@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
@@ -0,0 +1,324 @@
1
+ import type { InputHTMLAttributes } from 'vue';
2
+ import type { ComboboxRootProps, ComboboxRootEmits, ComboboxContentProps, ComboboxContentEmits, ComboboxArrowProps } from 'reka-ui';
3
+ import type { AppConfig } from '@nuxt/schema';
4
+ import theme from '#build/ui/input-menu';
5
+ import type { UseComponentIconsProps } from '../composables/useComponentIcons';
6
+ import type { AvatarProps, ChipProps } from '../types';
7
+ import type { AcceptableValue, ArrayOrNested, GetItemKeys, GetModelValue, GetModelValueEmits, NestedItem, EmitsToProps, ComponentConfig } from '../types/utils';
8
+ type InputMenu = ComponentConfig<typeof theme, AppConfig, 'inputMenu'>;
9
+ interface _InputMenuItem {
10
+ label?: string;
11
+ /**
12
+ * @IconifyIcon
13
+ */
14
+ icon?: string;
15
+ avatar?: AvatarProps;
16
+ chip?: ChipProps;
17
+ /**
18
+ * The item type.
19
+ * @defaultValue 'item'
20
+ */
21
+ type?: 'label' | 'separator' | 'item';
22
+ disabled?: boolean;
23
+ onSelect?(e?: Event): void;
24
+ [key: string]: any;
25
+ }
26
+ export type InputMenuItem = _InputMenuItem | AcceptableValue | boolean;
27
+ export interface InputMenuProps<T extends ArrayOrNested<InputMenuItem> = ArrayOrNested<InputMenuItem>, VK extends GetItemKeys<T> | undefined = undefined, M extends boolean = false> extends Pick<ComboboxRootProps<T>, 'open' | 'defaultOpen' | 'disabled' | 'name' | 'resetSearchTermOnBlur' | 'resetSearchTermOnSelect' | 'highlightOnHover'>, UseComponentIconsProps {
28
+ /**
29
+ * The element or component this component should render as.
30
+ * @defaultValue 'div'
31
+ */
32
+ as?: any;
33
+ id?: string;
34
+ type?: InputHTMLAttributes['type'];
35
+ /** The placeholder text when the input is empty. */
36
+ placeholder?: string;
37
+ /**
38
+ * @defaultValue 'primary'
39
+ */
40
+ color?: InputMenu['variants']['color'];
41
+ /**
42
+ * @defaultValue 'outline'
43
+ */
44
+ variant?: InputMenu['variants']['variant'];
45
+ /**
46
+ * @defaultValue 'md'
47
+ */
48
+ size?: InputMenu['variants']['size'];
49
+ required?: boolean;
50
+ autofocus?: boolean;
51
+ autofocusDelay?: number;
52
+ /**
53
+ * The icon displayed to open the menu.
54
+ * @defaultValue appConfig.ui.icons.chevronDown
55
+ * @IconifyIcon
56
+ */
57
+ trailingIcon?: string;
58
+ /**
59
+ * The icon displayed when an item is selected.
60
+ * @defaultValue appConfig.ui.icons.check
61
+ * @IconifyIcon
62
+ */
63
+ selectedIcon?: string;
64
+ /**
65
+ * The icon displayed to delete a tag.
66
+ * Works only when `multiple` is `true`.
67
+ * @defaultValue appConfig.ui.icons.close
68
+ * @IconifyIcon
69
+ */
70
+ deleteIcon?: string;
71
+ /**
72
+ * The content of the menu.
73
+ * @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' }
74
+ */
75
+ content?: Omit<ComboboxContentProps, 'as' | 'asChild' | 'forceMount'> & Partial<EmitsToProps<ComboboxContentEmits>>;
76
+ /**
77
+ * Display an arrow alongside the menu.
78
+ * @defaultValue false
79
+ */
80
+ arrow?: boolean | Omit<ComboboxArrowProps, 'as' | 'asChild'>;
81
+ /**
82
+ * Render the menu in a portal.
83
+ * @defaultValue true
84
+ */
85
+ portal?: boolean | string | HTMLElement;
86
+ /**
87
+ * When `items` is an array of objects, select the field to use as the value instead of the object itself.
88
+ * @defaultValue undefined
89
+ */
90
+ valueKey?: VK;
91
+ /**
92
+ * When `items` is an array of objects, select the field to use as the label.
93
+ * @defaultValue 'label'
94
+ */
95
+ labelKey?: keyof NestedItem<T>;
96
+ items?: T;
97
+ /** The value of the InputMenu when initially rendered. Use when you do not need to control the state of the InputMenu. */
98
+ defaultValue?: GetModelValue<T, VK, M>;
99
+ /** The controlled value of the InputMenu. Can be binded-with with `v-model`. */
100
+ modelValue?: GetModelValue<T, VK, M>;
101
+ /** Whether multiple options can be selected or not. */
102
+ multiple?: M & boolean;
103
+ /** Highlight the ring color like a focus state. */
104
+ highlight?: boolean;
105
+ /**
106
+ * Determines if custom user input that does not exist in options can be added.
107
+ * @defaultValue false
108
+ */
109
+ createItem?: boolean | 'always' | {
110
+ position?: 'top' | 'bottom';
111
+ when?: 'empty' | 'always';
112
+ };
113
+ /**
114
+ * Fields to filter items by.
115
+ * @defaultValue [labelKey]
116
+ */
117
+ filterFields?: string[];
118
+ /**
119
+ * When `true`, disable the default filters, useful for custom filtering (useAsyncData, useFetch, etc.).
120
+ * @defaultValue false
121
+ */
122
+ ignoreFilter?: boolean;
123
+ class?: any;
124
+ ui?: InputMenu['slots'];
125
+ }
126
+ export type InputMenuEmits<A extends ArrayOrNested<InputMenuItem>, VK extends GetItemKeys<A> | undefined, M extends boolean> = Pick<ComboboxRootEmits, 'update:open'> & {
127
+ change: [payload: Event];
128
+ blur: [payload: FocusEvent];
129
+ focus: [payload: FocusEvent];
130
+ create: [item: string];
131
+ /** Event handler when highlighted element changes. */
132
+ highlight: [
133
+ payload: {
134
+ ref: HTMLElement;
135
+ value: GetModelValue<A, VK, M>;
136
+ } | undefined
137
+ ];
138
+ } & GetModelValueEmits<A, VK, M>;
139
+ type SlotProps<T extends InputMenuItem> = (props: {
140
+ item: T;
141
+ index: number;
142
+ }) => any;
143
+ export interface InputMenuSlots<A extends ArrayOrNested<InputMenuItem> = ArrayOrNested<InputMenuItem>, VK extends GetItemKeys<A> | undefined = undefined, M extends boolean = false, T extends NestedItem<A> = NestedItem<A>> {
144
+ 'leading'(props: {
145
+ modelValue?: GetModelValue<A, VK, M>;
146
+ open: boolean;
147
+ ui: {
148
+ [K in keyof Required<InputMenu['slots']>]: (props?: Record<string, any>) => string;
149
+ };
150
+ }): any;
151
+ 'trailing'(props: {
152
+ modelValue?: GetModelValue<A, VK, M>;
153
+ open: boolean;
154
+ ui: {
155
+ [K in keyof Required<InputMenu['slots']>]: (props?: Record<string, any>) => string;
156
+ };
157
+ }): any;
158
+ 'empty'(props: {
159
+ searchTerm?: string;
160
+ }): any;
161
+ 'item': SlotProps<T>;
162
+ 'item-leading': SlotProps<T>;
163
+ 'item-label': SlotProps<T>;
164
+ 'item-trailing': SlotProps<T>;
165
+ 'tags-item-text': SlotProps<T>;
166
+ 'tags-item-delete': SlotProps<T>;
167
+ 'content-top': (props?: {}) => any;
168
+ 'content-bottom': (props?: {}) => any;
169
+ 'create-item-label'(props: {
170
+ item: string;
171
+ }): any;
172
+ }
173
+ declare const _default: <T extends ArrayOrNested<InputMenuItem>, VK extends GetItemKeys<T> | undefined = undefined, M extends boolean = false>(__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<{
174
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
175
+ readonly onBlur?: ((payload: FocusEvent) => any) | undefined;
176
+ readonly onChange?: ((payload: Event) => any) | undefined;
177
+ readonly onFocus?: ((payload: FocusEvent) => any) | undefined;
178
+ readonly onCreate?: ((item: string) => any) | undefined;
179
+ readonly "onUpdate:open"?: ((value: boolean) => any) | undefined;
180
+ readonly "onUpdate:modelValue"?: ((payload: GetModelValue<T, VK, M>) => any) | undefined;
181
+ readonly onHighlight?: ((payload: {
182
+ ref: HTMLElement;
183
+ value: GetModelValue<T, VK, M>;
184
+ } | undefined) => any) | undefined;
185
+ readonly "onUpdate:searchTerm"?: ((value: string) => any) | undefined;
186
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onFocus" | "onBlur" | "onChange" | "onUpdate:open" | "onUpdate:modelValue" | "onHighlight" | "onUpdate:searchTerm" | "onCreate"> & (InputMenuProps<T, VK, M> & {
187
+ searchTerm?: string;
188
+ }) & Partial<{}>> & import("vue").PublicProps;
189
+ expose(exposed: import("vue").ShallowUnwrapRef<{
190
+ inputRef: import("vue").Ref<({
191
+ $: import("vue").ComponentInternalInstance;
192
+ $data: {};
193
+ $props: {
194
+ readonly displayValue?: ((val: any) => string) | undefined;
195
+ readonly modelValue?: string | undefined;
196
+ readonly autoFocus?: boolean | undefined;
197
+ readonly disabled?: boolean | undefined;
198
+ readonly asChild?: boolean | undefined;
199
+ readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
200
+ readonly "onUpdate:modelValue"?: ((args_0: string) => any) | undefined | undefined;
201
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
202
+ $attrs: {
203
+ [x: string]: unknown;
204
+ };
205
+ $refs: {
206
+ [x: string]: unknown;
207
+ };
208
+ $slots: Readonly<{
209
+ [name: string]: import("vue").Slot<any> | undefined;
210
+ }>;
211
+ $root: import("vue").ComponentPublicInstance | null;
212
+ $parent: import("vue").ComponentPublicInstance | null;
213
+ $host: Element | null;
214
+ $emit: (event: "update:modelValue", args_0: string) => void;
215
+ $el: any;
216
+ $options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").ComboboxInputProps> & Readonly<{
217
+ "onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
218
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
219
+ "update:modelValue": (args_0: string) => any;
220
+ }, string, {
221
+ as: import("reka-ui").AsTag | import("vue").Component;
222
+ }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
223
+ beforeCreate?: (() => void) | (() => void)[];
224
+ created?: (() => void) | (() => void)[];
225
+ beforeMount?: (() => void) | (() => void)[];
226
+ mounted?: (() => void) | (() => void)[];
227
+ beforeUpdate?: (() => void) | (() => void)[];
228
+ updated?: (() => void) | (() => void)[];
229
+ activated?: (() => void) | (() => void)[];
230
+ deactivated?: (() => void) | (() => void)[];
231
+ beforeDestroy?: (() => void) | (() => void)[];
232
+ beforeUnmount?: (() => void) | (() => void)[];
233
+ destroyed?: (() => void) | (() => void)[];
234
+ unmounted?: (() => void) | (() => void)[];
235
+ renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
236
+ renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
237
+ errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
238
+ };
239
+ $forceUpdate: () => void;
240
+ $nextTick: typeof import("vue").nextTick;
241
+ $watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
242
+ } & Readonly<{
243
+ as: import("reka-ui").AsTag | import("vue").Component;
244
+ }> & Omit<Readonly<import("reka-ui").ComboboxInputProps> & Readonly<{
245
+ "onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
246
+ }>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
247
+ $slots: {
248
+ default?(_: {}): any;
249
+ };
250
+ }) | null, ({
251
+ $: import("vue").ComponentInternalInstance;
252
+ $data: {};
253
+ $props: {
254
+ readonly displayValue?: ((val: any) => string) | undefined;
255
+ readonly modelValue?: string | undefined;
256
+ readonly autoFocus?: boolean | undefined;
257
+ readonly disabled?: boolean | undefined;
258
+ readonly asChild?: boolean | undefined;
259
+ readonly as?: (import("reka-ui").AsTag | import("vue").Component) | undefined;
260
+ readonly "onUpdate:modelValue"?: ((args_0: string) => any) | undefined | undefined;
261
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
262
+ $attrs: {
263
+ [x: string]: unknown;
264
+ };
265
+ $refs: {
266
+ [x: string]: unknown;
267
+ };
268
+ $slots: Readonly<{
269
+ [name: string]: import("vue").Slot<any> | undefined;
270
+ }>;
271
+ $root: import("vue").ComponentPublicInstance | null;
272
+ $parent: import("vue").ComponentPublicInstance | null;
273
+ $host: Element | null;
274
+ $emit: (event: "update:modelValue", args_0: string) => void;
275
+ $el: any;
276
+ $options: import("vue").ComponentOptionsBase<Readonly<import("reka-ui").ComboboxInputProps> & Readonly<{
277
+ "onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
278
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
279
+ "update:modelValue": (args_0: string) => any;
280
+ }, string, {
281
+ as: import("reka-ui").AsTag | import("vue").Component;
282
+ }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
283
+ beforeCreate?: (() => void) | (() => void)[];
284
+ created?: (() => void) | (() => void)[];
285
+ beforeMount?: (() => void) | (() => void)[];
286
+ mounted?: (() => void) | (() => void)[];
287
+ beforeUpdate?: (() => void) | (() => void)[];
288
+ updated?: (() => void) | (() => void)[];
289
+ activated?: (() => void) | (() => void)[];
290
+ deactivated?: (() => void) | (() => void)[];
291
+ beforeDestroy?: (() => void) | (() => void)[];
292
+ beforeUnmount?: (() => void) | (() => void)[];
293
+ destroyed?: (() => void) | (() => void)[];
294
+ unmounted?: (() => void) | (() => void)[];
295
+ renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
296
+ renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
297
+ errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
298
+ };
299
+ $forceUpdate: () => void;
300
+ $nextTick: typeof import("vue").nextTick;
301
+ $watch<T_1 extends string | ((...args: any) => any)>(source: T_1, cb: T_1 extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
302
+ } & Readonly<{
303
+ as: import("reka-ui").AsTag | import("vue").Component;
304
+ }> & Omit<Readonly<import("reka-ui").ComboboxInputProps> & Readonly<{
305
+ "onUpdate:modelValue"?: ((args_0: string) => any) | undefined;
306
+ }>, "as"> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
307
+ $slots: {
308
+ default?(_: {}): any;
309
+ };
310
+ }) | null>;
311
+ }>): void;
312
+ attrs: any;
313
+ slots: InputMenuSlots<T, VK, M, NestedItem<T>>;
314
+ emit: (((evt: "blur", payload: FocusEvent) => void) & ((evt: "change", payload: Event) => void) & ((evt: "focus", payload: FocusEvent) => void) & ((evt: "create", item: string) => void) & ((evt: "update:open", value: boolean) => void) & ((evt: "update:modelValue", payload: GetModelValue<T, VK, M>) => void) & ((evt: "highlight", payload: {
315
+ ref: HTMLElement;
316
+ value: GetModelValue<T, VK, M>;
317
+ } | undefined) => void)) & ((evt: "update:searchTerm", value: string) => void);
318
+ }>) => import("vue").VNode & {
319
+ __ctx?: Awaited<typeof __VLS_setup>;
320
+ };
321
+ export default _default;
322
+ type __VLS_PrettifyLocal<T> = {
323
+ [K in keyof T]: T[K];
324
+ } & {};
@@ -1,149 +1,87 @@
1
- <script lang="ts">
2
- import type { VariantProps } from 'tailwind-variants'
3
- import type { NumberFieldRootProps } from 'reka-ui'
4
- import type { AppConfig } from '@nuxt/schema'
5
- import _appConfig from '#build/app.config'
6
- import theme from '#build/ui/input-number'
7
- import { tv } from '../utils/tv'
8
- import type { ButtonProps } from '../types'
9
- import type { PartialString } from '../types/utils'
10
-
11
- const appConfigInputNumber = _appConfig as AppConfig & { ui: { inputNumber: Partial<typeof theme> } }
12
-
13
- const inputNumber = tv({ extend: tv(theme), ...(appConfigInputNumber.ui?.inputNumber || {}) })
14
-
15
- type InputNumberVariants = VariantProps<typeof inputNumber>
16
-
17
- export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue' | 'defaultValue' | 'min' | 'max' | 'step' | 'disabled' | 'required' | 'id' | 'name' | 'formatOptions'> {
18
- /**
19
- * The element or component this component should render as.
20
- * @defaultValue 'div'
21
- */
22
- as?: any
23
- /** The placeholder text when the input is empty. */
24
- placeholder?: string
25
- color?: InputNumberVariants['color']
26
- variant?: InputNumberVariants['variant']
27
- size?: InputNumberVariants['size']
28
- /** Highlight the ring color like a focus state. */
29
- highlight?: boolean
30
- /**
31
- * The orientation of the input menu.
32
- * @defaultValue 'horizontal'
33
- */
34
- orientation?: 'vertical' | 'horizontal'
35
- /**
36
- * Configure the increment button. The `color` and `size` are inherited.
37
- * @defaultValue { variant: 'link' }
38
- */
39
- increment?: ButtonProps
40
- /**
41
- * The icon displayed to increment the value.
42
- * @defaultValue appConfig.ui.icons.plus
43
- * @IconifyIcon
44
- */
45
- incrementIcon?: string
46
- /**
47
- * Configure the decrement button. The `color` and `size` are inherited.
48
- * @defaultValue { variant: 'link' }
49
- */
50
- decrement?: ButtonProps
51
- /**
52
- * The icon displayed to decrement the value.
53
- * @defaultValue appConfig.ui.icons.minus
54
- * @IconifyIcon
55
- */
56
- decrementIcon?: string
57
- autofocus?: boolean
58
- autofocusDelay?: number
59
- /**
60
- * The locale to use for formatting and parsing numbers.
61
- * @defaultValue UApp.locale.code
62
- */
63
- locale?: string
64
- class?: any
65
- ui?: PartialString<typeof inputNumber.slots>
66
- }
67
-
68
- export interface InputNumberEmits {
69
- (e: 'update:modelValue', payload: number): void
70
- (e: 'blur', event: FocusEvent): void
71
- (e: 'change', payload: Event): void
72
- }
73
-
74
- export interface InputNumberSlots {
75
- increment(props?: {}): any
76
- decrement(props?: {}): any
77
- }
1
+ <script>
2
+ import theme from "#build/ui/input-number";
78
3
  </script>
