@nuxt/ui 2.10.0 → 2.11.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 +11 -0
- package/dist/module.d.mts +191 -82
- package/dist/module.d.ts +191 -82
- package/dist/module.json +1 -1
- package/dist/module.mjs +12 -5
- package/dist/runtime/components/elements/Alert.vue +7 -6
- package/dist/runtime/components/elements/Alert.vue.d.ts +6 -5
- package/dist/runtime/components/elements/Avatar.vue.d.ts +5 -4
- package/dist/runtime/components/elements/AvatarGroup.d.ts +4 -3
- package/dist/runtime/components/elements/Badge.vue +4 -2
- package/dist/runtime/components/elements/Badge.vue.d.ts +5 -5
- package/dist/runtime/components/elements/Button.vue +8 -6
- package/dist/runtime/components/elements/Button.vue.d.ts +6 -6
- package/dist/runtime/components/elements/ButtonGroup.d.ts +5 -4
- package/dist/runtime/components/elements/ButtonGroup.mjs +19 -32
- package/dist/runtime/components/elements/Chip.vue +85 -0
- package/dist/runtime/components/elements/Chip.vue.d.ts +90 -0
- package/dist/runtime/components/elements/Dropdown.vue +31 -17
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +6 -0
- package/dist/runtime/components/elements/Icon.vue +16 -2
- package/dist/runtime/components/elements/Icon.vue.d.ts +14 -2
- package/dist/runtime/components/elements/Kbd.vue.d.ts +5 -4
- package/dist/runtime/components/elements/Link.vue +2 -5
- package/dist/runtime/components/elements/Meter.vue.d.ts +3 -3
- package/dist/runtime/components/elements/MeterGroup.d.ts +2 -2
- package/dist/runtime/components/elements/Progress.vue +1 -1
- package/dist/runtime/components/forms/Checkbox.vue +2 -4
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +5 -5
- package/dist/runtime/components/forms/FormGroup.vue +7 -3
- package/dist/runtime/components/forms/FormGroup.vue.d.ts +15 -5
- package/dist/runtime/components/forms/Input.vue +36 -5
- package/dist/runtime/components/forms/Input.vue.d.ts +32 -9
- package/dist/runtime/components/forms/Radio.vue +12 -6
- package/dist/runtime/components/forms/Radio.vue.d.ts +5 -4
- package/dist/runtime/components/forms/RadioGroup.vue +1 -1
- package/dist/runtime/components/forms/RadioGroup.vue.d.ts +1 -1
- package/dist/runtime/components/forms/Range.vue.d.ts +6 -5
- package/dist/runtime/components/forms/Select.vue +5 -2
- package/dist/runtime/components/forms/Select.vue.d.ts +9 -8
- package/dist/runtime/components/forms/SelectMenu.vue +24 -7
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +18 -9
- package/dist/runtime/components/forms/Textarea.vue +33 -3
- package/dist/runtime/components/forms/Textarea.vue.d.ts +31 -8
- package/dist/runtime/components/forms/Toggle.vue +19 -1
- package/dist/runtime/components/forms/Toggle.vue.d.ts +15 -2
- package/dist/runtime/components/layout/Divider.vue.d.ts +3 -3
- package/dist/runtime/components/navigation/Breadcrumb.vue +78 -0
- package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +50 -0
- package/dist/runtime/components/navigation/CommandPalette.vue +8 -4
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +4 -4
- package/dist/runtime/components/navigation/Tabs.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/Notification.vue +27 -28
- package/dist/runtime/components/overlays/Notification.vue.d.ts +4 -3
- package/dist/runtime/components/overlays/Notifications.vue +16 -14
- package/dist/runtime/components/overlays/Popover.vue +9 -0
- package/dist/runtime/components/overlays/Popover.vue.d.ts +13 -2
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
- package/dist/runtime/composables/defineShortcuts.mjs +8 -4
- package/dist/runtime/composables/useButtonGroup.d.ts +20 -0
- package/dist/runtime/composables/useButtonGroup.mjs +52 -0
- package/dist/runtime/composables/useFormGroup.d.ts +4 -2
- package/dist/runtime/composables/useFormGroup.mjs +3 -2
- package/dist/runtime/composables/useShortcuts.d.ts +2 -2
- package/dist/runtime/types/alert.d.ts +7 -0
- package/dist/runtime/types/avatar.d.ts +3 -1
- package/dist/runtime/types/badge.d.ts +5 -4
- package/dist/runtime/types/breadcrumb.d.ts +7 -0
- package/dist/runtime/types/button.d.ts +5 -4
- package/dist/runtime/types/chip.d.ts +11 -0
- package/dist/runtime/types/dropdown.d.ts +2 -2
- package/dist/runtime/types/form-group.d.ts +5 -0
- package/dist/runtime/types/form.d.ts +2 -1
- package/dist/runtime/types/index.d.ts +10 -0
- package/dist/runtime/types/input.d.ts +8 -0
- package/dist/runtime/types/kbd.d.ts +5 -0
- package/dist/runtime/types/range.d.ts +5 -0
- package/dist/runtime/types/select.d.ts +8 -0
- package/dist/runtime/types/textarea.d.ts +8 -0
- package/dist/runtime/types/toggle.d.ts +5 -0
- package/dist/runtime/types/utils.d.ts +22 -5
- package/dist/runtime/ui.config/_popperArrow.d.ts +9 -0
- package/dist/runtime/ui.config/_popperArrow.mjs +8 -0
- package/dist/runtime/ui.config/data/table.d.ts +60 -0
- package/dist/runtime/ui.config/data/table.mjs +59 -0
- package/dist/runtime/ui.config/elements/accordion.d.ts +21 -0
- package/dist/runtime/ui.config/elements/accordion.mjs +20 -0
- package/dist/runtime/ui.config/elements/alert.d.ts +40 -0
- package/dist/runtime/ui.config/elements/alert.mjs +39 -0
- package/dist/runtime/ui.config/elements/avatar.d.ts +60 -0
- package/dist/runtime/ui.config/elements/avatar.mjs +59 -0
- package/dist/runtime/ui.config/elements/avatarGroup.d.ts +6 -0
- package/dist/runtime/ui.config/elements/avatarGroup.mjs +5 -0
- package/dist/runtime/ui.config/elements/badge.d.ts +34 -0
- package/dist/runtime/ui.config/elements/badge.mjs +33 -0
- package/dist/runtime/ui.config/elements/button.d.ts +77 -0
- package/dist/runtime/ui.config/elements/button.mjs +76 -0
- package/dist/runtime/ui.config/elements/buttonGroup.d.ts +9 -0
- package/dist/runtime/ui.config/elements/buttonGroup.mjs +8 -0
- package/dist/runtime/ui.config/elements/chip.d.ts +35 -0
- package/dist/runtime/ui.config/elements/chip.mjs +34 -0
- package/dist/runtime/ui.config/elements/dropdown.d.ts +53 -0
- package/dist/runtime/ui.config/elements/dropdown.mjs +51 -0
- package/dist/runtime/ui.config/elements/kbd.d.ts +17 -0
- package/dist/runtime/ui.config/elements/kbd.mjs +16 -0
- package/dist/runtime/ui.config/elements/meter.d.ts +77 -0
- package/dist/runtime/ui.config/elements/meter.mjs +76 -0
- package/dist/runtime/ui.config/elements/meterGroup.d.ts +12 -0
- package/dist/runtime/ui.config/elements/meterGroup.mjs +11 -0
- package/dist/runtime/ui.config/elements/progress.d.ts +75 -0
- package/dist/runtime/ui.config/elements/progress.mjs +74 -0
- package/dist/runtime/ui.config/forms/checkbox.d.ts +16 -0
- package/dist/runtime/ui.config/forms/checkbox.mjs +15 -0
- package/dist/runtime/ui.config/forms/formGroup.d.ts +25 -0
- package/dist/runtime/ui.config/forms/formGroup.mjs +25 -0
- package/dist/runtime/ui.config/forms/input.d.ts +105 -0
- package/dist/runtime/ui.config/forms/input.mjs +104 -0
- package/dist/runtime/ui.config/forms/radio.d.ts +15 -0
- package/dist/runtime/ui.config/forms/radio.mjs +14 -0
- package/dist/runtime/ui.config/forms/radioGroup.d.ts +8 -0
- package/dist/runtime/ui.config/forms/radioGroup.mjs +7 -0
- package/dist/runtime/ui.config/forms/range.d.ts +64 -0
- package/dist/runtime/ui.config/forms/range.mjs +63 -0
- package/dist/runtime/ui.config/forms/select.d.ts +106 -0
- package/dist/runtime/ui.config/forms/select.mjs +12 -0
- package/dist/runtime/ui.config/forms/selectMenu.d.ts +63 -0
- package/dist/runtime/ui.config/forms/selectMenu.mjs +61 -0
- package/dist/runtime/ui.config/forms/textarea.d.ts +104 -0
- package/dist/runtime/ui.config/forms/textarea.mjs +9 -0
- package/dist/runtime/ui.config/forms/toggle.d.ts +61 -0
- package/dist/runtime/ui.config/forms/toggle.mjs +60 -0
- package/dist/runtime/ui.config/index.d.ts +40 -0
- package/dist/runtime/ui.config/index.mjs +40 -0
- package/dist/runtime/ui.config/layout/card.d.ts +24 -0
- package/dist/runtime/ui.config/layout/card.mjs +23 -0
- package/dist/runtime/ui.config/layout/container.d.ts +6 -0
- package/dist/runtime/ui.config/layout/container.mjs +5 -0
- package/dist/runtime/ui.config/layout/divider.d.ts +30 -0
- package/dist/runtime/ui.config/layout/divider.mjs +29 -0
- package/dist/runtime/ui.config/layout/skeleton.d.ts +6 -0
- package/dist/runtime/ui.config/layout/skeleton.mjs +5 -0
- package/dist/runtime/ui.config/navigation/breadcrumb.d.ts +20 -0
- package/dist/runtime/ui.config/navigation/breadcrumb.mjs +19 -0
- package/dist/runtime/ui.config/navigation/commandPalette.d.ts +68 -0
- package/dist/runtime/ui.config/navigation/commandPalette.mjs +67 -0
- package/dist/runtime/ui.config/navigation/pagination.d.ts +35 -0
- package/dist/runtime/ui.config/navigation/pagination.mjs +34 -0
- package/dist/runtime/ui.config/navigation/tabs.d.ts +34 -0
- package/dist/runtime/ui.config/navigation/tabs.mjs +33 -0
- package/dist/runtime/ui.config/navigation/verticalNavigation.d.ts +28 -0
- package/dist/runtime/ui.config/navigation/verticalNavigation.mjs +27 -0
- package/dist/runtime/ui.config/overlays/contextMenu.d.ts +31 -0
- package/dist/runtime/ui.config/overlays/contextMenu.mjs +25 -0
- package/dist/runtime/ui.config/overlays/modal.d.ts +35 -0
- package/dist/runtime/ui.config/overlays/modal.mjs +36 -0
- package/dist/runtime/ui.config/overlays/notification.d.ts +49 -0
- package/dist/runtime/ui.config/overlays/notification.mjs +49 -0
- package/dist/runtime/ui.config/overlays/notifications.d.ts +7 -0
- package/dist/runtime/ui.config/overlays/notifications.mjs +6 -0
- package/dist/runtime/ui.config/overlays/popover.d.ts +42 -0
- package/dist/runtime/ui.config/overlays/popover.mjs +36 -0
- package/dist/runtime/ui.config/overlays/slideover.d.ts +27 -0
- package/dist/runtime/ui.config/overlays/slideover.mjs +28 -0
- package/dist/runtime/ui.config/overlays/tooltip.d.ts +32 -0
- package/dist/runtime/ui.config/overlays/tooltip.mjs +26 -0
- package/dist/runtime/utils/index.d.ts +5 -0
- package/dist/runtime/utils/index.mjs +6 -2
- package/dist/types.d.mts +3 -2
- package/dist/types.d.ts +3 -2
- package/package.json +32 -19
- package/dist/runtime/ui.config.d.ts +0 -1470
- package/dist/runtime/ui.config.mjs +0 -1273
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<Icon v-if="dynamic" :name="name" />
|
|
3
|
+
<span v-else :class="name" />
|
|
3
4
|
</template>
|
|
4
5
|
|
|
5
6
|
<script>
|
|
6
|
-
import { defineComponent } from "vue";
|
|
7
|
+
import { defineComponent, computed } from "vue";
|
|
8
|
+
import { useAppConfig } from "#imports";
|
|
7
9
|
export default defineComponent({
|
|
8
10
|
props: {
|
|
9
11
|
name: {
|
|
10
12
|
type: String,
|
|
11
13
|
required: true
|
|
14
|
+
},
|
|
15
|
+
dynamic: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: false
|
|
12
18
|
}
|
|
19
|
+
},
|
|
20
|
+
setup(props) {
|
|
21
|
+
const appConfig = useAppConfig();
|
|
22
|
+
const dynamic = computed(() => props.dynamic || appConfig.ui?.icons?.dynamic);
|
|
23
|
+
return {
|
|
24
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
25
|
+
dynamic
|
|
26
|
+
};
|
|
13
27
|
}
|
|
14
28
|
});
|
|
15
29
|
</script>
|
|
@@ -3,10 +3,22 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
3
3
|
type: StringConstructor;
|
|
4
4
|
required: true;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
dynamic: {
|
|
7
|
+
type: BooleanConstructor;
|
|
8
|
+
default: boolean;
|
|
9
|
+
};
|
|
10
|
+
}, {
|
|
11
|
+
dynamic: import("vue").ComputedRef<any>;
|
|
12
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
7
13
|
name: {
|
|
8
14
|
type: StringConstructor;
|
|
9
15
|
required: true;
|
|
10
16
|
};
|
|
11
|
-
|
|
17
|
+
dynamic: {
|
|
18
|
+
type: BooleanConstructor;
|
|
19
|
+
default: boolean;
|
|
20
|
+
};
|
|
21
|
+
}>>, {
|
|
22
|
+
dynamic: boolean;
|
|
23
|
+
}, {}>;
|
|
12
24
|
export default _default;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
|
+
import type { KbdSize } from '../../types';
|
|
2
3
|
declare const _default: import("vue").DefineComponent<{
|
|
3
4
|
value: {
|
|
4
5
|
type: StringConstructor;
|
|
5
6
|
default: null;
|
|
6
7
|
};
|
|
7
8
|
size: {
|
|
8
|
-
type: PropType<
|
|
9
|
+
type: PropType<KbdSize>;
|
|
9
10
|
default: () => any;
|
|
10
11
|
validator(value: string): boolean;
|
|
11
12
|
};
|
|
@@ -29,7 +30,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
29
30
|
default: null;
|
|
30
31
|
};
|
|
31
32
|
size: {
|
|
32
|
-
type: PropType<
|
|
33
|
+
type: PropType<KbdSize>;
|
|
33
34
|
default: () => any;
|
|
34
35
|
validator(value: string): boolean;
|
|
35
36
|
};
|
|
@@ -42,9 +43,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
42
43
|
default: undefined;
|
|
43
44
|
};
|
|
44
45
|
}>>, {
|
|
46
|
+
size: KbdSize;
|
|
45
47
|
ui: Partial<any>;
|
|
46
|
-
class: any;
|
|
47
48
|
value: string;
|
|
48
|
-
|
|
49
|
+
class: any;
|
|
49
50
|
}, {}>;
|
|
50
51
|
export default _default;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
v-if="!to"
|
|
5
5
|
:disabled="disabled"
|
|
6
6
|
v-bind="$attrs"
|
|
7
|
-
:class="inactiveClass"
|
|
7
|
+
:class="active ? activeClass : inactiveClass"
|
|
8
8
|
>
|
|
9
9
|
<slot />
|
|
10
10
|
</component>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
:role="disabled ? 'link' : undefined"
|
|
22
22
|
:rel="rel"
|
|
23
23
|
:target="target"
|
|
24
|
-
:class="resolveLinkClass(route, $route, { isActive, isExactActive })"
|
|
24
|
+
:class="active ? activeClass : resolveLinkClass(route, $route, { isActive, isExactActive })"
|
|
25
25
|
@click="(e) => !isExternal && navigate(e)"
|
|
26
26
|
>
|
|
27
27
|
<slot v-bind="{ isActive: exact ? isExactActive : isActive }" />
|
|
@@ -68,9 +68,6 @@ export default defineComponent({
|
|
|
68
68
|
},
|
|
69
69
|
setup(props) {
|
|
70
70
|
function resolveLinkClass(route, $route, { isActive, isExactActive }) {
|
|
71
|
-
if (props.active) {
|
|
72
|
-
return props.activeClass;
|
|
73
|
-
}
|
|
74
71
|
if (props.exactQuery && !isEqual(route.query, $route.query)) {
|
|
75
72
|
return props.inactiveClass;
|
|
76
73
|
}
|
|
@@ -100,13 +100,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
100
100
|
default: undefined;
|
|
101
101
|
};
|
|
102
102
|
}>>, {
|
|
103
|
+
size: "sm" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl";
|
|
104
|
+
ui: Partial<any>;
|
|
105
|
+
value: number;
|
|
103
106
|
icon: string;
|
|
104
107
|
color: any;
|
|
105
|
-
ui: Partial<any>;
|
|
106
108
|
class: any;
|
|
107
|
-
value: number;
|
|
108
109
|
label: string;
|
|
109
|
-
size: "sm" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl";
|
|
110
110
|
max: number;
|
|
111
111
|
min: number;
|
|
112
112
|
indicator: boolean;
|
|
@@ -62,10 +62,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
62
62
|
default: undefined;
|
|
63
63
|
};
|
|
64
64
|
}>>, {
|
|
65
|
-
|
|
65
|
+
size: "sm" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl";
|
|
66
66
|
ui: Partial<any>;
|
|
67
|
+
icon: string;
|
|
67
68
|
class: any;
|
|
68
|
-
size: "sm" | "md" | "xs" | "2xs" | "lg" | "xl" | "2xl";
|
|
69
69
|
max: number;
|
|
70
70
|
min: number;
|
|
71
71
|
indicator: boolean;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
@change="onChange"
|
|
18
18
|
>
|
|
19
19
|
</div>
|
|
20
|
-
<div v-if="label || $slots.label" class="ms-3
|
|
20
|
+
<div v-if="label || $slots.label" class="ms-3 flex flex-col">
|
|
21
21
|
<label :for="inputId" :class="ui.label">
|
|
22
22
|
<slot name="label">{{ label }}</slot>
|
|
23
23
|
<span v-if="required" :class="ui.required">*</span>
|
|
@@ -35,7 +35,6 @@ import { twMerge, twJoin } from "tailwind-merge";
|
|
|
35
35
|
import { useUI } from "../../composables/useUI";
|
|
36
36
|
import { useFormGroup } from "../../composables/useFormGroup";
|
|
37
37
|
import { mergeConfig } from "../../utils";
|
|
38
|
-
import { uid } from "../../utils/uid";
|
|
39
38
|
import appConfig from "#build/app.config";
|
|
40
39
|
import { checkbox } from "#ui/ui.config";
|
|
41
40
|
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.checkbox, checkbox);
|
|
@@ -44,8 +43,7 @@ export default defineComponent({
|
|
|
44
43
|
props: {
|
|
45
44
|
id: {
|
|
46
45
|
type: String,
|
|
47
|
-
|
|
48
|
-
default: () => uid()
|
|
46
|
+
default: () => null
|
|
49
47
|
},
|
|
50
48
|
value: {
|
|
51
49
|
type: [String, Number, Boolean, Object],
|
|
@@ -2,7 +2,7 @@ import type { PropType } from 'vue';
|
|
|
2
2
|
declare const _default: import("vue").DefineComponent<{
|
|
3
3
|
id: {
|
|
4
4
|
type: StringConstructor;
|
|
5
|
-
default: () =>
|
|
5
|
+
default: () => null;
|
|
6
6
|
};
|
|
7
7
|
value: {
|
|
8
8
|
type: (ObjectConstructor | BooleanConstructor | NumberConstructor | StringConstructor)[];
|
|
@@ -63,14 +63,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
63
63
|
[x: string]: unknown;
|
|
64
64
|
}, string>>;
|
|
65
65
|
toggle: import("vue").WritableComputedRef<boolean | unknown[]>;
|
|
66
|
-
inputId: import("vue").Ref<string | undefined>;
|
|
66
|
+
inputId: import("vue").Ref<string | null | undefined>;
|
|
67
67
|
name: import("vue").ComputedRef<string | undefined>;
|
|
68
68
|
inputClass: import("vue").ComputedRef<string>;
|
|
69
69
|
onChange: (event: Event) => void;
|
|
70
70
|
}, 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<{
|
|
71
71
|
id: {
|
|
72
72
|
type: StringConstructor;
|
|
73
|
-
default: () =>
|
|
73
|
+
default: () => null;
|
|
74
74
|
};
|
|
75
75
|
value: {
|
|
76
76
|
type: (ObjectConstructor | BooleanConstructor | NumberConstructor | StringConstructor)[];
|
|
@@ -129,12 +129,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
129
129
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
130
130
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
131
131
|
}, {
|
|
132
|
+
ui: Partial<any>;
|
|
133
|
+
value: string | number | boolean | Record<string, any>;
|
|
132
134
|
id: string;
|
|
133
135
|
color: any;
|
|
134
|
-
ui: Partial<any>;
|
|
135
136
|
name: string;
|
|
136
137
|
class: any;
|
|
137
|
-
value: string | number | boolean | Record<string, any>;
|
|
138
138
|
label: string;
|
|
139
139
|
modelValue: boolean | unknown[];
|
|
140
140
|
indeterminate: boolean;
|
|
@@ -43,7 +43,6 @@ import { useUI } from "../../composables/useUI";
|
|
|
43
43
|
import { mergeConfig } from "../../utils";
|
|
44
44
|
import appConfig from "#build/app.config";
|
|
45
45
|
import { formGroup } from "#ui/ui.config";
|
|
46
|
-
import { uid } from "../../utils/uid";
|
|
47
46
|
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.formGroup, formGroup);
|
|
48
47
|
export default defineComponent({
|
|
49
48
|
inheritAttrs: false,
|
|
@@ -90,6 +89,10 @@ export default defineComponent({
|
|
|
90
89
|
ui: {
|
|
91
90
|
type: Object,
|
|
92
91
|
default: void 0
|
|
92
|
+
},
|
|
93
|
+
eagerValidation: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
default: false
|
|
93
96
|
}
|
|
94
97
|
},
|
|
95
98
|
setup(props) {
|
|
@@ -99,12 +102,13 @@ export default defineComponent({
|
|
|
99
102
|
return props.error && typeof props.error === "string" || typeof props.error === "boolean" ? props.error : formErrors?.value?.find((error2) => error2.path === props.name)?.message;
|
|
100
103
|
});
|
|
101
104
|
const size = computed(() => ui.value.size[props.size ?? config.default.size]);
|
|
102
|
-
const inputId = ref(
|
|
105
|
+
const inputId = ref();
|
|
103
106
|
provide("form-group", {
|
|
104
107
|
error,
|
|
105
108
|
inputId,
|
|
106
109
|
name: computed(() => props.name),
|
|
107
|
-
size: computed(() => props.size)
|
|
110
|
+
size: computed(() => props.size),
|
|
111
|
+
eagerValidation: computed(() => props.eagerValidation)
|
|
108
112
|
});
|
|
109
113
|
return {
|
|
110
114
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { Ref, PropType } from 'vue';
|
|
2
|
+
import type { FormGroupSize } from '../../types';
|
|
2
3
|
declare const _default: import("vue").DefineComponent<{
|
|
3
4
|
name: {
|
|
4
5
|
type: StringConstructor;
|
|
5
6
|
default: null;
|
|
6
7
|
};
|
|
7
8
|
size: {
|
|
8
|
-
type: PropType<
|
|
9
|
+
type: PropType<FormGroupSize>;
|
|
9
10
|
default: null;
|
|
10
11
|
validator(value: string): boolean;
|
|
11
12
|
};
|
|
@@ -41,12 +42,16 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
41
42
|
type: PropType<Partial<any>>;
|
|
42
43
|
default: undefined;
|
|
43
44
|
};
|
|
45
|
+
eagerValidation: {
|
|
46
|
+
type: BooleanConstructor;
|
|
47
|
+
default: boolean;
|
|
48
|
+
};
|
|
44
49
|
}, {
|
|
45
50
|
ui: import("vue").ComputedRef<any>;
|
|
46
51
|
attrs: import("vue").ComputedRef<Pick<{
|
|
47
52
|
[x: string]: unknown;
|
|
48
53
|
}, string>>;
|
|
49
|
-
inputId: Ref<
|
|
54
|
+
inputId: Ref<any>;
|
|
50
55
|
size: import("vue").ComputedRef<any>;
|
|
51
56
|
error: import("vue").ComputedRef<string | boolean | undefined>;
|
|
52
57
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -55,7 +60,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
55
60
|
default: null;
|
|
56
61
|
};
|
|
57
62
|
size: {
|
|
58
|
-
type: PropType<
|
|
63
|
+
type: PropType<FormGroupSize>;
|
|
59
64
|
default: null;
|
|
60
65
|
validator(value: string): boolean;
|
|
61
66
|
};
|
|
@@ -91,16 +96,21 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
91
96
|
type: PropType<Partial<any>>;
|
|
92
97
|
default: undefined;
|
|
93
98
|
};
|
|
99
|
+
eagerValidation: {
|
|
100
|
+
type: BooleanConstructor;
|
|
101
|
+
default: boolean;
|
|
102
|
+
};
|
|
94
103
|
}>>, {
|
|
95
104
|
error: string | boolean;
|
|
96
|
-
|
|
105
|
+
size: FormGroupSize;
|
|
97
106
|
ui: Partial<any>;
|
|
107
|
+
description: string;
|
|
98
108
|
name: string;
|
|
99
109
|
class: any;
|
|
100
110
|
label: string;
|
|
101
111
|
required: boolean;
|
|
102
|
-
size: string | number | symbol;
|
|
103
112
|
help: string;
|
|
104
113
|
hint: string;
|
|
114
|
+
eagerValidation: boolean;
|
|
105
115
|
}, {}>;
|
|
106
116
|
export default _default;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
v-bind="attrs"
|
|
15
15
|
@input="onInput"
|
|
16
16
|
@blur="onBlur"
|
|
17
|
+
@change="onChange"
|
|
17
18
|
>
|
|
18
19
|
<slot />
|
|
19
20
|
|
|
@@ -35,9 +36,11 @@
|
|
|
35
36
|
import { ref, computed, toRef, onMounted, defineComponent } from "vue";
|
|
36
37
|
import { twMerge, twJoin } from "tailwind-merge";
|
|
37
38
|
import UIcon from "../elements/Icon.vue";
|
|
39
|
+
import { defu } from "defu";
|
|
38
40
|
import { useUI } from "../../composables/useUI";
|
|
39
41
|
import { useFormGroup } from "../../composables/useFormGroup";
|
|
40
|
-
import { mergeConfig } from "../../utils";
|
|
42
|
+
import { mergeConfig, looseToNumber } from "../../utils";
|
|
43
|
+
import { useInjectButtonGroup } from "../../composables/useButtonGroup";
|
|
41
44
|
import appConfig from "#build/app.config";
|
|
42
45
|
import { input } from "#ui/ui.config";
|
|
43
46
|
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.input, input);
|
|
@@ -150,22 +153,49 @@ export default defineComponent({
|
|
|
150
153
|
ui: {
|
|
151
154
|
type: Object,
|
|
152
155
|
default: void 0
|
|
156
|
+
},
|
|
157
|
+
modelModifiers: {
|
|
158
|
+
type: Object,
|
|
159
|
+
default: () => ({})
|
|
153
160
|
}
|
|
154
161
|
},
|
|
155
162
|
emits: ["update:modelValue", "blur"],
|
|
156
163
|
setup(props, { emit, slots }) {
|
|
157
164
|
const { ui, attrs } = useUI("input", toRef(props, "ui"), config, toRef(props, "class"));
|
|
158
|
-
const {
|
|
165
|
+
const { size: sizeButtonGroup, rounded } = useInjectButtonGroup({ ui, props });
|
|
166
|
+
const { emitFormBlur, emitFormInput, size: sizeFormGroup, color, inputId, name } = useFormGroup(props, config);
|
|
167
|
+
const size = computed(() => sizeButtonGroup.value || sizeFormGroup.value);
|
|
168
|
+
const modelModifiers = ref(defu({}, props.modelModifiers, { trim: false, lazy: false, number: false }));
|
|
159
169
|
const input2 = ref(null);
|
|
160
170
|
const autoFocus = () => {
|
|
161
171
|
if (props.autofocus) {
|
|
162
172
|
input2.value?.focus();
|
|
163
173
|
}
|
|
164
174
|
};
|
|
165
|
-
const
|
|
166
|
-
|
|
175
|
+
const updateInput = (value) => {
|
|
176
|
+
if (modelModifiers.value.trim) {
|
|
177
|
+
value = value.trim();
|
|
178
|
+
}
|
|
179
|
+
if (modelModifiers.value.number || props.type === "number") {
|
|
180
|
+
value = looseToNumber(value);
|
|
181
|
+
}
|
|
182
|
+
emit("update:modelValue", value);
|
|
167
183
|
emitFormInput();
|
|
168
184
|
};
|
|
185
|
+
const onInput = (event) => {
|
|
186
|
+
if (!modelModifiers.value.lazy) {
|
|
187
|
+
updateInput(event.target.value);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
const onChange = (event) => {
|
|
191
|
+
const value = event.target.value;
|
|
192
|
+
if (modelModifiers.value.lazy) {
|
|
193
|
+
updateInput(value);
|
|
194
|
+
}
|
|
195
|
+
if (modelModifiers.value.trim) {
|
|
196
|
+
event.target.value = value.trim();
|
|
197
|
+
}
|
|
198
|
+
};
|
|
169
199
|
const onBlur = (event) => {
|
|
170
200
|
emitFormBlur();
|
|
171
201
|
emit("blur", event);
|
|
@@ -179,7 +209,7 @@ export default defineComponent({
|
|
|
179
209
|
const variant = ui.value.color?.[color.value]?.[props.variant] || ui.value.variant[props.variant];
|
|
180
210
|
return twMerge(twJoin(
|
|
181
211
|
ui.value.base,
|
|
182
|
-
|
|
212
|
+
rounded.value,
|
|
183
213
|
ui.value.placeholder,
|
|
184
214
|
ui.value.size[size.value],
|
|
185
215
|
props.padded ? ui.value.padding[size.value] : "p-0",
|
|
@@ -255,6 +285,7 @@ export default defineComponent({
|
|
|
255
285
|
trailingIconClass,
|
|
256
286
|
trailingWrapperIconClass,
|
|
257
287
|
onInput,
|
|
288
|
+
onChange,
|
|
258
289
|
onBlur
|
|
259
290
|
};
|
|
260
291
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
|
+
import type { InputSize, InputVariant } from '../../types';
|
|
2
3
|
declare const _default: import("vue").DefineComponent<{
|
|
3
4
|
modelValue: {
|
|
4
5
|
type: (NumberConstructor | StringConstructor)[];
|
|
@@ -69,7 +70,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
69
70
|
default: boolean;
|
|
70
71
|
};
|
|
71
72
|
size: {
|
|
72
|
-
type: PropType<
|
|
73
|
+
type: PropType<InputSize>;
|
|
73
74
|
default: null;
|
|
74
75
|
validator(value: string): boolean;
|
|
75
76
|
};
|
|
@@ -79,7 +80,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
79
80
|
validator(value: string): boolean;
|
|
80
81
|
};
|
|
81
82
|
variant: {
|
|
82
|
-
type: PropType<
|
|
83
|
+
type: PropType<InputVariant>;
|
|
83
84
|
default: () => any;
|
|
84
85
|
validator(value: string): boolean;
|
|
85
86
|
};
|
|
@@ -95,13 +96,21 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
95
96
|
type: PropType<Partial<any>>;
|
|
96
97
|
default: undefined;
|
|
97
98
|
};
|
|
99
|
+
modelModifiers: {
|
|
100
|
+
type: PropType<{
|
|
101
|
+
trim?: boolean | undefined;
|
|
102
|
+
lazy?: boolean | undefined;
|
|
103
|
+
number?: boolean | undefined;
|
|
104
|
+
}>;
|
|
105
|
+
default: () => {};
|
|
106
|
+
};
|
|
98
107
|
}, {
|
|
99
108
|
ui: import("vue").ComputedRef<any>;
|
|
100
109
|
attrs: import("vue").ComputedRef<Pick<{
|
|
101
110
|
[x: string]: unknown;
|
|
102
111
|
}, string>>;
|
|
103
112
|
name: import("vue").ComputedRef<string | undefined>;
|
|
104
|
-
inputId: import("vue").Ref<string | undefined>;
|
|
113
|
+
inputId: import("vue").Ref<string | null | undefined>;
|
|
105
114
|
input: import("vue").Ref<HTMLInputElement | null>;
|
|
106
115
|
isLeading: import("vue").ComputedRef<string | true>;
|
|
107
116
|
isTrailing: import("vue").ComputedRef<string | true>;
|
|
@@ -113,6 +122,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
113
122
|
trailingIconClass: import("vue").ComputedRef<string>;
|
|
114
123
|
trailingWrapperIconClass: import("vue").ComputedRef<string>;
|
|
115
124
|
onInput: (event: InputEvent) => void;
|
|
125
|
+
onChange: (event: InputEvent) => void;
|
|
116
126
|
onBlur: (event: FocusEvent) => void;
|
|
117
127
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("blur" | "update:modelValue")[], "blur" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
118
128
|
modelValue: {
|
|
@@ -184,7 +194,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
184
194
|
default: boolean;
|
|
185
195
|
};
|
|
186
196
|
size: {
|
|
187
|
-
type: PropType<
|
|
197
|
+
type: PropType<InputSize>;
|
|
188
198
|
default: null;
|
|
189
199
|
validator(value: string): boolean;
|
|
190
200
|
};
|
|
@@ -194,7 +204,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
194
204
|
validator(value: string): boolean;
|
|
195
205
|
};
|
|
196
206
|
variant: {
|
|
197
|
-
type: PropType<
|
|
207
|
+
type: PropType<InputVariant>;
|
|
198
208
|
default: () => any;
|
|
199
209
|
validator(value: string): boolean;
|
|
200
210
|
};
|
|
@@ -210,23 +220,31 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
210
220
|
type: PropType<Partial<any>>;
|
|
211
221
|
default: undefined;
|
|
212
222
|
};
|
|
223
|
+
modelModifiers: {
|
|
224
|
+
type: PropType<{
|
|
225
|
+
trim?: boolean | undefined;
|
|
226
|
+
lazy?: boolean | undefined;
|
|
227
|
+
number?: boolean | undefined;
|
|
228
|
+
}>;
|
|
229
|
+
default: () => {};
|
|
230
|
+
};
|
|
213
231
|
}>> & {
|
|
214
232
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
215
233
|
onBlur?: ((...args: any[]) => any) | undefined;
|
|
216
234
|
}, {
|
|
235
|
+
size: InputSize;
|
|
236
|
+
ui: Partial<any>;
|
|
217
237
|
id: string;
|
|
218
238
|
icon: string;
|
|
219
239
|
color: any;
|
|
220
|
-
|
|
240
|
+
type: string;
|
|
221
241
|
name: string;
|
|
222
242
|
class: any;
|
|
223
243
|
modelValue: string | number;
|
|
224
244
|
loading: boolean;
|
|
225
|
-
type: string;
|
|
226
245
|
disabled: boolean;
|
|
227
|
-
variant:
|
|
246
|
+
variant: InputVariant;
|
|
228
247
|
required: boolean;
|
|
229
|
-
size: string | number | symbol;
|
|
230
248
|
placeholder: string;
|
|
231
249
|
padded: boolean;
|
|
232
250
|
loadingIcon: string;
|
|
@@ -237,5 +255,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
237
255
|
autofocus: boolean;
|
|
238
256
|
inputClass: string;
|
|
239
257
|
autofocusDelay: number;
|
|
258
|
+
modelModifiers: {
|
|
259
|
+
trim?: boolean | undefined;
|
|
260
|
+
lazy?: boolean | undefined;
|
|
261
|
+
number?: boolean | undefined;
|
|
262
|
+
};
|
|
240
263
|
}, {}>;
|
|
241
264
|
export default _default;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div :class="ui.wrapper">
|
|
3
3
|
<div class="flex items-center h-5">
|
|
4
4
|
<input
|
|
5
|
-
:id="
|
|
5
|
+
:id="inputId"
|
|
6
6
|
v-model="pick"
|
|
7
7
|
:name="name"
|
|
8
8
|
:required="required"
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
v-bind="attrs"
|
|
15
15
|
>
|
|
16
16
|
</div>
|
|
17
|
-
<div v-if="label || $slots.label" class="ms-3
|
|
18
|
-
<label :for="
|
|
17
|
+
<div v-if="label || $slots.label" class="ms-3 flex flex-col">
|
|
18
|
+
<label :for="inputId" :class="ui.label">
|
|
19
19
|
<slot name="label">{{ label }}</slot>
|
|
20
20
|
<span v-if="required" :class="ui.required">*</span>
|
|
21
21
|
</label>
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
</template>
|
|
28
28
|
|
|
29
29
|
<script>
|
|
30
|
-
import { computed, defineComponent, inject, toRef } from "vue";
|
|
30
|
+
import { computed, defineComponent, inject, toRef, onMounted, ref } from "vue";
|
|
31
31
|
import { twMerge, twJoin } from "tailwind-merge";
|
|
32
32
|
import { useUI } from "../../composables/useUI";
|
|
33
33
|
import { mergeConfig } from "../../utils";
|
|
@@ -41,8 +41,7 @@ export default defineComponent({
|
|
|
41
41
|
props: {
|
|
42
42
|
id: {
|
|
43
43
|
type: String,
|
|
44
|
-
|
|
45
|
-
default: () => uid()
|
|
44
|
+
default: () => null
|
|
46
45
|
},
|
|
47
46
|
value: {
|
|
48
47
|
type: [String, Number, Boolean],
|
|
@@ -97,6 +96,12 @@ export default defineComponent({
|
|
|
97
96
|
const { ui, attrs } = useUI("radio", toRef(props, "ui"), config, toRef(props, "class"));
|
|
98
97
|
const radioGroup = inject("radio-group", null);
|
|
99
98
|
const { emitFormChange, color, name } = radioGroup ?? useFormGroup(props, config);
|
|
99
|
+
const inputId = ref(props.id);
|
|
100
|
+
onMounted(() => {
|
|
101
|
+
if (!inputId.value) {
|
|
102
|
+
inputId.value = uid();
|
|
103
|
+
}
|
|
104
|
+
});
|
|
100
105
|
const pick = computed({
|
|
101
106
|
get() {
|
|
102
107
|
return props.modelValue;
|
|
@@ -119,6 +124,7 @@ export default defineComponent({
|
|
|
119
124
|
), props.inputClass);
|
|
120
125
|
});
|
|
121
126
|
return {
|
|
127
|
+
inputId,
|
|
122
128
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
123
129
|
ui,
|
|
124
130
|
attrs,
|
|
@@ -2,7 +2,7 @@ import type { PropType } from 'vue';
|
|
|
2
2
|
declare const _default: import("vue").DefineComponent<{
|
|
3
3
|
id: {
|
|
4
4
|
type: StringConstructor;
|
|
5
|
-
default: () =>
|
|
5
|
+
default: () => null;
|
|
6
6
|
};
|
|
7
7
|
value: {
|
|
8
8
|
type: (BooleanConstructor | NumberConstructor | StringConstructor)[];
|
|
@@ -50,6 +50,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
50
50
|
default: undefined;
|
|
51
51
|
};
|
|
52
52
|
}, {
|
|
53
|
+
inputId: import("vue").Ref<string>;
|
|
53
54
|
ui: import("vue").ComputedRef<any>;
|
|
54
55
|
attrs: import("vue").ComputedRef<Pick<{
|
|
55
56
|
[x: string]: unknown;
|
|
@@ -60,7 +61,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
60
61
|
}, 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<{
|
|
61
62
|
id: {
|
|
62
63
|
type: StringConstructor;
|
|
63
|
-
default: () =>
|
|
64
|
+
default: () => null;
|
|
64
65
|
};
|
|
65
66
|
value: {
|
|
66
67
|
type: (BooleanConstructor | NumberConstructor | StringConstructor)[];
|
|
@@ -111,12 +112,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
111
112
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
112
113
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
113
114
|
}, {
|
|
115
|
+
ui: Partial<any>;
|
|
116
|
+
value: string | number | boolean;
|
|
114
117
|
id: string;
|
|
115
118
|
color: any;
|
|
116
|
-
ui: Partial<any>;
|
|
117
119
|
name: string;
|
|
118
120
|
class: any;
|
|
119
|
-
value: string | number | boolean;
|
|
120
121
|
label: string;
|
|
121
122
|
modelValue: string | number | boolean | Record<string, any>;
|
|
122
123
|
disabled: boolean;
|
|
@@ -92,7 +92,7 @@ export default defineComponent({
|
|
|
92
92
|
setup(props, { emit }) {
|
|
93
93
|
const { ui, attrs } = useUI("radioGroup", toRef(props, "ui"), config, toRef(props, "class"));
|
|
94
94
|
const { ui: uiRadio } = useUI("radio", toRef(props, "uiRadio"), configRadio);
|
|
95
|
-
const { emitFormChange, color, name } = useFormGroup(props, config);
|
|
95
|
+
const { emitFormChange, color, name } = useFormGroup({ ...props, isFieldset: true }, config);
|
|
96
96
|
provide("radio-group", { color, name });
|
|
97
97
|
const onUpdate = (value) => {
|
|
98
98
|
emit("update:modelValue", value);
|
|
@@ -103,8 +103,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
103
103
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
104
104
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
105
105
|
}, {
|
|
106
|
-
color: any;
|
|
107
106
|
ui: Partial<any>;
|
|
107
|
+
color: any;
|
|
108
108
|
options: unknown[];
|
|
109
109
|
name: string;
|
|
110
110
|
class: any;
|