@nuxt/ui 2.9.0 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/README.md +11 -0
  2. package/dist/module.d.mts +449 -72
  3. package/dist/module.d.ts +449 -72
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +32 -6
  6. package/dist/runtime/components/data/Table.vue +8 -6
  7. package/dist/runtime/components/data/Table.vue.d.ts +2 -1
  8. package/dist/runtime/components/elements/Accordion.vue +15 -13
  9. package/dist/runtime/components/elements/Accordion.vue.d.ts +5 -2
  10. package/dist/runtime/components/elements/Alert.vue +7 -6
  11. package/dist/runtime/components/elements/Alert.vue.d.ts +6 -5
  12. package/dist/runtime/components/elements/Avatar.vue.d.ts +5 -4
  13. package/dist/runtime/components/elements/AvatarGroup.d.ts +4 -3
  14. package/dist/runtime/components/elements/Badge.vue +4 -2
  15. package/dist/runtime/components/elements/Badge.vue.d.ts +5 -5
  16. package/dist/runtime/components/elements/Button.vue +8 -6
  17. package/dist/runtime/components/elements/Button.vue.d.ts +7 -7
  18. package/dist/runtime/components/elements/ButtonGroup.d.ts +5 -4
  19. package/dist/runtime/components/elements/ButtonGroup.mjs +19 -32
  20. package/dist/runtime/components/elements/Chip.vue +85 -0
  21. package/dist/runtime/components/elements/Chip.vue.d.ts +90 -0
  22. package/dist/runtime/components/elements/Dropdown.vue +45 -25
  23. package/dist/runtime/components/elements/Dropdown.vue.d.ts +8 -0
  24. package/dist/runtime/components/elements/Icon.vue +16 -2
  25. package/dist/runtime/components/elements/Icon.vue.d.ts +14 -2
  26. package/dist/runtime/components/elements/Kbd.vue.d.ts +5 -4
  27. package/dist/runtime/components/elements/Link.vue +2 -5
  28. package/dist/runtime/components/elements/Meter.vue +166 -0
  29. package/dist/runtime/components/elements/Meter.vue.d.ts +123 -0
  30. package/dist/runtime/components/elements/MeterGroup.d.ts +78 -0
  31. package/dist/runtime/components/elements/MeterGroup.mjs +172 -0
  32. package/dist/runtime/components/elements/Progress.vue +284 -0
  33. package/dist/runtime/components/elements/Progress.vue.d.ts +2 -0
  34. package/dist/runtime/components/forms/Checkbox.vue +2 -4
  35. package/dist/runtime/components/forms/Checkbox.vue.d.ts +6 -6
  36. package/dist/runtime/components/forms/Form.vue +32 -7
  37. package/dist/runtime/components/forms/Form.vue.d.ts +2 -1
  38. package/dist/runtime/components/forms/FormGroup.vue +7 -3
  39. package/dist/runtime/components/forms/FormGroup.vue.d.ts +15 -5
  40. package/dist/runtime/components/forms/Input.vue +41 -6
  41. package/dist/runtime/components/forms/Input.vue.d.ts +42 -10
  42. package/dist/runtime/components/forms/Radio.vue +16 -9
  43. package/dist/runtime/components/forms/Radio.vue.d.ts +8 -7
  44. package/dist/runtime/components/forms/RadioGroup.vue +136 -0
  45. package/dist/runtime/components/forms/RadioGroup.vue.d.ts +118 -0
  46. package/dist/runtime/components/forms/Range.vue.d.ts +8 -7
  47. package/dist/runtime/components/forms/Select.vue +5 -2
  48. package/dist/runtime/components/forms/Select.vue.d.ts +10 -9
  49. package/dist/runtime/components/forms/SelectMenu.vue +80 -58
  50. package/dist/runtime/components/forms/SelectMenu.vue.d.ts +23 -13
  51. package/dist/runtime/components/forms/Textarea.vue +38 -4
  52. package/dist/runtime/components/forms/Textarea.vue.d.ts +41 -9
  53. package/dist/runtime/components/forms/Toggle.vue +19 -1
  54. package/dist/runtime/components/forms/Toggle.vue.d.ts +16 -3
  55. package/dist/runtime/components/layout/Divider.vue +107 -0
  56. package/dist/runtime/components/layout/Divider.vue.d.ts +82 -0
  57. package/dist/runtime/components/navigation/Breadcrumb.vue +78 -0
  58. package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +50 -0
  59. package/dist/runtime/components/navigation/CommandPalette.vue +18 -7
  60. package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +2 -2
  61. package/dist/runtime/components/navigation/Pagination.vue +65 -9
  62. package/dist/runtime/components/navigation/Pagination.vue.d.ts +45 -7
  63. package/dist/runtime/components/navigation/Tabs.vue +1 -1
  64. package/dist/runtime/components/navigation/Tabs.vue.d.ts +1 -1
  65. package/dist/runtime/components/overlays/ContextMenu.vue +7 -2
  66. package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +2 -1
  67. package/dist/runtime/components/overlays/Modal.vue +1 -1
  68. package/dist/runtime/components/overlays/Modal.vue.d.ts +1 -1
  69. package/dist/runtime/components/overlays/Notification.vue +32 -27
  70. package/dist/runtime/components/overlays/Notification.vue.d.ts +4 -3
  71. package/dist/runtime/components/overlays/Notifications.vue +16 -14
  72. package/dist/runtime/components/overlays/Popover.vue +31 -7
  73. package/dist/runtime/components/overlays/Popover.vue.d.ts +27 -2
  74. package/dist/runtime/components/overlays/Slideover.vue.d.ts +1 -1
  75. package/dist/runtime/components/overlays/Tooltip.vue +16 -10
  76. package/dist/runtime/components/overlays/Tooltip.vue.d.ts +1 -0
  77. package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
  78. package/dist/runtime/composables/defineShortcuts.mjs +8 -4
  79. package/dist/runtime/composables/useButtonGroup.d.ts +20 -0
  80. package/dist/runtime/composables/useButtonGroup.mjs +52 -0
  81. package/dist/runtime/composables/useFormGroup.d.ts +6 -4
  82. package/dist/runtime/composables/useFormGroup.mjs +19 -7
  83. package/dist/runtime/composables/usePopper.d.ts +3 -3
  84. package/dist/runtime/composables/usePopper.mjs +7 -1
  85. package/dist/runtime/composables/useShortcuts.d.ts +2 -2
  86. package/dist/runtime/composables/useUI.d.ts +2 -2
  87. package/dist/runtime/composables/useUI.mjs +2 -2
  88. package/dist/runtime/types/alert.d.ts +7 -0
  89. package/dist/runtime/types/avatar.d.ts +3 -1
  90. package/dist/runtime/types/badge.d.ts +5 -4
  91. package/dist/runtime/types/breadcrumb.d.ts +7 -0
  92. package/dist/runtime/types/button.d.ts +5 -4
  93. package/dist/runtime/types/chip.d.ts +11 -0
  94. package/dist/runtime/types/command-palette.d.ts +1 -0
  95. package/dist/runtime/types/dropdown.d.ts +2 -2
  96. package/dist/runtime/types/form-group.d.ts +5 -0
  97. package/dist/runtime/types/form.d.ts +14 -6
  98. package/dist/runtime/types/index.d.ts +12 -0
  99. package/dist/runtime/types/input.d.ts +8 -0
  100. package/dist/runtime/types/kbd.d.ts +5 -0
  101. package/dist/runtime/types/meter.d.ts +5 -0
  102. package/dist/runtime/types/popper.d.ts +1 -0
  103. package/dist/runtime/types/progress.d.ts +4 -0
  104. package/dist/runtime/types/range.d.ts +5 -0
  105. package/dist/runtime/types/select.d.ts +8 -0
  106. package/dist/runtime/types/textarea.d.ts +8 -0
  107. package/dist/runtime/types/toggle.d.ts +5 -0
  108. package/dist/runtime/types/utils.d.ts +22 -5
  109. package/dist/runtime/ui.config/_popperArrow.d.ts +9 -0
  110. package/dist/runtime/ui.config/_popperArrow.mjs +8 -0
  111. package/dist/runtime/ui.config/data/table.d.ts +60 -0
  112. package/dist/runtime/ui.config/data/table.mjs +59 -0
  113. package/dist/runtime/ui.config/elements/accordion.d.ts +21 -0
  114. package/dist/runtime/ui.config/elements/accordion.mjs +20 -0
  115. package/dist/runtime/ui.config/elements/alert.d.ts +40 -0
  116. package/dist/runtime/ui.config/elements/alert.mjs +39 -0
  117. package/dist/runtime/ui.config/elements/avatar.d.ts +60 -0
  118. package/dist/runtime/ui.config/elements/avatar.mjs +59 -0
  119. package/dist/runtime/ui.config/elements/avatarGroup.d.ts +6 -0
  120. package/dist/runtime/ui.config/elements/avatarGroup.mjs +5 -0
  121. package/dist/runtime/ui.config/elements/badge.d.ts +34 -0
  122. package/dist/runtime/ui.config/elements/badge.mjs +33 -0
  123. package/dist/runtime/ui.config/elements/button.d.ts +77 -0
  124. package/dist/runtime/ui.config/elements/button.mjs +76 -0
  125. package/dist/runtime/ui.config/elements/buttonGroup.d.ts +9 -0
  126. package/dist/runtime/ui.config/elements/buttonGroup.mjs +8 -0
  127. package/dist/runtime/ui.config/elements/chip.d.ts +35 -0
  128. package/dist/runtime/ui.config/elements/chip.mjs +34 -0
  129. package/dist/runtime/ui.config/elements/dropdown.d.ts +53 -0
  130. package/dist/runtime/ui.config/elements/dropdown.mjs +51 -0
  131. package/dist/runtime/ui.config/elements/kbd.d.ts +17 -0
  132. package/dist/runtime/ui.config/elements/kbd.mjs +16 -0
  133. package/dist/runtime/ui.config/elements/meter.d.ts +77 -0
  134. package/dist/runtime/ui.config/elements/meter.mjs +76 -0
  135. package/dist/runtime/ui.config/elements/meterGroup.d.ts +12 -0
  136. package/dist/runtime/ui.config/elements/meterGroup.mjs +11 -0
  137. package/dist/runtime/ui.config/elements/progress.d.ts +75 -0
  138. package/dist/runtime/ui.config/elements/progress.mjs +74 -0
  139. package/dist/runtime/ui.config/forms/checkbox.d.ts +16 -0
  140. package/dist/runtime/ui.config/forms/checkbox.mjs +15 -0
  141. package/dist/runtime/ui.config/forms/formGroup.d.ts +25 -0
  142. package/dist/runtime/ui.config/forms/formGroup.mjs +25 -0
  143. package/dist/runtime/ui.config/forms/input.d.ts +105 -0
  144. package/dist/runtime/ui.config/forms/input.mjs +104 -0
  145. package/dist/runtime/ui.config/forms/radio.d.ts +15 -0
  146. package/dist/runtime/ui.config/forms/radio.mjs +14 -0
  147. package/dist/runtime/ui.config/forms/radioGroup.d.ts +8 -0
  148. package/dist/runtime/ui.config/forms/radioGroup.mjs +7 -0
  149. package/dist/runtime/ui.config/forms/range.d.ts +64 -0
  150. package/dist/runtime/ui.config/forms/range.mjs +63 -0
  151. package/dist/runtime/ui.config/forms/select.d.ts +106 -0
  152. package/dist/runtime/ui.config/forms/select.mjs +12 -0
  153. package/dist/runtime/ui.config/forms/selectMenu.d.ts +63 -0
  154. package/dist/runtime/ui.config/forms/selectMenu.mjs +61 -0
  155. package/dist/runtime/ui.config/forms/textarea.d.ts +104 -0
  156. package/dist/runtime/ui.config/forms/textarea.mjs +9 -0
  157. package/dist/runtime/ui.config/forms/toggle.d.ts +61 -0
  158. package/dist/runtime/ui.config/forms/toggle.mjs +60 -0
  159. package/dist/runtime/ui.config/index.d.ts +40 -0
  160. package/dist/runtime/ui.config/index.mjs +40 -0
  161. package/dist/runtime/ui.config/layout/card.d.ts +24 -0
  162. package/dist/runtime/ui.config/layout/card.mjs +23 -0
  163. package/dist/runtime/ui.config/layout/container.d.ts +6 -0
  164. package/dist/runtime/ui.config/layout/container.mjs +5 -0
  165. package/dist/runtime/ui.config/layout/divider.d.ts +30 -0
  166. package/dist/runtime/ui.config/layout/divider.mjs +29 -0
  167. package/dist/runtime/ui.config/layout/skeleton.d.ts +6 -0
  168. package/dist/runtime/ui.config/layout/skeleton.mjs +5 -0
  169. package/dist/runtime/ui.config/navigation/breadcrumb.d.ts +20 -0
  170. package/dist/runtime/ui.config/navigation/breadcrumb.mjs +19 -0
  171. package/dist/runtime/ui.config/navigation/commandPalette.d.ts +68 -0
  172. package/dist/runtime/ui.config/navigation/commandPalette.mjs +67 -0
  173. package/dist/runtime/ui.config/navigation/pagination.d.ts +35 -0
  174. package/dist/runtime/ui.config/navigation/pagination.mjs +34 -0
  175. package/dist/runtime/ui.config/navigation/tabs.d.ts +34 -0
  176. package/dist/runtime/ui.config/navigation/tabs.mjs +33 -0
  177. package/dist/runtime/ui.config/navigation/verticalNavigation.d.ts +28 -0
  178. package/dist/runtime/ui.config/navigation/verticalNavigation.mjs +27 -0
  179. package/dist/runtime/ui.config/overlays/contextMenu.d.ts +31 -0
  180. package/dist/runtime/ui.config/overlays/contextMenu.mjs +25 -0
  181. package/dist/runtime/ui.config/overlays/modal.d.ts +35 -0
  182. package/dist/runtime/ui.config/overlays/modal.mjs +36 -0
  183. package/dist/runtime/ui.config/overlays/notification.d.ts +49 -0
  184. package/dist/runtime/ui.config/overlays/notification.mjs +49 -0
  185. package/dist/runtime/ui.config/overlays/notifications.d.ts +7 -0
  186. package/dist/runtime/ui.config/overlays/notifications.mjs +6 -0
  187. package/dist/runtime/ui.config/overlays/popover.d.ts +42 -0
  188. package/dist/runtime/ui.config/overlays/popover.mjs +36 -0
  189. package/dist/runtime/ui.config/overlays/slideover.d.ts +27 -0
  190. package/dist/runtime/ui.config/overlays/slideover.mjs +28 -0
  191. package/dist/runtime/ui.config/overlays/tooltip.d.ts +32 -0
  192. package/dist/runtime/ui.config/overlays/tooltip.mjs +26 -0
  193. package/dist/runtime/utils/index.d.ts +5 -0
  194. package/dist/runtime/utils/index.mjs +6 -2
  195. package/dist/types.d.mts +3 -2
  196. package/dist/types.d.ts +3 -2
  197. package/package.json +41 -28
  198. package/dist/runtime/ui.config.d.ts +0 -1207
  199. package/dist/runtime/ui.config.mjs +0 -1029
  200. package/dist/runtime/utils/StateEmitter.d.ts +0 -17
  201. package/dist/runtime/utils/StateEmitter.mjs +0 -21
