@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.
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,13 +1,14 @@
1
- import { jsxs as be, jsx as F } from "react/jsx-runtime";
2
- import { useMemo as J, forwardRef as ge, useRef as A, useState as E, useCallback as $, useEffect as he } from "react";
3
- import { c as Ne } from "./index-D2ZczOXr.js";
4
- import { useTranslation as ye } from "react-i18next";
1
+ import { jsxs as ve, jsx as F } from "react/jsx-runtime";
2
+ import { useMemo as G, forwardRef as be, useRef as A, useCallback as O, useState as _, useEffect as ge } from "react";
3
+ import { c as he } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as Ne } from "react-i18next";
5
+ import { u as ye } from "./use-controllable-state-BiY4xTzM.js";
5
6
  import { u as we } from "./form-field-context-B3APVHKx.js";
6
7
  import { c as Ie } from "./compose-refs-C0k0tdqF.js";
7
8
  import { u as De } from "./registry-C9nwlNyL.js";
8
9
  import { C as xe } from "./chevron-down-BX_NP2Yh.js";
9
10
  import { C as Fe } from "./chevron-up-zOEDrmBB.js";
10
- const Se = {
11
+ const Ce = {
11
12
  id: "number-input",
12
13
  capabilities: ["edit_inline"],
13
14
  state: {
@@ -64,29 +65,29 @@ const Se = {
64
65
  }
65
66
  }
66
67
  };
67
- function Me(t) {
68
+ function Se(t) {
68
69
  let r = "";
69
- for (const u of t) {
70
- const n = u.codePointAt(0);
71
- n !== void 0 && (n >= 1632 && n <= 1641 ? r += String.fromCodePoint(48 + (n - 1632)) : n >= 1776 && n <= 1785 ? r += String.fromCodePoint(48 + (n - 1776)) : r += u);
70
+ for (const d of t) {
71
+ const n = d.codePointAt(0);
72
+ n !== void 0 && (n >= 1632 && n <= 1641 ? r += String.fromCodePoint(48 + (n - 1632)) : n >= 1776 && n <= 1785 ? r += String.fromCodePoint(48 + (n - 1776)) : r += d);
72
73
  }
73
74
  return r;
74
75
  }
75
- function Ve(t, r, u) {
76
- return J(() => {
77
- var M, V;
78
- const n = new Intl.NumberFormat(t).formatToParts(1234.5), d = ((M = n.find((a) => a.type === "decimal")) == null ? void 0 : M.value) ?? ".", S = ((V = n.find((a) => a.type === "group")) == null ? void 0 : V.value) ?? ",", p = r === "currency" ? new Intl.NumberFormat(t, {
76
+ function Ve(t, r, d) {
77
+ return G(() => {
78
+ var S, V;
79
+ const n = new Intl.NumberFormat(t).formatToParts(1234.5), u = ((S = n.find((a) => a.type === "decimal")) == null ? void 0 : S.value) ?? ".", C = ((V = n.find((a) => a.type === "group")) == null ? void 0 : V.value) ?? ",", p = r === "currency" ? new Intl.NumberFormat(t, {
79
80
  style: "currency",
80
- currency: u ?? "USD"
81
+ currency: d ?? "USD"
81
82
  }) : r === "percentage" ? new Intl.NumberFormat(t, {
82
83
  style: "percent",
83
84
  maximumFractionDigits: 4
84
85
  }) : r === "integer" ? new Intl.NumberFormat(t, { maximumFractionDigits: 0 }) : new Intl.NumberFormat(t, { maximumFractionDigits: 10 }), T = (a) => Number.isFinite(a) ? p.format(a) : "", z = (a) => {
85
86
  if (!a) return NaN;
86
- const C = Me(a), g = C.trim(), I = g.startsWith("-") || g.startsWith("−");
87
+ const M = Se(a), g = M.trim(), I = g.startsWith("-") || g.startsWith("−");
87
88
  let c = "";
88
- for (const h of C)
89
- h >= "0" && h <= "9" ? c += h : h === d && (c += ".");
89
+ for (const h of M)
90
+ h >= "0" && h <= "9" ? c += h : h === u && (c += ".");
90
91
  if (!c || c === ".") return NaN;
91
92
  let m = Number(c);
92
93
  return Number.isFinite(m) ? (I && (m = -m), r === "percentage" && (m = m / 100), m) : NaN;
@@ -98,7 +99,7 @@ function Ve(t, r, u) {
98
99
  try {
99
100
  const { maximumFractionDigits: a } = new Intl.NumberFormat(t, {
100
101
  style: "currency",
101
- currency: u ?? "USD"
102
+ currency: d ?? "USD"
102
103
  }).resolvedOptions();
103
104
  b = a === 0 ? "numeric" : "decimal";
104
105
  } catch {
@@ -107,13 +108,13 @@ function Ve(t, r, u) {
107
108
  return {
108
109
  format: T,
109
110
  parse: z,
110
- decimalSeparator: d,
111
- groupingSeparator: S,
111
+ decimalSeparator: u,
112
+ groupingSeparator: C,
112
113
  inputMode: b
113
114
  };
114
- }, [t, r, u]);
115
+ }, [t, r, d]);
115
116
  }
116
- const Ce = Ne(
117
+ const Me = he(
117
118
  [
118
119
  "ds:flex ds:items-center ds:w-full ds:rounded-[var(--radius-sm)]",
119
120
  "ds:border ds:bg-input ds:text-foreground",
@@ -137,7 +138,7 @@ const Ce = Ne(
137
138
  },
138
139
  defaultVariants: { size: "md", tone: "default" }
139
140
  }
140
- ), G = [
141
+ ), $ = [
141
142
  "ds:inline-flex ds:items-center ds:justify-center",
142
143
  "ds:h-full ds:shrink-0",
143
144
  "ds:text-muted-foreground ds:hover:text-foreground",
@@ -146,100 +147,102 @@ const Ce = Ne(
146
147
  ].join(" "), ke = () => typeof navigator < "u" && navigator.language ? navigator.language : "en-US";
147
148
  function Te(t) {
148
149
  if (!Number.isFinite(t)) return 0;
149
- const r = String(t), u = r.indexOf(".");
150
- return u === -1 ? 0 : r.length - u - 1;
150
+ const r = String(t), d = r.indexOf(".");
151
+ return d === -1 ? 0 : r.length - d - 1;
151
152
  }
152
153
  function ze(t, r) {
153
154
  if (r <= 0 || !Number.isFinite(r)) return t;
154
155
  const n = 10 ** Te(r);
155
156
  return Math.round(t * n) / n;
156
157
  }
157
- const Pe = ge(
158
+ const Pe = be(
158
159
  ({
159
160
  value: t,
160
161
  defaultValue: r,
161
- onChange: u,
162
+ onChange: d,
162
163
  min: n,
163
- max: d,
164
- step: S = 1,
164
+ max: u,
165
+ step: C = 1,
165
166
  mode: p = "integer",
166
167
  currency: T,
167
168
  locale: z,
168
169
  size: b = "md",
169
- tone: M,
170
+ tone: S,
170
171
  className: V,
171
172
  id: a,
172
- disabled: C,
173
+ disabled: M,
173
174
  onFocus: g,
174
175
  onBlur: I,
175
176
  onKeyDown: c,
176
177
  ...m
177
178
  }, h) => {
178
- const { t: U } = ye(), D = we(), Q = a ?? D.id, k = !!(D.disabled || C), X = z ?? ke(), P = Ve(X, p, T), {
179
- decimalSeparator: B,
179
+ const { t: E } = Ne(), D = we(), J = a ?? D.id, k = !!(D.disabled || M), Q = z ?? ke(), P = Ve(Q, p, T), {
180
+ decimalSeparator: U,
180
181
  format: R,
181
- parse: K
182
- } = P, L = A(null), Y = Ie(h, L), H = t !== void 0, [Z, ee] = E(
183
- r ?? null
184
- ), s = H ? t ?? null : Z, W = A(s);
185
- W.current = s;
186
- const x = $(
182
+ parse: B
183
+ } = P, K = A(null), X = Ie(h, K), [Y, Z] = ye({
184
+ value: t,
185
+ defaultValue: r ?? null,
186
+ onChange: d
187
+ }), s = Y ?? null, L = A(s);
188
+ L.current = s;
189
+ const x = O(
187
190
  (e) => {
188
191
  const i = p === "percentage" ? e * 100 : e;
189
- return (Number.isInteger(i) ? String(i) : i.toString()).replace(".", B);
192
+ return (Number.isInteger(i) ? String(i) : i.toString()).replace(".", U);
190
193
  },
191
- [p, B]
192
- ), f = $(
194
+ [p, U]
195
+ ), f = O(
193
196
  (e) => e == null || Number.isNaN(e) ? "" : R(e),
194
197
  [R]
195
- ), [j, l] = E(
198
+ ), [j, l] = _(
196
199
  () => f(s)
197
- ), N = A(!1), [te, y] = E(!1);
198
- he(() => {
200
+ ), N = A(!1), [ee, y] = _(!1);
201
+ ge(() => {
199
202
  N.current || l(f(s));
200
203
  }, [s, f]);
201
- const ne = te || s !== null && (n !== void 0 && s < n || d !== void 0 && s > d), q = D.invalid || ne, re = q ? "error" : M ?? "default", v = (e) => {
202
- H || ee(e), u == null || u(e);
204
+ const te = ee || s !== null && (n !== void 0 && s < n || u !== void 0 && s > u), H = D.invalid || te, ne = H ? "error" : S ?? "default", v = (e) => {
205
+ Z(e);
203
206
  }, w = (e) => {
204
- let o = (s ?? 0) + S * e;
205
- n !== void 0 && (o = Math.max(n, o)), d !== void 0 && (o = Math.min(d, o)), o = ze(o, S), v(o), y(!1), l(
207
+ let o = (s ?? 0) + C * e;
208
+ n !== void 0 && (o = Math.max(n, o)), u !== void 0 && (o = Math.min(u, o)), o = ze(o, C), v(o), y(!1), l(
206
209
  N.current ? x(o) : f(o)
207
210
  );
208
- }, O = (e) => {
211
+ }, W = (e) => {
209
212
  v(e), y(!1), l(
210
213
  N.current ? x(e) : f(e)
211
214
  );
212
- }, se = (e) => {
215
+ }, re = (e) => {
213
216
  if (c == null || c(e), e.defaultPrevented || k) return;
214
217
  const { key: i, shiftKey: o } = e;
215
- i === "ArrowUp" ? (e.preventDefault(), w(o ? 10 : 1)) : i === "ArrowDown" ? (e.preventDefault(), w(o ? -10 : -1)) : i === "PageUp" ? (e.preventDefault(), w(100)) : i === "PageDown" ? (e.preventDefault(), w(-100)) : i === "Home" && n !== void 0 ? (e.preventDefault(), O(n)) : i === "End" && d !== void 0 && (e.preventDefault(), O(d));
216
- }, ie = (e) => {
218
+ i === "ArrowUp" ? (e.preventDefault(), w(o ? 10 : 1)) : i === "ArrowDown" ? (e.preventDefault(), w(o ? -10 : -1)) : i === "PageUp" ? (e.preventDefault(), w(100)) : i === "PageDown" ? (e.preventDefault(), w(-100)) : i === "Home" && n !== void 0 ? (e.preventDefault(), W(n)) : i === "End" && u !== void 0 && (e.preventDefault(), W(u));
219
+ }, se = (e) => {
217
220
  const i = e.target.value;
218
221
  if (l(i), i.trim() === "") {
219
222
  v(null), y(!1);
220
223
  return;
221
224
  }
222
- const o = K(i);
225
+ const o = B(i);
223
226
  Number.isNaN(o) || v(o);
224
- }, oe = (e) => {
227
+ }, ie = (e) => {
225
228
  g == null || g(e), N.current = !0, s != null && l(x(s));
226
- }, ae = (e) => {
229
+ }, oe = (e) => {
227
230
  if (I == null || I(e), N.current = !1, j.trim() === "") {
228
231
  v(null), y(!1), l("");
229
232
  return;
230
233
  }
231
- const i = K(j);
234
+ const i = B(j);
232
235
  if (Number.isNaN(i)) {
233
236
  l(f(s));
234
237
  return;
235
238
  }
236
- const o = n !== void 0 && i < n || d !== void 0 && i > d;
239
+ const o = n !== void 0 && i < n || u !== void 0 && i > u;
237
240
  y(o), v(i), l(f(i));
238
- }, _ = (e) => {
241
+ }, q = (e) => {
239
242
  e.preventDefault();
240
- }, ue = () => w(1), de = () => w(-1), le = J(
243
+ }, ae = () => w(1), ue = () => w(-1), de = G(
241
244
  () => ({
242
- getValue: () => W.current,
245
+ getValue: () => L.current,
243
246
  setValue: (e) => {
244
247
  v(e), l(
245
248
  e === null ? "" : N.current ? x(e) : f(e)
@@ -250,7 +253,7 @@ const Pe = ge(
250
253
  },
251
254
  focus: () => {
252
255
  var e;
253
- return (e = L.current) == null ? void 0 : e.focus();
256
+ return (e = K.current) == null ? void 0 : e.focus();
254
257
  }
255
258
  }),
256
259
  // The handle is reconstructed per render; consumers (the agent runtime)
@@ -258,14 +261,14 @@ const Pe = ge(
258
261
  // eslint-disable-next-line react-hooks/exhaustive-deps
259
262
  [x, f]
260
263
  );
261
- De(Se, le, a);
262
- const ce = k || n !== void 0 && s !== null && s <= n, fe = k || d !== void 0 && s !== null && s >= d, pe = s ?? void 0, me = (p === "currency" || p === "percentage") && s !== null && s !== null ? R(s) : void 0, ve = P.inputMode === "numeric" ? "[0-9]*" : void 0;
263
- return /* @__PURE__ */ be(
264
+ De(Ce, de, a);
265
+ const le = k || n !== void 0 && s !== null && s <= n, ce = k || u !== void 0 && s !== null && s >= u, fe = s ?? void 0, pe = (p === "currency" || p === "percentage") && s !== null && s !== null ? R(s) : void 0, me = P.inputMode === "numeric" ? "[0-9]*" : void 0;
266
+ return /* @__PURE__ */ ve(
264
267
  "div",
265
268
  {
266
- className: Ce({
269
+ className: Me({
267
270
  size: b,
268
- tone: re,
271
+ tone: ne,
269
272
  className: V
270
273
  }),
271
274
  "data-component": "number-input",
@@ -277,37 +280,37 @@ const Pe = ge(
277
280
  {
278
281
  type: "button",
279
282
  tabIndex: -1,
280
- "aria-label": U("inputs.number.decrement", "Decrement"),
281
- onClick: de,
282
- onMouseDown: _,
283
- disabled: ce,
284
- className: `${G} ds:ps-2 ds:pe-1`,
283
+ "aria-label": E("inputs.number.decrement", "Decrement"),
284
+ onClick: ue,
285
+ onMouseDown: q,
286
+ disabled: le,
287
+ className: `${$} ds:ps-2 ds:pe-1`,
285
288
  children: /* @__PURE__ */ F(xe, { "aria-hidden": "true", className: "ds:size-4" })
286
289
  }
287
290
  ),
288
291
  /* @__PURE__ */ F(
289
292
  "input",
290
293
  {
291
- ref: Y,
292
- id: Q,
294
+ ref: X,
295
+ id: J,
293
296
  type: "text",
294
297
  role: "spinbutton",
295
298
  inputMode: P.inputMode,
296
- pattern: ve,
299
+ pattern: me,
297
300
  autoComplete: "off",
298
301
  value: j,
299
302
  disabled: k,
300
303
  "aria-valuemin": n,
301
- "aria-valuemax": d,
302
- "aria-valuenow": pe,
303
- "aria-valuetext": me,
304
- "aria-invalid": q || void 0,
304
+ "aria-valuemax": u,
305
+ "aria-valuenow": fe,
306
+ "aria-valuetext": pe,
307
+ "aria-invalid": H || void 0,
305
308
  "aria-required": D.required || void 0,
306
309
  "aria-describedby": D.describedBy || void 0,
307
- onChange: ie,
308
- onFocus: oe,
309
- onBlur: ae,
310
- onKeyDown: se,
310
+ onChange: se,
311
+ onFocus: ie,
312
+ onBlur: oe,
313
+ onKeyDown: re,
311
314
  className: "ds:flex-1 ds:w-full ds:min-w-0 ds:bg-transparent ds:outline-none ds:ps-2 ds:pe-2 ds:text-start ds:tabular-nums ds:disabled:cursor-not-allowed",
312
315
  ...m
313
316
  }
@@ -317,11 +320,11 @@ const Pe = ge(
317
320
  {
318
321
  type: "button",
319
322
  tabIndex: -1,
320
- "aria-label": U("inputs.number.increment", "Increment"),
321
- onClick: ue,
322
- onMouseDown: _,
323
- disabled: fe,
324
- className: `${G} ds:ps-1 ds:pe-2`,
323
+ "aria-label": E("inputs.number.increment", "Increment"),
324
+ onClick: ae,
325
+ onMouseDown: q,
326
+ disabled: ce,
327
+ className: `${$} ds:ps-1 ds:pe-2`,
325
328
  children: /* @__PURE__ */ F(Fe, { "aria-hidden": "true", className: "ds:size-4" })
326
329
  }
327
330
  )
@@ -335,4 +338,4 @@ export {
335
338
  Pe as N,
336
339
  Ve as u
337
340
  };
338
- //# sourceMappingURL=number-input-DH00o0DN.js.map
341
+ //# sourceMappingURL=number-input-BZXu6bPY.js.map
@@ -1,7 +1,8 @@
1
- import { jsxs as ee, jsx as M } from "react/jsx-runtime";
2
- import { forwardRef as te, useId as se, useState as L, useRef as R, useEffect as re, useCallback as N, useMemo as oe } from "react";
3
- import { c as O } from "./index-D2ZczOXr.js";
1
+ import { jsxs as Z, jsx as A } from "react/jsx-runtime";
2
+ import { forwardRef as x, useId as ee, useRef as R, useState as te, useEffect as re, useCallback as L, useMemo as se } from "react";
3
+ import { c as N } from "./index-D2ZczOXr.js";
4
4
  import { useTranslation as ae } from "react-i18next";
5
+ import { u as oe } from "./use-controllable-state-BiY4xTzM.js";
5
6
  import { u as ie } from "./form-field-context-B3APVHKx.js";
6
7
  import { u as ne } from "./registry-C9nwlNyL.js";
7
8
  const ce = {
@@ -27,8 +28,8 @@ const ce = {
27
28
  argsType: "{ value: string }",
28
29
  descriptionKey: "ui.agent.otpInput.actions.setValue",
29
30
  description: "Replace the entered digits.",
30
- invoke: (e, o) => {
31
- e.setValue(o.value);
31
+ invoke: (e, a) => {
32
+ e.setValue(a.value);
32
33
  }
33
34
  },
34
35
  clear: {
@@ -60,7 +61,7 @@ const ce = {
60
61
  description: "Sourced from the id prop."
61
62
  }
62
63
  }
63
- }, ue = O("ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]"), le = O(
64
+ }, ue = N("ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]"), le = N(
64
65
  [
65
66
  "ds:w-[var(--min-target-size)] ds:h-[var(--min-target-size)]",
66
67
  "ds:rounded-[var(--radius-sm)]",
@@ -81,94 +82,92 @@ const ce = {
81
82
  defaultVariants: { tone: "default" }
82
83
  }
83
84
  );
84
- function F(e) {
85
- return e.replace(/[\u0660-\u0669]/g, (o) => String(o.charCodeAt(0) - 1632)).replace(/[\u06F0-\u06F9]/g, (o) => String(o.charCodeAt(0) - 1776));
85
+ function M(e) {
86
+ return e.replace(/[\u0660-\u0669]/g, (a) => String(a.charCodeAt(0) - 1632)).replace(/[\u06F0-\u06F9]/g, (a) => String(a.charCodeAt(0) - 1776));
86
87
  }
87
- function g(e, o) {
88
- return F(e).replace(/\D/g, "").slice(0, o);
88
+ function g(e, a) {
89
+ return M(e).replace(/\D/g, "").slice(0, a);
89
90
  }
90
- function de(e, o) {
91
- const m = g(e, o), l = new Array(o).fill("");
91
+ function de(e, a) {
92
+ const m = g(e, a), l = new Array(a).fill("");
92
93
  for (let n = 0; n < m.length; n += 1)
93
94
  l[n] = m[n];
94
95
  return l;
95
96
  }
96
- const pe = te(
97
+ const pe = x(
97
98
  ({
98
99
  length: e = 6,
99
- value: o,
100
+ value: a,
100
101
  defaultValue: m,
101
102
  onChange: l,
102
103
  onComplete: n,
103
104
  disabled: S,
104
- error: $,
105
+ error: O,
105
106
  label: y,
106
- id: K,
107
- className: j
108
- }, z) => {
109
- const { t: H } = ae(), v = ie(), _ = se(), P = y ? _ : void 0, w = o !== void 0, [q, W] = L(
110
- () => g(m ?? "", e)
111
- ), p = g(
112
- w ? o : q,
113
- e
114
- ), G = de(p, e), I = v.disabled || !!S, B = v.invalid || !!$, J = B ? "error" : "default", C = R([]), h = R(p.length === e), d = R(p);
107
+ id: F,
108
+ className: $
109
+ }, j) => {
110
+ const { t: z } = ae(), v = ie(), H = ee(), K = y ? H : void 0, [_, P] = oe({
111
+ value: a,
112
+ defaultValue: g(m ?? "", e)
113
+ }), p = g(_ ?? "", e), q = de(p, e), w = v.disabled || !!S, B = v.invalid || !!O, W = B ? "error" : "default", C = R([]), I = R(p.length === e), d = R(p);
115
114
  d.current = p;
116
- const Q = () => {
117
- const s = p.length;
118
- return s >= e ? e - 1 : s;
119
- }, [f, k] = L(Q);
115
+ const G = () => {
116
+ const r = p.length;
117
+ return r >= e ? e - 1 : r;
118
+ }, [f, h] = te(G);
120
119
  re(() => {
121
- f >= e && k(e - 1);
120
+ f >= e && h(e - 1);
122
121
  }, [f, e]);
123
- const c = N(
124
- (s) => {
125
- const t = Math.max(0, Math.min(e - 1, s));
126
- k(t);
127
- const r = C.current[t];
128
- r && (r.focus(), r.select());
122
+ const c = L(
123
+ (r) => {
124
+ const t = Math.max(0, Math.min(e - 1, r));
125
+ h(t);
126
+ const s = C.current[t];
127
+ s && (s.focus(), s.select());
129
128
  },
130
129
  [e]
131
- ), u = N(
132
- (s) => {
133
- const t = g(s, e);
134
- w || W(t), d.current = t, l == null || l(t), t.length === e ? h.current || (h.current = !0, n == null || n(t)) : h.current = !1;
130
+ ), u = L(
131
+ (r) => {
132
+ const t = g(r, e);
133
+ P(t), d.current = t, l == null || l(t), t.length === e ? I.current || (I.current = !0, n == null || n(t)) : I.current = !1;
135
134
  },
136
- [w, e, l, n]
137
- ), U = (s) => (t) => {
138
- const r = t.target.value, a = F(r).replace(/\D/g, ""), i = d.current;
139
- if (a.length === 0) {
140
- if (r === "" && s < i.length) {
141
- const A = i.slice(0, s) + i.slice(s + 1);
142
- u(A);
135
+ [P, e, l, n]
136
+ ), J = (r) => (t) => {
137
+ const s = t.target.value, o = M(s).replace(/\D/g, ""), i = d.current;
138
+ if (o.length === 0) {
139
+ if (s === "" && r < i.length) {
140
+ const T = i.slice(0, r) + i.slice(r + 1);
141
+ u(T);
143
142
  }
144
143
  return;
145
144
  }
146
- const b = i.slice(0, s), V = i.slice(s + a.length), D = (b + a + V).slice(0, e);
147
- u(D);
148
- const T = Math.min(s + a.length, e - 1);
149
- c(T);
150
- }, X = (s) => (t) => {
151
- const r = d.current;
145
+ const b = i.slice(0, r), k = i.slice(r + o.length), V = (b + o + k).slice(0, e);
146
+ u(V);
147
+ const D = Math.min(r + o.length, e - 1);
148
+ c(D);
149
+ }, Q = (r) => (t) => {
150
+ const s = d.current;
152
151
  if (t.key === "Backspace") {
153
- if (r[s]) {
152
+ if (s[r]) {
154
153
  t.preventDefault();
155
- const a = r.slice(0, s) + r.slice(s + 1);
156
- u(a);
154
+ const o = s.slice(0, r) + s.slice(r + 1);
155
+ u(o);
157
156
  return;
158
157
  }
159
- if (s > 0) {
158
+ if (r > 0) {
160
159
  t.preventDefault();
161
- const a = r.slice(0, s - 1) + r.slice(s);
162
- u(a), c(s - 1);
160
+ const o = s.slice(0, r - 1) + s.slice(r);
161
+ u(o), c(r - 1);
163
162
  }
164
163
  return;
165
164
  }
166
165
  if (t.key === "ArrowLeft") {
167
- t.preventDefault(), s > 0 && c(s - 1);
166
+ t.preventDefault(), r > 0 && c(r - 1);
168
167
  return;
169
168
  }
170
169
  if (t.key === "ArrowRight") {
171
- t.preventDefault(), s < e - 1 && c(s + 1);
170
+ t.preventDefault(), r < e - 1 && c(r + 1);
172
171
  return;
173
172
  }
174
173
  if (t.key === "Home") {
@@ -176,56 +175,56 @@ const pe = te(
176
175
  return;
177
176
  }
178
177
  t.key === "End" && (t.preventDefault(), c(e - 1));
179
- }, Y = (s) => (t) => {
180
- const a = t.clipboardData.getData("text").replace(/\s+/g, ""), i = F(a);
178
+ }, U = (r) => (t) => {
179
+ const o = t.clipboardData.getData("text").replace(/\s+/g, ""), i = M(o);
181
180
  if (!/^[0-9]+$/.test(i)) return;
182
181
  t.preventDefault();
183
- const b = d.current, V = b.slice(0, s), D = b.slice(s + i.length), T = (V + i + D).slice(0, e);
184
- u(T);
185
- const A = Math.min(s + i.length, e - 1);
186
- c(A);
187
- }, Z = (s) => (t) => {
188
- k(s), t.currentTarget.select();
189
- }, E = v.id, x = oe(
182
+ const b = d.current, k = b.slice(0, r), V = b.slice(r + i.length), D = (k + i + V).slice(0, e);
183
+ u(D);
184
+ const T = Math.min(r + i.length, e - 1);
185
+ c(T);
186
+ }, X = (r) => (t) => {
187
+ h(r), t.currentTarget.select();
188
+ }, E = v.id, Y = se(
190
189
  () => ({
191
190
  getValue: () => d.current,
192
- setValue: (s) => u(s),
191
+ setValue: (r) => u(r),
193
192
  clear: () => u(""),
194
193
  focus: () => c(f),
195
194
  isComplete: () => d.current.length === e
196
195
  }),
197
196
  [u, c, f, e]
198
197
  );
199
- return ne(ce, x, K), /* @__PURE__ */ ee("div", { className: ue({ className: j }), children: [
200
- y ? /* @__PURE__ */ M(
198
+ return ne(ce, Y, F), /* @__PURE__ */ Z("div", { className: ue({ className: $ }), children: [
199
+ y ? /* @__PURE__ */ A(
201
200
  "label",
202
201
  {
203
- id: P,
202
+ id: K,
204
203
  htmlFor: `${E}-0`,
205
204
  className: "type-label ds:text-foreground",
206
205
  children: y
207
206
  }
208
207
  ) : null,
209
- /* @__PURE__ */ M(
208
+ /* @__PURE__ */ A(
210
209
  "div",
211
210
  {
212
- ref: z,
211
+ ref: j,
213
212
  role: "group",
214
213
  dir: "ltr",
215
- "aria-labelledby": P,
214
+ "aria-labelledby": K,
216
215
  "aria-invalid": B || void 0,
217
216
  "aria-describedby": v.describedBy || void 0,
218
- "aria-disabled": I || void 0,
217
+ "aria-disabled": w || void 0,
219
218
  "data-component": "otp-input",
220
- "data-component-id": K,
219
+ "data-component-id": F,
221
220
  className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-sm)]",
222
- children: G.map((s, t) => {
223
- const r = !I && t === f;
224
- return /* @__PURE__ */ M(
221
+ children: q.map((r, t) => {
222
+ const s = !w && t === f;
223
+ return /* @__PURE__ */ A(
225
224
  "input",
226
225
  {
227
- ref: (a) => {
228
- C.current[t] = a;
226
+ ref: (o) => {
227
+ C.current[t] = o;
229
228
  },
230
229
  id: `${E}-${t}`,
231
230
  type: "text",
@@ -233,18 +232,18 @@ const pe = te(
233
232
  pattern: "[0-9]*",
234
233
  autoComplete: t === 0 ? "one-time-code" : "off",
235
234
  maxLength: 1,
236
- value: s,
237
- disabled: I,
238
- tabIndex: r ? 0 : -1,
239
- "aria-label": H("inputs.otp.digitLabel", {
235
+ value: r,
236
+ disabled: w,
237
+ tabIndex: s ? 0 : -1,
238
+ "aria-label": z("inputs.otp.digitLabel", {
240
239
  current: t + 1,
241
240
  total: e
242
241
  }),
243
- onChange: U(t),
244
- onKeyDown: X(t),
245
- onPaste: Y(t),
246
- onFocus: Z(t),
247
- className: le({ tone: J })
242
+ onChange: J(t),
243
+ onKeyDown: Q(t),
244
+ onPaste: U(t),
245
+ onFocus: X(t),
246
+ className: le({ tone: W })
248
247
  },
249
248
  t
250
249
  );
@@ -258,4 +257,4 @@ pe.displayName = "OTPInput";
258
257
  export {
259
258
  pe as O
260
259
  };
261
- //# sourceMappingURL=otp-input-BBXYvLx5.js.map
260
+ //# sourceMappingURL=otp-input-BDF_iNpa.js.map