@cognite/aura 0.3.2 → 0.3.4

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 (143) hide show
  1. package/DESIGN.md +134 -5
  2. package/README.md +24 -3
  3. package/dist/components/index.d.ts +5 -1
  4. package/dist/components/index.js +59 -327
  5. package/dist/components/ui/core/accordion/accordion.js +79 -114
  6. package/dist/components/ui/core/action-toolbar/action-toolbar.js +108 -176
  7. package/dist/components/ui/core/alert/alert.js +158 -206
  8. package/dist/components/ui/core/avatar/avatar.js +64 -90
  9. package/dist/components/ui/core/badge/badge.js +73 -108
  10. package/dist/components/ui/core/banner/banner.js +146 -215
  11. package/dist/components/ui/core/breadcrumb/breadcrumb.js +105 -200
  12. package/dist/components/ui/core/button/button.js +47 -52
  13. package/dist/components/ui/core/button-group/button-group.js +40 -79
  14. package/dist/components/ui/core/calendar/calendar-header.js +63 -0
  15. package/dist/components/ui/core/calendar/calendar-utils.js +39 -0
  16. package/dist/components/ui/core/calendar/calendar.js +68 -0
  17. package/dist/components/ui/core/calendar/constants.d.ts +1 -0
  18. package/dist/components/ui/core/card/card.js +102 -185
  19. package/dist/components/ui/core/chart/chart.js +116 -206
  20. package/dist/components/ui/core/chart/index.js +2 -8
  21. package/dist/components/ui/core/checkbox/checkbox.js +67 -132
  22. package/dist/components/ui/core/checkbox/checkbox.metadata.js +7 -7
  23. package/dist/components/ui/core/code-block/code-block.d.ts +1 -1
  24. package/dist/components/ui/core/code-block/code-block.js +179 -267
  25. package/dist/components/ui/core/collapsible/collapsible.js +29 -49
  26. package/dist/components/ui/core/combobox/combobox.js +41 -0
  27. package/dist/components/ui/core/command/command.js +85 -150
  28. package/dist/components/ui/core/count/count.js +21 -32
  29. package/dist/components/ui/core/data-grid/data-grid-cell.d.ts +10 -0
  30. package/dist/components/ui/core/data-grid/data-grid-header-row.d.ts +13 -0
  31. package/dist/components/ui/core/data-grid/data-grid-row.d.ts +18 -0
  32. package/dist/components/ui/core/data-grid/data-grid.d.ts +43 -0
  33. package/dist/components/ui/core/data-grid/data-grid.fixtures.d.ts +12 -0
  34. package/dist/components/ui/core/data-grid/data-grid.utils.d.ts +9 -0
  35. package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +60 -72
  36. package/dist/components/ui/core/date-time-pickers/date-picker/types.d.ts +2 -1
  37. package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +36 -51
  38. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +63 -87
  39. package/dist/components/ui/core/date-time-pickers/date-range-picker/types.d.ts +2 -1
  40. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +60 -68
  41. package/dist/components/ui/core/date-time-pickers/date-time-picker/index.d.ts +1 -0
  42. package/dist/components/ui/core/date-time-pickers/date-time-picker/types.d.ts +36 -0
  43. package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.d.ts +3 -0
  44. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +118 -174
  45. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.d.ts +7 -6
  46. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +104 -145
  47. package/dist/components/ui/core/date-time-pickers/index.d.ts +3 -1
  48. package/dist/components/ui/core/date-time-pickers/index.js +6 -10
  49. package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.d.ts +3 -2
  50. package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js +42 -56
  51. package/dist/components/ui/core/date-time-pickers/shared/constants.d.ts +3 -8
  52. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +64 -98
  53. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js +38 -67
  54. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +23 -23
  55. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js +52 -62
  56. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js +18 -18
  57. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js +24 -31
  58. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.d.ts +3 -3
  59. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js +24 -33
  60. package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js +4 -7
  61. package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.d.ts +3 -2
  62. package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js +17 -31
  63. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.d.ts +3 -2
  64. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +40 -40
  65. package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js +33 -50
  66. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +78 -99
  67. package/dist/components/ui/core/date-time-pickers/time-picker/types.d.ts +5 -4
  68. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +41 -63
  69. package/dist/components/ui/core/date-time-pickers/time-range-picker/index.d.ts +1 -0
  70. package/dist/components/ui/core/date-time-pickers/time-range-picker/types.d.ts +40 -0
  71. package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.d.ts +3 -0
  72. package/dist/components/ui/core/date-time-pickers/utils/format-utils.d.ts +1 -0
  73. package/dist/components/ui/core/date-time-pickers/utils/time-utils.d.ts +3 -3
  74. package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +7 -15
  75. package/dist/components/ui/core/dialog/dialog.js +82 -155
  76. package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +2 -2
  77. package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +150 -248
  78. package/dist/components/ui/core/empty-state/empty-state.context.js +5 -8
  79. package/dist/components/ui/core/empty-state/empty-state.js +86 -138
  80. package/dist/components/ui/core/helper-text/helper-text.js +37 -65
  81. package/dist/components/ui/core/hover-card/hover-card.js +54 -80
  82. package/dist/components/ui/core/inline-citation/inline-citation.js +98 -181
  83. package/dist/components/ui/core/input/input.js +12 -27
  84. package/dist/components/ui/core/input-group/input-group.js +76 -173
  85. package/dist/components/ui/core/kbd/kbd.js +20 -36
  86. package/dist/components/ui/core/label/label.js +26 -43
  87. package/dist/components/ui/core/loader/loader.js +80 -117
  88. package/dist/components/ui/core/message/message-response-default-streamdown-controls.js +12 -12
  89. package/dist/components/ui/core/message/message.d.ts +2 -2
  90. package/dist/components/ui/core/message/message.js +316 -542
  91. package/dist/components/ui/core/overflow-list/overflow-list.utils.d.ts +52 -0
  92. package/dist/components/ui/core/pagination/pagination-size-context.js +5 -6
  93. package/dist/components/ui/core/pagination/pagination-teleport.js +86 -106
  94. package/dist/components/ui/core/pagination/pagination-teleport.utils.js +6 -6
  95. package/dist/components/ui/core/pagination/pagination.js +231 -334
  96. package/dist/components/ui/core/popover/popover.js +90 -157
  97. package/dist/components/ui/core/progress/progress.js +36 -61
  98. package/dist/components/ui/core/prompt-input/prompt-input.js +274 -413
  99. package/dist/components/ui/core/radio-group/radio-group.js +58 -113
  100. package/dist/components/ui/core/reasoning/reasoning.js +55 -86
  101. package/dist/components/ui/core/scroll-area/scroll-area.js +41 -71
  102. package/dist/components/ui/core/search/search.js +77 -99
  103. package/dist/components/ui/core/segmented-control/segmented-control.js +110 -167
  104. package/dist/components/ui/core/select/select.js +168 -293
  105. package/dist/components/ui/core/separator/separator.js +13 -23
  106. package/dist/components/ui/core/shimmer/shimmer.d.ts +2 -4
  107. package/dist/components/ui/core/shimmer/shimmer.js +40 -107
  108. package/dist/components/ui/core/skeleton/skeleton.js +13 -18
  109. package/dist/components/ui/core/slider/slider.d.ts +9 -0
  110. package/dist/components/ui/core/slider/slider.js +40 -0
  111. package/dist/components/ui/core/sonner-toast/sonner-toast.js +54 -47
  112. package/dist/components/ui/core/sources/sources.d.ts +5 -1
  113. package/dist/components/ui/core/sources/sources.js +58 -79
  114. package/dist/components/ui/core/switch/switch.js +62 -0
  115. package/dist/components/ui/core/tabs/tabs.js +149 -223
  116. package/dist/components/ui/core/tabs/tabs.utils.js +6 -8
  117. package/dist/components/ui/core/textarea/textarea.js +13 -27
  118. package/dist/components/ui/core/toggle/toggle.js +55 -74
  119. package/dist/components/ui/core/tool/tool.js +127 -163
  120. package/dist/components/ui/core/tooltip/tooltip.js +47 -86
  121. package/dist/components/ui/core/topbar/topbar.js +106 -190
  122. package/dist/eslint/index.js +5 -10
  123. package/dist/eslint/no-overriding-styles.js +178 -237
  124. package/dist/icons/index.d.ts +1 -0
  125. package/dist/icons/index.js +1 -0
  126. package/dist/index.d.ts +1 -1
  127. package/dist/lib/highlight-code.d.ts +9 -0
  128. package/dist/lib/highlight-code.js +42 -0
  129. package/dist/lib/portal-container-context.js +8 -9
  130. package/dist/lib/style-scope.js +6 -6
  131. package/dist/lib/use-controllable-state.js +21 -30
  132. package/dist/lib/utils.d.ts +0 -2
  133. package/dist/lib/utils.js +32 -112
  134. package/dist/styles.css +1 -1
  135. package/dist/styles.source.css +26 -0
  136. package/package.json +42 -8
  137. package/dist/components/ui/core/date-time-pickers/shared/calendar/calendar.js +0 -119
  138. package/dist/components/ui/core/date-time-pickers/shared/calendar-header/calendar-header.js +0 -93
  139. package/dist/components/ui/core/date-time-pickers/shared/constants.js +0 -14
  140. package/dist/components/ui/core/date-time-pickers/utils/calendar-utils.js +0 -52
  141. /package/dist/components/ui/core/{date-time-pickers/shared/calendar-header → calendar}/calendar-header.d.ts +0 -0
  142. /package/dist/components/ui/core/{date-time-pickers/utils → calendar}/calendar-utils.d.ts +0 -0
  143. /package/dist/components/ui/core/{date-time-pickers/shared/calendar → calendar}/calendar.d.ts +0 -0
