// // Copyright 2026 DXOS.org // import { Primitive } from '@radix-ui/react-primitive'; import { Slot } from '@radix-ui/react-slot'; import React, { type CSSProperties } from 'react'; import { type SlottableProps } from '@dxos/ui-types'; import { useThemeContext } from '../../hooks'; import { PanelStyleProps } from '../../theme'; import { composableProps, slottable } from '../../util'; // // Root // const GRID_TEMPLATE_ROWS = 'auto 1fr auto'; const GRID_TEMPLATE_AREAS = '"toolbar" "content" "statusbar"'; type PanelRootProps = SlottableProps<{ style?: CSSProperties }>; const PanelRoot = slottable( ({ children, asChild, role, style, ...props }, forwardedRef) => { const { className, ...rest } = composableProps(props); const Comp = asChild ? Slot : Primitive.div; const { tx } = useThemeContext(); return ( {children} ); }, ); PanelRoot.displayName = 'Panel.Root'; // // Toolbar // type PanelToolbarProps = SlottableProps & Pick; const PanelToolbar = slottable>( ({ children, asChild, size, ...props }, forwardedRef) => { const { className, ...rest } = composableProps(props); const Comp = asChild ? Slot : Primitive.div; const { tx } = useThemeContext(); return ( {children} ); }, ); PanelToolbar.displayName = 'Panel.Toolbar'; // // Content // type PanelContentProps = SlottableProps; const PanelContent = slottable(({ children, asChild, ...props }, forwardedRef) => { const { className, ...rest } = composableProps(props); const Comp = asChild ? Slot : Primitive.div; const { tx } = useThemeContext(); return ( {children} ); }); PanelContent.displayName = 'Panel.Content'; // // Statusbar // type PanelStatusbarProps = SlottableProps & Pick; const PanelStatusbar = slottable>( ({ children, asChild, size, ...props }, forwardedRef) => { const { className, ...rest } = composableProps(props); const Comp = asChild ? Slot : Primitive.div; const { tx } = useThemeContext(); return ( {children} ); }, ); PanelStatusbar.displayName = 'Panel.Statusbar'; // // Panel // export const Panel = { Root: PanelRoot, Toolbar: PanelToolbar, Content: PanelContent, Statusbar: PanelStatusbar, }; export type { PanelContentProps, PanelRootProps, PanelStatusbarProps, PanelToolbarProps };