@stackone/malachite 2.130.1 → 2.132.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPONENTS.md +5 -5
- package/dist/assets/icons/hexagon_fill.svg.js +6 -0
- package/dist/assets/icons/hexagon_fill.svg.js.map +1 -0
- package/dist/assets/icons/shield_star_fill.svg.js +6 -0
- package/dist/assets/icons/shield_star_fill.svg.js.map +1 -0
- package/dist/components/CodeBlock.js +130 -130
- package/dist/components/CodeBlock.js.map +1 -1
- package/dist/components/CodeBlockHighlighter.js +65 -65
- package/dist/components/CodeBlockHighlighter.js.map +1 -1
- package/dist/components/CodePreview.js +74 -63
- package/dist/components/CodePreview.js.map +1 -1
- package/dist/components/FormActions.js +44 -37
- package/dist/components/FormActions.js.map +1 -1
- package/dist/components/Hexagon.js +33 -26
- package/dist/components/Hexagon.js.map +1 -1
- package/dist/components/HexagonScale.js +20 -19
- package/dist/components/HexagonScale.js.map +1 -1
- package/dist/components/QueryInput.js +91 -90
- package/dist/components/QueryInput.js.map +1 -1
- package/dist/components/SidePanel.js +275 -234
- package/dist/components/SidePanel.js.map +1 -1
- package/dist/components/codeBlockStyles.js +11 -6
- package/dist/components/codeBlockStyles.js.map +1 -1
- package/dist/components/codePreviewJson.js +25 -0
- package/dist/components/codePreviewJson.js.map +1 -0
- package/dist/index.d.ts +52 -22
- package/dist/tailwind.css.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidePanel.js","sources":["../../src/components/SidePanel.tsx"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { ShadowRootWrapper } from '../ShadowRootWrapper';\nimport type { AlertType } from './Alert';\nimport CalloutStrip from './CalloutStrip';\nimport ArrowLeftIcon from './CustomIcons/ArrowLeftIcon';\nimport ArrowLineLeftIcon from './CustomIcons/ArrowLineLeftIcon';\nimport ArrowLineRightIcon from './CustomIcons/ArrowLineRightIcon';\nimport DismissIcon from './CustomIcons/DismissIcon';\nimport type { RenderLink } from './PageLayout/types';\nimport SidePanelSheetLayer, { type SidePanelSheet } from './SidePanelSheet';\nimport SidePanelTabs from './SidePanelTabs';\nimport SidePanelTitle from './SidePanelTitle';\nimport EllipsisText from './Typography/EllipsisText';\nimport { afterNextPaint } from './afterNextPaint';\nimport { FOCUS_RING } from './focusRing';\nimport { inertWhen } from './inert';\nimport { OVERLAY_ICON_BUTTON_CLASSES, useOverlayBehaviour } from './overlayBehaviour';\nimport { OVERLAY_ELEVATED_ATTR, type OverlayStacking, overlayIdentity } from './portalOverlay';\nimport { SidePanelOverlayContext } from './sidePanelOverlay';\nimport { SidePanelTabsContext, type SidePanelTabsContextValue } from './sidePanelTabsContext';\n\nexport interface SidePanelProps {\n open: boolean;\n /** Dismiss handler — close button, ESC, or overlay click. */\n onClose: () => void;\n title: React.ReactNode;\n subtitle?: React.ReactNode;\n /** `below` stacks the subtitle under the title, so neither truncates the other. */\n subtitlePlacement?: 'inline' | 'below';\n /** With the subtitle `below`: content at the far end of the subtitle's row, such as what comes next. */\n subtitleExtra?: React.ReactNode;\n /** Content at the end of the title row, after the subtitle (e.g. a status tag). */\n titleExtra?: React.ReactNode;\n /** Block paragraph below the title row, spanning the header width. Announced as the panel's description. */\n description?: React.ReactNode;\n /** Pinned between the header and the scrolling body. */\n toolbar?: React.ReactNode;\n /** `body` insets the toolbar 28px, level with the body. Default: `default`. */\n toolbarPadding?: 'default' | 'body';\n /** Divider under the header. Default: false. */\n headerDivider?: boolean;\n /** Leading header slot, typically a logo or icon. */\n icon?: React.ReactNode;\n /** Content pinned right in the header, before the close button. */\n headerExtra?: React.ReactNode;\n footer?: React.ReactNode;\n /**\n * Makes the panel's header, body and footer one form. Enter in a field then submits through\n * a `type=\"submit\"` button in the footer (see `FormActions`), the way a browser form does:\n * not from a textarea, not mid-composition, and not while that button is disabled. The\n * event's default is prevented and validation is the caller's, so the form is `noValidate`.\n * Enter in the `toolbar` never submits. A field inside its own `MalachiteContext` sits in\n * another shadow root and is outside the form.\n */\n onSubmit?: (event: React.FormEvent<HTMLFormElement>) => void;\n /** Renders a back button before the header icon. */\n onBack?: () => void;\n /** Maximum panel width. Default: 1080. */\n maxWidth?: number | string;\n /** Accessible dialog name; required when `title` isn't a plain string. */\n 'aria-label'?: string;\n /** ID of a visible element naming the dialog (alternative to `aria-label`). */\n 'aria-labelledby'?: string;\n /** Whether the body gets default padding. Default: true. */\n bodyPadding?: boolean;\n /** `above-app-overlays` lifts the overlay stack clear of chrome pinned near max-int. */\n stacking?: OverlayStacking;\n /** Full-width Alert bands at the top of the body, above `children`, in order. Unaffected by\n * `bodyPadding`, and announced ahead of `description`. The message is markdown. */\n callouts?: { type?: AlertType; message: string }[];\n /** Routes root-relative links in `callouts` through the app's router; see `MarkdownBlock`. */\n renderLink?: RenderLink;\n /** A full-height column opened to the left, as wide again as `maxWidth`. The panel's own\n * header, body and footer keep their width and place; the aside's header and footer line\n * up with them. The aside is never narrower than 360px: a window too narrow for both\n * columns scrolls the panel sideways. */\n aside?: SidePanelAside;\n /** A drill-in raised over the body and footer, dimming the header; see `SidePanelSheet`. */\n sheet?: SidePanelSheet;\n /** How far through a multi-step form, from 0 to 1: a line along the foot of the header, or\n * of the `subheader` when there is one. */\n progress?: number;\n /**\n * A band under the header, above the body, with a rule below it: a wizard's step and what\n * comes next, say. It leaves the header at its usual height, level with the page's own.\n */\n subheader?: React.ReactNode;\n children: React.ReactNode;\n}\n\nexport type { SidePanelSheet };\n\nexport interface SidePanelAside {\n /** Shown in the aside's header, and names the column for assistive tech. */\n title: string;\n /** Content pinned right in the aside's header (e.g. a stepper). */\n headerExtra?: React.ReactNode;\n /** Pinned at the bottom, level with the panel's footer. */\n footer?: React.ReactNode;\n /** Whether the aside's body gets default padding, as the panel's `bodyPadding`. Default: true. */\n bodyPadding?: boolean;\n /**\n * `detached` draws the aside as a card of its own on the warm ground, tucked behind the\n * panel's left edge, which slides out from behind it and back. Default: `column`, a column\n * of the panel itself.\n */\n layout?: 'column' | 'detached';\n /** `detached` only: whether the card is out. Default: true. */\n open?: boolean;\n /**\n * `detached` only: adds a button to the card's header that tucks it away, and while it is\n * away a tab on the panel's edge that brings it back.\n */\n onOpenChange?: (open: boolean) => void;\n /** `detached` only: the edge tab's text. Default: `Open ` and the title. */\n tabLabel?: string;\n /** `detached` only: an icon before the edge tab's text, as the control that opens the aside shows. */\n tabIcon?: React.ReactNode;\n children: React.ReactNode;\n}\n\nconst TRANSITION_MS = 200;\nconst ASIDE_MIN_WIDTH = '360px';\n// How far a detached aside runs under the panel, so its card reads as coming from behind it.\nconst ASIDE_TUCK_PX = 16;\nconst SLIDE_MS = 320;\nconst SLIDE_EASE = 'cubic-bezier(0.2, 0.8, 0.2, 1)';\nconst WARM_BACKGROUND = 'var(--malachite-card-warm-background, rgb(244, 242, 240))';\n\nconst prefersReducedMotion = (): boolean =>\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n\n// The width of the panel card's border, which its rows sit inside and a detached aside does not.\nconst CARD_BORDER_PX = 1;\nconst withCardBorder = (height: number | undefined): number | undefined =>\n height === undefined ? undefined : height + CARD_BORDER_PX;\n\n/** The panel header's and footer's heights, so a detached aside's own can match them. */\nconst useRowHeights = (\n enabled: boolean,\n header: HTMLElement | null,\n footer: HTMLElement | null,\n): { header?: number; footer?: number } => {\n const [heights, setHeights] = useState<{ header?: number; footer?: number }>({});\n\n useEffect(() => {\n if (!enabled || typeof ResizeObserver === 'undefined') {\n return undefined;\n }\n const measure = () =>\n setHeights({\n header: header?.getBoundingClientRect().height,\n footer: footer?.getBoundingClientRect().height,\n });\n const observer = new ResizeObserver(measure);\n if (header) {\n observer.observe(header);\n }\n if (footer) {\n observer.observe(footer);\n }\n measure();\n return () => observer.disconnect();\n }, [enabled, header, footer]);\n\n return heights;\n};\n\ninterface ScrollingBodyProps {\n bodyPadding: boolean;\n className?: string;\n callouts?: { type?: AlertType; message: string }[];\n /** Prefix for each callout's id, which the panel names in `aria-describedby`. */\n calloutId?: string;\n renderLink?: RenderLink;\n stableGutter?: boolean;\n scrollerRef?: React.Ref<HTMLDivElement>;\n children: React.ReactNode;\n}\n\nconst ScrollingBody: React.FC<ScrollingBodyProps> = ({\n bodyPadding,\n className = '',\n callouts,\n calloutId,\n renderLink,\n stableGutter = false,\n scrollerRef,\n children,\n}) => {\n const hasCallouts = !!callouts?.length;\n\n // Callouts move the horizontal padding inward so their strips run full-bleed.\n return (\n <div\n ref={scrollerRef}\n className={`min-h-0 flex-1 overflow-y-auto [scrollbar-color:var(--malachite-text-dimmed)_transparent] ${stableGutter ? '[scrollbar-gutter:stable]' : ''} ${bodyPadding && !hasCallouts ? 'px-[28px]' : ''} ${className}`}\n >\n {callouts?.map((callout, index) => (\n <CalloutStrip\n key={index}\n id={calloutId ? `${calloutId}-${index}` : undefined}\n type={callout.type}\n message={callout.message}\n renderLink={renderLink}\n />\n ))}\n {bodyPadding ? (\n <div className={hasCallouts ? 'p-[28px]' : 'py-[28px]'}>{children}</div>\n ) : (\n children\n )}\n </div>\n );\n};\n\nconst toCssSize = (value: number | string): string =>\n typeof value === 'number' ? `${value}px` : value;\n\n// The toolbar holds filters, such as a Search over the list, never a field the form saves.\nconst cancelToolbarSubmit = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Enter' && event.target instanceof HTMLInputElement) {\n event.preventDefault();\n }\n};\n\nconst PANEL_COLUMN_CLASSES =\n 'isolate col-start-2 row-span-3 row-start-1 grid min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-subgrid';\n\n// The panel's own column, which is the form when the panel has one, so the header, body and\n// footer stay the subgrid's three rows either way.\nconst PanelColumn: React.FC<{\n onSubmit?: (event: React.FormEvent<HTMLFormElement>) => void;\n children: React.ReactNode;\n}> = ({ onSubmit, children }) =>\n onSubmit ? (\n <form\n noValidate\n className={PANEL_COLUMN_CLASSES}\n onSubmit={(event) => {\n event.preventDefault();\n // React bubbles it through the portal to a consumer's own form around the panel.\n event.stopPropagation();\n onSubmit(event);\n }}\n >\n {children}\n </form>\n ) : (\n <div className={PANEL_COLUMN_CLASSES}>{children}</div>\n );\n\n/**\n * A right-hand slide-in overlay panel (drawer) for inspecting or editing an entity\n * without leaving the page. Portals to `document.body`, locks background scroll and\n * traps keyboard focus while open (restoring both on close), dismisses on ESC\n * (topmost open overlay only), overlay click or the close button, and exposes header\n * (back/icon/title/subtitle/extra), scrollable body and optional footer slots.\n */\nconst SidePanel: React.FC<SidePanelProps> & { Tabs: typeof SidePanelTabs } = ({\n open,\n onClose,\n title,\n subtitle,\n subtitlePlacement = 'inline',\n subtitleExtra,\n titleExtra,\n description,\n toolbar,\n toolbarPadding = 'default',\n headerDivider = false,\n icon,\n headerExtra,\n footer,\n onSubmit,\n onBack,\n maxWidth = 1080,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n bodyPadding = true,\n stacking = 'default',\n callouts,\n renderLink,\n aside,\n sheet,\n progress,\n subheader,\n children,\n}) => {\n const calloutId = useId();\n const [stripSlot, setStripSlot] = useState<HTMLDivElement | null>(null);\n const [tabSets, setTabSets] = useState(0);\n const registerTabs = useCallback(() => {\n setTabSets((count) => count + 1);\n return () => setTabSets((count) => count - 1);\n }, []);\n const [scroller, setScroller] = useState<HTMLDivElement | null>(null);\n const tabsContext = useMemo<SidePanelTabsContextValue>(\n () => ({ stripSlot, scroller, registerTabs }),\n [stripSlot, scroller, registerTabs],\n );\n const [overlayLayer, setOverlayLayer] = useState<HTMLDivElement | null>(null);\n const [panelHeader, setPanelHeader] = useState<HTMLDivElement | null>(null);\n const [panelFooter, setPanelFooter] = useState<HTMLDivElement | null>(null);\n const detached = aside?.layout === 'detached';\n const asideOpen = detached ? (aside?.open ?? true) : !!aside;\n const rowHeights = useRowHeights(detached, panelHeader, panelFooter);\n const descriptionId = useId();\n const [isVisible, setIsVisible] = useState(false);\n const [isMounted, setIsMounted] = useState(false);\n const frameRef = useRef<number | null>(null);\n const unmountTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const hostRef = useRef<HTMLDivElement | null>(null);\n const {\n ref: handlePanelRef,\n isTopmost,\n zIndex,\n elevated,\n } = useOverlayBehaviour({\n open,\n onClose: sheet ? sheet.onClose : onClose,\n elevated: stacking === 'above-app-overlays',\n hostRef,\n });\n\n const lastSheet = useRef(sheet);\n useLayoutEffect(() => {\n if (open) {\n lastSheet.current = sheet;\n }\n });\n\n useEffect(() => {\n if (open) {\n setIsMounted(true);\n if (unmountTimerRef.current) {\n clearTimeout(unmountTimerRef.current);\n unmountTimerRef.current = null;\n }\n afterNextPaint(frameRef, () => setIsVisible(true));\n } else {\n setIsVisible(false);\n unmountTimerRef.current = setTimeout(() => {\n unmountTimerRef.current = null;\n setIsMounted(false);\n }, TRANSITION_MS);\n }\n return () => {\n if (frameRef.current !== null) {\n cancelAnimationFrame(frameRef.current);\n frameRef.current = null;\n }\n if (unmountTimerRef.current) {\n clearTimeout(unmountTimerRef.current);\n unmountTimerRef.current = null;\n }\n };\n }, [open]);\n\n if (!isMounted) {\n return null;\n }\n\n const closePanel = () => {\n sheet?.onClose();\n onClose();\n };\n const shownSheet = open ? sheet : lastSheet.current;\n\n const shownCallouts = callouts?.filter((callout) => callout.message.trim());\n const panelColumnWidth = `calc(${toCssSize(maxWidth)} - 2px)`;\n const dividerBelow = headerDivider\n ? 'border-0 border-b border-solid border-[var(--malachite-card-border)]'\n : '';\n // The panel's header row is 56px on its own, so its rule is drawn inside that rather than\n // under it, landing on the page header's rule and the detached aside's.\n const ruleInside = headerDivider\n ? '[box-shadow:inset_0_-1px_0_var(--malachite-card-border)]'\n : '';\n // Each column is a subgrid of the panel's three rows, so the aside's header and footer\n // stay level with the panel's whatever their content. The panel's own column is always the\n // second, so opening or closing the aside never remounts it or reflows it mid-transition:\n // without an aside the first column is simply empty and narrows to nothing.\n const asideColumn =\n aside && !detached ? (\n <aside\n aria-label={aside.title}\n {...inertWhen(!!shownSheet)}\n className=\"col-start-1 row-span-3 row-start-1 grid min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-subgrid overflow-hidden border-0 border-r border-solid border-[var(--malachite-card-border)]\"\n >\n <div\n className={`box-border flex min-h-[56px] min-w-0 items-center gap-[8px] px-[20px] py-[8px] ${dividerBelow}`}\n >\n <span className=\"flex min-w-0 shrink-0\">\n <SidePanelTitle>{aside.title}</SidePanelTitle>\n </span>\n {aside.headerExtra ? (\n <span className=\"ml-auto flex shrink-0 items-center\">\n {aside.headerExtra}\n </span>\n ) : null}\n </div>\n <div className={`flex min-h-0 flex-col ${aside.footer ? '' : 'row-span-2'}`}>\n <ScrollingBody bodyPadding={aside.bodyPadding ?? true}>\n {aside.children}\n </ScrollingBody>\n </div>\n {aside.footer ? (\n <div className=\"border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]\">\n {aside.footer}\n </div>\n ) : null}\n </aside>\n ) : null;\n\n const subtitleBelow = subtitlePlacement === 'below' && !!subtitle;\n const titleNode = (\n <span\n className={subtitleBelow ? 'flex min-w-0 shrink' : 'flex min-w-0 max-w-full shrink-0'}\n >\n <SidePanelTitle>{title}</SidePanelTitle>\n </span>\n );\n const subtitleNode = subtitle ? (\n <EllipsisText\n tooltip={subtitle}\n tooltipWhenTruncated\n tooltipPlacement=\"bottom\"\n color=\"secondary\"\n className=\"min-w-0 text-[13px]\"\n >\n {subtitle}\n </EllipsisText>\n ) : null;\n const titleExtraNode = titleExtra ? (\n <span className=\"flex shrink-0 items-center\">{titleExtra}</span>\n ) : null;\n const headerExtraNode = headerExtra ? (\n <span className=\"flex shrink-0 items-baseline\">{headerExtra}</span>\n ) : null;\n\n const progressLine =\n progress === undefined ? null : (\n <span\n aria-hidden=\"true\"\n // Under a subheader the rule is a border, which the line covers; on the header it is drawn inside.\n className={`absolute ${subheader ? 'bottom-[-1px]' : 'bottom-0'} left-0 h-[3px] bg-[var(--malachite-accent-foreground)]`}\n style={{\n width: `${Math.round(Math.min(1, Math.max(0, progress)) * 100)}%`,\n transition: prefersReducedMotion() ? undefined : 'width 280ms ease-out',\n }}\n />\n );\n const panelColumn = (\n <>\n {/* An explicit column: an implicit one is sized to its widest content and overflows the panel. */}\n <PanelColumn onSubmit={onSubmit}>\n <div\n ref={setPanelHeader}\n // 56px, the page header's height, so the panel's rule lands on the page's.\n className={`relative box-border flex min-h-[56px] flex-col justify-center px-[20px] ${ruleInside}`}\n {...inertWhen(!!shownSheet)}\n >\n {subheader ? null : progressLine}\n {/* 56px whether or not a description follows, so the title and close button sit\n where they do in a one-line header, the close as far from the top as the side. */}\n <div className=\"flex min-h-[56px] items-center gap-[12px] py-[8px]\">\n {onBack ? (\n <button\n type=\"button\"\n aria-label=\"Back\"\n onClick={onBack}\n className={OVERLAY_ICON_BUTTON_CLASSES}\n >\n <ArrowLeftIcon size={16} />\n </button>\n ) : null}\n {icon ? <span className=\"flex shrink-0 items-center\">{icon}</span> : null}\n {subtitleBelow ? (\n <div className=\"flex min-w-0 flex-1 items-center gap-[12px]\">\n <div className=\"flex min-w-0 flex-1 flex-col gap-[2px]\">\n <div className=\"flex min-w-0 items-baseline gap-[8px]\">\n {titleNode}\n {titleExtraNode}\n </div>\n {subtitleExtra ? (\n <div className=\"flex min-w-0 items-baseline gap-[12px]\">\n {subtitleNode}\n <span className=\"ml-auto flex shrink-0 items-baseline text-[13px]\">\n {subtitleExtra}\n </span>\n </div>\n ) : (\n subtitleNode\n )}\n </div>\n {headerExtraNode}\n </div>\n ) : (\n <div className=\"flex min-w-0 flex-1 items-baseline gap-[12px]\">\n <div className=\"flex min-w-0 flex-1 items-baseline gap-[8px]\">\n <div className=\"flex min-w-0 items-baseline gap-[8px]\">\n {titleNode}\n {subtitleNode}\n </div>\n {titleExtraNode}\n </div>\n {headerExtraNode}\n </div>\n )}\n <button\n type=\"button\"\n aria-label=\"Close\"\n onClick={closePanel}\n className={OVERLAY_ICON_BUTTON_CLASSES}\n >\n <DismissIcon size={10} />\n </button>\n </div>\n {description ? (\n <div\n id={descriptionId}\n className=\"-mt-[8px] pb-[16px] text-[13px] leading-[1.6] text-[var(--malachite-text-secondary)]\"\n >\n {description}\n </div>\n ) : null}\n </div>\n {/* The toolbar shares the body's row, so an aside's header and footer stay level. */}\n <div\n className={`flex min-h-0 flex-col ${footer ? '' : 'row-span-2'}`}\n {...inertWhen(!!shownSheet)}\n >\n {subheader ? (\n <div className=\"relative box-border flex min-h-[56px] shrink-0 items-center border-0 border-b border-solid border-[var(--malachite-card-border)] px-[20px]\">\n <div className=\"min-w-0 flex-1\">{subheader}</div>\n {progressLine}\n </div>\n ) : null}\n {toolbar ? (\n <div\n className={`shrink-0 pt-[16px] pb-[8px] ${toolbarPadding === 'body' ? 'px-[28px]' : 'px-[16px]'}`}\n onKeyDown={onSubmit ? cancelToolbarSubmit : undefined}\n >\n {toolbar}\n </div>\n ) : null}\n <div ref={setStripSlot} className=\"shrink-0 px-[28px] empty:hidden\" />\n <ScrollingBody\n bodyPadding={bodyPadding}\n callouts={shownCallouts}\n calloutId={calloutId}\n renderLink={renderLink}\n stableGutter={tabSets > 0}\n scrollerRef={setScroller}\n >\n <SidePanelTabsContext.Provider value={tabsContext}>\n {children}\n </SidePanelTabsContext.Provider>\n </ScrollingBody>\n </div>\n {footer ? (\n <div\n ref={setPanelFooter}\n className=\"border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]\"\n {...inertWhen(!!shownSheet)}\n >\n {footer}\n </div>\n ) : null}\n </PanelColumn>\n </>\n );\n\n const asideWidth = `max(${ASIDE_MIN_WIDTH}, min(${toCssSize(maxWidth)}, calc(100vw - ${toCssSize(maxWidth)} - 40px)))`;\n const slide = (open: boolean): React.CSSProperties =>\n prefersReducedMotion()\n ? {}\n : {\n transition: `transform ${SLIDE_MS}ms ${SLIDE_EASE}, opacity ${TRANSITION_MS}ms, visibility 0s linear ${open ? 0 : SLIDE_MS}ms`,\n };\n // Out, the card sits beside the panel with its last few pixels under the panel's edge; away,\n // it slides right until it is hidden behind the panel, and leaves the tab order once there.\n const detachedAside =\n aside && detached ? (\n <aside\n aria-label={aside.title}\n aria-hidden={asideOpen ? undefined : true}\n {...inertWhen(!!shownSheet)}\n className=\"absolute top-0 bottom-0 grid grid-cols-[minmax(0,1fr)] grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden rounded-l-[16px] text-[var(--malachite-card-foreground)] [box-shadow:var(--malachite-shadow-lg)]\"\n style={{\n right: `calc(100% - ${ASIDE_TUCK_PX}px)`,\n width: `calc(${asideWidth} + ${ASIDE_TUCK_PX}px)`,\n paddingRight: ASIDE_TUCK_PX,\n boxSizing: 'border-box',\n background: WARM_BACKGROUND,\n transform: asideOpen\n ? 'translateX(0)'\n : `translateX(calc(100% - ${ASIDE_TUCK_PX}px))`,\n opacity: asideOpen ? 1 : 0,\n visibility: asideOpen ? 'visible' : 'hidden',\n ...slide(asideOpen),\n }}\n >\n {/* The aside starts at the card's outer edge, the panel's rows inside its 1px\n border, so each of its rows is that much taller to put its rule on theirs. */}\n <div\n className=\"box-border flex min-w-0 items-center gap-[10px] px-[20px] py-[8px] [box-shadow:inset_0_-1px_0_var(--malachite-card-border)]\"\n style={{ minHeight: withCardBorder(rowHeights.header) }}\n >\n {/* The title keeps its width and at least the header's own padding from the\n controls, which give way first in a narrow card. */}\n <span className=\"mr-[10px] flex shrink-0\">\n <SidePanelTitle>{aside.title}</SidePanelTitle>\n </span>\n {aside.headerExtra ? (\n <span className=\"ml-auto flex min-w-0 shrink items-center justify-end\">\n {aside.headerExtra}\n </span>\n ) : null}\n {aside.onOpenChange ? (\n <button\n type=\"button\"\n aria-label={`Collapse ${aside.title}`}\n title={`Collapse ${aside.title}`}\n onClick={() => aside.onOpenChange?.(false)}\n className={OVERLAY_ICON_BUTTON_CLASSES}\n >\n <ArrowLineRightIcon size={16} />\n </button>\n ) : null}\n </div>\n <div className={`flex min-h-0 flex-col ${aside.footer ? '' : 'row-span-2'}`}>\n <ScrollingBody\n bodyPadding={aside.bodyPadding ?? true}\n // A shade darker than the default thumb, which barely shows on the warm ground.\n className=\"[scrollbar-color:var(--malachite-text-dimmed)_transparent]\"\n >\n {aside.children}\n </ScrollingBody>\n </div>\n {aside.footer ? (\n <div\n className=\"box-border flex flex-col justify-center border-0 border-t border-solid border-[var(--malachite-card-border)] px-[20px] py-[12px]\"\n style={{ minHeight: withCardBorder(rowHeights.footer) }}\n >\n {aside.footer}\n </div>\n ) : null}\n </aside>\n ) : null;\n const tabLabel = aside?.tabLabel ?? `Open ${aside?.title ?? ''}`;\n const edgeTab =\n aside && detached && !asideOpen && aside.onOpenChange ? (\n <button\n type=\"button\"\n aria-label={tabLabel}\n title={tabLabel}\n onClick={() => aside.onOpenChange?.(true)}\n // The aside's own warm ground, 40px across, read bottom to top: any icon, the\n // text, then the arrow 12px on. Its top sits where the card's 20px corner ends,\n // level with the aside's collapse button once open.\n // 2px more on the outer side than the inner, so the label sits off the panel edge.\n className={`absolute flex cursor-pointer flex-col items-center rounded-l-[14px] border-0 py-[12px] pr-0 pl-[2px] text-[13px] font-medium text-[var(--malachite-text-primary)] [box-shadow:var(--malachite-shadow-lg)] ${FOCUS_RING}`}\n style={{ right: '100%', top: 20, width: 42, background: WARM_BACKGROUND }}\n >\n <ArrowLineLeftIcon size={16} />\n <span aria-hidden=\"true\" style={{ height: 12, flexShrink: 0 }} />\n <span\n aria-hidden=\"true\"\n style={{\n writingMode: 'vertical-rl',\n transform: 'rotate(180deg)',\n whiteSpace: 'nowrap',\n }}\n >\n {tabLabel}\n </span>\n {aside.tabIcon ? (\n <span aria-hidden=\"true\" className=\"mt-[8px] flex\">\n {aside.tabIcon}\n </span>\n ) : null}\n </button>\n ) : null;\n // Spans the panel and an open detached aside, for an enlarged image over both.\n const overlayLayerElement = (\n <div\n ref={setOverlayLayer}\n className=\"pointer-events-none absolute top-0 right-0 bottom-0 z-[20]\"\n style={{\n left: detached && asideOpen ? `calc(-1 * ${asideWidth})` : 0,\n }}\n />\n );\n const cardClasses =\n 'grid grid-rows-[auto_minmax(0,1fr)_auto] rounded-[20px] border border-solid border-[var(--malachite-card-border)] bg-[var(--malachite-card-background)] text-[var(--malachite-card-foreground)] [box-shadow:var(--malachite-shadow-lg)]';\n\n return createPortal(\n // Host carries the stacking context — ShadowRootWrapper's `isolation` would\n // otherwise flatten our z-index and let sticky page elements paint over us.\n <ShadowRootWrapper\n hostRef={hostRef}\n hostStyle={{ position: 'relative', zIndex }}\n hostProps={\n elevated\n ? { ...overlayIdentity('sidepanel'), [OVERLAY_ELEVATED_ATTR]: '' }\n : overlayIdentity('sidepanel')\n }\n >\n <SidePanelTabsContext.Provider value={null}>\n <div className=\"fixed inset-0 z-[1000]\">\n <div\n aria-hidden=\"true\"\n onClick={closePanel}\n className={`absolute inset-0 bg-[var(--malachite-overlay-scrim)] transition-opacity duration-200 ease-in-out ${\n isVisible ? 'opacity-100' : 'opacity-0'\n }`}\n />\n <div\n ref={handlePanelRef}\n role=\"dialog\"\n // Only the topmost overlay may claim it, or a screen reader can still\n // browse the one underneath.\n aria-modal={isTopmost ? 'true' : undefined}\n aria-describedby={\n [\n ...(shownCallouts ?? []).map((_, index) => `${calloutId}-${index}`),\n description ? descriptionId : null,\n ]\n .filter(Boolean)\n .join(' ') || undefined\n }\n tabIndex={-1}\n // Prefer aria-labelledby; only fall back to aria-label when it's absent.\n aria-label={\n ariaLabelledBy\n ? undefined\n : (ariaLabel ?? (typeof title === 'string' ? title : undefined))\n }\n aria-labelledby={ariaLabelledBy}\n // Detached, the dialog holds the panel's card and the aside's side by side, so it\n // carries none of the card's own look and does not clip the aside.\n className={\n detached\n ? 'absolute top-[8px] right-[8px] bottom-[8px] outline-none'\n : `absolute top-[8px] right-[8px] bottom-[8px] overflow-x-auto overflow-y-hidden outline-none ${cardClasses}`\n }\n style={{\n width: `min(calc(100% - 16px), ${aside && !detached ? `calc(2 * ${toCssSize(maxWidth)})` : toCssSize(maxWidth)})`,\n // Inline: Tailwind translate utilities silently break inside\n // shadow roots (see CLAUDE.md Shadow DOM caveats).\n transform: isVisible\n ? 'translateX(0)'\n : 'translateX(calc(100% + 16px))',\n transition: `transform ${TRANSITION_MS}ms ease-in-out, width ${TRANSITION_MS}ms ease-in-out, grid-template-columns ${TRANSITION_MS}ms ease-in-out`,\n // The panel's own column is the width it has without an aside: `maxWidth`\n // less the 1px border either side, so opening the aside never widens it.\n // With an aside neither column gives way, so a narrow window scrolls the\n // panel instead. Both templates share one shape so the minimums animate\n // with the width rather than overflowing mid-transition.\n gridTemplateColumns: detached\n ? undefined\n : aside\n ? `minmax(${ASIDE_MIN_WIDTH}, 1fr) minmax(${panelColumnWidth}, ${panelColumnWidth})`\n : `minmax(0px, 1fr) minmax(0px, ${panelColumnWidth})`,\n }}\n >\n <SidePanelOverlayContext.Provider value={overlayLayer}>\n {detached ? (\n <>\n {detachedAside}\n {edgeTab}\n <div\n className={`absolute inset-0 overflow-hidden ${cardClasses}`}\n style={{\n gridTemplateColumns: `0px minmax(0px, 1fr)`,\n }}\n >\n {panelColumn}\n {shownSheet ? (\n <SidePanelSheetLayer sheet={shownSheet} />\n ) : null}\n </div>\n </>\n ) : (\n <>\n {asideColumn}\n {panelColumn}\n {shownSheet ? <SidePanelSheetLayer sheet={shownSheet} /> : null}\n </>\n )}\n {overlayLayerElement}\n </SidePanelOverlayContext.Provider>\n </div>\n </div>\n </SidePanelTabsContext.Provider>\n </ShadowRootWrapper>,\n document.body,\n );\n};\n\nSidePanel.Tabs = SidePanelTabs;\n\nexport default SidePanel;\nexport { SidePanel };\n"],"names":["TRANSITION_MS","ASIDE_MIN_WIDTH","ASIDE_TUCK_PX","SLIDE_MS","SLIDE_EASE","WARM_BACKGROUND","prefersReducedMotion","CARD_BORDER_PX","withCardBorder","height","useRowHeights","enabled","header","footer","heights","setHeights","useState","useEffect","measure","observer","ScrollingBody","bodyPadding","className","callouts","calloutId","renderLink","stableGutter","scrollerRef","children","hasCallouts","jsxs","callout","index","jsx","CalloutStrip","toCssSize","value","cancelToolbarSubmit","event","PANEL_COLUMN_CLASSES","PanelColumn","onSubmit","SidePanel","open","onClose","title","subtitle","subtitlePlacement","subtitleExtra","titleExtra","description","toolbar","toolbarPadding","headerDivider","icon","headerExtra","onBack","maxWidth","ariaLabel","ariaLabelledBy","stacking","aside","sheet","progress","subheader","useId","stripSlot","setStripSlot","tabSets","setTabSets","registerTabs","useCallback","count","scroller","setScroller","tabsContext","useMemo","overlayLayer","setOverlayLayer","panelHeader","setPanelHeader","panelFooter","setPanelFooter","detached","asideOpen","rowHeights","descriptionId","isVisible","setIsVisible","isMounted","setIsMounted","frameRef","useRef","unmountTimerRef","hostRef","handlePanelRef","isTopmost","zIndex","elevated","useOverlayBehaviour","lastSheet","useLayoutEffect","afterNextPaint","closePanel","shownSheet","shownCallouts","panelColumnWidth","dividerBelow","ruleInside","asideColumn","inertWhen","SidePanelTitle","subtitleBelow","titleNode","subtitleNode","EllipsisText","titleExtraNode","headerExtraNode","progressLine","panelColumn","Fragment","OVERLAY_ICON_BUTTON_CLASSES","ArrowLeftIcon","DismissIcon","SidePanelTabsContext","asideWidth","slide","detachedAside","_a","ArrowLineRightIcon","tabLabel","edgeTab","FOCUS_RING","ArrowLineLeftIcon","overlayLayerElement","cardClasses","createPortal","ShadowRootWrapper","overlayIdentity","OVERLAY_ELEVATED_ATTR","_","SidePanelOverlayContext","SidePanelSheetLayer","SidePanelTabs"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkIA,MAAMA,IAAgB,KAChBC,KAAkB,SAElBC,IAAgB,IAChBC,KAAW,KACXC,KAAa,kCACbC,KAAkB,6DAElBC,KAAuB,MACzB,OAAO,SAAW,OAClB,OAAO,OAAO,cAAe,cAC7B,OAAO,WAAW,kCAAkC,EAAE,SAGpDC,KAAiB,GACjBC,KAAiB,CAACC,MACpBA,MAAW,SAAY,SAAYA,IAASF,IAG1CG,KAAgB,CAClBC,GACA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UAAA;AAAA,gBAAAM,IACG,gBAAArD,EAAA0F,GAAA,EACK,UAAA;AAAA,kBAAAO;AAAA,kBACAI;AAAA,kBACD,gBAAArG;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACG,WAAW,oCAAoCyG,EAAW;AAAA,sBAC1D,OAAO;AAAA,wBACH,qBAAqB;AAAA,sBAAA;AAAA,sBAGxB,UAAA;AAAA,wBAAAhB;AAAA,wBACAf,IACG,gBAAAvE,EAAC6G,IAAA,EAAoB,OAAOtC,GAAY,IACxC;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACR,EAAA,CACJ,IAEA,gBAAA1E,EAAA0F,GAAA,EACK,UAAA;AAAA,kBAAAX;AAAA,kBACAU;AAAA,kBACAf,IAAa,gBAAAvE,EAAC6G,IAAA,EAAoB,OAAOtC,GAAY,IAAK;AAAA,gBAAA,GAC/D;AAAA,gBAEH8B;AAAA,cAAA,EAAA,CACL;AAAA,YAAA;AAAA,UAAA;AAAA,QACJ,EAAA,CACJ,EAAA,CACJ;AAAA,MAAA;AAAA,IAAA;AAAA,IAEJ,SAAS;AAAA,EAAA;AAEjB;AAEA5F,GAAU,OAAOqG;"}
|
|
1
|
+
{"version":3,"file":"SidePanel.js","sources":["../../src/components/SidePanel.tsx"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { ShadowRootWrapper } from '../ShadowRootWrapper';\nimport type { AlertType } from './Alert';\nimport CalloutStrip from './CalloutStrip';\nimport ArrowLeftIcon from './CustomIcons/ArrowLeftIcon';\nimport ArrowLineLeftIcon from './CustomIcons/ArrowLineLeftIcon';\nimport ArrowLineRightIcon from './CustomIcons/ArrowLineRightIcon';\nimport DismissIcon from './CustomIcons/DismissIcon';\nimport type { RenderLink } from './PageLayout/types';\nimport SidePanelSheetLayer, { type SidePanelSheet } from './SidePanelSheet';\nimport SidePanelTabs from './SidePanelTabs';\nimport SidePanelTitle from './SidePanelTitle';\nimport EllipsisText from './Typography/EllipsisText';\nimport { afterNextPaint } from './afterNextPaint';\nimport { FOCUS_RING } from './focusRing';\nimport { inertWhen } from './inert';\nimport { OVERLAY_ICON_BUTTON_CLASSES, useOverlayBehaviour } from './overlayBehaviour';\nimport { OVERLAY_ELEVATED_ATTR, type OverlayStacking, overlayIdentity } from './portalOverlay';\nimport { SidePanelOverlayContext } from './sidePanelOverlay';\nimport { SidePanelTabsContext, type SidePanelTabsContextValue } from './sidePanelTabsContext';\n\nexport interface SidePanelBaseProps {\n open: boolean;\n /** Dismiss handler — close button, ESC, or overlay click. */\n onClose: () => void;\n title: React.ReactNode;\n subtitle?: React.ReactNode;\n /** `below` stacks the subtitle under the title, so neither truncates the other. */\n subtitlePlacement?: 'inline' | 'below';\n /** With the subtitle `below`: content at the far end of the subtitle's row, such as what comes next. */\n subtitleExtra?: React.ReactNode;\n /** Content at the end of the title row, after the subtitle (e.g. a status tag). */\n titleExtra?: React.ReactNode;\n /** Block paragraph below the title row, spanning the header width. Announced as the panel's description. */\n description?: React.ReactNode;\n /** Pinned between the header and the scrolling body. */\n toolbar?: React.ReactNode;\n /** `body` insets the toolbar 28px, level with the body. Default: `default`. */\n toolbarPadding?: 'default' | 'body';\n /** Divider under the header. Default: false. */\n headerDivider?: boolean;\n /** Leading header slot, typically a logo or icon. */\n icon?: React.ReactNode;\n /** Content pinned right in the header, before the close button. */\n headerExtra?: React.ReactNode;\n footer?: React.ReactNode;\n /**\n * Makes the panel's header, body and footer one form. Enter in a field then submits through\n * a `type=\"submit\"` button in the footer (see `FormActions`), the way a browser form does:\n * not from a textarea, not mid-composition, and not while that button is disabled. The\n * event's default is prevented and validation is the caller's, so the form is `noValidate`.\n * Enter in the `toolbar` never submits. A field inside its own `MalachiteContext` sits in\n * another shadow root and is outside the form.\n */\n onSubmit?: (event: React.FormEvent<HTMLFormElement>) => void;\n /** Renders a back button before the header icon. */\n onBack?: () => void;\n /** Maximum panel width. Default: 1080. */\n maxWidth?: number | string;\n /** Accessible dialog name; required when `title` isn't a plain string. */\n 'aria-label'?: string;\n /** ID of a visible element naming the dialog (alternative to `aria-label`). */\n 'aria-labelledby'?: string;\n /** Whether the body gets default padding. Default: true. */\n bodyPadding?: boolean;\n /** `above-app-overlays` lifts the overlay stack clear of chrome pinned near max-int. */\n stacking?: OverlayStacking;\n /** Full-width Alert bands at the top of the body, above `children`, in order. Unaffected by\n * `bodyPadding`, and announced ahead of `description`. The message is markdown. */\n callouts?: { type?: AlertType; message: string }[];\n /** Routes root-relative links in `callouts` through the app's router; see `MarkdownBlock`. */\n renderLink?: RenderLink;\n /** A full-height column opened to the left, as wide again as `maxWidth`. The panel's own\n * header, body and footer keep their width and place; the aside's header and footer line\n * up with them. The aside is never narrower than 360px: a window too narrow for both\n * columns scrolls the panel sideways. */\n aside?: SidePanelAside;\n /** A drill-in raised over the body and footer, dimming the header; see `SidePanelSheet`. */\n sheet?: SidePanelSheet;\n /** How far through a multi-step form, from 0 to 1: a line along the foot of the header, or\n * of the `subheader` when there is one. */\n progress?: number;\n /**\n * A band under the header, above the body, with a rule below it: a wizard's step and what\n * comes next, say. It leaves the header at its usual height, level with the page's own.\n */\n subheader?: React.ReactNode;\n tray?: React.ReactNode;\n}\n\nexport interface SidePanelChildrenProps extends SidePanelBaseProps {\n children: React.ReactNode;\n columns?: undefined;\n}\n\nexport interface SidePanelColumnsProps extends SidePanelBaseProps {\n columns: SidePanelColumn[];\n children?: undefined;\n}\n\nexport type SidePanelProps = SidePanelChildrenProps | SidePanelColumnsProps;\n\nexport interface SidePanelColumn {\n id: string;\n content: React.ReactNode;\n share: number;\n bodyPadding?: boolean;\n fill?: boolean;\n 'aria-label'?: string;\n}\n\nexport type { SidePanelSheet };\n\nexport interface SidePanelAside {\n /** Shown in the aside's header, and names the column for assistive tech. */\n title: string;\n /** Content pinned right in the aside's header (e.g. a stepper). */\n headerExtra?: React.ReactNode;\n /** Pinned at the bottom, level with the panel's footer. */\n footer?: React.ReactNode;\n /** Whether the aside's body gets default padding, as the panel's `bodyPadding`. Default: true. */\n bodyPadding?: boolean;\n /**\n * `detached` draws the aside as a card of its own on the warm ground, tucked behind the\n * panel's left edge, which slides out from behind it and back. Default: `column`, a column\n * of the panel itself.\n */\n layout?: 'column' | 'detached';\n /** `detached` only: whether the card is out. Default: true. */\n open?: boolean;\n /**\n * `detached` only: adds a button to the card's header that tucks it away, and while it is\n * away a tab on the panel's edge that brings it back.\n */\n onOpenChange?: (open: boolean) => void;\n /** `detached` only: the edge tab's text. Default: `Open ` and the title. */\n tabLabel?: string;\n /** `detached` only: an icon before the edge tab's text, as the control that opens the aside shows. */\n tabIcon?: React.ReactNode;\n children: React.ReactNode;\n}\n\nconst TRANSITION_MS = 200;\nconst ASIDE_MIN_WIDTH = '360px';\n// How far a detached aside runs under the panel, so its card reads as coming from behind it.\nconst ASIDE_TUCK_PX = 16;\nconst SLIDE_MS = 320;\nconst SLIDE_EASE = 'cubic-bezier(0.2, 0.8, 0.2, 1)';\nconst WARM_BACKGROUND = 'var(--malachite-card-warm-background, rgb(244, 242, 240))';\n\nconst prefersReducedMotion = (): boolean =>\n typeof window !== 'undefined' &&\n typeof window.matchMedia === 'function' &&\n window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n\n// The width of the panel card's border, which its rows sit inside and a detached aside does not.\nconst CARD_BORDER_PX = 1;\nconst withCardBorder = (height: number | undefined): number | undefined =>\n height === undefined ? undefined : height + CARD_BORDER_PX;\n\n/** The panel header's and footer's heights, so a detached aside's own can match them. */\nconst useRowHeights = (\n enabled: boolean,\n header: HTMLElement | null,\n footer: HTMLElement | null,\n): { header?: number; footer?: number } => {\n const [heights, setHeights] = useState<{ header?: number; footer?: number }>({});\n\n useEffect(() => {\n if (!enabled || typeof ResizeObserver === 'undefined') {\n return undefined;\n }\n const measure = () =>\n setHeights({\n header: header?.getBoundingClientRect().height,\n footer: footer?.getBoundingClientRect().height,\n });\n const observer = new ResizeObserver(measure);\n if (header) {\n observer.observe(header);\n }\n if (footer) {\n observer.observe(footer);\n }\n measure();\n return () => observer.disconnect();\n }, [enabled, header, footer]);\n\n return heights;\n};\n\ninterface ScrollingBodyProps {\n bodyPadding: boolean;\n className?: string;\n callouts?: { type?: AlertType; message: string }[];\n /** Prefix for each callout's id, which the panel names in `aria-describedby`. */\n calloutId?: string;\n renderLink?: RenderLink;\n stableGutter?: boolean;\n scrollerRef?: React.Ref<HTMLDivElement>;\n children: React.ReactNode;\n}\n\nconst ScrollingBody: React.FC<ScrollingBodyProps> = ({\n bodyPadding,\n className = '',\n callouts,\n calloutId,\n renderLink,\n stableGutter = false,\n scrollerRef,\n children,\n}) => {\n const hasCallouts = !!callouts?.length;\n\n // Callouts move the horizontal padding inward so their strips run full-bleed.\n return (\n <div\n ref={scrollerRef}\n className={`min-h-0 flex-1 overflow-y-auto [scrollbar-color:var(--malachite-text-dimmed)_transparent] ${stableGutter ? '[scrollbar-gutter:stable]' : ''} ${bodyPadding && !hasCallouts ? 'px-[28px]' : ''} ${className}`}\n >\n {callouts?.map((callout, index) => (\n <CalloutStrip\n key={index}\n id={calloutId ? `${calloutId}-${index}` : undefined}\n type={callout.type}\n message={callout.message}\n renderLink={renderLink}\n />\n ))}\n {bodyPadding ? (\n <div className={hasCallouts ? 'p-[28px]' : 'py-[28px]'}>{children}</div>\n ) : (\n children\n )}\n </div>\n );\n};\n\nconst COLUMN_DIVIDER =\n 'border-0 border-solid border-[var(--malachite-card-border)] border-r @max-xl:border-r-0 @max-xl:border-b';\n\nconst SidePanelColumns: React.FC<{\n columns: SidePanelColumn[];\n callouts?: { type?: AlertType; message: string }[];\n calloutId: string;\n renderLink?: RenderLink;\n}> = ({ columns, callouts, calloutId, renderLink }) => (\n <>\n {callouts?.length ? (\n <div className=\"shrink-0\">\n {callouts.map((callout, index) => (\n <CalloutStrip\n key={index}\n id={`${calloutId}-${index}`}\n type={callout.type}\n message={callout.message}\n renderLink={renderLink}\n />\n ))}\n </div>\n ) : null}\n <div className=\"@container flex min-h-0 flex-1 flex-col\">\n <div className=\"flex min-h-0 flex-1 @max-xl:flex-col @max-xl:overflow-y-auto\">\n {columns.map((column, index) => {\n const padding = column.bodyPadding ?? true;\n return (\n <section\n key={column.id}\n aria-label={column['aria-label']}\n className={`flex min-h-0 min-w-0 flex-col @max-xl:min-h-[240px] ${index < columns.length - 1 ? COLUMN_DIVIDER : ''}`}\n style={{ flex: `${column.share} 1 0px` }}\n >\n {column.fill ? (\n <div\n className={`flex min-h-0 flex-1 flex-col overflow-hidden ${padding ? 'p-[28px]' : ''}`}\n >\n {column.content}\n </div>\n ) : (\n <ScrollingBody bodyPadding={padding}>\n {column.content}\n </ScrollingBody>\n )}\n </section>\n );\n })}\n </div>\n </div>\n </>\n);\n\nconst toCssSize = (value: number | string): string =>\n typeof value === 'number' ? `${value}px` : value;\n\n// The toolbar holds filters, such as a Search over the list, never a field the form saves.\nconst cancelToolbarSubmit = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Enter' && event.target instanceof HTMLInputElement) {\n event.preventDefault();\n }\n};\n\nconst PANEL_COLUMN_CLASSES =\n 'isolate col-start-2 row-span-3 row-start-1 grid min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-subgrid';\n\n// The panel's own column, which is the form when the panel has one, so the header, body and\n// footer stay the subgrid's three rows either way.\nconst PanelColumn: React.FC<{\n onSubmit?: (event: React.FormEvent<HTMLFormElement>) => void;\n children: React.ReactNode;\n}> = ({ onSubmit, children }) =>\n onSubmit ? (\n <form\n noValidate\n className={PANEL_COLUMN_CLASSES}\n onSubmit={(event) => {\n event.preventDefault();\n // React bubbles it through the portal to a consumer's own form around the panel.\n event.stopPropagation();\n onSubmit(event);\n }}\n >\n {children}\n </form>\n ) : (\n <div className={PANEL_COLUMN_CLASSES}>{children}</div>\n );\n\n/**\n * A right-hand slide-in overlay panel (drawer) for inspecting or editing an entity\n * without leaving the page. Portals to `document.body`, locks background scroll and\n * traps keyboard focus while open (restoring both on close), dismisses on ESC\n * (topmost open overlay only), overlay click or the close button, and exposes header\n * (back/icon/title/subtitle/extra), scrollable body and optional footer slots.\n */\nconst SidePanel: React.FC<SidePanelProps> & { Tabs: typeof SidePanelTabs } = ({\n open,\n onClose,\n title,\n subtitle,\n subtitlePlacement = 'inline',\n subtitleExtra,\n titleExtra,\n description,\n toolbar,\n toolbarPadding = 'default',\n headerDivider = false,\n icon,\n headerExtra,\n footer,\n onSubmit,\n onBack,\n maxWidth = 1080,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n bodyPadding = true,\n stacking = 'default',\n callouts,\n renderLink,\n aside,\n sheet,\n progress,\n subheader,\n tray,\n columns,\n children,\n}) => {\n const calloutId = useId();\n const [stripSlot, setStripSlot] = useState<HTMLDivElement | null>(null);\n const [tabSets, setTabSets] = useState(0);\n const registerTabs = useCallback(() => {\n setTabSets((count) => count + 1);\n return () => setTabSets((count) => count - 1);\n }, []);\n const [scroller, setScroller] = useState<HTMLDivElement | null>(null);\n const tabsContext = useMemo<SidePanelTabsContextValue>(\n () => ({ stripSlot, scroller, registerTabs }),\n [stripSlot, scroller, registerTabs],\n );\n const [overlayLayer, setOverlayLayer] = useState<HTMLDivElement | null>(null);\n const [panelHeader, setPanelHeader] = useState<HTMLDivElement | null>(null);\n const [panelFooter, setPanelFooter] = useState<HTMLDivElement | null>(null);\n const detached = aside?.layout === 'detached';\n const asideOpen = detached ? (aside?.open ?? true) : !!aside;\n const rowHeights = useRowHeights(detached, panelHeader, panelFooter);\n const descriptionId = useId();\n const [isVisible, setIsVisible] = useState(false);\n const [isMounted, setIsMounted] = useState(false);\n const frameRef = useRef<number | null>(null);\n const unmountTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const hostRef = useRef<HTMLDivElement | null>(null);\n const {\n ref: handlePanelRef,\n isTopmost,\n zIndex,\n elevated,\n } = useOverlayBehaviour({\n open,\n onClose: sheet ? sheet.onClose : onClose,\n elevated: stacking === 'above-app-overlays',\n hostRef,\n });\n\n const lastSheet = useRef(sheet);\n useLayoutEffect(() => {\n if (open) {\n lastSheet.current = sheet;\n }\n });\n\n useEffect(() => {\n if (open) {\n setIsMounted(true);\n if (unmountTimerRef.current) {\n clearTimeout(unmountTimerRef.current);\n unmountTimerRef.current = null;\n }\n afterNextPaint(frameRef, () => setIsVisible(true));\n } else {\n setIsVisible(false);\n unmountTimerRef.current = setTimeout(() => {\n unmountTimerRef.current = null;\n setIsMounted(false);\n }, TRANSITION_MS);\n }\n return () => {\n if (frameRef.current !== null) {\n cancelAnimationFrame(frameRef.current);\n frameRef.current = null;\n }\n if (unmountTimerRef.current) {\n clearTimeout(unmountTimerRef.current);\n unmountTimerRef.current = null;\n }\n };\n }, [open]);\n\n if (!isMounted) {\n return null;\n }\n\n const closePanel = () => {\n sheet?.onClose();\n onClose();\n };\n const shownSheet = open ? sheet : lastSheet.current;\n\n const shownCallouts = callouts?.filter((callout) => callout.message.trim());\n const panelColumnWidth = `calc(${toCssSize(maxWidth)} - 2px)`;\n const dividerBelow = headerDivider\n ? 'border-0 border-b border-solid border-[var(--malachite-card-border)]'\n : '';\n // The panel's header row is 56px on its own, so its rule is drawn inside that rather than\n // under it, landing on the page header's rule and the detached aside's.\n const ruleInside = headerDivider\n ? '[box-shadow:inset_0_-1px_0_var(--malachite-card-border)]'\n : '';\n // Each column is a subgrid of the panel's three rows, so the aside's header and footer\n // stay level with the panel's whatever their content. The panel's own column is always the\n // second, so opening or closing the aside never remounts it or reflows it mid-transition:\n // without an aside the first column is simply empty and narrows to nothing.\n const asideColumn =\n aside && !detached ? (\n <aside\n aria-label={aside.title}\n {...inertWhen(!!shownSheet)}\n className=\"col-start-1 row-span-3 row-start-1 grid min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-subgrid overflow-hidden border-0 border-r border-solid border-[var(--malachite-card-border)]\"\n >\n <div\n className={`box-border flex min-h-[56px] min-w-0 items-center gap-[8px] px-[20px] py-[8px] ${dividerBelow}`}\n >\n <span className=\"flex min-w-0 shrink-0\">\n <SidePanelTitle>{aside.title}</SidePanelTitle>\n </span>\n {aside.headerExtra ? (\n <span className=\"ml-auto flex shrink-0 items-center\">\n {aside.headerExtra}\n </span>\n ) : null}\n </div>\n <div className={`flex min-h-0 flex-col ${aside.footer ? '' : 'row-span-2'}`}>\n <ScrollingBody bodyPadding={aside.bodyPadding ?? true}>\n {aside.children}\n </ScrollingBody>\n </div>\n {aside.footer ? (\n <div className=\"border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]\">\n {aside.footer}\n </div>\n ) : null}\n </aside>\n ) : null;\n\n const subtitleBelow = subtitlePlacement === 'below' && !!subtitle;\n const titleNode = (\n <span\n className={subtitleBelow ? 'flex min-w-0 shrink' : 'flex min-w-0 max-w-full shrink-0'}\n >\n <SidePanelTitle>{title}</SidePanelTitle>\n </span>\n );\n const subtitleNode = subtitle ? (\n <EllipsisText\n tooltip={subtitle}\n tooltipWhenTruncated\n tooltipPlacement=\"bottom\"\n color=\"secondary\"\n className=\"min-w-0 text-[13px]\"\n >\n {subtitle}\n </EllipsisText>\n ) : null;\n const titleExtraNode = titleExtra ? (\n <span className=\"flex shrink-0 items-center\">{titleExtra}</span>\n ) : null;\n const headerExtraNode = headerExtra ? (\n <span className=\"flex shrink-0 items-baseline\">{headerExtra}</span>\n ) : null;\n\n const progressLine =\n progress === undefined ? null : (\n <span\n aria-hidden=\"true\"\n // Under a subheader the rule is a border, which the line covers; on the header it is drawn inside.\n className={`absolute ${subheader ? 'bottom-[-1px]' : 'bottom-0'} left-0 h-[3px] bg-[var(--malachite-accent-foreground)]`}\n style={{\n width: `${Math.round(Math.min(1, Math.max(0, progress)) * 100)}%`,\n transition: prefersReducedMotion() ? undefined : 'width 280ms ease-out',\n }}\n />\n );\n const panelColumn = (\n <>\n {/* An explicit column: an implicit one is sized to its widest content and overflows the panel. */}\n <PanelColumn onSubmit={onSubmit}>\n <div\n ref={setPanelHeader}\n // 56px, the page header's height, so the panel's rule lands on the page's.\n className={`relative box-border flex min-h-[56px] flex-col justify-center px-[20px] ${ruleInside}`}\n {...inertWhen(!!shownSheet)}\n >\n {subheader ? null : progressLine}\n {/* 56px whether or not a description follows, so the title and close button sit\n where they do in a one-line header, the close as far from the top as the side. */}\n <div className=\"flex min-h-[56px] items-center gap-[12px] py-[8px]\">\n {onBack ? (\n <button\n type=\"button\"\n aria-label=\"Back\"\n onClick={onBack}\n className={OVERLAY_ICON_BUTTON_CLASSES}\n >\n <ArrowLeftIcon size={16} />\n </button>\n ) : null}\n {icon ? <span className=\"flex shrink-0 items-center\">{icon}</span> : null}\n {subtitleBelow ? (\n <div className=\"flex min-w-0 flex-1 items-center gap-[12px]\">\n <div className=\"flex min-w-0 flex-1 flex-col gap-[2px]\">\n <div className=\"flex min-w-0 items-baseline gap-[8px]\">\n {titleNode}\n {titleExtraNode}\n </div>\n {subtitleExtra ? (\n <div className=\"flex min-w-0 items-baseline gap-[12px]\">\n {subtitleNode}\n <span className=\"ml-auto flex shrink-0 items-baseline text-[13px]\">\n {subtitleExtra}\n </span>\n </div>\n ) : (\n subtitleNode\n )}\n </div>\n {headerExtraNode}\n </div>\n ) : (\n <div className=\"flex min-w-0 flex-1 items-baseline gap-[12px]\">\n <div className=\"flex min-w-0 flex-1 items-baseline gap-[8px]\">\n <div className=\"flex min-w-0 items-baseline gap-[8px]\">\n {titleNode}\n {subtitleNode}\n </div>\n {titleExtraNode}\n </div>\n {headerExtraNode}\n </div>\n )}\n <button\n type=\"button\"\n aria-label=\"Close\"\n onClick={closePanel}\n className={OVERLAY_ICON_BUTTON_CLASSES}\n >\n <DismissIcon size={10} />\n </button>\n </div>\n {description ? (\n <div\n id={descriptionId}\n className=\"-mt-[8px] pb-[16px] text-[13px] leading-[1.6] text-[var(--malachite-text-secondary)]\"\n >\n {description}\n </div>\n ) : null}\n </div>\n {/* The toolbar shares the body's row, so an aside's header and footer stay level. */}\n <div\n className={`flex min-h-0 flex-col ${footer ? '' : 'row-span-2'}`}\n {...inertWhen(!!shownSheet)}\n >\n {subheader ? (\n <div className=\"relative box-border flex min-h-[56px] shrink-0 items-center border-0 border-b border-solid border-[var(--malachite-card-border)] px-[20px]\">\n <div className=\"min-w-0 flex-1\">{subheader}</div>\n {progressLine}\n </div>\n ) : null}\n {toolbar ? (\n <div\n className={`shrink-0 pt-[16px] pb-[8px] ${toolbarPadding === 'body' ? 'px-[28px]' : 'px-[16px]'}`}\n onKeyDown={onSubmit ? cancelToolbarSubmit : undefined}\n >\n {toolbar}\n </div>\n ) : null}\n <div ref={setStripSlot} className=\"shrink-0 px-[28px] empty:hidden\" />\n {columns ? (\n <SidePanelColumns\n columns={columns}\n callouts={shownCallouts}\n calloutId={calloutId}\n renderLink={renderLink}\n />\n ) : (\n <ScrollingBody\n bodyPadding={bodyPadding}\n callouts={shownCallouts}\n calloutId={calloutId}\n renderLink={renderLink}\n stableGutter={tabSets > 0}\n scrollerRef={setScroller}\n >\n <SidePanelTabsContext.Provider value={tabsContext}>\n {children}\n </SidePanelTabsContext.Provider>\n </ScrollingBody>\n )}\n {tray ? (\n <div className=\"max-h-[55%] shrink-0 overflow-x-hidden overflow-y-auto [scrollbar-color:var(--malachite-text-dimmed)_transparent]\">\n {tray}\n </div>\n ) : null}\n </div>\n {footer ? (\n <div\n ref={setPanelFooter}\n className=\"border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]\"\n {...inertWhen(!!shownSheet)}\n >\n {footer}\n </div>\n ) : null}\n </PanelColumn>\n </>\n );\n\n const asideWidth = `max(${ASIDE_MIN_WIDTH}, min(${toCssSize(maxWidth)}, calc(100vw - ${toCssSize(maxWidth)} - 40px)))`;\n const slide = (open: boolean): React.CSSProperties =>\n prefersReducedMotion()\n ? {}\n : {\n transition: `transform ${SLIDE_MS}ms ${SLIDE_EASE}, opacity ${TRANSITION_MS}ms, visibility 0s linear ${open ? 0 : SLIDE_MS}ms`,\n };\n // Out, the card sits beside the panel with its last few pixels under the panel's edge; away,\n // it slides right until it is hidden behind the panel, and leaves the tab order once there.\n const detachedAside =\n aside && detached ? (\n <aside\n aria-label={aside.title}\n aria-hidden={asideOpen ? undefined : true}\n {...inertWhen(!!shownSheet)}\n className=\"absolute top-0 bottom-0 grid grid-cols-[minmax(0,1fr)] grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden rounded-l-[16px] text-[var(--malachite-card-foreground)] [box-shadow:var(--malachite-shadow-lg)]\"\n style={{\n right: `calc(100% - ${ASIDE_TUCK_PX}px)`,\n width: `calc(${asideWidth} + ${ASIDE_TUCK_PX}px)`,\n paddingRight: ASIDE_TUCK_PX,\n boxSizing: 'border-box',\n background: WARM_BACKGROUND,\n transform: asideOpen\n ? 'translateX(0)'\n : `translateX(calc(100% - ${ASIDE_TUCK_PX}px))`,\n opacity: asideOpen ? 1 : 0,\n visibility: asideOpen ? 'visible' : 'hidden',\n ...slide(asideOpen),\n }}\n >\n {/* The aside starts at the card's outer edge, the panel's rows inside its 1px\n border, so each of its rows is that much taller to put its rule on theirs. */}\n <div\n className=\"box-border flex min-w-0 items-center gap-[10px] px-[20px] py-[8px] [box-shadow:inset_0_-1px_0_var(--malachite-card-border)]\"\n style={{ minHeight: withCardBorder(rowHeights.header) }}\n >\n {/* The title keeps its width and at least the header's own padding from the\n controls, which give way first in a narrow card. */}\n <span className=\"mr-[10px] flex shrink-0\">\n <SidePanelTitle>{aside.title}</SidePanelTitle>\n </span>\n {aside.headerExtra ? (\n <span className=\"ml-auto flex min-w-0 shrink items-center justify-end\">\n {aside.headerExtra}\n </span>\n ) : null}\n {aside.onOpenChange ? (\n <button\n type=\"button\"\n aria-label={`Collapse ${aside.title}`}\n title={`Collapse ${aside.title}`}\n onClick={() => aside.onOpenChange?.(false)}\n className={OVERLAY_ICON_BUTTON_CLASSES}\n >\n <ArrowLineRightIcon size={16} />\n </button>\n ) : null}\n </div>\n <div className={`flex min-h-0 flex-col ${aside.footer ? '' : 'row-span-2'}`}>\n <ScrollingBody\n bodyPadding={aside.bodyPadding ?? true}\n // A shade darker than the default thumb, which barely shows on the warm ground.\n className=\"[scrollbar-color:var(--malachite-text-dimmed)_transparent]\"\n >\n {aside.children}\n </ScrollingBody>\n </div>\n {aside.footer ? (\n <div\n className=\"box-border flex flex-col justify-center border-0 border-t border-solid border-[var(--malachite-card-border)] px-[20px] py-[12px]\"\n style={{ minHeight: withCardBorder(rowHeights.footer) }}\n >\n {aside.footer}\n </div>\n ) : null}\n </aside>\n ) : null;\n const tabLabel = aside?.tabLabel ?? `Open ${aside?.title ?? ''}`;\n const edgeTab =\n aside && detached && !asideOpen && aside.onOpenChange ? (\n <button\n type=\"button\"\n aria-label={tabLabel}\n title={tabLabel}\n onClick={() => aside.onOpenChange?.(true)}\n // The aside's own warm ground, 40px across, read bottom to top: any icon, the\n // text, then the arrow 12px on. Its top sits where the card's 20px corner ends,\n // level with the aside's collapse button once open.\n // 2px more on the outer side than the inner, so the label sits off the panel edge.\n className={`absolute flex cursor-pointer flex-col items-center rounded-l-[14px] border-0 py-[12px] pr-0 pl-[2px] text-[13px] font-medium text-[var(--malachite-text-primary)] [box-shadow:var(--malachite-shadow-lg)] ${FOCUS_RING}`}\n style={{ right: '100%', top: 20, width: 42, background: WARM_BACKGROUND }}\n >\n <ArrowLineLeftIcon size={16} />\n <span aria-hidden=\"true\" style={{ height: 12, flexShrink: 0 }} />\n <span\n aria-hidden=\"true\"\n style={{\n writingMode: 'vertical-rl',\n transform: 'rotate(180deg)',\n whiteSpace: 'nowrap',\n }}\n >\n {tabLabel}\n </span>\n {aside.tabIcon ? (\n <span aria-hidden=\"true\" className=\"mt-[8px] flex\">\n {aside.tabIcon}\n </span>\n ) : null}\n </button>\n ) : null;\n // Spans the panel and an open detached aside, for an enlarged image over both.\n const overlayLayerElement = (\n <div\n ref={setOverlayLayer}\n className=\"pointer-events-none absolute top-0 right-0 bottom-0 z-[20]\"\n style={{\n left: detached && asideOpen ? `calc(-1 * ${asideWidth})` : 0,\n }}\n />\n );\n const cardClasses =\n 'grid grid-rows-[auto_minmax(0,1fr)_auto] rounded-[20px] border border-solid border-[var(--malachite-card-border)] bg-[var(--malachite-card-background)] text-[var(--malachite-card-foreground)] [box-shadow:var(--malachite-shadow-lg)]';\n\n return createPortal(\n // Host carries the stacking context — ShadowRootWrapper's `isolation` would\n // otherwise flatten our z-index and let sticky page elements paint over us.\n <ShadowRootWrapper\n hostRef={hostRef}\n hostStyle={{ position: 'relative', zIndex }}\n hostProps={\n elevated\n ? { ...overlayIdentity('sidepanel'), [OVERLAY_ELEVATED_ATTR]: '' }\n : overlayIdentity('sidepanel')\n }\n >\n <SidePanelTabsContext.Provider value={null}>\n <div className=\"fixed inset-0 z-[1000]\">\n <div\n aria-hidden=\"true\"\n onClick={closePanel}\n className={`absolute inset-0 bg-[var(--malachite-overlay-scrim)] transition-opacity duration-200 ease-in-out ${\n isVisible ? 'opacity-100' : 'opacity-0'\n }`}\n />\n <div\n ref={handlePanelRef}\n role=\"dialog\"\n // Only the topmost overlay may claim it, or a screen reader can still\n // browse the one underneath.\n aria-modal={isTopmost ? 'true' : undefined}\n aria-describedby={\n [\n ...(shownCallouts ?? []).map((_, index) => `${calloutId}-${index}`),\n description ? descriptionId : null,\n ]\n .filter(Boolean)\n .join(' ') || undefined\n }\n tabIndex={-1}\n // Prefer aria-labelledby; only fall back to aria-label when it's absent.\n aria-label={\n ariaLabelledBy\n ? undefined\n : (ariaLabel ?? (typeof title === 'string' ? title : undefined))\n }\n aria-labelledby={ariaLabelledBy}\n // Detached, the dialog holds the panel's card and the aside's side by side, so it\n // carries none of the card's own look and does not clip the aside.\n className={\n detached\n ? 'absolute top-[8px] right-[8px] bottom-[8px] outline-none'\n : `absolute top-[8px] right-[8px] bottom-[8px] overflow-x-auto overflow-y-hidden outline-none ${cardClasses}`\n }\n style={{\n width: `min(calc(100% - 16px), ${aside && !detached ? `calc(2 * ${toCssSize(maxWidth)})` : toCssSize(maxWidth)})`,\n // Inline: Tailwind translate utilities silently break inside\n // shadow roots (see CLAUDE.md Shadow DOM caveats).\n transform: isVisible\n ? 'translateX(0)'\n : 'translateX(calc(100% + 16px))',\n transition: `transform ${TRANSITION_MS}ms ease-in-out, width ${TRANSITION_MS}ms ease-in-out, grid-template-columns ${TRANSITION_MS}ms ease-in-out`,\n // The panel's own column is the width it has without an aside: `maxWidth`\n // less the 1px border either side, so opening the aside never widens it.\n // With an aside neither column gives way, so a narrow window scrolls the\n // panel instead. Both templates share one shape so the minimums animate\n // with the width rather than overflowing mid-transition.\n gridTemplateColumns: detached\n ? undefined\n : aside\n ? `minmax(${ASIDE_MIN_WIDTH}, 1fr) minmax(${panelColumnWidth}, ${panelColumnWidth})`\n : `minmax(0px, 1fr) minmax(0px, ${panelColumnWidth})`,\n }}\n >\n <SidePanelOverlayContext.Provider value={overlayLayer}>\n {detached ? (\n <>\n {detachedAside}\n {edgeTab}\n <div\n className={`absolute inset-0 overflow-hidden ${cardClasses}`}\n style={{\n gridTemplateColumns: `0px minmax(0px, 1fr)`,\n }}\n >\n {panelColumn}\n {shownSheet ? (\n <SidePanelSheetLayer sheet={shownSheet} />\n ) : null}\n </div>\n </>\n ) : (\n <>\n {asideColumn}\n {panelColumn}\n {shownSheet ? <SidePanelSheetLayer sheet={shownSheet} /> : null}\n </>\n )}\n {overlayLayerElement}\n </SidePanelOverlayContext.Provider>\n </div>\n </div>\n </SidePanelTabsContext.Provider>\n </ShadowRootWrapper>,\n document.body,\n );\n};\n\nSidePanel.Tabs = SidePanelTabs;\n\nexport default SidePanel;\nexport { SidePanel };\n"],"names":["TRANSITION_MS","ASIDE_MIN_WIDTH","ASIDE_TUCK_PX","SLIDE_MS","SLIDE_EASE","WARM_BACKGROUND","prefersReducedMotion","CARD_BORDER_PX","withCardBorder","height","useRowHeights","enabled","header","footer","heights","setHeights","useState","useEffect","measure","observer","ScrollingBody","bodyPadding","className","callouts","calloutId","renderLink","stableGutter","scrollerRef","children","hasCallouts","jsxs","callout","index","jsx","CalloutStrip","COLUMN_DIVIDER","SidePanelColumns","columns","Fragment","column","padding","toCssSize","value","cancelToolbarSubmit","event","PANEL_COLUMN_CLASSES","PanelColumn","onSubmit","SidePanel","open","onClose","title","subtitle","subtitlePlacement","subtitleExtra","titleExtra","description","toolbar","toolbarPadding","headerDivider","icon","headerExtra","onBack","maxWidth","ariaLabel","ariaLabelledBy","stacking","aside","sheet","progress","subheader","tray","useId","stripSlot","setStripSlot","tabSets","setTabSets","registerTabs","useCallback","count","scroller","setScroller","tabsContext","useMemo","overlayLayer","setOverlayLayer","panelHeader","setPanelHeader","panelFooter","setPanelFooter","detached","asideOpen","rowHeights","descriptionId","isVisible","setIsVisible","isMounted","setIsMounted","frameRef","useRef","unmountTimerRef","hostRef","handlePanelRef","isTopmost","zIndex","elevated","useOverlayBehaviour","lastSheet","useLayoutEffect","afterNextPaint","closePanel","shownSheet","shownCallouts","panelColumnWidth","dividerBelow","ruleInside","asideColumn","inertWhen","SidePanelTitle","subtitleBelow","titleNode","subtitleNode","EllipsisText","titleExtraNode","headerExtraNode","progressLine","panelColumn","OVERLAY_ICON_BUTTON_CLASSES","ArrowLeftIcon","DismissIcon","SidePanelTabsContext","asideWidth","slide","detachedAside","_a","ArrowLineRightIcon","tabLabel","edgeTab","FOCUS_RING","ArrowLineLeftIcon","overlayLayerElement","cardClasses","createPortal","ShadowRootWrapper","overlayIdentity","OVERLAY_ELEVATED_ATTR","_","SidePanelOverlayContext","SidePanelSheetLayer","SidePanelTabs"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuJA,MAAMA,IAAgB,KAChBC,KAAkB,SAElBC,IAAgB,IAChBC,KAAW,KACXC,KAAa,kCACbC,KAAkB,6DAElBC,KAAuB,MACzB,OAAO,SAAW,OAClB,OAAO,OAAO,cAAe,cAC7B,OAAO,WAAW,kCAAkC,EAAE,SAGpDC,KAAiB,GACjBC,KAAiB,CAACC,MACpBA,MAAW,SAAY,SAAYA,IAASF,IAG1CG,KAAgB,CAClBC,GACAC,GACAC,MACuC;AACv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iBAAiBgH,CAAgB,KAAKA,CAAgB,MAC/E,gCAAgCA,CAAgB;AAAA,cAAA;AAAA,cAG5D,UAAA,gBAAAnF,EAACqH,GAAwB,UAAxB,EAAiC,OAAO/D,IACpC,UAAA;AAAA,gBAAAM,IACG,gBAAA5D,EAAAQ,GAAA,EACK,UAAA;AAAA,kBAAA+F;AAAA,kBACAI;AAAA,kBACD,gBAAA3G;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACG,WAAW,oCAAoC+G,EAAW;AAAA,sBAC1D,OAAO;AAAA,wBACH,qBAAqB;AAAA,sBAAA;AAAA,sBAGxB,UAAA;AAAA,wBAAAf;AAAA,wBACAf,IACG,gBAAA9E,EAACmH,IAAA,EAAoB,OAAOrC,GAAY,IACxC;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACR,EAAA,CACJ,IAEA,gBAAAjF,EAAAQ,GAAA,EACK,UAAA;AAAA,kBAAA8E;AAAA,kBACAU;AAAA,kBACAf,IAAa,gBAAA9E,EAACmH,IAAA,EAAoB,OAAOrC,GAAY,IAAK;AAAA,gBAAA,GAC/D;AAAA,gBAEH6B;AAAA,cAAA,EAAA,CACL;AAAA,YAAA;AAAA,UAAA;AAAA,QACJ,EAAA,CACJ,EAAA,CACJ;AAAA,MAAA;AAAA,IAAA;AAAA,IAEJ,SAAS;AAAA,EAAA;AAEjB;AAEA5F,GAAU,OAAOqG;"}
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
const
|
|
1
|
+
const l = {
|
|
2
2
|
color: "var(--malachite-codeblock-foreground)",
|
|
3
3
|
fontSize: "14px",
|
|
4
4
|
lineHeight: "20px",
|
|
5
5
|
fontFamily: "var(--malachite-font-mono, monospace)",
|
|
6
6
|
textAlign: "left",
|
|
7
7
|
background: "transparent"
|
|
8
|
-
},
|
|
8
|
+
}, s = {
|
|
9
|
+
keyword: "var(--malachite-codeblock-keyword, rgb(12, 88, 174))",
|
|
10
|
+
string: "var(--malachite-codeblock-string, rgb(2, 122, 66))",
|
|
11
|
+
number: "var(--malachite-codeblock-number, rgb(150, 88, 10))"
|
|
12
|
+
}, d = (n) => n ? { width: "100%" } : { width: "max-content", minWidth: "100%" }, r = /^ *(?:- +)*(?:"[^"]*"|'[^']*'|[^\s:'"][^\s:]*): +(?=\S)/, a = /^ *(?:- +)*/, i = 32, g = (n) => {
|
|
9
13
|
var o;
|
|
10
|
-
const c = ((o =
|
|
14
|
+
const c = ((o = r.exec(n) ?? a.exec(n)) == null ? void 0 : o[0].length) ?? 0, t = Math.min(c, i);
|
|
11
15
|
if (t === 0)
|
|
12
16
|
return {};
|
|
13
17
|
const e = `${t}ch`;
|
|
14
18
|
return { paddingLeft: e, textIndent: `-${e}` };
|
|
15
19
|
};
|
|
16
20
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
l as CODE_FONT,
|
|
22
|
+
s as CODE_TOKEN_COLOR,
|
|
23
|
+
g as hangingIndentStyle,
|
|
24
|
+
d as rowsWrapperStyle
|
|
20
25
|
};
|
|
21
26
|
//# sourceMappingURL=codeBlockStyles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeBlockStyles.js","sources":["../../src/components/codeBlockStyles.ts"],"sourcesContent":["import type React from 'react';\n\nexport const CODE_FONT: React.CSSProperties = {\n color: 'var(--malachite-codeblock-foreground)',\n fontSize: '14px',\n lineHeight: '20px',\n fontFamily: 'var(--malachite-font-mono, monospace)',\n textAlign: 'left',\n background: 'transparent',\n};\n\n/**\n * The element around a block's rows. Unwrapped, it is as wide as the widest line, floored at\n * the view, so rows filling it end level when one scrolls out. Wrapped, it is the view's width:\n * at `max-content` a line has nothing narrower to wrap against and scrolls anyway.\n */\nexport const rowsWrapperStyle = (wrap: boolean): React.CSSProperties =>\n wrap ? { width: '100%' } : { width: 'max-content', minWidth: '100%' };\n\n/** Anchored, so prose containing a colon falls through to {@link INDENT_COLUMN} instead. */\nconst VALUE_COLUMN = /^ *(?:- +)*(?:\"[^\"]*\"|'[^']*'|[^\\s:'\"][^\\s:]*): +(?=\\S)/;\n\nconst INDENT_COLUMN = /^ *(?:- +)*/;\n\n/**\n * Backstop, not a fit-to-width rule: `padding-left` counts toward the flex item's\n * `min-width: auto`, so a pathological key could otherwise widen the row past its panel. Set\n * well past any realistic key (the deepest in connector step YAML is ~18ch) because a clamped\n * row stops aligning under its value, which is the whole point of the hang.\n */\nconst MAX_HANG_CH = 32;\n\n/**\n * Hangs a wrapped row under the start of its line's value, so it can't read as a new key.\n * Measured in `ch` — the block is monospace, so one `ch` is one space (tabs are not counted).\n */\nexport const hangingIndentStyle = (line: string): React.CSSProperties => {\n const column = (VALUE_COLUMN.exec(line) ?? INDENT_COLUMN.exec(line))?.[0].length ?? 0;\n const hang = Math.min(column, MAX_HANG_CH);\n if (hang === 0) {\n return {};\n }\n const hangingIndent = `${hang}ch`;\n return { paddingLeft: hangingIndent, textIndent: `-${hangingIndent}` };\n};\n"],"names":["CODE_FONT","rowsWrapperStyle","wrap","VALUE_COLUMN","INDENT_COLUMN","MAX_HANG_CH","hangingIndentStyle","line","_a","column","hang","hangingIndent"],"mappings":"AAEO,MAAMA,IAAiC;AAAA,EAC1C,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,YAAY;AAChB,GAOaC,IAAmB,CAACC,MAC7BA,IAAO,EAAE,OAAO,OAAA,IAAW,EAAE,OAAO,eAAe,UAAU,OAAA,GAG3DC,IAAe,2DAEfC,IAAgB,eAQhBC,IAAc,IAMPC,IAAqB,CAACC,MAAsC;
|
|
1
|
+
{"version":3,"file":"codeBlockStyles.js","sources":["../../src/components/codeBlockStyles.ts"],"sourcesContent":["import type React from 'react';\n\nexport const CODE_FONT: React.CSSProperties = {\n color: 'var(--malachite-codeblock-foreground)',\n fontSize: '14px',\n lineHeight: '20px',\n fontFamily: 'var(--malachite-font-mono, monospace)',\n textAlign: 'left',\n background: 'transparent',\n};\n\n/** The shared keyword, string and number colours for code surfaces. */\nexport const CODE_TOKEN_COLOR = {\n keyword: 'var(--malachite-codeblock-keyword, rgb(12, 88, 174))',\n string: 'var(--malachite-codeblock-string, rgb(2, 122, 66))',\n number: 'var(--malachite-codeblock-number, rgb(150, 88, 10))',\n} as const;\n\n/**\n * The element around a block's rows. Unwrapped, it is as wide as the widest line, floored at\n * the view, so rows filling it end level when one scrolls out. Wrapped, it is the view's width:\n * at `max-content` a line has nothing narrower to wrap against and scrolls anyway.\n */\nexport const rowsWrapperStyle = (wrap: boolean): React.CSSProperties =>\n wrap ? { width: '100%' } : { width: 'max-content', minWidth: '100%' };\n\n/** Anchored, so prose containing a colon falls through to {@link INDENT_COLUMN} instead. */\nconst VALUE_COLUMN = /^ *(?:- +)*(?:\"[^\"]*\"|'[^']*'|[^\\s:'\"][^\\s:]*): +(?=\\S)/;\n\nconst INDENT_COLUMN = /^ *(?:- +)*/;\n\n/**\n * Backstop, not a fit-to-width rule: `padding-left` counts toward the flex item's\n * `min-width: auto`, so a pathological key could otherwise widen the row past its panel. Set\n * well past any realistic key (the deepest in connector step YAML is ~18ch) because a clamped\n * row stops aligning under its value, which is the whole point of the hang.\n */\nconst MAX_HANG_CH = 32;\n\n/**\n * Hangs a wrapped row under the start of its line's value, so it can't read as a new key.\n * Measured in `ch` — the block is monospace, so one `ch` is one space (tabs are not counted).\n */\nexport const hangingIndentStyle = (line: string): React.CSSProperties => {\n const column = (VALUE_COLUMN.exec(line) ?? INDENT_COLUMN.exec(line))?.[0].length ?? 0;\n const hang = Math.min(column, MAX_HANG_CH);\n if (hang === 0) {\n return {};\n }\n const hangingIndent = `${hang}ch`;\n return { paddingLeft: hangingIndent, textIndent: `-${hangingIndent}` };\n};\n"],"names":["CODE_FONT","CODE_TOKEN_COLOR","rowsWrapperStyle","wrap","VALUE_COLUMN","INDENT_COLUMN","MAX_HANG_CH","hangingIndentStyle","line","_a","column","hang","hangingIndent"],"mappings":"AAEO,MAAMA,IAAiC;AAAA,EAC1C,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,YAAY;AAChB,GAGaC,IAAmB;AAAA,EAC5B,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AACZ,GAOaC,IAAmB,CAACC,MAC7BA,IAAO,EAAE,OAAO,OAAA,IAAW,EAAE,OAAO,eAAe,UAAU,OAAA,GAG3DC,IAAe,2DAEfC,IAAgB,eAQhBC,IAAc,IAMPC,IAAqB,CAACC,MAAsC;AAzClE,MAAAC;AA0CH,QAAMC,MAAUD,IAAAL,EAAa,KAAKI,CAAI,KAAKH,EAAc,KAAKG,CAAI,MAAlD,gBAAAC,EAAuD,GAAG,WAAU,GAC9EE,IAAO,KAAK,IAAID,GAAQJ,CAAW;AACzC,MAAIK,MAAS;AACT,WAAO,CAAA;AAEX,QAAMC,IAAgB,GAAGD,CAAI;AAC7B,SAAO,EAAE,aAAaC,GAAe,YAAY,IAAIA,CAAa,GAAA;AACtE;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CODE_TOKEN_COLOR as s } from "./codeBlockStyles.js";
|
|
2
|
+
const c = 1e4, k = new RegExp('("(?:[^"\\\\]|\\\\.)*(?:"|\\\\?$))(\\s*:)?|(?<![\\w.\\-])(-?\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?)(?![\\w.])|\\b(true|false|null)\\b', "g"), f = {
|
|
3
|
+
key: s.keyword,
|
|
4
|
+
string: s.string,
|
|
5
|
+
number: s.number,
|
|
6
|
+
literal: s.keyword
|
|
7
|
+
}, p = (e) => {
|
|
8
|
+
if (e.length > c)
|
|
9
|
+
return [{ text: e, kind: "plain" }];
|
|
10
|
+
const t = [];
|
|
11
|
+
let n = 0;
|
|
12
|
+
for (const i of e.matchAll(k)) {
|
|
13
|
+
const o = i.index ?? 0;
|
|
14
|
+
o > n && t.push({ text: e.slice(n, o), kind: "plain" });
|
|
15
|
+
const [, l, r, d, u] = i;
|
|
16
|
+
l !== void 0 ? (t.push({ text: l, kind: r ? "key" : "string" }), r && t.push({ text: r, kind: "plain" })) : d !== void 0 ? t.push({ text: d, kind: "number" }) : u !== void 0 && t.push({ text: u, kind: "literal" }), n = o + i[0].length;
|
|
17
|
+
}
|
|
18
|
+
return n < e.length && t.push({ text: e.slice(n), kind: "plain" }), t;
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
f as JSON_TOKEN_COLORS,
|
|
22
|
+
c as MAX_TOKENIZED_LINE_LENGTH,
|
|
23
|
+
p as jsonTokensOf
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=codePreviewJson.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codePreviewJson.js","sources":["../../src/components/codePreviewJson.ts"],"sourcesContent":["import { CODE_TOKEN_COLOR } from './codeBlockStyles';\n\nexport type JsonTokenKind = 'key' | 'string' | 'number' | 'literal' | 'plain';\n\nexport interface JsonToken {\n text: string;\n kind: JsonTokenKind;\n}\n\n/** Past this a line stays plain: minified payloads arrive as one line, and every token is a span. */\nexport const MAX_TOKENIZED_LINE_LENGTH = 10_000;\n\n// An unterminated string runs to the end of the line, so a truncated payload is one string\n// token rather than a retry from every later quote.\nconst TOKEN =\n /(\"(?:[^\"\\\\]|\\\\.)*(?:\"|\\\\?$))(\\s*:)?|(?<![\\w.\\-])(-?\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?)(?![\\w.])|\\b(true|false|null)\\b/g;\n\nexport const JSON_TOKEN_COLORS: Record<Exclude<JsonTokenKind, 'plain'>, string> = {\n key: CODE_TOKEN_COLOR.keyword,\n string: CODE_TOKEN_COLOR.string,\n number: CODE_TOKEN_COLOR.number,\n literal: CODE_TOKEN_COLOR.keyword,\n};\n\n/** One line of pretty-printed JSON, split into coloured runs. Anything unrecognised stays plain. */\nexport const jsonTokensOf = (line: string): JsonToken[] => {\n if (line.length > MAX_TOKENIZED_LINE_LENGTH) {\n return [{ text: line, kind: 'plain' }];\n }\n const tokens: JsonToken[] = [];\n let last = 0;\n for (const match of line.matchAll(TOKEN)) {\n const start = match.index ?? 0;\n if (start > last) {\n tokens.push({ text: line.slice(last, start), kind: 'plain' });\n }\n const [, quoted, colon, number, literal] = match;\n if (quoted !== undefined) {\n tokens.push({ text: quoted, kind: colon ? 'key' : 'string' });\n if (colon) {\n tokens.push({ text: colon, kind: 'plain' });\n }\n } else if (number !== undefined) {\n tokens.push({ text: number, kind: 'number' });\n } else if (literal !== undefined) {\n tokens.push({ text: literal, kind: 'literal' });\n }\n last = start + match[0].length;\n }\n if (last < line.length) {\n tokens.push({ text: line.slice(last), kind: 'plain' });\n }\n return tokens;\n};\n"],"names":["MAX_TOKENIZED_LINE_LENGTH","TOKEN","JSON_TOKEN_COLORS","CODE_TOKEN_COLOR","jsonTokensOf","line","tokens","last","match","start","quoted","colon","number","literal"],"mappings":";AAUO,MAAMA,IAA4B,KAInCC,IACF,WAAA,qIAAA,GAAA,GAESC,IAAqE;AAAA,EAC9E,KAAKC,EAAiB;AAAA,EACtB,QAAQA,EAAiB;AAAA,EACzB,QAAQA,EAAiB;AAAA,EACzB,SAASA,EAAiB;AAC9B,GAGaC,IAAe,CAACC,MAA8B;AACvD,MAAIA,EAAK,SAASL;AACd,WAAO,CAAC,EAAE,MAAMK,GAAM,MAAM,SAAS;AAEzC,QAAMC,IAAsB,CAAA;AAC5B,MAAIC,IAAO;AACX,aAAWC,KAASH,EAAK,SAASJ,CAAK,GAAG;AACtC,UAAMQ,IAAQD,EAAM,SAAS;AAC7B,IAAIC,IAAQF,KACRD,EAAO,KAAK,EAAE,MAAMD,EAAK,MAAME,GAAME,CAAK,GAAG,MAAM,SAAS;AAEhE,UAAM,CAAA,EAAGC,GAAQC,GAAOC,GAAQC,CAAO,IAAIL;AAC3C,IAAIE,MAAW,UACXJ,EAAO,KAAK,EAAE,MAAMI,GAAQ,MAAMC,IAAQ,QAAQ,UAAU,GACxDA,KACAL,EAAO,KAAK,EAAE,MAAMK,GAAO,MAAM,SAAS,KAEvCC,MAAW,SAClBN,EAAO,KAAK,EAAE,MAAMM,GAAQ,MAAM,UAAU,IACrCC,MAAY,UACnBP,EAAO,KAAK,EAAE,MAAMO,GAAS,MAAM,WAAW,GAElDN,IAAOE,IAAQD,EAAM,CAAC,EAAE;AAAA,EAC5B;AACA,SAAID,IAAOF,EAAK,UACZC,EAAO,KAAK,EAAE,MAAMD,EAAK,MAAME,CAAI,GAAG,MAAM,SAAS,GAElDD;AACX;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1316,6 +1316,8 @@ export declare interface CodePreviewProps {
|
|
|
1316
1316
|
* title still names it for assistive tech. */
|
|
1317
1317
|
titleHidden?: boolean;
|
|
1318
1318
|
code: string;
|
|
1319
|
+
/** `json` colours keys, strings, numbers and literals line by line. Plain text by default. */
|
|
1320
|
+
language?: 'json';
|
|
1319
1321
|
/** How many lines show until the reader asks for all of them. `Infinity` shows them all. */
|
|
1320
1322
|
previewLines?: number;
|
|
1321
1323
|
/** 1-based line numbers to flag, such as the fields a scanner caught. Colour alone, so say why nearby. */
|
|
@@ -2364,6 +2366,7 @@ export declare interface FormActionsProps {
|
|
|
2364
2366
|
/** The outline action before it, usually Cancel. */
|
|
2365
2367
|
secondary?: FormAction;
|
|
2366
2368
|
size?: 'small' | 'medium';
|
|
2369
|
+
note?: default_2.ReactNode;
|
|
2367
2370
|
className?: string;
|
|
2368
2371
|
}
|
|
2369
2372
|
|
|
@@ -2569,6 +2572,8 @@ export declare interface HexagonProps {
|
|
|
2569
2572
|
tone?: HexagonTone;
|
|
2570
2573
|
/** `small` is 16px, `medium` 18px. */
|
|
2571
2574
|
size?: HexagonSize;
|
|
2575
|
+
/** `hexagon` for an outcome; `shield`, a shield with a star cut out, for a protection or risk level. Same tones and sizes. */
|
|
2576
|
+
shape?: HexagonShape;
|
|
2572
2577
|
/** Draws it at 20% strength, for a step of a scale that isn't the current one. */
|
|
2573
2578
|
dimmed?: boolean;
|
|
2574
2579
|
className?: string;
|
|
@@ -2577,8 +2582,10 @@ export declare interface HexagonProps {
|
|
|
2577
2582
|
export declare const HexagonScale: default_2.FC<HexagonScaleProps>;
|
|
2578
2583
|
|
|
2579
2584
|
export declare interface HexagonScaleProps {
|
|
2580
|
-
/** One
|
|
2585
|
+
/** One mark per step, in order. */
|
|
2581
2586
|
steps: readonly HexagonTone[];
|
|
2587
|
+
/** Every step's outline; default `hexagon`. */
|
|
2588
|
+
shape?: HexagonShape;
|
|
2582
2589
|
/** Index of the step drawn at full strength; the rest are dimmed. Omit to dim them all. */
|
|
2583
2590
|
current?: number;
|
|
2584
2591
|
/** Only when it stands alone; beside text naming the step it is decorative. */
|
|
@@ -2588,6 +2595,8 @@ export declare interface HexagonScaleProps {
|
|
|
2588
2595
|
className?: string;
|
|
2589
2596
|
}
|
|
2590
2597
|
|
|
2598
|
+
export declare type HexagonShape = 'hexagon' | 'shield';
|
|
2599
|
+
|
|
2591
2600
|
export declare type HexagonSize = 'small' | 'medium';
|
|
2592
2601
|
|
|
2593
2602
|
export declare type HexagonTone = 'neutral' | 'success' | 'caution' | 'warning' | 'error';
|
|
@@ -5690,27 +5699,7 @@ export declare interface SidePanelAside {
|
|
|
5690
5699
|
children: default_2.ReactNode;
|
|
5691
5700
|
}
|
|
5692
5701
|
|
|
5693
|
-
export declare
|
|
5694
|
-
|
|
5695
|
-
export declare interface SidePanelNavFooterProps {
|
|
5696
|
-
onNavigateUp?: () => void;
|
|
5697
|
-
onNavigateDown?: () => void;
|
|
5698
|
-
canNavigateUp?: boolean;
|
|
5699
|
-
canNavigateDown?: boolean;
|
|
5700
|
-
/** Either tab handler adds the ← → Switch tabs keycaps, for a panel with tabs. */
|
|
5701
|
-
onPreviousTab?: () => void;
|
|
5702
|
-
onNextTab?: () => void;
|
|
5703
|
-
canPreviousTab?: boolean;
|
|
5704
|
-
canNextTab?: boolean;
|
|
5705
|
-
actions?: default_2.ReactNode;
|
|
5706
|
-
/** The reader's place, such as `Step 2 of 5`. Default: `Navigate`. */
|
|
5707
|
-
navigateLabel?: string;
|
|
5708
|
-
/** Says what ESC does. Default: `Close`. */
|
|
5709
|
-
escapeLabel?: string;
|
|
5710
|
-
className?: string;
|
|
5711
|
-
}
|
|
5712
|
-
|
|
5713
|
-
export declare interface SidePanelProps {
|
|
5702
|
+
export declare interface SidePanelBaseProps {
|
|
5714
5703
|
open: boolean;
|
|
5715
5704
|
/** Dismiss handler — close button, ESC, or overlay click. */
|
|
5716
5705
|
onClose: () => void;
|
|
@@ -5779,9 +5768,50 @@ export declare interface SidePanelProps {
|
|
|
5779
5768
|
* comes next, say. It leaves the header at its usual height, level with the page's own.
|
|
5780
5769
|
*/
|
|
5781
5770
|
subheader?: default_2.ReactNode;
|
|
5771
|
+
tray?: default_2.ReactNode;
|
|
5772
|
+
}
|
|
5773
|
+
|
|
5774
|
+
export declare interface SidePanelChildrenProps extends SidePanelBaseProps {
|
|
5782
5775
|
children: default_2.ReactNode;
|
|
5776
|
+
columns?: undefined;
|
|
5777
|
+
}
|
|
5778
|
+
|
|
5779
|
+
export declare interface SidePanelColumn {
|
|
5780
|
+
id: string;
|
|
5781
|
+
content: default_2.ReactNode;
|
|
5782
|
+
share: number;
|
|
5783
|
+
bodyPadding?: boolean;
|
|
5784
|
+
fill?: boolean;
|
|
5785
|
+
'aria-label'?: string;
|
|
5786
|
+
}
|
|
5787
|
+
|
|
5788
|
+
export declare interface SidePanelColumnsProps extends SidePanelBaseProps {
|
|
5789
|
+
columns: SidePanelColumn[];
|
|
5790
|
+
children?: undefined;
|
|
5791
|
+
}
|
|
5792
|
+
|
|
5793
|
+
export declare const SidePanelNavFooter: default_2.FC<SidePanelNavFooterProps>;
|
|
5794
|
+
|
|
5795
|
+
export declare interface SidePanelNavFooterProps {
|
|
5796
|
+
onNavigateUp?: () => void;
|
|
5797
|
+
onNavigateDown?: () => void;
|
|
5798
|
+
canNavigateUp?: boolean;
|
|
5799
|
+
canNavigateDown?: boolean;
|
|
5800
|
+
/** Either tab handler adds the ← → Switch tabs keycaps, for a panel with tabs. */
|
|
5801
|
+
onPreviousTab?: () => void;
|
|
5802
|
+
onNextTab?: () => void;
|
|
5803
|
+
canPreviousTab?: boolean;
|
|
5804
|
+
canNextTab?: boolean;
|
|
5805
|
+
actions?: default_2.ReactNode;
|
|
5806
|
+
/** The reader's place, such as `Step 2 of 5`. Default: `Navigate`. */
|
|
5807
|
+
navigateLabel?: string;
|
|
5808
|
+
/** Says what ESC does. Default: `Close`. */
|
|
5809
|
+
escapeLabel?: string;
|
|
5810
|
+
className?: string;
|
|
5783
5811
|
}
|
|
5784
5812
|
|
|
5813
|
+
export declare type SidePanelProps = SidePanelChildrenProps | SidePanelColumnsProps;
|
|
5814
|
+
|
|
5785
5815
|
export declare interface SidePanelSheet {
|
|
5786
5816
|
/** Names the sheet for assistive tech, and its close button. */
|
|
5787
5817
|
'aria-label': string;
|