import type { ReactNode } from 'react'; import React from 'react'; import type { RenderProps } from '../../util/utility-types'; import type { Status } from '../../util/variant-types'; type FieldsetSharedProps = { /** * Indicates disabled state of the input. */ isDisabled?: boolean; /** * Status for the field state * * **Default is `"default"`**. */ status?: 'default' | Extract; }; type FieldsetProps = { /** * The contents of the fieldset. We suggest a Fieldset.Legend followed by * interactive elements within Fieldset.Items. */ children: ReactNode; /** * Additional classnames passed in for styling. */ className?: string; /** * Text under the component used to provide a description or error message to describe the state. */ fieldNote?: ReactNode; } & FieldsetSharedProps & React.HTMLAttributes; type FieldsetItemsProps = { /** * Type of element the immediate wrapper around the contents should be. * * **Default is `"div"`**. */ as?: string | React.ElementType; /** * Additional classnames passed in for styling. */ className?: string; } & RenderProps; type FieldsetLegendProps = { /** * CSS class names that can be appended to the component. */ className?: string; /** * Indicates that field is required for form to be successfully submitted */ required?: boolean; /** * Whether it should show the field hint or not * * **Default is `"false"`**. */ showHint?: boolean; /** * Secondary text used to describe the content in more detail */ subTitle?: string; /** * The title/heading of the component */ title?: string; } & FieldsetSharedProps; /** * ## Usage * * Label and contain a set of fields, to clearly indicate the fields have a close relationship. * Especially useful when showing `Checkbox` and `Radio` controls in a set. Can show its own label * and field note. * * | Type/Use | Description | Example | * |----------|-------------|---------| * | Radio set | Groups mutually exclusive options under a single legend. | Picking one plan, one delivery method, one answer. | * | Checkbox set | Groups related checkboxes that answer one question. | "Select all that apply" questions. | * | With a field note | `fieldNote` adds a description or error below the group, and inherits the group's `status`. | Validation that applies to the set rather than one control. | * * Compose it as a `Fieldset.Legend` to label the group, followed by the controls wrapped in * `Fieldset.Items`. `isDisabled` and `status` set on `Fieldset` flow down to both. * * ## Content & Accessibility * * ### Do's * * * Use `Fieldset` when you wish to label a set of `Radio` fields, and want to avoid lengthy text in an adjacent element. * * ### Don'ts * * * Avoid using `Fieldset` with non-control content, like blocks of text or other components. Instead, use `Card`. * * Don't use `Fieldset` with `Checkbox` unless the checkboxes are part of an overlapping set (e.g., "Select all that apply" in the label for the `Fieldset`). * * ## Resources * * * https://www.w3.org/WAI/WCAG22/Techniques/html/H71 */ export declare function Fieldset({ children, className, fieldNote, isDisabled, status, ...other }: FieldsetProps): React.JSX.Element; export declare namespace Fieldset { var displayName: string; var Items: { ({ children, as: Component, className, ...other }: FieldsetItemsProps): React.JSX.Element; displayName: string; }; var Legend: { ({ className, isDisabled: _, required, showHint, subTitle, title, ...other }: FieldsetLegendProps): React.JSX.Element; displayName: string; }; } /** * Helper sub-component for styling the control elements in the component. */ export declare const FieldsetItems: { ({ children, as: Component, className, ...other }: FieldsetItemsProps): React.JSX.Element; displayName: string; }; export {};