@nuxt/ui 2.10.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 (172) hide show
  1. package/README.md +11 -0
  2. package/dist/module.d.mts +191 -82
  3. package/dist/module.d.ts +191 -82
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +12 -5
  6. package/dist/runtime/components/elements/Alert.vue +7 -6
  7. package/dist/runtime/components/elements/Alert.vue.d.ts +6 -5
  8. package/dist/runtime/components/elements/Avatar.vue.d.ts +5 -4
  9. package/dist/runtime/components/elements/AvatarGroup.d.ts +4 -3
  10. package/dist/runtime/components/elements/Badge.vue +4 -2
  11. package/dist/runtime/components/elements/Badge.vue.d.ts +5 -5
  12. package/dist/runtime/components/elements/Button.vue +8 -6
  13. package/dist/runtime/components/elements/Button.vue.d.ts +6 -6
  14. package/dist/runtime/components/elements/ButtonGroup.d.ts +5 -4
  15. package/dist/runtime/components/elements/ButtonGroup.mjs +19 -32
  16. package/dist/runtime/components/elements/Chip.vue +85 -0
  17. package/dist/runtime/components/elements/Chip.vue.d.ts +90 -0
  18. package/dist/runtime/components/elements/Dropdown.vue +31 -17
  19. package/dist/runtime/components/elements/Dropdown.vue.d.ts +6 -0
  20. package/dist/runtime/components/elements/Icon.vue +16 -2
  21. package/dist/runtime/components/elements/Icon.vue.d.ts +14 -2
  22. package/dist/runtime/components/elements/Kbd.vue.d.ts +5 -4
  23. package/dist/runtime/components/elements/Link.vue +2 -5
  24. package/dist/runtime/components/elements/Meter.vue.d.ts +3 -3
  25. package/dist/runtime/components/elements/MeterGroup.d.ts +2 -2
  26. package/dist/runtime/components/elements/Progress.vue +1 -1
  27. package/dist/runtime/components/forms/Checkbox.vue +2 -4
  28. package/dist/runtime/components/forms/Checkbox.vue.d.ts +5 -5
  29. package/dist/runtime/components/forms/FormGroup.vue +7 -3
  30. package/dist/runtime/components/forms/FormGroup.vue.d.ts +15 -5
  31. package/dist/runtime/components/forms/Input.vue +36 -5
  32. package/dist/runtime/components/forms/Input.vue.d.ts +32 -9
  33. package/dist/runtime/components/forms/Radio.vue +12 -6
  34. package/dist/runtime/components/forms/Radio.vue.d.ts +5 -4
  35. package/dist/runtime/components/forms/RadioGroup.vue +1 -1
  36. package/dist/runtime/components/forms/RadioGroup.vue.d.ts +1 -1
  37. package/dist/runtime/components/forms/Range.vue.d.ts +6 -5
  38. package/dist/runtime/components/forms/Select.vue +5 -2
  39. package/dist/runtime/components/forms/Select.vue.d.ts +9 -8
  40. package/dist/runtime/components/forms/SelectMenu.vue +24 -7
  41. package/dist/runtime/components/forms/SelectMenu.vue.d.ts +18 -9
  42. package/dist/runtime/components/forms/Textarea.vue +33 -3
  43. package/dist/runtime/components/forms/Textarea.vue.d.ts +31 -8
  44. package/dist/runtime/components/forms/Toggle.vue +19 -1
  45. package/dist/runtime/components/forms/Toggle.vue.d.ts +15 -2
  46. package/dist/runtime/components/layout/Divider.vue.d.ts +3 -3
  47. package/dist/runtime/components/navigation/Breadcrumb.vue +78 -0
  48. package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +50 -0
  49. package/dist/runtime/components/navigation/CommandPalette.vue +8 -4
  50. package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +1 -1
  51. package/dist/runtime/components/navigation/Pagination.vue.d.ts +4 -4
  52. package/dist/runtime/components/navigation/Tabs.vue.d.ts +1 -1
  53. package/dist/runtime/components/overlays/Notification.vue +27 -28
  54. package/dist/runtime/components/overlays/Notification.vue.d.ts +4 -3
  55. package/dist/runtime/components/overlays/Notifications.vue +16 -14
  56. package/dist/runtime/components/overlays/Popover.vue +9 -0
  57. package/dist/runtime/components/overlays/Popover.vue.d.ts +13 -2
  58. package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
  59. package/dist/runtime/composables/defineShortcuts.mjs +8 -4
  60. package/dist/runtime/composables/useButtonGroup.d.ts +20 -0
  61. package/dist/runtime/composables/useButtonGroup.mjs +52 -0
  62. package/dist/runtime/composables/useFormGroup.d.ts +4 -2
  63. package/dist/runtime/composables/useFormGroup.mjs +3 -2
  64. package/dist/runtime/composables/useShortcuts.d.ts +2 -2
  65. package/dist/runtime/types/alert.d.ts +7 -0
  66. package/dist/runtime/types/avatar.d.ts +3 -1
  67. package/dist/runtime/types/badge.d.ts +5 -4
  68. package/dist/runtime/types/breadcrumb.d.ts +7 -0
  69. package/dist/runtime/types/button.d.ts +5 -4
  70. package/dist/runtime/types/chip.d.ts +11 -0
  71. package/dist/runtime/types/dropdown.d.ts +2 -2
  72. package/dist/runtime/types/form-group.d.ts +5 -0
  73. package/dist/runtime/types/form.d.ts +2 -1
  74. package/dist/runtime/types/index.d.ts +10 -0
  75. package/dist/runtime/types/input.d.ts +8 -0
  76. package/dist/runtime/types/kbd.d.ts +5 -0
  77. package/dist/runtime/types/range.d.ts +5 -0
  78. package/dist/runtime/types/select.d.ts +8 -0
  79. package/dist/runtime/types/textarea.d.ts +8 -0
  80. package/dist/runtime/types/toggle.d.ts +5 -0
  81. package/dist/runtime/types/utils.d.ts +22 -5
  82. package/dist/runtime/ui.config/_popperArrow.d.ts +9 -0
  83. package/dist/runtime/ui.config/_popperArrow.mjs +8 -0
  84. package/dist/runtime/ui.config/data/table.d.ts +60 -0
  85. package/dist/runtime/ui.config/data/table.mjs +59 -0
  86. package/dist/runtime/ui.config/elements/accordion.d.ts +21 -0
  87. package/dist/runtime/ui.config/elements/accordion.mjs +20 -0
  88. package/dist/runtime/ui.config/elements/alert.d.ts +40 -0
  89. package/dist/runtime/ui.config/elements/alert.mjs +39 -0
  90. package/dist/runtime/ui.config/elements/avatar.d.ts +60 -0
  91. package/dist/runtime/ui.config/elements/avatar.mjs +59 -0
  92. package/dist/runtime/ui.config/elements/avatarGroup.d.ts +6 -0
  93. package/dist/runtime/ui.config/elements/avatarGroup.mjs +5 -0
  94. package/dist/runtime/ui.config/elements/badge.d.ts +34 -0
  95. package/dist/runtime/ui.config/elements/badge.mjs +33 -0
  96. package/dist/runtime/ui.config/elements/button.d.ts +77 -0
  97. package/dist/runtime/ui.config/elements/button.mjs +76 -0
  98. package/dist/runtime/ui.config/elements/buttonGroup.d.ts +9 -0
  99. package/dist/runtime/ui.config/elements/buttonGroup.mjs +8 -0
  100. package/dist/runtime/ui.config/elements/chip.d.ts +35 -0
  101. package/dist/runtime/ui.config/elements/chip.mjs +34 -0
  102. package/dist/runtime/ui.config/elements/dropdown.d.ts +53 -0
  103. package/dist/runtime/ui.config/elements/dropdown.mjs +51 -0
  104. package/dist/runtime/ui.config/elements/kbd.d.ts +17 -0
  105. package/dist/runtime/ui.config/elements/kbd.mjs +16 -0
  106. package/dist/runtime/ui.config/elements/meter.d.ts +77 -0
  107. package/dist/runtime/ui.config/elements/meter.mjs +76 -0
  108. package/dist/runtime/ui.config/elements/meterGroup.d.ts +12 -0
  109. package/dist/runtime/ui.config/elements/meterGroup.mjs +11 -0
  110. package/dist/runtime/ui.config/elements/progress.d.ts +75 -0
  111. package/dist/runtime/ui.config/elements/progress.mjs +74 -0
  112. package/dist/runtime/ui.config/forms/checkbox.d.ts +16 -0
  113. package/dist/runtime/ui.config/forms/checkbox.mjs +15 -0
  114. package/dist/runtime/ui.config/forms/formGroup.d.ts +25 -0
  115. package/dist/runtime/ui.config/forms/formGroup.mjs +25 -0
  116. package/dist/runtime/ui.config/forms/input.d.ts +105 -0
  117. package/dist/runtime/ui.config/forms/input.mjs +104 -0
  118. package/dist/runtime/ui.config/forms/radio.d.ts +15 -0
  119. package/dist/runtime/ui.config/forms/radio.mjs +14 -0
  120. package/dist/runtime/ui.config/forms/radioGroup.d.ts +8 -0
  121. package/dist/runtime/ui.config/forms/radioGroup.mjs +7 -0
  122. package/dist/runtime/ui.config/forms/range.d.ts +64 -0
  123. package/dist/runtime/ui.config/forms/range.mjs +63 -0
  124. package/dist/runtime/ui.config/forms/select.d.ts +106 -0
  125. package/dist/runtime/ui.config/forms/select.mjs +12 -0
  126. package/dist/runtime/ui.config/forms/selectMenu.d.ts +63 -0
  127. package/dist/runtime/ui.config/forms/selectMenu.mjs +61 -0
  128. package/dist/runtime/ui.config/forms/textarea.d.ts +104 -0
  129. package/dist/runtime/ui.config/forms/textarea.mjs +9 -0
  130. package/dist/runtime/ui.config/forms/toggle.d.ts +61 -0
  131. package/dist/runtime/ui.config/forms/toggle.mjs +60 -0
  132. package/dist/runtime/ui.config/index.d.ts +40 -0
  133. package/dist/runtime/ui.config/index.mjs +40 -0
  134. package/dist/runtime/ui.config/layout/card.d.ts +24 -0
  135. package/dist/runtime/ui.config/layout/card.mjs +23 -0
  136. package/dist/runtime/ui.config/layout/container.d.ts +6 -0
  137. package/dist/runtime/ui.config/layout/container.mjs +5 -0
  138. package/dist/runtime/ui.config/layout/divider.d.ts +30 -0
  139. package/dist/runtime/ui.config/layout/divider.mjs +29 -0
  140. package/dist/runtime/ui.config/layout/skeleton.d.ts +6 -0
  141. package/dist/runtime/ui.config/layout/skeleton.mjs +5 -0
  142. package/dist/runtime/ui.config/navigation/breadcrumb.d.ts +20 -0
  143. package/dist/runtime/ui.config/navigation/breadcrumb.mjs +19 -0
  144. package/dist/runtime/ui.config/navigation/commandPalette.d.ts +68 -0
  145. package/dist/runtime/ui.config/navigation/commandPalette.mjs +67 -0
  146. package/dist/runtime/ui.config/navigation/pagination.d.ts +35 -0
  147. package/dist/runtime/ui.config/navigation/pagination.mjs +34 -0
  148. package/dist/runtime/ui.config/navigation/tabs.d.ts +34 -0
  149. package/dist/runtime/ui.config/navigation/tabs.mjs +33 -0
  150. package/dist/runtime/ui.config/navigation/verticalNavigation.d.ts +28 -0
  151. package/dist/runtime/ui.config/navigation/verticalNavigation.mjs +27 -0
  152. package/dist/runtime/ui.config/overlays/contextMenu.d.ts +31 -0
  153. package/dist/runtime/ui.config/overlays/contextMenu.mjs +25 -0
  154. package/dist/runtime/ui.config/overlays/modal.d.ts +35 -0
  155. package/dist/runtime/ui.config/overlays/modal.mjs +36 -0
  156. package/dist/runtime/ui.config/overlays/notification.d.ts +49 -0
  157. package/dist/runtime/ui.config/overlays/notification.mjs +49 -0
  158. package/dist/runtime/ui.config/overlays/notifications.d.ts +7 -0
  159. package/dist/runtime/ui.config/overlays/notifications.mjs +6 -0
  160. package/dist/runtime/ui.config/overlays/popover.d.ts +42 -0
  161. package/dist/runtime/ui.config/overlays/popover.mjs +36 -0
  162. package/dist/runtime/ui.config/overlays/slideover.d.ts +27 -0
  163. package/dist/runtime/ui.config/overlays/slideover.mjs +28 -0
  164. package/dist/runtime/ui.config/overlays/tooltip.d.ts +32 -0
  165. package/dist/runtime/ui.config/overlays/tooltip.mjs +26 -0
  166. package/dist/runtime/utils/index.d.ts +5 -0
  167. package/dist/runtime/utils/index.mjs +6 -2
  168. package/dist/types.d.mts +3 -2
  169. package/dist/types.d.ts +3 -2
  170. package/package.json +32 -19
  171. package/dist/runtime/ui.config.d.ts +0 -1470
  172. package/dist/runtime/ui.config.mjs +0 -1273
