@nuxt/ui 2.10.0 → 2.11.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 (208) hide show
  1. package/README.md +11 -0
  2. package/dist/module.d.mts +387 -104
  3. package/dist/module.d.ts +387 -104
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +16 -7
  6. package/dist/runtime/components/data/Table.vue +3 -3
  7. package/dist/runtime/components/data/Table.vue.d.ts +7 -7
  8. package/dist/runtime/components/elements/Accordion.vue +2 -2
  9. package/dist/runtime/components/elements/Accordion.vue.d.ts +7 -7
  10. package/dist/runtime/components/elements/Alert.vue +13 -12
  11. package/dist/runtime/components/elements/Alert.vue.d.ts +12 -11
  12. package/dist/runtime/components/elements/Avatar.vue +2 -2
  13. package/dist/runtime/components/elements/Avatar.vue.d.ts +11 -10
  14. package/dist/runtime/components/elements/AvatarGroup.d.ts +11 -10
  15. package/dist/runtime/components/elements/AvatarGroup.mjs +2 -2
  16. package/dist/runtime/components/elements/Badge.vue +6 -4
  17. package/dist/runtime/components/elements/Badge.vue.d.ts +11 -11
  18. package/dist/runtime/components/elements/Button.vue +16 -12
  19. package/dist/runtime/components/elements/Button.vue.d.ts +13 -12
  20. package/dist/runtime/components/elements/ButtonGroup.d.ts +12 -11
  21. package/dist/runtime/components/elements/ButtonGroup.mjs +8 -34
  22. package/dist/runtime/components/elements/Chip.vue +85 -0
  23. package/dist/runtime/components/elements/Chip.vue.d.ts +90 -0
  24. package/dist/runtime/components/elements/Dropdown.vue +35 -21
  25. package/dist/runtime/components/elements/Dropdown.vue.d.ts +13 -7
  26. package/dist/runtime/components/elements/Icon.vue +16 -2
  27. package/dist/runtime/components/elements/Icon.vue.d.ts +14 -2
  28. package/dist/runtime/components/elements/Kbd.vue +2 -2
  29. package/dist/runtime/components/elements/Kbd.vue.d.ts +12 -11
  30. package/dist/runtime/components/elements/Link.vue +2 -5
  31. package/dist/runtime/components/elements/Meter.vue +2 -2
  32. package/dist/runtime/components/elements/Meter.vue.d.ts +9 -9
  33. package/dist/runtime/components/elements/MeterGroup.d.ts +10 -10
  34. package/dist/runtime/components/elements/MeterGroup.mjs +8 -21
  35. package/dist/runtime/components/elements/Progress.vue +6 -95
  36. package/dist/runtime/components/elements/Progress.vue.d.ts +123 -1
  37. package/dist/runtime/components/forms/Checkbox.vue +8 -10
  38. package/dist/runtime/components/forms/Checkbox.vue.d.ts +10 -10
  39. package/dist/runtime/components/forms/Form.vue +1 -1
  40. package/dist/runtime/components/forms/FormGroup.vue +9 -5
  41. package/dist/runtime/components/forms/FormGroup.vue.d.ts +21 -11
  42. package/dist/runtime/components/forms/Input.vue +43 -12
  43. package/dist/runtime/components/forms/Input.vue.d.ts +38 -15
  44. package/dist/runtime/components/forms/Radio.vue +18 -12
  45. package/dist/runtime/components/forms/Radio.vue.d.ts +11 -10
  46. package/dist/runtime/components/forms/RadioGroup.vue +3 -3
  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 +11 -10
  50. package/dist/runtime/components/forms/Select.vue +12 -9
  51. package/dist/runtime/components/forms/Select.vue.d.ts +15 -14
  52. package/dist/runtime/components/forms/SelectMenu.vue +42 -25
  53. package/dist/runtime/components/forms/SelectMenu.vue.d.ts +28 -19
  54. package/dist/runtime/components/forms/Textarea.vue +36 -6
  55. package/dist/runtime/components/forms/Textarea.vue.d.ts +37 -14
  56. package/dist/runtime/components/forms/Toggle.vue +25 -7
  57. package/dist/runtime/components/forms/Toggle.vue.d.ts +20 -7
  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 +9 -9
  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 +78 -0
  67. package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +50 -0
  68. package/dist/runtime/components/navigation/CommandPalette.vue +50 -37
  69. package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +15 -8
  70. package/dist/runtime/components/navigation/CommandPaletteGroup.vue +1 -3
  71. package/dist/runtime/components/navigation/Pagination.vue +7 -7
  72. package/dist/runtime/components/navigation/Pagination.vue.d.ts +11 -11
  73. package/dist/runtime/components/navigation/Tabs.vue +8 -5
  74. package/dist/runtime/components/navigation/Tabs.vue.d.ts +10 -10
  75. package/dist/runtime/components/navigation/VerticalNavigation.vue +2 -2
  76. package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +7 -7
  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 +7 -7
  81. package/dist/runtime/components/overlays/Notification.vue +30 -31
  82. package/dist/runtime/components/overlays/Notification.vue.d.ts +10 -9
  83. package/dist/runtime/components/overlays/Notifications.vue +18 -16
  84. package/dist/runtime/components/overlays/Notifications.vue.d.ts +7 -7
  85. package/dist/runtime/components/overlays/Popover.vue +14 -4
  86. package/dist/runtime/components/overlays/Popover.vue.d.ts +20 -9
  87. package/dist/runtime/components/overlays/Slideover.vue +6 -6
  88. package/dist/runtime/components/overlays/Slideover.vue.d.ts +7 -7
  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/defineShortcuts.d.ts +1 -1
  92. package/dist/runtime/composables/defineShortcuts.mjs +8 -4
  93. package/dist/runtime/composables/useButtonGroup.d.ts +20 -0
  94. package/dist/runtime/composables/useButtonGroup.mjs +52 -0
  95. package/dist/runtime/composables/useFormGroup.d.ts +2 -0
  96. package/dist/runtime/composables/useFormGroup.mjs +3 -2
  97. package/dist/runtime/composables/useShortcuts.d.ts +2 -2
  98. package/dist/runtime/composables/useUI.d.ts +3 -3
  99. package/dist/runtime/types/alert.d.ts +7 -0
  100. package/dist/runtime/types/avatar.d.ts +3 -1
  101. package/dist/runtime/types/badge.d.ts +5 -4
  102. package/dist/runtime/types/breadcrumb.d.ts +9 -0
  103. package/dist/runtime/types/button.d.ts +5 -4
  104. package/dist/runtime/types/chip.d.ts +11 -0
  105. package/dist/runtime/types/dropdown.d.ts +2 -2
  106. package/dist/runtime/types/form-group.d.ts +5 -0
  107. package/dist/runtime/types/form.d.ts +3 -2
  108. package/dist/runtime/types/index.d.ts +10 -0
  109. package/dist/runtime/types/input.d.ts +8 -0
  110. package/dist/runtime/types/kbd.d.ts +5 -0
  111. package/dist/runtime/types/popper.d.ts +2 -0
  112. package/dist/runtime/types/range.d.ts +5 -0
  113. package/dist/runtime/types/select.d.ts +8 -0
  114. package/dist/runtime/types/textarea.d.ts +8 -0
  115. package/dist/runtime/types/toggle.d.ts +5 -0
  116. package/dist/runtime/types/utils.d.ts +24 -7
  117. package/dist/runtime/ui.config/data/table.d.ts +60 -0
  118. package/dist/runtime/ui.config/data/table.mjs +59 -0
  119. package/dist/runtime/ui.config/elements/accordion.d.ts +21 -0
  120. package/dist/runtime/ui.config/elements/accordion.mjs +20 -0
  121. package/dist/runtime/ui.config/elements/alert.d.ts +41 -0
  122. package/dist/runtime/ui.config/elements/alert.mjs +40 -0
  123. package/dist/runtime/ui.config/elements/avatar.d.ts +60 -0
  124. package/dist/runtime/ui.config/elements/avatar.mjs +59 -0
  125. package/dist/runtime/ui.config/elements/avatarGroup.d.ts +6 -0
  126. package/dist/runtime/ui.config/elements/avatarGroup.mjs +5 -0
  127. package/dist/runtime/ui.config/elements/badge.d.ts +34 -0
  128. package/dist/runtime/ui.config/elements/badge.mjs +33 -0
  129. package/dist/runtime/ui.config/elements/button.d.ts +81 -0
  130. package/dist/runtime/ui.config/elements/button.mjs +80 -0
  131. package/dist/runtime/ui.config/elements/buttonGroup.d.ts +101 -0
  132. package/dist/runtime/ui.config/elements/buttonGroup.mjs +19 -0
  133. package/dist/runtime/ui.config/elements/chip.d.ts +35 -0
  134. package/dist/runtime/ui.config/elements/chip.mjs +34 -0
  135. package/dist/runtime/ui.config/elements/dropdown.d.ts +55 -0
  136. package/dist/runtime/ui.config/elements/dropdown.mjs +53 -0
  137. package/dist/runtime/ui.config/elements/kbd.d.ts +17 -0
  138. package/dist/runtime/ui.config/elements/kbd.mjs +16 -0
  139. package/dist/runtime/ui.config/elements/meter.d.ts +77 -0
  140. package/dist/runtime/ui.config/elements/meter.mjs +76 -0
  141. package/dist/runtime/ui.config/elements/meterGroup.d.ts +52 -0
  142. package/dist/runtime/ui.config/elements/meterGroup.mjs +24 -0
  143. package/dist/runtime/ui.config/elements/progress.d.ts +75 -0
  144. package/dist/runtime/ui.config/elements/progress.mjs +74 -0
  145. package/dist/runtime/ui.config/forms/checkbox.d.ts +19 -0
  146. package/dist/runtime/ui.config/forms/checkbox.mjs +18 -0
  147. package/dist/runtime/ui.config/forms/formGroup.d.ts +25 -0
  148. package/dist/runtime/ui.config/forms/formGroup.mjs +25 -0
  149. package/dist/runtime/ui.config/forms/input.d.ts +107 -0
  150. package/dist/runtime/ui.config/forms/input.mjs +106 -0
  151. package/dist/runtime/ui.config/forms/radio.d.ts +18 -0
  152. package/dist/runtime/ui.config/forms/radio.mjs +17 -0
  153. package/dist/runtime/ui.config/forms/radioGroup.d.ts +8 -0
  154. package/dist/runtime/ui.config/forms/radioGroup.mjs +7 -0
  155. package/dist/runtime/ui.config/forms/range.d.ts +64 -0
  156. package/dist/runtime/ui.config/forms/range.mjs +63 -0
  157. package/dist/runtime/ui.config/forms/select.d.ts +108 -0
  158. package/dist/runtime/ui.config/forms/select.mjs +13 -0
  159. package/dist/runtime/ui.config/forms/selectMenu.d.ts +68 -0
  160. package/dist/runtime/ui.config/forms/selectMenu.mjs +66 -0
  161. package/dist/runtime/ui.config/forms/textarea.d.ts +106 -0
  162. package/dist/runtime/ui.config/forms/textarea.mjs +10 -0
  163. package/dist/runtime/ui.config/forms/toggle.d.ts +61 -0
  164. package/dist/runtime/ui.config/forms/toggle.mjs +60 -0
  165. package/dist/runtime/ui.config/index.d.ts +40 -0
  166. package/dist/runtime/ui.config/index.mjs +40 -0
  167. package/dist/runtime/ui.config/layout/card.d.ts +24 -0
  168. package/dist/runtime/ui.config/layout/card.mjs +23 -0
  169. package/dist/runtime/ui.config/layout/container.d.ts +6 -0
  170. package/dist/runtime/ui.config/layout/container.mjs +5 -0
  171. package/dist/runtime/ui.config/layout/divider.d.ts +35 -0
  172. package/dist/runtime/ui.config/layout/divider.mjs +34 -0
  173. package/dist/runtime/ui.config/layout/skeleton.d.ts +6 -0
  174. package/dist/runtime/ui.config/layout/skeleton.mjs +5 -0
  175. package/dist/runtime/ui.config/navigation/breadcrumb.d.ts +20 -0
  176. package/dist/runtime/ui.config/navigation/breadcrumb.mjs +19 -0
  177. package/dist/runtime/ui.config/navigation/commandPalette.d.ts +72 -0
  178. package/dist/runtime/ui.config/navigation/commandPalette.mjs +71 -0
  179. package/dist/runtime/ui.config/navigation/pagination.d.ts +35 -0
  180. package/dist/runtime/ui.config/navigation/pagination.mjs +34 -0
  181. package/dist/runtime/ui.config/navigation/tabs.d.ts +34 -0
  182. package/dist/runtime/ui.config/navigation/tabs.mjs +33 -0
  183. package/dist/runtime/ui.config/navigation/verticalNavigation.d.ts +28 -0
  184. package/dist/runtime/ui.config/navigation/verticalNavigation.mjs +27 -0
  185. package/dist/runtime/ui.config/overlays/contextMenu.d.ts +31 -0
  186. package/dist/runtime/ui.config/overlays/contextMenu.mjs +25 -0
  187. package/dist/runtime/ui.config/overlays/modal.d.ts +36 -0
  188. package/dist/runtime/ui.config/overlays/modal.mjs +37 -0
  189. package/dist/runtime/ui.config/overlays/notification.d.ts +50 -0
  190. package/dist/runtime/ui.config/overlays/notification.mjs +50 -0
  191. package/dist/runtime/ui.config/overlays/notifications.d.ts +7 -0
  192. package/dist/runtime/ui.config/overlays/notifications.mjs +6 -0
  193. package/dist/runtime/ui.config/overlays/popover.d.ts +43 -0
  194. package/dist/runtime/ui.config/overlays/popover.mjs +37 -0
  195. package/dist/runtime/ui.config/overlays/slideover.d.ts +32 -0
  196. package/dist/runtime/ui.config/overlays/slideover.mjs +33 -0
  197. package/dist/runtime/ui.config/overlays/tooltip.d.ts +33 -0
  198. package/dist/runtime/ui.config/overlays/tooltip.mjs +27 -0
  199. package/dist/runtime/ui.config/popper.d.ts +8 -0
  200. package/dist/runtime/ui.config/popper.mjs +8 -0
  201. package/dist/runtime/ui.css +1 -13
  202. package/dist/runtime/utils/index.d.ts +5 -0
  203. package/dist/runtime/utils/index.mjs +7 -3
  204. package/dist/types.d.mts +3 -2
  205. package/dist/types.d.ts +3 -2
  206. package/package.json +32 -21
  207. package/dist/runtime/ui.config.d.ts +0 -1470
  208. package/dist/runtime/ui.config.mjs +0 -1273
