@nuxt/ui 3.0.2 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/.nuxt/ui/accordion.ts +2 -2
  2. package/.nuxt/ui/alert.ts +29 -29
  3. package/.nuxt/ui/avatar-group.ts +1 -1
  4. package/.nuxt/ui/avatar.ts +3 -3
  5. package/.nuxt/ui/badge.ts +33 -33
  6. package/.nuxt/ui/breadcrumb.ts +5 -5
  7. package/.nuxt/ui/button.ts +43 -43
  8. package/.nuxt/ui/calendar.ts +17 -17
  9. package/.nuxt/ui/card.ts +5 -5
  10. package/.nuxt/ui/carousel.ts +6 -6
  11. package/.nuxt/ui/checkbox-group.ts +61 -0
  12. package/.nuxt/ui/checkbox.ts +140 -27
  13. package/.nuxt/ui/chip.ts +8 -8
  14. package/.nuxt/ui/color-picker.ts +3 -3
  15. package/.nuxt/ui/command-palette.ts +14 -14
  16. package/.nuxt/ui/context-menu.ts +33 -33
  17. package/.nuxt/ui/drawer.ts +10 -10
  18. package/.nuxt/ui/dropdown-menu.ts +34 -34
  19. package/.nuxt/ui/form-field.ts +6 -6
  20. package/.nuxt/ui/index.ts +1 -0
  21. package/.nuxt/ui/input-menu.ts +42 -42
  22. package/.nuxt/ui/input-number.ts +20 -20
  23. package/.nuxt/ui/input.ts +23 -23
  24. package/.nuxt/ui/kbd.ts +4 -4
  25. package/.nuxt/ui/link.ts +3 -3
  26. package/.nuxt/ui/modal.ts +5 -5
  27. package/.nuxt/ui/navigation-menu.ts +78 -80
  28. package/.nuxt/ui/pin-input.ts +20 -20
  29. package/.nuxt/ui/popover.ts +2 -2
  30. package/.nuxt/ui/progress.ts +17 -17
  31. package/.nuxt/ui/radio-group.ts +250 -35
  32. package/.nuxt/ui/select-menu.ts +36 -33
  33. package/.nuxt/ui/select.ts +32 -32
  34. package/.nuxt/ui/separator.ts +8 -8
  35. package/.nuxt/ui/skeleton.ts +1 -1
  36. package/.nuxt/ui/slideover.ts +4 -4
  37. package/.nuxt/ui/slider.ts +16 -16
  38. package/.nuxt/ui/stepper.ts +18 -18
  39. package/.nuxt/ui/switch.ts +20 -20
  40. package/.nuxt/ui/table.ts +15 -15
  41. package/.nuxt/ui/tabs.ts +32 -32
  42. package/.nuxt/ui/textarea.ts +40 -35
  43. package/.nuxt/ui/toast.ts +24 -24
  44. package/.nuxt/ui/tooltip.ts +2 -2
  45. package/.nuxt/ui/tree.ts +18 -18
  46. package/.nuxt/ui.css +63 -12
  47. package/README.md +15 -0
  48. package/cli/templates.mjs +18 -17
  49. package/dist/module.json +5 -5
  50. package/dist/module.mjs +12 -7
  51. package/dist/runtime/components/Accordion.vue +36 -93
  52. package/dist/runtime/components/Accordion.vue.d.ts +75 -0
  53. package/dist/runtime/components/Alert.vue +37 -100
  54. package/dist/runtime/components/Alert.vue.d.ts +81 -0
  55. package/dist/runtime/components/App.vue +28 -34
  56. package/dist/runtime/components/App.vue.d.ts +24 -0
  57. package/dist/runtime/components/Avatar.vue +42 -75
  58. package/dist/runtime/components/Avatar.vue.d.ts +39 -0
  59. package/dist/runtime/components/AvatarGroup.vue +40 -77
  60. package/dist/runtime/components/AvatarGroup.vue.d.ts +31 -0
  61. package/dist/runtime/components/Badge.vue +33 -62
  62. package/dist/runtime/components/Badge.vue.d.ts +41 -0
  63. package/dist/runtime/components/Breadcrumb.vue +37 -90
  64. package/dist/runtime/components/Breadcrumb.vue.d.ts +64 -0
  65. package/dist/runtime/components/Button.vue +95 -104
  66. package/dist/runtime/components/Button.vue.d.ts +48 -0
  67. package/dist/runtime/components/ButtonGroup.vue +20 -46
  68. package/dist/runtime/components/ButtonGroup.vue.d.ts +34 -0
  69. package/dist/runtime/components/Calendar.vue +67 -150
  70. package/dist/runtime/components/Calendar.vue.d.ts +111 -0
  71. package/dist/runtime/components/Card.vue +18 -40
  72. package/dist/runtime/components/Card.vue.d.ts +29 -0
  73. package/dist/runtime/components/Carousel.vue +112 -234
  74. package/dist/runtime/components/Carousel.vue.d.ts +122 -0
  75. package/dist/runtime/components/Checkbox.vue +52 -93
  76. package/dist/runtime/components/Checkbox.vue.d.ts +73 -0
  77. package/dist/runtime/components/CheckboxGroup.vue +121 -0
  78. package/dist/runtime/components/CheckboxGroup.vue.d.ts +78 -0
  79. package/dist/runtime/components/Chip.vue +26 -69
  80. package/dist/runtime/components/Chip.vue.d.ts +57 -0
  81. package/dist/runtime/components/Collapsible.vue +22 -41
  82. package/dist/runtime/components/Collapsible.vue.d.ts +35 -0
  83. package/dist/runtime/components/ColorPicker.vue +111 -197
  84. package/dist/runtime/components/ColorPicker.vue.d.ts +48 -0
  85. package/dist/runtime/components/CommandPalette.vue +96 -237
  86. package/dist/runtime/components/CommandPalette.vue.d.ts +161 -0
  87. package/dist/runtime/components/Container.vue +15 -28
  88. package/dist/runtime/components/Container.vue.d.ts +18 -0
  89. package/dist/runtime/components/ContextMenu.vue +34 -133
  90. package/dist/runtime/components/ContextMenu.vue.d.ts +107 -0
  91. package/dist/runtime/components/ContextMenuContent.vue +73 -81
  92. package/dist/runtime/components/ContextMenuContent.vue.d.ts +65 -0
  93. package/dist/runtime/components/Drawer.vue +49 -83
  94. package/dist/runtime/components/Drawer.vue.d.ts +78 -0
  95. package/dist/runtime/components/DropdownMenu.vue +39 -142
  96. package/dist/runtime/components/DropdownMenu.vue.d.ts +117 -0
  97. package/dist/runtime/components/DropdownMenuContent.vue +78 -88
  98. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +68 -0
  99. package/dist/runtime/components/Form.vue +135 -220
  100. package/dist/runtime/components/Form.vue.d.ts +69 -0
  101. package/dist/runtime/components/FormField.vue +35 -77
  102. package/dist/runtime/components/FormField.vue.d.ts +61 -0
  103. package/dist/runtime/components/Icon.vue +12 -19
  104. package/dist/runtime/components/Icon.vue.d.ts +8 -0
  105. package/dist/runtime/components/Input.vue +82 -140
  106. package/dist/runtime/components/Input.vue.d.ts +76 -0
  107. package/dist/runtime/components/InputMenu.vue +185 -332
  108. package/dist/runtime/components/InputMenu.vue.d.ts +324 -0
  109. package/dist/runtime/components/InputNumber.vue +71 -133
  110. package/dist/runtime/components/InputNumber.vue.d.ts +182 -0
  111. package/dist/runtime/components/Kbd.vue +20 -46
  112. package/dist/runtime/components/Kbd.vue.d.ts +34 -0
  113. package/dist/runtime/components/Link.vue +98 -176
  114. package/dist/runtime/components/Link.vue.d.ts +93 -0
  115. package/dist/runtime/components/LinkBase.vue +33 -42
  116. package/dist/runtime/components/LinkBase.vue.d.ts +25 -0
  117. package/dist/runtime/components/Modal.vue +53 -116
  118. package/dist/runtime/components/Modal.vue.d.ts +93 -0
  119. package/dist/runtime/components/NavigationMenu.vue +77 -209
  120. package/dist/runtime/components/NavigationMenu.vue.d.ts +139 -0
  121. package/dist/runtime/components/OverlayProvider.vue +14 -18
  122. package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
  123. package/dist/runtime/components/Pagination.vue +46 -140
  124. package/dist/runtime/components/Pagination.vue.d.ts +119 -0
  125. package/dist/runtime/components/PinInput.vue +61 -78
  126. package/dist/runtime/components/PinInput.vue.d.ts +57 -0
  127. package/dist/runtime/components/Popover.vue +47 -84
  128. package/dist/runtime/components/Popover.vue.d.ts +63 -0
  129. package/dist/runtime/components/Progress.vue +70 -131
  130. package/dist/runtime/components/Progress.vue.d.ts +66 -0
  131. package/dist/runtime/components/RadioGroup.vue +70 -132
  132. package/dist/runtime/components/RadioGroup.vue.d.ts +91 -0
  133. package/dist/runtime/components/Select.vue +110 -224
  134. package/dist/runtime/components/Select.vue.d.ts +145 -0
  135. package/dist/runtime/components/SelectMenu.vue +161 -310
  136. package/dist/runtime/components/SelectMenu.vue.d.ts +196 -0
  137. package/dist/runtime/components/Separator.vue +29 -71
  138. package/dist/runtime/components/Separator.vue.d.ts +54 -0
  139. package/dist/runtime/components/Skeleton.vue +21 -23
  140. package/dist/runtime/components/Skeleton.vue.d.ts +17 -0
  141. package/dist/runtime/components/Slideover.vue +53 -120
  142. package/dist/runtime/components/Slideover.vue.d.ts +94 -0
  143. package/dist/runtime/components/Slider.vue +46 -84
  144. package/dist/runtime/components/Slider.vue.d.ts +52 -0
  145. package/dist/runtime/components/Stepper.vue +45 -115
  146. package/dist/runtime/components/Stepper.vue.d.ts +83 -0
  147. package/dist/runtime/components/Switch.vue +45 -93
  148. package/dist/runtime/components/Switch.vue.d.ts +70 -0
  149. package/dist/runtime/components/Table.vue +163 -267
  150. package/dist/runtime/components/Table.vue.d.ts +183 -0
  151. package/dist/runtime/components/Tabs.vue +41 -107
  152. package/dist/runtime/components/Tabs.vue.d.ts +88 -0
  153. package/dist/runtime/components/Textarea.vue +113 -158
  154. package/dist/runtime/components/Textarea.vue.d.ts +78 -0
  155. package/dist/runtime/components/Toast.vue +49 -110
  156. package/dist/runtime/components/Toast.vue.d.ts +157 -0
  157. package/dist/runtime/components/Toaster.vue +70 -107
  158. package/dist/runtime/components/Toaster.vue.d.ts +38 -0
  159. package/dist/runtime/components/Tooltip.vue +38 -65
  160. package/dist/runtime/components/Tooltip.vue.d.ts +50 -0
  161. package/dist/runtime/components/Tree.vue +59 -166
  162. package/dist/runtime/components/Tree.vue.d.ts +111 -0
  163. package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
  164. package/dist/runtime/composables/defineShortcuts.js +6 -0
  165. package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
  166. package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
  167. package/dist/runtime/composables/useFormField.d.ts +2 -2
  168. package/dist/runtime/composables/useKbd.d.ts +1 -0
  169. package/dist/runtime/composables/useKbd.js +4 -3
  170. package/dist/runtime/composables/useOverlay.d.ts +14 -8
  171. package/dist/runtime/composables/useOverlay.js +20 -7
  172. package/dist/runtime/composables/usePortal.d.ts +6 -0
  173. package/dist/runtime/composables/usePortal.js +17 -0
  174. package/dist/runtime/index.css +1 -1
  175. package/dist/runtime/inertia/components/Link.vue +146 -0
  176. package/dist/runtime/inertia/components/Link.vue.d.ts +63 -0
  177. package/dist/runtime/inertia/stubs.d.ts +43 -0
  178. package/dist/runtime/inertia/stubs.js +82 -0
  179. package/dist/runtime/locale/bg.d.ts +3 -0
  180. package/dist/runtime/locale/bg.js +54 -0
  181. package/dist/runtime/locale/index.d.ts +5 -1
  182. package/dist/runtime/locale/index.js +5 -1
  183. package/dist/runtime/locale/kk.d.ts +3 -0
  184. package/dist/runtime/locale/kk.js +54 -0
  185. package/dist/runtime/locale/tj.d.ts +3 -0
  186. package/dist/runtime/locale/tj.js +54 -0
  187. package/dist/runtime/locale/ug_cn.d.ts +3 -0
  188. package/dist/runtime/locale/ug_cn.js +55 -0
  189. package/dist/runtime/types/form.d.ts +4 -1
  190. package/dist/runtime/types/index.d.ts +1 -0
  191. package/dist/runtime/types/index.js +1 -0
  192. package/dist/runtime/types/tv.d.ts +53 -0
  193. package/dist/runtime/types/tv.js +0 -0
  194. package/dist/runtime/types/utils.d.ts +7 -17
  195. package/dist/runtime/types/utils.js +1 -0
  196. package/dist/runtime/utils/link.d.ts +3 -3
  197. package/dist/runtime/utils/link.js +1 -0
  198. package/dist/runtime/utils/tv.js +2 -2
  199. package/dist/runtime/vue/components/Icon.vue +7 -8
  200. package/dist/runtime/vue/components/Icon.vue.d.ts +5 -0
  201. package/dist/runtime/vue/components/Link.vue +118 -202
  202. package/dist/runtime/vue/components/Link.vue.d.ts +93 -0
  203. package/dist/runtime/vue/stubs.d.ts +2 -2
  204. package/dist/shared/{ui.BkNUP964.mjs → ui.CbtTMMzt.mjs} +631 -366
  205. package/dist/types.d.mts +3 -5
  206. package/dist/unplugin.d.mts +6 -2
  207. package/dist/unplugin.mjs +25 -4
  208. package/dist/vite.d.mts +1 -1
  209. package/dist/vite.mjs +2 -2
  210. package/package.json +96 -54
  211. package/dist/module.cjs +0 -62
  212. package/dist/module.d.cts +0 -45
  213. package/dist/module.d.ts +0 -45
  214. package/dist/shared/ui.BL-XB3u1.cjs +0 -3555
  215. package/dist/types.d.ts +0 -7
  216. package/dist/unplugin.cjs +0 -232
  217. package/dist/unplugin.d.cts +0 -62
  218. package/dist/unplugin.d.ts +0 -62
  219. package/dist/vite.cjs +0 -23
  220. package/dist/vite.d.cts +0 -15
  221. package/dist/vite.d.ts +0 -15
