@nuxt/ui 2.17.0 → 2.18.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 (234) hide show
  1. package/dist/module.d.mts +3 -1988
  2. package/dist/module.d.ts +3 -1988
  3. package/dist/module.json +6 -2
  4. package/dist/module.mjs +6 -71
  5. package/dist/runtime/components/data/Table.vue +53 -15
  6. package/dist/runtime/components/data/Table.vue.d.ts +249 -50
  7. package/dist/runtime/components/elements/Accordion.vue.d.ts +140 -14
  8. package/dist/runtime/components/elements/Alert.vue +1 -1
  9. package/dist/runtime/components/elements/Alert.vue.d.ts +106 -23
  10. package/dist/runtime/components/elements/Avatar.vue.d.ts +146 -25
  11. package/dist/runtime/components/elements/AvatarGroup.d.ts +20 -11
  12. package/dist/runtime/components/elements/{AvatarGroup.mjs → AvatarGroup.js} +2 -2
  13. package/dist/runtime/components/elements/Badge.vue.d.ts +53 -16
  14. package/dist/runtime/components/elements/Button.vue.d.ts +259 -96
  15. package/dist/runtime/components/elements/ButtonGroup.d.ts +113 -9
  16. package/dist/runtime/components/elements/{ButtonGroup.mjs → ButtonGroup.js} +3 -3
  17. package/dist/runtime/components/elements/Carousel.vue.d.ts +75 -20
  18. package/dist/runtime/components/elements/Chip.vue.d.ts +95 -23
  19. package/dist/runtime/components/elements/Dropdown.vue +3 -6
  20. package/dist/runtime/components/elements/Dropdown.vue.d.ts +135 -16
  21. package/dist/runtime/components/elements/Icon.vue +16 -15
  22. package/dist/runtime/components/elements/Icon.vue.d.ts +33 -10
  23. package/dist/runtime/components/elements/Kbd.vue.d.ts +45 -10
  24. package/dist/runtime/components/elements/Link.vue.d.ts +72 -72
  25. package/dist/runtime/components/elements/Meter.vue +1 -1
  26. package/dist/runtime/components/elements/Meter.vue.d.ts +179 -23
  27. package/dist/runtime/components/elements/MeterGroup.d.ts +72 -15
  28. package/dist/runtime/components/elements/{MeterGroup.mjs → MeterGroup.js} +3 -3
  29. package/dist/runtime/components/elements/Progress.vue +7 -2
  30. package/dist/runtime/components/elements/Progress.vue.d.ts +188 -32
  31. package/dist/runtime/components/forms/Checkbox.vue +5 -3
  32. package/dist/runtime/components/forms/Checkbox.vue.d.ts +73 -32
  33. package/dist/runtime/components/forms/Form.vue +1 -2
  34. package/dist/runtime/components/forms/Form.vue.d.ts +11 -10
  35. package/dist/runtime/components/forms/FormGroup.vue +1 -1
  36. package/dist/runtime/components/forms/FormGroup.vue.d.ts +78 -25
  37. package/dist/runtime/components/forms/Input.vue +1 -1
  38. package/dist/runtime/components/forms/Input.vue.d.ts +272 -55
  39. package/dist/runtime/components/forms/InputMenu.vue +11 -8
  40. package/dist/runtime/components/forms/InputMenu.vue.d.ts +431 -81
  41. package/dist/runtime/components/forms/Radio.vue +5 -3
  42. package/dist/runtime/components/forms/Radio.vue.d.ts +71 -32
  43. package/dist/runtime/components/forms/RadioGroup.vue +11 -3
  44. package/dist/runtime/components/forms/RadioGroup.vue.d.ts +83 -25
  45. package/dist/runtime/components/forms/Range.vue.d.ts +153 -24
  46. package/dist/runtime/components/forms/Select.vue +1 -1
  47. package/dist/runtime/components/forms/Select.vue.d.ts +272 -49
  48. package/dist/runtime/components/forms/SelectMenu.vue +49 -23
  49. package/dist/runtime/components/forms/SelectMenu.vue.d.ts +449 -84
  50. package/dist/runtime/components/forms/Textarea.vue.d.ts +258 -43
  51. package/dist/runtime/components/forms/Toggle.vue.d.ts +152 -25
  52. package/dist/runtime/components/layout/Card.vue.d.ts +54 -4
  53. package/dist/runtime/components/layout/Container.vue.d.ts +18 -4
  54. package/dist/runtime/components/layout/Divider.vue.d.ts +121 -16
  55. package/dist/runtime/components/layout/Skeleton.vue +5 -1
  56. package/dist/runtime/components/layout/Skeleton.vue.d.ts +27 -4
  57. package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +52 -9
  58. package/dist/runtime/components/navigation/CommandPalette.vue +7 -4
  59. package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +193 -35
  60. package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +5 -7
  61. package/dist/runtime/components/navigation/HorizontalNavigation.vue.d.ts +64 -9
  62. package/dist/runtime/components/navigation/Pagination.vue +2 -4
  63. package/dist/runtime/components/navigation/Pagination.vue.d.ts +83 -11
  64. package/dist/runtime/components/navigation/Tabs.vue +10 -0
  65. package/dist/runtime/components/navigation/Tabs.vue.d.ts +85 -14
  66. package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +78 -9
  67. package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +71 -8
  68. package/dist/runtime/components/overlays/Modal.vue.d.ts +85 -11
  69. package/dist/runtime/components/overlays/Notification.vue +1 -1
  70. package/dist/runtime/components/overlays/Notification.vue.d.ts +127 -26
  71. package/dist/runtime/components/overlays/Notifications.vue.d.ts +31 -16
  72. package/dist/runtime/components/overlays/Popover.vue +3 -6
  73. package/dist/runtime/components/overlays/Popover.vue.d.ts +110 -15
  74. package/dist/runtime/components/overlays/Slideover.vue.d.ts +86 -14
  75. package/dist/runtime/components/overlays/Tooltip.vue.d.ts +90 -15
  76. package/dist/runtime/composables/{defineShortcuts.mjs → defineShortcuts.js} +1 -1
  77. package/dist/runtime/composables/{useButtonGroup.mjs → useButtonGroup.js} +8 -9
  78. package/dist/runtime/composables/useCopyToClipboard.d.ts +1 -1
  79. package/dist/runtime/composables/{useCopyToClipboard.mjs → useCopyToClipboard.js} +1 -1
  80. package/dist/runtime/composables/useFormGroup.d.ts +5 -5
  81. package/dist/runtime/composables/useFormGroup.js +49 -0
  82. package/dist/runtime/composables/useModal.d.ts +3 -3
  83. package/dist/runtime/composables/{useModal.mjs → useModal.js} +2 -4
  84. package/dist/runtime/composables/usePopper.d.ts +90 -54
  85. package/dist/runtime/composables/useShortcuts.d.ts +4 -4
  86. package/dist/runtime/composables/useSlideover.d.ts +3 -3
  87. package/dist/runtime/composables/{useSlideover.mjs → useSlideover.js} +2 -4
  88. package/dist/runtime/composables/useTimer.d.ts +1 -1
  89. package/dist/runtime/composables/useToast.d.ts +11 -11
  90. package/dist/runtime/composables/useUI.d.ts +1 -1
  91. package/dist/runtime/composables/{useUI.mjs → useUI.js} +1 -1
  92. package/dist/runtime/plugins/colors.d.ts +1 -1
  93. package/dist/runtime/plugins/{colors.mjs → colors.js} +1 -1
  94. package/dist/runtime/plugins/modals.d.ts +1 -1
  95. package/dist/runtime/plugins/{modals.mjs → modals.js} +1 -1
  96. package/dist/runtime/plugins/slideovers.d.ts +1 -1
  97. package/dist/runtime/plugins/{slideovers.mjs → slideovers.js} +1 -1
  98. package/dist/runtime/types/accordion.d.ts +6 -7
  99. package/dist/runtime/types/accordion.js +0 -0
  100. package/dist/runtime/types/alert.d.ts +8 -10
  101. package/dist/runtime/types/alert.js +0 -0
  102. package/dist/runtime/types/avatar.d.ts +13 -15
  103. package/dist/runtime/types/avatar.js +0 -0
  104. package/dist/runtime/types/badge.d.ts +11 -13
  105. package/dist/runtime/types/badge.js +0 -0
  106. package/dist/runtime/types/breadcrumb.d.ts +6 -8
  107. package/dist/runtime/types/breadcrumb.js +0 -0
  108. package/dist/runtime/types/button.d.ts +27 -29
  109. package/dist/runtime/types/button.js +0 -0
  110. package/dist/runtime/types/chip.d.ts +11 -13
  111. package/dist/runtime/types/chip.js +0 -0
  112. package/dist/runtime/types/clipboard.d.ts +7 -1
  113. package/dist/runtime/types/clipboard.js +0 -0
  114. package/dist/runtime/types/command-palette.d.ts +23 -24
  115. package/dist/runtime/types/command-palette.js +0 -0
  116. package/dist/runtime/types/component.d.ts +17 -14
  117. package/dist/runtime/types/component.js +0 -0
  118. package/dist/runtime/types/divider.d.ts +2 -3
  119. package/dist/runtime/types/divider.js +0 -0
  120. package/dist/runtime/types/dropdown.d.ts +12 -13
  121. package/dist/runtime/types/dropdown.js +0 -0
  122. package/dist/runtime/types/form-group.d.ts +4 -5
  123. package/dist/runtime/types/form-group.js +0 -0
  124. package/dist/runtime/types/form.d.ts +29 -28
  125. package/dist/runtime/types/form.js +0 -0
  126. package/dist/runtime/types/horizontal-navigation.d.ts +10 -11
  127. package/dist/runtime/types/horizontal-navigation.js +0 -0
  128. package/dist/runtime/types/index.d.ts +31 -31
  129. package/dist/runtime/types/index.js +31 -0
  130. package/dist/runtime/types/input.d.ts +7 -8
  131. package/dist/runtime/types/input.js +0 -0
  132. package/dist/runtime/types/kbd.d.ts +4 -5
  133. package/dist/runtime/types/kbd.js +0 -0
  134. package/dist/runtime/types/link.d.ts +9 -10
  135. package/dist/runtime/types/link.js +0 -0
  136. package/dist/runtime/types/meter.d.ts +4 -5
  137. package/dist/runtime/types/meter.js +0 -0
  138. package/dist/runtime/types/modal.d.ts +13 -15
  139. package/dist/runtime/types/modal.js +0 -0
  140. package/dist/runtime/types/notification.d.ts +17 -20
  141. package/dist/runtime/types/notification.js +0 -0
  142. package/dist/runtime/types/popper.d.ts +13 -15
  143. package/dist/runtime/types/popper.js +0 -0
  144. package/dist/runtime/types/progress.d.ts +5 -6
  145. package/dist/runtime/types/progress.js +0 -0
  146. package/dist/runtime/types/range.d.ts +6 -7
  147. package/dist/runtime/types/range.js +0 -0
  148. package/dist/runtime/types/select.d.ts +7 -8
  149. package/dist/runtime/types/select.js +0 -0
  150. package/dist/runtime/types/slideover.d.ts +10 -12
  151. package/dist/runtime/types/slideover.js +0 -0
  152. package/dist/runtime/types/tabs.d.ts +6 -5
  153. package/dist/runtime/types/tabs.js +0 -0
  154. package/dist/runtime/types/textarea.d.ts +7 -8
  155. package/dist/runtime/types/textarea.js +0 -0
  156. package/dist/runtime/types/toggle.d.ts +6 -7
  157. package/dist/runtime/types/toggle.js +0 -0
  158. package/dist/runtime/types/tooltip.d.ts +5 -5
  159. package/dist/runtime/types/tooltip.js +0 -0
  160. package/dist/runtime/types/utils.d.ts +15 -27
  161. package/dist/runtime/types/utils.js +0 -0
  162. package/dist/runtime/types/vertical-navigation.d.ts +10 -11
  163. package/dist/runtime/types/vertical-navigation.js +0 -0
  164. package/dist/runtime/ui.config/data/table.d.ts +10 -0
  165. package/dist/runtime/ui.config/data/{table.mjs → table.js} +10 -0
  166. package/dist/runtime/ui.config/elements/accordion.d.ts +1 -0
  167. package/dist/runtime/ui.config/elements/{accordion.mjs → accordion.js} +3 -2
  168. package/dist/runtime/ui.config/elements/alert.d.ts +2 -2
  169. package/dist/runtime/ui.config/elements/avatar.d.ts +2 -2
  170. package/dist/runtime/ui.config/elements/{carousel.mjs → carousel.js} +1 -1
  171. package/dist/runtime/ui.config/elements/{dropdown.mjs → dropdown.js} +1 -1
  172. package/dist/runtime/ui.config/forms/{inputMenu.mjs → inputMenu.js} +1 -1
  173. package/dist/runtime/ui.config/forms/{select.mjs → select.js} +1 -1
  174. package/dist/runtime/ui.config/forms/{selectMenu.mjs → selectMenu.js} +2 -2
  175. package/dist/runtime/ui.config/forms/{textarea.mjs → textarea.js} +1 -1
  176. package/dist/runtime/ui.config/forms/toggle.d.ts +2 -2
  177. package/dist/runtime/ui.config/index.d.ts +43 -43
  178. package/dist/runtime/ui.config/index.js +43 -0
  179. package/dist/runtime/ui.config/navigation/{breadcrumb.mjs → breadcrumb.js} +2 -2
  180. package/dist/runtime/ui.config/navigation/commandPalette.d.ts +1 -1
  181. package/dist/runtime/ui.config/navigation/tabs.d.ts +1 -0
  182. package/dist/runtime/ui.config/navigation/{tabs.mjs → tabs.js} +2 -1
  183. package/dist/runtime/ui.config/overlays/{contextMenu.mjs → contextMenu.js} +1 -1
  184. package/dist/runtime/ui.config/overlays/{modal.mjs → modal.js} +2 -2
  185. package/dist/runtime/ui.config/overlays/notification.d.ts +1 -1
  186. package/dist/runtime/ui.config/overlays/{popover.mjs → popover.js} +1 -1
  187. package/dist/runtime/ui.config/overlays/{slideover.mjs → slideover.js} +2 -2
  188. package/dist/runtime/ui.config/overlays/{tooltip.mjs → tooltip.js} +1 -1
  189. package/dist/runtime/utils/colors.d.ts +2 -2
  190. package/dist/runtime/utils/{colors.mjs → colors.js} +1 -1
  191. package/dist/runtime/utils/index.d.ts +4 -4
  192. package/dist/runtime/utils/{index.mjs → index.js} +2 -2
  193. package/dist/runtime/utils/link.d.ts +26 -24
  194. package/dist/runtime/utils/{link.mjs → link.js} +1 -1
  195. package/dist/types.d.mts +1 -16
  196. package/dist/types.d.ts +1 -16
  197. package/package.json +19 -21
  198. package/dist/runtime/composables/useFormGroup.mjs +0 -45
  199. package/dist/runtime/ui.config/index.mjs +0 -43
  200. /package/dist/runtime/composables/{useCarouselScroll.mjs → useCarouselScroll.js} +0 -0
  201. /package/dist/runtime/composables/{usePopper.mjs → usePopper.js} +0 -0
  202. /package/dist/runtime/composables/{useShortcuts.mjs → useShortcuts.js} +0 -0
  203. /package/dist/runtime/composables/{useTimer.mjs → useTimer.js} +0 -0
  204. /package/dist/runtime/composables/{useToast.mjs → useToast.js} +0 -0
  205. /package/dist/runtime/ui.config/elements/{alert.mjs → alert.js} +0 -0
  206. /package/dist/runtime/ui.config/elements/{avatar.mjs → avatar.js} +0 -0
  207. /package/dist/runtime/ui.config/elements/{avatarGroup.mjs → avatarGroup.js} +0 -0
  208. /package/dist/runtime/ui.config/elements/{badge.mjs → badge.js} +0 -0
  209. /package/dist/runtime/ui.config/elements/{button.mjs → button.js} +0 -0
  210. /package/dist/runtime/ui.config/elements/{buttonGroup.mjs → buttonGroup.js} +0 -0
  211. /package/dist/runtime/ui.config/elements/{chip.mjs → chip.js} +0 -0
  212. /package/dist/runtime/ui.config/elements/{kbd.mjs → kbd.js} +0 -0
  213. /package/dist/runtime/ui.config/elements/{meter.mjs → meter.js} +0 -0
  214. /package/dist/runtime/ui.config/elements/{meterGroup.mjs → meterGroup.js} +0 -0
  215. /package/dist/runtime/ui.config/elements/{progress.mjs → progress.js} +0 -0
  216. /package/dist/runtime/ui.config/forms/{checkbox.mjs → checkbox.js} +0 -0
  217. /package/dist/runtime/ui.config/forms/{formGroup.mjs → formGroup.js} +0 -0
  218. /package/dist/runtime/ui.config/forms/{input.mjs → input.js} +0 -0
  219. /package/dist/runtime/ui.config/forms/{radio.mjs → radio.js} +0 -0
  220. /package/dist/runtime/ui.config/forms/{radioGroup.mjs → radioGroup.js} +0 -0
  221. /package/dist/runtime/ui.config/forms/{range.mjs → range.js} +0 -0
  222. /package/dist/runtime/ui.config/forms/{toggle.mjs → toggle.js} +0 -0
  223. /package/dist/runtime/ui.config/layout/{card.mjs → card.js} +0 -0
  224. /package/dist/runtime/ui.config/layout/{container.mjs → container.js} +0 -0
  225. /package/dist/runtime/ui.config/layout/{divider.mjs → divider.js} +0 -0
  226. /package/dist/runtime/ui.config/layout/{skeleton.mjs → skeleton.js} +0 -0
  227. /package/dist/runtime/ui.config/navigation/{commandPalette.mjs → commandPalette.js} +0 -0
  228. /package/dist/runtime/ui.config/navigation/{horizontalNavigation.mjs → horizontalNavigation.js} +0 -0
  229. /package/dist/runtime/ui.config/navigation/{pagination.mjs → pagination.js} +0 -0
  230. /package/dist/runtime/ui.config/navigation/{verticalNavigation.mjs → verticalNavigation.js} +0 -0
  231. /package/dist/runtime/ui.config/overlays/{notification.mjs → notification.js} +0 -0
  232. /package/dist/runtime/ui.config/overlays/{notifications.mjs → notifications.js} +0 -0
  233. /package/dist/runtime/ui.config/{popper.mjs → popper.js} +0 -0
  234. /package/dist/runtime/utils/{lodash.mjs → lodash.js} +0 -0
