UNPKG

@porsche-design-system/components-react

Version:

Porsche Design System is a component library designed to help developers create the best experience for software or services distributed by Dr. Ing. h.c. F. Porsche AG.

161 lines (160 loc) 6.32 kB
import type { BaseProps } from '../../BaseProps'; import type { BreakpointCustomizable, PinCodeLength, PinCodeChangeEventDetail, PinCodeState, PinCodeType } from '../types'; export type PPinCodeProps = BaseProps & { /** * Reduces the pin code field height and spacing for use in dense layouts where vertical space is limited. * @default false */ compact?: boolean; /** * Sets a supplementary description displayed below the label to give users additional guidance about the pin code. * @default '' */ description?: string; /** * Prevents user interaction with all pin code fields and blocks events while the component is disabled. * @default false */ disabled?: boolean; /** * Associates the pin code with a form element by its ID when it is not a direct descendant of that form. */ form?: string; /** * Hides the visible label and description while keeping them accessible to screen readers. Supports responsive breakpoint values. * @default false */ hideLabel?: BreakpointCustomizable<boolean>; /** * Sets the visible label text displayed above the pin code fields to identify their purpose. * @default '' */ label?: string; /** * Sets the number of individual input fields rendered, determining how many characters the pin code consists of. * @default 4 */ length?: PinCodeLength; /** * Disables the pin code fields and shows a loading spinner to indicate an ongoing background operation. * @default false */ loading?: boolean; /** * Sets the validation feedback message displayed below the pin code when `state` is `success` or `error`. * @default '' */ message?: string; /** * Sets the name of the control submitted with the form data to identify the pin code value on the server. */ name?: string; /** * Emitted when the pin code component loses focus after the user finishes entering characters. */ onBlur?: (event: CustomEvent<void>) => void; /** * Emitted when the pin code value changes as the user types, carrying the new concatenated value in the event detail. */ onChange?: (event: CustomEvent<PinCodeChangeEventDetail>) => void; /** * Marks the pin code as required so the form cannot be submitted until all fields are filled. * @default false */ required?: boolean; /** * Sets the validation state of the pin code, which controls its visual appearance and feedback message style (`none`, `success`, `error`). * @default 'none' */ state?: PinCodeState; /** * Controls whether the individual input fields mask their content as password dots (`password`) or show digits (`number`). * @default 'number' */ type?: PinCodeType; /** * Sets the current concatenated value of all pin code fields and allows setting the initial value. * @default '' */ value?: string; }; export declare const PPinCode: import("react").ForwardRefExoticComponent<Omit<import("react").DOMAttributes<{}>, "onChange" | "onInput" | "onToggle"> & Pick<import("react").HTMLAttributes<{}>, "suppressHydrationWarning" | "autoFocus" | "className" | "dir" | "hidden" | "id" | "inert" | "inputMode" | "lang" | "slot" | "style" | "tabIndex" | "title" | "translate" | "role"> & { /** * Reduces the pin code field height and spacing for use in dense layouts where vertical space is limited. * @default false */ compact?: boolean; /** * Sets a supplementary description displayed below the label to give users additional guidance about the pin code. * @default '' */ description?: string; /** * Prevents user interaction with all pin code fields and blocks events while the component is disabled. * @default false */ disabled?: boolean; /** * Associates the pin code with a form element by its ID when it is not a direct descendant of that form. */ form?: string; /** * Hides the visible label and description while keeping them accessible to screen readers. Supports responsive breakpoint values. * @default false */ hideLabel?: BreakpointCustomizable<boolean>; /** * Sets the visible label text displayed above the pin code fields to identify their purpose. * @default '' */ label?: string; /** * Sets the number of individual input fields rendered, determining how many characters the pin code consists of. * @default 4 */ length?: PinCodeLength; /** * Disables the pin code fields and shows a loading spinner to indicate an ongoing background operation. * @default false */ loading?: boolean; /** * Sets the validation feedback message displayed below the pin code when `state` is `success` or `error`. * @default '' */ message?: string; /** * Sets the name of the control submitted with the form data to identify the pin code value on the server. */ name?: string; /** * Emitted when the pin code component loses focus after the user finishes entering characters. */ onBlur?: (event: CustomEvent<void>) => void; /** * Emitted when the pin code value changes as the user types, carrying the new concatenated value in the event detail. */ onChange?: (event: CustomEvent<PinCodeChangeEventDetail>) => void; /** * Marks the pin code as required so the form cannot be submitted until all fields are filled. * @default false */ required?: boolean; /** * Sets the validation state of the pin code, which controls its visual appearance and feedback message style (`none`, `success`, `error`). * @default 'none' */ state?: PinCodeState; /** * Controls whether the individual input fields mask their content as password dots (`password`) or show digits (`number`). * @default 'number' */ type?: PinCodeType; /** * Sets the current concatenated value of all pin code fields and allows setting the initial value. * @default '' */ value?: string; } & { children?: import("react").ReactNode | undefined; } & import("react").RefAttributes<HTMLElement>>;