@nuxt/ui 2.8.1 → 2.10.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 (120) hide show
  1. package/README.md +1 -0
  2. package/dist/module.d.mts +1411 -1092
  3. package/dist/module.d.ts +1411 -1092
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +55 -11
  6. package/dist/runtime/components/data/Table.vue +47 -32
  7. package/dist/runtime/components/data/Table.vue.d.ts +22 -14
  8. package/dist/runtime/components/elements/Accordion.vue +33 -28
  9. package/dist/runtime/components/elements/Accordion.vue.d.ts +25 -18
  10. package/dist/runtime/components/elements/Alert.vue +22 -18
  11. package/dist/runtime/components/elements/Alert.vue.d.ts +26 -19
  12. package/dist/runtime/components/elements/Avatar.vue +22 -16
  13. package/dist/runtime/components/elements/Avatar.vue.d.ts +28 -19
  14. package/dist/runtime/components/elements/AvatarGroup.d.ts +17 -8
  15. package/dist/runtime/components/elements/AvatarGroup.mjs +18 -13
  16. package/dist/runtime/components/elements/Badge.vue +21 -17
  17. package/dist/runtime/components/elements/Badge.vue.d.ts +28 -19
  18. package/dist/runtime/components/elements/Button.vue +22 -18
  19. package/dist/runtime/components/elements/Button.vue.d.ts +28 -19
  20. package/dist/runtime/components/elements/ButtonGroup.d.ts +17 -8
  21. package/dist/runtime/components/elements/ButtonGroup.mjs +22 -15
  22. package/dist/runtime/components/elements/Dropdown.vue +45 -37
  23. package/dist/runtime/components/elements/Dropdown.vue.d.ts +22 -17
  24. package/dist/runtime/components/elements/Kbd.vue +16 -12
  25. package/dist/runtime/components/elements/Kbd.vue.d.ts +20 -12
  26. package/dist/runtime/components/elements/Link.vue +18 -5
  27. package/dist/runtime/components/elements/Meter.vue +166 -0
  28. package/dist/runtime/components/elements/Meter.vue.d.ts +123 -0
  29. package/dist/runtime/components/elements/MeterGroup.d.ts +78 -0
  30. package/dist/runtime/components/elements/MeterGroup.mjs +172 -0
  31. package/dist/runtime/components/elements/Progress.vue +284 -0
  32. package/dist/runtime/components/elements/Progress.vue.d.ts +2 -0
  33. package/dist/runtime/components/forms/Checkbox.vue +27 -17
  34. package/dist/runtime/components/forms/Checkbox.vue.d.ts +33 -15
  35. package/dist/runtime/components/forms/Form.vue +34 -9
  36. package/dist/runtime/components/forms/Form.vue.d.ts +2 -1
  37. package/dist/runtime/components/forms/FormGroup.vue +51 -27
  38. package/dist/runtime/components/forms/FormGroup.vue.d.ts +23 -15
  39. package/dist/runtime/components/forms/Input.vue +41 -29
  40. package/dist/runtime/components/forms/Input.vue.d.ts +51 -24
  41. package/dist/runtime/components/forms/Radio.vue +32 -21
  42. package/dist/runtime/components/forms/Radio.vue.d.ts +36 -18
  43. package/dist/runtime/components/forms/RadioGroup.vue +136 -0
  44. package/dist/runtime/components/forms/RadioGroup.vue.d.ts +118 -0
  45. package/dist/runtime/components/forms/Range.vue +26 -16
  46. package/dist/runtime/components/forms/Range.vue.d.ts +37 -18
  47. package/dist/runtime/components/forms/Select.vue +34 -26
  48. package/dist/runtime/components/forms/Select.vue.d.ts +42 -24
  49. package/dist/runtime/components/forms/SelectMenu.vue +104 -89
  50. package/dist/runtime/components/forms/SelectMenu.vue.d.ts +53 -33
  51. package/dist/runtime/components/forms/Textarea.vue +43 -31
  52. package/dist/runtime/components/forms/Textarea.vue.d.ts +50 -23
  53. package/dist/runtime/components/forms/Toggle.vue +26 -15
  54. package/dist/runtime/components/forms/Toggle.vue.d.ts +31 -12
  55. package/dist/runtime/components/layout/Card.vue +15 -10
  56. package/dist/runtime/components/layout/Card.vue.d.ts +17 -9
  57. package/dist/runtime/components/layout/Container.vue +15 -10
  58. package/dist/runtime/components/layout/Container.vue.d.ts +17 -9
  59. package/dist/runtime/components/layout/Divider.vue +107 -0
  60. package/dist/runtime/components/layout/Divider.vue.d.ts +82 -0
  61. package/dist/runtime/components/layout/Skeleton.vue +15 -10
  62. package/dist/runtime/components/layout/Skeleton.vue.d.ts +17 -9
  63. package/dist/runtime/components/navigation/CommandPalette.vue +57 -38
  64. package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +24 -23
  65. package/dist/runtime/components/navigation/CommandPaletteGroup.vue +1 -1
  66. package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +3 -4
  67. package/dist/runtime/components/navigation/Pagination.vue +129 -64
  68. package/dist/runtime/components/navigation/Pagination.vue.d.ts +70 -25
  69. package/dist/runtime/components/navigation/Tabs.vue +17 -14
  70. package/dist/runtime/components/navigation/Tabs.vue.d.ts +18 -11
  71. package/dist/runtime/components/navigation/VerticalNavigation.vue +15 -13
  72. package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +20 -16
  73. package/dist/runtime/components/overlays/ContextMenu.vue +21 -11
  74. package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +20 -11
  75. package/dist/runtime/components/overlays/Modal.vue +16 -14
  76. package/dist/runtime/components/overlays/Modal.vue.d.ts +18 -11
  77. package/dist/runtime/components/overlays/Notification.vue +25 -15
  78. package/dist/runtime/components/overlays/Notification.vue.d.ts +25 -19
  79. package/dist/runtime/components/overlays/Notifications.vue +19 -13
  80. package/dist/runtime/components/overlays/Notifications.vue.d.ts +22 -14
  81. package/dist/runtime/components/overlays/Popover.vue +39 -22
  82. package/dist/runtime/components/overlays/Popover.vue.d.ts +32 -11
  83. package/dist/runtime/components/overlays/Slideover.vue +15 -13
  84. package/dist/runtime/components/overlays/Slideover.vue.d.ts +18 -11
  85. package/dist/runtime/components/overlays/Tooltip.vue +31 -23
  86. package/dist/runtime/components/overlays/Tooltip.vue.d.ts +19 -11
  87. package/dist/runtime/composables/useFormGroup.d.ts +12 -2
  88. package/dist/runtime/composables/useFormGroup.mjs +21 -4
  89. package/dist/runtime/composables/usePopper.d.ts +3 -3
  90. package/dist/runtime/composables/usePopper.mjs +47 -31
  91. package/dist/runtime/composables/useToast.d.ts +3 -3
  92. package/dist/runtime/composables/useUI.d.ts +10 -0
  93. package/dist/runtime/composables/useUI.mjs +24 -0
  94. package/dist/runtime/types/avatar.d.ts +10 -4
  95. package/dist/runtime/types/badge.d.ts +14 -0
  96. package/dist/runtime/types/button.d.ts +10 -3
  97. package/dist/runtime/types/command-palette.d.ts +3 -1
  98. package/dist/runtime/types/form.d.ts +18 -4
  99. package/dist/runtime/types/index.d.ts +4 -0
  100. package/dist/runtime/types/link.d.ts +1 -0
  101. package/dist/runtime/types/meter.d.ts +5 -0
  102. package/dist/runtime/types/notification.d.ts +5 -3
  103. package/dist/runtime/types/popper.d.ts +1 -0
  104. package/dist/runtime/types/progress.d.ts +4 -0
  105. package/dist/runtime/types/tabs.d.ts +1 -0
  106. package/dist/runtime/types/utils.d.ts +11 -0
  107. package/dist/runtime/ui.config.d.ts +1470 -0
  108. package/dist/runtime/{app.config.mjs → ui.config.mjs} +313 -97
  109. package/dist/runtime/utils/index.d.ts +5 -11
  110. package/dist/runtime/utils/index.mjs +21 -9
  111. package/dist/runtime/utils/lodash.d.ts +2 -0
  112. package/dist/runtime/utils/lodash.mjs +23 -0
  113. package/dist/runtime/utils/uid.d.ts +1 -0
  114. package/dist/runtime/utils/uid.mjs +4 -0
  115. package/dist/types.d.mts +1 -1
  116. package/dist/types.d.ts +1 -1
  117. package/package.json +27 -29
  118. package/dist/runtime/app.config.d.ts +0 -1203
  119. package/dist/runtime/utils/StateEmitter.d.ts +0 -17
  120. package/dist/runtime/utils/StateEmitter.mjs +0 -21