@@ -1,415 +1,276 @@
1
- import { jsx as o, jsxs as w } from "react/jsx-runtime";
2
- import { createContext as H, forwardRef as s, useState as y, useContext as C, useCallback as k, useMemo as A } from "react";
3
- import { IconSend as E, IconLoader2 as D, IconSquare as z, IconX as B, IconPlus as L, IconInfoCircle as G } from "@tabler/icons-react";
4
- import { cn as r } from "../../../../lib/utils.js";
5
- import { Command as F, CommandEmpty as j, CommandGroup as K, CommandInput as V, CommandItem as q, CommandList as R, CommandSeparator as O } from "../command/command.js";
6
- import { DropdownMenu as W, DropdownMenuContent as X, DropdownMenuItem as J, DropdownMenuTrigger as Q } from "../dropdown-menu/dropdown-menu.js";
7
- import { HelperText as f } from "../helper-text/helper-text.js";
8
- import { HoverCard as U, HoverCardContent as Y, HoverCardTrigger as Z } from "../hover-card/hover-card.js";
9
- import { InputGroupTextarea as _, InputGroupAddon as x, InputGroupButton as h, InputGroup as $ } from "../input-group/input-group.js";
10
- import { Select as tt, SelectContent as et, SelectItem as ot, SelectTrigger as nt, SelectValue as rt } from "../select/select.js";
11
- const N = H(
12
- null
13
- ), Xt = () => {
14
- const t = C(N);
15
- if (!t)
16
- throw new Error(
17
- "Wrap your component inside <PromptInputProvider> to use usePromptInputController()."
18
- );
19
- return t;
20
- }, v = () => C(N);
21
- function Jt({
22
- initialInput: t = "",
23
- children: e
24
- }) {
25
- const [n, a] = y(t), l = k(() => a(""), []), p = A(
26
- () => ({
27
- textInput: {
28
- value: n,
29
- setInput: a,
30
- clear: l
31
- }
32
- }),
33
- [n, l]
34
- );
35
- return /* @__PURE__ */ o(N.Provider, { value: p, children: e });
1
+ import { cn as e } from "../../../../lib/utils.js";
2
+ import { DropdownMenu as t, DropdownMenuContent as n, DropdownMenuItem as r, DropdownMenuTrigger as i } from "../dropdown-menu/dropdown-menu.js";
3
+ import { HelperText as a } from "../helper-text/helper-text.js";
4
+ import { HoverCard as o, HoverCardContent as s, HoverCardTrigger as c } from "../hover-card/hover-card.js";
5
+ import { Select as l, SelectContent as u, SelectItem as d, SelectTrigger as f, SelectValue as ee } from "../select/select.js";
6
+ import { Command as te, CommandEmpty as ne, CommandGroup as re, CommandInput as ie, CommandItem as p, CommandList as ae, CommandSeparator as oe } from "../command/command.js";
7
+ import { InputGroup as se, InputGroupAddon as m, InputGroupButton as h, InputGroupTextarea as ce } from "../input-group/input-group.js";
8
+ import { createContext as le, forwardRef as g, useCallback as ue, useContext as _, useMemo as de, useState as v } from "react";
9
+ import { IconInfoCircle as fe, IconLoader2 as pe, IconPlus as me, IconSend as he, IconSquare as ge, IconX as _e } from "@tabler/icons-react";
10
+ import { jsx as y, jsxs as ve } from "react/jsx-runtime";
11
+ //#region libs/aura/src/components/ui/core/prompt-input/prompt-input.tsx
12
+ var b = le(null), ye = () => {
13
+ let e = _(b);
14
+ if (!e) throw Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");
15
+ return e;
16
+ }, x = () => _(b);
17
+ function be({ initialInput: e = "", children: t }) {
18
+ let [n, r] = v(e), i = ue(() => r(""), []), a = de(() => ({ textInput: {
19
+ value: n,
20
+ setInput: r,
21
+ clear: i
22
+ } }), [n, i]);
23
+ return /* @__PURE__ */ y(b.Provider, {
24
+ value: a,
25
+ children: t
26
+ });
36
27
  }
37
- const at = ({
38
- className: t,
39
- onSubmit: e,
40
- helperText: n,
41
- errorMessage: a,
42
- children: l,
43
- ...p
44
- }) => {
45
- const m = v(), [u, c] = y(null), P = (g) => {
46
- g.preventDefault();
47
- const b = g.currentTarget, M = m ? m.textInput.value : (() => {
48
- const I = new FormData(b).get("message");
49
- return typeof I == "string" ? I : "";
50
- })();
51
- m || b.reset();
52
- try {
53
- const d = e({ text: M }, g);
54
- d instanceof Promise ? d.then(() => {
55
- c(null), m?.textInput.clear();
56
- }).catch((I) => {
57
- console.error("PromptInput: Submission error:", I), c(
58
- I instanceof Error ? I.message : "Failed to submit. Please try again."
59
- );
60
- }) : (c(null), m?.textInput.clear());
61
- } catch (d) {
62
- console.error("PromptInput: Submission error:", d), c(
63
- d instanceof Error ? d.message : "Failed to submit. Please try again."
64
- );
65
- }
66
- }, S = n === !1 ? null : n ?? /* @__PURE__ */ o(f, { size: "xs", icon: /* @__PURE__ */ o(G, {}), children: "AI doesn't always get it right. Be sure to check results" });
67
- return /* @__PURE__ */ w("div", { className: "w-full flex flex-col gap-2", children: [
68
- /* @__PURE__ */ o(
69
- "form",
70
- {
71
- "data-slot": "prompt-input",
72
- className: r("w-full", t),
73
- onSubmit: P,
74
- ...p,
75
- children: /* @__PURE__ */ o($, { className: "shadow-none rounded-xl has-[[data-slot=input-group-control]:is(:read-only,[aria-disabled=true])]:border-muted-background has-[[data-slot=input-group-control]:is(:read-only,[aria-disabled=true])]:bg-muted-background hover:has-[[data-slot=input-group-control]:is(:read-only,[aria-disabled=true])]:border-muted-background hover:has-[[data-slot=input-group-control]:is(:read-only,[aria-disabled=true])]:bg-muted-background hover:has-[[data-slot=input-group-control]:is(:read-only,[aria-disabled=true])]:text-muted-foreground", children: l })
76
- }
77
- ),
78
- a || u ? /* @__PURE__ */ o(f, { size: "xs", isError: !0, children: a || u }) : S
79
- ] });
80
- };
81
- at.displayName = "PromptInput";
82
- const st = s(
83
- ({ className: t, ...e }, n) => /* @__PURE__ */ o(
84
- "div",
85
- {
86
- ref: n,
87
- "data-slot": "prompt-input-body",
88
- className: r("contents", t),
89
- ...e
90
- }
91
- )
92
- );
93
- st.displayName = "PromptInputBody";
94
- const pt = s(
95
- ({ onChange: t, className: e, placeholder: n = "Type your message...", ...a }, l) => {
96
- const p = v(), [m, u] = y(!1), c = (i) => {
97
- if (i.key === "Enter") {
98
- if (m || i.nativeEvent.isComposing || i.shiftKey)
99
- return;
100
- i.preventDefault(), i.currentTarget.form?.requestSubmit();
101
- }
102
- }, P = p ? {
103
- value: p.textInput.value,
104
- onChange: (i) => {
105
- p.textInput.setInput(i.currentTarget.value), t?.(i);
106
- }
107
- } : {
108
- onChange: t
109
- };
110
- return /* @__PURE__ */ o(
111
- _,
112
- {
113
- ref: l,
114
- className: r(
115
- "field-sizing-content max-h-48 min-h-18 rounded-t-xl md:text-base tracking-tightest p-2.75 leading-5",
116
- e
117
- ),
118
- name: "message",
119
- onCompositionEnd: () => u(!1),
120
- onCompositionStart: () => u(!0),
121
- onKeyDown: c,
122
- placeholder: n,
123
- ...a,
124
- ...P
125
- }
126
- );
127
- }
128
- );
129
- pt.displayName = "PromptInputTextarea";
130
- const mt = s(
131
- ({ className: t, ...e }, n) => /* @__PURE__ */ o(
132
- x,
133
- {
134
- ref: n,
135
- align: "block-end",
136
- className: r("order-first flex-wrap gap-1", t),
137
- ...e
138
- }
139
- )
140
- );
141
- mt.displayName = "PromptInputHeader";
142
- const lt = s(
143
- ({ className: t, ...e }, n) => /* @__PURE__ */ o(
144
- x,
145
- {
146
- ref: n,
147
- align: "block-end",
148
- className: r("justify-between gap-1 p-2.75", t),
149
- ...e
150
- }
151
- )
152
- );
153
- lt.displayName = "PromptInputFooter";
154
- const ut = s(
155
- ({ className: t, ...e }, n) => /* @__PURE__ */ o(
156
- "div",
157
- {
158
- ref: n,
159
- "data-slot": "prompt-input-tools",
160
- className: r("flex items-center gap-2", t),
161
- ...e
162
- }
163
- )
164
- );
165
- ut.displayName = "PromptInputTools";
166
- const T = s(
167
- ({ variant: t = "ghost", className: e, size: n, ...a }, l) => {
168
- const p = a.children === void 0 || a.children === null ? 0 : Array.isArray(a.children) ? a.children.length : 1, m = n ?? (p > 1 ? "sm" : "icon-sm");
169
- return /* @__PURE__ */ o(
170
- h,
171
- {
172
- ref: l,
173
- className: r(e),
174
- size: m,
175
- type: "button",
176
- variant: t,
177
- ...a
178
- }
179
- );
180
- }
181
- );
182
- T.displayName = "PromptInputButton";
183
- const it = (t) => /* @__PURE__ */ o(W, { ...t });
184
- it.displayName = "PromptInputActionMenu";
185
- const dt = ({
186
- className: t,
187
- children: e,
188
- ...n
189
- }) => /* @__PURE__ */ o(
190
- Q,
191
- {
192
- render: /* @__PURE__ */ o(T, { className: t, ...n, children: e ?? /* @__PURE__ */ o(L, { className: "size-4" }) })
193
- }
194
- );
195
- dt.displayName = "PromptInputActionMenuTrigger";
196
- const ct = ({
197
- className: t,
198
- ...e
199
- }) => /* @__PURE__ */ o(X, { align: "start", className: r(t), ...e });
200
- ct.displayName = "PromptInputActionMenuContent";
201
- const It = ({
202
- className: t,
203
- ...e
204
- }) => /* @__PURE__ */ o(J, { className: r(t), ...e });
205
- It.displayName = "PromptInputActionMenuItem";
206
- const Pt = s(
207
- ({
208
- className: t,
209
- variant: e = "default",
210
- size: n = "icon-sm",
211
- status: a,
212
- children: l,
213
- ...p
214
- }, m) => {
215
- let u = /* @__PURE__ */ o(E, { className: "size-4" });
216
- return a === "submitted" ? u = /* @__PURE__ */ o(D, { className: "size-4 animate-spin" }) : a === "streaming" ? u = /* @__PURE__ */ o(z, { className: "size-4" }) : a === "error" && (u = /* @__PURE__ */ o(B, { className: "size-4" })), /* @__PURE__ */ o(
217
- h,
218
- {
219
- ref: m,
220
- "aria-label": "Submit",
221
- className: r(t),
222
- "data-status": a,
223
- size: n,
224
- type: "submit",
225
- variant: e,
226
- ...p,
227
- children: l ?? u
228
- }
229
- );
230
- }
231
- );
232
- Pt.displayName = "PromptInputSubmit";
233
- const gt = (t) => /* @__PURE__ */ o(tt, { ...t });
234
- gt.displayName = "PromptInputModelSelect";
235
- const yt = ({
236
- className: t,
237
- ...e
238
- }) => /* @__PURE__ */ o(
239
- nt,
240
- {
241
- className: r(
242
- "border-none bg-transparent font-medium text-muted-foreground shadow-none transition-colors",
243
- "hover:bg-accent-background hover:text-foreground aria-expanded:bg-accent-background aria-expanded:text-foreground",
244
- t
245
- ),
246
- ...e
247
- }
248
- );
249
- yt.displayName = "PromptInputModelSelectTrigger";
250
- const Nt = ({
251
- className: t,
252
- ...e
253
- }) => /* @__PURE__ */ o(et, { className: r(t), ...e });
254
- Nt.displayName = "PromptInputModelSelectContent";
255
- const bt = ({
256
- className: t,
257
- ...e
258
- }) => /* @__PURE__ */ o(ot, { className: r(t), ...e });
259
- bt.displayName = "PromptInputModelSelectItem";
260
- const ft = ({
261
- className: t,
262
- ...e
263
- }) => /* @__PURE__ */ o(rt, { className: r(t), ...e });
264
- ft.displayName = "PromptInputModelSelectValue";
265
- const Ct = ({
266
- openDelay: t = 0,
267
- closeDelay: e = 0,
268
- ...n
269
- }) => /* @__PURE__ */ o(U, { closeDelay: e, openDelay: t, ...n });
270
- Ct.displayName = "PromptInputHoverCard";
271
- const xt = (t) => /* @__PURE__ */ o(Z, { ...t });
272
- xt.displayName = "PromptInputHoverCardTrigger";
273
- const ht = ({
274
- align: t = "start",
275
- ...e
276
- }) => /* @__PURE__ */ o(Y, { align: t, ...e });
277
- ht.displayName = "PromptInputHoverCardContent";
278
- const vt = s(
279
- ({ className: t, ...e }, n) => /* @__PURE__ */ o(
280
- "div",
281
- {
282
- ref: n,
283
- "data-slot": "prompt-input-tabs-list",
284
- className: r(t),
285
- ...e
286
- }
287
- )
288
- );
289
- vt.displayName = "PromptInputTabsList";
290
- const Tt = s(
291
- ({ className: t, ...e }, n) => /* @__PURE__ */ o(
292
- "div",
293
- {
294
- ref: n,
295
- "data-slot": "prompt-input-tab",
296
- className: r(t),
297
- ...e
298
- }
299
- )
300
- );
301
- Tt.displayName = "PromptInputTab";
302
- const St = s(
303
- ({ className: t, children: e, ...n }, a) => /* @__PURE__ */ o(
304
- "h3",
305
- {
306
- ref: a,
307
- "data-slot": "prompt-input-tab-label",
308
- className: r(
309
- "mb-2 px-3 font-medium text-muted-foreground text-xs",
310
- t
311
- ),
312
- ...n,
313
- children: e
314
- }
315
- )
316
- );
317
- St.displayName = "PromptInputTabLabel";
318
- const Mt = s(
319
- ({ className: t, ...e }, n) => /* @__PURE__ */ o(
320
- "div",
321
- {
322
- ref: n,
323
- "data-slot": "prompt-input-tab-body",
324
- className: r("space-y-1", t),
325
- ...e
326
- }
327
- )
328
- );
329
- Mt.displayName = "PromptInputTabBody";
330
- const wt = s(
331
- ({ className: t, ...e }, n) => /* @__PURE__ */ o(
332
- "div",
333
- {
334
- ref: n,
335
- "data-slot": "prompt-input-tab-item",
336
- className: r(
337
- "flex items-center gap-2 px-3 py-2 text-xs hover:bg-accent-background",
338
- t
339
- ),
340
- ...e
341
- }
342
- )
343
- );
344
- wt.displayName = "PromptInputTabItem";
345
- const Ht = ({
346
- className: t,
347
- ...e
348
- }) => /* @__PURE__ */ o(F, { className: r(t), ...e });
349
- Ht.displayName = "PromptInputCommand";
350
- const kt = ({
351
- className: t,
352
- ...e
353
- }) => /* @__PURE__ */ o(V, { className: r(t), ...e });
354
- kt.displayName = "PromptInputCommandInput";
355
- const At = ({
356
- className: t,
357
- ...e
358
- }) => /* @__PURE__ */ o(R, { className: r(t), ...e });
359
- At.displayName = "PromptInputCommandList";
360
- const Et = ({
361
- className: t,
362
- ...e
363
- }) => /* @__PURE__ */ o(j, { className: r(t), ...e });
364
- Et.displayName = "PromptInputCommandEmpty";
365
- const Dt = ({
366
- className: t,
367
- ...e
368
- }) => /* @__PURE__ */ o(K, { className: r(t), ...e });
369
- Dt.displayName = "PromptInputCommandGroup";
370
- const zt = ({
371
- className: t,
372
- ...e
373
- }) => /* @__PURE__ */ o(q, { className: r(t), ...e });
374
- zt.displayName = "PromptInputCommandItem";
375
- const Bt = ({
376
- className: t,
377
- ...e
378
- }) => /* @__PURE__ */ o(O, { className: r(t), ...e });
379
- Bt.displayName = "PromptInputCommandSeparator";
380
- export {
381
- at as PromptInput,
382
- it as PromptInputActionMenu,
383
- ct as PromptInputActionMenuContent,
384
- It as PromptInputActionMenuItem,
385
- dt as PromptInputActionMenuTrigger,
386
- st as PromptInputBody,
387
- T as PromptInputButton,
388
- Ht as PromptInputCommand,
389
- Et as PromptInputCommandEmpty,
390
- Dt as PromptInputCommandGroup,
391
- kt as PromptInputCommandInput,
392
- zt as PromptInputCommandItem,
393
- At as PromptInputCommandList,
394
- Bt as PromptInputCommandSeparator,
395
- lt as PromptInputFooter,
396
- mt as PromptInputHeader,
397
- Ct as PromptInputHoverCard,
398
- ht as PromptInputHoverCardContent,
399
- xt as PromptInputHoverCardTrigger,
400
- gt as PromptInputModelSelect,
401
- Nt as PromptInputModelSelectContent,
402
- bt as PromptInputModelSelectItem,
403
- yt as PromptInputModelSelectTrigger,
404
- ft as PromptInputModelSelectValue,
405
- Jt as PromptInputProvider,
406
- Pt as PromptInputSubmit,
407
- Tt as PromptInputTab,
408
- Mt as PromptInputTabBody,
409
- wt as PromptInputTabItem,
410
- St as PromptInputTabLabel,
411
- vt as PromptInputTabsList,
412
- pt as PromptInputTextarea,
413
- ut as PromptInputTools,
414
- Xt as usePromptInputController
28
+ var S = ({ className: t, onSubmit: n, helperText: r, errorMessage: i, children: o, ...s }) => {
29
+ let c = x(), [l, u] = v(null), d = (e) => {
30
+ e.preventDefault();
31
+ let t = e.currentTarget, r = c ? c.textInput.value : (() => {
32
+ let e = new FormData(t).get("message");
33
+ return typeof e == "string" ? e : "";
34
+ })();
35
+ c || t.reset();
36
+ try {
37
+ let t = n({ text: r }, e);
38
+ t instanceof Promise ? t.then(() => {
39
+ u(null), c?.textInput.clear();
40
+ }).catch((e) => {
41
+ console.error("PromptInput: Submission error:", e), u(e instanceof Error ? e.message : "Failed to submit. Please try again.");
42
+ }) : (u(null), c?.textInput.clear());
43
+ } catch (e) {
44
+ console.error("PromptInput: Submission error:", e), u(e instanceof Error ? e.message : "Failed to submit. Please try again.");
45
+ }
46
+ }, f = r === !1 ? null : r ?? /* @__PURE__ */ y(a, {
47
+ size: "xs",
48
+ icon: /* @__PURE__ */ y(fe, {}),
49
+ children: "AI doesn't always get it right. Be sure to check results"
50
+ });
51
+ return /* @__PURE__ */ ve("div", {
52
+ className: "w-full flex flex-col gap-2",
53
+ children: [/* @__PURE__ */ y("form", {
54
+ "data-slot": "prompt-input",
55
+ className: e("w-full", t),
56
+ onSubmit: d,
57
+ ...s,
58
+ children: /* @__PURE__ */ y(se, {
59
+ className: "shadow-none rounded-xl has-[[data-slot=input-group-control]:is(:read-only,[aria-disabled=true])]:border-muted-background has-[[data-slot=input-group-control]:is(:read-only,[aria-disabled=true])]:bg-muted-background hover:has-[[data-slot=input-group-control]:is(:read-only,[aria-disabled=true])]:border-muted-background hover:has-[[data-slot=input-group-control]:is(:read-only,[aria-disabled=true])]:bg-muted-background hover:has-[[data-slot=input-group-control]:is(:read-only,[aria-disabled=true])]:text-muted-foreground",
60
+ children: o
61
+ })
62
+ }), i || l ? /* @__PURE__ */ y(a, {
63
+ size: "xs",
64
+ isError: !0,
65
+ children: i || l
66
+ }) : f]
67
+ });
415
68
  };
69
+ S.displayName = "PromptInput";
70
+ var C = g(({ className: t, ...n }, r) => /* @__PURE__ */ y("div", {
71
+ ref: r,
72
+ "data-slot": "prompt-input-body",
73
+ className: e("contents", t),
74
+ ...n
75
+ }));
76
+ C.displayName = "PromptInputBody";
77
+ var w = g(({ onChange: t, className: n, placeholder: r = "Type your message...", ...i }, a) => {
78
+ let o = x(), [s, c] = v(!1), l = (e) => {
79
+ if (e.key === "Enter") {
80
+ if (s || e.nativeEvent.isComposing || e.shiftKey) return;
81
+ e.preventDefault(), e.currentTarget.form?.requestSubmit();
82
+ }
83
+ }, u = o ? {
84
+ value: o.textInput.value,
85
+ onChange: (e) => {
86
+ o.textInput.setInput(e.currentTarget.value), t?.(e);
87
+ }
88
+ } : { onChange: t };
89
+ return /* @__PURE__ */ y(ce, {
90
+ ref: a,
91
+ className: e("field-sizing-content max-h-48 min-h-18 rounded-t-xl md:text-base tracking-tightest p-2.75 leading-5", n),
92
+ name: "message",
93
+ onCompositionEnd: () => c(!1),
94
+ onCompositionStart: () => c(!0),
95
+ onKeyDown: l,
96
+ placeholder: r,
97
+ ...i,
98
+ ...u
99
+ });
100
+ });
101
+ w.displayName = "PromptInputTextarea";
102
+ var T = g(({ className: t, ...n }, r) => /* @__PURE__ */ y(m, {
103
+ ref: r,
104
+ align: "block-end",
105
+ className: e("order-first flex-wrap gap-1", t),
106
+ ...n
107
+ }));
108
+ T.displayName = "PromptInputHeader";
109
+ var E = g(({ className: t, ...n }, r) => /* @__PURE__ */ y(m, {
110
+ ref: r,
111
+ align: "block-end",
112
+ className: e("justify-between gap-1 p-2.75", t),
113
+ ...n
114
+ }));
115
+ E.displayName = "PromptInputFooter";
116
+ var D = g(({ className: t, ...n }, r) => /* @__PURE__ */ y("div", {
117
+ ref: r,
118
+ "data-slot": "prompt-input-tools",
119
+ className: e("flex items-center gap-2", t),
120
+ ...n
121
+ }));
122
+ D.displayName = "PromptInputTools";
123
+ var O = g(({ variant: t = "ghost", className: n, size: r, ...i }, a) => {
124
+ let o = i.children === void 0 || i.children === null ? 0 : Array.isArray(i.children) ? i.children.length : 1, s = r ?? (o > 1 ? "sm" : "icon-sm");
125
+ return /* @__PURE__ */ y(h, {
126
+ ref: a,
127
+ className: e(n),
128
+ size: s,
129
+ type: "button",
130
+ variant: t,
131
+ ...i
132
+ });
133
+ });
134
+ O.displayName = "PromptInputButton";
135
+ var k = (e) => /* @__PURE__ */ y(t, { ...e });
136
+ k.displayName = "PromptInputActionMenu";
137
+ var A = ({ className: e, children: t, ...n }) => /* @__PURE__ */ y(i, { render: /* @__PURE__ */ y(O, {
138
+ className: e,
139
+ ...n,
140
+ children: t ?? /* @__PURE__ */ y(me, { className: "size-4" })
141
+ }) });
142
+ A.displayName = "PromptInputActionMenuTrigger";
143
+ var j = ({ className: t, ...r }) => /* @__PURE__ */ y(n, {
144
+ align: "start",
145
+ className: e(t),
146
+ ...r
147
+ });
148
+ j.displayName = "PromptInputActionMenuContent";
149
+ var M = ({ className: t, ...n }) => /* @__PURE__ */ y(r, {
150
+ className: e(t),
151
+ ...n
152
+ });
153
+ M.displayName = "PromptInputActionMenuItem";
154
+ var N = g(({ className: t, variant: n = "default", size: r = "icon-sm", status: i, children: a, ...o }, s) => {
155
+ let c = /* @__PURE__ */ y(he, { className: "size-4" });
156
+ return i === "submitted" ? c = /* @__PURE__ */ y(pe, { className: "size-4 animate-spin" }) : i === "streaming" ? c = /* @__PURE__ */ y(ge, { className: "size-4" }) : i === "error" && (c = /* @__PURE__ */ y(_e, { className: "size-4" })), /* @__PURE__ */ y(h, {
157
+ ref: s,
158
+ "aria-label": "Submit",
159
+ className: e(t),
160
+ "data-status": i,
161
+ size: r,
162
+ type: "submit",
163
+ variant: n,
164
+ ...o,
165
+ children: a ?? c
166
+ });
167
+ });
168
+ N.displayName = "PromptInputSubmit";
169
+ var P = (e) => /* @__PURE__ */ y(l, { ...e });
170
+ P.displayName = "PromptInputModelSelect";
171
+ var F = ({ className: t, ...n }) => /* @__PURE__ */ y(f, {
172
+ className: e("border-none bg-transparent font-medium text-muted-foreground shadow-none transition-colors", "hover:bg-accent-background hover:text-foreground aria-expanded:bg-accent-background aria-expanded:text-foreground", t),
173
+ ...n
174
+ });
175
+ F.displayName = "PromptInputModelSelectTrigger";
176
+ var I = ({ className: t, ...n }) => /* @__PURE__ */ y(u, {
177
+ className: e(t),
178
+ ...n
179
+ });
180
+ I.displayName = "PromptInputModelSelectContent";
181
+ var L = ({ className: t, ...n }) => /* @__PURE__ */ y(d, {
182
+ className: e(t),
183
+ ...n
184
+ });
185
+ L.displayName = "PromptInputModelSelectItem";
186
+ var R = ({ className: t, ...n }) => /* @__PURE__ */ y(ee, {
187
+ className: e(t),
188
+ ...n
189
+ });
190
+ R.displayName = "PromptInputModelSelectValue";
191
+ var z = ({ openDelay: e = 0, closeDelay: t = 0, ...n }) => /* @__PURE__ */ y(o, {
192
+ closeDelay: t,
193
+ openDelay: e,
194
+ ...n
195
+ });
196
+ z.displayName = "PromptInputHoverCard";
197
+ var B = (e) => /* @__PURE__ */ y(c, { ...e });
198
+ B.displayName = "PromptInputHoverCardTrigger";
199
+ var V = ({ align: e = "start", ...t }) => /* @__PURE__ */ y(s, {
200
+ align: e,
201
+ ...t
202
+ });
203
+ V.displayName = "PromptInputHoverCardContent";
204
+ var H = g(({ className: t, ...n }, r) => /* @__PURE__ */ y("div", {
205
+ ref: r,
206
+ "data-slot": "prompt-input-tabs-list",
207
+ className: e(t),
208
+ ...n
209
+ }));
210
+ H.displayName = "PromptInputTabsList";
211
+ var U = g(({ className: t, ...n }, r) => /* @__PURE__ */ y("div", {
212
+ ref: r,
213
+ "data-slot": "prompt-input-tab",
214
+ className: e(t),
215
+ ...n
216
+ }));
217
+ U.displayName = "PromptInputTab";
218
+ var W = g(({ className: t, children: n, ...r }, i) => /* @__PURE__ */ y("h3", {
219
+ ref: i,
220
+ "data-slot": "prompt-input-tab-label",
221
+ className: e("mb-2 px-3 font-medium text-muted-foreground text-xs", t),
222
+ ...r,
223
+ children: n
224
+ }));
225
+ W.displayName = "PromptInputTabLabel";
226
+ var G = g(({ className: t, ...n }, r) => /* @__PURE__ */ y("div", {
227
+ ref: r,
228
+ "data-slot": "prompt-input-tab-body",
229
+ className: e("space-y-1", t),
230
+ ...n
231
+ }));
232
+ G.displayName = "PromptInputTabBody";
233
+ var K = g(({ className: t, ...n }, r) => /* @__PURE__ */ y("div", {
234
+ ref: r,
235
+ "data-slot": "prompt-input-tab-item",
236
+ className: e("flex items-center gap-2 px-3 py-2 text-xs hover:bg-accent-background", t),
237
+ ...n
238
+ }));
239
+ K.displayName = "PromptInputTabItem";
240
+ var q = ({ className: t, ...n }) => /* @__PURE__ */ y(te, {
241
+ className: e(t),
242
+ ...n
243
+ });
244
+ q.displayName = "PromptInputCommand";
245
+ var J = ({ className: t, ...n }) => /* @__PURE__ */ y(ie, {
246
+ className: e(t),
247
+ ...n
248
+ });
249
+ J.displayName = "PromptInputCommandInput";
250
+ var Y = ({ className: t, ...n }) => /* @__PURE__ */ y(ae, {
251
+ className: e(t),
252
+ ...n
253
+ });
254
+ Y.displayName = "PromptInputCommandList";
255
+ var X = ({ className: t, ...n }) => /* @__PURE__ */ y(ne, {
256
+ className: e(t),
257
+ ...n
258
+ });
259
+ X.displayName = "PromptInputCommandEmpty";
260
+ var Z = ({ className: t, ...n }) => /* @__PURE__ */ y(re, {
261
+ className: e(t),
262
+ ...n
263
+ });
264
+ Z.displayName = "PromptInputCommandGroup";
265
+ var Q = ({ className: t, ...n }) => /* @__PURE__ */ y(p, {
266
+ className: e(t),
267
+ ...n
268
+ });
269
+ Q.displayName = "PromptInputCommandItem";
270
+ var $ = ({ className: t, ...n }) => /* @__PURE__ */ y(oe, {
271
+ className: e(t),
272
+ ...n
273
+ });
274
+ $.displayName = "PromptInputCommandSeparator";
275
+ //#endregion
276
+ export { S as PromptInput, k as PromptInputActionMenu, j as PromptInputActionMenuContent, M as PromptInputActionMenuItem, A as PromptInputActionMenuTrigger, C as PromptInputBody, O as PromptInputButton, q as PromptInputCommand, X as PromptInputCommandEmpty, Z as PromptInputCommandGroup, J as PromptInputCommandInput, Q as PromptInputCommandItem, Y as PromptInputCommandList, $ as PromptInputCommandSeparator, E as PromptInputFooter, T as PromptInputHeader, z as PromptInputHoverCard, V as PromptInputHoverCardContent, B as PromptInputHoverCardTrigger, P as PromptInputModelSelect, I as PromptInputModelSelectContent, L as PromptInputModelSelectItem, F as PromptInputModelSelectTrigger, R as PromptInputModelSelectValue, be as PromptInputProvider, N as PromptInputSubmit, U as PromptInputTab, G as PromptInputTabBody, K as PromptInputTabItem, W as PromptInputTabLabel, H as PromptInputTabsList, w as PromptInputTextarea, D as PromptInputTools, ye as usePromptInputController };