@nuxt/ui 2.8.0 → 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 (104) 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 +4 -5
  30. package/dist/runtime/components/forms/Form.vue.d.ts +1 -1
  31. package/dist/runtime/components/forms/FormGroup.vue +51 -27
  32. package/dist/runtime/components/forms/FormGroup.vue.d.ts +23 -15
  33. package/dist/runtime/components/forms/Input.vue +36 -28
  34. package/dist/runtime/components/forms/Input.vue.d.ts +41 -23
  35. package/dist/runtime/components/forms/Radio.vue +27 -17
  36. package/dist/runtime/components/forms/Radio.vue.d.ts +35 -17
  37. package/dist/runtime/components/forms/Range.vue +26 -16
  38. package/dist/runtime/components/forms/Range.vue.d.ts +36 -17
  39. package/dist/runtime/components/forms/Select.vue +34 -26
  40. package/dist/runtime/components/forms/Select.vue.d.ts +42 -24
  41. package/dist/runtime/components/forms/SelectMenu.vue +43 -33
  42. package/dist/runtime/components/forms/SelectMenu.vue.d.ts +49 -30
  43. package/dist/runtime/components/forms/Textarea.vue +38 -30
  44. package/dist/runtime/components/forms/Textarea.vue.d.ts +41 -23
  45. package/dist/runtime/components/forms/Toggle.vue +26 -15
  46. package/dist/runtime/components/forms/Toggle.vue.d.ts +31 -12
  47. package/dist/runtime/components/layout/Card.vue +15 -10
  48. package/dist/runtime/components/layout/Card.vue.d.ts +17 -9
  49. package/dist/runtime/components/layout/Container.vue +15 -10
  50. package/dist/runtime/components/layout/Container.vue.d.ts +17 -9
  51. package/dist/runtime/components/layout/Skeleton.vue +15 -10
  52. package/dist/runtime/components/layout/Skeleton.vue.d.ts +17 -9
  53. package/dist/runtime/components/navigation/CommandPalette.vue +50 -38
  54. package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +23 -22
  55. package/dist/runtime/components/navigation/CommandPaletteGroup.vue +1 -1
  56. package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +3 -4
  57. package/dist/runtime/components/navigation/Pagination.vue +65 -56
  58. package/dist/runtime/components/navigation/Pagination.vue.d.ts +29 -22
  59. package/dist/runtime/components/navigation/Tabs.vue +16 -13
  60. package/dist/runtime/components/navigation/Tabs.vue.d.ts +18 -11
  61. package/dist/runtime/components/navigation/VerticalNavigation.vue +15 -13
  62. package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +20 -16
  63. package/dist/runtime/components/overlays/ContextMenu.vue +14 -9
  64. package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +18 -10
  65. package/dist/runtime/components/overlays/Modal.vue +15 -13
  66. package/dist/runtime/components/overlays/Modal.vue.d.ts +17 -10
  67. package/dist/runtime/components/overlays/Notification.vue +18 -14
  68. package/dist/runtime/components/overlays/Notification.vue.d.ts +25 -19
  69. package/dist/runtime/components/overlays/Notifications.vue +18 -12
  70. package/dist/runtime/components/overlays/Notifications.vue.d.ts +22 -14
  71. package/dist/runtime/components/overlays/Popover.vue +18 -16
  72. package/dist/runtime/components/overlays/Popover.vue.d.ts +18 -11
  73. package/dist/runtime/components/overlays/Slideover.vue +15 -13
  74. package/dist/runtime/components/overlays/Slideover.vue.d.ts +17 -10
  75. package/dist/runtime/components/overlays/Tooltip.vue +15 -13
  76. package/dist/runtime/components/overlays/Tooltip.vue.d.ts +18 -11
  77. package/dist/runtime/composables/useFormGroup.d.ts +12 -2
  78. package/dist/runtime/composables/useFormGroup.mjs +10 -4
  79. package/dist/runtime/composables/usePopper.mjs +40 -30
  80. package/dist/runtime/composables/useToast.d.ts +3 -3
  81. package/dist/runtime/composables/useUI.d.ts +10 -0
  82. package/dist/runtime/composables/useUI.mjs +24 -0
  83. package/dist/runtime/types/avatar.d.ts +10 -4
  84. package/dist/runtime/types/badge.d.ts +14 -0
  85. package/dist/runtime/types/button.d.ts +10 -3
  86. package/dist/runtime/types/command-palette.d.ts +2 -1
  87. package/dist/runtime/types/form.d.ts +8 -1
  88. package/dist/runtime/types/index.d.ts +2 -0
  89. package/dist/runtime/types/link.d.ts +1 -0
  90. package/dist/runtime/types/notification.d.ts +5 -3
  91. package/dist/runtime/types/tabs.d.ts +1 -0
  92. package/dist/runtime/types/utils.d.ts +11 -0
  93. package/dist/runtime/ui.config.d.ts +1207 -0
  94. package/dist/runtime/{app.config.mjs → ui.config.mjs} +52 -80
  95. package/dist/runtime/utils/index.d.ts +5 -11
  96. package/dist/runtime/utils/index.mjs +21 -9
  97. package/dist/runtime/utils/lodash.d.ts +2 -0
  98. package/dist/runtime/utils/lodash.mjs +23 -0
  99. package/dist/runtime/utils/uid.d.ts +1 -0
  100. package/dist/runtime/utils/uid.mjs +4 -0
  101. package/dist/types.d.mts +1 -1
  102. package/dist/types.d.ts +1 -1
  103. package/package.json +19 -21
  104. package/dist/runtime/app.config.d.ts +0 -1203
