@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
@@ -1 +1 @@
1
- {"version":3,"file":"codeBlockStyles.js","sources":["../../src/components/codeBlockStyles.ts"],"sourcesContent":["import type React from 'react';\n\nexport const CODE_FONT: React.CSSProperties = {\n color: 'var(--malachite-codeblock-foreground)',\n fontSize: '14px',\n lineHeight: '20px',\n fontFamily: 'var(--malachite-font-mono, monospace)',\n textAlign: 'left',\n background: 'transparent',\n};\n\n\n/** Anchored, so prose containing a colon falls through to {@link INDENT_COLUMN} instead. */\nconst VALUE_COLUMN = /^ *(?:- +)*(?:\"[^\"]*\"|'[^']*'|[^\\s:'\"][^\\s:]*): +(?=\\S)/;\n\nconst INDENT_COLUMN = /^ *(?:- +)*/;\n\n/**\n * Backstop, not a fit-to-width rule: `padding-left` counts toward the flex item's\n * `min-width: auto`, so a pathological key could otherwise widen the row past its panel. Set\n * well past any realistic key (the deepest in connector step YAML is ~18ch) because a clamped\n * row stops aligning under its value, which is the whole point of the hang.\n */\nconst MAX_HANG_CH = 32;\n\n/**\n * Hangs a wrapped row under the start of its line's value, so it can't read as a new key.\n * Measured in `ch` — the block is monospace, so one `ch` is one space (tabs are not counted).\n */\nexport const hangingIndentStyle = (line: string): React.CSSProperties => {\n const column = (VALUE_COLUMN.exec(line) ?? INDENT_COLUMN.exec(line))?.[0].length ?? 0;\n const hang = Math.min(column, MAX_HANG_CH);\n if (hang === 0) {\n return {};\n }\n const hangingIndent = `${hang}ch`;\n return { paddingLeft: hangingIndent, textIndent: `-${hangingIndent}` };\n};\n"],"names":["CODE_FONT","VALUE_COLUMN","INDENT_COLUMN","MAX_HANG_CH","hangingIndentStyle","line","_a","column","hang","hangingIndent"],"mappings":"AAEO,MAAMA,IAAiC;AAAA,EAC1C,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,YAAY;AAChB,GAIMC,IAAe,2DAEfC,IAAgB,eAQhBC,IAAc,IAMPC,IAAqB,CAACC,MAAsC;AA3BlE,MAAAC;AA4BH,QAAMC,MAAUD,IAAAL,EAAa,KAAKI,CAAI,KAAKH,EAAc,KAAKG,CAAI,MAAlD,gBAAAC,EAAuD,GAAG,WAAU,GAC9EE,IAAO,KAAK,IAAID,GAAQJ,CAAW;AACzC,MAAIK,MAAS;AACT,WAAO,CAAA;AAEX,QAAMC,IAAgB,GAAGD,CAAI;AAC7B,SAAO,EAAE,aAAaC,GAAe,YAAY,IAAIA,CAAa,GAAA;AACtE;"}
1
+ {"version":3,"file":"codeBlockStyles.js","sources":["../../src/components/codeBlockStyles.ts"],"sourcesContent":["import type React from 'react';\n\nexport const CODE_FONT: React.CSSProperties = {\n color: 'var(--malachite-codeblock-foreground)',\n fontSize: '14px',\n lineHeight: '20px',\n fontFamily: 'var(--malachite-font-mono, monospace)',\n textAlign: 'left',\n background: 'transparent',\n};\n\n/**\n * The element around a block's rows. Unwrapped, it is as wide as the widest line, floored at\n * the view, so rows filling it end level when one scrolls out. Wrapped, it is the view's width:\n * at `max-content` a line has nothing narrower to wrap against and scrolls anyway.\n */\nexport const rowsWrapperStyle = (wrap: boolean): React.CSSProperties =>\n wrap ? { width: '100%' } : { width: 'max-content', minWidth: '100%' };\n\n/** Anchored, so prose containing a colon falls through to {@link INDENT_COLUMN} instead. */\nconst VALUE_COLUMN = /^ *(?:- +)*(?:\"[^\"]*\"|'[^']*'|[^\\s:'\"][^\\s:]*): +(?=\\S)/;\n\nconst INDENT_COLUMN = /^ *(?:- +)*/;\n\n/**\n * Backstop, not a fit-to-width rule: `padding-left` counts toward the flex item's\n * `min-width: auto`, so a pathological key could otherwise widen the row past its panel. Set\n * well past any realistic key (the deepest in connector step YAML is ~18ch) because a clamped\n * row stops aligning under its value, which is the whole point of the hang.\n */\nconst MAX_HANG_CH = 32;\n\n/**\n * Hangs a wrapped row under the start of its line's value, so it can't read as a new key.\n * Measured in `ch` — the block is monospace, so one `ch` is one space (tabs are not counted).\n */\nexport const hangingIndentStyle = (line: string): React.CSSProperties => {\n const column = (VALUE_COLUMN.exec(line) ?? INDENT_COLUMN.exec(line))?.[0].length ?? 0;\n const hang = Math.min(column, MAX_HANG_CH);\n if (hang === 0) {\n return {};\n }\n const hangingIndent = `${hang}ch`;\n return { paddingLeft: hangingIndent, textIndent: `-${hangingIndent}` };\n};\n"],"names":["CODE_FONT","rowsWrapperStyle","wrap","VALUE_COLUMN","INDENT_COLUMN","MAX_HANG_CH","hangingIndentStyle","line","_a","column","hang","hangingIndent"],"mappings":"AAEO,MAAMA,IAAiC;AAAA,EAC1C,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,YAAY;AAChB,GAOaC,IAAmB,CAACC,MAC7BA,IAAO,EAAE,OAAO,OAAA,IAAW,EAAE,OAAO,eAAe,UAAU,OAAA,GAG3DC,IAAe,2DAEfC,IAAgB,eAQhBC,IAAc,IAMPC,IAAqB,CAACC,MAAsC;AAlClE,MAAAC;AAmCH,QAAMC,MAAUD,IAAAL,EAAa,KAAKI,CAAI,KAAKH,EAAc,KAAKG,CAAI,MAAlD,gBAAAC,EAAuD,GAAG,WAAU,GAC9EE,IAAO,KAAK,IAAID,GAAQJ,CAAW;AACzC,MAAIK,MAAS;AACT,WAAO,CAAA;AAEX,QAAMC,IAAgB,GAAGD,CAAI;AAC7B,SAAO,EAAE,aAAaC,GAAe,YAAY,IAAIA,CAAa,GAAA;AACtE;"}
@@ -1,66 +1,66 @@
1
- const w = (e, t) => e !== null ? "items" : t.trim().length > 0 ? "search" : "filters", u = (e, t) => {
1
+ const w = (e, t) => e !== null ? "items" : t.trim().length > 0 ? "search" : "filters", m = (e, t) => {
2
2
  const s = t.trim().toLowerCase();
3
3
  return e.label.toLowerCase().includes(s) || e.value.toLowerCase().includes(s);
4
- }, c = (e, t) => {
4
+ }, d = (e, t) => {
5
5
  var s;
6
6
  return new Set(((s = e.find((l) => l.filter === t)) == null ? void 0 : s.items) ?? []);
7
7
  }, p = (e, t) => e.flatMap((s) => {
8
- const l = c(t, s.value);
8
+ const l = d(t, s.value);
9
9
  return s.items.map((o) => ({ item: o, filter: s, selected: l.has(o.value) }));
10
10
  }), g = (e, t) => {
11
- const s = e.filter((n) => u(n.item, t));
11
+ const s = e.filter((n) => m(n.item, t));
12
12
  if (!s.some((n) => !n.item.disabled)) return null;
13
13
  const l = e.every((n) => n.item.disabled || n.selected), o = t.trim().length > 0 && s.filter((n) => !n.item.disabled).every((n) => n.selected);
14
14
  return l || o ? "deselect" : "select";
15
15
  }, v = (e, t) => ({
16
16
  toggle: g(e, t),
17
- items: e.filter((s) => u(s.item, t))
17
+ items: e.filter((s) => m(s.item, t))
18
18
  }), S = (e, t, s, l) => {
19
19
  var f;
20
20
  if (e === null) return;
21
21
  const o = t.find((i) => i.value === e), n = s == null ? void 0 : s.find((i) => i.value === e);
22
22
  if (!o || !n) return o ?? n;
23
- const r = new Set((f = l.find((i) => i.filter === e)) == null ? void 0 : f.items), a = new Set(o.items.map((i) => i.value)), m = n.items.filter((i) => r.has(i.value) && !a.has(i.value));
24
- return m.length ? { ...o, items: [...o.items, ...m] } : o;
25
- }, y = (e, t, s) => e ? v(p([e], t), s) : { toggle: null, items: [] }, C = (e, t, s) => v(p(e, t), s), h = (e, t) => {
23
+ const r = new Set((f = l.find((i) => i.filter === e)) == null ? void 0 : f.items), u = new Set(o.items.map((i) => i.value)), a = n.items.filter((i) => r.has(i.value) && !u.has(i.value));
24
+ return a.length ? { ...o, items: [...o.items, ...a] } : o;
25
+ }, y = (e, t, s) => e ? v(p([e], t), s) : { toggle: null, items: [] }, x = (e, t, s) => v(p(e, t), s), h = (e, t) => {
26
26
  const s = new Set(t);
27
27
  return e.length === s.size && e.every((l) => s.has(l));
28
- }, d = (e, t) => {
28
+ }, c = (e, t) => {
29
29
  const s = t.filter(
30
- (r) => !h(r.items, [...c(e, r.filter)])
30
+ (r) => !h(r.items, [...d(e, r.filter)])
31
31
  ), l = new Map(s.map((r) => [r.filter, r.items])), o = e.map((r) => ({
32
32
  filter: r.filter,
33
33
  items: l.get(r.filter) ?? r.items
34
34
  })).filter((r) => r.items.length > 0), n = s.filter(
35
- (r) => r.items.length > 0 && !e.some((a) => a.filter === r.filter)
35
+ (r) => r.items.length > 0 && !e.some((u) => u.filter === r.filter)
36
36
  );
37
37
  return { next: [...o, ...n], changes: s };
38
- }, M = (e, t, s) => {
39
- const l = [...c(e, t)], o = l.includes(s) ? l.filter((n) => n !== s) : [...l, s];
40
- return d(e, [{ filter: t, items: o }]);
41
- }, $ = (e, t, s) => d(
38
+ }, C = (e, t, s) => {
39
+ const l = [...d(e, t)], o = l.includes(s) ? l.filter((n) => n !== s) : [...l, s];
40
+ return c(e, [{ filter: t, items: o }]);
41
+ }, M = (e, t, s) => c(
42
42
  t,
43
43
  e.map((l) => {
44
- const o = c(t, l.value), n = l.items.filter(
45
- (r) => !o.has(r.value) && !r.disabled && u(r, s)
44
+ const o = d(t, l.value), n = l.items.filter(
45
+ (r) => !o.has(r.value) && !r.disabled && m(r, s)
46
46
  ).map((r) => r.value);
47
47
  return { filter: l.value, items: [...o, ...n] };
48
48
  })
49
- ), b = (e, t, s) => d(
49
+ ), $ = (e, t, s) => c(
50
50
  t,
51
51
  e.map((l) => {
52
- const o = c(t, l.value), n = new Set(
53
- l.items.filter((r) => !r.disabled && u(r, s)).map((r) => r.value)
52
+ const o = d(t, l.value), n = new Set(
53
+ l.items.filter((r) => !r.disabled && m(r, s)).map((r) => r.value)
54
54
  );
55
55
  return {
56
56
  filter: l.value,
57
57
  items: [...o].filter((r) => !n.has(r))
58
58
  };
59
59
  })
60
- ), k = (e, t) => d(e, [{ filter: t, items: [] }]), x = (e) => d(
60
+ ), b = (e, t) => c(e, [{ filter: t, items: [] }]), k = (e) => c(
61
61
  e,
62
62
  e.map((t) => ({ filter: t.filter, items: [] }))
63
- ), A = (e, t) => t.length === 0 ? e : t.length === 1 ? `${e}: ${t[0]}` : `${e}: (${t.join(", ")})`, R = (e, t, s = null) => {
63
+ ), A = (e, t, s) => c(e, [{ filter: t, items: [s] }]), R = (e, t) => t.length === 0 ? e : t.length === 1 ? `${e}: ${t[0]}` : `${e}: (${t.join(", ")})`, T = (e, t, s = null) => {
64
64
  const l = new Set(e.map((n) => n.filter)), o = t.filter((n) => l.has(n) || n === s);
65
65
  return [
66
66
  ...o,
@@ -68,17 +68,18 @@ const w = (e, t) => e !== null ? "items" : t.trim().length > 0 ? "search" : "fil
68
68
  ];
69
69
  };
70
70
  export {
71
- A as chipText,
72
- x as clearAll,
73
- b as deselectAll,
71
+ R as chipText,
72
+ k as clearAll,
73
+ A as commitText,
74
+ $ as deselectAll,
74
75
  y as filterRows,
75
- u as matchesQuery,
76
+ m as matchesQuery,
76
77
  S as openFilterOf,
77
- R as orderSelections,
78
- k as removeFilter,
78
+ T as orderSelections,
79
+ b as removeFilter,
79
80
  w as resolveMode,
80
- C as searchRows,
81
- $ as selectAll,
82
- M as toggleValue
81
+ x as searchRows,
82
+ M as selectAll,
83
+ C as toggleValue
83
84
  };
84
85
  //# sourceMappingURL=filterSearchModel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filterSearchModel.js","sources":["../../src/components/filterSearchModel.ts"],"sourcesContent":["export interface FilterSearchItem {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\nexport interface FilterSearchFilter {\n value: string;\n label: string;\n /** Shown beside the filter's name in the menu, and beside its values in a cross-filter search. */\n info?: string;\n /** Right-aligned hint on the filter's row, e.g. `e.g. Attio, Ashby`. */\n example?: string;\n items: FilterSearchItem[];\n}\n\nexport interface FilterSearchSelection {\n filter: string;\n items: string[];\n}\n\n/** One filter's new values. An empty `items` means the filter was removed. */\nexport interface FilterSearchChange {\n filter: string;\n items: string[];\n}\n\nexport interface FilterSearchUpdate {\n next: FilterSearchSelection[];\n changes: FilterSearchChange[];\n}\n\nexport type FilterSearchMode = 'filters' | 'items' | 'search';\n\nexport type FilterSearchToggle = 'select' | 'deselect';\n\nexport interface FilterSearchItemRow {\n item: FilterSearchItem;\n filter: FilterSearchFilter;\n selected: boolean;\n}\n\nexport interface FilterSearchRows {\n /** The Select All / Deselect All row, absent when no enabled value matches. */\n toggle: FilterSearchToggle | null;\n items: FilterSearchItemRow[];\n}\n\nexport const resolveMode = (activeFilter: string | null, query: string): FilterSearchMode => {\n if (activeFilter !== null) return 'items';\n return query.trim().length > 0 ? 'search' : 'filters';\n};\n\nexport const matchesQuery = (item: FilterSearchItem, query: string): boolean => {\n const needle = query.trim().toLowerCase();\n return item.label.toLowerCase().includes(needle) || item.value.toLowerCase().includes(needle);\n};\n\nconst selectedValues = (selections: FilterSearchSelection[], filter: string): Set<string> =>\n new Set(selections.find((selection) => selection.filter === filter)?.items ?? []);\n\nconst toRows = (\n filters: FilterSearchFilter[],\n selections: FilterSearchSelection[],\n): FilterSearchItemRow[] =>\n filters.flatMap((filter) => {\n const selected = selectedValues(selections, filter.value);\n return filter.items.map((item) => ({ item, filter, selected: selected.has(item.value) }));\n });\n\n/**\n * \"Deselect All\" replaces \"Select All\" once every enabled value is chosen, or once every value\n * the query matches is.\n */\nconst toggleFor = (all: FilterSearchItemRow[], query: string): FilterSearchToggle | null => {\n const matched = all.filter((row) => matchesQuery(row.item, query));\n if (!matched.some((row) => !row.item.disabled)) return null;\n\n const everyEnabledSelected = all.every((row) => row.item.disabled || row.selected);\n const everyMatchSelected =\n query.trim().length > 0 &&\n matched.filter((row) => !row.item.disabled).every((row) => row.selected);\n\n return everyEnabledSelected || everyMatchSelected ? 'deselect' : 'select';\n};\n\nconst rowsFor = (all: FilterSearchItemRow[], query: string): FilterSearchRows => ({\n toggle: toggleFor(all, query),\n items: all.filter((row) => matchesQuery(row.item, query)),\n});\n\n/** The values of one filter, as the menu lists them once that filter is picked. */\n/**\n * The open filter as its menu lists it: `filters`' entry, with any picked value only\n * `searchFilters` holds added back, so a value picked through search can be unticked from its\n * own chip. A filter only `searchFilters` holds is listed from there.\n */\nexport const openFilterOf = (\n active: string | null,\n filters: FilterSearchFilter[],\n searchFilters: FilterSearchFilter[] | undefined,\n selections: FilterSearchSelection[],\n): FilterSearchFilter | undefined => {\n if (active === null) return undefined;\n const narrowed = filters.find((filter) => filter.value === active);\n const wide = searchFilters?.find((filter) => filter.value === active);\n if (!narrowed || !wide) return narrowed ?? wide;\n const picked = new Set(selections.find((selection) => selection.filter === active)?.items);\n const listed = new Set(narrowed.items.map((item) => item.value));\n const missing = wide.items.filter((item) => picked.has(item.value) && !listed.has(item.value));\n return missing.length ? { ...narrowed, items: [...narrowed.items, ...missing] } : narrowed;\n};\n\nexport const filterRows = (\n filter: FilterSearchFilter | undefined,\n selections: FilterSearchSelection[],\n query: string,\n): FilterSearchRows =>\n filter ? rowsFor(toRows([filter], selections), query) : { toggle: null, items: [] };\n\n/** The values of every filter that match a query typed before any filter was picked. */\nexport const searchRows = (\n filters: FilterSearchFilter[],\n selections: FilterSearchSelection[],\n query: string,\n): FilterSearchRows => rowsFor(toRows(filters, selections), query);\n\n// As sets: a Select All that adds nothing returns the values in item order, not the order chosen.\nconst sameItems = (a: string[], b: string[]) => {\n const set = new Set(b);\n return a.length === set.size && a.every((value) => set.has(value));\n};\n\n/** Applies per-filter changes, keeping each filter where it already was and dropping the emptied. */\nconst applyChanges = (\n selections: FilterSearchSelection[],\n proposed: FilterSearchChange[],\n): FilterSearchUpdate => {\n const changes = proposed.filter(\n (change) => !sameItems(change.items, [...selectedValues(selections, change.filter)]),\n );\n const byFilter = new Map(changes.map((change) => [change.filter, change.items]));\n const kept = selections\n .map((selection) => ({\n filter: selection.filter,\n items: byFilter.get(selection.filter) ?? selection.items,\n }))\n .filter((selection) => selection.items.length > 0);\n const added = changes.filter(\n (change) =>\n change.items.length > 0 &&\n !selections.some((selection) => selection.filter === change.filter),\n );\n\n return { next: [...kept, ...added], changes };\n};\n\nexport const toggleValue = (\n selections: FilterSearchSelection[],\n filter: string,\n value: string,\n): FilterSearchUpdate => {\n const current = [...selectedValues(selections, filter)];\n const items = current.includes(value)\n ? current.filter((item) => item !== value)\n : [...current, value];\n\n return applyChanges(selections, [{ filter, items }]);\n};\n\n/** Select All keeps what is already chosen and adds every enabled value the query matches. */\nexport const selectAll = (\n filters: FilterSearchFilter[],\n selections: FilterSearchSelection[],\n query: string,\n): FilterSearchUpdate =>\n applyChanges(\n selections,\n filters.map((filter) => {\n const selected = selectedValues(selections, filter.value);\n const added = filter.items\n .filter(\n (item) =>\n !selected.has(item.value) && !item.disabled && matchesQuery(item, query),\n )\n .map((item) => item.value);\n // Chosen values stay even when `items` no longer lists them (a stale or lazy list).\n return { filter: filter.value, items: [...selected, ...added] };\n }),\n );\n\n/** Deselect All drops every enabled value the query matches and keeps the rest. */\nexport const deselectAll = (\n filters: FilterSearchFilter[],\n selections: FilterSearchSelection[],\n query: string,\n): FilterSearchUpdate =>\n applyChanges(\n selections,\n filters.map((filter) => {\n const selected = selectedValues(selections, filter.value);\n const dropped = new Set(\n filter.items\n .filter((item) => !item.disabled && matchesQuery(item, query))\n .map((item) => item.value),\n );\n return {\n filter: filter.value,\n items: [...selected].filter((value) => !dropped.has(value)),\n };\n }),\n );\n\nexport const removeFilter = (\n selections: FilterSearchSelection[],\n filter: string,\n): FilterSearchUpdate => applyChanges(selections, [{ filter, items: [] }]);\n\nexport const clearAll = (selections: FilterSearchSelection[]): FilterSearchUpdate =>\n applyChanges(\n selections,\n selections.map((selection) => ({ filter: selection.filter, items: [] })),\n );\n\n/** `Connector: Notion`, or `Connector: (Notion, Attio)` once there is more than one value. */\nexport const chipText = (filterLabel: string, itemLabels: string[]): string => {\n if (itemLabels.length === 0) return filterLabel;\n if (itemLabels.length === 1) return `${filterLabel}: ${itemLabels[0]}`;\n return `${filterLabel}: (${itemLabels.join(', ')})`;\n};\n\n/**\n * The order chips show filters in: when each was first added. A consumer reading its selection back\n * from the URL gets it in a fixed key order, which would reshuffle the chips on every change.\n */\nexport const orderSelections = (\n selections: FilterSearchSelection[],\n order: string[],\n /** A filter to hold its place in `order` while it has no values, e.g. the one being edited. */\n keep: string | null = null,\n): string[] => {\n const present = new Set(selections.map((selection) => selection.filter));\n const kept = order.filter((filter) => present.has(filter) || filter === keep);\n return [\n ...kept,\n ...selections.map((selection) => selection.filter).filter((f) => !kept.includes(f)),\n ];\n};\n"],"names":["resolveMode","activeFilter","query","matchesQuery","item","needle","selectedValues","selections","filter","_a","selection","toRows","filters","selected","toggleFor","all","matched","row","everyEnabledSelected","everyMatchSelected","rowsFor","openFilterOf","active","searchFilters","narrowed","wide","picked","listed","missing","filterRows","searchRows","sameItems","a","b","set","value","applyChanges","proposed","changes","change","byFilter","kept","added","toggleValue","current","items","selectAll","deselectAll","dropped","removeFilter","clearAll","chipText","filterLabel","itemLabels","orderSelections","order","keep","present","f"],"mappings":"AAgDO,MAAMA,IAAc,CAACC,GAA6BC,MACjDD,MAAiB,OAAa,UAC3BC,EAAM,KAAA,EAAO,SAAS,IAAI,WAAW,WAGnCC,IAAe,CAACC,GAAwBF,MAA2B;AAC5E,QAAMG,IAASH,EAAM,KAAA,EAAO,YAAA;AAC5B,SAAOE,EAAK,MAAM,YAAA,EAAc,SAASC,CAAM,KAAKD,EAAK,MAAM,cAAc,SAASC,CAAM;AAChG,GAEMC,IAAiB,CAACC,GAAqCC,MAAA;AAVtD,MAAAC;AAWH,aAAI,MAAIA,IAAAF,EAAW,KAAK,CAACG,MAAcA,EAAU,WAAWF,CAAM,MAA1D,gBAAAC,EAA6D,UAAS,CAAA,CAAE;AAAA,GAE9EE,IAAS,CACXC,GACAL,MAEAK,EAAQ,QAAQ,CAACJ,MAAW;AACxB,QAAMK,IAAWP,EAAeC,GAAYC,EAAO,KAAK;AACxD,SAAOA,EAAO,MAAM,IAAI,CAACJ,OAAU,EAAE,MAAAA,GAAM,QAAAI,GAAQ,UAAUK,EAAS,IAAIT,EAAK,KAAK,IAAI;AAC5F,CAAC,GAMCU,IAAY,CAACC,GAA4Bb,MAA6C;AACxF,QAAMc,IAAUD,EAAI,OAAO,CAACE,MAAQd,EAAac,EAAI,MAAMf,CAAK,CAAC;AACjE,MAAI,CAACc,EAAQ,KAAK,CAACC,MAAQ,CAACA,EAAI,KA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WAAW,IAAUD,IAChCC,EAAW,WAAW,IAAU,GAAGD,CAAW,KAAKC,EAAW,CAAC,CAAC,KAC7D,GAAGD,CAAW,MAAMC,EAAW,KAAK,IAAI,CAAC,KAOvCC,IAAkB,CAC3B/C,GACAgD,GAEAC,IAAsB,SACX;AACX,QAAMC,IAAU,IAAI,IAAIlD,EAAW,IAAI,CAACG,MAAcA,EAAU,MAAM,CAAC,GACjE+B,IAAOc,EAAM,OAAO,CAAC/C,MAAWiD,EAAQ,IAAIjD,CAAM,KAAKA,MAAWgD,CAAI;AAC5E,SAAO;AAAA,IACH,GAAGf;AAAA,IACH,GAAGlC,EAAW,IAAI,CAACG,MAAcA,EAAU,MAAM,EAAE,OAAO,CAACgD,MAAM,CAACjB,EAAK,SAASiB,CAAC,CAAC;AAAA,EAAA;AAE1F;"}
1
+ {"version":3,"file":"filterSearchModel.js","sources":["../../src/components/filterSearchModel.ts"],"sourcesContent":["export interface FilterSearchItem {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\nexport interface FilterSearchFilter {\n value: string;\n label: string;\n /** Shown beside the filter's name in the menu, and beside its values in a cross-filter search. */\n info?: string;\n /** Right-aligned hint on the filter's row, e.g. `e.g. Attio, Ashby`. */\n example?: string;\n items: FilterSearchItem[];\n}\n\nexport interface FilterSearchSelection {\n filter: string;\n items: string[];\n}\n\n/** One filter's new values. An empty `items` means the filter was removed. */\nexport interface FilterSearchChange {\n filter: string;\n items: string[];\n}\n\nexport interface FilterSearchUpdate {\n next: FilterSearchSelection[];\n changes: FilterSearchChange[];\n}\n\nexport type FilterSearchMode = 'filters' | 'items' | 'search';\n\nexport type FilterSearchToggle = 'select' | 'deselect';\n\nexport interface FilterSearchItemRow {\n item: FilterSearchItem;\n filter: FilterSearchFilter;\n selected: boolean;\n}\n\nexport interface FilterSearchRows {\n /** The Select All / Deselect All row, absent when no enabled value matches. */\n toggle: FilterSearchToggle | null;\n items: FilterSearchItemRow[];\n}\n\nexport const resolveMode = (activeFilter: string | null, query: string): FilterSearchMode => {\n if (activeFilter !== null) return 'items';\n return query.trim().length > 0 ? 'search' : 'filters';\n};\n\nexport const matchesQuery = (item: FilterSearchItem, query: string): boolean => {\n const needle = query.trim().toLowerCase();\n return item.label.toLowerCase().includes(needle) || item.value.toLowerCase().includes(needle);\n};\n\nconst selectedValues = (selections: FilterSearchSelection[], filter: string): Set<string> =>\n new Set(selections.find((selection) => selection.filter === filter)?.items ?? []);\n\nconst toRows = (\n filters: FilterSearchFilter[],\n selections: FilterSearchSelection[],\n): FilterSearchItemRow[] =>\n filters.flatMap((filter) => {\n const selected = selectedValues(selections, filter.value);\n return filter.items.map((item) => ({ item, filter, selected: selected.has(item.value) }));\n });\n\n/**\n * \"Deselect All\" replaces \"Select All\" once every enabled value is chosen, or once every value\n * the query matches is.\n */\nconst toggleFor = (all: FilterSearchItemRow[], query: string): FilterSearchToggle | null => {\n const matched = all.filter((row) => matchesQuery(row.item, query));\n if (!matched.some((row) => !row.item.disabled)) return null;\n\n const everyEnabledSelected = all.every((row) => row.item.disabled || row.selected);\n const everyMatchSelected =\n query.trim().length > 0 &&\n matched.filter((row) => !row.item.disabled).every((row) => row.selected);\n\n return everyEnabledSelected || everyMatchSelected ? 'deselect' : 'select';\n};\n\nconst rowsFor = (all: FilterSearchItemRow[], query: string): FilterSearchRows => ({\n toggle: toggleFor(all, query),\n items: all.filter((row) => matchesQuery(row.item, query)),\n});\n\n/** The values of one filter, as the menu lists them once that filter is picked. */\n/**\n * The open filter as its menu lists it: `filters`' entry, with any picked value only\n * `searchFilters` holds added back, so a value picked through search can be unticked from its\n * own chip. A filter only `searchFilters` holds is listed from there.\n */\nexport const openFilterOf = (\n active: string | null,\n filters: FilterSearchFilter[],\n searchFilters: FilterSearchFilter[] | undefined,\n selections: FilterSearchSelection[],\n): FilterSearchFilter | undefined => {\n if (active === null) return undefined;\n const narrowed = filters.find((filter) => filter.value === active);\n const wide = searchFilters?.find((filter) => filter.value === active);\n if (!narrowed || !wide) return narrowed ?? wide;\n const picked = new Set(selections.find((selection) => selection.filter === active)?.items);\n const listed = new Set(narrowed.items.map((item) => item.value));\n const missing = wide.items.filter((item) => picked.has(item.value) && !listed.has(item.value));\n return missing.length ? { ...narrowed, items: [...narrowed.items, ...missing] } : narrowed;\n};\n\nexport const filterRows = (\n filter: FilterSearchFilter | undefined,\n selections: FilterSearchSelection[],\n query: string,\n): FilterSearchRows =>\n filter ? rowsFor(toRows([filter], selections), query) : { toggle: null, items: [] };\n\n/** The values of every filter that match a query typed before any filter was picked. */\nexport const searchRows = (\n filters: FilterSearchFilter[],\n selections: FilterSearchSelection[],\n query: string,\n): FilterSearchRows => rowsFor(toRows(filters, selections), query);\n\n// As sets: a Select All that adds nothing returns the values in item order, not the order chosen.\nconst sameItems = (a: string[], b: string[]) => {\n const set = new Set(b);\n return a.length === set.size && a.every((value) => set.has(value));\n};\n\n/** Applies per-filter changes, keeping each filter where it already was and dropping the emptied. */\nconst applyChanges = (\n selections: FilterSearchSelection[],\n proposed: FilterSearchChange[],\n): FilterSearchUpdate => {\n const changes = proposed.filter(\n (change) => !sameItems(change.items, [...selectedValues(selections, change.filter)]),\n );\n const byFilter = new Map(changes.map((change) => [change.filter, change.items]));\n const kept = selections\n .map((selection) => ({\n filter: selection.filter,\n items: byFilter.get(selection.filter) ?? selection.items,\n }))\n .filter((selection) => selection.items.length > 0);\n const added = changes.filter(\n (change) =>\n change.items.length > 0 &&\n !selections.some((selection) => selection.filter === change.filter),\n );\n\n return { next: [...kept, ...added], changes };\n};\n\nexport const toggleValue = (\n selections: FilterSearchSelection[],\n filter: string,\n value: string,\n): FilterSearchUpdate => {\n const current = [...selectedValues(selections, filter)];\n const items = current.includes(value)\n ? current.filter((item) => item !== value)\n : [...current, value];\n\n return applyChanges(selections, [{ filter, items }]);\n};\n\n/** Select All keeps what is already chosen and adds every enabled value the query matches. */\nexport const selectAll = (\n filters: FilterSearchFilter[],\n selections: FilterSearchSelection[],\n query: string,\n): FilterSearchUpdate =>\n applyChanges(\n selections,\n filters.map((filter) => {\n const selected = selectedValues(selections, filter.value);\n const added = filter.items\n .filter(\n (item) =>\n !selected.has(item.value) && !item.disabled && matchesQuery(item, query),\n )\n .map((item) => item.value);\n // Chosen values stay even when `items` no longer lists them (a stale or lazy list).\n return { filter: filter.value, items: [...selected, ...added] };\n }),\n );\n\n/** Deselect All drops every enabled value the query matches and keeps the rest. */\nexport const deselectAll = (\n filters: FilterSearchFilter[],\n selections: FilterSearchSelection[],\n query: string,\n): FilterSearchUpdate =>\n applyChanges(\n selections,\n filters.map((filter) => {\n const selected = selectedValues(selections, filter.value);\n const dropped = new Set(\n filter.items\n .filter((item) => !item.disabled && matchesQuery(item, query))\n .map((item) => item.value),\n );\n return {\n filter: filter.value,\n items: [...selected].filter((value) => !dropped.has(value)),\n };\n }),\n );\n\nexport const removeFilter = (\n selections: FilterSearchSelection[],\n filter: string,\n): FilterSearchUpdate => applyChanges(selections, [{ filter, items: [] }]);\n\nexport const clearAll = (selections: FilterSearchSelection[]): FilterSearchUpdate =>\n applyChanges(\n selections,\n selections.map((selection) => ({ filter: selection.filter, items: [] })),\n );\n\nexport const commitText = (\n selections: FilterSearchSelection[],\n filter: string,\n text: string,\n): FilterSearchUpdate => applyChanges(selections, [{ filter, items: [text] }]);\n\n/** `Connector: Notion`, or `Connector: (Notion, Attio)` once there is more than one value. */\nexport const chipText = (filterLabel: string, itemLabels: string[]): string => {\n if (itemLabels.length === 0) return filterLabel;\n if (itemLabels.length === 1) return `${filterLabel}: ${itemLabels[0]}`;\n return `${filterLabel}: (${itemLabels.join(', ')})`;\n};\n\n/**\n * The order chips show filters in: when each was first added. A consumer reading its selection back\n * from the URL gets it in a fixed key order, which would reshuffle the chips on every change.\n */\nexport const orderSelections = (\n selections: FilterSearchSelection[],\n order: string[],\n /** A filter to hold its place in `order` while it has no values, e.g. the one being edited. */\n keep: string | null = null,\n): string[] => {\n const present = new Set(selections.map((selection) => selection.filter));\n const kept = order.filter((filter) => present.has(filter) || filter === keep);\n return [\n ...kept,\n ...selections.map((selection) => selection.filter).filter((f) => !kept.includes(f)),\n ];\n};\n"],"names":["resolveMode","activeFilter","query","matchesQuery","item","needle","selectedValues","selections","filter","_a","selection","toRows","filters","selected","toggleFor","all","matched","row","everyEnabledSelected","everyMatchSelected","rowsFor","openFilterOf","active","searchFilters","narrowed","wide","picked","listed","missing","filterRows","searchRows","sameItems","a","b","set","value","applyChanges","proposed","changes","change","byFilter","kept","added","toggleValue","current","items","selectAll","deselectAll","dropped","removeFilter","clearAll","commitText","text","chipText","filterLabel","itemLabels","orderSelections","order","keep","present","f"],"mappings":"AAgDO,MAAMA,IAAc,CAACC,GAA6BC,MACjDD,MAAiB,OAAa,UAC3BC,EAAM,KAAA,EAAO,SAAS,IAAI,WAAW,WAGnCC,IAAe,CAACC,GAAwBF,MAA2B;AAC5E,QAAMG,IAASH,EAAM,KAAA,EAAO,YAAA;AAC5B,SAAOE,EAAK,MAAM,YAAA,EAAc,SAASC,CAAM,KAAKD,EAAK,MAAM,cAAc,SAASC,CAAM;AAChG,GAEMC,IAAiB,CAACC,GAAqCC,MAAA;AAVtD,MAAAC;AAWH,aAAI,MAAIA,IAAAF,EAAW,KAAK,CAACG,MAAcA,EAAU,WAAWF,CAAM,MAA1D,gBAAAC,EAA6D,UAAS,CAAA,CAAE;AAAA,GAE9EE,IAAS,CACXC,GACAL,MAEAK,EAAQ,QAAQ,CAACJ,MAAW;AACxB,QAAMK,IAAWP,EAAeC,GAAYC,EAAO,KAAK;AACxD,SAAOA,EAAO,MAAM,IAAI,CAACJ,OAAU,EAAE,MAAAA,GAAM,QAAAI,GAAQ,UAAUK,EAAS,IAAIT,EAAK,KAAK,IAAI;AAC5F,CAAC,GAMCU,IAAY,CAACC,GAA4Bb,MAA6C;AACxF,QAAMc,IAAUD,EAAI,OAAO,CAACE,MAAQd,EAAac,EAAI,MAAMf,CAAK,CAAC;AACjE,MAAI,CAACc,EAAQ,KAAK,CAACC,MAAQ,CAACA,EAAI,KA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,EAAa7B,GAAY,CAAC,EAAE,QAAAC,GAAQ,OAAO,CAAC4C,CAAI,EAAA,CAAG,CAAC,GAGhEC,IAAW,CAACC,GAAqBC,MACtCA,EAAW,WAAW,IAAUD,IAChCC,EAAW,WAAW,IAAU,GAAGD,CAAW,KAAKC,EAAW,CAAC,CAAC,KAC7D,GAAGD,CAAW,MAAMC,EAAW,KAAK,IAAI,CAAC,KAOvCC,IAAkB,CAC3BjD,GACAkD,GAEAC,IAAsB,SACX;AACX,QAAMC,IAAU,IAAI,IAAIpD,EAAW,IAAI,CAACG,MAAcA,EAAU,MAAM,CAAC,GACjE+B,IAAOgB,EAAM,OAAO,CAACjD,MAAWmD,EAAQ,IAAInD,CAAM,KAAKA,MAAWkD,CAAI;AAC5E,SAAO;AAAA,IACH,GAAGjB;AAAA,IACH,GAAGlC,EAAW,IAAI,CAACG,MAAcA,EAAU,MAAM,EAAE,OAAO,CAACkD,MAAM,CAACnB,EAAK,SAASmB,CAAC,CAAC;AAAA,EAAA;AAE1F;"}
@@ -1,14 +1,15 @@
1
- const r = "bg-[var(--malachite-table-background,#f7f7f7)] p-[4px] rounded-xl", o = 4, c = "var(--malachite-radius-xl, 12px)", e = 8, a = "1px solid var(--malachite-card-border, #e8e8e8)", t = {
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 = {
2
2
  background: "var(--malachite-table-row-background, #fff)",
3
3
  border: a,
4
4
  borderRadius: 8
5
5
  };
6
6
  export {
7
+ o as FRAME_BACKGROUND,
7
8
  r as FRAME_CLASS,
8
- o as FRAME_PADDING,
9
- c as FRAME_RADIUS,
9
+ c as FRAME_PADDING,
10
+ e as FRAME_RADIUS,
10
11
  a as FRAME_SECTION_BORDER,
11
- e as FRAME_SECTION_RADIUS,
12
- t as FRAME_SECTION_STYLE
12
+ t as FRAME_SECTION_RADIUS,
13
+ R as FRAME_SECTION_STYLE
13
14
  };
14
15
  //# 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 `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_PADDING","FRAME_RADIUS","FRAME_SECTION_RADIUS","FRAME_SECTION_BORDER","FRAME_SECTION_STYLE"],"mappings":"AAMO,MAAMA,IAAc,qEAEdC,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';\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;"}
package/dist/index.d.ts CHANGED
@@ -39,9 +39,9 @@ declare interface AccordionBaseProps {
39
39
  children?: default_2.ReactNode;
40
40
  /**
41
41
  * Visual style. `default` is the flat list row (row dividers, hover background).
42
- * `sunken` draws the section as a sunken card (dimmed rounded container, no
43
- * dividers/hover) — used for stacked detail sections in side panels and detail
44
- * pages (see `CollapsibleSection`). Both lead with the arrow: it is the affordance
42
+ * `sunken` draws the section as a sunken card (a rounded container in the table's frame
43
+ * colour, no dividers/hover) — used for stacked detail sections in side panels and
44
+ * detail pages (see `CollapsibleSection`). Both lead with the arrow: it is the affordance
45
45
  * that says the section opens, and a reader scanning a stack of them finds it in
46
46
  * one column rather than at whatever width each header happens to end.
47
47
  */
@@ -758,6 +758,7 @@ declare interface ChatComponent extends default_2.FC<ChatProps> {
758
758
  Message: default_2.FC<ChatMessageProps>;
759
759
  ToolCall: default_2.FC<ChatToolCallProps>;
760
760
  Thinking: default_2.FC<ChatThinkingProps>;
761
+ Reasoning: default_2.FC<ChatReasoningProps>;
761
762
  Composer: default_2.FC<ChatComposerProps>;
762
763
  ComposerChip: default_2.FC<ChatComposerChipProps>;
763
764
  Context: default_2.FC<ChatContextProps>;
@@ -953,6 +954,15 @@ export declare interface ChatProps {
953
954
  className?: string;
954
955
  }
955
956
 
957
+ export declare interface ChatReasoningProps {
958
+ /** Markdown. Absent or empty while nothing has arrived, or if the model summarised nothing. */
959
+ text?: string;
960
+ /** The model is still reasoning. Opens the card until it stops. */
961
+ streaming?: boolean;
962
+ title?: string;
963
+ className?: string;
964
+ }
965
+
956
966
  export declare type ChatRole = 'user' | 'assistant';
957
967
 
958
968
  export declare interface ChatSuggestionProps {
@@ -1001,15 +1011,20 @@ export declare interface ChatToolCallProps {
1001
1011
  * was taking two lines of the transcript to say nothing a reader wanted.
1002
1012
  */
1003
1013
  callId?: string;
1004
- /** Arguments the assistant sent. */
1005
- input?: object;
1014
+ /** Arguments the assistant sent. A string is shown as it is, for a payload that is not JSON. */
1015
+ input?: object | string;
1006
1016
  /** What the call returned. Absent while it is still running. */
1007
- output?: object;
1017
+ output?: object | string;
1018
+ /** Sits before the status on the row, outside the toggle, e.g. a risk indicator. */
1019
+ adornment?: default_2.ReactNode;
1020
+ /** Anything else the expanded card should carry, below the payloads. Unmounts on close. */
1021
+ children?: default_2.ReactNode;
1008
1022
  defaultExpanded?: boolean;
1009
1023
  className?: string;
1010
1024
  }
1011
1025
 
1012
- export declare type ChatToolCallStatus = 'running' | 'completed' | 'error';
1026
+ /** `blocked` is a call something refused to let run, which is not the call having failed. */
1027
+ export declare type ChatToolCallStatus = 'running' | 'completed' | 'error' | 'blocked';
1013
1028
 
1014
1029
  export declare const Checkbox: default_2.FC<CheckboxProps>;
1015
1030
 
@@ -1941,6 +1956,13 @@ export declare interface FilterSearchProps {
1941
1956
  onClear?: () => void;
1942
1957
  /** The filter whose values are open, or `null` on the filter list — for loading values lazily. */
1943
1958
  onActiveFilterChange?: (filter: string | null) => void;
1959
+ /** The text in the field on every change: typed, put back by clicking the text pill, or reset to `''` when a value is picked or the menu closes. */
1960
+ onQueryChange?: (query: string) => void;
1961
+ /** Lets typed text be committed as its own pill, under a `value` no filter uses. Its selection is `{ filter: textFilter.value, items: [text] }`. */
1962
+ textFilter?: {
1963
+ value: string;
1964
+ label: string;
1965
+ };
1944
1966
  placeholder?: string;
1945
1967
  size?: FilterSearchSize;
1946
1968
  width?: ControlWidth;