import { ComponentType, ReactNode } from 'react'; import { SvgIconProps, SxProps, Theme } from '@mui/material'; import { WrapperLabels } from './labels'; export interface WrapperProps { title: string; /** * Controlled collapsed state. When supplied, the wrapper is fully * controlled — the consumer is responsible for updating it via * `onCollapseChange`. Leave undefined to use the uncontrolled mode, * which seeds internal state from `defaultCollapsed`. */ collapsed?: boolean; /** * Fires whenever the user interacts to toggle the wrapper, with the * NEXT collapsed value. Called for both controlled and uncontrolled * usage — consumers can subscribe to user-driven toggles even when * letting the wrapper manage its own state. */ onCollapseChange?: (collapsed: boolean) => void; /** * Initial collapsed state when the wrapper is uncontrolled (i.e. * `collapsed` is undefined). Ignored when `collapsed` is supplied. */ defaultCollapsed?: boolean; disabled?: boolean; /** * Visual variant. `'elevation'` (default) renders a borderless shell; * `'outlined'` adds a 1px divider border around the card. */ variant?: 'outlined' | 'elevation'; labels?: Partial; /** * Icon shown at the right edge of the summary row. Accordion rotates it * 180° automatically when the wrapper expands. Default: `ExpandMoreIcon`. */ expandIcon?: ComponentType; iconProps?: SvgIconProps; sx?: SxProps; children: ReactNode; } /** * Widget shell — title + collapsible body, built on MUI `` for * native click-to-toggle on the summary header and a smooth open/close * transition. UX matches v1 ``: * * • hover-fade action buttons (always visible on coarse-pointer devices) * • multi-line title clamp (`WebkitLineClamp: 2`, word-break) + SmartTooltip * when the text overflows * • top-edge `` driven by the widget store's `isFetching` * • chevron at the right end (rotated by Accordion based on expanded state) * * Children are partitioned by component identity: `` and `` * render inside the summary row; everything else (``, `