@stackone/malachite 2.120.1 → 2.121.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.
@@ -1,5 +1,5 @@
1
1
  import { jsx as o, jsxs as E } from "react/jsx-runtime";
2
- import be, { useRef as D, useEffect as he } from "react";
2
+ import pe, { useRef as D, useEffect as he } from "react";
3
3
  import { DisclosureArrow as ge } from "./DisclosureArrow.js";
4
4
  import { paintOnChild as xe } from "./asChild.js";
5
5
  import { ROW_HOVER as ee } from "./chromeStyles.js";
@@ -15,11 +15,13 @@ const Se = {
15
15
  }, ye = {
16
16
  default: "",
17
17
  muted: "bg-[var(--malachite-card-dimmed-background)]",
18
- success: "bg-[var(--malachite-tag-success-background)]",
19
- error: "bg-[var(--malachite-tag-error-background)]"
18
+ success: "bg-[var(--malachite-tag-success-background,rgba(0,175,102,0.1))]",
19
+ warning: "bg-[var(--malachite-tag-warning-background,rgba(150,88,10,0.1))]",
20
+ error: "bg-[var(--malachite-tag-error-background,rgba(196,62,62,0.1))]"
20
21
  }, _e = {
21
- success: "var(--malachite-tag-success-foreground)",
22
- error: "var(--malachite-tag-error-foreground)"
22
+ success: "var(--malachite-tag-success-foreground, rgb(2, 122, 66))",
23
+ warning: "var(--malachite-tag-warning-foreground, rgb(150, 88, 10))",
24
+ error: "var(--malachite-tag-error-foreground, rgb(196, 62, 62))"
23
25
  }, ke = "opacity-0 transition-opacity group-[:hover]/row:opacity-100 group-focus-within/row:opacity-100 has-[[aria-expanded=true]]:opacity-100 [@media(hover:none)]:opacity-100", Oe = (r) => {
24
26
  var s;
25
27
  const n = r.getRootNode(), e = ((s = n.getSelection) == null ? void 0 : s.call(n)) ?? r.ownerDocument.getSelection();
@@ -29,17 +31,17 @@ const Se = {
29
31
  if (e.getRangeAt(l).intersectsNode(r))
30
32
  return !0;
31
33
  return !1;
32
- }, Te = (r) => new r.constructor("click", r), Ae = "0px 0px 4px 0px rgba(0,0,0,0.08), 0px 4px 4px 0px rgba(0,0,0,0.08), 0px 4px 10px 0px rgba(0,0,0,0.05)", te = (r) => {
34
+ }, Te = (r) => new r.constructor("click", r), Ae = "0px 0px 4px 0px rgba(0,0,0,0.08), 0px 4px 4px 0px rgba(0,0,0,0.08), 0px 4px 10px 0px rgba(0,0,0,0.05)", ae = (r) => {
33
35
  const {
34
36
  children: n,
35
- divider: a = !1,
37
+ divider: t = !1,
36
38
  disabled: e = !1,
37
39
  hover: s = !0,
38
40
  selected: l,
39
41
  selection: d,
40
42
  tone: u = "default",
41
43
  inset: w = "none",
42
- className: b = "",
44
+ className: p = "",
43
45
  style: f
44
46
  } = r, c = r.asChild === !0, {
45
47
  onClick: i,
@@ -50,34 +52,34 @@ const Se = {
50
52
  revealTrailing: B,
51
53
  leading: _,
52
54
  dimmed: F,
53
- role: p
55
+ role: b
54
56
  } = c ? {} : r, h = Ee(y), U = c ? void 0 : r["aria-label"], j = c ? void 0 : r["aria-labelledby"], oe = c ? void 0 : r.tabIndex, G = !!(i || h), ne = e && (G || c) ? "" : s ? ee : "", ie = u !== "default", le = ye[u], W = !c && Q(P), k = Se[w], ce = k ? "" : "p-0", H = [
55
57
  "w-full text-left border-0",
56
58
  le,
57
- a ? "border-b border-solid border-[var(--malachite-card-border)]" : "",
59
+ t ? "border-b border-solid border-[var(--malachite-card-border)]" : "",
58
60
  ne
59
61
  ].filter(Boolean).join(" "), X = [
60
62
  "appearance-none",
61
63
  ie ? "" : "bg-transparent",
62
64
  e ? "" : "cursor-pointer"
63
- ], V = (t) => [H, ...t, k, b].filter(Boolean).join(" "), se = d ? d !== "announce" : p !== "checkbox", de = d !== "tint", m = W && !!i && !h && !e, z = D(null), K = D(null), g = D(!1), ue = (t) => {
64
- g.current = t.target !== t.currentTarget;
65
- }, fe = (t) => {
66
- g.current || (g.current = t.target !== t.currentTarget);
65
+ ], V = (a) => [H, ...a, k, p].filter(Boolean).join(" "), se = d ? d !== "announce" : b !== "checkbox", de = d !== "tint", m = W && !!i && !h && !e, z = D(null), K = D(null), g = D(!1), ue = (a) => {
66
+ g.current = a.target !== a.currentTarget;
67
+ }, fe = (a) => {
68
+ g.current || (g.current = a.target !== a.currentTarget);
67
69
  };
68
70
  he(() => {
69
- const t = z.current;
70
- if (!m || !t)
71
+ const a = z.current;
72
+ if (!m || !a)
71
73
  return;
72
74
  const N = (v) => {
73
75
  const L = g.current;
74
76
  g.current = !1;
75
77
  const $ = K.current;
76
- !$ || v.target !== t || L || v.detail <= 1 && !v.shiftKey && Oe(t) || (v.stopPropagation(), $.focus({ preventScroll: !0 }), $.dispatchEvent(Te(v)));
78
+ !$ || v.target !== a || L || v.detail <= 1 && !v.shiftKey && Oe(a) || (v.stopPropagation(), $.focus({ preventScroll: !0 }), $.dispatchEvent(Te(v)));
77
79
  };
78
- return t.addEventListener("click", N), () => t.removeEventListener("click", N);
80
+ return a.addEventListener("click", N), () => a.removeEventListener("click", N);
79
81
  }, [m]);
80
- const pe = l === !0 && se ? {
82
+ const be = l === !0 && se ? {
81
83
  backgroundImage: `linear-gradient(${Z}, ${Z})`,
82
84
  color: Re,
83
85
  ...de ? { boxShadow: `inset 2px 0 0 ${Ne}` } : {},
@@ -85,18 +87,18 @@ const Se = {
85
87
  } : {}, O = _e[u], C = { ...O ? {
86
88
  color: O,
87
89
  "--malachite-ctx-text-primary": O
88
- } : {}, ...pe, ...f }, T = p === "checkbox" && l === "mixed" ? "mixed" : p === "radio" || p === "checkbox" ? l === !0 : void 0, Y = T === void 0 && l === !0 ? !0 : void 0, q = {
89
- role: p,
90
+ } : {}, ...be, ...f }, T = b === "checkbox" && l === "mixed" ? "mixed" : b === "radio" || b === "checkbox" ? l === !0 : void 0, Y = T === void 0 && l === !0 ? !0 : void 0, q = {
91
+ role: b,
90
92
  "aria-checked": T,
91
93
  "aria-current": Y,
92
94
  "aria-label": U,
93
95
  "aria-labelledby": j,
94
- "aria-disabled": p && e ? !0 : void 0
96
+ "aria-disabled": b && e ? !0 : void 0
95
97
  };
96
98
  if (c)
97
99
  return xe(n, V([]), C);
98
100
  const S = {
99
- role: p,
101
+ role: b,
100
102
  tabIndex: oe,
101
103
  "aria-checked": T,
102
104
  "aria-current": Y,
@@ -113,7 +115,7 @@ const Se = {
113
115
  )
114
116
  ] }) : n;
115
117
  if (W) {
116
- const t = e ? null : /* @__PURE__ */ o(
118
+ const a = e ? null : /* @__PURE__ */ o(
117
119
  "span",
118
120
  {
119
121
  "aria-hidden": "true",
@@ -135,7 +137,7 @@ const Se = {
135
137
  ...S,
136
138
  children: [
137
139
  x,
138
- t
140
+ a
139
141
  ]
140
142
  }
141
143
  ) : i ? /* @__PURE__ */ E(
@@ -150,7 +152,7 @@ const Se = {
150
152
  ...S,
151
153
  children: [
152
154
  x,
153
- t
155
+ a
154
156
  ]
155
157
  }
156
158
  ) : /* @__PURE__ */ o("div", { className: "flex-1 min-w-0", "data-malachite-row-control": "", ...q, children: x });
@@ -163,7 +165,7 @@ const Se = {
163
165
  m ? "cursor-pointer" : "",
164
166
  k,
165
167
  B ? "group/row" : "",
166
- b
168
+ p
167
169
  ].filter(Boolean).join(" "),
168
170
  style: C,
169
171
  "data-malachite-row": "",
@@ -213,38 +215,38 @@ const Se = {
213
215
  children: x
214
216
  }
215
217
  ) : /* @__PURE__ */ o("div", { className: A, style: C, ...q, children: x });
216
- }, Le = ({ children: r, className: n = "", style: a }) => /* @__PURE__ */ o("div", { className: n, style: a, onClick: (e) => e.stopPropagation(), children: r }), Ke = 39, $e = Object.assign(
218
+ }, Le = ({ children: r, className: n = "", style: t }) => /* @__PURE__ */ o("div", { className: n, style: t, onClick: (e) => e.stopPropagation(), children: r }), Ke = 39, $e = Object.assign(
217
219
  ({
218
220
  header: r,
219
221
  children: n,
220
- expanded: a,
222
+ expanded: t,
221
223
  onToggle: e,
222
224
  sticky: s = !1,
223
225
  stickyTopOffset: l = 0,
224
226
  divider: d = !1,
225
227
  tone: u = "default",
226
228
  "aria-label": w,
227
- className: b = "",
229
+ className: p = "",
228
230
  style: f
229
231
  }) => {
230
- const c = be.useId(), i = e ? () => e(!a) : void 0;
232
+ const c = pe.useId(), i = e ? () => e(!t) : void 0;
231
233
  return (
232
234
  // The hover is the header's, not the row's: the row holds the open body too, which is
233
235
  // not a target, and tinting it washes out everything in it.
234
236
  /* @__PURE__ */ E(
235
- te,
237
+ ae,
236
238
  {
237
239
  divider: d,
238
240
  tone: u,
239
241
  hover: !1,
240
- className: b,
242
+ className: p,
241
243
  style: f,
242
244
  children: [
243
245
  /* @__PURE__ */ E(
244
246
  "div",
245
247
  {
246
- className: `group flex items-center w-full ${ee} ${i ? "cursor-pointer" : ""} ${s && a ? "sticky z-[1] bg-[var(--malachite-card-background)]" : ""}`,
247
- style: s && a ? { top: l } : void 0,
248
+ className: `group flex items-center w-full ${ee} ${i ? "cursor-pointer" : ""} ${s && t ? "sticky z-[1] bg-[var(--malachite-card-background)]" : ""}`,
249
+ style: s && t ? { top: l } : void 0,
248
250
  onClick: i,
249
251
  role: "presentation",
250
252
  children: [
@@ -253,20 +255,20 @@ const Se = {
253
255
  {
254
256
  type: "button",
255
257
  className: `appearance-none bg-transparent border-0 p-0 flex items-center cursor-pointer ${re}`,
256
- "aria-expanded": a,
258
+ "aria-expanded": t,
257
259
  "aria-controls": c,
258
260
  "aria-label": w,
259
261
  onClick: (y) => {
260
262
  y.stopPropagation(), i();
261
263
  },
262
- children: /* @__PURE__ */ o(ge, { expanded: a })
264
+ children: /* @__PURE__ */ o(ge, { expanded: t })
263
265
  }
264
266
  ) }),
265
267
  r
266
268
  ]
267
269
  }
268
270
  ),
269
- a && /* @__PURE__ */ o("div", { id: c, children: n })
271
+ t && /* @__PURE__ */ o("div", { id: c, children: n })
270
272
  ]
271
273
  }
272
274
  )
@@ -276,28 +278,28 @@ const Se = {
276
278
  ), De = {
277
279
  default: "bg-[var(--malachite-card-background)] border border-solid border-[var(--malachite-card-border)]",
278
280
  highlight: "bg-[var(--malachite-card-warm-background,rgb(244,242,240))]"
279
- }, Ie = "relative after:pointer-events-none after:absolute after:-inset-px after:z-[9] after:rounded-[inherit] after:border after:border-solid after:[border-color:inherit] after:content-['']", ae = (({
281
+ }, Ie = "relative after:pointer-events-none after:absolute after:-inset-px after:z-[9] after:rounded-[inherit] after:border after:border-solid after:[border-color:inherit] after:content-['']", te = (({
280
282
  children: r,
281
283
  padding: n = !1,
282
- overflow: a = "hidden",
284
+ overflow: t = "hidden",
283
285
  tone: e = "default",
284
286
  shadow: s = e !== "highlight",
285
287
  role: l,
286
288
  "aria-label": d,
287
289
  "aria-labelledby": u,
288
290
  className: w = "",
289
- style: b
291
+ style: p
290
292
  }) => {
291
- const f = a === "clip" && !s && e === "default";
293
+ const f = t === "clip" && !s && e === "default";
292
294
  return /* @__PURE__ */ o(
293
295
  "div",
294
296
  {
295
- className: `w-full rounded-[var(--malachite-radius-xxl,14px)] ${f ? "overflow-visible" : a === "clip" ? "overflow-clip" : a === "visible" ? "overflow-visible" : "overflow-hidden"} ${De[e]} ${n ? "py-3 px-4" : ""} ${f ? Ie : ""} ${w}`,
297
+ className: `w-full rounded-[var(--malachite-radius-xxl,14px)] ${f ? "overflow-visible" : t === "clip" ? "overflow-clip" : t === "visible" ? "overflow-visible" : "overflow-hidden"} ${De[e]} ${n ? "py-3 px-4" : ""} ${f ? Ie : ""} ${w}`,
296
298
  style: {
297
299
  ...s ? { boxShadow: Ae } : {},
298
300
  ...f ? { clipPath: "inset(0 round var(--malachite-radius-xxl, 14px))" } : {},
299
301
  ...we,
300
- ...b
302
+ ...p
301
303
  },
302
304
  role: l,
303
305
  "aria-label": d,
@@ -306,13 +308,13 @@ const Se = {
306
308
  }
307
309
  );
308
310
  });
309
- ae.Row = te;
310
- ae.ExpandableRow = $e;
311
+ te.Row = ae;
312
+ te.ExpandableRow = $e;
311
313
  export {
312
314
  Ke as EXPANDABLE_ROW_LEAD_PX,
313
- ae as Surface,
315
+ te as Surface,
314
316
  $e as SurfaceExpandableRow,
315
- te as SurfaceRow,
316
- ae as default
317
+ ae as SurfaceRow,
318
+ te as default
317
319
  };
318
320
  //# sourceMappingURL=Surface.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Surface.js","sources":["../../src/components/Surface.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport DisclosureArrow from './DisclosureArrow';\nimport { paintOnChild } from './asChild';\nimport { ROW_HOVER } from './chromeStyles';\nimport { FOCUS_RING_INSET, FOCUS_RING_INSET_OVERLAY_HIDDEN } from './focusRing';\nimport { resolveRel } from './linkRel';\nimport { isRenderableNode } from './renderableNode';\nimport { safeHref } from './safeHref';\nimport {\n FOREGROUND_RESET,\n SELECTED_ROW_ACCENT,\n SELECTED_ROW_BACKGROUND,\n SELECTED_ROW_FOREGROUND,\n SELECTED_TEXT_CONTEXT,\n} from './selectedRow';\n\nexport type SurfaceTone = 'default' | 'highlight';\n\nexport interface SurfaceProps {\n children?: React.ReactNode;\n padding?: boolean;\n /**\n * Content overflow. Defaults to `hidden` so children are clipped to the rounded\n * corners. Use `clip` to keep the rounded clipping WITHOUT creating a scroll\n * container — so a `position: sticky` descendant still pins (unlike `hidden`,\n * which traps it). `visible` disables clipping entirely. A flat, default-tone `clip` card clips at its border.\n */\n overflow?: 'hidden' | 'visible' | 'clip';\n /**\n * `false` drops the elevation shadow, for a card that sits flat on its ground.\n * Default: `true`, or `false` with `tone=\"highlight\"`.\n */\n shadow?: boolean;\n /**\n * `highlight` paints the warm ground with no border and no shadow, for a static block that\n * stands out from the page, such as a hero or a guide's section header. Its ground is too\n * close to `Surface.Row`'s hover for clickable rows inside it.\n */\n tone?: SurfaceTone;\n role?: React.AriaRole;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n className?: string;\n style?: React.CSSProperties;\n}\n\ninterface SurfaceRowChromeProps {\n children?: React.ReactNode;\n /** Renders a bottom divider — omit on the last row in a Surface. */\n divider?: boolean;\n /** Removes the hover affordance / disables the control (e.g. while loading/busy). */\n disabled?: boolean;\n /** Announces the row as selected — `aria-checked` under a `radio`/`checkbox` role,\n * `aria-current` otherwise — and paints `Table`'s selected treatment unless `selection`\n * says not to. `'mixed'` is for a `checkbox` row that is partly selected: it announces\n * `aria-checked=\"mixed\"` there, never paints and never marks the row current, and counts\n * as not selected under any other role. */\n selected?: boolean | 'mixed';\n /** How a `selected` row shows it. `highlight` paints the treatment; `tint` paints it\n * without the accent bar, for a menu whose choice is already marked inside the row;\n * `announce` leaves the visual to a control inside the row and only sets the ARIA state.\n * Defaults to `announce` under `role=\"checkbox\"` and `highlight` otherwise. */\n selection?: 'highlight' | 'tint' | 'announce';\n /**\n * Tints the whole row by what it reports. `muted` is a row whose subject is inactive —\n * not disabled: it stays interactive. `success` and `error` are for a row that carries\n * an outcome, where the result belongs to the whole line rather than to one cell in it.\n */\n tone?: 'default' | 'muted' | 'success' | 'error';\n /** `compact` is an 8px by 16px inset the row owns. */\n inset?: 'none' | 'compact';\n /** `false` leaves the hover to something inside the row. */\n hover?: boolean;\n className?: string;\n style?: React.CSSProperties;\n}\n\nconst INSET_CLASSES: Record<NonNullable<SurfaceRowChromeProps['inset']>, string> = {\n none: '',\n // The 16px is ROW_INSET_PX in accordionBodyInset.ts too; Accordion's bodyIndent gives it back.\n compact: 'px-[16px] py-[8px]',\n};\n\n/** Stays an interface under its original name: a consumer may `extends` it. */\nexport interface SurfaceRowProps extends SurfaceRowChromeProps {\n asChild?: false;\n /**\n * When provided, the whole row becomes clickable: it renders as a `<button>`\n * (or `<a>` when `href` is set), so the entire row is the click target with\n * native focus + Enter/Space — no manual tabIndex/key handlers. For a\n * selectable row, put a presentational `<Radio>`/`<Checkbox>` inside as the\n * visual indicator; do NOT nest an interactive control (invalid + double tab stop).\n */\n onClick?: (event: React.MouseEvent) => void;\n /** Renders the clickable row as an anchor instead of a button. */\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n rel?: string;\n /** Content pinned right, outside the row button, so it may hold its own control. */\n trailing?: React.ReactNode;\n /**\n * Shows `trailing` only while the row is hovered or holds focus, and while a menu\n * it opened is still open. Hidden by opacity, so it stays in the tab order; a touch screen,\n * which has no hover, always shows it.\n */\n revealTrailing?: boolean;\n /** The row's indicator, before the children. With this or `dimmed`, pass one child. */\n leading?: React.ReactNode;\n /** Fades the children, not `leading` or `trailing`. */\n dimmed?: boolean;\n /** ARIA role for a clickable row, e.g. `radio`/`checkbox` (wrap the list in a `radiogroup`). */\n role?: React.AriaRole;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n /** `-1` takes the row out of the Tab order, for a roving radio group. */\n tabIndex?: number;\n}\n\n/**\n * The outcome tones reuse the tag tokens rather than minting row ones, so a row saying \"this\n * passed\" and a tag saying it are the same green wherever the two sit together.\n */\nconst TONE_CLASSES: Record<NonNullable<SurfaceRowProps['tone']>, string> = {\n default: '',\n muted: 'bg-[var(--malachite-card-dimmed-background)]',\n success: 'bg-[var(--malachite-tag-success-background)]',\n error: 'bg-[var(--malachite-tag-error-background)]',\n};\n\n/**\n * The text an outcome tone carries with it, through the same context channel a selected row\n * uses, so `Typography` inside the row follows the tint instead of staying near-black on it.\n * `color` as well, for row content that is not Typography.\n *\n * Only the outcome tones. `muted` dims its subject rather than recolouring it, and its\n * foreground is the ordinary one.\n */\nconst TONE_FOREGROUNDS: Partial<Record<NonNullable<SurfaceRowProps['tone']>, string>> = {\n success: 'var(--malachite-tag-success-foreground)',\n error: 'var(--malachite-tag-error-foreground)',\n};\n\nexport interface SurfaceRowAsChildProps extends SurfaceRowChromeProps {\n asChild: true;\n children: React.ReactElement;\n}\n\nexport type AnySurfaceRowProps = SurfaceRowProps | SurfaceRowAsChildProps;\n\n// Not `group-hover` or `group-has-[:focus-visible]`: WebKit never applies the first (its\n// `@media (hover: hover)` nested in the group selector) nor the second inside a shadow root,\n// so the control stayed hidden in Safari. An open menu takes focus out of the row into a\n// portal, and would otherwise lose its trigger.\nconst REVEALED_ON_INTERACTION =\n 'opacity-0 transition-opacity group-[:hover]/row:opacity-100 group-focus-within/row:opacity-100 has-[[aria-expanded=true]]:opacity-100 [@media(hover:none)]:opacity-100';\n\nconst selectsTextIn = (row: Element): boolean => {\n const root = row.getRootNode();\n const ownSelection = (root as Partial<Pick<Document, 'getSelection'>>).getSelection?.();\n const selection = ownSelection ?? row.ownerDocument.getSelection();\n if (!selection || selection.isCollapsed) {\n return false;\n }\n for (let index = 0; index < selection.rangeCount; index += 1) {\n if (selection.getRangeAt(index).intersectsNode(row)) {\n return true;\n }\n }\n return false;\n};\n\nconst forwardedClick = (event: MouseEvent): MouseEvent =>\n new (event.constructor as typeof MouseEvent)('click', event);\n\nconst TRIPLE_SHADOW =\n '0px 0px 4px 0px rgba(0,0,0,0.08), 0px 4px 4px 0px rgba(0,0,0,0.08), 0px 4px 10px 0px rgba(0,0,0,0.05)';\n\n/**\n * A single full-bleed row inside a <Surface>. Owns the row chrome — hover\n * highlight, colour transition and an optional bottom divider — so consumers\n * compose their own content inside without re-implementing design-system styling.\n * Pass `onClick`/`href` to make the entire row clickable (rendered as a real\n * button/anchor, so keyboard navigation works natively).\n */\nconst SurfaceRow: React.FC<AnySurfaceRowProps> = (props) => {\n const {\n children,\n divider = false,\n disabled = false,\n hover: hoverable = true,\n selected,\n selection,\n tone = 'default',\n inset = 'none',\n className = '',\n style,\n } = props;\n const asChild = props.asChild === true;\n const {\n onClick,\n href: rawHref,\n target,\n rel,\n trailing,\n revealTrailing,\n leading,\n dimmed,\n role,\n } = asChild ? ({} as SurfaceRowProps) : (props as SurfaceRowProps);\n // A rejected href (e.g. `javascript:`) leaves the row a button or a plain row, never an anchor.\n const href = safeHref(rawHref);\n const ariaLabel = asChild ? undefined : (props as SurfaceRowProps)['aria-label'];\n const ariaLabelledBy = asChild ? undefined : (props as SurfaceRowProps)['aria-labelledby'];\n const tabIndex = asChild ? undefined : (props as SurfaceRowProps).tabIndex;\n const interactive = Boolean(onClick || href);\n // `asChild` is interactive for the hover affordance only, not the focus/reset classes.\n const hover = disabled && (interactive || asChild) ? '' : hoverable ? ROW_HOVER : '';\n\n // A class, not an inline colour, which would outrank the hover utility. It replaces the\n // button reset's `bg-transparent` rather than joining it: same specificity, so the winner\n // would be whichever Tailwind emitted last.\n const tinted = tone !== 'default';\n const toneClass = TONE_CLASSES[tone];\n\n const hasTrailing = !asChild && isRenderableNode(trailing);\n const insetClass = INSET_CLASSES[inset];\n const controlPadding = insetClass ? '' : 'p-0';\n\n const chromeClasses = [\n 'w-full text-left border-0',\n toneClass,\n divider ? 'border-b border-solid border-[var(--malachite-card-border)]' : '',\n hover,\n ]\n .filter(Boolean)\n .join(' ');\n\n const controlReset = [\n 'appearance-none',\n tinted ? '' : 'bg-transparent',\n disabled ? '' : 'cursor-pointer',\n ];\n const rowClasses = (control: string[]) =>\n [chromeClasses, ...control, insetClass, className].filter(Boolean).join(' ');\n\n const paints = selection ? selection !== 'announce' : role !== 'checkbox';\n const accent = selection !== 'tint';\n\n const forwards = hasTrailing && Boolean(onClick) && !href && !disabled;\n const rowRef = useRef<HTMLDivElement>(null);\n const controlRef = useRef<HTMLButtonElement>(null);\n const pressLeftPadding = useRef(false);\n const startPress = (event: React.PointerEvent<HTMLDivElement>) => {\n pressLeftPadding.current = event.target !== event.currentTarget;\n };\n const trackPress = (event: React.PointerEvent<HTMLDivElement>) => {\n pressLeftPadding.current ||= event.target !== event.currentTarget;\n };\n useEffect(() => {\n const row = rowRef.current;\n if (!forwards || !row) {\n return undefined;\n }\n const forwardPaddingClick = (event: MouseEvent) => {\n const leftPadding = pressLeftPadding.current;\n pressLeftPadding.current = false;\n const control = controlRef.current;\n if (\n !control ||\n event.target !== row ||\n leftPadding ||\n (event.detail <= 1 && !event.shiftKey && selectsTextIn(row))\n ) {\n return;\n }\n event.stopPropagation();\n control.focus({ preventScroll: true });\n control.dispatchEvent(forwardedClick(event));\n };\n row.addEventListener('click', forwardPaddingClick);\n return () => row.removeEventListener('click', forwardPaddingClick);\n }, [forwards]);\n\n // A gradient layer so the tint composites over hover, and an inset shadow because\n // `ring-*` silently doesn't paint in a shadow root.\n const selectedStyle: React.CSSProperties =\n selected === true && paints\n ? {\n backgroundImage: `linear-gradient(${SELECTED_ROW_BACKGROUND}, ${SELECTED_ROW_BACKGROUND})`,\n color: SELECTED_ROW_FOREGROUND,\n ...(accent ? { boxShadow: `inset 2px 0 0 ${SELECTED_ROW_ACCENT}` } : {}),\n ...SELECTED_TEXT_CONTEXT,\n }\n : {};\n\n const toneForeground = TONE_FOREGROUNDS[tone];\n const toneStyle: React.CSSProperties = toneForeground\n ? ({\n color: toneForeground,\n '--malachite-ctx-text-primary': toneForeground,\n } as React.CSSProperties)\n : {};\n\n // `selected` last of the two: a row can be both, and selection is the state the reader is\n // acting on, so it wins the colour.\n const rowStyle = { ...toneStyle, ...selectedStyle, ...style };\n\n // Only a checkbox has a partly-checked state; a radio is chosen or not.\n const ariaChecked =\n role === 'checkbox' && selected === 'mixed'\n ? ('mixed' as const)\n : role === 'radio' || role === 'checkbox'\n ? selected === true\n : undefined;\n // `aria-current`, not `aria-pressed`: a selected row is one of many choices, not a toggle\n // (same call as `Dropdown`'s options). A role that carries its own state uses that instead.\n const ariaCurrent = ariaChecked === undefined && selected === true ? true : undefined;\n\n // Everything a control would have carried, for the branches that render none: the row\n // element is then the only thing assistive tech sees. `aria-disabled` because there is no\n // control to be natively disabled — and it is inert without a role, like the name.\n const rowFallbackAria = {\n role,\n 'aria-checked': ariaChecked,\n 'aria-current': ariaCurrent,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-disabled': role && disabled ? true : undefined,\n };\n\n if (asChild) {\n return paintOnChild(children, rowClasses([]), rowStyle);\n }\n\n // The set goes here, not on the wrapper: `radio` and `checkbox` make their\n // descendants presentational, which would bury a control in the trailing slot.\n const controlAria = {\n role,\n tabIndex,\n 'aria-checked': ariaChecked,\n 'aria-current': ariaCurrent,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n };\n\n const hasLeading = isRenderableNode(leading);\n const boxed = leading !== undefined || dimmed !== undefined;\n const content = boxed ? (\n <span className=\"flex w-full min-w-0 items-center gap-[12px]\">\n {hasLeading && <span className=\"shrink-0 flex items-center\">{leading}</span>}\n <span\n className={`grid flex-1 min-w-0 grid-cols-[minmax(0,1fr)] transition-opacity ${dimmed ? 'opacity-60' : ''}`}\n >\n {children}\n </span>\n </span>\n ) : (\n children\n );\n\n if (hasTrailing) {\n const focusRing = disabled ? null : (\n <span\n aria-hidden=\"true\"\n data-malachite-row-ring=\"\"\n className={FOCUS_RING_INSET_OVERLAY_HIDDEN}\n />\n );\n const rowControlClasses = [\n ...controlReset,\n 'outline-none border-0 p-0 flex-1 min-w-0 text-left',\n ]\n .filter(Boolean)\n .join(' ');\n const anchor = Boolean(href) && !disabled;\n const control = anchor ? (\n <a\n href={href}\n target={target}\n rel={resolveRel(rel, target)}\n onClick={onClick}\n className={`${rowControlClasses} no-underline text-inherit`}\n data-malachite-row-control=\"\"\n {...controlAria}\n >\n {content}\n {focusRing}\n </a>\n ) : onClick ? (\n <button\n ref={controlRef}\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={rowControlClasses}\n data-malachite-row-control=\"\"\n {...controlAria}\n >\n {content}\n {focusRing}\n </button>\n ) : (\n <div className=\"flex-1 min-w-0\" data-malachite-row-control=\"\" {...rowFallbackAria}>\n {content}\n </div>\n );\n\n return (\n <div\n className={[\n chromeClasses,\n 'relative flex items-center',\n forwards ? 'cursor-pointer' : '',\n insetClass,\n revealTrailing ? 'group/row' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n style={rowStyle}\n data-malachite-row=\"\"\n data-disabled={disabled ? '' : undefined}\n ref={rowRef}\n role={forwards ? 'presentation' : undefined}\n onPointerDownCapture={forwards ? startPress : undefined}\n onPointerUpCapture={forwards ? trackPress : undefined}\n >\n {control}\n <div\n className={`shrink-0 flex items-center ${forwards ? 'cursor-default' : ''} ${revealTrailing ? REVEALED_ON_INTERACTION : ''}`}\n data-malachite-row-slot=\"\"\n >\n {trailing}\n </div>\n </div>\n );\n }\n\n const classes = rowClasses(\n interactive ? [...controlReset, controlPadding, FOCUS_RING_INSET] : [],\n );\n\n if (href && !disabled) {\n return (\n <a\n href={href}\n target={target}\n rel={resolveRel(rel, target)}\n onClick={onClick}\n className={`${classes} no-underline text-inherit ${boxed ? 'block' : ''}`}\n style={rowStyle}\n {...controlAria}\n >\n {content}\n </a>\n );\n }\n\n if (onClick) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={classes}\n style={rowStyle}\n {...controlAria}\n >\n {content}\n </button>\n );\n }\n\n return (\n <div className={classes} style={rowStyle} {...rowFallbackAria}>\n {content}\n </div>\n );\n};\n\nexport interface SurfaceExpandableRowProps {\n /** The row itself, laid out across the line. May hold its own controls. */\n header: React.ReactNode;\n /** The body, rendered beneath the row while it is open. */\n children?: React.ReactNode;\n expanded: boolean;\n /** Omit for a row that cannot open. The arrow's space is still reserved, so a list of\n * rows stays in one column whether or not each one has a body. */\n onToggle?: (expanded: boolean) => void;\n /**\n * Pins the row while its body scrolls, so a long body never leaves the reader without\n * the line it belongs to. Offset by whatever is already pinned above it.\n */\n sticky?: boolean;\n stickyTopOffset?: number;\n divider?: boolean;\n tone?: SurfaceRowProps['tone'];\n /** Names the disclosure control, which is otherwise only an arrow. */\n 'aria-label'?: string;\n className?: string;\n style?: React.CSSProperties;\n}\n\n/**\n * Stops a click inside it from toggling the row, for the cells that hold controls.\n *\n * Explicit rather than sniffing the event's target for an interactive ancestor: a control\n * rendering into a shadow root retargets the event to its host, so the sniff would miss\n * exactly the components most likely to sit in a row.\n */\nconst ExpandableRowControls: React.FC<{\n children?: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n}> = ({ children, className = '', style }) => (\n <div className={className} style={style} onClick={(event) => event.stopPropagation()}>\n {children}\n </div>\n);\n\n/**\n * A row that opens to reveal a body, for a line that carries its own controls.\n *\n * Not `Accordion`: that puts its header inside the toggle button, so a header holding a\n * dropdown or a second button is invalid. Here the row surface takes the click and a cell\n * opts out with `ExpandableRow.Controls`, while the arrow stays a real button so the\n * keyboard reaches it.\n */\n/**\n * The space before the header: the arrow's own inset, its glyph and the gap after it.\n * Exported so a consumer aligning a column header above these rows offsets by the same\n * amount instead of guessing at it.\n */\nexport const EXPANDABLE_ROW_LEAD_PX = 39;\n\nconst SurfaceExpandableRow: React.FC<SurfaceExpandableRowProps> & {\n Controls: typeof ExpandableRowControls;\n} = Object.assign(\n ({\n header,\n children,\n expanded,\n onToggle,\n sticky = false,\n stickyTopOffset = 0,\n divider = false,\n tone = 'default',\n 'aria-label': ariaLabel,\n className = '',\n style,\n }: SurfaceExpandableRowProps) => {\n const bodyId = React.useId();\n const toggle = onToggle ? () => onToggle(!expanded) : undefined;\n\n return (\n // The hover is the header's, not the row's: the row holds the open body too, which is\n // not a target, and tinting it washes out everything in it.\n <SurfaceRow\n divider={divider}\n tone={tone}\n hover={false}\n className={className}\n style={style}\n >\n {/* `group` so the arrow takes its hover state from the whole header line. */}\n <div\n className={`group flex items-center w-full ${ROW_HOVER} ${\n toggle ? 'cursor-pointer' : ''\n } ${\n sticky && expanded\n ? 'sticky z-[1] bg-[var(--malachite-card-background)]'\n : ''\n }`}\n style={sticky && expanded ? { top: stickyTopOffset } : undefined}\n // Presentational: the arrow below is the keyboard control, and this only\n // widens the pointer target.\n onClick={toggle}\n role=\"presentation\"\n >\n {/* Reserved whether or not this row opens, so a list stays in one column.\n The inset and gap match Accordion's header. */}\n <span className=\"shrink-0 flex items-center pl-[16px] pr-[12px]\">\n {toggle && (\n <button\n type=\"button\"\n className={`appearance-none bg-transparent border-0 p-0 flex items-center cursor-pointer ${FOCUS_RING_INSET}`}\n aria-expanded={expanded}\n aria-controls={bodyId}\n aria-label={ariaLabel}\n onClick={(event) => {\n event.stopPropagation();\n toggle();\n }}\n >\n <DisclosureArrow expanded={expanded} />\n </button>\n )}\n </span>\n {header}\n </div>\n {expanded && <div id={bodyId}>{children}</div>}\n </SurfaceRow>\n );\n },\n { Controls: ExpandableRowControls },\n);\n\ninterface SurfaceComponent extends React.FC<SurfaceProps> {\n Row: React.FC<AnySurfaceRowProps>;\n ExpandableRow: typeof SurfaceExpandableRow;\n}\n\nconst SURFACE_TONE_CLASSES: Record<SurfaceTone, string> = {\n default:\n 'bg-[var(--malachite-card-background)] border border-solid border-[var(--malachite-card-border)]',\n highlight: 'bg-[var(--malachite-card-warm-background,rgb(244,242,240))]',\n};\n\nconst FLAT_CLIP_RING =\n \"relative after:pointer-events-none after:absolute after:-inset-px after:z-[9] after:rounded-[inherit] after:border after:border-solid after:[border-color:inherit] after:content-['']\";\n\nconst Surface = (({\n children,\n padding = false,\n overflow = 'hidden',\n tone = 'default',\n shadow = tone !== 'highlight',\n role,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className = '',\n style,\n}: SurfaceProps) => {\n // Literal class names (not interpolated) so Tailwind's JIT emits them.\n const clipsToBorder = overflow === 'clip' && !shadow && tone === 'default';\n const overflowClass = clipsToBorder\n ? 'overflow-visible'\n : overflow === 'clip'\n ? 'overflow-clip'\n : overflow === 'visible'\n ? 'overflow-visible'\n : 'overflow-hidden';\n return (\n <div\n className={`w-full rounded-[var(--malachite-radius-xxl,14px)] ${overflowClass} ${SURFACE_TONE_CLASSES[tone]} ${padding ? 'py-3 px-4' : ''} ${clipsToBorder ? FLAT_CLIP_RING : ''} ${className}`}\n style={{\n ...(shadow ? { boxShadow: TRIPLE_SHADOW } : {}),\n ...(clipsToBorder\n ? { clipPath: 'inset(0 round var(--malachite-radius-xxl, 14px))' }\n : {}),\n ...FOREGROUND_RESET,\n ...style,\n }}\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </div>\n );\n}) as SurfaceComponent;\n\nSurface.Row = SurfaceRow;\nSurface.ExpandableRow = SurfaceExpandableRow;\n\nexport default Surface;\nexport { Surface, SurfaceRow, SurfaceExpandableRow };\n"],"names":["INSET_CLASSES","TONE_CLASSES","TONE_FOREGROUNDS","REVEALED_ON_INTERACTION","selectsTextIn","row","root","selection","_a","index","forwardedClick","event","TRIPLE_SHADOW","SurfaceRow","props","children","divider","disabled","hoverable","selected","tone","inset","className","style","asChild","onClick","rawHref","target","rel","trailing","revealTrailing","leading","dimmed","role","href","safeHref","ariaLabel","ariaLabelledBy","tabIndex","interactive","hover","ROW_HOVER","tinted","toneClass","hasTrailing","isRenderableNode","insetClass","controlPadding","chromeClasses","controlReset","rowClasses","control","paints","accent","forwards","rowRef","useRef","controlRef","pressLeftPadding","startPress","trackPress","useEffect","forwardPaddingClick","leftPadding","selectedStyle","SELECTED_ROW_BACKGROUND","SELECTED_ROW_FOREGROUND","SELECTED_ROW_ACCENT","SELECTED_TEXT_CONTEXT","toneForeground","rowStyle","ariaChecked","ariaCurrent","rowFallbackAria","paintOnChild","controlAria","hasLeading","boxed","content","jsxs","jsx","focusRing","FOCUS_RING_INSET_OVERLAY_HIDDEN","rowControlClasses","resolveRel","classes","FOCUS_RING_INSET","ExpandableRowControls","EXPANDABLE_ROW_LEAD_PX","SurfaceExpandableRow","header","expanded","onToggle","sticky","stickyTopOffset","bodyId","React","toggle","DisclosureArrow","SURFACE_TONE_CLASSES","FLAT_CLIP_RING","Surface","padding","overflow","shadow","clipsToBorder","FOREGROUND_RESET"],"mappings":";;;;;;;;;;AA6EA,MAAMA,KAA6E;AAAA,EAC/E,MAAM;AAAA;AAAA,EAEN,SAAS;AACb,GAyCMC,KAAqE;AAAA,EACvE,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AACX,GAUMC,KAAkF;AAAA,EACpF,SAAS;AAAA,EACT,OAAO;AACX,GAaMC,KACF,0KAEEC,KAAgB,CAACC,MAA0B;;AAC7C,QAAMC,IAAOD,EAAI,YAAA,GAEXE,MADgBC,IAAAF,EAAiD,iBAAjD,gBAAAE,EAAA,KAAAF,OACYD,EAAI,cAAc,aAAA;AACpD,MAAI,CAACE,KAAaA,EAAU;AACxB,WAAO;AAEX,WAASE,IAAQ,GAAGA,IAA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["../../src/components/Surface.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport DisclosureArrow from './DisclosureArrow';\nimport { paintOnChild } from './asChild';\nimport { ROW_HOVER } from './chromeStyles';\nimport { FOCUS_RING_INSET, FOCUS_RING_INSET_OVERLAY_HIDDEN } from './focusRing';\nimport { resolveRel } from './linkRel';\nimport { isRenderableNode } from './renderableNode';\nimport { safeHref } from './safeHref';\nimport {\n FOREGROUND_RESET,\n SELECTED_ROW_ACCENT,\n SELECTED_ROW_BACKGROUND,\n SELECTED_ROW_FOREGROUND,\n SELECTED_TEXT_CONTEXT,\n} from './selectedRow';\n\nexport type SurfaceTone = 'default' | 'highlight';\n\nexport interface SurfaceProps {\n children?: React.ReactNode;\n padding?: boolean;\n /**\n * Content overflow. Defaults to `hidden` so children are clipped to the rounded\n * corners. Use `clip` to keep the rounded clipping WITHOUT creating a scroll\n * container — so a `position: sticky` descendant still pins (unlike `hidden`,\n * which traps it). `visible` disables clipping entirely. A flat, default-tone `clip` card clips at its border.\n */\n overflow?: 'hidden' | 'visible' | 'clip';\n /**\n * `false` drops the elevation shadow, for a card that sits flat on its ground.\n * Default: `true`, or `false` with `tone=\"highlight\"`.\n */\n shadow?: boolean;\n /**\n * `highlight` paints the warm ground with no border and no shadow, for a static block that\n * stands out from the page, such as a hero or a guide's section header. Its ground is too\n * close to `Surface.Row`'s hover for clickable rows inside it.\n */\n tone?: SurfaceTone;\n role?: React.AriaRole;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n className?: string;\n style?: React.CSSProperties;\n}\n\ninterface SurfaceRowChromeProps {\n children?: React.ReactNode;\n /** Renders a bottom divider — omit on the last row in a Surface. */\n divider?: boolean;\n /** Removes the hover affordance / disables the control (e.g. while loading/busy). */\n disabled?: boolean;\n /** Announces the row as selected — `aria-checked` under a `radio`/`checkbox` role,\n * `aria-current` otherwise — and paints `Table`'s selected treatment unless `selection`\n * says not to. `'mixed'` is for a `checkbox` row that is partly selected: it announces\n * `aria-checked=\"mixed\"` there, never paints and never marks the row current, and counts\n * as not selected under any other role. */\n selected?: boolean | 'mixed';\n /** How a `selected` row shows it. `highlight` paints the treatment; `tint` paints it\n * without the accent bar, for a menu whose choice is already marked inside the row;\n * `announce` leaves the visual to a control inside the row and only sets the ARIA state.\n * Defaults to `announce` under `role=\"checkbox\"` and `highlight` otherwise. */\n selection?: 'highlight' | 'tint' | 'announce';\n /**\n * Tints the whole row by what it reports. `muted` is a row whose subject is inactive —\n * not disabled: it stays interactive. `success`, `warning` and `error` are for a row that\n * carries an outcome, where the result belongs to the whole line rather than to one cell in it.\n */\n tone?: 'default' | 'muted' | 'success' | 'warning' | 'error';\n /** `compact` is an 8px by 16px inset the row owns. */\n inset?: 'none' | 'compact';\n /** `false` leaves the hover to something inside the row. */\n hover?: boolean;\n className?: string;\n style?: React.CSSProperties;\n}\n\nconst INSET_CLASSES: Record<NonNullable<SurfaceRowChromeProps['inset']>, string> = {\n none: '',\n // The 16px is ROW_INSET_PX in accordionBodyInset.ts too; Accordion's bodyIndent gives it back.\n compact: 'px-[16px] py-[8px]',\n};\n\n/** Stays an interface under its original name: a consumer may `extends` it. */\nexport interface SurfaceRowProps extends SurfaceRowChromeProps {\n asChild?: false;\n /**\n * When provided, the whole row becomes clickable: it renders as a `<button>`\n * (or `<a>` when `href` is set), so the entire row is the click target with\n * native focus + Enter/Space — no manual tabIndex/key handlers. For a\n * selectable row, put a presentational `<Radio>`/`<Checkbox>` inside as the\n * visual indicator; do NOT nest an interactive control (invalid + double tab stop).\n */\n onClick?: (event: React.MouseEvent) => void;\n /** Renders the clickable row as an anchor instead of a button. */\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n rel?: string;\n /** Content pinned right, outside the row button, so it may hold its own control. */\n trailing?: React.ReactNode;\n /**\n * Shows `trailing` only while the row is hovered or holds focus, and while a menu\n * it opened is still open. Hidden by opacity, so it stays in the tab order; a touch screen,\n * which has no hover, always shows it.\n */\n revealTrailing?: boolean;\n /** The row's indicator, before the children. With this or `dimmed`, pass one child. */\n leading?: React.ReactNode;\n /** Fades the children, not `leading` or `trailing`. */\n dimmed?: boolean;\n /** ARIA role for a clickable row, e.g. `radio`/`checkbox` (wrap the list in a `radiogroup`). */\n role?: React.AriaRole;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n /** `-1` takes the row out of the Tab order, for a roving radio group. */\n tabIndex?: number;\n}\n\n/**\n * The outcome tones reuse the tag tokens rather than minting row ones, so a row saying \"this\n * passed\" and a tag saying it are the same green wherever the two sit together.\n */\nconst TONE_CLASSES: Record<NonNullable<SurfaceRowProps['tone']>, string> = {\n default: '',\n muted: 'bg-[var(--malachite-card-dimmed-background)]',\n success: 'bg-[var(--malachite-tag-success-background,rgba(0,175,102,0.1))]',\n warning: 'bg-[var(--malachite-tag-warning-background,rgba(150,88,10,0.1))]',\n error: 'bg-[var(--malachite-tag-error-background,rgba(196,62,62,0.1))]',\n};\n\n/**\n * The text an outcome tone carries with it, through the same context channel a selected row\n * uses, so `Typography` inside the row follows the tint instead of staying near-black on it.\n * `color` as well, for row content that is not Typography.\n *\n * Only the outcome tones. `muted` dims its subject rather than recolouring it, and its\n * foreground is the ordinary one.\n */\nconst TONE_FOREGROUNDS: Partial<Record<NonNullable<SurfaceRowProps['tone']>, string>> = {\n success: 'var(--malachite-tag-success-foreground, rgb(2, 122, 66))',\n warning: 'var(--malachite-tag-warning-foreground, rgb(150, 88, 10))',\n error: 'var(--malachite-tag-error-foreground, rgb(196, 62, 62))',\n};\n\nexport interface SurfaceRowAsChildProps extends SurfaceRowChromeProps {\n asChild: true;\n children: React.ReactElement;\n}\n\nexport type AnySurfaceRowProps = SurfaceRowProps | SurfaceRowAsChildProps;\n\n// Not `group-hover` or `group-has-[:focus-visible]`: WebKit never applies the first (its\n// `@media (hover: hover)` nested in the group selector) nor the second inside a shadow root,\n// so the control stayed hidden in Safari. An open menu takes focus out of the row into a\n// portal, and would otherwise lose its trigger.\nconst REVEALED_ON_INTERACTION =\n 'opacity-0 transition-opacity group-[:hover]/row:opacity-100 group-focus-within/row:opacity-100 has-[[aria-expanded=true]]:opacity-100 [@media(hover:none)]:opacity-100';\n\nconst selectsTextIn = (row: Element): boolean => {\n const root = row.getRootNode();\n const ownSelection = (root as Partial<Pick<Document, 'getSelection'>>).getSelection?.();\n const selection = ownSelection ?? row.ownerDocument.getSelection();\n if (!selection || selection.isCollapsed) {\n return false;\n }\n for (let index = 0; index < selection.rangeCount; index += 1) {\n if (selection.getRangeAt(index).intersectsNode(row)) {\n return true;\n }\n }\n return false;\n};\n\nconst forwardedClick = (event: MouseEvent): MouseEvent =>\n new (event.constructor as typeof MouseEvent)('click', event);\n\nconst TRIPLE_SHADOW =\n '0px 0px 4px 0px rgba(0,0,0,0.08), 0px 4px 4px 0px rgba(0,0,0,0.08), 0px 4px 10px 0px rgba(0,0,0,0.05)';\n\n/**\n * A single full-bleed row inside a <Surface>. Owns the row chrome — hover\n * highlight, colour transition and an optional bottom divider — so consumers\n * compose their own content inside without re-implementing design-system styling.\n * Pass `onClick`/`href` to make the entire row clickable (rendered as a real\n * button/anchor, so keyboard navigation works natively).\n */\nconst SurfaceRow: React.FC<AnySurfaceRowProps> = (props) => {\n const {\n children,\n divider = false,\n disabled = false,\n hover: hoverable = true,\n selected,\n selection,\n tone = 'default',\n inset = 'none',\n className = '',\n style,\n } = props;\n const asChild = props.asChild === true;\n const {\n onClick,\n href: rawHref,\n target,\n rel,\n trailing,\n revealTrailing,\n leading,\n dimmed,\n role,\n } = asChild ? ({} as SurfaceRowProps) : (props as SurfaceRowProps);\n // A rejected href (e.g. `javascript:`) leaves the row a button or a plain row, never an anchor.\n const href = safeHref(rawHref);\n const ariaLabel = asChild ? undefined : (props as SurfaceRowProps)['aria-label'];\n const ariaLabelledBy = asChild ? undefined : (props as SurfaceRowProps)['aria-labelledby'];\n const tabIndex = asChild ? undefined : (props as SurfaceRowProps).tabIndex;\n const interactive = Boolean(onClick || href);\n // `asChild` is interactive for the hover affordance only, not the focus/reset classes.\n const hover = disabled && (interactive || asChild) ? '' : hoverable ? ROW_HOVER : '';\n\n // A class, not an inline colour, which would outrank the hover utility. It replaces the\n // button reset's `bg-transparent` rather than joining it: same specificity, so the winner\n // would be whichever Tailwind emitted last.\n const tinted = tone !== 'default';\n const toneClass = TONE_CLASSES[tone];\n\n const hasTrailing = !asChild && isRenderableNode(trailing);\n const insetClass = INSET_CLASSES[inset];\n const controlPadding = insetClass ? '' : 'p-0';\n\n const chromeClasses = [\n 'w-full text-left border-0',\n toneClass,\n divider ? 'border-b border-solid border-[var(--malachite-card-border)]' : '',\n hover,\n ]\n .filter(Boolean)\n .join(' ');\n\n const controlReset = [\n 'appearance-none',\n tinted ? '' : 'bg-transparent',\n disabled ? '' : 'cursor-pointer',\n ];\n const rowClasses = (control: string[]) =>\n [chromeClasses, ...control, insetClass, className].filter(Boolean).join(' ');\n\n const paints = selection ? selection !== 'announce' : role !== 'checkbox';\n const accent = selection !== 'tint';\n\n const forwards = hasTrailing && Boolean(onClick) && !href && !disabled;\n const rowRef = useRef<HTMLDivElement>(null);\n const controlRef = useRef<HTMLButtonElement>(null);\n const pressLeftPadding = useRef(false);\n const startPress = (event: React.PointerEvent<HTMLDivElement>) => {\n pressLeftPadding.current = event.target !== event.currentTarget;\n };\n const trackPress = (event: React.PointerEvent<HTMLDivElement>) => {\n pressLeftPadding.current ||= event.target !== event.currentTarget;\n };\n useEffect(() => {\n const row = rowRef.current;\n if (!forwards || !row) {\n return undefined;\n }\n const forwardPaddingClick = (event: MouseEvent) => {\n const leftPadding = pressLeftPadding.current;\n pressLeftPadding.current = false;\n const control = controlRef.current;\n if (\n !control ||\n event.target !== row ||\n leftPadding ||\n (event.detail <= 1 && !event.shiftKey && selectsTextIn(row))\n ) {\n return;\n }\n event.stopPropagation();\n control.focus({ preventScroll: true });\n control.dispatchEvent(forwardedClick(event));\n };\n row.addEventListener('click', forwardPaddingClick);\n return () => row.removeEventListener('click', forwardPaddingClick);\n }, [forwards]);\n\n // A gradient layer so the tint composites over hover, and an inset shadow because\n // `ring-*` silently doesn't paint in a shadow root.\n const selectedStyle: React.CSSProperties =\n selected === true && paints\n ? {\n backgroundImage: `linear-gradient(${SELECTED_ROW_BACKGROUND}, ${SELECTED_ROW_BACKGROUND})`,\n color: SELECTED_ROW_FOREGROUND,\n ...(accent ? { boxShadow: `inset 2px 0 0 ${SELECTED_ROW_ACCENT}` } : {}),\n ...SELECTED_TEXT_CONTEXT,\n }\n : {};\n\n const toneForeground = TONE_FOREGROUNDS[tone];\n const toneStyle: React.CSSProperties = toneForeground\n ? ({\n color: toneForeground,\n '--malachite-ctx-text-primary': toneForeground,\n } as React.CSSProperties)\n : {};\n\n // `selected` last of the two: a row can be both, and selection is the state the reader is\n // acting on, so it wins the colour.\n const rowStyle = { ...toneStyle, ...selectedStyle, ...style };\n\n // Only a checkbox has a partly-checked state; a radio is chosen or not.\n const ariaChecked =\n role === 'checkbox' && selected === 'mixed'\n ? ('mixed' as const)\n : role === 'radio' || role === 'checkbox'\n ? selected === true\n : undefined;\n // `aria-current`, not `aria-pressed`: a selected row is one of many choices, not a toggle\n // (same call as `Dropdown`'s options). A role that carries its own state uses that instead.\n const ariaCurrent = ariaChecked === undefined && selected === true ? true : undefined;\n\n // Everything a control would have carried, for the branches that render none: the row\n // element is then the only thing assistive tech sees. `aria-disabled` because there is no\n // control to be natively disabled — and it is inert without a role, like the name.\n const rowFallbackAria = {\n role,\n 'aria-checked': ariaChecked,\n 'aria-current': ariaCurrent,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-disabled': role && disabled ? true : undefined,\n };\n\n if (asChild) {\n return paintOnChild(children, rowClasses([]), rowStyle);\n }\n\n // The set goes here, not on the wrapper: `radio` and `checkbox` make their\n // descendants presentational, which would bury a control in the trailing slot.\n const controlAria = {\n role,\n tabIndex,\n 'aria-checked': ariaChecked,\n 'aria-current': ariaCurrent,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n };\n\n const hasLeading = isRenderableNode(leading);\n const boxed = leading !== undefined || dimmed !== undefined;\n const content = boxed ? (\n <span className=\"flex w-full min-w-0 items-center gap-[12px]\">\n {hasLeading && <span className=\"shrink-0 flex items-center\">{leading}</span>}\n <span\n className={`grid flex-1 min-w-0 grid-cols-[minmax(0,1fr)] transition-opacity ${dimmed ? 'opacity-60' : ''}`}\n >\n {children}\n </span>\n </span>\n ) : (\n children\n );\n\n if (hasTrailing) {\n const focusRing = disabled ? null : (\n <span\n aria-hidden=\"true\"\n data-malachite-row-ring=\"\"\n className={FOCUS_RING_INSET_OVERLAY_HIDDEN}\n />\n );\n const rowControlClasses = [\n ...controlReset,\n 'outline-none border-0 p-0 flex-1 min-w-0 text-left',\n ]\n .filter(Boolean)\n .join(' ');\n const anchor = Boolean(href) && !disabled;\n const control = anchor ? (\n <a\n href={href}\n target={target}\n rel={resolveRel(rel, target)}\n onClick={onClick}\n className={`${rowControlClasses} no-underline text-inherit`}\n data-malachite-row-control=\"\"\n {...controlAria}\n >\n {content}\n {focusRing}\n </a>\n ) : onClick ? (\n <button\n ref={controlRef}\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={rowControlClasses}\n data-malachite-row-control=\"\"\n {...controlAria}\n >\n {content}\n {focusRing}\n </button>\n ) : (\n <div className=\"flex-1 min-w-0\" data-malachite-row-control=\"\" {...rowFallbackAria}>\n {content}\n </div>\n );\n\n return (\n <div\n className={[\n chromeClasses,\n 'relative flex items-center',\n forwards ? 'cursor-pointer' : '',\n insetClass,\n revealTrailing ? 'group/row' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n style={rowStyle}\n data-malachite-row=\"\"\n data-disabled={disabled ? '' : undefined}\n ref={rowRef}\n role={forwards ? 'presentation' : undefined}\n onPointerDownCapture={forwards ? startPress : undefined}\n onPointerUpCapture={forwards ? trackPress : undefined}\n >\n {control}\n <div\n className={`shrink-0 flex items-center ${forwards ? 'cursor-default' : ''} ${revealTrailing ? REVEALED_ON_INTERACTION : ''}`}\n data-malachite-row-slot=\"\"\n >\n {trailing}\n </div>\n </div>\n );\n }\n\n const classes = rowClasses(\n interactive ? [...controlReset, controlPadding, FOCUS_RING_INSET] : [],\n );\n\n if (href && !disabled) {\n return (\n <a\n href={href}\n target={target}\n rel={resolveRel(rel, target)}\n onClick={onClick}\n className={`${classes} no-underline text-inherit ${boxed ? 'block' : ''}`}\n style={rowStyle}\n {...controlAria}\n >\n {content}\n </a>\n );\n }\n\n if (onClick) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={classes}\n style={rowStyle}\n {...controlAria}\n >\n {content}\n </button>\n );\n }\n\n return (\n <div className={classes} style={rowStyle} {...rowFallbackAria}>\n {content}\n </div>\n );\n};\n\nexport interface SurfaceExpandableRowProps {\n /** The row itself, laid out across the line. May hold its own controls. */\n header: React.ReactNode;\n /** The body, rendered beneath the row while it is open. */\n children?: React.ReactNode;\n expanded: boolean;\n /** Omit for a row that cannot open. The arrow's space is still reserved, so a list of\n * rows stays in one column whether or not each one has a body. */\n onToggle?: (expanded: boolean) => void;\n /**\n * Pins the row while its body scrolls, so a long body never leaves the reader without\n * the line it belongs to. Offset by whatever is already pinned above it.\n */\n sticky?: boolean;\n stickyTopOffset?: number;\n divider?: boolean;\n tone?: SurfaceRowProps['tone'];\n /** Names the disclosure control, which is otherwise only an arrow. */\n 'aria-label'?: string;\n className?: string;\n style?: React.CSSProperties;\n}\n\n/**\n * Stops a click inside it from toggling the row, for the cells that hold controls.\n *\n * Explicit rather than sniffing the event's target for an interactive ancestor: a control\n * rendering into a shadow root retargets the event to its host, so the sniff would miss\n * exactly the components most likely to sit in a row.\n */\nconst ExpandableRowControls: React.FC<{\n children?: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n}> = ({ children, className = '', style }) => (\n <div className={className} style={style} onClick={(event) => event.stopPropagation()}>\n {children}\n </div>\n);\n\n/**\n * A row that opens to reveal a body, for a line that carries its own controls.\n *\n * Not `Accordion`: that puts its header inside the toggle button, so a header holding a\n * dropdown or a second button is invalid. Here the row surface takes the click and a cell\n * opts out with `ExpandableRow.Controls`, while the arrow stays a real button so the\n * keyboard reaches it.\n */\n/**\n * The space before the header: the arrow's own inset, its glyph and the gap after it.\n * Exported so a consumer aligning a column header above these rows offsets by the same\n * amount instead of guessing at it.\n */\nexport const EXPANDABLE_ROW_LEAD_PX = 39;\n\nconst SurfaceExpandableRow: React.FC<SurfaceExpandableRowProps> & {\n Controls: typeof ExpandableRowControls;\n} = Object.assign(\n ({\n header,\n children,\n expanded,\n onToggle,\n sticky = false,\n stickyTopOffset = 0,\n divider = false,\n tone = 'default',\n 'aria-label': ariaLabel,\n className = '',\n style,\n }: SurfaceExpandableRowProps) => {\n const bodyId = React.useId();\n const toggle = onToggle ? () => onToggle(!expanded) : undefined;\n\n return (\n // The hover is the header's, not the row's: the row holds the open body too, which is\n // not a target, and tinting it washes out everything in it.\n <SurfaceRow\n divider={divider}\n tone={tone}\n hover={false}\n className={className}\n style={style}\n >\n {/* `group` so the arrow takes its hover state from the whole header line. */}\n <div\n className={`group flex items-center w-full ${ROW_HOVER} ${\n toggle ? 'cursor-pointer' : ''\n } ${\n sticky && expanded\n ? 'sticky z-[1] bg-[var(--malachite-card-background)]'\n : ''\n }`}\n style={sticky && expanded ? { top: stickyTopOffset } : undefined}\n // Presentational: the arrow below is the keyboard control, and this only\n // widens the pointer target.\n onClick={toggle}\n role=\"presentation\"\n >\n {/* Reserved whether or not this row opens, so a list stays in one column.\n The inset and gap match Accordion's header. */}\n <span className=\"shrink-0 flex items-center pl-[16px] pr-[12px]\">\n {toggle && (\n <button\n type=\"button\"\n className={`appearance-none bg-transparent border-0 p-0 flex items-center cursor-pointer ${FOCUS_RING_INSET}`}\n aria-expanded={expanded}\n aria-controls={bodyId}\n aria-label={ariaLabel}\n onClick={(event) => {\n event.stopPropagation();\n toggle();\n }}\n >\n <DisclosureArrow expanded={expanded} />\n </button>\n )}\n </span>\n {header}\n </div>\n {expanded && <div id={bodyId}>{children}</div>}\n </SurfaceRow>\n );\n },\n { Controls: ExpandableRowControls },\n);\n\ninterface SurfaceComponent extends React.FC<SurfaceProps> {\n Row: React.FC<AnySurfaceRowProps>;\n ExpandableRow: typeof SurfaceExpandableRow;\n}\n\nconst SURFACE_TONE_CLASSES: Record<SurfaceTone, string> = {\n default:\n 'bg-[var(--malachite-card-background)] border border-solid border-[var(--malachite-card-border)]',\n highlight: 'bg-[var(--malachite-card-warm-background,rgb(244,242,240))]',\n};\n\nconst FLAT_CLIP_RING =\n \"relative after:pointer-events-none after:absolute after:-inset-px after:z-[9] after:rounded-[inherit] after:border after:border-solid after:[border-color:inherit] after:content-['']\";\n\nconst Surface = (({\n children,\n padding = false,\n overflow = 'hidden',\n tone = 'default',\n shadow = tone !== 'highlight',\n role,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className = '',\n style,\n}: SurfaceProps) => {\n // Literal class names (not interpolated) so Tailwind's JIT emits them.\n const clipsToBorder = overflow === 'clip' && !shadow && tone === 'default';\n const overflowClass = clipsToBorder\n ? 'overflow-visible'\n : overflow === 'clip'\n ? 'overflow-clip'\n : overflow === 'visible'\n ? 'overflow-visible'\n : 'overflow-hidden';\n return (\n <div\n className={`w-full rounded-[var(--malachite-radius-xxl,14px)] ${overflowClass} ${SURFACE_TONE_CLASSES[tone]} ${padding ? 'py-3 px-4' : ''} ${clipsToBorder ? FLAT_CLIP_RING : ''} ${className}`}\n style={{\n ...(shadow ? { boxShadow: TRIPLE_SHADOW } : {}),\n ...(clipsToBorder\n ? { clipPath: 'inset(0 round var(--malachite-radius-xxl, 14px))' }\n : {}),\n ...FOREGROUND_RESET,\n ...style,\n }}\n role={role}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n {children}\n </div>\n );\n}) as SurfaceComponent;\n\nSurface.Row = SurfaceRow;\nSurface.ExpandableRow = SurfaceExpandableRow;\n\nexport default Surface;\nexport { Surface, SurfaceRow, SurfaceExpandableRow };\n"],"names":["INSET_CLASSES","TONE_CLASSES","TONE_FOREGROUNDS","REVEALED_ON_INTERACTION","selectsTextIn","row","root","selection","_a","index","forwardedClick","event","TRIPLE_SHADOW","SurfaceRow","props","children","divider","disabled","hoverable","selected","tone","inset","className","style","asChild","onClick","rawHref","target","rel","trailing","revealTrailing","leading","dimmed","role","href","safeHref","ariaLabel","ariaLabelledBy","tabIndex","interactive","hover","ROW_HOVER","tinted","toneClass","hasTrailing","isRenderableNode","insetClass","controlPadding","chromeClasses","controlReset","rowClasses","control","paints","accent","forwards","rowRef","useRef","controlRef","pressLeftPadding","startPress","trackPress","useEffect","forwardPaddingClick","leftPadding","selectedStyle","SELECTED_ROW_BACKGROUND","SELECTED_ROW_FOREGROUND","SELECTED_ROW_ACCENT","SELECTED_TEXT_CONTEXT","toneForeground","rowStyle","ariaChecked","ariaCurrent","rowFallbackAria","paintOnChild","controlAria","hasLeading","boxed","content","jsxs","jsx","focusRing","FOCUS_RING_INSET_OVERLAY_HIDDEN","rowControlClasses","resolveRel","classes","FOCUS_RING_INSET","ExpandableRowControls","EXPANDABLE_ROW_LEAD_PX","SurfaceExpandableRow","header","expanded","onToggle","sticky","stickyTopOffset","bodyId","React","toggle","DisclosureArrow","SURFACE_TONE_CLASSES","FLAT_CLIP_RING","Surface","padding","overflow","shadow","clipsToBorder","FOREGROUND_RESET"],"mappings":";;;;;;;;;;AA6EA,MAAMA,KAA6E;AAAA,EAC/E,MAAM;AAAA;AAAA,EAEN,SAAS;AACb,GAyCMC,KAAqE;AAAA,EACvE,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACX,GAUMC,KAAkF;AAAA,EACpF,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACX,GAaMC,KACF,0KAEEC,KAAgB,CAACC,MAA0B;;AAC7C,QAAMC,IAAOD,EAAI,YAAA,GAEXE,MADgBC,IAAAF,EAAiD,iBAAjD,gBAA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tB;AAAA,IAAA;AAAA,EAAA;AAGb;AAEAsF,GAAQ,MAAMxF;AACdwF,GAAQ,gBAAgBZ;"}
@@ -1,15 +1,17 @@
1
- const r = "bg-[var(--malachite-table-background,#f7f7f7)] p-[4px] rounded-xl", o = "var(--malachite-table-background, #f7f7f7)", c = 4, e = "var(--malachite-radius-xl, 12px)", t = 8, a = "1px solid var(--malachite-card-border, #e8e8e8)", R = {
1
+ import { MODAL_TRAY_BACKGROUND as r } from "./modalTray.js";
2
+ const t = "bg-[var(--malachite-table-background,#f7f7f7)] p-[4px] rounded-xl", d = "var(--malachite-table-background, #f7f7f7)", n = 4, A = "var(--malachite-radius-xl, 12px)", o = 8, c = "1px solid var(--malachite-card-border, #e8e8e8)", R = {
2
3
  background: "var(--malachite-table-row-background, #fff)",
3
- border: a,
4
- borderRadius: 8
5
- };
4
+ border: c,
5
+ borderRadius: o
6
+ }, l = (a) => a === "neutral" ? void 0 : r[a];
6
7
  export {
7
- o as FRAME_BACKGROUND,
8
- r as FRAME_CLASS,
9
- c as FRAME_PADDING,
10
- e as FRAME_RADIUS,
11
- a as FRAME_SECTION_BORDER,
12
- t as FRAME_SECTION_RADIUS,
13
- R as FRAME_SECTION_STYLE
8
+ d as FRAME_BACKGROUND,
9
+ t as FRAME_CLASS,
10
+ n as FRAME_PADDING,
11
+ A as FRAME_RADIUS,
12
+ c as FRAME_SECTION_BORDER,
13
+ o as FRAME_SECTION_RADIUS,
14
+ R as FRAME_SECTION_STYLE,
15
+ l as frameToneBackground
14
16
  };
15
17
  //# sourceMappingURL=frameStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"frameStyles.js","sources":["../../src/components/frameStyles.ts"],"sourcesContent":["import type React from 'react';\n\n/**\n * The grey frame the detached Table draws around its header and rows, shared with Card's\n * `framed` variant so a card and the table beside it read as one set in both themes.\n */\nexport const FRAME_CLASS = 'bg-[var(--malachite-table-background,#f7f7f7)] p-[4px] rounded-xl';\n/** The colour in `FRAME_CLASS`, for a ground set inline, such as a pinned header over the frame. */\nexport const FRAME_BACKGROUND = 'var(--malachite-table-background, #f7f7f7)';\n/** The `p-[4px]` in `FRAME_CLASS`, for geometry that has to offset it. */\nexport const FRAME_PADDING = 4;\n/** The radius `rounded-xl` in `FRAME_CLASS` resolves to. Read from the same token, or overriding\n * `radius.xl` pinches the corners of anything drawn to match them. */\nexport const FRAME_RADIUS = 'var(--malachite-radius-xl, 12px)';\n\n/** The bordered section inside the frame is clipped to this radius. The detached Table's first\n * and last rows echo it, so a selected row's accent bar curves into the corner instead of\n * being cut off by the clip. */\nexport const FRAME_SECTION_RADIUS = 8;\nexport const FRAME_SECTION_BORDER = '1px solid var(--malachite-card-border, #e8e8e8)';\n\n/** The bordered section a framed Card's children sit in, as the detached Table's rows do. */\nexport const FRAME_SECTION_STYLE: React.CSSProperties = {\n background: 'var(--malachite-table-row-background, #fff)',\n border: FRAME_SECTION_BORDER,\n borderRadius: FRAME_SECTION_RADIUS,\n};\n"],"names":["FRAME_CLASS","FRAME_BACKGROUND","FRAME_PADDING","FRAME_RADIUS","FRAME_SECTION_RADIUS","FRAME_SECTION_BORDER","FRAME_SECTION_STYLE"],"mappings":"AAMO,MAAMA,IAAc,qEAEdC,IAAmB,8CAEnBC,IAAgB,GAGhBC,IAAe,oCAKfC,IAAuB,GACvBC,IAAuB,mDAGvBC,IAA2C;AAAA,EACpD,YAAY;AAAA,EACZ,QAAQD;AAAA,EACR,cAAc;AAClB;"}
1
+ {"version":3,"file":"frameStyles.js","sources":["../../src/components/frameStyles.ts"],"sourcesContent":["import type React from 'react';\nimport { MODAL_TRAY_BACKGROUND, type ModalTrayTone } from './modalTray';\n\n/**\n * The grey frame the detached Table draws around its header and rows, shared with Card's\n * `framed` variant so a card and the table beside it read as one set in both themes.\n */\nexport const FRAME_CLASS = 'bg-[var(--malachite-table-background,#f7f7f7)] p-[4px] rounded-xl';\n/** The colour in `FRAME_CLASS`, for a ground set inline, such as a pinned header over the frame. */\nexport const FRAME_BACKGROUND = 'var(--malachite-table-background, #f7f7f7)';\n/** The `p-[4px]` in `FRAME_CLASS`, for geometry that has to offset it. */\nexport const FRAME_PADDING = 4;\n/** The radius `rounded-xl` in `FRAME_CLASS` resolves to. Read from the same token, or overriding\n * `radius.xl` pinches the corners of anything drawn to match them. */\nexport const FRAME_RADIUS = 'var(--malachite-radius-xl, 12px)';\n\n/** The bordered section inside the frame is clipped to this radius. The detached Table's first\n * and last rows echo it, so a selected row's accent bar curves into the corner instead of\n * being cut off by the clip. */\nexport const FRAME_SECTION_RADIUS = 8;\nexport const FRAME_SECTION_BORDER = '1px solid var(--malachite-card-border, #e8e8e8)';\n\n/** The bordered section a framed Card's children sit in, as the detached Table's rows do. */\nexport const FRAME_SECTION_STYLE: React.CSSProperties = {\n background: 'var(--malachite-table-row-background, #fff)',\n border: FRAME_SECTION_BORDER,\n borderRadius: FRAME_SECTION_RADIUS,\n};\n\n/**\n * The frame's ground for a tone, the `Modal` tray colour of that outcome. `neutral` returns\n * nothing, so the frame keeps `FRAME_CLASS`'s grey and still matches a detached Table.\n */\nexport const frameToneBackground = (tone: ModalTrayTone): string | undefined =>\n tone === 'neutral' ? undefined : MODAL_TRAY_BACKGROUND[tone];\n"],"names":["FRAME_CLASS","FRAME_BACKGROUND","FRAME_PADDING","FRAME_RADIUS","FRAME_SECTION_RADIUS","FRAME_SECTION_BORDER","FRAME_SECTION_STYLE","frameToneBackground","tone","MODAL_TRAY_BACKGROUND"],"mappings":";AAOO,MAAMA,IAAc,qEAEdC,IAAmB,8CAEnBC,IAAgB,GAGhBC,IAAe,oCAKfC,IAAuB,GACvBC,IAAuB,mDAGvBC,IAA2C;AAAA,EACpD,YAAY;AAAA,EACZ,QAAQD;AAAA,EACR,cAAcD;AAClB,GAMaG,IAAsB,CAACC,MAChCA,MAAS,YAAY,SAAYC,EAAsBD,CAAI;"}
@@ -4,10 +4,10 @@ const a = {
4
4
  error: "var(--malachite-tag-error-foreground)",
5
5
  success: "var(--malachite-tag-success-foreground)"
6
6
  }, r = {
7
- neutral: "var(--malachite-card-tray-neutral, var(--malachite-card-dimmed-background))",
8
- warning: "var(--malachite-card-tray-warning, var(--malachite-table-row-variant-warning-background))",
9
- error: "var(--malachite-card-tray-error, var(--malachite-table-row-variant-error-background))",
10
- success: "var(--malachite-card-tray-success, var(--malachite-table-row-variant-success-background))"
7
+ neutral: "var(--malachite-card-tray-neutral, var(--malachite-card-dimmed-background, rgb(247, 247, 247)))",
8
+ warning: "var(--malachite-card-tray-warning, var(--malachite-table-row-variant-warning-background, rgb(253, 243, 230)))",
9
+ error: "var(--malachite-card-tray-error, var(--malachite-table-row-variant-error-background, rgb(254, 241, 241)))",
10
+ success: "var(--malachite-card-tray-success, var(--malachite-table-row-variant-success-background, rgb(236, 249, 244)))"
11
11
  };
12
12
  export {
13
13
  r as MODAL_TRAY_BACKGROUND,
@@ -1 +1 @@
1
- {"version":3,"file":"modalTray.js","sources":["../../src/components/modalTray.ts"],"sourcesContent":["export type ModalTrayTone = 'neutral' | 'warning' | 'error' | 'success';\n\nexport const MODAL_TRAY_CAPTION_COLOR: Record<ModalTrayTone, string> = {\n neutral: 'var(--malachite-text-secondary)',\n warning: 'var(--malachite-tag-warning-foreground)',\n error: 'var(--malachite-tag-error-foreground)',\n success: 'var(--malachite-tag-success-foreground)',\n};\n\nexport const MODAL_TRAY_BACKGROUND: Record<ModalTrayTone, string> = {\n neutral: 'var(--malachite-card-tray-neutral, var(--malachite-card-dimmed-background))',\n warning:\n 'var(--malachite-card-tray-warning, var(--malachite-table-row-variant-warning-background))',\n error: 'var(--malachite-card-tray-error, var(--malachite-table-row-variant-error-background))',\n success:\n 'var(--malachite-card-tray-success, var(--malachite-table-row-variant-success-background))',\n};\n"],"names":["MODAL_TRAY_CAPTION_COLOR","MODAL_TRAY_BACKGROUND"],"mappings":"AAEO,MAAMA,IAA0D;AAAA,EACnE,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AACb,GAEaC,IAAuD;AAAA,EAChE,SAAS;AAAA,EACT,SACI;AAAA,EACJ,OAAO;AAAA,EACP,SACI;AACR;"}
1
+ {"version":3,"file":"modalTray.js","sources":["../../src/components/modalTray.ts"],"sourcesContent":["export type ModalTrayTone = 'neutral' | 'warning' | 'error' | 'success';\n\nexport const MODAL_TRAY_CAPTION_COLOR: Record<ModalTrayTone, string> = {\n neutral: 'var(--malachite-text-secondary)',\n warning: 'var(--malachite-tag-warning-foreground)',\n error: 'var(--malachite-tag-error-foreground)',\n success: 'var(--malachite-tag-success-foreground)',\n};\n\nexport const MODAL_TRAY_BACKGROUND: Record<ModalTrayTone, string> = {\n neutral:\n 'var(--malachite-card-tray-neutral, var(--malachite-card-dimmed-background, rgb(247, 247, 247)))',\n warning:\n 'var(--malachite-card-tray-warning, var(--malachite-table-row-variant-warning-background, rgb(253, 243, 230)))',\n error: 'var(--malachite-card-tray-error, var(--malachite-table-row-variant-error-background, rgb(254, 241, 241)))',\n success:\n 'var(--malachite-card-tray-success, var(--malachite-table-row-variant-success-background, rgb(236, 249, 244)))',\n};\n"],"names":["MODAL_TRAY_CAPTION_COLOR","MODAL_TRAY_BACKGROUND"],"mappings":"AAEO,MAAMA,IAA0D;AAAA,EACnE,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AACb,GAEaC,IAAuD;AAAA,EAChE,SACI;AAAA,EACJ,SACI;AAAA,EACJ,OAAO;AAAA,EACP,SACI;AACR;"}
package/dist/index.d.ts CHANGED
@@ -267,6 +267,8 @@ declare interface AlertProps {
267
267
 
268
268
  export declare type AlertType = 'info' | 'success' | 'error' | 'warning' | 'assistant';
269
269
 
270
+ export declare type AnyCardProps = CardProps | FramedCardProps;
271
+
270
272
  export declare type AnySurfaceRowProps = SurfaceRowProps | SurfaceRowAsChildProps;
271
273
 
272
274
  export declare const ApiKeysIcon: React.FC<IconProps_5>;
@@ -570,17 +572,14 @@ export declare type ButtonVariant = 'filled' | 'outline'
570
572
  /** Secondary text on no ground, primary on hover or focus: a row's secondary affordance, e.g. its open chevron. */
571
573
  | 'subtle' | 'no-style';
572
574
 
573
- export declare const Card: default_2.FC<CardProps>;
575
+ export declare const Card: default_2.FC<AnyCardProps>;
574
576
 
575
577
  export declare const CardIcon: React.FC<IconProps_19>;
576
578
 
577
- declare interface CardProps {
578
- /**
579
- * `framed` draws the detached Table's frame: the title row sits on a grey frame and the
580
- * children in a bordered section inside it, so a card above a table reads as part of the
581
- * same set. `dimmed`, `border`, `size`, `glassFooter` and `headerConfig` do not apply to it.
582
- */
579
+ export declare interface CardProps {
583
580
  variant?: CardVariant;
581
+ /** Only a framed card takes a tone; see `FramedCardProps`. */
582
+ tone?: never;
584
583
  title?: string | default_2.ReactNode;
585
584
  /** Dimmed text beside the title, such as a count or a unit. */
586
585
  subtitle?: default_2.ReactNode;
@@ -661,6 +660,13 @@ export declare interface CardStripProps {
661
660
  /** Palette for the strip's rule. Pass the tone of whatever card is selected. */
662
661
  export declare type CardStripTone = 'profile' | 'library' | 'editing';
663
662
 
663
+ export declare type CardTone = ModalTrayTone;
664
+
665
+ /**
666
+ * `framed` draws the detached Table's frame: the title row sits on a grey frame and the children
667
+ * in a bordered section inside it, so a card above a table reads as part of the same set.
668
+ * `dimmed`, `border`, `size`, `glassFooter` and `headerConfig` do not apply to it.
669
+ */
664
670
  export declare type CardVariant = 'default' | 'framed';
665
671
 
666
672
  export declare const CaretDoubleLeftIcon: React.FC<IconProps_20>;
@@ -2434,6 +2440,16 @@ export declare interface FormStepsProps {
2434
2440
 
2435
2441
  export declare const ForwardArrowIcon: React.FC<IconProps_63>;
2436
2442
 
2443
+ /** A framed card, which alone takes a `tone`. A second interface so `CardProps` keeps its shape. */
2444
+ export declare interface FramedCardProps extends Omit<CardProps, 'variant' | 'tone'> {
2445
+ variant: Extract<CardVariant, 'framed'>;
2446
+ /**
2447
+ * Paints the frame in the tray colour of the outcome it reports, as `Modal`'s `tray` does.
2448
+ * `neutral` keeps the default grey frame, so it still matches a detached Table.
2449
+ */
2450
+ tone?: CardTone;
2451
+ }
2452
+
2437
2453
  /**
2438
2454
  * Get current theme values from CSS custom properties
2439
2455
  */
@@ -3710,7 +3726,8 @@ export declare interface LinkProps {
3710
3726
  rel?: string;
3711
3727
  children: default_2.ReactNode;
3712
3728
  className?: string;
3713
- color?: 'default' | 'dimmed';
3729
+ /** `inherit` takes the surrounding text colour and is always underlined, whatever `underline` says. */
3730
+ color?: 'default' | 'dimmed' | 'inherit';
3714
3731
  size?: FontSize;
3715
3732
  underline?: boolean;
3716
3733
  /** Lets the link shrink as a flex item and ends an overflowing label with an ellipsis; a wrapper around the link must shrink too. */
@@ -6070,10 +6087,10 @@ declare interface SurfaceRowChromeProps {
6070
6087
  selection?: 'highlight' | 'tint' | 'announce';
6071
6088
  /**
6072
6089
  * Tints the whole row by what it reports. `muted` is a row whose subject is inactive —
6073
- * not disabled: it stays interactive. `success` and `error` are for a row that carries
6074
- * an outcome, where the result belongs to the whole line rather than to one cell in it.
6090
+ * not disabled: it stays interactive. `success`, `warning` and `error` are for a row that
6091
+ * carries an outcome, where the result belongs to the whole line rather than to one cell in it.
6075
6092
  */
6076
- tone?: 'default' | 'muted' | 'success' | 'error';
6093
+ tone?: 'default' | 'muted' | 'success' | 'warning' | 'error';
6077
6094
  /** `compact` is an 8px by 16px inset the row owns. */
6078
6095
  inset?: 'none' | 'compact';
6079
6096
  /** `false` leaves the hover to something inside the row. */