@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
@@ -0,0 +1,78 @@
1
+ <template>
2
+ <nav aria-label="Breadcrumb" :class="ui.wrapper" v-bind="attrs">
3
+ <ol :class="ui.ol">
4
+ <li v-for="(link, index) in links" :key="index" :class="ui.li">
5
+ <ULink
6
+ as="span"
7
+ :class="[ui.base, index === links.length - 1 ? ui.active : !!link.to ? ui.inactive : '']"
8
+ v-bind="omit(link, ['label', 'icon', 'iconClass'])"
9
+ :aria-current="index === links.length - 1 ? 'page' : undefined"
10
+ >
11
+ <slot name="icon" :link="link" :index="index" :is-active="index === links.length - 1">
12
+ <UIcon
13
+ v-if="link.icon"
14
+ :name="link.icon"
15
+ :class="[ui.icon.base, index === links.length - 1 ? ui.icon.active : !!link.to ? ui.icon.inactive : '', link.iconClass]"
16
+ />
17
+ </slot>
18
+
19
+ <slot :link="link" :index="index" :is-active="index === links.length - 1">
20
+ {{ link.label }}
21
+ </slot>
22
+ </ULink>
23
+
24
+ <slot v-if="index < links.length - 1" name="divider">
25
+ <template v-if="divider">
26
+ <UIcon v-if="divider.startsWith('i-')" :name="divider" :class="ui.divider.base" role="presentation" />
27
+ <span v-else role="presentation">{{ divider }}</span>
28
+ </template>
29
+ </slot>
30
+ </li>
31
+ </ol>
32
+ </nav>
33
+ </template>
34
+
35
+ <script>
36
+ import { defineComponent, toRef } from "vue";
37
+ import UIcon from "../elements/Icon.vue";
38
+ import ULink from "../elements/Link.vue";
39
+ import { useUI } from "../../composables/useUI";
40
+ import { mergeConfig, omit } from "../../utils";
41
+ import appConfig from "#build/app.config";
42
+ import { breadcrumb } from "#ui/ui.config";
43
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.breadcrumb, breadcrumb);
44
+ export default defineComponent({
45
+ components: {
46
+ UIcon,
47
+ ULink
48
+ },
49
+ inheritAttrs: false,
50
+ props: {
51
+ links: {
52
+ type: Array,
53
+ default: () => []
54
+ },
55
+ divider: {
56
+ type: String,
57
+ default: () => config.default.divider
58
+ },
59
+ class: {
60
+ type: [String, Object, Array],
61
+ default: void 0
62
+ },
63
+ ui: {
64
+ type: Object,
65
+ default: void 0
66
+ }
67
+ },
68
+ setup(props) {
69
+ const { ui, attrs } = useUI("breadcrumb", toRef(props, "ui"), config, toRef(props, "class"));
70
+ return {
71
+ // eslint-disable-next-line vue/no-dupe-keys
72
+ ui,
73
+ attrs,
74
+ omit
75
+ };
76
+ }
77
+ });
78
+ </script>
@@ -0,0 +1,50 @@
1
+ import type { PropType } from 'vue';
2
+ import { omit } from '../../utils';
3
+ import type { BreadcrumbLink } from '../../types';
4
+ declare const _default: import("vue").DefineComponent<{
5
+ links: {
6
+ type: PropType<BreadcrumbLink[]>;
7
+ default: () => never[];
8
+ };
9
+ divider: {
10
+ type: StringConstructor;
11
+ default: () => any;
12
+ };
13
+ class: {
14
+ type: PropType<any>;
15
+ default: undefined;
16
+ };
17
+ ui: {
18
+ type: PropType<Partial<any>>;
19
+ default: undefined;
20
+ };
21
+ }, {
22
+ ui: import("vue").ComputedRef<any>;
23
+ attrs: import("vue").ComputedRef<Pick<{
24
+ [x: string]: unknown;
25
+ }, string>>;
26
+ omit: typeof omit;
27
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
28
+ links: {
29
+ type: PropType<BreadcrumbLink[]>;
30
+ default: () => never[];
31
+ };
32
+ divider: {
33
+ type: StringConstructor;
34
+ default: () => any;
35
+ };
36
+ class: {
37
+ type: PropType<any>;
38
+ default: undefined;
39
+ };
40
+ ui: {
41
+ type: PropType<Partial<any>>;
42
+ default: undefined;
43
+ };
44
+ }>>, {
45
+ ui: Partial<any>;
46
+ class: any;
47
+ divider: string;
48
+ links: BreadcrumbLink[];
49
+ }, {}>;
50
+ export default _default;
@@ -181,7 +181,7 @@ export default defineComponent({
181
181
  const isLoading = ref(false);
182
182
  onMounted(() => {
183
183
  if (props.autoselect) {
184
- activateFirstOption();
184
+ activateNextOption();
185
185
  }
186
186
  });
187
187
  onMounted(() => {
@@ -221,18 +221,25 @@ export default defineComponent({
221
221
  }
222
222
  for (const key in groupedCommands) {
223
223
  const group = props.groups.find((group2) => group2.key === key);
224
- const commands2 = groupedCommands[key].slice(0, options.value.resultLimit).map((result) => {
224
+ let commands2 = groupedCommands[key].map((result) => {
225
225
  const { item, ...data } = result;
226
226
  return {
227
227
  ...item,
228
228
  ...data
229
229
  };
230
230
  });
231
- groups2.push({ ...group, commands: commands2 });
231
+ if (group.filter && typeof group.filter === "function") {
232
+ commands2 = group.filter(query.value, commands2);
233
+ }
234
+ groups2.push({ ...group, commands: commands2.slice(0, options.value.resultLimit) });
232
235
  }
233
236
  for (const group of props.groups) {
234
237
  if (group.search && searchResults.value[group.key]?.length) {
235
- groups2.push({ ...group, commands: (searchResults.value[group.key] || []).slice(0, options.value.resultLimit) });
238
+ let commands2 = searchResults.value[group.key] || [];
239
+ if (group.filter && typeof group.filter === "function") {
240
+ commands2 = group.filter(query.value, commands2);
241
+ }
242
+ groups2.push({ ...group, commands: commands2.slice(0, options.value.resultLimit) });
236
243
  }
237
244
  }
238
245
  return groups2;
@@ -247,12 +254,11 @@ export default defineComponent({
247
254
  searchResults.value[group.key] = await group.search(query.value);
248
255
  }));
249
256
  isLoading.value = false;
257
+ activateFirstOption();
250
258
  }, props.debounce);
251
259
  watch(query, () => {
252
260
  debouncedSearch();
253
- setTimeout(() => {
254
- comboboxInput.value?.$el.dispatchEvent(new KeyboardEvent("keydown", { key: "PageUp" }));
255
- }, 0);
261
+ activateFirstOption();
256
262
  });
257
263
  const iconName = computed(() => {
258
264
  if ((props.loading || isLoading.value) && props.loadingIcon) {
@@ -269,6 +275,11 @@ export default defineComponent({
269
275
  });
270
276
  const emptyState = computed(() => ({ ...ui.value.default.emptyState, ...props.emptyState }));
271
277
  function activateFirstOption() {
278
+ setTimeout(() => {
279
+ comboboxInput.value?.$el.dispatchEvent(new KeyboardEvent("keydown", { key: "PageUp" }));
280
+ }, 0);
281
+ }
282
+ function activateNextOption() {
272
283
  setTimeout(() => {
273
284
  comboboxInput.value?.$el.dispatchEvent(new KeyboardEvent("keydown", { key: "ArrowDown" }));
274
285
  }, 0);
@@ -193,12 +193,12 @@ declare const _default: import("vue").DefineComponent<{
193
193
  default: undefined;
194
194
  };
195
195
  }>> & {
196
- onClose?: ((...args: any[]) => any) | undefined;
197
196
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
197
+ onClose?: ((...args: any[]) => any) | undefined;
198
198
  }, {
199
+ ui: Partial<any>;
199
200
  icon: string;
200
201
  closeButton: Button;
201
- ui: Partial<any>;
202
202
  class: any;
203
203
  modelValue: string | number | unknown[] | Record<string, any>;
204
204
  by: string;
@@ -1,10 +1,23 @@
1
1
  <template>
2
2
  <div :class="ui.wrapper" v-bind="attrs">
3
+ <slot name="first" :on-click="onClickFirst">
4
+ <UButton
5
+ v-if="firstButton && showFirst"
6
+ :size="size"
7
+ :disabled="!canGoFirstOrPrev"
8
+ :class="[ui.base, ui.rounded]"
9
+ v-bind="{ ...ui.default.firstButton, ...firstButton }"
10
+ :ui="{ rounded: '' }"
11
+ aria-label="First"
12
+ @click="onClickFirst"
13
+ />
14
+ </slot>
15
+
3
16
  <slot name="prev" :on-click="onClickPrev">
4
17
  <UButton
5
18
  v-if="prevButton"
6
19
  :size="size"
7
- :disabled="!canGoPrev"
20
+ :disabled="!canGoFirstOrPrev"
8
21
  :class="[ui.base, ui.rounded]"
9
22
  v-bind="{ ...ui.default.prevButton, ...prevButton }"
10
23
  :ui="{ rounded: '' }"
@@ -28,7 +41,7 @@
28
41
  <UButton
29
42
  v-if="nextButton"
30
43
  :size="size"
31
- :disabled="!canGoNext"
44
+ :disabled="!canGoLastOrNext"
32
45
  :class="[ui.base, ui.rounded]"
33
46
  v-bind="{ ...ui.default.nextButton, ...nextButton }"
34
47
  :ui="{ rounded: '' }"
@@ -36,6 +49,19 @@
36
49
  @click="onClickNext"
37
50
  />
38
51
  </slot>
52
+
53
+ <slot name="last" :on-click="onClickLast">
54
+ <UButton
55
+ v-if="lastButton && showLast"
56
+ :size="size"
57
+ :disabled="!canGoLastOrNext"
58
+ :class="[ui.base, ui.rounded]"
59
+ v-bind="{ ...ui.default.lastButton, ...lastButton }"
60
+ :ui="{ rounded: '' }"
61
+ aria-label="Last"
62
+ @click="onClickLast"
63
+ />
64
+ </slot>
39
65
  </div>
40
66
  </template>
41
67
 
@@ -88,6 +114,22 @@ export default defineComponent({
88
114
  type: Object,
89
115
  default: () => config.default.inactiveButton
90
116
  },
117
+ showFirst: {
118
+ type: Boolean,
119
+ default: false
120
+ },
121
+ showLast: {
122
+ type: Boolean,
123
+ default: false
124
+ },
125
+ firstButton: {
126
+ type: Object,
127
+ default: () => config.default.firstButton
128
+ },
129
+ lastButton: {
130
+ type: Object,
131
+ default: () => config.default.lastButton
132
+ },
91
133
  prevButton: {
92
134
  type: Object,
93
135
  default: () => config.default.prevButton
@@ -168,8 +210,20 @@ export default defineComponent({
168
210
  }
169
211
  return items;
170
212
  });
171
- const canGoPrev = computed(() => currentPage.value > 1);
172
- const canGoNext = computed(() => currentPage.value < pages.value.length);
213
+ const canGoFirstOrPrev = computed(() => currentPage.value > 1);
214
+ const canGoLastOrNext = computed(() => currentPage.value < pages.value.length);
215
+ function onClickFirst() {
216
+ if (!canGoFirstOrPrev.value) {
217
+ return;
218
+ }
219
+ currentPage.value = 1;
220
+ }
221
+ function onClickLast() {
222
+ if (!canGoLastOrNext.value) {
223
+ return;
224
+ }
225
+ currentPage.value = pages.value.length;
226
+ }
173
227
  function onClickPage(page) {
174
228
  if (typeof page === "string") {
175
229
  return;
@@ -177,13 +231,13 @@ export default defineComponent({
177
231
  currentPage.value = page;
178
232
  }
179
233
  function onClickPrev() {
180
- if (!canGoPrev.value) {
234
+ if (!canGoFirstOrPrev.value) {
181
235
  return;
182
236
  }
183
237
  currentPage.value--;
184
238
  }
185
239
  function onClickNext() {
186
- if (!canGoNext.value) {
240
+ if (!canGoLastOrNext.value) {
187
241
  return;
188
242
  }
189
243
  currentPage.value++;
@@ -195,11 +249,13 @@ export default defineComponent({
195
249
  currentPage,
196
250
  pages,
197
251
  displayedPages,
198
- canGoPrev,
199
- canGoNext,
252
+ canGoLastOrNext,
253
+ canGoFirstOrPrev,
200
254
  onClickPrev,
201
255
  onClickNext,
202
- onClickPage
256
+ onClickPage,
257
+ onClickFirst,
258
+ onClickLast
203
259
  };
204
260
  }
205
261
  });
@@ -1,5 +1,5 @@
1
1
  import type { PropType } from 'vue';
2
- import type { Button } from '../../types';
2
+ import type { Button, ButtonSize } from '../../types';
3
3
  declare const _default: import("vue").DefineComponent<{
4
4
  modelValue: {
5
5
  type: NumberConstructor;
@@ -19,7 +19,7 @@ declare const _default: import("vue").DefineComponent<{
19
19
  validate(value: any): boolean;
20
20
  };
21
21
  size: {
22
- type: PropType<string | number | symbol>;
22
+ type: PropType<ButtonSize>;
23
23
  default: () => any;
24
24
  validator(value: string): boolean;
25
25
  };
@@ -31,6 +31,22 @@ declare const _default: import("vue").DefineComponent<{
31
31
  type: PropType<Button>;
32
32
  default: () => Button;
33
33
  };
34
+ showFirst: {
35
+ type: BooleanConstructor;
36
+ default: boolean;
37
+ };
38
+ showLast: {
39
+ type: BooleanConstructor;
40
+ default: boolean;
41
+ };
42
+ firstButton: {
43
+ type: PropType<Button>;
44
+ default: () => Button;
45
+ };
46
+ lastButton: {
47
+ type: PropType<Button>;
48
+ default: () => Button;
49
+ };
34
50
  prevButton: {
35
51
  type: PropType<Button>;
36
52
  default: () => Button;
@@ -59,11 +75,13 @@ declare const _default: import("vue").DefineComponent<{
59
75
  currentPage: import("vue").WritableComputedRef<number>;
60
76
  pages: import("vue").ComputedRef<number[]>;
61
77
  displayedPages: import("vue").ComputedRef<(string | number)[]>;
62
- canGoPrev: import("vue").ComputedRef<boolean>;
63
- canGoNext: import("vue").ComputedRef<boolean>;
78
+ canGoLastOrNext: import("vue").ComputedRef<boolean>;
79
+ canGoFirstOrPrev: import("vue").ComputedRef<boolean>;
64
80
  onClickPrev: () => void;
65
81
  onClickNext: () => void;
66
82
  onClickPage: (page: number | string) => void;
83
+ onClickFirst: () => void;
84
+ onClickLast: () => void;
67
85
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
68
86
  modelValue: {
69
87
  type: NumberConstructor;
@@ -83,7 +101,7 @@ declare const _default: import("vue").DefineComponent<{
83
101
  validate(value: any): boolean;
84
102
  };
85
103
  size: {
86
- type: PropType<string | number | symbol>;
104
+ type: PropType<ButtonSize>;
87
105
  default: () => any;
88
106
  validator(value: string): boolean;
89
107
  };
@@ -95,6 +113,22 @@ declare const _default: import("vue").DefineComponent<{
95
113
  type: PropType<Button>;
96
114
  default: () => Button;
97
115
  };
116
+ showFirst: {
117
+ type: BooleanConstructor;
118
+ default: boolean;
119
+ };
120
+ showLast: {
121
+ type: BooleanConstructor;
122
+ default: boolean;
123
+ };
124
+ firstButton: {
125
+ type: PropType<Button>;
126
+ default: () => Button;
127
+ };
128
+ lastButton: {
129
+ type: PropType<Button>;
130
+ default: () => Button;
131
+ };
98
132
  prevButton: {
99
133
  type: PropType<Button>;
100
134
  default: () => Button;
@@ -118,15 +152,19 @@ declare const _default: import("vue").DefineComponent<{
118
152
  }>> & {
119
153
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
120
154
  }, {
155
+ size: ButtonSize;
121
156
  ui: Partial<any>;
122
157
  class: any;
123
- size: string | number | symbol;
124
158
  max: number;
159
+ divider: string;
125
160
  pageCount: number;
126
161
  activeButton: Button;
127
162
  inactiveButton: Button;
163
+ showFirst: boolean;
164
+ showLast: boolean;
165
+ firstButton: Button;
166
+ lastButton: Button;
128
167
  prevButton: Button;
129
168
  nextButton: Button;
130
- divider: string;
131
169
  }, {}>;
132
170
  export default _default;
@@ -26,7 +26,7 @@
26
26
  >
27
27
  <button :class="[ui.list.tab.base, ui.list.tab.background, ui.list.tab.height, ui.list.tab.padding, ui.list.tab.size, ui.list.tab.font, ui.list.tab.rounded, ui.list.tab.shadow, selected ? ui.list.tab.active : ui.list.tab.inactive]">
28
28
  <slot :item="item" :index="index" :selected="selected" :disabled="disabled">
29
- {{ item.label }}
29
+ <span class="truncate">{{ item.label }}</span>
30
30
  </slot>
31
31
  </button>
32
32
  </HTab>
@@ -66,11 +66,11 @@ declare const _default: import("vue").DefineComponent<{
66
66
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
67
67
  onChange?: ((...args: any[]) => any) | undefined;
68
68
  }, {
69
+ orientation: "horizontal" | "vertical";
69
70
  ui: Partial<any>;
70
71
  class: any;
71
72
  modelValue: number;
72
73
  items: TabItem[];
73
- orientation: "horizontal" | "vertical";
74
74
  defaultIndex: number;
75
75
  }, {}>;
76
76
  export default _default;
@@ -1,8 +1,11 @@
1
1
  <template>
2
2
  <div v-if="isOpen" ref="container" :class="wrapperClass" v-bind="attrs">
3
3
  <Transition appear v-bind="ui.transition">
4
- <div :class="[ui.base, ui.ring, ui.rounded, ui.shadow, ui.background]">
5
- <slot />
4
+ <div>
5
+ <div v-if="popper.arrow" data-popper-arrow :class="['invisible before:visible before:block before:rotate-45 before:z-[-1]', Object.values(ui.arrow)]" />
6
+ <div :class="[ui.base, ui.ring, ui.rounded, ui.shadow, ui.background]">
7
+ <slot />
8
+ </div>
6
9
  </div>
7
10
  </Transition>
8
11
  </div>
@@ -72,6 +75,8 @@ export default defineComponent({
72
75
  attrs,
73
76
  isOpen,
74
77
  wrapperClass,
78
+ // eslint-disable-next-line vue/no-dupe-keys
79
+ popper,
75
80
  container
76
81
  };
77
82
  }
@@ -28,6 +28,7 @@ declare const _default: import("vue").DefineComponent<{
28
28
  }, string>>;
29
29
  isOpen: import("vue").WritableComputedRef<boolean>;
30
30
  wrapperClass: import("vue").ComputedRef<string>;
31
+ popper: import("vue").ComputedRef<PopperOptions>;
31
32
  container: Ref<import("@vueuse/core").MaybeElement>;
32
33
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "update:modelValue")[], "close" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
33
34
  modelValue: {
@@ -51,8 +52,8 @@ declare const _default: import("vue").DefineComponent<{
51
52
  default: undefined;
52
53
  };
53
54
  }>> & {
54
- onClose?: ((...args: any[]) => any) | undefined;
55
55
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
56
+ onClose?: ((...args: any[]) => any) | undefined;
56
57
  }, {
57
58
  ui: Partial<any>;
58
59
  popper: PopperOptions;
@@ -6,7 +6,7 @@
6
6
  </TransitionChild>
7
7
 
8
8
  <div :class="ui.inner">
9
- <div :class="[ui.container, ui.padding]">
9
+ <div :class="[ui.container, !fullscreen && ui.padding]">
10
10
  <TransitionChild as="template" :appear="appear" v-bind="transitionClass">
11
11
  <HDialogPanel
12
12
  :class="[
@@ -74,8 +74,8 @@ declare const _default: import("vue").DefineComponent<{
74
74
  default: undefined;
75
75
  };
76
76
  }>> & {
77
- onClose?: ((...args: any[]) => any) | undefined;
78
77
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
78
+ onClose?: ((...args: any[]) => any) | undefined;
79
79
  }, {
80
80
  ui: Partial<any>;
81
81
  class: any;
@@ -1,35 +1,39 @@
1
1
  <template>
2
2
  <Transition appear v-bind="ui.transition">
3
- <div :class="wrapperClass" v-bind="attrs" @mouseover="onMouseover" @mouseleave="onMouseleave">
3
+ <div
4
+ :class="wrapperClass"
5
+ role="status"
6
+ v-bind="attrs"
7
+ @mouseover="onMouseover"
8
+ @mouseleave="onMouseleave"
9
+ >
4
10
  <div :class="[ui.container, ui.rounded, ui.ring]">
5
- <div :class="ui.padding">
6
- <div class="flex gap-3" :class="{ 'items-start': description || $slots.description, 'items-center': !description && !$slots.description }">
7
- <UIcon v-if="icon" :name="icon" :class="iconClass" />
8
- <UAvatar v-if="avatar" v-bind="{ size: ui.avatar.size, ...avatar }" :class="ui.avatar.base" />
11
+ <div class="flex" :class="[ui.padding, ui.gap, { 'items-start': description || $slots.description, 'items-center': !description && !$slots.description }]">
12
+ <UIcon v-if="icon" :name="icon" :class="iconClass" />
13
+ <UAvatar v-if="avatar" v-bind="{ size: ui.avatar.size, ...avatar }" :class="ui.avatar.base" />
9
14
 
10
- <div class="w-0 flex-1">
11
- <p :class="ui.title">
12
- <slot name="title" :title="title">
13
- {{ title }}
14
- </slot>
15
- </p>
16
- <p v-if="(description || $slots.description)" :class="ui.description">
17
- <slot name="description" :description="description">
18
- {{ description }}
19
- </slot>
20
- </p>
15
+ <div class="w-0 flex-1">
16
+ <p :class="ui.title">
17
+ <slot name="title" :title="title">
18
+ {{ title }}
19
+ </slot>
20
+ </p>
21
+ <p v-if="(description || $slots.description)" :class="ui.description">
22
+ <slot name="description" :description="description">
23
+ {{ description }}
24
+ </slot>
25
+ </p>
21
26
 
22
- <div v-if="(description || $slots.description) && actions.length" class="mt-3 flex items-center gap-2">
23
- <UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...ui.default.actionButton, ...action }" @click.stop="onAction(action)" />
24
- </div>
27
+ <div v-if="(description || $slots.description) && actions.length" :class="ui.actions">
28
+ <UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...ui.default.actionButton, ...action }" @click.stop="onAction(action)" />
25
29
  </div>
26
- <div class="flex-shrink-0 flex items-center gap-3">
27
- <div v-if="!description && !$slots.description && actions.length" class="flex items-center gap-2">
28
- <UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...ui.default.actionButton, ...action }" @click.stop="onAction(action)" />
29
- </div>
30
+ </div>
31
+ <div v-if="closeButton || (!description && !$slots.description && actions.length)" :class="twMerge(ui.actions, 'mt-0')">
32
+ <template v-if="!description && !$slots.description && actions.length">
33
+ <UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...ui.default.actionButton, ...action }" @click.stop="onAction(action)" />
34
+ </template>
30
35
 
31
- <UButton v-if="closeButton" aria-label="Close" v-bind="{ ...ui.default.closeButton, ...closeButton }" @click.stop="onClose" />
32
- </div>
36
+ <UButton v-if="closeButton" aria-label="Close" v-bind="{ ...ui.default.closeButton, ...closeButton }" @click.stop="onClose" />
33
37
  </div>
34
38
  </div>
35
39
  <div v-if="timeout" :class="progressClass" :style="progressStyle" />
@@ -84,7 +88,7 @@ export default defineComponent({
84
88
  },
85
89
  timeout: {
86
90
  type: Number,
87
- default: 5e3
91
+ default: () => config.default.timeout
88
92
  },
89
93
  actions: {
90
94
  type: Array,
@@ -194,7 +198,8 @@ export default defineComponent({
194
198
  onMouseover,
195
199
  onMouseleave,
196
200
  onClose,
197
- onAction
201
+ onAction,
202
+ twMerge
198
203
  };
199
204
  }
200
205
  });
@@ -27,7 +27,7 @@ declare const _default: import("vue").DefineComponent<{
27
27
  };
28
28
  timeout: {
29
29
  type: NumberConstructor;
30
- default: number;
30
+ default: () => any;
31
31
  };
32
32
  actions: {
33
33
  type: PropType<NotificationAction[]>;
@@ -65,6 +65,7 @@ declare const _default: import("vue").DefineComponent<{
65
65
  onMouseleave: () => void;
66
66
  onClose: () => void;
67
67
  onAction: (action: NotificationAction) => void;
68
+ twMerge: (...classLists: import("tailwind-merge").ClassNameValue[]) => string;
68
69
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "close"[], "close", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
69
70
  id: {
70
71
  type: (NumberConstructor | StringConstructor)[];
@@ -92,7 +93,7 @@ declare const _default: import("vue").DefineComponent<{
92
93
  };
93
94
  timeout: {
94
95
  type: NumberConstructor;
95
- default: number;
96
+ default: () => any;
96
97
  };
97
98
  actions: {
98
99
  type: PropType<NotificationAction[]>;
@@ -118,6 +119,7 @@ declare const _default: import("vue").DefineComponent<{
118
119
  }>> & {
119
120
  onClose?: ((...args: any[]) => any) | undefined;
120
121
  }, {
122
+ ui: Partial<any>;
121
123
  description: string;
122
124
  icon: string;
123
125
  avatar: Avatar;
@@ -126,7 +128,6 @@ declare const _default: import("vue").DefineComponent<{
126
128
  actions: NotificationAction[];
127
129
  callback: Function;
128
130
  color: any;
129
- ui: Partial<any>;
130
131
  class: any;
131
132
  }, {}>;
132
133
  export default _default;