@wix/form-elements 1.133.0 → 1.135.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 (114) hide show
  1. package/dist/component/{appointment-rac-D0mwr3TL.js → appointment-rac-CYCddSl9.js} +246 -246
  2. package/dist/component/{bookings-address-rac-BEnmwXax.js → bookings-address-rac-BK-sU26E.js} +1 -1
  3. package/dist/component/{bookings-email-rac-D56j9PXc.js → bookings-email-rac-DZ3HVkyn.js} +1 -1
  4. package/dist/component/{bookings-first-name-rac-xu3S-ih_.js → bookings-first-name-rac-Ci4PHqOr.js} +1 -1
  5. package/dist/component/{bookings-header-rac-hfBabv7v.js → bookings-header-rac-C_MYNrDA.js} +1 -1
  6. package/dist/component/{bookings-last-name-rac-6bMvN0Cm.js → bookings-last-name-rac-CdNlwyjm.js} +1 -1
  7. package/dist/component/{bookings-login-bar-rac-DE70Omwf.js → bookings-login-bar-rac-CP2JcaVr.js} +17 -17
  8. package/dist/component/{bookings-phone-rac-D_EHRAiU.js → bookings-phone-rac-BV8sqxil.js} +1 -1
  9. package/dist/component/{bookings-rich-text-rac-BxgI9Zt6.js → bookings-rich-text-rac-DQtcYRsh.js} +1 -1
  10. package/dist/component/{calendar.module-DnhTT4QT.js → calendar.module-CKCBG_Pg.js} +11 -11
  11. package/dist/component/{checkbox-field-rac-BLDUOAXM.js → checkbox-field-rac-DPNqHTNc.js} +26 -25
  12. package/dist/component/{checkbox-group-field-headless-CugSJIBp.js → checkbox-group-field-headless-DhhynlgN.js} +32 -31
  13. package/dist/component/{checkbox-group-field-rac-D4m9SmRX.js → checkbox-group-field-rac-B3zOW7qr.js} +6 -6
  14. package/dist/component/{checkbox-group-rac-BYqEsCwa.js → checkbox-group-rac-Qy03hO31.js} +1 -1
  15. package/dist/component/{checkbox-indicator-module-classes-zXKP5rD4.js → checkbox-indicator-module-classes-6173wvuW.js} +1 -1
  16. package/dist/component/{checkbox-rac-DkIBUAN7.js → checkbox-rac-DYr3RaHj.js} +1 -1
  17. package/dist/component/{contacts-address-rac-D1tzbiTM.js → contacts-address-rac-Bi-etpfX.js} +1 -1
  18. package/dist/component/{contacts-birthdate-rac-DO-1xG0u.js → contacts-birthdate-rac-D2LLjX9P.js} +1 -1
  19. package/dist/component/{contacts-company-rac-CzJK3YIo.js → contacts-company-rac-C9ImoG_i.js} +1 -1
  20. package/dist/component/{contacts-email-rac-DLvMErBI.js → contacts-email-rac-DeGblC9V.js} +1 -1
  21. package/dist/component/{contacts-first-name-rac-3RcSXL0h.js → contacts-first-name-rac-Xk3m57jK.js} +1 -1
  22. package/dist/component/{contacts-last-name-rac-BYoSi_QX.js → contacts-last-name-rac-BKE-1IYB.js} +1 -1
  23. package/dist/component/{contacts-phone-rac-DMYn0orB.js → contacts-phone-rac-CHmtTutD.js} +1 -1
  24. package/dist/component/{contacts-position-rac-K1R6ihXo.js → contacts-position-rac-BS3TySLG.js} +1 -1
  25. package/dist/component/{contacts-subscribe-rac-DsWNSH6t.js → contacts-subscribe-rac--fpczJiB.js} +1 -1
  26. package/dist/component/{contacts-tax-id-rac-D7NjPiRf.js → contacts-tax-id-rac-CHkn8vkL.js} +1 -1
  27. package/dist/component/{date-availability-D3n6-g3h.js → date-availability-70Vb-dlb.js} +1 -1
  28. package/dist/component/{date-input-field-rac-SyAmInlu.js → date-input-field-rac-BlkYEYM_.js} +60 -60
  29. package/dist/component/{date-input-rac-BQNOsWz1.js → date-input-rac-JdNFk07Q.js} +1 -1
  30. package/dist/component/{date-picker-field-rac-DO1epod7.js → date-picker-field-rac-DHu11mY1.js} +63 -63
  31. package/dist/component/{date-picker-rac-DQElftUu.js → date-picker-rac-CZtWhFzM.js} +1 -1
  32. package/dist/component/{date-time-input-field-rac-CV5wZSXO.js → date-time-input-field-rac-cHAALqS5.js} +7 -7
  33. package/dist/component/{date-time-input-rac-DvHwpjnk.js → date-time-input-rac-Dz7GfoJO.js} +1 -1
  34. package/dist/component/{dext-checkbox-group-rac-BfcKoslb.js → dext-checkbox-group-rac-ZNKzyWda.js} +2 -2
  35. package/dist/component/{dext-checkbox-rac-DhadtXb5.js → dext-checkbox-rac-DfPFXrKu.js} +1 -1
  36. package/dist/component/{dext-date-picker-rac-0Dmo3mrG.js → dext-date-picker-rac-BPbl65qK.js} +1 -1
  37. package/dist/component/{dext-date-time-input-rac-Cnh7Aqiq.js → dext-date-time-input-rac-D5ywbLtW.js} +1 -1
  38. package/dist/component/{dext-dropdown-rac-CajXcYsB.js → dext-dropdown-rac-BuVsPZOU.js} +1 -1
  39. package/dist/component/{dext-email-rac-DynJaiZt.js → dext-email-rac-DRjt3lqT.js} +1 -1
  40. package/dist/component/{dext-number-input-rac-LmTKwb80.js → dext-number-input-rac-Bzrl87fo.js} +1 -1
  41. package/dist/component/{dext-phone-rac-Cw2roq1_.js → dext-phone-rac-LibvQb8h.js} +1 -1
  42. package/dist/component/{dext-radio-group-rac-CaNZJrkc.js → dext-radio-group-rac-BTWnIvwW.js} +2 -2
  43. package/dist/component/{dext-rating-input-rac-CAL1jb0q.js → dext-rating-input-rac-DTlnOcC8.js} +1 -1
  44. package/dist/component/{dext-tags-rac-BOp_amVK.js → dext-tags-rac-YdeijviH.js} +2 -2
  45. package/dist/component/{dext-text-area-rac-6DYTHIeh.js → dext-text-area-rac-CdCzQYey.js} +1 -1
  46. package/dist/component/{dext-text-input-rac-CDWthvV3.js → dext-text-input-rac-B28RTezm.js} +1 -1
  47. package/dist/component/{dext-url-input-rac-CsS4NPYO.js → dext-url-input-rac-B0ZBPbAb.js} +1 -1
  48. package/dist/component/{donation-rac-B7lFkotu.js → donation-rac-_0cwsIAq.js} +7 -10
  49. package/dist/component/{dropdown-field-headless-ajQghLaj.js → dropdown-field-headless-DVZnbZAM.js} +5 -5
  50. package/dist/component/{dropdown-field-rac-Bf5LQqSL.js → dropdown-field-rac-DWCj_Grt.js} +5 -5
  51. package/dist/component/{dropdown-rac-CJmA_ePl.js → dropdown-rac-Bpo-F5sc.js} +1 -1
  52. package/dist/component/{ecom-address-rac-B49ZP2qc.js → ecom-address-rac-vJ0ku_Ld.js} +1 -1
  53. package/dist/component/{ecom-subscription-checkbox-rac-C8qImtxo.js → ecom-subscription-checkbox-rac-DgVReM6c.js} +2 -2
  54. package/dist/component/{email-input-field-rac-B_bEWp5N.js → email-input-field-rac-BXJGOBg-.js} +4 -4
  55. package/dist/component/{events-repeater-rac-DXxqmIBX.js → events-repeater-rac-CrXE_ppd.js} +48 -47
  56. package/dist/component/{events-rsvp-rac-BaJQLSv3.js → events-rsvp-rac-BGg3P1CQ.js} +4 -4
  57. package/dist/component/{field-error-headless-BxEFPwKI.js → field-error-headless-C3eOy1_l.js} +1 -1
  58. package/dist/component/{field-label-headless-5mewgrhq.js → field-label-headless-BMmR_IeF.js} +1 -1
  59. package/dist/component/field-rac.module-DfEb7pBp.js +25 -0
  60. package/dist/component/file-upload-rac-Umix6wXx.js +566 -0
  61. package/dist/component/{fixed-payment-rac-S68bqvbB.js → fixed-payment-rac-CfIJCBjb.js} +4 -4
  62. package/dist/component/{form-CPY-PtxT.js → form-CYPNOMwk.js} +1685 -1641
  63. package/dist/component/form.css +1 -1
  64. package/dist/component/form.js +1 -1
  65. package/dist/component/{header-field-rac-r6dYbnvA.js → header-field-rac-oxHUTKYV.js} +2 -2
  66. package/dist/component/{header-rac-C9gaKsaE.js → header-rac-DTGV923r.js} +1 -1
  67. package/dist/component/{image-choice-rac-BbES5dAK.js → image-choice-rac-B9JGl_h7.js} +42 -45
  68. package/dist/component/{index-o-TpCHqo.js → index-BOKSOnDK.js} +4 -4
  69. package/dist/component/{index-C6zuIVeJ.js → index-C_ktc-yO.js} +2 -2
  70. package/dist/component/{isObjectLike-BSRiBVs9.js → isObjectLike-Di8V7txC.js} +1 -1
  71. package/dist/component/{multiline-address-field-rac-BfVIiFyM.js → multiline-address-field-rac-zgmTbXlg.js} +8 -8
  72. package/dist/component/{multiline-address-rac-BOKBExhi.js → multiline-address-rac-Cyb3dvBf.js} +1 -1
  73. package/dist/component/{number-input-field-rac-BRKFm8aA.js → number-input-field-rac-DquqqRy_.js} +5 -5
  74. package/dist/component/{number-input-rac-BNbCCb-g.js → number-input-rac-G2DdTbk2.js} +1 -1
  75. package/dist/component/{password-rac-BygVJf7f.js → password-rac-DJCU0F38.js} +5 -5
  76. package/dist/component/{payment-input-rac-CoMbHcHG.js → payment-input-rac-DlIYza6N.js} +5 -5
  77. package/dist/component/{phone-input-field-rac-dFjxptEr.js → phone-input-field-rac-B10TInMa.js} +28 -29
  78. package/dist/component/{phone-rac-Dup3AP9J.js → phone-rac-BuyttJpM.js} +1 -1
  79. package/dist/component/{product-list-rac-B62mNB_W.js → product-list-rac-WrSJwQ_g.js} +69 -68
  80. package/dist/component/{quiz-radio-group-rac-DPMhDtr7.js → quiz-radio-group-rac-CHxZ_pK_.js} +1 -1
  81. package/dist/component/{radio-button-module-classes-BMvPai_6.js → radio-button-module-classes-DjJU-8ZB.js} +18 -17
  82. package/dist/component/{radio-group-field-rac-DPt2Zl4G.js → radio-group-field-rac-BImiqcKa.js} +5 -5
  83. package/dist/component/{radio-group-rac-BZyGqFzr.js → radio-group-rac-CDkJeGpN.js} +1 -1
  84. package/dist/component/{rating-input-field-rac-C3E0KzV-.js → rating-input-field-rac-Dsr_S5qN.js} +35 -33
  85. package/dist/component/{rating-input-rac-BKLz4l_D.js → rating-input-rac-BJUW8U93.js} +1 -1
  86. package/dist/component/{rich-content-rac.module-CQ1qa_zz.js → rich-content-rac.module-BfQJqA-x.js} +1 -1
  87. package/dist/component/{rich-text-field-rac-BfdA5KNz.js → rich-text-field-rac-DIuZbu_u.js} +2 -2
  88. package/dist/component/{rich-text-rac-BFbhfFuF.js → rich-text-rac-C39fpEiP.js} +1 -1
  89. package/dist/component/{service-dropdown-rac-VulpHBki.js → service-dropdown-rac-Bc9hEpx3.js} +6 -6
  90. package/dist/component/{services-multi-choice-rac-CIx5UpfD.js → services-multi-choice-rac-GVb4qA7g.js} +7 -7
  91. package/dist/component/{signature-rac-BdxMBfl9.js → signature-rac-nC5pr6nB.js} +269 -264
  92. package/dist/component/{submit-button-rac-CkuWGEyL.js → submit-button-rac-eUjgrx9Q.js} +2 -2
  93. package/dist/component/{tags-field-rac-DKo_Yb5i.js → tags-field-rac-zv30chSd.js} +54 -57
  94. package/dist/component/{tags-rac-BimVd3ym.js → tags-rac-PnS2SxVP.js} +1 -1
  95. package/dist/component/{text-area-field-rac-DEiLtCnb.js → text-area-field-rac-DLeOMD4g.js} +5 -5
  96. package/dist/component/{text-area-rac-CHZtsq0f.js → text-area-rac-jZ_mh45C.js} +1 -1
  97. package/dist/component/{text-input-field-rac-CSHvUtRG.js → text-input-field-rac-DifV7Erd.js} +4 -4
  98. package/dist/component/{text-input-headless-BYcExFPS.js → text-input-headless-DhVEjorY.js} +3 -3
  99. package/dist/component/{text-input-rac-D-R9btYo.js → text-input-rac-Ce4qKN9M.js} +1 -1
  100. package/dist/component/{time-input-rac-wkHemVzj.js → time-input-rac-1kW3aDIo.js} +5 -5
  101. package/dist/component/{url-input-field-rac-KJEcLyFk.js → url-input-field-rac-D9xXAQCq.js} +5 -5
  102. package/dist/component/{url-input-rac-JFfEH389.js → url-input-rac-SaAybDdN.js} +1 -1
  103. package/dist/component/{use-dropdown-option-class-name-BetaTWbW.js → use-dropdown-option-class-name-C_MO_0JS.js} +3 -3
  104. package/dist/component/{use-dropdown-trigger-class-name-C0ffAjFn.js → use-dropdown-trigger-class-name-D7EMiD-M.js} +2 -2
  105. package/dist/component/use-element-state-class-name-DZFi3Z42.js +23 -0
  106. package/dist/component/use-hoverable-input-class-name-JAZ1mif0.js +25 -0
  107. package/dist/component/{use-service-options-base-q0JTA7UI.js → use-service-options-base-ZX4iaxzr.js} +1 -1
  108. package/dist/component/use-text-input-class-name-XFjQX8q1.js +6 -0
  109. package/package.json +2 -2
  110. package/dist/component/field-rac.module-BGN-O8tV.js +0 -25
  111. package/dist/component/file-upload-rac-D9Z1Cumr.js +0 -562
  112. package/dist/component/use-element-state-class-name-BOks3she.js +0 -20
  113. package/dist/component/use-hoverable-input-class-name-jxtCw16L.js +0 -23
  114. package/dist/component/use-text-input-class-name-CTa0bC4T.js +0 -6
