@alfadocs/ui-kit 0.17.1 → 0.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{accordion-DOmxGEWU.js → accordion-CNcodXuO.js} +6 -6
- package/dist/_chunks/{ai-prompt-input-DEiQwIMn.js → ai-prompt-input-B-w5Rx3V.js} +184 -181
- package/dist/_chunks/{alert-pgdXrEO5.js → alert-DBnawbmf.js} +64 -59
- package/dist/_chunks/{audio-recorder-CRh4uyFL.js → audio-recorder-DNkQLW1G.js} +3 -3
- package/dist/_chunks/{autocomplete-mOg7WLOh.js → autocomplete-BxfabhZ8.js} +167 -164
- package/dist/_chunks/{balance-cell-renderer-DWWtX-VM.js → balance-cell-renderer-DJB6WDPe.js} +2 -2
- package/dist/_chunks/{chat-input-UK-bXU7u.js → chat-input-B3XmFGDw.js} +123 -122
- package/dist/_chunks/checkbox-group-Bwmt1ovQ.js +213 -0
- package/dist/_chunks/{checkbox-D5EHnB14.js → checkbox-mwbrPZDY.js} +75 -70
- package/dist/_chunks/{collapsible-CuxUBoHJ.js → collapsible-hHiyZp0b.js} +61 -63
- package/dist/_chunks/{color-picker-BPfcByHH.js → color-picker-Bm-gzpsh.js} +2 -2
- package/dist/_chunks/{combobox-D5tWe0t_.js → combobox-Da9eq00i.js} +214 -211
- package/dist/_chunks/{copy-field-BCHAZ8QV.js → copy-field-BAF4mt9h.js} +95 -132
- package/dist/_chunks/{date-picker-BlhtBhPo.js → date-picker-BIoSLRly.js} +222 -219
- package/dist/_chunks/{date-range-picker-C2hRu_Ke.js → date-range-picker-9gANFNG9.js} +81 -78
- package/dist/_chunks/{date-time-picker-B67mPZmP.js → date-time-picker-DG7BiGdb.js} +98 -95
- package/dist/_chunks/{dialog-DRp6Dejy.js → dialog-DUomPCRS.js} +69 -71
- package/dist/_chunks/{dropdown-menu-dyV7gHh_.js → dropdown-menu-DZxwF23X.js} +108 -110
- package/dist/_chunks/{freemium-paywall-BTEiVkes.js → freemium-paywall-DXc7XlGE.js} +98 -97
- package/dist/_chunks/{leo-sidebar-D3TuyH5_.js → leo-sidebar-DIsiTju3.js} +2 -2
- package/dist/_chunks/{list-DcjV0m5B.js → list-BdvDctBz.js} +184 -180
- package/dist/_chunks/{message-tray-Fsend-du.js → message-tray-BNAS8al4.js} +111 -111
- package/dist/_chunks/{multi-select-DooDzQIp.js → multi-select-CyspR5ZF.js} +157 -154
- package/dist/_chunks/{navigation-menu-DdufF-_4.js → navigation-menu-CyS1fBJ7.js} +85 -87
- package/dist/_chunks/{notification-tray-C3dYdLAF.js → notification-tray-D_69dXFY.js} +114 -114
- package/dist/_chunks/{number-input-DH00o0DN.js → number-input-BZXu6bPY.js} +92 -89
- package/dist/_chunks/{otp-input-BBXYvLx5.js → otp-input-BDF_iNpa.js} +92 -93
- package/dist/_chunks/{pagination-F1ei4khE.js → pagination-BWaXF7W0.js} +194 -211
- package/dist/_chunks/{patient-shell-BE0CdPOJ.js → patient-shell-BOOaWZA9.js} +3 -3
- package/dist/_chunks/{payment-form-CI77oIx1.js → payment-form-BjkuQeqR.js} +2 -2
- package/dist/_chunks/{pdf-viewer-CnEJvmXC.js → pdf-viewer-BG_nsFT5.js} +2 -2
- package/dist/_chunks/{radio-group-Cz1a4QCA.js → radio-group-BHZOxrIK.js} +4 -4
- package/dist/_chunks/{select-Ca6ibiDL.js → select-C92AT_OZ.js} +7 -7
- package/dist/_chunks/{sidebar-D8Lq065m.js → sidebar-BqzlRBvC.js} +271 -291
- package/dist/_chunks/{slider-CkR6CLun.js → slider-CfEzeseL.js} +4 -4
- package/dist/_chunks/{tabs-CRCyPpJo.js → tabs-aEQfQV3x.js} +8 -8
- package/dist/_chunks/{theme-toggle-B3meAb3y.js → theme-toggle-BswYl0Yp.js} +2 -2
- package/dist/_chunks/use-controllable-state-BiY4xTzM.js +23 -0
- package/dist/_chunks/use-copy-to-clipboard-Cyfc_dlv.js +43 -0
- package/dist/_chunks/use-persistent-state-i23OWy6G.js +24 -0
- package/dist/_chunks/{warning-stack-CeRihME9.js → warning-stack-CDH9TudY.js} +2 -2
- package/dist/_chunks/{workflow-map-D3MvrsZV.js → workflow-map-BeKe23uw.js} +3 -3
- package/dist/agent-catalog.json +1 -1
- package/dist/components/_shared/use-debounced-callback.d.ts +1 -5
- package/dist/components/_shared/use-direction.d.ts +1 -18
- package/dist/components/_shared/use-focus-trap.d.ts +1 -31
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/ai-prompt-input/index.js +1 -1
- package/dist/components/alert/index.js +1 -1
- package/dist/components/audio-recorder/index.js +1 -1
- package/dist/components/autocomplete/index.js +1 -1
- package/dist/components/chat-input/index.js +1 -1
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/checkbox-group/index.js +1 -1
- package/dist/components/collapsible/index.js +1 -1
- package/dist/components/color-picker/index.js +1 -1
- package/dist/components/combobox/index.js +1 -1
- package/dist/components/command-palette/command-palette.d.ts +1 -1
- package/dist/components/copy-field/index.js +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/date-picker/index.js +1 -1
- package/dist/components/date-range-picker/index.js +1 -1
- package/dist/components/date-time-picker/index.js +1 -1
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/dropdown-menu/index.js +1 -1
- package/dist/components/freemium-paywall/index.js +1 -1
- package/dist/components/icon-button-group/icon-button-group.d.ts +14 -14
- package/dist/components/list/index.js +1 -1
- package/dist/components/message-tray/index.js +1 -1
- package/dist/components/multi-select/index.js +1 -1
- package/dist/components/navigation-menu/index.js +1 -1
- package/dist/components/notification-tray/index.js +1 -1
- package/dist/components/number-input/index.js +1 -1
- package/dist/components/otp-input/index.js +1 -1
- package/dist/components/pagination/index.js +1 -1
- package/dist/components/payment-form/index.js +1 -1
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/radio-group/index.js +1 -1
- package/dist/components/select/index.js +1 -1
- package/dist/components/sidebar/index.js +8 -7
- package/dist/components/sidebar/sidebar.d.ts +1 -1
- package/dist/components/slider/index.js +1 -1
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/theme-toggle/index.js +1 -1
- package/dist/components/warning-stack/index.js +1 -1
- package/dist/components/workflow/index.js +1 -1
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/index.js +98 -15
- package/dist/hooks/use-debounced-callback.d.ts +19 -0
- package/dist/hooks/use-debounced-value.d.ts +16 -0
- package/dist/hooks/use-direction.d.ts +19 -0
- package/dist/hooks/use-focus-trap.d.ts +32 -0
- package/dist/hooks/use-isomorphic-layout-effect.d.ts +13 -0
- package/dist/hooks/use-persistent-state.d.ts +16 -0
- package/dist/index.js +493 -492
- package/dist/patterns/leo-assistant/index.js +1 -1
- package/dist/patterns/patient-shell/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +4 -2
- package/dist/_chunks/checkbox-group-Qkm3Rg1S.js +0 -208
|
@@ -2,9 +2,9 @@ import { jsx as d, jsxs as D } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef as g, useContext as E, useRef as b, useState as S, useEffect as H, useCallback as M, useMemo as q, createContext as B } from "react";
|
|
3
3
|
import * as u from "@radix-ui/react-accordion";
|
|
4
4
|
import { c as m } from "./index-D2ZczOXr.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { c as F } from "./compose-refs-C0k0tdqF.js";
|
|
6
|
+
import { C as G } from "./chevron-down-BX_NP2Yh.js";
|
|
7
|
+
import { u as J } from "./use-direction-D6rvvG9G.js";
|
|
8
8
|
import { u as K } from "./registry-C9nwlNyL.js";
|
|
9
9
|
const L = {
|
|
10
10
|
id: "accordion",
|
|
@@ -97,7 +97,7 @@ const L = {
|
|
|
97
97
|
].join(" ")
|
|
98
98
|
), V = g(
|
|
99
99
|
({ variant: a = "default", className: t, children: n, id: r, ...p }, h) => {
|
|
100
|
-
const v = b(null), N =
|
|
100
|
+
const v = b(null), N = F(h, v), R = J(v), c = p, A = p.type === "multiple", y = c.value !== void 0, [_, T] = S(
|
|
101
101
|
() => {
|
|
102
102
|
const e = c.defaultValue;
|
|
103
103
|
return e !== void 0 ? e : A ? [] : "";
|
|
@@ -195,7 +195,7 @@ const w = g(
|
|
|
195
195
|
...n,
|
|
196
196
|
children: [
|
|
197
197
|
t,
|
|
198
|
-
/* @__PURE__ */ d(
|
|
198
|
+
/* @__PURE__ */ d(G, { "aria-hidden": "true", className: X() })
|
|
199
199
|
]
|
|
200
200
|
}
|
|
201
201
|
) })
|
|
@@ -225,4 +225,4 @@ export {
|
|
|
225
225
|
w as c,
|
|
226
226
|
L as d
|
|
227
227
|
};
|
|
228
|
-
//# sourceMappingURL=accordion-
|
|
228
|
+
//# sourceMappingURL=accordion-CNcodXuO.js.map
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { c as
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import { u as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { S as
|
|
11
|
-
import {
|
|
12
|
-
|
|
1
|
+
import { jsxs as u, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Fe, useId as Be, useRef as H, useCallback as v, useState as _, useLayoutEffect as $e, useImperativeHandle as Ce, useMemo as Oe } from "react";
|
|
3
|
+
import { c as je } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as ee } from "react-i18next";
|
|
5
|
+
import { u as J } from "./use-controllable-state-BiY4xTzM.js";
|
|
6
|
+
import { u as Re } from "./registry-C9nwlNyL.js";
|
|
7
|
+
import { _ as g } from "./index-4xgbg-sn.js";
|
|
8
|
+
import { u as De } from "./index-CFoBa86t.js";
|
|
9
|
+
import { I as te } from "./icon-button-C4CGcYuz.js";
|
|
10
|
+
import { S as _e } from "./select-C92AT_OZ.js";
|
|
11
|
+
import { S as Ae } from "./send-CySZIRPJ.js";
|
|
12
|
+
import { X as Le } from "./x-CCcI3eJp.js";
|
|
13
|
+
const Ue = {
|
|
13
14
|
id: "ai-prompt-input",
|
|
14
15
|
capabilities: ["edit_inline", "submit"],
|
|
15
16
|
state: {
|
|
@@ -79,7 +80,7 @@ const We = {
|
|
|
79
80
|
description: "Sourced from the id prop; addresses a specific composer instance."
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
|
-
},
|
|
83
|
+
}, We = je(
|
|
83
84
|
[
|
|
84
85
|
"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:w-full",
|
|
85
86
|
"ds:rounded-[var(--radius-md)] ds:border ds:border-border ds:bg-input",
|
|
@@ -98,146 +99,149 @@ const We = {
|
|
|
98
99
|
},
|
|
99
100
|
defaultVariants: { size: "md" }
|
|
100
101
|
}
|
|
101
|
-
),
|
|
102
|
+
), Ze = Fe(
|
|
102
103
|
({
|
|
103
104
|
commands: s = [],
|
|
104
105
|
models: d,
|
|
105
|
-
defaultModelId:
|
|
106
|
-
modelId:
|
|
107
|
-
onModelChange:
|
|
108
|
-
maxSize:
|
|
109
|
-
accept:
|
|
110
|
-
context:
|
|
111
|
-
onContextDismiss:
|
|
112
|
-
onSubmit:
|
|
113
|
-
onAttach:
|
|
114
|
-
onAttachmentRejected:
|
|
115
|
-
minRows:
|
|
116
|
-
maxRows:
|
|
117
|
-
value:
|
|
118
|
-
defaultValue:
|
|
119
|
-
size:
|
|
120
|
-
disabled:
|
|
121
|
-
className:
|
|
122
|
-
placeholder:
|
|
123
|
-
onChange:
|
|
124
|
-
onKeyDown:
|
|
125
|
-
onCompositionStart:
|
|
126
|
-
onCompositionEnd:
|
|
127
|
-
onPaste:
|
|
128
|
-
id:
|
|
129
|
-
...
|
|
130
|
-
},
|
|
131
|
-
var
|
|
132
|
-
const { t: o } =
|
|
133
|
-
|
|
134
|
-
}, []),
|
|
135
|
-
String(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
106
|
+
defaultModelId: K,
|
|
107
|
+
modelId: se,
|
|
108
|
+
onModelChange: ae,
|
|
109
|
+
maxSize: h,
|
|
110
|
+
accept: re,
|
|
111
|
+
context: T,
|
|
112
|
+
onContextDismiss: b,
|
|
113
|
+
onSubmit: x,
|
|
114
|
+
onAttach: y,
|
|
115
|
+
onAttachmentRejected: I,
|
|
116
|
+
minRows: E = 2,
|
|
117
|
+
maxRows: A = 8,
|
|
118
|
+
value: L,
|
|
119
|
+
defaultValue: ne,
|
|
120
|
+
size: ie = "md",
|
|
121
|
+
disabled: U,
|
|
122
|
+
className: oe,
|
|
123
|
+
placeholder: de,
|
|
124
|
+
onChange: F,
|
|
125
|
+
onKeyDown: B,
|
|
126
|
+
onCompositionStart: $,
|
|
127
|
+
onCompositionEnd: C,
|
|
128
|
+
onPaste: O,
|
|
129
|
+
id: j,
|
|
130
|
+
...le
|
|
131
|
+
}, ce) => {
|
|
132
|
+
var Y;
|
|
133
|
+
const { t: o } = ee(), pe = Be(), w = H(null), k = H(!1), ue = H(null), me = v((e) => {
|
|
134
|
+
w.current = e;
|
|
135
|
+
}, []), [fe, m] = J({
|
|
136
|
+
value: L === void 0 ? void 0 : String(L),
|
|
137
|
+
defaultValue: String(ne ?? "")
|
|
138
|
+
}), i = fe ?? "", [p, N] = _([]), [f, S] = _(!1), [ve, M] = _(""), [ge, he] = J({
|
|
139
|
+
value: se,
|
|
140
|
+
defaultValue: K ?? ((Y = d == null ? void 0 : d[0]) == null ? void 0 : Y.id) ?? "",
|
|
141
|
+
onChange: ae
|
|
142
|
+
}), R = ge ?? "", W = v(() => {
|
|
143
|
+
const e = w.current;
|
|
140
144
|
if (!e) return;
|
|
141
|
-
const t = window.getComputedStyle(e), n = parseFloat(t.lineHeight) || 24, r = parseFloat(t.paddingTop) || 0,
|
|
145
|
+
const t = window.getComputedStyle(e), n = parseFloat(t.lineHeight) || 24, r = parseFloat(t.paddingTop) || 0, c = parseFloat(t.paddingBottom) || 0, l = parseFloat(t.borderTopWidth) || 0, D = parseFloat(t.borderBottomWidth) || 0, V = r + c + l + D, Te = n * E + V, G = n * A + V;
|
|
142
146
|
e.style.height = "auto";
|
|
143
|
-
const
|
|
144
|
-
e.style.height = `${
|
|
145
|
-
}, [
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}, [
|
|
149
|
-
const
|
|
147
|
+
const Ee = Math.max(Te, Math.min(e.scrollHeight, G));
|
|
148
|
+
e.style.height = `${Ee}px`, e.style.overflowY = e.scrollHeight > G ? "auto" : "hidden";
|
|
149
|
+
}, [E, A]);
|
|
150
|
+
$e(() => {
|
|
151
|
+
W();
|
|
152
|
+
}, [W, i]);
|
|
153
|
+
const be = v((e, t) => {
|
|
150
154
|
const r = e.slice(0, t).lastIndexOf(`
|
|
151
|
-
`) + 1,
|
|
152
|
-
if (
|
|
153
|
-
const l =
|
|
155
|
+
`) + 1, c = e.slice(r, t);
|
|
156
|
+
if (c.startsWith("/")) {
|
|
157
|
+
const l = c.slice(1);
|
|
154
158
|
if (!/\s/.test(l)) {
|
|
155
|
-
|
|
159
|
+
S(!0), M(l);
|
|
156
160
|
return;
|
|
157
161
|
}
|
|
158
162
|
}
|
|
159
|
-
|
|
160
|
-
}, []),
|
|
161
|
-
if (
|
|
162
|
-
|
|
163
|
+
S(!1), M("");
|
|
164
|
+
}, []), xe = (e) => {
|
|
165
|
+
if (m(e.target.value), k.current) return;
|
|
166
|
+
F == null || F(e);
|
|
163
167
|
const t = e.target.selectionStart ?? e.target.value.length;
|
|
164
|
-
|
|
168
|
+
be(e.target.value, t);
|
|
169
|
+
}, ye = (e) => {
|
|
170
|
+
k.current = !0, $ == null || $(e);
|
|
165
171
|
}, Ie = (e) => {
|
|
166
|
-
|
|
167
|
-
}, we = (e) => {
|
|
168
|
-
|
|
169
|
-
}, ke = (e) => e.nativeEvent.isComposing || e.keyCode === 229 || S.current, V = g(() => {
|
|
170
|
-
if (!i.trim() && u.length === 0) return;
|
|
172
|
+
k.current = !1, C == null || C(e);
|
|
173
|
+
}, we = (e) => e.nativeEvent.isComposing || e.keyCode === 229 || k.current, P = v(() => {
|
|
174
|
+
if (!i.trim() && p.length === 0) return;
|
|
171
175
|
let t, n = i;
|
|
172
176
|
const r = i.match(/^\/(\S+)\s?/);
|
|
173
|
-
r && (t = r[1], n = i.slice(r[0].length)),
|
|
177
|
+
r && (t = r[1], n = i.slice(r[0].length)), x == null || x({
|
|
174
178
|
text: n,
|
|
175
179
|
command: t,
|
|
176
|
-
attachments:
|
|
177
|
-
modelId:
|
|
178
|
-
}),
|
|
179
|
-
}, [i,
|
|
180
|
-
|
|
181
|
-
const
|
|
180
|
+
attachments: p,
|
|
181
|
+
modelId: R || void 0
|
|
182
|
+
}), m(""), N([]);
|
|
183
|
+
}, [i, p, x, R, m]), Z = H(null);
|
|
184
|
+
Ce(ce, () => Z.current, []);
|
|
185
|
+
const ke = Oe(
|
|
182
186
|
() => ({
|
|
183
187
|
getValue: () => i,
|
|
184
|
-
isEmpty: () => !i.trim() &&
|
|
188
|
+
isEmpty: () => !i.trim() && p.length === 0,
|
|
185
189
|
isSubmitting: () => !1,
|
|
186
190
|
setValue: (e) => {
|
|
187
|
-
|
|
191
|
+
m(e);
|
|
188
192
|
},
|
|
189
193
|
clear: () => {
|
|
190
|
-
|
|
194
|
+
m(""), N([]);
|
|
191
195
|
},
|
|
192
196
|
submit: () => {
|
|
193
|
-
|
|
197
|
+
P();
|
|
194
198
|
},
|
|
195
199
|
focus: () => {
|
|
196
200
|
var e;
|
|
197
|
-
(e =
|
|
201
|
+
(e = w.current) == null || e.focus();
|
|
198
202
|
}
|
|
199
203
|
}),
|
|
200
|
-
[i,
|
|
204
|
+
[i, p, m, P]
|
|
201
205
|
);
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
if (
|
|
205
|
-
if (
|
|
206
|
-
e.preventDefault(),
|
|
206
|
+
Re(Ue, ke, j);
|
|
207
|
+
const Ne = (e) => {
|
|
208
|
+
if (B == null || B(e), !e.defaultPrevented && !we(e)) {
|
|
209
|
+
if (f && e.key === "Escape") {
|
|
210
|
+
e.preventDefault(), S(!1);
|
|
207
211
|
return;
|
|
208
212
|
}
|
|
209
|
-
e.key === "Enter" && (e.metaKey || e.ctrlKey) && (e.preventDefault(),
|
|
213
|
+
e.key === "Enter" && (e.metaKey || e.ctrlKey) && (e.preventDefault(), P());
|
|
210
214
|
}
|
|
211
|
-
},
|
|
212
|
-
const t =
|
|
215
|
+
}, Se = (e) => {
|
|
216
|
+
const t = w.current;
|
|
213
217
|
if (!t) return;
|
|
214
|
-
const n = t.selectionStart ?? i.length,
|
|
218
|
+
const n = t.selectionStart ?? i.length, c = i.slice(0, n).lastIndexOf(`
|
|
215
219
|
`) + 1;
|
|
216
220
|
let l = n;
|
|
217
221
|
for (; l < i.length && !/\s/.test(i[l]); )
|
|
218
222
|
l += 1;
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
},
|
|
222
|
-
if (
|
|
223
|
+
const D = i.slice(l), V = i.slice(0, c) + `/${e.id} ` + D;
|
|
224
|
+
m(V), S(!1), M(""), queueMicrotask(() => t.focus());
|
|
225
|
+
}, Me = (e) => {
|
|
226
|
+
if (O == null || O(e), e.defaultPrevented) return;
|
|
223
227
|
const { clipboardData: t } = e;
|
|
224
228
|
if (!t) return;
|
|
225
229
|
const n = [];
|
|
226
230
|
for (let r = 0; r < t.items.length; r += 1) {
|
|
227
|
-
const
|
|
228
|
-
if (
|
|
229
|
-
const l =
|
|
231
|
+
const c = t.items[r];
|
|
232
|
+
if (c.kind === "file") {
|
|
233
|
+
const l = c.getAsFile();
|
|
230
234
|
l && n.push(l);
|
|
231
235
|
}
|
|
232
236
|
}
|
|
233
|
-
n.length > 0 && (e.preventDefault(),
|
|
234
|
-
},
|
|
237
|
+
n.length > 0 && (e.preventDefault(), Q(n));
|
|
238
|
+
}, Q = v(
|
|
235
239
|
(e) => {
|
|
236
240
|
var n;
|
|
237
241
|
const t = [];
|
|
238
242
|
for (const r of e) {
|
|
239
|
-
if (typeof
|
|
240
|
-
|
|
243
|
+
if (typeof h == "number" && r.size > h) {
|
|
244
|
+
I == null || I(
|
|
241
245
|
o("chat.attachment.rejected", { reason: "size" })
|
|
242
246
|
);
|
|
243
247
|
continue;
|
|
@@ -247,41 +251,41 @@ const We = {
|
|
|
247
251
|
file: r
|
|
248
252
|
});
|
|
249
253
|
}
|
|
250
|
-
t.length > 0 && (
|
|
254
|
+
t.length > 0 && (N((r) => [...r, ...t]), y == null || y(t.map((r) => r.file)));
|
|
251
255
|
},
|
|
252
|
-
[
|
|
253
|
-
), { getRootProps:
|
|
254
|
-
onDrop:
|
|
255
|
-
maxSize:
|
|
256
|
-
accept:
|
|
256
|
+
[h, y, I, o]
|
|
257
|
+
), { getRootProps: Pe, getInputProps: ze, isDragActive: Ve } = De({
|
|
258
|
+
onDrop: Q,
|
|
259
|
+
maxSize: h,
|
|
260
|
+
accept: re,
|
|
257
261
|
noClick: !0,
|
|
258
262
|
noKeyboard: !0
|
|
259
|
-
}),
|
|
260
|
-
|
|
261
|
-
},
|
|
262
|
-
return /* @__PURE__ */
|
|
263
|
+
}), He = (e) => {
|
|
264
|
+
N((t) => t.filter((n) => n.id !== e));
|
|
265
|
+
}, z = j ?? pe, q = `${z}-label`, X = `${z}-slash-list`, Ke = (d == null ? void 0 : d.map((e) => ({ value: e.id, label: e.label }))) ?? [];
|
|
266
|
+
return /* @__PURE__ */ u(
|
|
263
267
|
"div",
|
|
264
268
|
{
|
|
265
|
-
ref:
|
|
266
|
-
...
|
|
269
|
+
ref: Z,
|
|
270
|
+
...Pe({
|
|
267
271
|
className: [
|
|
268
|
-
|
|
269
|
-
|
|
272
|
+
We({ size: ie, className: oe }),
|
|
273
|
+
Ve ? "ds:outline ds:outline-dashed ds:outline-[color:var(--primary)] ds:outline-offset-2 ds:bg-[color:var(--primary)]/5" : ""
|
|
270
274
|
].join(" ")
|
|
271
275
|
}),
|
|
272
276
|
"aria-label": o("chat.attachmentZone"),
|
|
273
277
|
"data-component": "ai-prompt-input",
|
|
274
|
-
"data-component-id":
|
|
278
|
+
"data-component-id": j,
|
|
275
279
|
children: [
|
|
276
|
-
/* @__PURE__ */ a("input", { "aria-label": o("chat.attachmentZone"), ...
|
|
277
|
-
|
|
280
|
+
/* @__PURE__ */ a("input", { "aria-label": o("chat.attachmentZone"), ...ze() }),
|
|
281
|
+
T ? /* @__PURE__ */ a("div", { className: "ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-xs)] ds:pt-[var(--spacing-xs)]", children: /* @__PURE__ */ a(
|
|
278
282
|
"button",
|
|
279
283
|
{
|
|
280
284
|
type: "button",
|
|
281
|
-
"aria-label": o("chat.contextActive", { name:
|
|
282
|
-
onClick:
|
|
285
|
+
"aria-label": o("chat.contextActive", { name: T }),
|
|
286
|
+
onClick: b,
|
|
283
287
|
onKeyDown: (e) => {
|
|
284
|
-
(e.key === "Backspace" || e.key === "Delete") && (e.preventDefault(),
|
|
288
|
+
(e.key === "Backspace" || e.key === "Delete") && (e.preventDefault(), b == null || b());
|
|
285
289
|
},
|
|
286
290
|
className: [
|
|
287
291
|
"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]",
|
|
@@ -293,30 +297,29 @@ const We = {
|
|
|
293
297
|
"ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-[color:var(--ring)]",
|
|
294
298
|
"ds:forced-colors:focus-visible:outline-[CanvasText]"
|
|
295
299
|
].join(" "),
|
|
296
|
-
children: o("chat.contextActive", { name:
|
|
300
|
+
children: o("chat.contextActive", { name: T })
|
|
297
301
|
}
|
|
298
302
|
) }) : null,
|
|
299
|
-
/* @__PURE__ */ a("label", { id:
|
|
300
|
-
/* @__PURE__ */
|
|
303
|
+
/* @__PURE__ */ a("label", { id: q, htmlFor: z, className: "ds:sr-only", children: o("chat.prompt") }),
|
|
304
|
+
/* @__PURE__ */ u("div", { className: "ds:relative", children: [
|
|
301
305
|
/* @__PURE__ */ a(
|
|
302
306
|
"textarea",
|
|
303
307
|
{
|
|
304
|
-
ref:
|
|
305
|
-
id:
|
|
306
|
-
rows:
|
|
307
|
-
value:
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
"
|
|
312
|
-
|
|
313
|
-
"aria-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
onCompositionEnd: we,
|
|
308
|
+
ref: me,
|
|
309
|
+
id: z,
|
|
310
|
+
rows: E,
|
|
311
|
+
value: i,
|
|
312
|
+
disabled: U,
|
|
313
|
+
placeholder: de ?? o("chat.input.placeholder"),
|
|
314
|
+
"aria-labelledby": q,
|
|
315
|
+
role: f ? "combobox" : void 0,
|
|
316
|
+
"aria-controls": f ? X : void 0,
|
|
317
|
+
"aria-expanded": f ? !0 : void 0,
|
|
318
|
+
onChange: xe,
|
|
319
|
+
onKeyDown: Ne,
|
|
320
|
+
onPaste: Me,
|
|
321
|
+
onCompositionStart: ye,
|
|
322
|
+
onCompositionEnd: Ie,
|
|
320
323
|
className: [
|
|
321
324
|
"ds:w-full ds:resize-none ds:bg-transparent ds:outline-none",
|
|
322
325
|
"ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)] ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-xs)]",
|
|
@@ -324,13 +327,13 @@ const We = {
|
|
|
324
327
|
"ds:leading-[var(--line-height-base)]",
|
|
325
328
|
"ds:disabled:opacity-50 ds:disabled:cursor-not-allowed"
|
|
326
329
|
].join(" "),
|
|
327
|
-
...
|
|
330
|
+
...le
|
|
328
331
|
}
|
|
329
332
|
),
|
|
330
|
-
|
|
333
|
+
f ? /* @__PURE__ */ a(
|
|
331
334
|
"div",
|
|
332
335
|
{
|
|
333
|
-
ref:
|
|
336
|
+
ref: ue,
|
|
334
337
|
className: [
|
|
335
338
|
"ds:absolute ds:start-[var(--spacing-md)] ds:top-full ds:z-50",
|
|
336
339
|
"ds:mt-[var(--spacing-xs)]",
|
|
@@ -343,23 +346,23 @@ const We = {
|
|
|
343
346
|
"ds:origin-top ds:motion-safe:animate-in ds:motion-safe:fade-in-0 ds:motion-safe:zoom-in-95",
|
|
344
347
|
"ds:duration-[var(--animation-duration)] ds:ease-[var(--ease-out)]"
|
|
345
348
|
].join(" "),
|
|
346
|
-
id:
|
|
347
|
-
children: /* @__PURE__ */
|
|
349
|
+
id: X,
|
|
350
|
+
children: /* @__PURE__ */ u(g, { label: o("chat.slashMenu.label"), loop: !0, children: [
|
|
348
351
|
/* @__PURE__ */ a(
|
|
349
|
-
|
|
352
|
+
g.Input,
|
|
350
353
|
{
|
|
351
|
-
value:
|
|
354
|
+
value: ve,
|
|
352
355
|
onValueChange: M,
|
|
353
356
|
className: "ds:sr-only"
|
|
354
357
|
}
|
|
355
358
|
),
|
|
356
|
-
/* @__PURE__ */
|
|
357
|
-
/* @__PURE__ */ a(
|
|
358
|
-
s.map((e) => /* @__PURE__ */
|
|
359
|
-
|
|
359
|
+
/* @__PURE__ */ u(g.List, { className: "ds:max-h-60 ds:overflow-y-auto ds:pt-[var(--spacing-xs)] ds:pb-[var(--spacing-xs)]", children: [
|
|
360
|
+
/* @__PURE__ */ a(g.Empty, { className: "type-body-sm ds:text-[color:var(--muted-foreground)] ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)] ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-sm)]", children: o("chat.slashMenu.empty") }),
|
|
361
|
+
s.map((e) => /* @__PURE__ */ u(
|
|
362
|
+
g.Item,
|
|
360
363
|
{
|
|
361
364
|
value: e.id,
|
|
362
|
-
onSelect: () =>
|
|
365
|
+
onSelect: () => Se(e),
|
|
363
366
|
className: [
|
|
364
367
|
"ds:flex ds:flex-col ds:gap-[2px]",
|
|
365
368
|
"ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
|
|
@@ -369,7 +372,7 @@ const We = {
|
|
|
369
372
|
"ds:data-[selected=true]:bg-muted/20"
|
|
370
373
|
].join(" "),
|
|
371
374
|
children: [
|
|
372
|
-
/* @__PURE__ */
|
|
375
|
+
/* @__PURE__ */ u("span", { className: "ds:font-medium", children: [
|
|
373
376
|
"/",
|
|
374
377
|
e.id
|
|
375
378
|
] }),
|
|
@@ -383,45 +386,45 @@ const We = {
|
|
|
383
386
|
}
|
|
384
387
|
) : null
|
|
385
388
|
] }),
|
|
386
|
-
|
|
389
|
+
p.length > 0 ? /* @__PURE__ */ a(
|
|
387
390
|
"div",
|
|
388
391
|
{
|
|
389
392
|
role: "group",
|
|
390
393
|
"aria-label": o("chat.attachmentZone"),
|
|
391
394
|
className: "ds:flex ds:flex-wrap ds:gap-[var(--spacing-xs)] ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)]",
|
|
392
|
-
children:
|
|
393
|
-
|
|
395
|
+
children: p.map((e) => /* @__PURE__ */ a(
|
|
396
|
+
qe,
|
|
394
397
|
{
|
|
395
398
|
file: e.file,
|
|
396
|
-
onRemove: () =>
|
|
399
|
+
onRemove: () => He(e.id)
|
|
397
400
|
},
|
|
398
401
|
e.id
|
|
399
402
|
))
|
|
400
403
|
}
|
|
401
404
|
) : null,
|
|
402
|
-
/* @__PURE__ */
|
|
405
|
+
/* @__PURE__ */ u("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:ps-[var(--spacing-xs)] ds:pe-[var(--spacing-xs)] ds:pb-[var(--spacing-xs)]", children: [
|
|
403
406
|
d && d.length > 0 ? /* @__PURE__ */ a("div", { className: "ds:me-auto ds:min-w-[140px]", children: /* @__PURE__ */ a(
|
|
404
|
-
|
|
407
|
+
_e,
|
|
405
408
|
{
|
|
406
409
|
"aria-label": o("chat.model.select"),
|
|
407
|
-
options:
|
|
408
|
-
value:
|
|
410
|
+
options: Ke,
|
|
411
|
+
value: R || "",
|
|
409
412
|
onValueChange: (e) => {
|
|
410
|
-
|
|
413
|
+
he(e);
|
|
411
414
|
},
|
|
412
415
|
size: "sm"
|
|
413
416
|
}
|
|
414
417
|
) }) : /* @__PURE__ */ a("div", { className: "ds:me-auto" }),
|
|
415
418
|
/* @__PURE__ */ a("span", { className: "ds:sr-only", children: o("chat.input.sendHint") }),
|
|
416
419
|
/* @__PURE__ */ a(
|
|
417
|
-
|
|
420
|
+
te,
|
|
418
421
|
{
|
|
419
|
-
icon: /* @__PURE__ */ a(
|
|
422
|
+
icon: /* @__PURE__ */ a(Ae, {}),
|
|
420
423
|
"aria-label": o("chat.send"),
|
|
421
424
|
intent: "primary",
|
|
422
425
|
size: "sm",
|
|
423
|
-
disabled:
|
|
424
|
-
onClick:
|
|
426
|
+
disabled: U || !i.trim() && p.length === 0,
|
|
427
|
+
onClick: P,
|
|
425
428
|
"aria-keyshortcuts": "Meta+Enter Control+Enter"
|
|
426
429
|
}
|
|
427
430
|
)
|
|
@@ -431,16 +434,16 @@ const We = {
|
|
|
431
434
|
);
|
|
432
435
|
}
|
|
433
436
|
);
|
|
434
|
-
|
|
435
|
-
function
|
|
437
|
+
Ze.displayName = "AIPromptInput";
|
|
438
|
+
function Qe(s) {
|
|
436
439
|
return s < 1024 ? `${s} B` : s < 1024 * 1024 ? `${(s / 1024).toFixed(1)} KB` : `${(s / (1024 * 1024)).toFixed(1)} MB`;
|
|
437
440
|
}
|
|
438
|
-
function
|
|
441
|
+
function qe({
|
|
439
442
|
file: s,
|
|
440
443
|
onRemove: d
|
|
441
444
|
}) {
|
|
442
|
-
const { t:
|
|
443
|
-
return /* @__PURE__ */
|
|
445
|
+
const { t: K } = ee();
|
|
446
|
+
return /* @__PURE__ */ u(
|
|
444
447
|
"span",
|
|
445
448
|
{
|
|
446
449
|
className: [
|
|
@@ -455,12 +458,12 @@ function Xe({
|
|
|
455
458
|
].join(" "),
|
|
456
459
|
children: [
|
|
457
460
|
/* @__PURE__ */ a("span", { className: "ds:truncate ds:max-w-[16ch]", children: s.name }),
|
|
458
|
-
/* @__PURE__ */ a("span", { className: "ds:text-[color:var(--muted-foreground)] ds:tabular-nums", children:
|
|
461
|
+
/* @__PURE__ */ a("span", { className: "ds:text-[color:var(--muted-foreground)] ds:tabular-nums", children: Qe(s.size) }),
|
|
459
462
|
/* @__PURE__ */ a(
|
|
460
|
-
|
|
463
|
+
te,
|
|
461
464
|
{
|
|
462
|
-
icon: /* @__PURE__ */ a(
|
|
463
|
-
"aria-label":
|
|
465
|
+
icon: /* @__PURE__ */ a(Le, {}),
|
|
466
|
+
"aria-label": K("chat.attachment.remove", { name: s.name }),
|
|
464
467
|
intent: "ghost",
|
|
465
468
|
size: "sm",
|
|
466
469
|
onClick: d
|
|
@@ -471,7 +474,7 @@ function Xe({
|
|
|
471
474
|
);
|
|
472
475
|
}
|
|
473
476
|
export {
|
|
474
|
-
|
|
475
|
-
|
|
477
|
+
Ze as A,
|
|
478
|
+
Ue as a
|
|
476
479
|
};
|
|
477
|
-
//# sourceMappingURL=ai-prompt-input-
|
|
480
|
+
//# sourceMappingURL=ai-prompt-input-B-w5Rx3V.js.map
|