@spear-ai/spectral 1.9.1 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -5
- package/dist/.js +112 -239
- package/dist/Accordion-CDXdSAST.js +363 -0
- package/dist/Accordion.js +3 -498
- package/dist/Alert/AlertBase.js +69 -152
- package/dist/Alert.js +58 -106
- package/dist/AnimatePresence-D-9jXfgI.js +178 -0
- package/dist/App.js +6 -6
- package/dist/Avatar.js +83 -65
- package/dist/Badge.d.ts +1 -3
- package/dist/Badge.js +21 -25
- package/dist/Button.js +102 -178
- package/dist/ButtonGroup/ButtonGroupButton.js +38 -40
- package/dist/ButtonGroup.js +55 -59
- package/dist/ButtonIcon.js +58 -134
- package/dist/Calendar-s4lyijkn.js +3109 -0
- package/dist/Checkbox/CheckboxBase.js +94 -126
- package/dist/Checkbox.d.ts +1 -1
- package/dist/Checkbox.js +40 -105
- package/dist/Combobox/ComboboxBase.js +2 -79
- package/dist/Combobox.js +106 -172
- package/dist/ComboboxBase-D8Nf4xC-.js +491 -0
- package/dist/ControlGroup/ControlGroupSelect.d.ts +1 -1
- package/dist/ControlGroup/ControlGroupSelect.js +85 -101
- package/dist/ControlGroup.js +45 -48
- package/dist/DataCard/Card.js +37 -12
- package/dist/DataCard.d.ts +1 -1
- package/dist/DataCard.js +36 -16
- package/dist/DateTimePicker/Calendar.js +2 -2967
- package/dist/DateTimePicker/DateTimeDisplayInput.d.ts +1 -1
- package/dist/DateTimePicker/DateTimeDisplayInput.js +379 -275
- package/dist/DateTimePicker/DateTimeInput.d.ts +1 -1
- package/dist/DateTimePicker/DateTimeInput.js +133 -141
- package/dist/DateTimePicker/DateTimeUtils.js +2 -2193
- package/dist/DateTimePicker/TimePeriodSelect.d.ts +1 -1
- package/dist/DateTimePicker/TimePeriodSelect.js +45 -20
- package/dist/DateTimePicker/TimePicker.d.ts +1 -1
- package/dist/DateTimePicker/TimePicker.js +76 -60
- package/dist/DateTimePicker.d.ts +2 -2
- package/dist/DateTimePicker.js +87 -205
- package/dist/DateTimeUtils-DVvG6H-p.js +2098 -0
- package/dist/Dialog.js +74 -74
- package/dist/Drawer.js +67 -37
- package/dist/HoverCard-CYDsIiVK.js +201 -0
- package/dist/HoverCard.d.ts +1 -1
- package/dist/HoverCard.js +2 -218
- package/dist/Icons/AnalyzeIcon.js +50 -57
- package/dist/Icons/AnnotationsIcon.js +20 -15
- package/dist/Icons/ApprovedIcon.js +26 -18
- package/dist/Icons/ArrowDownIcon.js +20 -6
- package/dist/Icons/ArrowUpIcon.js +20 -6
- package/dist/Icons/BoxToolIcon.js +17 -12
- package/dist/Icons/CalendarIcon.js +43 -20
- package/dist/Icons/CheckCircleIcon.js +26 -10
- package/dist/Icons/CheckSquareIcon.js +26 -10
- package/dist/Icons/CheckmarkIcon.js +22 -9
- package/dist/Icons/ChevronDownIcon.js +22 -9
- package/dist/Icons/ChevronUpIcon.js +22 -9
- package/dist/Icons/ClockIcon.js +26 -18
- package/dist/Icons/CloseCircleIcon.js +26 -10
- package/dist/Icons/CloseIcon.js +18 -9
- package/dist/Icons/DashboardIcon.js +36 -10
- package/dist/Icons/DatabaseIcon.js +36 -19
- package/dist/Icons/DeleteIcon.js +36 -19
- package/dist/Icons/DurationIcon.js +57 -22
- package/dist/Icons/EditIcon.js +26 -27
- package/dist/Icons/EmailIcon.js +26 -10
- package/dist/Icons/EraserIcon.js +41 -25
- package/dist/Icons/ErrorIcon.js +27 -11
- package/dist/Icons/EyeClosedIcon.js +29 -13
- package/dist/Icons/EyeClosedIcon2.js +27 -11
- package/dist/Icons/EyeOpenIcon.js +22 -9
- package/dist/Icons/FileDownloadIcon.js +43 -20
- package/dist/Icons/GoToFirstIcon.js +26 -9
- package/dist/Icons/GoToLastIcon.js +26 -9
- package/dist/Icons/HarmonicCursorsIcon.js +23 -9
- package/dist/Icons/IconBase.d.ts +3 -3
- package/dist/Icons/IconBase.js +49 -66
- package/dist/Icons/InfoIcon.js +36 -10
- package/dist/Icons/KeyboardIcon.js +26 -27
- package/dist/Icons/LabelIcon.js +19 -14
- package/dist/Icons/LassoIcon.js +36 -28
- package/dist/Icons/LineToolIcon.js +48 -39
- package/dist/Icons/LiveViewIcon.js +50 -12
- package/dist/Icons/LoaderIcon.js +67 -27
- package/dist/Icons/LocationIcon.js +26 -27
- package/dist/Icons/LogoutIcon.js +20 -15
- package/dist/Icons/MeasureIcon.js +78 -25
- package/dist/Icons/MessagesIcon.js +33 -18
- package/dist/Icons/MetadataIcon.js +20 -15
- package/dist/Icons/MinusIcon.d.ts +1 -1
- package/dist/Icons/MinusIcon.js +18 -6
- package/dist/Icons/OntologyIcon.js +87 -71
- package/dist/Icons/PanelIconClose.js +28 -10
- package/dist/Icons/PanelIconOpen.js +28 -10
- package/dist/Icons/PlayIcon.js +20 -6
- package/dist/Icons/PlusIcon.js +20 -14
- package/dist/Icons/PolygonIcon.js +50 -39
- package/dist/Icons/ProgressCheckIcon.d.ts +5 -0
- package/dist/Icons/ProgressCheckIcon.js +58 -0
- package/dist/Icons/ResetIcon.js +17 -12
- package/dist/Icons/ReviewedIcon.js +36 -19
- package/dist/Icons/ScissorsIcon.js +22 -17
- package/dist/Icons/SearchIcon.js +26 -9
- package/dist/Icons/SettingsIcon.js +26 -27
- package/dist/Icons/SortAscendingIcon.js +50 -12
- package/dist/Icons/SortAtoZIcon.js +50 -12
- package/dist/Icons/SortDescendingIcon.js +50 -12
- package/dist/Icons/SortZtoAIcon.js +50 -12
- package/dist/Icons/StackIcon.js +26 -9
- package/dist/Icons/StarIcon.js +20 -6
- package/dist/Icons/TrashIcon.js +17 -12
- package/dist/Icons/UndoIcon.js +20 -15
- package/dist/Icons/User2Icon.js +26 -10
- package/dist/Icons/UserIcon.js +19 -14
- package/dist/Icons/WarningIcon.js +19 -14
- package/dist/Icons/ZoomAllIcon.js +71 -15
- package/dist/Icons/ZoomXIcon.js +36 -10
- package/dist/Icons/ZoomYIcon.js +36 -10
- package/dist/Icons/index.d.ts +1 -0
- package/dist/Icons.js +68 -136
- package/dist/IconsAnimated/PanelLeftCloseIcon.js +66 -36
- package/dist/IconsAnimated/PanelLeftOpenIcon.js +66 -36
- package/dist/IconsAnimated.js +3 -6
- package/dist/Input/InputUtils.js +51 -52
- package/dist/Input.js +132 -185
- package/dist/InputOTP-XUWW9xcI.js +461 -0
- package/dist/InputOTP.js +2 -382
- package/dist/Kbd.d.ts +1 -1
- package/dist/Kbd.js +182 -86
- package/dist/Label.js +12 -14
- package/dist/MultiSelect/MultiSelectBase.js +331 -403
- package/dist/MultiSelect.d.ts +1 -1
- package/dist/MultiSelect.js +23 -23
- package/dist/Popover.js +28 -32
- package/dist/RadioButton.d.ts +17 -0
- package/dist/RadioButton.js +33 -0
- package/dist/RadioButtonGroup/RadioButtonGroupBase.d.ts +3 -1
- package/dist/RadioButtonGroup/RadioButtonGroupBase.js +49 -46
- package/dist/RadioButtonGroup.d.ts +1 -1
- package/dist/RadioButtonGroup.js +11 -8
- package/dist/RadioGroup-w_q6RGEK.js +447 -0
- package/dist/RadioGroup.js +2 -505
- package/dist/Select.js +163 -186
- package/dist/Separator.js +16 -19
- package/dist/Skeleton.js +10 -6
- package/dist/Slider-BzzZT3Zm.js +490 -0
- package/dist/Slider.js +2 -562
- package/dist/SpectralProvider.js +8 -5
- package/dist/Switch/SwitchBase.js +91 -95
- package/dist/Switch-CVzRJ-0n.js +126 -0
- package/dist/Switch.d.ts +1 -1
- package/dist/Switch.js +2 -134
- package/dist/Tabs/TabsBase.js +242 -250
- package/dist/Tabs/tabsUtils.js +65 -73
- package/dist/Tabs.d.ts +1 -1
- package/dist/Tabs.js +73 -103
- package/dist/Textarea/TextareaUtils.js +35 -46
- package/dist/Textarea.js +83 -160
- package/dist/Toast-9zqXxKKO.js +711 -0
- package/dist/Toast.js +2 -885
- package/dist/Toggle/ToggleBase.js +46 -56
- package/dist/Toggle.d.ts +1 -1
- package/dist/Toggle.js +52 -62
- package/dist/ToggleGroup/ToggleGroupBase.js +128 -104
- package/dist/ToggleGroup.d.ts +1 -1
- package/dist/ToggleGroup.js +52 -63
- package/dist/Tooltip-D1K8kY1y.js +389 -0
- package/dist/Tooltip.js +2 -365
- package/dist/Tray.js +174 -217
- package/dist/chunk-h9knIhTc.js +20 -0
- package/dist/clsx-jM1GlMvB.js +16 -0
- package/dist/dist-3Af8168y.js +913 -0
- package/dist/dist-7HRQ5IKN.js +249 -0
- package/dist/dist-B2k1iWFp.js +129 -0
- package/dist/dist-B4FgboI8.js +122 -0
- package/dist/dist-B4g6zpUF.js +33 -0
- package/dist/dist-B9tup-4O.js +216 -0
- package/dist/dist-BK1K0g9W.js +29 -0
- package/dist/dist-Bfjk-jx9.js +28 -0
- package/dist/dist-Bft31cJh.js +65 -0
- package/dist/dist-BtdmHAzK.js +190 -0
- package/dist/dist-C0Hifjgh.js +1287 -0
- package/dist/dist-CGzgmYB9.js +68 -0
- package/dist/dist-ClmepHp4.js +10 -0
- package/dist/dist-D8Wb_MX9.js +6 -0
- package/dist/dist-Dtvmk11N.js +12 -0
- package/dist/dist-fW81qjVl.js +677 -0
- package/dist/dist-s1uWaZYZ.js +11 -0
- package/dist/es2015-YHaMV-St.js +701 -0
- package/dist/hooks/useAccordionAutoScroll.js +66 -67
- package/dist/hooks/useControllableState.js +14 -13
- package/dist/hooks/useTheme.js +21 -17
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/main.js +18954 -27224
- package/dist/primitives/button.js +39 -41
- package/dist/primitives/input-group.js +57 -73
- package/dist/primitives/input.js +11 -20
- package/dist/primitives/popover.js +34 -28
- package/dist/primitives/select.js +70 -138
- package/dist/primitives/slot.js +32 -31
- package/dist/primitives/textarea.js +10 -16
- package/dist/proxy-Dn10Pl_g.js +4920 -0
- package/dist/styles/main.css +2 -1
- package/dist/styles/spectral.css +1 -1
- package/dist/twUtils-VNWgstKL.js +1673 -0
- package/dist/use-animation-CBUDycyW.js +57 -0
- package/dist/utils/constants.js +4 -4
- package/dist/utils/formFieldUtils.js +136 -148
- package/dist/utils/sharedUtils.js +26 -7
- package/dist/utils/twUtils.js +2 -2919
- package/package.json +24 -28
- package/dist/ComboboxBase-CxNxYtdT.js +0 -408
- package/dist/clsx-OuTLNxxd.js +0 -16
- package/dist/index-0ioNhtNM.js +0 -10
- package/dist/index-6oYKCvIn.js +0 -677
- package/dist/index-BFOf48AQ.js +0 -69
- package/dist/index-BZPx6jYI.js +0 -8
- package/dist/index-BlHU_t18.js +0 -142
- package/dist/index-Bm1RbF6w.js +0 -1037
- package/dist/index-Bv2OIg5P.js +0 -225
- package/dist/index-CKEI0pDv.js +0 -56
- package/dist/index-CM_hWgfC.js +0 -32
- package/dist/index-C_YVr64u.js +0 -1538
- package/dist/index-Cl8VeY0o.js +0 -149
- package/dist/index-CwSyIPrv.js +0 -13
- package/dist/index-D29mdTf5.js +0 -34
- package/dist/index-DEYs15GP.js +0 -66
- package/dist/index-Dc0No4pV.js +0 -233
- package/dist/index-T6XEa11q.js +0 -822
- package/dist/index-pBCLb6Gr.js +0 -240
- package/dist/index-psiVrsnE.js +0 -27
- package/dist/index-rKs9bXHr.js +0 -6
- package/dist/proxy-CO_-Vget.js +0 -4975
- package/dist/use-animation-DhEPRwZ3.js +0 -62
package/dist/index-Bm1RbF6w.js
DELETED
|
@@ -1,1037 +0,0 @@
|
|
|
1
|
-
import { O as me, a as pe, b as we, C as he, T as ge, D as ve, R as ye, P as be } from "./index-pBCLb6Gr.js";
|
|
2
|
-
import * as Se from "react";
|
|
3
|
-
import r, { useMemo as Te, useLayoutEffect as Re, useEffect as Ee } from "react";
|
|
4
|
-
function De(t) {
|
|
5
|
-
if (typeof document > "u") return;
|
|
6
|
-
let n = document.head || document.getElementsByTagName("head")[0], e = document.createElement("style");
|
|
7
|
-
e.type = "text/css", n.appendChild(e), e.styleSheet ? e.styleSheet.cssText = t : e.appendChild(document.createTextNode(t));
|
|
8
|
-
}
|
|
9
|
-
const Wt = r.createContext({
|
|
10
|
-
drawerRef: {
|
|
11
|
-
current: null
|
|
12
|
-
},
|
|
13
|
-
overlayRef: {
|
|
14
|
-
current: null
|
|
15
|
-
},
|
|
16
|
-
onPress: () => {
|
|
17
|
-
},
|
|
18
|
-
onRelease: () => {
|
|
19
|
-
},
|
|
20
|
-
onDrag: () => {
|
|
21
|
-
},
|
|
22
|
-
onNestedDrag: () => {
|
|
23
|
-
},
|
|
24
|
-
onNestedOpenChange: () => {
|
|
25
|
-
},
|
|
26
|
-
onNestedRelease: () => {
|
|
27
|
-
},
|
|
28
|
-
openProp: void 0,
|
|
29
|
-
dismissible: !1,
|
|
30
|
-
isOpen: !1,
|
|
31
|
-
isDragging: !1,
|
|
32
|
-
keyboardIsOpen: {
|
|
33
|
-
current: !1
|
|
34
|
-
},
|
|
35
|
-
snapPointsOffset: null,
|
|
36
|
-
snapPoints: null,
|
|
37
|
-
handleOnly: !1,
|
|
38
|
-
modal: !1,
|
|
39
|
-
shouldFade: !1,
|
|
40
|
-
activeSnapPoint: null,
|
|
41
|
-
onOpenChange: () => {
|
|
42
|
-
},
|
|
43
|
-
setActiveSnapPoint: () => {
|
|
44
|
-
},
|
|
45
|
-
closeDrawer: () => {
|
|
46
|
-
},
|
|
47
|
-
direction: "bottom",
|
|
48
|
-
shouldAnimate: {
|
|
49
|
-
current: !0
|
|
50
|
-
},
|
|
51
|
-
shouldScaleBackground: !1,
|
|
52
|
-
setBackgroundColorOnScale: !0,
|
|
53
|
-
noBodyStyles: !1,
|
|
54
|
-
container: null,
|
|
55
|
-
autoFocus: !1
|
|
56
|
-
}), ct = () => {
|
|
57
|
-
const t = r.useContext(Wt);
|
|
58
|
-
if (!t)
|
|
59
|
-
throw new Error("useDrawerContext must be used within a Drawer.Root");
|
|
60
|
-
return t;
|
|
61
|
-
};
|
|
62
|
-
De(`[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(
|
|
63
|
-
[data-state=closed]
|
|
64
|
-
){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)}}`);
|
|
65
|
-
function Oe() {
|
|
66
|
-
const t = navigator.userAgent;
|
|
67
|
-
return typeof window < "u" && (/Firefox/.test(t) && /Mobile/.test(t) || // Android Firefox
|
|
68
|
-
/FxiOS/.test(t));
|
|
69
|
-
}
|
|
70
|
-
function xe() {
|
|
71
|
-
return xt(/^Mac/);
|
|
72
|
-
}
|
|
73
|
-
function Ce() {
|
|
74
|
-
return xt(/^iPhone/);
|
|
75
|
-
}
|
|
76
|
-
function kt() {
|
|
77
|
-
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
78
|
-
}
|
|
79
|
-
function $e() {
|
|
80
|
-
return xt(/^iPad/) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
81
|
-
xe() && navigator.maxTouchPoints > 1;
|
|
82
|
-
}
|
|
83
|
-
function zt() {
|
|
84
|
-
return Ce() || $e();
|
|
85
|
-
}
|
|
86
|
-
function xt(t) {
|
|
87
|
-
return typeof window < "u" && window.navigator != null ? t.test(window.navigator.platform) : void 0;
|
|
88
|
-
}
|
|
89
|
-
const Ae = 24, Me = typeof window < "u" ? Re : Ee;
|
|
90
|
-
function Bt(...t) {
|
|
91
|
-
return (...n) => {
|
|
92
|
-
for (let e of t)
|
|
93
|
-
typeof e == "function" && e(...n);
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
const St = typeof document < "u" && window.visualViewport;
|
|
97
|
-
function Ut(t) {
|
|
98
|
-
let n = window.getComputedStyle(t);
|
|
99
|
-
return /(auto|scroll)/.test(n.overflow + n.overflowX + n.overflowY);
|
|
100
|
-
}
|
|
101
|
-
function Vt(t) {
|
|
102
|
-
for (Ut(t) && (t = t.parentElement); t && !Ut(t); )
|
|
103
|
-
t = t.parentElement;
|
|
104
|
-
return t || document.scrollingElement || document.documentElement;
|
|
105
|
-
}
|
|
106
|
-
const Pe = /* @__PURE__ */ new Set([
|
|
107
|
-
"checkbox",
|
|
108
|
-
"radio",
|
|
109
|
-
"range",
|
|
110
|
-
"color",
|
|
111
|
-
"file",
|
|
112
|
-
"image",
|
|
113
|
-
"button",
|
|
114
|
-
"submit",
|
|
115
|
-
"reset"
|
|
116
|
-
]);
|
|
117
|
-
let pt = 0, Tt;
|
|
118
|
-
function Ie(t = {}) {
|
|
119
|
-
let { isDisabled: n } = t;
|
|
120
|
-
Me(() => {
|
|
121
|
-
if (!n)
|
|
122
|
-
return pt++, pt === 1 && zt() && (Tt = _e()), () => {
|
|
123
|
-
pt--, pt === 0 && Tt?.();
|
|
124
|
-
};
|
|
125
|
-
}, [
|
|
126
|
-
n
|
|
127
|
-
]);
|
|
128
|
-
}
|
|
129
|
-
function _e() {
|
|
130
|
-
let t, n = 0, e = (f) => {
|
|
131
|
-
t = Vt(f.target), !(t === document.documentElement && t === document.body) && (n = f.changedTouches[0].pageY);
|
|
132
|
-
}, o = (f) => {
|
|
133
|
-
if (!t || t === document.documentElement || t === document.body) {
|
|
134
|
-
f.preventDefault();
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
let m = f.changedTouches[0].pageY, B = t.scrollTop, L = t.scrollHeight - t.clientHeight;
|
|
138
|
-
L !== 0 && ((B <= 0 && m > n || B >= L && m < n) && f.preventDefault(), n = m);
|
|
139
|
-
}, i = (f) => {
|
|
140
|
-
let m = f.target;
|
|
141
|
-
Dt(m) && m !== document.activeElement && (f.preventDefault(), m.style.transform = "translateY(-2000px)", m.focus(), requestAnimationFrame(() => {
|
|
142
|
-
m.style.transform = "";
|
|
143
|
-
}));
|
|
144
|
-
}, a = (f) => {
|
|
145
|
-
let m = f.target;
|
|
146
|
-
Dt(m) && (m.style.transform = "translateY(-2000px)", requestAnimationFrame(() => {
|
|
147
|
-
m.style.transform = "", St && (St.height < window.innerHeight ? requestAnimationFrame(() => {
|
|
148
|
-
Ft(m);
|
|
149
|
-
}) : St.addEventListener("resize", () => Ft(m), {
|
|
150
|
-
once: !0
|
|
151
|
-
}));
|
|
152
|
-
}));
|
|
153
|
-
}, v = () => {
|
|
154
|
-
window.scrollTo(0, 0);
|
|
155
|
-
}, w = window.pageXOffset, T = window.pageYOffset, E = Bt(He(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`));
|
|
156
|
-
window.scrollTo(0, 0);
|
|
157
|
-
let h = Bt(lt(document, "touchstart", e, {
|
|
158
|
-
passive: !1,
|
|
159
|
-
capture: !0
|
|
160
|
-
}), lt(document, "touchmove", o, {
|
|
161
|
-
passive: !1,
|
|
162
|
-
capture: !0
|
|
163
|
-
}), lt(document, "touchend", i, {
|
|
164
|
-
passive: !1,
|
|
165
|
-
capture: !0
|
|
166
|
-
}), lt(document, "focus", a, !0), lt(window, "scroll", v));
|
|
167
|
-
return () => {
|
|
168
|
-
E(), h(), window.scrollTo(w, T);
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
function He(t, n, e) {
|
|
172
|
-
let o = t.style[n];
|
|
173
|
-
return t.style[n] = e, () => {
|
|
174
|
-
t.style[n] = o;
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
function lt(t, n, e, o) {
|
|
178
|
-
return t.addEventListener(n, e, o), () => {
|
|
179
|
-
t.removeEventListener(n, e, o);
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
function Ft(t) {
|
|
183
|
-
let n = document.scrollingElement || document.documentElement;
|
|
184
|
-
for (; t && t !== n; ) {
|
|
185
|
-
let e = Vt(t);
|
|
186
|
-
if (e !== document.documentElement && e !== document.body && e !== t) {
|
|
187
|
-
let o = e.getBoundingClientRect().top, i = t.getBoundingClientRect().top, a = t.getBoundingClientRect().bottom;
|
|
188
|
-
const v = e.getBoundingClientRect().bottom + Ae;
|
|
189
|
-
a > v && (e.scrollTop += i - o);
|
|
190
|
-
}
|
|
191
|
-
t = e.parentElement;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
function Dt(t) {
|
|
195
|
-
return t instanceof HTMLInputElement && !Pe.has(t.type) || t instanceof HTMLTextAreaElement || t instanceof HTMLElement && t.isContentEditable;
|
|
196
|
-
}
|
|
197
|
-
function Ne(t, n) {
|
|
198
|
-
typeof t == "function" ? t(n) : t != null && (t.current = n);
|
|
199
|
-
}
|
|
200
|
-
function Le(...t) {
|
|
201
|
-
return (n) => t.forEach((e) => Ne(e, n));
|
|
202
|
-
}
|
|
203
|
-
function Yt(...t) {
|
|
204
|
-
return Se.useCallback(Le(...t), t);
|
|
205
|
-
}
|
|
206
|
-
const jt = /* @__PURE__ */ new WeakMap();
|
|
207
|
-
function $(t, n, e = !1) {
|
|
208
|
-
if (!t || !(t instanceof HTMLElement)) return;
|
|
209
|
-
let o = {};
|
|
210
|
-
Object.entries(n).forEach(([i, a]) => {
|
|
211
|
-
if (i.startsWith("--")) {
|
|
212
|
-
t.style.setProperty(i, a);
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
o[i] = t.style[i], t.style[i] = a;
|
|
216
|
-
}), !e && jt.set(t, o);
|
|
217
|
-
}
|
|
218
|
-
function ke(t, n) {
|
|
219
|
-
if (!t || !(t instanceof HTMLElement)) return;
|
|
220
|
-
let e = jt.get(t);
|
|
221
|
-
e && (t.style[n] = e[n]);
|
|
222
|
-
}
|
|
223
|
-
const C = (t) => {
|
|
224
|
-
switch (t) {
|
|
225
|
-
case "top":
|
|
226
|
-
case "bottom":
|
|
227
|
-
return !0;
|
|
228
|
-
case "left":
|
|
229
|
-
case "right":
|
|
230
|
-
return !1;
|
|
231
|
-
default:
|
|
232
|
-
return t;
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
function wt(t, n) {
|
|
236
|
-
if (!t)
|
|
237
|
-
return null;
|
|
238
|
-
const e = window.getComputedStyle(t), o = (
|
|
239
|
-
// @ts-ignore
|
|
240
|
-
e.transform || e.webkitTransform || e.mozTransform
|
|
241
|
-
);
|
|
242
|
-
let i = o.match(/^matrix3d\((.+)\)$/);
|
|
243
|
-
return i ? parseFloat(i[1].split(", ")[C(n) ? 13 : 12]) : (i = o.match(/^matrix\((.+)\)$/), i ? parseFloat(i[1].split(", ")[C(n) ? 5 : 4]) : null);
|
|
244
|
-
}
|
|
245
|
-
function Be(t) {
|
|
246
|
-
return 8 * (Math.log(t + 1) - 2);
|
|
247
|
-
}
|
|
248
|
-
function Rt(t, n) {
|
|
249
|
-
if (!t) return () => {
|
|
250
|
-
};
|
|
251
|
-
const e = t.style.cssText;
|
|
252
|
-
return Object.assign(t.style, n), () => {
|
|
253
|
-
t.style.cssText = e;
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
function Ue(...t) {
|
|
257
|
-
return (...n) => {
|
|
258
|
-
for (const e of t)
|
|
259
|
-
typeof e == "function" && e(...n);
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
const O = {
|
|
263
|
-
DURATION: 0.5,
|
|
264
|
-
EASE: [
|
|
265
|
-
0.32,
|
|
266
|
-
0.72,
|
|
267
|
-
0,
|
|
268
|
-
1
|
|
269
|
-
]
|
|
270
|
-
}, qt = 0.4, Fe = 0.25, We = 100, Xt = 8, Z = 16, Ot = 26, Et = "vaul-dragging";
|
|
271
|
-
function Kt(t) {
|
|
272
|
-
const n = r.useRef(t);
|
|
273
|
-
return r.useEffect(() => {
|
|
274
|
-
n.current = t;
|
|
275
|
-
}), r.useMemo(() => (...e) => n.current == null ? void 0 : n.current.call(n, ...e), []);
|
|
276
|
-
}
|
|
277
|
-
function ze({ defaultProp: t, onChange: n }) {
|
|
278
|
-
const e = r.useState(t), [o] = e, i = r.useRef(o), a = Kt(n);
|
|
279
|
-
return r.useEffect(() => {
|
|
280
|
-
i.current !== o && (a(o), i.current = o);
|
|
281
|
-
}, [
|
|
282
|
-
o,
|
|
283
|
-
i,
|
|
284
|
-
a
|
|
285
|
-
]), e;
|
|
286
|
-
}
|
|
287
|
-
function Gt({ prop: t, defaultProp: n, onChange: e = () => {
|
|
288
|
-
} }) {
|
|
289
|
-
const [o, i] = ze({
|
|
290
|
-
defaultProp: n,
|
|
291
|
-
onChange: e
|
|
292
|
-
}), a = t !== void 0, v = a ? t : o, w = Kt(e), T = r.useCallback((E) => {
|
|
293
|
-
if (a) {
|
|
294
|
-
const f = typeof E == "function" ? E(t) : E;
|
|
295
|
-
f !== t && w(f);
|
|
296
|
-
} else
|
|
297
|
-
i(E);
|
|
298
|
-
}, [
|
|
299
|
-
a,
|
|
300
|
-
t,
|
|
301
|
-
i,
|
|
302
|
-
w
|
|
303
|
-
]);
|
|
304
|
-
return [
|
|
305
|
-
v,
|
|
306
|
-
T
|
|
307
|
-
];
|
|
308
|
-
}
|
|
309
|
-
function Ve({ activeSnapPointProp: t, setActiveSnapPointProp: n, snapPoints: e, drawerRef: o, overlayRef: i, fadeFromIndex: a, onSnapPointChange: v, direction: w = "bottom", container: T, snapToSequentialPoint: E }) {
|
|
310
|
-
const [h, f] = Gt({
|
|
311
|
-
prop: t,
|
|
312
|
-
defaultProp: e?.[0],
|
|
313
|
-
onChange: n
|
|
314
|
-
}), [m, B] = r.useState(typeof window < "u" ? {
|
|
315
|
-
innerWidth: window.innerWidth,
|
|
316
|
-
innerHeight: window.innerHeight
|
|
317
|
-
} : void 0);
|
|
318
|
-
r.useEffect(() => {
|
|
319
|
-
function u() {
|
|
320
|
-
B({
|
|
321
|
-
innerWidth: window.innerWidth,
|
|
322
|
-
innerHeight: window.innerHeight
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
return window.addEventListener("resize", u), () => window.removeEventListener("resize", u);
|
|
326
|
-
}, []);
|
|
327
|
-
const L = r.useMemo(() => h === e?.[e.length - 1] || null, [
|
|
328
|
-
e,
|
|
329
|
-
h
|
|
330
|
-
]), D = r.useMemo(() => {
|
|
331
|
-
var u;
|
|
332
|
-
return (u = e?.findIndex((b) => b === h)) != null ? u : null;
|
|
333
|
-
}, [
|
|
334
|
-
e,
|
|
335
|
-
h
|
|
336
|
-
]), U = e && e.length > 0 && (a || a === 0) && !Number.isNaN(a) && e[a] === h || !e, p = r.useMemo(() => {
|
|
337
|
-
const u = T ? {
|
|
338
|
-
width: T.getBoundingClientRect().width,
|
|
339
|
-
height: T.getBoundingClientRect().height
|
|
340
|
-
} : typeof window < "u" ? {
|
|
341
|
-
width: window.innerWidth,
|
|
342
|
-
height: window.innerHeight
|
|
343
|
-
} : {
|
|
344
|
-
width: 0,
|
|
345
|
-
height: 0
|
|
346
|
-
};
|
|
347
|
-
var b;
|
|
348
|
-
return (b = e?.map((y) => {
|
|
349
|
-
const _ = typeof y == "string";
|
|
350
|
-
let P = 0;
|
|
351
|
-
if (_ && (P = parseInt(y, 10)), C(w)) {
|
|
352
|
-
const l = _ ? P : m ? y * u.height : 0;
|
|
353
|
-
return m ? w === "bottom" ? u.height - l : -u.height + l : l;
|
|
354
|
-
}
|
|
355
|
-
const W = _ ? P : m ? y * u.width : 0;
|
|
356
|
-
return m ? w === "right" ? u.width - W : -u.width + W : W;
|
|
357
|
-
})) != null ? b : [];
|
|
358
|
-
}, [
|
|
359
|
-
e,
|
|
360
|
-
m,
|
|
361
|
-
T
|
|
362
|
-
]), M = r.useMemo(() => D !== null ? p?.[D] : null, [
|
|
363
|
-
p,
|
|
364
|
-
D
|
|
365
|
-
]), A = r.useCallback((u) => {
|
|
366
|
-
var b;
|
|
367
|
-
const y = (b = p?.findIndex((_) => _ === u)) != null ? b : null;
|
|
368
|
-
v(y), $(o.current, {
|
|
369
|
-
transition: `transform ${O.DURATION}s cubic-bezier(${O.EASE.join(",")})`,
|
|
370
|
-
transform: C(w) ? `translate3d(0, ${u}px, 0)` : `translate3d(${u}px, 0, 0)`
|
|
371
|
-
}), p && y !== p.length - 1 && a !== void 0 && y !== a && y < a ? $(i.current, {
|
|
372
|
-
transition: `opacity ${O.DURATION}s cubic-bezier(${O.EASE.join(",")})`,
|
|
373
|
-
opacity: "0"
|
|
374
|
-
}) : $(i.current, {
|
|
375
|
-
transition: `opacity ${O.DURATION}s cubic-bezier(${O.EASE.join(",")})`,
|
|
376
|
-
opacity: "1"
|
|
377
|
-
}), f(e?.[Math.max(y, 0)]);
|
|
378
|
-
}, [
|
|
379
|
-
o.current,
|
|
380
|
-
e,
|
|
381
|
-
p,
|
|
382
|
-
a,
|
|
383
|
-
i,
|
|
384
|
-
f
|
|
385
|
-
]);
|
|
386
|
-
r.useEffect(() => {
|
|
387
|
-
if (h || t) {
|
|
388
|
-
var u;
|
|
389
|
-
const b = (u = e?.findIndex((y) => y === t || y === h)) != null ? u : -1;
|
|
390
|
-
p && b !== -1 && typeof p[b] == "number" && A(p[b]);
|
|
391
|
-
}
|
|
392
|
-
}, [
|
|
393
|
-
h,
|
|
394
|
-
t,
|
|
395
|
-
e,
|
|
396
|
-
p,
|
|
397
|
-
A
|
|
398
|
-
]);
|
|
399
|
-
function c({ draggedDistance: u, closeDrawer: b, velocity: y, dismissible: _ }) {
|
|
400
|
-
if (a === void 0) return;
|
|
401
|
-
const P = w === "bottom" || w === "right" ? (M ?? 0) - u : (M ?? 0) + u, W = D === a - 1, l = D === 0, F = u > 0;
|
|
402
|
-
if (W && $(i.current, {
|
|
403
|
-
transition: `opacity ${O.DURATION}s cubic-bezier(${O.EASE.join(",")})`
|
|
404
|
-
}), !E && y > 2 && !F) {
|
|
405
|
-
_ ? b() : A(p[0]);
|
|
406
|
-
return;
|
|
407
|
-
}
|
|
408
|
-
if (!E && y > 2 && F && p && e) {
|
|
409
|
-
A(p[e.length - 1]);
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
const H = p?.reduce((I, q) => typeof I != "number" || typeof q != "number" ? I : Math.abs(q - P) < Math.abs(I - P) ? q : I), z = C(w) ? window.innerHeight : window.innerWidth;
|
|
413
|
-
if (y > qt && Math.abs(u) < z * 0.4) {
|
|
414
|
-
const I = F ? 1 : -1;
|
|
415
|
-
if (I > 0 && L && e) {
|
|
416
|
-
A(p[e.length - 1]);
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
if (l && I < 0 && _ && b(), D === null) return;
|
|
420
|
-
A(p[D + I]);
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
|
-
A(H);
|
|
424
|
-
}
|
|
425
|
-
function Y({ draggedDistance: u }) {
|
|
426
|
-
if (M === null) return;
|
|
427
|
-
const b = w === "bottom" || w === "right" ? M - u : M + u;
|
|
428
|
-
(w === "bottom" || w === "right") && b < p[p.length - 1] || (w === "top" || w === "left") && b > p[p.length - 1] || $(o.current, {
|
|
429
|
-
transform: C(w) ? `translate3d(0, ${b}px, 0)` : `translate3d(${b}px, 0, 0)`
|
|
430
|
-
});
|
|
431
|
-
}
|
|
432
|
-
function J(u, b) {
|
|
433
|
-
if (!e || typeof D != "number" || !p || a === void 0) return null;
|
|
434
|
-
const y = D === a - 1;
|
|
435
|
-
if (D >= a && b)
|
|
436
|
-
return 0;
|
|
437
|
-
if (y && !b) return 1;
|
|
438
|
-
if (!U && !y) return null;
|
|
439
|
-
const P = y ? D + 1 : D - 1, W = y ? p[P] - p[P - 1] : p[P + 1] - p[P], l = u / Math.abs(W);
|
|
440
|
-
return y ? 1 - l : l;
|
|
441
|
-
}
|
|
442
|
-
return {
|
|
443
|
-
isLastSnapPoint: L,
|
|
444
|
-
activeSnapPoint: h,
|
|
445
|
-
shouldFade: U,
|
|
446
|
-
getPercentageDragged: J,
|
|
447
|
-
setActiveSnapPoint: f,
|
|
448
|
-
activeSnapPointIndex: D,
|
|
449
|
-
onRelease: c,
|
|
450
|
-
onDrag: Y,
|
|
451
|
-
snapPointsOffset: p
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
const Ye = () => () => {
|
|
455
|
-
};
|
|
456
|
-
function je() {
|
|
457
|
-
const { direction: t, isOpen: n, shouldScaleBackground: e, setBackgroundColorOnScale: o, noBodyStyles: i } = ct(), a = r.useRef(null), v = Te(() => document.body.style.backgroundColor, []);
|
|
458
|
-
function w() {
|
|
459
|
-
return (window.innerWidth - Ot) / window.innerWidth;
|
|
460
|
-
}
|
|
461
|
-
r.useEffect(() => {
|
|
462
|
-
if (n && e) {
|
|
463
|
-
a.current && clearTimeout(a.current);
|
|
464
|
-
const T = document.querySelector("[data-vaul-drawer-wrapper]") || document.querySelector("[vaul-drawer-wrapper]");
|
|
465
|
-
if (!T) return;
|
|
466
|
-
Ue(o && !i ? Rt(document.body, {
|
|
467
|
-
background: "black"
|
|
468
|
-
}) : Ye, Rt(T, {
|
|
469
|
-
transformOrigin: C(t) ? "top" : "left",
|
|
470
|
-
transitionProperty: "transform, border-radius",
|
|
471
|
-
transitionDuration: `${O.DURATION}s`,
|
|
472
|
-
transitionTimingFunction: `cubic-bezier(${O.EASE.join(",")})`
|
|
473
|
-
}));
|
|
474
|
-
const E = Rt(T, {
|
|
475
|
-
borderRadius: `${Xt}px`,
|
|
476
|
-
overflow: "hidden",
|
|
477
|
-
...C(t) ? {
|
|
478
|
-
transform: `scale(${w()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`
|
|
479
|
-
} : {
|
|
480
|
-
transform: `scale(${w()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`
|
|
481
|
-
}
|
|
482
|
-
});
|
|
483
|
-
return () => {
|
|
484
|
-
E(), a.current = window.setTimeout(() => {
|
|
485
|
-
v ? document.body.style.background = v : document.body.style.removeProperty("background");
|
|
486
|
-
}, O.DURATION * 1e3);
|
|
487
|
-
};
|
|
488
|
-
}
|
|
489
|
-
}, [
|
|
490
|
-
n,
|
|
491
|
-
e,
|
|
492
|
-
v
|
|
493
|
-
]);
|
|
494
|
-
}
|
|
495
|
-
let ut = null;
|
|
496
|
-
function qe({ isOpen: t, modal: n, nested: e, hasBeenOpened: o, preventScrollRestoration: i, noBodyStyles: a }) {
|
|
497
|
-
const [v, w] = r.useState(() => typeof window < "u" ? window.location.href : ""), T = r.useRef(0), E = r.useCallback(() => {
|
|
498
|
-
if (kt() && ut === null && t && !a) {
|
|
499
|
-
ut = {
|
|
500
|
-
position: document.body.style.position,
|
|
501
|
-
top: document.body.style.top,
|
|
502
|
-
left: document.body.style.left,
|
|
503
|
-
height: document.body.style.height,
|
|
504
|
-
right: "unset"
|
|
505
|
-
};
|
|
506
|
-
const { scrollX: f, innerHeight: m } = window;
|
|
507
|
-
document.body.style.setProperty("position", "fixed", "important"), Object.assign(document.body.style, {
|
|
508
|
-
top: `${-T.current}px`,
|
|
509
|
-
left: `${-f}px`,
|
|
510
|
-
right: "0px",
|
|
511
|
-
height: "auto"
|
|
512
|
-
}), window.setTimeout(() => window.requestAnimationFrame(() => {
|
|
513
|
-
const B = m - window.innerHeight;
|
|
514
|
-
B && T.current >= m && (document.body.style.top = `${-(T.current + B)}px`);
|
|
515
|
-
}), 300);
|
|
516
|
-
}
|
|
517
|
-
}, [
|
|
518
|
-
t
|
|
519
|
-
]), h = r.useCallback(() => {
|
|
520
|
-
if (kt() && ut !== null && !a) {
|
|
521
|
-
const f = -parseInt(document.body.style.top, 10), m = -parseInt(document.body.style.left, 10);
|
|
522
|
-
Object.assign(document.body.style, ut), window.requestAnimationFrame(() => {
|
|
523
|
-
if (i && v !== window.location.href) {
|
|
524
|
-
w(window.location.href);
|
|
525
|
-
return;
|
|
526
|
-
}
|
|
527
|
-
window.scrollTo(m, f);
|
|
528
|
-
}), ut = null;
|
|
529
|
-
}
|
|
530
|
-
}, [
|
|
531
|
-
v
|
|
532
|
-
]);
|
|
533
|
-
return r.useEffect(() => {
|
|
534
|
-
function f() {
|
|
535
|
-
T.current = window.scrollY;
|
|
536
|
-
}
|
|
537
|
-
return f(), window.addEventListener("scroll", f), () => {
|
|
538
|
-
window.removeEventListener("scroll", f);
|
|
539
|
-
};
|
|
540
|
-
}, []), r.useEffect(() => {
|
|
541
|
-
if (n)
|
|
542
|
-
return () => {
|
|
543
|
-
typeof document > "u" || document.querySelector("[data-vaul-drawer]") || h();
|
|
544
|
-
};
|
|
545
|
-
}, [
|
|
546
|
-
n,
|
|
547
|
-
h
|
|
548
|
-
]), r.useEffect(() => {
|
|
549
|
-
e || !o || (t ? (!window.matchMedia("(display-mode: standalone)").matches && E(), n || window.setTimeout(() => {
|
|
550
|
-
h();
|
|
551
|
-
}, 500)) : h());
|
|
552
|
-
}, [
|
|
553
|
-
t,
|
|
554
|
-
o,
|
|
555
|
-
v,
|
|
556
|
-
n,
|
|
557
|
-
e,
|
|
558
|
-
E,
|
|
559
|
-
h
|
|
560
|
-
]), {
|
|
561
|
-
restorePositionSetting: h
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
|
-
function Xe({ open: t, onOpenChange: n, children: e, onDrag: o, onRelease: i, snapPoints: a, shouldScaleBackground: v = !1, setBackgroundColorOnScale: w = !0, closeThreshold: T = Fe, scrollLockTimeout: E = We, dismissible: h = !0, handleOnly: f = !1, fadeFromIndex: m = a && a.length - 1, activeSnapPoint: B, setActiveSnapPoint: L, fixed: D, modal: U = !0, onClose: p, nested: M, noBodyStyles: A = !1, direction: c = "bottom", defaultOpen: Y = !1, disablePreventScroll: J = !0, snapToSequentialPoint: u = !1, preventScrollRestoration: b = !1, repositionInputs: y = !0, onAnimationEnd: _, container: P, autoFocus: W = !1 }) {
|
|
565
|
-
var l, F;
|
|
566
|
-
const [H = !1, z] = Gt({
|
|
567
|
-
defaultProp: Y,
|
|
568
|
-
prop: t,
|
|
569
|
-
onChange: (s) => {
|
|
570
|
-
n?.(s), !s && !M && oe(), setTimeout(() => {
|
|
571
|
-
_?.(s);
|
|
572
|
-
}, O.DURATION * 1e3), s && !U && typeof window < "u" && window.requestAnimationFrame(() => {
|
|
573
|
-
document.body.style.pointerEvents = "auto";
|
|
574
|
-
}), s || (document.body.style.pointerEvents = "auto");
|
|
575
|
-
}
|
|
576
|
-
}), [I, q] = r.useState(!1), [X, rt] = r.useState(!1), [Zt, Ct] = r.useState(!1), tt = r.useRef(null), dt = r.useRef(null), ht = r.useRef(null), gt = r.useRef(null), at = r.useRef(null), ot = r.useRef(!1), vt = r.useRef(null), yt = r.useRef(0), et = r.useRef(!1), $t = r.useRef(!Y), At = r.useRef(0), d = r.useRef(null), Mt = r.useRef(((l = d.current) == null ? void 0 : l.getBoundingClientRect().height) || 0), Pt = r.useRef(((F = d.current) == null ? void 0 : F.getBoundingClientRect().width) || 0), bt = r.useRef(0), te = r.useCallback((s) => {
|
|
577
|
-
a && s === it.length - 1 && (dt.current = /* @__PURE__ */ new Date());
|
|
578
|
-
}, []), { activeSnapPoint: ee, activeSnapPointIndex: nt, setActiveSnapPoint: It, onRelease: ne, snapPointsOffset: it, onDrag: re, shouldFade: _t, getPercentageDragged: ae } = Ve({
|
|
579
|
-
snapPoints: a,
|
|
580
|
-
activeSnapPointProp: B,
|
|
581
|
-
setActiveSnapPointProp: L,
|
|
582
|
-
drawerRef: d,
|
|
583
|
-
fadeFromIndex: m,
|
|
584
|
-
overlayRef: tt,
|
|
585
|
-
onSnapPointChange: te,
|
|
586
|
-
direction: c,
|
|
587
|
-
container: P,
|
|
588
|
-
snapToSequentialPoint: u
|
|
589
|
-
});
|
|
590
|
-
Ie({
|
|
591
|
-
isDisabled: !H || X || !U || Zt || !I || !y || !J
|
|
592
|
-
});
|
|
593
|
-
const { restorePositionSetting: oe } = qe({
|
|
594
|
-
isOpen: H,
|
|
595
|
-
modal: U,
|
|
596
|
-
nested: M ?? !1,
|
|
597
|
-
hasBeenOpened: I,
|
|
598
|
-
preventScrollRestoration: b,
|
|
599
|
-
noBodyStyles: A
|
|
600
|
-
});
|
|
601
|
-
function ft() {
|
|
602
|
-
return (window.innerWidth - Ot) / window.innerWidth;
|
|
603
|
-
}
|
|
604
|
-
function ie(s) {
|
|
605
|
-
var S, R;
|
|
606
|
-
!h && !a || d.current && !d.current.contains(s.target) || (Mt.current = ((S = d.current) == null ? void 0 : S.getBoundingClientRect().height) || 0, Pt.current = ((R = d.current) == null ? void 0 : R.getBoundingClientRect().width) || 0, rt(!0), ht.current = /* @__PURE__ */ new Date(), zt() && window.addEventListener("touchend", () => ot.current = !1, {
|
|
607
|
-
once: !0
|
|
608
|
-
}), s.target.setPointerCapture(s.pointerId), yt.current = C(c) ? s.pageY : s.pageX);
|
|
609
|
-
}
|
|
610
|
-
function Ht(s, S) {
|
|
611
|
-
var R;
|
|
612
|
-
let g = s;
|
|
613
|
-
const x = (R = window.getSelection()) == null ? void 0 : R.toString(), k = d.current ? wt(d.current, c) : null, N = /* @__PURE__ */ new Date();
|
|
614
|
-
if (g.tagName === "SELECT" || g.hasAttribute("data-vaul-no-drag") || g.closest("[data-vaul-no-drag]"))
|
|
615
|
-
return !1;
|
|
616
|
-
if (c === "right" || c === "left")
|
|
617
|
-
return !0;
|
|
618
|
-
if (dt.current && N.getTime() - dt.current.getTime() < 500)
|
|
619
|
-
return !1;
|
|
620
|
-
if (k !== null && (c === "bottom" ? k > 0 : k < 0))
|
|
621
|
-
return !0;
|
|
622
|
-
if (x && x.length > 0)
|
|
623
|
-
return !1;
|
|
624
|
-
if (at.current && N.getTime() - at.current.getTime() < E && k === 0 || S)
|
|
625
|
-
return at.current = N, !1;
|
|
626
|
-
for (; g; ) {
|
|
627
|
-
if (g.scrollHeight > g.clientHeight) {
|
|
628
|
-
if (g.scrollTop !== 0)
|
|
629
|
-
return at.current = /* @__PURE__ */ new Date(), !1;
|
|
630
|
-
if (g.getAttribute("role") === "dialog")
|
|
631
|
-
return !0;
|
|
632
|
-
}
|
|
633
|
-
g = g.parentNode;
|
|
634
|
-
}
|
|
635
|
-
return !0;
|
|
636
|
-
}
|
|
637
|
-
function se(s) {
|
|
638
|
-
if (d.current && X) {
|
|
639
|
-
const S = c === "bottom" || c === "right" ? 1 : -1, R = (yt.current - (C(c) ? s.pageY : s.pageX)) * S, g = R > 0, x = a && !h && !g;
|
|
640
|
-
if (x && nt === 0) return;
|
|
641
|
-
const k = Math.abs(R), N = document.querySelector("[data-vaul-drawer-wrapper]"), K = c === "bottom" || c === "top" ? Mt.current : Pt.current;
|
|
642
|
-
let V = k / K;
|
|
643
|
-
const Q = ae(k, g);
|
|
644
|
-
if (Q !== null && (V = Q), x && V >= 1 || !ot.current && !Ht(s.target, g)) return;
|
|
645
|
-
if (d.current.classList.add(Et), ot.current = !0, $(d.current, {
|
|
646
|
-
transition: "none"
|
|
647
|
-
}), $(tt.current, {
|
|
648
|
-
transition: "none"
|
|
649
|
-
}), a && re({
|
|
650
|
-
draggedDistance: R
|
|
651
|
-
}), g && !a) {
|
|
652
|
-
const j = Be(R), mt = Math.min(j * -1, 0) * S;
|
|
653
|
-
$(d.current, {
|
|
654
|
-
transform: C(c) ? `translate3d(0, ${mt}px, 0)` : `translate3d(${mt}px, 0, 0)`
|
|
655
|
-
});
|
|
656
|
-
return;
|
|
657
|
-
}
|
|
658
|
-
const G = 1 - V;
|
|
659
|
-
if ((_t || m && nt === m - 1) && (o?.(s, V), $(tt.current, {
|
|
660
|
-
opacity: `${G}`,
|
|
661
|
-
transition: "none"
|
|
662
|
-
}, !0)), N && tt.current && v) {
|
|
663
|
-
const j = Math.min(ft() + V * (1 - ft()), 1), mt = 8 - V * 8, Lt = Math.max(0, 14 - V * 14);
|
|
664
|
-
$(N, {
|
|
665
|
-
borderRadius: `${mt}px`,
|
|
666
|
-
transform: C(c) ? `scale(${j}) translate3d(0, ${Lt}px, 0)` : `scale(${j}) translate3d(${Lt}px, 0, 0)`,
|
|
667
|
-
transition: "none"
|
|
668
|
-
}, !0);
|
|
669
|
-
}
|
|
670
|
-
if (!a) {
|
|
671
|
-
const j = k * S;
|
|
672
|
-
$(d.current, {
|
|
673
|
-
transform: C(c) ? `translate3d(0, ${j}px, 0)` : `translate3d(${j}px, 0, 0)`
|
|
674
|
-
});
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
r.useEffect(() => {
|
|
679
|
-
window.requestAnimationFrame(() => {
|
|
680
|
-
$t.current = !0;
|
|
681
|
-
});
|
|
682
|
-
}, []), r.useEffect(() => {
|
|
683
|
-
var s;
|
|
684
|
-
function S() {
|
|
685
|
-
if (!d.current || !y) return;
|
|
686
|
-
const R = document.activeElement;
|
|
687
|
-
if (Dt(R) || et.current) {
|
|
688
|
-
var g;
|
|
689
|
-
const x = ((g = window.visualViewport) == null ? void 0 : g.height) || 0, k = window.innerHeight;
|
|
690
|
-
let N = k - x;
|
|
691
|
-
const K = d.current.getBoundingClientRect().height || 0, V = K > k * 0.8;
|
|
692
|
-
bt.current || (bt.current = K);
|
|
693
|
-
const Q = d.current.getBoundingClientRect().top;
|
|
694
|
-
if (Math.abs(At.current - N) > 60 && (et.current = !et.current), a && a.length > 0 && it && nt) {
|
|
695
|
-
const G = it[nt] || 0;
|
|
696
|
-
N += G;
|
|
697
|
-
}
|
|
698
|
-
if (At.current = N, K > x || et.current) {
|
|
699
|
-
const G = d.current.getBoundingClientRect().height;
|
|
700
|
-
let j = G;
|
|
701
|
-
G > x && (j = x - (V ? Q : Ot)), D ? d.current.style.height = `${G - Math.max(N, 0)}px` : d.current.style.height = `${Math.max(j, x - Q)}px`;
|
|
702
|
-
} else Oe() || (d.current.style.height = `${bt.current}px`);
|
|
703
|
-
a && a.length > 0 && !et.current ? d.current.style.bottom = "0px" : d.current.style.bottom = `${Math.max(N, 0)}px`;
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
return (s = window.visualViewport) == null || s.addEventListener("resize", S), () => {
|
|
707
|
-
var R;
|
|
708
|
-
return (R = window.visualViewport) == null ? void 0 : R.removeEventListener("resize", S);
|
|
709
|
-
};
|
|
710
|
-
}, [
|
|
711
|
-
nt,
|
|
712
|
-
a,
|
|
713
|
-
it
|
|
714
|
-
]);
|
|
715
|
-
function st(s) {
|
|
716
|
-
le(), p?.(), s || z(!1), setTimeout(() => {
|
|
717
|
-
a && It(a[0]);
|
|
718
|
-
}, O.DURATION * 1e3);
|
|
719
|
-
}
|
|
720
|
-
function Nt() {
|
|
721
|
-
if (!d.current) return;
|
|
722
|
-
const s = document.querySelector("[data-vaul-drawer-wrapper]"), S = wt(d.current, c);
|
|
723
|
-
$(d.current, {
|
|
724
|
-
transform: "translate3d(0, 0, 0)",
|
|
725
|
-
transition: `transform ${O.DURATION}s cubic-bezier(${O.EASE.join(",")})`
|
|
726
|
-
}), $(tt.current, {
|
|
727
|
-
transition: `opacity ${O.DURATION}s cubic-bezier(${O.EASE.join(",")})`,
|
|
728
|
-
opacity: "1"
|
|
729
|
-
}), v && S && S > 0 && H && $(s, {
|
|
730
|
-
borderRadius: `${Xt}px`,
|
|
731
|
-
overflow: "hidden",
|
|
732
|
-
...C(c) ? {
|
|
733
|
-
transform: `scale(${ft()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,
|
|
734
|
-
transformOrigin: "top"
|
|
735
|
-
} : {
|
|
736
|
-
transform: `scale(${ft()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,
|
|
737
|
-
transformOrigin: "left"
|
|
738
|
-
},
|
|
739
|
-
transitionProperty: "transform, border-radius",
|
|
740
|
-
transitionDuration: `${O.DURATION}s`,
|
|
741
|
-
transitionTimingFunction: `cubic-bezier(${O.EASE.join(",")})`
|
|
742
|
-
}, !0);
|
|
743
|
-
}
|
|
744
|
-
function le() {
|
|
745
|
-
!X || !d.current || (d.current.classList.remove(Et), ot.current = !1, rt(!1), gt.current = /* @__PURE__ */ new Date());
|
|
746
|
-
}
|
|
747
|
-
function ue(s) {
|
|
748
|
-
if (!X || !d.current) return;
|
|
749
|
-
d.current.classList.remove(Et), ot.current = !1, rt(!1), gt.current = /* @__PURE__ */ new Date();
|
|
750
|
-
const S = wt(d.current, c);
|
|
751
|
-
if (!s || !Ht(s.target, !1) || !S || Number.isNaN(S) || ht.current === null) return;
|
|
752
|
-
const R = gt.current.getTime() - ht.current.getTime(), g = yt.current - (C(c) ? s.pageY : s.pageX), x = Math.abs(g) / R;
|
|
753
|
-
if (x > 0.05 && (Ct(!0), setTimeout(() => {
|
|
754
|
-
Ct(!1);
|
|
755
|
-
}, 200)), a) {
|
|
756
|
-
ne({
|
|
757
|
-
draggedDistance: g * (c === "bottom" || c === "right" ? 1 : -1),
|
|
758
|
-
closeDrawer: st,
|
|
759
|
-
velocity: x,
|
|
760
|
-
dismissible: h
|
|
761
|
-
}), i?.(s, !0);
|
|
762
|
-
return;
|
|
763
|
-
}
|
|
764
|
-
if (c === "bottom" || c === "right" ? g > 0 : g < 0) {
|
|
765
|
-
Nt(), i?.(s, !0);
|
|
766
|
-
return;
|
|
767
|
-
}
|
|
768
|
-
if (x > qt) {
|
|
769
|
-
st(), i?.(s, !1);
|
|
770
|
-
return;
|
|
771
|
-
}
|
|
772
|
-
var k;
|
|
773
|
-
const N = Math.min((k = d.current.getBoundingClientRect().height) != null ? k : 0, window.innerHeight);
|
|
774
|
-
var K;
|
|
775
|
-
const V = Math.min((K = d.current.getBoundingClientRect().width) != null ? K : 0, window.innerWidth), Q = c === "left" || c === "right";
|
|
776
|
-
if (Math.abs(S) >= (Q ? V : N) * T) {
|
|
777
|
-
st(), i?.(s, !1);
|
|
778
|
-
return;
|
|
779
|
-
}
|
|
780
|
-
i?.(s, !0), Nt();
|
|
781
|
-
}
|
|
782
|
-
r.useEffect(() => (H && ($(document.documentElement, {
|
|
783
|
-
scrollBehavior: "auto"
|
|
784
|
-
}), dt.current = /* @__PURE__ */ new Date()), () => {
|
|
785
|
-
ke(document.documentElement, "scrollBehavior");
|
|
786
|
-
}), [
|
|
787
|
-
H
|
|
788
|
-
]);
|
|
789
|
-
function ce(s) {
|
|
790
|
-
const S = s ? (window.innerWidth - Z) / window.innerWidth : 1, R = s ? -Z : 0;
|
|
791
|
-
vt.current && window.clearTimeout(vt.current), $(d.current, {
|
|
792
|
-
transition: `transform ${O.DURATION}s cubic-bezier(${O.EASE.join(",")})`,
|
|
793
|
-
transform: C(c) ? `scale(${S}) translate3d(0, ${R}px, 0)` : `scale(${S}) translate3d(${R}px, 0, 0)`
|
|
794
|
-
}), !s && d.current && (vt.current = setTimeout(() => {
|
|
795
|
-
const g = wt(d.current, c);
|
|
796
|
-
$(d.current, {
|
|
797
|
-
transition: "none",
|
|
798
|
-
transform: C(c) ? `translate3d(0, ${g}px, 0)` : `translate3d(${g}px, 0, 0)`
|
|
799
|
-
});
|
|
800
|
-
}, 500));
|
|
801
|
-
}
|
|
802
|
-
function de(s, S) {
|
|
803
|
-
if (S < 0) return;
|
|
804
|
-
const R = (window.innerWidth - Z) / window.innerWidth, g = R + S * (1 - R), x = -Z + S * Z;
|
|
805
|
-
$(d.current, {
|
|
806
|
-
transform: C(c) ? `scale(${g}) translate3d(0, ${x}px, 0)` : `scale(${g}) translate3d(${x}px, 0, 0)`,
|
|
807
|
-
transition: "none"
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
|
-
function fe(s, S) {
|
|
811
|
-
const R = C(c) ? window.innerHeight : window.innerWidth, g = S ? (R - Z) / R : 1, x = S ? -Z : 0;
|
|
812
|
-
S && $(d.current, {
|
|
813
|
-
transition: `transform ${O.DURATION}s cubic-bezier(${O.EASE.join(",")})`,
|
|
814
|
-
transform: C(c) ? `scale(${g}) translate3d(0, ${x}px, 0)` : `scale(${g}) translate3d(${x}px, 0, 0)`
|
|
815
|
-
});
|
|
816
|
-
}
|
|
817
|
-
return r.useEffect(() => {
|
|
818
|
-
U || window.requestAnimationFrame(() => {
|
|
819
|
-
document.body.style.pointerEvents = "auto";
|
|
820
|
-
});
|
|
821
|
-
}, [
|
|
822
|
-
U
|
|
823
|
-
]), /* @__PURE__ */ r.createElement(ye, {
|
|
824
|
-
defaultOpen: Y,
|
|
825
|
-
onOpenChange: (s) => {
|
|
826
|
-
!h && !s || (s ? q(!0) : st(!0), z(s));
|
|
827
|
-
},
|
|
828
|
-
open: H
|
|
829
|
-
}, /* @__PURE__ */ r.createElement(Wt.Provider, {
|
|
830
|
-
value: {
|
|
831
|
-
activeSnapPoint: ee,
|
|
832
|
-
snapPoints: a,
|
|
833
|
-
setActiveSnapPoint: It,
|
|
834
|
-
drawerRef: d,
|
|
835
|
-
overlayRef: tt,
|
|
836
|
-
onOpenChange: n,
|
|
837
|
-
onPress: ie,
|
|
838
|
-
onRelease: ue,
|
|
839
|
-
onDrag: se,
|
|
840
|
-
dismissible: h,
|
|
841
|
-
shouldAnimate: $t,
|
|
842
|
-
handleOnly: f,
|
|
843
|
-
isOpen: H,
|
|
844
|
-
isDragging: X,
|
|
845
|
-
shouldFade: _t,
|
|
846
|
-
closeDrawer: st,
|
|
847
|
-
onNestedDrag: de,
|
|
848
|
-
onNestedOpenChange: ce,
|
|
849
|
-
onNestedRelease: fe,
|
|
850
|
-
keyboardIsOpen: et,
|
|
851
|
-
modal: U,
|
|
852
|
-
snapPointsOffset: it,
|
|
853
|
-
activeSnapPointIndex: nt,
|
|
854
|
-
direction: c,
|
|
855
|
-
shouldScaleBackground: v,
|
|
856
|
-
setBackgroundColorOnScale: w,
|
|
857
|
-
noBodyStyles: A,
|
|
858
|
-
container: P,
|
|
859
|
-
autoFocus: W
|
|
860
|
-
}
|
|
861
|
-
}, e));
|
|
862
|
-
}
|
|
863
|
-
const Jt = /* @__PURE__ */ r.forwardRef(function({ ...t }, n) {
|
|
864
|
-
const { overlayRef: e, snapPoints: o, onRelease: i, shouldFade: a, isOpen: v, modal: w, shouldAnimate: T } = ct(), E = Yt(n, e), h = o && o.length > 0;
|
|
865
|
-
if (!w)
|
|
866
|
-
return null;
|
|
867
|
-
const f = r.useCallback((m) => i(m), [
|
|
868
|
-
i
|
|
869
|
-
]);
|
|
870
|
-
return /* @__PURE__ */ r.createElement(me, {
|
|
871
|
-
onMouseUp: f,
|
|
872
|
-
ref: E,
|
|
873
|
-
"data-vaul-overlay": "",
|
|
874
|
-
"data-vaul-snap-points": v && h ? "true" : "false",
|
|
875
|
-
"data-vaul-snap-points-overlay": v && a ? "true" : "false",
|
|
876
|
-
"data-vaul-animate": T?.current ? "true" : "false",
|
|
877
|
-
...t
|
|
878
|
-
});
|
|
879
|
-
});
|
|
880
|
-
Jt.displayName = "Drawer.Overlay";
|
|
881
|
-
const Qt = /* @__PURE__ */ r.forwardRef(function({ onPointerDownOutside: t, style: n, onOpenAutoFocus: e, ...o }, i) {
|
|
882
|
-
const { drawerRef: a, onPress: v, onRelease: w, onDrag: T, keyboardIsOpen: E, snapPointsOffset: h, activeSnapPointIndex: f, modal: m, isOpen: B, direction: L, snapPoints: D, container: U, handleOnly: p, shouldAnimate: M, autoFocus: A } = ct(), [c, Y] = r.useState(!1), J = Yt(i, a), u = r.useRef(null), b = r.useRef(null), y = r.useRef(!1), _ = D && D.length > 0;
|
|
883
|
-
je();
|
|
884
|
-
const P = (l, F, H = 0) => {
|
|
885
|
-
if (y.current) return !0;
|
|
886
|
-
const z = Math.abs(l.y), I = Math.abs(l.x), q = I > z, X = [
|
|
887
|
-
"bottom",
|
|
888
|
-
"right"
|
|
889
|
-
].includes(F) ? 1 : -1;
|
|
890
|
-
if (F === "left" || F === "right") {
|
|
891
|
-
if (!(l.x * X < 0) && I >= 0 && I <= H)
|
|
892
|
-
return q;
|
|
893
|
-
} else if (!(l.y * X < 0) && z >= 0 && z <= H)
|
|
894
|
-
return !q;
|
|
895
|
-
return y.current = !0, !0;
|
|
896
|
-
};
|
|
897
|
-
r.useEffect(() => {
|
|
898
|
-
_ && window.requestAnimationFrame(() => {
|
|
899
|
-
Y(!0);
|
|
900
|
-
});
|
|
901
|
-
}, []);
|
|
902
|
-
function W(l) {
|
|
903
|
-
u.current = null, y.current = !1, w(l);
|
|
904
|
-
}
|
|
905
|
-
return /* @__PURE__ */ r.createElement(pe, {
|
|
906
|
-
"data-vaul-drawer-direction": L,
|
|
907
|
-
"data-vaul-drawer": "",
|
|
908
|
-
"data-vaul-delayed-snap-points": c ? "true" : "false",
|
|
909
|
-
"data-vaul-snap-points": B && _ ? "true" : "false",
|
|
910
|
-
"data-vaul-custom-container": U ? "true" : "false",
|
|
911
|
-
"data-vaul-animate": M?.current ? "true" : "false",
|
|
912
|
-
...o,
|
|
913
|
-
ref: J,
|
|
914
|
-
style: h && h.length > 0 ? {
|
|
915
|
-
"--snap-point-height": `${h[f ?? 0]}px`,
|
|
916
|
-
...n
|
|
917
|
-
} : n,
|
|
918
|
-
onPointerDown: (l) => {
|
|
919
|
-
p || (o.onPointerDown == null || o.onPointerDown.call(o, l), u.current = {
|
|
920
|
-
x: l.pageX,
|
|
921
|
-
y: l.pageY
|
|
922
|
-
}, v(l));
|
|
923
|
-
},
|
|
924
|
-
onOpenAutoFocus: (l) => {
|
|
925
|
-
e?.(l), A || l.preventDefault();
|
|
926
|
-
},
|
|
927
|
-
onPointerDownOutside: (l) => {
|
|
928
|
-
if (t?.(l), !m || l.defaultPrevented) {
|
|
929
|
-
l.preventDefault();
|
|
930
|
-
return;
|
|
931
|
-
}
|
|
932
|
-
E.current && (E.current = !1);
|
|
933
|
-
},
|
|
934
|
-
onFocusOutside: (l) => {
|
|
935
|
-
if (!m) {
|
|
936
|
-
l.preventDefault();
|
|
937
|
-
return;
|
|
938
|
-
}
|
|
939
|
-
},
|
|
940
|
-
onPointerMove: (l) => {
|
|
941
|
-
if (b.current = l, p || (o.onPointerMove == null || o.onPointerMove.call(o, l), !u.current)) return;
|
|
942
|
-
const F = l.pageY - u.current.y, H = l.pageX - u.current.x, z = l.pointerType === "touch" ? 10 : 2;
|
|
943
|
-
P({
|
|
944
|
-
x: H,
|
|
945
|
-
y: F
|
|
946
|
-
}, L, z) ? T(l) : (Math.abs(H) > z || Math.abs(F) > z) && (u.current = null);
|
|
947
|
-
},
|
|
948
|
-
onPointerUp: (l) => {
|
|
949
|
-
o.onPointerUp == null || o.onPointerUp.call(o, l), u.current = null, y.current = !1, w(l);
|
|
950
|
-
},
|
|
951
|
-
onPointerOut: (l) => {
|
|
952
|
-
o.onPointerOut == null || o.onPointerOut.call(o, l), W(b.current);
|
|
953
|
-
},
|
|
954
|
-
onContextMenu: (l) => {
|
|
955
|
-
o.onContextMenu == null || o.onContextMenu.call(o, l), b.current && W(b.current);
|
|
956
|
-
}
|
|
957
|
-
});
|
|
958
|
-
});
|
|
959
|
-
Qt.displayName = "Drawer.Content";
|
|
960
|
-
const Ke = 250, Ge = 120, Je = /* @__PURE__ */ r.forwardRef(function({ preventCycle: t = !1, children: n, ...e }, o) {
|
|
961
|
-
const { closeDrawer: i, isDragging: a, snapPoints: v, activeSnapPoint: w, setActiveSnapPoint: T, dismissible: E, handleOnly: h, isOpen: f, onPress: m, onDrag: B } = ct(), L = r.useRef(null), D = r.useRef(!1);
|
|
962
|
-
function U() {
|
|
963
|
-
if (D.current) {
|
|
964
|
-
A();
|
|
965
|
-
return;
|
|
966
|
-
}
|
|
967
|
-
window.setTimeout(() => {
|
|
968
|
-
p();
|
|
969
|
-
}, Ge);
|
|
970
|
-
}
|
|
971
|
-
function p() {
|
|
972
|
-
if (a || t || D.current) {
|
|
973
|
-
A();
|
|
974
|
-
return;
|
|
975
|
-
}
|
|
976
|
-
if (A(), !v || v.length === 0) {
|
|
977
|
-
E || i();
|
|
978
|
-
return;
|
|
979
|
-
}
|
|
980
|
-
if (w === v[v.length - 1] && E) {
|
|
981
|
-
i();
|
|
982
|
-
return;
|
|
983
|
-
}
|
|
984
|
-
const Y = v.findIndex((u) => u === w);
|
|
985
|
-
if (Y === -1) return;
|
|
986
|
-
const J = v[Y + 1];
|
|
987
|
-
T(J);
|
|
988
|
-
}
|
|
989
|
-
function M() {
|
|
990
|
-
L.current = window.setTimeout(() => {
|
|
991
|
-
D.current = !0;
|
|
992
|
-
}, Ke);
|
|
993
|
-
}
|
|
994
|
-
function A() {
|
|
995
|
-
L.current && window.clearTimeout(L.current), D.current = !1;
|
|
996
|
-
}
|
|
997
|
-
return /* @__PURE__ */ r.createElement("div", {
|
|
998
|
-
onClick: U,
|
|
999
|
-
onPointerCancel: A,
|
|
1000
|
-
onPointerDown: (c) => {
|
|
1001
|
-
h && m(c), M();
|
|
1002
|
-
},
|
|
1003
|
-
onPointerMove: (c) => {
|
|
1004
|
-
h && B(c);
|
|
1005
|
-
},
|
|
1006
|
-
// onPointerUp is already handled by the content component
|
|
1007
|
-
ref: o,
|
|
1008
|
-
"data-vaul-drawer-visible": f ? "true" : "false",
|
|
1009
|
-
"data-vaul-handle": "",
|
|
1010
|
-
"aria-hidden": "true",
|
|
1011
|
-
...e
|
|
1012
|
-
}, /* @__PURE__ */ r.createElement("span", {
|
|
1013
|
-
"data-vaul-handle-hitarea": "",
|
|
1014
|
-
"aria-hidden": "true"
|
|
1015
|
-
}, n));
|
|
1016
|
-
});
|
|
1017
|
-
Je.displayName = "Drawer.Handle";
|
|
1018
|
-
function Qe(t) {
|
|
1019
|
-
const n = ct(), { container: e = n.container, ...o } = t;
|
|
1020
|
-
return /* @__PURE__ */ r.createElement(be, {
|
|
1021
|
-
container: e,
|
|
1022
|
-
...o
|
|
1023
|
-
});
|
|
1024
|
-
}
|
|
1025
|
-
const en = {
|
|
1026
|
-
Root: Xe,
|
|
1027
|
-
Content: Qt,
|
|
1028
|
-
Overlay: Jt,
|
|
1029
|
-
Trigger: we,
|
|
1030
|
-
Portal: Qe,
|
|
1031
|
-
Close: he,
|
|
1032
|
-
Title: ge,
|
|
1033
|
-
Description: ve
|
|
1034
|
-
};
|
|
1035
|
-
export {
|
|
1036
|
-
en as D
|
|
1037
|
-
};
|