@stackone/malachite 2.105.0 → 2.106.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
@@ -76,7 +76,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
76
76
  - **`DatePicker`** — Picks one day, or one instant with `precision="minute"` or `"second"`, from Figma's calendar in a popover. Day precision commits on click; a time precision adds hour/minute(/second) columns and holds a draft until Apply, which Escape or an outside click discards. `timeZone="utc"` draws the UTC calendar day and suffixes times with "UTC" whatever the browser's zone, as the logs pages need. Values are `Date`s; ISO strings are accepted (a string without an offset, such as `2025-01-20` or `2025-01-20T10:00`, is read in `timeZone`), and a `formControl` field seeded with a string is written back as an ISO string. `min`/`max` bound the instant (days and times outside are disabled, as are month arrows and keyboard paging that would leave them; a value clamped up to `min` rounds up to the precision, so on `min`'s own day a day-precision value is `min` itself) and `isDateDisabled` rules out single days. The grid is an ARIA grid with a roving tab stop: arrows move by day and week, PageUp/PageDown by month (Shift for a year), Home/End to the week's ends, Enter or Space picks; every day of a range is `aria-selected`, and a hidden live line asks for the end date once the start is picked. The trigger sits on the 28/32/42 control ladder with Dropdown's chrome; `clearable` adds a clear control reported as `onChange(null)`. Colours come from `text`, `accent` and `card`, so a rebrand repaints the picker; the derived states (hover, outside-month text, selected fill, today ring, range band, pressed opacity) can each be overridden through the `datePicker` theme group (`applyTheme({ colors: { datePicker: { selectedBackground } } })`). _Key props:_ `value`, `defaultValue`, `onChange`, `precision` (`day` | `minute` | `second`), `minuteStep`, `timeZone` (`local` | `utc`), `weekStartsOn`, `min`, `max`, `isDateDisabled`, `presets`, `clearable`, `tag` (`{ label, type }` status beside the value), `tone` (`default` | `chosen` | `pending`, paint only), `placeholder`, `size`, `fullWidth`, `width`, `label`, `description`, `hint`, `tooltip`, `helperText`, `required`, `requiredIndicator`, `formControl`, `error`, `disabled`, `loading`, `id`, `aria-label`, `aria-labelledby`.
77
77
  - **`DateRangePicker`** — `DatePicker`'s range form, with the same props and a `{ start, end }` value. The second click completes a day range; a click before the start restarts it. The end always covers the whole of its last unit (`23:59:59.999` for a picked day, the last millisecond of the picked minute or second), so a filter on the range keeps its final minutes. In a `formControl` field a cleared range writes `null`. With a time precision a Start/End switch picks which end the time columns edit, end times before the start are not offered, and Apply waits for both ends. `presets` list beside the calendar and apply at once; pass a function (`value: () => ({ start, end })`) for a relative preset such as "Past 1 hour", so it is measured when clicked rather than when the page loaded. _Key props:_ `value` / `defaultValue` (`{ start, end }`), `onChange`, `presets` (`DateRangePreset[]`), plus every `DatePicker` prop.
78
78
  - **`MultiSelect`** — Multi-select dropdown. `width` fixes the trigger, as `Dropdown` and `Search` take it, so a toolbar can put its controls on one width — and, as with those two, a container narrower than the value still wins; the menu fills the trigger and left-aligns under it, so that one prop sizes both; `minWidth` raises the 160px floor a narrow trigger falls back to. An option label too long for the menu ellipsises, and hovering it shows the full label — above the description in `hover` mode — as `Dropdown` does for its options. `requiredIndicator` follows the same three-way convention the single-select controls do, so a form choosing asterisks does not get "(Optional)" on one of its fields. _Key props:_ `MultiSelectOption[]`, `MultiSelectSize`, `width`, `minWidth`, `label`, `searchable`, `inlineSearch`, `chips`, `chipsRemovable`, `required`, `requiredIndicator`, `aria-label`, `aria-labelledby`, `id`.
79
- - **`FilterSearch`** — One search field that filters across several categories. Clicking lists the filters, each with its description and an example; picking one lists its values behind a `Filters > Name` breadcrumb, and typing before picking searches the values of every filter at once, tagging each match with the filter it belongs to. Select All / Deselect All act on whatever the query matches. Each filter becomes a segmented chip, its name then its values (`Connector | Notion, Attio +2`), that reopens its values when clicked; an item `icon` is drawn in its menu row and in the chip, and `chipLabel: false` on a filter drops its name from the chip (`Configured only`); Backspace in an empty field removes the last one. `onQueryChange` reports the text in the field, for analytics or a server-side search. With `textFilter` (`{ value, label }`, under a `value` no filter uses) the typed text is itself the first row while searching (`Search "acme"`); committing it adds a `Search: acme` chip whose selection is `{ filter: textFilter.value, items: [text] }`, replacing any earlier text, so a free-text search can sit in the URL beside the filters, and clicking that chip puts the text back in the field. Controlled: `onChange` gets the next selection and the `changes` that produced it, an empty `items` meaning the filter was removed, so a URL-backed selection writes back only what moved. Chips keep the order filters were added in even when `value` comes back reordered, and keep their labels while `filters` reloads. `filtersButton` puts a Filters button, with the applied count, at the right end of the bar that opens the filter list, right-aligned beneath it; clicking the field then leaves the list shut until something is typed, while the arrow keys and Enter open it as the button does. _Key props:_ `filters`, `value`, `onChange`, `onClear`, `onActiveFilterChange`, `onQueryChange`, `textFilter`, `filtersButton`, `placeholder`, `size`, `width`, `loading`, `disabled`, `clearable`, `maxVisibleChips`, `aria-label`, `aria-labelledby`, `id`.
79
+ - **`FilterSearch`** — One search field that filters across several categories. Clicking lists the filters, each with its description and an example; picking one lists its values behind a `Filters > Name` breadcrumb, and typing before picking searches the values of every filter at once, tagging each match with the filter it belongs to. Select All / Deselect All act on whatever the query matches. Each filter becomes a segmented chip, its name then its values (`Connector | Notion, Attio +2`), that reopens its values when clicked; an item `icon` is drawn in its menu row and in the chip, and `chipLabel: false` on a filter drops its name from the chip (`Configured only`); Backspace in an empty field removes the last one. `onQueryChange` reports the text in the field, for analytics or a server-side search. With `textFilter` (`{ value, label }`, under a `value` no filter uses) the typed text is itself the first row while searching (`Search "acme"`); committing it adds a `Search: acme` chip whose selection is `{ filter: textFilter.value, items: [text] }`, replacing any earlier text, so a free-text search can sit in the URL beside the filters, and clicking that chip puts the text back in the field. Controlled: `onChange` gets the next selection and the `changes` that produced it, an empty `items` meaning the filter was removed, so a URL-backed selection writes back only what moved. Chips keep the order filters were added in even when `value` comes back reordered, and keep their labels while `filters` reloads. `filtersButton` puts a Filters button, with the applied count, at the right end of the bar that opens a Filters panel beneath it: every filter at once, each drawn by its `control` (`list`, the default, a checkbox per value with an optional `count` badge and a search box past 8 values; `toggle`, a switch for the filter's one value; `segmented`, All plus one segment per value), applied as they change and mirrored as chips in the bar, with Clear all leaving the typed text alone. The button and the filter chips are then the only way to filters: the field is a plain search box (`role="searchbox"`) that never opens a menu, reports what is typed through `onQueryChange`, keeps it on blur and while the panel is open, and pins it as the `textFilter` chip on Enter. _Key props:_ `filters` (`control`, item `count`), `value`, `onChange`, `onClear`, `onActiveFilterChange`, `onQueryChange`, `textFilter`, `filtersButton`, `placeholder`, `size`, `width`, `loading`, `disabled`, `clearable`, `maxVisibleChips`, `aria-label`, `aria-labelledby`, `id`.
80
80
  - **`QueryInput`** — A textbox with inline syntax colouring and a suggestion menu anchored to the caret. It carries no grammar of its own: the consumer parses the value, hands back `tokens` to colour and `suggestions` to offer, so the vocabulary lives in the consuming app rather than here. _Key props:_ `value`, `onChange`, `tokens`, `suggestions`, `activeRange`, `onAccept`, `onQueryContextChange`, `onSubmit`, `placeholder`, `size`, `disabled`, `loading`, `emptyMessage`, `className`, `style`, `aria-label`, `aria-labelledby`.
81
81
  - **`SettingRow`** — One setting: a labelled row with its control on the trailing edge, and the sentence that explains it underneath. `control` may be a render prop receiving the label’s id, so a control that no `<label htmlFor>` can reach — `Toggle` renders a `<button role="switch">` — still names itself via `aria-labelledby`. _Key props:_ `label`, `badge`, `description`, `control`, `className`.
82
82
 
@@ -1,91 +1,92 @@
1
1
  import { jsxs as B, jsx as t } from "react/jsx-runtime";
2
- import fe, { useId as pe, useState as c, useEffect as X, useRef as g } from "react";
3
- import be from "./CollapseFocusHandOff.js";
2
+ import pe, { useId as be, useState as c, useEffect as V, useRef as h } from "react";
3
+ import ge from "./CollapseFocusHandOff.js";
4
4
  import { DisclosureArrow as I } from "./DisclosureArrow.js";
5
5
  import he from "./PinnedCornerCap.js";
6
- import { ARROW_PX as L, toggleGapPx as ge, togglePaddingLeftPx as ve, bodyInsetPx as xe } from "./accordionBodyInset.js";
7
- import { FOCUS_RING as we, FOCUS_RING_INSET as Ne } from "./focusRing.js";
8
- import { FRAME_BACKGROUND as Re, FRAME_CLASS as ke } from "./frameStyles.js";
6
+ import { ARROW_PX as L, toggleGapPx as ve, togglePaddingLeftPx as xe, bodyInsetPx as we } from "./accordionBodyInset.js";
7
+ import { ROW_HOVER_COLOR as X } from "./chromeStyles.js";
8
+ import { FOCUS_RING as Ne, FOCUS_RING_INSET as Re } from "./focusRing.js";
9
+ import { FRAME_BACKGROUND as _e, FRAME_CLASS as Ce } from "./frameStyles.js";
9
10
  import { inertWhen as ye } from "./inert.js";
10
11
  import { isRenderableNode as Y } from "./renderableNode.js";
11
- import { usePinned as Ce } from "./usePinned.js";
12
- const _e = "--malachite-ctx-pinned-surround", Se = 300, J = 1600, Ae = { position: "absolute", width: 0, height: 0 }, Be = ({
13
- title: Q,
14
- header: V,
12
+ import { usePinned as ke } from "./usePinned.js";
13
+ const Se = "--malachite-ctx-pinned-surround", Ae = 300, H = 1600, Be = { position: "absolute", width: 0, height: 0 }, Ie = ({
14
+ title: J,
15
+ header: Q,
15
16
  className: Z,
16
17
  children: i,
17
- trailing: F,
18
- leading: $,
18
+ trailing: $,
19
+ leading: E,
19
20
  arrowPosition: u = "start",
20
21
  highlightExpanded: v = !0,
21
- bodyIndent: H = "none",
22
- variant: ee = "default",
23
- defaultExpanded: te = !1,
22
+ bodyIndent: ee = "none",
23
+ variant: te = "default",
24
+ defaultExpanded: re = !1,
24
25
  isExpanded: x,
25
26
  onToggle: w,
26
27
  disabled: N = !1,
27
28
  stickyHeader: d = !1,
28
29
  stickyTopOffset: m = 0,
29
- pinnedCorners: re = !1,
30
+ pinnedCorners: oe = !1,
30
31
  animate: l = !0,
31
32
  collapsible: n = !0,
32
33
  flashKey: f
33
- }, oe) => {
34
- const R = N || !n, r = ee === "sunken", k = `${pe()}-body`, [j, E] = c(te), [ne, ae] = c(f), [p, se] = c(0), [P, D] = c(!1);
35
- Object.is(f, ne) || (ae(f), f !== void 0 && (se(p + 1), D(!0))), X(() => {
34
+ }, ne) => {
35
+ const R = N || !n, r = te === "sunken", _ = `${be()}-body`, [F, j] = c(re), [ae, se] = c(f), [p, ie] = c(0), [O, P] = c(!1);
36
+ Object.is(f, ae) || (se(f), f !== void 0 && (ie(p + 1), P(!0))), V(() => {
36
37
  if (p === 0)
37
38
  return;
38
- const o = window.setTimeout(() => D(!1), J);
39
+ const o = window.setTimeout(() => P(!1), H);
39
40
  return () => window.clearTimeout(o);
40
- }, [p]), !n && !j && E(!0);
41
- const e = !n || (x !== void 0 ? x : j), y = n && u === "gutter", ie = l || e && !!i, [s, b] = c(!n), M = g(e);
42
- !e && s ? b(!1) : e && !l && !s && b(!0), X(() => {
41
+ }, [p]), !n && !F && j(!0);
42
+ const e = !n || (x !== void 0 ? x : F), C = n && u === "gutter", de = l || e && !!i, [s, b] = c(!n), D = h(e);
43
+ !e && s ? b(!1) : e && !l && !s && b(!0), V(() => {
43
44
  if (!e) {
44
- M.current = !1;
45
+ D.current = !1;
45
46
  return;
46
47
  }
47
- if (!l || s || M.current && n)
48
+ if (!l || s || D.current && n)
48
49
  return;
49
- const o = window.setTimeout(() => b(!0), Se);
50
+ const o = window.setTimeout(() => b(!0), Ae);
50
51
  return () => window.clearTimeout(o);
51
52
  }, [l, e, n, s]);
52
- const C = g(null), z = g(null), T = g(null), G = !!d && re && !r, _ = Ce(T, m, G), S = Y($), a = H === "title", h = a ? "grid grid-cols-subgrid col-span-4" : "", O = () => {
53
+ const y = h(null), M = h(null), z = h(null), T = !!d && oe && !r, k = ke(z, m, T), S = Y(E), a = ee === "title", g = a ? "grid grid-cols-subgrid col-span-4" : "", G = () => {
53
54
  const o = !e;
54
- x === void 0 && E(o), w == null || w(o);
55
- }, de = [
55
+ x === void 0 && j(o), w == null || w(o);
56
+ }, le = [
56
57
  a ? "grid grid-cols-[auto_auto_minmax(0,1fr)_auto]" : "flex flex-col",
57
58
  "w-full text-left",
58
59
  // The table's frame, so a sunken section reads as the same kind of container as a table
59
60
  // beside it, in both themes.
60
- r ? ke : "",
61
- P ? "relative" : "",
61
+ r ? Ce : "",
62
+ O ? "relative" : "",
62
63
  Z
63
- ].filter(Boolean).join(" "), le = [
64
+ ].filter(Boolean).join(" "), ce = [
64
65
  // `group` only when enabled, so the arrow doesn't darken on hover while disabled.
65
66
  R ? "" : "group",
66
- a ? h : "flex w-full",
67
+ a ? g : "flex w-full",
67
68
  "items-center transition-colors",
68
69
  r ? "" : "border-0 border-b border-solid border-[var(--malachite-card-border)]",
69
- d ? `sticky ${_ ? "z-10" : "z-[8]"}` : "",
70
- r ? "bg-transparent" : d ? e && v || R ? "" : "hover:bg-[image:linear-gradient(var(--malachite-buttonlist-hover-background),var(--malachite-buttonlist-hover-background))]" : e && v ? "bg-[var(--malachite-buttonlist-hover-background)]" : R ? "bg-transparent" : "bg-transparent hover:bg-[var(--malachite-buttonlist-hover-background)]"
70
+ d ? `sticky ${k ? "z-10" : "z-[8]"}` : "",
71
+ r ? "bg-transparent" : d ? e && v || R ? "" : "hover:bg-[image:linear-gradient(var(--malachite-buttonlist-hover-background,rgb(245,245,245)),var(--malachite-buttonlist-hover-background,rgb(245,245,245)))]" : e && v ? "bg-[var(--malachite-buttonlist-hover-background,rgb(245,245,245))]" : R ? "bg-transparent" : "bg-transparent hover:bg-[var(--malachite-buttonlist-hover-background,rgb(245,245,245))]"
71
72
  ].filter(Boolean).join(" "), U = [
72
73
  "flex flex-1 items-center min-w-0 text-left",
73
74
  r ? "pr-[16px] py-[12px]" : "pr-[16px] py-[16px]",
74
75
  a ? "col-start-3" : ""
75
- ].filter(Boolean).join(" "), ce = [
76
+ ].filter(Boolean).join(" "), ue = [
76
77
  U,
77
78
  "appearance-none border-0 bg-transparent cursor-pointer select-none disabled:cursor-not-allowed",
78
- r ? `rounded-lg ${we}` : Ne
79
- ].join(" "), K = {
80
- paddingLeft: ve(S || y),
81
- gap: ge(r)
82
- }, W = V ?? /* @__PURE__ */ t("span", { className: "flex-1 min-w-0 truncate font-medium text-[13px] tracking-[0.13px] text-[var(--malachite-text-primary)]", children: Q }), ue = !r && e && v, me = d ? {
79
+ r ? `rounded-lg ${Ne}` : Re
80
+ ].join(" "), W = {
81
+ paddingLeft: xe(S || C),
82
+ gap: ve(r)
83
+ }, K = Q ?? /* @__PURE__ */ t("span", { className: "flex-1 min-w-0 truncate font-medium text-[13px] tracking-[0.13px] text-[var(--malachite-text-primary)]", children: J }), me = !r && e && v, fe = d ? {
83
84
  top: `${m}px`,
84
- backgroundColor: r ? Re : "var(--malachite-card-background)",
85
- ...ue && {
86
- backgroundImage: "linear-gradient(var(--malachite-buttonlist-hover-background), var(--malachite-buttonlist-hover-background))"
85
+ backgroundColor: r ? _e : "var(--malachite-card-background)",
86
+ ...me && {
87
+ backgroundImage: `linear-gradient(${X}, ${X})`
87
88
  }
88
- } : {}, A = xe({
89
+ } : {}, A = we({
89
90
  arrowPosition: n ? u : "end",
90
91
  hasLeading: S,
91
92
  sunken: r
@@ -100,38 +101,38 @@ const _e = "--malachite-ctx-pinned-surround", Se = 300, J = 1600, Ae = { positio
100
101
  return /* @__PURE__ */ B(
101
102
  "div",
102
103
  {
103
- ref: oe,
104
- className: de,
104
+ ref: ne,
105
+ className: le,
105
106
  style: d && m ? { scrollMarginTop: m } : void 0,
106
107
  children: [
107
- P && /* @__PURE__ */ t(
108
+ O && /* @__PURE__ */ t(
108
109
  "span",
109
110
  {
110
111
  "aria-hidden": "true",
111
112
  className: "pointer-events-none absolute inset-0 z-[11] rounded-[inherit] [outline-offset:-2px] [animation:malachite-section-flash_ease-out] motion-reduce:[animation-name:malachite-section-flash-still]",
112
- style: { animationDuration: `${J}ms` },
113
+ style: { animationDuration: `${H}ms` },
113
114
  "data-accordion-flash": ""
114
115
  },
115
116
  p
116
117
  ),
117
- G && /* @__PURE__ */ t("div", { ref: T, "aria-hidden": "true", style: Ae }),
118
+ T && /* @__PURE__ */ t("div", { ref: z, "aria-hidden": "true", style: Be }),
118
119
  /* @__PURE__ */ B(
119
120
  "div",
120
121
  {
121
- className: le,
122
- style: me,
122
+ className: ce,
123
+ style: fe,
123
124
  "data-accordion-header": "",
124
- "data-pinned": _ ? "" : void 0,
125
+ "data-pinned": k ? "" : void 0,
125
126
  children: [
126
- _ && /* @__PURE__ */ t(
127
+ k && /* @__PURE__ */ t(
127
128
  he,
128
129
  {
129
130
  bordered: !0,
130
131
  radius: "var(--malachite-radius-xxl, 14px)",
131
- surround: `var(${_e}, var(--malachite-card-sunken-background))`
132
+ surround: `var(${Se}, var(--malachite-card-sunken-background))`
132
133
  }
133
134
  ),
134
- y && /* @__PURE__ */ t(
135
+ C && /* @__PURE__ */ t(
135
136
  "button",
136
137
  {
137
138
  type: "button",
@@ -139,7 +140,7 @@ const _e = "--malachite-ctx-pinned-surround", Se = 300, J = 1600, Ae = { positio
139
140
  "aria-hidden": "true",
140
141
  className: `${a ? "col-start-1" : ""} shrink-0 self-stretch flex items-center pl-[16px] appearance-none border-0 bg-transparent cursor-pointer disabled:cursor-not-allowed`,
141
142
  onMouseDown: (o) => o.preventDefault(),
142
- onClick: O,
143
+ onClick: G,
143
144
  disabled: N,
144
145
  children: /* @__PURE__ */ t(I, { expanded: e, size: L })
145
146
  }
@@ -147,24 +148,24 @@ const _e = "--malachite-ctx-pinned-surround", Se = 300, J = 1600, Ae = { positio
147
148
  S && /* @__PURE__ */ t(
148
149
  "div",
149
150
  {
150
- className: `${a ? "col-start-2" : ""} shrink-0 flex items-center ${y ? "pl-[12px]" : "pl-[16px]"}`,
151
- children: $
151
+ className: `${a ? "col-start-2" : ""} shrink-0 flex items-center ${C ? "pl-[12px]" : "pl-[16px]"}`,
152
+ children: E
152
153
  }
153
154
  ),
154
155
  n ? /* @__PURE__ */ B(
155
156
  "button",
156
157
  {
157
- ref: z,
158
+ ref: M,
158
159
  type: "button",
159
- className: ce,
160
- style: K,
161
- onClick: O,
160
+ className: ue,
161
+ style: W,
162
+ onClick: G,
162
163
  "aria-expanded": e,
163
- "aria-controls": ie ? k : void 0,
164
+ "aria-controls": de ? _ : void 0,
164
165
  disabled: N,
165
166
  children: [
166
167
  u === "start" && /* @__PURE__ */ t(I, { expanded: e, size: L }),
167
- W,
168
+ K,
168
169
  u === "end" && /* @__PURE__ */ t(
169
170
  I,
170
171
  {
@@ -175,12 +176,12 @@ const _e = "--malachite-ctx-pinned-surround", Se = 300, J = 1600, Ae = { positio
175
176
  )
176
177
  ]
177
178
  }
178
- ) : /* @__PURE__ */ t("div", { className: U, style: K, children: W }),
179
- Y(F) && /* @__PURE__ */ t(
179
+ ) : /* @__PURE__ */ t("div", { className: U, style: W, children: K }),
180
+ Y($) && /* @__PURE__ */ t(
180
181
  "div",
181
182
  {
182
183
  className: `${a ? "col-start-4" : ""} shrink-0 flex items-center pr-[16px] text-[var(--malachite-text-secondary)]`,
183
- children: F
184
+ children: $
184
185
  }
185
186
  )
186
187
  ]
@@ -195,9 +196,9 @@ const _e = "--malachite-ctx-pinned-surround", Se = 300, J = 1600, Ae = { positio
195
196
  /* @__PURE__ */ t(
196
197
  "div",
197
198
  {
198
- ref: C,
199
+ ref: y,
199
200
  ...ye(!e),
200
- id: k,
201
+ id: _,
201
202
  className: `grid ${a ? "grid-cols-subgrid col-span-4" : "grid-cols-[minmax(0,1fr)]"} w-full transition-[grid-template-rows] duration-200 ease-in-out`,
202
203
  style: { gridTemplateRows: e ? "1fr" : "0fr" },
203
204
  onTransitionEnd: (o) => {
@@ -206,13 +207,13 @@ const _e = "--malachite-ctx-pinned-surround", Se = 300, J = 1600, Ae = { positio
206
207
  children: /* @__PURE__ */ t(
207
208
  "div",
208
209
  {
209
- className: [h, s ? "overflow-visible" : "overflow-hidden"].filter(Boolean).join(" "),
210
+ className: [g, s ? "overflow-visible" : "overflow-hidden"].filter(Boolean).join(" "),
210
211
  "data-settled": s ? "" : void 0,
211
212
  children: i && /* @__PURE__ */ t(
212
213
  "div",
213
214
  {
214
215
  className: [
215
- h,
216
+ g,
216
217
  r ? "pt-[4px]" : "border-b border-solid border-[var(--malachite-card-border)]"
217
218
  ].filter(Boolean).join(" "),
218
219
  children: q
@@ -227,24 +228,24 @@ const _e = "--malachite-ctx-pinned-surround", Se = 300, J = 1600, Ae = { positio
227
228
  e && i && /* @__PURE__ */ t(
228
229
  "div",
229
230
  {
230
- ref: C,
231
- id: k,
231
+ ref: y,
232
+ id: _,
232
233
  className: [
233
- h,
234
+ g,
234
235
  r ? "pt-[4px]" : "border-b border-solid border-[var(--malachite-card-border)]"
235
236
  ].filter(Boolean).join(" "),
236
237
  children: q
237
238
  }
238
239
  )
239
240
  ),
240
- /* @__PURE__ */ t(be, { expanded: e, bodyRef: C, toggleRef: z })
241
+ /* @__PURE__ */ t(ge, { expanded: e, bodyRef: y, toggleRef: M })
241
242
  ]
242
243
  }
243
244
  );
244
- }, Ie = fe.forwardRef(Be);
245
- Ie.displayName = "Accordion";
245
+ }, Le = pe.forwardRef(Ie);
246
+ Le.displayName = "Accordion";
246
247
  export {
247
- Ie as Accordion,
248
- Ie as default
248
+ Le as Accordion,
249
+ Le as default
249
250
  };
250
251
  //# sourceMappingURL=Accordion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Accordion.js","sources":["../../src/components/Accordion.tsx"],"sourcesContent":["import React, { useEffect, useId, useRef, useState } from 'react';\nimport CollapseFocusHandOff from './CollapseFocusHandOff';\nimport DisclosureArrow from './DisclosureArrow';\nimport PinnedCornerCap from './PinnedCornerCap';\nimport { ARROW_PX, bodyInsetPx, toggleGapPx, togglePaddingLeftPx } from './accordionBodyInset';\nimport { FOCUS_RING, FOCUS_RING_INSET } from './focusRing';\nimport { FRAME_BACKGROUND, FRAME_CLASS } from './frameStyles';\nimport { inertWhen } from './inert';\nimport { isRenderableNode } from './renderableNode';\nimport { usePinned } from './usePinned';\n\n/** The ground behind a pinned header's card, painted into its corners. A context channel, not a\n * theme token: no palette value, not settable through `applyTheme`, absent from\n * `getCurrentTheme`. Set it on an ancestor when the card does not sit on the page ground. */\nconst PINNED_SURROUND_CHANNEL = '--malachite-ctx-pinned-surround';\n\nconst SETTLE_FALLBACK_MS = 300;\nconst FLASH_MS = 1600;\n\n// Out of flow with no insets: it rests at the section's top without a cell or a caller's gap.\nconst PIN_MARKER_STYLE: React.CSSProperties = { position: 'absolute', width: 0, height: 0 };\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 (a rounded container in the table's frame\n * colour, no dividers/hover) — used for stacked detail sections in side panels and\n * detail 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 /** `false` keeps an open row on the card ground. */\n highlightExpanded?: boolean;\n /** `title` starts the body under the title, 16px short of it for a compact `Surface.Row`. */\n bodyIndent?: 'none' | 'title';\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 * With `stickyHeader`, rounds the header into its card's top corners once it pins,\n * in a flat, default-tone `<Surface overflow=\"clip\" shadow={false}>`. Set\n * `--malachite-ctx-pinned-surround` on an ancestor when the card sits on another ground.\n */\n pinnedCorners?: boolean;\n /** Change it after mount to flash an outline around the section. */\n flashKey?: React.Key;\n}\n\ninterface AccordionToggleProps {\n /** `false` is a section that never closes; the toggle props except `animate` are then ignored. */\n collapsible?: boolean;\n /** `gutter` puts the arrow before `leading` as its own mouse toggle; the title stays the keyboard one. */\n arrowPosition?: 'start' | 'end' | 'gutter';\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 * 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 AccordionToggleProps &\n ({ title: string; header?: React.ReactNode } | { title?: string; header: React.ReactNode });\n\nconst AccordionSection = (\n {\n title,\n header,\n className,\n children,\n trailing,\n leading,\n arrowPosition = 'start',\n highlightExpanded = true,\n bodyIndent = 'none',\n variant = 'default',\n defaultExpanded = false,\n isExpanded,\n onToggle,\n disabled = false,\n stickyHeader = false,\n stickyTopOffset = 0,\n pinnedCorners = false,\n animate = true,\n collapsible = true,\n flashKey,\n }: AccordionProps,\n ref: React.ForwardedRef<HTMLDivElement>,\n) => {\n const quiet = disabled || !collapsible;\n const sunken = variant === 'sunken';\n const instanceId = useId();\n const bodyId = `${instanceId}-body`;\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);\n const [prevFlashKey, setPrevFlashKey] = useState(flashKey);\n const [flashRun, setFlashRun] = useState(0);\n const [flashing, setFlashing] = useState(false);\n if (!Object.is(flashKey, prevFlashKey)) {\n setPrevFlashKey(flashKey);\n if (flashKey !== undefined) {\n setFlashRun(flashRun + 1);\n setFlashing(true);\n }\n }\n useEffect(() => {\n if (flashRun === 0) {\n return;\n }\n const end = window.setTimeout(() => setFlashing(false), FLASH_MS);\n return () => window.clearTimeout(end);\n }, [flashRun]);\n if (!collapsible && !internalExpanded) {\n setInternalExpanded(true);\n }\n\n // Use controlled state if isExpanded is provided, otherwise use internal state\n const expanded = !collapsible || (isExpanded !== undefined ? isExpanded : internalExpanded);\n const gutter = collapsible && arrowPosition === 'gutter';\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 const [bodySettled, setBodySettled] = useState(!collapsible);\n const mountedOpen = useRef(expanded);\n if (!expanded && bodySettled) {\n setBodySettled(false);\n } else if (expanded && !animate && !bodySettled) {\n setBodySettled(true);\n }\n useEffect(() => {\n if (!expanded) {\n mountedOpen.current = false;\n return undefined;\n }\n if (!animate || bodySettled || (mountedOpen.current && collapsible)) {\n return undefined;\n }\n // Not `transitioncancel`: reversing a running transition fires it while the new one runs.\n const fallback = window.setTimeout(() => setBodySettled(true), SETTLE_FALLBACK_MS);\n return () => window.clearTimeout(fallback);\n }, [animate, expanded, collapsible, bodySettled]);\n // A collapsed animated body is only a zero-height row, so it renders `inert` (below); an\n // instant one unmounts. Either way focus inside it is handed out (`CollapseFocusHandOff`).\n const bodyRef = useRef<HTMLDivElement>(null);\n const toggleRef = useRef<HTMLButtonElement>(null);\n const markerRef = useRef<HTMLDivElement>(null);\n const capsCorners = Boolean(stickyHeader) && pinnedCorners && !sunken;\n const pinned = usePinned(markerRef, stickyTopOffset, capsCorners);\n const hasLeading = isRenderableNode(leading);\n\n // One header column per slot, so the body can start at the toggle's.\n const titleGrid = bodyIndent === 'title';\n const subgrid = titleGrid ? 'grid grid-cols-subgrid col-span-4' : '';\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 titleGrid ? 'grid grid-cols-[auto_auto_minmax(0,1fr)_auto]' : 'flex flex-col',\n 'w-full text-left',\n // The table's frame, so a sunken section reads as the same kind of container as a table\n // beside it, in both themes.\n sunken ? FRAME_CLASS : '',\n flashing ? 'relative' : '',\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 // A pinned header's hover paints over its inline ground (headerRowStyle), which beats a\n // bg-colour class. Written out in full so Tailwind's scanner generates it.\n const pinnedBackground =\n (expanded && highlightExpanded) || quiet\n ? ''\n : 'hover:bg-[image:linear-gradient(var(--malachite-buttonlist-hover-background),var(--malachite-buttonlist-hover-background))]';\n const rowBackground = sunken\n ? 'bg-transparent'\n : stickyHeader\n ? pinnedBackground\n : expanded && highlightExpanded\n ? 'bg-[var(--malachite-buttonlist-hover-background)]'\n : quiet\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 quiet ? '' : 'group',\n titleGrid ? subgrid : 'flex w-full',\n 'items-center transition-colors',\n sunken ? '' : 'border-0 border-b border-solid border-[var(--malachite-card-border)]',\n stickyHeader ? `sticky ${pinned ? 'z-10' : 'z-[8]'}` : '',\n rowBackground,\n ]\n .filter(Boolean)\n .join(' ');\n const titleAreaClasses = [\n 'flex flex-1 items-center min-w-0 text-left',\n sunken ? 'pr-[16px] py-[12px]' : 'pr-[16px] py-[16px]',\n titleGrid ? 'col-start-3' : '',\n ]\n .filter(Boolean)\n .join(' ');\n // Full-bleed default rows use an inset ring; the padded sunken toggle fits an outset one.\n const toggleButtonClasses = [\n titleAreaClasses,\n 'appearance-none border-0 bg-transparent cursor-pointer select-none disabled:cursor-not-allowed',\n sunken ? `rounded-lg ${FOCUS_RING}` : FOCUS_RING_INSET,\n ].join(' ');\n const titleAreaStyle: React.CSSProperties = {\n paddingLeft: togglePaddingLeftPx(hasLeading || gutter),\n gap: toggleGapPx(sunken),\n };\n const titleContent = 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\n // Inline so the offset, the opaque ground and the open highlight apply even where arbitrary\n // classes are not compiled. The ground is the variant's own: a sunken section pinned in card\n // white would float over its frame.\n const highlighted = !sunken && expanded && highlightExpanded;\n const headerRowStyle: React.CSSProperties = stickyHeader\n ? {\n top: `${stickyTopOffset}px`,\n backgroundColor: sunken ? FRAME_BACKGROUND : 'var(--malachite-card-background)',\n ...(highlighted && {\n backgroundImage:\n 'linear-gradient(var(--malachite-buttonlist-hover-background), var(--malachite-buttonlist-hover-background))',\n }),\n }\n : {};\n\n const titleInset = bodyInsetPx({\n arrowPosition: collapsible ? arrowPosition : 'end',\n hasLeading,\n sunken,\n });\n const bodyChildren = titleGrid ? (\n <div\n className=\"col-start-3 col-span-2 min-w-0\"\n style={titleInset < 0 ? { marginLeft: titleInset } : { paddingLeft: titleInset }}\n >\n {children}\n </div>\n ) : (\n children\n );\n\n return (\n <div\n ref={ref}\n className={containerClasses}\n style={\n stickyHeader && stickyTopOffset ? { scrollMarginTop: stickyTopOffset } : undefined\n }\n >\n {flashing && (\n <span\n key={flashRun}\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-0 z-[11] rounded-[inherit] [outline-offset:-2px] [animation:malachite-section-flash_ease-out] motion-reduce:[animation-name:malachite-section-flash-still]\"\n style={{ animationDuration: `${FLASH_MS}ms` }}\n data-accordion-flash=\"\"\n />\n )}\n {capsCorners && <div ref={markerRef} aria-hidden=\"true\" style={PIN_MARKER_STYLE} />}\n <div\n className={headerRowClasses}\n style={headerRowStyle}\n data-accordion-header=\"\"\n data-pinned={pinned ? '' : undefined}\n >\n {pinned && (\n <PinnedCornerCap\n bordered\n radius=\"var(--malachite-radius-xxl, 14px)\"\n surround={`var(${PINNED_SURROUND_CHANNEL}, var(--malachite-card-sunken-background))`}\n />\n )}\n {gutter && (\n <button\n type=\"button\"\n tabIndex={-1}\n aria-hidden=\"true\"\n className={`${titleGrid ? 'col-start-1' : ''} 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} size={ARROW_PX} />\n </button>\n )}\n {hasLeading && (\n <div\n className={`${titleGrid ? 'col-start-2' : ''} shrink-0 flex items-center ${gutter ? 'pl-[12px]' : 'pl-[16px]'}`}\n >\n {leading}\n </div>\n )}\n {/* Toggle area — arrow + header/title. Interactive trailing sits outside it. */}\n {collapsible ? (\n <button\n ref={toggleRef}\n type=\"button\"\n className={toggleButtonClasses}\n style={titleAreaStyle}\n onClick={handleToggle}\n aria-expanded={expanded}\n aria-controls={bodyRendered ? bodyId : undefined}\n disabled={disabled}\n >\n {arrowPosition === 'start' && (\n <DisclosureArrow expanded={expanded} size={ARROW_PX} />\n )}\n {titleContent}\n {arrowPosition === 'end' && (\n <DisclosureArrow\n expanded={expanded}\n size={ARROW_PX}\n className=\"ml-auto\"\n />\n )}\n </button>\n ) : (\n <div className={titleAreaClasses} style={titleAreaStyle}>\n {titleContent}\n </div>\n )}\n {isRenderableNode(trailing) && (\n <div\n className={`${titleGrid ? 'col-start-4' : ''} shrink-0 flex items-center pr-[16px] text-[var(--malachite-text-secondary)]`}\n >\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 the title grid's body cell uses min-w-0 instead. */\n <div\n ref={bodyRef}\n {...inertWhen(!expanded)}\n id={bodyId}\n className={`grid ${titleGrid ? 'grid-cols-subgrid col-span-4' : '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 (\n event.target === event.currentTarget &&\n event.propertyName === 'grid-template-rows'\n ) {\n setBodySettled(expanded);\n }\n }}\n >\n <div\n className={[subgrid, bodySettled ? 'overflow-visible' : 'overflow-hidden']\n .filter(Boolean)\n .join(' ')}\n data-settled={bodySettled ? '' : undefined}\n >\n {children && (\n <div\n className={[\n subgrid,\n sunken\n ? 'pt-[4px]'\n : 'border-b border-solid border-[var(--malachite-card-border)]',\n ]\n .filter(Boolean)\n .join(' ')}\n >\n {bodyChildren}\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 ref={bodyRef}\n id={bodyId}\n className={[\n subgrid,\n sunken\n ? 'pt-[4px]'\n : 'border-b border-solid border-[var(--malachite-card-border)]',\n ]\n .filter(Boolean)\n .join(' ')}\n >\n {bodyChildren}\n </div>\n )\n )}\n {/* Last, so a toggle mounted in the same commit has its ref by the hand-off. */}\n <CollapseFocusHandOff expanded={expanded} bodyRef={bodyRef} toggleRef={toggleRef} />\n </div>\n );\n};\n\nconst Accordion = React.forwardRef(AccordionSection);\nAccordion.displayName = 'Accordion';\n\nexport default Accordion;\nexport { Accordion };\nexport type { AccordionProps };\n"],"names":["PINNED_SURROUND_CHANNEL","SETTLE_FALLBACK_MS","FLASH_MS","PIN_MARKER_STYLE","AccordionSection","title","header","className","children","trailing","leading","arrowPosition","highlightExpanded","bodyIndent","variant","defaultExpanded","isExpanded","onToggle","disabled","stickyHeader","stickyTopOffset","pinnedCorners","animate","collapsible","flashKey","ref","quiet","sunken","bodyId","useId","internalExpanded","setInternalExpanded","useState","prevFlashKey","setPrevFlashKey","flashRun","setFlashRun","flashing","setFlashing","useEffect","end","expanded","gutter","bodyRendered","bodySettled","setBodySettled","mountedOpen","useRef","fallback","bodyRef","toggleRef","markerRef","capsCorners","pinned","usePinned","hasLeading","isRenderableNode","titleGrid","subgrid","handleToggle","newExpanded","containerClasses","FRAME_CLASS","headerRowClasses","titleAreaClasses","toggleButtonClasses","FOCUS_RING","FOCUS_RING_INSET","titleAreaStyle","togglePaddingLeftPx","toggleGapPx","titleContent","jsx","highlighted","headerRowStyle","FRAME_BACKGROUND","titleInset","bodyInsetPx","bodyChildren","jsxs","PinnedCornerCap","event","DisclosureArrow","ARROW_PX","inertWhen","CollapseFocusHandO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AAAA,cAE/B;AAAA,cAEA,UAAA,gBAAA+B;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACG,WAAW,CAACd,GAASd,IAAc,qBAAqB,iBAAiB,EACpE,OAAO,OAAO,EACd,KAAK,GAAG;AAAA,kBACb,gBAAcA,IAAc,KAAK;AAAA,kBAEhC,UAAApC,KACG,gBAAAgE;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACG,WAAW;AAAA,wBACPd;AAAA,wBACA/B,IACM,aACA;AAAA,sBAAA,EAEL,OAAO,OAAO,EACd,KAAK,GAAG;AAAA,sBAEZ,UAAAmD;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACL;AAAA,cAAA;AAAA,YAER;AAAA,UAAA;AAAA;AAAA;AAAA,UAIJrC,KACAjC,KACI,gBAAAgE;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,KAAKvB;AAAA,cACL,IAAIrB;AAAA,cACJ,WAAW;AAAA,gBACP8B;AAAA,gBACA/B,IACM,aACA;AAAA,cAAA,EAEL,OAAO,OAAO,EACd,KAAK,GAAG;AAAA,cAEZ,UAAAmD;AAAA,YAAA;AAAA,UAAA;AAAA;AAAA,QAKb,gBAAAN,EAACa,IAAA,EAAqB,UAAA5C,GAAoB,SAAAQ,GAAkB,WAAAC,EAAA,CAAsB;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG9F,GAEMoC,KAAYC,GAAM,WAAWnF,EAAgB;AACnDkF,GAAU,cAAc;"}
1
+ {"version":3,"file":"Accordion.js","sources":["../../src/components/Accordion.tsx"],"sourcesContent":["import React, { useEffect, useId, useRef, useState } from 'react';\nimport CollapseFocusHandOff from './CollapseFocusHandOff';\nimport DisclosureArrow from './DisclosureArrow';\nimport PinnedCornerCap from './PinnedCornerCap';\nimport { ARROW_PX, bodyInsetPx, toggleGapPx, togglePaddingLeftPx } from './accordionBodyInset';\nimport { ROW_HOVER_COLOR } from './chromeStyles';\nimport { FOCUS_RING, FOCUS_RING_INSET } from './focusRing';\nimport { FRAME_BACKGROUND, FRAME_CLASS } from './frameStyles';\nimport { inertWhen } from './inert';\nimport { isRenderableNode } from './renderableNode';\nimport { usePinned } from './usePinned';\n\n/** The ground behind a pinned header's card, painted into its corners. A context channel, not a\n * theme token: no palette value, not settable through `applyTheme`, absent from\n * `getCurrentTheme`. Set it on an ancestor when the card does not sit on the page ground. */\nconst PINNED_SURROUND_CHANNEL = '--malachite-ctx-pinned-surround';\n\nconst SETTLE_FALLBACK_MS = 300;\nconst FLASH_MS = 1600;\n\n// Out of flow with no insets: it rests at the section's top without a cell or a caller's gap.\nconst PIN_MARKER_STYLE: React.CSSProperties = { position: 'absolute', width: 0, height: 0 };\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 (a rounded container in the table's frame\n * colour, no dividers/hover) — used for stacked detail sections in side panels and\n * detail 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 /** `false` keeps an open row on the card ground. */\n highlightExpanded?: boolean;\n /** `title` starts the body under the title, 16px short of it for a compact `Surface.Row`. */\n bodyIndent?: 'none' | 'title';\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 * With `stickyHeader`, rounds the header into its card's top corners once it pins,\n * in a flat, default-tone `<Surface overflow=\"clip\" shadow={false}>`. Set\n * `--malachite-ctx-pinned-surround` on an ancestor when the card sits on another ground.\n */\n pinnedCorners?: boolean;\n /** Change it after mount to flash an outline around the section. */\n flashKey?: React.Key;\n}\n\ninterface AccordionToggleProps {\n /** `false` is a section that never closes; the toggle props except `animate` are then ignored. */\n collapsible?: boolean;\n /** `gutter` puts the arrow before `leading` as its own mouse toggle; the title stays the keyboard one. */\n arrowPosition?: 'start' | 'end' | 'gutter';\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 * 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 AccordionToggleProps &\n ({ title: string; header?: React.ReactNode } | { title?: string; header: React.ReactNode });\n\nconst AccordionSection = (\n {\n title,\n header,\n className,\n children,\n trailing,\n leading,\n arrowPosition = 'start',\n highlightExpanded = true,\n bodyIndent = 'none',\n variant = 'default',\n defaultExpanded = false,\n isExpanded,\n onToggle,\n disabled = false,\n stickyHeader = false,\n stickyTopOffset = 0,\n pinnedCorners = false,\n animate = true,\n collapsible = true,\n flashKey,\n }: AccordionProps,\n ref: React.ForwardedRef<HTMLDivElement>,\n) => {\n const quiet = disabled || !collapsible;\n const sunken = variant === 'sunken';\n const instanceId = useId();\n const bodyId = `${instanceId}-body`;\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);\n const [prevFlashKey, setPrevFlashKey] = useState(flashKey);\n const [flashRun, setFlashRun] = useState(0);\n const [flashing, setFlashing] = useState(false);\n if (!Object.is(flashKey, prevFlashKey)) {\n setPrevFlashKey(flashKey);\n if (flashKey !== undefined) {\n setFlashRun(flashRun + 1);\n setFlashing(true);\n }\n }\n useEffect(() => {\n if (flashRun === 0) {\n return;\n }\n const end = window.setTimeout(() => setFlashing(false), FLASH_MS);\n return () => window.clearTimeout(end);\n }, [flashRun]);\n if (!collapsible && !internalExpanded) {\n setInternalExpanded(true);\n }\n\n // Use controlled state if isExpanded is provided, otherwise use internal state\n const expanded = !collapsible || (isExpanded !== undefined ? isExpanded : internalExpanded);\n const gutter = collapsible && arrowPosition === 'gutter';\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 const [bodySettled, setBodySettled] = useState(!collapsible);\n const mountedOpen = useRef(expanded);\n if (!expanded && bodySettled) {\n setBodySettled(false);\n } else if (expanded && !animate && !bodySettled) {\n setBodySettled(true);\n }\n useEffect(() => {\n if (!expanded) {\n mountedOpen.current = false;\n return undefined;\n }\n if (!animate || bodySettled || (mountedOpen.current && collapsible)) {\n return undefined;\n }\n // Not `transitioncancel`: reversing a running transition fires it while the new one runs.\n const fallback = window.setTimeout(() => setBodySettled(true), SETTLE_FALLBACK_MS);\n return () => window.clearTimeout(fallback);\n }, [animate, expanded, collapsible, bodySettled]);\n // A collapsed animated body is only a zero-height row, so it renders `inert` (below); an\n // instant one unmounts. Either way focus inside it is handed out (`CollapseFocusHandOff`).\n const bodyRef = useRef<HTMLDivElement>(null);\n const toggleRef = useRef<HTMLButtonElement>(null);\n const markerRef = useRef<HTMLDivElement>(null);\n const capsCorners = Boolean(stickyHeader) && pinnedCorners && !sunken;\n const pinned = usePinned(markerRef, stickyTopOffset, capsCorners);\n const hasLeading = isRenderableNode(leading);\n\n // One header column per slot, so the body can start at the toggle's.\n const titleGrid = bodyIndent === 'title';\n const subgrid = titleGrid ? 'grid grid-cols-subgrid col-span-4' : '';\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 titleGrid ? 'grid grid-cols-[auto_auto_minmax(0,1fr)_auto]' : 'flex flex-col',\n 'w-full text-left',\n // The table's frame, so a sunken section reads as the same kind of container as a table\n // beside it, in both themes.\n sunken ? FRAME_CLASS : '',\n flashing ? 'relative' : '',\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 // A pinned header's hover paints over its inline ground (headerRowStyle), which beats a\n // bg-colour class. Written out in full so Tailwind's scanner generates it.\n const pinnedBackground =\n (expanded && highlightExpanded) || quiet\n ? ''\n : 'hover:bg-[image:linear-gradient(var(--malachite-buttonlist-hover-background,rgb(245,245,245)),var(--malachite-buttonlist-hover-background,rgb(245,245,245)))]';\n const rowBackground = sunken\n ? 'bg-transparent'\n : stickyHeader\n ? pinnedBackground\n : expanded && highlightExpanded\n ? 'bg-[var(--malachite-buttonlist-hover-background,rgb(245,245,245))]'\n : quiet\n ? 'bg-transparent'\n : 'bg-transparent hover:bg-[var(--malachite-buttonlist-hover-background,rgb(245,245,245))]';\n const headerRowClasses = [\n // `group` only when enabled, so the arrow doesn't darken on hover while disabled.\n quiet ? '' : 'group',\n titleGrid ? subgrid : 'flex w-full',\n 'items-center transition-colors',\n sunken ? '' : 'border-0 border-b border-solid border-[var(--malachite-card-border)]',\n stickyHeader ? `sticky ${pinned ? 'z-10' : 'z-[8]'}` : '',\n rowBackground,\n ]\n .filter(Boolean)\n .join(' ');\n const titleAreaClasses = [\n 'flex flex-1 items-center min-w-0 text-left',\n sunken ? 'pr-[16px] py-[12px]' : 'pr-[16px] py-[16px]',\n titleGrid ? 'col-start-3' : '',\n ]\n .filter(Boolean)\n .join(' ');\n // Full-bleed default rows use an inset ring; the padded sunken toggle fits an outset one.\n const toggleButtonClasses = [\n titleAreaClasses,\n 'appearance-none border-0 bg-transparent cursor-pointer select-none disabled:cursor-not-allowed',\n sunken ? `rounded-lg ${FOCUS_RING}` : FOCUS_RING_INSET,\n ].join(' ');\n const titleAreaStyle: React.CSSProperties = {\n paddingLeft: togglePaddingLeftPx(hasLeading || gutter),\n gap: toggleGapPx(sunken),\n };\n const titleContent = 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\n // Inline so the offset, the opaque ground and the open highlight apply even where arbitrary\n // classes are not compiled. The ground is the variant's own: a sunken section pinned in card\n // white would float over its frame.\n const highlighted = !sunken && expanded && highlightExpanded;\n const headerRowStyle: React.CSSProperties = stickyHeader\n ? {\n top: `${stickyTopOffset}px`,\n backgroundColor: sunken ? FRAME_BACKGROUND : 'var(--malachite-card-background)',\n ...(highlighted && {\n backgroundImage: `linear-gradient(${ROW_HOVER_COLOR}, ${ROW_HOVER_COLOR})`,\n }),\n }\n : {};\n\n const titleInset = bodyInsetPx({\n arrowPosition: collapsible ? arrowPosition : 'end',\n hasLeading,\n sunken,\n });\n const bodyChildren = titleGrid ? (\n <div\n className=\"col-start-3 col-span-2 min-w-0\"\n style={titleInset < 0 ? { marginLeft: titleInset } : { paddingLeft: titleInset }}\n >\n {children}\n </div>\n ) : (\n children\n );\n\n return (\n <div\n ref={ref}\n className={containerClasses}\n style={\n stickyHeader && stickyTopOffset ? { scrollMarginTop: stickyTopOffset } : undefined\n }\n >\n {flashing && (\n <span\n key={flashRun}\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-0 z-[11] rounded-[inherit] [outline-offset:-2px] [animation:malachite-section-flash_ease-out] motion-reduce:[animation-name:malachite-section-flash-still]\"\n style={{ animationDuration: `${FLASH_MS}ms` }}\n data-accordion-flash=\"\"\n />\n )}\n {capsCorners && <div ref={markerRef} aria-hidden=\"true\" style={PIN_MARKER_STYLE} />}\n <div\n className={headerRowClasses}\n style={headerRowStyle}\n data-accordion-header=\"\"\n data-pinned={pinned ? '' : undefined}\n >\n {pinned && (\n <PinnedCornerCap\n bordered\n radius=\"var(--malachite-radius-xxl, 14px)\"\n surround={`var(${PINNED_SURROUND_CHANNEL}, var(--malachite-card-sunken-background))`}\n />\n )}\n {gutter && (\n <button\n type=\"button\"\n tabIndex={-1}\n aria-hidden=\"true\"\n className={`${titleGrid ? 'col-start-1' : ''} 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} size={ARROW_PX} />\n </button>\n )}\n {hasLeading && (\n <div\n className={`${titleGrid ? 'col-start-2' : ''} shrink-0 flex items-center ${gutter ? 'pl-[12px]' : 'pl-[16px]'}`}\n >\n {leading}\n </div>\n )}\n {/* Toggle area — arrow + header/title. Interactive trailing sits outside it. */}\n {collapsible ? (\n <button\n ref={toggleRef}\n type=\"button\"\n className={toggleButtonClasses}\n style={titleAreaStyle}\n onClick={handleToggle}\n aria-expanded={expanded}\n aria-controls={bodyRendered ? bodyId : undefined}\n disabled={disabled}\n >\n {arrowPosition === 'start' && (\n <DisclosureArrow expanded={expanded} size={ARROW_PX} />\n )}\n {titleContent}\n {arrowPosition === 'end' && (\n <DisclosureArrow\n expanded={expanded}\n size={ARROW_PX}\n className=\"ml-auto\"\n />\n )}\n </button>\n ) : (\n <div className={titleAreaClasses} style={titleAreaStyle}>\n {titleContent}\n </div>\n )}\n {isRenderableNode(trailing) && (\n <div\n className={`${titleGrid ? 'col-start-4' : ''} shrink-0 flex items-center pr-[16px] text-[var(--malachite-text-secondary)]`}\n >\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 the title grid's body cell uses min-w-0 instead. */\n <div\n ref={bodyRef}\n {...inertWhen(!expanded)}\n id={bodyId}\n className={`grid ${titleGrid ? 'grid-cols-subgrid col-span-4' : '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 (\n event.target === event.currentTarget &&\n event.propertyName === 'grid-template-rows'\n ) {\n setBodySettled(expanded);\n }\n }}\n >\n <div\n className={[subgrid, bodySettled ? 'overflow-visible' : 'overflow-hidden']\n .filter(Boolean)\n .join(' ')}\n data-settled={bodySettled ? '' : undefined}\n >\n {children && (\n <div\n className={[\n subgrid,\n sunken\n ? 'pt-[4px]'\n : 'border-b border-solid border-[var(--malachite-card-border)]',\n ]\n .filter(Boolean)\n .join(' ')}\n >\n {bodyChildren}\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 ref={bodyRef}\n id={bodyId}\n className={[\n subgrid,\n sunken\n ? 'pt-[4px]'\n : 'border-b border-solid border-[var(--malachite-card-border)]',\n ]\n .filter(Boolean)\n .join(' ')}\n >\n {bodyChildren}\n </div>\n )\n )}\n {/* Last, so a toggle mounted in the same commit has its ref by the hand-off. */}\n <CollapseFocusHandOff expanded={expanded} bodyRef={bodyRef} toggleRef={toggleRef} />\n </div>\n );\n};\n\nconst Accordion = React.forwardRef(AccordionSection);\nAccordion.displayName = 'Accordion';\n\nexport default Accordion;\nexport { Accordion };\nexport type { AccordionProps };\n"],"names":["PINNED_SURROUND_CHANNEL","SETTLE_FALLBACK_MS","FLASH_MS","PIN_MARKER_STYLE","AccordionSection","title","header","className","children","trailing","leading","arrowPosition","highlightExpanded","bodyIndent","variant","defaultExpanded","isExpanded","onToggle","disabled","stickyHeader","stickyTopOffset","pinnedCorners","animate","collapsible","flashKey","ref","quiet","sunken","bodyId","useId","internalExpanded","setInternalExpanded","useState","prevFlashKey","setPrevFlashKey","flashRun","setFlashRun","flashing","setFlashing","useEffect","end","expanded","gutter","bodyRendered","bodySettled","setBodySettled","mountedOpen","useRef","fallback","bodyRef","toggleRef","markerRef","capsCorners","pinned","usePinned","hasLeading","isRenderableNode","titleGrid","subgrid","handleToggle","newExpanded","containerClasses","FRAME_CLASS","headerRowClasses","titleAreaClasses","toggleButtonClasses","FOCUS_RING","FOCUS_RING_INSET","titleAreaStyle","togglePaddingLeftPx","toggleGapPx","titleContent","jsx","highlighted","headerRowStyle","FRAME_BACKGROUND","ROW_HOVER_COLOR","titleInset","bodyInsetPx","bodyChildren","jsxs","PinnedCornerCap","event","DisclosureArrow","ARROW_PX","inertWhen","CollapseFocusHandOff","Accordion","React"],"mappings":";;;;;;;;;;;;AAeA,MAAMA,KAA0B,mCAE1BC,KAAqB,KACrBC,IAAW,MAGXC,KAAwC,EAAE,UAAU,YAAY,OAAO,GAAG,QAAQ,EAAA,GAqElFC,KAAmB,CACrB;AAAA,EACI,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,YAAAC,KAAa;AAAA,EACb,SAAAC,KAAU;AAAA,EACV,iBAAAC,KAAkB;AAAA,EAClB,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,cAAAC,IAAe;AAAA,EACf,iBAAAC,IAAkB;AAAA,EAClB,eAAAC,KAAgB;AAAA,EAChB,SAAAC,IAAU;AAAA,EACV,aAAAC,IAAc;AAAA,EACd,UAAAC;AACJ,GACAC,OACC;AACD,QAAMC,IAAQR,KAAY,CAACK,GACrBI,IAASb,OAAY,UAErBc,IAAS,GADIC,GAAA,CACS,SACtB,CAACC,GAAkBC,CAAmB,IAAIC,EAASjB,EAAe,GAClE,CAACkB,IAAcC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