@nuxt/ui 2.11.0 → 2.12.0

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 (159) hide show
  1. package/dist/module.d.mts +294 -48
  2. package/dist/module.d.ts +294 -48
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +6 -4
  5. package/dist/runtime/components/data/Table.vue +29 -21
  6. package/dist/runtime/components/data/Table.vue.d.ts +28 -19
  7. package/dist/runtime/components/elements/Accordion.vue +10 -6
  8. package/dist/runtime/components/elements/Accordion.vue.d.ts +11 -11
  9. package/dist/runtime/components/elements/Alert.vue +12 -6
  10. package/dist/runtime/components/elements/Alert.vue.d.ts +12 -17
  11. package/dist/runtime/components/elements/Avatar.vue +2 -2
  12. package/dist/runtime/components/elements/Avatar.vue.d.ts +7 -7
  13. package/dist/runtime/components/elements/AvatarGroup.d.ts +7 -7
  14. package/dist/runtime/components/elements/AvatarGroup.mjs +2 -2
  15. package/dist/runtime/components/elements/Badge.vue +2 -2
  16. package/dist/runtime/components/elements/Badge.vue.d.ts +7 -7
  17. package/dist/runtime/components/elements/Button.vue +8 -6
  18. package/dist/runtime/components/elements/Button.vue.d.ts +9 -8
  19. package/dist/runtime/components/elements/ButtonGroup.d.ts +7 -7
  20. package/dist/runtime/components/elements/ButtonGroup.mjs +3 -16
  21. package/dist/runtime/components/elements/Chip.vue +2 -2
  22. package/dist/runtime/components/elements/Chip.vue.d.ts +9 -9
  23. package/dist/runtime/components/elements/Dropdown.vue +68 -19
  24. package/dist/runtime/components/elements/Dropdown.vue.d.ts +37 -9
  25. package/dist/runtime/components/elements/Kbd.vue +2 -2
  26. package/dist/runtime/components/elements/Kbd.vue.d.ts +7 -7
  27. package/dist/runtime/components/elements/Link.vue +2 -2
  28. package/dist/runtime/components/elements/Meter.vue +2 -2
  29. package/dist/runtime/components/elements/Meter.vue.d.ts +7 -7
  30. package/dist/runtime/components/elements/MeterGroup.d.ts +9 -9
  31. package/dist/runtime/components/elements/MeterGroup.mjs +8 -21
  32. package/dist/runtime/components/elements/Progress.vue +5 -94
  33. package/dist/runtime/components/elements/Progress.vue.d.ts +123 -1
  34. package/dist/runtime/components/forms/Checkbox.vue +7 -7
  35. package/dist/runtime/components/forms/Checkbox.vue.d.ts +8 -8
  36. package/dist/runtime/components/forms/Form.vue +17 -8
  37. package/dist/runtime/components/forms/Form.vue.d.ts +1 -1
  38. package/dist/runtime/components/forms/FormGroup.vue +2 -2
  39. package/dist/runtime/components/forms/FormGroup.vue.d.ts +7 -7
  40. package/dist/runtime/components/forms/Input.vue +8 -8
  41. package/dist/runtime/components/forms/Input.vue.d.ts +11 -11
  42. package/dist/runtime/components/forms/InputMenu.vue +410 -0
  43. package/dist/runtime/components/forms/InputMenu.vue.d.ts +331 -0
  44. package/dist/runtime/components/forms/Radio.vue +7 -7
  45. package/dist/runtime/components/forms/Radio.vue.d.ts +7 -7
  46. package/dist/runtime/components/forms/RadioGroup.vue +5 -5
  47. package/dist/runtime/components/forms/RadioGroup.vue.d.ts +13 -13
  48. package/dist/runtime/components/forms/Range.vue +5 -5
  49. package/dist/runtime/components/forms/Range.vue.d.ts +8 -8
  50. package/dist/runtime/components/forms/Select.vue +8 -8
  51. package/dist/runtime/components/forms/Select.vue.d.ts +10 -10
  52. package/dist/runtime/components/forms/SelectMenu.vue +69 -36
  53. package/dist/runtime/components/forms/SelectMenu.vue.d.ts +40 -20
  54. package/dist/runtime/components/forms/Textarea.vue +3 -3
  55. package/dist/runtime/components/forms/Textarea.vue.d.ts +10 -10
  56. package/dist/runtime/components/forms/Toggle.vue +10 -10
  57. package/dist/runtime/components/forms/Toggle.vue.d.ts +16 -15
  58. package/dist/runtime/components/layout/Card.vue +2 -2
  59. package/dist/runtime/components/layout/Card.vue.d.ts +7 -7
  60. package/dist/runtime/components/layout/Container.vue +2 -2
  61. package/dist/runtime/components/layout/Container.vue.d.ts +7 -7
  62. package/dist/runtime/components/layout/Divider.vue +3 -8
  63. package/dist/runtime/components/layout/Divider.vue.d.ts +7 -7
  64. package/dist/runtime/components/layout/Skeleton.vue +2 -2
  65. package/dist/runtime/components/layout/Skeleton.vue.d.ts +7 -7
  66. package/dist/runtime/components/navigation/Breadcrumb.vue +9 -6
  67. package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +10 -7
  68. package/dist/runtime/components/navigation/CommandPalette.vue +42 -33
  69. package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +16 -9
  70. package/dist/runtime/components/navigation/CommandPaletteGroup.vue +1 -3
  71. package/dist/runtime/components/navigation/Pagination.vue +16 -11
  72. package/dist/runtime/components/navigation/Pagination.vue.d.ts +16 -7
  73. package/dist/runtime/components/navigation/Tabs.vue +8 -5
  74. package/dist/runtime/components/navigation/Tabs.vue.d.ts +9 -9
  75. package/dist/runtime/components/navigation/VerticalNavigation.vue +56 -39
  76. package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +14 -10
  77. package/dist/runtime/components/overlays/ContextMenu.vue +4 -3
  78. package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +7 -7
  79. package/dist/runtime/components/overlays/Modal.vue +3 -6
  80. package/dist/runtime/components/overlays/Modal.vue.d.ts +8 -8
  81. package/dist/runtime/components/overlays/Notification.vue +7 -7
  82. package/dist/runtime/components/overlays/Notification.vue.d.ts +7 -7
  83. package/dist/runtime/components/overlays/Notifications.vue +2 -2
  84. package/dist/runtime/components/overlays/Notifications.vue.d.ts +7 -7
  85. package/dist/runtime/components/overlays/Popover.vue +54 -17
  86. package/dist/runtime/components/overlays/Popover.vue.d.ts +21 -11
  87. package/dist/runtime/components/overlays/Slideover.vue +6 -6
  88. package/dist/runtime/components/overlays/Slideover.vue.d.ts +8 -8
  89. package/dist/runtime/components/overlays/Tooltip.vue +6 -5
  90. package/dist/runtime/components/overlays/Tooltip.vue.d.ts +7 -7
  91. package/dist/runtime/composables/useFormGroup.d.ts +3 -3
  92. package/dist/runtime/composables/useFormGroup.mjs +1 -1
  93. package/dist/runtime/composables/useShortcuts.mjs +3 -1
  94. package/dist/runtime/composables/useUI.d.ts +3 -3
  95. package/dist/runtime/types/alert.d.ts +5 -0
  96. package/dist/runtime/types/breadcrumb.d.ts +3 -0
  97. package/dist/runtime/types/dropdown.d.ts +2 -0
  98. package/dist/runtime/types/form.d.ts +2 -1
  99. package/dist/runtime/types/popper.d.ts +2 -0
  100. package/dist/runtime/types/utils.d.ts +4 -4
  101. package/dist/runtime/types/vertical-navigation.d.ts +1 -0
  102. package/dist/runtime/ui.config/data/table.d.ts +2 -2
  103. package/dist/runtime/ui.config/elements/accordion.d.ts +1 -1
  104. package/dist/runtime/ui.config/elements/alert.d.ts +5 -4
  105. package/dist/runtime/ui.config/elements/alert.mjs +1 -0
  106. package/dist/runtime/ui.config/elements/button.d.ts +4 -0
  107. package/dist/runtime/ui.config/elements/button.mjs +4 -0
  108. package/dist/runtime/ui.config/elements/buttonGroup.d.ts +92 -0
  109. package/dist/runtime/ui.config/elements/buttonGroup.mjs +12 -1
  110. package/dist/runtime/ui.config/elements/dropdown.d.ts +3 -1
  111. package/dist/runtime/ui.config/elements/dropdown.mjs +4 -2
  112. package/dist/runtime/ui.config/elements/meterGroup.d.ts +40 -0
  113. package/dist/runtime/ui.config/elements/meterGroup.mjs +14 -1
  114. package/dist/runtime/ui.config/forms/checkbox.d.ts +3 -0
  115. package/dist/runtime/ui.config/forms/checkbox.mjs +3 -0
  116. package/dist/runtime/ui.config/forms/input.d.ts +2 -0
  117. package/dist/runtime/ui.config/forms/input.mjs +14 -12
  118. package/dist/runtime/ui.config/forms/inputMenu.d.ts +64 -0
  119. package/dist/runtime/ui.config/forms/inputMenu.mjs +62 -0
  120. package/dist/runtime/ui.config/forms/radio.d.ts +3 -0
  121. package/dist/runtime/ui.config/forms/radio.mjs +3 -0
  122. package/dist/runtime/ui.config/forms/select.d.ts +2 -0
  123. package/dist/runtime/ui.config/forms/select.mjs +1 -0
  124. package/dist/runtime/ui.config/forms/selectMenu.d.ts +18 -11
  125. package/dist/runtime/ui.config/forms/selectMenu.mjs +12 -41
  126. package/dist/runtime/ui.config/forms/textarea.d.ts +2 -0
  127. package/dist/runtime/ui.config/forms/textarea.mjs +1 -0
  128. package/dist/runtime/ui.config/index.d.ts +1 -0
  129. package/dist/runtime/ui.config/index.mjs +1 -0
  130. package/dist/runtime/ui.config/layout/card.mjs +1 -1
  131. package/dist/runtime/ui.config/layout/divider.d.ts +6 -1
  132. package/dist/runtime/ui.config/layout/divider.mjs +5 -0
  133. package/dist/runtime/ui.config/navigation/breadcrumb.d.ts +1 -0
  134. package/dist/runtime/ui.config/navigation/breadcrumb.mjs +2 -1
  135. package/dist/runtime/ui.config/navigation/commandPalette.d.ts +5 -1
  136. package/dist/runtime/ui.config/navigation/commandPalette.mjs +5 -1
  137. package/dist/runtime/ui.config/navigation/pagination.d.ts +6 -6
  138. package/dist/runtime/ui.config/navigation/verticalNavigation.d.ts +6 -1
  139. package/dist/runtime/ui.config/navigation/verticalNavigation.mjs +5 -0
  140. package/dist/runtime/ui.config/overlays/contextMenu.mjs +1 -1
  141. package/dist/runtime/ui.config/overlays/modal.d.ts +1 -0
  142. package/dist/runtime/ui.config/overlays/modal.mjs +3 -2
  143. package/dist/runtime/ui.config/overlays/notification.d.ts +5 -4
  144. package/dist/runtime/ui.config/overlays/notification.mjs +1 -0
  145. package/dist/runtime/ui.config/overlays/popover.d.ts +1 -0
  146. package/dist/runtime/ui.config/overlays/popover.mjs +2 -1
  147. package/dist/runtime/ui.config/overlays/slideover.d.ts +5 -0
  148. package/dist/runtime/ui.config/overlays/slideover.mjs +5 -0
  149. package/dist/runtime/ui.config/overlays/tooltip.d.ts +1 -0
  150. package/dist/runtime/ui.config/overlays/tooltip.mjs +2 -1
  151. package/dist/runtime/ui.config/{_popperArrow.d.ts → popper.d.ts} +1 -2
  152. package/dist/runtime/ui.config/popper.mjs +9 -0
  153. package/dist/runtime/ui.css +1 -13
  154. package/dist/runtime/utils/index.mjs +11 -3
  155. package/dist/runtime/utils/uid.mjs +2 -1
  156. package/dist/types.d.mts +2 -2
  157. package/dist/types.d.ts +1 -1
  158. package/package.json +29 -28
  159. package/dist/runtime/ui.config/_popperArrow.mjs +0 -8
