@nuxt/ui 2.10.0 → 2.11.1

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 (208) hide show
  1. package/README.md +11 -0
  2. package/dist/module.d.mts +387 -104
  3. package/dist/module.d.ts +387 -104
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +16 -7
  6. package/dist/runtime/components/data/Table.vue +3 -3
  7. package/dist/runtime/components/data/Table.vue.d.ts +7 -7
  8. package/dist/runtime/components/elements/Accordion.vue +2 -2
  9. package/dist/runtime/components/elements/Accordion.vue.d.ts +7 -7
  10. package/dist/runtime/components/elements/Alert.vue +13 -12
  11. package/dist/runtime/components/elements/Alert.vue.d.ts +12 -11
  12. package/dist/runtime/components/elements/Avatar.vue +2 -2
  13. package/dist/runtime/components/elements/Avatar.vue.d.ts +11 -10
  14. package/dist/runtime/components/elements/AvatarGroup.d.ts +11 -10
  15. package/dist/runtime/components/elements/AvatarGroup.mjs +2 -2
  16. package/dist/runtime/components/elements/Badge.vue +6 -4
  17. package/dist/runtime/components/elements/Badge.vue.d.ts +11 -11
  18. package/dist/runtime/components/elements/Button.vue +16 -12
  19. package/dist/runtime/components/elements/Button.vue.d.ts +13 -12
  20. package/dist/runtime/components/elements/ButtonGroup.d.ts +12 -11
  21. package/dist/runtime/components/elements/ButtonGroup.mjs +8 -34
  22. package/dist/runtime/components/elements/Chip.vue +85 -0
  23. package/dist/runtime/components/elements/Chip.vue.d.ts +90 -0
  24. package/dist/runtime/components/elements/Dropdown.vue +35 -21
  25. package/dist/runtime/components/elements/Dropdown.vue.d.ts +13 -7
  26. package/dist/runtime/components/elements/Icon.vue +16 -2
  27. package/dist/runtime/components/elements/Icon.vue.d.ts +14 -2
  28. package/dist/runtime/components/elements/Kbd.vue +2 -2
  29. package/dist/runtime/components/elements/Kbd.vue.d.ts +12 -11
  30. package/dist/runtime/components/elements/Link.vue +2 -5
  31. package/dist/runtime/components/elements/Meter.vue +2 -2
  32. package/dist/runtime/components/elements/Meter.vue.d.ts +9 -9
  33. package/dist/runtime/components/elements/MeterGroup.d.ts +10 -10
  34. package/dist/runtime/components/elements/MeterGroup.mjs +8 -21
  35. package/dist/runtime/components/elements/Progress.vue +6 -95
  36. package/dist/runtime/components/elements/Progress.vue.d.ts +123 -1
  37. package/dist/runtime/components/forms/Checkbox.vue +8 -10
  38. package/dist/runtime/components/forms/Checkbox.vue.d.ts +10 -10
  39. package/dist/runtime/components/forms/Form.vue +1 -1
  40. package/dist/runtime/components/forms/FormGroup.vue +9 -5
  41. package/dist/runtime/components/forms/FormGroup.vue.d.ts +21 -11
  42. package/dist/runtime/components/forms/Input.vue +43 -12
  43. package/dist/runtime/components/forms/Input.vue.d.ts +38 -15
  44. package/dist/runtime/components/forms/Radio.vue +18 -12
  45. package/dist/runtime/components/forms/Radio.vue.d.ts +11 -10
  46. package/dist/runtime/components/forms/RadioGroup.vue +3 -3
  47. package/dist/runtime/components/forms/RadioGroup.vue.d.ts +13 -13
  48. package/dist/runtime/components/forms/Range.vue +5 -5
  49. package/dist/runtime/components/forms/Range.vue.d.ts +11 -10
  50. package/dist/runtime/components/forms/Select.vue +12 -9
  51. package/dist/runtime/components/forms/Select.vue.d.ts +15 -14
  52. package/dist/runtime/components/forms/SelectMenu.vue +42 -25
  53. package/dist/runtime/components/forms/SelectMenu.vue.d.ts +28 -19
  54. package/dist/runtime/components/forms/Textarea.vue +36 -6
  55. package/dist/runtime/components/forms/Textarea.vue.d.ts +37 -14
  56. package/dist/runtime/components/forms/Toggle.vue +25 -7
  57. package/dist/runtime/components/forms/Toggle.vue.d.ts +20 -7
  58. package/dist/runtime/components/layout/Card.vue +2 -2
  59. package/dist/runtime/components/layout/Card.vue.d.ts +7 -7
  60. package/dist/runtime/components/layout/Container.vue +2 -2
  61. package/dist/runtime/components/layout/Container.vue.d.ts +7 -7
  62. package/dist/runtime/components/layout/Divider.vue +3 -8
  63. package/dist/runtime/components/layout/Divider.vue.d.ts +9 -9
  64. package/dist/runtime/components/layout/Skeleton.vue +2 -2
  65. package/dist/runtime/components/layout/Skeleton.vue.d.ts +7 -7
  66. package/dist/runtime/components/navigation/Breadcrumb.vue +78 -0
  67. package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +50 -0
  68. package/dist/runtime/components/navigation/CommandPalette.vue +50 -37
  69. package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +15 -8
  70. package/dist/runtime/components/navigation/CommandPaletteGroup.vue +1 -3
  71. package/dist/runtime/components/navigation/Pagination.vue +7 -7
  72. package/dist/runtime/components/navigation/Pagination.vue.d.ts +11 -11
  73. package/dist/runtime/components/navigation/Tabs.vue +8 -5
  74. package/dist/runtime/components/navigation/Tabs.vue.d.ts +10 -10
  75. package/dist/runtime/components/navigation/VerticalNavigation.vue +2 -2
  76. package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +7 -7
  77. package/dist/runtime/components/overlays/ContextMenu.vue +4 -3
  78. package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +7 -7
  79. package/dist/runtime/components/overlays/Modal.vue +3 -6
  80. package/dist/runtime/components/overlays/Modal.vue.d.ts +7 -7
  81. package/dist/runtime/components/overlays/Notification.vue +30 -31
  82. package/dist/runtime/components/overlays/Notification.vue.d.ts +10 -9
  83. package/dist/runtime/components/overlays/Notifications.vue +18 -16
  84. package/dist/runtime/components/overlays/Notifications.vue.d.ts +7 -7
  85. package/dist/runtime/components/overlays/Popover.vue +14 -4
  86. package/dist/runtime/components/overlays/Popover.vue.d.ts +20 -9
  87. package/dist/runtime/components/overlays/Slideover.vue +6 -6
  88. package/dist/runtime/components/overlays/Slideover.vue.d.ts +7 -7
  89. package/dist/runtime/components/overlays/Tooltip.vue +6 -5
  90. package/dist/runtime/components/overlays/Tooltip.vue.d.ts +7 -7
  91. package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
  92. package/dist/runtime/composables/defineShortcuts.mjs +8 -4
  93. package/dist/runtime/composables/useButtonGroup.d.ts +20 -0
  94. package/dist/runtime/composables/useButtonGroup.mjs +52 -0
  95. package/dist/runtime/composables/useFormGroup.d.ts +2 -0
  96. package/dist/runtime/composables/useFormGroup.mjs +3 -2
  97. package/dist/runtime/composables/useShortcuts.d.ts +2 -2
  98. package/dist/runtime/composables/useUI.d.ts +3 -3
  99. package/dist/runtime/types/alert.d.ts +7 -0
  100. package/dist/runtime/types/avatar.d.ts +3 -1
  101. package/dist/runtime/types/badge.d.ts +5 -4
  102. package/dist/runtime/types/breadcrumb.d.ts +9 -0
  103. package/dist/runtime/types/button.d.ts +5 -4
  104. package/dist/runtime/types/chip.d.ts +11 -0
  105. package/dist/runtime/types/dropdown.d.ts +2 -2
  106. package/dist/runtime/types/form-group.d.ts +5 -0
  107. package/dist/runtime/types/form.d.ts +3 -2
  108. package/dist/runtime/types/index.d.ts +10 -0
  109. package/dist/runtime/types/input.d.ts +8 -0
  110. package/dist/runtime/types/kbd.d.ts +5 -0
  111. package/dist/runtime/types/popper.d.ts +2 -0
  112. package/dist/runtime/types/range.d.ts +5 -0
  113. package/dist/runtime/types/select.d.ts +8 -0
  114. package/dist/runtime/types/textarea.d.ts +8 -0
  115. package/dist/runtime/types/toggle.d.ts +5 -0
  116. package/dist/runtime/types/utils.d.ts +24 -7
  117. package/dist/runtime/ui.config/data/table.d.ts +60 -0
  118. package/dist/runtime/ui.config/data/table.mjs +59 -0
  119. package/dist/runtime/ui.config/elements/accordion.d.ts +21 -0
  120. package/dist/runtime/ui.config/elements/accordion.mjs +20 -0
  121. package/dist/runtime/ui.config/elements/alert.d.ts +41 -0
  122. package/dist/runtime/ui.config/elements/alert.mjs +40 -0
  123. package/dist/runtime/ui.config/elements/avatar.d.ts +60 -0
  124. package/dist/runtime/ui.config/elements/avatar.mjs +59 -0
  125. package/dist/runtime/ui.config/elements/avatarGroup.d.ts +6 -0
  126. package/dist/runtime/ui.config/elements/avatarGroup.mjs +5 -0
  127. package/dist/runtime/ui.config/elements/badge.d.ts +34 -0
  128. package/dist/runtime/ui.config/elements/badge.mjs +33 -0
  129. package/dist/runtime/ui.config/elements/button.d.ts +81 -0
  130. package/dist/runtime/ui.config/elements/button.mjs +80 -0
  131. package/dist/runtime/ui.config/elements/buttonGroup.d.ts +101 -0
  132. package/dist/runtime/ui.config/elements/buttonGroup.mjs +19 -0
  133. package/dist/runtime/ui.config/elements/chip.d.ts +35 -0
  134. package/dist/runtime/ui.config/elements/chip.mjs +34 -0
  135. package/dist/runtime/ui.config/elements/dropdown.d.ts +55 -0
  136. package/dist/runtime/ui.config/elements/dropdown.mjs +53 -0
  137. package/dist/runtime/ui.config/elements/kbd.d.ts +17 -0
  138. package/dist/runtime/ui.config/elements/kbd.mjs +16 -0
  139. package/dist/runtime/ui.config/elements/meter.d.ts +77 -0
  140. package/dist/runtime/ui.config/elements/meter.mjs +76 -0
  141. package/dist/runtime/ui.config/elements/meterGroup.d.ts +52 -0
  142. package/dist/runtime/ui.config/elements/meterGroup.mjs +24 -0
  143. package/dist/runtime/ui.config/elements/progress.d.ts +75 -0
  144. package/dist/runtime/ui.config/elements/progress.mjs +74 -0
  145. package/dist/runtime/ui.config/forms/checkbox.d.ts +19 -0
  146. package/dist/runtime/ui.config/forms/checkbox.mjs +18 -0
  147. package/dist/runtime/ui.config/forms/formGroup.d.ts +25 -0
  148. package/dist/runtime/ui.config/forms/formGroup.mjs +25 -0
  149. package/dist/runtime/ui.config/forms/input.d.ts +107 -0
  150. package/dist/runtime/ui.config/forms/input.mjs +106 -0
  151. package/dist/runtime/ui.config/forms/radio.d.ts +18 -0
  152. package/dist/runtime/ui.config/forms/radio.mjs +17 -0
  153. package/dist/runtime/ui.config/forms/radioGroup.d.ts +8 -0
  154. package/dist/runtime/ui.config/forms/radioGroup.mjs +7 -0
  155. package/dist/runtime/ui.config/forms/range.d.ts +64 -0
  156. package/dist/runtime/ui.config/forms/range.mjs +63 -0
  157. package/dist/runtime/ui.config/forms/select.d.ts +108 -0
  158. package/dist/runtime/ui.config/forms/select.mjs +13 -0
  159. package/dist/runtime/ui.config/forms/selectMenu.d.ts +68 -0
  160. package/dist/runtime/ui.config/forms/selectMenu.mjs +66 -0
  161. package/dist/runtime/ui.config/forms/textarea.d.ts +106 -0
  162. package/dist/runtime/ui.config/forms/textarea.mjs +10 -0
  163. package/dist/runtime/ui.config/forms/toggle.d.ts +61 -0
  164. package/dist/runtime/ui.config/forms/toggle.mjs +60 -0
  165. package/dist/runtime/ui.config/index.d.ts +40 -0
  166. package/dist/runtime/ui.config/index.mjs +40 -0
  167. package/dist/runtime/ui.config/layout/card.d.ts +24 -0
  168. package/dist/runtime/ui.config/layout/card.mjs +23 -0
  169. package/dist/runtime/ui.config/layout/container.d.ts +6 -0
  170. package/dist/runtime/ui.config/layout/container.mjs +5 -0
  171. package/dist/runtime/ui.config/layout/divider.d.ts +35 -0
  172. package/dist/runtime/ui.config/layout/divider.mjs +34 -0
  173. package/dist/runtime/ui.config/layout/skeleton.d.ts +6 -0
  174. package/dist/runtime/ui.config/layout/skeleton.mjs +5 -0
  175. package/dist/runtime/ui.config/navigation/breadcrumb.d.ts +20 -0
  176. package/dist/runtime/ui.config/navigation/breadcrumb.mjs +19 -0
  177. package/dist/runtime/ui.config/navigation/commandPalette.d.ts +72 -0
  178. package/dist/runtime/ui.config/navigation/commandPalette.mjs +71 -0
  179. package/dist/runtime/ui.config/navigation/pagination.d.ts +35 -0
  180. package/dist/runtime/ui.config/navigation/pagination.mjs +34 -0
  181. package/dist/runtime/ui.config/navigation/tabs.d.ts +34 -0
  182. package/dist/runtime/ui.config/navigation/tabs.mjs +33 -0
  183. package/dist/runtime/ui.config/navigation/verticalNavigation.d.ts +28 -0
  184. package/dist/runtime/ui.config/navigation/verticalNavigation.mjs +27 -0
  185. package/dist/runtime/ui.config/overlays/contextMenu.d.ts +31 -0
  186. package/dist/runtime/ui.config/overlays/contextMenu.mjs +25 -0
  187. package/dist/runtime/ui.config/overlays/modal.d.ts +36 -0
  188. package/dist/runtime/ui.config/overlays/modal.mjs +37 -0
  189. package/dist/runtime/ui.config/overlays/notification.d.ts +50 -0
  190. package/dist/runtime/ui.config/overlays/notification.mjs +50 -0
  191. package/dist/runtime/ui.config/overlays/notifications.d.ts +7 -0
  192. package/dist/runtime/ui.config/overlays/notifications.mjs +6 -0
  193. package/dist/runtime/ui.config/overlays/popover.d.ts +43 -0
  194. package/dist/runtime/ui.config/overlays/popover.mjs +37 -0
  195. package/dist/runtime/ui.config/overlays/slideover.d.ts +32 -0
  196. package/dist/runtime/ui.config/overlays/slideover.mjs +33 -0
  197. package/dist/runtime/ui.config/overlays/tooltip.d.ts +33 -0
  198. package/dist/runtime/ui.config/overlays/tooltip.mjs +27 -0
  199. package/dist/runtime/ui.config/popper.d.ts +8 -0
  200. package/dist/runtime/ui.config/popper.mjs +8 -0
  201. package/dist/runtime/ui.css +1 -13
  202. package/dist/runtime/utils/index.d.ts +5 -0
  203. package/dist/runtime/utils/index.mjs +7 -3
  204. package/dist/types.d.mts +3 -2
  205. package/dist/types.d.ts +3 -2
  206. package/package.json +32 -21
  207. package/dist/runtime/ui.config.d.ts +0 -1470
  208. package/dist/runtime/ui.config.mjs +0 -1273
