{"version":3,"file":"chunk-Panel.mjs","names":[],"sources":["../../src/components/Panel/Panel.tsx"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport { ark } from '@ark-ui/react/factory';\nimport React, { createContext, useContext } from 'react';\n\nimport { recipes } from '../../recipes.ts';\nimport { type Size } from '../../sizes.ts';\nimport { composableProps, slottable } from '../../util/slots.ts';\nimport { DefaultGutterProvider, type Gutter, type Level } from '../Container/Container.tsx';\n\n//\n// Root\n//\n\ntype PanelRootProps = {\n  size?: Size;\n  /** An absolute rung of the surface ladder; `base` by default, as the current Panel's content. */\n  level?: Exclude<Level, '+1'>;\n  /** `document` keeps a scrolling Body's content at the reading width, centred, while it still scrolls at the panel's edge. */\n  width?: 'document';\n  /**\n   * The gutter of the first Container under the Body when it names none (`sm`, the form inset, by default); content\n   * that puts icons in the rails names `gutter='rail'` itself.\n   */\n  gutter?: Exclude<Gutter, 'inherit'>;\n};\n\nconst PanelGutterContext = createContext<Exclude<Gutter, 'inherit'>>('sm');\n\n/**\n * The plank host: fills its parent, sets `data-size` and a level for its subtree, and is the pane's\n * query container, so its header, body and footer collapse at the same pane width.\n */\nconst PanelRoot = slottable<HTMLDivElement, PanelRootProps>(\n  ({ children, asChild, size, level = 'base', width, gutter = 'sm', ...props }, forwardedRef) => {\n    const { className, ...rest } = composableProps(props, { classNames: recipes.panel() });\n    return (\n      <PanelGutterContext.Provider value={gutter}>\n        <ark.div\n          asChild={asChild}\n          {...rest}\n          data-scope='panel'\n          data-part='root'\n          data-size={size}\n          data-surface={level}\n          data-width={width}\n          className={className}\n          ref={forwardedRef}\n        >\n          {children}\n        </ark.div>\n      </PanelGutterContext.Provider>\n    );\n  },\n);\n\nPanelRoot.displayName = 'Panel.Root';\n\n//\n// Header\n//\n\ntype PanelHeaderProps = {};\n\n/**\n * The top row on the bar aspect, which steps off whatever level hosts the panel; it sizes to its content, so it takes\n * no space when empty and one block when it holds a `Toolbar.Root`.\n */\nconst PanelHeader = slottable<HTMLDivElement, PanelHeaderProps>(({ children, asChild, ...props }, forwardedRef) => {\n  const { className, ...rest } = composableProps(props, { classNames: recipes.panelHeader() });\n  return (\n    <ark.div\n      asChild={asChild}\n      {...rest}\n      data-scope='panel'\n      data-part='header'\n      data-surface='bar'\n      className={className}\n      ref={forwardedRef}\n    >\n      {children}\n    </ark.div>\n  );\n});\n\nPanelHeader.displayName = 'Panel.Header';\n\n//\n// Body\n//\n\ntype PanelBodyProps = {};\n\n/**\n * The growing middle row, a plain slot: it neither scrolls nor adds a gutter, so content composes its own frame\n * (`asChild` onto a `ScrollArea.Root` around a Container, or a canvas that fills the row). The first Container under it\n * takes the panel's gutter unless it names one. Like the header and footer it is no query container, so its content\n * collapses against the panel.\n */\nconst PanelBody = slottable<HTMLDivElement, PanelBodyProps>(({ children, asChild, ...props }, forwardedRef) => {\n  const gutter = useContext(PanelGutterContext);\n  const { className, ...rest } = composableProps(props, { classNames: recipes.panelBody() });\n  return (\n    <DefaultGutterProvider gutter={gutter}>\n      <ark.div asChild={asChild} {...rest} data-scope='panel' data-part='body' className={className} ref={forwardedRef}>\n        {children}\n      </ark.div>\n    </DefaultGutterProvider>\n  );\n});\n\nPanelBody.displayName = 'Panel.Body';\n\n//\n// Footer\n//\n\ntype PanelFooterProps = {};\n\n/** The bottom row on the bar aspect; like Header it sizes to its content, holding a `Toolbar.Root` when it needs one. */\nconst PanelFooter = slottable<HTMLDivElement, PanelFooterProps>(({ children, asChild, ...props }, forwardedRef) => {\n  const { className, ...rest } = composableProps(props, { classNames: recipes.panelFooter() });\n  return (\n    <ark.div\n      asChild={asChild}\n      {...rest}\n      data-scope='panel'\n      data-part='footer'\n      data-surface='bar'\n      className={className}\n      ref={forwardedRef}\n    >\n      {children}\n    </ark.div>\n  );\n});\n\nPanelFooter.displayName = 'Panel.Footer';\nexport type {\n  PanelBodyProps as BodyProps,\n  PanelFooterProps as FooterProps,\n  PanelHeaderProps as HeaderProps,\n  PanelRootProps as RootProps,\n};\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