@nuxt/ui 2.9.0 → 2.11.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 (201) hide show
  1. package/README.md +11 -0
  2. package/dist/module.d.mts +449 -72
  3. package/dist/module.d.ts +449 -72
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +32 -6
  6. package/dist/runtime/components/data/Table.vue +8 -6
  7. package/dist/runtime/components/data/Table.vue.d.ts +2 -1
  8. package/dist/runtime/components/elements/Accordion.vue +15 -13
  9. package/dist/runtime/components/elements/Accordion.vue.d.ts +5 -2
  10. package/dist/runtime/components/elements/Alert.vue +7 -6
  11. package/dist/runtime/components/elements/Alert.vue.d.ts +6 -5
  12. package/dist/runtime/components/elements/Avatar.vue.d.ts +5 -4
  13. package/dist/runtime/components/elements/AvatarGroup.d.ts +4 -3
  14. package/dist/runtime/components/elements/Badge.vue +4 -2
  15. package/dist/runtime/components/elements/Badge.vue.d.ts +5 -5
  16. package/dist/runtime/components/elements/Button.vue +8 -6
  17. package/dist/runtime/components/elements/Button.vue.d.ts +7 -7
  18. package/dist/runtime/components/elements/ButtonGroup.d.ts +5 -4
  19. package/dist/runtime/components/elements/ButtonGroup.mjs +19 -32
  20. package/dist/runtime/components/elements/Chip.vue +85 -0
  21. package/dist/runtime/components/elements/Chip.vue.d.ts +90 -0
  22. package/dist/runtime/components/elements/Dropdown.vue +45 -25
  23. package/dist/runtime/components/elements/Dropdown.vue.d.ts +8 -0
  24. package/dist/runtime/components/elements/Icon.vue +16 -2
  25. package/dist/runtime/components/elements/Icon.vue.d.ts +14 -2
  26. package/dist/runtime/components/elements/Kbd.vue.d.ts +5 -4
  27. package/dist/runtime/components/elements/Link.vue +2 -5
  28. package/dist/runtime/components/elements/Meter.vue +166 -0
  29. package/dist/runtime/components/elements/Meter.vue.d.ts +123 -0
  30. package/dist/runtime/components/elements/MeterGroup.d.ts +78 -0
  31. package/dist/runtime/components/elements/MeterGroup.mjs +172 -0
  32. package/dist/runtime/components/elements/Progress.vue +284 -0
  33. package/dist/runtime/components/elements/Progress.vue.d.ts +2 -0
  34. package/dist/runtime/components/forms/Checkbox.vue +2 -4
  35. package/dist/runtime/components/forms/Checkbox.vue.d.ts +6 -6
  36. package/dist/runtime/components/forms/Form.vue +32 -7
  37. package/dist/runtime/components/forms/Form.vue.d.ts +2 -1
  38. package/dist/runtime/components/forms/FormGroup.vue +7 -3
  39. package/dist/runtime/components/forms/FormGroup.vue.d.ts +15 -5
  40. package/dist/runtime/components/forms/Input.vue +41 -6
  41. package/dist/runtime/components/forms/Input.vue.d.ts +42 -10
  42. package/dist/runtime/components/forms/Radio.vue +16 -9
  43. package/dist/runtime/components/forms/Radio.vue.d.ts +8 -7
  44. package/dist/runtime/components/forms/RadioGroup.vue +136 -0
  45. package/dist/runtime/components/forms/RadioGroup.vue.d.ts +118 -0
  46. package/dist/runtime/components/forms/Range.vue.d.ts +8 -7
  47. package/dist/runtime/components/forms/Select.vue +5 -2
  48. package/dist/runtime/components/forms/Select.vue.d.ts +10 -9
  49. package/dist/runtime/components/forms/SelectMenu.vue +80 -58
  50. package/dist/runtime/components/forms/SelectMenu.vue.d.ts +23 -13
  51. package/dist/runtime/components/forms/Textarea.vue +38 -4
  52. package/dist/runtime/components/forms/Textarea.vue.d.ts +41 -9
  53. package/dist/runtime/components/forms/Toggle.vue +19 -1
  54. package/dist/runtime/components/forms/Toggle.vue.d.ts +16 -3
  55. package/dist/runtime/components/layout/Divider.vue +107 -0
  56. package/dist/runtime/components/layout/Divider.vue.d.ts +82 -0
  57. package/dist/runtime/components/navigation/Breadcrumb.vue +78 -0
  58. package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +50 -0
  59. package/dist/runtime/components/navigation/CommandPalette.vue +18 -7
  60. package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +2 -2
  61. package/dist/runtime/components/navigation/Pagination.vue +65 -9
  62. package/dist/runtime/components/navigation/Pagination.vue.d.ts +45 -7
  63. package/dist/runtime/components/navigation/Tabs.vue +1 -1
  64. package/dist/runtime/components/navigation/Tabs.vue.d.ts +1 -1
  65. package/dist/runtime/components/overlays/ContextMenu.vue +7 -2
  66. package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +2 -1
  67. package/dist/runtime/components/overlays/Modal.vue +1 -1
  68. package/dist/runtime/components/overlays/Modal.vue.d.ts +1 -1
  69. package/dist/runtime/components/overlays/Notification.vue +32 -27
  70. package/dist/runtime/components/overlays/Notification.vue.d.ts +4 -3
  71. package/dist/runtime/components/overlays/Notifications.vue +16 -14
  72. package/dist/runtime/components/overlays/Popover.vue +31 -7
  73. package/dist/runtime/components/overlays/Popover.vue.d.ts +27 -2
  74. package/dist/runtime/components/overlays/Slideover.vue.d.ts +1 -1
  75. package/dist/runtime/components/overlays/Tooltip.vue +16 -10
  76. package/dist/runtime/components/overlays/Tooltip.vue.d.ts +1 -0
  77. package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
  78. package/dist/runtime/composables/defineShortcuts.mjs +8 -4
  79. package/dist/runtime/composables/useButtonGroup.d.ts +20 -0
  80. package/dist/runtime/composables/useButtonGroup.mjs +52 -0
  81. package/dist/runtime/composables/useFormGroup.d.ts +6 -4
  82. package/dist/runtime/composables/useFormGroup.mjs +19 -7
  83. package/dist/runtime/composables/usePopper.d.ts +3 -3
  84. package/dist/runtime/composables/usePopper.mjs +7 -1
  85. package/dist/runtime/composables/useShortcuts.d.ts +2 -2
  86. package/dist/runtime/composables/useUI.d.ts +2 -2
  87. package/dist/runtime/composables/useUI.mjs +2 -2
  88. package/dist/runtime/types/alert.d.ts +7 -0
  89. package/dist/runtime/types/avatar.d.ts +3 -1
  90. package/dist/runtime/types/badge.d.ts +5 -4
  91. package/dist/runtime/types/breadcrumb.d.ts +7 -0
  92. package/dist/runtime/types/button.d.ts +5 -4
  93. package/dist/runtime/types/chip.d.ts +11 -0
  94. package/dist/runtime/types/command-palette.d.ts +1 -0
  95. package/dist/runtime/types/dropdown.d.ts +2 -2
  96. package/dist/runtime/types/form-group.d.ts +5 -0
  97. package/dist/runtime/types/form.d.ts +14 -6
  98. package/dist/runtime/types/index.d.ts +12 -0
  99. package/dist/runtime/types/input.d.ts +8 -0
  100. package/dist/runtime/types/kbd.d.ts +5 -0
  101. package/dist/runtime/types/meter.d.ts +5 -0
  102. package/dist/runtime/types/popper.d.ts +1 -0
  103. package/dist/runtime/types/progress.d.ts +4 -0
  104. package/dist/runtime/types/range.d.ts +5 -0
  105. package/dist/runtime/types/select.d.ts +8 -0
  106. package/dist/runtime/types/textarea.d.ts +8 -0
  107. package/dist/runtime/types/toggle.d.ts +5 -0
  108. package/dist/runtime/types/utils.d.ts +22 -5
  109. package/dist/runtime/ui.config/_popperArrow.d.ts +9 -0
  110. package/dist/runtime/ui.config/_popperArrow.mjs +8 -0
  111. package/dist/runtime/ui.config/data/table.d.ts +60 -0
  112. package/dist/runtime/ui.config/data/table.mjs +59 -0
  113. package/dist/runtime/ui.config/elements/accordion.d.ts +21 -0
  114. package/dist/runtime/ui.config/elements/accordion.mjs +20 -0
  115. package/dist/runtime/ui.config/elements/alert.d.ts +40 -0
  116. package/dist/runtime/ui.config/elements/alert.mjs +39 -0
  117. package/dist/runtime/ui.config/elements/avatar.d.ts +60 -0
  118. package/dist/runtime/ui.config/elements/avatar.mjs +59 -0
  119. package/dist/runtime/ui.config/elements/avatarGroup.d.ts +6 -0
  120. package/dist/runtime/ui.config/elements/avatarGroup.mjs +5 -0
  121. package/dist/runtime/ui.config/elements/badge.d.ts +34 -0
  122. package/dist/runtime/ui.config/elements/badge.mjs +33 -0
  123. package/dist/runtime/ui.config/elements/button.d.ts +77 -0
  124. package/dist/runtime/ui.config/elements/button.mjs +76 -0
  125. package/dist/runtime/ui.config/elements/buttonGroup.d.ts +9 -0
  126. package/dist/runtime/ui.config/elements/buttonGroup.mjs +8 -0
  127. package/dist/runtime/ui.config/elements/chip.d.ts +35 -0
  128. package/dist/runtime/ui.config/elements/chip.mjs +34 -0
  129. package/dist/runtime/ui.config/elements/dropdown.d.ts +53 -0
  130. package/dist/runtime/ui.config/elements/dropdown.mjs +51 -0
  131. package/dist/runtime/ui.config/elements/kbd.d.ts +17 -0
  132. package/dist/runtime/ui.config/elements/kbd.mjs +16 -0
  133. package/dist/runtime/ui.config/elements/meter.d.ts +77 -0
  134. package/dist/runtime/ui.config/elements/meter.mjs +76 -0
  135. package/dist/runtime/ui.config/elements/meterGroup.d.ts +12 -0
  136. package/dist/runtime/ui.config/elements/meterGroup.mjs +11 -0
  137. package/dist/runtime/ui.config/elements/progress.d.ts +75 -0
  138. package/dist/runtime/ui.config/elements/progress.mjs +74 -0
  139. package/dist/runtime/ui.config/forms/checkbox.d.ts +16 -0
  140. package/dist/runtime/ui.config/forms/checkbox.mjs +15 -0
  141. package/dist/runtime/ui.config/forms/formGroup.d.ts +25 -0
  142. package/dist/runtime/ui.config/forms/formGroup.mjs +25 -0
  143. package/dist/runtime/ui.config/forms/input.d.ts +105 -0
  144. package/dist/runtime/ui.config/forms/input.mjs +104 -0
  145. package/dist/runtime/ui.config/forms/radio.d.ts +15 -0
  146. package/dist/runtime/ui.config/forms/radio.mjs +14 -0
  147. package/dist/runtime/ui.config/forms/radioGroup.d.ts +8 -0
  148. package/dist/runtime/ui.config/forms/radioGroup.mjs +7 -0
  149. package/dist/runtime/ui.config/forms/range.d.ts +64 -0
  150. package/dist/runtime/ui.config/forms/range.mjs +63 -0
  151. package/dist/runtime/ui.config/forms/select.d.ts +106 -0
  152. package/dist/runtime/ui.config/forms/select.mjs +12 -0
  153. package/dist/runtime/ui.config/forms/selectMenu.d.ts +63 -0
  154. package/dist/runtime/ui.config/forms/selectMenu.mjs +61 -0
  155. package/dist/runtime/ui.config/forms/textarea.d.ts +104 -0
  156. package/dist/runtime/ui.config/forms/textarea.mjs +9 -0
  157. package/dist/runtime/ui.config/forms/toggle.d.ts +61 -0
  158. package/dist/runtime/ui.config/forms/toggle.mjs +60 -0
  159. package/dist/runtime/ui.config/index.d.ts +40 -0
  160. package/dist/runtime/ui.config/index.mjs +40 -0
  161. package/dist/runtime/ui.config/layout/card.d.ts +24 -0
  162. package/dist/runtime/ui.config/layout/card.mjs +23 -0
  163. package/dist/runtime/ui.config/layout/container.d.ts +6 -0
  164. package/dist/runtime/ui.config/layout/container.mjs +5 -0
  165. package/dist/runtime/ui.config/layout/divider.d.ts +30 -0
  166. package/dist/runtime/ui.config/layout/divider.mjs +29 -0
  167. package/dist/runtime/ui.config/layout/skeleton.d.ts +6 -0
  168. package/dist/runtime/ui.config/layout/skeleton.mjs +5 -0
  169. package/dist/runtime/ui.config/navigation/breadcrumb.d.ts +20 -0
  170. package/dist/runtime/ui.config/navigation/breadcrumb.mjs +19 -0
  171. package/dist/runtime/ui.config/navigation/commandPalette.d.ts +68 -0
  172. package/dist/runtime/ui.config/navigation/commandPalette.mjs +67 -0
  173. package/dist/runtime/ui.config/navigation/pagination.d.ts +35 -0
  174. package/dist/runtime/ui.config/navigation/pagination.mjs +34 -0
  175. package/dist/runtime/ui.config/navigation/tabs.d.ts +34 -0
  176. package/dist/runtime/ui.config/navigation/tabs.mjs +33 -0
  177. package/dist/runtime/ui.config/navigation/verticalNavigation.d.ts +28 -0
  178. package/dist/runtime/ui.config/navigation/verticalNavigation.mjs +27 -0
  179. package/dist/runtime/ui.config/overlays/contextMenu.d.ts +31 -0
  180. package/dist/runtime/ui.config/overlays/contextMenu.mjs +25 -0
  181. package/dist/runtime/ui.config/overlays/modal.d.ts +35 -0
  182. package/dist/runtime/ui.config/overlays/modal.mjs +36 -0
  183. package/dist/runtime/ui.config/overlays/notification.d.ts +49 -0
  184. package/dist/runtime/ui.config/overlays/notification.mjs +49 -0
  185. package/dist/runtime/ui.config/overlays/notifications.d.ts +7 -0
  186. package/dist/runtime/ui.config/overlays/notifications.mjs +6 -0
  187. package/dist/runtime/ui.config/overlays/popover.d.ts +42 -0
  188. package/dist/runtime/ui.config/overlays/popover.mjs +36 -0
  189. package/dist/runtime/ui.config/overlays/slideover.d.ts +27 -0
  190. package/dist/runtime/ui.config/overlays/slideover.mjs +28 -0
  191. package/dist/runtime/ui.config/overlays/tooltip.d.ts +32 -0
  192. package/dist/runtime/ui.config/overlays/tooltip.mjs +26 -0
  193. package/dist/runtime/utils/index.d.ts +5 -0
  194. package/dist/runtime/utils/index.mjs +6 -2
  195. package/dist/types.d.mts +3 -2
  196. package/dist/types.d.ts +3 -2
  197. package/package.json +41 -28
  198. package/dist/runtime/ui.config.d.ts +0 -1207
  199. package/dist/runtime/ui.config.mjs +0 -1029
  200. package/dist/runtime/utils/StateEmitter.d.ts +0 -17
  201. package/dist/runtime/utils/StateEmitter.mjs +0 -21
