@stackone/malachite 2.91.0 → 2.93.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/COMPONENTS.md +2 -2
  2. package/dist/components/Accordion.js +52 -49
  3. package/dist/components/Accordion.js.map +1 -1
  4. package/dist/components/Chat/ChatReasoning.js +40 -0
  5. package/dist/components/Chat/ChatReasoning.js.map +1 -0
  6. package/dist/components/Chat/ChatToolCall.js +57 -43
  7. package/dist/components/Chat/ChatToolCall.js.map +1 -1
  8. package/dist/components/Chat/index.js +12 -10
  9. package/dist/components/Chat/index.js.map +1 -1
  10. package/dist/components/Chat/stickToBottom.js +23 -17
  11. package/dist/components/Chat/stickToBottom.js.map +1 -1
  12. package/dist/components/CodeBlock.js +49 -48
  13. package/dist/components/CodeBlock.js.map +1 -1
  14. package/dist/components/CodeBlockHighlighter.js +22 -22
  15. package/dist/components/CodeBlockHighlighter.js.map +1 -1
  16. package/dist/components/FilterSearch.js +318 -282
  17. package/dist/components/FilterSearch.js.map +1 -1
  18. package/dist/components/Modal.js +58 -59
  19. package/dist/components/Modal.js.map +1 -1
  20. package/dist/components/SidePanel.js +47 -48
  21. package/dist/components/SidePanel.js.map +1 -1
  22. package/dist/components/Typography/MarkdownBlock.js +136 -103
  23. package/dist/components/Typography/MarkdownBlock.js.map +1 -1
  24. package/dist/components/afterNextPaint.js +11 -0
  25. package/dist/components/afterNextPaint.js.map +1 -0
  26. package/dist/components/codeBlockStyles.js +6 -5
  27. package/dist/components/codeBlockStyles.js.map +1 -1
  28. package/dist/components/filterSearchModel.js +32 -31
  29. package/dist/components/filterSearchModel.js.map +1 -1
  30. package/dist/components/frameStyles.js +6 -5
  31. package/dist/components/frameStyles.js.map +1 -1
  32. package/dist/index.d.ts +29 -7
  33. package/dist/tailwind.css.js +1 -1
  34. package/package.json +1 -1
package/COMPONENTS.md CHANGED
@@ -6,7 +6,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
6
6
 
7
7
  ## Layout & containers
8
8
 
9
- - **`Chat`** — A chat column: `Chat.Thread` scrolls and pins itself to the newest message, `Chat.Composer` keeps its own height and owns the Enter/Shift+Enter convention, and `Chat.Message`, `Chat.ToolCall` and `Chat.Thinking` render one turn each. A user turn sits right and hugs its text; an assistant turn runs full width, and `variant="card"` frames it with its state, copy and rating controls, and a token/model line. `variant="bubble"` is a third treatment, not a repaint of either: tinted bubbles whose flattened corner points at whoever spoke, so authorship reads before the words do. `Chat.Context` lists what the conversation can see — a removable chip per source, and an add affordance only when a handler is given. `Chat.Thinking` and a loading turn draw bars in the shape of the answer rather than a spinner. The row under a composer is `ComposerChip`, `ContextMeter` and `ModelPicker` — PillButton tabs, so it reads as attached to the field; `ModelPicker` opens a portalled menu with a submenu per model. The transcript is a live `log` region, so a streamed reply is announced, and it shows a centred empty state until the first turn. _Key props:_ `Chat`: `children`, `className`. `Thread`: `aria-label`, `emptyTitle`, `emptyDescription`, `emptyIcon`. `Message`: `role`, `variant` (`plain` | `card`), `content`, `children`, `name`, `avatarSrc`, `status` (`streaming` | `completed` | `error`), `loading`, `onCopy`, `onFeedback`, `usage`. `ToolCall`: `name`, `status` (`running` | `completed` | `error`), `callId`, `input`, `output`, `defaultExpanded`. `Thinking`: `label`. `Composer`: `value`, `onChange`, `onSend`, `onStop`, `busy`, `disabled`, `placeholder`, `maxLength`, `rows`, `children`. `ComposerChip`: `label`, `icon`, `trailingIcon`, `onClick`, `disabled`. `ContextMeter`: `used`, `limit`, `cached`, `label`. `ModelPicker`: `models`, `value`, `optionValue`, `onChange`, `openUp`, `disabled`. `Context`: `label`, `items` (`{id, label, onRemove?}`), `onAdd`, `className`.
9
+ - **`Chat`** — A chat column: `Chat.Thread` scrolls and pins itself to the newest message, `Chat.Composer` keeps its own height and owns the Enter/Shift+Enter convention, and `Chat.Message`, `Chat.ToolCall` and `Chat.Thinking` render one turn each. A user turn sits right and hugs its text; an assistant turn runs full width, and `variant="card"` frames it with its state, copy and rating controls, and a token/model line. `variant="bubble"` is a third treatment, not a repaint of either: tinted bubbles whose flattened corner points at whoever spoke, so authorship reads before the words do. `Chat.Context` lists what the conversation can see — a removable chip per source, and an add affordance only when a handler is given. `Chat.Thinking` and a loading turn draw bars in the shape of the answer rather than a spinner. `Chat.Reasoning` shows what a model reasoned, open while it arrives and shut once it stops, until the reader toggles it. `Chat.ToolCall` mounts its payloads only once opened, since a result can be tens of KB; `blocked` is a call something refused to run, as distinct from `error`. The row under a composer is `ComposerChip`, `ContextMeter` and `ModelPicker` — PillButton tabs, so it reads as attached to the field; `ModelPicker` opens a portalled menu with a submenu per model. The transcript is a live `log` region, so a streamed reply is announced, and it shows a centred empty state until the first turn. _Key props:_ `Chat`: `children`, `className`. `Thread`: `aria-label`, `emptyTitle`, `emptyDescription`, `emptyIcon`. `Message`: `role`, `variant` (`plain` | `card`), `content`, `children`, `name`, `avatarSrc`, `status` (`streaming` | `completed` | `error`), `loading`, `onCopy`, `onFeedback`, `usage`. `ToolCall`: `name`, `status` (`running` | `completed` | `error` | `blocked`), `callId`, `input` and `output` (an object, or a string shown as it is), `adornment`, `children`, `defaultExpanded`. `Reasoning`: `text`, `streaming`, `title`. `Thinking`: `label`. `Composer`: `value`, `onChange`, `onSend`, `onStop`, `busy`, `disabled`, `placeholder`, `maxLength`, `rows`, `children`. `ComposerChip`: `label`, `icon`, `trailingIcon`, `onClick`, `disabled`. `ContextMeter`: `used`, `limit`, `cached`, `label`. `ModelPicker`: `models`, `value`, `optionValue`, `onChange`, `openUp`, `disabled`. `Context`: `label`, `items` (`{id, label, onRemove?}`), `onAdd`, `className`.
10
10
  - **`Surface`** — Rounded, bordered card container with the standard elevation shadow. Use `overflow="clip"` to keep the rounded clipping while letting a `position: sticky` descendant still pin (`hidden` would trap it); `visible` disables clipping. _Key props:_ `children`, `padding`, `overflow`, `shadow` (`false` sits the card flat, without the elevation shadow), `tone` (`default` | `highlight`; `highlight` paints the warm ground with no border, and sits flat unless `shadow` is passed, for a static block that stands out from the page, such as a hero or a guide's section header; its ground is too close to `Surface.Row`'s hover for clickable rows inside it), `className`, `style`.
