@cognite/aura 0.1.5 → 0.1.7

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 (74) hide show
  1. package/DESIGN.md +1269 -0
  2. package/README.md +24 -0
  3. package/dist/colors.css +824 -0
  4. package/dist/components/index.d.ts +11 -2
  5. package/dist/components/index.js +284 -249
  6. package/dist/components/ui/core/accordion/accordion.d.ts +24 -0
  7. package/dist/components/ui/core/accordion/accordion.js +113 -0
  8. package/dist/components/ui/core/accordion/accordion.metadata.d.ts +2 -0
  9. package/dist/components/ui/core/accordion/accordion.metadata.js +9 -0
  10. package/dist/components/ui/core/alert/alert.d.ts +2 -1
  11. package/dist/components/ui/core/alert/alert.js +120 -96
  12. package/dist/components/ui/core/alert/alert.metadata.js +1 -1
  13. package/dist/components/ui/core/avatar/avatar.js +29 -32
  14. package/dist/components/ui/core/badge/badge.d.ts +1 -1
  15. package/dist/components/ui/core/badge/badge.js +44 -52
  16. package/dist/components/ui/core/banner/banner.d.ts +40 -0
  17. package/dist/components/ui/core/banner/banner.js +218 -0
  18. package/dist/components/ui/core/banner/banner.metadata.d.ts +2 -0
  19. package/dist/components/ui/core/banner/banner.metadata.js +9 -0
  20. package/dist/components/ui/core/button/button.d.ts +2 -2
  21. package/dist/components/ui/core/button/button.js +19 -20
  22. package/dist/components/ui/core/button-group/button-group.js +10 -10
  23. package/dist/components/ui/core/card/card.js +1 -1
  24. package/dist/components/ui/core/code-block/code-block.d.ts +14 -3
  25. package/dist/components/ui/core/code-block/code-block.js +218 -97
  26. package/dist/components/ui/core/code-block/code-block.metadata.js +1 -1
  27. package/dist/components/ui/core/collapsible/collapsible.js +30 -24
  28. package/dist/components/ui/core/command/command.d.ts +2 -2
  29. package/dist/components/ui/core/command/command.js +30 -30
  30. package/dist/components/ui/core/dialog/dialog.js +8 -8
  31. package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +1 -1
  32. package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +65 -62
  33. package/dist/components/ui/core/helper-text/helper-text.js +8 -8
  34. package/dist/components/ui/core/hover-card/hover-card.js +5 -5
  35. package/dist/components/ui/core/inline-citation/inline-citation.js +19 -16
  36. package/dist/components/ui/core/input/input.d.ts +1 -5
  37. package/dist/components/ui/core/input/input.js +24 -30
  38. package/dist/components/ui/core/input-group/input-group.d.ts +2 -2
  39. package/dist/components/ui/core/input-group/input-group.js +104 -74
  40. package/dist/components/ui/core/label/label.d.ts +3 -1
  41. package/dist/components/ui/core/label/label.js +39 -16
  42. package/dist/components/ui/core/label/label.metadata.js +2 -2
  43. package/dist/components/ui/core/message/message-response-default-streamdown-controls.d.ts +11 -0
  44. package/dist/components/ui/core/message/message-response-default-streamdown-controls.js +13 -0
  45. package/dist/components/ui/core/message/message.d.ts +1 -1
  46. package/dist/components/ui/core/message/message.js +62 -44
  47. package/dist/components/ui/core/popover/popover.d.ts +10 -1
  48. package/dist/components/ui/core/popover/popover.js +137 -34
  49. package/dist/components/ui/core/popover/popover.metadata.js +9 -0
  50. package/dist/components/ui/core/progress/progress.d.ts +10 -0
  51. package/dist/components/ui/core/progress/progress.js +61 -0
  52. package/dist/components/ui/core/progress/progress.metadata.d.ts +2 -0
  53. package/dist/components/ui/core/progress/progress.metadata.js +9 -0
  54. package/dist/components/ui/core/prompt-input/prompt-input.d.ts +2 -2
  55. package/dist/components/ui/core/prompt-input/prompt-input.js +100 -100
  56. package/dist/components/ui/core/scroll-area/scroll-area.d.ts +3 -0
  57. package/dist/components/ui/core/scroll-area/scroll-area.js +71 -0
  58. package/dist/components/ui/core/scroll-area/scroll-area.metadata.d.ts +2 -0
  59. package/dist/components/ui/core/scroll-area/scroll-area.metadata.js +9 -0
  60. package/dist/components/ui/core/select/select.d.ts +3 -3
  61. package/dist/components/ui/core/select/select.js +69 -73
  62. package/dist/components/ui/core/skeleton/skeleton.js +6 -6
  63. package/dist/components/ui/core/sources/sources.js +8 -1
  64. package/dist/components/ui/core/textarea/textarea.d.ts +1 -8
  65. package/dist/components/ui/core/textarea/textarea.js +21 -45
  66. package/dist/components/ui/core/tool/tool.js +58 -50
  67. package/dist/components/ui/core/tooltip/tooltip.js +10 -10
  68. package/dist/index.d.ts +1 -1
  69. package/dist/index.js +281 -249
  70. package/dist/lib/utils.d.ts +6 -6
  71. package/dist/lib/utils.js +26 -26
  72. package/dist/styles.css +1 -1
  73. package/dist/styles.source.css +3 -812
  74. package/package.json +28 -9