@@ -1,6 +1,5 @@
1
- /// <reference types="lodash" />
2
1
  import type { PropType, Ref } from 'vue';
3
- import type { PopperOptions } from '../../types/popper';
2
+ import type { PopperOptions } from '../../types';
4
3
  declare const _default: import("vue").DefineComponent<{
5
4
  modelValue: {
6
5
  type: BooleanConstructor;
@@ -14,15 +13,19 @@ declare const _default: import("vue").DefineComponent<{
14
13
  type: PropType<PopperOptions>;
15
14
  default: () => {};
16
15
  };
17
- ui: {
16
+ class: {
18
17
  type: PropType<any>;
19
- default: () => {};
18
+ default: undefined;
19
+ };
20
+ ui: {
21
+ type: PropType<Partial<any>>;
22
+ default: undefined;
20
23
  };
21
24
  }, {
22
- attrs: import("lodash").Omit<{
23
- [x: string]: unknown;
24
- }, "class">;
25
25
  ui: import("vue").ComputedRef<any>;
26
+ attrs: import("vue").ComputedRef<Pick<{
27
+ [x: string]: unknown;
28
+ }, string>>;
26
29
  isOpen: import("vue").WritableComputedRef<boolean>;
27
30
  wrapperClass: import("vue").ComputedRef<string>;
28
31
  container: Ref<import("@vueuse/core").MaybeElement>;
@@ -39,16 +42,21 @@ declare const _default: import("vue").DefineComponent<{
39
42
  type: PropType<PopperOptions>;
40
43
  default: () => {};
41
44
  };
42
- ui: {
45
+ class: {
43
46
  type: PropType<any>;
44
- default: () => {};
47
+ default: undefined;
48
+ };
49
+ ui: {
50
+ type: PropType<Partial<any>>;
51
+ default: undefined;
45
52
  };
46
53
  }>> & {
47
54
  onClose?: ((...args: any[]) => any) | undefined;
48
55
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
49
56
  }, {
50
- ui: any;
57
+ ui: Partial<any>;
51
58
  popper: PopperOptions;
59
+ class: any;
52
60
  modelValue: boolean;
53
61
  }, {}>;
54
62
  export default _default;
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <TransitionRoot :appear="appear" :show="isOpen" as="template">
3
- <HDialog :class="wrapperClass" v-bind="attrs" @close="(e) => !preventClose && close(e)">
3
+ <HDialog :class="ui.wrapper" v-bind="attrs" @close="(e) => !preventClose && close(e)">
4
4
  <TransitionChild v-if="overlay" as="template" :appear="appear" v-bind="ui.overlay.transition">
5
5
  <div :class="[ui.overlay.base, ui.overlay.background]" />
6
6
  </TransitionChild>
@@ -30,12 +30,13 @@
30
30
  </template>
31
31
 
32
32
  <script>
33
- import { computed, defineComponent } from "vue";
34
- import { omit } from "lodash-es";
35
- import { twMerge } from "tailwind-merge";
33
+ import { computed, toRef, defineComponent } from "vue";
36
34
  import { Dialog as HDialog, DialogPanel as HDialogPanel, TransitionRoot, TransitionChild } from "@headlessui/vue";
37
- import { defuTwMerge } from "../../utils";
38
- import { useAppConfig } from "#imports";
35
+ import { useUI } from "../../composables/useUI";
36
+ import { mergeConfig } from "../../utils";
37
+ import appConfig from "#build/app.config";
38
+ import { modal } from "#ui/ui.config";
39
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.modal, modal);
39
40
  export default defineComponent({
40
41
  components: {
41
42
  HDialog,
@@ -69,15 +70,18 @@ export default defineComponent({
69
70
  type: Boolean,
70
71
  default: false
71
72
  },
73
+ class: {
74
+ type: [String, Object, Array],
75
+ default: void 0
76
+ },
72
77
  ui: {
73
78
  type: Object,
74
- default: () => ({})
79
+ default: void 0
75
80
  }
76
81
  },
77
82
  emits: ["update:modelValue", "close"],
78
- setup(props, { attrs, emit }) {
79
- const appConfig2 = useAppConfig();
80
- const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.modal));
83
+ setup(props, { emit }) {
84
+ const { ui, attrs } = useUI("modal", toRef(props, "ui"), config, toRef(props, "class"));
81
85
  const isOpen = computed({
82
86
  get() {
83
87
  return props.modelValue;
@@ -86,7 +90,6 @@ export default defineComponent({
86
90
  emit("update:modelValue", value);
87
91
  }
88
92
  });
89
- const wrapperClass = computed(() => twMerge(ui.value.wrapper, attrs.class));
90
93
  const transitionClass = computed(() => {
91
94
  if (!props.transition) {
92
95
  return {};
@@ -100,11 +103,10 @@ export default defineComponent({
100
103
  emit("close");
101
104
  }
102
105
  return {
103
- attrs: omit(attrs, ["class"]),
104
106
  // eslint-disable-next-line vue/no-dupe-keys
105
107
  ui,
108
+ attrs,
106
109
  isOpen,
107
- wrapperClass,
108
110
  transitionClass,
109
111
  close
110
112
  };
@@ -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
  modelValue: {
@@ -25,17 +24,20 @@ declare const _default: import("vue").DefineComponent<{
25
24
  type: BooleanConstructor;
26
25
  default: boolean;
27
26
  };
28
- ui: {
27
+ class: {
29
28
  type: PropType<any>;
30
- default: () => {};
29
+ default: undefined;
30
+ };
31
+ ui: {
32
+ type: PropType<Partial<any>>;
33
+ default: undefined;
31
34
  };
32
35
  }, {
33
- attrs: import("lodash").Omit<{
34
- [x: string]: unknown;
35
- }, "class">;
36
36
  ui: import("vue").ComputedRef<any>;
37
+ attrs: import("vue").ComputedRef<Pick<{
38
+ [x: string]: unknown;
39
+ }, string>>;
37
40
  isOpen: import("vue").WritableComputedRef<boolean>;
38
- wrapperClass: import("vue").ComputedRef<string>;
39
41
  transitionClass: import("vue").ComputedRef<any>;
40
42
  close: (value: boolean) => void;
41
43
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "update:modelValue")[], "close" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -63,15 +65,20 @@ declare const _default: import("vue").DefineComponent<{
63
65
  type: BooleanConstructor;
64
66
  default: boolean;
65
67
  };
66
- ui: {
68
+ class: {
67
69
  type: PropType<any>;
68
- default: () => {};
70
+ default: undefined;
71
+ };
72
+ ui: {
73
+ type: PropType<Partial<any>>;
74
+ default: undefined;
69
75
  };
70
76
  }>> & {
71
77
  onClose?: ((...args: any[]) => any) | undefined;
72
78
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
73
79
  }, {
74
- ui: any;
80
+ ui: Partial<any>;
81
+ class: any;
75
82
  modelValue: boolean;
76
83
  appear: boolean;
77
84
  overlay: boolean;
@@ -28,7 +28,7 @@
28
28
  <UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...ui.default.actionButton, ...action }" @click.stop="onAction(action)" />
29
29
  </div>
30
30
 
31
- <UButton v-if="closeButton" v-bind="{ ...ui.default.closeButton, ...closeButton }" @click.stop="onClose" />
31
+ <UButton v-if="closeButton" aria-label="Close" v-bind="{ ...ui.default.closeButton, ...closeButton }" @click.stop="onClose" />
32
32
  </div>
33
33
  </div>
34
34
  </div>
@@ -39,16 +39,17 @@
39
39
  </template>
40
40
 
41
41
  <script>
42
- import { ref, computed, onMounted, onUnmounted, watchEffect, defineComponent } from "vue";
43
- import { omit } from "lodash-es";
42
+ import { ref, computed, toRef, onMounted, onUnmounted, watchEffect, defineComponent } from "vue";
44
43
  import { twMerge, twJoin } from "tailwind-merge";
45
44
  import UIcon from "../elements/Icon.vue";
46
45
  import UAvatar from "../elements/Avatar.vue";
47
46
  import UButton from "../elements/Button.vue";
47
+ import { useUI } from "../../composables/useUI";
48
48
  import { useTimer } from "../../composables/useTimer";
49
- import { defuTwMerge } from "../../utils";
50
- import { useAppConfig } from "#imports";
49
+ import { mergeConfig } from "../../utils";
51
50
  import appConfig from "#build/app.config";
51
+ import { notification } from "#ui/ui.config";
52
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.notification, notification);
52
53
  export default defineComponent({
53
54
  components: {
54
55
  UIcon,
@@ -71,7 +72,7 @@ export default defineComponent({
71
72
  },
72
73
  icon: {
73
74
  type: String,
74
- default: () => appConfig.ui.notification.default.icon
75
+ default: () => config.default.icon
75
76
  },
76
77
  avatar: {
77
78
  type: Object,
@@ -79,7 +80,7 @@ export default defineComponent({
79
80
  },
80
81
  closeButton: {
81
82
  type: Object,
82
- default: () => appConfig.ui.notification.default.closeButton
83
+ default: () => config.default.closeButton
83
84
  },
84
85
  timeout: {
85
86
  type: Number,
@@ -95,20 +96,23 @@ export default defineComponent({
95
96
  },
96
97
  color: {
97
98
  type: String,
98
- default: () => appConfig.ui.notification.default.color,
99
+ default: () => config.default.color,
99
100
  validator(value) {
100
101
  return ["gray", ...appConfig.ui.colors].includes(value);
101
102
  }
102
103
  },
104
+ class: {
105
+ type: [String, Object, Array],
106
+ default: void 0
107
+ },
103
108
  ui: {
104
109
  type: Object,
105
- default: () => ({})
110
+ default: void 0
106
111
  }
107
112
  },
108
113
  emits: ["close"],
109
- setup(props, { attrs, emit }) {
110
- const appConfig2 = useAppConfig();
111
- const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.notification));
114
+ setup(props, { emit }) {
115
+ const { ui, attrs } = useUI("notification", toRef(props, "ui"), config);
112
116
  let timer = null;
113
117
  const remaining = ref(props.timeout);
114
118
  const wrapperClass = computed(() => {
@@ -117,7 +121,7 @@ export default defineComponent({
117
121
  ui.value.background,
118
122
  ui.value.rounded,
119
123
  ui.value.shadow
120
- ), attrs.class);
124
+ ), props.class);
121
125
  });
122
126
  const progressClass = computed(() => {
123
127
  return twJoin(
@@ -180,9 +184,9 @@ export default defineComponent({
180
184
  }
181
185
  });
182
186
  return {
183
- attrs: omit(attrs, ["class"]),
184
187
  // eslint-disable-next-line vue/no-dupe-keys
185
188
  ui,
189
+ attrs,
186
190
  wrapperClass,
187
191
  progressClass,
188
192
  progressStyle,
@@ -1,11 +1,8 @@
1
- /// <reference types="lodash" />
2
1
  import type { PropType } from 'vue';
3
- import type { NotificationAction } from '../../types/notification';
4
- import type { Avatar } from '../../types/avatar';
5
- import type { Button } from '../../types/button';
2
+ import type { Avatar, Button, NotificationAction } from '../../types';
6
3
  declare const _default: import("vue").DefineComponent<{
7
4
  id: {
8
- type: (StringConstructor | NumberConstructor)[];
5
+ type: (NumberConstructor | StringConstructor)[];
9
6
  required: true;
10
7
  };
11
8
  title: {
@@ -26,7 +23,7 @@ declare const _default: import("vue").DefineComponent<{
26
23
  };
27
24
  closeButton: {
28
25
  type: PropType<Button>;
29
- default: () => any;
26
+ default: () => Button;
30
27
  };
31
28
  timeout: {
32
29
  type: NumberConstructor;
@@ -41,19 +38,23 @@ declare const _default: import("vue").DefineComponent<{
41
38
  default: null;
42
39
  };
43
40
  color: {
44
- type: StringConstructor;
41
+ type: PropType<any>;
45
42
  default: () => any;
46
43
  validator(value: string): boolean;
47
44
  };
48
- ui: {
45
+ class: {
49
46
  type: PropType<any>;
50
- default: () => {};
47
+ default: undefined;
48
+ };
49
+ ui: {
50
+ type: PropType<Partial<any>>;
51
+ default: undefined;
51
52
  };
52
53
  }, {
53
- attrs: import("lodash").Omit<{
54
- [x: string]: unknown;
55
- }, "class">;
56
54
  ui: import("vue").ComputedRef<any>;
55
+ attrs: import("vue").ComputedRef<Pick<{
56
+ [x: string]: unknown;
57
+ }, string>>;
57
58
  wrapperClass: import("vue").ComputedRef<string>;
58
59
  progressClass: import("vue").ComputedRef<string>;
59
60
  progressStyle: import("vue").ComputedRef<{
@@ -66,7 +67,7 @@ declare const _default: import("vue").DefineComponent<{
66
67
  onAction: (action: NotificationAction) => void;
67
68
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "close"[], "close", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
68
69
  id: {
69
- type: (StringConstructor | NumberConstructor)[];
70
+ type: (NumberConstructor | StringConstructor)[];
70
71
  required: true;
71
72
  };
72
73
  title: {
@@ -87,7 +88,7 @@ declare const _default: import("vue").DefineComponent<{
87
88
  };
88
89
  closeButton: {
89
90
  type: PropType<Button>;
90
- default: () => any;
91
+ default: () => Button;
91
92
  };
92
93
  timeout: {
93
94
  type: NumberConstructor;
@@ -102,13 +103,17 @@ declare const _default: import("vue").DefineComponent<{
102
103
  default: null;
103
104
  };
104
105
  color: {
105
- type: StringConstructor;
106
+ type: PropType<any>;
106
107
  default: () => any;
107
108
  validator(value: string): boolean;
108
109
  };
109
- ui: {
110
+ class: {
110
111
  type: PropType<any>;
111
- default: () => {};
112
+ default: undefined;
113
+ };
114
+ ui: {
115
+ type: PropType<Partial<any>>;
116
+ default: undefined;
112
117
  };
113
118
  }>> & {
114
119
  onClose?: ((...args: any[]) => any) | undefined;
@@ -120,7 +125,8 @@ declare const _default: import("vue").DefineComponent<{
120
125
  timeout: number;
121
126
  actions: NotificationAction[];
122
127
  callback: Function;
123
- color: string;
124
- ui: any;
128
+ color: any;
129
+ ui: Partial<any>;
130
+ class: any;
125
131
  }, {}>;
126
132
  export default _default;
@@ -18,42 +18,48 @@
18
18
  </template>
19
19
 
20
20
  <script>
21
- import { computed, defineComponent } from "vue";
22
- import { omit } from "lodash-es";
21
+ import { computed, toRef, defineComponent } from "vue";
23
22
  import { twMerge, twJoin } from "tailwind-merge";
24
23
  import UNotification from "./Notification.vue";
24
+ import { useUI } from "../../composables/useUI";
25
25
  import { useToast } from "../../composables/useToast";
26
- import { defuTwMerge } from "../../utils";
27
- import { useState, useAppConfig } from "#imports";
26
+ import { mergeConfig } from "../../utils";
27
+ import { useState } from "#imports";
28
+ import appConfig from "#build/app.config";
29
+ import { notifications } from "#ui/ui.config";
30
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.notifications, notifications);
28
31
  export default defineComponent({
29
32
  components: {
30
33
  UNotification
31
34
  },
32
35
  inheritAttrs: false,
33
36
  props: {
37
+ class: {
38
+ type: [String, Object, Array],
39
+ default: void 0
40
+ },
34
41
  ui: {
35
42
  type: Object,
36
- default: () => ({})
43
+ default: void 0
37
44
  }
38
45
  },
39
- setup(props, { attrs }) {
40
- const appConfig2 = useAppConfig();
41
- const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.notifications));
46
+ setup(props) {
47
+ const { ui, attrs } = useUI("notifications", toRef(props, "ui"), config);
42
48
  const toast = useToast();
43
- const notifications = useState("notifications", () => []);
49
+ const notifications2 = useState("notifications", () => []);
44
50
  const wrapperClass = computed(() => {
45
51
  return twMerge(twJoin(
46
52
  ui.value.wrapper,
47
53
  ui.value.position,
48
54
  ui.value.width
49
- ), attrs.class);
55
+ ), props.class);
50
56
  });
51
57
  return {
52
- attrs: omit(attrs, ["class"]),
53
58
  // eslint-disable-next-line vue/no-dupe-keys
54
59
  ui,
60
+ attrs,
55
61
  toast,
56
- notifications,
62
+ notifications: notifications2,
57
63
  wrapperClass
58
64
  };
59
65
  }
@@ -1,29 +1,32 @@
1
- /// <reference types="lodash" />
2
1
  import type { PropType } from 'vue';
3
- import type { Notification } from '../../types/notification';
2
+ import type { Notification } from '../../types';
4
3
  declare const _default: import("vue").DefineComponent<{
5
- ui: {
4
+ class: {
6
5
  type: PropType<any>;
7
- default: () => {};
6
+ default: undefined;
7
+ };
8
+ ui: {
9
+ type: PropType<Partial<any>>;
10
+ default: undefined;
8
11
  };
9
12
  }, {
10
- attrs: import("lodash").Omit<{
11
- [x: string]: unknown;
12
- }, "class">;
13
13
  ui: import("vue").ComputedRef<any>;
14
+ attrs: import("vue").ComputedRef<Pick<{
15
+ [x: string]: unknown;
16
+ }, string>>;
14
17
  toast: {
15
18
  add: (notification: Partial<Notification>) => {
16
19
  id: string;
17
20
  title?: string | undefined;
18
21
  description?: string | undefined;
19
22
  icon?: string | undefined;
20
- avatar?: import("../../types/avatar").Avatar | undefined;
21
- closeButton?: import("../../types/button").Button | undefined;
23
+ avatar?: import("../../types").Avatar | undefined;
24
+ closeButton?: import("../../types").Button | undefined;
22
25
  timeout?: number | undefined;
23
- actions?: import("../../types/notification").NotificationAction[] | undefined;
26
+ actions?: import("../../types").NotificationAction[] | undefined;
24
27
  click?: Function | undefined;
25
28
  callback?: Function | undefined;
26
- color?: string | undefined;
29
+ color?: any;
27
30
  ui?: any;
28
31
  };
29
32
  remove: (id: string) => void;
@@ -31,11 +34,16 @@ declare const _default: import("vue").DefineComponent<{
31
34
  notifications: any;
32
35
  wrapperClass: import("vue").ComputedRef<string>;
33
36
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
34
- ui: {
37
+ class: {
35
38
  type: PropType<any>;
36
- default: () => {};
39
+ default: undefined;
40
+ };
41
+ ui: {
42
+ type: PropType<Partial<any>>;
43
+ default: undefined;
37
44
  };
38
45
  }>>, {
39
- ui: any;
46
+ ui: Partial<any>;
47
+ class: any;
40
48
  }, {}>;
41
49
  export default _default;
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <HPopover ref="popover" v-slot="{ open, close }" :class="wrapperClass" v-bind="attrs" @mouseleave="onMouseLeave">
2
+ <HPopover ref="popover" v-slot="{ open, close }" :class="ui.wrapper" v-bind="attrs" @mouseleave="onMouseLeave">
3
3
  <HPopoverButton
4
4
  ref="trigger"
5
5
  as="div"
@@ -26,14 +26,15 @@
26
26
  </template>
27
27
 
28
28
  <script>
29
- import { computed, ref, onMounted, defineComponent } from "vue";
29
+ import { computed, ref, toRef, onMounted, defineComponent } from "vue";
30
30
  import { defu } from "defu";
31
- import { omit } from "lodash-es";
32
- import { twMerge } from "tailwind-merge";
33
31
  import { Popover as HPopover, PopoverButton as HPopoverButton, PopoverPanel as HPopoverPanel } from "@headlessui/vue";
32
+ import { useUI } from "../../composables/useUI";
34
33
  import { usePopper } from "../../composables/usePopper";
35
- import { defuTwMerge } from "../../utils";
36
- import { useAppConfig } from "#imports";
34
+ import { mergeConfig } from "../../utils";
35
+ import appConfig from "#build/app.config";
36
+ import { popover } from "#ui/ui.config";
37
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.popover, popover);
37
38
  export default defineComponent({
38
39
  components: {
39
40
  HPopover,
@@ -63,22 +64,25 @@ export default defineComponent({
63
64
  type: Object,
64
65
  default: () => ({})
65
66
  },
67
+ class: {
68
+ type: [String, Object, Array],
69
+ default: void 0
70
+ },
66
71
  ui: {
67
72
  type: Object,
68
- default: () => ({})
73
+ default: void 0
69
74
  }
70
75
  },
71
- setup(props, { attrs }) {
72
- const appConfig2 = useAppConfig();
73
- const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.popover));
76
+ setup(props) {
77
+ const { ui, attrs } = useUI("popover", toRef(props, "ui"), config, toRef(props, "class"));
74
78
  const popper = computed(() => defu(props.mode === "hover" ? { offsetDistance: 0 } : {}, props.popper, ui.value.popper));
75
79
  const [trigger, container] = usePopper(popper.value);
76
- const popover = ref(null);
80
+ const popover2 = ref(null);
77
81
  const popoverApi = ref(null);
78
82
  let openTimeout = null;
79
83
  let closeTimeout = null;
80
84
  onMounted(() => {
81
- const popoverProvides = popover.value?.$.provides;
85
+ const popoverProvides = popover2.value?.$.provides;
82
86
  if (!popoverProvides) {
83
87
  return;
84
88
  }
@@ -89,7 +93,6 @@ export default defineComponent({
89
93
  const offsetDistance = props.popper?.offsetDistance || ui.value.popper?.offsetDistance || 8;
90
94
  return props.mode === "hover" ? { paddingTop: `${offsetDistance}px`, paddingBottom: `${offsetDistance}px` } : {};
91
95
  });
92
- const wrapperClass = computed(() => twMerge(ui.value.wrapper, attrs.class));
93
96
  function onMouseOver() {
94
97
  if (props.mode !== "hover" || !popoverApi.value) {
95
98
  return;
@@ -123,14 +126,13 @@ export default defineComponent({
123
126
  }, props.closeDelay);
124
127
  }
125
128
  return {
126
- attrs: omit(attrs, ["class"]),
127
129
  // eslint-disable-next-line vue/no-dupe-keys
128
130
  ui,
129
- popover,
131
+ attrs,
132
+ popover: popover2,
130
133
  trigger,
131
134
  container,
132
135
  containerStyle,
133
- wrapperClass,
134
136
  onMouseOver,
135
137
  onMouseLeave
136
138
  };
@@ -1,6 +1,5 @@
1
- /// <reference types="lodash" />
2
1
  import type { PropType } from 'vue';
3
- import type { PopperOptions } from '../../types/popper';
2
+ import type { PopperOptions } from '../../types';
4
3
  declare const _default: import("vue").DefineComponent<{
5
4
  mode: {
6
5
  type: PropType<"click" | "hover">;
@@ -23,15 +22,19 @@ declare const _default: import("vue").DefineComponent<{
23
22
  type: PropType<PopperOptions>;
24
23
  default: () => {};
25
24
  };
26
- ui: {
25
+ class: {
27
26
  type: PropType<any>;
28
- default: () => {};
27
+ default: undefined;
28
+ };
29
+ ui: {
30
+ type: PropType<Partial<any>>;
31
+ default: undefined;
29
32
  };
30
33
  }, {
31
- attrs: import("lodash").Omit<{
32
- [x: string]: unknown;
33
- }, "class">;
34
34
  ui: import("vue").ComputedRef<any>;
35
+ attrs: import("vue").ComputedRef<Pick<{
36
+ [x: string]: unknown;
37
+ }, string>>;
35
38
  popover: any;
36
39
  trigger: import("vue").Ref<import("@vueuse/core").MaybeElement>;
37
40
  container: import("vue").Ref<import("@vueuse/core").MaybeElement>;
@@ -42,7 +45,6 @@ declare const _default: import("vue").DefineComponent<{
42
45
  paddingTop?: undefined;
43
46
  paddingBottom?: undefined;
44
47
  }>;
45
- wrapperClass: import("vue").ComputedRef<string>;
46
48
  onMouseOver: () => void;
47
49
  onMouseLeave: () => void;
48
50
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -67,13 +69,18 @@ declare const _default: import("vue").DefineComponent<{
67
69
  type: PropType<PopperOptions>;
68
70
  default: () => {};
69
71
  };
70
- ui: {
72
+ class: {
71
73
  type: PropType<any>;
72
- default: () => {};
74
+ default: undefined;
75
+ };
76
+ ui: {
77
+ type: PropType<Partial<any>>;
78
+ default: undefined;
73
79
  };
74
80
  }>>, {
75
- ui: any;
81
+ ui: Partial<any>;
76
82
  popper: PopperOptions;
83
+ class: any;
77
84
  disabled: boolean;
78
85
  mode: "click" | "hover";
79
86
  openDelay: number;