@nuxt/ui 2.8.0 → 2.9.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 (104) hide show
  1. package/README.md +1 -0
  2. package/dist/module.d.mts +1147 -1096
  3. package/dist/module.d.ts +1147 -1096
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +35 -10
  6. package/dist/runtime/components/data/Table.vue +42 -29
  7. package/dist/runtime/components/data/Table.vue.d.ts +20 -13
  8. package/dist/runtime/components/elements/Accordion.vue +25 -22
  9. package/dist/runtime/components/elements/Accordion.vue.d.ts +21 -17
  10. package/dist/runtime/components/elements/Alert.vue +22 -18
  11. package/dist/runtime/components/elements/Alert.vue.d.ts +26 -19
  12. package/dist/runtime/components/elements/Avatar.vue +22 -16
  13. package/dist/runtime/components/elements/Avatar.vue.d.ts +28 -19
  14. package/dist/runtime/components/elements/AvatarGroup.d.ts +17 -8
  15. package/dist/runtime/components/elements/AvatarGroup.mjs +18 -13
  16. package/dist/runtime/components/elements/Badge.vue +21 -17
  17. package/dist/runtime/components/elements/Badge.vue.d.ts +28 -19
  18. package/dist/runtime/components/elements/Button.vue +22 -18
  19. package/dist/runtime/components/elements/Button.vue.d.ts +26 -17
  20. package/dist/runtime/components/elements/ButtonGroup.d.ts +17 -8
  21. package/dist/runtime/components/elements/ButtonGroup.mjs +22 -15
  22. package/dist/runtime/components/elements/Dropdown.vue +15 -13
  23. package/dist/runtime/components/elements/Dropdown.vue.d.ts +20 -17
  24. package/dist/runtime/components/elements/Kbd.vue +16 -12
  25. package/dist/runtime/components/elements/Kbd.vue.d.ts +20 -12
  26. package/dist/runtime/components/elements/Link.vue +18 -5
  27. package/dist/runtime/components/forms/Checkbox.vue +27 -17
  28. package/dist/runtime/components/forms/Checkbox.vue.d.ts +33 -15
  29. package/dist/runtime/components/forms/Form.vue +4 -5
  30. package/dist/runtime/components/forms/Form.vue.d.ts +1 -1
  31. package/dist/runtime/components/forms/FormGroup.vue +51 -27
  32. package/dist/runtime/components/forms/FormGroup.vue.d.ts +23 -15
  33. package/dist/runtime/components/forms/Input.vue +36 -28
  34. package/dist/runtime/components/forms/Input.vue.d.ts +41 -23
  35. package/dist/runtime/components/forms/Radio.vue +27 -17
  36. package/dist/runtime/components/forms/Radio.vue.d.ts +35 -17
  37. package/dist/runtime/components/forms/Range.vue +26 -16
  38. package/dist/runtime/components/forms/Range.vue.d.ts +36 -17
  39. package/dist/runtime/components/forms/Select.vue +34 -26
  40. package/dist/runtime/components/forms/Select.vue.d.ts +42 -24
  41. package/dist/runtime/components/forms/SelectMenu.vue +43 -33
  42. package/dist/runtime/components/forms/SelectMenu.vue.d.ts +49 -30
  43. package/dist/runtime/components/forms/Textarea.vue +38 -30
  44. package/dist/runtime/components/forms/Textarea.vue.d.ts +41 -23
  45. package/dist/runtime/components/forms/Toggle.vue +26 -15
  46. package/dist/runtime/components/forms/Toggle.vue.d.ts +31 -12
  47. package/dist/runtime/components/layout/Card.vue +15 -10
  48. package/dist/runtime/components/layout/Card.vue.d.ts +17 -9
  49. package/dist/runtime/components/layout/Container.vue +15 -10
  50. package/dist/runtime/components/layout/Container.vue.d.ts +17 -9
  51. package/dist/runtime/components/layout/Skeleton.vue +15 -10
  52. package/dist/runtime/components/layout/Skeleton.vue.d.ts +17 -9
  53. package/dist/runtime/components/navigation/CommandPalette.vue +50 -38
  54. package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +23 -22
  55. package/dist/runtime/components/navigation/CommandPaletteGroup.vue +1 -1
  56. package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +3 -4
  57. package/dist/runtime/components/navigation/Pagination.vue +65 -56
  58. package/dist/runtime/components/navigation/Pagination.vue.d.ts +29 -22
  59. package/dist/runtime/components/navigation/Tabs.vue +16 -13
  60. package/dist/runtime/components/navigation/Tabs.vue.d.ts +18 -11
  61. package/dist/runtime/components/navigation/VerticalNavigation.vue +15 -13
  62. package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +20 -16
  63. package/dist/runtime/components/overlays/ContextMenu.vue +14 -9
  64. package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +18 -10
  65. package/dist/runtime/components/overlays/Modal.vue +15 -13
  66. package/dist/runtime/components/overlays/Modal.vue.d.ts +17 -10
  67. package/dist/runtime/components/overlays/Notification.vue +18 -14
  68. package/dist/runtime/components/overlays/Notification.vue.d.ts +25 -19
  69. package/dist/runtime/components/overlays/Notifications.vue +18 -12
  70. package/dist/runtime/components/overlays/Notifications.vue.d.ts +22 -14
  71. package/dist/runtime/components/overlays/Popover.vue +18 -16
  72. package/dist/runtime/components/overlays/Popover.vue.d.ts +18 -11
  73. package/dist/runtime/components/overlays/Slideover.vue +15 -13
  74. package/dist/runtime/components/overlays/Slideover.vue.d.ts +17 -10
  75. package/dist/runtime/components/overlays/Tooltip.vue +15 -13
  76. package/dist/runtime/components/overlays/Tooltip.vue.d.ts +18 -11
  77. package/dist/runtime/composables/useFormGroup.d.ts +12 -2
  78. package/dist/runtime/composables/useFormGroup.mjs +10 -4
  79. package/dist/runtime/composables/usePopper.mjs +40 -30
  80. package/dist/runtime/composables/useToast.d.ts +3 -3
  81. package/dist/runtime/composables/useUI.d.ts +10 -0
  82. package/dist/runtime/composables/useUI.mjs +24 -0
  83. package/dist/runtime/types/avatar.d.ts +10 -4
  84. package/dist/runtime/types/badge.d.ts +14 -0
  85. package/dist/runtime/types/button.d.ts +10 -3
  86. package/dist/runtime/types/command-palette.d.ts +2 -1
  87. package/dist/runtime/types/form.d.ts +8 -1
  88. package/dist/runtime/types/index.d.ts +2 -0
  89. package/dist/runtime/types/link.d.ts +1 -0
  90. package/dist/runtime/types/notification.d.ts +5 -3
  91. package/dist/runtime/types/tabs.d.ts +1 -0
  92. package/dist/runtime/types/utils.d.ts +11 -0
  93. package/dist/runtime/ui.config.d.ts +1207 -0
  94. package/dist/runtime/{app.config.mjs → ui.config.mjs} +52 -80
  95. package/dist/runtime/utils/index.d.ts +5 -11
  96. package/dist/runtime/utils/index.mjs +21 -9
  97. package/dist/runtime/utils/lodash.d.ts +2 -0
  98. package/dist/runtime/utils/lodash.mjs +23 -0
  99. package/dist/runtime/utils/uid.d.ts +1 -0
  100. package/dist/runtime/utils/uid.mjs +4 -0
  101. package/dist/types.d.mts +1 -1
  102. package/dist/types.d.ts +1 -1
  103. package/package.json +19 -21
  104. package/dist/runtime/app.config.d.ts +0 -1203
