@nuxt/ui 2.8.1 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +2 -2
- 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 +64 -55
- 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,14 +1,17 @@
|
|
|
1
|
-
/// <reference types="lodash" />
|
|
2
1
|
import type { PropType } from 'vue';
|
|
3
2
|
declare const _default: import("vue").DefineComponent<{
|
|
4
3
|
modelValue: {
|
|
5
|
-
type: (
|
|
4
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
6
5
|
default: string;
|
|
7
6
|
};
|
|
8
7
|
type: {
|
|
9
8
|
type: StringConstructor;
|
|
10
9
|
default: string;
|
|
11
10
|
};
|
|
11
|
+
id: {
|
|
12
|
+
type: StringConstructor;
|
|
13
|
+
default: null;
|
|
14
|
+
};
|
|
12
15
|
name: {
|
|
13
16
|
type: StringConstructor;
|
|
14
17
|
default: null;
|
|
@@ -62,17 +65,17 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
62
65
|
default: boolean;
|
|
63
66
|
};
|
|
64
67
|
size: {
|
|
65
|
-
type:
|
|
66
|
-
default:
|
|
68
|
+
type: PropType<string | number | symbol>;
|
|
69
|
+
default: null;
|
|
67
70
|
validator(value: string): boolean;
|
|
68
71
|
};
|
|
69
72
|
color: {
|
|
70
|
-
type:
|
|
73
|
+
type: PropType<any>;
|
|
71
74
|
default: () => any;
|
|
72
75
|
validator(value: string): boolean;
|
|
73
76
|
};
|
|
74
77
|
variant: {
|
|
75
|
-
type:
|
|
78
|
+
type: PropType<any>;
|
|
76
79
|
default: () => any;
|
|
77
80
|
validator(value: string): boolean;
|
|
78
81
|
};
|
|
@@ -80,19 +83,24 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
80
83
|
type: StringConstructor;
|
|
81
84
|
default: null;
|
|
82
85
|
};
|
|
83
|
-
|
|
86
|
+
class: {
|
|
84
87
|
type: PropType<any>;
|
|
85
|
-
default:
|
|
88
|
+
default: undefined;
|
|
89
|
+
};
|
|
90
|
+
ui: {
|
|
91
|
+
type: PropType<Partial<any>>;
|
|
92
|
+
default: undefined;
|
|
86
93
|
};
|
|
87
94
|
}, {
|
|
88
|
-
attrs: import("lodash").Omit<{
|
|
89
|
-
[x: string]: unknown;
|
|
90
|
-
}, "class">;
|
|
91
95
|
ui: import("vue").ComputedRef<any>;
|
|
96
|
+
attrs: import("vue").ComputedRef<Pick<{
|
|
97
|
+
[x: string]: unknown;
|
|
98
|
+
}, string>>;
|
|
99
|
+
name: import("vue").ComputedRef<any>;
|
|
100
|
+
inputId: import("vue").ComputedRef<any>;
|
|
92
101
|
input: import("vue").Ref<HTMLInputElement | null>;
|
|
93
102
|
isLeading: import("vue").ComputedRef<string | true>;
|
|
94
103
|
isTrailing: import("vue").ComputedRef<string | true>;
|
|
95
|
-
wrapperClass: import("vue").ComputedRef<string>;
|
|
96
104
|
inputClass: import("vue").ComputedRef<string>;
|
|
97
105
|
leadingIconName: import("vue").ComputedRef<string | undefined>;
|
|
98
106
|
leadingIconClass: import("vue").ComputedRef<string>;
|
|
@@ -104,13 +112,17 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
104
112
|
onBlur: (event: FocusEvent) => void;
|
|
105
113
|
}, 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<{
|
|
106
114
|
modelValue: {
|
|
107
|
-
type: (
|
|
115
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
108
116
|
default: string;
|
|
109
117
|
};
|
|
110
118
|
type: {
|
|
111
119
|
type: StringConstructor;
|
|
112
120
|
default: string;
|
|
113
121
|
};
|
|
122
|
+
id: {
|
|
123
|
+
type: StringConstructor;
|
|
124
|
+
default: null;
|
|
125
|
+
};
|
|
114
126
|
name: {
|
|
115
127
|
type: StringConstructor;
|
|
116
128
|
default: null;
|
|
@@ -164,17 +176,17 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
164
176
|
default: boolean;
|
|
165
177
|
};
|
|
166
178
|
size: {
|
|
167
|
-
type:
|
|
168
|
-
default:
|
|
179
|
+
type: PropType<string | number | symbol>;
|
|
180
|
+
default: null;
|
|
169
181
|
validator(value: string): boolean;
|
|
170
182
|
};
|
|
171
183
|
color: {
|
|
172
|
-
type:
|
|
184
|
+
type: PropType<any>;
|
|
173
185
|
default: () => any;
|
|
174
186
|
validator(value: string): boolean;
|
|
175
187
|
};
|
|
176
188
|
variant: {
|
|
177
|
-
type:
|
|
189
|
+
type: PropType<any>;
|
|
178
190
|
default: () => any;
|
|
179
191
|
validator(value: string): boolean;
|
|
180
192
|
};
|
|
@@ -182,25 +194,31 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
182
194
|
type: StringConstructor;
|
|
183
195
|
default: null;
|
|
184
196
|
};
|
|
185
|
-
|
|
197
|
+
class: {
|
|
186
198
|
type: PropType<any>;
|
|
187
|
-
default:
|
|
199
|
+
default: undefined;
|
|
200
|
+
};
|
|
201
|
+
ui: {
|
|
202
|
+
type: PropType<Partial<any>>;
|
|
203
|
+
default: undefined;
|
|
188
204
|
};
|
|
189
205
|
}>> & {
|
|
190
206
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
191
207
|
onBlur?: ((...args: any[]) => any) | undefined;
|
|
192
208
|
}, {
|
|
209
|
+
id: string;
|
|
193
210
|
icon: string;
|
|
194
|
-
color:
|
|
195
|
-
ui: any
|
|
211
|
+
color: any;
|
|
212
|
+
ui: Partial<any>;
|
|
196
213
|
name: string;
|
|
214
|
+
class: any;
|
|
197
215
|
type: string;
|
|
198
216
|
modelValue: string | number;
|
|
199
217
|
loading: boolean;
|
|
200
218
|
disabled: boolean;
|
|
201
|
-
variant:
|
|
219
|
+
variant: any;
|
|
202
220
|
required: boolean;
|
|
203
|
-
size: string;
|
|
221
|
+
size: string | number | symbol;
|
|
204
222
|
placeholder: string;
|
|
205
223
|
padded: boolean;
|
|
206
224
|
loadingIcon: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="
|
|
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"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
>
|
|
16
16
|
</div>
|
|
17
17
|
<div v-if="label || $slots.label" class="ms-3 text-sm">
|
|
18
|
-
<label :for="
|
|
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,16 +27,23 @@
|
|
|
27
27
|
</template>
|
|
28
28
|
|
|
29
29
|
<script>
|
|
30
|
-
import { computed, defineComponent } from "vue";
|
|
31
|
-
import { omit } from "lodash-es";
|
|
30
|
+
import { computed, toRef, defineComponent } from "vue";
|
|
32
31
|
import { twMerge, twJoin } from "tailwind-merge";
|
|
33
|
-
import {
|
|
32
|
+
import { useUI } from "../../composables/useUI";
|
|
34
33
|
import { useFormGroup } from "../../composables/useFormGroup";
|
|
35
|
-
import {
|
|
34
|
+
import { mergeConfig } from "../../utils";
|
|
36
35
|
import appConfig from "#build/app.config";
|
|
36
|
+
import { radio } from "#ui/ui.config";
|
|
37
|
+
import { uid } from "../../utils/uid";
|
|
38
|
+
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.radio, radio);
|
|
37
39
|
export default defineComponent({
|
|
38
40
|
inheritAttrs: false,
|
|
39
41
|
props: {
|
|
42
|
+
id: {
|
|
43
|
+
type: String,
|
|
44
|
+
// A default value is needed here to bind the label
|
|
45
|
+
default: () => uid()
|
|
46
|
+
},
|
|
40
47
|
value: {
|
|
41
48
|
type: [String, Number, Boolean],
|
|
42
49
|
default: null
|
|
@@ -67,7 +74,7 @@ export default defineComponent({
|
|
|
67
74
|
},
|
|
68
75
|
color: {
|
|
69
76
|
type: String,
|
|
70
|
-
default: () =>
|
|
77
|
+
default: () => config.default.color,
|
|
71
78
|
validator(value) {
|
|
72
79
|
return appConfig.ui.colors.includes(value);
|
|
73
80
|
}
|
|
@@ -76,17 +83,19 @@ export default defineComponent({
|
|
|
76
83
|
type: String,
|
|
77
84
|
default: null
|
|
78
85
|
},
|
|
86
|
+
class: {
|
|
87
|
+
type: [String, Object, Array],
|
|
88
|
+
default: void 0
|
|
89
|
+
},
|
|
79
90
|
ui: {
|
|
80
91
|
type: Object,
|
|
81
|
-
default:
|
|
92
|
+
default: void 0
|
|
82
93
|
}
|
|
83
94
|
},
|
|
84
95
|
emits: ["update:modelValue"],
|
|
85
|
-
setup(props, { emit
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
const { emitFormChange, formGroup } = useFormGroup();
|
|
89
|
-
const color = computed(() => formGroup?.error?.value ? "red" : props.color);
|
|
96
|
+
setup(props, { emit }) {
|
|
97
|
+
const { ui, attrs } = useUI("radio", toRef(props, "ui"), config, toRef(props, "class"));
|
|
98
|
+
const { emitFormChange, color, name, inputId } = useFormGroup(props);
|
|
90
99
|
const pick = computed({
|
|
91
100
|
get() {
|
|
92
101
|
return props.modelValue;
|
|
@@ -98,7 +107,6 @@ export default defineComponent({
|
|
|
98
107
|
}
|
|
99
108
|
}
|
|
100
109
|
});
|
|
101
|
-
const wrapperClass = computed(() => twMerge(ui.value.wrapper, attrs.class));
|
|
102
110
|
const inputClass = computed(() => {
|
|
103
111
|
return twMerge(twJoin(
|
|
104
112
|
ui.value.base,
|
|
@@ -109,11 +117,13 @@ export default defineComponent({
|
|
|
109
117
|
), props.inputClass);
|
|
110
118
|
});
|
|
111
119
|
return {
|
|
112
|
-
attrs: omit(attrs, ["class"]),
|
|
113
120
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
114
121
|
ui,
|
|
122
|
+
inputId,
|
|
123
|
+
attrs,
|
|
115
124
|
pick,
|
|
116
|
-
|
|
125
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
126
|
+
name,
|
|
117
127
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
118
128
|
inputClass
|
|
119
129
|
};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
/// <reference types="lodash" />
|
|
2
1
|
import type { PropType } from 'vue';
|
|
3
2
|
declare const _default: import("vue").DefineComponent<{
|
|
3
|
+
id: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
default: () => string;
|
|
6
|
+
};
|
|
4
7
|
value: {
|
|
5
|
-
type: (BooleanConstructor |
|
|
8
|
+
type: (BooleanConstructor | NumberConstructor | StringConstructor)[];
|
|
6
9
|
default: null;
|
|
7
10
|
};
|
|
8
11
|
modelValue: {
|
|
9
|
-
type: (ObjectConstructor | BooleanConstructor |
|
|
12
|
+
type: (ObjectConstructor | BooleanConstructor | NumberConstructor | StringConstructor)[];
|
|
10
13
|
default: null;
|
|
11
14
|
};
|
|
12
15
|
name: {
|
|
@@ -30,7 +33,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
30
33
|
default: boolean;
|
|
31
34
|
};
|
|
32
35
|
color: {
|
|
33
|
-
type:
|
|
36
|
+
type: PropType<any>;
|
|
34
37
|
default: () => any;
|
|
35
38
|
validator(value: string): any;
|
|
36
39
|
};
|
|
@@ -38,25 +41,34 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
38
41
|
type: StringConstructor;
|
|
39
42
|
default: null;
|
|
40
43
|
};
|
|
41
|
-
|
|
44
|
+
class: {
|
|
42
45
|
type: PropType<any>;
|
|
43
|
-
default:
|
|
46
|
+
default: undefined;
|
|
47
|
+
};
|
|
48
|
+
ui: {
|
|
49
|
+
type: PropType<Partial<any>>;
|
|
50
|
+
default: undefined;
|
|
44
51
|
};
|
|
45
52
|
}, {
|
|
46
|
-
attrs: import("lodash").Omit<{
|
|
47
|
-
[x: string]: unknown;
|
|
48
|
-
}, "class">;
|
|
49
53
|
ui: import("vue").ComputedRef<any>;
|
|
54
|
+
inputId: import("vue").ComputedRef<any>;
|
|
55
|
+
attrs: import("vue").ComputedRef<Pick<{
|
|
56
|
+
[x: string]: unknown;
|
|
57
|
+
}, string>>;
|
|
50
58
|
pick: import("vue").WritableComputedRef<string | number | boolean | Record<string, any>>;
|
|
51
|
-
|
|
59
|
+
name: import("vue").ComputedRef<any>;
|
|
52
60
|
inputClass: import("vue").ComputedRef<string>;
|
|
53
61
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
62
|
+
id: {
|
|
63
|
+
type: StringConstructor;
|
|
64
|
+
default: () => string;
|
|
65
|
+
};
|
|
54
66
|
value: {
|
|
55
|
-
type: (BooleanConstructor |
|
|
67
|
+
type: (BooleanConstructor | NumberConstructor | StringConstructor)[];
|
|
56
68
|
default: null;
|
|
57
69
|
};
|
|
58
70
|
modelValue: {
|
|
59
|
-
type: (ObjectConstructor | BooleanConstructor |
|
|
71
|
+
type: (ObjectConstructor | BooleanConstructor | NumberConstructor | StringConstructor)[];
|
|
60
72
|
default: null;
|
|
61
73
|
};
|
|
62
74
|
name: {
|
|
@@ -80,7 +92,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
80
92
|
default: boolean;
|
|
81
93
|
};
|
|
82
94
|
color: {
|
|
83
|
-
type:
|
|
95
|
+
type: PropType<any>;
|
|
84
96
|
default: () => any;
|
|
85
97
|
validator(value: string): any;
|
|
86
98
|
};
|
|
@@ -88,16 +100,22 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
88
100
|
type: StringConstructor;
|
|
89
101
|
default: null;
|
|
90
102
|
};
|
|
91
|
-
|
|
103
|
+
class: {
|
|
92
104
|
type: PropType<any>;
|
|
93
|
-
default:
|
|
105
|
+
default: undefined;
|
|
106
|
+
};
|
|
107
|
+
ui: {
|
|
108
|
+
type: PropType<Partial<any>>;
|
|
109
|
+
default: undefined;
|
|
94
110
|
};
|
|
95
111
|
}>> & {
|
|
96
112
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
97
113
|
}, {
|
|
98
|
-
|
|
99
|
-
|
|
114
|
+
id: string;
|
|
115
|
+
color: any;
|
|
116
|
+
ui: Partial<any>;
|
|
100
117
|
name: string;
|
|
118
|
+
class: any;
|
|
101
119
|
value: string | number | boolean;
|
|
102
120
|
label: string;
|
|
103
121
|
modelValue: string | number | boolean | Record<string, any>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="wrapperClass">
|
|
3
3
|
<input
|
|
4
|
+
:id="inputId"
|
|
4
5
|
ref="input"
|
|
5
6
|
v-model.number="value"
|
|
6
7
|
:name="name"
|
|
@@ -19,13 +20,14 @@
|
|
|
19
20
|
</template>
|
|
20
21
|
|
|
21
22
|
<script>
|
|
22
|
-
import { computed, defineComponent } from "vue";
|
|
23
|
-
import { omit } from "lodash-es";
|
|
23
|
+
import { computed, toRef, defineComponent } from "vue";
|
|
24
24
|
import { twMerge, twJoin } from "tailwind-merge";
|
|
25
|
-
import {
|
|
25
|
+
import { useUI } from "../../composables/useUI";
|
|
26
26
|
import { useFormGroup } from "../../composables/useFormGroup";
|
|
27
|
-
import {
|
|
27
|
+
import { mergeConfig } from "../../utils";
|
|
28
28
|
import appConfig from "#build/app.config";
|
|
29
|
+
import { range } from "#ui/ui.config";
|
|
30
|
+
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.range, range);
|
|
29
31
|
export default defineComponent({
|
|
30
32
|
inheritAttrs: false,
|
|
31
33
|
props: {
|
|
@@ -33,6 +35,10 @@ export default defineComponent({
|
|
|
33
35
|
type: Number,
|
|
34
36
|
default: 0
|
|
35
37
|
},
|
|
38
|
+
id: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: null
|
|
41
|
+
},
|
|
36
42
|
name: {
|
|
37
43
|
type: String,
|
|
38
44
|
default: null
|
|
@@ -55,14 +61,14 @@ export default defineComponent({
|
|
|
55
61
|
},
|
|
56
62
|
size: {
|
|
57
63
|
type: String,
|
|
58
|
-
default:
|
|
64
|
+
default: null,
|
|
59
65
|
validator(value) {
|
|
60
|
-
return Object.keys(
|
|
66
|
+
return Object.keys(config.size).includes(value);
|
|
61
67
|
}
|
|
62
68
|
},
|
|
63
69
|
color: {
|
|
64
70
|
type: String,
|
|
65
|
-
default: () =>
|
|
71
|
+
default: () => config.default.color,
|
|
66
72
|
validator(value) {
|
|
67
73
|
return appConfig.ui.colors.includes(value);
|
|
68
74
|
}
|
|
@@ -71,18 +77,19 @@ export default defineComponent({
|
|
|
71
77
|
type: String,
|
|
72
78
|
default: null
|
|
73
79
|
},
|
|
80
|
+
class: {
|
|
81
|
+
type: [String, Object, Array],
|
|
82
|
+
default: void 0
|
|
83
|
+
},
|
|
74
84
|
ui: {
|
|
75
85
|
type: Object,
|
|
76
|
-
default:
|
|
86
|
+
default: void 0
|
|
77
87
|
}
|
|
78
88
|
},
|
|
79
89
|
emits: ["update:modelValue", "change"],
|
|
80
|
-
setup(props, { emit
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
const { emitFormChange, formGroup } = useFormGroup();
|
|
84
|
-
const color = computed(() => formGroup?.error?.value ? "red" : props.color);
|
|
85
|
-
const size = computed(() => formGroup?.size?.value ?? props.size);
|
|
90
|
+
setup(props, { emit }) {
|
|
91
|
+
const { ui, attrs } = useUI("range", toRef(props, "ui"), config);
|
|
92
|
+
const { emitFormChange, inputId, color, size, name } = useFormGroup(props, config);
|
|
86
93
|
const value = computed({
|
|
87
94
|
get() {
|
|
88
95
|
return props.modelValue;
|
|
@@ -99,7 +106,7 @@ export default defineComponent({
|
|
|
99
106
|
return twMerge(twJoin(
|
|
100
107
|
ui.value.wrapper,
|
|
101
108
|
ui.value.size[size.value]
|
|
102
|
-
),
|
|
109
|
+
), props.class);
|
|
103
110
|
});
|
|
104
111
|
const inputClass = computed(() => {
|
|
105
112
|
return twMerge(twJoin(
|
|
@@ -145,9 +152,12 @@ export default defineComponent({
|
|
|
145
152
|
};
|
|
146
153
|
});
|
|
147
154
|
return {
|
|
148
|
-
attrs: omit(attrs, ["class"]),
|
|
149
155
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
150
156
|
ui,
|
|
157
|
+
attrs,
|
|
158
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
159
|
+
name,
|
|
160
|
+
inputId,
|
|
151
161
|
value,
|
|
152
162
|
wrapperClass,
|
|
153
163
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
/// <reference types="lodash" />
|
|
2
1
|
import type { PropType } from 'vue';
|
|
3
2
|
declare const _default: import("vue").DefineComponent<{
|
|
4
3
|
modelValue: {
|
|
5
4
|
type: NumberConstructor;
|
|
6
5
|
default: number;
|
|
7
6
|
};
|
|
7
|
+
id: {
|
|
8
|
+
type: StringConstructor;
|
|
9
|
+
default: null;
|
|
10
|
+
};
|
|
8
11
|
name: {
|
|
9
12
|
type: StringConstructor;
|
|
10
13
|
default: null;
|
|
@@ -26,12 +29,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
26
29
|
default: number;
|
|
27
30
|
};
|
|
28
31
|
size: {
|
|
29
|
-
type:
|
|
30
|
-
default:
|
|
32
|
+
type: PropType<string | number | symbol>;
|
|
33
|
+
default: null;
|
|
31
34
|
validator(value: string): boolean;
|
|
32
35
|
};
|
|
33
36
|
color: {
|
|
34
|
-
type:
|
|
37
|
+
type: PropType<any>;
|
|
35
38
|
default: () => any;
|
|
36
39
|
validator(value: string): any;
|
|
37
40
|
};
|
|
@@ -39,15 +42,21 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
39
42
|
type: StringConstructor;
|
|
40
43
|
default: null;
|
|
41
44
|
};
|
|
42
|
-
|
|
45
|
+
class: {
|
|
43
46
|
type: PropType<any>;
|
|
44
|
-
default:
|
|
47
|
+
default: undefined;
|
|
48
|
+
};
|
|
49
|
+
ui: {
|
|
50
|
+
type: PropType<Partial<any>>;
|
|
51
|
+
default: undefined;
|
|
45
52
|
};
|
|
46
53
|
}, {
|
|
47
|
-
attrs: import("lodash").Omit<{
|
|
48
|
-
[x: string]: unknown;
|
|
49
|
-
}, "class">;
|
|
50
54
|
ui: import("vue").ComputedRef<any>;
|
|
55
|
+
attrs: import("vue").ComputedRef<Pick<{
|
|
56
|
+
[x: string]: unknown;
|
|
57
|
+
}, string>>;
|
|
58
|
+
name: import("vue").ComputedRef<any>;
|
|
59
|
+
inputId: import("vue").ComputedRef<any>;
|
|
51
60
|
value: import("vue").WritableComputedRef<number>;
|
|
52
61
|
wrapperClass: import("vue").ComputedRef<string>;
|
|
53
62
|
inputClass: import("vue").ComputedRef<string>;
|
|
@@ -63,6 +72,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
63
72
|
type: NumberConstructor;
|
|
64
73
|
default: number;
|
|
65
74
|
};
|
|
75
|
+
id: {
|
|
76
|
+
type: StringConstructor;
|
|
77
|
+
default: null;
|
|
78
|
+
};
|
|
66
79
|
name: {
|
|
67
80
|
type: StringConstructor;
|
|
68
81
|
default: null;
|
|
@@ -84,12 +97,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
84
97
|
default: number;
|
|
85
98
|
};
|
|
86
99
|
size: {
|
|
87
|
-
type:
|
|
88
|
-
default:
|
|
100
|
+
type: PropType<string | number | symbol>;
|
|
101
|
+
default: null;
|
|
89
102
|
validator(value: string): boolean;
|
|
90
103
|
};
|
|
91
104
|
color: {
|
|
92
|
-
type:
|
|
105
|
+
type: PropType<any>;
|
|
93
106
|
default: () => any;
|
|
94
107
|
validator(value: string): any;
|
|
95
108
|
};
|
|
@@ -97,20 +110,26 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
97
110
|
type: StringConstructor;
|
|
98
111
|
default: null;
|
|
99
112
|
};
|
|
100
|
-
|
|
113
|
+
class: {
|
|
101
114
|
type: PropType<any>;
|
|
102
|
-
default:
|
|
115
|
+
default: undefined;
|
|
116
|
+
};
|
|
117
|
+
ui: {
|
|
118
|
+
type: PropType<Partial<any>>;
|
|
119
|
+
default: undefined;
|
|
103
120
|
};
|
|
104
121
|
}>> & {
|
|
105
122
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
106
123
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
107
124
|
}, {
|
|
108
|
-
|
|
109
|
-
|
|
125
|
+
id: string;
|
|
126
|
+
color: any;
|
|
127
|
+
ui: Partial<any>;
|
|
110
128
|
name: string;
|
|
129
|
+
class: any;
|
|
111
130
|
modelValue: number;
|
|
112
131
|
disabled: boolean;
|
|
113
|
-
size: string;
|
|
132
|
+
size: string | number | symbol;
|
|
114
133
|
max: number;
|
|
115
134
|
inputClass: string;
|
|
116
135
|
min: number;
|