@nuxt/ui 2.8.1 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/module.d.mts +1411 -1092
- package/dist/module.d.ts +1411 -1092
- package/dist/module.json +1 -1
- package/dist/module.mjs +55 -11
- package/dist/runtime/components/data/Table.vue +47 -32
- package/dist/runtime/components/data/Table.vue.d.ts +22 -14
- package/dist/runtime/components/elements/Accordion.vue +33 -28
- package/dist/runtime/components/elements/Accordion.vue.d.ts +25 -18
- 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 +28 -19
- 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 +45 -37
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +22 -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/elements/Meter.vue +166 -0
- package/dist/runtime/components/elements/Meter.vue.d.ts +123 -0
- package/dist/runtime/components/elements/MeterGroup.d.ts +78 -0
- package/dist/runtime/components/elements/MeterGroup.mjs +172 -0
- package/dist/runtime/components/elements/Progress.vue +284 -0
- package/dist/runtime/components/elements/Progress.vue.d.ts +2 -0
- 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 +34 -9
- package/dist/runtime/components/forms/Form.vue.d.ts +2 -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 +41 -29
- package/dist/runtime/components/forms/Input.vue.d.ts +51 -24
- package/dist/runtime/components/forms/Radio.vue +32 -21
- package/dist/runtime/components/forms/Radio.vue.d.ts +36 -18
- package/dist/runtime/components/forms/RadioGroup.vue +136 -0
- package/dist/runtime/components/forms/RadioGroup.vue.d.ts +118 -0
- package/dist/runtime/components/forms/Range.vue +26 -16
- package/dist/runtime/components/forms/Range.vue.d.ts +37 -18
- 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 +104 -89
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +53 -33
- package/dist/runtime/components/forms/Textarea.vue +43 -31
- package/dist/runtime/components/forms/Textarea.vue.d.ts +50 -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/Divider.vue +107 -0
- package/dist/runtime/components/layout/Divider.vue.d.ts +82 -0
- 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 +57 -38
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +24 -23
- 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 +129 -64
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +70 -25
- package/dist/runtime/components/navigation/Tabs.vue +17 -14
- 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 +21 -11
- package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +20 -11
- package/dist/runtime/components/overlays/Modal.vue +16 -14
- package/dist/runtime/components/overlays/Modal.vue.d.ts +18 -11
- package/dist/runtime/components/overlays/Notification.vue +25 -15
- package/dist/runtime/components/overlays/Notification.vue.d.ts +25 -19
- package/dist/runtime/components/overlays/Notifications.vue +19 -13
- package/dist/runtime/components/overlays/Notifications.vue.d.ts +22 -14
- package/dist/runtime/components/overlays/Popover.vue +39 -22
- package/dist/runtime/components/overlays/Popover.vue.d.ts +32 -11
- package/dist/runtime/components/overlays/Slideover.vue +15 -13
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +18 -11
- package/dist/runtime/components/overlays/Tooltip.vue +31 -23
- package/dist/runtime/components/overlays/Tooltip.vue.d.ts +19 -11
- package/dist/runtime/composables/useFormGroup.d.ts +12 -2
- package/dist/runtime/composables/useFormGroup.mjs +21 -4
- package/dist/runtime/composables/usePopper.d.ts +3 -3
- package/dist/runtime/composables/usePopper.mjs +47 -31
- 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 +3 -1
- package/dist/runtime/types/form.d.ts +18 -4
- package/dist/runtime/types/index.d.ts +4 -0
- package/dist/runtime/types/link.d.ts +1 -0
- package/dist/runtime/types/meter.d.ts +5 -0
- package/dist/runtime/types/notification.d.ts +5 -3
- package/dist/runtime/types/popper.d.ts +1 -0
- package/dist/runtime/types/progress.d.ts +4 -0
- 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 +1470 -0
- package/dist/runtime/{app.config.mjs → ui.config.mjs} +313 -97
- 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 +27 -29
- package/dist/runtime/app.config.d.ts +0 -1203
- package/dist/runtime/utils/StateEmitter.d.ts +0 -17
- package/dist/runtime/utils/StateEmitter.mjs +0 -21
|
@@ -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
|
-
onClose?: ((...args: any[]) => any) | undefined;
|
|
74
79
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
80
|
+
onClose?: ((...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,22 +1,26 @@
|
|
|
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>
|
|
6
6
|
|
|
7
7
|
<div v-if="open && !prevent" ref="container" :class="[ui.container, ui.width]">
|
|
8
8
|
<Transition appear v-bind="ui.transition">
|
|
9
|
-
<div
|
|
10
|
-
<
|
|
11
|
-
{{ text }}
|
|
12
|
-
</slot>
|
|
9
|
+
<div>
|
|
10
|
+
<div v-if="popper.arrow" data-popper-arrow :class="['invisible before:visible before:block before:rotate-45 before:z-[-1]', Object.values(ui.arrow)]" />
|
|
13
11
|
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
<div :class="[ui.base, ui.background, ui.color, ui.rounded, ui.shadow, ui.ring]">
|
|
13
|
+
<slot name="text">
|
|
14
|
+
{{ text }}
|
|
15
|
+
</slot>
|
|
16
|
+
|
|
17
|
+
<span v-if="shortcuts?.length" :class="ui.shortcuts">
|
|
18
|
+
<span class="mx-1 text-gray-700 dark:text-gray-200">·</span>
|
|
19
|
+
<UKbd v-for="shortcut of shortcuts" :key="shortcut" size="xs">
|
|
20
|
+
{{ shortcut }}
|
|
21
|
+
</Ukbd>
|
|
22
|
+
</span>
|
|
23
|
+
</div>
|
|
20
24
|
</div>
|
|
21
25
|
</Transition>
|
|
22
26
|
</div>
|
|
@@ -24,14 +28,15 @@
|
|
|
24
28
|
</template>
|
|
25
29
|
|
|
26
30
|
<script>
|
|
27
|
-
import { computed, ref, defineComponent } from "vue";
|
|
31
|
+
import { computed, ref, toRef, defineComponent } from "vue";
|
|
28
32
|
import { defu } from "defu";
|
|
29
|
-
import { omit } from "lodash-es";
|
|
30
|
-
import { twMerge } from "tailwind-merge";
|
|
31
33
|
import UKbd from "../elements/Kbd.vue";
|
|
34
|
+
import { useUI } from "../../composables/useUI";
|
|
32
35
|
import { usePopper } from "../../composables/usePopper";
|
|
33
|
-
import {
|
|
34
|
-
import
|
|
36
|
+
import { mergeConfig } from "../../utils";
|
|
37
|
+
import appConfig from "#build/app.config";
|
|
38
|
+
import { tooltip } from "#ui/ui.config";
|
|
39
|
+
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.tooltip, tooltip);
|
|
35
40
|
export default defineComponent({
|
|
36
41
|
components: {
|
|
37
42
|
UKbd
|
|
@@ -62,20 +67,22 @@ export default defineComponent({
|
|
|
62
67
|
type: Object,
|
|
63
68
|
default: () => ({})
|
|
64
69
|
},
|
|
70
|
+
class: {
|
|
71
|
+
type: [String, Object, Array],
|
|
72
|
+
default: void 0
|
|
73
|
+
},
|
|
65
74
|
ui: {
|
|
66
75
|
type: Object,
|
|
67
|
-
default:
|
|
76
|
+
default: void 0
|
|
68
77
|
}
|
|
69
78
|
},
|
|
70
|
-
setup(props
|
|
71
|
-
const
|
|
72
|
-
const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.tooltip));
|
|
79
|
+
setup(props) {
|
|
80
|
+
const { ui, attrs } = useUI("tooltip", toRef(props, "ui"), config, toRef(props, "class"));
|
|
73
81
|
const popper = computed(() => defu({}, props.popper, ui.value.popper));
|
|
74
82
|
const [trigger, container] = usePopper(popper.value);
|
|
75
83
|
const open = ref(false);
|
|
76
84
|
let openTimeout = null;
|
|
77
85
|
let closeTimeout = null;
|
|
78
|
-
const wrapperClass = computed(() => twMerge(ui.value.wrapper, attrs.class));
|
|
79
86
|
function onMouseOver() {
|
|
80
87
|
if (closeTimeout) {
|
|
81
88
|
clearTimeout(closeTimeout);
|
|
@@ -103,13 +110,14 @@ export default defineComponent({
|
|
|
103
110
|
}, props.closeDelay);
|
|
104
111
|
}
|
|
105
112
|
return {
|
|
106
|
-
attrs: omit(attrs, ["class"]),
|
|
107
113
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
108
114
|
ui,
|
|
115
|
+
attrs,
|
|
116
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
117
|
+
popper,
|
|
109
118
|
trigger,
|
|
110
119
|
container,
|
|
111
120
|
open,
|
|
112
|
-
wrapperClass,
|
|
113
121
|
onMouseOver,
|
|
114
122
|
onMouseLeave
|
|
115
123
|
};
|
|
@@ -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,23 @@ 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>>;
|
|
41
|
+
popper: import("vue").ComputedRef<PopperOptions>;
|
|
38
42
|
trigger: import("vue").Ref<import("@vueuse/core").MaybeElement>;
|
|
39
43
|
container: import("vue").Ref<import("@vueuse/core").MaybeElement>;
|
|
40
44
|
open: import("vue").Ref<boolean>;
|
|
41
|
-
wrapperClass: import("vue").ComputedRef<string>;
|
|
42
45
|
onMouseOver: () => void;
|
|
43
46
|
onMouseLeave: () => void;
|
|
44
47
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -66,13 +69,18 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
66
69
|
type: PropType<PopperOptions>;
|
|
67
70
|
default: () => {};
|
|
68
71
|
};
|
|
69
|
-
|
|
72
|
+
class: {
|
|
70
73
|
type: PropType<any>;
|
|
71
|
-
default:
|
|
74
|
+
default: undefined;
|
|
75
|
+
};
|
|
76
|
+
ui: {
|
|
77
|
+
type: PropType<Partial<any>>;
|
|
78
|
+
default: undefined;
|
|
72
79
|
};
|
|
73
80
|
}>>, {
|
|
74
|
-
ui: any
|
|
81
|
+
ui: Partial<any>;
|
|
75
82
|
popper: PopperOptions;
|
|
83
|
+
class: any;
|
|
76
84
|
text: string;
|
|
77
85
|
openDelay: number;
|
|
78
86
|
closeDelay: number;
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
type InputProps = {
|
|
2
|
+
id?: string;
|
|
3
|
+
size?: string | number | symbol;
|
|
4
|
+
color?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const useFormGroup: (inputProps?: InputProps, config?: any) => {
|
|
8
|
+
inputId: import("vue").Ref<string | undefined>;
|
|
9
|
+
name: import("vue").ComputedRef<string | undefined>;
|
|
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,19 @@
|
|
|
1
|
-
import { inject, ref } from "vue";
|
|
1
|
+
import { inject, ref, computed, onMounted } 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
|
+
const formInputs = inject("form-inputs", void 0);
|
|
7
|
+
const inputId = ref(inputProps?.id);
|
|
8
|
+
onMounted(() => {
|
|
9
|
+
inputId.value = inputProps?.id ?? formGroup?.inputId.value;
|
|
10
|
+
if (formGroup) {
|
|
11
|
+
formGroup.inputId.value = inputId.value;
|
|
12
|
+
if (formInputs) {
|
|
13
|
+
formInputs.value[formGroup.name.value] = inputId;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
6
17
|
const blurred = ref(false);
|
|
7
18
|
function emitFormEvent(type, path) {
|
|
8
19
|
if (formBus) {
|
|
@@ -22,9 +33,15 @@ export const useFormGroup = () => {
|
|
|
22
33
|
}
|
|
23
34
|
}, 300);
|
|
24
35
|
return {
|
|
36
|
+
inputId,
|
|
37
|
+
name: computed(() => inputProps?.name ?? formGroup?.name.value),
|
|
38
|
+
size: computed(() => {
|
|
39
|
+
const formGroupSize = config.size[formGroup?.size.value] ? formGroup?.size.value : null;
|
|
40
|
+
return inputProps?.size ?? formGroupSize ?? config?.default?.size;
|
|
41
|
+
}),
|
|
42
|
+
color: computed(() => formGroup?.error?.value ? "red" : inputProps?.color),
|
|
25
43
|
emitFormBlur,
|
|
26
44
|
emitFormInput,
|
|
27
|
-
emitFormChange
|
|
28
|
-
formGroup
|
|
45
|
+
emitFormChange
|
|
29
46
|
};
|
|
30
47
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Ref } from 'vue';
|
|
2
|
-
import { VirtualElement } from '@popperjs/core/lib/popper-lite';
|
|
2
|
+
import type { VirtualElement } from '@popperjs/core/lib/popper-lite';
|
|
3
3
|
import type { Instance } from '@popperjs/core';
|
|
4
|
-
import { MaybeElement } from '@vueuse/core';
|
|
4
|
+
import type { MaybeElement } from '@vueuse/core';
|
|
5
5
|
import type { PopperOptions } from '../types/popper';
|
|
6
6
|
export declare const createPopper: <TModifier extends Partial<import("@popperjs/core").Modifier<any, any>>>(reference: Element | VirtualElement, popper: HTMLElement, options?: Partial<import("@popperjs/core").OptionsGeneric<TModifier>> | undefined) => Instance;
|
|
7
|
-
export declare function usePopper({ locked, overflowPadding, offsetDistance, offsetSkid, gpuAcceleration, adaptive, scroll, resize, placement, strategy }: PopperOptions, virtualReference?: Ref<Element | VirtualElement>): readonly [Ref<MaybeElement>, Ref<MaybeElement>, Ref<{
|
|
7
|
+
export declare function usePopper({ locked, overflowPadding, offsetDistance, offsetSkid, gpuAcceleration, adaptive, scroll, resize, arrow, placement, strategy }: PopperOptions, virtualReference?: Ref<Element | VirtualElement>): readonly [Ref<MaybeElement>, Ref<MaybeElement>, Ref<{
|
|
8
8
|
state: {
|
|
9
9
|
elements: {
|
|
10
10
|
reference: Element | {
|
|
@@ -1,14 +1,14 @@
|
|
|
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";
|
|
7
6
|
import computeStyles from "@popperjs/core/lib/modifiers/computeStyles";
|
|
8
7
|
import eventListeners from "@popperjs/core/lib/modifiers/eventListeners";
|
|
8
|
+
import arrowModifier from "@popperjs/core/lib/modifiers/arrow";
|
|
9
9
|
import { unrefElement } from "@vueuse/core";
|
|
10
10
|
export const createPopper = popperGenerator({
|
|
11
|
-
defaultModifiers: [...defaultModifiers, offset, flip, preventOverflow, computeStyles, eventListeners]
|
|
11
|
+
defaultModifiers: [...defaultModifiers, offset, flip, preventOverflow, computeStyles, eventListeners, arrowModifier]
|
|
12
12
|
});
|
|
13
13
|
export function usePopper({
|
|
14
14
|
locked = false,
|
|
@@ -19,6 +19,7 @@ export function usePopper({
|
|
|
19
19
|
adaptive = true,
|
|
20
20
|
scroll = true,
|
|
21
21
|
resize = true,
|
|
22
|
+
arrow = false,
|
|
22
23
|
placement,
|
|
23
24
|
strategy
|
|
24
25
|
}, virtualReference) {
|
|
@@ -41,36 +42,51 @@ export function usePopper({
|
|
|
41
42
|
if (!referenceEl) {
|
|
42
43
|
return;
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
const config = {
|
|
46
|
+
modifiers: [
|
|
47
|
+
{
|
|
48
|
+
name: "flip",
|
|
49
|
+
enabled: !locked
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "preventOverflow",
|
|
53
|
+
options: {
|
|
54
|
+
padding: overflowPadding
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "offset",
|
|
59
|
+
options: {
|
|
60
|
+
offset: [offsetSkid, offsetDistance]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "computeStyles",
|
|
65
|
+
options: {
|
|
66
|
+
adaptive,
|
|
67
|
+
gpuAcceleration
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "eventListeners",
|
|
72
|
+
options: {
|
|
73
|
+
scroll,
|
|
74
|
+
resize
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "arrow",
|
|
79
|
+
enabled: arrow
|
|
54
80
|
}
|
|
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));
|
|
81
|
+
]
|
|
82
|
+
};
|
|
83
|
+
if (placement) {
|
|
84
|
+
config.placement = placement;
|
|
85
|
+
}
|
|
86
|
+
if (strategy) {
|
|
87
|
+
config.strategy = strategy;
|
|
88
|
+
}
|
|
89
|
+
instance.value = createPopper(referenceEl, popperEl, config);
|
|
74
90
|
onInvalidate(instance.value.destroy);
|
|
75
91
|
});
|
|
76
92
|
});
|
|
@@ -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 type { 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>, withAppConfig?: boolean) => {
|
|
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, withAppConfig = false) => {
|
|
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 || withAppConfig ? 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
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { Ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
export interface FormError<T extends string = string> {
|
|
4
|
+
path: T
|
|
3
5
|
message: string
|
|
4
6
|
}
|
|
5
7
|
|
|
8
|
+
export interface FormErrorWithId extends FormError {
|
|
9
|
+
id: string
|
|
10
|
+
}
|
|
11
|
+
|
|
6
12
|
export interface Form<T> {
|
|
7
|
-
validate(path?: string, opts
|
|
13
|
+
validate(path?: string, opts?: { silent?: boolean }): Promise<T>
|
|
8
14
|
clear(path?: string): void
|
|
9
15
|
errors: Ref<FormError[]>
|
|
10
16
|
setErrors(errs: FormError[], path?: string): void
|
|
@@ -12,10 +18,18 @@ export interface Form<T> {
|
|
|
12
18
|
}
|
|
13
19
|
|
|
14
20
|
export type FormSubmitEvent<T> = SubmitEvent & { data: T }
|
|
21
|
+
export type FormErrorEvent = SubmitEvent & { errors: FormErrorWithId[] }
|
|
15
22
|
|
|
16
23
|
export type FormEventType = 'blur' | 'input' | 'change' | 'submit'
|
|
17
24
|
|
|
18
25
|
export interface FormEvent {
|
|
19
26
|
type: FormEventType
|
|
20
|
-
path
|
|
27
|
+
path?: string
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface InjectedFormGroupValue {
|
|
31
|
+
inputId: Ref<string | undefined>
|
|
32
|
+
name: Ref<string>
|
|
33
|
+
size: Ref<string | number | symbol>
|
|
34
|
+
error: Ref<string | boolean>
|
|
21
35
|
}
|
|
@@ -1,12 +1,16 @@
|
|
|
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'
|
|
6
7
|
export * from './dropdown'
|
|
7
8
|
export * from './form'
|
|
8
9
|
export * from './link'
|
|
10
|
+
export * from './meter'
|
|
9
11
|
export * from './notification'
|
|
10
12
|
export * from './popper'
|
|
13
|
+
export * from './progress'
|
|
11
14
|
export * from './tabs'
|
|
12
15
|
export * from './vertical-navigation'
|
|
16
|
+
export * from './utils'
|