@alfadocs/ui-kit 0.38.0 → 0.40.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.
Files changed (144) hide show
  1. package/dist/_chunks/{accordion-bSU21uTV.js → accordion-9lJSMMsZ.js} +6 -6
  2. package/dist/_chunks/{agenda-tray-By_asPN9.js → agenda-tray-Dyj9ChHC.js} +22 -21
  3. package/dist/_chunks/{bmi-calculator-BRUru9QX.js → bmi-calculator-DnEr513I.js} +2 -2
  4. package/dist/_chunks/{booking-DK_BPHnQ.js → booking-4mCw3Mpl.js} +2 -2
  5. package/dist/_chunks/{chart-DnHvmiDX.js → chart-Cbt0_sKv.js} +46 -37
  6. package/dist/_chunks/{collapsible-CERONory.js → collapsible-X3oaLPU3.js} +5 -5
  7. package/dist/_chunks/{document-scanner-CdHQ6lTN.js → document-scanner-CqS_klIr.js} +56 -55
  8. package/dist/_chunks/{editable-currency-cell-renderer-DGKuRNVG.js → editable-currency-cell-renderer-DgkCIIcO.js} +2 -2
  9. package/dist/_chunks/{file-upload-CnzRcErt.js → file-upload-BosbPDb1.js} +2 -2
  10. package/dist/_chunks/{freemium-paywall-D1N02Oam.js → freemium-paywall-BAk3a6er.js} +7 -7
  11. package/dist/_chunks/header-settings-CBLwUK6t.js +244 -0
  12. package/dist/_chunks/{map-view-vD5pvWs9.js → map-view-qJLybrmN.js} +2 -2
  13. package/dist/_chunks/marketplace-app-shell-BlxVizU4.js +296 -0
  14. package/dist/_chunks/{message-card-BbRhZkDI.js → message-card-DSPw5ghw.js} +20 -19
  15. package/dist/_chunks/{message-tray-B762TKuv.js → message-tray-hSQff9u4.js} +3 -3
  16. package/dist/_chunks/{notification-card-DMdO4g54.js → notification-card-CObnGdJu.js} +22 -21
  17. package/dist/_chunks/{notification-tray-Dl3FTleW.js → notification-tray-BWHDIjgd.js} +2 -2
  18. package/dist/_chunks/{otp-input-CDTWT5EK.js → otp-input-CMphfBxZ.js} +70 -71
  19. package/dist/_chunks/{patient-shell-Bz3CdO84.js → patient-shell-DF81lALv.js} +36 -35
  20. package/dist/_chunks/{payment-form-D5rgnZu7.js → payment-form-Dy3WIIsC.js} +18 -18
  21. package/dist/_chunks/{pdf-viewer-DvtEHcEP.js → pdf-viewer-Cy6Ul3hZ.js} +2 -2
  22. package/dist/_chunks/{practice-results-C8ciLQap.js → practice-results-C0d4IL5E.js} +2 -2
  23. package/dist/_chunks/{public-footer.agent-zw1vFin_.js → public-footer.agent-okt8ZRc5.js} +2 -2
  24. package/dist/_chunks/{reviews-panel-Dow8Dzoa.js → reviews-panel-CPrXu5TX.js} +2 -2
  25. package/dist/_chunks/{sidebar-BbR8f6oe.js → sidebar-_vJXI9rB.js} +2 -2
  26. package/dist/_chunks/sign-document-CpLDZ6Db.js +316 -0
  27. package/dist/_chunks/{signature-capture-C-fF71xI.js → signature-capture-DoiBd6i3.js} +138 -143
  28. package/dist/_chunks/{sparkline-DEROcSl0.js → sparkline-DGhCSw8M.js} +55 -46
  29. package/dist/_chunks/{stepper-accordion-BfS6lUB9.js → stepper-accordion-Dki6r9ZE.js} +2 -2
  30. package/dist/_chunks/{tag-CyoaEmf_.js → tag-CdA0s_VV.js} +16 -16
  31. package/dist/_chunks/{task-card-BUVMh6HN.js → task-card-CPyQ5AXC.js} +6 -5
  32. package/dist/_chunks/{task-tray-DRK0b0Qb.js → task-tray-B8jFv5FV.js} +36 -35
  33. package/dist/_chunks/{transcript-panel-DyhTpAP7.js → transcript-panel-CR7VY1uw.js} +8 -7
  34. package/dist/_chunks/{warning-stack-bDicCvxs.js → warning-stack-DNR3-IbP.js} +17 -16
  35. package/dist/_chunks/{workflow-map-uSiHbOWQ.js → workflow-map-C3gB0FvB.js} +3 -2
  36. package/dist/agent-catalog.json +39 -1
  37. package/dist/components/accordion/index.js +1 -1
  38. package/dist/components/agenda-tray/index.js +1 -1
  39. package/dist/components/bmi-calculator/index.js +1 -1
  40. package/dist/components/booking/index.js +1 -1
  41. package/dist/components/chart/chart.d.ts +1 -1
  42. package/dist/components/chart/index.js +1 -1
  43. package/dist/components/collapsible/index.js +1 -1
  44. package/dist/components/data-table/index.js +1 -1
  45. package/dist/components/document-scanner/index.js +1 -1
  46. package/dist/components/file-upload/index.js +1 -1
  47. package/dist/components/freemium-paywall/index.js +1 -1
  48. package/dist/components/header-settings/header-settings.agent.d.ts +4 -0
  49. package/dist/components/header-settings/header-settings.d.ts +36 -0
  50. package/dist/components/header-settings/index.d.ts +2 -0
  51. package/dist/components/header-settings/index.js +2 -241
  52. package/dist/components/index.d.ts +1 -0
  53. package/dist/components/locale-picker/locale-picker.agent.d.ts +4 -0
  54. package/dist/components/locale-picker/locale-picker.d.ts +80 -0
  55. package/dist/components/map-view/index.js +1 -1
  56. package/dist/components/message-card/index.js +1 -1
  57. package/dist/components/message-tray/index.js +1 -1
  58. package/dist/components/notification-card/index.js +1 -1
  59. package/dist/components/notification-tray/index.js +1 -1
  60. package/dist/components/otp-input/index.d.ts +1 -1
  61. package/dist/components/otp-input/index.js +1 -1
  62. package/dist/components/otp-input/otp-input.d.ts +1 -1
  63. package/dist/components/payment-form/index.js +1 -1
  64. package/dist/components/pdf-viewer/index.js +1 -1
  65. package/dist/components/practice-results/index.js +1 -1
  66. package/dist/components/public-footer/index.js +1 -1
  67. package/dist/components/reviews-panel/index.js +1 -1
  68. package/dist/components/sidebar/index.js +1 -1
  69. package/dist/components/sign-document/index.d.ts +4 -0
  70. package/dist/components/sign-document/index.js +6 -0
  71. package/dist/components/sign-document/sign-document.agent.d.ts +4 -0
  72. package/dist/components/sign-document/sign-document.d.ts +47 -0
  73. package/dist/components/signature-capture/index.js +1 -1
  74. package/dist/components/sparkline/index.js +1 -1
  75. package/dist/components/sparkline/sparkline.d.ts +1 -1
  76. package/dist/components/stepper-accordion/index.js +1 -1
  77. package/dist/components/tag/index.js +1 -1
  78. package/dist/components/task-card/index.js +1 -1
  79. package/dist/components/task-tray/index.js +1 -1
  80. package/dist/components/transcript-panel/index.js +1 -1
  81. package/dist/components/warning-stack/index.js +1 -1
  82. package/dist/components/workflow/index.js +1 -1
  83. package/dist/i18n/locale-meta.d.ts +56 -0
  84. package/dist/i18n/locales/ar.d.ts +22 -0
  85. package/dist/i18n/locales/ar.js +22 -0
  86. package/dist/i18n/locales/de.d.ts +22 -0
  87. package/dist/i18n/locales/de.js +22 -0
  88. package/dist/i18n/locales/el.d.ts +22 -0
  89. package/dist/i18n/locales/el.js +22 -0
  90. package/dist/i18n/locales/en.d.ts +22 -0
  91. package/dist/i18n/locales/en.js +22 -0
  92. package/dist/i18n/locales/es.d.ts +22 -0
  93. package/dist/i18n/locales/es.js +22 -0
  94. package/dist/i18n/locales/fr.d.ts +22 -0
  95. package/dist/i18n/locales/fr.js +22 -0
  96. package/dist/i18n/locales/hi.d.ts +22 -0
  97. package/dist/i18n/locales/hi.js +22 -0
  98. package/dist/i18n/locales/it.d.ts +22 -0
  99. package/dist/i18n/locales/it.js +22 -0
  100. package/dist/i18n/locales/ja.d.ts +22 -0
  101. package/dist/i18n/locales/ja.js +22 -0
  102. package/dist/i18n/locales/nl.d.ts +22 -0
  103. package/dist/i18n/locales/nl.js +22 -0
  104. package/dist/i18n/locales/pl.d.ts +22 -0
  105. package/dist/i18n/locales/pl.js +22 -0
  106. package/dist/i18n/locales/pt.d.ts +22 -0
  107. package/dist/i18n/locales/pt.js +22 -0
  108. package/dist/i18n/locales/ro.d.ts +22 -0
  109. package/dist/i18n/locales/ro.js +22 -0
  110. package/dist/i18n/locales/ru.d.ts +22 -0
  111. package/dist/i18n/locales/ru.js +22 -0
  112. package/dist/i18n/locales/sq.d.ts +22 -0
  113. package/dist/i18n/locales/sq.js +22 -0
  114. package/dist/i18n/locales/sv.d.ts +22 -0
  115. package/dist/i18n/locales/sv.js +22 -0
  116. package/dist/i18n/locales/tr.d.ts +22 -0
  117. package/dist/i18n/locales/tr.js +22 -0
  118. package/dist/i18n/locales/zh.d.ts +22 -0
  119. package/dist/i18n/locales/zh.js +22 -0
  120. package/dist/index.js +110 -107
  121. package/dist/locales/ar.json +22 -0
  122. package/dist/locales/de.json +22 -0
  123. package/dist/locales/el.json +22 -0
  124. package/dist/locales/en.json +22 -0
  125. package/dist/locales/es.json +22 -0
  126. package/dist/locales/fr.json +22 -0
  127. package/dist/locales/hi.json +22 -0
  128. package/dist/locales/it.json +22 -0
  129. package/dist/locales/ja.json +22 -0
  130. package/dist/locales/nl.json +22 -0
  131. package/dist/locales/pl.json +22 -0
  132. package/dist/locales/pt.json +22 -0
  133. package/dist/locales/ro.json +22 -0
  134. package/dist/locales/ru.json +22 -0
  135. package/dist/locales/sq.json +22 -0
  136. package/dist/locales/sv.json +22 -0
  137. package/dist/locales/tr.json +22 -0
  138. package/dist/locales/zh.json +22 -0
  139. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  140. package/dist/patterns/marketplace-app-shell/marketplace-app-shell.d.ts +12 -8
  141. package/dist/patterns/patient-shell/index.js +1 -1
  142. package/dist/tokens.css +1 -1
  143. package/package.json +5 -1
  144. package/dist/_chunks/marketplace-app-shell-BnClrL2B.js +0 -295