@@ -1,25 +1,25 @@
1
- import { jsx as t, jsxs as u, Fragment as C } from "react/jsx-runtime";
2
- import { createContext as N, useMemo as y, useId as z, useContext as I } from "react";
1
+ import { jsxs as u, Fragment as C, jsx as t } from "react/jsx-runtime";
2
+ import { createContext as N, forwardRef as y, useId as z, useContext as I, useMemo as V } from "react";
3
3
  import { Select as o } from "@base-ui/react/select";
4
- import { IconCheck as V, IconChevronDown as h, IconChevronUp as _, IconExclamationCircle as O } from "@tabler/icons-react";
4
+ import { IconChevronDown as h, IconExclamationCircle as k, IconCheck as _, IconChevronUp as O } from "@tabler/icons-react";
5
5
  import { usePortalContainer as P } from "../../../../lib/portal-container-context.js";
6
6
  import { useControllableState as j } from "../../../../lib/use-controllable-state.js";
7
- import { cn as s, disabledState as k, invalidState as D, focusState as T, filledState as B, hoverState as E, formElementBase as G } from "../../../../lib/utils.js";
8
- const g = N(null), L = () => {
7
+ import { cn as r, disabledState as T, invalidState as D, focusState as B, filledState as E, hoverState as G, formElementBase as L } from "../../../../lib/utils.js";
8
+ const g = N(null), R = () => {
9
9
  const e = I(g);
10
10
  if (!e)
11
11
  throw new Error("Select components must be used within Select");
12
12
  return e;
13
13
  };
14
- function Q(e) {
14
+ function Y(e) {
15
15
  const [a, l] = j({
16
16
  prop: e.open,
17
17
  defaultProp: e.defaultOpen ?? !1,
18
18
  onChange: e.onOpenChange
19
- }), n = y(() => ({ isOpen: a ?? !1 }), [a]);
19
+ }), n = V(() => ({ isOpen: a ?? !1 }), [a]);
20
20
  if (e.multiple) {
21
21
  const {
22
- multiple: m,
22
+ multiple: p,
23
23
  value: v,
24
24
  defaultValue: b,
25
25
  onValueChange: S,
@@ -33,7 +33,7 @@ function Q(e) {
33
33
  onOpenChange: (f) => l(f),
34
34
  value: v,
35
35
  defaultValue: b,
36
- onValueChange: (f, R) => {
36
+ onValueChange: (f, W) => {
37
37
  S?.(f ?? []);
38
38
  },
39
39
  multiple: !0,
@@ -41,33 +41,33 @@ function Q(e) {
41
41
  }
42
42
  ) });
43
43
  }
44
- const { value: r, defaultValue: i, onValueChange: c, ...d } = e, p = r === void 0 ? void 0 : r === "" ? null : r, x = i === void 0 ? void 0 : i === "" ? null : i;
44
+ const { value: s, defaultValue: i, onValueChange: m, ...c } = e, d = s === void 0 ? void 0 : s === "" ? null : s, x = i === void 0 ? void 0 : i === "" ? null : i;
45
45
  return /* @__PURE__ */ t(g.Provider, { value: n, children: /* @__PURE__ */ t(
46
46
  o.Root,
47
47
  {
48
48
  "data-slot": "select",
49
49
  open: a,
50
- onOpenChange: (m) => l(m),
51
- value: p,
50
+ onOpenChange: (p) => l(p),
51
+ value: d,
52
52
  defaultValue: x,
53
- onValueChange: (m, v) => {
54
- c?.(typeof m == "string" ? m : "");
53
+ onValueChange: (p, v) => {
54
+ m?.(typeof p == "string" ? p : "");
55
55
  },
56
- ...d
56
+ ...c
57
57
  }
58
58
  ) });
59
59
  }
60
- function X({ className: e, ...a }) {
60
+ function Z({ className: e, ...a }) {
61
61
  return /* @__PURE__ */ t(
62
62
  o.Group,
63
63
  {
64
64
  "data-slot": "select-group",
65
- className: s("scroll-my-1 p-1", e),
65
+ className: r("scroll-my-1 p-1", e),
66
66
  ...a
67
67
  }
68
68
  );
69
69
  }
70
- function Y({
70
+ function M({
71
71
  icon: e,
72
72
  ...a
73
73
  }) {
@@ -76,36 +76,31 @@ function Y({
76
76
  /* @__PURE__ */ t(o.Value, { "data-slot": "select-value", ...a })
77
77
  ] }) : /* @__PURE__ */ t(o.Value, { "data-slot": "select-value", ...a });
78
78
  }
79
- function Z({
80
- className: e,
81
- size: a = "default",
82
- children: l,
83
- errorMessage: n,
84
- ...r
85
- }) {
86
- const { isOpen: i } = L(), c = !!n, d = z();
79
+ const U = y(({ className: e, size: a = "default", children: l, errorMessage: n, ...s }, i) => {
80
+ const { isOpen: m } = R(), c = !!n, d = z();
87
81
  return /* @__PURE__ */ u(C, { children: [
88
82
  /* @__PURE__ */ u(
89
83
  o.Trigger,
90
84
  {
85
+ ref: i,
91
86
  "data-slot": "select-trigger",
92
87
  "data-size": a,
93
88
  "aria-invalid": c ? !0 : void 0,
94
89
  "aria-describedby": c ? d : void 0,
95
- className: s(
90
+ className: r(
96
91
  "w-fit min-w-50 min-h-9 flex items-center justify-between gap-2 whitespace-nowrap transition-[color,box-shadow] cursor-pointer",
92
+ L,
97
93
  G,
98
94
  E,
99
95
  B,
100
- T,
101
96
  D,
102
- k,
103
- "dark:bg-input/30 dark:text-muted-foreground dark:hover:bg-accent",
97
+ T,
98
+ "dark:bg-muted-background/30 dark:text-muted-foreground dark:hover:bg-accent-background",
104
99
  "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
105
100
  "*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2",
106
101
  e
107
102
  ),
108
- ...r,
103
+ ...s,
109
104
  children: [
110
105
  l,
111
106
  /* @__PURE__ */ t(
@@ -114,9 +109,9 @@ function Z({
114
109
  render: /* @__PURE__ */ t(
115
110
  h,
116
111
  {
117
- className: s(
112
+ className: r(
118
113
  "size-4 opacity-50 transition-transform",
119
- i ? "rotate-180" : "rotate-0"
114
+ m ? "rotate-180" : "rotate-0"
120
115
  )
121
116
  }
122
117
  )
@@ -131,55 +126,56 @@ function Z({
131
126
  id: d,
132
127
  className: "flex flex-row gap-1 justify-start items-center p-1",
133
128
  children: [
134
- /* @__PURE__ */ t(O, { className: "text-destructive-foreground text-sm size-4" }),
129
+ /* @__PURE__ */ t(k, { className: "text-destructive-foreground text-sm size-4" }),
135
130
  /* @__PURE__ */ t("span", { className: "text-destructive-foreground text-sm", children: n })
136
131
  ]
137
132
  }
138
133
  )
139
134
  ] });
140
- }
141
- function M({
135
+ });
136
+ U.displayName = "SelectTrigger";
137
+ function ee({
142
138
  className: e,
143
139
  children: a,
144
140
  position: l = "popper",
145
141
  align: n = "start",
146
- alignOffset: r = 0,
142
+ alignOffset: s = 0,
147
143
  side: i = "bottom",
148
- sideOffset: c = 4,
149
- ...d
144
+ sideOffset: m = 4,
145
+ ...c
150
146
  }) {
151
- const p = P();
152
- return /* @__PURE__ */ t(o.Portal, { container: p, children: /* @__PURE__ */ t(
147
+ const d = P();
148
+ return /* @__PURE__ */ t(o.Portal, { container: d, children: /* @__PURE__ */ t(
153
149
  o.Positioner,
154
150
  {
155
151
  alignItemWithTrigger: !1,
156
152
  align: n,
157
- alignOffset: r,
153
+ alignOffset: s,
158
154
  side: i,
159
- sideOffset: c,
155
+ sideOffset: m,
160
156
  collisionPadding: 10,
161
157
  className: "isolate z-50",
162
158
  children: /* @__PURE__ */ u(
163
159
  o.Popup,
164
160
  {
165
161
  "data-slot": "select-content",
166
- className: s(
167
- "bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--available-height) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md outline-none",
162
+ className: r(
163
+ "bg-popover-background text-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--available-height) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md outline-none",
168
164
  l === "popper" && "data-[side=bottom]:translate-y-1",
169
165
  e
170
166
  ),
171
- ...d,
167
+ ...c,
172
168
  children: [
173
- /* @__PURE__ */ t(U, {}),
169
+ /* @__PURE__ */ t(A, {}),
174
170
  /* @__PURE__ */ t(o.List, { children: a }),
175
- /* @__PURE__ */ t(A, {})
171
+ /* @__PURE__ */ t(F, {})
176
172
  ]
177
173
  }
178
174
  )
179
175
  }
180
176
  ) });
181
177
  }
182
- function ee({
178
+ function te({
183
179
  className: e,
184
180
  ...a
185
181
  }) {
@@ -187,12 +183,12 @@ function ee({
187
183
  o.GroupLabel,
188
184
  {
189
185
  "data-slot": "select-label",
190
- className: s("text-muted-foreground px-2 py-1.5 text-xs", e),
186
+ className: r("text-muted-foreground px-2 py-1.5 text-xs", e),
191
187
  ...a
192
188
  }
193
189
  );
194
190
  }
195
- function te({
191
+ function ae({
196
192
  className: e,
197
193
  children: a,
198
194
  icon: l,
@@ -202,8 +198,8 @@ function te({
202
198
  o.Item,
203
199
  {
204
200
  "data-slot": "select-item",
205
- className: s(
206
- "relative flex w-full min-h-9 cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-base leading-5 tracking-tightest outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
201
+ className: r(
202
+ "relative flex w-full min-h-9 cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-base leading-5 tracking-tightest outline-hidden select-none focus:bg-accent-background focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
207
203
  e
208
204
  ),
209
205
  ...n,
@@ -211,7 +207,7 @@ function te({
211
207
  /* @__PURE__ */ t(
212
208
  o.ItemIndicator,
213
209
  {
214
- render: /* @__PURE__ */ t("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ t(V, { className: "size-4 text-popover-foreground" }) })
210
+ render: /* @__PURE__ */ t("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ t(_, { className: "size-4 text-foreground" }) })
215
211
  }
216
212
  ),
217
213
  l && /* @__PURE__ */ t("span", { className: "flex items-center gap-2 mr-1", children: l }),
@@ -220,7 +216,7 @@ function te({
220
216
  }
221
217
  );
222
218
  }
223
- function ae({
219
+ function oe({
224
220
  className: e,
225
221
  ...a
226
222
  }) {
@@ -228,12 +224,12 @@ function ae({
228
224
  o.Separator,
229
225
  {
230
226
  "data-slot": "select-separator",
231
- className: s("bg-border pointer-events-none -mx-1 my-1 h-px", e),
227
+ className: r("bg-border pointer-events-none -mx-1 my-1 h-px", e),
232
228
  ...a
233
229
  }
234
230
  );
235
231
  }
236
- function U({
232
+ function A({
237
233
  className: e,
238
234
  ...a
239
235
  }) {
@@ -241,16 +237,16 @@ function U({
241
237
  o.ScrollUpArrow,
242
238
  {
243
239
  "data-slot": "select-scroll-up-button",
244
- className: s(
245
- "bg-popover z-10 flex cursor-default items-center justify-center py-1 top-0 w-full",
240
+ className: r(
241
+ "bg-popover-background z-10 flex cursor-default items-center justify-center py-1 top-0 w-full",
246
242
  e
247
243
  ),
248
244
  ...a,
249
- children: /* @__PURE__ */ t(_, { className: "size-4" })
245
+ children: /* @__PURE__ */ t(O, { className: "size-4" })
250
246
  }
251
247
  );
252
248
  }
253
- function A({
249
+ function F({
254
250
  className: e,
255
251
  ...a
256
252
  }) {
@@ -258,8 +254,8 @@ function A({
258
254
  o.ScrollDownArrow,
259
255
  {
260
256
  "data-slot": "select-scroll-down-button",
261
- className: s(
262
- "bg-popover z-10 flex cursor-default items-center justify-center py-1 bottom-0 w-full",
257
+ className: r(
258
+ "bg-popover-background z-10 flex cursor-default items-center justify-center py-1 bottom-0 w-full",
263
259
  e
264
260
  ),
265
261
  ...a,
@@ -268,14 +264,14 @@ function A({
268
264
  );
269
265
  }
270
266
  export {
271
- Q as Select,
272
- M as SelectContent,
273
- X as SelectGroup,
274
- te as SelectItem,
275
- ee as SelectLabel,
276
- A as SelectScrollDownButton,
277
- U as SelectScrollUpButton,
278
- ae as SelectSeparator,
279
- Z as SelectTrigger,
280
- Y as SelectValue
267
+ Y as Select,
268
+ ee as SelectContent,
269
+ Z as SelectGroup,
270
+ ae as SelectItem,
271
+ te as SelectLabel,
272
+ F as SelectScrollDownButton,
273
+ A as SelectScrollUpButton,
274
+ oe as SelectSeparator,
275
+ U as SelectTrigger,
276
+ M as SelectValue
281
277
  };
@@ -1,14 +1,14 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
- import { forwardRef as m } from "react";
3
- import { cn as r } from "../../../../lib/utils.js";
4
- const n = m(
5
- ({ className: e, ...o }, t) => /* @__PURE__ */ a(
2
+ import { forwardRef as r } from "react";
3
+ import { cn as m } from "../../../../lib/utils.js";
4
+ const n = r(
5
+ ({ className: o, ...e }, t) => /* @__PURE__ */ a(
6
6
  "div",
7
7
  {
8
8
  ref: t,
9
9
  "data-slot": "skeleton",
10
- className: r("bg-accent animate-pulse rounded-md", e),
11
- ...o
10
+ className: m("bg-accent-background animate-pulse rounded-md", o),
11
+ ...e
12
12
  }
13
13
  )
14
14
  );
@@ -12,7 +12,14 @@ const S = ({ className: r, title: e, children: t, ...o }) => {
12
12
  ...o,
13
13
  children: [
14
14
  n ? null : i,
15
- /* @__PURE__ */ s("div", { "data-slot": "sources-items", className: "flex flex-wrap gap-2", children: t })
15
+ /* @__PURE__ */ s(
16
+ "div",
17
+ {
18
+ "data-slot": "sources-items",
19
+ className: "flex flex-wrap gap-2 [&>*]:min-w-0",
20
+ children: t
21
+ }
22
+ )
16
23
  ]
17
24
  }
18
25
  );
@@ -1,9 +1,2 @@
1
- import { ComponentProps } from 'react';
2
- interface TextareaProps extends ComponentProps<'textarea'> {
3
- maxChars?: number;
4
- errorMessage?: string;
5
- overLimitMessage?: string;
6
- charactersLeftMessage?: (remaining: number) => string;
7
- }
8
- declare const Textarea: import('react').ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & import('react').RefAttributes<HTMLTextAreaElement>>;
1
+ declare const Textarea: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & import('react').RefAttributes<HTMLTextAreaElement>>;
9
2
  export { Textarea };
@@ -1,49 +1,25 @@
1
- import { jsxs as x, Fragment as C, jsx as l } from "react/jsx-runtime";
2
- import { forwardRef as S, useState as b } from "react";
3
- import { cn as T, disabledState as w, invalidState as E, focusState as j, filledState as k, hoverState as y, formElementBase as L } from "../../../../lib/utils.js";
4
- import { HelperText as c } from "../helper-text/helper-text.js";
5
- const N = (a) => `${a} characters left`, V = S(
6
- ({
7
- className: a,
8
- maxChars: e,
9
- errorMessage: o,
10
- overLimitMessage: s = "Too many characters",
11
- charactersLeftMessage: u = N,
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { forwardRef as r } from "react";
3
+ import { cn as i, disabledState as l, invalidState as n, focusState as s, filledState as d, hoverState as f, formElementBase as m } from "../../../../lib/utils.js";
4
+ const c = r(({ className: e, ...t }, a) => /* @__PURE__ */ o(
5
+ "textarea",
6
+ {
7
+ ref: a,
8
+ "data-slot": "textarea",
9
+ className: i(
10
+ "flex field-sizing-content min-h-20 w-full transition-[color,background-color,border-color,box-shadow] resize-none",
11
+ m,
12
+ f,
13
+ d,
14
+ s,
15
+ n,
16
+ l,
17
+ e
18
+ ),
12
19
  ...t
13
- }, f) => {
14
- const i = t.value !== void 0, [h, g] = b(() => {
15
- const n = t.defaultValue ?? "";
16
- return String(n).length;
17
- }), d = i ? String(t.value ?? "").length : h, r = e !== void 0 && d > e, m = !!o || r, v = (n) => {
18
- i || g(n.target.value.length), t.onChange && t.onChange(n);
19
- };
20
- return /* @__PURE__ */ x(C, { children: [
21
- /* @__PURE__ */ l(
22
- "textarea",
23
- {
24
- ref: f,
25
- "data-slot": "textarea",
26
- "aria-invalid": m ? !0 : void 0,
27
- className: T(
28
- "flex field-sizing-content min-h-16 w-full placeholder:text-muted-foreground transition-[color,background-color,border-color,box-shadow]",
29
- L,
30
- y,
31
- k,
32
- j,
33
- E,
34
- w,
35
- "dark:bg-input/30",
36
- a
37
- ),
38
- onChange: v,
39
- ...t
40
- }
41
- ),
42
- o ? /* @__PURE__ */ l(c, { isError: !0, children: o }) : e !== void 0 && /* @__PURE__ */ l(c, { isError: r, children: r ? s : u(e - d) })
43
- ] });
44
20
  }
45
- );
46
- V.displayName = "Textarea";
21
+ ));
22
+ c.displayName = "Textarea";
47
23
  export {
48
- V as Textarea
24
+ c as Textarea
49
25
  };
@@ -1,18 +1,18 @@
1
- import { jsx as e, jsxs as a } from "react/jsx-runtime";
2
- import { forwardRef as s } from "react";
3
- import { IconSelector as f } from "@tabler/icons-react";
4
- import { cn as d } from "../../../../lib/utils.js";
5
- import { Badge as p } from "../badge/badge.js";
6
- import { Button as g } from "../button/button.js";
7
- import { CodeBlock as c, CodeBlockCopyButton as m, CodeBlockCollapseButton as u } from "../code-block/code-block.js";
8
- import { Collapsible as x, CollapsibleTrigger as h, CollapsibleContent as N } from "../collapsible/collapsible.js";
9
- const b = s(
1
+ import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
+ import { forwardRef as d } from "react";
3
+ import { IconSelector as p } from "@tabler/icons-react";
4
+ import { cn as s } from "../../../../lib/utils.js";
5
+ import { Badge as g } from "../badge/badge.js";
6
+ import { Button as h } from "../button/button.js";
7
+ import { CodeBlock as c, CodeBlockCopyButton as m, CodeBlockDownloadButton as u, CodeBlockCollapseButton as f } from "../code-block/code-block.js";
8
+ import { Collapsible as x, CollapsibleTrigger as N, CollapsibleContent as b } from "../collapsible/collapsible.js";
9
+ const y = d(
10
10
  ({ className: t, ...o }, l) => /* @__PURE__ */ e(
11
11
  x,
12
12
  {
13
13
  ref: l,
14
14
  "data-slot": "tool",
15
- className: d(
15
+ className: s(
16
16
  "group not-prose w-full bg-background rounded-md flex flex-col gap-2",
17
17
  t
18
18
  ),
@@ -20,30 +20,30 @@ const b = s(
20
20
  }
21
21
  )
22
22
  );
23
- b.displayName = "Tool";
24
- const y = s(({ className: t, title: o, type: l, hasError: r = !1, ...i }, n) => /* @__PURE__ */ e(
25
- h,
23
+ y.displayName = "Tool";
24
+ const v = d(({ className: t, title: o, type: l, hasError: r = !1, ...i }, a) => /* @__PURE__ */ e(
25
+ N,
26
26
  {
27
- ref: n,
27
+ ref: a,
28
28
  "data-slot": "tool-header",
29
29
  className: t,
30
- render: /* @__PURE__ */ a(
31
- g,
30
+ render: /* @__PURE__ */ n(
31
+ h,
32
32
  {
33
33
  variant: "ghost",
34
34
  className: "w-full justify-between text-base leading-5 tracking-tighter",
35
35
  children: [
36
36
  /* @__PURE__ */ e("span", { children: o ?? l.substring(l.indexOf("-") + 1) }),
37
- /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
37
+ /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
38
38
  r ? /* @__PURE__ */ e(
39
- p,
39
+ g,
40
40
  {
41
41
  outline: !0,
42
42
  className: "bg-background text-destructive-foreground border-border",
43
43
  children: "Error"
44
44
  }
45
45
  ) : null,
46
- /* @__PURE__ */ e(f, { className: "h-4 w-4" })
46
+ /* @__PURE__ */ e(p, { className: "h-4 w-4" })
47
47
  ] })
48
48
  ]
49
49
  }
@@ -51,31 +51,35 @@ const y = s(({ className: t, title: o, type: l, hasError: r = !1, ...i }, n) =>
51
51
  ...i
52
52
  }
53
53
  ));
54
- y.displayName = "ToolHeader";
55
- const v = s(({ className: t, ...o }, l) => /* @__PURE__ */ e(
56
- N,
54
+ v.displayName = "ToolHeader";
55
+ const j = d(({ className: t, ...o }, l) => /* @__PURE__ */ e(
56
+ b,
57
57
  {
58
58
  ref: l,
59
59
  "data-slot": "tool-content",
60
- className: d(
61
- "data-open:flex flex-col py-3 gap-6 text-popover-foreground outline-none",
60
+ className: s(
61
+ /* min-h-0: flex descendants (e.g. CodeBlock max-height) may shrink */
62
+ "flex min-h-0 flex-col gap-4 py-3 text-popover-foreground outline-none",
62
63
  t
63
64
  ),
64
65
  ...o
65
66
  }
66
67
  ));
67
- v.displayName = "ToolContent";
68
- const C = s(
69
- ({ className: t, input: o, ...l }, r) => /* @__PURE__ */ a(
68
+ j.displayName = "ToolContent";
69
+ const w = d(
70
+ ({ className: t, input: o, ...l }, r) => /* @__PURE__ */ n(
70
71
  "div",
71
72
  {
72
73
  ref: r,
73
74
  "data-slot": "tool-input",
74
- className: d("space-y-2 overflow-hidden px-3.25", t),
75
+ className: s(
76
+ "min-h-0 space-y-2 overflow-x-hidden overflow-y-visible px-3.25",
77
+ t
78
+ ),
75
79
  ...l,
76
80
  children: [
77
81
  /* @__PURE__ */ e("h4", { className: "text-sm font-medium uppercase tracking-wide text-muted-foreground", children: "Parameters" }),
78
- /* @__PURE__ */ e("div", { className: "rounded-md bg-muted/50", children: /* @__PURE__ */ a(
82
+ /* @__PURE__ */ e("div", { className: "min-h-0 rounded-md bg-muted/50", children: /* @__PURE__ */ n(
79
83
  c,
80
84
  {
81
85
  code: JSON.stringify(o, null, 2),
@@ -83,7 +87,8 @@ const C = s(
83
87
  collapsed: !0,
84
88
  children: [
85
89
  /* @__PURE__ */ e(m, {}),
86
- /* @__PURE__ */ e(u, {})
90
+ /* @__PURE__ */ e(u, { fileName: "tool-parameters.json" }),
91
+ /* @__PURE__ */ e(f, {})
87
92
  ]
88
93
  }
89
94
  ) })
@@ -91,16 +96,17 @@ const C = s(
91
96
  }
92
97
  )
93
98
  );
94
- C.displayName = "ToolInput";
95
- const w = s(
99
+ w.displayName = "ToolInput";
100
+ const C = d(
96
101
  ({ className: t, output: o, errorText: l, ...r }, i) => {
97
102
  if (o == null && !l)
98
103
  return null;
99
- let n = null;
100
- return typeof o == "string" ? n = /* @__PURE__ */ a(c, { code: o, language: "json", collapsed: !0, children: [
104
+ let a = null;
105
+ return typeof o == "string" ? a = /* @__PURE__ */ n(c, { code: o, language: "json", collapsed: !0, children: [
101
106
  /* @__PURE__ */ e(m, {}),
102
- /* @__PURE__ */ e(u, {})
103
- ] }) : o == null ? n = null : typeof o == "object" ? n = /* @__PURE__ */ a(
107
+ /* @__PURE__ */ e(u, { fileName: "tool-result.json" }),
108
+ /* @__PURE__ */ e(f, {})
109
+ ] }) : o == null ? a = null : typeof o == "object" ? a = /* @__PURE__ */ n(
104
110
  c,
105
111
  {
106
112
  code: JSON.stringify(o, null, 2),
@@ -108,44 +114,46 @@ const w = s(
108
114
  collapsed: !0,
109
115
  children: [
110
116
  /* @__PURE__ */ e(m, {}),
111
- /* @__PURE__ */ e(u, {})
117
+ /* @__PURE__ */ e(u, { fileName: "tool-result.json" }),
118
+ /* @__PURE__ */ e(f, {})
112
119
  ]
113
120
  }
114
- ) : (typeof o == "number" || typeof o == "boolean" || typeof o == "bigint") && (n = /* @__PURE__ */ a(c, { code: String(o), language: "json", collapsed: !0, children: [
121
+ ) : (typeof o == "number" || typeof o == "boolean" || typeof o == "bigint") && (a = /* @__PURE__ */ n(c, { code: String(o), language: "json", collapsed: !0, children: [
115
122
  /* @__PURE__ */ e(m, {}),
116
- /* @__PURE__ */ e(u, {})
123
+ /* @__PURE__ */ e(u, { fileName: "tool-result.json" }),
124
+ /* @__PURE__ */ e(f, {})
117
125
  ] })), l ? /* @__PURE__ */ e(
118
126
  "div",
119
127
  {
120
128
  ref: i,
121
129
  "data-slot": "tool-output",
122
- className: d("space-y-2 px-3.25", t),
130
+ className: s("space-y-2 px-3.25", t),
123
131
  ...r,
124
- children: /* @__PURE__ */ a("div", { className: "flex flex-col gap-2 text-sm", children: [
132
+ children: /* @__PURE__ */ n("div", { className: "flex flex-col gap-2 text-sm", children: [
125
133
  /* @__PURE__ */ e("span", { className: "font-medium text-destructive-foreground", children: "ERROR" }),
126
134
  /* @__PURE__ */ e("span", { className: "text-foreground", children: l })
127
135
  ] })
128
136
  }
129
- ) : /* @__PURE__ */ a(
137
+ ) : /* @__PURE__ */ n(
130
138
  "div",
131
139
  {
132
140
  ref: i,
133
141
  "data-slot": "tool-output",
134
- className: d("space-y-2 px-3.25", t),
142
+ className: s("space-y-2 px-3.25", t),
135
143
  ...r,
136
144
  children: [
137
145
  /* @__PURE__ */ e("h4", { className: "text-sm font-medium uppercase tracking-wide text-muted-foreground", children: "Result" }),
138
- /* @__PURE__ */ e("div", { className: "overflow-x-auto rounded-md bg-muted/50 text-xs text-foreground [&_table]:w-full", children: n })
146
+ /* @__PURE__ */ e("div", { className: "min-h-0 overflow-x-auto rounded-md bg-muted-background/50 text-xs text-foreground [&_table]:w-full", children: a })
139
147
  ]
140
148
  }
141
149
  );
142
150
  }
143
151
  );
144
- w.displayName = "ToolOutput";
152
+ C.displayName = "ToolOutput";
145
153
  export {
146
- b as Tool,
147
- v as ToolContent,
148
- y as ToolHeader,
149
- C as ToolInput,
150
- w as ToolOutput
154
+ y as Tool,
155
+ j as ToolContent,
156
+ v as ToolHeader,
157
+ w as ToolInput,
158
+ C as ToolOutput
151
159
  };