@stackone/malachite 2.106.0 → 2.107.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/COMPONENTS.md CHANGED
@@ -29,7 +29,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
29
29
  - **`ActionBar`** — A row of actions that collapses into a single `ActionMenu` once its container drops below `collapseBelow`. Measures the nearest genuinely-wider ancestor rather than itself, since the row shrinks to its own content. `dividerBefore` renders a vertical rule in the row and a divider in the collapsed menu, so both forms group the actions the same way. _Key props:_ `buttons` (`label`, `onClick`, `icon`, `variant`, `size`, `radius`, `tooltip`, `disabled`, `dividerBefore`), `collapseBelow`, `menuLabel`, `className`.
30
30
  - **`Popover`** — An anchored, non-modal panel for arbitrary content — a workspace switcher, an org flyout. The panel renders in its own shadow root, so malachite components inside it are styled, and joins the top layer like the other overlays. It prefers its `placement` and flips to the opposite side when there is no room, clamping along the other axis. Click-opened panels take focus and hand it back to the trigger on close; `openOn="hover"` also opens on focus and stays open while the pointer or focus is in the panel. A nested Popover counts as inside its parent for outside-press and hover dismissal, and Escape closes the topmost only. A click panel also closes when focus moves somewhere outside it and its trigger, and on close it hands focus back to the trigger only if focus would otherwise fall to the page. _Key props:_ `trigger`, `children`, `open`, `defaultOpen`, `onOpenChange`, `placement` (`bottom-start` | `bottom-end` | `top-start` | `top-end` | `top-center` | `right-start` | `right-end` | `left-start`), `openOn` (`click` | `hover`), `width` (`content` | `trigger`), `padding` (`none` | `small` | `medium`), `anchorRef` (position against another element, e.g. the section a trigger row sits in), `offset` (`small` 8px | `medium` 12px | `large` 14px), `elevation` (`default` | `raised`), `initialFocus` (a ref, or a function read when the panel is shown, for what takes focus in place of the first focusable; it is read again as the panel's content changes, so focus follows content that mounts late or a focused element that is removed, but never leaves an element the user moved to; `initialFocusRef` is its deprecated form, read on open only), `openOnArrowKey` (a click panel also opens, focus inside, on the arrow key its placement points at — ArrowDown for a `bottom-*` placement; a text field trigger keeps its arrow keys), `role` (`dialog` | `menu` | `listbox`; `menu` brings no roving focus of its own), `aria-label` or `aria-labelledby` (one is required), `className`. The panel is capped to the viewport width, and only overlays opened from inside it (menus, dropdowns, modals) count as inside for outside-press dismissal. A side placement stays level with its anchor and scrolls within the room below, sliding up only when under 160px is left. Parts for the panel body: `Popover.Header` (`title`, `action`, `divider` — `false` drops the rule and sits it 4px over the list, as its label), `Popover.Action` (`icon`, `aria-label`, `onClick`, `href` (a link that opens in a new tab on Cmd/Ctrl-click or a middle click; a plain click runs `onClick` when one is given), `disabled`, `tooltip`), `Popover.List` (a scrolling list; `scrollToSelected` scrolls the list, never the page, to its selected row, one marked `aria-current`, `aria-selected` or a checked radio, each time the popover is shown, once that row mounts), `Popover.Section` (a bordered section), `Popover.Empty` (an empty-state line), `Popover.Search` (pads a `Search` above the list without a second rule), `Popover.Note` (a footnote section in small secondary text) and `Popover.Status` (`message`, `tone` (`default` | `error`), `action` (`label`, `onClick`, `pending`), `focusable`): one `status` live region for the panel's life, announcing each message it is given and staying mounted, visually hidden, while there is none, so clear `message` rather than unmounting it. Errors announce through the same region. `focusable` with a ref makes it an `initialFocus` target; resolve to it only while it has a message, since an empty one is invisible. Reach for `Status` when the message changes while the panel is open or carries an action (loading, failed, sign-in needed), and `Empty` for a static line in a list that simply has nothing in it.
31
31
  - **`Modal`** — Centred dialog over a scrim, with header slots (icon/title/subtitle/extra), a scrolling body and a pinned footer. Locks background scroll and dismisses on ESC, the close button, or a scrim click unless `closeOnOverlayClick` is off; `busy` suppresses the two pointer routes while a request is in flight and sets `aria-busy`, so a stray click cannot tear the dialog down mid-write — but never ESC, which is the only guaranteed keyboard exit from a focus trap and so always reaches `onClose`. ESC, the Tab focus trap and `aria-modal` all apply to the topmost overlay only, so these may be stacked — a dialog opened from a panel keeps Tab to itself and the panel stops claiming to be modal. The Tab trap follows focus into a malachite popup portaled out of the dialog’s own tree — a `MultiSelect` listbox or a `Popover` opened from the body — and traps Tab within that popup while it holds focus, so Tab walks and wraps that popup’s own stops rather than being yanked back to the dialog’s first control or escaping the dialog altogether. A `Dropdown` list or an `ActionMenu` is dismissed by Tab rather than trapping it: it closes and focus returns to its trigger, so Tab carries on from there. A consumer’s own portaled popup is not known to the trap and Tab will pull focus out of it. Set `role="alertdialog"` for a consequential choice, which asks assistive tech to announce the body and not just the name, and point `aria-describedby` at whichever element carries it. Width comes from the `size` union (`small` 420px | `medium` 612px | `large` 760px | `fullscreen`, which fills the window in both directions) rather than a raw pixel prop. `titleAdornment` sits immediately after the title behind a hairline divider, for naming the thing being acted on — distinct from `headerExtra`, which pins to the far right. `tray` paints a tinted plate around the card and hangs a `caption` beneath it; the plate is the dialog element itself, so that caption stays inside the `aria-modal` subtree rather than being stranded outside it by the visual nesting, and it is added to `aria-describedby` automatically because it says what the dialog is asking. It takes a tone (`neutral` | `warning` | `error` | `success`) rather than a colour, so no consumer can paint it off-palette — and the tone sets the plate and its caption colour together, so the two cannot disagree. The caption is a `{ label?, message }` pair rather than a node, because its row height, type scale and colour belong to the plate. `size` names the card, and the plate’s 4px ring is added on top. Like `SidePanel` it sits in a z-index band from 1000 — one step per stacked overlay, so what paints on top is what holds the keyboard — and stays out of the browser top layer, so a host app’s own dialogs can still cover it. `callouts` stacks full-bleed `Alert` bands at the top of the body, as on `SidePanel`; they ignore `bodyPadding` and lead `aria-describedby`, ahead of the consumer’s own description and the tray caption. For a confirmation use `ConfirmationDialog`, which is a preset over this. _Key props:_ `open`, `onClose`, `title`, `subtitle`, `icon`, `headerExtra`, `titleAdornment`, `tray`, `callouts`, `renderLink`, `headerDivider`, `footer`, `size`, `showCloseButton`, `closeOnOverlayClick`, `bodyPadding`, `bodyHeight` (`auto` | `tall` — 600px, or the viewport less 160px when smaller, for an embedded iframe at `height: 100%`), `busy`, `role` (`dialog` | `alertdialog`), `aria-label`, `aria-labelledby`, `aria-describedby`.
32
- - **`SidePanel`** — Right-hand slide-in overlay panel (drawer) with header slots (back/icon/title/subtitle/extra), scrollable body and optional footer. `subtitlePlacement="below"` stacks the subtitle on its own line under the title row, so neither truncates the other in a narrow panel. `toolbar` pins content between the header and the scrolling body (16px sides, 16px above, 8px below, no divider), such as a Search over the list it filters. Locks background scroll and dismisses on ESC, an overlay click or close. ESC and the Tab focus trap apply to the topmost overlay only, so a `Modal` may be stacked over it. The Tab trap follows focus into a malachite popup portaled out of the panel’s own tree — a `MultiSelect` listbox or a `Popover` opened from the body — and traps Tab within that popup while it holds focus, so Tab walks and wraps that popup’s own stops rather than being yanked back to the panel’s first control or escaping the panel altogether. A `Dropdown` list or an `ActionMenu` is dismissed by Tab rather than trapping it: it closes and focus returns to its trigger, so Tab carries on from there. A consumer’s own portaled popup is not known to the trap and Tab will pull focus out of it. `callouts` stacks full-bleed `Alert` bands at the top of the body, above `children` and unaffected by `bodyPadding` — the same band `ConfirmationDialog` gives its `callout` — and `renderLink` routes their root-relative markdown links through the app’s router. The callouts are announced as the panel’s description, ahead of `description`. `aside` opens a full-height column to the left, as wide again as `maxWidth`, for help that sits beside the content — a setup guide beside a form. The panel’s own header, body and footer keep their width and place, and the aside’s `title` (with an optional `headerExtra`, such as a `Stepper`) and `footer` line up with the panel’s header and footer; `bodyPadding` works as the panel’s does. The aside is never narrower than 360px, so a window too narrow for both columns scrolls the panel sideways. `onSubmit` makes the header, body and footer one `<form>` (`noValidate`, default prevented), so Enter in a field submits through a `type="submit"` footer button, as `FormActions` gives, the way a browser form does: not from a textarea, not mid-composition, and not while that button is disabled. Enter in the `toolbar` never submits, and the submit does not reach a form the panel is rendered inside.
32
+ - **`SidePanel`** — Right-hand slide-in overlay panel (drawer) with header slots (back/icon/title/subtitle/extra), scrollable body and optional footer. `subtitlePlacement="below"` stacks the subtitle on its own line under the title row, so neither truncates the other in a narrow panel. `toolbar` pins content between the header and the scrolling body (16px sides, 16px above, 8px below, no divider), such as a Search over the list it filters. `toolbarPadding="body"` insets it 28px either side instead, level with the body, for a full-width row such as a `KeyValueStrip`. `SidePanel.Tabs`, rendered anywhere in the body, pins its `Tabs` strip under the header and toolbar (arrow keys open the tab they reach), always inset by the panel’s 28px gutter (with `bodyPadding={false}`, pad the panels 28px to line them up), and keeps its panels where it sits, so a child that owns its tabs needs no plumbing; panels mount the first time their tab opens and stay mounted, hidden, until it unmounts, each tab reopens at the scroll position it was left at, and a tabbed body keeps a stable scrollbar gutter so tabs of any length line up. Outside a `SidePanel` it renders as `Tabs`. Locks background scroll and dismisses on ESC, an overlay click or close. ESC and the Tab focus trap apply to the topmost overlay only, so a `Modal` may be stacked over it. The Tab trap follows focus into a malachite popup portaled out of the panel’s own tree — a `MultiSelect` listbox or a `Popover` opened from the body — and traps Tab within that popup while it holds focus, so Tab walks and wraps that popup’s own stops rather than being yanked back to the panel’s first control or escaping the panel altogether. A `Dropdown` list or an `ActionMenu` is dismissed by Tab rather than trapping it: it closes and focus returns to its trigger, so Tab carries on from there. A consumer’s own portaled popup is not known to the trap and Tab will pull focus out of it. `callouts` stacks full-bleed `Alert` bands at the top of the body, above `children` and unaffected by `bodyPadding` — the same band `ConfirmationDialog` gives its `callout` — and `renderLink` routes their root-relative markdown links through the app’s router. The callouts are announced as the panel’s description, ahead of `description`. `aside` opens a full-height column to the left, as wide again as `maxWidth`, for help that sits beside the content — a setup guide beside a form. The panel’s own header, body and footer keep their width and place, and the aside’s `title` (with an optional `headerExtra`, such as a `Stepper`) and `footer` line up with the panel’s header and footer; `bodyPadding` works as the panel’s does. The aside is never narrower than 360px, so a window too narrow for both columns scrolls the panel sideways. `onSubmit` makes the header, body and footer one `<form>` (`noValidate`, default prevented), so Enter in a field submits through a `type="submit"` footer button, as `FormActions` gives, the way a browser form does: not from a textarea, not mid-composition, and not while that button is disabled. Enter in the `toolbar` never submits, and the submit does not reach a form the panel is rendered inside.
33
33
  - **`useHasOpenOverlay`** — Hook reporting whether any modal-type overlay - `SidePanel` or `Modal` - is open anywhere in the app. For host chrome that has to get out of an overlay’s way, a floating support widget being the case it was added for: overlays render through a portal, so a host has no DOM signal of its own to read, and reading the library’s internal markers would couple it to something it does not own. Dropdowns and tooltips are deliberately not counted - they do not trap focus, and chrome does not need to move for them. _Key props:_ No arguments. Returns a boolean.
34
34
  - **`SidePanelNavFooter`** — Keyboard-hint footer for SidePanel: up/down keycaps to step between records, optional left/right keycaps to switch tabs, and an esc-to-close hint, with an optional right-aligned actions slot.
35
35
 
@@ -87,7 +87,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
87
87
  - **`DefinitionRow`** — Row showing an icon, label, optional tag and description — for definition/detail lists. _Key props:_ `icon`, `label`, `tag`, `description`.
88
88
  - **`PreviewTree`** — Nested, indented tree for previewing hierarchical structure.
89
89
  - **`PreviewTreeRow`** — A single labelled row within a PreviewTree. _Key props:_ `label`.
90
- - **`Tabs`** — Tabbed navigation switching between content panels. `trailing` puts content on the same row, settled against its end — a count, a scope picker, the state the tabs are showing — inside the rule this component already draws. Without it a consumer had to redraw that rule to carry it past the tabs, and the tab list, which cannot wrap, would not yield any width to what sat beside it. The tabs hold their width and the trailing content gives ground; the `tablist` role stays on the tabs alone, so the extra content is not announced as one. Give an item `content` and each tab gets a `tabpanel` below the strip, wired with `aria-controls` and `aria-labelledby`: a panel mounts the first time its tab opens and then stays mounted, hidden, so a search, a filter or a scroll position survives a round trip and its data is not fetched again. `destroyInactivePanels` unmounts a panel when its tab is left instead. Panels have no overflow of their own, so a sticky toolbar inside one still pins to the page. Leave `content` off every item and the strip is all it renders. _Key props:_ `TabItem[]` (`key`, `label`, `disabled`, `content`), `activeKey`, `onChange`, `trailing`, `destroyInactivePanels`, `className`, `style`.
90
+ - **`Tabs`** — Tabbed navigation switching between content panels. ArrowLeft and ArrowRight on a focused tab move focus to the next enabled tab, wrapping at the ends, and Home and End to the first and last; Enter, Space or a click opens it, or `activation="automatic"` opens the tab an arrow reaches. ArrowUp, ArrowDown and any key with Alt, Ctrl or Cmd held are left to the page. `trailing` puts content on the same row, settled against its end — a count, a scope picker, the state the tabs are showing — inside the rule this component already draws. Without it a consumer had to redraw that rule to carry it past the tabs, and the tab list, which cannot wrap, would not yield any width to what sat beside it. The tabs hold their width and the trailing content gives ground; the `tablist` role stays on the tabs alone, so the extra content is not announced as one. Give an item `content` and each tab gets a `tabpanel` below the strip, wired with `aria-controls` and `aria-labelledby`: a panel mounts the first time its tab opens and then stays mounted, hidden, so a search, a filter or a scroll position survives a round trip and its data is not fetched again. `destroyInactivePanels` unmounts a panel when its tab is left instead. Panels have no overflow of their own, so a sticky toolbar inside one still pins to the page. Leave `content` off every item and the strip is all it renders. _Key props:_ `TabItem[]` (`key`, `label`, `disabled`, `content`), `activeKey`, `onChange`, `trailing`, `destroyInactivePanels`, `activation` (`manual` | `automatic`), `className`, `style`.
91
91
  - **`Breadcrumbs`** — Breadcrumb trail with caret separators, an optional back button (shown only when there is more than one crumb AND the parent — the second-to-last — carries a `url` to target) and a right-aligned `actions` row. A lone crumb marked `isRoot` switches to title mode: plain emphasised text, no trail chrome, but the `actions` row still renders. Renders as a `nav`/`ol` with `aria-current="page"` on the last crumb. Pass `renderLink` to route crumbs through the app's own router instead of a plain `<a>`. Used by `PageLayout`, but standalone too. _Key props:_ `links[]` (`name`, `url`, `isRoot`), `actions[]`, `renderLink`, `className`, `style`.
92
92
  - **`ActionMenu`** — Dropdown menu of actions (kebab/overflow style). The trigger is an icon-only `Button` by default, so `size` draws exactly the square a `Button` of that size draws beside it: `xsmall` is Figma's 20px "Button Element - Square (X-Small)", `small` the 28px rung above it. Both squares are fixed rather than read off the `controlHeights` tokens, so re-theming those does not resize the trigger. A supplied `triggerIcon` is held to the tier's glyph size — 11px at `xsmall`, 16px at `small`. At 20px the `xsmall` trigger meets WCAG 2.5.8 through the *Spacing* exception rather than the 24px minimum, so keep at least 4px between adjacent triggers. `showLabel` draws `label` beside the icon instead of leaving it to the accessible name — for a menu that is the point of its corner rather than an overflow for a row that already says what it acts on — and `variant` puts the trigger on any `Button` variant, so a menu handing work to the assistant can wear the assistant ground rather than the overflow-kebab outline. An item's `icon` leads its label: every caller's names the action itself — copy, open, delete — and an icon that is part of an item's identity belongs where the eye starts rather than right-aligned, where it reads as a status column. The menu is Figma's `Dropdown Component - Options List`: a fixed sized to its widest item between a 180px floor and the 280px Figma draws, by default under the trigger's right edge, 14px below it, flipping above or clamping sideways when the viewport has no room, rounding at the library's 12px and padding wider (8px) than the menu a `Dropdown` opens. Items read in the primary text colour, or the secondary one with `tone="muted"` (e.g. a sidebar's menus); destructive ones in red; `danger: 'hover'` keeps an item in its normal colour and turns it destructive (red text on a light red ground) only on hover or keyboard focus, for an action like signing out. A ceiling rather than a flat width: taken literally it gave a menu of four short verbs 130px of air and made every kebab in an app the same width whatever it held. `minWidth` only raises it above that ceiling, so it is the one way to go past 280px, and a label too long for the box truncates rather than wrapping. _Key props:_ `ActionMenuItem[]`, `size`, `label`, `triggerIcon`, `minWidth`, `showLabel`, `variant`, `tone` (`default` | `muted`), `trigger` (your own control in place of the kebab, cloned with the menu's ref and aria state), `highlightChoices`, `placement` (`bottom-end` default | `bottom-start` | `right-start` | `top-start` | `top-center`), `offset` (`small` 8px | `medium` 12px | `large` 14px; applies to every placement; without it the default `bottom-end` keeps the options menu's 14px and the others use 8px). An item's `tag` (e.g. an "Early access" `Tag`) follows its label in a lazily loaded shadow host of its own, since the menu renders into `document.body`, and joins its accessible name; `current: true` marks the item for the page the user is on (`aria-current="page"` and the selected row paint; a `danger` item keeps its red text). An item with an `href` is a link: Cmd/Ctrl-click or a middle click opens it in a new tab and closes the menu, while a plain click runs `onClick` in its place when one is given (so a router can navigate in-app); Enter and Space both activate it. `target: '_blank'` opens it in a new tab, adds `noopener noreferrer` and tells screen readers it opens a new tab. An item with `checked` is one of a set of choices: a `menuitemradio` with `aria-checked` and a trailing check while true; picking it still runs `onClick` and closes. Give the choices of one set the same `group` and, where they sit next to each other, they share a `role="group"` named by it, so a screen reader can tell where the set ends; choices with the same `group` split by another item form separate groups. `description` adds a quieter second line under the label, announced as the item's description rather than its name. `intent` colours the label and icon: `warning` (amber) for undoing choices already made, `accent` (green) for a way forward; a disabled item drops it, and `danger` or `current` wins over it. `highlightChoices` styles the menu as a picker: the checked choice of each `group` sits on a light green row (a Dropdown selected option's ground) with a green check (a danger, intent, disabled or current choice keeps its own colours), and a text row whose label is a set's `group` name sits a notch smaller, as its heading. An item with `type: 'text'` is context rather than an action (an account's email above its actions): secondary text the arrow keys skip. Opened from the keyboard, focus lands on the first item, or on the checked choice in a menu of choices; Up/Down/Home/End move through enabled items, Tab closes the menu and moves on as usual; Escape or a picked item returns focus to the trigger.
