import { type ComponentProps, type ReactNode, type RefObject } from 'react'; /** * Unstyled Carbon for IBM Products `SidePanel`, the behaviour of the styled one without a single * class: a `Panel` that slides in from the right (or left) and out again before it unmounts (none * with `--ui-duration-moderate-01` at 0, reduced motion, or a hidden page). Slide-over (default): * Tab stays inside the panel and Esc asks to close; `slideIn` pushes the page element * (`selectorPageContent`) aside instead, with no focus trap and no Esc. On open, focus goes to * `selectorInitialFocus`, else (slide-over) the first control; on close it goes back to what had it. * An `Overlay` dims the page, holds it still and asks to close when clicked (`'overlay'`, unless * `closeOnOverlayClick` is false). `Close` asks to close (`'close-button'`). * * A slide-over panel is on the page's overlay stack (core/overlay.ts): one Esc closes only the topmost * layer (a modal opened from the panel closes first). One opened from a modal goes over it, inside a * modal `` of its own (`layerClassName`; give its `::backdrop` no colour), so it can be used. * * Controlled: `onRequestClose(reason)`; set `open` to false to close. State shows as data * attributes: `data-open` and `data-closing` (sliding out) on `Panel` and `Overlay`, * `data-placement` (right | left) on `Panel`. * * ```tsx * setOpen(false)}> * * * × * … * * * ``` */ export type SidePanelCloseReason = 'escape' | 'close-button' | 'overlay'; export type SidePanelPlacement = 'right' | 'left'; export interface RootProps { open: boolean; /** Esc, `Close`, or a click on the `Overlay` asked to close; set `open` to false to close (Carbon `onRequestClose`). */ onRequestClose?: (reason: SidePanelCloseReason) => void; placement?: SidePanelPlacement; /** Push the page aside (`selectorPageContent`) instead of covering it; no focus trap, no Esc. */ slideIn?: boolean; /** A click on the `Overlay` asks to close (default true; Carbon `preventCloseOnClickOutside` turns it off). */ closeOnOverlayClick?: boolean; /** What takes focus on open (Carbon `selectorPrimaryFocus`), else the first control (slide-over). */ selectorInitialFocus?: string; /** The page element a slide-in panel pushes aside. */ selectorPageContent?: string; /** Class of the `` that holds the panel when it opens over a modal (make its `::backdrop` transparent). */ layerClassName?: string; /** Rendered while open and while the panel slides out. */ children?: ReactNode; } interface SidePanelContextValue { open: boolean; /** Sliding out after `open` turned false. */ closing: boolean; placement: SidePanelPlacement; slideIn: boolean; panel: RefObject; overlay: RefObject; requestClose: (reason: SidePanelCloseReason) => void; } /** The state of the enclosing `SidePanel.Root` (open, closing, `requestClose` …). */ export declare function useSidePanelContext(part?: string): SidePanelContextValue; /** Holds the open state, slides the panel, moves focus and listens for Esc; renders only its children, while shown. */ export declare function Root({ open, onRequestClose, placement, slideIn, closeOnOverlayClick, selectorInitialFocus, selectorPageContent, layerClassName, children }: Readonly): import("react").JSX.Element | null; /** The panel: Tab stays inside it unless `slideIn`; name it (`aria-label` or `aria-labelledby`). */ export declare function Panel({ ref, ...rest }: Readonly>): import("react").JSX.Element; /** Dims the page and holds it still while open; a click asks to close (`'overlay'`). Hidden from assistive technology. */ export declare function Overlay({ ref, ...rest }: Readonly>): import("react").JSX.Element; /** Asks to close (`'close-button'`); give it an `aria-label`. */ export declare function Close(props: Readonly, 'type'>>): import("react").JSX.Element; export {};