11
11
  - **`SurfaceRow`** — A full-bleed row inside a Surface (used as `Surface.Row`). Owns hover highlight, colour transition and an optional bottom divider. Pass `onClick`/`href` to make the whole row clickable (renders as a real button/anchor, so keyboard nav works). For a selectable row use `role="radio"` + `selected` and put a presentational `<Radio>` inside as the indicator; `selected` then paints the same treatment `Table` gives `selectedRowKey`. Under `role="checkbox"` it only announces — a multi-select row carries its own checkbox, and a highlight marking one of many says nothing when most rows are checked. `selection` overrides that either way (`highlight` / `announce`). `selected="mixed"` marks a partly selected checkbox row (`aria-checked="mixed"`); it never paints or marks a row current, and counts as not selected under any other role. Use `trailing` for a control that must stay interactive — it renders outside the row button, which a nested control could not be. An `onClick` row with `trailing` is still clickable across its whole box, padding and the space around the slot included (an `href` row leaves that to its link, so a modified click still opens a new tab), with its focus ring at the row's edge; a click inside the slot (or in a menu it portals out) is the slot's own, and a disabled row drops both the click and the ring. `revealTrailing` shows that control only on hover, keyboard focus or while a menu it opened is open, keeping it in the tab order and always showing it on a touch screen. `tone="muted"` tints a row whose subject is inactive, which `disabled` does not: a muted row stays clickable. `leading` puts the row's own indicator (a presentational `Checkbox`) inside the row button ahead of the children (with `leading` or `dimmed`, pass one child; it fills the row), and `dimmed` fades the children but not `leading` or `trailing`, for a row switched off but still a click from on. _Key props:_ `divider`, `disabled`, `tone` (`default` | `muted`), `inset` (`none` | `compact` — the row owns an 8px by 16px inset, wrapping `trailing` too, so its content needs no padding wrapper), `onClick`, `href`, `target`, `rel`, `selected` (`boolean` | `"mixed"`), `selection` (`highlight` | `tint` | `announce`; `tint` paints the selected treatment without the accent bar, for a menu whose choice is already marked inside the row), `trailing`, `revealTrailing`, `leading`, `dimmed`, `role`, `className`, `style`.
