nuance-ui 0.2.11 → 0.2.12

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.
Files changed (35) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +12 -0
  3. package/dist/runtime/components/input/number-input.vue +1 -1
  4. package/dist/runtime/components/input/text-input.vue +4 -1
  5. package/dist/runtime/components/textarea.d.vue.ts +5 -3
  6. package/dist/runtime/components/textarea.vue +27 -14
  7. package/dist/runtime/components/textarea.vue.d.ts +5 -3
  8. package/dist/runtime/form/date-field.d.vue.ts +45 -0
  9. package/dist/runtime/form/date-field.vue +88 -0
  10. package/dist/runtime/form/date-field.vue.d.ts +45 -0
  11. package/dist/runtime/form/date-time-field.d.vue.ts +37 -0
  12. package/dist/runtime/form/date-time-field.vue +76 -0
  13. package/dist/runtime/form/date-time-field.vue.d.ts +37 -0
  14. package/dist/runtime/form/email-field.d.vue.ts +37 -0
  15. package/dist/runtime/form/email-field.vue +76 -0
  16. package/dist/runtime/form/email-field.vue.d.ts +37 -0
  17. package/dist/runtime/form/number-field.d.vue.ts +37 -0
  18. package/dist/runtime/form/number-field.vue +79 -0
  19. package/dist/runtime/form/number-field.vue.d.ts +37 -0
  20. package/dist/runtime/form/password-field.d.vue.ts +37 -0
  21. package/dist/runtime/form/password-field.vue +76 -0
  22. package/dist/runtime/form/password-field.vue.d.ts +37 -0
  23. package/dist/runtime/form/select-field.d.vue.ts +50 -0
  24. package/dist/runtime/form/select-field.vue +86 -0
  25. package/dist/runtime/form/select-field.vue.d.ts +50 -0
  26. package/dist/runtime/form/text-field.d.vue.ts +37 -0
  27. package/dist/runtime/form/text-field.vue +76 -0
  28. package/dist/runtime/form/text-field.vue.d.ts +37 -0
  29. package/dist/runtime/form/textarea-field.d.vue.ts +37 -0
  30. package/dist/runtime/form/textarea-field.vue +75 -0
  31. package/dist/runtime/form/textarea-field.vue.d.ts +37 -0
  32. package/dist/runtime/form/time-field.d.vue.ts +37 -0
  33. package/dist/runtime/form/time-field.vue +84 -0
  34. package/dist/runtime/form/time-field.vue.d.ts +37 -0
  35. package/package.json +11 -2
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^4.0.0"
6
6
  },
7
- "version": "0.2.11",
7
+ "version": "0.2.12",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
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
  }