@@ -1,5 +1,5 @@
1
- import { jsxs as X, jsx as h } from "react/jsx-runtime";
2
- import { forwardRef as ze, useId as Se, useMemo as ae, useRef as C, useState as N, useEffect as P, useCallback as T, useImperativeHandle as Re } from "react";
1
+ import { jsxs as W, jsx as k } from "react/jsx-runtime";
2
+ import { forwardRef as Ce, useId as Se, useMemo as se, useRef as z, useState as N, useEffect as P, useCallback as T, useImperativeHandle as Re } from "react";
3
3
  import Ae from "signature_pad";
4
4
  import { c as R } from "./index-D2ZczOXr.js";
5
5
  import { useTranslation as Me } from "react-i18next";
@@ -48,7 +48,9 @@ const Pe = {
48
48
  "ds:signature-capture-alfadocs ds:flex ds:flex-col",
49
49
  "ds:gap-[var(--spacing-sm)]",
50
50
  "ds:bg-[var(--background)] ds:text-[var(--foreground)]",
51
- "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
51
+ "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--card-border)]",
52
+ "ds:shadow-[var(--shadow-card)]",
53
+ "ds:[.theme-accessible_&]:border-2",
52
54
  "ds:p-[var(--spacing-sm)]",
53
55
  "ds:aria-disabled:opacity-[var(--opacity-50)] ds:aria-disabled:cursor-not-allowed"
54
56
  ].join(" ")