@@ -1,5 +1,5 @@
1
1
  import type { PropType } from 'vue';
2
- import type { ButtonVariant } from '../../types';
2
+ import type { ButtonSize, ButtonVariant } from '../../types';
3
3
  declare const _default: import("vue").DefineComponent<{
4
4
  type: {
5
5
  type: StringConstructor;
@@ -26,7 +26,7 @@ declare const _default: import("vue").DefineComponent<{
26
26
  default: boolean;
27
27
  };
28
28
  size: {
29
- type: PropType<"sm" | "md" | "xs" | "2xs" | "lg" | "xl">;
29
+ type: PropType<ButtonSize>;
30
30
  default: () => any;
31
31
  validator(value: string): boolean;
32
32
  };
@@ -74,13 +74,14 @@ declare const _default: import("vue").DefineComponent<{
74
74
  };
75
75
  class: {
76
76
  type: PropType<any>;
77
- default: undefined;
77
+ default: () => "";
78
78
  };
79
79
  ui: {
80
- type: PropType<Partial<any>>;
81
- default: undefined;
80
+ type: PropType<any>;
81
+ default: () => {};
82
82
  };
83
83
  }, {
84
+ ui: import("vue").ComputedRef<any>;
84
85
  attrs: import("vue").ComputedRef<Pick<{
85
86
  [x: string]: unknown;
86
87
  }, string>>;
@@ -118,7 +119,7 @@ declare const _default: import("vue").DefineComponent<{
118
119
  default: boolean;
119
120
  };
120
121
  size: {
121
- type: PropType<"sm" | "md" | "xs" | "2xs" | "lg" | "xl">;
122
+ type: PropType<ButtonSize>;
122
123
  default: () => any;
123
124
  validator(value: string): boolean;
124
125
  };
@@ -166,24 +167,24 @@ declare const _default: import("vue").DefineComponent<{
166
167
  };
167
168
  class: {
168
169
  type: PropType<any>;
169
- default: undefined;
170
+ default: () => "";
170
171
  };
171
172
  ui: {
172
- type: PropType<Partial<any>>;
173
- default: undefined;
173
+ type: PropType<any>;
174
+ default: () => {};
174
175
  };
175
176
  }>>, {
177
+ size: ButtonSize;
178
+ ui: any;
176
179
  truncate: boolean;
177
180
  icon: string;
178
181
  color: any;
179
- ui: Partial<any>;
182
+ type: string;
180
183
  class: any;
181
184
  label: string;
182
185
  loading: boolean;
183
- type: string;
184
186
  disabled: boolean;
185
187
  variant: ButtonVariant;
186
- size: "sm" | "md" | "xs" | "2xs" | "lg" | "xl";
187
188
  block: boolean;
188
189
  padded: boolean;
189
190
  loadingIcon: string;
@@ -1,7 +1,8 @@
1
1
  import type { PropType } from 'vue';
2
+ import type { ButtonSize } from '../../types';
2
3
  declare const _default: import("vue").DefineComponent<{
3
4
  size: {
4
- type: PropType<"sm" | "md" | "xs" | "2xs" | "lg" | "xl">;
5
+ type: PropType<ButtonSize>;
5
6
  default: null;
6
7
  validator(value: string): boolean;
7
8
  };
@@ -12,17 +13,17 @@ declare const _default: import("vue").DefineComponent<{
12
13
  };
13
14
  class: {
14
15
  type: PropType<any>;
15
- default: undefined;
16
+ default: () => "";
16
17
  };
17
18
  ui: {
18
- type: PropType<Partial<any>>;
19
- default: undefined;
19
+ type: PropType<any>;
20
+ default: () => {};
20
21
  };
21
22
  }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
22
23
  [key: string]: any;
23
24
  }>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
24
25
  size: {
25
- type: PropType<"sm" | "md" | "xs" | "2xs" | "lg" | "xl">;
26
+ type: PropType<ButtonSize>;
26
27
  default: null;
27
28
  validator(value: string): boolean;
28
29
  };
@@ -33,16 +34,16 @@ declare const _default: import("vue").DefineComponent<{
33
34
  };
34
35
  class: {
35
36
  type: PropType<any>;
36
- default: undefined;
37
+ default: () => "";
37
38
  };
38
39
  ui: {
39
- type: PropType<Partial<any>>;
40
- default: undefined;
40
+ type: PropType<any>;
41
+ default: () => {};
41
42
  };
42
43
  }>>, {
43
- ui: Partial<any>;
44
- class: any;
45
- size: "sm" | "md" | "xs" | "2xs" | "lg" | "xl";
46
44
  orientation: "horizontal" | "vertical";
45
+ size: ButtonSize;
46
+ ui: any;
47
+ class: any;
47
48
  }, {}>;
