@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
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/ui",
3
- "version": "2.9.0",
3
+ "version": "2.11.0",
4
4
  "configKey": "ui",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.0.0-rc.8"
package/dist/module.mjs CHANGED
@@ -3,7 +3,6 @@ import defaultColors from 'tailwindcss/colors.js';
3
3
  import { defaultExtractor as defaultExtractor$1 } from 'tailwindcss/lib/lib/defaultExtractor.js';
4
4
  import { iconsPlugin, getIconCollections } from '@egoist/tailwindcss-icons';
5
5
  import { kebabCase, upperFirst, camelCase } from 'scule';
6
- import { dirname } from 'pathe';
7
6
 
8
7
 
9
8
 
@@ -15,7 +14,7 @@ const __filename = __cjs_url__.fileURLToPath(import.meta.url);
15
14
  const __dirname = __cjs_path__.dirname(__filename);
16
15
  const require = __cjs_mod__.createRequire(import.meta.url);
17
16
  const name = "@nuxt/ui";
18
- const version = "2.9.0";
17
+ const version = "2.11.0";
19
18
 
20
19
  function omit(object, keysToOmit) {
21
20
  const result = { ...object };
@@ -194,6 +193,23 @@ const safelistByComponent = {
194
193
  pattern: new RegExp(`ring-(${colorsAsRegex2})-500`),
195
194
  variants: ["focus-visible"]
196
195
  }],
196
+ progress: (colorsAsRegex2) => [{
197
+ pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
198
+ variants: ["dark"]
199
+ }, {
200
+ pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
201
+ }],
202
+ meter: (colorsAsRegex2) => [{
203
+ pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
204
+ variants: ["dark"]
205
+ }, {
206
+ pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
207
+ }, {
208
+ pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
209
+ variants: ["dark"]
210
+ }, {
211
+ pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
212
+ }],
197
213
  notification: (colorsAsRegex2) => [{
198
214
  pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
199
215
  variants: ["dark"]
@@ -204,12 +220,20 @@ const safelistByComponent = {
204
220
  variants: ["dark"]
205
221
  }, {
206
222
  pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
223
+ }],
224
+ chip: (colorsAsRegex2) => [{
225
+ pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
226
+ variants: ["dark"]
227
+ }, {
228
+ pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
207
229
  }]
208
230
  };
209
231
  const safelistComponentAliasesMap = {
210
232
  "USelect": "UInput",
211
233
  "USelectMenu": "UInput",
212
- "UTextarea": "UInput"
234
+ "UTextarea": "UInput",
235
+ "URadioGroup": "URadio",
236
+ "UMeterGroup": "UMeter"
213
237
  };
214
238
  const colorsAsRegex = (colors) => colors.join("|");
215
239
  const excludeColors = (colors) => {
@@ -271,7 +295,7 @@ function createTemplates(nuxt = useNuxt()) {
271
295
  getContents: () => `declare module '#ui-colors' { const defaultExport: ${JSON.stringify(nuxt.options.appConfig.ui.colors)}; export default defaultExport; }`,
272
296
  write: true
273
297
  });
274
- nuxt.options.alias["#ui-colors"] = dirname(template.dst);
298
+ nuxt.options.alias["#ui-colors"] = template.dst;
275
299
  nuxt.hook("prepare:types", (opts) => {
276
300
  opts.references.push({ path: typesTemplate.dst });
277
301
  });
@@ -350,9 +374,10 @@ const module = defineNuxtModule({
350
374
  tailwindConfig.safelist = tailwindConfig.safelist || [];
351
375
  tailwindConfig.safelist.push(...generateSafelist(options.safelistColors, colors));
352
376
  tailwindConfig.plugins = tailwindConfig.plugins || [];
353
- tailwindConfig.plugins.push(iconsPlugin({ collections: getIconCollections(options.icons) }));
377
+ tailwindConfig.plugins.push(iconsPlugin(Array.isArray(options.icons) || options.icons === "all" ? { collections: getIconCollections(options.icons) } : typeof options.icons === "object" ? options.icons : {}));
354
378
  });
