@nuxt/ui 2.9.0 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/README.md +11 -0
  2. package/dist/module.d.mts +449 -72
  3. package/dist/module.d.ts +449 -72
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +32 -6
  6. package/dist/runtime/components/data/Table.vue +8 -6
  7. package/dist/runtime/components/data/Table.vue.d.ts +2 -1
  8. package/dist/runtime/components/elements/Accordion.vue +15 -13
  9. package/dist/runtime/components/elements/Accordion.vue.d.ts +5 -2
  10. package/dist/runtime/components/elements/Alert.vue +7 -6
  11. package/dist/runtime/components/elements/Alert.vue.d.ts +6 -5
  12. package/dist/runtime/components/elements/Avatar.vue.d.ts +5 -4
  13. package/dist/runtime/components/elements/AvatarGroup.d.ts +4 -3
  14. package/dist/runtime/components/elements/Badge.vue +4 -2
  15. package/dist/runtime/components/elements/Badge.vue.d.ts +5 -5
  16. package/dist/runtime/components/elements/Button.vue +8 -6
  17. package/dist/runtime/components/elements/Button.vue.d.ts +7 -7
  18. package/dist/runtime/components/elements/ButtonGroup.d.ts +5 -4
  19. package/dist/runtime/components/elements/ButtonGroup.mjs +19 -32
  20. package/dist/runtime/components/elements/Chip.vue +85 -0
  21. package/dist/runtime/components/elements/Chip.vue.d.ts +90 -0
  22. package/dist/runtime/components/elements/Dropdown.vue +45 -25
  23. package/dist/runtime/components/elements/Dropdown.vue.d.ts +8 -0
  24. package/dist/runtime/components/elements/Icon.vue +16 -2
  25. package/dist/runtime/components/elements/Icon.vue.d.ts +14 -2
  26. package/dist/runtime/components/elements/Kbd.vue.d.ts +5 -4
  27. package/dist/runtime/components/elements/Link.vue +2 -5
  28. package/dist/runtime/components/elements/Meter.vue +166 -0
  29. package/dist/runtime/components/elements/Meter.vue.d.ts +123 -0
  30. package/dist/runtime/components/elements/MeterGroup.d.ts +78 -0
  31. package/dist/runtime/components/elements/MeterGroup.mjs +172 -0
  32. package/dist/runtime/components/elements/Progress.vue +284 -0
  33. package/dist/runtime/components/elements/Progress.vue.d.ts +2 -0
  34. package/dist/runtime/components/forms/Checkbox.vue +2 -4
  35. package/dist/runtime/components/forms/Checkbox.vue.d.ts +6 -6
  36. package/dist/runtime/components/forms/Form.vue +32 -7
  37. package/dist/runtime/components/forms/Form.vue.d.ts +2 -1
  38. package/dist/runtime/components/forms/FormGroup.vue +7 -3
  39. package/dist/runtime/components/forms/FormGroup.vue.d.ts +15 -5
  40. package/dist/runtime/components/forms/Input.vue +41 -6
  41. package/dist/runtime/components/forms/Input.vue.d.ts +42 -10
  42. package/dist/runtime/components/forms/Radio.vue +16 -9
  43. package/dist/runtime/components/forms/Radio.vue.d.ts +8 -7
  44. package/dist/runtime/components/forms/RadioGroup.vue +136 -0
  45. package/dist/runtime/components/forms/RadioGroup.vue.d.ts +118 -0
  46. package/dist/runtime/components/forms/Range.vue.d.ts +8 -7
  47. package/dist/runtime/components/forms/Select.vue +5 -2
  48. package/dist/runtime/components/forms/Select.vue.d.ts +10 -9
  49. package/dist/runtime/components/forms/SelectMenu.vue +80 -58
  50. package/dist/runtime/components/forms/SelectMenu.vue.d.ts +23 -13
  51. package/dist/runtime/components/forms/Textarea.vue +38 -4
  52. package/dist/runtime/components/forms/Textarea.vue.d.ts +41 -9
  53. package/dist/runtime/components/forms/Toggle.vue +19 -1
  54. package/dist/runtime/components/forms/Toggle.vue.d.ts +16 -3
  55. package/dist/runtime/components/layout/Divider.vue +107 -0
  56. package/dist/runtime/components/layout/Divider.vue.d.ts +82 -0
  57. package/dist/runtime/components/navigation/Breadcrumb.vue +78 -0
  58. package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +50 -0
  59. package/dist/runtime/components/navigation/CommandPalette.vue +18 -7
  60. package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +2 -2
  61. package/dist/runtime/components/navigation/Pagination.vue +65 -9
  62. package/dist/runtime/components/navigation/Pagination.vue.d.ts +45 -7
  63. package/dist/runtime/components/navigation/Tabs.vue +1 -1
  64. package/dist/runtime/components/navigation/Tabs.vue.d.ts +1 -1
  65. package/dist/runtime/components/overlays/ContextMenu.vue +7 -2
  66. package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +2 -1
  67. package/dist/runtime/components/overlays/Modal.vue +1 -1
  68. package/dist/runtime/components/overlays/Modal.vue.d.ts +1 -1
  69. package/dist/runtime/components/overlays/Notification.vue +32 -27
  70. package/dist/runtime/components/overlays/Notification.vue.d.ts +4 -3
  71. package/dist/runtime/components/overlays/Notifications.vue +16 -14
  72. package/dist/runtime/components/overlays/Popover.vue +31 -7
  73. package/dist/runtime/components/overlays/Popover.vue.d.ts +27 -2
  74. package/dist/runtime/components/overlays/Slideover.vue.d.ts +1 -1
  75. package/dist/runtime/components/overlays/Tooltip.vue +16 -10
  76. package/dist/runtime/components/overlays/Tooltip.vue.d.ts +1 -0
  77. package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
  78. package/dist/runtime/composables/defineShortcuts.mjs +8 -4
  79. package/dist/runtime/composables/useButtonGroup.d.ts +20 -0
  80. package/dist/runtime/composables/useButtonGroup.mjs +52 -0
  81. package/dist/runtime/composables/useFormGroup.d.ts +6 -4
  82. package/dist/runtime/composables/useFormGroup.mjs +19 -7
  83. package/dist/runtime/composables/usePopper.d.ts +3 -3
  84. package/dist/runtime/composables/usePopper.mjs +7 -1
  85. package/dist/runtime/composables/useShortcuts.d.ts +2 -2
  86. package/dist/runtime/composables/useUI.d.ts +2 -2
  87. package/dist/runtime/composables/useUI.mjs +2 -2
  88. package/dist/runtime/types/alert.d.ts +7 -0
  89. package/dist/runtime/types/avatar.d.ts +3 -1
  90. package/dist/runtime/types/badge.d.ts +5 -4
  91. package/dist/runtime/types/breadcrumb.d.ts +7 -0
  92. package/dist/runtime/types/button.d.ts +5 -4
  93. package/dist/runtime/types/chip.d.ts +11 -0
  94. package/dist/runtime/types/command-palette.d.ts +1 -0
  95. package/dist/runtime/types/dropdown.d.ts +2 -2
  96. package/dist/runtime/types/form-group.d.ts +5 -0
  97. package/dist/runtime/types/form.d.ts +14 -6
  98. package/dist/runtime/types/index.d.ts +12 -0
  99. package/dist/runtime/types/input.d.ts +8 -0
  100. package/dist/runtime/types/kbd.d.ts +5 -0
  101. package/dist/runtime/types/meter.d.ts +5 -0
  102. package/dist/runtime/types/popper.d.ts +1 -0
  103. package/dist/runtime/types/progress.d.ts +4 -0
  104. package/dist/runtime/types/range.d.ts +5 -0
  105. package/dist/runtime/types/select.d.ts +8 -0
  106. package/dist/runtime/types/textarea.d.ts +8 -0
  107. package/dist/runtime/types/toggle.d.ts +5 -0
  108. package/dist/runtime/types/utils.d.ts +22 -5
  109. package/dist/runtime/ui.config/_popperArrow.d.ts +9 -0
  110. package/dist/runtime/ui.config/_popperArrow.mjs +8 -0
  111. package/dist/runtime/ui.config/data/table.d.ts +60 -0
  112. package/dist/runtime/ui.config/data/table.mjs +59 -0
  113. package/dist/runtime/ui.config/elements/accordion.d.ts +21 -0
  114. package/dist/runtime/ui.config/elements/accordion.mjs +20 -0
  115. package/dist/runtime/ui.config/elements/alert.d.ts +40 -0
  116. package/dist/runtime/ui.config/elements/alert.mjs +39 -0
  117. package/dist/runtime/ui.config/elements/avatar.d.ts +60 -0
  118. package/dist/runtime/ui.config/elements/avatar.mjs +59 -0
  119. package/dist/runtime/ui.config/elements/avatarGroup.d.ts +6 -0
  120. package/dist/runtime/ui.config/elements/avatarGroup.mjs +5 -0
  121. package/dist/runtime/ui.config/elements/badge.d.ts +34 -0
  122. package/dist/runtime/ui.config/elements/badge.mjs +33 -0
  123. package/dist/runtime/ui.config/elements/button.d.ts +77 -0
  124. package/dist/runtime/ui.config/elements/button.mjs +76 -0
  125. package/dist/runtime/ui.config/elements/buttonGroup.d.ts +9 -0
  126. package/dist/runtime/ui.config/elements/buttonGroup.mjs +8 -0
  127. package/dist/runtime/ui.config/elements/chip.d.ts +35 -0
  128. package/dist/runtime/ui.config/elements/chip.mjs +34 -0
  129. package/dist/runtime/ui.config/elements/dropdown.d.ts +53 -0
  130. package/dist/runtime/ui.config/elements/dropdown.mjs +51 -0
  131. package/dist/runtime/ui.config/elements/kbd.d.ts +17 -0
  132. package/dist/runtime/ui.config/elements/kbd.mjs +16 -0
  133. package/dist/runtime/ui.config/elements/meter.d.ts +77 -0
  134. package/dist/runtime/ui.config/elements/meter.mjs +76 -0
  135. package/dist/runtime/ui.config/elements/meterGroup.d.ts +12 -0
  136. package/dist/runtime/ui.config/elements/meterGroup.mjs +11 -0
  137. package/dist/runtime/ui.config/elements/progress.d.ts +75 -0
  138. package/dist/runtime/ui.config/elements/progress.mjs +74 -0
  139. package/dist/runtime/ui.config/forms/checkbox.d.ts +16 -0
  140. package/dist/runtime/ui.config/forms/checkbox.mjs +15 -0
  141. package/dist/runtime/ui.config/forms/formGroup.d.ts +25 -0
  142. package/dist/runtime/ui.config/forms/formGroup.mjs +25 -0
  143. package/dist/runtime/ui.config/forms/input.d.ts +105 -0
  144. package/dist/runtime/ui.config/forms/input.mjs +104 -0
  145. package/dist/runtime/ui.config/forms/radio.d.ts +15 -0
  146. package/dist/runtime/ui.config/forms/radio.mjs +14 -0
  147. package/dist/runtime/ui.config/forms/radioGroup.d.ts +8 -0
  148. package/dist/runtime/ui.config/forms/radioGroup.mjs +7 -0
  149. package/dist/runtime/ui.config/forms/range.d.ts +64 -0
  150. package/dist/runtime/ui.config/forms/range.mjs +63 -0
  151. package/dist/runtime/ui.config/forms/select.d.ts +106 -0
  152. package/dist/runtime/ui.config/forms/select.mjs +12 -0
  153. package/dist/runtime/ui.config/forms/selectMenu.d.ts +63 -0
  154. package/dist/runtime/ui.config/forms/selectMenu.mjs +61 -0
  155. package/dist/runtime/ui.config/forms/textarea.d.ts +104 -0
  156. package/dist/runtime/ui.config/forms/textarea.mjs +9 -0
  157. package/dist/runtime/ui.config/forms/toggle.d.ts +61 -0
  158. package/dist/runtime/ui.config/forms/toggle.mjs +60 -0
  159. package/dist/runtime/ui.config/index.d.ts +40 -0
  160. package/dist/runtime/ui.config/index.mjs +40 -0
  161. package/dist/runtime/ui.config/layout/card.d.ts +24 -0
  162. package/dist/runtime/ui.config/layout/card.mjs +23 -0
  163. package/dist/runtime/ui.config/layout/container.d.ts +6 -0
  164. package/dist/runtime/ui.config/layout/container.mjs +5 -0
  165. package/dist/runtime/ui.config/layout/divider.d.ts +30 -0
  166. package/dist/runtime/ui.config/layout/divider.mjs +29 -0
  167. package/dist/runtime/ui.config/layout/skeleton.d.ts +6 -0
  168. package/dist/runtime/ui.config/layout/skeleton.mjs +5 -0
  169. package/dist/runtime/ui.config/navigation/breadcrumb.d.ts +20 -0
  170. package/dist/runtime/ui.config/navigation/breadcrumb.mjs +19 -0
  171. package/dist/runtime/ui.config/navigation/commandPalette.d.ts +68 -0
  172. package/dist/runtime/ui.config/navigation/commandPalette.mjs +67 -0
  173. package/dist/runtime/ui.config/navigation/pagination.d.ts +35 -0
  174. package/dist/runtime/ui.config/navigation/pagination.mjs +34 -0
  175. package/dist/runtime/ui.config/navigation/tabs.d.ts +34 -0
  176. package/dist/runtime/ui.config/navigation/tabs.mjs +33 -0
  177. package/dist/runtime/ui.config/navigation/verticalNavigation.d.ts +28 -0
  178. package/dist/runtime/ui.config/navigation/verticalNavigation.mjs +27 -0
  179. package/dist/runtime/ui.config/overlays/contextMenu.d.ts +31 -0
  180. package/dist/runtime/ui.config/overlays/contextMenu.mjs +25 -0
  181. package/dist/runtime/ui.config/overlays/modal.d.ts +35 -0
  182. package/dist/runtime/ui.config/overlays/modal.mjs +36 -0
  183. package/dist/runtime/ui.config/overlays/notification.d.ts +49 -0
  184. package/dist/runtime/ui.config/overlays/notification.mjs +49 -0
  185. package/dist/runtime/ui.config/overlays/notifications.d.ts +7 -0
  186. package/dist/runtime/ui.config/overlays/notifications.mjs +6 -0
  187. package/dist/runtime/ui.config/overlays/popover.d.ts +42 -0
  188. package/dist/runtime/ui.config/overlays/popover.mjs +36 -0
  189. package/dist/runtime/ui.config/overlays/slideover.d.ts +27 -0
  190. package/dist/runtime/ui.config/overlays/slideover.mjs +28 -0
  191. package/dist/runtime/ui.config/overlays/tooltip.d.ts +32 -0
  192. package/dist/runtime/ui.config/overlays/tooltip.mjs +26 -0
  193. package/dist/runtime/utils/index.d.ts +5 -0
  194. package/dist/runtime/utils/index.mjs +6 -2
  195. package/dist/types.d.mts +3 -2
  196. package/dist/types.d.ts +3 -2
  197. package/package.json +41 -28
  198. package/dist/runtime/ui.config.d.ts +0 -1207
  199. package/dist/runtime/ui.config.mjs +0 -1029
  200. package/dist/runtime/utils/StateEmitter.d.ts +0 -17
  201. package/dist/runtime/utils/StateEmitter.mjs +0 -21
