import type { HTMLAttributes, ReactNode } from "react"; import { cn } from "./cn.js"; import {ApplicationPanelFullscreen} from "./ApplicationPanelFullscreen.js"; import { Icon, type IconName } from "./Icon.js"; export interface ApplicationShellProps extends Omit, "content"> { header: ReactNode; stage: ReactNode; navigation?: ReactNode; content?: ReactNode; endPanel?: ReactNode; navigationOpen?: boolean; contentOpen?: boolean; contentExpanded?: boolean; endPanelOpen?: boolean; } export function ApplicationShell({ header, stage, navigation, content, endPanel, navigationOpen = false, contentOpen = false, contentExpanded = false, endPanelOpen = false, className, ...props }: ApplicationShellProps) { return ( {header} {stage} {navigationOpen && navigation ? {navigation} : null} {contentOpen && content ? {content} : null} {endPanel ? {endPanel} : null} ); } export interface ApplicationPanelProps extends Omit, "title"> { eyebrow?: ReactNode; title: ReactNode; description?: ReactNode; expanded?: boolean; /** Enables full-window presentation requested by an owned viewer through context. */ allowFullscreen?: boolean; expandLabel?: string; closeLabel?: string; onExpandedChange?: (expanded: boolean) => void; /** Persistent custom controls rendered before utility icon actions. */ headerTools?: ReactNode; /** Persistent utility actions rendered before expand/close in the panel header. */ utilityActions?: ApplicationPanelUtilityAction[]; onClose: () => void; children: ReactNode; } export interface ApplicationPanelUtilityAction { label: string; icon: IconName; onClick: () => void; disabled?: boolean; pressed?: boolean; } export function ApplicationPanel({ eyebrow, title, description, expanded = false, allowFullscreen = false, expandLabel = "Развернуть окно", closeLabel = "Закрыть окно", onExpandedChange, headerTools, utilityActions = [], onClose, children, className, ...props }: ApplicationPanelProps) { const panel = ( {eyebrow ? {eyebrow} : null} {title} {description ? {description} : null} {headerTools ? {headerTools} : null} {utilityActions.map((action) => ( ))} {onExpandedChange ? ( onExpandedChange(!expanded)} > ) : null} {children} ); return allowFullscreen ? {panel} : panel; }
{description}