@vjdesigns/vjdesigns-ui 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +781 -724
- package/dist/ai/llms-full.txt +550 -479
- package/dist/ai/llms.txt +1 -0
- package/dist/ai/registry.json +215 -6
- package/dist/components/data-display/Chat/Chat.cjs.js +1 -0
- package/dist/components/data-display/Chat/Chat.d.ts +114 -0
- package/dist/components/data-display/Chat/Chat.mjs +301 -0
- package/dist/components/data-display/Chat/Chat.module.css.cjs.js +1 -0
- package/dist/components/data-display/Chat/Chat.module.css.mjs +32 -0
- package/dist/components/data-display/Chat/index.d.ts +2 -0
- package/dist/components/data-display/Chat/streams.cjs.js +4 -0
- package/dist/components/data-display/Chat/streams.d.ts +32 -0
- package/dist/components/data-display/Chat/streams.mjs +35 -0
- package/dist/components/forms/Combobox/Combobox.cjs.js +1 -1
- package/dist/components/forms/Combobox/Combobox.mjs +5 -5
- package/dist/components/forms/TagInput/TagInput.cjs.js +1 -1
- package/dist/components/forms/TagInput/TagInput.mjs +5 -5
- package/dist/i18n/en.cjs.js +1 -1
- package/dist/i18n/en.mjs +21 -0
- package/dist/i18n/types.d.ts +35 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +85 -83
- package/dist/locales/ar.cjs.js +1 -1
- package/dist/locales/ar.mjs +21 -0
- package/dist/locales/bn.cjs.js +1 -1
- package/dist/locales/bn.mjs +21 -0
- package/dist/locales/cs.cjs.js +1 -1
- package/dist/locales/cs.mjs +21 -0
- package/dist/locales/da.cjs.js +1 -1
- package/dist/locales/da.mjs +21 -0
- package/dist/locales/de.cjs.js +1 -1
- package/dist/locales/de.mjs +21 -0
- package/dist/locales/el.cjs.js +1 -1
- package/dist/locales/el.mjs +21 -0
- package/dist/locales/es.cjs.js +1 -1
- package/dist/locales/es.mjs +21 -0
- package/dist/locales/fa.cjs.js +1 -1
- package/dist/locales/fa.mjs +21 -0
- package/dist/locales/fi.cjs.js +1 -1
- package/dist/locales/fi.mjs +21 -0
- package/dist/locales/fr.cjs.js +1 -1
- package/dist/locales/fr.mjs +21 -0
- package/dist/locales/he.cjs.js +1 -1
- package/dist/locales/he.mjs +21 -0
- package/dist/locales/hi.cjs.js +1 -1
- package/dist/locales/hi.mjs +21 -0
- package/dist/locales/hu.cjs.js +1 -1
- package/dist/locales/hu.mjs +21 -0
- package/dist/locales/id.cjs.js +1 -1
- package/dist/locales/id.mjs +21 -0
- package/dist/locales/it.cjs.js +1 -1
- package/dist/locales/it.mjs +21 -0
- package/dist/locales/ja.cjs.js +1 -1
- package/dist/locales/ja.mjs +21 -0
- package/dist/locales/ko.cjs.js +1 -1
- package/dist/locales/ko.mjs +21 -0
- package/dist/locales/nb.cjs.js +1 -1
- package/dist/locales/nb.mjs +21 -0
- package/dist/locales/nl.cjs.js +1 -1
- package/dist/locales/nl.mjs +21 -0
- package/dist/locales/pl.cjs.js +1 -1
- package/dist/locales/pl.mjs +21 -0
- package/dist/locales/pt-BR.cjs.js +1 -1
- package/dist/locales/pt-BR.mjs +21 -0
- package/dist/locales/ro.cjs.js +1 -1
- package/dist/locales/ro.mjs +21 -0
- package/dist/locales/ru.cjs.js +1 -1
- package/dist/locales/ru.mjs +21 -0
- package/dist/locales/sv.cjs.js +1 -1
- package/dist/locales/sv.mjs +21 -0
- package/dist/locales/th.cjs.js +1 -1
- package/dist/locales/th.mjs +21 -0
- package/dist/locales/tr.cjs.js +1 -1
- package/dist/locales/tr.mjs +21 -0
- package/dist/locales/uk.cjs.js +1 -1
- package/dist/locales/uk.mjs +21 -0
- package/dist/locales/ur.cjs.js +1 -1
- package/dist/locales/ur.mjs +21 -0
- package/dist/locales/vi.cjs.js +1 -1
- package/dist/locales/vi.mjs +21 -0
- package/dist/locales/zh-Hans.cjs.js +1 -1
- package/dist/locales/zh-Hans.mjs +21 -0
- package/dist/locales/zh-Hant.cjs.js +1 -1
- package/dist/locales/zh-Hant.mjs +21 -0
- package/dist/vjdesigns-ui.css +1 -1
- package/package.json +90 -88
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { useControllableState as e } from "../../../hooks/useControllableState.mjs";
|
|
2
|
+
import { useMessages as t } from "../../utilities/LocaleProvider/LocaleProvider.mjs";
|
|
3
|
+
import { useClipboard as n } from "../../../hooks/useClipboard.mjs";
|
|
4
|
+
import { useReducedMotion as r } from "../../../hooks/useEnvironment.mjs";
|
|
5
|
+
import { cx as i } from "../../../utils/cx.mjs";
|
|
6
|
+
import { announce as a } from "../../../utils/announce.mjs";
|
|
7
|
+
import { VisuallyHidden as o } from "../../utilities/VisuallyHidden/VisuallyHidden.mjs";
|
|
8
|
+
import { Button as s, IconButton as c } from "../../primitives/Button/Button.mjs";
|
|
9
|
+
import { Icon as l } from "../../primitives/Icon/Icon.mjs";
|
|
10
|
+
import { ScrollArea as u } from "../../layout/ScrollArea/ScrollArea.mjs";
|
|
11
|
+
import { Textarea as ee } from "../../forms/Textarea/Textarea.mjs";
|
|
12
|
+
import d from "./Chat.module.css.mjs";
|
|
13
|
+
import { useCallback as f, useEffect as p, useId as te, useLayoutEffect as ne, useRef as m, useState as h } from "react";
|
|
14
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
15
|
+
//#region src/components/data-display/Chat/Chat.tsx
|
|
16
|
+
var re = 48, ie = typeof window < "u" ? ne : p;
|
|
17
|
+
function ae(e) {
|
|
18
|
+
return e != null && typeof e[Symbol.asyncIterator] == "function";
|
|
19
|
+
}
|
|
20
|
+
var oe = () => /* @__PURE__ */ g(l, { children: /* @__PURE__ */ g("rect", {
|
|
21
|
+
x: "7",
|
|
22
|
+
y: "7",
|
|
23
|
+
width: "10",
|
|
24
|
+
height: "10",
|
|
25
|
+
rx: "2",
|
|
26
|
+
fill: "currentColor",
|
|
27
|
+
stroke: "none"
|
|
28
|
+
}) }), v = ({ messages: ne, defaultMessages: v, onMessagesChange: se, onSend: y, onStop: ce, onError: b, draft: le, defaultDraft: ue, onDraftChange: de, suggestions: x, emptyState: fe, renderContent: S, assistantName: pe, assistantAvatar: me, userAvatar: he, copyable: C = !0, disclaimer: w, placeholder: ge, maxLength: T, disabled: E = !1, labels: _e, className: ve, "aria-label": ye, ...D }) => {
|
|
29
|
+
let O = {
|
|
30
|
+
...t().chat,
|
|
31
|
+
..._e
|
|
32
|
+
}, k = pe ?? O.assistant, be = r(), A = te(), j = `${A}-hint`, [M, N] = e({
|
|
33
|
+
value: ne,
|
|
34
|
+
defaultValue: v ?? [],
|
|
35
|
+
onChange: se
|
|
36
|
+
}), P = m(M), F = m(M);
|
|
37
|
+
M !== F.current && (F.current = M, P.current = M);
|
|
38
|
+
let I = f((e) => {
|
|
39
|
+
let t = e(P.current);
|
|
40
|
+
P.current = t, N(t);
|
|
41
|
+
}, [N]), L = f((e, t) => I((n) => n.map((n) => n.id === e ? {
|
|
42
|
+
...n,
|
|
43
|
+
...t
|
|
44
|
+
} : n)), [I]), xe = m(0), R = () => `${A}-${++xe.current}`, [z, B] = e({
|
|
45
|
+
value: le,
|
|
46
|
+
defaultValue: ue ?? "",
|
|
47
|
+
onChange: de
|
|
48
|
+
}), [V, H] = h(!1), U = m(null), W = m(null), G = m(y);
|
|
49
|
+
G.current = y;
|
|
50
|
+
let K = m(b);
|
|
51
|
+
K.current = b, p(() => () => U.current?.abort(), []);
|
|
52
|
+
let q = m(null), J = m(!0), [Se, Y] = h(!0), Ce = () => {
|
|
53
|
+
let e = q.current;
|
|
54
|
+
if (!e) return;
|
|
55
|
+
let t = e.scrollHeight - e.scrollTop - e.clientHeight <= re;
|
|
56
|
+
J.current = t, Y(t);
|
|
57
|
+
};
|
|
58
|
+
ie(() => {
|
|
59
|
+
let e = q.current;
|
|
60
|
+
e && J.current && (e.scrollTop = e.scrollHeight);
|
|
61
|
+
}, [M]);
|
|
62
|
+
let we = () => {
|
|
63
|
+
let e = q.current;
|
|
64
|
+
e && (J.current = !0, Y(!0), e.scrollTo({
|
|
65
|
+
top: e.scrollHeight,
|
|
66
|
+
behavior: be ? "auto" : "smooth"
|
|
67
|
+
}), W.current?.focus());
|
|
68
|
+
}, X = async (e, t) => {
|
|
69
|
+
let n = R();
|
|
70
|
+
I(() => [...e, {
|
|
71
|
+
id: n,
|
|
72
|
+
role: "assistant",
|
|
73
|
+
content: "",
|
|
74
|
+
status: "streaming"
|
|
75
|
+
}]), J.current = !0, Y(!0), H(!0), a(O.typing(k));
|
|
76
|
+
let r = new AbortController();
|
|
77
|
+
U.current = r;
|
|
78
|
+
let i = "";
|
|
79
|
+
try {
|
|
80
|
+
let o = await G.current?.(t, {
|
|
81
|
+
messages: e,
|
|
82
|
+
signal: r.signal
|
|
83
|
+
});
|
|
84
|
+
if (typeof o == "string") i = o;
|
|
85
|
+
else if (ae(o)) for await (let e of o) {
|
|
86
|
+
if (r.signal.aborted) break;
|
|
87
|
+
i += e, L(n, { content: i });
|
|
88
|
+
}
|
|
89
|
+
else if (!r.signal.aborted) {
|
|
90
|
+
I((e) => e.filter((e) => e.id !== n));
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (r.signal.aborted) throw r.signal.reason;
|
|
94
|
+
L(n, {
|
|
95
|
+
content: i,
|
|
96
|
+
status: "done"
|
|
97
|
+
}), a(`${O.assistantSaid(k)} ${i}`);
|
|
98
|
+
} catch (e) {
|
|
99
|
+
r.signal.aborted ? (L(n, {
|
|
100
|
+
content: i,
|
|
101
|
+
status: "stopped"
|
|
102
|
+
}), a(O.stopped)) : (K.current?.(e), L(n, {
|
|
103
|
+
content: i,
|
|
104
|
+
status: "error"
|
|
105
|
+
}), a(O.error));
|
|
106
|
+
} finally {
|
|
107
|
+
U.current === r && (U.current = null), H(!1);
|
|
108
|
+
}
|
|
109
|
+
}, Z = (e) => {
|
|
110
|
+
let t = e.trim();
|
|
111
|
+
!t || V || E || (B(""), X([...P.current, {
|
|
112
|
+
id: R(),
|
|
113
|
+
role: "user",
|
|
114
|
+
content: t,
|
|
115
|
+
status: "done"
|
|
116
|
+
}], t));
|
|
117
|
+
}, Q = () => {
|
|
118
|
+
U.current && (U.current.abort(), ce?.(), W.current?.focus());
|
|
119
|
+
}, Te = (e) => {
|
|
120
|
+
let t = P.current, n = t.findIndex((t) => t.id === e) - 1;
|
|
121
|
+
for (; n >= 0 && t[n].role !== "user";) n--;
|
|
122
|
+
n < 0 || V || (X(t.slice(0, n + 1), t[n].content), W.current?.focus());
|
|
123
|
+
}, Ee = (e) => {
|
|
124
|
+
e.preventDefault(), V ? Q() : Z(z);
|
|
125
|
+
}, De = (e) => {
|
|
126
|
+
if (e.key === "Escape" && V) {
|
|
127
|
+
e.preventDefault(), Q();
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing && (e.preventDefault(), Z(e.currentTarget.value));
|
|
131
|
+
}, { copy: Oe } = n(), [$, ke] = h(null);
|
|
132
|
+
p(() => {
|
|
133
|
+
if ($ === null) return;
|
|
134
|
+
let e = window.setTimeout(() => ke(null), 2e3);
|
|
135
|
+
return () => window.clearTimeout(e);
|
|
136
|
+
}, [$]);
|
|
137
|
+
let Ae = async (e) => {
|
|
138
|
+
await Oe(e.content) && (ke(e.id), a(O.copied));
|
|
139
|
+
}, je = M.filter((e) => e.role !== "system").length === 0, Me = M[M.length - 1], Ne = (e) => {
|
|
140
|
+
if (e.role === "system") return /* @__PURE__ */ g("p", {
|
|
141
|
+
className: d.system,
|
|
142
|
+
children: e.content
|
|
143
|
+
}, e.id);
|
|
144
|
+
let t = e.role === "user", n = e.status ?? "done", r = n === "streaming" && e.content === "", a = t ? he : me, u = !t && !V && e === Me && (n === "error" || n === "stopped");
|
|
145
|
+
return /* @__PURE__ */ _("article", {
|
|
146
|
+
className: i(d.message, t ? d.user : d.assistant),
|
|
147
|
+
"data-role": e.role,
|
|
148
|
+
"data-status": n,
|
|
149
|
+
"aria-busy": n === "streaming" || void 0,
|
|
150
|
+
children: [a != null && /* @__PURE__ */ g("div", {
|
|
151
|
+
className: d.avatar,
|
|
152
|
+
"aria-hidden": "true",
|
|
153
|
+
children: a
|
|
154
|
+
}), /* @__PURE__ */ _("div", {
|
|
155
|
+
className: d.body,
|
|
156
|
+
children: [
|
|
157
|
+
r ? /* @__PURE__ */ _("div", {
|
|
158
|
+
className: d.bubble,
|
|
159
|
+
children: [/* @__PURE__ */ _("span", {
|
|
160
|
+
className: d.dots,
|
|
161
|
+
"aria-hidden": "true",
|
|
162
|
+
children: [
|
|
163
|
+
/* @__PURE__ */ g("span", {}),
|
|
164
|
+
/* @__PURE__ */ g("span", {}),
|
|
165
|
+
/* @__PURE__ */ g("span", {})
|
|
166
|
+
]
|
|
167
|
+
}), /* @__PURE__ */ g(o, { children: O.typing(k) })]
|
|
168
|
+
}) : e.content !== "" && /* @__PURE__ */ _("div", {
|
|
169
|
+
className: d.bubble,
|
|
170
|
+
children: [/* @__PURE__ */ _(o, { children: [t ? O.youSaid : O.assistantSaid(k), " "] }), S ? S(e) : /* @__PURE__ */ g("p", {
|
|
171
|
+
className: d.text,
|
|
172
|
+
children: e.content
|
|
173
|
+
})]
|
|
174
|
+
}),
|
|
175
|
+
n === "error" && /* @__PURE__ */ _("p", {
|
|
176
|
+
className: d.error,
|
|
177
|
+
children: [/* @__PURE__ */ g(l, {
|
|
178
|
+
name: "error",
|
|
179
|
+
size: "sm"
|
|
180
|
+
}), /* @__PURE__ */ g("span", { children: e.error ?? O.error })]
|
|
181
|
+
}),
|
|
182
|
+
n === "stopped" && /* @__PURE__ */ g("p", {
|
|
183
|
+
className: d.note,
|
|
184
|
+
children: O.stopped
|
|
185
|
+
}),
|
|
186
|
+
!t && (u || C && n === "done" && e.content !== "") && /* @__PURE__ */ _("div", {
|
|
187
|
+
className: d.actions,
|
|
188
|
+
children: [C && n === "done" && e.content !== "" && /* @__PURE__ */ g(c, {
|
|
189
|
+
variant: "ghost",
|
|
190
|
+
tone: "neutral",
|
|
191
|
+
size: "sm",
|
|
192
|
+
"aria-label": $ === e.id ? O.copied : O.copy,
|
|
193
|
+
onClick: () => void Ae(e),
|
|
194
|
+
children: /* @__PURE__ */ g(l, { name: $ === e.id ? "check" : "copy" })
|
|
195
|
+
}), u && /* @__PURE__ */ g(s, {
|
|
196
|
+
variant: "ghost",
|
|
197
|
+
tone: "neutral",
|
|
198
|
+
size: "sm",
|
|
199
|
+
startIcon: /* @__PURE__ */ g(l, { name: "refresh" }),
|
|
200
|
+
onClick: () => Te(e.id),
|
|
201
|
+
children: O.retry
|
|
202
|
+
})]
|
|
203
|
+
})
|
|
204
|
+
]
|
|
205
|
+
})]
|
|
206
|
+
}, e.id);
|
|
207
|
+
};
|
|
208
|
+
return /* @__PURE__ */ _("section", {
|
|
209
|
+
...D,
|
|
210
|
+
"aria-label": ye ?? (D["aria-labelledby"] ? void 0 : O.region),
|
|
211
|
+
className: i(d.root, ve),
|
|
212
|
+
children: [/* @__PURE__ */ _("div", {
|
|
213
|
+
className: d.logWrap,
|
|
214
|
+
children: [/* @__PURE__ */ g(u, {
|
|
215
|
+
className: d.log,
|
|
216
|
+
viewportRef: q,
|
|
217
|
+
onViewportScroll: Ce,
|
|
218
|
+
"aria-label": O.log,
|
|
219
|
+
"aria-busy": V || void 0,
|
|
220
|
+
tabIndex: 0,
|
|
221
|
+
children: /* @__PURE__ */ _("div", {
|
|
222
|
+
className: d.messages,
|
|
223
|
+
children: [je && /* @__PURE__ */ _("div", {
|
|
224
|
+
className: d.empty,
|
|
225
|
+
children: [fe ?? /* @__PURE__ */ g("p", {
|
|
226
|
+
className: d.emptyTitle,
|
|
227
|
+
children: O.emptyTitle
|
|
228
|
+
}), x && x.length > 0 && /* @__PURE__ */ g("div", {
|
|
229
|
+
role: "group",
|
|
230
|
+
"aria-label": O.suggestions,
|
|
231
|
+
className: d.suggestions,
|
|
232
|
+
children: x.map((e) => /* @__PURE__ */ g(s, {
|
|
233
|
+
variant: "outline",
|
|
234
|
+
tone: "neutral",
|
|
235
|
+
size: "sm",
|
|
236
|
+
disabled: E,
|
|
237
|
+
className: d.suggestion,
|
|
238
|
+
onClick: () => Z(e),
|
|
239
|
+
children: e
|
|
240
|
+
}, e))
|
|
241
|
+
})]
|
|
242
|
+
}), M.map(Ne)]
|
|
243
|
+
})
|
|
244
|
+
}), !Se && !je && /* @__PURE__ */ g(c, {
|
|
245
|
+
variant: "soft",
|
|
246
|
+
tone: "neutral",
|
|
247
|
+
size: "sm",
|
|
248
|
+
className: d.jump,
|
|
249
|
+
"aria-label": O.scrollToLatest,
|
|
250
|
+
onClick: we,
|
|
251
|
+
children: /* @__PURE__ */ g(l, { name: "arrow-down" })
|
|
252
|
+
})]
|
|
253
|
+
}), /* @__PURE__ */ _("form", {
|
|
254
|
+
className: d.composer,
|
|
255
|
+
onSubmit: Ee,
|
|
256
|
+
children: [
|
|
257
|
+
/* @__PURE__ */ _("div", {
|
|
258
|
+
className: d.inputRow,
|
|
259
|
+
children: [/* @__PURE__ */ g(ee, {
|
|
260
|
+
ref: W,
|
|
261
|
+
className: d.input,
|
|
262
|
+
"aria-label": O.input,
|
|
263
|
+
"aria-describedby": j,
|
|
264
|
+
placeholder: ge ?? O.placeholder,
|
|
265
|
+
value: z,
|
|
266
|
+
onValueChange: B,
|
|
267
|
+
onKeyDown: De,
|
|
268
|
+
autoResize: !0,
|
|
269
|
+
rows: 1,
|
|
270
|
+
maxRows: 6,
|
|
271
|
+
maxLength: T,
|
|
272
|
+
showCount: T !== void 0,
|
|
273
|
+
disabled: E,
|
|
274
|
+
enterKeyHint: "send"
|
|
275
|
+
}), V ? /* @__PURE__ */ g(c, {
|
|
276
|
+
type: "submit",
|
|
277
|
+
variant: "soft",
|
|
278
|
+
tone: "neutral",
|
|
279
|
+
"aria-label": O.stop,
|
|
280
|
+
children: /* @__PURE__ */ g(oe, {})
|
|
281
|
+
}) : /* @__PURE__ */ g(c, {
|
|
282
|
+
type: "submit",
|
|
283
|
+
"aria-label": O.send,
|
|
284
|
+
disabled: E || z.trim() === "",
|
|
285
|
+
children: /* @__PURE__ */ g(l, { name: "arrow-up" })
|
|
286
|
+
})]
|
|
287
|
+
}),
|
|
288
|
+
/* @__PURE__ */ g(o, {
|
|
289
|
+
id: j,
|
|
290
|
+
children: O.hint
|
|
291
|
+
}),
|
|
292
|
+
w != null && /* @__PURE__ */ g("p", {
|
|
293
|
+
className: d.disclaimer,
|
|
294
|
+
children: w
|
|
295
|
+
})
|
|
296
|
+
]
|
|
297
|
+
})]
|
|
298
|
+
});
|
|
299
|
+
};
|
|
300
|
+
//#endregion
|
|
301
|
+
export { v as Chat };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`_root_1vnqg_8`,t=`_logWrap_1vnqg_18`,n=`_log_1vnqg_18`,r=`_messages_1vnqg_30`,i=`_empty_1vnqg_39`,a=`_emptyTitle_1vnqg_48`,o=`_suggestions_1vnqg_56`,s=`_suggestion_1vnqg_56`,c=`_message_1vnqg_30`,l=`_enter_1vnqg_1`,u=`_user_1vnqg_80`,d=`_assistant_1vnqg_85`,f=`_avatar_1vnqg_89`,p=`_body_1vnqg_94`,m=`_bubble_1vnqg_105`,h=`_text_1vnqg_128`,g=`_dots_1vnqg_134`,_=`_bounce_1vnqg_1`,v=`_error_1vnqg_185`,y=`_note_1vnqg_194`,b=`_actions_1vnqg_201`,x=`_system_1vnqg_207`,S=`_jump_1vnqg_217`,C=`_composer_1vnqg_230`,w=`_inputRow_1vnqg_238`,T=`_input_1vnqg_238`,E=`_disclaimer_1vnqg_248`,D={root:e,logWrap:t,log:n,messages:r,empty:i,emptyTitle:a,suggestions:o,suggestion:s,message:c,enter:l,user:u,assistant:d,avatar:f,body:p,bubble:m,text:h,dots:g,bounce:_,error:v,note:y,actions:b,system:x,jump:S,composer:C,inputRow:w,input:T,disclaimer:E};exports.actions=b,exports.assistant=d,exports.avatar=f,exports.body=p,exports.bounce=_,exports.bubble=m,exports.composer=C,exports.default=D,exports.disclaimer=E,exports.dots=g,exports.empty=i,exports.emptyTitle=a,exports.enter=l,exports.error=v,exports.input=T,exports.inputRow=w,exports.jump=S,exports.log=n,exports.logWrap=t,exports.message=c,exports.messages=r,exports.note=y,exports.root=e,exports.suggestion=s,exports.suggestions=o,exports.system=x,exports.text=h,exports.user=u;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/components/data-display/Chat/Chat.module.css
|
|
2
|
+
var e = "_root_1vnqg_8", t = "_logWrap_1vnqg_18", n = "_log_1vnqg_18", r = "_messages_1vnqg_30", i = "_empty_1vnqg_39", a = "_emptyTitle_1vnqg_48", o = "_suggestions_1vnqg_56", s = "_suggestion_1vnqg_56", c = "_message_1vnqg_30", l = "_enter_1vnqg_1", u = "_user_1vnqg_80", d = "_assistant_1vnqg_85", f = "_avatar_1vnqg_89", p = "_body_1vnqg_94", m = "_bubble_1vnqg_105", h = "_text_1vnqg_128", g = "_dots_1vnqg_134", _ = "_bounce_1vnqg_1", v = "_error_1vnqg_185", y = "_note_1vnqg_194", b = "_actions_1vnqg_201", x = "_system_1vnqg_207", S = "_jump_1vnqg_217", C = "_composer_1vnqg_230", w = "_inputRow_1vnqg_238", T = "_input_1vnqg_238", E = "_disclaimer_1vnqg_248", D = {
|
|
3
|
+
root: e,
|
|
4
|
+
logWrap: t,
|
|
5
|
+
log: n,
|
|
6
|
+
messages: r,
|
|
7
|
+
empty: i,
|
|
8
|
+
emptyTitle: a,
|
|
9
|
+
suggestions: o,
|
|
10
|
+
suggestion: s,
|
|
11
|
+
message: c,
|
|
12
|
+
enter: l,
|
|
13
|
+
user: u,
|
|
14
|
+
assistant: d,
|
|
15
|
+
avatar: f,
|
|
16
|
+
body: p,
|
|
17
|
+
bubble: m,
|
|
18
|
+
text: h,
|
|
19
|
+
dots: g,
|
|
20
|
+
bounce: _,
|
|
21
|
+
error: v,
|
|
22
|
+
note: y,
|
|
23
|
+
actions: b,
|
|
24
|
+
system: x,
|
|
25
|
+
jump: S,
|
|
26
|
+
composer: C,
|
|
27
|
+
inputRow: w,
|
|
28
|
+
input: T,
|
|
29
|
+
disclaimer: E
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { b as actions, d as assistant, f as avatar, p as body, _ as bounce, m as bubble, C as composer, D as default, E as disclaimer, g as dots, i as empty, a as emptyTitle, l as enter, v as error, T as input, w as inputRow, S as jump, n as log, t as logWrap, c as message, r as messages, y as note, e as root, s as suggestion, o as suggestions, x as system, h as text, u as user };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
function e(e){let t=e instanceof Response?e.body:e;if(!t)throw Error(`readTextStream: the response has no body to read.`);return t}async function*t(t){let n=e(t).getReader(),r=new TextDecoder;try{for(;;){let{done:e,value:t}=await n.read();if(e)break;let i=r.decode(t,{stream:!0});i&&(yield i)}let e=r.decode();e&&(yield e)}finally{n.releaseLock()}}async function*n(e){let n=``,r=function*(e){let t=n.split(/\r?\n\r?\n/);n=e?``:t.pop()??``;for(let e of t){let t=e.split(/\r?\n/).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).replace(/^ /,``));t.length>0&&(yield t.join(`
|
|
2
|
+
`))}};for await(let i of t(e))n+=i,yield*r(!1);n+=`
|
|
3
|
+
|
|
4
|
+
`,yield*r(!0)}exports.readEventStream=n,exports.readTextStream=t;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for turning a streaming HTTP response into the `AsyncIterable<string>`
|
|
3
|
+
* that `Chat`'s `onSend` can return. They read with `getReader()`, so they
|
|
4
|
+
* work in browsers without async iteration of `ReadableStream`.
|
|
5
|
+
*/
|
|
6
|
+
type ByteSource = Response | ReadableStream<Uint8Array> | null | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Yields decoded text chunks from a plain streaming response (a body that is
|
|
9
|
+
* just the reply text, sent in pieces).
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* onSend={async function* (text, { signal }) {
|
|
13
|
+
* const res = await fetch("/api/chat", { method: "POST", body: text, signal });
|
|
14
|
+
* yield* readTextStream(res);
|
|
15
|
+
* }}
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function readTextStream(source: ByteSource): AsyncGenerator<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Yields the `data` of each server-sent event (`text/event-stream`), the
|
|
21
|
+
* format most LLM APIs stream in. Multi-line data is joined with `\n`. Parse
|
|
22
|
+
* each payload yourself, since every API shapes it differently.
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* for await (const data of readEventStream(res)) {
|
|
26
|
+
* if (data === "[DONE]") break;
|
|
27
|
+
* yield JSON.parse(data).delta ?? "";
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function readEventStream(source: ByteSource): AsyncGenerator<string>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region src/components/data-display/Chat/streams.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
let t = e instanceof Response ? e.body : e;
|
|
4
|
+
if (!t) throw Error("readTextStream: the response has no body to read.");
|
|
5
|
+
return t;
|
|
6
|
+
}
|
|
7
|
+
async function* t(t) {
|
|
8
|
+
let n = e(t).getReader(), r = new TextDecoder();
|
|
9
|
+
try {
|
|
10
|
+
for (;;) {
|
|
11
|
+
let { done: e, value: t } = await n.read();
|
|
12
|
+
if (e) break;
|
|
13
|
+
let i = r.decode(t, { stream: !0 });
|
|
14
|
+
i && (yield i);
|
|
15
|
+
}
|
|
16
|
+
let e = r.decode();
|
|
17
|
+
e && (yield e);
|
|
18
|
+
} finally {
|
|
19
|
+
n.releaseLock();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
async function* n(e) {
|
|
23
|
+
let n = "", r = function* (e) {
|
|
24
|
+
let t = n.split(/\r?\n\r?\n/);
|
|
25
|
+
n = e ? "" : t.pop() ?? "";
|
|
26
|
+
for (let e of t) {
|
|
27
|
+
let t = e.split(/\r?\n/).filter((e) => e.startsWith("data:")).map((e) => e.slice(5).replace(/^ /, ""));
|
|
28
|
+
t.length > 0 && (yield t.join("\n"));
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
for await (let i of t(e)) n += i, yield* r(!1);
|
|
32
|
+
n += "\n\n", yield* r(!0);
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { n as readEventStream, t as readTextStream };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../../hooks/useOverlayLayer.cjs.js"),n=require("../../utilities/LocaleProvider/LocaleProvider.cjs.js"),r=require("../../../utils/refs.cjs.js"),i=require("../../../utils/cx.cjs.js"),ee=require("../../utilities/VisuallyHidden/VisuallyHidden.cjs.js"),te=require("../../primitives/Icon/icons.cjs.js"),ne=require("
|
|
1
|
+
const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../../hooks/useOverlayLayer.cjs.js"),n=require("../../utilities/LocaleProvider/LocaleProvider.cjs.js"),r=require("../../../utils/refs.cjs.js"),i=require("../../../utils/cx.cjs.js"),ee=require("../../utilities/VisuallyHidden/VisuallyHidden.cjs.js"),te=require("../../primitives/Icon/icons.cjs.js"),ne=require("../Field/FieldContext.cjs.js"),re=require("../../data-display/Chip/Chip.cjs.js"),a=require("./comboboxUtils.cjs.js"),o=require("./Combobox.module.css.cjs.js"),ie=require("./ComboboxPopup.cjs.js");let s=require("react"),c=require("react/jsx-runtime"),ae=require("react-dom");var oe={sm:o.default.sm,md:o.default.md,lg:o.default.lg},se={sm:`sm`,md:`sm`,lg:`md`};function l(e){return typeof e==`string`||typeof e==`number`?String(e):``}var ce=500,le=le=>{let u=n.useMessages().combobox,{options:d,renderOption:ue,multiple:f=!1,value:de,defaultValue:fe,onValueChange:pe,inputValue:me,defaultInputValue:he,onInputValueChange:ge,open:_e,defaultOpen:ve=!1,onOpenChange:ye,filter:be,loading:p=!1,loadingMessage:xe=u.loading,emptyMessage:m=u.empty,resultsMessage:Se=u.results,allowCustomValue:h=!1,onCreate:Ce,createLabel:we=u.create,clearable:Te=!1,clearLabel:Ee=u.clear,requiredMessage:De=u.required,clearOnEscape:Oe=!1,showSuggestionsLabel:ke=u.showSuggestions,hideSuggestionsLabel:Ae=u.hideSuggestions,selectedLabel:je=u.selected,autoHighlight:Me=!1,loop:Ne=!0,size:Pe,invalid:Fe,required:Ie,disabled:Le,readOnly:Re,name:g,placement:ze=`bottom-start`,maxHeight:Be,fullWidth:Ve=!0,container:He,inputClassName:Ue,className:We,style:Ge,id:Ke,ref:qe,placeholder:Je,onChange:Ye,onKeyDown:Xe,onBlur:Ze,"aria-describedby":Qe,"aria-label":_,"aria-labelledby":$e,...et}=le,v=ne.useFieldContext(),y=ne.useFieldControl({id:Ke,invalid:Fe,required:Ie,disabled:Le,readOnly:Re,size:Pe,"aria-describedby":Qe},{nativeRequired:!1}),b=y.size??`md`,x=!y.disabled&&!y.readOnly,tt=(0,s.useId)(),nt=y.id??`${tt}-input`,S=`${tt}-listbox`,C=(0,s.useRef)(null),w=(0,s.useRef)(null),T=(0,s.useRef)(null),rt=(0,s.useCallback)(e=>{C.current=e,r.assignRef(qe,e)},[qe]),E=(0,s.useRef)(new Map);for(let e of d)E.current.set(e.value,e);let D=e=>d.find(t=>t.value===e)??E.current.get(e),[O,k]=e.useControllableState({value:de,defaultValue:fe??(f?[]:null),onChange:pe}),A=f?Array.isArray(O)?O:[]:typeof O==`string`?[O]:[],j=!f&&typeof O==`string`?O:null,M=j===null?``:D(j)?.label??j,[N,P]=e.useControllableState({value:me,defaultValue:he??(f?``:M),onChange:ge}),it=A.length>0||h&&!f&&N.trim()!==``;(0,s.useEffect)(()=>{C.current?.setCustomValidity(y.required&&!it?De:``)},[y.required,it,De]);let[F,I]=e.useControllableState({value:_e,defaultValue:ve,onChange:ye}),at=F&&x,[L,R]=(0,s.useState)(!1),[z,B]=(0,s.useState)(null),ot=be===!1?null:be??a.defaultComboboxFilter,st=(e,t)=>{let n=[];d.forEach((t,r)=>{(!ot||ot(t,e))&&n.push({kind:`option`,key:t.value,option:t,id:`${S}-option-${r}`})});let r=N.trim();return Ce&&t&&r!==``&&!d.some(e=>a.normalizeText(e.label)===a.normalizeText(r))&&n.push({kind:`create`,key:a.CREATE_KEY,text:r,id:`${S}-create`}),a.orderItems(n)},V=f||L,H=st(V?N:``,V),U=z===null?-1:H.findIndex(e=>e.key===z);U>=0&&!a.isEnabled(H[U])&&(U=-1),U===-1&&Me&&V&&N.trim()!==``&&(U=a.findEnabled(H,-1,1,!0));let ct=m!=null&&m!==!1&&m!==``,W=at&&(H.length>0||p||ct),lt=W&&U>=0?H[U].id:void 0,[ut,G]=(0,s.useState)(``),dt=H.filter(e=>e.kind===`option`).length,ft=H.find(e=>e.kind===`create`),K=W?p?l(xe):dt>0?Se(dt):ft?.kind===`create`?l(we(ft.text)):l(m):``;(0,s.useEffect)(()=>{if(!K)return;let e=window.setTimeout(()=>G(K),ce);return()=>window.clearTimeout(e)},[K]),(0,s.useEffect)(()=>{W||G(``)},[W]);let q=(0,s.useRef)(me!==void 0&&!f&&M!==``?null:M);(0,s.useEffect)(()=>{f||q.current===M||(q.current=M,!(h&&M===``)&&(L||P(M)))},[f,M,L,h,P]);let J=e=>{(!e||x)&&(I(e),e||B(null))},pt=t.useOverlayLayer({active:W,elements:()=>[w,T],onEscape:()=>J(!1),onOutsidePress:()=>J(!1)}),Y=e=>{if(!x)return;let t=!f&&N===M,n=f||L&&!t;t&&R(!1);let r=st(n?N:``,n),i=-1;e===`first`?i=a.findEnabled(r,-1,1,!0):e===`last`?i=a.findEnabled(r,-1,-1,!0):e===`selected`&&(i=r.findIndex(e=>e.kind===`option`&&!e.option.disabled&&A.includes(e.option.value)),i<0&&(i=a.findEnabled(r,-1,1,!0))),B(i>=0?r[i].key:null),I(!0)},mt=e=>{let t=a.findEnabled(H,U,e,Ne);B(t>=0?H[t].key:null)},X=(e,t)=>{if(f){let n=A.includes(e);k(n?A.filter(t=>t!==e):[...A,e]),P(``),R(!1),B(e),G(n?u.optionRemoved(t):u.optionSelected(t));return}k(e),q.current=t,P(t),R(!1),J(!1)},ht=e=>{if(!a.isEnabled(e))return;if(e.kind===`option`){X(e.option.value,e.option.label);return}let t=Ce?.(e.text);if(typeof t==`string`){E.current.set(t,{value:t,label:e.text}),X(t,e.text);return}R(!1),f?P(``):J(!1)},gt=e=>{x&&(k(A.filter(t=>t!==e)),G(u.optionRemoved(D(e)?.label??e)))},Z=()=>{k(f?[]:null),q.current=``,P(``),R(!1),B(null)},_t=e=>{Ye?.(e),P(e.target.value),R(!0),B(null),F||J(!0)},vt=e=>{if(Xe?.(e),!(e.defaultPrevented||e.nativeEvent.isComposing||y.disabled))switch(e.key){case`ArrowDown`:if(!x)return;e.preventDefault(),e.altKey?W||Y(`none`):W?mt(1):Y(f?`first`:`selected`);return;case`ArrowUp`:if(!x)return;e.preventDefault(),e.altKey?J(!1):W?mt(-1):Y(`last`);return;case`Enter`:if(!W){f&&h&&N.trim()&&x&&(e.preventDefault(),e.repeat||yt()),!f&&x&&(0,ae.flushSync)(bt);return}if(e.preventDefault(),e.repeat)return;U>=0?ht(H[U]):f&&h&&N.trim()?yt():(!f&&h&&N!==M&&j!==null&&k(null),J(!1));return;case`Escape`:if(W)return;if(F){e.preventDefault(),I(!1);return}if(!x)return;{let t=f?``:M;if(N!==t){e.preventDefault(),P(t),R(!1);return}Oe&&(j!==null||A.length>0)&&(e.preventDefault(),Z())}return;case`Home`:case`End`:case`ArrowLeft`:case`ArrowRight`:z!==null&&B(null);return;case`Backspace`:f&&x&&!e.repeat&&N===``&&A.length>0&>(A[A.length-1]);return;default:return}},yt=()=>{let e=N.trim(),t=d.find(t=>a.normalizeText(t.label)===a.normalizeText(e));if(A.includes(t?.value??e)){P(``);return}if(t){t.disabled||X(t.value,t.label);return}E.current.set(e,{value:e,label:e}),X(e,e)},bt=()=>{if(!(f||N===M)){if(N.trim()===``){j===null?N!==``&&P(``):Z();return}if(h){j!==null&&k(null);return}P(M)}},xt=e=>{Ze?.(e),J(!1),R(!1),bt()},St=(0,s.useRef)(()=>{});St.current=()=>{if(de!==void 0)return;let e=fe??(f?[]:null);k(e);let t=typeof e==`string`?D(e)?.label??e:``;P(he??(f?``:t)),J(!1),R(!1)},(0,s.useEffect)(()=>{let e=C.current?.form;if(!e)return;let t=()=>St.current();return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)},[]);let Ct=e=>{let t=C.current;if(!t||y.disabled)return;let n=e.target;w.current?.contains(n)&&(n===t||n.closest(`button, a`)||(e.preventDefault(),t.focus()))},wt=e=>{let t=e.target;w.current?.contains(t)&&!t.closest(`button, a`)&&(F||Y(`none`))},Tt=()=>{C.current?.focus(),W||F?J(!1):Y(`none`)},Et=()=>{Z(),G(u.cleared),C.current?.focus()},Q=e=>e.preventDefault(),Dt=Te&&x&&(A.length>0||N!==``),$=f&&A.length>0,Ot=$e??(_?void 0:v&&!v.isGroup?v.labelId:void 0),kt=g===void 0?null:f?A.map(e=>(0,c.jsx)(`input`,{type:`hidden`,name:g,value:e,disabled:y.disabled},e)):(0,c.jsx)(`input`,{type:`hidden`,name:g,value:j??(h?N:``),disabled:y.disabled});return(0,c.jsxs)(`div`,{ref:w,className:i.cx(o.default.root,oe[b],Ve&&o.default.fullWidth,f&&o.default.multiple,$&&o.default.hasChips,y.invalid&&o.default.invalid,y.disabled&&o.default.disabled,y.readOnly&&!y.disabled&&o.default.readOnly,We),style:Ge,"data-size":b,"data-state":W?`open`:`closed`,onMouseDown:Ct,onClick:wt,children:[$&&(0,c.jsx)(re.ChipGroup,{"aria-label":je,size:se[b],tone:`primary`,variant:`soft`,disabled:y.disabled,focusFallback:C,className:o.default.chips,children:A.map(e=>{let t=D(e);return(0,c.jsx)(re.Chip,{startIcon:t?.icon,onRemove:x?()=>gt(e):void 0,children:t?.label??e},e)})}),(0,c.jsx)(`input`,{autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,...et,ref:rt,id:nt,type:`text`,role:`combobox`,"aria-label":_,"aria-labelledby":$e,"aria-expanded":W,"aria-controls":S,"aria-autocomplete":`list`,"aria-activedescendant":lt,...y.ariaProps,placeholder:$?void 0:Je,value:N,disabled:y.disabled,readOnly:y.readOnly,className:i.cx(o.default.input,Ue),onChange:_t,onKeyDown:vt,onBlur:xt}),(0,c.jsxs)(`span`,{className:o.default.actions,children:[Dt&&(0,c.jsx)(`button`,{type:`button`,className:o.default.iconButton,"aria-label":Ee,onMouseDown:Q,onClick:Et,children:(0,c.jsx)(te.CloseIcon,{size:b===`lg`?`sm`:`xs`,strokeWidth:2.5})}),(0,c.jsx)(`button`,{type:`button`,tabIndex:-1,className:i.cx(o.default.iconButton,o.default.toggle),"aria-label":W?Ae:ke,disabled:!x,onMouseDown:Q,onClick:Tt,children:(0,c.jsx)(te.ChevronDownIcon,{size:b===`sm`?`sm`:`md`,className:o.default.chevron})})]}),kt,(0,c.jsx)(ee.VisuallyHidden,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:ut}),W&&(0,c.jsx)(ie.ComboboxPopup,{anchorRef:w,positionerRef:T,layer:pt,listboxId:S,labelledBy:Ot,label:_,multiple:f,size:b,placement:ze,maxHeight:Be,items:H,highlightedIndex:U,isSelected:e=>A.includes(e),onHighlight:e=>B(H[e]?.key??null),onChoose:ht,renderOption:ue,createLabel:we,loading:p,loadingMessage:xe,emptyMessage:m,container:He})]})};exports.Combobox=le,exports.defaultComboboxFilter=a.defaultComboboxFilter;
|
|
@@ -5,8 +5,8 @@ import { assignRef as r } from "../../../utils/refs.mjs";
|
|
|
5
5
|
import { cx as i } from "../../../utils/cx.mjs";
|
|
6
6
|
import { VisuallyHidden as ee } from "../../utilities/VisuallyHidden/VisuallyHidden.mjs";
|
|
7
7
|
import { ChevronDownIcon as te, CloseIcon as ne } from "../../primitives/Icon/icons.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { useFieldContext as re, useFieldControl as ie } from "../Field/FieldContext.mjs";
|
|
9
|
+
import { Chip as ae, ChipGroup as oe } from "../../data-display/Chip/Chip.mjs";
|
|
10
10
|
import { CREATE_KEY as se, defaultComboboxFilter as ce, findEnabled as a, isEnabled as le, normalizeText as o, orderItems as ue } from "./comboboxUtils.mjs";
|
|
11
11
|
import s from "./Combobox.module.css.mjs";
|
|
12
12
|
import { ComboboxPopup as de } from "./ComboboxPopup.mjs";
|
|
@@ -27,7 +27,7 @@ function f(e) {
|
|
|
27
27
|
return typeof e == "string" || typeof e == "number" ? String(e) : "";
|
|
28
28
|
}
|
|
29
29
|
var ve = 500, ye = (ye) => {
|
|
30
|
-
let p = n().combobox, { options: m, renderOption: be, multiple: h = !1, value: xe, defaultValue: Se, onValueChange: Ce, inputValue: we, defaultInputValue: Te, onInputValueChange: Ee, open: De, defaultOpen: Oe = !1, onOpenChange: ke, filter: Ae, loading: g = !1, loadingMessage: je = p.loading, emptyMessage: _ = p.empty, resultsMessage: Me = p.results, allowCustomValue: v = !1, onCreate: Ne, createLabel: Pe = p.create, clearable: Fe = !1, clearLabel: Ie = p.clear, requiredMessage: Le = p.required, clearOnEscape: Re = !1, showSuggestionsLabel: ze = p.showSuggestions, hideSuggestionsLabel: Be = p.hideSuggestions, selectedLabel: Ve = p.selected, autoHighlight: He = !1, loop: Ue = !0, size: We, invalid: Ge, required: Ke, disabled: qe, readOnly: Je, name: y, placement: Ye = "bottom-start", maxHeight: Xe, fullWidth: Ze = !0, container: Qe, inputClassName: $e, className: et, style: tt, id: nt, ref: rt, placeholder: it, onChange: at, onKeyDown: ot, onBlur: st, "aria-describedby": ct, "aria-label": b, "aria-labelledby": lt, ...ut } = ye, x =
|
|
30
|
+
let p = n().combobox, { options: m, renderOption: be, multiple: h = !1, value: xe, defaultValue: Se, onValueChange: Ce, inputValue: we, defaultInputValue: Te, onInputValueChange: Ee, open: De, defaultOpen: Oe = !1, onOpenChange: ke, filter: Ae, loading: g = !1, loadingMessage: je = p.loading, emptyMessage: _ = p.empty, resultsMessage: Me = p.results, allowCustomValue: v = !1, onCreate: Ne, createLabel: Pe = p.create, clearable: Fe = !1, clearLabel: Ie = p.clear, requiredMessage: Le = p.required, clearOnEscape: Re = !1, showSuggestionsLabel: ze = p.showSuggestions, hideSuggestionsLabel: Be = p.hideSuggestions, selectedLabel: Ve = p.selected, autoHighlight: He = !1, loop: Ue = !0, size: We, invalid: Ge, required: Ke, disabled: qe, readOnly: Je, name: y, placement: Ye = "bottom-start", maxHeight: Xe, fullWidth: Ze = !0, container: Qe, inputClassName: $e, className: et, style: tt, id: nt, ref: rt, placeholder: it, onChange: at, onKeyDown: ot, onBlur: st, "aria-describedby": ct, "aria-label": b, "aria-labelledby": lt, ...ut } = ye, x = re(), S = ie({
|
|
31
31
|
id: nt,
|
|
32
32
|
invalid: Ge,
|
|
33
33
|
required: Ke,
|
|
@@ -258,7 +258,7 @@ var ve = 500, ye = (ye) => {
|
|
|
258
258
|
onMouseDown: Pt,
|
|
259
259
|
onClick: Ft,
|
|
260
260
|
children: [
|
|
261
|
-
Bt && /* @__PURE__ */ d(
|
|
261
|
+
Bt && /* @__PURE__ */ d(oe, {
|
|
262
262
|
"aria-label": Ve,
|
|
263
263
|
size: _e[C],
|
|
264
264
|
tone: "primary",
|
|
@@ -268,7 +268,7 @@ var ve = 500, ye = (ye) => {
|
|
|
268
268
|
className: s.chips,
|
|
269
269
|
children: M.map((e) => {
|
|
270
270
|
let t = k(e);
|
|
271
|
-
return /* @__PURE__ */ d(
|
|
271
|
+
return /* @__PURE__ */ d(ae, {
|
|
272
272
|
startIcon: t?.icon,
|
|
273
273
|
onRemove: w ? () => Dt(e) : void 0,
|
|
274
274
|
children: t?.label ?? e
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../utilities/LocaleProvider/LocaleProvider.cjs.js"),n=require("../../../utils/refs.cjs.js"),r=require("../../../utils/cx.cjs.js"),i=require("../../utilities/VisuallyHidden/VisuallyHidden.cjs.js"),a=require("../../primitives/Icon/icons.cjs.js"),o=require("
|
|
1
|
+
const e=require("../../../hooks/useControllableState.cjs.js"),t=require("../../utilities/LocaleProvider/LocaleProvider.cjs.js"),n=require("../../../utils/refs.cjs.js"),r=require("../../../utils/cx.cjs.js"),i=require("../../utilities/VisuallyHidden/VisuallyHidden.cjs.js"),a=require("../../primitives/Icon/icons.cjs.js"),o=require("../Field/FieldContext.cjs.js"),s=require("../../data-display/Chip/Chip.cjs.js"),c=require("./TagInput.module.css.cjs.js");let l=require("react"),u=require("react/jsx-runtime");var ee={sm:`sm`,md:`md`,lg:`lg`},te={sm:c.default.sm,md:c.default.md,lg:c.default.lg},d=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function f(e,t){return{",":t.comma,";":t.semicolon," ":t.space,"|":t.pipe," ":t.tab}[e]??t.other(e)}function ne(e,t,n,r){let i=[n.keys.enter,...t?[n.keys.tab]:[],...e.map(e=>f(e,n.keys))],a=Intl.ListFormat,o=a?new a(r,{type:`disjunction`}).format(i):i.join(`, `);return n.instructions(o)}var p=({value:f,defaultValue:p,onValueChange:re,inputValue:ie,defaultInputValue:m,onInputValueChange:ae,delimiters:h=[`,`],addOnTab:g=!1,addOnBlur:oe=!1,allowDuplicates:se=!1,maxTags:_,validate:ce,transform:le,size:ue,disabled:de,readOnly:fe,invalid:pe,required:me,placeholder:he,name:ge,chipVariant:_e,chipTone:ve,removeLabel:ye,tagListLabel:be,instructions:xe,messages:Se,className:Ce,inputClassName:we,style:Te,ref:v,id:Ee,onChange:De,onKeyDown:Oe,onPaste:ke,onBlur:Ae,form:y,"aria-describedby":je,"aria-labelledby":b,...x})=>{let{messages:S,locale:Me}=t.useLocale(),Ne=ye??S.tagInput.remove,C={...S.tagInput,...Se},w=(0,l.useId)(),T=`${w}-instructions`,E=`${w}-error`,D=`${w}-max`,O=o.useFieldContext(),[k,A]=e.useControllableState({value:f,defaultValue:p??[],onChange:re}),[j,M]=e.useControllableState({value:ie,defaultValue:m??``,onChange:ae}),[N,P]=(0,l.useState)(null),[Pe,F]=(0,l.useState)(null),[I,L]=(0,l.useState)(null),[R,Fe]=(0,l.useState)({text:``,n:0}),z=_!==void 0&&k.length>=_,Ie=[je,T,z?D:void 0,N?E:void 0].filter(Boolean).join(` `)||void 0,B=o.useFieldControl({id:Ee,invalid:pe,required:me,disabled:de,readOnly:fe,size:ue,"aria-describedby":Ie},{nativeRequired:!1}),V=B.size??`md`,Le=B.invalid||N!==null,H=!B.disabled&&!B.readOnly,U=(0,l.useRef)(null),W=(0,l.useRef)(null),Re=(0,l.useRef)([]),G=(0,l.useRef)(null),K=(0,l.useRef)(void 0),ze=(0,l.useCallback)(e=>{U.current=e,n.assignRef(v,e)},[v]);(0,l.useEffect)(()=>()=>window.clearTimeout(K.current),[]);let Be=e=>{e&&Fe(t=>({text:e,n:t.n+1}))},[Ve,He]=(0,l.useState)(0),q=()=>U.current?.focus(),J=e=>{let t=Re.current[e]?.querySelector(`button:not(:disabled)`);return t?(t.focus(),!0):!1};(0,l.useLayoutEffect)(()=>{let e=G.current;e!==null&&(G.current=null,!(e<k.length&&J(e))&&q())}),(0,l.useEffect)(()=>{let e=U.current;e&&e.setCustomValidity(B.required&&k.length===0?C.required:``)});let Ue=(0,l.useRef)(p??[]),We=(0,l.useRef)(m??``);(0,l.useEffect)(()=>{let e=U.current?.form??W.current?.closest(`form`);if(!e)return;let t=()=>{A(Ue.current),M(We.current),P(null)};return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)},[A,M]);let Y=h.length>0?new RegExp(h.map(d).join(`|`)):null,Ge=new RegExp([...h.map(d),`\\r?\\n`,`\\t`].join(`|`)),X=e=>{let t=[...k],n=[],r=[],i=[],a=null,o=!1;for(let s of e){let e=s.trim();if(!e)continue;let c=(le?le(e):e).trim();if(c){if(_!==void 0&&t.length>=_){o=!0;continue}if(!se&&t.includes(c)){r.push(c);continue}if(ce){let t=ce(c);if(t!==!0){a??=typeof t==`string`&&t?t:C.invalid(c),i.push(e);continue}}t.push(c),n.push(c)}}n.length>0&&A(t),P(a),r.length>0&&(window.clearTimeout(K.current),F(r[0]),L(C.duplicate(r[0])),K.current=window.setTimeout(()=>F(null),1200));let s=_!==void 0&&t.length>=_&&n.length>0,c=[n.length>0?C.added(n):null,...r.map(C.duplicate),a,o||s?C.maxReached(_):null].filter(Boolean);return Be(c.join(`. `)),{rejected:i,added:n.length>0}},Ke=e=>{let t=k[e];t!==void 0&&H&&(G.current=e,A(k.filter((t,n)=>n!==e)),P(null),Be(C.removed(t)))},Z=(e,t=``)=>{let n=h[0],r=n===void 0||n.trim()===``?` `:`${n} `;return[...e,t].filter(Boolean).join(r)},Q=()=>{let e=X([j]);return M(e.rejected.length>0?j:``),e},qe=e=>{De?.(e),I&&L(null);let t=e.target.value;if(Y&&Y.test(t)){let e=t.split(Y),n=e.pop()??``,r=X(e);M(Z(r.rejected,n));return}N&&P(null),M(t)},Je=e=>{if(ke?.(e),e.defaultPrevented)return;let t=e.clipboardData.getData(`text`);if(!Ge.test(t))return;e.preventDefault();let n=e.currentTarget,r=n.selectionStart??j.length,i=n.selectionEnd??j.length,a=j.slice(0,r)+t+j.slice(i),o=X(a.split(Ge));M(Z(o.rejected))},Ye=()=>W.current?getComputedStyle(W.current).direction===`rtl`:!1,Xe=e=>{if(Oe?.(e),e.defaultPrevented||e.nativeEvent.isComposing)return;let t=e.currentTarget,n=t.selectionStart===0&&t.selectionEnd===0,r=Ye()?`ArrowRight`:`ArrowLeft`;switch(e.key){case`Enter`:if(e.repeat){e.preventDefault();return}if(!j.trim())return;e.preventDefault(),Q();return;case`Tab`:{if(!g||e.shiftKey||!j.trim())return;let t=Q();t.added&&t.rejected.length===0&&e.preventDefault();return}case`Backspace`:if(e.repeat||j!==``||k.length===0)return;J(k.length-1)&&e.preventDefault();return;case r:if(!n||k.length===0||e.shiftKey)return;J(k.length-1)&&e.preventDefault();return;default:return}},Ze=e=>{Ae?.(e),oe&&j.trim()&&Q()},Qe=(e,t)=>{let n=Ye(),r=n?`ArrowRight`:`ArrowLeft`,i=n?`ArrowLeft`:`ArrowRight`,a=!0;switch(e.key){case r:t>0&&J(t-1);break;case i:t<k.length-1&&J(t+1)||q();break;case`Home`:J(0);break;case`End`:q();break;default:a=!1}a&&e.preventDefault()},$e=e=>{let t=U.current;if(!t||B.disabled)return;let n=e.target;n===t||n.closest(`button, a, input, [tabindex]`)||(e.preventDefault(),t.focus())},$=be===void 0?b??(O&&!O.isGroup?O.labelId:void 0):void 0,et=be??($?void 0:S.tagInput.list),tt=xe??ne(h,g,S.tagInput,Me),nt=k.length===0&&!z;return(0,u.jsxs)(`div`,{ref:W,className:r.cx(c.default.root,Ce),style:Te,"data-size":V,children:[(0,u.jsxs)(`div`,{className:r.cx(c.default.box,te[V],k.length>0&&c.default.hasTags,Le&&c.default.invalid,B.disabled&&c.default.disabled,B.readOnly&&!B.disabled&&c.default.readOnly),onPointerDown:$e,children:[k.length>0&&(0,u.jsx)(`ul`,{className:c.default.list,"aria-labelledby":$,"aria-label":et,"aria-describedby":B.readOnly?B.ariaProps[`aria-describedby`]:void 0,children:k.map((e,t)=>(0,u.jsx)(`li`,{ref:e=>{Re.current[t]=e},className:c.default.item,"data-highlighted":Pe===e||void 0,onKeyDown:e=>Qe(e,t),onFocus:()=>He(t),children:(0,u.jsx)(s.Chip,{size:ee[V],variant:_e,tone:ve,disabled:B.disabled,onRemove:H?()=>Ke(t):void 0,removeLabel:H?Ne(e):void 0,removeTabIndex:t===Math.min(Ve,k.length-1)?0:-1,children:e})},`${e}-${t}`))}),B.readOnly&&!B.disabled?k.length===0&&(0,u.jsx)(`span`,{className:c.default.empty,children:C.empty}):(0,u.jsx)(`input`,{...x,ref:ze,id:B.id,type:`text`,form:y,value:j,placeholder:nt?he:void 0,disabled:B.disabled,readOnly:z,autoComplete:x.autoComplete??`off`,...B.ariaProps,"aria-labelledby":b,"aria-invalid":Le||void 0,"aria-errormessage":N?E:B.ariaProps[`aria-errormessage`],className:r.cx(c.default.input,we),onChange:qe,onKeyDown:Xe,onPaste:Je,onBlur:Ze})]}),N&&(0,u.jsxs)(`p`,{id:E,className:c.default.error,children:[(0,u.jsx)(a.ErrorIcon,{size:`sm`,className:c.default.errorIcon}),(0,u.jsx)(`span`,{children:N})]}),(0,u.jsx)(i.VisuallyHidden,{id:T,children:tt}),I&&(0,u.jsx)(`p`,{className:c.default.limit,children:I}),z&&(0,u.jsx)(`p`,{id:D,className:c.default.limit,children:C.maxReached(_)}),(0,u.jsxs)(i.VisuallyHidden,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:[R.text,R.n%2==1?`\xA0`:``]}),ge!==void 0&&k.map((e,t)=>(0,u.jsx)(`input`,{type:`hidden`,name:ge,value:e,form:y,disabled:B.disabled},`${e}-${t}`))]})};exports.TagInput=p;
|
|
@@ -4,8 +4,8 @@ import { assignRef as n } from "../../../utils/refs.mjs";
|
|
|
4
4
|
import { cx as r } from "../../../utils/cx.mjs";
|
|
5
5
|
import { VisuallyHidden as i } from "../../utilities/VisuallyHidden/VisuallyHidden.mjs";
|
|
6
6
|
import { ErrorIcon as a } from "../../primitives/Icon/icons.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useFieldContext as o, useFieldControl as s } from "../Field/FieldContext.mjs";
|
|
8
|
+
import { Chip as c } from "../../data-display/Chip/Chip.mjs";
|
|
9
9
|
import l from "./TagInput.module.css.mjs";
|
|
10
10
|
import { useCallback as ee, useEffect as u, useId as te, useLayoutEffect as ne, useRef as d, useState as f } from "react";
|
|
11
11
|
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
@@ -40,7 +40,7 @@ var _ = ({ value: g, defaultValue: _, onValueChange: oe, inputValue: se, default
|
|
|
40
40
|
let { messages: E, locale: Fe } = t(), Ie = Ce ?? E.tagInput.remove, D = {
|
|
41
41
|
...E.tagInput,
|
|
42
42
|
...Te
|
|
43
|
-
}, O = te(), k = `${O}-instructions`, A = `${O}-error`, j = `${O}-max`, M =
|
|
43
|
+
}, O = te(), k = `${O}-instructions`, A = `${O}-error`, j = `${O}-max`, M = o(), [N, P] = e({
|
|
44
44
|
value: g,
|
|
45
45
|
defaultValue: _ ?? [],
|
|
46
46
|
onChange: oe
|
|
@@ -56,7 +56,7 @@ var _ = ({ value: g, defaultValue: _, onValueChange: oe, inputValue: se, default
|
|
|
56
56
|
k,
|
|
57
57
|
B ? j : void 0,
|
|
58
58
|
L ? A : void 0
|
|
59
|
-
].filter(Boolean).join(" ") || void 0, V =
|
|
59
|
+
].filter(Boolean).join(" ") || void 0, V = s({
|
|
60
60
|
id: ke,
|
|
61
61
|
invalid: _e,
|
|
62
62
|
required: ve,
|
|
@@ -234,7 +234,7 @@ var _ = ({ value: g, defaultValue: _, onValueChange: oe, inputValue: se, default
|
|
|
234
234
|
"data-highlighted": Le === e || void 0,
|
|
235
235
|
onKeyDown: (e) => it(e, t),
|
|
236
236
|
onFocus: () => Je(t),
|
|
237
|
-
children: /* @__PURE__ */ p(
|
|
237
|
+
children: /* @__PURE__ */ p(c, {
|
|
238
238
|
size: re[H],
|
|
239
239
|
variant: xe,
|
|
240
240
|
tone: Se,
|
package/dist/i18n/en.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./plural.cjs.js");var t=e.plural(`en`),n=e.num(`en`),r={avatar:{status:{online:`online`,away:`away`,busy:`busy`,offline:`offline`},fallbackName:`User`,surplus:e=>`and ${n(e)} more`},carousel:{previous:`Previous slide`,next:`Next slide`,start:`Start automatic slide show`,stop:`Stop automatic slide show`,slides:`Slides`,indicators:`Choose slide`,goTo:e=>`Go to slide ${e}`,slide:(e,t)=>`${e} of ${t}`,status:(e,t,n)=>e===t?`Slide ${e} of ${n}`:`Slides ${e} to ${t} of ${n}`},chip:{remove:`Remove`,removeNamed:e=>`Remove ${e}`},codeBlock:{copy:`Copy code`,copied:`Copied`,copyError:`Couldn't copy. Select the code and copy it manually.`,region:e=>`Code: ${e}`,snippet:`snippet`},emptyState:{noData:{title:`Nothing here yet`,description:`When there's something to show, it'll appear here.`},noResults:{title:e=>e?`No results for “${e}”`:`No results found`,description:`Try a different search or clear your filters.`},error:{title:`Something went wrong`,description:`We couldn't load this. Please try again.`},offline:{title:`You're offline`,description:`Check your connection, then try again.`},noAccess:{title:`You don't have access`,description:`Ask an admin for permission to view this.`},firstRun:{title:`Let's get started`,description:`Create your first one and you're off and running.`},retry:`Try again`},stat:{loading:`Loading`,increased:e=>`increased by ${e}`,decreased:e=>`decreased by ${e}`,changed:e=>`changed by ${e}`,noChange:`no change`,progress:`Progress`,progressNamed:e=>`${e} progress`},table:{loading:`Loading`,scrollRegion:`Scrollable table`,selectAll:`Select all rows`,selectRow:`Select row`,selectRowNamed:e=>`Select row ${e}`,selectColumn:`Select`},dataGrid:{ascending:`ascending`,descending:`descending`,sorted:(e,t)=>`Sorted by ${e}, ${t}`,sortCleared:`Sorting cleared`,selectedCount:e=>t(e,{one:`# row selected`,other:`# rows selected`}),rowCount:e=>t(e,{one:`# row`,other:`# rows`}),range:(e,t,r)=>`${n(e)}–${n(t)} of ${n(r)}`,empty:`No rows`,noResults:`No matching rows`,resizeColumn:e=>`Resize ${e}`},chart:{showTable:`Show data table`,hideTable:`Hide data table`},timeline:{status:{complete:`Completed`,current:`Current step`,upcoming:`Upcoming`,error:`Error`},region:`Timeline`},treeView:{loading:`Loading…`,error:`Couldn't load items. Collapse and expand to try again.`},alert:{dismiss:`Dismiss`,prefix:{info:`Info: `,success:`Success: `,warning:`Warning: `,danger:`Error: `,neutral:`Note: `}},banner:{dismiss:`Dismiss banner`,region:`Announcement`},button:{loading:`Loading`},skeleton:{loading:`Loading…`},spinner:{loading:`Loading`},toast:{region:`Notifications`,dismiss:`Dismiss notification`,queued:e=>t(e,{one:`+# more notification`,other:`+# more notifications`}),tone:{info:`Info`,success:`Success`,warning:`Warning`,danger:`Error`,loading:`Loading`}},kbd:{then:`then`,keys:{command:`Command`,control:`Control`,windows:`Windows`,super:`Super`,option:`Option`,alt:`Alt`,shift:`Shift`,return:`Return`,enter:`Enter`,escape:`Escape`,tab:`Tab`,space:`Space`,delete:`Delete`,forwardDelete:`Forward Delete`,backspace:`Backspace`,capsLock:`Caps Lock`,up:`Up Arrow`,down:`Down Arrow`,left:`Left Arrow`,right:`Right Arrow`,pageUp:`Page Up`,pageDown:`Page Down`,home:`Home`,end:`End`}},colorPicker:{area:`Saturation and brightness`,areaRoleDescription:`2D slider`,saturation:`Saturation`,brightness:`Brightness`,hue:`Hue`,degrees:`degrees`,alpha:`Opacity`,input:`Color value`,invalidInput:`Enter a color like #1d4ed8, rgb(29, 78, 216), or hsl(224, 76%, 48%). The last valid color was kept.`,swatches:`Preset colors`,eyeDropper:`Pick a color from the screen`,eyeDropperPicked:e=>`Picked ${e}`,dialog:`Choose a color`,colors:{hues:{red:`red`,orange:`orange`,gold:`gold`,yellow:`yellow`,yellowGreen:`yellow-green`,green:`green`,teal:`teal`,cyan:`cyan`,blue:`blue`,purple:`purple`,magenta:`magenta`,pink:`pink`},black:`black`,white:`white`,gray:`gray`,brown:`brown`,olive:`olive`,dark:e=>`dark ${e}`,light:e=>`light ${e}`,muted:e=>`muted ${e}`,vivid:e=>`vivid ${e}`,withOpacity:(e,t)=>`${e}, ${t}% opacity`}},combobox:{loading:`Loading…`,empty:`No results`,results:e=>t(e,{one:`# result available`,other:`# results available`}),create:e=>`Create “${e}”`,clear:`Clear selection`,required:`Choose an option.`,showSuggestions:`Show suggestions`,hideSuggestions:`Hide suggestions`,selected:`Selected`,optionSelected:e=>`${e} selected`,optionRemoved:e=>`${e} removed`,cleared:`Selection cleared`},datePicker:{chooseDate:`Choose date`,changeDate:e=>`Change date, ${e}`,dialog:`Choose date`,format:e=>`Format: ${e}`,pattern:{day:`DD`,month:`MM`,year:`YYYY`},previousMonth:`Previous month`,nextMonth:`Next month`,startDate:`Start date`,endDate:`End date`,chooseDates:`Choose dates`,changeDates:e=>`Change dates, ${e}`,datesDialog:`Choose dates`,invalid:{unparseable:e=>`Enter a date as ${e}.`,between:(e,t)=>`Choose a date from ${e} to ${t}.`,onOrAfter:e=>`Choose a date on or after ${e}.`,onOrBefore:e=>`Choose a date on or before ${e}.`,unavailable:e=>`${e} isn't available. Choose another date.`,rangeBetween:(e,t)=>`Choose dates from ${e} to ${t}.`,rangeOnOrAfter:e=>`Choose dates on or after ${e}.`,rangeOnOrBefore:e=>`Choose dates on or before ${e}.`,endBeforeStart:`The end date must be on or after the start date.`,startAfterEnd:`The start date must be on or before the end date.`}},timePicker:{format:e=>`Example: ${e}`,showTimes:`Show times`,hideTimes:`Hide times`,date:`Date`,time:`Time`,invalid:{unparseable:e=>`Enter a time, for example ${e}.`,between:(e,t)=>`Choose a time from ${e} to ${t}.`,onOrAfter:e=>`Choose a time at or after ${e}.`,onOrBefore:e=>`Choose a time at or before ${e}.`}},fileUpload:{list:`Selected files`,remove:e=>`Remove ${e}`,uploaded:`Uploaded`,uploadFailed:`Upload failed`,uploading:`Uploading`,uploadingPercent:e=>`Uploading ${e}%`,progressFor:e=>`Upload progress for ${e}`,announceUploaded:e=>`${e} uploaded.`,announceFailed:e=>`${e} failed to upload.`,announceAdded:(e,r)=>{let i=[];return e&&i.push(t(e,{one:`# file added`,other:`# files added`})),r&&i.push(e?`${n(r)} rejected`:t(r,{one:`# file rejected`,other:`# files rejected`})),`${i.join(`, `)}.`},typeNotAccepted:`File type not accepted.`,typeNotAcceptedUse:e=>`File type not accepted. Use ${e}.`,tooLarge:e=>`File is larger than ${e}.`,tooSmall:e=>`File is smaller than ${e}.`,duplicate:`This file is already added.`,tooMany:e=>t(e,{one:`Too many files. You can add up to # file.`,other:`Too many files. You can add up to # files.`}),onlyOne:`Only one file can be added.`,upTo:e=>`up to ${e}`,upToEach:e=>`up to ${e} each`,maxFiles:e=>t(e,{one:`Up to # file`,other:`Up to # files`}),uploadFiles:`Upload files`,browseFiles:`Browse files`,dropFiles:`Drop files here or browse`,dropFile:`Drop a file here or browse`,required:`Required`,rejected:e=>t(e,{one:`# file couldn't be added`,other:`# files couldn't be added`}),dismissErrors:`Dismiss file errors`,typeGroups:{image:`images`,video:`videos`,audio:`audio`,text:`text files`},typeGroup:e=>`${e} files`,units:{B:`B`,KB:`KB`,MB:`MB`,GB:`GB`,TB:`TB`}},input:{clear:`Clear`},numberInput:{decrement:`Decrease`,increment:`Increase`},passwordInput:{show:`Show password`,capsLock:`Caps Lock is on`,strength:[`Too weak`,`Weak`,`Fair`,`Good`,`Strong`],strengthPrefix:`Strength:`,requirements:`Your password needs:`,met:`Met`,notMet:`Not met`,announceStrength:e=>`Password strength: ${e}.`,allMet:`All requirements met.`,someMet:(e,t)=>`${e} of ${t} requirements met.`},rating:{option:(e,t)=>`${e} out of ${t}`,display:(e,t)=>`Rated ${e} out of ${t}`,count:e=>t(e,{one:`(# review)`,other:`(# reviews)`}),clearHint:`Press Space on the selected rating, or Delete, to clear it.`,unrated:`Not rated`},searchInput:{clear:`Clear search`,results:e=>t(e,{"=0":`No results`,one:`# result`,other:`# results`}),search:`Search`},switch:{on:`On`,off:`Off`,saving:`Saving`},tagInput:{added:e=>e.length===1?`Added ${e[0]}`:`Added ${e.length} tags: ${e.join(`, `)}`,removed:e=>`Removed ${e}`,duplicate:e=>`${e} is already added`,invalid:e=>`"${e}" is not valid`,maxReached:e=>`Maximum of ${e} tags reached`,required:`Add at least one tag.`,empty:`None`,remove:e=>`Remove ${e}`,list:`Tags`,instructions:e=>`Press ${e} to add a tag. Backspace or the left arrow moves to added tags.`,keys:{enter:`Enter`,tab:`Tab`,comma:`a comma`,semicolon:`a semicolon`,space:`a space`,pipe:`a pipe`,other:e=>`"${e}"`}},textarea:{limitReached:`Character limit reached`,remaining:e=>t(e,{one:`# character remaining`,other:`# characters remaining`})},resizablePanels:{handle:`Resize panels`,resizePanel:e=>`Resize ${e}`},breadcrumbs:{nav:`Breadcrumb`,expand:e=>t(e,{one:`Show # more breadcrumb`,other:`Show # more breadcrumbs`})},contextMenu:{label:`Context menu`},navbar:{openMenu:`Open menu`,menu:`Menu`,nav:`Main`},pagination:{nav:`Pagination`,previous:`Previous page`,next:`Next page`,first:`First page`,last:`Last page`,currentPage:e=>`Page ${e}`,goToPage:e=>`Go to page ${e}`,status:`Page {page} of {total}`},sidebar:{nav:`Main navigation`,collapse:`Collapse sidebar`,expand:`Expand sidebar`},skipLink:{label:`Skip to main content`},stepper:{status:{complete:`Completed`,current:`Current`,upcoming:`Not started`,error:`Error`},nav:`Progress`,allComplete:e=>`All ${e} steps complete`,stepTitled:(e,t,n)=>`Step ${e} of ${t}: ${n}`,step:(e,t)=>`Step ${e} of ${t}`,count:(e,t)=>`${e} of ${t}`,prefix:e=>`Step ${e}: `},commandPalette:{label:`Command palette`,placeholder:`Type a command or search…`,list:`Commands`,loading:`Loading results…`,results:e=>t(e,{"=0":`No results`,one:`# result`,other:`# results`}),instructions:`Use the up and down arrow keys to move through results, Enter to run a command, and Escape to close.`,back:`Back`,hints:{navigate:`to navigate`,select:`to select`,back:`to go back`,close:`to close`}},auth:{or:`or`,unexpected:`Something went wrong. Try again.`,email:`Email`,username:`Username`,password:`Password`,signIn:{title:`Sign in`,submit:`Sign in`,remember:`Remember me`,forgot:`Forgot password?`,noAccount:`Don't have an account?`,signUp:`Create an account`},signUp:{title:`Create an account`,submit:`Create account`,name:`Name`,confirmPassword:`Confirm password`,mismatch:`The passwords don't match.`,termsRequired:`Accept the terms to continue.`,haveAccount:`Already have an account?`,signIn:`Sign in`},forgot:{title:`Reset your password`,description:`Enter your email and we'll send you a link to reset your password.`,submit:`Send reset link`,sent:e=>`If an account exists for ${e}, we sent it a link to reset your password.`,resend:`Send again`,back:`Back to sign in`},reset:{title:`Choose a new password`,password:`New password`,submit:`Save password`,done:`Your password has been changed.`},verify:{title:`Enter the code`,description:e=>`Enter the code we sent to ${e}.`,descriptionGeneric:`Enter the code we sent you.`,code:`Verification code`,submit:`Verify`,resend:`Resend code`,resendIn:e=>`Resend code in ${e}`,resent:`We sent a new code.`,incomplete:`Enter the full code.`}},validation:{required:`This field is required.`,email:`Enter an email address, like name@example.com.`,url:`Enter a web address, like https://example.com.`,ip:`Enter an IP address, like 192.168.0.1 or 2001:db8::1.`,ipv4:`Enter an IPv4 address, like 192.168.0.1.`,ipv6:`Enter an IPv6 address, like 2001:db8::1.`,number:`Enter a number.`,pattern:`Use the requested format.`,tooShort:e=>t(e,{one:`Use at least # character.`,other:`Use at least # characters.`}),tooLong:e=>t(e,{one:`Use # character or fewer.`,other:`Use # characters or fewer.`}),min:e=>`Enter ${e} or more.`,max:e=>`Enter ${e} or less.`,step:`Enter a valid value.`,invalid:`Enter a valid value.`,matches:`The values don't match.`,summaryTitle:e=>t(e,{one:`There is # problem`,other:`There are # problems`})},drawer:{close:`Close`},modal:{close:`Close`,confirm:`Confirm`,cancel:`Cancel`},popover:{close:`Close`}};exports.en=r;
|
|
1
|
+
const e=require("./plural.cjs.js");var t=e.plural(`en`),n=e.num(`en`),r={avatar:{status:{online:`online`,away:`away`,busy:`busy`,offline:`offline`},fallbackName:`User`,surplus:e=>`and ${n(e)} more`},carousel:{previous:`Previous slide`,next:`Next slide`,start:`Start automatic slide show`,stop:`Stop automatic slide show`,slides:`Slides`,indicators:`Choose slide`,goTo:e=>`Go to slide ${e}`,slide:(e,t)=>`${e} of ${t}`,status:(e,t,n)=>e===t?`Slide ${e} of ${n}`:`Slides ${e} to ${t} of ${n}`},chip:{remove:`Remove`,removeNamed:e=>`Remove ${e}`},chat:{region:`Chat`,log:`Conversation`,input:`Message`,placeholder:`Ask anything`,hint:`Press Enter to send, or Shift+Enter for a new line.`,send:`Send message`,stop:`Stop response`,copy:`Copy message`,copied:`Copied`,retry:`Retry`,error:`Something went wrong. Try again.`,stopped:`Response stopped`,assistant:`Assistant`,youSaid:`You said:`,assistantSaid:e=>`${e} said:`,typing:e=>`${e} is typing`,emptyTitle:`How can I help?`,suggestions:`Suggested prompts`,scrollToLatest:`Jump to latest message`},codeBlock:{copy:`Copy code`,copied:`Copied`,copyError:`Couldn't copy. Select the code and copy it manually.`,region:e=>`Code: ${e}`,snippet:`snippet`},emptyState:{noData:{title:`Nothing here yet`,description:`When there's something to show, it'll appear here.`},noResults:{title:e=>e?`No results for “${e}”`:`No results found`,description:`Try a different search or clear your filters.`},error:{title:`Something went wrong`,description:`We couldn't load this. Please try again.`},offline:{title:`You're offline`,description:`Check your connection, then try again.`},noAccess:{title:`You don't have access`,description:`Ask an admin for permission to view this.`},firstRun:{title:`Let's get started`,description:`Create your first one and you're off and running.`},retry:`Try again`},stat:{loading:`Loading`,increased:e=>`increased by ${e}`,decreased:e=>`decreased by ${e}`,changed:e=>`changed by ${e}`,noChange:`no change`,progress:`Progress`,progressNamed:e=>`${e} progress`},table:{loading:`Loading`,scrollRegion:`Scrollable table`,selectAll:`Select all rows`,selectRow:`Select row`,selectRowNamed:e=>`Select row ${e}`,selectColumn:`Select`},dataGrid:{ascending:`ascending`,descending:`descending`,sorted:(e,t)=>`Sorted by ${e}, ${t}`,sortCleared:`Sorting cleared`,selectedCount:e=>t(e,{one:`# row selected`,other:`# rows selected`}),rowCount:e=>t(e,{one:`# row`,other:`# rows`}),range:(e,t,r)=>`${n(e)}–${n(t)} of ${n(r)}`,empty:`No rows`,noResults:`No matching rows`,resizeColumn:e=>`Resize ${e}`},chart:{showTable:`Show data table`,hideTable:`Hide data table`},timeline:{status:{complete:`Completed`,current:`Current step`,upcoming:`Upcoming`,error:`Error`},region:`Timeline`},treeView:{loading:`Loading…`,error:`Couldn't load items. Collapse and expand to try again.`},alert:{dismiss:`Dismiss`,prefix:{info:`Info: `,success:`Success: `,warning:`Warning: `,danger:`Error: `,neutral:`Note: `}},banner:{dismiss:`Dismiss banner`,region:`Announcement`},button:{loading:`Loading`},skeleton:{loading:`Loading…`},spinner:{loading:`Loading`},toast:{region:`Notifications`,dismiss:`Dismiss notification`,queued:e=>t(e,{one:`+# more notification`,other:`+# more notifications`}),tone:{info:`Info`,success:`Success`,warning:`Warning`,danger:`Error`,loading:`Loading`}},kbd:{then:`then`,keys:{command:`Command`,control:`Control`,windows:`Windows`,super:`Super`,option:`Option`,alt:`Alt`,shift:`Shift`,return:`Return`,enter:`Enter`,escape:`Escape`,tab:`Tab`,space:`Space`,delete:`Delete`,forwardDelete:`Forward Delete`,backspace:`Backspace`,capsLock:`Caps Lock`,up:`Up Arrow`,down:`Down Arrow`,left:`Left Arrow`,right:`Right Arrow`,pageUp:`Page Up`,pageDown:`Page Down`,home:`Home`,end:`End`}},colorPicker:{area:`Saturation and brightness`,areaRoleDescription:`2D slider`,saturation:`Saturation`,brightness:`Brightness`,hue:`Hue`,degrees:`degrees`,alpha:`Opacity`,input:`Color value`,invalidInput:`Enter a color like #1d4ed8, rgb(29, 78, 216), or hsl(224, 76%, 48%). The last valid color was kept.`,swatches:`Preset colors`,eyeDropper:`Pick a color from the screen`,eyeDropperPicked:e=>`Picked ${e}`,dialog:`Choose a color`,colors:{hues:{red:`red`,orange:`orange`,gold:`gold`,yellow:`yellow`,yellowGreen:`yellow-green`,green:`green`,teal:`teal`,cyan:`cyan`,blue:`blue`,purple:`purple`,magenta:`magenta`,pink:`pink`},black:`black`,white:`white`,gray:`gray`,brown:`brown`,olive:`olive`,dark:e=>`dark ${e}`,light:e=>`light ${e}`,muted:e=>`muted ${e}`,vivid:e=>`vivid ${e}`,withOpacity:(e,t)=>`${e}, ${t}% opacity`}},combobox:{loading:`Loading…`,empty:`No results`,results:e=>t(e,{one:`# result available`,other:`# results available`}),create:e=>`Create “${e}”`,clear:`Clear selection`,required:`Choose an option.`,showSuggestions:`Show suggestions`,hideSuggestions:`Hide suggestions`,selected:`Selected`,optionSelected:e=>`${e} selected`,optionRemoved:e=>`${e} removed`,cleared:`Selection cleared`},datePicker:{chooseDate:`Choose date`,changeDate:e=>`Change date, ${e}`,dialog:`Choose date`,format:e=>`Format: ${e}`,pattern:{day:`DD`,month:`MM`,year:`YYYY`},previousMonth:`Previous month`,nextMonth:`Next month`,startDate:`Start date`,endDate:`End date`,chooseDates:`Choose dates`,changeDates:e=>`Change dates, ${e}`,datesDialog:`Choose dates`,invalid:{unparseable:e=>`Enter a date as ${e}.`,between:(e,t)=>`Choose a date from ${e} to ${t}.`,onOrAfter:e=>`Choose a date on or after ${e}.`,onOrBefore:e=>`Choose a date on or before ${e}.`,unavailable:e=>`${e} isn't available. Choose another date.`,rangeBetween:(e,t)=>`Choose dates from ${e} to ${t}.`,rangeOnOrAfter:e=>`Choose dates on or after ${e}.`,rangeOnOrBefore:e=>`Choose dates on or before ${e}.`,endBeforeStart:`The end date must be on or after the start date.`,startAfterEnd:`The start date must be on or before the end date.`}},timePicker:{format:e=>`Example: ${e}`,showTimes:`Show times`,hideTimes:`Hide times`,date:`Date`,time:`Time`,invalid:{unparseable:e=>`Enter a time, for example ${e}.`,between:(e,t)=>`Choose a time from ${e} to ${t}.`,onOrAfter:e=>`Choose a time at or after ${e}.`,onOrBefore:e=>`Choose a time at or before ${e}.`}},fileUpload:{list:`Selected files`,remove:e=>`Remove ${e}`,uploaded:`Uploaded`,uploadFailed:`Upload failed`,uploading:`Uploading`,uploadingPercent:e=>`Uploading ${e}%`,progressFor:e=>`Upload progress for ${e}`,announceUploaded:e=>`${e} uploaded.`,announceFailed:e=>`${e} failed to upload.`,announceAdded:(e,r)=>{let i=[];return e&&i.push(t(e,{one:`# file added`,other:`# files added`})),r&&i.push(e?`${n(r)} rejected`:t(r,{one:`# file rejected`,other:`# files rejected`})),`${i.join(`, `)}.`},typeNotAccepted:`File type not accepted.`,typeNotAcceptedUse:e=>`File type not accepted. Use ${e}.`,tooLarge:e=>`File is larger than ${e}.`,tooSmall:e=>`File is smaller than ${e}.`,duplicate:`This file is already added.`,tooMany:e=>t(e,{one:`Too many files. You can add up to # file.`,other:`Too many files. You can add up to # files.`}),onlyOne:`Only one file can be added.`,upTo:e=>`up to ${e}`,upToEach:e=>`up to ${e} each`,maxFiles:e=>t(e,{one:`Up to # file`,other:`Up to # files`}),uploadFiles:`Upload files`,browseFiles:`Browse files`,dropFiles:`Drop files here or browse`,dropFile:`Drop a file here or browse`,required:`Required`,rejected:e=>t(e,{one:`# file couldn't be added`,other:`# files couldn't be added`}),dismissErrors:`Dismiss file errors`,typeGroups:{image:`images`,video:`videos`,audio:`audio`,text:`text files`},typeGroup:e=>`${e} files`,units:{B:`B`,KB:`KB`,MB:`MB`,GB:`GB`,TB:`TB`}},input:{clear:`Clear`},numberInput:{decrement:`Decrease`,increment:`Increase`},passwordInput:{show:`Show password`,capsLock:`Caps Lock is on`,strength:[`Too weak`,`Weak`,`Fair`,`Good`,`Strong`],strengthPrefix:`Strength:`,requirements:`Your password needs:`,met:`Met`,notMet:`Not met`,announceStrength:e=>`Password strength: ${e}.`,allMet:`All requirements met.`,someMet:(e,t)=>`${e} of ${t} requirements met.`},rating:{option:(e,t)=>`${e} out of ${t}`,display:(e,t)=>`Rated ${e} out of ${t}`,count:e=>t(e,{one:`(# review)`,other:`(# reviews)`}),clearHint:`Press Space on the selected rating, or Delete, to clear it.`,unrated:`Not rated`},searchInput:{clear:`Clear search`,results:e=>t(e,{"=0":`No results`,one:`# result`,other:`# results`}),search:`Search`},switch:{on:`On`,off:`Off`,saving:`Saving`},tagInput:{added:e=>e.length===1?`Added ${e[0]}`:`Added ${e.length} tags: ${e.join(`, `)}`,removed:e=>`Removed ${e}`,duplicate:e=>`${e} is already added`,invalid:e=>`"${e}" is not valid`,maxReached:e=>`Maximum of ${e} tags reached`,required:`Add at least one tag.`,empty:`None`,remove:e=>`Remove ${e}`,list:`Tags`,instructions:e=>`Press ${e} to add a tag. Backspace or the left arrow moves to added tags.`,keys:{enter:`Enter`,tab:`Tab`,comma:`a comma`,semicolon:`a semicolon`,space:`a space`,pipe:`a pipe`,other:e=>`"${e}"`}},textarea:{limitReached:`Character limit reached`,remaining:e=>t(e,{one:`# character remaining`,other:`# characters remaining`})},resizablePanels:{handle:`Resize panels`,resizePanel:e=>`Resize ${e}`},breadcrumbs:{nav:`Breadcrumb`,expand:e=>t(e,{one:`Show # more breadcrumb`,other:`Show # more breadcrumbs`})},contextMenu:{label:`Context menu`},navbar:{openMenu:`Open menu`,menu:`Menu`,nav:`Main`},pagination:{nav:`Pagination`,previous:`Previous page`,next:`Next page`,first:`First page`,last:`Last page`,currentPage:e=>`Page ${e}`,goToPage:e=>`Go to page ${e}`,status:`Page {page} of {total}`},sidebar:{nav:`Main navigation`,collapse:`Collapse sidebar`,expand:`Expand sidebar`},skipLink:{label:`Skip to main content`},stepper:{status:{complete:`Completed`,current:`Current`,upcoming:`Not started`,error:`Error`},nav:`Progress`,allComplete:e=>`All ${e} steps complete`,stepTitled:(e,t,n)=>`Step ${e} of ${t}: ${n}`,step:(e,t)=>`Step ${e} of ${t}`,count:(e,t)=>`${e} of ${t}`,prefix:e=>`Step ${e}: `},commandPalette:{label:`Command palette`,placeholder:`Type a command or search…`,list:`Commands`,loading:`Loading results…`,results:e=>t(e,{"=0":`No results`,one:`# result`,other:`# results`}),instructions:`Use the up and down arrow keys to move through results, Enter to run a command, and Escape to close.`,back:`Back`,hints:{navigate:`to navigate`,select:`to select`,back:`to go back`,close:`to close`}},auth:{or:`or`,unexpected:`Something went wrong. Try again.`,email:`Email`,username:`Username`,password:`Password`,signIn:{title:`Sign in`,submit:`Sign in`,remember:`Remember me`,forgot:`Forgot password?`,noAccount:`Don't have an account?`,signUp:`Create an account`},signUp:{title:`Create an account`,submit:`Create account`,name:`Name`,confirmPassword:`Confirm password`,mismatch:`The passwords don't match.`,termsRequired:`Accept the terms to continue.`,haveAccount:`Already have an account?`,signIn:`Sign in`},forgot:{title:`Reset your password`,description:`Enter your email and we'll send you a link to reset your password.`,submit:`Send reset link`,sent:e=>`If an account exists for ${e}, we sent it a link to reset your password.`,resend:`Send again`,back:`Back to sign in`},reset:{title:`Choose a new password`,password:`New password`,submit:`Save password`,done:`Your password has been changed.`},verify:{title:`Enter the code`,description:e=>`Enter the code we sent to ${e}.`,descriptionGeneric:`Enter the code we sent you.`,code:`Verification code`,submit:`Verify`,resend:`Resend code`,resendIn:e=>`Resend code in ${e}`,resent:`We sent a new code.`,incomplete:`Enter the full code.`}},validation:{required:`This field is required.`,email:`Enter an email address, like name@example.com.`,url:`Enter a web address, like https://example.com.`,ip:`Enter an IP address, like 192.168.0.1 or 2001:db8::1.`,ipv4:`Enter an IPv4 address, like 192.168.0.1.`,ipv6:`Enter an IPv6 address, like 2001:db8::1.`,number:`Enter a number.`,pattern:`Use the requested format.`,tooShort:e=>t(e,{one:`Use at least # character.`,other:`Use at least # characters.`}),tooLong:e=>t(e,{one:`Use # character or fewer.`,other:`Use # characters or fewer.`}),min:e=>`Enter ${e} or more.`,max:e=>`Enter ${e} or less.`,step:`Enter a valid value.`,invalid:`Enter a valid value.`,matches:`The values don't match.`,summaryTitle:e=>t(e,{one:`There is # problem`,other:`There are # problems`})},drawer:{close:`Close`},modal:{close:`Close`,confirm:`Confirm`,cancel:`Cancel`},popover:{close:`Close`}};exports.en=r;
|