diff --git a/app/src/components/globals/formItems/AdressItem.vue b/app/src/components/globals/formItems/AdressItem.vue index 6d6a0a4d..5e2caf72 100644 --- a/app/src/components/globals/formItems/AdressItem.vue +++ b/app/src/components/globals/formItems/AdressItem.vue @@ -1,35 +1,36 @@ @@ -37,32 +38,38 @@ function onInput(key: 'localPart' | 'domain', modelValue: string | null) { diff --git a/app/src/composables/form.ts b/app/src/composables/form.ts new file mode 100644 index 00000000..ff2b6803 --- /dev/null +++ b/app/src/composables/form.ts @@ -0,0 +1,5 @@ +import type { InjectionKey } from 'vue' + +export const ValidationTouchSymbol = Symbol() as InjectionKey< + (key?: string) => void +> diff --git a/app/src/types/form.ts b/app/src/types/form.ts new file mode 100644 index 00000000..0ac585ad --- /dev/null +++ b/app/src/types/form.ts @@ -0,0 +1,28 @@ +import type { BaseValidation } from '@vuelidate/core' +type StateValidation = false | null + +// WRITABLE + +type BaseWritableItemProps = { + id?: string + name?: string + placeholder?: string + touchKey?: string +} + +export type BaseItemComputedProps = { + ariaDescribedby?: string | string[] + modelValue?: MV + state?: StateValidation + validation?: BaseValidation +} + +export type AdressItemProps = BaseWritableItemProps & { + choices: string[] + type?: 'domain' | 'email' +} +export type AdressModelValue = { + localPart: string | null + separator: string + domain: string | null +}