48
49
  export default _default;
@@ -1,12 +1,14 @@
1
- import { h, cloneVNode, computed, toRef, defineComponent } from "vue";
1
+ import { h, computed, toRef, defineComponent } from "vue";
2
2
  import { twMerge, twJoin } from "tailwind-merge";
3
3
  import { useUI } from "../../composables/useUI.mjs";
4
4
  import { mergeConfig, getSlotsChildren } from "../../utils/index.mjs";
5
+ import { useProvideButtonGroup } from "../../composables/useButtonGroup.mjs";
5
6
  import appConfig from "#build/app.config";
6
7
  import { button, buttonGroup } from "#ui/ui.config";
7
8
  const buttonConfig = mergeConfig(appConfig.ui.strategy, appConfig.ui.button, button);
8
9
  const buttonGroupConfig = mergeConfig(appConfig.ui.strategy, appConfig.ui.buttonGroup, buttonGroup);
9
10
  export default defineComponent({
11
+ name: "ButtonGroup",
10
12
  inheritAttrs: false,
11
13
  props: {
12
14
  size: {
@@ -25,46 +27,16 @@ export default defineComponent({
25
27
  },
26
28
  class: {
27
29
  type: [String, Object, Array],
28
- default: void 0
30
+ default: () => ""
29
31
  },
30
32
  ui: {
31
33
  type: Object,
32
- default: void 0
34
+ default: () => ({})
33
35
  }
34
36
  },
35
37
  setup(props, { slots }) {
36
38
  const { ui, attrs } = useUI("buttonGroup", toRef(props, "ui"), buttonGroupConfig);
37
39
  const children = computed(() => getSlotsChildren(slots));
38
- const rounded = computed(() => {
39
- const roundedMap = {
40
- "rounded-none": { horizontal: { left: "rounded-s-none", right: "rounded-e-none" }, vertical: { top: "rounded-t-none", bottom: "rounded-b-none" } },
41
- "rounded-sm": { horizontal: { left: "rounded-s-sm", right: "rounded-e-sm" }, vertical: { top: "rounded-t-sm", bottom: "rounded-b-sm" } },
42
- rounded: { horizontal: { left: "rounded-s", right: "rounded-e" }, vertical: { top: "rounded-t", bottom: "rounded-b" } },
43
- "rounded-md": { horizontal: { left: "rounded-s-md", right: "rounded-e-md" }, vertical: { top: "rounded-t-md", bottom: "rounded-b-md" } },
44
- "rounded-lg": { horizontal: { left: "rounded-s-lg", right: "rounded-e-lg" }, vertical: { top: "rounded-t-lg", bottom: "rounded-b-lg" } },
45
- "rounded-xl": { horizontal: { left: "rounded-s-xl", right: "rounded-e-xl" }, vertical: { top: "rounded-t-xl", bottom: "rounded-b-xl" } },
46
- "rounded-2xl": { horizontal: { left: "rounded-s-2xl", right: "rounded-e-2xl" }, vertical: { top: "rounded-t-2xl", bottom: "rounded-b-2xl" } },
47
- "rounded-3xl": { horizontal: { left: "rounded-s-3xl", right: "rounded-e-3xl" }, vertical: { top: "rounded-t-3xl", bottom: "rounded-b-3xl" } },
48
- "rounded-full": { horizontal: { left: "rounded-s-full", right: "rounded-e-full" }, vertical: { top: "rounded-t-full", bottom: "rounded-b-full" } }
49
- };
50
- return roundedMap[ui.value.rounded][props.orientation];
51
- });
52
- const clones = computed(() => children.value.map((node, index) => {
53
- const vProps = {};
54
- if (props.size) {
55
- vProps.size = props.size;
56
- }
57
- vProps.ui = node.props?.ui || {};
58
- vProps.ui.rounded = "rounded-none";
59
- vProps.ui.base = "!shadow-none";
60
- if (index === 0) {
61
- vProps.ui.rounded += ` ${rounded.value.left || rounded.value.top}`;
62
- }
63
- if (index === children.value.length - 1) {
64
- vProps.ui.rounded += ` ${rounded.value.right || rounded.value.bottom}`;
65
- }
66
- return cloneVNode(node, vProps);
67
- }));
68
40
  const wrapperClass = computed(() => {
69
41
  return twMerge(twJoin(
70
42
  ui.value.wrapper[props.orientation],
@@ -72,6 +44,8 @@ export default defineComponent({
72
44
  ui.value.shadow
73
45
  ), props.class);
74
46
  });
75
- return () => h("div", { class: wrapperClass.value, ...attrs.value }, clones.value);
47
+ const rounded = computed(() => ui.value.orientation[ui.value.rounded][props.orientation]);
48
+ useProvideButtonGroup({ orientation: toRef(props, "orientation"), size: toRef(props, "size"), ui, rounded });
49
+ return () => h("div", { class: wrapperClass.value, ...attrs.value }, children.value);
76
50
  }
77
51
  });
@@ -0,0 +1,85 @@
1
+ <template>
2
+ <div :class="ui.wrapper" v-bind="attrs">
3
+ <slot />
4
+
5
+ <span v-if="show" :class="chipClass">
6
+ <slot name="content">
7
+ {{ text }}
8
+ </slot>
9
+ </span>
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ import { defineComponent, computed, toRef } from "vue";
15
+ import { twJoin } from "tailwind-merge";
16
+ import { useUI } from "../../composables/useUI";
17
+ import { mergeConfig } from "../../utils";
18
+ import appConfig from "#build/app.config";
19
+ import { chip } from "#ui/ui.config";
20
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.chip, chip);
21
+ export default defineComponent({
22
+ inheritAttrs: false,
23
+ props: {
24
+ size: {
25
+ type: String,
26
+ default: () => config.default.size,
27
+ validator(value) {
28
+ return Object.keys(config.size).includes(value);
29
+ }
30
+ },
31
+ color: {
32
+ type: String,
33
+ default: () => config.default.color,
34
+ validator(value) {
35
+ return ["gray", ...appConfig.ui.colors].includes(value);
36
+ }
37
+ },
38
+ position: {
39
+ type: String,
40
+ default: () => config.default.position,
41
+ validator(value) {
42
+ return Object.keys(config.position).includes(value);
43
+ }
44
+ },
45
+ text: {
46
+ type: [String, Number],
47
+ default: null
48
+ },
49
+ inset: {
50
+ type: Boolean,
51
+ default: () => config.default.inset
52
+ },
53
+ show: {
54
+ type: Boolean,
55
+ default: true
56
+ },
57
+ class: {
58
+ type: [String, Object, Array],
59
+ default: () => ""
60
+ },
61
+ ui: {
62
+ type: Object,
63
+ default: () => ({})
64
+ }
65
+ },
66
+ setup(props) {
67
+ const { ui, attrs } = useUI("chip", toRef(props, "ui"), config, toRef(props, "class"));
68
+ const chipClass = computed(() => {
69
+ return twJoin(
70
+ ui.value.base,
71
+ ui.value.size[props.size],
72
+ ui.value.position[props.position],
73
+ props.inset ? null : ui.value.translate[props.position],
74
+ ui.value.background.replaceAll("{color}", props.color)
75
+ );
76
+ });
77
+ return {
78
+ // eslint-disable-next-line vue/no-dupe-keys
79
+ ui,
80
+ attrs,
81
+ chipClass
82
+ };
83
+ }
84
+ });
85
+ </script>
@@ -0,0 +1,90 @@
1
+ import type { PropType } from 'vue';
2
+ declare const _default: import("vue").DefineComponent<{
3
+ size: {
4
+ type: PropType<"sm" | "3xs" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl" | "3xl">;
5
+ default: () => any;
6
+ validator(value: string): boolean;
7
+ };
8
+ color: {
9
+ type: PropType<any>;
10
+ default: () => any;
11
+ validator(value: string): boolean;
12
+ };
13
+ position: {
14
+ type: PropType<"top-right" | "bottom-right" | "top-left" | "bottom-left">;
15
+ default: () => any;
16
+ validator(value: string): boolean;
17
+ };
18
+ text: {
19
+ type: (NumberConstructor | StringConstructor)[];
20
+ default: null;
21
+ };
22
+ inset: {
23
+ type: BooleanConstructor;
24
+ default: () => any;
25
+ };
26
+ show: {
27
+ type: BooleanConstructor;
28
+ default: boolean;
29
+ };
30
+ class: {
31
+ type: PropType<any>;
32
+ default: () => "";
33
+ };
34
+ ui: {
35
+ type: PropType<any>;
36
+ default: () => {};
37
+ };
38
+ }, {
39
+ ui: import("vue").ComputedRef<any>;
40
+ attrs: import("vue").ComputedRef<Pick<{
41
+ [x: string]: unknown;
42
+ }, string>>;
43
+ chipClass: import("vue").ComputedRef<string>;
44
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
45
+ size: {
46
+ type: PropType<"sm" | "3xs" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl" | "3xl">;
47
+ default: () => any;
48
+ validator(value: string): boolean;
49
+ };
50
+ color: {
51
+ type: PropType<any>;
52
+ default: () => any;
53
+ validator(value: string): boolean;
54
+ };
55
+ position: {
56
+ type: PropType<"top-right" | "bottom-right" | "top-left" | "bottom-left">;
57
+ default: () => any;
58
+ validator(value: string): boolean;
59
+ };
60
+ text: {
61
+ type: (NumberConstructor | StringConstructor)[];
62
+ default: null;
63
+ };
64
+ inset: {
65
+ type: BooleanConstructor;
66
+ default: () => any;
67
+ };
68
+ show: {
69
+ type: BooleanConstructor;
70
+ default: boolean;
71
+ };
72
+ class: {
73
+ type: PropType<any>;
74
+ default: () => "";
75
+ };
76
+ ui: {
77
+ type: PropType<any>;
78
+ default: () => {};
79
+ };
80
+ }>>, {
81
+ size: "sm" | "3xs" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl" | "3xl";
82
+ ui: any;
83
+ color: any;
84
+ class: any;
85
+ text: string | number;
86
+ position: "top-right" | "bottom-right" | "top-left" | "bottom-left";
87
+ inset: boolean;
88
+ show: boolean;
89
+ }, {}>;
90
+ export default _default;
@@ -4,7 +4,7 @@
4
4
  ref="trigger"
5
5
  as="div"
6
6
  :disabled="disabled"
7
- class="inline-flex w-full"
7
+ :class="ui.trigger"
8
8
  role="button"
9
9
  @mouseover="onMouseOver"
10
10
  >
@@ -18,28 +18,32 @@
18
18
  <div v-if="open && items.length" ref="container" :class="[ui.container, ui.width]" :style="containerStyle" @mouseover="onMouseOver">
19
19
  <Transition appear v-bind="ui.transition">
20
20
  <div>
21
- <div v-if="popper.arrow" data-popper-arrow :class="['invisible before:visible before:block before:rotate-45 before:z-[-1]', Object.values(ui.arrow)]" />
21
+ <div v-if="popper.arrow" data-popper-arrow :class="Object.values(ui.arrow)" />
22
22
  <HMenuItems :class="[ui.base, ui.divide, ui.ring, ui.rounded, ui.shadow, ui.background, ui.height]" static>
23
23
  <div v-for="(subItems, index) of items" :key="index" :class="ui.padding">
24
- <HMenuItem v-for="(item, subIndex) of subItems" :key="subIndex" v-slot="{ active, disabled: itemDisabled }" :disabled="item.disabled">
25
- <component
26
- :is="!!item.to ? NuxtLink : 'button'"
27
- v-bind="omit(item, ['label', 'slot', 'icon', 'iconClass', 'avatar', 'shortcuts', 'disabled', 'click'])"
28
- :class="[ui.item.base, ui.item.padding, ui.item.size, ui.item.rounded, active ? ui.item.active : ui.item.inactive, itemDisabled && ui.item.disabled]"
29
- @click="item.click"
30
- >
31
- <slot :name="item.slot || 'item'" :item="item">
32
- <UIcon v-if="item.icon" :name="item.icon" :class="[ui.item.icon.base, active ? ui.item.icon.active : ui.item.icon.inactive, item.iconClass]" />
33
- <UAvatar v-else-if="item.avatar" v-bind="{ size: ui.item.avatar.size, ...item.avatar }" :class="ui.item.avatar.base" />
24
+ <NuxtLink v-for="(item, subIndex) of subItems" :key="subIndex" v-slot="{ href, target, rel, navigate, isExternal }" v-bind="omit(item, ['label', 'slot', 'icon', 'iconClass', 'avatar', 'shortcuts', 'disabled', 'click'])" custom>
25
+ <HMenuItem v-slot="{ active, disabled: itemDisabled, close }" :disabled="item.disabled">
26
+ <component
27
+ :is="!!href ? 'a' : 'button'"
28
+ :href="!itemDisabled ? href : undefined"
29
+ :rel="rel"
30
+ :target="target"
31
+ :class="[ui.item.base, ui.item.padding, ui.item.size, ui.item.rounded, active ? ui.item.active : ui.item.inactive, itemDisabled && ui.item.disabled]"
32
+ @click="onClick($event, item, { href, navigate, close, isExternal })"
33
+ >
34
+ <slot :name="item.slot || 'item'" :item="item">
35
+ <UIcon v-if="item.icon" :name="item.icon" :class="[ui.item.icon.base, active ? ui.item.icon.active : ui.item.icon.inactive, item.iconClass]" />
36
+ <UAvatar v-else-if="item.avatar" v-bind="{ size: ui.item.avatar.size, ...item.avatar }" :class="ui.item.avatar.base" />
34
37
 
35
- <span class="truncate">{{ item.label }}</span>
38
+ <span :class="ui.item.label">{{ item.label }}</span>
36
39
 
37
- <span v-if="item.shortcuts?.length" :class="ui.item.shortcuts">
38
- <UKbd v-for="shortcut of item.shortcuts" :key="shortcut">{{ shortcut }}</UKbd>
39
- </span>
40
- </slot>
41
- </component>
42
- </HMenuItem>
40
+ <span v-if="item.shortcuts?.length" :class="ui.item.shortcuts">
41
+ <UKbd v-for="shortcut of item.shortcuts" :key="shortcut">{{ shortcut }}</UKbd>
42
+ </span>
43
+ </slot>
44
+ </component>
45
+ </HMenuItem>
46
+ </NuxtLink>
43
47
  </div>
44
48
  </HMenuItems>
45
49
  </div>
@@ -100,11 +104,11 @@ export default defineComponent({
100
104
  },
101
105
  class: {
102
106
  type: [String, Object, Array],
103
- default: void 0
107
+ default: () => ""
104
108
  },
105
109
  ui: {
106
110
  type: Object,
107
- default: void 0
111
+ default: () => ({})
108
112
  }
109
113
  },
110
114
  setup(props) {
@@ -160,6 +164,15 @@ export default defineComponent({
160
164
  closeTimeout = null;
161
165
  }, props.closeDelay);
162
166
  }
167
+ function onClick(e, item, { href, navigate, close, isExternal }) {
168
+ if (item.click) {
169
+ item.click(e);
170
+ }
171
+ if (href && !isExternal) {
172
+ navigate(e);
173
+ close();
174
+ }
175
+ }
163
176
  const NuxtLink = resolveComponent("NuxtLink");
164
177
  return {
165
178
  // eslint-disable-next-line vue/no-dupe-keys
@@ -172,6 +185,7 @@ export default defineComponent({
172
185
  containerStyle,
173
186
  onMouseOver,
174
187
  onMouseLeave,
188
+ onClick,
175
189
  omit,
176
190
  NuxtLink
177
191
  };
@@ -29,11 +29,11 @@ declare const _default: import("vue").DefineComponent<{
29
29
  };
30
30
  class: {
31
31
  type: PropType<any>;
32
- default: undefined;
32
+ default: () => string;
33
33
  };
34
34
  ui: {
35
- type: PropType<Partial<any>>;
36
- default: undefined;
35
+ type: PropType<any>;
36
+ default: () => {};
37
37
  };
38
38
  }, {
39
39
  ui: import("vue").ComputedRef<any>;
@@ -52,6 +52,12 @@ declare const _default: import("vue").DefineComponent<{
52
52
  }>;
53
53
  onMouseOver: () => void;
54
54
  onMouseLeave: () => void;
55
+ onClick: (e: any, item: any, { href, navigate, close, isExternal }: {
56
+ href: any;
57
+ navigate: any;
58
+ close: any;
59
+ isExternal: any;
60
+ }) => void;
55
61
  omit: typeof omit;
56
62
  NuxtLink: string | import("vue").ConcreteComponent<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
57
63
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -82,14 +88,14 @@ declare const _default: import("vue").DefineComponent<{
82
88
  };
83
89
  class: {
84
90
  type: PropType<any>;
85
- default: undefined;
91
+ default: () => string;
86
92
  };
87
93
  ui: {
88
- type: PropType<Partial<any>>;
89
- default: undefined;
94
+ type: PropType<any>;
95
+ default: () => {};
90
96
  };
91
97
  }>>, {
92
- ui: Partial<any>;
98
+ ui: any;
93
99
  popper: PopperOptions;
94
100
  class: any;
95
101
  disabled: boolean;
@@ -1,15 +1,29 @@
1
1
  <template>
2
- <span :class="name" />
2
+ <Icon v-if="dynamic" :name="name" />
3
+ <span v-else :class="name" />
3
4
  </template>
4
5
 
5
6
  <script>
6
- import { defineComponent } from "vue";
7
+ import { defineComponent, computed } from "vue";
8
+ import { useAppConfig } from "#imports";
7
9
  export default defineComponent({
8
10
  props: {
9
11
  name: {
10
12
  type: String,
11
13
  required: true
14
+ },
15
+ dynamic: {
16
+ type: Boolean,
17
+ default: false
12
18
  }
19
+ },
20
+ setup(props) {
21
+ const appConfig = useAppConfig();
22
+ const dynamic = computed(() => props.dynamic || appConfig.ui?.icons?.dynamic);
23
+ return {
24
+ // eslint-disable-next-line vue/no-dupe-keys
25
+ dynamic
26
+ };
13
27
  }
14
28
  });
15
29
  </script>
@@ -3,10 +3,22 @@ declare const _default: import("vue").DefineComponent<{
3
3
  type: StringConstructor;
4
4
  required: true;
5
5
  };
6
- }, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
6
+ dynamic: {
7
+ type: BooleanConstructor;
8
+ default: boolean;
9
+ };
10
+ }, {
11
+ dynamic: import("vue").ComputedRef<any>;
12
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
7
13
  name: {
8
14
  type: StringConstructor;
9
15
  required: true;
10
16
  };
11
- }>>, {}, {}>;
17
+ dynamic: {
18
+ type: BooleanConstructor;
19
+ default: boolean;
20
+ };
21
+ }>>, {
22
+ dynamic: boolean;
23
+ }, {}>;
12
24
  export default _default;
@@ -28,11 +28,11 @@ export default defineComponent({
28
28
  },
29
29
  class: {
30
30
  type: [String, Object, Array],
31
- default: void 0
31
+ default: () => ""
32
32
  },
33
33
  ui: {
34
34
  type: Object,
35
- default: void 0
35
+ default: () => ({})
36
36
  }
37
37
  },
38
38
  setup(props) {
@@ -1,21 +1,22 @@
1
1
  import type { PropType } from 'vue';
2
+ import type { KbdSize } from '../../types';
2
3
  declare const _default: import("vue").DefineComponent<{
3
4
  value: {
4
5
  type: StringConstructor;
5
6
  default: null;
6
7
  };
7
8
  size: {
8
- type: PropType<string | number | symbol>;
9
+ type: PropType<KbdSize>;
9
10
  default: () => any;
10
11
  validator(value: string): boolean;
11
12
  };
12
13
  class: {
13
14
  type: PropType<any>;
14
- default: undefined;
15
+ default: () => "";
15
16
  };
16
17
  ui: {
17
- type: PropType<Partial<any>>;
18
- default: undefined;
18
+ type: PropType<any>;
19
+ default: () => {};
19
20
  };
20
21
  }, {
21
22
  ui: import("vue").ComputedRef<any>;
@@ -29,22 +30,22 @@ declare const _default: import("vue").DefineComponent<{
29
30
  default: null;
30
31
  };
31
32
  size: {
32
- type: PropType<string | number | symbol>;
33
+ type: PropType<KbdSize>;
33
34
  default: () => any;
34
35
  validator(value: string): boolean;
35
36
  };
36
37
  class: {
37
38
  type: PropType<any>;
38
- default: undefined;
39
+ default: () => "";
39
40
  };
40
41
  ui: {
41
- type: PropType<Partial<any>>;
42
- default: undefined;
42
+ type: PropType<any>;
43
+ default: () => {};
43
44
  };
44
45
  }>>, {
45
- ui: Partial<any>;
46
- class: any;
46
+ size: KbdSize;
47
+ ui: any;
47
48
  value: string;
48
- size: string | number | symbol;
49
+ class: any;
49
50
  }, {}>;
50
51
  export default _default;