@loczer/storefront-sdk 0.170.0 → 0.171.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.
- package/dist/components/BookingPeriodSelector/components/BookingEndDateField.js +2 -2
- package/dist/components/BookingPeriodSelector/components/BookingMobileDateDrawer.js +38 -38
- package/dist/components/BookingPeriodSelector/components/BookingStartDateField.js +2 -2
- package/dist/ui/day-picker.d.ts.map +1 -1
- package/dist/ui/day-picker.js +16 -21
- package/package.json +3 -3
|
@@ -328,7 +328,7 @@ const qe = () => {
|
|
|
328
328
|
showOutsideDays: !1,
|
|
329
329
|
numberOfMonths: l,
|
|
330
330
|
disabled: (e) => i && e < i || e < U,
|
|
331
|
-
|
|
331
|
+
autoFocus: !0,
|
|
332
332
|
"data-testid": "end-date-calendar"
|
|
333
333
|
},
|
|
334
334
|
portalContainer: S
|
|
@@ -381,7 +381,7 @@ const qe = () => {
|
|
|
381
381
|
showOutsideDays: !1,
|
|
382
382
|
numberOfMonths: l,
|
|
383
383
|
disabled: (e) => i && e < i || e < U,
|
|
384
|
-
|
|
384
|
+
autoFocus: !0,
|
|
385
385
|
"data-testid": "end-date-calendar"
|
|
386
386
|
}
|
|
387
387
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r, jsxs as c } from "react/jsx-runtime";
|
|
2
2
|
import { useState as z, useRef as R, useEffect as D } from "react";
|
|
3
3
|
import { startOfMonth as s, differenceInCalendarDays as Z, isSameDay as w, endOfMonth as H, addMonths as V } from "date-fns";
|
|
4
4
|
import { DayButton as ee } from "react-day-picker";
|
|
5
5
|
import { cn as f } from "@rpcbase/ui";
|
|
6
6
|
import { buttonVariants as te, Button as T } from "../../../ui/button.js";
|
|
7
7
|
import { DayPicker as F } from "../../../ui/day-picker.js";
|
|
8
|
-
import { Drawer as oe, DrawerContent as ne, DrawerHeader as ae, DrawerTitle as
|
|
9
|
-
import { useBookingPeriod as
|
|
8
|
+
import { Drawer as oe, DrawerContent as ne, DrawerHeader as ae, DrawerTitle as re } from "../../../ui/drawer.js";
|
|
9
|
+
import { useBookingPeriod as le } from "../BookingPeriodContext.js";
|
|
10
10
|
const se = ee, K = 1, P = f(
|
|
11
11
|
te({ variant: "outline" }),
|
|
12
12
|
"z-10 h-11 w-11 bg-background p-0 opacity-100 shadow-sm [&_svg]:size-5"
|
|
@@ -45,20 +45,20 @@ const se = ee, K = 1, P = f(
|
|
|
45
45
|
dateLocale: S,
|
|
46
46
|
isMobile: k,
|
|
47
47
|
withMobileDateDrawer: B,
|
|
48
|
-
minSelectableDate:
|
|
49
|
-
} =
|
|
50
|
-
Y(n, a,
|
|
48
|
+
minSelectableDate: d
|
|
49
|
+
} = le(), i = B && k && (N || C), l = C && !N ? "end" : "start", G = I(d), h = I(
|
|
50
|
+
Y(n, a, d)
|
|
51
51
|
), [J, O] = z(
|
|
52
|
-
() => s(
|
|
52
|
+
() => s(d)
|
|
53
53
|
), [Q, p] = z(
|
|
54
54
|
() => g(h)
|
|
55
55
|
), y = R(!0), v = R(!1), _ = n && (a ?? n) >= n ? Z(a ?? n, n) + 1 : null, j = a ?? n;
|
|
56
56
|
if (D(() => {
|
|
57
|
-
!
|
|
58
|
-
}, [
|
|
59
|
-
!
|
|
60
|
-
}, [
|
|
61
|
-
if (!
|
|
57
|
+
!i || l !== "start" || O(s(d));
|
|
58
|
+
}, [l, i, G]), D(() => {
|
|
59
|
+
!i || l !== "end" || p(g(h));
|
|
60
|
+
}, [l, h, i]), D(() => {
|
|
61
|
+
if (!i || typeof document > "u")
|
|
62
62
|
return;
|
|
63
63
|
const e = window.scrollY, { body: t, documentElement: u } = document, m = {
|
|
64
64
|
overflow: t.style.overflow,
|
|
@@ -69,7 +69,7 @@ const se = ee, K = 1, P = f(
|
|
|
69
69
|
return y.current = !0, t.style.overflow = "hidden", t.style.position = "fixed", t.style.top = `-${e}px`, t.style.width = "100%", u.style.overscrollBehavior = "none", () => {
|
|
70
70
|
t.style.overflow = m.overflow, t.style.position = m.position, t.style.top = m.top, t.style.width = m.width, u.style.overscrollBehavior = X, y.current && window.scrollTo(0, e);
|
|
71
71
|
};
|
|
72
|
-
}, [
|
|
72
|
+
}, [i]), !B || !k)
|
|
73
73
|
return null;
|
|
74
74
|
const x = (e) => {
|
|
75
75
|
if (e === "end") {
|
|
@@ -91,7 +91,7 @@ const se = ee, K = 1, P = f(
|
|
|
91
91
|
className: f(e.className, "overflow-visible"),
|
|
92
92
|
children: [
|
|
93
93
|
e.children,
|
|
94
|
-
t ? /* @__PURE__ */
|
|
94
|
+
t ? /* @__PURE__ */ r(
|
|
95
95
|
"span",
|
|
96
96
|
{
|
|
97
97
|
className: "pointer-events-none absolute left-1/2 top-0 z-[70] -translate-x-1/2 -translate-y-[calc(100%+4px)] whitespace-nowrap rounded-md border bg-popover px-2 py-1 text-xs font-semibold text-primary shadow-md",
|
|
@@ -103,54 +103,54 @@ const se = ee, K = 1, P = f(
|
|
|
103
103
|
}
|
|
104
104
|
);
|
|
105
105
|
};
|
|
106
|
-
return /* @__PURE__ */
|
|
106
|
+
return /* @__PURE__ */ r(
|
|
107
107
|
oe,
|
|
108
108
|
{
|
|
109
|
-
open:
|
|
109
|
+
open: i,
|
|
110
110
|
lockScroll: !1,
|
|
111
111
|
onOpenChange: (e) => {
|
|
112
112
|
e || U();
|
|
113
113
|
},
|
|
114
114
|
children: /* @__PURE__ */ c(ne, { className: "overflow-hidden", children: [
|
|
115
115
|
/* @__PURE__ */ c(ae, { className: "border-b px-4 pb-3 pt-4 text-left", children: [
|
|
116
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ r(re, { className: "sr-only", children: l === "start" ? o.startDate : o.endDate }),
|
|
117
117
|
/* @__PURE__ */ c(
|
|
118
118
|
"div",
|
|
119
119
|
{
|
|
120
120
|
className: "relative grid grid-cols-2 rounded-md bg-muted p-1",
|
|
121
121
|
"aria-label": o.rentalPeriod,
|
|
122
122
|
children: [
|
|
123
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ r(
|
|
124
124
|
"span",
|
|
125
125
|
{
|
|
126
126
|
"aria-hidden": "true",
|
|
127
127
|
className: f(
|
|
128
128
|
"absolute inset-y-1 left-1 w-[calc(50%-0.25rem)] rounded bg-background shadow-sm transition-transform duration-300 ease-out",
|
|
129
|
-
|
|
129
|
+
l === "end" && "translate-x-full"
|
|
130
130
|
)
|
|
131
131
|
}
|
|
132
132
|
),
|
|
133
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ r(
|
|
134
134
|
"button",
|
|
135
135
|
{
|
|
136
136
|
type: "button",
|
|
137
|
-
"aria-pressed":
|
|
137
|
+
"aria-pressed": l === "start",
|
|
138
138
|
className: f(
|
|
139
139
|
"relative z-10 h-9 rounded px-3 text-sm font-medium transition-colors",
|
|
140
|
-
|
|
140
|
+
l === "start" ? "text-foreground" : "text-muted-foreground"
|
|
141
141
|
),
|
|
142
142
|
onClick: () => x("start"),
|
|
143
143
|
children: o.startDate
|
|
144
144
|
}
|
|
145
145
|
),
|
|
146
|
-
/* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ r(
|
|
147
147
|
"button",
|
|
148
148
|
{
|
|
149
149
|
type: "button",
|
|
150
|
-
"aria-pressed":
|
|
150
|
+
"aria-pressed": l === "end",
|
|
151
151
|
className: f(
|
|
152
152
|
"relative z-10 h-9 rounded px-3 text-sm font-medium transition-colors",
|
|
153
|
-
|
|
153
|
+
l === "end" ? "text-foreground" : "text-muted-foreground"
|
|
154
154
|
),
|
|
155
155
|
onClick: () => x("end"),
|
|
156
156
|
children: o.endDate
|
|
@@ -160,16 +160,16 @@ const se = ee, K = 1, P = f(
|
|
|
160
160
|
}
|
|
161
161
|
)
|
|
162
162
|
] }),
|
|
163
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ r("div", { className: "overflow-hidden px-4 py-4", children: /* @__PURE__ */ c(
|
|
164
164
|
"div",
|
|
165
165
|
{
|
|
166
166
|
className: f(
|
|
167
167
|
"flex w-[200%] transition-transform duration-300 ease-out",
|
|
168
|
-
|
|
168
|
+
l === "end" && "-translate-x-1/2"
|
|
169
169
|
),
|
|
170
170
|
children: [
|
|
171
|
-
/* @__PURE__ */
|
|
172
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ r("section", { className: "max-h-[calc(95dvh-9rem)] w-1/2 shrink-0 overflow-y-auto pr-4", children: /* @__PURE__ */ c("div", { className: "flex flex-col gap-4", children: [
|
|
172
|
+
/* @__PURE__ */ r(
|
|
173
173
|
F,
|
|
174
174
|
{
|
|
175
175
|
id: "start-date-calendar",
|
|
@@ -181,11 +181,11 @@ const se = ee, K = 1, P = f(
|
|
|
181
181
|
selected: n,
|
|
182
182
|
month: J,
|
|
183
183
|
onMonthChange: (e) => O(s(e)),
|
|
184
|
-
disabled: (e) => e <
|
|
184
|
+
disabled: (e) => e < d,
|
|
185
185
|
onSelect: (e) => {
|
|
186
186
|
const t = e ?? void 0, u = t != null && (n == null || !w(t, n)), m = A(t);
|
|
187
187
|
u && (v.current = !1), p(
|
|
188
|
-
Y(t, a,
|
|
188
|
+
Y(t, a, d)
|
|
189
189
|
), q(t, {
|
|
190
190
|
close: !1,
|
|
191
191
|
openEndDatePicker: !1
|
|
@@ -194,13 +194,13 @@ const se = ee, K = 1, P = f(
|
|
|
194
194
|
commit: !1
|
|
195
195
|
});
|
|
196
196
|
},
|
|
197
|
-
|
|
197
|
+
autoFocus: !0,
|
|
198
198
|
"data-testid": "start-date-calendar",
|
|
199
199
|
className: "w-full p-0",
|
|
200
200
|
classNames: $
|
|
201
201
|
}
|
|
202
202
|
),
|
|
203
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ r(
|
|
204
204
|
T,
|
|
205
205
|
{
|
|
206
206
|
type: "button",
|
|
@@ -214,8 +214,8 @@ const se = ee, K = 1, P = f(
|
|
|
214
214
|
}
|
|
215
215
|
)
|
|
216
216
|
] }) }),
|
|
217
|
-
/* @__PURE__ */
|
|
218
|
-
/* @__PURE__ */
|
|
217
|
+
/* @__PURE__ */ r("section", { className: "max-h-[calc(95dvh-9rem)] w-1/2 shrink-0 overflow-y-auto pl-4", children: /* @__PURE__ */ c("div", { className: "flex flex-col gap-4", children: [
|
|
218
|
+
/* @__PURE__ */ r(
|
|
219
219
|
F,
|
|
220
220
|
{
|
|
221
221
|
id: "end-date-calendar",
|
|
@@ -229,14 +229,14 @@ const se = ee, K = 1, P = f(
|
|
|
229
229
|
},
|
|
230
230
|
month: Q,
|
|
231
231
|
onMonthChange: (e) => p(s(e)),
|
|
232
|
-
disabled: (e) => n && e < n || e <
|
|
232
|
+
disabled: (e) => n && e < n || e < d,
|
|
233
233
|
onSelect: (e, t) => {
|
|
234
234
|
v.current = !0, b(t ?? void 0, {
|
|
235
235
|
close: !1,
|
|
236
236
|
commit: !1
|
|
237
237
|
});
|
|
238
238
|
},
|
|
239
|
-
|
|
239
|
+
autoFocus: !0,
|
|
240
240
|
"data-testid": "end-date-calendar",
|
|
241
241
|
className: "w-full p-0",
|
|
242
242
|
classNames: $,
|
|
@@ -246,7 +246,7 @@ const se = ee, K = 1, P = f(
|
|
|
246
246
|
},
|
|
247
247
|
h
|
|
248
248
|
),
|
|
249
|
-
/* @__PURE__ */
|
|
249
|
+
/* @__PURE__ */ r(
|
|
250
250
|
T,
|
|
251
251
|
{
|
|
252
252
|
type: "button",
|
|
@@ -137,7 +137,7 @@ const y = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()), z = (e) =
|
|
|
137
137
|
DayButton: k
|
|
138
138
|
},
|
|
139
139
|
disabled: (a) => a < w,
|
|
140
|
-
|
|
140
|
+
autoFocus: !0,
|
|
141
141
|
"data-testid": "start-date-calendar"
|
|
142
142
|
},
|
|
143
143
|
portalContainer: E
|
|
@@ -169,7 +169,7 @@ const y = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()), z = (e) =
|
|
|
169
169
|
DayButton: k
|
|
170
170
|
},
|
|
171
171
|
disabled: (a) => a < w,
|
|
172
|
-
|
|
172
|
+
autoFocus: !0,
|
|
173
173
|
"data-testid": "start-date-calendar"
|
|
174
174
|
}
|
|
175
175
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"day-picker.d.ts","sourceRoot":"","sources":["../../src/ui/day-picker.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAM,KAAK,cAAc,EAAE,MAAM,aAAa,CAAA;AAKrD,YAAY,EAAE,cAAc,EAAE,CAAA;AAO9B,iBAAS,SAAS,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,eAAsB,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"day-picker.d.ts","sourceRoot":"","sources":["../../src/ui/day-picker.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAM,KAAK,cAAc,EAAE,MAAM,aAAa,CAAA;AAKrD,YAAY,EAAE,cAAc,EAAE,CAAA;AAO9B,iBAAS,SAAS,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,eAAsB,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,2CA8CzG;kBA9CQ,SAAS;;;AAiDlB,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
package/dist/ui/day-picker.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { ChevronLeft as
|
|
3
|
-
import { DayPicker as
|
|
2
|
+
import { ChevronLeft as s, ChevronRight as m } from "lucide-react";
|
|
3
|
+
import { DayPicker as u } from "react-day-picker";
|
|
4
4
|
import { cn as e } from "@rpcbase/ui";
|
|
5
|
-
import { buttonVariants as
|
|
6
|
-
const
|
|
7
|
-
function
|
|
5
|
+
import { buttonVariants as a } from "./button.js";
|
|
6
|
+
const l = u;
|
|
7
|
+
function p({ className: o, classNames: n, components: i, showOutsideDays: d = !0, ...c }) {
|
|
8
8
|
return /* @__PURE__ */ r(
|
|
9
|
-
|
|
9
|
+
l,
|
|
10
10
|
{
|
|
11
11
|
weekStartsOn: 1,
|
|
12
|
-
showOutsideDays:
|
|
13
|
-
className: e("p-3",
|
|
12
|
+
showOutsideDays: d,
|
|
13
|
+
className: e("p-3", o),
|
|
14
14
|
classNames: {
|
|
15
15
|
month: "space-y-4",
|
|
16
16
|
months: "flex flex-col sm:flex-row space-y-4 sm:space-y-0 relative gap-2",
|
|
@@ -18,25 +18,20 @@ function l({ className: a, classNames: n, components: d, showOutsideDays: i = !0
|
|
|
18
18
|
month_grid: "w-full border-collapse space-y-1",
|
|
19
19
|
caption_label: "text-sm font-medium",
|
|
20
20
|
nav: "flex items-center justify-between absolute inset-x-0",
|
|
21
|
-
button_previous: e(
|
|
22
|
-
button_next: e(
|
|
21
|
+
button_previous: e(a({ variant: "outline" }), "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100 z-10"),
|
|
22
|
+
button_next: e(a({ variant: "outline" }), "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100 z-10"),
|
|
23
23
|
weeks: "w-full border-collapse",
|
|
24
24
|
weekdays: "flex",
|
|
25
25
|
weekday: "text-muted-foreground rounded-md w-9 font-normal text-xs",
|
|
26
26
|
week: "flex w-full mt-2",
|
|
27
27
|
day: "h-9 w-9 p-0 font-normal aria-selected:opacity-100 rounded-md first:aria-selected:rounded-l-md last:aria-selected:rounded-r-md",
|
|
28
28
|
day_button: e(
|
|
29
|
-
|
|
29
|
+
a({ variant: "ghost" }),
|
|
30
30
|
"h-9 w-9 text-center text-sm p-0 relative focus-within:relative focus-within:z-20"
|
|
31
31
|
),
|
|
32
32
|
range_start: "day-range-start !bg-accent rounded-l-md [&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:hover:bg-primary [&>button]:hover:text-primary-foreground",
|
|
33
33
|
range_end: "day-range-end !bg-accent rounded-r-md [&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:hover:bg-primary [&>button]:hover:text-primary-foreground",
|
|
34
34
|
range_middle: "aria-selected:bg-accent aria-selected:text-accent-foreground !rounded-none",
|
|
35
|
-
day_selected: "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
|
|
36
|
-
day_today: "bg-accent text-accent-foreground",
|
|
37
|
-
day_outside: "day-outside text-muted-foreground aria-selected:text-muted-foreground",
|
|
38
|
-
day_disabled: "text-muted-foreground opacity-50",
|
|
39
|
-
day_hidden: "invisible",
|
|
40
35
|
selected: "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
|
|
41
36
|
today: "bg-gray-50 text-accent-foreground !rounded-md",
|
|
42
37
|
outside: "day-outside text-muted-foreground opacity-50 !aria-selected:bg-accent/50 !aria-selected:text-muted-foreground !aria-selected:opacity-30",
|
|
@@ -45,14 +40,14 @@ function l({ className: a, classNames: n, components: d, showOutsideDays: i = !0
|
|
|
45
40
|
...n
|
|
46
41
|
},
|
|
47
42
|
components: {
|
|
48
|
-
Chevron: ({ ...t }) => t.orientation === "left" ? /* @__PURE__ */ r(
|
|
49
|
-
...
|
|
43
|
+
Chevron: ({ ...t }) => t.orientation === "left" ? /* @__PURE__ */ r(s, { ...t, className: "h-4 w-4" }) : /* @__PURE__ */ r(m, { ...t, className: "h-4 w-4" }),
|
|
44
|
+
...i
|
|
50
45
|
},
|
|
51
|
-
...
|
|
46
|
+
...c
|
|
52
47
|
}
|
|
53
48
|
);
|
|
54
49
|
}
|
|
55
|
-
|
|
50
|
+
p.displayName = "DayPicker";
|
|
56
51
|
export {
|
|
57
|
-
|
|
52
|
+
p as DayPicker
|
|
58
53
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loczer/storefront-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.171.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"typecheck": {
|
|
76
|
-
"command": "tsc --noEmit",
|
|
76
|
+
"command": "node ../../node_modules/typescript/bin/tsc --noEmit",
|
|
77
77
|
"dependencies": [
|
|
78
78
|
"../booking-engine:build",
|
|
79
79
|
"../ui:types:build"
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
]
|
|
112
112
|
},
|
|
113
113
|
"test": {
|
|
114
|
-
"command": "tsc --noEmit && playwright test",
|
|
114
|
+
"command": "node ../../node_modules/typescript/bin/tsc --noEmit && playwright test",
|
|
115
115
|
"dependencies": [
|
|
116
116
|
"../booking-engine:build",
|
|
117
117
|
"../ui:build"
|