@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,90 +1,56 @@
1
- <script lang="ts">
2
- import type { DrawerRootProps, DrawerRootEmits } from 'vaul-vue'
3
- import type { DialogContentProps, DialogContentEmits } from 'reka-ui'
4
- import type { AppConfig } from '@nuxt/schema'
5
- import _appConfig from '#build/app.config'
6
- import theme from '#build/ui/drawer'
7
- import { tv } from '../utils/tv'
8
- import type { EmitsToProps } from '../types/utils'
9
-
10
- const appConfigDrawer = _appConfig as AppConfig & { ui: { drawer: Partial<typeof theme> } }
11
-
12
- const drawer = tv({ extend: tv(theme), ...(appConfigDrawer.ui?.drawer || {}) })
13
-
14
- export interface DrawerProps extends Pick<DrawerRootProps, 'activeSnapPoint' | 'closeThreshold' | 'shouldScaleBackground' | 'setBackgroundColorOnScale' | 'scrollLockTimeout' | 'fixed' | 'dismissible' | 'modal' | 'open' | 'defaultOpen' | 'nested' | 'direction' | 'noBodyStyles' | 'handleOnly' | 'preventScrollRestoration' | 'snapPoints'> {
15
- /**
16
- * The element or component this component should render as.
17
- * @defaultValue 'div'
18
- */
19
- as?: any
20
- title?: string
21
- description?: string
22
- /**
23
- * Whether to inset the drawer from the edges.
24
- * @defaultValue false
25
- */
26
- inset?: boolean
27
- /** The content of the drawer. */
28
- content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<DialogContentEmits>>
29
- /**
30
- * Render an overlay behind the drawer.
31
- * @defaultValue true
32
- */
33
- overlay?: boolean
34
- /**
35
- * Render a handle on the drawer.
36
- * @defaultValue true
37
- */
38
- handle?: boolean
39
- /**
40
- * Render the drawer in a portal.
41
- * @defaultValue true
42
- */
43
- portal?: boolean
44
- class?: any
45
- ui?: Partial<typeof drawer.slots>
46
- }
47
-
48
- export interface DrawerEmits extends DrawerRootEmits {}
49
-
50
- export interface DrawerSlots {
51
- default(props?: {}): any
52
- content(props?: {}): any
53
- header(props?: {}): any
54
- title(props?: {}): any
55
- description(props?: {}): any
56
- body(props?: {}): any
57
- footer(props?: {}): any
58
- }
1
+ <script>
2
+ import theme from "#build/ui/drawer";
59
3
  </script>
60
4
 
