@wix/form-elements 1.110.0 → 1.112.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 (106) hide show
  1. package/dist/component/{appointment-rac-CfPs6AsU.js → appointment-rac-BZ9sCf_L.js} +4 -4
  2. package/dist/component/{bookings-address-rac-XkgsBu8i.js → bookings-address-rac-DDisJZwl.js} +1 -1
  3. package/dist/component/{bookings-email-rac-CyESeQLD.js → bookings-email-rac-ovewChXn.js} +1 -1
  4. package/dist/component/{bookings-first-name-rac-CFY5Qwk9.js → bookings-first-name-rac-CyudJnHy.js} +1 -1
  5. package/dist/component/{bookings-header-rac-lRsebspV.js → bookings-header-rac-BSN_BoC0.js} +1 -1
  6. package/dist/component/{bookings-last-name-rac-B7J2K4oK.js → bookings-last-name-rac-SdX5IANy.js} +1 -1
  7. package/dist/component/{bookings-login-bar-rac-BD97U76_.js → bookings-login-bar-rac-COQ2BOsY.js} +1 -1
  8. package/dist/component/{bookings-phone-rac-CpgDCLTp.js → bookings-phone-rac-DlUfTzEz.js} +1 -1
  9. package/dist/component/{bookings-rich-text-rac-DQUQMN3s.js → bookings-rich-text-rac-Dx0uxbQc.js} +1 -1
  10. package/dist/component/{checkbox-field-rac-CcOW4yol.js → checkbox-field-rac-DueJINhA.js} +4 -4
  11. package/dist/component/{checkbox-group-field-headless-DiBxnwOj.js → checkbox-group-field-headless-wj9ITlbE.js} +3 -3
  12. package/dist/component/{checkbox-group-field-rac-BCzS44NM.js → checkbox-group-field-rac-CrD849TZ.js} +4 -4
  13. package/dist/component/{checkbox-group-rac-C2oHVikX.js → checkbox-group-rac-Wdz1ShJh.js} +1 -1
  14. package/dist/component/{checkbox-rac-DPhswfJ9.js → checkbox-rac-BC7A8y2w.js} +1 -1
  15. package/dist/component/{contacts-address-rac-Cjqot4Vo.js → contacts-address-rac-DoWo8zyH.js} +1 -1
  16. package/dist/component/{contacts-birthdate-rac-C3uYlFa3.js → contacts-birthdate-rac-CEXkyOuk.js} +1 -1
  17. package/dist/component/{contacts-company-rac-BDmDrlJm.js → contacts-company-rac-CYaVpLCk.js} +1 -1
  18. package/dist/component/{contacts-email-rac-9NI8430K.js → contacts-email-rac-teBI-Rpu.js} +1 -1
  19. package/dist/component/{contacts-first-name-rac-PNgDNwXZ.js → contacts-first-name-rac-BOPuOgk1.js} +1 -1
  20. package/dist/component/{contacts-last-name-rac-Dkf8oYRe.js → contacts-last-name-rac-DdRhuv9q.js} +1 -1
  21. package/dist/component/{contacts-phone-rac-BefG0umR.js → contacts-phone-rac-BMiop0kR.js} +1 -1
  22. package/dist/component/{contacts-position-rac-8ZWMa74Q.js → contacts-position-rac-C8iM62rN.js} +1 -1
  23. package/dist/component/{contacts-subscribe-rac-Dj0k_O2C.js → contacts-subscribe-rac-CkToH-f2.js} +1 -1
  24. package/dist/component/{contacts-tax-id-rac-Dbz0SEH9.js → contacts-tax-id-rac-JM0KJre8.js} +1 -1
  25. package/dist/component/{date-availability-CpZYBX1d.js → date-availability-DJyvNJ6w.js} +1 -1
  26. package/dist/component/{date-input-field-rac-8CkusNEQ.js → date-input-field-rac-CStB2jP7.js} +6 -6
  27. package/dist/component/{date-input-rac-CH1ke9-c.js → date-input-rac-DUSJH8am.js} +1 -1
  28. package/dist/component/{date-picker-field-rac-pZQhHvZc.js → date-picker-field-rac-6xffgnXB.js} +5 -5
  29. package/dist/component/{date-picker-rac-BOdzNgu6.js → date-picker-rac-Dpe0w0G6.js} +1 -1
  30. package/dist/component/{date-time-input-field-rac-DDUZvi8G.js → date-time-input-field-rac-CX39V3G1.js} +6 -6
  31. package/dist/component/{date-time-input-rac-DkjW7KId.js → date-time-input-rac-DBVMIbom.js} +1 -1
  32. package/dist/component/{dext-checkbox-group-rac-Cjx062TO.js → dext-checkbox-group-rac-CAxyCWQY.js} +2 -2
  33. package/dist/component/{dext-checkbox-rac-CIqsZ8Cf.js → dext-checkbox-rac-CRBzElbv.js} +1 -1
  34. package/dist/component/{dext-date-picker-rac-BYQN00yy.js → dext-date-picker-rac-DNzXwBkg.js} +1 -1
  35. package/dist/component/{dext-date-time-input-rac-Bh-HYZ_X.js → dext-date-time-input-rac-D2W3buJP.js} +1 -1
  36. package/dist/component/{dext-dropdown-rac-rnkUqsSx.js → dext-dropdown-rac-CTTreT77.js} +1 -1
  37. package/dist/component/{dext-email-rac-DtW_DadC.js → dext-email-rac-BwI4-hML.js} +1 -1
  38. package/dist/component/{dext-number-input-rac-DTfdLXFG.js → dext-number-input-rac-DT5pQiC3.js} +1 -1
  39. package/dist/component/{dext-phone-rac-D3anV8iB.js → dext-phone-rac-MA6wyUxM.js} +1 -1
  40. package/dist/component/{dext-radio-group-rac-CIO_2H7F.js → dext-radio-group-rac-3PYEgYHn.js} +2 -2
  41. package/dist/component/{dext-rating-input-rac-Bdtbwo1W.js → dext-rating-input-rac-I3e9k3Tp.js} +1 -1
  42. package/dist/component/{dext-tags-rac-DT4_lRM0.js → dext-tags-rac-Bf4tEUAW.js} +2 -2
  43. package/dist/component/{dext-text-area-rac-BgMlIgik.js → dext-text-area-rac-5oOAM6zJ.js} +1 -1
  44. package/dist/component/{dext-text-input-rac-DDc6-lsN.js → dext-text-input-rac-8nHhvQfO.js} +1 -1
  45. package/dist/component/{dext-url-input-rac-CrOT7XQf.js → dext-url-input-rac-DSAfDqx1.js} +1 -1
  46. package/dist/component/{donation-rac-CORUAfww.js → donation-rac-DJiD7Fel.js} +5 -5
  47. package/dist/component/{dropdown-field-headless-B-82vlHV.js → dropdown-field-headless-B_W8kD-t.js} +4 -4
  48. package/dist/component/{dropdown-field-rac-AYGyhYSH.js → dropdown-field-rac-IDVaMgoc.js} +3 -3
  49. package/dist/component/{dropdown-rac-g-zqV-y4.js → dropdown-rac-I2ZO66jF.js} +1 -1
  50. package/dist/component/{ecom-address-rac-BQqh4QrW.js → ecom-address-rac-B1knDuog.js} +1 -1
  51. package/dist/component/{ecom-subscription-checkbox-rac-Cf7Ou6Om.js → ecom-subscription-checkbox-rac-BQPJb2kl.js} +2 -2
  52. package/dist/component/{email-input-field-rac-BFrfF6TW.js → email-input-field-rac-DsjMnxGw.js} +3 -3
  53. package/dist/component/{events-repeater-rac-CNifjThM.js → events-repeater-rac-CT7scvgS.js} +4 -4
  54. package/dist/component/{events-rsvp-rac-CnW7CNdo.js → events-rsvp-rac-Dcrc1yxR.js} +3 -3
  55. package/dist/component/{field-error-headless-BLgaEh1d.js → field-error-headless-DRkkbv__.js} +1 -1
  56. package/dist/component/{field-label-headless-C8NbnF9M.js → field-label-headless-m633nF93.js} +1 -1
  57. package/dist/component/{file-upload-rac-Yk44koqY.js → file-upload-rac-DaExm5ny.js} +4 -4
  58. package/dist/component/{fixed-payment-rac-r_OUP_KD.js → fixed-payment-rac-BglZ8zc0.js} +3 -3
  59. package/dist/component/{form-DC8xFBa_.js → form-CY-iFZdC.js} +69 -69
  60. package/dist/component/form.css +1 -1
  61. package/dist/component/form.js +1 -1
  62. package/dist/component/{header-field-rac-6NOymbBc.js → header-field-rac-B6Mzqr3b.js} +2 -2
  63. package/dist/component/{header-rac-DzK8Cg5s.js → header-rac-CB2NDeCJ.js} +1 -1
  64. package/dist/component/{image-choice-rac-CcCInqrr.js → image-choice-rac-gtYrnTGg.js} +4 -4
  65. package/dist/component/{index-B_72TOzS.js → index-Ozpoh9do.js} +2 -2
  66. package/dist/component/{index-CGbawBGb.js → index-wR-OU2AH.js} +4 -4
  67. package/dist/component/{isObjectLike-BziKAUTi.js → isObjectLike-DsBVSQ_O.js} +1 -1
  68. package/dist/component/{multiline-address-field-rac-CJw6HvHY.js → multiline-address-field-rac-Z4hKy_B_.js} +7 -7
  69. package/dist/component/{multiline-address-rac-B_GR1nkJ.js → multiline-address-rac-DWV0BZHX.js} +1 -1
  70. package/dist/component/{number-input-field-rac-CXFmpNWL.js → number-input-field-rac-DKpSb1S_.js} +4 -4
  71. package/dist/component/{number-input-rac-sr4Dhnxa.js → number-input-rac-Di7Q8CH9.js} +1 -1
  72. package/dist/component/{password-rac-BwBEPYo3.js → password-rac-B9RT0izw.js} +4 -4
  73. package/dist/component/{payment-input-rac-BcLSkgtK.js → payment-input-rac-DdGNnPcd.js} +4 -4
  74. package/dist/component/phone-input-field-rac-B-5gHBXY.js +503 -0
  75. package/dist/component/{phone-rac-B_QYTg28.js → phone-rac-CmZwJyH7.js} +1 -1
  76. package/dist/component/{product-list-rac-C7YDHPj_.js → product-list-rac-BInJ4cw_.js} +4 -4
  77. package/dist/component/{quiz-radio-group-rac-Be1v1PyS.js → quiz-radio-group-rac-B1EIBOt5.js} +1 -1
  78. package/dist/component/{radio-button-module-classes-k9DhZ1Fd.js → radio-button-module-classes-CjDU2x_m.js} +3 -3
  79. package/dist/component/{radio-group-field-rac-BDEAYQH5.js → radio-group-field-rac-DAwCG8w2.js} +4 -4
  80. package/dist/component/{radio-group-rac-DcmSrcGy.js → radio-group-rac-CExbY0aw.js} +1 -1
  81. package/dist/component/{rating-input-field-rac-CcO3-3O3.js → rating-input-field-rac-DTeubyLu.js} +4 -4
  82. package/dist/component/{rating-input-rac-wl8G35Xv.js → rating-input-rac-P7Fdwrm3.js} +1 -1
  83. package/dist/component/{rich-content-rac.module-CzZ6x_Yf.js → rich-content-rac.module-DgQubdPj.js} +1 -1
  84. package/dist/component/{rich-text-field-rac-B4l_YgG7.js → rich-text-field-rac-8dkTMWKw.js} +2 -2
  85. package/dist/component/{rich-text-rac-BlW4v4gg.js → rich-text-rac-C6u_hF5R.js} +1 -1
  86. package/dist/component/{service-dropdown-rac-CJTrm0iL.js → service-dropdown-rac-CTSCew5q.js} +4 -4
  87. package/dist/component/{services-multi-choice-rac-BkiL2Pct.js → services-multi-choice-rac-BUFJHq-l.js} +5 -5
  88. package/dist/component/{signature-rac-_fTng53p.js → signature-rac-yO924Qfv.js} +3 -3
  89. package/dist/component/{submit-button-rac-EmqyRMuE.js → submit-button-rac-BurhcqZP.js} +1 -1
  90. package/dist/component/{tags-field-rac-CTlZZLdv.js → tags-field-rac-qbNQcwnE.js} +5 -5
  91. package/dist/component/{tags-rac-xd-CpByf.js → tags-rac-DVHcpxNG.js} +1 -1
  92. package/dist/component/{text-area-field-rac-Dap_aF4j.js → text-area-field-rac-BKhGX0CL.js} +4 -4
  93. package/dist/component/{text-area-rac-rKSZi3gu.js → text-area-rac-CHHEDeUX.js} +1 -1
  94. package/dist/component/{text-input-field-rac-GBsaUY0A.js → text-input-field-rac-BGitxCuC.js} +3 -3
  95. package/dist/component/{text-input-headless-SHtvSa6y.js → text-input-headless-BBn1G2s9.js} +3 -3
  96. package/dist/component/{text-input-rac-v4R17Vxm.js → text-input-rac-CHX-U7Kp.js} +1 -1
  97. package/dist/component/{time-input-rac-DgnhZSjV.js → time-input-rac-Bp6B2gO3.js} +4 -4
  98. package/dist/component/{url-input-field-rac-BuTadRMy.js → url-input-field-rac-CPibLAWz.js} +4 -4
  99. package/dist/component/{url-input-rac-BpVSwqpz.js → url-input-rac-Bj4PV2YJ.js} +1 -1
  100. package/dist/component/{use-dropdown-option-class-name-Cwfh_4oi.js → use-dropdown-option-class-name-CE1u4RLT.js} +2 -2
  101. package/dist/component/{use-element-state-class-name-BF7I_Ju7.js → use-element-state-class-name-Dn_LpP1k.js} +1 -1
  102. package/dist/component/{use-is-forced-open-dropdown-BMuhxge2.js → use-is-forced-open-dropdown-B2mdY7ku.js} +1 -1
  103. package/dist/component/{use-service-options-base-DfyQZjmw.js → use-service-options-base-DBvqU30V.js} +1 -1
  104. package/dist/component/{use-text-input-class-name-ixt7gTGg.js → use-text-input-class-name-BUW0svzK.js} +2 -2
  105. package/package.json +2 -2
  106. package/dist/component/phone-input-field-rac-4kp5xRJZ.js +0 -487
