@wix/form-elements 1.74.0 → 1.76.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 (116) hide show
  1. package/dist/component/appointment-rac-BQsFMmBg.js +1016 -0
  2. package/dist/component/{bookings-address-rac-BcrkXf63.js → bookings-address-rac-AJNyTdok.js} +1 -1
  3. package/dist/component/{bookings-email-rac-DYq5RxOP.js → bookings-email-rac-BHZ0MFgI.js} +1 -1
  4. package/dist/component/{bookings-first-name-rac-ZJ_sQ-01.js → bookings-first-name-rac-Bw5FuWNX.js} +1 -1
  5. package/dist/component/{bookings-header-rac-Cv8kl01f.js → bookings-header-rac-C1M2Pg1f.js} +1 -1
  6. package/dist/component/{bookings-last-name-rac-BmnulSZ6.js → bookings-last-name-rac-DKkPY0CO.js} +1 -1
  7. package/dist/component/{bookings-login-bar-rac-Bdi4xs9y.js → bookings-login-bar-rac-P6pziSl1.js} +2 -2
  8. package/dist/component/{bookings-phone-rac-C8DjSzUY.js → bookings-phone-rac-CiOZWKHz.js} +1 -1
  9. package/dist/component/{bookings-rich-text-rac-DYu011oy.js → bookings-rich-text-rac-D9ZComtY.js} +1 -1
  10. package/dist/component/{checkbox-field-rac-BH3yEE5j.js → checkbox-field-rac-4zG3Sf1c.js} +328 -320
  11. package/dist/component/checkbox-group-field-headless-DN2aNw9g.js +205 -0
  12. package/dist/component/checkbox-group-field-rac-B1qhet83.js +41 -0
  13. package/dist/component/{checkbox-group-rac-CgW0DnhX.js → checkbox-group-rac-DGsE7xGu.js} +1 -1
  14. package/dist/component/checkbox-indicator-module-classes-BcScu147.js +17 -0
  15. package/dist/component/{checkbox-rac-DOAYMMsi.js → checkbox-rac-CFWQW9_K.js} +1 -1
  16. package/dist/component/{contacts-address-rac-DXJa4J_k.js → contacts-address-rac-G5ZH3Odo.js} +1 -1
  17. package/dist/component/{contacts-birthdate-rac-CVsuRq3B.js → contacts-birthdate-rac-C7TDUfT0.js} +1 -1
  18. package/dist/component/{contacts-company-rac-b2bwHSNC.js → contacts-company-rac-8queUhWT.js} +1 -1
  19. package/dist/component/{contacts-email-rac-DMPcpQ1c.js → contacts-email-rac-CYOs5N_I.js} +1 -1
  20. package/dist/component/{contacts-first-name-rac-CL2BsHuJ.js → contacts-first-name-rac-D8Goc_Ym.js} +1 -1
  21. package/dist/component/{contacts-last-name-rac-hdBsWaqb.js → contacts-last-name-rac-lBmtuEnr.js} +1 -1
  22. package/dist/component/{contacts-phone-rac-DQF6aV9B.js → contacts-phone-rac-DSUWUNBX.js} +1 -1
  23. package/dist/component/{contacts-position-rac-CVX-WCfx.js → contacts-position-rac-wA-aw5Id.js} +1 -1
  24. package/dist/component/contacts-subscribe-rac-CAbBbFxZ.js +13 -0
  25. package/dist/component/{contacts-tax-id-rac-0KTXvF81.js → contacts-tax-id-rac-BpjVM1Ye.js} +1 -1
  26. package/dist/component/{date-availability-DBljhBgO.js → date-availability-CeiMjrtD.js} +1 -1
  27. package/dist/component/{date-input-field-rac-CfflD2Ar.js → date-input-field-rac-CVaajAFM.js} +30 -30
  28. package/dist/component/{date-input-rac-fQclCKoa.js → date-input-rac-DhEzawuM.js} +1 -1
  29. package/dist/component/{date-picker-field-rac-BSmFOaH-.js → date-picker-field-rac-1Q6yyNmK.js} +35 -35
  30. package/dist/component/{date-picker-rac-D7I3ramu.js → date-picker-rac-BCGtmXMJ.js} +1 -1
  31. package/dist/component/{date-time-input-field-rac-vjZDQ_Fp.js → date-time-input-field-rac-Dd-HNgKP.js} +35 -35
  32. package/dist/component/{date-time-input-rac-CDbS0VZR.js → date-time-input-rac-CsCWEsH5.js} +1 -1
  33. package/dist/component/{dext-checkbox-group-rac-BBiPt6_a.js → dext-checkbox-group-rac-CauN5uuV.js} +2 -2
  34. package/dist/component/{dext-checkbox-rac-Cqp--0SO.js → dext-checkbox-rac-q-g9gDnw.js} +1 -1
  35. package/dist/component/{dext-date-picker-rac-5Wft0w9m.js → dext-date-picker-rac-CZT3dTLv.js} +1 -1
  36. package/dist/component/{dext-date-time-input-rac-Bbs7bgtn.js → dext-date-time-input-rac-DVUoZZbX.js} +1 -1
  37. package/dist/component/{dext-dropdown-rac-CSvhtqbc.js → dext-dropdown-rac-GRltutt5.js} +1 -1
  38. package/dist/component/{dext-email-rac-BoLeXqyI.js → dext-email-rac-74Y8S9GA.js} +1 -1
  39. package/dist/component/{dext-number-input-rac-DzaJYTSz.js → dext-number-input-rac-CF9d_GTl.js} +1 -1
  40. package/dist/component/{dext-phone-rac-BagPg_CT.js → dext-phone-rac-DObx_gOd.js} +1 -1
  41. package/dist/component/{dext-radio-group-rac-B5HSQt7a.js → dext-radio-group-rac-CzU9KX5_.js} +2 -2
  42. package/dist/component/{dext-rating-input-rac-DrtaAf-E.js → dext-rating-input-rac-BjRwwgXr.js} +1 -1
  43. package/dist/component/{dext-tags-rac-Cg4jJ4jr.js → dext-tags-rac-Vif4x1yF.js} +2 -2
  44. package/dist/component/{dext-text-area-rac-C_t-W7lk.js → dext-text-area-rac-DmZwl_ax.js} +1 -1
  45. package/dist/component/{dext-text-input-rac-ChvV21Jf.js → dext-text-input-rac-B6FVbjUM.js} +1 -1
  46. package/dist/component/{dext-url-input-rac-DclbSYTr.js → dext-url-input-rac-17Dj3ICM.js} +1 -1
  47. package/dist/component/donation-rac-bgHep0Xi.js +307 -0
  48. package/dist/component/{dropdown-field-headless-CTZ-zGqZ.js → dropdown-field-headless-BGfJ1FyZ.js} +3 -3
  49. package/dist/component/{dropdown-field-rac-C1KVtxwv.js → dropdown-field-rac-DGiysJQY.js} +7 -7
  50. package/dist/component/{dropdown-rac-CkkDEDje.js → dropdown-rac-FHjz8fKp.js} +1 -1
  51. package/dist/component/{ecom-address-rac-BOuugSxX.js → ecom-address-rac-DSbpf4z8.js} +1 -1
  52. package/dist/component/{ecom-subscription-checkbox-rac-IZeMlljb.js → ecom-subscription-checkbox-rac-DiZWNwnt.js} +6 -6
  53. package/dist/component/{email-input-field-rac-CNzmm1j7.js → email-input-field-rac-BQKK2O7L.js} +44 -44
  54. package/dist/component/events-repeater-rac-Dudnyhal.js +255 -0
  55. package/dist/component/{events-rsvp-rac-BmjboAco.js → events-rsvp-rac-008H5Ska.js} +3 -3
  56. package/dist/component/{field-error-headless-DQZ5XAdn.js → field-error-headless-C5ZsFUKv.js} +1 -1
  57. package/dist/component/{field-label-headless-DoxfHHaj.js → field-label-headless-CS5OYsiI.js} +1 -1
  58. package/dist/component/field-rac.module-DjmaTYkc.js +23 -0
  59. package/dist/component/{file-upload-rac-YEQ7uXhm.js → file-upload-rac-bQ2QOO8Q.js} +48 -48
  60. package/dist/component/{fixed-payment-rac-DDufIQBT.js → fixed-payment-rac-B6FvXoCU.js} +17 -17
  61. package/dist/component/{form-C6WwBcGP.js → form-BpHElSwH.js} +69 -69
  62. package/dist/component/form-element-classes-BXNs5k3q.js +119 -0
  63. package/dist/component/form.css +1 -1
  64. package/dist/component/form.js +1 -1
  65. package/dist/component/{header-field-rac-DGfjrjQC.js → header-field-rac-D4UYcmok.js} +3 -3
  66. package/dist/component/{header-rac-C_JE2cTg.js → header-rac-KavPiBdn.js} +1 -1
  67. package/dist/component/{image-choice-rac-LDLPQwrN.js → image-choice-rac-BJQqBhBD.js} +35 -36
  68. package/dist/component/{index-CIOoaQ8Z.js → index-RSEYrQef.js} +2 -2
  69. package/dist/component/{index-C2srcuHD.js → index-Y8iTxLat.js} +4 -4
  70. package/dist/component/{isObjectLike-E5QfEa1u.js → isObjectLike-jwHec4Ap.js} +1 -1
  71. package/dist/component/{multiline-address-field-rac-Biyj2tIN.js → multiline-address-field-rac-D4Ibno80.js} +110 -110
  72. package/dist/component/{multiline-address-rac-BCqCvG7a.js → multiline-address-rac-CrTSjzBN.js} +1 -1
  73. package/dist/component/{number-input-field-rac-CwUoIbM8.js → number-input-field-rac-DW1SjB-Z.js} +16 -16
  74. package/dist/component/{number-input-rac-CdYdTDem.js → number-input-rac-CdE_hRbA.js} +1 -1
  75. package/dist/component/{password-rac-D62npVHY.js → password-rac-BCxl5mMQ.js} +20 -20
  76. package/dist/component/{payment-input-rac-D4u-3vcW.js → payment-input-rac-DmO4s4ue.js} +9 -9
  77. package/dist/component/{phone-input-field-rac-uHxR3ozd.js → phone-input-field-rac-BYAnwk5h.js} +25 -25
  78. package/dist/component/{phone-rac-Bf99_BGi.js → phone-rac-gS4k9Yn8.js} +1 -1
  79. package/dist/component/product-list-rac-CO0o3yOg.js +271 -0
  80. package/dist/component/{quiz-radio-group-rac-CPGS0LEb.js → quiz-radio-group-rac-Dhk7nkzb.js} +2 -2
  81. package/dist/component/{radio-group-field-rac-BWpTNAbO.js → radio-group-field-rac-DdlyQ3m6.js} +3 -3
  82. package/dist/component/{radio-group-field-rac.module-WxU5zxvM.js → radio-group-field-rac.module-emin6sSc.js} +3 -3
  83. package/dist/component/{radio-group-rac-dA4WZ1Vj.js → radio-group-rac-B-9q91fJ.js} +1 -1
  84. package/dist/component/{rating-input-field-rac-CJnFsBvH.js → rating-input-field-rac-VDaJKq-n.js} +27 -28
  85. package/dist/component/{rating-input-rac-DXVYozFV.js → rating-input-rac-BVO62LmE.js} +1 -1
  86. package/dist/component/{rich-content-rac.module-DkKwzJS7.js → rich-content-rac.module-CdiaAjxG.js} +1 -1
  87. package/dist/component/{rich-text-field-rac-8FWCRrpb.js → rich-text-field-rac-C4RrbyEX.js} +3 -3
  88. package/dist/component/{rich-text-rac-OeM_mPRy.js → rich-text-rac-BG376ww9.js} +1 -1
  89. package/dist/component/{service-dropdown-rac-mvUMpcS_.js → service-dropdown-rac-Dy6-OpVR.js} +18 -18
  90. package/dist/component/services-multi-choice-rac-BKW9MP_b.js +84 -0
  91. package/dist/component/{signature-rac-D44U9Uyp.js → signature-rac-Cxgixp4o.js} +56 -56
  92. package/dist/component/{submit-button-rac-BqtcgVAn.js → submit-button-rac-BqPJ7WPI.js} +2 -2
  93. package/dist/component/{tags-field-rac-CemsTKWz.js → tags-field-rac-wwqpztG7.js} +36 -37
  94. package/dist/component/{tags-rac-fVjCf6qo.js → tags-rac-DUxITYxU.js} +1 -1
  95. package/dist/component/{text-area-field-rac-BPciZlZb.js → text-area-field-rac-Cen6O33S.js} +16 -16
  96. package/dist/component/{text-area-rac-CRTORdZM.js → text-area-rac-CRlO56GA.js} +1 -1
  97. package/dist/component/{text-input-field-rac-CvFoWlRN.js → text-input-field-rac-CbnKn03g.js} +6 -6
  98. package/dist/component/{text-input-headless-BQ3TWU9G.js → text-input-headless-C_NTJmLe.js} +3 -3
  99. package/dist/component/{text-input-rac-DSFkEmob.js → text-input-rac-DvwV7Igm.js} +1 -1
  100. package/dist/component/{time-input-rac-CGgs7ncp.js → time-input-rac-TSEXiODs.js} +15 -15
  101. package/dist/component/{url-input-field-rac-CqvgTc-F.js → url-input-field-rac-Cxgh9T8s.js} +20 -20
  102. package/dist/component/{url-input-rac-C45KOwnr.js → url-input-rac-DNw-Jg1U.js} +1 -1
  103. package/dist/component/use-element-state-class-name-CC65g9mT.js +15 -0
  104. package/dist/component/{use-service-options-base-D4Zl-iGW.js → use-service-options-base-EFrxTpGm.js} +1 -1
  105. package/package.json +2 -2
  106. package/dist/component/appointment-rac-Bze1s2XD.js +0 -1005
  107. package/dist/component/checkbox-group-field-headless-D_GG5LHM.js +0 -210
  108. package/dist/component/checkbox-group-field-rac-Cj7Erubs.js +0 -41
  109. package/dist/component/contacts-subscribe-rac-Dl1ot9qw.js +0 -13
  110. package/dist/component/donation-rac-FYQIMm5m.js +0 -308
  111. package/dist/component/events-repeater-rac-CMV0Lmwz.js +0 -247
  112. package/dist/component/field-rac.module-Cac83bU5.js +0 -21
  113. package/dist/component/form-element-classes-DDKCTFQj.js +0 -65
  114. package/dist/component/form-element-keys-D0sEdpFo.js +0 -8
  115. package/dist/component/product-list-rac-iRf6Ra7i.js +0 -263
  116. package/dist/component/services-multi-choice-rac-DrgUrn_N.js +0 -76