@@ -90,11 +90,11 @@ declare const _default: import("vue").DefineComponent<{
90
90
  };
91
91
  class: {
92
92
  type: PropType<any>;
93
- default: undefined;
93
+ default: () => "";
94
94
  };
95
95
  ui: {
96
- type: PropType<Partial<any>>;
97
- default: undefined;
96
+ type: PropType<any>;
97
+ default: () => {};
98
98
  };
99
99
  }, {
100
100
  ui: ComputedRef<any>;
@@ -102,7 +102,7 @@ declare const _default: import("vue").DefineComponent<{
102
102
  [x: string]: unknown;
103
103
  }, string>>;
104
104
  name: ComputedRef<string | undefined>;
105
- inputId: import("vue").Ref<string | null | undefined>;
105
+ inputId: import("vue").Ref<string | undefined>;
106
106
  normalizedOptionsWithPlaceholder: ComputedRef<{
107
107
  disabled?: boolean | undefined;
108
108
  children: {
@@ -119,7 +119,7 @@ declare const _default: import("vue").DefineComponent<{
119
119
  trailingIconName: ComputedRef<string | undefined>;
120
120
  trailingIconClass: ComputedRef<string>;
121
121
  trailingWrapperIconClass: ComputedRef<string>;
122
- onInput: (event: InputEvent) => void;
122
+ onInput: (event: Event) => void;
123
123
  onChange: (event: Event) => void;
124
124
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:modelValue")[], "change" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
125
125
  modelValue: {
@@ -211,23 +211,24 @@ declare const _default: import("vue").DefineComponent<{
211
211
  };
212
212
  class: {
213
213
  type: PropType<any>;
214
- default: undefined;
214
+ default: () => "";
215
215
  };
216
216
  ui: {
217
- type: PropType<Partial<any>>;
218
- default: undefined;
217
+ type: PropType<any>;
218
+ default: () => {};
219
219
  };
220
220
  }>> & {
221
221
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
222
222
  onChange?: ((...args: any[]) => any) | undefined;
223
223
  }, {
224
224
  size: SelectSize;
225
- ui: Partial<any>;
225
+ ui: any;
226
226
  id: string;
227
227
  icon: string;
228
228
  color: any;
229
229
  options: unknown[];
230
230
  name: string;
231
+ leading: boolean;
231
232
  class: any;
232
233
  modelValue: string | number | Record<string, any>;
233
234
  loading: boolean;
@@ -240,7 +241,6 @@ declare const _default: import("vue").DefineComponent<{
240
241
  leadingIcon: string;
241
242
  trailingIcon: string;
242
243
  trailing: boolean;
243
- leading: boolean;
244
244
  optionAttribute: string;
245
245
  valueAttribute: string;
246
246
  selectClass: string;
@@ -6,7 +6,7 @@
6
6
  :name="name"
7
7
  :model-value="modelValue"
8
8
  :multiple="multiple"
9
- :disabled="disabled || loading"
9
+ :disabled="disabled"
10
10
  as="div"
11
11
  :class="ui.wrapper"
12
12
  @update:model-value="onUpdate"
@@ -15,7 +15,7 @@
15
15
  v-if="required"
16
16
  :value="modelValue"
17
17
  :required="required"
18
- class="absolute inset-0 w-px opacity-0 cursor-default"
18
+ :class="uiMenu.required"
19
19
  tabindex="-1"
20
20
  aria-hidden="true"
21
21
  >
@@ -25,10 +25,10 @@
25
25
  ref="trigger"
26
26
  as="div"
27
27
  role="button"
28
- class="inline-flex w-full"
28
+ :class="uiMenu.trigger"
29
29
  >
30
30
  <slot :open="open" :disabled="disabled" :loading="loading">
31
- <button :id="inputId" :class="selectClass" :disabled="disabled || loading" type="button" v-bind="attrs">
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
33
  <slot name="leading" :disabled="disabled" :loading="loading">
34
34
  <UIcon :name="leadingIconName" :class="leadingIconClass" />
@@ -36,9 +36,9 @@
36
36
  </span>
37
37
 
38
38
  <slot name="label">
39
- <span v-if="multiple && Array.isArray(modelValue) && modelValue.length" class="block truncate">{{ modelValue.length }} selected</span>
40
- <span v-else-if="!multiple && modelValue" class="block truncate">{{ ['string', 'number'].includes(typeof modelValue) ? modelValue : modelValue[optionAttribute] }}</span>
41
- <span v-else class="block truncate" :class="uiMenu.placeholder">{{ placeholder || '&nbsp;' }}</span>
39
+ <span v-if="multiple && Array.isArray(modelValue) && modelValue.length" :class="uiMenu.label">{{ modelValue.length }} selected</span>
40
+ <span v-else-if="!multiple && modelValue" :class="uiMenu.label">{{ ['string', 'number'].includes(typeof modelValue) ? modelValue : modelValue[optionAttribute] }}</span>
41
+ <span v-else :class="uiMenu.label">{{ placeholder || '&nbsp;' }}</span>
42
42
  </slot>
43
43
 
44
44
  <span v-if="(isTrailing && trailingIconName) || $slots.trailing" :class="trailingWrapperIconClass">
@@ -53,18 +53,18 @@
53
53
  <div v-if="open" ref="container" :class="[uiMenu.container, uiMenu.width]">
54
54
  <Transition appear v-bind="uiMenu.transition">
55
55
  <div>
56
- <div v-if="popper.arrow" data-popper-arrow :class="['invisible before:visible before:block before:rotate-45 before:z-[-1]', Object.values(uiMenu.arrow)]" />
57
- <component :is="searchable ? 'HComboboxOptions' : 'HListboxOptions'" static :class="[uiMenu.base, uiMenu.divide, uiMenu.ring, uiMenu.rounded, uiMenu.shadow, uiMenu.background, uiMenu.padding, uiMenu.height]">
56
+ <div v-if="popper.arrow" data-popper-arrow :class="Object.values(uiMenu.arrow)" />
57
+
58
+ <component :is="searchable ? 'HComboboxOptions' : 'HListboxOptions'" static :class="[uiMenu.base, uiMenu.ring, uiMenu.rounded, uiMenu.shadow, uiMenu.background, uiMenu.padding, uiMenu.height]">
58
59
  <HComboboxInput
59
60
  v-if="searchable"
60
- ref="searchInput"
61
61
  :display-value="() => query"
62
62
  name="q"
63
63
  :placeholder="searchablePlaceholder"
64
64
  autofocus
65
65
  autocomplete="off"
66
66
  :class="uiMenu.input"
67
- @change="query = $event.target.value"
67
+ @change="onChange"
68
68
  />
69
69
  <component
70
70
  :is="searchable ? 'HComboboxOption' : 'HListboxOption'"
@@ -97,11 +97,11 @@
97
97
  </li>
98
98
  </component>
99
99
 
100
- <component :is="searchable ? 'HComboboxOption' : 'HListboxOption'" v-if="creatable && queryOption && !filteredOptions.length" v-slot="{ active, selected }" :value="queryOption" as="template">
100
+ <component :is="searchable ? 'HComboboxOption' : 'HListboxOption'" v-if="creatable && createOption" v-slot="{ active, selected }" :value="createOption" as="template">
101
101
  <li :class="[uiMenu.option.base, uiMenu.option.rounded, uiMenu.option.padding, uiMenu.option.size, uiMenu.option.color, active ? uiMenu.option.active : uiMenu.option.inactive]">
102
102
  <div :class="uiMenu.option.container">
103
- <slot name="option-create" :option="queryOption" :active="active" :selected="selected">
104
- <span class="block truncate">Create "{{ queryOption[optionAttribute] }}"</span>
103
+ <slot name="option-create" :option="createOption" :active="active" :selected="selected">
104
+ <span :class="uiMenu.option.create">Create "{{ createOption[optionAttribute] }}"</span>
105
105
  </slot>
106
106
  </div>
107
107
  </li>
@@ -111,6 +111,11 @@
111
111
  No results for "{{ query }}".
112
112
  </slot>
113
113
  </p>
114
+ <p v-else-if="!filteredOptions.length" :class="uiMenu.empty">
115
+ <slot name="empty" :query="query">
116
+ No options.
117
+ </slot>
118
+ </p>
114
119
  </component>
115
120
  </div>
116
121
  </Transition>
@@ -165,6 +170,10 @@ export default defineComponent({
165
170
  type: [String, Number, Object, Array],
166
171
  default: ""
167
172
  },
173
+ query: {
174
+ type: String,
175
+ default: null
176
+ },
168
177
  by: {
169
178
  type: String,
170
179
  default: void 0
@@ -235,7 +244,7 @@ export default defineComponent({
235
244
  },
236
245
  clearSearchOnClose: {
237
246
  type: Boolean,
238
- default: () => configMenu.default.clearOnClose
247
+ default: () => configMenu.default.clearSearchOnClose
239
248
  },
240
249
  debounce: {
241
250
  type: Number,
@@ -245,6 +254,10 @@ export default defineComponent({
245
254
  type: Boolean,
246
255
  default: false
247
256
  },
257
+ showCreateOptionWhen: {
258
+ type: String,
259
+ default: () => configMenu.default.showCreateOptionWhen
260
+ },
248
261
  placeholder: {
249
262
  type: String,
250
263
  default: null
@@ -299,18 +312,18 @@ export default defineComponent({
299
312
  },
300
313
  class: {
301
314
  type: [String, Object, Array],
302
- default: void 0
315
+ default: () => ""
303
316
  },
304
317
  ui: {
305
318
  type: Object,
306
- default: void 0
319
+ default: () => ({})
307
320
  },
308
321
  uiMenu: {
309
322
  type: Object,
310
- default: void 0
323
+ default: () => ({})
311
324
  }
312
325
  },
313
- emits: ["update:modelValue", "open", "close", "change"],
326
+ emits: ["update:modelValue", "update:query", "open", "close", "change"],
314
327
  setup(props, { emit, slots }) {
315
328
  const { ui, attrs } = useUI("select", toRef(props, "ui"), config, toRef(props, "class"));
316
329
  const { ui: uiMenu } = useUI("selectMenu", toRef(props, "uiMenu"), configMenu);
@@ -319,21 +332,28 @@ export default defineComponent({
319
332
  const { size: sizeButtonGroup, rounded } = useInjectButtonGroup({ ui, props });
320
333
  const { emitFormBlur, emitFormChange, inputId, color, size: sizeFormGroup, name } = useFormGroup(props, config);
321
334
  const size = computed(() => sizeButtonGroup.value || sizeFormGroup.value);
322
- const query = ref("");
323
- const searchInput = ref();
335
+ const internalQuery = ref("");
336
+ const query = computed({
337
+ get() {
338
+ return props.query ?? internalQuery.value;
339
+ },
340
+ set(value) {
341
+ internalQuery.value = value;
342
+ emit("update:query", value);
343
+ }
344
+ });
324
345
  const selectClass = computed(() => {
325
346
  const variant = ui.value.color?.[color.value]?.[props.variant] || ui.value.variant[props.variant];
326
347
  return twMerge(twJoin(
327
348
  ui.value.base,
349
+ uiMenu.value.select,
328
350
  rounded.value,
329
- "text-left cursor-default",
330
351
  ui.value.size[size.value],
331
352
  ui.value.gap[size.value],
332
353
  props.padded ? ui.value.padding[size.value] : "p-0",
333
354
  variant?.replaceAll("{color}", color.value),
334
355
  (isLeading.value || slots.leading) && ui.value.leading.padding[size.value],
335
- (isTrailing.value || slots.trailing) && ui.value.trailing.padding[size.value],
336
- "inline-flex items-center"
356
+ (isTrailing.value || slots.trailing) && ui.value.trailing.padding[size.value]
337
357
  ), props.selectClass);
338
358
  });
339
359
  const isLeading = computed(() => {
@@ -364,9 +384,9 @@ export default defineComponent({
364
384
  const leadingIconClass = computed(() => {
365
385
  return twJoin(
366
386
  ui.value.icon.base,
367
- appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
387
+ color.value && appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
368
388
  ui.value.icon.size[size.value],
369
- props.loading && "animate-spin"
389
+ props.loading && ui.value.icon.loading
370
390
  );
371
391
  });
372
392
  const trailingWrapperIconClass = computed(() => {
@@ -379,9 +399,9 @@ export default defineComponent({
379
399
  const trailingIconClass = computed(() => {
380
400
  return twJoin(
381
401
  ui.value.icon.base,
382
- appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
402
+ color.value && appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
383
403
  ui.value.icon.size[size.value],
384
- props.loading && !isLeading.value && "animate-spin"
404
+ props.loading && !isLeading.value && ui.value.icon.loading
385
405
  );
386
406
  });
387
407
  const debouncedSearch = typeof props.searchable === "function" ? useDebounceFn(props.searchable, props.debounce) : void 0;
@@ -402,8 +422,20 @@ export default defineComponent({
402
422
  });
403
423
  });
404
424
  });
405
- const queryOption = computed(() => {
406
- return query.value === "" ? null : { [props.optionAttribute]: query.value };
425
+ const createOption = computed(() => {
426
+ if (query.value === "") {
427
+ return null;
428
+ }
429
+ if (props.showCreateOptionWhen === "empty" && filteredOptions.value.length) {
430
+ return null;
431
+ }
432
+ if (props.showCreateOptionWhen === "always") {
433
+ const existingOption = filteredOptions.value.find((option) => ["string", "number"].includes(typeof option) ? option === query.value : option[props.optionAttribute] === query.value);
434
+ if (existingOption) {
435
+ return null;
436
+ }
437
+ }
438
+ return ["string", "number"].includes(typeof props.modelValue) ? query.value : { [props.optionAttribute]: query.value };
407
439
  });
408
440
  function clearOnClose() {
409
441
  if (props.clearSearchOnClose) {
@@ -420,14 +452,13 @@ export default defineComponent({
420
452
  }
421
453
  });
422
454
  function onUpdate(event) {
423
- if (query.value && searchInput.value?.$el) {
424
- query.value = "";
425
- searchInput.value.$el.value = "";
426
- }
427
455
  emit("update:modelValue", event);
428
456
  emit("change", event);
429
457
  emitFormChange();
430
458
  }
459
+ function onChange(event) {
460
+ query.value = event.target.value;
461
+ }
431
462
  return {
432
463
  // eslint-disable-next-line vue/no-dupe-keys
433
464
  ui,
@@ -452,9 +483,11 @@ export default defineComponent({
452
483
  trailingIconClass,
453
484
  trailingWrapperIconClass,
454
485
  filteredOptions,
455
- queryOption,
486
+ createOption,
487
+ // eslint-disable-next-line vue/no-dupe-keys
456
488
  query,
457
- onUpdate
489
+ onUpdate,
490
+ onChange
458
491
  };
459
492
  }
460
493
  });
@@ -5,6 +5,10 @@ declare const _default: import("vue").DefineComponent<{
5
5
  type: (ObjectConstructor | NumberConstructor | ArrayConstructor | StringConstructor)[];
6
6
  default: string;
7
7
  };
8
+ query: {
9
+ type: StringConstructor;
10
+ default: null;
11
+ };
8
12
  by: {
9
13
  type: StringConstructor;
10
14
  default: undefined;
@@ -88,6 +92,10 @@ declare const _default: import("vue").DefineComponent<{
88
92
  type: BooleanConstructor;
89
93
  default: boolean;
90
94
  };
95
+ showCreateOptionWhen: {
96
+ type: PropType<"empty" | "always">;
97
+ default: () => any;
98
+ };
91
99
  placeholder: {
92
100
  type: StringConstructor;
93
101
  default: null;
@@ -133,15 +141,15 @@ declare const _default: import("vue").DefineComponent<{
133
141
  };
134
142
  class: {
135
143
  type: PropType<any>;
136
- default: undefined;
144
+ default: () => "";
137
145
  };
138
146
  ui: {
139
- type: PropType<Partial<any>>;
140
- default: undefined;
147
+ type: PropType<any>;
148
+ default: () => {};
141
149
  };
142
150
  uiMenu: {
143
- type: PropType<Partial<any>>;
144
- default: undefined;
151
+ type: PropType<any>;
152
+ default: () => {};
145
153
  };
146
154
  }, {
147
155
  ui: import("vue").ComputedRef<any>;
@@ -150,7 +158,7 @@ declare const _default: import("vue").DefineComponent<{
150
158
  [x: string]: unknown;
151
159
  }, string>>;
152
160
  name: import("vue").ComputedRef<string | undefined>;
153
- inputId: import("vue").Ref<string | null | undefined>;
161
+ inputId: import("vue").Ref<string | undefined>;
154
162
  popper: import("vue").ComputedRef<PopperOptions>;
155
163
  trigger: import("vue").Ref<import("@vueuse/core").MaybeElement>;
156
164
  container: import("vue").Ref<import("@vueuse/core").MaybeElement>;
@@ -164,16 +172,21 @@ declare const _default: import("vue").DefineComponent<{
164
172
  trailingIconClass: import("vue").ComputedRef<string>;
165
173
  trailingWrapperIconClass: import("vue").ComputedRef<string>;
166
174
  filteredOptions: import("vue").Ref<any[]>;
167
- queryOption: import("vue").ComputedRef<{
175
+ createOption: import("vue").ComputedRef<string | {
168
176
  [x: string]: string;
169
177
  } | null>;
170
- query: import("vue").Ref<string>;
178
+ query: import("vue").WritableComputedRef<string>;
171
179
  onUpdate: (event: any) => void;
172
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close" | "update:modelValue" | "open")[], "change" | "close" | "update:modelValue" | "open", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
180
+ onChange: (event: any) => void;
181
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close" | "update:modelValue" | "open" | "update:query")[], "change" | "close" | "update:modelValue" | "open" | "update:query", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
173
182
  modelValue: {
174
183
  type: (ObjectConstructor | NumberConstructor | ArrayConstructor | StringConstructor)[];
175
184
  default: string;
176
185
  };
186
+ query: {
187
+ type: StringConstructor;
188
+ default: null;
189
+ };
177
190
  by: {
178
191
  type: StringConstructor;
179
192
  default: undefined;
@@ -257,6 +270,10 @@ declare const _default: import("vue").DefineComponent<{
257
270
  type: BooleanConstructor;
258
271
  default: boolean;
259
272
  };
273
+ showCreateOptionWhen: {
274
+ type: PropType<"empty" | "always">;
275
+ default: () => any;
276
+ };
260
277
  placeholder: {
261
278
  type: StringConstructor;
262
279
  default: null;
@@ -302,24 +319,25 @@ declare const _default: import("vue").DefineComponent<{
302
319
  };
303
320
  class: {
304
321
  type: PropType<any>;
305
- default: undefined;
322
+ default: () => "";
306
323
  };
307
324
  ui: {
308
- type: PropType<Partial<any>>;
309
- default: undefined;
325
+ type: PropType<any>;
326
+ default: () => {};
310
327
  };
311
328
  uiMenu: {
312
- type: PropType<Partial<any>>;
313
- default: undefined;
329
+ type: PropType<any>;
330
+ default: () => {};
314
331
  };
315
332
  }>> & {
316
333
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
317
334
  onChange?: ((...args: any[]) => any) | undefined;
318
335
  onClose?: ((...args: any[]) => any) | undefined;
319
336
  onOpen?: ((...args: any[]) => any) | undefined;
337
+ "onUpdate:query"?: ((...args: any[]) => any) | undefined;
320
338
  }, {
321
339
  size: SelectSize;
322
- ui: Partial<any>;
340
+ ui: any;
323
341
  id: string;
324
342
  icon: string;
325
343
  color: any;
@@ -329,6 +347,7 @@ declare const _default: import("vue").DefineComponent<{
329
347
  }[];
330
348
  popper: PopperOptions;
331
349
  name: string;
350
+ leading: boolean;
332
351
  class: any;
333
352
  modelValue: string | number | unknown[] | Record<string, any>;
334
353
  by: string;
@@ -343,17 +362,18 @@ declare const _default: import("vue").DefineComponent<{
343
362
  leadingIcon: string;
344
363
  trailingIcon: string;
345
364
  trailing: boolean;
346
- leading: boolean;
365
+ query: string;
366
+ selectedIcon: string;
347
367
  optionAttribute: string;
348
368
  valueAttribute: string;
369
+ searchAttributes: unknown[];
370
+ debounce: number;
371
+ uiMenu: any;
349
372
  selectClass: string;
350
- selectedIcon: string;
351
373
  searchable: boolean | ((query: string) => Promise<any[]> | any[]);
352
374
  searchablePlaceholder: string;
353
375
  clearSearchOnClose: boolean;
354
- debounce: number;
355
376
  creatable: boolean;
356
- searchAttributes: unknown[];
357
- uiMenu: Partial<any>;
377
+ showCreateOptionWhen: "empty" | "always";
358
378
  }, {}>;
359
379
  export default _default;
@@ -9,7 +9,6 @@
9
9
  :required="required"
10
10
  :disabled="disabled"
11
11
  :placeholder="placeholder"
12
- class="form-textarea"
13
12
  :class="textareaClass"
14
13
  v-bind="attrs"
15
14
  @input="onInput"
@@ -112,11 +111,11 @@ export default defineComponent({
112
111
  },
113
112
  class: {
114
113
  type: [String, Object, Array],
115
- default: void 0
114
+ default: () => ""
116
115
  },
117
116
  ui: {
118
117
  type: Object,
119
- default: void 0
118
+ default: () => ({})
120
119
  },
121
120
  modelModifiers: {
122
121
  type: Object,
@@ -199,6 +198,7 @@ export default defineComponent({
199
198
  const variant = ui.value.color?.[color.value]?.[props.variant] || ui.value.variant[props.variant];
200
199
  return twMerge(twJoin(
201
200
  ui.value.base,
201
+ ui.value.form,
202
202
  ui.value.rounded,
203
203
  ui.value.placeholder,
204
204
  ui.value.size[size.value],
@@ -70,11 +70,11 @@ declare const _default: import("vue").DefineComponent<{
70
70
  };
71
71
  class: {
72
72
  type: PropType<any>;
73
- default: undefined;
73
+ default: () => "";
74
74
  };
75
75
  ui: {
76
- type: PropType<Partial<any>>;
77
- default: undefined;
76
+ type: PropType<any>;
77
+ default: () => {};
78
78
  };
79
79
  modelModifiers: {
80
80
  type: PropType<{
@@ -90,11 +90,11 @@ declare const _default: import("vue").DefineComponent<{
90
90
  [x: string]: unknown;
91
91
  }, string>>;
92
92
  name: import("vue").ComputedRef<string | undefined>;
93
- inputId: import("vue").Ref<string | null | undefined>;
93
+ inputId: import("vue").Ref<string | undefined>;
94
94
  textarea: import("vue").Ref<HTMLTextAreaElement | null>;
95
95
  textareaClass: import("vue").ComputedRef<string>;
96
- onInput: (event: InputEvent) => void;
97
- onChange: (event: InputEvent) => void;
96
+ onInput: (event: Event) => void;
97
+ onChange: (event: Event) => void;
98
98
  onBlur: (event: FocusEvent) => void;
99
99
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("blur" | "update:modelValue")[], "blur" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
100
100
  modelValue: {
@@ -166,11 +166,11 @@ declare const _default: import("vue").DefineComponent<{
166
166
  };
167
167
  class: {
168
168
  type: PropType<any>;
169
- default: undefined;
169
+ default: () => "";
170
170
  };
171
171
  ui: {
172
- type: PropType<Partial<any>>;
173
- default: undefined;
172
+ type: PropType<any>;
173
+ default: () => {};
174
174
  };
175
175
  modelModifiers: {
176
176
  type: PropType<{
@@ -186,7 +186,7 @@ declare const _default: import("vue").DefineComponent<{
186
186
  }, {
187
187
  resize: boolean;
188
188
  size: TextareaSize;
189
- ui: Partial<any>;
189
+ ui: any;
190
190
  id: string;
191
191
  color: any;
192
192
  name: string;
@@ -67,10 +67,6 @@ export default defineComponent({
67
67
  return appConfig.ui.colors.includes(value);
68
68
  }
69
69
  },
70
- class: {
71
- type: [String, Object, Array],
72
- default: void 0
73
- },
74
70
  size: {
75
71
  type: String,
76
72
  default: config.default.size,
@@ -78,12 +74,16 @@ export default defineComponent({
78
74
  return Object.keys(config.size).includes(value);
79
75
  }
80
76
  },
77
+ class: {
78
+ type: [String, Object, Array],
79
+ default: () => ""
80
+ },
81
81
  ui: {
82
82
  type: Object,
83
- default: void 0
83
+ default: () => ({})
84
84
  }
85
85
  },
86
- emits: ["update:modelValue"],
86
+ emits: ["update:modelValue", "change"],
87
87
  setup(props, { emit }) {
88
88
  const { ui, attrs } = useUI("toggle", toRef(props, "ui"), config);
89
89
  const { emitFormChange, color, inputId, name } = useFormGroup(props);
@@ -101,8 +101,8 @@ export default defineComponent({
101
101
  ui.value.base,
102
102
  ui.value.size[props.size],
103
103
  ui.value.rounded,
104
- ui.value.ring.replaceAll("{color}", color.value),
105
- (active.value ? ui.value.active : ui.value.inactive).replaceAll("{color}", color.value)
104
+ color.value && ui.value.ring.replaceAll("{color}", color.value),
105
+ color.value && (active.value ? ui.value.active : ui.value.inactive).replaceAll("{color}", color.value)
106
106
  ), props.class);
107
107
  });
108
108
  const containerClass = computed(() => {
@@ -115,13 +115,13 @@ export default defineComponent({
115
115
  const onIconClass = computed(() => {
116
116
  return twJoin(
117
117
  ui.value.icon.size[props.size],
118
- ui.value.icon.on.replaceAll("{color}", color.value)
118
+ color.value && ui.value.icon.on.replaceAll("{color}", color.value)
119
119
  );
120
120
  });
121
121
  const offIconClass = computed(() => {
122
122
  return twJoin(
123
123
  ui.value.icon.size[props.size],
124
- ui.value.icon.off.replaceAll("{color}", color.value)
124
+ color.value && ui.value.icon.off.replaceAll("{color}", color.value)
125
125
  );
126
126
  });
127
127
  return {