@wix/form-elements 1.104.0 → 1.106.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/component/appointment-rac-D2F4vgf1.js +1011 -0
  2. package/dist/component/{bookings-address-rac-bOPrbrFn.js → bookings-address-rac-_5S8J8_i.js} +1 -1
  3. package/dist/component/{bookings-email-rac-DSpy4yfX.js → bookings-email-rac-6vmDR9nS.js} +1 -1
  4. package/dist/component/{bookings-first-name-rac-Dw0U4kHG.js → bookings-first-name-rac-DtTJ4T2K.js} +1 -1
  5. package/dist/component/{bookings-header-rac-Czrqn8yy.js → bookings-header-rac-B3dsEwzR.js} +1 -1
  6. package/dist/component/{bookings-last-name-rac-CVxRqG5b.js → bookings-last-name-rac-B3idkbi8.js} +1 -1
  7. package/dist/component/{bookings-login-bar-rac-s_2BlBcX.js → bookings-login-bar-rac-CrRBcQwT.js} +4 -4
  8. package/dist/component/{bookings-phone-rac-B2SgZsIb.js → bookings-phone-rac-BE0yWNnj.js} +1 -1
  9. package/dist/component/{bookings-rich-text-rac-b3K__6c9.js → bookings-rich-text-rac-CYo1l0-6.js} +1 -1
  10. package/dist/component/{checkbox-field-rac-Gt2JioDC.js → checkbox-field-rac-boTtXVEt.js} +18 -22
  11. package/dist/component/{checkbox-group-field-headless-cKefepGi.js → checkbox-group-field-headless-DnkUvDm8.js} +3 -3
  12. package/dist/component/{checkbox-group-field-rac-B14obB-6.js → checkbox-group-field-rac-DrDTgHMg.js} +13 -13
  13. package/dist/component/{checkbox-group-rac-B6cixM2X.js → checkbox-group-rac-v3ozUBpo.js} +1 -1
  14. package/dist/component/{checkbox-indicator-module-classes-DhbNznSB.js → checkbox-indicator-module-classes-BpeSpGsW.js} +1 -1
  15. package/dist/component/{checkbox-rac-COwblKlm.js → checkbox-rac-YSLE-RnG.js} +1 -1
  16. package/dist/component/{contacts-address-rac-BJrwGPo4.js → contacts-address-rac-C653yaHZ.js} +1 -1
  17. package/dist/component/{contacts-birthdate-rac-BaotTtEN.js → contacts-birthdate-rac-BeAQ6shx.js} +1 -1
  18. package/dist/component/{contacts-company-rac-BjTc-e_S.js → contacts-company-rac-BglKOoTG.js} +1 -1
  19. package/dist/component/{contacts-email-rac-DVFF485m.js → contacts-email-rac-D6m7ynfc.js} +1 -1
  20. package/dist/component/{contacts-first-name-rac-C4Fht3FS.js → contacts-first-name-rac-Dgxn0tUJ.js} +1 -1
  21. package/dist/component/{contacts-last-name-rac-BTbOJedX.js → contacts-last-name-rac-1UyIuRKH.js} +1 -1
  22. package/dist/component/{contacts-phone-rac-GePv5BT7.js → contacts-phone-rac-BQ77BlW4.js} +1 -1
  23. package/dist/component/{contacts-position-rac-BZ1ASqF_.js → contacts-position-rac-BUDUv7lv.js} +1 -1
  24. package/dist/component/contacts-subscribe-rac-DdtA0qKW.js +6 -0
  25. package/dist/component/{contacts-tax-id-rac-A2tdbIvB.js → contacts-tax-id-rac-WUaKcNl0.js} +1 -1
  26. package/dist/component/{date-availability-b1h4CrSQ.js → date-availability-XjBFq8jt.js} +1 -1
  27. package/dist/component/{date-input-field-rac-moOjGzUv.js → date-input-field-rac-aY2zuuKs.js} +14 -14
  28. package/dist/component/{date-input-rac-DTqZCOqB.js → date-input-rac-DRiP2_97.js} +1 -1
  29. package/dist/component/{date-picker-field-rac-flB4Hw18.js → date-picker-field-rac-Bzl-d3Uj.js} +70 -70
  30. package/dist/component/{date-picker-rac-B2fqOP6H.js → date-picker-rac-DHHUh8vn.js} +1 -1
  31. package/dist/component/{date-time-input-field-rac-BtLGRGf5.js → date-time-input-field-rac-DP_StuLr.js} +27 -27
  32. package/dist/component/{date-time-input-rac-CRfUmOim.js → date-time-input-rac-B11KIxsf.js} +1 -1
  33. package/dist/component/{dext-checkbox-group-rac-Ds4t475J.js → dext-checkbox-group-rac-BHZBqyWv.js} +2 -2
  34. package/dist/component/{dext-checkbox-rac-BC6EGH5R.js → dext-checkbox-rac-BIlAqEvV.js} +1 -1
  35. package/dist/component/{dext-date-picker-rac-DyydPJyC.js → dext-date-picker-rac-CHBXNrZi.js} +1 -1
  36. package/dist/component/{dext-date-time-input-rac-DhssYv6t.js → dext-date-time-input-rac-BYtliKry.js} +1 -1
  37. package/dist/component/{dext-dropdown-rac-Bn0C1Ry8.js → dext-dropdown-rac-C2VPSFV5.js} +1 -1
  38. package/dist/component/{dext-email-rac-DKhk_v_w.js → dext-email-rac-Fnb0Ggcs.js} +1 -1
  39. package/dist/component/{dext-number-input-rac-u92WD8VD.js → dext-number-input-rac-DopfSyFi.js} +1 -1
  40. package/dist/component/{dext-phone-rac-DTzdQAe9.js → dext-phone-rac-Rn4i_2rc.js} +1 -1
  41. package/dist/component/{dext-radio-group-rac-CoOYhInI.js → dext-radio-group-rac-bNaskJpK.js} +2 -2
  42. package/dist/component/{dext-rating-input-rac-DPdyJsCZ.js → dext-rating-input-rac-DL6ZZd7d.js} +1 -1
  43. package/dist/component/{dext-tags-rac-Bh3pQ-Ck.js → dext-tags-rac-TsUPoImO.js} +2 -2
  44. package/dist/component/{dext-text-area-rac-Cefsz8ct.js → dext-text-area-rac-BIuY7LTd.js} +1 -1
  45. package/dist/component/{dext-text-input-rac-Bj_pAChP.js → dext-text-input-rac-CSYPW0Qi.js} +1 -1
  46. package/dist/component/{dext-url-input-rac-Bk_kwZzM.js → dext-url-input-rac-_g0lqGfW.js} +1 -1
  47. package/dist/component/{donation-rac-wRWkCjYg.js → donation-rac-BYKFtsyR.js} +55 -55
  48. package/dist/component/{dropdown-field-headless-CedOXKAH.js → dropdown-field-headless-CBaqlNZi.js} +4 -4
  49. package/dist/component/{dropdown-field-rac-CENh9Khw.js → dropdown-field-rac-CCAGSMm3.js} +6 -6
  50. package/dist/component/{dropdown-rac-CeCNULzS.js → dropdown-rac-C_EqUsZ1.js} +1 -1
  51. package/dist/component/{ecom-address-rac-BLJ0UHrV.js → ecom-address-rac-Bw9eH0iF.js} +1 -1
  52. package/dist/component/{ecom-subscription-checkbox-rac-xJDzCasS.js → ecom-subscription-checkbox-rac-B5PVOO2a.js} +10 -17
  53. package/dist/component/{email-input-field-rac-CeTVUWeX.js → email-input-field-rac-B2kqQ6yo.js} +14 -14
  54. package/dist/component/{events-repeater-rac-CT9LAF22.js → events-repeater-rac--4OnUxWE.js} +55 -55
  55. package/dist/component/{events-rsvp-rac-Bu8tqcVi.js → events-rsvp-rac-CczCoo3T.js} +13 -13
  56. package/dist/component/{field-error-headless-gLZVlnQV.js → field-error-headless-D3-1L5sf.js} +1 -1
  57. package/dist/component/{field-label-headless-yc46NPmu.js → field-label-headless-Du4ckIVy.js} +1 -1
  58. package/dist/component/field-rac.module-B4l_0KRU.js +26 -0
  59. package/dist/component/{file-upload-rac-LkVTFtZb.js → file-upload-rac-DbdkUbWM.js} +80 -80
  60. package/dist/component/{fixed-payment-rac-DEbV0w-8.js → fixed-payment-rac-f9-01iDN.js} +8 -8
  61. package/dist/component/{form-DV231fmJ.js → form-DQauhsho.js} +69 -69
  62. package/dist/component/form-element-classes-bLFmhsKw.js +137 -0
  63. package/dist/component/form.css +1 -1
  64. package/dist/component/form.js +1 -1
  65. package/dist/component/{header-field-rac-BzB5dm6C.js → header-field-rac-DamDk5BR.js} +3 -3
  66. package/dist/component/{header-rac-BzS5HfUt.js → header-rac-CR9T3Pnu.js} +1 -1
  67. package/dist/component/{image-choice-rac-8YqUqetS.js → image-choice-rac-DJ_8v467.js} +13 -13
  68. package/dist/component/{index-CMtf-So7.js → index-BB7d_9Dv.js} +4 -4
  69. package/dist/component/{index-BzRG28bH.js → index-CcUTIUWM.js} +2 -2
  70. package/dist/component/{isObjectLike--gPCPyGa.js → isObjectLike-xvPa_08X.js} +1 -1
  71. package/dist/component/{multiline-address-field-rac-CJWdu5LV.js → multiline-address-field-rac-CyaFOloE.js} +80 -80
  72. package/dist/component/{multiline-address-rac-Cw5VweB0.js → multiline-address-rac-CaHGUN_f.js} +1 -1
  73. package/dist/component/{number-input-field-rac-D8NRpCCM.js → number-input-field-rac-BuYUzDWV.js} +15 -15
  74. package/dist/component/{number-input-rac-CM_CQHE_.js → number-input-rac-DMKX6nhk.js} +1 -1
  75. package/dist/component/{password-rac-I6vynKG4.js → password-rac-0RUXPAn6.js} +38 -38
  76. package/dist/component/{payment-input-rac-B4rXCs7V.js → payment-input-rac-CHSZ3-Lt.js} +17 -17
  77. package/dist/component/{phone-input-field-rac-B-k2e0Np.js → phone-input-field-rac-JmIFcP1e.js} +29 -29
  78. package/dist/component/{phone-rac-D443psAx.js → phone-rac-BLRnAPXP.js} +1 -1
  79. package/dist/component/{product-list-rac-B6qUWxkz.js → product-list-rac-BkF5tDwt.js} +11 -11
  80. package/dist/component/quiz-radio-group-rac-32cCMTUS.js +6 -0
  81. package/dist/component/{radio-button-module-classes--on7xGzb.js → radio-button-module-classes-IOulhuSH.js} +28 -28
  82. package/dist/component/radio-group-field-rac-CJwku6e0.js +46 -0
  83. package/dist/component/{radio-group-rac-CjbSQydw.js → radio-group-rac-BiW-9Abj.js} +1 -1
  84. package/dist/component/{rating-input-field-rac-yVgqxBKi.js → rating-input-field-rac-B9cwaROK.js} +30 -30
  85. package/dist/component/{rating-input-rac-D6BKC4oS.js → rating-input-rac-BpwlNvzQ.js} +1 -1
  86. package/dist/component/{rich-content-rac.module-Ca4LYv7k.js → rich-content-rac.module-B1uyPmtK.js} +1 -1
  87. package/dist/component/{rich-text-field-rac-DIeBS-ux.js → rich-text-field-rac-C_qE7Ykg.js} +3 -3
  88. package/dist/component/{rich-text-rac-BgjP0ngh.js → rich-text-rac-VfeZxS27.js} +1 -1
  89. package/dist/component/{service-dropdown-rac-DjOMT7dx.js → service-dropdown-rac-BCfs8IhW.js} +18 -18
  90. package/dist/component/{services-multi-choice-rac-C0Rp9Sng.js → services-multi-choice-rac-CCqdF_7P.js} +8 -8
  91. package/dist/component/{signature-rac-CFT-Fni_.js → signature-rac-DOyMo3u0.js} +73 -73
  92. package/dist/component/{submit-button-rac-BOluGZI0.js → submit-button-rac-C2uA5DeE.js} +11 -11
  93. package/dist/component/{tags-field-rac-CP0RS4SG.js → tags-field-rac-C_uIw2by.js} +36 -36
  94. package/dist/component/{tags-rac-Dtp3VCKk.js → tags-rac-1pQ-fpe_.js} +1 -1
  95. package/dist/component/{text-area-field-rac-DUKg8kgN.js → text-area-field-rac-DqlOkm7e.js} +23 -23
  96. package/dist/component/{text-area-rac-Clh7zMTL.js → text-area-rac-DPdkrFcH.js} +1 -1
  97. package/dist/component/{text-input-field-rac-DY60Q6da.js → text-input-field-rac-CmXm6r1w.js} +6 -6
  98. package/dist/component/{text-input-headless-BBv0nukI.js → text-input-headless-DD__2DFf.js} +3 -3
  99. package/dist/component/{text-input-rac-FVD6iJ1i.js → text-input-rac-DRHyQEH7.js} +1 -1
  100. package/dist/component/{time-input-rac-DsctZB28.js → time-input-rac-BJPIymQY.js} +22 -22
  101. package/dist/component/{url-input-field-rac-Du4HlhH3.js → url-input-field-rac-CFDYkZ6I.js} +15 -15
  102. package/dist/component/{url-input-rac-3QPdK0xz.js → url-input-rac-C0ChQUzq.js} +1 -1
  103. package/dist/component/{use-dropdown-option-class-name-Bze6ghRl.js → use-dropdown-option-class-name-3L5ZmNLK.js} +3 -3
  104. package/dist/component/{use-element-state-class-name-4CDAF1S-.js → use-element-state-class-name-BatTc2bw.js} +1 -1
  105. package/dist/component/{use-is-forced-open-dropdown--w4f5dWP.js → use-is-forced-open-dropdown-B0jiPTmS.js} +1 -1
  106. package/dist/component/{use-service-options-base-9vUuIThY.js → use-service-options-base-oeE7xszw.js} +1 -1
  107. package/dist/component/{use-text-input-class-name-Ch91llI_.js → use-text-input-class-name-LQ5S-NLh.js} +4 -4
  108. package/package.json +5 -5
  109. package/dist/component/appointment-rac-CCciYQ_h.js +0 -1012
  110. package/dist/component/contacts-subscribe-rac-CmyBcsLP.js +0 -13
  111. package/dist/component/field-rac.module-DobpyqOd.js +0 -26
  112. package/dist/component/form-element-classes-BtKlobUX.js +0 -192
  113. package/dist/component/quiz-radio-group-rac-DdPJQmV5.js +0 -13
  114. package/dist/component/radio-group-field-rac-CjiGr1rO.js +0 -50
