nuance-ui 0.2.11 → 0.2.14
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/dist/module.json +1 -1
- package/dist/module.mjs +12 -0
- package/dist/runtime/components/app-shell/app-shell.d.vue.ts +8 -0
- package/dist/runtime/components/app-shell/app-shell.vue +9 -5
- package/dist/runtime/components/app-shell/app-shell.vue.d.ts +8 -0
- package/dist/runtime/components/checkbox/checkbox.vue +1 -1
- package/dist/runtime/components/input/number-input.vue +1 -1
- package/dist/runtime/components/input/text-input.vue +4 -1
- package/dist/runtime/components/textarea.d.vue.ts +5 -3
- package/dist/runtime/components/textarea.vue +27 -14
- package/dist/runtime/components/textarea.vue.d.ts +5 -3
- package/dist/runtime/form/checkbox-field.d.vue.ts +38 -0
- package/dist/runtime/form/checkbox-field.vue +68 -0
- package/dist/runtime/form/checkbox-field.vue.d.ts +38 -0
- package/dist/runtime/form/checkbox-group-field.d.vue.ts +35 -0
- package/dist/runtime/form/checkbox-group-field.vue +62 -0
- package/dist/runtime/form/checkbox-group-field.vue.d.ts +35 -0
- package/dist/runtime/form/date-field.d.vue.ts +45 -0
- package/dist/runtime/form/date-field.vue +88 -0
- package/dist/runtime/form/date-field.vue.d.ts +45 -0
- package/dist/runtime/form/date-time-field.d.vue.ts +37 -0
- package/dist/runtime/form/date-time-field.vue +76 -0
- package/dist/runtime/form/date-time-field.vue.d.ts +37 -0
- package/dist/runtime/form/email-field.d.vue.ts +37 -0
- package/dist/runtime/form/email-field.vue +76 -0
- package/dist/runtime/form/email-field.vue.d.ts +37 -0
- package/dist/runtime/form/number-field.d.vue.ts +37 -0
- package/dist/runtime/form/number-field.vue +79 -0
- package/dist/runtime/form/number-field.vue.d.ts +37 -0
- package/dist/runtime/form/password-field.d.vue.ts +37 -0
- package/dist/runtime/form/password-field.vue +76 -0
- package/dist/runtime/form/password-field.vue.d.ts +37 -0
- package/dist/runtime/form/select-field.d.vue.ts +50 -0
- package/dist/runtime/form/select-field.vue +86 -0
- package/dist/runtime/form/select-field.vue.d.ts +50 -0
- package/dist/runtime/form/switch-field.d.vue.ts +33 -0
- package/dist/runtime/form/switch-field.vue +66 -0
- package/dist/runtime/form/switch-field.vue.d.ts +33 -0
- package/dist/runtime/form/switch-group-field.d.vue.ts +35 -0
- package/dist/runtime/form/switch-group-field.vue +62 -0
- package/dist/runtime/form/switch-group-field.vue.d.ts +35 -0
- package/dist/runtime/form/text-field.d.vue.ts +37 -0
- package/dist/runtime/form/text-field.vue +76 -0
- package/dist/runtime/form/text-field.vue.d.ts +37 -0
- package/dist/runtime/form/textarea-field.d.vue.ts +37 -0
- package/dist/runtime/form/textarea-field.vue +75 -0
- package/dist/runtime/form/textarea-field.vue.d.ts +37 -0
- package/dist/runtime/form/time-field.d.vue.ts +37 -0
- package/dist/runtime/form/time-field.vue +84 -0
- package/dist/runtime/form/time-field.vue.d.ts +37 -0
- package/package.json +2 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -35,6 +35,7 @@ const module$1 = defineNuxtModule({
|
|
|
35
35
|
const aliases = {
|
|
36
36
|
composables: resolve("./runtime/composables"),
|
|
37
37
|
components: resolve("./runtime/components"),
|
|
38
|
+
form: resolve("./runtime/form"),
|
|
38
39
|
utils: resolve("./runtime/utils"),
|
|
39
40
|
types: resolve("./runtime/types"),
|
|
40
41
|
modals: resolve("./runtime/modals")
|
|
@@ -70,6 +71,17 @@ const module$1 = defineNuxtModule({
|
|
|
70
71
|
"**/*.module.css"
|
|
71
72
|
]
|
|
72
73
|
});
|
|
74
|
+
addComponentsDir({
|
|
75
|
+
path: aliases.form,
|
|
76
|
+
prefix: options.prefix,
|
|
77
|
+
pathPrefix: false,
|
|
78
|
+
extensions: [".vue"],
|
|
79
|
+
ignore: [
|
|
80
|
+
"**/_*/**",
|
|
81
|
+
"**/types/**",
|
|
82
|
+
"**/*.module.css"
|
|
83
|
+
]
|
|
84
|
+
});
|
|
73
85
|
addImportsDir(aliases.composables);
|
|
74
86
|
addImportsDir(aliases.utils);
|
|
75
87
|
}
|
|
@@ -14,6 +14,14 @@ export interface AppShellProps extends BoxProps {
|
|
|
14
14
|
withBorder?: boolean;
|
|
15
15
|
/** Locale configuration for date-aware features */
|
|
16
16
|
dateConfig?: Partial<DateConfig>;
|
|
17
|
+
/** Hides aside on mount */
|
|
18
|
+
hideAside?: boolean;
|
|
19
|
+
/** Hides navbar on mount */
|
|
20
|
+
hideNavbar?: boolean;
|
|
21
|
+
/** Hides header on mount */
|
|
22
|
+
hideHeader?: boolean;
|
|
23
|
+
/** Hides footer on mount */
|
|
24
|
+
hideFooter?: boolean;
|
|
17
25
|
}
|
|
18
26
|
type __VLS_Props = AppShellProps;
|
|
19
27
|
type __VLS_ModelProps = {
|
|
@@ -12,13 +12,17 @@ const {
|
|
|
12
12
|
layout: { type: String, required: false },
|
|
13
13
|
withBorder: { type: Boolean, required: false },
|
|
14
14
|
dateConfig: { type: Object, required: false },
|
|
15
|
+
hideAside: { type: Boolean, required: false },
|
|
16
|
+
hideNavbar: { type: Boolean, required: false },
|
|
17
|
+
hideHeader: { type: Boolean, required: false },
|
|
18
|
+
hideFooter: { type: Boolean, required: false },
|
|
15
19
|
is: { type: null, required: false },
|
|
16
20
|
mod: { type: [Object, Array, null], required: false }
|
|
17
21
|
});
|
|
18
|
-
const aside = defineModel("aside", { type: Boolean, ...{ default:
|
|
19
|
-
const header = defineModel("header", { type: Boolean, ...{ default:
|
|
20
|
-
const navbar = defineModel("navbar", { type: Boolean, ...{ default:
|
|
21
|
-
const footer = defineModel("footer", { type: Boolean, ...{ default:
|
|
22
|
+
const aside = defineModel("aside", { type: Boolean, ...{ default: (props) => !!props.hideAside } });
|
|
23
|
+
const header = defineModel("header", { type: Boolean, ...{ default: (props) => !!props.hideHeader } });
|
|
24
|
+
const navbar = defineModel("navbar", { type: Boolean, ...{ default: (props) => !!props.hideNavbar } });
|
|
25
|
+
const footer = defineModel("footer", { type: Boolean, ...{ default: (props) => !!props.hideFooter } });
|
|
22
26
|
useProvideAppShell({ aside, footer, header, navbar });
|
|
23
27
|
useProvideDatesConfig(dateConfig);
|
|
24
28
|
const style = useVarsResolver(() => ({
|
|
@@ -38,7 +42,7 @@ const style = useVarsResolver(() => ({
|
|
|
38
42
|
<template>
|
|
39
43
|
<Box
|
|
40
44
|
:is
|
|
41
|
-
:style
|
|
45
|
+
:style='style.root'
|
|
42
46
|
:class='$style.root'
|
|
43
47
|
:mod='[mod, { layout, "with-border": withBorder }]'
|
|
44
48
|
>
|
|
@@ -14,6 +14,14 @@ export interface AppShellProps extends BoxProps {
|
|
|
14
14
|
withBorder?: boolean;
|
|
15
15
|
/** Locale configuration for date-aware features */
|
|
16
16
|
dateConfig?: Partial<DateConfig>;
|
|
17
|
+
/** Hides aside on mount */
|
|
18
|
+
hideAside?: boolean;
|
|
19
|
+
/** Hides navbar on mount */
|
|
20
|
+
hideNavbar?: boolean;
|
|
21
|
+
/** Hides header on mount */
|
|
22
|
+
hideHeader?: boolean;
|
|
23
|
+
/** Hides footer on mount */
|
|
24
|
+
hideFooter?: boolean;
|
|
17
25
|
}
|
|
18
26
|
type __VLS_Props = AppShellProps;
|
|
19
27
|
type __VLS_ModelProps = {
|
|
@@ -32,7 +32,10 @@ defineExpose({
|
|
|
32
32
|
</script>
|
|
33
33
|
|
|
34
34
|
<template>
|
|
35
|
-
<InputWrapper
|
|
35
|
+
<InputWrapper
|
|
36
|
+
v-bind='props'
|
|
37
|
+
:class='[$attrs.class, classes?.wrapper]'
|
|
38
|
+
>
|
|
36
39
|
<BaseInput>
|
|
37
40
|
<template v-if='!!$slots.leftSection || icon' #leftSection>
|
|
38
41
|
<slot name='leftSection'>
|
|
@@ -2,6 +2,8 @@ import type { InputBaseProps, InputWrapperProps } from './input/index.js';
|
|
|
2
2
|
export interface TextareaProps extends InputWrapperProps, InputBaseProps {
|
|
3
3
|
/** Icon displayed in the left section */
|
|
4
4
|
icon?: string;
|
|
5
|
+
/** If set, enables textarea height growing with its content @default false */
|
|
6
|
+
autosize?: boolean;
|
|
5
7
|
}
|
|
6
8
|
type __VLS_Props = TextareaProps;
|
|
7
9
|
type __VLS_ModelProps = {
|
|
@@ -21,11 +23,11 @@ type __VLS_Slots = {} & {
|
|
|
21
23
|
description?: (props: typeof __VLS_33) => any;
|
|
22
24
|
};
|
|
23
25
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
24
|
-
$el: HTMLTextAreaElement | null
|
|
26
|
+
$el: Readonly<import("vue").ShallowRef<HTMLTextAreaElement | null>>;
|
|
25
27
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
26
|
-
"update:modelValue": (value: string
|
|
28
|
+
"update:modelValue": (value: string) => any;
|
|
27
29
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
28
|
-
"onUpdate:modelValue"?: ((value: string
|
|
30
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
29
31
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
32
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
31
33
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { useTextareaAutosize } from "@vueuse/core";
|
|
3
3
|
import { useTemplateRef } from "vue";
|
|
4
4
|
import InputBase from "./input/ui/input-base.vue";
|
|
5
5
|
import InputWrapper from "./input/ui/input-wrapper.vue";
|
|
6
|
-
const {
|
|
6
|
+
const {
|
|
7
|
+
icon,
|
|
8
|
+
autosize = false,
|
|
9
|
+
multiline = true,
|
|
10
|
+
resize,
|
|
11
|
+
...props
|
|
12
|
+
} = defineProps({
|
|
7
13
|
icon: { type: String, required: false },
|
|
14
|
+
autosize: { type: Boolean, required: false },
|
|
8
15
|
error: { type: String, required: false },
|
|
9
16
|
description: { type: String, required: false },
|
|
10
17
|
label: { type: String, required: false },
|
|
@@ -20,21 +27,27 @@ const { icon, ...props } = defineProps({
|
|
|
20
27
|
readonly: { type: Boolean, required: false },
|
|
21
28
|
disabled: { type: Boolean, required: false }
|
|
22
29
|
});
|
|
23
|
-
const model = defineModel({ type: String });
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
30
|
+
const model = defineModel({ type: String, ...{ default: "" } });
|
|
31
|
+
const inputRef = useTemplateRef("input");
|
|
32
|
+
if (autosize) {
|
|
33
|
+
useTextareaAutosize({
|
|
34
|
+
element: inputRef,
|
|
35
|
+
input: model
|
|
36
|
+
});
|
|
37
|
+
}
|
|
30
38
|
defineExpose({
|
|
31
|
-
$el:
|
|
39
|
+
$el: inputRef
|
|
32
40
|
});
|
|
33
41
|
</script>
|
|
34
42
|
|
|
35
43
|
<template>
|
|
36
|
-
<InputWrapper
|
|
37
|
-
|
|
44
|
+
<InputWrapper
|
|
45
|
+
v-bind='props'
|
|
46
|
+
:multiline
|
|
47
|
+
:class='$attrs?.class'
|
|
48
|
+
:resize='autosize ? void 0 : resize'
|
|
49
|
+
>
|
|
50
|
+
<InputBase :classes='{ root: $style.test }'>
|
|
38
51
|
<template v-if='!!$slots.leftSection || icon' #leftSection>
|
|
39
52
|
<slot name='leftSection'>
|
|
40
53
|
<Icon v-if='icon' :name='icon' />
|
|
@@ -49,7 +62,7 @@ defineExpose({
|
|
|
49
62
|
v-model='model'
|
|
50
63
|
:class='[css, $style.textarea]'
|
|
51
64
|
:required='props.required'
|
|
52
|
-
:disabled='props.
|
|
65
|
+
:disabled='props.disabled'
|
|
53
66
|
:readonly='props.readonly'
|
|
54
67
|
/>
|
|
55
68
|
</template>
|
|
@@ -72,5 +85,5 @@ defineExpose({
|
|
|
72
85
|
</template>
|
|
73
86
|
|
|
74
87
|
<style module>
|
|
75
|
-
.textarea{height:auto;scrollbar-width:none;-ms-overflow-style:none}.textarea::-webkit-scrollbar{display:none}
|
|
88
|
+
.textarea{--input-padding-y:var(--input-padding-inline-start);height:auto;line-height:1.2;min-height:rem(62px);scrollbar-width:none;-ms-overflow-style:none}.textarea::-webkit-scrollbar{display:none}
|
|
76
89
|
</style>
|
|
@@ -2,6 +2,8 @@ import type { InputBaseProps, InputWrapperProps } from './input/index.js';
|
|
|
2
2
|
export interface TextareaProps extends InputWrapperProps, InputBaseProps {
|
|
3
3
|
/** Icon displayed in the left section */
|
|
4
4
|
icon?: string;
|
|
5
|
+
/** If set, enables textarea height growing with its content @default false */
|
|
6
|
+
autosize?: boolean;
|
|
5
7
|
}
|
|
6
8
|
type __VLS_Props = TextareaProps;
|
|
7
9
|
type __VLS_ModelProps = {
|
|
@@ -21,11 +23,11 @@ type __VLS_Slots = {} & {
|
|
|
21
23
|
description?: (props: typeof __VLS_33) => any;
|
|
22
24
|
};
|
|
23
25
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
24
|
-
$el: HTMLTextAreaElement | null
|
|
26
|
+
$el: Readonly<import("vue").ShallowRef<HTMLTextAreaElement | null>>;
|
|
25
27
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
26
|
-
"update:modelValue": (value: string
|
|
28
|
+
"update:modelValue": (value: string) => any;
|
|
27
29
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
28
|
-
"onUpdate:modelValue"?: ((value: string
|
|
30
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
29
31
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
32
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
31
33
|
declare const _default: typeof __VLS_export;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { RuleExpression } from 'vee-validate';
|
|
2
|
+
import type { CheckboxProps } from '../components/checkbox/checkbox.vue.js';
|
|
3
|
+
export interface CheckboxFieldProps extends Omit<CheckboxProps, 'error'> {
|
|
4
|
+
/** Field name used by vee-validate */
|
|
5
|
+
name: string;
|
|
6
|
+
/** Validation rules, applied when `controlled: false` or as field-level override */
|
|
7
|
+
rules?: RuleExpression<boolean>;
|
|
8
|
+
/** When to trigger validation @default `'change'` */
|
|
9
|
+
validateOn?: 'change' | 'submit';
|
|
10
|
+
/** Pre-fills the field value @default `false` */
|
|
11
|
+
initialValue?: boolean;
|
|
12
|
+
/** If `false`, disconnects the field from the parent form context @default `true` */
|
|
13
|
+
controlled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare var __VLS_11: {
|
|
16
|
+
class: string;
|
|
17
|
+
indeterminate: boolean;
|
|
18
|
+
}, __VLS_14: {}, __VLS_17: {}, __VLS_20: {
|
|
19
|
+
error: string | undefined;
|
|
20
|
+
};
|
|
21
|
+
type __VLS_Slots = {} & {
|
|
22
|
+
icon?: (props: typeof __VLS_11) => any;
|
|
23
|
+
} & {
|
|
24
|
+
label?: (props: typeof __VLS_14) => any;
|
|
25
|
+
} & {
|
|
26
|
+
description?: (props: typeof __VLS_17) => any;
|
|
27
|
+
} & {
|
|
28
|
+
error?: (props: typeof __VLS_20) => any;
|
|
29
|
+
};
|
|
30
|
+
declare const __VLS_base: import("vue").DefineComponent<CheckboxFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CheckboxFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
31
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
32
|
+
declare const _default: typeof __VLS_export;
|
|
33
|
+
export default _default;
|
|
34
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
35
|
+
new (): {
|
|
36
|
+
$slots: S;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useField } from "vee-validate";
|
|
3
|
+
import Checkbox from "../components/checkbox/checkbox.vue";
|
|
4
|
+
const {
|
|
5
|
+
name,
|
|
6
|
+
rules,
|
|
7
|
+
validateOn = "change",
|
|
8
|
+
initialValue = false,
|
|
9
|
+
controlled = true,
|
|
10
|
+
...props
|
|
11
|
+
} = defineProps({
|
|
12
|
+
name: { type: String, required: true },
|
|
13
|
+
rules: { type: [String, Object, Function, Array], required: false, skipCheck: true },
|
|
14
|
+
validateOn: { type: String, required: false },
|
|
15
|
+
initialValue: { type: Boolean, required: false },
|
|
16
|
+
controlled: { type: Boolean, required: false },
|
|
17
|
+
id: { type: String, required: false },
|
|
18
|
+
color: { type: null, required: false },
|
|
19
|
+
iconColor: { type: null, required: false },
|
|
20
|
+
radius: { type: [String, Number, Object], required: false },
|
|
21
|
+
size: { type: String, required: false },
|
|
22
|
+
value: { type: String, required: false },
|
|
23
|
+
variant: { type: String, required: false },
|
|
24
|
+
label: { type: String, required: false },
|
|
25
|
+
description: { type: String, required: false },
|
|
26
|
+
disabled: { type: Boolean, required: false, skipCheck: true },
|
|
27
|
+
labelPosition: { type: String, required: false },
|
|
28
|
+
bodyElement: { type: null, required: false },
|
|
29
|
+
labelElement: { type: null, required: false },
|
|
30
|
+
is: { type: null, required: false },
|
|
31
|
+
mod: { type: [Object, Array, null], required: false }
|
|
32
|
+
});
|
|
33
|
+
const {
|
|
34
|
+
value,
|
|
35
|
+
errorMessage,
|
|
36
|
+
handleChange
|
|
37
|
+
} = useField(() => name, rules, {
|
|
38
|
+
validateOnValueUpdate: false,
|
|
39
|
+
validateOnMount: false,
|
|
40
|
+
initialValue,
|
|
41
|
+
controlled
|
|
42
|
+
});
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<Checkbox
|
|
47
|
+
v-bind='props'
|
|
48
|
+
:model-value='value'
|
|
49
|
+
:error='errorMessage'
|
|
50
|
+
@update:model-value='handleChange($event, validateOn === "change" || !!errorMessage)'
|
|
51
|
+
>
|
|
52
|
+
<template v-if='$slots.icon' #icon='slotProps'>
|
|
53
|
+
<slot name='icon' v-bind='slotProps' />
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<template v-if='$slots.label' #label>
|
|
57
|
+
<slot name='label' />
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<template v-if='$slots.description' #description>
|
|
61
|
+
<slot name='description' />
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
<template v-if='$slots.error' #error>
|
|
65
|
+
<slot name='error' :error='errorMessage' />
|
|
66
|
+
</template>
|
|
67
|
+
</Checkbox>
|
|
68
|
+
</template>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { RuleExpression } from 'vee-validate';
|
|
2
|
+
import type { CheckboxProps } from '../components/checkbox/checkbox.vue.js';
|
|
3
|
+
export interface CheckboxFieldProps extends Omit<CheckboxProps, 'error'> {
|
|
4
|
+
/** Field name used by vee-validate */
|
|
5
|
+
name: string;
|
|
6
|
+
/** Validation rules, applied when `controlled: false` or as field-level override */
|
|
7
|
+
rules?: RuleExpression<boolean>;
|
|
8
|
+
/** When to trigger validation @default `'change'` */
|
|
9
|
+
validateOn?: 'change' | 'submit';
|
|
10
|
+
/** Pre-fills the field value @default `false` */
|
|
11
|
+
initialValue?: boolean;
|
|
12
|
+
/** If `false`, disconnects the field from the parent form context @default `true` */
|
|
13
|
+
controlled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare var __VLS_11: {
|
|
16
|
+
class: string;
|
|
17
|
+
indeterminate: boolean;
|
|
18
|
+
}, __VLS_14: {}, __VLS_17: {}, __VLS_20: {
|
|
19
|
+
error: string | undefined;
|
|
20
|
+
};
|
|
21
|
+
type __VLS_Slots = {} & {
|
|
22
|
+
icon?: (props: typeof __VLS_11) => any;
|
|
23
|
+
} & {
|
|
24
|
+
label?: (props: typeof __VLS_14) => any;
|
|
25
|
+
} & {
|
|
26
|
+
description?: (props: typeof __VLS_17) => any;
|
|
27
|
+
} & {
|
|
28
|
+
error?: (props: typeof __VLS_20) => any;
|
|
29
|
+
};
|
|
30
|
+
declare const __VLS_base: import("vue").DefineComponent<CheckboxFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CheckboxFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
31
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
32
|
+
declare const _default: typeof __VLS_export;
|
|
33
|
+
export default _default;
|
|
34
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
35
|
+
new (): {
|
|
36
|
+
$slots: S;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { RuleExpression } from 'vee-validate';
|
|
2
|
+
import type { CheckboxGroupProps } from '../components/checkbox/checkbox-group.vue.js';
|
|
3
|
+
export interface CheckboxGroupFieldProps extends Omit<CheckboxGroupProps, 'error'> {
|
|
4
|
+
/** Field name used by vee-validate */
|
|
5
|
+
name: string;
|
|
6
|
+
/** Validation rules, applied when `controlled: false` or as field-level override */
|
|
7
|
+
rules?: RuleExpression<string[]>;
|
|
8
|
+
/** When to trigger validation @default `'change'` */
|
|
9
|
+
validateOn?: 'change' | 'submit';
|
|
10
|
+
/** Pre-fills the field value */
|
|
11
|
+
initialValue?: string[];
|
|
12
|
+
/** If `false`, disconnects the field from the parent form context @default `true` */
|
|
13
|
+
controlled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare var __VLS_10: {}, __VLS_13: {}, __VLS_16: {}, __VLS_19: {
|
|
16
|
+
error: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
type __VLS_Slots = {} & {
|
|
19
|
+
default?: (props: typeof __VLS_10) => any;
|
|
20
|
+
} & {
|
|
21
|
+
label?: (props: typeof __VLS_13) => any;
|
|
22
|
+
} & {
|
|
23
|
+
description?: (props: typeof __VLS_16) => any;
|
|
24
|
+
} & {
|
|
25
|
+
error?: (props: typeof __VLS_19) => any;
|
|
26
|
+
};
|
|
27
|
+
declare const __VLS_base: import("vue").DefineComponent<CheckboxGroupFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CheckboxGroupFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
29
|
+
declare const _default: typeof __VLS_export;
|
|
30
|
+
export default _default;
|
|
31
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
32
|
+
new (): {
|
|
33
|
+
$slots: S;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useField } from "vee-validate";
|
|
3
|
+
import CheckboxGroup from "../components/checkbox/checkbox-group.vue";
|
|
4
|
+
const {
|
|
5
|
+
name,
|
|
6
|
+
rules,
|
|
7
|
+
validateOn = "change",
|
|
8
|
+
initialValue,
|
|
9
|
+
controlled = true,
|
|
10
|
+
...props
|
|
11
|
+
} = defineProps({
|
|
12
|
+
name: { type: String, required: true },
|
|
13
|
+
rules: { type: [String, Object, Function, Array], required: false, skipCheck: true },
|
|
14
|
+
validateOn: { type: String, required: false },
|
|
15
|
+
initialValue: { type: Array, required: false },
|
|
16
|
+
controlled: { type: Boolean, required: false },
|
|
17
|
+
size: { type: String, required: false },
|
|
18
|
+
readOnly: { type: Boolean, required: false },
|
|
19
|
+
disabled: { type: Boolean, required: false },
|
|
20
|
+
maxSelectedValues: { type: Number, required: false },
|
|
21
|
+
description: { type: String, required: false },
|
|
22
|
+
label: { type: String, required: false },
|
|
23
|
+
required: { type: Boolean, required: false },
|
|
24
|
+
radius: { type: [String, Number, Object], required: false },
|
|
25
|
+
variant: { type: String, required: false },
|
|
26
|
+
leftSectionPE: { type: void 0, required: false },
|
|
27
|
+
rightSectionPE: { type: void 0, required: false }
|
|
28
|
+
});
|
|
29
|
+
const {
|
|
30
|
+
value,
|
|
31
|
+
errorMessage,
|
|
32
|
+
handleChange
|
|
33
|
+
} = useField(() => name, rules, {
|
|
34
|
+
validateOnValueUpdate: false,
|
|
35
|
+
validateOnMount: false,
|
|
36
|
+
initialValue,
|
|
37
|
+
controlled
|
|
38
|
+
});
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<template>
|
|
42
|
+
<CheckboxGroup
|
|
43
|
+
v-bind='props'
|
|
44
|
+
:model-value='value ?? []'
|
|
45
|
+
:error='errorMessage'
|
|
46
|
+
@update:model-value='handleChange($event, validateOn === "change" || !!errorMessage)'
|
|
47
|
+
>
|
|
48
|
+
<slot />
|
|
49
|
+
|
|
50
|
+
<template v-if='$slots.label' #label>
|
|
51
|
+
<slot name='label' />
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<template v-if='$slots.description' #description>
|
|
55
|
+
<slot name='description' />
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<template v-if='$slots.error' #error>
|
|
59
|
+
<slot name='error' :error='errorMessage' />
|
|
60
|
+
</template>
|
|
61
|
+
</CheckboxGroup>
|
|
62
|
+
</template>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { RuleExpression } from 'vee-validate';
|
|
2
|
+
import type { CheckboxGroupProps } from '../components/checkbox/checkbox-group.vue.js';
|
|
3
|
+
export interface CheckboxGroupFieldProps extends Omit<CheckboxGroupProps, 'error'> {
|
|
4
|
+
/** Field name used by vee-validate */
|
|
5
|
+
name: string;
|
|
6
|
+
/** Validation rules, applied when `controlled: false` or as field-level override */
|
|
7
|
+
rules?: RuleExpression<string[]>;
|
|
8
|
+
/** When to trigger validation @default `'change'` */
|
|
9
|
+
validateOn?: 'change' | 'submit';
|
|
10
|
+
/** Pre-fills the field value */
|
|
11
|
+
initialValue?: string[];
|
|
12
|
+
/** If `false`, disconnects the field from the parent form context @default `true` */
|
|
13
|
+
controlled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare var __VLS_10: {}, __VLS_13: {}, __VLS_16: {}, __VLS_19: {
|
|
16
|
+
error: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
type __VLS_Slots = {} & {
|
|
19
|
+
default?: (props: typeof __VLS_10) => any;
|
|
20
|
+
} & {
|
|
21
|
+
label?: (props: typeof __VLS_13) => any;
|
|
22
|
+
} & {
|
|
23
|
+
description?: (props: typeof __VLS_16) => any;
|
|
24
|
+
} & {
|
|
25
|
+
error?: (props: typeof __VLS_19) => any;
|
|
26
|
+
};
|
|
27
|
+
declare const __VLS_base: import("vue").DefineComponent<CheckboxGroupFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CheckboxGroupFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
29
|
+
declare const _default: typeof __VLS_export;
|
|
30
|
+
export default _default;
|
|
31
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
32
|
+
new (): {
|
|
33
|
+
$slots: S;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { RuleExpression } from 'vee-validate';
|
|
2
|
+
import type { DateSelection, SelectionMode } from '../components/calendar/index.js';
|
|
3
|
+
import type { DatePickerProps } from '../components/input/date-picker.vue.js';
|
|
4
|
+
export interface DateFieldProps<Mode extends SelectionMode = 'single'> extends Omit<DatePickerProps<Mode>, 'error'> {
|
|
5
|
+
/** Field name used by vee-validate */
|
|
6
|
+
name: string;
|
|
7
|
+
/** Validation rules, applied when `controlled: false` or as field-level override */
|
|
8
|
+
rules?: RuleExpression<DateSelection<Mode>>;
|
|
9
|
+
/** When to trigger validation @default `'change'` */
|
|
10
|
+
validateOn?: 'change' | 'submit';
|
|
11
|
+
/** Pre-fills the field value */
|
|
12
|
+
initialValue?: DateSelection<Mode>;
|
|
13
|
+
/** If `false`, disconnects the field from the parent form context @default `true` */
|
|
14
|
+
controlled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare const __VLS_export: <Mode extends SelectionMode = "single">(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
17
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<DateFieldProps<Mode>> & (typeof globalThis extends {
|
|
18
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
19
|
+
} ? P : {});
|
|
20
|
+
expose: (exposed: {}) => void;
|
|
21
|
+
attrs: any;
|
|
22
|
+
slots: {
|
|
23
|
+
leftSection?: (props: {}) => any;
|
|
24
|
+
} & {
|
|
25
|
+
rightSection?: (props: {}) => any;
|
|
26
|
+
} & {
|
|
27
|
+
label?: (props: {}) => any;
|
|
28
|
+
} & {
|
|
29
|
+
description?: (props: {}) => any;
|
|
30
|
+
} & {
|
|
31
|
+
error?: (props: {
|
|
32
|
+
error: string | undefined;
|
|
33
|
+
}) => any;
|
|
34
|
+
};
|
|
35
|
+
emit: {};
|
|
36
|
+
}>) => import("vue").VNode & {
|
|
37
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
38
|
+
};
|
|
39
|
+
declare const _default: typeof __VLS_export;
|
|
40
|
+
export default _default;
|
|
41
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
42
|
+
[K in keyof T]: T[K];
|
|
43
|
+
} : {
|
|
44
|
+
[K in keyof T as K]: T[K];
|
|
45
|
+
}) & {};
|