@wix/form-elements 1.71.0 → 1.73.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 (109) hide show
  1. package/dist/component/{appointment-rac-CrzIERuK.js → appointment-rac-Bze1s2XD.js} +5 -5
  2. package/dist/component/{bookings-address-rac-Dfkpd7m-.js → bookings-address-rac-BcrkXf63.js} +1 -1
  3. package/dist/component/{bookings-email-rac-qQ7bgngn.js → bookings-email-rac-DYq5RxOP.js} +1 -1
  4. package/dist/component/{bookings-first-name-rac-plgTTOzk.js → bookings-first-name-rac-ZJ_sQ-01.js} +1 -1
  5. package/dist/component/{bookings-header-rac-B3LjHXJs.js → bookings-header-rac-Cv8kl01f.js} +1 -1
  6. package/dist/component/{bookings-last-name-rac-DwDrEmTT.js → bookings-last-name-rac-BmnulSZ6.js} +1 -1
  7. package/dist/component/{bookings-login-bar-rac-EGRy_-2H.js → bookings-login-bar-rac-Bdi4xs9y.js} +2 -2
  8. package/dist/component/{bookings-phone-rac-BgViVOU-.js → bookings-phone-rac-C8DjSzUY.js} +1 -1
  9. package/dist/component/{bookings-rich-text-rac-CDwCdPHa.js → bookings-rich-text-rac-DYu011oy.js} +1 -1
  10. package/dist/component/{checkbox-field-rac-wF2nX9PW.js → checkbox-field-rac-BH3yEE5j.js} +43 -43
  11. package/dist/component/{checkbox-group-field-headless-jNzvn7tN.js → checkbox-group-field-headless-D_GG5LHM.js} +3 -3
  12. package/dist/component/{checkbox-group-field-rac-6PaMjzeg.js → checkbox-group-field-rac-Cj7Erubs.js} +20 -19
  13. package/dist/component/{checkbox-group-rac-BV9-hfo0.js → checkbox-group-rac-CgW0DnhX.js} +1 -1
  14. package/dist/component/{checkbox-rac-BbKD6UEX.js → checkbox-rac-DOAYMMsi.js} +1 -1
  15. package/dist/component/{contacts-address-rac-pDLwXVYR.js → contacts-address-rac-DXJa4J_k.js} +1 -1
  16. package/dist/component/{contacts-birthdate-rac-BJx3BjlB.js → contacts-birthdate-rac-CVsuRq3B.js} +1 -1
  17. package/dist/component/{contacts-company-rac-DyKNlrhE.js → contacts-company-rac-b2bwHSNC.js} +1 -1
  18. package/dist/component/{contacts-email-rac-DmYj37_A.js → contacts-email-rac-DMPcpQ1c.js} +1 -1
  19. package/dist/component/{contacts-first-name-rac-DeyEyMG0.js → contacts-first-name-rac-CL2BsHuJ.js} +1 -1
  20. package/dist/component/{contacts-last-name-rac-SwBI_L_7.js → contacts-last-name-rac-hdBsWaqb.js} +1 -1
  21. package/dist/component/{contacts-phone-rac-BRDIz_ya.js → contacts-phone-rac-DQF6aV9B.js} +1 -1
  22. package/dist/component/{contacts-position-rac-DDfta8r4.js → contacts-position-rac-CVX-WCfx.js} +1 -1
  23. package/dist/component/{contacts-subscribe-rac-Bx6b16b3.js → contacts-subscribe-rac-Dl1ot9qw.js} +2 -2
  24. package/dist/component/{contacts-tax-id-rac-DICtcCkJ.js → contacts-tax-id-rac-0KTXvF81.js} +1 -1
  25. package/dist/component/{date-availability-DM6KcDU2.js → date-availability-DBljhBgO.js} +1 -1
  26. package/dist/component/{date-input-field-rac-F_DfMOXT.js → date-input-field-rac-CfflD2Ar.js} +5 -5
  27. package/dist/component/{date-input-rac-Ho7shG41.js → date-input-rac-fQclCKoa.js} +1 -1
  28. package/dist/component/{date-picker-field-rac-BEXQ7hyT.js → date-picker-field-rac-BSmFOaH-.js} +6 -6
  29. package/dist/component/{date-picker-rac-C32DD1bT.js → date-picker-rac-D7I3ramu.js} +1 -1
  30. package/dist/component/{date-time-input-field-rac-BVbgkFtL.js → date-time-input-field-rac-vjZDQ_Fp.js} +5 -5
  31. package/dist/component/{date-time-input-rac-DB4xpq5h.js → date-time-input-rac-CDbS0VZR.js} +1 -1
  32. package/dist/component/{dext-checkbox-group-rac-C2s4IBgt.js → dext-checkbox-group-rac-BBiPt6_a.js} +2 -2
  33. package/dist/component/{dext-checkbox-rac-NyBGiLzP.js → dext-checkbox-rac-Cqp--0SO.js} +1 -1
  34. package/dist/component/{dext-date-picker-rac-JKcEE1fQ.js → dext-date-picker-rac-5Wft0w9m.js} +1 -1
  35. package/dist/component/{dext-date-time-input-rac-DtamPz-x.js → dext-date-time-input-rac-Bbs7bgtn.js} +1 -1
  36. package/dist/component/{dext-dropdown-rac-194Qq0or.js → dext-dropdown-rac-CSvhtqbc.js} +1 -1
  37. package/dist/component/{dext-email-rac-Chwg6ePI.js → dext-email-rac-BoLeXqyI.js} +1 -1
  38. package/dist/component/{dext-number-input-rac-DORye-Si.js → dext-number-input-rac-DzaJYTSz.js} +1 -1
  39. package/dist/component/{dext-phone-rac-jykmsttk.js → dext-phone-rac-BagPg_CT.js} +1 -1
  40. package/dist/component/{dext-radio-group-rac-MvkExS4d.js → dext-radio-group-rac-B5HSQt7a.js} +2 -2
  41. package/dist/component/{dext-rating-input-rac-DUsqZg7A.js → dext-rating-input-rac-DrtaAf-E.js} +1 -1
  42. package/dist/component/{dext-tags-rac-DnMlv2wO.js → dext-tags-rac-Cg4jJ4jr.js} +2 -2
  43. package/dist/component/{dext-text-area-rac-DGMWNaah.js → dext-text-area-rac-C_t-W7lk.js} +1 -1
  44. package/dist/component/{dext-text-input-rac-Cv0NkJrp.js → dext-text-input-rac-ChvV21Jf.js} +1 -1
  45. package/dist/component/{dext-url-input-rac-DpMC8935.js → dext-url-input-rac-DclbSYTr.js} +1 -1
  46. package/dist/component/donation-rac-FYQIMm5m.js +308 -0
  47. package/dist/component/{dropdown-field-headless-C_-tm9VD.js → dropdown-field-headless-CTZ-zGqZ.js} +3 -3
  48. package/dist/component/{dropdown-field-rac-DRKVFHE1.js → dropdown-field-rac-C1KVtxwv.js} +5 -5
  49. package/dist/component/{dropdown-rac-BLqlMGTK.js → dropdown-rac-CkkDEDje.js} +1 -1
  50. package/dist/component/{ecom-address-rac-BdlTO9SW.js → ecom-address-rac-BOuugSxX.js} +1 -1
  51. package/dist/component/{ecom-subscription-checkbox-rac-CcF5V54K.js → ecom-subscription-checkbox-rac-IZeMlljb.js} +3 -3
  52. package/dist/component/{email-input-field-rac-C-lfW9Ua.js → email-input-field-rac-CNzmm1j7.js} +27 -27
  53. package/dist/component/{events-repeater-rac-sHbYZ-WY.js → events-repeater-rac-CMV0Lmwz.js} +4 -4
  54. package/dist/component/{events-rsvp-rac-Bx_xn-K0.js → events-rsvp-rac-BmjboAco.js} +3 -3
  55. package/dist/component/{field-error-headless-DWbRjy6q.js → field-error-headless-DQZ5XAdn.js} +1 -1
  56. package/dist/component/{field-label-headless-DUWK0CI-.js → field-label-headless-DoxfHHaj.js} +1 -1
  57. package/dist/component/field-rac.module-Cac83bU5.js +21 -0
  58. package/dist/component/{file-upload-rac-D9NdbrRq.js → file-upload-rac-YEQ7uXhm.js} +47 -47
  59. package/dist/component/{fixed-payment-rac-i_hkRpLX.js → fixed-payment-rac-DDufIQBT.js} +5 -5
  60. package/dist/component/{form-Pr0rklwH.js → form-C6WwBcGP.js} +69 -69
  61. package/dist/component/{form-element-classes-BSMjWijd.js → form-element-classes-DDKCTFQj.js} +24 -22
  62. package/dist/component/form-element-keys-D0sEdpFo.js +8 -0
  63. package/dist/component/form.css +1 -1
  64. package/dist/component/form.js +1 -1
  65. package/dist/component/{header-field-rac-C22TlZYz.js → header-field-rac-DGfjrjQC.js} +3 -3
  66. package/dist/component/{header-rac-CRBMp0xN.js → header-rac-C_JE2cTg.js} +1 -1
  67. package/dist/component/image-choice-rac-LDLPQwrN.js +147 -0
  68. package/dist/component/{index-FZEaJpsD.js → index-C2srcuHD.js} +4 -4
  69. package/dist/component/{index-BJ-kFqI7.js → index-CIOoaQ8Z.js} +2 -2
  70. package/dist/component/{isObjectLike-DnLDLZFA.js → isObjectLike-E5QfEa1u.js} +1 -1
  71. package/dist/component/{multiline-address-field-rac-c1vN8M4W.js → multiline-address-field-rac-Biyj2tIN.js} +6 -6
  72. package/dist/component/{multiline-address-rac-BVd_JUMw.js → multiline-address-rac-BCqCvG7a.js} +1 -1
  73. package/dist/component/{number-input-field-rac-DXfWTZkC.js → number-input-field-rac-CwUoIbM8.js} +5 -5
  74. package/dist/component/{number-input-rac-uUl9e8AI.js → number-input-rac-CdYdTDem.js} +1 -1
  75. package/dist/component/{password-rac-BDJ6HPYo.js → password-rac-D62npVHY.js} +10 -10
  76. package/dist/component/{payment-input-rac-XRcefuRt.js → payment-input-rac-D4u-3vcW.js} +7 -7
  77. package/dist/component/{phone-input-field-rac-DHgA6BeE.js → phone-input-field-rac-uHxR3ozd.js} +15 -15
  78. package/dist/component/{phone-rac-CMtVXoft.js → phone-rac-Bf99_BGi.js} +1 -1
  79. package/dist/component/{product-list-rac-CBLHOwHX.js → product-list-rac-iRf6Ra7i.js} +5 -5
  80. package/dist/component/{quiz-radio-group-rac-CAmXql2m.js → quiz-radio-group-rac-CPGS0LEb.js} +2 -2
  81. package/dist/component/{radio-group-field-rac-DBjgd4cD.js → radio-group-field-rac-BWpTNAbO.js} +3 -3
  82. package/dist/component/{radio-group-field-rac.module-CqOyiO2g.js → radio-group-field-rac.module-WxU5zxvM.js} +3 -3
  83. package/dist/component/{radio-group-rac-CrEtErkv.js → radio-group-rac-dA4WZ1Vj.js} +1 -1
  84. package/dist/component/rating-input-field-rac-CJnFsBvH.js +127 -0
  85. package/dist/component/{rating-input-rac-CtidC0z2.js → rating-input-rac-DXVYozFV.js} +1 -1
  86. package/dist/component/{rich-content-rac.module-DX2Jd5w6.js → rich-content-rac.module-DkKwzJS7.js} +1 -1
  87. package/dist/component/{rich-text-field-rac-CusODU1H.js → rich-text-field-rac-8FWCRrpb.js} +3 -3
  88. package/dist/component/{rich-text-rac-wq_vA-qU.js → rich-text-rac-OeM_mPRy.js} +1 -1
  89. package/dist/component/{service-dropdown-rac--YcOnGmq.js → service-dropdown-rac-mvUMpcS_.js} +15 -15
  90. package/dist/component/{services-multi-choice-rac-D_kSdluR.js → services-multi-choice-rac-DrgUrn_N.js} +10 -10
  91. package/dist/component/{signature-rac-DBAg8bEo.js → signature-rac-D44U9Uyp.js} +53 -53
  92. package/dist/component/{submit-button-rac-BW3P99jM.js → submit-button-rac-BqtcgVAn.js} +2 -2
  93. package/dist/component/tags-field-rac-CemsTKWz.js +207 -0
  94. package/dist/component/{tags-rac-Bqo0dqEU.js → tags-rac-fVjCf6qo.js} +1 -1
  95. package/dist/component/{text-area-field-rac-DaWfCdVq.js → text-area-field-rac-BPciZlZb.js} +7 -7
  96. package/dist/component/{text-area-rac-BVnA5cPV.js → text-area-rac-CRTORdZM.js} +1 -1
  97. package/dist/component/{text-input-field-rac-Dm6a4jOn.js → text-input-field-rac-CvFoWlRN.js} +3 -3
  98. package/dist/component/{text-input-headless-fTooOIqx.js → text-input-headless-BQ3TWU9G.js} +3 -3
  99. package/dist/component/{text-input-rac-DA0we6AY.js → text-input-rac-DSFkEmob.js} +1 -1
  100. package/dist/component/{time-input-rac-DQ9raFL_.js → time-input-rac-CGgs7ncp.js} +9 -9
  101. package/dist/component/{url-input-field-rac-BEpbWAVe.js → url-input-field-rac-CqvgTc-F.js} +13 -13
  102. package/dist/component/{url-input-rac-Du6EqRQX.js → url-input-rac-C45KOwnr.js} +1 -1
  103. package/dist/component/{use-service-options-base-OMXZXAVb.js → use-service-options-base-D4Zl-iGW.js} +1 -1
  104. package/package.json +2 -2
  105. package/dist/component/donation-rac-DeBx8D9a.js +0 -302
  106. package/dist/component/field-rac.module-DnUIb9Oh.js +0 -21
  107. package/dist/component/image-choice-rac-cjylrvfO.js +0 -141
  108. package/dist/component/rating-input-field-rac-BWn0usVp.js +0 -130
  109. package/dist/component/tags-field-rac-DSdwley7.js +0 -201
