@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
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div :class="wrapperClass" v-bind="attrs">
2
+ <div :class="ui.wrapper" v-bind="attrs">
3
3
  <slot name="prev" :on-click="onClickPrev">
4
4
  <UButton
5
5
  v-if="prevButton"
@@ -8,6 +8,7 @@
8
8
  :class="[ui.base, ui.rounded]"
9
9
  v-bind="{ ...ui.default.prevButton, ...prevButton }"
10
10
  :ui="{ rounded: '' }"
11
+ aria-label="Prev"
11
12
  @click="onClickPrev"
12
13
  />
13
14
  </slot>
@@ -31,6 +32,7 @@
31
32
  :class="[ui.base, ui.rounded]"
32
33
  v-bind="{ ...ui.default.nextButton, ...nextButton }"
33
34
  :ui="{ rounded: '' }"
35
+ aria-label="Next"
34
36
  @click="onClickNext"
35
37
  />
36
38
  </slot>
@@ -38,13 +40,14 @@
38
40
  </template>
39
41
 
40
42
  <script>
41
- import { computed, defineComponent } from "vue";
42
- import { omit } from "lodash-es";
43
- import { twMerge } from "tailwind-merge";
43
+ import { computed, toRef, defineComponent } from "vue";
44
44
  import UButton from "../elements/Button.vue";
45
- import { defuTwMerge } from "../../utils";
46
- import { useAppConfig } from "#imports";
45
+ import { useUI } from "../../composables/useUI";
46
+ import { mergeConfig } from "../../utils";
47
47
  import appConfig from "#build/app.config";
