@stackone/malachite 2.76.0 → 2.78.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
@@ -26,8 +26,8 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
26
26
  - **`OverflowRow`** — Horizontal row that collapses items that do not fit into an overflow affordance.
27
27
  - **`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`.
28
28
  - **`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.
29
- - **`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) 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`.
30
- - **`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`.
29
+ - **`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`.
30
+ - **`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.
31
31
  - **`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.
32
32
  - **`SidePanelNavFooter`** — Keyboard-hint footer for SidePanel: up/down keycaps to step between records and an esc-to-close hint, with an optional right-aligned actions slot.
33
33
 
@@ -45,7 +45,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
45
45
  - **`UsageCard`** — A small metered card: a title (optionally a link via `titleLink`, drawn with a trailing arrow), a right-aligned `detail` such as "700/1,000", and a body, usually a `Progress`. Used by `Sidebar.Usage`, and fine on its own, e.g. on a billing page. _Key props:_ `title`, `titleLink`, `detail`, `children`, `aria-label` (required; names the group), `busy` (sets `aria-busy` only).
46
46
  - **`Progress`** — Progress bar.
47
47
  - **`LoadingBar`** — Indeterminate full-width loading line; the variant colour sweeps across a pale track for work of unknown duration. Toggle `active` rather than unmounting, so the reserved height prevents layout shift. _Key props:_ `active`, `LoadingBarVariant` (`default` | `warning` | `error`), `LoadingBarSize` (`small` | `medium` | `large`), `aria-label`, `aria-labelledby`, `className`, `style`.
48
- - **`ToastProvider`** — Transient top-centre toasts for the outcome of an action. Wrap the app once in `ToastProvider` and call `useToast().show({ message, variant })` anywhere beneath it. Each toast auto-dismisses, pauses while hovered and dismisses on click; at most three show at once. Toasts are announced through always-mounted live regions (`status` for success, `alert` for error), and the pills themselves are hidden from assistive tech and never take focus, so they cannot fight a dialog's focus trap. The host mounts on the first toast and joins the top layer, so toasts paint above elevated side panels. _Key props:_ `ToastProvider`: `children`, `duration` (ms, default 3000). `useToast()` → `show({ message, variant })`, `ToastVariant` (`success` | `error`, default `success`).
48
+ - **`ToastProvider`** — Transient top-centre toasts for the outcome of an action. Wrap the app once in `ToastProvider` and call `useToast().show({ message, variant })` anywhere beneath it. Corners match a medium button. Each toast auto-dismisses, pauses while hovered and dismisses on click; at most three show at once. Toasts are announced through always-mounted live regions (`status` for success, `alert` for error), and the pills themselves are hidden from assistive tech and never take focus, so they cannot fight a dialog's focus trap. The host mounts on the first toast and joins the top layer, so toasts paint above elevated side panels. _Key props:_ `ToastProvider`: `children`, `duration` (ms, default 3000). `useToast()` → `show({ message, variant })`, `ToastVariant` (`success` | `error`, default `success`).
49
49
  - **`Spinner`** — Loading spinner.
50
50
  - **`Skeleton`** — Loading placeholders. Includes `Skeleton.Avatar` and `Skeleton.Input`. The shimmer stops under `prefers-reduced-motion`, leaving the plain placeholder.
51
51
  - **`Tooltip`** — Hover/focus tooltip; also works on disabled controls (see CLAUDE.md). It describes its trigger once shown, so `describesTrigger={false}` where the same sentence is already on screen and referenced — otherwise a screen reader reads it twice. _Key props:_ `text`, `placement`, `delay`, `maxWidth`, `shouldShow`, `triggerAs`, `describesTrigger`, `isShrinkable`, `fill`, `wrapChildren`, `suppressed` (holds the tooltip back, e.g. while the popup its trigger opens is up), `showOnFocus` (false where script can move focus onto the trigger, e.g. an option a panel focuses on open), `focusableTrigger` (makes a trigger that cannot take focus — text, a static `Tag` — a tab stop, so the tooltip is not mouse-only; not for focusable children).
@@ -56,7 +56,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
56
56
  ## Lists, rows & navigation
57
57
 
58
58
  - **`ButtonList`** — Vertical list of pill-style button/link rows with built-in hover/focus/active states. _Key props:_ `buttons[]` (`key`, `children`, `onClick`, `href`), `compact`.
59
- - **`Accordion`** — Expand/collapse section with a clickable header (disclosure arrow + title/header + trailing slot). Use `header` for rich content and `trailing` for an interactive control (e.g. a Checkbox) — trailing sits outside the toggle button, so a selectable+expandable row is just an Accordion. Controlled or uncontrolled. Pass `stickyHeader` (+ optional `stickyTopOffset`) to pin the header while the body scrolls — needs a scroll ancestor that clips without trapping sticky (e.g. `<Surface overflow="clip">`). `animate={false}` opens instantly. _Key props:_ `title` or `header`, `leading` (before the title, outside the toggle, e.g. a group's tri-state Checkbox), `trailing`, `arrowPosition` (`start` | `end`), `highlightExpanded` (default `true`; `false` leaves an open row on the card ground), `disabled`, `isExpanded`/`defaultExpanded`, `onToggle`, `stickyHeader`, `stickyTopOffset`, `animate`.
59
+ - **`Accordion`** — Expand/collapse section with a clickable header (disclosure arrow + title/header + trailing slot). Use `header` for rich content and `trailing` for an interactive control (e.g. a Checkbox) — trailing sits outside the toggle button, so a selectable+expandable row is just an Accordion. Controlled or uncontrolled. Pass `stickyHeader` (+ optional `stickyTopOffset`) to pin the header while the body scrolls — needs a scroll ancestor that clips without trapping sticky (e.g. `<Surface overflow="clip">`). `animate={false}` opens instantly. _Key props:_ `title` or `header`, `leading` (before the title, outside the toggle, e.g. a group's tri-state Checkbox), `trailing`, `arrowPosition` (`start` | `end` | `gutter`; `gutter` puts the arrow before `leading` as its own mouse toggle, as a file tree keeps its caret in the gutter), `highlightExpanded` (default `true`; `false` leaves an open row on the card ground), `disabled`, `isExpanded`/`defaultExpanded`, `onToggle`, `stickyHeader`, `stickyTopOffset`, `animate`.
60
60
  - **`DefinitionRow`** — Row showing an icon, label, optional tag and description — for definition/detail lists. _Key props:_ `icon`, `label`, `tag`, `description`.
61
61
  - **`PreviewTree`** — Nested, indented tree for previewing hierarchical structure.
62
62
  - **`PreviewTreeRow`** — A single labelled row within a PreviewTree. _Key props:_ `label`.
@@ -122,7 +122,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
122
122
  - **`AppLogo`** — A connector's mark, optionally with its name and version tag. Builds on `Avatar`, so a missing or broken logo falls back to the generic "no logo available" placeholder, a neutral grey tile with a darker square, the same mark stackone-logos.com serves. The gap tightens below 18px so the mark and label still read as one unit. _Key props:_ `src`, `name`, `showName`, `size`, `nameSize`, `nameWeight`, `version`, `truncate`, `className`.
123
123
  - **`ConnectionHeader`** — Two tilted logo tiles (from → to) showing a connection between apps. _Key props:_ `from`, `to` (`ConnectionEndpoint`: `icon`, `label`, `background`).
124
124
  - **`CodeBlock`** — Syntax-styled code block. _Key props:_ `code`.
125
- - **`Stepper`** — Progress dots/segments for a multi-step flow; optionally clickable. _Key props:_ `steps`, `active`, `onChange`.
125
+ - **`Stepper`** — Progress dots/segments for a multi-step flow; optionally clickable. `groups` takes a long flow in labelled sections: the active step’s group opens into one bar per step across the full width and every other group folds to a short bar. Folded bars keep a fixed width and the open group shares what is left, so allow about 20px per other group and 12px per step in the open group. With `onChange` each folded bar is a button named after its group. _Key props:_ `steps` or `groups` (`{ label, steps }[]`), `active`, `onChange`.
126
126
  - **`Swatch`** — Colour swatch preview.
127
127
 
128
128
  ## Theming & utility
@@ -1,68 +1,87 @@
1
- import { jsxs as c, jsx as r } from "react/jsx-runtime";
2
- import { useId as O, useState as f } from "react";
3
- import { DisclosureArrow as v } from "./DisclosureArrow.js";
4
- import { FOCUS_RING as U, FOCUS_RING_INSET as z } from "./focusRing.js";
5
- import { isRenderableNode as h } from "./renderableNode.js";
1
+ import { jsxs as i, jsx as r } from "react/jsx-runtime";
2
+ import { useId as G, useState as v } from "react";
3
+ import { DisclosureArrow as p } from "./DisclosureArrow.js";
4
+ import { FOCUS_RING as O, FOCUS_RING_INSET as U } from "./focusRing.js";
5
+ import { isRenderableNode as g } from "./renderableNode.js";
6
6
  const T = ({
7
- title: g,
8
- header: w,
9
- className: N,
10
- children: a,
11
- trailing: i,
12
- leading: p,
13
- arrowPosition: m = "start",
14
- highlightExpanded: k = !0,
15
- variant: y = "default",
16
- defaultExpanded: I = !1,
17
- isExpanded: n,
18
- onToggle: s,
19
- disabled: d = !1,
7
+ title: N,
8
+ header: k,
9
+ className: w,
10
+ children: o,
11
+ trailing: m,
12
+ leading: u,
13
+ arrowPosition: n = "start",
14
+ highlightExpanded: y = !0,
15
+ variant: I = "default",
16
+ defaultExpanded: C = !1,
17
+ isExpanded: d,
18
+ onToggle: l,
19
+ disabled: s = !1,
20
20
  stickyHeader: b = !1,
21
21
  stickyTopOffset: B = 0,
22
22
  animate: x = !0
23
23
  }) => {
24
- const t = y === "sunken", l = `${O()}-body`, [C, R] = f(I), e = n !== void 0 ? n : C, S = x || e && !!a, [j, $] = f(!1), E = () => {
25
- const o = !e;
26
- n === void 0 && R(o), s == null || s(o);
27
- }, _ = [
24
+ const t = I === "sunken", c = `${G()}-body`, [R, S] = v(C), e = d !== void 0 ? d : R, j = x || e && !!o, [$, D] = v(!1), f = () => {
25
+ const a = !e;
26
+ d === void 0 && S(a), l == null || l(a);
27
+ }, E = [
28
28
  "flex flex-col w-full text-left",
29
29
  t ? "rounded-xl bg-[var(--malachite-card-dimmed-background)] p-[4px]" : "",
30
- N
31
- ].filter(Boolean).join(" "), A = [
30
+ w
31
+ ].filter(Boolean).join(" "), _ = [
32
32
  // `group` only when enabled, so the arrow doesn't darken on hover while disabled.
33
- d ? "" : "group",
33
+ s ? "" : "group",
34
34
  "flex items-center w-full transition-colors",
35
35
  t ? "" : "border-0 border-b border-solid border-[var(--malachite-card-border)]",
36
36
  b ? "sticky z-10" : "",
37
- t ? "bg-transparent" : e && k ? "bg-[var(--malachite-buttonlist-hover-background)]" : d ? "bg-transparent" : "bg-transparent hover:bg-[var(--malachite-buttonlist-hover-background)]"
38
- ].filter(Boolean).join(" "), u = h(p), F = [
37
+ t ? "bg-transparent" : e && y ? "bg-[var(--malachite-buttonlist-hover-background)]" : s ? "bg-transparent" : "bg-transparent hover:bg-[var(--malachite-buttonlist-hover-background)]"
38
+ ].filter(Boolean).join(" "), h = g(u), A = [
39
39
  "flex flex-1 items-center min-w-0 appearance-none border-0 bg-transparent text-left cursor-pointer select-none disabled:cursor-not-allowed",
40
- t ? `gap-[16px] px-[16px] py-[12px] rounded-lg ${U}` : `gap-[12px] p-[16px] ${z}`,
41
- u ? "!pl-[12px]" : ""
42
- ].filter(Boolean).join(" "), G = b ? {
40
+ t ? `gap-[16px] px-[16px] py-[12px] rounded-lg ${O}` : `gap-[12px] p-[16px] ${U}`,
41
+ h || n === "gutter" ? "!pl-[12px]" : ""
42
+ ].filter(Boolean).join(" "), F = b ? {
43
43
  top: `${B}px`,
44
44
  backgroundColor: t ? "var(--malachite-card-dimmed-background)" : "var(--malachite-card-background)"
45
45
  } : {};
46
- return /* @__PURE__ */ c("div", { className: _, children: [
47
- /* @__PURE__ */ c("div", { className: A, style: G, "data-accordion-header": "", children: [
48
- u && /* @__PURE__ */ r("div", { className: "shrink-0 flex items-center pl-[16px]", children: p }),
49
- /* @__PURE__ */ c(
46
+ return /* @__PURE__ */ i("div", { className: E, children: [
47
+ /* @__PURE__ */ i("div", { className: _, style: F, "data-accordion-header": "", children: [
48
+ n === "gutter" && /* @__PURE__ */ r(
50
49
  "button",
51
50
  {
52
51
  type: "button",
53
- className: F,
54
- onClick: E,
52
+ tabIndex: -1,
53
+ "aria-hidden": "true",
54
+ className: "shrink-0 self-stretch flex items-center pl-[16px] appearance-none border-0 bg-transparent cursor-pointer disabled:cursor-not-allowed",
55
+ onMouseDown: (a) => a.preventDefault(),
56
+ onClick: f,
57
+ disabled: s,
58
+ children: /* @__PURE__ */ r(p, { expanded: e })
59
+ }
60
+ ),
61
+ h && /* @__PURE__ */ r(
62
+ "div",
63
+ {
64
+ className: `shrink-0 flex items-center ${n === "gutter" ? "pl-[12px]" : "pl-[16px]"}`,
65
+ children: u
66
+ }
67
+ ),
68
+ /* @__PURE__ */ i(
69
+ "button",
70
+ {
71
+ type: "button",
72
+ className: A,
73
+ onClick: f,
55
74
  "aria-expanded": e,
56
- "aria-controls": S ? l : void 0,
57
- disabled: d,
75
+ "aria-controls": j ? c : void 0,
76
+ disabled: s,
58
77
  children: [
59
- m === "start" && /* @__PURE__ */ r(v, { expanded: e }),
60
- w ?? /* @__PURE__ */ r("span", { className: "flex-1 min-w-0 truncate font-medium text-[13px] tracking-[0.13px] text-[var(--malachite-text-primary)]", children: g }),
61
- m === "end" && /* @__PURE__ */ r(v, { expanded: e, className: "ml-auto" })
78
+ n === "start" && /* @__PURE__ */ r(p, { expanded: e }),
79
+ k ?? /* @__PURE__ */ r("span", { className: "flex-1 min-w-0 truncate font-medium text-[13px] tracking-[0.13px] text-[var(--malachite-text-primary)]", children: N }),
80
+ n === "end" && /* @__PURE__ */ r(p, { expanded: e, className: "ml-auto" })
62
81
  ]
63
82
  }
64
83
  ),
65
- h(i) && /* @__PURE__ */ r("div", { className: "shrink-0 flex items-center pr-[16px] text-[var(--malachite-text-secondary)]", children: i })
84
+ g(m) && /* @__PURE__ */ r("div", { className: "shrink-0 flex items-center pr-[16px] text-[var(--malachite-text-secondary)]", children: m })
66
85
  ] }),
67
86
  x ? (
68
87
  /* Height animates via grid-template-rows (0fr → 1fr); body clips during.
@@ -72,21 +91,21 @@ const T = ({
72
91
  /* @__PURE__ */ r(
73
92
  "div",
74
93
  {
75
- id: l,
94
+ id: c,
76
95
  className: "grid grid-cols-[minmax(0,1fr)] w-full transition-[grid-template-rows] duration-200 ease-in-out",
77
96
  style: { gridTemplateRows: e ? "1fr" : "0fr" },
78
- onTransitionEnd: (o) => {
79
- o.propertyName === "grid-template-rows" && $(e);
97
+ onTransitionEnd: (a) => {
98
+ a.propertyName === "grid-template-rows" && D(e);
80
99
  },
81
100
  children: /* @__PURE__ */ r(
82
101
  "div",
83
102
  {
84
- className: j && e ? "overflow-visible" : "overflow-hidden",
85
- children: a && /* @__PURE__ */ r(
103
+ className: $ && e ? "overflow-visible" : "overflow-hidden",
104
+ children: o && /* @__PURE__ */ r(
86
105
  "div",
87
106
  {
88
107
  className: t ? "pt-[4px]" : "border-b border-solid border-[var(--malachite-card-border)]",
89
- children: a
108
+ children: o
90
109
  }
91
110
  )
92
111
  }
@@ -95,12 +114,12 @@ const T = ({
95
114
  )
96
115
  ) : (
97
116
  /* Instant open — no clip, so a sticky child inside pins immediately. */
98
- e && a && /* @__PURE__ */ r(
117
+ e && o && /* @__PURE__ */ r(
99
118
  "div",
100
119
  {
101
- id: l,
120
+ id: c,
102
121
  className: t ? "pt-[4px]" : "border-b border-solid border-[var(--malachite-card-border)]",
103
- children: a
122
+ children: o
104
123
  }
105
124
  )
106
125
  )
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.js","sources":["../../src/components/Accordion.tsx"],"sourcesContent":["import React, { useId, useState } from 'react';\nimport DisclosureArrow from './DisclosureArrow';\nimport { FOCUS_RING, FOCUS_RING_INSET } from './focusRing';\nimport { isRenderableNode } from './renderableNode';\n\ninterface AccordionBaseProps {\n className?: string;\n children?: React.ReactNode;\n /**\n * Visual style. `default` is the flat list row (row dividers, hover background).\n * `sunken` draws the section as a sunken card (dimmed rounded container, no\n * dividers/hover) — used for stacked detail sections in side panels and detail\n * pages (see `CollapsibleSection`). Both lead with the arrow: it is the affordance\n * that says the section opens, and a reader scanning a stack of them finds it in\n * one column rather than at whatever width each header happens to end.\n */\n variant?: 'default' | 'sunken';\n /**\n * Content pinned to the right of the header, OUTSIDE the toggle button — so it may\n * be interactive (e.g. a Checkbox) without nesting a button inside a button.\n */\n trailing?: React.ReactNode;\n /** Before the title, outside the toggle button. */\n leading?: React.ReactNode;\n arrowPosition?: 'start' | 'end';\n /** `false` keeps an open row on the card ground. */\n highlightExpanded?: boolean;\n defaultExpanded?: boolean;\n isExpanded?: boolean;\n onToggle?: (expanded: boolean) => void;\n /** Disables the toggle (and its hover). Trailing controls manage their own state. */\n disabled?: boolean;\n /**\n * Pin the header row to the top of the nearest scroll container so it stays\n * reachable while the body scrolls. Needs a scroll ancestor that clips without\n * trapping sticky — e.g. a `<Surface overflow=\"clip\">` (`overflow: hidden` traps it).\n */\n stickyHeader?: boolean;\n /** Offset (px) from the top of the scroll container when `stickyHeader` is set. */\n stickyTopOffset?: number;\n /**\n * Animate the expand/collapse height (default `true`). Set `false` for an instant\n * open — the body isn't clipped, so a `position: sticky` child pins immediately with\n * no post-animation settle.\n */\n animate?: boolean;\n}\n\n/**\n * Requires at least one of `title` (simple text header) or `header` (rich ReactNode\n * content for the toggle area, e.g. avatar + badges) so the toggle is never empty.\n */\ntype AccordionProps = AccordionBaseProps &\n ({ title: string; header?: React.ReactNode } | { title?: string; header: React.ReactNode });\n\nconst Accordion: React.FC<AccordionProps> = ({\n title,\n header,\n className,\n children,\n trailing,\n leading,\n arrowPosition = 'start',\n highlightExpanded = true,\n variant = 'default',\n defaultExpanded = false,\n isExpanded,\n onToggle,\n disabled = false,\n stickyHeader = false,\n stickyTopOffset = 0,\n animate = true,\n}) => {\n const sunken = variant === 'sunken';\n const instanceId = useId();\n const bodyId = `${instanceId}-body`;\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);\n\n // Use controlled state if isExpanded is provided, otherwise use internal state\n const expanded = isExpanded !== undefined ? isExpanded : internalExpanded;\n\n // The instant path only renders the body while expanded; don't advertise\n // aria-controls when the referenced element isn't in the DOM.\n const bodyRendered = animate || (expanded && !!children);\n\n // The body clips overflow so the expand/collapse height animation works. Once fully\n // expanded we release the clip (after the transition) so a `position: sticky` child\n // inside can pin — `overflow: hidden` would otherwise trap it.\n //\n // Owned entirely by the transition: the same `onTransitionEnd` that sets it on expand\n // clears it on collapse, so no effect has to mirror `expanded` into it.\n const [bodySettled, setBodySettled] = useState(false);\n\n const handleToggle = () => {\n const newExpanded = !expanded;\n if (isExpanded === undefined) {\n setInternalExpanded(newExpanded);\n }\n onToggle?.(newExpanded);\n };\n\n const containerClasses = [\n 'flex flex-col w-full text-left',\n sunken ? 'rounded-xl bg-[var(--malachite-card-dimmed-background)] p-[4px]' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n // The whole header row is a `group` so the disclosure arrow darkens on hover; the\n // hover background and arrow react to hovering anywhere on the row. The sunken\n // variant carries its own card chrome instead of row dividers/hover.\n const rowBackground = sunken\n ? 'bg-transparent'\n : expanded && highlightExpanded\n ? 'bg-[var(--malachite-buttonlist-hover-background)]'\n : disabled\n ? 'bg-transparent'\n : 'bg-transparent hover:bg-[var(--malachite-buttonlist-hover-background)]';\n const headerRowClasses = [\n // `group` only when enabled, so the arrow doesn't darken on hover while disabled.\n disabled ? '' : 'group',\n 'flex items-center w-full transition-colors',\n sunken ? '' : 'border-0 border-b border-solid border-[var(--malachite-card-border)]',\n stickyHeader ? 'sticky z-10' : '',\n rowBackground,\n ]\n .filter(Boolean)\n .join(' ');\n const hasLeading = isRenderableNode(leading);\n // Full-bleed default rows use an inset ring; the padded sunken toggle fits an outset one.\n const toggleButtonClasses = [\n 'flex flex-1 items-center min-w-0 appearance-none border-0 bg-transparent text-left cursor-pointer select-none disabled:cursor-not-allowed',\n sunken\n ? `gap-[16px] px-[16px] py-[12px] rounded-lg ${FOCUS_RING}`\n : `gap-[12px] p-[16px] ${FOCUS_RING_INSET}`,\n hasLeading ? '!pl-[12px]' : '',\n ]\n .filter(Boolean)\n .join(' ');\n\n // A pinned header needs an opaque background so the scrolling body doesn't bleed\n // through. Inline (not a Tailwind arbitrary class) so the offset always applies. It is\n // the variant's own ground, not the card's: a sunken section pinned in card white is a\n // white bar floating over the grey it belongs to.\n const headerRowStyle: React.CSSProperties = stickyHeader\n ? {\n top: `${stickyTopOffset}px`,\n backgroundColor: sunken\n ? 'var(--malachite-card-dimmed-background)'\n : 'var(--malachite-card-background)',\n }\n : {};\n\n return (\n <div className={containerClasses}>\n <div className={headerRowClasses} style={headerRowStyle} data-accordion-header=\"\">\n {hasLeading && (\n <div className=\"shrink-0 flex items-center pl-[16px]\">{leading}</div>\n )}\n {/* Toggle area — arrow + header/title. Interactive trailing sits outside it. */}\n <button\n type=\"button\"\n className={toggleButtonClasses}\n onClick={handleToggle}\n aria-expanded={expanded}\n aria-controls={bodyRendered ? bodyId : undefined}\n disabled={disabled}\n >\n {arrowPosition === 'start' && <DisclosureArrow expanded={expanded} />}\n {header ?? (\n <span className=\"flex-1 min-w-0 truncate font-medium text-[13px] tracking-[0.13px] text-[var(--malachite-text-primary)]\">\n {title}\n </span>\n )}\n {arrowPosition === 'end' && (\n <DisclosureArrow expanded={expanded} className=\"ml-auto\" />\n )}\n </button>\n {isRenderableNode(trailing) && (\n <div className=\"shrink-0 flex items-center pr-[16px] text-[var(--malachite-text-secondary)]\">\n {trailing}\n </div>\n )}\n </div>\n\n {animate ? (\n /* Height animates via grid-template-rows (0fr → 1fr); body clips during.\n grid-cols-[minmax(0,1fr)] pins the single column to the track width so\n wide, non-wrapping children (e.g. a table with long cell text) can't grow\n the implicit `auto` column to their max-content and overflow the container. */\n <div\n id={bodyId}\n className=\"grid grid-cols-[minmax(0,1fr)] w-full transition-[grid-template-rows] duration-200 ease-in-out\"\n style={{ gridTemplateRows: expanded ? '1fr' : '0fr' }}\n onTransitionEnd={(event) => {\n if (event.propertyName === 'grid-template-rows') {\n setBodySettled(expanded);\n }\n }}\n >\n <div\n className={bodySettled && expanded ? 'overflow-visible' : 'overflow-hidden'}\n >\n {children && (\n <div\n className={\n sunken\n ? 'pt-[4px]'\n : 'border-b border-solid border-[var(--malachite-card-border)]'\n }\n >\n {children}\n </div>\n )}\n </div>\n </div>\n ) : (\n /* Instant open — no clip, so a sticky child inside pins immediately. */\n expanded &&\n children && (\n <div\n id={bodyId}\n className={\n sunken\n ? 'pt-[4px]'\n : 'border-b border-solid border-[var(--malachite-card-border)]'\n }\n >\n {children}\n </div>\n )\n )}\n </div>\n );\n};\n\nexport default Accordion;\nexport { Accordion };\nexport type { AccordionProps };\n"],"names":["Accordion","title","header","className","children","trailing","leading","arrowPosition","highlightExpanded","variant","defaultExpanded","isExpanded","onToggle","disabled","stickyHeader","stickyTopOffset","animate","sunken","bodyId","useId","internalExpanded","setInternalExpanded","useState","expanded","bodyRendered","bodySettled","setBodySettled","handleToggle","newExpanded","containerClasses","headerRowClasses","hasLeading","isRenderableNode","toggleButtonClasses","FOCUS_RING","FOCUS_RING_INSET","headerRowStyle","jsxs","jsx","DisclosureArrow","event"],"mappings":";;;;;AAuDA,MAAMA,IAAsC,CAAC;AAAA,EACzC,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,mBAAAC,IAAoB;AAAA,EACpB,SAAAC,IAAU;AAAA,EACV,iBAAAC,IAAkB;AAAA,EAClB,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,cAAAC,IAAe;AAAA,EACf,iBAAAC,IAAkB;AAAA,EAClB,SAAAC,IAAU;AACd,MAAM;AACF,QAAMC,IAASR,MAAY,UAErBS,IAAS,GADIC,EAAA,CACS,SACtB,CAACC,GAAkBC,CAAmB,IAAIC,EAASZ,CAAe,GAGlEa,IAAWZ,MAAe,SAAYA,IAAaS,GAInDI,IAAeR,KAAYO,KAAY,CAAC,CAACnB,GAQzC,CAACqB,GAAaC,CAAc,IAAIJ,EAAS,EAAK,GAE9CK,IAAe,MAAM;AACvB,UAAMC,IAAc,CAACL;AACrB,IAAIZ,MAAe,UACfU,EAAoBO,CAAW,GAEnChB,KAAA,QAAAA,EAAWgB;AAAA,EACf,GAEMC,IAAmB;AAAA,IACrB;AAAA,IAC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AAU;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,MAGhES,EAAiB3B,CAAQ,uBACrB,OAAA,EAAI,WAAU,+EACV,UAAAA,EAAA,CACL;AAAA,IAAA,GAER;AAAA,IAECW;AAAA;AAAA;AAAA;AAAA;AAAA,MAKG,gBAAAsB;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,IAAIpB;AAAA,UACJ,WAAU;AAAA,UACV,OAAO,EAAE,kBAAkBK,IAAW,QAAQ,MAAA;AAAA,UAC9C,iBAAiB,CAACiB,MAAU;AACxB,YAAIA,EAAM,iBAAiB,wBACvBd,EAAeH,CAAQ;AAAA,UAE/B;AAAA,UAEA,UAAA,gBAAAe;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,WAAWb,KAAeF,IAAW,qBAAqB;AAAA,cAEzD,UAAAnB,KACG,gBAAAkC;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACG,WACIrB,IACM,aACA;AAAA,kBAGT,UAAAb;AAAA,gBAAA;AAAA,cAAA;AAAA,YACL;AAAA,UAAA;AAAA,QAER;AAAA,MAAA;AAAA;AAAA;AAAA,MAIJmB,KACAnB,KACI,gBAAAkC;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,IAAIpB;AAAA,UACJ,WACID,IACM,aACA;AAAA,UAGT,UAAAb;AAAA,QAAA;AAAA,MAAA;AAAA;AAAA,EACL,GAGZ;AAER;"}
1
+ {"version":3,"file":"Accordion.js","sources":["../../src/components/Accordion.tsx"],"sourcesContent":["import React, { useId, useState } from 'react';\nimport DisclosureArrow from './DisclosureArrow';\nimport { FOCUS_RING, FOCUS_RING_INSET } from './focusRing';\nimport { isRenderableNode } from './renderableNode';\n\ninterface AccordionBaseProps {\n className?: string;\n children?: React.ReactNode;\n /**\n * Visual style. `default` is the flat list row (row dividers, hover background).\n * `sunken` draws the section as a sunken card (dimmed rounded container, no\n * dividers/hover) — used for stacked detail sections in side panels and detail\n * pages (see `CollapsibleSection`). Both lead with the arrow: it is the affordance\n * that says the section opens, and a reader scanning a stack of them finds it in\n * one column rather than at whatever width each header happens to end.\n */\n variant?: 'default' | 'sunken';\n /**\n * Content pinned to the right of the header, OUTSIDE the toggle button — so it may\n * be interactive (e.g. a Checkbox) without nesting a button inside a button.\n */\n trailing?: React.ReactNode;\n /** Before the title, outside the toggle button. */\n leading?: React.ReactNode;\n /** `gutter` puts the arrow before `leading` as its own mouse toggle; the title stays the keyboard one. */\n arrowPosition?: 'start' | 'end' | 'gutter';\n /** `false` keeps an open row on the card ground. */\n highlightExpanded?: boolean;\n defaultExpanded?: boolean;\n isExpanded?: boolean;\n onToggle?: (expanded: boolean) => void;\n /** Disables the toggle (and its hover). Trailing controls manage their own state. */\n disabled?: boolean;\n /**\n * Pin the header row to the top of the nearest scroll container so it stays\n * reachable while the body scrolls. Needs a scroll ancestor that clips without\n * trapping sticky — e.g. a `<Surface overflow=\"clip\">` (`overflow: hidden` traps it).\n */\n stickyHeader?: boolean;\n /** Offset (px) from the top of the scroll container when `stickyHeader` is set. */\n stickyTopOffset?: number;\n /**\n * Animate the expand/collapse height (default `true`). Set `false` for an instant\n * open — the body isn't clipped, so a `position: sticky` child pins immediately with\n * no post-animation settle.\n */\n animate?: boolean;\n}\n\n/**\n * Requires at least one of `title` (simple text header) or `header` (rich ReactNode\n * content for the toggle area, e.g. avatar + badges) so the toggle is never empty.\n */\ntype AccordionProps = AccordionBaseProps &\n ({ title: string; header?: React.ReactNode } | { title?: string; header: React.ReactNode });\n\nconst Accordion: React.FC<AccordionProps> = ({\n title,\n header,\n className,\n children,\n trailing,\n leading,\n arrowPosition = 'start',\n highlightExpanded = true,\n variant = 'default',\n defaultExpanded = false,\n isExpanded,\n onToggle,\n disabled = false,\n stickyHeader = false,\n stickyTopOffset = 0,\n animate = true,\n}) => {\n const sunken = variant === 'sunken';\n const instanceId = useId();\n const bodyId = `${instanceId}-body`;\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);\n\n // Use controlled state if isExpanded is provided, otherwise use internal state\n const expanded = isExpanded !== undefined ? isExpanded : internalExpanded;\n\n // The instant path only renders the body while expanded; don't advertise\n // aria-controls when the referenced element isn't in the DOM.\n const bodyRendered = animate || (expanded && !!children);\n\n // The body clips overflow so the expand/collapse height animation works. Once fully\n // expanded we release the clip (after the transition) so a `position: sticky` child\n // inside can pin — `overflow: hidden` would otherwise trap it.\n //\n // Owned entirely by the transition: the same `onTransitionEnd` that sets it on expand\n // clears it on collapse, so no effect has to mirror `expanded` into it.\n const [bodySettled, setBodySettled] = useState(false);\n\n const handleToggle = () => {\n const newExpanded = !expanded;\n if (isExpanded === undefined) {\n setInternalExpanded(newExpanded);\n }\n onToggle?.(newExpanded);\n };\n\n const containerClasses = [\n 'flex flex-col w-full text-left',\n sunken ? 'rounded-xl bg-[var(--malachite-card-dimmed-background)] p-[4px]' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n // The whole header row is a `group` so the disclosure arrow darkens on hover; the\n // hover background and arrow react to hovering anywhere on the row. The sunken\n // variant carries its own card chrome instead of row dividers/hover.\n const rowBackground = sunken\n ? 'bg-transparent'\n : expanded && highlightExpanded\n ? 'bg-[var(--malachite-buttonlist-hover-background)]'\n : disabled\n ? 'bg-transparent'\n : 'bg-transparent hover:bg-[var(--malachite-buttonlist-hover-background)]';\n const headerRowClasses = [\n // `group` only when enabled, so the arrow doesn't darken on hover while disabled.\n disabled ? '' : 'group',\n 'flex items-center w-full transition-colors',\n sunken ? '' : 'border-0 border-b border-solid border-[var(--malachite-card-border)]',\n stickyHeader ? 'sticky z-10' : '',\n rowBackground,\n ]\n .filter(Boolean)\n .join(' ');\n const hasLeading = isRenderableNode(leading);\n // Full-bleed default rows use an inset ring; the padded sunken toggle fits an outset one.\n const toggleButtonClasses = [\n 'flex flex-1 items-center min-w-0 appearance-none border-0 bg-transparent text-left cursor-pointer select-none disabled:cursor-not-allowed',\n sunken\n ? `gap-[16px] px-[16px] py-[12px] rounded-lg ${FOCUS_RING}`\n : `gap-[12px] p-[16px] ${FOCUS_RING_INSET}`,\n hasLeading || arrowPosition === 'gutter' ? '!pl-[12px]' : '',\n ]\n .filter(Boolean)\n .join(' ');\n\n // A pinned header needs an opaque background so the scrolling body doesn't bleed\n // through. Inline (not a Tailwind arbitrary class) so the offset always applies. It is\n // the variant's own ground, not the card's: a sunken section pinned in card white is a\n // white bar floating over the grey it belongs to.\n const headerRowStyle: React.CSSProperties = stickyHeader\n ? {\n top: `${stickyTopOffset}px`,\n backgroundColor: sunken\n ? 'var(--malachite-card-dimmed-background)'\n : 'var(--malachite-card-background)',\n }\n : {};\n\n return (\n <div className={containerClasses}>\n <div className={headerRowClasses} style={headerRowStyle} data-accordion-header=\"\">\n {arrowPosition === 'gutter' && (\n <button\n type=\"button\"\n tabIndex={-1}\n aria-hidden=\"true\"\n className=\"shrink-0 self-stretch flex items-center pl-[16px] appearance-none border-0 bg-transparent cursor-pointer disabled:cursor-not-allowed\"\n onMouseDown={(event) => event.preventDefault()}\n onClick={handleToggle}\n disabled={disabled}\n >\n <DisclosureArrow expanded={expanded} />\n </button>\n )}\n {hasLeading && (\n <div\n className={`shrink-0 flex items-center ${arrowPosition === 'gutter' ? 'pl-[12px]' : 'pl-[16px]'}`}\n >\n {leading}\n </div>\n )}\n {/* Toggle area — arrow + header/title. Interactive trailing sits outside it. */}\n <button\n type=\"button\"\n className={toggleButtonClasses}\n onClick={handleToggle}\n aria-expanded={expanded}\n aria-controls={bodyRendered ? bodyId : undefined}\n disabled={disabled}\n >\n {arrowPosition === 'start' && <DisclosureArrow expanded={expanded} />}\n {header ?? (\n <span className=\"flex-1 min-w-0 truncate font-medium text-[13px] tracking-[0.13px] text-[var(--malachite-text-primary)]\">\n {title}\n </span>\n )}\n {arrowPosition === 'end' && (\n <DisclosureArrow expanded={expanded} className=\"ml-auto\" />\n )}\n </button>\n {isRenderableNode(trailing) && (\n <div className=\"shrink-0 flex items-center pr-[16px] text-[var(--malachite-text-secondary)]\">\n {trailing}\n </div>\n )}\n </div>\n\n {animate ? (\n /* Height animates via grid-template-rows (0fr → 1fr); body clips during.\n grid-cols-[minmax(0,1fr)] pins the single column to the track width so\n wide, non-wrapping children (e.g. a table with long cell text) can't grow\n the implicit `auto` column to their max-content and overflow the container. */\n <div\n id={bodyId}\n className=\"grid grid-cols-[minmax(0,1fr)] w-full transition-[grid-template-rows] duration-200 ease-in-out\"\n style={{ gridTemplateRows: expanded ? '1fr' : '0fr' }}\n onTransitionEnd={(event) => {\n if (event.propertyName === 'grid-template-rows') {\n setBodySettled(expanded);\n }\n }}\n >\n <div\n className={bodySettled && expanded ? 'overflow-visible' : 'overflow-hidden'}\n >\n {children && (\n <div\n className={\n sunken\n ? 'pt-[4px]'\n : 'border-b border-solid border-[var(--malachite-card-border)]'\n }\n >\n {children}\n </div>\n )}\n </div>\n </div>\n ) : (\n /* Instant open — no clip, so a sticky child inside pins immediately. */\n expanded &&\n children && (\n <div\n id={bodyId}\n className={\n sunken\n ? 'pt-[4px]'\n : 'border-b border-solid border-[var(--malachite-card-border)]'\n }\n >\n {children}\n </div>\n )\n )}\n </div>\n );\n};\n\nexport default Accordion;\nexport { Accordion };\nexport type { AccordionProps };\n"],"names":["Accordion","title","header","className","children","trailing","leading","arrowPosition","highlightExpanded","variant","defaultExpanded","isExpanded","onToggle","disabled","stickyHeader","stickyTopOffset","animate","sunken","bodyId","useId","internalExpanded","setInternalExpanded","useState","expanded","bodyRendered","bodySettled","setBodySettled","handleToggle","newExpanded","containerClasses","headerRowClasses","hasLeading","isRenderableNode","toggleButtonClasses","FOCUS_RING","FOCUS_RING_INSET","headerRowStyle","jsxs","jsx","event","DisclosureArrow"],"mappings":";;;;;AAwDA,MAAMA,IAAsC,CAAC;AAAA,EACzC,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,mBAAAC,IAAoB;AAAA,EACpB,SAAAC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,EAAE,kBAAkBK,IAAW,QAAQ,MAAA;AAAA,UAC9C,iBAAiB,CAACgB,MAAU;AACxB,YAAIA,EAAM,iBAAiB,wBACvBb,EAAeH,CAAQ;AAAA,UAE/B;AAAA,UAEA,UAAA,gBAAAe;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,WAAWb,KAAeF,IAAW,qBAAqB;AAAA,cAEzD,UAAAnB,KACG,gBAAAkC;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACG,WACIrB,IACM,aACA;AAAA,kBAGT,UAAAb;AAAA,gBAAA;AAAA,cAAA;AAAA,YACL;AAAA,UAAA;AAAA,QAER;AAAA,MAAA;AAAA;AAAA;AAAA,MAIJmB,KACAnB,KACI,gBAAAkC;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,IAAIpB;AAAA,UACJ,WACID,IACM,aACA;AAAA,UAGT,UAAAb;AAAA,QAAA;AAAA,MAAA;AAAA;AAAA,EACL,GAGZ;AAER;"}
@@ -1,74 +1,84 @@
1
- import { jsx as e, jsxs as s } from "react/jsx-runtime";
2
- import { useId as z } from "react";
3
- import F from "./CustomIcons/ArrowUpRightIcon.js";
4
- import $ from "./CustomIcons/InfoFilledIcon.js";
5
- import { FormItem as w } from "./FormItem.js";
6
- import { Link as O } from "./Link.js";
7
- import { safeHref as _ } from "./safeHref.js";
1
+ import { jsx as e, jsxs as a } from "react/jsx-runtime";
2
+ import { useId as k } from "react";
3
+ import w from "./CustomIcons/ArrowUpRightIcon.js";
4
+ import F from "./CustomIcons/InfoFilledIcon.js";
5
+ import { FormItem as $ } from "./FormItem.js";
6
+ import { Link as y } from "./Link.js";
8
7
  import x from "./Spacer.js";
