@alfadocs/ui-kit 0.55.0 → 0.56.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/{pdf-viewer-4odMFuFW.js → pdf-viewer-XxWdtKfD.js} +63 -58
- package/dist/_chunks/{sign-document-BzHTjMVC.js → sign-document-BmAT0kKD.js} +3 -3
- package/dist/_chunks/{signature-capture-CHbrKoA_.js → signature-capture-COi0Uiqu.js} +22 -7
- package/dist/_chunks/use-signing-session-CyOZWinp.js +147 -0
- package/dist/agent-catalog.json +1 -1
- package/dist/components/pdf-viewer/index.js +1 -1
- package/dist/components/sign-document/index.js +1 -1
- package/dist/components/signature-capture/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/use-signing-session.d.ts +8 -0
- package/dist/index.js +4 -4
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/use-signing-session-C5evzYmo.js +0 -108
|
@@ -86,6 +86,11 @@ fe.GlobalWorkerOptions.workerSrc = Ce;
|
|
|
86
86
|
const ke = J(
|
|
87
87
|
[
|
|
88
88
|
"ds:pdf-viewer-alfadocs ds:flex ds:flex-col",
|
|
89
|
+
// Allow the viewer to shrink below its content's intrinsic width when it
|
|
90
|
+
// sits in a constrained flex/grid context (mobile signing flows): without
|
|
91
|
+
// min-inline-size:0 the page canvas's natural width pins the flex item
|
|
92
|
+
// open, fit-width then measures that inflated width and never scales down.
|
|
93
|
+
"ds:min-w-0",
|
|
89
94
|
"ds:gap-[var(--spacing-sm)]",
|
|
90
95
|
"ds:bg-[var(--background)] ds:text-[var(--foreground)]",
|
|
91
96
|
"ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--card-border)] ds:[.theme-accessible_&]:border-2",
|
|
@@ -191,7 +196,7 @@ function Se(o, t, f) {
|
|
|
191
196
|
const y = window.getComputedStyle(f), h = parseFloat(y.paddingInlineStart || "0") + parseFloat(y.paddingInlineEnd || "0"), g = parseFloat(y.paddingBlockStart || "0") + parseFloat(y.paddingBlockEnd || "0"), x = Math.max(f.clientWidth - h, 1), w = Math.max(f.clientHeight - g, 1), k = t.width, z = t.height;
|
|
192
197
|
return o === "fit-width" ? x / k : Math.min(x / k, w / z);
|
|
193
198
|
}
|
|
194
|
-
const
|
|
199
|
+
const st = Ee(
|
|
195
200
|
({
|
|
196
201
|
id: o,
|
|
197
202
|
src: t,
|
|
@@ -216,14 +221,14 @@ const at = Ee(
|
|
|
216
221
|
const e = window.matchMedia("(prefers-reduced-motion: reduce)"), r = () => H(e.matches);
|
|
217
222
|
return r(), e.addEventListener("change", r), () => e.removeEventListener("change", r);
|
|
218
223
|
}, []);
|
|
219
|
-
const [
|
|
224
|
+
const [a, Q] = b(null), [W, c] = b(null), [l, A] = b(f), [S, m] = b(y), [s, M] = b({ start: Math.max(1, f - 1), end: f + 1 }), [_, te] = b(""), [G, L] = b(!1), [O, me] = b(""), [Ie, Re] = b({ current: 0, total: 0 }), re = V(x), ne = V(w), se = V(k);
|
|
220
225
|
C(() => {
|
|
221
|
-
re.current = x, ne.current = w,
|
|
226
|
+
re.current = x, ne.current = w, se.current = k;
|
|
222
227
|
}, [x, w, k]);
|
|
223
228
|
const de = V(null);
|
|
224
229
|
C(() => {
|
|
225
|
-
de.current =
|
|
226
|
-
}, [
|
|
230
|
+
de.current = a;
|
|
231
|
+
}, [a]), C(() => {
|
|
227
232
|
let e = !1;
|
|
228
233
|
Q(null), c(null);
|
|
229
234
|
const r = {
|
|
@@ -257,7 +262,7 @@ const at = Ee(
|
|
|
257
262
|
var Z;
|
|
258
263
|
if (e) return;
|
|
259
264
|
const R = i instanceof Error ? i : new Error(String(i));
|
|
260
|
-
c(R), (Z =
|
|
265
|
+
c(R), (Z = se.current) == null || Z.call(se, R);
|
|
261
266
|
}
|
|
262
267
|
), () => {
|
|
263
268
|
e = !0, u.destroy();
|
|
@@ -272,14 +277,14 @@ const at = Ee(
|
|
|
272
277
|
};
|
|
273
278
|
}, [t]), C(() => {
|
|
274
279
|
var e;
|
|
275
|
-
|
|
276
|
-
d("pdf.pageOf", { current: l, total:
|
|
280
|
+
a && (te(
|
|
281
|
+
d("pdf.pageOf", { current: l, total: a.numPages })
|
|
277
282
|
), (e = re.current) == null || e.call(re, l));
|
|
278
|
-
}, [l,
|
|
279
|
-
const
|
|
283
|
+
}, [l, a, d]);
|
|
284
|
+
const ae = V(null), ce = V([]), j = K(
|
|
280
285
|
(e) => {
|
|
281
|
-
if (!
|
|
282
|
-
const r = Math.max(1, Math.min(e,
|
|
286
|
+
if (!a) return;
|
|
287
|
+
const r = Math.max(1, Math.min(e, a.numPages));
|
|
283
288
|
A(r);
|
|
284
289
|
const u = ce.current[r - 1];
|
|
285
290
|
u && u.scrollIntoView({
|
|
@@ -287,7 +292,7 @@ const at = Ee(
|
|
|
287
292
|
block: "start"
|
|
288
293
|
});
|
|
289
294
|
},
|
|
290
|
-
[
|
|
295
|
+
[a, p]
|
|
291
296
|
), he = K((e) => {
|
|
292
297
|
m(e);
|
|
293
298
|
}, []), Y = K(() => {
|
|
@@ -306,7 +311,7 @@ const at = Ee(
|
|
|
306
311
|
Le(I, () => le, [le]), Ke(Ge, le, o);
|
|
307
312
|
const Te = K(
|
|
308
313
|
(e) => {
|
|
309
|
-
if (!
|
|
314
|
+
if (!a) return;
|
|
310
315
|
const r = e.metaKey || e.ctrlKey;
|
|
311
316
|
if (e.key === "PageDown") {
|
|
312
317
|
e.preventDefault(), j(l + 1);
|
|
@@ -321,7 +326,7 @@ const at = Ee(
|
|
|
321
326
|
return;
|
|
322
327
|
}
|
|
323
328
|
if (e.key === "End") {
|
|
324
|
-
e.preventDefault(), j(
|
|
329
|
+
e.preventDefault(), j(a.numPages);
|
|
325
330
|
return;
|
|
326
331
|
}
|
|
327
332
|
if (r && e.key.toLowerCase() === "f") {
|
|
@@ -344,13 +349,13 @@ const at = Ee(
|
|
|
344
349
|
}
|
|
345
350
|
r && e.key.toLowerCase() === "p" && (e.preventDefault(), Y());
|
|
346
351
|
},
|
|
347
|
-
[l, j, Y,
|
|
352
|
+
[l, j, Y, a]
|
|
348
353
|
), ue = V(l);
|
|
349
354
|
C(() => {
|
|
350
355
|
ue.current = l;
|
|
351
356
|
}, [l]), C(() => {
|
|
352
|
-
if (!
|
|
353
|
-
const e =
|
|
357
|
+
if (!a) return;
|
|
358
|
+
const e = ae.current;
|
|
354
359
|
if (!e) return;
|
|
355
360
|
const r = /* @__PURE__ */ new Map(), u = new IntersectionObserver(
|
|
356
361
|
(i) => {
|
|
@@ -365,7 +370,7 @@ const at = Ee(
|
|
|
365
370
|
$ > Z && (R = F, Z = $), $ > 0 && (q = Math.min(q, F), U = Math.max(U, F));
|
|
366
371
|
Z > 0 && R !== ue.current && A(R), q !== 1 / 0 && M({
|
|
367
372
|
start: Math.max(1, q - 1),
|
|
368
|
-
end: Math.min(
|
|
373
|
+
end: Math.min(a.numPages, U + 1)
|
|
369
374
|
});
|
|
370
375
|
},
|
|
371
376
|
{ root: e, threshold: [0, 0.25, 0.5, 0.75, 1] }
|
|
@@ -373,10 +378,10 @@ const at = Ee(
|
|
|
373
378
|
return ce.current.forEach((i) => {
|
|
374
379
|
i && u.observe(i);
|
|
375
380
|
}), () => u.disconnect();
|
|
376
|
-
}, [
|
|
381
|
+
}, [a]);
|
|
377
382
|
const [Ae, Oe] = b(0);
|
|
378
383
|
C(() => {
|
|
379
|
-
const e =
|
|
384
|
+
const e = ae.current;
|
|
380
385
|
if (!e || typeof ResizeObserver > "u") return;
|
|
381
386
|
const r = new ResizeObserver(() => {
|
|
382
387
|
(S === "fit-width" || S === "fit-page") && Oe((u) => u + 1);
|
|
@@ -427,10 +432,10 @@ const at = Ee(
|
|
|
427
432
|
"data-pdfjs-worker-src": Ce,
|
|
428
433
|
children: [
|
|
429
434
|
z ? /* @__PURE__ */ n(
|
|
430
|
-
|
|
435
|
+
at,
|
|
431
436
|
{
|
|
432
437
|
currentPage: l,
|
|
433
|
-
numPages: (
|
|
438
|
+
numPages: (a == null ? void 0 : a.numPages) ?? 0,
|
|
434
439
|
zoom: S,
|
|
435
440
|
onPrev: () => j(l - 1),
|
|
436
441
|
onNext: () => j(l + 1),
|
|
@@ -466,24 +471,24 @@ const at = Ee(
|
|
|
466
471
|
/* @__PURE__ */ n(
|
|
467
472
|
"div",
|
|
468
473
|
{
|
|
469
|
-
ref:
|
|
474
|
+
ref: ae,
|
|
470
475
|
className: tt(),
|
|
471
476
|
"data-testid": "pdf-pages-container",
|
|
472
477
|
tabIndex: 0,
|
|
473
478
|
"aria-label": d("pdf.pagesRegionLabel"),
|
|
474
|
-
children:
|
|
479
|
+
children: a ? Array.from({ length: a.numPages }, (e, r) => r + 1).map(
|
|
475
480
|
(e) => /* @__PURE__ */ n(
|
|
476
481
|
ot,
|
|
477
482
|
{
|
|
478
483
|
pageNumber: e,
|
|
479
|
-
totalPages:
|
|
480
|
-
doc:
|
|
484
|
+
totalPages: a.numPages,
|
|
485
|
+
doc: a.doc,
|
|
481
486
|
zoom: S,
|
|
482
487
|
pageRotation: h,
|
|
483
488
|
renderPageOverlay: g,
|
|
484
|
-
container:
|
|
489
|
+
container: ae.current,
|
|
485
490
|
resizeTick: Ae,
|
|
486
|
-
shouldRender: e >=
|
|
491
|
+
shouldRender: e >= s.start && e <= s.end,
|
|
487
492
|
registerRef: (r) => {
|
|
488
493
|
ce.current[e - 1] = r;
|
|
489
494
|
},
|
|
@@ -509,8 +514,8 @@ const at = Ee(
|
|
|
509
514
|
);
|
|
510
515
|
}
|
|
511
516
|
);
|
|
512
|
-
|
|
513
|
-
function
|
|
517
|
+
st.displayName = "PDFViewer";
|
|
518
|
+
function at(o) {
|
|
514
519
|
const { t } = pe(), {
|
|
515
520
|
currentPage: f,
|
|
516
521
|
numPages: y,
|
|
@@ -530,7 +535,7 @@ function st(o) {
|
|
|
530
535
|
searchMatches: E,
|
|
531
536
|
register: p,
|
|
532
537
|
focusIndex: H,
|
|
533
|
-
setFocusIndex:
|
|
538
|
+
setFocusIndex: a,
|
|
534
539
|
onToolbarKeyDown: Q
|
|
535
540
|
} = o, [W, c] = b(String(f));
|
|
536
541
|
C(() => {
|
|
@@ -538,30 +543,30 @@ function st(o) {
|
|
|
538
543
|
}, [f]);
|
|
539
544
|
const l = f <= 1, A = f >= y;
|
|
540
545
|
function S() {
|
|
541
|
-
const
|
|
542
|
-
Number.isFinite(
|
|
546
|
+
const s = Number(W);
|
|
547
|
+
Number.isFinite(s) && s >= 1 ? w(Math.min(s, y)) : c(String(f));
|
|
543
548
|
}
|
|
544
|
-
function m(
|
|
549
|
+
function m(s) {
|
|
545
550
|
return /* @__PURE__ */ n(
|
|
546
551
|
"button",
|
|
547
552
|
{
|
|
548
553
|
type: "button",
|
|
549
|
-
ref: p(
|
|
550
|
-
tabIndex:
|
|
551
|
-
onFocus: () => s
|
|
554
|
+
ref: p(s.index),
|
|
555
|
+
tabIndex: s.index === H ? 0 : -1,
|
|
556
|
+
onFocus: () => a(s.index),
|
|
552
557
|
onKeyDown: Q,
|
|
553
|
-
"aria-label":
|
|
554
|
-
"aria-disabled":
|
|
555
|
-
title:
|
|
558
|
+
"aria-label": s.label,
|
|
559
|
+
"aria-disabled": s.disabled || void 0,
|
|
560
|
+
title: s.label,
|
|
556
561
|
onClick: (M) => {
|
|
557
|
-
if (
|
|
562
|
+
if (s.disabled) {
|
|
558
563
|
M.preventDefault();
|
|
559
564
|
return;
|
|
560
565
|
}
|
|
561
|
-
|
|
566
|
+
s.onActivate();
|
|
562
567
|
},
|
|
563
568
|
className: ze(),
|
|
564
|
-
children:
|
|
569
|
+
children: s.icon
|
|
565
570
|
}
|
|
566
571
|
);
|
|
567
572
|
}
|
|
@@ -605,12 +610,12 @@ function st(o) {
|
|
|
605
610
|
min: 1,
|
|
606
611
|
max: Math.max(y, 1),
|
|
607
612
|
value: W,
|
|
608
|
-
onChange: (
|
|
609
|
-
onKeyDown: (
|
|
610
|
-
|
|
613
|
+
onChange: (s) => c(s.target.value),
|
|
614
|
+
onKeyDown: (s) => {
|
|
615
|
+
s.key === "Enter" && (s.preventDefault(), S());
|
|
611
616
|
},
|
|
612
617
|
onBlur: S,
|
|
613
|
-
onFocus: () =>
|
|
618
|
+
onFocus: () => a(2),
|
|
614
619
|
ref: p(2),
|
|
615
620
|
tabIndex: H === 2 ? 0 : -1,
|
|
616
621
|
"aria-label": t("pdf.currentPageInput"),
|
|
@@ -661,8 +666,8 @@ function st(o) {
|
|
|
661
666
|
{
|
|
662
667
|
"aria-label": t("pdf.zoom.preset"),
|
|
663
668
|
value: typeof h == "number" ? String(h) : h,
|
|
664
|
-
onChange: (
|
|
665
|
-
const M =
|
|
669
|
+
onChange: (s) => {
|
|
670
|
+
const M = s.target.value;
|
|
666
671
|
if (M === "fit-width" || M === "fit-page" || M === "actual-size")
|
|
667
672
|
T(M);
|
|
668
673
|
else {
|
|
@@ -672,14 +677,14 @@ function st(o) {
|
|
|
672
677
|
},
|
|
673
678
|
ref: p(5),
|
|
674
679
|
tabIndex: H === 5 ? 0 : -1,
|
|
675
|
-
onFocus: () =>
|
|
680
|
+
onFocus: () => a(5),
|
|
676
681
|
onKeyDown: Q,
|
|
677
682
|
className: et(),
|
|
678
683
|
children: [
|
|
679
684
|
/* @__PURE__ */ n("option", { value: "fit-width", children: t("pdf.zoom.fitWidth") }),
|
|
680
685
|
/* @__PURE__ */ n("option", { value: "fit-page", children: t("pdf.zoom.fitPage") }),
|
|
681
686
|
/* @__PURE__ */ n("option", { value: "actual-size", children: t("pdf.zoom.actualSize") }),
|
|
682
|
-
nt.filter(X).map((
|
|
687
|
+
nt.filter(X).map((s) => /* @__PURE__ */ n("option", { value: String(s), children: `${Math.round(s * 100)}%` }, s))
|
|
683
688
|
]
|
|
684
689
|
}
|
|
685
690
|
),
|
|
@@ -715,7 +720,7 @@ function st(o) {
|
|
|
715
720
|
type: "search",
|
|
716
721
|
autoFocus: !0,
|
|
717
722
|
value: N,
|
|
718
|
-
onChange: (
|
|
723
|
+
onChange: (s) => v(s.target.value),
|
|
719
724
|
placeholder: t("pdf.search.placeholder"),
|
|
720
725
|
"aria-label": t("pdf.search.placeholder"),
|
|
721
726
|
className: Pe({
|
|
@@ -802,7 +807,7 @@ function ot(o) {
|
|
|
802
807
|
height: Math.floor(S.height)
|
|
803
808
|
});
|
|
804
809
|
}, [p, h, w, k, g]);
|
|
805
|
-
const
|
|
810
|
+
const a = g ?? (p == null ? void 0 : p.rotate) ?? 0;
|
|
806
811
|
C(() => {
|
|
807
812
|
if (!p || !z) {
|
|
808
813
|
const O = P.current;
|
|
@@ -813,7 +818,7 @@ function ot(o) {
|
|
|
813
818
|
if (!c) return;
|
|
814
819
|
const A = c.getContext("2d");
|
|
815
820
|
if (!A) return;
|
|
816
|
-
const S = (O) => g === void 0 ? { scale: O } : { scale: O, rotation: g }, m = p.getViewport(S(1)),
|
|
821
|
+
const S = (O) => g === void 0 ? { scale: O } : { scale: O, rotation: g }, m = p.getViewport(S(1)), s = Se(h, m, w), M = p.getViewport(S(s)), _ = Math.max(1, window.devicePixelRatio || 1);
|
|
817
822
|
c.width = Math.floor(M.width * _), c.height = Math.floor(M.height * _), A.setTransform(_, 0, 0, _, 0, 0);
|
|
818
823
|
const te = p.render({
|
|
819
824
|
canvas: c,
|
|
@@ -905,7 +910,7 @@ function ot(o) {
|
|
|
905
910
|
pageNumber: t,
|
|
906
911
|
pageWidthCss: v.width,
|
|
907
912
|
pageHeightCss: v.height,
|
|
908
|
-
rotation:
|
|
913
|
+
rotation: a
|
|
909
914
|
})
|
|
910
915
|
}
|
|
911
916
|
) : null
|
|
@@ -954,7 +959,7 @@ function Ne(o, t, f) {
|
|
|
954
959
|
}), f(T);
|
|
955
960
|
}
|
|
956
961
|
export {
|
|
957
|
-
|
|
962
|
+
st as P,
|
|
958
963
|
Ge as p
|
|
959
964
|
};
|
|
960
|
-
//# sourceMappingURL=pdf-viewer-
|
|
965
|
+
//# sourceMappingURL=pdf-viewer-XxWdtKfD.js.map
|
|
@@ -2,8 +2,8 @@ import { jsxs as c, jsx as n } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef as ce, useId as le, useMemo as G, useRef as L, useState as x, useEffect as _, useCallback as l, useImperativeHandle as ue } from "react";
|
|
3
3
|
import { c as i } from "./index-D2ZczOXr.js";
|
|
4
4
|
import { useTranslation as me } from "react-i18next";
|
|
5
|
-
import { P as ge } from "./pdf-viewer-
|
|
6
|
-
import { S as pe } from "./signature-capture-
|
|
5
|
+
import { P as ge } from "./pdf-viewer-XxWdtKfD.js";
|
|
6
|
+
import { S as pe } from "./signature-capture-COi0Uiqu.js";
|
|
7
7
|
import { u as fe } from "./registry-nPAVE19X.js";
|
|
8
8
|
import { C as J } from "./circle-check-9AeSgJD_.js";
|
|
9
9
|
const ve = {
|
|
@@ -341,4 +341,4 @@ export {
|
|
|
341
341
|
je as S,
|
|
342
342
|
ve as s
|
|
343
343
|
};
|
|
344
|
-
//# sourceMappingURL=sign-document-
|
|
344
|
+
//# sourceMappingURL=sign-document-BmAT0kKD.js.map
|
|
@@ -57,8 +57,12 @@ const je = {
|
|
|
57
57
|
), Ee = R(
|
|
58
58
|
[
|
|
59
59
|
"ds:relative ds:block",
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
// Mobile-first: fill the available width but never exceed the configured
|
|
61
|
+
// pad width. Arbitrary-property form because `inline-size-[…]` /
|
|
62
|
+
// `block-size-[…]` named utilities emit no CSS here (see canvasVariants).
|
|
63
|
+
"ds:[inline-size:100%]",
|
|
64
|
+
"ds:[max-inline-size:var(--signature-width)]",
|
|
65
|
+
"ds:[block-size:var(--signature-height)]",
|
|
62
66
|
"ds:rounded-[var(--radius-sm)]",
|
|
63
67
|
"ds:border ds:border-[color:var(--border)]",
|
|
64
68
|
"ds:bg-[var(--background)]",
|
|
@@ -72,8 +76,16 @@ const je = {
|
|
|
72
76
|
), $e = R(
|
|
73
77
|
[
|
|
74
78
|
"ds:block",
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
// Arbitrary-property form, NOT `inline-size-full` / `block-size-full`:
|
|
80
|
+
// the `inline-size-*` / `block-size-*` named utilities generate no CSS in
|
|
81
|
+
// this Tailwind setup, so on a block <div> they silently fall back to auto
|
|
82
|
+
// (harmless) but on a replaced <canvas> the element then sizes to its
|
|
83
|
+
// backing-store `width`/`height` attribute — which scaleCanvas drives up to
|
|
84
|
+
// MAX_CANVAS_PX (4096) in a feedback loop, overflowing the pad on mobile.
|
|
85
|
+
// The `[property:value]` escape hatch always emits, pinning the canvas to
|
|
86
|
+
// the frame so the loop can't run away.
|
|
87
|
+
"ds:[inline-size:100%]",
|
|
88
|
+
"ds:[block-size:100%]",
|
|
77
89
|
"ds:touch-none",
|
|
78
90
|
"ds:select-none"
|
|
79
91
|
].join(" ")
|
|
@@ -141,8 +153,11 @@ const je = {
|
|
|
141
153
|
), Ie = R(
|
|
142
154
|
[
|
|
143
155
|
"ds:flex ds:items-center ds:justify-center",
|
|
144
|
-
|
|
145
|
-
|
|
156
|
+
// Match the pad frame: responsive width capped at the configured size.
|
|
157
|
+
// Arbitrary-property form (the named `*-size-[…]` utilities are no-ops here).
|
|
158
|
+
"ds:[inline-size:100%]",
|
|
159
|
+
"ds:[max-inline-size:var(--signature-width)]",
|
|
160
|
+
"ds:[block-size:var(--signature-height)]",
|
|
146
161
|
"ds:rounded-[var(--radius-sm)]",
|
|
147
162
|
"ds:border ds:border-[color:var(--card-border)]",
|
|
148
163
|
"ds:[.theme-accessible_&]:border-2",
|
|
@@ -501,4 +516,4 @@ export {
|
|
|
501
516
|
We as S,
|
|
502
517
|
je as s
|
|
503
518
|
};
|
|
504
|
-
//# sourceMappingURL=signature-capture-
|
|
519
|
+
//# sourceMappingURL=signature-capture-COi0Uiqu.js.map
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { useRef as E, useEffect as B, useState as h, useMemo as I, useCallback as g } from "react";
|
|
2
|
+
function R(o) {
|
|
3
|
+
return o != null && o.current ? o.current : typeof document > "u" ? null : document;
|
|
4
|
+
}
|
|
5
|
+
function T(o, s) {
|
|
6
|
+
const r = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(o) : (
|
|
7
|
+
// SSR / jsdom fallback — drop every character that's
|
|
8
|
+
// significant in a CSS attribute selector. Conservative but
|
|
9
|
+
// robust enough for the test environment.
|
|
10
|
+
o.replace(/["'\\[\]]/g, "")
|
|
11
|
+
), c = `[data-error-anchor="${r}"], [name="${r}"], [name$="[${r}]"]`, l = Array.from(s.querySelectorAll(c));
|
|
12
|
+
return l.length === 0 ? null : l.find((f) => f.offsetParent !== null) ?? l[0];
|
|
13
|
+
}
|
|
14
|
+
function q(o, s, r = {}) {
|
|
15
|
+
const {
|
|
16
|
+
scope: c,
|
|
17
|
+
scrollOptions: l = { behavior: "smooth", block: "center" },
|
|
18
|
+
focus: p = !0,
|
|
19
|
+
skipInitialMount: f = !0
|
|
20
|
+
} = r, t = E(!1), a = E(null), i = s.find((m) => !!o[m]) ?? null;
|
|
21
|
+
B(() => {
|
|
22
|
+
if (f && !t.current) {
|
|
23
|
+
t.current = !0, a.current = i;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!i) {
|
|
27
|
+
a.current = null;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (i === a.current || typeof window > "u") return;
|
|
31
|
+
const m = window.requestAnimationFrame(() => {
|
|
32
|
+
const F = R(c);
|
|
33
|
+
if (!F) return;
|
|
34
|
+
const S = T(i, F);
|
|
35
|
+
S && (S.scrollIntoView(l), p && S.focus({ preventScroll: !0 }), a.current = i);
|
|
36
|
+
});
|
|
37
|
+
return () => window.cancelAnimationFrame(m);
|
|
38
|
+
}, [i]);
|
|
39
|
+
}
|
|
40
|
+
function k(o, s = !1) {
|
|
41
|
+
const r = {};
|
|
42
|
+
for (const c of o)
|
|
43
|
+
r[c.id] = { signed: s ? !1 : !!c.signed };
|
|
44
|
+
return r;
|
|
45
|
+
}
|
|
46
|
+
function M(o) {
|
|
47
|
+
const [s, r] = h(
|
|
48
|
+
() => k(o)
|
|
49
|
+
), [c, l] = h(null), [p, f] = h(
|
|
50
|
+
() => {
|
|
51
|
+
var n;
|
|
52
|
+
return ((n = o[0]) == null ? void 0 : n.id) ?? null;
|
|
53
|
+
}
|
|
54
|
+
), t = I(
|
|
55
|
+
() => o.map((n) => {
|
|
56
|
+
const e = s[n.id];
|
|
57
|
+
return {
|
|
58
|
+
...n,
|
|
59
|
+
signed: e ? e.signed : !!n.signed,
|
|
60
|
+
payload: e == null ? void 0 : e.payload
|
|
61
|
+
};
|
|
62
|
+
}),
|
|
63
|
+
[o, s]
|
|
64
|
+
), a = I(
|
|
65
|
+
() => t.reduce((n, e) => e.signed ? n + 1 : n, 0),
|
|
66
|
+
[t]
|
|
67
|
+
), i = t.length, m = i > 0 && a === i, F = g((n) => {
|
|
68
|
+
l(n);
|
|
69
|
+
}, []), S = g(() => {
|
|
70
|
+
l(null);
|
|
71
|
+
}, []), v = g((n, e) => {
|
|
72
|
+
r((u) => ({ ...u, [n]: { signed: !0, payload: e } })), l((u) => u === n ? null : u);
|
|
73
|
+
}, []), w = g(
|
|
74
|
+
(n) => {
|
|
75
|
+
var e;
|
|
76
|
+
return !!((e = s[n]) != null && e.signed);
|
|
77
|
+
},
|
|
78
|
+
[s]
|
|
79
|
+
), y = g(() => {
|
|
80
|
+
var n;
|
|
81
|
+
r(k(o, !0)), l(null), f(((n = o[0]) == null ? void 0 : n.id) ?? null);
|
|
82
|
+
}, [o]), C = g(() => {
|
|
83
|
+
f((n) => {
|
|
84
|
+
const e = t.length;
|
|
85
|
+
if (e === 0) return null;
|
|
86
|
+
const u = n ? t.findIndex((d) => d.id === n) : -1;
|
|
87
|
+
return t[(u + 1 + e) % e].id;
|
|
88
|
+
});
|
|
89
|
+
}, [t]), x = g(() => {
|
|
90
|
+
f((n) => {
|
|
91
|
+
const e = t.length;
|
|
92
|
+
if (e === 0) return null;
|
|
93
|
+
const u = n ? t.findIndex((d) => d.id === n) : 0;
|
|
94
|
+
return t[(u - 1 + e) % e].id;
|
|
95
|
+
});
|
|
96
|
+
}, [t]), b = g(() => {
|
|
97
|
+
f((n) => {
|
|
98
|
+
const e = t.length;
|
|
99
|
+
if (e === 0) return n;
|
|
100
|
+
const u = n ? t.findIndex((d) => d.id === n) : -1;
|
|
101
|
+
for (let d = 1; d <= e; d += 1) {
|
|
102
|
+
const A = t[(u + d) % e];
|
|
103
|
+
if (!A.signed) return A.id;
|
|
104
|
+
}
|
|
105
|
+
return n;
|
|
106
|
+
});
|
|
107
|
+
}, [t]);
|
|
108
|
+
return I(
|
|
109
|
+
() => ({
|
|
110
|
+
fields: t,
|
|
111
|
+
signedCount: a,
|
|
112
|
+
total: i,
|
|
113
|
+
isComplete: m,
|
|
114
|
+
activeFieldId: c,
|
|
115
|
+
openField: F,
|
|
116
|
+
closeField: S,
|
|
117
|
+
markSigned: v,
|
|
118
|
+
isFieldSigned: w,
|
|
119
|
+
reset: y,
|
|
120
|
+
cursorFieldId: p,
|
|
121
|
+
goToNextField: C,
|
|
122
|
+
goToPreviousField: x,
|
|
123
|
+
goToNextUnsigned: b
|
|
124
|
+
}),
|
|
125
|
+
[
|
|
126
|
+
t,
|
|
127
|
+
a,
|
|
128
|
+
i,
|
|
129
|
+
m,
|
|
130
|
+
c,
|
|
131
|
+
F,
|
|
132
|
+
S,
|
|
133
|
+
v,
|
|
134
|
+
w,
|
|
135
|
+
y,
|
|
136
|
+
p,
|
|
137
|
+
C,
|
|
138
|
+
x,
|
|
139
|
+
b
|
|
140
|
+
]
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
export {
|
|
144
|
+
M as a,
|
|
145
|
+
q as u
|
|
146
|
+
};
|
|
147
|
+
//# sourceMappingURL=use-signing-session-CyOZWinp.js.map
|
package/dist/agent-catalog.json
CHANGED
package/dist/hooks/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { u as v } from "../_chunks/use-prefers-reduced-motion-BMwIQRjB.js";
|
|
2
2
|
import { u as D } from "../_chunks/use-media-query-CcAx5SMM.js";
|
|
3
|
-
import { u as g, a as _ } from "../_chunks/use-signing-session-
|
|
3
|
+
import { u as g, a as _ } from "../_chunks/use-signing-session-CyOZWinp.js";
|
|
4
4
|
import { u as O } from "../_chunks/use-count-up-BLLetaZ8.js";
|
|
5
5
|
import { u as k } from "../_chunks/use-locale-BkCIHujH.js";
|
|
6
6
|
import { A as K, T as H, a as M, r as Y, t as q, u as B } from "../_chunks/use-theme-CAuo6EYT.js";
|
|
@@ -31,6 +31,14 @@ export interface UseSigningSessionReturn<TField extends SigningFieldBase, TPaylo
|
|
|
31
31
|
isFieldSigned: (id: string) => boolean;
|
|
32
32
|
/** Clear all signatures and close any open field. */
|
|
33
33
|
reset: () => void;
|
|
34
|
+
/** The field currently targeted by next/previous navigation, or `null`. */
|
|
35
|
+
cursorFieldId: string | null;
|
|
36
|
+
/** Move the navigation cursor to the next field (input order, cycling). */
|
|
37
|
+
goToNextField: () => void;
|
|
38
|
+
/** Move the navigation cursor to the previous field (cycling). */
|
|
39
|
+
goToPreviousField: () => void;
|
|
40
|
+
/** Move the cursor to the next still-unsigned field (cycling); no-op if all signed. */
|
|
41
|
+
goToNextUnsigned: () => void;
|
|
34
42
|
}
|
|
35
43
|
export declare function useSigningSession<TField extends SigningFieldBase, TPayload = unknown>(fields: TField[]): UseSigningSessionReturn<TField, TPayload>;
|
|
36
44
|
//# sourceMappingURL=use-signing-session.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { u as r } from "./_chunks/use-prefers-reduced-motion-BMwIQRjB.js";
|
|
2
2
|
import { u as t } from "./_chunks/use-media-query-CcAx5SMM.js";
|
|
3
|
-
import { u as n, a as i } from "./_chunks/use-signing-session-
|
|
3
|
+
import { u as n, a as i } from "./_chunks/use-signing-session-CyOZWinp.js";
|
|
4
4
|
import { u as m } from "./_chunks/use-locale-BkCIHujH.js";
|
|
5
5
|
import { A as d, T as c, a as f, r as g, t as A, u as x } from "./_chunks/use-theme-CAuo6EYT.js";
|
|
6
6
|
import { u } from "./_chunks/use-persistent-state-i23OWy6G.js";
|
|
@@ -160,12 +160,12 @@ import { C as Mm, a as km, b as Hm, c as wm } from "./_chunks/contact-profile-ca
|
|
|
160
160
|
import { P as Vm, p as Gm } from "./_chunks/practice-results-CtfciF2v.js";
|
|
161
161
|
import { P as Um, a as Km, p as Ym, b as qm } from "./_chunks/payment-request-card-B_lyobd0.js";
|
|
162
162
|
import { P as jm, f as zm, p as Xm, a as Jm, s as Zm, b as $m, c as al } from "./_chunks/payment-form-DJ9vnzrT.js";
|
|
163
|
-
import { P as rl, p as ol } from "./_chunks/pdf-viewer-
|
|
163
|
+
import { P as rl, p as ol } from "./_chunks/pdf-viewer-XxWdtKfD.js";
|
|
164
164
|
import { R as sl, r as nl } from "./_chunks/reviews-panel-CPrXu5TX.js";
|
|
165
165
|
import { R as pl, e as ml, r as ll, t as dl, a as cl, w as fl } from "./_chunks/rich-text-editor-DhGIBd4a.js";
|
|
166
|
-
import { S as Al, s as xl } from "./_chunks/signature-capture-
|
|
166
|
+
import { S as Al, s as xl } from "./_chunks/signature-capture-COi0Uiqu.js";
|
|
167
167
|
import { S as ul, s as Sl } from "./_chunks/signature-field-DhscKdgk.js";
|
|
168
|
-
import { S as bl, s as Pl } from "./_chunks/sign-document-
|
|
168
|
+
import { S as bl, s as Pl } from "./_chunks/sign-document-BmAT0kKD.js";
|
|
169
169
|
import { S as Rl, f as El, i as hl } from "./_chunks/slot-grid-BlHHP9Qy.js";
|
|
170
170
|
import { C as Nl, a as _l, b as Ll, F as Dl, c as yl, d as Ol, P as Bl, e as Ml, T as kl, f as Hl, g as wl, h as vl, l as Vl, i as Gl, t as Wl, r as Ul } from "./_chunks/tooth-scheme-CxlsLjfN.js";
|
|
171
171
|
import { T as Yl } from "./_chunks/transaction-chip-BZCa6XDn.js";
|