import React from 'react'; import PropTypes from 'prop-types'; import { ComponentProps } from '../utils/types'; /** @public */ type SingleOpenPanelGroupChangeHandler = (event: React.MouseEvent, data: { action: 'open' | 'close'; panelId?: string | number; reason: 'toggleClick'; }) => void; interface SingleOpenPanelGroupPropsBase { /** * Must be `CollapsiblePanel`. */ children?: React.ReactNode; /** * Sets the panel to expand on the initial render. Use only when using * `SingleOpenPanelGroup` as an uncontrolled component. Must match the `panelId` of * one of the `CollapsiblePanel` children. */ defaultOpenPanelId?: string | number; /** * A React ref which is set to the DOM element when the component mounts and null when it unmounts. */ elementRef?: React.Ref; /** * By default, adds padding to panel content. If set to false, renders panel content without padding. */ inset?: boolean; /** * Invoked on a change of the open panel. * Callback is passed the `panelId` of the `CollapsiblePanel` that originated the expand request and the `action` ("open" or "close") */ onChange?: SingleOpenPanelGroupChangeHandler; /** * Indicates the `panelId` of the currently expanded `CollapsiblePanel`. * Use only when using `SingleOpenPanelGroup` as a controlled component. */ openPanelId?: string | number | null; } interface SingleOpenPanelGroupControlledProps extends SingleOpenPanelGroupPropsBase { defaultOpenPanelId?: never; onChange: SingleOpenPanelGroupChangeHandler; openPanelId?: string | number | null; } interface SingleOpenPanelGroupUncontrolledProps extends SingleOpenPanelGroupPropsBase { defaultOpenPanelId?: string | number; openPanelId?: never; } type SingleOpenPanelGroupProps = ComponentProps; declare function SingleOpenPanelGroup({ children, defaultOpenPanelId, elementRef, inset, onChange, openPanelId, ...otherProps }: SingleOpenPanelGroupProps): React.JSX.Element; declare namespace SingleOpenPanelGroup { var propTypes: { children: PropTypes.Requireable; defaultOpenPanelId: PropTypes.Requireable; elementRef: PropTypes.Requireable; inset: PropTypes.Requireable; onChange: PropTypes.Requireable<(...args: any[]) => any>; openPanelId: PropTypes.Requireable; }; } export default SingleOpenPanelGroup; export { SingleOpenPanelGroupChangeHandler };