@loczer/storefront-sdk 0.157.0 → 0.158.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BookingEndDateField.d.ts","sourceRoot":"","sources":["../../../../src/components/BookingPeriodSelector/components/BookingEndDateField.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BookingEndDateField.d.ts","sourceRoot":"","sources":["../../../../src/components/BookingPeriodSelector/components/BookingEndDateField.tsx"],"names":[],"mappings":"AAqJA,eAAO,MAAM,mBAAmB,+CA6hB/B,CAAA"}
|
|
@@ -1,87 +1,129 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { differenceInCalendarDays as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { useMorphingModalWizardOverlayLayer as
|
|
6
|
-
import { DayPicker as
|
|
7
|
-
import { Label as
|
|
8
|
-
import {
|
|
9
|
-
import { useBookingPeriod as
|
|
10
|
-
import { BookingPeriodFieldErrorMessage as
|
|
11
|
-
import { ModalDayPickerField as
|
|
12
|
-
const X = (
|
|
13
|
-
const
|
|
14
|
-
if (d <
|
|
15
|
-
return
|
|
16
|
-
if (d >
|
|
17
|
-
const
|
|
18
|
-
return
|
|
1
|
+
import { jsxs as te, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { differenceInCalendarDays as pe } from "date-fns";
|
|
3
|
+
import { createContext as ye, useRef as F, useState as Y, useEffect as h, useContext as De } from "react";
|
|
4
|
+
import { cn as k, DayPickerField as Ee } from "@rpcbase/ui";
|
|
5
|
+
import { useMorphingModalWizardOverlayLayer as he } from "../../../chunks/ui/dist/MorphingModalWizard-D7hc-dDP.js";
|
|
6
|
+
import { DayPicker as ve } from "../../../ui/day-picker.js";
|
|
7
|
+
import { Label as be } from "../../../ui/label.js";
|
|
8
|
+
import { Provider as ge, Root as Me, TooltipTrigger as ke, Content as Te } from "../../../ui/tooltip.js";
|
|
9
|
+
import { useBookingPeriod as Pe } from "../BookingPeriodContext.js";
|
|
10
|
+
import { BookingPeriodFieldErrorMessage as we } from "./BookingPeriodFieldErrorMessage.js";
|
|
11
|
+
import { ModalDayPickerField as Ce } from "./internal/ModalDayPickerField.js";
|
|
12
|
+
const X = (t) => String(t).padStart(2, "0"), $ = (t) => `${t.getFullYear()}-${X(t.getMonth() + 1)}-${X(t.getDate())}`, z = (t) => t.getFullYear() * 12 + t.getMonth(), ne = (t) => new Date(Math.floor(t / 12), t % 12, 1), H = (t) => ne(z(t)), Z = (t, i, r) => {
|
|
13
|
+
const c = z(t), d = z(i), f = Math.max(0, r - 1), b = c + f;
|
|
14
|
+
if (d < c)
|
|
15
|
+
return H(i);
|
|
16
|
+
if (d > b) {
|
|
17
|
+
const m = d - f;
|
|
18
|
+
return m === c ? t : ne(m);
|
|
19
19
|
}
|
|
20
|
-
return
|
|
21
|
-
},
|
|
20
|
+
return t;
|
|
21
|
+
}, Fe = (t) => {
|
|
22
22
|
if (typeof PointerEvent == "function") {
|
|
23
|
-
|
|
23
|
+
t.dispatchEvent(new PointerEvent("pointermove", { bubbles: !0, pointerType: "mouse" }));
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
}, ee = (
|
|
26
|
+
t.dispatchEvent(new MouseEvent("mousemove", { bubbles: !0 }));
|
|
27
|
+
}, ee = (t) => {
|
|
28
28
|
if (typeof PointerEvent == "function") {
|
|
29
|
-
|
|
29
|
+
t.dispatchEvent(new PointerEvent("pointerout", { bubbles: !0, pointerType: "mouse" })), t.dispatchEvent(new PointerEvent("pointerleave", { bubbles: !0, pointerType: "mouse" }));
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
},
|
|
32
|
+
t.dispatchEvent(new MouseEvent("mouseout", { bubbles: !0 })), t.dispatchEvent(new MouseEvent("mouseleave", { bubbles: !0 }));
|
|
33
|
+
}, oe = ye(null), re = (t) => {
|
|
34
|
+
const i = De(oe), { day: r, modifiers: c, className: d, ...f } = t, b = c.disabled ? "cursor-not-allowed" : "cursor-pointer", m = F(null);
|
|
35
|
+
h(() => {
|
|
36
|
+
c.focused && m.current?.focus();
|
|
37
|
+
}, [c.focused]);
|
|
38
|
+
const p = /* @__PURE__ */ s(
|
|
39
|
+
"button",
|
|
40
|
+
{
|
|
41
|
+
ref: m,
|
|
42
|
+
...f,
|
|
43
|
+
className: k(d, b)
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
if (!i)
|
|
47
|
+
return p;
|
|
48
|
+
const { labels: y, startDate: L, hoveredEndDate: T, keyboardTooltipDay: P, numberOfMonths: g, overlayLayer: M } = i;
|
|
49
|
+
if (!L || c.disabled || g === 1)
|
|
50
|
+
return p;
|
|
51
|
+
const l = pe(r.date, L);
|
|
52
|
+
if (l < 0)
|
|
53
|
+
return p;
|
|
54
|
+
const B = $(r.date), I = P === B || (!P && T ? $(T) === B : !1), O = y.selectedDaysTooltip?.({ count: l + 1 });
|
|
55
|
+
return O ? /* @__PURE__ */ te(Me, { open: I, children: [
|
|
56
|
+
/* @__PURE__ */ s(ke, { asChild: !0, children: p }),
|
|
57
|
+
/* @__PURE__ */ s(
|
|
58
|
+
Te,
|
|
59
|
+
{
|
|
60
|
+
container: M ?? void 0,
|
|
61
|
+
side: "top",
|
|
62
|
+
align: "center",
|
|
63
|
+
disableAnimation: !0,
|
|
64
|
+
positionerClassName: M ? "z-[120]" : "z-[80]",
|
|
65
|
+
className: k(
|
|
66
|
+
"pointer-events-none rounded-md border bg-popover px-2 py-1 text-xs font-semibold text-primary shadow-md",
|
|
67
|
+
M ? "z-[120]" : "z-[70]"
|
|
68
|
+
),
|
|
69
|
+
children: /* @__PURE__ */ s("span", { children: O })
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] }) : p;
|
|
73
|
+
};
|
|
74
|
+
re.displayName = "BookingEndDateDayButton";
|
|
75
|
+
const Re = () => {
|
|
34
76
|
const {
|
|
35
|
-
labels:
|
|
77
|
+
labels: t,
|
|
36
78
|
startDate: i,
|
|
37
|
-
endDate:
|
|
38
|
-
selectEndDate:
|
|
79
|
+
endDate: r,
|
|
80
|
+
selectEndDate: c,
|
|
39
81
|
isEndDatePopoverOpen: d,
|
|
40
82
|
setIsEndDatePopoverOpen: f,
|
|
41
|
-
setIsStartTimeSelectOpen:
|
|
42
|
-
hoveredEndDate:
|
|
43
|
-
setHoveredEndDate:
|
|
44
|
-
resetHoveredEndDate:
|
|
45
|
-
labelClassName:
|
|
46
|
-
inputClassName:
|
|
47
|
-
buttonClassName:
|
|
48
|
-
errors:
|
|
49
|
-
dateLocale:
|
|
50
|
-
numberOfMonths:
|
|
51
|
-
isMobile:
|
|
52
|
-
isHydrated:
|
|
53
|
-
openDatePickerOnFocus:
|
|
54
|
-
withMobileDateDrawer:
|
|
55
|
-
minSelectableDate:
|
|
56
|
-
} =
|
|
57
|
-
() =>
|
|
58
|
-
),
|
|
59
|
-
|
|
83
|
+
setIsStartTimeSelectOpen: b,
|
|
84
|
+
hoveredEndDate: m,
|
|
85
|
+
setHoveredEndDate: p,
|
|
86
|
+
resetHoveredEndDate: y,
|
|
87
|
+
labelClassName: L,
|
|
88
|
+
inputClassName: T,
|
|
89
|
+
buttonClassName: P,
|
|
90
|
+
errors: g,
|
|
91
|
+
dateLocale: M,
|
|
92
|
+
numberOfMonths: l,
|
|
93
|
+
isMobile: B,
|
|
94
|
+
isHydrated: I,
|
|
95
|
+
openDatePickerOnFocus: O,
|
|
96
|
+
withMobileDateDrawer: ae,
|
|
97
|
+
minSelectableDate: U
|
|
98
|
+
} = Pe(), D = ae && B, E = F(null), v = F(!1), [ie, de] = Y(!1), [V, N] = Y(null), [j, A] = Y(
|
|
99
|
+
() => H(i ?? r ?? /* @__PURE__ */ new Date())
|
|
100
|
+
), x = he(), se = !!x || !ie;
|
|
101
|
+
h(() => {
|
|
60
102
|
de(!0);
|
|
61
|
-
}, []),
|
|
103
|
+
}, []), h(() => {
|
|
62
104
|
if (typeof document > "u")
|
|
63
105
|
return;
|
|
64
106
|
const e = document.getElementById("end-date-picker");
|
|
65
107
|
if (!(e instanceof HTMLInputElement))
|
|
66
108
|
return;
|
|
67
|
-
const
|
|
68
|
-
|
|
109
|
+
const n = (o) => {
|
|
110
|
+
v.current = o.key === "ArrowUp" || o.key === "ArrowDown";
|
|
69
111
|
};
|
|
70
|
-
return e.addEventListener("keydown",
|
|
71
|
-
e.removeEventListener("keydown",
|
|
112
|
+
return e.addEventListener("keydown", n, !0), () => {
|
|
113
|
+
e.removeEventListener("keydown", n, !0);
|
|
72
114
|
};
|
|
73
|
-
}, []),
|
|
74
|
-
if (!d ||
|
|
115
|
+
}, []), h(() => {
|
|
116
|
+
if (!d || D)
|
|
75
117
|
return;
|
|
76
|
-
const e =
|
|
77
|
-
|
|
78
|
-
}, [
|
|
118
|
+
const e = H(i ?? r ?? /* @__PURE__ */ new Date()), n = r ?? i;
|
|
119
|
+
A(n ? Z(e, n, l) : e);
|
|
120
|
+
}, [r, d, l, i]), h(() => {
|
|
79
121
|
if (!d)
|
|
80
122
|
return;
|
|
81
|
-
const e =
|
|
82
|
-
e &&
|
|
83
|
-
}, [
|
|
84
|
-
if (!d || typeof document > "u" || (
|
|
123
|
+
const e = m ?? r;
|
|
124
|
+
e && A((n) => Z(n, e, l));
|
|
125
|
+
}, [r, m, d, l]), h(() => {
|
|
126
|
+
if (!d || typeof document > "u" || (y(), D))
|
|
85
127
|
return;
|
|
86
128
|
const e = document.getElementById("end-date-picker");
|
|
87
129
|
if (!(e instanceof HTMLElement)) {
|
|
@@ -91,266 +133,265 @@ const X = (o) => String(o).padStart(2, "0"), x = (o) => `${o.getFullYear()}-${X(
|
|
|
91
133
|
document.activeElement !== e && requestAnimationFrame(() => {
|
|
92
134
|
e.focus({ preventScroll: !0 }), e.click();
|
|
93
135
|
});
|
|
94
|
-
}, [d,
|
|
136
|
+
}, [d, y, f]), h(() => {
|
|
95
137
|
if (typeof document > "u")
|
|
96
138
|
return;
|
|
97
139
|
const e = document.getElementById("end-date-picker");
|
|
98
140
|
if (!(e instanceof HTMLInputElement))
|
|
99
141
|
return;
|
|
100
|
-
const
|
|
101
|
-
|
|
142
|
+
const n = () => {
|
|
143
|
+
b(!1);
|
|
102
144
|
};
|
|
103
|
-
return e.addEventListener("focus",
|
|
104
|
-
e.removeEventListener("focus",
|
|
145
|
+
return e.addEventListener("focus", n, !0), () => {
|
|
146
|
+
e.removeEventListener("focus", n, !0);
|
|
105
147
|
};
|
|
106
|
-
}, [
|
|
148
|
+
}, [b]), h(() => {
|
|
107
149
|
if (d || typeof document > "u")
|
|
108
150
|
return;
|
|
109
|
-
const e =
|
|
151
|
+
const e = E.current;
|
|
110
152
|
if (!e)
|
|
111
153
|
return;
|
|
112
|
-
const
|
|
113
|
-
|
|
154
|
+
const o = document.getElementById("end-date-calendar")?.querySelector(`[data-day="${e}"] button`);
|
|
155
|
+
o instanceof HTMLElement && ee(o), E.current = null, N(null);
|
|
114
156
|
}, [d]);
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
157
|
+
const W = F({
|
|
158
|
+
labels: t,
|
|
159
|
+
startDate: i,
|
|
160
|
+
endDate: r,
|
|
161
|
+
hoveredEndDate: m,
|
|
162
|
+
keyboardTooltipDay: V,
|
|
163
|
+
numberOfMonths: l,
|
|
164
|
+
overlayLayer: x,
|
|
165
|
+
calendarMonth: j,
|
|
166
|
+
resetHoveredEndDate: y,
|
|
167
|
+
setHoveredEndDate: p
|
|
168
|
+
});
|
|
169
|
+
W.current = {
|
|
170
|
+
labels: t,
|
|
171
|
+
startDate: i,
|
|
172
|
+
endDate: r,
|
|
173
|
+
hoveredEndDate: m,
|
|
174
|
+
keyboardTooltipDay: V,
|
|
175
|
+
numberOfMonths: l,
|
|
176
|
+
overlayLayer: x,
|
|
177
|
+
calendarMonth: j,
|
|
178
|
+
resetHoveredEndDate: y,
|
|
179
|
+
setHoveredEndDate: p
|
|
180
|
+
};
|
|
181
|
+
const K = F(null);
|
|
182
|
+
if (!K.current) {
|
|
183
|
+
const e = (n) => {
|
|
184
|
+
const {
|
|
185
|
+
labels: o,
|
|
186
|
+
startDate: a,
|
|
187
|
+
endDate: u,
|
|
188
|
+
hoveredEndDate: w,
|
|
189
|
+
keyboardTooltipDay: S,
|
|
190
|
+
numberOfMonths: Q,
|
|
191
|
+
overlayLayer: ce,
|
|
192
|
+
calendarMonth: le,
|
|
193
|
+
resetHoveredEndDate: ue,
|
|
194
|
+
setHoveredEndDate: fe
|
|
195
|
+
} = W.current, me = {
|
|
196
|
+
labels: o,
|
|
197
|
+
startDate: a,
|
|
198
|
+
hoveredEndDate: w,
|
|
199
|
+
keyboardTooltipDay: S,
|
|
200
|
+
numberOfMonths: Q,
|
|
201
|
+
overlayLayer: ce
|
|
202
|
+
};
|
|
203
|
+
return /* @__PURE__ */ s(oe.Provider, { value: me, children: /* @__PURE__ */ s(ge, { delayDuration: 0, children: /* @__PURE__ */ s("div", { onMouseLeave: ue, children: /* @__PURE__ */ s(
|
|
204
|
+
ve,
|
|
123
205
|
{
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
disableAnimation: !0,
|
|
144
|
-
positionerClassName: D ? "z-[120]" : "z-[80]",
|
|
145
|
-
className: b(
|
|
146
|
-
"pointer-events-none rounded-md border bg-popover px-2 py-1 text-xs font-semibold text-primary shadow-md",
|
|
147
|
-
D ? "z-[120]" : "z-[70]"
|
|
148
|
-
),
|
|
149
|
-
children: /* @__PURE__ */ s("span", { children: G })
|
|
206
|
+
...n,
|
|
207
|
+
mode: "range",
|
|
208
|
+
month: le,
|
|
209
|
+
onMonthChange: (C) => {
|
|
210
|
+
A(H(C));
|
|
211
|
+
},
|
|
212
|
+
selected: {
|
|
213
|
+
from: a,
|
|
214
|
+
to: w || u
|
|
215
|
+
},
|
|
216
|
+
components: {
|
|
217
|
+
...n.components,
|
|
218
|
+
DayButton: re
|
|
219
|
+
},
|
|
220
|
+
onSelect: (C, R) => {
|
|
221
|
+
n.onSelect?.(R);
|
|
222
|
+
},
|
|
223
|
+
onDayMouseEnter: (C, R) => {
|
|
224
|
+
Q !== 1 && a && !R.disabled && C >= a && fe(C);
|
|
150
225
|
}
|
|
151
|
-
)
|
|
152
|
-
] }) : w;
|
|
153
|
-
};
|
|
154
|
-
return e.displayName = "BookingEndDateDayButton", e;
|
|
155
|
-
}, [u, F, o, D, i]), R = Q(() => {
|
|
156
|
-
const e = (t) => /* @__PURE__ */ s(ge, { delayDuration: 0, children: /* @__PURE__ */ s("div", { onMouseLeave: m, children: /* @__PURE__ */ s(
|
|
157
|
-
me,
|
|
158
|
-
{
|
|
159
|
-
...t,
|
|
160
|
-
mode: "range",
|
|
161
|
-
month: $,
|
|
162
|
-
onMonthChange: (n) => {
|
|
163
|
-
B(C(n));
|
|
164
|
-
},
|
|
165
|
-
selected: {
|
|
166
|
-
from: i,
|
|
167
|
-
to: u || a
|
|
168
|
-
},
|
|
169
|
-
components: {
|
|
170
|
-
...t.components,
|
|
171
|
-
DayButton: z
|
|
172
|
-
},
|
|
173
|
-
onSelect: (n, r) => {
|
|
174
|
-
t.onSelect?.(r);
|
|
175
|
-
},
|
|
176
|
-
onDayMouseEnter: (n, r) => {
|
|
177
|
-
p !== 1 && i && !r.disabled && n >= i && M(n);
|
|
178
226
|
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
i,
|
|
185
|
-
a,
|
|
186
|
-
u,
|
|
187
|
-
$,
|
|
188
|
-
m,
|
|
189
|
-
M
|
|
190
|
-
]), L = () => {
|
|
227
|
+
) }) }) });
|
|
228
|
+
};
|
|
229
|
+
e.displayName = "BookingEndDateDayPicker", K.current = e;
|
|
230
|
+
}
|
|
231
|
+
const _ = K.current, q = () => {
|
|
191
232
|
if (typeof document > "u") {
|
|
192
|
-
|
|
233
|
+
E.current = null;
|
|
193
234
|
return;
|
|
194
235
|
}
|
|
195
|
-
const e =
|
|
236
|
+
const e = E.current;
|
|
196
237
|
if (!e)
|
|
197
238
|
return;
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
},
|
|
239
|
+
const o = document.getElementById("end-date-calendar")?.querySelector(`[data-day="${e}"] button`);
|
|
240
|
+
o instanceof HTMLElement && ee(o), E.current = null, N(null);
|
|
241
|
+
}, G = (e) => {
|
|
201
242
|
if (typeof document > "u")
|
|
202
243
|
return;
|
|
203
|
-
const
|
|
204
|
-
if (
|
|
244
|
+
const n = $(e);
|
|
245
|
+
if (E.current === n)
|
|
205
246
|
return;
|
|
206
|
-
|
|
207
|
-
let
|
|
208
|
-
const
|
|
209
|
-
if (
|
|
247
|
+
q(), E.current = n, N(n);
|
|
248
|
+
let o = 0;
|
|
249
|
+
const a = 6, u = () => {
|
|
250
|
+
if (E.current !== n)
|
|
210
251
|
return;
|
|
211
|
-
const
|
|
212
|
-
if (!(
|
|
213
|
-
|
|
252
|
+
const w = document.getElementById("end-date-calendar");
|
|
253
|
+
if (!(w instanceof HTMLElement)) {
|
|
254
|
+
o += 1, o <= a && requestAnimationFrame(u);
|
|
214
255
|
return;
|
|
215
256
|
}
|
|
216
|
-
const
|
|
217
|
-
if (
|
|
218
|
-
|
|
257
|
+
const S = w.querySelector(`[data-day="${n}"] button:not([disabled])`);
|
|
258
|
+
if (S instanceof HTMLElement) {
|
|
259
|
+
Fe(S);
|
|
219
260
|
return;
|
|
220
261
|
}
|
|
221
|
-
|
|
262
|
+
o += 1, o <= a && requestAnimationFrame(u);
|
|
222
263
|
};
|
|
223
|
-
requestAnimationFrame(
|
|
224
|
-
},
|
|
225
|
-
|
|
264
|
+
requestAnimationFrame(u);
|
|
265
|
+
}, J = () => {
|
|
266
|
+
D && f(!0);
|
|
226
267
|
};
|
|
227
|
-
return /* @__PURE__ */
|
|
268
|
+
return /* @__PURE__ */ te(
|
|
228
269
|
"div",
|
|
229
270
|
{
|
|
230
|
-
className:
|
|
231
|
-
onPointerDownCapture:
|
|
232
|
-
onClick:
|
|
271
|
+
className: k("group/form-item relative flex-grow", D && "cursor-pointer rounded-md"),
|
|
272
|
+
onPointerDownCapture: J,
|
|
273
|
+
onClick: J,
|
|
233
274
|
children: [
|
|
234
275
|
/* @__PURE__ */ s(
|
|
235
|
-
|
|
276
|
+
be,
|
|
236
277
|
{
|
|
237
278
|
htmlFor: "end-date-picker",
|
|
238
|
-
className:
|
|
239
|
-
children: /* @__PURE__ */ s("span", { children:
|
|
279
|
+
className: k("mb-1 block text-sm font-medium", D && "cursor-pointer", L),
|
|
280
|
+
children: /* @__PURE__ */ s("span", { children: t.endDate })
|
|
240
281
|
}
|
|
241
282
|
),
|
|
242
283
|
se ? /* @__PURE__ */ s(
|
|
243
|
-
|
|
284
|
+
Ce,
|
|
244
285
|
{
|
|
245
286
|
id: "end-date-picker",
|
|
246
|
-
value:
|
|
247
|
-
placeholder:
|
|
287
|
+
value: r ?? null,
|
|
288
|
+
placeholder: t.pickEndDate,
|
|
248
289
|
triggerTestId: "end-date-trigger",
|
|
249
|
-
isHydrated:
|
|
250
|
-
open:
|
|
290
|
+
isHydrated: I,
|
|
291
|
+
open: D ? !1 : d,
|
|
251
292
|
onOpenChange: f,
|
|
252
|
-
readOnly:
|
|
253
|
-
openOnFocus:
|
|
293
|
+
readOnly: D,
|
|
294
|
+
openOnFocus: O,
|
|
254
295
|
onValueUpdate: (e) => {
|
|
255
|
-
const
|
|
296
|
+
const n = (() => {
|
|
256
297
|
if (!d || typeof document > "u")
|
|
257
298
|
return !1;
|
|
258
|
-
const
|
|
259
|
-
return
|
|
299
|
+
const o = document.activeElement;
|
|
300
|
+
return o instanceof HTMLElement && o.id === "end-date-picker";
|
|
260
301
|
})();
|
|
261
302
|
if (!i || !e || e < i) {
|
|
262
|
-
|
|
303
|
+
y(), n && q();
|
|
263
304
|
return;
|
|
264
305
|
}
|
|
265
|
-
|
|
306
|
+
p(e), n && G(e);
|
|
266
307
|
},
|
|
267
308
|
onChange: (e) => {
|
|
268
|
-
if (
|
|
309
|
+
if (y(), (() => {
|
|
269
310
|
if (typeof document > "u")
|
|
270
|
-
return
|
|
271
|
-
const
|
|
272
|
-
return
|
|
273
|
-
})() || e &&
|
|
311
|
+
return v.current = !1, !1;
|
|
312
|
+
const a = document.activeElement, u = v.current && a instanceof HTMLElement && a.id === "end-date-picker";
|
|
313
|
+
return v.current = !1, u;
|
|
314
|
+
})() || e && r && e.getFullYear() === r.getFullYear() && e.getMonth() === r.getMonth() && e.getDate() === r.getDate())
|
|
274
315
|
return;
|
|
275
|
-
const
|
|
316
|
+
const o = (() => {
|
|
276
317
|
if (!e || typeof document > "u")
|
|
277
318
|
return !1;
|
|
278
|
-
const
|
|
279
|
-
return
|
|
319
|
+
const a = document.activeElement;
|
|
320
|
+
return a instanceof HTMLElement ? !!(document.getElementById("end-date-calendar")?.contains(a) || a.id === "end-date-picker") : !1;
|
|
280
321
|
})();
|
|
281
|
-
|
|
322
|
+
c(e ?? void 0, { openTimePicker: o });
|
|
282
323
|
},
|
|
283
|
-
inputClassName:
|
|
284
|
-
dayPickerComponent:
|
|
324
|
+
inputClassName: k(g.endDate && "border-destructive", T, P),
|
|
325
|
+
dayPickerComponent: _,
|
|
285
326
|
dayPickerProps: {
|
|
286
327
|
id: "end-date-calendar",
|
|
287
|
-
locale:
|
|
328
|
+
locale: M,
|
|
288
329
|
showOutsideDays: !1,
|
|
289
|
-
numberOfMonths:
|
|
290
|
-
disabled: (e) => i && e < i || e <
|
|
330
|
+
numberOfMonths: l,
|
|
331
|
+
disabled: (e) => i && e < i || e < U,
|
|
291
332
|
initialFocus: !0,
|
|
292
333
|
"data-testid": "end-date-calendar"
|
|
293
334
|
},
|
|
294
|
-
portalContainer:
|
|
335
|
+
portalContainer: x
|
|
295
336
|
}
|
|
296
337
|
) : /* @__PURE__ */ s(
|
|
297
|
-
|
|
338
|
+
Ee,
|
|
298
339
|
{
|
|
299
340
|
id: "end-date-picker",
|
|
300
|
-
value:
|
|
301
|
-
placeholder:
|
|
341
|
+
value: r ?? null,
|
|
342
|
+
placeholder: t.pickEndDate,
|
|
302
343
|
triggerTestId: "end-date-trigger",
|
|
303
|
-
isHydrated:
|
|
304
|
-
open:
|
|
344
|
+
isHydrated: I,
|
|
345
|
+
open: D ? !1 : d,
|
|
305
346
|
onOpenChange: f,
|
|
306
|
-
readOnly:
|
|
347
|
+
readOnly: D,
|
|
307
348
|
onValueUpdate: (e) => {
|
|
308
|
-
const
|
|
349
|
+
const n = (() => {
|
|
309
350
|
if (!d || typeof document > "u")
|
|
310
351
|
return !1;
|
|
311
|
-
const
|
|
312
|
-
return
|
|
352
|
+
const o = document.activeElement;
|
|
353
|
+
return o instanceof HTMLElement && o.id === "end-date-picker";
|
|
313
354
|
})();
|
|
314
355
|
if (!i || !e || e < i) {
|
|
315
|
-
|
|
356
|
+
y(), n && q();
|
|
316
357
|
return;
|
|
317
358
|
}
|
|
318
|
-
|
|
359
|
+
p(e), n && G(e);
|
|
319
360
|
},
|
|
320
361
|
onChange: (e) => {
|
|
321
|
-
if (
|
|
362
|
+
if (y(), (() => {
|
|
322
363
|
if (typeof document > "u")
|
|
323
|
-
return
|
|
324
|
-
const
|
|
325
|
-
return
|
|
326
|
-
})() || e &&
|
|
364
|
+
return v.current = !1, !1;
|
|
365
|
+
const a = document.activeElement, u = v.current && a instanceof HTMLElement && a.id === "end-date-picker";
|
|
366
|
+
return v.current = !1, u;
|
|
367
|
+
})() || e && r && e.getFullYear() === r.getFullYear() && e.getMonth() === r.getMonth() && e.getDate() === r.getDate())
|
|
327
368
|
return;
|
|
328
|
-
const
|
|
369
|
+
const o = (() => {
|
|
329
370
|
if (!e || typeof document > "u")
|
|
330
371
|
return !1;
|
|
331
|
-
const
|
|
332
|
-
return
|
|
372
|
+
const a = document.activeElement;
|
|
373
|
+
return a instanceof HTMLElement ? !!(document.getElementById("end-date-calendar")?.contains(a) || a.id === "end-date-picker") : !1;
|
|
333
374
|
})();
|
|
334
|
-
|
|
375
|
+
c(e ?? void 0, { openTimePicker: o });
|
|
335
376
|
},
|
|
336
|
-
inputClassName:
|
|
337
|
-
dayPickerComponent:
|
|
377
|
+
inputClassName: k(g.endDate && "border-destructive", T, P),
|
|
378
|
+
dayPickerComponent: _,
|
|
338
379
|
dayPickerProps: {
|
|
339
380
|
id: "end-date-calendar",
|
|
340
|
-
locale:
|
|
381
|
+
locale: M,
|
|
341
382
|
showOutsideDays: !1,
|
|
342
|
-
numberOfMonths:
|
|
343
|
-
disabled: (e) => i && e < i || e <
|
|
383
|
+
numberOfMonths: l,
|
|
384
|
+
disabled: (e) => i && e < i || e < U,
|
|
344
385
|
initialFocus: !0,
|
|
345
386
|
"data-testid": "end-date-calendar"
|
|
346
387
|
}
|
|
347
388
|
}
|
|
348
389
|
),
|
|
349
|
-
|
|
390
|
+
g.endDate && /* @__PURE__ */ s(we, { children: g.endDate })
|
|
350
391
|
]
|
|
351
392
|
}
|
|
352
393
|
);
|
|
353
394
|
};
|
|
354
395
|
export {
|
|
355
|
-
|
|
396
|
+
Re as BookingEndDateField
|
|
356
397
|
};
|