import { default as React, ReactNode } from 'react'; import { FeedbackTextProps } from '../feedback-text/feedback-text'; import { FormLabelProps } from '../form-label/form-label'; import { Input } from './components/input/input'; import { Prefix } from './components/prefix/prefix'; import { Suffix } from './components/suffix/suffix'; export interface InputGroupProps extends FormLabelProps { /** * Additional class name(s) applied to the root element of the InputGroup. * Useful for custom styling or layout overrides. */ className?: string; /** * Enables merged styling between input and its prefix/suffix elements. * When `true`, borders and radius are visually combined into a single control. * Disable this when using non-standard addons (e.g. buttons) that should not visually merge. * * @default true */ addons?: boolean; /** * Helper or feedback text displayed below the input group. * Can be a single item or multiple messages (e.g. error + hint). * * Accepts the same props as `FeedbackText`. */ helper?: FeedbackTextProps | FeedbackTextProps[]; /** * InputGroup composition slots. * Typically includes `InputGroup.Input` and optionally `InputGroup.Prefix` and/or `InputGroup.Suffix`. */ children: ReactNode; /** * Disables the entire input group. * Applies disabled styles to the group and propagates the disabled state * to the input and any interactive prefix/suffix elements. */ disabled?: boolean; /** * Marks the whole group as invalid. Applies the error border to the * prefix/suffix addons and propagates `invalid` down to the inner form * control, so you don't have to set it on the child as well. Pair with an * error `helper` message. */ invalid?: boolean; } export interface InputGroupForwardRef { root: HTMLDivElement | null; } export type InputGroupContextValue = { /** * Registers a prefix element within the InputGroup. * Used internally to apply correct styling (e.g. border merging). */ registerPrefix: () => void; /** * Unregisters the prefix element when it is removed. */ unregisterPrefix: () => void; /** * Registers a suffix element within the InputGroup. * Used internally to apply correct styling. */ registerSuffix: () => void; /** * Unregisters the suffix element when it is removed. */ unregisterSuffix: () => void; /** * Whether a prefix is currently present. */ hasPrefix: boolean; /** * Whether a suffix is currently present. */ hasSuffix: boolean; /** * Disabled state inherited from InputGroup. * Consumers (Input, Prefix, Suffix) should use this to adjust * behavior and styling. */ disabled?: boolean; /** * Invalid state inherited from InputGroup. * Consumed by Input to propagate `invalid` (or `aria-invalid`) to the * wrapped form control. */ invalid?: boolean; hasExternalLabel?: boolean; inputId?: string; }; export declare const useInputGroup: () => InputGroupContextValue; export declare const useOptionalInputGroup: () => InputGroupContextValue | null; export declare const InputGroupBase: React.ForwardRefExoticComponent>; declare const InputGroup: typeof InputGroupBase & { Prefix: typeof Prefix; Suffix: typeof Suffix; Input: typeof Input; }; export default InputGroup;