48
+ import { pagination, button } from "#ui/ui.config";
49
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.pagination, pagination);
50
+ const buttonConfig = mergeConfig(appConfig.ui.strategy, appConfig.ui.button, button);
48
51
  export default defineComponent({
49
52
  components: {
50
53
  UButton
@@ -67,45 +70,48 @@ export default defineComponent({
67
70
  type: Number,
68
71
  default: 7,
69
72
  validate(value) {
70
- return value >= 7 && value < Number.MAX_VALUE;
73
+ return value >= 5 && value < Number.MAX_VALUE;
71
74
  }
72
75
  },
73
76
  size: {
74
77
  type: String,
75
- default: () => appConfig.ui.pagination.default.size,
78
+ default: () => config.default.size,
76
79
  validator(value) {
77
- return Object.keys(appConfig.ui.button.size).includes(value);
80
+ return Object.keys(buttonConfig.size).includes(value);
78
81
  }
79
82
  },
80
83
  activeButton: {
81
84
  type: Object,
82
- default: () => appConfig.ui.pagination.default.activeButton
85
+ default: () => config.default.activeButton
83
86
  },
84
87
  inactiveButton: {
85
88
  type: Object,
86
- default: () => appConfig.ui.pagination.default.inactiveButton
89
+ default: () => config.default.inactiveButton
87
90
  },
88
91
  prevButton: {
89
92
  type: Object,
90
- default: () => appConfig.ui.pagination.default.prevButton
93
+ default: () => config.default.prevButton
91
94
  },
92
95
  nextButton: {
93
96
  type: Object,
94
- default: () => appConfig.ui.pagination.default.nextButton
97
+ default: () => config.default.nextButton
95
98
  },
96
99
  divider: {
97
100
  type: String,
98
101
  default: "\u2026"
99
102
  },
103
+ class: {
104
+ type: [String, Object, Array],
105
+ default: void 0
106
+ },
100
107
  ui: {
101
108
  type: Object,
102
- default: () => ({})
109
+ default: void 0
103
110
  }
104
111
  },
105
112
  emits: ["update:modelValue"],
106
- setup(props, { attrs, emit }) {
107
- const appConfig2 = useAppConfig();
108
- const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.pagination));
113
+ setup(props, { emit }) {
114
+ const { ui, attrs } = useUI("pagination", toRef(props, "ui"), config, toRef(props, "class"));
109
115
  const currentPage = computed({
110
116
  get() {
111
117
  return props.modelValue;
@@ -116,50 +122,54 @@ export default defineComponent({
116
122
  });
117
123
  const pages = computed(() => Array.from({ length: Math.ceil(props.total / props.pageCount) }, (_, i) => i + 1));
118
124
  const displayedPages = computed(() => {
119
- if (!props.max || pages.value.length <= 5) {
120
- return pages.value;
121
- } else {
122
- const current = currentPage.value;
123
- const max = pages.value.length;
124
- const r = Math.floor((Math.min(props.max, max) - 5) / 2);
125
- const r1 = current - r;
126
- const r2 = current + r;
127
- const beforeWrapped = r1 - 1 > 1;
128
- const afterWrapped = r2 + 1 < max;
129
- const items = [1];
130
- if (beforeWrapped)
131
- items.push(props.divider);
132
- if (!afterWrapped) {
133
- const addedItems = current + r + 2 - max;
134
- for (let i = current - r - addedItems; i <= current - r - 1; i++) {
135
- items.push(i);
136
- }
137
- }
138
- for (let i = r1 > 2 ? r1 : 2; i <= Math.min(max, r2); i++) {
125
+ const totalPages = pages.value.length;
126
+ const current = currentPage.value;
127
+ const maxDisplayedPages = Math.max(props.max, 5);
128
+ const r = Math.floor((Math.min(maxDisplayedPages, totalPages) - 5) / 2);
129
+ const r1 = current - r;
130
+ const r2 = current + r;
131
+ const beforeWrapped = r1 - 1 > 1;
132
+ const afterWrapped = r2 + 1 < totalPages;
133
+ const items = [];
134
+ if (totalPages <= maxDisplayedPages) {
135
+ for (let i = 1; i <= totalPages; i++) {
139
136
  items.push(i);
140
137
  }
141
- if (!beforeWrapped) {
142
- const addedItems = 1 - (current - r - 2);
143
- for (let i = current + r + 1; i <= current + r + addedItems; i++) {
144
- items.push(i);
145
- }
146
- }
147
- if (afterWrapped)
148
- items.push(props.divider);
149
- if (r2 < max)
150
- items.push(max);
151
- if (items.length >= 3 && items[1] === props.divider && items[2] === 3) {
152
- items[1] = 2;
138
+ return items;
139
+ }
140
+ items.push(1);
141
+ if (beforeWrapped)
142
+ items.push(props.divider);
143
+ if (!afterWrapped) {
144
+ const addedItems = current + r + 2 - totalPages;
145
+ for (let i = current - r - addedItems; i <= current - r - 1; i++) {
146
+ items.push(i);
153
147
  }
154
- if (items.length >= 3 && items[items.length - 2] === props.divider && items[items.length - 1] === items.length) {
155
- items[items.length - 2] = items.length - 1;
148
+ }
149
+ for (let i = Math.max(2, r1); i <= Math.min(totalPages, r2); i++) {
150
+ items.push(i);
151
+ }
152
+ if (!beforeWrapped) {
153
+ const addedItems = 1 - (current - r - 2);
154
+ for (let i = current + r + 1; i <= current + r + addedItems; i++) {
155
+ items.push(i);
156
156
  }
157
- return items;
158
157
  }
158
+ if (afterWrapped)
159
+ items.push(props.divider);
160
+ if (r2 < totalPages) {
161
+ items.push(totalPages);
162
+ }
163
+ if (items.length >= 3 && items[1] === props.divider && items[2] === 3) {
164
+ items[1] = 2;
165
+ }
166
+ if (items.length >= 3 && items[items.length - 2] === props.divider && items[items.length - 1] === items.length) {
167
+ items[items.length - 2] = items.length - 1;
168
+ }
169
+ return items;
159
170
  });
160
171
  const canGoPrev = computed(() => currentPage.value > 1);
161
172
  const canGoNext = computed(() => currentPage.value < pages.value.length);
162
- const wrapperClass = computed(() => twMerge(ui.value.wrapper, attrs.class));
163
173
  function onClickPage(page) {
164
174
  if (typeof page === "string") {
165
175
  return;
@@ -179,15 +189,14 @@ export default defineComponent({
179
189
  currentPage.value++;
180
190
  }
181
191
  return {
182
- attrs: omit(attrs, ["class"]),
183
192
  // eslint-disable-next-line vue/no-dupe-keys
184
193
  ui,
194
+ attrs,
185
195
  currentPage,
186
196
  pages,
187
197
  displayedPages,
188
198
  canGoPrev,
189
199
  canGoNext,
190
- wrapperClass,
191
200
  onClickPrev,
192
201
  onClickNext,
193
202
  onClickPage
@@ -1,6 +1,5 @@
1
- /// <reference types="lodash" />
2
1
  import type { PropType } from 'vue';
3
- import type { Button } from '../../types/button';
2
+ import type { Button } from '../../types';
4
3
  declare const _default: import("vue").DefineComponent<{
5
4
  modelValue: {
6
5
  type: NumberConstructor;
@@ -20,45 +19,48 @@ declare const _default: import("vue").DefineComponent<{
20
19
  validate(value: any): boolean;
21
20
  };
22
21
  size: {
23
- type: StringConstructor;
22
+ type: PropType<string | number | symbol>;
24
23
  default: () => any;
25
24
  validator(value: string): boolean;
26
25
  };
27
26
  activeButton: {
28
27
  type: PropType<Button>;
29
- default: () => any;
28
+ default: () => Button;
30
29
  };
31
30
  inactiveButton: {
32
31
  type: PropType<Button>;
33
- default: () => any;
32
+ default: () => Button;
34
33
  };
35
34
  prevButton: {
36
35
  type: PropType<Button>;
37
- default: () => any;
36
+ default: () => Button;
38
37
  };
39
38
  nextButton: {
40
39
  type: PropType<Button>;
41
- default: () => any;
40
+ default: () => Button;
42
41
  };
43
42
  divider: {
44
43
  type: StringConstructor;
45
44
  default: string;
46
45
  };
47
- ui: {
46
+ class: {
48
47
  type: PropType<any>;
49
- default: () => {};
48
+ default: undefined;
49
+ };
50
+ ui: {
51
+ type: PropType<Partial<any>>;
52
+ default: undefined;
50
53
  };
51
54
  }, {
52
- attrs: import("lodash").Omit<{
53
- [x: string]: unknown;
54
- }, "class">;
55
55
  ui: import("vue").ComputedRef<any>;
56
+ attrs: import("vue").ComputedRef<Pick<{
57
+ [x: string]: unknown;
58
+ }, string>>;
56
59
  currentPage: import("vue").WritableComputedRef<number>;
57
60
  pages: import("vue").ComputedRef<number[]>;
58
61
  displayedPages: import("vue").ComputedRef<(string | number)[]>;
59
62
  canGoPrev: import("vue").ComputedRef<boolean>;
60
63
  canGoNext: import("vue").ComputedRef<boolean>;
61
- wrapperClass: import("vue").ComputedRef<string>;
62
64
  onClickPrev: () => void;
63
65
  onClickNext: () => void;
64
66
  onClickPage: (page: number | string) => void;
@@ -81,39 +83,44 @@ declare const _default: import("vue").DefineComponent<{
81
83
  validate(value: any): boolean;
82
84
  };
83
85
  size: {
84
- type: StringConstructor;
86
+ type: PropType<string | number | symbol>;
85
87
  default: () => any;
86
88
  validator(value: string): boolean;
87
89
  };
88
90
  activeButton: {
89
91
  type: PropType<Button>;
90
- default: () => any;
92
+ default: () => Button;
91
93
  };
92
94
  inactiveButton: {
93
95
  type: PropType<Button>;
94
- default: () => any;
96
+ default: () => Button;
95
97
  };
96
98
  prevButton: {
97
99
  type: PropType<Button>;
98
- default: () => any;
100
+ default: () => Button;
99
101
  };
100
102
  nextButton: {
101
103
  type: PropType<Button>;
102
- default: () => any;
104
+ default: () => Button;
103
105
  };
104
106
  divider: {
105
107
  type: StringConstructor;
106
108
  default: string;
107
109
  };
108
- ui: {
110
+ class: {
109
111
  type: PropType<any>;
110
- default: () => {};
112
+ default: undefined;
113
+ };
114
+ ui: {
115
+ type: PropType<Partial<any>>;
116
+ default: undefined;
111
117
  };
112
118
  }>> & {
113
119
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
114
120
  }, {
115
- ui: any;
116
- size: string;
121
+ ui: Partial<any>;
122
+ class: any;
123
+ size: string | number | symbol;
117
124
  max: number;
118
125
  pageCount: number;
119
126
  activeButton: Button;
@@ -3,7 +3,7 @@
3
3
  :vertical="orientation === 'vertical'"
4
4
  :selected-index="selectedIndex"
5
5
  as="div"
6
- :class="wrapperClass"
6
+ :class="ui.wrapper"
7
7
  v-bind="attrs"
8
8
  @change="onChange"
9
9
  >
@@ -38,6 +38,7 @@
38
38
  :key="index"
39
39
  v-slot="{ selected }"
40
40
  :class="ui.base"
41
+ tabindex="-1"
41
42
  >
42
43
  <slot :name="item.slot || 'item'" :item="item" :index="index" :selected="selected">
43
44
  {{ item.content }}
@@ -48,13 +49,14 @@
48
49
  </template>
49
50
 
50
51
  <script>
51
- import { ref, computed, watch, onMounted, defineComponent } from "vue";
52
+ import { toRef, ref, watch, onMounted, defineComponent } from "vue";
52
53
  import { TabGroup as HTabGroup, TabList as HTabList, Tab as HTab, TabPanels as HTabPanels, TabPanel as HTabPanel } from "@headlessui/vue";
53
54
  import { useResizeObserver } from "@vueuse/core";
54
- import { omit } from "lodash-es";
55
- import { twMerge } from "tailwind-merge";
56
- import { defuTwMerge } from "../../utils";
57
- import { useAppConfig } from "#imports";
55
+ import { useUI } from "../../composables/useUI";
56
+ import { mergeConfig } from "../../utils";
57
+ import appConfig from "#build/app.config";
58
+ import { tabs } from "#ui/ui.config";
59
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.tabs, tabs);
58
60
  export default defineComponent({
59
61
  components: {
60
62
  HTabGroup,
@@ -82,20 +84,22 @@ export default defineComponent({
82
84
  type: Array,
83
85
  default: () => []
84
86
  },
87
+ class: {
88
+ type: [String, Object, Array],
89
+ default: void 0
90
+ },
85
91
  ui: {
86
92
  type: Object,
87
- default: () => ({})
93
+ default: void 0
88
94
  }
89
95
  },
90
96
  emits: ["update:modelValue", "change"],
91
- setup(props, { attrs, emit }) {
92
- const appConfig2 = useAppConfig();
93
- const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.tabs));
97
+ setup(props, { emit }) {
98
+ const { ui, attrs } = useUI("tabs", toRef(props, "ui"), config, toRef(props, "class"));
94
99
  const listRef = ref();
95
100
  const itemRefs = ref([]);
96
101
  const markerRef = ref();
97
102
  const selectedIndex = ref(props.modelValue || props.defaultIndex);
98
- const wrapperClass = computed(() => twMerge(ui.value.wrapper, attrs.class));
99
103
  function calcMarkerSize(index) {
100
104
  const tab = itemRefs.value[index]?.$el;
101
105
  if (!tab) {
@@ -123,14 +127,13 @@ export default defineComponent({
123
127
  });
124
128
  onMounted(() => calcMarkerSize(selectedIndex.value));
125
129
  return {
126
- attrs: omit(attrs, ["class"]),
127
130
  // eslint-disable-next-line vue/no-dupe-keys
128
131
  ui,
132
+ attrs,
129
133
  listRef,
130
134
  itemRefs,
131
135
  markerRef,
132
136
  selectedIndex,
133
- wrapperClass,
134
137
  onChange
135
138
  };
136
139
  }
@@ -1,6 +1,5 @@
1
- /// <reference types="lodash" />
2
1
  import type { PropType } from 'vue';
3
- import type { TabItem } from '../../types/tabs';
2
+ import type { TabItem } from '../../types';
4
3
  declare const _default: import("vue").DefineComponent<{
5
4
  modelValue: {
6
5
  type: NumberConstructor;
@@ -19,20 +18,23 @@ declare const _default: import("vue").DefineComponent<{
19
18
  type: PropType<TabItem[]>;
20
19
  default: () => never[];
21
20
  };
22
- ui: {
21
+ class: {
23
22
  type: PropType<any>;
24
- default: () => {};
23
+ default: undefined;
24
+ };
25
+ ui: {
26
+ type: PropType<Partial<any>>;
27
+ default: undefined;
25
28
  };
26
29
  }, {
27
- attrs: import("lodash").Omit<{
28
- [x: string]: unknown;
29
- }, "class">;
30
30
  ui: import("vue").ComputedRef<any>;
31
+ attrs: import("vue").ComputedRef<Pick<{
32
+ [x: string]: unknown;
33
+ }, string>>;
31
34
  listRef: import("vue").Ref<HTMLElement | undefined>;
32
35
  itemRefs: import("vue").Ref<HTMLElement[]>;
33
36
  markerRef: import("vue").Ref<HTMLElement | undefined>;
34
37
  selectedIndex: import("vue").Ref<number>;
35
- wrapperClass: import("vue").ComputedRef<string>;
36
38
  onChange: (index: any) => void;
37
39
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:modelValue")[], "change" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
38
40
  modelValue: {
@@ -52,15 +54,20 @@ declare const _default: import("vue").DefineComponent<{
52
54
  type: PropType<TabItem[]>;
53
55
  default: () => never[];
54
56
  };
55
- ui: {
57
+ class: {
56
58
  type: PropType<any>;
57
- default: () => {};
59
+ default: undefined;
60
+ };
61
+ ui: {
62
+ type: PropType<Partial<any>>;
63
+ default: undefined;
58
64
  };
59
65
  }>> & {
60
66
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
61
67
  onChange?: ((...args: any[]) => any) | undefined;
62
68
  }, {
63
- ui: any;
69
+ ui: Partial<any>;
70
+ class: any;
64
71
  modelValue: number;
65
72
  items: TabItem[];
66
73
  orientation: "horizontal" | "vertical";
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <nav :class="wrapperClass" v-bind="attrs">
2
+ <nav :class="ui.wrapper" v-bind="attrs">
3
3
  <ULink
4
4
  v-for="(link, index) of links"
5
5
  v-slot="{ isActive }"
@@ -38,14 +38,15 @@
38
38
  </template>
39
39
 
40
40
  <script>
41
- import { computed, defineComponent } from "vue";
42
- import { omit } from "lodash-es";
43
- import { twMerge } from "tailwind-merge";
41
+ import { toRef, defineComponent } from "vue";
44
42
  import UIcon from "../elements/Icon.vue";
45
43
  import UAvatar from "../elements/Avatar.vue";
46
44
  import ULink from "../elements/Link.vue";
47
- import { defuTwMerge } from "../../utils";
48
- import { useAppConfig } from "#imports";
45
+ import { useUI } from "../../composables/useUI";
46
+ import { mergeConfig, omit } from "../../utils";
47
+ import appConfig from "#build/app.config";
48
+ import { verticalNavigation } from "#ui/ui.config";
49
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.verticalNavigation, verticalNavigation);
49
50
  export default defineComponent({
50
51
  components: {
51
52
  UIcon,
@@ -58,20 +59,21 @@ export default defineComponent({
58
59
  type: Array,
59
60
  default: () => []
60
61
  },
62
+ class: {
63
+ type: [String, Object, Array],
64
+ default: void 0
65
+ },
61
66
  ui: {
62
67
  type: Object,
63
- default: () => ({})
68
+ default: void 0
64
69
  }
65
70
  },
66
- setup(props, { attrs }) {
67
- const appConfig2 = useAppConfig();
68
- const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.verticalNavigation));
69
- const wrapperClass = computed(() => twMerge(ui.value.wrapper, attrs.class));
71
+ setup(props) {
72
+ const { ui, attrs } = useUI("verticalNavigation", toRef(props, "ui"), config, toRef(props, "class"));
70
73
  return {
71
- attrs: omit(attrs, ["class"]),
72
74
  // eslint-disable-next-line vue/no-dupe-keys
73
75
  ui,
74
- wrapperClass,
76
+ attrs,
75
77
  omit
76
78
  };
77
79
  }
@@ -1,37 +1,41 @@
1
- /// <reference types="lodash" />
2
1
  import type { PropType } from 'vue';
3
- import type { VerticalNavigationLink } from '../../types/vertical-navigation';
2
+ import { omit } from '../../utils';
3
+ import type { VerticalNavigationLink } from '../../types';
4
4
  declare const _default: import("vue").DefineComponent<{
5
5
  links: {
6
6
  type: PropType<VerticalNavigationLink[]>;
7
7
  default: () => never[];
8
8
  };
9
- ui: {
9
+ class: {
10
10
  type: PropType<any>;
11
- default: () => {};
11
+ default: undefined;
12
+ };
13
+ ui: {
14
+ type: PropType<Partial<any>>;
15
+ default: undefined;
12
16
  };
13
17
  }, {
14
- attrs: import("lodash").Omit<{
15
- [x: string]: unknown;
16
- }, "class">;
17
18
  ui: import("vue").ComputedRef<any>;
18
- wrapperClass: import("vue").ComputedRef<string>;
19
- omit: {
20
- <T extends object, K extends import("lodash").PropertyName[]>(object: T | null | undefined, ...paths: K): Pick<T, Exclude<keyof T, K[number]>>;
21
- <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>;
22
- <T_2 extends object>(object: T_2 | null | undefined, ...paths: import("lodash").Many<import("lodash").PropertyName>[]): Partial<T_2>;
23
- };
19
+ attrs: import("vue").ComputedRef<Pick<{
20
+ [x: string]: unknown;
21
+ }, string>>;
22
+ omit: typeof omit;
24
23
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
25
24
  links: {
26
25
  type: PropType<VerticalNavigationLink[]>;
27
26
  default: () => never[];
28
27
  };
29
- ui: {
28
+ class: {
30
29
  type: PropType<any>;
31
- default: () => {};
30
+ default: undefined;
31
+ };
32
+ ui: {
33
+ type: PropType<Partial<any>>;
34
+ default: undefined;
32
35
  };
33
36
  }>>, {
34
- ui: any;
37
+ ui: Partial<any>;
38
+ class: any;
35
39
  links: VerticalNavigationLink[];
36
40
  }, {}>;
37
41
  export default _default;
@@ -12,11 +12,13 @@
12
12
  import { computed, toRef, defineComponent } from "vue";
13
13
  import { defu } from "defu";
14
14
  import { onClickOutside } from "@vueuse/core";
15
- import { omit } from "lodash-es";
16
15
  import { twMerge, twJoin } from "tailwind-merge";
16
+ import { useUI } from "../../composables/useUI";
17
17
  import { usePopper } from "../../composables/usePopper";
18
- import { defuTwMerge } from "../../utils";
19
- import { useAppConfig } from "#imports";
18
+ import { mergeConfig } from "../../utils";
19
+ import appConfig from "#build/app.config";
20
+ import { contextMenu } from "#ui/ui.config";
21
+ const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.contextMenu, contextMenu);
20
22
  export default defineComponent({
21
23
  inheritAttrs: false,
22
24
  props: {
@@ -32,15 +34,18 @@ export default defineComponent({
32
34
  type: Object,
33
35
  default: () => ({})
34
36
  },
37
+ class: {
38
+ type: [String, Object, Array],
39
+ default: void 0
40
+ },
35
41
  ui: {
36
42
  type: Object,
37
- default: () => ({})
43
+ default: void 0
38
44
  }
39
45
  },
40
46
  emits: ["update:modelValue", "close"],
41
- setup(props, { attrs, emit }) {
42
- const appConfig2 = useAppConfig();
43
- const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.contextMenu));
47
+ setup(props, { emit }) {
48
+ const { ui, attrs } = useUI("contextMenu", toRef(props, "ui"), config);
44
49
  const popper = computed(() => defu({}, props.popper, ui.value.popper));
45
50
  const isOpen = computed({
46
51
  get() {
@@ -56,15 +61,15 @@ export default defineComponent({
56
61
  return twMerge(twJoin(
57
62
  ui.value.container,
58
63
  ui.value.width
59
- ), attrs.class);
64
+ ), props.class);
60
65
  });
61
66
  onClickOutside(container, () => {
62
67
  isOpen.value = false;
63
68
  });
64
69
  return {
65
- attrs: omit(attrs, ["class"]),
66
70
  // eslint-disable-next-line vue/no-dupe-keys
67
71
  ui,
72
+ attrs,
68
73
  isOpen,
69
74
  wrapperClass,
70
75
  container