@@ -0,0 +1,123 @@
1
+ import type { SlotsType, PropType } from 'vue';
2
+ declare const _default: import("vue").DefineComponent<{
3
+ value: {
4
+ type: NumberConstructor;
5
+ default: number;
6
+ };
7
+ min: {
8
+ type: NumberConstructor;
9
+ default: number;
10
+ };
11
+ max: {
12
+ type: NumberConstructor;
13
+ default: number;
14
+ };
15
+ indicator: {
16
+ type: BooleanConstructor;
17
+ default: boolean;
18
+ };
19
+ label: {
20
+ type: StringConstructor;
21
+ default: null;
22
+ };
23
+ size: {
24
+ type: PropType<"sm" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl">;
25
+ default: () => any;
26
+ validator(value: string): boolean;
27
+ };
28
+ color: {
29
+ type: PropType<any>;
30
+ default: () => any;
31
+ validator(value: string): boolean;
32
+ };
33
+ icon: {
34
+ type: StringConstructor;
35
+ default: null;
36
+ };
37
+ class: {
38
+ type: PropType<any>;
39
+ default: undefined;
40
+ };
41
+ ui: {
42
+ type: PropType<Partial<any>>;
43
+ default: undefined;
44
+ };
45
+ }, {
46
+ ui: import("vue").ComputedRef<any>;
47
+ attrs: import("vue").ComputedRef<Pick<{
48
+ [x: string]: unknown;
49
+ }, string>>;
50
+ indicatorContainerClass: import("vue").ComputedRef<string>;
51
+ indicatorClass: import("vue").ComputedRef<string>;
52
+ meterClass: import("vue").ComputedRef<string>;
53
+ meterAppearanceClass: import("vue").ComputedRef<string>;
54
+ meterBarClass: import("vue").ComputedRef<string>;
55
+ labelClass: import("vue").ComputedRef<string>;
56
+ normalizedMin: import("vue").ComputedRef<number>;
57
+ normalizedMax: import("vue").ComputedRef<number>;
58
+ percent: import("vue").ComputedRef<number>;
59
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
60
+ value: {
61
+ type: NumberConstructor;
62
+ default: number;
63
+ };
64
+ min: {
65
+ type: NumberConstructor;
66
+ default: number;
67
+ };
68
+ max: {
69
+ type: NumberConstructor;
70
+ default: number;
71
+ };
72
+ indicator: {
73
+ type: BooleanConstructor;
74
+ default: boolean;
75
+ };
76
+ label: {
77
+ type: StringConstructor;
78
+ default: null;
79
+ };
80
+ size: {
81
+ type: PropType<"sm" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl">;
82
+ default: () => any;
83
+ validator(value: string): boolean;
84
+ };
85
+ color: {
86
+ type: PropType<any>;
87
+ default: () => any;
88
+ validator(value: string): boolean;
89
+ };
90
+ icon: {
91
+ type: StringConstructor;
92
+ default: null;
93
+ };
94
+ class: {
95
+ type: PropType<any>;
96
+ default: undefined;
97
+ };
98
+ ui: {
99
+ type: PropType<Partial<any>>;
100
+ default: undefined;
101
+ };
102
+ }>>, {
103
+ size: "sm" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl";
104
+ ui: Partial<any>;
105
+ value: number;
106
+ icon: string;
107
+ color: any;
108
+ class: any;
109
+ label: string;
110
+ max: number;
111
+ min: number;
112
+ indicator: boolean;
113
+ }, SlotsType<{
114
+ indicator?: {
115
+ percent: number;
116
+ value: number;
117
+ } | undefined;
118
+ label?: {
119
+ percent: number;
120
+ value: number;
121
+ } | undefined;
122
+ }>>;
123
+ export default _default;
@@ -0,0 +1,78 @@
1
+ import type { VNode, SlotsType, PropType } from 'vue';
2
+ declare const _default: import("vue").DefineComponent<{
3
+ min: {
4
+ type: NumberConstructor;
5
+ default: number;
6
+ };
7
+ max: {
8
+ type: NumberConstructor;
9
+ default: number;
10
+ };
11
+ size: {
12
+ type: PropType<"sm" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl">;
13
+ default: () => any;
14
+ validator(value: string): boolean;
15
+ };
16
+ indicator: {
17
+ type: BooleanConstructor;
18
+ default: boolean;
19
+ };
20
+ icon: {
21
+ type: StringConstructor;
22
+ default: string;
23
+ };
24
+ class: {
25
+ type: PropType<any>;
26
+ default: undefined;
27
+ };
28
+ ui: {
29
+ type: PropType<Partial<any>>;
30
+ default: undefined;
31
+ };
32
+ }, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
33
+ [key: string]: any;
34
+ }>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
35
+ min: {
36
+ type: NumberConstructor;
37
+ default: number;
38
+ };
39
+ max: {
40
+ type: NumberConstructor;
41
+ default: number;
42
+ };
43
+ size: {
44
+ type: PropType<"sm" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl">;
45
+ default: () => any;
46
+ validator(value: string): boolean;
47
+ };
48
+ indicator: {
49
+ type: BooleanConstructor;
50
+ default: boolean;
51
+ };
52
+ icon: {
53
+ type: StringConstructor;
54
+ default: string;
55
+ };
56
+ class: {
57
+ type: PropType<any>;
58
+ default: undefined;
59
+ };
60
+ ui: {
61
+ type: PropType<Partial<any>>;
62
+ default: undefined;
63
+ };
64
+ }>>, {
65
+ size: "sm" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl";
66
+ ui: Partial<any>;
67
+ icon: string;
68
+ class: any;
69
+ max: number;
70
+ min: number;
71
+ indicator: boolean;
72
+ }, SlotsType<{
73
+ default?: any[] | undefined;
74
+ indicator?: {
75
+ percent: number;
76
+ } | undefined;
77
+ }>>;
78
+ export default _default;
@@ -0,0 +1,172 @@
1
+ import { h, cloneVNode, computed, toRef, defineComponent } from "vue";
2
+ import { twJoin } from "tailwind-merge";
3
+ import UIcon from "./Icon.vue";
4
+ import { useUI } from "../../composables/useUI.mjs";
5
+ import { mergeConfig, getSlotsChildren } from "../../utils/index.mjs";
6
+ import appConfig from "#build/app.config";
7
+ import { meter, meterGroup } from "#ui/ui.config";
8
+ const meterConfig = mergeConfig(appConfig.ui.strategy, appConfig.ui.meter, meter);
9
+ const meterGroupConfig = mergeConfig(appConfig.ui.strategy, appConfig.ui.meterGroup, meterGroup);
10
+ export default defineComponent({
11
+ components: {
12
+ UIcon
13
+ },
14
+ inheritAttrs: false,
15
+ slots: Object,
16
+ props: {
17
+ min: {
18
+ type: Number,
19
+ default: 0
20
+ },
21
+ max: {
22
+ type: Number,
23
+ default: 100
24
+ },
25
+ size: {
26
+ type: String,
27
+ default: () => meterConfig.default.size,
28
+ validator(value) {
29
+ return Object.keys(meterConfig.meter.bar.size).includes(value);
30
+ }
31
+ },
32
+ indicator: {
33
+ type: Boolean,
34
+ default: false
35
+ },
36
+ icon: {
37
+ type: String,
38
+ default: "i-heroicons-minus"
39
+ },
40
+ class: {
41
+ type: [String, Object, Array],
42
+ default: void 0
43
+ },
44
+ ui: {
45
+ type: Object,
46
+ default: void 0
47
+ }
48
+ },
49
+ setup(props, { slots }) {
50
+ const { ui, attrs } = useUI("meterGroup", toRef(props, "ui"), meterGroupConfig);
51
+ const { ui: uiMeter } = useUI("meter", void 0, meterConfig);
52
+ if (!slots.default) {
53
+ throw new Error("Meter Group has no Meter children.");
54
+ }
55
+ const normalizedMin = computed(() => props.min > props.max ? props.max : props.min);
56
+ const normalizedMax = computed(() => props.max < props.min ? props.min : props.max);
57
+ const children = computed(() => getSlotsChildren(slots));
58
+ const rounded = computed(() => {
59
+ const roundedMap = {
60
+ "rounded-none": { left: "rounded-s-none", right: "rounded-e-none" },
61
+ "rounded-sm": { left: "rounded-s-sm", right: "rounded-e-sm" },
62
+ rounded: { left: "rounded-s", right: "rounded-e" },
63
+ "rounded-md": { left: "rounded-s-md", right: "rounded-e-md" },
64
+ "rounded-lg": { left: "rounded-s-lg", right: "rounded-e-lg" },
65
+ "rounded-xl": { left: "rounded-s-xl", right: "rounded-e-xl" },
66
+ "rounded-2xl": { left: "rounded-s-2xl", right: "rounded-e-2xl" },
67
+ "rounded-3xl": { left: "rounded-s-3xl", right: "rounded-e-3xl" },
68
+ "rounded-full": { left: "rounded-s-full", right: "rounded-e-full" }
69
+ };
70
+ return roundedMap[ui.value.rounded];
71
+ });
72
+ function clampPercent(value, min, max) {
73
+ if (min == max) {
74
+ return value < min ? 0 : 100;
75
+ }
76
+ if (min > max) {
77
+ max = [min, min = max][0];
78
+ }
79
+ const percent2 = (value - min) / (max - min) * 100;
80
+ return Math.max(0, Math.min(100, percent2));
81
+ }
82
+ const labels = computed(() => {
83
+ return children.value.map((node) => node.props.label);
84
+ });
85
+ const percents = computed(() => {
86
+ return children.value.map((node) => clampPercent(node.props.value, props.min, props.max));
87
+ });
88
+ const percent = computed(() => {
89
+ return Math.max(0, Math.max(percents.value.reduce((prev, percent2) => prev + percent2, 0)));
90
+ });
91
+ const clones = computed(() => children.value.map((node, index) => {
92
+ const vProps = {};
93
+ vProps.style = { width: `${percents.value[index]}%` };
94
+ vProps.size = props.size;
95
+ vProps.min = normalizedMin.value;
96
+ vProps.max = normalizedMax.value;
97
+ vProps.ui = node.props?.ui || {};
98
+ vProps.ui.wrapper = node.props?.ui?.wrapper || "";
99
+ vProps.ui.wrapper += [
100
+ node.props?.ui?.wrapper,
101
+ props.ui?.meter?.background || ui.value.background,
102
+ ui.value.transition
103
+ ].filter(Boolean).join(" ");
104
+ vProps.ui.meter = node.props?.ui?.meter || {};
105
+ vProps.ui.meter.background = `bg-${node.props.color}-500 dark:bg-${node.props.color}-400`;
106
+ vProps.ui.meter.rounded = "rounded-none";
107
+ vProps.ui.meter.bar = node.props?.ui?.meter?.bar || {};
108
+ if (index === 0) {
109
+ vProps.ui.meter.rounded = `${rounded.value.left} rounded-e-none`;
110
+ }
111
+ if (index === children.value.length - 1) {
112
+ vProps.ui.meter.rounded = `${rounded.value.right} rounded-s-none`;
113
+ }
114
+ labels.value[index] = node.props.label;
115
+ const clone = cloneVNode(node, vProps);
116
+ delete clone.children?.label;
117
+ delete clone.props.indicator;
118
+ delete clone.props.label;
119
+ return clone;
120
+ }));
121
+ const baseClass = computed(() => {
122
+ return twJoin(
123
+ ui.value.base,
124
+ ui.value.background,
125
+ ui.value.rounded,
126
+ ui.value.shadow,
127
+ uiMeter.value.meter.size[props.size]
128
+ );
129
+ });
130
+ const indicatorContainerClass = computed(() => {
131
+ return twJoin(
132
+ uiMeter.value.indicator.container
133
+ );
134
+ });
135
+ const indicatorClass = computed(() => {
136
+ return twJoin(
137
+ uiMeter.value.indicator.text,
138
+ uiMeter.value.indicator.size[props.size]
139
+ );
140
+ });
141
+ const vNodeChildren = computed(() => {
142
+ const vNodeSlots = [
143
+ void 0,
144
+ h("div", { class: baseClass.value }, clones.value),
145
+ void 0
146
+ ];
147
+ if (props.indicator) {
148
+ vNodeSlots[0] = h("div", { class: indicatorContainerClass.value }, [
149
+ h("div", { class: indicatorClass.value, style: { width: `${percent.value}%` } }, Math.round(percent.value) + "%")
150
+ ]);
151
+ } else if (slots.indicator) {
152
+ vNodeSlots[0] = slots.indicator({ percent: percent.value });
153
+ }
154
+ vNodeSlots[2] = h("ol", { class: "list-disc list-inside" }, labels.value.map((label, key) => {
155
+ const labelClass = computed(() => {
156
+ return twJoin(
157
+ uiMeter.value.label.base,
158
+ uiMeter.value.label.text,
159
+ uiMeter.value.color[clones.value[key]?.props.color] ?? uiMeter.value.label.color.replaceAll("{color}", clones.value[key]?.props.color ?? uiMeter.value.default.color),
160
+ uiMeter.value.label.size[props.size]
161
+ );
162
+ });
163
+ return h("li", { class: labelClass.value }, [
164
+ h(UIcon, { name: clones.value[key]?.props.icon ?? props.icon }),
165
+ `${label} (${Math.round(percents.value[key])}%)`
166
+ ]);
167
+ }));
168
+ return vNodeSlots;
169
+ });
170
+ return () => h("div", { class: ui.value.wrapper, ...attrs.value }, vNodeChildren.value);
171
+ }
172
+ });
@@ -0,0 +1,284 @@
1
+ <template>
2
+ <div :class="ui.wrapper" v-bind="attrs">
3
+ <slot v-if="indicator || $slots.indicator" name="indicator" v-bind="{ percent }">
4
+ <div v-if="!isSteps" :class="indicatorContainerClass" :style="{ width: `${percent}%` }">
5
+ <div :class="indicatorClass">
6
+ {{ Math.round(percent) }}%
7
+ </div>
8
+ </div>
9
+ </slot>
10
+
11
+ <progress :class="progressClass" v-bind="{ value, max: realMax }">
12
+ {{ Math.round(percent) }}%
13
+ </progress>
14
+
15
+ <div v-if="isSteps" :class="stepsClass">
16
+ <div v-for="(step, index) in max" :key="index" :class="stepClasses(index)">
17
+ <slot :name="`step-${index}`" v-bind="{ step }">
18
+ {{ step }}
19
+ </slot>
20
+ </div>
21
+ </div>
22
+ </div>
23
+ </template>
24
+
25
+ <script>
26
+ import { computed, defineComponent, toRef } from "vue";
27
+ import { twJoin } from "tailwind-merge";
28
+ import { useUI } from "../../composables/useUI";
29
+ import { mergeConfig } from "../../utils";
30
+ import appConfig from "#build/app.config";
31
+ import { progress } from "#ui/ui.config";
32
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.progress, progress);
33
+ export default defineComponent({
34
+ inheritAttrs: false,
35
+ props: {
36
+ value: {
37
+ type: [Number, null, void 0],
38
+ default: null
39
+ },
40
+ max: {
41
+ type: [Number, Array],
42
+ default: 100
43
+ },
44
+ indicator: {
45
+ type: Boolean,
46
+ default: false
47
+ },
48
+ animation: {
49
+ type: String,
50
+ default: () => config.default.animation,
51
+ validator(value) {
52
+ return Object.keys(config.animation).includes(value);
53
+ }
54
+ },
55
+ size: {
56
+ type: String,
57
+ default: () => config.default.size,
58
+ validator(value) {
59
+ return Object.keys(config.progress.size).includes(value);
60
+ }
61
+ },
62
+ color: {
63
+ type: String,
64
+ default: () => config.default.color,
65
+ validator(value) {
66
+ return appConfig.ui.colors.includes(value);
67
+ }
68
+ },
69
+ class: {
70
+ type: [String, Object, Array],
71
+ default: void 0
72
+ },
73
+ ui: {
74
+ type: Object,
75
+ default: void 0
76
+ }
77
+ },
78
+ setup(props) {
79
+ const { ui, attrs } = useUI("progress", toRef(props, "ui"), config, toRef(props, "class"));
80
+ const indicatorContainerClass = computed(() => {
81
+ return twJoin(
82
+ ui.value.indicator.container.base,
83
+ ui.value.indicator.container.width,
84
+ ui.value.indicator.container.transition
85
+ );
86
+ });
87
+ const indicatorClass = computed(() => {
88
+ return twJoin(
89
+ ui.value.indicator.align,
90
+ ui.value.indicator.width,
91
+ ui.value.indicator.color,
92
+ ui.value.indicator.size[props.size]
93
+ );
94
+ });
95
+ const progressClass = computed(() => {
96
+ const classes = [
97
+ ui.value.progress.base,
98
+ ui.value.progress.width,
99
+ ui.value.progress.size[props.size],
100
+ ui.value.progress.rounded,
101
+ ui.value.progress.track,
102
+ ui.value.progress.bar,
103
+ // Intermediate class to allow thumb ring or background color (set to `current`) as it's impossible to safelist with arbitrary values
104
+ ui.value.progress.color?.replaceAll("{color}", props.color),
105
+ ui.value.progress.background,
106
+ ui.value.progress.indeterminate.base,
107
+ ui.value.progress.indeterminate.rounded
108
+ ];
109
+ if (isIndeterminate.value) {
110
+ classes.push(ui.value.animation[props.animation]);
111
+ }
112
+ return twJoin(...classes);
113
+ });
114
+ const stepsClass = computed(() => {
115
+ return twJoin(
116
+ ui.value.steps.base,
117
+ ui.value.steps.color?.replaceAll("{color}", props.color),
118
+ ui.value.steps.size[props.size]
119
+ );
120
+ });
121
+ const stepClass = computed(() => {
122
+ return twJoin(
123
+ ui.value.step.base,
124
+ ui.value.step.align
125
+ );
126
+ });
127
+ const stepActiveClass = computed(() => {
128
+ return twJoin(
129
+ ui.value.step.active
130
+ );
131
+ });
132
+ const stepFirstClass = computed(() => {
133
+ return twJoin(
134
+ ui.value.step.first
135
+ );
136
+ });
137
+ function isActive(index) {
138
+ return index === Number(props.value);
139
+ }
140
+ function isFirst(index) {
141
+ return index === 0;
142
+ }
143
+ function stepClasses(index) {
144
+ index = Number(index);
145
+ const classes = [stepClass.value];
146
+ if (isFirst(index)) {
147
+ classes.push(stepFirstClass.value);
148
+ }
149
+ if (isActive(index)) {
150
+ classes.push(stepActiveClass.value);
151
+ }
152
+ return classes.join(" ");
153
+ }
154
+ const isIndeterminate = computed(() => [void 0, null].includes(props.value));
155
+ const isSteps = computed(() => Array.isArray(props.max));
156
+ const realMax = computed(() => {
157
+ if (isIndeterminate.value) {
158
+ return null;
159
+ }
160
+ if (Array.isArray(props.max)) {
161
+ return props.max.length - 1;
162
+ }
163
+ return Number(props.max);
164
+ });
165
+ const percent = computed(() => {
166
+ switch (true) {
167
+ case props.value < 0:
168
+ return 0;
169
+ case props.value > realMax.value:
170
+ return 100;
171
+ default:
172
+ return props.value / realMax.value * 100;
173
+ }
174
+ });
175
+ return {
176
+ // eslint-disable-next-line vue/no-dupe-keys
177
+ ui,
178
+ attrs,
179
+ indicatorContainerClass,
180
+ indicatorClass,
181
+ progressClass,
182
+ stepsClass,
183
+ stepClasses,
184
+ isIndeterminate,
185
+ isSteps,
186
+ realMax,
187
+ percent
188
+ };
189
+ }
190
+ });
191
+ </script>
192
+
193
+ <style scoped>
194
+ /** These styles are required to animate the bar */
195
+ progress:indeterminate {
196
+ @apply relative;
197
+
198
+ &:after {
199
+ @apply content-[''];
200
+ @apply absolute inset-0;
201
+ @apply bg-current;
202
+ }
203
+
204
+ &::-webkit-progress-value {
205
+ @apply bg-current;
206
+ }
207
+
208
+ &::-moz-progress-bar {
209
+ @apply bg-current;
210
+ }
211
+
212
+ &.bar-animation-carousel {
213
+ &:after {
214
+ animation: carousel 2s ease-in-out infinite;
215
+ }
216
+ &::-webkit-progress-value {
217
+ animation: carousel 2s ease-in-out infinite;
218
+ }
219
+ &::-moz-progress-bar {
220
+ animation: carousel 2s ease-in-out infinite;
221
+ }
222
+ }
223
+
224
+ &.bar-animation-carousel-inverse {
225
+ &:after {
226
+ animation: carousel-inverse 2s ease-in-out infinite;
227
+ }
228
+ &::-webkit-progress-value {
229
+ animation: carousel-inverse 2s ease-in-out infinite;
230
+ }
231
+ &::-moz-progress-bar {
232
+ animation: carousel-inverse 2s ease-in-out infinite;
233
+ }
234
+ }
235
+
236
+ &.bar-animation-swing {
237
+ &:after {
238
+ animation: swing 3s ease-in-out infinite;
239
+ }
240
+ &::-webkit-progress-value {
241
+ animation: swing 3s ease-in-out infinite;
242
+ }
243
+ &::-moz-progress-bar {
244
+ animation: swing 3s ease-in-out infinite;
245
+ }
246
+ }
247
+
248
+ &.bar-animation-elastic {
249
+ &::after {
250
+ animation: elastic 3s ease-in-out infinite;
251
+ }
252
+ &::-webkit-progress-value {
253
+ animation: elastic 3s ease-in-out infinite;
254
+ }
255
+ &::-moz-progress-bar {
256
+ animation: elastic 3s ease-in-out infinite;
257
+ }
258
+ }
259
+ }
260
+
261
+ @keyframes carousel {
262
+ 0%, 100% { width: 50% }
263
+ 0% { transform: translateX(-100%) }
264
+ 100% { transform: translateX(200%) }
265
+ }
266
+
267
+ @keyframes carousel-inverse {
268
+ 0%, 100% { width: 50% }
269
+ 0% { transform: translateX(200%) }
270
+ 100% { transform: translateX(-100%) }
271
+ }
272
+
273
+ @keyframes swing {
274
+ 0%, 100% { width: 50% }
275
+ 0%, 100% { transform: translateX(-25%) }
276
+ 50% { transform: translateX(125%) }
277
+ }
278
+
279
+ @keyframes elastic {
280
+ /* Firefox doesn't do "margin: 0 auto", we have to play with margin-left */
281
+ 0%, 100% { width: 50%; margin-left: 25%; }
282
+ 50% { width: 90%; margin-left: 5% }
283
+ }
284
+ </style>
@@ -0,0 +1,2 @@
1
+ declare const _default: (props: Record<string, any> & {}) => any;
2
+ export default _default;
@@ -17,7 +17,7 @@
17
17
  @change="onChange"
18
18
  >
19
19
  </div>
20
- <div v-if="label || $slots.label" class="ms-3 text-sm">
20
+ <div v-if="label || $slots.label" class="ms-3 flex flex-col">
21
21
  <label :for="inputId" :class="ui.label">
22
22
  <slot name="label">{{ label }}</slot>
23
23
  <span v-if="required" :class="ui.required">*</span>
@@ -35,7 +35,6 @@ import { twMerge, twJoin } from "tailwind-merge";
35
35
  import { useUI } from "../../composables/useUI";
36
36
  import { useFormGroup } from "../../composables/useFormGroup";
37
37
  import { mergeConfig } from "../../utils";
38
- import { uid } from "../../utils/uid";
39
38
  import appConfig from "#build/app.config";
40
39
  import { checkbox } from "#ui/ui.config";
41
40
  const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.checkbox, checkbox);
@@ -44,8 +43,7 @@ export default defineComponent({
44
43
  props: {
45
44
  id: {
46
45
  type: String,
47
- // A default value is needed here to bind the label
48
- default: () => uid()
46
+ default: () => null
49
47
  },
50
48
  value: {
51
49
  type: [String, Number, Boolean, Object],