@@ -1,5 +1,5 @@
1
1
  import type { PropType } from 'vue';
2
- import type { PopperOptions } from '../../types';
2
+ import type { SelectSize, SelectVariant, PopperOptions } from '../../types';
3
3
  declare const _default: import("vue").DefineComponent<{
4
4
  modelValue: {
5
5
  type: (ObjectConstructor | NumberConstructor | ArrayConstructor | StringConstructor)[];
@@ -76,6 +76,10 @@ declare const _default: import("vue").DefineComponent<{
76
76
  type: StringConstructor;
77
77
  default: string;
78
78
  };
79
+ clearSearchOnClose: {
80
+ type: BooleanConstructor;
81
+ default: () => any;
82
+ };
79
83
  debounce: {
80
84
  type: NumberConstructor;
81
85
  default: number;
@@ -93,7 +97,7 @@ declare const _default: import("vue").DefineComponent<{
93
97
  default: boolean;
94
98
  };
95
99
  size: {
96
- type: PropType<string | number | symbol>;
100
+ type: PropType<SelectSize>;
97
101
  default: null;
98
102
  validator(value: string): boolean;
99
103
  };
@@ -103,7 +107,7 @@ declare const _default: import("vue").DefineComponent<{
103
107
  validator(value: string): boolean;
104
108
  };
105
109
  variant: {
106
- type: PropType<any>;
110
+ type: PropType<SelectVariant>;
107
111
  default: () => any;
108
112
  validator(value: string): boolean;
109
113
  };
@@ -145,8 +149,9 @@ declare const _default: import("vue").DefineComponent<{
145
149
  attrs: import("vue").ComputedRef<Pick<{
146
150
  [x: string]: unknown;
147
151
  }, string>>;
148
- name: import("vue").ComputedRef<any>;
149
- inputId: import("vue").ComputedRef<any>;
152
+ name: import("vue").ComputedRef<string | undefined>;
153
+ inputId: import("vue").Ref<string | null | undefined>;
154
+ popper: import("vue").ComputedRef<PopperOptions>;
150
155
  trigger: import("vue").Ref<import("@vueuse/core").MaybeElement>;
151
156
  container: import("vue").Ref<import("@vueuse/core").MaybeElement>;
152
157
  isLeading: import("vue").ComputedRef<string | true>;
@@ -164,7 +169,7 @@ declare const _default: import("vue").DefineComponent<{
164
169
  } | null>;
165
170
  query: import("vue").Ref<string>;
166
171
  onUpdate: (event: any) => void;
167
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close" | "open" | "update:modelValue")[], "change" | "close" | "open" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
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<{
168
173
  modelValue: {
169
174
  type: (ObjectConstructor | NumberConstructor | ArrayConstructor | StringConstructor)[];
170
175
  default: string;
@@ -240,6 +245,10 @@ declare const _default: import("vue").DefineComponent<{
240
245
  type: StringConstructor;
241
246
  default: string;
242
247
  };
248
+ clearSearchOnClose: {
249
+ type: BooleanConstructor;
250
+ default: () => any;
251
+ };
243
252
  debounce: {
244
253
  type: NumberConstructor;
245
254
  default: number;
@@ -257,7 +266,7 @@ declare const _default: import("vue").DefineComponent<{
257
266
  default: boolean;
258
267
  };
259
268
  size: {
260
- type: PropType<string | number | symbol>;
269
+ type: PropType<SelectSize>;
261
270
  default: null;
262
271
  validator(value: string): boolean;
263
272
  };
@@ -267,7 +276,7 @@ declare const _default: import("vue").DefineComponent<{
267
276
  validator(value: string): boolean;
268
277
  };
269
278
  variant: {
270
- type: PropType<any>;
279
+ type: PropType<SelectVariant>;
271
280
  default: () => any;
272
281
  validator(value: string): boolean;
273
282
  };
@@ -304,15 +313,16 @@ declare const _default: import("vue").DefineComponent<{
304
313
  default: undefined;
305
314
  };
306
315
  }>> & {
307
- onClose?: ((...args: any[]) => any) | undefined;
308
- onOpen?: ((...args: any[]) => any) | undefined;
309
316
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
310
317
  onChange?: ((...args: any[]) => any) | undefined;
318
+ onClose?: ((...args: any[]) => any) | undefined;
319
+ onOpen?: ((...args: any[]) => any) | undefined;
311
320
  }, {
321
+ size: SelectSize;
322
+ ui: Partial<any>;
312
323
  id: string;
313
324
  icon: string;
314
325
  color: any;
315
- ui: Partial<any>;
316
326
  options: string[] | {
317
327
  [key: string]: any;
318
328
  disabled?: boolean | undefined;
@@ -325,9 +335,8 @@ declare const _default: import("vue").DefineComponent<{
325
335
  loading: boolean;
326
336
  disabled: boolean;
327
337
  multiple: boolean;
328
- variant: any;
338
+ variant: SelectVariant;
329
339
  required: boolean;
330
- size: string | number | symbol;
331
340
  placeholder: string;
332
341
  padded: boolean;
333
342
  loadingIcon: string;
@@ -341,6 +350,7 @@ declare const _default: import("vue").DefineComponent<{
341
350
  selectedIcon: string;
342
351
  searchable: boolean | ((query: string) => Promise<any[]> | any[]);
343
352
  searchablePlaceholder: string;
353
+ clearSearchOnClose: boolean;
344
354
  debounce: number;
345
355
  creatable: boolean;
346
356
  searchAttributes: unknown[];
@@ -14,16 +14,20 @@
14
14
  v-bind="attrs"
15
15
  @input="onInput"
16
16
  @blur="onBlur"
17
+ @change="onChange"
17
18
  />
19
+
20
+ <slot />
18
21
  </div>
19
22
  </template>
20
23
 
21
24
  <script>
22
25
  import { ref, computed, toRef, watch, onMounted, nextTick, defineComponent } from "vue";
23
26
  import { twMerge, twJoin } from "tailwind-merge";
27
+ import { defu } from "defu";
24
28
  import { useUI } from "../../composables/useUI";
25
29
  import { useFormGroup } from "../../composables/useFormGroup";
26
- import { mergeConfig } from "../../utils";
30
+ import { mergeConfig, looseToNumber } from "../../utils";
27
31
  import appConfig from "#build/app.config";
28
32
  import { textarea } from "#ui/ui.config";
29
33
  const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.textarea, textarea);
@@ -66,6 +70,10 @@ export default defineComponent({
66
70
  type: Boolean,
67
71
  default: false
68
72
  },
73
+ autofocusDelay: {
74
+ type: Number,
75
+ default: 100
76
+ },
69
77
  resize: {
70
78
  type: Boolean,
71
79
  default: false
@@ -109,12 +117,17 @@ export default defineComponent({
109
117
  ui: {
110
118
  type: Object,
111
119
  default: void 0
120
+ },
121
+ modelModifiers: {
122
+ type: Object,
123
+ default: () => ({})
112
124
  }
113
125
  },
114
126
  emits: ["update:modelValue", "blur"],
115
127
  setup(props, { emit }) {
116
128
  const { ui, attrs } = useUI("textarea", toRef(props, "ui"), config, toRef(props, "class"));
117
129
  const { emitFormBlur, emitFormInput, inputId, color, size, name } = useFormGroup(props, config);
130
+ const modelModifiers = ref(defu({}, props.modelModifiers, { trim: false, lazy: false, number: false }));
118
131
  const textarea2 = ref(null);
119
132
  const autoFocus = () => {
120
133
  if (props.autofocus) {
@@ -139,10 +152,30 @@ export default defineComponent({
139
152
  }
140
153
  }
141
154
  };
155
+ const updateInput = (value) => {
156
+ if (modelModifiers.value.trim) {
157
+ value = value.trim();
158
+ }
159
+ if (modelModifiers.value.number) {
160
+ value = looseToNumber(value);
161
+ }
162
+ emit("update:modelValue", value);
163
+ emitFormInput();
164
+ };
142
165
  const onInput = (event) => {
143
166
  autoResize();
144
- emit("update:modelValue", event.target.value);
145
- emitFormInput();
167
+ if (!modelModifiers.value.lazy) {
168
+ updateInput(event.target.value);
169
+ }
170
+ };
171
+ const onChange = (event) => {
172
+ const value = event.target.value;
173
+ if (modelModifiers.value.lazy) {
174
+ updateInput(value);
175
+ }
176
+ if (modelModifiers.value.trim) {
177
+ event.target.value = value.trim();
178
+ }
146
179
  };
147
180
  const onBlur = (event) => {
148
181
  emit("blur", event);
@@ -151,7 +184,7 @@ export default defineComponent({
151
184
  onMounted(() => {
152
185
  setTimeout(() => {
153
186
  autoFocus();
154
- }, 100);
187
+ }, props.autofocusDelay);
155
188
  });
156
189
  watch(() => props.modelValue, () => {
157
190
  nextTick(autoResize);
@@ -185,6 +218,7 @@ export default defineComponent({
185
218
  // eslint-disable-next-line vue/no-dupe-keys
186
219
  textareaClass,
187
220
  onInput,
221
+ onChange,
188
222
  onBlur
189
223
  };
190
224
  }
@@ -1,4 +1,5 @@
1
1
  import type { PropType } from 'vue';
2
+ import type { TextareaSize, TextareaVariant } from '../../types';
2
3
  declare const _default: import("vue").DefineComponent<{
3
4
  modelValue: {
4
5
  type: (NumberConstructor | StringConstructor)[];
@@ -36,6 +37,10 @@ declare const _default: import("vue").DefineComponent<{
36
37
  type: BooleanConstructor;
37
38
  default: boolean;
38
39
  };
40
+ autofocusDelay: {
41
+ type: NumberConstructor;
42
+ default: number;
43
+ };
39
44
  resize: {
40
45
  type: BooleanConstructor;
41
46
  default: boolean;
@@ -45,7 +50,7 @@ declare const _default: import("vue").DefineComponent<{
45
50
  default: boolean;
46
51
  };
47
52
  size: {
48
- type: PropType<string | number | symbol>;
53
+ type: PropType<TextareaSize>;
49
54
  default: null;
50
55
  validator(value: string): boolean;
51
56
  };
@@ -55,7 +60,7 @@ declare const _default: import("vue").DefineComponent<{
55
60
  validator(value: string): boolean;
56
61
  };
57
62
  variant: {
58
- type: PropType<any>;
63
+ type: PropType<TextareaVariant>;
59
64
  default: () => any;
60
65
  validator(value: string): boolean;
61
66
  };
@@ -71,16 +76,25 @@ declare const _default: import("vue").DefineComponent<{
71
76
  type: PropType<Partial<any>>;
72
77
  default: undefined;
73
78
  };
79
+ modelModifiers: {
80
+ type: PropType<{
81
+ trim?: boolean | undefined;
82
+ lazy?: boolean | undefined;
83
+ number?: boolean | undefined;
84
+ }>;
85
+ default: () => {};
86
+ };
74
87
  }, {
75
88
  ui: import("vue").ComputedRef<any>;
76
89
  attrs: import("vue").ComputedRef<Pick<{
77
90
  [x: string]: unknown;
78
91
  }, string>>;
79
- name: import("vue").ComputedRef<any>;
80
- inputId: import("vue").ComputedRef<any>;
92
+ name: import("vue").ComputedRef<string | undefined>;
93
+ inputId: import("vue").Ref<string | null | undefined>;
81
94
  textarea: import("vue").Ref<HTMLTextAreaElement | null>;
82
95
  textareaClass: import("vue").ComputedRef<string>;
83
96
  onInput: (event: InputEvent) => void;
97
+ onChange: (event: InputEvent) => void;
84
98
  onBlur: (event: FocusEvent) => void;
85
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<{
86
100
  modelValue: {
@@ -119,6 +133,10 @@ declare const _default: import("vue").DefineComponent<{
119
133
  type: BooleanConstructor;
120
134
  default: boolean;
121
135
  };
136
+ autofocusDelay: {
137
+ type: NumberConstructor;
138
+ default: number;
139
+ };
122
140
  resize: {
123
141
  type: BooleanConstructor;
124
142
  default: boolean;
@@ -128,7 +146,7 @@ declare const _default: import("vue").DefineComponent<{
128
146
  default: boolean;
129
147
  };
130
148
  size: {
131
- type: PropType<string | number | symbol>;
149
+ type: PropType<TextareaSize>;
132
150
  default: null;
133
151
  validator(value: string): boolean;
134
152
  };
@@ -138,7 +156,7 @@ declare const _default: import("vue").DefineComponent<{
138
156
  validator(value: string): boolean;
139
157
  };
140
158
  variant: {
141
- type: PropType<any>;
159
+ type: PropType<TextareaVariant>;
142
160
  default: () => any;
143
161
  validator(value: string): boolean;
144
162
  };
@@ -154,25 +172,39 @@ declare const _default: import("vue").DefineComponent<{
154
172
  type: PropType<Partial<any>>;
155
173
  default: undefined;
156
174
  };
175
+ modelModifiers: {
176
+ type: PropType<{
177
+ trim?: boolean | undefined;
178
+ lazy?: boolean | undefined;
179
+ number?: boolean | undefined;
180
+ }>;
181
+ default: () => {};
182
+ };
157
183
  }>> & {
158
184
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
159
185
  onBlur?: ((...args: any[]) => any) | undefined;
160
186
  }, {
161
187
  resize: boolean;
188
+ size: TextareaSize;
189
+ ui: Partial<any>;
162
190
  id: string;
163
191
  color: any;
164
- ui: Partial<any>;
165
192
  name: string;
166
193
  class: any;
167
194
  modelValue: string | number;
168
195
  rows: number;
169
196
  disabled: boolean;
170
- variant: any;
197
+ variant: TextareaVariant;
171
198
  required: boolean;
172
- size: string | number | symbol;
173
199
  placeholder: string;
174
200
  padded: boolean;
175
201
  autofocus: boolean;
202
+ autofocusDelay: number;
203
+ modelModifiers: {
204
+ trim?: boolean | undefined;
205
+ lazy?: boolean | undefined;
206
+ number?: boolean | undefined;
207
+ };
176
208
  autoresize: boolean;
177
209
  textareaClass: string;
178
210
  }, {}>;
@@ -7,7 +7,7 @@
7
7
  :class="switchClass"
8
8
  v-bind="attrs"
9
9
  >
10
- <span :class="[active ? ui.container.active : ui.container.inactive, ui.container.base]">
10
+ <span :class="containerClass">
11
11
  <span v-if="onIcon" :class="[active ? ui.icon.active : ui.icon.inactive, ui.icon.base]" aria-hidden="true">
12
12
  <UIcon :name="onIcon" :class="onIconClass" />
13
13
  </span>
@@ -71,6 +71,13 @@ export default defineComponent({
71
71
  type: [String, Object, Array],
72
72
  default: void 0
73
73
  },
74
+ size: {
75
+ type: String,
76
+ default: config.default.size,
77
+ validator(value) {
78
+ return Object.keys(config.size).includes(value);
79
+ }
80
+ },
74
81
  ui: {
75
82
  type: Object,
76
83
  default: void 0
@@ -92,18 +99,28 @@ export default defineComponent({
92
99
  const switchClass = computed(() => {
93
100
  return twMerge(twJoin(
94
101
  ui.value.base,
102
+ ui.value.size[props.size],
95
103
  ui.value.rounded,
96
104
  ui.value.ring.replaceAll("{color}", color.value),
97
105
  (active.value ? ui.value.active : ui.value.inactive).replaceAll("{color}", color.value)
98
106
  ), props.class);
99
107
  });
108
+ const containerClass = computed(() => {
109
+ return twJoin(
110
+ ui.value.container.base,
111
+ ui.value.container.size[props.size],
112
+ active.value ? ui.value.container.active[props.size] : ui.value.container.inactive
113
+ );
114
+ });
100
115
  const onIconClass = computed(() => {
101
116
  return twJoin(
117
+ ui.value.icon.size[props.size],
102
118
  ui.value.icon.on.replaceAll("{color}", color.value)
103
119
  );
104
120
  });
105
121
  const offIconClass = computed(() => {
106
122
  return twJoin(
123
+ ui.value.icon.size[props.size],
107
124
  ui.value.icon.off.replaceAll("{color}", color.value)
108
125
  );
109
126
  });
@@ -116,6 +133,7 @@ export default defineComponent({
116
133
  inputId,
117
134
  active,
118
135
  switchClass,
136
+ containerClass,
119
137
  onIconClass,
120
138
  offIconClass
121
139
  };
@@ -1,4 +1,5 @@
1
1
  import type { PropType } from 'vue';
2
+ import type { ToggleSize } from '../../types';
2
3
  declare const _default: import("vue").DefineComponent<{
3
4
  id: {
4
5
  type: StringConstructor;
@@ -33,6 +34,11 @@ declare const _default: import("vue").DefineComponent<{
33
34
  type: PropType<any>;
34
35
  default: undefined;
35
36
  };
37
+ size: {
38
+ type: PropType<ToggleSize>;
39
+ default: any;
40
+ validator(value: string): boolean;
41
+ };
36
42
  ui: {
37
43
  type: PropType<Partial<any>>;
38
44
  default: undefined;
@@ -42,10 +48,11 @@ declare const _default: import("vue").DefineComponent<{
42
48
  attrs: import("vue").ComputedRef<Pick<{
43
49
  [x: string]: unknown;
44
50
  }, string>>;
45
- name: import("vue").ComputedRef<any>;
46
- inputId: import("vue").ComputedRef<any>;
51
+ name: import("vue").ComputedRef<string | undefined>;
52
+ inputId: import("vue").Ref<string | null | undefined>;
47
53
  active: import("vue").WritableComputedRef<boolean>;
48
54
  switchClass: import("vue").ComputedRef<string>;
55
+ containerClass: import("vue").ComputedRef<string>;
49
56
  onIconClass: import("vue").ComputedRef<string>;
50
57
  offIconClass: import("vue").ComputedRef<string>;
51
58
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -82,6 +89,11 @@ declare const _default: import("vue").DefineComponent<{
82
89
  type: PropType<any>;
83
90
  default: undefined;
84
91
  };
92
+ size: {
93
+ type: PropType<ToggleSize>;
94
+ default: any;
95
+ validator(value: string): boolean;
96
+ };
85
97
  ui: {
86
98
  type: PropType<Partial<any>>;
87
99
  default: undefined;
@@ -89,9 +101,10 @@ declare const _default: import("vue").DefineComponent<{
89
101
  }>> & {
90
102
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
91
103
  }, {
104
+ size: ToggleSize;
105
+ ui: Partial<any>;
92
106
  id: string;
93
107
  color: any;
94
- ui: Partial<any>;
95
108
  name: string;
96
109
  class: any;
97
110
  modelValue: boolean;
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <div :class="wrapperClass" v-bind="attrs">
3
+ <div :class="borderClass" />
4
+
5
+ <template v-if="label || icon || avatar || $slots.default">
6
+ <div :class="containerClass">
7
+ <slot>
8
+ <span v-if="label" :class="ui.label">
9
+ {{ label }}
10
+ </span>
11
+ <UIcon v-else-if="icon" :name="icon" :class="ui.icon.base" />
12
+ <UAvatar v-else-if="avatar" v-bind="{ size: ui.avatar.size, ...avatar }" :class="ui.avatar.base" />
13
+ </slot>
14
+ </div>
15
+
16
+ <div :class="borderClass" />
17
+ </template>
18
+ </div>
19
+ </template>
20
+
21
+ <script>
22
+ import { toRef, computed, defineComponent } from "vue";
23
+ import { twMerge, twJoin } from "tailwind-merge";
24
+ import UIcon from "../elements/Icon.vue";
25
+ import UAvatar from "../elements/Avatar.vue";
26
+ import { useUI } from "../../composables/useUI";
27
+ import { mergeConfig } from "../../utils";
28
+ import appConfig from "#build/app.config";
29
+ import { divider } from "#ui/ui.config";
30
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.divider, divider);
31
+ export default defineComponent({
32
+ components: {
33
+ UIcon,
34
+ UAvatar
35
+ },
36
+ inheritAttrs: false,
37
+ props: {
38
+ label: {
39
+ type: String,
40
+ default: null
41
+ },
42
+ icon: {
43
+ type: String,
44
+ default: null
45
+ },
46
+ avatar: {
47
+ type: Object,
48
+ default: null
49
+ },
50
+ orientation: {
51
+ type: String,
52
+ default: "horizontal",
53
+ validator: (value) => ["horizontal", "vertical"].includes(value)
54
+ },
55
+ type: {
56
+ type: String,
57
+ default: "solid",
58
+ validator: (value) => ["solid", "dotted", "dashed"].includes(value)
59
+ },
60
+ class: {
61
+ type: [String, Object, Array],
62
+ default: void 0
63
+ },
64
+ ui: {
65
+ type: Object,
66
+ default: void 0
67
+ }
68
+ },
69
+ setup(props) {
70
+ const { ui, attrs } = useUI("divider", toRef(props, "ui"), config);
71
+ const isHorizontal = computed(() => props.orientation === "horizontal");
72
+ const wrapperClass = computed(() => {
73
+ return twMerge(twJoin(
74
+ ui.value.wrapper.base,
75
+ isHorizontal.value ? ui.value.wrapper.horizontal : ui.value.wrapper.vertical
76
+ ), props.class);
77
+ });
78
+ const containerClass = computed(() => {
79
+ return twJoin(
80
+ ui.value.container.base,
81
+ isHorizontal.value ? ui.value.container.horizontal : ui.value.container.vertical
82
+ );
83
+ });
84
+ const borderClass = computed(() => {
85
+ const typeClass = {
86
+ solid: "border-solid",
87
+ dotted: "border-dotted",
88
+ dashed: "border-dashed"
89
+ }[props.type];
90
+ return twJoin(
91
+ ui.value.border.base,
92
+ isHorizontal.value ? ui.value.border.horizontal : ui.value.border.vertical,
93
+ isHorizontal.value ? ui.value.border.size.horizontal : ui.value.border.size.vertical,
94
+ typeClass
95
+ );
96
+ });
97
+ return {
98
+ // eslint-disable-next-line vue/no-dupe-keys
99
+ ui,
100
+ attrs,
101
+ wrapperClass,
102
+ containerClass,
103
+ borderClass
104
+ };
105
+ }
106
+ });
107
+ </script>
@@ -0,0 +1,82 @@
1
+ import type { PropType } from 'vue';
2
+ import type { Avatar } from '../../types';
3
+ declare const _default: import("vue").DefineComponent<{
4
+ label: {
5
+ type: StringConstructor;
6
+ default: null;
7
+ };
8
+ icon: {
9
+ type: StringConstructor;
10
+ default: null;
11
+ };
12
+ avatar: {
13
+ type: PropType<Avatar>;
14
+ default: null;
15
+ };
16
+ orientation: {
17
+ type: PropType<"horizontal" | "vertical">;
18
+ default: string;
19
+ validator: (value: string) => boolean;
20
+ };
21
+ type: {
22
+ type: PropType<"solid" | "dotted" | "dashed">;
23
+ default: string;
24
+ validator: (value: string) => boolean;
25
+ };
26
+ class: {
27
+ type: PropType<any>;
28
+ default: undefined;
29
+ };
30
+ ui: {
31
+ type: PropType<Partial<any>>;
32
+ default: undefined;
33
+ };
34
+ }, {
35
+ ui: import("vue").ComputedRef<any>;
36
+ attrs: import("vue").ComputedRef<Pick<{
37
+ [x: string]: unknown;
38
+ }, string>>;
39
+ wrapperClass: import("vue").ComputedRef<string>;
40
+ containerClass: import("vue").ComputedRef<string>;
41
+ borderClass: import("vue").ComputedRef<string>;
42
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
43
+ label: {
44
+ type: StringConstructor;
45
+ default: null;
46
+ };
47
+ icon: {
48
+ type: StringConstructor;
49
+ default: null;
50
+ };
51
+ avatar: {
52
+ type: PropType<Avatar>;
53
+ default: null;
54
+ };
55
+ orientation: {
56
+ type: PropType<"horizontal" | "vertical">;
57
+ default: string;
58
+ validator: (value: string) => boolean;
59
+ };
60
+ type: {
61
+ type: PropType<"solid" | "dotted" | "dashed">;
62
+ default: string;
63
+ validator: (value: string) => boolean;
64
+ };
65
+ class: {
66
+ type: PropType<any>;
67
+ default: undefined;
68
+ };
69
+ ui: {
70
+ type: PropType<Partial<any>>;
71
+ default: undefined;
72
+ };
73
+ }>>, {
74
+ orientation: "horizontal" | "vertical";
75
+ ui: Partial<any>;
76
+ icon: string;
77
+ avatar: Avatar;
78
+ type: "solid" | "dotted" | "dashed";
79
+ class: any;
80
+ label: string;
81
+ }, {}>;
82
+ export default _default;