9
- import k from "./Tooltip.js";
10
- import H from "./Typography/MarkdownBlock.js";
8
+ import O from "./Tooltip.js";
9
+ import _ from "./Typography/MarkdownBlock.js";
11
10
  import h from "./Typography/Text.js";
12
- import { FOCUS_RING as R } from "./focusRing.js";
13
- import { renderFormItemChildren as y, NO_FIELD_ERROR as L } from "./formItemState.js";
11
+ import { FOCUS_RING as u } from "./focusRing.js";
12
+ import { renderFormItemChildren as H, NO_FIELD_ERROR as R } from "./formItemState.js";
13
+ import { safeHref as L } from "./safeHref.js";
14
14
  const T = 0.5, q = ({
15
- id: t,
16
- label: r,
17
- description: i,
15
+ id: r,
16
+ label: t,
17
+ description: o,
18
18
  hint: l,
19
- helperText: a = !1
19
+ helperText: s = !1
20
20
  }) => {
21
- const o = `mal-${z().replace(/[^a-zA-Z0-9_-]/g, "")}-`, p = t ?? `${o}control`, f = r ? `${o}label` : void 0, n = i ? `${o}description` : void 0, m = l ? `${o}hint` : void 0, c = a ? `${o}helper` : void 0, d = [n, m, c].filter(Boolean).join(" ") || void 0;
21
+ const i = `mal-${k().replace(/[^a-zA-Z0-9_-]/g, "")}-`, p = r ?? `${i}control`, f = t ? `${i}label` : void 0, n = o ? `${i}description` : void 0, m = l ? `${i}hint` : void 0, c = s ? `${i}helper` : void 0, d = [n, m, c].filter(Boolean).join(" ") || void 0;
22
22
  return { controlId: p, labelId: f, descriptionId: n, hintId: m, helperTextId: c, describedBy: d };
23
23
  }, ee = ({
24
- label: t,
25
- hint: r,
26
- rightSideContent: i,
24
+ label: r,
25
+ hint: t,
26
+ rightSideContent: o,
27
27
  tooltip: l,
28
- name: a,
29
- description: o,
28
+ name: s,
29
+ description: i,
30
30
  required: p = !1,
31
31
  requiredIndicator: f = "optional-suffix",
32
32
  loading: n = !1,
33
33
  formControl: m,
34
34
  loadingComponent: c,
35
35
  children: d,
36
- controlId: u,
37
- labelId: v,
36
+ controlId: v,
37
+ labelId: b,
38
38
  descriptionId: I,
39
39
  hintId: N,
40
- fullWidth: b = !1
40
+ fullWidth: g = !1
41
41
  }) => {
42
- const g = m ? /* @__PURE__ */ e(w, { control: m, name: a, children: d }) : y(d, L);
43
- return /* @__PURE__ */ s(x, { direction: "vertical", size: 6, align: "stretch", fullWidth: b, children: [
44
- (t || r || o || i) && /* @__PURE__ */ s(x, { direction: "vertical", size: 4, align: "stretch", children: [
45
- /* @__PURE__ */ s("div", { className: "flex justify-between items-start", children: [
42
+ const z = m ? /* @__PURE__ */ e($, { control: m, name: s, children: d }) : H(d, R);
43
+ return /* @__PURE__ */ a(x, { direction: "vertical", size: 6, align: "stretch", fullWidth: g, children: [
44
+ (r || t || i || o) && /* @__PURE__ */ a(x, { direction: "vertical", size: 4, align: "stretch", children: [
45
+ /* @__PURE__ */ a("div", { className: "flex justify-between items-start", children: [
46
46
  /* @__PURE__ */ e(
47
47
  E,
48
48
  {
49
- text: t,
49
+ text: r,
50
50
  required: p,
51
51
  requiredIndicator: f,
52
52
  tooltip: l,
53
- id: v,
54
- htmlFor: n ? void 0 : u
53
+ id: b,
54
+ htmlFor: n ? void 0 : v
55
55
  }
56
56
  ),
57
- (r || i) && /* @__PURE__ */ s("div", { className: "flex items-start gap-2", children: [
58
- r && /* @__PURE__ */ e(B, { text: r, id: N }),
59
- i && /* @__PURE__ */ e(j, { ...i })
57
+ (t || o) && /* @__PURE__ */ a("div", { className: "flex items-start gap-2", children: [
58
+ t && /* @__PURE__ */ e(B, { text: t, id: N }),
59
+ o && /* @__PURE__ */ e(j, { ...o })
60
60
  ] })
61
61
  ] }),
62
- o && /* @__PURE__ */ e(D, { text: o, id: I })
62
+ i && /* @__PURE__ */ e(D, { text: i, id: I })
63
63
  ] }),
64
- n ? c : g
64
+ n ? c : z
65
65
  ] });
66
- }, j = (t) => {
67
- const r = _(t.href);
68
- return r ? /* @__PURE__ */ s(
69
- O,
66
+ }, j = (r) => {
67
+ if (r.type === "button")
68
+ return /* @__PURE__ */ e(
69
+ "button",
70
+ {
71
+ type: "button",
72
+ onClick: r.onClick,
73
+ className: `relative top-[3px] shrink-0 cursor-pointer whitespace-nowrap border-0 bg-transparent p-0 text-[length:var(--malachite-font-size-xsmall)] font-medium text-[var(--malachite-accent-foreground)] hover:underline ${u}`,
74
+ children: r.text
75
+ }
76
+ );
77
+ const t = L(r.href);
78
+ return t ? /* @__PURE__ */ a(
79
+ y,
70
80
  {
71
- href: r,
81
+ href: t,
72
82
  target: "_blank",
73
83
  rel: "noopener noreferrer",
74
84
  color: "dimmed",
@@ -76,22 +86,22 @@ const T = 0.5, q = ({
76
86
  underline: !1,
77
87
  className: "shrink-0 whitespace-nowrap inline-flex items-center gap-1 relative top-[3px]",
78
88
  children: [
79
- t.text,
80
- /* @__PURE__ */ e(F, { size: 13 })
89
+ r.text,
90
+ /* @__PURE__ */ e(w, { size: 13 })
81
91
  ]
82
92
  }
83
93
  ) : null;
84
- }, B = ({ text: t, id: r }) => /* @__PURE__ */ e("span", { id: r, children: /* @__PURE__ */ e(h, { size: "xsmall", color: "dimmed", className: "pr-2 relative top-[3px]", children: t }) }), D = ({ text: t, id: r }) => /* @__PURE__ */ e("div", { className: "pl-2 text-left", id: r, children: /* @__PURE__ */ e(H, { color: "dimmed", size: "small", text: t ?? "", omitMargin: !0 }) }), E = ({
85
- text: t,
86
- required: r,
87
- requiredIndicator: i,
94
+ }, B = ({ text: r, id: t }) => /* @__PURE__ */ e("span", { id: t, children: /* @__PURE__ */ e(h, { size: "xsmall", color: "dimmed", className: "pr-2 relative top-[3px]", children: r }) }), D = ({ text: r, id: t }) => /* @__PURE__ */ e("div", { className: "pl-2 text-left", id: t, children: /* @__PURE__ */ e(_, { color: "dimmed", size: "small", text: r ?? "", omitMargin: !0 }) }), E = ({
95
+ text: r,
96
+ required: t,
97
+ requiredIndicator: o,
88
98
  tooltip: l,
89
- id: a,
90
- htmlFor: o
91
- }) => t ? /* @__PURE__ */ s("div", { className: "flex items-center", children: [
92
- /* @__PURE__ */ e("label", { id: a, htmlFor: o, children: /* @__PURE__ */ e(h, { size: "xsmall", color: "primary", fontWeight: "semi-bold", className: "pl-2", children: t }) }),
93
- i === "optional-suffix" && !r && /* @__PURE__ */ e("span", { "aria-hidden": "true", children: /* @__PURE__ */ e(h, { size: "xsmall", color: "dimmed", className: "ml-1", children: "(Optional)" }) }),
94
- i === "asterisk" && r && /* @__PURE__ */ e(
99
+ id: s,
100
+ htmlFor: i
101
+ }) => r ? /* @__PURE__ */ a("div", { className: "flex items-center", children: [
102
+ /* @__PURE__ */ e("label", { id: s, htmlFor: i, children: /* @__PURE__ */ e(h, { size: "xsmall", color: "primary", fontWeight: "semi-bold", className: "pl-2", children: r }) }),
103
+ o === "optional-suffix" && !t && /* @__PURE__ */ e("span", { "aria-hidden": "true", children: /* @__PURE__ */ e(h, { size: "xsmall", color: "dimmed", className: "ml-1", children: "(Optional)" }) }),
104
+ o === "asterisk" && t && /* @__PURE__ */ e(
95
105
  "span",
96
106
  {
97
107
  "aria-hidden": "true",
@@ -99,13 +109,13 @@ const T = 0.5, q = ({
99
109
  children: "*"
100
110
  }
101
111
  ),
102
- l && /* @__PURE__ */ e(k, { text: l, placement: "right", delay: T, children: /* @__PURE__ */ e(
112
+ l && /* @__PURE__ */ e(O, { text: l, placement: "right", delay: T, children: /* @__PURE__ */ e(
103
113
  "button",
104
114
  {
105
115
  type: "button",
106
- "aria-label": `More information about ${t}`,
107
- className: `ml-1 -mt-[2px] inline-flex items-center text-[var(--malachite-text-dimmed)] cursor-help ${R}`,
108
- children: /* @__PURE__ */ e($, { size: 14 })
116
+ "aria-label": `More information about ${r}`,
117
+ className: `ml-1 -mt-[2px] inline-flex items-center text-[var(--malachite-text-dimmed)] cursor-help ${u}`,
118
+ children: /* @__PURE__ */ e(F, { size: 14 })
109
119
  }
110
120
  ) })
111
121
  ] }) : /* @__PURE__ */ e("div", {});
@@ -1 +1 @@
1
- {"version":3,"file":"BaseFormComponent.js","sources":["../../src/components/BaseFormComponent.tsx"],"sourcesContent":["import React, { useId } from 'react';\nimport type { Control, FieldPath, FieldValues } from 'react-hook-form';\nimport ArrowUpRightIcon from './CustomIcons/ArrowUpRightIcon';\nimport InfoFilledIcon from './CustomIcons/InfoFilledIcon';\nimport FormItem from './FormItem';\nimport Link from './Link';\nimport { safeHref } from './safeHref';\nimport Spacer from './Spacer';\nimport Tooltip from './Tooltip';\nimport MarkdownBlock from './Typography/MarkdownBlock';\nimport Text from './Typography/Text';\nimport { FOCUS_RING } from './focusRing';\nimport { type FormItemChildren, NO_FIELD_ERROR, renderFormItemChildren } from './formItemState';\n\n/** Tooltip's own default of 1s reads as broken; 0.5 matches the rest of the library. */\nconst TOOLTIP_DELAY_SECONDS = 0.5;\n\n/** The ids that wire a form field's label / description / hint to its control. */\nexport interface FormFieldIds {\n controlId: string;\n labelId?: string;\n descriptionId?: string;\n hintId?: string;\n helperTextId?: string;\n describedBy?: string;\n}\n\ninterface FormFieldIdOptions {\n /** A caller-supplied id always wins, so consumers can label the control themselves. */\n id?: string;\n label?: string;\n description?: string;\n hint?: string;\n helperText?: boolean;\n}\n\n/**\n * Generates the stable ids a form field needs to be announced correctly. Shared by\n * `Input`, `TextArea`, `Dropdown` and `MultiSelect` so all four wire up identically.\n */\nexport const useFormFieldIds = ({\n id,\n label,\n description,\n hint,\n helperText = false,\n}: FormFieldIdOptions): FormFieldIds => {\n // useId() emits \":r0:\", and a colon is invalid in a CSS id selector, so a consumer's\n // querySelector(`#${id}`) throws. Stripping only the delimiters keeps ids unique.\n const generatedId = `mal-${useId().replace(/[^a-zA-Z0-9_-]/g, '')}-`;\n const controlId = id ?? `${generatedId}control`;\n const labelId = label ? `${generatedId}label` : undefined;\n const descriptionId = description ? `${generatedId}description` : undefined;\n const hintId = hint ? `${generatedId}hint` : undefined;\n const helperTextId = helperText ? `${generatedId}helper` : undefined;\n const describedBy =\n [descriptionId, hintId, helperTextId].filter(Boolean).join(' ') || undefined;\n\n return { controlId, labelId, descriptionId, hintId, helperTextId, describedBy };\n};\n\ninterface BaseFormComponentProps {\n label?: string;\n description?: string;\n hint?: string;\n rightSideContent?: RightSideContent;\n tooltip?: string;\n required?: boolean;\n requiredIndicator?: RequiredIndicator;\n name: FieldPath<FieldValues>;\n defaultValue?: string;\n loading?: boolean;\n formControl?: Control<FieldValues, unknown>;\n loadingComponent: React.ReactNode;\n children?: FormItemChildren;\n /** Accessibility wiring, from `useFormFieldIds` — see `FormFieldIds`. */\n controlId?: string;\n labelId?: string;\n descriptionId?: string;\n hintId?: string;\n fullWidth?: boolean;\n}\n\nconst BaseFormComponent: React.FC<BaseFormComponentProps> = ({\n label,\n hint,\n rightSideContent,\n tooltip,\n name,\n description,\n required = false,\n requiredIndicator = 'optional-suffix',\n loading = false,\n formControl,\n loadingComponent,\n children,\n controlId,\n labelId,\n descriptionId,\n hintId,\n fullWidth = false,\n}) => {\n const finalComponent = formControl ? (\n <FormItem control={formControl} name={name}>\n {children}\n </FormItem>\n ) : (\n renderFormItemChildren(children, NO_FIELD_ERROR)\n );\n\n const topHeader = () => (\n <Spacer direction=\"vertical\" size={4} align=\"stretch\">\n <div className=\"flex justify-between items-start\">\n <Label\n text={label}\n required={required}\n requiredIndicator={requiredIndicator}\n tooltip={tooltip}\n id={labelId}\n // No control is rendered while loading, so an htmlFor would be an orphan.\n htmlFor={loading ? undefined : controlId}\n />\n {(hint || rightSideContent) && (\n <div className=\"flex items-start gap-2\">\n {hint && <Hint text={hint} id={hintId} />}\n {rightSideContent && <RightSide {...rightSideContent} />}\n </div>\n )}\n </div>\n {description && <Description text={description} id={descriptionId} />}\n </Spacer>\n );\n\n const showHeader = label || hint || description || rightSideContent;\n\n return (\n <Spacer direction=\"vertical\" size={6} align=\"stretch\" fullWidth={fullWidth}>\n {showHeader && topHeader()}\n {!loading ? finalComponent : loadingComponent}\n </Spacer>\n );\n};\n\n/**\n * What sits at the far end of a field's label row. Data rather than a node, so nothing\n * arbitrary reaches the row; discriminated so a further kind is additive. Plain text is\n * already `hint`.\n */\nexport type RightSideContent = {\n type?: 'link';\n text: string;\n href: string;\n};\n\nconst RightSide = (content: RightSideContent) => {\n const safe = safeHref(content.href);\n\n if (!safe) {\n return null;\n }\n\n return (\n <Link\n href={safe}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n color=\"dimmed\"\n size=\"xsmall\"\n underline={false}\n className=\"shrink-0 whitespace-nowrap inline-flex items-center gap-1 relative top-[3px]\"\n >\n {content.text}\n <ArrowUpRightIcon size={13} />\n </Link>\n );\n};\n\nconst Hint = ({ text, id }: { text?: string; id?: string }) => {\n return (\n <span id={id}>\n <Text size=\"xsmall\" color=\"dimmed\" className=\"pr-2 relative top-[3px]\">\n {text}\n </Text>\n </span>\n );\n};\n\nconst Description = ({ text, id }: { text?: string; id?: string }) => {\n return (\n <div className=\"pl-2 text-left\" id={id}>\n <MarkdownBlock color=\"dimmed\" size=\"small\" text={text ?? ''} omitMargin={true} />\n </div>\n );\n};\n\nexport type RequiredIndicator = 'optional-suffix' | 'asterisk' | 'none';\n\nconst Label = ({\n text,\n required,\n requiredIndicator,\n tooltip,\n id,\n htmlFor,\n}: {\n text?: string;\n required: boolean;\n requiredIndicator: RequiredIndicator;\n tooltip?: string;\n id?: string;\n htmlFor?: string;\n}) => {\n return text ? (\n <div className=\"flex items-center\">\n <label id={id} htmlFor={htmlFor}>\n <Text size=\"xsmall\" color=\"primary\" fontWeight=\"semi-bold\" className=\"pl-2\">\n {text}\n </Text>\n </label>\n {/* Sibling of the <label>, not a child: Testing Library's getByLabelText matches\n on textContent, so a marker inside it breaks getByLabelText('<label>'). */}\n {requiredIndicator === 'optional-suffix' && !required && (\n <span aria-hidden=\"true\">\n <Text size=\"xsmall\" color=\"dimmed\" className=\"ml-1\">\n (Optional)\n </Text>\n </span>\n )}\n {requiredIndicator === 'asterisk' && required && (\n <span\n aria-hidden=\"true\"\n className=\"ml-1 text-[var(--malachite-destructive-foreground,rgb(196,62,62))]\"\n >\n *\n </span>\n )}\n {tooltip && (\n <Tooltip text={tooltip} placement=\"right\" delay={TOOLTIP_DELAY_SECONDS}>\n <button\n type=\"button\"\n aria-label={`More information about ${text}`}\n className={`ml-1 -mt-[2px] inline-flex items-center text-[var(--malachite-text-dimmed)] cursor-help ${FOCUS_RING}`}\n >\n <InfoFilledIcon size={14} />\n </button>\n </Tooltip>\n )}\n </div>\n ) : (\n <div />\n );\n};\n\nexport default BaseFormComponent;\n"],"names":["TOOLTIP_DELAY_SECONDS","useFormFieldIds","id","label","description","hint","helperText","generatedId","useId","controlId","labelId","descriptionId","hintId","helperTextId","describedBy","BaseFormComponent","rightSideContent","tooltip","name","required","requiredIndicator","loading","formControl","loadingComponent","children","fullWidth","finalComponent","jsx","FormItem","renderFormItemChildren","NO_FIELD_ERROR","jsxs","Spacer","Label","Hint","RightSide","Description","content","safe","safeHref","Link","ArrowUpRightIcon","text","Text","MarkdownBlock","htmlFor","Tooltip","FOCUS_RING","InfoFilledIcon"],"mappings":";;;;;;;;;;;;;AAeA,MAAMA,IAAwB,KAyBjBC,IAAkB,CAAC;AAAA,EAC5B,IAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAAC;AAAA,EACA,YAAAC,IAAa;AACjB,MAAwC;AAGpC,QAAMC,IAAc,OAAOC,EAAA,EAAQ,QAAQ,mBAAmB,EAAE,CAAC,KAC3DC,IAAYP,KAAM,GAAGK,CAAW,WAChCG,IAAUP,IAAQ,GAAGI,CAAW,UAAU,QAC1CI,IAAgBP,IAAc,GAAGG,CAAW,gBAAgB,QAC5DK,IAASP,IAAO,GAAGE,CAAW,SAAS,QACvCM,IAAeP,IAAa,GAAGC,CAAW,WAAW,QACrDO,IACF,CAACH,GAAeC,GAAQC,CAAY,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,KAAK;AAEvE,SAAO,EAAE,WAAAJ,GAAW,SAAAC,GAAS,eAAAC,GAAe,QAAAC,GAAQ,cAAAC,GAAc,aAAAC,EAAA;AACtE,GAwBMC,KAAsD,CAAC;AAAA,EACzD,OAAAZ;AAAA,EACA,MAAAE;AAAA,EACA,kBAAAW;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,aAAAd;AAAA,EACA,UAAAe,IAAW;AAAA,EACX,mBAAAC,IAAoB;AAAA,EACpB,SAAAC,IAAU;AAAA,EACV,aAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,UAAAC;A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MACZ,WAAU;AAAA,MACb,UAAA;AAAA,IAAA;AAAA,EAAA;AAAA,EAIJV,uBACI6B,GAAA,EAAQ,MAAM7B,GAAS,WAAU,SAAQ,OAAOjB,GAC7C,UAAA,gBAAA2B;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,MAAK;AAAA,MACL,cAAY,0BAA0Be,CAAI;AAAA,MAC1C,WAAW,2FAA2FK,CAAU;AAAA,MAEhH,UAAA,gBAAApB,EAACqB,GAAA,EAAe,MAAM,GAAA,CAAI;AAAA,IAAA;AAAA,EAAA,EAC9B,CACJ;AAAA,EAAA,CAER,sBAEC,OAAA,EAAI;"}
1
+ {"version":3,"file":"BaseFormComponent.js","sources":["../../src/components/BaseFormComponent.tsx"],"sourcesContent":["import React, { useId } from 'react';\nimport type { Control, FieldPath, FieldValues } from 'react-hook-form';\nimport ArrowUpRightIcon from './CustomIcons/ArrowUpRightIcon';\nimport InfoFilledIcon from './CustomIcons/InfoFilledIcon';\nimport FormItem from './FormItem';\nimport Link from './Link';\nimport Spacer from './Spacer';\nimport Tooltip from './Tooltip';\nimport MarkdownBlock from './Typography/MarkdownBlock';\nimport Text from './Typography/Text';\nimport { FOCUS_RING } from './focusRing';\nimport { type FormItemChildren, NO_FIELD_ERROR, renderFormItemChildren } from './formItemState';\nimport { safeHref } from './safeHref';\n\n/** Tooltip's own default of 1s reads as broken; 0.5 matches the rest of the library. */\nconst TOOLTIP_DELAY_SECONDS = 0.5;\n\n/** The ids that wire a form field's label / description / hint to its control. */\nexport interface FormFieldIds {\n controlId: string;\n labelId?: string;\n descriptionId?: string;\n hintId?: string;\n helperTextId?: string;\n describedBy?: string;\n}\n\ninterface FormFieldIdOptions {\n /** A caller-supplied id always wins, so consumers can label the control themselves. */\n id?: string;\n label?: string;\n description?: string;\n hint?: string;\n helperText?: boolean;\n}\n\n/**\n * Generates the stable ids a form field needs to be announced correctly. Shared by\n * `Input`, `TextArea`, `Dropdown` and `MultiSelect` so all four wire up identically.\n */\nexport const useFormFieldIds = ({\n id,\n label,\n description,\n hint,\n helperText = false,\n}: FormFieldIdOptions): FormFieldIds => {\n // useId() emits \":r0:\", and a colon is invalid in a CSS id selector, so a consumer's\n // querySelector(`#${id}`) throws. Stripping only the delimiters keeps ids unique.\n const generatedId = `mal-${useId().replace(/[^a-zA-Z0-9_-]/g, '')}-`;\n const controlId = id ?? `${generatedId}control`;\n const labelId = label ? `${generatedId}label` : undefined;\n const descriptionId = description ? `${generatedId}description` : undefined;\n const hintId = hint ? `${generatedId}hint` : undefined;\n const helperTextId = helperText ? `${generatedId}helper` : undefined;\n const describedBy =\n [descriptionId, hintId, helperTextId].filter(Boolean).join(' ') || undefined;\n\n return { controlId, labelId, descriptionId, hintId, helperTextId, describedBy };\n};\n\ninterface BaseFormComponentProps {\n label?: string;\n description?: string;\n hint?: string;\n rightSideContent?: RightSideContent;\n tooltip?: string;\n required?: boolean;\n requiredIndicator?: RequiredIndicator;\n name: FieldPath<FieldValues>;\n defaultValue?: string;\n loading?: boolean;\n formControl?: Control<FieldValues, unknown>;\n loadingComponent: React.ReactNode;\n children?: FormItemChildren;\n /** Accessibility wiring, from `useFormFieldIds` — see `FormFieldIds`. */\n controlId?: string;\n labelId?: string;\n descriptionId?: string;\n hintId?: string;\n fullWidth?: boolean;\n}\n\nconst BaseFormComponent: React.FC<BaseFormComponentProps> = ({\n label,\n hint,\n rightSideContent,\n tooltip,\n name,\n description,\n required = false,\n requiredIndicator = 'optional-suffix',\n loading = false,\n formControl,\n loadingComponent,\n children,\n controlId,\n labelId,\n descriptionId,\n hintId,\n fullWidth = false,\n}) => {\n const finalComponent = formControl ? (\n <FormItem control={formControl} name={name}>\n {children}\n </FormItem>\n ) : (\n renderFormItemChildren(children, NO_FIELD_ERROR)\n );\n\n const topHeader = () => (\n <Spacer direction=\"vertical\" size={4} align=\"stretch\">\n <div className=\"flex justify-between items-start\">\n <Label\n text={label}\n required={required}\n requiredIndicator={requiredIndicator}\n tooltip={tooltip}\n id={labelId}\n // No control is rendered while loading, so an htmlFor would be an orphan.\n htmlFor={loading ? undefined : controlId}\n />\n {(hint || rightSideContent) && (\n <div className=\"flex items-start gap-2\">\n {hint && <Hint text={hint} id={hintId} />}\n {rightSideContent && <RightSide {...rightSideContent} />}\n </div>\n )}\n </div>\n {description && <Description text={description} id={descriptionId} />}\n </Spacer>\n );\n\n const showHeader = label || hint || description || rightSideContent;\n\n return (\n <Spacer direction=\"vertical\" size={6} align=\"stretch\" fullWidth={fullWidth}>\n {showHeader && topHeader()}\n {!loading ? finalComponent : loadingComponent}\n </Spacer>\n );\n};\n\n/**\n * What sits at the far end of a field's label row. Data rather than a node, so nothing\n * arbitrary reaches the row; discriminated so a further kind is additive. Plain text is\n * already `hint`.\n */\nexport type RightSideContent =\n | {\n type?: 'link';\n text: string;\n href: string;\n }\n | {\n /** An action on the form itself, such as showing a panel of help beside it. */\n type: 'button';\n text: string;\n onClick: () => void;\n };\n\nconst RightSide = (content: RightSideContent) => {\n if (content.type === 'button') {\n return (\n <button\n type=\"button\"\n onClick={content.onClick}\n className={`relative top-[3px] shrink-0 cursor-pointer whitespace-nowrap border-0 bg-transparent p-0 text-[length:var(--malachite-font-size-xsmall)] font-medium text-[var(--malachite-accent-foreground)] hover:underline ${FOCUS_RING}`}\n >\n {content.text}\n </button>\n );\n }\n\n const safe = safeHref(content.href);\n\n if (!safe) {\n return null;\n }\n\n return (\n <Link\n href={safe}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n color=\"dimmed\"\n size=\"xsmall\"\n underline={false}\n className=\"shrink-0 whitespace-nowrap inline-flex items-center gap-1 relative top-[3px]\"\n >\n {content.text}\n <ArrowUpRightIcon size={13} />\n </Link>\n );\n};\n\nconst Hint = ({ text, id }: { text?: string; id?: string }) => {\n return (\n <span id={id}>\n <Text size=\"xsmall\" color=\"dimmed\" className=\"pr-2 relative top-[3px]\">\n {text}\n </Text>\n </span>\n );\n};\n\nconst Description = ({ text, id }: { text?: string; id?: string }) => {\n return (\n <div className=\"pl-2 text-left\" id={id}>\n <MarkdownBlock color=\"dimmed\" size=\"small\" text={text ?? ''} omitMargin={true} />\n </div>\n );\n};\n\nexport type RequiredIndicator = 'optional-suffix' | 'asterisk' | 'none';\n\nconst Label = ({\n text,\n required,\n requiredIndicator,\n tooltip,\n id,\n htmlFor,\n}: {\n text?: string;\n required: boolean;\n requiredIndicator: RequiredIndicator;\n tooltip?: string;\n id?: string;\n htmlFor?: string;\n}) => {\n return text ? (\n <div className=\"flex items-center\">\n <label id={id} htmlFor={htmlFor}>\n <Text size=\"xsmall\" color=\"primary\" fontWeight=\"semi-bold\" className=\"pl-2\">\n {text}\n </Text>\n </label>\n {/* Sibling of the <label>, not a child: Testing Library's getByLabelText matches\n on textContent, so a marker inside it breaks getByLabelText('<label>'). */}\n {requiredIndicator === 'optional-suffix' && !required && (\n <span aria-hidden=\"true\">\n <Text size=\"xsmall\" color=\"dimmed\" className=\"ml-1\">\n (Optional)\n </Text>\n </span>\n )}\n {requiredIndicator === 'asterisk' && required && (\n <span\n aria-hidden=\"true\"\n className=\"ml-1 text-[var(--malachite-destructive-foreground,rgb(196,62,62))]\"\n >\n *\n </span>\n )}\n {tooltip && (\n <Tooltip text={tooltip} placement=\"right\" delay={TOOLTIP_DELAY_SECONDS}>\n <button\n type=\"button\"\n aria-label={`More information about ${text}`}\n className={`ml-1 -mt-[2px] inline-flex items-center text-[var(--malachite-text-dimmed)] cursor-help ${FOCUS_RING}`}\n >\n <InfoFilledIcon size={14} />\n </button>\n </Tooltip>\n )}\n </div>\n ) : (\n <div />\n );\n};\n\nexport default BaseFormComponent;\n"],"names":["TOOLTIP_DELAY_SECONDS","useFormFieldIds","id","label","description","hint","helperText","generatedId","useId","controlId","labelId","descriptionId","hintId","helperTextId","describedBy","BaseFormComponent","rightSideContent","tooltip","name","required","requiredIndicator","loading","formControl","loadingComponent","children","fullWidth","finalComponent","jsx","FormItem","renderFormItemChildren","NO_FIELD_ERROR","jsxs","Spacer","Label","Hint","RightSide","Description","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