@@ -1,20 +1,22 @@
1
1
  <template>
2
- <div :class="wrapperClass" 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>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <HPopover ref="popover" v-slot="{ open, close }" :class="ui.wrapper" v-bind="attrs" @mouseleave="onMouseLeave">
2
+ <HPopover ref="popover" v-slot="{ open: headlessOpen, close }" :class="ui.wrapper" v-bind="attrs" @mouseleave="onMouseLeave">
3
3
  <HPopoverButton
4
4
  ref="trigger"
5
5
  as="div"
@@ -8,18 +8,25 @@
8
8
  role="button"
9
9
  @mouseover="onMouseOver"
10
10
  >
11
- <slot :open="open" :close="close">
11
+ <slot :open="(open !== undefined) ? open : headlessOpen" :close="close">
12
12
  <button :disabled="disabled">
13
13
  Open
14
14
  </button>
15
15
  </slot>
16
16
  </HPopoverButton>
17
17
 
18
- <div v-if="open" ref="container" :class="[ui.container, ui.width]" :style="containerStyle" @mouseover="onMouseOver">
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
+
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
- <HPopoverPanel :class="[ui.base, ui.background, ui.ring, ui.rounded, ui.shadow]" static>
21
- <slot name="panel" :open="open" :close="close" />
22
- </HPopoverPanel>
24
+ <div>
25
+ <div v-if="popper.arrow" data-popper-arrow :class="['invisible before:visible before:block before:rotate-45 before:z-[-1]', Object.values(ui.arrow)]" />
26
+ <HPopoverPanel :class="[ui.base, ui.background, ui.ring, ui.rounded, ui.shadow]" static>
27
+ <slot name="panel" :open="(open !== undefined) ? open : headlessOpen" :close="close" />
28
+ </HPopoverPanel>
29
+ </div>
23
30
  </Transition>