@@ -25,22 +25,23 @@
25
25
  <UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...ui.default.actionButton, ...action }" @click.stop="action.click" />
26
26
  </div>
27
27
 
28
- <UButton v-if="closeButton" v-bind="{ ...ui.default.closeButton, ...closeButton }" @click.stop="$emit('close')" />
28
+ <UButton v-if="closeButton" aria-label="Close" v-bind="{ ...ui.default.closeButton, ...closeButton }" @click.stop="$emit('close')" />
29
29
  </div>
30
30
  </div>
31
31
  </div>
32
32
  </template>
33
33
 
34
34
  <script>
35
- import { computed, defineComponent } from "vue";
35
+ import { computed, toRef, defineComponent } from "vue";
36
36
  import { twMerge, twJoin } from "tailwind-merge";
37
37
  import UIcon from "../elements/Icon.vue";
38
38
  import UAvatar from "../elements/Avatar.vue";
39
39
  import UButton from "../elements/Button.vue";
40
- import { defuTwMerge } from "../../utils";
41
- import { useAppConfig } from "#imports";
40
+ import { useUI } from "../../composables/useUI";
41
+ import { mergeConfig } from "../../utils";
42
42
  import appConfig from "#build/app.config";
43
- import { omit } from "lodash-es";
43
+ import { alert } from "#ui/ui.config";
44
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.alert, alert);
44
45
  export default defineComponent({
45
46
  components: {
46
47
  UIcon,
@@ -59,7 +60,7 @@ export default defineComponent({
59
60
  },
60
61
  icon: {
61
62
  type: String,
62
- default: () => appConfig.ui.alert.default.icon
63
+ default: () => config.default.icon
63
64
  },
64
65
  avatar: {
65
66
  type: Object,
@@ -67,7 +68,7 @@ export default defineComponent({
67
68
  },
68
69
  closeButton: {
69
70
  type: Object,
70
- default: () => appConfig.ui.alert.default.closeButton
71
+ default: () => config.default.closeButton
71
72
  },
72
73
  actions: {
73
74
  type: Array,
@@ -75,30 +76,33 @@ export default defineComponent({
75
76
  },
76
77
  color: {
77
78
  type: String,
78
- default: () => appConfig.ui.alert.default.color,
79
+ default: () => config.default.color,
79
80
  validator(value) {
80
- return [...appConfig.ui.colors, ...Object.keys(appConfig.ui.alert.color)].includes(value);
81
+ return [...appConfig.ui.colors, ...Object.keys(config.color)].includes(value);
81
82
  }
82
83
  },
83
84
  variant: {
84
85
  type: String,
85
- default: () => appConfig.ui.alert.default.variant,
86
+ default: () => config.default.variant,
86
87
  validator(value) {
87
88
  return [
88
- ...Object.keys(appConfig.ui.alert.variant),
89
- ...Object.values(appConfig.ui.alert.color).flatMap((value2) => Object.keys(value2))
89
+ ...Object.keys(config.variant),
90
+ ...Object.values(config.color).flatMap((value2) => Object.keys(value2))
90
91
  ].includes(value);
91
92
  }
92
93
  },
94
+ class: {
95
+ type: [String, Object, Array],
96
+ default: void 0
97
+ },
93
98
  ui: {
94
99
  type: Object,
95
- default: () => ({})
100
+ default: void 0
96
101
  }
97
102
  },
98
103
  emits: ["close"],
99
- setup(props, { attrs }) {
100
- const appConfig2 = useAppConfig();
101
- const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.alert));
104
+ setup(props) {
105
+ const { ui, attrs } = useUI("alert", toRef(props, "ui"), config);
102
106
  const alertClass = computed(() => {
103
107
  const variant = ui.value.color?.[props.color]?.[props.variant] || ui.value.variant[props.variant];
104
108
  return twMerge(twJoin(
@@ -107,12 +111,12 @@ export default defineComponent({
107
111
  ui.value.shadow,
108
112
  ui.value.padding,
109
113
  variant?.replaceAll("{color}", props.color)
110
- ), attrs.class);
114
+ ), props.class);
111
115
  });
112
116
  return {
113
- attrs: omit(attrs, ["class"]),
114
117
  // eslint-disable-next-line vue/no-dupe-keys
115
118
  ui,
119
+ attrs,
116
120
  alertClass
117
121
  };
118
122
  }
@@ -1,7 +1,5 @@
1
- /// <reference types="lodash" />
2
1
  import type { PropType } from 'vue';
3
- import type { Avatar } from '../../types/avatar';
4
- import type { Button } from '../../types/button';
2
+ import type { Avatar, Button } from '../../types';
5
3
  declare const _default: import("vue").DefineComponent<{
6
4
  title: {
7
5
  type: StringConstructor;
@@ -21,7 +19,7 @@ declare const _default: import("vue").DefineComponent<{
21
19
  };
22
20
  closeButton: {
23
21
  type: PropType<Button>;
24
- default: () => any;
22
+ default: () => Button;
25
23
  };
26
24
  actions: {
27
25
  type: PropType<(Button & {
@@ -30,24 +28,28 @@ declare const _default: import("vue").DefineComponent<{
30
28
  default: () => never[];
31
29
  };
32
30
  color: {
33
- type: StringConstructor;
31
+ type: PropType<any>;
34
32
  default: () => any;
35
33
  validator(value: string): boolean;
36
34
  };
37
35
  variant: {
38
- type: StringConstructor;
36
+ type: PropType<any>;
39
37
  default: () => any;
40
38
  validator(value: string): boolean;
41
39
  };
42
- ui: {
40
+ class: {
43
41
  type: PropType<any>;
44
- default: () => {};
42
+ default: undefined;
43
+ };
44
+ ui: {
45
+ type: PropType<Partial<any>>;
46
+ default: undefined;
45
47
  };
46
48
  }, {
47
- attrs: import("lodash").Omit<{
48
- [x: string]: unknown;
49
- }, "class">;
50
49
  ui: import("vue").ComputedRef<any>;
50
+ attrs: import("vue").ComputedRef<Pick<{
51
+ [x: string]: unknown;
52
+ }, string>>;
51
53
  alertClass: import("vue").ComputedRef<string>;
52
54
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "close"[], "close", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
53
55
  title: {
@@ -68,7 +70,7 @@ declare const _default: import("vue").DefineComponent<{
68
70
  };
69
71
  closeButton: {
70
72
  type: PropType<Button>;
71
- default: () => any;
73
+ default: () => Button;
72
74
  };
73
75
  actions: {
74
76
  type: PropType<(Button & {
@@ -77,18 +79,22 @@ declare const _default: import("vue").DefineComponent<{
77
79
  default: () => never[];
78
80
  };
79
81
  color: {
80
- type: StringConstructor;
82
+ type: PropType<any>;
81
83
  default: () => any;
82
84
  validator(value: string): boolean;
83
85
  };
84
86
  variant: {
85
- type: StringConstructor;
87
+ type: PropType<any>;
86
88
  default: () => any;
87
89
  validator(value: string): boolean;
88
90
  };
89
- ui: {
91
+ class: {
90
92
  type: PropType<any>;
91
- default: () => {};
93
+ default: undefined;
94
+ };
95
+ ui: {
96
+ type: PropType<Partial<any>>;
97
+ default: undefined;
92
98
  };
93
99
  }>> & {
94
100
  onClose?: ((...args: any[]) => any) | undefined;
@@ -100,8 +106,9 @@ declare const _default: import("vue").DefineComponent<{
100
106
  actions: (Button & {
101
107
  click?: Function | undefined;
102
108
  })[];
103
- color: string;
104
- ui: any;
105
- variant: string;
109
+ color: any;
110
+ ui: Partial<any>;
111
+ class: any;
112
+ variant: any;
106
113
  }, {}>;
107
114
  export default _default;
@@ -20,13 +20,14 @@
20
20
  </template>
21
21
 
22
22
  <script>
23
- import { defineComponent, ref, computed, watch } from "vue";
23
+ import { defineComponent, ref, computed, toRef, watch } from "vue";
24
24
  import { twMerge, twJoin } from "tailwind-merge";
25
25
  import UIcon from "../elements/Icon.vue";
26
- import { defuTwMerge } from "../../utils";
27
- import { useAppConfig } from "#imports";
26
+ import { useUI } from "../../composables/useUI";
27
+ import { mergeConfig } from "../../utils";
28
28
  import appConfig from "#build/app.config";
29
- import { omit } from "lodash-es";
29
+ import { avatar } from "#ui/ui.config";
30
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.avatar, avatar);
30
31
  export default defineComponent({
31
32
  components: {
32
33
  UIcon
@@ -47,27 +48,27 @@ export default defineComponent({
47
48
  },
48
49
  icon: {
49
50
  type: String,
50
- default: () => appConfig.ui.avatar.default.icon
51
+ default: () => config.default.icon
51
52
  },
52
53
  size: {
53
54
  type: String,
54
- default: () => appConfig.ui.avatar.default.size,
55
+ default: () => config.default.size,
55
56
  validator(value) {
56
- return Object.keys(appConfig.ui.avatar.size).includes(value);
57
+ return Object.keys(config.size).includes(value);
57
58
  }
58
59
  },
59
60
  chipColor: {
60
61
  type: String,
61
- default: () => appConfig.ui.avatar.default.chipColor,
62
+ default: () => config.default.chipColor,
62
63
  validator(value) {
63
64
  return ["gray", ...appConfig.ui.colors].includes(value);
64
65
  }
65
66
  },
66
67
  chipPosition: {
67
68
  type: String,
68
- default: () => appConfig.ui.avatar.default.chipPosition,
69
+ default: () => config.default.chipPosition,
69
70
  validator(value) {
70
- return Object.keys(appConfig.ui.avatar.chip.position).includes(value);
71
+ return Object.keys(config.chip.position).includes(value);
71
72
  }
72
73
  },
73
74
  chipText: {
@@ -78,14 +79,17 @@ export default defineComponent({
78
79
  type: String,
79
80
  default: ""
80
81
  },
82
+ class: {
83
+ type: [String, Object, Array],
84
+ default: void 0
85
+ },
81
86
  ui: {
82
87
  type: Object,
83
- default: () => ({})
88
+ default: void 0
84
89
  }
85
90
  },
86
- setup(props, { attrs }) {
87
- const appConfig2 = useAppConfig();
88
- const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.avatar));
91
+ setup(props) {
92
+ const { ui, attrs } = useUI("avatar", toRef(props, "ui"), config);
89
93
  const url = computed(() => {
90
94
  if (typeof props.src === "boolean") {
91
95
  return null;
@@ -101,7 +105,7 @@ export default defineComponent({
101
105
  (error.value || !url.value) && ui.value.background,
102
106
  ui.value.rounded,
103
107
  ui.value.size[props.size]
104
- ), attrs.class);
108
+ ), props.class);
105
109
  });
106
110
  const imgClass = computed(() => {
107
111
  return twMerge(twJoin(
@@ -133,7 +137,9 @@ export default defineComponent({
133
137
  error.value = true;
134
138
  }
135
139
  return {
136
- attrs: omit(attrs, ["class"]),
140
+ // eslint-disable-next-line vue/no-dupe-keys
141
+ ui,
142
+ attrs,
137
143
  wrapperClass,
138
144
  // eslint-disable-next-line vue/no-dupe-keys
139
145
  imgClass,
@@ -1,4 +1,3 @@
1
- /// <reference types="lodash" />
2
1
  import type { PropType } from 'vue';
3
2
  declare const _default: import("vue").DefineComponent<{
4
3
  src: {
@@ -18,36 +17,41 @@ declare const _default: import("vue").DefineComponent<{
18
17
  default: () => any;
19
18
  };
20
19
  size: {
21
- type: StringConstructor;
20
+ type: PropType<"sm" | "3xs" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl" | "3xl">;
22
21
  default: () => any;
23
22
  validator(value: string): boolean;
24
23
  };
25
24
  chipColor: {
26
- type: StringConstructor;
25
+ type: PropType<any>;
27
26
  default: () => any;
28
27
  validator(value: string): boolean;
29
28
  };
30
29
  chipPosition: {
31
- type: StringConstructor;
30
+ type: PropType<"top-right" | "bottom-right" | "top-left" | "bottom-left">;
32
31
  default: () => any;
33
32
  validator(value: string): boolean;
34
33
  };
35
34
  chipText: {
36
- type: (StringConstructor | NumberConstructor)[];
35
+ type: (NumberConstructor | StringConstructor)[];
37
36
  default: null;
38
37
  };
39
38
  imgClass: {
40
39
  type: StringConstructor;
41
40
  default: string;
42
41
  };
43
- ui: {
42
+ class: {
44
43
  type: PropType<any>;
45
- default: () => {};
44
+ default: undefined;
45
+ };
46
+ ui: {
47
+ type: PropType<Partial<any>>;
48
+ default: undefined;
46
49
  };
47
50
  }, {
48
- attrs: import("lodash").Omit<{
51
+ ui: import("vue").ComputedRef<any>;
52
+ attrs: import("vue").ComputedRef<Pick<{
49
53
  [x: string]: unknown;
50
- }, "class">;
54
+ }, string>>;
51
55
  wrapperClass: import("vue").ComputedRef<string>;
52
56
  imgClass: import("vue").ComputedRef<string>;
53
57
  iconClass: import("vue").ComputedRef<string>;
@@ -74,41 +78,46 @@ declare const _default: import("vue").DefineComponent<{
74
78
  default: () => any;
75
79
  };
76
80
  size: {
77
- type: StringConstructor;
81
+ type: PropType<"sm" | "3xs" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl" | "3xl">;
78
82
  default: () => any;
79
83
  validator(value: string): boolean;
80
84
  };
81
85
  chipColor: {
82
- type: StringConstructor;
86
+ type: PropType<any>;
83
87
  default: () => any;
84
88
  validator(value: string): boolean;
85
89
  };
86
90
  chipPosition: {
87
- type: StringConstructor;
91
+ type: PropType<"top-right" | "bottom-right" | "top-left" | "bottom-left">;
88
92
  default: () => any;
89
93
  validator(value: string): boolean;
90
94
  };
91
95
  chipText: {
92
- type: (StringConstructor | NumberConstructor)[];
96
+ type: (NumberConstructor | StringConstructor)[];
93
97
  default: null;
94
98
  };
95
99
  imgClass: {
96
100
  type: StringConstructor;
97
101
  default: string;
98
102
  };
99
- ui: {
103
+ class: {
100
104
  type: PropType<any>;
101
- default: () => {};
105
+ default: undefined;
106
+ };
107
+ ui: {
108
+ type: PropType<Partial<any>>;
109
+ default: undefined;
102
110
  };
103
111
  }>>, {
104
112
  alt: string;
105
113
  icon: string;
106
- ui: any;
114
+ ui: Partial<any>;
115
+ class: any;
107
116
  src: string | boolean;
108
117
  text: string;
109
- size: string;
110
- chipColor: string;
111
- chipPosition: string;
118
+ size: "sm" | "3xs" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl" | "3xl";
119
+ chipColor: any;
120
+ chipPosition: "top-right" | "bottom-right" | "top-left" | "bottom-left";
112
121
  chipText: string | number;
113
122
  imgClass: string;
114
123
  }, {}>;
@@ -1,7 +1,7 @@
1
1
  import type { PropType } from 'vue';
2
2
  declare const _default: import("vue").DefineComponent<{
3
3
  size: {
4
- type: StringConstructor;
4
+ type: PropType<string | number | symbol>;
5
5
  default: null;
6
6
  validator(value: string): boolean;
7
7
  };
@@ -9,15 +9,19 @@ declare const _default: import("vue").DefineComponent<{
9
9
  type: NumberConstructor;
10
10
  default: null;
11
11
  };
12
- ui: {
12
+ class: {
13
13
  type: PropType<any>;
14
- default: () => {};
14
+ default: undefined;
15
+ };
16
+ ui: {
17
+ type: PropType<Partial<any>>;
18
+ default: undefined;
15
19
  };
16
20
  }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
17
21
  [key: string]: any;
18
22
  }>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
19
23
  size: {
20
- type: StringConstructor;
24
+ type: PropType<string | number | symbol>;
21
25
  default: null;
22
26
  validator(value: string): boolean;
23
27
  };
@@ -25,13 +29,18 @@ declare const _default: import("vue").DefineComponent<{
25
29
  type: NumberConstructor;
26
30
  default: null;
27
31
  };
28
- ui: {
32
+ class: {
29
33
  type: PropType<any>;
30
- default: () => {};
34
+ default: undefined;
35
+ };
36
+ ui: {
37
+ type: PropType<Partial<any>>;
38
+ default: undefined;
31
39
  };
32
40
  }>>, {
33
- ui: any;
34
- size: string;
41
+ ui: Partial<any>;
42
+ class: any;
43
+ size: string | number | symbol;
35
44
  max: number;
36
45
  }, {}>;
37
46
  export default _default;
@@ -1,10 +1,12 @@
1
- import { h, cloneVNode, computed, defineComponent } from "vue";
2
- import { omit } from "lodash-es";
1
+ import { h, cloneVNode, computed, toRef, defineComponent } from "vue";
3
2
  import { twMerge, twJoin } from "tailwind-merge";
4
- import { defuTwMerge, getSlotsChildren } from "../../utils/index.mjs";
5
- import Avatar from "./Avatar.vue";
6
- import { useAppConfig } from "#imports";
3
+ import UAvatar from "./Avatar.vue";
4
+ import { useUI } from "../../composables/useUI.mjs";
5
+ import { mergeConfig, getSlotsChildren } from "../../utils/index.mjs";
7
6
  import appConfig from "#build/app.config";
7
+ import { avatar, avatarGroup } from "#ui/ui.config";
8
+ const avatarConfig = mergeConfig(appConfig.ui.strategy, appConfig.ui.avatar, avatar);
9
+ const avatarGroupConfig = mergeConfig(appConfig.ui.strategy, appConfig.ui.avatarGroup, avatarGroup);
8
10
  export default defineComponent({
9
11
  inheritAttrs: false,
10
12
  props: {
@@ -12,21 +14,24 @@ export default defineComponent({
12
14
  type: String,
13
15
  default: null,
14
16
  validator(value) {
15
- return Object.keys(appConfig.ui.avatar.size).includes(value);
17
+ return Object.keys(avatarConfig.size).includes(value);
16
18
  }
17
19
  },
18
20
  max: {
19
21
  type: Number,
20
22
  default: null
21
23
  },
24
+ class: {
25
+ type: [String, Object, Array],
26
+ default: void 0
27
+ },
22
28
  ui: {
23
29
  type: Object,
24
- default: () => ({})
30
+ default: void 0
25
31
  }
26
32
  },
27
- setup(props, { attrs, slots }) {
28
- const appConfig2 = useAppConfig();
29
- const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.avatarGroup));
33
+ setup(props, { slots }) {
34
+ const { ui, attrs } = useUI("avatarGroup", toRef(props, "ui"), avatarGroupConfig, toRef(props, "class"));
30
35
  const children = computed(() => getSlotsChildren(slots));
31
36
  const max = computed(() => typeof props.max === "string" ? parseInt(props.max, 10) : props.max);
32
37
  const clones = computed(() => children.value.map((node, index) => {
@@ -40,14 +45,14 @@ export default defineComponent({
40
45
  return cloneVNode(node, vProps);
41
46
  }
42
47
  if (max.value !== void 0 && index === max.value) {
43
- return h(Avatar, {
44
- size: props.size || appConfig2.ui.avatar.default.size,
48
+ return h(UAvatar, {
49
+ size: props.size || avatarConfig.default.size,
45
50
  text: `+${children.value.length - max.value}`,
46
51
  class: twJoin(ui.value.ring, ui.value.margin)
47
52
  });
48
53
  }
49
54
  return null;
50
55
  }).filter(Boolean).reverse());
51
- return () => h("div", { class: twMerge(ui.value.wrapper, attrs.class), ...omit(attrs, ["class"]) }, clones.value);
56
+ return () => h("div", { class: ui.value.wrapper, ...attrs.value }, clones.value);
52
57
  }
53
58
  });
@@ -5,36 +5,37 @@
5
5
  </template>
6
6
 
7
7
  <script>
8
- import { computed, defineComponent } from "vue";
9
- import { omit } from "lodash-es";
8
+ import { computed, toRef, defineComponent } from "vue";
10
9
  import { twMerge, twJoin } from "tailwind-merge";
11
- import { defuTwMerge } from "../../utils";
12
- import { useAppConfig } from "#imports";
10
+ import { useUI } from "../../composables/useUI";
11
+ import { mergeConfig } from "../../utils";
13
12
  import appConfig from "#build/app.config";
13
+ import { badge } from "#ui/ui.config";
14
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.badge, badge);
14
15
  export default defineComponent({
15
16
  inheritAttrs: false,
16
17
  props: {
17
18
  size: {
18
19
  type: String,
19
- default: () => appConfig.ui.badge.default.size,
20
+ default: () => config.default.size,
20
21
  validator(value) {
21
- return Object.keys(appConfig.ui.badge.size).includes(value);
22
+ return Object.keys(config.size).includes(value);
22
23
  }
23
24
  },
24
25
  color: {
25
26
  type: String,
26
- default: () => appConfig.ui.badge.default.color,
27
+ default: () => config.default.color,
27
28
  validator(value) {
28
- return [...appConfig.ui.colors, ...Object.keys(appConfig.ui.badge.color)].includes(value);
29
+ return [...appConfig.ui.colors, ...Object.keys(config.color)].includes(value);
29
30
  }
30
31
  },
31
32
  variant: {
32
33
  type: String,
33
- default: () => appConfig.ui.badge.default.variant,
34
+ default: () => config.default.variant,
34
35
  validator(value) {
35
36
  return [
36
- ...Object.keys(appConfig.ui.badge.variant),
37
- ...Object.values(appConfig.ui.badge.color).flatMap((value2) => Object.keys(value2))
37
+ ...Object.keys(config.variant),
38
+ ...Object.values(config.color).flatMap((value2) => Object.keys(value2))
38
39
  ].includes(value);
39
40
  }
40
41
  },
@@ -42,14 +43,17 @@ export default defineComponent({
42
43
  type: [String, Number],
43
44
  default: null
44
45
  },
46
+ class: {
47
+ type: [String, Object, Array],
48
+ default: void 0
49
+ },
45
50
  ui: {
46
51
  type: Object,
47
- default: () => ({})
52
+ default: void 0
48
53
  }
49
54
  },
50
- setup(props, { attrs }) {
51
- const appConfig2 = useAppConfig();
52
- const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.badge));
55
+ setup(props) {
56
+ const { ui, attrs } = useUI("badge", toRef(props, "ui"), config);
53
57
  const badgeClass = computed(() => {
54
58
  const variant = ui.value.color?.[props.color]?.[props.variant] || ui.value.variant[props.variant];
55
59
  return twMerge(twJoin(
@@ -58,10 +62,10 @@ export default defineComponent({
58
62
  ui.value.rounded,
59
63
  ui.value.size[props.size],
60
64
  variant?.replaceAll("{color}", props.color)
61
- ), attrs.class);
65
+ ), props.class);
62
66
  });
63
67
  return {
64
- attrs: omit(attrs, ["class"]),
68
+ attrs,
65
69
  badgeClass
66
70
  };
67
71
  }