@alfadocs/ui-kit-debug 0.52.0 → 0.53.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 (136) hide show
  1. package/dist/_chunks/{otp-input-CMphfBxZ.js → otp-input-Chb9r5vf.js} +89 -87
  2. package/dist/_chunks/{otp-input-CMphfBxZ.js.map → otp-input-Chb9r5vf.js.map} +1 -1
  3. package/dist/_chunks/{public-header.agent-BY6FH71R.js → public-header.agent-DyVpPwmv.js} +72 -62
  4. package/dist/_chunks/public-header.agent-DyVpPwmv.js.map +1 -0
  5. package/dist/_chunks/{sign-document-Bzld9jVM.js → sign-document-BzHTjMVC.js} +2 -2
  6. package/dist/_chunks/{sign-document-Bzld9jVM.js.map → sign-document-BzHTjMVC.js.map} +1 -1
  7. package/dist/_chunks/{signature-capture-CpMBhqQ9.js → signature-capture-CHbrKoA_.js} +163 -152
  8. package/dist/_chunks/signature-capture-CHbrKoA_.js.map +1 -0
  9. package/dist/_chunks/signature-field-DhscKdgk.js +152 -0
  10. package/dist/_chunks/signature-field-DhscKdgk.js.map +1 -0
  11. package/dist/_chunks/use-signing-session-C5evzYmo.js +108 -0
  12. package/dist/_chunks/use-signing-session-C5evzYmo.js.map +1 -0
  13. package/dist/agent-catalog.json +1 -1
  14. package/dist/components/index.d.ts +3 -2
  15. package/dist/components/index.d.ts.map +1 -1
  16. package/dist/components/otp-input/index.js +1 -1
  17. package/dist/components/otp-input/otp-input.d.ts +6 -0
  18. package/dist/components/otp-input/otp-input.d.ts.map +1 -1
  19. package/dist/components/pdf-viewer/index.d.ts +1 -1
  20. package/dist/components/pdf-viewer/index.d.ts.map +1 -1
  21. package/dist/components/public-header/index.js +1 -1
  22. package/dist/components/public-header/public-header.d.ts +1 -1
  23. package/dist/components/public-header/public-header.d.ts.map +1 -1
  24. package/dist/components/sign-document/index.js +1 -1
  25. package/dist/components/signature-capture/index.js +1 -1
  26. package/dist/components/signature-capture/signature-capture.d.ts +7 -0
  27. package/dist/components/signature-capture/signature-capture.d.ts.map +1 -1
  28. package/dist/components/signature-field/index.d.ts +3 -0
  29. package/dist/components/signature-field/index.d.ts.map +1 -0
  30. package/dist/components/signature-field/index.js +6 -0
  31. package/dist/components/signature-field/index.js.map +1 -0
  32. package/dist/components/signature-field/signature-field.d.ts +35 -0
  33. package/dist/components/signature-field/signature-field.d.ts.map +1 -0
  34. package/dist/hooks/index.d.ts +1 -0
  35. package/dist/hooks/index.d.ts.map +1 -1
  36. package/dist/hooks/index.js +42 -41
  37. package/dist/hooks/use-signing-session.d.ts +36 -0
  38. package/dist/hooks/use-signing-session.d.ts.map +1 -0
  39. package/dist/i18n/locales/ar.d.ts +8 -0
  40. package/dist/i18n/locales/ar.d.ts.map +1 -1
  41. package/dist/i18n/locales/ar.js +8 -0
  42. package/dist/i18n/locales/ar.js.map +1 -1
  43. package/dist/i18n/locales/de.d.ts +8 -0
  44. package/dist/i18n/locales/de.d.ts.map +1 -1
  45. package/dist/i18n/locales/de.js +8 -0
  46. package/dist/i18n/locales/de.js.map +1 -1
  47. package/dist/i18n/locales/el.d.ts +8 -0
  48. package/dist/i18n/locales/el.d.ts.map +1 -1
  49. package/dist/i18n/locales/el.js +8 -0
  50. package/dist/i18n/locales/el.js.map +1 -1
  51. package/dist/i18n/locales/en.d.ts +8 -0
  52. package/dist/i18n/locales/en.d.ts.map +1 -1
  53. package/dist/i18n/locales/en.js +8 -0
  54. package/dist/i18n/locales/en.js.map +1 -1
  55. package/dist/i18n/locales/es.d.ts +8 -0
  56. package/dist/i18n/locales/es.d.ts.map +1 -1
  57. package/dist/i18n/locales/es.js +8 -0
  58. package/dist/i18n/locales/es.js.map +1 -1
  59. package/dist/i18n/locales/fr.d.ts +8 -0
  60. package/dist/i18n/locales/fr.d.ts.map +1 -1
  61. package/dist/i18n/locales/fr.js +8 -0
  62. package/dist/i18n/locales/fr.js.map +1 -1
  63. package/dist/i18n/locales/hi.d.ts +8 -0
  64. package/dist/i18n/locales/hi.d.ts.map +1 -1
  65. package/dist/i18n/locales/hi.js +8 -0
  66. package/dist/i18n/locales/hi.js.map +1 -1
  67. package/dist/i18n/locales/it.d.ts +8 -0
  68. package/dist/i18n/locales/it.d.ts.map +1 -1
  69. package/dist/i18n/locales/it.js +8 -0
  70. package/dist/i18n/locales/it.js.map +1 -1
  71. package/dist/i18n/locales/ja.d.ts +8 -0
  72. package/dist/i18n/locales/ja.d.ts.map +1 -1
  73. package/dist/i18n/locales/ja.js +8 -0
  74. package/dist/i18n/locales/ja.js.map +1 -1
  75. package/dist/i18n/locales/nl.d.ts +8 -0
  76. package/dist/i18n/locales/nl.d.ts.map +1 -1
  77. package/dist/i18n/locales/nl.js +8 -0
  78. package/dist/i18n/locales/nl.js.map +1 -1
  79. package/dist/i18n/locales/pl.d.ts +8 -0
  80. package/dist/i18n/locales/pl.d.ts.map +1 -1
  81. package/dist/i18n/locales/pl.js +8 -0
  82. package/dist/i18n/locales/pl.js.map +1 -1
  83. package/dist/i18n/locales/pt.d.ts +8 -0
  84. package/dist/i18n/locales/pt.d.ts.map +1 -1
  85. package/dist/i18n/locales/pt.js +8 -0
  86. package/dist/i18n/locales/pt.js.map +1 -1
  87. package/dist/i18n/locales/ro.d.ts +8 -0
  88. package/dist/i18n/locales/ro.d.ts.map +1 -1
  89. package/dist/i18n/locales/ro.js +8 -0
  90. package/dist/i18n/locales/ro.js.map +1 -1
  91. package/dist/i18n/locales/ru.d.ts +8 -0
  92. package/dist/i18n/locales/ru.d.ts.map +1 -1
  93. package/dist/i18n/locales/ru.js +8 -0
  94. package/dist/i18n/locales/ru.js.map +1 -1
  95. package/dist/i18n/locales/sq.d.ts +8 -0
  96. package/dist/i18n/locales/sq.d.ts.map +1 -1
  97. package/dist/i18n/locales/sq.js +8 -0
  98. package/dist/i18n/locales/sq.js.map +1 -1
  99. package/dist/i18n/locales/sv.d.ts +8 -0
  100. package/dist/i18n/locales/sv.d.ts.map +1 -1
  101. package/dist/i18n/locales/sv.js +8 -0
  102. package/dist/i18n/locales/sv.js.map +1 -1
  103. package/dist/i18n/locales/tr.d.ts +8 -0
  104. package/dist/i18n/locales/tr.d.ts.map +1 -1
  105. package/dist/i18n/locales/tr.js +8 -0
  106. package/dist/i18n/locales/tr.js.map +1 -1
  107. package/dist/i18n/locales/zh.d.ts +8 -0
  108. package/dist/i18n/locales/zh.d.ts.map +1 -1
  109. package/dist/i18n/locales/zh.js +8 -0
  110. package/dist/i18n/locales/zh.js.map +1 -1
  111. package/dist/index.js +701 -697
  112. package/dist/index.js.map +1 -1
  113. package/dist/locales/ar.json +8 -0
  114. package/dist/locales/de.json +8 -0
  115. package/dist/locales/el.json +8 -0
  116. package/dist/locales/en.json +8 -0
  117. package/dist/locales/es.json +8 -0
  118. package/dist/locales/fr.json +8 -0
  119. package/dist/locales/hi.json +8 -0
  120. package/dist/locales/it.json +8 -0
  121. package/dist/locales/ja.json +8 -0
  122. package/dist/locales/nl.json +8 -0
  123. package/dist/locales/pl.json +8 -0
  124. package/dist/locales/pt.json +8 -0
  125. package/dist/locales/ro.json +8 -0
  126. package/dist/locales/ru.json +8 -0
  127. package/dist/locales/sq.json +8 -0
  128. package/dist/locales/sv.json +8 -0
  129. package/dist/locales/tr.json +8 -0
  130. package/dist/locales/zh.json +8 -0
  131. package/dist/tokens.css +1 -1
  132. package/package.json +5 -1
  133. package/dist/_chunks/public-header.agent-BY6FH71R.js.map +0 -1
  134. package/dist/_chunks/signature-capture-CpMBhqQ9.js.map +0 -1
  135. package/dist/_chunks/use-scroll-to-first-error-4Za-u5Nw.js +0 -43
  136. package/dist/_chunks/use-scroll-to-first-error-4Za-u5Nw.js.map +0 -1