@@ -1,1012 +0,0 @@
1
- import o, { useRef as J, useState as j, useEffect as H, createContext as Ge, useContext as Ze, useMemo as P, useCallback as ie } from "react";
2
- import { RicosViewer as lt } from "@wix/ricos/viewer";
3
- import w from "classnames";
4
- import { C as Ce } from "./chevron-down-icon-CcpVm6B-.js";
5
- import { E as ct } from "./error-icon-hZxQ6DEy.js";
6
- import { g as ut, c as We } from "./calendar.module-DnhTT4QT.js";
7
- import { H as de } from "./custom-focus-class-_483Pkwp.js";
8
- import { s as fe } from "./field-rac.module-DobpyqOd.js";
9
- import { C as mt, S as dt, a as ft, z as Be, i as Dt, W as Et, r as St, j as pt, a2 as _t } from "./form-element-classes-BtKlobUX.js";
10
- import { u as Lt } from "./use-element-state-class-name-4CDAF1S-.js";
11
- import { ListBox as yt, Button as he, ListBoxItem as At, RadioGroup as Nt, RadioField as gt, RadioButton as It } from "react-aria-components";
12
- import { ac as Ee, ab as Ot, ag as ve, af as bt, c as Tt, au as ht, at as vt, ak as ce, ah as Se, am as kt, aj as Rt, F as wt } from "./form-DV231fmJ.js";
13
- import { f as T, a as le } from "./find-child-C60k4CxG.js";
14
- import { D as Ft, E as Mt } from "./field-error-headless-gLZVlnQV.js";
15
- import { L as Ct } from "./field-label-headless-yc46NPmu.js";
16
- import { F as Wt } from "./fieldset-headless-CD3fds9J.js";
17
- import "date-fns";
18
- import { V as Ve } from "./headless-styles-CmcyA_pi.js";
19
- function Bt(e) {
20
- return { evid: 40, src: 16, endpoint: "", params: e };
21
- }
22
- var Oe = /* @__PURE__ */ (function(e) {
23
- return e.BOOKING_NOT_INSTALL = "BOOKING_NOT_INSTALL", e.NO_AVAILABILITY_DATES_FOUND = "NO_AVAILABILITY_DATES_FOUND", e.GENERAL = "GENERAL", e;
24
- })({}), z = /* @__PURE__ */ (function(e) {
25
- return e.LOADING = "LOADING", e.DONE = "DONE", e.ERROR = "ERROR", e;
26
- })({});
27
- const V = 4;
28
- var Q = /* @__PURE__ */ (function(e) {
29
- return e.FORM = "form", e.NO_AVAILABILITY_FOR_DATE = "no availability for date empty state", e.NO_AVAILABILITY_AT_ALL = "no availability at all empty state", e.SLOT = "slot", e.DATE = "date", e.PAGINATION = "pagination", e.SHOW_MORE = "show more", e;
30
- })({}), te = /* @__PURE__ */ (function(e) {
31
- return e.LOAD = "load", e.CLICK = "click", e;
32
- })({});
33
- const Ut = (e) => {
34
- var t;
35
- return {
36
- bookingsServiceId: e == null ? void 0 : e.id,
37
- formGuid: (t = e == null ? void 0 : e.form) == null ? void 0 : t.id,
38
- serviceProperties: xt(e)
39
- };
40
- }, xt = (e) => {
41
- var t;
42
- return JSON.stringify({
43
- serviceId: e == null ? void 0 : e.id,
44
- serviceType: e == null ? void 0 : e.type,
45
- locationIds: (t = e == null ? void 0 : e.locations) == null ? void 0 : t.map((n) => n.id).filter((n) => n),
46
- staffMemberIds: e == null ? void 0 : e.staffMemberIds,
47
- isOfferedAsPricingPlan: !1
48
- });
49
- }, qe = (e) => {
50
- var m;
51
- const { appointmentFieldProps: t } = ke(), { isEditor: n, isComposer: a } = Ee(), s = Ot(), r = e || ((m = t == null ? void 0 : t.initialData) == null ? void 0 : m.service);
52
- if (!(n || a))
53
- return {
54
- ...s,
55
- report: (i) => s == null ? void 0 : s.report(Bt({
56
- ...Ut(r),
57
- ...i
58
- }))
59
- };
60
- };
61
- var be;
62
- (function(e) {
63
- e.UNDEFINED = "UNDEFINED", e.OWNER_BUSINESS = "OWNER_BUSINESS", e.OWNER_CUSTOM = "OWNER_CUSTOM", e.CUSTOM = "CUSTOM";
64
- })(be || (be = {}));
65
- var Ue;
66
- (function(e) {
67
- e.UNKNOWN_REQUESTED_GENDER = "UNKNOWN_REQUESTED_GENDER", e.ANY_MALE = "ANY_MALE", e.ANY_FEMALE = "ANY_FEMALE";
68
- })(Ue || (Ue = {}));
69
- var xe;
70
- (function(e) {
71
- e.UNKNOWN_LOCATION_TYPE = "UNKNOWN_LOCATION_TYPE", e.BUSINESS = "BUSINESS", e.CUSTOM = "CUSTOM", e.CUSTOMER = "CUSTOMER";
72
- })(xe || (xe = {}));
73
- var Pe;
74
- (function(e) {
75
- e.UNKNOWN_REQUESTED_GENDER = "UNKNOWN_REQUESTED_GENDER", e.ANY_MALE = "ANY_MALE", e.ANY_FEMALE = "ANY_FEMALE";
76
- })(Pe || (Pe = {}));
77
- var ze;
78
- (function(e) {
79
- e.ASC = "ASC", e.DESC = "DESC";
80
- })(ze || (ze = {}));
81
- const Pt = (e) => {
82
- const { service: t } = e || {};
83
- return (t == null ? void 0 : t.id) ? null : {
84
- type: Oe.GENERAL,
85
- message: "Service ID is missing"
86
- };
87
- }, zt = ({ appointmentFieldProps: e, isEditor: t, isComposer: n }) => {
88
- const { initialData: a } = e, s = Kt();
89
- if (t || n)
90
- return {
91
- ...s,
92
- timezone: je(),
93
- dataStatus: z.DONE
94
- };
95
- {
96
- const r = Pt(a);
97
- if (r)
98
- return {
99
- dataStatus: z.ERROR,
100
- error: r
101
- };
102
- }
103
- return {
104
- ...s,
105
- dataStatus: z.LOADING
106
- };
107
- }, Ht = (e, t) => {
108
- const n = /* @__PURE__ */ new Date(), a = new Date(n);
109
- a.setMonth(a.getMonth() + e);
110
- const s = new Date(n.toLocaleString("en-US", {
111
- timeZone: t
112
- })), r = new Date(a.toLocaleString("en-US", {
113
- timeZone: t
114
- }));
115
- return {
116
- startDate: s,
117
- endDate: r
118
- };
119
- }, je = () => Intl.DateTimeFormat().resolvedOptions().timeZone, Yt = (e) => {
120
- var t, n, a;
121
- if ((n = (t = e == null ? void 0 : e[0]) == null ? void 0 : t.slot) != null && n.startDate)
122
- return new Date((a = e[0].slot) == null ? void 0 : a.startDate);
123
- }, Kt = ({ duration: e = 60, timezone: t = "UTC" } = {}) => {
124
- var E, f;
125
- const n = "267d1c11-8019-4e3d-b9c6-cd2b859c69e2", a = /* @__PURE__ */ new Date(), s = [], r = [], m = a.toISOString().split("T")[0], i = 10, l = 18;
126
- let c = /* @__PURE__ */ new Date(`${m}T${i}:00:00`), d = new Date(c);
127
- d.setMinutes(d.getMinutes() + e);
128
- let S = !1;
129
- for (; d.getHours() < l || d.getHours() === l && d.getMinutes() === 0; ) {
130
- const b = {
131
- slot: {
132
- serviceId: n,
133
- startDate: c.toISOString(),
134
- endDate: d.toISOString(),
135
- location: {
136
- locationType: be.CUSTOM
137
- }
138
- },
139
- bookable: !0,
140
- totalSpots: 1,
141
- openSpots: 1,
142
- bookingPolicyViolations: {
143
- tooEarlyToBook: !1,
144
- tooLateToBook: !1,
145
- bookOnlineDisabled: !1
146
- },
147
- nestedSlots: []
148
- };
149
- r.push(b), S || (s.push(b), S = !0), c = new Date(d), d = new Date(c), d.setMinutes(d.getMinutes() + e);
150
- }
151
- return {
152
- availabilitySlots: r,
153
- availabilityDates: s,
154
- timezone: t,
155
- currentSlotBulkSize: V,
156
- selectedDate: s.length > 0 && ((f = (E = s[0]) == null ? void 0 : E.slot) != null && f.startDate) ? new Date(s[0].slot.startDate) : void 0
157
- };
158
- };
159
- function $t(e) {
160
- var f;
161
- const { initialData: t, onChange: n, value: a } = e, { isEditor: s, isComposer: r } = Ee(), m = (f = t == null ? void 0 : t.service) == null ? void 0 : f.id, { actions: i } = ve(), l = J(i);
162
- l.current = i;
163
- const c = !!(i != null && i.getAvailabilityDates && (i != null && i.getAvailabilitySlots)), [d, S] = j(null), E = qe(t == null ? void 0 : t.service);
164
- return H(() => {
165
- m && !s && !r && c && (async () => {
166
- var W, A, N, Y, B;
167
- const h = je(), O = {
168
- currentSlotBulkSize: V,
169
- timezone: h,
170
- dataStatus: z.LOADING
171
- };
172
- try {
173
- const U = async (oe) => {
174
- var v, p;
175
- const { startDate: se, endDate: $ } = Ht(oe, h);
176
- return (p = (v = l.current) == null ? void 0 : v.getAvailabilityDates) == null ? void 0 : p.call(v, {
177
- serviceId: m,
178
- fromDate: se,
179
- toDate: $,
180
- timeZone: h
181
- });
182
- };
183
- if (O.availabilityDates = await U(2), (W = O.availabilityDates) != null && W.length || (O.availabilityDates = await U(6)), !((A = O.availabilityDates) != null && A.length)) {
184
- E == null || E.report({
185
- action: te.LOAD,
186
- component: Q.NO_AVAILABILITY_AT_ALL
187
- }), S({
188
- dataStatus: z.ERROR,
189
- error: {
190
- type: Oe.NO_AVAILABILITY_DATES_FOUND,
191
- message: "No availability dates found"
192
- }
193
- });
194
- return;
195
- }
196
- O.selectedDate = Yt(O.availabilityDates), O.selectedDate && (O.availabilitySlots = await ((Y = (N = l.current) == null ? void 0 : N.getAvailabilitySlots) == null ? void 0 : Y.call(N, {
197
- serviceId: m,
198
- timeZone: h,
199
- selectedDate: O.selectedDate
200
- }))), E == null || E.report({
201
- action: te.LOAD,
202
- component: (B = O.availabilityDates) != null && B.length ? Q.FORM : Q.NO_AVAILABILITY_FOR_DATE
203
- }), a != null && a.startDate || n(void 0), S({
204
- ...O,
205
- dataStatus: z.DONE
206
- });
207
- } catch (U) {
208
- console.error(U), S({
209
- dataStatus: z.ERROR,
210
- error: {
211
- type: Oe.GENERAL,
212
- message: "An error occurred in initialAppointmentState"
213
- }
214
- });
215
- }
216
- })();
217
- }, [
218
- s,
219
- r,
220
- m,
221
- c
222
- ]), d;
223
- }
224
- const Qe = /* @__PURE__ */ Ge({
225
- appointmentState: {},
226
- setAppointmentState: () => {
227
- }
228
- }), Gt = ({ appointmentFieldProps: e, children: t }) => {
229
- const { isEditor: n, isComposer: a } = Ee(), [s, r] = j(() => zt({
230
- appointmentFieldProps: e,
231
- isEditor: n,
232
- isComposer: a
233
- })), m = $t(e);
234
- return H(() => {
235
- m && r({
236
- ...s,
237
- ...m
238
- });
239
- }, [
240
- m
241
- ]), /* @__PURE__ */ o.createElement(Qe.Provider, {
242
- value: {
243
- appointmentFieldProps: e,
244
- appointmentState: s,
245
- setAppointmentState: (i) => r({
246
- ...s,
247
- ...i
248
- })
249
- }
250
- }, t);
251
- }, ke = () => Ze(Qe), Zt = (e, t) => {
252
- if (e.startOfWeek.getMonth() === e.endOfWeek.getMonth())
253
- return new Intl.DateTimeFormat(t, {
254
- month: "long",
255
- year: "numeric"
256
- }).format(e.endOfWeek);
257
- const n = new Intl.DateTimeFormat(t, {
258
- month: "short"
259
- }).format(e.startOfWeek), a = new Intl.DateTimeFormat(t, {
260
- month: "short",
261
- year: "numeric"
262
- }).format(e.endOfWeek);
263
- return `${n} - ${a}`;
264
- }, Vt = (e) => !(e != null && e.startDate) || !(e != null && e.endDate) || !(e != null && e.timeZone) ? null : {
265
- startDate: e == null ? void 0 : e.startDate,
266
- endDate: e == null ? void 0 : e.endDate,
267
- timeZone: e == null ? void 0 : e.timeZone
268
- }, He = ({ timezone: e, language: t, formatType: n }) => {
269
- var s;
270
- return (s = new Intl.DateTimeFormat(t, {
271
- timeZone: e,
272
- timeZoneName: n === "name" ? "long" : "short"
273
- }).formatToParts(/* @__PURE__ */ new Date()).find(({ type: r }) => r === "timeZoneName")) == null ? void 0 : s.value;
274
- }, qt = ({ timezone: e, language: t }) => {
275
- const n = He({
276
- timezone: e,
277
- language: t,
278
- formatType: "name"
279
- }), a = He({
280
- timezone: e,
281
- language: t,
282
- formatType: "offset"
283
- });
284
- return `${n} (${a})`;
285
- }, ne = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate(), jt = (e, t) => {
286
- const n = new Date(e);
287
- n.setDate(e.getDate() - t);
288
- const a = new Date(e);
289
- return a.setDate(e.getDate() + t), {
290
- fromDate: n,
291
- toDate: a
292
- };
293
- }, Qt = ({ setIsReloadingSlots: e }) => {
294
- const { appointmentFieldProps: t, appointmentState: n, setAppointmentState: a } = ke(), { value: s } = t, { actions: r } = ve();
295
- H(() => {
296
- (async () => {
297
- var i, l;
298
- if (s != null && s.startDate && (n != null && n.selectedDate) && (n == null ? void 0 : n.dataStatus) === z.DONE && !ne(new Date(s.startDate), n == null ? void 0 : n.selectedDate)) {
299
- e(!0);
300
- const d = new Date(s.startDate), { fromDate: S, toDate: E } = jt(d, 8), [f, b] = await Promise.all([
301
- (i = r == null ? void 0 : r.getAvailabilityDates) == null ? void 0 : i.call(r, {
302
- serviceId: t == null ? void 0 : t.initialData.service.id,
303
- timeZone: (n == null ? void 0 : n.timezone) || "",
304
- fromDate: S,
305
- toDate: E
306
- }),
307
- (l = r == null ? void 0 : r.getAvailabilitySlots) == null ? void 0 : l.call(r, {
308
- serviceId: t == null ? void 0 : t.initialData.service.id,
309
- timeZone: (n == null ? void 0 : n.timezone) || "",
310
- selectedDate: d
311
- })
312
- ]);
313
- a({
314
- availabilityDates: f,
315
- selectedDate: d,
316
- availabilitySlots: b
317
- }), e(!1);
318
- }
319
- })();
320
- }, [
321
- s,
322
- n == null ? void 0 : n.dataStatus
323
- ]);
324
- }, Jt = (e, t) => !e || !t.length ? e : e.filter((n) => {
325
- var a;
326
- return !t.includes(((a = n == null ? void 0 : n.slot) == null ? void 0 : a.startDate) ?? "");
327
- }), De = (e) => !(e != null && e.startDate) || !(e != null && e.endDate) ? "" : `${e == null ? void 0 : e.startDate}_${e == null ? void 0 : e.endDate}`, Xt = ({ locale: e, endDate: t, startDate: n, timezone: a }) => {
328
- const s = {
329
- hour: "numeric",
330
- minute: "numeric",
331
- timeZone: a
332
- }, r = new Intl.DateTimeFormat(e, s).format(new Date(n)), m = new Intl.DateTimeFormat(e, s).format(new Date(t));
333
- return `${r} - ${m}`;
334
- }, en = ({ selectedDate: e, locale: t, timezone: n }) => e ? new Intl.DateTimeFormat(t, {
335
- weekday: "long",
336
- month: "short",
337
- day: "numeric",
338
- timeZone: n
339
- }).format(e) : "", tn = (e, t) => {
340
- let n;
341
- return t.forEach((a, s) => {
342
- var r, m;
343
- De({
344
- startDate: (r = a == null ? void 0 : a.slot) == null ? void 0 : r.startDate,
345
- endDate: (m = a == null ? void 0 : a.slot) == null ? void 0 : m.endDate
346
- }) === e && (n = s);
347
- }), n;
348
- };
349
- var nn = /* @__PURE__ */ (function(e) {
350
- return e.OS_LOCATION = "OS_LOCATION", e.CUSTOM_LOCATION = "CUSTOM_LOCATION", e;
351
- })({});
352
- const an = "SLOT_UNAVAILABLE", Ye = [], on = (e) => {
353
- var t;
354
- return ((t = e == null ? void 0 : e.params) == null ? void 0 : t.reason) === an;
355
- }, sn = ({ error: e, selectedSlot: t }) => {
356
- const { isExperimentEnabled: n } = bt(), a = n(Tt.BIF_SLOT_HOLD), [s, r] = j(Ye), m = a && on(e), i = t == null ? void 0 : t.startDate, l = J(!1);
357
- return H(() => {
358
- if (!m) {
359
- l.current = !1;
360
- return;
361
- }
362
- l.current || (l.current = !0, i && r((c) => c.includes(i) ? c : [
363
- ...c,
364
- i
365
- ]));
366
- }, [
367
- m,
368
- i
369
- ]), a ? s : Ye;
370
- }, q = 7, Te = (e) => {
371
- const t = new Date(e);
372
- return t.setHours(0, 0, 0, 0), t;
373
- }, rn = (e) => {
374
- const t = new Date(e);
375
- return t.setHours(23, 59, 59, 999), t;
376
- }, ee = (e, t) => {
377
- const n = new Date(e);
378
- return n.setDate(n.getDate() + t), n;
379
- }, Ke = (e, t) => {
380
- const n = Te(e), a = (n.getDay() - t + q) % q;
381
- return ee(n, -a);
382
- }, ln = (e) => `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`, cn = (e, t, n) => {
383
- const a = new Intl.DateTimeFormat(n, {
384
- month: "short",
385
- day: "numeric"
386
- });
387
- return typeof a.formatRange == "function" ? a.formatRange(e, t) : `${a.format(e)} - ${a.format(t)}`;
388
- }, un = (e, t = []) => t.some((n) => {
389
- var a;
390
- return !!((a = n.slot) != null && a.startDate) && ne(new Date(n.slot.startDate), e);
391
- }), mn = () => {
392
- var Me;
393
- const { appointmentFieldProps: e, appointmentState: t, setAppointmentState: n } = ke(), { language: a, isEditor: s, isComposer: r, isMobile: m } = Ee(), { t: i } = ht(), { actions: l } = ve(), c = qe(), [d, S] = j(!1), [E, f] = j(!1), [b, h] = j(), [O, W] = j();
394
- Qt({
395
- setIsReloadingSlots: S
396
- });
397
- const { onChange: A, value: N, target: Y, initialData: B, formatDescription: U, locationType: oe, error: se } = e, { availabilityDates: $, availabilitySlots: v, timezone: p = "", selectedDate: _, currentSlotBulkSize: k, dataStatus: G, error: ue } = t, K = (Me = B == null ? void 0 : B.service) == null ? void 0 : Me.id, Z = G === z.LOADING, X = d || E, pe = !!ue, we = sn({
398
- error: se,
399
- selectedSlot: N
400
- }), L = P(() => Jt(v, we), [
401
- v,
402
- we
403
- ]);
404
- H(() => {
405
- A == null || A(Vt(N));
406
- }, [
407
- N == null ? void 0 : N.startDate,
408
- N == null ? void 0 : N.endDate,
409
- p
410
- ]), vt((D) => {
411
- const g = D == null ? void 0 : D[Y];
412
- v != null && v.length && n({
413
- availabilitySlots: v.filter((I) => {
414
- var R;
415
- return ((R = I == null ? void 0 : I.slot) == null ? void 0 : R.startDate) !== (g == null ? void 0 : g.startDate);
416
- })
417
- });
418
- }), H(() => {
419
- if (L != null && L.length && k) {
420
- const D = tn(De(N ?? void 0), L);
421
- D && D + 1 > k && n({
422
- currentSlotBulkSize: D + 1
423
- });
424
- } else !(L != null && L.length) && N && (A == null || A(void 0));
425
- }, [
426
- N,
427
- L,
428
- $
429
- ]);
430
- const _e = P(() => ut(a), [
431
- a
432
- ]), Fe = J(_);
433
- H(() => {
434
- const D = Fe.current;
435
- Fe.current = _, !!_ && (!D || !ne(D, _)) && h(void 0);
436
- }, [
437
- _
438
- ]);
439
- const M = P(() => b ?? Ke(_ ?? /* @__PURE__ */ new Date(), _e), [
440
- b,
441
- _,
442
- _e
443
- ]), et = P(() => {
444
- const D = Te(/* @__PURE__ */ new Date()), g = new Intl.DateTimeFormat(a, {
445
- weekday: m ? "narrow" : "short"
446
- }), I = new Intl.DateTimeFormat(a, {
447
- day: "numeric"
448
- }), R = new Intl.DateTimeFormat(a, {
449
- weekday: "long",
450
- month: "long",
451
- day: "numeric"
452
- });
453
- return Array.from({
454
- length: q
455
- }, (re, ge) => {
456
- const x = ee(M, ge), Ie = !!_ && ne(x, _), it = Te(x) < D;
457
- return {
458
- key: ln(x),
459
- date: x,
460
- isSelected: Ie,
461
- isAvailable: !Z && !X && !Ie && un(x, $),
462
- isDisabled: it || X && !Ie,
463
- isToday: ne(x, D),
464
- dayOfMonthLabel: I.format(x),
465
- weekdayLabel: g.format(x),
466
- label: R.format(x),
467
- availabilityLabel: i("form.appointment.accessibility.calendar.has-availability.aria-label")
468
- };
469
- });
470
- }, [
471
- M,
472
- _,
473
- $,
474
- Z,
475
- X,
476
- a,
477
- m,
478
- i
479
- ]), Le = De(N ?? void 0) || void 0, ye = P(() => Z || d ? [] : (L ?? []).slice(0, k).flatMap((D) => {
480
- const { startDate: g, endDate: I } = D.slot ?? {};
481
- if (!g || !I)
482
- return [];
483
- const R = De({
484
- startDate: g,
485
- endDate: I
486
- });
487
- return [
488
- {
489
- key: R,
490
- startDate: g,
491
- endDate: I,
492
- timeRange: Xt({
493
- startDate: g,
494
- endDate: I,
495
- locale: a,
496
- timezone: p
497
- }),
498
- isSelected: R === Le
499
- }
500
- ];
501
- }), [
502
- L,
503
- k,
504
- Z,
505
- d,
506
- a,
507
- p,
508
- Le
509
- ]), Ae = !d && !!(L != null && L.length) && (k || V) < L.length, Ne = M > Ke(/* @__PURE__ */ new Date(), _e), tt = ie(
510
- async (D) => {
511
- var g;
512
- if (!(X || _ && ne(D, _))) {
513
- S(!0), A == null || A(void 0), n({
514
- currentSlotBulkSize: V,
515
- selectedDate: D,
516
- availabilitySlots: void 0
517
- }), c == null || c.report({
518
- action: te.CLICK,
519
- component: Q.DATE
520
- });
521
- try {
522
- const I = await ((g = l == null ? void 0 : l.getAvailabilitySlots) == null ? void 0 : g.call(l, {
523
- serviceId: K,
524
- timeZone: p,
525
- selectedDate: D
526
- }));
527
- n({
528
- currentSlotBulkSize: V,
529
- selectedDate: D,
530
- availabilitySlots: I
531
- });
532
- } catch {
533
- } finally {
534
- S(!1);
535
- }
536
- }
537
- },
538
- // eslint-disable-next-line react-hooks/exhaustive-deps
539
- [
540
- X,
541
- _,
542
- K,
543
- p,
544
- l,
545
- A,
546
- c
547
- ]
548
- ), me = J(0), nt = ie(
549
- async (D) => {
550
- var re;
551
- if (D < 0 && !Ne)
552
- return;
553
- const g = M, I = ee(M, D * q);
554
- if (h(I), s || r)
555
- return;
556
- const R = ++me.current;
557
- f(!0), c == null || c.report({
558
- action: te.CLICK,
559
- component: Q.PAGINATION
560
- });
561
- try {
562
- const ge = await ((re = l == null ? void 0 : l.getAvailabilityDates) == null ? void 0 : re.call(l, {
563
- serviceId: K,
564
- timeZone: p,
565
- fromDate: I,
566
- toDate: rn(ee(I, q - 1))
567
- }));
568
- R === me.current && n({
569
- availabilityDates: ge
570
- });
571
- } catch {
572
- R === me.current && h(g);
573
- } finally {
574
- R === me.current && f(!1);
575
- }
576
- },
577
- // eslint-disable-next-line react-hooks/exhaustive-deps
578
- [
579
- Ne,
580
- M,
581
- s,
582
- r,
583
- K,
584
- p,
585
- l,
586
- c
587
- ]
588
- ), at = ie(
589
- (D) => {
590
- const g = ye.find((re) => re.key === D);
591
- if (!g)
592
- return;
593
- const { startDate: I, endDate: R } = g;
594
- c == null || c.report({
595
- action: te.CLICK,
596
- component: Q.SLOT,
597
- startTime: new Date(I).valueOf(),
598
- endTime: new Date(R).valueOf()
599
- }), A == null || A({
600
- startDate: I,
601
- endDate: R,
602
- timeZone: p
603
- });
604
- },
605
- // eslint-disable-next-line react-hooks/exhaustive-deps
606
- [
607
- ye,
608
- p,
609
- A,
610
- c
611
- ]
612
- ), ot = ie(() => {
613
- if (!Ae)
614
- return;
615
- const D = k || V;
616
- c == null || c.report({
617
- action: te.CLICK,
618
- component: Q.SHOW_MORE
619
- }), W(D), n({
620
- currentSlotBulkSize: D + V
621
- });
622
- }, [
623
- Ae,
624
- k,
625
- c
626
- ]), st = ie(() => W(void 0), []), rt = P(() => {
627
- if (pe)
628
- return i("form.appointment.empty-state.notification.text");
629
- if (!Z && !d && !(L != null && L.length))
630
- return i("form.appointment.slots-not-found.text");
631
- }, [
632
- pe,
633
- Z,
634
- d,
635
- L == null ? void 0 : L.length,
636
- i
637
- ]);
638
- return {
639
- days: et,
640
- slots: ye,
641
- selectedSlotKey: Le,
642
- selectDate: tt,
643
- selectSlot: at,
644
- changeWeek: nt,
645
- showMoreSlots: ot,
646
- canGoToPreviousWeek: Ne,
647
- hasMoreSlots: Ae,
648
- hasError: pe,
649
- isLoading: Z,
650
- isRefetching: X,
651
- isReloadingSlots: d,
652
- weekRangeLabel: cn(M, ee(M, q - 1), a),
653
- weekCaptionLabel: Zt({
654
- startOfWeek: M,
655
- endOfWeek: ee(M, q - 1)
656
- }, a),
657
- selectedDateLabel: en({
658
- selectedDate: _,
659
- locale: a,
660
- timezone: p
661
- }),
662
- timezoneLabel: p ? `${i("form.appointment.timezone.label")}: ${qt({
663
- timezone: p,
664
- language: a
665
- })}` : "",
666
- formatLabel: oe === nn.OS_LOCATION ? i("form.appointment.meeting-format.in-person-location-method-os-location") : U,
667
- notificationMessage: rt,
668
- showMoreSlotsLabel: i("form.appointment.show-more-slots.text"),
669
- previousWeekLabel: i("form.appointment.accessibility.calendar.previous-week.aria-label"),
670
- nextWeekLabel: i("form.appointment.accessibility.calendar.next-week.aria-label"),
671
- pendingFocusIndex: O,
672
- consumePendingFocusIndex: st
673
- };
674
- }, Je = Ge(void 0), Xe = (e) => `${e}-timezone-note`, F = () => {
675
- const e = Ze(Je);
676
- if (typeof e > "u")
677
- throw new Error("Appointment parts must be used inside an <Appointment> component");
678
- return e;
679
- }, Re = () => {
680
- const { disabled: e, readOnly: t } = ce();
681
- return !!e || !!t;
682
- }, C = ({ children: e, className: t }) => {
683
- const { days: n, selectDate: a, weekRangeLabel: s } = F(), r = T(e, C.PreviousWeek), m = T(e, C.Heading), i = T(e, C.NextWeek), l = T(e, C.Day) ?? /* @__PURE__ */ o.createElement(C.Day, null), c = P(() => n.filter((f) => f.isSelected).map((f) => f.key), [
684
- n
685
- ]), d = Re(), S = P(() => n.filter((f) => d || f.isDisabled).map((f) => f.key), [
686
- n,
687
- d
688
- ]), E = (f) => {
689
- if (f === "all")
690
- return;
691
- const [b] = [
692
- ...f
693
- ], h = n.find(({ key: O }) => O === b);
694
- h && a(h.date);
695
- };
696
- return /* @__PURE__ */ o.createElement("div", {
697
- className: t
698
- }, r, m, i, /* @__PURE__ */ o.createElement(yt, {
699
- "aria-label": s,
700
- orientation: "horizontal",
701
- selectionMode: "single",
702
- selectedKeys: c,
703
- disabledKeys: S,
704
- onSelectionChange: E
705
- }, n.map((f) => le(l, {
706
- key: f.key,
707
- day: f
708
- }))));
709
- }, dn = ({ children: e, className: t }) => {
710
- const { changeWeek: n, canGoToPreviousWeek: a, previousWeekLabel: s, nextWeekLabel: r } = F(), m = Re(), i = J(null), l = J(!1);
711
- return H(() => {
712
- var S, E, f;
713
- if (a || !l.current)
714
- return;
715
- l.current = !1;
716
- const c = document.activeElement;
717
- if (c !== document.body && c !== i.current)
718
- return;
719
- const d = ((E = (S = i.current) == null ? void 0 : S.closest("fieldset")) == null ? void 0 : E.querySelectorAll("button")) ?? [];
720
- (f = Array.from(d).find((b) => b.getAttribute("aria-label") === r)) == null || f.focus();
721
- }, [
722
- a,
723
- r
724
- ]), /* @__PURE__ */ o.createElement(he, {
725
- ref: i,
726
- className: t,
727
- "aria-label": s,
728
- isDisabled: !a || m,
729
- onPress: () => {
730
- l.current = !0, n(-1);
731
- }
732
- }, e ?? "‹");
733
- }, fn = ({ children: e, className: t }) => {
734
- const { changeWeek: n, nextWeekLabel: a } = F(), s = Re();
735
- return /* @__PURE__ */ o.createElement(he, {
736
- className: t,
737
- "aria-label": a,
738
- isDisabled: s,
739
- onPress: () => n(1)
740
- }, e ?? "›");
741
- }, Dn = ({ children: e, className: t }) => {
742
- const { weekCaptionLabel: n, weekRangeLabel: a } = F();
743
- return /* @__PURE__ */ o.createElement("span", {
744
- className: t,
745
- "aria-live": "polite"
746
- }, e ? e({
747
- label: n,
748
- weekRange: a
749
- }) : /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("span", {
750
- "aria-hidden": "true"
751
- }, n), /* @__PURE__ */ o.createElement("span", {
752
- style: Ve
753
- }, a)));
754
- }, En = ({ children: e, className: t, ...n }) => {
755
- const { day: a } = n;
756
- return /* @__PURE__ */ o.createElement(At, {
757
- id: a.key,
758
- className: t,
759
- textValue: a.label,
760
- "aria-label": a.isAvailable ? `${a.label}, ${a.availabilityLabel}` : a.label,
761
- "data-available": a.isAvailable || void 0,
762
- "data-today": a.isToday || void 0
763
- }, e ? e({
764
- ...a,
765
- date: new Date(a.date)
766
- }) : /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("span", null, a.weekdayLabel), /* @__PURE__ */ o.createElement("span", null, a.dayOfMonthLabel)));
767
- };
768
- C.PreviousWeek = dn;
769
- C.Heading = Dn;
770
- C.NextWeek = fn;
771
- C.Day = En;
772
- const $e = 'input[type="radio"]', ae = ({ children: e, className: t, ...n }) => {
773
- const { hasTimezoneNote: a } = n, { slots: s, selectedSlotKey: r, selectSlot: m, selectedDateLabel: i, isReloadingSlots: l, timezoneLabel: c, pendingFocusIndex: d, consumePendingFocusIndex: S } = F(), { id: E, disabled: f, readOnly: b, required: h, hasError: O } = ce(), { inputId: W, labelId: A, ariaDescribedBy: N } = Se(), Y = J(null), B = `${W}-slots-label`, U = T(e, ae.Label), oe = T(e, ae.Slot) ?? /* @__PURE__ */ o.createElement(ae.Slot, null), se = !!U && !!i, $ = [
774
- N,
775
- a && c ? Xe(W) : void 0
776
- ].filter(Boolean).join(" ") || void 0, v = (p) => {
777
- var _, k, G;
778
- (G = (k = (_ = Y.current) == null ? void 0 : _.querySelectorAll($e)) == null ? void 0 : k[p]) == null || G.focus();
779
- };
780
- return kt(() => {
781
- var G, ue;
782
- if (!!((G = Y.current) != null && G.querySelector($e))) {
783
- v(0);
784
- return;
785
- }
786
- const _ = Array.from(((ue = document.getElementById(W)) == null ? void 0 : ue.querySelectorAll('[role="option"]')) ?? []), k = _.find((K) => K.getAttribute("aria-selected") === "true") ?? _.find((K) => K.getAttribute("aria-disabled") !== "true");
787
- k == null || k.focus();
788
- }, E), H(() => {
789
- d !== void 0 && (v(d), S());
790
- }, [
791
- d,
792
- s.length
793
- ]), /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("div", {
794
- role: "status",
795
- style: Ve
796
- }, s.length > 0 ? i : void 0), /* @__PURE__ */ o.createElement(Nt, {
797
- ref: Y,
798
- className: t,
799
- value: r ?? null,
800
- onChange: m,
801
- isDisabled: f,
802
- isReadOnly: b,
803
- isRequired: h,
804
- isInvalid: O,
805
- "aria-labelledby": se ? B : A,
806
- "aria-describedby": $,
807
- "data-refetch": l || void 0
808
- }, le(U, {
809
- labelId: B
810
- }), s.map((p) => le(oe, {
811
- key: p.key,
812
- slot: p
813
- }))));
814
- }, Sn = ({ children: e, className: t, ...n }) => {
815
- const { selectedDateLabel: a } = F(), { labelId: s } = n;
816
- return a ? /* @__PURE__ */ o.createElement("div", {
817
- id: s,
818
- className: t
819
- }, e ? e({
820
- label: a
821
- }) : a) : null;
822
- }, pn = ({ children: e, className: t, ...n }) => {
823
- const { slot: a } = n;
824
- return /* @__PURE__ */ o.createElement(gt, {
825
- value: a.key,
826
- "aria-label": a.timeRange
827
- }, /* @__PURE__ */ o.createElement(It, {
828
- className: t
829
- }, e ? e(a) : a.timeRange));
830
- };
831
- ae.Label = Sn;
832
- ae.Slot = pn;
833
- const u = ({ children: e, className: t }) => {
834
- const n = ce(), { id: a, FieldLayout: s } = n, { labelId: r, inputId: m, ariaDescribedBy: i } = Se(), l = Rt(wt.APPOINTMENT), c = P(() => ({
835
- ...n,
836
- initialData: l,
837
- inputId: m,
838
- ariaLabelledBy: r,
839
- ariaDescribedBy: i,
840
- fieldId: a
841
- }), [
842
- n,
843
- l,
844
- m,
845
- r,
846
- i,
847
- a
848
- ]), d = T(e, u.Label), S = T(e, u.Description), E = T(e, u.Error);
849
- return /* @__PURE__ */ o.createElement(s, {
850
- fieldId: a,
851
- renderLabel: () => le(d, {
852
- as: "div"
853
- }),
854
- renderInput: () => /* @__PURE__ */ o.createElement(Gt, {
855
- appointmentFieldProps: c
856
- }, /* @__PURE__ */ o.createElement(Ln, {
857
- className: t
858
- }, e)),
859
- renderDescription: () => /* @__PURE__ */ o.createElement(o.Fragment, null, E, S)
860
- });
861
- }, _n = {
862
- visibility: "hidden"
863
- }, Ln = ({ children: e, className: t }) => {
864
- const { required: n, onFocus: a, onBlur: s } = ce(), { inputId: r, labelId: m, ariaDescribedBy: i } = Se(), l = mn(), c = T(e, u.Loader), d = T(e, u.Notification), S = T(e, u.Dates), E = T(e, u.Timezone), f = T(e, u.Format), b = T(e, u.Slots), h = T(e, u.ShowMoreSlots);
865
- return /* @__PURE__ */ o.createElement(Je.Provider, {
866
- value: l
867
- }, /* @__PURE__ */ o.createElement(Wt, {
868
- id: r,
869
- className: t,
870
- ariaLabelledBy: m,
871
- ariaDescribedBy: i,
872
- required: n,
873
- onFocus: a,
874
- onBlur: s
875
- }, c, l.hasError ? d : /* @__PURE__ */ o.createElement("div", {
876
- style: l.isLoading ? _n : void 0
877
- }, S, E, f, le(b, {
878
- hasTimezoneNote: !!E
879
- }), d, h)));
880
- }, yn = ({ children: e, className: t }) => {
881
- const { isLoading: n, isRefetching: a } = F();
882
- return !n && !a ? null : /* @__PURE__ */ o.createElement("div", {
883
- className: t,
884
- role: "status",
885
- "aria-live": "polite",
886
- "data-initial": n || void 0,
887
- "data-refetch": !n && a || void 0
888
- }, e);
889
- }, An = ({ children: e, className: t }) => {
890
- const { notificationMessage: n } = F();
891
- return n ? /* @__PURE__ */ o.createElement("div", {
892
- className: t,
893
- role: "status"
894
- }, e ? e({
895
- message: n
896
- }) : n) : null;
897
- }, Nn = ({ children: e, className: t }) => {
898
- const { timezoneLabel: n } = F(), { inputId: a } = Se();
899
- return n ? /* @__PURE__ */ o.createElement("span", {
900
- id: Xe(a),
901
- className: t
902
- }, e ? e({
903
- label: n
904
- }) : n) : null;
905
- }, gn = ({ children: e, className: t }) => {
906
- const { formatLabel: n } = F();
907
- return n ? /* @__PURE__ */ o.createElement("span", {
908
- className: t
909
- }, e ? e({
910
- label: n
911
- }) : n) : null;
912
- }, In = ({ children: e, className: t }) => {
913
- const { hasMoreSlots: n, showMoreSlots: a, showMoreSlotsLabel: s } = F(), { disabled: r, readOnly: m } = ce();
914
- return n ? /* @__PURE__ */ o.createElement(he, {
915
- className: t,
916
- isDisabled: !!r || !!m,
917
- onPress: a
918
- }, e ? e({
919
- label: s
920
- }) : s) : null;
921
- };
922
- u.Label = Ct;
923
- u.Loader = yn;
924
- u.Notification = An;
925
- u.Dates = C;
926
- u.Timezone = Nn;
927
- u.Format = gn;
928
- u.Slots = ae;
929
- u.ShowMoreSlots = In;
930
- u.Description = Ft;
931
- u.Error = Mt;
932
- const On = "_appointment_14hug_1", bn = "_dates_14hug_6", Tn = "_weekHeading_14hug_27", hn = "_weekButton_14hug_36", vn = "_previousWeek_14hug_68", kn = "_nextWeek_14hug_72", Rn = "_day_14hug_84", wn = "_weekdayLabel_14hug_96", Fn = "_indicator_14hug_108", Mn = "_hint_14hug_131", Cn = "_slots_14hug_144", Wn = "_slotsLabel_14hug_159", Bn = "_slot_14hug_144", Un = "_slotHover_14hug_198", xn = "_slotSelected_14hug_206", Pn = "_showMoreSlots_14hug_260", zn = "_loader_14hug_290", Hn = "_notification_14hug_326", y = {
933
- appointment: On,
934
- dates: bn,
935
- weekHeading: Tn,
936
- weekButton: hn,
937
- previousWeek: vn,
938
- nextWeek: kn,
939
- day: Rn,
940
- weekdayLabel: wn,
941
- indicator: Fn,
942
- hint: Mn,
943
- slots: Cn,
944
- slotsLabel: Wn,
945
- slot: Bn,
946
- slotHover: Un,
947
- slotSelected: xn,
948
- showMoreSlots: Pn,
949
- loader: zn,
950
- notification: Hn
951
- }, Yn = ({ content: e, locale: t }) => /* @__PURE__ */ o.createElement(lt, {
952
- content: e,
953
- locale: t
954
- }), Kn = {
955
- base: y.slot,
956
- selected: y.slotSelected,
957
- hover: y.slotHover
958
- }, $n = () => {
959
- const e = Lt({
960
- globalClasses: _t,
961
- moduleClasses: Kn
962
- });
963
- return /* @__PURE__ */ o.createElement(u, {
964
- className: y.appointment
965
- }, /* @__PURE__ */ o.createElement(u.Label, {
966
- className: w(mt, fe.label)
967
- }, /* @__PURE__ */ o.createElement(u.Label.Required, {
968
- className: w(dt, fe.requiredMark)
969
- })), /* @__PURE__ */ o.createElement(u.Loader, {
970
- className: y.loader
971
- }), /* @__PURE__ */ o.createElement(u.Dates, {
972
- className: w(ft, y.dates)
973
- }, /* @__PURE__ */ o.createElement(u.Dates.PreviousWeek, {
974
- className: w(de, y.weekButton, y.previousWeek)
975
- }, /* @__PURE__ */ o.createElement(Ce, null)), /* @__PURE__ */ o.createElement(u.Dates.Heading, {
976
- className: y.weekHeading
977
- }), /* @__PURE__ */ o.createElement(u.Dates.NextWeek, {
978
- className: w(de, y.weekButton, y.nextWeek)
979
- }, /* @__PURE__ */ o.createElement(Ce, null)), /* @__PURE__ */ o.createElement(u.Dates.Day, {
980
- className: w(de, We.day, y.day)
981
- }, (t) => /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("span", {
982
- className: y.weekdayLabel
983
- }, t.weekdayLabel), /* @__PURE__ */ o.createElement("span", {
984
- className: We.dayNumber
985
- }, t.dayOfMonthLabel, /* @__PURE__ */ o.createElement("span", {
986
- className: y.indicator
987
- }))))), /* @__PURE__ */ o.createElement(u.Timezone, {
988
- className: w(Be, y.hint)
989
- }), /* @__PURE__ */ o.createElement(u.Format, {
990
- className: w(Be, y.hint)
991
- }), /* @__PURE__ */ o.createElement(u.Slots, {
992
- className: y.slots
993
- }, /* @__PURE__ */ o.createElement(u.Slots.Label, {
994
- className: w(Dt, y.slotsLabel)
995
- }), /* @__PURE__ */ o.createElement(u.Slots.Slot, {
996
- className: ({ isSelected: t, isHovered: n, isDisabled: a, isReadOnly: s }) => e({
997
- isSelected: t,
998
- isHovered: n && !t && !a && !s
999
- })
1000
- }, (t) => t.timeRange)), /* @__PURE__ */ o.createElement(u.Notification, {
1001
- className: y.notification
1002
- }), /* @__PURE__ */ o.createElement(u.ShowMoreSlots, {
1003
- className: w(Et, de, y.showMoreSlots)
1004
- }), /* @__PURE__ */ o.createElement(u.Error, {
1005
- className: w(St, fe.error)
1006
- }, /* @__PURE__ */ o.createElement(ct, null), /* @__PURE__ */ o.createElement(u.Error.Text, null)), /* @__PURE__ */ o.createElement(u.Description, {
1007
- className: w(pt, fe.description)
1008
- }, Yn));
1009
- }, ua = () => /* @__PURE__ */ o.createElement($n, null);
1010
- export {
1011
- ua as AppointmentRAC
1012
- };