import type { JSX } from "@solidjs/web"; import { type Accessor } from "solid-js"; import type { OTPFieldInputState, OTPFieldRootChangeEventDetails, OTPFieldRootInvalidEventDetails, OTPFieldRootState, OTPFieldValidationType } from "./otp-field-root-types.js"; /** * Context published by `` to its descendant slot ``s. * * Solid 2 adaptation from Base UI React's `OTPFieldRootContext`: * * - Every reactive entry is exposed as `Accessor` so descendants pull live * values on demand without tripping the top-level reactive-read rule * (RFC 01). The React version ships snapshots; here we ship getters. * - Callbacks (`setValue`, `focusInput`, `queueFocusInput`, `handleInputBlur`, * `handleInputFocus`, `reportValueInvalid`, `getInputId`) are plain stable * functions owned by the root — slot inputs capture them into event * closures. * - `state` is an accessor returning the full `OTPFieldRootState` object so * each slot can derive its own `OTPFieldInputState` via the helper below. */ export interface OTPFieldRootContextValue { activeIndex: Accessor; autoComplete: Accessor; disabled: Accessor; form: Accessor; focusInput: (index: number) => void; queueFocusInput: (index: number, value: string) => void; getInputId: (index: number) => string | undefined; handleInputBlur: (event: FocusEvent & { currentTarget: HTMLInputElement; }) => void; handleInputFocus: (index: number, event: FocusEvent & { currentTarget: HTMLInputElement; }) => void; inputMode: Accessor["inputmode"]>; inputAriaLabelledBy: Accessor; invalid: Accessor; length: Accessor; mask: Accessor; pattern: Accessor; reportValueInvalid: (value: string, details: OTPFieldRootInvalidEventDetails) => void; readOnly: Accessor; required: Accessor; sanitizeValue: Accessor<((value: string) => string) | undefined>; setValue: (value: string, details: OTPFieldRootChangeEventDetails) => string | null; state: Accessor; validationType: Accessor; value: Accessor; /** Marker — `true` when provided by a real ``. */ readonly present: boolean; } export declare const NOOP_OTP_FIELD_ROOT_CONTEXT: OTPFieldRootContextValue; export declare const OTPFieldRootContext: import("solid-js").Context; /** * Read the nearest `` context. Throws when no real root is an * ancestor — slot ``s are meaningless without their root. */ export declare function useOTPFieldRootContext(): OTPFieldRootContextValue; /** * Derive per-slot state from the root state + this slot's value and index. * Pure helper — call it from a memo if you want reactive updates. */ export declare function getOTPFieldInputState(state: OTPFieldRootState, value: string, index: number): OTPFieldInputState; //# sourceMappingURL=otp-field-root-context.d.ts.map