@@ -1,1005 +0,0 @@
1
- import o, { useRef as J, useState as j, useEffect as Y, 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 T from "classnames";
4
- import { ab as ce, aa as ct, ae as ke, ad as mt, c as ut, as as dt, ar as ft, ai as me, af as Se, ak as Dt, ah as Et, F as St } from "./form-C6WwBcGP.js";
5
- import { C as Be } from "./chevron-down-icon-CcpVm6B-.js";
6
- import { E as pt } from "./error-icon-hZxQ6DEy.js";
7
- import { s as fe } from "./field-rac.module-Cac83bU5.js";
8
- import { z as De, R as yt, A as Ie, i as Lt, j as Oe, h as _t, B as Nt, q as At } from "./form-element-classes-DDKCTFQj.js";
9
- import { ListBox as bt, Button as Re, ListBoxItem as gt, RadioGroup as It, RadioField as Ot, RadioButton as Tt } from "react-aria-components";
10
- import { f as w, a as le } from "./find-child-C60k4CxG.js";
11
- import { D as wt, E as vt } from "./field-error-headless-DQZ5XAdn.js";
12
- import { L as kt } from "./field-label-headless-DoxfHHaj.js";
13
- import { F as Rt } from "./fieldset-headless-CD3fds9J.js";
14
- import { g as ht } from "./get-first-day-of-the-week-DvnsxYhQ.js";
15
- import "date-fns";
16
- import { V as Ve } from "./headless-styles-CmcyA_pi.js";
17
- function Ft(e) {
18
- return { evid: 40, src: 16, endpoint: "", params: e };
19
- }
20
- var Te = /* @__PURE__ */ (function(e) {
21
- return e.BOOKING_NOT_INSTALL = "BOOKING_NOT_INSTALL", e.NO_AVAILABILITY_DATES_FOUND = "NO_AVAILABILITY_DATES_FOUND", e.GENERAL = "GENERAL", e;
22
- })({}), z = /* @__PURE__ */ (function(e) {
23
- return e.LOADING = "LOADING", e.DONE = "DONE", e.ERROR = "ERROR", e;
24
- })({});
25
- const V = 4;
26
- var Q = /* @__PURE__ */ (function(e) {
27
- 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;
28
- })({}), te = /* @__PURE__ */ (function(e) {
29
- return e.LOAD = "load", e.CLICK = "click", e;
30
- })({});
31
- const Mt = (e) => {
32
- var t;
33
- return {
34
- bookingsServiceId: e == null ? void 0 : e.id,
35
- formGuid: (t = e == null ? void 0 : e.form) == null ? void 0 : t.id,
36
- serviceProperties: Ct(e)
37
- };
38
- }, Ct = (e) => {
39
- var t;
40
- return JSON.stringify({
41
- serviceId: e == null ? void 0 : e.id,
42
- serviceType: e == null ? void 0 : e.type,
43
- locationIds: (t = e == null ? void 0 : e.locations) == null ? void 0 : t.map((n) => n.id).filter((n) => n),
44
- staffMemberIds: e == null ? void 0 : e.staffMemberIds,
45
- isOfferedAsPricingPlan: !1
46
- });
47
- }, qe = (e) => {
48
- var u;
49
- const { appointmentFieldProps: t } = he(), { isEditor: n, isComposer: a } = ce(), s = ct(), r = e || ((u = t == null ? void 0 : t.initialData) == null ? void 0 : u.service);
50
- if (!(n || a))
51
- return {
52
- ...s,
53
- report: (i) => s == null ? void 0 : s.report(Ft({
54
- ...Mt(r),
55
- ...i
56
- }))
57
- };
58
- };
59
- var we;
60
- (function(e) {
61
- e.UNDEFINED = "UNDEFINED", e.OWNER_BUSINESS = "OWNER_BUSINESS", e.OWNER_CUSTOM = "OWNER_CUSTOM", e.CUSTOM = "CUSTOM";
62
- })(we || (we = {}));
63
- var Ue;
64
- (function(e) {
65
- e.UNKNOWN_REQUESTED_GENDER = "UNKNOWN_REQUESTED_GENDER", e.ANY_MALE = "ANY_MALE", e.ANY_FEMALE = "ANY_FEMALE";
66
- })(Ue || (Ue = {}));
67
- var xe;
68
- (function(e) {
69
- e.UNKNOWN_LOCATION_TYPE = "UNKNOWN_LOCATION_TYPE", e.BUSINESS = "BUSINESS", e.CUSTOM = "CUSTOM", e.CUSTOMER = "CUSTOMER";
70
- })(xe || (xe = {}));
71
- var Pe;
72
- (function(e) {
73
- e.UNKNOWN_REQUESTED_GENDER = "UNKNOWN_REQUESTED_GENDER", e.ANY_MALE = "ANY_MALE", e.ANY_FEMALE = "ANY_FEMALE";
74
- })(Pe || (Pe = {}));
75
- var ze;
76
- (function(e) {
77
- e.ASC = "ASC", e.DESC = "DESC";
78
- })(ze || (ze = {}));
79
- const Wt = (e) => {
80
- const { service: t } = e || {};
81
- return (t == null ? void 0 : t.id) ? null : {
82
- type: Te.GENERAL,
83
- message: "Service ID is missing"
84
- };
85
- }, Bt = ({ appointmentFieldProps: e, isEditor: t, isComposer: n }) => {
86
- const { initialData: a } = e, s = Pt();
87
- if (t || n)
88
- return {
89
- ...s,
90
- timezone: je(),
91
- dataStatus: z.DONE
92
- };
93
- {
94
- const r = Wt(a);
95
- if (r)
96
- return {
97
- dataStatus: z.ERROR,
98
- error: r
99
- };
100
- }
101
- return {
102
- ...s,
103
- dataStatus: z.LOADING
104
- };
105
- }, Ut = (e, t) => {
106
- const n = /* @__PURE__ */ new Date(), a = new Date(n);
107
- a.setMonth(a.getMonth() + e);
108
- const s = new Date(n.toLocaleString("en-US", {
109
- timeZone: t
110
- })), r = new Date(a.toLocaleString("en-US", {
111
- timeZone: t
112
- }));
113
- return {
114
- startDate: s,
115
- endDate: r
116
- };
117
- }, je = () => Intl.DateTimeFormat().resolvedOptions().timeZone, xt = (e) => {
118
- var t, n, a;
119
- if ((n = (t = e == null ? void 0 : e[0]) == null ? void 0 : t.slot) != null && n.startDate)
120
- return new Date((a = e[0].slot) == null ? void 0 : a.startDate);
121
- }, Pt = ({ duration: e = 60, timezone: t = "UTC" } = {}) => {
122
- var E, f;
123
- const n = "267d1c11-8019-4e3d-b9c6-cd2b859c69e2", a = /* @__PURE__ */ new Date(), s = [], r = [], u = a.toISOString().split("T")[0], i = 10, l = 18;
124
- let c = /* @__PURE__ */ new Date(`${u}T${i}:00:00`), d = new Date(c);
125
- d.setMinutes(d.getMinutes() + e);
126
- let S = !1;
127
- for (; d.getHours() < l || d.getHours() === l && d.getMinutes() === 0; ) {
128
- const O = {
129
- slot: {
130
- serviceId: n,
131
- startDate: c.toISOString(),
132
- endDate: d.toISOString(),
133
- location: {
134
- locationType: we.CUSTOM
135
- }
136
- },
137
- bookable: !0,
138
- totalSpots: 1,
139
- openSpots: 1,
140
- bookingPolicyViolations: {
141
- tooEarlyToBook: !1,
142
- tooLateToBook: !1,
143
- bookOnlineDisabled: !1
144
- },
145
- nestedSlots: []
146
- };
147
- r.push(O), S || (s.push(O), S = !0), c = new Date(d), d = new Date(c), d.setMinutes(d.getMinutes() + e);
148
- }
149
- return {
150
- availabilitySlots: r,
151
- availabilityDates: s,
152
- timezone: t,
153
- currentSlotBulkSize: V,
154
- selectedDate: s.length > 0 && ((f = (E = s[0]) == null ? void 0 : E.slot) != null && f.startDate) ? new Date(s[0].slot.startDate) : void 0
155
- };
156
- };
157
- function zt(e) {
158
- var f;
159
- const { initialData: t, onChange: n, value: a } = e, { isEditor: s, isComposer: r } = ce(), u = (f = t == null ? void 0 : t.service) == null ? void 0 : f.id, { actions: i } = ke(), l = J(i);
160
- l.current = i;
161
- const c = !!(i != null && i.getAvailabilityDates && (i != null && i.getAvailabilitySlots)), [d, S] = j(null), E = qe(t == null ? void 0 : t.service);
162
- return Y(() => {
163
- u && !s && !r && c && (async () => {
164
- var W, N, A, K, B;
165
- const v = je(), I = {
166
- currentSlotBulkSize: V,
167
- timezone: v,
168
- dataStatus: z.LOADING
169
- };
170
- try {
171
- const U = async (oe) => {
172
- var k, p;
173
- const { startDate: se, endDate: $ } = Ut(oe, v);
174
- return (p = (k = l.current) == null ? void 0 : k.getAvailabilityDates) == null ? void 0 : p.call(k, {
175
- serviceId: u,
176
- fromDate: se,
177
- toDate: $,
178
- timeZone: v
179
- });
180
- };
181
- if (I.availabilityDates = await U(2), (W = I.availabilityDates) != null && W.length || (I.availabilityDates = await U(6)), !((N = I.availabilityDates) != null && N.length)) {
182
- E == null || E.report({
183
- action: te.LOAD,
184
- component: Q.NO_AVAILABILITY_AT_ALL
185
- }), S({
186
- dataStatus: z.ERROR,
187
- error: {
188
- type: Te.NO_AVAILABILITY_DATES_FOUND,
189
- message: "No availability dates found"
190
- }
191
- });
192
- return;
193
- }
194
- I.selectedDate = xt(I.availabilityDates), I.selectedDate && (I.availabilitySlots = await ((K = (A = l.current) == null ? void 0 : A.getAvailabilitySlots) == null ? void 0 : K.call(A, {
195
- serviceId: u,
196
- timeZone: v,
197
- selectedDate: I.selectedDate
198
- }))), E == null || E.report({
199
- action: te.LOAD,
200
- component: (B = I.availabilityDates) != null && B.length ? Q.FORM : Q.NO_AVAILABILITY_FOR_DATE
201
- }), a != null && a.startDate || n(void 0), S({
202
- ...I,
203
- dataStatus: z.DONE
204
- });
205
- } catch (U) {
206
- console.error(U), S({
207
- dataStatus: z.ERROR,
208
- error: {
209
- type: Te.GENERAL,
210
- message: "An error occurred in initialAppointmentState"
211
- }
212
- });
213
- }
214
- })();
215
- }, [
216
- s,
217
- r,
218
- u,
219
- c
220
- ]), d;
221
- }
222
- const Qe = /* @__PURE__ */ Ge({
223
- appointmentState: {},
224
- setAppointmentState: () => {
225
- }
226
- }), Yt = ({ appointmentFieldProps: e, children: t }) => {
227
- const { isEditor: n, isComposer: a } = ce(), [s, r] = j(() => Bt({
228
- appointmentFieldProps: e,
229
- isEditor: n,
230
- isComposer: a
231
- })), u = zt(e);
232
- return Y(() => {
233
- u && r({
234
- ...s,
235
- ...u
236
- });
237
- }, [
238
- u
239
- ]), /* @__PURE__ */ o.createElement(Qe.Provider, {
240
- value: {
241
- appointmentFieldProps: e,
242
- appointmentState: s,
243
- setAppointmentState: (i) => r({
244
- ...s,
245
- ...i
246
- })
247
- }
248
- }, t);
249
- }, he = () => Ze(Qe), Kt = (e, t) => {
250
- if (e.startOfWeek.getMonth() === e.endOfWeek.getMonth())
251
- return new Intl.DateTimeFormat(t, {
252
- month: "long",
253
- year: "numeric"
254
- }).format(e.endOfWeek);
255
- const n = new Intl.DateTimeFormat(t, {
256
- month: "short"
257
- }).format(e.startOfWeek), a = new Intl.DateTimeFormat(t, {
258
- month: "short",
259
- year: "numeric"
260
- }).format(e.endOfWeek);
261
- return `${n} - ${a}`;
262
- }, Ht = (e) => !(e != null && e.startDate) || !(e != null && e.endDate) || !(e != null && e.timeZone) ? null : {
263
- startDate: e == null ? void 0 : e.startDate,
264
- endDate: e == null ? void 0 : e.endDate,
265
- timeZone: e == null ? void 0 : e.timeZone
266
- }, Ye = ({ timezone: e, language: t, formatType: n }) => {
267
- var s;
268
- return (s = new Intl.DateTimeFormat(t, {
269
- timeZone: e,
270
- timeZoneName: n === "name" ? "long" : "short"
271
- }).formatToParts(/* @__PURE__ */ new Date()).find(({ type: r }) => r === "timeZoneName")) == null ? void 0 : s.value;
272
- }, $t = ({ timezone: e, language: t }) => {
273
- const n = Ye({
274
- timezone: e,
275
- language: t,
276
- formatType: "name"
277
- }), a = Ye({
278
- timezone: e,
279
- language: t,
280
- formatType: "offset"
281
- });
282
- return `${n} (${a})`;
283
- }, ne = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate(), Gt = (e, t) => {
284
- const n = new Date(e);
285
- n.setDate(e.getDate() - t);
286
- const a = new Date(e);
287
- return a.setDate(e.getDate() + t), {
288
- fromDate: n,
289
- toDate: a
290
- };
291
- }, Zt = ({ setIsReloadingSlots: e }) => {
292
- const { appointmentFieldProps: t, appointmentState: n, setAppointmentState: a } = he(), { value: s } = t, { actions: r } = ke();
293
- Y(() => {
294
- (async () => {
295
- var i, l;
296
- 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)) {
297
- e(!0);
298
- const d = new Date(s.startDate), { fromDate: S, toDate: E } = Gt(d, 8), [f, O] = await Promise.all([
299
- (i = r == null ? void 0 : r.getAvailabilityDates) == null ? void 0 : i.call(r, {
300
- serviceId: t == null ? void 0 : t.initialData.service.id,
301
- timeZone: (n == null ? void 0 : n.timezone) || "",
302
- fromDate: S,
303
- toDate: E
304
- }),
305
- (l = r == null ? void 0 : r.getAvailabilitySlots) == null ? void 0 : l.call(r, {
306
- serviceId: t == null ? void 0 : t.initialData.service.id,
307
- timeZone: (n == null ? void 0 : n.timezone) || "",
308
- selectedDate: d
309
- })
310
- ]);
311
- a({
312
- availabilityDates: f,
313
- selectedDate: d,
314
- availabilitySlots: O
315
- }), e(!1);
316
- }
317
- })();
318
- }, [
319
- s,
320
- n == null ? void 0 : n.dataStatus
321
- ]);
322
- }, Vt = (e, t) => !e || !t.length ? e : e.filter((n) => {
323
- var a;
324
- return !t.includes(((a = n == null ? void 0 : n.slot) == null ? void 0 : a.startDate) ?? "");
325
- }), Ee = (e) => !(e != null && e.startDate) || !(e != null && e.endDate) ? "" : `${e == null ? void 0 : e.startDate}_${e == null ? void 0 : e.endDate}`, qt = ({ locale: e, endDate: t, startDate: n, timezone: a }) => {
326
- const s = {
327
- hour: "numeric",
328
- minute: "numeric",
329
- timeZone: a
330
- }, r = new Intl.DateTimeFormat(e, s).format(new Date(n)), u = new Intl.DateTimeFormat(e, s).format(new Date(t));
331
- return `${r} - ${u}`;
332
- }, jt = ({ selectedDate: e, locale: t, timezone: n }) => e ? new Intl.DateTimeFormat(t, {
333
- weekday: "long",
334
- month: "short",
335
- day: "numeric",
336
- timeZone: n
337
- }).format(e) : "", Qt = (e, t) => {
338
- let n;
339
- return t.forEach((a, s) => {
340
- var r, u;
341
- Ee({
342
- startDate: (r = a == null ? void 0 : a.slot) == null ? void 0 : r.startDate,
343
- endDate: (u = a == null ? void 0 : a.slot) == null ? void 0 : u.endDate
344
- }) === e && (n = s);
345
- }), n;
346
- };
347
- var Jt = /* @__PURE__ */ (function(e) {
348
- return e.OS_LOCATION = "OS_LOCATION", e.CUSTOM_LOCATION = "CUSTOM_LOCATION", e;
349
- })({});
350
- const Xt = "SLOT_UNAVAILABLE", Ke = [], en = (e) => {
351
- var t;
352
- return ((t = e == null ? void 0 : e.params) == null ? void 0 : t.reason) === Xt;
353
- }, tn = ({ error: e, selectedSlot: t }) => {
354
- const { isExperimentEnabled: n } = mt(), a = n(ut.BIF_SLOT_HOLD), [s, r] = j(Ke), u = a && en(e), i = t == null ? void 0 : t.startDate, l = J(!1);
355
- return Y(() => {
356
- if (!u) {
357
- l.current = !1;
358
- return;
359
- }
360
- l.current || (l.current = !0, i && r((c) => c.includes(i) ? c : [
361
- ...c,
362
- i
363
- ]));
364
- }, [
365
- u,
366
- i
367
- ]), a ? s : Ke;
368
- }, q = 7, ve = (e) => {
369
- const t = new Date(e);
370
- return t.setHours(0, 0, 0, 0), t;
371
- }, nn = (e) => {
372
- const t = new Date(e);
373
- return t.setHours(23, 59, 59, 999), t;
374
- }, ee = (e, t) => {
375
- const n = new Date(e);
376
- return n.setDate(n.getDate() + t), n;
377
- }, He = (e, t) => {
378
- const n = ve(e), a = (n.getDay() - t + q) % q;
379
- return ee(n, -a);
380
- }, an = (e) => `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`, on = (e, t, n) => {
381
- const a = new Intl.DateTimeFormat(n, {
382
- month: "short",
383
- day: "numeric"
384
- });
385
- return typeof a.formatRange == "function" ? a.formatRange(e, t) : `${a.format(e)} - ${a.format(t)}`;
386
- }, sn = (e, t = []) => t.some((n) => {
387
- var a;
388
- return !!((a = n.slot) != null && a.startDate) && ne(new Date(n.slot.startDate), e);
389
- }), rn = () => {
390
- var We;
391
- const { appointmentFieldProps: e, appointmentState: t, setAppointmentState: n } = he(), { language: a, isEditor: s, isComposer: r, isMobile: u } = ce(), { t: i } = dt(), { actions: l } = ke(), c = qe(), [d, S] = j(!1), [E, f] = j(!1), [O, v] = j(), [I, W] = j();
392
- Zt({
393
- setIsReloadingSlots: S
394
- });
395
- const { onChange: N, value: A, target: K, initialData: B, formatDescription: U, locationType: oe, error: se } = e, { availabilityDates: $, availabilitySlots: k, timezone: p = "", selectedDate: L, currentSlotBulkSize: R, dataStatus: G, error: ue } = t, H = (We = B == null ? void 0 : B.service) == null ? void 0 : We.id, Z = G === z.LOADING, X = d || E, pe = !!ue, Me = tn({
396
- error: se,
397
- selectedSlot: A
398
- }), _ = P(() => Vt(k, Me), [
399
- k,
400
- Me
401
- ]);
402
- Y(() => {
403
- N == null || N(Ht(A));
404
- }, [
405
- A == null ? void 0 : A.startDate,
406
- A == null ? void 0 : A.endDate,
407
- p
408
- ]), ft((D) => {
409
- const b = D == null ? void 0 : D[K];
410
- k != null && k.length && n({
411
- availabilitySlots: k.filter((g) => {
412
- var h;
413
- return ((h = g == null ? void 0 : g.slot) == null ? void 0 : h.startDate) !== (b == null ? void 0 : b.startDate);
414
- })
415
- });
416
- }), Y(() => {
417
- if (_ != null && _.length && R) {
418
- const D = Qt(Ee(A ?? void 0), _);
419
- D && D + 1 > R && n({
420
- currentSlotBulkSize: D + 1
421
- });
422
- } else !(_ != null && _.length) && A && (N == null || N(void 0));
423
- }, [
424
- A,
425
- _,
426
- $
427
- ]);
428
- const ye = P(() => ht(a), [
429
- a
430
- ]), Ce = J(L);
431
- Y(() => {
432
- const D = Ce.current;
433
- Ce.current = L, !!L && (!D || !ne(D, L)) && v(void 0);
434
- }, [
435
- L
436
- ]);
437
- const M = P(() => O ?? He(L ?? /* @__PURE__ */ new Date(), ye), [
438
- O,
439
- L,
440
- ye
441
- ]), et = P(() => {
442
- const D = ve(/* @__PURE__ */ new Date()), b = new Intl.DateTimeFormat(a, {
443
- weekday: u ? "narrow" : "short"
444
- }), g = new Intl.DateTimeFormat(a, {
445
- day: "numeric"
446
- }), h = new Intl.DateTimeFormat(a, {
447
- weekday: "long",
448
- month: "long",
449
- day: "numeric"
450
- });
451
- return Array.from({
452
- length: q
453
- }, (re, be) => {
454
- const x = ee(M, be), ge = !!L && ne(x, L), it = ve(x) < D;
455
- return {
456
- key: an(x),
457
- date: x,
458
- isSelected: ge,
459
- isAvailable: !Z && !X && !ge && sn(x, $),
460
- isDisabled: it || X && !ge,
461
- isToday: ne(x, D),
462
- dayOfMonthLabel: g.format(x),
463
- weekdayLabel: b.format(x),
464
- label: h.format(x),
465
- availabilityLabel: i("form.appointment.accessibility.calendar.has-availability.aria-label")
466
- };
467
- });
468
- }, [
469
- M,
470
- L,
471
- $,
472
- Z,
473
- X,
474
- a,
475
- u,
476
- i
477
- ]), Le = Ee(A ?? void 0) || void 0, _e = P(() => Z || d ? [] : (_ ?? []).slice(0, R).flatMap((D) => {
478
- const { startDate: b, endDate: g } = D.slot ?? {};
479
- if (!b || !g)
480
- return [];
481
- const h = Ee({
482
- startDate: b,
483
- endDate: g
484
- });
485
- return [
486
- {
487
- key: h,
488
- startDate: b,
489
- endDate: g,
490
- timeRange: qt({
491
- startDate: b,
492
- endDate: g,
493
- locale: a,
494
- timezone: p
495
- }),
496
- isSelected: h === Le
497
- }
498
- ];
499
- }), [
500
- _,
501
- R,
502
- Z,
503
- d,
504
- a,
505
- p,
506
- Le
507
- ]), Ne = !d && !!(_ != null && _.length) && (R || V) < _.length, Ae = M > He(/* @__PURE__ */ new Date(), ye), tt = ie(
508
- async (D) => {
509
- var b;
510
- if (!(X || L && ne(D, L))) {
511
- S(!0), N == null || N(void 0), n({
512
- currentSlotBulkSize: V,
513
- selectedDate: D,
514
- availabilitySlots: void 0
515
- }), c == null || c.report({
516
- action: te.CLICK,
517
- component: Q.DATE
518
- });
519
- try {
520
- const g = await ((b = l == null ? void 0 : l.getAvailabilitySlots) == null ? void 0 : b.call(l, {
521
- serviceId: H,
522
- timeZone: p,
523
- selectedDate: D
524
- }));
525
- n({
526
- currentSlotBulkSize: V,
527
- selectedDate: D,
528
- availabilitySlots: g
529
- });
530
- } catch {
531
- } finally {
532
- S(!1);
533
- }
534
- }
535
- },
536
- // eslint-disable-next-line react-hooks/exhaustive-deps
537
- [
538
- X,
539
- L,
540
- H,
541
- p,
542
- l,
543
- N,
544
- c
545
- ]
546
- ), de = J(0), nt = ie(
547
- async (D) => {
548
- var re;
549
- if (D < 0 && !Ae)
550
- return;
551
- const b = M, g = ee(M, D * q);
552
- if (v(g), s || r)
553
- return;
554
- const h = ++de.current;
555
- f(!0), c == null || c.report({
556
- action: te.CLICK,
557
- component: Q.PAGINATION
558
- });
559
- try {
560
- const be = await ((re = l == null ? void 0 : l.getAvailabilityDates) == null ? void 0 : re.call(l, {
561
- serviceId: H,
562
- timeZone: p,
563
- fromDate: g,
564
- toDate: nn(ee(g, q - 1))
565
- }));
566
- h === de.current && n({
567
- availabilityDates: be
568
- });
569
- } catch {
570
- h === de.current && v(b);
571
- } finally {
572
- h === de.current && f(!1);
573
- }
574
- },
575
- // eslint-disable-next-line react-hooks/exhaustive-deps
576
- [
577
- Ae,
578
- M,
579
- s,
580
- r,
581
- H,
582
- p,
583
- l,
584
- c
585
- ]
586
- ), at = ie(
587
- (D) => {
588
- const b = _e.find((re) => re.key === D);
589
- if (!b)
590
- return;
591
- const { startDate: g, endDate: h } = b;
592
- c == null || c.report({
593
- action: te.CLICK,
594
- component: Q.SLOT,
595
- startTime: new Date(g).valueOf(),
596
- endTime: new Date(h).valueOf()
597
- }), N == null || N({
598
- startDate: g,
599
- endDate: h,
600
- timeZone: p
601
- });
602
- },
603
- // eslint-disable-next-line react-hooks/exhaustive-deps
604
- [
605
- _e,
606
- p,
607
- N,
608
- c
609
- ]
610
- ), ot = ie(() => {
611
- if (!Ne)
612
- return;
613
- const D = R || V;
614
- c == null || c.report({
615
- action: te.CLICK,
616
- component: Q.SHOW_MORE
617
- }), W(D), n({
618
- currentSlotBulkSize: D + V
619
- });
620
- }, [
621
- Ne,
622
- R,
623
- c
624
- ]), st = ie(() => W(void 0), []), rt = P(() => {
625
- if (pe)
626
- return i("form.appointment.empty-state.notification.text");
627
- if (!Z && !d && !(_ != null && _.length))
628
- return i("form.appointment.slots-not-found.text");
629
- }, [
630
- pe,
631
- Z,
632
- d,
633
- _ == null ? void 0 : _.length,
634
- i
635
- ]);
636
- return {
637
- days: et,
638
- slots: _e,
639
- selectedSlotKey: Le,
640
- selectDate: tt,
641
- selectSlot: at,
642
- changeWeek: nt,
643
- showMoreSlots: ot,
644
- canGoToPreviousWeek: Ae,
645
- hasMoreSlots: Ne,
646
- hasError: pe,
647
- isLoading: Z,
648
- isRefetching: X,
649
- isReloadingSlots: d,
650
- weekRangeLabel: on(M, ee(M, q - 1), a),
651
- weekCaptionLabel: Kt({
652
- startOfWeek: M,
653
- endOfWeek: ee(M, q - 1)
654
- }, a),
655
- selectedDateLabel: jt({
656
- selectedDate: L,
657
- locale: a,
658
- timezone: p
659
- }),
660
- timezoneLabel: p ? `${i("form.appointment.timezone.label")}: ${$t({
661
- timezone: p,
662
- language: a
663
- })}` : "",
664
- formatLabel: oe === Jt.OS_LOCATION ? i("form.appointment.meeting-format.in-person-location-method-os-location") : U,
665
- notificationMessage: rt,
666
- showMoreSlotsLabel: i("form.appointment.show-more-slots.text"),
667
- previousWeekLabel: i("form.appointment.accessibility.calendar.previous-week.aria-label"),
668
- nextWeekLabel: i("form.appointment.accessibility.calendar.next-week.aria-label"),
669
- pendingFocusIndex: I,
670
- consumePendingFocusIndex: st
671
- };
672
- }, Je = Ge(void 0), Xe = (e) => `${e}-timezone-note`, F = () => {
673
- const e = Ze(Je);
674
- if (typeof e > "u")
675
- throw new Error("Appointment parts must be used inside an <Appointment> component");
676
- return e;
677
- }, Fe = () => {
678
- const { disabled: e, readOnly: t } = me();
679
- return !!e || !!t;
680
- }, C = ({ children: e, className: t }) => {
681
- const { days: n, selectDate: a, weekRangeLabel: s } = F(), r = w(e, C.PreviousWeek), u = w(e, C.Heading), i = w(e, C.NextWeek), l = w(e, C.Day) ?? /* @__PURE__ */ o.createElement(C.Day, null), c = P(() => n.filter((f) => f.isSelected).map((f) => f.key), [
682
- n
683
- ]), d = Fe(), S = P(() => n.filter((f) => d || f.isDisabled).map((f) => f.key), [
684
- n,
685
- d
686
- ]), E = (f) => {
687
- if (f === "all")
688
- return;
689
- const [O] = [
690
- ...f
691
- ], v = n.find(({ key: I }) => I === O);
692
- v && a(v.date);
693
- };
694
- return /* @__PURE__ */ o.createElement("div", {
695
- className: t
696
- }, r, u, i, /* @__PURE__ */ o.createElement(bt, {
697
- "aria-label": s,
698
- orientation: "horizontal",
699
- selectionMode: "single",
700
- selectedKeys: c,
701
- disabledKeys: S,
702
- onSelectionChange: E
703
- }, n.map((f) => le(l, {
704
- key: f.key,
705
- day: f
706
- }))));
707
- }, ln = ({ children: e, className: t }) => {
708
- const { changeWeek: n, canGoToPreviousWeek: a, previousWeekLabel: s, nextWeekLabel: r } = F(), u = Fe(), i = J(null), l = J(!1);
709
- return Y(() => {
710
- var S, E, f;
711
- if (a || !l.current)
712
- return;
713
- l.current = !1;
714
- const c = document.activeElement;
715
- if (c !== document.body && c !== i.current)
716
- return;
717
- const d = ((E = (S = i.current) == null ? void 0 : S.closest("fieldset")) == null ? void 0 : E.querySelectorAll("button")) ?? [];
718
- (f = Array.from(d).find((O) => O.getAttribute("aria-label") === r)) == null || f.focus();
719
- }, [
720
- a,
721
- r
722
- ]), /* @__PURE__ */ o.createElement(Re, {
723
- ref: i,
724
- className: t,
725
- "aria-label": s,
726
- isDisabled: !a || u,
727
- onPress: () => {
728
- l.current = !0, n(-1);
729
- }
730
- }, e ?? "‹");
731
- }, cn = ({ children: e, className: t }) => {
732
- const { changeWeek: n, nextWeekLabel: a } = F(), s = Fe();
733
- return /* @__PURE__ */ o.createElement(Re, {
734
- className: t,
735
- "aria-label": a,
736
- isDisabled: s,
737
- onPress: () => n(1)
738
- }, e ?? "›");
739
- }, mn = ({ children: e, className: t }) => {
740
- const { weekCaptionLabel: n, weekRangeLabel: a } = F();
741
- return /* @__PURE__ */ o.createElement("span", {
742
- className: t,
743
- "aria-live": "polite"
744
- }, e ? e({
745
- label: n,
746
- weekRange: a
747
- }) : /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("span", {
748
- "aria-hidden": "true"
749
- }, n), /* @__PURE__ */ o.createElement("span", {
750
- style: Ve
751
- }, a)));
752
- }, un = ({ children: e, className: t, ...n }) => {
753
- const { day: a } = n;
754
- return /* @__PURE__ */ o.createElement(gt, {
755
- id: a.key,
756
- className: t,
757
- textValue: a.label,
758
- "aria-label": a.isAvailable ? `${a.label}, ${a.availabilityLabel}` : a.label,
759
- "data-available": a.isAvailable || void 0,
760
- "data-today": a.isToday || void 0
761
- }, e ? e({
762
- ...a,
763
- date: new Date(a.date)
764
- }) : /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("span", null, a.weekdayLabel), /* @__PURE__ */ o.createElement("span", null, a.dayOfMonthLabel)));
765
- };
766
- C.PreviousWeek = ln;
767
- C.Heading = mn;
768
- C.NextWeek = cn;
769
- C.Day = un;
770
- const $e = 'input[type="radio"]', ae = ({ children: e, className: t, ...n }) => {
771
- const { hasTimezoneNote: a } = n, { slots: s, selectedSlotKey: r, selectSlot: u, selectedDateLabel: i, isReloadingSlots: l, timezoneLabel: c, pendingFocusIndex: d, consumePendingFocusIndex: S } = F(), { id: E, disabled: f, readOnly: O, required: v, hasError: I } = me(), { inputId: W, labelId: N, ariaDescribedBy: A } = Se(), K = J(null), B = `${W}-slots-label`, U = w(e, ae.Label), oe = w(e, ae.Slot) ?? /* @__PURE__ */ o.createElement(ae.Slot, null), se = !!U && !!i, $ = [
772
- A,
773
- a && c ? Xe(W) : void 0
774
- ].filter(Boolean).join(" ") || void 0, k = (p) => {
775
- var L, R, G;
776
- (G = (R = (L = K.current) == null ? void 0 : L.querySelectorAll($e)) == null ? void 0 : R[p]) == null || G.focus();
777
- };
778
- return Dt(() => {
779
- var G, ue;
780
- if (!!((G = K.current) != null && G.querySelector($e))) {
781
- k(0);
782
- return;
783
- }
784
- const L = Array.from(((ue = document.getElementById(W)) == null ? void 0 : ue.querySelectorAll('[role="option"]')) ?? []), R = L.find((H) => H.getAttribute("aria-selected") === "true") ?? L.find((H) => H.getAttribute("aria-disabled") !== "true");
785
- R == null || R.focus();
786
- }, E), Y(() => {
787
- d !== void 0 && (k(d), S());
788
- }, [
789
- d,
790
- s.length
791
- ]), /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("div", {
792
- role: "status",
793
- style: Ve
794
- }, s.length > 0 ? i : void 0), /* @__PURE__ */ o.createElement(It, {
795
- ref: K,
796
- className: t,
797
- value: r ?? null,
798
- onChange: u,
799
- isDisabled: f,
800
- isReadOnly: O,
801
- isRequired: v,
802
- isInvalid: I,
803
- "aria-labelledby": se ? B : N,
804
- "aria-describedby": $,
805
- "data-refetch": l || void 0
806
- }, le(U, {
807
- labelId: B
808
- }), s.map((p) => le(oe, {
809
- key: p.key,
810
- slot: p
811
- }))));
812
- }, dn = ({ children: e, className: t, ...n }) => {
813
- const { selectedDateLabel: a } = F(), { labelId: s } = n;
814
- return a ? /* @__PURE__ */ o.createElement("div", {
815
- id: s,
816
- className: t
817
- }, e ? e({
818
- label: a
819
- }) : a) : null;
820
- }, fn = ({ children: e, className: t, ...n }) => {
821
- const { slot: a } = n;
822
- return /* @__PURE__ */ o.createElement(Ot, {
823
- value: a.key,
824
- "aria-label": a.timeRange
825
- }, /* @__PURE__ */ o.createElement(Tt, {
826
- className: t
827
- }, e ? e(a) : a.timeRange));
828
- };
829
- ae.Label = dn;
830
- ae.Slot = fn;
831
- const m = ({ children: e, className: t }) => {
832
- const n = me(), { id: a, FieldLayout: s } = n, { labelId: r, inputId: u, ariaDescribedBy: i } = Se(), l = Et(St.APPOINTMENT), c = P(() => ({
833
- ...n,
834
- initialData: l,
835
- inputId: u,
836
- ariaLabelledBy: r,
837
- ariaDescribedBy: i,
838
- fieldId: a
839
- }), [
840
- n,
841
- l,
842
- u,
843
- r,
844
- i,
845
- a
846
- ]), d = w(e, m.Label), S = w(e, m.Description), E = w(e, m.Error);
847
- return /* @__PURE__ */ o.createElement(s, {
848
- fieldId: a,
849
- renderLabel: () => le(d, {
850
- as: "div"
851
- }),
852
- renderInput: () => /* @__PURE__ */ o.createElement(Yt, {
853
- appointmentFieldProps: c
854
- }, /* @__PURE__ */ o.createElement(En, {
855
- className: t
856
- }, e)),
857
- renderDescription: () => /* @__PURE__ */ o.createElement(o.Fragment, null, E, S)
858
- });
859
- }, Dn = {
860
- visibility: "hidden"
861
- }, En = ({ children: e, className: t }) => {
862
- const { required: n, onFocus: a, onBlur: s } = me(), { inputId: r, labelId: u, ariaDescribedBy: i } = Se(), l = rn(), c = w(e, m.Loader), d = w(e, m.Notification), S = w(e, m.Dates), E = w(e, m.Timezone), f = w(e, m.Format), O = w(e, m.Slots), v = w(e, m.ShowMoreSlots);
863
- return /* @__PURE__ */ o.createElement(Je.Provider, {
864
- value: l
865
- }, /* @__PURE__ */ o.createElement(Rt, {
866
- id: r,
867
- className: t,
868
- ariaLabelledBy: u,
869
- ariaDescribedBy: i,
870
- required: n,
871
- onFocus: a,
872
- onBlur: s
873
- }, c, l.hasError ? d : /* @__PURE__ */ o.createElement("div", {
874
- style: l.isLoading ? Dn : void 0
875
- }, S, E, f, le(O, {
876
- hasTimezoneNote: !!E
877
- }), d, v)));
878
- }, Sn = ({ children: e, className: t }) => {
879
- const { isLoading: n, isRefetching: a } = F();
880
- return !n && !a ? null : /* @__PURE__ */ o.createElement("div", {
881
- className: t,
882
- role: "status",
883
- "aria-live": "polite",
884
- "data-initial": n || void 0,
885
- "data-refetch": !n && a || void 0
886
- }, e);
887
- }, pn = ({ children: e, className: t }) => {
888
- const { notificationMessage: n } = F();
889
- return n ? /* @__PURE__ */ o.createElement("div", {
890
- className: t,
891
- role: "status"
892
- }, e ? e({
893
- message: n
894
- }) : n) : null;
895
- }, yn = ({ children: e, className: t }) => {
896
- const { timezoneLabel: n } = F(), { inputId: a } = Se();
897
- return n ? /* @__PURE__ */ o.createElement("span", {
898
- id: Xe(a),
899
- className: t
900
- }, e ? e({
901
- label: n
902
- }) : n) : null;
903
- }, Ln = ({ children: e, className: t }) => {
904
- const { formatLabel: n } = F();
905
- return n ? /* @__PURE__ */ o.createElement("span", {
906
- className: t
907
- }, e ? e({
908
- label: n
909
- }) : n) : null;
910
- }, _n = ({ children: e, className: t }) => {
911
- const { hasMoreSlots: n, showMoreSlots: a, showMoreSlotsLabel: s } = F(), { disabled: r, readOnly: u } = me();
912
- return n ? /* @__PURE__ */ o.createElement(Re, {
913
- className: t,
914
- isDisabled: !!r || !!u,
915
- onPress: a
916
- }, e ? e({
917
- label: s
918
- }) : s) : null;
919
- };
920
- m.Label = kt;
921
- m.Loader = Sn;
922
- m.Notification = pn;
923
- m.Dates = C;
924
- m.Timezone = yn;
925
- m.Format = Ln;
926
- m.Slots = ae;
927
- m.ShowMoreSlots = _n;
928
- m.Description = wt;
929
- m.Error = vt;
930
- const Nn = "_appointment_1v1wg_1", An = "_dates_1v1wg_5", bn = "_weekHeading_1v1wg_23", gn = "_weekButton_1v1wg_32", In = "_previousWeek_1v1wg_64", On = "_nextWeek_1v1wg_68", Tn = "_day_1v1wg_80", wn = "_weekdayLabel_1v1wg_95", vn = "_dayNumber_1v1wg_107", kn = "_indicator_1v1wg_167", Rn = "_hint_1v1wg_186", hn = "_slots_1v1wg_199", Fn = "_slotsMobile_1v1wg_208", Mn = "_slotsLabel_1v1wg_212", Cn = "_slot_1v1wg_199", Wn = "_slotLabel_1v1wg_247", Bn = "_showMoreSlots_1v1wg_314", Un = "_loader_1v1wg_345", xn = "_notification_1v1wg_381", y = {
931
- appointment: Nn,
932
- dates: An,
933
- weekHeading: bn,
934
- weekButton: gn,
935
- previousWeek: In,
936
- nextWeek: On,
937
- day: Tn,
938
- weekdayLabel: wn,
939
- dayNumber: vn,
940
- indicator: kn,
941
- hint: Rn,
942
- slots: hn,
943
- slotsMobile: Fn,
944
- slotsLabel: Mn,
945
- slot: Cn,
946
- slotLabel: Wn,
947
- showMoreSlots: Bn,
948
- loader: Un,
949
- notification: xn
950
- }, Pn = ({ content: e, locale: t }) => /* @__PURE__ */ o.createElement(lt, {
951
- content: e,
952
- locale: t
953
- }), zn = () => {
954
- const { isMobile: e } = ce();
955
- return /* @__PURE__ */ o.createElement(m, {
956
- className: y.appointment
957
- }, /* @__PURE__ */ o.createElement(m.Label, {
958
- className: T(De, fe.label)
959
- }, /* @__PURE__ */ o.createElement(m.Label.Required, {
960
- className: T(yt, fe.requiredMark)
961
- })), /* @__PURE__ */ o.createElement(m.Loader, {
962
- className: y.loader
963
- }), /* @__PURE__ */ o.createElement(m.Dates, {
964
- className: y.dates
965
- }, /* @__PURE__ */ o.createElement(m.Dates.PreviousWeek, {
966
- className: T(Ie, y.weekButton, y.previousWeek)
967
- }, /* @__PURE__ */ o.createElement(Be, null)), /* @__PURE__ */ o.createElement(m.Dates.Heading, {
968
- className: T(De, y.weekHeading)
969
- }), /* @__PURE__ */ o.createElement(m.Dates.NextWeek, {
970
- className: T(Ie, y.weekButton, y.nextWeek)
971
- }, /* @__PURE__ */ o.createElement(Be, null)), /* @__PURE__ */ o.createElement(m.Dates.Day, {
972
- className: y.day
973
- }, (t) => /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("span", {
974
- className: T(De, y.weekdayLabel)
975
- }, t.weekdayLabel), /* @__PURE__ */ o.createElement("span", {
976
- className: T(Lt, y.dayNumber)
977
- }, t.dayOfMonthLabel, /* @__PURE__ */ o.createElement("span", {
978
- className: y.indicator
979
- }))))), /* @__PURE__ */ o.createElement(m.Timezone, {
980
- className: T(Oe, y.hint)
981
- }), /* @__PURE__ */ o.createElement(m.Format, {
982
- className: T(Oe, y.hint)
983
- }), /* @__PURE__ */ o.createElement(m.Slots, {
984
- className: T(y.slots, {
985
- [y.slotsMobile]: e
986
- })
987
- }, /* @__PURE__ */ o.createElement(m.Slots.Label, {
988
- className: T(De, y.slotsLabel)
989
- }), /* @__PURE__ */ o.createElement(m.Slots.Slot, {
990
- className: T(_t, y.slot)
991
- }, (t) => /* @__PURE__ */ o.createElement("span", {
992
- className: T(Nt, y.slotLabel)
993
- }, t.timeRange))), /* @__PURE__ */ o.createElement(m.Notification, {
994
- className: y.notification
995
- }), /* @__PURE__ */ o.createElement(m.ShowMoreSlots, {
996
- className: T(Ie, y.showMoreSlots)
997
- }), /* @__PURE__ */ o.createElement(m.Error, {
998
- className: T(At, fe.error)
999
- }, /* @__PURE__ */ o.createElement(pt, null), /* @__PURE__ */ o.createElement(m.Error.Text, null)), /* @__PURE__ */ o.createElement(m.Description, {
1000
- className: T(Oe, fe.description)
1001
- }, Pn));
1002
- }, oa = () => /* @__PURE__ */ o.createElement(zn, null);
1003
- export {
1004
- oa as AppointmentRAC
1005
- };