@wix/form-elements 1.237.0 → 1.239.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 (122) hide show
  1. package/dist/component/appointment-rac-Bm8rDoTG.js +1041 -0
  2. package/dist/component/{bookings-address-rac-lkvT2jFg.js → bookings-address-rac-DU8OkeK5.js} +1 -1
  3. package/dist/component/{bookings-email-rac-B6yDIr7X.js → bookings-email-rac-CknyRCva.js} +1 -1
  4. package/dist/component/{bookings-first-name-rac-BdwaASKa.js → bookings-first-name-rac-DU59YdGL.js} +1 -1
  5. package/dist/component/{bookings-header-rac-K_4D2edM.js → bookings-header-rac-Cp9jofKf.js} +1 -1
  6. package/dist/component/{bookings-last-name-rac-z1DsE6Te.js → bookings-last-name-rac-icNxzYrt.js} +1 -1
  7. package/dist/component/{bookings-login-bar-rac-DuDc27Sg.js → bookings-login-bar-rac-C7q9ivGr.js} +1 -1
  8. package/dist/component/{bookings-phone-rac-D3I57XfO.js → bookings-phone-rac-DO6xouOx.js} +1 -1
  9. package/dist/component/{bookings-rich-text-rac-Dva_0eJC.js → bookings-rich-text-rac-BlchtuQW.js} +1 -1
  10. package/dist/component/{checkbox-field-rac-CcVXm9fo.js → checkbox-field-rac-DykQE4ex.js} +4 -4
  11. package/dist/component/{checkbox-group-field-headless-DIwGr5_m.js → checkbox-group-field-headless-DEEfGA8I.js} +3 -3
  12. package/dist/component/{checkbox-group-field-rac-Di8eepGG.js → checkbox-group-field-rac-Dhj9rm6Q.js} +4 -4
  13. package/dist/component/{checkbox-group-rac-uA3X1M2J.js → checkbox-group-rac-CpfowXJ1.js} +1 -1
  14. package/dist/component/{checkbox-rac-BSYp2Yim.js → checkbox-rac-BR4S6ifx.js} +1 -1
  15. package/dist/component/{contacts-address-rac-BmITc1pA.js → contacts-address-rac-VJta12Vu.js} +1 -1
  16. package/dist/component/{contacts-birthdate-rac-BbiTr6cp.js → contacts-birthdate-rac-8M-73m41.js} +1 -1
  17. package/dist/component/{contacts-company-rac-DUQ7fNTn.js → contacts-company-rac-DL9YQzZH.js} +1 -1
  18. package/dist/component/{contacts-email-rac-CVqqMJbq.js → contacts-email-rac-Cc3REWGd.js} +1 -1
  19. package/dist/component/{contacts-first-name-rac-uv3ldXXw.js → contacts-first-name-rac--JpJgbEk.js} +1 -1
  20. package/dist/component/{contacts-last-name-rac-CimDHNgO.js → contacts-last-name-rac-CY5pia7A.js} +1 -1
  21. package/dist/component/{contacts-phone-rac-BShfAZ5U.js → contacts-phone-rac-CM3FGS_4.js} +1 -1
  22. package/dist/component/{contacts-position-rac-BENXoFz5.js → contacts-position-rac-D4Peii3n.js} +1 -1
  23. package/dist/component/{contacts-subscribe-rac-CBBgFf9U.js → contacts-subscribe-rac-BJkc1FNK.js} +1 -1
  24. package/dist/component/{contacts-tax-id-rac-B4fcviNx.js → contacts-tax-id-rac-QhcqnnBB.js} +1 -1
  25. package/dist/component/{date-availability-BrxRBFHK.js → date-availability-BK0U1C5v.js} +1 -1
  26. package/dist/component/{date-input-field-rac-BFDOSod0.js → date-input-field-rac-Dz8j3H_P.js} +8 -8
  27. package/dist/component/{date-input-rac-Cd6SHUjO.js → date-input-rac-o0ootRXL.js} +1 -1
  28. package/dist/component/{date-picker-field-rac-BN2EjYXP.js → date-picker-field-rac-CWz0tsV1.js} +8 -8
  29. package/dist/component/{date-picker-rac-BQWpqtZJ.js → date-picker-rac-DNJWptj-.js} +1 -1
  30. package/dist/component/{date-time-input-field-rac-BO_3H4NG.js → date-time-input-field-rac-Bw32HIB2.js} +8 -8
  31. package/dist/component/{date-time-input-rac-wgKGtEcj.js → date-time-input-rac-CAfM3cKC.js} +1 -1
  32. package/dist/component/{dext-checkbox-group-rac-DM20MEtm.js → dext-checkbox-group-rac-DU61bMpN.js} +2 -2
  33. package/dist/component/{dext-checkbox-rac-DvzEyVhG.js → dext-checkbox-rac-CMnEAlvV.js} +1 -1
  34. package/dist/component/{dext-date-picker-rac-cof0w9i_.js → dext-date-picker-rac-CFZJvc4p.js} +1 -1
  35. package/dist/component/{dext-date-time-input-rac-BiJqwZ-5.js → dext-date-time-input-rac-D9uVYWdR.js} +1 -1
  36. package/dist/component/{dext-dropdown-rac-DEq1gj7M.js → dext-dropdown-rac-rnSAPrM7.js} +1 -1
  37. package/dist/component/{dext-email-rac-BDg2wBuO.js → dext-email-rac-OjBTeg7J.js} +1 -1
  38. package/dist/component/{dext-number-input-rac-BBouksMP.js → dext-number-input-rac-BDHXmpsz.js} +1 -1
  39. package/dist/component/{dext-phone-rac-DZASm4Ft.js → dext-phone-rac-Dwqg2FSb.js} +1 -1
  40. package/dist/component/{dext-radio-group-rac-DqAZs7cq.js → dext-radio-group-rac-BdHFvP7g.js} +2 -2
  41. package/dist/component/{dext-rating-input-rac-BUB6w2g3.js → dext-rating-input-rac-BxStM3Z6.js} +1 -1
  42. package/dist/component/{dext-tags-rac-BH6azQiT.js → dext-tags-rac-By9ABifk.js} +2 -2
  43. package/dist/component/{dext-text-area-rac-Bm1Oi7pi.js → dext-text-area-rac-DUiklOQo.js} +1 -1
  44. package/dist/component/{dext-text-input-rac-DBSxcYp8.js → dext-text-input-rac-CyxWpYGU.js} +1 -1
  45. package/dist/component/{dext-url-input-rac-gJ_-qrzY.js → dext-url-input-rac-w8R6U7u8.js} +1 -1
  46. package/dist/component/{dismiss-icon-sdQDwRev.js → dismiss-icon-4SdtTtrF.js} +1 -1
  47. package/dist/component/{donation-rac-CJHcIOnk.js → donation-rac-mhC_41a7.js} +5 -5
  48. package/dist/component/{dropdown-field-rac-D94vF6Um.js → dropdown-field-rac-nCvgQtwV.js} +3 -3
  49. package/dist/component/{dropdown-rac-EN7KMhtd.js → dropdown-rac-BN3E1a2F.js} +1 -1
  50. package/dist/component/{ecom-address-rac-CYk1wXq3.js → ecom-address-rac-BvZ5fKwq.js} +1 -1
  51. package/dist/component/{ecom-subscription-checkbox-rac--cLVBIUD.js → ecom-subscription-checkbox-rac-B21kn8WX.js} +2 -2
  52. package/dist/component/{email-input-field-rac-DWTQUl88.js → email-input-field-rac-BAZfDhzT.js} +3 -3
  53. package/dist/component/{events-repeater-rac-B-CAZJsO.js → events-repeater-rac-MrnfHupV.js} +4 -4
  54. package/dist/component/{events-rsvp-rac-CkLzjZe0.js → events-rsvp-rac-BSeWX1Lx.js} +3 -3
  55. package/dist/component/{field-error-headless-Hpn7Cjyz.js → field-error-headless-Ek4POGu5.js} +1 -1
  56. package/dist/component/{field-label-headless-CZaQ-q22.js → field-label-headless-DrZeUGw3.js} +1 -1
  57. package/dist/component/{file-upload-rac-DelhbRzX.js → file-upload-rac-BgHsS7Ze.js} +4 -4
  58. package/dist/component/{fixed-payment-rac-CGee8oWb.js → fixed-payment-rac-DOYG4dHG.js} +3 -3
  59. package/dist/component/{form-CKPfFL3D.js → form-DnkQAGFK.js} +1698 -1669
  60. package/dist/component/form.js +1 -1
  61. package/dist/component/{header-field-rac-B6vzJnaW.js → header-field-rac-BkCSVoMt.js} +2 -2
  62. package/dist/component/{header-rac-Bc4WxzR1.js → header-rac-DrxFuzRm.js} +1 -1
  63. package/dist/component/{image-choice-rac-BuArZj5n.js → image-choice-rac-BW4I446V.js} +4 -4
  64. package/dist/component/{index-CmopQE1P.js → index-BoA1-4AG.js} +2 -2
  65. package/dist/component/{index-yqi4FTyq.js → index-CffZGLlY.js} +4 -4
  66. package/dist/component/{isObjectLike-DO4jXs__.js → isObjectLike-Bz7iKiVE.js} +1 -1
  67. package/dist/component/{messages_de-BblI6nNP.js → messages_de-S0rBxAIU.js} +1 -1
  68. package/dist/component/{messages_el-Bn-N2ylb.js → messages_el-CMI_nPL7.js} +1 -1
  69. package/dist/component/{messages_fr-DwsdsKNJ.js → messages_fr-CheAamQq.js} +1 -1
  70. package/dist/component/{messages_hr-Cg6bfHop.js → messages_hr-E_aOZLMp.js} +1 -1
  71. package/dist/component/{messages_hu-DlaM-wMA.js → messages_hu-B2dkjZ1e.js} +1 -1
  72. package/dist/component/{messages_it-Cd9TDhM_.js → messages_it-BsPU-f6V.js} +1 -1
  73. package/dist/component/{messages_ko-CXsE6Y5X.js → messages_ko-BeTBMjB8.js} +2 -2
  74. package/dist/component/{messages_lt-D2_5jBX-.js → messages_lt-D5b93e1_.js} +1 -1
  75. package/dist/component/{messages_nl--wTlsfUh.js → messages_nl-7-vnYSr_.js} +1 -1
  76. package/dist/component/{messages_no-C0t05F50.js → messages_no-BgFqH2jP.js} +1 -1
  77. package/dist/component/{messages_pt-CfE28POg.js → messages_pt-DL0XLwt6.js} +1 -1
  78. package/dist/component/{messages_ru-Cjgw9gK2.js → messages_ru-NQEwxnBj.js} +1 -1
  79. package/dist/component/{messages_zh-Dy3Cx4WX.js → messages_zh-Cjp8A8Tu.js} +1 -1
  80. package/dist/component/{multiline-address-field-rac-CijPzBxU.js → multiline-address-field-rac-BqJCbVps.js} +8 -8
  81. package/dist/component/{multiline-address-rac-CchEjTwl.js → multiline-address-rac-BmH-FA_w.js} +1 -1
  82. package/dist/component/{number-input-field-rac-CdJstTE-.js → number-input-field-rac-BZAEJpnZ.js} +4 -4
  83. package/dist/component/{number-input-rac-B0V7Xy0I.js → number-input-rac-BNnuE4_U.js} +1 -1
  84. package/dist/component/{password-rac-BipcyWPk.js → password-rac-CdouGooI.js} +4 -4
  85. package/dist/component/{payment-input-rac-ClhUNxdL.js → payment-input-rac-CJpi9gN5.js} +4 -4
  86. package/dist/component/{phone-input-field-rac-CPNMdr70.js → phone-input-field-rac-CrlJJbEi.js} +7 -7
  87. package/dist/component/{phone-rac-DL5pW-cK.js → phone-rac-DUhwmZCm.js} +1 -1
  88. package/dist/component/{product-list-rac-Ii0qlyiq.js → product-list-rac-BOiMnJzz.js} +4 -4
  89. package/dist/component/{quiz-radio-group-rac-DtO0om99.js → quiz-radio-group-rac-BhUdkWjK.js} +1 -1
  90. package/dist/component/{radio-button-module-classes-CY-zH0im.js → radio-button-module-classes-C3bv24a7.js} +3 -3
  91. package/dist/component/{radio-group-field-rac-ViY8g4gL.js → radio-group-field-rac-DaBu-Y0t.js} +4 -4
  92. package/dist/component/{radio-group-rac-CjCoPD-w.js → radio-group-rac-BfogPsFM.js} +1 -1
  93. package/dist/component/{rating-input-field-rac-BMFXLqfg.js → rating-input-field-rac-DMb9Gx38.js} +4 -4
  94. package/dist/component/{rating-input-rac-CWGGV3Fx.js → rating-input-rac-BSWe-su7.js} +1 -1
  95. package/dist/component/{rich-content-rac.module-CTlkS2_O.js → rich-content-rac.module-BTwxU9GT.js} +1 -1
  96. package/dist/component/{rich-text-field-rac-2SQn_URM.js → rich-text-field-rac-ColJr0G-.js} +2 -2
  97. package/dist/component/{rich-text-rac-L3m09cVp.js → rich-text-rac-Bl8NdFB3.js} +1 -1
  98. package/dist/component/{service-dropdown-rac-uKz9PkBj.js → service-dropdown-rac-BRJGGTwv.js} +4 -4
  99. package/dist/component/{services-multi-choice-rac-sOJlp6_l.js → services-multi-choice-rac-ChQYyeIQ.js} +5 -5
  100. package/dist/component/{signature-rac-B1O7Ivtg.js → signature-rac-C_u7kXY2.js} +4 -4
  101. package/dist/component/{submit-button-rac-iYdJFSXy.js → submit-button-rac-PiSBi7Db.js} +2 -2
  102. package/dist/component/{tags-field-rac-CFSrsxw9.js → tags-field-rac-DW_tFzve.js} +5 -5
  103. package/dist/component/{tags-rac-KW_c8m3p.js → tags-rac-ND1_w18c.js} +1 -1
  104. package/dist/component/{text-area-field-rac-BJEAvqCy.js → text-area-field-rac-BT5kn2_p.js} +4 -4
  105. package/dist/component/{text-area-rac-Bk9j2e4k.js → text-area-rac-RTfL5OYW.js} +1 -1
  106. package/dist/component/{text-input-field-rac-KlrY_3qp.js → text-input-field-rac-B6aqpQqL.js} +3 -3
  107. package/dist/component/{text-input-headless-B6gzsedE.js → text-input-headless-BiYydJnd.js} +3 -3
  108. package/dist/component/{text-input-rac-CSO1g0rD.js → text-input-rac-B_ktWIA7.js} +1 -1
  109. package/dist/component/{time-input-rac-jaYI3_XV.js → time-input-rac-vNgNQgNN.js} +6 -6
  110. package/dist/component/{url-input-field-rac-1t5d4VjM.js → url-input-field-rac-BYRoYHR6.js} +4 -4
  111. package/dist/component/{url-input-rac-BTQOpun9.js → url-input-rac-9AVzPoc5.js} +1 -1
  112. package/dist/component/{use-dropdown-option-class-name-DEBN31l5.js → use-dropdown-option-class-name-DAiT5uNc.js} +2 -2
  113. package/dist/component/{use-dropdown-trigger-class-name-BpcEWMWj.js → use-dropdown-trigger-class-name-aUb_sgFq.js} +7 -7
  114. package/dist/component/{use-element-state-class-name-B0muHOx4.js → use-element-state-class-name-4Q4mzmq7.js} +1 -1
  115. package/dist/component/{use-hoverable-input-class-name-CL0sOlNu.js → use-hoverable-input-class-name-B3TQVTv2.js} +2 -2
  116. package/dist/component/{use-is-forced-open-dropdown-BhQKJWNc.js → use-is-forced-open-dropdown-BqAHpu-1.js} +1 -1
  117. package/dist/component/{use-native-mobile-input-W9CS9U3u.js → use-native-mobile-input-Bq_rDwKS.js} +1 -1
  118. package/dist/component/{use-service-options-base-DUgTjbHR.js → use-service-options-base-Dfmr-7Ha.js} +1 -1
  119. package/dist/component/use-text-input-class-name-D7autJGB.js +6 -0
  120. package/package.json +2 -2
  121. package/dist/component/appointment-rac-DaJz8fBt.js +0 -1021
  122. package/dist/component/use-text-input-class-name-Mm_0ULVk.js +0 -6
