@ai-matrx/content-ir-react 0.22.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/dist/db-component.d.cts +8 -8
- package/dist/db-component.d.ts +8 -8
- package/dist/{directive-host-CtFMuSZc.d.cts → directive-host-QjoZEeik.d.cts} +3 -3
- package/dist/{directive-host-CtFMuSZc.d.ts → directive-host-QjoZEeik.d.ts} +3 -3
- package/dist/directives.d.cts +9 -9
- package/dist/directives.d.ts +9 -9
- package/dist/{host-types-mMFt5-hQ.d.cts → host-types-B2Q8fiU8.d.cts} +1 -1
- package/dist/{host-types-CGcK8Nib.d.ts → host-types-DvZukz6J.d.ts} +1 -1
- package/dist/host.d.cts +5 -5
- package/dist/host.d.ts +5 -5
- package/dist/kind-kit.cjs +1155 -0
- package/dist/kind-kit.cjs.map +1 -0
- package/dist/kind-kit.d.cts +418 -0
- package/dist/kind-kit.d.ts +418 -0
- package/dist/kind-kit.js +1131 -0
- package/dist/kind-kit.js.map +1 -0
- package/dist/react.d.cts +11 -11
- package/dist/react.d.ts +11 -11
- package/package.json +18 -3
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MatrxCopyMenuProps } from '@ai-matrx/alchemy/react/workspace';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The kit's HOST SLOTS. The kit never imports app code; the three things it cannot own are
|
|
6
|
+
* handed in once by the host through `setKindKitHost`:
|
|
7
|
+
* - `CopyButtons` the copy bar `KindHeaderBar` renders for its `copy` prop;
|
|
8
|
+
* - `ReadEmpty` what `SortableList` / `TagList` show instead of an empty state while a
|
|
9
|
+
* read has not succeeded;
|
|
10
|
+
* - `ReadStaleNotice` the notice above rows left on screen by a failed refresh.
|
|
11
|
+
* Each default is honest and working: a plain Copy button, and text that says what happened.
|
|
12
|
+
* State lives on globalThis under a Symbol.for key so two copies of the package share one host.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The copy bar's props: exactly the design system's `MatrxCopyMenuProps`, so a host registers its
|
|
17
|
+
* own `CopyButtons` (which takes that shape) with no adapter. Type-only: no runtime import.
|
|
18
|
+
*/
|
|
19
|
+
type KindKitCopyProps = MatrxCopyMenuProps;
|
|
20
|
+
type ReadStatus = "loading" | "error" | "ready";
|
|
21
|
+
/** A read's outcome, handed to a list primitive's `read` prop. */
|
|
22
|
+
interface ReadOutcome {
|
|
23
|
+
status: ReadStatus;
|
|
24
|
+
/** The failure itself, or a truthy flag when the read only says it failed. */
|
|
25
|
+
error?: unknown;
|
|
26
|
+
onRetry?: (() => void) | undefined;
|
|
27
|
+
/** What was read, in the reader's words: "your tasks". */
|
|
28
|
+
what?: string | undefined;
|
|
29
|
+
/** A successful read has already produced a value. */
|
|
30
|
+
hasData?: boolean | undefined;
|
|
31
|
+
}
|
|
32
|
+
interface KindKitReadEmptyProps {
|
|
33
|
+
read?: ReadOutcome | undefined;
|
|
34
|
+
loading?: React.ReactNode;
|
|
35
|
+
children?: React.ReactNode;
|
|
36
|
+
}
|
|
37
|
+
interface KindKitReadStaleNoticeProps {
|
|
38
|
+
read?: ReadOutcome | undefined;
|
|
39
|
+
className?: string;
|
|
40
|
+
}
|
|
41
|
+
interface KindKitHost {
|
|
42
|
+
CopyButtons: React.ComponentType<KindKitCopyProps>;
|
|
43
|
+
ReadEmpty: React.ComponentType<KindKitReadEmptyProps>;
|
|
44
|
+
ReadStaleNotice: React.ComponentType<KindKitReadStaleNoticeProps>;
|
|
45
|
+
}
|
|
46
|
+
/** Default copy bar: one "Copy" button that writes the `human` text (else the JSON) to the clipboard. */
|
|
47
|
+
declare function DefaultCopyButtons({ label, human, json, size, className }: KindKitCopyProps): React.JSX.Element;
|
|
48
|
+
/** Default: loading says it is loading; an error says what failed (with retry); ready shows the host's empty state. */
|
|
49
|
+
declare function DefaultReadEmpty({ read, loading, children }: KindKitReadEmptyProps): React.JSX.Element;
|
|
50
|
+
/** Default: when the latest read failed, the rows on screen may be out of date; says so, with retry. */
|
|
51
|
+
declare function DefaultReadStaleNotice({ read, className }: KindKitReadStaleNoticeProps): React.JSX.Element | null;
|
|
52
|
+
/** Register the host's copy bar and read notices. Call once at boot; a slot left out keeps its default. */
|
|
53
|
+
declare function setKindKitHost(host: Partial<KindKitHost>): void;
|
|
54
|
+
/** The slots in force: the host's where registered, the defaults elsewhere. */
|
|
55
|
+
declare function getKindKitHost(): KindKitHost;
|
|
56
|
+
/** Clear every registered slot (tests, hot reload). */
|
|
57
|
+
declare function resetKindKitHost(): void;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* SortableList — drag-to-reorder list for kind components.
|
|
61
|
+
*
|
|
62
|
+
* The mandated reorder UX, built once: while a row is dragged, the rows it
|
|
63
|
+
* passes DISPLACE (translate) out of the way and a SHADOWED placeholder marks
|
|
64
|
+
* exactly where the item will land. Native HTML5 drag-and-drop (no deps); a
|
|
65
|
+
* grab handle starts the drag (so text and inputs inside rows stay usable);
|
|
66
|
+
* up/down buttons are the keyboard + touch fallback; `onRemove` adds an inline
|
|
67
|
+
* remove control. Contract: `kind-kit/README.md`.
|
|
68
|
+
*
|
|
69
|
+
* Sandbox-safe by construction: imports only react, the design system,
|
|
70
|
+
* and `cn`.
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
interface SortableRenderContext {
|
|
74
|
+
index: number;
|
|
75
|
+
/** True for the row currently being dragged (rendered as the placeholder). */
|
|
76
|
+
isDragging: boolean;
|
|
77
|
+
}
|
|
78
|
+
interface SortableListProps<T> {
|
|
79
|
+
/** Current order. Treated as read-only; the new order arrives via `onReorder`. */
|
|
80
|
+
items: readonly T[];
|
|
81
|
+
/**
|
|
82
|
+
* Stable key per item. Default: the item itself when it is a string, else
|
|
83
|
+
* `item.id` / `item.key` when present, else the index (unstable — pass one).
|
|
84
|
+
*/
|
|
85
|
+
getKey?: (item: T, index: number) => string;
|
|
86
|
+
/** Called with the full reordered array after a drop or an arrow press. */
|
|
87
|
+
onReorder: (items: T[]) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Row content. Default: the item when it is a string/number, else its
|
|
90
|
+
* `label` / `title` / `name` / `text` field, else `JSON.stringify`.
|
|
91
|
+
*/
|
|
92
|
+
renderItem?: (item: T, ctx: SortableRenderContext) => React.ReactNode;
|
|
93
|
+
/** When set, every row gets an inline remove (X) control. */
|
|
94
|
+
onRemove?: (item: T, index: number) => void;
|
|
95
|
+
/** Disables drag, arrows and remove (rows still render). */
|
|
96
|
+
disabled?: boolean;
|
|
97
|
+
/** Hide the up/down arrow buttons (drag only). Default false. */
|
|
98
|
+
hideArrows?: boolean;
|
|
99
|
+
/** Shown when `items` is empty. */
|
|
100
|
+
emptyState?: React.ReactNode;
|
|
101
|
+
/**
|
|
102
|
+
* The outcome of the read behind the rows (RC-B12 r13). `emptyState` shows
|
|
103
|
+
* only after a read that succeeded; a failed read shows the failure + retry.
|
|
104
|
+
*/
|
|
105
|
+
read?: ReadOutcome;
|
|
106
|
+
/** Wrapper `<ul>` className. */
|
|
107
|
+
className?: string;
|
|
108
|
+
/** Per-row className (applied to every `<li>`). */
|
|
109
|
+
itemClassName?: string;
|
|
110
|
+
/** Accessible name for the list. */
|
|
111
|
+
ariaLabel?: string;
|
|
112
|
+
}
|
|
113
|
+
declare function SortableList<T>({ items, getKey, onReorder, renderItem, onRemove, disabled, hideArrows, emptyState, read, className, itemClassName, ariaLabel, }: SortableListProps<T>): React.JSX.Element | null;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* KindPanelGrid — content-aware responsive grid for side-by-side panels.
|
|
117
|
+
*
|
|
118
|
+
* Never more columns than the content can afford: every track is at least
|
|
119
|
+
* `minColumnWidth` (default 280px) wide, the column count is whatever fits
|
|
120
|
+
* (`auto-fit`), and every panel in a row stretches to the same height so the
|
|
121
|
+
* panels' footers line up. Pair with `KindPanel` (its `footer` is pinned to
|
|
122
|
+
* the bottom). Contract: `kind-kit/README.md`.
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
declare const GAP_PX: {
|
|
126
|
+
readonly sm: 8;
|
|
127
|
+
readonly md: 12;
|
|
128
|
+
readonly lg: 16;
|
|
129
|
+
};
|
|
130
|
+
interface KindPanelGridProps {
|
|
131
|
+
children: React.ReactNode;
|
|
132
|
+
/** Minimum width (px) of a column before the grid drops a column. Default 280. */
|
|
133
|
+
minColumnWidth?: number;
|
|
134
|
+
/** Hard ceiling on columns, however wide the container is. */
|
|
135
|
+
maxColumns?: number;
|
|
136
|
+
/** Space between panels. Default "md" (12px). */
|
|
137
|
+
gap?: keyof typeof GAP_PX;
|
|
138
|
+
/**
|
|
139
|
+
* "auto-fit" (default): a short last row lets panels grow to fill the width.
|
|
140
|
+
* "auto-fill": tracks stay the same width and the row is left short.
|
|
141
|
+
*/
|
|
142
|
+
fill?: "auto-fit" | "auto-fill";
|
|
143
|
+
className?: string;
|
|
144
|
+
}
|
|
145
|
+
declare function KindPanelGrid({ children, minColumnWidth, maxColumns, gap, fill, className, }: KindPanelGridProps): React.JSX.Element;
|
|
146
|
+
|
|
147
|
+
type KindKitIcon = React.ComponentType<{
|
|
148
|
+
className?: string;
|
|
149
|
+
}> | React.ReactElement<{
|
|
150
|
+
className?: string;
|
|
151
|
+
}>;
|
|
152
|
+
/** Render either icon authoring form without treating an element as a component type. */
|
|
153
|
+
declare function renderKindKitIcon(icon: KindKitIcon | undefined, className: string): React.ReactElement | null;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* KindPanel — the standard panel for a kind component's sub-sections (a
|
|
157
|
+
* keyword bucket, an option card, a section of results).
|
|
158
|
+
*
|
|
159
|
+
* Layout is fixed so agent-authored panels come out right by construction:
|
|
160
|
+
* - compact header: icon · title (wraps, never squeezed) · count · ≤2 inline
|
|
161
|
+
* actions · an overflow menu that absorbs EVERY other control (no control
|
|
162
|
+
* row ever gets crammed);
|
|
163
|
+
* - full-width subline (a rationale, a hint) on its own line UNDER the
|
|
164
|
+
* header — never beside the title;
|
|
165
|
+
* - body;
|
|
166
|
+
* - `footer` pinned to the bottom (flex column + mt-auto) so "Add" rows
|
|
167
|
+
* line up across sibling panels in a `KindPanelGrid`.
|
|
168
|
+
* Contract: `kind-kit/README.md`.
|
|
169
|
+
*/
|
|
170
|
+
|
|
171
|
+
interface KindPanelMenuItem {
|
|
172
|
+
label: string;
|
|
173
|
+
onSelect: () => void;
|
|
174
|
+
icon?: React.ComponentType<{
|
|
175
|
+
className?: string;
|
|
176
|
+
}>;
|
|
177
|
+
disabled?: boolean;
|
|
178
|
+
/** Renders in the destructive colour (delete, clear, reset). */
|
|
179
|
+
destructive?: boolean;
|
|
180
|
+
/** Draws a separator ABOVE this item. */
|
|
181
|
+
separatorBefore?: boolean;
|
|
182
|
+
}
|
|
183
|
+
interface KindPanelProps {
|
|
184
|
+
/** Header title. Wraps onto extra lines rather than truncating. */
|
|
185
|
+
title: React.ReactNode;
|
|
186
|
+
/** Lucide component or an already-created icon element shown before the title. */
|
|
187
|
+
icon?: KindKitIcon;
|
|
188
|
+
/** Count pill after the title (e.g. number of items). */
|
|
189
|
+
count?: number | string;
|
|
190
|
+
/** Any extra pill/badge after the count (a status, a score). */
|
|
191
|
+
badge?: React.ReactNode;
|
|
192
|
+
/** Shows a spinner in the header while this panel's data is still arriving. */
|
|
193
|
+
streaming?: boolean;
|
|
194
|
+
/**
|
|
195
|
+
* At most one or two compact controls rendered inline on the right of the
|
|
196
|
+
* header (a toggle, a tiny icon button). Put everything else in `menuItems`.
|
|
197
|
+
*/
|
|
198
|
+
actions?: React.ReactNode;
|
|
199
|
+
/** Controls collapsed into the header's overflow (⋯) menu. */
|
|
200
|
+
menuItems?: KindPanelMenuItem[];
|
|
201
|
+
/** Full-width line under the header — a rationale, a hint. Never beside the title. */
|
|
202
|
+
subline?: React.ReactNode;
|
|
203
|
+
/** Panel body. */
|
|
204
|
+
children?: React.ReactNode;
|
|
205
|
+
/** Pinned to the bottom of the panel (an "Add" row, a summary, a copy bar). */
|
|
206
|
+
footer?: React.ReactNode;
|
|
207
|
+
/** "card" (default): bordered card. "bare": no border/background — the host IS the chrome. */
|
|
208
|
+
variant?: "card" | "bare";
|
|
209
|
+
/** Tighter paddings for dense lists. */
|
|
210
|
+
dense?: boolean;
|
|
211
|
+
className?: string;
|
|
212
|
+
/** className for the body wrapper. */
|
|
213
|
+
bodyClassName?: string;
|
|
214
|
+
}
|
|
215
|
+
declare function KindPanel({ title, icon, count, badge, streaming, actions, menuItems, subline, children, footer, variant, dense, className, bodyClassName, }: KindPanelProps): React.JSX.Element;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* KindHeaderBar — the standard compact header of a kind component:
|
|
219
|
+
* icon · title (the instance's `title_key` value) · at-a-glance stats · the
|
|
220
|
+
* copy bar (the host's `CopyButtons` slot: Copy / Copy-for-AI / JSON / Export from builders
|
|
221
|
+
* the caller supplies). One row that wraps on narrow widths; the copy bar
|
|
222
|
+
* stays on the right. Contract: `kind-kit/README.md`.
|
|
223
|
+
*/
|
|
224
|
+
|
|
225
|
+
interface KindHeaderStat {
|
|
226
|
+
/** Short label, e.g. "keywords". */
|
|
227
|
+
label: string;
|
|
228
|
+
/** The number/text, e.g. 42 or "3 buckets". */
|
|
229
|
+
value: React.ReactNode;
|
|
230
|
+
/** Lucide component or an already-created icon element. */
|
|
231
|
+
icon?: KindKitIcon;
|
|
232
|
+
/** Optional hover text. */
|
|
233
|
+
title?: string;
|
|
234
|
+
}
|
|
235
|
+
interface KindHeaderBarProps {
|
|
236
|
+
/** The instance title (usually `data[title_key]`). */
|
|
237
|
+
title: React.ReactNode;
|
|
238
|
+
/** Lucide component or an already-created icon element. */
|
|
239
|
+
icon?: KindKitIcon;
|
|
240
|
+
/** Small muted line under the title (a primary keyword, a subtitle). */
|
|
241
|
+
subtitle?: React.ReactNode;
|
|
242
|
+
/** At-a-glance numbers rendered as compact "value label" stats. */
|
|
243
|
+
stats?: KindHeaderStat[];
|
|
244
|
+
/** Shows a spinner + "Streaming" while the instance is still arriving. */
|
|
245
|
+
streaming?: boolean;
|
|
246
|
+
/** Word shown beside the spinner. Default "Streaming". */
|
|
247
|
+
streamingLabel?: string;
|
|
248
|
+
/**
|
|
249
|
+
* The copy bar. Pass the builders you have — `human` (text), `agent`
|
|
250
|
+
* (payload or string), `json` (raw record), `export` (download items) and
|
|
251
|
+
* the `label` used in toasts. Omit to render no copy bar.
|
|
252
|
+
*/
|
|
253
|
+
copy?: Omit<KindKitCopyProps, "size" | "className">;
|
|
254
|
+
/** Extra controls rendered between the stats and the copy bar. */
|
|
255
|
+
actions?: React.ReactNode;
|
|
256
|
+
/** "sm" (default) for in-chat blocks; "md" for page-level kind surfaces. */
|
|
257
|
+
size?: "sm" | "md";
|
|
258
|
+
className?: string;
|
|
259
|
+
}
|
|
260
|
+
declare function KindHeaderBar({ title, icon, subtitle, stats, streaming, streamingLabel, copy, actions, size, className, }: KindHeaderBarProps): React.JSX.Element;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* KindActionButton — the one-click door from a kind component to a host
|
|
264
|
+
* Action. Wraps the component's `runAction(key, input)` prop (the ONLY
|
|
265
|
+
* side-effect channel; it never throws, it returns an `{ok}` envelope), with
|
|
266
|
+
* a busy state, no double fire, an optional inline confirm that states the
|
|
267
|
+
* consequence, and a one-line inline error (the host already toasts).
|
|
268
|
+
* Contract: `kind-kit/README.md`.
|
|
269
|
+
*/
|
|
270
|
+
|
|
271
|
+
type KindActionEnvelope = {
|
|
272
|
+
ok: true;
|
|
273
|
+
result?: unknown;
|
|
274
|
+
} | {
|
|
275
|
+
ok: false;
|
|
276
|
+
error: string;
|
|
277
|
+
};
|
|
278
|
+
interface KindActionButtonProps {
|
|
279
|
+
/** The component's `runAction` prop, passed straight through. */
|
|
280
|
+
runAction: (key: string, input: unknown) => Promise<KindActionEnvelope>;
|
|
281
|
+
/** Action key, e.g. "run_shortcut". */
|
|
282
|
+
action: string;
|
|
283
|
+
/** The action input, or a function that builds it at click time. */
|
|
284
|
+
input: unknown | (() => unknown);
|
|
285
|
+
/** Short label. Also the aria-label/tooltip when `compact`. */
|
|
286
|
+
label: string;
|
|
287
|
+
/** Lucide component or an already-created icon element. */
|
|
288
|
+
icon?: KindKitIcon;
|
|
289
|
+
/** Label while running. Defaults to `label`. */
|
|
290
|
+
busyLabel?: string;
|
|
291
|
+
/** One-sentence consequence. When set, the first click asks to confirm. */
|
|
292
|
+
confirm?: string;
|
|
293
|
+
onDone?: (result: unknown) => void;
|
|
294
|
+
onError?: (error: string) => void;
|
|
295
|
+
variant?: "default" | "primary" | "destructive" | "success" | "outline" | "secondary" | "ghost" | "subtle";
|
|
296
|
+
/** Icon-only with tooltip + aria-label, for menus and header rows. */
|
|
297
|
+
compact?: boolean;
|
|
298
|
+
disabled?: boolean;
|
|
299
|
+
className?: string;
|
|
300
|
+
}
|
|
301
|
+
declare function KindActionButton({ runAction, action, input, label, icon, busyLabel, confirm, onDone, onError, variant, compact, disabled, className, }: KindActionButtonProps): React.JSX.Element;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* StreamingSkeleton + useStreamingValue — the "before data lands" kit.
|
|
305
|
+
*
|
|
306
|
+
* A kind component receives partial `data` on every envelope flush while the
|
|
307
|
+
* agent streams: fields are absent, arrays are short, strings are cut. The
|
|
308
|
+
* skeleton mimics the layout the real content will have (list / cards /
|
|
309
|
+
* table / text) for the instant before anything arrives; the helpers make
|
|
310
|
+
* field reads tolerant so a component never crashes on a half-built
|
|
311
|
+
* instance and never flickers a value away. Contract:
|
|
312
|
+
* `kind-kit/README.md`.
|
|
313
|
+
*/
|
|
314
|
+
|
|
315
|
+
interface StreamingSkeletonProps {
|
|
316
|
+
/** Layout to mimic. Default "list". */
|
|
317
|
+
layout?: "list" | "cards" | "table" | "text";
|
|
318
|
+
/** Rows (list/table/text lines) or cards. Default 3. */
|
|
319
|
+
rows?: number;
|
|
320
|
+
/** Columns for "table" / "cards". Default 3 (table) / 2 (cards). */
|
|
321
|
+
columns?: number;
|
|
322
|
+
/** Render a title bar line above the body. Default true. */
|
|
323
|
+
header?: boolean;
|
|
324
|
+
/** Accessible label. Default "Loading". */
|
|
325
|
+
label?: string;
|
|
326
|
+
className?: string;
|
|
327
|
+
}
|
|
328
|
+
declare function StreamingSkeleton({ layout, rows, columns, header, label, className, }: StreamingSkeletonProps): React.JSX.Element;
|
|
329
|
+
/**
|
|
330
|
+
* Sticky, tolerant read of a value that may be absent mid-stream.
|
|
331
|
+
*
|
|
332
|
+
* Returns the latest DEFINED value seen (so a re-parse that momentarily drops
|
|
333
|
+
* a field does not blank the UI), `fallback` until one arrives, and `arrived`
|
|
334
|
+
* once any real value has been observed. Implemented with the React
|
|
335
|
+
* "remember the previous render" pattern (state updated during render), so
|
|
336
|
+
* pass a FIELD READ (`data?.summary`) — never an expression that builds a
|
|
337
|
+
* new object/array on every render (`data?.items ?? []`), which would
|
|
338
|
+
* re-trigger the update each render.
|
|
339
|
+
*/
|
|
340
|
+
declare function useStreamingValue<T>(value: T | null | undefined, fallback: T): {
|
|
341
|
+
value: T;
|
|
342
|
+
arrived: boolean;
|
|
343
|
+
};
|
|
344
|
+
/** `value` when it is an array, else `[]` — for `data.items` that is not there yet. */
|
|
345
|
+
declare function streamList<T = unknown>(value: unknown): T[];
|
|
346
|
+
/** `value` when it is a non-empty string, else `fallback` ("" by default). */
|
|
347
|
+
declare function streamText(value: unknown, fallback?: string): string;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* KeywordChip + TagList — chips that WRAP, never truncate.
|
|
351
|
+
*
|
|
352
|
+
* A keyword / tag / phrase is always shown in full: the chip wraps its text
|
|
353
|
+
* onto extra lines inside the chip, and the list wraps chips onto extra rows.
|
|
354
|
+
* Optional select (checkbox-like toggle), remove (X) and inline edit
|
|
355
|
+
* (pencil → input, Enter commits, Esc cancels). `TagList` adds an inline
|
|
356
|
+
* "Add" input at the end when `onAdd` is given. Contract:
|
|
357
|
+
* `kind-kit/README.md`.
|
|
358
|
+
*/
|
|
359
|
+
|
|
360
|
+
interface KeywordChipProps {
|
|
361
|
+
/** The phrase. Rendered in full — wraps, never truncates. */
|
|
362
|
+
label: string;
|
|
363
|
+
/** Small trailing detail (a count, a volume, a score). */
|
|
364
|
+
meta?: React.ReactNode;
|
|
365
|
+
/** Lucide component or an already-created icon element. */
|
|
366
|
+
icon?: KindKitIcon;
|
|
367
|
+
/** Selected state; pass `onSelect` to make the chip a toggle. */
|
|
368
|
+
selected?: boolean;
|
|
369
|
+
/** Makes the chip a toggle; called with the next selected state. */
|
|
370
|
+
onSelect?: ((selected: boolean) => void) | undefined;
|
|
371
|
+
/** Adds an X control. */
|
|
372
|
+
onRemove?: (() => void) | undefined;
|
|
373
|
+
/** Enables inline edit (pencil control + double-click); called with the committed text. */
|
|
374
|
+
onEdit?: ((next: string) => void) | undefined;
|
|
375
|
+
/** Greys the chip and disables select/remove/edit. */
|
|
376
|
+
disabled?: boolean | undefined;
|
|
377
|
+
tone?: "default" | "primary" | "muted" | undefined;
|
|
378
|
+
size?: "sm" | "md";
|
|
379
|
+
className?: string;
|
|
380
|
+
}
|
|
381
|
+
declare function KeywordChip({ label, meta, icon, selected, onSelect, onRemove, onEdit, disabled, tone, size, className, }: KeywordChipProps): React.JSX.Element;
|
|
382
|
+
interface TagItem {
|
|
383
|
+
label: string;
|
|
384
|
+
/** Stable key; defaults to `label`. */
|
|
385
|
+
key?: string;
|
|
386
|
+
meta?: React.ReactNode;
|
|
387
|
+
disabled?: boolean;
|
|
388
|
+
}
|
|
389
|
+
interface TagListProps {
|
|
390
|
+
/** Phrases, as strings or `{ label, key?, meta?, disabled? }` objects. */
|
|
391
|
+
items: readonly (string | TagItem)[];
|
|
392
|
+
/** Selected keys (label when no key). Pass with `onToggle` for selectable chips. */
|
|
393
|
+
selected?: readonly string[];
|
|
394
|
+
/** Makes chips toggles; called with (key, nextSelected). */
|
|
395
|
+
onToggle?: (key: string, selected: boolean) => void;
|
|
396
|
+
/** Adds an X on every chip; called with (key, index). */
|
|
397
|
+
onRemove?: (key: string, index: number) => void;
|
|
398
|
+
/** Enables inline edit on every chip; called with (key, index, nextLabel). */
|
|
399
|
+
onEdit?: (key: string, index: number, next: string) => void;
|
|
400
|
+
/** Renders an inline "Add" input at the end; called with the trimmed text. */
|
|
401
|
+
onAdd?: (label: string) => void;
|
|
402
|
+
/** Placeholder of the add input. Default "Add…". */
|
|
403
|
+
addPlaceholder?: string;
|
|
404
|
+
/** Shown when `items` is empty (and there is no add input). */
|
|
405
|
+
emptyState?: React.ReactNode;
|
|
406
|
+
/**
|
|
407
|
+
* The outcome of the read behind the rows (RC-B12 r13). `emptyState` shows
|
|
408
|
+
* only after a read that succeeded; a failed read shows the failure + retry.
|
|
409
|
+
*/
|
|
410
|
+
read?: ReadOutcome;
|
|
411
|
+
tone?: KeywordChipProps["tone"];
|
|
412
|
+
size?: KeywordChipProps["size"];
|
|
413
|
+
disabled?: boolean;
|
|
414
|
+
className?: string;
|
|
415
|
+
}
|
|
416
|
+
declare function TagList({ items, selected, onToggle, onRemove, onEdit, onAdd, addPlaceholder, emptyState, read, tone, size, disabled, className, }: TagListProps): React.JSX.Element | null;
|
|
417
|
+
|
|
418
|
+
export { DefaultCopyButtons, DefaultReadEmpty, DefaultReadStaleNotice, KeywordChip, type KeywordChipProps, KindActionButton, type KindActionButtonProps, type KindActionEnvelope, KindHeaderBar, type KindHeaderBarProps, type KindHeaderStat, type KindKitCopyProps, type KindKitHost, type KindKitIcon, type KindKitReadEmptyProps, type KindKitReadStaleNoticeProps, KindPanel, KindPanelGrid, type KindPanelGridProps, type KindPanelMenuItem, type KindPanelProps, type ReadOutcome, type ReadStatus, SortableList, type SortableListProps, type SortableRenderContext, StreamingSkeleton, type StreamingSkeletonProps, type TagItem, TagList, type TagListProps, getKindKitHost, renderKindKitIcon, resetKindKitHost, setKindKitHost, streamList, streamText, useStreamingValue };
|