import { FloatingPanel as ArkFloatingPanel } from "@ark-ui/react/floating-panel"; import { injectComponentStyle } from "@bysages/core/styling"; import type { ComponentProps, ReactNode } from "react"; import { iconNode } from "../../internal/icon"; import { useElementId } from "../../internal/id"; /** Ark's FloatingPanel, dressed in the paper-and-ink system: the shared * popup vessel let loose — a draggable, resizable sheet whose header is the * handle. The API is Ark's own — Root, Trigger, Positioner, Content, Header, * Title, Control, DragTrigger, StageTrigger, CloseTrigger, ResizeTrigger, * Body. */ function FloatingPanelRoot(props: ComponentProps) { const id = useElementId("floating-panel", props); return ; } const resizeAxes = ["n", "e", "s", "w", "ne", "se", "sw", "nw"] as const; export interface FloatingPanelFacadeProps { open?: boolean; defaultOpen?: boolean; trigger?: string; content?: string; label: string; description?: string; disabled?: boolean; children?: ReactNode; onOpenChange?: (open: boolean) => void; } function FloatingPanelFacade({ open, defaultOpen, trigger, content, label, description, disabled = false, children, onOpenChange, }: FloatingPanelFacadeProps) { return ( onOpenChange?.(details.open)} > {trigger ?? label} {label} {iconNode("minus")} {iconNode("maximize-2")} {iconNode("x")} {description ?

{description}

: null} {content ?

{content}

: null} {children}
{resizeAxes.map((axis) => ( ))}
); } FloatingPanelFacade.displayName = "SFloatingPanel"; type FloatingPanelParts = typeof ArkFloatingPanel; /* Ark's namespace is frozen — spread copies the members so Root can be * the sized wrapper while the rest stay Ark's own parts. */ export const FloatingPanel = Object.assign(FloatingPanelFacade, { ...ArkFloatingPanel, Root: FloatingPanelRoot, }) as typeof FloatingPanelFacade & FloatingPanelParts; injectComponentStyle("floating-panel");