/* eslint-disable eslint-comments/disable-enable-pair */ /* eslint-disable no-implicit-coercion */ /* eslint-disable import/no-default-export */ /* eslint-disable tsdoc/syntax */ import type { ReactNode } from 'react' export interface FieldsetBaseType { /** * The input's required id, used to link the label and input, as well as the error message. */ id: string /** * Error message to show input validation. */ error?: string /** * Success message to show input validation. */ success?: string /** * Label to describe the input. */ label?: string | ReactNode /** * Hint to show optional fields or a hint to the user of what to enter in the input. */ hint?: string } type FieldsetType = FieldsetBaseType & { children: ReactNode } /** * @name Fieldset * @description A fieldset component, used to share markup for labels, hints, and errors for Input components. * * @example *
* *
*/ export default function Fieldset({ label, hint, id, children, error, success }: FieldsetType) { return (
{!!label && (
{typeof hint === 'string' && ( {hint} )}
)} {children} {error && (

{error}

)} {success && (

{success}

)}
) }