@stackone/malachite 2.116.0 → 2.117.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.
Files changed (48) hide show
  1. package/COMPONENTS.md +18 -8
  2. package/dist/assets/icons/caret_down.svg.js +2 -2
  3. package/dist/assets/icons/caret_down.svg.js.map +1 -1
  4. package/dist/assets/icons/caret_up.svg.js +2 -2
  5. package/dist/assets/icons/caret_up.svg.js.map +1 -1
  6. package/dist/assets/icons/minus.svg.js +6 -0
  7. package/dist/assets/icons/minus.svg.js.map +1 -0
  8. package/dist/assets/icons/warning_circle_filled.svg.js +3 -3
  9. package/dist/assets/icons/warning_circle_filled.svg.js.map +1 -1
  10. package/dist/components/Alert.js +3 -3
  11. package/dist/components/Alert.js.map +1 -1
  12. package/dist/components/BaseFormComponent.js +84 -64
  13. package/dist/components/BaseFormComponent.js.map +1 -1
  14. package/dist/components/ClampText.js +89 -15
  15. package/dist/components/ClampText.js.map +1 -1
  16. package/dist/components/CustomIcons/MinusIcon.js +16 -0
  17. package/dist/components/CustomIcons/MinusIcon.js.map +1 -0
  18. package/dist/components/CustomIcons/index.js +150 -147
  19. package/dist/components/CustomIcons/index.js.map +1 -1
  20. package/dist/components/Dropdown.js +449 -439
  21. package/dist/components/Dropdown.js.map +1 -1
  22. package/dist/components/FieldBlock.js +32 -21
  23. package/dist/components/FieldBlock.js.map +1 -1
  24. package/dist/components/GuideTimeline/GuideJumpMenu.js +74 -0
  25. package/dist/components/GuideTimeline/GuideJumpMenu.js.map +1 -0
  26. package/dist/components/GuideTimeline/GuideProgress.js +81 -0
  27. package/dist/components/GuideTimeline/GuideProgress.js.map +1 -0
  28. package/dist/components/GuideTimeline/GuideTimeline.js +313 -0
  29. package/dist/components/GuideTimeline/GuideTimeline.js.map +1 -0
  30. package/dist/components/GuideTimeline/guideTimelinePositions.js +23 -0
  31. package/dist/components/GuideTimeline/guideTimelinePositions.js.map +1 -0
  32. package/dist/components/MultiSelect.js +1 -1
  33. package/dist/components/MultiSelect.js.map +1 -1
  34. package/dist/components/SidePanel.js +382 -227
  35. package/dist/components/SidePanel.js.map +1 -1
  36. package/dist/components/Tooltip.js +1 -1
  37. package/dist/components/Tooltip.js.map +1 -1
  38. package/dist/components/TruncatedTooltip.js +1 -1
  39. package/dist/components/TruncatedTooltip.js.map +1 -1
  40. package/dist/components/ZoomableImage.js +144 -32
  41. package/dist/components/ZoomableImage.js.map +1 -1
  42. package/dist/components/sidePanelOverlay.js +7 -0
  43. package/dist/components/sidePanelOverlay.js.map +1 -0
  44. package/dist/index.d.ts +147 -11
  45. package/dist/index.js +265 -255
  46. package/dist/index.js.map +1 -1
  47. package/dist/tailwind.css.js +1 -1
  48. 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 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 { inertWhen } from './inert';\nimport { OVERLAY_ICON_BUTTON_CLASSES, useOverlayBehaviour } from './overlayBehaviour';\nimport { OVERLAY_ELEVATED_ATTR, type OverlayStacking, overlayIdentity } from './portalOverlay';\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 /** 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 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 children: React.ReactNode;\n}\n\nconst TRANSITION_MS = 200;\nconst ASIDE_MIN_WIDTH = '360px';\n\ninterface ScrollingBodyProps {\n bodyPadding: boolean;\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 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 ${stableGutter ? '[scrollbar-gutter:stable]' : ''} ${bodyPadding && !hasCallouts ? 'px-[28px]' : ''}`}\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 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 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 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 // 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 = aside ? (\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={`flex min-w-0 items-center gap-[8px] px-[20px] py-[18px] ${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\">{aside.headerExtra}</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 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 className={`absolute top-[8px] right-[8px] bottom-[8px] grid grid-rows-[auto_minmax(0,1fr)_auto] overflow-x-auto overflow-y-hidden rounded-[20px] border border-solid border-[var(--malachite-card-border)] bg-[var(--malachite-card-background)] text-[var(--malachite-card-foreground)] outline-none [box-shadow:var(--malachite-shadow-lg)]`}\n style={{\n width: `min(calc(100% - 16px), ${aside ? `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: aside\n ? `minmax(${ASIDE_MIN_WIDTH}, 1fr) minmax(${panelColumnWidth}, ${panelColumnWidth})`\n : `minmax(0px, 1fr) minmax(0px, ${panelColumnWidth})`,\n }}\n >\n {asideColumn}\n {/* An explicit column: an implicit one is sized to its widest content and overflows the panel. */}\n <PanelColumn onSubmit={onSubmit}>\n <div\n className={`flex flex-col gap-[20px] px-[20px] py-[18px] ${dividerBelow}`}\n {...inertWhen(!!shownSheet)}\n >\n <div className=\"flex items-center gap-[12px]\">\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 ? (\n <span className=\"flex shrink-0 items-center\">{icon}</span>\n ) : 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 {subtitleNode}\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=\"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 {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\n ref={setStripSlot}\n className=\"shrink-0 px-[28px] empty:hidden\"\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 </div>\n {footer ? (\n <div\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 {shownSheet ? <SidePanelSheetLayer sheet={shownSheet} /> : null}\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","ScrollingBody","bodyPadding","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","titleExtra","description","toolbar","toolbarPadding","headerDivider","icon","headerExtra","footer","onBack","maxWidth","ariaLabel","ariaLabelledBy","stacking","aside","sheet","useId","stripSlot","setStripSlot","useState","tabSets","setTabSets","registerTabs","useCallback","count","scroller","setScroller","tabsContext","useMemo","descriptionId","isVisible","setIsVisible","isMounted","setIsMounted","frameRef","useRef","unmountTimerRef","hostRef","handlePanelRef","isTopmost","zIndex","elevated","useOverlayBehaviour","lastSheet","useLayoutEffect","useEffect","afterNextPaint","closePanel","shownSheet","shownCallouts","panelColumnWidth","dividerBelow","asideColumn","inertWhen","SidePanelTitle","subtitleBelow","titleNode","subtitleNode","EllipsisText","titleExtraNode","headerExtraNode","createPortal","ShadowRootWrapper","overlayIdentity","OVERLAY_ELEVATED_ATTR","SidePanelTabsContext","_","OVERLAY_ICON_BUTTON_CLASSES","ArrowLeftIcon","DismissIcon","SidePanelSheetLayer","SidePanelTabs"],"mappings":";;;;;;;;;;;;;;;;AAmGA,MAAMA,IAAgB,KAChBC,KAAkB,SAalBC,KAA8C,CAAC;AAAA,EACjD,aAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,aAAAC;AAAA,EACA,UAAAC;AACJ,MAAM;AACF,QAAMC,IAAc,CAAC,EAACN,KAAA,QAAAA,EAAU;AAGhC,SACI,gBAAAO;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,KAAKH;AAAA,MACL,WAAW,kCAAkCD,IAAe,8BAA8B,EAAE,IAAIJ,KAAe,CAACO,IAAc,cAAc,EAAE;AAAA,MAE7I,UAAA;AAAA,QAAAN,KAAA,gBAAAA,EAAU,IAAI,CAACQ,GAASC,MACrB,gBAAAC;AAAA,UAACC;AAAA,UAAA;AAAA,YAEG,IAAIV,IAAY,GAAGA,CAAS,IAAIQ,CAAK,KAAK;AAAA,YAC1C,MAAMD,EAAQ;AAAA,YACd,SAASA,EAAQ;AAAA,YACjB,YAAAN;AAAA,UAAA;AAAA,UAJKO;AAAA,QAAA;AAAA,QAOZV,sBACI,OAAA,EAAI,WAAWO,IAAc,aAAa,aAAc,UAAAD,GAAS,IAElEA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIhB,GAEMO,IAAY,CAACC,MACf,OAAOA,KAAU,WAAW,GAAGA,CAAK,OAAOA,GAGzCC,KAAsB,CAACC,MAA+C;AACxE,EAAIA,EAAM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A,0BAACZ;AAAA,0BAAA;AAAA,4BACG,aAAAC;AAAA,4BACA,UAAU0E;AAAA,4BACV,WAAAxE;AAAA,4BACA,YAAAC;AAAA,4BACA,cAAc0C,KAAU;AAAA,4BACxB,aAAaM;AAAA,4BAEb,4BAACuC,GAAqB,UAArB,EAA8B,OAAOtC,IACjC,UAAA9C,GAAA,CACL;AAAA,0BAAA;AAAA,wBAAA;AAAA,sBACJ;AAAA,oBAAA;AAAA,kBAAA;AAAA,kBAEH2B,IACG,gBAAAtB;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACG,WAAU;AAAA,sBACT,GAAGmE,EAAU,CAAC,CAACL,CAAU;AAAA,sBAEzB,UAAAxC;AAAA,oBAAA;AAAA,kBAAA,IAEL;AAAA,gBAAA,GACR;AAAA,gBACCwC,IAAa,gBAAA9D,EAACoF,IAAA,EAAoB,OAAOtB,GAAY,IAAK;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAC/D,EAAA,CACJ,EAAA,CACJ;AAAA,MAAA;AAAA,IAAA;AAAA,IAEJ,SAAS;AAAA,EAAA;AAEjB;AAEArD,GAAU,OAAO4E;"}
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,GACAC,GACAC,MACuC;AACvC,QAAM,CAACC,GAASC,CAAU,IAAIC,EAA+C,CAAA,CAAE;AAE/E,SAAAC,GAAU,MAAM;AACZ,QAAI,CAACN,KAAW,OAAO,iBAAmB;AACtC;AAEJ,UAAMO,IAAU,MACZH,EAAW;AAAA,MACP,QAAQH,KAAA,gBAAAA,EA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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;"}
@@ -17,7 +17,7 @@ const wt = new RegExp("(?<=[/\\\\.\\-_?&#=:@])"), xt = (o) => o.split(wt).map((s
17
17
  }, x = 8, It = '"Inter", ui-sans-serif, system-ui, sans-serif', Mt = ({
18
18
  text: o,
19
19
  children: s,
20
- delay: R = 1,
20
+ delay: R = 0.2,
21
21
  wrapChildren: J = !1,
22
22
  triggerAs: Q = "div",
23
23
  inline: M = !1,
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sources":["../../src/components/Tooltip.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect, useId, useInsertionEffect, useCallback } from 'react';\nimport { createPortal } from 'react-dom';\nimport { FOCUS_RING } from './focusRing';\nimport { ensureOverlayStyles, overlayIdentity } from './portalOverlay';\nimport { useTopLayer } from './topLayer';\nimport { useFollowTrigger } from './useFollowTrigger';\n\n// Split after each delimiter so long values (URLs, dotted paths) wrap at \"/\" or \".\"\n// instead of mid-token. <wbr> is copy-safe (a zero-width space would corrupt a copied\n// URL); overflow-wrap still handles a single run too long to fit.\nconst WRAP_AFTER = /(?<=[/\\\\.\\-_?&#=:@])/;\nconst withBreakOpportunities = (value: string): React.ReactNode =>\n value.split(WRAP_AFTER).map((chunk, i) => (\n <React.Fragment key={i}>\n {chunk}\n <wbr />\n </React.Fragment>\n ));\n\ninterface TooltipProps {\n text: React.ReactNode | string;\n children: React.ReactNode;\n delay?: number;\n wrapChildren?: boolean;\n placement?: 'top' | 'bottom' | 'left' | 'right';\n isShrinkable?: boolean;\n fill?: boolean;\n /** Max width of tooltip. Default: 320px */\n maxWidth?: number | string;\n /** Called synchronously when the trigger is hovered/focused; return false to\n * suppress the tooltip for this interaction. Lets wrappers defer expensive\n * checks (e.g. truncation measurement) to interaction time instead of mount. */\n shouldShow?: () => boolean;\n suppressed?: boolean;\n triggerAs?: 'div' | 'span';\n inline?: boolean;\n /** Whether the tooltip acts as the trigger's accessible description. False where the\n * trigger already points at the same sentence on screen, so it is not announced twice. */\n describesTrigger?: boolean;\n /** False to open on hover only, e.g. where script moves focus onto the trigger. */\n showOnFocus?: boolean;\n /** Makes a trigger that cannot take focus a tab stop. Not for focusable children. */\n focusableTrigger?: boolean;\n}\n\nconst SHRINKABLE_STYLE: React.CSSProperties = {\n minWidth: 0,\n overflow: 'hidden',\n};\n\nconst FILL_STYLE: React.CSSProperties = {\n flex: 1,\n minWidth: 0,\n};\n\n/** Kept clear of the viewport edge so a clamped tooltip does not sit flush against it. */\nconst VIEWPORT_MARGIN = 8;\n\n// The tooltip portals to document.body, outside the shadow root's `--font-sans`, so it names the\n// stack itself rather than inheriting the host page's font (a serif in an MCP card's iframe).\nconst TOOLTIP_FONT_FAMILY = '\"Inter\", ui-sans-serif, system-ui, sans-serif';\n\nconst Tooltip: React.FC<TooltipProps> = ({\n text,\n children,\n delay = 1,\n wrapChildren = false,\n triggerAs = 'div',\n inline = false,\n placement = 'top',\n isShrinkable = false,\n maxWidth = '320px',\n fill = false,\n shouldShow,\n suppressed = false,\n describesTrigger = true,\n showOnFocus = true,\n focusableTrigger = false,\n}) => {\n const triggerStyle =\n isShrinkable || fill\n ? { ...(isShrinkable ? SHRINKABLE_STYLE : {}), ...(fill ? FILL_STYLE : {}) }\n : undefined;\n\n const [isVisible, setIsVisible] = useState(false);\n // Portal mounts on first show, not on mount: an at-rest tooltip otherwise\n // costs a hidden document.body node plus a getBoundingClientRect per render —\n // multiplied by every row in a large table.\n // Mounted up front so a focusable trigger is described on first focus.\n const [hasShown, setHasShown] = useState(false);\n const isMounted = hasShown || focusableTrigger;\n const timeoutRef = useRef<NodeJS.Timeout | null>(null);\n const showFrameRef = useRef<number | null>(null);\n\n const cancelPendingShow = useCallback(() => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n if (showFrameRef.current !== null) {\n cancelAnimationFrame(showFrameRef.current);\n showFrameRef.current = null;\n }\n }, []);\n\n const scheduleVisible = () => {\n // Two steps so the portal mounts hidden first and the fade-in transition\n // still runs on the very first show. The frame is tracked so leave/blur/\n // unmount can cancel a show that is already past its delay.\n setHasShown(true);\n if (showFrameRef.current !== null) {\n cancelAnimationFrame(showFrameRef.current);\n }\n showFrameRef.current = requestAnimationFrame(() => {\n showFrameRef.current = null;\n setIsVisible(true);\n });\n };\n const tooltipRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLDivElement>(null);\n\n // Tied to visibility, not mount: the node is latched into the DOM after its first show, and\n // re-entering on each show keeps a tooltip above the panel it is annotating.\n useTopLayer(tooltipRef, isVisible);\n\n const tooltipId = useId();\n\n const hasText = text !== null && text !== undefined && text !== '' && text !== false;\n\n const handleMouseEnter = (e: React.MouseEvent) => {\n e.stopPropagation();\n\n if (!hasText || suppressed || (shouldShow && !shouldShow())) {\n return;\n }\n\n cancelPendingShow();\n\n timeoutRef.current = setTimeout(() => {\n scheduleVisible();\n }, delay * 1000);\n };\n\n const handleMouseLeave = (e: React.MouseEvent) => {\n e.stopPropagation();\n\n cancelPendingShow();\n setIsVisible(false);\n };\n\n const handleFocus = () => {\n if (!showOnFocus || !hasText || suppressed || (shouldShow && !shouldShow())) {\n return;\n }\n\n cancelPendingShow();\n scheduleVisible();\n };\n\n const handleBlur = () => {\n cancelPendingShow();\n setIsVisible(false);\n };\n\n // Turning on while the trigger already holds focus fires no focus event to open on.\n const showOnFocusRef = useRef(showOnFocus);\n useEffect(() => {\n const switchedOn = showOnFocus && !showOnFocusRef.current;\n showOnFocusRef.current = showOnFocus;\n if (switchedOn && triggerRef.current?.matches(':focus-within')) {\n handleFocus();\n }\n });\n\n const [wasSuppressed, setWasSuppressed] = useState(suppressed);\n if (suppressed !== wasSuppressed) {\n setWasSuppressed(suppressed);\n if (suppressed) {\n setIsVisible(false);\n }\n }\n\n useEffect(() => {\n if (suppressed) {\n cancelPendingShow();\n }\n }, [suppressed, cancelPendingShow]);\n\n const [, forceUpdate] = useState({});\n\n const hideWithTrigger = useCallback(() => {\n cancelPendingShow();\n setIsVisible(false);\n }, [cancelPendingShow]);\n\n useFollowTrigger(isVisible, triggerRef, () => forceUpdate({}), hideWithTrigger);\n\n useEffect(() => {\n // Only a VISIBLE tooltip needs to track resize; keeping global listeners per mounted\n // instance made every event fan out across every tooltip on the page. Scrolling is\n // followed by useFollowTrigger.\n if (!isVisible) {\n return () => {\n cancelPendingShow();\n };\n }\n const handleUpdate = () => {\n forceUpdate({});\n };\n\n window.addEventListener('resize', handleUpdate);\n\n return () => {\n cancelPendingShow();\n window.removeEventListener('resize', handleUpdate);\n };\n }, [isVisible, cancelPendingShow]);\n\n // The first render that mounts the tooltip has no measured width yet, so the clamp below\n // cannot run on it. One extra pass once it is in the DOM gives the clamp its measurement\n // — before the opacity transition finishes, so nothing is seen sliding into place.\n useEffect(() => {\n if (isVisible) {\n forceUpdate({});\n }\n }, [isVisible]);\n\n const getTooltipStyles = (): React.CSSProperties => {\n if (!triggerRef.current) {\n return { display: 'none' };\n }\n\n const rect = triggerRef.current.getBoundingClientRect();\n\n const baseStyles: React.CSSProperties = {\n position: 'fixed',\n display: 'flex',\n width: 'max-content',\n maxWidth: typeof maxWidth === 'number' ? `${maxWidth}px` : maxWidth,\n minWidth: '32px',\n minHeight: '32px',\n padding: '8px 12px',\n alignItems: 'center',\n gap: '8px',\n borderRadius: '12px',\n backgroundColor: 'var(--malachite-tooltip-background, rgb(59, 59, 59))',\n color: 'var(--malachite-tooltip-foreground, rgb(255, 255, 255))',\n boxShadow: 'var(--malachite-tooltip-shadow, 0px 0px 10px 0px rgba(0, 0, 0, 0.20))',\n fontFamily: TOOLTIP_FONT_FAMILY,\n fontSize: '14px',\n lineHeight: '1.4',\n whiteSpace: 'normal',\n textAlign: 'left',\n pointerEvents: 'none',\n opacity: isVisible ? 1 : 0,\n visibility: isVisible ? 'visible' : 'hidden',\n transition:\n 'opacity 150ms ease-in-out, transform 150ms ease-in-out, visibility 150ms ease-in-out',\n };\n\n // A trigger near the viewport edge would otherwise centre a wide tooltip half off\n // screen, where the panel or the window crops it. Clamping the CENTRE keeps the\n // `translateX(-50%)` placement honest: the box stays put, it just stops short.\n const measured = tooltipRef.current?.getBoundingClientRect();\n const width = measured?.width ?? 0;\n const height = measured?.height ?? 0;\n\n const centeredLeft = (): number => {\n const desired = rect.left + rect.width / 2;\n\n if (width === 0) {\n return desired;\n }\n\n const half = width / 2;\n const min = VIEWPORT_MARGIN + half;\n const max = window.innerWidth - VIEWPORT_MARGIN - half;\n\n // A tooltip wider than the viewport has no in-bounds centre; leave it centred\n // rather than pinning it to a nonsensical one.\n return min > max ? desired : Math.min(Math.max(desired, min), max);\n };\n\n // At the viewport's top or bottom edge the tooltip would land where the window or an\n // embedding iframe crops it, so it flips to the side that has room.\n const fitsAbove = rect.top - 8 - height >= VIEWPORT_MARGIN;\n const fitsBelow = rect.bottom + 8 + height <= window.innerHeight - VIEWPORT_MARGIN;\n const side =\n placement === 'top' && !fitsAbove && fitsBelow\n ? 'bottom'\n : placement === 'bottom' && !fitsBelow && fitsAbove\n ? 'top'\n : placement;\n\n switch (side) {\n case 'top':\n return {\n ...baseStyles,\n top: rect.top - 8,\n left: centeredLeft(),\n transform: `translate(-50%, -100%) ${isVisible ? 'scale(1)' : 'scale(0.95)'}`,\n };\n case 'bottom':\n return {\n ...baseStyles,\n top: rect.bottom + 8,\n left: centeredLeft(),\n transform: `translateX(-50%) ${isVisible ? 'scale(1)' : 'scale(0.95)'}`,\n };\n case 'left':\n return {\n ...baseStyles,\n top: rect.top + rect.height / 2,\n left: rect.left - 8,\n transform: `translate(-100%, -50%) ${isVisible ? 'scale(1)' : 'scale(0.95)'}`,\n };\n case 'right':\n return {\n ...baseStyles,\n top: rect.top + rect.height / 2,\n left: rect.right + 8,\n transform: `translateY(-50%) ${isVisible ? 'scale(1)' : 'scale(0.95)'}`,\n };\n default:\n return {\n ...baseStyles,\n top: rect.top - 8,\n left: centeredLeft(),\n transform: `translate(-50%, -100%) ${isVisible ? 'scale(1)' : 'scale(0.95)'}`,\n };\n }\n };\n\n // Only reference the tooltip id once the portal can exist — a dangling\n // aria-describedby (text set, never shown) confuses assistive tech.\n const describedBy = hasText && isMounted && describesTrigger ? tooltipId : undefined;\n useInsertionEffect(() => {\n if (hasText && isMounted) {\n ensureOverlayStyles();\n }\n }, [hasText, isMounted]);\n const renderedChildren = focusableTrigger ? (\n children\n ) : wrapChildren || !React.isValidElement(children) ? (\n <span aria-describedby={describedBy} style={fill ? FILL_STYLE : undefined}>\n {children}\n </span>\n ) : (\n React.cloneElement(children as React.ReactElement, {\n 'aria-describedby':\n [(children as React.ReactElement).props['aria-describedby'], describedBy]\n .filter(Boolean)\n .join(' ') || undefined,\n })\n );\n\n const Trigger = inline ? 'span' : triggerAs;\n const isTabStop = focusableTrigger && hasText && !suppressed && showOnFocus;\n\n // Create the tooltip content without its own shadow root\n return (\n <>\n <Trigger\n ref={triggerRef}\n className={`relative ${inline ? 'inline-flex max-w-full align-middle' : 'flex'} items-center${isTabStop ? ` ${FOCUS_RING}` : ''}`}\n style={triggerStyle}\n tabIndex={isTabStop ? 0 : undefined}\n aria-describedby={focusableTrigger ? describedBy : undefined}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onFocus={handleFocus}\n onBlur={handleBlur}\n >\n {renderedChildren}\n </Trigger>\n\n {hasText &&\n isMounted &&\n createPortal(\n <div\n ref={tooltipRef}\n id={tooltipId}\n role=\"tooltip\"\n // Nothing references it, and the sentence is already on screen and\n // described: left in the tree it is a second copy to read past.\n aria-hidden={describesTrigger ? undefined : true}\n {...overlayIdentity('tooltip')}\n style={getTooltipStyles()}\n >\n {/* min-w-0 + overflow-wrap let long values wrap within maxWidth. */}\n <span\n style={{\n minWidth: 0,\n overflowWrap: 'anywhere',\n }}\n >\n {typeof text === 'string' ? withBreakOpportunities(text) : text}\n </span>\n </div>,\n document.body,\n )}\n </>\n );\n};\n\nexport default Tooltip;\n"],"names":["WRAP_AFTER","withBreakOpportunities","value","chunk","i","jsxs","React","SHRINKABLE_STYLE","FILL_STYLE","VIEWPORT_MARGIN","TOOLTIP_FONT_FAMILY","Tooltip","text","children","delay","wrapChildren","triggerAs","inline","placement","isShrinkable","maxWidth","fill","shouldShow","suppressed","describesTrigger","showOnFocus","focusableTrigger","triggerStyle","isVisible","setIsVisible","useState","hasShown","setHasShown","isMounted","timeoutRef","useRef","showFrameRef","cancelPendingShow","useCallback","scheduleVisible","tooltipRef","triggerRef","useTopLayer","tooltipId","useId","hasText","handleMouseEnter","e","handleMouseLeave","handleFocus","handleBlur","showOnFocusRef","useEffect","switchedOn","_a","wasSuppressed","setWasSuppressed","forceUpdate","hideWithTrigger","useFollowTrigger","handleUpdate","getTooltipStyles","rect","baseStyles","measured","width","height","centeredLeft","desired","half","min","max","fitsAbove","fitsBelow","describedBy","useInsertionEffect","ensureOverlayStyles","renderedChildren","jsx","Trigger","isTabStop","Fragment","FOCUS_RING","createPortal","overlayIdentity"],"mappings":";;;;;;;AAUA,MAAMA,KAAa,WAAA,yBAAA,GACbC,KAAyB,CAACC,MAC5BA,EAAM,MAAMF,EAAU,EAAE,IAAI,CAACG,GAAOC,MAChC,gBAAAC,EAACC,EAAM,UAAN,EACI,UAA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,KAAKtC;AAAA,UACL,IAAIG;AAAA,UACJ,MAAK;AAAA,UAGL,eAAanB,IAAmB,SAAY;AAAA,UAC3C,GAAG4D,GAAgB,SAAS;AAAA,UAC7B,OAAOvB,GAAA;AAAA,UAGP,UAAA,gBAAAiB;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,OAAO;AAAA,gBACH,UAAU;AAAA,gBACV,cAAc;AAAA,cAAA;AAAA,cAGjB,UAAA,OAAOlE,KAAS,WAAWX,GAAuBW,CAAI,IAAIA;AAAA,YAAA;AAAA,UAAA;AAAA,QAC/D;AAAA,MAAA;AAAA,MAEJ,SAAS;AAAA,IAAA;AAAA,EACb,GACR;AAER;"}
1
+ {"version":3,"file":"Tooltip.js","sources":["../../src/components/Tooltip.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect, useId, useInsertionEffect, useCallback } from 'react';\nimport { createPortal } from 'react-dom';\nimport { FOCUS_RING } from './focusRing';\nimport { ensureOverlayStyles, overlayIdentity } from './portalOverlay';\nimport { useTopLayer } from './topLayer';\nimport { useFollowTrigger } from './useFollowTrigger';\n\n// Split after each delimiter so long values (URLs, dotted paths) wrap at \"/\" or \".\"\n// instead of mid-token. <wbr> is copy-safe (a zero-width space would corrupt a copied\n// URL); overflow-wrap still handles a single run too long to fit.\nconst WRAP_AFTER = /(?<=[/\\\\.\\-_?&#=:@])/;\nconst withBreakOpportunities = (value: string): React.ReactNode =>\n value.split(WRAP_AFTER).map((chunk, i) => (\n <React.Fragment key={i}>\n {chunk}\n <wbr />\n </React.Fragment>\n ));\n\ninterface TooltipProps {\n text: React.ReactNode | string;\n children: React.ReactNode;\n delay?: number;\n wrapChildren?: boolean;\n placement?: 'top' | 'bottom' | 'left' | 'right';\n isShrinkable?: boolean;\n fill?: boolean;\n /** Max width of tooltip. Default: 320px */\n maxWidth?: number | string;\n /** Called synchronously when the trigger is hovered/focused; return false to\n * suppress the tooltip for this interaction. Lets wrappers defer expensive\n * checks (e.g. truncation measurement) to interaction time instead of mount. */\n shouldShow?: () => boolean;\n suppressed?: boolean;\n triggerAs?: 'div' | 'span';\n inline?: boolean;\n /** Whether the tooltip acts as the trigger's accessible description. False where the\n * trigger already points at the same sentence on screen, so it is not announced twice. */\n describesTrigger?: boolean;\n /** False to open on hover only, e.g. where script moves focus onto the trigger. */\n showOnFocus?: boolean;\n /** Makes a trigger that cannot take focus a tab stop. Not for focusable children. */\n focusableTrigger?: boolean;\n}\n\nconst SHRINKABLE_STYLE: React.CSSProperties = {\n minWidth: 0,\n overflow: 'hidden',\n};\n\nconst FILL_STYLE: React.CSSProperties = {\n flex: 1,\n minWidth: 0,\n};\n\n/** Kept clear of the viewport edge so a clamped tooltip does not sit flush against it. */\nconst VIEWPORT_MARGIN = 8;\n\n// The tooltip portals to document.body, outside the shadow root's `--font-sans`, so it names the\n// stack itself rather than inheriting the host page's font (a serif in an MCP card's iframe).\nconst TOOLTIP_FONT_FAMILY = '\"Inter\", ui-sans-serif, system-ui, sans-serif';\n\nconst Tooltip: React.FC<TooltipProps> = ({\n text,\n children,\n delay = 0.2,\n wrapChildren = false,\n triggerAs = 'div',\n inline = false,\n placement = 'top',\n isShrinkable = false,\n maxWidth = '320px',\n fill = false,\n shouldShow,\n suppressed = false,\n describesTrigger = true,\n showOnFocus = true,\n focusableTrigger = false,\n}) => {\n const triggerStyle =\n isShrinkable || fill\n ? { ...(isShrinkable ? SHRINKABLE_STYLE : {}), ...(fill ? FILL_STYLE : {}) }\n : undefined;\n\n const [isVisible, setIsVisible] = useState(false);\n // Portal mounts on first show, not on mount: an at-rest tooltip otherwise\n // costs a hidden document.body node plus a getBoundingClientRect per render —\n // multiplied by every row in a large table.\n // Mounted up front so a focusable trigger is described on first focus.\n const [hasShown, setHasShown] = useState(false);\n const isMounted = hasShown || focusableTrigger;\n const timeoutRef = useRef<NodeJS.Timeout | null>(null);\n const showFrameRef = useRef<number | null>(null);\n\n const cancelPendingShow = useCallback(() => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n if (showFrameRef.current !== null) {\n cancelAnimationFrame(showFrameRef.current);\n showFrameRef.current = null;\n }\n }, []);\n\n const scheduleVisible = () => {\n // Two steps so the portal mounts hidden first and the fade-in transition\n // still runs on the very first show. The frame is tracked so leave/blur/\n // unmount can cancel a show that is already past its delay.\n setHasShown(true);\n if (showFrameRef.current !== null) {\n cancelAnimationFrame(showFrameRef.current);\n }\n showFrameRef.current = requestAnimationFrame(() => {\n showFrameRef.current = null;\n setIsVisible(true);\n });\n };\n const tooltipRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLDivElement>(null);\n\n // Tied to visibility, not mount: the node is latched into the DOM after its first show, and\n // re-entering on each show keeps a tooltip above the panel it is annotating.\n useTopLayer(tooltipRef, isVisible);\n\n const tooltipId = useId();\n\n const hasText = text !== null && text !== undefined && text !== '' && text !== false;\n\n const handleMouseEnter = (e: React.MouseEvent) => {\n e.stopPropagation();\n\n if (!hasText || suppressed || (shouldShow && !shouldShow())) {\n return;\n }\n\n cancelPendingShow();\n\n timeoutRef.current = setTimeout(() => {\n scheduleVisible();\n }, delay * 1000);\n };\n\n const handleMouseLeave = (e: React.MouseEvent) => {\n e.stopPropagation();\n\n cancelPendingShow();\n setIsVisible(false);\n };\n\n const handleFocus = () => {\n if (!showOnFocus || !hasText || suppressed || (shouldShow && !shouldShow())) {\n return;\n }\n\n cancelPendingShow();\n scheduleVisible();\n };\n\n const handleBlur = () => {\n cancelPendingShow();\n setIsVisible(false);\n };\n\n // Turning on while the trigger already holds focus fires no focus event to open on.\n const showOnFocusRef = useRef(showOnFocus);\n useEffect(() => {\n const switchedOn = showOnFocus && !showOnFocusRef.current;\n showOnFocusRef.current = showOnFocus;\n if (switchedOn && triggerRef.current?.matches(':focus-within')) {\n handleFocus();\n }\n });\n\n const [wasSuppressed, setWasSuppressed] = useState(suppressed);\n if (suppressed !== wasSuppressed) {\n setWasSuppressed(suppressed);\n if (suppressed) {\n setIsVisible(false);\n }\n }\n\n useEffect(() => {\n if (suppressed) {\n cancelPendingShow();\n }\n }, [suppressed, cancelPendingShow]);\n\n const [, forceUpdate] = useState({});\n\n const hideWithTrigger = useCallback(() => {\n cancelPendingShow();\n setIsVisible(false);\n }, [cancelPendingShow]);\n\n useFollowTrigger(isVisible, triggerRef, () => forceUpdate({}), hideWithTrigger);\n\n useEffect(() => {\n // Only a VISIBLE tooltip needs to track resize; keeping global listeners per mounted\n // instance made every event fan out across every tooltip on the page. Scrolling is\n // followed by useFollowTrigger.\n if (!isVisible) {\n return () => {\n cancelPendingShow();\n };\n }\n const handleUpdate = () => {\n forceUpdate({});\n };\n\n window.addEventListener('resize', handleUpdate);\n\n return () => {\n cancelPendingShow();\n window.removeEventListener('resize', handleUpdate);\n };\n }, [isVisible, cancelPendingShow]);\n\n // The first render that mounts the tooltip has no measured width yet, so the clamp below\n // cannot run on it. One extra pass once it is in the DOM gives the clamp its measurement\n // — before the opacity transition finishes, so nothing is seen sliding into place.\n useEffect(() => {\n if (isVisible) {\n forceUpdate({});\n }\n }, [isVisible]);\n\n const getTooltipStyles = (): React.CSSProperties => {\n if (!triggerRef.current) {\n return { display: 'none' };\n }\n\n const rect = triggerRef.current.getBoundingClientRect();\n\n const baseStyles: React.CSSProperties = {\n position: 'fixed',\n display: 'flex',\n width: 'max-content',\n maxWidth: typeof maxWidth === 'number' ? `${maxWidth}px` : maxWidth,\n minWidth: '32px',\n minHeight: '32px',\n padding: '8px 12px',\n alignItems: 'center',\n gap: '8px',\n borderRadius: '12px',\n backgroundColor: 'var(--malachite-tooltip-background, rgb(59, 59, 59))',\n color: 'var(--malachite-tooltip-foreground, rgb(255, 255, 255))',\n boxShadow: 'var(--malachite-tooltip-shadow, 0px 0px 10px 0px rgba(0, 0, 0, 0.20))',\n fontFamily: TOOLTIP_FONT_FAMILY,\n fontSize: '14px',\n lineHeight: '1.4',\n whiteSpace: 'normal',\n textAlign: 'left',\n pointerEvents: 'none',\n opacity: isVisible ? 1 : 0,\n visibility: isVisible ? 'visible' : 'hidden',\n transition:\n 'opacity 150ms ease-in-out, transform 150ms ease-in-out, visibility 150ms ease-in-out',\n };\n\n // A trigger near the viewport edge would otherwise centre a wide tooltip half off\n // screen, where the panel or the window crops it. Clamping the CENTRE keeps the\n // `translateX(-50%)` placement honest: the box stays put, it just stops short.\n const measured = tooltipRef.current?.getBoundingClientRect();\n const width = measured?.width ?? 0;\n const height = measured?.height ?? 0;\n\n const centeredLeft = (): number => {\n const desired = rect.left + rect.width / 2;\n\n if (width === 0) {\n return desired;\n }\n\n const half = width / 2;\n const min = VIEWPORT_MARGIN + half;\n const max = window.innerWidth - VIEWPORT_MARGIN - half;\n\n // A tooltip wider than the viewport has no in-bounds centre; leave it centred\n // rather than pinning it to a nonsensical one.\n return min > max ? desired : Math.min(Math.max(desired, min), max);\n };\n\n // At the viewport's top or bottom edge the tooltip would land where the window or an\n // embedding iframe crops it, so it flips to the side that has room.\n const fitsAbove = rect.top - 8 - height >= VIEWPORT_MARGIN;\n const fitsBelow = rect.bottom + 8 + height <= window.innerHeight - VIEWPORT_MARGIN;\n const side =\n placement === 'top' && !fitsAbove && fitsBelow\n ? 'bottom'\n : placement === 'bottom' && !fitsBelow && fitsAbove\n ? 'top'\n : placement;\n\n switch (side) {\n case 'top':\n return {\n ...baseStyles,\n top: rect.top - 8,\n left: centeredLeft(),\n transform: `translate(-50%, -100%) ${isVisible ? 'scale(1)' : 'scale(0.95)'}`,\n };\n case 'bottom':\n return {\n ...baseStyles,\n top: rect.bottom + 8,\n left: centeredLeft(),\n transform: `translateX(-50%) ${isVisible ? 'scale(1)' : 'scale(0.95)'}`,\n };\n case 'left':\n return {\n ...baseStyles,\n top: rect.top + rect.height / 2,\n left: rect.left - 8,\n transform: `translate(-100%, -50%) ${isVisible ? 'scale(1)' : 'scale(0.95)'}`,\n };\n case 'right':\n return {\n ...baseStyles,\n top: rect.top + rect.height / 2,\n left: rect.right + 8,\n transform: `translateY(-50%) ${isVisible ? 'scale(1)' : 'scale(0.95)'}`,\n };\n default:\n return {\n ...baseStyles,\n top: rect.top - 8,\n left: centeredLeft(),\n transform: `translate(-50%, -100%) ${isVisible ? 'scale(1)' : 'scale(0.95)'}`,\n };\n }\n };\n\n // Only reference the tooltip id once the portal can exist — a dangling\n // aria-describedby (text set, never shown) confuses assistive tech.\n const describedBy = hasText && isMounted && describesTrigger ? tooltipId : undefined;\n useInsertionEffect(() => {\n if (hasText && isMounted) {\n ensureOverlayStyles();\n }\n }, [hasText, isMounted]);\n const renderedChildren = focusableTrigger ? (\n children\n ) : wrapChildren || !React.isValidElement(children) ? (\n <span aria-describedby={describedBy} style={fill ? FILL_STYLE : undefined}>\n {children}\n </span>\n ) : (\n React.cloneElement(children as React.ReactElement, {\n 'aria-describedby':\n [(children as React.ReactElement).props['aria-describedby'], describedBy]\n .filter(Boolean)\n .join(' ') || undefined,\n })\n );\n\n const Trigger = inline ? 'span' : triggerAs;\n const isTabStop = focusableTrigger && hasText && !suppressed && showOnFocus;\n\n // Create the tooltip content without its own shadow root\n return (\n <>\n <Trigger\n ref={triggerRef}\n className={`relative ${inline ? 'inline-flex max-w-full align-middle' : 'flex'} items-center${isTabStop ? ` ${FOCUS_RING}` : ''}`}\n style={triggerStyle}\n tabIndex={isTabStop ? 0 : undefined}\n aria-describedby={focusableTrigger ? describedBy : undefined}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onFocus={handleFocus}\n onBlur={handleBlur}\n >\n {renderedChildren}\n </Trigger>\n\n {hasText &&\n isMounted &&\n createPortal(\n <div\n ref={tooltipRef}\n id={tooltipId}\n role=\"tooltip\"\n // Nothing references it, and the sentence is already on screen and\n // described: left in the tree it is a second copy to read past.\n aria-hidden={describesTrigger ? undefined : true}\n {...overlayIdentity('tooltip')}\n style={getTooltipStyles()}\n >\n {/* min-w-0 + overflow-wrap let long values wrap within maxWidth. */}\n <span\n style={{\n minWidth: 0,\n overflowWrap: 'anywhere',\n }}\n >\n {typeof text === 'string' ? withBreakOpportunities(text) : text}\n </span>\n </div>,\n document.body,\n )}\n </>\n );\n};\n\nexport default Tooltip;\n"],"names":["WRAP_AFTER","withBreakOpportunities","value","chunk","i","jsxs","React","SHRINKABLE_STYLE","FILL_STYLE","VIEWPORT_MARGIN","TOOLTIP_FONT_FAMILY","Tooltip","text","children","delay","wrapChildren","triggerAs","inline","placement","isShrinkable","maxWidth","fill","shouldShow","suppressed","describesTrigger","showOnFocus","focusableTrigger","triggerStyle","isVisible","setIsVisible","useState","hasShown","setHasShown","isMounted","timeoutRef","useRef","showFrameRef","cancelPendingShow","useCallback","scheduleVisible","tooltipRef","triggerRef","useTopLayer","tooltipId","useId","hasText","handleMouseEnter","e","handleMouseLeave","handleFocus","handleBlur","showOnFocusRef","useEffect","switchedOn","_a","wasSuppressed","setWasSuppressed","forceUpdate","hideWithTrigger","useFollowTrigger","handleUpdate","getTooltipStyles","rect","baseStyles","measured","width","height","centeredLeft","desired","half","min","max","fitsAbove","fitsBelow","describedBy","useInsertionEffect","ensureOverlayStyles","renderedChildren","jsx","Trigger","isTabStop","Fragment","FOCUS_RING","createPortal","overlayIdentity"],"mappings":";;;;;;;AAUA,MAAMA,KAAa,WAAA,yBAAA,GACbC,KAAyB,CAACC,MAC5BA,EAAM,MAAMF,EAAU,EAAE,IAAI,CAACG,GAAOC,MAChC,gBAAAC,EAACC,EAAM,UAAN,EACI,UAAA;AAAA,EAAAH;AAAA,oBACA,OAAA,CAAA,CAAI;AAAA,EAAA,GAFYC,CAGrB,CACH,GA4BCG,KAAwC;AAAA,EAC1C,UAAU;AAAA,EACV,UAAU;AACd,GAEMC,IAAkC;AAAA,EACpC,MAAM;AAAA,EACN,UAAU;AACd,GAGMC,IAAkB,GAIlBC,KAAsB,iDAEtBC,KAAkC,CAAC;AAAA,EACrC,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,cAAAC,IAAe;AAAA,EACf,WAAAC,IAAY;AAAA,EACZ,QAAAC,I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AA,MAEJ,SAAS;AAAA,IAAA;AAAA,EACb,GACR;AAER;"}
@@ -10,7 +10,7 @@ const m = {
10
10
  }, b = ({
11
11
  text: r,
12
12
  children: l,
13
- delay: i = 0.5,
13
+ delay: i = 0.2,
14
14
  placement: s = "top",
15
15
  className: n = "",
16
16
  triggerAs: a,
@@ -1 +1 @@
1
- {"version":3,"file":"TruncatedTooltip.js","sources":["../../src/components/TruncatedTooltip.tsx"],"sourcesContent":["import React, { useCallback, useRef } from 'react';\nimport Tooltip from './Tooltip';\n\nexport interface TruncatedTooltipProps {\n text: React.ReactNode | string;\n children: React.ReactNode;\n delay?: number;\n placement?: 'top' | 'bottom' | 'left' | 'right';\n className?: string;\n /** `span` where the tooltip sits inside inline content. Defaults to `div`. */\n triggerAs?: 'div' | 'span';\n /** False when `text` repeats the children, which are already in the DOM in full. */\n describesTrigger?: boolean;\n /** Keeps the tooltip shut, e.g. while the control it sits in has its own popup open. */\n suppressed?: boolean;\n}\n\n// Inline: in a menu portaled outside the shadow root, utility classes would not apply.\nconst TRUNCATE_STYLE: React.CSSProperties = {\n display: 'block',\n width: '100%',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n};\n\n/**\n * TruncatedTooltip renders its children in a single-line truncating container\n * (overflow:hidden + text-overflow:ellipsis + white-space:nowrap) and surfaces\n * the malachite Tooltip only when the content is actually being cut off.\n *\n * Truncation is checked at interaction time (Tooltip's `shouldShow`), not at\n * mount: a mount-time measurement forces a synchronous layout per instance,\n * and in large tables those reads interleave with other components' DOM writes\n * — hundreds of full layout passes per mounted batch (the Safari row-mount\n * stalls of ENG-1168). The ellipsis itself is pure CSS and needs no JS.\n */\nconst TruncatedTooltip: React.FC<TruncatedTooltipProps> = ({\n text,\n children,\n delay = 0.5,\n placement = 'top',\n className = '',\n triggerAs,\n describesTrigger,\n suppressed,\n}) => {\n const containerRef = useRef<HTMLSpanElement | null>(null);\n\n // One layout read, on the user's hover/focus — never on the mount path.\n const isTruncated = useCallback(() => {\n const el = containerRef.current;\n return !!el && el.scrollWidth > el.clientWidth;\n }, []);\n\n return (\n <Tooltip\n text={text}\n delay={delay}\n placement={placement}\n wrapChildren={false}\n isShrinkable\n shouldShow={isTruncated}\n triggerAs={triggerAs}\n describesTrigger={describesTrigger}\n suppressed={suppressed}\n >\n <span ref={containerRef} className={className || undefined} style={TRUNCATE_STYLE}>\n {children}\n </span>\n </Tooltip>\n );\n};\n\nexport default TruncatedTooltip;\n"],"names":["TRUNCATE_STYLE","TruncatedTooltip","text","children","delay","placement","className","triggerAs","describesTrigger","suppressed","containerRef","useRef","isTruncated","useCallback","el","jsx","Tooltip"],"mappings":";;;AAkBA,MAAMA,IAAsC;AAAA,EACxC,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,cAAc;AAClB,GAaMC,IAAoD,CAAC;AAAA,EACvD,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,WAAAC,IAAY;AAAA,EACZ,WAAAC,IAAY;AAAA,EACZ,WAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAAC;AACJ,MAAM;AACF,QAAMC,IAAeC,EAA+B,IAAI,GAGlDC,IAAcC,EAAY,MAAM;AAClC,UAAMC,IAAKJ,EAAa;AACxB,WAAO,CAAC,CAACI,KAAMA,EAAG,cAAcA,EAAG;AAAA,EACvC,GAAG,CAAA,CAAE;AAEL,SACI,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,MAAAd;AAAA,MACA,OAAAE;AAAA,MACA,WAAAC;AAAA,MACA,cAAc;AAAA,MACd,cAAY;AAAA,MACZ,YAAYO;AAAA,MACZ,WAAAL;AAAA,MACA,kBAAAC;AAAA,MACA,YAAAC;AAAA,MAEA,UAAA,gBAAAM,EAAC,UAAK,KAAKL,GAAc,WAAWJ,KAAa,QAAW,OAAON,GAC9D,UAAAG,EAAA,CACL;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
1
+ {"version":3,"file":"TruncatedTooltip.js","sources":["../../src/components/TruncatedTooltip.tsx"],"sourcesContent":["import React, { useCallback, useRef } from 'react';\nimport Tooltip from './Tooltip';\n\nexport interface TruncatedTooltipProps {\n text: React.ReactNode | string;\n children: React.ReactNode;\n delay?: number;\n placement?: 'top' | 'bottom' | 'left' | 'right';\n className?: string;\n /** `span` where the tooltip sits inside inline content. Defaults to `div`. */\n triggerAs?: 'div' | 'span';\n /** False when `text` repeats the children, which are already in the DOM in full. */\n describesTrigger?: boolean;\n /** Keeps the tooltip shut, e.g. while the control it sits in has its own popup open. */\n suppressed?: boolean;\n}\n\n// Inline: in a menu portaled outside the shadow root, utility classes would not apply.\nconst TRUNCATE_STYLE: React.CSSProperties = {\n display: 'block',\n width: '100%',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n};\n\n/**\n * TruncatedTooltip renders its children in a single-line truncating container\n * (overflow:hidden + text-overflow:ellipsis + white-space:nowrap) and surfaces\n * the malachite Tooltip only when the content is actually being cut off.\n *\n * Truncation is checked at interaction time (Tooltip's `shouldShow`), not at\n * mount: a mount-time measurement forces a synchronous layout per instance,\n * and in large tables those reads interleave with other components' DOM writes\n * — hundreds of full layout passes per mounted batch (the Safari row-mount\n * stalls of ENG-1168). The ellipsis itself is pure CSS and needs no JS.\n */\nconst TruncatedTooltip: React.FC<TruncatedTooltipProps> = ({\n text,\n children,\n delay = 0.2,\n placement = 'top',\n className = '',\n triggerAs,\n describesTrigger,\n suppressed,\n}) => {\n const containerRef = useRef<HTMLSpanElement | null>(null);\n\n // One layout read, on the user's hover/focus — never on the mount path.\n const isTruncated = useCallback(() => {\n const el = containerRef.current;\n return !!el && el.scrollWidth > el.clientWidth;\n }, []);\n\n return (\n <Tooltip\n text={text}\n delay={delay}\n placement={placement}\n wrapChildren={false}\n isShrinkable\n shouldShow={isTruncated}\n triggerAs={triggerAs}\n describesTrigger={describesTrigger}\n suppressed={suppressed}\n >\n <span ref={containerRef} className={className || undefined} style={TRUNCATE_STYLE}>\n {children}\n </span>\n </Tooltip>\n );\n};\n\nexport default TruncatedTooltip;\n"],"names":["TRUNCATE_STYLE","TruncatedTooltip","text","children","delay","placement","className","triggerAs","describesTrigger","suppressed","containerRef","useRef","isTruncated","useCallback","el","jsx","Tooltip"],"mappings":";;;AAkBA,MAAMA,IAAsC;AAAA,EACxC,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,cAAc;AAClB,GAaMC,IAAoD,CAAC;AAAA,EACvD,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,WAAAC,IAAY;AAAA,EACZ,WAAAC,IAAY;AAAA,EACZ,WAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAAC;AACJ,MAAM;AACF,QAAMC,IAAeC,EAA+B,IAAI,GAGlDC,IAAcC,EAAY,MAAM;AAClC,UAAMC,IAAKJ,EAAa;AACxB,WAAO,CAAC,CAACI,KAAMA,EAAG,cAAcA,EAAG;AAAA,EACvC,GAAG,CAAA,CAAE;AAEL,SACI,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,MAAAd;AAAA,MACA,OAAAE;AAAA,MACA,WAAAC;AAAA,MACA,cAAc;AAAA,MACd,cAAY;AAAA,MACZ,YAAYO;AAAA,MACZ,WAAAL;AAAA,MACA,kBAAAC;AAAA,MACA,YAAAC;AAAA,MAEA,UAAA,gBAAAM,EAAC,UAAK,KAAKL,GAAc,WAAWJ,KAAa,QAAW,OAAON,GAC9D,UAAAG,EAAA,CACL;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
@@ -1,59 +1,171 @@
1
- import { jsxs as t, Fragment as f, jsx as e } from "react/jsx-runtime";
2
- import { useState as s } from "react";
3
- import { Modal as g } from "./Modal.js";
4
- import { FOCUS_RING as b, FOCUS_RING_INSET as p } from "./focusRing.js";
5
- const C = ({ src: l, alt: o, title: i, onError: a }) => {
6
- const [d, r] = s(!1), [c, m] = s(!1), n = () => r(!1), u = () => {
7
- m(!0), r(!0);
1
+ import { jsxs as b, Fragment as w, jsx as r } from "react/jsx-runtime";
2
+ import { useRef as s, useState as h, useEffect as x } from "react";
3
+ import { createPortal as k } from "react-dom";
4
+ import N from "./CustomIcons/DismissIcon.js";
5
+ import { Modal as C } from "./Modal.js";
6
+ import { pushEscapeLayer as z } from "./escapeLayers.js";
7
+ import { FOCUS_RING as y, FOCUS_RING_INSET as R } from "./focusRing.js";
8
+ import { useSidePanelOverlay as E } from "./sidePanelOverlay.js";
9
+ const S = 230, v = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, p = (e, a, o) => {
10
+ e && typeof e.animate == "function" && !v() && e.animate(a, { fill: "both", ...o });
11
+ }, j = ({ src: e, alt: a, label: o, onClose: c }) => {
12
+ const t = s(null), n = s(null), l = s(null), u = s(!1), d = s(c);
13
+ x(() => {
14
+ d.current = c;
15
+ });
16
+ const m = () => {
17
+ u.current || (u.current = !0, p(t.current, [{ opacity: 1 }, { opacity: 0 }], {
18
+ duration: 200,
19
+ delay: 20,
20
+ easing: "ease-in"
21
+ }), p(
22
+ n.current,
23
+ [
24
+ { opacity: 1, transform: "none" },
25
+ { opacity: 0, transform: "translateY(4px) scale(0.97)" }
26
+ ],
27
+ { duration: 180, easing: "cubic-bezier(0.4, 0, 1, 1)" }
28
+ ), setTimeout(() => d.current(), v() ? 0 : S));
8
29
  };
9
- return /* @__PURE__ */ t(f, { children: [
10
- /* @__PURE__ */ e(
30
+ return x(() => {
31
+ var i;
32
+ return p(t.current, [{ opacity: 0 }, { opacity: 1 }], {
33
+ duration: 220,
34
+ easing: "ease-out"
35
+ }), p(
36
+ n.current,
37
+ [
38
+ { opacity: 0, transform: "translateY(6px) scale(0.97)" },
39
+ { opacity: 1, transform: "none" }
40
+ ],
41
+ { duration: 280, delay: 40, easing: "cubic-bezier(0.2, 0.8, 0.2, 1)" }
42
+ ), (i = l.current) == null || i.focus({ preventScroll: !0 }), z(() => {
43
+ var f;
44
+ return (f = l.current) == null ? void 0 : f.click();
45
+ });
46
+ }, []), /* @__PURE__ */ b(
47
+ "div",
48
+ {
49
+ role: "dialog",
50
+ "aria-modal": "true",
51
+ "aria-label": o,
52
+ className: "pointer-events-auto absolute inset-0",
53
+ children: [
54
+ /* @__PURE__ */ r(
55
+ "div",
56
+ {
57
+ ref: t,
58
+ "aria-hidden": "true",
59
+ onClick: m,
60
+ className: "absolute inset-0 cursor-zoom-out rounded-[16px]",
61
+ style: {
62
+ background: "color-mix(in srgb, var(--malachite-card-background, rgb(255, 255, 255)) 8%, transparent)",
63
+ backdropFilter: "blur(5px)",
64
+ WebkitBackdropFilter: "blur(5px)"
65
+ }
66
+ }
67
+ ),
68
+ /* @__PURE__ */ r("div", { className: "pointer-events-none absolute inset-[20px] flex items-center justify-center", children: /* @__PURE__ */ b(
69
+ "div",
70
+ {
71
+ ref: n,
72
+ className: "pointer-events-auto relative flex max-h-full max-w-full",
73
+ children: [
74
+ /* @__PURE__ */ r(
75
+ "img",
76
+ {
77
+ src: e,
78
+ alt: a,
79
+ className: "block max-h-full max-w-full rounded-[16px] object-contain [box-shadow:var(--malachite-shadow-lg)]"
80
+ }
81
+ ),
82
+ /* @__PURE__ */ r(
83
+ "button",
84
+ {
85
+ ref: l,
86
+ type: "button",
87
+ "aria-label": "Close enlarged image",
88
+ title: "Close",
89
+ onClick: m,
90
+ className: `absolute top-[8px] right-[8px] flex h-[30px] w-[30px] cursor-pointer items-center justify-center rounded-[12px] border border-solid border-[var(--malachite-card-border)] bg-[var(--malachite-card-background)] p-0 text-[var(--malachite-text-primary)] ${y}`,
91
+ children: /* @__PURE__ */ r(N, { size: 10 })
92
+ }
93
+ )
94
+ ]
95
+ }
96
+ ) })
97
+ ]
98
+ }
99
+ );
100
+ }, U = ({ src: e, alt: a, title: o, onError: c }) => {
101
+ const t = E(), n = s(null), [l, u] = h(!1), [d, m] = h(!1), i = () => u(!1), f = () => {
102
+ m(!0), u(!0);
103
+ };
104
+ return /* @__PURE__ */ b(w, { children: [
105
+ /* @__PURE__ */ r(
11
106
  "button",
12
107
  {
108
+ ref: n,
13
109
  type: "button",
14
- "aria-label": `Enlarge image: ${o}`,
15
- onClick: u,
16
- className: `block max-h-[240px] w-fit max-w-full cursor-zoom-in overflow-hidden rounded-lg border border-solid border-[var(--malachite-card-border)] bg-transparent p-0 ${b}`,
17
- children: /* @__PURE__ */ e(
110
+ "aria-label": `Enlarge image: ${a}`,
111
+ onClick: f,
112
+ className: `block max-h-[240px] w-fit max-w-full cursor-zoom-in overflow-hidden rounded-lg border border-solid border-[var(--malachite-card-border)] bg-transparent p-0 ${y}`,
113
+ children: /* @__PURE__ */ r(
18
114
  "img",
19
115
  {
20
- src: l,
21
- alt: o,
116
+ src: e,
117
+ alt: a,
22
118
  loading: "lazy",
23
119
  decoding: "async",
24
- onError: a ? () => a() : void 0,
120
+ onError: c ? () => c() : void 0,
25
121
  className: "block h-auto w-full"
26
122
  },
27
- l
123
+ e
28
124
  )
29
125
  }
30
126
  ),
31
- c && /* @__PURE__ */ e(
32
- g,
127
+ t !== null && l && k(
128
+ /* @__PURE__ */ r(
129
+ j,
130
+ {
131
+ src: e,
132
+ alt: a,
133
+ label: o || a,
134
+ onClose: () => {
135
+ var g;
136
+ i(), (g = n.current) == null || g.focus({ preventScroll: !0 });
137
+ }
138
+ },
139
+ e
140
+ ),
141
+ t
142
+ ),
143
+ t === null && d && /* @__PURE__ */ r(
144
+ C,
33
145
  {
34
- open: d,
35
- onClose: n,
36
- title: i || o,
146
+ open: l,
147
+ onClose: i,
148
+ title: o || a,
37
149
  size: "fullscreen",
38
150
  surface: "none",
39
- children: /* @__PURE__ */ t("div", { className: "relative flex h-full w-full items-center justify-center", children: [
40
- /* @__PURE__ */ e(
151
+ children: /* @__PURE__ */ b("div", { className: "relative flex h-full w-full items-center justify-center", children: [
152
+ /* @__PURE__ */ r(
41
153
  "button",
42
154
  {
43
155
  type: "button",
44
156
  "aria-label": "Close enlarged image",
45
- onClick: n,
46
- className: `absolute inset-0 z-10 cursor-zoom-out border-0 bg-transparent p-0 ${p}`
157
+ onClick: i,
158
+ className: `absolute inset-0 z-10 cursor-zoom-out border-0 bg-transparent p-0 ${R}`
47
159
  }
48
160
  ),
49
- /* @__PURE__ */ e(
161
+ /* @__PURE__ */ r(
50
162
  "img",
51
163
  {
52
- src: l,
53
- alt: o,
164
+ src: e,
165
+ alt: a,
54
166
  className: "max-h-full max-w-full rounded-lg object-contain"
55
167
  },
56
- l
168
+ e
57
169
  )
58
170
  ] })
59
171
  }
@@ -61,7 +173,7 @@ const C = ({ src: l, alt: o, title: i, onError: a }) => {
61
173
  ] });
62
174
  };
63
175
  export {
64
- C as ZoomableImage,
65
- C as default
176
+ U as ZoomableImage,
177
+ U as default
66
178
  };
67
179
  //# sourceMappingURL=ZoomableImage.js.map