@nuxt/ui 2.8.1 → 2.9.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 (103) hide show
  1. package/README.md +1 -0
  2. package/dist/module.d.mts +1147 -1096
  3. package/dist/module.d.ts +1147 -1096
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +35 -10
  6. package/dist/runtime/components/data/Table.vue +42 -29
  7. package/dist/runtime/components/data/Table.vue.d.ts +20 -13
  8. package/dist/runtime/components/elements/Accordion.vue +25 -22
  9. package/dist/runtime/components/elements/Accordion.vue.d.ts +21 -17
  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 +26 -17
  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 +15 -13
  23. package/dist/runtime/components/elements/Dropdown.vue.d.ts +20 -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/forms/Checkbox.vue +27 -17
  28. package/dist/runtime/components/forms/Checkbox.vue.d.ts +33 -15
  29. package/dist/runtime/components/forms/Form.vue +2 -2
  30. package/dist/runtime/components/forms/FormGroup.vue +51 -27
  31. package/dist/runtime/components/forms/FormGroup.vue.d.ts +23 -15
  32. package/dist/runtime/components/forms/Input.vue +36 -28
  33. package/dist/runtime/components/forms/Input.vue.d.ts +41 -23
  34. package/dist/runtime/components/forms/Radio.vue +27 -17
  35. package/dist/runtime/components/forms/Radio.vue.d.ts +35 -17
  36. package/dist/runtime/components/forms/Range.vue +26 -16
  37. package/dist/runtime/components/forms/Range.vue.d.ts +36 -17
  38. package/dist/runtime/components/forms/Select.vue +34 -26
  39. package/dist/runtime/components/forms/Select.vue.d.ts +42 -24
  40. package/dist/runtime/components/forms/SelectMenu.vue +43 -33
  41. package/dist/runtime/components/forms/SelectMenu.vue.d.ts +49 -30
  42. package/dist/runtime/components/forms/Textarea.vue +38 -30
  43. package/dist/runtime/components/forms/Textarea.vue.d.ts +41 -23
  44. package/dist/runtime/components/forms/Toggle.vue +26 -15
  45. package/dist/runtime/components/forms/Toggle.vue.d.ts +31 -12
  46. package/dist/runtime/components/layout/Card.vue +15 -10
  47. package/dist/runtime/components/layout/Card.vue.d.ts +17 -9
  48. package/dist/runtime/components/layout/Container.vue +15 -10
  49. package/dist/runtime/components/layout/Container.vue.d.ts +17 -9
  50. package/dist/runtime/components/layout/Skeleton.vue +15 -10
  51. package/dist/runtime/components/layout/Skeleton.vue.d.ts +17 -9
  52. package/dist/runtime/components/navigation/CommandPalette.vue +50 -38
  53. package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +23 -22
  54. package/dist/runtime/components/navigation/CommandPaletteGroup.vue +1 -1
  55. package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +3 -4
  56. package/dist/runtime/components/navigation/Pagination.vue +64 -55
  57. package/dist/runtime/components/navigation/Pagination.vue.d.ts +29 -22
  58. package/dist/runtime/components/navigation/Tabs.vue +16 -13
  59. package/dist/runtime/components/navigation/Tabs.vue.d.ts +18 -11
  60. package/dist/runtime/components/navigation/VerticalNavigation.vue +15 -13
  61. package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +20 -16
  62. package/dist/runtime/components/overlays/ContextMenu.vue +14 -9
  63. package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +18 -10
  64. package/dist/runtime/components/overlays/Modal.vue +15 -13
  65. package/dist/runtime/components/overlays/Modal.vue.d.ts +17 -10
  66. package/dist/runtime/components/overlays/Notification.vue +18 -14
  67. package/dist/runtime/components/overlays/Notification.vue.d.ts +25 -19
  68. package/dist/runtime/components/overlays/Notifications.vue +18 -12
  69. package/dist/runtime/components/overlays/Notifications.vue.d.ts +22 -14
  70. package/dist/runtime/components/overlays/Popover.vue +18 -16
  71. package/dist/runtime/components/overlays/Popover.vue.d.ts +18 -11
  72. package/dist/runtime/components/overlays/Slideover.vue +15 -13
  73. package/dist/runtime/components/overlays/Slideover.vue.d.ts +17 -10
  74. package/dist/runtime/components/overlays/Tooltip.vue +15 -13
  75. package/dist/runtime/components/overlays/Tooltip.vue.d.ts +18 -11
  76. package/dist/runtime/composables/useFormGroup.d.ts +12 -2
  77. package/dist/runtime/composables/useFormGroup.mjs +10 -4
  78. package/dist/runtime/composables/usePopper.mjs +40 -30
  79. package/dist/runtime/composables/useToast.d.ts +3 -3
  80. package/dist/runtime/composables/useUI.d.ts +10 -0
  81. package/dist/runtime/composables/useUI.mjs +24 -0
  82. package/dist/runtime/types/avatar.d.ts +10 -4
  83. package/dist/runtime/types/badge.d.ts +14 -0
  84. package/dist/runtime/types/button.d.ts +10 -3
  85. package/dist/runtime/types/command-palette.d.ts +2 -1
  86. package/dist/runtime/types/form.d.ts +8 -1
  87. package/dist/runtime/types/index.d.ts +2 -0
  88. package/dist/runtime/types/link.d.ts +1 -0
  89. package/dist/runtime/types/notification.d.ts +5 -3
  90. package/dist/runtime/types/tabs.d.ts +1 -0
  91. package/dist/runtime/types/utils.d.ts +11 -0
  92. package/dist/runtime/ui.config.d.ts +1207 -0
  93. package/dist/runtime/{app.config.mjs → ui.config.mjs} +52 -80
  94. package/dist/runtime/utils/index.d.ts +5 -11
  95. package/dist/runtime/utils/index.mjs +21 -9
  96. package/dist/runtime/utils/lodash.d.ts +2 -0
  97. package/dist/runtime/utils/lodash.mjs +23 -0
  98. package/dist/runtime/utils/uid.d.ts +1 -0
  99. package/dist/runtime/utils/uid.mjs +4 -0
  100. package/dist/types.d.mts +1 -1
  101. package/dist/types.d.ts +1 -1
  102. package/package.json +19 -21
  103. package/dist/runtime/app.config.d.ts +0 -1203