61
- <script setup lang="ts">
62
- import { computed, toRef } from 'vue'
63
- import { useForwardPropsEmits } from 'reka-ui'
64
- import { DrawerRoot, DrawerTrigger, DrawerPortal, DrawerOverlay, DrawerContent, DrawerTitle, DrawerDescription, DrawerHandle } from 'vaul-vue'
65
- import { reactivePick } from '@vueuse/core'
66
-
67
- const props = withDefaults(defineProps<DrawerProps>(), {
68
- direction: 'bottom',
69
- portal: true,
70
- overlay: true,
71
- handle: true,
72
- modal: true,
73
- dismissible: true
74
- })
75
- const emits = defineEmits<DrawerEmits>()
76
- const slots = defineSlots<DrawerSlots>()
77
-
78
- const rootProps = useForwardPropsEmits(reactivePick(props, 'activeSnapPoint', 'closeThreshold', 'shouldScaleBackground', 'setBackgroundColorOnScale', 'scrollLockTimeout', 'fixed', 'dismissible', 'modal', 'open', 'defaultOpen', 'nested', 'direction', 'noBodyStyles', 'handleOnly', 'preventScrollRestoration', 'snapPoints'), emits)
79
- const contentProps = toRef(() => props.content)
5
+ <script setup>
6
+ import { computed, toRef } from "vue";
7
+ import { useForwardPropsEmits } from "reka-ui";
8
+ import { DrawerRoot, DrawerTrigger, DrawerPortal, DrawerOverlay, DrawerContent, DrawerTitle, DrawerDescription, DrawerHandle } from "vaul-vue";
9
+ import { reactivePick } from "@vueuse/core";
10
+ import { useAppConfig } from "#imports";
11
+ import { usePortal } from "../composables/usePortal";
12
+ import { tv } from "../utils/tv";
13
+ const props = defineProps({
14
+ as: { type: null, required: false },
15
+ title: { type: String, required: false },
16
+ description: { type: String, required: false },
17
+ inset: { type: Boolean, required: false },
18
+ content: { type: Object, required: false },
19
+ overlay: { type: Boolean, required: false, default: true },
20
+ handle: { type: Boolean, required: false, default: true },
21
+ portal: { type: [Boolean, String], required: false, skipCheck: true, default: true },
22
+ class: { type: null, required: false },
23
+ ui: { type: null, required: false },
24
+ activeSnapPoint: { type: [Number, String, null], required: false },
25
+ closeThreshold: { type: Number, required: false },
26
+ shouldScaleBackground: { type: Boolean, required: false },
27
+ setBackgroundColorOnScale: { type: Boolean, required: false },
28
+ scrollLockTimeout: { type: Number, required: false },
29
+ fixed: { type: Boolean, required: false },
30
+ dismissible: { type: Boolean, required: false, default: true },
31
+ modal: { type: Boolean, required: false, default: true },
32
+ open: { type: Boolean, required: false },
33
+ defaultOpen: { type: Boolean, required: false },
34
+ nested: { type: Boolean, required: false },
35
+ direction: { type: String, required: false, default: "bottom" },
36
+ noBodyStyles: { type: Boolean, required: false },
37
+ handleOnly: { type: Boolean, required: false },
38
+ preventScrollRestoration: { type: Boolean, required: false },
39
+ snapPoints: { type: Array, required: false }
40
+ });
41
+ const emits = defineEmits(["drag", "release", "close", "update:open", "update:activeSnapPoint", "animationEnd"]);
42
+ const slots = defineSlots();
43
+ const appConfig = useAppConfig();
44
+ const rootProps = useForwardPropsEmits(reactivePick(props, "activeSnapPoint", "closeThreshold", "shouldScaleBackground", "setBackgroundColorOnScale", "scrollLockTimeout", "fixed", "dismissible", "modal", "open", "defaultOpen", "nested", "direction", "noBodyStyles", "handleOnly", "preventScrollRestoration", "snapPoints"), emits);
45
+ const portalProps = usePortal(toRef(() => props.portal));
46
+ const contentProps = toRef(() => props.content);
80
47
  const contentEvents = {
81
- closeAutoFocus: (e: Event) => e.preventDefault()
82
- }
83
-
84
- const ui = computed(() => drawer({
48
+ closeAutoFocus: (e) => e.preventDefault()
49
+ };
50
+ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.drawer || {} })({
85
51
  direction: props.direction,
86
52
  inset: props.inset
87
- }))
53
+ }));
88
54
  </script>
89
55
 
90
56
  <template>
