@alfadocs/ui-kit 0.25.2 → 0.30.1

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 (86) hide show
  1. package/dist/_chunks/booking-Bw9eOU4k.js +2292 -0
  2. package/dist/_chunks/{calendar-9eOXumpH.js → calendar-WWNx448i.js} +10 -9
  3. package/dist/_chunks/{contact-card-CeEfEAxh.js → contact-card-DYbp--s-.js} +2 -2
  4. package/dist/_chunks/{header-B8V_sNPy.js → header-CkMb1TZS.js} +23 -23
  5. package/dist/_chunks/heart-pulse-CvuyFKHB.js +21 -0
  6. package/dist/_chunks/{link-DmM5IevO.js → link-DrD_cRUg.js} +50 -45
  7. package/dist/_chunks/parseISO-Dk4xa7q6.js +120 -0
  8. package/dist/_chunks/patient-search-DuSoGG2t.js +1113 -0
  9. package/dist/_chunks/{patient-shell-Bq8CjRYF.js → patient-shell-CAXYzbRw.js} +2 -2
  10. package/dist/_chunks/public-footer.agent-DivkKdG4.js +537 -0
  11. package/dist/_chunks/reviews-panel-CFttsfuC.js +513 -0
  12. package/dist/_chunks/slot-grid-B2zprPcv.js +387 -0
  13. package/dist/_chunks/stethoscope-DT5qCW8Y.js +18 -0
  14. package/dist/agent-catalog.json +117 -22
  15. package/dist/components/booking/booking-types.d.ts +167 -0
  16. package/dist/components/booking/booking.agent.d.ts +1 -1
  17. package/dist/components/booking/booking.d.ts +4 -89
  18. package/dist/components/booking/cascade.d.ts +96 -0
  19. package/dist/components/booking/details-form.d.ts +39 -0
  20. package/dist/components/booking/index.d.ts +2 -1
  21. package/dist/components/booking/index.js +5 -3
  22. package/dist/components/calendar/index.js +1 -1
  23. package/dist/components/checkbox/checkbox.d.ts +6 -2
  24. package/dist/components/contact-card/index.js +1 -1
  25. package/dist/components/header/index.js +1 -1
  26. package/dist/components/index.d.ts +3 -0
  27. package/dist/components/link/index.js +1 -1
  28. package/dist/components/link/link.d.ts +7 -0
  29. package/dist/components/patient-search/index.d.ts +4 -0
  30. package/dist/components/patient-search/index.js +6 -0
  31. package/dist/components/patient-search/patient-search.agent.d.ts +4 -0
  32. package/dist/components/patient-search/patient-search.d.ts +112 -0
  33. package/dist/components/public-footer/index.d.ts +6 -0
  34. package/dist/components/public-footer/index.js +10 -0
  35. package/dist/components/public-footer/legal-urls.d.ts +18 -0
  36. package/dist/components/public-footer/public-footer.agent.d.ts +4 -0
  37. package/dist/components/public-footer/public-footer.d.ts +58 -0
  38. package/dist/components/public-footer/socials.d.ts +9 -0
  39. package/dist/components/reviews-panel/index.d.ts +4 -0
  40. package/dist/components/reviews-panel/index.js +6 -0
  41. package/dist/components/reviews-panel/reviews-panel.agent.d.ts +4 -0
  42. package/dist/components/reviews-panel/reviews-panel.d.ts +76 -0
  43. package/dist/components/slot-grid/index.js +1 -1
  44. package/dist/i18n/config.js +3994 -38
  45. package/dist/i18n/locales/ar.d.ts +221 -0
  46. package/dist/i18n/locales/de.d.ts +221 -0
  47. package/dist/i18n/locales/el.d.ts +221 -0
  48. package/dist/i18n/locales/es.d.ts +221 -0
  49. package/dist/i18n/locales/fr.d.ts +221 -0
  50. package/dist/i18n/locales/hi.d.ts +221 -0
  51. package/dist/i18n/locales/ja.d.ts +221 -0
  52. package/dist/i18n/locales/nl.d.ts +221 -0
  53. package/dist/i18n/locales/pl.d.ts +221 -0
  54. package/dist/i18n/locales/pt.d.ts +221 -0
  55. package/dist/i18n/locales/ro.d.ts +221 -0
  56. package/dist/i18n/locales/ru.d.ts +221 -0
  57. package/dist/i18n/locales/sq.d.ts +221 -0
  58. package/dist/i18n/locales/sv.d.ts +221 -0
  59. package/dist/i18n/locales/tr.d.ts +221 -0
  60. package/dist/i18n/locales/zh.d.ts +221 -0
  61. package/dist/i18n/resources.d.ts +442 -0
  62. package/dist/index.js +351 -336
  63. package/dist/locales/ar.json +222 -1
  64. package/dist/locales/de.json +222 -1
  65. package/dist/locales/el.json +222 -1
  66. package/dist/locales/en.json +222 -1
  67. package/dist/locales/es.json +222 -1
  68. package/dist/locales/fr.json +222 -1
  69. package/dist/locales/hi.json +222 -1
  70. package/dist/locales/it.json +222 -1
  71. package/dist/locales/ja.json +222 -1
  72. package/dist/locales/nl.json +222 -1
  73. package/dist/locales/pl.json +222 -1
  74. package/dist/locales/pt.json +222 -1
  75. package/dist/locales/ro.json +222 -1
  76. package/dist/locales/ru.json +222 -1
  77. package/dist/locales/sq.json +222 -1
  78. package/dist/locales/sv.json +222 -1
  79. package/dist/locales/tr.json +222 -1
  80. package/dist/locales/zh.json +222 -1
  81. package/dist/patterns/patient-shell/index.js +1 -1
  82. package/dist/tokens.css +1 -1
  83. package/package.json +17 -1
  84. package/dist/_chunks/booking-CXngC-1u.js +0 -1743
  85. package/dist/_chunks/slot-grid-DoodeQGZ.js +0 -502
  86. package/dist/_chunks/stethoscope-B8kpbtjh.js +0 -35
