import * as React from 'react'; import { Box } from '../box'; import { Button, IconButton } from '../button'; type ExpansionPanelProps = { /** * The id applied to the expanded content, used by the toggle's * `aria-controls` attribute. Defaults to an auto-generated id; provide one * only when you need a specific, stable DOM id. */ id?: string; children: React.ReactNode; } & ({ /** * The default state of the expansion panel when used in uncontrolled * mode (e.g. without the `isExpanded` and `onToggleExpand` props) */ initiallyExpanded?: boolean; isExpanded?: never; onToggleExpand?: never; } | { /** Controlled expand/collapse state. Pair with `onToggleExpand`. */ isExpanded: boolean; /** Called when the toggle is clicked. Consumer flips `isExpanded`. */ onToggleExpand: () => void; initiallyExpanded?: never; }); /** * Animated expand/collapse primitive. Compose with `ExpansionPanelHeader`, * `ExpansionPanelToggle`, and `ExpansionPanelContent` as children. * * Supports both controlled (`isExpanded` + `onToggleExpand`) and uncontrolled * (`initiallyExpanded`) modes. */ declare function ExpansionPanel({ children, initiallyExpanded, id: providedId, ...props }: ExpansionPanelProps): React.JSX.Element; type ExpansionPanelHeaderProps = React.ComponentProps; /** * Semantic wrapper for the panel's header row. A thin alias over `Box` — use it * to colocate the toggle with sibling controls (e.g. add/delete buttons) without * making the whole row clickable. */ declare function ExpansionPanelHeader({ children, ...props }: ExpansionPanelHeaderProps): React.JSX.Element; /** * Props the toggle owns internally and consumers must not override — omitted * from the public prop types. (`size` here refers to the chevron size below, not * the button's own `size`, which is also internal.) */ type InternalToggleProps = 'variant' | 'size' | 'icon' | 'startIcon' | 'onClick' | 'aria-expanded' | 'aria-controls' | 'aria-label' | 'children'; type ButtonTogglePassthrough = Omit, InternalToggleProps>; type IconButtonTogglePassthrough = Omit, InternalToggleProps>; type ExpansionPanelToggleProps = ({ /** * Visible label for the button. `aria-label` is optional here since * the children already name the button. */ children: React.ReactNode; 'aria-label'?: string; /** Chevron icon size. Defaults to `'24'`. */ size?: '24' | '16'; } & ButtonTogglePassthrough) | ({ children?: never; /** Required accessible label for the icon-only toggle. */ 'aria-label': string; /** Chevron icon size. Defaults to `'24'`. */ size?: '24' | '16'; } & IconButtonTogglePassthrough); /** * Button that toggles the panel's expand/collapse state. Wires up `onClick`, * `aria-expanded`, and `aria-controls` automatically from the parent * `ExpansionPanel`'s context. * * Renders an `IconButton` when no children are passed (`aria-label` required), * or a full-width `Button` with a chevron start icon otherwise. Remaining props * forward to the underlying button. */ declare function ExpansionPanelToggle({ exceptionallySetClassName, children, 'aria-label': ariaLabel, size, ...props }: ExpansionPanelToggleProps): React.JSX.Element; type ExpansionPanelContentProps = Omit, 'id'> & { /** Called once the expand animation finishes (not fired on collapse). */ onEntered?: () => void; }; /** * Container for the panel's expandable content. Animates height on * expand/collapse driven by the parent `ExpansionPanel`'s state. Extra props * forward to the inner `Box`. */ declare function ExpansionPanelContent({ children, onEntered, ...props }: ExpansionPanelContentProps): React.JSX.Element; export { ExpansionPanel, ExpansionPanelContent, ExpansionPanelHeader, ExpansionPanelToggle }; export type { ExpansionPanelContentProps, ExpansionPanelHeaderProps, ExpansionPanelProps, ExpansionPanelToggleProps, };