@@ -1,100 +1,87 @@
1
- <!-- eslint-disable vue/block-tag-newline -->
2
- <script lang="ts">
3
- import type { DropdownMenuContentProps as RekaDropdownMenuContentProps, DropdownMenuContentEmits as RekaDropdownMenuContentEmits } from 'reka-ui'
4
- import theme from '#build/ui/dropdown-menu'
5
- import { tv } from '../utils/tv'
6
- import type { KbdProps, AvatarProps, DropdownMenuItem, DropdownMenuSlots } from '../types'
7
- import type { ArrayOrNested, NestedItem } from '../types/utils'
8
-
9
- const _dropdownMenu = tv(theme)()
10
-
11
- interface DropdownMenuContentProps<T extends ArrayOrNested<DropdownMenuItem>> extends Omit<RekaDropdownMenuContentProps, 'as' | 'asChild' | 'forceMount'> {
12
- items?: T
13
- portal?: boolean
14
- sub?: boolean
15
- labelKey: keyof NestedItem<T>
16
- /**
17
- * @IconifyIcon
18
- */
19
- checkedIcon?: string
20
- /**
21
- * @IconifyIcon
22
- */
23
- loadingIcon?: string
24
- /**
25
- * @IconifyIcon
26
- */
27
- externalIcon?: boolean | string
28
- class?: any
29
- ui: typeof _dropdownMenu
30
- uiOverride?: any
31
- }
32
-
33
- interface DropdownMenuContentEmits extends RekaDropdownMenuContentEmits {}
34
-
35
- type DropdownMenuContentSlots<T extends ArrayOrNested<DropdownMenuItem>> = Omit<DropdownMenuSlots<T>, 'default'> & {
36
- default(props?: {}): any
37
- }
1
+ <script>
38
2
 
