@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
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { jsxs as u, jsx as r, Fragment as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { c as
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import { I as
|
|
6
|
-
import { u as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { jsxs as u, jsx as r, Fragment as ge } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ve, useId as be, useRef as v, useCallback as $, useLayoutEffect as ye, useImperativeHandle as xe, useMemo as Ie } from "react";
|
|
3
|
+
import { c as ke } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as Ce } from "react-i18next";
|
|
5
|
+
import { I as W } from "./icon-button-C4CGcYuz.js";
|
|
6
|
+
import { u as we } from "./use-controllable-state-BiY4xTzM.js";
|
|
7
|
+
import { u as Ne } from "./registry-C9nwlNyL.js";
|
|
8
|
+
import { c as Ve } from "./createLucideIcon-CrFbzy84.js";
|
|
9
|
+
import { C as ze } from "./circle-alert-ChA9opNA.js";
|
|
10
|
+
import { S as He } from "./send-CySZIRPJ.js";
|
|
10
11
|
/**
|
|
11
12
|
* @license lucide-react v1.8.0 - ISC
|
|
12
13
|
*
|
|
13
14
|
* This source code is licensed under the ISC license.
|
|
14
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
15
16
|
*/
|
|
16
|
-
const
|
|
17
|
+
const Ee = [
|
|
17
18
|
[
|
|
18
19
|
"path",
|
|
19
20
|
{
|
|
@@ -21,7 +22,7 @@ const Me = [
|
|
|
21
22
|
key: "1miecu"
|
|
22
23
|
}
|
|
23
24
|
]
|
|
24
|
-
],
|
|
25
|
+
], Me = Ve("paperclip", Ee), Te = {
|
|
25
26
|
id: "chat-input",
|
|
26
27
|
capabilities: ["edit_inline", "submit"],
|
|
27
28
|
state: {
|
|
@@ -44,8 +45,8 @@ const Me = [
|
|
|
44
45
|
argsType: "{ value: string }",
|
|
45
46
|
descriptionKey: "ui.agent.chatInput.actions.setValue",
|
|
46
47
|
description: "Replace the composer text.",
|
|
47
|
-
invoke: (t,
|
|
48
|
-
t.setValue(
|
|
48
|
+
invoke: (t, o) => {
|
|
49
|
+
t.setValue(o.value);
|
|
49
50
|
}
|
|
50
51
|
},
|
|
51
52
|
clear: {
|
|
@@ -85,7 +86,7 @@ const Me = [
|
|
|
85
86
|
description: "Sourced from the id prop."
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
|
-
},
|
|
89
|
+
}, Fe = ke(
|
|
89
90
|
[
|
|
90
91
|
"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)] ds:w-full",
|
|
91
92
|
// Uses the kit's shared input-chrome tokens — `--input` for fill,
|
|
@@ -110,137 +111,137 @@ const Me = [
|
|
|
110
111
|
defaultVariants: { size: "md" }
|
|
111
112
|
}
|
|
112
113
|
);
|
|
113
|
-
function
|
|
114
|
+
function Ke(t, o) {
|
|
114
115
|
if (typeof Intl < "u" && typeof Intl.Segmenter == "function")
|
|
115
116
|
try {
|
|
116
|
-
const
|
|
117
|
+
const b = new Intl.Segmenter(o, { granularity: "grapheme" });
|
|
117
118
|
let s = 0;
|
|
118
|
-
for (const
|
|
119
|
+
for (const E of b.segment(t)) s += 1;
|
|
119
120
|
return s;
|
|
120
121
|
} catch {
|
|
121
122
|
}
|
|
122
123
|
return Array.from(t).length;
|
|
123
124
|
}
|
|
124
|
-
const
|
|
125
|
+
const Re = ve(
|
|
125
126
|
({
|
|
126
127
|
size: t = "md",
|
|
127
|
-
value:
|
|
128
|
-
defaultValue:
|
|
128
|
+
value: o,
|
|
129
|
+
defaultValue: b,
|
|
129
130
|
maxLength: s,
|
|
130
|
-
submitOnEnter:
|
|
131
|
-
minRows:
|
|
132
|
-
maxRows:
|
|
133
|
-
onSubmit:
|
|
134
|
-
onAttach:
|
|
135
|
-
accept:
|
|
136
|
-
disabled:
|
|
137
|
-
toolbar:
|
|
138
|
-
label:
|
|
139
|
-
placeholder:
|
|
140
|
-
className:
|
|
141
|
-
onChange:
|
|
142
|
-
onKeyDown:
|
|
143
|
-
onCompositionStart:
|
|
144
|
-
onCompositionEnd:
|
|
145
|
-
id:
|
|
146
|
-
...
|
|
147
|
-
},
|
|
148
|
-
const { t:
|
|
149
|
-
|
|
150
|
-
}, []),
|
|
151
|
-
String(
|
|
152
|
-
|
|
153
|
-
|
|
131
|
+
submitOnEnter: E = !1,
|
|
132
|
+
minRows: y = 1,
|
|
133
|
+
maxRows: M = 8,
|
|
134
|
+
onSubmit: x,
|
|
135
|
+
onAttach: p,
|
|
136
|
+
accept: U,
|
|
137
|
+
disabled: m,
|
|
138
|
+
toolbar: Y,
|
|
139
|
+
label: T,
|
|
140
|
+
placeholder: q,
|
|
141
|
+
className: A,
|
|
142
|
+
onChange: I,
|
|
143
|
+
onKeyDown: k,
|
|
144
|
+
onCompositionStart: C,
|
|
145
|
+
onCompositionEnd: w,
|
|
146
|
+
id: N,
|
|
147
|
+
...G
|
|
148
|
+
}, J) => {
|
|
149
|
+
const { t: n, i18n: L } = Ce(), O = be(), f = v(!1), F = v(null), V = v(null), Q = $((e) => {
|
|
150
|
+
V.current = e;
|
|
151
|
+
}, []), [X, c] = we({
|
|
152
|
+
value: o === void 0 ? void 0 : String(o),
|
|
153
|
+
defaultValue: String(b ?? "")
|
|
154
|
+
}), a = X ?? "", z = Ke(a, L.language), h = typeof s == "number" && s > 0, Z = h ? Math.max(0, s - z) : 0, D = h && z > s * 0.9, l = h && z >= s, K = $(() => {
|
|
155
|
+
const e = V.current;
|
|
154
156
|
if (!e) return;
|
|
155
|
-
const
|
|
157
|
+
const i = window.getComputedStyle(e), g = parseFloat(i.lineHeight) || 24, de = parseFloat(i.paddingTop) || 0, ue = parseFloat(i.paddingBottom) || 0, pe = parseFloat(i.borderTopWidth) || 0, me = parseFloat(i.borderBottomWidth) || 0, P = de + ue + pe + me, fe = g * y + P, _ = g * M + P;
|
|
156
158
|
e.style.height = "auto";
|
|
157
|
-
const
|
|
158
|
-
e.style.height = `${
|
|
159
|
-
}, [
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}, [
|
|
163
|
-
const
|
|
164
|
-
|
|
159
|
+
const he = Math.max(fe, Math.min(e.scrollHeight, _));
|
|
160
|
+
e.style.height = `${he}px`, e.style.overflowY = e.scrollHeight > _ ? "auto" : "hidden";
|
|
161
|
+
}, [y, M]);
|
|
162
|
+
ye(() => {
|
|
163
|
+
K();
|
|
164
|
+
}, [K, a]);
|
|
165
|
+
const ee = (e) => {
|
|
166
|
+
c(e.target.value), !f.current && (I == null || I(e));
|
|
167
|
+
}, te = (e) => {
|
|
168
|
+
f.current = !0, C == null || C(e);
|
|
165
169
|
}, se = (e) => {
|
|
166
|
-
|
|
167
|
-
}, ae = (e) => {
|
|
168
|
-
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
ke(L, () => j.current, []);
|
|
173
|
-
const ne = Ce(
|
|
170
|
+
f.current = !1, w == null || w(e);
|
|
171
|
+
}, ae = (e) => e.nativeEvent.isComposing || e.keyCode === 229 || f.current, H = () => {
|
|
172
|
+
!a.trim() || m || l || (x == null || x(a), c(""));
|
|
173
|
+
}, R = v(null);
|
|
174
|
+
xe(J, () => R.current, []);
|
|
175
|
+
const re = Ie(
|
|
174
176
|
() => ({
|
|
175
177
|
getValue: () => a,
|
|
176
178
|
isEmpty: () => !a.trim(),
|
|
177
179
|
setValue: (e) => {
|
|
178
|
-
|
|
180
|
+
c(e);
|
|
179
181
|
},
|
|
180
182
|
clear: () => {
|
|
181
|
-
|
|
183
|
+
c("");
|
|
182
184
|
},
|
|
183
185
|
submit: () => {
|
|
184
|
-
|
|
186
|
+
H();
|
|
185
187
|
},
|
|
186
188
|
focus: () => {
|
|
187
189
|
var e;
|
|
188
|
-
(e =
|
|
190
|
+
(e = V.current) == null || e.focus();
|
|
189
191
|
}
|
|
190
192
|
}),
|
|
191
193
|
// `submit` is a local closure that always sees the latest currentValue
|
|
192
|
-
// via React's render cycle — depend on currentValue
|
|
193
|
-
//
|
|
194
|
+
// via React's render cycle — depend on currentValue so the handle
|
|
195
|
+
// picks up new values across renders.
|
|
194
196
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
195
|
-
[a,
|
|
197
|
+
[a, c]
|
|
196
198
|
);
|
|
197
|
-
|
|
198
|
-
const
|
|
199
|
-
if (
|
|
200
|
-
const
|
|
201
|
-
(
|
|
199
|
+
Ne(Te, re, N);
|
|
200
|
+
const ne = (e) => {
|
|
201
|
+
if (k == null || k(e), !e.defaultPrevented && !ae(e) && e.key === "Enter") {
|
|
202
|
+
const i = e.metaKey || e.ctrlKey, g = E && !e.shiftKey;
|
|
203
|
+
(i || g) && (e.preventDefault(), H());
|
|
202
204
|
}
|
|
203
|
-
},
|
|
205
|
+
}, ie = () => {
|
|
204
206
|
var e;
|
|
205
|
-
(e =
|
|
206
|
-
},
|
|
207
|
-
e.target.files && e.target.files.length > 0 && (
|
|
208
|
-
}, d =
|
|
207
|
+
(e = F.current) == null || e.click();
|
|
208
|
+
}, oe = (e) => {
|
|
209
|
+
e.target.files && e.target.files.length > 0 && (p == null || p(e.target.files)), e.target.value = "";
|
|
210
|
+
}, d = N ?? O, S = `${d}-label`, j = h ? `${d}-counter` : void 0, B = `${d}-hint`, ce = q ?? n("chat.input.placeholder"), le = T ?? n("chat.prompt");
|
|
209
211
|
return /* @__PURE__ */ u(
|
|
210
212
|
"div",
|
|
211
213
|
{
|
|
212
|
-
ref:
|
|
214
|
+
ref: R,
|
|
213
215
|
"data-component": "chat-input",
|
|
214
|
-
"data-component-id":
|
|
215
|
-
className:
|
|
216
|
+
"data-component-id": N,
|
|
217
|
+
className: Fe({ size: t, className: A }),
|
|
216
218
|
children: [
|
|
217
219
|
/* @__PURE__ */ r(
|
|
218
220
|
"label",
|
|
219
221
|
{
|
|
220
|
-
id:
|
|
222
|
+
id: S,
|
|
221
223
|
htmlFor: d,
|
|
222
|
-
className:
|
|
223
|
-
children:
|
|
224
|
+
className: T ? "type-label ds:ps-[var(--spacing-sm)] ds:pt-[var(--spacing-sm)]" : "ds:sr-only",
|
|
225
|
+
children: le
|
|
224
226
|
}
|
|
225
227
|
),
|
|
226
228
|
/* @__PURE__ */ r(
|
|
227
229
|
"textarea",
|
|
228
230
|
{
|
|
229
|
-
ref:
|
|
231
|
+
ref: Q,
|
|
230
232
|
id: d,
|
|
231
|
-
value:
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
rows: x,
|
|
233
|
+
value: a,
|
|
234
|
+
disabled: m,
|
|
235
|
+
rows: y,
|
|
235
236
|
maxLength: s,
|
|
236
|
-
placeholder:
|
|
237
|
-
"aria-labelledby":
|
|
238
|
-
"aria-describedby": [
|
|
237
|
+
placeholder: ce,
|
|
238
|
+
"aria-labelledby": S,
|
|
239
|
+
"aria-describedby": [j, B].filter(Boolean).join(" ") || void 0,
|
|
239
240
|
"aria-invalid": l || void 0,
|
|
240
|
-
onChange:
|
|
241
|
-
onKeyDown:
|
|
242
|
-
onCompositionStart:
|
|
243
|
-
onCompositionEnd:
|
|
241
|
+
onChange: ee,
|
|
242
|
+
onKeyDown: ne,
|
|
243
|
+
onCompositionStart: te,
|
|
244
|
+
onCompositionEnd: se,
|
|
244
245
|
className: [
|
|
245
246
|
"ds:w-full ds:resize-none ds:bg-transparent",
|
|
246
247
|
"ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)] ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-xs)]",
|
|
@@ -256,42 +257,42 @@ const je = ye(
|
|
|
256
257
|
"ds:rounded-[var(--radius-sm)]",
|
|
257
258
|
"ds:forced-colors:focus-visible:outline-[CanvasText]"
|
|
258
259
|
].join(" "),
|
|
259
|
-
...
|
|
260
|
+
...G
|
|
260
261
|
}
|
|
261
262
|
),
|
|
262
263
|
/* @__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: [
|
|
263
|
-
|
|
264
|
+
p ? /* @__PURE__ */ u(ge, { children: [
|
|
264
265
|
/* @__PURE__ */ r(
|
|
265
266
|
"input",
|
|
266
267
|
{
|
|
267
|
-
ref:
|
|
268
|
+
ref: F,
|
|
268
269
|
type: "file",
|
|
269
270
|
className: "ds:sr-only",
|
|
270
271
|
multiple: !0,
|
|
271
|
-
accept:
|
|
272
|
-
onChange:
|
|
273
|
-
"aria-label":
|
|
272
|
+
accept: U,
|
|
273
|
+
onChange: oe,
|
|
274
|
+
"aria-label": n("chat.input.attach"),
|
|
274
275
|
tabIndex: -1
|
|
275
276
|
}
|
|
276
277
|
),
|
|
277
278
|
/* @__PURE__ */ r(
|
|
278
|
-
|
|
279
|
+
W,
|
|
279
280
|
{
|
|
280
|
-
icon: /* @__PURE__ */ r(
|
|
281
|
-
"aria-label":
|
|
281
|
+
icon: /* @__PURE__ */ r(Me, {}),
|
|
282
|
+
"aria-label": n("chat.input.attach"),
|
|
282
283
|
intent: "ghost",
|
|
283
284
|
size: "sm",
|
|
284
|
-
onClick:
|
|
285
|
-
disabled:
|
|
285
|
+
onClick: ie,
|
|
286
|
+
disabled: m
|
|
286
287
|
}
|
|
287
288
|
)
|
|
288
289
|
] }) : null,
|
|
289
|
-
|
|
290
|
+
Y,
|
|
290
291
|
/* @__PURE__ */ u("div", { className: "ds:ms-auto ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
|
|
291
|
-
|
|
292
|
+
D ? /* @__PURE__ */ u(
|
|
292
293
|
"span",
|
|
293
294
|
{
|
|
294
|
-
id:
|
|
295
|
+
id: j,
|
|
295
296
|
"aria-live": "polite",
|
|
296
297
|
className: [
|
|
297
298
|
"ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]",
|
|
@@ -302,22 +303,22 @@ const je = ye(
|
|
|
302
303
|
l ? (
|
|
303
304
|
// Icon pairs with --destructive colour so the at-limit
|
|
304
305
|
// state is not conveyed by hue alone (WCAG 1.4.1).
|
|
305
|
-
/* @__PURE__ */ r(
|
|
306
|
+
/* @__PURE__ */ r(ze, { "aria-hidden": "true", className: "ds:size-3.5" })
|
|
306
307
|
) : null,
|
|
307
|
-
|
|
308
|
+
n("chat.input.remaining", { count: Z })
|
|
308
309
|
]
|
|
309
310
|
}
|
|
310
311
|
) : null,
|
|
311
|
-
/* @__PURE__ */ r("span", { id:
|
|
312
|
+
/* @__PURE__ */ r("span", { id: B, className: "ds:sr-only", children: n("chat.input.sendHint") }),
|
|
312
313
|
/* @__PURE__ */ r(
|
|
313
|
-
|
|
314
|
+
W,
|
|
314
315
|
{
|
|
315
|
-
icon: /* @__PURE__ */ r(
|
|
316
|
-
"aria-label":
|
|
316
|
+
icon: /* @__PURE__ */ r(He, {}),
|
|
317
|
+
"aria-label": n("chat.send"),
|
|
317
318
|
intent: "primary",
|
|
318
319
|
size: "sm",
|
|
319
|
-
disabled:
|
|
320
|
-
onClick:
|
|
320
|
+
disabled: m || !a.trim() || l,
|
|
321
|
+
onClick: H,
|
|
321
322
|
"aria-keyshortcuts": "Meta+Enter Control+Enter"
|
|
322
323
|
}
|
|
323
324
|
)
|
|
@@ -328,9 +329,9 @@ const je = ye(
|
|
|
328
329
|
);
|
|
329
330
|
}
|
|
330
331
|
);
|
|
331
|
-
|
|
332
|
+
Re.displayName = "ChatInput";
|
|
332
333
|
export {
|
|
333
|
-
|
|
334
|
-
|
|
334
|
+
Re as C,
|
|
335
|
+
Te as c
|
|
335
336
|
};
|
|
336
|
-
//# sourceMappingURL=chat-input-
|
|
337
|
+
//# sourceMappingURL=chat-input-B3XmFGDw.js.map
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { jsx as t, jsxs as B } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as O, useId as Q, useMemo as S, useState as T, useRef as W, Children as X, isValidElement as Y } from "react";
|
|
3
|
+
import { c as Z } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as V } from "react-i18next";
|
|
5
|
+
import { u as ee } from "./use-controllable-state-BiY4xTzM.js";
|
|
6
|
+
import { C as M, a as te } from "./checkbox-mwbrPZDY.js";
|
|
7
|
+
import { u as se } from "./registry-C9nwlNyL.js";
|
|
8
|
+
import { C as ce } from "./circle-alert-ChA9opNA.js";
|
|
9
|
+
const re = {
|
|
10
|
+
id: "checkbox-group",
|
|
11
|
+
capabilities: ["select_multiple"],
|
|
12
|
+
state: {
|
|
13
|
+
selection: {
|
|
14
|
+
type: "string[]",
|
|
15
|
+
descriptionKey: "ui.agent.checkboxGroup.state.selection",
|
|
16
|
+
description: "Values of currently-checked options.",
|
|
17
|
+
read: (s) => s.getSelection()
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
actions: {
|
|
21
|
+
set_selection: {
|
|
22
|
+
safety: "write",
|
|
23
|
+
argsType: "{ ids: string[] }",
|
|
24
|
+
descriptionKey: "ui.agent.checkboxGroup.actions.setSelection",
|
|
25
|
+
description: "Replace the current selection with the given option values.",
|
|
26
|
+
invoke: (s, a) => {
|
|
27
|
+
s.setSelection(a.ids);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
clear_selection: {
|
|
31
|
+
safety: "destructive",
|
|
32
|
+
descriptionKey: "ui.agent.checkboxGroup.actions.clearSelection",
|
|
33
|
+
description: "Uncheck every option in the group.",
|
|
34
|
+
invoke: (s) => {
|
|
35
|
+
s.clearSelection();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
domHooks: {
|
|
40
|
+
root: {
|
|
41
|
+
attr: "data-component",
|
|
42
|
+
value: "checkbox-group",
|
|
43
|
+
description: "Marks the CheckboxGroup fieldset."
|
|
44
|
+
},
|
|
45
|
+
instanceId: {
|
|
46
|
+
attr: "data-component-id",
|
|
47
|
+
sourceProp: "id",
|
|
48
|
+
description: "Sourced from the id prop."
|
|
49
|
+
},
|
|
50
|
+
item: {
|
|
51
|
+
attr: "data-option-id",
|
|
52
|
+
description: "Stable opaque value emitted on each rendered Checkbox child within the group."
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}, le = Z("", {
|
|
56
|
+
variants: {
|
|
57
|
+
orientation: {
|
|
58
|
+
vertical: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
|
|
59
|
+
horizontal: "ds:flex ds:flex-wrap ds:gap-x-[var(--spacing-lg)] ds:gap-y-[var(--spacing-sm)]"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
defaultVariants: { orientation: "vertical" }
|
|
63
|
+
});
|
|
64
|
+
function ae(s) {
|
|
65
|
+
const a = [];
|
|
66
|
+
return X.forEach(s, (h) => {
|
|
67
|
+
if (!Y(h)) return;
|
|
68
|
+
const m = h.props;
|
|
69
|
+
typeof m.value == "string" && a.push(m.value);
|
|
70
|
+
}), a;
|
|
71
|
+
}
|
|
72
|
+
const oe = O(
|
|
73
|
+
({
|
|
74
|
+
label: s,
|
|
75
|
+
value: a,
|
|
76
|
+
onChange: h,
|
|
77
|
+
name: m,
|
|
78
|
+
id: g,
|
|
79
|
+
orientation: K = "vertical",
|
|
80
|
+
disabled: G = !1,
|
|
81
|
+
min: o,
|
|
82
|
+
max: i,
|
|
83
|
+
onConstraintViolation: c,
|
|
84
|
+
withSelectAll: _ = !1,
|
|
85
|
+
options: d,
|
|
86
|
+
error: f,
|
|
87
|
+
helperText: v,
|
|
88
|
+
className: $,
|
|
89
|
+
children: b
|
|
90
|
+
}, z) => {
|
|
91
|
+
const { t: u } = V(), x = Q(), N = `${x}-helper`, R = `${x}-error`, w = `${x}-counter`, [E, C] = ee({
|
|
92
|
+
value: a,
|
|
93
|
+
defaultValue: [],
|
|
94
|
+
onChange: h
|
|
95
|
+
}), r = E ?? [], I = S(() => new Set(r), [r]), [H, l] = T(""), k = S(
|
|
96
|
+
() => d ? d.map((e) => e.value) : ae(b),
|
|
97
|
+
[d, b]
|
|
98
|
+
), n = (e) => {
|
|
99
|
+
C(e);
|
|
100
|
+
}, A = W(r);
|
|
101
|
+
A.current = r;
|
|
102
|
+
const P = S(
|
|
103
|
+
() => ({
|
|
104
|
+
getSelection: () => A.current.slice(),
|
|
105
|
+
setSelection: (e) => n(e),
|
|
106
|
+
clearSelection: () => n([])
|
|
107
|
+
}),
|
|
108
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
109
|
+
[C]
|
|
110
|
+
);
|
|
111
|
+
se(re, P, g);
|
|
112
|
+
const q = {
|
|
113
|
+
name: m,
|
|
114
|
+
value: I,
|
|
115
|
+
toggle: (e) => {
|
|
116
|
+
if (I.has(e)) {
|
|
117
|
+
if (typeof o == "number" && r.length <= o) {
|
|
118
|
+
l(u("inputs.checkboxGroup.minReached", { min: o })), c == null || c("min");
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
l(""), n(r.filter((L) => L !== e));
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (typeof i == "number" && r.length >= i) {
|
|
125
|
+
l(u("inputs.checkboxGroup.maxReached", { max: i })), c == null || c("max");
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
l(""), n([...r, e]);
|
|
129
|
+
},
|
|
130
|
+
disabled: G
|
|
131
|
+
}, p = k.length, y = r.length, j = p === 0 || y === 0 ? !1 : y >= p ? !0 : "indeterminate", U = () => {
|
|
132
|
+
if (j === !0) {
|
|
133
|
+
if (typeof o == "number" && o > 0) {
|
|
134
|
+
l(u("inputs.checkboxGroup.minReached", { min: o })), c == null || c("min");
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
n([]), l("");
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const e = typeof i == "number" ? k.slice(0, i) : k;
|
|
141
|
+
n(e), l("");
|
|
142
|
+
}, D = [
|
|
143
|
+
v ? N : null,
|
|
144
|
+
f ? R : null,
|
|
145
|
+
p > 0 ? w : null
|
|
146
|
+
].filter(Boolean).join(" ") || void 0, F = b ?? (d ? d.map((e) => /* @__PURE__ */ t(
|
|
147
|
+
M,
|
|
148
|
+
{
|
|
149
|
+
value: e.value,
|
|
150
|
+
label: e.label,
|
|
151
|
+
disabled: e.disabled
|
|
152
|
+
},
|
|
153
|
+
e.value
|
|
154
|
+
)) : null), J = [
|
|
155
|
+
"ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:min-w-0 ds:border-0 ds:p-0 ds:m-0",
|
|
156
|
+
$
|
|
157
|
+
].filter(Boolean).join(" ");
|
|
158
|
+
return /* @__PURE__ */ B(
|
|
159
|
+
"fieldset",
|
|
160
|
+
{
|
|
161
|
+
ref: z,
|
|
162
|
+
id: g,
|
|
163
|
+
className: J,
|
|
164
|
+
"aria-describedby": D,
|
|
165
|
+
"aria-invalid": !!f || void 0,
|
|
166
|
+
"data-component": "checkbox-group",
|
|
167
|
+
"data-component-id": g,
|
|
168
|
+
children: [
|
|
169
|
+
/* @__PURE__ */ t("legend", { className: "type-label ds:text-foreground ds:p-0 ds:mb-[var(--spacing-sm)]", children: s }),
|
|
170
|
+
_ ? /* @__PURE__ */ t(
|
|
171
|
+
M,
|
|
172
|
+
{
|
|
173
|
+
label: u("inputs.checkboxGroup.selectAll"),
|
|
174
|
+
checked: j,
|
|
175
|
+
onCheckedChange: U,
|
|
176
|
+
disabled: G
|
|
177
|
+
}
|
|
178
|
+
) : null,
|
|
179
|
+
/* @__PURE__ */ t(te.Provider, { value: q, children: /* @__PURE__ */ t("div", { className: le({ orientation: K }), children: F }) }),
|
|
180
|
+
v ? /* @__PURE__ */ t("p", { id: N, className: "type-body-sm ds:text-muted-foreground", children: v }) : null,
|
|
181
|
+
f ? /* @__PURE__ */ B(
|
|
182
|
+
"p",
|
|
183
|
+
{
|
|
184
|
+
id: R,
|
|
185
|
+
role: "alert",
|
|
186
|
+
className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-body-sm ds:text-destructive",
|
|
187
|
+
children: [
|
|
188
|
+
/* @__PURE__ */ t(ce, { "aria-hidden": "true", className: "ds:size-4 ds:shrink-0" }),
|
|
189
|
+
/* @__PURE__ */ t("span", { children: f })
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
) : null,
|
|
193
|
+
/* @__PURE__ */ t(
|
|
194
|
+
"span",
|
|
195
|
+
{
|
|
196
|
+
id: w,
|
|
197
|
+
role: "status",
|
|
198
|
+
"aria-live": "polite",
|
|
199
|
+
className: "ds:sr-only",
|
|
200
|
+
children: p > 0 ? u("inputs.checkboxGroup.counter", { count: y, total: p }) : ""
|
|
201
|
+
}
|
|
202
|
+
),
|
|
203
|
+
/* @__PURE__ */ t("span", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: H })
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
oe.displayName = "CheckboxGroup";
|
|
210
|
+
export {
|
|
211
|
+
oe as C
|
|
212
|
+
};
|
|
213
|
+
//# sourceMappingURL=checkbox-group-Bwmt1ovQ.js.map
|