@dowel-ui/react 0.2.0 → 0.4.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 (141) hide show
  1. package/README.md +14 -7
  2. package/dist/components/ai-agent-plan/ai-agent-plan.d.ts +50 -0
  3. package/dist/components/ai-agent-plan/ai-agent-plan.d.ts.map +1 -0
  4. package/dist/components/ai-agent-plan/ai-agent-plan.js +156 -0
  5. package/dist/components/ai-agent-plan/ai-agent-plan.js.map +1 -0
  6. package/dist/components/ai-agent-plan/index.d.ts +2 -0
  7. package/dist/components/ai-agent-plan/index.js +2 -0
  8. package/dist/components/ai-agent-plan/meta.js +17 -0
  9. package/dist/components/ai-agent-plan/meta.js.map +1 -0
  10. package/dist/components/ai-agent-status/ai-agent-status.d.ts +1 -1
  11. package/dist/components/ai-approval-request/ai-approval-request.d.ts +67 -0
  12. package/dist/components/ai-approval-request/ai-approval-request.d.ts.map +1 -0
  13. package/dist/components/ai-approval-request/ai-approval-request.js +218 -0
  14. package/dist/components/ai-approval-request/ai-approval-request.js.map +1 -0
  15. package/dist/components/ai-approval-request/index.d.ts +2 -0
  16. package/dist/components/ai-approval-request/index.js +2 -0
  17. package/dist/components/ai-approval-request/meta.js +17 -0
  18. package/dist/components/ai-approval-request/meta.js.map +1 -0
  19. package/dist/components/ai-disclosure/ai-disclosure.d.ts +92 -0
  20. package/dist/components/ai-disclosure/ai-disclosure.d.ts.map +1 -0
  21. package/dist/components/ai-disclosure/ai-disclosure.js +122 -0
  22. package/dist/components/ai-disclosure/ai-disclosure.js.map +1 -0
  23. package/dist/components/ai-disclosure/index.d.ts +2 -0
  24. package/dist/components/ai-disclosure/index.js +2 -0
  25. package/dist/components/ai-disclosure/meta.js +17 -0
  26. package/dist/components/ai-disclosure/meta.js.map +1 -0
  27. package/dist/components/ai-response/ai-response.d.ts.map +1 -1
  28. package/dist/components/ai-response/ai-response.js +1 -0
  29. package/dist/components/ai-response/ai-response.js.map +1 -1
  30. package/dist/components/ai-structured-output/ai-structured-output.d.ts.map +1 -1
  31. package/dist/components/ai-structured-output/ai-structured-output.js +13 -2
  32. package/dist/components/ai-structured-output/ai-structured-output.js.map +1 -1
  33. package/dist/components/ai-tool/ai-tool.d.ts +1 -1
  34. package/dist/components/alert/alert.d.ts +1 -1
  35. package/dist/components/avatar/avatar.d.ts +1 -1
  36. package/dist/components/badge/badge.d.ts +1 -1
  37. package/dist/components/button/button.d.ts +1 -1
  38. package/dist/components/date-picker/date-picker.js +1 -1
  39. package/dist/components/diff-viewer/diff-model.d.ts +69 -0
  40. package/dist/components/diff-viewer/diff-model.d.ts.map +1 -0
  41. package/dist/components/diff-viewer/diff-model.js +180 -0
  42. package/dist/components/diff-viewer/diff-model.js.map +1 -0
  43. package/dist/components/diff-viewer/diff-viewer.d.ts +42 -0
  44. package/dist/components/diff-viewer/diff-viewer.d.ts.map +1 -0
  45. package/dist/components/diff-viewer/diff-viewer.js +212 -0
  46. package/dist/components/diff-viewer/diff-viewer.js.map +1 -0
  47. package/dist/components/diff-viewer/index.d.ts +3 -0
  48. package/dist/components/diff-viewer/index.js +3 -0
  49. package/dist/components/diff-viewer/meta.js +17 -0
  50. package/dist/components/diff-viewer/meta.js.map +1 -0
  51. package/dist/components/file-upload/file-upload.d.ts +46 -0
  52. package/dist/components/file-upload/file-upload.d.ts.map +1 -0
  53. package/dist/components/file-upload/file-upload.js +204 -0
  54. package/dist/components/file-upload/file-upload.js.map +1 -0
  55. package/dist/components/file-upload/index.d.ts +3 -0
  56. package/dist/components/file-upload/index.js +3 -0
  57. package/dist/components/file-upload/meta.js +17 -0
  58. package/dist/components/file-upload/meta.js.map +1 -0
  59. package/dist/components/file-upload/upload-queue.d.ts +87 -0
  60. package/dist/components/file-upload/upload-queue.d.ts.map +1 -0
  61. package/dist/components/file-upload/upload-queue.js +249 -0
  62. package/dist/components/file-upload/upload-queue.js.map +1 -0
  63. package/dist/components/log-viewer/index.d.ts +3 -0
  64. package/dist/components/log-viewer/index.js +3 -0
  65. package/dist/components/log-viewer/log-stream.d.ts +68 -0
  66. package/dist/components/log-viewer/log-stream.d.ts.map +1 -0
  67. package/dist/components/log-viewer/log-stream.js +120 -0
  68. package/dist/components/log-viewer/log-stream.js.map +1 -0
  69. package/dist/components/log-viewer/log-viewer.d.ts +51 -0
  70. package/dist/components/log-viewer/log-viewer.d.ts.map +1 -0
  71. package/dist/components/log-viewer/log-viewer.js +284 -0
  72. package/dist/components/log-viewer/log-viewer.js.map +1 -0
  73. package/dist/components/log-viewer/meta.js +17 -0
  74. package/dist/components/log-viewer/meta.js.map +1 -0
  75. package/dist/components/progress/progress.d.ts +1 -1
  76. package/dist/components/progress/progress.js +1 -0
  77. package/dist/components/progress/progress.js.map +1 -1
  78. package/dist/components/spinner/spinner.d.ts +1 -1
  79. package/dist/components/spinner/spinner.js +1 -0
  80. package/dist/components/spinner/spinner.js.map +1 -1
  81. package/dist/components/tags-input/index.d.ts +2 -0
  82. package/dist/components/tags-input/index.js +2 -0
  83. package/dist/components/tags-input/meta.js +17 -0
  84. package/dist/components/tags-input/meta.js.map +1 -0
  85. package/dist/components/tags-input/tags-input.d.ts +47 -0
  86. package/dist/components/tags-input/tags-input.d.ts.map +1 -0
  87. package/dist/components/tags-input/tags-input.js +182 -0
  88. package/dist/components/tags-input/tags-input.js.map +1 -0
  89. package/dist/components/time-range-picker/index.d.ts +3 -0
  90. package/dist/components/time-range-picker/index.js +3 -0
  91. package/dist/components/time-range-picker/meta.js +22 -0
  92. package/dist/components/time-range-picker/meta.js.map +1 -0
  93. package/dist/components/time-range-picker/time-expression.d.ts +88 -0
  94. package/dist/components/time-range-picker/time-expression.d.ts.map +1 -0
  95. package/dist/components/time-range-picker/time-expression.js +335 -0
  96. package/dist/components/time-range-picker/time-expression.js.map +1 -0
  97. package/dist/components/time-range-picker/time-range-picker.d.ts +65 -0
  98. package/dist/components/time-range-picker/time-range-picker.d.ts.map +1 -0
  99. package/dist/components/time-range-picker/time-range-picker.js +377 -0
  100. package/dist/components/time-range-picker/time-range-picker.js.map +1 -0
  101. package/dist/components/toast/toast.d.ts +1 -1
  102. package/dist/index.d.ts +21 -1
  103. package/dist/index.js +14 -2
  104. package/dist/registry/components.d.ts.map +1 -1
  105. package/dist/registry/components.js +66 -50
  106. package/dist/registry/components.js.map +1 -1
  107. package/package.json +6 -4
  108. package/src/components/ai-agent-plan/ai-agent-plan.tsx +0 -0
  109. package/src/components/ai-agent-plan/index.ts +10 -0
  110. package/src/components/ai-agent-plan/meta.ts +19 -0
  111. package/src/components/ai-approval-request/ai-approval-request.tsx +368 -0
  112. package/src/components/ai-approval-request/index.ts +7 -0
  113. package/src/components/ai-approval-request/meta.ts +21 -0
  114. package/src/components/ai-disclosure/ai-disclosure.tsx +244 -0
  115. package/src/components/ai-disclosure/index.ts +9 -0
  116. package/src/components/ai-disclosure/meta.ts +23 -0
  117. package/src/components/ai-response/ai-response.tsx +1 -0
  118. package/src/components/ai-structured-output/ai-structured-output.tsx +25 -1
  119. package/src/components/diff-viewer/diff-model.ts +256 -0
  120. package/src/components/diff-viewer/diff-viewer.tsx +339 -0
  121. package/src/components/diff-viewer/index.ts +17 -0
  122. package/src/components/diff-viewer/meta.ts +20 -0
  123. package/src/components/file-upload/file-upload.tsx +322 -0
  124. package/src/components/file-upload/index.ts +20 -0
  125. package/src/components/file-upload/meta.ts +21 -0
  126. package/src/components/file-upload/upload-queue.ts +337 -0
  127. package/src/components/log-viewer/index.ts +21 -0
  128. package/src/components/log-viewer/log-stream.ts +176 -0
  129. package/src/components/log-viewer/log-viewer.tsx +424 -0
  130. package/src/components/log-viewer/meta.ts +21 -0
  131. package/src/components/progress/progress.tsx +3 -0
  132. package/src/components/spinner/spinner.tsx +5 -0
  133. package/src/components/tags-input/index.ts +1 -0
  134. package/src/components/tags-input/meta.ts +23 -0
  135. package/src/components/tags-input/tags-input.tsx +300 -0
  136. package/src/components/time-range-picker/index.ts +25 -0
  137. package/src/components/time-range-picker/meta.ts +22 -0
  138. package/src/components/time-range-picker/time-expression.ts +491 -0
  139. package/src/components/time-range-picker/time-range-picker.tsx +522 -0
  140. package/src/index.ts +8 -0
  141. package/src/registry/components.ts +16 -0