39
3
  </script>
40
4
 
41
- <script setup lang="ts" generic="T extends ArrayOrNested<DropdownMenuItem>">
42
- import { computed } from 'vue'
43
- import { DropdownMenu } from 'reka-ui/namespaced'
44
- import { useForwardPropsEmits } from 'reka-ui'
45
- import { reactiveOmit, createReusableTemplate } from '@vueuse/core'
46
- import { useAppConfig } from '#imports'
47
- import { omit, get, isArrayOfArray } from '../utils'
48
- import { pickLinkProps } from '../utils/link'
49
- import ULinkBase from './LinkBase.vue'
50
- import ULink from './Link.vue'
51
- import UAvatar from './Avatar.vue'
52
- import UIcon from './Icon.vue'
53
- import UKbd from './Kbd.vue'
54
- // eslint-disable-next-line import/no-self-import
55
- import UDropdownMenuContent from './DropdownMenuContent.vue'
56
-
57
- const props = defineProps<DropdownMenuContentProps<T>>()
58
- const emits = defineEmits<DropdownMenuContentEmits>()
59
- const slots = defineSlots<DropdownMenuContentSlots<T>>()
60
-
61
- const appConfig = useAppConfig()
62
- const contentProps = useForwardPropsEmits(reactiveOmit(props, 'sub', 'items', 'portal', 'labelKey', 'checkedIcon', 'loadingIcon', 'externalIcon', 'class', 'ui', 'uiOverride'), emits)
63
- const proxySlots = omit(slots, ['default'])
64
-
65
- const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate<{ item: DropdownMenuItem, active?: boolean, index: number }>()
66
-
67
- const groups = computed<DropdownMenuItem[][]>(() =>
68
- props.items?.length
69
- ? isArrayOfArray(props.items)
70
- ? props.items
71
- : [props.items]
72
- : []
73
- )
5
+ <script setup>
6
+ import { computed, toRef } from "vue";
7
+ import { DropdownMenu } from "reka-ui/namespaced";
8
+ import { useForwardPropsEmits } from "reka-ui";
9
+ import { reactiveOmit, createReusableTemplate } from "@vueuse/core";
10
+ import { useAppConfig } from "#imports";
11
+ import { useLocale } from "../composables/useLocale";
12
+ import { usePortal } from "../composables/usePortal";
13
+ import { omit, get, isArrayOfArray } from "../utils";
14
+ import { pickLinkProps } from "../utils/link";
15
+ import ULinkBase from "./LinkBase.vue";
16
+ import ULink from "./Link.vue";
17
+ import UAvatar from "./Avatar.vue";
18
+ import UIcon from "./Icon.vue";
19
+ import UKbd from "./Kbd.vue";
20
+ import UDropdownMenuContent from "./DropdownMenuContent.vue";
21
+ const props = defineProps({
22
+ items: { type: null, required: false },
23
+ portal: { type: [Boolean, String], required: false, skipCheck: true },
24
+ sub: { type: Boolean, required: false },
25
+ labelKey: { type: null, required: true },
26
+ checkedIcon: { type: String, required: false },
27
+ loadingIcon: { type: String, required: false },
28
+ externalIcon: { type: [Boolean, String], required: false },
29
+ class: { type: null, required: false },
30
+ ui: { type: null, required: true },
31
+ uiOverride: { type: null, required: false },
32
+ loop: { type: Boolean, required: false },
33
+ side: { type: null, required: false },
34
+ sideOffset: { type: Number, required: false },
35
+ align: { type: null, required: false },
36
+ alignOffset: { type: Number, required: false },
37
+ avoidCollisions: { type: Boolean, required: false },
38
+ collisionBoundary: { type: null, required: false },
39
+ collisionPadding: { type: [Number, Object], required: false },
40
+ arrowPadding: { type: Number, required: false },
41
+ sticky: { type: String, required: false },
42
+ hideWhenDetached: { type: Boolean, required: false },
43
+ positionStrategy: { type: String, required: false },
44
+ updatePositionStrategy: { type: String, required: false },
45
+ disableUpdateOnLayoutShift: { type: Boolean, required: false },
46
+ prioritizePosition: { type: Boolean, required: false },
47
+ reference: { type: null, required: false }
48
+ });
49
+ const emits = defineEmits(["escapeKeyDown", "pointerDownOutside", "focusOutside", "interactOutside", "closeAutoFocus"]);
50
+ const slots = defineSlots();
51
+ const { dir } = useLocale();
52
+ const appConfig = useAppConfig();
53
+ const portalProps = usePortal(toRef(() => props.portal));
54
+ const contentProps = useForwardPropsEmits(reactiveOmit(props, "sub", "items", "portal", "labelKey", "checkedIcon", "loadingIcon", "externalIcon", "class", "ui", "uiOverride"), emits);
55
+ const proxySlots = omit(slots, ["default"]);
56
+ const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate();
57
+ const childrenIcon = computed(() => dir.value === "rtl" ? appConfig.ui.icons.chevronLeft : appConfig.ui.icons.chevronRight);
58
+ const groups = computed(
59
+ () => props.items?.length ? isArrayOfArray(props.items) ? props.items : [props.items] : []
60
+ );
74
61
  </script>
