/** What the field edits. `select` / `multiselect` open a listbox, `otp` renders one box per character. */ export type SyInputType = 'text' | 'email' | 'number' | 'tel' | 'url' | 'search' | 'password' | 'textarea' | 'select' | 'multiselect' | 'otp'; /** `outlined` border, `filled` tinted background, `soft` neumorphic raised surface, `underlined` bottom line only. */ export type SyInputAppearance = 'outlined' | 'filled' | 'soft' | 'underlined'; /** Corner style. `radius` overrides it. */ export type SyInputShape = 'rounded' | 'pill' | 'square'; /** Height: sm 2.5rem, md 3rem, lg 3.5rem. */ export type SyInputSize = 'sm' | 'md' | 'lg'; /** Action button (e.g. search): inside the field, attached to its end, or detached next to it. */ export type SyInputAction = 'none' | 'inside' | 'attached' | 'detached'; /** Show/hide button on password fields: `icon` eye, `text` Show/Hide link, `none`. */ export type SyPasswordToggle = 'icon' | 'text' | 'none'; /** Characters an OTP box accepts. */ export type SyOtpMode = 'numeric' | 'alphanumeric'; /** Option for select, multiselect and text suggestions. Plain strings are accepted too. */ export interface SyInputOption { label: string; /** Must be unique within `options`. */ value: string; /** Sylar icon name (sy-...) or an SVG URL. CSS icon classes are not drawn here. */ icon?: string; disabled?: boolean; } /** Validation error added when `enforceRules` is on and a password rule fails. */ export interface SyPasswordRulesError { passwordRules: { failed: string[]; }; } /** Validation error while an OTP is partly filled. */ export interface SyOtpIncompleteError { otpIncomplete: { length: number; actual: number; }; } /** One requirement shown in the checklist and used for strength and validation. */ export interface SyPasswordRule { /** Stable key, reported in the `passwordRules` validation error. */ id: string; /** Text shown in the checklist, e.g. '8 characters'. */ label: string; test: (value: string) => boolean; } /** `none` while empty; otherwise grows with the share of rules met. */ export type SyPasswordStrength = 'none' | 'weak' | 'fair' | 'good' | 'strong'; /** Custom scoring: receives the value and the rules, returns a level. */ export type SyPasswordStrengthFn = (value: string, rules: ReadonlyArray) => SyPasswordStrength;