sit-onyx 1.0.0-alpha.64 → 1.0.0-alpha.66

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 (31) hide show
  1. package/dist/components/OnyxCheckbox/OnyxCheckbox.vue.d.ts +3 -1
  2. package/dist/components/OnyxCheckbox/types.d.ts +2 -1
  3. package/dist/components/OnyxCheckboxGroup/OnyxCheckboxGroup.vue.d.ts +3 -3
  4. package/dist/components/OnyxInput/OnyxInput.vue.d.ts +5 -3
  5. package/dist/components/OnyxInput/types.d.ts +2 -1
  6. package/dist/components/OnyxRadioButton/OnyxRadioButton.vue.d.ts +15 -9
  7. package/dist/components/OnyxRadioButton/types.d.ts +2 -2
  8. package/dist/components/OnyxRadioButtonGroup/OnyxRadioButtonGroup.vue.d.ts +12 -9
  9. package/dist/components/OnyxRadioButtonGroup/types.d.ts +2 -5
  10. package/dist/components/OnyxSelect/OnyxSelect.vue.d.ts +6 -6
  11. package/dist/components/OnyxSwitch/OnyxSwitch.vue.d.ts +2 -2
  12. package/dist/components/OnyxSwitch/types.d.ts +3 -6
  13. package/dist/composables/useCustomValidity.d.ts +46 -0
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.js +576 -648
  17. package/dist/style.css +1 -1
  18. package/dist/utils/forms.d.ts +1 -1
  19. package/package.json +2 -2
  20. package/src/styles/density.scss +29 -49
  21. package/src/styles/fonts.scss +30 -27
  22. package/src/styles/grid.scss +55 -53
  23. package/src/styles/index.scss +2 -29
  24. package/src/styles/layers.scss +2 -0
  25. package/src/styles/mixins/density.scss +27 -0
  26. package/src/styles/mixins/layers.scss +11 -0
  27. package/src/styles/mixins/normalize.scss +217 -0
  28. package/src/styles/required.scss +33 -32
  29. package/src/styles/root.scss +30 -0
  30. package/dist/components/TestInput/TestInput.vue.d.ts +0 -80
  31. package/dist/components/TestInput/types.d.ts +0 -5
@@ -9,6 +9,7 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
9
9
  truncation: string;
10
10
  skeleton: boolean;
11
11
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ validityChange: (validity: ValidityState) => void;
12
13
  "update:modelValue": (value: boolean) => void;
13
14
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OnyxCheckboxProps>, {
14
15
  modelValue: boolean;
@@ -20,13 +21,14 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
20
21
  skeleton: boolean;
21
22
  }>>> & {
22
23
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
24
+ onValidityChange?: ((validity: ValidityState) => any) | undefined;
23
25
  }, {
24
26
  required: boolean;
25
27
  disabled: boolean;
26
28
  loading: boolean;
27
29
  skeleton: boolean;
28
- modelValue: boolean;
29
30
  indeterminate: boolean;
31
+ modelValue: boolean;
30
32
  truncation: "ellipsis" | "multiline";
31
33
  }, {}>;
32
34
  export default _default;
@@ -1,8 +1,9 @@
1
1
  import { TruncationType } from '../../types/fonts';
2
+ import { CustomValidityProp } from '../../composables/useCustomValidity';
2
3
  import { RequiredMarkerProp } from '../../composables/required';
3
4
  import { DensityProp } from '../../composables/density';
4
5
 