75
62
 
76
63
  <template>
77
64
  <DefineItemTemplate v-slot="{ item, active, index }">
78
- <slot :name="((item.slot || 'item') as keyof DropdownMenuContentSlots<T>)" :item="(item as Extract<NestedItem<T>, { slot: string; }>)" :index="index">
79
- <slot :name="((item.slot ? `${item.slot}-leading`: 'item-leading') as keyof DropdownMenuContentSlots<T>)" :item="(item as Extract<NestedItem<T>, { slot: string; }>)" :active="active" :index="index">
65
+ <slot :name="item.slot || 'item'" :item="item" :index="index">
66
+ <slot :name="item.slot ? `${item.slot}-leading` : 'item-leading'" :item="item" :active="active" :index="index">
80
67
  <UIcon v-if="item.loading" :name="loadingIcon || appConfig.ui.icons.loading" :class="ui.itemLeadingIcon({ class: uiOverride?.itemLeadingIcon, color: item?.color, loading: true })" />
81
68
  <UIcon v-else-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: uiOverride?.itemLeadingIcon, color: item?.color, active })" />
82
- <UAvatar v-else-if="item.avatar" :size="((props.uiOverride?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: uiOverride?.itemLeadingAvatar, active })" />
69
+ <UAvatar v-else-if="item.avatar" :size="props.uiOverride?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: uiOverride?.itemLeadingAvatar, active })" />
83
70
  </slot>
