@wix/form-elements 0.0.0-stage → 1.54.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/LICENSE +21 -0
- package/README.md +118 -2
- package/dist/component/appointment-rac-DlOqbFoi.js +1005 -0
- package/dist/component/bookings-address-rac-CvK-P3df.js +6 -0
- package/dist/component/bookings-email-rac-9BEPTuox.js +6 -0
- package/dist/component/bookings-first-name-rac-BrU-BtPp.js +6 -0
- package/dist/component/bookings-header-rac-8NCL7fxp.js +8 -0
- package/dist/component/bookings-last-name-rac-DgLqZ1nS.js +6 -0
- package/dist/component/bookings-login-bar-rac-C2pzRMyt.js +74 -0
- package/dist/component/bookings-phone-rac-BrPBAo8B.js +6 -0
- package/dist/component/bookings-rich-text-rac-qpPsyIuc.js +8 -0
- package/dist/component/calling-country-codes-PyWuOTmF.js +243 -0
- package/dist/component/checkbox-field-rac-CaloY2Hs.js +625 -0
- package/dist/component/checkbox-group-field-headless-4HlJmarB.js +204 -0
- package/dist/component/checkbox-group-field-rac-B1tFZT3o.js +33 -0
- package/dist/component/checkbox-group-rac-C0SzN2Bx.js +6 -0
- package/dist/component/checkbox-rac-ssJIVvZI.js +6 -0
- package/dist/component/chevron-down-icon-CcpVm6B-.js +15 -0
- package/dist/component/contacts-address-rac-Dwf4yrGq.js +6 -0
- package/dist/component/contacts-birthdate-rac-C195rG5w.js +6 -0
- package/dist/component/contacts-company-rac-BHX6xZU8.js +6 -0
- package/dist/component/contacts-email-rac-CFY-m-r2.js +6 -0
- package/dist/component/contacts-first-name-rac-D23QFUGK.js +6 -0
- package/dist/component/contacts-last-name-rac-COuQB15p.js +6 -0
- package/dist/component/contacts-phone-rac-BfhY_I7p.js +6 -0
- package/dist/component/contacts-position-rac-D80_knc8.js +6 -0
- package/dist/component/contacts-subscribe-rac--NuPoBFm.js +13 -0
- package/dist/component/contacts-tax-id-rac-BURE313k.js +6 -0
- package/dist/component/custom-focus-class-_483Pkwp.js +4 -0
- package/dist/component/data-hooks-Dkw1pbRj.js +6 -0
- package/dist/component/date-availability-BQyNH-7j.js +49 -0
- package/dist/component/date-input-field-rac-BnFvhqe1.js +286 -0
- package/dist/component/date-input-rac-TLkITFRh.js +6 -0
- package/dist/component/date-picker-field-rac-BAFKYE1B.js +304 -0
- package/dist/component/date-picker-rac-uBJQkALE.js +6 -0
- package/dist/component/date-time-input-field-rac-DnOkBj7w.js +421 -0
- package/dist/component/date-time-input-rac-BxbWyK23.js +6 -0
- package/dist/component/default-limits-D7qVv_Hv.js +6 -0
- package/dist/component/dext-checkbox-group-rac-DnifcsEZ.js +18 -0
- package/dist/component/dext-checkbox-rac-D45Ok0J4.js +6 -0
- package/dist/component/dext-date-picker-rac-Cs47jywn.js +6 -0
- package/dist/component/dext-date-time-input-rac-UPwXpk2g.js +6 -0
- package/dist/component/dext-dropdown-rac-D18mhUDU.js +6 -0
- package/dist/component/dext-email-rac-B4frwTvA.js +6 -0
- package/dist/component/dext-number-input-rac-CoS-Fk59.js +6 -0
- package/dist/component/dext-phone-rac-DwR0JLia.js +6 -0
- package/dist/component/dext-radio-group-rac-DogWvoUg.js +18 -0
- package/dist/component/dext-rating-input-rac-C4NxeIto.js +6 -0
- package/dist/component/dext-tags-rac-DsEenrft.js +18 -0
- package/dist/component/dext-text-area-rac-Du-FqTqW.js +6 -0
- package/dist/component/dext-text-input-rac-DUE8JE9b.js +6 -0
- package/dist/component/dext-url-input-rac-Cn55pV9m.js +6 -0
- package/dist/component/donation-rac-Cjk_hFm1.js +305 -0
- package/dist/component/dropdown-field-headless-Dcy46MWj.js +84 -0
- package/dist/component/dropdown-field-rac-rMMPzKxL.js +32 -0
- package/dist/component/dropdown-rac-C6B8C8Yc.js +6 -0
- package/dist/component/ecom-address-rac-1wNixzip.js +6 -0
- package/dist/component/ecom-subscription-checkbox-rac-C5z68KHa.js +49 -0
- package/dist/component/email-input-field-rac-C7Wn2XVU.js +507 -0
- package/dist/component/error-icon-hZxQ6DEy.js +15 -0
- package/dist/component/events-repeater-rac-DTv4JD79.js +247 -0
- package/dist/component/events-rsvp-rac-cS7Mb04F.js +38 -0
- package/dist/component/field-error-headless-Dm5UCOBb.js +34 -0
- package/dist/component/field-label-headless-C7mDzdLq.js +52 -0
- package/dist/component/field-rac.module-DAPTqFDM.js +21 -0
- package/dist/component/fieldset-headless-CD3fds9J.js +54 -0
- package/dist/component/file-upload-rac-DeZvh7dy.js +484 -0
- package/dist/component/find-child-C60k4CxG.js +11 -0
- package/dist/component/fixed-payment-rac-D7t5DjVp.js +62 -0
- package/dist/component/form-DaOKiR16.js +8890 -0
- package/dist/component/form-element-classes-Bi-nNM8q.js +55 -0
- package/dist/component/form.css +1 -0
- package/dist/component/form.js +9 -0
- package/dist/component/format-currency-BwShJ9vM.js +44 -0
- package/dist/component/get-first-day-of-the-week-DvnsxYhQ.js +118 -0
- package/dist/component/header-field-rac-hJSXllPm.js +25 -0
- package/dist/component/header-rac-G_lsddOd.js +6 -0
- package/dist/component/headless-styles-CmcyA_pi.js +20 -0
- package/dist/component/helpers-HmkkXrh2.js +12 -0
- package/dist/component/image-choice-rac-BHyAKRDt.js +141 -0
- package/dist/component/index-CFW1VXFU.js +64 -0
- package/dist/component/index-CkCSQD3_.js +2290 -0
- package/dist/component/isObject-BAwJJxQ3.js +34 -0
- package/dist/component/messages_ar-BZXnU2Gj.js +3517 -0
- package/dist/component/messages_ar-L1BYLZbF.js +20 -0
- package/dist/component/messages_ar-PAHg01OB.js +299 -0
- package/dist/component/messages_bg-CO56qlOt.js +299 -0
- package/dist/component/messages_bg-CQcGl0Yi.js +20 -0
- package/dist/component/messages_bg-DgbMwIbv.js +3515 -0
- package/dist/component/messages_ca-BAHE5nuo.js +3515 -0
- package/dist/component/messages_ca-BRoHmzRw.js +20 -0
- package/dist/component/messages_ca-Bl6rZi_O.js +299 -0
- package/dist/component/messages_cs-BADd3t_h.js +3515 -0
- package/dist/component/messages_cs-CDyWDExk.js +298 -0
- package/dist/component/messages_cs-wn5UmrBw.js +20 -0
- package/dist/component/messages_da-BPnmb9Qb.js +20 -0
- package/dist/component/messages_da-BvVUWnBz.js +3515 -0
- package/dist/component/messages_da-DHlpaT4q.js +298 -0
- package/dist/component/messages_de-2czOmM8X.js +3515 -0
- package/dist/component/messages_de-BKgzIF1d.js +298 -0
- package/dist/component/messages_de-Bwx84N0O.js +20 -0
- package/dist/component/messages_el-BnuYMjcf.js +299 -0
- package/dist/component/messages_el-_D2RUBSU.js +20 -0
- package/dist/component/messages_el-qCyH12Uq.js +3515 -0
- package/dist/component/messages_en-BWaixPd6.js +3518 -0
- package/dist/component/messages_en-CBBcgtxs.js +296 -0
- package/dist/component/messages_en-DvSLxqKp.js +20 -0
- package/dist/component/messages_es-Cq6i2xci.js +3515 -0
- package/dist/component/messages_es-DlGCLaYi.js +298 -0
- package/dist/component/messages_es-rCKXnGf0.js +20 -0
- package/dist/component/messages_fi-B-ciZGqD.js +3515 -0
- package/dist/component/messages_fi-DzKva_Wq.js +299 -0
- package/dist/component/messages_fi-PCCXPo0O.js +20 -0
- package/dist/component/messages_fr-2im0dcYp.js +3515 -0
- package/dist/component/messages_fr-DMFilq1G.js +298 -0
- package/dist/component/messages_fr-DQa1dT9u.js +20 -0
- package/dist/component/messages_he-Bb1qTc2Y.js +299 -0
- package/dist/component/messages_he-BfIkDo1h.js +3515 -0
- package/dist/component/messages_he-DwIysfDp.js +20 -0
- package/dist/component/messages_hi-Bty6ytCh.js +3515 -0
- package/dist/component/messages_hi-C-6UHGbM.js +298 -0
- package/dist/component/messages_hi-DF1w6b6B.js +20 -0
- package/dist/component/messages_hr-BXzIzU3d.js +20 -0
- package/dist/component/messages_hr-CiU1ZVrx.js +3515 -0
- package/dist/component/messages_hr-tRSM9lmc.js +299 -0
- package/dist/component/messages_hu-ChzHFUtB.js +3515 -0
- package/dist/component/messages_hu-D86Taf9R.js +299 -0
- package/dist/component/messages_hu-Z9XpByCO.js +20 -0
- package/dist/component/messages_id-3952ilBE.js +20 -0
- package/dist/component/messages_id-CPuhTUYV.js +298 -0
- package/dist/component/messages_id-Ddr3ijST.js +3515 -0
- package/dist/component/messages_it-B-A1X4BZ.js +298 -0
- package/dist/component/messages_it-DnUTUabT.js +20 -0
- package/dist/component/messages_it-eY6GnuZC.js +3515 -0
- package/dist/component/messages_ja-B3PxHv2c.js +3515 -0
- package/dist/component/messages_ja-Ced6ZBxD.js +298 -0
- package/dist/component/messages_ja-Cg7CqBUL.js +20 -0
- package/dist/component/messages_ko-DBCjHG4c.js +3515 -0
- package/dist/component/messages_ko-PKIrqwPk.js +298 -0
- package/dist/component/messages_ko-zvhtZMGA.js +20 -0
- package/dist/component/messages_lt-DV3hdFsp.js +3515 -0
- package/dist/component/messages_lt-DywusvNm.js +20 -0
- package/dist/component/messages_lt-zxcCPHno.js +299 -0
- package/dist/component/messages_lv-BEowUv-S.js +299 -0
- package/dist/component/messages_lv-DggJE2f9.js +20 -0
- package/dist/component/messages_lv-hIonzpTs.js +3515 -0
- package/dist/component/messages_ms-Ca0m7bf7.js +20 -0
- package/dist/component/messages_ms-Cvypo0vi.js +299 -0
- package/dist/component/messages_ms-DoMzA8a3.js +3515 -0
- package/dist/component/messages_nl-CEmANR_r.js +3515 -0
- package/dist/component/messages_nl-CZR4TvNo.js +298 -0
- package/dist/component/messages_nl-DgVYmdO9.js +20 -0
- package/dist/component/messages_no-B2BBaGBH.js +298 -0
- package/dist/component/messages_no-DJfJSlDm.js +3515 -0
- package/dist/component/messages_no-hPkfRJQ9.js +20 -0
- package/dist/component/messages_pl-Bzph-WyD.js +20 -0
- package/dist/component/messages_pl-ChJVH7RO.js +3515 -0
- package/dist/component/messages_pl-rCMsbMbN.js +298 -0
- package/dist/component/messages_pt-Bv63V1uB.js +3515 -0
- package/dist/component/messages_pt-CBgCNF3T.js +20 -0
- package/dist/component/messages_pt-Cx0FF6uF.js +298 -0
- package/dist/component/messages_ro-BvLoD_wE.js +299 -0
- package/dist/component/messages_ro-CMzcu-9b.js +20 -0
- package/dist/component/messages_ro-PVRK7Gx4.js +3515 -0
- package/dist/component/messages_ru-8BI6MYA0.js +3515 -0
- package/dist/component/messages_ru-BhRKVmVC.js +298 -0
- package/dist/component/messages_ru-C_BaQo57.js +20 -0
- package/dist/component/messages_sk-Bgi_3583.js +3515 -0
- package/dist/component/messages_sk-CrsC7rOj.js +20 -0
- package/dist/component/messages_sk-CtF-ei23.js +299 -0
- package/dist/component/messages_sl-B5t-KKi8.js +299 -0
- package/dist/component/messages_sl-BFdYWVHd.js +3515 -0
- package/dist/component/messages_sl-NqfmyUP1.js +20 -0
- package/dist/component/messages_sv-Bd1CcY6G.js +3515 -0
- package/dist/component/messages_sv-DPRT-DpN.js +20 -0
- package/dist/component/messages_sv-bQwbNmjr.js +298 -0
- package/dist/component/messages_th-BauH9qdo.js +20 -0
- package/dist/component/messages_th-C_dL_PCq.js +298 -0
- package/dist/component/messages_th-DEWm01uD.js +3515 -0
- package/dist/component/messages_tl-CouXLNcW.js +299 -0
- package/dist/component/messages_tl-D2t9Y_ZC.js +3515 -0
- package/dist/component/messages_tl-UDZY8Wuk.js +20 -0
- package/dist/component/messages_tr-2-OHesob.js +3515 -0
- package/dist/component/messages_tr-CpsxYTDb.js +20 -0
- package/dist/component/messages_tr-DHXnlj_j.js +298 -0
- package/dist/component/messages_uk-CPK4y5lH.js +298 -0
- package/dist/component/messages_uk-DIuQ2HoD.js +3515 -0
- package/dist/component/messages_uk-gPkmA_ar.js +20 -0
- package/dist/component/messages_vi-CgxB4Ey0.js +20 -0
- package/dist/component/messages_vi-DZeFWgwp.js +3515 -0
- package/dist/component/messages_vi-Det8i7_V.js +298 -0
- package/dist/component/messages_zh-D53_A4N9.js +298 -0
- package/dist/component/messages_zh-O552w5dp.js +20 -0
- package/dist/component/messages_zh-nG7LNxIt.js +3515 -0
- package/dist/component/multiline-address-field-rac-CwLOzNF6.js +1574 -0
- package/dist/component/multiline-address-rac-C4JXBlFC.js +6 -0
- package/dist/component/non-modal-popover-DtIMXHbe.js +63 -0
- package/dist/component/number-input-field-rac-BOeiugCV.js +89 -0
- package/dist/component/number-input-rac-NqbFwW0d.js +6 -0
- package/dist/component/numeric-input-utils-CuBMi4-a.js +45 -0
- package/dist/component/options-layout-constants-DEfIEJWD.js +6 -0
- package/dist/component/options-rac.module-KM-VT_KY.js +7 -0
- package/dist/component/password-rac-DxCYgvu_.js +142 -0
- package/dist/component/payment-field-utils-DobiK5Xh.js +12 -0
- package/dist/component/payment-input-rac-C2aof0p0.js +137 -0
- package/dist/component/phone-input-field-rac-Cd7RFaoD.js +473 -0
- package/dist/component/phone-rac-4MQREqBG.js +6 -0
- package/dist/component/product-list-rac-CjoepDQ_.js +263 -0
- package/dist/component/quiz-radio-group-rac-CIwk7N3X.js +13 -0
- package/dist/component/radio-group-field-rac-DE2mnUHD.js +40 -0
- package/dist/component/radio-group-field-rac.module-DEP9BCiX.js +124 -0
- package/dist/component/radio-group-rac-XE6CeGnp.js +6 -0
- package/dist/component/rating-input-field-rac-BzAAMipp.js +130 -0
- package/dist/component/rating-input-rac-oIvpEVjK.js +6 -0
- package/dist/component/rich-content-rac.module-cis7mx3M.js +49 -0
- package/dist/component/rich-text-field-rac-CqkM22CI.js +22 -0
- package/dist/component/rich-text-rac-BKbz3TcX.js +6 -0
- package/dist/component/ricos-viewer-chunk-B4rfbgjA.js +5 -0
- package/dist/component/service-dropdown-rac-CfCMbT9d.js +142 -0
- package/dist/component/services-multi-choice-rac-F2h5gUOr.js +76 -0
- package/dist/component/signature-rac-CIRsmZhS.js +795 -0
- package/dist/component/submit-button-rac-BELGrClx.js +115 -0
- package/dist/component/tags-field-rac-B6Hg2XOI.js +201 -0
- package/dist/component/tags-rac-Dfv8VP7J.js +6 -0
- package/dist/component/text-area-field-rac-Bsd1V2Q3.js +69 -0
- package/dist/component/text-area-rac-BNVdI-Gq.js +6 -0
- package/dist/component/text-input-field-rac-DF9dD_KW.js +24 -0
- package/dist/component/text-input-headless-Dlao2R8f.js +44 -0
- package/dist/component/text-input-rac-C2p7E01b.js +6 -0
- package/dist/component/time-input-rac-90mLBZsX.js +152 -0
- package/dist/component/url-input-field-rac-bCEOlctr.js +71 -0
- package/dist/component/url-input-rac-D5o8b9gx.js +6 -0
- package/dist/component/use-invoke-callback-UH73A_J3.js +15 -0
- package/dist/component/use-service-options-base-DO5hy6mn.js +48 -0
- package/dist/component/use-synced-display-value-DcAxdn3M.js +19 -0
- package/dist/form.d.ts +6930 -0
- package/package.json +164 -3
|
@@ -0,0 +1,795 @@
|
|
|
1
|
+
import s, { useRef as W, useCallback as I, useState as K, useEffect as Q, useMemo as De, isValidElement as we } from "react";
|
|
2
|
+
import { RicosViewer as Re } from "@wix/ricos/viewer";
|
|
3
|
+
import v from "classnames";
|
|
4
|
+
import { useHover as ve, useFocusRing as xe, mergeProps as Se } from "react-aria";
|
|
5
|
+
import { RadioGroup as Fe, Button as fe, TextField as Ae, Input as _e, RadioField as Pe, RadioButton as Ne } from "react-aria-components";
|
|
6
|
+
import he from "signature_pad";
|
|
7
|
+
import { y as Ue, ac as Oe, aa as Be, ao as ge, E as ce, e as q, ag as A, ad as H, ai as Ee, aq as Me } from "./form-DaOKiR16.js";
|
|
8
|
+
import { f as T, a as F } from "./find-child-C60k4CxG.js";
|
|
9
|
+
import { D as We, E as He } from "./field-error-headless-Dm5UCOBb.js";
|
|
10
|
+
import { L as Ye } from "./field-label-headless-C7mDzdLq.js";
|
|
11
|
+
import { D as ke } from "./data-hooks-Dkw1pbRj.js";
|
|
12
|
+
import { E as $e } from "./error-icon-hZxQ6DEy.js";
|
|
13
|
+
import { s as V } from "./field-rac.module-DAPTqFDM.js";
|
|
14
|
+
import { r as ue, H as Ve, q as B, V as ze, l as Ze, h as Xe } from "./form-element-classes-Bi-nNM8q.js";
|
|
15
|
+
const qe = typeof s.useId == "function" ? s.useId : () => W(Ue()).current;
|
|
16
|
+
var w = /* @__PURE__ */ (function(e) {
|
|
17
|
+
return e.TEXT = "text/plain", e.POINTS = "points/json", e;
|
|
18
|
+
})({}), b = /* @__PURE__ */ (function(e) {
|
|
19
|
+
return e.DRAW = "draw", e.TYPE = "type", e.UPLOAD = "upload", e;
|
|
20
|
+
})({}), S = /* @__PURE__ */ (function(e) {
|
|
21
|
+
return e.DRAW = "draw", e.TYPE = "type", e.IMAGE = "image", e.UPLOAD = "upload", e;
|
|
22
|
+
})({});
|
|
23
|
+
const Ge = (e) => {
|
|
24
|
+
const { actions: t, formId: a } = Oe(), n = t == null ? void 0 : t.uploadFile;
|
|
25
|
+
return I(async (r) => {
|
|
26
|
+
if (!n)
|
|
27
|
+
throw new Error("No uploadFile action");
|
|
28
|
+
const o = await n({
|
|
29
|
+
file: r,
|
|
30
|
+
formId: a,
|
|
31
|
+
uploadTarget: e
|
|
32
|
+
}), { id: i, displayName: l, url: c, isPrivate: d } = o;
|
|
33
|
+
return {
|
|
34
|
+
fileId: i,
|
|
35
|
+
displayName: l || r.name,
|
|
36
|
+
url: d ? void 0 : c,
|
|
37
|
+
fileType: r.type
|
|
38
|
+
};
|
|
39
|
+
}, [
|
|
40
|
+
n,
|
|
41
|
+
a,
|
|
42
|
+
e
|
|
43
|
+
]);
|
|
44
|
+
};
|
|
45
|
+
function je(e) {
|
|
46
|
+
const a = z(1, 1).getContext("2d");
|
|
47
|
+
a.fillStyle = e, a.fillRect(0, 0, 1, 1);
|
|
48
|
+
const n = a.getImageData(0, 0, 1, 1);
|
|
49
|
+
return n.data[0] * 65536 + n.data[1] * 256 + n.data[2];
|
|
50
|
+
}
|
|
51
|
+
const Je = (e, t) => {
|
|
52
|
+
const a = je(e);
|
|
53
|
+
return (n, r) => {
|
|
54
|
+
const o = (r * t.width + n) * 4;
|
|
55
|
+
return t.data[o] * 65536 + t.data[o + 1] * 256 + t.data[o + 2] === a;
|
|
56
|
+
};
|
|
57
|
+
}, Ke = (e) => (t, a) => {
|
|
58
|
+
const n = (a * e.width + t) * 4;
|
|
59
|
+
return e.data[n + 3] === 0;
|
|
60
|
+
};
|
|
61
|
+
function J(e, t) {
|
|
62
|
+
const a = e.getContext("2d", {
|
|
63
|
+
willReadFrequently: !0
|
|
64
|
+
}), n = e.width, r = e.height, o = a.getImageData(0, 0, n, r), i = t ? Je(t, o) : Ke(o);
|
|
65
|
+
let l = n + 1, c = -1, d = r + 1, u = -1, f = 0, m = 0;
|
|
66
|
+
for (m = 0; m < r; m++)
|
|
67
|
+
for (f = 0; f < n; f++)
|
|
68
|
+
i(f, m) || (l > f && (l = f), c < f && (c = f), d > m && (d = m), u < m && (u = m));
|
|
69
|
+
const h = c - l, E = u - d;
|
|
70
|
+
if (h < 0 || E < 0)
|
|
71
|
+
return null;
|
|
72
|
+
const p = a.getImageData(l, d, h, E), L = document.createElement("canvas"), y = L.getContext("2d");
|
|
73
|
+
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;
|
|
74
|
+
}
|
|
75
|
+
function z(e, t, a) {
|
|
76
|
+
const n = document.createElement("canvas");
|
|
77
|
+
if (n.width = e, n.height = t, a) {
|
|
78
|
+
const r = n.getContext("2d", {
|
|
79
|
+
willReadFrequently: !0
|
|
80
|
+
});
|
|
81
|
+
r == null || r.scale(a, a);
|
|
82
|
+
}
|
|
83
|
+
return n;
|
|
84
|
+
}
|
|
85
|
+
function Qe(e, t) {
|
|
86
|
+
return new Promise((a, n) => {
|
|
87
|
+
const r = new Image();
|
|
88
|
+
r.onload = () => {
|
|
89
|
+
const o = z(r.width, r.height), i = o.getContext("2d", {
|
|
90
|
+
willReadFrequently: !0
|
|
91
|
+
});
|
|
92
|
+
i == null || i.drawImage(r, 0, 0), a(o);
|
|
93
|
+
}, r.onerror = n, r.src = e;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function de(e, t, a, n) {
|
|
97
|
+
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");
|
|
98
|
+
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;
|
|
99
|
+
}
|
|
100
|
+
function me(e, t) {
|
|
101
|
+
const a = e.getContext("2d"), n = e.offsetWidth, r = e.offsetHeight, o = Math.max(window.devicePixelRatio || 1, 1), i = n * o, l = r * o;
|
|
102
|
+
return (e.width !== i || e.height !== l) && a ? (e.width = i, e.height = l, a.scale(o, o), t == null || t.redraw(), !0) : !1;
|
|
103
|
+
}
|
|
104
|
+
const M = 480, et = (e) => Ce({
|
|
105
|
+
data: JSON.stringify(e),
|
|
106
|
+
mimeType: w.POINTS
|
|
107
|
+
}), Le = (e) => {
|
|
108
|
+
const t = N(e);
|
|
109
|
+
if ((t == null ? void 0 : t.mimeType) === w.POINTS)
|
|
110
|
+
try {
|
|
111
|
+
return JSON.parse(t.data);
|
|
112
|
+
} catch {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
}, pe = 0.8, be = "Madefor";
|
|
117
|
+
function ye(e, t) {
|
|
118
|
+
const { width: a, actualBoundingBoxAscent: n, actualBoundingBoxDescent: r } = t.measureText(e);
|
|
119
|
+
return {
|
|
120
|
+
width: a,
|
|
121
|
+
height: n + r,
|
|
122
|
+
offsetY: n
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function tt(e, t) {
|
|
126
|
+
const a = t.getContext("2d"), n = t.offsetWidth || t.width, o = (t.offsetHeight || t.height) * pe, i = n * pe;
|
|
127
|
+
a.font = `${o}px ${be}`;
|
|
128
|
+
const { width: l, height: c } = ye(e, a), d = o / (l / i), u = o / (c / o);
|
|
129
|
+
return Math.min(d, u);
|
|
130
|
+
}
|
|
131
|
+
function nt(e, t, a = "black", n = !1, r) {
|
|
132
|
+
const o = e.getContext("2d"), i = tt(t, e);
|
|
133
|
+
o.font = `${i}px ${be}`, o.textBaseline = "top";
|
|
134
|
+
const l = e.offsetWidth || e.width, c = e.offsetHeight || e.height, { width: d, height: u, offsetY: f } = ye(t, o);
|
|
135
|
+
o.fillStyle = r, o.fillRect(0, 0, l, c), o.fillStyle = a;
|
|
136
|
+
const m = (l - d) / 2;
|
|
137
|
+
o.fillText(t, n ? l - m : m, (c - u) / 2 + f);
|
|
138
|
+
}
|
|
139
|
+
const Te = /^data:([^;,]+)(?:;([^,]+))?,(.+)$/;
|
|
140
|
+
function at(e) {
|
|
141
|
+
return Te.test(e);
|
|
142
|
+
}
|
|
143
|
+
function N(e) {
|
|
144
|
+
if (!e)
|
|
145
|
+
return;
|
|
146
|
+
const t = e.match(Te);
|
|
147
|
+
if (!t)
|
|
148
|
+
return;
|
|
149
|
+
const [, a, n, r] = t;
|
|
150
|
+
return {
|
|
151
|
+
data: n === "base64" ? atob(r) : decodeURI(r),
|
|
152
|
+
mimeType: a,
|
|
153
|
+
encoding: n
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function Ce({ data: e, mimeType: t, encoding: a = "text" }) {
|
|
157
|
+
const n = a === "base64" ? btoa(e) : encodeURI(e);
|
|
158
|
+
return `data:${a === "base64" ? `${t};base64` : t},${n}`;
|
|
159
|
+
}
|
|
160
|
+
function rt(e, t) {
|
|
161
|
+
const a = N(e);
|
|
162
|
+
if (!a)
|
|
163
|
+
return;
|
|
164
|
+
let n = a.data.length;
|
|
165
|
+
const r = new Uint8Array(n);
|
|
166
|
+
for (; n--; )
|
|
167
|
+
r[n] = a.data.charCodeAt(n);
|
|
168
|
+
const o = a.mimeType.split("/")[1] ?? "txt";
|
|
169
|
+
return new File([
|
|
170
|
+
r
|
|
171
|
+
], `${t}.${o}`, {
|
|
172
|
+
type: a.mimeType
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function ee(e, t = "temp") {
|
|
176
|
+
const a = N(e);
|
|
177
|
+
return {
|
|
178
|
+
fileId: "temp",
|
|
179
|
+
displayName: t,
|
|
180
|
+
url: e,
|
|
181
|
+
fileType: (a == null ? void 0 : a.mimeType) ?? ""
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
async function ot(e, t) {
|
|
185
|
+
const a = N(e);
|
|
186
|
+
if (!a)
|
|
187
|
+
return e;
|
|
188
|
+
const n = a.mimeType;
|
|
189
|
+
if (n === w.TEXT) {
|
|
190
|
+
const r = z(M * 20, M, 1);
|
|
191
|
+
nt(r, a.data, "black", t, "white");
|
|
192
|
+
const o = J(r, "white");
|
|
193
|
+
return (o == null ? void 0 : o.toDataURL("image/jpeg", 0.7)) ?? null;
|
|
194
|
+
}
|
|
195
|
+
if (n === w.POINTS) {
|
|
196
|
+
const r = Le(e);
|
|
197
|
+
if (!r)
|
|
198
|
+
return null;
|
|
199
|
+
const o = r.map((u) => ({
|
|
200
|
+
...u,
|
|
201
|
+
penColor: "black"
|
|
202
|
+
})), i = z(M * 20, M, Math.max(window.devicePixelRatio || 1, 1));
|
|
203
|
+
new he(i).fromData(o);
|
|
204
|
+
const c = J(i);
|
|
205
|
+
return c ? de(c, void 0, M, "white").toDataURL("image/jpeg", 0.7) : null;
|
|
206
|
+
}
|
|
207
|
+
if (n != null && n.startsWith("image/")) {
|
|
208
|
+
const r = await Qe(e), o = J(r);
|
|
209
|
+
return o ? de(o, void 0, M).toDataURL("image/jpeg", 0.7) : null;
|
|
210
|
+
}
|
|
211
|
+
return e;
|
|
212
|
+
}
|
|
213
|
+
async function st(e, t) {
|
|
214
|
+
const a = await ot(e, t);
|
|
215
|
+
if (a)
|
|
216
|
+
return rt(a, "signature");
|
|
217
|
+
}
|
|
218
|
+
const it = ({ value: e, onChange: t, target: a }) => {
|
|
219
|
+
const [n, r] = K(e), { isRTL: o } = Be(), i = Ge(a), { setFormStatus: l } = ge(), c = W();
|
|
220
|
+
Q(() => {
|
|
221
|
+
e === ce && r(ce);
|
|
222
|
+
}, [
|
|
223
|
+
e
|
|
224
|
+
]);
|
|
225
|
+
const d = I(() => {
|
|
226
|
+
c.current && (clearTimeout(c.current), c.current = null);
|
|
227
|
+
}, []), u = n == null ? void 0 : n[0], f = u != null && u.url ? N(u.url) : void 0, m = I(async (E) => {
|
|
228
|
+
try {
|
|
229
|
+
const p = (E == null ? void 0 : E.url) ?? "";
|
|
230
|
+
if (at(p)) {
|
|
231
|
+
const L = await st(p, o);
|
|
232
|
+
if (L) {
|
|
233
|
+
const y = await i(L);
|
|
234
|
+
t([
|
|
235
|
+
y
|
|
236
|
+
]);
|
|
237
|
+
} else
|
|
238
|
+
r(void 0), t(void 0);
|
|
239
|
+
}
|
|
240
|
+
c.current = null;
|
|
241
|
+
} finally {
|
|
242
|
+
l(a, q.READY);
|
|
243
|
+
}
|
|
244
|
+
}, [
|
|
245
|
+
l,
|
|
246
|
+
a,
|
|
247
|
+
o,
|
|
248
|
+
i,
|
|
249
|
+
t
|
|
250
|
+
]);
|
|
251
|
+
return {
|
|
252
|
+
handleChange: I((E) => {
|
|
253
|
+
const p = (L) => {
|
|
254
|
+
c.current = setTimeout(() => m(L), 1500);
|
|
255
|
+
};
|
|
256
|
+
E ? (c.current && (clearTimeout(c.current), c.current = null), r([
|
|
257
|
+
E
|
|
258
|
+
]), p(E)) : (t == null || t(null), r(void 0), l(a, q.READY));
|
|
259
|
+
}, [
|
|
260
|
+
m,
|
|
261
|
+
t,
|
|
262
|
+
l,
|
|
263
|
+
a
|
|
264
|
+
]),
|
|
265
|
+
signature: u,
|
|
266
|
+
decodedValue: f,
|
|
267
|
+
cancelUpload: d
|
|
268
|
+
};
|
|
269
|
+
}, lt = ({ target: e, value: t, onChange: a }) => {
|
|
270
|
+
const { handleChange: n, cancelUpload: r, signature: o, decodedValue: i } = it({
|
|
271
|
+
value: t,
|
|
272
|
+
onChange: a,
|
|
273
|
+
target: e
|
|
274
|
+
}), [l, c] = K(() => {
|
|
275
|
+
if (o == null)
|
|
276
|
+
return b.DRAW;
|
|
277
|
+
switch (i == null ? void 0 : i.mimeType) {
|
|
278
|
+
case w.POINTS:
|
|
279
|
+
return b.DRAW;
|
|
280
|
+
case w.TEXT:
|
|
281
|
+
return b.TYPE;
|
|
282
|
+
default:
|
|
283
|
+
return b.UPLOAD;
|
|
284
|
+
}
|
|
285
|
+
}), { setFormStatus: d } = ge(), u = I(() => {
|
|
286
|
+
r(), d(e, q.BUSY);
|
|
287
|
+
}, [
|
|
288
|
+
r,
|
|
289
|
+
d,
|
|
290
|
+
e
|
|
291
|
+
]), f = I(() => {
|
|
292
|
+
r(), n(null), d(e, q.READY);
|
|
293
|
+
}, [
|
|
294
|
+
r,
|
|
295
|
+
n,
|
|
296
|
+
d,
|
|
297
|
+
e
|
|
298
|
+
]), m = o != null, h = ut(l, o, i), E = (() => {
|
|
299
|
+
switch (l) {
|
|
300
|
+
case b.DRAW:
|
|
301
|
+
return S.DRAW;
|
|
302
|
+
case b.TYPE:
|
|
303
|
+
return S.TYPE;
|
|
304
|
+
case b.UPLOAD:
|
|
305
|
+
return h != null ? S.IMAGE : S.UPLOAD;
|
|
306
|
+
default:
|
|
307
|
+
return S.DRAW;
|
|
308
|
+
}
|
|
309
|
+
})();
|
|
310
|
+
return {
|
|
311
|
+
signature: o,
|
|
312
|
+
decodedValue: i,
|
|
313
|
+
signatureMode: l,
|
|
314
|
+
clearable: m,
|
|
315
|
+
signatureValueForView: h,
|
|
316
|
+
signatureView: E,
|
|
317
|
+
handleChange: n,
|
|
318
|
+
setSignatureMode: c,
|
|
319
|
+
handleBeforeChange: u,
|
|
320
|
+
handleClear: f
|
|
321
|
+
};
|
|
322
|
+
}, ct = {
|
|
323
|
+
[b.DRAW]: (e) => (e == null ? void 0 : e.mimeType) === w.POINTS,
|
|
324
|
+
[b.TYPE]: (e) => (e == null ? void 0 : e.mimeType) === w.TEXT,
|
|
325
|
+
[b.UPLOAD]: (e) => (e == null ? void 0 : e.mimeType) !== w.POINTS && (e == null ? void 0 : e.mimeType) !== w.TEXT
|
|
326
|
+
};
|
|
327
|
+
function ut(e, t, a) {
|
|
328
|
+
return t && ct[e](a) ? t : void 0;
|
|
329
|
+
}
|
|
330
|
+
const dt = (e) => {
|
|
331
|
+
const t = e.url ? N(e.url) : void 0;
|
|
332
|
+
return t ? t.mimeType !== w.POINTS && t.mimeType !== w.TEXT : !0;
|
|
333
|
+
}, te = () => {
|
|
334
|
+
const { hoverProps: e, isHovered: t } = ve({}), { focusProps: a, isFocused: n, isFocusVisible: r } = xe({
|
|
335
|
+
within: !0
|
|
336
|
+
});
|
|
337
|
+
return {
|
|
338
|
+
...Se(e, a),
|
|
339
|
+
"data-hovered": t || void 0,
|
|
340
|
+
"data-focus-within": n || void 0,
|
|
341
|
+
"data-focus-visible": r || void 0
|
|
342
|
+
};
|
|
343
|
+
}, g = ({ children: e }) => {
|
|
344
|
+
const { id: t, FieldLayout: a } = A(), n = T(e, g.Label), r = T(e, g.Input), o = T(e, g.Description), i = T(e, g.Error);
|
|
345
|
+
return /* @__PURE__ */ s.createElement(a, {
|
|
346
|
+
fieldId: t,
|
|
347
|
+
renderLabel: () => n,
|
|
348
|
+
renderInput: () => r,
|
|
349
|
+
renderDescription: () => /* @__PURE__ */ s.createElement(s.Fragment, null, i, o)
|
|
350
|
+
});
|
|
351
|
+
}, Z = ({ children: e }) => {
|
|
352
|
+
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({
|
|
353
|
+
target: n,
|
|
354
|
+
value: t,
|
|
355
|
+
onChange: a
|
|
356
|
+
}), h = T(e, Z.Header), E = T(e, Z.Value), p = {
|
|
357
|
+
signatureMode: o,
|
|
358
|
+
setSignatureMode: i,
|
|
359
|
+
handleClear: l,
|
|
360
|
+
clearable: c,
|
|
361
|
+
signatureView: d,
|
|
362
|
+
signatureValueForView: u,
|
|
363
|
+
handleChange: f,
|
|
364
|
+
handleBeforeChange: m
|
|
365
|
+
};
|
|
366
|
+
return /* @__PURE__ */ s.createElement(s.Fragment, null, !r && F(h, p), F(E, p));
|
|
367
|
+
}, X = ({ children: e, className: t, ...a }) => {
|
|
368
|
+
const { signatureMode: n, setSignatureMode: r, clearable: o, handleClear: i } = a, { uploadEnabled: l } = A(), c = T(e, X.Tabs), d = T(e, X.Clear);
|
|
369
|
+
return /* @__PURE__ */ s.createElement("div", {
|
|
370
|
+
className: t
|
|
371
|
+
}, F(c, {
|
|
372
|
+
signatureMode: n,
|
|
373
|
+
setSignatureMode: r,
|
|
374
|
+
uploadEnabled: l
|
|
375
|
+
}), o && F(d, {
|
|
376
|
+
handleClear: i
|
|
377
|
+
}));
|
|
378
|
+
}, _ = ({ children: e, className: t, ...a }) => {
|
|
379
|
+
const { signatureMode: n, setSignatureMode: r, uploadEnabled: o } = a, { disabled: i } = A(), { labelId: l, inputId: c } = H(), d = I((h) => {
|
|
380
|
+
r(h);
|
|
381
|
+
}, [
|
|
382
|
+
r
|
|
383
|
+
]), u = {
|
|
384
|
+
[b.DRAW]: T(e, _.Draw),
|
|
385
|
+
[b.TYPE]: T(e, _.Type),
|
|
386
|
+
[b.UPLOAD]: o ? T(e, _.Upload) : null
|
|
387
|
+
}, f = u[n], m = mt(f) ? f.props.description : void 0;
|
|
388
|
+
return /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("div", {
|
|
389
|
+
role: "status",
|
|
390
|
+
"aria-live": "polite",
|
|
391
|
+
style: {
|
|
392
|
+
position: "absolute",
|
|
393
|
+
left: "-10000px",
|
|
394
|
+
width: "1px",
|
|
395
|
+
height: "1px",
|
|
396
|
+
overflow: "hidden"
|
|
397
|
+
}
|
|
398
|
+
}, m), /* @__PURE__ */ s.createElement(Fe, {
|
|
399
|
+
value: n,
|
|
400
|
+
onChange: d,
|
|
401
|
+
isDisabled: i,
|
|
402
|
+
"aria-labelledby": l,
|
|
403
|
+
"aria-controls": c,
|
|
404
|
+
"data-hook": ke.SIGNATURE_FIELD_MODE_SELECT,
|
|
405
|
+
className: t
|
|
406
|
+
}, u[b.DRAW], u[b.TYPE], u[b.UPLOAD]));
|
|
407
|
+
}, mt = (e) => /* @__PURE__ */ we(e), ne = ({ mode: e, children: t, className: a, "aria-label": n }) => /* @__PURE__ */ s.createElement(Pe, {
|
|
408
|
+
value: e,
|
|
409
|
+
"aria-label": n
|
|
410
|
+
}, /* @__PURE__ */ s.createElement(Ne, {
|
|
411
|
+
"data-hook": `signature-mode-${e}`,
|
|
412
|
+
className: a
|
|
413
|
+
}, t)), pt = (e) => /* @__PURE__ */ s.createElement(ne, {
|
|
414
|
+
...e,
|
|
415
|
+
mode: b.DRAW
|
|
416
|
+
}), ft = (e) => /* @__PURE__ */ s.createElement(ne, {
|
|
417
|
+
...e,
|
|
418
|
+
mode: b.TYPE
|
|
419
|
+
}), ht = (e) => /* @__PURE__ */ s.createElement(ne, {
|
|
420
|
+
...e,
|
|
421
|
+
mode: b.UPLOAD
|
|
422
|
+
}), gt = ({ children: e, className: t, "aria-label": a, ...n }) => {
|
|
423
|
+
const { handleClear: r } = n, { disabled: o, target: i } = A(), { inputId: l } = H();
|
|
424
|
+
return /* @__PURE__ */ s.createElement(fe, {
|
|
425
|
+
onPress: r,
|
|
426
|
+
isDisabled: o,
|
|
427
|
+
"aria-label": a,
|
|
428
|
+
"aria-controls": l,
|
|
429
|
+
"data-hook": `clear-${i}`,
|
|
430
|
+
className: t
|
|
431
|
+
}, e);
|
|
432
|
+
}, P = ({ children: e, className: t, ...a }) => {
|
|
433
|
+
const { signatureView: n, signatureValueForView: r, handleChange: o, handleBeforeChange: i } = a, { disabled: l, readOnly: c, onBlur: d, onFocus: u, hasError: f } = A(), m = T(e, P.Canvas), h = T(e, P.Type), E = T(e, P.Upload);
|
|
434
|
+
return /* @__PURE__ */ s.createElement("div", {
|
|
435
|
+
className: t,
|
|
436
|
+
"data-hook": "signature-input",
|
|
437
|
+
"data-invalid": f,
|
|
438
|
+
"data-disabled": l,
|
|
439
|
+
"data-readonly": c
|
|
440
|
+
}, n === S.DRAW && F(m, {
|
|
441
|
+
value: r,
|
|
442
|
+
onChange: o,
|
|
443
|
+
onBeforeChange: i,
|
|
444
|
+
disabled: l,
|
|
445
|
+
readOnly: c,
|
|
446
|
+
onBlur: d,
|
|
447
|
+
onFocus: u
|
|
448
|
+
}), n === S.TYPE && F(h, {
|
|
449
|
+
value: r,
|
|
450
|
+
onChange: o,
|
|
451
|
+
onBeforeChange: i,
|
|
452
|
+
disabled: l,
|
|
453
|
+
readOnly: c,
|
|
454
|
+
onBlur: d,
|
|
455
|
+
onFocus: u
|
|
456
|
+
}), (n === S.UPLOAD || n === S.IMAGE) && F(E, {
|
|
457
|
+
value: r,
|
|
458
|
+
onChange: o,
|
|
459
|
+
onBeforeChange: i,
|
|
460
|
+
disabled: l,
|
|
461
|
+
readOnly: c,
|
|
462
|
+
onBlur: d,
|
|
463
|
+
onFocus: u
|
|
464
|
+
}));
|
|
465
|
+
}, Et = ({ className: e, emptyLabel: t, signedLabel: a, ...n }) => {
|
|
466
|
+
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), x = r == null ? void 0 : r.url, [U, Y] = K(!1);
|
|
467
|
+
Ee(() => {
|
|
468
|
+
var D;
|
|
469
|
+
(D = L.current) == null || D.focus();
|
|
470
|
+
}, f);
|
|
471
|
+
const R = De(() => ({
|
|
472
|
+
throttle: 0,
|
|
473
|
+
dotSize: 2,
|
|
474
|
+
minWidth: 1,
|
|
475
|
+
maxWidth: 3,
|
|
476
|
+
velocityFilterWeight: 0.2
|
|
477
|
+
}), []), oe = I(() => {
|
|
478
|
+
var O, k, $;
|
|
479
|
+
if ((O = p.current) != null && O.isEmpty())
|
|
480
|
+
return "";
|
|
481
|
+
const D = (k = p.current) == null ? void 0 : k.toData();
|
|
482
|
+
return D ? et(D) : (($ = p.current) == null ? void 0 : $.toDataURL()) ?? "";
|
|
483
|
+
}, []), G = I(() => {
|
|
484
|
+
var O;
|
|
485
|
+
const D = (O = p.current) == null ? void 0 : O.isEmpty();
|
|
486
|
+
Y(!D), o(ee(oe()));
|
|
487
|
+
}, [
|
|
488
|
+
oe,
|
|
489
|
+
o
|
|
490
|
+
]), j = I(() => {
|
|
491
|
+
i == null || i();
|
|
492
|
+
}, [
|
|
493
|
+
i
|
|
494
|
+
]), Ie = I((D) => {
|
|
495
|
+
var k, $, se, ie;
|
|
496
|
+
if (D != null) {
|
|
497
|
+
if (L.current = D, p.current = new he(D, {
|
|
498
|
+
...R,
|
|
499
|
+
penColor: getComputedStyle(D).color || void 0
|
|
500
|
+
}), me(L.current, p.current), x) {
|
|
501
|
+
const le = Le(x);
|
|
502
|
+
le && (p.current.fromData(le), Y(!0));
|
|
503
|
+
} else
|
|
504
|
+
p.current.clear(), Y(!1);
|
|
505
|
+
p.current.addEventListener("beginStroke", j), p.current.addEventListener("endStroke", G), typeof ResizeObserver < "u" && !y.current && (y.current = new ResizeObserver(() => {
|
|
506
|
+
L.current && me(L.current, p == null ? void 0 : p.current);
|
|
507
|
+
})), (k = y.current) == null || k.observe(D);
|
|
508
|
+
} else
|
|
509
|
+
($ = y.current) == null || $.disconnect(), (se = p.current) == null || se.removeEventListener("endStroke", G), (ie = p.current) == null || ie.removeEventListener("beginStroke", j);
|
|
510
|
+
}, [
|
|
511
|
+
R,
|
|
512
|
+
x,
|
|
513
|
+
j,
|
|
514
|
+
G
|
|
515
|
+
]);
|
|
516
|
+
return Q(() => {
|
|
517
|
+
p.current && (c || l ? p.current.off() : p.current.on());
|
|
518
|
+
}, [
|
|
519
|
+
l,
|
|
520
|
+
c
|
|
521
|
+
]), /* @__PURE__ */ s.createElement("div", {
|
|
522
|
+
className: e,
|
|
523
|
+
...E
|
|
524
|
+
}, /* @__PURE__ */ s.createElement("canvas", {
|
|
525
|
+
ref: Ie,
|
|
526
|
+
id: m,
|
|
527
|
+
"data-hook": "signature-canvas",
|
|
528
|
+
"data-input-id": m,
|
|
529
|
+
"data-has-value": !!x,
|
|
530
|
+
onFocus: u,
|
|
531
|
+
onBlur: d,
|
|
532
|
+
role: "img",
|
|
533
|
+
"aria-label": U ? a : t,
|
|
534
|
+
"aria-describedby": h
|
|
535
|
+
}));
|
|
536
|
+
}, ae = ({ children: e, className: t, ...a }) => {
|
|
537
|
+
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 ? N(n.url) : void 0, { data: x = "" } = y ?? {
|
|
538
|
+
data: ""
|
|
539
|
+
};
|
|
540
|
+
Ee(() => {
|
|
541
|
+
const R = document.getElementById(h);
|
|
542
|
+
R == null || R.focus({
|
|
543
|
+
preventScroll: !0
|
|
544
|
+
});
|
|
545
|
+
}, u), Q(() => {
|
|
546
|
+
if (!n) {
|
|
547
|
+
const R = document.getElementById(h);
|
|
548
|
+
R && (R.value = "");
|
|
549
|
+
}
|
|
550
|
+
}, [
|
|
551
|
+
n,
|
|
552
|
+
h
|
|
553
|
+
]);
|
|
554
|
+
const U = I((R) => {
|
|
555
|
+
o == null || o(), R.trim() ? r(ee(Ce({
|
|
556
|
+
data: R,
|
|
557
|
+
mimeType: w.TEXT
|
|
558
|
+
}))) : r(null);
|
|
559
|
+
}, [
|
|
560
|
+
o,
|
|
561
|
+
r
|
|
562
|
+
]), Y = T(e, ae.Value);
|
|
563
|
+
return /* @__PURE__ */ s.createElement(Ae, {
|
|
564
|
+
"aria-labelledby": p,
|
|
565
|
+
value: x,
|
|
566
|
+
onChange: U,
|
|
567
|
+
onBlur: c,
|
|
568
|
+
onFocus: d,
|
|
569
|
+
isDisabled: i,
|
|
570
|
+
isReadOnly: l,
|
|
571
|
+
isRequired: f,
|
|
572
|
+
isInvalid: m,
|
|
573
|
+
validationBehavior: "aria"
|
|
574
|
+
}, /* @__PURE__ */ s.createElement("div", {
|
|
575
|
+
className: t,
|
|
576
|
+
...L
|
|
577
|
+
}, F(Y, {
|
|
578
|
+
inputId: h,
|
|
579
|
+
ariaDescribedBy: E
|
|
580
|
+
})));
|
|
581
|
+
}, Lt = ({ className: e, placeholder: t, ...a }) => {
|
|
582
|
+
const { inputId: n, ariaDescribedBy: r } = a;
|
|
583
|
+
return /* @__PURE__ */ s.createElement(_e, {
|
|
584
|
+
id: n,
|
|
585
|
+
"data-hook": "signature-text",
|
|
586
|
+
"aria-describedby": r,
|
|
587
|
+
placeholder: t,
|
|
588
|
+
className: e
|
|
589
|
+
});
|
|
590
|
+
}, bt = {
|
|
591
|
+
display: "none"
|
|
592
|
+
}, re = ({ children: e, className: t, imageAlt: a, ...n }) => {
|
|
593
|
+
const { value: r, onChange: o, disabled: i, readOnly: l, onBlur: c, onFocus: d } = n, { inputId: u } = H(), f = te(), m = T(e, re.Button), h = W(null), E = I((L) => {
|
|
594
|
+
const y = L.target.files;
|
|
595
|
+
if (!y || y.length === 0) {
|
|
596
|
+
o(null);
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
const x = y[0], U = new FileReader();
|
|
600
|
+
U.onload = function() {
|
|
601
|
+
o(ee(this.result, x.name));
|
|
602
|
+
}, U.readAsDataURL(x);
|
|
603
|
+
}, [
|
|
604
|
+
o
|
|
605
|
+
]), p = r && dt(r);
|
|
606
|
+
return /* @__PURE__ */ s.createElement("div", {
|
|
607
|
+
className: t,
|
|
608
|
+
"data-has-value": p || void 0,
|
|
609
|
+
...f
|
|
610
|
+
}, /* @__PURE__ */ s.createElement("input", {
|
|
611
|
+
ref: h,
|
|
612
|
+
type: "file",
|
|
613
|
+
accept: "image/*",
|
|
614
|
+
onChange: E,
|
|
615
|
+
disabled: i || l,
|
|
616
|
+
style: bt,
|
|
617
|
+
"aria-hidden": "true",
|
|
618
|
+
tabIndex: -1
|
|
619
|
+
}), !p && F(m, {
|
|
620
|
+
fileInputRef: h,
|
|
621
|
+
disabled: i,
|
|
622
|
+
readOnly: l,
|
|
623
|
+
onBlur: c,
|
|
624
|
+
onFocus: d
|
|
625
|
+
}), p && (r.url ? /* @__PURE__ */ s.createElement("img", {
|
|
626
|
+
id: u,
|
|
627
|
+
src: r.url,
|
|
628
|
+
alt: r.displayName || a,
|
|
629
|
+
"data-hook": "signature-image"
|
|
630
|
+
}) : /* @__PURE__ */ s.createElement("span", {
|
|
631
|
+
id: u,
|
|
632
|
+
"data-hook": "signature-image"
|
|
633
|
+
}, r.displayName || a)));
|
|
634
|
+
}, yt = ({ children: e, className: t, ...a }) => {
|
|
635
|
+
const { fileInputRef: n, disabled: r, readOnly: o, onBlur: i, onFocus: l } = a, { inputId: c, ariaDescribedBy: d, labelId: u } = H(), f = qe(), m = I(() => {
|
|
636
|
+
var h;
|
|
637
|
+
(h = n.current) == null || h.click();
|
|
638
|
+
}, [
|
|
639
|
+
n
|
|
640
|
+
]);
|
|
641
|
+
return /* @__PURE__ */ s.createElement(fe, {
|
|
642
|
+
id: c,
|
|
643
|
+
onPress: m,
|
|
644
|
+
onBlur: i,
|
|
645
|
+
onFocus: l,
|
|
646
|
+
isDisabled: r || o,
|
|
647
|
+
"aria-labelledby": `${u} ${f}`,
|
|
648
|
+
"aria-describedby": d,
|
|
649
|
+
"data-hook": "signature-upload",
|
|
650
|
+
className: t
|
|
651
|
+
}, /* @__PURE__ */ s.createElement("span", {
|
|
652
|
+
id: f
|
|
653
|
+
}, e));
|
|
654
|
+
};
|
|
655
|
+
g.Label = Ye;
|
|
656
|
+
g.Input = Z;
|
|
657
|
+
g.Description = We;
|
|
658
|
+
g.Error = He;
|
|
659
|
+
Z.Header = X;
|
|
660
|
+
Z.Value = P;
|
|
661
|
+
X.Tabs = _;
|
|
662
|
+
X.Clear = gt;
|
|
663
|
+
_.Draw = pt;
|
|
664
|
+
_.Type = ft;
|
|
665
|
+
_.Upload = ht;
|
|
666
|
+
P.Canvas = Et;
|
|
667
|
+
P.Type = ae;
|
|
668
|
+
P.Upload = re;
|
|
669
|
+
ae.Value = Lt;
|
|
670
|
+
re.Button = yt;
|
|
671
|
+
const Tt = () => {
|
|
672
|
+
const { t: e } = Me();
|
|
673
|
+
return {
|
|
674
|
+
drawLabel: e("field.signature.mode.draw.label"),
|
|
675
|
+
typeLabel: e("field.signature.mode.type.label"),
|
|
676
|
+
uploadModeLabel: e("field.signature.mode.upload.label"),
|
|
677
|
+
drawDescription: e("field.signature.mode.draw.description"),
|
|
678
|
+
typeDescription: e("field.signature.mode.type.description"),
|
|
679
|
+
uploadDescription: e("field.signature.mode.upload.description"),
|
|
680
|
+
clearLabel: e("field.signature.clear-button.label"),
|
|
681
|
+
emptyLabel: e("field.signature.canvas.aria-label.empty"),
|
|
682
|
+
signedLabel: e("field.signature.canvas.aria-label.signed"),
|
|
683
|
+
placeholder: e("field.signature.text.placeholder"),
|
|
684
|
+
imageAlt: e("field.signature.a11y.state.signed"),
|
|
685
|
+
uploadLabel: e("field.signature.settings.upload-button.label")
|
|
686
|
+
};
|
|
687
|
+
}, Ct = (e) => /* @__PURE__ */ s.createElement("svg", {
|
|
688
|
+
viewBox: "0 0 24 24",
|
|
689
|
+
width: 24,
|
|
690
|
+
height: 24,
|
|
691
|
+
fill: "currentColor",
|
|
692
|
+
"aria-hidden": "true",
|
|
693
|
+
...e
|
|
694
|
+
}, /* @__PURE__ */ s.createElement("path", {
|
|
695
|
+
fillRule: "evenodd",
|
|
696
|
+
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"
|
|
697
|
+
})), It = (e) => /* @__PURE__ */ s.createElement("svg", {
|
|
698
|
+
viewBox: "0 0 24 24",
|
|
699
|
+
width: 24,
|
|
700
|
+
height: 24,
|
|
701
|
+
fill: "currentColor",
|
|
702
|
+
"aria-hidden": "true",
|
|
703
|
+
...e
|
|
704
|
+
}, /* @__PURE__ */ s.createElement("path", {
|
|
705
|
+
fillRule: "evenodd",
|
|
706
|
+
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"
|
|
707
|
+
})), Dt = (e) => /* @__PURE__ */ s.createElement("svg", {
|
|
708
|
+
viewBox: "0 0 24 24",
|
|
709
|
+
width: 24,
|
|
710
|
+
height: 24,
|
|
711
|
+
fill: "currentColor",
|
|
712
|
+
"aria-hidden": "true",
|
|
713
|
+
...e
|
|
714
|
+
}, /* @__PURE__ */ s.createElement("path", {
|
|
715
|
+
fillRule: "evenodd",
|
|
716
|
+
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"
|
|
717
|
+
})), wt = (e) => /* @__PURE__ */ s.createElement("svg", {
|
|
718
|
+
viewBox: "0 0 20 20",
|
|
719
|
+
width: 24,
|
|
720
|
+
height: 24,
|
|
721
|
+
fill: "currentColor",
|
|
722
|
+
"aria-hidden": "true",
|
|
723
|
+
...e
|
|
724
|
+
}, /* @__PURE__ */ s.createElement("path", {
|
|
725
|
+
fillRule: "evenodd",
|
|
726
|
+
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"
|
|
727
|
+
})), Rt = "_header_15ti0_1", vt = "_tabs_15ti0_8", xt = "_tab_15ti0_8", St = "_tabIcon_15ti0_74", Ft = "_clear_15ti0_81", At = "_value_15ti0_113", _t = "_box_15ti0_118", Pt = "_uploadBox_15ti0_119", Nt = "_typeInput_15ti0_230", C = {
|
|
728
|
+
header: Rt,
|
|
729
|
+
tabs: vt,
|
|
730
|
+
tab: xt,
|
|
731
|
+
tabIcon: St,
|
|
732
|
+
clear: Ft,
|
|
733
|
+
value: At,
|
|
734
|
+
box: _t,
|
|
735
|
+
uploadBox: Pt,
|
|
736
|
+
typeInput: Nt
|
|
737
|
+
}, Ut = ({ content: e, locale: t }) => /* @__PURE__ */ s.createElement(Re, {
|
|
738
|
+
content: e,
|
|
739
|
+
locale: t
|
|
740
|
+
}), Ot = () => {
|
|
741
|
+
const e = Tt();
|
|
742
|
+
return /* @__PURE__ */ s.createElement(g, null, /* @__PURE__ */ s.createElement(g.Label, {
|
|
743
|
+
className: v(ue, V.label)
|
|
744
|
+
}, /* @__PURE__ */ s.createElement(g.Label.Required, {
|
|
745
|
+
className: v(Ve, V.requiredMark)
|
|
746
|
+
})), /* @__PURE__ */ s.createElement(g.Input, null, /* @__PURE__ */ s.createElement(g.Input.Header, {
|
|
747
|
+
className: C.header
|
|
748
|
+
}, /* @__PURE__ */ s.createElement(g.Input.Header.Tabs, {
|
|
749
|
+
className: C.tabs
|
|
750
|
+
}, /* @__PURE__ */ s.createElement(g.Input.Header.Tabs.Draw, {
|
|
751
|
+
className: v(B, C.tab),
|
|
752
|
+
"aria-label": e.drawLabel,
|
|
753
|
+
description: e.drawDescription
|
|
754
|
+
}, /* @__PURE__ */ s.createElement(Dt, {
|
|
755
|
+
className: C.tabIcon
|
|
756
|
+
})), /* @__PURE__ */ s.createElement(g.Input.Header.Tabs.Type, {
|
|
757
|
+
className: v(B, C.tab),
|
|
758
|
+
"aria-label": e.typeLabel,
|
|
759
|
+
description: e.typeDescription
|
|
760
|
+
}, /* @__PURE__ */ s.createElement(wt, {
|
|
761
|
+
className: C.tabIcon
|
|
762
|
+
})), /* @__PURE__ */ s.createElement(g.Input.Header.Tabs.Upload, {
|
|
763
|
+
className: v(B, C.tab),
|
|
764
|
+
"aria-label": e.uploadModeLabel,
|
|
765
|
+
description: e.uploadDescription
|
|
766
|
+
}, /* @__PURE__ */ s.createElement(It, {
|
|
767
|
+
className: C.tabIcon
|
|
768
|
+
}))), /* @__PURE__ */ s.createElement(g.Input.Header.Clear, {
|
|
769
|
+
className: v(ue, C.clear),
|
|
770
|
+
"aria-label": e.clearLabel
|
|
771
|
+
}, /* @__PURE__ */ s.createElement(Ct, null))), /* @__PURE__ */ s.createElement(g.Input.Value, {
|
|
772
|
+
className: C.value
|
|
773
|
+
}, /* @__PURE__ */ s.createElement(g.Input.Value.Canvas, {
|
|
774
|
+
className: v(B, C.box),
|
|
775
|
+
emptyLabel: e.emptyLabel,
|
|
776
|
+
signedLabel: e.signedLabel
|
|
777
|
+
}), /* @__PURE__ */ s.createElement(g.Input.Value.Type, {
|
|
778
|
+
className: v(B, C.box)
|
|
779
|
+
}, /* @__PURE__ */ s.createElement(g.Input.Value.Type.Value, {
|
|
780
|
+
className: C.typeInput,
|
|
781
|
+
placeholder: e.placeholder
|
|
782
|
+
})), /* @__PURE__ */ s.createElement(g.Input.Value.Upload, {
|
|
783
|
+
className: v(B, C.uploadBox),
|
|
784
|
+
imageAlt: e.imageAlt
|
|
785
|
+
}, /* @__PURE__ */ s.createElement(g.Input.Value.Upload.Button, {
|
|
786
|
+
className: v(ze, V.uploadButton)
|
|
787
|
+
}, e.uploadLabel)))), /* @__PURE__ */ s.createElement(g.Error, {
|
|
788
|
+
className: v(Ze, V.error)
|
|
789
|
+
}, /* @__PURE__ */ s.createElement($e, null), /* @__PURE__ */ s.createElement(g.Error.Text, null)), /* @__PURE__ */ s.createElement(g.Description, {
|
|
790
|
+
className: v(Xe, V.description)
|
|
791
|
+
}, Ut));
|
|
792
|
+
}, Jt = () => /* @__PURE__ */ s.createElement(Ot, null);
|
|
793
|
+
export {
|
|
794
|
+
Jt as SignatureRAC
|
|
795
|
+
};
|