@@ -0,0 +1,377 @@
1
+ "use client";
2
+ import { focusRing } from "../../lib/styles.js";
3
+ import { cn } from "../../lib/utils.js";
4
+ import { Popover, PopoverContent, PopoverTrigger } from "../popover/popover.js";
5
+ import { Button } from "../button/button.js";
6
+ import { Calendar } from "../calendar/calendar.js";
7
+ import { Input } from "../input/input.js";
8
+ import { DEFAULT_PRESETS, TimeExpressionError, absoluteExpression, describeTimeRange, formatResolvedRange, resolveTimeRange } from "./time-expression.js";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ import { createContext, useCallback, useContext, useId, useMemo, useState, useSyncExternalStore } from "react";
11
+ //#region src/components/time-range-picker/time-range-picker.tsx
12
+ /** Stands in until the clock is known. Never shown; see `clockReady`. */
13
+ const EPOCH = /* @__PURE__ */ new Date(0);
14
+ /**
15
+ * The clock, for callers who did not supply one.
16
+ *
17
+ * `useSyncExternalStore` rather than an effect, because this is the case it
18
+ * exists for: a value the server cannot know. The server snapshot is null, so a
19
+ * server render and the hydration render both commit to nothing clock-dependent
20
+ * and cannot disagree; the real instant arrives in the re-render after.
21
+ *
22
+ * `getSnapshot` has to be referentially stable, so the instant is created once
23
+ * for the page. That means every picker without a `now` prop shares it and none
24
+ * of them advance — which is the whole reason the prop is there.
25
+ */
26
+ const subscribeToNothing = () => () => void 0;
27
+ let sharedClock = null;
28
+ const readSharedClock = () => sharedClock ??= /* @__PURE__ */ new Date();
29
+ const readNoClock = () => null;
30
+ const TimeRangeContext = createContext(null);
31
+ function useTimeRange(component) {
32
+ const context = useContext(TimeRangeContext);
33
+ if (!context) throw new Error(`${component} must be used inside <TimeRange>.`);
34
+ return context;
35
+ }
36
+ function TimeRange({ value: valueProp, defaultValue = "now-6h..now", onValueChange, now, timeZone, locale, presets = DEFAULT_PRESETS, open: openProp, onOpenChange, children }) {
37
+ const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
38
+ const value = valueProp ?? uncontrolledValue;
39
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
40
+ const open = openProp ?? uncontrolledOpen;
41
+ const labelId = useId();
42
+ const fallbackClock = useSyncExternalStore(subscribeToNothing, readSharedClock, readNoClock);
43
+ const clock = now ?? fallbackClock;
44
+ const effectiveNow = clock ?? EPOCH;
45
+ const setOpen = useCallback((next) => {
46
+ if (openProp === void 0) setUncontrolledOpen(next);
47
+ onOpenChange?.(next);
48
+ }, [openProp, onOpenChange]);
49
+ const setValue = useCallback((expression) => {
50
+ if (valueProp === void 0) setUncontrolledValue(expression);
51
+ onValueChange?.(expression);
52
+ }, [valueProp, onValueChange]);
53
+ const { resolved, error } = useMemo(() => {
54
+ if (!clock) return {
55
+ resolved: null,
56
+ error: null
57
+ };
58
+ try {
59
+ return {
60
+ resolved: resolveTimeRange(value, {
61
+ now: clock,
62
+ timeZone
63
+ }),
64
+ error: null
65
+ };
66
+ } catch (thrown) {
67
+ return {
68
+ resolved: null,
69
+ error: thrown instanceof TimeExpressionError ? thrown.message : "Invalid time range."
70
+ };
71
+ }
72
+ }, [
73
+ value,
74
+ clock,
75
+ timeZone
76
+ ]);
77
+ const context = useMemo(() => ({
78
+ value,
79
+ setValue,
80
+ now: effectiveNow,
81
+ timeZone,
82
+ locale,
83
+ presets,
84
+ resolved,
85
+ error,
86
+ clockReady: clock !== null,
87
+ close: () => {
88
+ setOpen(false);
89
+ },
90
+ labelId
91
+ }), [
92
+ value,
93
+ setValue,
94
+ effectiveNow,
95
+ clock,
96
+ timeZone,
97
+ locale,
98
+ presets,
99
+ resolved,
100
+ error,
101
+ setOpen,
102
+ labelId
103
+ ]);
104
+ return /* @__PURE__ */ jsx(TimeRangeContext.Provider, {
105
+ value: context,
106
+ children: /* @__PURE__ */ jsx(Popover, {
107
+ open,
108
+ onOpenChange: setOpen,
109
+ children
110
+ })
111
+ });
112
+ }
113
+ function ClockIcon() {
114
+ return /* @__PURE__ */ jsxs("svg", {
115
+ viewBox: "0 0 24 24",
116
+ fill: "none",
117
+ "aria-hidden": "true",
118
+ className: "size-4 opacity-70",
119
+ children: [/* @__PURE__ */ jsx("circle", {
120
+ cx: "12",
121
+ cy: "12",
122
+ r: "9",
123
+ stroke: "currentColor",
124
+ strokeWidth: "2"
125
+ }), /* @__PURE__ */ jsx("path", {
126
+ d: "M12 7v5l3 2",
127
+ stroke: "currentColor",
128
+ strokeWidth: "2",
129
+ strokeLinecap: "round"
130
+ })]
131
+ });
132
+ }
133
+ /**
134
+ * The button, named by the range it holds: "Last 6 hours", not two timestamps.
135
+ * The resolved window stays reachable as the title, and as `showResolved`.
136
+ */
137
+ function TimeRangeTrigger({ className, showResolved = false, ...props }) {
138
+ const { value, now, timeZone, locale, presets, resolved, error } = useTimeRange("TimeRangeTrigger");
139
+ const label = describeTimeRange(value, {
140
+ now,
141
+ timeZone,
142
+ locale,
143
+ presets
144
+ });
145
+ const resolvedText = resolved ? formatResolvedRange(resolved, {
146
+ locale,
147
+ timeZone
148
+ }) : null;
149
+ return /* @__PURE__ */ jsx(PopoverTrigger, {
150
+ asChild: true,
151
+ children: /* @__PURE__ */ jsxs(Button, {
152
+ "data-slot": "time-range-trigger",
153
+ variant: "outline",
154
+ "aria-invalid": error ? true : void 0,
155
+ title: resolvedText ?? void 0,
156
+ className: cn("justify-start gap-2 font-normal", className),
157
+ ...props,
158
+ children: [
159
+ /* @__PURE__ */ jsx(ClockIcon, {}),
160
+ /* @__PURE__ */ jsxs("span", {
161
+ className: "flex flex-col items-start leading-tight",
162
+ children: [/* @__PURE__ */ jsx("span", { children: label }), showResolved && resolvedText ? /* @__PURE__ */ jsx("span", {
163
+ className: "text-2xs font-normal text-muted-foreground",
164
+ children: resolvedText
165
+ }) : null]
166
+ }),
167
+ resolvedText && !showResolved ? /* @__PURE__ */ jsx("span", {
168
+ className: "sr-only",
169
+ children: `, ${resolvedText}`
170
+ }) : null
171
+ ]
172
+ })
173
+ });
174
+ }
175
+ function TimeRangeContent({ className, label = "Choose a time range", children, ...props }) {
176
+ const { labelId } = useTimeRange("TimeRangeContent");
177
+ return /* @__PURE__ */ jsxs(PopoverContent, {
178
+ "data-slot": "time-range-content",
179
+ "aria-labelledby": labelId,
180
+ align: "start",
181
+ className: cn("w-auto max-w-[min(38rem,calc(100vw-2rem))] p-0", className),
182
+ ...props,
183
+ children: [/* @__PURE__ */ jsx("h2", {
184
+ id: labelId,
185
+ className: "sr-only",
186
+ children: label
187
+ }), /* @__PURE__ */ jsx("div", {
188
+ className: "flex flex-col gap-0 sm:flex-row sm:items-stretch",
189
+ children
190
+ })]
191
+ });
192
+ }
193
+ /**
194
+ * The named ranges, which is how most of these are actually used. Buttons
195
+ * rather than a radiogroup: choosing one both selects and dismisses, which is a
196
+ * command, and `aria-pressed` still carries which one matches.
197
+ */
198
+ function TimeRangePresets({ className, ...props }) {
199
+ const { presets, value, setValue, close } = useTimeRange("TimeRangePresets");
200
+ const groups = useMemo(() => {
201
+ const collected = /* @__PURE__ */ new Map();
202
+ for (const preset of presets) {
203
+ const existing = collected.get(preset.group);
204
+ if (existing) existing.push(preset);
205
+ else collected.set(preset.group, [preset]);
206
+ }
207
+ return [...collected];
208
+ }, [presets]);
209
+ return /* @__PURE__ */ jsx("div", {
210
+ "data-slot": "time-range-presets",
211
+ className: cn("max-h-80 min-w-52 overflow-y-auto border-border p-1.5 sm:border-r", className),
212
+ ...props,
213
+ children: groups.map(([group, items]) => /* @__PURE__ */ jsxs("div", {
214
+ role: "group",
215
+ "aria-label": group,
216
+ className: "pb-1 last:pb-0",
217
+ children: [/* @__PURE__ */ jsx("p", {
218
+ className: "px-2 py-1 text-2xs font-medium tracking-wide text-muted-foreground uppercase",
219
+ children: group
220
+ }), items.map((preset) => /* @__PURE__ */ jsx("button", {
221
+ type: "button",
222
+ "aria-pressed": preset.expression === value,
223
+ onClick: () => {
224
+ setValue(preset.expression);
225
+ close();
226
+ },
227
+ className: cn("flex w-full items-center rounded-md px-2 py-1.5 text-left text-sm transition-colors", preset.expression === value ? "bg-accent font-medium text-accent-foreground" : "hover:bg-accent hover:text-accent-foreground", focusRing),
228
+ children: preset.label
229
+ }, preset.expression))]
230
+ }, group))
231
+ });
232
+ }
233
+ /**
234
+ * Raw expression entry, with the resolved window shown as you type — the escape
235
+ * hatch that keeps the presets from being a ceiling.
236
+ *
237
+ * An expression that does not parse says why and is not applied: a chart
238
+ * quietly re-scoping itself to a window nobody asked for is worse than one that
239
+ * refuses.
240
+ */
241
+ function TimeRangeExpression({ className, ...props }) {
242
+ const { value, setValue, now, timeZone, locale, clockReady, close } = useTimeRange("TimeRangeExpression");
243
+ const [draft, setDraft] = useState(value);
244
+ const [lastValue, setLastValue] = useState(value);
245
+ if (value !== lastValue) {
246
+ setLastValue(value);
247
+ setDraft(value);
248
+ }
249
+ const feedbackId = useId();
250
+ const preview = useMemo(() => {
251
+ if (!clockReady) return {
252
+ text: null,
253
+ error: null
254
+ };
255
+ try {
256
+ return {
257
+ text: formatResolvedRange(resolveTimeRange(draft, {
258
+ now,
259
+ timeZone
260
+ }), {
261
+ locale,
262
+ timeZone
263
+ }),
264
+ error: null
265
+ };
266
+ } catch (thrown) {
267
+ return {
268
+ text: null,
269
+ error: thrown instanceof TimeExpressionError ? thrown.message : "Invalid time range."
270
+ };
271
+ }
272
+ }, [
273
+ draft,
274
+ now,
275
+ timeZone,
276
+ locale,
277
+ clockReady
278
+ ]);
279
+ const apply = () => {
280
+ if (preview.error || !clockReady) return;
281
+ setValue(draft.trim());
282
+ close();
283
+ };
284
+ return /* @__PURE__ */ jsxs("div", {
285
+ "data-slot": "time-range-expression",
286
+ className: cn("flex flex-col gap-1.5 border-t border-border p-3 sm:border-t-0", className),
287
+ ...props,
288
+ children: [
289
+ /* @__PURE__ */ jsx("label", {
290
+ htmlFor: feedbackId + "-input",
291
+ className: "text-xs font-medium",
292
+ children: "Expression"
293
+ }),
294
+ /* @__PURE__ */ jsxs("div", {
295
+ className: "flex gap-2",
296
+ children: [/* @__PURE__ */ jsx(Input, {
297
+ id: feedbackId + "-input",
298
+ inputSize: "sm",
299
+ value: draft,
300
+ spellCheck: false,
301
+ autoComplete: "off",
302
+ "aria-invalid": preview.error ? true : void 0,
303
+ "aria-describedby": feedbackId,
304
+ onChange: (event) => {
305
+ setDraft(event.target.value);
306
+ },
307
+ onKeyDown: (event) => {
308
+ if (event.key === "Enter") {
309
+ event.preventDefault();
310
+ apply();
311
+ }
312
+ },
313
+ className: "font-mono"
314
+ }), /* @__PURE__ */ jsx(Button, {
315
+ size: "sm",
316
+ onClick: apply,
317
+ disabled: Boolean(preview.error) || !clockReady,
318
+ children: "Apply"
319
+ })]
320
+ }),
321
+ /* @__PURE__ */ jsx("p", {
322
+ id: feedbackId,
323
+ className: cn("min-h-4 text-2xs", preview.error ? "text-destructive" : "text-muted-foreground"),
324
+ children: preview.error ?? preview.text
325
+ })
326
+ ]
327
+ });
328
+ }
329
+ /**
330
+ * The absolute path, for a window with no relative meaning. Picking dates
331
+ * writes a concrete expression: "1 to 7 March" does not become relative just
332
+ * because it was chosen here.
333
+ */
334
+ function TimeRangeCalendar({ className, numberOfMonths = 1, ...props }) {
335
+ const { setValue, resolved, close } = useTimeRange("TimeRangeCalendar");
336
+ const [selection, setSelection] = useState(() => resolved ? {
337
+ from: resolved.from,
338
+ to: resolved.to
339
+ } : void 0);
340
+ return /* @__PURE__ */ jsx("div", {
341
+ "data-slot": "time-range-calendar",
342
+ className: cn("border-t border-border p-1 sm:border-t-0 sm:border-l", className),
343
+ ...props,
344
+ children: /* @__PURE__ */ jsx(Calendar, {
345
+ mode: "range",
346
+ selected: selection,
347
+ defaultMonth: selection?.from,
348
+ numberOfMonths,
349
+ onSelect: (next) => {
350
+ setSelection(next);
351
+ if (next?.from && next.to) {
352
+ setValue(absoluteExpression(startOfDay(next.from), endOfDay(next.to)));
353
+ close();
354
+ }
355
+ }
356
+ })
357
+ });
358
+ }
359
+ function startOfDay(date) {
360
+ const start = new Date(date);
361
+ start.setHours(0, 0, 0, 0);
362
+ return start;
363
+ }
364
+ /**
365
+ * A day picked as the end of a range means the whole of that day. Taking
366
+ * midnight instead silently drops the last day's data, which is the same
367
+ * off-by-one that `now/d..now/d` has to avoid.
368
+ */
369
+ function endOfDay(date) {
370
+ const end = new Date(date);
371
+ end.setHours(23, 59, 59, 999);
372
+ return end;
373
+ }
374
+ //#endregion
375
+ export { TimeRange, TimeRangeCalendar, TimeRangeContent, TimeRangeExpression, TimeRangePresets, TimeRangeTrigger };
376
+
377
+ //# sourceMappingURL=time-range-picker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-range-picker.js","names":[],"sources":["../../../src/components/time-range-picker/time-range-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n useCallback,\n useContext,\n useId,\n useMemo,\n useState,\n useSyncExternalStore,\n type ComponentPropsWithRef,\n type ReactNode,\n} from \"react\";\nimport type { DateRange } from \"react-day-picker\";\n\nimport { Button } from \"@/components/button\";\nimport { Calendar } from \"@/components/calendar\";\nimport { Input } from \"@/components/input\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"@/components/popover\";\nimport { focusRing } from \"@/lib/styles\";\nimport { cn } from \"@/lib/utils\";\n\nimport {\n DEFAULT_PRESETS,\n TimeExpressionError,\n absoluteExpression,\n describeTimeRange,\n formatResolvedRange,\n resolveTimeRange,\n type ResolvedRange,\n type TimeRangePreset,\n} from \"./time-expression\";\n\n/**\n * The control every observability product builds for itself.\n *\n * Grafana, Datadog, Sentry, PostHog, Vercel, Honeycomb, Cloudflare and\n * Amplitude each maintain a bespoke one, and no React package ships it, because\n * it looks like a date picker and is not one — see `time-expression.ts` for the\n * value model that makes the difference.\n *\n * Composed rather than reimplemented: Popover supplies the dialog semantics,\n * Calendar the absolute path, Input the expression entry.\n *\n * Two omissions are deliberate. No timezone picker — that is a 400-entry\n * combobox and a decision an app makes once, so `timeZone` is a prop. And no\n * comparison range; a second window belongs to whatever renders the chart.\n */\n\ninterface TimeRangeContextValue {\n value: string;\n setValue: (expression: string) => void;\n now: Date;\n timeZone?: string;\n locale?: string;\n presets: TimeRangePreset[];\n resolved: ResolvedRange | null;\n error: string | null;\n /** False until the clock is known, which on a server render is never. */\n clockReady: boolean;\n close: () => void;\n labelId: string;\n}\n\n/** Stands in until the clock is known. Never shown; see `clockReady`. */\nconst EPOCH = new Date(0);\n\n/**\n * The clock, for callers who did not supply one.\n *\n * `useSyncExternalStore` rather than an effect, because this is the case it\n * exists for: a value the server cannot know. The server snapshot is null, so a\n * server render and the hydration render both commit to nothing clock-dependent\n * and cannot disagree; the real instant arrives in the re-render after.\n *\n * `getSnapshot` has to be referentially stable, so the instant is created once\n * for the page. That means every picker without a `now` prop shares it and none\n * of them advance — which is the whole reason the prop is there.\n */\nconst subscribeToNothing = () => () => undefined;\nlet sharedClock: Date | null = null;\nconst readSharedClock = () => (sharedClock ??= new Date());\nconst readNoClock = () => null;\n\nconst TimeRangeContext = createContext<TimeRangeContextValue | null>(null);\n\nfunction useTimeRange(component: string): TimeRangeContextValue {\n const context = useContext(TimeRangeContext);\n if (!context) {\n throw new Error(`${component} must be used inside <TimeRange>.`);\n }\n return context;\n}\n\nexport interface TimeRangeProps {\n /** The expression, e.g. `now-6h..now`. Controlled. */\n value?: string;\n defaultValue?: string;\n onValueChange?: (expression: string) => void;\n /**\n * The instant relative expressions are measured from. Supplied by the\n * consumer so nothing here reads the clock during render. Pass a value that\n * changes when you refresh; a stable one holds the window still between them.\n */\n now?: Date;\n /** IANA zone the snapping happens in. Defaults to the runtime zone. */\n timeZone?: string;\n locale?: string;\n presets?: TimeRangePreset[];\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n children: ReactNode;\n}\n\nexport function TimeRange({\n value: valueProp,\n defaultValue = \"now-6h..now\",\n onValueChange,\n now,\n timeZone,\n locale,\n presets = DEFAULT_PRESETS,\n open: openProp,\n onOpenChange,\n children,\n}: TimeRangeProps) {\n const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);\n const value = valueProp ?? uncontrolledValue;\n\n const [uncontrolledOpen, setUncontrolledOpen] = useState(false);\n const open = openProp ?? uncontrolledOpen;\n\n const labelId = useId();\n\n // Reading the clock during render is what the `now` prop exists to avoid: the\n // server would render one instant and hydration another, and React would\n // throw out the tree. Until the fallback arrives, nothing clock-dependent is\n // rendered — the relative label, \"Last 6 hours\", does not need one, which is\n // why the trigger still says something useful in the meantime.\n const fallbackClock = useSyncExternalStore(subscribeToNothing, readSharedClock, readNoClock);\n\n const clock = now ?? fallbackClock;\n // A placeholder only for expressions that never mention `now`; anything that\n // does is gated on `clock` below rather than resolved against a fake instant.\n const effectiveNow = clock ?? EPOCH;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (openProp === undefined) setUncontrolledOpen(next);\n onOpenChange?.(next);\n },\n [openProp, onOpenChange],\n );\n\n const setValue = useCallback(\n (expression: string) => {\n if (valueProp === undefined) setUncontrolledValue(expression);\n onValueChange?.(expression);\n },\n [valueProp, onValueChange],\n );\n\n const { resolved, error } = useMemo(() => {\n // Claiming neither a window nor an error before the clock is known: an\n // expression cannot be judged against an instant nobody has read yet.\n if (!clock) return { resolved: null, error: null };\n try {\n return { resolved: resolveTimeRange(value, { now: clock, timeZone }), error: null };\n } catch (thrown) {\n return {\n resolved: null,\n error: thrown instanceof TimeExpressionError ? thrown.message : \"Invalid time range.\",\n };\n }\n }, [value, clock, timeZone]);\n\n const context = useMemo<TimeRangeContextValue>(\n () => ({\n value,\n setValue,\n now: effectiveNow,\n timeZone,\n locale,\n presets,\n resolved,\n error,\n clockReady: clock !== null,\n close: () => {\n setOpen(false);\n },\n labelId,\n }),\n [\n value,\n setValue,\n effectiveNow,\n clock,\n timeZone,\n locale,\n presets,\n resolved,\n error,\n setOpen,\n labelId,\n ],\n );\n\n return (\n <TimeRangeContext.Provider value={context}>\n <Popover open={open} onOpenChange={setOpen}>\n {children}\n </Popover>\n </TimeRangeContext.Provider>\n );\n}\n\nfunction ClockIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\" className=\"size-4 opacity-70\">\n <circle cx=\"12\" cy=\"12\" r=\"9\" stroke=\"currentColor\" strokeWidth=\"2\" />\n <path d=\"M12 7v5l3 2\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" />\n </svg>\n );\n}\n\nexport interface TimeRangeTriggerProps extends ComponentPropsWithRef<\"button\"> {\n /** Shows the resolved window under the label. Off by default; it is long. */\n showResolved?: boolean;\n}\n\n/**\n * The button, named by the range it holds: \"Last 6 hours\", not two timestamps.\n * The resolved window stays reachable as the title, and as `showResolved`.\n */\nexport function TimeRangeTrigger({\n className,\n showResolved = false,\n ...props\n}: TimeRangeTriggerProps) {\n const { value, now, timeZone, locale, presets, resolved, error } =\n useTimeRange(\"TimeRangeTrigger\");\n\n const label = describeTimeRange(value, { now, timeZone, locale, presets });\n const resolvedText = resolved ? formatResolvedRange(resolved, { locale, timeZone }) : null;\n\n return (\n <PopoverTrigger asChild>\n <Button\n data-slot=\"time-range-trigger\"\n variant=\"outline\"\n aria-invalid={error ? true : undefined}\n title={resolvedText ?? undefined}\n className={cn(\"justify-start gap-2 font-normal\", className)}\n {...props}\n >\n <ClockIcon />\n <span className=\"flex flex-col items-start leading-tight\">\n <span>{label}</span>\n {showResolved && resolvedText ? (\n <span className=\"text-2xs font-normal text-muted-foreground\">{resolvedText}</span>\n ) : null}\n </span>\n {/* The window the label stands for, for anyone who cannot see the\n title attribute. Read after the label, not instead of it. */}\n {resolvedText && !showResolved ? (\n <span className=\"sr-only\">{`, ${resolvedText}`}</span>\n ) : null}\n </Button>\n </PopoverTrigger>\n );\n}\n\nexport interface TimeRangeContentProps extends ComponentPropsWithRef<typeof PopoverContent> {\n /** Names the dialog. */\n label?: string;\n}\n\nexport function TimeRangeContent({\n className,\n label = \"Choose a time range\",\n children,\n ...props\n}: TimeRangeContentProps) {\n const { labelId } = useTimeRange(\"TimeRangeContent\");\n\n return (\n <PopoverContent\n data-slot=\"time-range-content\"\n aria-labelledby={labelId}\n align=\"start\"\n className={cn(\"w-auto max-w-[min(38rem,calc(100vw-2rem))] p-0\", className)}\n {...props}\n >\n <h2 id={labelId} className=\"sr-only\">\n {label}\n </h2>\n <div className=\"flex flex-col gap-0 sm:flex-row sm:items-stretch\">{children}</div>\n </PopoverContent>\n );\n}\n\n/**\n * The named ranges, which is how most of these are actually used. Buttons\n * rather than a radiogroup: choosing one both selects and dismisses, which is a\n * command, and `aria-pressed` still carries which one matches.\n */\nexport function TimeRangePresets({\n className,\n ...props\n}: Omit<ComponentPropsWithRef<\"div\">, \"children\">) {\n const { presets, value, setValue, close } = useTimeRange(\"TimeRangePresets\");\n\n const groups = useMemo(() => {\n const collected = new Map<string, TimeRangePreset[]>();\n for (const preset of presets) {\n const existing = collected.get(preset.group);\n if (existing) existing.push(preset);\n else collected.set(preset.group, [preset]);\n }\n return [...collected];\n }, [presets]);\n\n return (\n <div\n data-slot=\"time-range-presets\"\n className={cn(\n \"max-h-80 min-w-52 overflow-y-auto border-border p-1.5 sm:border-r\",\n className,\n )}\n {...props}\n >\n {groups.map(([group, items]) => (\n <div key={group} role=\"group\" aria-label={group} className=\"pb-1 last:pb-0\">\n <p className=\"px-2 py-1 text-2xs font-medium tracking-wide text-muted-foreground uppercase\">\n {group}\n </p>\n {items.map((preset) => (\n <button\n key={preset.expression}\n type=\"button\"\n aria-pressed={preset.expression === value}\n onClick={() => {\n setValue(preset.expression);\n close();\n }}\n className={cn(\n \"flex w-full items-center rounded-md px-2 py-1.5 text-left text-sm transition-colors\",\n preset.expression === value\n ? \"bg-accent font-medium text-accent-foreground\"\n : \"hover:bg-accent hover:text-accent-foreground\",\n focusRing,\n )}\n >\n {preset.label}\n </button>\n ))}\n </div>\n ))}\n </div>\n );\n}\n\n/**\n * Raw expression entry, with the resolved window shown as you type — the escape\n * hatch that keeps the presets from being a ceiling.\n *\n * An expression that does not parse says why and is not applied: a chart\n * quietly re-scoping itself to a window nobody asked for is worse than one that\n * refuses.\n */\nexport function TimeRangeExpression({\n className,\n ...props\n}: Omit<ComponentPropsWithRef<\"div\">, \"children\">) {\n const { value, setValue, now, timeZone, locale, clockReady, close } =\n useTimeRange(\"TimeRangeExpression\");\n\n const [draft, setDraft] = useState(value);\n // The expression can change under the input — a preset click, or the\n // consumer setting it. Adjusting during render rather than in an effect keeps\n // the field from showing a stale value for a frame.\n const [lastValue, setLastValue] = useState(value);\n if (value !== lastValue) {\n setLastValue(value);\n setDraft(value);\n }\n\n const feedbackId = useId();\n const preview = useMemo(() => {\n // Before the clock is known there is nothing to preview and nothing to\n // reject — saying \"invalid\" here would be a verdict reached without a fact.\n if (!clockReady) return { text: null, error: null as string | null };\n try {\n return {\n text: formatResolvedRange(resolveTimeRange(draft, { now, timeZone }), {\n locale,\n timeZone,\n }),\n error: null as string | null,\n };\n } catch (thrown) {\n return {\n text: null,\n error: thrown instanceof TimeExpressionError ? thrown.message : \"Invalid time range.\",\n };\n }\n }, [draft, now, timeZone, locale, clockReady]);\n\n const apply = () => {\n if (preview.error || !clockReady) return;\n setValue(draft.trim());\n close();\n };\n\n return (\n <div\n data-slot=\"time-range-expression\"\n className={cn(\n \"flex flex-col gap-1.5 border-t border-border p-3 sm:border-t-0\",\n className,\n )}\n {...props}\n >\n <label htmlFor={feedbackId + \"-input\"} className=\"text-xs font-medium\">\n Expression\n </label>\n <div className=\"flex gap-2\">\n <Input\n id={feedbackId + \"-input\"}\n inputSize=\"sm\"\n value={draft}\n spellCheck={false}\n autoComplete=\"off\"\n aria-invalid={preview.error ? true : undefined}\n aria-describedby={feedbackId}\n onChange={(event) => {\n setDraft(event.target.value);\n }}\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n event.preventDefault();\n apply();\n }\n }}\n className=\"font-mono\"\n />\n <Button size=\"sm\" onClick={apply} disabled={Boolean(preview.error) || !clockReady}>\n Apply\n </Button>\n </div>\n {/* One element for both outcomes, so a screen reader hears the error\n replace the preview rather than accumulating two descriptions. */}\n <p\n id={feedbackId}\n className={cn(\n \"min-h-4 text-2xs\",\n preview.error ? \"text-destructive\" : \"text-muted-foreground\",\n )}\n >\n {preview.error ?? preview.text}\n </p>\n </div>\n );\n}\n\n/**\n * The absolute path, for a window with no relative meaning. Picking dates\n * writes a concrete expression: \"1 to 7 March\" does not become relative just\n * because it was chosen here.\n */\nexport function TimeRangeCalendar({\n className,\n numberOfMonths = 1,\n ...props\n}: Omit<ComponentPropsWithRef<\"div\">, \"children\"> & { numberOfMonths?: number }) {\n const { setValue, resolved, close } = useTimeRange(\"TimeRangeCalendar\");\n\n const [selection, setSelection] = useState<DateRange | undefined>(() =>\n resolved ? { from: resolved.from, to: resolved.to } : undefined,\n );\n\n return (\n <div\n data-slot=\"time-range-calendar\"\n className={cn(\"border-t border-border p-1 sm:border-t-0 sm:border-l\", className)}\n {...props}\n >\n <Calendar\n mode=\"range\"\n selected={selection}\n defaultMonth={selection?.from}\n numberOfMonths={numberOfMonths}\n onSelect={(next) => {\n setSelection(next);\n // Only once both ends exist. One click is half an answer, and\n // applying it would show a zero-length range mid-gesture.\n if (next?.from && next.to) {\n setValue(absoluteExpression(startOfDay(next.from), endOfDay(next.to)));\n close();\n }\n }}\n />\n </div>\n );\n}\n\nfunction startOfDay(date: Date): Date {\n const start = new Date(date);\n start.setHours(0, 0, 0, 0);\n return start;\n}\n\n/**\n * A day picked as the end of a range means the whole of that day. Taking\n * midnight instead silently drops the last day's data, which is the same\n * off-by-one that `now/d..now/d` has to avoid.\n */\nfunction endOfDay(date: Date): Date {\n const end = new Date(date);\n end.setHours(23, 59, 59, 999);\n return end;\n}\n"],"mappings":";;;;;;;;;;;;AAiEA,MAAM,wBAAQ,IAAI,KAAK,CAAC;;;;;;;;;;;;;AAcxB,MAAM,iCAAiC,KAAA;AACvC,IAAI,cAA2B;AAC/B,MAAM,wBAAyB,gCAAgB,IAAI,KAAK;AACxD,MAAM,oBAAoB;AAE1B,MAAM,mBAAmB,cA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WithRef } from "react";
12
12
  * toast list from anywhere on the page.