84
71
 
85
- <span v-if="get(item, props.labelKey as string) || !!slots[(item.slot ? `${item.slot}-label`: 'item-label') as keyof DropdownMenuContentSlots<T>]" :class="ui.itemLabel({ class: uiOverride?.itemLabel, active })">
86
- <slot :name="((item.slot ? `${item.slot}-label`: 'item-label') as keyof DropdownMenuContentSlots<T>)" :item="(item as Extract<NestedItem<T>, { slot: string; }>)" :active="active" :index="index">
87
- {{ get(item, props.labelKey as string) }}
72
+ <span v-if="get(item, props.labelKey) || !!slots[item.slot ? `${item.slot}-label` : 'item-label']" :class="ui.itemLabel({ class: uiOverride?.itemLabel, active })">
73
+ <slot :name="item.slot ? `${item.slot}-label` : 'item-label'" :item="item" :active="active" :index="index">
74
+ {{ get(item, props.labelKey) }}
88
75
  </slot>
89
76
 
90
77
  <UIcon v-if="item.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.itemLabelExternalIcon({ class: uiOverride?.itemLabelExternalIcon, color: item?.color, active })" />
91
78
  </span>
92
79
 
93
80
  <span :class="ui.itemTrailing({ class: uiOverride?.itemTrailing })">