@@ -1,1021 +0,0 @@
1
- import o, { useRef as J, useState as Q, useEffect as U, createContext as Ke, useContext as $e, useMemo as P, useCallback as re } from "react";
2
- import { RicosViewer as it } from "@wix/ricos/viewer";
3
- import g from "classnames";
4
- import { C as he } from "./chevron-down-icon-CcpVm6B-.js";
5
- import { E as lt } from "./error-icon-hZxQ6DEy.js";
6
- import { g as ct, c as Ce } from "./calendar.module-BMUyMVja.js";
7
- import { H as me } from "./custom-focus-class-_483Pkwp.js";
8
- import { s as ue } from "./field-rac.module-D0QzJXUv.js";
9
- import { bF as Ee, bE as mt, bJ as ge, bH as ut, bY as dt, bX as Dt, bN as ie, bK as le, bP as ft, bM as Et, F as St, h as _t, X as Nt, am as pt, g as At, j as We, i as yt, n as It, k as Ot, l as Lt, M as Tt, I as bt, m as gt } from "./form-CKPfFL3D.js";
10
- import { u as kt } from "./use-element-state-class-name-B0muHOx4.js";
11
- import { ListBox as vt, Button as ke, ListBoxItem as Rt, RadioGroup as Mt, RadioField as Ft, RadioButton as wt } from "react-aria-components";
12
- import { f as k, a as Se } from "./find-child-C60k4CxG.js";
13
- import { D as ht, E as Ct } from "./field-error-headless-Hpn7Cjyz.js";
14
- import { L as Wt } from "./field-label-headless-CZaQ-q22.js";
15
- import { F as Bt } from "./fieldset-headless-CD3fds9J.js";
16
- import "date-fns";
17
- import { V as Ge } from "./headless-styles-CmcyA_pi.js";
18
- function Pt(e) {
19
- return { evid: 40, src: 16, endpoint: "", params: e };
20
- }
21
- var De = /* @__PURE__ */ (function(e) {
22
- return e.BOOKING_NOT_INSTALL = "BOOKING_NOT_INSTALL", e.NO_AVAILABILITY_DATES_FOUND = "NO_AVAILABILITY_DATES_FOUND", e.GENERAL = "GENERAL", e;
23
- })({}), W = /* @__PURE__ */ (function(e) {
24
- return e.LOADING = "LOADING", e.DONE = "DONE", e.ERROR = "ERROR", e;
25
- })({});
26
- const q = 4;
27
- var X = /* @__PURE__ */ (function(e) {
28
- 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;
29
- })({}), ne = /* @__PURE__ */ (function(e) {
30
- return e.LOAD = "load", e.CLICK = "click", e;
31
- })({});
32
- const Ut = (e) => {
33
- var t;
34
- return {
35
- bookingsServiceId: e == null ? void 0 : e.id,
36
- formGuid: (t = e == null ? void 0 : e.form) == null ? void 0 : t.id,
37
- serviceProperties: xt(e)
38
- };
39
- }, xt = (e) => {
40
- var t;
41
- return JSON.stringify({
42
- serviceId: e == null ? void 0 : e.id,
43
- serviceType: e == null ? void 0 : e.type,
44
- locationIds: (t = e == null ? void 0 : e.locations) == null ? void 0 : t.map((n) => n.id).filter((n) => n),
45
- staffMemberIds: e == null ? void 0 : e.staffMemberIds,
46
- isOfferedAsPricingPlan: !1
47
- });
48
- }, Ze = (e) => {
49
- var l;
50
- const { appointmentFieldProps: t } = ve(), { isEditor: n, isComposer: a } = Ee(), r = mt(), s = e || ((l = t == null ? void 0 : t.initialData) == null ? void 0 : l.service);
51
- if (!(n || a))
52
- return {
53
- ...r,
54
- report: (i) => r == null ? void 0 : r.report(Pt({
55
- ...Ut(s),
56
- ...i
57
- }))
58
- };
59
- };
60
- var Te;
61
- (function(e) {
62
- e.UNDEFINED = "UNDEFINED", e.OWNER_BUSINESS = "OWNER_BUSINESS", e.OWNER_CUSTOM = "OWNER_CUSTOM", e.CUSTOM = "CUSTOM";
63
- })(Te || (Te = {}));
64
- var Be;
65
- (function(e) {
66
- e.UNKNOWN_REQUESTED_GENDER = "UNKNOWN_REQUESTED_GENDER", e.ANY_MALE = "ANY_MALE", e.ANY_FEMALE = "ANY_FEMALE";
67
- })(Be || (Be = {}));
68
- var Pe;
69
- (function(e) {
70
- e.UNKNOWN_LOCATION_TYPE = "UNKNOWN_LOCATION_TYPE", e.BUSINESS = "BUSINESS", e.CUSTOM = "CUSTOM", e.CUSTOMER = "CUSTOMER";
71
- })(Pe || (Pe = {}));
72
- var Ue;
73
- (function(e) {
74
- e.UNKNOWN_REQUESTED_GENDER = "UNKNOWN_REQUESTED_GENDER", e.ANY_MALE = "ANY_MALE", e.ANY_FEMALE = "ANY_FEMALE";
75
- })(Ue || (Ue = {}));
76
- var xe;
77
- (function(e) {
78
- e.ASC = "ASC", e.DESC = "DESC";
79
- })(xe || (xe = {}));
80
- const zt = (e) => {
81
- const { service: t } = e || {};
82
- return (t == null ? void 0 : t.id) ? null : {
83
- type: De.GENERAL,
84
- message: "Service ID is missing"
85
- };
86
- }, Yt = ({ appointmentFieldProps: e, isEditor: t, isComposer: n }) => {
87
- const { initialData: a } = e, r = $t();
88
- if (t || n)
89
- return {
90
- ...r,
91
- timezone: Ve(),
92
- dataStatus: W.DONE
93
- };
94
- {
95
- const s = zt(a);
96
- if (s)
97
- return {
98
- dataStatus: W.ERROR,
99
- error: s
100
- };
101
- }
102
- return {
103
- ...r,
104
- dataStatus: W.LOADING
105
- };
106
- }, Ht = (e, t) => {
107
- const n = /* @__PURE__ */ new Date(), a = new Date(n);
108
- a.setMonth(a.getMonth() + e);
109
- const r = new Date(n.toLocaleString("en-US", {
110
- timeZone: t
111
- })), s = new Date(a.toLocaleString("en-US", {
112
- timeZone: t
113
- }));
114
- return {
115
- startDate: r,
116
- endDate: s
117
- };
118
- }, Ve = () => Intl.DateTimeFormat().resolvedOptions().timeZone, Kt = (e) => {
119
- var t, n, a;
120
- if ((n = (t = e == null ? void 0 : e[0]) == null ? void 0 : t.slot) != null && n.startDate)
121
- return new Date((a = e[0].slot) == null ? void 0 : a.startDate);
122
- }, $t = ({ duration: e = 60, timezone: t = "UTC" } = {}) => {
123
- var E, d;
124
- const n = "267d1c11-8019-4e3d-b9c6-cd2b859c69e2", a = /* @__PURE__ */ new Date(), r = [], s = [], l = a.toISOString().split("T")[0], i = 10, c = 18;
125
- let D = /* @__PURE__ */ new Date(`${l}T${i}:00:00`), u = new Date(D);
126
- u.setMinutes(u.getMinutes() + e);
127
- let S = !1;
128
- for (; u.getHours() < c || u.getHours() === c && u.getMinutes() === 0; ) {
129
- const b = {
130
- slot: {
131
- serviceId: n,
132
- startDate: D.toISOString(),
133
- endDate: u.toISOString(),
134
- location: {
135
- locationType: Te.CUSTOM
136
- }
137
- },
138
- bookable: !0,
139
- totalSpots: 1,
140
- openSpots: 1,
141
- bookingPolicyViolations: {
142
- tooEarlyToBook: !1,
143
- tooLateToBook: !1,
144
- bookOnlineDisabled: !1
145
- },
146
- nestedSlots: []
147
- };
148
- s.push(b), S || (r.push(b), S = !0), D = new Date(u), u = new Date(D), u.setMinutes(u.getMinutes() + e);
149
- }
150
- return {
151
- availabilitySlots: s,
152
- availabilityDates: r,
153
- timezone: t,
154
- currentSlotBulkSize: q,
155
- selectedDate: r.length > 0 && ((d = (E = r[0]) == null ? void 0 : E.slot) != null && d.startDate) ? new Date(r[0].slot.startDate) : void 0
156
- };
157
- };
158
- function Gt(e) {
159
- var d;
160
- const { initialData: t, onChange: n, value: a } = e, { isEditor: r, isComposer: s } = Ee(), l = (d = t == null ? void 0 : t.service) == null ? void 0 : d.id, { actions: i } = ge(), c = J(i);
161
- c.current = i;
162
- const D = !!(i != null && i.getAvailabilityDates && (i != null && i.getAvailabilitySlots)), [u, S] = Q(null), E = Ze(t == null ? void 0 : t.service);
163
- return U(() => {
164
- l && !r && !s && D && (async () => {
165
- var I, O, x, z, Y;
166
- const M = Ve(), A = {
167
- currentSlotBulkSize: q,
168
- timezone: M,
169
- dataStatus: W.LOADING
170
- };
171
- try {
172
- const H = async (oe) => {
173
- var _, N;
174
- const { startDate: $, endDate: F } = Ht(oe, M);
175
- return (N = (_ = c.current) == null ? void 0 : _.getAvailabilityDates) == null ? void 0 : N.call(_, {
176
- serviceId: l,
177
- fromDate: $,
178
- toDate: F,
179
- timeZone: M
180
- });
181
- };
182
- if (A.availabilityDates = await H(2), (I = A.availabilityDates) != null && I.length || (A.availabilityDates = await H(6)), !((O = A.availabilityDates) != null && O.length)) {
183
- E == null || E.report({
184
- action: ne.LOAD,
185
- component: X.NO_AVAILABILITY_AT_ALL
186
- }), S({
187
- dataStatus: W.ERROR,
188
- error: {
189
- type: De.NO_AVAILABILITY_DATES_FOUND,
190
- message: "No availability dates found"
191
- }
192
- });
193
- return;
194
- }
195
- A.selectedDate = Kt(A.availabilityDates), A.selectedDate && (A.availabilitySlots = await ((z = (x = c.current) == null ? void 0 : x.getAvailabilitySlots) == null ? void 0 : z.call(x, {
196
- serviceId: l,
197
- timeZone: M,
198
- selectedDate: A.selectedDate
199
- }))), E == null || E.report({
200
- action: ne.LOAD,
201
- component: (Y = A.availabilityDates) != null && Y.length ? X.FORM : X.NO_AVAILABILITY_FOR_DATE
202
- }), a != null && a.startDate || n(void 0), S({
203
- ...A,
204
- dataStatus: W.DONE
205
- });
206
- } catch (H) {
207
- console.error(H), S({
208
- dataStatus: W.ERROR,
209
- error: {
210
- type: De.GENERAL,
211
- message: "An error occurred in initialAppointmentState"
212
- }
213
- });
214
- }
215
- })();
216
- }, [
217
- r,
218
- s,
219
- l,
220
- D
221
- ]), u;
222
- }
223
- const qe = /* @__PURE__ */ Ke({
224
- appointmentState: {},
225
- setAppointmentState: () => {
226
- }
227
- }), Zt = {
228
- dataStatus: W.ERROR,
229
- error: {
230
- type: De.NO_AVAILABILITY_DATES_FOUND,
231
- message: "No availability dates found"
232
- }
233
- }, Vt = ({ appointmentFieldProps: e, children: t }) => {
234
- var c;
235
- const { isEditor: n, isComposer: a } = Ee(), r = ((c = ut().appointment) == null ? void 0 : c.noAvailability) === !0, [s, l] = Q(() => Yt({
236
- appointmentFieldProps: e,
237
- isEditor: n,
238
- isComposer: a
239
- })), i = Gt(e);
240
- return U(() => {
241
- i && l({
242
- ...s,
243
- ...i
244
- });
245
- }, [
246
- i
247
- ]), /* @__PURE__ */ o.createElement(qe.Provider, {
248
- value: {
249
- appointmentFieldProps: e,
250
- appointmentState: r ? Zt : s,
251
- setAppointmentState: (D) => l({
252
- ...s,
253
- ...D
254
- })
255
- }
256
- }, t);
257
- }, ve = () => $e(qe), qt = (e, t) => {
258
- if (e.startOfWeek.getMonth() === e.endOfWeek.getMonth())
259
- return new Intl.DateTimeFormat(t, {
260
- month: "long",
261
- year: "numeric"
262
- }).format(e.endOfWeek);
263
- const n = new Intl.DateTimeFormat(t, {
264
- month: "short"
265
- }).format(e.startOfWeek), a = new Intl.DateTimeFormat(t, {
266
- month: "short",
267
- year: "numeric"
268
- }).format(e.endOfWeek);
269
- return `${n} - ${a}`;
270
- }, jt = (e) => !(e != null && e.startDate) || !(e != null && e.endDate) || !(e != null && e.timeZone) ? null : {
271
- startDate: e == null ? void 0 : e.startDate,
272
- endDate: e == null ? void 0 : e.endDate,
273
- timeZone: e == null ? void 0 : e.timeZone
274
- }, ze = ({ timezone: e, language: t, formatType: n }) => {
275
- var r;
276
- return (r = new Intl.DateTimeFormat(t, {
277
- timeZone: e,
278
- timeZoneName: n === "name" ? "long" : "short"
279
- }).formatToParts(/* @__PURE__ */ new Date()).find(({ type: s }) => s === "timeZoneName")) == null ? void 0 : r.value;
280
- }, Qt = ({ timezone: e, language: t }) => {
281
- const n = ze({
282
- timezone: e,
283
- language: t,
284
- formatType: "name"
285
- }), a = ze({
286
- timezone: e,
287
- language: t,
288
- formatType: "offset"
289
- });
290
- return `${n} (${a})`;
291
- }, ae = (e, t) => e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate(), Xt = (e, t) => {
292
- const n = new Date(e);
293
- n.setDate(e.getDate() - t);
294
- const a = new Date(e);
295
- return a.setDate(e.getDate() + t), {
296
- fromDate: n,
297
- toDate: a
298
- };
299
- }, Jt = ({ setIsReloadingSlots: e }) => {
300
- const { appointmentFieldProps: t, appointmentState: n, setAppointmentState: a } = ve(), { value: r } = t, { actions: s } = ge();
301
- U(() => {
302
- (async () => {
303
- var i, c;
304
- if (r != null && r.startDate && (n != null && n.selectedDate) && (n == null ? void 0 : n.dataStatus) === W.DONE && !ae(new Date(r.startDate), n == null ? void 0 : n.selectedDate)) {
305
- e(!0);
306
- const u = new Date(r.startDate), { fromDate: S, toDate: E } = Xt(u, 8), [d, b] = await Promise.all([
307
- (i = s == null ? void 0 : s.getAvailabilityDates) == null ? void 0 : i.call(s, {
308
- serviceId: t == null ? void 0 : t.initialData.service.id,
309
- timeZone: (n == null ? void 0 : n.timezone) || "",
310
- fromDate: S,
311
- toDate: E
312
- }),
313
- (c = s == null ? void 0 : s.getAvailabilitySlots) == null ? void 0 : c.call(s, {
314
- serviceId: t == null ? void 0 : t.initialData.service.id,
315
- timeZone: (n == null ? void 0 : n.timezone) || "",
316
- selectedDate: u
317
- })
318
- ]);
319
- a({
320
- availabilityDates: d,
321
- selectedDate: u,
322
- availabilitySlots: b
323
- }), e(!1);
324
- }
325
- })();
326
- }, [
327
- r,
328
- n == null ? void 0 : n.dataStatus
329
- ]);
330
- }, en = (e, t) => !e || !t.length ? e : e.filter((n) => {
331
- var a;
332
- return !t.includes(((a = n == null ? void 0 : n.slot) == null ? void 0 : a.startDate) ?? "");
333
- }), de = (e) => !(e != null && e.startDate) || !(e != null && e.endDate) ? "" : `${e == null ? void 0 : e.startDate}_${e == null ? void 0 : e.endDate}`, tn = ({ locale: e, endDate: t, startDate: n, timezone: a }) => {
334
- const r = {
335
- hour: "numeric",
336
- minute: "numeric",
337
- timeZone: a
338
- }, s = new Intl.DateTimeFormat(e, r).format(new Date(n)), l = new Intl.DateTimeFormat(e, r).format(new Date(t));
339
- return `${s} - ${l}`;
340
- }, nn = ({ selectedDate: e, locale: t, timezone: n }) => e ? new Intl.DateTimeFormat(t, {
341
- weekday: "long",
342
- month: "short",
343
- day: "numeric",
344
- timeZone: n
345
- }).format(e) : "", an = (e, t) => {
346
- let n;
347
- return t.forEach((a, r) => {
348
- var s, l;
349
- de({
350
- startDate: (s = a == null ? void 0 : a.slot) == null ? void 0 : s.startDate,
351
- endDate: (l = a == null ? void 0 : a.slot) == null ? void 0 : l.endDate
352
- }) === e && (n = r);
353
- }), n;
354
- };
355
- var on = /* @__PURE__ */ (function(e) {
356
- return e.OS_LOCATION = "OS_LOCATION", e.CUSTOM_LOCATION = "CUSTOM_LOCATION", e;
357
- })({});
358
- const sn = "SLOT_UNAVAILABLE", rn = (e) => {
359
- var t;
360
- return ((t = e == null ? void 0 : e.params) == null ? void 0 : t.reason) === sn;
361
- }, ln = ({ error: e, selectedSlot: t }) => {
362
- const [n, a] = Q([]), r = rn(e), s = t == null ? void 0 : t.startDate, l = J(!1);
363
- return U(() => {
364
- if (!r) {
365
- l.current = !1;
366
- return;
367
- }
368
- l.current || (l.current = !0, s && a((i) => i.includes(s) ? i : [
369
- ...i,
370
- s
371
- ]));
372
- }, [
373
- r,
374
- s
375
- ]), n;
376
- }, j = 7, be = (e) => {
377
- const t = new Date(e);
378
- return t.setHours(0, 0, 0, 0), t;
379
- }, cn = (e) => {
380
- const t = new Date(e);
381
- return t.setHours(23, 59, 59, 999), t;
382
- }, te = (e, t) => {
383
- const n = new Date(e);
384
- return n.setDate(n.getDate() + t), n;
385
- }, Ye = (e, t) => {
386
- const n = be(e), a = (n.getDay() - t + j) % j;
387
- return te(n, -a);
388
- }, mn = (e) => `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`, un = (e, t, n) => {
389
- const a = new Intl.DateTimeFormat(n, {
390
- month: "short",
391
- day: "numeric"
392
- });
393
- return typeof a.formatRange == "function" ? a.formatRange(e, t) : `${a.format(e)} - ${a.format(t)}`;
394
- }, dn = (e, t = []) => t.some((n) => {
395
- var a;
396
- return !!((a = n.slot) != null && a.startDate) && ae(new Date(n.slot.startDate), e);
397
- }), Dn = () => {
398
- var we;
399
- const { appointmentFieldProps: e, appointmentState: t, setAppointmentState: n } = ve(), { language: a, isEditor: r, isComposer: s } = Ee(), { t: l } = dt(), { actions: i } = ge(), c = Ze(), [D, u] = Q(!1), [S, E] = Q(!1), [d, b] = Q(), [M, A] = Q();
400
- Jt({
401
- setIsReloadingSlots: u
402
- });
403
- const { onChange: I, value: O, target: x, initialData: z, formatDescription: Y, locationType: H, error: oe } = e, { availabilityDates: $, availabilitySlots: F, timezone: _ = "", selectedDate: N, currentSlotBulkSize: v, dataStatus: G, error: Z } = t, K = (we = z == null ? void 0 : z.service) == null ? void 0 : we.id, V = G === W.LOADING, ee = D || S, _e = !!Z, Me = ln({
404
- error: oe,
405
- selectedSlot: O
406
- }), y = P(() => en(F, Me), [
407
- F,
408
- Me
409
- ]);
410
- U(() => {
411
- I == null || I(jt(O));
412
- }, [
413
- O == null ? void 0 : O.startDate,
414
- O == null ? void 0 : O.endDate,
415
- _
416
- ]), Dt((f) => {
417
- const L = f == null ? void 0 : f[x];
418
- F != null && F.length && n({
419
- availabilitySlots: F.filter((T) => {
420
- var R;
421
- return ((R = T == null ? void 0 : T.slot) == null ? void 0 : R.startDate) !== (L == null ? void 0 : L.startDate);
422
- })
423
- });
424
- }), U(() => {
425
- if (y != null && y.length && v) {
426
- const f = an(de(O ?? void 0), y);
427
- f && f + 1 > v && n({
428
- currentSlotBulkSize: f + 1
429
- });
430
- } else !(y != null && y.length) && O && (I == null || I(void 0));
431
- }, [
432
- O,
433
- y,
434
- $
435
- ]);
436
- const Ne = P(() => ct(a), [
437
- a
438
- ]), Fe = J(N);
439
- U(() => {
440
- const f = Fe.current;
441
- Fe.current = N, !!N && (!f || !ae(f, N)) && b(void 0);
442
- }, [
443
- N
444
- ]);
445
- const h = P(() => d ?? Ye(N ?? /* @__PURE__ */ new Date(), Ne), [
446
- d,
447
- N,
448
- Ne
449
- ]), Je = P(() => {
450
- const f = be(/* @__PURE__ */ new Date()), L = new Intl.DateTimeFormat(a, {
451
- weekday: "short"
452
- }), T = new Intl.DateTimeFormat(a, {
453
- day: "numeric"
454
- }), R = new Intl.DateTimeFormat(a, {
455
- weekday: "long",
456
- month: "long",
457
- day: "numeric"
458
- });
459
- return Array.from({
460
- length: j
461
- }, (se, Oe) => {
462
- const B = te(h, Oe), Le = !!N && ae(B, N), rt = be(B) < f;
463
- return {
464
- key: mn(B),
465
- date: B,
466
- isSelected: Le,
467
- isAvailable: !V && !ee && !Le && dn(B, $),
468
- isDisabled: rt || ee && !Le,
469
- isToday: ae(B, f),
470
- dayOfMonthLabel: T.format(B),
471
- weekdayLabel: L.format(B),
472
- label: R.format(B),
473
- availabilityLabel: l("form.appointment.accessibility.calendar.has-availability.aria-label")
474
- };
475
- });
476
- }, [
477
- h,
478
- N,
479
- $,
480
- V,
481
- ee,
482
- a,
483
- l
484
- ]), pe = de(O ?? void 0) || void 0, Ae = P(() => V || D ? [] : (y ?? []).slice(0, v).flatMap((f) => {
485
- const { startDate: L, endDate: T } = f.slot ?? {};
486
- if (!L || !T)
487
- return [];
488
- const R = de({
489
- startDate: L,
490
- endDate: T
491
- });
492
- return [
493
- {
494
- key: R,
495
- startDate: L,
496
- endDate: T,
497
- timeRange: tn({
498
- startDate: L,
499
- endDate: T,
500
- locale: a,
501
- timezone: _
502
- }),
503
- isSelected: R === pe
504
- }
505
- ];
506
- }), [
507
- y,
508
- v,
509
- V,
510
- D,
511
- a,
512
- _,
513
- pe
514
- ]), ye = !D && !!(y != null && y.length) && (v || q) < y.length, Ie = h > Ye(/* @__PURE__ */ new Date(), Ne), et = re(
515
- async (f) => {
516
- var L;
517
- if (!(ee || N && ae(f, N))) {
518
- u(!0), I == null || I(void 0), n({
519
- currentSlotBulkSize: q,
520
- selectedDate: f,
521
- availabilitySlots: void 0
522
- }), c == null || c.report({
523
- action: ne.CLICK,
524
- component: X.DATE
525
- });
526
- try {
527
- const T = await ((L = i == null ? void 0 : i.getAvailabilitySlots) == null ? void 0 : L.call(i, {
528
- serviceId: K,
529
- timeZone: _,
530
- selectedDate: f
531
- }));
532
- n({
533
- currentSlotBulkSize: q,
534
- selectedDate: f,
535
- availabilitySlots: T
536
- });
537
- } catch {
538
- } finally {
539
- u(!1);
540
- }
541
- }
542
- },
543
- // eslint-disable-next-line react-hooks/exhaustive-deps
544
- [
545
- ee,
546
- N,
547
- K,
548
- _,
549
- i,
550
- I,
551
- c
552
- ]
553
- ), ce = J(0), tt = re(
554
- async (f) => {
555
- var se;
556
- if (f < 0 && !Ie)
557
- return;
558
- const L = h, T = te(h, f * j);
559
- if (b(T), r || s)
560
- return;
561
- const R = ++ce.current;
562
- E(!0), c == null || c.report({
563
- action: ne.CLICK,
564
- component: X.PAGINATION
565
- });
566
- try {
567
- const Oe = await ((se = i == null ? void 0 : i.getAvailabilityDates) == null ? void 0 : se.call(i, {
568
- serviceId: K,
569
- timeZone: _,
570
- fromDate: T,
571
- toDate: cn(te(T, j - 1))
572
- }));
573
- R === ce.current && n({
574
- availabilityDates: Oe
575
- });
576
- } catch {
577
- R === ce.current && b(L);
578
- } finally {
579
- R === ce.current && E(!1);
580
- }
581
- },
582
- // eslint-disable-next-line react-hooks/exhaustive-deps
583
- [
584
- Ie,
585
- h,
586
- r,
587
- s,
588
- K,
589
- _,
590
- i,
591
- c
592
- ]
593
- ), nt = re(
594
- (f) => {
595
- const L = Ae.find((se) => se.key === f);
596
- if (!L)
597
- return;
598
- const { startDate: T, endDate: R } = L;
599
- c == null || c.report({
600
- action: ne.CLICK,
601
- component: X.SLOT,
602
- startTime: new Date(T).valueOf(),
603
- endTime: new Date(R).valueOf()
604
- }), I == null || I({
605
- startDate: T,
606
- endDate: R,
607
- timeZone: _
608
- });
609
- },
610
- // eslint-disable-next-line react-hooks/exhaustive-deps
611
- [
612
- Ae,
613
- _,
614
- I,
615
- c
616
- ]
617
- ), at = re(() => {
618
- if (!ye)
619
- return;
620
- const f = v || q;
621
- c == null || c.report({
622
- action: ne.CLICK,
623
- component: X.SHOW_MORE
624
- }), A(f), n({
625
- currentSlotBulkSize: f + q
626
- });
627
- }, [
628
- ye,
629
- v,
630
- c
631
- ]), ot = re(() => A(void 0), []), st = P(() => {
632
- if (_e)
633
- return l("form.appointment.empty-state.notification.text");
634
- if (!V && !D && !(y != null && y.length))
635
- return l("form.appointment.slots-not-found.text");
636
- }, [
637
- _e,
638
- V,
639
- D,
640
- y == null ? void 0 : y.length,
641
- l
642
- ]);
643
- return {
644
- days: Je,
645
- slots: Ae,
646
- selectedSlotKey: pe,
647
- selectDate: et,
648
- selectSlot: nt,
649
- changeWeek: tt,
650
- showMoreSlots: at,
651
- canGoToPreviousWeek: Ie,
652
- hasMoreSlots: ye,
653
- hasError: _e,
654
- isLoading: V,
655
- isRefetching: ee,
656
- isReloadingSlots: D,
657
- weekRangeLabel: un(h, te(h, j - 1), a),
658
- weekCaptionLabel: qt({
659
- startOfWeek: h,
660
- endOfWeek: te(h, j - 1)
661
- }, a),
662
- selectedDateLabel: nn({
663
- selectedDate: N,
664
- locale: a,
665
- timezone: _
666
- }),
667
- timezoneLabel: _ ? `${l("form.appointment.timezone.label")}: ${Qt({
668
- timezone: _,
669
- language: a
670
- })}` : "",
671
- formatLabel: H === on.OS_LOCATION ? l("form.appointment.meeting-format.in-person-location-method-os-location") : Y,
672
- notificationMessage: st,
673
- showMoreSlotsLabel: l("form.appointment.show-more-slots.text"),
674
- previousWeekLabel: l("form.appointment.accessibility.calendar.previous-week.aria-label"),
675
- nextWeekLabel: l("form.appointment.accessibility.calendar.next-week.aria-label"),
676
- pendingFocusIndex: M,
677
- consumePendingFocusIndex: ot
678
- };
679
- }, je = Ke(void 0), Qe = (e) => `${e}-timezone-note`, Xe = (e) => `${e}-date-title`, w = () => {
680
- const e = $e(je);
681
- if (typeof e > "u")
682
- throw new Error("Appointment parts must be used inside an <Appointment> component");
683
- return e;
684
- }, Re = () => {
685
- const { disabled: e, readOnly: t } = ie();
686
- return !!e || !!t;
687
- }, C = ({ children: e, className: t }) => {
688
- const { days: n, selectDate: a, weekRangeLabel: r } = w(), s = k(e, C.PreviousWeek), l = k(e, C.Heading), i = k(e, C.NextWeek), c = k(e, C.Day) ?? /* @__PURE__ */ o.createElement(C.Day, null), D = P(() => n.filter((d) => d.isSelected).map((d) => d.key), [
689
- n
690
- ]), u = Re(), S = P(() => n.filter((d) => u || d.isDisabled).map((d) => d.key), [
691
- n,
692
- u
693
- ]), E = (d) => {
694
- if (d === "all")
695
- return;
696
- const [b] = [
697
- ...d
698
- ], M = n.find(({ key: A }) => A === b);
699
- M && a(M.date);
700
- };
701
- return /* @__PURE__ */ o.createElement("div", {
702
- className: t
703
- }, s, l, i, /* @__PURE__ */ o.createElement(vt, {
704
- "aria-label": r,
705
- orientation: "horizontal",
706
- selectionMode: "single",
707
- selectedKeys: D,
708
- disabledKeys: S,
709
- onSelectionChange: E
710
- }, n.map((d) => Se(c, {
711
- key: d.key,
712
- day: d
713
- }))));
714
- }, fn = ({ children: e, className: t }) => {
715
- const { changeWeek: n, canGoToPreviousWeek: a, previousWeekLabel: r, nextWeekLabel: s } = w(), l = Re(), i = J(null), c = J(!1);
716
- return U(() => {
717
- var S, E, d;
718
- if (a || !c.current)
719
- return;
720
- c.current = !1;
721
- const D = document.activeElement;
722
- if (D !== document.body && D !== i.current)
723
- return;
724
- const u = ((E = (S = i.current) == null ? void 0 : S.closest("fieldset")) == null ? void 0 : E.querySelectorAll("button")) ?? [];
725
- (d = Array.from(u).find((b) => b.getAttribute("aria-label") === s)) == null || d.focus();
726
- }, [
727
- a,
728
- s
729
- ]), /* @__PURE__ */ o.createElement(ke, {
730
- ref: i,
731
- className: t,
732
- "aria-label": r,
733
- isDisabled: !a || l,
734
- onPress: () => {
735
- c.current = !0, n(-1);
736
- }
737
- }, e ?? "‹");
738
- }, En = ({ children: e, className: t }) => {
739
- const { changeWeek: n, nextWeekLabel: a } = w(), r = Re();
740
- return /* @__PURE__ */ o.createElement(ke, {
741
- className: t,
742
- "aria-label": a,
743
- isDisabled: r,
744
- onPress: () => n(1)
745
- }, e ?? "›");
746
- }, Sn = ({ children: e, className: t }) => {
747
- const { weekCaptionLabel: n, weekRangeLabel: a } = w();
748
- return /* @__PURE__ */ o.createElement("span", {
749
- className: t,
750
- "aria-live": "polite"
751
- }, e ? e({
752
- label: n,
753
- weekRange: a
754
- }) : /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("span", {
755
- "aria-hidden": "true"
756
- }, n), /* @__PURE__ */ o.createElement("span", {
757
- style: Ge
758
- }, a)));
759
- }, _n = ({ children: e, className: t, ...n }) => {
760
- const { day: a } = n;
761
- return /* @__PURE__ */ o.createElement(Rt, {
762
- id: a.key,
763
- className: t,
764
- textValue: a.label,
765
- "aria-label": a.isAvailable ? `${a.label}, ${a.availabilityLabel}` : a.label,
766
- "data-available": a.isAvailable || void 0,
767
- "data-today": a.isToday || void 0
768
- }, e ? e({
769
- ...a,
770
- date: new Date(a.date)
771
- }) : /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("span", null, a.weekdayLabel), /* @__PURE__ */ o.createElement("span", null, a.dayOfMonthLabel)));
772
- };
773
- C.PreviousWeek = fn;
774
- C.Heading = Sn;
775
- C.NextWeek = En;
776
- C.Day = _n;
777
- const He = 'input[type="radio"]', fe = ({ children: e, className: t, ...n }) => {
778
- const { hasTimezoneNote: a, hasDateTitle: r } = n, { slots: s, selectedSlotKey: l, selectSlot: i, selectedDateLabel: c, isReloadingSlots: D, timezoneLabel: u, pendingFocusIndex: S, consumePendingFocusIndex: E } = w(), { id: d, disabled: b, readOnly: M, required: A, hasError: I } = ie(), { inputId: O, labelId: x, ariaDescribedBy: z } = le(), Y = J(null), H = k(e, fe.Slot) ?? /* @__PURE__ */ o.createElement(fe.Slot, null), oe = !!r && !!c, $ = [
779
- z,
780
- a && u ? Qe(O) : void 0
781
- ].filter(Boolean).join(" ") || void 0, F = (_, N) => {
782
- var v, G, Z;
783
- (Z = (G = (v = Y.current) == null ? void 0 : v.querySelectorAll(He)) == null ? void 0 : G[_]) == null || Z.focus(N);
784
- };
785
- return ft(() => {
786
- var G, Z;
787
- if (!!((G = Y.current) != null && G.querySelector(He))) {
788
- F(0, {
789
- preventScroll: !0
790
- });
791
- return;
792
- }
793
- const N = Array.from(((Z = document.getElementById(O)) == null ? void 0 : Z.querySelectorAll('[role="option"]')) ?? []), v = N.find((K) => K.getAttribute("aria-selected") === "true") ?? N.find((K) => K.getAttribute("aria-disabled") !== "true");
794
- v == null || v.focus({
795
- preventScroll: !0
796
- });
797
- }, d), U(() => {
798
- S !== void 0 && (F(S), E());
799
- }, [
800
- S,
801
- s.length
802
- ]), /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("div", {
803
- role: "status",
804
- style: Ge
805
- }, s.length > 0 ? c : void 0), /* @__PURE__ */ o.createElement(Mt, {
806
- ref: Y,
807
- className: t,
808
- value: l ?? null,
809
- onChange: i,
810
- isDisabled: b,
811
- isReadOnly: M,
812
- isRequired: A,
813
- isInvalid: I,
814
- "aria-labelledby": oe ? Xe(O) : x,
815
- "aria-describedby": $,
816
- "data-refetch": D || void 0
817
- }, s.map((_) => Se(H, {
818
- key: _.key,
819
- slot: _
820
- }))));
821
- }, Nn = ({ children: e, className: t, ...n }) => {
822
- const { slot: a } = n;
823
- return /* @__PURE__ */ o.createElement(Ft, {
824
- value: a.key,
825
- "aria-label": a.timeRange
826
- }, /* @__PURE__ */ o.createElement(wt, {
827
- className: t
828
- }, e ? e(a) : a.timeRange));
829
- };
830
- fe.Slot = Nn;
831
- const m = ({ children: e, className: t }) => {
832
- const n = ie(), { id: a, FieldLayout: r } = n, { labelId: s, inputId: l, ariaDescribedBy: i } = le(), c = Et(St.APPOINTMENT), D = P(() => ({
833
- ...n,
834
- initialData: c,
835
- inputId: l,
836
- ariaLabelledBy: s,
837
- ariaDescribedBy: i,
838
- fieldId: a
839
- }), [
840
- n,
841
- c,
842
- l,
843
- s,
844
- i,
845
- a
846
- ]), u = k(e, m.Label), S = k(e, m.Description), E = k(e, m.Error);
847
- return /* @__PURE__ */ o.createElement(r, {
848
- fieldId: a,
849
- renderLabel: () => Se(u, {
850
- as: "div"
851
- }),
852
- renderInput: () => /* @__PURE__ */ o.createElement(Vt, {
853
- appointmentFieldProps: D
854
- }, /* @__PURE__ */ o.createElement(An, {
855
- className: t
856
- }, e)),
857
- renderDescription: () => /* @__PURE__ */ o.createElement(o.Fragment, null, E, S)
858
- });
859
- }, pn = {
860
- visibility: "hidden"
861
- }, An = ({ children: e, className: t }) => {
862
- const { required: n, onFocus: a, onBlur: r } = ie(), { inputId: s, labelId: l, ariaDescribedBy: i } = le(), c = Dn(), D = k(e, m.Loader), u = k(e, m.Notification), S = k(e, m.Dates), E = k(e, m.Timezone), d = k(e, m.Format), b = k(e, m.DateTitle), M = k(e, m.Slots), A = k(e, m.ShowMoreSlots);
863
- return /* @__PURE__ */ o.createElement(je.Provider, {
864
- value: c
865
- }, /* @__PURE__ */ o.createElement(Bt, {
866
- id: s,
867
- className: t,
868
- ariaLabelledBy: l,
869
- ariaDescribedBy: i,
870
- required: n,
871
- onFocus: a,
872
- onBlur: r
873
- }, D, c.hasError ? u : /* @__PURE__ */ o.createElement("div", {
874
- style: c.isLoading ? pn : void 0
875
- }, S, E, d, b, Se(M, {
876
- hasTimezoneNote: !!E,
877
- hasDateTitle: !!b
878
- }), u, A)));
879
- }, yn = ({ children: e, className: t }) => {
880
- const { isLoading: n, isRefetching: a } = w();
881
- return !n && !a ? null : /* @__PURE__ */ o.createElement("div", {
882
- className: t,
883
- role: "status",
884
- "aria-live": "polite",
885
- "data-initial": n || void 0,
886
- "data-refetch": !n && a || void 0
887
- }, e);
888
- }, In = ({ children: e, className: t }) => {
889
- const { notificationMessage: n } = w();
890
- return n ? /* @__PURE__ */ o.createElement("div", {
891
- className: t,
892
- role: "status"
893
- }, e ? e({
894
- message: n
895
- }) : n) : null;
896
- }, On = ({ children: e, className: t }) => {
897
- const { timezoneLabel: n } = w(), { inputId: a } = le();
898
- return n ? /* @__PURE__ */ o.createElement("span", {
899
- id: Qe(a),
900
- className: t
901
- }, e ? e({
902
- label: n
903
- }) : n) : null;
904
- }, Ln = ({ children: e, className: t }) => {
905
- const { formatLabel: n } = w();
906
- return n ? /* @__PURE__ */ o.createElement("span", {
907
- className: t
908
- }, e ? e({
909
- label: n
910
- }) : n) : null;
911
- }, Tn = ({ children: e, className: t }) => {
912
- const { selectedDateLabel: n } = w(), { inputId: a } = le();
913
- return n ? /* @__PURE__ */ o.createElement("div", {
914
- id: Xe(a),
915
- className: t
916
- }, e ? e({
917
- label: n
918
- }) : n) : null;
919
- }, bn = ({ children: e, className: t }) => {
920
- const { hasMoreSlots: n, showMoreSlots: a, showMoreSlotsLabel: r } = w(), { disabled: s, readOnly: l } = ie();
921
- return n ? /* @__PURE__ */ o.createElement(ke, {
922
- className: t,
923
- isDisabled: !!s || !!l,
924
- onPress: a
925
- }, e ? e({
926
- label: r
927
- }) : r) : null;
928
- };
929
- m.Label = Wt;
930
- m.Loader = yn;
931
- m.Notification = In;
932
- m.Dates = C;
933
- m.Timezone = On;
934
- m.Format = Ln;
935
- m.DateTitle = Tn;
936
- m.Slots = fe;
937
- m.ShowMoreSlots = bn;
938
- m.Description = ht;
939
- m.Error = Ct;
940
- const gn = "_appointment_ki27o_1", kn = "_dates_ki27o_5", vn = "_weekHeading_ki27o_30", Rn = "_weekButton_ki27o_36", Mn = "_previousWeek_ki27o_68", Fn = "_nextWeek_ki27o_72", wn = "_day_ki27o_84", hn = "_weekdayLabel_ki27o_94", Cn = "_dayNumber_ki27o_103", Wn = "_indicator_ki27o_107", Bn = "_hint_ki27o_130", Pn = "_slots_ki27o_143", Un = "_dateTitle_ki27o_157", xn = "_slot_ki27o_143", zn = "_slotHover_ki27o_199", Yn = "_slotSelected_ki27o_207", Hn = "_showMoreSlots_ki27o_261", Kn = "_loader_ki27o_292", $n = "_notification_ki27o_328", p = {
941
- appointment: gn,
942
- dates: kn,
943
- weekHeading: vn,
944
- weekButton: Rn,
945
- previousWeek: Mn,
946
- nextWeek: Fn,
947
- day: wn,
948
- weekdayLabel: hn,
949
- dayNumber: Cn,
950
- indicator: Wn,
951
- hint: Bn,
952
- slots: Pn,
953
- dateTitle: Un,
954
- slot: xn,
955
- slotHover: zn,
956
- slotSelected: Yn,
957
- showMoreSlots: Hn,
958
- loader: Kn,
959
- notification: $n
960
- }, Gn = ({ content: e, locale: t }) => /* @__PURE__ */ o.createElement(it, {
961
- content: e,
962
- locale: t
963
- }), Zn = {
964
- base: p.slot,
965
- selected: p.slotSelected,
966
- hover: p.slotHover
967
- }, Vn = () => {
968
- const e = kt({
969
- globalClasses: gt,
970
- moduleClasses: Zn
971
- });
972
- return /* @__PURE__ */ o.createElement(m, {
973
- className: g(_t, p.appointment)
974
- }, /* @__PURE__ */ o.createElement(m.Label, {
975
- className: g(Nt, ue.label)
976
- }, /* @__PURE__ */ o.createElement(m.Label.Required, {
977
- className: g(pt, ue.requiredMark)
978
- })), /* @__PURE__ */ o.createElement(m.Loader, {
979
- className: p.loader
980
- }), /* @__PURE__ */ o.createElement(m.Dates, {
981
- className: g(At, p.dates)
982
- }, /* @__PURE__ */ o.createElement(m.Dates.PreviousWeek, {
983
- className: g(me, p.weekButton, p.previousWeek)
984
- }, /* @__PURE__ */ o.createElement(he, null)), /* @__PURE__ */ o.createElement(m.Dates.Heading, {
985
- className: p.weekHeading
986
- }), /* @__PURE__ */ o.createElement(m.Dates.NextWeek, {
987
- className: g(me, p.weekButton, p.nextWeek)
988
- }, /* @__PURE__ */ o.createElement(he, null)), /* @__PURE__ */ o.createElement(m.Dates.Day, {
989
- className: g(me, Ce.day, p.day)
990
- }, (t) => /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("span", {
991
- className: p.weekdayLabel
992
- }, t.weekdayLabel), /* @__PURE__ */ o.createElement("span", {
993
- className: g(Ce.dayNumber, p.dayNumber)
994
- }, t.dayOfMonthLabel, /* @__PURE__ */ o.createElement("span", {
995
- className: p.indicator
996
- }))))), /* @__PURE__ */ o.createElement(m.Timezone, {
997
- className: g(We, p.hint)
998
- }), /* @__PURE__ */ o.createElement(m.Format, {
999
- className: g(We, p.hint)
1000
- }), /* @__PURE__ */ o.createElement(m.DateTitle, {
1001
- className: g(yt, p.dateTitle)
1002
- }), /* @__PURE__ */ o.createElement(m.Slots, {
1003
- className: g(It, p.slots)
1004
- }, /* @__PURE__ */ o.createElement(m.Slots.Slot, {
1005
- className: ({ isSelected: t, isHovered: n, isFocused: a, isDisabled: r, isReadOnly: s }) => e({
1006
- isSelected: t,
1007
- isHovered: (n || a) && !t && !r && !s
1008
- })
1009
- }, (t) => t.timeRange)), /* @__PURE__ */ o.createElement(m.Notification, {
1010
- className: g(Ot, p.notification)
1011
- }), /* @__PURE__ */ o.createElement(m.ShowMoreSlots, {
1012
- className: g(Lt, me, p.showMoreSlots)
1013
- }), /* @__PURE__ */ o.createElement(m.Error, {
1014
- className: g(Tt, ue.error)
1015
- }, /* @__PURE__ */ o.createElement(lt, null), /* @__PURE__ */ o.createElement(m.Error.Text, null)), /* @__PURE__ */ o.createElement(m.Description, {
1016
- className: g(bt, ue.description)
1017
- }, Gn));
1018
- }, da = () => /* @__PURE__ */ o.createElement(Vn, null);
1019
- export {
1020
- da as AppointmentRAC
1021
- };