93
93
  - **`NavItem`** — A row in an app's side navigation. Idle rows read secondary and take the list hover; the `active` row wears the accent tint and sets `aria-current="page"` on a link. `collapsed` shrinks it to a 36px icon tile whose label becomes the accessible name and a right-hand tooltip, with any `badge` pinned to the tile's corner. `variant="subitem"` indents a child row behind a dot instead of an icon; `disclosure` makes a group header button with `aria-expanded` and a rotating chevron, and `hasActiveChild` colours its text while a child is current. Renders an `<a>` with `href`, the element passed with `asChild` (a router `Link`), or a `<button>`, and forwards its ref and extra attributes so it can be a `Popover` or `ActionMenu` trigger. `disabled` keeps the row a tab stop with `aria-disabled`, drops its hover and pointer, and ignores clicks, Enter and Space; a `Popover` or `ActionMenu` it triggers stays shut on press, hover, focus and arrow keys, while other keys still reach a passed `onKeyDown` so arrow navigation through a list keeps working; a disabled `href` row renders as a button so it cannot be followed. `disabledReason` explains it in a right-hand tooltip on hover and focus and is the row's accessible description from the first focus. Not with `asChild`, whose child would still navigate. _Key props:_ `label`, `icon`, `active`, `hasActiveChild`, `collapsed`, `variant` (`item` | `subitem`), `danger`, `trailing`, `badge`, `disclosure` (`expanded` | `collapsed`), `tooltip`, `accessibleLabel` (overrides the accessible name; collapsed it defaults to the tooltip text plus `badgeLabel`), `href`, `target`, `rel`, `onClick`, `asChild` + `children`, `className`, `size` (`medium` | `small`, the tighter row for lists inside a popover), `tag` (beside the label, e.g. early access), `badgeLabel` (read in place of the badge and added to the collapsed name), `disabled`, `disabledReason`. A passed `aria-expanded` (e.g. from a `Popover`) wins over `disclosure`, and a button row forwards a passed `aria-current`.