94
- <slot :name="((item.slot ? `${item.slot}-trailing`: 'item-trailing') as keyof DropdownMenuContentSlots<T>)" :item="(item as Extract<NestedItem<T>, { slot: string; }>)" :active="active" :index="index">
95
- <UIcon v-if="item.children?.length" :name="appConfig.ui.icons.chevronRight" :class="ui.itemTrailingIcon({ class: uiOverride?.itemTrailingIcon, color: item?.color, active })" />
81
+ <slot :name="item.slot ? `${item.slot}-trailing` : 'item-trailing'" :item="item" :active="active" :index="index">
82
+ <UIcon v-if="item.children?.length" :name="childrenIcon" :class="ui.itemTrailingIcon({ class: uiOverride?.itemTrailingIcon, color: item?.color, active })" />
96
83
  <span v-else-if="item.kbds?.length" :class="ui.itemTrailingKbds({ class: uiOverride?.itemTrailingKbds })">
97
- <UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="((props.uiOverride?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()) as KbdProps['size'])" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
84
+ <UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="props.uiOverride?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
98
85
  </span>
99
86
  </slot>
100
87
 
@@ -105,8 +92,10 @@ const groups = computed<DropdownMenuItem[][]>(() =>
105
92
  </slot>
106
93
  </DefineItemTemplate>
107
94
 
108
- <DropdownMenu.Portal :disabled="!portal">
95
+ <DropdownMenu.Portal v-bind="portalProps">
109
96
  <component :is="sub ? DropdownMenu.SubContent : DropdownMenu.Content" :class="props.class" v-bind="contentProps">
97
+ <slot name="content-top" />
98
+
110
99
  <DropdownMenu.Group v-for="(group, groupIndex) in groups" :key="`group-${groupIndex}`" :class="ui.group({ class: uiOverride?.group })">
111
100
  <template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
112
101
  <DropdownMenu.Label v-if="item.type === 'label'" :class="ui.label({ class: uiOverride?.label })">
@@ -118,7 +107,7 @@ const groups = computed<DropdownMenuItem[][]>(() =>
118
107
  as="button"
119
108
  type="button"
120
109
  :disabled="item.disabled"
121
- :text-value="get(item, props.labelKey as string)"
110
+ :text-value="get(item, props.labelKey)"
122
111
  :class="ui.item({ class: uiOverride?.item, color: item?.color })"
123
112
  >
124
113
  <ReuseItemTemplate :item="item" :index="index" />
@@ -130,8 +119,7 @@ const groups = computed<DropdownMenuItem[][]>(() =>
130
119
  :ui="ui"
131
120
  :ui-override="uiOverride"
132
121
  :portal="portal"
133
- :items="(item.children as T)"
134
- side="right"
122
+ :items="item.children"
135
123
  align="start"
136
124
  :align-offset="-4"
137
125
  :side-offset="3"
@@ -141,8 +129,8 @@ const groups = computed<DropdownMenuItem[][]>(() =>
141
129
  :external-icon="externalIcon"
142
130
  v-bind="item.content"
143
131
  >
144
- <template v-for="(_, name) in proxySlots" #[name]="slotData: any">
145
- <slot :name="(name as keyof DropdownMenuContentSlots<T>)" v-bind="slotData" />
132
+ <template v-for="(_, name) in proxySlots" #[name]="slotData">
133
+ <slot :name="name" v-bind="slotData" />
146
134
  </template>
147
135
  </UDropdownMenuContent>
148
136
  </DropdownMenu.Sub>
@@ -150,7 +138,7 @@ const groups = computed<DropdownMenuItem[][]>(() =>
150
138
  v-else-if="item.type === 'checkbox'"
151
139
  :model-value="item.checked"
152
140
  :disabled="item.disabled"
153
- :text-value="get(item, props.labelKey as string)"
141
+ :text-value="get(item, props.labelKey)"
154
142
  :class="ui.item({ class: [uiOverride?.item, item.class], color: item?.color })"
155
143
  @update:model-value="item.onUpdateChecked"
156
144
  @select="item.onSelect"
@@ -161,10 +149,10 @@ const groups = computed<DropdownMenuItem[][]>(() =>
161
149
  v-else
162
150
  as-child
163
151
  :disabled="item.disabled"
164
- :text-value="get(item, props.labelKey as string)"
152
+ :text-value="get(item, props.labelKey)"
165
153
  @select="item.onSelect"
166
154
  >
167
- <ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item as Omit<DropdownMenuItem, 'type'>)" custom>
155
+ <ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
168
156
  <ULinkBase v-bind="slotProps" :class="ui.item({ class: [uiOverride?.item, item.class], color: item?.color, active })">
169
157
  <ReuseItemTemplate :item="item" :active="active" :index="index" />
170
158
  </ULinkBase>
@@ -174,6 +162,8 @@ const groups = computed<DropdownMenuItem[][]>(() =>
174
162
  </DropdownMenu.Group>
175
163
 
176
164
  <slot />
165
+
166
+ <slot name="content-bottom" />
177
167
  </component>
178
168
  </DropdownMenu.Portal>
179
169
  </template>
@@ -0,0 +1,68 @@
1
+ import { DropdownMenu } from 'reka-ui/namespaced';
2
+ import type { DropdownMenuContentProps as RekaDropdownMenuContentProps } from 'reka-ui';
3
+ import type { AppConfig } from '@nuxt/schema';
4
+ import type theme from '#build/ui/dropdown-menu';
5
+ import type { DropdownMenuItem, DropdownMenuSlots } from '../types';
6
+ import type { ArrayOrNested, NestedItem, ComponentConfig } from '../types/utils';
7
+ type DropdownMenu = ComponentConfig<typeof theme, AppConfig, 'dropdownMenu'>;
8
+ interface DropdownMenuContentProps<T extends ArrayOrNested<DropdownMenuItem>> extends Omit<RekaDropdownMenuContentProps, 'as' | 'asChild' | 'forceMount'> {
9
+ items?: T;
10
+ portal?: boolean | string | HTMLElement;
11
+ sub?: boolean;
12
+ labelKey: keyof NestedItem<T>;
13
+ /**
14
+ * @IconifyIcon
15
+ */
16
+ checkedIcon?: string;
17
+ /**
18
+ * @IconifyIcon
19
+ */
20
+ loadingIcon?: string;
21
+ /**
22
+ * @IconifyIcon
23
+ */
24
+ externalIcon?: boolean | string;
25
+ class?: any;
26
+ ui: {
27
+ [K in keyof Required<DropdownMenu['slots']>]: (props?: Record<string, any>) => string;
28
+ };
29
+ uiOverride?: DropdownMenu['slots'];
30
+ }
31
+ type DropdownMenuContentSlots<T extends ArrayOrNested<DropdownMenuItem>> = Omit<DropdownMenuSlots<T>, 'default'> & {
32
+ default(props?: {}): any;
33
+ };
34
+ declare const _default: <T extends ArrayOrNested<DropdownMenuItem>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
35
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
36
+ readonly onEscapeKeyDown?: ((event: KeyboardEvent) => any) | undefined;
37
+ readonly onPointerDownOutside?: ((event: CustomEvent<{
38
+ originalEvent: PointerEvent;
39
+ }>) => any) | undefined;
40
+ readonly onFocusOutside?: ((event: CustomEvent<{
41
+ originalEvent: FocusEvent;
42
+ }>) => any) | undefined;
43
+ readonly onInteractOutside?: ((event: CustomEvent<{
44
+ originalEvent: PointerEvent;
45
+ }> | CustomEvent<{
46
+ originalEvent: FocusEvent;
47
+ }>) => any) | undefined;
48
+ readonly onCloseAutoFocus?: ((event: Event) => any) | undefined;
49
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onEscapeKeyDown" | "onPointerDownOutside" | "onFocusOutside" | "onInteractOutside" | "onCloseAutoFocus"> & DropdownMenuContentProps<T> & Partial<{}>> & import("vue").PublicProps;
50
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
51
+ attrs: any;
52
+ slots: DropdownMenuContentSlots<T>;
53
+ emit: ((evt: "escapeKeyDown", event: KeyboardEvent) => void) & ((evt: "pointerDownOutside", event: CustomEvent<{
54
+ originalEvent: PointerEvent;
55
+ }>) => void) & ((evt: "focusOutside", event: CustomEvent<{
56
+ originalEvent: FocusEvent;
57
+ }>) => void) & ((evt: "interactOutside", event: CustomEvent<{
58
+ originalEvent: PointerEvent;
59
+ }> | CustomEvent<{
60
+ originalEvent: FocusEvent;
61
+ }>) => void) & ((evt: "closeAutoFocus", event: Event) => void);
62
+ }>) => import("vue").VNode & {
63
+ __ctx?: Awaited<typeof __VLS_setup>;
64
+ };
65
+ export default _default;
66
+ type __VLS_PrettifyLocal<T> = {
67
+ [K in keyof T]: T[K];
68
+ } & {};