13
13
  */
14
14
  declare const toastVariants: (props?: ({
15
- variant?: "destructive" | "default" | "success" | "warning" | "info" | null | undefined;
15
+ variant?: "default" | "destructive" | "success" | "warning" | "info" | null | undefined;
16
16
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
17
17
  declare const ToastProvider: import("react").FC<Toast.ToastProviderProps>;
18
18
  interface ToastProps extends ComponentPropsWithRef<typeof Toast.Root>, VariantProps<typeof toastVariants> {}
package/dist/index.d.ts CHANGED
@@ -4,10 +4,16 @@ import { ActivityContent, ActivityDescription, ActivityFeed, ActivityIndicator,
4
4
  import "./components/activity-feed/index.js";
5
5
  import { ActionLedger, ActionLedgerEntry, ActionLedgerEntryProps, ActionLedgerList, ActionLedgerPayload, ActionLedgerProps, ActionLedgerSelectionSummary, ActionLedgerToolbar, ActionStatus, LedgerAction, Reversibility, ledgerEntryVariants } from "./components/ai-action-ledger/ai-action-ledger.js";
6
6
  import "./components/ai-action-ledger/index.js";
7
+ import { AgentPlan, AgentPlanProps, AgentPlanStep, AgentPlanStepProps, AgentPlanSteps, AgentPlanSummary, PlanStep, StepStatus } from "./components/ai-agent-plan/ai-agent-plan.js";
8
+ import "./components/ai-agent-plan/index.js";
7
9
  import { AgentState, AgentStatus, AgentStatusProps, agentStatusVariants } from "./components/ai-agent-status/ai-agent-status.js";
8
10
  import "./components/ai-agent-status/index.js";
11
+ import { ApprovalDecision, ApprovalField, ApprovalRequest, ApprovalRequestProps, ApprovalScope } from "./components/ai-approval-request/ai-approval-request.js";
12
+ import "./components/ai-approval-request/index.js";
9
13
  import { Conversation, ConversationMessages, ConversationProps, ConversationScrollButton, ConversationScrollButtonProps, ConversationStatus, ConversationStatusProps } from "./components/ai-conversation/ai-conversation.js";
10
14
  import "./components/ai-conversation/index.js";
15
+ import { AIDisclosure, AIDisclosureProps, AIDisclosureProvenance, AIDisclosureProvenanceProps, DisclosureKind, ProvenanceClaim, disclosureVariants } from "./components/ai-disclosure/ai-disclosure.js";
16
+ import "./components/ai-disclosure/index.js";
11
17
  import { InlineCompletion, InlineCompletionProps } from "./components/ai-inline-completion/ai-inline-completion.js";
12
18
  import "./components/ai-inline-completion/index.js";
13
19
  import { Message, MessageActions, MessageAvatar, MessageAvatarProps, MessageBody, MessageBodyProps, MessageFooter, MessageProps, MessageRole, messageBodyVariants, messageVariants } from "./components/ai-message/ai-message.js";
@@ -56,18 +62,27 @@ import { DataTable, DataTableColumnHeader, DataTableColumnHeaderProps, DataTable
56
62
  import "./components/data-table/index.js";
57
63
  import { DatePicker, DatePickerProps, DateRangePicker, DateRangePickerProps } from "./components/date-picker/date-picker.js";
58
64
  import "./components/date-picker/index.js";
65
+ import { BuildDiffOptions, DiffHunk, DiffRow, RowKind, WordSegment, buildDiff, countChanges, groupIntoHunks, toSplitRows } from "./components/diff-viewer/diff-model.js";
66
+ import { DiffViewer, DiffViewerProps, DiffViewerToolbar, HunkDecision } from "./components/diff-viewer/diff-viewer.js";
67
+ import "./components/diff-viewer/index.js";
59
68
  import { Drawer, DrawerBody, DrawerCancel, DrawerClose, DrawerContent, DrawerContentProps, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerProps, DrawerTitle, DrawerTrigger } from "./components/drawer/drawer.js";
60
69
  import "./components/drawer/index.js";
61
70
  import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuContentProps, DropdownMenuGroup, DropdownMenuItem, DropdownMenuItemProps, DropdownMenuLabel, DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuSubTriggerProps, DropdownMenuTrigger } from "./components/dropdown-menu/dropdown-menu.js";
62
71
  import "./components/dropdown-menu/index.js";
63
72
  import { EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateIcon, EmptyStateProps, EmptyStateTitle, emptyStateVariants } from "./components/empty-state/empty-state.js";
64
73
  import "./components/empty-state/index.js";
74
+ import { QueuedFile, UploadContext, UploadFn, UploadQueueOptions, UploadStatus, formatBytes, matchesAccept, useUploadQueue, xhrUpload } from "./components/file-upload/upload-queue.js";
75
+ import { FileUpload, FileUploadItem, FileUploadItemProps, FileUploadList, FileUploadListProps, FileUploadProps, FileUploadStatus } from "./components/file-upload/file-upload.js";
76
+ import "./components/file-upload/index.js";
65
77
  import { Form, FormControl, FormControlProps, FormDescription, FormField, FormFieldProps, FormLabel, FormLabelProps, FormMessage, FormMessageProps, FormProps } from "./components/form/form.js";
66
78
  import "./components/form/index.js";
67
79
  import { Input, InputProps, inputVariants } from "./components/input/input.js";
68
80
  import "./components/input/index.js";
69
81
  import { Label, LabelProps } from "./components/label/label.js";
70
82
  import "./components/label/index.js";
83
+ import { FilterState, LOG_LEVELS, LogLevel, LogLine, MatchRange, UseLogStreamOptions, VisibleLine, compileQuery, findMatches, segment, useLogStream } from "./components/log-viewer/log-stream.js";
84
+ import { LogViewer, LogViewerProps, LogViewerRow, LogViewerRowProps, LogViewerToolbar, LogViewerToolbarProps } from "./components/log-viewer/log-viewer.js";
85
+ import "./components/log-viewer/index.js";
71
86
  import { Meter, MeterLegend, MeterProps, MeterSegment, MeterTone, MeterValue } from "./components/meter/meter.js";
72
87
  import "./components/meter/index.js";
73
88
  import { MetricDelta, MetricDeltaProps, MetricPolarity, deltaVariants } from "./components/metric-delta/metric-delta.js";
@@ -98,6 +113,11 @@ import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, Tabl
98
113
  import "./components/table/index.js";
99
114
  import { Tabs, TabsContent, TabsContentProps, TabsList, TabsListProps, TabsTrigger, TabsTriggerProps, tabsListVariants, tabsTriggerVariants } from "./components/tabs/tabs.js";
100
115
  import "./components/tabs/index.js";
116
+ import { TagValidator, TagsInput, TagsInputProps } from "./components/tags-input/tags-input.js";
117
+ import "./components/tags-input/index.js";
118
+ import { DEFAULT_PRESETS, ResolveOptions, ResolvedRange, TimeExpressionError, TimeRangePreset, TimeUnit, absoluteExpression, describeTimeRange, formatResolvedRange, isValidTimeRange, resolveExpression, resolveTimeRange } from "./components/time-range-picker/time-expression.js";
119
+ import { TimeRange, TimeRangeCalendar, TimeRangeContent, TimeRangeContentProps, TimeRangeExpression, TimeRangePresets, TimeRangeProps, TimeRangeTrigger, TimeRangeTriggerProps } from "./components/time-range-picker/time-range-picker.js";
120
+ import "./components/time-range-picker/index.js";
101
121
  import { Toast, ToastAction, ToastClose, ToastDescription, ToastPosition, ToastProps, ToastProvider, ToastTitle, Toaster, ToasterProps, toastVariants } from "./components/toast/toast.js";
102
122
  import { DEFAULT_TOAST_DURATION, TOAST_LIMIT, ToastAction as ToastAction$1, ToastOptions, ToastPromiseMessages, ToastRecord, ToastVariant, toast, useToasts } from "./components/toast/toast-store.js";
103
123
  import "./components/toast/index.js";
@@ -106,4 +126,4 @@ import "./components/tooltip/index.js";
106
126
  import { cn } from "./lib/utils.js";
107
127
  import { disabledStyles, focusRing, focusRingInset, iconSlot, invalidStyles } from "./lib/styles.js";
108
128
  import { COMPONENT_CATEGORIES, COMPONENT_STATUSES, ComponentCategory, ComponentMeta, ComponentStatus, defineMeta } from "./registry/schema.js";
109
- export { Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, AccordionTrigger, type AccordionTriggerProps, ActionLedger, ActionLedgerEntry, type ActionLedgerEntryProps, ActionLedgerList, ActionLedgerPayload, type ActionLedgerProps, ActionLedgerSelectionSummary, ActionLedgerToolbar, type ActionStatus, ActivityContent, ActivityDescription, ActivityFeed, ActivityIndicator, type ActivityIndicatorProps, ActivityItem, type ActivityItemProps, ActivityTime, type ActivityTimeProps, ActivityTitle, type AgentState, AgentStatus, type AgentStatusProps, Alert, AlertDescription, type AlertLive, type AlertProps, AlertTitle, Avatar, AvatarFallback, type AvatarFallbackProps, AvatarImage, type AvatarImageProps, type AvatarProps, Badge, type BadgeProps, Button, type ButtonProps, COMPONENT_CATEGORIES, COMPONENT_STATUSES, Calendar, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CardTitleProps, Checkbox, type CheckboxProps, CodeBlock, type CodeBlockProps, Combobox, ComboboxContent, type ComboboxContentProps, ComboboxEmpty, ComboboxInput, type ComboboxInputProps, ComboboxItem, type ComboboxItemProps, ComboboxList, type ComboboxProps, ComboboxTrigger, type ComboboxTriggerProps, Command, CommandDialog, type CommandDialogProps, CommandEmpty, CommandGroup, type CommandGroupProps, CommandInput, type CommandInputProps, CommandItem, type CommandItemProps, CommandList, type CommandProps, CommandSeparator, CommandShortcut, ComponentCategory, ComponentMeta, ComponentStatus, Conversation, ConversationMessages, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, ConversationStatus, type ConversationStatusProps, CopyButton, type CopyButtonProps, DEFAULT_TOAST_DURATION, DataTable, DataTableColumnHeader, type DataTableColumnHeaderProps, DataTablePagination, type DataTablePaginationProps, type DataTableProps, DataTableViewOptions, type DataTableViewOptionsProps, DatePicker, type DatePickerProps, DateRangePicker, type DateRangePickerProps, Dialog, DialogClose, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, DialogHeader, DialogOverlay, type DialogOverlayProps, DialogPortal, DialogTitle, type DialogTitleProps, DialogTrigger, Drawer, DrawerBody, DrawerCancel, DrawerClose, DrawerContent, type DrawerContentProps, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, type DrawerProps, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, type DropdownMenuSubTriggerProps, DropdownMenuTrigger, EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateIcon, type EmptyStateProps, EmptyStateTitle, type FieldChange, type FieldState, Form, FormControl, type FormControlProps, FormDescription, FormField, type FormFieldProps, FormLabel, type FormLabelProps, FormMessage, type FormMessageProps, type FormProps, type HideableTable, InlineCitation, type InlineCitationProps, InlineCompletion, type InlineCompletionProps, Input, type InputProps, Label, type LabelProps, type LedgerAction, Message, MessageActions, MessageAvatar, type MessageAvatarProps, MessageBody, type MessageBodyProps, MessageFooter, type MessageProps, type MessageRole, Meter, MeterLegend, type MeterProps, type MeterSegment, type MeterTone, MeterValue, MetricDelta, type MetricDeltaProps, type MetricPolarity, type ModelOption, ModelSelector, type ModelSelectorProps, type OutputField, type PaginatedTable, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, type PaginationLinkProps, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, type PopoverContentProps, PopoverTrigger, Progress, type ProgressProps, PromptInput, PromptInputCounter, type PromptInputCounterProps, type PromptInputProps, PromptInputSubmit, type PromptInputSubmitProps, PromptInputTextarea, type PromptInputTextareaProps, PromptInputToolbar, RadioGroup, RadioGroupItem, type RadioGroupItemProps, type RadioGroupProps, Reasoning, ReasoningContent, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, RecordDiff, type RecordDiffProps, RecordDiffSummary, RecordDiffTable, type RecordDiffTableProps, type RecordField, Response, ResponseCaret, type ResponseProps, type Reversibility, Select, SelectContent, type SelectContentProps, SelectGroup, SelectItem, type SelectItemProps, SelectLabel, SelectSeparator, SelectTrigger, type SelectTriggerProps, SelectValue, Separator, type SeparatorProps, Sheet, SheetClose, SheetContent, type SheetContentProps, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, Slider, type SliderProps, type SortableColumn, Source, type SourceProps, Sources, SourcesContent, type SourcesProps, SourcesTrigger, type SourcesTriggerProps, Spinner, type SpinnerProps, StructuredConfidence, StructuredField, StructuredFieldError, type StructuredFieldProps, StructuredOutput, type StructuredOutputProps, Switch, type SwitchProps, TOAST_LIMIT, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, type TableProps, TableRow, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsListProps, TabsTrigger, type TabsTriggerProps, ThinkingIndicator, type ThinkingIndicatorProps, Toast, ToastAction, type ToastAction$1 as ToastActionOptions, ToastClose, ToastDescription, type ToastOptions, type ToastPosition, type ToastPromiseMessages, type ToastProps, ToastProvider, type ToastRecord, ToastTitle, type ToastVariant, Toaster, type ToasterProps, TokenCount, type TokenCountProps, TokenUsage, type TokenUsageProps, Tool, ToolContent, ToolHeader, type ToolHeaderProps, ToolPayload, type ToolPayloadProps, type ToolProps, ToolSection, type ToolSectionProps, type ToolStatus, Tooltip, TooltipContent, type TooltipContentProps, type TooltipProps, TooltipProvider, TooltipTrigger, agentStatusVariants, alertVariants, avatarVariants, badgeVariants, buttonVariants, cn, defaultComboboxFilter, defaultCommandFilter, defineMeta, deltaVariants, diffRecords, disabledStyles, emptyStateVariants, focusRing, focusRingInset, iconSlot, inputVariants, invalidStyles, ledgerEntryVariants, messageBodyVariants, messageVariants, progressVariants, selectTriggerVariants, sheetVariants, spinnerVariants, tabsListVariants, tabsTriggerVariants, toast, toastVariants, toolVariants, useToasts };
129
+ export { AIDisclosure, type AIDisclosureProps, AIDisclosureProvenance, type AIDisclosureProvenanceProps, Accordion, AccordionContent, type AccordionContentProps, AccordionItem, type AccordionItemProps, AccordionTrigger, type AccordionTriggerProps, ActionLedger, ActionLedgerEntry, type ActionLedgerEntryProps, ActionLedgerList, ActionLedgerPayload, type ActionLedgerProps, ActionLedgerSelectionSummary, ActionLedgerToolbar, type ActionStatus, ActivityContent, ActivityDescription, ActivityFeed, ActivityIndicator, type ActivityIndicatorProps, ActivityItem, type ActivityItemProps, ActivityTime, type ActivityTimeProps, ActivityTitle, AgentPlan, type AgentPlanProps, AgentPlanStep, type AgentPlanStepProps, AgentPlanSteps, AgentPlanSummary, type AgentState, AgentStatus, type AgentStatusProps, Alert, AlertDescription, type AlertLive, type AlertProps, AlertTitle, type ApprovalDecision, type ApprovalField, ApprovalRequest, type ApprovalRequestProps, type ApprovalScope, Avatar, AvatarFallback, type AvatarFallbackProps, AvatarImage, type AvatarImageProps, type AvatarProps, Badge, type BadgeProps, type BuildDiffOptions, Button, type ButtonProps, COMPONENT_CATEGORIES, COMPONENT_STATUSES, Calendar, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CardTitleProps, Checkbox, type CheckboxProps, CodeBlock, type CodeBlockProps, Combobox, ComboboxContent, type ComboboxContentProps, ComboboxEmpty, ComboboxInput, type ComboboxInputProps, ComboboxItem, type ComboboxItemProps, ComboboxList, type ComboboxProps, ComboboxTrigger, type ComboboxTriggerProps, Command, CommandDialog, type CommandDialogProps, CommandEmpty, CommandGroup, type CommandGroupProps, CommandInput, type CommandInputProps, CommandItem, type CommandItemProps, CommandList, type CommandProps, CommandSeparator, CommandShortcut, ComponentCategory, ComponentMeta, ComponentStatus, Conversation, ConversationMessages, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, ConversationStatus, type ConversationStatusProps, CopyButton, type CopyButtonProps, DEFAULT_PRESETS, DEFAULT_TOAST_DURATION, DataTable, DataTableColumnHeader, type DataTableColumnHeaderProps, DataTablePagination, type DataTablePaginationProps, type DataTableProps, DataTableViewOptions, type DataTableViewOptionsProps, DatePicker, type DatePickerProps, DateRangePicker, type DateRangePickerProps, Dialog, DialogClose, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, DialogHeader, DialogOverlay, type DialogOverlayProps, DialogPortal, DialogTitle, type DialogTitleProps, DialogTrigger, type DiffHunk, type DiffRow, DiffViewer, type DiffViewerProps, DiffViewerToolbar, type DisclosureKind, Drawer, DrawerBody, DrawerCancel, DrawerClose, DrawerContent, type DrawerContentProps, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, type DrawerProps, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, type DropdownMenuSubTriggerProps, DropdownMenuTrigger, EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateIcon, type EmptyStateProps, EmptyStateTitle, type FieldChange, type FieldState, FileUpload, FileUploadItem, type FileUploadItemProps, FileUploadList, type FileUploadListProps, type FileUploadProps, FileUploadStatus, type FilterState, Form, FormControl, type FormControlProps, FormDescription, FormField, type FormFieldProps, FormLabel, type FormLabelProps, FormMessage, type FormMessageProps, type FormProps, type HideableTable, type HunkDecision, InlineCitation, type InlineCitationProps, InlineCompletion, type InlineCompletionProps, Input, type InputProps, LOG_LEVELS, Label, type LabelProps, type LedgerAction, type LogLevel, type LogLine, LogViewer, type LogViewerProps, LogViewerRow, type LogViewerRowProps, LogViewerToolbar, type LogViewerToolbarProps, type MatchRange, Message, MessageActions, MessageAvatar, type MessageAvatarProps, MessageBody, type MessageBodyProps, MessageFooter, type MessageProps, type MessageRole, Meter, MeterLegend, type MeterProps, type MeterSegment, type MeterTone, MeterValue, MetricDelta, type MetricDeltaProps, type MetricPolarity, type ModelOption, ModelSelector, type ModelSelectorProps, type OutputField, type PaginatedTable, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, type PaginationLinkProps, PaginationNext, PaginationPrevious, type PlanStep, Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, type PopoverContentProps, PopoverTrigger, Progress, type ProgressProps, PromptInput, PromptInputCounter, type PromptInputCounterProps, type PromptInputProps, PromptInputSubmit, type PromptInputSubmitProps, PromptInputTextarea, type PromptInputTextareaProps, PromptInputToolbar, type ProvenanceClaim, type QueuedFile, RadioGroup, RadioGroupItem, type RadioGroupItemProps, type RadioGroupProps, Reasoning, ReasoningContent, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, RecordDiff, type RecordDiffProps, RecordDiffSummary, RecordDiffTable, type RecordDiffTableProps, type RecordField, type ResolveOptions, type ResolvedRange, Response, ResponseCaret, type ResponseProps, type Reversibility, type RowKind, Select, SelectContent, type SelectContentProps, SelectGroup, SelectItem, type SelectItemProps, SelectLabel, SelectSeparator, SelectTrigger, type SelectTriggerProps, SelectValue, Separator, type SeparatorProps, Sheet, SheetClose, SheetContent, type SheetContentProps, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, Slider, type SliderProps, type SortableColumn, Source, type SourceProps, Sources, SourcesContent, type SourcesProps, SourcesTrigger, type SourcesTriggerProps, Spinner, type SpinnerProps, type StepStatus, StructuredConfidence, StructuredField, StructuredFieldError, type StructuredFieldProps, StructuredOutput, type StructuredOutputProps, Switch, type SwitchProps, TOAST_LIMIT, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, type TableProps, TableRow, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsListProps, TabsTrigger, type TabsTriggerProps, type TagValidator, TagsInput, type TagsInputProps, ThinkingIndicator, type ThinkingIndicatorProps, TimeExpressionError, TimeRange, TimeRangeCalendar, TimeRangeContent, type TimeRangeContentProps, TimeRangeExpression, type TimeRangePreset, TimeRangePresets, type TimeRangeProps, TimeRangeTrigger, type TimeRangeTriggerProps, type TimeUnit, Toast, ToastAction, type ToastAction$1 as ToastActionOptions, ToastClose, ToastDescription, type ToastOptions, type ToastPosition, type ToastPromiseMessages, type ToastProps, ToastProvider, type ToastRecord, ToastTitle, type ToastVariant, Toaster, type ToasterProps, TokenCount, type TokenCountProps, TokenUsage, type TokenUsageProps, Tool, ToolContent, ToolHeader, type ToolHeaderProps, ToolPayload, type ToolPayloadProps, type ToolProps, ToolSection, type ToolSectionProps, type ToolStatus, Tooltip, TooltipContent, type TooltipContentProps, type TooltipProps, TooltipProvider, TooltipTrigger, type UploadContext, type UploadFn, type UploadQueueOptions, type UploadStatus, type UseLogStreamOptions, type VisibleLine, type WordSegment, absoluteExpression, agentStatusVariants, alertVariants, avatarVariants, badgeVariants, buildDiff, buttonVariants, cn, compileQuery, countChanges, defaultComboboxFilter, defaultCommandFilter, defineMeta, deltaVariants, describeTimeRange, diffRecords, disabledStyles, disclosureVariants, emptyStateVariants, findMatches, focusRing, focusRingInset, formatBytes, formatResolvedRange, groupIntoHunks, iconSlot, inputVariants, invalidStyles, isValidTimeRange, ledgerEntryVariants, matchesAccept, messageBodyVariants, messageVariants, progressVariants, resolveExpression, resolveTimeRange, segment, selectTriggerVariants, sheetVariants, spinnerVariants, tabsListVariants, tabsTriggerVariants, toSplitRows, toast, toastVariants, toolVariants, useLogStream, useToasts, useUploadQueue, xhrUpload };
package/dist/index.js CHANGED
@@ -5,8 +5,12 @@ import { ActivityContent, ActivityDescription, ActivityFeed, ActivityIndicator,
5
5
  import { ActionLedger, ActionLedgerEntry, ActionLedgerList, ActionLedgerPayload, ActionLedgerSelectionSummary, ActionLedgerToolbar, ledgerEntryVariants } from "./components/ai-action-ledger/ai-action-ledger.js";
6
6
  import { InlineCompletion } from "./components/ai-inline-completion/ai-inline-completion.js";
7
7
  import { StructuredConfidence, StructuredField, StructuredFieldError, StructuredOutput } from "./components/ai-structured-output/ai-structured-output.js";
8
+ import { AgentPlan, AgentPlanStep, AgentPlanSteps, AgentPlanSummary } from "./components/ai-agent-plan/ai-agent-plan.js";
8
9
  import { AgentStatus, agentStatusVariants } from "./components/ai-agent-status/ai-agent-status.js";
10
+ import { ApprovalRequest } from "./components/ai-approval-request/ai-approval-request.js";
9
11
  import { Conversation, ConversationMessages, ConversationScrollButton, ConversationStatus } from "./components/ai-conversation/ai-conversation.js";
12
+ import { Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, PopoverTrigger } from "./components/popover/popover.js";
13
+ import { AIDisclosure, AIDisclosureProvenance, disclosureVariants } from "./components/ai-disclosure/ai-disclosure.js";
10
14
  import { Message, MessageActions, MessageAvatar, MessageBody, MessageFooter, messageBodyVariants, messageVariants } from "./components/ai-message/ai-message.js";
11
15
  import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, selectTriggerVariants } from "./components/select/select.js";
12
16
  import { ModelSelector } from "./components/ai-model-selector/ai-model-selector.js";
@@ -31,13 +35,18 @@ import { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, Comma
31
35
  import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./components/dropdown-menu/dropdown-menu.js";
32
36
  import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "./components/table/table.js";
33
37
  import { DataTable, DataTableColumnHeader, DataTablePagination, DataTableViewOptions } from "./components/data-table/data-table.js";
34
- import { Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, PopoverTrigger } from "./components/popover/popover.js";
35
38
  import { DatePicker, DateRangePicker } from "./components/date-picker/date-picker.js";
39
+ import { buildDiff, countChanges, groupIntoHunks, toSplitRows } from "./components/diff-viewer/diff-model.js";
40
+ import { DiffViewer, DiffViewerToolbar } from "./components/diff-viewer/diff-viewer.js";
36
41
  import { Drawer, DrawerBody, DrawerCancel, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger } from "./components/drawer/drawer.js";
37
42
  import { EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateIcon, EmptyStateTitle, emptyStateVariants } from "./components/empty-state/empty-state.js";
43
+ import { formatBytes, matchesAccept, useUploadQueue, xhrUpload } from "./components/file-upload/upload-queue.js";
44
+ import { FileUpload, FileUploadItem, FileUploadList, FileUploadStatus } from "./components/file-upload/file-upload.js";
38
45
  import { Form, FormControl, FormDescription, FormField, FormLabel, FormMessage } from "./components/form/form.js";
39
46
  import { Input, inputVariants } from "./components/input/input.js";
40
47
  import { Label } from "./components/label/label.js";
48
+ import { LOG_LEVELS, compileQuery, findMatches, segment, useLogStream } from "./components/log-viewer/log-stream.js";
49
+ import { LogViewer, LogViewerRow, LogViewerToolbar } from "./components/log-viewer/log-viewer.js";
41
50
  import { Meter, MeterLegend, MeterValue } from "./components/meter/meter.js";
42
51
  import { MetricDelta, deltaVariants } from "./components/metric-delta/metric-delta.js";
43
52
  import { RecordDiff, RecordDiffSummary, RecordDiffTable, diffRecords } from "./components/record-diff/record-diff.js";
@@ -50,8 +59,11 @@ import { Skeleton } from "./components/skeleton/skeleton.js";
50
59
  import { Slider } from "./components/slider/slider.js";
51
60
  import { Switch } from "./components/switch/switch.js";
52
61
  import { Tabs, TabsContent, TabsList, TabsTrigger, tabsListVariants, tabsTriggerVariants } from "./components/tabs/tabs.js";
62
+ import { TagsInput } from "./components/tags-input/tags-input.js";
63
+ import { DEFAULT_PRESETS, TimeExpressionError, absoluteExpression, describeTimeRange, formatResolvedRange, isValidTimeRange, resolveExpression, resolveTimeRange } from "./components/time-range-picker/time-expression.js";
64
+ import { TimeRange, TimeRangeCalendar, TimeRangeContent, TimeRangeExpression, TimeRangePresets, TimeRangeTrigger } from "./components/time-range-picker/time-range-picker.js";
53
65
  import { DEFAULT_TOAST_DURATION, TOAST_LIMIT, toast, useToasts } from "./components/toast/toast-store.js";
54
66
  import { Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, Toaster, toastVariants } from "./components/toast/toast.js";
55
67
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/tooltip/tooltip.js";
56
68
  import { COMPONENT_CATEGORIES, COMPONENT_STATUSES, defineMeta } from "./registry/schema.js";
57
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActionLedger, ActionLedgerEntry, ActionLedgerList, ActionLedgerPayload, ActionLedgerSelectionSummary, ActionLedgerToolbar, ActivityContent, ActivityDescription, ActivityFeed, ActivityIndicator, ActivityItem, ActivityTime, ActivityTitle, AgentStatus, Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Button, COMPONENT_CATEGORIES, COMPONENT_STATUSES, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CodeBlock, Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, ComboboxTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Conversation, ConversationMessages, ConversationScrollButton, ConversationStatus, CopyButton, DEFAULT_TOAST_DURATION, DataTable, DataTableColumnHeader, DataTablePagination, DataTableViewOptions, DatePicker, DateRangePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerCancel, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateIcon, EmptyStateTitle, Form, FormControl, FormDescription, FormField, FormLabel, FormMessage, InlineCitation, InlineCompletion, Input, Label, Message, MessageActions, MessageAvatar, MessageBody, MessageFooter, Meter, MeterLegend, MeterValue, MetricDelta, ModelSelector, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, PopoverTrigger, Progress, PromptInput, PromptInputCounter, PromptInputSubmit, PromptInputTextarea, PromptInputToolbar, RadioGroup, RadioGroupItem, Reasoning, ReasoningContent, ReasoningTrigger, RecordDiff, RecordDiffSummary, RecordDiffTable, Response, ResponseCaret, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, Slider, Source, Sources, SourcesContent, SourcesTrigger, Spinner, StructuredConfidence, StructuredField, StructuredFieldError, StructuredOutput, Switch, TOAST_LIMIT, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, ThinkingIndicator, Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, Toaster, TokenCount, TokenUsage, Tool, ToolContent, ToolHeader, ToolPayload, ToolSection, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, agentStatusVariants, alertVariants, avatarVariants, badgeVariants, buttonVariants, cn, defaultComboboxFilter, defaultCommandFilter, defineMeta, deltaVariants, diffRecords, disabledStyles, emptyStateVariants, focusRing, focusRingInset, iconSlot, inputVariants, invalidStyles, ledgerEntryVariants, messageBodyVariants, messageVariants, progressVariants, selectTriggerVariants, sheetVariants, spinnerVariants, tabsListVariants, tabsTriggerVariants, toast, toastVariants, toolVariants, useToasts };
69
+ export { AIDisclosure, AIDisclosureProvenance, Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActionLedger, ActionLedgerEntry, ActionLedgerList, ActionLedgerPayload, ActionLedgerSelectionSummary, ActionLedgerToolbar, ActivityContent, ActivityDescription, ActivityFeed, ActivityIndicator, ActivityItem, ActivityTime, ActivityTitle, AgentPlan, AgentPlanStep, AgentPlanSteps, AgentPlanSummary, AgentStatus, Alert, AlertDescription, AlertTitle, ApprovalRequest, Avatar, AvatarFallback, AvatarImage, Badge, Button, COMPONENT_CATEGORIES, COMPONENT_STATUSES, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CodeBlock, Combobox, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, ComboboxTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Conversation, ConversationMessages, ConversationScrollButton, ConversationStatus, CopyButton, DEFAULT_PRESETS, DEFAULT_TOAST_DURATION, DataTable, DataTableColumnHeader, DataTablePagination, DataTableViewOptions, DatePicker, DateRangePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiffViewer, DiffViewerToolbar, Drawer, DrawerBody, DrawerCancel, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, EmptyStateActions, EmptyStateDescription, EmptyStateIcon, EmptyStateTitle, FileUpload, FileUploadItem, FileUploadList, FileUploadStatus, Form, FormControl, FormDescription, FormField, FormLabel, FormMessage, InlineCitation, InlineCompletion, Input, LOG_LEVELS, Label, LogViewer, LogViewerRow, LogViewerToolbar, Message, MessageActions, MessageAvatar, MessageBody, MessageFooter, Meter, MeterLegend, MeterValue, MetricDelta, ModelSelector, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, PopoverTrigger, Progress, PromptInput, PromptInputCounter, PromptInputSubmit, PromptInputTextarea, PromptInputToolbar, RadioGroup, RadioGroupItem, Reasoning, ReasoningContent, ReasoningTrigger, RecordDiff, RecordDiffSummary, RecordDiffTable, Response, ResponseCaret, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, Slider, Source, Sources, SourcesContent, SourcesTrigger, Spinner, StructuredConfidence, StructuredField, StructuredFieldError, StructuredOutput, Switch, TOAST_LIMIT, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagsInput, ThinkingIndicator, TimeExpressionError, TimeRange, TimeRangeCalendar, TimeRangeContent, TimeRangeExpression, TimeRangePresets, TimeRangeTrigger, Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, Toaster, TokenCount, TokenUsage, Tool, ToolContent, ToolHeader, ToolPayload, ToolSection, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, absoluteExpression, agentStatusVariants, alertVariants, avatarVariants, badgeVariants, buildDiff, buttonVariants, cn, compileQuery, countChanges, defaultComboboxFilter, defaultCommandFilter, defineMeta, deltaVariants, describeTimeRange, diffRecords, disabledStyles, disclosureVariants, emptyStateVariants, findMatches, focusRing, focusRingInset, formatBytes, formatResolvedRange, groupIntoHunks, iconSlot, inputVariants, invalidStyles, isValidTimeRange, ledgerEntryVariants, matchesAccept, messageBodyVariants, messageVariants, progressVariants, resolveExpression, resolveTimeRange, segment, selectTriggerVariants, sheetVariants, spinnerVariants, tabsListVariants, tabsTriggerVariants, toSplitRows, toast, toastVariants, toolVariants, useLogStream, useToasts, useUploadQueue, xhrUpload };
@@ -1 +1 @@
1
- {"version":3,"file":"components.d.ts","names":[],"sources":["../../src/registry/components.ts"],"mappings":";;;;;;;;;;;;;;cAkEa,gBAAgB"}
1
+ {"version":3,"file":"components.d.ts","names":[],"sources":["../../src/registry/components.ts"],"mappings":";;;;;;;;;;;;;;cA0Ea,gBAAgB"}