@@ -1,11 +1,12 @@
1
1
  import type { Ref, PropType } from 'vue';
2
+ import type { FormGroupSize } from '../../types';
2
3
  declare const _default: import("vue").DefineComponent<{
3
4
  name: {
4
5
  type: StringConstructor;
5
6
  default: null;
6
7
  };
7
8
  size: {
8
- type: PropType<string | number | symbol>;
9
+ type: PropType<FormGroupSize>;
9
10
  default: null;
10
11
  validator(value: string): boolean;
11
12
  };
@@ -35,18 +36,22 @@ declare const _default: import("vue").DefineComponent<{
35
36
  };
36
37
  class: {
37
38
  type: PropType<any>;
38
- default: undefined;
39
+ default: () => "";
39
40
  };
40
41
  ui: {
41
- type: PropType<Partial<any>>;
42
- default: undefined;
42
+ type: PropType<any>;
43
+ default: () => {};
44
+ };
45
+ eagerValidation: {
46
+ type: BooleanConstructor;
47
+ default: boolean;
43
48
  };
44
49
  }, {
45
50
  ui: import("vue").ComputedRef<any>;
46
51
  attrs: import("vue").ComputedRef<Pick<{
47
52
  [x: string]: unknown;
48
53
  }, string>>;
49
- inputId: Ref<string>;
54
+ inputId: Ref<any>;
50
55
  size: import("vue").ComputedRef<any>;
51
56
  error: import("vue").ComputedRef<string | boolean | undefined>;
52
57
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -55,7 +60,7 @@ declare const _default: import("vue").DefineComponent<{
55
60
  default: null;
56
61
  };
57
62
  size: {
58
- type: PropType<string | number | symbol>;
63
+ type: PropType<FormGroupSize>;
59
64
  default: null;
60
65
  validator(value: string): boolean;
61
66
  };
@@ -85,22 +90,27 @@ declare const _default: import("vue").DefineComponent<{
85
90
  };
86
91
  class: {
87
92
  type: PropType<any>;
88
- default: undefined;
93
+ default: () => "";
89
94
  };
90
95
  ui: {
91
- type: PropType<Partial<any>>;
92
- default: undefined;
96
+ type: PropType<any>;
97
+ default: () => {};
98
+ };
99
+ eagerValidation: {
100
+ type: BooleanConstructor;
101
+ default: boolean;
93
102
  };
94
103
  }>>, {
95
104
  error: string | boolean;
105
+ size: FormGroupSize;
106
+ ui: any;
96
107
  description: string;
97
- ui: Partial<any>;
98
108
  name: string;
99
109
  class: any;
100
110
  label: string;
101
111
  required: boolean;
102
- size: string | number | symbol;
103
112
  help: string;
104
113
  hint: string;
114
+ eagerValidation: boolean;
105
115
  }, {}>;
