@wix/form-elements 1.121.0 → 1.122.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 (112) hide show
  1. package/dist/component/{appointment-rac-BmwzUTfZ.js → appointment-rac-Cj90bm7v.js} +4 -4
  2. package/dist/component/{bookings-address-rac-CDpBaBGi.js → bookings-address-rac-ta3UnLl8.js} +1 -1
  3. package/dist/component/{bookings-email-rac-8AonBAEP.js → bookings-email-rac-Ch2W4ucr.js} +1 -1
  4. package/dist/component/{bookings-first-name-rac-BAF3OLyL.js → bookings-first-name-rac-CvBNN0qW.js} +1 -1
  5. package/dist/component/{bookings-header-rac-DIXxOHe1.js → bookings-header-rac-BGn5xB-k.js} +1 -1
  6. package/dist/component/{bookings-last-name-rac-Cm-58BWq.js → bookings-last-name-rac-Dlu0RgZ0.js} +1 -1
  7. package/dist/component/{bookings-login-bar-rac-DvaiFVqg.js → bookings-login-bar-rac-1htwH3kv.js} +1 -1
  8. package/dist/component/{bookings-phone-rac-znrjfRwm.js → bookings-phone-rac-U75qHO4B.js} +1 -1
  9. package/dist/component/{bookings-rich-text-rac-DFPeWcrH.js → bookings-rich-text-rac-_j66QPCk.js} +1 -1
  10. package/dist/component/{checkbox-field-rac-COvxqyF7.js → checkbox-field-rac-CjQeC7-Y.js} +4 -4
  11. package/dist/component/{checkbox-group-field-headless-DT1HX61N.js → checkbox-group-field-headless-BLZlefmT.js} +3 -3
  12. package/dist/component/{checkbox-group-field-rac-Db1w6Vzm.js → checkbox-group-field-rac-s_9nrnok.js} +4 -4
  13. package/dist/component/{checkbox-group-rac-BCgFQJ4P.js → checkbox-group-rac-DZgOprql.js} +1 -1
  14. package/dist/component/{checkbox-rac-C1dKq2AT.js → checkbox-rac-H0jZt4pG.js} +1 -1
  15. package/dist/component/{contacts-address-rac-BoZ2LExb.js → contacts-address-rac-QMPNicwV.js} +1 -1
  16. package/dist/component/{contacts-birthdate-rac-CX-oJkwP.js → contacts-birthdate-rac-BubQqfVp.js} +1 -1
  17. package/dist/component/{contacts-company-rac-ByY9oaOX.js → contacts-company-rac-fVQn5dPH.js} +1 -1
  18. package/dist/component/{contacts-email-rac-DBnTEm82.js → contacts-email-rac-sJqycgjN.js} +1 -1
  19. package/dist/component/{contacts-first-name-rac-Jn-ubMoS.js → contacts-first-name-rac-DuHDHR2w.js} +1 -1
  20. package/dist/component/{contacts-last-name-rac-Wea7_JU-.js → contacts-last-name-rac-DV2g2QGF.js} +1 -1
  21. package/dist/component/{contacts-phone-rac-POYGTwBr.js → contacts-phone-rac-e9o55Al-.js} +1 -1
  22. package/dist/component/{contacts-position-rac-DjDHNTfL.js → contacts-position-rac-Z6vDVuT7.js} +1 -1
  23. package/dist/component/{contacts-subscribe-rac-C7vOLrLV.js → contacts-subscribe-rac-GiiBZhQ7.js} +1 -1
  24. package/dist/component/{contacts-tax-id-rac-C-CVis0b.js → contacts-tax-id-rac-KFIbfE1X.js} +1 -1
  25. package/dist/component/{date-availability-B3unFx4z.js → date-availability-BloJXrmD.js} +1 -1
  26. package/dist/component/date-input-field-rac-MT_m-Z3G.js +290 -0
  27. package/dist/component/{date-input-rac-BW_WuabB.js → date-input-rac-C2WNFEp-.js} +1 -1
  28. package/dist/component/{date-picker-field-rac-DgBfvDRc.js → date-picker-field-rac-C9ewyabf.js} +117 -114
  29. package/dist/component/{date-picker-rac-B2v-E9tZ.js → date-picker-rac-BiDt00zO.js} +1 -1
  30. package/dist/component/{date-time-input-field-rac-DNxauQLv.js → date-time-input-field-rac-D1GNwPmZ.js} +111 -111
  31. package/dist/component/{date-time-input-rac-DZMQuMlD.js → date-time-input-rac-VMTzuAzt.js} +1 -1
  32. package/dist/component/{dext-checkbox-group-rac-B0u3i1v1.js → dext-checkbox-group-rac-CUG-FJj1.js} +2 -2
  33. package/dist/component/{dext-checkbox-rac-BngAFLbm.js → dext-checkbox-rac-DUC-rpQy.js} +1 -1
  34. package/dist/component/{dext-date-picker-rac-CyPtZQQp.js → dext-date-picker-rac-Bp1_5ZRF.js} +1 -1
  35. package/dist/component/{dext-date-time-input-rac-DBm_ZVMr.js → dext-date-time-input-rac-D7BBsF1U.js} +1 -1
  36. package/dist/component/{dext-dropdown-rac-DBDOigJS.js → dext-dropdown-rac-GmP2v4Va.js} +1 -1
  37. package/dist/component/{dext-email-rac-Cj-eerfr.js → dext-email-rac-Dfu8MJjD.js} +1 -1
  38. package/dist/component/{dext-number-input-rac-WdUIM6bV.js → dext-number-input-rac-C8ejJdHk.js} +1 -1
  39. package/dist/component/{dext-phone-rac-CH-UDDKr.js → dext-phone-rac-iaVcaxNr.js} +1 -1
  40. package/dist/component/{dext-radio-group-rac-umexCSNY.js → dext-radio-group-rac-yOH9UuWW.js} +2 -2
  41. package/dist/component/{dext-rating-input-rac-ukMPDLxU.js → dext-rating-input-rac-d_PyzTCP.js} +1 -1
  42. package/dist/component/{dext-tags-rac-BE8aqyRm.js → dext-tags-rac-CjH32M87.js} +2 -2
  43. package/dist/component/{dext-text-area-rac-GtNDPetb.js → dext-text-area-rac-BLcw2KMH.js} +1 -1
  44. package/dist/component/{dext-text-input-rac-DQhaKaoe.js → dext-text-input-rac-2SLBKsBY.js} +1 -1
  45. package/dist/component/{dext-url-input-rac-DogsntOO.js → dext-url-input-rac-BIh4KJw3.js} +1 -1
  46. package/dist/component/{donation-rac-C1Se3wmU.js → donation-rac-D1cY7dDX.js} +5 -5
  47. package/dist/component/{dropdown-field-headless-5vi45azS.js → dropdown-field-headless-DgpZtlSI.js} +5 -5
  48. package/dist/component/{dropdown-field-rac-B0PeCuG6.js → dropdown-field-rac-CUNtROoj.js} +18 -17
  49. package/dist/component/{dropdown-rac--ZgcFbpH.js → dropdown-rac-BdCYUN39.js} +1 -1
  50. package/dist/component/{ecom-address-rac-C1p-fN1j.js → ecom-address-rac-CRcfdrJ1.js} +1 -1
  51. package/dist/component/{ecom-subscription-checkbox-rac-uplYmDWZ.js → ecom-subscription-checkbox-rac-CgePHF0U.js} +2 -2
  52. package/dist/component/{email-input-field-rac-C6nqydVv.js → email-input-field-rac-DvWj_fAr.js} +3 -3
  53. package/dist/component/{events-repeater-rac-CqKFo75H.js → events-repeater-rac-Cfth4URI.js} +4 -4
  54. package/dist/component/{events-rsvp-rac-BBQwW-Jk.js → events-rsvp-rac-PmNHKbSw.js} +3 -3
  55. package/dist/component/{field-error-headless-COObBNJG.js → field-error-headless-B8MijSrk.js} +1 -1
  56. package/dist/component/{field-label-headless-DhXceghb.js → field-label-headless-D3FPZC-x.js} +1 -1
  57. package/dist/component/{file-upload-rac-B5CnpgIo.js → file-upload-rac-BNqkSQ2b.js} +4 -4
  58. package/dist/component/{fixed-payment-rac-B8yKRpQV.js → fixed-payment-rac-CtNOKzeC.js} +3 -3
  59. package/dist/component/{form-CimhBiBc.js → form-AphBF-mQ.js} +691 -671
  60. package/dist/component/form.css +1 -1
  61. package/dist/component/form.js +1 -1
  62. package/dist/component/{header-field-rac-BHgFF-LG.js → header-field-rac-cJ2ZFy67.js} +2 -2
  63. package/dist/component/{header-rac-DJttTbow.js → header-rac-Dd7yRNC0.js} +1 -1
  64. package/dist/component/{image-choice-rac-C-qj1WBS.js → image-choice-rac-2Z_7AfHu.js} +4 -4
  65. package/dist/component/{index-Qe91Dgi2.js → index-A4jMKGCs.js} +2 -2
  66. package/dist/component/{index-9nfSsqJo.js → index-ERGpdqrG.js} +4 -4
  67. package/dist/component/{isObjectLike-VICRth8V.js → isObjectLike-wpJkrV5k.js} +1 -1
  68. package/dist/component/{multiline-address-field-rac-DMg6V-0L.js → multiline-address-field-rac-CGqF3dfq.js} +369 -369
  69. package/dist/component/{multiline-address-rac-DpvB5bX9.js → multiline-address-rac-Dy8_4emN.js} +1 -1
  70. package/dist/component/{number-input-field-rac-DQERdWaA.js → number-input-field-rac-BaTODjcx.js} +4 -4
  71. package/dist/component/{number-input-rac-DY9uyE-k.js → number-input-rac-CVpDhFz5.js} +1 -1
  72. package/dist/component/{password-rac-cSWH1LPy.js → password-rac-BNam3XdN.js} +4 -4
  73. package/dist/component/{payment-input-rac-BiUNnsQx.js → payment-input-rac-Czqho0fu.js} +4 -4
  74. package/dist/component/phone-input-field-rac-BM2SoA5b.js +507 -0
  75. package/dist/component/{phone-rac-CFeNcp2U.js → phone-rac-BuC_Yxb2.js} +1 -1
  76. package/dist/component/{product-list-rac-DzhnEmL_.js → product-list-rac-gfZUDEoh.js} +4 -4
  77. package/dist/component/{quiz-radio-group-rac-BpsPgebu.js → quiz-radio-group-rac-DswfVeX4.js} +1 -1
  78. package/dist/component/{radio-button-module-classes-NBKHsJH7.js → radio-button-module-classes-DmWrhFOe.js} +3 -3
  79. package/dist/component/{radio-group-field-rac-C2oTt1mT.js → radio-group-field-rac-CE67QNOZ.js} +4 -4
  80. package/dist/component/{radio-group-rac-oINHZ5yY.js → radio-group-rac-hMr6DTvG.js} +1 -1
  81. package/dist/component/{rating-input-field-rac-fnv2RdUA.js → rating-input-field-rac-bDVUjGJa.js} +4 -4
  82. package/dist/component/{rating-input-rac-BFofFzSX.js → rating-input-rac-ZNdJ7gjD.js} +1 -1
  83. package/dist/component/{rich-content-rac.module-BplXvCt6.js → rich-content-rac.module-CUYcnq1k.js} +1 -1
  84. package/dist/component/{rich-text-field-rac-Csi4_gCV.js → rich-text-field-rac-DjnSs-6W.js} +2 -2
  85. package/dist/component/{rich-text-rac-Btu1y3LR.js → rich-text-rac-BIZ9Yyb_.js} +1 -1
  86. package/dist/component/service-dropdown-rac-6cm9orLJ.js +146 -0
  87. package/dist/component/{services-multi-choice-rac-B2rAg7VN.js → services-multi-choice-rac-DkojlNhZ.js} +5 -5
  88. package/dist/component/{signature-rac-tznFgZ4j.js → signature-rac-BfDoEvbo.js} +3 -3
  89. package/dist/component/submit-button-rac-BDEQy_l_.js +172 -0
  90. package/dist/component/{tags-field-rac-DFm9o85s.js → tags-field-rac-DvmQ9U0Y.js} +5 -5
  91. package/dist/component/{tags-rac-CJFccYp5.js → tags-rac-DxkhHwfm.js} +1 -1
  92. package/dist/component/{text-area-field-rac-C4UEZOjz.js → text-area-field-rac-DngdDcia.js} +4 -4
  93. package/dist/component/{text-area-rac-Dhsq1l8f.js → text-area-rac-CXm7TYZV.js} +1 -1
  94. package/dist/component/{text-input-field-rac-DiW0Sqj_.js → text-input-field-rac-DyDgs_io.js} +3 -3
  95. package/dist/component/{text-input-headless-u1_aFnZ1.js → text-input-headless-C_feZwcp.js} +3 -3
  96. package/dist/component/{text-input-rac-COy-c4N_.js → text-input-rac-C5UxE1Zt.js} +1 -1
  97. package/dist/component/{time-input-rac-DipZQTZN.js → time-input-rac-cBIuRiEr.js} +4 -4
  98. package/dist/component/{url-input-field-rac-DhBCGvKd.js → url-input-field-rac-BUO9FUv6.js} +4 -4
  99. package/dist/component/{url-input-rac-kw4gCDbc.js → url-input-rac-D7Z-AQaq.js} +1 -1
  100. package/dist/component/{use-dropdown-option-class-name-Bes6rpX4.js → use-dropdown-option-class-name-Bm1SOTi8.js} +2 -2
  101. package/dist/component/use-dropdown-trigger-class-name-Dcy1VIqo.js +43 -0
  102. package/dist/component/{use-element-state-class-name-_GWfwpEf.js → use-element-state-class-name-B3vhm52Z.js} +1 -1
  103. package/dist/component/use-hoverable-input-class-name-nSoEwyiu.js +23 -0
  104. package/dist/component/{use-service-options-base-4yrjmSWU.js → use-service-options-base-Drse9uff.js} +1 -1
  105. package/dist/component/use-text-input-class-name-CZWGRiSQ.js +6 -0
  106. package/package.json +2 -2
  107. package/dist/component/date-input-field-rac-BW0c1-Kl.js +0 -290
  108. package/dist/component/phone-input-field-rac-CtPGbnw_.js +0 -504
  109. package/dist/component/service-dropdown-rac-CzZW7Bp1.js +0 -145
  110. package/dist/component/submit-button-rac-DnHWbtTC.js +0 -141
  111. package/dist/component/use-is-forced-open-dropdown-RE1Ml2A3.js +0 -41
  112. package/dist/component/use-text-input-class-name-uMLXv54u.js +0 -23