@@ -1,10 +1,10 @@
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
- import Ae from "signature_pad";
1
+ import { jsxs as q, jsx as b } from "react/jsx-runtime";
2
+ import { forwardRef as Ve, useId as Ae, useMemo as ie, useRef as z, useState as A, useEffect as N, useCallback as P, useImperativeHandle as Me } from "react";
3
+ import Ne from "signature_pad";
4
4
  import { c as R } from "./index-D2ZczOXr.js";
5
- import { useTranslation as Me } from "react-i18next";
6
- import { u as Ne } from "./registry-nPAVE19X.js";
7
- const Pe = {
5
+ import { useTranslation as Pe } from "react-i18next";
6
+ import { u as Te } from "./registry-nPAVE19X.js";
7
+ const je = {
8
8
  id: "signature-capture",
9
9
  capabilities: ["edit_inline", "submit"],
10
10
  state: {
@@ -43,7 +43,7 @@ const Pe = {
43
43
  description: "Sourced from the id prop."
44
44
  }
45
45
  }
46
- }, Te = R(
46
+ }, Be = R(
47
47
  [
48
48
  "ds:signature-capture-alfadocs ds:flex ds:flex-col",
49
49
  "ds:gap-[var(--spacing-sm)]",
@@ -54,7 +54,7 @@ const Pe = {
54
54
  "ds:p-[var(--spacing-sm)]",
55
55
  "ds:aria-disabled:opacity-[var(--opacity-50)] ds:aria-disabled:cursor-not-allowed"
56
56
  ].join(" ")
57
- ), Ve = R(
57
+ ), Ee = R(
58
58
  [
59
59
  "ds:relative ds:block",
60
60
  "ds:inline-size-[var(--signature-width)]",
@@ -69,7 +69,7 @@ const Pe = {
69
69
  "ds:focus-visible:outline-[var(--ring)]",
70
70
  "ds:forced-colors:focus-visible:outline-[CanvasText]"
71
71
  ].join(" ")
72
- ), je = R(
72
+ ), $e = R(
73
73
  [
74
74
  "ds:block",
75
75
  "ds:inline-size-full",
@@ -77,11 +77,11 @@ const Pe = {
77
77
  "ds:touch-none",
78
78
  "ds:select-none"
79
79
  ].join(" ")
80
- ), Ee = R(
80
+ ), De = R(
81
81
  ["ds:flex ds:items-stretch ds:flex-wrap ds:gap-[var(--spacing-sm)]"].join(
82
82
  " "
83
83
  )
84
- ), ae = R(
84
+ ), oe = R(
85
85
  [
86
86
  "ds:inline-flex ds:flex-1 ds:items-center ds:justify-center",
87
87
  "ds:[min-block-size:var(--min-target-size)]",
@@ -102,7 +102,7 @@ const Pe = {
102
102
  "ds:forced-colors:focus-visible:outline-[CanvasText]",
103
103
  "ds:aria-disabled:opacity-[var(--opacity-50)] ds:aria-disabled:cursor-not-allowed"
104
104
  ].join(" ")
105
- ), Be = R(
105
+ ), Fe = R(
106
106
  [
107
107
  "ds:inline-flex ds:flex-1 ds:items-center ds:justify-center",
108
108
  "ds:[min-block-size:var(--min-target-size)]",
@@ -121,7 +121,7 @@ const Pe = {
121
121
  "ds:forced-colors:focus-visible:outline-[CanvasText]",
122
122
  "ds:aria-disabled:opacity-[var(--opacity-50)] ds:aria-disabled:cursor-not-allowed"
123
123
  ].join(" ")
124
- ), $e = R(
124
+ ), Le = R(
125
125
  [
126
126
  "ds:block ds:inline-size-full",
127
127
  "ds:[min-block-size:var(--min-target-size)]",
@@ -138,7 +138,7 @@ const Pe = {
138
138
  "ds:focus-visible:outline-[var(--ring)]",
139
139
  "ds:forced-colors:focus-visible:outline-[CanvasText]"
140
140
  ].join(" ")
141
- ), De = R(
141
+ ), Ie = R(
142
142
  [
143
143
  "ds:flex ds:items-center ds:justify-center",
144
144
  "ds:inline-size-[var(--signature-width)]",
@@ -154,18 +154,18 @@ const Pe = {
154
154
  "ds:p-[var(--spacing-md)]"
155
155
  ].join(" ")
156
156
  );
157
- function ie(t) {
157
+ function de(t) {
158
158
  return typeof document > "u" ? "" : getComputedStyle(document.documentElement).getPropertyValue(t).trim();
159
159
  }
160
- function oe(t, n) {
160
+ function ce(t, n) {
161
161
  return typeof t == "number" ? `${t}px` : typeof t == "string" && t.length > 0 ? t : n;
162
162
  }
163
- function de(t) {
163
+ function le(t) {
164
164
  if (typeof t == "string" && /[^0-9.\s\-px]/i.test(t)) return null;
165
165
  const n = parseFloat(t);
166
166
  return Number.isFinite(n) ? n : null;
167
167
  }
168
- function Fe(t) {
168
+ function He(t) {
169
169
  let n = "";
170
170
  for (let s = 0; s < t.length; s += 1) {
171
171
  const i = t[s];
@@ -173,7 +173,7 @@ function Fe(t) {
173
173
  }
174
174
  return n;
175
175
  }
176
- function Le(t) {
176
+ function Ue(t) {
177
177
  if (typeof atob == "function") {
178
178
  const s = atob(t), i = new Uint8Array(s.length);
179
179
  for (let a = 0; a < s.length; a += 1) i[a] = s.charCodeAt(a);
@@ -182,18 +182,18 @@ function Le(t) {
182
182
  const n = globalThis;
183
183
  return n.Buffer ? n.Buffer.from(t, "base64") : new Uint8Array();
184
184
  }
185
- async function Ie(t) {
185
+ async function Oe(t) {
186
186
  var s;
187
187
  const n = globalThis;
188
188
  if ((s = n.crypto) != null && s.subtle) {
189
189
  const i = new Uint8Array(t.byteLength);
190
190
  i.set(t);
191
191
  const a = await n.crypto.subtle.digest("SHA-256", i.buffer);
192
- return Fe(new Uint8Array(a));
192
+ return He(new Uint8Array(a));
193
193
  }
194
194
  return "";
195
195
  }
196
- function He(t, n, s, i, a) {
196
+ function _e(t, n, s, i, a) {
197
197
  const v = Math.max(
198
198
  1,
199
199
  typeof window < "u" ? window.devicePixelRatio : 1
@@ -202,7 +202,7 @@ function He(t, n, s, i, a) {
202
202
  const d = C.getContext("2d");
203
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;
204
204
  }
205
- const Ue = Ce(
205
+ const We = Ve(
206
206
  ({
207
207
  id: t,
208
208
  onConfirm: n,
@@ -212,29 +212,30 @@ const Ue = Ce(
212
212
  height: v = 200,
213
213
  penColor: C,
214
214
  backgroundColor: d,
215
- allowTypedFallback: ce = !0,
216
- disabled: b = !1,
217
- ariaLabel: le,
218
- className: ue
219
- }, fe) => {
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);
224
- P(() => {
225
- j.current = i, E.current = s, B.current = n;
215
+ allowTypedFallback: ue = !0,
216
+ name: T,
217
+ disabled: h = !1,
218
+ ariaLabel: fe,
219
+ className: ge
220
+ }, pe) => {
221
+ const { t: c } = Pe(), G = Ae(), Z = `${ie(
222
+ () => `sig-${G.replace(/[^a-zA-Z0-9-_]/g, "")}`,
223
+ [G]
224
+ )}-live`, L = z(null), J = z(null), j = z(null), K = z(null), y = z(null), [l, ve] = A("draw"), [S, I] = A(""), [me, Q] = A(""), [be, H] = A(!1), he = z("empty"), [ye, we] = A(""), [m, xe] = A(""), [w, ke] = A(""), B = z(i), E = z(s), $ = z(n);
225
+ N(() => {
226
+ B.current = i, E.current = s, $.current = n;
226
227
  }, [i, s, n]);
227
- const f = T(
228
+ const f = P(
228
229
  (e) => {
229
- ve.current = e, be(c(`signature.state.${e}`));
230
+ he.current = e, we(c(`signature.state.${e}`));
230
231
  },
231
232
  [c]
232
233
  );
233
- P(() => {
234
+ N(() => {
234
235
  if (typeof document > "u") return;
235
236
  function e() {
236
- const o = C ?? ie("--foreground"), g = d ?? ie("--background");
237
- he(o || "currentColor"), ye(g || "transparent");
237
+ const o = C ?? de("--foreground"), g = d ?? de("--background");
238
+ xe(o || "currentColor"), ke(g || "transparent");
238
239
  }
239
240
  e();
240
241
  const r = new MutationObserver(() => {
@@ -244,235 +245,245 @@ const Ue = Ce(
244
245
  attributes: !0,
245
246
  attributeFilter: ["class"]
246
247
  }), () => r.disconnect();
247
- }, [C, d]), P(() => {
248
- const e = h.current;
249
- e && (m && (e.penColor = m), y && (e.backgroundColor = y));
250
- }, [m, y]), P(() => {
248
+ }, [C, d]), N(() => {
249
+ const e = y.current;
250
+ e && (m && (e.penColor = m), w && (e.backgroundColor = w));
251
+ }, [m, w]), N(() => {
251
252
  if (l !== "draw") return;
252
- const e = V.current;
253
+ const e = j.current;
253
254
  if (!e) return;
254
- const r = new Ae(e, {
255
+ const r = new Ne(e, {
255
256
  penColor: m || "currentColor",
256
- backgroundColor: y || "transparent",
257
+ backgroundColor: w || "transparent",
257
258
  minWidth: 0.5,
258
259
  maxWidth: 2.5,
259
260
  velocityFilterWeight: 0.7
260
261
  });
261
- h.current = r;
262
+ y.current = r;
262
263
  const o = () => {
263
- var w;
264
- I(!0), f("drawing"), (w = j.current) == null || w.call(j);
264
+ var x;
265
+ H(!0), f("drawing"), (x = B.current) == null || x.call(B);
265
266
  }, g = () => {
266
267
  };
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;
268
+ return r.addEventListener("beginStroke", o), r.addEventListener("endStroke", g), D(e), f("empty"), () => {
269
+ r.removeEventListener("beginStroke", o), r.removeEventListener("endStroke", g), r.clear(), r.off(), y.current = null;
269
270
  };
270
- }, [l]), P(() => {
271
- const e = h.current;
272
- e && (b ? e.off() : e.on());
273
- }, [b, l]);
274
- const J = 4096, $ = T(
271
+ }, [l]), N(() => {
272
+ const e = y.current;
273
+ e && (h ? e.off() : e.on());
274
+ }, [h, l]);
275
+ const Y = 4096, D = P(
275
276
  (e) => {
276
277
  const r = e.getBoundingClientRect(), o = Math.max(
277
278
  1,
278
279
  typeof window < "u" ? window.devicePixelRatio : 1
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)
280
+ ), g = Math.max(1, Math.floor(r.width * o)), x = Math.max(1, Math.floor(r.height * o)), V = Math.min(g, Y), k = Math.min(x, Y);
281
+ if (e.width === V && e.height === k)
281
282
  return;
282
- const p = h.current, M = p ? p.toData() : null;
283
- e.width = A, e.height = x;
284
- const D = e.getContext("2d");
285
- D && D.scale(o, o), p && (y && (p.backgroundColor = y), m && (p.penColor = m), p.clear(), M && M.length > 0 && p.fromData(M));
283
+ const p = y.current, M = p ? p.toData() : null;
284
+ e.width = V, e.height = k;
285
+ const F = e.getContext("2d");
286
+ F && F.scale(o, o), p && (w && (p.backgroundColor = w), m && (p.penColor = m), p.clear(), M && M.length > 0 && p.fromData(M));
286
287
  },
287
- [y, m]
288
+ [w, m]
288
289
  );
289
- P(() => {
290
- const e = V.current;
290
+ N(() => {
291
+ const e = j.current;
291
292
  if (!e) return;
292
293
  if (typeof ResizeObserver > "u") {
293
- $(e);
294
+ D(e);
294
295
  return;
295
296
  }
296
297
  const r = new ResizeObserver(() => {
297
- $(e);
298
+ D(e);
298
299
  });
299
300
  return r.observe(e), () => r.disconnect();
300
- }, [$]);
301
- const H = T(() => {
301
+ }, [D]);
302
+ const U = P(() => {
302
303
  var r;
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;
304
+ const e = y.current;
305
+ e && e.clear(), I(""), Q(""), H(!1), f("cleared"), (r = E.current) == null || r.call(E);
306
+ }, [f]), ee = P(() => {
307
+ const e = y.current;
307
308
  if (!e) return;
308
309
  const r = e.toData();
309
- !r || r.length === 0 || (r.pop(), e.fromData(r), r.length === 0 && (I(!1), f("empty")));
310
- }, [f]), Q = T(() => {
310
+ !r || r.length === 0 || (r.pop(), e.fromData(r), r.length === 0 && (H(!1), f("empty")));
311
+ }, [f]), te = P(() => {
311
312
  if (l === "typed") return S.trim().length === 0;
312
- const e = h.current;
313
+ const e = y.current;
313
314
  return e ? e.isEmpty() : !0;
314
- }, [l, S]), U = T(async () => {
315
- var re;
316
- const e = de(
315
+ }, [l, S]), O = P(async () => {
316
+ var se;
317
+ const e = le(
317
318
  typeof a == "number" ? `${a}` : String(a)
318
- ), r = de(
319
+ ), r = le(
319
320
  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;
321
+ ), o = l === "draw" ? j.current ?? J.current ?? L.current : K.current ?? L.current, g = o == null ? void 0 : o.getBoundingClientRect(), x = e ?? (g ? g.width : 400), V = r ?? (g ? g.height : 200);
322
+ let k = "", p = "", M;
322
323
  if (l === "draw") {
323
- const u = h.current;
324
+ const u = y.current;
324
325
  if (!u || u.isEmpty()) return null;
325
- x = u.toDataURL("image/png"), p = u.toSVG(), M = u.toData();
326
+ k = u.toDataURL("image/png"), p = u.toSVG(), M = u.toData();
326
327
  } else {
327
328
  const u = S.trim();
328
329
  if (u.length === 0) return null;
329
- x = He(
330
+ k = _e(
330
331
  u,
331
- w,
332
- A,
332
+ x,
333
+ V,
333
334
  m || "currentColor",
334
- y || "transparent"
335
+ w || "transparent"
335
336
  ).toDataURL("image/png");
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>`;
337
+ const X = u.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
338
+ p = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${x} ${V}" width="${x}" height="${V}"><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">${X}</text></svg>`;
338
339
  }
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);
340
+ const F = x * 25.4 / 96, Se = V * 25.4 / 96, Re = (/* @__PURE__ */ new Date()).toISOString();
341
+ let ne = "";
342
+ if (k) {
343
+ const u = k.indexOf(","), ae = u >= 0 ? k.slice(u + 1) : "", X = Ue(ae);
344
+ ne = await Oe(X);
344
345
  }
345
- const te = {
346
- png: x,
346
+ const W = {
347
+ png: k,
347
348
  svg: p,
348
- widthMm: D,
349
- heightMm: ke,
350
- capturedAt: ze,
351
- sha256: ee,
349
+ widthMm: F,
350
+ heightMm: Se,
351
+ capturedAt: Re,
352
+ sha256: ne,
352
353
  strokes: M
353
354
  };
354
- return f("captured"), (re = B.current) == null || re.call(B, te), te;
355
- }, [l, S, a, v, m, y, f]), _ = se(
355
+ return f("captured"), T && Q(W.png), (se = $.current) == null || se.call($, W), W;
356
+ }, [
357
+ l,
358
+ S,
359
+ a,
360
+ v,
361
+ m,
362
+ w,
363
+ f,
364
+ T
365
+ ]), _ = ie(
356
366
  () => ({
357
- clear: H,
358
- undo: K,
359
- isEmpty: Q,
360
- confirm: U
367
+ clear: U,
368
+ undo: ee,
369
+ isEmpty: te,
370
+ confirm: O
361
371
  }),
362
- [H, K, Q, U]
372
+ [U, ee, te, O]
363
373
  );
364
- Re(fe, () => _, [_]), Ne(Pe, _, t);
365
- const we = l === "typed" ? S.trim().length > 0 : pe, Y = b || !we, xe = {
366
- "--signature-width": oe(
374
+ Me(pe, () => _, [_]), Te(je, _, t);
375
+ const ze = l === "typed" ? S.trim().length > 0 : be, re = h || !ze, Ce = {
376
+ "--signature-width": ce(
367
377
  a,
368
378
  "var(--signature-default-width)"
369
379
  ),
370
- "--signature-height": oe(
380
+ "--signature-height": ce(
371
381
  v,
372
382
  "var(--signature-default-height)"
373
383
  )
374
384
  };
375
- return /* @__PURE__ */ W(
385
+ return /* @__PURE__ */ q(
376
386
  "div",
377
387
  {
378
- ref: F,
388
+ ref: L,
379
389
  role: "group",
380
- "aria-label": le ?? c("signature.padLabel"),
381
- "aria-disabled": b || void 0,
382
- className: [Te(), ue].filter(Boolean).join(" "),
383
- style: xe,
390
+ "aria-label": fe ?? c("signature.padLabel"),
391
+ "aria-disabled": h || void 0,
392
+ className: [Be(), ge].filter(Boolean).join(" "),
393
+ style: Ce,
384
394
  "data-component": "signature-capture",
385
395
  "data-component-id": t,
386
396
  children: [
387
- l === "draw" ? /* @__PURE__ */ k("div", { ref: G, className: Ve(), children: /* @__PURE__ */ k(
397
+ T ? /* @__PURE__ */ b("input", { type: "hidden", name: T, value: me, readOnly: !0 }) : null,
398
+ l === "draw" ? /* @__PURE__ */ b("div", { ref: J, className: Ee(), children: /* @__PURE__ */ b(
388
399
  "canvas",
389
400
  {
390
- ref: V,
401
+ ref: j,
391
402
  role: "img",
392
403
  "aria-label": c("signature.padLabel"),
393
- className: je(),
404
+ className: $e(),
394
405
  "data-testid": "signature-canvas"
395
406
  }
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(
407
+ ) }) : /* @__PURE__ */ q("label", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]", children: [
408
+ /* @__PURE__ */ b("span", { className: "type-body-sm ds:text-[var(--muted-foreground)]", children: c("signature.typedFallback.label") }),
409
+ /* @__PURE__ */ b(
399
410
  "input",
400
411
  {
401
412
  type: "text",
402
413
  value: S,
403
414
  onChange: (e) => {
404
- L(e.target.value), e.target.value.length > 0 ? f("drawing") : f("empty");
415
+ I(e.target.value), e.target.value.length > 0 ? f("drawing") : f("empty");
405
416
  },
406
417
  placeholder: c("signature.typedFallback.placeholder"),
407
418
  "aria-label": c("signature.typedFallback.label"),
408
- disabled: b,
409
- className: $e(),
419
+ disabled: h,
420
+ className: Le(),
410
421
  "data-testid": "signature-typed-input"
411
422
  }
412
423
  ),
413
- S ? /* @__PURE__ */ k(
424
+ S ? /* @__PURE__ */ b(
414
425
  "div",
415
426
  {
416
- ref: Z,
417
- className: De(),
427
+ ref: K,
428
+ className: Ie(),
418
429
  "aria-hidden": "true",
419
430
  children: S
420
431
  }
421
432
  ) : null
422
433
  ] }),
423
- /* @__PURE__ */ k(
434
+ /* @__PURE__ */ b(
424
435
  "div",
425
436
  {
426
- id: q,
437
+ id: Z,
427
438
  "aria-live": "polite",
428
439
  "aria-atomic": "true",
429
440
  className: "ds:sr-only",
430
441
  "data-testid": "signature-live",
431
- children: me
442
+ children: ye
432
443
  }
433
444
  ),
434
- /* @__PURE__ */ W(
445
+ /* @__PURE__ */ q(
435
446
  "div",
436
447
  {
437
- className: Ee(),
448
+ className: De(),
438
449
  role: "group",
439
450
  "aria-label": c("signature.padLabel"),
440
451
  children: [
441
- /* @__PURE__ */ k(
452
+ /* @__PURE__ */ b(
442
453
  "button",
443
454
  {
444
455
  type: "button",
445
456
  onClick: () => {
446
- b || H();
457
+ h || U();
447
458
  },
448
- "aria-disabled": b || void 0,
449
- className: ae(),
459
+ "aria-disabled": h || void 0,
460
+ className: oe(),
450
461
  children: c("signature.clear")
451
462
  }
452
463
  ),
453
- ce ? /* @__PURE__ */ k(
464
+ ue ? /* @__PURE__ */ b(
454
465
  "button",
455
466
  {
456
467
  type: "button",
457
468
  onClick: () => {
458
- b || (L(""), ge((e) => e === "draw" ? "typed" : "draw"), f("cleared"));
469
+ h || (I(""), ve((e) => e === "draw" ? "typed" : "draw"), f("cleared"));
459
470
  },
460
- "aria-disabled": b || void 0,
461
- className: ae(),
471
+ "aria-disabled": h || void 0,
472
+ className: oe(),
462
473
  "aria-pressed": l === "typed",
463
474
  children: c(l === "draw" ? "signature.typedFallback.toggle" : "signature.typedFallback.toggleDraw")
464
475
  }
465
476
  ) : null,
466
- /* @__PURE__ */ k(
477
+ /* @__PURE__ */ b(
467
478
  "button",
468
479
  {
469
480
  type: "button",
470
481
  onClick: () => {
471
- Y || U();
482
+ re || O();
472
483
  },
473
- "aria-disabled": Y || void 0,
474
- "aria-describedby": q,
475
- className: Be(),
484
+ "aria-disabled": re || void 0,
485
+ "aria-describedby": Z,
486
+ className: Fe(),
476
487
  "data-testid": "signature-confirm",
477
488
  children: c("signature.confirm")
478
489
  }
@@ -485,9 +496,9 @@ const Ue = Ce(
485
496
  );
486
497
  }
487
498
  );
488
- Ue.displayName = "SignatureCapture";
499
+ We.displayName = "SignatureCapture";
489
500
  export {
490
- Ue as S,
491
- Pe as s
501
+ We as S,
502
+ je as s
492
503
  };
493
- //# sourceMappingURL=signature-capture-CpMBhqQ9.js.map
504
+ //# sourceMappingURL=signature-capture-CHbrKoA_.js.map