@@ -93,7 +59,7 @@ const ui = computed(() => drawer({
93
59
  <slot />
94
60
  </DrawerTrigger>
95
61
 
96
- <DrawerPortal :disabled="!portal">
62
+ <DrawerPortal v-bind="portalProps">
97
63
  <DrawerOverlay v-if="overlay" :class="ui.overlay({ class: props.ui?.overlay })" />
98
64
 
99
65
  <DrawerContent :class="ui.content({ class: [!slots.default && props.class, props.ui?.content] })" v-bind="contentProps" v-on="contentEvents">
@@ -0,0 +1,78 @@
1
+ import type { DrawerRootProps, DrawerRootEmits } from 'vaul-vue';
2
+ import type { DialogContentProps, DialogContentEmits } from 'reka-ui';
3
+ import type { AppConfig } from '@nuxt/schema';
4
+ import theme from '#build/ui/drawer';
5
+ import type { EmitsToProps, ComponentConfig } from '../types/utils';
6
+ type Drawer = ComponentConfig<typeof theme, AppConfig, 'drawer'>;
7
+ export interface DrawerProps extends Pick<DrawerRootProps, 'activeSnapPoint' | 'closeThreshold' | 'shouldScaleBackground' | 'setBackgroundColorOnScale' | 'scrollLockTimeout' | 'fixed' | 'dismissible' | 'modal' | 'open' | 'defaultOpen' | 'nested' | 'direction' | 'noBodyStyles' | 'handleOnly' | 'preventScrollRestoration' | 'snapPoints'> {
8
+ /**
9
+ * The element or component this component should render as.
10
+ * @defaultValue 'div'
11
+ */
12
+ as?: any;
13
+ title?: string;
14
+ description?: string;
15
+ /**
16
+ * Whether to inset the drawer from the edges.
17
+ * @defaultValue false
18
+ */
19
+ inset?: boolean;
20
+ /** The content of the drawer. */
21
+ content?: Omit<DialogContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<DialogContentEmits>>;
22
+ /**
23
+ * Render an overlay behind the drawer.
24
+ * @defaultValue true
25
+ */
26
+ overlay?: boolean;
27
+ /**
28
+ * Render a handle on the drawer.
29
+ * @defaultValue true
30
+ */
31
+ handle?: boolean;
32
+ /**
33
+ * Render the drawer in a portal.
34
+ * @defaultValue true
35
+ */
36
+ portal?: boolean | string | HTMLElement;
37
+ class?: any;
38
+ ui?: Drawer['slots'];
39
+ }
40
+ export interface DrawerEmits extends DrawerRootEmits {
41
+ }
42
+ export interface DrawerSlots {
43
+ default(props?: {}): any;
44
+ content(props?: {}): any;
45
+ header(props?: {}): any;
46
+ title(props?: {}): any;
47
+ description(props?: {}): any;
48
+ body(props?: {}): any;
49
+ footer(props?: {}): any;
50
+ }
51
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<DrawerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
52
+ close: () => any;
53
+ drag: (percentageDragged: number) => any;
54
+ "update:open": (open: boolean) => any;
55
+ release: (open: boolean) => any;
56
+ "update:activeSnapPoint": (val: string | number) => any;
57
+ animationEnd: (open: boolean) => any;
58
+ }, string, import("vue").PublicProps, Readonly<DrawerProps> & Readonly<{
59
+ onClose?: (() => any) | undefined;
60
+ onDrag?: ((percentageDragged: number) => any) | undefined;
61
+ "onUpdate:open"?: ((open: boolean) => any) | undefined;
62
+ onRelease?: ((open: boolean) => any) | undefined;
63
+ "onUpdate:activeSnapPoint"?: ((val: string | number) => any) | undefined;
64
+ onAnimationEnd?: ((open: boolean) => any) | undefined;
65
+ }>, {
66
+ modal: boolean;
67
+ portal: boolean | string | HTMLElement;
68
+ overlay: boolean;
69
+ direction: import("vaul-vue").DrawerDirection;
70
+ dismissible: boolean;
71
+ handle: boolean;
72
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, DrawerSlots>;
73
+ export default _default;
74
+ type __VLS_WithSlots<T, S> = T & {
75
+ new (): {
76
+ $slots: S;
77
+ };
78
+ };
@@ -1,146 +1,43 @@
1
- <!-- eslint-disable vue/block-tag-newline -->
2
- <script lang="ts">
3
- import type { VariantProps } from 'tailwind-variants'
4
- import type { DropdownMenuRootProps, DropdownMenuRootEmits, DropdownMenuContentProps, DropdownMenuContentEmits, DropdownMenuArrowProps } from 'reka-ui'
5
- import type { AppConfig } from '@nuxt/schema'
6
- import _appConfig from '#build/app.config'
7
- import theme from '#build/ui/dropdown-menu'
8
- import { tv } from '../utils/tv'
9
- import type { AvatarProps, KbdProps, LinkProps } from '../types'
10
- import type {
11
- ArrayOrNested,
12
- DynamicSlots,
13
- MergeTypes,
14
- NestedItem,
15
- PartialString,
16
- EmitsToProps
17
- } from '../types/utils'
18
-
19
- const appConfigDropdownMenu = _appConfig as AppConfig & { ui: { dropdownMenu: Partial<typeof theme> } }
20
-
21
- const dropdownMenu = tv({ extend: tv(theme), ...(appConfigDropdownMenu.ui?.dropdownMenu || {}) })
22
-
23
- type DropdownMenuVariants = VariantProps<typeof dropdownMenu>
24
-
25
- export interface DropdownMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'> {
26
- label?: string
27
- /**
28
- * @IconifyIcon
29
- */
30
- icon?: string
31
- color?: DropdownMenuVariants['color']
32
- avatar?: AvatarProps
33
- content?: Omit<DropdownMenuContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<DropdownMenuContentEmits>>
34
- kbds?: KbdProps['value'][] | KbdProps[]
35
- /**
36
- * The item type.
37
- * @defaultValue 'link'
38
- */
39
- type?: 'label' | 'separator' | 'link' | 'checkbox'
40
- slot?: string
41
- loading?: boolean
42
- disabled?: boolean
43
- checked?: boolean
44
- open?: boolean
45
- defaultOpen?: boolean
46
- children?: ArrayOrNested<DropdownMenuItem>
47
- onSelect?(e: Event): void
48
- onUpdateChecked?(checked: boolean): void
49
- [key: string]: any
50
- }
51
-
52
- export interface DropdownMenuProps<T extends ArrayOrNested<DropdownMenuItem> = ArrayOrNested<DropdownMenuItem>> extends Omit<DropdownMenuRootProps, 'dir'> {
53
- /**
54
- * @defaultValue 'md'
55
- */
56
- size?: DropdownMenuVariants['size']
57
- items?: T
58
- /**
59
- * The icon displayed when an item is checked.
60
- * @defaultValue appConfig.ui.icons.check
61
- * @IconifyIcon
62
- */
63
- checkedIcon?: string
64
- /**
65
- * The icon displayed when an item is loading.
66
- * @defaultValue appConfig.ui.icons.loading
67
- * @IconifyIcon
68
- */
69
- loadingIcon?: string
70
- /**
71
- * The icon displayed when the item is an external link.
72
- * Set to `false` to hide the external icon.
73
- * @defaultValue appConfig.ui.icons.external
74
- * @IconifyIcon
75
- */
76
- externalIcon?: boolean | string
77
- /**
78
- * The content of the menu.
79
- * @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8 }
80
- */
81
- content?: Omit<DropdownMenuContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<DropdownMenuContentEmits>>
82
- /**
83
- * Display an arrow alongside the menu.
84
- * @defaultValue false
85
- */
86
- arrow?: boolean | Omit<DropdownMenuArrowProps, 'as' | 'asChild'>
87
- /**
88
- * Render the menu in a portal.
89
- * @defaultValue true
90
- */
91
- portal?: boolean
92
- /**
93
- * The key used to get the label from the item.
94
- * @defaultValue 'label'
95
- */
96
- labelKey?: keyof NestedItem<T>
97
- disabled?: boolean
98
- class?: any
99
- ui?: PartialString<typeof dropdownMenu.slots>
100
- }
101
-
102
- export interface DropdownMenuEmits extends DropdownMenuRootEmits {}
103
-
104
- type SlotProps<T extends DropdownMenuItem> = (props: { item: T, active?: boolean, index: number }) => any
105
-
106
- export type DropdownMenuSlots<
107
- A extends ArrayOrNested<DropdownMenuItem> = ArrayOrNested<DropdownMenuItem>,
108
- T extends NestedItem<A> = NestedItem<A>
109
- > = {
110
- 'default'(props: { open: boolean }): any
111
- 'item': SlotProps<T>
112
- 'item-leading': SlotProps<T>
113
- 'item-label': SlotProps<T>
114
- 'item-trailing': SlotProps<T>
115
- } & DynamicSlots<MergeTypes<T>, 'leading' | 'label' | 'trailing', { active?: boolean, index: number }>
116
-
1
+ <script>
2
+ import theme from "#build/ui/dropdown-menu";
117
3
  </script>
118
4
 
119
- <script setup lang="ts" generic="T extends ArrayOrNested<DropdownMenuItem>">
120
- import { computed, toRef } from 'vue'
121
- import { defu } from 'defu'
122
- import { DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuArrow, useForwardPropsEmits } from 'reka-ui'
123
- import { reactivePick } from '@vueuse/core'
124
- import { omit } from '../utils'
125
- import UDropdownMenuContent from './DropdownMenuContent.vue'
126
-
127
- const props = withDefaults(defineProps<DropdownMenuProps<T>>(), {
128
- portal: true,
129
- modal: true,
130
- externalIcon: true,
131
- labelKey: 'label'
132
- })
133
- const emits = defineEmits<DropdownMenuEmits>()
134
- const slots = defineSlots<DropdownMenuSlots<T>>()
135
-
136
- const rootProps = useForwardPropsEmits(reactivePick(props, 'defaultOpen', 'open', 'modal'), emits)
137
- const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffset: 8, collisionPadding: 8 }) as DropdownMenuContentProps)
138
- const arrowProps = toRef(() => props.arrow as DropdownMenuArrowProps)
139
- const proxySlots = omit(slots, ['default'])
140
-
141
- const ui = computed(() => dropdownMenu({
5
+ <script setup>
6
+ import { computed, toRef } from "vue";
7
+ import { defu } from "defu";
8
+ import { DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuArrow, useForwardPropsEmits } from "reka-ui";
9
+ import { reactivePick } from "@vueuse/core";
10
+ import { useAppConfig } from "#imports";
11
+ import { omit } from "../utils";
12
+ import { tv } from "../utils/tv";
13
+ import UDropdownMenuContent from "./DropdownMenuContent.vue";
14
+ const props = defineProps({
15
+ size: { type: null, required: false },
16
+ items: { type: null, required: false },
17
+ checkedIcon: { type: String, required: false },
18
+ loadingIcon: { type: String, required: false },
19
+ externalIcon: { type: [Boolean, String], required: false, default: true },
20
+ content: { type: Object, required: false },
21
+ arrow: { type: [Boolean, Object], required: false },
22
+ portal: { type: [Boolean, String], required: false, skipCheck: true, default: true },
23
+ labelKey: { type: null, required: false, default: "label" },
24
+ disabled: { type: Boolean, required: false },
25
+ class: { type: null, required: false },
26
+ ui: { type: null, required: false },
27
+ defaultOpen: { type: Boolean, required: false },
28
+ open: { type: Boolean, required: false },
29
+ modal: { type: Boolean, required: false, default: true }
30
+ });
31
+ const emits = defineEmits(["update:open"]);
32
+ const slots = defineSlots();
33
+ const appConfig = useAppConfig();
34
+ const rootProps = useForwardPropsEmits(reactivePick(props, "defaultOpen", "open", "modal"), emits);
35
+ const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8 }));
36
+ const arrowProps = toRef(() => props.arrow);
37
+ const proxySlots = omit(slots, ["default"]);
38
+ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.dropdownMenu || {} })({
142
39
  size: props.size
143
- }))
40
+ }));
144
41
  </script>
