@spear-ai/spectral 1.3.10 → 1.3.12
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/.js +91 -0
- package/dist/Accordion/AccordionBase.js +233 -0
- package/dist/App.js +8 -0
- package/dist/Badge/BadgeBase.js +35 -0
- package/dist/Badge.js +7 -0
- package/dist/Button.js +99 -0
- package/dist/Card.js +35 -0
- package/dist/Checkbox/CheckboxBase.js +141 -0
- package/dist/Drawer.js +1293 -0
- package/dist/Icons/AnnotationsIcon.js +28 -0
- package/dist/Icons/CalendarIcon.js +60 -0
- package/dist/Icons/ClockIcon.js +40 -0
- package/dist/Icons/DeleteIcon.js +32 -0
- package/dist/Icons/DurationIcon.js +80 -0
- package/dist/Icons/EraserIcon.js +37 -0
- package/dist/Icons/GoToFirstIcon.js +40 -0
- package/dist/Icons/GoToLastIcon.js +40 -0
- package/dist/Icons/IconBase.js +33 -0
- package/dist/Icons/LabelIcon.js +27 -0
- package/dist/Icons/LassoIcon.js +50 -0
- package/dist/Icons/LineToolIcon.js +96 -0
- package/dist/Icons/LiveViewIcon.js +70 -0
- package/dist/Icons/LocationIcon.js +40 -0
- package/dist/Icons/MetadataIcon.js +28 -0
- package/dist/Icons/OntologyIcon.js +31 -0
- package/dist/Icons/PlayIcon.js +28 -0
- package/dist/Icons/PlusIcon.js +27 -0
- package/dist/Icons/ResetIcon.js +25 -0
- package/dist/Icons/ScissorsIcon.js +36 -0
- package/dist/Icons/TrashIcon.js +25 -0
- package/dist/Icons/UndoIcon.js +28 -0
- package/dist/Icons/ZoomAllIcon.js +28 -0
- package/dist/Icons/ZoomXIcon.js +41 -0
- package/dist/Icons/ZoomYIcon.js +41 -0
- package/dist/Icons/iconTypes.js +2 -0
- package/dist/Icons.js +51 -0
- package/dist/Label.js +13 -0
- package/dist/Popover.js +250 -0
- package/dist/RadioGroup/RadioGroupBase.js +254 -0
- package/dist/Skeleton.js +10 -0
- package/dist/Slider/SliderBase.js +315 -0
- package/dist/Slider.js +74 -0
- package/dist/Switch/SwitchBase.js +131 -0
- package/dist/Switch.js +59 -0
- package/dist/Toggle/ToggleBase.js +51 -0
- package/dist/Toggle.js +51 -0
- package/dist/ToggleGroup/ToggleGroupBase.js +125 -0
- package/dist/ToggleGroup.js +53 -0
- package/dist/Toolbar.js +13 -0
- package/dist/Tooltip/TooltipBase.js +225 -0
- package/dist/Tooltip.js +371 -0
- package/dist/features/LabelingTools/LabelingTools.d.ts.map +1 -0
- package/dist/features/LabelingTools.js +107 -0
- package/dist/hooks/useAccordionAutoScroll.js +65 -0
- package/dist/hooks/useOutsideClick.js +16 -0
- package/dist/hooks/useTheme.js +19 -0
- package/dist/index-B7LSgz_k.js +446 -0
- package/dist/index-CRBC94ik.js +34 -0
- package/dist/index-gg2zpNk0.js +672 -0
- package/dist/index-sDEISz8i.js +1558 -0
- package/dist/loader-circle-Btf6jOd5.js +101 -0
- package/dist/main.js +25212 -0
- package/dist/primitives/label.js +27 -0
- package/dist/primitives/slot.js +40 -0
- package/dist/twUtils-CRiPKpXj.js +2743 -0
- package/dist/utils/refs.js +10 -0
- package/dist/utils/shared.js +29 -0
- package/dist/utils/twUtils.js +5 -0
- package/package.json +19 -7
- package/dist/components/LabelingTools/LabelingTools.d.ts.map +0 -1
- package/dist/index.js +0 -9253
- package/dist/spectral.cjs.js +0 -83
- /package/dist/{components → features}/LabelingTools/LabelingTools.d.ts +0 -0
package/dist/Drawer.js
ADDED
|
@@ -0,0 +1,1293 @@
|
|
|
1
|
+
import(/* @vite-ignore */ new URL('./assets/main.css', import.meta.url).href)
|
|
2
|
+
import { jsx as S, jsxs as gt, Fragment as te } from "react/jsx-runtime";
|
|
3
|
+
import * as O from "react";
|
|
4
|
+
import i, { useMemo as je, useLayoutEffect as qe, useEffect as Xe } from "react";
|
|
5
|
+
import { c as Ge, P as kt, g as Ke, e as wt, d as Ht, f as ht, D as Je, i as Ze, u as Qe, a as Pt, b as tn } from "./index-B7LSgz_k.js";
|
|
6
|
+
import { R as en, h as nn, u as rn, F as an } from "./index-gg2zpNk0.js";
|
|
7
|
+
var Tt = "Dialog", [oe, er] = Ge(Tt), [on, q] = oe(Tt), ie = (t) => {
|
|
8
|
+
const {
|
|
9
|
+
__scopeDialog: n,
|
|
10
|
+
children: e,
|
|
11
|
+
open: a,
|
|
12
|
+
defaultOpen: o,
|
|
13
|
+
onOpenChange: r,
|
|
14
|
+
modal: l = !0
|
|
15
|
+
} = t, s = O.useRef(null), v = O.useRef(null), [D, g] = Qe({
|
|
16
|
+
prop: a,
|
|
17
|
+
defaultProp: o ?? !1,
|
|
18
|
+
onChange: r,
|
|
19
|
+
caller: Tt
|
|
20
|
+
});
|
|
21
|
+
return /* @__PURE__ */ S(
|
|
22
|
+
on,
|
|
23
|
+
{
|
|
24
|
+
scope: n,
|
|
25
|
+
triggerRef: s,
|
|
26
|
+
contentRef: v,
|
|
27
|
+
contentId: Pt(),
|
|
28
|
+
titleId: Pt(),
|
|
29
|
+
descriptionId: Pt(),
|
|
30
|
+
open: D,
|
|
31
|
+
onOpenChange: g,
|
|
32
|
+
onOpenToggle: O.useCallback(() => g((m) => !m), [g]),
|
|
33
|
+
modal: l,
|
|
34
|
+
children: e
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
ie.displayName = Tt;
|
|
39
|
+
var se = "DialogTrigger", le = O.forwardRef(
|
|
40
|
+
(t, n) => {
|
|
41
|
+
const { __scopeDialog: e, ...a } = t, o = q(se, e), r = Ht(n, o.triggerRef);
|
|
42
|
+
return /* @__PURE__ */ S(
|
|
43
|
+
wt.button,
|
|
44
|
+
{
|
|
45
|
+
type: "button",
|
|
46
|
+
"aria-haspopup": "dialog",
|
|
47
|
+
"aria-expanded": o.open,
|
|
48
|
+
"aria-controls": o.contentId,
|
|
49
|
+
"data-state": Ut(o.open),
|
|
50
|
+
...a,
|
|
51
|
+
ref: r,
|
|
52
|
+
onClick: ht(t.onClick, o.onOpenToggle)
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
le.displayName = se;
|
|
58
|
+
var Bt = "DialogPortal", [sn, ue] = oe(Bt, {
|
|
59
|
+
forceMount: void 0
|
|
60
|
+
}), ce = (t) => {
|
|
61
|
+
const { __scopeDialog: n, forceMount: e, children: a, container: o } = t, r = q(Bt, n);
|
|
62
|
+
return /* @__PURE__ */ S(sn, { scope: n, forceMount: e, children: O.Children.map(a, (l) => /* @__PURE__ */ S(kt, { present: e || r.open, children: /* @__PURE__ */ S(tn, { asChild: !0, container: o, children: l }) })) });
|
|
63
|
+
};
|
|
64
|
+
ce.displayName = Bt;
|
|
65
|
+
var St = "DialogOverlay", de = O.forwardRef(
|
|
66
|
+
(t, n) => {
|
|
67
|
+
const e = ue(St, t.__scopeDialog), { forceMount: a = e.forceMount, ...o } = t, r = q(St, t.__scopeDialog);
|
|
68
|
+
return r.modal ? /* @__PURE__ */ S(kt, { present: a || r.open, children: /* @__PURE__ */ S(un, { ...o, ref: n }) }) : null;
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
de.displayName = St;
|
|
72
|
+
var ln = Ke("DialogOverlay.RemoveScroll"), un = O.forwardRef(
|
|
73
|
+
(t, n) => {
|
|
74
|
+
const { __scopeDialog: e, ...a } = t, o = q(St, e);
|
|
75
|
+
return (
|
|
76
|
+
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
77
|
+
// ie. when `Overlay` and `Content` are siblings
|
|
78
|
+
/* @__PURE__ */ S(en, { as: ln, allowPinchZoom: !0, shards: [o.contentRef], children: /* @__PURE__ */ S(
|
|
79
|
+
wt.div,
|
|
80
|
+
{
|
|
81
|
+
"data-state": Ut(o.open),
|
|
82
|
+
...a,
|
|
83
|
+
ref: n,
|
|
84
|
+
style: { pointerEvents: "auto", ...a.style }
|
|
85
|
+
}
|
|
86
|
+
) })
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
), at = "DialogContent", fe = O.forwardRef(
|
|
90
|
+
(t, n) => {
|
|
91
|
+
const e = ue(at, t.__scopeDialog), { forceMount: a = e.forceMount, ...o } = t, r = q(at, t.__scopeDialog);
|
|
92
|
+
return /* @__PURE__ */ S(kt, { present: a || r.open, children: r.modal ? /* @__PURE__ */ S(cn, { ...o, ref: n }) : /* @__PURE__ */ S(dn, { ...o, ref: n }) });
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
fe.displayName = at;
|
|
96
|
+
var cn = O.forwardRef(
|
|
97
|
+
(t, n) => {
|
|
98
|
+
const e = q(at, t.__scopeDialog), a = O.useRef(null), o = Ht(n, e.contentRef, a);
|
|
99
|
+
return O.useEffect(() => {
|
|
100
|
+
const r = a.current;
|
|
101
|
+
if (r) return nn(r);
|
|
102
|
+
}, []), /* @__PURE__ */ S(
|
|
103
|
+
pe,
|
|
104
|
+
{
|
|
105
|
+
...t,
|
|
106
|
+
ref: o,
|
|
107
|
+
trapFocus: e.open,
|
|
108
|
+
disableOutsidePointerEvents: !0,
|
|
109
|
+
onCloseAutoFocus: ht(t.onCloseAutoFocus, (r) => {
|
|
110
|
+
r.preventDefault(), e.triggerRef.current?.focus();
|
|
111
|
+
}),
|
|
112
|
+
onPointerDownOutside: ht(t.onPointerDownOutside, (r) => {
|
|
113
|
+
const l = r.detail.originalEvent, s = l.button === 0 && l.ctrlKey === !0;
|
|
114
|
+
(l.button === 2 || s) && r.preventDefault();
|
|
115
|
+
}),
|
|
116
|
+
onFocusOutside: ht(
|
|
117
|
+
t.onFocusOutside,
|
|
118
|
+
(r) => r.preventDefault()
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
), dn = O.forwardRef(
|
|
124
|
+
(t, n) => {
|
|
125
|
+
const e = q(at, t.__scopeDialog), a = O.useRef(!1), o = O.useRef(!1);
|
|
126
|
+
return /* @__PURE__ */ S(
|
|
127
|
+
pe,
|
|
128
|
+
{
|
|
129
|
+
...t,
|
|
130
|
+
ref: n,
|
|
131
|
+
trapFocus: !1,
|
|
132
|
+
disableOutsidePointerEvents: !1,
|
|
133
|
+
onCloseAutoFocus: (r) => {
|
|
134
|
+
t.onCloseAutoFocus?.(r), r.defaultPrevented || (a.current || e.triggerRef.current?.focus(), r.preventDefault()), a.current = !1, o.current = !1;
|
|
135
|
+
},
|
|
136
|
+
onInteractOutside: (r) => {
|
|
137
|
+
t.onInteractOutside?.(r), r.defaultPrevented || (a.current = !0, r.detail.originalEvent.type === "pointerdown" && (o.current = !0));
|
|
138
|
+
const l = r.target;
|
|
139
|
+
e.triggerRef.current?.contains(l) && r.preventDefault(), r.detail.originalEvent.type === "focusin" && o.current && r.preventDefault();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
), pe = O.forwardRef(
|
|
145
|
+
(t, n) => {
|
|
146
|
+
const { __scopeDialog: e, trapFocus: a, onOpenAutoFocus: o, onCloseAutoFocus: r, ...l } = t, s = q(at, e), v = O.useRef(null), D = Ht(n, v);
|
|
147
|
+
return rn(), /* @__PURE__ */ gt(te, { children: [
|
|
148
|
+
/* @__PURE__ */ S(
|
|
149
|
+
an,
|
|
150
|
+
{
|
|
151
|
+
asChild: !0,
|
|
152
|
+
loop: !0,
|
|
153
|
+
trapped: a,
|
|
154
|
+
onMountAutoFocus: o,
|
|
155
|
+
onUnmountAutoFocus: r,
|
|
156
|
+
children: /* @__PURE__ */ S(
|
|
157
|
+
Je,
|
|
158
|
+
{
|
|
159
|
+
role: "dialog",
|
|
160
|
+
id: s.contentId,
|
|
161
|
+
"aria-describedby": s.descriptionId,
|
|
162
|
+
"aria-labelledby": s.titleId,
|
|
163
|
+
"data-state": Ut(s.open),
|
|
164
|
+
...l,
|
|
165
|
+
ref: D,
|
|
166
|
+
onDismiss: () => s.onOpenChange(!1)
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
/* @__PURE__ */ gt(te, { children: [
|
|
172
|
+
/* @__PURE__ */ S(fn, { titleId: s.titleId }),
|
|
173
|
+
/* @__PURE__ */ S(mn, { contentRef: v, descriptionId: s.descriptionId })
|
|
174
|
+
] })
|
|
175
|
+
] });
|
|
176
|
+
}
|
|
177
|
+
), Wt = "DialogTitle", me = O.forwardRef(
|
|
178
|
+
(t, n) => {
|
|
179
|
+
const { __scopeDialog: e, ...a } = t, o = q(Wt, e);
|
|
180
|
+
return /* @__PURE__ */ S(wt.h2, { id: o.titleId, ...a, ref: n });
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
me.displayName = Wt;
|
|
184
|
+
var ge = "DialogDescription", he = O.forwardRef(
|
|
185
|
+
(t, n) => {
|
|
186
|
+
const { __scopeDialog: e, ...a } = t, o = q(ge, e);
|
|
187
|
+
return /* @__PURE__ */ S(wt.p, { id: o.descriptionId, ...a, ref: n });
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
he.displayName = ge;
|
|
191
|
+
var we = "DialogClose", ve = O.forwardRef(
|
|
192
|
+
(t, n) => {
|
|
193
|
+
const { __scopeDialog: e, ...a } = t, o = q(we, e);
|
|
194
|
+
return /* @__PURE__ */ S(
|
|
195
|
+
wt.button,
|
|
196
|
+
{
|
|
197
|
+
type: "button",
|
|
198
|
+
...a,
|
|
199
|
+
ref: n,
|
|
200
|
+
onClick: ht(t.onClick, () => o.onOpenChange(!1))
|
|
201
|
+
}
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
ve.displayName = we;
|
|
206
|
+
function Ut(t) {
|
|
207
|
+
return t ? "open" : "closed";
|
|
208
|
+
}
|
|
209
|
+
var ye = "DialogTitleWarning", [nr, be] = Ze(ye, {
|
|
210
|
+
contentName: at,
|
|
211
|
+
titleName: Wt,
|
|
212
|
+
docsSlug: "dialog"
|
|
213
|
+
}), fn = ({ titleId: t }) => {
|
|
214
|
+
const n = be(ye), e = `\`${n.contentName}\` requires a \`${n.titleName}\` for the component to be accessible for screen reader users.
|
|
215
|
+
|
|
216
|
+
If you want to hide the \`${n.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
217
|
+
|
|
218
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${n.docsSlug}`;
|
|
219
|
+
return O.useEffect(() => {
|
|
220
|
+
t && (document.getElementById(t) || console.error(e));
|
|
221
|
+
}, [e, t]), null;
|
|
222
|
+
}, pn = "DialogDescriptionWarning", mn = ({ contentRef: t, descriptionId: n }) => {
|
|
223
|
+
const a = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${be(pn).contentName}}.`;
|
|
224
|
+
return O.useEffect(() => {
|
|
225
|
+
const o = t.current?.getAttribute("aria-describedby");
|
|
226
|
+
n && o && (document.getElementById(n) || console.warn(a));
|
|
227
|
+
}, [a, t, n]), null;
|
|
228
|
+
}, gn = ie, hn = le, wn = ce, vn = de, yn = fe, bn = me, Dn = he, Rn = ve;
|
|
229
|
+
function En(t) {
|
|
230
|
+
if (typeof document > "u") return;
|
|
231
|
+
let n = document.head || document.getElementsByTagName("head")[0], e = document.createElement("style");
|
|
232
|
+
e.type = "text/css", n.appendChild(e), e.styleSheet ? e.styleSheet.cssText = t : e.appendChild(document.createTextNode(t));
|
|
233
|
+
}
|
|
234
|
+
const De = i.createContext({
|
|
235
|
+
drawerRef: {
|
|
236
|
+
current: null
|
|
237
|
+
},
|
|
238
|
+
overlayRef: {
|
|
239
|
+
current: null
|
|
240
|
+
},
|
|
241
|
+
onPress: () => {
|
|
242
|
+
},
|
|
243
|
+
onRelease: () => {
|
|
244
|
+
},
|
|
245
|
+
onDrag: () => {
|
|
246
|
+
},
|
|
247
|
+
onNestedDrag: () => {
|
|
248
|
+
},
|
|
249
|
+
onNestedOpenChange: () => {
|
|
250
|
+
},
|
|
251
|
+
onNestedRelease: () => {
|
|
252
|
+
},
|
|
253
|
+
openProp: void 0,
|
|
254
|
+
dismissible: !1,
|
|
255
|
+
isOpen: !1,
|
|
256
|
+
isDragging: !1,
|
|
257
|
+
keyboardIsOpen: {
|
|
258
|
+
current: !1
|
|
259
|
+
},
|
|
260
|
+
snapPointsOffset: null,
|
|
261
|
+
snapPoints: null,
|
|
262
|
+
handleOnly: !1,
|
|
263
|
+
modal: !1,
|
|
264
|
+
shouldFade: !1,
|
|
265
|
+
activeSnapPoint: null,
|
|
266
|
+
onOpenChange: () => {
|
|
267
|
+
},
|
|
268
|
+
setActiveSnapPoint: () => {
|
|
269
|
+
},
|
|
270
|
+
closeDrawer: () => {
|
|
271
|
+
},
|
|
272
|
+
direction: "bottom",
|
|
273
|
+
shouldAnimate: {
|
|
274
|
+
current: !0
|
|
275
|
+
},
|
|
276
|
+
shouldScaleBackground: !1,
|
|
277
|
+
setBackgroundColorOnScale: !0,
|
|
278
|
+
noBodyStyles: !1,
|
|
279
|
+
container: null,
|
|
280
|
+
autoFocus: !1
|
|
281
|
+
}), vt = () => {
|
|
282
|
+
const t = i.useContext(De);
|
|
283
|
+
if (!t)
|
|
284
|
+
throw new Error("useDrawerContext must be used within a Drawer.Root");
|
|
285
|
+
return t;
|
|
286
|
+
};
|
|
287
|
+
En(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
|
|
288
|
+
[data-state=closed]
|
|
289
|
+
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);
|
|
290
|
+
function Sn() {
|
|
291
|
+
const t = navigator.userAgent;
|
|
292
|
+
return typeof window < "u" && (/Firefox/.test(t) && /Mobile/.test(t) || // Android Firefox
|
|
293
|
+
/FxiOS/.test(t));
|
|
294
|
+
}
|
|
295
|
+
function Tn() {
|
|
296
|
+
return Vt(/^Mac/);
|
|
297
|
+
}
|
|
298
|
+
function xn() {
|
|
299
|
+
return Vt(/^iPhone/);
|
|
300
|
+
}
|
|
301
|
+
function ee() {
|
|
302
|
+
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
303
|
+
}
|
|
304
|
+
function Cn() {
|
|
305
|
+
return Vt(/^iPad/) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
306
|
+
Tn() && navigator.maxTouchPoints > 1;
|
|
307
|
+
}
|
|
308
|
+
function Re() {
|
|
309
|
+
return xn() || Cn();
|
|
310
|
+
}
|
|
311
|
+
function Vt(t) {
|
|
312
|
+
return typeof window < "u" && window.navigator != null ? t.test(window.navigator.platform) : void 0;
|
|
313
|
+
}
|
|
314
|
+
const On = 24, _n = typeof window < "u" ? qe : Xe;
|
|
315
|
+
function ne(...t) {
|
|
316
|
+
return (...n) => {
|
|
317
|
+
for (let e of t)
|
|
318
|
+
typeof e == "function" && e(...n);
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
const Nt = typeof document < "u" && window.visualViewport;
|
|
322
|
+
function re(t) {
|
|
323
|
+
let n = window.getComputedStyle(t);
|
|
324
|
+
return /(auto|scroll)/.test(n.overflow + n.overflowX + n.overflowY);
|
|
325
|
+
}
|
|
326
|
+
function Ee(t) {
|
|
327
|
+
for (re(t) && (t = t.parentElement); t && !re(t); )
|
|
328
|
+
t = t.parentElement;
|
|
329
|
+
return t || document.scrollingElement || document.documentElement;
|
|
330
|
+
}
|
|
331
|
+
const An = /* @__PURE__ */ new Set([
|
|
332
|
+
"checkbox",
|
|
333
|
+
"radio",
|
|
334
|
+
"range",
|
|
335
|
+
"color",
|
|
336
|
+
"file",
|
|
337
|
+
"image",
|
|
338
|
+
"button",
|
|
339
|
+
"submit",
|
|
340
|
+
"reset"
|
|
341
|
+
]);
|
|
342
|
+
let Rt = 0, $t;
|
|
343
|
+
function Pn(t = {}) {
|
|
344
|
+
let { isDisabled: n } = t;
|
|
345
|
+
_n(() => {
|
|
346
|
+
if (!n)
|
|
347
|
+
return Rt++, Rt === 1 && Re() && ($t = Nn()), () => {
|
|
348
|
+
Rt--, Rt === 0 && $t?.();
|
|
349
|
+
};
|
|
350
|
+
}, [
|
|
351
|
+
n
|
|
352
|
+
]);
|
|
353
|
+
}
|
|
354
|
+
function Nn() {
|
|
355
|
+
let t, n = 0, e = (m) => {
|
|
356
|
+
t = Ee(m.target), !(t === document.documentElement && t === document.body) && (n = m.changedTouches[0].pageY);
|
|
357
|
+
}, a = (m) => {
|
|
358
|
+
if (!t || t === document.documentElement || t === document.body) {
|
|
359
|
+
m.preventDefault();
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
let h = m.changedTouches[0].pageY, W = t.scrollTop, H = t.scrollHeight - t.clientHeight;
|
|
363
|
+
H !== 0 && ((W <= 0 && h > n || W >= H && h < n) && m.preventDefault(), n = h);
|
|
364
|
+
}, o = (m) => {
|
|
365
|
+
let h = m.target;
|
|
366
|
+
Lt(h) && h !== document.activeElement && (m.preventDefault(), h.style.transform = "translateY(-2000px)", h.focus(), requestAnimationFrame(() => {
|
|
367
|
+
h.style.transform = "";
|
|
368
|
+
}));
|
|
369
|
+
}, r = (m) => {
|
|
370
|
+
let h = m.target;
|
|
371
|
+
Lt(h) && (h.style.transform = "translateY(-2000px)", requestAnimationFrame(() => {
|
|
372
|
+
h.style.transform = "", Nt && (Nt.height < window.innerHeight ? requestAnimationFrame(() => {
|
|
373
|
+
ae(h);
|
|
374
|
+
}) : Nt.addEventListener("resize", () => ae(h), {
|
|
375
|
+
once: !0
|
|
376
|
+
}));
|
|
377
|
+
}));
|
|
378
|
+
}, l = () => {
|
|
379
|
+
window.scrollTo(0, 0);
|
|
380
|
+
}, s = window.pageXOffset, v = window.pageYOffset, D = ne($n(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`));
|
|
381
|
+
window.scrollTo(0, 0);
|
|
382
|
+
let g = ne(pt(document, "touchstart", e, {
|
|
383
|
+
passive: !1,
|
|
384
|
+
capture: !0
|
|
385
|
+
}), pt(document, "touchmove", a, {
|
|
386
|
+
passive: !1,
|
|
387
|
+
capture: !0
|
|
388
|
+
}), pt(document, "touchend", o, {
|
|
389
|
+
passive: !1,
|
|
390
|
+
capture: !0
|
|
391
|
+
}), pt(document, "focus", r, !0), pt(window, "scroll", l));
|
|
392
|
+
return () => {
|
|
393
|
+
D(), g(), window.scrollTo(s, v);
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
function $n(t, n, e) {
|
|
397
|
+
let a = t.style[n];
|
|
398
|
+
return t.style[n] = e, () => {
|
|
399
|
+
t.style[n] = a;
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
function pt(t, n, e, a) {
|
|
403
|
+
return t.addEventListener(n, e, a), () => {
|
|
404
|
+
t.removeEventListener(n, e, a);
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
function ae(t) {
|
|
408
|
+
let n = document.scrollingElement || document.documentElement;
|
|
409
|
+
for (; t && t !== n; ) {
|
|
410
|
+
let e = Ee(t);
|
|
411
|
+
if (e !== document.documentElement && e !== document.body && e !== t) {
|
|
412
|
+
let a = e.getBoundingClientRect().top, o = t.getBoundingClientRect().top, r = t.getBoundingClientRect().bottom;
|
|
413
|
+
const l = e.getBoundingClientRect().bottom + On;
|
|
414
|
+
r > l && (e.scrollTop += o - a);
|
|
415
|
+
}
|
|
416
|
+
t = e.parentElement;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
function Lt(t) {
|
|
420
|
+
return t instanceof HTMLInputElement && !An.has(t.type) || t instanceof HTMLTextAreaElement || t instanceof HTMLElement && t.isContentEditable;
|
|
421
|
+
}
|
|
422
|
+
function Mn(t, n) {
|
|
423
|
+
typeof t == "function" ? t(n) : t != null && (t.current = n);
|
|
424
|
+
}
|
|
425
|
+
function In(...t) {
|
|
426
|
+
return (n) => t.forEach((e) => Mn(e, n));
|
|
427
|
+
}
|
|
428
|
+
function Se(...t) {
|
|
429
|
+
return O.useCallback(In(...t), t);
|
|
430
|
+
}
|
|
431
|
+
const Te = /* @__PURE__ */ new WeakMap();
|
|
432
|
+
function P(t, n, e = !1) {
|
|
433
|
+
if (!t || !(t instanceof HTMLElement)) return;
|
|
434
|
+
let a = {};
|
|
435
|
+
Object.entries(n).forEach(([o, r]) => {
|
|
436
|
+
if (o.startsWith("--")) {
|
|
437
|
+
t.style.setProperty(o, r);
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
a[o] = t.style[o], t.style[o] = r;
|
|
441
|
+
}), !e && Te.set(t, a);
|
|
442
|
+
}
|
|
443
|
+
function Ln(t, n) {
|
|
444
|
+
if (!t || !(t instanceof HTMLElement)) return;
|
|
445
|
+
let e = Te.get(t);
|
|
446
|
+
e && (t.style[n] = e[n]);
|
|
447
|
+
}
|
|
448
|
+
const A = (t) => {
|
|
449
|
+
switch (t) {
|
|
450
|
+
case "top":
|
|
451
|
+
case "bottom":
|
|
452
|
+
return !0;
|
|
453
|
+
case "left":
|
|
454
|
+
case "right":
|
|
455
|
+
return !1;
|
|
456
|
+
default:
|
|
457
|
+
return t;
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
function Et(t, n) {
|
|
461
|
+
if (!t)
|
|
462
|
+
return null;
|
|
463
|
+
const e = window.getComputedStyle(t), a = (
|
|
464
|
+
// @ts-ignore
|
|
465
|
+
e.transform || e.webkitTransform || e.mozTransform
|
|
466
|
+
);
|
|
467
|
+
let o = a.match(/^matrix3d\((.+)\)$/);
|
|
468
|
+
return o ? parseFloat(o[1].split(", ")[A(n) ? 13 : 12]) : (o = a.match(/^matrix\((.+)\)$/), o ? parseFloat(o[1].split(", ")[A(n) ? 5 : 4]) : null);
|
|
469
|
+
}
|
|
470
|
+
function Fn(t) {
|
|
471
|
+
return 8 * (Math.log(t + 1) - 2);
|
|
472
|
+
}
|
|
473
|
+
function Mt(t, n) {
|
|
474
|
+
if (!t) return () => {
|
|
475
|
+
};
|
|
476
|
+
const e = t.style.cssText;
|
|
477
|
+
return Object.assign(t.style, n), () => {
|
|
478
|
+
t.style.cssText = e;
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
function kn(...t) {
|
|
482
|
+
return (...n) => {
|
|
483
|
+
for (const e of t)
|
|
484
|
+
typeof e == "function" && e(...n);
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
const C = {
|
|
488
|
+
DURATION: 0.5,
|
|
489
|
+
EASE: [
|
|
490
|
+
0.32,
|
|
491
|
+
0.72,
|
|
492
|
+
0,
|
|
493
|
+
1
|
|
494
|
+
]
|
|
495
|
+
}, xe = 0.4, Hn = 0.25, Bn = 100, Ce = 8, rt = 16, Ft = 26, It = "vaul-dragging";
|
|
496
|
+
function Oe(t) {
|
|
497
|
+
const n = i.useRef(t);
|
|
498
|
+
return i.useEffect(() => {
|
|
499
|
+
n.current = t;
|
|
500
|
+
}), i.useMemo(() => (...e) => n.current == null ? void 0 : n.current.call(n, ...e), []);
|
|
501
|
+
}
|
|
502
|
+
function Wn({ defaultProp: t, onChange: n }) {
|
|
503
|
+
const e = i.useState(t), [a] = e, o = i.useRef(a), r = Oe(n);
|
|
504
|
+
return i.useEffect(() => {
|
|
505
|
+
o.current !== a && (r(a), o.current = a);
|
|
506
|
+
}, [
|
|
507
|
+
a,
|
|
508
|
+
o,
|
|
509
|
+
r
|
|
510
|
+
]), e;
|
|
511
|
+
}
|
|
512
|
+
function _e({ prop: t, defaultProp: n, onChange: e = () => {
|
|
513
|
+
} }) {
|
|
514
|
+
const [a, o] = Wn({
|
|
515
|
+
defaultProp: n,
|
|
516
|
+
onChange: e
|
|
517
|
+
}), r = t !== void 0, l = r ? t : a, s = Oe(e), v = i.useCallback((D) => {
|
|
518
|
+
if (r) {
|
|
519
|
+
const m = typeof D == "function" ? D(t) : D;
|
|
520
|
+
m !== t && s(m);
|
|
521
|
+
} else
|
|
522
|
+
o(D);
|
|
523
|
+
}, [
|
|
524
|
+
r,
|
|
525
|
+
t,
|
|
526
|
+
o,
|
|
527
|
+
s
|
|
528
|
+
]);
|
|
529
|
+
return [
|
|
530
|
+
l,
|
|
531
|
+
v
|
|
532
|
+
];
|
|
533
|
+
}
|
|
534
|
+
function Un({ activeSnapPointProp: t, setActiveSnapPointProp: n, snapPoints: e, drawerRef: a, overlayRef: o, fadeFromIndex: r, onSnapPointChange: l, direction: s = "bottom", container: v, snapToSequentialPoint: D }) {
|
|
535
|
+
const [g, m] = _e({
|
|
536
|
+
prop: t,
|
|
537
|
+
defaultProp: e?.[0],
|
|
538
|
+
onChange: n
|
|
539
|
+
}), [h, W] = i.useState(typeof window < "u" ? {
|
|
540
|
+
innerWidth: window.innerWidth,
|
|
541
|
+
innerHeight: window.innerHeight
|
|
542
|
+
} : void 0);
|
|
543
|
+
i.useEffect(() => {
|
|
544
|
+
function d() {
|
|
545
|
+
W({
|
|
546
|
+
innerWidth: window.innerWidth,
|
|
547
|
+
innerHeight: window.innerHeight
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
return window.addEventListener("resize", d), () => window.removeEventListener("resize", d);
|
|
551
|
+
}, []);
|
|
552
|
+
const H = i.useMemo(() => g === e?.[e.length - 1] || null, [
|
|
553
|
+
e,
|
|
554
|
+
g
|
|
555
|
+
]), x = i.useMemo(() => {
|
|
556
|
+
var d;
|
|
557
|
+
return (d = e?.findIndex((R) => R === g)) != null ? d : null;
|
|
558
|
+
}, [
|
|
559
|
+
e,
|
|
560
|
+
g
|
|
561
|
+
]), U = e && e.length > 0 && (r || r === 0) && !Number.isNaN(r) && e[r] === g || !e, w = i.useMemo(() => {
|
|
562
|
+
const d = v ? {
|
|
563
|
+
width: v.getBoundingClientRect().width,
|
|
564
|
+
height: v.getBoundingClientRect().height
|
|
565
|
+
} : typeof window < "u" ? {
|
|
566
|
+
width: window.innerWidth,
|
|
567
|
+
height: window.innerHeight
|
|
568
|
+
} : {
|
|
569
|
+
width: 0,
|
|
570
|
+
height: 0
|
|
571
|
+
};
|
|
572
|
+
var R;
|
|
573
|
+
return (R = e?.map((b) => {
|
|
574
|
+
const L = typeof b == "string";
|
|
575
|
+
let M = 0;
|
|
576
|
+
if (L && (M = parseInt(b, 10)), A(s)) {
|
|
577
|
+
const c = L ? M : h ? b * d.height : 0;
|
|
578
|
+
return h ? s === "bottom" ? d.height - c : -d.height + c : c;
|
|
579
|
+
}
|
|
580
|
+
const z = L ? M : h ? b * d.width : 0;
|
|
581
|
+
return h ? s === "right" ? d.width - z : -d.width + z : z;
|
|
582
|
+
})) != null ? R : [];
|
|
583
|
+
}, [
|
|
584
|
+
e,
|
|
585
|
+
h,
|
|
586
|
+
v
|
|
587
|
+
]), $ = i.useMemo(() => x !== null ? w?.[x] : null, [
|
|
588
|
+
w,
|
|
589
|
+
x
|
|
590
|
+
]), N = i.useCallback((d) => {
|
|
591
|
+
var R;
|
|
592
|
+
const b = (R = w?.findIndex((L) => L === d)) != null ? R : null;
|
|
593
|
+
l(b), P(a.current, {
|
|
594
|
+
transition: `transform ${C.DURATION}s cubic-bezier(${C.EASE.join(",")})`,
|
|
595
|
+
transform: A(s) ? `translate3d(0, ${d}px, 0)` : `translate3d(${d}px, 0, 0)`
|
|
596
|
+
}), w && b !== w.length - 1 && r !== void 0 && b !== r && b < r ? P(o.current, {
|
|
597
|
+
transition: `opacity ${C.DURATION}s cubic-bezier(${C.EASE.join(",")})`,
|
|
598
|
+
opacity: "0"
|
|
599
|
+
}) : P(o.current, {
|
|
600
|
+
transition: `opacity ${C.DURATION}s cubic-bezier(${C.EASE.join(",")})`,
|
|
601
|
+
opacity: "1"
|
|
602
|
+
}), m(e?.[Math.max(b, 0)]);
|
|
603
|
+
}, [
|
|
604
|
+
a.current,
|
|
605
|
+
e,
|
|
606
|
+
w,
|
|
607
|
+
r,
|
|
608
|
+
o,
|
|
609
|
+
m
|
|
610
|
+
]);
|
|
611
|
+
i.useEffect(() => {
|
|
612
|
+
if (g || t) {
|
|
613
|
+
var d;
|
|
614
|
+
const R = (d = e?.findIndex((b) => b === t || b === g)) != null ? d : -1;
|
|
615
|
+
w && R !== -1 && typeof w[R] == "number" && N(w[R]);
|
|
616
|
+
}
|
|
617
|
+
}, [
|
|
618
|
+
g,
|
|
619
|
+
t,
|
|
620
|
+
e,
|
|
621
|
+
w,
|
|
622
|
+
N
|
|
623
|
+
]);
|
|
624
|
+
function f({ draggedDistance: d, closeDrawer: R, velocity: b, dismissible: L }) {
|
|
625
|
+
if (r === void 0) return;
|
|
626
|
+
const M = s === "bottom" || s === "right" ? ($ ?? 0) - d : ($ ?? 0) + d, z = x === r - 1, c = x === 0, V = d > 0;
|
|
627
|
+
if (z && P(o.current, {
|
|
628
|
+
transition: `opacity ${C.DURATION}s cubic-bezier(${C.EASE.join(",")})`
|
|
629
|
+
}), !D && b > 2 && !V) {
|
|
630
|
+
L ? R() : N(w[0]);
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
if (!D && b > 2 && V && w && e) {
|
|
634
|
+
N(w[e.length - 1]);
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
const F = w?.reduce((I, K) => typeof I != "number" || typeof K != "number" ? I : Math.abs(K - M) < Math.abs(I - M) ? K : I), Y = A(s) ? window.innerHeight : window.innerWidth;
|
|
638
|
+
if (b > xe && Math.abs(d) < Y * 0.4) {
|
|
639
|
+
const I = V ? 1 : -1;
|
|
640
|
+
if (I > 0 && H && e) {
|
|
641
|
+
N(w[e.length - 1]);
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
if (c && I < 0 && L && R(), x === null) return;
|
|
645
|
+
N(w[x + I]);
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
N(F);
|
|
649
|
+
}
|
|
650
|
+
function X({ draggedDistance: d }) {
|
|
651
|
+
if ($ === null) return;
|
|
652
|
+
const R = s === "bottom" || s === "right" ? $ - d : $ + d;
|
|
653
|
+
(s === "bottom" || s === "right") && R < w[w.length - 1] || (s === "top" || s === "left") && R > w[w.length - 1] || P(a.current, {
|
|
654
|
+
transform: A(s) ? `translate3d(0, ${R}px, 0)` : `translate3d(${R}px, 0, 0)`
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
function et(d, R) {
|
|
658
|
+
if (!e || typeof x != "number" || !w || r === void 0) return null;
|
|
659
|
+
const b = x === r - 1;
|
|
660
|
+
if (x >= r && R)
|
|
661
|
+
return 0;
|
|
662
|
+
if (b && !R) return 1;
|
|
663
|
+
if (!U && !b) return null;
|
|
664
|
+
const M = b ? x + 1 : x - 1, z = b ? w[M] - w[M - 1] : w[M + 1] - w[M], c = d / Math.abs(z);
|
|
665
|
+
return b ? 1 - c : c;
|
|
666
|
+
}
|
|
667
|
+
return {
|
|
668
|
+
isLastSnapPoint: H,
|
|
669
|
+
activeSnapPoint: g,
|
|
670
|
+
shouldFade: U,
|
|
671
|
+
getPercentageDragged: et,
|
|
672
|
+
setActiveSnapPoint: m,
|
|
673
|
+
activeSnapPointIndex: x,
|
|
674
|
+
onRelease: f,
|
|
675
|
+
onDrag: X,
|
|
676
|
+
snapPointsOffset: w
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
const Vn = () => () => {
|
|
680
|
+
};
|
|
681
|
+
function zn() {
|
|
682
|
+
const { direction: t, isOpen: n, shouldScaleBackground: e, setBackgroundColorOnScale: a, noBodyStyles: o } = vt(), r = i.useRef(null), l = je(() => document.body.style.backgroundColor, []);
|
|
683
|
+
function s() {
|
|
684
|
+
return (window.innerWidth - Ft) / window.innerWidth;
|
|
685
|
+
}
|
|
686
|
+
i.useEffect(() => {
|
|
687
|
+
if (n && e) {
|
|
688
|
+
r.current && clearTimeout(r.current);
|
|
689
|
+
const v = document.querySelector("[data-vaul-drawer-wrapper]") || document.querySelector("[vaul-drawer-wrapper]");
|
|
690
|
+
if (!v) return;
|
|
691
|
+
kn(a && !o ? Mt(document.body, {
|
|
692
|
+
background: "black"
|
|
693
|
+
}) : Vn, Mt(v, {
|
|
694
|
+
transformOrigin: A(t) ? "top" : "left",
|
|
695
|
+
transitionProperty: "transform, border-radius",
|
|
696
|
+
transitionDuration: `${C.DURATION}s`,
|
|
697
|
+
transitionTimingFunction: `cubic-bezier(${C.EASE.join(",")})`
|
|
698
|
+
}));
|
|
699
|
+
const D = Mt(v, {
|
|
700
|
+
borderRadius: `${Ce}px`,
|
|
701
|
+
overflow: "hidden",
|
|
702
|
+
...A(t) ? {
|
|
703
|
+
transform: `scale(${s()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`
|
|
704
|
+
} : {
|
|
705
|
+
transform: `scale(${s()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`
|
|
706
|
+
}
|
|
707
|
+
});
|
|
708
|
+
return () => {
|
|
709
|
+
D(), r.current = window.setTimeout(() => {
|
|
710
|
+
l ? document.body.style.background = l : document.body.style.removeProperty("background");
|
|
711
|
+
}, C.DURATION * 1e3);
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
}, [
|
|
715
|
+
n,
|
|
716
|
+
e,
|
|
717
|
+
l
|
|
718
|
+
]);
|
|
719
|
+
}
|
|
720
|
+
let mt = null;
|
|
721
|
+
function Yn({ isOpen: t, modal: n, nested: e, hasBeenOpened: a, preventScrollRestoration: o, noBodyStyles: r }) {
|
|
722
|
+
const [l, s] = i.useState(() => typeof window < "u" ? window.location.href : ""), v = i.useRef(0), D = i.useCallback(() => {
|
|
723
|
+
if (ee() && mt === null && t && !r) {
|
|
724
|
+
mt = {
|
|
725
|
+
position: document.body.style.position,
|
|
726
|
+
top: document.body.style.top,
|
|
727
|
+
left: document.body.style.left,
|
|
728
|
+
height: document.body.style.height,
|
|
729
|
+
right: "unset"
|
|
730
|
+
};
|
|
731
|
+
const { scrollX: m, innerHeight: h } = window;
|
|
732
|
+
document.body.style.setProperty("position", "fixed", "important"), Object.assign(document.body.style, {
|
|
733
|
+
top: `${-v.current}px`,
|
|
734
|
+
left: `${-m}px`,
|
|
735
|
+
right: "0px",
|
|
736
|
+
height: "auto"
|
|
737
|
+
}), window.setTimeout(() => window.requestAnimationFrame(() => {
|
|
738
|
+
const W = h - window.innerHeight;
|
|
739
|
+
W && v.current >= h && (document.body.style.top = `${-(v.current + W)}px`);
|
|
740
|
+
}), 300);
|
|
741
|
+
}
|
|
742
|
+
}, [
|
|
743
|
+
t
|
|
744
|
+
]), g = i.useCallback(() => {
|
|
745
|
+
if (ee() && mt !== null && !r) {
|
|
746
|
+
const m = -parseInt(document.body.style.top, 10), h = -parseInt(document.body.style.left, 10);
|
|
747
|
+
Object.assign(document.body.style, mt), window.requestAnimationFrame(() => {
|
|
748
|
+
if (o && l !== window.location.href) {
|
|
749
|
+
s(window.location.href);
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
window.scrollTo(h, m);
|
|
753
|
+
}), mt = null;
|
|
754
|
+
}
|
|
755
|
+
}, [
|
|
756
|
+
l
|
|
757
|
+
]);
|
|
758
|
+
return i.useEffect(() => {
|
|
759
|
+
function m() {
|
|
760
|
+
v.current = window.scrollY;
|
|
761
|
+
}
|
|
762
|
+
return m(), window.addEventListener("scroll", m), () => {
|
|
763
|
+
window.removeEventListener("scroll", m);
|
|
764
|
+
};
|
|
765
|
+
}, []), i.useEffect(() => {
|
|
766
|
+
if (n)
|
|
767
|
+
return () => {
|
|
768
|
+
typeof document > "u" || document.querySelector("[data-vaul-drawer]") || g();
|
|
769
|
+
};
|
|
770
|
+
}, [
|
|
771
|
+
n,
|
|
772
|
+
g
|
|
773
|
+
]), i.useEffect(() => {
|
|
774
|
+
e || !a || (t ? (!window.matchMedia("(display-mode: standalone)").matches && D(), n || window.setTimeout(() => {
|
|
775
|
+
g();
|
|
776
|
+
}, 500)) : g());
|
|
777
|
+
}, [
|
|
778
|
+
t,
|
|
779
|
+
a,
|
|
780
|
+
l,
|
|
781
|
+
n,
|
|
782
|
+
e,
|
|
783
|
+
D,
|
|
784
|
+
g
|
|
785
|
+
]), {
|
|
786
|
+
restorePositionSetting: g
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
function jn({ open: t, onOpenChange: n, children: e, onDrag: a, onRelease: o, snapPoints: r, shouldScaleBackground: l = !1, setBackgroundColorOnScale: s = !0, closeThreshold: v = Hn, scrollLockTimeout: D = Bn, dismissible: g = !0, handleOnly: m = !1, fadeFromIndex: h = r && r.length - 1, activeSnapPoint: W, setActiveSnapPoint: H, fixed: x, modal: U = !0, onClose: w, nested: $, noBodyStyles: N = !1, direction: f = "bottom", defaultOpen: X = !1, disablePreventScroll: et = !0, snapToSequentialPoint: d = !1, preventScrollRestoration: R = !1, repositionInputs: b = !0, onAnimationEnd: L, container: M, autoFocus: z = !1 }) {
|
|
790
|
+
var c, V;
|
|
791
|
+
const [F = !1, Y] = _e({
|
|
792
|
+
defaultProp: X,
|
|
793
|
+
prop: t,
|
|
794
|
+
onChange: (u) => {
|
|
795
|
+
n?.(u), !u && !$ && ke(), setTimeout(() => {
|
|
796
|
+
L?.(u);
|
|
797
|
+
}, C.DURATION * 1e3), u && !U && typeof window < "u" && window.requestAnimationFrame(() => {
|
|
798
|
+
document.body.style.pointerEvents = "auto";
|
|
799
|
+
}), u || (document.body.style.pointerEvents = "auto");
|
|
800
|
+
}
|
|
801
|
+
}), [I, K] = i.useState(!1), [J, lt] = i.useState(!1), [Ne, zt] = i.useState(!1), ot = i.useRef(null), yt = i.useRef(null), xt = i.useRef(null), Ct = i.useRef(null), ut = i.useRef(null), ct = i.useRef(!1), Ot = i.useRef(null), _t = i.useRef(0), it = i.useRef(!1), Yt = i.useRef(!X), jt = i.useRef(0), p = i.useRef(null), qt = i.useRef(((c = p.current) == null ? void 0 : c.getBoundingClientRect().height) || 0), Xt = i.useRef(((V = p.current) == null ? void 0 : V.getBoundingClientRect().width) || 0), At = i.useRef(0), $e = i.useCallback((u) => {
|
|
802
|
+
r && u === dt.length - 1 && (yt.current = /* @__PURE__ */ new Date());
|
|
803
|
+
}, []), { activeSnapPoint: Me, activeSnapPointIndex: st, setActiveSnapPoint: Gt, onRelease: Ie, snapPointsOffset: dt, onDrag: Le, shouldFade: Kt, getPercentageDragged: Fe } = Un({
|
|
804
|
+
snapPoints: r,
|
|
805
|
+
activeSnapPointProp: W,
|
|
806
|
+
setActiveSnapPointProp: H,
|
|
807
|
+
drawerRef: p,
|
|
808
|
+
fadeFromIndex: h,
|
|
809
|
+
overlayRef: ot,
|
|
810
|
+
onSnapPointChange: $e,
|
|
811
|
+
direction: f,
|
|
812
|
+
container: M,
|
|
813
|
+
snapToSequentialPoint: d
|
|
814
|
+
});
|
|
815
|
+
Pn({
|
|
816
|
+
isDisabled: !F || J || !U || Ne || !I || !b || !et
|
|
817
|
+
});
|
|
818
|
+
const { restorePositionSetting: ke } = Yn({
|
|
819
|
+
isOpen: F,
|
|
820
|
+
modal: U,
|
|
821
|
+
nested: $ ?? !1,
|
|
822
|
+
hasBeenOpened: I,
|
|
823
|
+
preventScrollRestoration: R,
|
|
824
|
+
noBodyStyles: N
|
|
825
|
+
});
|
|
826
|
+
function bt() {
|
|
827
|
+
return (window.innerWidth - Ft) / window.innerWidth;
|
|
828
|
+
}
|
|
829
|
+
function He(u) {
|
|
830
|
+
var E, T;
|
|
831
|
+
!g && !r || p.current && !p.current.contains(u.target) || (qt.current = ((E = p.current) == null ? void 0 : E.getBoundingClientRect().height) || 0, Xt.current = ((T = p.current) == null ? void 0 : T.getBoundingClientRect().width) || 0, lt(!0), xt.current = /* @__PURE__ */ new Date(), Re() && window.addEventListener("touchend", () => ct.current = !1, {
|
|
832
|
+
once: !0
|
|
833
|
+
}), u.target.setPointerCapture(u.pointerId), _t.current = A(f) ? u.pageY : u.pageX);
|
|
834
|
+
}
|
|
835
|
+
function Jt(u, E) {
|
|
836
|
+
var T;
|
|
837
|
+
let y = u;
|
|
838
|
+
const _ = (T = window.getSelection()) == null ? void 0 : T.toString(), B = p.current ? Et(p.current, f) : null, k = /* @__PURE__ */ new Date();
|
|
839
|
+
if (y.tagName === "SELECT" || y.hasAttribute("data-vaul-no-drag") || y.closest("[data-vaul-no-drag]"))
|
|
840
|
+
return !1;
|
|
841
|
+
if (f === "right" || f === "left")
|
|
842
|
+
return !0;
|
|
843
|
+
if (yt.current && k.getTime() - yt.current.getTime() < 500)
|
|
844
|
+
return !1;
|
|
845
|
+
if (B !== null && (f === "bottom" ? B > 0 : B < 0))
|
|
846
|
+
return !0;
|
|
847
|
+
if (_ && _.length > 0)
|
|
848
|
+
return !1;
|
|
849
|
+
if (ut.current && k.getTime() - ut.current.getTime() < D && B === 0 || E)
|
|
850
|
+
return ut.current = k, !1;
|
|
851
|
+
for (; y; ) {
|
|
852
|
+
if (y.scrollHeight > y.clientHeight) {
|
|
853
|
+
if (y.scrollTop !== 0)
|
|
854
|
+
return ut.current = /* @__PURE__ */ new Date(), !1;
|
|
855
|
+
if (y.getAttribute("role") === "dialog")
|
|
856
|
+
return !0;
|
|
857
|
+
}
|
|
858
|
+
y = y.parentNode;
|
|
859
|
+
}
|
|
860
|
+
return !0;
|
|
861
|
+
}
|
|
862
|
+
function Be(u) {
|
|
863
|
+
if (p.current && J) {
|
|
864
|
+
const E = f === "bottom" || f === "right" ? 1 : -1, T = (_t.current - (A(f) ? u.pageY : u.pageX)) * E, y = T > 0, _ = r && !g && !y;
|
|
865
|
+
if (_ && st === 0) return;
|
|
866
|
+
const B = Math.abs(T), k = document.querySelector("[data-vaul-drawer-wrapper]"), Z = f === "bottom" || f === "top" ? qt.current : Xt.current;
|
|
867
|
+
let j = B / Z;
|
|
868
|
+
const nt = Fe(B, y);
|
|
869
|
+
if (nt !== null && (j = nt), _ && j >= 1 || !ct.current && !Jt(u.target, y)) return;
|
|
870
|
+
if (p.current.classList.add(It), ct.current = !0, P(p.current, {
|
|
871
|
+
transition: "none"
|
|
872
|
+
}), P(ot.current, {
|
|
873
|
+
transition: "none"
|
|
874
|
+
}), r && Le({
|
|
875
|
+
draggedDistance: T
|
|
876
|
+
}), y && !r) {
|
|
877
|
+
const G = Fn(T), Dt = Math.min(G * -1, 0) * E;
|
|
878
|
+
P(p.current, {
|
|
879
|
+
transform: A(f) ? `translate3d(0, ${Dt}px, 0)` : `translate3d(${Dt}px, 0, 0)`
|
|
880
|
+
});
|
|
881
|
+
return;
|
|
882
|
+
}
|
|
883
|
+
const Q = 1 - j;
|
|
884
|
+
if ((Kt || h && st === h - 1) && (a?.(u, j), P(ot.current, {
|
|
885
|
+
opacity: `${Q}`,
|
|
886
|
+
transition: "none"
|
|
887
|
+
}, !0)), k && ot.current && l) {
|
|
888
|
+
const G = Math.min(bt() + j * (1 - bt()), 1), Dt = 8 - j * 8, Qt = Math.max(0, 14 - j * 14);
|
|
889
|
+
P(k, {
|
|
890
|
+
borderRadius: `${Dt}px`,
|
|
891
|
+
transform: A(f) ? `scale(${G}) translate3d(0, ${Qt}px, 0)` : `scale(${G}) translate3d(${Qt}px, 0, 0)`,
|
|
892
|
+
transition: "none"
|
|
893
|
+
}, !0);
|
|
894
|
+
}
|
|
895
|
+
if (!r) {
|
|
896
|
+
const G = B * E;
|
|
897
|
+
P(p.current, {
|
|
898
|
+
transform: A(f) ? `translate3d(0, ${G}px, 0)` : `translate3d(${G}px, 0, 0)`
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
i.useEffect(() => {
|
|
904
|
+
window.requestAnimationFrame(() => {
|
|
905
|
+
Yt.current = !0;
|
|
906
|
+
});
|
|
907
|
+
}, []), i.useEffect(() => {
|
|
908
|
+
var u;
|
|
909
|
+
function E() {
|
|
910
|
+
if (!p.current || !b) return;
|
|
911
|
+
const T = document.activeElement;
|
|
912
|
+
if (Lt(T) || it.current) {
|
|
913
|
+
var y;
|
|
914
|
+
const _ = ((y = window.visualViewport) == null ? void 0 : y.height) || 0, B = window.innerHeight;
|
|
915
|
+
let k = B - _;
|
|
916
|
+
const Z = p.current.getBoundingClientRect().height || 0, j = Z > B * 0.8;
|
|
917
|
+
At.current || (At.current = Z);
|
|
918
|
+
const nt = p.current.getBoundingClientRect().top;
|
|
919
|
+
if (Math.abs(jt.current - k) > 60 && (it.current = !it.current), r && r.length > 0 && dt && st) {
|
|
920
|
+
const Q = dt[st] || 0;
|
|
921
|
+
k += Q;
|
|
922
|
+
}
|
|
923
|
+
if (jt.current = k, Z > _ || it.current) {
|
|
924
|
+
const Q = p.current.getBoundingClientRect().height;
|
|
925
|
+
let G = Q;
|
|
926
|
+
Q > _ && (G = _ - (j ? nt : Ft)), x ? p.current.style.height = `${Q - Math.max(k, 0)}px` : p.current.style.height = `${Math.max(G, _ - nt)}px`;
|
|
927
|
+
} else Sn() || (p.current.style.height = `${At.current}px`);
|
|
928
|
+
r && r.length > 0 && !it.current ? p.current.style.bottom = "0px" : p.current.style.bottom = `${Math.max(k, 0)}px`;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
return (u = window.visualViewport) == null || u.addEventListener("resize", E), () => {
|
|
932
|
+
var T;
|
|
933
|
+
return (T = window.visualViewport) == null ? void 0 : T.removeEventListener("resize", E);
|
|
934
|
+
};
|
|
935
|
+
}, [
|
|
936
|
+
st,
|
|
937
|
+
r,
|
|
938
|
+
dt
|
|
939
|
+
]);
|
|
940
|
+
function ft(u) {
|
|
941
|
+
We(), w?.(), u || Y(!1), setTimeout(() => {
|
|
942
|
+
r && Gt(r[0]);
|
|
943
|
+
}, C.DURATION * 1e3);
|
|
944
|
+
}
|
|
945
|
+
function Zt() {
|
|
946
|
+
if (!p.current) return;
|
|
947
|
+
const u = document.querySelector("[data-vaul-drawer-wrapper]"), E = Et(p.current, f);
|
|
948
|
+
P(p.current, {
|
|
949
|
+
transform: "translate3d(0, 0, 0)",
|
|
950
|
+
transition: `transform ${C.DURATION}s cubic-bezier(${C.EASE.join(",")})`
|
|
951
|
+
}), P(ot.current, {
|
|
952
|
+
transition: `opacity ${C.DURATION}s cubic-bezier(${C.EASE.join(",")})`,
|
|
953
|
+
opacity: "1"
|
|
954
|
+
}), l && E && E > 0 && F && P(u, {
|
|
955
|
+
borderRadius: `${Ce}px`,
|
|
956
|
+
overflow: "hidden",
|
|
957
|
+
...A(f) ? {
|
|
958
|
+
transform: `scale(${bt()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,
|
|
959
|
+
transformOrigin: "top"
|
|
960
|
+
} : {
|
|
961
|
+
transform: `scale(${bt()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,
|
|
962
|
+
transformOrigin: "left"
|
|
963
|
+
},
|
|
964
|
+
transitionProperty: "transform, border-radius",
|
|
965
|
+
transitionDuration: `${C.DURATION}s`,
|
|
966
|
+
transitionTimingFunction: `cubic-bezier(${C.EASE.join(",")})`
|
|
967
|
+
}, !0);
|
|
968
|
+
}
|
|
969
|
+
function We() {
|
|
970
|
+
!J || !p.current || (p.current.classList.remove(It), ct.current = !1, lt(!1), Ct.current = /* @__PURE__ */ new Date());
|
|
971
|
+
}
|
|
972
|
+
function Ue(u) {
|
|
973
|
+
if (!J || !p.current) return;
|
|
974
|
+
p.current.classList.remove(It), ct.current = !1, lt(!1), Ct.current = /* @__PURE__ */ new Date();
|
|
975
|
+
const E = Et(p.current, f);
|
|
976
|
+
if (!u || !Jt(u.target, !1) || !E || Number.isNaN(E) || xt.current === null) return;
|
|
977
|
+
const T = Ct.current.getTime() - xt.current.getTime(), y = _t.current - (A(f) ? u.pageY : u.pageX), _ = Math.abs(y) / T;
|
|
978
|
+
if (_ > 0.05 && (zt(!0), setTimeout(() => {
|
|
979
|
+
zt(!1);
|
|
980
|
+
}, 200)), r) {
|
|
981
|
+
Ie({
|
|
982
|
+
draggedDistance: y * (f === "bottom" || f === "right" ? 1 : -1),
|
|
983
|
+
closeDrawer: ft,
|
|
984
|
+
velocity: _,
|
|
985
|
+
dismissible: g
|
|
986
|
+
}), o?.(u, !0);
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
989
|
+
if (f === "bottom" || f === "right" ? y > 0 : y < 0) {
|
|
990
|
+
Zt(), o?.(u, !0);
|
|
991
|
+
return;
|
|
992
|
+
}
|
|
993
|
+
if (_ > xe) {
|
|
994
|
+
ft(), o?.(u, !1);
|
|
995
|
+
return;
|
|
996
|
+
}
|
|
997
|
+
var B;
|
|
998
|
+
const k = Math.min((B = p.current.getBoundingClientRect().height) != null ? B : 0, window.innerHeight);
|
|
999
|
+
var Z;
|
|
1000
|
+
const j = Math.min((Z = p.current.getBoundingClientRect().width) != null ? Z : 0, window.innerWidth), nt = f === "left" || f === "right";
|
|
1001
|
+
if (Math.abs(E) >= (nt ? j : k) * v) {
|
|
1002
|
+
ft(), o?.(u, !1);
|
|
1003
|
+
return;
|
|
1004
|
+
}
|
|
1005
|
+
o?.(u, !0), Zt();
|
|
1006
|
+
}
|
|
1007
|
+
i.useEffect(() => (F && (P(document.documentElement, {
|
|
1008
|
+
scrollBehavior: "auto"
|
|
1009
|
+
}), yt.current = /* @__PURE__ */ new Date()), () => {
|
|
1010
|
+
Ln(document.documentElement, "scrollBehavior");
|
|
1011
|
+
}), [
|
|
1012
|
+
F
|
|
1013
|
+
]);
|
|
1014
|
+
function Ve(u) {
|
|
1015
|
+
const E = u ? (window.innerWidth - rt) / window.innerWidth : 1, T = u ? -rt : 0;
|
|
1016
|
+
Ot.current && window.clearTimeout(Ot.current), P(p.current, {
|
|
1017
|
+
transition: `transform ${C.DURATION}s cubic-bezier(${C.EASE.join(",")})`,
|
|
1018
|
+
transform: A(f) ? `scale(${E}) translate3d(0, ${T}px, 0)` : `scale(${E}) translate3d(${T}px, 0, 0)`
|
|
1019
|
+
}), !u && p.current && (Ot.current = setTimeout(() => {
|
|
1020
|
+
const y = Et(p.current, f);
|
|
1021
|
+
P(p.current, {
|
|
1022
|
+
transition: "none",
|
|
1023
|
+
transform: A(f) ? `translate3d(0, ${y}px, 0)` : `translate3d(${y}px, 0, 0)`
|
|
1024
|
+
});
|
|
1025
|
+
}, 500));
|
|
1026
|
+
}
|
|
1027
|
+
function ze(u, E) {
|
|
1028
|
+
if (E < 0) return;
|
|
1029
|
+
const T = (window.innerWidth - rt) / window.innerWidth, y = T + E * (1 - T), _ = -rt + E * rt;
|
|
1030
|
+
P(p.current, {
|
|
1031
|
+
transform: A(f) ? `scale(${y}) translate3d(0, ${_}px, 0)` : `scale(${y}) translate3d(${_}px, 0, 0)`,
|
|
1032
|
+
transition: "none"
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
function Ye(u, E) {
|
|
1036
|
+
const T = A(f) ? window.innerHeight : window.innerWidth, y = E ? (T - rt) / T : 1, _ = E ? -rt : 0;
|
|
1037
|
+
E && P(p.current, {
|
|
1038
|
+
transition: `transform ${C.DURATION}s cubic-bezier(${C.EASE.join(",")})`,
|
|
1039
|
+
transform: A(f) ? `scale(${y}) translate3d(0, ${_}px, 0)` : `scale(${y}) translate3d(${_}px, 0, 0)`
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
return i.useEffect(() => {
|
|
1043
|
+
U || window.requestAnimationFrame(() => {
|
|
1044
|
+
document.body.style.pointerEvents = "auto";
|
|
1045
|
+
});
|
|
1046
|
+
}, [
|
|
1047
|
+
U
|
|
1048
|
+
]), /* @__PURE__ */ i.createElement(gn, {
|
|
1049
|
+
defaultOpen: X,
|
|
1050
|
+
onOpenChange: (u) => {
|
|
1051
|
+
!g && !u || (u ? K(!0) : ft(!0), Y(u));
|
|
1052
|
+
},
|
|
1053
|
+
open: F
|
|
1054
|
+
}, /* @__PURE__ */ i.createElement(De.Provider, {
|
|
1055
|
+
value: {
|
|
1056
|
+
activeSnapPoint: Me,
|
|
1057
|
+
snapPoints: r,
|
|
1058
|
+
setActiveSnapPoint: Gt,
|
|
1059
|
+
drawerRef: p,
|
|
1060
|
+
overlayRef: ot,
|
|
1061
|
+
onOpenChange: n,
|
|
1062
|
+
onPress: He,
|
|
1063
|
+
onRelease: Ue,
|
|
1064
|
+
onDrag: Be,
|
|
1065
|
+
dismissible: g,
|
|
1066
|
+
shouldAnimate: Yt,
|
|
1067
|
+
handleOnly: m,
|
|
1068
|
+
isOpen: F,
|
|
1069
|
+
isDragging: J,
|
|
1070
|
+
shouldFade: Kt,
|
|
1071
|
+
closeDrawer: ft,
|
|
1072
|
+
onNestedDrag: ze,
|
|
1073
|
+
onNestedOpenChange: Ve,
|
|
1074
|
+
onNestedRelease: Ye,
|
|
1075
|
+
keyboardIsOpen: it,
|
|
1076
|
+
modal: U,
|
|
1077
|
+
snapPointsOffset: dt,
|
|
1078
|
+
activeSnapPointIndex: st,
|
|
1079
|
+
direction: f,
|
|
1080
|
+
shouldScaleBackground: l,
|
|
1081
|
+
setBackgroundColorOnScale: s,
|
|
1082
|
+
noBodyStyles: N,
|
|
1083
|
+
container: M,
|
|
1084
|
+
autoFocus: z
|
|
1085
|
+
}
|
|
1086
|
+
}, e));
|
|
1087
|
+
}
|
|
1088
|
+
const Ae = /* @__PURE__ */ i.forwardRef(function({ ...t }, n) {
|
|
1089
|
+
const { overlayRef: e, snapPoints: a, onRelease: o, shouldFade: r, isOpen: l, modal: s, shouldAnimate: v } = vt(), D = Se(n, e), g = a && a.length > 0;
|
|
1090
|
+
if (!s)
|
|
1091
|
+
return null;
|
|
1092
|
+
const m = i.useCallback((h) => o(h), [
|
|
1093
|
+
o
|
|
1094
|
+
]);
|
|
1095
|
+
return /* @__PURE__ */ i.createElement(vn, {
|
|
1096
|
+
onMouseUp: m,
|
|
1097
|
+
ref: D,
|
|
1098
|
+
"data-vaul-overlay": "",
|
|
1099
|
+
"data-vaul-snap-points": l && g ? "true" : "false",
|
|
1100
|
+
"data-vaul-snap-points-overlay": l && r ? "true" : "false",
|
|
1101
|
+
"data-vaul-animate": v?.current ? "true" : "false",
|
|
1102
|
+
...t
|
|
1103
|
+
});
|
|
1104
|
+
});
|
|
1105
|
+
Ae.displayName = "Drawer.Overlay";
|
|
1106
|
+
const Pe = /* @__PURE__ */ i.forwardRef(function({ onPointerDownOutside: t, style: n, onOpenAutoFocus: e, ...a }, o) {
|
|
1107
|
+
const { drawerRef: r, onPress: l, onRelease: s, onDrag: v, keyboardIsOpen: D, snapPointsOffset: g, activeSnapPointIndex: m, modal: h, isOpen: W, direction: H, snapPoints: x, container: U, handleOnly: w, shouldAnimate: $, autoFocus: N } = vt(), [f, X] = i.useState(!1), et = Se(o, r), d = i.useRef(null), R = i.useRef(null), b = i.useRef(!1), L = x && x.length > 0;
|
|
1108
|
+
zn();
|
|
1109
|
+
const M = (c, V, F = 0) => {
|
|
1110
|
+
if (b.current) return !0;
|
|
1111
|
+
const Y = Math.abs(c.y), I = Math.abs(c.x), K = I > Y, J = [
|
|
1112
|
+
"bottom",
|
|
1113
|
+
"right"
|
|
1114
|
+
].includes(V) ? 1 : -1;
|
|
1115
|
+
if (V === "left" || V === "right") {
|
|
1116
|
+
if (!(c.x * J < 0) && I >= 0 && I <= F)
|
|
1117
|
+
return K;
|
|
1118
|
+
} else if (!(c.y * J < 0) && Y >= 0 && Y <= F)
|
|
1119
|
+
return !K;
|
|
1120
|
+
return b.current = !0, !0;
|
|
1121
|
+
};
|
|
1122
|
+
i.useEffect(() => {
|
|
1123
|
+
L && window.requestAnimationFrame(() => {
|
|
1124
|
+
X(!0);
|
|
1125
|
+
});
|
|
1126
|
+
}, []);
|
|
1127
|
+
function z(c) {
|
|
1128
|
+
d.current = null, b.current = !1, s(c);
|
|
1129
|
+
}
|
|
1130
|
+
return /* @__PURE__ */ i.createElement(yn, {
|
|
1131
|
+
"data-vaul-drawer-direction": H,
|
|
1132
|
+
"data-vaul-drawer": "",
|
|
1133
|
+
"data-vaul-delayed-snap-points": f ? "true" : "false",
|
|
1134
|
+
"data-vaul-snap-points": W && L ? "true" : "false",
|
|
1135
|
+
"data-vaul-custom-container": U ? "true" : "false",
|
|
1136
|
+
"data-vaul-animate": $?.current ? "true" : "false",
|
|
1137
|
+
...a,
|
|
1138
|
+
ref: et,
|
|
1139
|
+
style: g && g.length > 0 ? {
|
|
1140
|
+
"--snap-point-height": `${g[m ?? 0]}px`,
|
|
1141
|
+
...n
|
|
1142
|
+
} : n,
|
|
1143
|
+
onPointerDown: (c) => {
|
|
1144
|
+
w || (a.onPointerDown == null || a.onPointerDown.call(a, c), d.current = {
|
|
1145
|
+
x: c.pageX,
|
|
1146
|
+
y: c.pageY
|
|
1147
|
+
}, l(c));
|
|
1148
|
+
},
|
|
1149
|
+
onOpenAutoFocus: (c) => {
|
|
1150
|
+
e?.(c), N || c.preventDefault();
|
|
1151
|
+
},
|
|
1152
|
+
onPointerDownOutside: (c) => {
|
|
1153
|
+
if (t?.(c), !h || c.defaultPrevented) {
|
|
1154
|
+
c.preventDefault();
|
|
1155
|
+
return;
|
|
1156
|
+
}
|
|
1157
|
+
D.current && (D.current = !1);
|
|
1158
|
+
},
|
|
1159
|
+
onFocusOutside: (c) => {
|
|
1160
|
+
if (!h) {
|
|
1161
|
+
c.preventDefault();
|
|
1162
|
+
return;
|
|
1163
|
+
}
|
|
1164
|
+
},
|
|
1165
|
+
onPointerMove: (c) => {
|
|
1166
|
+
if (R.current = c, w || (a.onPointerMove == null || a.onPointerMove.call(a, c), !d.current)) return;
|
|
1167
|
+
const V = c.pageY - d.current.y, F = c.pageX - d.current.x, Y = c.pointerType === "touch" ? 10 : 2;
|
|
1168
|
+
M({
|
|
1169
|
+
x: F,
|
|
1170
|
+
y: V
|
|
1171
|
+
}, H, Y) ? v(c) : (Math.abs(F) > Y || Math.abs(V) > Y) && (d.current = null);
|
|
1172
|
+
},
|
|
1173
|
+
onPointerUp: (c) => {
|
|
1174
|
+
a.onPointerUp == null || a.onPointerUp.call(a, c), d.current = null, b.current = !1, s(c);
|
|
1175
|
+
},
|
|
1176
|
+
onPointerOut: (c) => {
|
|
1177
|
+
a.onPointerOut == null || a.onPointerOut.call(a, c), z(R.current);
|
|
1178
|
+
},
|
|
1179
|
+
onContextMenu: (c) => {
|
|
1180
|
+
a.onContextMenu == null || a.onContextMenu.call(a, c), R.current && z(R.current);
|
|
1181
|
+
}
|
|
1182
|
+
});
|
|
1183
|
+
});
|
|
1184
|
+
Pe.displayName = "Drawer.Content";
|
|
1185
|
+
const qn = 250, Xn = 120, Gn = /* @__PURE__ */ i.forwardRef(function({ preventCycle: t = !1, children: n, ...e }, a) {
|
|
1186
|
+
const { closeDrawer: o, isDragging: r, snapPoints: l, activeSnapPoint: s, setActiveSnapPoint: v, dismissible: D, handleOnly: g, isOpen: m, onPress: h, onDrag: W } = vt(), H = i.useRef(null), x = i.useRef(!1);
|
|
1187
|
+
function U() {
|
|
1188
|
+
if (x.current) {
|
|
1189
|
+
N();
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
window.setTimeout(() => {
|
|
1193
|
+
w();
|
|
1194
|
+
}, Xn);
|
|
1195
|
+
}
|
|
1196
|
+
function w() {
|
|
1197
|
+
if (r || t || x.current) {
|
|
1198
|
+
N();
|
|
1199
|
+
return;
|
|
1200
|
+
}
|
|
1201
|
+
if (N(), !l || l.length === 0) {
|
|
1202
|
+
D || o();
|
|
1203
|
+
return;
|
|
1204
|
+
}
|
|
1205
|
+
if (s === l[l.length - 1] && D) {
|
|
1206
|
+
o();
|
|
1207
|
+
return;
|
|
1208
|
+
}
|
|
1209
|
+
const X = l.findIndex((d) => d === s);
|
|
1210
|
+
if (X === -1) return;
|
|
1211
|
+
const et = l[X + 1];
|
|
1212
|
+
v(et);
|
|
1213
|
+
}
|
|
1214
|
+
function $() {
|
|
1215
|
+
H.current = window.setTimeout(() => {
|
|
1216
|
+
x.current = !0;
|
|
1217
|
+
}, qn);
|
|
1218
|
+
}
|
|
1219
|
+
function N() {
|
|
1220
|
+
H.current && window.clearTimeout(H.current), x.current = !1;
|
|
1221
|
+
}
|
|
1222
|
+
return /* @__PURE__ */ i.createElement("div", {
|
|
1223
|
+
onClick: U,
|
|
1224
|
+
onPointerCancel: N,
|
|
1225
|
+
onPointerDown: (f) => {
|
|
1226
|
+
g && h(f), $();
|
|
1227
|
+
},
|
|
1228
|
+
onPointerMove: (f) => {
|
|
1229
|
+
g && W(f);
|
|
1230
|
+
},
|
|
1231
|
+
// onPointerUp is already handled by the content component
|
|
1232
|
+
ref: a,
|
|
1233
|
+
"data-vaul-drawer-visible": m ? "true" : "false",
|
|
1234
|
+
"data-vaul-handle": "",
|
|
1235
|
+
"aria-hidden": "true",
|
|
1236
|
+
...e
|
|
1237
|
+
}, /* @__PURE__ */ i.createElement("span", {
|
|
1238
|
+
"data-vaul-handle-hitarea": "",
|
|
1239
|
+
"aria-hidden": "true"
|
|
1240
|
+
}, n));
|
|
1241
|
+
});
|
|
1242
|
+
Gn.displayName = "Drawer.Handle";
|
|
1243
|
+
function Kn(t) {
|
|
1244
|
+
const n = vt(), { container: e = n.container, ...a } = t;
|
|
1245
|
+
return /* @__PURE__ */ i.createElement(wn, {
|
|
1246
|
+
container: e,
|
|
1247
|
+
...a
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
const tt = {
|
|
1251
|
+
Root: jn,
|
|
1252
|
+
Content: Pe,
|
|
1253
|
+
Overlay: Ae,
|
|
1254
|
+
Trigger: hn,
|
|
1255
|
+
Portal: Kn,
|
|
1256
|
+
Close: Rn,
|
|
1257
|
+
Title: bn,
|
|
1258
|
+
Description: Dn
|
|
1259
|
+
}, rr = ({ trigger: t, title: n, description: e, children: a, direction: o = "right", size: r = "320px" }) => {
|
|
1260
|
+
const l = "!font-sans fixed", s = {
|
|
1261
|
+
left: {
|
|
1262
|
+
className: `${l} top-0 bottom-0 left-0 shadow-[20px_0_20px_rgba(0,0,0,0.4)]`,
|
|
1263
|
+
style: { width: r }
|
|
1264
|
+
},
|
|
1265
|
+
right: {
|
|
1266
|
+
className: `${l} top-0 bottom-0 right-0 shadow-[-20px_0_20px_rgba(0,0,0,0.4)]`,
|
|
1267
|
+
style: { width: r }
|
|
1268
|
+
},
|
|
1269
|
+
top: {
|
|
1270
|
+
className: `${l} top-0 left-0 right-0 shadow-[0_20px_20px_rgba(0,0,0,0.4)]`,
|
|
1271
|
+
style: { height: r }
|
|
1272
|
+
},
|
|
1273
|
+
bottom: {
|
|
1274
|
+
className: `${l} bottom-0 left-0 right-0 shadow-[0_-20px_20px_rgba(0,0,0,0.4)]`,
|
|
1275
|
+
style: { height: r }
|
|
1276
|
+
}
|
|
1277
|
+
}, { className: v, style: D } = s[o];
|
|
1278
|
+
return /* @__PURE__ */ gt(tt.Root, { direction: o, children: [
|
|
1279
|
+
/* @__PURE__ */ S(tt.Trigger, { asChild: !0, children: t }),
|
|
1280
|
+
/* @__PURE__ */ gt(tt.Portal, { children: [
|
|
1281
|
+
/* @__PURE__ */ S(tt.Overlay, { className: "fixed inset-0 bg-transparent" }),
|
|
1282
|
+
/* @__PURE__ */ gt(tt.Content, { className: `bg-drawer-bg z-10 flex flex-col p-4 outline-none ${v}`, style: D, children: [
|
|
1283
|
+
/* @__PURE__ */ S(tt.Close, {}),
|
|
1284
|
+
/* @__PURE__ */ S(tt.Title, { className: "text-text-primary mb-2 text-lg font-semibold", children: n }),
|
|
1285
|
+
/* @__PURE__ */ S(tt.Description, { className: "!text-text-secondary mb-2 !text-xs uppercase", children: e }),
|
|
1286
|
+
/* @__PURE__ */ S("div", { className: "pt-2", children: a })
|
|
1287
|
+
] })
|
|
1288
|
+
] })
|
|
1289
|
+
] });
|
|
1290
|
+
};
|
|
1291
|
+
export {
|
|
1292
|
+
rr as Drawer
|
|
1293
|
+
};
|