Skip to content

Commit 9a4c4ed

Browse files
committed
wip
1 parent 6f85291 commit 9a4c4ed

29 files changed

+174
-77
lines changed

package/src/Menu/MenuGroup.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
namespace StackTrace\Ui\Menu;
55

66

7+
use Illuminate\Support\Collection;
78
use Illuminate\Support\Traits\Conditionable;
89
use StackTrace\Ui\Icon;
910
use StackTrace\Ui\ViewModel;
@@ -45,6 +46,40 @@ public function addUnless($value, MenuItem|MenuGroup $menu): static
4546
return $this->unless($value, fn (MenuGroup $group) => $group->add($menu));
4647
}
4748

49+
/**
50+
* Retrieve all items within the menu.
51+
*
52+
* @return \Illuminate\Support\Collection<int, \StackTrace\Ui\Menu\MenuItem|\StackTrace\Ui\Menu\MenuGroup>
53+
*/
54+
public function getItems(): Collection
55+
{
56+
return collect($this->items);
57+
}
58+
59+
/**
60+
* Retrieve id of the group.
61+
*/
62+
public function getId(): ?string
63+
{
64+
return $this->id;
65+
}
66+
67+
/**
68+
* Retrieve title of the group.
69+
*/
70+
public function getTitle(): ?string
71+
{
72+
return $this->title;
73+
}
74+
75+
/**
76+
* Retrieve icon of the group.
77+
*/
78+
public function getIcon(): ?Icon
79+
{
80+
return $this->icon;
81+
}
82+
4883
public function toView(): array
4984
{
5085
return [

package/src/Menu/MenuItem.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ public function title(string $title): static
4343
return $this;
4444
}
4545

46+
/**
47+
* Retrieve title of the item.
48+
*/
49+
public function getTitle(): string
50+
{
51+
return $this->title;
52+
}
53+
4654
/**
4755
* Set action on the menu item.
4856
*/
@@ -53,6 +61,14 @@ public function action(?Link $action): static
5361
return $this;
5462
}
5563

64+
/**
65+
* Retrieve action of the item.
66+
*/
67+
public function getAction(): ?Link
68+
{
69+
return $this->action;
70+
}
71+
5672
/**
5773
* Set icon on the menu item.
5874
*/
@@ -63,6 +79,14 @@ public function icon(?Icon $icon): static
6379
return $this;
6480
}
6581

82+
/**
83+
* Retrieve icon of the item.
84+
*/
85+
public function getIcon(): ?Icon
86+
{
87+
return $this->icon;
88+
}
89+
6690
/**
6791
* Set badge on the menu item.
6892
*/
@@ -73,6 +97,14 @@ public function badge(?string $badge): static
7397
return $this;
7498
}
7599

