import * as React from 'react'; import { View } from 'react-native'; import type { ZestUIComponentProps } from '../../types'; import type { ZestChangeEventDetails } from '../../utils/createChangeEventDetails'; import { REASONS } from '../../utils/reasons'; import { type OTPValidationType } from '../utils/otp'; /** * Groups all parts of the OTP field. * Renders a ``. * * **Not ported from upstream.** `name`/`form`/`required`/`autoSubmit` (the hidden * input and form submission — see the standing decision in CLAUDE.md), and * `pattern`, which is HTML constraint validation. */ export declare function OTPFieldRoot(componentProps: OTPFieldRoot.Props): React.JSX.Element; export interface OTPFieldRootState { /** * Whether the component should ignore user interaction. */ disabled: boolean; /** * Whether the user should be unable to change the field value. */ readOnly: boolean; /** * The current OTP value. */ value: string; /** * The number of slots. */ length: number; /** * Whether the slots mask their characters. */ mask: boolean; /** * Whether every slot is filled. */ complete: boolean; /** * The slot that currently has focus, or `-1` when none does. */ activeIndex: number; } export interface OTPFieldRootProps extends Omit, 'id'> { /** * The number of OTP input slots. */ length: number; /** * The OTP value. */ value?: string | undefined; /** * The uncontrolled OTP value when the component is initially rendered. */ defaultValue?: string | undefined; /** * The id of the first input. Subsequent inputs derive theirs from it * (`{id}-2`, `{id}-3`, and so on). */ id?: string | undefined; /** * The autofill hint applied to the first slot. `'one-time-code'` is what lets * the OS offer a code it read from an SMS. * @default 'one-time-code' */ autoComplete?: string | undefined; /** * Whether the slots should mask entered characters. * @default false */ mask?: boolean | undefined; /** * The type of validation applied to the OTP value. * @default 'numeric' */ validationType?: OTPValidationType | undefined; /** * Normalizes the OTP value after whitespace and `validationType` filtering. * It must be idempotent: the same value may be normalized more than once. */ normalizeValue?: ((value: string) => string) | undefined; /** * Whether the component should ignore user interaction. * @default false */ disabled?: boolean | undefined; /** * Whether the user should be unable to change the field value. * @default false */ readOnly?: boolean | undefined; /** * Callback fired when the OTP value changes. */ onValueChange?: ((value: string, eventDetails: OTPFieldRoot.ChangeEventDetails) => void) | undefined; /** * Callback fired when entered text contains characters rejected by validation * or normalization. The `value` argument is what the user attempted to enter, * before normalization. */ onValueInvalid?: ((value: string, eventDetails: OTPFieldRoot.InvalidEventDetails) => void) | undefined; /** * Callback fired when the OTP value becomes complete. */ onValueComplete?: ((value: string, eventDetails: OTPFieldRoot.CompleteEventDetails) => void) | undefined; } export type OTPFieldRootChangeEventReason = typeof REASONS.inputChange | typeof REASONS.inputClear | typeof REASONS.none; export type OTPFieldRootChangeEventDetails = ZestChangeEventDetails; export declare namespace OTPFieldRoot { type State = OTPFieldRootState; type Props = OTPFieldRootProps; type ValidationType = OTPValidationType; type ChangeEventReason = OTPFieldRootChangeEventReason; type ChangeEventDetails = OTPFieldRootChangeEventDetails; type InvalidEventDetails = OTPFieldRootChangeEventDetails; type CompleteEventDetails = OTPFieldRootChangeEventDetails; } //# sourceMappingURL=OTPFieldRoot.d.ts.map