@@ -0,0 +1,566 @@
1
+ import t, { useState as Y, useRef as H, useMemo as fe, useEffect as ne, useCallback as M, createContext as he, useContext as _e } from "react";
2
+ import Le from "@wix/editor-react-components/AnimatedIcon";
3
+ import { RicosViewer as Ce } from "@wix/ricos/viewer";
4
+ import A from "classnames";
5
+ import { bd as xe, br as oe, bm as Ne, ak as ve, bp as De, ad as ie, bq as Te, be as Ee, bh as z, bj as Se, bb as Be, ba as ye, I as Ze, U as Re, b as Ae, a8 as Ie, a9 as ce, p as ue, u as de, v as me, a7 as Me, f as te } from "./form-CYPNOMwk.js";
6
+ import { E as Oe } from "./error-icon-hZxQ6DEy.js";
7
+ import { s as $ } from "./field-rac.module-DfEb7pBp.js";
8
+ import { u as pe } from "./use-element-state-class-name-DZFi3Z42.js";
9
+ import { DropZone as we, Text as Ue, FileTrigger as Pe, Button as be, ProgressBar as qe, VisuallyHidden as He } from "react-aria-components";
10
+ import { f as L, a as W } from "./find-child-C60k4CxG.js";
11
+ import { b as ke, a as ze, D as Ve, E as je } from "./field-error-headless-C3eOy1_l.js";
12
+ import { L as Ke } from "./field-label-headless-BMmR_IeF.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: o } = xe();
22
+ return async (a, s, d) => {
23
+ if (!(n != null && n.uploadFile) || !a.length)
24
+ return n != null && n.uploadFile || console.error("No uploadFile action"), a.length || console.error("No files to upload"), [];
25
+ const E = a.map(({ file: r }) => n.uploadFile({
26
+ file: r,
27
+ formId: o,
28
+ uploadTarget: e
29
+ }).then((i) => {
30
+ const { id: x, displayName: m, url: p, isPrivate: c } = i, T = {
31
+ fileId: x,
32
+ displayName: m || r.name,
33
+ url: c ? void 0 : p,
34
+ fileType: r.type || "application/octet-stream"
35
+ };
36
+ return s({
37
+ file: r,
38
+ uploadedFile: T
39
+ }), T;
40
+ }).catch((i) => {
41
+ d(i, r);
42
+ }));
43
+ return (await Promise.all(E)).filter((r) => r !== void 0);
44
+ };
45
+ };
46
+ function We({ valueSliderLimit: e, value: n, explanationText: o, target: a, onChange: s, uploadFileFormats: d, onBlur: E, onFilesCleared: C }) {
47
+ const [r, i] = Y(Qe(n)), [x, m] = Y(n || []), [p, c] = Y(), T = Ye(a), { t: N } = oe(), F = Ne().includes(ve.BUTTONS_HOVER), { setFormStatus: B } = De(), Z = H(!1), y = H(s);
48
+ y.current = s;
49
+ const v = fe(() => r.some((f) => f.state === "uploading"), [
50
+ r
51
+ ]);
52
+ ne(() => {
53
+ Z.current !== v && (Z.current = v, B(a, v ? ie.BUSY : ie.READY));
54
+ }, [
55
+ v,
56
+ B,
57
+ a
58
+ ]);
59
+ const u = M(() => {
60
+ if (!r.length)
61
+ return;
62
+ const h = r.filter((f) => f.state === "uploading").length;
63
+ if (h) {
64
+ const f = r.filter((b) => b.state === "uploaded" && b.file.size > 0).length, _ = f / (f + h);
65
+ return N("form.file-upload.uploading", {
66
+ count: Math.round(_ * 100)
67
+ });
68
+ }
69
+ return N("form.file-upload.explanation-text", {
70
+ count: r.length
71
+ });
72
+ }, [
73
+ r,
74
+ N
75
+ ]), R = M(() => r.length ? r.some((f) => f.state === "uploading") ? u() : o || u() : o, [
76
+ r,
77
+ o,
78
+ u
79
+ ]), S = M(async (h) => {
80
+ await T(h, ({ file: f, uploadedFile: _ }) => {
81
+ i((b) => b.map((g) => g.file === f ? {
82
+ file: f,
83
+ state: "uploaded"
84
+ } : g)), m((b) => {
85
+ var U;
86
+ const g = [
87
+ ...b
88
+ ].concat(_);
89
+ return (U = y.current) == null || U.call(y, g), g;
90
+ });
91
+ }, (f, _) => {
92
+ i((b) => b.map((g) => g.file === _ ? {
93
+ file: _,
94
+ state: "error",
95
+ errorMessage: N("form.file-upload.error.upload-failed")
96
+ } : g));
97
+ });
98
+ }, [
99
+ T,
100
+ N
101
+ ]), j = async (h) => {
102
+ if (p && c(void 0), h) {
103
+ if (r.length + h.length > e) {
104
+ c(N("form.file-upload.error.upload-limit", {
105
+ limit: e
106
+ }));
107
+ return;
108
+ }
109
+ const b = Array.from(h).reduce((g, U) => (r.some((P) => P.file.name === U.name) || g.push({
110
+ file: U,
111
+ state: "uploading"
112
+ }), g), []);
113
+ i([
114
+ ...r,
115
+ ...b
116
+ ]), await S(b);
117
+ }
118
+ }, w = (h) => {
119
+ const f = r[h];
120
+ if (x && s && f.state !== "error") {
121
+ const _ = x.filter((g) => g.displayName !== f.file.name);
122
+ s(_), m(_);
123
+ const b = r.filter((g) => g.file.name !== f.file.name);
124
+ i(b), b.length === 0 && C();
125
+ } else {
126
+ const _ = r.filter((b) => b !== f);
127
+ i(_), _.length === 0 && C();
128
+ }
129
+ }, K = () => {
130
+ p && c(void 0), E();
131
+ }, Q = d.map((h) => $e[h]).join(), X = M(() => {
132
+ i([]), m([]);
133
+ }, []);
134
+ return Te(X), {
135
+ files: r,
136
+ limitError: p,
137
+ hover: F,
138
+ getExplanationText: R,
139
+ getStatusText: u,
140
+ handleChange: j,
141
+ handleDelete: w,
142
+ accept: Q,
143
+ handleBlur: K
144
+ };
145
+ }
146
+ function Qe(e = []) {
147
+ const n = e || [];
148
+ try {
149
+ return n.map((o) => ({
150
+ file: new File([
151
+ new Int8Array(0)
152
+ ], o.displayName, {
153
+ type: o.fileType
154
+ }),
155
+ state: "uploaded"
156
+ }));
157
+ } catch (o) {
158
+ console.error(o);
159
+ }
160
+ return [];
161
+ }
162
+ const ge = /* @__PURE__ */ he(void 0);
163
+ function V() {
164
+ const e = _e(ge);
165
+ if (typeof e > "u")
166
+ throw new Error("FileUpload components must be used within FileUpload");
167
+ return e;
168
+ }
169
+ const k = ({ children: e, className: n }) => {
170
+ const { ariaDescribedBy: o } = Ee(), { disabled: a, hasError: s } = z(), { handleFileChange: d, limitReached: E } = V();
171
+ if (E)
172
+ return null;
173
+ const C = L(e, k.Title), r = L(e, k.Subtitle), i = L(e, k.Button);
174
+ return /* @__PURE__ */ t.createElement(we, {
175
+ "aria-describedby": o,
176
+ className: n,
177
+ "data-invalid": s,
178
+ isDisabled: a,
179
+ onDrop: async (x) => {
180
+ const m = [];
181
+ for (const p of x.items)
182
+ if (p.kind === "file") {
183
+ const c = await p.getFile();
184
+ c && m.push(c);
185
+ }
186
+ if (m.length > 0) {
187
+ const p = new DataTransfer();
188
+ m.forEach((c) => p.items.add(c)), d(p.files);
189
+ }
190
+ }
191
+ }, /* @__PURE__ */ t.createElement(Ue, {
192
+ slot: "label"
193
+ }, C, r), i);
194
+ }, Ge = ({ className: e, children: n }) => {
195
+ const { limitReached: o } = V();
196
+ return /* @__PURE__ */ t.createElement("p", {
197
+ className: e
198
+ }, n({
199
+ limitReached: o
200
+ }));
201
+ }, Je = ({ className: e, children: n }) => {
202
+ const { limitReached: o } = V(), { explanationText: a } = z();
203
+ return /* @__PURE__ */ t.createElement("p", {
204
+ className: e
205
+ }, a || n({
206
+ limitReached: o
207
+ }));
208
+ }, re = ({ className: e, children: n, "aria-roledescription": o, onHoverStart: a, onHoverEnd: s, onFocusChange: d }) => {
209
+ const { ariaDescribedBy: E, inputId: C, labelId: r, errorId: i } = Ee(), { disabled: x, required: m, onFocus: p, hasError: c, errorMessage: T } = z(), { handleFileChange: N, accept: O, multiple: F, buttonRef: B, handleBlur: Z, limitError: y, files: v } = V(), u = (v == null ? void 0 : v.some((S) => S.errorMessage)) ?? !1, R = !!(c || T || y || u);
210
+ return /* @__PURE__ */ t.createElement(Pe, {
211
+ acceptedFileTypes: O ? O.split(",") : void 0,
212
+ allowsMultiple: F,
213
+ onSelect: (S) => {
214
+ if (S) {
215
+ const j = Array.from(S), w = new DataTransfer();
216
+ j.forEach((K) => w.items.add(K)), N(w.files);
217
+ }
218
+ }
219
+ }, /* @__PURE__ */ t.createElement(be, {
220
+ ref: B,
221
+ id: C,
222
+ "aria-labelledby": r,
223
+ "aria-describedby": [
224
+ E,
225
+ i
226
+ ].filter(Boolean).join(" "),
227
+ render: (S) => /* @__PURE__ */ t.createElement("button", {
228
+ ...S,
229
+ "aria-roledescription": o,
230
+ "aria-invalid": R || void 0,
231
+ "aria-required": m
232
+ }),
233
+ isDisabled: x,
234
+ className: e,
235
+ onFocus: p,
236
+ onBlur: Z,
237
+ onHoverStart: a,
238
+ onHoverEnd: s,
239
+ onFocusChange: d
240
+ }, n));
241
+ }, Xe = ({ className: e }) => {
242
+ const { buttonText: n } = z();
243
+ return /* @__PURE__ */ t.createElement("span", {
244
+ className: e
245
+ }, n);
246
+ };
247
+ re.Text = Xe;
248
+ k.Title = Ge;
249
+ k.Subtitle = Je;
250
+ k.Button = re;
251
+ const I = ({ children: e, className: n, ...o }) => {
252
+ const { file: a, index: s } = o, d = a.file.name, E = L(e, I.Name), C = L(e, I.Remove), r = L(e, I.Spinner), i = L(e, I.Error);
253
+ return /* @__PURE__ */ t.createElement("div", {
254
+ className: n
255
+ }, W(E, {
256
+ fileName: d
257
+ }), a.state === "uploading" ? r : W(C, {
258
+ index: s,
259
+ fileName: d
260
+ }), a.errorMessage && W(i, {
261
+ errorMessage: a.errorMessage
262
+ }));
263
+ }, et = ({ className: e, ...n }) => {
264
+ const { fileName: o } = n;
265
+ return /* @__PURE__ */ t.createElement("span", {
266
+ className: e
267
+ }, o);
268
+ }, tt = ({ className: e, "aria-label": n, children: o, ...a }) => {
269
+ const { fileName: s, index: d } = a, { disabled: E } = z(), { handleDelete: C, fileRemoveButtonRefs: r } = V(), i = H(null);
270
+ ne(() => {
271
+ const m = r.current, p = s;
272
+ return m[p] = i, () => {
273
+ m[p] === i && (m[p] = void 0);
274
+ };
275
+ }, [
276
+ s,
277
+ r
278
+ ]);
279
+ const x = () => {
280
+ C(d);
281
+ };
282
+ return /* @__PURE__ */ t.createElement(be, {
283
+ ref: i,
284
+ "aria-disabled": E,
285
+ "aria-label": n,
286
+ "aria-description": s,
287
+ onClick: x,
288
+ className: e,
289
+ isDisabled: E
290
+ }, o);
291
+ }, Fe = ({ className: e, children: n, ...o }) => {
292
+ const { errorMessage: a } = o;
293
+ return a ? /* @__PURE__ */ t.createElement(ze, {
294
+ value: a
295
+ }, /* @__PURE__ */ t.createElement("div", {
296
+ className: e,
297
+ role: "alert"
298
+ }, n)) : null;
299
+ }, nt = ({ className: e, "aria-label": n, children: o }) => /* @__PURE__ */ t.createElement(qe, {
300
+ "aria-label": n,
301
+ className: e,
302
+ isIndeterminate: !0
303
+ }, o);
304
+ I.Name = et;
305
+ I.Remove = tt;
306
+ I.Spinner = nt;
307
+ I.Error = Fe;
308
+ Fe.Text = ke;
309
+ const ae = ({ children: e, className: n }) => {
310
+ const { files: o } = V(), a = L(e, ae.File);
311
+ return !o || o.length === 0 ? null : /* @__PURE__ */ t.createElement("div", {
312
+ className: n
313
+ }, o.map((s, d) => W(a, {
314
+ key: s.file.name || d,
315
+ file: s,
316
+ index: d
317
+ })));
318
+ };
319
+ ae.File = I;
320
+ const J = (e) => e.file.name, l = ({ children: e }) => {
321
+ const { t: n } = oe(), { id: o, value: a, onChange: s, uploadFileFormats: d, valueSliderLimit: E, target: C, explanationText: r, onBlur: i, hasError: x, errorMessage: m, FieldLayout: p } = z(), c = H(null), T = H({}), N = H(!1), O = M(() => {
322
+ c.current ? c.current.focus() : N.current = !0;
323
+ }, []), { files: F, limitError: B, hover: Z, getExplanationText: y, getStatusText: v, handleBlur: u, handleChange: R, handleDelete: S, accept: j } = We({
324
+ valueSliderLimit: E,
325
+ value: a,
326
+ explanationText: r,
327
+ target: C,
328
+ onChange: s,
329
+ uploadFileFormats: d,
330
+ onBlur: i,
331
+ onFilesCleared: O
332
+ }), w = M((P) => {
333
+ var se;
334
+ const G = F[P], q = J(G);
335
+ F.length > 1 && ((se = (F.filter((ee) => J(ee) !== q).map((ee) => T.current[J(ee)]).find(Boolean) ?? c).current) == null || se.focus()), S(P);
336
+ }, [
337
+ S,
338
+ F
339
+ ]);
340
+ ne(() => {
341
+ N.current && c.current && (N.current = !1, c.current.focus());
342
+ }, [
343
+ F
344
+ ]);
345
+ const K = E > 1, Q = F.length >= E, X = fe(() => ({
346
+ handleFileChange: R,
347
+ handleBlur: u,
348
+ handleDelete: w,
349
+ files: F,
350
+ accept: j,
351
+ limitReached: Q,
352
+ multiple: K,
353
+ getExplanationText: y,
354
+ getStatusText: v,
355
+ hover: Z,
356
+ limitError: B,
357
+ buttonRef: c,
358
+ fileRemoveButtonRefs: T
359
+ }), [
360
+ R,
361
+ u,
362
+ w,
363
+ F,
364
+ j,
365
+ Q,
366
+ K,
367
+ y,
368
+ v,
369
+ Z,
370
+ B
371
+ ]), h = L(e, l.Label), f = L(e, l.DropZone), _ = L(e, l.Button), b = L(e, l.Explanation), g = L(e, l.Files), U = L(e, l.Description), le = L(e, l.Error);
372
+ return Se(() => {
373
+ var P, G;
374
+ if (c.current) {
375
+ c.current.focus();
376
+ return;
377
+ }
378
+ (G = (P = F.map((q) => T.current[J(q)]).find((q) => q == null ? void 0 : q.current)) == null ? void 0 : P.current) == null || G.focus();
379
+ }, o), /* @__PURE__ */ t.createElement(ge.Provider, {
380
+ value: X
381
+ }, /* @__PURE__ */ t.createElement(p, {
382
+ fieldId: o,
383
+ renderLabel: () => h,
384
+ renderInput: () => f ?? _,
385
+ renderDescription: () => /* @__PURE__ */ t.createElement(t.Fragment, null, W(le, {
386
+ hasError: !!(x || B),
387
+ errorMessage: B ?? m
388
+ }), /* @__PURE__ */ t.createElement(He, {
389
+ role: "status",
390
+ "aria-live": "polite",
391
+ "aria-atomic": "true"
392
+ }, n("form.file-upload.explanation-text", {
393
+ count: F.length
394
+ })), b, g, U)
395
+ }));
396
+ }, ot = ({ className: e, showUploadStatusOnly: n }) => {
397
+ const { files: o, getExplanationText: a, getStatusText: s } = V(), d = n ? s() : a();
398
+ return o.length === 1 || !d ? null : /* @__PURE__ */ t.createElement("p", {
399
+ className: e
400
+ }, d);
401
+ };
402
+ l.Label = Ke;
403
+ l.DropZone = k;
404
+ l.Button = re;
405
+ l.Explanation = ot;
406
+ l.Files = ae;
407
+ l.Description = Ve;
408
+ l.Error = je;
409
+ const rt = (e) => /* @__PURE__ */ t.createElement("svg", {
410
+ viewBox: "0 0 24 24",
411
+ width: 24,
412
+ height: 24,
413
+ fill: "currentColor",
414
+ "aria-hidden": "true",
415
+ ...e
416
+ }, /* @__PURE__ */ t.createElement("path", {
417
+ 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"
418
+ })), at = (e) => /* @__PURE__ */ t.createElement("svg", {
419
+ viewBox: "0 0 24 24",
420
+ width: 24,
421
+ height: 24,
422
+ fill: "currentColor",
423
+ "aria-hidden": "true",
424
+ ...e
425
+ }, /* @__PURE__ */ t.createElement("path", {
426
+ 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"
427
+ })), lt = (e) => /* @__PURE__ */ t.createElement("svg", {
428
+ viewBox: "0 0 24 24",
429
+ width: 24,
430
+ height: 24,
431
+ fill: "currentColor",
432
+ "aria-hidden": "true",
433
+ ...e
434
+ }, /* @__PURE__ */ t.createElement("path", {
435
+ 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"
436
+ })), st = () => {
437
+ const n = "calc(50% - 2px)";
438
+ return /* @__PURE__ */ t.createElement("svg", {
439
+ fill: "none",
440
+ width: "100%",
441
+ height: "100%",
442
+ viewBox: "0 0 32 32"
443
+ }, /* @__PURE__ */ t.createElement("circle", {
444
+ cx: "50%",
445
+ cy: "50%",
446
+ r: n
447
+ }), /* @__PURE__ */ t.createElement("circle", {
448
+ cx: "50%",
449
+ cy: "50%",
450
+ r: n,
451
+ // Normalize the path length to 100 so we can easily set stroke-dashoffset to a fixed arc.
452
+ pathLength: "100",
453
+ // Add extra gap between dashes so the arc reads correctly in Chrome.
454
+ strokeDasharray: "100 200",
455
+ strokeDashoffset: 75,
456
+ strokeLinecap: "round",
457
+ style: {
458
+ rotate: "-90deg",
459
+ transformOrigin: "center center"
460
+ }
461
+ }, /* @__PURE__ */ t.createElement("animateTransform", {
462
+ attributeName: "transform",
463
+ type: "rotate",
464
+ dur: "0.75s",
465
+ values: "0;360",
466
+ repeatCount: "indefinite"
467
+ })));
468
+ }, it = "_dropZone_9tg5q_1", ct = "_dropZoneHover_9tg5q_27", ut = "_dropZoneTitle_9tg5q_52", dt = "_dropZoneSubtitle_9tg5q_57", mt = "_button_9tg5q_61", pt = "_buttonHover_9tg5q_114", ft = "_explanation_9tg5q_131", Et = "_files_9tg5q_135", bt = "_file_9tg5q_135", gt = "_fileName_9tg5q_185", Ft = "_buttonLabel_9tg5q_193", ht = "_removeButton_9tg5q_197", _t = "_spinner_9tg5q_244", Lt = "_fileError_9tg5q_260", D = {
469
+ dropZone: it,
470
+ dropZoneHover: ct,
471
+ dropZoneTitle: ut,
472
+ dropZoneSubtitle: dt,
473
+ button: mt,
474
+ buttonHover: pt,
475
+ explanation: ft,
476
+ files: Et,
477
+ file: bt,
478
+ fileName: gt,
479
+ buttonLabel: Ft,
480
+ removeButton: ht,
481
+ spinner: _t,
482
+ fileError: Lt
483
+ }, Ct = ({ content: e, locale: n }) => /* @__PURE__ */ t.createElement(Ce, {
484
+ content: e,
485
+ locale: n
486
+ }), xt = () => {
487
+ var B, Z, y, v;
488
+ const { t: e } = oe(), { disabled: n, readOnly: o } = z(), a = !n && !o, s = pe({
489
+ globalClasses: de,
490
+ moduleClasses: {
491
+ base: D.dropZone,
492
+ hover: D.dropZoneHover
493
+ }
494
+ }), d = pe({
495
+ globalClasses: Me,
496
+ moduleClasses: {
497
+ base: D.button,
498
+ hover: D.buttonHover
499
+ }
500
+ }), E = (v = (y = (Z = (B = Be().dropZone) == null ? void 0 : B.elementProps) == null ? void 0 : Z.uploadButton) == null ? void 0 : y.elementProps) == null ? void 0 : v.icon, { wix: C, className: r, ...i } = E ?? {}, x = ye(te.DROP_ZONE, te.UPLOAD_BUTTON, te.UPLOAD_BUTTON_LABEL), m = H(null), [p, c] = Y(!1), [T, N] = Y(!1), O = M(() => {
501
+ var u;
502
+ c(!0), (u = m.current) == null || u.runAnimationForward();
503
+ }, []), F = M(() => {
504
+ var u;
505
+ c(!1), (u = m.current) == null || u.runAnimationBackward();
506
+ }, []);
507
+ return /* @__PURE__ */ t.createElement(l, null, /* @__PURE__ */ t.createElement(l.Label, {
508
+ className: A(Ze, $.label)
509
+ }, /* @__PURE__ */ t.createElement(l.Label.Required, {
510
+ className: A(Re, $.requiredMark)
511
+ })), /* @__PURE__ */ t.createElement(l.DropZone, {
512
+ className: ({ isHovered: u, isFocused: R, isDropTarget: S }) => s({
513
+ isSelected: !1,
514
+ isHovered: u || S,
515
+ isFocused: R,
516
+ isInteractive: a
517
+ })
518
+ }, /* @__PURE__ */ t.createElement(l.DropZone.Title, {
519
+ className: D.dropZoneTitle
520
+ }, ({ limitReached: u }) => e(u ? "file-upload.dropzone.limit-reached.title" : "file-upload.dropzone.title")), /* @__PURE__ */ t.createElement(l.DropZone.Subtitle, {
521
+ className: D.dropZoneSubtitle
522
+ }, ({ limitReached: u }) => e(u ? "file-upload.dropzone.limit-reached.subtitle" : "file-upload.dropzone.subtitle")), /* @__PURE__ */ t.createElement(l.DropZone.Button, {
523
+ className: ({ isHovered: u, isFocused: R }) => d({
524
+ isSelected: !1,
525
+ isHovered: u,
526
+ isFocused: R,
527
+ isInteractive: a
528
+ }),
529
+ "aria-roledescription": e("file-upload.aria-roledescription"),
530
+ onHoverStart: O,
531
+ onHoverEnd: F,
532
+ onFocusChange: N
533
+ }, i.svg ? /* @__PURE__ */ t.createElement(Le, {
534
+ ...i,
535
+ ref: m,
536
+ className: A(Ae, Ie, r)
537
+ }) : E ? null : /* @__PURE__ */ t.createElement(rt, null), /* @__PURE__ */ t.createElement(l.DropZone.Button.Text, {
538
+ className: A(ce.base, D.buttonLabel, x, {
539
+ [ce.hover]: a && (p || T)
540
+ })
541
+ }))), /* @__PURE__ */ t.createElement(l.Explanation, {
542
+ className: A(ue, $.description, D.explanation),
543
+ showUploadStatusOnly: !0
544
+ }), /* @__PURE__ */ t.createElement(l.Files, {
545
+ className: D.files
546
+ }, /* @__PURE__ */ t.createElement(l.Files.File, {
547
+ className: A(de.base, D.file)
548
+ }, /* @__PURE__ */ t.createElement(l.Files.File.Name, {
549
+ className: D.fileName
550
+ }), /* @__PURE__ */ t.createElement(l.Files.File.Spinner, {
551
+ className: D.spinner,
552
+ "aria-label": e("file-upload.file.uploading-spinner.aria-label")
553
+ }, /* @__PURE__ */ t.createElement(st, null)), /* @__PURE__ */ t.createElement(l.Files.File.Remove, {
554
+ className: D.removeButton,
555
+ "aria-label": e("file-upload.delete-file.aria-label")
556
+ }, /* @__PURE__ */ t.createElement(lt, null)), /* @__PURE__ */ t.createElement(l.Files.File.Error, {
557
+ className: A(me, $.error, D.fileError)
558
+ }, /* @__PURE__ */ t.createElement(at, null), /* @__PURE__ */ t.createElement(l.Files.File.Error.Text, null)))), /* @__PURE__ */ t.createElement(l.Description, {
559
+ className: A(ue, $.description)
560
+ }, Ct), /* @__PURE__ */ t.createElement(l.Error, {
561
+ className: A(me, $.error)
562
+ }, /* @__PURE__ */ t.createElement(Oe, null), /* @__PURE__ */ t.createElement(l.Error.Text, null)));
563
+ }, wt = () => /* @__PURE__ */ t.createElement(xt, null);
564
+ export {
565
+ wt as FileUploadRAC
566
+ };
@@ -1,12 +1,12 @@
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 { bh as C, b9 as I, be as P, I as O, J as S, p as x } from "./form-CPY-PtxT.js";
4
+ import { bh as C, b9 as I, be as P, I as O, J as S, p as x } from "./form-CYPNOMwk.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-BxEFPwKI.js";
8
- import { L as g } from "./field-label-headless-5mewgrhq.js";
9
- import { s as L } from "./field-rac.module-BGN-O8tV.js";
7
+ import { D as v, E as M } from "./field-error-headless-C3eOy1_l.js";
8
+ import { L as g } from "./field-label-headless-BMmR_IeF.js";
9
+ import { s as L } from "./field-rac.module-DfEb7pBp.js";
10
10
  const e = ({ children: r }) => {
11
11
  var p;
12
12
  const { id: a, validation: n, FieldLayout: l } = C(), { currency: o, regionalFormat: m } = I(), s = _(() => {