@@ -1,487 +0,0 @@
1
- import { RicosViewer as Oe } from "@wix/ricos/viewer";
2
- import O from "classnames";
3
- import t, { useMemo as x, useState as B, useRef as v, useEffect as U, useCallback as oe, createContext as le, useContext as K } from "react";
4
- import { aU as _e, bj as P, b1 as ue, bi as Ne, b9 as M, b6 as ie, bb as Se, I as Le, U as Ie, t as Fe, H as ve, K as Pe, v as De, p as Re } from "./form-DC8xFBa_.js";
5
- import { UNSAFE_PortalProvider as xe } from "react-aria";
6
- import { Dialog as me, OverlayTriggerStateContext as Be, ModalOverlay as Me, Modal as qe, SearchField as Ae, Group as G, ListBoxItem as Te, DialogTrigger as $e, Select as je, Input as Ce, ListBox as we, Autocomplete as Ue } from "react-aria-components";
7
- import { f as h, a as H } from "./find-child-C60k4CxG.js";
8
- import { D as ke, E as Ve } from "./field-error-headless-BLgaEh1d.js";
9
- import { L as Ge } from "./field-label-headless-C8NbnF9M.js";
10
- import { N as He, S as Ke } from "./non-modal-popover-DtIMXHbe.js";
11
- import { u as Ye } from "./use-invoke-callback-UH73A_J3.js";
12
- import { u as ze } from "./use-is-forced-open-dropdown-BMuhxge2.js";
13
- import de, { AsYouType as We, isValidPhoneNumber as Ze, isSupportedCountry as Qe } from "libphonenumber-js";
14
- import "libphonenumber-js/metadata.min.json";
15
- import { C as re } from "./calling-country-codes-PyWuOTmF.js";
16
- import { C as Je } from "./chevron-down-icon-CcpVm6B-.js";
17
- import { E as Xe } from "./error-icon-hZxQ6DEy.js";
18
- import { H as ae } from "./custom-focus-class-_483Pkwp.js";
19
- import { s as b } from "./field-rac.module-B4l_0KRU.js";
20
- import { u as et } from "./use-dropdown-option-class-name-Cwfh_4oi.js";
21
- import { u as tt } from "./use-text-input-class-name-ixt7gTGg.js";
22
- function se(e) {
23
- const n = e ? de(e) : void 0, r = n == null ? void 0 : n.country;
24
- if (r)
25
- return r;
26
- const o = new We();
27
- return e && o.input(e), o.getCountry();
28
- }
29
- function Y(e) {
30
- var n;
31
- return e && ((n = _e.getCountryByKey(e)) == null ? void 0 : n.dialCode);
32
- }
33
- function k(e) {
34
- return e === null ? null : e.replace(/[^0-9+]/g, "") || e;
35
- }
36
- function ce(e, n) {
37
- if (e && n)
38
- try {
39
- const r = de(e, n), o = r == null ? void 0 : r.formatInternational();
40
- if (o && Ze(o))
41
- return o.replace(/\s+/g, "");
42
- } catch {
43
- }
44
- return e;
45
- }
46
- function nt() {
47
- const { t: e } = P(), { language: n } = ue();
48
- return x(() => Object.keys(re).reduce((o, a) => {
49
- const l = re[a], s = Y(l), i = e(`locale-dataset.countries.${l.toUpperCase()}`);
50
- return s && Qe(a) && o.push({
51
- countryName: i,
52
- longCountryCode: l,
53
- shortCountryCode: a,
54
- callingCode: s
55
- }), o;
56
- }, []).sort((o, a) => o.countryName.localeCompare(a.countryName, n)), [
57
- e,
58
- n
59
- ]);
60
- }
61
- function ot(e, n) {
62
- return e.filter((r) => n && n.length > 0 ? n.includes(r.shortCountryCode) : !0);
63
- }
64
- function rt(e, n) {
65
- const { countryName: r, callingCode: o, shortCountryCode: a } = e;
66
- return !!(V(r, n) || V(o, n) || V(a, n));
67
- }
68
- function V(e, n) {
69
- return e.toLowerCase().includes(n.toLowerCase());
70
- }
71
- function at({ value: e, defaultCountryCode: n, allowedCountryCodes: r, onChange: o }) {
72
- const [a, l] = B(e || ""), s = v(k(e ?? null) ?? ""), [i, u] = B(n);
73
- Ne(() => {
74
- l(""), s.current = "", u(n), o("");
75
- });
76
- const m = x(() => se(a), [
77
- a
78
- ]);
79
- U(() => {
80
- const d = e ?? "";
81
- d !== s.current && (l(d), s.current = d);
82
- }, [
83
- e
84
- ]), U(() => {
85
- n && !i && u(n);
86
- }, [
87
- n,
88
- i
89
- ]), U(() => {
90
- u(n ?? m);
91
- }, [
92
- m,
93
- n
94
- ]);
95
- const p = oe((d) => {
96
- if (l(d), !d) {
97
- s.current = "", o(null);
98
- return;
99
- }
100
- const E = se(d);
101
- u((y) => {
102
- const N = E || y || ((r == null ? void 0 : r.length) === 1 ? r[0] : void 0), S = k(ce(d, N));
103
- return s.current = S ?? "", o(S), E || y;
104
- });
105
- }, [
106
- r,
107
- o
108
- ]), C = oe((d) => {
109
- u(d), l((E) => {
110
- const y = k(ce(E, d));
111
- return s.current = y ?? "", o(y), E;
112
- });
113
- }, [
114
- o
115
- ]);
116
- return {
117
- currentValue: a,
118
- selectedCountryCode: i,
119
- handlePhoneChange: p,
120
- handleCountryCodeChange: C
121
- };
122
- }
123
- const pe = /* @__PURE__ */ le(null), _ = () => {
124
- const e = K(pe);
125
- if (!e)
126
- throw new Error("Phone input components must be used within PhoneInput component");
127
- return e;
128
- }, ye = /* @__PURE__ */ le(null), z = () => {
129
- const e = K(ye);
130
- if (!e)
131
- throw new Error("Option sub-components must be used within Option component");
132
- return e;
133
- }, W = ({ longCountryCode: e, className: n }) => {
134
- function r(l, s) {
135
- const i = "https://static.parastorage.com/services/linguist-flags/1.1005.0/assets/flags/square/", m = `${l}${s === "2x" ? "_2x" : ""}.png`;
136
- return `${i}${m}`;
137
- }
138
- const o = r(e, "1x"), a = r(e, "2x");
139
- return /* @__PURE__ */ t.createElement("img", {
140
- src: o,
141
- srcSet: `${o} 1x, ${a} 2x`,
142
- alt: "",
143
- "aria-hidden": "true",
144
- loading: "lazy",
145
- className: n
146
- });
147
- }, c = ({ children: e }) => {
148
- var D, F;
149
- const { id: n, value: r, onChange: o, FieldLayout: a, defaultCountry: l, validation: s } = M(), [i, u] = B(null), m = (F = (D = s == null ? void 0 : s.string) == null ? void 0 : D.phoneOptions) == null ? void 0 : F.allowedCountryCodes, p = nt(), C = x(() => ot(p, m), [
150
- p,
151
- m
152
- ]), d = x(() => C.map((R) => R.shortCountryCode), [
153
- C
154
- ]), { currentValue: E, selectedCountryCode: y, handlePhoneChange: N, handleCountryCodeChange: S } = at({
155
- value: r,
156
- defaultCountryCode: l,
157
- allowedCountryCodes: d,
158
- onChange: o
159
- }), A = h(e, c.Label), T = h(e, c.Control), L = h(e, c.Description), $ = h(e, c.Error), I = {
160
- currentValue: E,
161
- selectedCountryCode: y,
162
- handlePhoneChange: N,
163
- handleCountryCodeChange: S,
164
- countryCodes: d,
165
- countries: C,
166
- popoverContainer: i
167
- };
168
- return /* @__PURE__ */ t.createElement(pe.Provider, {
169
- value: I
170
- }, /* @__PURE__ */ t.createElement(a, {
171
- fieldId: n,
172
- renderLabel: () => A,
173
- renderInput: () => /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement("div", {
174
- ref: u,
175
- style: {
176
- display: "contents"
177
- }
178
- }), T),
179
- renderDescription: () => /* @__PURE__ */ t.createElement(t.Fragment, null, $, L)
180
- }));
181
- }, Z = ({ children: e, className: n }) => {
182
- const { inputId: r, labelId: o } = ie(), { hasError: a, disabled: l, readOnly: s } = M(), { t: i } = P(), { selectedCountryCode: u, countries: m } = _(), p = `${r}-country`, C = u ? m.find((N) => N.shortCountryCode === u) : void 0, d = C && Y(C.longCountryCode) || "", E = i("field.phone.country-code.aria-label"), y = C ? `${E}, ${C.countryName}, ${d}` : E;
183
- return /* @__PURE__ */ t.createElement(Ke, {
184
- isDisabled: l || s,
185
- id: p,
186
- "aria-label": y,
187
- "aria-labelledby": o ? `${o} ${p}` : void 0,
188
- className: n,
189
- "data-invalid": a || void 0
190
- }, e);
191
- }, st = ({ className: e }) => {
192
- const { selectedCountryCode: n, countries: r } = _(), o = r.find((a) => a.shortCountryCode === n);
193
- return o ? /* @__PURE__ */ t.createElement(W, {
194
- className: e,
195
- longCountryCode: o.longCountryCode
196
- }) : null;
197
- }, ct = ({ children: e, className: n }) => {
198
- const { selectedCountryCode: r, countries: o } = _();
199
- return o.some((l) => l.shortCountryCode === r) ? null : /* @__PURE__ */ t.createElement("span", {
200
- className: n
201
- }, e);
202
- };
203
- Z.Flag = st;
204
- Z.EmptyState = ct;
205
- const g = ({ children: e, className: n, "aria-label": r, placement: o, offset: a, ...l }) => {
206
- const { triggerRef: s, optionsRef: i, isForcedOpen: u } = l, { popoverContainer: m } = _(), p = h(e, g.Search), C = /* @__PURE__ */ t.createElement(Ee, {
207
- isForcedOpen: u
208
- }, e);
209
- return /* @__PURE__ */ t.createElement(xe, {
210
- getContainer: () => m
211
- }, /* @__PURE__ */ t.createElement(He, {
212
- ref: i,
213
- triggerRef: s,
214
- className: n,
215
- placement: o,
216
- offset: a,
217
- containerPadding: 0
218
- }, p && !u ? /* @__PURE__ */ t.createElement(me, {
219
- "aria-label": r
220
- }, C) : C));
221
- }, lt = ({ children: e, className: n, overlayClassName: r, "aria-label": o, portalContainer: a = t.Fragment, ...l }) => {
222
- const { optionsRef: s } = l, { selectedCountryCode: i, handleCountryCodeChange: u } = _(), m = K(Be);
223
- return /* @__PURE__ */ t.createElement(Me, {
224
- className: r,
225
- isDismissable: !0
226
- }, /* @__PURE__ */ t.createElement(a, null, /* @__PURE__ */ t.createElement(qe, {
227
- ref: s,
228
- className: n
229
- }, /* @__PURE__ */ t.createElement(me, {
230
- "aria-label": o
231
- }, /* @__PURE__ */ t.createElement(Ee, {
232
- listBoxProps: {
233
- "aria-label": o,
234
- selectionMode: "single",
235
- selectedKeys: i ? [
236
- i
237
- ] : [],
238
- onAction: (p) => {
239
- u(p), m == null || m.close();
240
- }
241
- }
242
- }, e)))));
243
- }, Ee = ({ children: e, listBoxProps: n, isForcedOpen: r }) => {
244
- const { countries: o } = _(), a = h(e, g.Option), l = h(e, g.Search), s = h(e, g.EmptyState), i = /* @__PURE__ */ t.createElement(we, {
245
- ...n,
246
- renderEmptyState: s ? () => s : void 0
247
- }, o.map((u) => {
248
- const m = Y(u.longCountryCode) || "";
249
- return H(a, {
250
- key: u.shortCountryCode,
251
- countryCode: u.shortCountryCode,
252
- dialingCode: m,
253
- countryName: u.countryName,
254
- longCountryCode: u.longCountryCode
255
- });
256
- }));
257
- return l ? /* @__PURE__ */ t.createElement(Ue, {
258
- filter: (u, m, p) => {
259
- const C = o.find((d) => d.shortCountryCode === p.key);
260
- return !!C && rt(C, m);
261
- }
262
- }, r ? H(l, {
263
- autoFocus: !1
264
- }) : l, i) : i;
265
- };
266
- g.Popover = g;
267
- g.Modal = lt;
268
- const fe = ({ className: e, children: n, "aria-label": r, ...o }) => {
269
- const { autoFocus: a = !0 } = o;
270
- return /* @__PURE__ */ t.createElement(Ae, {
271
- "aria-label": r,
272
- autoFocus: a
273
- }, /* @__PURE__ */ t.createElement(G, {
274
- className: e
275
- }, n));
276
- }, ut = ({ className: e, placeholder: n }) => /* @__PURE__ */ t.createElement(Ce, {
277
- className: e,
278
- placeholder: n
279
- });
280
- fe.Input = ut;
281
- g.Search = fe;
282
- const it = ({ children: e, className: n }) => /* @__PURE__ */ t.createElement("div", {
283
- className: n
284
- }, e);
285
- g.EmptyState = it;
286
- const q = ({ children: e, className: n, ...r }) => {
287
- const { countryCode: o, dialingCode: a, countryName: l, longCountryCode: s } = r, i = {
288
- countryCode: o,
289
- dialingCode: a,
290
- countryName: l,
291
- longCountryCode: s
292
- }, u = e || /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(he, null), /* @__PURE__ */ t.createElement(ge, null), /* @__PURE__ */ t.createElement(be, null));
293
- return /* @__PURE__ */ t.createElement(Te, {
294
- className: n,
295
- id: o,
296
- textValue: `${l} ${a}`
297
- }, /* @__PURE__ */ t.createElement(ye.Provider, {
298
- value: i
299
- }, u));
300
- }, he = ({ className: e }) => {
301
- const { longCountryCode: n } = z();
302
- return /* @__PURE__ */ t.createElement(W, {
303
- className: e,
304
- longCountryCode: n
305
- });
306
- }, ge = ({ className: e }) => {
307
- const { countryName: n } = z();
308
- return /* @__PURE__ */ t.createElement("span", {
309
- className: e
310
- }, n);
311
- }, be = ({ className: e }) => {
312
- const { dialingCode: n } = z();
313
- return /* @__PURE__ */ t.createElement("span", {
314
- className: e
315
- }, n);
316
- };
317
- q.Flag = he;
318
- q.Name = ge;
319
- q.Code = be;
320
- g.Option = q;
321
- const mt = ({ className: e }) => {
322
- const { t: n } = P(), { inputId: r, ariaDescribedBy: o } = ie(), { id: a, placeholder: l, disabled: s, readOnly: i, required: u, label: m, hasError: p } = M(), { currentValue: C, handlePhoneChange: d } = _(), E = v(null);
323
- return Se(() => {
324
- var y;
325
- (y = E.current) == null || y.focus({
326
- preventScroll: !0
327
- });
328
- }, a), /* @__PURE__ */ t.createElement(Ce, {
329
- ref: E,
330
- id: r,
331
- type: "tel",
332
- value: C,
333
- onChange: (y) => d(y.target.value),
334
- disabled: s,
335
- readOnly: i,
336
- required: u,
337
- "aria-label": `${m}. ${n("field.phone.aria-label")}`,
338
- "aria-describedby": o,
339
- "aria-invalid": p,
340
- placeholder: l,
341
- className: e
342
- });
343
- }, Ct = ({ children: e, className: n }) => {
344
- const r = v(null), o = v(null), a = v(!1), { id: l, disabled: s, readOnly: i, required: u, hasError: m, showFlag: p, onFocus: C, onBlur: d } = M(), [E, y] = B(!1), N = Ye(d), { t: S } = P(), { selectedCountryCode: A, handleCountryCodeChange: T, countries: L } = _(), $ = h(e, c.CountryButton), I = h(e, c.CountryOptions.Modal), D = I ?? h(e, c.CountryOptions.Popover), F = h(e, c.PhoneNumber), R = L.length > 1, j = ze(l) && !I && R, Q = typeof n == "function" ? n({
345
- hasCountryOptions: R
346
- }) : n, J = {
347
- onFocus: () => {
348
- a.current || (a.current = !0, C == null || C());
349
- },
350
- onBlur: (w) => {
351
- var te, ne;
352
- const ee = w.relatedTarget;
353
- !((te = r.current) != null && te.contains(ee)) && !((ne = o.current) != null && ne.contains(ee)) && (a.current = !1, N());
354
- }
355
- };
356
- if (L.length === 1)
357
- return /* @__PURE__ */ t.createElement(G, {
358
- ref: r,
359
- className: Q,
360
- isDisabled: s,
361
- isInvalid: m,
362
- ...J
363
- }, p && /* @__PURE__ */ t.createElement(W, {
364
- longCountryCode: L[0].longCountryCode
365
- }), F);
366
- const X = /* @__PURE__ */ t.createElement(t.Fragment, null, $, H(D, {
367
- triggerRef: r,
368
- optionsRef: o,
369
- isForcedOpen: j
370
- }));
371
- return /* @__PURE__ */ t.createElement(G, {
372
- ref: r,
373
- className: Q,
374
- isDisabled: s,
375
- isInvalid: m,
376
- ...J
377
- }, I ? /* @__PURE__ */ t.createElement($e, null, X) : /* @__PURE__ */ t.createElement(je, {
378
- "aria-label": S("field.phone.country-code.aria-label"),
379
- value: A ?? null,
380
- onChange: (w) => T(w),
381
- isDisabled: s || i,
382
- isInvalid: m,
383
- isRequired: u,
384
- placeholder: "",
385
- isOpen: j || E && !s && !i,
386
- onOpenChange: j ? void 0 : y
387
- }, X), F);
388
- };
389
- c.Label = Ge;
390
- c.Control = Ct;
391
- c.CountryButton = Z;
392
- c.CountryOptions = g;
393
- c.PhoneNumber = mt;
394
- c.Description = ke;
395
- c.Error = Ve;
396
- const dt = (e) => /* @__PURE__ */ t.createElement("svg", {
397
- width: 24,
398
- height: 24,
399
- viewBox: "0 0 24 24",
400
- fill: "currentColor",
401
- "aria-hidden": "true",
402
- ...e
403
- }, /* @__PURE__ */ t.createElement("path", {
404
- fillRule: "evenodd",
405
- 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"
406
- })), pt = (e) => /* @__PURE__ */ t.createElement("svg", {
407
- width: 24,
408
- height: 24,
409
- viewBox: "0 0 24 24",
410
- fill: "currentColor",
411
- "aria-hidden": "true",
412
- ...e
413
- }, /* @__PURE__ */ t.createElement("path", {
414
- fillRule: "evenodd",
415
- 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"
416
- })), yt = "_control_124jq_1", Et = "_countryButton_124jq_9", ft = "_chevron_124jq_25", ht = "_globeIcon_124jq_34", gt = "_searchIcon_124jq_35", bt = "_flag_124jq_44", Ot = "_phoneNumber_124jq_59", _t = "_countryOptions_124jq_85", Nt = "_option_124jq_93", St = "_countrySearch_124jq_102", Lt = "_mobileDrawer_124jq_110", It = "_name_124jq_119", Ft = "_code_124jq_123", vt = "_mobileOverlay_124jq_140", f = {
417
- control: yt,
418
- countryButton: Et,
419
- chevron: ft,
420
- globeIcon: ht,
421
- searchIcon: gt,
422
- flag: bt,
423
- phoneNumber: Ot,
424
- countryOptions: _t,
425
- option: Nt,
426
- countrySearch: St,
427
- mobileDrawer: Lt,
428
- name: It,
429
- code: Ft,
430
- mobileOverlay: vt
431
- }, Pt = ({ content: e, locale: n }) => /* @__PURE__ */ t.createElement(Oe, {
432
- content: e,
433
- locale: n
434
- }), Dt = () => /* @__PURE__ */ t.createElement("span", {
435
- className: f.chevron,
436
- "aria-hidden": "true"
437
- }, /* @__PURE__ */ t.createElement(Je, null)), Jt = () => {
438
- const e = et(b.selectOptionWithoutFocusRing, f.option, ae), n = tt(f.countrySearch), { t: r } = P(), { isMobile: o, PortalContainer: a } = ue(), l = /* @__PURE__ */ t.createElement(c.CountryOptions.Search, {
439
- className: n,
440
- "aria-label": r("field.phone.country-search-input.aria-label")
441
- }, /* @__PURE__ */ t.createElement(pt, {
442
- className: f.searchIcon
443
- }), /* @__PURE__ */ t.createElement(c.CountryOptions.Search.Input, {
444
- className: O(b.innerInput, ae),
445
- placeholder: r("field.phone.country-search-input.placeholder")
446
- })), s = /* @__PURE__ */ t.createElement(c.CountryOptions.EmptyState, null, r("field.phone.country-selector-dropdown.no-result")), i = /* @__PURE__ */ t.createElement(c.CountryOptions.Option, {
447
- className: e
448
- }, /* @__PURE__ */ t.createElement(c.CountryOptions.Option.Flag, {
449
- className: f.flag
450
- }), /* @__PURE__ */ t.createElement(c.CountryOptions.Option.Name, {
451
- className: f.name
452
- }), /* @__PURE__ */ t.createElement(c.CountryOptions.Option.Code, {
453
- className: f.code
454
- }));
455
- return /* @__PURE__ */ t.createElement(c, null, /* @__PURE__ */ t.createElement(c.Label, {
456
- className: O(Le, b.label)
457
- }, /* @__PURE__ */ t.createElement(c.Label.Required, {
458
- className: O(Ie, b.requiredMark)
459
- })), /* @__PURE__ */ t.createElement(c.Control, {
460
- className: ({ hasCountryOptions: u }) => O(u ? Fe : ve, b.input, f.control)
461
- }, /* @__PURE__ */ t.createElement(c.CountryButton, {
462
- className: f.countryButton
463
- }, /* @__PURE__ */ t.createElement(c.CountryButton.Flag, {
464
- className: f.flag
465
- }), /* @__PURE__ */ t.createElement(c.CountryButton.EmptyState, null, /* @__PURE__ */ t.createElement(dt, {
466
- className: f.globeIcon
467
- })), /* @__PURE__ */ t.createElement(Dt, null)), /* @__PURE__ */ t.createElement(c.PhoneNumber, {
468
- className: O(b.innerInput, f.phoneNumber)
469
- }), o ? /* @__PURE__ */ t.createElement(c.CountryOptions.Modal, {
470
- className: O(b.selectPopover, f.mobileDrawer),
471
- overlayClassName: f.mobileOverlay,
472
- portalContainer: a,
473
- "aria-label": r("field.phone.country-code.aria-label")
474
- }, l, s, i) : /* @__PURE__ */ t.createElement(c.CountryOptions.Popover, {
475
- className: O(Pe, b.selectPopover, f.countryOptions),
476
- placement: "bottom start",
477
- offset: 0,
478
- "aria-label": r("field.phone.country-code.aria-label")
479
- }, l, s, i)), /* @__PURE__ */ t.createElement(c.Error, {
480
- className: O(De, b.error)
481
- }, /* @__PURE__ */ t.createElement(Xe, null), /* @__PURE__ */ t.createElement(c.Error.Text, null)), /* @__PURE__ */ t.createElement(c.Description, {
482
- className: O(Re, b.description)
483
- }, Pt));
484
- };
485
- export {
486
- Jt as P
487
- };