@wix/form-elements 1.126.0 → 1.128.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/component/{appointment-rac-CYB_k6uF.js → appointment-rac-S9z3s23G.js} +5 -5
- package/dist/component/{bookings-address-rac-yJjV3u5m.js → bookings-address-rac-B7wL2TjQ.js} +1 -1
- package/dist/component/{bookings-email-rac-WkFgaEv5.js → bookings-email-rac-T2lFRGpg.js} +1 -1
- package/dist/component/{bookings-first-name-rac-CJ1cBR5Z.js → bookings-first-name-rac-BBrENRBf.js} +1 -1
- package/dist/component/{bookings-header-rac-DiC19ttR.js → bookings-header-rac-CWGMiMQz.js} +1 -1
- package/dist/component/{bookings-last-name-rac-Dx0Nt5Z_.js → bookings-last-name-rac-BQWvH_gm.js} +1 -1
- package/dist/component/{bookings-login-bar-rac-CcW2nUYQ.js → bookings-login-bar-rac-tFs0Vioz.js} +6 -6
- package/dist/component/{bookings-phone-rac-BMLrrTf6.js → bookings-phone-rac-BV_BTfAh.js} +1 -1
- package/dist/component/{bookings-rich-text-rac-DIbRjzxZ.js → bookings-rich-text-rac-8cD6QJBZ.js} +1 -1
- package/dist/component/{checkbox-field-rac-3a6NYcNf.js → checkbox-field-rac-YmG26i31.js} +45 -45
- package/dist/component/{checkbox-group-field-headless-CM-2wLJv.js → checkbox-group-field-headless-CE8sEjZj.js} +3 -3
- package/dist/component/{checkbox-group-field-rac-CNWwJ_No.js → checkbox-group-field-rac-CSuJRyk1.js} +6 -6
- package/dist/component/{checkbox-group-rac-F08XYJSA.js → checkbox-group-rac-VDezm9js.js} +1 -1
- package/dist/component/{checkbox-indicator-module-classes-DOAYUQ_Q.js → checkbox-indicator-module-classes-Bqo0QILF.js} +1 -1
- package/dist/component/{checkbox-rac-z98USBLu.js → checkbox-rac-DoC1ZqAq.js} +1 -1
- package/dist/component/{contacts-address-rac-DuodyS7l.js → contacts-address-rac-10AZNzhI.js} +1 -1
- package/dist/component/{contacts-birthdate-rac-BY7L9nWm.js → contacts-birthdate-rac-C7YDiyg2.js} +1 -1
- package/dist/component/{contacts-company-rac-iPNPKhx2.js → contacts-company-rac-xQEtJ_-m.js} +1 -1
- package/dist/component/{contacts-email-rac-C7kBUzQH.js → contacts-email-rac-Bryw_aCU.js} +1 -1
- package/dist/component/{contacts-first-name-rac-DvDNRs2q.js → contacts-first-name-rac-BXmuuhfG.js} +1 -1
- package/dist/component/{contacts-last-name-rac-Cls5_7W0.js → contacts-last-name-rac-CVWVZO8I.js} +1 -1
- package/dist/component/{contacts-phone-rac-DMy2lBJl.js → contacts-phone-rac-C-KSwisV.js} +1 -1
- package/dist/component/{contacts-position-rac-Bn21lF_i.js → contacts-position-rac-od-5Gie5.js} +1 -1
- package/dist/component/{contacts-subscribe-rac-QSC_n_T_.js → contacts-subscribe-rac-CCh9JcQx.js} +1 -1
- package/dist/component/{contacts-tax-id-rac-BvqoePCN.js → contacts-tax-id-rac-DOM7TPQz.js} +1 -1
- package/dist/component/{date-availability-SErYnVtm.js → date-availability-G5IwqtRi.js} +1 -1
- package/dist/component/{date-input-field-rac-H81WktJT.js → date-input-field-rac-BpBqS7LG.js} +42 -42
- package/dist/component/{date-input-rac-C6ZeK0zQ.js → date-input-rac-CQyqRqZK.js} +1 -1
- package/dist/component/{date-picker-field-rac-BwSKny80.js → date-picker-field-rac-BsR_0eAW.js} +15 -15
- package/dist/component/{date-picker-rac-BB5zswk4.js → date-picker-rac-Bl2k363u.js} +1 -1
- package/dist/component/{date-time-input-field-rac-C4srGo4X.js → date-time-input-field-rac-C5TC2nsm.js} +64 -64
- package/dist/component/{date-time-input-rac-6PXunNeR.js → date-time-input-rac-CInfYWxN.js} +1 -1
- package/dist/component/{dext-checkbox-group-rac-B1GOhxW8.js → dext-checkbox-group-rac-E36LjEfn.js} +2 -2
- package/dist/component/{dext-checkbox-rac-DVels76t.js → dext-checkbox-rac-DkMAv7aY.js} +1 -1
- package/dist/component/{dext-date-picker-rac-kKH7Nu_c.js → dext-date-picker-rac-BNkJPlYo.js} +1 -1
- package/dist/component/{dext-date-time-input-rac-C2xk0pv1.js → dext-date-time-input-rac-BH3Q0pwI.js} +1 -1
- package/dist/component/{dext-dropdown-rac-bd3XpA-l.js → dext-dropdown-rac-DkF_DD08.js} +1 -1
- package/dist/component/{dext-email-rac-BtEeJsrT.js → dext-email-rac-0x_DN0_O.js} +1 -1
- package/dist/component/{dext-number-input-rac-BLPAbm2q.js → dext-number-input-rac-UiIENkK3.js} +1 -1
- package/dist/component/{dext-phone-rac-ByEP8XRg.js → dext-phone-rac-BZFK4Uq7.js} +1 -1
- package/dist/component/{dext-radio-group-rac-AY271KFi.js → dext-radio-group-rac-CBAdO7kt.js} +4 -4
- package/dist/component/{dext-rating-input-rac-Dp9N8OWT.js → dext-rating-input-rac-fqR1sriq.js} +1 -1
- package/dist/component/{dext-tags-rac-PgZGGDwj.js → dext-tags-rac-mDuiUs9L.js} +4 -4
- package/dist/component/{dext-text-area-rac-BN99TM9O.js → dext-text-area-rac-C-8jKWpK.js} +1 -1
- package/dist/component/{dext-text-input-rac-C5TaQVi8.js → dext-text-input-rac-CCBAM9YO.js} +1 -1
- package/dist/component/{dext-url-input-rac-BvMh_jc6.js → dext-url-input-rac-C4_8Yk0p.js} +1 -1
- package/dist/component/{donation-rac-BSCyAZPx.js → donation-rac-BwDHypVJ.js} +36 -36
- package/dist/component/{dropdown-field-headless-DzDE-6ha.js → dropdown-field-headless-CspX2zV_.js} +16 -16
- package/dist/component/{dropdown-field-rac-mbYavQtS.js → dropdown-field-rac-DduQJ9rO.js} +5 -5
- package/dist/component/{dropdown-rac-BUJag5ow.js → dropdown-rac-BhhECLoH.js} +1 -1
- package/dist/component/{ecom-address-rac-B7_RYjoj.js → ecom-address-rac-BJ1nnEVL.js} +1 -1
- package/dist/component/{ecom-subscription-checkbox-rac-BCDyH7x-.js → ecom-subscription-checkbox-rac-4m1XMTDY.js} +2 -2
- package/dist/component/{email-input-field-rac-CUi08-gD.js → email-input-field-rac-bPEcgidt.js} +19 -19
- package/dist/component/{events-repeater-rac-CkHq7ADr.js → events-repeater-rac-CujTGEHx.js} +11 -11
- package/dist/component/{events-rsvp-rac-DBwLvDeR.js → events-rsvp-rac-BPqr_aY9.js} +4 -4
- package/dist/component/{field-error-headless-Ct41F8cQ.js → field-error-headless-Bu_4Huhb.js} +6 -6
- package/dist/component/{field-label-headless-DUqBV42_.js → field-label-headless-DkDmQPFG.js} +1 -1
- package/dist/component/field-rac.module-BIBNQEOK.js +25 -0
- package/dist/component/{file-upload-rac-CkbjhtAl.js → file-upload-rac-DmOQrGe8.js} +68 -68
- package/dist/component/{fixed-payment-rac-Dgnhsx3e.js → fixed-payment-rac-CDsddKrV.js} +9 -9
- package/dist/component/{form-Dx1bK3Fi.js → form-BpJ4Lqbe.js} +668 -617
- package/dist/component/form.css +1 -1
- package/dist/component/form.js +3 -3
- package/dist/component/{header-field-rac-BuUxOZO1.js → header-field-rac-Cr1FVQdq.js} +6 -6
- package/dist/component/{header-rac-CIvWVvYs.js → header-rac-CvAZsqDL.js} +1 -1
- package/dist/component/{image-choice-rac-BBo0PiW4.js → image-choice-rac-D_EKrD73.js} +12 -12
- package/dist/component/{index-BmMiwDw9.js → index-DxsHfkik.js} +44 -44
- package/dist/component/{index-BDSs3l4d.js → index-Tnke1N8m.js} +15 -15
- package/dist/component/{isObjectLike-xZCFQW_t.js → isObjectLike-CMWsWjX8.js} +7 -7
- package/dist/component/{multiline-address-field-rac-C6mRorOw.js → multiline-address-field-rac-BMeMP7J6.js} +8 -8
- package/dist/component/{multiline-address-rac-BOjsVo4R.js → multiline-address-rac-CFprfFXm.js} +1 -1
- package/dist/component/{number-input-field-rac-C89M-zOh.js → number-input-field-rac-CaHySxYH.js} +9 -9
- package/dist/component/{number-input-rac-DttY0Ll3.js → number-input-rac-BezfoU8h.js} +1 -1
- package/dist/component/{password-rac-C2KTrH40.js → password-rac-_wwZFd67.js} +32 -32
- package/dist/component/{payment-input-rac-BhyBxeu1.js → payment-input-rac-CWrSvBDp.js} +15 -15
- package/dist/component/{phone-input-field-rac-BT-Fe6WZ.js → phone-input-field-rac-R3LYdPIs.js} +39 -39
- package/dist/component/{phone-rac-B26qwlDN.js → phone-rac-D6uILVRw.js} +1 -1
- package/dist/component/{product-list-rac-CF4gkfTK.js → product-list-rac-D3WTfC9k.js} +28 -28
- package/dist/component/{quiz-radio-group-rac-Bf2HeDDw.js → quiz-radio-group-rac-B6T7eedk.js} +1 -1
- package/dist/component/{radio-button-module-classes-DtmmP89u.js → radio-button-module-classes-D8Jm-Q6u.js} +3 -3
- package/dist/component/{radio-group-field-rac-BY2OIFFr.js → radio-group-field-rac-R5onZzJd.js} +5 -5
- package/dist/component/{radio-group-rac-BuxVel2l.js → radio-group-rac-DUPHR4tK.js} +1 -1
- package/dist/component/{rating-input-field-rac-CbLzvwyk.js → rating-input-field-rac-C9GpwuRO.js} +10 -10
- package/dist/component/{rating-input-rac-B8QxNYHU.js → rating-input-rac-Iv_2PVqP.js} +1 -1
- package/dist/component/{rich-content-rac.module-wu4JPlkg.js → rich-content-rac.module-Det3BKrI.js} +1 -1
- package/dist/component/{rich-text-field-rac-CTrEe0SQ.js → rich-text-field-rac-DnBtp2d_.js} +9 -9
- package/dist/component/{rich-text-rac-kmzPTMKb.js → rich-text-rac-CXzxap1G.js} +1 -1
- package/dist/component/{service-dropdown-rac-C8nTy49F.js → service-dropdown-rac-CVyd2HYC.js} +14 -14
- package/dist/component/{services-multi-choice-rac-rDkpN2fs.js → services-multi-choice-rac-BY-W0xIt.js} +7 -7
- package/dist/component/signature-rac-BojdPJhg.js +918 -0
- package/dist/component/{submit-button-rac-BFywt2Fn.js → submit-button-rac-Q7KKQbiL.js} +15 -15
- package/dist/component/{tags-field-rac-rpzvIn_0.js → tags-field-rac-CbmR6gi4.js} +17 -17
- package/dist/component/{tags-rac-DVLGSSvh.js → tags-rac-hJo0tMVR.js} +1 -1
- package/dist/component/{text-area-field-rac-BfVrtvl8.js → text-area-field-rac-DHQqkqtu.js} +15 -15
- package/dist/component/{text-area-rac-VP-yXdJ6.js → text-area-rac-BTXxfWyK.js} +1 -1
- package/dist/component/{text-input-field-rac-BlaXiXoF.js → text-input-field-rac-BVTBYjMM.js} +4 -4
- package/dist/component/{text-input-headless-ChCTtqUX.js → text-input-headless-Dk_0y9U-.js} +8 -8
- package/dist/component/{text-input-rac-CG-Oo3nZ.js → text-input-rac-DIwGn0WI.js} +1 -1
- package/dist/component/{time-input-rac-CzUGIr2X.js → time-input-rac-ClyPOKOH.js} +10 -10
- package/dist/component/{url-input-field-rac-BHF6gZlT.js → url-input-field-rac-BhPzHWTI.js} +10 -10
- package/dist/component/{url-input-rac-DouQt3DF.js → url-input-rac-COD7T5wo.js} +1 -1
- package/dist/component/{use-dropdown-option-class-name-AklIMCCI.js → use-dropdown-option-class-name-CTDQ4YIC.js} +3 -3
- package/dist/component/{use-dropdown-trigger-class-name-COJhxT4T.js → use-dropdown-trigger-class-name-DapDPNX0.js} +10 -10
- package/dist/component/use-element-state-class-name-BU86oHkX.js +20 -0
- package/dist/component/{use-hoverable-input-class-name-CtHJHqiV.js → use-hoverable-input-class-name-DWkmQfPd.js} +3 -3
- package/dist/component/{use-service-options-base-2u1I6l-t.js → use-service-options-base-jkecu8jY.js} +4 -4
- package/dist/component/use-text-input-class-name-CNTXVb7N.js +6 -0
- package/dist/form.d.ts +10 -0
- package/package.json +2 -2
- package/dist/component/field-rac.module-DQxyEwK7.js +0 -26
- package/dist/component/signature-rac-6r_gWBD2.js +0 -794
- package/dist/component/use-element-state-class-name-CCe7Cvsu.js +0 -22
- package/dist/component/use-text-input-class-name-Bnfv7ZsJ.js +0 -6
|
@@ -1,794 +0,0 @@
|
|
|
1
|
-
import s, { useRef as W, useCallback as C, useState as K, useEffect as Q, useMemo as De, isValidElement as Re } from "react";
|
|
2
|
-
import { RicosViewer as we } from "@wix/ricos/viewer";
|
|
3
|
-
import v from "classnames";
|
|
4
|
-
import { useHover as ve, useFocusRing as Se, mergeProps as xe } from "react-aria";
|
|
5
|
-
import { RadioGroup as Fe, Button as fe, TextField as Ae, Input as _e, RadioField as Ne, RadioButton as Pe } from "react-aria-components";
|
|
6
|
-
import he from "signature_pad";
|
|
7
|
-
import { aD as Ue, b5 as Oe, b1 as Be, bh as ge, E as ce, a6 as G, b9 as A, b6 as H, bb as Ee, bj as Me, I as ue, U as We, H as B, W as He, v as Ye, p as ke } from "./form-Dx1bK3Fi.js";
|
|
8
|
-
import { f as I, a as F } from "./find-child-C60k4CxG.js";
|
|
9
|
-
import { D as $e, E as Ve } from "./field-error-headless-Ct41F8cQ.js";
|
|
10
|
-
import { L as ze } from "./field-label-headless-DUqBV42_.js";
|
|
11
|
-
import { D as Ze } from "./data-hooks-Dkw1pbRj.js";
|
|
12
|
-
import { E as Xe } from "./error-icon-hZxQ6DEy.js";
|
|
13
|
-
import { s as V } from "./field-rac.module-DQxyEwK7.js";
|
|
14
|
-
const Ge = typeof s.useId == "function" ? s.useId : () => W(Ue()).current;
|
|
15
|
-
var R = /* @__PURE__ */ (function(e) {
|
|
16
|
-
return e.TEXT = "text/plain", e.POINTS = "points/json", e;
|
|
17
|
-
})({}), b = /* @__PURE__ */ (function(e) {
|
|
18
|
-
return e.DRAW = "draw", e.TYPE = "type", e.UPLOAD = "upload", e;
|
|
19
|
-
})({}), x = /* @__PURE__ */ (function(e) {
|
|
20
|
-
return e.DRAW = "draw", e.TYPE = "type", e.IMAGE = "image", e.UPLOAD = "upload", e;
|
|
21
|
-
})({});
|
|
22
|
-
const qe = (e) => {
|
|
23
|
-
const { actions: t, formId: a } = Oe(), n = t == null ? void 0 : t.uploadFile;
|
|
24
|
-
return C(async (r) => {
|
|
25
|
-
if (!n)
|
|
26
|
-
throw new Error("No uploadFile action");
|
|
27
|
-
const o = await n({
|
|
28
|
-
file: r,
|
|
29
|
-
formId: a,
|
|
30
|
-
uploadTarget: e
|
|
31
|
-
}), { id: i, displayName: l, url: c, isPrivate: d } = o;
|
|
32
|
-
return {
|
|
33
|
-
fileId: i,
|
|
34
|
-
displayName: l || r.name,
|
|
35
|
-
url: d ? void 0 : c,
|
|
36
|
-
fileType: r.type
|
|
37
|
-
};
|
|
38
|
-
}, [
|
|
39
|
-
n,
|
|
40
|
-
a,
|
|
41
|
-
e
|
|
42
|
-
]);
|
|
43
|
-
};
|
|
44
|
-
function je(e) {
|
|
45
|
-
const a = z(1, 1).getContext("2d");
|
|
46
|
-
a.fillStyle = e, a.fillRect(0, 0, 1, 1);
|
|
47
|
-
const n = a.getImageData(0, 0, 1, 1);
|
|
48
|
-
return n.data[0] * 65536 + n.data[1] * 256 + n.data[2];
|
|
49
|
-
}
|
|
50
|
-
const Je = (e, t) => {
|
|
51
|
-
const a = je(e);
|
|
52
|
-
return (n, r) => {
|
|
53
|
-
const o = (r * t.width + n) * 4;
|
|
54
|
-
return t.data[o] * 65536 + t.data[o + 1] * 256 + t.data[o + 2] === a;
|
|
55
|
-
};
|
|
56
|
-
}, Ke = (e) => (t, a) => {
|
|
57
|
-
const n = (a * e.width + t) * 4;
|
|
58
|
-
return e.data[n + 3] === 0;
|
|
59
|
-
};
|
|
60
|
-
function J(e, t) {
|
|
61
|
-
const a = e.getContext("2d", {
|
|
62
|
-
willReadFrequently: !0
|
|
63
|
-
}), n = e.width, r = e.height, o = a.getImageData(0, 0, n, r), i = t ? Je(t, o) : Ke(o);
|
|
64
|
-
let l = n + 1, c = -1, d = r + 1, u = -1, f = 0, m = 0;
|
|
65
|
-
for (m = 0; m < r; m++)
|
|
66
|
-
for (f = 0; f < n; f++)
|
|
67
|
-
i(f, m) || (l > f && (l = f), c < f && (c = f), d > m && (d = m), u < m && (u = m));
|
|
68
|
-
const h = c - l, E = u - d;
|
|
69
|
-
if (h < 0 || E < 0)
|
|
70
|
-
return null;
|
|
71
|
-
const p = a.getImageData(l, d, h, E), L = document.createElement("canvas"), y = L.getContext("2d");
|
|
72
|
-
return L.width = h, L.height = E, t ? (y.fillStyle = t, y.fillRect(0, 0, h, E)) : y.clearRect(0, 0, h, E), y.putImageData(p, 0, 0), L;
|
|
73
|
-
}
|
|
74
|
-
function z(e, t, a) {
|
|
75
|
-
const n = document.createElement("canvas");
|
|
76
|
-
if (n.width = e, n.height = t, a) {
|
|
77
|
-
const r = n.getContext("2d", {
|
|
78
|
-
willReadFrequently: !0
|
|
79
|
-
});
|
|
80
|
-
r == null || r.scale(a, a);
|
|
81
|
-
}
|
|
82
|
-
return n;
|
|
83
|
-
}
|
|
84
|
-
function Qe(e, t) {
|
|
85
|
-
return new Promise((a, n) => {
|
|
86
|
-
const r = new Image();
|
|
87
|
-
r.onload = () => {
|
|
88
|
-
const o = z(r.width, r.height), i = o.getContext("2d", {
|
|
89
|
-
willReadFrequently: !0
|
|
90
|
-
});
|
|
91
|
-
i == null || i.drawImage(r, 0, 0), a(o);
|
|
92
|
-
}, r.onerror = n, r.src = e;
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
function de(e, t, a, n) {
|
|
96
|
-
const r = e.width, o = e.height, i = 1, l = a / o, c = Math.min(l, i), d = r * c, u = o * c, f = z(d, u), m = f.getContext("2d");
|
|
97
|
-
return n && m && (m.fillStyle = n, m.fillRect(0, 0, d, u)), m == null || m.drawImage(e, 0, 0, r, o, 0, 0, d, u), f;
|
|
98
|
-
}
|
|
99
|
-
function me(e, t) {
|
|
100
|
-
const a = e.getContext("2d"), n = e.offsetWidth, r = e.offsetHeight, o = Math.max(window.devicePixelRatio || 1, 1), i = n * o, l = r * o;
|
|
101
|
-
return (e.width !== i || e.height !== l) && a ? (e.width = i, e.height = l, a.scale(o, o), t == null || t.redraw(), !0) : !1;
|
|
102
|
-
}
|
|
103
|
-
const M = 480, et = (e) => Te({
|
|
104
|
-
data: JSON.stringify(e),
|
|
105
|
-
mimeType: R.POINTS
|
|
106
|
-
}), Le = (e) => {
|
|
107
|
-
const t = P(e);
|
|
108
|
-
if ((t == null ? void 0 : t.mimeType) === R.POINTS)
|
|
109
|
-
try {
|
|
110
|
-
return JSON.parse(t.data);
|
|
111
|
-
} catch {
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
return null;
|
|
115
|
-
}, pe = 0.8, be = "Madefor";
|
|
116
|
-
function ye(e, t) {
|
|
117
|
-
const { width: a, actualBoundingBoxAscent: n, actualBoundingBoxDescent: r } = t.measureText(e);
|
|
118
|
-
return {
|
|
119
|
-
width: a,
|
|
120
|
-
height: n + r,
|
|
121
|
-
offsetY: n
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
function tt(e, t) {
|
|
125
|
-
const a = t.getContext("2d"), n = t.offsetWidth || t.width, o = (t.offsetHeight || t.height) * pe, i = n * pe;
|
|
126
|
-
a.font = `${o}px ${be}`;
|
|
127
|
-
const { width: l, height: c } = ye(e, a), d = o / (l / i), u = o / (c / o);
|
|
128
|
-
return Math.min(d, u);
|
|
129
|
-
}
|
|
130
|
-
function nt(e, t, a = "black", n = !1, r) {
|
|
131
|
-
const o = e.getContext("2d"), i = tt(t, e);
|
|
132
|
-
o.font = `${i}px ${be}`, o.textBaseline = "top";
|
|
133
|
-
const l = e.offsetWidth || e.width, c = e.offsetHeight || e.height, { width: d, height: u, offsetY: f } = ye(t, o);
|
|
134
|
-
o.fillStyle = r, o.fillRect(0, 0, l, c), o.fillStyle = a;
|
|
135
|
-
const m = (l - d) / 2;
|
|
136
|
-
o.fillText(t, n ? l - m : m, (c - u) / 2 + f);
|
|
137
|
-
}
|
|
138
|
-
const Ie = /^data:([^;,]+)(?:;([^,]+))?,(.+)$/;
|
|
139
|
-
function at(e) {
|
|
140
|
-
return Ie.test(e);
|
|
141
|
-
}
|
|
142
|
-
function P(e) {
|
|
143
|
-
if (!e)
|
|
144
|
-
return;
|
|
145
|
-
const t = e.match(Ie);
|
|
146
|
-
if (!t)
|
|
147
|
-
return;
|
|
148
|
-
const [, a, n, r] = t;
|
|
149
|
-
return {
|
|
150
|
-
data: n === "base64" ? atob(r) : decodeURI(r),
|
|
151
|
-
mimeType: a,
|
|
152
|
-
encoding: n
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
function Te({ data: e, mimeType: t, encoding: a = "text" }) {
|
|
156
|
-
const n = a === "base64" ? btoa(e) : encodeURI(e);
|
|
157
|
-
return `data:${a === "base64" ? `${t};base64` : t},${n}`;
|
|
158
|
-
}
|
|
159
|
-
function rt(e, t) {
|
|
160
|
-
const a = P(e);
|
|
161
|
-
if (!a)
|
|
162
|
-
return;
|
|
163
|
-
let n = a.data.length;
|
|
164
|
-
const r = new Uint8Array(n);
|
|
165
|
-
for (; n--; )
|
|
166
|
-
r[n] = a.data.charCodeAt(n);
|
|
167
|
-
const o = a.mimeType.split("/")[1] ?? "txt";
|
|
168
|
-
return new File([
|
|
169
|
-
r
|
|
170
|
-
], `${t}.${o}`, {
|
|
171
|
-
type: a.mimeType
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
function ee(e, t = "temp") {
|
|
175
|
-
const a = P(e);
|
|
176
|
-
return {
|
|
177
|
-
fileId: "temp",
|
|
178
|
-
displayName: t,
|
|
179
|
-
url: e,
|
|
180
|
-
fileType: (a == null ? void 0 : a.mimeType) ?? ""
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
async function ot(e, t) {
|
|
184
|
-
const a = P(e);
|
|
185
|
-
if (!a)
|
|
186
|
-
return e;
|
|
187
|
-
const n = a.mimeType;
|
|
188
|
-
if (n === R.TEXT) {
|
|
189
|
-
const r = z(M * 20, M, 1);
|
|
190
|
-
nt(r, a.data, "black", t, "white");
|
|
191
|
-
const o = J(r, "white");
|
|
192
|
-
return (o == null ? void 0 : o.toDataURL("image/jpeg", 0.7)) ?? null;
|
|
193
|
-
}
|
|
194
|
-
if (n === R.POINTS) {
|
|
195
|
-
const r = Le(e);
|
|
196
|
-
if (!r)
|
|
197
|
-
return null;
|
|
198
|
-
const o = r.map((u) => ({
|
|
199
|
-
...u,
|
|
200
|
-
penColor: "black"
|
|
201
|
-
})), i = z(M * 20, M, Math.max(window.devicePixelRatio || 1, 1));
|
|
202
|
-
new he(i).fromData(o);
|
|
203
|
-
const c = J(i);
|
|
204
|
-
return c ? de(c, void 0, M, "white").toDataURL("image/jpeg", 0.7) : null;
|
|
205
|
-
}
|
|
206
|
-
if (n != null && n.startsWith("image/")) {
|
|
207
|
-
const r = await Qe(e), o = J(r);
|
|
208
|
-
return o ? de(o, void 0, M).toDataURL("image/jpeg", 0.7) : null;
|
|
209
|
-
}
|
|
210
|
-
return e;
|
|
211
|
-
}
|
|
212
|
-
async function st(e, t) {
|
|
213
|
-
const a = await ot(e, t);
|
|
214
|
-
if (a)
|
|
215
|
-
return rt(a, "signature");
|
|
216
|
-
}
|
|
217
|
-
const it = ({ value: e, onChange: t, target: a }) => {
|
|
218
|
-
const [n, r] = K(e), { isRTL: o } = Be(), i = qe(a), { setFormStatus: l } = ge(), c = W();
|
|
219
|
-
Q(() => {
|
|
220
|
-
e === ce && r(ce);
|
|
221
|
-
}, [
|
|
222
|
-
e
|
|
223
|
-
]);
|
|
224
|
-
const d = C(() => {
|
|
225
|
-
c.current && (clearTimeout(c.current), c.current = null);
|
|
226
|
-
}, []), u = n == null ? void 0 : n[0], f = u != null && u.url ? P(u.url) : void 0, m = C(async (E) => {
|
|
227
|
-
try {
|
|
228
|
-
const p = (E == null ? void 0 : E.url) ?? "";
|
|
229
|
-
if (at(p)) {
|
|
230
|
-
const L = await st(p, o);
|
|
231
|
-
if (L) {
|
|
232
|
-
const y = await i(L);
|
|
233
|
-
t([
|
|
234
|
-
y
|
|
235
|
-
]);
|
|
236
|
-
} else
|
|
237
|
-
r(void 0), t(void 0);
|
|
238
|
-
}
|
|
239
|
-
c.current = null;
|
|
240
|
-
} finally {
|
|
241
|
-
l(a, G.READY);
|
|
242
|
-
}
|
|
243
|
-
}, [
|
|
244
|
-
l,
|
|
245
|
-
a,
|
|
246
|
-
o,
|
|
247
|
-
i,
|
|
248
|
-
t
|
|
249
|
-
]);
|
|
250
|
-
return {
|
|
251
|
-
handleChange: C((E) => {
|
|
252
|
-
const p = (L) => {
|
|
253
|
-
c.current = setTimeout(() => m(L), 1500);
|
|
254
|
-
};
|
|
255
|
-
E ? (c.current && (clearTimeout(c.current), c.current = null), r([
|
|
256
|
-
E
|
|
257
|
-
]), p(E)) : (t == null || t(null), r(void 0), l(a, G.READY));
|
|
258
|
-
}, [
|
|
259
|
-
m,
|
|
260
|
-
t,
|
|
261
|
-
l,
|
|
262
|
-
a
|
|
263
|
-
]),
|
|
264
|
-
signature: u,
|
|
265
|
-
decodedValue: f,
|
|
266
|
-
cancelUpload: d
|
|
267
|
-
};
|
|
268
|
-
}, lt = ({ target: e, value: t, onChange: a }) => {
|
|
269
|
-
const { handleChange: n, cancelUpload: r, signature: o, decodedValue: i } = it({
|
|
270
|
-
value: t,
|
|
271
|
-
onChange: a,
|
|
272
|
-
target: e
|
|
273
|
-
}), [l, c] = K(() => {
|
|
274
|
-
if (o == null)
|
|
275
|
-
return b.DRAW;
|
|
276
|
-
switch (i == null ? void 0 : i.mimeType) {
|
|
277
|
-
case R.POINTS:
|
|
278
|
-
return b.DRAW;
|
|
279
|
-
case R.TEXT:
|
|
280
|
-
return b.TYPE;
|
|
281
|
-
default:
|
|
282
|
-
return b.UPLOAD;
|
|
283
|
-
}
|
|
284
|
-
}), { setFormStatus: d } = ge(), u = C(() => {
|
|
285
|
-
r(), d(e, G.BUSY);
|
|
286
|
-
}, [
|
|
287
|
-
r,
|
|
288
|
-
d,
|
|
289
|
-
e
|
|
290
|
-
]), f = C(() => {
|
|
291
|
-
r(), n(null), d(e, G.READY);
|
|
292
|
-
}, [
|
|
293
|
-
r,
|
|
294
|
-
n,
|
|
295
|
-
d,
|
|
296
|
-
e
|
|
297
|
-
]), m = o != null, h = ut(l, o, i), E = (() => {
|
|
298
|
-
switch (l) {
|
|
299
|
-
case b.DRAW:
|
|
300
|
-
return x.DRAW;
|
|
301
|
-
case b.TYPE:
|
|
302
|
-
return x.TYPE;
|
|
303
|
-
case b.UPLOAD:
|
|
304
|
-
return h != null ? x.IMAGE : x.UPLOAD;
|
|
305
|
-
default:
|
|
306
|
-
return x.DRAW;
|
|
307
|
-
}
|
|
308
|
-
})();
|
|
309
|
-
return {
|
|
310
|
-
signature: o,
|
|
311
|
-
decodedValue: i,
|
|
312
|
-
signatureMode: l,
|
|
313
|
-
clearable: m,
|
|
314
|
-
signatureValueForView: h,
|
|
315
|
-
signatureView: E,
|
|
316
|
-
handleChange: n,
|
|
317
|
-
setSignatureMode: c,
|
|
318
|
-
handleBeforeChange: u,
|
|
319
|
-
handleClear: f
|
|
320
|
-
};
|
|
321
|
-
}, ct = {
|
|
322
|
-
[b.DRAW]: (e) => (e == null ? void 0 : e.mimeType) === R.POINTS,
|
|
323
|
-
[b.TYPE]: (e) => (e == null ? void 0 : e.mimeType) === R.TEXT,
|
|
324
|
-
[b.UPLOAD]: (e) => (e == null ? void 0 : e.mimeType) !== R.POINTS && (e == null ? void 0 : e.mimeType) !== R.TEXT
|
|
325
|
-
};
|
|
326
|
-
function ut(e, t, a) {
|
|
327
|
-
return t && ct[e](a) ? t : void 0;
|
|
328
|
-
}
|
|
329
|
-
const dt = (e) => {
|
|
330
|
-
const t = e.url ? P(e.url) : void 0;
|
|
331
|
-
return t ? t.mimeType !== R.POINTS && t.mimeType !== R.TEXT : !0;
|
|
332
|
-
}, te = () => {
|
|
333
|
-
const { hoverProps: e, isHovered: t } = ve({}), { focusProps: a, isFocused: n, isFocusVisible: r } = Se({
|
|
334
|
-
within: !0
|
|
335
|
-
});
|
|
336
|
-
return {
|
|
337
|
-
...xe(e, a),
|
|
338
|
-
"data-hovered": t || void 0,
|
|
339
|
-
"data-focus-within": n || void 0,
|
|
340
|
-
"data-focus-visible": r || void 0
|
|
341
|
-
};
|
|
342
|
-
}, g = ({ children: e }) => {
|
|
343
|
-
const { id: t, FieldLayout: a } = A(), n = I(e, g.Label), r = I(e, g.Input), o = I(e, g.Description), i = I(e, g.Error);
|
|
344
|
-
return /* @__PURE__ */ s.createElement(a, {
|
|
345
|
-
fieldId: t,
|
|
346
|
-
renderLabel: () => n,
|
|
347
|
-
renderInput: () => r,
|
|
348
|
-
renderDescription: () => /* @__PURE__ */ s.createElement(s.Fragment, null, i, o)
|
|
349
|
-
});
|
|
350
|
-
}, Z = ({ children: e }) => {
|
|
351
|
-
const { value: t, onChange: a, target: n, readOnly: r } = A(), { signatureMode: o, setSignatureMode: i, handleClear: l, clearable: c, signatureView: d, signatureValueForView: u, handleChange: f, handleBeforeChange: m } = lt({
|
|
352
|
-
target: n,
|
|
353
|
-
value: t,
|
|
354
|
-
onChange: a
|
|
355
|
-
}), h = I(e, Z.Header), E = I(e, Z.Value), p = {
|
|
356
|
-
signatureMode: o,
|
|
357
|
-
setSignatureMode: i,
|
|
358
|
-
handleClear: l,
|
|
359
|
-
clearable: c,
|
|
360
|
-
signatureView: d,
|
|
361
|
-
signatureValueForView: u,
|
|
362
|
-
handleChange: f,
|
|
363
|
-
handleBeforeChange: m
|
|
364
|
-
};
|
|
365
|
-
return /* @__PURE__ */ s.createElement(s.Fragment, null, !r && F(h, p), F(E, p));
|
|
366
|
-
}, X = ({ children: e, className: t, ...a }) => {
|
|
367
|
-
const { signatureMode: n, setSignatureMode: r, clearable: o, handleClear: i } = a, { uploadEnabled: l } = A(), c = I(e, X.Tabs), d = I(e, X.Clear);
|
|
368
|
-
return /* @__PURE__ */ s.createElement("div", {
|
|
369
|
-
className: t
|
|
370
|
-
}, F(c, {
|
|
371
|
-
signatureMode: n,
|
|
372
|
-
setSignatureMode: r,
|
|
373
|
-
uploadEnabled: l
|
|
374
|
-
}), o && F(d, {
|
|
375
|
-
handleClear: i
|
|
376
|
-
}));
|
|
377
|
-
}, _ = ({ children: e, className: t, ...a }) => {
|
|
378
|
-
const { signatureMode: n, setSignatureMode: r, uploadEnabled: o } = a, { disabled: i } = A(), { labelId: l, inputId: c } = H(), d = C((h) => {
|
|
379
|
-
r(h);
|
|
380
|
-
}, [
|
|
381
|
-
r
|
|
382
|
-
]), u = {
|
|
383
|
-
[b.DRAW]: I(e, _.Draw),
|
|
384
|
-
[b.TYPE]: I(e, _.Type),
|
|
385
|
-
[b.UPLOAD]: o ? I(e, _.Upload) : null
|
|
386
|
-
}, f = u[n], m = mt(f) ? f.props.description : void 0;
|
|
387
|
-
return /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("div", {
|
|
388
|
-
role: "status",
|
|
389
|
-
"aria-live": "polite",
|
|
390
|
-
style: {
|
|
391
|
-
position: "absolute",
|
|
392
|
-
left: "-10000px",
|
|
393
|
-
width: "1px",
|
|
394
|
-
height: "1px",
|
|
395
|
-
overflow: "hidden"
|
|
396
|
-
}
|
|
397
|
-
}, m), /* @__PURE__ */ s.createElement(Fe, {
|
|
398
|
-
value: n,
|
|
399
|
-
onChange: d,
|
|
400
|
-
isDisabled: i,
|
|
401
|
-
"aria-labelledby": l,
|
|
402
|
-
"aria-controls": c,
|
|
403
|
-
"data-hook": Ze.SIGNATURE_FIELD_MODE_SELECT,
|
|
404
|
-
className: t
|
|
405
|
-
}, u[b.DRAW], u[b.TYPE], u[b.UPLOAD]));
|
|
406
|
-
}, mt = (e) => /* @__PURE__ */ Re(e), ne = ({ mode: e, children: t, className: a, "aria-label": n }) => /* @__PURE__ */ s.createElement(Ne, {
|
|
407
|
-
value: e,
|
|
408
|
-
"aria-label": n
|
|
409
|
-
}, /* @__PURE__ */ s.createElement(Pe, {
|
|
410
|
-
"data-hook": `signature-mode-${e}`,
|
|
411
|
-
className: a
|
|
412
|
-
}, t)), pt = (e) => /* @__PURE__ */ s.createElement(ne, {
|
|
413
|
-
...e,
|
|
414
|
-
mode: b.DRAW
|
|
415
|
-
}), ft = (e) => /* @__PURE__ */ s.createElement(ne, {
|
|
416
|
-
...e,
|
|
417
|
-
mode: b.TYPE
|
|
418
|
-
}), ht = (e) => /* @__PURE__ */ s.createElement(ne, {
|
|
419
|
-
...e,
|
|
420
|
-
mode: b.UPLOAD
|
|
421
|
-
}), gt = ({ children: e, className: t, "aria-label": a, ...n }) => {
|
|
422
|
-
const { handleClear: r } = n, { disabled: o, target: i } = A(), { inputId: l } = H();
|
|
423
|
-
return /* @__PURE__ */ s.createElement(fe, {
|
|
424
|
-
onPress: r,
|
|
425
|
-
isDisabled: o,
|
|
426
|
-
"aria-label": a,
|
|
427
|
-
"aria-controls": l,
|
|
428
|
-
"data-hook": `clear-${i}`,
|
|
429
|
-
className: t
|
|
430
|
-
}, e);
|
|
431
|
-
}, N = ({ children: e, className: t, ...a }) => {
|
|
432
|
-
const { signatureView: n, signatureValueForView: r, handleChange: o, handleBeforeChange: i } = a, { disabled: l, readOnly: c, onBlur: d, onFocus: u, hasError: f } = A(), m = I(e, N.Canvas), h = I(e, N.Type), E = I(e, N.Upload);
|
|
433
|
-
return /* @__PURE__ */ s.createElement("div", {
|
|
434
|
-
className: t,
|
|
435
|
-
"data-hook": "signature-input",
|
|
436
|
-
"data-invalid": f,
|
|
437
|
-
"data-disabled": l,
|
|
438
|
-
"data-readonly": c
|
|
439
|
-
}, n === x.DRAW && F(m, {
|
|
440
|
-
value: r,
|
|
441
|
-
onChange: o,
|
|
442
|
-
onBeforeChange: i,
|
|
443
|
-
disabled: l,
|
|
444
|
-
readOnly: c,
|
|
445
|
-
onBlur: d,
|
|
446
|
-
onFocus: u
|
|
447
|
-
}), n === x.TYPE && F(h, {
|
|
448
|
-
value: r,
|
|
449
|
-
onChange: o,
|
|
450
|
-
onBeforeChange: i,
|
|
451
|
-
disabled: l,
|
|
452
|
-
readOnly: c,
|
|
453
|
-
onBlur: d,
|
|
454
|
-
onFocus: u
|
|
455
|
-
}), (n === x.UPLOAD || n === x.IMAGE) && F(E, {
|
|
456
|
-
value: r,
|
|
457
|
-
onChange: o,
|
|
458
|
-
onBeforeChange: i,
|
|
459
|
-
disabled: l,
|
|
460
|
-
readOnly: c,
|
|
461
|
-
onBlur: d,
|
|
462
|
-
onFocus: u
|
|
463
|
-
}));
|
|
464
|
-
}, Et = ({ className: e, emptyLabel: t, signedLabel: a, ...n }) => {
|
|
465
|
-
const { value: r, onChange: o, onBeforeChange: i, disabled: l, readOnly: c, onBlur: d, onFocus: u } = n, { id: f } = A(), { inputId: m, ariaDescribedBy: h } = H(), E = te(), p = W(), L = W(), y = W(null), S = r == null ? void 0 : r.url, [U, Y] = K(!1);
|
|
466
|
-
Ee(() => {
|
|
467
|
-
var D;
|
|
468
|
-
(D = L.current) == null || D.focus();
|
|
469
|
-
}, f);
|
|
470
|
-
const w = De(() => ({
|
|
471
|
-
throttle: 0,
|
|
472
|
-
dotSize: 2,
|
|
473
|
-
minWidth: 1,
|
|
474
|
-
maxWidth: 3,
|
|
475
|
-
velocityFilterWeight: 0.2
|
|
476
|
-
}), []), oe = C(() => {
|
|
477
|
-
var O, k, $;
|
|
478
|
-
if ((O = p.current) != null && O.isEmpty())
|
|
479
|
-
return "";
|
|
480
|
-
const D = (k = p.current) == null ? void 0 : k.toData();
|
|
481
|
-
return D ? et(D) : (($ = p.current) == null ? void 0 : $.toDataURL()) ?? "";
|
|
482
|
-
}, []), q = C(() => {
|
|
483
|
-
var O;
|
|
484
|
-
const D = (O = p.current) == null ? void 0 : O.isEmpty();
|
|
485
|
-
Y(!D), o(ee(oe()));
|
|
486
|
-
}, [
|
|
487
|
-
oe,
|
|
488
|
-
o
|
|
489
|
-
]), j = C(() => {
|
|
490
|
-
i == null || i();
|
|
491
|
-
}, [
|
|
492
|
-
i
|
|
493
|
-
]), Ce = C((D) => {
|
|
494
|
-
var k, $, se, ie;
|
|
495
|
-
if (D != null) {
|
|
496
|
-
if (L.current = D, p.current = new he(D, {
|
|
497
|
-
...w,
|
|
498
|
-
penColor: getComputedStyle(D).color || void 0
|
|
499
|
-
}), me(L.current, p.current), S) {
|
|
500
|
-
const le = Le(S);
|
|
501
|
-
le && (p.current.fromData(le), Y(!0));
|
|
502
|
-
} else
|
|
503
|
-
p.current.clear(), Y(!1);
|
|
504
|
-
p.current.addEventListener("beginStroke", j), p.current.addEventListener("endStroke", q), typeof ResizeObserver < "u" && !y.current && (y.current = new ResizeObserver(() => {
|
|
505
|
-
L.current && me(L.current, p == null ? void 0 : p.current);
|
|
506
|
-
})), (k = y.current) == null || k.observe(D);
|
|
507
|
-
} else
|
|
508
|
-
($ = y.current) == null || $.disconnect(), (se = p.current) == null || se.removeEventListener("endStroke", q), (ie = p.current) == null || ie.removeEventListener("beginStroke", j);
|
|
509
|
-
}, [
|
|
510
|
-
w,
|
|
511
|
-
S,
|
|
512
|
-
j,
|
|
513
|
-
q
|
|
514
|
-
]);
|
|
515
|
-
return Q(() => {
|
|
516
|
-
p.current && (c || l ? p.current.off() : p.current.on());
|
|
517
|
-
}, [
|
|
518
|
-
l,
|
|
519
|
-
c
|
|
520
|
-
]), /* @__PURE__ */ s.createElement("div", {
|
|
521
|
-
className: e,
|
|
522
|
-
...E
|
|
523
|
-
}, /* @__PURE__ */ s.createElement("canvas", {
|
|
524
|
-
ref: Ce,
|
|
525
|
-
id: m,
|
|
526
|
-
"data-hook": "signature-canvas",
|
|
527
|
-
"data-input-id": m,
|
|
528
|
-
"data-has-value": !!S,
|
|
529
|
-
onFocus: u,
|
|
530
|
-
onBlur: d,
|
|
531
|
-
role: "img",
|
|
532
|
-
"aria-label": U ? a : t,
|
|
533
|
-
"aria-describedby": h
|
|
534
|
-
}));
|
|
535
|
-
}, ae = ({ children: e, className: t, ...a }) => {
|
|
536
|
-
const { value: n, onChange: r, onBeforeChange: o, disabled: i, readOnly: l, onBlur: c, onFocus: d } = a, { id: u, required: f, hasError: m } = A(), { inputId: h, ariaDescribedBy: E, labelId: p } = H(), L = te(), y = n != null && n.url ? P(n.url) : void 0, { data: S = "" } = y ?? {
|
|
537
|
-
data: ""
|
|
538
|
-
};
|
|
539
|
-
Ee(() => {
|
|
540
|
-
const w = document.getElementById(h);
|
|
541
|
-
w == null || w.focus({
|
|
542
|
-
preventScroll: !0
|
|
543
|
-
});
|
|
544
|
-
}, u), Q(() => {
|
|
545
|
-
if (!n) {
|
|
546
|
-
const w = document.getElementById(h);
|
|
547
|
-
w && (w.value = "");
|
|
548
|
-
}
|
|
549
|
-
}, [
|
|
550
|
-
n,
|
|
551
|
-
h
|
|
552
|
-
]);
|
|
553
|
-
const U = C((w) => {
|
|
554
|
-
o == null || o(), w.trim() ? r(ee(Te({
|
|
555
|
-
data: w,
|
|
556
|
-
mimeType: R.TEXT
|
|
557
|
-
}))) : r(null);
|
|
558
|
-
}, [
|
|
559
|
-
o,
|
|
560
|
-
r
|
|
561
|
-
]), Y = I(e, ae.Value);
|
|
562
|
-
return /* @__PURE__ */ s.createElement(Ae, {
|
|
563
|
-
"aria-labelledby": p,
|
|
564
|
-
value: S,
|
|
565
|
-
onChange: U,
|
|
566
|
-
onBlur: c,
|
|
567
|
-
onFocus: d,
|
|
568
|
-
isDisabled: i,
|
|
569
|
-
isReadOnly: l,
|
|
570
|
-
isRequired: f,
|
|
571
|
-
isInvalid: m,
|
|
572
|
-
validationBehavior: "aria"
|
|
573
|
-
}, /* @__PURE__ */ s.createElement("div", {
|
|
574
|
-
className: t,
|
|
575
|
-
...L
|
|
576
|
-
}, F(Y, {
|
|
577
|
-
inputId: h,
|
|
578
|
-
ariaDescribedBy: E
|
|
579
|
-
})));
|
|
580
|
-
}, Lt = ({ className: e, placeholder: t, ...a }) => {
|
|
581
|
-
const { inputId: n, ariaDescribedBy: r } = a;
|
|
582
|
-
return /* @__PURE__ */ s.createElement(_e, {
|
|
583
|
-
id: n,
|
|
584
|
-
"data-hook": "signature-text",
|
|
585
|
-
"aria-describedby": r,
|
|
586
|
-
placeholder: t,
|
|
587
|
-
className: e
|
|
588
|
-
});
|
|
589
|
-
}, bt = {
|
|
590
|
-
display: "none"
|
|
591
|
-
}, re = ({ children: e, className: t, imageAlt: a, ...n }) => {
|
|
592
|
-
const { value: r, onChange: o, disabled: i, readOnly: l, onBlur: c, onFocus: d } = n, { inputId: u } = H(), f = te(), m = I(e, re.Button), h = W(null), E = C((L) => {
|
|
593
|
-
const y = L.target.files;
|
|
594
|
-
if (!y || y.length === 0) {
|
|
595
|
-
o(null);
|
|
596
|
-
return;
|
|
597
|
-
}
|
|
598
|
-
const S = y[0], U = new FileReader();
|
|
599
|
-
U.onload = function() {
|
|
600
|
-
o(ee(this.result, S.name));
|
|
601
|
-
}, U.readAsDataURL(S);
|
|
602
|
-
}, [
|
|
603
|
-
o
|
|
604
|
-
]), p = r && dt(r);
|
|
605
|
-
return /* @__PURE__ */ s.createElement("div", {
|
|
606
|
-
className: t,
|
|
607
|
-
"data-has-value": p || void 0,
|
|
608
|
-
...f
|
|
609
|
-
}, /* @__PURE__ */ s.createElement("input", {
|
|
610
|
-
ref: h,
|
|
611
|
-
type: "file",
|
|
612
|
-
accept: "image/*",
|
|
613
|
-
onChange: E,
|
|
614
|
-
disabled: i || l,
|
|
615
|
-
style: bt,
|
|
616
|
-
"aria-hidden": "true",
|
|
617
|
-
tabIndex: -1
|
|
618
|
-
}), !p && F(m, {
|
|
619
|
-
fileInputRef: h,
|
|
620
|
-
disabled: i,
|
|
621
|
-
readOnly: l,
|
|
622
|
-
onBlur: c,
|
|
623
|
-
onFocus: d
|
|
624
|
-
}), p && (r.url ? /* @__PURE__ */ s.createElement("img", {
|
|
625
|
-
id: u,
|
|
626
|
-
src: r.url,
|
|
627
|
-
alt: r.displayName || a,
|
|
628
|
-
"data-hook": "signature-image"
|
|
629
|
-
}) : /* @__PURE__ */ s.createElement("span", {
|
|
630
|
-
id: u,
|
|
631
|
-
"data-hook": "signature-image"
|
|
632
|
-
}, r.displayName || a)));
|
|
633
|
-
}, yt = ({ children: e, className: t, ...a }) => {
|
|
634
|
-
const { fileInputRef: n, disabled: r, readOnly: o, onBlur: i, onFocus: l } = a, { inputId: c, ariaDescribedBy: d, labelId: u } = H(), f = Ge(), m = C(() => {
|
|
635
|
-
var h;
|
|
636
|
-
(h = n.current) == null || h.click();
|
|
637
|
-
}, [
|
|
638
|
-
n
|
|
639
|
-
]);
|
|
640
|
-
return /* @__PURE__ */ s.createElement(fe, {
|
|
641
|
-
id: c,
|
|
642
|
-
onPress: m,
|
|
643
|
-
onBlur: i,
|
|
644
|
-
onFocus: l,
|
|
645
|
-
isDisabled: r || o,
|
|
646
|
-
"aria-labelledby": `${u} ${f}`,
|
|
647
|
-
"aria-describedby": d,
|
|
648
|
-
"data-hook": "signature-upload",
|
|
649
|
-
className: t
|
|
650
|
-
}, /* @__PURE__ */ s.createElement("span", {
|
|
651
|
-
id: f
|
|
652
|
-
}, e));
|
|
653
|
-
};
|
|
654
|
-
g.Label = ze;
|
|
655
|
-
g.Input = Z;
|
|
656
|
-
g.Description = $e;
|
|
657
|
-
g.Error = Ve;
|
|
658
|
-
Z.Header = X;
|
|
659
|
-
Z.Value = N;
|
|
660
|
-
X.Tabs = _;
|
|
661
|
-
X.Clear = gt;
|
|
662
|
-
_.Draw = pt;
|
|
663
|
-
_.Type = ft;
|
|
664
|
-
_.Upload = ht;
|
|
665
|
-
N.Canvas = Et;
|
|
666
|
-
N.Type = ae;
|
|
667
|
-
N.Upload = re;
|
|
668
|
-
ae.Value = Lt;
|
|
669
|
-
re.Button = yt;
|
|
670
|
-
const It = () => {
|
|
671
|
-
const { t: e } = Me();
|
|
672
|
-
return {
|
|
673
|
-
drawLabel: e("field.signature.mode.draw.label"),
|
|
674
|
-
typeLabel: e("field.signature.mode.type.label"),
|
|
675
|
-
uploadModeLabel: e("field.signature.mode.upload.label"),
|
|
676
|
-
drawDescription: e("field.signature.mode.draw.description"),
|
|
677
|
-
typeDescription: e("field.signature.mode.type.description"),
|
|
678
|
-
uploadDescription: e("field.signature.mode.upload.description"),
|
|
679
|
-
clearLabel: e("field.signature.clear-button.label"),
|
|
680
|
-
emptyLabel: e("field.signature.canvas.aria-label.empty"),
|
|
681
|
-
signedLabel: e("field.signature.canvas.aria-label.signed"),
|
|
682
|
-
placeholder: e("field.signature.text.placeholder"),
|
|
683
|
-
imageAlt: e("field.signature.a11y.state.signed"),
|
|
684
|
-
uploadLabel: e("field.signature.settings.upload-button.label")
|
|
685
|
-
};
|
|
686
|
-
}, Tt = (e) => /* @__PURE__ */ s.createElement("svg", {
|
|
687
|
-
viewBox: "0 0 24 24",
|
|
688
|
-
width: 24,
|
|
689
|
-
height: 24,
|
|
690
|
-
fill: "currentColor",
|
|
691
|
-
"aria-hidden": "true",
|
|
692
|
-
...e
|
|
693
|
-
}, /* @__PURE__ */ s.createElement("path", {
|
|
694
|
-
fillRule: "evenodd",
|
|
695
|
-
d: "M13.5,3 C14.327,3 15,3.673 15,4.5 L15,4.5 L15,5 L19,5 L19,6 L18,6 L18,17.5 C18,18.879 16.878,20 15.5,20 L15.5,20 L7.5,20 C6.122,20 5,18.879 5,17.5 L5,17.5 L5,6 L4,6 L4,5 L8,5 L8,4.5 C8,3.673 8.673,3 9.5,3 L9.5,3 Z M17,6 L6,6 L6,17.5 C6,18.327 6.673,19 7.5,19 L7.5,19 L15.5,19 C16.327,19 17,18.327 17,17.5 L17,17.5 L17,6 Z M10,9 L10,16 L9,16 L9,9 L10,9 Z M14,9 L14,16 L13,16 L13,9 L14,9 Z M13.5,4 L9.5,4 C9.224,4 9,4.225 9,4.5 L9,4.5 L9,5 L14,5 L14,4.5 C14,4.225 13.776,4 13.5,4 L13.5,4 Z"
|
|
696
|
-
})), Ct = (e) => /* @__PURE__ */ s.createElement("svg", {
|
|
697
|
-
viewBox: "0 0 24 24",
|
|
698
|
-
width: 24,
|
|
699
|
-
height: 24,
|
|
700
|
-
fill: "currentColor",
|
|
701
|
-
"aria-hidden": "true",
|
|
702
|
-
...e
|
|
703
|
-
}, /* @__PURE__ */ s.createElement("path", {
|
|
704
|
-
fillRule: "evenodd",
|
|
705
|
-
d: "M4.9937,15.9971 L4.9937,18.4971 C4.9937,18.7721 5.2177,18.9971 5.4937,18.9971 L5.4937,18.9971 L17.4937,18.9971 C17.7697,18.9971 17.9937,18.7721 17.9937,18.4971 L17.9937,18.4971 L17.9937,15.9971 L18.9937,15.9971 L18.9937,18.4971 C18.9937,19.3241 18.3207,19.9971 17.4937,19.9971 L17.4937,19.9971 L5.4937,19.9971 C4.6657,19.9971 3.9937,19.3241 3.9937,18.4971 L3.9937,18.4971 L3.9937,15.9971 L4.9937,15.9971 Z M11.9933,4 L11.9933,14.078 L15.0293,11.043 L15.7363,11.75 L11.4933,15.992 L7.2513,11.75 L7.9583,11.043 L10.9933,14.078 L10.9933,4 L11.9933,4 Z"
|
|
706
|
-
})), Dt = (e) => /* @__PURE__ */ s.createElement("svg", {
|
|
707
|
-
viewBox: "0 0 24 24",
|
|
708
|
-
width: 24,
|
|
709
|
-
height: 24,
|
|
710
|
-
fill: "currentColor",
|
|
711
|
-
"aria-hidden": "true",
|
|
712
|
-
...e
|
|
713
|
-
}, /* @__PURE__ */ s.createElement("path", {
|
|
714
|
-
fillRule: "evenodd",
|
|
715
|
-
d: "M18.8525,7.543 L17.7515,8.644 L15.3565,6.248 L16.4575,5.147 C16.5555,5.05 16.6835,5.001 16.8105,5.001 C16.9385,5.001 17.0665,5.05 17.1645,5.147 L18.8525,6.835 C19.0475,7.03 19.0475,7.348 18.8525,7.543 L18.8525,7.543 Z M8.1895,18.206 C8.1185,18.276 8.0275,18.324 7.9295,18.344 L5.1275,18.873 L5.6575,16.07 C5.6755,15.972 5.7225,15.882 5.7945,15.811 L14.6495,6.955 L17.0445,9.351 L8.1895,18.206 Z M19.5595,6.128 L17.8715,4.44 C17.2865,3.856 16.3355,3.856 15.7505,4.44 L5.0875,15.103 C4.8735,15.317 4.7295,15.588 4.6745,15.886 L4.0085,19.407 C3.9775,19.569 4.0295,19.736 4.1465,19.854 C4.2415,19.948 4.3685,20 4.4995,20 C4.5305,20 4.5615,19.997 4.5925,19.991 L8.1165,19.326 C8.4145,19.269 8.6855,19.125 8.8965,18.912 L19.5595,8.25 C20.1445,7.665 20.1445,6.713 19.5595,6.128 L19.5595,6.128 Z"
|
|
716
|
-
})), Rt = (e) => /* @__PURE__ */ s.createElement("svg", {
|
|
717
|
-
viewBox: "0 0 20 20",
|
|
718
|
-
width: 24,
|
|
719
|
-
height: 24,
|
|
720
|
-
fill: "currentColor",
|
|
721
|
-
"aria-hidden": "true",
|
|
722
|
-
...e
|
|
723
|
-
}, /* @__PURE__ */ s.createElement("path", {
|
|
724
|
-
fillRule: "evenodd",
|
|
725
|
-
d: "M12,4 L12,5 L8,5 L8,16 L7,16 L7,5 L3,5 L3,4 L12,4 Z M18,8 L18,9 L15,9 L15,16 L14,16 L14,9 L11,9 L11,8 L18,8 Z"
|
|
726
|
-
})), wt = "_header_15ti0_1", vt = "_tabs_15ti0_8", St = "_tab_15ti0_8", xt = "_tabIcon_15ti0_74", Ft = "_clear_15ti0_81", At = "_value_15ti0_113", _t = "_box_15ti0_118", Nt = "_uploadBox_15ti0_119", Pt = "_typeInput_15ti0_230", T = {
|
|
727
|
-
header: wt,
|
|
728
|
-
tabs: vt,
|
|
729
|
-
tab: St,
|
|
730
|
-
tabIcon: xt,
|
|
731
|
-
clear: Ft,
|
|
732
|
-
value: At,
|
|
733
|
-
box: _t,
|
|
734
|
-
uploadBox: Nt,
|
|
735
|
-
typeInput: Pt
|
|
736
|
-
}, Ut = ({ content: e, locale: t }) => /* @__PURE__ */ s.createElement(we, {
|
|
737
|
-
content: e,
|
|
738
|
-
locale: t
|
|
739
|
-
}), Ot = () => {
|
|
740
|
-
const e = It();
|
|
741
|
-
return /* @__PURE__ */ s.createElement(g, null, /* @__PURE__ */ s.createElement(g.Label, {
|
|
742
|
-
className: v(ue, V.label)
|
|
743
|
-
}, /* @__PURE__ */ s.createElement(g.Label.Required, {
|
|
744
|
-
className: v(We, V.requiredMark)
|
|
745
|
-
})), /* @__PURE__ */ s.createElement(g.Input, null, /* @__PURE__ */ s.createElement(g.Input.Header, {
|
|
746
|
-
className: T.header
|
|
747
|
-
}, /* @__PURE__ */ s.createElement(g.Input.Header.Tabs, {
|
|
748
|
-
className: T.tabs
|
|
749
|
-
}, /* @__PURE__ */ s.createElement(g.Input.Header.Tabs.Draw, {
|
|
750
|
-
className: v(B, T.tab),
|
|
751
|
-
"aria-label": e.drawLabel,
|
|
752
|
-
description: e.drawDescription
|
|
753
|
-
}, /* @__PURE__ */ s.createElement(Dt, {
|
|
754
|
-
className: T.tabIcon
|
|
755
|
-
})), /* @__PURE__ */ s.createElement(g.Input.Header.Tabs.Type, {
|
|
756
|
-
className: v(B, T.tab),
|
|
757
|
-
"aria-label": e.typeLabel,
|
|
758
|
-
description: e.typeDescription
|
|
759
|
-
}, /* @__PURE__ */ s.createElement(Rt, {
|
|
760
|
-
className: T.tabIcon
|
|
761
|
-
})), /* @__PURE__ */ s.createElement(g.Input.Header.Tabs.Upload, {
|
|
762
|
-
className: v(B, T.tab),
|
|
763
|
-
"aria-label": e.uploadModeLabel,
|
|
764
|
-
description: e.uploadDescription
|
|
765
|
-
}, /* @__PURE__ */ s.createElement(Ct, {
|
|
766
|
-
className: T.tabIcon
|
|
767
|
-
}))), /* @__PURE__ */ s.createElement(g.Input.Header.Clear, {
|
|
768
|
-
className: v(ue, T.clear),
|
|
769
|
-
"aria-label": e.clearLabel
|
|
770
|
-
}, /* @__PURE__ */ s.createElement(Tt, null))), /* @__PURE__ */ s.createElement(g.Input.Value, {
|
|
771
|
-
className: T.value
|
|
772
|
-
}, /* @__PURE__ */ s.createElement(g.Input.Value.Canvas, {
|
|
773
|
-
className: v(B, T.box),
|
|
774
|
-
emptyLabel: e.emptyLabel,
|
|
775
|
-
signedLabel: e.signedLabel
|
|
776
|
-
}), /* @__PURE__ */ s.createElement(g.Input.Value.Type, {
|
|
777
|
-
className: v(B, T.box)
|
|
778
|
-
}, /* @__PURE__ */ s.createElement(g.Input.Value.Type.Value, {
|
|
779
|
-
className: T.typeInput,
|
|
780
|
-
placeholder: e.placeholder
|
|
781
|
-
})), /* @__PURE__ */ s.createElement(g.Input.Value.Upload, {
|
|
782
|
-
className: v(B, T.uploadBox),
|
|
783
|
-
imageAlt: e.imageAlt
|
|
784
|
-
}, /* @__PURE__ */ s.createElement(g.Input.Value.Upload.Button, {
|
|
785
|
-
className: v(He, V.uploadButton)
|
|
786
|
-
}, e.uploadLabel)))), /* @__PURE__ */ s.createElement(g.Error, {
|
|
787
|
-
className: v(Ye, V.error)
|
|
788
|
-
}, /* @__PURE__ */ s.createElement(Xe, null), /* @__PURE__ */ s.createElement(g.Error.Text, null)), /* @__PURE__ */ s.createElement(g.Description, {
|
|
789
|
-
className: v(ke, V.description)
|
|
790
|
-
}, Ut));
|
|
791
|
-
}, jt = () => /* @__PURE__ */ s.createElement(Ot, null);
|
|
792
|
-
export {
|
|
793
|
-
jt as SignatureRAC
|
|
794
|
-
};
|