@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
@@ -1,5 +1,5 @@
1
1
  import type { PropType } from 'vue';
2
- import type { Avatar, Button } from '../../types';
2
+ import type { Avatar, Button, AlertVariant } from '../../types';
3
3
  declare const _default: import("vue").DefineComponent<{
4
4
  title: {
5
5
  type: StringConstructor;
@@ -33,7 +33,7 @@ declare const _default: import("vue").DefineComponent<{
33
33
  validator(value: string): boolean;
34
34
  };
35
35
  variant: {
36
- type: PropType<any>;
36
+ type: PropType<AlertVariant>;
37
37
  default: () => any;
38
38
  validator(value: string): boolean;
39
39
  };
@@ -51,6 +51,7 @@ declare const _default: import("vue").DefineComponent<{
51
51
  [x: string]: unknown;
52
52
  }, string>>;
53
53
  alertClass: import("vue").ComputedRef<string>;
54
+ twMerge: (...classLists: import("tailwind-merge").ClassNameValue[]) => string;
54
55
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "close"[], "close", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
55
56
  title: {
56
57
  type: StringConstructor;
@@ -84,7 +85,7 @@ declare const _default: import("vue").DefineComponent<{
84
85
  validator(value: string): boolean;
85
86
  };
86
87
  variant: {
87
- type: PropType<any>;
88
+ type: PropType<AlertVariant>;
88
89
  default: () => any;
89
90
  validator(value: string): boolean;
90
91
  };
@@ -99,6 +100,7 @@ declare const _default: import("vue").DefineComponent<{
99
100
  }>> & {
100
101
  onClose?: ((...args: any[]) => any) | undefined;
101
102
  }, {
103
+ ui: Partial<any>;
102
104
  description: string;
103
105
  icon: string;
104
106
  avatar: Avatar;
@@ -107,8 +109,7 @@ declare const _default: import("vue").DefineComponent<{
107
109
  click?: Function | undefined;
108
110
  })[];
109
111
  color: any;
110
- ui: Partial<any>;
111
112
  class: any;
112
- variant: any;
113
+ variant: AlertVariant;
113
114
  }, {}>;
114
115
  export default _default;
@@ -1,4 +1,5 @@
1
1
  import type { PropType } from 'vue';
2
+ import type { AvatarSize } from '../../types';
2
3
  declare const _default: import("vue").DefineComponent<{
3
4
  src: {
4
5
  type: (BooleanConstructor | StringConstructor)[];
@@ -17,7 +18,7 @@ declare const _default: import("vue").DefineComponent<{
17
18
  default: () => any;
18
19
  };
19
20
  size: {
20
- type: PropType<"sm" | "3xs" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl" | "3xl">;
21
+ type: PropType<AvatarSize>;
21
22
  default: () => any;
22
23
  validator(value: string): boolean;
23
24
  };
@@ -78,7 +79,7 @@ declare const _default: import("vue").DefineComponent<{
78
79
  default: () => any;
79
80
  };
80
81
  size: {
81
- type: PropType<"sm" | "3xs" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl" | "3xl">;
82
+ type: PropType<AvatarSize>;
82
83
  default: () => any;
83
84
  validator(value: string): boolean;
84
85
  };
@@ -110,12 +111,12 @@ declare const _default: import("vue").DefineComponent<{
110
111
  };
111
112
  }>>, {
112
113
  alt: string;
113
- icon: string;
114
+ size: AvatarSize;
114
115
  ui: Partial<any>;
116
+ icon: string;
115
117
  class: any;
116
118
  src: string | boolean;
117
119
  text: string;
118
- size: "sm" | "3xs" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl" | "3xl";
119
120
  chipColor: any;
120
121
  chipPosition: "top-right" | "bottom-right" | "top-left" | "bottom-left";
121
122
  chipText: string | number;
@@ -1,7 +1,8 @@
1
1
  import type { PropType } from 'vue';
2
+ import type { AvatarSize } from '../../types';
2
3
  declare const _default: import("vue").DefineComponent<{
3
4
  size: {
4
- type: PropType<string | number | symbol>;
5
+ type: PropType<AvatarSize>;
5
6
  default: null;
6
7
  validator(value: string): boolean;
7
8
  };
@@ -21,7 +22,7 @@ declare const _default: import("vue").DefineComponent<{
21
22
  [key: string]: any;
22
23
  }>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
23
24
  size: {
24
- type: PropType<string | number | symbol>;
25
+ type: PropType<AvatarSize>;
25
26
  default: null;
26
27
  validator(value: string): boolean;
27
28
  };
@@ -38,9 +39,9 @@ declare const _default: import("vue").DefineComponent<{
38
39
  default: undefined;
39
40
  };
40
41
  }>>, {
42
+ size: AvatarSize;
41
43
  ui: Partial<any>;
42
44
  class: any;
43
- size: string | number | symbol;
44
45
  max: number;
45
46
  }, {}>;
46
47
  export default _default;
@@ -9,6 +9,7 @@ import { computed, toRef, defineComponent } from "vue";
9
9
  import { twMerge, twJoin } from "tailwind-merge";
10
10
  import { useUI } from "../../composables/useUI";
11
11
  import { mergeConfig } from "../../utils";
12
+ import { useInjectButtonGroup } from "../../composables/useButtonGroup";
12
13
  import appConfig from "#build/app.config";
13
14
  import { badge } from "#ui/ui.config";
14
15
  const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.badge, badge);
@@ -54,13 +55,14 @@ export default defineComponent({
54
55
  },
55
56
  setup(props) {
56
57
  const { ui, attrs } = useUI("badge", toRef(props, "ui"), config);
58
+ const { size, rounded } = useInjectButtonGroup({ ui, props });
57
59
  const badgeClass = computed(() => {
58
60
  const variant = ui.value.color?.[props.color]?.[props.variant] || ui.value.variant[props.variant];
59
61
  return twMerge(twJoin(
60
62
  ui.value.base,
61
63
  ui.value.font,
62
- ui.value.rounded,
63
- ui.value.size[props.size],
64
+ rounded.value,
65
+ ui.value.size[size.value],
64
66
  variant?.replaceAll("{color}", props.color)
65
67
  ), props.class);
66
68
  });
@@ -1,8 +1,8 @@
1
1
  import type { PropType } from 'vue';
2
- import type { BadgeVariant } from '../../types';
2
+ import type { BadgeSize, BadgeVariant } from '../../types';
3
3
  declare const _default: import("vue").DefineComponent<{
4
4
  size: {
5
- type: PropType<"sm" | "md" | "xs" | "lg">;
5
+ type: PropType<BadgeSize>;
6
6
  default: () => any;
7
7
  validator(value: string): boolean;
8
8
  };
@@ -35,7 +35,7 @@ declare const _default: import("vue").DefineComponent<{
35
35
  badgeClass: import("vue").ComputedRef<string>;
36
36
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
37
37
  size: {
38
- type: PropType<"sm" | "md" | "xs" | "lg">;
38
+ type: PropType<BadgeSize>;
39
39
  default: () => any;
40
40
  validator(value: string): boolean;
41
41
  };
@@ -62,11 +62,11 @@ declare const _default: import("vue").DefineComponent<{
62
62
  default: undefined;
63
63
  };
64
64
  }>>, {
65
- color: any;
65
+ size: BadgeSize;
66
66
  ui: Partial<any>;
67
+ color: any;
67
68
  class: any;
68
69
  label: string | number;
69
70
  variant: BadgeVariant;
70
- size: "sm" | "md" | "xs" | "lg";
71
71
  }, {}>;
72
72
  export default _default;
@@ -23,6 +23,7 @@ import UIcon from "../elements/Icon.vue";
23
23
  import ULink from "../elements/Link.vue";
24
24
  import { useUI } from "../../composables/useUI";
25
25
  import { mergeConfig } from "../../utils";
26
+ import { useInjectButtonGroup } from "../../composables/useButtonGroup";
26
27
  import appConfig from "#build/app.config";
27
28
  import { button } from "#ui/ui.config";
28
29
  const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.button, button);
@@ -124,6 +125,7 @@ export default defineComponent({
124
125
  },
125
126
  setup(props, { slots }) {
126
127
  const { ui, attrs } = useUI("button", toRef(props, "ui"), config);
128
+ const { size, rounded } = useInjectButtonGroup({ ui, props });
127
129
  const isLeading = computed(() => {
128
130
  return props.icon && props.leading || props.icon && !props.trailing || props.loading && !props.trailing || props.leadingIcon;
129
131
  });
@@ -136,10 +138,10 @@ export default defineComponent({
136
138
  return twMerge(twJoin(
137
139
  ui.value.base,
138
140
  ui.value.font,
139
- ui.value.rounded,
140
- ui.value.size[props.size],
141
- ui.value.gap[props.size],
142
- props.padded && ui.value[isSquare.value ? "square" : "padding"][props.size],
141
+ rounded.value,
142
+ ui.value.size[size.value],
143
+ ui.value.gap[size.value],
144
+ props.padded && ui.value[isSquare.value ? "square" : "padding"][size.value],
143
145
  variant?.replaceAll("{color}", props.color),
144
146
  props.block ? "w-full flex justify-center items-center" : "inline-flex items-center"
145
147
  ), props.class);
@@ -159,14 +161,14 @@ export default defineComponent({
159
161
  const leadingIconClass = computed(() => {
160
162
  return twJoin(
161
163
  ui.value.icon.base,
162
- ui.value.icon.size[props.size],
164
+ ui.value.icon.size[size.value],
163
165
  props.loading && "animate-spin"
164
166
  );
165
167
  });
166
168
  const trailingIconClass = computed(() => {
167
169
  return twJoin(
168
170
  ui.value.icon.base,
169
- ui.value.icon.size[props.size],
171
+ ui.value.icon.size[size.value],
170
172
  props.loading && !isLeading.value && "animate-spin"
171
173
  );
172
174
  });
@@ -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
  };
@@ -118,7 +118,7 @@ declare const _default: import("vue").DefineComponent<{
118
118
  default: boolean;
119
119
  };
120
120
  size: {
121
- type: PropType<"sm" | "md" | "xs" | "2xs" | "lg" | "xl">;
121
+ type: PropType<ButtonSize>;
122
122
  default: () => any;
123
123
  validator(value: string): boolean;
124
124
  };
@@ -173,17 +173,17 @@ declare const _default: import("vue").DefineComponent<{
173
173
  default: undefined;
174
174
  };
175
175
  }>>, {
176
+ size: ButtonSize;
177
+ ui: Partial<any>;
176
178
  truncate: boolean;
177
179
  icon: string;
178
180
  color: any;
179
- ui: Partial<any>;
181
+ type: string;
180
182
  class: any;
181
183
  label: string;
182
184
  loading: boolean;
183
- type: string;
184
185
  disabled: boolean;
185
186
  variant: ButtonVariant;
186
- size: "sm" | "md" | "xs" | "2xs" | "lg" | "xl";
187
187
  block: boolean;
188
188
  padded: boolean;
189
189
  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
  };
@@ -22,7 +23,7 @@ declare const _default: import("vue").DefineComponent<{
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
  };
@@ -40,9 +41,9 @@ declare const _default: import("vue").DefineComponent<{
40
41
  default: undefined;
41
42
  };
42
43
  }>>, {
44
+ orientation: "horizontal" | "vertical";
45
+ size: ButtonSize;
43
46
  ui: Partial<any>;
44
47
  class: any;
45
- size: "sm" | "md" | "xs" | "2xs" | "lg" | "xl";
46
- orientation: "horizontal" | "vertical";
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: {
@@ -35,36 +37,6 @@ export default defineComponent({
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,21 @@ 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(() => {
48
+ const roundedMap = {
49
+ "rounded-none": { horizontal: { start: "rounded-s-none", end: "rounded-e-none" }, vertical: { start: "rounded-t-none", end: "rounded-b-none" } },
50
+ "rounded-sm": { horizontal: { start: "rounded-s-sm", end: "rounded-e-sm" }, vertical: { start: "rounded-t-sm", end: "rounded-b-sm" } },
51
+ rounded: { horizontal: { start: "rounded-s", end: "rounded-e" }, vertical: { start: "rounded-t", end: "rounded-b" } },
52
+ "rounded-md": { horizontal: { start: "rounded-s-md", end: "rounded-e-md" }, vertical: { start: "rounded-t-md", end: "rounded-b-md" } },
53
+ "rounded-lg": { horizontal: { start: "rounded-s-lg", end: "rounded-e-lg" }, vertical: { start: "rounded-t-lg", end: "rounded-b-lg" } },
54
+ "rounded-xl": { horizontal: { start: "rounded-s-xl", end: "rounded-e-xl" }, vertical: { start: "rounded-t-xl", end: "rounded-b-xl" } },
55
+ "rounded-2xl": { horizontal: { start: "rounded-s-2xl", end: "rounded-e-2xl" }, vertical: { start: "rounded-t-2xl", end: "rounded-b-2xl" } },
56
+ "rounded-3xl": { horizontal: { start: "rounded-s-3xl", end: "rounded-e-3xl" }, vertical: { start: "rounded-t-3xl", end: "rounded-b-3xl" } },
57
+ "rounded-full": { horizontal: { start: "rounded-s-full", end: "rounded-e-full" }, vertical: { start: "rounded-t-full", end: "rounded-b-full" } }
58
+ };
59
+ return roundedMap[ui.value.rounded][props.orientation];
60
+ });
61
+ useProvideButtonGroup({ orientation: toRef(props, "orientation"), size: toRef(props, "size"), ui, rounded });
62
+ return () => h("div", { class: wrapperClass.value, ...attrs.value }, children.value);
76
63
  }
77
64
  });
@@ -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: void 0
60
+ },
61
+ ui: {
62
+ type: Object,
63
+ default: void 0
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: undefined;
33
+ };
34
+ ui: {
35
+ type: PropType<Partial<any>>;
36
+ default: undefined;
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: undefined;
75
+ };
76
+ ui: {
77
+ type: PropType<Partial<any>>;
78
+ default: undefined;
79
+ };
80
+ }>>, {
81
+ size: "sm" | "3xs" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl" | "3xl";
82
+ ui: Partial<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;
@@ -21,25 +21,29 @@
21
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)]" />
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="truncate">{{ 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>
@@ -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
  };
@@ -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<{