@wix/form-elements 1.108.0 → 1.110.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.
Files changed (107) hide show
  1. package/dist/component/{appointment-rac-ZAp8oWbK.js → appointment-rac-CfPs6AsU.js} +60 -60
  2. package/dist/component/{bookings-address-rac-x-Az7vHf.js → bookings-address-rac-XkgsBu8i.js} +1 -1
  3. package/dist/component/{bookings-email-rac-MoF_CaqB.js → bookings-email-rac-CyESeQLD.js} +1 -1
  4. package/dist/component/{bookings-first-name-rac-CWh3Rb0M.js → bookings-first-name-rac-CFY5Qwk9.js} +1 -1
  5. package/dist/component/{bookings-header-rac-BVTiXUWk.js → bookings-header-rac-lRsebspV.js} +1 -1
  6. package/dist/component/{bookings-last-name-rac-kXRRlyHl.js → bookings-last-name-rac-B7J2K4oK.js} +1 -1
  7. package/dist/component/{bookings-login-bar-rac-C4Zr6kXE.js → bookings-login-bar-rac-BD97U76_.js} +3 -3
  8. package/dist/component/{bookings-phone-rac-2rz1m_xi.js → bookings-phone-rac-CpgDCLTp.js} +1 -1
  9. package/dist/component/{bookings-rich-text-rac-BEjGypQw.js → bookings-rich-text-rac-DQUQMN3s.js} +1 -1
  10. package/dist/component/{checkbox-field-rac-DwEQLIaz.js → checkbox-field-rac-CcOW4yol.js} +43 -43
  11. package/dist/component/{checkbox-group-field-headless-BsOww_QB.js → checkbox-group-field-headless-DiBxnwOj.js} +8 -8
  12. package/dist/component/{checkbox-group-field-rac-DTcZcVS6.js → checkbox-group-field-rac-BCzS44NM.js} +4 -4
  13. package/dist/component/{checkbox-group-rac-DQsML-pW.js → checkbox-group-rac-C2oHVikX.js} +1 -1
  14. package/dist/component/{checkbox-rac-irEBBOxP.js → checkbox-rac-DPhswfJ9.js} +1 -1
  15. package/dist/component/{contacts-address-rac-B5bSAYrm.js → contacts-address-rac-Cjqot4Vo.js} +1 -1
  16. package/dist/component/{contacts-birthdate-rac-DyScj8f4.js → contacts-birthdate-rac-C3uYlFa3.js} +1 -1
  17. package/dist/component/{contacts-company-rac-C5X9-jXa.js → contacts-company-rac-BDmDrlJm.js} +1 -1
  18. package/dist/component/{contacts-email-rac-B0vkfmrS.js → contacts-email-rac-9NI8430K.js} +1 -1
  19. package/dist/component/{contacts-first-name-rac-Cfil3U_e.js → contacts-first-name-rac-PNgDNwXZ.js} +1 -1
  20. package/dist/component/{contacts-last-name-rac-CtPLE-7-.js → contacts-last-name-rac-Dkf8oYRe.js} +1 -1
  21. package/dist/component/{contacts-phone-rac-YkzsAoBZ.js → contacts-phone-rac-BefG0umR.js} +1 -1
  22. package/dist/component/{contacts-position-rac-BS4j8QC-.js → contacts-position-rac-8ZWMa74Q.js} +1 -1
  23. package/dist/component/{contacts-subscribe-rac-z_9VsEZL.js → contacts-subscribe-rac-Dj0k_O2C.js} +1 -1
  24. package/dist/component/{contacts-tax-id-rac-WFkmKyZv.js → contacts-tax-id-rac-Dbz0SEH9.js} +1 -1
  25. package/dist/component/{date-availability-NN3rxosk.js → date-availability-CpZYBX1d.js} +1 -1
  26. package/dist/component/{date-input-field-rac-mdhEC3oq.js → date-input-field-rac-8CkusNEQ.js} +64 -64
  27. package/dist/component/{date-input-rac-CGciuoTx.js → date-input-rac-CH1ke9-c.js} +1 -1
  28. package/dist/component/{date-picker-field-rac-CRZVODfF.js → date-picker-field-rac-pZQhHvZc.js} +31 -31
  29. package/dist/component/{date-picker-rac-Bfbvjy8W.js → date-picker-rac-BOdzNgu6.js} +1 -1
  30. package/dist/component/{date-time-input-field-rac-TDWBXZ44.js → date-time-input-field-rac-DDUZvi8G.js} +70 -70
  31. package/dist/component/{date-time-input-rac-DY0qdSix.js → date-time-input-rac-DkjW7KId.js} +1 -1
  32. package/dist/component/{dext-checkbox-group-rac-BFGM7SOt.js → dext-checkbox-group-rac-Cjx062TO.js} +2 -2
  33. package/dist/component/{dext-checkbox-rac-DPZvTeUZ.js → dext-checkbox-rac-CIqsZ8Cf.js} +1 -1
  34. package/dist/component/{dext-date-picker-rac-Xd5kojsQ.js → dext-date-picker-rac-BYQN00yy.js} +1 -1
  35. package/dist/component/{dext-date-time-input-rac-C0RIdxJW.js → dext-date-time-input-rac-Bh-HYZ_X.js} +1 -1
  36. package/dist/component/{dext-dropdown-rac-D1m8vJvm.js → dext-dropdown-rac-rnkUqsSx.js} +1 -1
  37. package/dist/component/{dext-email-rac-BC81RFYY.js → dext-email-rac-DtW_DadC.js} +1 -1
  38. package/dist/component/{dext-number-input-rac-Z_ih9FfX.js → dext-number-input-rac-DTfdLXFG.js} +1 -1
  39. package/dist/component/{dext-phone-rac-s3BOnXuI.js → dext-phone-rac-D3anV8iB.js} +1 -1
  40. package/dist/component/{dext-radio-group-rac-CL3jcezs.js → dext-radio-group-rac-CIO_2H7F.js} +4 -4
  41. package/dist/component/{dext-rating-input-rac-wz1EyP5b.js → dext-rating-input-rac-Bdtbwo1W.js} +1 -1
  42. package/dist/component/{dext-tags-rac-BY4Rf2BP.js → dext-tags-rac-DT4_lRM0.js} +4 -4
  43. package/dist/component/{dext-text-area-rac-DRJzlsq8.js → dext-text-area-rac-BgMlIgik.js} +1 -1
  44. package/dist/component/{dext-text-input-rac-BGcRNNAi.js → dext-text-input-rac-DDc6-lsN.js} +1 -1
  45. package/dist/component/{dext-url-input-rac-CRAIm8yp.js → dext-url-input-rac-CrOT7XQf.js} +1 -1
  46. package/dist/component/{donation-rac-BlTfOIlE.js → donation-rac-CORUAfww.js} +74 -74
  47. package/dist/component/{dropdown-field-headless-DhzRAMcM.js → dropdown-field-headless-B-82vlHV.js} +10 -10
  48. package/dist/component/{dropdown-field-rac-DXyY5we-.js → dropdown-field-rac-AYGyhYSH.js} +3 -3
  49. package/dist/component/{dropdown-rac-C6YM6qxm.js → dropdown-rac-g-zqV-y4.js} +1 -1
  50. package/dist/component/{ecom-address-rac-CAdr7wya.js → ecom-address-rac-BQqh4QrW.js} +1 -1
  51. package/dist/component/{ecom-subscription-checkbox-rac-Z2VMuCbt.js → ecom-subscription-checkbox-rac-Cf7Ou6Om.js} +2 -2
  52. package/dist/component/{email-input-field-rac-DpkfunVK.js → email-input-field-rac-BFrfF6TW.js} +47 -47
  53. package/dist/component/{events-repeater-rac-CuJkdrPo.js → events-repeater-rac-CNifjThM.js} +8 -8
  54. package/dist/component/{events-rsvp-rac-BKWlSeQ9.js → events-rsvp-rac-CnW7CNdo.js} +10 -10
  55. package/dist/component/{field-error-headless-tsg9FQ-_.js → field-error-headless-BLgaEh1d.js} +11 -11
  56. package/dist/component/{field-label-headless-CB8dEat8.js → field-label-headless-C8NbnF9M.js} +4 -4
  57. package/dist/component/file-upload-rac-Yk44koqY.js +561 -0
  58. package/dist/component/{fixed-payment-rac-CuIQEeHh.js → fixed-payment-rac-r_OUP_KD.js} +15 -15
  59. package/dist/component/{form-0jt4L5xo.js → form-DC8xFBa_.js} +6178 -5729
  60. package/dist/component/form.css +1 -1
  61. package/dist/component/form.js +3 -3
  62. package/dist/component/{header-field-rac-CWVGzxKb.js → header-field-rac-6NOymbBc.js} +4 -4
  63. package/dist/component/{header-rac-D6KsV-ko.js → header-rac-DzK8Cg5s.js} +1 -1
  64. package/dist/component/{image-choice-rac-CUCyVS8c.js → image-choice-rac-CcCInqrr.js} +9 -9
  65. package/dist/component/{index-iOqQidgV.js → index-B_72TOzS.js} +2 -2
  66. package/dist/component/{index-TJSnVtCO.js → index-CGbawBGb.js} +43 -43
  67. package/dist/component/{isObjectLike-DQbx8r1c.js → isObjectLike-BziKAUTi.js} +1 -1
  68. package/dist/component/{multiline-address-field-rac-DtZ1NTfD.js → multiline-address-field-rac-CJw6HvHY.js} +78 -78
  69. package/dist/component/{multiline-address-rac-ub-_XzHU.js → multiline-address-rac-B_GR1nkJ.js} +1 -1
  70. package/dist/component/{number-input-field-rac-DLItn4DK.js → number-input-field-rac-CXFmpNWL.js} +13 -13
  71. package/dist/component/{number-input-rac-UuxJzqEx.js → number-input-rac-sr4Dhnxa.js} +1 -1
  72. package/dist/component/{password-rac-Di6q96Rn.js → password-rac-BwBEPYo3.js} +15 -15
  73. package/dist/component/{payment-input-rac-CG6c4-Ge.js → payment-input-rac-BcLSkgtK.js} +44 -44
  74. package/dist/component/{phone-input-field-rac-D4JphCuT.js → phone-input-field-rac-4kp5xRJZ.js} +50 -50
  75. package/dist/component/{phone-rac-_vDw2usa.js → phone-rac-B_QYTg28.js} +1 -1
  76. package/dist/component/{product-list-rac-CgxRlj1f.js → product-list-rac-C7YDHPj_.js} +50 -50
  77. package/dist/component/{quiz-radio-group-rac-bi26aGxN.js → quiz-radio-group-rac-Be1v1PyS.js} +1 -1
  78. package/dist/component/{radio-button-module-classes-DDJq2ESf.js → radio-button-module-classes-k9DhZ1Fd.js} +14 -14
  79. package/dist/component/{radio-group-field-rac-D1aMVO6l.js → radio-group-field-rac-BDEAYQH5.js} +6 -6
  80. package/dist/component/{radio-group-rac-HKC85M6t.js → radio-group-rac-DcmSrcGy.js} +1 -1
  81. package/dist/component/{rating-input-field-rac-CpRehxFB.js → rating-input-field-rac-CcO3-3O3.js} +20 -20
  82. package/dist/component/{rating-input-rac-BMuCZ3oj.js → rating-input-rac-wl8G35Xv.js} +1 -1
  83. package/dist/component/{rich-content-rac.module-mZ6xoAOd.js → rich-content-rac.module-CzZ6x_Yf.js} +1 -1
  84. package/dist/component/{rich-text-field-rac-CUK8V8Kf.js → rich-text-field-rac-B4l_YgG7.js} +4 -4
  85. package/dist/component/{rich-text-rac-B-7sR2FJ.js → rich-text-rac-BlW4v4gg.js} +1 -1
  86. package/dist/component/{service-dropdown-rac-1DDNT5bn.js → service-dropdown-rac-CJTrm0iL.js} +33 -33
  87. package/dist/component/{services-multi-choice-rac-CB-6dwxz.js → services-multi-choice-rac-BkiL2Pct.js} +13 -13
  88. package/dist/component/{signature-rac-7XBci6P2.js → signature-rac-_fTng53p.js} +133 -133
  89. package/dist/component/{submit-button-rac-B1-Mk8Gg.js → submit-button-rac-EmqyRMuE.js} +17 -17
  90. package/dist/component/{tags-field-rac-CQ9Y7mq-.js → tags-field-rac-CTlZZLdv.js} +32 -32
  91. package/dist/component/{tags-rac-Visic-Ml.js → tags-rac-xd-CpByf.js} +1 -1
  92. package/dist/component/{text-area-field-rac-C8fP1g-w.js → text-area-field-rac-Dap_aF4j.js} +14 -14
  93. package/dist/component/{text-area-rac-B6yZxzxm.js → text-area-rac-rKSZi3gu.js} +1 -1
  94. package/dist/component/{text-input-field-rac-CNjbOxD1.js → text-input-field-rac-GBsaUY0A.js} +5 -5
  95. package/dist/component/{text-input-headless-Bm8PJGep.js → text-input-headless-SHtvSa6y.js} +3 -3
  96. package/dist/component/{text-input-rac-BEPC1Z-4.js → text-input-rac-v4R17Vxm.js} +1 -1
  97. package/dist/component/{time-input-rac-3m6C_Jp5.js → time-input-rac-DgnhZSjV.js} +27 -27
  98. package/dist/component/{url-input-field-rac-CIk_6Lf6.js → url-input-field-rac-BuTadRMy.js} +19 -19
  99. package/dist/component/{url-input-rac-DyVoygXH.js → url-input-rac-BpVSwqpz.js} +1 -1
  100. package/dist/component/{use-dropdown-option-class-name-McG3ayOT.js → use-dropdown-option-class-name-Cwfh_4oi.js} +2 -2
  101. package/dist/component/{use-element-state-class-name-B9MBWX44.js → use-element-state-class-name-BF7I_Ju7.js} +1 -1
  102. package/dist/component/{use-is-forced-open-dropdown-r5G_sZsO.js → use-is-forced-open-dropdown-BMuhxge2.js} +8 -8
  103. package/dist/component/{use-service-options-base-hcbkvhpw.js → use-service-options-base-DfyQZjmw.js} +1 -1
  104. package/dist/component/{use-text-input-class-name-SnurFqAr.js → use-text-input-class-name-ixt7gTGg.js} +2 -2
  105. package/dist/form.d.ts +18 -0
  106. package/package.json +3 -3
  107. package/dist/component/file-upload-rac-ZdgYt646.js +0 -483