106
116
  export default _default;
@@ -9,11 +9,11 @@
9
9
  :required="required"
10
10
  :placeholder="placeholder"
11
11
  :disabled="disabled || loading"
12
- class="form-input"
13
12
  :class="inputClass"
14
13
  v-bind="attrs"
15
14
  @input="onInput"
16
15
  @blur="onBlur"
16
+ @change="onChange"
17
17
  >
18
18
  <slot />
19
19
 
@@ -35,9 +35,11 @@
35
35
  import { ref, computed, toRef, onMounted, defineComponent } from "vue";
36
36
  import { twMerge, twJoin } from "tailwind-merge";
37
37
  import UIcon from "../elements/Icon.vue";
38
+ import { defu } from "defu";
38
39
  import { useUI } from "../../composables/useUI";
39
40
  import { useFormGroup } from "../../composables/useFormGroup";
40
- import { mergeConfig } from "../../utils";
41
+ import { mergeConfig, looseToNumber } from "../../utils";
42
+ import { useInjectButtonGroup } from "../../composables/useButtonGroup";
41
43
  import appConfig from "#build/app.config";
42
44
  import { input } from "#ui/ui.config";
43
45
  const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.input, input);
@@ -145,27 +147,54 @@ export default defineComponent({
145
147
  },
146
148
  class: {
147
149
  type: [String, Object, Array],
148
- default: void 0
150
+ default: () => ""
149
151
  },
150
152
  ui: {
151
153
  type: Object,
152
- default: void 0
154
+ default: () => ({})
155
+ },
156
+ modelModifiers: {
157
+ type: Object,
158
+ default: () => ({})
153
159
  }
154
160
  },