79
4
 
80
- <script setup lang="ts">
81
- import { onMounted, ref, computed } from 'vue'
82
- import { NumberFieldRoot, NumberFieldInput, NumberFieldDecrement, NumberFieldIncrement, useForwardPropsEmits } from 'reka-ui'
83
- import { reactivePick } from '@vueuse/core'
84
- import { useAppConfig } from '#imports'
85
- import { useFormField } from '../composables/useFormField'
86
- import { useLocale } from '../composables/useLocale'
87
- import UButton from './Button.vue'
88
-
89
- defineOptions({ inheritAttrs: false })
90
-
91
- const props = withDefaults(defineProps<InputNumberProps>(), {
92
- orientation: 'horizontal'
93
- })
94
- const emits = defineEmits<InputNumberEmits>()
95
- defineSlots<InputNumberSlots>()
96
-
97
- const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'min', 'max', 'step', 'formatOptions'), emits)
98
-
99
- const appConfig = useAppConfig()
100
- const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, id, color, size, name, highlight, disabled, ariaAttrs } = useFormField<InputNumberProps>(props)
101
-
102
- const { t, code: codeLocale } = useLocale()
103
- const locale = computed(() => props.locale || codeLocale.value)
104
-
105
- const ui = computed(() => inputNumber({
5
+ <script setup>
6
+ import { onMounted, ref, computed } from "vue";
7
+ import { NumberFieldRoot, NumberFieldInput, NumberFieldDecrement, NumberFieldIncrement, useForwardPropsEmits } from "reka-ui";
8
+ import { reactivePick } from "@vueuse/core";
9
+ import { useAppConfig } from "#imports";
10
+ import { useFormField } from "../composables/useFormField";
11
+ import { useLocale } from "../composables/useLocale";
12
+ import { tv } from "../utils/tv";
13
+ import UButton from "./Button.vue";
14
+ defineOptions({ inheritAttrs: false });
15
+ const props = defineProps({
16
+ as: { type: null, required: false },
17
+ placeholder: { type: String, required: false },
18
+ color: { type: null, required: false },
19
+ variant: { type: null, required: false },
20
+ size: { type: null, required: false },
21
+ highlight: { type: Boolean, required: false },
22
+ orientation: { type: String, required: false, default: "horizontal" },
23
+ increment: { type: Object, required: false },
24
+ incrementIcon: { type: String, required: false },
25
+ decrement: { type: Object, required: false },
26
+ decrementIcon: { type: String, required: false },
27
+ autofocus: { type: Boolean, required: false },
28
+ autofocusDelay: { type: Number, required: false },
29
+ locale: { type: String, required: false },
30
+ class: { type: null, required: false },
31
+ ui: { type: null, required: false },
32
+ modelValue: { type: [Number, null], required: false },
33
+ defaultValue: { type: Number, required: false },
34
+ min: { type: Number, required: false },
35
+ max: { type: Number, required: false },
36
+ step: { type: Number, required: false },
37
+ stepSnapping: { type: Boolean, required: false },
38
+ disabled: { type: Boolean, required: false },
39
+ required: { type: Boolean, required: false },
40
+ id: { type: String, required: false },
41
+ name: { type: String, required: false },
42
+ formatOptions: { type: null, required: false },
43
+ disableWheelChange: { type: Boolean, required: false }
44
+ });
45
+ const emits = defineEmits(["update:modelValue", "blur", "change"]);
46
+ defineSlots();
47
+ const appConfig = useAppConfig();
48
+ const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "min", "max", "step", "stepSnapping", "formatOptions", "disableWheelChange"), emits);
49
+ const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, id, color, size, name, highlight, disabled, ariaAttrs } = useFormField(props);
50
+ const { t, code: codeLocale } = useLocale();
51
+ const locale = computed(() => props.locale || codeLocale.value);
52
+ const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.inputNumber || {} })({
106
53
  color: color.value,
107
54
  variant: props.variant,
108
55
  size: size.value,
109
56
  highlight: highlight.value,
110
57
  orientation: props.orientation
111
- }))
112
-
113
- const incrementIcon = computed(() => props.incrementIcon || (props.orientation === 'horizontal' ? appConfig.ui.icons.plus : appConfig.ui.icons.chevronUp))
114
- const decrementIcon = computed(() => props.decrementIcon || (props.orientation === 'horizontal' ? appConfig.ui.icons.minus : appConfig.ui.icons.chevronDown))
115
-
116
- const inputRef = ref<InstanceType<typeof NumberFieldInput> | null>(null)
117
-
58
+ }));
59
+ const incrementIcon = computed(() => props.incrementIcon || (props.orientation === "horizontal" ? appConfig.ui.icons.plus : appConfig.ui.icons.chevronUp));
60
+ const decrementIcon = computed(() => props.decrementIcon || (props.orientation === "horizontal" ? appConfig.ui.icons.minus : appConfig.ui.icons.chevronDown));
61
+ const inputRef = ref(null);
62
+ function onUpdate(value) {
63
+ const event = new Event("change", { target: { value } });
64
+ emits("change", event);
65
+ emitFormChange();
66
+ emitFormInput();
67
+ }
68
+ function onBlur(event) {
69
+ emitFormBlur();
70
+ emits("blur", event);
71
+ }
118
72
  function autoFocus() {
119
73
  if (props.autofocus) {
120
- inputRef.value?.$el?.focus()
74
+ inputRef.value?.$el?.focus();
121
75
  }
122
76
  }