@@ -1,130 +0,0 @@
1
- import { RicosViewer as D } from "@wix/ricos/viewer";
2
- import d from "classnames";
3
- import e, { useCallback as N, useState as y, useRef as O } from "react";
4
- import { ai as v, af as I, as as A } from "./form-Pr0rklwH.js";
5
- import { RadioGroup as w, RadioField as M, RadioButton as B } from "react-aria-components";
6
- import { f as m, a as T } from "./find-child-C60k4CxG.js";
7
- import { D as P, E as q } from "./field-error-headless-DWbRjy6q.js";
8
- import { L as H } from "./field-label-headless-DUWK0CI-.js";
9
- import { E as x } from "./error-icon-hZxQ6DEy.js";
10
- import { s as u } from "./field-rac.module-DnUIb9Oh.js";
11
- import { z, P as k, O as G, q as j, j as Q } from "./form-element-classes-BSMjWijd.js";
12
- const t = ({ children: r }) => {
13
- const { id: n, value: s, onChange: o, disabled: l, required: c, hasError: i, onBlur: C, onFocus: L, FieldLayout: E } = v(), { labelId: p } = I(), R = N((F) => o(Number(F)), [
14
- o
15
- ]), f = m(r, t.Label), a = m(r, t.Ratings), g = m(r, t.Description), S = m(r, t.Error);
16
- return /* @__PURE__ */ e.createElement(E, {
17
- fieldId: n,
18
- renderLabel: () => f,
19
- renderInput: () => /* @__PURE__ */ e.createElement(w, {
20
- "aria-labelledby": p,
21
- value: s ? String(s) : void 0,
22
- onChange: R,
23
- isDisabled: l,
24
- isRequired: c,
25
- isInvalid: i,
26
- onBlur: C,
27
- onFocus: L,
28
- orientation: "horizontal"
29
- }, a),
30
- renderDescription: () => /* @__PURE__ */ e.createElement(e.Fragment, null, S, g)
31
- });
32
- }, h = ({ children: r, className: n, getReactionLabel: s }) => {
33
- const { value: o, hasError: l } = v(), { inputId: c, ariaDescribedBy: i } = I(), [C, L] = y(), E = O(null), p = m(r, h.Rating), R = [
34
- "1",
35
- "2",
36
- "3",
37
- "4",
38
- "5"
39
- ], f = (a) => C ? C >= a : !!o && o >= Number(a);
40
- return /* @__PURE__ */ e.createElement("div", {
41
- ref: E,
42
- id: c,
43
- "aria-describedby": i,
44
- className: n,
45
- "data-invalid": l
46
- }, R.map((a) => T(p, {
47
- key: a,
48
- value: a,
49
- isSelected: f(a),
50
- onHoverChange: (g) => L(g ? a : void 0),
51
- label: s == null ? void 0 : s(Number(a))
52
- })));
53
- }, U = {
54
- border: 0,
55
- clipPath: "inset(50%)",
56
- height: 1,
57
- margin: -1,
58
- overflow: "hidden",
59
- padding: 0,
60
- position: "absolute",
61
- width: 1,
62
- whiteSpace: "nowrap"
63
- }, _ = ({ className: r, children: n, ...s }) => {
64
- const { value: o, isSelected: l, onHoverChange: c, label: i } = s;
65
- return /* @__PURE__ */ e.createElement(M, {
66
- value: o
67
- }, /* @__PURE__ */ e.createElement(B, {
68
- className: r,
69
- "data-active": l || void 0,
70
- onHoverChange: c
71
- }, typeof n == "function" ? n({
72
- isSelected: l
73
- }) : n, i ? /* @__PURE__ */ e.createElement("span", {
74
- style: U
75
- }, i) : null));
76
- };
77
- h.Rating = _;
78
- t.Label = H;
79
- t.Ratings = h;
80
- t.Rating = _;
81
- t.Description = P;
82
- t.Error = q;
83
- const Z = (r) => /* @__PURE__ */ e.createElement("svg", {
84
- viewBox: "0 0 32 32",
85
- width: 32,
86
- height: 32,
87
- fill: "currentColor",
88
- "aria-hidden": "true",
89
- ...r
90
- }, /* @__PURE__ */ e.createElement("path", {
91
- fillRule: "evenodd",
92
- d: "M28.6265,13.6325 C28.9655,13.3015 29.0845,12.8175 28.9385,12.3665 C28.7925,11.9165 28.4105,11.5945 27.9415,11.5265 L20.5785,10.4565 C20.5015,10.4445 20.4345,10.3965 20.4005,10.3275 L17.1075,3.6545 L17.1075,3.6535 C16.8975,3.2295 16.4735,2.9655 16.0005,2.9655 L15.9995,2.9655 C15.5255,2.9655 15.1025,3.2295 14.8925,3.6545 L11.5985,10.3275 C11.5645,10.3965 11.4985,10.4445 11.4225,10.4565 L4.0575,11.5265 C3.5895,11.5945 3.2075,11.9165 3.0615,12.3665 C2.9155,12.8175 3.0345,13.3015 3.3735,13.6325 L8.7025,18.8265 C8.7575,18.8805 8.7835,18.9585 8.7705,19.0345 L7.5125,26.3695 C7.4325,26.8355 7.6205,27.2985 8.0035,27.5765 C8.2195,27.7345 8.4735,27.8145 8.7285,27.8145 C8.9245,27.8145 9.1215,27.7665 9.3045,27.6705 L15.8895,24.2085 C15.9595,24.1725 16.0415,24.1725 16.1085,24.2075 L22.6955,27.6705 C23.1155,27.8915 23.6135,27.8555 23.9965,27.5765 C24.3795,27.2985 24.5675,26.8355 24.4875,26.3695 L23.2305,19.0355 C23.2165,18.9585 23.2425,18.8805 23.2975,18.8265 L28.6265,13.6325 Z"
93
- })), J = (r) => /* @__PURE__ */ e.createElement("svg", {
94
- viewBox: "0 0 32 32",
95
- width: 32,
96
- height: 32,
97
- fill: "currentColor",
98
- "aria-hidden": "true",
99
- ...r
100
- }, /* @__PURE__ */ e.createElement("path", {
101
- fillRule: "evenodd",
102
- d: "M16,3.966 C15.956,3.966 15.848,3.979 15.789,4.097 L12.496,10.77 C12.317,11.133 11.969,11.386 11.567,11.445 L4.202,12.515 C4.072,12.534 4.026,12.634 4.012,12.675 C3.999,12.717 3.978,12.824 4.072,12.917 L9.4,18.111 C9.691,18.394 9.824,18.803 9.755,19.204 L8.498,26.538 C8.476,26.668 8.556,26.742 8.591,26.768 C8.627,26.793 8.721,26.846 8.838,26.786 L15.426,23.323 C15.785,23.133 16.215,23.134 16.574,23.322 L23.162,26.786 C23.277,26.846 23.374,26.793 23.409,26.768 C23.444,26.742 23.524,26.668 23.502,26.538 L22.245,19.204 C22.176,18.803 22.309,18.394 22.6,18.111 L27.928,12.917 C28.022,12.824 28.001,12.717 27.988,12.675 C27.974,12.634 27.928,12.534 27.798,12.515 L20.434,11.445 C20.031,11.386 19.683,11.133 19.504,10.769 L16.211,4.097 C16.152,3.979 16.044,3.966 16,3.966 M8.728,27.814 C8.473,27.814 8.22,27.734 8.003,27.577 C7.62,27.299 7.432,26.836 7.512,26.369 L8.77,19.035 C8.783,18.958 8.758,18.881 8.702,18.826 L3.374,13.633 C3.035,13.302 2.915,12.817 3.061,12.367 C3.208,11.916 3.589,11.594 4.058,11.526 L11.422,10.456 C11.499,10.445 11.565,10.397 11.599,10.328 L14.893,3.654 C15.102,3.23 15.526,2.966 16,2.966 C16.474,2.966 16.898,3.23 17.107,3.654 L20.401,10.327 C20.435,10.397 20.501,10.445 20.579,10.456 L27.942,11.526 C28.411,11.594 28.792,11.916 28.939,12.367 C29.085,12.817 28.965,13.302 28.626,13.633 L23.298,18.826 C23.242,18.881 23.217,18.958 23.23,19.035 L24.488,26.369 C24.568,26.836 24.38,27.299 23.997,27.577 C23.614,27.855 23.116,27.892 22.696,27.671 L16.109,24.208 C16.042,24.173 15.959,24.172 15.891,24.208 L9.304,27.671 C9.122,27.767 8.924,27.814 8.728,27.814"
103
- })), K = "_ratings_112z7_1", W = "_rating_112z7_1", b = {
104
- ratings: K,
105
- rating: W
106
- }, X = ({ content: r, locale: n }) => /* @__PURE__ */ e.createElement(D, {
107
- content: r,
108
- locale: n
109
- }), i2 = () => {
110
- const { t: r } = A();
111
- return /* @__PURE__ */ e.createElement(t, null, /* @__PURE__ */ e.createElement(t.Label, {
112
- className: d(z, u.label)
113
- }, /* @__PURE__ */ e.createElement(t.Label.Required, {
114
- className: d(k, u.requiredMark)
115
- })), /* @__PURE__ */ e.createElement(t.Ratings, {
116
- className: b.ratings,
117
- getReactionLabel: (n) => r("rating-input.a11y.reaction-label", {
118
- count: n
119
- })
120
- }, /* @__PURE__ */ e.createElement(t.Rating, {
121
- className: d(G, b.rating)
122
- }, ({ isSelected: n }) => n ? /* @__PURE__ */ e.createElement(Z, null) : /* @__PURE__ */ e.createElement(J, null))), /* @__PURE__ */ e.createElement(t.Error, {
123
- className: d(j, u.error)
124
- }, /* @__PURE__ */ e.createElement(x, null), /* @__PURE__ */ e.createElement(t.Error.Text, null)), /* @__PURE__ */ e.createElement(t.Description, {
125
- className: d(Q, u.description)
126
- }, X));
127
- };
128
- export {
129
- i2 as R
130
- };
@@ -1,201 +0,0 @@
1
- import { RicosViewer as H } from "@wix/ricos/viewer";
2
- import _ from "classnames";
3
- import e, { useMemo as F, useState as j, useRef as k, useLayoutEffect as z, useCallback as M } from "react";
4
- import { CheckboxGroup as Q, TextField as J, Input as K, CheckboxField as X, CheckboxButton as Y } from "react-aria-components";
5
- import { ai as D, af as Z, as as v, ab as ee, ak as te } from "./form-Pr0rklwH.js";
6
- import { f, a as x } from "./find-child-C60k4CxG.js";
7
- import { E as B, D as P } from "./field-error-headless-DWbRjy6q.js";
8
- import { L as $ } from "./field-label-headless-DUWK0CI-.js";
9
- import { F as ae } from "./fieldset-headless-CD3fds9J.js";
10
- import { N } from "./options-layout-constants-DEfIEJWD.js";
11
- import { E as ne } from "./error-icon-hZxQ6DEy.js";
12
- import { s as S } from "./field-rac.module-DnUIb9Oh.js";
13
- import { z as re, P as oe, _ as se, $ as le, a0 as ie, y as ce, q as ue, j as de } from "./form-element-classes-BSMjWijd.js";
14
- import { o as me } from "./options-rac.module-KM-VT_KY.js";
15
- const g = "Other", pe = (t, a) => {
16
- const c = a.length + 2;
17
- return (t.find((r) => r.startsWith(`${a}: `)) || "").slice(c);
18
- }, he = (t) => t.map((a) => a.value ?? a.label), q = ({ className: t, ...a }) => {
19
- const { label: l } = a;
20
- return /* @__PURE__ */ e.createElement("span", {
21
- className: t
22
- }, l);
23
- }, W = ({ className: t }) => {
24
- const { value: a, onChange: l, addOtherLabel: c, addOtherPlaceholder: i, otherInputCharacterLimit: r, disabled: u, readOnly: b, hasError: d } = D(), { t: m } = v(), o = c || m("add-other.default-other-option-label") || g, p = F(() => pe(a || [], o), [
25
- a,
26
- o
27
- ]), [n, L] = j(p), h = k(l);
28
- z(() => {
29
- h.current = l;
30
- });
31
- const I = M((E) => {
32
- L(E);
33
- const C = (a || []).filter((O) => !O.startsWith(`${o}:`) && O !== o), R = E ? `${o}: ${E}` : o;
34
- h.current([
35
- ...C,
36
- R
37
- ]);
38
- }, [
39
- a,
40
- o
41
- ]);
42
- return /* @__PURE__ */ e.createElement(J, {
43
- value: n,
44
- onChange: I,
45
- isDisabled: u,
46
- isReadOnly: b,
47
- isInvalid: d,
48
- "aria-label": o
49
- }, /* @__PURE__ */ e.createElement(K, {
50
- "data-hook": "tags-other-input",
51
- "data-filled": n ? !0 : void 0,
52
- placeholder: i,
53
- maxLength: r,
54
- className: t
55
- }));
56
- }, T = ({ children: t, className: a, ...l }) => {
57
- const { value: c, label: i, isOther: r, isFirstOption: u } = l, { id: b, value: d, onChange: m, options: o, disabled: p, readOnly: n, hasError: L } = D(), h = k(null);
58
- te(() => {
59
- var O;
60
- u && ((O = h.current) == null || O.focus({
61
- preventScroll: !0
62
- }));
63
- }, b);
64
- const I = f(t, q), E = F(() => d || [], [
65
- d
66
- ]), C = F(() => r ? E.find((O) => O === i || O.startsWith(`${i}: `)) || i : c, [
67
- r,
68
- E,
69
- i,
70
- c
71
- ]), R = M((O) => {
72
- const U = he(o || []), V = E.filter((w) => U.includes(w));
73
- m(O ? [
74
- ...V,
75
- i
76
- ] : V);
77
- }, [
78
- i,
79
- m,
80
- o,
81
- E
82
- ]);
83
- return /* @__PURE__ */ e.createElement(X, {
84
- inputRef: h,
85
- value: C,
86
- onChange: r ? R : void 0,
87
- isDisabled: p,
88
- isReadOnly: n,
89
- isInvalid: L
90
- }, /* @__PURE__ */ e.createElement(Y, {
91
- className: a,
92
- "data-hook": `tags-${r ? g : c}`
93
- }, x(I, {
94
- value: c,
95
- label: i,
96
- isOther: r,
97
- isFirstOption: u
98
- })));
99
- }, A = ({ children: t, className: a }) => {
100
- const { options: l, addOther: c, addOtherLabel: i, numberOfColumns: r = N.FREE_FLOW } = D(), { isMobile: u } = ee(), { t: b } = v(), d = u && r !== N.FREE_FLOW ? N.ONE : r, m = i || b("add-other.default-other-option-label") || g, o = f(t, T), p = F(() => {
101
- const n = l || [];
102
- return c ? [
103
- ...n,
104
- {
105
- label: m,
106
- value: m,
107
- isOther: !0
108
- }
109
- ] : n;
110
- }, [
111
- l,
112
- c,
113
- m
114
- ]);
115
- return p.length === 0 ? null : /* @__PURE__ */ e.createElement("div", {
116
- className: a,
117
- "data-columns": d
118
- }, p.map((n, L) => {
119
- const h = n.value ?? n.label;
120
- return x(o, {
121
- key: n.isOther ? g : h,
122
- value: h,
123
- label: n.label,
124
- isOther: n.isOther,
125
- isFirstOption: L === 0
126
- });
127
- }));
128
- }, G = ({ children: t, className: a }) => {
129
- const { addOther: l, addOtherLabel: c, hasError: i, readOnly: r, value: u } = D(), { t: b } = v(), d = c || b("add-other.default-other-option-label") || g, m = f(t, A), o = f(t, W), p = F(() => !l || !u ? !1 : u.some((n) => n === d || n.startsWith(`${d}:`)), [
130
- l,
131
- u,
132
- d
133
- ]);
134
- return /* @__PURE__ */ e.createElement("div", {
135
- className: a,
136
- "data-invalid": i,
137
- "data-readonly": r
138
- }, m, p && o);
139
- }, s = ({ children: t }) => {
140
- const { id: a, value: l, onChange: c, FieldLayout: i, required: r, disabled: u, readOnly: b, hasError: d, onBlur: m, onFocus: o } = D(), { inputId: p, labelId: n, ariaDescribedBy: L } = Z(), h = F(() => l || [], [
141
- l
142
- ]), I = f(t, $), E = f(t, G), C = f(t, P), R = f(t, B);
143
- return /* @__PURE__ */ e.createElement(i, {
144
- fieldId: a,
145
- renderLabel: () => I,
146
- renderInput: () => /* @__PURE__ */ e.createElement(ae, {
147
- id: p,
148
- ariaLabelledBy: n,
149
- ariaDescribedBy: L,
150
- required: r,
151
- onBlur: m,
152
- onFocus: o
153
- }, /* @__PURE__ */ e.createElement(Q, {
154
- "aria-labelledby": n,
155
- value: h,
156
- onChange: c,
157
- isDisabled: u,
158
- isReadOnly: b,
159
- isRequired: r,
160
- isInvalid: d
161
- }, E)),
162
- renderDescription: () => /* @__PURE__ */ e.createElement(e.Fragment, null, R, C)
163
- });
164
- };
165
- A.Option = T;
166
- T.Label = q;
167
- s.Label = $;
168
- s.Control = G;
169
- s.Options = A;
170
- s.OtherInput = W;
171
- s.Description = P;
172
- s.Error = B;
173
- const Ee = "_control_1kvnw_1", Oe = "_options_1kvnw_7", be = "_option_1kvnw_7", y = {
174
- control: Ee,
175
- options: Oe,
176
- option: be
177
- }, fe = ({ content: t, locale: a }) => /* @__PURE__ */ e.createElement(H, {
178
- content: t,
179
- locale: a
180
- }), Ve = () => /* @__PURE__ */ e.createElement(s, null, /* @__PURE__ */ e.createElement(s.Label, {
181
- className: _(re, S.label)
182
- }, /* @__PURE__ */ e.createElement(s.Label.Required, {
183
- className: _(oe, S.requiredMark)
184
- })), /* @__PURE__ */ e.createElement(s.Control, {
185
- className: y.control
186
- }, /* @__PURE__ */ e.createElement(s.Options, {
187
- className: _(se, y.options)
188
- }, /* @__PURE__ */ e.createElement(s.Options.Option, {
189
- className: ({ isSelected: t }) => _(le, t && ie, y.option)
190
- }, /* @__PURE__ */ e.createElement(s.Options.Option.Label, {
191
- className: me.optionLabel
192
- }))), /* @__PURE__ */ e.createElement(s.OtherInput, {
193
- className: _(ce, S.input)
194
- })), /* @__PURE__ */ e.createElement(s.Error, {
195
- className: _(ue, S.error)
196
- }, /* @__PURE__ */ e.createElement(ne, null), /* @__PURE__ */ e.createElement(s.Error.Text, null)), /* @__PURE__ */ e.createElement(s.Description, {
197
- className: _(de, S.description)
198
- }, fe));
199
- export {
200
- Ve as T
201
- };