5
- export type OnyxCheckboxProps = DensityProp & RequiredMarkerProp & {
6
+ export type OnyxCheckboxProps = DensityProp & RequiredMarkerProp & CustomValidityProp & {
6
7
  /**
7
8
  * Whether the checkbox is checked.
8
9
  */
@@ -4,7 +4,7 @@ declare const _default: <TValue extends string | number | boolean>(__VLS_props:
4
4
  skeleton?: number | undefined;
5
5
  modelValue?: TValue[] | undefined;
6
6
  "onUpdate:modelValue"?: ((value: TValue[]) => any) | undefined;
7
- options: import('../../index').CheckboxGroupOption<TValue>[];
7
+ options: import('./types').CheckboxGroupOption<TValue>[];
8
8
  headline?: string | undefined;
9
9
  direction?: "horizontal" | "vertical" | undefined;
10
10
  withCheckAll?: boolean | undefined;
@@ -20,7 +20,7 @@ declare const _default: <TValue extends string | number | boolean>(__VLS_props:
20
20
  skeleton?: number | undefined;
21
21
  modelValue?: TValue[] | undefined;
22
22
  "onUpdate:modelValue"?: ((value: TValue[]) => any) | undefined;
23
- options: import('../../index').CheckboxGroupOption<TValue>[];
23
+ options: import('./types').CheckboxGroupOption<TValue>[];
24
24
  headline?: string | undefined;
25
25
  direction?: "horizontal" | "vertical" | undefined;
26
26
  withCheckAll?: boolean | undefined;
@@ -40,7 +40,7 @@ declare const _default: <TValue extends string | number | boolean>(__VLS_props:
40
40
  skeleton?: number | undefined;
41
41
  modelValue?: TValue[] | undefined;
42
42
  "onUpdate:modelValue"?: ((value: TValue[]) => any) | undefined;
43
- options: import('../../index').CheckboxGroupOption<TValue>[];
43
+ options: import('./types').CheckboxGroupOption<TValue>[];
44
44
  headline?: string | undefined;
45
45
  direction?: "horizontal" | "vertical" | undefined;
46
46
  withCheckAll?: boolean | undefined;
@@ -9,10 +9,11 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
9
9
  disabled: boolean;
10
10
  loading: boolean;
11
11
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ validityChange: (validity: ValidityState) => void;
13
+ blur: () => void;
14
+ focus: () => void;
12
15
  "update:modelValue": (value: string) => void;
13
16
  change: (value: string) => void;
14
- focus: () => void;
15
- blur: () => void;
16
17
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OnyxInputProps>, {
17
18
  modelValue: string;
18
19
  type: string;
@@ -26,13 +27,14 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
26
27
  onBlur?: (() => any) | undefined;
27
28
  onChange?: ((value: string) => any) | undefined;
28
29
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
30
+ onValidityChange?: ((validity: ValidityState) => any) | undefined;
29
31
  }, {
30
32
  type: "search" | "text" | "email" | "password" | "tel" | "url";
31
33
  required: boolean;
32
34
  disabled: boolean;
33
35
  loading: boolean;
34
- modelValue: string;
35
36
  autocapitalize: "none" | "sentences" | "words" | "characters";
37
+ modelValue: string;
36
38
  readonly: boolean;
37
39
  }, {}>;
38
40
  export default _default;
@@ -1,7 +1,8 @@
1
+ import { CustomValidityProp } from '../../composables/useCustomValidity';
1
2
  import { RequiredMarkerProp } from '../../composables/required';
2
3
  import { DensityProp } from '../../composables/density';
3
4
 
4
- export type OnyxInputProps = DensityProp & RequiredMarkerProp & {
5
+ export type OnyxInputProps = DensityProp & RequiredMarkerProp & CustomValidityProp & {
5
6
  /**
6
7
  * Label to show above the input. Required due to accessibility / screen readers.
7
8
  * If you want to visually hide the label, use the `hideLabel` property.
@@ -3,6 +3,7 @@ import { SelectionOptionValue } from './types';
3
3
  declare const _default: <TValue extends SelectionOptionValue = SelectionOptionValue>(__VLS_props: {
4
4
  required?: boolean | undefined;
5
5
  label: string;
6
+ onChange?: ((value: string) => any) | undefined;
6
7
  selected?: boolean | undefined;
7
8
  value?: unknown;
8
9
  id: TValue;
@@ -10,17 +11,19 @@ declare const _default: <TValue extends SelectionOptionValue = SelectionOptionVa
10
11
  disabled?: boolean | undefined;
11
12
  loading?: boolean | undefined;
12
13
  skeleton?: boolean | undefined;
13
- truncation?: "ellipsis" | "multiline" | undefined;
14
+ customError?: string | undefined;
14
15
  name: string;
15
- errorMessage?: string | undefined;
16
+ truncation?: "ellipsis" | "multiline" | undefined;
17
+ onValidityChange?: ((validity: ValidityState) => any) | undefined;
16
18
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, __VLS_ctx?: {
17
19
  attrs: any;
18
20
  slots: {};
19
- emit: any;
21
+ emit: ((evt: "validityChange", validity: ValidityState) => void) & ((evt: "change", value: string) => void);
20
22
  } | undefined, __VLS_expose?: ((exposed: import('vue').ShallowUnwrapRef<{}>) => void) | undefined, __VLS_setup?: Promise<{
21
23
  props: {
22
24
  required?: boolean | undefined;
23
25
  label: string;
26
+ onChange?: ((value: string) => any) | undefined;
24
27
  selected?: boolean | undefined;
25
28
  value?: unknown;
26
29
  id: TValue;
@@ -28,14 +31,15 @@ declare const _default: <TValue extends SelectionOptionValue = SelectionOptionVa
28
31
  disabled?: boolean | undefined;
29
32
  loading?: boolean | undefined;
30
33
  skeleton?: boolean | undefined;
31
- truncation?: "ellipsis" | "multiline" | undefined;
34
+ customError?: string | undefined;
32
35
  name: string;
33
- errorMessage?: string | undefined;
36
+ truncation?: "ellipsis" | "multiline" | undefined;
37
+ onValidityChange?: ((validity: ValidityState) => any) | undefined;
34
38
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
35
39
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
36
40
  attrs: any;
37
41
  slots: {};
38
- emit: any;
42
+ emit: ((evt: "validityChange", validity: ValidityState) => void) & ((evt: "change", value: string) => void);
39
43
  }>) => import('vue').VNode<import("vue").RendererNode, import("vue").RendererElement, {
40
44
  [key: string]: any;
41
45
  }> & {
@@ -43,6 +47,7 @@ declare const _default: <TValue extends SelectionOptionValue = SelectionOptionVa
43
47
  props: {
44
48
  required?: boolean | undefined;
45
49
  label: string;
50
+ onChange?: ((value: string) => any) | undefined;
46
51
  selected?: boolean | undefined;
47
52
  value?: unknown;
48
53
  id: TValue;
@@ -50,14 +55,15 @@ declare const _default: <TValue extends SelectionOptionValue = SelectionOptionVa
50
55
  disabled?: boolean | undefined;
51
56
  loading?: boolean | undefined;
52
57
  skeleton?: boolean | undefined;
53
- truncation?: "ellipsis" | "multiline" | undefined;
58
+ customError?: string | undefined;
54
59
  name: string;
55
- errorMessage?: string | undefined;
60
+ truncation?: "ellipsis" | "multiline" | undefined;
61
+ onValidityChange?: ((validity: ValidityState) => any) | undefined;
56
62
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
57
63
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
58
64
  attrs: any;
59
65
  slots: {};
60
- emit: any;
66
+ emit: ((evt: "validityChange", validity: ValidityState) => void) & ((evt: "change", value: string) => void);
61
67
  } | undefined;
62
68
  };
63
69
  export default _default;
@@ -1,4 +1,5 @@
1
1
  import { TruncationType } from '../../types/fonts';
2
+ import { CustomValidityProp } from '../../composables/useCustomValidity';
2
3
  import { DensityProp } from '../../composables/density';
3
4
 
4
5
  export type SelectionOptionValue = string | number | boolean;
@@ -30,7 +31,7 @@ export type SelectionOption<T extends SelectionOptionValue = SelectionOptionValu
30
31
  */
31
32
  skeleton?: boolean;
32
33
  };
33
- export type RadioButtonProps<TValue extends SelectionOptionValue = SelectionOptionValue> = SelectionOption<TValue> & DensityProp & {
34
+ export type OnyxRadioButtonProps<TValue extends SelectionOptionValue = SelectionOptionValue> = SelectionOption<TValue> & DensityProp & CustomValidityProp & {
34
35
  /**
35
36
  * Identifier for the radio buttons in the group.
36
37
  * All radio buttons that should belong to the same radio group must have the same name.
@@ -47,5 +48,4 @@ export type RadioButtonProps<TValue extends SelectionOptionValue = SelectionOpti
47
48
  * See also: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio#required
48
49
  */
49
50
  required?: boolean;
50
- errorMessage?: string;
51
51
  };
@@ -5,37 +5,39 @@ declare const _default: <TValue extends SelectionOptionValue>(__VLS_props: {
5
5
  density?: "default" | "cozy" | "compact" | undefined;
6
6
  disabled?: boolean | undefined;
7
7
  skeleton?: number | undefined;
8
+ customError?: string | undefined;
9
+ name?: string | undefined;
8
10
  modelValue?: SelectionOption<TValue> | undefined;
9
11
  requiredMarker?: "required" | "optional" | undefined;
10
12
  "onUpdate:modelValue"?: ((selected: SelectionOption<TValue>) => any) | undefined;
11
13
  options: SelectionOption<TValue>[];
12
14
  headline?: string | undefined;
13
15
  direction?: "horizontal" | "vertical" | undefined;
14
- name?: string | undefined;
15
- errorMessage?: string | undefined;
16
+ onValidityChange?: ((validity: ValidityState) => any) | undefined;
16
17
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, __VLS_ctx?: {
17
18
  attrs: any;
18
19
  slots: {};
19
- emit: (evt: "update:modelValue", selected: SelectionOption<TValue>) => void;
20
+ emit: ((evt: "validityChange", validity: ValidityState) => void) & ((evt: "update:modelValue", selected: SelectionOption<TValue>) => void);
20
21
  } | undefined, __VLS_expose?: ((exposed: import('vue').ShallowUnwrapRef<{}>) => void) | undefined, __VLS_setup?: Promise<{
21
22
  props: {
22
23
  required?: boolean | undefined;
23
24
  density?: "default" | "cozy" | "compact" | undefined;
24
25
  disabled?: boolean | undefined;
25
26
  skeleton?: number | undefined;
27
+ customError?: string | undefined;
28
+ name?: string | undefined;
26
29
  modelValue?: SelectionOption<TValue> | undefined;
27
30
  requiredMarker?: "required" | "optional" | undefined;
28
31
  "onUpdate:modelValue"?: ((selected: SelectionOption<TValue>) => any) | undefined;
29
32
  options: SelectionOption<TValue>[];
30
33
  headline?: string | undefined;
31
34
  direction?: "horizontal" | "vertical" | undefined;
32
- name?: string | undefined;
33
- errorMessage?: string | undefined;
35
+ onValidityChange?: ((validity: ValidityState) => any) | undefined;
34
36
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
35
37
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
36
38
  attrs: any;
37
39
  slots: {};
38
- emit: (evt: "update:modelValue", selected: SelectionOption<TValue>) => void;
40
+ emit: ((evt: "validityChange", validity: ValidityState) => void) & ((evt: "update:modelValue", selected: SelectionOption<TValue>) => void);
39
41
  }>) => import('vue').VNode<import("vue").RendererNode, import("vue").RendererElement, {
40
42
  [key: string]: any;
41
43
  }> & {
@@ -45,19 +47,20 @@ declare const _default: <TValue extends SelectionOptionValue>(__VLS_props: {
45
47
  density?: "default" | "cozy" | "compact" | undefined;
46
48
  disabled?: boolean | undefined;
47
49
  skeleton?: number | undefined;
50
+ customError?: string | undefined;
51
+ name?: string | undefined;
48
52
  modelValue?: SelectionOption<TValue> | undefined;
49
53
  requiredMarker?: "required" | "optional" | undefined;
50
54
  "onUpdate:modelValue"?: ((selected: SelectionOption<TValue>) => any) | undefined;
51
55
  options: SelectionOption<TValue>[];
52
56
  headline?: string | undefined;
53
57
  direction?: "horizontal" | "vertical" | undefined;
54
- name?: string | undefined;
55
- errorMessage?: string | undefined;
58
+ onValidityChange?: ((validity: ValidityState) => any) | undefined;
56
59
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
57
60
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
58
61
  attrs: any;
59
62
  slots: {};
60
- emit: (evt: "update:modelValue", selected: SelectionOption<TValue>) => void;
63
+ emit: ((evt: "validityChange", validity: ValidityState) => void) & ((evt: "update:modelValue", selected: SelectionOption<TValue>) => void);
61
64
  } | undefined;
62
65
  };
63
66
  export default _default;
@@ -1,9 +1,10 @@
1
1
  import { SelectionOption, SelectionOptionValue } from '../OnyxRadioButton/types';
2
2
  import { Direction } from '../../types';
3
+ import { CustomValidityProp } from '../../composables/useCustomValidity';
3
4
  import { RequiredMarkerProp } from '../../composables/required';
4
5
  import { DensityProp } from '../../composables/density';
5
6
 
6
- export type OnyxRadioButtonGroupProps<TValue extends SelectionOptionValue> = DensityProp & RequiredMarkerProp & {
7
+ export type OnyxRadioButtonGroupProps<TValue extends SelectionOptionValue = SelectionOptionValue> = DensityProp & RequiredMarkerProp & CustomValidityProp & {
7
8
  /**
8
9
  * Unique name for the radio button group form element.
9
10
  * Will automatically filled, when it is not given.
@@ -23,10 +24,6 @@ export type OnyxRadioButtonGroupProps<TValue extends SelectionOptionValue> = Den
23
24
  * Disable the radio button group.
24
25
  */
25
26
  disabled?: boolean;
26
- /**
27
- * Set the radio button group into the error state with the given error message.
28
- */
29
- errorMessage?: string;
30
27
  /**
31
28
  * Direction of the checkboxes. Can be vertical (default) or horizontal.
32
29
  */
@@ -7,14 +7,14 @@ declare const _default: <TValue extends SelectModelValue<TMultiple>, TMultiple e
7
7
  disabled?: boolean | undefined;
8
8
  loading?: boolean | undefined;
9
9
  skeleton?: boolean | undefined;
10
+ multiple?: TMultiple | undefined;
11
+ placeholder?: string | undefined;
10
12
  modelValue?: TValue | undefined;
11
13
  hideLabel?: boolean | undefined;
12
14
  requiredMarker?: "required" | "optional" | undefined;
13
15
  "onUpdate:modelValue"?: ((value: TValue | undefined) => any) | undefined;
14
- placeholder?: string | undefined;
15
16
  readonly?: boolean | undefined;
16
17
  message?: string | undefined;
17
- multiple?: TMultiple | undefined;
18
18
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, __VLS_ctx?: {
19
19
  attrs: any;
20
20
  slots: {};
@@ -27,14 +27,14 @@ declare const _default: <TValue extends SelectModelValue<TMultiple>, TMultiple e
27
27
  disabled?: boolean | undefined;
28
28
  loading?: boolean | undefined;
29
29
  skeleton?: boolean | undefined;
30
+ multiple?: TMultiple | undefined;
31
+ placeholder?: string | undefined;
30
32
  modelValue?: TValue | undefined;
31
33
  hideLabel?: boolean | undefined;
32
34
  requiredMarker?: "required" | "optional" | undefined;
33
35
  "onUpdate:modelValue"?: ((value: TValue | undefined) => any) | undefined;
34
- placeholder?: string | undefined;
35
36
  readonly?: boolean | undefined;
36
37
  message?: string | undefined;
37
- multiple?: TMultiple | undefined;
38
38
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
39
39
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
40
40
  attrs: any;
@@ -51,14 +51,14 @@ declare const _default: <TValue extends SelectModelValue<TMultiple>, TMultiple e
51
51
  disabled?: boolean | undefined;
52
52
  loading?: boolean | undefined;
53
53
  skeleton?: boolean | undefined;
54
+ multiple?: TMultiple | undefined;
55
+ placeholder?: string | undefined;
54
56
  modelValue?: TValue | undefined;
55
57
  hideLabel?: boolean | undefined;
56
58
  requiredMarker?: "required" | "optional" | undefined;
57
59
  "onUpdate:modelValue"?: ((value: TValue | undefined) => any) | undefined;
58
- placeholder?: string | undefined;
59
60
  readonly?: boolean | undefined;
60
61
  message?: string | undefined;
61
- multiple?: TMultiple | undefined;
62
62
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
63
63
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
64
64
  attrs: any;
@@ -7,8 +7,8 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
7
7
  truncation: string;
8
8
  skeleton: boolean;
9
9
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ validityChange: (validity: ValidityState) => void;
10
11
  "update:modelValue": (value: boolean) => void;
11
- validityChange: (state: ValidityState) => void;
12
12
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OnyxSwitchProps>, {
13
13
  modelValue: boolean;
14
14
  disabled: boolean;
@@ -17,7 +17,7 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
17
17
  skeleton: boolean;
18
18
  }>>> & {
19
19
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
20
- onValidityChange?: ((state: ValidityState) => any) | undefined;
20
+ onValidityChange?: ((validity: ValidityState) => any) | undefined;
21
21
  }, {
22
22
  disabled: boolean;
23
23
  loading: boolean;
@@ -1,8 +1,9 @@
1
- import { TruncationType } from '../../types/fonts';
1
+ import { TruncationType } from '../../types';
2
+ import { CustomValidityProp } from '../../composables/useCustomValidity';
2
3
  import { RequiredMarkerProp } from '../../composables/required';
3
4
  import { DensityProp } from '../../composables/density';
4
5
 
5
- export type OnyxSwitchProps = DensityProp & RequiredMarkerProp & {
6
+ export type OnyxSwitchProps = DensityProp & RequiredMarkerProp & CustomValidityProp & {
6
7
  /**
7
8
  * Whether the switch should be checked or not.
8
9
  */
@@ -19,10 +20,6 @@ export type OnyxSwitchProps = DensityProp & RequiredMarkerProp & {
19
20
  * Shows a loading indicator.
20
21
  */
21
22
  loading?: boolean;
22
- /**
23
- * The error message will set switch to invalid state.
24
- */
25
- errorMessage?: string;
26
23
  /**
27
24
  * If `true`, the label will be visually hidden and the `title` attribute will be set.
28
25
  * For accessibility / screen readers, the aria-label will still be set.
@@ -0,0 +1,46 @@
1
+ export type CustomValidityProp = {
2
+ /**
3
+ * Custom error message to show. Will only show up after the user has interacted with the input.
4
+ */
5
+ customError?: string;
6
+ };
7
+ export type UseCustomValidityOptions = {
8
+ /**
9
+ * Component props as defined with `const props = defineProps()`
10
+ */
11
+ props: CustomValidityProp & {
12
+ modelValue?: unknown;
13
+ };
14
+ /**
15
+ * Component emit as defined with `const emit = defineEmits()`
16
+ */
17
+ emit: (evt: "validityChange", validity: ValidityState) => void;
18
+ };
19
+ export type InputValidationElement = Pick<HTMLInputElement, "validity" | "setCustomValidity">;
20
+ /**
21
+ * Composable for unified handling of custom error messages for form components.
22
+ * Will call `setCustomValidity()` accordingly and emit the "validityChange" event
23
+ * whenever the input value / error changes.
24
+ *
25
+ * @example
26
+ * ```html
27
+ * <script lang="ts" setup>
28
+ * const props = defineProps<CustomValidityProp>();
29
+ * const emit = defineEmits<{ validityChange: [validity: ValidityState] }>();
30
+ *
31
+ * const { vCustomValidity } = useCustomValidity({ props, emit });
32
+ * </script>
33
+ *
34
+ * <template>
35
+ * <input v-custom-validity />
36
+ * </template>
37
+ * ```
38
+ */
39
+ export declare const useCustomValidity: (options: UseCustomValidityOptions) => {
40
+ /**
41
+ * Directive to set the custom error message and emit validityChange event.
42
+ */
43
+ vCustomValidity: {
44
+ mounted: (el: InputValidationElement) => void;
45
+ };
46
+ };