import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms'; /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE */ /** * Bundled `ValidatorFn`s — pure functions, no DOM, no DI. Mirrors the * API shape of Angular's built-in `Validators` so it composes cleanly: * * ```ts * import { Validators } from '@angular/forms'; * import { WrValidators } from 'ngwr/validators'; * * new FormControl('', [ * Validators.required, * WrValidators.cardNumber, * WrValidators.cvc(3), * WrValidators.match('password'), * WrValidators.oneOf(['xs', 'sm', 'md', 'lg', 'xl']), * ]); * ``` * * Each error is keyed under the validator name (e.g. `cardNumber`, * `cvc`, `iban`) so consumers can branch in templates. * * Anything Angular already ships (`required`, `email`, `min`, `max`, * `pattern`, …) is deliberately NOT duplicated here. * * @see https://ngwr.dev/validators */ declare const WrValidators: { /** No whitespace anywhere in the value. */ noWhitespace: (control: AbstractControl) => ValidationErrors | null; /** 3, 4, 6, or 8-digit hex colour (`#abc`, `#1a2b3c`, `#1a2b3c4d`). */ hexColor: (control: AbstractControl) => ValidationErrors | null; /** * Valid URL. Accepts any scheme by default; pass `{ protocols: ['https'] }` * to restrict. A scheme is required by default; pass `{ requireProtocol: false }` * to also accept bare domains (e.g. `ngwr.dev`), assuming `https`. */ url: (options?: { readonly protocols?: readonly string[]; readonly requireProtocol?: boolean; }) => ValidatorFn; /** Credit card number — Luhn check + 13-19 digit length. Spaces and dashes are stripped first. */ cardNumber: (control: AbstractControl) => ValidationErrors | null; /** CVC / CVV — N digits (default 3). Common: 3 for Visa/MC, 4 for Amex. */ cvc: (length?: number) => ValidatorFn; /** * IBAN — basic structure (CC + 2 digits + up to 30 alphanumerics) + * the mod-97 check. Country-length tables not enforced. */ iban: (control: AbstractControl) => ValidationErrors | null; /** * Value must equal a sibling control's value (e.g. confirm-password). * The target lookup uses `control.parent.get(name)`, so it works * inside `FormGroup` and nested groups. */ match: (targetName: string) => ValidatorFn; /** Value must be one of the allowed entries (strict equality). */ oneOf: (allowed: readonly T[]) => ValidatorFn; /** Value (Date | parseable) must be ≥ `min`. */ minDate: (min: Date | string | number) => ValidatorFn; /** Value (Date | parseable) must be ≤ `max`. */ maxDate: (max: Date | string | number) => ValidatorFn; }; export { WrValidators };