@@ -1,1743 +0,0 @@
1
- import { jsxs as h, jsx as t } from "react/jsx-runtime";
2
- import { forwardRef as ke, useState as z, useMemo as S, useRef as _, useImperativeHandle as xe, useEffect as H, useCallback as j, useId as we } from "react";
3
- import { c as J } from "./index-D2ZczOXr.js";
4
- import { useTranslation as $ } from "react-i18next";
5
- import { u as Se } from "./registry-C9nwlNyL.js";
6
- import { B as T } from "./button-DD_0Xdmr.js";
7
- import { I as ae } from "./icon-button-BRHSSFmZ.js";
8
- import { T as Ne } from "./text-input-CakysYnD.js";
9
- import { a as re, S as oe } from "./suggestion-chip-C4kxWUIs.js";
10
- import { S as ee } from "./select-C92AT_OZ.js";
11
- import { A as Ie } from "./autocomplete-CUh0f7Dj.js";
12
- import { D as Me } from "./date-range-picker-DYgHzMOo.js";
13
- import { S as Q, p as L } from "./slot-grid-DoodeQGZ.js";
14
- import { S as De } from "./stepper-accordion-BfS6lUB9.js";
15
- import { S as Ae } from "./stepper-progress-jFY8BSf7.js";
16
- import { E as W } from "./empty-state-BLy7tigq.js";
17
- import { S as Z } from "./skeleton-CZbwyJAA.js";
18
- import { o as de, h as R, f as P, d as Ke, q as U } from "./react-day-picker-D3yzgvDB.js";
19
- import { S as ce } from "./search-BonnQsHv.js";
20
- import { c as C } from "./createLucideIcon-CrFbzy84.js";
21
- import { C as Le } from "./chevron-left-CX1jqD2M.js";
22
- import { C as Ce } from "./chevron-right-BrpYejk0.js";
23
- import { i as ie } from "./isSameDay-DHG8Xade.js";
24
- import { S as le } from "./sparkles-CuYXqQLg.js";
25
- import { M as _e, S as $e } from "./sun-BuXE0xUS.js";
26
- import { H as Be, S as Re } from "./stethoscope-B8kpbtjh.js";
27
- import { E as ze } from "./eye-LHlSU38h.js";
28
- /**
29
- * @license lucide-react v1.8.0 - ISC
30
- *
31
- * This source code is licensed under the ISC license.
32
- * See the LICENSE file in the root directory of this source tree.
33
- */
34
- const Te = [
35
- [
36
- "path",
37
- {
38
- d: "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",
39
- key: "169zse"
40
- }
41
- ]
42
- ], He = C("activity", Te);
43
- /**
44
- * @license lucide-react v1.8.0 - ISC
45
- *
46
- * This source code is licensed under the ISC license.
47
- * See the LICENSE file in the root directory of this source tree.
48
- */
49
- const qe = [
50
- ["path", { d: "M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5", key: "1u7htd" }],
51
- ["path", { d: "M15 12h.01", key: "1k8ypt" }],
52
- [
53
- "path",
54
- {
55
- d: "M19.38 6.813A9 9 0 0 1 20.8 10.2a2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5s-.9 2.5-2 2.5c-.8 0-1.5-.4-1.5-1",
56
- key: "11xh7x"
57
- }
58
- ],
59
- ["path", { d: "M9 12h.01", key: "157uk2" }]
60
- ], Fe = C("baby", qe);
61
- /**
62
- * @license lucide-react v1.8.0 - ISC
63
- *
64
- * This source code is licensed under the ISC license.
65
- * See the LICENSE file in the root directory of this source tree.
66
- */
67
- const Ve = [
68
- [
69
- "path",
70
- {
71
- d: "M17 10c.7-.7 1.69 0 2.5 0a2.5 2.5 0 1 0 0-5 .5.5 0 0 1-.5-.5 2.5 2.5 0 1 0-5 0c0 .81.7 1.8 0 2.5l-7 7c-.7.7-1.69 0-2.5 0a2.5 2.5 0 0 0 0 5c.28 0 .5.22.5.5a2.5 2.5 0 1 0 5 0c0-.81-.7-1.8 0-2.5Z",
72
- key: "w610uw"
73
- }
74
- ]
75
- ], Ee = C("bone", Ve);
76
- /**
77
- * @license lucide-react v1.8.0 - ISC
78
- *
79
- * This source code is licensed under the ISC license.
80
- * See the LICENSE file in the root directory of this source tree.
81
- */
82
- const Pe = [
83
- ["path", { d: "M12 18V5", key: "adv99a" }],
84
- ["path", { d: "M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4", key: "1e3is1" }],
85
- ["path", { d: "M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5", key: "1gqd8o" }],
86
- ["path", { d: "M17.997 5.125a4 4 0 0 1 2.526 5.77", key: "iwvgf7" }],
87
- ["path", { d: "M18 18a4 4 0 0 0 2-7.464", key: "efp6ie" }],
88
- ["path", { d: "M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517", key: "1gq6am" }],
89
- ["path", { d: "M6 18a4 4 0 0 1-2-7.464", key: "k1g0md" }],
90
- ["path", { d: "M6.003 5.125a4 4 0 0 0-2.526 5.77", key: "q97ue3" }]
91
- ], je = C("brain", Pe);
92
- /**
93
- * @license lucide-react v1.8.0 - ISC
94
- *
95
- * This source code is licensed under the ISC license.
96
- * See the LICENSE file in the root directory of this source tree.
97
- */
98
- const Oe = [
99
- ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
100
- ["path", { d: "M16 2v4", key: "4m81vk" }],
101
- ["path", { d: "M3 10h18", key: "8toen8" }],
102
- ["path", { d: "M8 2v4", key: "1cmpym" }],
103
- ["path", { d: "M17 14h-6", key: "bkmgh3" }],
104
- ["path", { d: "M13 18H7", key: "bb0bb7" }],
105
- ["path", { d: "M7 14h.01", key: "1qa3f1" }],
106
- ["path", { d: "M17 18h.01", key: "1bdyru" }]
107
- ], me = C("calendar-range", Oe);
108
- /**
109
- * @license lucide-react v1.8.0 - ISC
110
- *
111
- * This source code is licensed under the ISC license.
112
- * See the LICENSE file in the root directory of this source tree.
113
- */
114
- const Ge = [
115
- ["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
116
- [
117
- "path",
118
- {
119
- d: "M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",
120
- key: "116196"
121
- }
122
- ],
123
- ["path", { d: "m9 14 2 2 4-4", key: "df797q" }]
124
- ], Ue = C("clipboard-check", Ge);
125
- /**
126
- * @license lucide-react v1.8.0 - ISC
127
- *
128
- * This source code is licensed under the ISC license.
129
- * See the LICENSE file in the root directory of this source tree.
130
- */
131
- const Ze = [
132
- ["path", { d: "M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0", key: "1dfaln" }],
133
- ["path", { d: "M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4", key: "1qnva7" }]
134
- ], Je = C("ear", Ze);
135
- /**
136
- * @license lucide-react v1.8.0 - ISC
137
- *
138
- * This source code is licensed under the ISC license.
139
- * See the LICENSE file in the root directory of this source tree.
140
- */
141
- const Qe = [
142
- ["path", { d: "M6 18h8", key: "1borvv" }],
143
- ["path", { d: "M3 22h18", key: "8prr45" }],
144
- ["path", { d: "M14 22a7 7 0 1 0 0-14h-1", key: "1jwaiy" }],
145
- ["path", { d: "M9 14h2", key: "197e7h" }],
146
- ["path", { d: "M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z", key: "1bmzmy" }],
147
- ["path", { d: "M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3", key: "1drr47" }]
148
- ], We = C("microscope", Qe);
149
- /**
150
- * @license lucide-react v1.8.0 - ISC
151
- *
152
- * This source code is licensed under the ISC license.
153
- * See the LICENSE file in the root directory of this source tree.
154
- */
155
- const Ye = [
156
- [
157
- "path",
158
- { d: "m10.5 20.5 10-10a4.95 4.95 0 1 0-7-7l-10 10a4.95 4.95 0 1 0 7 7Z", key: "wa1lgi" }
159
- ],
160
- ["path", { d: "m8.5 8.5 7 7", key: "rvfmvr" }]
161
- ], Xe = C("pill", Ye);
162
- /**
163
- * @license lucide-react v1.8.0 - ISC
164
- *
165
- * This source code is licensed under the ISC license.
166
- * See the LICENSE file in the root directory of this source tree.
167
- */
168
- const et = [
169
- ["path", { d: "M3 7V5a2 2 0 0 1 2-2h2", key: "aa7l1z" }],
170
- ["path", { d: "M17 3h2a2 2 0 0 1 2 2v2", key: "4qcy5o" }],
171
- ["path", { d: "M21 17v2a2 2 0 0 1-2 2h-2", key: "6vwrx8" }],
172
- ["path", { d: "M7 21H5a2 2 0 0 1-2-2v-2", key: "ioqczr" }],
173
- ["path", { d: "M7 12h10", key: "b7w52i" }]
174
- ], tt = C("scan-line", et);
175
- /**
176
- * @license lucide-react v1.8.0 - ISC
177
- *
178
- * This source code is licensed under the ISC license.
179
- * See the LICENSE file in the root directory of this source tree.
180
- */
181
- const st = [
182
- ["circle", { cx: "6", cy: "6", r: "3", key: "1lh9wr" }],
183
- ["path", { d: "M8.12 8.12 12 12", key: "1alkpv" }],
184
- ["path", { d: "M20 4 8.12 15.88", key: "xgtan2" }],
185
- ["circle", { cx: "6", cy: "18", r: "3", key: "fqmcym" }],
186
- ["path", { d: "M14.8 14.8 20 20", key: "ptml3r" }]
187
- ], at = C("scissors", st);
188
- /**
189
- * @license lucide-react v1.8.0 - ISC
190
- *
191
- * This source code is licensed under the ISC license.
192
- * See the LICENSE file in the root directory of this source tree.
193
- */
194
- const it = [
195
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
196
- ["path", { d: "M8 14s1.5 2 4 2 4-2 4-2", key: "1y1vjs" }],
197
- ["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
198
- ["line", { x1: "15", x2: "15.01", y1: "9", y2: "9", key: "1p4y9e" }]
199
- ], nt = C("smile", it);
200
- /**
201
- * @license lucide-react v1.8.0 - ISC
202
- *
203
- * This source code is licensed under the ISC license.
204
- * See the LICENSE file in the root directory of this source tree.
205
- */
206
- const rt = [
207
- ["path", { d: "M12 10V2", key: "16sf7g" }],
208
- ["path", { d: "m4.93 10.93 1.41 1.41", key: "2a7f42" }],
209
- ["path", { d: "M2 18h2", key: "j10viu" }],
210
- ["path", { d: "M20 18h2", key: "wocana" }],
211
- ["path", { d: "m19.07 10.93-1.41 1.41", key: "15zs5n" }],
212
- ["path", { d: "M22 22H2", key: "19qnx5" }],
213
- ["path", { d: "m16 6-4 4-4-4", key: "6wukr" }],
214
- ["path", { d: "M16 18a4 4 0 0 0-8 0", key: "1lzouq" }]
215
- ], ot = C("sunset", rt);
216
- /**
217
- * @license lucide-react v1.8.0 - ISC
218
- *
219
- * This source code is licensed under the ISC license.
220
- * See the LICENSE file in the root directory of this source tree.
221
- */
222
- const dt = [
223
- ["path", { d: "m18 2 4 4", key: "22kx64" }],
224
- ["path", { d: "m17 7 3-3", key: "1w1zoj" }],
225
- ["path", { d: "M19 9 8.7 19.3c-1 1-2.5 1-3.4 0l-.6-.6c-1-1-1-2.5 0-3.4L15 5", key: "1exhtz" }],
226
- ["path", { d: "m9 11 4 4", key: "rovt3i" }],
227
- ["path", { d: "m5 19-3 3", key: "59f2uf" }],
228
- ["path", { d: "m14 4 6 6", key: "yqp9t2" }]
229
- ], ne = C("syringe", dt);
230
- function ct(o, c, l) {
231
- return de(o, -1, l);
232
- }
233
- const lt = {
234
- id: "booking",
235
- capabilities: ["navigate", "view_change"],
236
- state: {
237
- currentStep: {
238
- type: "number",
239
- descriptionKey: "ui.agent.booking.state.currentStep",
240
- description: "Zero-indexed active step within the active variant. Variants with no step machine report 0.",
241
- read: (o) => o.getCurrentStep()
242
- },
243
- totalSteps: {
244
- type: "number",
245
- descriptionKey: "ui.agent.booking.state.totalSteps",
246
- description: "Total number of steps in the active variant. Single-screen variants report 1.",
247
- read: (o) => o.getTotalSteps()
248
- },
249
- variant: {
250
- type: "string",
251
- descriptionKey: "ui.agent.booking.state.variant",
252
- description: "Active variant — one of `inline-list`, `accordion`, `calendar`, `flexible`, `progress`.",
253
- read: (o) => o.getVariant()
254
- }
255
- },
256
- actions: {
257
- goto_step: {
258
- safety: "read",
259
- argsType: "{ step: number }",
260
- descriptionKey: "ui.agent.booking.actions.gotoStep",
261
- description: "Jump to the given step within the active variant. Steps beyond first-incomplete are gated internally.",
262
- invoke: (o, c) => {
263
- o.gotoStep(c.step);
264
- }
265
- },
266
- next: {
267
- safety: "read",
268
- descriptionKey: "ui.agent.booking.actions.next",
269
- description: "Advance to the next step when the current step has a valid value.",
270
- invoke: (o) => {
271
- o.next();
272
- }
273
- },
274
- previous: {
275
- safety: "read",
276
- descriptionKey: "ui.agent.booking.actions.previous",
277
- description: "Return to the previous step.",
278
- invoke: (o) => {
279
- o.previous();
280
- }
281
- }
282
- },
283
- domHooks: {
284
- root: {
285
- attr: "data-component",
286
- value: "booking",
287
- description: "Marks the Booking root region."
288
- },
289
- instanceId: {
290
- attr: "data-component-id",
291
- sourceProp: "id",
292
- description: "Sourced from the id prop."
293
- }
294
- }
295
- }, mt = J(
296
- "ds:flex ds:w-full ds:flex-col ds:text-[var(--foreground)]",
297
- {
298
- variants: {
299
- variant: {
300
- "inline-list": "ds:gap-[var(--spacing-md)]",
301
- accordion: "ds:gap-[var(--spacing-md)]",
302
- calendar: "ds:gap-[var(--spacing-md)]",
303
- flexible: "ds:gap-[var(--spacing-lg)]",
304
- progress: "ds:gap-[var(--spacing-sm)]"
305
- }
306
- },
307
- defaultVariants: {
308
- variant: "inline-list"
309
- }
310
- }
311
- ), pe = [
312
- // Aesthetic medicine (filler / botox / mesotherapy) — needle imagery is
313
- // the cross-cultural shorthand. Comes before the dermatology rule so
314
- // "medicina estetica" doesn't get pulled into the skin family.
315
- [
316
- /\b(estetic|aesthetic|botox|filler|mesoterap|chirurgia\s*plastic)/i,
317
- ne
318
- ],
319
- [/\b(cardio|ecg|elettrocardio|ecocardio|cuore|heart)/i, Be],
320
- [/\b(dent|odonto|tooth|teeth|pulizia|igien|smile)/i, nt],
321
- [/\b(oftalmo|ocul|ophthal|vision|occhi|eye)/i, ze],
322
- [/\b(otorin|udito|orecchi|hearing|ear)/i, Je],
323
- [/\b(neuro|brain|cervello)/i, je],
324
- [/\b(pediatr|child|bambin)/i, Fe],
325
- [/\b(ortop|ortho|osteo|skeleton|ossa|bone)/i, Ee],
326
- [/\b(lab|analis|test|sang|esami)/i, We],
327
- [/\b(farmaco|pharm|pillol|refill)/i, Xe],
328
- [/\b(chirurg|surg|intervent|operat)/i, at],
329
- [/\b(scan|rx|x-?ray|raggi|imag|radio|risonan|ecograf|ultras)/i, tt],
330
- [/\b(vacc|inject|inie|punto)/i, ne],
331
- // Medical dermatology — separate from aesthetic, picked up later.
332
- [/\b(derma|skin|pelle)/i, le],
333
- [/\b(prima\s*visit|first\s*visit|consult|consulto|valutaz)/i, Ue],
334
- [/\b(general|medicin|family|control|check[-\s]?up)/i, He]
335
- ], pt = pe;
336
- function fe(o, c) {
337
- for (const [l, e] of c)
338
- if (l.test(o)) return e;
339
- return null;
340
- }
341
- function ft(o) {
342
- if (o.icon) return o.icon;
343
- const c = `${o.label} ${o.description ?? ""}`, l = fe(c, pe) ?? Re;
344
- return /* @__PURE__ */ t(l, { "aria-hidden": "true", className: "ds:size-5" });
345
- }
346
- function ge(o) {
347
- if (o.icon) return o.icon;
348
- const c = fe(o.label, pt) ?? le;
349
- return /* @__PURE__ */ t(
350
- c,
351
- {
352
- "aria-hidden": "true",
353
- className: "ds:size-3.5 ds:text-[color:var(--accent)]"
354
- }
355
- );
356
- }
357
- function q(o) {
358
- return R(o, "yyyy-MM-dd");
359
- }
360
- const gt = {
361
- "inline-list": 4,
362
- // service, date, time, details
363
- accordion: 3,
364
- // service, date+time, confirm
365
- calendar: 2,
366
- // service, confirm
367
- flexible: 2,
368
- // service+date-range, confirm
369
- progress: 3
370
- // service, date+time, confirm
371
- };
372
- function te(o, c) {
373
- switch (o) {
374
- case "inline-list":
375
- return c.serviceId ? c.date ? c.time ? 3 : 2 : 1 : 0;
376
- case "accordion":
377
- return c.serviceId ? !c.date || !c.time ? 1 : 2 : 0;
378
- case "calendar":
379
- return !c.serviceId || !c.date || !c.time ? 0 : 1;
380
- case "flexible":
381
- return c.serviceId ? 1 : 0;
382
- case "progress":
383
- return c.serviceId ? !c.date || !c.time ? 1 : 2 : 0;
384
- /* c8 ignore next */
385
- default:
386
- return 0;
387
- }
388
- }
389
- const ut = [
390
- "ds:relative ds:flex ds:items-center ds:justify-center",
391
- "ds:min-h-[var(--min-target-size)] ds:min-w-[var(--min-target-size)]",
392
- "ds:rounded-[var(--radius-sm)]",
393
- "ds:text-[length:var(--font-size-sm)]",
394
- "ds:transition-colors ds:duration-[var(--animation-duration)]",
395
- "ds:motion-reduce:transition-none",
396
- "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
397
- "ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
398
- "ds:forced-colors:focus-visible:outline-[CanvasText]"
399
- ].join(" "), ht = J(ut, {
400
- variants: {
401
- state: {
402
- available: "ds:cursor-pointer ds:text-[var(--foreground)] ds:hover:bg-[var(--muted)]/30",
403
- unavailable: "ds:cursor-not-allowed ds:text-[var(--muted-foreground)]/60",
404
- selected: "ds:bg-[var(--primary)] ds:text-[var(--primary-foreground)] ds:font-[var(--font-weight-semibold)]",
405
- outside: "ds:text-[var(--muted-foreground)]/40"
406
- }
407
- },
408
- defaultVariants: { state: "unavailable" }
409
- });
410
- function Y({
411
- availableDates: o,
412
- selectedDate: c,
413
- onSelectDate: l,
414
- locale: e,
415
- loading: n
416
- }) {
417
- const { t: g } = $(), v = S(() => c ? P(L(c)) : o.length > 0 ? P(L(o[0])) : P(/* @__PURE__ */ new Date()), [c, o]), [y, w] = z(v), [x, a] = z(null), d = S(() => {
418
- const r = P(y), s = Ke(y), i = r.getDay(), b = s.getDate(), K = [];
419
- for (let M = i; M > 0; M -= 1) {
420
- const D = new Date(r);
421
- D.setDate(r.getDate() - M), K.push(D);
422
- }
423
- for (let M = 0; M < b; M += 1) {
424
- const D = new Date(r);
425
- D.setDate(r.getDate() + M), K.push(D);
426
- }
427
- for (; K.length < 42; ) {
428
- const M = K[K.length - 1], D = new Date(M);
429
- D.setDate(M.getDate() + 1), K.push(D);
430
- }
431
- return K;
432
- }, [y]), u = S(() => {
433
- try {
434
- return new Intl.DateTimeFormat(e, {
435
- month: "long",
436
- year: "numeric"
437
- }).format(y);
438
- } catch {
439
- return R(y, "MMMM yyyy");
440
- }
441
- }, [y, e]), k = S(() => {
442
- const r = new Date(2024, 0, 7);
443
- return Array.from({ length: 7 }, (s, i) => {
444
- const b = new Date(r);
445
- b.setDate(r.getDate() + i);
446
- try {
447
- return new Intl.DateTimeFormat(e, { weekday: "short" }).format(b);
448
- } catch {
449
- return R(b, "EEE");
450
- }
451
- });
452
- }, [e]), m = S(() => new Set(o), [o]), p = j(
453
- (r) => m.has(q(r)),
454
- [m]
455
- ), N = S(() => {
456
- if (x) return x;
457
- if (c) return L(c);
458
- const r = d.find(
459
- (s) => U(s, y) && p(s)
460
- );
461
- return r || (d.find((s) => U(s, y)) ?? null);
462
- }, [x, c, d, y, p]), I = j(
463
- (r, s) => {
464
- let i = null;
465
- switch (r.key) {
466
- case "ArrowLeft":
467
- i = new Date(s), i.setDate(s.getDate() - 1);
468
- break;
469
- case "ArrowRight":
470
- i = new Date(s), i.setDate(s.getDate() + 1);
471
- break;
472
- case "ArrowUp":
473
- i = new Date(s), i.setDate(s.getDate() - 7);
474
- break;
475
- case "ArrowDown":
476
- i = new Date(s), i.setDate(s.getDate() + 7);
477
- break;
478
- case "Home":
479
- i = new Date(s), i.setDate(s.getDate() - s.getDay());
480
- break;
481
- case "End":
482
- i = new Date(s), i.setDate(s.getDate() + (6 - s.getDay()));
483
- break;
484
- case "Enter":
485
- case " ": {
486
- r.preventDefault(), p(s) && l(q(s));
487
- return;
488
- }
489
- default:
490
- return;
491
- }
492
- i && (r.preventDefault(), U(i, y) || w(P(i)), a(i));
493
- },
494
- [p, l, y]
495
- );
496
- return n ? /* @__PURE__ */ h(
497
- "div",
498
- {
499
- role: "status",
500
- "aria-live": "polite",
501
- "aria-label": g("common.loading"),
502
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
503
- children: [
504
- /* @__PURE__ */ t(Z, { variant: "text", width: "40%" }),
505
- /* @__PURE__ */ t("div", { className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]", children: Array.from({ length: 42 }, (r, s) => /* @__PURE__ */ t(Z, { variant: "rounded", height: "2.5rem" }, `mg-skel-${s}`)) })
506
- ]
507
- }
508
- ) : (
509
- // The accessible name lives on the inner `role="grid"` further down
510
- // (see line ~610 below). Don't add `role="group"` here — Note 14 from
511
- // the a11y review: the outer `group` is redundant with the inner
512
- // `grid` and adds noise to AT linearisation.
513
- /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
514
- /* @__PURE__ */ h("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
515
- /* @__PURE__ */ t(
516
- ae,
517
- {
518
- icon: /* @__PURE__ */ t(Le, {}),
519
- "aria-label": g("booking.previousMonth"),
520
- size: "sm",
521
- intent: "ghost",
522
- flipIconInRtl: !0,
523
- onClick: () => {
524
- w((r) => ct(r)), a(null);
525
- }
526
- }
527
- ),
528
- /* @__PURE__ */ t(
529
- "span",
530
- {
531
- className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]",
532
- "aria-live": "polite",
533
- children: u
534
- }
535
- ),
536
- /* @__PURE__ */ t(
537
- ae,
538
- {
539
- icon: /* @__PURE__ */ t(Ce, {}),
540
- "aria-label": g("booking.nextMonth"),
541
- size: "sm",
542
- intent: "ghost",
543
- flipIconInRtl: !0,
544
- onClick: () => {
545
- w((r) => de(r, 1)), a(null);
546
- }
547
- }
548
- )
549
- ] }),
550
- /* @__PURE__ */ h(
551
- "div",
552
- {
553
- role: "grid",
554
- "aria-label": g("booking.monthGridLabel"),
555
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
556
- children: [
557
- /* @__PURE__ */ t(
558
- "div",
559
- {
560
- role: "row",
561
- className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]",
562
- children: k.map((r, s) => /* @__PURE__ */ t(
563
- "div",
564
- {
565
- role: "columnheader",
566
- className: "type-meta ds:text-center ds:text-[var(--muted-foreground)] ds:font-[var(--font-weight-medium)]",
567
- children: r
568
- },
569
- `wd-${s}`
570
- ))
571
- }
572
- ),
573
- Array.from({ length: 6 }, (r, s) => /* @__PURE__ */ t(
574
- "div",
575
- {
576
- role: "row",
577
- className: "ds:grid ds:grid-cols-7 ds:gap-[var(--spacing-2xs)]",
578
- children: d.slice(s * 7, s * 7 + 7).map((i, b) => {
579
- const K = s * 7 + b, M = U(i, y), D = M && p(i), B = c ? ie(i, L(c)) : !1, f = M ? B ? "selected" : D ? "available" : "unavailable" : "outside", A = N ? ie(N, i) : !1, O = (() => {
580
- try {
581
- return new Intl.DateTimeFormat(e, {
582
- dateStyle: "full"
583
- }).format(i);
584
- } catch {
585
- return R(i, "PPP");
586
- }
587
- })();
588
- return /* @__PURE__ */ t(
589
- "button",
590
- {
591
- type: "button",
592
- role: "gridcell",
593
- "aria-label": O,
594
- "aria-selected": B || void 0,
595
- "aria-disabled": !D || void 0,
596
- tabIndex: A ? 0 : -1,
597
- disabled: !D,
598
- onClick: () => {
599
- D && l(q(i));
600
- },
601
- onKeyDown: (F) => I(F, i),
602
- className: ht({ state: f }),
603
- children: /* @__PURE__ */ t("span", { "aria-hidden": "true", children: i.getDate() })
604
- },
605
- `mg-cell-${K}`
606
- );
607
- })
608
- },
609
- `mg-row-${s}`
610
- ))
611
- ]
612
- }
613
- )
614
- ] })
615
- );
616
- }
617
- const bt = J(
618
- [
619
- "ds:relative ds:flex ds:w-full ds:items-center ds:gap-[var(--spacing-md)]",
620
- // Explicit floor — composition tends to give us enough vertical space
621
- // via the icon + label + meta stack, but a service card with a short
622
- // label and no description shouldn't dip below the 44/48 target size.
623
- "ds:min-h-[var(--min-target-size)]",
624
- "ds:rounded-[var(--radius-md)] ds:border",
625
- "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
626
- "ds:pt-[var(--spacing-sm)] ds:pb-[var(--spacing-sm)]",
627
- "ds:text-start",
628
- "ds:transition-[background-color,border-color]",
629
- "ds:duration-[var(--animation-duration)]",
630
- "ds:motion-reduce:transition-none",
631
- "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
632
- "ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
633
- "ds:forced-colors:focus-visible:outline-[CanvasText]",
634
- "ds:cursor-pointer"
635
- ].join(" "),
636
- {
637
- variants: {
638
- state: {
639
- idle: "ds:border-[var(--border)] ds:bg-[var(--card)] ds:hover:border-[var(--primary)]/40",
640
- selected: "ds:border-[var(--primary)] ds:bg-[var(--primary)]/5 ds:shadow-[var(--shadow-sm)]"
641
- }
642
- },
643
- defaultVariants: { state: "idle" }
644
- }
645
- );
646
- function yt({
647
- services: o,
648
- selectedServiceId: c,
649
- onSelectService: l
650
- }) {
651
- const { t: e } = $(), n = we(), [g, v] = z(() => {
652
- if (c) {
653
- const a = o.findIndex((d) => d.id === c);
654
- if (a >= 0) return a;
655
- }
656
- return 0;
657
- }), y = _(/* @__PURE__ */ new Map()), w = j((a) => {
658
- const d = y.current.get(a);
659
- d && d.focus();
660
- }, []), x = j(
661
- (a, d, u) => {
662
- const k = o.length;
663
- if (k !== 0)
664
- switch (a.key) {
665
- case "ArrowDown":
666
- case "ArrowRight": {
667
- a.preventDefault();
668
- const m = (d + 1) % k;
669
- v(m), w(m);
670
- break;
671
- }
672
- case "ArrowUp":
673
- case "ArrowLeft": {
674
- a.preventDefault();
675
- const m = (d - 1 + k) % k;
676
- v(m), w(m);
677
- break;
678
- }
679
- case "Home": {
680
- a.preventDefault(), v(0), w(0);
681
- break;
682
- }
683
- case "End": {
684
- a.preventDefault();
685
- const m = k - 1;
686
- v(m), w(m);
687
- break;
688
- }
689
- case "Enter":
690
- case " ": {
691
- a.preventDefault(), l(u);
692
- break;
693
- }
694
- }
695
- },
696
- [o.length, w, l]
697
- );
698
- return o.length === 0 ? /* @__PURE__ */ t(
699
- W,
700
- {
701
- variant: "no-results",
702
- title: e("emptyState.noResults.title"),
703
- description: e("emptyState.noResults.description")
704
- }
705
- ) : /* @__PURE__ */ t(
706
- "div",
707
- {
708
- role: "radiogroup",
709
- "aria-label": e("booking.serviceListLabel"),
710
- id: n,
711
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
712
- children: o.map((a, d) => {
713
- const u = c === a.id, m = g === d ? 0 : -1, p = e("booking.serviceCardLabel", {
714
- label: a.label,
715
- duration: a.durationMin
716
- }), N = ft(a);
717
- return /* @__PURE__ */ h(
718
- "button",
719
- {
720
- ref: (I) => {
721
- I ? y.current.set(d, I) : y.current.delete(d);
722
- },
723
- type: "button",
724
- role: "radio",
725
- "aria-checked": u,
726
- "aria-label": p,
727
- tabIndex: m,
728
- onClick: () => l(a.id),
729
- onFocus: () => v(d),
730
- onKeyDown: (I) => x(I, d, a.id),
731
- className: bt({
732
- state: u ? "selected" : "idle"
733
- }),
734
- children: [
735
- /* @__PURE__ */ t(
736
- "span",
737
- {
738
- "aria-hidden": "true",
739
- className: "ds:flex ds:size-10 ds:shrink-0 ds:items-center ds:justify-center ds:rounded-[var(--radius-sm)] ds:bg-[var(--primary)]/10 ds:text-[var(--primary)]",
740
- children: N
741
- }
742
- ),
743
- /* @__PURE__ */ h("span", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
744
- /* @__PURE__ */ h("span", { className: "ds:flex ds:flex-wrap ds:items-baseline ds:gap-[var(--spacing-sm)]", children: [
745
- /* @__PURE__ */ t("span", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]", children: a.label }),
746
- /* @__PURE__ */ t("span", { className: "type-meta ds:text-[var(--muted-foreground)]", children: e("booking.serviceSummary", {
747
- minutes: a.durationMin
748
- }) })
749
- ] }),
750
- a.description ? /* @__PURE__ */ t("span", { className: "type-body-sm ds:text-[var(--muted-foreground)]", children: a.description }) : null
751
- ] }),
752
- /* @__PURE__ */ h("span", { className: "ds:flex ds:shrink-0 ds:flex-col ds:items-end ds:gap-[var(--spacing-2xs)]", children: [
753
- a.price ? /* @__PURE__ */ t("span", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]", children: a.price }) : null,
754
- a.paymentHint ? /* @__PURE__ */ t("span", { className: "type-meta ds:text-[var(--muted-foreground)]", children: a.paymentHint }) : null
755
- ] })
756
- ]
757
- },
758
- a.id
759
- );
760
- })
761
- }
762
- );
763
- }
764
- function X(o, c) {
765
- const l = L(o);
766
- return {
767
- date: l,
768
- slots: c.map((e) => {
769
- const [n, g] = e.time.split(":").map((y) => parseInt(y, 10)), v = new Date(l);
770
- return v.setHours(n ?? 0, g ?? 0, 0, 0), {
771
- id: e.key,
772
- start: v,
773
- available: e.available,
774
- label: e.time
775
- };
776
- })
777
- };
778
- }
779
- const vt = J(
780
- [
781
- "ds:inline-flex ds:items-center ds:justify-center ds:gap-[var(--spacing-2xs)]",
782
- "ds:min-h-[var(--min-target-size)]",
783
- "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
784
- "ds:pt-[var(--spacing-2xs)] ds:pb-[var(--spacing-2xs)]",
785
- "ds:rounded-[var(--radius-md)] ds:border",
786
- "ds:text-[length:var(--font-size-sm)] ds:font-[var(--font-weight-medium)]",
787
- "ds:transition-colors ds:duration-[var(--animation-duration)]",
788
- "ds:motion-reduce:transition-none",
789
- "ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid",
790
- "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
791
- "ds:disabled:cursor-not-allowed ds:disabled:opacity-50",
792
- "ds:forced-colors:border-[ButtonText] ds:forced-colors:text-[ButtonText]"
793
- ].join(" "),
794
- {
795
- variants: {
796
- state: {
797
- idle: "ds:border-[color:var(--border)] ds:bg-[color:var(--background)] ds:text-[color:var(--foreground)] ds:hover:enabled:bg-[color:var(--muted)]/40",
798
- selected: "ds:border-[color:var(--primary)] ds:bg-[color:var(--primary)] ds:text-[color:var(--primary-foreground)]",
799
- unavailable: "ds:border-dashed ds:border-[color:var(--border)] ds:bg-transparent ds:text-[color:var(--muted-foreground)]"
800
- }
801
- },
802
- defaultVariants: { state: "idle" }
803
- }
804
- );
805
- function kt(o) {
806
- const [c] = o.split(":").map((e) => parseInt(e, 10)), l = Number.isFinite(c) ? c : 0;
807
- return l < 12 ? "morning" : l < 17 ? "afternoon" : "evening";
808
- }
809
- const xt = {
810
- morning: $e,
811
- afternoon: ot,
812
- evening: _e
813
- };
814
- function wt({
815
- date: o,
816
- slots: c,
817
- selectedSlotKey: l,
818
- onSelect: e,
819
- loading: n,
820
- locale: g
821
- }) {
822
- const { t: v } = $(), y = S(() => {
823
- try {
824
- return new Intl.DateTimeFormat(g, {
825
- weekday: "long",
826
- day: "numeric",
827
- month: "long"
828
- }).format(L(o));
829
- } catch {
830
- return o;
831
- }
832
- }, [o, g]), w = S(() => {
833
- const d = {
834
- morning: [],
835
- afternoon: [],
836
- evening: []
837
- };
838
- for (const u of c)
839
- d[kt(u.time)].push(u);
840
- return d;
841
- }, [c]), x = c.filter((d) => d.available).length, a = ["morning", "afternoon", "evening"];
842
- return n ? /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
843
- /* @__PURE__ */ t(Z, { variant: "text", width: "60%" }),
844
- [0, 1].map((d) => /* @__PURE__ */ t(
845
- "div",
846
- {
847
- className: "ds:grid ds:grid-cols-3 ds:gap-[var(--spacing-xs)]",
848
- children: [0, 1, 2].map((u) => /* @__PURE__ */ t(Z, { variant: "rounded", height: "44px" }, u))
849
- },
850
- d
851
- ))
852
- ] }) : x === 0 ? /* @__PURE__ */ t(W, { variant: "no-results", title: v("booking.noSlotsForDate") }) : /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
853
- /* @__PURE__ */ h("div", { className: "ds:flex ds:items-baseline ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
854
- /* @__PURE__ */ h("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
855
- /* @__PURE__ */ t(
856
- me,
857
- {
858
- "aria-hidden": "true",
859
- className: "ds:size-4 ds:text-[color:var(--accent)]"
860
- }
861
- ),
862
- /* @__PURE__ */ t("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: y })
863
- ] }),
864
- /* @__PURE__ */ t("span", { className: "type-meta ds:text-[var(--muted-foreground)]", children: v("booking.slotsAvailable", { count: x }) })
865
- ] }),
866
- a.map((d) => {
867
- const u = w[d];
868
- if (u.length === 0) return null;
869
- const k = xt[d];
870
- return /* @__PURE__ */ h(
871
- "div",
872
- {
873
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
874
- children: [
875
- /* @__PURE__ */ h("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-[color:var(--muted-foreground)]", children: [
876
- /* @__PURE__ */ t(k, { "aria-hidden": "true", className: "ds:size-3.5" }),
877
- /* @__PURE__ */ t("span", { className: "type-meta ds:font-[var(--font-weight-semibold)] ds:uppercase", children: v(`booking.timeOfDay.${d}`) })
878
- ] }),
879
- /* @__PURE__ */ t(
880
- "div",
881
- {
882
- role: "group",
883
- "aria-label": v(`booking.timeOfDay.${d}`),
884
- className: "ds:grid ds:grid-cols-3 ds:gap-[var(--spacing-xs)] ds:sm:grid-cols-4",
885
- children: u.map((m) => {
886
- const p = m.key === l, N = m.available ? p ? "selected" : "idle" : "unavailable";
887
- return /* @__PURE__ */ t(
888
- "button",
889
- {
890
- type: "button",
891
- "data-slot-id": m.key,
892
- disabled: !m.available,
893
- "aria-pressed": p,
894
- "aria-label": m.unavailableReason && !m.available ? `${m.time} — ${m.unavailableReason}` : v("booking.slotAvailableLabel", { time: m.time }),
895
- onClick: () => m.available && e(m),
896
- className: vt({ state: N }),
897
- children: m.time
898
- },
899
- m.key
900
- );
901
- })
902
- }
903
- )
904
- ]
905
- },
906
- d
907
- );
908
- })
909
- ] });
910
- }
911
- function St({
912
- services: o,
913
- specialties: c,
914
- availableDates: l,
915
- availableSlots: e,
916
- value: n,
917
- onChange: g,
918
- onSubmit: v,
919
- detailsSlot: y,
920
- loadingDates: w,
921
- loadingSlots: x,
922
- locale: a
923
- }) {
924
- const { t: d } = $(), [u, k] = z(""), m = _(null), p = _(null), N = _(!!n.serviceId), I = _(!!n.date);
925
- H(() => {
926
- const f = !!n.serviceId;
927
- !N.current && f && requestAnimationFrame(() => {
928
- var A;
929
- return (A = m.current) == null ? void 0 : A.focus();
930
- }), N.current = f;
931
- }, [n.serviceId]), H(() => {
932
- const f = !!n.date;
933
- !I.current && f && requestAnimationFrame(() => {
934
- var A;
935
- return (A = p.current) == null ? void 0 : A.focus();
936
- }), I.current = f;
937
- }, [n.date]);
938
- const r = S(() => {
939
- const f = u.trim().toLowerCase();
940
- return o.filter((A) => n.specialtyId && A.specialtyId && A.specialtyId !== n.specialtyId ? !1 : f ? `${A.label} ${A.description ?? ""}`.toLowerCase().includes(f) : !0);
941
- }, [o, u, n.specialtyId]), s = S(
942
- () => o.find((f) => f.id === n.serviceId),
943
- [o, n.serviceId]
944
- ), i = S(() => {
945
- if (!n.date) return null;
946
- const f = e[n.date] ?? [];
947
- return [X(n.date, f)];
948
- }, [n.date, e]), b = (f) => {
949
- g({
950
- ...n,
951
- specialtyId: n.specialtyId === f ? void 0 : f,
952
- // Clear downstream selections when filter changes.
953
- serviceId: void 0,
954
- date: void 0,
955
- time: void 0,
956
- slotKey: void 0
957
- });
958
- }, K = (f) => {
959
- g({
960
- ...n,
961
- serviceId: f,
962
- // Clear downstream selections when service changes.
963
- date: void 0,
964
- time: void 0,
965
- slotKey: void 0
966
- });
967
- }, M = (f) => {
968
- g({
969
- ...n,
970
- date: f,
971
- time: void 0,
972
- slotKey: void 0
973
- });
974
- }, D = (f) => {
975
- g({
976
- ...n,
977
- slotKey: f.id,
978
- time: typeof f.label == "string" ? f.label : R(
979
- f.start instanceof Date ? f.start : L(f.start),
980
- "HH:mm"
981
- )
982
- });
983
- }, B = !!n.serviceId && !!n.date && !!n.slotKey;
984
- return /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
985
- /* @__PURE__ */ t(
986
- Ne,
987
- {
988
- placeholder: d("booking.searchPlaceholder"),
989
- "aria-label": d("booking.searchLabel"),
990
- value: u,
991
- onChange: (f) => k(f.target.value),
992
- startAdornment: /* @__PURE__ */ t(ce, { "aria-hidden": "true", className: "ds:size-4" })
993
- }
994
- ),
995
- c.length > 0 ? /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
996
- /* @__PURE__ */ t("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: d("booking.browseBySpecialty") }),
997
- /* @__PURE__ */ t(re, { label: d("booking.browseBySpecialty"), children: c.map((f) => /* @__PURE__ */ t(
998
- oe,
999
- {
1000
- value: f.id,
1001
- keepOnSelect: !0,
1002
- intent: n.specialtyId === f.id ? "suggestion" : "default",
1003
- "aria-pressed": n.specialtyId === f.id || void 0,
1004
- startIcon: ge(f),
1005
- onSelect: () => b(f.id),
1006
- children: f.label
1007
- },
1008
- f.id
1009
- )) })
1010
- ] }) : null,
1011
- /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1012
- /* @__PURE__ */ t("h3", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0", children: d("booking.pickService") }),
1013
- /* @__PURE__ */ t(
1014
- yt,
1015
- {
1016
- services: r,
1017
- selectedServiceId: n.serviceId,
1018
- onSelectService: K
1019
- }
1020
- )
1021
- ] }),
1022
- s ? /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1023
- /* @__PURE__ */ t(
1024
- "h3",
1025
- {
1026
- ref: m,
1027
- tabIndex: -1,
1028
- className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0 ds:focus:outline-none",
1029
- children: d("booking.pickDate")
1030
- }
1031
- ),
1032
- l.length === 0 && !w ? /* @__PURE__ */ t(
1033
- W,
1034
- {
1035
- variant: "no-results",
1036
- title: d("booking.noAvailability")
1037
- }
1038
- ) : /* @__PURE__ */ t(
1039
- Y,
1040
- {
1041
- availableDates: l,
1042
- selectedDate: n.date,
1043
- onSelectDate: M,
1044
- locale: a,
1045
- loading: w
1046
- }
1047
- )
1048
- ] }) : null,
1049
- s && n.date && i ? /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
1050
- /* @__PURE__ */ t(
1051
- "h3",
1052
- {
1053
- ref: p,
1054
- tabIndex: -1,
1055
- className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)] ds:m-0 ds:focus:outline-none",
1056
- children: d("booking.pickTime")
1057
- }
1058
- ),
1059
- /* @__PURE__ */ t(
1060
- Q,
1061
- {
1062
- days: i,
1063
- state: x ? "loading" : "default",
1064
- selectedSlotId: n.slotKey,
1065
- onSlotSelect: D,
1066
- locale: a
1067
- }
1068
- )
1069
- ] }) : null,
1070
- s && n.slotKey ? /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1071
- y,
1072
- /* @__PURE__ */ t(
1073
- T,
1074
- {
1075
- intent: "primary",
1076
- size: "md",
1077
- disabled: !B,
1078
- onClick: () => v == null ? void 0 : v(n),
1079
- children: d("booking.actions.confirm")
1080
- }
1081
- )
1082
- ] }) : null
1083
- ] });
1084
- }
1085
- function Nt({
1086
- services: o,
1087
- availableDates: c,
1088
- availableSlots: l,
1089
- value: e,
1090
- onChange: n,
1091
- onSubmit: g,
1092
- detailsSlot: v,
1093
- loadingDates: y,
1094
- loadingSlots: w,
1095
- locale: x
1096
- }) {
1097
- const { t: a } = $(), d = S(
1098
- () => te("accordion", e),
1099
- [e]
1100
- ), [u, k] = z(d);
1101
- H(() => {
1102
- k((s) => Math.max(s, d));
1103
- }, [d]);
1104
- const m = S(
1105
- () => o.map((s) => ({
1106
- value: s.id,
1107
- label: `${s.label} · ${a("booking.serviceSummary", {
1108
- minutes: s.durationMin
1109
- })}`
1110
- })),
1111
- [o, a]
1112
- ), p = o.find((s) => s.id === e.serviceId), N = S(() => {
1113
- if (!e.date) return null;
1114
- const s = l[e.date] ?? [];
1115
- return [X(e.date, s)];
1116
- }, [e.date, l]), I = S(() => {
1117
- if (!(!e.date || !e.time))
1118
- try {
1119
- const s = new Intl.DateTimeFormat(x, {
1120
- dateStyle: "long"
1121
- }).format(L(e.date));
1122
- return a("booking.dateTimeSummary", {
1123
- date: s,
1124
- time: e.time
1125
- });
1126
- } catch {
1127
- return `${e.date} ${e.time}`;
1128
- }
1129
- }, [e.date, e.time, x, a]), r = [
1130
- {
1131
- label: a("booking.pickServiceLabel"),
1132
- summary: p == null ? void 0 : p.label,
1133
- status: e.serviceId ? "completed" : void 0,
1134
- content: /* @__PURE__ */ t("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: /* @__PURE__ */ t(
1135
- ee,
1136
- {
1137
- options: m,
1138
- value: e.serviceId ?? "",
1139
- onValueChange: (s) => n({
1140
- ...e,
1141
- serviceId: s || void 0,
1142
- date: void 0,
1143
- time: void 0,
1144
- slotKey: void 0
1145
- }),
1146
- "aria-label": a("booking.pickServiceLabel"),
1147
- placeholder: a("booking.pickServiceLabel")
1148
- }
1149
- ) })
1150
- },
1151
- {
1152
- label: a("booking.pickDateLabel"),
1153
- summary: I,
1154
- status: e.date && e.time ? "completed" : void 0,
1155
- content: /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:md:flex-row", children: [
1156
- /* @__PURE__ */ t("div", { className: "ds:flex-1 ds:min-w-0", children: /* @__PURE__ */ t(
1157
- Y,
1158
- {
1159
- availableDates: c,
1160
- selectedDate: e.date,
1161
- onSelectDate: (s) => n({
1162
- ...e,
1163
- date: s,
1164
- time: void 0,
1165
- slotKey: void 0
1166
- }),
1167
- locale: x,
1168
- loading: y
1169
- }
1170
- ) }),
1171
- /* @__PURE__ */ t("div", { className: "ds:flex-1 ds:min-w-0", children: e.date && N ? /* @__PURE__ */ t(
1172
- Q,
1173
- {
1174
- days: N,
1175
- state: w ? "loading" : "default",
1176
- selectedSlotId: e.slotKey,
1177
- onSlotSelect: (s) => n({
1178
- ...e,
1179
- slotKey: s.id,
1180
- time: typeof s.label == "string" ? s.label : R(
1181
- s.start instanceof Date ? s.start : L(s.start),
1182
- "HH:mm"
1183
- )
1184
- }),
1185
- locale: x
1186
- }
1187
- ) : /* @__PURE__ */ t("p", { className: "type-body-sm ds:text-[var(--muted-foreground)]", children: a("booking.pickDate") }) })
1188
- ] })
1189
- },
1190
- {
1191
- label: a("booking.confirmStep"),
1192
- content: /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1193
- v ?? /* @__PURE__ */ h("p", { className: "type-body-sm ds:text-[var(--muted-foreground)]", children: [
1194
- p == null ? void 0 : p.label,
1195
- I ? ` — ${I}` : ""
1196
- ] }),
1197
- /* @__PURE__ */ t(
1198
- T,
1199
- {
1200
- intent: "primary",
1201
- size: "md",
1202
- disabled: !e.serviceId || !e.slotKey,
1203
- onClick: () => g == null ? void 0 : g(e),
1204
- children: a("booking.actions.confirm")
1205
- }
1206
- )
1207
- ] })
1208
- }
1209
- ];
1210
- return /* @__PURE__ */ t(
1211
- De,
1212
- {
1213
- activeStep: u,
1214
- steps: r,
1215
- onStepChange: k
1216
- }
1217
- );
1218
- }
1219
- function It({
1220
- services: o,
1221
- availableDates: c,
1222
- availableSlots: l,
1223
- value: e,
1224
- onChange: n,
1225
- onSubmit: g,
1226
- detailsSlot: v,
1227
- loadingDates: y,
1228
- loadingSlots: w,
1229
- locale: x
1230
- }) {
1231
- const { t: a } = $(), d = S(
1232
- () => o.map((p) => ({
1233
- value: p.id,
1234
- label: `${p.label} · ${a("booking.serviceSummary", {
1235
- minutes: p.durationMin
1236
- })}`
1237
- })),
1238
- [o, a]
1239
- ), u = S(() => e.date ? l[e.date] ?? [] : [], [e.date, l]), k = _(null), m = _(!!e.date);
1240
- return H(() => {
1241
- const p = !!e.date;
1242
- !m.current && p && requestAnimationFrame(() => {
1243
- var I;
1244
- const N = (I = k.current) == null ? void 0 : I.querySelector(
1245
- 'button:not([disabled]), h4, [tabindex="0"]'
1246
- );
1247
- N == null || N.focus();
1248
- }), m.current = p;
1249
- }, [e.date]), /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1250
- /* @__PURE__ */ t(
1251
- ee,
1252
- {
1253
- options: d,
1254
- value: e.serviceId ?? "",
1255
- onValueChange: (p) => n({
1256
- ...e,
1257
- serviceId: p || void 0,
1258
- date: void 0,
1259
- time: void 0,
1260
- slotKey: void 0
1261
- }),
1262
- "aria-label": a("booking.pickServiceLabel"),
1263
- placeholder: a("booking.pickServiceLabel")
1264
- }
1265
- ),
1266
- /* @__PURE__ */ h("div", { className: "ds:grid ds:grid-cols-1 ds:gap-[var(--spacing-md)] ds:md:grid-cols-2", children: [
1267
- /* @__PURE__ */ t("div", { className: "ds:min-w-0", children: c.length === 0 && !y ? /* @__PURE__ */ t(
1268
- W,
1269
- {
1270
- variant: "no-results",
1271
- title: a("booking.noAvailability")
1272
- }
1273
- ) : /* @__PURE__ */ t(
1274
- Y,
1275
- {
1276
- availableDates: c,
1277
- selectedDate: e.date,
1278
- onSelectDate: (p) => n({
1279
- ...e,
1280
- date: p,
1281
- time: void 0,
1282
- slotKey: void 0
1283
- }),
1284
- locale: x,
1285
- loading: y
1286
- }
1287
- ) }),
1288
- /* @__PURE__ */ t("div", { ref: k, className: "ds:min-w-0", children: e.date ? /* @__PURE__ */ t(
1289
- wt,
1290
- {
1291
- date: e.date,
1292
- slots: u,
1293
- selectedSlotKey: e.slotKey,
1294
- loading: w,
1295
- locale: x,
1296
- onSelect: (p) => n({
1297
- ...e,
1298
- slotKey: p.key,
1299
- time: p.time
1300
- })
1301
- }
1302
- ) : /* @__PURE__ */ h("div", { className: "ds:flex ds:h-full ds:flex-col ds:items-center ds:justify-center ds:gap-[var(--spacing-xs)] ds:rounded-[var(--radius-md)] ds:border ds:border-dashed ds:border-[color:var(--border)] ds:p-[var(--spacing-md)] ds:text-center", children: [
1303
- /* @__PURE__ */ t(
1304
- me,
1305
- {
1306
- "aria-hidden": "true",
1307
- className: "ds:size-5 ds:text-[color:var(--accent)]"
1308
- }
1309
- ),
1310
- /* @__PURE__ */ t("p", { className: "type-body-sm ds:text-[var(--muted-foreground)] ds:m-0", children: a("booking.pickDate") })
1311
- ] }) })
1312
- ] }),
1313
- e.slotKey ? /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1314
- v,
1315
- /* @__PURE__ */ t(
1316
- T,
1317
- {
1318
- intent: "primary",
1319
- size: "md",
1320
- disabled: !e.serviceId || !e.slotKey,
1321
- onClick: () => g == null ? void 0 : g(e),
1322
- children: a("booking.actions.confirm")
1323
- }
1324
- )
1325
- ] }) : null
1326
- ] });
1327
- }
1328
- function Mt({
1329
- services: o,
1330
- specialties: c,
1331
- availableDates: l,
1332
- availableSlots: e,
1333
- value: n,
1334
- onChange: g,
1335
- onSubmit: v,
1336
- detailsSlot: y,
1337
- loadingSlots: w,
1338
- locale: x
1339
- }) {
1340
- const { t: a } = $(), [d, u] = z(() => {
1341
- if (n.date) {
1342
- const r = L(n.date);
1343
- return { from: r, to: r };
1344
- }
1345
- return l.length > 0 ? {
1346
- from: L(l[0]),
1347
- to: L(l[l.length - 1])
1348
- } : {};
1349
- }), k = S(() => n.specialtyId ? o.filter(
1350
- (r) => !r.specialtyId || r.specialtyId === n.specialtyId
1351
- ) : o, [o, n.specialtyId]), m = S(() => {
1352
- if (!d.from || !d.to) return l;
1353
- const r = [], s = d.from, i = d.to, b = new Date(s);
1354
- for (; b.getTime() <= i.getTime(); )
1355
- r.push(q(b)), b.setDate(b.getDate() + 1);
1356
- return r.filter((K) => l.includes(K));
1357
- }, [d.from, d.to, l]), p = S(
1358
- () => m.map(
1359
- (r) => X(r, e[r] ?? [])
1360
- ),
1361
- [m, e]
1362
- ), N = (r) => {
1363
- g({
1364
- ...n,
1365
- serviceId: r.value,
1366
- date: void 0,
1367
- time: void 0,
1368
- slotKey: void 0
1369
- });
1370
- }, I = j(
1371
- async (r) => {
1372
- const s = r.trim().toLowerCase();
1373
- return k.filter((i) => s ? i.label.toLowerCase().includes(s) : !0).map((i) => ({
1374
- value: i.id,
1375
- label: `${i.label} · ${a("booking.serviceSummary", {
1376
- minutes: i.durationMin
1377
- })}`
1378
- }));
1379
- },
1380
- [k, a]
1381
- );
1382
- return o.find((r) => r.id === n.serviceId), /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1383
- /* @__PURE__ */ t(
1384
- Ie,
1385
- {
1386
- placeholder: a("booking.searchPlaceholder"),
1387
- "aria-label": a("booking.searchLabel"),
1388
- loadOptions: I,
1389
- onSelect: N,
1390
- startAdornment: /* @__PURE__ */ t(ce, { "aria-hidden": "true", className: "ds:size-4" })
1391
- }
1392
- ),
1393
- c.length > 0 ? /* @__PURE__ */ t(re, { label: a("booking.browseBySpecialty"), children: c.map((r) => /* @__PURE__ */ t(
1394
- oe,
1395
- {
1396
- value: r.id,
1397
- keepOnSelect: !0,
1398
- intent: n.specialtyId === r.id ? "suggestion" : "default",
1399
- "aria-pressed": n.specialtyId === r.id || void 0,
1400
- startIcon: ge(r),
1401
- onSelect: () => g({
1402
- ...n,
1403
- specialtyId: n.specialtyId === r.id ? void 0 : r.id,
1404
- serviceId: void 0,
1405
- date: void 0,
1406
- time: void 0,
1407
- slotKey: void 0
1408
- }),
1409
- children: r.label
1410
- },
1411
- r.id
1412
- )) }) : null,
1413
- /* @__PURE__ */ t(
1414
- Me,
1415
- {
1416
- value: d,
1417
- onChange: (r) => {
1418
- u(r), r.from && g({
1419
- ...n,
1420
- date: q(r.from),
1421
- time: void 0,
1422
- slotKey: void 0
1423
- });
1424
- }
1425
- }
1426
- ),
1427
- /* @__PURE__ */ t(
1428
- Q,
1429
- {
1430
- days: p,
1431
- state: w ? "loading" : "default",
1432
- selectedSlotId: n.slotKey,
1433
- onSlotSelect: (r, s) => {
1434
- const i = s.date instanceof Date ? s.date : L(s.date);
1435
- g({
1436
- ...n,
1437
- date: q(i),
1438
- slotKey: r.id,
1439
- time: typeof r.label == "string" ? r.label : R(
1440
- r.start instanceof Date ? r.start : L(r.start),
1441
- "HH:mm"
1442
- )
1443
- });
1444
- },
1445
- locale: x
1446
- }
1447
- ),
1448
- n.slotKey ? /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1449
- y,
1450
- /* @__PURE__ */ t(
1451
- T,
1452
- {
1453
- intent: "primary",
1454
- size: "md",
1455
- disabled: !n.serviceId || !n.slotKey,
1456
- onClick: () => v == null ? void 0 : v(n),
1457
- children: a("booking.actions.confirm")
1458
- }
1459
- )
1460
- ] }) : null
1461
- ] });
1462
- }
1463
- function Dt({
1464
- services: o,
1465
- availableDates: c,
1466
- availableSlots: l,
1467
- value: e,
1468
- onChange: n,
1469
- onSubmit: g,
1470
- detailsSlot: v,
1471
- loadingDates: y,
1472
- loadingSlots: w,
1473
- locale: x
1474
- }) {
1475
- const { t: a } = $(), d = S(
1476
- () => te("progress", e),
1477
- [e]
1478
- ), [u, k] = z(d);
1479
- H(() => {
1480
- k((i) => Math.max(i, d));
1481
- }, [d]);
1482
- const m = _(null), p = _(!0);
1483
- H(() => {
1484
- if (p.current) {
1485
- p.current = !1;
1486
- return;
1487
- }
1488
- requestAnimationFrame(() => {
1489
- var b;
1490
- const i = (b = m.current) == null ? void 0 : b.querySelector(
1491
- 'button:not([disabled]), [role="combobox"], input, textarea, [tabindex="0"]'
1492
- );
1493
- i == null || i.focus();
1494
- });
1495
- }, [u]);
1496
- const N = [
1497
- { label: a("booking.pickServiceLabel") },
1498
- { label: a("booking.pickDateLabel") },
1499
- { label: a("booking.confirmStep") }
1500
- ], I = S(
1501
- () => o.map((i) => ({
1502
- value: i.id,
1503
- label: `${i.label} · ${a("booking.serviceSummary", {
1504
- minutes: i.durationMin
1505
- })}`
1506
- })),
1507
- [o, a]
1508
- ), r = S(() => {
1509
- if (!e.date) return null;
1510
- const i = l[e.date] ?? [];
1511
- return [X(e.date, i)];
1512
- }, [e.date, l]), s = (i) => i === 0 ? !!e.serviceId : i === 1 ? !!(e.date && e.time) : !0;
1513
- return /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1514
- /* @__PURE__ */ t(Ae, { activeStep: u, steps: N, onStepChange: k }),
1515
- /* @__PURE__ */ h(
1516
- "div",
1517
- {
1518
- ref: m,
1519
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
1520
- children: [
1521
- u === 0 ? /* @__PURE__ */ t(
1522
- ee,
1523
- {
1524
- options: I,
1525
- value: e.serviceId ?? "",
1526
- onValueChange: (i) => n({
1527
- ...e,
1528
- serviceId: i || void 0,
1529
- date: void 0,
1530
- time: void 0,
1531
- slotKey: void 0
1532
- }),
1533
- "aria-label": a("booking.pickServiceLabel"),
1534
- placeholder: a("booking.pickServiceLabel")
1535
- }
1536
- ) : null,
1537
- u === 1 ? /* @__PURE__ */ h("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
1538
- /* @__PURE__ */ t(
1539
- Y,
1540
- {
1541
- availableDates: c,
1542
- selectedDate: e.date,
1543
- onSelectDate: (i) => n({
1544
- ...e,
1545
- date: i,
1546
- time: void 0,
1547
- slotKey: void 0
1548
- }),
1549
- locale: x,
1550
- loading: y
1551
- }
1552
- ),
1553
- e.date && r ? /* @__PURE__ */ t(
1554
- Q,
1555
- {
1556
- days: r,
1557
- state: w ? "loading" : "default",
1558
- selectedSlotId: e.slotKey,
1559
- onSlotSelect: (i) => n({
1560
- ...e,
1561
- slotKey: i.id,
1562
- time: typeof i.label == "string" ? i.label : R(
1563
- i.start instanceof Date ? i.start : L(i.start),
1564
- "HH:mm"
1565
- )
1566
- }),
1567
- locale: x
1568
- }
1569
- ) : null
1570
- ] }) : null,
1571
- u === 2 ? /* @__PURE__ */ t("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: v }) : null
1572
- ]
1573
- }
1574
- ),
1575
- /* @__PURE__ */ h("div", { className: "ds:flex ds:items-center ds:justify-between ds:gap-[var(--spacing-sm)]", children: [
1576
- /* @__PURE__ */ t(
1577
- T,
1578
- {
1579
- intent: "ghost",
1580
- size: "md",
1581
- disabled: u === 0,
1582
- onClick: () => k((i) => Math.max(0, i - 1)),
1583
- children: a("booking.actions.back")
1584
- }
1585
- ),
1586
- u < 2 ? /* @__PURE__ */ t(
1587
- T,
1588
- {
1589
- intent: "primary",
1590
- size: "md",
1591
- disabled: !s(u),
1592
- onClick: () => k((i) => Math.min(N.length - 1, i + 1)),
1593
- children: a("booking.actions.next")
1594
- }
1595
- ) : /* @__PURE__ */ t(
1596
- T,
1597
- {
1598
- intent: "primary",
1599
- size: "md",
1600
- disabled: !e.serviceId || !e.slotKey,
1601
- onClick: () => g == null ? void 0 : g(e),
1602
- children: a("booking.actions.confirm")
1603
- }
1604
- )
1605
- ] })
1606
- ] });
1607
- }
1608
- const At = ke(
1609
- ({
1610
- variant: o = "inline-list",
1611
- services: c,
1612
- specialties: l,
1613
- availableDates: e,
1614
- availableSlots: n,
1615
- value: g,
1616
- onChange: v,
1617
- onSubmit: y,
1618
- filtersSlot: w,
1619
- detailsSlot: x,
1620
- ctaSlot: a,
1621
- heading: d,
1622
- loadingDates: u,
1623
- loadingSlots: k,
1624
- "aria-label": m,
1625
- id: p,
1626
- className: N,
1627
- ...I
1628
- }, r) => {
1629
- const { t: s, i18n: i } = $(), b = o ?? "inline-list", K = i.language ?? "en", M = gt[b], [D, B] = z(null), f = te(b, g), A = D ?? f, O = S(
1630
- () => ({
1631
- getCurrentStep: () => A,
1632
- getTotalSteps: () => M,
1633
- gotoStep: (E) => {
1634
- const G = Math.max(0, Math.min(E, M - 1));
1635
- B(G);
1636
- },
1637
- next: () => {
1638
- A < M - 1 && B(A + 1);
1639
- },
1640
- previous: () => {
1641
- A > 0 && B(A - 1);
1642
- },
1643
- getVariant: () => b
1644
- }),
1645
- [A, M, b]
1646
- ), F = _(null);
1647
- xe(r, () => F.current, []), Se(lt, O, p);
1648
- const se = _(!0);
1649
- H(() => {
1650
- if (se.current) {
1651
- se.current = !1;
1652
- return;
1653
- }
1654
- D != null && requestAnimationFrame(() => {
1655
- var G;
1656
- const E = (G = F.current) == null ? void 0 : G.querySelector(
1657
- 'button:not([disabled]), [role="combobox"], input:not([disabled]), textarea, h3[tabindex="-1"]'
1658
- );
1659
- E == null || E.focus();
1660
- });
1661
- }, [D]);
1662
- const ue = s(b === "inline-list" ? "booking.inlineList.title" : b === "accordion" ? "booking.accordion.title" : b === "calendar" ? "booking.calendar.title" : b === "flexible" ? "booking.flexible.title" : "booking.progress.title"), he = s(b === "inline-list" ? "booking.inlineList.subtitle" : b === "accordion" ? "booking.accordion.subtitle" : b === "calendar" ? "booking.calendar.subtitle" : b === "flexible" ? "booking.flexible.subtitle" : "booking.progress.subtitle"), be = m ?? s("booking.regionLabel"), ye = d === null ? null : d !== void 0 ? d : (
1663
- // Plain <div> here, not <header>: the booking root carries
1664
- // `role="region"`, which already has an accessible name via
1665
- // `aria-labelledby`. Using a second nested `<header>` would
1666
- // emit a banner landmark inside a region landmark, which axe's
1667
- // `landmark-banner-is-top-level` rule flags as a moderate
1668
- // violation. The visual styling is identical.
1669
- /* @__PURE__ */ h(
1670
- "div",
1671
- {
1672
- className: [
1673
- "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]",
1674
- b === "inline-list" ? [
1675
- "ds:rounded-[var(--radius-md)]",
1676
- "ds:bg-[image:var(--gradient-hero-brand)]",
1677
- "ds:ps-[var(--spacing-md)] ds:pe-[var(--spacing-md)]",
1678
- "ds:pt-[var(--spacing-md)] ds:pb-[var(--spacing-md)]"
1679
- ].join(" ") : ""
1680
- ].filter(Boolean).join(" "),
1681
- children: [
1682
- /* @__PURE__ */ t("h2", { className: "type-title-card ds:text-[var(--foreground)] ds:m-0", children: ue }),
1683
- /* @__PURE__ */ t("p", { className: "type-body-sm ds:text-[var(--muted-foreground)] ds:m-0", children: he })
1684
- ]
1685
- }
1686
- )
1687
- ), V = {
1688
- services: c,
1689
- specialties: l ?? [],
1690
- availableDates: e,
1691
- availableSlots: n,
1692
- value: g,
1693
- onChange: v,
1694
- onSubmit: y,
1695
- detailsSlot: x,
1696
- loadingDates: u,
1697
- loadingSlots: k,
1698
- locale: K
1699
- }, ve = (() => {
1700
- switch (b) {
1701
- case "inline-list":
1702
- return /* @__PURE__ */ t(St, { ...V });
1703
- case "accordion":
1704
- return /* @__PURE__ */ t(Nt, { ...V });
1705
- case "calendar":
1706
- return /* @__PURE__ */ t(It, { ...V });
1707
- case "flexible":
1708
- return /* @__PURE__ */ t(Mt, { ...V });
1709
- case "progress":
1710
- return /* @__PURE__ */ t(Dt, { ...V });
1711
- /* c8 ignore next 2 */
1712
- default:
1713
- return null;
1714
- }
1715
- })();
1716
- return /* @__PURE__ */ h(
1717
- "div",
1718
- {
1719
- ref: F,
1720
- role: "region",
1721
- "aria-label": be,
1722
- id: p,
1723
- "data-component": "booking",
1724
- "data-component-id": p,
1725
- "data-variant": b,
1726
- className: mt({ variant: b, className: N }),
1727
- ...I,
1728
- children: [
1729
- ye,
1730
- w,
1731
- ve,
1732
- a
1733
- ]
1734
- }
1735
- );
1736
- }
1737
- );
1738
- At.displayName = "Booking";
1739
- export {
1740
- At as B,
1741
- lt as b
1742
- };
1743
- //# sourceMappingURL=booking-CXngC-1u.js.map