import type { MutableRefObject, ReactNode } from 'react'; import type { Action, AsProp, BaseProps, TestIdProp } from '@pega/cosmos-react-core'; /** * Resolved form factor the detail surface renders in. * - `docked` — an in-flow region that shares the host's layout box (e.g. the 40% of a split). * - `overlay` — floats over the host, anchored to the trailing edge (used on narrow hosts). * * The template host resolves this value before rendering the surface. */ export type DetailPanelPresentation = 'docked' | 'overlay'; /** * Describes the currently selected master item so the detail surface can render its identity and * enable/disable previous/next. Fully host-defined — the surface treats it as opaque. */ export interface MasterDetailHeader { /** Stable id of the selected item (used for keys and change detection). */ id: string; /** Primary text shown in the panel header (e.g. the record title). */ header?: string; /** Optional icon name rendered before the header text. */ icon?: string; /** Plain-text selection identity supplied by the host for announcements. */ accessibleName?: string; /** Step to the previous item. Omit to disable the previous control. */ onPrevious?: () => void; /** Step to the next item. Omit to disable the next control. */ onNext?: () => void; /** Standard static actions or a function that fetches actions when the header menu opens. */ actions?: Action[] | (() => Promise); } export interface PanelHeader extends MasterDetailHeader { } /** * Presentation resolved by the template host for the detail region. */ export type MasterDetailPresentation = DetailPanelPresentation; export interface MasterDetailNestedNavigation { /** Steps back to the previous detail. Omit when the current detail is not nested. */ back?: { onClick: () => void; /** Names the previous detail in the back control's accessible name. */ contextualLabel?: string; }; title?: ReactNode; icon?: string; } export interface MasterDetailProps extends AsProp, TestIdProp, BaseProps { /** The master surface (e.g. the table). Always rendered at full width until `open`. */ master: ReactNode; /** The detail content for the current selection. */ detail?: ReactNode; /** Controlled open state of the detail region. */ open: boolean; /** Current selection metadata forwarded to the panel header. */ selection?: MasterDetailHeader; /** Renders the detail body in a loading state. */ loading?: boolean; /** Host-resolved detail presentation. */ presentation: DetailPanelPresentation; /** Optional nested detail navigation state supplied by the host renderer. */ nestedNavigation?: MasterDetailNestedNavigation; /** Enable the drag-to-resize handle in docked mode. Default true. */ resizeable?: boolean; /** Docked split ratio configuration. Omit for an uncontrolled 60% ratio with a [20, 80] range. */ splitRatio?: { ratio: number; range?: [number, number]; }; /** Collapse the detail region and clear selection. */ onClose: () => void; /** Fired when the user drags the resize handle (host may persist the ratio). */ onResize?: (ratio: number) => void; /** Optional generic target that receives focus when detail closes. */ restoreFocusRef?: MutableRefObject; } //# sourceMappingURL=MasterDetail.types.d.ts.map