import { useId } from 'react'; import { FlexBox } from '../../atoms/flex-box'; import { Typography } from '../../atoms/typography'; import { Dialog } from '../../atoms/dialog'; import { Element } from '../../primitives/element'; import { cn } from '../../tools/cn'; import { SheetHead } from './components/SheetHead'; import { SheetPopover } from './components/SheetPopover'; import type { SheetProps } from './types'; import { sheetLayerVariants, sheetPanelVariants } from './variants'; /** * One surface in three placements: `bottom` for every mobile dialog, `side` for desktop detail * panels, `popover` for desktop share and support. Render the same content in the mobile and * desktop placement. Bottom and side panels take focus when they open; focus returns to the * trigger when they close. */ export function Sheet({ placement = 'bottom', open, title, icon, children, footer, onClose, closeLabel, dismissible = true, alert, className, }: SheetProps) { const titleId = useId(); if (placement === 'popover') { return ( {children} ); } return ( {placement === 'bottom' && ( )} {icon && {icon}} {children != null && ( // As Modal's body, so the same content reads the same on mobile and desktop. {children} )} {footer && ( {footer} )} ); }