@nuxt/ui 2.11.0 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/dist/module.d.mts +294 -48
  2. package/dist/module.d.ts +294 -48
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +6 -4
  5. package/dist/runtime/components/data/Table.vue +29 -21
  6. package/dist/runtime/components/data/Table.vue.d.ts +28 -19
  7. package/dist/runtime/components/elements/Accordion.vue +10 -6
  8. package/dist/runtime/components/elements/Accordion.vue.d.ts +11 -11
  9. package/dist/runtime/components/elements/Alert.vue +12 -6
  10. package/dist/runtime/components/elements/Alert.vue.d.ts +12 -17
  11. package/dist/runtime/components/elements/Avatar.vue +2 -2
  12. package/dist/runtime/components/elements/Avatar.vue.d.ts +7 -7
  13. package/dist/runtime/components/elements/AvatarGroup.d.ts +7 -7
  14. package/dist/runtime/components/elements/AvatarGroup.mjs +2 -2
  15. package/dist/runtime/components/elements/Badge.vue +2 -2
  16. package/dist/runtime/components/elements/Badge.vue.d.ts +7 -7
  17. package/dist/runtime/components/elements/Button.vue +8 -6
  18. package/dist/runtime/components/elements/Button.vue.d.ts +9 -8
  19. package/dist/runtime/components/elements/ButtonGroup.d.ts +7 -7
  20. package/dist/runtime/components/elements/ButtonGroup.mjs +3 -16
  21. package/dist/runtime/components/elements/Chip.vue +2 -2
  22. package/dist/runtime/components/elements/Chip.vue.d.ts +9 -9
  23. package/dist/runtime/components/elements/Dropdown.vue +68 -19
  24. package/dist/runtime/components/elements/Dropdown.vue.d.ts +37 -9
  25. package/dist/runtime/components/elements/Kbd.vue +2 -2
  26. package/dist/runtime/components/elements/Kbd.vue.d.ts +7 -7
  27. package/dist/runtime/components/elements/Link.vue +2 -2
  28. package/dist/runtime/components/elements/Meter.vue +2 -2
  29. package/dist/runtime/components/elements/Meter.vue.d.ts +7 -7
  30. package/dist/runtime/components/elements/MeterGroup.d.ts +9 -9
  31. package/dist/runtime/components/elements/MeterGroup.mjs +8 -21
  32. package/dist/runtime/components/elements/Progress.vue +5 -94
  33. package/dist/runtime/components/elements/Progress.vue.d.ts +123 -1
  34. package/dist/runtime/components/forms/Checkbox.vue +7 -7
  35. package/dist/runtime/components/forms/Checkbox.vue.d.ts +8 -8
  36. package/dist/runtime/components/forms/Form.vue +17 -8
  37. package/dist/runtime/components/forms/Form.vue.d.ts +1 -1
  38. package/dist/runtime/components/forms/FormGroup.vue +2 -2
  39. package/dist/runtime/components/forms/FormGroup.vue.d.ts +7 -7
  40. package/dist/runtime/components/forms/Input.vue +8 -8
  41. package/dist/runtime/components/forms/Input.vue.d.ts +11 -11
  42. package/dist/runtime/components/forms/InputMenu.vue +410 -0
  43. package/dist/runtime/components/forms/InputMenu.vue.d.ts +331 -0
  44. package/dist/runtime/components/forms/Radio.vue +7 -7
  45. package/dist/runtime/components/forms/Radio.vue.d.ts +7 -7
  46. package/dist/runtime/components/forms/RadioGroup.vue +5 -5
  47. package/dist/runtime/components/forms/RadioGroup.vue.d.ts +13 -13
  48. package/dist/runtime/components/forms/Range.vue +5 -5
  49. package/dist/runtime/components/forms/Range.vue.d.ts +8 -8
  50. package/dist/runtime/components/forms/Select.vue +8 -8
  51. package/dist/runtime/components/forms/Select.vue.d.ts +10 -10
  52. package/dist/runtime/components/forms/SelectMenu.vue +69 -36
  53. package/dist/runtime/components/forms/SelectMenu.vue.d.ts +40 -20
  54. package/dist/runtime/components/forms/Textarea.vue +3 -3
  55. package/dist/runtime/components/forms/Textarea.vue.d.ts +10 -10
  56. package/dist/runtime/components/forms/Toggle.vue +10 -10
  57. package/dist/runtime/components/forms/Toggle.vue.d.ts +16 -15
  58. package/dist/runtime/components/layout/Card.vue +2 -2
  59. package/dist/runtime/components/layout/Card.vue.d.ts +7 -7
  60. package/dist/runtime/components/layout/Container.vue +2 -2
  61. package/dist/runtime/components/layout/Container.vue.d.ts +7 -7
  62. package/dist/runtime/components/layout/Divider.vue +3 -8
  63. package/dist/runtime/components/layout/Divider.vue.d.ts +7 -7
  64. package/dist/runtime/components/layout/Skeleton.vue +2 -2
  65. package/dist/runtime/components/layout/Skeleton.vue.d.ts +7 -7
  66. package/dist/runtime/components/navigation/Breadcrumb.vue +9 -6
  67. package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +10 -7
  68. package/dist/runtime/components/navigation/CommandPalette.vue +42 -33
  69. package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +16 -9
  70. package/dist/runtime/components/navigation/CommandPaletteGroup.vue +1 -3
  71. package/dist/runtime/components/navigation/Pagination.vue +16 -11
  72. package/dist/runtime/components/navigation/Pagination.vue.d.ts +16 -7
  73. package/dist/runtime/components/navigation/Tabs.vue +8 -5
  74. package/dist/runtime/components/navigation/Tabs.vue.d.ts +9 -9
  75. package/dist/runtime/components/navigation/VerticalNavigation.vue +56 -39
  76. package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +14 -10
  77. package/dist/runtime/components/overlays/ContextMenu.vue +4 -3
  78. package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +7 -7
  79. package/dist/runtime/components/overlays/Modal.vue +3 -6
  80. package/dist/runtime/components/overlays/Modal.vue.d.ts +8 -8
  81. package/dist/runtime/components/overlays/Notification.vue +7 -7
  82. package/dist/runtime/components/overlays/Notification.vue.d.ts +7 -7
  83. package/dist/runtime/components/overlays/Notifications.vue +2 -2
  84. package/dist/runtime/components/overlays/Notifications.vue.d.ts +7 -7
  85. package/dist/runtime/components/overlays/Popover.vue +54 -17
  86. package/dist/runtime/components/overlays/Popover.vue.d.ts +21 -11
  87. package/dist/runtime/components/overlays/Slideover.vue +6 -6
  88. package/dist/runtime/components/overlays/Slideover.vue.d.ts +8 -8
  89. package/dist/runtime/components/overlays/Tooltip.vue +6 -5
  90. package/dist/runtime/components/overlays/Tooltip.vue.d.ts +7 -7
  91. package/dist/runtime/composables/useFormGroup.d.ts +3 -3
  92. package/dist/runtime/composables/useFormGroup.mjs +1 -1
  93. package/dist/runtime/composables/useShortcuts.mjs +3 -1
  94. package/dist/runtime/composables/useUI.d.ts +3 -3
  95. package/dist/runtime/types/alert.d.ts +5 -0
  96. package/dist/runtime/types/breadcrumb.d.ts +3 -0
  97. package/dist/runtime/types/dropdown.d.ts +2 -0
  98. package/dist/runtime/types/form.d.ts +2 -1
  99. package/dist/runtime/types/popper.d.ts +2 -0
  100. package/dist/runtime/types/utils.d.ts +4 -4
  101. package/dist/runtime/types/vertical-navigation.d.ts +1 -0
  102. package/dist/runtime/ui.config/data/table.d.ts +2 -2
  103. package/dist/runtime/ui.config/elements/accordion.d.ts +1 -1
  104. package/dist/runtime/ui.config/elements/alert.d.ts +5 -4
  105. package/dist/runtime/ui.config/elements/alert.mjs +1 -0
  106. package/dist/runtime/ui.config/elements/button.d.ts +4 -0
  107. package/dist/runtime/ui.config/elements/button.mjs +4 -0
  108. package/dist/runtime/ui.config/elements/buttonGroup.d.ts +92 -0
  109. package/dist/runtime/ui.config/elements/buttonGroup.mjs +12 -1
  110. package/dist/runtime/ui.config/elements/dropdown.d.ts +3 -1
  111. package/dist/runtime/ui.config/elements/dropdown.mjs +4 -2
  112. package/dist/runtime/ui.config/elements/meterGroup.d.ts +40 -0
  113. package/dist/runtime/ui.config/elements/meterGroup.mjs +14 -1
  114. package/dist/runtime/ui.config/forms/checkbox.d.ts +3 -0
  115. package/dist/runtime/ui.config/forms/checkbox.mjs +3 -0
  116. package/dist/runtime/ui.config/forms/input.d.ts +2 -0
  117. package/dist/runtime/ui.config/forms/input.mjs +14 -12
  118. package/dist/runtime/ui.config/forms/inputMenu.d.ts +64 -0
  119. package/dist/runtime/ui.config/forms/inputMenu.mjs +62 -0
  120. package/dist/runtime/ui.config/forms/radio.d.ts +3 -0
  121. package/dist/runtime/ui.config/forms/radio.mjs +3 -0
  122. package/dist/runtime/ui.config/forms/select.d.ts +2 -0
  123. package/dist/runtime/ui.config/forms/select.mjs +1 -0
  124. package/dist/runtime/ui.config/forms/selectMenu.d.ts +18 -11
  125. package/dist/runtime/ui.config/forms/selectMenu.mjs +12 -41
  126. package/dist/runtime/ui.config/forms/textarea.d.ts +2 -0
  127. package/dist/runtime/ui.config/forms/textarea.mjs +1 -0
  128. package/dist/runtime/ui.config/index.d.ts +1 -0
  129. package/dist/runtime/ui.config/index.mjs +1 -0
  130. package/dist/runtime/ui.config/layout/card.mjs +1 -1
  131. package/dist/runtime/ui.config/layout/divider.d.ts +6 -1
  132. package/dist/runtime/ui.config/layout/divider.mjs +5 -0
  133. package/dist/runtime/ui.config/navigation/breadcrumb.d.ts +1 -0
  134. package/dist/runtime/ui.config/navigation/breadcrumb.mjs +2 -1
  135. package/dist/runtime/ui.config/navigation/commandPalette.d.ts +5 -1
  136. package/dist/runtime/ui.config/navigation/commandPalette.mjs +5 -1
  137. package/dist/runtime/ui.config/navigation/pagination.d.ts +6 -6
  138. package/dist/runtime/ui.config/navigation/verticalNavigation.d.ts +6 -1
  139. package/dist/runtime/ui.config/navigation/verticalNavigation.mjs +5 -0
  140. package/dist/runtime/ui.config/overlays/contextMenu.mjs +1 -1
  141. package/dist/runtime/ui.config/overlays/modal.d.ts +1 -0
  142. package/dist/runtime/ui.config/overlays/modal.mjs +3 -2
  143. package/dist/runtime/ui.config/overlays/notification.d.ts +5 -4
  144. package/dist/runtime/ui.config/overlays/notification.mjs +1 -0
  145. package/dist/runtime/ui.config/overlays/popover.d.ts +1 -0
  146. package/dist/runtime/ui.config/overlays/popover.mjs +2 -1
  147. package/dist/runtime/ui.config/overlays/slideover.d.ts +5 -0
  148. package/dist/runtime/ui.config/overlays/slideover.mjs +5 -0
  149. package/dist/runtime/ui.config/overlays/tooltip.d.ts +1 -0
  150. package/dist/runtime/ui.config/overlays/tooltip.mjs +2 -1
  151. package/dist/runtime/ui.config/{_popperArrow.d.ts → popper.d.ts} +1 -2
  152. package/dist/runtime/ui.config/popper.mjs +9 -0
  153. package/dist/runtime/ui.css +1 -13
  154. package/dist/runtime/utils/index.mjs +11 -3
  155. package/dist/runtime/utils/uid.mjs +2 -1
  156. package/dist/types.d.mts +2 -2
  157. package/dist/types.d.ts +1 -1
  158. package/package.json +29 -28
  159. package/dist/runtime/ui.config/_popperArrow.mjs +0 -8
