@alfadocs/ui-kit 0.17.1 → 0.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/_chunks/{accordion-DOmxGEWU.js → accordion-CNcodXuO.js} +6 -6
  2. package/dist/_chunks/{ai-prompt-input-DEiQwIMn.js → ai-prompt-input-B-w5Rx3V.js} +184 -181
  3. package/dist/_chunks/{alert-pgdXrEO5.js → alert-DBnawbmf.js} +64 -59
  4. package/dist/_chunks/{audio-recorder-CRh4uyFL.js → audio-recorder-DNkQLW1G.js} +3 -3
  5. package/dist/_chunks/{autocomplete-mOg7WLOh.js → autocomplete-BxfabhZ8.js} +167 -164
  6. package/dist/_chunks/{balance-cell-renderer-DWWtX-VM.js → balance-cell-renderer-DJB6WDPe.js} +2 -2
  7. package/dist/_chunks/{chat-input-UK-bXU7u.js → chat-input-B3XmFGDw.js} +123 -122
  8. package/dist/_chunks/checkbox-group-Bwmt1ovQ.js +213 -0
  9. package/dist/_chunks/{checkbox-D5EHnB14.js → checkbox-mwbrPZDY.js} +75 -70
  10. package/dist/_chunks/{collapsible-CuxUBoHJ.js → collapsible-hHiyZp0b.js} +61 -63
  11. package/dist/_chunks/{color-picker-BPfcByHH.js → color-picker-Bm-gzpsh.js} +2 -2
  12. package/dist/_chunks/{combobox-D5tWe0t_.js → combobox-Da9eq00i.js} +214 -211
  13. package/dist/_chunks/{copy-field-BCHAZ8QV.js → copy-field-BAF4mt9h.js} +95 -132
  14. package/dist/_chunks/{date-picker-BlhtBhPo.js → date-picker-BIoSLRly.js} +222 -219
  15. package/dist/_chunks/{date-range-picker-C2hRu_Ke.js → date-range-picker-9gANFNG9.js} +81 -78
  16. package/dist/_chunks/{date-time-picker-B67mPZmP.js → date-time-picker-DG7BiGdb.js} +98 -95
  17. package/dist/_chunks/{dialog-DRp6Dejy.js → dialog-DUomPCRS.js} +69 -71
  18. package/dist/_chunks/{dropdown-menu-dyV7gHh_.js → dropdown-menu-DZxwF23X.js} +108 -110
  19. package/dist/_chunks/{freemium-paywall-BTEiVkes.js → freemium-paywall-DXc7XlGE.js} +98 -97
  20. package/dist/_chunks/{leo-sidebar-D3TuyH5_.js → leo-sidebar-DIsiTju3.js} +2 -2
  21. package/dist/_chunks/{list-DcjV0m5B.js → list-BdvDctBz.js} +184 -180
  22. package/dist/_chunks/{message-tray-Fsend-du.js → message-tray-BNAS8al4.js} +111 -111
  23. package/dist/_chunks/{multi-select-DooDzQIp.js → multi-select-CyspR5ZF.js} +157 -154
  24. package/dist/_chunks/{navigation-menu-DdufF-_4.js → navigation-menu-CyS1fBJ7.js} +85 -87
  25. package/dist/_chunks/{notification-tray-C3dYdLAF.js → notification-tray-D_69dXFY.js} +114 -114
  26. package/dist/_chunks/{number-input-DH00o0DN.js → number-input-BZXu6bPY.js} +92 -89
  27. package/dist/_chunks/{otp-input-BBXYvLx5.js → otp-input-BDF_iNpa.js} +92 -93
  28. package/dist/_chunks/{pagination-F1ei4khE.js → pagination-BWaXF7W0.js} +194 -211
  29. package/dist/_chunks/{patient-shell-BE0CdPOJ.js → patient-shell-BOOaWZA9.js} +3 -3
  30. package/dist/_chunks/{payment-form-CI77oIx1.js → payment-form-BjkuQeqR.js} +2 -2
  31. package/dist/_chunks/{pdf-viewer-CnEJvmXC.js → pdf-viewer-BG_nsFT5.js} +2 -2
  32. package/dist/_chunks/{radio-group-Cz1a4QCA.js → radio-group-BHZOxrIK.js} +4 -4
  33. package/dist/_chunks/{select-Ca6ibiDL.js → select-C92AT_OZ.js} +7 -7
  34. package/dist/_chunks/{sidebar-D8Lq065m.js → sidebar-BqzlRBvC.js} +271 -291
  35. package/dist/_chunks/{slider-CkR6CLun.js → slider-CfEzeseL.js} +4 -4
  36. package/dist/_chunks/{tabs-CRCyPpJo.js → tabs-aEQfQV3x.js} +8 -8
  37. package/dist/_chunks/{theme-toggle-B3meAb3y.js → theme-toggle-BswYl0Yp.js} +2 -2
  38. package/dist/_chunks/use-controllable-state-BiY4xTzM.js +23 -0
  39. package/dist/_chunks/use-copy-to-clipboard-Cyfc_dlv.js +43 -0
  40. package/dist/_chunks/use-persistent-state-i23OWy6G.js +24 -0
  41. package/dist/_chunks/{warning-stack-CeRihME9.js → warning-stack-CDH9TudY.js} +2 -2
  42. package/dist/_chunks/{workflow-map-D3MvrsZV.js → workflow-map-BeKe23uw.js} +3 -3
  43. package/dist/agent-catalog.json +1 -1
  44. package/dist/components/_shared/use-debounced-callback.d.ts +1 -5
  45. package/dist/components/_shared/use-direction.d.ts +1 -18
  46. package/dist/components/_shared/use-focus-trap.d.ts +1 -31
  47. package/dist/components/accordion/index.js +1 -1
  48. package/dist/components/ai-prompt-input/index.js +1 -1
  49. package/dist/components/alert/index.js +1 -1
  50. package/dist/components/audio-recorder/index.js +1 -1
  51. package/dist/components/autocomplete/index.js +1 -1
  52. package/dist/components/chat-input/index.js +1 -1
  53. package/dist/components/checkbox/index.js +1 -1
  54. package/dist/components/checkbox-group/index.js +1 -1
  55. package/dist/components/collapsible/index.js +1 -1
  56. package/dist/components/color-picker/index.js +1 -1
  57. package/dist/components/combobox/index.js +1 -1
  58. package/dist/components/command-palette/command-palette.d.ts +1 -1
  59. package/dist/components/copy-field/index.js +1 -1
  60. package/dist/components/data-table/index.js +1 -1
  61. package/dist/components/date-picker/index.js +1 -1
  62. package/dist/components/date-range-picker/index.js +1 -1
  63. package/dist/components/date-time-picker/index.js +1 -1
  64. package/dist/components/dialog/index.js +1 -1
  65. package/dist/components/dropdown-menu/index.js +1 -1
  66. package/dist/components/freemium-paywall/index.js +1 -1
  67. package/dist/components/icon-button-group/icon-button-group.d.ts +14 -14
  68. package/dist/components/list/index.js +1 -1
  69. package/dist/components/message-tray/index.js +1 -1
  70. package/dist/components/multi-select/index.js +1 -1
  71. package/dist/components/navigation-menu/index.js +1 -1
  72. package/dist/components/notification-tray/index.js +1 -1
  73. package/dist/components/number-input/index.js +1 -1
  74. package/dist/components/otp-input/index.js +1 -1
  75. package/dist/components/pagination/index.js +1 -1
  76. package/dist/components/payment-form/index.js +1 -1
  77. package/dist/components/pdf-viewer/index.js +1 -1
  78. package/dist/components/radio-group/index.js +1 -1
  79. package/dist/components/select/index.js +1 -1
  80. package/dist/components/sidebar/index.js +8 -7
  81. package/dist/components/sidebar/sidebar.d.ts +1 -1
  82. package/dist/components/slider/index.js +1 -1
  83. package/dist/components/tabs/index.js +1 -1
  84. package/dist/components/theme-toggle/index.js +1 -1
  85. package/dist/components/warning-stack/index.js +1 -1
  86. package/dist/components/workflow/index.js +1 -1
  87. package/dist/hooks/index.d.ts +8 -0
  88. package/dist/hooks/index.js +98 -15
  89. package/dist/hooks/use-debounced-callback.d.ts +19 -0
  90. package/dist/hooks/use-debounced-value.d.ts +16 -0
  91. package/dist/hooks/use-direction.d.ts +19 -0
  92. package/dist/hooks/use-focus-trap.d.ts +32 -0
  93. package/dist/hooks/use-isomorphic-layout-effect.d.ts +13 -0
  94. package/dist/hooks/use-persistent-state.d.ts +16 -0
  95. package/dist/index.js +493 -492
  96. package/dist/patterns/leo-assistant/index.js +1 -1
  97. package/dist/patterns/patient-shell/index.js +1 -1
  98. package/dist/tokens.css +1 -1
  99. package/package.json +4 -2
  100. package/dist/_chunks/checkbox-group-Qkm3Rg1S.js +0 -208
