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