@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.
- package/README.md +1 -0
- package/dist/module.d.mts +1147 -1096
- package/dist/module.d.ts +1147 -1096
- package/dist/module.json +1 -1
- package/dist/module.mjs +35 -10
- package/dist/runtime/components/data/Table.vue +42 -29
- package/dist/runtime/components/data/Table.vue.d.ts +20 -13
- package/dist/runtime/components/elements/Accordion.vue +25 -22
- package/dist/runtime/components/elements/Accordion.vue.d.ts +21 -17
- package/dist/runtime/components/elements/Alert.vue +22 -18
- package/dist/runtime/components/elements/Alert.vue.d.ts +26 -19
- package/dist/runtime/components/elements/Avatar.vue +22 -16
- package/dist/runtime/components/elements/Avatar.vue.d.ts +28 -19
- package/dist/runtime/components/elements/AvatarGroup.d.ts +17 -8
- package/dist/runtime/components/elements/AvatarGroup.mjs +18 -13
- package/dist/runtime/components/elements/Badge.vue +21 -17
- package/dist/runtime/components/elements/Badge.vue.d.ts +28 -19
- package/dist/runtime/components/elements/Button.vue +22 -18
- package/dist/runtime/components/elements/Button.vue.d.ts +26 -17
- package/dist/runtime/components/elements/ButtonGroup.d.ts +17 -8
- package/dist/runtime/components/elements/ButtonGroup.mjs +22 -15
- package/dist/runtime/components/elements/Dropdown.vue +15 -13
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +20 -17
- package/dist/runtime/components/elements/Kbd.vue +16 -12
- package/dist/runtime/components/elements/Kbd.vue.d.ts +20 -12
- package/dist/runtime/components/elements/Link.vue +18 -5
- package/dist/runtime/components/forms/Checkbox.vue +27 -17
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +33 -15
- package/dist/runtime/components/forms/Form.vue +4 -5
- package/dist/runtime/components/forms/Form.vue.d.ts +1 -1
- package/dist/runtime/components/forms/FormGroup.vue +51 -27
- package/dist/runtime/components/forms/FormGroup.vue.d.ts +23 -15
- package/dist/runtime/components/forms/Input.vue +36 -28
- package/dist/runtime/components/forms/Input.vue.d.ts +41 -23
- package/dist/runtime/components/forms/Radio.vue +27 -17
- package/dist/runtime/components/forms/Radio.vue.d.ts +35 -17
- package/dist/runtime/components/forms/Range.vue +26 -16
- package/dist/runtime/components/forms/Range.vue.d.ts +36 -17
- package/dist/runtime/components/forms/Select.vue +34 -26
- package/dist/runtime/components/forms/Select.vue.d.ts +42 -24
- package/dist/runtime/components/forms/SelectMenu.vue +43 -33
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +49 -30
- package/dist/runtime/components/forms/Textarea.vue +38 -30
- package/dist/runtime/components/forms/Textarea.vue.d.ts +41 -23
- package/dist/runtime/components/forms/Toggle.vue +26 -15
- package/dist/runtime/components/forms/Toggle.vue.d.ts +31 -12
- package/dist/runtime/components/layout/Card.vue +15 -10
- package/dist/runtime/components/layout/Card.vue.d.ts +17 -9
- package/dist/runtime/components/layout/Container.vue +15 -10
- package/dist/runtime/components/layout/Container.vue.d.ts +17 -9
- package/dist/runtime/components/layout/Skeleton.vue +15 -10
- package/dist/runtime/components/layout/Skeleton.vue.d.ts +17 -9
- package/dist/runtime/components/navigation/CommandPalette.vue +50 -38
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +23 -22
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue +1 -1
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +3 -4
- package/dist/runtime/components/navigation/Pagination.vue +65 -56
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +29 -22
- package/dist/runtime/components/navigation/Tabs.vue +16 -13
- package/dist/runtime/components/navigation/Tabs.vue.d.ts +18 -11
- package/dist/runtime/components/navigation/VerticalNavigation.vue +15 -13
- package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +20 -16
- package/dist/runtime/components/overlays/ContextMenu.vue +14 -9
- package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +18 -10
- package/dist/runtime/components/overlays/Modal.vue +15 -13
- package/dist/runtime/components/overlays/Modal.vue.d.ts +17 -10
- package/dist/runtime/components/overlays/Notification.vue +18 -14
- package/dist/runtime/components/overlays/Notification.vue.d.ts +25 -19
- package/dist/runtime/components/overlays/Notifications.vue +18 -12
- package/dist/runtime/components/overlays/Notifications.vue.d.ts +22 -14
- package/dist/runtime/components/overlays/Popover.vue +18 -16
- package/dist/runtime/components/overlays/Popover.vue.d.ts +18 -11
- package/dist/runtime/components/overlays/Slideover.vue +15 -13
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +17 -10
- package/dist/runtime/components/overlays/Tooltip.vue +15 -13
- package/dist/runtime/components/overlays/Tooltip.vue.d.ts +18 -11
- package/dist/runtime/composables/useFormGroup.d.ts +12 -2
- package/dist/runtime/composables/useFormGroup.mjs +10 -4
- package/dist/runtime/composables/usePopper.mjs +40 -30
- package/dist/runtime/composables/useToast.d.ts +3 -3
- package/dist/runtime/composables/useUI.d.ts +10 -0
- package/dist/runtime/composables/useUI.mjs +24 -0
- package/dist/runtime/types/avatar.d.ts +10 -4
- package/dist/runtime/types/badge.d.ts +14 -0
- package/dist/runtime/types/button.d.ts +10 -3
- package/dist/runtime/types/command-palette.d.ts +2 -1
- package/dist/runtime/types/form.d.ts +8 -1
- package/dist/runtime/types/index.d.ts +2 -0
- package/dist/runtime/types/link.d.ts +1 -0
- package/dist/runtime/types/notification.d.ts +5 -3
- package/dist/runtime/types/tabs.d.ts +1 -0
- package/dist/runtime/types/utils.d.ts +11 -0
- package/dist/runtime/ui.config.d.ts +1207 -0
- package/dist/runtime/{app.config.mjs → ui.config.mjs} +52 -80
- package/dist/runtime/utils/index.d.ts +5 -11
- package/dist/runtime/utils/index.mjs +21 -9
- package/dist/runtime/utils/lodash.d.ts +2 -0
- package/dist/runtime/utils/lodash.mjs +23 -0
- package/dist/runtime/utils/uid.d.ts +1 -0
- package/dist/runtime/utils/uid.mjs +4 -0
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +19 -21
- package/dist/runtime/app.config.d.ts +0 -1203
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<TransitionRoot as="template" :appear="appear" :show="isOpen">
|
|
3
|
-
<HDialog :class="[
|
|
3
|
+
<HDialog :class="[ui.wrapper, { 'justify-end': side === 'right' }]" 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>
|
|
@@ -15,12 +15,13 @@
|
|
|
15
15
|
</template>
|
|
16
16
|
|
|
17
17
|
<script>
|
|
18
|
-
import { computed, defineComponent } from "vue";
|
|
18
|
+
import { computed, toRef, defineComponent } from "vue";
|
|
19
19
|
import { Dialog as HDialog, DialogPanel as HDialogPanel, TransitionRoot, TransitionChild } from "@headlessui/vue";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
23
|
-
import {
|
|
20
|
+
import { useUI } from "../../composables/useUI";
|
|
21
|
+
import { mergeConfig } from "../../utils";
|
|
22
|
+
import appConfig from "#build/app.config";
|
|
23
|
+
import { slideover } from "#ui/ui.config";
|
|
24
|
+
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.slideover, slideover);
|
|
24
25
|
export default defineComponent({
|
|
25
26
|
components: {
|
|
26
27
|
HDialog,
|
|
@@ -55,15 +56,18 @@ export default defineComponent({
|
|
|
55
56
|
type: Boolean,
|
|
56
57
|
default: false
|
|
57
58
|
},
|
|
59
|
+
class: {
|
|
60
|
+
type: [String, Object, Array],
|
|
61
|
+
default: void 0
|
|
62
|
+
},
|
|
58
63
|
ui: {
|
|
59
64
|
type: Object,
|
|
60
|
-
default:
|
|
65
|
+
default: void 0
|
|
61
66
|
}
|
|
62
67
|
},
|
|
63
68
|
emits: ["update:modelValue", "close"],
|
|
64
|
-
setup(props, {
|
|
65
|
-
const
|
|
66
|
-
const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.slideover));
|
|
69
|
+
setup(props, { emit }) {
|
|
70
|
+
const { ui, attrs } = useUI("slideover", toRef(props, "ui"), config, toRef(props, "class"));
|
|
67
71
|
const isOpen = computed({
|
|
68
72
|
get() {
|
|
69
73
|
return props.modelValue;
|
|
@@ -72,7 +76,6 @@ export default defineComponent({
|
|
|
72
76
|
emit("update:modelValue", value);
|
|
73
77
|
}
|
|
74
78
|
});
|
|
75
|
-
const wrapperClass = computed(() => twMerge(ui.value.wrapper, attrs.class));
|
|
76
79
|
const transitionClass = computed(() => {
|
|
77
80
|
if (!props.transition) {
|
|
78
81
|
return {};
|
|
@@ -90,11 +93,10 @@ export default defineComponent({
|
|
|
90
93
|
emit("close");
|
|
91
94
|
}
|
|
92
95
|
return {
|
|
93
|
-
attrs: omit(attrs, ["class"]),
|
|
94
96
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
95
97
|
ui,
|
|
98
|
+
attrs,
|
|
96
99
|
isOpen,
|
|
97
|
-
wrapperClass,
|
|
98
100
|
transitionClass,
|
|
99
101
|
close
|
|
100
102
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="lodash" />
|
|
2
1
|
import type { WritableComputedRef, PropType } from 'vue';
|
|
3
2
|
declare const _default: import("vue").DefineComponent<{
|
|
4
3
|
modelValue: {
|
|
@@ -26,17 +25,20 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
26
25
|
type: BooleanConstructor;
|
|
27
26
|
default: boolean;
|
|
28
27
|
};
|
|
29
|
-
|
|
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
|
-
attrs: import("lodash").Omit<{
|
|
35
|
-
[x: string]: unknown;
|
|
36
|
-
}, "class">;
|
|
37
37
|
ui: import("vue").ComputedRef<any>;
|
|
38
|
+
attrs: import("vue").ComputedRef<Pick<{
|
|
39
|
+
[x: string]: unknown;
|
|
40
|
+
}, string>>;
|
|
38
41
|
isOpen: WritableComputedRef<boolean>;
|
|
39
|
-
wrapperClass: import("vue").ComputedRef<string>;
|
|
40
42
|
transitionClass: import("vue").ComputedRef<any>;
|
|
41
43
|
close: (value: boolean) => void;
|
|
42
44
|
}, 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<{
|
|
@@ -65,15 +67,20 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
65
67
|
type: BooleanConstructor;
|
|
66
68
|
default: boolean;
|
|
67
69
|
};
|
|
68
|
-
|
|
70
|
+
class: {
|
|
69
71
|
type: PropType<any>;
|
|
70
|
-
default:
|
|
72
|
+
default: undefined;
|
|
73
|
+
};
|
|
74
|
+
ui: {
|
|
75
|
+
type: PropType<Partial<any>>;
|
|
76
|
+
default: undefined;
|
|
71
77
|
};
|
|
72
78
|
}>> & {
|
|
73
79
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
74
80
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
75
81
|
}, {
|
|
76
|
-
ui: any
|
|
82
|
+
ui: Partial<any>;
|
|
83
|
+
class: any;
|
|
77
84
|
modelValue: boolean;
|
|
78
85
|
appear: boolean;
|
|
79
86
|
overlay: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div ref="trigger" :class="
|
|
2
|
+
<div ref="trigger" :class="ui.wrapper" v-bind="attrs" @mouseover="onMouseOver" @mouseleave="onMouseLeave">
|
|
3
3
|
<slot :open="open">
|
|
4
4
|
Hover
|
|
5
5
|
</slot>
|
|
@@ -24,14 +24,15 @@
|
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
26
|
<script>
|
|
27
|
-
import { computed, ref, defineComponent } from "vue";
|
|
27
|
+
import { computed, ref, toRef, defineComponent } from "vue";
|
|
28
28
|
import { defu } from "defu";
|
|
29
|
-
import { omit } from "lodash-es";
|
|
30
|
-
import { twMerge } from "tailwind-merge";
|
|
31
29
|
import UKbd from "../elements/Kbd.vue";
|
|
30
|
+
import { useUI } from "../../composables/useUI";
|
|
32
31
|
import { usePopper } from "../../composables/usePopper";
|
|
33
|
-
import {
|
|
34
|
-
import
|
|
32
|
+
import { mergeConfig } from "../../utils";
|
|
33
|
+
import appConfig from "#build/app.config";
|
|
34
|
+
import { tooltip } from "#ui/ui.config";
|
|
35
|
+
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.tooltip, tooltip);
|
|
35
36
|
export default defineComponent({
|
|
36
37
|
components: {
|
|
37
38
|
UKbd
|
|
@@ -62,20 +63,22 @@ export default defineComponent({
|
|
|
62
63
|
type: Object,
|
|
63
64
|
default: () => ({})
|
|
64
65
|
},
|
|
66
|
+
class: {
|
|
67
|
+
type: [String, Object, Array],
|
|
68
|
+
default: void 0
|
|
69
|
+
},
|
|
65
70
|
ui: {
|
|
66
71
|
type: Object,
|
|
67
|
-
default:
|
|
72
|
+
default: void 0
|
|
68
73
|
}
|
|
69
74
|
},
|
|
70
|
-
setup(props
|
|
71
|
-
const
|
|
72
|
-
const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.tooltip));
|
|
75
|
+
setup(props) {
|
|
76
|
+
const { ui, attrs } = useUI("tooltip", toRef(props, "ui"), config, toRef(props, "class"));
|
|
73
77
|
const popper = computed(() => defu({}, props.popper, ui.value.popper));
|
|
74
78
|
const [trigger, container] = usePopper(popper.value);
|
|
75
79
|
const open = ref(false);
|
|
76
80
|
let openTimeout = null;
|
|
77
81
|
let closeTimeout = null;
|
|
78
|
-
const wrapperClass = computed(() => twMerge(ui.value.wrapper, attrs.class));
|
|
79
82
|
function onMouseOver() {
|
|
80
83
|
if (closeTimeout) {
|
|
81
84
|
clearTimeout(closeTimeout);
|
|
@@ -103,13 +106,12 @@ export default defineComponent({
|
|
|
103
106
|
}, props.closeDelay);
|
|
104
107
|
}
|
|
105
108
|
return {
|
|
106
|
-
attrs: omit(attrs, ["class"]),
|
|
107
109
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
108
110
|
ui,
|
|
111
|
+
attrs,
|
|
109
112
|
trigger,
|
|
110
113
|
container,
|
|
111
114
|
open,
|
|
112
|
-
wrapperClass,
|
|
113
115
|
onMouseOver,
|
|
114
116
|
onMouseLeave
|
|
115
117
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="lodash" />
|
|
2
1
|
import type { PropType } from 'vue';
|
|
3
|
-
import type { PopperOptions } from '../../types
|
|
2
|
+
import type { PopperOptions } from '../../types';
|
|
4
3
|
declare const _default: import("vue").DefineComponent<{
|
|
5
4
|
text: {
|
|
6
5
|
type: StringConstructor;
|
|
@@ -26,19 +25,22 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
26
25
|
type: PropType<PopperOptions>;
|
|
27
26
|
default: () => {};
|
|
28
27
|
};
|
|
29
|
-
|
|
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
|
-
attrs: import("lodash").Omit<{
|
|
35
|
-
[x: string]: unknown;
|
|
36
|
-
}, "class">;
|
|
37
37
|
ui: import("vue").ComputedRef<any>;
|
|
38
|
+
attrs: import("vue").ComputedRef<Pick<{
|
|
39
|
+
[x: string]: unknown;
|
|
40
|
+
}, string>>;
|
|
38
41
|
trigger: import("vue").Ref<import("@vueuse/core").MaybeElement>;
|
|
39
42
|
container: import("vue").Ref<import("@vueuse/core").MaybeElement>;
|
|
40
43
|
open: import("vue").Ref<boolean>;
|
|
41
|
-
wrapperClass: import("vue").ComputedRef<string>;
|
|
42
44
|
onMouseOver: () => void;
|
|
43
45
|
onMouseLeave: () => void;
|
|
44
46
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -66,13 +68,18 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
66
68
|
type: PropType<PopperOptions>;
|
|
67
69
|
default: () => {};
|
|
68
70
|
};
|
|
69
|
-
|
|
71
|
+
class: {
|
|
70
72
|
type: PropType<any>;
|
|
71
|
-
default:
|
|
73
|
+
default: undefined;
|
|
74
|
+
};
|
|
75
|
+
ui: {
|
|
76
|
+
type: PropType<Partial<any>>;
|
|
77
|
+
default: undefined;
|
|
72
78
|
};
|
|
73
79
|
}>>, {
|
|
74
|
-
ui: any
|
|
80
|
+
ui: Partial<any>;
|
|
75
81
|
popper: PopperOptions;
|
|
82
|
+
class: any;
|
|
76
83
|
text: string;
|
|
77
84
|
openDelay: number;
|
|
78
85
|
closeDelay: number;
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
type InputProps = {
|
|
2
|
+
id?: string;
|
|
3
|
+
size?: string;
|
|
4
|
+
color?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const useFormGroup: (inputProps?: InputProps, config?: any) => {
|
|
8
|
+
inputId: import("vue").ComputedRef<any>;
|
|
9
|
+
name: import("vue").ComputedRef<any>;
|
|
10
|
+
size: import("vue").ComputedRef<any>;
|
|
11
|
+
color: import("vue").ComputedRef<string | undefined>;
|
|
2
12
|
emitFormBlur: () => void;
|
|
3
13
|
emitFormInput: import("@vueuse/shared").PromisifyFn<() => void>;
|
|
4
14
|
emitFormChange: () => void;
|
|
5
|
-
formGroup: undefined;
|
|
6
15
|
};
|
|
16
|
+
export {};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { inject, ref } from "vue";
|
|
1
|
+
import { inject, ref, computed } from "vue";
|
|
2
2
|
import { useDebounceFn } from "@vueuse/core";
|
|
3
|
-
export const useFormGroup = () => {
|
|
3
|
+
export const useFormGroup = (inputProps, config) => {
|
|
4
4
|
const formBus = inject("form-events", void 0);
|
|
5
5
|
const formGroup = inject("form-group", void 0);
|
|
6
|
+
if (formGroup) {
|
|
7
|
+
formGroup.inputId.value = inputProps?.id ?? formGroup?.inputId.value;
|
|
8
|
+
}
|
|
6
9
|
const blurred = ref(false);
|
|
7
10
|
function emitFormEvent(type, path) {
|
|
8
11
|
if (formBus) {
|
|
@@ -22,9 +25,12 @@ export const useFormGroup = () => {
|
|
|
22
25
|
}
|
|
23
26
|
}, 300);
|
|
24
27
|
return {
|
|
28
|
+
inputId: computed(() => inputProps.id ?? formGroup?.inputId.value),
|
|
29
|
+
name: computed(() => inputProps?.name ?? formGroup?.name.value),
|
|
30
|
+
size: computed(() => inputProps?.size ?? formGroup?.size.value ?? config?.default?.size),
|
|
31
|
+
color: computed(() => formGroup?.error?.value ? "red" : inputProps?.color),
|
|
25
32
|
emitFormBlur,
|
|
26
33
|
emitFormInput,
|
|
27
|
-
emitFormChange
|
|
28
|
-
formGroup
|
|
34
|
+
emitFormChange
|
|
29
35
|
};
|
|
30
36
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ref, onMounted, watchEffect } from "vue";
|
|
2
2
|
import { popperGenerator, defaultModifiers } from "@popperjs/core/lib/popper-lite";
|
|
3
|
-
import { omitBy, isUndefined } from "lodash-es";
|
|
4
3
|
import flip from "@popperjs/core/lib/modifiers/flip";
|
|
5
4
|
import offset from "@popperjs/core/lib/modifiers/offset";
|
|
6
5
|
import preventOverflow from "@popperjs/core/lib/modifiers/preventOverflow";
|
|
@@ -41,36 +40,47 @@ export function usePopper({
|
|
|
41
40
|
if (!referenceEl) {
|
|
42
41
|
return;
|
|
43
42
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
const config = {
|
|
44
|
+
modifiers: [
|
|
45
|
+
{
|
|
46
|
+
name: "flip",
|
|
47
|
+
enabled: !locked
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "preventOverflow",
|
|
51
|
+
options: {
|
|
52
|
+
padding: overflowPadding
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "offset",
|
|
57
|
+
options: {
|
|
58
|
+
offset: [offsetSkid, offsetDistance]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: "computeStyles",
|
|
63
|
+
options: {
|
|
64
|
+
adaptive,
|
|
65
|
+
gpuAcceleration
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "eventListeners",
|
|
70
|
+
options: {
|
|
71
|
+
scroll,
|
|
72
|
+
resize
|
|
73
|
+
}
|
|
54
74
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
gpuAcceleration
|
|
65
|
-
}
|
|
66
|
-
}, {
|
|
67
|
-
name: "eventListeners",
|
|
68
|
-
options: {
|
|
69
|
-
scroll,
|
|
70
|
-
resize
|
|
71
|
-
}
|
|
72
|
-
}]
|
|
73
|
-
}, isUndefined));
|
|
75
|
+
]
|
|
76
|
+
};
|
|
77
|
+
if (placement) {
|
|
78
|
+
config.placement = placement;
|
|
79
|
+
}
|
|
80
|
+
if (strategy) {
|
|
81
|
+
config.strategy = strategy;
|
|
82
|
+
}
|
|
83
|
+
instance.value = createPopper(referenceEl, popperEl, config);
|
|
74
84
|
onInvalidate(instance.value.destroy);
|
|
75
85
|
});
|
|
76
86
|
});
|
|
@@ -5,13 +5,13 @@ export declare function useToast(): {
|
|
|
5
5
|
title?: string | undefined;
|
|
6
6
|
description?: string | undefined;
|
|
7
7
|
icon?: string | undefined;
|
|
8
|
-
avatar?: import("../types
|
|
9
|
-
closeButton?: import("../types
|
|
8
|
+
avatar?: import("../types").Avatar | undefined;
|
|
9
|
+
closeButton?: import("../types").Button | undefined;
|
|
10
10
|
timeout?: number | undefined;
|
|
11
11
|
actions?: import("../types/notification").NotificationAction[] | undefined;
|
|
12
12
|
click?: Function | undefined;
|
|
13
13
|
callback?: Function | undefined;
|
|
14
|
-
color?:
|
|
14
|
+
color?: any;
|
|
15
15
|
ui?: any;
|
|
16
16
|
};
|
|
17
17
|
remove: (id: string) => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import { Strategy } from '../types';
|
|
3
|
+
export declare const useUI: <T>(key: any, $ui: Ref<Partial<T & {
|
|
4
|
+
strategy: Strategy;
|
|
5
|
+
}> | undefined>, $config?: T | Ref<T> | undefined, $wrapperClass?: Ref<string>) => {
|
|
6
|
+
ui: import("vue").ComputedRef<T>;
|
|
7
|
+
attrs: import("vue").ComputedRef<Pick<{
|
|
8
|
+
[x: string]: unknown;
|
|
9
|
+
}, string>>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { computed, toValue, useAttrs } from "vue";
|
|
2
|
+
import { useAppConfig } from "#imports";
|
|
3
|
+
import { mergeConfig, omit, get } from "../utils/index.mjs";
|
|
4
|
+
export const useUI = (key, $ui, $config, $wrapperClass) => {
|
|
5
|
+
const $attrs = useAttrs();
|
|
6
|
+
const appConfig = useAppConfig();
|
|
7
|
+
const ui = computed(() => {
|
|
8
|
+
const _ui = toValue($ui);
|
|
9
|
+
const _config = toValue($config);
|
|
10
|
+
const _wrapperClass = toValue($wrapperClass);
|
|
11
|
+
return mergeConfig(
|
|
12
|
+
_ui?.strategy || appConfig.ui?.strategy,
|
|
13
|
+
_wrapperClass ? { wrapper: _wrapperClass } : {},
|
|
14
|
+
_ui || {},
|
|
15
|
+
process.dev ? get(appConfig.ui, key, {}) : {},
|
|
16
|
+
_config || {}
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
const attrs = computed(() => omit($attrs, ["class"]));
|
|
20
|
+
return {
|
|
21
|
+
ui,
|
|
22
|
+
attrs
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { avatar } from '../ui.config'
|
|
2
|
+
import colors from '#ui-colors'
|
|
3
|
+
|
|
4
|
+
export type AvatarSize = keyof typeof avatar.size
|
|
5
|
+
export type AvatarChipColor = 'gray' | typeof colors[number]
|
|
6
|
+
export type AvatarChipPosition = keyof typeof avatar.chip.position
|
|
7
|
+
|
|
1
8
|
export interface Avatar {
|
|
2
9
|
src?: string | boolean
|
|
3
10
|
alt?: string
|
|
4
11
|
text?: string
|
|
5
|
-
size?:
|
|
6
|
-
chipColor?:
|
|
7
|
-
|
|
8
|
-
chipPosition?: string
|
|
12
|
+
size?: AvatarSize
|
|
13
|
+
chipColor?: AvatarChipColor
|
|
14
|
+
chipPosition?: AvatarChipPosition
|
|
9
15
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { badge } from '../ui.config'
|
|
2
|
+
import type { NestedKeyOf } from '.'
|
|
3
|
+
import colors from '#ui-colors'
|
|
4
|
+
|
|
5
|
+
export type BadgeSize = keyof typeof badge.size
|
|
6
|
+
export type BadgeColor = keyof typeof badge.color | typeof colors[number]
|
|
7
|
+
export type BadgeVariant = keyof typeof badge.variant | NestedKeyOf<typeof badge.color>
|
|
8
|
+
|
|
9
|
+
export interface Badge {
|
|
10
|
+
label?: string
|
|
11
|
+
size?: BadgeSize
|
|
12
|
+
color?: BadgeColor
|
|
13
|
+
variant?: BadgeVariant
|
|
14
|
+
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import type { Link } from './link'
|
|
2
|
+
import { button } from '../ui.config'
|
|
3
|
+
import type { NestedKeyOf } from '.'
|
|
4
|
+
import colors from '#ui-colors'
|
|
5
|
+
|
|
6
|
+
export type ButtonSize = keyof typeof button.size
|
|
7
|
+
export type ButtonColor = keyof typeof button.color | typeof colors[number]
|
|
8
|
+
export type ButtonVariant = keyof typeof button.variant | NestedKeyOf<typeof button.color>
|
|
2
9
|
|
|
3
10
|
export interface Button extends Link {
|
|
4
11
|
type?: string
|
|
@@ -7,9 +14,9 @@ export interface Button extends Link {
|
|
|
7
14
|
loading?: boolean
|
|
8
15
|
disabled?: boolean
|
|
9
16
|
padded?: boolean
|
|
10
|
-
size?:
|
|
11
|
-
color?:
|
|
12
|
-
variant?:
|
|
17
|
+
size?: ButtonSize
|
|
18
|
+
color?: ButtonColor
|
|
19
|
+
variant?: ButtonVariant
|
|
13
20
|
icon?: string
|
|
14
21
|
loadingIcon?: string
|
|
15
22
|
leadingIcon?: string
|
|
@@ -4,7 +4,7 @@ export interface FormError {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
export interface Form<T> {
|
|
7
|
-
validate(path?: string, opts: { silent?: boolean }
|
|
7
|
+
validate(path?: string, opts: { silent?: boolean }): Promise<T>
|
|
8
8
|
clear(path?: string): void
|
|
9
9
|
errors: Ref<FormError[]>
|
|
10
10
|
setErrors(errs: FormError[], path?: string): void
|
|
@@ -19,3 +19,10 @@ export interface FormEvent {
|
|
|
19
19
|
type: FormEventType
|
|
20
20
|
path: string
|
|
21
21
|
}
|
|
22
|
+
|
|
23
|
+
export interface InjectedFormGroupValue {
|
|
24
|
+
inputId: Ref<string>
|
|
25
|
+
name: Ref<string>
|
|
26
|
+
size: Ref<string>
|
|
27
|
+
error: Ref<string | boolean>
|
|
28
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './accordion'
|
|
2
2
|
export * from './avatar'
|
|
3
|
+
export * from './badge'
|
|
3
4
|
export * from './button'
|
|
4
5
|
export * from './clipboard'
|
|
5
6
|
export * from './command-palette'
|
|
@@ -10,3 +11,4 @@ export * from './notification'
|
|
|
10
11
|
export * from './popper'
|
|
11
12
|
export * from './tabs'
|
|
12
13
|
export * from './vertical-navigation'
|
|
14
|
+
export * from './utils'
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Avatar } from './avatar'
|
|
2
2
|
import type { Button } from './button'
|
|
3
|
-
import
|
|
3
|
+
import colors from '#ui-colors'
|
|
4
|
+
|
|
5
|
+
export type NotificationColor = 'gray' | typeof colors[number]
|
|
4
6
|
|
|
5
7
|
export interface NotificationAction extends Button {
|
|
6
8
|
click?: Function
|
|
@@ -17,6 +19,6 @@ export interface Notification {
|
|
|
17
19
|
actions?: NotificationAction[]
|
|
18
20
|
click?: Function
|
|
19
21
|
callback?: Function
|
|
20
|
-
color?:
|
|
21
|
-
ui?:
|
|
22
|
+
color?: NotificationColor
|
|
23
|
+
ui?: any
|
|
22
24
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type Strategy = 'merge' | 'override';
|
|
2
|
+
|
|
3
|
+
export type NestedKeyOf<ObjectType extends object> = {
|
|
4
|
+
[Key in keyof ObjectType]: ObjectType[Key] extends object
|
|
5
|
+
? NestedKeyOf<ObjectType[Key]>
|
|
6
|
+
: Key;
|
|
7
|
+
}[keyof ObjectType];
|
|
8
|
+
|
|
9
|
+
export type DeepPartial<T> = Partial<{
|
|
10
|
+
[P in keyof T]: DeepPartial<T[P]> | { [key: string]: string };
|
|
11
|
+
}>;
|