24
31
  </div>
25
32
  </HPopover>
@@ -48,6 +55,10 @@ export default defineComponent({
48
55
  default: "click",
49
56
  validator: (value) => ["click", "hover"].includes(value)
50
57
  },
58
+ open: {
59
+ type: Boolean,
60
+ default: void 0
61
+ },
51
62
  disabled: {
52
63
  type: Boolean,
53
64
  default: false
@@ -60,6 +71,10 @@ export default defineComponent({
60
71
  type: Number,
61
72
  default: 0
62
73
  },
74
+ overlay: {
75
+ type: Boolean,
76
+ default: false
77
+ },
63
78
  popper: {
64
79
  type: Object,
65
80
  default: () => ({})
@@ -73,6 +88,7 @@ export default defineComponent({
73
88
  default: void 0
74
89
  }
75
90
  },
91
+ emits: ["update:open"],
76
92
  setup(props) {
77
93
  const { ui, attrs } = useUI("popover", toRef(props, "ui"), config, toRef(props, "class"));
78
94
  const popper = computed(() => defu(props.mode === "hover" ? { offsetDistance: 0 } : {}, props.popper, ui.value.popper));
@@ -91,7 +107,13 @@ export default defineComponent({
91
107
  });
92
108
  const containerStyle = computed(() => {
93
109
  const offsetDistance = props.popper?.offsetDistance || ui.value.popper?.offsetDistance || 8;
94
- return props.mode === "hover" ? { paddingTop: `${offsetDistance}px`, paddingBottom: `${offsetDistance}px` } : {};
110
+ const padding = `${offsetDistance}px`;
111
+ return props.mode === "hover" ? {
112
+ paddingTop: padding,
113
+ paddingBottom: padding,
114
+ paddingLeft: padding,
115
+ paddingRight: padding
116
+ } : {};
95
117
  });
96
118
  function onMouseOver() {
97
119
  if (props.mode !== "hover" || !popoverApi.value) {
@@ -130,6 +152,8 @@ export default defineComponent({
130
152
  ui,
131
153
  attrs,
132
154
  popover: popover2,
155
+ // eslint-disable-next-line vue/no-dupe-keys
156
+ popper,
133
157
  trigger,
134
158
  container,
135
159
  containerStyle,
@@ -6,6 +6,10 @@ declare const _default: import("vue").DefineComponent<{
6
6
  default: string;
7
7
  validator: (value: string) => boolean;
8
8
  };
9
+ open: {
10
+ type: BooleanConstructor;
11
+ default: undefined;
12
+ };
9
13
  disabled: {
10
14
  type: BooleanConstructor;
11
15
  default: boolean;
@@ -18,6 +22,10 @@ declare const _default: import("vue").DefineComponent<{
18
22
  type: NumberConstructor;
19
23
  default: number;
20
24
  };
25
+ overlay: {
26
+ type: BooleanConstructor;
27
+ default: boolean;
28
+ };
21
29
  popper: {
22
30
  type: PropType<PopperOptions>;
23
31
  default: () => {};
@@ -36,23 +44,32 @@ declare const _default: import("vue").DefineComponent<{
36
44
  [x: string]: unknown;
37
45
  }, string>>;
38
46
  popover: any;
47
+ popper: import("vue").ComputedRef<PopperOptions>;
39
48
  trigger: import("vue").Ref<import("@vueuse/core").MaybeElement>;
40
49
  container: import("vue").Ref<import("@vueuse/core").MaybeElement>;
41
50
  containerStyle: import("vue").ComputedRef<{
42
51
  paddingTop: string;
43
52
  paddingBottom: string;
53
+ paddingLeft: string;
54
+ paddingRight: string;
44
55
  } | {
45
56
  paddingTop?: undefined;
46
57
  paddingBottom?: undefined;
58
+ paddingLeft?: undefined;
59
+ paddingRight?: undefined;
47
60
  }>;
48
61
  onMouseOver: () => void;
49
62
  onMouseLeave: () => void;
50
- }, 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<{
51
64
  mode: {
52
65
  type: PropType<"click" | "hover">;
53
66
  default: string;
54
67
  validator: (value: string) => boolean;
55
68
  };
69
+ open: {
70
+ type: BooleanConstructor;
71
+ default: undefined;
72
+ };
56
73
  disabled: {
57
74
  type: BooleanConstructor;
58
75
  default: boolean;
@@ -65,6 +82,10 @@ declare const _default: import("vue").DefineComponent<{
65
82
  type: NumberConstructor;
66
83
  default: number;
67
84
  };
85
+ overlay: {
86
+ type: BooleanConstructor;
87
+ default: boolean;
88
+ };
68
89
  popper: {
69
90
  type: PropType<PopperOptions>;
70
91
  default: () => {};
@@ -77,13 +98,17 @@ declare const _default: import("vue").DefineComponent<{
77
98
  type: PropType<Partial<any>>;
78
99
  default: undefined;
79
100
  };
80
- }>>, {
101
+ }>> & {
102
+ "onUpdate:open"?: ((...args: any[]) => any) | undefined;
103
+ }, {
81
104
  ui: Partial<any>;
82
105
  popper: PopperOptions;
83
106
  class: any;
84
107
  disabled: boolean;
108
+ open: boolean;
85
109
  mode: "click" | "hover";
86
110
  openDelay: number;
87
111
  closeDelay: number;
112
+ overlay: boolean;
88
113
  }, {}>;
89
114
  export default _default;
@@ -76,8 +76,8 @@ declare const _default: import("vue").DefineComponent<{
76
76
  default: undefined;
77
77
  };
78
78
  }>> & {
79
- onClose?: ((...args: any[]) => any) | undefined;
80
79
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
80
+ onClose?: ((...args: any[]) => any) | undefined;
81
81
  }, {
82
82
  ui: Partial<any>;
83
83
  class: any;
@@ -6,17 +6,21 @@
6
6
 
7
7
  <div v-if="open && !prevent" ref="container" :class="[ui.container, ui.width]">
8
8
  <Transition appear v-bind="ui.transition">
9
- <div :class="[ui.base, ui.background, ui.color, ui.rounded, ui.shadow, ui.ring]">
10
- <slot name="text">
11
- {{ text }}
12
- </slot>
9
+ <div>
10
+ <div v-if="popper.arrow" data-popper-arrow :class="['invisible before:visible before:block before:rotate-45 before:z-[-1]', Object.values(ui.arrow)]" />
13
11
 
14
- <span v-if="shortcuts?.length" :class="ui.shortcuts">
15
- <span class="mx-1 text-gray-700 dark:text-gray-200">&middot;</span>
16
- <UKbd v-for="shortcut of shortcuts" :key="shortcut" size="xs">
17
- {{ shortcut }}
18
- </Ukbd>
19
- </span>
12
+ <div :class="[ui.base, ui.background, ui.color, ui.rounded, ui.shadow, ui.ring]">
13
+ <slot name="text">
14
+ {{ text }}
15
+ </slot>
16
+
17
+ <span v-if="shortcuts?.length" :class="ui.shortcuts">
18
+ <span class="mx-1 text-gray-700 dark:text-gray-200">&middot;</span>
19
+ <UKbd v-for="shortcut of shortcuts" :key="shortcut" size="xs">
20
+ {{ shortcut }}
21
+ </Ukbd>
22
+ </span>
23
+ </div>
20
24
  </div>
21
25
  </Transition>
22
26
  </div>
@@ -109,6 +113,8 @@ export default defineComponent({
109
113
  // eslint-disable-next-line vue/no-dupe-keys
110
114
  ui,
111
115
  attrs,
116
+ // eslint-disable-next-line vue/no-dupe-keys
117
+ popper,
112
118
  trigger,
113
119
  container,
114
120
  open,
@@ -38,6 +38,7 @@ declare const _default: import("vue").DefineComponent<{
38
38
  attrs: import("vue").ComputedRef<Pick<{
39
39
  [x: string]: unknown;
40
40
  }, string>>;
41
+ popper: import("vue").ComputedRef<PopperOptions>;
41
42
  trigger: import("vue").Ref<import("@vueuse/core").MaybeElement>;
42
43
  container: import("vue").Ref<import("@vueuse/core").MaybeElement>;
43
44
  open: import("vue").Ref<boolean>;
@@ -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,12 +1,14 @@
1
1
  type InputProps = {
2
- id?: string;
3
- size?: string;
2
+ id?: string | null;
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").ComputedRef<any>;
9
- name: import("vue").ComputedRef<any>;
10
+ inputId: import("vue").Ref<string | null | undefined>;
11
+ name: import("vue").ComputedRef<string | undefined>;
10
12
  size: import("vue").ComputedRef<any>;
11
13
  color: import("vue").ComputedRef<string | undefined>;
12
14
  emitFormBlur: () => void;
@@ -1,11 +1,20 @@
1
- import { inject, ref, computed } from "vue";
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
- if (formGroup) {
7
- formGroup.inputId.value = inputProps?.id ?? formGroup?.inputId.value;
8
- }
7
+ const formInputs = inject("form-inputs", void 0);
8
+ const inputId = ref(inputProps?.id);
9
+ onMounted(() => {
10
+ inputId.value = inputProps?.isFieldset ? null : inputProps?.id ?? uid();
11
+ if (formGroup) {
12
+ formGroup.inputId.value = inputId.value;
13
+ if (formInputs) {
14
+ formInputs.value[formGroup.name.value] = inputId;
15
+ }
16
+ }
17
+ });
9
18
  const blurred = ref(false);
10
19
  function emitFormEvent(type, path) {
11
20
  if (formBus) {
@@ -20,14 +29,17 @@ export const useFormGroup = (inputProps, config) => {
20
29
  emitFormEvent("change", formGroup?.name.value);
21
30
  }
22
31
  const emitFormInput = useDebounceFn(() => {
23
- if (blurred.value) {
32
+ if (blurred.value || formGroup?.eagerValidation.value) {
24
33
  emitFormEvent("input", formGroup?.name.value);
25
34
  }
26
35
  }, 300);
27
36
  return {
28
- inputId: computed(() => inputProps.id ?? formGroup?.inputId.value),
37
+ inputId,
29
38
  name: computed(() => inputProps?.name ?? formGroup?.name.value),
30
- size: computed(() => inputProps?.size ?? formGroup?.size.value ?? config?.default?.size),
39
+ size: computed(() => {
40
+ const formGroupSize = config.size[formGroup?.size.value] ? formGroup?.size.value : null;
41
+ return inputProps?.size ?? formGroupSize ?? config?.default?.size;
42
+ }),
31
43
  color: computed(() => formGroup?.error?.value ? "red" : inputProps?.color),
32
44
  emitFormBlur,
33
45
  emitFormInput,
@@ -1,10 +1,10 @@
1
1
  import type { Ref } from 'vue';
2
- import { VirtualElement } from '@popperjs/core/lib/popper-lite';
2
+ import type { VirtualElement } from '@popperjs/core/lib/popper-lite';
3
3
  import type { Instance } from '@popperjs/core';
4
- import { MaybeElement } from '@vueuse/core';
4
+ import type { MaybeElement } from '@vueuse/core';
5
5
  import type { PopperOptions } from '../types/popper';
6
6
  export declare const createPopper: <TModifier extends Partial<import("@popperjs/core").Modifier<any, any>>>(reference: Element | VirtualElement, popper: HTMLElement, options?: Partial<import("@popperjs/core").OptionsGeneric<TModifier>> | undefined) => Instance;
7
- export declare function usePopper({ locked, overflowPadding, offsetDistance, offsetSkid, gpuAcceleration, adaptive, scroll, resize, placement, strategy }: PopperOptions, virtualReference?: Ref<Element | VirtualElement>): readonly [Ref<MaybeElement>, Ref<MaybeElement>, Ref<{
7
+ export declare function usePopper({ locked, overflowPadding, offsetDistance, offsetSkid, gpuAcceleration, adaptive, scroll, resize, arrow, placement, strategy }: PopperOptions, virtualReference?: Ref<Element | VirtualElement>): readonly [Ref<MaybeElement>, Ref<MaybeElement>, Ref<{
8
8
  state: {
9
9
  elements: {
10
10
  reference: Element | {
@@ -5,9 +5,10 @@ import offset from "@popperjs/core/lib/modifiers/offset";
5
5
  import preventOverflow from "@popperjs/core/lib/modifiers/preventOverflow";
6
6
  import computeStyles from "@popperjs/core/lib/modifiers/computeStyles";
7
7
  import eventListeners from "@popperjs/core/lib/modifiers/eventListeners";
8
+ import arrowModifier from "@popperjs/core/lib/modifiers/arrow";
8
9
  import { unrefElement } from "@vueuse/core";
9
10
  export const createPopper = popperGenerator({
10
- defaultModifiers: [...defaultModifiers, offset, flip, preventOverflow, computeStyles, eventListeners]
11
+ defaultModifiers: [...defaultModifiers, offset, flip, preventOverflow, computeStyles, eventListeners, arrowModifier]
11
12
  });
12
13
  export function usePopper({
13
14
  locked = false,
@@ -18,6 +19,7 @@ export function usePopper({
18
19
  adaptive = true,
19
20
  scroll = true,
20
21
  resize = true,
22
+ arrow = false,
21
23
  placement,
22
24
  strategy
23
25
  }, virtualReference) {
@@ -71,6 +73,10 @@ export function usePopper({
71
73
  scroll,
72
74
  resize
73
75
  }
76
+ },
77
+ {
78
+ name: "arrow",
79
+ enabled: arrow
74
80
  }
75
81
  ]
76
82
  };
@@ -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>;
@@ -1,8 +1,8 @@
1
1
  import type { Ref } from 'vue';
2
- import { Strategy } from '../types';
2
+ import type { Strategy } from '../types';
3
3
  export declare const useUI: <T>(key: any, $ui: Ref<Partial<T & {
4
4
  strategy: Strategy;
5
- }> | undefined>, $config?: T | Ref<T> | undefined, $wrapperClass?: Ref<string>) => {
5
+ }> | undefined>, $config?: T | Ref<T> | undefined, $wrapperClass?: Ref<string>, withAppConfig?: boolean) => {
6
6
  ui: import("vue").ComputedRef<T>;
7
7
  attrs: import("vue").ComputedRef<Pick<{
8
8
  [x: string]: unknown;
@@ -1,7 +1,7 @@
1
1
  import { computed, toValue, useAttrs } from "vue";
2
2
  import { useAppConfig } from "#imports";
3
3
  import { mergeConfig, omit, get } from "../utils/index.mjs";
4
- export const useUI = (key, $ui, $config, $wrapperClass) => {
4
+ export const useUI = (key, $ui, $config, $wrapperClass, withAppConfig = false) => {
5
5
  const $attrs = useAttrs();
6
6
  const appConfig = useAppConfig();
7
7
  const ui = computed(() => {
@@ -12,7 +12,7 @@ export const useUI = (key, $ui, $config, $wrapperClass) => {
12
12
  _ui?.strategy || appConfig.ui?.strategy,
13
13
  _wrapperClass ? { wrapper: _wrapperClass } : {},
14
14
  _ui || {},
15
- process.dev ? get(appConfig.ui, key, {}) : {},
15
+ process.dev || withAppConfig ? get(appConfig.ui, key, {}) : {},
16
16
  _config || {}
17
17
  );
18
18
  });
@@ -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
 
@@ -1,10 +1,11 @@
1
1
  import { badge } from '../ui.config'
2
- import type { NestedKeyOf } from '.'
2
+ import type { NestedKeyOf, ExtractDeepKey, ExtractDeepObject } from '.'
3
3
  import colors from '#ui-colors'
4
+ import type { AppConfig } from 'nuxt/schema'
4
5
 
5
- export type BadgeSize = keyof typeof badge.size
6
- export type BadgeColor = keyof typeof badge.color | typeof colors[number]
7
- export type BadgeVariant = keyof typeof badge.variant | NestedKeyOf<typeof badge.color>
6
+ export type BadgeSize = keyof typeof badge.size | ExtractDeepKey<AppConfig, ['ui', 'badge', 'size']>
7
+ export type BadgeColor = keyof typeof badge.color | ExtractDeepKey<AppConfig, ['ui', 'badge', 'color']> | typeof colors[number]
8
+ export type BadgeVariant = keyof typeof badge.variant | ExtractDeepKey<AppConfig, ['ui', 'badge', 'variant']> | NestedKeyOf<typeof badge.color> | NestedKeyOf<ExtractDeepObject<AppConfig, ['ui', 'badge', 'color']>>
8
9
 
9
10
  export interface Badge {
10
11
  label?: string
@@ -0,0 +1,7 @@
1
+ import type { Link } from './link'
2
+
3
+ export interface BreadcrumbLink extends Link {
4
+ label: string
5
+ icon?: string
6
+ iconClass?: string
7
+ }
@@ -1,11 +1,12 @@
1
1
  import type { Link } from './link'
2
2
  import { button } from '../ui.config'
3
- import type { NestedKeyOf } from '.'
3
+ import type { NestedKeyOf, ExtractDeepKey, ExtractDeepObject } from '.'
4
4
  import colors from '#ui-colors'
5
+ import type { AppConfig } from 'nuxt/schema'
5
6
 
6
- export type ButtonSize = keyof typeof button.size
7
- export type ButtonColor = keyof typeof button.color | typeof colors[number]
8
- export type ButtonVariant = keyof typeof button.variant | NestedKeyOf<typeof button.color>
7
+ export type ButtonSize = keyof typeof button.size | ExtractDeepKey<AppConfig, ['ui', 'button', 'size']>
8
+ export type ButtonColor = keyof typeof button.color | ExtractDeepKey<AppConfig, ['ui', 'button', 'color']> | typeof colors[number]
9
+ export type ButtonVariant = keyof typeof button.variant | ExtractDeepKey<AppConfig, ['ui', 'button', 'variant']> | NestedKeyOf<typeof button.color> | NestedKeyOf<ExtractDeepObject<AppConfig, ['ui', 'button', 'color']>>
9
10
 
10
11
  export interface Button extends Link {
11
12
  type?: string
@@ -0,0 +1,11 @@
1
+ import { chip } from '../ui.config'
2
+ import colors from '#ui-colors'
3
+
4
+ export type ChipSize = keyof typeof chip.size
5
+ export type ChipColor = 'gray' | typeof colors[number]
6
+ export type ChipPosition = keyof typeof chip.position
7
+
8
+ export interface Chip {
9
+ color?: ChipColor
10
+ position?: ChipPosition
11
+ }
@@ -23,5 +23,6 @@ export interface Group {
23
23
  inactive?: string
24
24
  commands?: Command[]
25
25
  search?: Function
26
+ filter?: Function
26
27
  [key: string]: any
27
28
  }
@@ -1,7 +1,7 @@
1
- import type { Link } from './link'
1
+ import type { NuxtLinkProps } from '#app'
2
2
  import type { Avatar } from './avatar'
3
3
 
4
- export interface DropdownItem extends Link {
4
+ export interface DropdownItem extends NuxtLinkProps {
5
5
  label: string
6
6
  slot?: string
7
7
  icon?: string
@@ -0,0 +1,5 @@
1
+ import { formGroup } from '../ui.config'
2
+ import type { ExtractDeepKey } from '.'
3
+ import type { AppConfig } from 'nuxt/schema'
4
+
5
+ export type FormGroupSize = keyof typeof formGroup.size | ExtractDeepKey<AppConfig, ['ui', 'formGroup', 'size']>