@@ -0,0 +1,561 @@
1
+ import t, { useState as J, useRef as H, useMemo as fe, useEffect as ne, useCallback as M, createContext as xe, useContext as he } from "react";
2
+ import _e from "@wix/editor-react-components/AnimatedIcon";
3
+ import { RicosViewer as Ce } from "@wix/ricos/viewer";
4
+ import R from "classnames";
5
+ import { b5 as Le, bj as re, be as Ne, ad as ve, bh as De, a6 as ie, bi as Te, b6 as Ee, b9 as k, bb as Se, b3 as Be, b2 as ye, I as Ze, U as Re, b as Ae, a1 as Me, a2 as ce, p as de, u as ue, v as me, a0 as Ie, f as te } from "./form-DC8xFBa_.js";
6
+ import { E as Oe } from "./error-icon-hZxQ6DEy.js";
7
+ import { s as K } from "./field-rac.module-B4l_0KRU.js";
8
+ import { u as pe } from "./use-element-state-class-name-BF7I_Ju7.js";
9
+ import { DropZone as we, Text as Ue, FileTrigger as Pe, Button as be, ProgressBar as He, VisuallyHidden as je } from "react-aria-components";
10
+ import { f as C, a as $ } from "./find-child-C60k4CxG.js";
11
+ import { b as ke, a as ze, D as Ve, E as qe } from "./field-error-headless-BLgaEh1d.js";
12
+ import { L as Ke } from "./field-label-headless-C8NbnF9M.js";
13
+ const $e = {
14
+ Video: "video/*",
15
+ Image: "image/*",
16
+ Audio: "audio/*",
17
+ Document: ".ai, .cdr, .csv, .doc, .docb, .docx, .dot, .dotx, .dwg, .eps, .epub, .fla, .gpx, .ical, .icalendar, .ics, .ifb, .indd, .ipynb, .key, .kml, .kmz, .mobi, .mtf, .mtx, .numbers, .odg, .odp, .ods, .odt, .otp, .ots, .ott, .oxps, .pages, .pdf, .pdn, .pkg, .pot, .potx, .pps, .ppsx, .ppt, .pptx, .psd, .pub, .rtf, .sldx, .txt, .json, .vcf, .xcf, .xls, .xlsx, .xlt, .xltx, .xlw, .xps,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel",
18
+ Archive: ".zip, .rar, .tar, .tar.gz, .gz, .gzip, .jar, .7z, .fgz, .webarchive",
19
+ Model3D: ".gltf, .glb"
20
+ }, Ye = (e) => {
21
+ const { actions: n, formId: r } = Le();
22
+ return async (l, s, u) => {
23
+ if (!(n != null && n.uploadFile) || !l.length)
24
+ return n != null && n.uploadFile || console.error("No uploadFile action"), l.length || console.error("No files to upload"), [];
25
+ const E = l.map(({ file: o }) => n.uploadFile({
26
+ file: o,
27
+ formId: r,
28
+ uploadTarget: e
29
+ }).then((i) => {
30
+ const { id: N, displayName: m, url: p, isPrivate: d } = i, v = {
31
+ fileId: N,
32
+ displayName: m || o.name,
33
+ url: d ? void 0 : p,
34
+ fileType: o.type || "application/octet-stream"
35
+ };
36
+ return s({
37
+ file: o,
38
+ uploadedFile: v
39
+ }), v;
40
+ }).catch((i) => {
41
+ u(i, o);
42
+ }));
43
+ return (await Promise.all(E)).filter((o) => o !== void 0);
44
+ };
45
+ };
46
+ function We({ valueSliderLimit: e, value: n, explanationText: r, target: l, onChange: s, uploadFileFormats: u, onBlur: E, onFilesCleared: L }) {
47
+ const [o, i] = J(Qe(n)), [N, m] = J(n || []), [p, d] = J(), v = Ye(l), { t: h } = re(), F = Ne().includes(ve.BUTTONS_HOVER), { setFormStatus: T } = De(), y = H(!1), c = H(s);
48
+ c.current = s;
49
+ const S = fe(() => o.some((f) => f.state === "uploading"), [
50
+ o
51
+ ]);
52
+ ne(() => {
53
+ y.current !== S && (y.current = S, T(l, S ? ie.BUSY : ie.READY));
54
+ }, [
55
+ S,
56
+ T,
57
+ l
58
+ ]);
59
+ const Z = M(() => {
60
+ if (!o.length)
61
+ return;
62
+ const x = o.filter((f) => f.state === "uploading").length;
63
+ if (x) {
64
+ const f = o.filter((b) => b.state === "uploaded" && b.file.size > 0).length, _ = f / (f + x);
65
+ return h("form.file-upload.uploading", {
66
+ count: Math.round(_ * 100)
67
+ });
68
+ }
69
+ return h("form.file-upload.explanation-text", {
70
+ count: o.length
71
+ });
72
+ }, [
73
+ o,
74
+ h
75
+ ]), B = M(() => o.length ? o.some((f) => f.state === "uploading") ? Z() : r || Z() : r, [
76
+ o,
77
+ r,
78
+ Z
79
+ ]), V = M(async (x) => {
80
+ await v(x, ({ file: f, uploadedFile: _ }) => {
81
+ i((b) => b.map((g) => g.file === f ? {
82
+ file: f,
83
+ state: "uploaded"
84
+ } : g)), m((b) => {
85
+ var w;
86
+ const g = [
87
+ ...b
88
+ ].concat(_);
89
+ return (w = c.current) == null || w.call(c, g), g;
90
+ });
91
+ }, (f, _) => {
92
+ i((b) => b.map((g) => g.file === _ ? {
93
+ file: _,
94
+ state: "error",
95
+ errorMessage: h("form.file-upload.error.upload-failed")
96
+ } : g));
97
+ });
98
+ }, [
99
+ v,
100
+ h
101
+ ]), O = async (x) => {
102
+ if (p && d(void 0), x) {
103
+ if (o.length + x.length > e) {
104
+ d(h("form.file-upload.error.upload-limit", {
105
+ limit: e
106
+ }));
107
+ return;
108
+ }
109
+ const b = Array.from(x).reduce((g, w) => (o.some((U) => U.file.name === w.name) || g.push({
110
+ file: w,
111
+ state: "uploading"
112
+ }), g), []);
113
+ i([
114
+ ...o,
115
+ ...b
116
+ ]), await V(b);
117
+ }
118
+ }, q = (x) => {
119
+ const f = o[x];
120
+ if (N && s && f.state !== "error") {
121
+ const _ = N.filter((g) => g.displayName !== f.file.name);
122
+ s(_), m(_);
123
+ const b = o.filter((g) => g.file.name !== f.file.name);
124
+ i(b), b.length === 0 && L();
125
+ } else {
126
+ const _ = o.filter((b) => b !== f);
127
+ i(_), _.length === 0 && L();
128
+ }
129
+ }, Y = () => {
130
+ p && d(void 0), E();
131
+ }, W = u.map((x) => $e[x]).join(), X = M(() => {
132
+ i([]), m([]);
133
+ }, []);
134
+ return Te(X), {
135
+ files: o,
136
+ limitError: p,
137
+ hover: F,
138
+ getExplanationText: B,
139
+ getStatusText: Z,
140
+ handleChange: O,
141
+ handleDelete: q,
142
+ accept: W,
143
+ handleBlur: Y
144
+ };
145
+ }
146
+ function Qe(e = []) {
147
+ const n = e || [];
148
+ try {
149
+ return n.map((r) => ({
150
+ file: new File([
151
+ new Int8Array(0)
152
+ ], r.displayName, {
153
+ type: r.fileType
154
+ }),
155
+ state: "uploaded"
156
+ }));
157
+ } catch (r) {
158
+ console.error(r);
159
+ }
160
+ return [];
161
+ }
162
+ const Fe = /* @__PURE__ */ xe(void 0);
163
+ function z() {
164
+ const e = he(Fe);
165
+ if (typeof e > "u")
166
+ throw new Error("FileUpload components must be used within FileUpload");
167
+ return e;
168
+ }
169
+ const j = ({ children: e, className: n }) => {
170
+ const { ariaDescribedBy: r } = Ee(), { disabled: l, hasError: s } = k(), { handleFileChange: u, limitReached: E } = z();
171
+ if (E)
172
+ return null;
173
+ const L = C(e, j.Title), o = C(e, j.Subtitle), i = C(e, j.Button);
174
+ return /* @__PURE__ */ t.createElement(we, {
175
+ "aria-describedby": r,
176
+ className: n,
177
+ "data-invalid": s,
178
+ isDisabled: l,
179
+ onDrop: async (N) => {
180
+ const m = [];
181
+ for (const p of N.items)
182
+ if (p.kind === "file") {
183
+ const d = await p.getFile();
184
+ d && m.push(d);
185
+ }
186
+ if (m.length > 0) {
187
+ const p = new DataTransfer();
188
+ m.forEach((d) => p.items.add(d)), u(p.files);
189
+ }
190
+ }
191
+ }, /* @__PURE__ */ t.createElement(Ue, {
192
+ slot: "label"
193
+ }, L, o), i);
194
+ }, Ge = ({ className: e, children: n }) => {
195
+ const { limitReached: r } = z();
196
+ return /* @__PURE__ */ t.createElement("p", {
197
+ className: e
198
+ }, n({
199
+ limitReached: r
200
+ }));
201
+ }, Je = ({ className: e, children: n }) => {
202
+ const { limitReached: r } = z(), { explanationText: l } = k();
203
+ return /* @__PURE__ */ t.createElement("p", {
204
+ className: e
205
+ }, l || n({
206
+ limitReached: r
207
+ }));
208
+ }, oe = ({ className: e, children: n, "aria-roledescription": r, onHoverStart: l, onHoverEnd: s }) => {
209
+ const { ariaDescribedBy: u, inputId: E, labelId: L, errorId: o } = Ee(), { disabled: i, required: N, onFocus: m, hasError: p, errorMessage: d } = k(), { handleFileChange: v, accept: h, multiple: I, buttonRef: F, handleBlur: T, limitError: y, files: c } = z(), S = (c == null ? void 0 : c.some((B) => B.errorMessage)) ?? !1, Z = !!(p || d || y || S);
210
+ return /* @__PURE__ */ t.createElement(Pe, {
211
+ acceptedFileTypes: h ? h.split(",") : void 0,
212
+ allowsMultiple: I,
213
+ onSelect: (B) => {
214
+ if (B) {
215
+ const V = Array.from(B), O = new DataTransfer();
216
+ V.forEach((q) => O.items.add(q)), v(O.files);
217
+ }
218
+ }
219
+ }, /* @__PURE__ */ t.createElement(be, {
220
+ ref: F,
221
+ id: E,
222
+ "aria-labelledby": L,
223
+ "aria-describedby": [
224
+ u,
225
+ o
226
+ ].filter(Boolean).join(" "),
227
+ render: (B) => /* @__PURE__ */ t.createElement("button", {
228
+ ...B,
229
+ "aria-roledescription": r,
230
+ "aria-invalid": Z || void 0,
231
+ "aria-required": N
232
+ }),
233
+ isDisabled: i,
234
+ className: e,
235
+ onFocus: m,
236
+ onBlur: T,
237
+ onHoverStart: l,
238
+ onHoverEnd: s
239
+ }, n));
240
+ }, Xe = ({ className: e }) => {
241
+ const { buttonText: n } = k();
242
+ return /* @__PURE__ */ t.createElement("span", {
243
+ className: e
244
+ }, n);
245
+ };
246
+ oe.Text = Xe;
247
+ j.Title = Ge;
248
+ j.Subtitle = Je;
249
+ j.Button = oe;
250
+ const A = ({ children: e, className: n, ...r }) => {
251
+ const { file: l, index: s } = r, u = l.file.name, E = C(e, A.Name), L = C(e, A.Remove), o = C(e, A.Spinner), i = C(e, A.Error);
252
+ return /* @__PURE__ */ t.createElement("div", {
253
+ className: n
254
+ }, $(E, {
255
+ fileName: u
256
+ }), l.state === "uploading" ? o : $(L, {
257
+ index: s,
258
+ fileName: u
259
+ }), l.errorMessage && $(i, {
260
+ errorMessage: l.errorMessage
261
+ }));
262
+ }, et = ({ className: e, ...n }) => {
263
+ const { fileName: r } = n;
264
+ return /* @__PURE__ */ t.createElement("span", {
265
+ className: e
266
+ }, r);
267
+ }, tt = ({ className: e, "aria-label": n, children: r, ...l }) => {
268
+ const { fileName: s, index: u } = l, { disabled: E } = k(), { handleDelete: L, fileRemoveButtonRefs: o } = z(), i = H(null);
269
+ ne(() => {
270
+ const m = o.current, p = s;
271
+ return m[p] = i, () => {
272
+ m[p] === i && (m[p] = void 0);
273
+ };
274
+ }, [
275
+ s,
276
+ o
277
+ ]);
278
+ const N = () => {
279
+ L(u);
280
+ };
281
+ return /* @__PURE__ */ t.createElement(be, {
282
+ ref: i,
283
+ "aria-disabled": E,
284
+ "aria-label": n,
285
+ "aria-description": s,
286
+ onClick: N,
287
+ className: e,
288
+ isDisabled: E
289
+ }, r);
290
+ }, ge = ({ className: e, children: n, ...r }) => {
291
+ const { errorMessage: l } = r;
292
+ return l ? /* @__PURE__ */ t.createElement(ze, {
293
+ value: l
294
+ }, /* @__PURE__ */ t.createElement("div", {
295
+ className: e,
296
+ role: "alert"
297
+ }, n)) : null;
298
+ }, nt = ({ className: e, "aria-label": n, children: r }) => /* @__PURE__ */ t.createElement(He, {
299
+ "aria-label": n,
300
+ className: e,
301
+ isIndeterminate: !0
302
+ }, r);
303
+ A.Name = et;
304
+ A.Remove = tt;
305
+ A.Spinner = nt;
306
+ A.Error = ge;
307
+ ge.Text = ke;
308
+ const le = ({ children: e, className: n }) => {
309
+ const { files: r } = z(), l = C(e, le.File);
310
+ return !r || r.length === 0 ? null : /* @__PURE__ */ t.createElement("div", {
311
+ className: n
312
+ }, r.map((s, u) => $(l, {
313
+ key: s.file.name || u,
314
+ file: s,
315
+ index: u
316
+ })));
317
+ };
318
+ le.File = A;
319
+ const G = (e) => e.file.name, a = ({ children: e }) => {
320
+ const { t: n } = re(), { id: r, value: l, onChange: s, uploadFileFormats: u, valueSliderLimit: E, target: L, explanationText: o, onBlur: i, hasError: N, errorMessage: m, FieldLayout: p } = k(), d = H(null), v = H({}), h = H(!1), I = M(() => {
321
+ d.current ? d.current.focus() : h.current = !0;
322
+ }, []), { files: F, limitError: T, hover: y, getExplanationText: c, getStatusText: S, handleBlur: Z, handleChange: B, handleDelete: V, accept: O } = We({
323
+ valueSliderLimit: E,
324
+ value: l,
325
+ explanationText: o,
326
+ target: L,
327
+ onChange: s,
328
+ uploadFileFormats: u,
329
+ onBlur: i,
330
+ onFilesCleared: I
331
+ }), q = M((U) => {
332
+ var se;
333
+ const Q = F[U], P = G(Q);
334
+ F.length > 1 && ((se = (F.filter((ee) => G(ee) !== P).map((ee) => v.current[G(ee)]).find(Boolean) ?? d).current) == null || se.focus()), V(U);
335
+ }, [
336
+ V,
337
+ F
338
+ ]);
339
+ ne(() => {
340
+ h.current && d.current && (h.current = !1, d.current.focus());
341
+ }, [
342
+ F
343
+ ]);
344
+ const Y = E > 1, W = F.length >= E, X = fe(() => ({
345
+ handleFileChange: B,
346
+ handleBlur: Z,
347
+ handleDelete: q,
348
+ files: F,
349
+ accept: O,
350
+ limitReached: W,
351
+ multiple: Y,
352
+ getExplanationText: c,
353
+ getStatusText: S,
354
+ hover: y,
355
+ limitError: T,
356
+ buttonRef: d,
357
+ fileRemoveButtonRefs: v
358
+ }), [
359
+ B,
360
+ Z,
361
+ q,
362
+ F,
363
+ O,
364
+ W,
365
+ Y,
366
+ c,
367
+ S,
368
+ y,
369
+ T
370
+ ]), x = C(e, a.Label), f = C(e, a.DropZone), _ = C(e, a.Button), b = C(e, a.Explanation), g = C(e, a.Files), w = C(e, a.Description), ae = C(e, a.Error);
371
+ return Se(() => {
372
+ var U, Q;
373
+ if (d.current) {
374
+ d.current.focus();
375
+ return;
376
+ }
377
+ (Q = (U = F.map((P) => v.current[G(P)]).find((P) => P == null ? void 0 : P.current)) == null ? void 0 : U.current) == null || Q.focus();
378
+ }, r), /* @__PURE__ */ t.createElement(Fe.Provider, {
379
+ value: X
380
+ }, /* @__PURE__ */ t.createElement(p, {
381
+ fieldId: r,
382
+ renderLabel: () => x,
383
+ renderInput: () => f ?? _,
384
+ renderDescription: () => /* @__PURE__ */ t.createElement(t.Fragment, null, $(ae, {
385
+ hasError: !!(N || T),
386
+ errorMessage: T ?? m
387
+ }), /* @__PURE__ */ t.createElement(je, {
388
+ role: "status",
389
+ "aria-live": "polite",
390
+ "aria-atomic": "true"
391
+ }, n("form.file-upload.explanation-text", {
392
+ count: F.length
393
+ })), b, g, w)
394
+ }));
395
+ }, rt = ({ className: e, showUploadStatusOnly: n }) => {
396
+ const { files: r, getExplanationText: l, getStatusText: s } = z(), u = n ? s() : l();
397
+ return r.length === 1 || !u ? null : /* @__PURE__ */ t.createElement("p", {
398
+ className: e
399
+ }, u);
400
+ };
401
+ a.Label = Ke;
402
+ a.DropZone = j;
403
+ a.Button = oe;
404
+ a.Explanation = rt;
405
+ a.Files = le;
406
+ a.Description = Ve;
407
+ a.Error = qe;
408
+ const ot = (e) => /* @__PURE__ */ t.createElement("svg", {
409
+ viewBox: "0 0 24 24",
410
+ width: 24,
411
+ height: 24,
412
+ fill: "currentColor",
413
+ "aria-hidden": "true",
414
+ ...e
415
+ }, /* @__PURE__ */ t.createElement("path", {
416
+ d: "M12 12 12 6 11 6 11 12 5 12 5 13 11 13 11 19 12 19 12 13 18 13 18 12z"
417
+ })), lt = (e) => /* @__PURE__ */ t.createElement("svg", {
418
+ viewBox: "0 0 24 24",
419
+ width: 24,
420
+ height: 24,
421
+ fill: "currentColor",
422
+ "aria-hidden": "true",
423
+ ...e
424
+ }, /* @__PURE__ */ t.createElement("path", {
425
+ d: "M12,21 C7.02943725,21 3,16.9705627 3,12 C3,7.02943725 7.02943725,3 12,3 C16.9705627,3 21,7.02943725 21,12 C21,16.9705627 16.9705627,21 12,21 Z M12,20 C16.418278,20 20,16.418278 20,12 C20,7.581722 16.418278,4 12,4 C7.581722,4 4,7.581722 4,12 C4,16.418278 7.581722,20 12,20 Z M12.7287834,7.27532214 C12.9203342,7.46687299 13.0199347,7.73174979 13.0020527,8.00205275 L13.0020527,12.0020527 C13.0199347,12.2723557 12.9203342,12.5372325 12.7287834,12.7287834 C12.5372325,12.9203342 12.2723557,13.0199347 12.0020527,13.0020527 C11.7317498,13.0199347 11.466873,12.9203342 11.2753221,12.7287834 C11.0837713,12.5372325 10.9841708,12.2723557 11.0020527,12.0020527 L11.0020527,8.00205275 C10.9841708,7.73174979 11.0837713,7.46687299 11.2753221,7.27532214 C11.466873,7.08377129 11.7317498,6.98417081 12.0020527,7.00205275 C12.2723557,6.98417081 12.5372325,7.08377129 12.7287834,7.27532214 Z M12.7287834,15.2753221 C12.9203342,15.466873 13.0199347,15.7317498 13.0020527,16.0020527 C13.0199347,16.2723557 12.9203342,16.5372325 12.7287834,16.7287834 C12.5372325,16.9203342 12.2723557,17.0199347 12.0020527,17.0020527 C11.7317498,17.0199347 11.466873,16.9203342 11.2753221,16.7287834 C11.0837713,16.5372325 10.9841708,16.2723557 11.0020527,16.0020527 C10.9841708,15.7317498 11.0837713,15.466873 11.2753221,15.2753221 C11.466873,15.0837713 11.7317498,14.9841708 12.0020527,15.0020527 C12.2723557,14.9841708 12.5372325,15.0837713 12.7287834,15.2753221 Z"
426
+ })), at = (e) => /* @__PURE__ */ t.createElement("svg", {
427
+ viewBox: "0 0 24 24",
428
+ width: 24,
429
+ height: 24,
430
+ fill: "currentColor",
431
+ "aria-hidden": "true",
432
+ ...e
433
+ }, /* @__PURE__ */ t.createElement("path", {
434
+ d: "M17,17 C17,18.6568542 15.6568542,20 14,20 L9,20 C7.34314575,20 6,18.6568542 6,17 L6,7 L5,7 L5,6 L18,6 L18,7 L17,7 L17,17 Z M9,9 L10,9 L10,16 L9,16 L9,9 Z M11,9 L12,9 L12,16 L11,16 L11,9 Z M13,9 L14,9 L14,16 L13,16 L13,9 Z M7,17 C7,18.1045695 7.8954305,19 9,19 L14,19 C15.1045695,19 16,18.1045695 16,17 L16,7 L7,7 L7,17 Z M13,6 L13,5 L10,5 L10,6 L9,6 L9,5 C9,4.44771525 9.44771525,4 10,4 L13,4 C13.5522847,4 14,4.44771525 14,5 L14,6 L13,6 Z"
435
+ })), st = () => {
436
+ const n = "calc(50% - 2px)";
437
+ return /* @__PURE__ */ t.createElement("svg", {
438
+ fill: "none",
439
+ width: "100%",
440
+ height: "100%",
441
+ viewBox: "0 0 32 32"
442
+ }, /* @__PURE__ */ t.createElement("circle", {
443
+ cx: "50%",
444
+ cy: "50%",
445
+ r: n
446
+ }), /* @__PURE__ */ t.createElement("circle", {
447
+ cx: "50%",
448
+ cy: "50%",
449
+ r: n,
450
+ // Normalize the path length to 100 so we can easily set stroke-dashoffset to a fixed arc.
451
+ pathLength: "100",
452
+ // Add extra gap between dashes so the arc reads correctly in Chrome.
453
+ strokeDasharray: "100 200",
454
+ strokeDashoffset: 75,
455
+ strokeLinecap: "round",
456
+ style: {
457
+ rotate: "-90deg",
458
+ transformOrigin: "center center"
459
+ }
460
+ }, /* @__PURE__ */ t.createElement("animateTransform", {
461
+ attributeName: "transform",
462
+ type: "rotate",
463
+ dur: "0.75s",
464
+ values: "0;360",
465
+ repeatCount: "indefinite"
466
+ })));
467
+ }, it = "_dropZone_cj70x_1", ct = "_dropZoneHover_cj70x_30", dt = "_dropZoneTitle_cj70x_55", ut = "_dropZoneSubtitle_cj70x_60", mt = "_button_cj70x_64", pt = "_buttonHover_cj70x_114", ft = "_explanation_cj70x_131", Et = "_files_cj70x_135", bt = "_file_cj70x_135", Ft = "_fileName_cj70x_185", gt = "_removeButton_cj70x_193", xt = "_spinner_cj70x_234", ht = "_fileError_cj70x_250", D = {
468
+ dropZone: it,
469
+ dropZoneHover: ct,
470
+ dropZoneTitle: dt,
471
+ dropZoneSubtitle: ut,
472
+ button: mt,
473
+ buttonHover: pt,
474
+ explanation: ft,
475
+ files: Et,
476
+ file: bt,
477
+ fileName: Ft,
478
+ removeButton: gt,
479
+ spinner: xt,
480
+ fileError: ht
481
+ }, _t = ({ content: e, locale: n }) => /* @__PURE__ */ t.createElement(Ce, {
482
+ content: e,
483
+ locale: n
484
+ }), Ct = () => {
485
+ var I, F, T, y;
486
+ const { t: e } = re(), { disabled: n, readOnly: r } = k(), l = !n && !r, s = pe({
487
+ globalClasses: ue,
488
+ moduleClasses: {
489
+ base: D.dropZone,
490
+ hover: D.dropZoneHover
491
+ }
492
+ }), u = pe({
493
+ globalClasses: Ie,
494
+ moduleClasses: {
495
+ base: D.button,
496
+ hover: D.buttonHover
497
+ }
498
+ }), E = (y = (T = (F = (I = Be().dropZone) == null ? void 0 : I.elementProps) == null ? void 0 : F.uploadButton) == null ? void 0 : T.elementProps) == null ? void 0 : y.icon, { wix: L, className: o, ...i } = E ?? {}, N = ye(te.DROP_ZONE, te.UPLOAD_BUTTON, te.UPLOAD_BUTTON_LABEL), m = H(null), [p, d] = J(!1), v = M(() => {
499
+ var c;
500
+ d(!0), (c = m.current) == null || c.runAnimationForward();
501
+ }, []), h = M(() => {
502
+ var c;
503
+ d(!1), (c = m.current) == null || c.runAnimationBackward();
504
+ }, []);
505
+ return /* @__PURE__ */ t.createElement(a, null, /* @__PURE__ */ t.createElement(a.Label, {
506
+ className: R(Ze, K.label)
507
+ }, /* @__PURE__ */ t.createElement(a.Label.Required, {
508
+ className: R(Re, K.requiredMark)
509
+ })), /* @__PURE__ */ t.createElement(a.DropZone, {
510
+ className: ({ isHovered: c, isDropTarget: S }) => s({
511
+ isSelected: !1,
512
+ isHovered: c || S,
513
+ isInteractive: l
514
+ })
515
+ }, /* @__PURE__ */ t.createElement(a.DropZone.Title, {
516
+ className: D.dropZoneTitle
517
+ }, ({ limitReached: c }) => e(c ? "file-upload.dropzone.limit-reached.title" : "file-upload.dropzone.title")), /* @__PURE__ */ t.createElement(a.DropZone.Subtitle, {
518
+ className: D.dropZoneSubtitle
519
+ }, ({ limitReached: c }) => e(c ? "file-upload.dropzone.limit-reached.subtitle" : "file-upload.dropzone.subtitle")), /* @__PURE__ */ t.createElement(a.DropZone.Button, {
520
+ className: ({ isHovered: c }) => u({
521
+ isSelected: !1,
522
+ isHovered: c,
523
+ isInteractive: l
524
+ }),
525
+ "aria-roledescription": e("file-upload.aria-roledescription"),
526
+ onHoverStart: v,
527
+ onHoverEnd: h
528
+ }, i.svg ? /* @__PURE__ */ t.createElement(_e, {
529
+ ...i,
530
+ ref: m,
531
+ className: R(Ae, Me, o)
532
+ }) : E ? null : /* @__PURE__ */ t.createElement(ot, null), /* @__PURE__ */ t.createElement(a.DropZone.Button.Text, {
533
+ className: R(ce.base, N, {
534
+ [ce.hover]: l && p
535
+ })
536
+ }))), /* @__PURE__ */ t.createElement(a.Explanation, {
537
+ className: R(de, K.description, D.explanation),
538
+ showUploadStatusOnly: !0
539
+ }), /* @__PURE__ */ t.createElement(a.Files, {
540
+ className: D.files
541
+ }, /* @__PURE__ */ t.createElement(a.Files.File, {
542
+ className: R(ue.base, D.file)
543
+ }, /* @__PURE__ */ t.createElement(a.Files.File.Name, {
544
+ className: D.fileName
545
+ }), /* @__PURE__ */ t.createElement(a.Files.File.Spinner, {
546
+ className: D.spinner,
547
+ "aria-label": e("file-upload.file.uploading-spinner.aria-label")
548
+ }, /* @__PURE__ */ t.createElement(st, null)), /* @__PURE__ */ t.createElement(a.Files.File.Remove, {
549
+ className: D.removeButton,
550
+ "aria-label": e("file-upload.delete-file.aria-label")
551
+ }, /* @__PURE__ */ t.createElement(at, null)), /* @__PURE__ */ t.createElement(a.Files.File.Error, {
552
+ className: R(me, K.error, D.fileError)
553
+ }, /* @__PURE__ */ t.createElement(lt, null), /* @__PURE__ */ t.createElement(a.Files.File.Error.Text, null)))), /* @__PURE__ */ t.createElement(a.Description, {
554
+ className: R(de, K.description)
555
+ }, _t), /* @__PURE__ */ t.createElement(a.Error, {
556
+ className: R(me, K.error)
557
+ }, /* @__PURE__ */ t.createElement(Oe, null), /* @__PURE__ */ t.createElement(a.Error.Text, null)));
558
+ }, Ot = () => /* @__PURE__ */ t.createElement(Ct, null);
559
+ export {
560
+ Ot as FileUploadRAC
561
+ };
@@ -1,22 +1,22 @@
1
1
  import t, { useMemo as _ } from "react";