@@ -17,14 +17,15 @@
17
17
  </template>
18
18
 
19
19
  <script>
20
- import { computed, defineComponent } from "vue";
21
- import { omit } from "lodash-es";
20
+ import { computed, defineComponent, toRef } from "vue";
22
21
  import { twMerge, twJoin } from "tailwind-merge";
23
22
  import UIcon from "../elements/Icon.vue";
24
23
  import ULink from "../elements/Link.vue";
25
- import { defuTwMerge } from "../../utils";
26
- import { useAppConfig } from "#imports";
24
+ import { useUI } from "../../composables/useUI";
25
+ import { mergeConfig } from "../../utils";
27
26
  import appConfig from "#build/app.config";
27
+ import { button } from "#ui/ui.config";
28
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.button, button);
28
29
  export default defineComponent({
29
30
  components: {
30
31
  UIcon,
@@ -58,25 +59,25 @@ export default defineComponent({
58
59
  },
59
60
  size: {
60
61
  type: String,
61
- default: () => appConfig.ui.button.default.size,
62
+ default: () => config.default.size,
62
63
  validator(value) {
63
- return Object.keys(appConfig.ui.button.size).includes(value);
64
+ return Object.keys(config.size).includes(value);
64
65
  }
65
66
  },
66
67
  color: {
67
68
  type: String,
68
- default: () => appConfig.ui.button.default.color,
69
+ default: () => config.default.color,
69
70
  validator(value) {
70
- return [...appConfig.ui.colors, ...Object.keys(appConfig.ui.button.color)].includes(value);
71
+ return [...appConfig.ui.colors, ...Object.keys(config.color)].includes(value);
71
72
  }
72
73
  },
73
74
  variant: {
74
75
  type: String,
75
- default: () => appConfig.ui.button.default.variant,
76
+ default: () => config.default.variant,
76
77
  validator(value) {
77
78
  return [
78
- ...Object.keys(appConfig.ui.button.variant),
79
- ...Object.values(appConfig.ui.button.color).flatMap((value2) => Object.keys(value2))
79
+ ...Object.keys(config.variant),
80
+ ...Object.values(config.color).flatMap((value2) => Object.keys(value2))
80
81
  ].includes(value);
81
82
  }
82
83
  },
@@ -86,7 +87,7 @@ export default defineComponent({
86
87
  },
87
88
  loadingIcon: {
88
89
  type: String,
89
- default: () => appConfig.ui.button.default.loadingIcon
90
+ default: () => config.default.loadingIcon
90
91
  },
91
92
  leadingIcon: {
92
93
  type: String,
@@ -112,14 +113,17 @@ export default defineComponent({
112
113
  type: Boolean,
113
114
  default: false
114
115
  },
116
+ class: {
117
+ type: [String, Object, Array],
118
+ default: void 0
119
+ },
115
120
  ui: {
116
121
  type: Object,
117
- default: () => ({})
122
+ default: void 0
118
123
  }
119
124
  },
120
- setup(props, { attrs, slots }) {
121
- const appConfig2 = useAppConfig();
122
- const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.button));
125
+ setup(props, { slots }) {
126
+ const { ui, attrs } = useUI("button", toRef(props, "ui"), config);
123
127
  const isLeading = computed(() => {
124
128
  return props.icon && props.leading || props.icon && !props.trailing || props.loading && !props.trailing || props.leadingIcon;
125
129
  });
@@ -138,7 +142,7 @@ export default defineComponent({
138
142
  props.padded && ui.value[isSquare.value ? "square" : "padding"][props.size],
139
143
  variant?.replaceAll("{color}", props.color),
140
144
  props.block ? "w-full flex justify-center items-center" : "inline-flex items-center"
141
- ), attrs.class);
145
+ ), props.class);
142
146
  });
143
147
  const leadingIconName = computed(() => {
144
148
  if (props.loading) {
@@ -167,7 +171,7 @@ export default defineComponent({
167
171
  );
168
172
  });
169
173
  return {
170
- attrs: omit(attrs, ["class"]),
174
+ attrs,
171
175
  isLeading,
172
176
  isTrailing,
173
177
  isSquare,
@@ -1,5 +1,5 @@
1
- /// <reference types="lodash" />
2
1
  import type { PropType } from 'vue';
2
+ import type { ButtonVariant } from '../../types';
3
3
  declare const _default: import("vue").DefineComponent<{
4
4
  type: {
5
5
  type: StringConstructor;
@@ -26,17 +26,17 @@ declare const _default: import("vue").DefineComponent<{
26
26
  default: boolean;
27
27
  };
28
28
  size: {
29
- type: StringConstructor;
29
+ type: PropType<"sm" | "md" | "xs" | "2xs" | "lg" | "xl">;
30
30
  default: () => any;
31
31
  validator(value: string): boolean;
32
32
  };
33
33
  color: {
34
- type: StringConstructor;
34
+ type: PropType<any>;
35
35
  default: () => any;
36
36
  validator(value: string): boolean;
37
37
  };
38
38
  variant: {
39
- type: StringConstructor;
39
+ type: PropType<ButtonVariant>;
40
40
  default: () => any;
41
41
  validator(value: string): boolean;
42
42
  };
@@ -72,14 +72,18 @@ declare const _default: import("vue").DefineComponent<{
72
72
  type: BooleanConstructor;
73
73
  default: boolean;
74
74
  };
75
- ui: {
75
+ class: {
76
76
  type: PropType<any>;
77
- default: () => {};
77
+ default: undefined;
78
+ };
79
+ ui: {
80
+ type: PropType<Partial<any>>;
81
+ default: undefined;
78
82
  };
79
83
  }, {
80
- attrs: import("lodash").Omit<{
84
+ attrs: import("vue").ComputedRef<Pick<{
81
85
  [x: string]: unknown;
82
- }, "class">;
86
+ }, string>>;
83
87
  isLeading: import("vue").ComputedRef<string | true>;
84
88
  isTrailing: import("vue").ComputedRef<string | true>;
85
89
  isSquare: import("vue").ComputedRef<boolean>;
@@ -114,17 +118,17 @@ declare const _default: import("vue").DefineComponent<{
114
118
  default: boolean;
115
119
  };
116
120
  size: {
117
- type: StringConstructor;
121
+ type: PropType<"sm" | "md" | "xs" | "2xs" | "lg" | "xl">;
118
122
  default: () => any;
119
123
  validator(value: string): boolean;
120
124
  };
121
125
  color: {
122
- type: StringConstructor;
126
+ type: PropType<any>;
123
127
  default: () => any;
124
128
  validator(value: string): boolean;
125
129
  };
126
130
  variant: {
127
- type: StringConstructor;
131
+ type: PropType<ButtonVariant>;
128
132
  default: () => any;
129
133
  validator(value: string): boolean;
130
134
  };
@@ -160,20 +164,25 @@ declare const _default: import("vue").DefineComponent<{
160
164
  type: BooleanConstructor;
161
165
  default: boolean;
162
166
  };
163
- ui: {
167
+ class: {
164
168
  type: PropType<any>;
165
- default: () => {};
169
+ default: undefined;
170
+ };
171
+ ui: {
172
+ type: PropType<Partial<any>>;
173
+ default: undefined;
166
174
  };
167
175
  }>>, {
168
176
  icon: string;
169
- color: string;
170
- ui: any;
177
+ color: any;
178
+ ui: Partial<any>;
179
+ class: any;
171
180
  label: string;
172
181
  type: string;
173
182
  loading: boolean;
174
183
  disabled: boolean;
175
- variant: string;
176
- size: string;
184
+ variant: ButtonVariant;
185
+ size: "sm" | "md" | "xs" | "2xs" | "lg" | "xl";
177
186
  block: boolean;
178
187
  padded: boolean;
179
188
  loadingIcon: string;
@@ -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<"sm" | "md" | "xs" | "2xs" | "lg" | "xl">;
5
5
  default: null;
6
6
  validator(value: string): boolean;
7
7
  };
@@ -10,15 +10,19 @@ declare const _default: import("vue").DefineComponent<{
10
10
  default: string;
11
11
  validator(value: string): boolean;
12
12
  };
13
- ui: {
13
+ class: {
14
14
  type: PropType<any>;
15
- default: () => {};
15
+ default: undefined;
16
+ };
17
+ ui: {
18
+ type: PropType<Partial<any>>;
19
+ default: undefined;
16
20
  };
17
21
  }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
18
22
  [key: string]: any;
19
23
  }>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
20
24
  size: {
21
- type: StringConstructor;
25
+ type: PropType<"sm" | "md" | "xs" | "2xs" | "lg" | "xl">;
22
26
  default: null;
23
27
  validator(value: string): boolean;
24
28
  };
@@ -27,13 +31,18 @@ declare const _default: import("vue").DefineComponent<{
27
31
  default: string;
28
32
  validator(value: string): boolean;
29
33
  };
30
- ui: {
34
+ class: {
31
35
  type: PropType<any>;
32
- default: () => {};
36
+ default: undefined;
37
+ };
38
+ ui: {
39
+ type: PropType<Partial<any>>;
40
+ default: undefined;
33
41
  };
34
42
  }>>, {
35
- ui: any;
36
- size: string;
43
+ ui: Partial<any>;
44
+ class: any;
45
+ size: "sm" | "md" | "xs" | "2xs" | "lg" | "xl";
37
46
  orientation: "horizontal" | "vertical";
38
47
  }, {}>;
39
48
  export default _default;
@@ -1,9 +1,11 @@
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 { useAppConfig } from "#imports";
3
+ import { useUI } from "../../composables/useUI.mjs";
4
+ import { mergeConfig, getSlotsChildren } from "../../utils/index.mjs";
6
5
  import appConfig from "#build/app.config";
6
+ import { button, buttonGroup } from "#ui/ui.config";
7
+ const buttonConfig = mergeConfig(appConfig.ui.strategy, appConfig.ui.button, button);
8
+ const buttonGroupConfig = mergeConfig(appConfig.ui.strategy, appConfig.ui.buttonGroup, buttonGroup);
7
9
  export default defineComponent({
8
10
  inheritAttrs: false,
9
11
  props: {
@@ -11,7 +13,7 @@ export default defineComponent({
11
13
  type: String,
12
14
  default: null,
13
15
  validator(value) {
14
- return Object.keys(appConfig.ui.button.size).includes(value);
16
+ return Object.keys(buttonConfig.size).includes(value);
15
17
  }
16
18
  },
17
19
  orientation: {
@@ -21,14 +23,17 @@ export default defineComponent({
21
23
  return ["horizontal", "vertical"].includes(value);
22
24
  }
23
25
  },
26
+ class: {
27
+ type: [String, Object, Array],
28
+ default: void 0
29
+ },
24
30
  ui: {
25
31
  type: Object,
26
- default: () => ({})
32
+ default: void 0
27
33
  }
28
34
  },
29
- setup(props, { attrs, slots }) {
30
- const appConfig2 = useAppConfig();
31
- const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.buttonGroup));
35
+ setup(props, { slots }) {
36
+ const { ui, attrs } = useUI("buttonGroup", toRef(props, "ui"), buttonGroupConfig);
32
37
  const children = computed(() => getSlotsChildren(slots));
33
38
  const rounded = computed(() => {
34
39
  const roundedMap = {
@@ -46,11 +51,6 @@ export default defineComponent({
46
51
  });
47
52
  const clones = computed(() => children.value.map((node, index) => {
48
53
  const vProps = {};
49
- if (props.orientation === "vertical") {
50
- ui.value.wrapper = "flex flex-col -space-y-px";
51
- } else {
52
- ui.value.wrapper = "inline-flex -space-x-px";
53
- }
54
54
  if (props.size) {
55
55
  vProps.size = props.size;
56
56
  }
@@ -65,6 +65,13 @@ export default defineComponent({
65
65
  }
66
66
  return cloneVNode(node, vProps);
67
67
  }));
68
- return () => h("div", { class: twMerge(twJoin(ui.value.wrapper, ui.value.rounded, ui.value.shadow), attrs.class), ...omit(attrs, ["class"]) }, clones.value);
68
+ const wrapperClass = computed(() => {
69
+ return twMerge(twJoin(
70
+ ui.value.wrapper[props.orientation],
71
+ ui.value.rounded,
72
+ ui.value.shadow
73
+ ), props.class);
74
+ });
75
+ return () => h("div", { class: wrapperClass.value, ...attrs.value }, clones.value);
69
76
  }
70
77
  });
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <HMenu v-slot="{ open }" as="div" :class="wrapperClass" v-bind="attrs" @mouseleave="onMouseLeave">
2
+ <HMenu v-slot="{ open }" as="div" :class="ui.wrapper" v-bind="attrs" @mouseleave="onMouseLeave">
3
3
  <HMenuButton
4
4
  ref="trigger"
5
5
  as="div"
@@ -45,18 +45,19 @@
45
45
  </template>
46
46
 
47
47
  <script>
48
- import { defineComponent, ref, computed, onMounted } from "vue";
48
+ import { defineComponent, ref, computed, toRef, onMounted } from "vue";
49
49
  import { Menu as HMenu, MenuButton as HMenuButton, MenuItems as HMenuItems, MenuItem as HMenuItem } from "@headlessui/vue";
50
50
  import { defu } from "defu";
51
- import { omit } from "lodash-es";
52
- import { twMerge } from "tailwind-merge";
53
51
  import UIcon from "../elements/Icon.vue";
54
52
  import UAvatar from "../elements/Avatar.vue";
55
53
  import UKbd from "../elements/Kbd.vue";
56
54
  import ULink from "../elements/Link.vue";
55
+ import { useUI } from "../../composables/useUI";
57
56
  import { usePopper } from "../../composables/usePopper";
58
- import { defuTwMerge } from "../../utils";
59
- import { useAppConfig } from "#imports";
57
+ import { mergeConfig, omit } from "../../utils";
58
+ import appConfig from "#build/app.config";
59
+ import { dropdown } from "#ui/ui.config";
60
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.dropdown, dropdown);
60
61
  export default defineComponent({
61
62
  components: {
62
63
  HMenu,
@@ -95,14 +96,17 @@ export default defineComponent({
95
96
  type: Number,
96
97
  default: 0
97
98
  },
99
+ class: {
100
+ type: [String, Object, Array],
101
+ default: void 0
102
+ },
98
103
  ui: {
99
104
  type: Object,
100
- default: () => ({})
105
+ default: void 0
101
106
  }
102
107
  },
103
- setup(props, { attrs }) {
104
- const appConfig2 = useAppConfig();
105
- const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.dropdown));
108
+ setup(props) {
109
+ const { ui, attrs } = useUI("dropdown", toRef(props, "ui"), config, toRef(props, "class"));
106
110
  const popper = computed(() => defu(props.mode === "hover" ? { offsetDistance: 0 } : {}, props.popper, ui.value.popper));
107
111
  const [trigger, container] = usePopper(popper.value);
108
112
  const menuApi = ref(null);
@@ -122,7 +126,6 @@ export default defineComponent({
122
126
  const offsetDistance = props.popper?.offsetDistance || ui.value.popper?.offsetDistance || 8;
123
127
  return props.mode === "hover" ? { paddingTop: `${offsetDistance}px`, paddingBottom: `${offsetDistance}px` } : {};
124
128
  });
125
- const wrapperClass = computed(() => twMerge(ui.value.wrapper, attrs.class));
126
129
  function onMouseOver() {
127
130
  if (props.mode !== "hover" || !menuApi.value) {
128
131
  return;
@@ -156,13 +159,12 @@ export default defineComponent({
156
159
  }, props.closeDelay);
157
160
  }
158
161
  return {
159
- attrs: omit(attrs, ["class"]),
160
162
  // eslint-disable-next-line vue/no-dupe-keys
161
163
  ui,
164
+ attrs,
162
165
  trigger,
163
166
  container,
164
167
  containerStyle,
165
- wrapperClass,
166
168
  onMouseOver,
167
169
  onMouseLeave,
168
170
  omit
@@ -1,7 +1,6 @@
1
- /// <reference types="lodash" />
2
1
  import type { PropType } from 'vue';
3
- import type { DropdownItem } from '../../types/dropdown';
4
- import type { PopperOptions } from '../../types/popper';
2
+ import { omit } from '../../utils';
3
+ import type { DropdownItem, PopperOptions } from '../../types';
5
4
  declare const _default: import("vue").DefineComponent<{
6
5
  items: {
7
6
  type: PropType<DropdownItem[][]>;
@@ -28,15 +27,19 @@ declare const _default: import("vue").DefineComponent<{
28
27
  type: NumberConstructor;
29
28
  default: number;
30
29
  };
31
- ui: {
30
+ class: {
32
31
  type: PropType<any>;
33
- default: () => {};
32
+ default: undefined;
33
+ };
34
+ ui: {
35
+ type: PropType<Partial<any>>;
36
+ default: undefined;
34
37
  };
35
38
  }, {
36
- attrs: import("lodash").Omit<{
37
- [x: string]: unknown;
38
- }, "class">;
39
39
  ui: import("vue").ComputedRef<any>;
40
+ attrs: import("vue").ComputedRef<Pick<{
41
+ [x: string]: unknown;
42
+ }, string>>;
40
43
  trigger: import("vue").Ref<import("@vueuse/core").MaybeElement>;
41
44
  container: import("vue").Ref<import("@vueuse/core").MaybeElement>;
42
45
  containerStyle: import("vue").ComputedRef<{
@@ -46,14 +49,9 @@ declare const _default: import("vue").DefineComponent<{
46
49
  paddingTop?: undefined;
47
50
  paddingBottom?: undefined;
48
51
  }>;
49
- wrapperClass: import("vue").ComputedRef<string>;
50
52
  onMouseOver: () => void;
51
53
  onMouseLeave: () => void;
52
- omit: {
53
- <T extends object, K extends import("lodash").PropertyName[]>(object: T | null | undefined, ...paths: K): Pick<T, Exclude<keyof T, K[number]>>;
54
- <T_1 extends object, K_1 extends keyof T_1>(object: T_1 | null | undefined, ...paths: import("lodash").Many<K_1>[]): import("lodash").Omit<T_1, K_1>;
55
- <T_2 extends object>(object: T_2 | null | undefined, ...paths: import("lodash").Many<import("lodash").PropertyName>[]): Partial<T_2>;
56
- };
54
+ omit: typeof omit;
57
55
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
58
56
  items: {
59
57
  type: PropType<DropdownItem[][]>;
@@ -80,13 +78,18 @@ declare const _default: import("vue").DefineComponent<{
80
78
  type: NumberConstructor;
81
79
  default: number;
82
80
  };
83
- ui: {
81
+ class: {
84
82
  type: PropType<any>;
85
- default: () => {};
83
+ default: undefined;
84
+ };
85
+ ui: {
86
+ type: PropType<Partial<any>>;
87
+ default: undefined;
86
88
  };
87
89
  }>>, {
88
- ui: any;
90
+ ui: Partial<any>;
89
91
  popper: PopperOptions;
92
+ class: any;
90
93
  disabled: boolean;
91
94
  items: DropdownItem[][];
92
95
  mode: "click" | "hover";
@@ -5,12 +5,13 @@
5
5
  </template>
6
6
 
7
7
  <script>
8
- import { defineComponent, computed } from "vue";
9
- import { omit } from "lodash-es";
8
+ import { toRef, defineComponent, computed } 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 { kbd } from "#ui/ui.config";
14
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.kbd, kbd);
14
15
  export default defineComponent({
15
16
  inheritAttrs: false,
16
17
  props: {
@@ -20,19 +21,22 @@ export default defineComponent({
20
21
  },
21
22
  size: {
22
23
  type: String,
23
- default: () => appConfig.ui.kbd.default.size,
24
+ default: () => config.default.size,
24
25
  validator(value) {
25
- return Object.keys(appConfig.ui.kbd.size).includes(value);
26
+ return Object.keys(config.size).includes(value);
26
27
  }
27
28
  },
29
+ class: {
30
+ type: [String, Object, Array],
31
+ default: void 0
32
+ },
28
33
  ui: {
29
34
  type: Object,
30
- default: () => ({})
35
+ default: void 0
31
36
  }
32
37
  },
33
- setup(props, { attrs }) {
34
- const appConfig2 = useAppConfig();
35
- const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.kbd));
38
+ setup(props) {
39
+ const { ui, attrs } = useUI("kbd", toRef(props, "ui"), config);
36
40
  const kbdClass = computed(() => {
37
41
  return twMerge(twJoin(
38
42
  ui.value.base,
@@ -42,12 +46,12 @@ export default defineComponent({
42
46
  ui.value.font,
43
47
  ui.value.background,
44
48
  ui.value.ring
45
- ), attrs.class);
49
+ ), props.class);
46
50
  });
47
51
  return {
48
- attrs: omit(attrs, ["class"]),
49
52
  // eslint-disable-next-line vue/no-dupe-keys
50
53
  ui,
54
+ attrs,
51
55
  kbdClass
52
56
  };
53
57
  }
@@ -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
  value: {
@@ -6,19 +5,23 @@ declare const _default: import("vue").DefineComponent<{
6
5
  default: null;
7
6
  };
8
7
  size: {
9
- type: StringConstructor;
8
+ type: PropType<string | number | symbol>;
10
9
  default: () => any;
11
10
  validator(value: string): boolean;
12
11
  };
13
- ui: {
12
+ class: {
14
13
  type: PropType<any>;
15
- default: () => {};
14
+ default: undefined;
15
+ };
16
+ ui: {
17
+ type: PropType<Partial<any>>;
18
+ default: undefined;
16
19
  };
17
20
  }, {
18
- attrs: import("lodash").Omit<{
19
- [x: string]: unknown;
20
- }, "class">;
21
21
  ui: import("vue").ComputedRef<any>;
22
+ attrs: import("vue").ComputedRef<Pick<{
23
+ [x: string]: unknown;
24
+ }, string>>;
22
25
  kbdClass: import("vue").ComputedRef<string>;
23
26
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
24
27
  value: {
@@ -26,17 +29,22 @@ declare const _default: import("vue").DefineComponent<{
26
29
  default: null;
27
30
  };
28
31
  size: {
29
- type: StringConstructor;
32
+ type: PropType<string | number | symbol>;
30
33
  default: () => any;
31
34
  validator(value: string): boolean;
32
35
  };
33
- ui: {
36
+ class: {
34
37
  type: PropType<any>;
35
- default: () => {};
38
+ default: undefined;
39
+ };
40
+ ui: {
41
+ type: PropType<Partial<any>>;
42
+ default: undefined;
36
43
  };
37
44
  }>>, {
38
- ui: any;
45
+ ui: Partial<any>;
46
+ class: any;
39
47
  value: string;
40
- size: string;
48
+ size: string | number | symbol;
41
49
  }, {}>;
42
50
  export default _default;
@@ -1,7 +1,13 @@
1
1
  <template>
2
- <button v-if="!to" :type="type" :disabled="disabled" v-bind="$attrs" :class="inactiveClass">
2
+ <component
3
+ :is="as"
4
+ v-if="!to"
5
+ :disabled="disabled"
6
+ v-bind="$attrs"
7
+ :class="inactiveClass"
8
+ >
3
9
  <slot />
4
- </button>
10
+ </component>
5
11
  <NuxtLink
6
12
  v-else
7
13
  v-slot="{ route, href, target, rel, navigate, isActive, isExactActive, isExternal }"
@@ -24,21 +30,25 @@
24
30
  </template>
25
31
 
26
32
  <script>
27
- import { isEqual } from "lodash-es";
33
+ import { isEqual } from "ohash";
28
34
  import { defineComponent } from "vue";
29
35
  import { NuxtLink } from "#components";
30
36
  export default defineComponent({
31
37
  inheritAttrs: false,
32
38
  props: {
33
39
  ...NuxtLink.props,
34
- type: {
40
+ as: {
35
41
  type: String,
36
- default: null
42
+ default: "button"
37
43
  },
38
44
  disabled: {
39
45
  type: Boolean,
40
46
  default: null
41
47
  },
48
+ active: {
49
+ type: Boolean,
50
+ default: false
51
+ },
42
52
  exact: {
43
53
  type: Boolean,
44
54
  default: false
@@ -58,6 +68,9 @@ export default defineComponent({
58
68
  },
59
69
  setup(props) {
60
70
  function resolveLinkClass(route, $route, { isActive, isExactActive }) {
71
+ if (props.active) {
72
+ return props.activeClass;
73
+ }
61
74
  if (props.exactQuery && !isEqual(route.query, $route.query)) {
62
75
  return props.inactiveClass;
63
76
  }