/** * Field — the layout and validation-state kit a form control composes into. * * PanelUI's own controls (`Input`, `Checkbox`, `Switch`, `RadioGroup`) already * carry their own label, description and error slot, so the common case needs * no wrapper at all — pass those props straight through. `Field` exists for * what doesn't fit that shape: a horizontal row pairing a control with a * label off to the side (a `Switch` in a settings list), several controls * grouped under one legend, or a rule breaking a long form into sections. * * `invalid` / `disabled` / `required` set on the root flow to `Field.Label` * and `Field.Description` through context, so a multi-field row states its * validity once instead of repeating the prop at every leaf. * * ```tsx * * * Marketing emails * Product updates, at most weekly. * * * * ``` */ import { type ReactNode } from 'react'; import { View, type Text as RNText, type ViewProps } from 'react-native'; import { type TextProps } from '../../primitives/text.js'; import { type LabelProps } from '../label/index.js'; /** Android can announce the label, help and error text rendered beside a control. */ export declare function useFieldLabelledBy(): string[] | undefined; export interface FieldProps extends ViewProps { className?: string; /** `horizontal` puts a label beside the control instead of above it. */ orientation?: 'vertical' | 'horizontal'; /** Marks every `Field.Label`/`Field.Description` below as invalid. */ invalid?: boolean; disabled?: boolean; /** Marks every `Field.Label` below as required, same as `Label`'s own prop. */ required?: boolean; children?: ReactNode; } export interface FieldContentProps extends ViewProps { className?: string; children?: ReactNode; } export interface FieldLabelProps extends LabelProps { } export interface FieldDescriptionProps extends TextProps { className?: string; } export interface FieldErrorProps extends Omit { className?: string; /** * Error messages to render, deduplicated by message. A single entry renders * as plain text; more than one renders as a bulleted list, since RN has no * `