@@ -179,7 +179,7 @@ export default defineComponent({
179
179
  const { ui, attrs } = useUI("select", toRef(props, "ui"), config, toRef(props, "class"));
180
180
  const { size: sizeButtonGroup, rounded } = useInjectButtonGroup({ ui, props });
181
181
  const { emitFormChange, inputId, color, size: sizeFormGroup, name } = useFormGroup(props, config);
182
- const size = computed(() => sizeButtonGroup.value || sizeFormGroup.value);
182
+ const size = computed(() => sizeButtonGroup.value ?? sizeFormGroup.value);
183
183
  const onInput = (event) => {
184
184
  emit("update:modelValue", event.target.value);
185
185
  };
@@ -1,21 +1,131 @@
1
1
  import type { PropType, ComputedRef } from 'vue';
2
- import type { SelectSize, SelectVariant } from '../../types';
2
+ import type { SelectSize, SelectColor, SelectVariant, Strategy } from '../../types.js';
3
+ declare const config: {
4
+ form: string;
5
+ placeholder: string;
6
+ default: {
7
+ size: string;
8
+ color: string;
9
+ variant: string;
10
+ loadingIcon: string;
11
+ trailingIcon: string;
12
+ };
13
+ wrapper: string;
14
+ base: string;
15
+ rounded: string;
16
+ file: {
17
+ base: string;
18
+ };
19
+ size: {
20
+ '2xs': string;
21
+ xs: string;
22
+ sm: string;
23
+ md: string;
24
+ lg: string;
25
+ xl: string;
26
+ };
27
+ gap: {
28
+ '2xs': string;
29
+ xs: string;
30
+ sm: string;
31
+ md: string;
32
+ lg: string;
33
+ xl: string;
34
+ };
35
+ padding: {
36
+ '2xs': string;
37
+ xs: string;
38
+ sm: string;
39
+ md: string;
40
+ lg: string;
41
+ xl: string;
42
+ };
43
+ leading: {
44
+ padding: {
45
+ '2xs': string;
46
+ xs: string;
47
+ sm: string;
48
+ md: string;
49
+ lg: string;
50
+ xl: string;
51
+ };
52
+ };
53
+ trailing: {
54
+ padding: {
55
+ '2xs': string;
56
+ xs: string;
57
+ sm: string;
58
+ md: string;
59
+ lg: string;
60
+ xl: string;
61
+ };
62
+ };
63
+ color: {
64
+ white: {
65
+ outline: string;
66
+ };
67
+ gray: {
68
+ outline: string;
69
+ };
70
+ };
71
+ variant: {
72
+ outline: string;
73
+ none: string;
74
+ };
75
+ icon: {
76
+ base: string;
77
+ color: string;
78
+ loading: string;
79
+ size: {
80
+ '2xs': string;
81
+ xs: string;
82
+ sm: string;
83
+ md: string;
84
+ lg: string;
85
+ xl: string;
86
+ };
87
+ leading: {
88
+ wrapper: string;
89
+ pointer: string;
90
+ padding: {
91
+ '2xs': string;
92
+ xs: string;
93
+ sm: string;
94
+ md: string;
95
+ lg: string;
96
+ xl: string;
97
+ };
98
+ };
99
+ trailing: {
100
+ wrapper: string;
101
+ pointer: string;
102
+ padding: {
103
+ '2xs': string;
104
+ xs: string;
105
+ sm: string;
106
+ md: string;
107
+ lg: string;
108
+ xl: string;
109
+ };
110
+ };
111
+ };
112
+ };
3
113
  declare const _default: import("vue").DefineComponent<{
4
114
  modelValue: {
5
- type: (StringConstructor | ObjectConstructor | NumberConstructor)[];
115
+ type: (StringConstructor | NumberConstructor | ObjectConstructor)[];
6
116
  default: string;
7
117
  };
8
118
  id: {
9
119
  type: StringConstructor;
10
- default: null;
120
+ default: any;
11
121
  };
12
122
  name: {
13
123
  type: StringConstructor;
14
- default: null;
124
+ default: any;
15
125
  };
16
126
  placeholder: {
17
127
  type: StringConstructor;
18
- default: null;
128
+ default: any;
19
129
  };
20
130
  required: {
21
131
  type: BooleanConstructor;
@@ -27,19 +137,19 @@ declare const _default: import("vue").DefineComponent<{
27
137
  };
28
138
  icon: {
29
139
  type: StringConstructor;
30
- default: null;
140
+ default: any;
31
141
  };
32
142
  loadingIcon: {
33
143
  type: StringConstructor;
34
- default: () => any;
144
+ default: () => string;
35
145
  };
36
146
  leadingIcon: {
37
147
  type: StringConstructor;
38
- default: null;
148
+ default: any;
39
149
  };
40
150
  trailingIcon: {
41
151
  type: StringConstructor;
42
- default: () => any;
152
+ default: () => string;
43
153
  };
44
154
  trailing: {
45
155
  type: BooleanConstructor;
@@ -59,21 +169,21 @@ declare const _default: import("vue").DefineComponent<{
59
169
  };
60
170
  options: {
61
171
  type: ArrayConstructor;
62
- default: () => never[];
172
+ default: () => any[];
63
173
  };
64
174
  size: {
65
175
  type: PropType<SelectSize>;
66
- default: null;
176
+ default: any;
67
177
  validator(value: string): boolean;
68
178
  };
69
179
  color: {
70
- type: PropType<any>;
71
- default: () => any;
180
+ type: PropType<SelectColor>;
181
+ default: () => string;
72
182
  validator(value: string): boolean;
73
183
  };
74
184
  variant: {
75
185
  type: PropType<SelectVariant>;
76
- default: () => any;
186
+ default: () => string;
77
187
  validator(value: string): boolean;
78
188
  };
79
189
  optionAttribute: {
@@ -86,57 +196,168 @@ declare const _default: import("vue").DefineComponent<{
86
196
  };
87
197
  selectClass: {
88
198
  type: StringConstructor;
89
- default: null;
199
+ default: any;
90
200
  };
91
201
  class: {
92
202
  type: PropType<any>;
93
203
  default: () => "";
94
204
  };
95
205
  ui: {
96
- type: PropType<any>;
206
+ type: PropType<Partial<typeof config> & {
207
+ strategy?: Strategy;
208
+ }>;
97
209
  default: () => {};
98
210
  };
99
211
  }, {
100
- ui: ComputedRef<any>;
212
+ ui: ComputedRef<{
213
+ form: string;
214
+ placeholder: string;
215
+ default: {
216
+ size: string;
217
+ color: string;
218
+ variant: string;
219
+ loadingIcon: string;
220
+ trailingIcon: string;
221
+ };
222
+ wrapper: string;
223
+ base: string;
224
+ rounded: string;
225
+ file: {
226
+ base: string;
227
+ };
228
+ size: {
229
+ '2xs': string;
230
+ xs: string;
231
+ sm: string;
232
+ md: string;
233
+ lg: string;
234
+ xl: string;
235
+ };
236
+ gap: {
237
+ '2xs': string;
238
+ xs: string;
239
+ sm: string;
240
+ md: string;
241
+ lg: string;
242
+ xl: string;
243
+ };
244
+ padding: {
245
+ '2xs': string;
246
+ xs: string;
247
+ sm: string;
248
+ md: string;
249
+ lg: string;
250
+ xl: string;
251
+ };
252
+ leading: {
253
+ padding: {
254
+ '2xs': string;
255
+ xs: string;
256
+ sm: string;
257
+ md: string;
258
+ lg: string;
259
+ xl: string;
260
+ };
261
+ };
262
+ trailing: {
263
+ padding: {
264
+ '2xs': string;
265
+ xs: string;
266
+ sm: string;
267
+ md: string;
268
+ lg: string;
269
+ xl: string;
270
+ };
271
+ };
272
+ color: {
273
+ white: {
274
+ outline: string;
275
+ };
276
+ gray: {
277
+ outline: string;
278
+ };
279
+ };
280
+ variant: {
281
+ outline: string;
282
+ none: string;
283
+ };
284
+ icon: {
285
+ base: string;
286
+ color: string;
287
+ loading: string;
288
+ size: {
289
+ '2xs': string;
290
+ xs: string;
291
+ sm: string;
292
+ md: string;
293
+ lg: string;
294
+ xl: string;
295
+ };
296
+ leading: {
297
+ wrapper: string;
298
+ pointer: string;
299
+ padding: {
300
+ '2xs': string;
301
+ xs: string;
302
+ sm: string;
303
+ md: string;
304
+ lg: string;
305
+ xl: string;
306
+ };
307
+ };
308
+ trailing: {
309
+ wrapper: string;
310
+ pointer: string;
311
+ padding: {
312
+ '2xs': string;
313
+ xs: string;
314
+ sm: string;
315
+ md: string;
316
+ lg: string;
317
+ xl: string;
318
+ };
319
+ };
320
+ };
321
+ }>;
101
322
  attrs: ComputedRef<Pick<{
102
323
  [x: string]: unknown;
103
324
  }, string>>;
104
- name: ComputedRef<string | undefined>;
105
- inputId: ComputedRef<string | undefined>;
325
+ name: ComputedRef<string>;
326
+ inputId: ComputedRef<string>;
106
327
  normalizedOptionsWithPlaceholder: ComputedRef<{
107
- disabled?: boolean | undefined;
328
+ disabled?: boolean;
108
329
  children: {
109
330
  disabled?: boolean;
110
331
  }[];
111
332
  }[]>;
112
333
  normalizedValue: ComputedRef<any>;
113
334
  isLeading: ComputedRef<string | true>;
114
- isTrailing: ComputedRef<string | true | undefined>;
335
+ isTrailing: ComputedRef<string | true>;
115
336
  selectClass: ComputedRef<string>;
116
- leadingIconName: ComputedRef<string | undefined>;
337
+ leadingIconName: ComputedRef<string>;
117
338
  leadingIconClass: ComputedRef<string>;
118
339
  leadingWrapperIconClass: ComputedRef<string>;
119
- trailingIconName: ComputedRef<string | undefined>;
340
+ trailingIconName: ComputedRef<string>;
120
341
  trailingIconClass: ComputedRef<string>;
121
342
  trailingWrapperIconClass: ComputedRef<string>;
122
343
  onInput: (event: Event) => void;
123
344
  onChange: (event: Event) => void;
124
345
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:modelValue")[], "change" | "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
125
346
  modelValue: {
126
- type: (StringConstructor | ObjectConstructor | NumberConstructor)[];
347
+ type: (StringConstructor | NumberConstructor | ObjectConstructor)[];
127
348
  default: string;
128
349
  };
129
350
  id: {
130
351
  type: StringConstructor;
131
- default: null;
352
+ default: any;
132
353
  };
133
354
  name: {
134
355
  type: StringConstructor;
135
- default: null;
356
+ default: any;
136
357
  };
137
358
  placeholder: {
138
359
  type: StringConstructor;
139
- default: null;
360
+ default: any;
140
361
  };
141
362
  required: {
142
363
  type: BooleanConstructor;
@@ -148,19 +369,19 @@ declare const _default: import("vue").DefineComponent<{
148
369
  };
149
370
  icon: {
150
371
  type: StringConstructor;
151
- default: null;
372
+ default: any;
152
373
  };
153
374
  loadingIcon: {
154
375
  type: StringConstructor;
155
- default: () => any;
376
+ default: () => string;
156
377
  };
157
378
  leadingIcon: {
158
379
  type: StringConstructor;
159
- default: null;
380
+ default: any;
160
381
  };
161
382
  trailingIcon: {
162
383
  type: StringConstructor;
163
- default: () => any;
384
+ default: () => string;
164
385
  };
165
386
  trailing: {
166
387
  type: BooleanConstructor;
@@ -180,21 +401,21 @@ declare const _default: import("vue").DefineComponent<{
180
401
  };
181
402
  options: {
182
403
  type: ArrayConstructor;
183
- default: () => never[];
404
+ default: () => any[];
184
405
  };
185
406
  size: {
186
407
  type: PropType<SelectSize>;
187
- default: null;
408
+ default: any;
188
409
  validator(value: string): boolean;
189
410
  };
190
411
  color: {
191
- type: PropType<any>;
192
- default: () => any;
412
+ type: PropType<SelectColor>;
413
+ default: () => string;
193
414
  validator(value: string): boolean;
194
415
  };
195
416
  variant: {
196
417
  type: PropType<SelectVariant>;
197
- default: () => any;
418
+ default: () => string;
198
419
  validator(value: string): boolean;
199
420
  };
200
421
  optionAttribute: {
@@ -207,40 +428,42 @@ declare const _default: import("vue").DefineComponent<{
207
428
  };
208
429
  selectClass: {
209
430
  type: StringConstructor;
210
- default: null;
431
+ default: any;
211
432
  };
212
433
  class: {
213
434
  type: PropType<any>;
214
435
  default: () => "";
215
436
  };
216
437
  ui: {
217
- type: PropType<any>;
438
+ type: PropType<Partial<typeof config> & {
439
+ strategy?: Strategy;
440
+ }>;
218
441
  default: () => {};
219
442
  };
220
443
  }>> & {
221
- onChange?: ((...args: any[]) => any) | undefined;
222
- "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
444
+ onChange?: (...args: any[]) => any;
445
+ "onUpdate:modelValue"?: (...args: any[]) => any;
223
446
  }, {
224
- size: SelectSize;
225
447
  name: string;
448
+ size: SelectSize;
226
449
  required: boolean;
227
450
  class: any;
228
- leading: boolean;
229
- color: any;
230
- variant: SelectVariant;
231
451
  disabled: boolean;
232
- ui: any;
452
+ ui: {};
453
+ color: SelectColor;
454
+ variant: SelectVariant;
455
+ icon: string;
456
+ id: string;
457
+ leading: boolean;
458
+ options: unknown[];
459
+ modelValue: string | number | Record<string, any>;
233
460
  loading: boolean;
234
461
  padded: boolean;
235
- icon: string;
236
462
  loadingIcon: string;
237
463
  leadingIcon: string;
238
464
  trailingIcon: string;
239
465
  trailing: boolean;
240
- id: string;
241
- modelValue: string | number | Record<string, any>;
242
466
  placeholder: string;
243
- options: unknown[];
244
467
  optionAttribute: string;
245
468
  valueAttribute: string;
246
469
  selectClass: string;
@@ -4,7 +4,7 @@
4
4
  v-slot="{ open }"
5
5
  :by="by"
6
6
  :name="name"
7
- :model-value="modelValue"
7
+ :model-value="multiple ? (Array.isArray(modelValue) ? modelValue : []) : modelValue"
8
8
  :multiple="multiple"
9
9
  :disabled="disabled"
10
10
  as="div"
@@ -30,18 +30,18 @@
30
30
  <slot :open="open" :disabled="disabled" :loading="loading">
31
31
  <button :id="inputId" :class="selectClass" :disabled="disabled" type="button" v-bind="attrs">
32
32
  <span v-if="(isLeading && leadingIconName) || $slots.leading" :class="leadingWrapperIconClass">
33
- <slot name="leading" :disabled="disabled" :loading="loading">
33
+ <slot name="leading" :selected="selected" :disabled="disabled" :loading="loading">
34
34
  <UIcon :name="leadingIconName" :class="leadingIconClass" />
35
35
  </slot>
36
36
  </span>
37
37
 
38
- <slot name="label">
38
+ <slot name="label" :selected="selected">
39
39
  <span v-if="label" :class="uiMenu.label">{{ label }}</span>
40
40
  <span v-else :class="uiMenu.label">{{ placeholder || '&nbsp;' }}</span>
41
41
  </slot>
42
42
 
43
43
  <span v-if="(isTrailing && trailingIconName) || $slots.trailing" :class="trailingWrapperIconClass">
44
- <slot name="trailing" :disabled="disabled" :loading="loading">
44
+ <slot name="trailing" :selected="selected" :disabled="disabled" :loading="loading">
45
45
  <UIcon :name="trailingIconName" :class="trailingIconClass" aria-hidden="true" />
46
46
  </slot>
47
47
  </span>
@@ -68,15 +68,15 @@
68
68
  <component
69
69
  :is="searchable ? 'HComboboxOption' : 'HListboxOption'"
70
70
  v-for="(option, index) in filteredOptions"
71
- v-slot="{ active, selected, disabled: optionDisabled }"
71
+ v-slot="{ active, selected: optionSelected, disabled: optionDisabled }"
72
72
  :key="index"
73
73
  as="template"
74
74
  :value="valueAttribute ? option[valueAttribute] : option"
75
75
  :disabled="option.disabled"
76
76
  >
77
- <li :class="[uiMenu.option.base, uiMenu.option.rounded, uiMenu.option.padding, uiMenu.option.size, uiMenu.option.color, active ? uiMenu.option.active : uiMenu.option.inactive, selected && uiMenu.option.selected, optionDisabled && uiMenu.option.disabled]">
77
+ <li :class="[uiMenu.option.base, uiMenu.option.rounded, uiMenu.option.padding, uiMenu.option.size, uiMenu.option.color, active ? uiMenu.option.active : uiMenu.option.inactive, optionSelected && uiMenu.option.selected, optionDisabled && uiMenu.option.disabled]">
78
78
  <div :class="uiMenu.option.container">
79
- <slot name="option" :option="option" :active="active" :selected="selected">
79
+ <slot name="option" :option="option" :active="active" :selected="optionSelected">
80
80
  <UIcon v-if="option.icon" :name="option.icon" :class="[uiMenu.option.icon.base, active ? uiMenu.option.icon.active : uiMenu.option.icon.inactive, option.iconClass]" aria-hidden="true" />
81
81
  <UAvatar
82
82
  v-else-if="option.avatar"
@@ -90,16 +90,16 @@
90
90
  </slot>
91
91
  </div>
92
92
 
93
- <span v-if="selected" :class="[uiMenu.option.selectedIcon.wrapper, uiMenu.option.selectedIcon.padding]">
93
+ <span v-if="optionSelected" :class="[uiMenu.option.selectedIcon.wrapper, uiMenu.option.selectedIcon.padding]">
94
94
  <UIcon :name="selectedIcon" :class="uiMenu.option.selectedIcon.base" aria-hidden="true" />
95
95
  </span>
96
96
  </li>
97
97
  </component>
98
98
 
99
- <component :is="searchable ? 'HComboboxOption' : 'HListboxOption'" v-if="creatable && createOption" v-slot="{ active, selected }" :value="createOption" as="template">
99
+ <component :is="searchable ? 'HComboboxOption' : 'HListboxOption'" v-if="creatable && createOption" v-slot="{ active, selected: optionSelected }" :value="createOption" as="template">
100
100
  <li :class="[uiMenu.option.base, uiMenu.option.rounded, uiMenu.option.padding, uiMenu.option.size, uiMenu.option.color, active ? uiMenu.option.active : uiMenu.option.inactive]">
101
101
  <div :class="uiMenu.option.container">
102
- <slot name="option-create" :option="createOption" :active="active" :selected="selected">
102
+ <slot name="option-create" :option="createOption" :active="active" :selected="optionSelected">
103
103
  <span :class="uiMenu.option.create">Create "{{ createOption[optionAttribute] }}"</span>
104
104
  </slot>
105
105
  </div>
@@ -260,7 +260,7 @@ export default defineComponent({
260
260
  default: false
261
261
  },
262
262
  showCreateOptionWhen: {
263
- type: String,
263
+ type: [String, Function],
264
264
  default: () => configMenu.default.showCreateOptionWhen
265
265
  },
266
266
  placeholder: {
@@ -330,13 +330,16 @@ export default defineComponent({
330
330
  },
331
331
  emits: ["update:modelValue", "update:query", "open", "close", "change"],
332
332
  setup(props, { emit, slots }) {
333
+ if (import.meta.dev && props.multiple && !Array.isArray(props.modelValue)) {
334
+ console.warn(`[@nuxt/ui] The USelectMenu components needs to have a modelValue of type Array when using the multiple prop. Got '${typeof props.modelValue}' instead.`, props.modelValue);
335
+ }
333
336
  const { ui, attrs } = useUI("select", toRef(props, "ui"), config, toRef(props, "class"));
334
337
  const { ui: uiMenu } = useUI("selectMenu", toRef(props, "uiMenu"), configMenu);
335
338
  const popper = computed(() => defu({}, props.popper, uiMenu.value.popper));
336
339
  const [trigger, container] = usePopper(popper.value);
337
340
  const { size: sizeButtonGroup, rounded } = useInjectButtonGroup({ ui, props });
338
341
  const { emitFormBlur, emitFormChange, inputId, color, size: sizeFormGroup, name } = useFormGroup(props, config);
339
- const size = computed(() => sizeButtonGroup.value || sizeFormGroup.value);
342
+ const size = computed(() => sizeButtonGroup.value ?? sizeFormGroup.value);
340
343
  const internalQuery = ref("");
341
344
  const query = computed({
342
345
  get() {
@@ -347,17 +350,31 @@ export default defineComponent({
347
350
  emit("update:query", value);
348
351
  }
349
352
  });
353
+ const selected = computed(() => {
354
+ if (props.multiple) {
355
+ if (!Array.isArray(props.modelValue) || !props.modelValue.length) {
356
+ return [];
357
+ }
358
+ if (props.valueAttribute) {
359
+ return options.value.filter((option) => props.modelValue.includes(option[props.valueAttribute]));
360
+ }
361
+ return options.value.filter((option) => props.modelValue.includes(option));
362
+ }
363
+ if (props.valueAttribute) {
364
+ return options.value.find((option) => option[props.valueAttribute] === props.modelValue);
365
+ }
366
+ return options.value.find((option) => option === props.modelValue);
367
+ });
350
368
  const label = computed(() => {
351
369
  if (props.multiple) {
352
370
  if (Array.isArray(props.modelValue) && props.modelValue.length) {
353
- return `${props.modelValue.length} selected`;
371
+ return `${selected.value.length} selected`;
354
372
  } else {
355
373
  return null;
356
374
  }
357
375
  } else if (props.modelValue !== void 0 && props.modelValue !== null) {
358
376
  if (props.valueAttribute) {
359
- const option = props.options.find((option2) => option2[props.valueAttribute] === props.modelValue);
360
- return option ? option[props.optionAttribute] : null;
377
+ return selected.value?.[props.optionAttribute] ?? null;
361
378
  } else {
362
379
  return ["string", "number"].includes(typeof props.modelValue) ? props.modelValue : props.modelValue[props.optionAttribute];
363
380
  }
@@ -426,15 +443,20 @@ export default defineComponent({
426
443
  props.loading && !isLeading.value && ui.value.icon.loading
427
444
  );
428
445
  });
429
- const debouncedSearch = typeof props.searchable === "function" ? useDebounceFn(props.searchable, props.debounce) : void 0;
430
- const filteredOptions = computedAsync(async () => {
431
- if (props.searchable && debouncedSearch) {
446
+ const debouncedSearch = props.searchable && typeof props.searchable === "function" ? useDebounceFn(props.searchable, props.debounce) : void 0;
447
+ const options = computedAsync(async () => {
448
+ if (debouncedSearch) {
432
449
  return await debouncedSearch(query.value);
433
450
  }
434
- if (query.value === "") {
435
- return props.options;
451
+ return props.options || [];
452
+ }, [], {
453
+ lazy: props.searchableLazy
454
+ });
455
+ const filteredOptions = computed(() => {
456
+ if (!query.value || debouncedSearch) {
457
+ return options.value;
436
458
  }
437
- return props.options.filter((option) => {
459
+ return options.value.filter((option) => {
438
460
  return (props.searchAttributes?.length ? props.searchAttributes : [props.optionAttribute]).some((searchAttribute) => {
439
461
  if (["string", "number"].includes(typeof option)) {
440
462
  return String(option).search(new RegExp(query.value, "i")) !== -1;
@@ -443,8 +465,6 @@ export default defineComponent({
443
465
  return child !== null && child !== void 0 && String(child).search(new RegExp(query.value, "i")) !== -1;
444
466
  });
445
467
  });
446
- }, [], {
447
- lazy: props.searchableLazy
448
468
  });
449
469
  const createOption = computed(() => {
450
470
  if (query.value === "") {
@@ -459,6 +479,11 @@ export default defineComponent({
459
479
  return null;
460
480
  }
461
481
  }
482
+ if (typeof props.showCreateOptionWhen === "function") {
483
+ if (!props.showCreateOptionWhen(query.value, filteredOptions.value)) {
484
+ return null;
485
+ }
486
+ }
462
487
  return ["string", "number"].includes(typeof props.modelValue) ? query.value : { [props.optionAttribute]: query.value };
463
488
  });
464
489
  function clearOnClose() {
@@ -497,6 +522,7 @@ export default defineComponent({
497
522
  popper,
498
523
  trigger,
499
524
  container,
525
+ selected,
500
526
  label,
501
527
  isLeading,
502
528
  isTrailing,