@superdoc-dev/esign 1.3.0 → 1.3.1

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/index.mjs CHANGED
@@ -14,19 +14,19 @@ function ve() {
14
14
  if (ie) return W;
15
15
  ie = 1;
16
16
  var g = Symbol.for("react.transitional.element"), v = Symbol.for("react.fragment");
17
- function m(a, n, f) {
17
+ function m(a, n, d) {
18
18
  var x = null;
19
- if (f !== void 0 && (x = "" + f), n.key !== void 0 && (x = "" + n.key), "key" in n) {
20
- f = {};
19
+ if (d !== void 0 && (x = "" + d), n.key !== void 0 && (x = "" + n.key), "key" in n) {
20
+ d = {};
21
21
  for (var S in n)
22
- S !== "key" && (f[S] = n[S]);
23
- } else f = n;
24
- return n = f.ref, {
22
+ S !== "key" && (d[S] = n[S]);
23
+ } else d = n;
24
+ return n = d.ref, {
25
25
  $$typeof: g,
26
26
  type: a,
27
27
  key: x,
28
28
  ref: n !== void 0 ? n : null,
29
- props: f
29
+ props: d
30
30
  };
31
31
  }
32
32
  return W.Fragment = v, W.jsx = m, W.jsxs = m, W;
@@ -99,11 +99,11 @@ function be() {
99
99
  }
100
100
  if (r) {
101
101
  r = console;
102
- var c = r.error, u = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
102
+ var c = r.error, l = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
103
103
  return c.call(
104
104
  r,
105
105
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
106
- u
106
+ l
107
107
  ), v(e);
108
108
  }
109
109
  }
@@ -122,7 +122,7 @@ function be() {
122
122
  var e = w.A;
123
123
  return e === null ? null : e.getOwner();
124
124
  }
125
- function f() {
125
+ function d() {
126
126
  return Error("react-stack-top-frame");
127
127
  }
128
128
  function x(e) {
@@ -150,15 +150,15 @@ function be() {
150
150
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
151
151
  )), e = this.props.ref, e !== void 0 ? e : null;
152
152
  }
153
- function B(e, r, c, u, D, q) {
154
- var d = c.ref;
153
+ function B(e, r, c, l, D, q) {
154
+ var u = c.ref;
155
155
  return e = {
156
156
  $$typeof: J,
157
157
  type: e,
158
158
  key: r,
159
159
  props: c,
160
- _owner: u
161
- }, (d !== void 0 ? d : null) !== null ? Object.defineProperty(e, "ref", {
160
+ _owner: l
161
+ }, (u !== void 0 ? u : null) !== null ? Object.defineProperty(e, "ref", {
162
162
  enumerable: !1,
163
163
  get: z
164
164
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
@@ -183,48 +183,48 @@ function be() {
183
183
  value: q
184
184
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
185
185
  }
186
- function Y(e, r, c, u, D, q) {
187
- var d = r.children;
188
- if (d !== void 0)
189
- if (u)
190
- if (ae(d)) {
191
- for (u = 0; u < d.length; u++)
192
- $(d[u]);
193
- Object.freeze && Object.freeze(d);
186
+ function Y(e, r, c, l, D, q) {
187
+ var u = r.children;
188
+ if (u !== void 0)
189
+ if (l)
190
+ if (ae(u)) {
191
+ for (l = 0; l < u.length; l++)
192
+ $(u[l]);
193
+ Object.freeze && Object.freeze(u);
194
194
  } else
195
195
  console.error(
196
196
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
197
197
  );
198
- else $(d);
198
+ else $(u);
199
199
  if (y.call(r, "key")) {
200
- d = g(e);
200
+ u = g(e);
201
201
  var C = Object.keys(r).filter(function(se) {
202
202
  return se !== "key";
203
203
  });
204
- u = 0 < C.length ? "{key: someKey, " + C.join(": ..., ") + ": ...}" : "{key: someKey}", j[d + u] || (C = 0 < C.length ? "{" + C.join(": ..., ") + ": ...}" : "{}", console.error(
204
+ l = 0 < C.length ? "{key: someKey, " + C.join(": ..., ") + ": ...}" : "{key: someKey}", j[u + l] || (C = 0 < C.length ? "{" + C.join(": ..., ") + ": ...}" : "{}", console.error(
205
205
  `A props object containing a "key" prop is being spread into JSX:
206
206
  let props = %s;
207
207
  <%s {...props} />
208
208
  React keys must be passed directly to JSX without using spread:
209
209
  let props = %s;
210
210
  <%s key={someKey} {...props} />`,
211
+ l,
211
212
  u,
212
- d,
213
213
  C,
214
- d
215
- ), j[d + u] = !0);
214
+ u
215
+ ), j[u + l] = !0);
216
216
  }
217
- if (d = null, c !== void 0 && (m(c), d = "" + c), x(r) && (m(r.key), d = "" + r.key), "key" in r) {
217
+ if (u = null, c !== void 0 && (m(c), u = "" + c), x(r) && (m(r.key), u = "" + r.key), "key" in r) {
218
218
  c = {};
219
219
  for (var F in r)
220
220
  F !== "key" && (c[F] = r[F]);
221
221
  } else c = r;
222
- return d && S(
222
+ return u && S(
223
223
  c,
224
224
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
225
225
  ), B(
226
226
  e,
227
- d,
227
+ u,
228
228
  c,
229
229
  n(),
230
230
  D,
@@ -247,27 +247,27 @@ React keys must be passed directly to JSX without using spread:
247
247
  };
248
248
  var k, N = {}, ee = O.react_stack_bottom_frame.bind(
249
249
  O,
250
- f
251
- )(), U = E(a(f)), j = {};
250
+ d
251
+ )(), U = E(a(d)), j = {};
252
252
  V.Fragment = _, V.jsx = function(e, r, c) {
253
- var u = 1e4 > w.recentlyCreatedOwnerStacks++;
253
+ var l = 1e4 > w.recentlyCreatedOwnerStacks++;
254
254
  return Y(
255
255
  e,
256
256
  r,
257
257
  c,
258
258
  !1,
259
- u ? Error("react-stack-top-frame") : ee,
260
- u ? E(a(e)) : U
259
+ l ? Error("react-stack-top-frame") : ee,
260
+ l ? E(a(e)) : U
261
261
  );
262
262
  }, V.jsxs = function(e, r, c) {
263
- var u = 1e4 > w.recentlyCreatedOwnerStacks++;
263
+ var l = 1e4 > w.recentlyCreatedOwnerStacks++;
264
264
  return Y(
265
265
  e,
266
266
  r,
267
267
  c,
268
268
  !0,
269
- u ? Error("react-stack-top-frame") : ee,
270
- u ? E(a(e)) : U
269
+ l ? Error("react-stack-top-frame") : ee,
270
+ l ? E(a(e)) : U
271
271
  );
272
272
  };
273
273
  })()), V;
@@ -333,7 +333,7 @@ const he = ({
333
333
  fileName: a,
334
334
  isDisabled: n
335
335
  }) => {
336
- const f = g?.label || "Download";
336
+ const d = g?.label || "Download";
337
337
  return /* @__PURE__ */ p.jsxs(
338
338
  "button",
339
339
  {
@@ -352,7 +352,7 @@ const he = ({
352
352
  fontWeight: "bold"
353
353
  },
354
354
  children: [
355
- f,
355
+ d,
356
356
  " ",
357
357
  a && `(${a})`
358
358
  ]
@@ -362,14 +362,14 @@ const he = ({
362
362
  onClick: m,
363
363
  isValid: a,
364
364
  isDisabled: n,
365
- isSubmitting: f
365
+ isSubmitting: d
366
366
  }) => {
367
367
  const x = () => g?.label || "Submit";
368
368
  return /* @__PURE__ */ p.jsx(
369
369
  "button",
370
370
  {
371
371
  onClick: m,
372
- disabled: !a || n || f,
372
+ disabled: !a || n || d,
373
373
  className: "superdoc-esign-btn superdoc-esign-btn--submit",
374
374
  style: {
375
375
  padding: "12px 24px",
@@ -385,331 +385,329 @@ const he = ({
385
385
  children: x()
386
386
  }
387
387
  );
388
- }, Re = me(
389
- (g, v) => {
390
- const {
388
+ }, Re = me((g, v) => {
389
+ const {
390
+ eventId: m,
391
+ document: a,
392
+ fields: n = {},
393
+ download: d,
394
+ submit: x,
395
+ onSubmit: S,
396
+ onDownload: z,
397
+ onStateChange: B,
398
+ onFieldChange: Y,
399
+ onFieldsDiscovered: $,
400
+ isDisabled: h = !1,
401
+ className: O,
402
+ style: J,
403
+ documentHeight: ne = "600px"
404
+ } = g, [_, H] = I(
405
+ !a.validation?.scroll?.required
406
+ ), [b, G] = I(
407
+ /* @__PURE__ */ new Map()
408
+ ), [A, X] = I(!1), [T, Z] = I(!1), [Q, P] = I([]), [K, oe] = I(!1), w = L(null), y = L(null), ae = L(Date.now()), E = L(n), k = L([]);
409
+ E.current = n, te(() => {
410
+ k.current = Q;
411
+ }, [Q]);
412
+ const N = M((t) => {
413
+ if (!y.current?.activeEditor) return;
414
+ const o = y.current.activeEditor, s = E.current.signer?.find(
415
+ (i) => i.id === t.id
416
+ );
417
+ let f;
418
+ s?.type === "signature" && t.value ? f = {
419
+ json: {
420
+ type: "image",
421
+ attrs: { src: typeof t.value == "string" && t.value.startsWith("data:image/") ? t.value : ee(String(t.value)), alt: "Signature" }
422
+ }
423
+ } : f = { text: String(t.value ?? "") }, t.id && o.commands.updateStructuredContentById(t.id, f);
424
+ }, []);
425
+ function ee(t) {
426
+ const o = globalThis.document.createElement("canvas"), s = o.getContext("2d"), f = 30;
427
+ s.font = `italic ${f}px cursive`;
428
+ const R = s.measureText(t).width, ue = f * 1.3, de = 4, fe = 6;
429
+ return o.width = Math.ceil(R + de * 2) + 20, o.height = Math.ceil(ue + fe * 2), s.font = `italic ${f}px cursive`, s.fillStyle = "black", s.textAlign = "center", s.textBaseline = "middle", s.fillText(t, o.width / 2, o.height / 2), o.toDataURL("image/png");
430
+ }
431
+ const U = M(
432
+ (t) => {
433
+ if (!t) return;
434
+ const o = t.helpers.structuredContentCommands.getStructuredContentTags(
435
+ t.state
436
+ ), s = /* @__PURE__ */ new Map();
437
+ E.current.document?.forEach((i) => {
438
+ i.id && s.set(i.id, i.value);
439
+ }), E.current.signer?.forEach((i) => {
440
+ i.value !== void 0 && s.set(i.id, i.value);
441
+ });
442
+ const f = o.map(({ node: i }) => ({
443
+ id: i.attrs.id,
444
+ label: i.attrs.label,
445
+ value: s.get(i.attrs.id) ?? i.textContent ?? ""
446
+ })).filter((i) => i.id);
447
+ f.length > 0 && ($?.(f), [
448
+ ...E.current.document || [],
449
+ ...E.current.signer || []
450
+ ].filter((R) => R.value !== void 0).forEach(
451
+ (R) => N({
452
+ id: R.id,
453
+ value: R.value
454
+ })
455
+ ));
456
+ },
457
+ [$, N]
458
+ ), j = (t) => {
459
+ const o = {
460
+ ...t,
461
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
462
+ }, s = globalThis?.__SUPERDOC_AUDIT_MOCK__;
463
+ s && s(o);
464
+ const f = [...k.current, o];
465
+ return k.current = f, P(f), f;
466
+ };
467
+ te(() => w.current ? ((async () => {
468
+ const { SuperDoc: o } = await import("superdoc"), s = new o({
469
+ selector: w.current,
470
+ document: a.source,
471
+ documentMode: "viewing",
472
+ onReady: () => {
473
+ s.activeEditor && U(s.activeEditor), j({ type: "ready" }), oe(!0);
474
+ }
475
+ });
476
+ y.current = s;
477
+ })(), () => {
478
+ y.current && (typeof y.current.destroy == "function" && y.current.destroy(), y.current = null);
479
+ }) : void 0, [a.source, a.mode, U]), te(() => {
480
+ if (!a.validation?.scroll?.required || !K) return;
481
+ const t = w.current;
482
+ if (!t) return;
483
+ const o = () => {
484
+ const { scrollTop: s, scrollHeight: f, clientHeight: i } = t, R = s / (f - i);
485
+ (R >= 0.95 || f <= i) && (H(!0), j({
486
+ type: "scroll",
487
+ data: { percent: Math.round(R * 100) }
488
+ }));
489
+ };
490
+ return t.addEventListener("scroll", o), o(), () => t.removeEventListener("scroll", o);
491
+ }, [a.validation?.scroll?.required, K]);
492
+ const e = M(
493
+ (t, o) => {
494
+ G((s) => {
495
+ const f = s.get(t), i = new Map(s);
496
+ return i.set(t, o), N({
497
+ id: t,
498
+ value: o
499
+ }), j({
500
+ type: "field_change",
501
+ data: { fieldId: t, value: o, previousValue: f }
502
+ }), Y?.({
503
+ id: t,
504
+ value: o,
505
+ previousValue: f
506
+ }), i;
507
+ });
508
+ },
509
+ [Y, N]
510
+ ), r = M(() => a.validation?.scroll?.required && !_ ? !1 : (n.signer || []).every((t) => {
511
+ if (!t.validation?.required) return !0;
512
+ const o = b.get(t.id);
513
+ return o && (typeof o != "string" || o.trim());
514
+ }), [
515
+ _,
516
+ n.signer,
517
+ b,
518
+ a.validation?.scroll?.required
519
+ ]);
520
+ te(() => {
521
+ const t = r();
522
+ X(t), B?.({
523
+ scrolled: _,
524
+ fields: b,
525
+ isValid: t,
526
+ isSubmitting: T
527
+ });
528
+ }, [_, b, T, r, B]);
529
+ const c = M(async () => {
530
+ if (h) return;
531
+ const t = {
391
532
  eventId: m,
392
- document: a,
393
- fields: n = {},
394
- download: f,
395
- submit: x,
396
- onSubmit: S,
397
- onDownload: z,
398
- onStateChange: B,
399
- onFieldChange: Y,
400
- onFieldsDiscovered: $,
401
- isDisabled: h = !1,
402
- className: O,
403
- style: J,
404
- documentHeight: ne = "600px"
405
- } = g, [_, H] = I(
406
- !a.validation?.scroll?.required
407
- ), [b, G] = I(
408
- /* @__PURE__ */ new Map()
409
- ), [A, X] = I(!1), [T, Z] = I(!1), [Q, P] = I([]), [K, oe] = I(!1), w = L(null), y = L(null), ae = L(Date.now()), E = L(n), k = L([]);
410
- E.current = n, te(() => {
411
- k.current = Q;
412
- }, [Q]);
413
- const N = M((t) => {
414
- if (!y.current?.activeEditor) return;
415
- const o = y.current.activeEditor, s = E.current.signer?.find(
416
- (i) => i.id === t.id
417
- );
418
- let l;
419
- s?.type === "signature" && t.value ? l = {
420
- json: {
421
- type: "image",
422
- attrs: { src: typeof t.value == "string" && t.value.startsWith("data:image/") ? t.value : ee(String(t.value)), alt: "Signature" }
423
- }
424
- } : l = { text: String(t.value ?? "") }, t.id && o.commands.updateStructuredContentById(t.id, l);
425
- }, []);
426
- function ee(t) {
427
- const o = globalThis.document.createElement("canvas"), s = o.getContext("2d"), l = 30;
428
- s.font = `italic ${l}px cursive`;
429
- const R = s.measureText(t).width, ue = l * 1.3, de = 4, fe = 6;
430
- return o.width = Math.ceil(R + de * 2) + 20, o.height = Math.ceil(ue + fe * 2), s.font = `italic ${l}px cursive`, s.fillStyle = "black", s.textAlign = "center", s.textBaseline = "middle", s.fillText(t, o.width / 2, o.height / 2), o.toDataURL("image/png");
431
- }
432
- const U = M(
433
- (t) => {
434
- if (!t) return;
435
- const o = t.helpers.structuredContentCommands.getStructuredContentTags(
436
- t.state
437
- ), s = /* @__PURE__ */ new Map();
438
- E.current.document?.forEach((i) => {
439
- i.id && s.set(i.id, i.value);
440
- }), E.current.signer?.forEach((i) => {
441
- i.value !== void 0 && s.set(i.id, i.value);
442
- });
443
- const l = o.map(({ node: i }) => ({
444
- id: i.attrs.id,
445
- label: i.attrs.label,
446
- value: s.get(i.attrs.id) ?? i.textContent ?? ""
447
- })).filter((i) => i.id);
448
- l.length > 0 && ($?.(l), [
449
- ...E.current.document || [],
450
- ...E.current.signer || []
451
- ].filter((R) => R.value !== void 0).forEach(
452
- (R) => N({
453
- id: R.id,
454
- value: R.value
455
- })
456
- ));
533
+ documentSource: a.source,
534
+ fields: {
535
+ document: n.document || [],
536
+ signer: (n.signer || []).map((o) => ({
537
+ id: o.id,
538
+ value: b.get(o.id) ?? null
539
+ }))
457
540
  },
458
- [$, N]
459
- ), j = (t) => {
460
- const o = {
461
- ...t,
462
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
463
- }, s = globalThis?.__SUPERDOC_AUDIT_MOCK__;
464
- s && s(o);
465
- const l = [...k.current, o];
466
- return k.current = l, P(l), l;
541
+ fileName: d?.fileName || "document.pdf"
467
542
  };
468
- te(() => w.current ? ((async () => {
469
- const { SuperDoc: o } = await import("./superdoc.es-CqejOF1J.js").then((l) => l.D), s = new o({
470
- selector: w.current,
471
- document: a.source,
472
- documentMode: "viewing",
473
- onReady: () => {
474
- s.activeEditor && U(s.activeEditor), j({ type: "ready" }), oe(!0);
475
- }
476
- });
477
- y.current = s;
478
- })(), () => {
479
- y.current && (typeof y.current.destroy == "function" && y.current.destroy(), y.current = null);
480
- }) : void 0, [a.source, a.mode, U]), te(() => {
481
- if (!a.validation?.scroll?.required || !K) return;
482
- const t = w.current;
483
- if (!t) return;
484
- const o = () => {
485
- const { scrollTop: s, scrollHeight: l, clientHeight: i } = t, R = s / (l - i);
486
- (R >= 0.95 || l <= i) && (H(!0), j({
487
- type: "scroll",
488
- data: { percent: Math.round(R * 100) }
489
- }));
490
- };
491
- return t.addEventListener("scroll", o), o(), () => t.removeEventListener("scroll", o);
492
- }, [a.validation?.scroll?.required, K]);
493
- const e = M(
494
- (t, o) => {
495
- G((s) => {
496
- const l = s.get(t), i = new Map(s);
497
- return i.set(t, o), N({
498
- id: t,
499
- value: o
500
- }), j({
501
- type: "field_change",
502
- data: { fieldId: t, value: o, previousValue: l }
503
- }), Y?.({
504
- id: t,
505
- value: o,
506
- previousValue: l
507
- }), i;
508
- });
543
+ await z?.(t);
544
+ }, [
545
+ h,
546
+ m,
547
+ a.source,
548
+ n,
549
+ b,
550
+ d,
551
+ z
552
+ ]), l = M(async () => {
553
+ if (!A || h || T) return;
554
+ Z(!0), j({ type: "submit" });
555
+ const t = j({ type: "submit" }), o = {
556
+ eventId: m,
557
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
558
+ duration: Math.floor((Date.now() - ae.current) / 1e3),
559
+ auditTrail: t,
560
+ documentFields: n.document || [],
561
+ signerFields: (n.signer || []).map((s) => ({
562
+ id: s.id,
563
+ value: b.get(s.id) ?? null
564
+ })),
565
+ isFullyCompleted: A
566
+ };
567
+ try {
568
+ await S(o);
569
+ } finally {
570
+ Z(!1);
571
+ }
572
+ }, [
573
+ A,
574
+ h,
575
+ T,
576
+ m,
577
+ n,
578
+ b,
579
+ S
580
+ ]), D = (t) => {
581
+ const o = t.component || q(t.type);
582
+ return /* @__PURE__ */ p.jsx(
583
+ o,
584
+ {
585
+ value: b.get(t.id) ?? null,
586
+ onChange: (s) => e(t.id, s),
587
+ isDisabled: h,
588
+ label: t.label
509
589
  },
510
- [Y, N]
511
- ), r = M(() => a.validation?.scroll?.required && !_ ? !1 : (n.signer || []).every((t) => {
512
- if (!t.validation?.required) return !0;
513
- const o = b.get(t.id);
514
- return o && (typeof o != "string" || o.trim());
515
- }), [
516
- _,
517
- n.signer,
518
- b,
519
- a.validation?.scroll?.required
520
- ]);
521
- te(() => {
522
- const t = r();
523
- X(t), B?.({
524
- scrolled: _,
525
- fields: b,
526
- isValid: t,
527
- isSubmitting: T
528
- });
529
- }, [_, b, T, r, B]);
530
- const c = M(async () => {
531
- if (h) return;
532
- const t = {
533
- eventId: m,
534
- documentSource: a.source,
535
- fields: {
536
- document: n.document || [],
537
- signer: (n.signer || []).map((o) => ({
538
- id: o.id,
539
- value: b.get(o.id) ?? null
540
- }))
541
- },
542
- fileName: f?.fileName || "document.pdf"
543
- };
544
- await z?.(t);
545
- }, [
546
- h,
547
- m,
548
- a.source,
549
- n,
550
- b,
551
- f,
552
- z
553
- ]), u = M(async () => {
554
- if (!A || h || T) return;
555
- Z(!0), j({ type: "submit" });
556
- const t = j({ type: "submit" }), o = {
557
- eventId: m,
558
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
559
- duration: Math.floor((Date.now() - ae.current) / 1e3),
560
- auditTrail: t,
561
- documentFields: n.document || [],
562
- signerFields: (n.signer || []).map((s) => ({
563
- id: s.id,
564
- value: b.get(s.id) ?? null
565
- })),
566
- isFullyCompleted: A
567
- };
568
- try {
569
- await S(o);
570
- } finally {
571
- Z(!1);
572
- }
573
- }, [
574
- A,
575
- h,
576
- T,
577
- m,
578
- n,
579
- b,
580
- S
581
- ]), D = (t) => {
582
- const o = t.component || q(t.type);
583
- return /* @__PURE__ */ p.jsx(
584
- o,
585
- {
586
- value: b.get(t.id) ?? null,
587
- onChange: (s) => e(t.id, s),
588
- isDisabled: h,
589
- label: t.label
590
- },
591
- t.id
592
- );
593
- }, q = (t) => {
594
- switch (t) {
595
- case "signature":
596
- case "text":
597
- return he;
598
- case "checkbox":
599
- return ye;
600
- }
601
- }, d = () => {
602
- const t = f?.component || Ee(f);
603
- return t ? /* @__PURE__ */ p.jsx(
604
- t,
605
- {
606
- onClick: c,
607
- fileName: f?.fileName,
608
- isDisabled: h
609
- }
610
- ) : null;
611
- }, C = () => {
612
- if (a.mode === "download")
613
- return null;
614
- const t = x?.component || _e(x);
615
- return /* @__PURE__ */ p.jsx(
616
- "div",
617
- {
618
- className: "superdoc-esign-actions superdoc-esign-form-actions",
619
- style: { display: "flex", gap: "10px" },
620
- children: /* @__PURE__ */ p.jsx(
621
- t,
622
- {
623
- onClick: u,
624
- isValid: A,
625
- isDisabled: h,
626
- isSubmitting: T
627
- }
628
- )
629
- }
630
- );
631
- }, F = d(), se = C();
632
- return ge(v, () => ({
633
- getState: () => ({
634
- scrolled: _,
635
- fields: b,
636
- isValid: A,
637
- isSubmitting: T
638
- }),
639
- getAuditTrail: () => k.current,
640
- reset: () => {
641
- H(!a.validation?.scroll?.required), G(/* @__PURE__ */ new Map()), X(!1), k.current = [], P([]);
590
+ t.id
591
+ );
592
+ }, q = (t) => {
593
+ switch (t) {
594
+ case "signature":
595
+ case "text":
596
+ return he;
597
+ case "checkbox":
598
+ return ye;
599
+ }
600
+ }, u = () => {
601
+ const t = d?.component || Ee(d);
602
+ return t ? /* @__PURE__ */ p.jsx(
603
+ t,
604
+ {
605
+ onClick: c,
606
+ fileName: d?.fileName,
607
+ isDisabled: h
642
608
  }
643
- })), /* @__PURE__ */ p.jsxs(
609
+ ) : null;
610
+ }, C = () => {
611
+ if (a.mode === "download")
612
+ return null;
613
+ const t = x?.component || _e(x);
614
+ return /* @__PURE__ */ p.jsx(
644
615
  "div",
645
616
  {
646
- className: `superdoc-esign-container ${O || ""}`,
647
- style: J,
648
- children: [
649
- /* @__PURE__ */ p.jsxs(
650
- "div",
651
- {
652
- className: "superdoc-esign-document",
653
- "data-testid": "superdoc-esign-document",
654
- style: { display: "flex", flexDirection: "column" },
655
- children: [
656
- F && /* @__PURE__ */ p.jsx(
657
- "div",
658
- {
659
- className: "superdoc-esign-document-toolbar",
660
- style: {
661
- display: "flex",
662
- justifyContent: "flex-end",
663
- alignItems: "center",
664
- padding: "8px 12px"
665
- },
666
- children: /* @__PURE__ */ p.jsx(
667
- "div",
668
- {
669
- className: "superdoc-esign-document-controls",
670
- style: { display: "flex", gap: "8px" },
671
- children: F
672
- }
673
- )
674
- }
675
- ),
676
- /* @__PURE__ */ p.jsx(
677
- "div",
678
- {
679
- ref: w,
680
- className: "superdoc-esign-document-viewer",
681
- "data-testid": "superdoc-scroll-container",
682
- style: { height: ne, overflow: "auto" }
683
- }
684
- )
685
- ]
686
- }
687
- ),
688
- /* @__PURE__ */ p.jsxs(
689
- "div",
690
- {
691
- className: "superdoc-esign-controls",
692
- style: { marginTop: "20px" },
693
- "data-testid": "superdoc-esign-controls",
694
- children: [
695
- n.signer && n.signer.length > 0 && /* @__PURE__ */ p.jsx(
696
- "div",
697
- {
698
- className: "superdoc-esign-fields",
699
- style: { marginBottom: "20px" },
700
- "data-testid": "superdoc-esign-fields",
701
- children: n.signer.map(D)
702
- }
703
- ),
704
- se
705
- ]
706
- }
707
- )
708
- ]
617
+ className: "superdoc-esign-actions superdoc-esign-form-actions",
618
+ style: { display: "flex", gap: "10px" },
619
+ children: /* @__PURE__ */ p.jsx(
620
+ t,
621
+ {
622
+ onClick: l,
623
+ isValid: A,
624
+ isDisabled: h,
625
+ isSubmitting: T
626
+ }
627
+ )
709
628
  }
710
629
  );
711
- }
712
- );
630
+ }, F = u(), se = C();
631
+ return ge(v, () => ({
632
+ getState: () => ({
633
+ scrolled: _,
634
+ fields: b,
635
+ isValid: A,
636
+ isSubmitting: T
637
+ }),
638
+ getAuditTrail: () => k.current,
639
+ reset: () => {
640
+ H(!a.validation?.scroll?.required), G(/* @__PURE__ */ new Map()), X(!1), k.current = [], P([]);
641
+ }
642
+ })), /* @__PURE__ */ p.jsxs(
643
+ "div",
644
+ {
645
+ className: `superdoc-esign-container ${O || ""}`,
646
+ style: J,
647
+ children: [
648
+ /* @__PURE__ */ p.jsxs(
649
+ "div",
650
+ {
651
+ className: "superdoc-esign-document",
652
+ "data-testid": "superdoc-esign-document",
653
+ style: { display: "flex", flexDirection: "column" },
654
+ children: [
655
+ F && /* @__PURE__ */ p.jsx(
656
+ "div",
657
+ {
658
+ className: "superdoc-esign-document-toolbar",
659
+ style: {
660
+ display: "flex",
661
+ justifyContent: "flex-end",
662
+ alignItems: "center",
663
+ padding: "8px 12px"
664
+ },
665
+ children: /* @__PURE__ */ p.jsx(
666
+ "div",
667
+ {
668
+ className: "superdoc-esign-document-controls",
669
+ style: { display: "flex", gap: "8px" },
670
+ children: F
671
+ }
672
+ )
673
+ }
674
+ ),
675
+ /* @__PURE__ */ p.jsx(
676
+ "div",
677
+ {
678
+ ref: w,
679
+ className: "superdoc-esign-document-viewer",
680
+ "data-testid": "superdoc-scroll-container",
681
+ style: { height: ne, overflow: "auto" }
682
+ }
683
+ )
684
+ ]
685
+ }
686
+ ),
687
+ /* @__PURE__ */ p.jsxs(
688
+ "div",
689
+ {
690
+ className: "superdoc-esign-controls",
691
+ style: { marginTop: "20px" },
692
+ "data-testid": "superdoc-esign-controls",
693
+ children: [
694
+ n.signer && n.signer.length > 0 && /* @__PURE__ */ p.jsx(
695
+ "div",
696
+ {
697
+ className: "superdoc-esign-fields",
698
+ style: { marginBottom: "20px" },
699
+ "data-testid": "superdoc-esign-fields",
700
+ children: n.signer.map(D)
701
+ }
702
+ ),
703
+ se
704
+ ]
705
+ }
706
+ )
707
+ ]
708
+ }
709
+ );
710
+ });
713
711
  Re.displayName = "SuperDocESign";
714
712
  export {
715
713
  ye as CheckboxInput,