@alfadocs/ui-kit 0.2.1 → 0.2.2
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/{chat-input-DOlsB1fm.js → chat-input-Bov-gkwP.js} +40 -38
- package/dist/_chunks/{leo-sidebar-CfEY-xi2.js → leo-sidebar-kHO45M6C.js} +2 -2
- package/dist/agent-catalog.json +1 -1
- package/dist/components/chat-input/index.js +1 -1
- package/dist/index.js +2 -2
- package/dist/patterns/leo-assistant/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as u, jsx as
|
|
1
|
+
import { jsxs as u, jsx as r, Fragment as ve } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as ye, useId as be, useRef as b, useCallback as W, useState as xe, useLayoutEffect as Ie, useImperativeHandle as ke, useMemo as Ce } from "react";
|
|
3
3
|
import { c as we } from "./index-D2ZczOXr.js";
|
|
4
4
|
import { useTranslation as Ne } from "react-i18next";
|
|
@@ -44,8 +44,8 @@ const Me = [
|
|
|
44
44
|
argsType: "{ value: string }",
|
|
45
45
|
descriptionKey: "ui.agent.chatInput.actions.setValue",
|
|
46
46
|
description: "Replace the composer text.",
|
|
47
|
-
invoke: (t,
|
|
48
|
-
t.setValue(
|
|
47
|
+
invoke: (t, c) => {
|
|
48
|
+
t.setValue(c.value);
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
clear: {
|
|
@@ -109,10 +109,10 @@ const Me = [
|
|
|
109
109
|
defaultVariants: { size: "md" }
|
|
110
110
|
}
|
|
111
111
|
);
|
|
112
|
-
function Se(t,
|
|
112
|
+
function Se(t, c) {
|
|
113
113
|
if (typeof Intl < "u" && typeof Intl.Segmenter == "function")
|
|
114
114
|
try {
|
|
115
|
-
const p = new Intl.Segmenter(
|
|
115
|
+
const p = new Intl.Segmenter(c, { granularity: "grapheme" });
|
|
116
116
|
let s = 0;
|
|
117
117
|
for (const M of p.segment(t)) s += 1;
|
|
118
118
|
return s;
|
|
@@ -123,7 +123,7 @@ function Se(t, o) {
|
|
|
123
123
|
const je = ye(
|
|
124
124
|
({
|
|
125
125
|
size: t = "md",
|
|
126
|
-
value:
|
|
126
|
+
value: c,
|
|
127
127
|
defaultValue: p,
|
|
128
128
|
maxLength: s,
|
|
129
129
|
submitOnEnter: M = !1,
|
|
@@ -144,35 +144,35 @@ const je = ye(
|
|
|
144
144
|
id: z,
|
|
145
145
|
...J
|
|
146
146
|
}, L) => {
|
|
147
|
-
const { t:
|
|
147
|
+
const { t: i, i18n: O } = Ne(), Q = be(), h = b(!1), K = b(null), H = b(null), X = W((e) => {
|
|
148
148
|
H.current = e;
|
|
149
|
-
}, []), n =
|
|
149
|
+
}, []), n = c !== void 0, [Z, g] = xe(
|
|
150
150
|
String(p ?? "")
|
|
151
|
-
),
|
|
151
|
+
), a = n ? String(c) : Z, V = Se(a, O.language), v = typeof s == "number" && s > 0, D = v ? Math.max(0, s - V) : 0, ee = v && V > s * 0.9, l = v && V >= s, S = W(() => {
|
|
152
152
|
const e = H.current;
|
|
153
153
|
if (!e) return;
|
|
154
|
-
const
|
|
154
|
+
const o = window.getComputedStyle(e), y = parseFloat(o.lineHeight) || 24, ue = parseFloat(o.paddingTop) || 0, pe = parseFloat(o.paddingBottom) || 0, me = parseFloat(o.borderTopWidth) || 0, fe = parseFloat(o.borderBottomWidth) || 0, _ = ue + pe + me + fe, he = y * x + _, $ = y * T + _;
|
|
155
155
|
e.style.height = "auto";
|
|
156
156
|
const ge = Math.max(he, Math.min(e.scrollHeight, $));
|
|
157
157
|
e.style.height = `${ge}px`, e.style.overflowY = e.scrollHeight > $ ? "auto" : "hidden";
|
|
158
158
|
}, [x, T]);
|
|
159
159
|
Ie(() => {
|
|
160
160
|
S();
|
|
161
|
-
}, [S,
|
|
161
|
+
}, [S, a]);
|
|
162
162
|
const te = (e) => {
|
|
163
163
|
n || g(e.target.value), !h.current && (k == null || k(e));
|
|
164
164
|
}, se = (e) => {
|
|
165
165
|
h.current = !0, w == null || w(e);
|
|
166
|
-
},
|
|
166
|
+
}, ae = (e) => {
|
|
167
167
|
h.current = !1, N == null || N(e);
|
|
168
|
-
},
|
|
169
|
-
!
|
|
168
|
+
}, re = (e) => e.nativeEvent.isComposing || e.keyCode === 229 || h.current, E = () => {
|
|
169
|
+
!a.trim() || f || l || (I == null || I(a), n || g(""));
|
|
170
170
|
}, j = b(null);
|
|
171
171
|
ke(L, () => j.current, []);
|
|
172
172
|
const ne = Ce(
|
|
173
173
|
() => ({
|
|
174
|
-
getValue: () =>
|
|
175
|
-
isEmpty: () => !
|
|
174
|
+
getValue: () => a,
|
|
175
|
+
isEmpty: () => !a.trim(),
|
|
176
176
|
setValue: (e) => {
|
|
177
177
|
n || g(e);
|
|
178
178
|
},
|
|
@@ -191,20 +191,20 @@ const je = ye(
|
|
|
191
191
|
// via React's render cycle — depend on currentValue + isControlled so
|
|
192
192
|
// the handle picks up new values across renders.
|
|
193
193
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
194
|
-
[
|
|
194
|
+
[a, n]
|
|
195
195
|
);
|
|
196
196
|
ze(Fe, ne, z);
|
|
197
197
|
const ie = (e) => {
|
|
198
|
-
if (C == null || C(e), !e.defaultPrevented && !
|
|
199
|
-
const
|
|
200
|
-
(
|
|
198
|
+
if (C == null || C(e), !e.defaultPrevented && !re(e) && e.key === "Enter") {
|
|
199
|
+
const o = e.metaKey || e.ctrlKey, y = M && !e.shiftKey;
|
|
200
|
+
(o || y) && (e.preventDefault(), E());
|
|
201
201
|
}
|
|
202
202
|
}, oe = () => {
|
|
203
203
|
var e;
|
|
204
204
|
(e = K.current) == null || e.click();
|
|
205
205
|
}, ce = (e) => {
|
|
206
206
|
e.target.files && e.target.files.length > 0 && (m == null || m(e.target.files)), e.target.value = "";
|
|
207
|
-
}, d = z ?? Q, B = `${d}-label`, R = v ? `${d}-counter` : void 0, P = `${d}-hint`, le = A ??
|
|
207
|
+
}, d = z ?? Q, B = `${d}-label`, R = v ? `${d}-counter` : void 0, P = `${d}-hint`, le = A ?? i("chat.input.placeholder"), de = F ?? i("chat.prompt");
|
|
208
208
|
return /* @__PURE__ */ u(
|
|
209
209
|
"div",
|
|
210
210
|
{
|
|
@@ -213,7 +213,7 @@ const je = ye(
|
|
|
213
213
|
"data-component-id": z,
|
|
214
214
|
className: Ke({ size: t, className: G }),
|
|
215
215
|
children: [
|
|
216
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ r(
|
|
217
217
|
"label",
|
|
218
218
|
{
|
|
219
219
|
id: B,
|
|
@@ -222,12 +222,12 @@ const je = ye(
|
|
|
222
222
|
children: de
|
|
223
223
|
}
|
|
224
224
|
),
|
|
225
|
-
/* @__PURE__ */
|
|
225
|
+
/* @__PURE__ */ r(
|
|
226
226
|
"textarea",
|
|
227
227
|
{
|
|
228
228
|
ref: X,
|
|
229
229
|
id: d,
|
|
230
|
-
value: n ?
|
|
230
|
+
value: n ? a : void 0,
|
|
231
231
|
defaultValue: n ? void 0 : p,
|
|
232
232
|
disabled: f,
|
|
233
233
|
rows: x,
|
|
@@ -239,7 +239,7 @@ const je = ye(
|
|
|
239
239
|
onChange: te,
|
|
240
240
|
onKeyDown: ie,
|
|
241
241
|
onCompositionStart: se,
|
|
242
|
-
onCompositionEnd:
|
|
242
|
+
onCompositionEnd: ae,
|
|
243
243
|
className: [
|
|
244
244
|
"ds:w-full ds:resize-none ds:bg-transparent",
|
|
245
245
|
"ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)] ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-xs)]",
|
|
@@ -260,7 +260,7 @@ const je = ye(
|
|
|
260
260
|
),
|
|
261
261
|
/* @__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: [
|
|
262
262
|
m ? /* @__PURE__ */ u(ve, { children: [
|
|
263
|
-
/* @__PURE__ */
|
|
263
|
+
/* @__PURE__ */ r(
|
|
264
264
|
"input",
|
|
265
265
|
{
|
|
266
266
|
ref: K,
|
|
@@ -268,14 +268,16 @@ const je = ye(
|
|
|
268
268
|
className: "ds:sr-only",
|
|
269
269
|
multiple: !0,
|
|
270
270
|
accept: Y,
|
|
271
|
-
onChange: ce
|
|
271
|
+
onChange: ce,
|
|
272
|
+
"aria-label": i("chat.input.attach"),
|
|
273
|
+
tabIndex: -1
|
|
272
274
|
}
|
|
273
275
|
),
|
|
274
|
-
/* @__PURE__ */
|
|
276
|
+
/* @__PURE__ */ r(
|
|
275
277
|
U,
|
|
276
278
|
{
|
|
277
|
-
icon: /* @__PURE__ */
|
|
278
|
-
"aria-label":
|
|
279
|
+
icon: /* @__PURE__ */ r(Te, {}),
|
|
280
|
+
"aria-label": i("chat.input.attach"),
|
|
279
281
|
intent: "ghost",
|
|
280
282
|
size: "sm",
|
|
281
283
|
onClick: oe,
|
|
@@ -299,21 +301,21 @@ const je = ye(
|
|
|
299
301
|
l ? (
|
|
300
302
|
// Icon pairs with --destructive colour so the at-limit
|
|
301
303
|
// state is not conveyed by hue alone (WCAG 1.4.1).
|
|
302
|
-
/* @__PURE__ */
|
|
304
|
+
/* @__PURE__ */ r(Ve, { "aria-hidden": "true", className: "ds:size-3.5" })
|
|
303
305
|
) : null,
|
|
304
|
-
|
|
306
|
+
i("chat.input.remaining", { count: D })
|
|
305
307
|
]
|
|
306
308
|
}
|
|
307
309
|
) : null,
|
|
308
|
-
/* @__PURE__ */
|
|
309
|
-
/* @__PURE__ */
|
|
310
|
+
/* @__PURE__ */ r("span", { id: P, className: "ds:sr-only", children: i("chat.input.sendHint") }),
|
|
311
|
+
/* @__PURE__ */ r(
|
|
310
312
|
U,
|
|
311
313
|
{
|
|
312
|
-
icon: /* @__PURE__ */
|
|
313
|
-
"aria-label":
|
|
314
|
+
icon: /* @__PURE__ */ r(Ee, {}),
|
|
315
|
+
"aria-label": i("chat.send"),
|
|
314
316
|
intent: "primary",
|
|
315
317
|
size: "sm",
|
|
316
|
-
disabled: f || !
|
|
318
|
+
disabled: f || !a.trim() || l,
|
|
317
319
|
onClick: E,
|
|
318
320
|
"aria-keyshortcuts": "Meta+Enter Control+Enter"
|
|
319
321
|
}
|
|
@@ -330,4 +332,4 @@ export {
|
|
|
330
332
|
je as C,
|
|
331
333
|
Fe as c
|
|
332
334
|
};
|
|
333
|
-
//# sourceMappingURL=chat-input-
|
|
335
|
+
//# sourceMappingURL=chat-input-Bov-gkwP.js.map
|
|
@@ -10,7 +10,7 @@ import { A as L } from "./avatar-Dcr6XuDQ.js";
|
|
|
10
10
|
import { B as D } from "./button-DD_0Xdmr.js";
|
|
11
11
|
import { C as ae } from "./chat-container-ClzsWXp2.js";
|
|
12
12
|
import { C as re } from "./chat-message-DoAhgUTj.js";
|
|
13
|
-
import { C as le } from "./chat-input-
|
|
13
|
+
import { C as le } from "./chat-input-Bov-gkwP.js";
|
|
14
14
|
import { S as ie } from "./streaming-text-BgjCTVOw.js";
|
|
15
15
|
import { a as q, S as O } from "./suggestion-chip-C4Jz0LrM.js";
|
|
16
16
|
import { T as oe } from "./typing-indicator-BZ5jXZPn.js";
|
|
@@ -756,4 +756,4 @@ export {
|
|
|
756
756
|
we as b,
|
|
757
757
|
Ce as c
|
|
758
758
|
};
|
|
759
|
-
//# sourceMappingURL=leo-sidebar-
|
|
759
|
+
//# sourceMappingURL=leo-sidebar-kHO45M6C.js.map
|
package/dist/agent-catalog.json
CHANGED
package/dist/index.js
CHANGED
|
@@ -106,7 +106,7 @@ import { A as pn, a as mn } from "./_chunks/ai-prompt-input-BBiDlEIS.js";
|
|
|
106
106
|
import { A as dn, a as fn } from "./_chunks/audio-recorder-B4U1LuiQ.js";
|
|
107
107
|
import { A as cn } from "./_chunks/audio-visualiser-ByDEFLNm.js";
|
|
108
108
|
import { C as An, c as Sn } from "./_chunks/chat-container-ClzsWXp2.js";
|
|
109
|
-
import { C as Tn, c as Cn } from "./_chunks/chat-input-
|
|
109
|
+
import { C as Tn, c as Cn } from "./_chunks/chat-input-Bov-gkwP.js";
|
|
110
110
|
import { C as Pn } from "./_chunks/chat-message-DoAhgUTj.js";
|
|
111
111
|
import { F as In, f as Rn } from "./_chunks/freemium-paywall-CrVefV0M.js";
|
|
112
112
|
import { S as Ln } from "./_chunks/streaming-text-BgjCTVOw.js";
|
|
@@ -123,7 +123,7 @@ import { S as li, f as di, i as fi } from "./_chunks/slot-grid-CgpYgBkW.js";
|
|
|
123
123
|
import { C as ci, a as xi, b as Ai, F as Si, c as ui, d as Ti, P as Ci, e as bi, T as Pi, f as hi, g as Ii, h as Ri, l as ki, i as Li, t as Ei, r as Ni } from "./_chunks/tooth-scheme-3mITSXiZ.js";
|
|
124
124
|
import { T as Mi } from "./_chunks/transaction-chip-DE6DITun.js";
|
|
125
125
|
import { C as Bi, W as Di, a as Vi, b as vi, c as wi, i as Hi, l as Oi, m as _i, r as Gi, w as Wi, d as Ui, e as Ki, f as Yi } from "./_chunks/workflow-map-C-nlogPC.js";
|
|
126
|
-
import { L as zi, a as qi, b as Qi, c as Ji } from "./_chunks/leo-sidebar-
|
|
126
|
+
import { L as zi, a as qi, b as Qi, c as Ji } from "./_chunks/leo-sidebar-kHO45M6C.js";
|
|
127
127
|
import { P as Zi } from "./_chunks/patient-shell-BlsEUKWB.js";
|
|
128
128
|
import { Root as ap } from "@radix-ui/react-aspect-ratio";
|
|
129
129
|
export {
|