155
161
  emits: ["update:modelValue", "blur"],
156
162
  setup(props, { emit, slots }) {
157
163
  const { ui, attrs } = useUI("input", toRef(props, "ui"), config, toRef(props, "class"));
158
- const { emitFormBlur, emitFormInput, size, color, inputId, name } = useFormGroup(props, config);
164
+ const { size: sizeButtonGroup, rounded } = useInjectButtonGroup({ ui, props });
165
+ const { emitFormBlur, emitFormInput, size: sizeFormGroup, color, inputId, name } = useFormGroup(props, config);
166
+ const size = computed(() => sizeButtonGroup.value || sizeFormGroup.value);
167
+ const modelModifiers = ref(defu({}, props.modelModifiers, { trim: false, lazy: false, number: false }));
159
168
  const input2 = ref(null);
160
169
  const autoFocus = () => {
161
170
  if (props.autofocus) {
162
171
  input2.value?.focus();
163
172
  }
164
173
  };
165
- const onInput = (event) => {
166
- emit("update:modelValue", event.target.value);
174
+ const updateInput = (value) => {
175
+ if (modelModifiers.value.trim) {
176
+ value = value.trim();
177
+ }
178
+ if (modelModifiers.value.number || props.type === "number") {
179
+ value = looseToNumber(value);
180
+ }
181
+ emit("update:modelValue", value);
167
182
  emitFormInput();
168
183
  };
184
+ const onInput = (event) => {
185
+ if (!modelModifiers.value.lazy) {
186
+ updateInput(event.target.value);
187
+ }
188
+ };
189
+ const onChange = (event) => {
190
+ const value = event.target.value;
191
+ if (modelModifiers.value.lazy) {
192
+ updateInput(value);
193
+ }
194
+ if (modelModifiers.value.trim) {
195
+ event.target.value = value.trim();
196
+ }
197
+ };
169
198
  const onBlur = (event) => {
170
199
  emitFormBlur();
171
200
  emit("blur", event);
@@ -179,7 +208,8 @@ export default defineComponent({
179
208
  const variant = ui.value.color?.[color.value]?.[props.variant] || ui.value.variant[props.variant];
180
209
  return twMerge(twJoin(
181
210
  ui.value.base,
182
- ui.value.rounded,
211
+ ui.value.form,
212
+ rounded.value,
183
213
  ui.value.placeholder,
184
214
  ui.value.size[size.value],
185
215
  props.padded ? ui.value.padding[size.value] : "p-0",
@@ -216,9 +246,9 @@ export default defineComponent({
216
246
  const leadingIconClass = computed(() => {
217
247
  return twJoin(
218
248
  ui.value.icon.base,
219
- appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
249
+ color.value && appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
220
250
  ui.value.icon.size[size.value],
221
- props.loading && "animate-spin"
251
+ props.loading && ui.value.icon.loading
222
252
  );
223
253
  });
224
254
  const trailingWrapperIconClass = computed(() => {
@@ -231,9 +261,9 @@ export default defineComponent({
231
261
  const trailingIconClass = computed(() => {
232
262
  return twJoin(
233
263
  ui.value.icon.base,
234
- appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
264
+ color.value && appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
235
265
  ui.value.icon.size[size.value],
236
- props.loading && !isLeading.value && "animate-spin"
266
+ props.loading && !isLeading.value && ui.value.icon.loading
237
267
  );
238
268
  });
239
269
  return {
@@ -255,6 +285,7 @@ export default defineComponent({
255
285
  trailingIconClass,
256
286
  trailingWrapperIconClass,
257
287
  onInput,
288
+ onChange,
258
289
  onBlur
259
290
  };
260
291
  }
@@ -1,4 +1,5 @@
1
1
  import type { PropType } from 'vue';
2
+ import type { InputSize, InputVariant } from '../../types';
2
3
  declare const _default: import("vue").DefineComponent<{
3
4
  modelValue: {
4
5
  type: (NumberConstructor | StringConstructor)[];
@@ -69,7 +70,7 @@ declare const _default: import("vue").DefineComponent<{
69
70
  default: boolean;
70
71
  };
71
72
  size: {
72
- type: PropType<string | number | symbol>;
73
+ type: PropType<InputSize>;
73
74
  default: null;
74
75
  validator(value: string): boolean;
75
76
  };
@@ -79,7 +80,7 @@ declare const _default: import("vue").DefineComponent<{
79
80
  validator(value: string): boolean;
80
81
  };
81
82
  variant: {
82
- type: PropType<any>;
83
+ type: PropType<InputVariant>;
83
84
  default: () => any;
84
85
  validator(value: string): boolean;
85
86
  };
@@ -89,11 +90,19 @@ declare const _default: import("vue").DefineComponent<{
89
90
  };
90
91
  class: {
91
92
  type: PropType<any>;
92
- default: undefined;
93
+ default: () => "";
93
94
  };
94
95
  ui: {
95
- type: PropType<Partial<any>>;
96
- default: undefined;
96
+ type: PropType<any>;
97
+ default: () => {};
98
+ };
99
+ modelModifiers: {
100
+ type: PropType<{
101
+ trim?: boolean | undefined;
102
+ lazy?: boolean | undefined;
103
+ number?: boolean | undefined;
104
+ }>;
105
+ default: () => {};
97
106
  };
98
107
  }, {
99
108
  ui: import("vue").ComputedRef<any>;
@@ -112,7 +121,8 @@ declare const _default: import("vue").DefineComponent<{
112
121
  trailingIconName: import("vue").ComputedRef<string | undefined>;
113
122
  trailingIconClass: import("vue").ComputedRef<string>;
114
123
  trailingWrapperIconClass: import("vue").ComputedRef<string>;
115
- onInput: (event: InputEvent) => void;
124
+ onInput: (event: Event) => void;
125
+ onChange: (event: Event) => void;
116
126
  onBlur: (event: FocusEvent) => void;
117
127
  }, 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<{
118
128
  modelValue: {
@@ -184,7 +194,7 @@ declare const _default: import("vue").DefineComponent<{
184
194
  default: boolean;
185
195
  };
186
196
  size: {
187
- type: PropType<string | number | symbol>;
197
+ type: PropType<InputSize>;
188
198
  default: null;
189
199
  validator(value: string): boolean;
190
200
  };
@@ -194,7 +204,7 @@ declare const _default: import("vue").DefineComponent<{
194
204
  validator(value: string): boolean;
195
205
  };
196
206
  variant: {
197
- type: PropType<any>;
207
+ type: PropType<InputVariant>;
198
208
  default: () => any;
199
209
  validator(value: string): boolean;
200
210
  };
@@ -204,29 +214,37 @@ declare const _default: import("vue").DefineComponent<{
204
214
  };
205
215
  class: {
206
216
  type: PropType<any>;
207
- default: undefined;
217
+ default: () => "";
208
218
  };
209
219
  ui: {
210
- type: PropType<Partial<any>>;
211
- default: undefined;
220
+ type: PropType<any>;
221
+ default: () => {};
222
+ };
223
+ modelModifiers: {
224
+ type: PropType<{
225
+ trim?: boolean | undefined;
226
+ lazy?: boolean | undefined;
227
+ number?: boolean | undefined;
228
+ }>;
229
+ default: () => {};
212
230
  };
213
231
  }>> & {
214
232
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
215
233
  onBlur?: ((...args: any[]) => any) | undefined;
216
234
  }, {
235
+ size: InputSize;
236
+ ui: any;
217
237
  id: string;
218
238
  icon: string;
219
239
  color: any;
220
- ui: Partial<any>;
240
+ type: string;
221
241
  name: string;
222
242
  class: any;
223
243
  modelValue: string | number;
224
244
  loading: boolean;
225
- type: string;
226
245
  disabled: boolean;
227
- variant: any;
246
+ variant: InputVariant;
228
247
  required: boolean;
229
- size: string | number | symbol;
230
248
  placeholder: string;
231
249
  padded: boolean;
232
250
  loadingIcon: string;
@@ -237,5 +255,10 @@ declare const _default: import("vue").DefineComponent<{
237
255
  autofocus: boolean;
238
256
  inputClass: string;
239
257
  autofocusDelay: number;
258
+ modelModifiers: {
259
+ trim?: boolean | undefined;
260
+ lazy?: boolean | undefined;
261
+ number?: boolean | undefined;
262
+ };
240
263
  }, {}>;
241
264
  export default _default;
@@ -1,21 +1,20 @@
1
1
  <template>
2
2
  <div :class="ui.wrapper">
3
- <div class="flex items-center h-5">
3
+ <div :class="ui.container">
4
4
  <input
5
- :id="id"
5
+ :id="inputId"
6
6
  v-model="pick"
7
7
  :name="name"
8
8
  :required="required"
9
9
  :value="value"
10
10
  :disabled="disabled"
11
11
  type="radio"
12
- class="form-radio"
13
12
  :class="inputClass"
14
13
  v-bind="attrs"
15
14
  >
16
15
  </div>
17
- <div v-if="label || $slots.label" class="ms-3 inline-flex items-center">
18
- <label :for="id" :class="ui.label">
16
+ <div v-if="label || $slots.label" :class="ui.inner">
17
+ <label :for="inputId" :class="ui.label">
19
18
  <slot name="label">{{ label }}</slot>
20
19
  <span v-if="required" :class="ui.required">*</span>
21
20
  </label>
@@ -27,7 +26,7 @@
27
26
  </template>
28
27
 
29
28
  <script>
30
- import { computed, defineComponent, inject, toRef } from "vue";
29
+ import { computed, defineComponent, inject, toRef, onMounted, ref } from "vue";
31
30
  import { twMerge, twJoin } from "tailwind-merge";
32
31
  import { useUI } from "../../composables/useUI";
33
32
  import { mergeConfig } from "../../utils";
@@ -41,8 +40,7 @@ export default defineComponent({
41
40
  props: {
42
41
  id: {
43
42
  type: String,
44
- // A default value is needed here to bind the label
45
- default: () => uid()
43
+ default: () => null
46
44
  },
47
45
  value: {
48
46
  type: [String, Number, Boolean],
@@ -85,11 +83,11 @@ export default defineComponent({
85
83
  },
86
84
  class: {
87
85
  type: [String, Object, Array],
88
- default: void 0
86
+ default: () => ""
89
87
  },
90
88
  ui: {
91
89
  type: Object,
92
- default: void 0
90
+ default: () => ({})
93
91
  }
94
92
  },
95
93
  emits: ["update:modelValue", "change"],
@@ -97,6 +95,12 @@ export default defineComponent({
97
95
  const { ui, attrs } = useUI("radio", toRef(props, "ui"), config, toRef(props, "class"));
98
96
  const radioGroup = inject("radio-group", null);
99
97
  const { emitFormChange, color, name } = radioGroup ?? useFormGroup(props, config);
98
+ const inputId = ref(props.id);
99
+ onMounted(() => {
100
+ if (!inputId.value) {
101
+ inputId.value = uid();
102
+ }
103
+ });
100
104
  const pick = computed({
101
105
  get() {
102
106
  return props.modelValue;
@@ -112,13 +116,15 @@ export default defineComponent({
112
116
  const inputClass = computed(() => {
113
117
  return twMerge(twJoin(
114
118
  ui.value.base,
119
+ ui.value.form,
115
120
  ui.value.background,
116
121
  ui.value.border,
117
- ui.value.ring.replaceAll("{color}", color.value),
118
- ui.value.color.replaceAll("{color}", color.value)
122
+ color.value && ui.value.ring.replaceAll("{color}", color.value),
123
+ color.value && ui.value.color.replaceAll("{color}", color.value)
119
124
  ), props.inputClass);
120
125
  });
121
126
  return {
127
+ inputId,
122
128
  // eslint-disable-next-line vue/no-dupe-keys
123
129
  ui,
124
130
  attrs,
@@ -2,7 +2,7 @@ import type { PropType } from 'vue';
2
2
  declare const _default: import("vue").DefineComponent<{
3
3
  id: {
4
4
  type: StringConstructor;
5
- default: () => string;
5
+ default: () => null;
6
6
  };
7
7
  value: {
8
8
  type: (BooleanConstructor | NumberConstructor | StringConstructor)[];
@@ -43,13 +43,14 @@ declare const _default: import("vue").DefineComponent<{
43
43
  };
44
44
  class: {
45
45
  type: PropType<any>;
46
- default: undefined;
46
+ default: () => "";
47
47
  };
48
48
  ui: {
49
- type: PropType<Partial<any>>;
50
- default: undefined;
49
+ type: PropType<any>;
50
+ default: () => {};
51
51
  };
52
52
  }, {
53
+ inputId: import("vue").Ref<string>;
53
54
  ui: import("vue").ComputedRef<any>;
54
55
  attrs: import("vue").ComputedRef<Pick<{
55
56
  [x: string]: unknown;
@@ -60,7 +61,7 @@ declare const _default: import("vue").DefineComponent<{
60
61
  }, 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<{
61
62
  id: {
62
63
  type: StringConstructor;
63
- default: () => string;
64
+ default: () => null;
64
65
  };
65
66
  value: {
66
67
  type: (BooleanConstructor | NumberConstructor | StringConstructor)[];
@@ -101,22 +102,22 @@ declare const _default: import("vue").DefineComponent<{
101
102
  };
102
103
  class: {
103
104
  type: PropType<any>;
104
- default: undefined;
105
+ default: () => "";
105
106
  };
106
107
  ui: {
107
- type: PropType<Partial<any>>;
108
- default: undefined;
108
+ type: PropType<any>;
109
+ default: () => {};
109
110
  };
110
111
  }>> & {
111
112
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
112
113
  onChange?: ((...args: any[]) => any) | undefined;
113
114
  }, {
115
+ ui: any;
116
+ value: string | number | boolean;
114
117
  id: string;
115
118
  color: any;
116
- ui: Partial<any>;
117
119
  name: string;
118
120
  class: any;
119
- value: string | number | boolean;
120
121
  label: string;
121
122
  modelValue: string | number | boolean | Record<string, any>;
122
123
  disabled: boolean;
@@ -77,15 +77,15 @@ export default defineComponent({
77
77
  },
78
78
  class: {
79
79
  type: [String, Object, Array],
80
- default: void 0
80
+ default: () => ""
81
81
  },
82
82
  ui: {
83
83
  type: Object,
84
- default: void 0
84
+ default: () => ({})
85
85
  },
86
86
  uiRadio: {
87
87
  type: Object,
88
- default: void 0
88
+ default: () => ({})
89
89
  }
90
90
  },
91
91
  emits: ["update:modelValue", "change"],
@@ -35,15 +35,15 @@ declare const _default: import("vue").DefineComponent<{
35
35
  };
36
36
  class: {
37
37
  type: PropType<any>;
38
- default: undefined;
38
+ default: () => "";
39
39
  };
40
40
  ui: {
41
- type: PropType<Partial<any>>;
42
- default: undefined;
41
+ type: PropType<any>;
42
+ default: () => {};
43
43
  };
44
44
  uiRadio: {
45
- type: PropType<Partial<any>>;
46
- default: undefined;
45
+ type: PropType<any>;
46
+ default: () => {};
47
47
  };
48
48
  }, {
49
49
  ui: import("vue").ComputedRef<any>;
@@ -89,30 +89,30 @@ declare const _default: import("vue").DefineComponent<{
89
89
  };
90
90
  class: {
91
91
  type: PropType<any>;
92
- default: undefined;
92
+ default: () => "";
93
93
  };
94
94
  ui: {
95
- type: PropType<Partial<any>>;
96
- default: undefined;
95
+ type: PropType<any>;
96
+ default: () => {};
97
97
  };
98
98
  uiRadio: {
99
- type: PropType<Partial<any>>;
100
- default: undefined;
99
+ type: PropType<any>;
100
+ default: () => {};
101
101
  };
102
102
  }>> & {
103
103
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
104
104
  onChange?: ((...args: any[]) => any) | undefined;
105
105
  }, {
106
+ ui: any;
106
107
  color: any;
107
- ui: Partial<any>;
108
+ legend: string;
108
109
  options: unknown[];
109
110
  name: string;
110
111
  class: any;
111
- legend: string;
112
112
  modelValue: string | number | Record<string, any>;
113
113
  disabled: boolean;
114
114
  optionAttribute: string;
115
115
  valueAttribute: string;
116
- uiRadio: Partial<any>;
116
+ uiRadio: any;
117
117
  }, {}>;
118
118
  export default _default;
@@ -79,11 +79,11 @@ export default defineComponent({
79
79
  },
80
80
  class: {
81
81
  type: [String, Object, Array],
82
- default: void 0
82
+ default: () => ""
83
83
  },
84
84
  ui: {
85
85
  type: Object,
86
- default: void 0
86
+ default: () => ({})
87
87
  }
88
88
  },
89
89
  emits: ["update:modelValue", "change"],
@@ -113,7 +113,7 @@ export default defineComponent({
113
113
  ui.value.base,
114
114
  ui.value.background,
115
115
  ui.value.rounded,
116
- ui.value.ring.replaceAll("{color}", color.value),
116
+ color.value && ui.value.ring.replaceAll("{color}", color.value),
117
117
  ui.value.size[size.value]
118
118
  ), props.inputClass);
119
119
  });
@@ -121,7 +121,7 @@ export default defineComponent({
121
121
  return twJoin(
122
122
  ui.value.thumb.base,
123
123
  // Intermediate class to allow thumb ring or background color (set to `current`) as it's impossible to safelist with arbitrary values
124
- ui.value.thumb.color.replaceAll("{color}", color.value),
124
+ color.value && ui.value.thumb.color.replaceAll("{color}", color.value),
125
125
  ui.value.thumb.ring,
126
126
  ui.value.thumb.background,
127
127
  ui.value.thumb.size[size.value]
@@ -139,7 +139,7 @@ export default defineComponent({
139
139
  return twJoin(
140
140
  ui.value.progress.base,
141
141
  ui.value.progress.rounded,
142
- ui.value.progress.background.replaceAll("{color}", color.value),
142
+ color.value && ui.value.progress.background.replaceAll("{color}", color.value),
143
143
  ui.value.progress.size[size.value]
144
144
  );
145
145
  });
@@ -1,4 +1,5 @@
1
1
  import type { PropType } from 'vue';
2
+ import type { RangeSize } from '../../types';
2
3
  declare const _default: import("vue").DefineComponent<{
3
4
  modelValue: {
4
5
  type: NumberConstructor;
@@ -29,7 +30,7 @@ declare const _default: import("vue").DefineComponent<{
29
30
  default: number;
30
31
  };
31
32
  size: {
32
- type: PropType<string | number | symbol>;
33
+ type: PropType<RangeSize>;
33
34
  default: null;
34
35
  validator(value: string): boolean;
35
36
  };
@@ -44,11 +45,11 @@ declare const _default: import("vue").DefineComponent<{
44
45
  };
45
46
  class: {
46
47
  type: PropType<any>;
47
- default: undefined;
48
+ default: () => "";
48
49
  };
49
50
  ui: {
50
- type: PropType<Partial<any>>;
51
- default: undefined;
51
+ type: PropType<any>;
52
+ default: () => {};
52
53
  };
53
54
  }, {
54
55
  ui: import("vue").ComputedRef<any>;
@@ -97,7 +98,7 @@ declare const _default: import("vue").DefineComponent<{
97
98
  default: number;
98
99
  };
99
100
  size: {
100
- type: PropType<string | number | symbol>;
101
+ type: PropType<RangeSize>;
101
102
  default: null;
102
103
  validator(value: string): boolean;
103
104
  };
@@ -112,24 +113,24 @@ declare const _default: import("vue").DefineComponent<{
112
113
  };
113
114
  class: {
114
115
  type: PropType<any>;
115
- default: undefined;
116
+ default: () => "";
116
117
  };
117
118
  ui: {
118
- type: PropType<Partial<any>>;
119
- default: undefined;
119
+ type: PropType<any>;
120
+ default: () => {};
120
121
  };
121
122
  }>> & {
122
123
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
123
124
  onChange?: ((...args: any[]) => any) | undefined;
124
125
  }, {
126
+ size: RangeSize;
127
+ ui: any;
125
128
  id: string;
126
129
  color: any;
127
- ui: Partial<any>;
128
130
  name: string;
129
131
  class: any;
130
132
  modelValue: number;
131
133
  disabled: boolean;
132
- size: string | number | symbol;
133
134
  max: number;
134
135
  min: number;
135
136
  inputClass: string;