100+
/**
101+
* Retrieve badge of the item.
102+
*/
103+
public function getBadge(): ?string
104+
{
105+
return $this->badge;
106+
}
107+
76108
public function toView(): array
77109
{
78110
return [

package/stubs/components/DropdownMenu/DropdownMenu.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script setup lang="ts">
2-
import { DropdownMenuRoot, type DropdownMenuRootEmits, type DropdownMenuRootProps, useForwardPropsEmits } from 'radix-vue'
2+
import type { DropdownMenuRootEmits, DropdownMenuRootProps } from 'radix-vue'
3+
import { DropdownMenuRoot, useForwardPropsEmits } from 'radix-vue'
34
45
const props = defineProps<DropdownMenuRootProps>()
56
const emits = defineEmits<DropdownMenuRootEmits>()

package/stubs/components/DropdownMenu/DropdownMenuCheckboxItem.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<script setup lang="ts">
2-
import { type HTMLAttributes, computed } from 'vue'
2+
import type { DropdownMenuCheckboxItemEmits, DropdownMenuCheckboxItemProps } from 'radix-vue'
3+
import type { HTMLAttributes } from 'vue'
4+
import { cn } from '@/Utils'
5+
import { CheckIcon } from '@radix-icons/vue'
36
import {
47
DropdownMenuCheckboxItem,
5-
type DropdownMenuCheckboxItemEmits,
6-
type DropdownMenuCheckboxItemProps,
8+
79
DropdownMenuItemIndicator,
810
useForwardPropsEmits,
911
} from 'radix-vue'
10-
import { CheckIcon } from '@radix-icons/vue'
11-
import { cn } from '@/Utils'
12+
import { computed } from 'vue'
1213
1314
const props = defineProps<DropdownMenuCheckboxItemProps & { class?: HTMLAttributes['class'] }>()
1415
const emits = defineEmits<DropdownMenuCheckboxItemEmits>()

package/stubs/components/DropdownMenu/DropdownMenuContent.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<script setup lang="ts">
2-
import { type HTMLAttributes, computed } from 'vue'
2+
import type { DropdownMenuContentEmits, DropdownMenuContentProps } from 'radix-vue'
3+
import type { HTMLAttributes } from 'vue'
4+
import { cn } from '@/Utils'
35
import {
46
DropdownMenuContent,
5-
type DropdownMenuContentEmits,
6-
type DropdownMenuContentProps,
7+
78
DropdownMenuPortal,
89
useForwardPropsEmits,
910
} from 'radix-vue'
10-
import { cn } from '@/Utils'
11+
import { computed } from 'vue'
1112
1213
const props = withDefaults(
1314
defineProps<DropdownMenuContentProps & { class?: HTMLAttributes['class'] }>(),

package/stubs/components/DropdownMenu/DropdownMenuGroup.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script setup lang="ts">
2-
import { DropdownMenuGroup, type DropdownMenuGroupProps } from 'radix-vue'
2+
import type { DropdownMenuGroupProps } from 'radix-vue'
3+
import { DropdownMenuGroup } from 'radix-vue'
34
45
const props = defineProps<DropdownMenuGroupProps>()
56
</script>

package/stubs/components/DropdownMenu/DropdownMenuItem.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<script setup lang="ts">
2-
import { type HTMLAttributes, computed } from 'vue'
3-
import { DropdownMenuItem, type DropdownMenuItemProps, useForwardProps } from 'radix-vue'
2+
import type { DropdownMenuItemProps } from 'radix-vue'
3+
import type { HTMLAttributes } from 'vue'
44
import { cn } from '@/Utils'
5+
import { DropdownMenuItem, useForwardProps } from 'radix-vue'
6+
import { computed } from 'vue'
57
68
const props = defineProps<DropdownMenuItemProps & { class?: HTMLAttributes['class'], inset?: boolean }>()
79
@@ -18,7 +20,7 @@ const forwardedProps = useForwardProps(delegatedProps)
1820
<DropdownMenuItem
1921
v-bind="forwardedProps"
2022
:class="cn(
21-
'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
23+
'relative flex cursor-default select-none items-center rounded-sm gap-2 px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0',
2224
inset && 'pl-8',
2325
props.class,
2426
)"

package/stubs/components/DropdownMenu/DropdownMenuLabel.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<script setup lang="ts">
2-
import { type HTMLAttributes, computed } from 'vue'
3-
import { DropdownMenuLabel, type DropdownMenuLabelProps, useForwardProps } from 'radix-vue'
2+
import type { DropdownMenuLabelProps } from 'radix-vue'
3+
import type { HTMLAttributes } from 'vue'
44
import { cn } from '@/Utils'
5+
import { DropdownMenuLabel, useForwardProps } from 'radix-vue'
6+
import { computed } from 'vue'
57
68
const props = defineProps<DropdownMenuLabelProps & { class?: HTMLAttributes['class'], inset?: boolean }>()
79

package/stubs/components/DropdownMenu/DropdownMenuRadioGroup.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script setup lang="ts">
2+
import type { DropdownMenuRadioGroupEmits, DropdownMenuRadioGroupProps } from 'radix-vue'
23
import {
34
DropdownMenuRadioGroup,
4-
type DropdownMenuRadioGroupEmits,
5-
type DropdownMenuRadioGroupProps,
5+
66
useForwardPropsEmits,
77
} from 'radix-vue'
88

package/stubs/components/DropdownMenu/DropdownMenuRadioItem.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<script setup lang="ts">
2-
import { type HTMLAttributes, computed } from 'vue'
2+
import type { DropdownMenuRadioItemEmits, DropdownMenuRadioItemProps } from 'radix-vue'
3+
import type { HTMLAttributes } from 'vue'
4+
import { cn } from '@/Utils'
5+
import { DotFilledIcon } from '@radix-icons/vue'
36
import {
47
DropdownMenuItemIndicator,
58
DropdownMenuRadioItem,
6-
type DropdownMenuRadioItemEmits,
7-
type DropdownMenuRadioItemProps,
9+
810
useForwardPropsEmits,
911
} from 'radix-vue'
10-
import { DotFilledIcon } from '@radix-icons/vue'
11-
import { cn } from '@/Utils'
12+
import { computed } from 'vue'
1213
1314
const props = defineProps<DropdownMenuRadioItemProps & { class?: HTMLAttributes['class'] }>()
1415

0 commit comments

Comments
 (0)