145
42
 
146
43
  <template>
@@ -156,13 +53,13 @@ const ui = computed(() => dropdownMenu({
156
53
  v-bind="contentProps"
157
54
  :items="items"
158
55
  :portal="portal"
159
- :label-key="(labelKey as keyof NestedItem<T>)"
56
+ :label-key="labelKey"
160
57
  :checked-icon="checkedIcon"
161
58
  :loading-icon="loadingIcon"
162
59
  :external-icon="externalIcon"
163
60
  >
164
61
  <template v-for="(_, name) in proxySlots" #[name]="slotData">
165
- <slot :name="(name as keyof DropdownMenuSlots<T>)" v-bind="slotData" />
62
+ <slot :name="name" v-bind="slotData" />
166
63
  </template>
167
64
 
168
65
  <DropdownMenuArrow v-if="!!arrow" v-bind="arrowProps" :class="ui.arrow({ class: props.ui?.arrow })" />
@@ -0,0 +1,117 @@
1
+ import type { DropdownMenuRootProps, DropdownMenuRootEmits, DropdownMenuContentProps, DropdownMenuContentEmits, DropdownMenuArrowProps } from 'reka-ui';
2
+ import type { AppConfig } from '@nuxt/schema';
3
+ import theme from '#build/ui/dropdown-menu';
4
+ import type { AvatarProps, KbdProps, LinkProps } from '../types';
5
+ import type { ArrayOrNested, DynamicSlots, MergeTypes, NestedItem, EmitsToProps, ComponentConfig } from '../types/utils';
6
+ type DropdownMenu = ComponentConfig<typeof theme, AppConfig, 'dropdownMenu'>;
7
+ export interface DropdownMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custom'> {
8
+ label?: string;
9
+ /**
10
+ * @IconifyIcon
11
+ */
12
+ icon?: string;
13
+ color?: DropdownMenu['variants']['color'];
14
+ avatar?: AvatarProps;
15
+ content?: Omit<DropdownMenuContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<DropdownMenuContentEmits>>;
16
+ kbds?: KbdProps['value'][] | KbdProps[];
17
+ /**
18
+ * The item type.
19
+ * @defaultValue 'link'
20
+ */
21
+ type?: 'label' | 'separator' | 'link' | 'checkbox';
22
+ slot?: string;
23
+ loading?: boolean;
24
+ disabled?: boolean;
25
+ checked?: boolean;
26
+ open?: boolean;
27
+ defaultOpen?: boolean;
28
+ children?: ArrayOrNested<DropdownMenuItem>;
29
+ onSelect?(e: Event): void;
30
+ onUpdateChecked?(checked: boolean): void;
31
+ [key: string]: any;
32
+ }
33
+ export interface DropdownMenuProps<T extends ArrayOrNested<DropdownMenuItem> = ArrayOrNested<DropdownMenuItem>> extends Omit<DropdownMenuRootProps, 'dir'> {
34
+ /**
35
+ * @defaultValue 'md'
36
+ */
37
+ size?: DropdownMenu['variants']['size'];
38
+ items?: T;
39
+ /**
40
+ * The icon displayed when an item is checked.
41
+ * @defaultValue appConfig.ui.icons.check
42
+ * @IconifyIcon
43
+ */
44
+ checkedIcon?: string;
45
+ /**
46
+ * The icon displayed when an item is loading.
47
+ * @defaultValue appConfig.ui.icons.loading
48
+ * @IconifyIcon
49
+ */
50
+ loadingIcon?: string;
51
+ /**
52
+ * The icon displayed when the item is an external link.
53
+ * Set to `false` to hide the external icon.
54
+ * @defaultValue appConfig.ui.icons.external
55
+ * @IconifyIcon
56
+ */
57
+ externalIcon?: boolean | string;
58
+ /**
59
+ * The content of the menu.
60
+ * @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8 }
61
+ */
62
+ content?: Omit<DropdownMenuContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<DropdownMenuContentEmits>>;
63
+ /**
64
+ * Display an arrow alongside the menu.
65
+ * @defaultValue false
66
+ */
67
+ arrow?: boolean | Omit<DropdownMenuArrowProps, 'as' | 'asChild'>;
68
+ /**
69
+ * Render the menu in a portal.
70
+ * @defaultValue true
71
+ */
72
+ portal?: boolean | string | HTMLElement;
73
+ /**
74
+ * The key used to get the label from the item.
75
+ * @defaultValue 'label'
76
+ */
77
+ labelKey?: keyof NestedItem<T>;
78
+ disabled?: boolean;
79
+ class?: any;
80
+ ui?: DropdownMenu['slots'];
81
+ }
82
+ export interface DropdownMenuEmits extends DropdownMenuRootEmits {
83
+ }
84
+ type SlotProps<T extends DropdownMenuItem> = (props: {
85
+ item: T;
86
+ active?: boolean;
87
+ index: number;
88
+ }) => any;
89
+ export type DropdownMenuSlots<A extends ArrayOrNested<DropdownMenuItem> = ArrayOrNested<DropdownMenuItem>, T extends NestedItem<A> = NestedItem<A>> = {
90
+ 'default'(props: {
91
+ open: boolean;
92
+ }): any;
93
+ 'item': SlotProps<T>;
94
+ 'item-leading': SlotProps<T>;
95
+ 'item-label': SlotProps<T>;
96
+ 'item-trailing': SlotProps<T>;
97
+ 'content-top': (props?: {}) => any;
98
+ 'content-bottom': (props?: {}) => any;
99
+ } & DynamicSlots<MergeTypes<T>, 'leading' | 'label' | 'trailing', {
100
+ active?: boolean;
101
+ index: number;
102
+ }>;
103
+ 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<{
104
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
105
+ readonly "onUpdate:open"?: ((payload: boolean) => any) | undefined;
106
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:open"> & DropdownMenuProps<T> & Partial<{}>> & import("vue").PublicProps;
107
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
108
+ attrs: any;
109
+ slots: DropdownMenuSlots<T, NestedItem<T>>;
110
+ emit: (evt: "update:open", payload: boolean) => void;
111
+ }>) => import("vue").VNode & {
112
+ __ctx?: Awaited<typeof __VLS_setup>;
113
+ };
114
+ export default _default;
115
+ type __VLS_PrettifyLocal<T> = {
116
+ [K in keyof T]: T[K];
117
+ } & {};