Files
heroui-vue/packages/vue/src/components/field/validation.ts
T

17 lines
672 B
TypeScript

/** Snapshot native readonly validity flags without retaining a live DOM object. */
export function validitySnapshot(value?: ValidityState): ValidityState {
return {
badInput: value?.badInput ?? false,
customError: value?.customError ?? false,
patternMismatch: value?.patternMismatch ?? false,
rangeOverflow: value?.rangeOverflow ?? false,
rangeUnderflow: value?.rangeUnderflow ?? false,
stepMismatch: value?.stepMismatch ?? false,
tooLong: value?.tooLong ?? false,
tooShort: value?.tooShort ?? false,
typeMismatch: value?.typeMismatch ?? false,
valid: value?.valid ?? true,
valueMissing: value?.valueMissing ?? false,
};
}