123
-
124
77
  onMounted(() => {
125
78
  setTimeout(() => {
126
- autoFocus()
127
- }, props.autofocusDelay)
128
- })
129
-
130
- function onUpdate(value: number) {
131
- // @ts-expect-error - 'target' does not exist in type 'EventInit'
132
- const event = new Event('change', { target: { value } })
133
- emits('change', event)
134
-
135
- emitFormChange()
136
- emitFormInput()
137
- }
138
-
139
- function onBlur(event: FocusEvent) {
140
- emitFormBlur()
141
- emits('blur', event)
142
- }
143
-
79
+ autoFocus();
80
+ }, props.autofocusDelay);
81
+ });
144
82
  defineExpose({
145
83
  inputRef
146
- })
84
+ });
147
85
  </script>
148
86
 
149
87
  <template>
@@ -175,7 +113,7 @@ defineExpose({
175
113
  :size="size"
176
114
  variant="link"
177
115
  :aria-label="t('inputNumber.increment')"
178
- v-bind="typeof increment === 'object' ? increment : undefined"
116
+ v-bind="typeof increment === 'object' ? increment : void 0"
179
117
  />
180
118
  </slot>
181
119
  </NumberFieldIncrement>
@@ -190,7 +128,7 @@ defineExpose({
190
128
  :size="size"
191
129
  variant="link"
192
130
  :aria-label="t('inputNumber.decrement')"
193
- v-bind="typeof decrement === 'object' ? decrement : undefined"
131
+ v-bind="typeof decrement === 'object' ? decrement : void 0"
194
132
  />
195
133
  </slot>
196
134
  </NumberFieldDecrement>