@@ -1,6 +1,7 @@
1
1
  <template>
2
- <div :class="wrapperClass">
2
+ <div :class="ui.wrapper">
3
3
  <select
4
+ :id="inputId"
4
5
  :name="name"
5
6
  :value="modelValue"
6
7
  :required="required"
@@ -53,14 +54,15 @@
53
54
  </template>
54
55
 
55
56
  <script>
56
- import { computed, defineComponent } from "vue";
57
- import { get, omit } from "lodash-es";
57
+ import { computed, toRef, defineComponent } from "vue";
58
58
  import { twMerge, twJoin } from "tailwind-merge";
59
59
  import UIcon from "../elements/Icon.vue";
60
- import { defuTwMerge } from "../../utils";
60
+ import { useUI } from "../../composables/useUI";
61
61
  import { useFormGroup } from "../../composables/useFormGroup";
62
- import { useAppConfig } from "#imports";
62
+ import { mergeConfig, get } from "../../utils";
63
63
  import appConfig from "#build/app.config";
64
+ import { select } from "#ui/ui.config";
65
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.select, select);
64
66
  export default defineComponent({
65
67
  components: {
66
68
  UIcon
@@ -71,6 +73,10 @@ export default defineComponent({
71
73
  type: [String, Number, Object],
72
74
  default: ""
73
75
  },
76
+ id: {
77
+ type: String,
78
+ default: null
79
+ },
74
80
  name: {
75
81
  type: String,
76
82
  default: null
@@ -93,7 +99,7 @@ export default defineComponent({
93
99
  },
94
100
  loadingIcon: {
95
101
  type: String,
96
- default: () => appConfig.ui.input.default.loadingIcon
102
+ default: () => config.default.loadingIcon
97
103
  },
98
104
  leadingIcon: {
99
105
  type: String,
@@ -101,7 +107,7 @@ export default defineComponent({
101
107
  },
102
108
  trailingIcon: {
103
109
  type: String,
104
- default: () => appConfig.ui.select.default.trailingIcon
110
+ default: () => config.default.trailingIcon
105
111
  },
106
112
  trailing: {
107
113
  type: Boolean,
@@ -125,25 +131,25 @@ export default defineComponent({
125
131
  },
126
132
  size: {
127
133
  type: String,
128
- default: () => appConfig.ui.select.default.size,
134
+ default: null,
129
135
  validator(value) {
130
- return Object.keys(appConfig.ui.select.size).includes(value);
136
+ return Object.keys(config.size).includes(value);
131
137
  }
132
138
  },
133
139
  color: {
134
140
  type: String,
135
- default: () => appConfig.ui.select.default.color,
141
+ default: () => config.default.color,
136
142
  validator(value) {
137
- return [...appConfig.ui.colors, ...Object.keys(appConfig.ui.select.color)].includes(value);
143
+ return [...appConfig.ui.colors, ...Object.keys(config.color)].includes(value);
138
144
  }
139
145
  },
140
146
  variant: {
141
147
  type: String,
142
- default: () => appConfig.ui.select.default.variant,
148
+ default: () => config.default.variant,
143
149
  validator(value) {
144
150
  return [
145
- ...Object.keys(appConfig.ui.select.variant),
146
- ...Object.values(appConfig.ui.select.color).flatMap((value2) => Object.keys(value2))
151
+ ...Object.keys(config.variant),
152
+ ...Object.values(config.color).flatMap((value2) => Object.keys(value2))
147
153
  ].includes(value);
148
154
  }
149
155
  },
@@ -159,18 +165,19 @@ export default defineComponent({
159
165
  type: String,
160
166
  default: null
161
167
  },
168
+ class: {
169
+ type: [String, Object, Array],
170
+ default: void 0
171
+ },
162
172
  ui: {
163
173
  type: Object,
164
- default: () => ({})
174
+ default: void 0
165
175
  }
166
176
  },
167
177
  emits: ["update:modelValue", "change"],
168
- setup(props, { emit, attrs, slots }) {
169
- const appConfig2 = useAppConfig();
170
- const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.select));
171
- const { emitFormChange, formGroup } = useFormGroup();
172
- const color = computed(() => formGroup?.error?.value ? "red" : props.color);
173
- const size = computed(() => formGroup?.size?.value ?? props.size);
178
+ setup(props, { emit, slots }) {
179
+ const { ui, attrs } = useUI("select", toRef(props, "ui"), config, toRef(props, "class"));
180
+ const { emitFormChange, inputId, color, size, name } = useFormGroup(props, config);
174
181
  const onInput = (event) => {
175
182
  emit("update:modelValue", event.target.value);
176
183
  };
@@ -221,7 +228,6 @@ export default defineComponent({
221
228
  }
222
229
  return foundOption[props.valueAttribute];
223
230
  });
224
- const wrapperClass = computed(() => twMerge(ui.value.wrapper, attrs.class));
225
231
  const selectClass = computed(() => {
226
232
  const variant = ui.value.color?.[color.value]?.[props.variant] || ui.value.variant[props.variant];
227
233
  return twMerge(twJoin(
@@ -262,7 +268,7 @@ export default defineComponent({
262
268
  const leadingIconClass = computed(() => {
263
269
  return twJoin(
264
270
  ui.value.icon.base,
265
- appConfig2.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
271
+ appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
266
272
  ui.value.icon.size[size.value],
267
273
  props.loading && "animate-spin"
268
274
  );
@@ -277,20 +283,22 @@ export default defineComponent({
277
283
  const trailingIconClass = computed(() => {
278
284
  return twJoin(
279
285
  ui.value.icon.base,
280
- appConfig2.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
286
+ appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
281
287
  ui.value.icon.size[size.value],
282
288
  props.loading && !isLeading.value && "animate-spin"
283
289
  );
284
290
  });
285
291
  return {
286
- attrs: omit(attrs, ["class"]),
287
292
  // eslint-disable-next-line vue/no-dupe-keys
288
293
  ui,
294
+ attrs,
295
+ // eslint-disable-next-line vue/no-dupe-keys
296
+ name,
297
+ inputId,
289
298
  normalizedOptionsWithPlaceholder,
290
299
  normalizedValue,
291
300
  isLeading,
292
301
  isTrailing,
293
- wrapperClass,
294
302
  // eslint-disable-next-line vue/no-dupe-keys
295
303
  selectClass,
296
304
  leadingIconName,
@@ -1,10 +1,13 @@
1
- /// <reference types="lodash" />
2
1
  import type { PropType, ComputedRef } from 'vue';
3
2
  declare const _default: import("vue").DefineComponent<{
4
3
  modelValue: {
5
- type: (ObjectConstructor | StringConstructor | NumberConstructor)[];
4
+ type: (ObjectConstructor | NumberConstructor | StringConstructor)[];
6
5
  default: string;
7
6
  };
7
+ id: {
8
+ type: StringConstructor;
9
+ default: null;
10
+ };
8
11
  name: {
9
12
  type: StringConstructor;
10
13
  default: null;
@@ -58,17 +61,17 @@ declare const _default: import("vue").DefineComponent<{
58
61
  default: () => never[];
59
62
  };
60
63
  size: {
61
- type: StringConstructor;
62
- default: () => any;
64
+ type: PropType<string | number | symbol>;
65
+ default: null;
63
66
  validator(value: string): boolean;
64
67
  };
65
68
  color: {
66
- type: StringConstructor;
69
+ type: PropType<any>;
67
70
  default: () => any;
68
71
  validator(value: string): boolean;
69
72
  };
70
73
  variant: {
71
- type: StringConstructor;
74
+ type: PropType<any>;
72
75
  default: () => any;
73
76
  validator(value: string): boolean;
74
77
  };
@@ -84,15 +87,21 @@ declare const _default: import("vue").DefineComponent<{
84
87
  type: StringConstructor;
85
88
  default: null;
86
89
  };
87
- ui: {
90
+ class: {
88
91
  type: PropType<any>;
89
- default: () => {};
92
+ default: undefined;
93
+ };
94
+ ui: {
95
+ type: PropType<Partial<any>>;
96
+ default: undefined;
90
97
  };
91
98
  }, {
92
- attrs: import("lodash").Omit<{
93
- [x: string]: unknown;
94
- }, "class">;
95
99
  ui: ComputedRef<any>;
100
+ attrs: ComputedRef<Pick<{
101
+ [x: string]: unknown;
102
+ }, string>>;
103
+ name: ComputedRef<any>;
104
+ inputId: ComputedRef<any>;
96
105
  normalizedOptionsWithPlaceholder: ComputedRef<{
97
106
  disabled?: boolean | undefined;
98
107
  children: {
@@ -102,7 +111,6 @@ declare const _default: import("vue").DefineComponent<{
102
111
  normalizedValue: ComputedRef<any>;
103
112
  isLeading: ComputedRef<string | true>;
104
113
  isTrailing: ComputedRef<string | true | undefined>;
105
- wrapperClass: ComputedRef<string>;
106
114
  selectClass: ComputedRef<string>;
107
115
  leadingIconName: ComputedRef<string | undefined>;
108
116
  leadingIconClass: ComputedRef<string>;
@@ -114,9 +122,13 @@ declare const _default: import("vue").DefineComponent<{
114
122
  onChange: (event: Event) => void;
115
123
  }, 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<{
116
124
  modelValue: {
117
- type: (ObjectConstructor | StringConstructor | NumberConstructor)[];
125
+ type: (ObjectConstructor | NumberConstructor | StringConstructor)[];
118
126
  default: string;
119
127
  };
128
+ id: {
129
+ type: StringConstructor;
130
+ default: null;
131
+ };
120
132
  name: {
121
133
  type: StringConstructor;
122
134
  default: null;
@@ -170,17 +182,17 @@ declare const _default: import("vue").DefineComponent<{
170
182
  default: () => never[];
171
183
  };
172
184
  size: {
173
- type: StringConstructor;
174
- default: () => any;
185
+ type: PropType<string | number | symbol>;
186
+ default: null;
175
187
  validator(value: string): boolean;
176
188
  };
177
189
  color: {
178
- type: StringConstructor;
190
+ type: PropType<any>;
179
191
  default: () => any;
180
192
  validator(value: string): boolean;
181
193
  };
182
194
  variant: {
183
- type: StringConstructor;
195
+ type: PropType<any>;
184
196
  default: () => any;
185
197
  validator(value: string): boolean;
186
198
  };
@@ -196,25 +208,31 @@ declare const _default: import("vue").DefineComponent<{
196
208
  type: StringConstructor;
197
209
  default: null;
198
210
  };
199
- ui: {
211
+ class: {
200
212
  type: PropType<any>;
201
- default: () => {};
213
+ default: undefined;
214
+ };
215
+ ui: {
216
+ type: PropType<Partial<any>>;
217
+ default: undefined;
202
218
  };
203
219
  }>> & {
204
220
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
205
221
  onChange?: ((...args: any[]) => any) | undefined;
206
222
  }, {
223
+ id: string;
207
224
  icon: string;
208
- color: string;
209
- ui: any;
210
- name: string;
225
+ color: any;
226
+ ui: Partial<any>;
211
227
  options: unknown[];
228
+ name: string;
229
+ class: any;
212
230
  modelValue: string | number | Record<string, any>;
213
231
  loading: boolean;
214
232
  disabled: boolean;
215
- variant: string;
233
+ variant: any;
216
234
  required: boolean;
217
- size: string;
235
+ size: string | number | symbol;
218
236
  placeholder: string;
219
237
  padded: boolean;
220
238
  loadingIcon: string;
@@ -8,7 +8,7 @@
8
8
  :multiple="multiple"
9
9
  :disabled="disabled || loading"
10
10
  as="div"
11
- :class="wrapperClass"
11
+ :class="ui.wrapper"
12
12
  @update:model-value="onUpdate"
13
13
  >
14
14
  <input
@@ -28,7 +28,7 @@
28
28
  class="inline-flex w-full"
29
29
  >
30
30
  <slot :open="open" :disabled="disabled" :loading="loading">
31
- <button :class="selectClass" :disabled="disabled || loading" type="button" v-bind="attrs">
31
+ <button :id="inputId" :class="selectClass" :disabled="disabled || loading" 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" />
@@ -37,7 +37,7 @@
37
37
 
38
38
  <slot name="label">
39
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">{{ typeof modelValue === 'string' ? modelValue : modelValue[optionAttribute] }}</span>
40
+ <span v-else-if="!multiple && modelValue" class="block truncate">{{ ['string', 'number'].includes(typeof modelValue) ? modelValue : modelValue[optionAttribute] }}</span>
41
41
  <span v-else class="block truncate" :class="uiMenu.placeholder">{{ placeholder || '&nbsp;' }}</span>
42
42
  </slot>
43
43
 
@@ -85,7 +85,7 @@
85
85
  />
86
86
  <span v-else-if="option.chip" :class="uiMenu.option.chip.base" :style="{ background: `#${option.chip}` }" />
87
87
 
88
- <span class="truncate">{{ typeof option === 'string' ? option : option[optionAttribute] }}</span>
88
+ <span class="truncate">{{ ['string', 'number'].includes(typeof option) ? option : option[optionAttribute] }}</span>
89
89
  </slot>
90
90
  </div>
91
91
 
@@ -116,7 +116,7 @@
116
116
  </template>
117
117
 
118
118
  <script>
119
- import { ref, computed, watch, defineComponent } from "vue";
119
+ import { ref, computed, toRef, watch, defineComponent } from "vue";
120
120
  import {
121
121
  Combobox as HCombobox,
122
122
  ComboboxButton as HComboboxButton,
@@ -130,15 +130,17 @@ import {
130
130
  } from "@headlessui/vue";
131
131
  import { computedAsync, useDebounceFn } from "@vueuse/core";
132
132
  import { defu } from "defu";
133
- import { omit } from "lodash-es";
134
133
  import { twMerge, twJoin } from "tailwind-merge";
135
134
  import UIcon from "../elements/Icon.vue";
136
135
  import UAvatar from "../elements/Avatar.vue";
137
- import { defuTwMerge } from "../../utils";
136
+ import { useUI } from "../../composables/useUI";
138
137
  import { usePopper } from "../../composables/usePopper";
139
138
  import { useFormGroup } from "../../composables/useFormGroup";
140
- import { useAppConfig } from "#imports";
139
+ import { mergeConfig } from "../../utils";
141
140
  import appConfig from "#build/app.config";
141
+ import { select, selectMenu } from "#ui/ui.config";
142
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.select, select);
143
+ const configMenu = mergeConfig(appConfig.ui.strategy, appConfig.ui.selectMenu, selectMenu);
142
144
  export default defineComponent({
143
145
  components: {
144
146
  HCombobox,
@@ -167,6 +169,10 @@ export default defineComponent({
167
169
  type: Array,
168
170
  default: () => []
169
171
  },
172
+ id: {
173
+ type: String,
174
+ default: null
175
+ },
170
176
  name: {
171
177
  type: String,
172
178
  default: null
@@ -181,7 +187,7 @@ export default defineComponent({
181
187
  },
182
188
  loadingIcon: {
183
189
  type: String,
184
- default: () => appConfig.ui.input.default.loadingIcon
190
+ default: () => config.default.loadingIcon
185
191
  },
186
192
  leadingIcon: {
187
193
  type: String,
@@ -189,7 +195,7 @@ export default defineComponent({
189
195
  },
190
196
  trailingIcon: {
191
197
  type: String,
192
- default: () => appConfig.ui.select.default.trailingIcon
198
+ default: () => config.default.trailingIcon
193
199
  },
194
200
  trailing: {
195
201
  type: Boolean,
@@ -205,7 +211,7 @@ export default defineComponent({
205
211
  },
206
212
  selectedIcon: {
207
213
  type: String,
208
- default: () => appConfig.ui.selectMenu.default.selectedIcon
214
+ default: () => configMenu.default.selectedIcon
209
215
  },
210
216
  disabled: {
211
217
  type: Boolean,
@@ -241,25 +247,25 @@ export default defineComponent({
241
247
  },
242
248
  size: {
243
249
  type: String,
244
- default: () => appConfig.ui.select.default.size,
250
+ default: null,
245
251
  validator(value) {
246
- return Object.keys(appConfig.ui.select.size).includes(value);
252
+ return Object.keys(config.size).includes(value);
247
253
  }
248
254
  },
249
255
  color: {
250
256
  type: String,
251
- default: () => appConfig.ui.select.default.color,
257
+ default: () => config.default.color,
252
258
  validator(value) {
253
- return [...appConfig.ui.colors, ...Object.keys(appConfig.ui.select.color)].includes(value);
259
+ return [...appConfig.ui.colors, ...Object.keys(config.color)].includes(value);
254
260
  }
255
261
  },
256
262
  variant: {
257
263
  type: String,
258
- default: () => appConfig.ui.select.default.variant,
264
+ default: () => config.default.variant,
259
265
  validator(value) {
260
266
  return [
261
- ...Object.keys(appConfig.ui.select.variant),
262
- ...Object.values(appConfig.ui.select.color).flatMap((value2) => Object.keys(value2))
267
+ ...Object.keys(config.variant),
268
+ ...Object.values(config.color).flatMap((value2) => Object.keys(value2))
263
269
  ].includes(value);
264
270
  }
265
271
  },
@@ -283,28 +289,28 @@ export default defineComponent({
283
289
  type: String,
284
290
  default: null
285
291
  },
292
+ class: {
293
+ type: [String, Object, Array],
294
+ default: void 0
295
+ },
286
296
  ui: {
287
297
  type: Object,
288
- default: () => ({})
298
+ default: void 0
289
299
  },
290
300
  uiMenu: {
291
301
  type: Object,
292
- default: () => ({})
302
+ default: void 0
293
303
  }
294
304
  },
295
305
  emits: ["update:modelValue", "open", "close", "change"],
296
- setup(props, { emit, attrs, slots }) {
297
- const appConfig2 = useAppConfig();
298
- const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.select));
299
- const uiMenu = computed(() => defuTwMerge({}, props.uiMenu, appConfig2.ui.selectMenu));
306
+ setup(props, { emit, slots }) {
307
+ const { ui, attrs } = useUI("select", toRef(props, "ui"), config, toRef(props, "class"));
308
+ const { ui: uiMenu } = useUI("selectMenu", toRef(props, "uiMenu"), configMenu);
300
309
  const popper = computed(() => defu({}, props.popper, uiMenu.value.popper));
301
310
  const [trigger, container] = usePopper(popper.value);
302
- const { emitFormBlur, emitFormChange, formGroup } = useFormGroup();
303
- const color = computed(() => formGroup?.error?.value ? "red" : props.color);
304
- const size = computed(() => formGroup?.size?.value ?? props.size);
311
+ const { emitFormBlur, emitFormChange, inputId, color, size, name } = useFormGroup(props, config);
305
312
  const query = ref("");
306
313
  const searchInput = ref();
307
- const wrapperClass = computed(() => twMerge(ui.value.wrapper, attrs.class));
308
314
  const selectClass = computed(() => {
309
315
  const variant = ui.value.color?.[color.value]?.[props.variant] || ui.value.variant[props.variant];
310
316
  return twMerge(twJoin(
@@ -348,7 +354,7 @@ export default defineComponent({
348
354
  const leadingIconClass = computed(() => {
349
355
  return twJoin(
350
356
  ui.value.icon.base,
351
- appConfig2.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
357
+ appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
352
358
  ui.value.icon.size[size.value],
353
359
  props.loading && "animate-spin"
354
360
  );
@@ -363,7 +369,7 @@ export default defineComponent({
363
369
  const trailingIconClass = computed(() => {
364
370
  return twJoin(
365
371
  ui.value.icon.base,
366
- appConfig2.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
372
+ appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
367
373
  ui.value.icon.size[size.value],
368
374
  props.loading && !isLeading.value && "animate-spin"
369
375
  );
@@ -378,7 +384,7 @@ export default defineComponent({
378
384
  }
379
385
  return props.options.filter((option) => {
380
386
  return (props.searchAttributes?.length ? props.searchAttributes : [props.optionAttribute]).some((searchAttribute) => {
381
- return typeof option === "string" ? option.search(new RegExp(query.value, "i")) !== -1 : option[searchAttribute] && option[searchAttribute].search(new RegExp(query.value, "i")) !== -1;
387
+ return ["string", "number"].includes(typeof option) ? option.toString().search(new RegExp(query.value, "i")) !== -1 : option[searchAttribute] && option[searchAttribute].search(new RegExp(query.value, "i")) !== -1;
382
388
  });
383
389
  });
384
390
  });
@@ -403,14 +409,18 @@ export default defineComponent({
403
409
  emitFormChange();
404
410
  }
405
411
  return {
406
- attrs: omit(attrs, ["class"]),
412
+ // eslint-disable-next-line vue/no-dupe-keys
413
+ ui,
407
414
  // eslint-disable-next-line vue/no-dupe-keys
408
415
  uiMenu,
416
+ attrs,
417
+ // eslint-disable-next-line vue/no-dupe-keys
418
+ name,
419
+ inputId,
409
420
  trigger,
410
421
  container,
411
422
  isLeading,
412
423
  isTrailing,
413
- wrapperClass,
414
424
  // eslint-disable-next-line vue/no-dupe-keys
415
425
  selectClass,
416
426
  leadingIconName,