@@ -1,504 +0,0 @@
1
- import { RicosViewer as Ce } from "@wix/ricos/viewer";
2
- import g from "classnames";
3
- import t, { useMemo as A, useState as T, useRef as P, useEffect as k, useCallback as W, createContext as ee, useContext as H, useId as de } from "react";
4
- import { aU as ye, bj as F, b1 as te, bi as Ee, b9 as D, b6 as ne, bb as fe, I as he, U as ge, t as be, H as Oe, K as _e, v as Ne, p as Se } from "./form-CimhBiBc.js";
5
- import { UNSAFE_PortalProvider as Le } from "react-aria";
6
- import { Dialog as oe, OverlayTriggerStateContext as Ie, ModalOverlay as ve, Modal as Pe, SearchField as Fe, Group as G, ListBoxItem as De, DialogTrigger as Be, Select as Re, Input as re, Autocomplete as xe } from "react-aria-components";
7
- import { f as h, a as L } from "./find-child-C60k4CxG.js";
8
- import { D as we, E as Me } from "./field-error-headless-COObBNJG.js";
9
- import { L as Ae } from "./field-label-headless-DhXceghb.js";
10
- import { N as Te, S as $e } from "./non-modal-popover-DtIMXHbe.js";
11
- import { u as Ue } from "./use-invoke-callback-UH73A_J3.js";
12
- import { u as ke } from "./use-is-forced-open-dropdown-RE1Ml2A3.js";
13
- import { V as Ve, u as qe } from "./use-dropdown-option-class-name-Bes6rpX4.js";
14
- import ae, { AsYouType as Ge, isValidPhoneNumber as He, isSupportedCountry as Ke } from "libphonenumber-js";
15
- import "libphonenumber-js/metadata.min.json";
16
- import { C as Z } from "./calling-country-codes-PyWuOTmF.js";
17
- import { C as Ye } from "./chevron-down-icon-CcpVm6B-.js";
18
- import { E as je } from "./error-icon-hZxQ6DEy.js";
19
- import { H as Q } from "./custom-focus-class-_483Pkwp.js";
20
- import { s as O } from "./field-rac.module-B4l_0KRU.js";
21
- import { u as ze } from "./use-text-input-class-name-uMLXv54u.js";
22
- function J(e) {
23
- const n = e ? ae(e) : void 0, o = n == null ? void 0 : n.country;
24
- if (o)
25
- return o;
26
- const r = new Ge();
27
- return e && r.input(e), r.getCountry();
28
- }
29
- function K(e) {
30
- var n;
31
- return e && ((n = ye.getCountryByKey(e)) == null ? void 0 : n.dialCode);
32
- }
33
- function V(e) {
34
- return e === null ? null : e.replace(/[^0-9+]/g, "") || e;
35
- }
36
- function X(e, n) {
37
- if (e && n)
38
- try {
39
- const o = ae(e, n), r = o == null ? void 0 : o.formatInternational();
40
- if (r && He(r))
41
- return r.replace(/\s+/g, "");
42
- } catch {
43
- }
44
- return e;
45
- }
46
- function We() {
47
- const { t: e } = F(), { language: n } = te();
48
- return A(() => Object.keys(Z).reduce((r, a) => {
49
- const c = Z[a], l = K(c), u = e(`locale-dataset.countries.${c.toUpperCase()}`);
50
- return l && Ke(a) && r.push({
51
- countryName: u,
52
- longCountryCode: c,
53
- shortCountryCode: a,
54
- callingCode: l
55
- }), r;
56
- }, []).sort((r, a) => r.countryName.localeCompare(a.countryName, n)), [
57
- e,
58
- n
59
- ]);
60
- }
61
- function Ze(e, n) {
62
- return e.filter((o) => n && n.length > 0 ? n.includes(o.shortCountryCode) : !0);
63
- }
64
- function Qe(e, n) {
65
- const { countryName: o, callingCode: r, shortCountryCode: a } = e;
66
- return !!(q(o, n) || q(r, n) || q(a, n));
67
- }
68
- function q(e, n) {
69
- return e.toLowerCase().includes(n.toLowerCase());
70
- }
71
- function Je({ value: e, defaultCountryCode: n, allowedCountryCodes: o, onChange: r }) {
72
- const [a, c] = T(e || ""), l = P(V(e ?? null) ?? ""), [u, i] = T(n);
73
- Ee(() => {
74
- c(""), l.current = "", i(n), r("");
75
- });
76
- const p = A(() => J(a), [
77
- a
78
- ]);
79
- k(() => {
80
- const m = e ?? "";
81
- m !== l.current && (c(m), l.current = m);
82
- }, [
83
- e
84
- ]), k(() => {
85
- n && !u && i(n);
86
- }, [
87
- n,
88
- u
89
- ]), k(() => {
90
- i(n ?? p);
91
- }, [
92
- p,
93
- n
94
- ]);
95
- const C = W((m) => {
96
- if (c(m), !m) {
97
- l.current = "", r(null);
98
- return;
99
- }
100
- const f = J(m);
101
- i((d) => {
102
- const S = f || d || ((o == null ? void 0 : o.length) === 1 ? o[0] : void 0), N = V(X(m, S));
103
- return l.current = N ?? "", r(N), f || d;
104
- });
105
- }, [
106
- o,
107
- r
108
- ]), y = W((m) => {
109
- i(m), c((f) => {
110
- const d = V(X(f, m));
111
- return l.current = d ?? "", r(d), f;
112
- });
113
- }, [
114
- r
115
- ]);
116
- return {
117
- currentValue: a,
118
- selectedCountryCode: u,
119
- handlePhoneChange: C,
120
- handleCountryCodeChange: y
121
- };
122
- }
123
- const se = /* @__PURE__ */ ee(null), _ = () => {
124
- const e = H(se);
125
- if (!e)
126
- throw new Error("Phone input components must be used within PhoneInput component");
127
- return e;
128
- }, ce = /* @__PURE__ */ ee(null), Y = () => {
129
- const e = H(ce);
130
- if (!e)
131
- throw new Error("Option sub-components must be used within Option component");
132
- return e;
133
- }, j = ({ longCountryCode: e, className: n }) => {
134
- function o(c, l) {
135
- const u = "https://static.parastorage.com/services/linguist-flags/1.1005.0/assets/flags/square/", p = `${c}${l === "2x" ? "_2x" : ""}.png`;
136
- return `${u}${p}`;
137
- }
138
- const r = o(e, "1x"), a = o(e, "2x");
139
- return /* @__PURE__ */ t.createElement("img", {
140
- src: r,
141
- srcSet: `${r} 1x, ${a} 2x`,
142
- alt: "",
143
- "aria-hidden": "true",
144
- loading: "lazy",
145
- className: n
146
- });
147
- }, s = ({ children: e }) => {
148
- var I, v;
149
- const { id: n, value: o, onChange: r, FieldLayout: a, defaultCountry: c, validation: l } = D(), [u, i] = T(null), p = (v = (I = l == null ? void 0 : l.string) == null ? void 0 : I.phoneOptions) == null ? void 0 : v.allowedCountryCodes, C = We(), y = A(() => Ze(C, p), [
150
- C,
151
- p
152
- ]), m = A(() => y.map((M) => M.shortCountryCode), [
153
- y
154
- ]), { currentValue: f, selectedCountryCode: d, handlePhoneChange: S, handleCountryCodeChange: N } = Je({
155
- value: o,
156
- defaultCountryCode: c,
157
- allowedCountryCodes: m,
158
- onChange: r
159
- }), B = h(e, s.Label), R = h(e, s.Control), x = h(e, s.Description), w = h(e, s.Error), U = {
160
- currentValue: f,
161
- selectedCountryCode: d,
162
- handlePhoneChange: S,
163
- handleCountryCodeChange: N,
164
- countryCodes: m,
165
- countries: y,
166
- popoverContainer: u
167
- };
168
- return /* @__PURE__ */ t.createElement(se.Provider, {
169
- value: U
170
- }, /* @__PURE__ */ t.createElement(a, {
171
- fieldId: n,
172
- renderLabel: () => B,
173
- renderInput: () => /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("div", {
174
- ref: i,
175
- style: {
176
- display: "contents"
177
- }
178
- }), R),
179
- renderDescription: () => /* @__PURE__ */ t.createElement(t.Fragment, null, w, x)
180
- }));
181
- }, z = ({ children: e, className: n }) => {
182
- const { labelId: o } = ne(), { hasError: r, disabled: a, readOnly: c } = D(), { t: l } = F(), { selectedCountryCode: u, countries: i } = _(), p = de(), C = u ? i.find((d) => d.shortCountryCode === u) : void 0, y = C && K(C.longCountryCode) || "", m = l("field.phone.country-code.aria-label"), f = C ? `${m}, ${C.countryName}, ${y}` : m;
183
- return /* @__PURE__ */ t.createElement($e, {
184
- isDisabled: a || c,
185
- id: p,
186
- "aria-label": f,
187
- "aria-labelledby": o ? `${o} ${p}` : void 0,
188
- className: n,
189
- "data-invalid": r || void 0
190
- }, e);
191
- }, Xe = ({ className: e }) => {
192
- const { selectedCountryCode: n, countries: o } = _(), r = o.find((a) => a.shortCountryCode === n);
193
- return r ? /* @__PURE__ */ t.createElement(j, {
194
- className: e,
195
- longCountryCode: r.longCountryCode
196
- }) : null;
197
- }, et = ({ children: e, className: n }) => {
198
- const { selectedCountryCode: o, countries: r } = _();
199
- return r.some((c) => c.shortCountryCode === o) ? null : /* @__PURE__ */ t.createElement("span", {
200
- className: n
201
- }, e);
202
- };
203
- z.Flag = Xe;
204
- z.EmptyState = et;
205
- const b = ({ children: e, className: n, "aria-label": o, placement: r, offset: a, ...c }) => {
206
- const { triggerRef: l, optionsRef: u, isForcedOpen: i, isOpen: p } = c, { popoverContainer: C } = _(), y = h(e, b.Search);
207
- if (!p)
208
- return null;
209
- const m = /* @__PURE__ */ t.createElement(le, {
210
- isForcedOpen: i
211
- }, e);
212
- return /* @__PURE__ */ t.createElement(Le, {
213
- getContainer: () => C
214
- }, /* @__PURE__ */ t.createElement(Te, {
215
- ref: u,
216
- triggerRef: l,
217
- className: n,
218
- placement: r,
219
- offset: a,
220
- containerPadding: 0
221
- }, y && !i ? /* @__PURE__ */ t.createElement(oe, {
222
- "aria-label": o
223
- }, m) : m));
224
- }, tt = ({ children: e, className: n, overlayClassName: o, "aria-label": r, portalContainer: a = t.Fragment, ...c }) => {
225
- const { optionsRef: l } = c, { selectedCountryCode: u, handleCountryCodeChange: i } = _(), p = H(Ie);
226
- return /* @__PURE__ */ t.createElement(ve, {
227
- className: o,
228
- isDismissable: !0
229
- }, /* @__PURE__ */ t.createElement(a, null, /* @__PURE__ */ t.createElement(Pe, {
230
- ref: l,
231
- className: n
232
- }, /* @__PURE__ */ t.createElement(oe, {
233
- "aria-label": r
234
- }, /* @__PURE__ */ t.createElement(le, {
235
- listBoxProps: {
236
- "aria-label": r,
237
- selectionMode: "single",
238
- selectedKeys: u ? [
239
- u
240
- ] : [],
241
- onAction: (C) => {
242
- i(C), p == null || p.close();
243
- }
244
- }
245
- }, e)))));
246
- }, le = ({ children: e, listBoxProps: n, isForcedOpen: o }) => {
247
- const { countries: r } = _(), a = h(e, b.Option), c = h(e, b.Search), l = h(e, b.EmptyState), u = /* @__PURE__ */ t.createElement(Ve, {
248
- isForcedOpen: o === !0,
249
- ...n,
250
- renderEmptyState: l ? () => l : void 0
251
- }, r.map((i) => {
252
- const p = K(i.longCountryCode) || "";
253
- return L(a, {
254
- key: i.shortCountryCode,
255
- countryCode: i.shortCountryCode,
256
- dialingCode: p,
257
- countryName: i.countryName,
258
- longCountryCode: i.longCountryCode
259
- });
260
- }));
261
- return c ? /* @__PURE__ */ t.createElement(xe, {
262
- filter: (i, p, C) => {
263
- const y = r.find((m) => m.shortCountryCode === C.key);
264
- return !!y && Qe(y, p);
265
- }
266
- }, o ? L(c, {
267
- autoFocus: !1
268
- }) : c, u) : u;
269
- };
270
- b.Popover = b;
271
- b.Modal = tt;
272
- const ue = ({ className: e, children: n, "aria-label": o, ...r }) => {
273
- const { autoFocus: a = !0 } = r;
274
- return /* @__PURE__ */ t.createElement(Fe, {
275
- "aria-label": o,
276
- autoFocus: a
277
- }, /* @__PURE__ */ t.createElement(G, {
278
- className: e
279
- }, n));
280
- }, nt = ({ className: e, placeholder: n }) => /* @__PURE__ */ t.createElement(re, {
281
- className: e,
282
- placeholder: n
283
- });
284
- ue.Input = nt;
285
- b.Search = ue;
286
- const ot = ({ children: e, className: n }) => /* @__PURE__ */ t.createElement("div", {
287
- className: n
288
- }, e);
289
- b.EmptyState = ot;
290
- const $ = ({ children: e, className: n, ...o }) => {
291
- const { countryCode: r, dialingCode: a, countryName: c, longCountryCode: l } = o, u = {
292
- countryCode: r,
293
- dialingCode: a,
294
- countryName: c,
295
- longCountryCode: l
296
- }, i = e || /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(ie, null), /* @__PURE__ */ t.createElement(me, null), /* @__PURE__ */ t.createElement(pe, null));
297
- return /* @__PURE__ */ t.createElement(De, {
298
- className: n,
299
- id: r,
300
- textValue: `${c} ${a}`
301
- }, /* @__PURE__ */ t.createElement(ce.Provider, {
302
- value: u
303
- }, i));
304
- }, ie = ({ className: e }) => {
305
- const { longCountryCode: n } = Y();
306
- return /* @__PURE__ */ t.createElement(j, {
307
- className: e,
308
- longCountryCode: n
309
- });
310
- }, me = ({ className: e }) => {
311
- const { countryName: n } = Y();
312
- return /* @__PURE__ */ t.createElement("span", {
313
- className: e
314
- }, n);
315
- }, pe = ({ className: e }) => {
316
- const { dialingCode: n } = Y();
317
- return /* @__PURE__ */ t.createElement("span", {
318
- className: e
319
- }, n);
320
- };
321
- $.Flag = ie;
322
- $.Name = me;
323
- $.Code = pe;
324
- b.Option = $;
325
- const rt = ({ className: e }) => {
326
- const { t: n } = F(), { inputId: o, ariaDescribedBy: r } = ne(), { id: a, placeholder: c, disabled: l, readOnly: u, required: i, label: p, hasError: C } = D(), { currentValue: y, handlePhoneChange: m } = _(), f = P(null);
327
- return fe(() => {
328
- var d;
329
- (d = f.current) == null || d.focus({
330
- preventScroll: !0
331
- });
332
- }, a), /* @__PURE__ */ t.createElement(re, {
333
- ref: f,
334
- id: o,
335
- type: "tel",
336
- value: y,
337
- onChange: (d) => m(d.target.value),
338
- disabled: l,
339
- readOnly: u,
340
- required: i,
341
- "aria-label": `${p}. ${n("field.phone.aria-label")}`,
342
- "aria-describedby": r,
343
- "aria-invalid": C,
344
- placeholder: c,
345
- className: e
346
- });
347
- }, at = ({ children: e, ...n }) => {
348
- const o = n, { isForcedOpen: r } = o, { disabled: a, readOnly: c, required: l, hasError: u } = D(), [i, p] = T(!1), { t: C } = F(), { selectedCountryCode: y, handleCountryCodeChange: m } = _(), f = r || i && !a && !c;
349
- return /* @__PURE__ */ t.createElement(Re, {
350
- "aria-label": C("field.phone.country-code.aria-label"),
351
- value: y ?? null,
352
- onChange: (d) => m(d),
353
- isDisabled: a || c,
354
- isInvalid: u,
355
- isRequired: l,
356
- placeholder: "",
357
- isOpen: f,
358
- allowsEmptyCollection: !0,
359
- onOpenChange: r ? void 0 : p
360
- }, h(e, s.CountryButton), L(h(e, s.CountryOptions.Popover), {
361
- ...o,
362
- isOpen: f
363
- }));
364
- }, st = ({ children: e, ...n }) => {
365
- const o = n;
366
- return /* @__PURE__ */ t.createElement(Be, null, h(e, s.CountryButton), L(h(e, s.CountryOptions.Modal), o));
367
- }, ct = ({ children: e, className: n }) => {
368
- const o = P(null), r = P(null), a = P(!1), { id: c, disabled: l, hasError: u, showFlag: i, onFocus: p, onBlur: C } = D(), y = Ue(C), { countries: m } = _(), f = h(e, s.CountryDrawer), d = h(e, s.CountryPopover), S = h(e, s.PhoneNumber), N = m.length > 1, B = ke(c) && !!d && N, R = typeof n == "function" ? n({
369
- hasCountryOptions: N
370
- }) : n, x = {
371
- triggerRef: o,
372
- optionsRef: r,
373
- isForcedOpen: B
374
- }, w = {
375
- onFocus: () => {
376
- a.current || (a.current = !0, p == null || p());
377
- },
378
- onBlur: (U) => {
379
- var v, M;
380
- const I = U.relatedTarget;
381
- !((v = o.current) != null && v.contains(I)) && !((M = r.current) != null && M.contains(I)) && (a.current = !1, y());
382
- }
383
- };
384
- return m.length === 1 ? /* @__PURE__ */ t.createElement(G, {
385
- ref: o,
386
- className: R,
387
- isDisabled: l,
388
- isInvalid: u,
389
- ...w
390
- }, i && /* @__PURE__ */ t.createElement(j, {
391
- longCountryCode: m[0].longCountryCode
392
- }), S) : /* @__PURE__ */ t.createElement(G, {
393
- ref: o,
394
- className: R,
395
- isDisabled: l,
396
- isInvalid: u,
397
- ...w
398
- }, !B && L(f, x), L(d, x), S);
399
- };
400
- s.Label = Ae;
401
- s.Control = ct;
402
- s.CountryButton = z;
403
- s.CountryDrawer = st;
404
- s.CountryPopover = at;
405
- s.CountryOptions = b;
406
- s.PhoneNumber = rt;
407
- s.Description = we;
408
- s.Error = Me;
409
- const lt = (e) => /* @__PURE__ */ t.createElement("svg", {
410
- width: 24,
411
- height: 24,
412
- viewBox: "0 0 24 24",
413
- fill: "currentColor",
414
- "aria-hidden": "true",
415
- ...e
416
- }, /* @__PURE__ */ t.createElement("path", {
417
- fillRule: "evenodd",
418
- d: "M11.5,19 C11.331,19 11.166,18.985 11,18.975 L11,16.5 C11,16.224 10.776,16 10.5,16 L9.5,16 C9.224,16 9,15.775 9,15.5 L9,12.5 C9,12.366 8.947,12.238 8.852,12.145 L4.804,8.14 C6.04,5.688 8.573,4 11.5,4 C12.76,4 13.946,4.315 14.989,4.866 L15,6.497 C15.001,6.631 14.949,6.757 14.855,6.853 C14.76,6.947 14.634,7 14.5,7 L12.339,7 C12.207,7 12.08,7.053 11.986,7.146 L10.146,8.983 C10.053,9.077 10,9.204 10,9.337 L10,10.5 C10,11.325 10.672,11.999 11.499,12 L15.293,12 L17,13.707 L17,16.582 C15.629,18.064 13.674,19 11.5,19 M4,11.5 C4,10.673 4.14,9.879 4.388,9.135 L8,12.709 L8,15.5 C8,16.327 8.673,17 9.5,17 L10,17 L10,18.849 C6.581,18.152 4,15.122 4,11.5 M19,11.5 C19,12.856 18.632,14.127 18,15.226 L18,13.5 C18,13.367 17.947,13.24 17.854,13.146 L15.854,11.146 C15.76,11.053 15.633,11 15.5,11 L11.5,11 C11.224,11 11,10.775 11,10.5 L11,9.544 L12.546,8 L14.5,8 C14.902,8 15.281,7.843 15.564,7.557 C15.848,7.271 16.003,6.892 16,6.49 L15.993,5.51 C17.814,6.879 19,9.051 19,11.5 M11.5,3 C6.813,3 3,6.813 3,11.5 C3,16.187 6.813,20 11.5,20 C16.187,20 20,16.187 20,11.5 C20,6.813 16.187,3 11.5,3"
419
- })), ut = (e) => /* @__PURE__ */ t.createElement("svg", {
420
- width: 24,
421
- height: 24,
422
- viewBox: "0 0 24 24",
423
- fill: "currentColor",
424
- "aria-hidden": "true",
425
- ...e
426
- }, /* @__PURE__ */ t.createElement("path", {
427
- fillRule: "evenodd",
428
- d: "M6.6108,14.3887 C5.5718,13.3497 4.9998,11.9687 4.9998,10.4997 C4.9998,9.0317 5.5718,7.6507 6.6108,6.6117 C7.6498,5.5727 9.0308,4.9997 10.4998,4.9997 C11.9688,4.9997 13.3498,5.5727 14.3888,6.6117 C15.4278,7.6507 15.9998,9.0317 15.9998,10.4997 C15.9998,11.9687 15.4278,13.3497 14.3888,14.3887 C13.3498,15.4277 11.9688,15.9997 10.4998,15.9997 C9.0308,15.9997 7.6498,15.4277 6.6108,14.3887 L6.6108,14.3887 Z M20.0028,19.2957 L15.4328,14.7247 C16.4438,13.5477 16.9998,12.0687 16.9998,10.4997 C16.9998,8.7637 16.3238,7.1317 15.0958,5.9047 C13.8688,4.6767 12.2358,3.9997 10.4998,3.9997 C8.7638,3.9997 7.1318,4.6767 5.9038,5.9047 C4.6758,7.1317 3.9998,8.7637 3.9998,10.4997 C3.9998,12.2367 4.6758,13.8677 5.9038,15.0957 C7.1318,16.3237 8.7638,16.9997 10.4998,16.9997 C12.0688,16.9997 13.5478,16.4437 14.7258,15.4317 L19.2958,20.0027 L20.0028,19.2957 Z"
429
- })), it = "_control_rc3mn_1", mt = "_countryButton_rc3mn_9", pt = "_drawerButton_rc3mn_25", Ct = "_popoverButton_rc3mn_34", dt = "_chevron_rc3mn_39", yt = "_globeIcon_rc3mn_48", Et = "_searchIcon_rc3mn_49", ft = "_flag_rc3mn_58", ht = "_phoneNumber_rc3mn_73", gt = "_countryOptions_rc3mn_99", bt = "_option_rc3mn_107", Ot = "_countrySearch_rc3mn_116", _t = "_mobileDrawer_rc3mn_124", Nt = "_name_rc3mn_133", St = "_code_rc3mn_137", Lt = "_mobileOverlay_rc3mn_154", E = {
430
- control: it,
431
- countryButton: mt,
432
- drawerButton: pt,
433
- popoverButton: Ct,
434
- chevron: dt,
435
- globeIcon: yt,
436
- searchIcon: Et,
437
- flag: ft,
438
- phoneNumber: ht,
439
- countryOptions: gt,
440
- option: bt,
441
- countrySearch: Ot,
442
- mobileDrawer: _t,
443
- name: Nt,
444
- code: St,
445
- mobileOverlay: Lt
446
- }, It = ({ content: e, locale: n }) => /* @__PURE__ */ t.createElement(Ce, {
447
- content: e,
448
- locale: n
449
- }), vt = () => /* @__PURE__ */ t.createElement("span", {
450
- className: E.chevron,
451
- "aria-hidden": "true"
452
- }, /* @__PURE__ */ t.createElement(Ye, null)), Wt = () => {
453
- const e = qe(O.selectOptionWithoutFocusRing, E.option, Q), n = ze(E.countrySearch), { t: o } = F(), { PortalContainer: r } = te(), a = /* @__PURE__ */ t.createElement(s.CountryOptions.Search, {
454
- className: n,
455
- "aria-label": o("field.phone.country-search-input.aria-label")
456
- }, /* @__PURE__ */ t.createElement(ut, {
457
- className: E.searchIcon
458
- }), /* @__PURE__ */ t.createElement(s.CountryOptions.Search.Input, {
459
- className: g(O.innerInput, Q),
460
- placeholder: o("field.phone.country-search-input.placeholder")
461
- })), c = /* @__PURE__ */ t.createElement(s.CountryOptions.EmptyState, null, o("field.phone.country-selector-dropdown.no-result")), l = /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(s.CountryButton.Flag, {
462
- className: E.flag
463
- }), /* @__PURE__ */ t.createElement(s.CountryButton.EmptyState, null, /* @__PURE__ */ t.createElement(lt, {
464
- className: E.globeIcon
465
- })), /* @__PURE__ */ t.createElement(vt, null)), u = /* @__PURE__ */ t.createElement(s.CountryOptions.Option, {
466
- className: e
467
- }, /* @__PURE__ */ t.createElement(s.CountryOptions.Option.Flag, {
468
- className: E.flag
469
- }), /* @__PURE__ */ t.createElement(s.CountryOptions.Option.Name, {
470
- className: E.name
471
- }), /* @__PURE__ */ t.createElement(s.CountryOptions.Option.Code, {
472
- className: E.code
473
- }));
474
- return /* @__PURE__ */ t.createElement(s, null, /* @__PURE__ */ t.createElement(s.Label, {
475
- className: g(he, O.label)
476
- }, /* @__PURE__ */ t.createElement(s.Label.Required, {
477
- className: g(ge, O.requiredMark)
478
- })), /* @__PURE__ */ t.createElement(s.Control, {
479
- className: ({ hasCountryOptions: i }) => g(i ? be : Oe, O.input, E.control)
480
- }, /* @__PURE__ */ t.createElement(s.CountryDrawer, null, /* @__PURE__ */ t.createElement(s.CountryButton, {
481
- className: g(E.countryButton, E.drawerButton)
482
- }, l), /* @__PURE__ */ t.createElement(s.CountryOptions.Modal, {
483
- className: g(O.selectPopover, E.mobileDrawer),
484
- overlayClassName: E.mobileOverlay,
485
- portalContainer: r,
486
- "aria-label": o("field.phone.country-code.aria-label")
487
- }, a, c, u)), /* @__PURE__ */ t.createElement(s.CountryPopover, null, /* @__PURE__ */ t.createElement(s.CountryButton, {
488
- className: g(E.countryButton, E.popoverButton)
489
- }, l), /* @__PURE__ */ t.createElement(s.CountryOptions.Popover, {
490
- className: g(_e, O.selectPopover, E.countryOptions),
491
- placement: "bottom start",
492
- offset: 0,
493
- "aria-label": o("field.phone.country-code.aria-label")
494
- }, a, c, u)), /* @__PURE__ */ t.createElement(s.PhoneNumber, {
495
- className: g(O.innerInput, E.phoneNumber)
496
- })), /* @__PURE__ */ t.createElement(s.Error, {
497
- className: g(Ne, O.error)
498
- }, /* @__PURE__ */ t.createElement(je, null), /* @__PURE__ */ t.createElement(s.Error.Text, null)), /* @__PURE__ */ t.createElement(s.Description, {
499
- className: g(Se, O.description)
500
- }, It));
501
- };
502
- export {
503
- Wt as P
504
- };
@@ -1,145 +0,0 @@
1
- import t, { useRef as b, useMemo as g, useCallback as D, useEffect as P } from "react";
2
- import { RicosViewer as T } from "@wix/ricos/viewer";
3
- import u from "classnames";
4
- import { b5 as w, bj as A, F as M, b9 as y, b1 as U, ac as V, I as x, U as H, t as W, K as k, v as q, p as B } from "./form-CimhBiBc.js";
5
- import { u as G } from "./use-service-options-base-4yrjmSWU.js";
6
- import { D as d } from "./dropdown-field-headless-5vi45azS.js";
7
- import { C as j } from "./chevron-down-icon-CcpVm6B-.js";
8
- import { E as K } from "./error-icon-hZxQ6DEy.js";
9
- import { H as Q } from "./custom-focus-class-_483Pkwp.js";
10
- import { s as i } from "./field-rac.module-B4l_0KRU.js";
11
- import { u as Y } from "./use-dropdown-option-class-name-Bes6rpX4.js";
12
- const z = "00000000-0000-0000-0000-000000000000", J = (e) => {
13
- const { actions: r } = w(), { t: h } = A(), { addOther: n, addOtherLabel: p } = e, c = p || h("add-other.default-other-option-label"), a = b(!0), E = g(() => {
14
- var s;
15
- return ((s = e.options) == null ? void 0 : s.map((m) => m.id ?? "")) ?? [];
16
- }, [
17
- e.options
18
- ]), O = D((s) => n ? [
19
- ...s,
20
- {
21
- value: c,
22
- label: c,
23
- id: z
24
- }
25
- ] : s, [
26
- n,
27
- c
28
- ]), { isLoading: f, options: l, isEmpty: C, shouldRender: I, setIsLoading: R, setOptions: _, setIsEmpty: S, processOptions: F } = G({
29
- fieldType: M.SERVICES_DROPDOWN,
30
- isEditor: e.isEditor,
31
- postProcessOptions: O
32
- }), L = D(async () => {
33
- if (a.current && (r != null && r.fetchServices) && E.length > 0) {
34
- a.current = !1, R(!0);
35
- let s;
36
- try {
37
- s = await r.fetchServices({
38
- serviceIds: E
39
- });
40
- } catch (m) {
41
- console.error(m);
42
- }
43
- if (s) {
44
- const m = F(s);
45
- S(!n && m.length === 0), _(m);
46
- } else
47
- a.current = !0;
48
- R(!1);
49
- }
50
- }, [
51
- r,
52
- E,
53
- F,
54
- n,
55
- R,
56
- _,
57
- S
58
- ]);
59
- P(() => {
60
- if (!e.isEditor && l.length > 0) {
61
- const s = n ? l.length - 1 : l.length;
62
- S(s === 0);
63
- }
64
- }, [
65
- l,
66
- n,
67
- S,
68
- e.isEditor
69
- ]);
70
- const v = D(() => {
71
- e.onFocus && e.onFocus(), a.current && L();
72
- }, [
73
- L,
74
- e.onFocus
75
- ]), N = D(
76
- (s) => {
77
- e.onChange && e.onChange(s), a.current = !0;
78
- },
79
- // eslint-disable-next-line react-hooks/exhaustive-deps
80
- [
81
- e.onChange
82
- ]
83
- );
84
- return {
85
- isLoading: f,
86
- options: l,
87
- isEmpty: C,
88
- onFocus: v,
89
- onChange: N,
90
- shouldRender: I
91
- };
92
- }, o = ({ children: e }) => {
93
- const r = y(), { addOther: h } = r, n = U(), p = r.isEditor || n.isEditor || n.isComposer, { isLoading: c, options: a, isEmpty: E, onFocus: O, onChange: f, shouldRender: l } = J({
94
- ...r,
95
- isEditor: p
96
- }), C = g(() => ({
97
- ...r,
98
- options: c ? [] : a,
99
- isLoading: c,
100
- onFocus: O,
101
- onChange: f
102
- }), [
103
- r,
104
- a,
105
- c,
106
- O,
107
- f
108
- ]);
109
- return !p && E && !h || !l ? null : /* @__PURE__ */ t.createElement(V.Provider, {
110
- value: {
111
- v2: C
112
- }
113
- }, /* @__PURE__ */ t.createElement(d, null, e));
114
- };
115
- o.Label = d.Label;
116
- o.Trigger = d.Trigger;
117
- o.Options = d.Options;
118
- o.Description = d.Description;
119
- o.Error = d.Error;
120
- const X = ({ content: e, locale: r }) => /* @__PURE__ */ t.createElement(T, {
121
- content: e,
122
- locale: r
123
- }), Z = () => {
124
- const e = Y(Q);
125
- return /* @__PURE__ */ t.createElement(o, null, /* @__PURE__ */ t.createElement(o.Label, {
126
- className: u(x, i.label)
127
- }, /* @__PURE__ */ t.createElement(o.Label.Required, {
128
- className: u(H, i.requiredMark)
129
- })), /* @__PURE__ */ t.createElement(o.Trigger, {
130
- className: u(W, i.input, i.dropdownTrigger)
131
- }, /* @__PURE__ */ t.createElement(j, {
132
- className: i.dropdownIcon
133
- })), /* @__PURE__ */ t.createElement(o.Options, {
134
- className: u(k, i.selectPopover, i.dropdownPopover)
135
- }, /* @__PURE__ */ t.createElement(o.Options.Option, {
136
- className: e
137
- })), /* @__PURE__ */ t.createElement(o.Error, {
138
- className: u(q, i.error)
139
- }, /* @__PURE__ */ t.createElement(K, null), /* @__PURE__ */ t.createElement(o.Error.Text, null)), /* @__PURE__ */ t.createElement(o.Description, {
140
- className: u(B, i.description)
141
- }, X));
142
- }, me = () => /* @__PURE__ */ t.createElement(Z, null);
143
- export {
144
- me as ServiceDropdownRAC
145
- };