@@ -61,7 +61,7 @@ function handleBlur() {
61
61
  <input
62
62
  :id
63
63
  v-model='value'
64
- :class='css'
64
+ v-bind='{ ...$attrs, class: css }'
65
65
  :min
66
66
  :max
67
67
  :step
@@ -32,7 +32,10 @@ defineExpose({
32
32
  </script>
33
33
 
34
34
  <template>
35
- <InputWrapper v-bind='props' :class='[$attrs.class, classes?.wrapper]'>
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 | undefined;
26
+ $el: Readonly<import("vue").ShallowRef<HTMLTextAreaElement | null>>;
25
27
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
26
- "update:modelValue": (value: string | undefined) => any;
28
+ "update:modelValue": (value: string) => any;
27
29
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
28
- "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
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 { unrefElement, useTextareaAutosize } from "@vueuse/core";
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 { icon, ...props } = defineProps({
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 ref = useTemplateRef("input");
25
- const { input } = useTextareaAutosize({
26
- input: model.value,
27
- styleProp: "minHeight",
28
- element: unrefElement(ref.value)
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: unrefElement(ref.value)
39
+ $el: inputRef
32
40
  });
33
41
  </script>
34
42
 
35
43
  <template>
36
- <InputWrapper v-bind='props' :multiline :class='$attrs?.class'>
37
- <InputBase>
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.required'
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 | undefined;
26
+ $el: Readonly<import("vue").ShallowRef<HTMLTextAreaElement | null>>;
25
27
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
26
- "update:modelValue": (value: string | undefined) => any;
28
+ "update:modelValue": (value: string) => any;
27
29
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
28
- "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
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,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
+ }) & {};
@@ -0,0 +1,88 @@
1
+ <script setup>
2
+ import { useField } from "vee-validate";
3
+ import DatePicker from "../components/input/date-picker.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: null, required: false },
16
+ controlled: { type: Boolean, required: false },
17
+ valueFormat: { type: [String, Object], required: false },
18
+ size: { type: [String, Object], required: false },
19
+ withWeekNumbers: { type: Boolean, required: false },
20
+ prevDisabled: { type: Function, required: false },
21
+ nextDisabled: { type: Function, required: false },
22
+ minLevel: { type: String, required: false },
23
+ maxLevel: { type: String, required: false },
24
+ withCellSpacing: { type: Boolean, required: false },
25
+ mode: { type: null, required: false },
26
+ numberOfMonths: { type: Number, required: false },
27
+ weekdayFormat: { type: String, required: false },
28
+ fixedWeeks: { type: Boolean, required: false },
29
+ minDate: { type: [Date, String], required: false },
30
+ maxDate: { type: [Date, String], required: false },
31
+ excludeDate: { type: Function, required: false },
32
+ highlightToday: { type: Boolean, required: false },
33
+ hideOutsideDates: { type: Boolean, required: false },
34
+ disabled: { type: Boolean, required: false },
35
+ readonly: { type: Boolean, required: false },
36
+ config: { type: Object, required: false },
37
+ multiline: { type: Boolean, required: false },
38
+ classes: { type: Object, required: false },
39
+ description: { type: String, required: false },
40
+ label: { type: String, required: false },
41
+ required: { type: Boolean, required: false },
42
+ id: { type: [String, null], required: false },
43
+ radius: { type: [String, Number, Object], required: false },
44
+ variant: { type: String, required: false },
45
+ resize: { type: void 0, required: false },
46
+ leftSectionPE: { type: void 0, required: false },
47
+ rightSectionPE: { type: void 0, required: false }
48
+ });
49
+ const {
50
+ value,
51
+ errorMessage,
52
+ handleChange
53
+ } = useField(() => name, rules, {
54
+ validateOnValueUpdate: false,
55
+ validateOnMount: false,
56
+ initialValue,
57
+ controlled
58
+ });
59
+ </script>
60
+
61
+ <template>
62
+ <DatePicker
63
+ v-bind='props'
64
+ :model-value='value'
65
+ :error='errorMessage'
66
+ @update:model-value='handleChange($event, validateOn === "change" || !!errorMessage)'
67
+ >
68
+ <template v-if='$slots.leftSection' #leftSection>
69
+ <slot name='leftSection' />
70
+ </template>
71
+
72
+ <template v-if='$slots.rightSection' #rightSection>
73
+ <slot name='rightSection' />
74
+ </template>
75
+
76
+ <template v-if='$slots.label' #label>
77
+ <slot name='label' />
78
+ </template>
79
+
80
+ <template v-if='$slots.description' #description>
81
+ <slot name='description' />
82
+ </template>
83
+
84
+ <template v-if='$slots.error' #error>
85
+ <slot name='error' :error='errorMessage' />
86
+ </template>
87
+ </DatePicker>
88
+ </template>
@@ -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
+ }) & {};
@@ -0,0 +1,37 @@
1
+ import type { RuleExpression } from 'vee-validate';
2
+ import type { DatePickerProps } from '../components/date-time-picker.vue.js';
3
+ export interface DateTimeFieldProps extends Omit<DatePickerProps, '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 | Date | null>;
8
+ /** When to trigger validation @default `'change'` */
9
+ validateOn?: 'change' | 'submit';
10
+ /** Pre-fills the field value */
11
+ initialValue?: string | Date | null;
12
+ /** If `false`, disconnects the field from the parent form context @default `true` */
13
+ controlled?: boolean;
14
+ }
15
+ declare var __VLS_11: {}, __VLS_14: {}, __VLS_17: {}, __VLS_20: {}, __VLS_23: {
16
+ error: string | undefined;
17
+ };
18
+ type __VLS_Slots = {} & {
19
+ leftSection?: (props: typeof __VLS_11) => any;
20
+ } & {
21
+ rightSection?: (props: typeof __VLS_14) => any;
22
+ } & {
23
+ label?: (props: typeof __VLS_17) => any;
24
+ } & {
25
+ description?: (props: typeof __VLS_20) => any;
26
+ } & {
27
+ error?: (props: typeof __VLS_23) => any;
28
+ };
29
+ declare const __VLS_base: import("vue").DefineComponent<DateTimeFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DateTimeFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
31
+ declare const _default: typeof __VLS_export;
32
+ export default _default;
33
+ type __VLS_WithSlots<T, S> = T & {
34
+ new (): {
35
+ $slots: S;
36
+ };
37
+ };
@@ -0,0 +1,76 @@
1
+ <script setup>
2
+ import { useField } from "vee-validate";
3
+ import DateTimePicker from "../components/date-time-picker.vue";
4
+ const {
5
+ name,
6
+ rules,
7
+ validateOn = "change",
8
+ initialValue = null,
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: [String, Date, null], required: false },
16
+ controlled: { type: Boolean, required: false },
17
+ format: { type: [String, Object], required: false },
18
+ calendarProps: { type: Object, required: false },
19
+ timePickerProps: { type: Object, required: false },
20
+ clearable: { type: Boolean, required: false },
21
+ multiline: { type: Boolean, required: false },
22
+ classes: { type: Object, required: false },
23
+ description: { type: String, required: false },
24
+ label: { type: String, required: false },
25
+ required: { type: Boolean, required: false },
26
+ id: { type: [String, null], required: false },
27
+ radius: { type: [String, Number, Object], required: false },
28
+ size: { type: [String, Object], required: false },
29
+ variant: { type: String, required: false },
30
+ resize: { type: void 0, required: false },
31
+ leftSectionPE: { type: void 0, required: false },
32
+ rightSectionPE: { type: void 0, required: false },
33
+ readonly: { type: Boolean, required: false },
34
+ disabled: { type: Boolean, required: false },
35
+ withSeconds: { type: Boolean, required: false }
36
+ });
37
+ const {
38
+ value,
39
+ errorMessage,
40
+ handleChange
41
+ } = useField(() => name, rules, {
42
+ validateOnValueUpdate: false,
43
+ validateOnMount: false,
44
+ initialValue,
45
+ controlled
46
+ });
47
+ </script>
48
+
49
+ <template>
50
+ <DateTimePicker
51
+ v-bind='props'
52
+ :model-value='value'
53
+ :error='errorMessage'
54
+ @update:model-value='handleChange($event, validateOn === "change" || !!errorMessage)'
55
+ >
56
+ <template v-if='$slots.leftSection' #leftSection>
57
+ <slot name='leftSection' />
58
+ </template>
59
+
60
+ <template v-if='$slots.rightSection' #rightSection>
61
+ <slot name='rightSection' />
62
+ </template>
63
+
64
+ <template v-if='$slots.label' #label>
65
+ <slot name='label' />
66
+ </template>
67
+
68
+ <template v-if='$slots.description' #description>
69
+ <slot name='description' />
70
+ </template>
71
+
72
+ <template v-if='$slots.error' #error>
73
+ <slot name='error' :error='errorMessage' />
74
+ </template>
75
+ </DateTimePicker>
76
+ </template>
@@ -0,0 +1,37 @@
1
+ import type { RuleExpression } from 'vee-validate';
2
+ import type { DatePickerProps } from '../components/date-time-picker.vue.js';
3
+ export interface DateTimeFieldProps extends Omit<DatePickerProps, '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 | Date | null>;
8
+ /** When to trigger validation @default `'change'` */
9
+ validateOn?: 'change' | 'submit';
10
+ /** Pre-fills the field value */
11
+ initialValue?: string | Date | null;
12
+ /** If `false`, disconnects the field from the parent form context @default `true` */
13
+ controlled?: boolean;
14
+ }
15
+ declare var __VLS_11: {}, __VLS_14: {}, __VLS_17: {}, __VLS_20: {}, __VLS_23: {
16
+ error: string | undefined;
17
+ };
18
+ type __VLS_Slots = {} & {
19
+ leftSection?: (props: typeof __VLS_11) => any;
20
+ } & {
21
+ rightSection?: (props: typeof __VLS_14) => any;
22
+ } & {
23
+ label?: (props: typeof __VLS_17) => any;
24
+ } & {
25
+ description?: (props: typeof __VLS_20) => any;
26
+ } & {
27
+ error?: (props: typeof __VLS_23) => any;
28
+ };
29
+ declare const __VLS_base: import("vue").DefineComponent<DateTimeFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DateTimeFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
31
+ declare const _default: typeof __VLS_export;
32
+ export default _default;
33
+ type __VLS_WithSlots<T, S> = T & {
34
+ new (): {
35
+ $slots: S;
36
+ };
37
+ };
@@ -0,0 +1,37 @@
1
+ import type { RuleExpression } from 'vee-validate';
2
+ import type { TextInputProps } from '../components/input/text-input.vue.js';
3
+ export interface EmailFieldProps extends Omit<TextInputProps, '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 `'blur'` */
9
+ validateOn?: 'blur' | 'submit' | 'change';
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_12: {}, __VLS_15: {}, __VLS_18: {}, __VLS_21: {}, __VLS_24: {
16
+ error: string | undefined;
17
+ };
18
+ type __VLS_Slots = {} & {
19
+ leftSection?: (props: typeof __VLS_12) => any;
20
+ } & {
21
+ rightSection?: (props: typeof __VLS_15) => any;
22
+ } & {
23
+ label?: (props: typeof __VLS_18) => any;
24
+ } & {
25
+ description?: (props: typeof __VLS_21) => any;
26
+ } & {
27
+ error?: (props: typeof __VLS_24) => any;
28
+ };
29
+ declare const __VLS_base: import("vue").DefineComponent<EmailFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<EmailFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
31
+ declare const _default: typeof __VLS_export;
32
+ export default _default;
33
+ type __VLS_WithSlots<T, S> = T & {
34
+ new (): {
35
+ $slots: S;
36
+ };
37
+ };
@@ -0,0 +1,76 @@
1
+ <script setup>
2
+ import { useField } from "vee-validate";
3
+ import EmailInput from "../components/input/email-input.vue";
4
+ const {
5
+ name,
6
+ rules,
7
+ validateOn = "blur",
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: String, required: false },
16
+ controlled: { type: Boolean, required: false },
17
+ multiline: { type: Boolean, required: false },
18
+ withAria: { type: Boolean, required: false },
19
+ classes: { type: Object, required: false },
20
+ icon: { type: String, required: false },
21
+ description: { type: String, required: false },
22
+ label: { type: String, required: false },
23
+ required: { type: Boolean, required: false },
24
+ id: { type: [String, null], required: false },
25
+ radius: { type: [String, Number, Object], required: false },
26
+ size: { type: [String, Object], required: false },
27
+ variant: { type: String, required: false },
28
+ resize: { type: void 0, required: false },
29
+ leftSectionPE: { type: void 0, required: false },
30
+ rightSectionPE: { type: void 0, required: false },
31
+ readonly: { type: Boolean, required: false },
32
+ disabled: { type: Boolean, required: false }
33
+ });
34
+ const {
35
+ value,
36
+ errorMessage,
37
+ handleBlur,
38
+ handleChange
39
+ } = useField(() => name, rules, {
40
+ validateOnValueUpdate: false,
41
+ validateOnMount: false,
42
+ initialValue,
43
+ controlled
44
+ });
45
+ </script>
46
+
47
+ <template>
48
+ <EmailInput
49
+ v-bind='props'
50
+ :model-value='value'
51
+ :error='errorMessage'
52
+ :name
53
+ @update:model-value='handleChange($event, !!errorMessage)'
54
+ @blur='handleBlur($event, validateOn === "blur")'
55
+ >
56
+ <template v-if='$slots.leftSection' #leftSection>
57
+ <slot name='leftSection' />
58
+ </template>
59
+
60
+ <template v-if='$slots.rightSection' #rightSection>
61
+ <slot name='rightSection' />
62
+ </template>
63
+
64
+ <template v-if='$slots.label' #label>
65
+ <slot name='label' />
66
+ </template>
67
+
68
+ <template v-if='$slots.description' #description>
69
+ <slot name='description' />
70
+ </template>
71
+
72
+ <template v-if='$slots.error' #error>
73
+ <slot name='error' :error='errorMessage' />
74
+ </template>
75
+ </EmailInput>
76
+ </template>
@@ -0,0 +1,37 @@
1
+ import type { RuleExpression } from 'vee-validate';
2
+ import type { TextInputProps } from '../components/input/text-input.vue.js';
3
+ export interface EmailFieldProps extends Omit<TextInputProps, '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 `'blur'` */
9
+ validateOn?: 'blur' | 'submit' | 'change';
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_12: {}, __VLS_15: {}, __VLS_18: {}, __VLS_21: {}, __VLS_24: {
16
+ error: string | undefined;
17
+ };
18
+ type __VLS_Slots = {} & {
19
+ leftSection?: (props: typeof __VLS_12) => any;
20
+ } & {
21
+ rightSection?: (props: typeof __VLS_15) => any;
22
+ } & {
23
+ label?: (props: typeof __VLS_18) => any;
24
+ } & {
25
+ description?: (props: typeof __VLS_21) => any;
26
+ } & {
27
+ error?: (props: typeof __VLS_24) => any;
28
+ };
29
+ declare const __VLS_base: import("vue").DefineComponent<EmailFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<EmailFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
31
+ declare const _default: typeof __VLS_export;
32
+ export default _default;
33
+ type __VLS_WithSlots<T, S> = T & {
34
+ new (): {
35
+ $slots: S;
36
+ };
37
+ };