355
379
  createTemplates(nuxt);
380
+ await installModule("nuxt-icon");
356
381
  await installModule("@nuxtjs/color-mode", { classSuffix: "" });
357
382
  await installModule("@nuxtjs/tailwindcss", {
358
383
  exposeConfig: true,
@@ -368,7 +393,7 @@ const module = defineNuxtModule({
368
393
  content: {
369
394
  files: [
370
395
  resolve(runtimeDir, "components/**/*.{vue,mjs,ts}"),
371
- resolve(runtimeDir, "*.{mjs,js,ts}")
396
+ resolve(runtimeDir, "ui.config/**/*.{mjs,js,ts}")
372
397
  ],
373
398
  transform: {
374
399
  vue: (content) => {
@@ -379,6 +404,7 @@ const module = defineNuxtModule({
379
404
  vue: (content) => {
380
405
  return [
381
406
  ...defaultExtractor(content),
407
+ // @ts-ignore
382
408
  ...customSafelistExtractor(options.prefix, content, nuxt.options.appConfig.ui.colors, options.safelistColors)
383
409
  ];
384
410
  }
@@ -146,19 +146,20 @@ export default defineComponent({
146
146
  default: void 0
147
147
  }
148
148
  },
149
- emits: ["update:modelValue"],
149
+ emits: ["update:modelValue", "update:sort"],
150
150
  setup(props, { emit, attrs: $attrs }) {
151
151
  const { ui, attrs } = useUI("table", toRef(props, "ui"), config, toRef(props, "class"));
152
152
  const columns = computed(() => props.columns ?? Object.keys(omit(props.rows[0] ?? {}, ["click"])).map((key) => ({ key, label: upperFirst(key), sortable: false })));
153
153
  const sort = ref(defu({}, props.sort, { column: null, direction: "asc" }));
154
+ const defaultSort = { column: sort.value.column, direction: null };
154
155
  const rows = computed(() => {
155
156
  if (!sort.value?.column) {
156
157
  return props.rows;
157
158
  }
158
159
  const { column, direction } = sort.value;
159
160
  return props.rows.slice().sort((a, b) => {
160
- const aValue = a[column];
161
- const bValue = b[column];
161
+ const aValue = get(a, column);
162
+ const bValue = get(b, column);
162
163
  if (aValue === bValue) {
163
164
  return 0;
164
165
  }
@@ -205,13 +206,14 @@ export default defineComponent({
205
206
  if (sort.value.column === column.key) {
206
207
  const direction = !column.direction || column.direction === "asc" ? "desc" : "asc";
207
208
  if (sort.value.direction === direction) {
208
- sort.value = defu({}, props.sort, { column: null, direction: "asc" });
209
+ sort.value = defu({}, defaultSort, { column: null, direction: "asc" });
209
210
  } else {
210
211
  sort.value.direction = sort.value.direction === "asc" ? "desc" : "asc";
211
212
  }
212
213
  } else {
213
214
  sort.value = { column: column.key, direction: column.direction || "asc" };
214
215
  }
216
+ emit("update:sort", sort.value);
215
217
  }
216
218
  function onSelect(row) {
217
219
  if (!$attrs.onSelect) {
@@ -221,10 +223,10 @@ export default defineComponent({
221
223
  }
222
224
  function selectAllRows() {
223
225
  props.rows.forEach((row) => {
224
- if (selected.value.some((item) => compare(toRaw(item), toRaw(row)))) {
226
+ if (isSelected(row)) {
225
227
  return;
226
228
  }
227
- $attrs.onSelect ? $attrs.onSelect(row) : selected.value.push(row);
229
+ selected.value.push(row);
228
230
  });
229
231
  }
230
232
  function onChange(event) {
@@ -108,7 +108,7 @@ declare const _default: import("vue").DefineComponent<{
108
108
  onSelect: (row: any) => void;
109
109
  onChange: (event: any) => void;
110
110
  getRowData: (row: Object, rowKey: string | string[], defaultValue?: any) => any;
111
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
111
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:sort")[], "update:modelValue" | "update:sort", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
112
112
  modelValue: {
113
113
  type: ArrayConstructor;
114
114
  default: null;
@@ -185,6 +185,7 @@ declare const _default: import("vue").DefineComponent<{
185
185
  };
186
186
  }>> & {
187
187
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
188
+ "onUpdate:sort"?: ((...args: any[]) => any) | undefined;
188
189
  }, {
189
190
  sort: {
190
191
  column: string;
@@ -1,7 +1,14 @@
1
1
  <template>
2
2
  <div :class="ui.wrapper">
3
3
  <HDisclosure v-for="(item, index) in items" v-slot="{ open, close }" :key="index" :default-open="defaultOpen || item.defaultOpen">
4
- <HDisclosureButton :ref="() => buttonRefs[index] = close" as="template" :disabled="item.disabled">
4
+ <HDisclosureButton
5
+ :ref="() => buttonRefs[index] = { open, close }"
6
+ as="template"
7
+ :disabled="item.disabled"
8
+ @click="closeOthers(index, $event)"
9
+ @keydown.enter="closeOthers(index, $event)"
10
+ @keydown.space="closeOthers(index, $event)"
11
+ >
5
12
  <slot :item="item" :index="index" :open="open" :close="close">
6
13
  <UButton v-bind="{ ...omit(ui.default, ['openIcon', 'closeIcon']), ...attrs, ...omit(item, ['slot', 'disabled', 'content', 'defaultOpen']) }">
7
14
  <template #trailing>
@@ -18,8 +25,6 @@
18
25
  </slot>
19
26
  </HDisclosureButton>
20
27
 
21
- <StateEmitter :open="open" @open="closeOthers(index)" />
22
-
23
28
  <Transition
24
29
  v-bind="ui.transition"
25
30
  @enter="onEnter"
@@ -46,7 +51,6 @@ import UIcon from "../elements/Icon.vue";
46
51
  import UButton from "../elements/Button.vue";
47
52
  import { useUI } from "../../composables/useUI";
48
53
  import { mergeConfig, omit } from "../../utils";
49
- import StateEmitter from "../../utils/StateEmitter";
50
54
  import appConfig from "#build/app.config";
51
55
  import { accordion, button } from "#ui/ui.config";
52
56
  const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.accordion, accordion);
@@ -57,8 +61,7 @@ export default defineComponent({
57
61
  HDisclosureButton,
58
62
  HDisclosurePanel,
59
63
  UIcon,
60
- UButton,
61
- StateEmitter
64
+ UButton
62
65
  },
63
66
  inheritAttrs: false,
64
67
  props: {
@@ -95,16 +98,15 @@ export default defineComponent({
95
98
  const { ui, attrs } = useUI("accordion", toRef(props, "ui"), config, toRef(props, "class"));
96
99
  const uiButton = computed(() => configButton);
97
100
  const buttonRefs = ref([]);
98
- function closeOthers(currentIndex) {
101
+ function closeOthers(currentIndex, e) {
99
102
  if (!props.items[currentIndex].closeOthers && props.multiple) {
100
103
  return;
101
104
  }
102
- const totalItems = buttonRefs.value.length;
103
- const order = Array.from({ length: totalItems }, (_, i) => (currentIndex + i) % totalItems).filter((index) => index !== currentIndex).reverse();
104
- for (const index of order) {
105
- const close = buttonRefs.value[index];
106
- close();
107
- }
105
+ buttonRefs.value.forEach((button2) => {
106
+ if (button2.open) {
107
+ button2.close(e.target);
108
+ }
109
+ });
108
110
  }
109
111
  function onEnter(el, done) {
110
112
  el.style.height = "0";
@@ -36,8 +36,11 @@ declare const _default: import("vue").DefineComponent<{
36
36
  attrs: import("vue").ComputedRef<Pick<{
37
37
  [x: string]: unknown;
38
38
  }, string>>;
39
- buttonRefs: import("vue").Ref<Function[]>;
40
- closeOthers: (currentIndex: number) => void;
39
+ buttonRefs: import("vue").Ref<{
40
+ open: boolean;
41
+ close: (e: EventTarget) => {};
42
+ }[]>;
43
+ closeOthers: (currentIndex: number, e: Event) => void;
41
44
  omit: typeof omit;
42
45
  onEnter: (el: HTMLElement, done: any) => void;
43
46
  onBeforeLeave: (el: HTMLElement) => void;
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div :class="alertClass" v-bind="attrs">
3
- <div class="flex gap-3" :class="{ 'items-start': (description || $slots.description), 'items-center': !description && !$slots.description }">
3
+ <div class="flex" :class="[ui.gap, { 'items-start': (description || $slots.description), 'items-center': !description && !$slots.description }]">
4
4
  <UIcon v-if="icon" :name="icon" :class="ui.icon.base" />
5
5
  <UAvatar v-if="avatar" v-bind="{ size: ui.avatar.size, ...avatar }" :class="ui.avatar.base" />
6
6
 
@@ -16,14 +16,14 @@
16
16
  </slot>
17
17
  </p>
18
18
 
19
- <div v-if="(description || $slots.description) && actions.length" class="mt-3 flex items-center gap-2">
19
+ <div v-if="(description || $slots.description) && actions.length" :class="ui.actions">
20
20
  <UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...ui.default.actionButton, ...action }" @click.stop="action.click" />
21
21
  </div>
22
22
  </div>
23
- <div class="flex-shrink-0 flex items-center gap-3">
24
- <div v-if="!description && !$slots.description && actions.length" class="flex items-center gap-2">
23
+ <div v-if="closeButton || (!description && !$slots.description && actions.length)" :class="twMerge(ui.actions, 'mt-0')">
24
+ <template v-if="!description && !$slots.description && actions.length">
25
25
  <UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...ui.default.actionButton, ...action }" @click.stop="action.click" />
26
- </div>
26
+ </template>
27
27
 
28
28
  <UButton v-if="closeButton" aria-label="Close" v-bind="{ ...ui.default.closeButton, ...closeButton }" @click.stop="$emit('close')" />
29
29
  </div>
@@ -117,7 +117,8 @@ export default defineComponent({
117
117
  // eslint-disable-next-line vue/no-dupe-keys
118
118
  ui,
119
119
  attrs,
120
- alertClass
120
+ alertClass,
121
+ twMerge
121
122
  };
122
123
  }
123
124
  });
@@ -1,5 +1,5 @@
1
1
  import type { PropType } from 'vue';
2
- import type { Avatar, Button } from '../../types';
2
+ import type { Avatar, Button, AlertVariant } from '../../types';
3
3
  declare const _default: import("vue").DefineComponent<{
4
4
  title: {
5
5
  type: StringConstructor;
@@ -33,7 +33,7 @@ declare const _default: import("vue").DefineComponent<{
33
33
  validator(value: string): boolean;
34
34
  };
35
35
  variant: {
36
- type: PropType<any>;
36
+ type: PropType<AlertVariant>;
37
37
  default: () => any;
38
38
  validator(value: string): boolean;
39
39
  };
@@ -51,6 +51,7 @@ declare const _default: import("vue").DefineComponent<{
51
51
  [x: string]: unknown;
52
52
  }, string>>;
53
53
  alertClass: import("vue").ComputedRef<string>;
54
+ twMerge: (...classLists: import("tailwind-merge").ClassNameValue[]) => string;
54
55
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "close"[], "close", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
55
56
  title: {
56
57
  type: StringConstructor;
@@ -84,7 +85,7 @@ declare const _default: import("vue").DefineComponent<{
84
85
  validator(value: string): boolean;
85
86
  };
86
87
  variant: {
87
- type: PropType<any>;
88
+ type: PropType<AlertVariant>;
88
89
  default: () => any;
89
90
  validator(value: string): boolean;
90
91
  };
@@ -99,6 +100,7 @@ declare const _default: import("vue").DefineComponent<{
99
100
  }>> & {
100
101
  onClose?: ((...args: any[]) => any) | undefined;
101
102
  }, {
103
+ ui: Partial<any>;
102
104
  description: string;
103
105
  icon: string;
104
106
  avatar: Avatar;
@@ -107,8 +109,7 @@ declare const _default: import("vue").DefineComponent<{
107
109
  click?: Function | undefined;
108
110
  })[];
109
111
  color: any;
110
- ui: Partial<any>;
111
112
  class: any;
112
- variant: any;
113
+ variant: AlertVariant;
113
114
  }, {}>;
114
115
  export default _default;
@@ -1,4 +1,5 @@
1
1
  import type { PropType } from 'vue';
2
+ import type { AvatarSize } from '../../types';
2
3
  declare const _default: import("vue").DefineComponent<{
3
4
  src: {
4
5
  type: (BooleanConstructor | StringConstructor)[];
@@ -17,7 +18,7 @@ declare const _default: import("vue").DefineComponent<{
17
18
  default: () => any;
18
19
  };
19
20
  size: {
20
- type: PropType<"sm" | "3xs" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl" | "3xl">;
21
+ type: PropType<AvatarSize>;
21
22
  default: () => any;
22
23
  validator(value: string): boolean;
23
24
  };
@@ -78,7 +79,7 @@ declare const _default: import("vue").DefineComponent<{
78
79
  default: () => any;
79
80
  };
80
81
  size: {
81
- type: PropType<"sm" | "3xs" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl" | "3xl">;
82
+ type: PropType<AvatarSize>;
82
83
  default: () => any;
83
84
  validator(value: string): boolean;
84
85
  };
@@ -110,12 +111,12 @@ declare const _default: import("vue").DefineComponent<{
110
111
  };
111
112
  }>>, {
112
113
  alt: string;
113
- icon: string;
114
+ size: AvatarSize;
114
115
  ui: Partial<any>;
116
+ icon: string;
115
117
  class: any;
116
118
  src: string | boolean;
117
119
  text: string;
118
- size: "sm" | "3xs" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl" | "3xl";
119
120
  chipColor: any;
120
121
  chipPosition: "top-right" | "bottom-right" | "top-left" | "bottom-left";
121
122
  chipText: string | number;
@@ -1,7 +1,8 @@
1
1
  import type { PropType } from 'vue';
2
+ import type { AvatarSize } from '../../types';
2
3
  declare const _default: import("vue").DefineComponent<{
3
4
  size: {
4
- type: PropType<string | number | symbol>;
5
+ type: PropType<AvatarSize>;
5
6
  default: null;
6
7
  validator(value: string): boolean;
7
8
  };
@@ -21,7 +22,7 @@ declare const _default: import("vue").DefineComponent<{
21
22
  [key: string]: any;
22
23
  }>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
23
24
  size: {
24
- type: PropType<string | number | symbol>;
25
+ type: PropType<AvatarSize>;
25
26
  default: null;
26
27
  validator(value: string): boolean;
27
28
  };
@@ -38,9 +39,9 @@ declare const _default: import("vue").DefineComponent<{
38
39
  default: undefined;
39
40
  };
40
41
  }>>, {
42
+ size: AvatarSize;
41
43
  ui: Partial<any>;
42
44
  class: any;
43
- size: string | number | symbol;
44
45
  max: number;
45
46
  }, {}>;
46
47
  export default _default;
@@ -9,6 +9,7 @@ import { computed, toRef, defineComponent } from "vue";
9
9
  import { twMerge, twJoin } from "tailwind-merge";
10
10
  import { useUI } from "../../composables/useUI";
11
11
  import { mergeConfig } from "../../utils";
12
+ import { useInjectButtonGroup } from "../../composables/useButtonGroup";
12
13
  import appConfig from "#build/app.config";
13
14
  import { badge } from "#ui/ui.config";
14
15
  const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.badge, badge);
@@ -54,13 +55,14 @@ export default defineComponent({
54
55
  },
55
56
  setup(props) {
56
57
  const { ui, attrs } = useUI("badge", toRef(props, "ui"), config);
58
+ const { size, rounded } = useInjectButtonGroup({ ui, props });
57
59
  const badgeClass = computed(() => {
58
60
  const variant = ui.value.color?.[props.color]?.[props.variant] || ui.value.variant[props.variant];
59
61
  return twMerge(twJoin(
60
62
  ui.value.base,
61
63
  ui.value.font,
62
- ui.value.rounded,
63
- ui.value.size[props.size],
64
+ rounded.value,
65
+ ui.value.size[size.value],
64
66
  variant?.replaceAll("{color}", props.color)
65
67
  ), props.class);
66
68
  });
@@ -1,8 +1,8 @@
1
1
  import type { PropType } from 'vue';
2
- import type { BadgeVariant } from '../../types';
2
+ import type { BadgeSize, BadgeVariant } from '../../types';
3
3
  declare const _default: import("vue").DefineComponent<{
4
4
  size: {
5
- type: PropType<"sm" | "md" | "xs" | "lg">;
5
+ type: PropType<BadgeSize>;
6
6
  default: () => any;
7
7
  validator(value: string): boolean;
8
8
  };
@@ -35,7 +35,7 @@ declare const _default: import("vue").DefineComponent<{
35
35
  badgeClass: import("vue").ComputedRef<string>;
36
36
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
37
37
  size: {
38
- type: PropType<"sm" | "md" | "xs" | "lg">;
38
+ type: PropType<BadgeSize>;
39
39
  default: () => any;
40
40
  validator(value: string): boolean;
41
41
  };
@@ -62,11 +62,11 @@ declare const _default: import("vue").DefineComponent<{
62
62
  default: undefined;
63
63
  };
64
64
  }>>, {
65
- color: any;
65
+ size: BadgeSize;
66
66
  ui: Partial<any>;
67
+ color: any;
67
68
  class: any;
68
69
  label: string | number;
69
70
  variant: BadgeVariant;
70
- size: "sm" | "md" | "xs" | "lg";
71
71
  }, {}>;
72
72
  export default _default;
@@ -23,6 +23,7 @@ import UIcon from "../elements/Icon.vue";
23
23
  import ULink from "../elements/Link.vue";
24
24
  import { useUI } from "../../composables/useUI";
25
25
  import { mergeConfig } from "../../utils";
26
+ import { useInjectButtonGroup } from "../../composables/useButtonGroup";
26
27
  import appConfig from "#build/app.config";
27
28
  import { button } from "#ui/ui.config";
28
29
  const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.button, button);
@@ -124,6 +125,7 @@ export default defineComponent({
124
125
  },
125
126
  setup(props, { slots }) {
126
127
  const { ui, attrs } = useUI("button", toRef(props, "ui"), config);
128
+ const { size, rounded } = useInjectButtonGroup({ ui, props });
127
129
  const isLeading = computed(() => {
128
130
  return props.icon && props.leading || props.icon && !props.trailing || props.loading && !props.trailing || props.leadingIcon;
129
131
  });
@@ -136,10 +138,10 @@ export default defineComponent({
136
138
  return twMerge(twJoin(
137
139
  ui.value.base,
138
140
  ui.value.font,
139
- ui.value.rounded,
140
- ui.value.size[props.size],
141
- ui.value.gap[props.size],
142
- props.padded && ui.value[isSquare.value ? "square" : "padding"][props.size],
141
+ rounded.value,
142
+ ui.value.size[size.value],
143
+ ui.value.gap[size.value],
144
+ props.padded && ui.value[isSquare.value ? "square" : "padding"][size.value],
143
145
  variant?.replaceAll("{color}", props.color),
144
146
  props.block ? "w-full flex justify-center items-center" : "inline-flex items-center"
145
147
  ), props.class);
@@ -159,14 +161,14 @@ export default defineComponent({
159
161
  const leadingIconClass = computed(() => {
160
162
  return twJoin(
161
163
  ui.value.icon.base,
162
- ui.value.icon.size[props.size],
164
+ ui.value.icon.size[size.value],
163
165
  props.loading && "animate-spin"
164
166
  );
165
167
  });
166
168
  const trailingIconClass = computed(() => {
167
169
  return twJoin(
168
170
  ui.value.icon.base,
169
- ui.value.icon.size[props.size],
171
+ ui.value.icon.size[size.value],
170
172
  props.loading && !isLeading.value && "animate-spin"
171
173
  );
172
174
  });
@@ -1,5 +1,5 @@
1
1
  import type { PropType } from 'vue';
2
- import type { ButtonVariant } from '../../types';
2
+ import type { ButtonSize, ButtonVariant } from '../../types';
3
3
  declare const _default: import("vue").DefineComponent<{
4
4
  type: {
5
5
  type: StringConstructor;
@@ -26,7 +26,7 @@ declare const _default: import("vue").DefineComponent<{
26
26
  default: boolean;
27
27
  };
28
28
  size: {
29
- type: PropType<"sm" | "md" | "xs" | "2xs" | "lg" | "xl">;
29
+ type: PropType<ButtonSize>;
30
30
  default: () => any;
31
31
  validator(value: string): boolean;
32
32
  };
@@ -118,7 +118,7 @@ declare const _default: import("vue").DefineComponent<{
118
118
  default: boolean;
119
119
  };
120
120
  size: {
121
- type: PropType<"sm" | "md" | "xs" | "2xs" | "lg" | "xl">;
121
+ type: PropType<ButtonSize>;
122
122
  default: () => any;
123
123
  validator(value: string): boolean;
124
124
  };
@@ -173,16 +173,17 @@ declare const _default: import("vue").DefineComponent<{
173
173
  default: undefined;
174
174
  };
175
175
  }>>, {
176
+ size: ButtonSize;
177
+ ui: Partial<any>;
178
+ truncate: boolean;
176
179
  icon: string;
177
180
  color: any;
178
- ui: Partial<any>;
181
+ type: string;
179
182
  class: any;
180
183
  label: string;
181
- type: string;
182
184
  loading: boolean;
183
185
  disabled: boolean;
184
186
  variant: ButtonVariant;
185
- size: "sm" | "md" | "xs" | "2xs" | "lg" | "xl";
186
187
  block: boolean;
187
188
  padded: boolean;
188
189
  loadingIcon: string;
@@ -191,6 +192,5 @@ declare const _default: import("vue").DefineComponent<{
191
192
  trailing: boolean;
192
193
  leading: boolean;
193
194
  square: boolean;
194
- truncate: boolean;
195
195
  }, {}>;
196
196
  export default _default;
@@ -1,7 +1,8 @@
1
1
  import type { PropType } from 'vue';
2
+ import type { ButtonSize } from '../../types';
2
3
  declare const _default: import("vue").DefineComponent<{
3
4
  size: {
4
- type: PropType<"sm" | "md" | "xs" | "2xs" | "lg" | "xl">;
5
+ type: PropType<ButtonSize>;
5
6
  default: null;
6
7
  validator(value: string): boolean;
7
8
  };
@@ -22,7 +23,7 @@ declare const _default: import("vue").DefineComponent<{
22
23
  [key: string]: any;
23
24
  }>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
24
25
  size: {
25
- type: PropType<"sm" | "md" | "xs" | "2xs" | "lg" | "xl">;
26
+ type: PropType<ButtonSize>;
26
27
  default: null;
27
28
  validator(value: string): boolean;
28
29
  };
@@ -40,9 +41,9 @@ declare const _default: import("vue").DefineComponent<{
40
41
  default: undefined;
41
42
  };
42
43
  }>>, {
44
+ orientation: "horizontal" | "vertical";
45
+ size: ButtonSize;
43
46
  ui: Partial<any>;
44
47
  class: any;
45
- size: "sm" | "md" | "xs" | "2xs" | "lg" | "xl";
46
- orientation: "horizontal" | "vertical";
47
48
  }, {}>;
48
49
  export default _default;