12
12
  - **`SurfaceExpandableRow`** — A row that opens to reveal a body (used as `Surface.ExpandableRow`), for a line that carries its own controls. Not `Accordion`, which puts its header inside the toggle button, so a header holding a dropdown or a second button would be invalid: here the row surface takes the click and a cell opts out by wrapping its controls in `ExpandableRow.Controls`, while the arrow stays a real button so the keyboard reaches it. That opt-out is explicit rather than sniffing the event target for an interactive ancestor, because a control rendering into a shadow root retargets the event to its host. `sticky` pins the row while its body scrolls, offset by `stickyTopOffset` for whatever is already pinned above it; it only pins while open, since a closed row has nothing to scroll past. _Key props:_ `header`, `children`, `expanded`, `onToggle`, `sticky`, `stickyTopOffset`, `divider`, `tone`, `aria-label`, `className`, `style`.
@@ -94,7 +94,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
94
94
  - **`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`.
95
95
  - **`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.
96
96
  - **`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`.
97
- - **`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 chip (`Connector: Notion`, or `Connector: (Notion, Attio)`) that reopens its values when clicked; Backspace in an empty field removes the last one. 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. _Key props:_ `filters`, `value`, `onChange`, `onClear`, `onActiveFilterChange`, `placeholder`, `size`, `width`, `loading`, `disabled`, `clearable`, `maxVisibleChips`, `aria-label`, `aria-labelledby`, `id`.
97
+ - **`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 chip (`Connector: Notion`, or `Connector: (Notion, Attio)`) that reopens its values when clicked; 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. _Key props:_ `filters`, `value`, `onChange`, `onClear`, `onActiveFilterChange`, `onQueryChange`, `textFilter`, `placeholder`, `size`, `width`, `loading`, `disabled`, `clearable`, `maxVisibleChips`, `aria-label`, `aria-labelledby`, `id`.
98
98
  - **`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`.
99
99
  - **`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`.
100
100
 
@@ -1,17 +1,18 @@
1
1
  import { jsxs as S, jsx as t } from "react/jsx-runtime";
2
- import ue, { useId as me, useState as c, useEffect as q, useRef as K } from "react";
3
- import { DisclosureArrow as B } from "./DisclosureArrow.js";
4
- import pe from "./PinnedCornerCap.js";
5
- import { ARROW_PX as I, toggleGapPx as fe, togglePaddingLeftPx as be, bodyInsetPx as he } from "./accordionBodyInset.js";
2
+ import ue, { useId as me, useState as c, useEffect as K, useRef as q } from "react";
3
+ import { DisclosureArrow as A } from "./DisclosureArrow.js";
4
+ import fe from "./PinnedCornerCap.js";
5
+ import { ARROW_PX as B, toggleGapPx as pe, togglePaddingLeftPx as be, bodyInsetPx as he } from "./accordionBodyInset.js";
6
6
  import { FOCUS_RING as ge, FOCUS_RING_INSET as ve } from "./focusRing.js";
7
+ import { FRAME_BACKGROUND as xe, FRAME_CLASS as we } from "./frameStyles.js";
7
8
  import { isRenderableNode as W } from "./renderableNode.js";
8
- import { usePinned as xe } from "./usePinned.js";
9
- const we = "--malachite-ctx-pinned-surround", Ne = 300, X = 1600, ke = { position: "absolute", width: 0, height: 0 }, Re = ({
9
+ import { usePinned as Ne } from "./usePinned.js";
10
+ const Re = "--malachite-ctx-pinned-surround", ke = 300, X = 1600, _e = { position: "absolute", width: 0, height: 0 }, ye = ({
10
11
  title: Y,
11
12
  header: J,
12
13
  className: Q,
13
14
  children: i,
14
- trailing: A,
15
+ trailing: I,
15
16
  leading: L,
16
17
  arrowPosition: u = "start",
17
18
  highlightExpanded: g = !0,
@@ -26,33 +27,35 @@ const we = "--malachite-ctx-pinned-surround", Ne = 300, X = 1600, ke = { positio
26
27
  pinnedCorners: ee = !1,
27
28
  animate: l = !0,
28
29
  collapsible: o = !0,
29
- flashKey: p
30
+ flashKey: f
30
31
  }, te) => {
31
- const N = w || !o, r = Z === "sunken", k = `${me()}-body`, [$, j] = c(H), [re, ne] = c(p), [f, oe] = c(0), [E, F] = c(!1);
32
- Object.is(p, re) || (ne(p), p !== void 0 && (oe(f + 1), F(!0))), q(() => {
33
- if (f === 0)
32
+ const N = w || !o, r = Z === "sunken", R = `${me()}-body`, [$, j] = c(H), [re, ne] = c(f), [p, oe] = c(0), [E, F] = c(!1);
33
+ Object.is(f, re) || (ne(f), f !== void 0 && (oe(p + 1), F(!0))), K(() => {
34
+ if (p === 0)
34
35
  return;
35
36
  const n = window.setTimeout(() => F(!1), X);
36
37
  return () => window.clearTimeout(n);
37
- }, [f]), !o && !$ && j(!0);
38
- const e = !o || (v !== void 0 ? v : $), R = o && u === "gutter", ae = l || e && !!i, [s, b] = c(!o), P = K(e);
39
- !e && s ? b(!1) : e && !l && !s && b(!0), q(() => {
38
+ }, [p]), !o && !$ && j(!0);
39
+ const e = !o || (v !== void 0 ? v : $), k = o && u === "gutter", ae = l || e && !!i, [s, b] = c(!o), P = q(e);
40
+ !e && s ? b(!1) : e && !l && !s && b(!0), K(() => {
40
41
  if (!e) {
41
42
  P.current = !1;
42
43
  return;
43
44
  }
44
45
  if (!l || s || P.current && o)
45
46
  return;
46
- const n = window.setTimeout(() => b(!0), Ne);
47
+ const n = window.setTimeout(() => b(!0), ke);
47
48
  return () => window.clearTimeout(n);
48
49
  }, [l, e, o, s]);
49
- const z = K(null), D = !!d && ee && !r, y = xe(z, m, D), _ = W(L), a = V === "title", h = a ? "grid grid-cols-subgrid col-span-4" : "", T = () => {
50
+ const D = q(null), M = !!d && ee && !r, _ = Ne(D, m, M), y = W(L), a = V === "title", h = a ? "grid grid-cols-subgrid col-span-4" : "", z = () => {
50
51
  const n = !e;
51
52
  v === void 0 && j(n), x == null || x(n);
52
53
  }, se = [
53
54
  a ? "grid grid-cols-[auto_auto_minmax(0,1fr)_auto]" : "flex flex-col",
54
55
  "w-full text-left",
55
- r ? "rounded-xl bg-[var(--malachite-card-dimmed-background)] p-[4px]" : "",
56
+ // The table's frame, so a sunken section reads as the same kind of container as a table
57
+ // beside it, in both themes.
58
+ r ? we : "",
56
59
  E ? "relative" : "",
57
60
  Q
58
61
  ].filter(Boolean).join(" "), ie = [
@@ -61,28 +64,28 @@ const we = "--malachite-ctx-pinned-surround", Ne = 300, X = 1600, ke = { positio
61
64
  a ? h : "flex w-full",
62
65
  "items-center transition-colors",
63
66
  r ? "" : "border-0 border-b border-solid border-[var(--malachite-card-border)]",
64
- d ? `sticky ${y ? "z-10" : "z-[8]"}` : "",
67
+ d ? `sticky ${_ ? "z-10" : "z-[8]"}` : "",
65
68
  r ? "bg-transparent" : d ? e && g || N ? "" : "hover:bg-[image:linear-gradient(var(--malachite-buttonlist-hover-background),var(--malachite-buttonlist-hover-background))]" : e && g ? "bg-[var(--malachite-buttonlist-hover-background)]" : N ? "bg-transparent" : "bg-transparent hover:bg-[var(--malachite-buttonlist-hover-background)]"
66
- ].filter(Boolean).join(" "), M = [
69
+ ].filter(Boolean).join(" "), T = [
67
70
  "flex flex-1 items-center min-w-0 text-left",
68
71
  r ? "pr-[16px] py-[12px]" : "pr-[16px] py-[16px]",
69
72
  a ? "col-start-3" : ""
70
73
  ].filter(Boolean).join(" "), de = [
71
- M,
74
+ T,
72
75
  "appearance-none border-0 bg-transparent cursor-pointer select-none disabled:cursor-not-allowed",
73
76
  r ? `rounded-lg ${ge}` : ve
74
77
  ].join(" "), G = {
75
- paddingLeft: be(_ || R),
76
- gap: fe(r)
78
+ paddingLeft: be(y || k),
79
+ gap: pe(r)
77
80
  }, U = J ?? /* @__PURE__ */ t("span", { className: "flex-1 min-w-0 truncate font-medium text-[13px] tracking-[0.13px] text-[var(--malachite-text-primary)]", children: Y }), le = !r && e && g, ce = d ? {
78
81
  top: `${m}px`,
79
- backgroundColor: r ? "var(--malachite-card-dimmed-background)" : "var(--malachite-card-background)",
82
+ backgroundColor: r ? xe : "var(--malachite-card-background)",
80
83
  ...le && {
81
84
  backgroundImage: "linear-gradient(var(--malachite-buttonlist-hover-background), var(--malachite-buttonlist-hover-background))"
82
85
  }
83
86
  } : {}, C = he({
84
87
  arrowPosition: o ? u : "end",
85
- hasLeading: _,
88
+ hasLeading: y,
86
89
  sunken: r
87
90
  }), O = a ? /* @__PURE__ */ t(
88
91
  "div",
@@ -107,26 +110,26 @@ const we = "--malachite-ctx-pinned-surround", Ne = 300, X = 1600, ke = { positio
107
110
  style: { animationDuration: `${X}ms` },
108
111
  "data-accordion-flash": ""
109
112
  },
110
- f
113
+ p
111
114
  ),
112
- D && /* @__PURE__ */ t("div", { ref: z, "aria-hidden": "true", style: ke }),
115
+ M && /* @__PURE__ */ t("div", { ref: D, "aria-hidden": "true", style: _e }),
113
116
  /* @__PURE__ */ S(
114
117
  "div",
115
118
  {
116
119
  className: ie,
117
120
  style: ce,
118
121
  "data-accordion-header": "",
119
- "data-pinned": y ? "" : void 0,
122
+ "data-pinned": _ ? "" : void 0,
120
123
  children: [
121
- y && /* @__PURE__ */ t(
122
- pe,
124
+ _ && /* @__PURE__ */ t(
125
+ fe,
123
126
  {
124
127
  bordered: !0,
125
128
  radius: "var(--malachite-radius-xxl, 14px)",
126
- surround: `var(${we}, var(--malachite-card-sunken-background))`
129
+ surround: `var(${Re}, var(--malachite-card-sunken-background))`
127
130
  }
128
131
  ),
129
- R && /* @__PURE__ */ t(
132
+ k && /* @__PURE__ */ t(
130
133
  "button",
131
134
  {
132
135
  type: "button",
@@ -134,15 +137,15 @@ const we = "--malachite-ctx-pinned-surround", Ne = 300, X = 1600, ke = { positio
134
137
  "aria-hidden": "true",
135
138
  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`,