@@ -1,130 +1,139 @@
1
1
  import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
- import { useId as B, useState as W, useRef as v, useEffect as ie } from "react";
3
- import { createPortal as ne } from "react-dom";
4
- import { ShadowRootWrapper as oe } from "../ShadowRootWrapper.js";
5
- import se from "./CalloutStrip.js";
6
- import ce from "./CustomIcons/ArrowLeftIcon.js";
7
- import de from "./CustomIcons/DismissIcon.js";
8
- import N from "./Typography/EllipsisText.js";
9
- import { afterNextPaint as me } from "./afterNextPaint.js";
10
- import { useOverlayBehaviour as pe, OVERLAY_ICON_BUTTON_CLASSES as j } from "./overlayBehaviour.js";
11
- import { OVERLAY_ELEVATED_ATTR as xe, overlayIdentity as H } from "./portalOverlay.js";
12
- const x = 200, fe = "360px", U = ({
2
+ import { useId as F, useState as m, useCallback as ue, useMemo as he, useRef as y, useEffect as be } from "react";
3
+ import { createPortal as ve } from "react-dom";
4
+ import { ShadowRootWrapper as Ne } from "../ShadowRootWrapper.js";
5
+ import ge from "./CalloutStrip.js";
6
+ import we from "./CustomIcons/ArrowLeftIcon.js";
7
+ import ye from "./CustomIcons/DismissIcon.js";
8
+ import Te from "./SidePanelTabs.js";
9
+ import T from "./Typography/EllipsisText.js";
10
+ import { afterNextPaint as Se } from "./afterNextPaint.js";
11
+ import { useOverlayBehaviour as $e, OVERLAY_ICON_BUTTON_CLASSES as G } from "./overlayBehaviour.js";
12
+ import { OVERLAY_ELEVATED_ATTR as Ce, overlayIdentity as K } from "./portalOverlay.js";
13
+ import { SidePanelTabsContext as q } from "./sidePanelTabsContext.js";
14
+ const h = 200, Ie = "360px", J = ({
13
15
  bodyPadding: r,
14
- callouts: a,
16
+ callouts: t,
15
17
  calloutId: i,
16
18
  renderLink: o,
17
- children: m
19
+ stableGutter: b = !1,
20
+ scrollerRef: p,
21
+ children: s
18
22
  }) => {
19
- const c = !!(a != null && a.length);
23
+ const d = !!(t != null && t.length);
20
24
  return /* @__PURE__ */ l(
21
25
  "div",
22
26
  {
23
- className: `min-h-0 flex-1 overflow-y-auto ${r && !c ? "px-[28px]" : ""}`,
27
+ ref: p,
28
+ className: `min-h-0 flex-1 overflow-y-auto ${b ? "[scrollbar-gutter:stable]" : ""} ${r && !d ? "px-[28px]" : ""}`,
24
29
  children: [
25
- a == null ? void 0 : a.map((s, d) => /* @__PURE__ */ e(
26
- se,
30
+ t == null ? void 0 : t.map((x, f) => /* @__PURE__ */ e(
31
+ ge,
27
32
  {
28
- id: i ? `${i}-${d}` : void 0,
29
- type: s.type,
30
- message: s.message,
33
+ id: i ? `${i}-${f}` : void 0,
34
+ type: x.type,
35
+ message: x.message,
31
36
  renderLink: o
32
37
  },
33
- d
38
+ f
34
39
  )),
35
- r ? /* @__PURE__ */ e("div", { className: c ? "p-[28px]" : "py-[28px]", children: m }) : m
40
+ r ? /* @__PURE__ */ e("div", { className: d ? "p-[28px]" : "py-[28px]", children: s }) : s
36
41
  ]
37
42
  }
38
43
  );
39
- }, g = (r) => typeof r == "number" ? `${r}px` : r, ue = (r) => {
44
+ }, S = (r) => typeof r == "number" ? `${r}px` : r, Pe = (r) => {
40
45
  r.key === "Enter" && r.target instanceof HTMLInputElement && r.preventDefault();
41
- }, X = "col-start-2 row-span-3 grid min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-subgrid", he = ({ onSubmit: r, children: a }) => r ? /* @__PURE__ */ e(
46
+ }, Q = "col-start-2 row-span-3 grid min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-subgrid", ke = ({ onSubmit: r, children: t }) => r ? /* @__PURE__ */ e(
42
47
  "form",
43
48
  {
44
49
  noValidate: !0,
45
- className: X,
50
+ className: Q,
46
51
  onSubmit: (i) => {
47
52
  i.preventDefault(), i.stopPropagation(), r(i);
48
53
  },
49
- children: a
54
+ children: t
50
55
  }
51
- ) : /* @__PURE__ */ e("div", { className: X, children: a }), Ce = ({
56
+ ) : /* @__PURE__ */ e("div", { className: Q, children: t }), Ee = ({
52
57
  open: r,
53
- onClose: a,
58
+ onClose: t,
54
59
  title: i,
55
60
  subtitle: o,
56
- subtitlePlacement: m = "inline",
57
- titleExtra: c,
61
+ subtitlePlacement: b = "inline",
62
+ titleExtra: p,
58
63
  description: s,
59
64
  toolbar: d,
60
- headerDivider: Y = !1,
61
- icon: w,
62
- headerExtra: y,
63
- footer: f,
64
- onSubmit: $,
65
- onBack: T,
66
- maxWidth: u = 1080,
67
- "aria-label": F,
68
- "aria-labelledby": I,
69
- bodyPadding: K = !0,
70
- stacking: q = "default",
71
- callouts: h,
72
- renderLink: G,
73
- aside: t,
74
- children: J
65
+ toolbarPadding: x = "default",
66
+ headerDivider: f = !1,
67
+ icon: $,
68
+ headerExtra: C,
69
+ footer: v,
70
+ onSubmit: I,
71
+ onBack: P,
72
+ maxWidth: N = 1080,
73
+ "aria-label": Z,
74
+ "aria-labelledby": k,
75
+ bodyPadding: ee = !0,
76
+ stacking: re = "default",
77
+ callouts: g,
78
+ renderLink: le,
79
+ aside: a,
80
+ children: te
75
81
  }) => {
76
- const S = B(), E = B(), [C, k] = W(!1), [Q, _] = W(!1), p = v(null), n = v(null), P = v(null), {
77
- ref: Z,
78
- isTopmost: ee,
79
- zIndex: re,
80
- elevated: le
81
- } = pe({
82
+ const E = F(), [_, ae] = m(null), [ie, A] = m(0), R = ue(() => (A((c) => c + 1), () => A((c) => c - 1)), []), [L, ne] = m(null), oe = he(
83
+ () => ({ stripSlot: _, scroller: L, registerTabs: R }),
84
+ [_, L, R]
85
+ ), z = F(), [D, M] = m(!1), [se, O] = m(!1), u = y(null), n = y(null), V = y(null), {
86
+ ref: ce,
87
+ isTopmost: de,
88
+ zIndex: me,
89
+ elevated: pe
90
+ } = $e({
82
91
  open: r,
83
- onClose: a,
84
- elevated: q === "above-app-overlays",
85
- hostRef: P
92
+ onClose: t,
93
+ elevated: re === "above-app-overlays",
94
+ hostRef: V
86
95
  });
87
- if (ie(() => (r ? (_(!0), n.current && (clearTimeout(n.current), n.current = null), me(p, () => k(!0))) : (k(!1), n.current = setTimeout(() => {
88
- n.current = null, _(!1);
89
- }, x)), () => {
90
- p.current !== null && (cancelAnimationFrame(p.current), p.current = null), n.current && (clearTimeout(n.current), n.current = null);
91
- }), [r]), !Q)
96
+ if (be(() => (r ? (O(!0), n.current && (clearTimeout(n.current), n.current = null), Se(u, () => M(!0))) : (M(!1), n.current = setTimeout(() => {
97
+ n.current = null, O(!1);
98
+ }, h)), () => {
99
+ u.current !== null && (cancelAnimationFrame(u.current), u.current = null), n.current && (clearTimeout(n.current), n.current = null);
100
+ }), [r]), !se)
92
101
  return null;
93
- const A = h == null ? void 0 : h.filter((V) => V.message.trim()), b = `calc(${g(u)} - 2px)`, R = Y ? "border-0 border-b border-solid border-[var(--malachite-card-border)]" : "", ae = t ? /* @__PURE__ */ l(
102
+ const B = g == null ? void 0 : g.filter((c) => c.message.trim()), w = `calc(${S(N)} - 2px)`, W = f ? "border-0 border-b border-solid border-[var(--malachite-card-border)]" : "", xe = a ? /* @__PURE__ */ l(
94
103
  "aside",
95
104
  {
96
- "aria-label": t.title,
105
+ "aria-label": a.title,
97
106
  className: "col-start-1 row-span-3 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)]",
98
107
  children: [
99
108
  /* @__PURE__ */ l(
100
109
  "div",
101
110
  {
102
- className: `flex min-w-0 items-center gap-[8px] px-[20px] py-[18px] ${R}`,
111
+ className: `flex min-w-0 items-center gap-[8px] px-[20px] py-[18px] ${W}`,
103
112
  children: [
104
113
  /* @__PURE__ */ e("span", { className: "flex min-w-0 shrink-0", children: /* @__PURE__ */ e(
105
- N,
114
+ T,
106
115
  {
107
- tooltip: t.title,
116
+ tooltip: a.title,
108
117
  tooltipWhenTruncated: !0,
109
118
  tooltipPlacement: "bottom",
110
119
  className: "min-w-0 text-[length:var(--malachite-font-size-15,15px)] font-semibold",
111
- children: t.title
120
+ children: a.title
112
121
  }
113
122
  ) }),
114
- t.headerExtra ? /* @__PURE__ */ e("span", { className: "ml-auto flex shrink-0 items-center", children: t.headerExtra }) : null
123
+ a.headerExtra ? /* @__PURE__ */ e("span", { className: "ml-auto flex shrink-0 items-center", children: a.headerExtra }) : null
115
124
  ]
116
125
  }
117
126
  ),
118
- /* @__PURE__ */ e("div", { className: `flex min-h-0 flex-col ${t.footer ? "" : "row-span-2"}`, children: /* @__PURE__ */ e(U, { bodyPadding: t.bodyPadding ?? !0, children: t.children }) }),
119
- t.footer ? /* @__PURE__ */ e("div", { className: "border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]", children: t.footer }) : null
127
+ /* @__PURE__ */ e("div", { className: `flex min-h-0 flex-col ${a.footer ? "" : "row-span-2"}`, children: /* @__PURE__ */ e(J, { bodyPadding: a.bodyPadding ?? !0, children: a.children }) }),
128
+ a.footer ? /* @__PURE__ */ e("div", { className: "border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]", children: a.footer }) : null
120
129
  ]
121
130
  }
122
- ) : null, L = m === "below" && !!o, z = /* @__PURE__ */ e(
131
+ ) : null, j = b === "below" && !!o, H = /* @__PURE__ */ e(
123
132
  "span",
124
133
  {
125
- className: L ? "flex min-w-0 shrink" : "flex min-w-0 max-w-full shrink-0",
134
+ className: j ? "flex min-w-0 shrink" : "flex min-w-0 max-w-full shrink-0",
126
135
  children: /* @__PURE__ */ e(
127
- N,
136
+ T,
128
137
  {
129
138
  tooltip: i,
130
139
  tooltipWhenTruncated: !0,
@@ -134,8 +143,8 @@ const x = 200, fe = "360px", U = ({
134
143
  }
135
144
  )
136
145
  }
137
- ), D = o ? /* @__PURE__ */ e(
138
- N,
146
+ ), U = o ? /* @__PURE__ */ e(
147
+ T,
139
148
  {
140
149
  tooltip: o,
141
150
  tooltipWhenTruncated: !0,
@@ -144,106 +153,106 @@ const x = 200, fe = "360px", U = ({
144
153
  className: "min-w-0 text-[13px]",
145
154
  children: o
146
155
  }
147
- ) : null, O = c ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center", children: c }) : null, M = y ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-baseline", children: y }) : null;
148
- return ne(
156
+ ) : null, X = p ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center", children: p }) : null, Y = C ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-baseline", children: C }) : null;
157
+ return ve(
149
158
  // Host carries the stacking context — ShadowRootWrapper's `isolation` would
150
159
  // otherwise flatten our z-index and let sticky page elements paint over us.
151
160
  /* @__PURE__ */ e(
152
- oe,
161
+ Ne,
153
162
  {
154
- hostRef: P,
155
- hostStyle: { position: "relative", zIndex: re },
156
- hostProps: le ? { ...H("sidepanel"), [xe]: "" } : H("sidepanel"),
157
- children: /* @__PURE__ */ l("div", { className: "fixed inset-0 z-[1000]", children: [
163
+ hostRef: V,
164
+ hostStyle: { position: "relative", zIndex: me },
165
+ hostProps: pe ? { ...K("sidepanel"), [Ce]: "" } : K("sidepanel"),
166
+ children: /* @__PURE__ */ e(q.Provider, { value: null, children: /* @__PURE__ */ l("div", { className: "fixed inset-0 z-[1000]", children: [
158
167
  /* @__PURE__ */ e(
159
168
  "div",
160
169
  {
161
170
  "aria-hidden": "true",
162
- onClick: a,
163
- className: `absolute inset-0 bg-[var(--malachite-overlay-scrim)] transition-opacity duration-200 ease-in-out ${C ? "opacity-100" : "opacity-0"}`
171
+ onClick: t,
172
+ className: `absolute inset-0 bg-[var(--malachite-overlay-scrim)] transition-opacity duration-200 ease-in-out ${D ? "opacity-100" : "opacity-0"}`
164
173
  }
165
174
  ),
166
175
  /* @__PURE__ */ l(
167
176
  "div",
168
177
  {
169
- ref: Z,
178
+ ref: ce,
170
179
  role: "dialog",
171
- "aria-modal": ee ? "true" : void 0,
180
+ "aria-modal": de ? "true" : void 0,
172
181
  "aria-describedby": [
173
- ...(A ?? []).map((V, te) => `${S}-${te}`),
174
- s ? E : null
182
+ ...(B ?? []).map((c, fe) => `${E}-${fe}`),
183
+ s ? z : null
175
184
  ].filter(Boolean).join(" ") || void 0,
176
185
  tabIndex: -1,
177
- "aria-label": I ? void 0 : F ?? (typeof i == "string" ? i : void 0),
178
- "aria-labelledby": I,
186
+ "aria-label": k ? void 0 : Z ?? (typeof i == "string" ? i : void 0),
187
+ "aria-labelledby": k,
179
188
  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)]",
180
189
  style: {
181
- width: `min(calc(100% - 16px), ${t ? `calc(2 * ${g(u)})` : g(u)})`,
190
+ width: `min(calc(100% - 16px), ${a ? `calc(2 * ${S(N)})` : S(N)})`,
182
191
  // Inline: Tailwind translate utilities silently break inside
183
192
  // shadow roots (see CLAUDE.md Shadow DOM caveats).
184
- transform: C ? "translateX(0)" : "translateX(calc(100% + 16px))",
185
- transition: `transform ${x}ms ease-in-out, width ${x}ms ease-in-out, grid-template-columns ${x}ms ease-in-out`,
193
+ transform: D ? "translateX(0)" : "translateX(calc(100% + 16px))",
194
+ transition: `transform ${h}ms ease-in-out, width ${h}ms ease-in-out, grid-template-columns ${h}ms ease-in-out`,
186
195
  // The panel's own column is the width it has without an aside: `maxWidth`
187
196
  // less the 1px border either side, so opening the aside never widens it.
188
197
  // With an aside neither column gives way, so a narrow window scrolls the
189
198
  // panel instead. Both templates share one shape so the minimums animate
190
199
  // with the width rather than overflowing mid-transition.
191
- gridTemplateColumns: t ? `minmax(${fe}, 1fr) minmax(${b}, ${b})` : `minmax(0px, 1fr) minmax(0px, ${b})`
200
+ gridTemplateColumns: a ? `minmax(${Ie}, 1fr) minmax(${w}, ${w})` : `minmax(0px, 1fr) minmax(0px, ${w})`
192
201
  },
193
202
  children: [
194
- ae,
195
- /* @__PURE__ */ l(he, { onSubmit: $, children: [
203
+ xe,
204
+ /* @__PURE__ */ l(ke, { onSubmit: I, children: [
196
205
  /* @__PURE__ */ l(
197
206
  "div",
198
207
  {
199
- className: `flex flex-col gap-[20px] px-[20px] py-[18px] ${R}`,
208
+ className: `flex flex-col gap-[20px] px-[20px] py-[18px] ${W}`,
200
209
  children: [
201
210
  /* @__PURE__ */ l("div", { className: "flex items-center gap-[12px]", children: [
202
- T ? /* @__PURE__ */ e(
211
+ P ? /* @__PURE__ */ e(
203
212
  "button",
204
213
  {
205
214
  type: "button",
206
215
  "aria-label": "Back",
207
- onClick: T,
208
- className: j,
209
- children: /* @__PURE__ */ e(ce, { size: 16 })
216
+ onClick: P,
217
+ className: G,
218
+ children: /* @__PURE__ */ e(we, { size: 16 })
210
219
  }
211
220
  ) : null,
212
- w ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center", children: w }) : null,
213
- L ? /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 items-center gap-[12px]", children: [
221
+ $ ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center", children: $ }) : null,
222
+ j ? /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 items-center gap-[12px]", children: [
214
223
  /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 flex-col gap-[2px]", children: [
215
224
  /* @__PURE__ */ l("div", { className: "flex min-w-0 items-baseline gap-[8px]", children: [
216
- z,
217
- O
225
+ H,
226
+ X
218
227
  ] }),
219
- D
228
+ U
220
229
  ] }),
221
- M
230
+ Y
222
231
  ] }) : /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 items-baseline gap-[12px]", children: [
223
232
  /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 items-baseline gap-[8px]", children: [
224
233
  /* @__PURE__ */ l("div", { className: "flex min-w-0 items-baseline gap-[8px]", children: [
225
- z,
226
- D
234
+ H,
235
+ U
227
236
  ] }),
228
- O
237
+ X
229
238
  ] }),
230
- M
239
+ Y
231
240
  ] }),
232
241
  /* @__PURE__ */ e(
233
242
  "button",
234
243
  {
235
244
  type: "button",
236
245
  "aria-label": "Close",
237
- onClick: a,
238
- className: j,
239
- children: /* @__PURE__ */ e(de, { size: 10 })
246
+ onClick: t,
247
+ className: G,
248
+ children: /* @__PURE__ */ e(ye, { size: 10 })
240
249
  }
241
250
  )
242
251
  ] }),
243
252
  s ? /* @__PURE__ */ e(
244
253
  "div",
245
254
  {
246
- id: E,
255
+ id: z,
247
256
  className: "text-[13px] leading-[1.6] text-[var(--malachite-text-secondary)]",
248
257
  children: s
249
258
  }
@@ -251,39 +260,49 @@ const x = 200, fe = "360px", U = ({
251
260
  ]
252
261
  }
253
262
  ),
254
- /* @__PURE__ */ l("div", { className: `flex min-h-0 flex-col ${f ? "" : "row-span-2"}`, children: [
263
+ /* @__PURE__ */ l("div", { className: `flex min-h-0 flex-col ${v ? "" : "row-span-2"}`, children: [
255
264
  d ? /* @__PURE__ */ e(
256
265
  "div",
257
266
  {
258
- className: "shrink-0 px-[16px] pt-[16px] pb-[8px]",
259
- onKeyDown: $ ? ue : void 0,
267
+ className: `shrink-0 pt-[16px] pb-[8px] ${x === "body" ? "px-[28px]" : "px-[16px]"}`,
268
+ onKeyDown: I ? Pe : void 0,
260
269
  children: d
261
270
  }
262
271
  ) : null,
263
272
  /* @__PURE__ */ e(
264
- U,
273
+ "div",
274
+ {
275
+ ref: ae,
276
+ className: "shrink-0 px-[28px] empty:hidden"
277
+ }
278
+ ),
279
+ /* @__PURE__ */ e(
280
+ J,
265
281
  {
266
- bodyPadding: K,
267
- callouts: A,
268
- calloutId: S,
269
- renderLink: G,
270
- children: J
282
+ bodyPadding: ee,
283
+ callouts: B,
284
+ calloutId: E,
285
+ renderLink: le,
286
+ stableGutter: ie > 0,
287
+ scrollerRef: ne,
288
+ children: /* @__PURE__ */ e(q.Provider, { value: oe, children: te })
271
289
  }
272
290
  )
273
291
  ] }),
274
- f ? /* @__PURE__ */ e("div", { className: "border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]", children: f }) : null
292
+ v ? /* @__PURE__ */ e("div", { className: "border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]", children: v }) : null
275
293
  ] })
276
294
  ]
277
295
  }
278
296
  )
279
- ] })
297
+ ] }) })
280
298
  }
281
299
  ),
282
300
  document.body
283
301
  );
284
302
  };
303
+ Ee.Tabs = Te;
285
304
  export {
286
- Ce as SidePanel,
287
- Ce as default
305
+ Ee as SidePanel,
306
+ Ee as default
288
307
  };
289
308
  //# sourceMappingURL=SidePanel.js.map