@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.
- package/dist/_chunks/{accordion-bSU21uTV.js → accordion-9lJSMMsZ.js} +6 -6
- package/dist/_chunks/{agenda-tray-By_asPN9.js → agenda-tray-Dyj9ChHC.js} +22 -21
- package/dist/_chunks/{bmi-calculator-BRUru9QX.js → bmi-calculator-DnEr513I.js} +2 -2
- package/dist/_chunks/{booking-DK_BPHnQ.js → booking-4mCw3Mpl.js} +2 -2
- package/dist/_chunks/{chart-DnHvmiDX.js → chart-Cbt0_sKv.js} +46 -37
- package/dist/_chunks/{collapsible-CERONory.js → collapsible-X3oaLPU3.js} +5 -5
- package/dist/_chunks/{document-scanner-CdHQ6lTN.js → document-scanner-CqS_klIr.js} +56 -55
- package/dist/_chunks/{editable-currency-cell-renderer-DGKuRNVG.js → editable-currency-cell-renderer-DgkCIIcO.js} +2 -2
- package/dist/_chunks/{file-upload-CnzRcErt.js → file-upload-BosbPDb1.js} +2 -2
- package/dist/_chunks/{freemium-paywall-D1N02Oam.js → freemium-paywall-BAk3a6er.js} +7 -7
- package/dist/_chunks/header-settings-CBLwUK6t.js +244 -0
- package/dist/_chunks/{map-view-vD5pvWs9.js → map-view-qJLybrmN.js} +2 -2
- package/dist/_chunks/marketplace-app-shell-BlxVizU4.js +296 -0
- package/dist/_chunks/{message-card-BbRhZkDI.js → message-card-DSPw5ghw.js} +20 -19
- package/dist/_chunks/{message-tray-B762TKuv.js → message-tray-hSQff9u4.js} +3 -3
- package/dist/_chunks/{notification-card-DMdO4g54.js → notification-card-CObnGdJu.js} +22 -21
- package/dist/_chunks/{notification-tray-Dl3FTleW.js → notification-tray-BWHDIjgd.js} +2 -2
- package/dist/_chunks/{otp-input-CDTWT5EK.js → otp-input-CMphfBxZ.js} +70 -71
- package/dist/_chunks/{patient-shell-Bz3CdO84.js → patient-shell-DF81lALv.js} +36 -35
- package/dist/_chunks/{payment-form-D5rgnZu7.js → payment-form-Dy3WIIsC.js} +18 -18
- package/dist/_chunks/{pdf-viewer-DvtEHcEP.js → pdf-viewer-Cy6Ul3hZ.js} +2 -2
- package/dist/_chunks/{practice-results-C8ciLQap.js → practice-results-C0d4IL5E.js} +2 -2
- package/dist/_chunks/{public-footer.agent-zw1vFin_.js → public-footer.agent-okt8ZRc5.js} +2 -2
- package/dist/_chunks/{reviews-panel-Dow8Dzoa.js → reviews-panel-CPrXu5TX.js} +2 -2
- package/dist/_chunks/{sidebar-BbR8f6oe.js → sidebar-_vJXI9rB.js} +2 -2
- package/dist/_chunks/sign-document-CpLDZ6Db.js +316 -0
- package/dist/_chunks/{signature-capture-C-fF71xI.js → signature-capture-DoiBd6i3.js} +138 -143
- package/dist/_chunks/{sparkline-DEROcSl0.js → sparkline-DGhCSw8M.js} +55 -46
- package/dist/_chunks/{stepper-accordion-BfS6lUB9.js → stepper-accordion-Dki6r9ZE.js} +2 -2
- package/dist/_chunks/{tag-CyoaEmf_.js → tag-CdA0s_VV.js} +16 -16
- package/dist/_chunks/{task-card-BUVMh6HN.js → task-card-CPyQ5AXC.js} +6 -5
- package/dist/_chunks/{task-tray-DRK0b0Qb.js → task-tray-B8jFv5FV.js} +36 -35
- package/dist/_chunks/{transcript-panel-DyhTpAP7.js → transcript-panel-CR7VY1uw.js} +8 -7
- package/dist/_chunks/{warning-stack-bDicCvxs.js → warning-stack-DNR3-IbP.js} +17 -16
- package/dist/_chunks/{workflow-map-uSiHbOWQ.js → workflow-map-C3gB0FvB.js} +3 -2
- package/dist/agent-catalog.json +39 -1
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/agenda-tray/index.js +1 -1
- package/dist/components/bmi-calculator/index.js +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/chart/chart.d.ts +1 -1
- package/dist/components/chart/index.js +1 -1
- package/dist/components/collapsible/index.js +1 -1
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/document-scanner/index.js +1 -1
- package/dist/components/file-upload/index.js +1 -1
- package/dist/components/freemium-paywall/index.js +1 -1
- package/dist/components/header-settings/header-settings.agent.d.ts +4 -0
- package/dist/components/header-settings/header-settings.d.ts +36 -0
- package/dist/components/header-settings/index.d.ts +2 -0
- package/dist/components/header-settings/index.js +2 -241
- package/dist/components/index.d.ts +1 -0
- package/dist/components/locale-picker/locale-picker.agent.d.ts +4 -0
- package/dist/components/locale-picker/locale-picker.d.ts +80 -0
- package/dist/components/map-view/index.js +1 -1
- package/dist/components/message-card/index.js +1 -1
- package/dist/components/message-tray/index.js +1 -1
- package/dist/components/notification-card/index.js +1 -1
- package/dist/components/notification-tray/index.js +1 -1
- package/dist/components/otp-input/index.d.ts +1 -1
- package/dist/components/otp-input/index.js +1 -1
- package/dist/components/otp-input/otp-input.d.ts +1 -1
- package/dist/components/payment-form/index.js +1 -1
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/public-footer/index.js +1 -1
- package/dist/components/reviews-panel/index.js +1 -1
- package/dist/components/sidebar/index.js +1 -1
- package/dist/components/sign-document/index.d.ts +4 -0
- package/dist/components/sign-document/index.js +6 -0
- package/dist/components/sign-document/sign-document.agent.d.ts +4 -0
- package/dist/components/sign-document/sign-document.d.ts +47 -0
- package/dist/components/signature-capture/index.js +1 -1
- package/dist/components/sparkline/index.js +1 -1
- package/dist/components/sparkline/sparkline.d.ts +1 -1
- package/dist/components/stepper-accordion/index.js +1 -1
- package/dist/components/tag/index.js +1 -1
- package/dist/components/task-card/index.js +1 -1
- package/dist/components/task-tray/index.js +1 -1
- package/dist/components/transcript-panel/index.js +1 -1
- package/dist/components/warning-stack/index.js +1 -1
- package/dist/components/workflow/index.js +1 -1
- package/dist/i18n/locale-meta.d.ts +56 -0
- package/dist/i18n/locales/ar.d.ts +22 -0
- package/dist/i18n/locales/ar.js +22 -0
- package/dist/i18n/locales/de.d.ts +22 -0
- package/dist/i18n/locales/de.js +22 -0
- package/dist/i18n/locales/el.d.ts +22 -0
- package/dist/i18n/locales/el.js +22 -0
- package/dist/i18n/locales/en.d.ts +22 -0
- package/dist/i18n/locales/en.js +22 -0
- package/dist/i18n/locales/es.d.ts +22 -0
- package/dist/i18n/locales/es.js +22 -0
- package/dist/i18n/locales/fr.d.ts +22 -0
- package/dist/i18n/locales/fr.js +22 -0
- package/dist/i18n/locales/hi.d.ts +22 -0
- package/dist/i18n/locales/hi.js +22 -0
- package/dist/i18n/locales/it.d.ts +22 -0
- package/dist/i18n/locales/it.js +22 -0
- package/dist/i18n/locales/ja.d.ts +22 -0
- package/dist/i18n/locales/ja.js +22 -0
- package/dist/i18n/locales/nl.d.ts +22 -0
- package/dist/i18n/locales/nl.js +22 -0
- package/dist/i18n/locales/pl.d.ts +22 -0
- package/dist/i18n/locales/pl.js +22 -0
- package/dist/i18n/locales/pt.d.ts +22 -0
- package/dist/i18n/locales/pt.js +22 -0
- package/dist/i18n/locales/ro.d.ts +22 -0
- package/dist/i18n/locales/ro.js +22 -0
- package/dist/i18n/locales/ru.d.ts +22 -0
- package/dist/i18n/locales/ru.js +22 -0
- package/dist/i18n/locales/sq.d.ts +22 -0
- package/dist/i18n/locales/sq.js +22 -0
- package/dist/i18n/locales/sv.d.ts +22 -0
- package/dist/i18n/locales/sv.js +22 -0
- package/dist/i18n/locales/tr.d.ts +22 -0
- package/dist/i18n/locales/tr.js +22 -0
- package/dist/i18n/locales/zh.d.ts +22 -0
- package/dist/i18n/locales/zh.js +22 -0
- package/dist/index.js +110 -107
- package/dist/locales/ar.json +22 -0
- package/dist/locales/de.json +22 -0
- package/dist/locales/el.json +22 -0
- package/dist/locales/en.json +22 -0
- package/dist/locales/es.json +22 -0
- package/dist/locales/fr.json +22 -0
- package/dist/locales/hi.json +22 -0
- package/dist/locales/it.json +22 -0
- package/dist/locales/ja.json +22 -0
- package/dist/locales/nl.json +22 -0
- package/dist/locales/pl.json +22 -0
- package/dist/locales/pt.json +22 -0
- package/dist/locales/ro.json +22 -0
- package/dist/locales/ru.json +22 -0
- package/dist/locales/sq.json +22 -0
- package/dist/locales/sv.json +22 -0
- package/dist/locales/tr.json +22 -0
- package/dist/locales/zh.json +22 -0
- package/dist/patterns/marketplace-app-shell/index.js +1 -1
- package/dist/patterns/marketplace-app-shell/marketplace-app-shell.d.ts +12 -8
- package/dist/patterns/patient-shell/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +5 -1
- package/dist/_chunks/marketplace-app-shell-BnClrL2B.js +0 -295
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
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-
|
|
80
|
-
|
|
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-
|
|
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-
|
|
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-
|
|
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
|
|
197
|
+
const v = Math.max(
|
|
191
198
|
1,
|
|
192
199
|
typeof window < "u" ? window.devicePixelRatio : 1
|
|
193
|
-
),
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
return
|
|
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 =
|
|
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:
|
|
206
|
-
penColor:
|
|
207
|
-
backgroundColor:
|
|
212
|
+
height: v = 200,
|
|
213
|
+
penColor: C,
|
|
214
|
+
backgroundColor: d,
|
|
208
215
|
allowTypedFallback: ce = !0,
|
|
209
|
-
disabled:
|
|
216
|
+
disabled: b = !1,
|
|
210
217
|
ariaLabel: le,
|
|
211
218
|
className: ue
|
|
212
219
|
}, fe) => {
|
|
213
|
-
const { t:
|
|
214
|
-
() => `sig-${
|
|
215
|
-
[
|
|
216
|
-
)}-live`, F =
|
|
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
|
|
227
|
+
const f = T(
|
|
221
228
|
(e) => {
|
|
222
|
-
ve.current = e, be(
|
|
229
|
+
ve.current = e, be(c(`signature.state.${e}`));
|
|
223
230
|
},
|
|
224
|
-
[
|
|
231
|
+
[c]
|
|
225
232
|
);
|
|
226
233
|
P(() => {
|
|
227
234
|
if (typeof document > "u") return;
|
|
228
235
|
function e() {
|
|
229
|
-
const
|
|
230
|
-
he(
|
|
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
|
-
}, [
|
|
241
|
-
const e =
|
|
242
|
-
e && (
|
|
243
|
-
}, [
|
|
244
|
-
if (
|
|
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:
|
|
249
|
-
backgroundColor:
|
|
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
|
-
|
|
255
|
-
const
|
|
256
|
-
var
|
|
257
|
-
I(!0),
|
|
258
|
-
},
|
|
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",
|
|
261
|
-
r.removeEventListener("beginStroke",
|
|
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
|
-
}, [
|
|
264
|
-
const e =
|
|
265
|
-
e && (
|
|
266
|
-
}, [
|
|
267
|
-
const
|
|
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(),
|
|
276
|
+
const r = e.getBoundingClientRect(), o = Math.max(
|
|
270
277
|
1,
|
|
271
278
|
typeof window < "u" ? window.devicePixelRatio : 1
|
|
272
|
-
),
|
|
273
|
-
if (e.width === A && e.height ===
|
|
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
|
|
276
|
-
e.width = A, e.height =
|
|
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(
|
|
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
|
-
[
|
|
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 =
|
|
297
|
-
e && e.clear(), L(""), I(!1),
|
|
298
|
-
}, [
|
|
299
|
-
const e =
|
|
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),
|
|
303
|
-
}, [
|
|
304
|
-
if (
|
|
305
|
-
const e =
|
|
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
|
-
}, [
|
|
308
|
-
var
|
|
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
|
|
313
|
-
),
|
|
314
|
-
let
|
|
315
|
-
if (
|
|
316
|
-
const u =
|
|
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
|
-
|
|
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
|
-
|
|
329
|
+
x = He(
|
|
323
330
|
u,
|
|
324
|
-
|
|
331
|
+
w,
|
|
325
332
|
A,
|
|
326
|
-
|
|
327
|
-
|
|
333
|
+
m || "currentColor",
|
|
334
|
+
y || "transparent"
|
|
328
335
|
).toDataURL("image/png");
|
|
329
|
-
const
|
|
330
|
-
|
|
336
|
+
const O = u.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
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 =
|
|
333
|
-
let
|
|
334
|
-
if (
|
|
335
|
-
const u =
|
|
336
|
-
|
|
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
|
|
339
|
-
png:
|
|
340
|
-
svg:
|
|
345
|
+
const te = {
|
|
346
|
+
png: x,
|
|
347
|
+
svg: p,
|
|
341
348
|
widthMm: D,
|
|
342
349
|
heightMm: ke,
|
|
343
|
-
capturedAt:
|
|
344
|
-
sha256:
|
|
350
|
+
capturedAt: ze,
|
|
351
|
+
sha256: ee,
|
|
345
352
|
strokes: M
|
|
346
353
|
};
|
|
347
|
-
return
|
|
348
|
-
}, [
|
|
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:
|
|
352
|
-
isEmpty:
|
|
353
|
-
confirm:
|
|
358
|
+
undo: K,
|
|
359
|
+
isEmpty: Q,
|
|
360
|
+
confirm: U
|
|
354
361
|
}),
|
|
355
|
-
[H,
|
|
362
|
+
[H, K, Q, U]
|
|
356
363
|
);
|
|
357
364
|
Re(fe, () => _, [_]), Ne(Pe, _, t);
|
|
358
|
-
const we =
|
|
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
|
-
|
|
371
|
+
v,
|
|
365
372
|
"var(--signature-default-height)"
|
|
366
373
|
)
|
|
367
374
|
};
|
|
368
|
-
return /* @__PURE__ */
|
|
375
|
+
return /* @__PURE__ */ W(
|
|
369
376
|
"div",
|
|
370
377
|
{
|
|
371
378
|
ref: F,
|
|
372
379
|
role: "group",
|
|
373
|
-
"aria-label": le ??
|
|
374
|
-
"aria-disabled":
|
|
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
|
-
|
|
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":
|
|
392
|
+
"aria-label": c("signature.padLabel"),
|
|
386
393
|
className: je(),
|
|
387
394
|
"data-testid": "signature-canvas"
|
|
388
395
|
}
|
|
389
|
-
) }) : /* @__PURE__ */
|
|
390
|
-
/* @__PURE__ */
|
|
391
|
-
/* @__PURE__ */
|
|
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 ?
|
|
404
|
+
L(e.target.value), e.target.value.length > 0 ? f("drawing") : f("empty");
|
|
398
405
|
},
|
|
399
|
-
placeholder:
|
|
400
|
-
"aria-label":
|
|
401
|
-
disabled:
|
|
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__ */
|
|
413
|
+
S ? /* @__PURE__ */ k(
|
|
407
414
|
"div",
|
|
408
415
|
{
|
|
409
|
-
ref:
|
|
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__ */
|
|
423
|
+
/* @__PURE__ */ k(
|
|
417
424
|
"div",
|
|
418
425
|
{
|
|
419
|
-
id:
|
|
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__ */
|
|
434
|
+
/* @__PURE__ */ W(
|
|
428
435
|
"div",
|
|
429
436
|
{
|
|
430
437
|
className: Ee(),
|
|
431
438
|
role: "group",
|
|
432
|
-
"aria-label":
|
|
439
|
+
"aria-label": c("signature.padLabel"),
|
|
433
440
|
children: [
|
|
434
|
-
/* @__PURE__ */
|
|
441
|
+
/* @__PURE__ */ k(
|
|
435
442
|
"button",
|
|
436
443
|
{
|
|
437
444
|
type: "button",
|
|
438
445
|
onClick: () => {
|
|
439
|
-
|
|
446
|
+
b || H();
|
|
440
447
|
},
|
|
441
|
-
"aria-disabled":
|
|
442
|
-
className:
|
|
443
|
-
children:
|
|
448
|
+
"aria-disabled": b || void 0,
|
|
449
|
+
className: ae(),
|
|
450
|
+
children: c("signature.clear")
|
|
444
451
|
}
|
|
445
452
|
),
|
|
446
|
-
|
|
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
|
-
|
|
458
|
+
b || (L(""), ge((e) => e === "draw" ? "typed" : "draw"), f("cleared"));
|
|
464
459
|
},
|
|
465
|
-
"aria-disabled":
|
|
466
|
-
className:
|
|
467
|
-
"aria-pressed":
|
|
468
|
-
children:
|
|
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__ */
|
|
466
|
+
/* @__PURE__ */ k(
|
|
472
467
|
"button",
|
|
473
468
|
{
|
|
474
469
|
type: "button",
|
|
475
470
|
onClick: () => {
|
|
476
|
-
|
|
471
|
+
Y || U();
|
|
477
472
|
},
|
|
478
|
-
"aria-disabled":
|
|
479
|
-
"aria-describedby":
|
|
473
|
+
"aria-disabled": Y || void 0,
|
|
474
|
+
"aria-describedby": q,
|
|
480
475
|
className: Be(),
|
|
481
476
|
"data-testid": "signature-confirm",
|
|
482
|
-
children:
|
|
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-
|
|
493
|
+
//# sourceMappingURL=signature-capture-DoiBd6i3.js.map
|