136
139
  onMouseDown: (n) => n.preventDefault(),
137
- onClick: T,
140
+ onClick: z,
138
141
  disabled: w,
139
- children: /* @__PURE__ */ t(B, { expanded: e, size: I })
142
+ children: /* @__PURE__ */ t(A, { expanded: e, size: B })
140
143
  }
141
144
  ),
142
- _ && /* @__PURE__ */ t(
145
+ y && /* @__PURE__ */ t(
143
146
  "div",
144
147
  {
145
- className: `${a ? "col-start-2" : ""} shrink-0 flex items-center ${R ? "pl-[12px]" : "pl-[16px]"}`,
148
+ className: `${a ? "col-start-2" : ""} shrink-0 flex items-center ${k ? "pl-[12px]" : "pl-[16px]"}`,
146
149
  children: L
147
150
  }
148
151
  ),
@@ -152,29 +155,29 @@ const we = "--malachite-ctx-pinned-surround", Ne = 300, X = 1600, ke = { positio
152
155
  type: "button",
153
156
  className: de,
154
157
  style: G,
155
- onClick: T,
158
+ onClick: z,
156
159
  "aria-expanded": e,
157
- "aria-controls": ae ? k : void 0,
160
+ "aria-controls": ae ? R : void 0,
158
161
  disabled: w,
159
162
  children: [
160
- u === "start" && /* @__PURE__ */ t(B, { expanded: e, size: I }),
163
+ u === "start" && /* @__PURE__ */ t(A, { expanded: e, size: B }),
161
164
  U,
162
165
  u === "end" && /* @__PURE__ */ t(
163
- B,
166
+ A,
164
167
  {
165
168
  expanded: e,
166
- size: I,
169
+ size: B,
167
170
  className: "ml-auto"
168
171
  }
169
172
  )
170
173
  ]
171
174
  }
172
- ) : /* @__PURE__ */ t("div", { className: M, style: G, children: U }),
173
- W(A) && /* @__PURE__ */ t(
175
+ ) : /* @__PURE__ */ t("div", { className: T, style: G, children: U }),
176
+ W(I) && /* @__PURE__ */ t(
174
177
  "div",
175
178
  {
176
179
  className: `${a ? "col-start-4" : ""} shrink-0 flex items-center pr-[16px] text-[var(--malachite-text-secondary)]`,
177
- children: A
180
+ children: I
178
181
  }
179
182
  )