@@ -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(() => {
@@ -254,12 +254,11 @@ export default defineComponent({
254
254
  searchResults.value[group.key] = await group.search(query.value);
255
255
  }));
256
256
  isLoading.value = false;
257
+ activateFirstOption();
257
258
  }, props.debounce);
258
259
  watch(query, () => {
259
260
  debouncedSearch();
260
- setTimeout(() => {
261
- comboboxInput.value?.$el.dispatchEvent(new KeyboardEvent("keydown", { key: "PageUp" }));
262
- }, 0);
261
+ activateFirstOption();
263
262
  });
264
263
  const iconName = computed(() => {
265
264
  if ((props.loading || isLoading.value) && props.loadingIcon) {
@@ -276,6 +275,11 @@ export default defineComponent({
276
275
  });
277
276
  const emptyState = computed(() => ({ ...ui.value.default.emptyState, ...props.emptyState }));
278
277
  function activateFirstOption() {
278
+ setTimeout(() => {
279
+ comboboxInput.value?.$el.dispatchEvent(new KeyboardEvent("keydown", { key: "PageUp" }));
280
+ }, 0);
281
+ }
282
+ function activateNextOption() {
279
283
  setTimeout(() => {
280
284
  comboboxInput.value?.$el.dispatchEvent(new KeyboardEvent("keydown", { key: "ArrowDown" }));
281
285
  }, 0);
@@ -196,9 +196,9 @@ declare const _default: import("vue").DefineComponent<{
196
196
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
197
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,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
  };
@@ -101,7 +101,7 @@ declare const _default: import("vue").DefineComponent<{
101
101
  validate(value: any): boolean;
102
102
  };
103
103
  size: {
104
- type: PropType<string | number | symbol>;
104
+ type: PropType<ButtonSize>;
105
105
  default: () => any;
106
106
  validator(value: string): boolean;
107
107
  };
@@ -152,9 +152,9 @@ declare const _default: import("vue").DefineComponent<{
152
152
  }>> & {
153
153
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
154
154
  }, {
155
+ size: ButtonSize;
155
156
  ui: Partial<any>;
156
157
  class: any;
157
- size: string | number | symbol;
158
158
  max: number;
159
159
  divider: string;
160
160
  pageCount: number;
@@ -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;
@@ -2,40 +2,38 @@
2
2
  <Transition appear v-bind="ui.transition">
3
3
  <div
4
4
  :class="wrapperClass"
5
- role="status"
5
+ role="status"
6
6
  v-bind="attrs"
7
- @mouseover="onMouseover"
7
+ @mouseover="onMouseover"
8
8
  @mouseleave="onMouseleave"
9
9
  >
10
10
  <div :class="[ui.container, ui.rounded, ui.ring]">
11
- <div :class="ui.padding">
12
- <div class="flex gap-3" :class="{ 'items-start': description || $slots.description, 'items-center': !description && !$slots.description }">
13
- <UIcon v-if="icon" :name="icon" :class="iconClass" />
14
- <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" />
15
14
 
16
- <div class="w-0 flex-1">
17
- <p :class="ui.title">
18
- <slot name="title" :title="title">
19
- {{ title }}
20
- </slot>
21
- </p>
22
- <p v-if="(description || $slots.description)" :class="ui.description">
23
- <slot name="description" :description="description">
24
- {{ description }}
25
- </slot>
26
- </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>
27
26
 
28
- <div v-if="(description || $slots.description) && actions.length" class="mt-3 flex items-center gap-2">
29
- <UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...ui.default.actionButton, ...action }" @click.stop="onAction(action)" />
30
- </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)" />
31
29
  </div>
32
- <div class="flex-shrink-0 flex items-center gap-3">
33
- <div v-if="!description && !$slots.description && actions.length" class="flex items-center gap-2">
34
- <UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...ui.default.actionButton, ...action }" @click.stop="onAction(action)" />
35
- </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>
36
35
 
37
- <UButton v-if="closeButton" aria-label="Close" v-bind="{ ...ui.default.closeButton, ...closeButton }" @click.stop="onClose" />
38
- </div>
36
+ <UButton v-if="closeButton" aria-label="Close" v-bind="{ ...ui.default.closeButton, ...closeButton }" @click.stop="onClose" />
39
37
  </div>
40
38
  </div>
41
39
  <div v-if="timeout" :class="progressClass" :style="progressStyle" />
@@ -90,7 +88,7 @@ export default defineComponent({
90
88
  },
91
89
  timeout: {
92
90
  type: Number,
93
- default: 5e3
91
+ default: () => config.default.timeout
94
92
  },
95
93
  actions: {
96
94
  type: Array,
@@ -200,7 +198,8 @@ export default defineComponent({
200
198
  onMouseover,
201
199
  onMouseleave,
202
200
  onClose,
203
- onAction
201
+ onAction,
202
+ twMerge
204
203
  };
205
204
  }
206
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;
@@ -1,20 +1,22 @@
1
1
  <template>
2
- <div :class="wrapperClass" role="region" v-bind="attrs">
3
- <div v-if="notifications.length" :class="ui.container">
4
- <div v-for="notification of notifications" :key="notification.id">
5
- <UNotification
6
- v-bind="notification"
7
- :class="notification.click && 'cursor-pointer'"
8
- @click="notification.click && notification.click(notification)"
9
- @close="toast.remove(notification.id)"
10
- >
11
- <template v-for="(_, name) in $slots" #[name]="slotData">
12
- <slot :name="name" v-bind="slotData" />
13
- </template>
14
- </UNotification>
2
+ <Teleport to="body">
3
+ <div :class="wrapperClass" role="region" v-bind="attrs">
4
+ <div v-if="notifications.length" :class="ui.container">
5
+ <div v-for="notification of notifications" :key="notification.id">
6
+ <UNotification
7
+ v-bind="notification"
8
+ :class="notification.click && 'cursor-pointer'"
9
+ @click="notification.click && notification.click(notification)"
10
+ @close="toast.remove(notification.id)"
11
+ >
12
+ <template v-for="(_, name) in $slots" #[name]="slotData">
13
+ <slot :name="name" v-bind="slotData" />
14
+ </template>
15
+ </UNotification>
16
+ </div>
15
17
  </div>
16
18
  </div>
17
- </div>
19
+ </Teleport>
18
20
  </template>
19
21
 
20
22
  <script>
@@ -15,6 +15,10 @@
15
15
  </slot>
16
16
  </HPopoverButton>
17
17
 
18
+ <Transition v-if="overlay" appear v-bind="ui.overlay.transition">
19
+ <div v-if="(open !== undefined) ? open : headlessOpen" :class="[ui.overlay.base, ui.overlay.background]" @click="$emit('update:open')" />
20
+ </Transition>
21
+
18
22
  <div v-if="(open !== undefined) ? open : headlessOpen" ref="container" :class="[ui.container, ui.width]" :style="containerStyle" @mouseover="onMouseOver">
19
23
  <Transition appear v-bind="ui.transition">
20
24
  <div>
@@ -67,6 +71,10 @@ export default defineComponent({
67
71
  type: Number,
68
72
  default: 0
69
73
  },
74
+ overlay: {
75
+ type: Boolean,
76
+ default: false
77
+ },
70
78
  popper: {
71
79
  type: Object,
72
80
  default: () => ({})
@@ -80,6 +88,7 @@ export default defineComponent({
80
88
  default: void 0
81
89
  }
82
90
  },
91
+ emits: ["update:open"],
83
92
  setup(props) {
84
93
  const { ui, attrs } = useUI("popover", toRef(props, "ui"), config, toRef(props, "class"));
85
94
  const popper = computed(() => defu(props.mode === "hover" ? { offsetDistance: 0 } : {}, props.popper, ui.value.popper));
@@ -22,6 +22,10 @@ declare const _default: import("vue").DefineComponent<{
22
22
  type: NumberConstructor;
23
23
  default: number;
24
24
  };
25
+ overlay: {
26
+ type: BooleanConstructor;
27
+ default: boolean;
28
+ };
25
29
  popper: {
26
30
  type: PropType<PopperOptions>;
27
31
  default: () => {};
@@ -56,7 +60,7 @@ declare const _default: import("vue").DefineComponent<{
56
60
  }>;
57
61
  onMouseOver: () => void;
58
62
  onMouseLeave: () => void;
59
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
63
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:open"[], "update:open", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
60
64
  mode: {
61
65
  type: PropType<"click" | "hover">;
62
66
  default: string;
@@ -78,6 +82,10 @@ declare const _default: import("vue").DefineComponent<{
78
82
  type: NumberConstructor;
79
83
  default: number;
80
84
  };
85
+ overlay: {
86
+ type: BooleanConstructor;
87
+ default: boolean;
88
+ };
81
89
  popper: {
82
90
  type: PropType<PopperOptions>;
83
91
  default: () => {};
@@ -90,7 +98,9 @@ declare const _default: import("vue").DefineComponent<{
90
98
  type: PropType<Partial<any>>;
91
99
  default: undefined;
92
100
  };
93
- }>>, {
101
+ }>> & {
102
+ "onUpdate:open"?: ((...args: any[]) => any) | undefined;
103
+ }, {
94
104
  ui: Partial<any>;
95
105
  popper: PopperOptions;
96
106
  class: any;
@@ -99,5 +109,6 @@ declare const _default: import("vue").DefineComponent<{
99
109
  mode: "click" | "hover";
100
110
  openDelay: number;
101
111
  closeDelay: number;
112
+ overlay: boolean;
102
113
  }, {}>;
103
114
  export default _default;
@@ -2,7 +2,7 @@ import type { WatchSource } from 'vue';
2
2
  export interface ShortcutConfig {
3
3
  handler: Function;
4
4
  usingInput?: string | boolean;
5
- whenever?: WatchSource<Boolean>[];
5
+ whenever?: WatchSource<boolean>[];
6
6
  }
7
7
  export interface ShortcutsConfig {
8
8
  [key: string]: ShortcutConfig | Function;
@@ -2,6 +2,8 @@ import { ref, computed } from "vue";
2
2
  import { logicAnd, logicNot } from "@vueuse/math";
3
3
  import { useEventListener, useDebounceFn } from "@vueuse/core";
4
4
  import { useShortcuts } from "./useShortcuts.mjs";
5
+ const chainedShortcutRegex = /^[^-]+.*-.*[^-]+$/;
6
+ const combinedShortcutRegex = /^[^_]+.*_.*[^_]+$/;
5
7
  export const defineShortcuts = (config, options = {}) => {
6
8
  const { macOS, usingInput } = useShortcuts();
7
9
  let shortcuts = [];
@@ -58,11 +60,13 @@ export const defineShortcuts = (config, options = {}) => {
58
60
  return null;
59
61
  }
60
62
  let shortcut;
61
- if (key.includes("-") && key.includes("_")) {
62
- console.trace("[Shortcut] Invalid key");
63
- return null;
63
+ if (key.includes("-") && key !== "-" && !key.match(chainedShortcutRegex)?.length) {
64
+ console.trace(`[Shortcut] Invalid key: "${key}"`);
65
+ }
66
+ if (key.includes("_") && key !== "_" && !key.match(combinedShortcutRegex)?.length) {
67
+ console.trace(`[Shortcut] Invalid key: "${key}"`);
64
68
  }
65
- const chained = key.includes("-");
69
+ const chained = key.includes("-") && key !== "-";
66
70
  if (chained) {
67
71
  shortcut = {
68
72
  key: key.toLowerCase(),
@@ -0,0 +1,20 @@
1
+ import type { Ref } from 'vue';
2
+ import { buttonGroup } from '#ui/ui.config';
3
+ type ButtonGroupProps = {
4
+ orientation?: Ref<'horizontal' | 'vertical'>;
5
+ size?: Ref<string>;
6
+ ui?: Ref<Partial<typeof buttonGroup>>;
7
+ rounded?: Ref<{
8
+ start: string;
9
+ end: string;
10
+ }>;
11
+ };
12
+ export declare function useProvideButtonGroup(buttonGroupProps: ButtonGroupProps): void;
13
+ export declare function useInjectButtonGroup({ ui, props }: {
14
+ ui: any;
15
+ props: any;
16
+ }): {
17
+ size: import("vue").ComputedRef<any>;
18
+ rounded: import("vue").ComputedRef<any>;
19
+ };
20
+ export {};
@@ -0,0 +1,52 @@
1
+ import { computed, ref, provide, inject, onMounted, onUnmounted, getCurrentInstance } from "vue";
2
+ export function useProvideButtonGroup(buttonGroupProps) {
3
+ const instance = getCurrentInstance();
4
+ const groupKey = `group-${instance.uid}`;
5
+ const state = ref({
6
+ children: [],
7
+ register(child) {
8
+ this.children.push(child);
9
+ },
10
+ unregister(child) {
11
+ const index = this.children.indexOf(child);
12
+ if (index > -1) {
13
+ this.children.splice(index, 1);
14
+ }
15
+ },
16
+ ...buttonGroupProps
17
+ });
18
+ provide(groupKey, state);
19
+ }
20
+ export function useInjectButtonGroup({ ui, props }) {
21
+ const instance = getCurrentInstance();
22
+ let parent = instance.parent;
23
+ let groupContext;
24
+ while (parent && !groupContext) {
25
+ if (parent.type.name === "ButtonGroup") {
26
+ groupContext = inject(`group-${parent.uid}`);
27
+ break;
28
+ }
29
+ parent = parent.parent;
30
+ }
31
+ const positionInGroup = computed(() => groupContext?.value.children.indexOf(instance));
32
+ onMounted(() => {
33
+ groupContext?.value.register(instance);
34
+ });
35
+ onUnmounted(() => {
36
+ groupContext?.value.unregister(instance);
37
+ });
38
+ return {
39
+ size: computed(() => groupContext?.value.size || props.size),
40
+ rounded: computed(() => {
41
+ if (!groupContext || positionInGroup.value === -1)
42
+ return ui.value.rounded;
43
+ if (groupContext.value.children.length === 1)
44
+ return groupContext.value.ui.rounded;
45
+ if (positionInGroup.value === 0)
46
+ return groupContext.value.rounded.start;
47
+ if (positionInGroup.value === groupContext.value.children.length - 1)
48
+ return groupContext.value.rounded.end;
49
+ return "rounded-none";
50
+ })
51
+ };
52
+ }
@@ -1,11 +1,13 @@
1
1
  type InputProps = {
2
- id?: string;
2
+ id?: string | null;
3
3
  size?: string | number | symbol;
4
4
  color?: string;
5
5
  name?: string;
6
+ isFieldset?: boolean;
7
+ eagerValidation?: boolean;
6
8
  };
7
9
  export declare const useFormGroup: (inputProps?: InputProps, config?: any) => {
8
- inputId: import("vue").Ref<string | undefined>;
10
+ inputId: import("vue").Ref<string | null | undefined>;
9
11
  name: import("vue").ComputedRef<string | undefined>;
10
12
  size: import("vue").ComputedRef<any>;
11
13
  color: import("vue").ComputedRef<string | undefined>;
@@ -1,12 +1,13 @@
1
1
  import { inject, ref, computed, onMounted } from "vue";
2
2
  import { useDebounceFn } from "@vueuse/core";
3
+ import { uid } from "../utils/uid.mjs";
3
4
  export const useFormGroup = (inputProps, config) => {
4
5
  const formBus = inject("form-events", void 0);
5
6
  const formGroup = inject("form-group", void 0);
6
7
  const formInputs = inject("form-inputs", void 0);
7
8
  const inputId = ref(inputProps?.id);
8
9
  onMounted(() => {
9
- inputId.value = inputProps?.id ?? formGroup?.inputId.value;
10
+ inputId.value = inputProps?.isFieldset ? null : inputProps?.id ?? uid();
10
11
  if (formGroup) {
11
12
  formGroup.inputId.value = inputId.value;
12
13
  if (formInputs) {
@@ -28,7 +29,7 @@ export const useFormGroup = (inputProps, config) => {
28
29
  emitFormEvent("change", formGroup?.name.value);
29
30
  }
30
31
  const emitFormInput = useDebounceFn(() => {
31
- if (blurred.value) {
32
+ if (blurred.value || formGroup?.eagerValidation.value) {
32
33
  emitFormEvent("input", formGroup?.name.value);
33
34
  }
34
35
  }, 300);
@@ -1,11 +1,11 @@
1
1
  export declare const _useShortcuts: () => {
2
- macOS: import("vue").ComputedRef<any>;
2
+ macOS: import("vue").ComputedRef<false | "" | RegExpMatchArray | null | undefined>;
3
3
  metaSymbol: import("vue").Ref<string>;
4
4
  activeElement: import("@vueuse/shared").ComputedRefWithControl<HTMLElement | null | undefined>;
5
5
  usingInput: import("vue").ComputedRef<string | boolean>;
6
6
  };
7
7
  export declare const useShortcuts: () => {
8
- macOS: import("vue").ComputedRef<any>;
8
+ macOS: import("vue").ComputedRef<false | "" | RegExpMatchArray | null | undefined>;
9
9
  metaSymbol: import("vue").Ref<string>;
10
10
  activeElement: import("@vueuse/shared").ComputedRefWithControl<HTMLElement | null | undefined>;
11
11
  usingInput: import("vue").ComputedRef<string | boolean>;
@@ -0,0 +1,7 @@
1
+ import { alert } from '../ui.config'
2
+ import type { NestedKeyOf, ExtractDeepKey, ExtractDeepObject } from '.'
3
+ import colors from '#ui-colors'
4
+ import type { AppConfig } from 'nuxt/schema'
5
+
6
+ export type AlertColor = keyof typeof alert.color | ExtractDeepKey<AppConfig, ['ui', 'alert', 'color']> | typeof colors[number]
7
+ export type AlertVariant = keyof typeof alert.variant | ExtractDeepKey<AppConfig, ['ui', 'alert', 'variant']> | NestedKeyOf<typeof alert.color> | NestedKeyOf<ExtractDeepObject<AppConfig, ['ui', 'alert', 'color']>>
@@ -1,7 +1,9 @@
1
1
  import { avatar } from '../ui.config'
2
+ import type { ExtractDeepKey } from '.'
2
3
  import colors from '#ui-colors'
4
+ import type { AppConfig } from 'nuxt/schema'
3
5
 
4
- export type AvatarSize = keyof typeof avatar.size
6
+ export type AvatarSize = keyof typeof avatar.size | ExtractDeepKey<AppConfig, ['ui', 'avatar', 'size']>
5
7
  export type AvatarChipColor = 'gray' | typeof colors[number]
6
8
  export type AvatarChipPosition = keyof typeof avatar.chip.position
7
9