@@ -76,18 +78,21 @@ const Pe = {
76
78
  "ds:select-none"
77
79
  ].join(" ")
78
80
  ), Ee = R(
79
- ["ds:flex ds:items-center ds:flex-wrap ds:gap-[var(--spacing-xs)]"].join(" ")
80
- ), q = R(
81
+ ["ds:flex ds:items-stretch ds:flex-wrap ds:gap-[var(--spacing-sm)]"].join(
82
+ " "
83
+ )
84
+ ), ae = R(
81
85
  [
82
- "ds:inline-flex ds:items-center ds:justify-center",
86
+ "ds:inline-flex ds:flex-1 ds:items-center ds:justify-center",
83
87
  "ds:min-block-size-[var(--min-target-size)]",
84
88
  "ds:min-inline-size-[var(--min-target-size)]",
85
89
  "ds:gap-[var(--spacing-xs)]",
86
- "ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)]",
90
+ "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
91
+ "ds:pt-[var(--spacing-md)] ds:pb-[var(--spacing-md)]",
87
92
  "ds:rounded-[var(--radius-sm)]",
88
93
  "ds:border ds:border-[color:var(--border)]",
89
94
  "ds:bg-transparent ds:text-[var(--foreground)]",
90
- "ds:text-[length:var(--font-size-sm)] ds:font-medium",
95
+ "ds:text-[length:var(--font-size-base)] ds:font-medium",
91
96
  "ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
92
97
  "ds:hover:bg-[var(--muted)]",
93
98
  "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
@@ -99,13 +104,14 @@ const Pe = {
99
104
  ].join(" ")
100
105
  ), Be = R(
101
106
  [
102
- "ds:inline-flex ds:items-center ds:justify-center",
107
+ "ds:inline-flex ds:flex-1 ds:items-center ds:justify-center",
103
108
  "ds:min-block-size-[var(--min-target-size)]",
104
109
  "ds:min-inline-size-[var(--min-target-size)]",
105
110
  "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
111
+ "ds:pt-[var(--spacing-md)] ds:pb-[var(--spacing-md)]",
106
112
  "ds:rounded-[var(--radius-sm)]",
107
113
  "ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)]",
108
- "ds:text-[length:var(--font-size-sm)] ds:font-medium",
114
+ "ds:text-[length:var(--font-size-base)] ds:font-medium",
109
115
  "ds:transition-colors ds:duration-[var(--animation-duration)] ds:motion-reduce:transition-none",
110
116
  "ds:hover:bg-[var(--primary-hover)]",
111
117
  "ds:focus-visible:outline-[length:var(--focus-ring-width)]",
@@ -138,7 +144,8 @@ const Pe = {
138
144
  "ds:inline-size-[var(--signature-width)]",
139
145
  "ds:block-size-[var(--signature-height)]",
140
146
  "ds:rounded-[var(--radius-sm)]",
141
- "ds:border ds:border-[color:var(--border)]",
147
+ "ds:border ds:border-[color:var(--card-border)]",
148
+ "ds:[.theme-accessible_&]:border-2",
142
149
  "ds:bg-[var(--background)] ds:text-[var(--foreground)]",
143
150
  "ds:font-[family-name:var(--font-sans)]",
144
151
  "ds:italic",
@@ -187,47 +194,47 @@ async function Ie(t) {
187
194
  return "";
188
195
  }
189
196
  function He(t, n, s, i, a) {
190
- const m = Math.max(
197
+ const v = Math.max(
191
198
  1,
192
199
  typeof window < "u" ? window.devicePixelRatio : 1
193
- ), z = document.createElement("canvas");
194
- z.width = Math.floor(n * m), z.height = Math.floor(s * m);
195
- const l = z.getContext("2d");
196
- return l && (l.setTransform(m, 0, 0, m, 0, 0), l.fillStyle = a, l.fillRect(0, 0, n, s), l.fillStyle = i, l.font = "32px italic sans-serif", l.textAlign = "center", l.textBaseline = "middle", l.fillText(t, n / 2, s / 2, n - 16)), z;
200
+ ), C = document.createElement("canvas");
201
+ C.width = Math.floor(n * v), C.height = Math.floor(s * v);
202
+ const d = C.getContext("2d");
203
+ return d && (d.setTransform(v, 0, 0, v, 0, 0), d.fillStyle = a, d.fillRect(0, 0, n, s), d.fillStyle = i, d.font = "32px italic sans-serif", d.textAlign = "center", d.textBaseline = "middle", d.fillText(t, n / 2, s / 2, n - 16)), C;
197
204
  }
198
- const Ue = ze(
205
+ const Ue = Ce(
199
206
  ({
200
207
  id: t,
201
208
  onConfirm: n,
202
209
  onClear: s,
203
210
  onStart: i,
204
211
  width: a = 400,
205
- height: m = 200,
206
- penColor: z,
207
- backgroundColor: l,
212
+ height: v = 200,
213
+ penColor: C,
214
+ backgroundColor: d,
208
215
  allowTypedFallback: ce = !0,
209
- disabled: f = !1,
216
+ disabled: b = !1,
210
217
  ariaLabel: le,
211
218
  className: ue
212
219
  }, fe) => {
213
- const { t: o } = Me(), G = Se(), Z = `${ae(
214
- () => `sig-${G.replace(/[^a-zA-Z0-9-_]/g, "")}`,
215
- [G]
216
- )}-live`, F = C(null), J = C(null), V = C(null), K = C(null), y = C(null), [d, ge] = N("draw"), [S, L] = N(""), [pe, I] = N(!1), ve = C("empty"), [me, be] = N(""), [b, he] = N(""), [w, ye] = N(""), j = C(i), E = C(s), B = C(n);
220
+ const { t: c } = Me(), X = Se(), q = `${se(
221
+ () => `sig-${X.replace(/[^a-zA-Z0-9-_]/g, "")}`,
222
+ [X]
223
+ )}-live`, F = z(null), G = z(null), V = z(null), Z = z(null), h = z(null), [l, ge] = N("draw"), [S, L] = N(""), [pe, I] = N(!1), ve = z("empty"), [me, be] = N(""), [m, he] = N(""), [y, ye] = N(""), j = z(i), E = z(s), B = z(n);
217
224
  P(() => {
218
225
  j.current = i, E.current = s, B.current = n;
219
226
  }, [i, s, n]);
220
- const g = T(
227
+ const f = T(
221
228
  (e) => {
222
- ve.current = e, be(o(`signature.state.${e}`));
229
+ ve.current = e, be(c(`signature.state.${e}`));
223
230
  },
224
- [o]
231
+ [c]
225
232
  );
226
233
  P(() => {
227
234
  if (typeof document > "u") return;
228
235
  function e() {
229
- const c = z ?? ie("--foreground"), p = l ?? ie("--background");
230
- he(c || "currentColor"), ye(p || "transparent");
236
+ const o = C ?? ie("--foreground"), g = d ?? ie("--background");
237
+ he(o || "currentColor"), ye(g || "transparent");
231
238
  }
232
239
  e();
233
240
  const r = new MutationObserver(() => {
@@ -237,47 +244,47 @@ const Ue = ze(
237
244
  attributes: !0,
238
245
  attributeFilter: ["class"]
239
246
  }), () => r.disconnect();
240
- }, [z, l]), P(() => {
241
- const e = y.current;
242
- e && (b && (e.penColor = b), w && (e.backgroundColor = w));
243
- }, [b, w]), P(() => {
244
- if (d !== "draw") return;
247
+ }, [C, d]), P(() => {
248
+ const e = h.current;
249
+ e && (m && (e.penColor = m), y && (e.backgroundColor = y));
250
+ }, [m, y]), P(() => {
251
+ if (l !== "draw") return;
245
252
  const e = V.current;
246
253
  if (!e) return;
247
254
  const r = new Ae(e, {
248
- penColor: b || "currentColor",
249
- backgroundColor: w || "transparent",
255
+ penColor: m || "currentColor",
256
+ backgroundColor: y || "transparent",
250
257
  minWidth: 0.5,
251
258
  maxWidth: 2.5,
252
259
  velocityFilterWeight: 0.7
253
260
  });
254
- y.current = r;
255
- const c = () => {
256
- var x;
257
- I(!0), g("drawing"), (x = j.current) == null || x.call(j);
258
- }, p = () => {
261
+ h.current = r;
262
+ const o = () => {
263
+ var w;
264
+ I(!0), f("drawing"), (w = j.current) == null || w.call(j);
265
+ }, g = () => {
259
266
  };
260
- return r.addEventListener("beginStroke", c), r.addEventListener("endStroke", p), $(e), g("empty"), () => {
261
- r.removeEventListener("beginStroke", c), r.removeEventListener("endStroke", p), r.clear(), r.off(), y.current = null;
267
+ return r.addEventListener("beginStroke", o), r.addEventListener("endStroke", g), $(e), f("empty"), () => {
268
+ r.removeEventListener("beginStroke", o), r.removeEventListener("endStroke", g), r.clear(), r.off(), h.current = null;
262
269
  };
263
- }, [d]), P(() => {
264
- const e = y.current;
265
- e && (f ? e.off() : e.on());
266
- }, [f, d]);
267
- const Q = 4096, $ = T(
270
+ }, [l]), P(() => {
271
+ const e = h.current;
272
+ e && (b ? e.off() : e.on());
273
+ }, [b, l]);
274
+ const J = 4096, $ = T(
268
275
  (e) => {
269
- const r = e.getBoundingClientRect(), c = Math.max(
276
+ const r = e.getBoundingClientRect(), o = Math.max(
270
277
  1,
271
278
  typeof window < "u" ? window.devicePixelRatio : 1
272
- ), p = Math.max(1, Math.floor(r.width * c)), x = Math.max(1, Math.floor(r.height * c)), A = Math.min(p, Q), k = Math.min(x, Q);
273
- if (e.width === A && e.height === k)
279
+ ), g = Math.max(1, Math.floor(r.width * o)), w = Math.max(1, Math.floor(r.height * o)), A = Math.min(g, J), x = Math.min(w, J);
280
+ if (e.width === A && e.height === x)
274
281
  return;
275
- const v = y.current, M = v ? v.toData() : null;
276
- e.width = A, e.height = k;
282
+ const p = h.current, M = p ? p.toData() : null;
283
+ e.width = A, e.height = x;
277
284
  const D = e.getContext("2d");
278
- D && D.scale(c, c), v && (w && (v.backgroundColor = w), b && (v.penColor = b), v.clear(), M && M.length > 0 && v.fromData(M));
285
+ D && D.scale(o, o), p && (y && (p.backgroundColor = y), m && (p.penColor = m), p.clear(), M && M.length > 0 && p.fromData(M));
279
286
  },
280
- [w, b]
287
+ [y, m]
281
288
  );
282
289
  P(() => {
283
290
  const e = V.current;
@@ -293,130 +300,130 @@ const Ue = ze(
293
300
  }, [$]);
294
301
  const H = T(() => {
295
302
  var r;
296
- const e = y.current;
297
- e && e.clear(), L(""), I(!1), g("cleared"), (r = E.current) == null || r.call(E);
298
- }, [g]), U = T(() => {
299
- const e = y.current;
303
+ const e = h.current;
304
+ e && e.clear(), L(""), I(!1), f("cleared"), (r = E.current) == null || r.call(E);
305
+ }, [f]), K = T(() => {
306
+ const e = h.current;
300
307
  if (!e) return;
301
308
  const r = e.toData();
302
- !r || r.length === 0 || (r.pop(), e.fromData(r), r.length === 0 && (I(!1), g("empty")));
303
- }, [g]), Y = T(() => {
304
- if (d === "typed") return S.trim().length === 0;
305
- const e = y.current;
309
+ !r || r.length === 0 || (r.pop(), e.fromData(r), r.length === 0 && (I(!1), f("empty")));
310
+ }, [f]), Q = T(() => {
311
+ if (l === "typed") return S.trim().length === 0;
312
+ const e = h.current;
306
313
  return e ? e.isEmpty() : !0;
307
- }, [d, S]), O = T(async () => {
308
- var ne;
314
+ }, [l, S]), U = T(async () => {
315
+ var re;
309
316
  const e = de(
310
317
  typeof a == "number" ? `${a}` : String(a)
311
318
  ), r = de(
312
- typeof m == "number" ? `${m}` : String(m)
313
- ), c = d === "draw" ? V.current ?? J.current ?? F.current : K.current ?? F.current, p = c == null ? void 0 : c.getBoundingClientRect(), x = e ?? (p ? p.width : 400), A = r ?? (p ? p.height : 200);
314
- let k = "", v = "", M;
315
- if (d === "draw") {
316
- const u = y.current;
319
+ typeof v == "number" ? `${v}` : String(v)
320
+ ), o = l === "draw" ? V.current ?? G.current ?? F.current : Z.current ?? F.current, g = o == null ? void 0 : o.getBoundingClientRect(), w = e ?? (g ? g.width : 400), A = r ?? (g ? g.height : 200);
321
+ let x = "", p = "", M;
322
+ if (l === "draw") {
323
+ const u = h.current;
317
324
  if (!u || u.isEmpty()) return null;
318
- k = u.toDataURL("image/png"), v = u.toSVG(), M = u.toData();
325
+ x = u.toDataURL("image/png"), p = u.toSVG(), M = u.toData();
319
326
  } else {
320
327
  const u = S.trim();
321
328
  if (u.length === 0) return null;
322
- k = He(
329
+ x = He(
323
330
  u,
324
- x,
331
+ w,
325
332
  A,
326
- b || "currentColor",
327
- w || "transparent"
333
+ m || "currentColor",
334
+ y || "transparent"
328
335
  ).toDataURL("image/png");
329
- const W = u.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
330
- v = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${x} ${A}" width="${x}" height="${A}"><text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" font-family="sans-serif" font-style="italic" font-size="32" fill="${b || "currentColor"}" letter-spacing="3">${W}</text></svg>`;
336
+ const O = u.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
337
+ p = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${w} ${A}" width="${w}" height="${A}"><text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" font-family="sans-serif" font-style="italic" font-size="32" fill="${m || "currentColor"}" letter-spacing="3">${O}</text></svg>`;
331
338
  }
332
- const D = x * 25.4 / 96, ke = A * 25.4 / 96, Ce = (/* @__PURE__ */ new Date()).toISOString();
333
- let te = "";
334
- if (k) {
335
- const u = k.indexOf(","), se = u >= 0 ? k.slice(u + 1) : "", W = Le(se);
336
- te = await Ie(W);
339
+ const D = w * 25.4 / 96, ke = A * 25.4 / 96, ze = (/* @__PURE__ */ new Date()).toISOString();
340
+ let ee = "";
341
+ if (x) {
342
+ const u = x.indexOf(","), ne = u >= 0 ? x.slice(u + 1) : "", O = Le(ne);
343
+ ee = await Ie(O);
337
344
  }
338
- const re = {
339
- png: k,
340
- svg: v,
345
+ const te = {
346
+ png: x,
347
+ svg: p,
341
348
  widthMm: D,
342
349
  heightMm: ke,
343
- capturedAt: Ce,
344
- sha256: te,
350
+ capturedAt: ze,
351
+ sha256: ee,
345
352
  strokes: M
346
353
  };
347
- return g("captured"), (ne = B.current) == null || ne.call(B, re), re;
348
- }, [d, S, a, m, b, w, g]), _ = ae(
354
+ return f("captured"), (re = B.current) == null || re.call(B, te), te;
355
+ }, [l, S, a, v, m, y, f]), _ = se(
349
356
  () => ({
350
357
  clear: H,
351
- undo: U,
352
- isEmpty: Y,
353
- confirm: O
358
+ undo: K,
359
+ isEmpty: Q,
360
+ confirm: U
354
361
  }),
355
- [H, U, Y, O]
362
+ [H, K, Q, U]
356
363
  );
357
364
  Re(fe, () => _, [_]), Ne(Pe, _, t);
358
- const we = d === "typed" ? S.trim().length > 0 : pe, ee = f || !we, xe = {
365
+ const we = l === "typed" ? S.trim().length > 0 : pe, Y = b || !we, xe = {
359
366
  "--signature-width": oe(
360
367
  a,
361
368
  "var(--signature-default-width)"
362
369
  ),
363
370
  "--signature-height": oe(
364
- m,
371
+ v,
365
372
  "var(--signature-default-height)"
366
373
  )
367
374
  };
368
- return /* @__PURE__ */ X(
375
+ return /* @__PURE__ */ W(
369
376
  "div",
370
377
  {
371
378
  ref: F,
372
379
  role: "group",
373
- "aria-label": le ?? o("signature.padLabel"),
374
- "aria-disabled": f || void 0,
380
+ "aria-label": le ?? c("signature.padLabel"),
381
+ "aria-disabled": b || void 0,
375
382
  className: [Te(), ue].filter(Boolean).join(" "),
376
383
  style: xe,
377
384
  "data-component": "signature-capture",
378
385
  "data-component-id": t,
379
386
  children: [
380
- d === "draw" ? /* @__PURE__ */ h("div", { ref: J, className: Ve(), children: /* @__PURE__ */ h(
387
+ l === "draw" ? /* @__PURE__ */ k("div", { ref: G, className: Ve(), children: /* @__PURE__ */ k(
381
388
  "canvas",
382
389
  {
383
390
  ref: V,
384
391
  role: "img",
385
- "aria-label": o("signature.padLabel"),
392
+ "aria-label": c("signature.padLabel"),
386
393
  className: je(),
387
394
  "data-testid": "signature-canvas"
388
395
  }
389
- ) }) : /* @__PURE__ */ X("label", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
390
- /* @__PURE__ */ h("span", { className: "type-body-sm ds:text-[var(--muted-foreground)]", children: o("signature.typedFallback.label") }),
391
- /* @__PURE__ */ h(
396
+ ) }) : /* @__PURE__ */ W("label", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
397
+ /* @__PURE__ */ k("span", { className: "type-body-sm ds:text-[var(--muted-foreground)]", children: c("signature.typedFallback.label") }),
398
+ /* @__PURE__ */ k(
392
399
  "input",
393
400
  {
394
401
  type: "text",
395
402
  value: S,
396
403
  onChange: (e) => {
397
- L(e.target.value), e.target.value.length > 0 ? g("drawing") : g("empty");
404
+ L(e.target.value), e.target.value.length > 0 ? f("drawing") : f("empty");
398
405
  },
399
- placeholder: o("signature.typedFallback.placeholder"),
400
- "aria-label": o("signature.typedFallback.label"),
401
- disabled: f,
406
+ placeholder: c("signature.typedFallback.placeholder"),
407
+ "aria-label": c("signature.typedFallback.label"),
408
+ disabled: b,
402
409
  className: $e(),
403
410
  "data-testid": "signature-typed-input"
404
411
  }
405
412
  ),
406
- S ? /* @__PURE__ */ h(
413
+ S ? /* @__PURE__ */ k(
407
414
  "div",
408
415
  {
409
- ref: K,
416
+ ref: Z,
410
417
  className: De(),
411
418
  "aria-hidden": "true",
412
419
  children: S
413
420
  }
414
421
  ) : null
415
422
  ] }),
416
- /* @__PURE__ */ h(
423
+ /* @__PURE__ */ k(
417
424
  "div",
418
425
  {
419
- id: Z,
426
+ id: q,
420
427
  "aria-live": "polite",
421
428
  "aria-atomic": "true",
422
429
  className: "ds:sr-only",
@@ -424,62 +431,50 @@ const Ue = ze(
424
431
  children: me
425
432
  }
426
433
  ),
427
- /* @__PURE__ */ X(
434
+ /* @__PURE__ */ W(
428
435
  "div",
429
436
  {
430
437
  className: Ee(),
431
438
  role: "group",
432
- "aria-label": o("signature.padLabel"),
439
+ "aria-label": c("signature.padLabel"),
433
440
  children: [
434
- /* @__PURE__ */ h(
441
+ /* @__PURE__ */ k(
435
442
  "button",
436
443
  {
437
444
  type: "button",
438
445
  onClick: () => {
439
- f || H();
446
+ b || H();
440
447
  },
441
- "aria-disabled": f || void 0,
442
- className: q(),
443
- children: o("signature.clear")
448
+ "aria-disabled": b || void 0,
449
+ className: ae(),
450
+ children: c("signature.clear")
444
451
  }
445
452
  ),
446
- d === "draw" ? /* @__PURE__ */ h(
447
- "button",
448
- {
449
- type: "button",
450
- onClick: () => {
451
- f || U();
452
- },
453
- "aria-disabled": f || void 0,
454
- className: q(),
455
- children: o("signature.undo")
456
- }
457
- ) : null,
458
- ce ? /* @__PURE__ */ h(
453
+ ce ? /* @__PURE__ */ k(
459
454
  "button",
460
455
  {
461
456
  type: "button",
462
457
  onClick: () => {
463
- f || (L(""), ge((e) => e === "draw" ? "typed" : "draw"), g("cleared"));
458
+ b || (L(""), ge((e) => e === "draw" ? "typed" : "draw"), f("cleared"));
464
459
  },
465
- "aria-disabled": f || void 0,
466
- className: q(),
467
- "aria-pressed": d === "typed",
468
- children: o(d === "draw" ? "signature.typedFallback.toggle" : "signature.typedFallback.toggleDraw")
460
+ "aria-disabled": b || void 0,
461
+ className: ae(),
462
+ "aria-pressed": l === "typed",
463
+ children: c(l === "draw" ? "signature.typedFallback.toggle" : "signature.typedFallback.toggleDraw")
469
464
  }
470
465
  ) : null,
471
- /* @__PURE__ */ h(
466
+ /* @__PURE__ */ k(
472
467
  "button",
473
468
  {
474
469
  type: "button",
475
470
  onClick: () => {
476
- ee || O();
471
+ Y || U();
477
472
  },
478
- "aria-disabled": ee || void 0,
479
- "aria-describedby": Z,
473
+ "aria-disabled": Y || void 0,
474
+ "aria-describedby": q,
480
475
  className: Be(),
481
476
  "data-testid": "signature-confirm",
482
- children: o("signature.confirm")
477
+ children: c("signature.confirm")
483
478
  }
484
479
  )
485
480
  ]
@@ -495,4 +490,4 @@ export {
495
490
  Ue as S,
496
491
  Pe as s
497
492
  };
498
- //# sourceMappingURL=signature-capture-C-fF71xI.js.map
493
+ //# sourceMappingURL=signature-capture-DoiBd6i3.js.map