@loczer/storefront-sdk 0.172.0 → 0.174.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/BookingMobileDateDrawer.d.ts.map +1 -1
- package/dist/components/BookingPeriodSelector/components/BookingMobileDateDrawer.js +163 -155
- package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts +1 -0
- package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/storefront.css +1 -1
- package/dist/ui/drawer.d.ts +3 -0
- package/dist/ui/drawer.d.ts.map +1 -1
- package/dist/ui/drawer.js +118 -97
- package/package.json +1 -1
package/dist/ui/drawer.d.ts
CHANGED
|
@@ -35,11 +35,14 @@ declare const DrawerOverlay: React.ForwardRefExoticComponent<React.HTMLAttribute
|
|
|
35
35
|
}) => void;
|
|
36
36
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
37
37
|
declare const DrawerContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
38
|
+
closeButtonTestId?: string;
|
|
39
|
+
closeLabel?: string;
|
|
38
40
|
onPointerDownOutside?: (event: {
|
|
39
41
|
detail: {
|
|
40
42
|
originalEvent: PointerEvent;
|
|
41
43
|
};
|
|
42
44
|
}) => void;
|
|
45
|
+
showCloseButton?: boolean;
|
|
43
46
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
44
47
|
declare function DrawerHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
45
48
|
declare function DrawerFooter({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
package/dist/ui/drawer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/ui/drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,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C,EAAE,WAAW,GAAG,IAAI,CAAA;CAC/B,CAAA;AAED,iBAAS,YAAY,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,iBAAiB,4BAmB/D;AAMD,QAAA,MAAM,WAAW;cAHL,OAAO;2CAsBlB,CAAA;AAOD,QAAA,MAAM,aAAa;2BAHM,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE;YAAE,aAAa,EAAE,YAAY,CAAA;SAAE,CAAA;KAAE,KAAK,IAAI;wCAiCpF,CAAA;AAUD,QAAA,MAAM,aAAa;wBANG,MAAM;iBACb,MAAM;2BACI,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE;YAAE,aAAa,EAAE,YAAY,CAAA;SAAE,CAAA;KAAE,KAAK,IAAI;sBACjE,OAAO;wCAsE1B,CAAA;AAGD,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAWzE;AAED,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAQzE;AAED,QAAA,MAAM,WAAW,qHAUf,CAAA;AAGF,QAAA,MAAM,iBAAiB,yHAUrB,CAAA;AAGF,OAAO,EACL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,aAAa,EACb,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,GAClB,CAAA"}
|
package/dist/ui/drawer.js
CHANGED
|
@@ -1,142 +1,163 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as n, jsxs as h } from "react/jsx-runtime";
|
|
2
2
|
import * as a from "react";
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { createPortal as O } from "react-dom";
|
|
4
|
+
import { X as R } from "lucide-react";
|
|
5
|
+
import { cn as u } from "@rpcbase/ui";
|
|
6
|
+
import { useAriaHiddenSiblings as S } from "./modal-aria.js";
|
|
7
|
+
import { Slot as y } from "./slot.js";
|
|
8
|
+
const D = a.createContext(null), f = () => {
|
|
9
|
+
const e = a.useContext(D);
|
|
9
10
|
if (!e)
|
|
10
11
|
throw new Error("Drawer components must be used within <Drawer>");
|
|
11
12
|
return e;
|
|
12
13
|
};
|
|
13
|
-
function
|
|
14
|
+
function U({
|
|
14
15
|
open: e,
|
|
15
16
|
defaultOpen: t = !1,
|
|
16
17
|
onOpenChange: r,
|
|
17
|
-
direction:
|
|
18
|
-
children:
|
|
19
|
-
modal:
|
|
18
|
+
direction: i = "bottom",
|
|
19
|
+
children: s,
|
|
20
|
+
modal: l = !0,
|
|
20
21
|
dismissible: o = !0,
|
|
21
|
-
fixed:
|
|
22
|
-
repositionInputs:
|
|
23
|
-
snapPoints:
|
|
24
|
-
activeSnapPoint:
|
|
25
|
-
setActiveSnapPoint:
|
|
26
|
-
lockScroll:
|
|
22
|
+
fixed: m,
|
|
23
|
+
repositionInputs: d,
|
|
24
|
+
snapPoints: b,
|
|
25
|
+
activeSnapPoint: g,
|
|
26
|
+
setActiveSnapPoint: c,
|
|
27
|
+
lockScroll: p = !0
|
|
27
28
|
}) {
|
|
28
|
-
const [
|
|
29
|
-
|
|
29
|
+
const [N, k] = a.useState(t), v = e !== void 0, x = v ? e : N, E = (w) => {
|
|
30
|
+
v || k(w), r?.(w);
|
|
30
31
|
};
|
|
31
32
|
return a.useEffect(() => {
|
|
32
|
-
if (!
|
|
33
|
+
if (!x || !p || typeof document > "u")
|
|
33
34
|
return;
|
|
34
|
-
const
|
|
35
|
+
const w = document.body.style.overflow;
|
|
35
36
|
return document.body.style.overflow = "hidden", () => {
|
|
36
|
-
document.body.style.overflow =
|
|
37
|
+
document.body.style.overflow = w;
|
|
37
38
|
};
|
|
38
|
-
}, [
|
|
39
|
+
}, [p, x]), /* @__PURE__ */ n(D.Provider, { value: { open: x, setOpen: E, direction: i, modal: l, dismissible: o }, children: s });
|
|
39
40
|
}
|
|
40
|
-
const
|
|
41
|
-
({ asChild: e, onClick: t, ...r },
|
|
42
|
-
const { setOpen:
|
|
43
|
-
return /* @__PURE__ */
|
|
44
|
-
e ?
|
|
41
|
+
const z = a.forwardRef(
|
|
42
|
+
({ asChild: e, onClick: t, ...r }, i) => {
|
|
43
|
+
const { setOpen: s } = f();
|
|
44
|
+
return /* @__PURE__ */ n(
|
|
45
|
+
e ? y : "button",
|
|
45
46
|
{
|
|
46
|
-
ref:
|
|
47
|
+
ref: i,
|
|
47
48
|
"data-slot": "drawer-trigger",
|
|
48
49
|
onClick: (o) => {
|
|
49
|
-
t?.(o), o.defaultPrevented ||
|
|
50
|
+
t?.(o), o.defaultPrevented || s(!0);
|
|
50
51
|
},
|
|
51
52
|
...r
|
|
52
53
|
}
|
|
53
54
|
);
|
|
54
55
|
}
|
|
55
56
|
);
|
|
56
|
-
|
|
57
|
-
function
|
|
58
|
-
const { open: r, modal:
|
|
57
|
+
z.displayName = "DrawerTrigger";
|
|
58
|
+
function _({ children: e, container: t }) {
|
|
59
|
+
const { open: r, modal: i } = f(), [s, l] = a.useState(!1), o = a.useRef(null);
|
|
59
60
|
return a.useEffect(() => {
|
|
60
|
-
|
|
61
|
-
}, []),
|
|
62
|
-
/* @__PURE__ */
|
|
61
|
+
l(!0);
|
|
62
|
+
}, []), S(r && s && i, o), !r || !s || typeof document > "u" ? null : O(
|
|
63
|
+
/* @__PURE__ */ n("div", { ref: o, "data-slot": "drawer-portal", children: e }),
|
|
63
64
|
t ?? document.body
|
|
64
65
|
);
|
|
65
66
|
}
|
|
66
|
-
const
|
|
67
|
-
({ asChild: e, onClick: t, ...r },
|
|
68
|
-
const { setOpen:
|
|
69
|
-
return /* @__PURE__ */
|
|
70
|
-
e ?
|
|
67
|
+
const C = a.forwardRef(
|
|
68
|
+
({ asChild: e, onClick: t, ...r }, i) => {
|
|
69
|
+
const { setOpen: s } = f();
|
|
70
|
+
return /* @__PURE__ */ n(
|
|
71
|
+
e ? y : "button",
|
|
71
72
|
{
|
|
72
|
-
ref:
|
|
73
|
+
ref: i,
|
|
73
74
|
"data-slot": "drawer-close",
|
|
74
75
|
onClick: (o) => {
|
|
75
|
-
t?.(o), o.defaultPrevented ||
|
|
76
|
+
t?.(o), o.defaultPrevented || s(!1);
|
|
76
77
|
},
|
|
77
78
|
...r
|
|
78
79
|
}
|
|
79
80
|
);
|
|
80
81
|
}
|
|
81
82
|
);
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
({ className: e, onClick: t, onPointerDownOutside: r, ...
|
|
85
|
-
const { setOpen:
|
|
86
|
-
t?.(
|
|
83
|
+
C.displayName = "DrawerClose";
|
|
84
|
+
const P = a.forwardRef(
|
|
85
|
+
({ className: e, onClick: t, onPointerDownOutside: r, ...i }, s) => {
|
|
86
|
+
const { setOpen: l, dismissible: o } = f(), m = (d) => {
|
|
87
|
+
t?.(d), !(d.defaultPrevented || !o) && (d.stopPropagation(), l(!1));
|
|
87
88
|
};
|
|
88
|
-
return /* @__PURE__ */
|
|
89
|
+
return /* @__PURE__ */ n(
|
|
89
90
|
"div",
|
|
90
91
|
{
|
|
91
|
-
ref:
|
|
92
|
+
ref: s,
|
|
92
93
|
"data-slot": "drawer-overlay",
|
|
93
94
|
"data-state": "open",
|
|
94
|
-
className:
|
|
95
|
+
className: u(
|
|
95
96
|
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
96
97
|
e
|
|
97
98
|
),
|
|
98
|
-
onPointerDown: (
|
|
99
|
-
r?.({ detail: { originalEvent:
|
|
99
|
+
onPointerDown: (d) => {
|
|
100
|
+
r?.({ detail: { originalEvent: d.nativeEvent } });
|
|
100
101
|
},
|
|
101
|
-
onClick:
|
|
102
|
-
...
|
|
102
|
+
onClick: m,
|
|
103
|
+
...i
|
|
103
104
|
}
|
|
104
105
|
);
|
|
105
106
|
}
|
|
106
107
|
);
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
({
|
|
110
|
-
|
|
108
|
+
P.displayName = "DrawerOverlay";
|
|
109
|
+
const T = a.forwardRef(
|
|
110
|
+
({
|
|
111
|
+
className: e,
|
|
112
|
+
children: t,
|
|
113
|
+
closeButtonTestId: r = "drawer-close",
|
|
114
|
+
closeLabel: i = "Close",
|
|
115
|
+
onPointerDownOutside: s,
|
|
116
|
+
showCloseButton: l = !1,
|
|
117
|
+
...o
|
|
118
|
+
}, m) => {
|
|
119
|
+
const { direction: d, setOpen: b, dismissible: g } = f();
|
|
111
120
|
return a.useEffect(() => {
|
|
112
121
|
if (typeof document > "u")
|
|
113
122
|
return;
|
|
114
|
-
const
|
|
115
|
-
|
|
123
|
+
const c = (p) => {
|
|
124
|
+
g && p.key === "Escape" && b(!1);
|
|
116
125
|
};
|
|
117
|
-
return document.addEventListener("keydown",
|
|
118
|
-
}, [
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
/* @__PURE__ */
|
|
126
|
+
return document.addEventListener("keydown", c), () => document.removeEventListener("keydown", c);
|
|
127
|
+
}, [g, b]), /* @__PURE__ */ h(_, { children: [
|
|
128
|
+
/* @__PURE__ */ n(P, { onPointerDownOutside: s }),
|
|
129
|
+
/* @__PURE__ */ h(
|
|
121
130
|
"div",
|
|
122
131
|
{
|
|
123
|
-
ref:
|
|
132
|
+
ref: m,
|
|
124
133
|
"data-slot": "drawer-content",
|
|
125
|
-
"data-drawer-direction":
|
|
134
|
+
"data-drawer-direction": d,
|
|
126
135
|
"data-state": "open",
|
|
127
136
|
role: "dialog",
|
|
128
137
|
"aria-modal": "true",
|
|
129
|
-
className:
|
|
138
|
+
className: u(
|
|
130
139
|
"group/drawer-content bg-background fixed z-50 flex h-auto flex-col",
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
140
|
+
d === "top" && "inset-x-0 top-0 mb-24 max-h-[80vh] rounded-b-lg border-b",
|
|
141
|
+
d === "bottom" && "inset-x-0 bottom-0 max-h-[95dvh] rounded-t-lg border-t",
|
|
142
|
+
d === "right" && "inset-y-0 right-0 w-3/4 border-l sm:max-w-sm",
|
|
143
|
+
d === "left" && "inset-y-0 left-0 w-3/4 border-r sm:max-w-sm",
|
|
135
144
|
e
|
|
136
145
|
),
|
|
137
|
-
...
|
|
146
|
+
...o,
|
|
138
147
|
children: [
|
|
139
|
-
/* @__PURE__ */
|
|
148
|
+
/* @__PURE__ */ n("div", { className: "bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[drawer-direction=bottom]/drawer-content:block" }),
|
|
149
|
+
l ? /* @__PURE__ */ n(C, { asChild: !0, children: /* @__PURE__ */ n(
|
|
150
|
+
"button",
|
|
151
|
+
{
|
|
152
|
+
type: "button",
|
|
153
|
+
className: "absolute right-4 top-2 z-20 flex size-10 items-center justify-center rounded-full bg-background/90 text-muted-foreground shadow-sm ring-1 ring-border backdrop-blur-sm transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
154
|
+
"aria-label": i,
|
|
155
|
+
"data-testid": r,
|
|
156
|
+
onClick: (c) => c.stopPropagation(),
|
|
157
|
+
onPointerDown: (c) => c.stopPropagation(),
|
|
158
|
+
children: /* @__PURE__ */ n(R, { className: "size-5", "aria-hidden": "true" })
|
|
159
|
+
}
|
|
160
|
+
) }) : null,
|
|
140
161
|
t
|
|
141
162
|
]
|
|
142
163
|
}
|
|
@@ -144,13 +165,13 @@ const S = a.forwardRef(
|
|
|
144
165
|
] });
|
|
145
166
|
}
|
|
146
167
|
);
|
|
147
|
-
|
|
148
|
-
function
|
|
149
|
-
return /* @__PURE__ */
|
|
168
|
+
T.displayName = "DrawerContent";
|
|
169
|
+
function X({ className: e, ...t }) {
|
|
170
|
+
return /* @__PURE__ */ n(
|
|
150
171
|
"div",
|
|
151
172
|
{
|
|
152
173
|
"data-slot": "drawer-header",
|
|
153
|
-
className:
|
|
174
|
+
className: u(
|
|
154
175
|
"flex flex-col gap-0.5 p-4 group-data-[drawer-direction=bottom]/drawer-content:text-center group-data-[drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
|
|
155
176
|
e
|
|
156
177
|
),
|
|
@@ -158,45 +179,45 @@ function M({ className: e, ...t }) {
|
|
|
158
179
|
}
|
|
159
180
|
);
|
|
160
181
|
}
|
|
161
|
-
function
|
|
162
|
-
return /* @__PURE__ */
|
|
182
|
+
function q({ className: e, ...t }) {
|
|
183
|
+
return /* @__PURE__ */ n(
|
|
163
184
|
"div",
|
|
164
185
|
{
|
|
165
186
|
"data-slot": "drawer-footer",
|
|
166
|
-
className:
|
|
187
|
+
className: u("mt-auto flex flex-col gap-2 p-4", e),
|
|
167
188
|
...t
|
|
168
189
|
}
|
|
169
190
|
);
|
|
170
191
|
}
|
|
171
|
-
const
|
|
192
|
+
const j = a.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
172
193
|
"h2",
|
|
173
194
|
{
|
|
174
195
|
ref: r,
|
|
175
196
|
"data-slot": "drawer-title",
|
|
176
|
-
className:
|
|
197
|
+
className: u("text-foreground font-semibold", e),
|
|
177
198
|
...t
|
|
178
199
|
}
|
|
179
200
|
));
|
|
180
|
-
|
|
181
|
-
const
|
|
201
|
+
j.displayName = "DrawerTitle";
|
|
202
|
+
const A = a.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ n(
|
|
182
203
|
"p",
|
|
183
204
|
{
|
|
184
205
|
ref: r,
|
|
185
206
|
"data-slot": "drawer-description",
|
|
186
|
-
className:
|
|
207
|
+
className: u("text-muted-foreground text-sm", e),
|
|
187
208
|
...t
|
|
188
209
|
}
|
|
189
210
|
));
|
|
190
|
-
|
|
211
|
+
A.displayName = "DrawerDescription";
|
|
191
212
|
export {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
213
|
+
U as Drawer,
|
|
214
|
+
C as DrawerClose,
|
|
215
|
+
T as DrawerContent,
|
|
216
|
+
A as DrawerDescription,
|
|
217
|
+
q as DrawerFooter,
|
|
218
|
+
X as DrawerHeader,
|
|
219
|
+
P as DrawerOverlay,
|
|
220
|
+
_ as DrawerPortal,
|
|
221
|
+
j as DrawerTitle,
|
|
222
|
+
z as DrawerTrigger
|
|
202
223
|
};
|