UNPKG

@accelint/design-toolkit

Version:

An open-source component library to serve as part of the entire ecosystem of UX for Accelint.

88 lines (85 loc) 2.62 kB
import * as react_jsx_runtime from 'react/jsx-runtime'; import * as react from 'react'; import { ContextValue } from 'react-aria-components'; import { ProviderProps } from '../../lib/types.js'; import { TextFieldProps } from './types.js'; import '../input/types.js'; import 'tailwind-variants'; import '../button/types.js'; import '../button/styles.js'; import 'tailwind-merge'; import '../input/styles.js'; import '../label/types.js'; declare const TextFieldContext: react.Context<ContextValue<TextFieldProps, HTMLDivElement>>; declare function TextFieldProvider({ children, ...props }: ProviderProps<TextFieldProps>): react_jsx_runtime.JSX.Element; declare namespace TextFieldProvider { var displayName: string; } /** * TextField - A complete form field component with label, input, and validation * * Provides a comprehensive form field experience combining label, input, description, * and error message components. Handles validation states and accessibility * automatically while supporting extensive customization through styling props. * * @example * // Basic text field with label and required validation * <TextField label='Full Name' isRequired defaultValue='John Doe' /> * * @example * // Text field with placeholder and description * <TextField * label='Email Address' * inputProps={{ placeholder: 'Enter your email address', type: 'email' }} * description='We will never share your email with third parties' * /> * * @example * // Text field with error state * <TextField * label='Username' * isInvalid * errorMessage='Username must be at least 3 characters long' * inputProps={{ placeholder: 'Enter username' }} * /> * * @example * // Small size text field with clearable input * <TextField * label='Search' * size='small' * inputProps={{ * placeholder: 'Type to search...', * isClearable: true, * type: 'search' * }} * /> * * @example * // Disabled text field * <TextField * label='Status' * isDisabled * defaultValue='Inactive' * description='This field cannot be edited' * /> * * @example * // Password field with validation * <TextField * label='Password' * isRequired * inputProps={{ * type: 'password', * placeholder: 'Enter a secure password', * minLength: 8 * }} * description='Password must be at least 8 characters' * /> */ declare function TextField({ ref, ...props }: TextFieldProps): react_jsx_runtime.JSX.Element; declare namespace TextField { var displayName: string; var Provider: typeof TextFieldProvider; } export { TextField, TextFieldContext };