import type { HTMLAttributes, AllHTMLAttributes, AriaAttributes, ReactNode } from 'react'; type Without = { [P in Exclude]?: never; }; type SingleXOR = T | U extends object ? (Without & U) | (Without & T) : T | U; export type XOR = T extends [infer Only] ? Only : T extends [infer A, infer B, ...infer Rest] ? XOR<[SingleXOR, ...Rest]> : never; /** * Enforces that at least one of the given keys is provided. * Useful for accessible labelling patterns like `label | aria-label | aria-labelledby`. */ export type AtLeastOne> = { [K in keyof T]: { [P in K]: T[P]; } & { [P in Exclude]?: T[P]; }; }[keyof T]; export type PascalToCamelCase = S extends `${infer P1}${infer P2}` ? `${Lowercase}${P2}` : S; export type RemoveSuffix = S extends `${infer Prefix}${Suffix}` ? Prefix : S; /** * This type removes the suffix from a PascalCase string and converts it to camelCase. Pretty useful for Icon, CategoryIcon and ProductIcon components. * Their names being `AddressIcon` but we might need to have `address` as the prop name. */ export type PascalToCamelCaseWithoutSuffix = T extends `${infer Prefix}${Suffix}` ? `${PascalToCamelCase}` : never; /** * @deprecated use type FormComponentProps instead which will handle all form props required. */ export type LabelProp = { label: ReactNode; 'aria-label'?: never; id?: string; } | { label?: never; 'aria-label': string; id?: string; } | { label?: never; 'aria-label'?: never; id: string; }; export type CheckboxLabelProp = { children: ReactNode; 'aria-label'?: string; } | { children?: never; 'aria-label': string; }; type DefaultLabel = { label: string; 'aria-label': string; 'aria-labelledby': string; }; export type PartialLabelProps = Partial; export type LabelProps = AtLeastOne; type BaseAriaProps = Pick; type StyleBaseProps = Pick, 'style' | 'className'>; type InputBaseProps = Pick, 'onFocus' | 'onBlur' | 'onKeyDown' | 'autoFocus'>; type DefaultProps = { 'data-testid'?: string; helper?: ReactNode; } & Pick, 'disabled' | 'required' | 'id' | 'name'>; export type BaseFormComponentProps = DefaultProps & InputBaseProps & StyleBaseProps & BaseAriaProps & PartialLabelProps; export {}; //# sourceMappingURL=types.d.ts.map