2
2
  import { RicosViewer as A } from "@wix/ricos/viewer";
3
3
  import u from "classnames";
4
- import { b5 as C, aZ as I, b2 as P, H as O, I as S, p as x } from "./form-0jt4L5xo.js";
4
+ import { b9 as C, b1 as I, b6 as P, I as O, J as S, p as x } from "./form-DC8xFBa_.js";
5
5
  import { f as c, a as N } from "./find-child-C60k4CxG.js";
6
6
  import { f as R } from "./format-currency-BwShJ9vM.js";
7
- import { D as v, E as M } from "./field-error-headless-tsg9FQ-_.js";
8
- import { L as g } from "./field-label-headless-CB8dEat8.js";
7
+ import { D as v, E as M } from "./field-error-headless-BLgaEh1d.js";
8
+ import { L as g } from "./field-label-headless-C8NbnF9M.js";
9
9
  import { s as L } from "./field-rac.module-B4l_0KRU.js";
10
10
  const e = ({ children: r }) => {
11
11
  var p;
12
- const { id: n, validation: a, FieldLayout: l } = C(), { currency: o, regionalFormat: m } = I(), s = _(() => {
12
+ const { id: a, validation: n, FieldLayout: l } = C(), { currency: o, regionalFormat: m } = I(), s = _(() => {
13
13
  var d, E, f;
14
- return (f = (E = (d = a == null ? void 0 : a.predefined) == null ? void 0 : d.paymentOptions) == null ? void 0 : E.products) == null ? void 0 : f[0];
14
+ return (f = (E = (d = n == null ? void 0 : n.predefined) == null ? void 0 : d.paymentOptions) == null ? void 0 : E.products) == null ? void 0 : f[0];
15
15
  }, [
16
- a
16
+ n
17
17
  ]), i = (p = s == null ? void 0 : s.fixedPriceOptions) == null ? void 0 : p.price, y = c(r, e.Label), F = c(r, e.Amount), b = c(r, e.Description), D = c(r, e.Error);
18
18
  return /* @__PURE__ */ t.createElement(l, {
19
- fieldId: n,
19
+ fieldId: a,
20
20
  renderLabel: () => y,
21
21
  renderInput: () => N(F, {
22
22
  price: i,
@@ -25,9 +25,9 @@ const e = ({ children: r }) => {
25
25
  }),
26
26
  renderDescription: () => /* @__PURE__ */ t.createElement(t.Fragment, null, D, b)
27
27
  });
28
- }, B = ({ className: r, ...n }) => {
29
- const { price: a, currencyCode: l, locale: o } = n, { inputId: m, ariaDescribedBy: s } = P(), i = R({
30
- amount: a,
28
+ }, B = ({ className: r, ...a }) => {
29
+ const { price: n, currencyCode: l, locale: o } = a, { inputId: m, ariaDescribedBy: s } = P(), i = R({
30
+ amount: n,
31
31
  currency: l,
32
32
  locale: o
33
33
  });
@@ -46,16 +46,16 @@ e.Description = v;
46
46
  e.Error = M;
47
47
  const V = "_value_c7203_1", k = {
48
48
  value: V
49
- }, w = ({ content: r, locale: n }) => /* @__PURE__ */ t.createElement(A, {
49
+ }, w = ({ content: r, locale: a }) => /* @__PURE__ */ t.createElement(A, {
50
50
  content: r,
51
- locale: n
52
- }), H = () => /* @__PURE__ */ t.createElement(e, null, /* @__PURE__ */ t.createElement(e.Label, {
51
+ locale: a
52
+ }), J = () => /* @__PURE__ */ t.createElement(e, null, /* @__PURE__ */ t.createElement(e.Label, {
53
53
  className: u(O, L.label)
54
54
  }), /* @__PURE__ */ t.createElement(e.Amount, {
55
55
  className: u(S, k.value)
56
56
  }), /* @__PURE__ */ t.createElement(e.Description, {
57
57
  className: u(x, L.description)
58
- }, w)), U = () => /* @__PURE__ */ t.createElement(H, null);
58
+ }, w)), W = () => /* @__PURE__ */ t.createElement(J, null);
59
59
  export {
60
- U as FixedPaymentRAC
60
+ W as FixedPaymentRAC
61
61
  };