package/dist/module.mjs CHANGED
@@ -14,7 +14,7 @@ const __filename = __cjs_url__.fileURLToPath(import.meta.url);
14
14
  const __dirname = __cjs_path__.dirname(__filename);
15
15
  const require = __cjs_mod__.createRequire(import.meta.url);
16
16
  const name = "@nuxt/ui";
17
- const version = "2.11.0";
17
+ const version = "2.12.0";
18
18
 
19
19
  function omit(object, keysToOmit) {
20
20
  const result = { ...object };
@@ -329,11 +329,13 @@ const module = defineNuxtModule({
329
329
  nuxt.options.alias["#ui"] = runtimeDir;
330
330
  nuxt.options.css.push(resolve(runtimeDir, "ui.css"));
331
331
  nuxt.hook("tailwindcss:config", function(tailwindConfig) {
332
+ tailwindConfig.theme = tailwindConfig.theme || {};
333
+ tailwindConfig.theme.extend = tailwindConfig.theme.extend || {};
334
+ tailwindConfig.theme.extend.colors = tailwindConfig.theme.extend.colors || {};
332
335
  const globalColors = {
333
336
  ...tailwindConfig.theme.colors || defaultColors,
334
337
  ...tailwindConfig.theme.extend?.colors
335
338
  };
336
- tailwindConfig.theme.extend.colors = tailwindConfig.theme.extend.colors || {};
337
339
  globalColors.primary = tailwindConfig.theme.extend.colors.primary = {
338
340
  50: "rgb(var(--color-primary-50) / <alpha-value>)",
339
341
  100: "rgb(var(--color-primary-100) / <alpha-value>)",
@@ -372,9 +374,9 @@ const module = defineNuxtModule({
372
374
  strategy: "merge"
373
375
  };
374
376
  tailwindConfig.safelist = tailwindConfig.safelist || [];
375
- tailwindConfig.safelist.push(...generateSafelist(options.safelistColors, colors));
377
+ tailwindConfig.safelist.push(...generateSafelist(options.safelistColors || [], colors));
376
378
  tailwindConfig.plugins = tailwindConfig.plugins || [];
377
- tailwindConfig.plugins.push(iconsPlugin(Array.isArray(options.icons) || options.icons === "all" ? { collections: getIconCollections(options.icons) } : typeof options.icons === "object" ? options.icons : {}));
379
+ tailwindConfig.plugins.push(iconsPlugin(Array.isArray(options.icons) ? { collections: getIconCollections(options.icons) } : typeof options.icons === "object" ? options.icons : {}));
378
380
  });
379
381
  createTemplates(nuxt);
380
382
  await installModule("nuxt-icon");
@@ -11,7 +11,7 @@
11
11
  <slot :name="`${column.key}-header`" :column="column" :sort="sort" :on-sort="onSort">
12
12
  <UButton
13
13
  v-if="column.sortable"
14
- v-bind="{ ...ui.default.sortButton, ...sortButton }"
14
+ v-bind="{ ...(ui.default.sortButton || {}), ...sortButton }"
15
15
  :icon="(!sort.column || sort.column !== column.key) ? (sortButton.icon || ui.default.sortButton.icon) : sort.direction === 'asc' ? sortAscIcon : sortDescIcon"
16
16
  :label="column[columnAttribute]"
17
17
  @click="onSort(column)"
@@ -67,20 +67,31 @@
67
67
  </template>
68
68
 
69
69
  <script>
70
- import { ref, computed, defineComponent, toRaw, toRef } from "vue";
70
+ import { computed, defineComponent, toRaw, toRef } from "vue";
71
71
  import { upperFirst } from "scule";
72
72
  import { defu } from "defu";
73
+ import { useVModel } from "@vueuse/core";
73
74
  import UButton from "../elements/Button.vue";
74
75
  import UIcon from "../elements/Icon.vue";
75
76
  import UCheckbox from "../forms/Checkbox.vue";
76
77
  import { useUI } from "../../composables/useUI";
77
- import { mergeConfig, omit, get } from "../../utils";
78
+ import { mergeConfig, get } from "../../utils";
78
79
  import appConfig from "#build/app.config";
79
80
  import { table } from "#ui/ui.config";
80
81
  const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.table, table);
81
82
  function defaultComparator(a, z) {
82
83
  return a === z;
83
84
  }
85
+ function defaultSort(a, b, direction) {
86
+ if (a === b) {
87
+ return 0;
88
+ }
89
+ if (direction === "asc") {
90
+ return a < b ? -1 : 1;
91
+ } else {
92
+ return a > b ? -1 : 1;
93
+ }
94
+ }
84
95
  export default defineComponent({
85
96
  components: {
86
97
  UButton,
@@ -113,6 +124,10 @@ export default defineComponent({
113
124
  type: Object,
114
125
  default: () => ({})
115
126
  },
127
+ sortMode: {
128
+ type: String,
129
+ default: "auto"
130
+ },
116
131
  sortButton: {
117
132
  type: Object,
118
133
  default: () => config.default.sortButton
@@ -139,35 +154,29 @@ export default defineComponent({
139
154
  },
140
155
  class: {
141
156
  type: [String, Object, Array],
142
- default: void 0
157
+ default: () => ""
143
158
  },
144
159
  ui: {
145
160
  type: Object,
146
- default: void 0
161
+ default: () => ({})
147
162
  }
148
163
  },
149
164
  emits: ["update:modelValue", "update:sort"],
150
165
  setup(props, { emit, attrs: $attrs }) {
151
166
  const { ui, attrs } = useUI("table", toRef(props, "ui"), config, toRef(props, "class"));
152
- const columns = computed(() => props.columns ?? Object.keys(omit(props.rows[0] ?? {}, ["click"])).map((key) => ({ key, label: upperFirst(key), sortable: false })));
153
- const sort = ref(defu({}, props.sort, { column: null, direction: "asc" }));
154
- const defaultSort = { column: sort.value.column, direction: null };
167
+ const columns = computed(() => props.columns ?? Object.keys(props.rows[0] ?? {}).map((key) => ({ key, label: upperFirst(key), sortable: false, class: void 0, sort: defaultSort })));
168
+ const sort = useVModel(props, "sort", emit, { passive: true, defaultValue: defu({}, props.sort, { column: null, direction: "asc" }) });
169
+ const savedSort = { column: sort.value.column, direction: null };
155
170
  const rows = computed(() => {
156
- if (!sort.value?.column) {
171
+ if (!sort.value?.column || props.sortMode === "manual") {
157
172
  return props.rows;
158
173
  }
159
174
  const { column, direction } = sort.value;
160
175
  return props.rows.slice().sort((a, b) => {
161
176
  const aValue = get(a, column);
162
177
  const bValue = get(b, column);
163
- if (aValue === bValue) {
164
- return 0;
165
- }
166
- if (direction === "asc") {
167
- return aValue < bValue ? -1 : 1;
168
- } else {
169
- return aValue > bValue ? -1 : 1;
170
- }
178
+ const sort2 = columns.value.find((col) => col.key === column)?.sort ?? defaultSort;
179
+ return sort2(aValue, bValue, direction);
171
180
  });
172
181
  });
173
182
  const selected = computed({
@@ -206,14 +215,13 @@ export default defineComponent({
206
215
  if (sort.value.column === column.key) {
207
216
  const direction = !column.direction || column.direction === "asc" ? "desc" : "asc";
208
217
  if (sort.value.direction === direction) {
209
- sort.value = defu({}, defaultSort, { column: null, direction: "asc" });
218
+ sort.value = defu({}, savedSort, { column: null, direction: "asc" });
210
219
  } else {
211
- sort.value.direction = sort.value.direction === "asc" ? "desc" : "asc";
220
+ sort.value = { column: sort.value.column, direction: sort.value.direction === "asc" ? "desc" : "asc" };
212
221
  }
213
222
  } else {
214
223
  sort.value = { column: column.key, direction: column.direction || "asc" };
215
224
  }
216
- emit("update:sort", sort.value);
217
225
  }
218
226
  function onSelect(row) {
219
227
  if (!$attrs.onSelect) {
@@ -236,7 +244,7 @@ export default defineComponent({
236
244
  selected.value = [];
237
245
  }
238
246
  }
239
- function getRowData(row, rowKey, defaultValue = "Failed to get cell value") {
247
+ function getRowData(row, rowKey, defaultValue = "") {
240
248
  return get(row, rowKey, defaultValue);
241
249
  }
242
250
  return {
@@ -13,7 +13,6 @@ declare const _default: import("vue").DefineComponent<{
13
13
  rows: {
14
14
  type: PropType<{
15
15
  [key: string]: any;
16
- click?: Function | undefined;
17
16
  }[]>;
18
17
  default: () => never[];
19
18
  };
@@ -22,6 +21,7 @@ declare const _default: import("vue").DefineComponent<{
22
21
  [key: string]: any;
23
22
  key: string;
24
23
  sortable?: boolean | undefined;
24
+ sort?: ((a: any, b: any, direction: 'asc' | 'desc') => number) | undefined;
25
25
  direction?: "asc" | "desc" | undefined;
26
26
  class?: string | undefined;
27
27
  }[]>;
@@ -38,6 +38,10 @@ declare const _default: import("vue").DefineComponent<{
38
38
  }>;
39
39
  default: () => {};
40
40
  };
41
+ sortMode: {
42
+ type: PropType<"auto" | "manual">;
43
+ default: string;
44
+ };
41
45
  sortButton: {
42
46
  type: PropType<Button>;
43
47
  default: () => Button;
@@ -70,31 +74,31 @@ declare const _default: import("vue").DefineComponent<{
70
74
  };
71
75
  class: {
72
76
  type: PropType<any>;
73
- default: undefined;
77
+ default: () => string;
74
78
  };
75
79
  ui: {
76
- type: PropType<Partial<any>>;
77
- default: undefined;
80
+ type: PropType<any>;
81
+ default: () => {};
78
82
  };
79
83
  }, {
80
84
  ui: import("vue").ComputedRef<any>;
81
85
  attrs: import("vue").ComputedRef<Pick<{
82
86
  [x: string]: unknown;
83
87
  }, string>>;
84
- sort: import("vue").Ref<{
85
- direction: string;
88
+ sort: import("vue").WritableComputedRef<{
86
89
  column: string;
90
+ direction: 'asc' | 'desc';
87
91
  }>;
88
92
  columns: import("vue").ComputedRef<{
89
93
  [key: string]: any;
90
94
  key: string;
91
95
  sortable?: boolean | undefined;
96
+ sort?: ((a: any, b: any, direction: 'asc' | 'desc') => number) | undefined;
92
97
  direction?: "asc" | "desc" | undefined;
93
98
  class?: string | undefined;
94
99
  }[]>;
95
100
  rows: import("vue").ComputedRef<{
96
101
  [key: string]: any;
97
- click?: Function | undefined;
98
102
  }[]>;
99
103
  selected: import("vue").WritableComputedRef<unknown[]>;
100
104
  indeterminate: import("vue").ComputedRef<boolean>;
@@ -120,7 +124,6 @@ declare const _default: import("vue").DefineComponent<{
120
124
  rows: {
121
125
  type: PropType<{
122
126
  [key: string]: any;
123
- click?: Function | undefined;
124
127
  }[]>;
125
128
  default: () => never[];
126
129
  };
@@ -129,6 +132,7 @@ declare const _default: import("vue").DefineComponent<{
129
132
  [key: string]: any;
130
133
  key: string;
131
134
  sortable?: boolean | undefined;
135
+ sort?: ((a: any, b: any, direction: 'asc' | 'desc') => number) | undefined;
132
136
  direction?: "asc" | "desc" | undefined;
133
137
  class?: string | undefined;
134
138
  }[]>;
@@ -145,6 +149,10 @@ declare const _default: import("vue").DefineComponent<{
145
149
  }>;
146
150
  default: () => {};
147
151
  };
152
+ sortMode: {
153
+ type: PropType<"auto" | "manual">;
154
+ default: string;
155
+ };
148
156
  sortButton: {
149
157
  type: PropType<Button>;
150
158
  default: () => Button;
@@ -177,11 +185,11 @@ declare const _default: import("vue").DefineComponent<{
177
185
  };
178
186
  class: {
179
187
  type: PropType<any>;
180
- default: undefined;
188
+ default: () => string;
181
189
  };
182
190
  ui: {
183
- type: PropType<Partial<any>>;
184
- default: undefined;
191
+ type: PropType<any>;
192
+ default: () => {};
185
193
  };
186
194
  }>> & {
187
195
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
@@ -191,22 +199,23 @@ declare const _default: import("vue").DefineComponent<{
191
199
  column: string;
192
200
  direction: 'asc' | 'desc';
193
201
  };
194
- ui: Partial<any>;
195
- class: any;
196
- modelValue: unknown[];
197
- by: string | Function;
198
- rows: {
199
- [key: string]: any;
200
- click?: Function | undefined;
201
- }[];
202
+ ui: any;
202
203
  columns: {
203
204
  [key: string]: any;
204
205
  key: string;
205
206
  sortable?: boolean | undefined;
207
+ sort?: ((a: any, b: any, direction: 'asc' | 'desc') => number) | undefined;
206
208
  direction?: "asc" | "desc" | undefined;
207
209
  class?: string | undefined;
208
210
  }[];
211
+ class: any;
212
+ modelValue: unknown[];
213
+ by: string | Function;
214
+ rows: {
215
+ [key: string]: any;
216
+ }[];
209
217
  columnAttribute: string;
218
+ sortMode: "auto" | "manual";
210
219
  sortButton: Button;
211
220
  sortAscIcon: string;
212
221
  sortDescIcon: string;
@@ -87,11 +87,11 @@ export default defineComponent({
87
87
  },
88
88
  class: {
89
89
  type: [String, Object, Array],
90
- default: void 0
90
+ default: () => ""
91
91
  },
92
92
  ui: {
93
93
  type: Object,
94
- default: void 0
94
+ default: () => ({})
95
95
  }
96
96
  },
97
97
  setup(props) {
@@ -108,20 +108,24 @@ export default defineComponent({
108
108
  }
109
109
  });
110
110
  }
111
- function onEnter(el, done) {
111
+ function onEnter(_el, done) {
112
+ const el = _el;
112
113
  el.style.height = "0";
113
114
  el.offsetHeight;
114
115
  el.style.height = el.scrollHeight + "px";
115
116
  el.addEventListener("transitionend", done, { once: true });
116
117
  }
117
- function onBeforeLeave(el) {
118
+ function onBeforeLeave(_el) {
119
+ const el = _el;
118
120
  el.style.height = el.scrollHeight + "px";
119
121
  el.offsetHeight;
120
122
  }
121
- function onAfterEnter(el) {
123
+ function onAfterEnter(_el) {
124
+ const el = _el;
122
125
  el.style.height = "auto";
123
126
  }
124
- function onLeave(el, done) {
127
+ function onLeave(_el, done) {
128
+ const el = _el;
125
129
  el.style.height = "0";
126
130
  el.addEventListener("transitionend", done, { once: true });
127
131
  }
@@ -24,11 +24,11 @@ declare const _default: import("vue").DefineComponent<{
24
24
  };
25
25
  class: {
26
26
  type: PropType<any>;
27
- default: undefined;
27
+ default: () => string;
28
28
  };
29
29
  ui: {
30
- type: PropType<Partial<any>>;
31
- default: undefined;
30
+ type: PropType<any>;
31
+ default: () => {};
32
32
  };
33
33
  }, {
34
34
  ui: import("vue").ComputedRef<any>;
@@ -42,10 +42,10 @@ declare const _default: import("vue").DefineComponent<{
42
42
  }[]>;
43
43
  closeOthers: (currentIndex: number, e: Event) => void;
44
44
  omit: typeof omit;
45
- onEnter: (el: HTMLElement, done: any) => void;
46
- onBeforeLeave: (el: HTMLElement) => void;
47
- onAfterEnter: (el: HTMLElement) => void;
48
- onLeave: (el: HTMLElement, done: any) => void;
45
+ onEnter: (_el: Element, done: () => void) => void;
46
+ onBeforeLeave: (_el: Element) => void;
47
+ onAfterEnter: (_el: Element) => void;
48
+ onLeave: (_el: Element, done: () => void) => void;
49
49
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
50
50
  items: {
51
51
  type: PropType<AccordionItem[]>;
@@ -69,14 +69,14 @@ declare const _default: import("vue").DefineComponent<{
69
69
  };
70
70
  class: {
71
71
  type: PropType<any>;
72
- default: undefined;
72
+ default: () => string;
73
73
  };
74
74
  ui: {
75
- type: PropType<Partial<any>>;
76
- default: undefined;
75
+ type: PropType<any>;
76
+ default: () => {};
77
77
  };
78
78
  }>>, {
79
- ui: Partial<any>;
79
+ ui: any;
80
80
  class: any;
81
81
  defaultOpen: boolean;
82
82
  items: AccordionItem[];
@@ -4,7 +4,7 @@
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
 
7
- <div class="w-0 flex-1">
7
+ <div :class="ui.inner">
8
8
  <p :class="ui.title">
9
9
  <slot name="title" :title="title">
10
10
  {{ title }}
@@ -17,15 +17,15 @@
17
17
  </p>
18
18
 
19
19
  <div v-if="(description || $slots.description) && actions.length" :class="ui.actions">
20
- <UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...ui.default.actionButton, ...action }" @click.stop="action.click" />
20
+ <UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...(ui.default.actionButton || {}), ...action }" @click.stop="onAction(action)" />
21
21
  </div>
22
22
  </div>
23
23
  <div v-if="closeButton || (!description && !$slots.description && actions.length)" :class="twMerge(ui.actions, 'mt-0')">
24
24
  <template v-if="!description && !$slots.description && actions.length">
25
- <UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...ui.default.actionButton, ...action }" @click.stop="action.click" />
25
+ <UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...(ui.default.actionButton || {}), ...action }" @click.stop="onAction(action)" />
26
26
  </template>
27
27
 
28
- <UButton v-if="closeButton" aria-label="Close" v-bind="{ ...ui.default.closeButton, ...closeButton }" @click.stop="$emit('close')" />
28
+ <UButton v-if="closeButton" aria-label="Close" v-bind="{ ...(ui.default.closeButton || {}), ...closeButton }" @click.stop="$emit('close')" />
29
29
  </div>
30
30
  </div>
31
31
  </div>
@@ -93,11 +93,11 @@ export default defineComponent({
93
93
  },
94
94
  class: {
95
95
  type: [String, Object, Array],
96
- default: void 0
96
+ default: () => ""
97
97
  },
98
98
  ui: {
99
99
  type: Object,
100
- default: void 0
100
+ default: () => ({})
101
101
  }
102
102
  },
103
103
  emits: ["close"],
@@ -113,11 +113,17 @@ export default defineComponent({
113
113
  variant?.replaceAll("{color}", props.color)
114
114
  ), props.class);
115
115
  });
116
+ function onAction(action) {
117
+ if (action.click) {
118
+ action.click();
119
+ }
120
+ }
116
121
  return {
117
122
  // eslint-disable-next-line vue/no-dupe-keys
118
123
  ui,
119
124
  attrs,
120
125
  alertClass,
126
+ onAction,
121
127
  twMerge
122
128
  };
123
129
  }
@@ -1,5 +1,5 @@
1
1
  import type { PropType } from 'vue';
2
- import type { Avatar, Button, AlertVariant } from '../../types';
2
+ import type { Avatar, Button, AlertVariant, AlertAction } from '../../types';
3
3
  declare const _default: import("vue").DefineComponent<{
4
4
  title: {
5
5
  type: StringConstructor;
@@ -22,9 +22,7 @@ declare const _default: import("vue").DefineComponent<{
22
22
  default: () => Button;
23
23
  };
24
24
  actions: {
25
- type: PropType<(Button & {
26
- click?: Function | undefined;
27
- })[]>;
25
+ type: PropType<AlertAction[]>;
28
26
  default: () => never[];
29
27
  };
30
28
  color: {
@@ -39,11 +37,11 @@ declare const _default: import("vue").DefineComponent<{
39
37
  };
40
38
  class: {
41
39
  type: PropType<any>;
42
- default: undefined;
40
+ default: () => "";
43
41
  };
44
42
  ui: {
45
- type: PropType<Partial<any>>;
46
- default: undefined;
43
+ type: PropType<any>;
44
+ default: () => {};
47
45
  };
48
46
  }, {
49
47
  ui: import("vue").ComputedRef<any>;
@@ -51,6 +49,7 @@ declare const _default: import("vue").DefineComponent<{
51
49
  [x: string]: unknown;
52
50
  }, string>>;
53
51
  alertClass: import("vue").ComputedRef<string>;
52
+ onAction: (action: AlertAction) => void;
54
53
  twMerge: (...classLists: import("tailwind-merge").ClassNameValue[]) => string;
55
54
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "close"[], "close", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
56
55
  title: {
@@ -74,9 +73,7 @@ declare const _default: import("vue").DefineComponent<{
74
73
  default: () => Button;
75
74
  };
76
75
  actions: {
77
- type: PropType<(Button & {
78
- click?: Function | undefined;
79
- })[]>;
76
+ type: PropType<AlertAction[]>;
80
77
  default: () => never[];
81
78
  };
82
79
  color: {
@@ -91,23 +88,21 @@ declare const _default: import("vue").DefineComponent<{
91
88
  };
92
89
  class: {
93
90
  type: PropType<any>;
94
- default: undefined;
91
+ default: () => "";
95
92
  };
96
93
  ui: {
97
- type: PropType<Partial<any>>;
98
- default: undefined;
94
+ type: PropType<any>;
95
+ default: () => {};
99
96
  };
100
97
  }>> & {
101
98
  onClose?: ((...args: any[]) => any) | undefined;
102
99
  }, {
103
- ui: Partial<any>;
100
+ ui: any;
104
101
  description: string;
105
102
  icon: string;
106
103
  avatar: Avatar;
107
104
  closeButton: Button;
108
- actions: (Button & {
109
- click?: Function | undefined;
110
- })[];
105
+ actions: AlertAction[];
111
106
  color: any;
112
107
  class: any;
113
108
  variant: AlertVariant;
@@ -81,11 +81,11 @@ export default defineComponent({
81
81
  },
82
82
  class: {
83
83
  type: [String, Object, Array],
84
- default: void 0
84
+ default: () => ""
85
85
  },
86
86
  ui: {
87
87
  type: Object,
88
- default: void 0
88
+ default: () => ({})
89
89
  }
90
90
  },
91
91
  setup(props) {
@@ -42,11 +42,11 @@ declare const _default: import("vue").DefineComponent<{
42
42
  };
43
43
  class: {
44
44
  type: PropType<any>;
45
- default: undefined;
45
+ default: () => "";
46
46
  };
47
47
  ui: {
48
- type: PropType<Partial<any>>;
49
- default: undefined;
48
+ type: PropType<any>;
49
+ default: () => {};
50
50
  };
51
51
  }, {
52
52
  ui: import("vue").ComputedRef<any>;
@@ -103,16 +103,16 @@ declare const _default: import("vue").DefineComponent<{
103
103
  };
104
104
  class: {
105
105
  type: PropType<any>;
106
- default: undefined;
106
+ default: () => "";
107
107
  };
108
108
  ui: {
109
- type: PropType<Partial<any>>;
110
- default: undefined;
109
+ type: PropType<any>;
110
+ default: () => {};
111
111
  };
112
112
  }>>, {
113
113
  alt: string;
114
114
  size: AvatarSize;
115
- ui: Partial<any>;
115
+ ui: any;
116
116
  icon: string;
117
117
  class: any;
118
118
  src: string | boolean;
@@ -12,11 +12,11 @@ declare const _default: import("vue").DefineComponent<{
12
12
  };
13
13
  class: {
14
14
  type: PropType<any>;
15
- default: undefined;
15
+ default: () => "";
16
16
  };
17
17
  ui: {
18
- type: PropType<Partial<any>>;
19
- default: undefined;
18
+ type: PropType<any>;
19
+ default: () => {};
20
20
  };
21
21
  }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
22
22
  [key: string]: any;
@@ -32,15 +32,15 @@ declare const _default: import("vue").DefineComponent<{
32
32
  };
33
33
  class: {
34
34
  type: PropType<any>;
35
- default: undefined;
35
+ default: () => "";
36
36
  };
37
37
  ui: {
38
- type: PropType<Partial<any>>;
39
- default: undefined;
38
+ type: PropType<any>;
39
+ default: () => {};
40
40
  };
41
41
  }>>, {
42
42
  size: AvatarSize;
43
- ui: Partial<any>;
43
+ ui: any;
44
44
  class: any;
45
45
  max: number;
46
46
  }, {}>;
@@ -23,11 +23,11 @@ export default defineComponent({
23
23
  },
24
24
  class: {
25
25
  type: [String, Object, Array],
26
- default: void 0
26
+ default: () => ""
27
27
  },
28
28
  ui: {
29
29
  type: Object,
30
- default: void 0
30
+ default: () => ({})
31
31
  }
32
32
  },
33
33
  setup(props, { slots }) {
@@ -46,11 +46,11 @@ export default defineComponent({
46
46
  },
47
47
  class: {
48
48
  type: [String, Object, Array],
49
- default: void 0
49
+ default: () => ""
50
50
  },
51
51
  ui: {
52
52
  type: Object,
53
- default: void 0
53
+ default: () => ({})
54
54
  }
55
55
  },
56
56
  setup(props) {