180
183
  ]
@@ -189,7 +192,7 @@ const we = "--malachite-ctx-pinned-surround", Ne = 300, X = 1600, ke = { positio
189
192
  /* @__PURE__ */ t(
190
193
  "div",
191
194
  {
192
- id: k,
195
+ id: R,
193
196
  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`,
194
197
  style: { gridTemplateRows: e ? "1fr" : "0fr" },
195
198
  onTransitionEnd: (n) => {
@@ -219,7 +222,7 @@ const we = "--malachite-ctx-pinned-surround", Ne = 300, X = 1600, ke = { positio
219
222
  e && i && /* @__PURE__ */ t(
220
223
  "div",
221
224
  {
222
- id: k,
225
+ id: R,
223
226
  className: [
224
227
  h,
225
228
  r ? "pt-[4px]" : "border-b border-solid border-[var(--malachite-card-border)]"
@@ -231,10 +234,10 @@ const we = "--malachite-ctx-pinned-surround", Ne = 300, X = 1600, ke = { positio
231
234
  ]
232
235
  }
233
236
  );
234
- }, ye = ue.forwardRef(Re);
235
- ye.displayName = "Accordion";
237
+ }, Ce = ue.forwardRef(ye);
238
+ Ce.displayName = "Accordion";
236
239
  export {
237
- ye as Accordion,
238
- ye as default
240
+ Ce as Accordion,
241
+ Ce as default
239
242
  };
240
243
  //# 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 DisclosureArrow from './DisclosureArrow';\nimport PinnedCornerCap from './PinnedCornerCap';\nimport { ARROW_PX, bodyInsetPx, toggleGapPx, togglePaddingLeftPx } from './accordionBodyInset';\nimport { FOCUS_RING, FOCUS_RING_INSET } from './focusRing';\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 (dimmed rounded container, no\n * dividers/hover) — used for stacked detail sections in side panels and detail\n * pages (see `CollapsibleSection`). Both lead with the arrow: it is the affordance\n * that says the section opens, and a reader scanning a stack of them finds it in\n * one column rather than at whatever width each header happens to end.\n */\n variant?: 'default' | 'sunken';\n /**\n * Content pinned to the right of the header, OUTSIDE the toggle button — so it may\n * be interactive (e.g. a Checkbox) without nesting a button inside a button.\n */\n trailing?: React.ReactNode;\n /** Before the title, outside the toggle button. */\n leading?: React.ReactNode;\n /** `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 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 sunken ? 'rounded-xl bg-[var(--malachite-card-dimmed-background)] p-[4px]' : '',\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 floats over its grey.\n const highlighted = !sunken && expanded && highlightExpanded;\n const headerRowStyle: React.CSSProperties = stickyHeader\n ? {\n top: `${stickyTopOffset}px`,\n backgroundColor: sunken\n ? 'var(--malachite-card-dimmed-background)'\n : 'var(--malachite-card-background)',\n ...(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 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 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 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 </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","markerRef","capsCorners","pinned","usePinned","hasLeading","isRenderableNode","titleGrid","subgrid","handleToggle","newExpanded","containerClasses","headerRowClasses","titleAreaClasses","toggleButtonClasses","FOCUS_RING","FOCUS_RING_INSET","titleAreaStyle","togglePaddingLeftPx","toggleGapPx","titleContent","jsx","highlighted","headerRowStyle","titleInset","bodyInsetPx","bodyChildren","jsxs","PinnedCornerCap","event","DisclosureArrow","ARROW_PX","Accordion","React"],"mappings":";;;;;;;;AAWA,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,IAAa;AAAA,EACb,SAAAC,IAAU;AAAA,EACV,iBAAAC,IAAkB;AAAA,EAClB,YAAAC;AAAA,EACA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ACM,aACA;AAAA,cAAA,EAEL,OAAO,OAAO,EACd,KAAK,GAAG;AAAA,cAEZ,UAAA+C;AAAA,YAAA;AAAA,UAAA;AAAA;AAAA,MACL;AAAA,IAAA;AAAA,EAAA;AAKpB,GAEMM,KAAYC,GAAM,WAAW7E,EAAgB;AACnD4E,GAAU,cAAc;"}
1
+ {"version":3,"file":"Accordion.js","sources":["../../src/components/Accordion.tsx"],"sourcesContent":["import React, { useEffect, useId, useRef, useState } from 'react';\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 { 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 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 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 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 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 </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","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","Accordion","React"],"mappings":";;;;;;;;;AAYA,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,IAAa;AAAA,EACb,SAAAC,IAAU;AAAA,EACV,iBAAAC,IAAkB;AAAA,EAClB,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,cAAAC,IAAe;AAAA,EACf,iBAAAC,IAAkB;AAAA,EAClB,eAAAC,KAAgB;AAAA,EAChB,SAAAC,IAAU;AAAA,EACV,aAAAC,IAAc;AAAA,EACd,UAAAC;AACJ,GACAC,OACC;AACD,QAAMC,IAAQR,KAAY,CAACK,GACrBI,IAASb,MAAY,UAErBc,IAAS,GADIC,GAAA,CACS,SACtB,CAACC,GAAkBC,CAAmB,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";
3
+ import { Accordion as d } from "../Accordion.js";
4
+ import { Tag as c } from "../Tag.js";
5
+ import { Typography as a } from "../Typography/index.js";
6
+ import { ChatThinking as f } from "./ChatThinking.js";
7
+ const v = ({
8
+ text: o,
9
+ streaming: n = !1,
10
+ title: i = "Reasoning",
11
+ className: l
12
+ }) => {
13
+ const [t, r] = m(void 0), s = !!(o != null && o.trim());
14
+ return /* @__PURE__ */ e(
15
+ d,
16
+ {
17
+ variant: "sunken",
18
+ animate: !1,
19
+ isExpanded: t ?? n,
20
+ onToggle: r,
21
+ className: l,
22
+ header: /* @__PURE__ */ e("span", { className: "min-w-0 text-left", children: /* @__PURE__ */ e(a.Text, { size: "small", fontWeight: "semi-bold", children: i }) }),
23
+ trailing: /* @__PURE__ */ e(
24
+ c,
25
+ {
26
+ value: n ? "Streaming" : "Completed",
27
+ type: n ? "warning" : "default",
28
+ fontSize: "xsmall",
29
+ textTransform: "none"
30
+ }
31
+ ),
32
+ children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-2 p-2", onFocus: () => r(!0), children: s ? /* @__PURE__ */ e(a.MarkdownBlock, { text: o ?? "", omitMargin: !0 }) : n ? /* @__PURE__ */ e(f, {}) : /* @__PURE__ */ e(a.SecondaryText, { size: "small", children: "No reasoning provided." }) })
33
+ }
34
+ );
35
+ };
36
+ export {
37
+ v as ChatReasoning,
38
+ v as default
39
+ };
40
+ //# sourceMappingURL=ChatReasoning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatReasoning.js","sources":["../../../src/components/Chat/ChatReasoning.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport Accordion from '../Accordion';\nimport Tag from '../Tag';\nimport Typography from '../Typography';\nimport ChatThinking from './ChatThinking';\n\nexport interface ChatReasoningProps {\n /** Markdown. Absent or empty while nothing has arrived, or if the model summarised nothing. */\n text?: string;\n /** The model is still reasoning. Opens the card until it stops. */\n streaming?: boolean;\n title?: string;\n className?: string;\n}\n\n/**\n * What a model reasoned before it answered: worth reading as it arrives, and out of the way once\n * the answer is there. So it follows `streaming` until the reader toggles it, and from then on\n * stays where they put it.\n */\nconst ChatReasoning: React.FC<ChatReasoningProps> = ({\n text,\n streaming = false,\n title = 'Reasoning',\n className,\n}) => {\n const [chosen, setChosen] = useState<boolean | undefined>(undefined);\n const hasText = Boolean(text?.trim());\n\n return (\n <Accordion\n variant=\"sunken\"\n animate={false}\n isExpanded={chosen ?? streaming}\n onToggle={setChosen}\n className={className}\n header={\n <span className=\"min-w-0 text-left\">\n <Typography.Text size=\"small\" fontWeight=\"semi-bold\">\n {title}\n </Typography.Text>\n </span>\n }\n trailing={\n <Tag\n value={streaming ? 'Streaming' : 'Completed'}\n type={streaming ? 'warning' : 'default'}\n fontSize=\"xsmall\"\n textTransform=\"none\"\n />\n }\n >\n {/* Focus inside counts as a choice, or the close on `streaming` ending would drop it. */}\n <div className=\"flex flex-col gap-2 p-2\" onFocus={() => setChosen(true)}>\n {hasText ? (\n <Typography.MarkdownBlock text={text ?? ''} omitMargin />\n ) : streaming ? (\n <ChatThinking />\n ) : (\n <Typography.SecondaryText size=\"small\">\n No reasoning provided.\n </Typography.SecondaryText>\n )}\n </div>\n </Accordion>\n );\n};\n\nexport default ChatReasoning;\nexport { ChatReasoning };\n"],"names":["ChatReasoning","text","streaming","title","className","chosen","setChosen","useState","hasText","jsx","Accordion","Typography","Tag","ChatThinking"],"mappings":";;;;;;AAoBA,MAAMA,IAA8C,CAAC;AAAA,EACjD,MAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,OAAAC,IAAQ;AAAA,EACR,WAAAC;AACJ,MAAM;AACF,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAA8B,MAAS,GAC7DC,IAAU,GAAQP,KAAA,QAAAA,EAAM;AAE9B,SACI,gBAAAQ;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,SAAQ;AAAA,MACR,SAAS;AAAA,MACT,YAAYL,KAAUH;AAAA,MACtB,UAAUI;AAAA,MACV,WAAAF;AAAA,MACA,QACI,gBAAAK,EAAC,QAAA,EAAK,WAAU,qBACZ,UAAA,gBAAAA,EAACE,EAAW,MAAX,EAAgB,MAAK,SAAQ,YAAW,aACpC,aACL,GACJ;AAAA,MAEJ,UACI,gBAAAF;AAAA,QAACG;AAAA,QAAA;AAAA,UACG,OAAOV,IAAY,cAAc;AAAA,UACjC,MAAMA,IAAY,YAAY;AAAA,UAC9B,UAAS;AAAA,UACT,eAAc;AAAA,QAAA;AAAA,MAAA;AAAA,MAKtB,UAAA,gBAAAO,EAAC,OAAA,EAAI,WAAU,2BAA0B,SAAS,MAAMH,EAAU,EAAI,GACjE,UAAAE,IACG,gBAAAC,EAACE,EAAW,eAAX,EAAyB,MAAMV,KAAQ,IAAI,YAAU,IAAC,IACvDC,sBACCW,GAAA,EAAa,IAEd,gBAAAJ,EAACE,EAAW,eAAX,EAAyB,MAAK,SAAQ,oCAEvC,EAAA,CAER;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
@@ -1,59 +1,73 @@
1
- import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
- import { Accordion as d } from "../Accordion.js";
3
- import c from "../CodeBlock.js";
4
- import p from "../CustomIcons/CheckIcon.js";
5
- import f from "../CustomIcons/RejectIcon.js";
6
- import { Tag as T } from "../Tag.js";
7
- import { Typography as s } from "../Typography/index.js";
8
- const x = {
1
+ import { jsx as e, jsxs as l } from "react/jsx-runtime";
2
+ import { Accordion as x } from "../Accordion.js";
3
+ import a from "../CodeBlock.js";
4
+ import h from "../CustomIcons/CheckIcon.js";
5
+ import T from "../CustomIcons/DisabledIcon.js";
6
+ import g from "../CustomIcons/RejectIcon.js";
7
+ import { Tag as S } from "../Tag.js";
8
+ import { Typography as n } from "../Typography/index.js";
9
+ const u = {
9
10
  running: "Running",
10
11
  completed: "Completed",
11
- error: "Failed"
12
- }, S = {
12
+ error: "Failed",
13
+ blocked: "Blocked"
14
+ }, b = {
13
15
  running: "warning",
14
16
  completed: "success",
15
- error: "error"
16
- }, h = {
17
- completed: /* @__PURE__ */ e(p, { size: 11 }),
18
- error: /* @__PURE__ */ e(f, { size: 11 })
19
- }, y = ({
20
- name: t,
17
+ error: "error",
18
+ blocked: "error"
19
+ }, w = {
20
+ completed: /* @__PURE__ */ e(h, { size: 11 }),
21
+ error: /* @__PURE__ */ e(g, { size: 11 }),
22
+ blocked: /* @__PURE__ */ e(T, { size: 11 })
23
+ }, s = ({ label: r, value: o }) => o === void 0 || o === "" ? null : /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-col gap-1", children: [
24
+ /* @__PURE__ */ e(n.SecondaryText, { size: "xsmall", children: r }),
25
+ typeof o == "string" ? /* @__PURE__ */ e(a, { code: o, wrapLines: !0, showLineNumbers: !1, "aria-label": r }) : /* @__PURE__ */ e(a, { json: o, collapsed: 2, "aria-label": r })
26
+ ] }), I = ({
27
+ name: r,
21
28
  status: o = "completed",
22
- callId: l,
23
- input: r,
24
- output: n,
25
- defaultExpanded: m = !1,
26
- className: a
29
+ callId: i,
30
+ input: t,
31
+ output: c,
32
+ adornment: m,
33
+ children: d,
34
+ defaultExpanded: p = !1,
35
+ className: f
27
36
  }) => /* @__PURE__ */ e(
28
- d,
37
+ x,
29
38
  {
30
39
  variant: "sunken",
31
- defaultExpanded: m,
32
- className: a,
33
- header: /* @__PURE__ */ e("span", { className: "min-w-0 text-left", children: /* @__PURE__ */ e(s.Text, { size: "small", fontWeight: "semi-bold", children: t }) }),
34
- trailing: /* @__PURE__ */ e(
35
- T,
36
- {
37
- value: x[o],
38
- type: S[o],
39
- fontSize: "xsmall",
40
- textTransform: "none",
41
- icon: h[o],
42
- iconPosition: "left"
43
- }
44
- ),
45
- children: /* @__PURE__ */ i("div", { className: "flex flex-col gap-2 p-2", children: [
46
- l === void 0 ? null : /* @__PURE__ */ i(s.SecondaryText, { size: "xsmall", children: [
40
+ animate: !1,
41
+ defaultExpanded: p,
42
+ className: f,
43
+ header: /* @__PURE__ */ e("span", { className: "min-w-0 text-left [overflow-wrap:anywhere]", children: /* @__PURE__ */ e(n.Text, { size: "small", fontWeight: "semi-bold", children: r }) }),
44
+ trailing: /* @__PURE__ */ l("span", { className: "flex items-center gap-2", children: [
45
+ m,
46
+ /* @__PURE__ */ e(
47
+ S,
48
+ {
49
+ value: u[o],
50
+ type: b[o],
51
+ fontSize: "xsmall",
52
+ textTransform: "none",
53
+ icon: w[o],
54
+ iconPosition: "left"
55
+ }
56
+ )
57
+ ] }),
58
+ children: /* @__PURE__ */ l("div", { className: "flex flex-col gap-2 p-2", children: [
59
+ i === void 0 ? null : /* @__PURE__ */ l(n.SecondaryText, { size: "xsmall", children: [
47
60
  "Call ID: ",
48
- l
61
+ i
49
62
  ] }),
50
- r === void 0 ? null : /* @__PURE__ */ e(c, { json: r, collapsed: 2 }),
51
- n === void 0 ? null : /* @__PURE__ */ e(c, { json: n, collapsed: 2 })
63
+ /* @__PURE__ */ e(s, { label: "Parameters", value: t }),
64
+ /* @__PURE__ */ e(s, { label: "Result", value: c }),
65
+ d
52
66
  ] })
53
67
  }
54
68
  );
55
69
  export {
56
- y as ChatToolCall,
57
- y as default
70
+ I as ChatToolCall,
71
+ I as default
58
72
  };
59
73
  //# sourceMappingURL=ChatToolCall.js.map