@@ -1,19 +1,20 @@
1
- import { jsxs as u, jsx as r, Fragment as ve } from "react/jsx-runtime";
2
- import { forwardRef as ye, useId as be, useRef as b, useCallback as W, useState as xe, useLayoutEffect as Ie, useImperativeHandle as ke, useMemo as Ce } from "react";
3
- import { c as we } from "./index-D2ZczOXr.js";
4
- import { useTranslation as Ne } from "react-i18next";
5
- import { I as U } from "./icon-button-C4CGcYuz.js";
6
- import { u as ze } from "./registry-C9nwlNyL.js";
7
- import { c as He } from "./createLucideIcon-CrFbzy84.js";
8
- import { C as Ve } from "./circle-alert-ChA9opNA.js";
9
- import { S as Ee } from "./send-CySZIRPJ.js";
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 Me = [
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
- ], Te = He("paperclip", Me), Fe = {
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, c) => {
48
- t.setValue(c.value);
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
- }, Ke = we(
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 Se(t, c) {
114
+ function Ke(t, o) {
114
115
  if (typeof Intl < "u" && typeof Intl.Segmenter == "function")
115
116
  try {
116
- const p = new Intl.Segmenter(c, { granularity: "grapheme" });
117
+ const b = new Intl.Segmenter(o, { granularity: "grapheme" });
117
118
  let s = 0;
118
- for (const M of p.segment(t)) s += 1;
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 je = ye(
125
+ const Re = ve(
125
126
  ({
126
127
  size: t = "md",
127
- value: c,
128
- defaultValue: p,
128
+ value: o,
129
+ defaultValue: b,
129
130
  maxLength: s,
130
- submitOnEnter: M = !1,
131
- minRows: x = 1,
132
- maxRows: T = 8,
133
- onSubmit: I,
134
- onAttach: m,
135
- accept: Y,
136
- disabled: f,
137
- toolbar: q,
138
- label: F,
139
- placeholder: A,
140
- className: G,
141
- onChange: k,
142
- onKeyDown: C,
143
- onCompositionStart: w,
144
- onCompositionEnd: N,
145
- id: z,
146
- ...J
147
- }, L) => {
148
- const { t: i, i18n: O } = Ne(), Q = be(), h = b(!1), K = b(null), H = b(null), X = W((e) => {
149
- H.current = e;
150
- }, []), n = c !== void 0, [Z, g] = xe(
151
- String(p ?? "")
152
- ), a = n ? String(c) : Z, V = Se(a, O.language), v = typeof s == "number" && s > 0, D = v ? Math.max(0, s - V) : 0, ee = v && V > s * 0.9, l = v && V >= s, S = W(() => {
153
- const e = H.current;
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 o = window.getComputedStyle(e), y = parseFloat(o.lineHeight) || 24, ue = parseFloat(o.paddingTop) || 0, pe = parseFloat(o.paddingBottom) || 0, me = parseFloat(o.borderTopWidth) || 0, fe = parseFloat(o.borderBottomWidth) || 0, _ = ue + pe + me + fe, he = y * x + _, $ = y * T + _;
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 ge = Math.max(he, Math.min(e.scrollHeight, $));
158
- e.style.height = `${ge}px`, e.style.overflowY = e.scrollHeight > $ ? "auto" : "hidden";
159
- }, [x, T]);
160
- Ie(() => {
161
- S();
162
- }, [S, a]);
163
- const te = (e) => {
164
- n || g(e.target.value), !h.current && (k == null || k(e));
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
- h.current = !0, w == null || w(e);
167
- }, ae = (e) => {
168
- h.current = !1, N == null || N(e);
169
- }, re = (e) => e.nativeEvent.isComposing || e.keyCode === 229 || h.current, E = () => {
170
- !a.trim() || f || l || (I == null || I(a), n || g(""));
171
- }, j = b(null);
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
- n || g(e);
180
+ c(e);
179
181
  },
180
182
  clear: () => {
181
- n || g("");
183
+ c("");
182
184
  },
183
185
  submit: () => {
184
- E();
186
+ H();
185
187
  },
186
188
  focus: () => {
187
189
  var e;
188
- (e = H.current) == null || e.focus();
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 + isControlled so
193
- // the handle picks up new values across renders.
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, n]
197
+ [a, c]
196
198
  );
197
- ze(Fe, ne, z);
198
- const ie = (e) => {
199
- if (C == null || C(e), !e.defaultPrevented && !re(e) && e.key === "Enter") {
200
- const o = e.metaKey || e.ctrlKey, y = M && !e.shiftKey;
201
- (o || y) && (e.preventDefault(), E());
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
- }, oe = () => {
205
+ }, ie = () => {
204
206
  var e;
205
- (e = K.current) == null || e.click();
206
- }, ce = (e) => {
207
- e.target.files && e.target.files.length > 0 && (m == null || m(e.target.files)), e.target.value = "";
208
- }, d = z ?? Q, B = `${d}-label`, R = v ? `${d}-counter` : void 0, P = `${d}-hint`, le = A ?? i("chat.input.placeholder"), de = F ?? i("chat.prompt");
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: j,
214
+ ref: R,
213
215
  "data-component": "chat-input",
214
- "data-component-id": z,
215
- className: Ke({ size: t, className: G }),
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: B,
222
+ id: S,
221
223
  htmlFor: d,
222
- className: F ? "type-label ds:ps-[var(--spacing-sm)] ds:pt-[var(--spacing-sm)]" : "ds:sr-only",
223
- children: de
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: X,
231
+ ref: Q,
230
232
  id: d,
231
- value: n ? a : void 0,
232
- defaultValue: n ? void 0 : p,
233
- disabled: f,
234
- rows: x,
233
+ value: a,
234
+ disabled: m,
235
+ rows: y,
235
236
  maxLength: s,
236
- placeholder: le,
237
- "aria-labelledby": B,
238
- "aria-describedby": [R, P].filter(Boolean).join(" ") || void 0,
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: te,
241
- onKeyDown: ie,
242
- onCompositionStart: se,
243
- onCompositionEnd: ae,
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
- ...J
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
- m ? /* @__PURE__ */ u(ve, { children: [
264
+ p ? /* @__PURE__ */ u(ge, { children: [
264
265
  /* @__PURE__ */ r(
265
266
  "input",
266
267
  {
267
- ref: K,
268
+ ref: F,
268
269
  type: "file",
269
270
  className: "ds:sr-only",
270
271
  multiple: !0,
271
- accept: Y,
272
- onChange: ce,
273
- "aria-label": i("chat.input.attach"),
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
- U,
279
+ W,
279
280
  {
280
- icon: /* @__PURE__ */ r(Te, {}),
281
- "aria-label": i("chat.input.attach"),
281
+ icon: /* @__PURE__ */ r(Me, {}),
282
+ "aria-label": n("chat.input.attach"),
282
283
  intent: "ghost",
283
284
  size: "sm",
284
- onClick: oe,
285
- disabled: f
285
+ onClick: ie,
286
+ disabled: m
286
287
  }
287
288
  )
288
289
  ] }) : null,
289
- q,
290
+ Y,
290
291
  /* @__PURE__ */ u("div", { className: "ds:ms-auto ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
291
- ee ? /* @__PURE__ */ u(
292
+ D ? /* @__PURE__ */ u(
292
293
  "span",
293
294
  {
294
- id: R,
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(Ve, { "aria-hidden": "true", className: "ds:size-3.5" })
306
+ /* @__PURE__ */ r(ze, { "aria-hidden": "true", className: "ds:size-3.5" })
306
307
  ) : null,
307
- i("chat.input.remaining", { count: D })
308
+ n("chat.input.remaining", { count: Z })
308
309
  ]
309
310
  }
310
311
  ) : null,
311
- /* @__PURE__ */ r("span", { id: P, className: "ds:sr-only", children: i("chat.input.sendHint") }),
312
+ /* @__PURE__ */ r("span", { id: B, className: "ds:sr-only", children: n("chat.input.sendHint") }),
312
313
  /* @__PURE__ */ r(
313
- U,
314
+ W,
314
315
  {
315
- icon: /* @__PURE__ */ r(Ee, {}),
316
- "aria-label": i("chat.send"),
316
+ icon: /* @__PURE__ */ r(He, {}),
317
+ "aria-label": n("chat.send"),
317
318
  intent: "primary",
318
319
  size: "sm",
319
- disabled: f || !a.trim() || l,
320
- onClick: E,
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
- je.displayName = "ChatInput";
332
+ Re.displayName = "ChatInput";
332
333
  export {
333
- je as C,
334
- Fe as c
334
+ Re as C,
335
+ Te as c
335
336
  };
336
- //# sourceMappingURL=chat-input-UK-bXU7u.js.map
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