@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.
- package/dist/_chunks/{otp-input-CMphfBxZ.js → otp-input-Chb9r5vf.js} +89 -87
- package/dist/_chunks/{otp-input-CMphfBxZ.js.map → otp-input-Chb9r5vf.js.map} +1 -1
- package/dist/_chunks/{public-header.agent-BY6FH71R.js → public-header.agent-DyVpPwmv.js} +72 -62
- package/dist/_chunks/public-header.agent-DyVpPwmv.js.map +1 -0
- package/dist/_chunks/{sign-document-Bzld9jVM.js → sign-document-BzHTjMVC.js} +2 -2
- package/dist/_chunks/{sign-document-Bzld9jVM.js.map → sign-document-BzHTjMVC.js.map} +1 -1
- package/dist/_chunks/{signature-capture-CpMBhqQ9.js → signature-capture-CHbrKoA_.js} +163 -152
- package/dist/_chunks/signature-capture-CHbrKoA_.js.map +1 -0
- package/dist/_chunks/signature-field-DhscKdgk.js +152 -0
- package/dist/_chunks/signature-field-DhscKdgk.js.map +1 -0
- package/dist/_chunks/use-signing-session-C5evzYmo.js +108 -0
- package/dist/_chunks/use-signing-session-C5evzYmo.js.map +1 -0
- package/dist/agent-catalog.json +1 -1
- package/dist/components/index.d.ts +3 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/otp-input/index.js +1 -1
- package/dist/components/otp-input/otp-input.d.ts +6 -0
- package/dist/components/otp-input/otp-input.d.ts.map +1 -1
- package/dist/components/pdf-viewer/index.d.ts +1 -1
- package/dist/components/pdf-viewer/index.d.ts.map +1 -1
- package/dist/components/public-header/index.js +1 -1
- package/dist/components/public-header/public-header.d.ts +1 -1
- package/dist/components/public-header/public-header.d.ts.map +1 -1
- package/dist/components/sign-document/index.js +1 -1
- package/dist/components/signature-capture/index.js +1 -1
- package/dist/components/signature-capture/signature-capture.d.ts +7 -0
- package/dist/components/signature-capture/signature-capture.d.ts.map +1 -1
- package/dist/components/signature-field/index.d.ts +3 -0
- package/dist/components/signature-field/index.d.ts.map +1 -0
- package/dist/components/signature-field/index.js +6 -0
- package/dist/components/signature-field/index.js.map +1 -0
- package/dist/components/signature-field/signature-field.d.ts +35 -0
- package/dist/components/signature-field/signature-field.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +42 -41
- package/dist/hooks/use-signing-session.d.ts +36 -0
- package/dist/hooks/use-signing-session.d.ts.map +1 -0
- package/dist/i18n/locales/ar.d.ts +8 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +8 -0
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +8 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +8 -0
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +8 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +8 -0
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +8 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +8 -0
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +8 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +8 -0
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +8 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +8 -0
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +8 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +8 -0
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +8 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +8 -0
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +8 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +8 -0
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +8 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +8 -0
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +8 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +8 -0
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +8 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +8 -0
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +8 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +8 -0
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +8 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +8 -0
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +8 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +8 -0
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +8 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +8 -0
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +8 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +8 -0
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +8 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +8 -0
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +701 -697
- package/dist/index.js.map +1 -1
- package/dist/locales/ar.json +8 -0
- package/dist/locales/de.json +8 -0
- package/dist/locales/el.json +8 -0
- package/dist/locales/en.json +8 -0
- package/dist/locales/es.json +8 -0
- package/dist/locales/fr.json +8 -0
- package/dist/locales/hi.json +8 -0
- package/dist/locales/it.json +8 -0
- package/dist/locales/ja.json +8 -0
- package/dist/locales/nl.json +8 -0
- package/dist/locales/pl.json +8 -0
- package/dist/locales/pt.json +8 -0
- package/dist/locales/ro.json +8 -0
- package/dist/locales/ru.json +8 -0
- package/dist/locales/sq.json +8 -0
- package/dist/locales/sv.json +8 -0
- package/dist/locales/tr.json +8 -0
- package/dist/locales/zh.json +8 -0
- package/dist/tokens.css +1 -1
- package/package.json +5 -1
- package/dist/_chunks/public-header.agent-BY6FH71R.js.map +0 -1
- package/dist/_chunks/signature-capture-CpMBhqQ9.js.map +0 -1
- package/dist/_chunks/use-scroll-to-first-error-4Za-u5Nw.js +0 -43
- package/dist/_chunks/use-scroll-to-first-error-4Za-u5Nw.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
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
|
|
6
|
-
import { u as
|
|
7
|
-
const
|
|
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
|
-
},
|
|
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
|
-
),
|
|
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
|
-
),
|
|
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
|
-
),
|
|
80
|
+
), De = R(
|
|
81
81
|
["ds:flex ds:items-stretch ds:flex-wrap ds:gap-[var(--spacing-sm)]"].join(
|
|
82
82
|
" "
|
|
83
83
|
)
|
|
84
|
-
),
|
|
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
|
-
),
|
|
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
|
-
),
|
|
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
|
-
),
|
|
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
|
|
157
|
+
function de(t) {
|
|
158
158
|
return typeof document > "u" ? "" : getComputedStyle(document.documentElement).getPropertyValue(t).trim();
|
|
159
159
|
}
|
|
160
|
-
function
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
192
|
+
return He(new Uint8Array(a));
|
|
193
193
|
}
|
|
194
194
|
return "";
|
|
195
195
|
}
|
|
196
|
-
function
|
|
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
|
|
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:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
[
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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 =
|
|
228
|
+
const f = P(
|
|
228
229
|
(e) => {
|
|
229
|
-
|
|
230
|
+
he.current = e, we(c(`signature.state.${e}`));
|
|
230
231
|
},
|
|
231
232
|
[c]
|
|
232
233
|
);
|
|
233
|
-
|
|
234
|
+
N(() => {
|
|
234
235
|
if (typeof document > "u") return;
|
|
235
236
|
function e() {
|
|
236
|
-
const o = C ??
|
|
237
|
-
|
|
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]),
|
|
248
|
-
const e =
|
|
249
|
-
e && (m && (e.penColor = m),
|
|
250
|
-
}, [m,
|
|
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 =
|
|
253
|
+
const e = j.current;
|
|
253
254
|
if (!e) return;
|
|
254
|
-
const r = new
|
|
255
|
+
const r = new Ne(e, {
|
|
255
256
|
penColor: m || "currentColor",
|
|
256
|
-
backgroundColor:
|
|
257
|
+
backgroundColor: w || "transparent",
|
|
257
258
|
minWidth: 0.5,
|
|
258
259
|
maxWidth: 2.5,
|
|
259
260
|
velocityFilterWeight: 0.7
|
|
260
261
|
});
|
|
261
|
-
|
|
262
|
+
y.current = r;
|
|
262
263
|
const o = () => {
|
|
263
|
-
var
|
|
264
|
-
|
|
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),
|
|
268
|
-
r.removeEventListener("beginStroke", o), r.removeEventListener("endStroke", g), r.clear(), r.off(),
|
|
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]),
|
|
271
|
-
const e =
|
|
272
|
-
e && (
|
|
273
|
-
}, [
|
|
274
|
-
const
|
|
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)),
|
|
280
|
-
if (e.width ===
|
|
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 =
|
|
283
|
-
e.width =
|
|
284
|
-
const
|
|
285
|
-
|
|
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
|
-
[
|
|
288
|
+
[w, m]
|
|
288
289
|
);
|
|
289
|
-
|
|
290
|
-
const e =
|
|
290
|
+
N(() => {
|
|
291
|
+
const e = j.current;
|
|
291
292
|
if (!e) return;
|
|
292
293
|
if (typeof ResizeObserver > "u") {
|
|
293
|
-
|
|
294
|
+
D(e);
|
|
294
295
|
return;
|
|
295
296
|
}
|
|
296
297
|
const r = new ResizeObserver(() => {
|
|
297
|
-
|
|
298
|
+
D(e);
|
|
298
299
|
});
|
|
299
300
|
return r.observe(e), () => r.disconnect();
|
|
300
|
-
}, [
|
|
301
|
-
const
|
|
301
|
+
}, [D]);
|
|
302
|
+
const U = P(() => {
|
|
302
303
|
var r;
|
|
303
|
-
const e =
|
|
304
|
-
e && e.clear(),
|
|
305
|
-
}, [f]),
|
|
306
|
-
const e =
|
|
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 && (
|
|
310
|
-
}, [f]),
|
|
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 =
|
|
313
|
+
const e = y.current;
|
|
313
314
|
return e ? e.isEmpty() : !0;
|
|
314
|
-
}, [l, S]),
|
|
315
|
-
var
|
|
316
|
-
const e =
|
|
315
|
+
}, [l, S]), O = P(async () => {
|
|
316
|
+
var se;
|
|
317
|
+
const e = le(
|
|
317
318
|
typeof a == "number" ? `${a}` : String(a)
|
|
318
|
-
), r =
|
|
319
|
+
), r = le(
|
|
319
320
|
typeof v == "number" ? `${v}` : String(v)
|
|
320
|
-
), o = l === "draw" ?
|
|
321
|
-
let
|
|
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 =
|
|
324
|
+
const u = y.current;
|
|
324
325
|
if (!u || u.isEmpty()) return null;
|
|
325
|
-
|
|
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
|
-
|
|
330
|
+
k = _e(
|
|
330
331
|
u,
|
|
331
|
-
|
|
332
|
-
|
|
332
|
+
x,
|
|
333
|
+
V,
|
|
333
334
|
m || "currentColor",
|
|
334
|
-
|
|
335
|
+
w || "transparent"
|
|
335
336
|
).toDataURL("image/png");
|
|
336
|
-
const
|
|
337
|
-
p = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${
|
|
337
|
+
const X = u.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
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
|
|
340
|
-
let
|
|
341
|
-
if (
|
|
342
|
-
const u =
|
|
343
|
-
|
|
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
|
|
346
|
-
png:
|
|
346
|
+
const W = {
|
|
347
|
+
png: k,
|
|
347
348
|
svg: p,
|
|
348
|
-
widthMm:
|
|
349
|
-
heightMm:
|
|
350
|
-
capturedAt:
|
|
351
|
-
sha256:
|
|
349
|
+
widthMm: F,
|
|
350
|
+
heightMm: Se,
|
|
351
|
+
capturedAt: Re,
|
|
352
|
+
sha256: ne,
|
|
352
353
|
strokes: M
|
|
353
354
|
};
|
|
354
|
-
return f("captured"), (
|
|
355
|
-
}, [
|
|
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:
|
|
358
|
-
undo:
|
|
359
|
-
isEmpty:
|
|
360
|
-
confirm:
|
|
367
|
+
clear: U,
|
|
368
|
+
undo: ee,
|
|
369
|
+
isEmpty: te,
|
|
370
|
+
confirm: O
|
|
361
371
|
}),
|
|
362
|
-
[
|
|
372
|
+
[U, ee, te, O]
|
|
363
373
|
);
|
|
364
|
-
|
|
365
|
-
const
|
|
366
|
-
"--signature-width":
|
|
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":
|
|
380
|
+
"--signature-height": ce(
|
|
371
381
|
v,
|
|
372
382
|
"var(--signature-default-height)"
|
|
373
383
|
)
|
|
374
384
|
};
|
|
375
|
-
return /* @__PURE__ */
|
|
385
|
+
return /* @__PURE__ */ q(
|
|
376
386
|
"div",
|
|
377
387
|
{
|
|
378
|
-
ref:
|
|
388
|
+
ref: L,
|
|
379
389
|
role: "group",
|
|
380
|
-
"aria-label":
|
|
381
|
-
"aria-disabled":
|
|
382
|
-
className: [
|
|
383
|
-
style:
|
|
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
|
-
|
|
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:
|
|
401
|
+
ref: j,
|
|
391
402
|
role: "img",
|
|
392
403
|
"aria-label": c("signature.padLabel"),
|
|
393
|
-
className:
|
|
404
|
+
className: $e(),
|
|
394
405
|
"data-testid": "signature-canvas"
|
|
395
406
|
}
|
|
396
|
-
) }) : /* @__PURE__ */
|
|
397
|
-
/* @__PURE__ */
|
|
398
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
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:
|
|
409
|
-
className:
|
|
419
|
+
disabled: h,
|
|
420
|
+
className: Le(),
|
|
410
421
|
"data-testid": "signature-typed-input"
|
|
411
422
|
}
|
|
412
423
|
),
|
|
413
|
-
S ? /* @__PURE__ */
|
|
424
|
+
S ? /* @__PURE__ */ b(
|
|
414
425
|
"div",
|
|
415
426
|
{
|
|
416
|
-
ref:
|
|
417
|
-
className:
|
|
427
|
+
ref: K,
|
|
428
|
+
className: Ie(),
|
|
418
429
|
"aria-hidden": "true",
|
|
419
430
|
children: S
|
|
420
431
|
}
|
|
421
432
|
) : null
|
|
422
433
|
] }),
|
|
423
|
-
/* @__PURE__ */
|
|
434
|
+
/* @__PURE__ */ b(
|
|
424
435
|
"div",
|
|
425
436
|
{
|
|
426
|
-
id:
|
|
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:
|
|
442
|
+
children: ye
|
|
432
443
|
}
|
|
433
444
|
),
|
|
434
|
-
/* @__PURE__ */
|
|
445
|
+
/* @__PURE__ */ q(
|
|
435
446
|
"div",
|
|
436
447
|
{
|
|
437
|
-
className:
|
|
448
|
+
className: De(),
|
|
438
449
|
role: "group",
|
|
439
450
|
"aria-label": c("signature.padLabel"),
|
|
440
451
|
children: [
|
|
441
|
-
/* @__PURE__ */
|
|
452
|
+
/* @__PURE__ */ b(
|
|
442
453
|
"button",
|
|
443
454
|
{
|
|
444
455
|
type: "button",
|
|
445
456
|
onClick: () => {
|
|
446
|
-
|
|
457
|
+
h || U();
|
|
447
458
|
},
|
|
448
|
-
"aria-disabled":
|
|
449
|
-
className:
|
|
459
|
+
"aria-disabled": h || void 0,
|
|
460
|
+
className: oe(),
|
|
450
461
|
children: c("signature.clear")
|
|
451
462
|
}
|
|
452
463
|
),
|
|
453
|
-
|
|
464
|
+
ue ? /* @__PURE__ */ b(
|
|
454
465
|
"button",
|
|
455
466
|
{
|
|
456
467
|
type: "button",
|
|
457
468
|
onClick: () => {
|
|
458
|
-
|
|
469
|
+
h || (I(""), ve((e) => e === "draw" ? "typed" : "draw"), f("cleared"));
|
|
459
470
|
},
|
|
460
|
-
"aria-disabled":
|
|
461
|
-
className:
|
|
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__ */
|
|
477
|
+
/* @__PURE__ */ b(
|
|
467
478
|
"button",
|
|
468
479
|
{
|
|
469
480
|
type: "button",
|
|
470
481
|
onClick: () => {
|
|
471
|
-
|
|
482
|
+
re || O();
|
|
472
483
|
},
|
|
473
|
-
"aria-disabled":
|
|
474
|
-
"aria-describedby":
|
|
475
|
-
className:
|
|
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
|
-
|
|
499
|
+
We.displayName = "SignatureCapture";
|
|
489
500
|
export {
|
|
490
|
-
|
|
491
|
-
|
|
501
|
+
We as S,
|
|
502
|
+
je as s
|
|
492
503
|
};
|
|
493
|
-
//# sourceMappingURL=signature-capture-
|
|
504
|
+
//# sourceMappingURL=signature-capture-CHbrKoA_.js.map
|