base-vaul 0.1.0 → 1.1.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.
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.css","names":[],"sources":["../src/index.css"],"sourcesContent":["[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(.32,.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-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],[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],[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(.32,.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-open]{animation-name:fadeIn}[data-vaul-overlay][data-closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;opacity:1;transition:opacity .5s cubic-bezier(.32,.72,0,1)}[data-vaul-drawer]:not([data-vaul-custom-container=true]):after{content:\"\";background:inherit;background-color:inherit;position:absolute}[data-vaul-drawer][data-vaul-drawer-direction=top]:after{top:initial;height:200%;bottom:100%;left:0;right:0}[data-vaul-drawer][data-vaul-drawer-direction=bottom]:after{top:100%;bottom:initial;height:200%;left:0;right:0}[data-vaul-drawer][data-vaul-drawer-direction=left]:after{left:initial;width:200%;top:0;bottom:0;right:100%}[data-vaul-drawer][data-vaul-drawer-direction=right]:after{left:100%;right:initial;width:200%;top:0;bottom:0}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not([data-closed]){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{opacity:.7;touch-action:pan-y;background:#e2e2e4;border-radius:1rem;width:32px;height:5px;margin-left:auto;margin-right:auto;display:block;position:relative}[data-vaul-handle]:hover,[data-vaul-handle]:active{opacity:1}[data-vaul-handle-hitarea]{touch-action:inherit;width:max(100%,2.75rem);height:max(100%,2.75rem);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}@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{0%{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{0%{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate(0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{0%{transform:translate3d(0,calc(var(--initial-transform,100%)*-1),0)}to{transform:translate(0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%)*-1),0)}}@keyframes slideFromLeft{0%{transform:translate3d(calc(var(--initial-transform,100%)*-1),0,0)}to{transform:translate(0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%)*-1),0,0)}}@keyframes slideFromRight{0%{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate(0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}"],"mappings":"AAAA"}
package/dist/index.d.cts DELETED
@@ -1,186 +0,0 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
- import * as _base_ui_react0 from "@base-ui/react";
3
- import { Dialog } from "@base-ui/react";
4
- import React from "react";
5
-
6
- //#region src/context.d.ts
7
- type BaseUIMouseEvent = React.MouseEvent<HTMLDivElement> & {
8
- preventBaseUIHandler: () => void;
9
- readonly baseUIHandlerPrevented?: boolean | undefined;
10
- };
11
- //#endregion
12
- //#region src/index.d.ts
13
- interface WithFadeFromProps {
14
- /**
15
- * Array of numbers from 0 to 100 that corresponds to % of the screen a given snap point should take up.
16
- * Should go from least visible. Example `[0.2, 0.5, 0.8]`.
17
- * You can also use px values, which doesn't take screen height into account.
18
- */
19
- snapPoints: (number | string)[];
20
- /**
21
- * Index of a `snapPoint` from which the overlay fade should be applied. Defaults to the last snap point.
22
- */
23
- fadeFromIndex: number;
24
- }
25
- interface WithoutFadeFromProps {
26
- /**
27
- * Array of numbers from 0 to 100 that corresponds to % of the screen a given snap point should take up.
28
- * Should go from least visible. Example `[0.2, 0.5, 0.8]`.
29
- * You can also use px values, which doesn't take screen height into account.
30
- */
31
- snapPoints?: (number | string)[];
32
- fadeFromIndex?: never;
33
- }
34
- type DialogProps = {
35
- activeSnapPoint?: number | string | null;
36
- setActiveSnapPoint?: (snapPoint: number | string | null) => void;
37
- children?: React.ReactNode;
38
- open?: boolean;
39
- /**
40
- * Number between 0 and 1 that determines when the drawer should be closed.
41
- * Example: threshold of 0.5 would close the drawer if the user swiped for 50% of the height of the drawer or more.
42
- * @default 0.25
43
- */
44
- closeThreshold?: number;
45
- /**
46
- * When `true` the `body` doesn't get any styles assigned from Vaul
47
- */
48
- noBodyStyles?: boolean;
49
- onOpenChange?: (open: boolean) => void;
50
- shouldScaleBackground?: boolean;
51
- /**
52
- * When `false` we don't change body's background color when the drawer is open.
53
- * @default true
54
- */
55
- setBackgroundColorOnScale?: boolean;
56
- /**
57
- * Duration for which the drawer is not draggable after scrolling content inside of the drawer.
58
- * @default 500ms
59
- */
60
- scrollLockTimeout?: number;
61
- /**
62
- * When `true`, don't move the drawer upwards if there's space, but rather only change it's height so it's fully scrollable when the keyboard is open
63
- */
64
- fixed?: boolean;
65
- /**
66
- * When `true` only allows the drawer to be dragged by the `<Drawer.Handle />` component.
67
- * @default false
68
- */
69
- handleOnly?: boolean;
70
- /**
71
- * When `false` dragging, clicking outside, pressing esc, etc. will not close the drawer.
72
- * Use this in comination with the `open` prop, otherwise you won't be able to open/close the drawer.
73
- * @default true
74
- */
75
- dismissible?: boolean;
76
- onDrag?: (event: BaseUIMouseEvent, percentageDragged: number) => void;
77
- onRelease?: (event: BaseUIMouseEvent, open: boolean) => void;
78
- /**
79
- * When `false` it allows to interact with elements outside of the drawer without closing it.
80
- * @default true
81
- */
82
- modal?: boolean;
83
- nested?: boolean;
84
- onClose?: () => void;
85
- /**
86
- * Direction of the drawer. Can be `top` or `bottom`, `left`, `right`.
87
- * @default 'bottom'
88
- */
89
- direction?: "top" | "bottom" | "left" | "right";
90
- /**
91
- * Opened by default, skips initial enter animation. Still reacts to `open` state changes
92
- * @default false
93
- */
94
- defaultOpen?: boolean;
95
- /**
96
- * When set to `true` prevents scrolling on the document body on mount, and restores it on unmount.
97
- * @default false
98
- */
99
- disablePreventScroll?: boolean;
100
- /**
101
- * When `true` Vaul will reposition inputs rather than scroll then into view if the keyboard is in the way.
102
- * Setting it to `false` will fall back to the default browser behavior.
103
- * @default true when {@link snapPoints} is defined
104
- */
105
- repositionInputs?: boolean;
106
- /**
107
- * Disabled velocity based swiping for snap points.
108
- * This means that a snap point won't be skipped even if the velocity is high enough.
109
- * Useful if each snap point in a drawer is equally important.
110
- * @default false
111
- */
112
- snapToSequentialPoint?: boolean;
113
- container?: HTMLElement | null;
114
- /**
115
- * Gets triggered after the open or close animation ends, it receives an `open` argument with the `open` state of the drawer by the time the function was triggered.
116
- * Useful to revert any state changes for example.
117
- */
118
- onAnimationEnd?: (open: boolean) => void;
119
- preventScrollRestoration?: boolean;
120
- autoFocus?: boolean;
121
- } & (WithFadeFromProps | WithoutFadeFromProps);
122
- declare function Root({
123
- open: openProp,
124
- onOpenChange,
125
- children,
126
- onDrag: onDragProp,
127
- onRelease: onReleaseProp,
128
- snapPoints,
129
- shouldScaleBackground,
130
- setBackgroundColorOnScale,
131
- closeThreshold,
132
- scrollLockTimeout,
133
- dismissible,
134
- handleOnly,
135
- fadeFromIndex,
136
- activeSnapPoint: activeSnapPointProp,
137
- setActiveSnapPoint: setActiveSnapPointProp,
138
- fixed,
139
- modal,
140
- onClose,
141
- nested,
142
- noBodyStyles,
143
- direction,
144
- defaultOpen,
145
- disablePreventScroll,
146
- snapToSequentialPoint,
147
- preventScrollRestoration,
148
- repositionInputs,
149
- onAnimationEnd,
150
- container,
151
- autoFocus
152
- }: DialogProps): react_jsx_runtime0.JSX.Element;
153
- declare const Overlay: React.ForwardRefExoticComponent<Omit<_base_ui_react0.DialogBackdropProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
154
- type ContentProps = React.ComponentPropsWithoutRef<typeof Dialog.Popup>;
155
- declare const Content: React.ForwardRefExoticComponent<Omit<_base_ui_react0.DialogPopupProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
156
- type HandleProps = React.ComponentPropsWithoutRef<"div"> & {
157
- preventCycle?: boolean;
158
- };
159
- declare const Handle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
160
- preventCycle?: boolean;
161
- } & React.RefAttributes<HTMLDivElement>>;
162
- declare function NestedRoot({
163
- onDrag,
164
- onOpenChange,
165
- open: nestedIsOpen,
166
- ...rest
167
- }: DialogProps): react_jsx_runtime0.JSX.Element;
168
- type PortalProps = React.ComponentPropsWithoutRef<typeof Dialog.Portal>;
169
- declare function Portal(props: PortalProps): react_jsx_runtime0.JSX.Element;
170
- declare const Drawer: {
171
- Root: typeof Root;
172
- NestedRoot: typeof NestedRoot;
173
- Content: React.ForwardRefExoticComponent<Omit<_base_ui_react0.DialogPopupProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
174
- Overlay: React.ForwardRefExoticComponent<Omit<_base_ui_react0.DialogBackdropProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
175
- Trigger: Dialog.Trigger;
176
- Portal: typeof Portal;
177
- Handle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
178
- preventCycle?: boolean;
179
- } & React.RefAttributes<HTMLDivElement>>;
180
- Close: React.ForwardRefExoticComponent<_base_ui_react0.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
181
- Title: React.ForwardRefExoticComponent<_base_ui_react0.DialogTitleProps & React.RefAttributes<HTMLParagraphElement>>;
182
- Description: React.ForwardRefExoticComponent<_base_ui_react0.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
183
- };
184
- //#endregion
185
- export { Content, ContentProps, DialogProps, Drawer, Handle, HandleProps, NestedRoot, Overlay, Portal, Root, WithFadeFromProps, WithoutFadeFromProps };
186
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/context.ts","../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;KAIY,gBAAA,GAAmB,KAAA,CAAM,WAAW;;;;;;UC6B/B,iBAAA;;AD7BjB;;;;EC6BiB,UAAA,EAAA,CAAA,MAAA,GAAiB,MAAA,CAAA,EAAA;EAajB;AAUjB;;EA0CmB,aAAA,EAAA,MAAA;;AAqCL,UAzFG,oBAAA,CAyFH;EAQT;;;AAEL;;EAEE,UAAA,CAAA,EAAA,CAAA,MAAA,GAAA,MAAA,CAAA,EAAA;EACA,aAAA,CAAA,EAAA,KAAA;;AAEW,KA9FD,WAAA,GA8FC;EACX,eAAA,CAAA,EAAA,MAAA,GAAA,MAAA,GAAA,IAAA;EACA,kBAAA,CAAA,EAAA,CAAA,SAAA,EAAA,MAAA,GAAA,MAAA,GAAA,IAAA,EAAA,GAAA,IAAA;EACA,QAAA,CAAA,EA9FW,KAAA,CAAM,SA8FjB;EACA,IAAA,CAAA,EAAA,OAAA;EACA;;;;;EAKoB,cAAA,CAAA,EAAA,MAAA;EACpB;;;EAGA,YAAA,CAAA,EAAA,OAAA;EACA,YAAA,CAAA,EAAA,CAAA,IAAA,EAAA,OAAA,EAAA,GAAA,IAAA;EACA,qBAAA,CAAA,EAAA,OAAA;EACA;;;;EAIA,yBAAA,CAAA,EAAA,OAAA;EACA;;;;EAGY,iBAAA,CAAA,EAAA,MAAA;EAAA;AAyuBd;;EAAoB,KAAA,CAAA,EAAA,OAAA;EAAA;;;;EAAA,UAAA,CAAA,EAAA,OAAA;EAAA;AAwCpB;AAIA;;;EAAoB,WAAA,CAAA,EAAA,OAAA;EAAA,MAAA,CAAA,EAAA,CAAA,KAAA,EAl2BD,gBAk2BC,EAA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;AAiHnB;;EAEE,WAAA,CAAA,EAAA,OAAA;EACM;;;;EAiCH,oBAAW,CAAA,EAAA,OACP;EAGO;AAOhB;;;;;;;;;;;;cAvnCc;;;;;;;;KAQT,oBAAoB;iBAET,IAAA;QACR;;;UAGE;aACG;;;;;;;;;mBASM;sBACG;;;;;;;;;;;;;;;GAenB,cAAW,kBAAA,CAAA,GAAA,CAAA;cAyuBD,SAAO,KAAA,CAAA,0BAAA,KAoClB,eAAA,CApCkB,mBAAA,GAAA,KAAA,CAAA,cAAA,0BAAA,KAAA,CAAA,cAAA;KAwCR,YAAA,GAAe,KAAA,CAAM,gCACxB,MAAA,CAAgB;cAGZ,SAAO,KAAA,CAAA,0BAAA,KA+IlB,eAAA,CA/IkB,gBAAA,GAAA,KAAA,CAAA,cAAA,0BAAA,KAAA,CAAA,cAAA;KAmJR,WAAA,GAAc,KAAA,CAAM;;;cAOnB,QAAM,KAAA,CAAA,0BAAA,KAAA,KAAA,CAAA,kBAAA,KAAA,CAAA,eAAA,iBAAA;;;iBAiHH,UAAA;;;QAGR;;GAEL,cAAW,kBAAA,CAAA,GAAA,CAAA;KA+BT,WAAA,GAAc,KAAA,CAAM,gCAChB,MAAA,CAAgB;iBAGT,MAAA,QAAc,cAAW,kBAAA,CAAA,GAAA,CAAA;cAO5B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":["chain","restore: () => void","scrollable: Element","React","originalStyles: Style","value","previousBodyPosition: Record<string, string> | null","activeSnapPointIndex","DialogPrimitive","direction"],"sources":["../src/context.ts","../src/browser.ts","../src/use-prevent-scroll.ts","../src/use-composed-refs.ts","../src/helpers.ts","../src/constants.ts","../src/use-controllable-state.ts","../src/use-snap-points.ts","../src/use-scale-background.ts","../src/use-position-fixed.ts","../src/index.tsx"],"sourcesContent":["// @ts-nocheck [FIXME] See after monorepo migration\nimport React from \"react\";\nimport { DrawerDirection } from \"./types\";\n\nexport type BaseUIMouseEvent = React.MouseEvent<HTMLDivElement> & {\n preventBaseUIHandler: () => void;\n readonly baseUIHandlerPrevented?: boolean | undefined;\n};\n\nexport type BaseUIPointerEvent = React.PointerEvent<HTMLDivElement> & {\n preventBaseUIHandler: () => void;\n readonly baseUIHandlerPrevented?: boolean | undefined;\n};\n\ninterface DrawerContextValue {\n drawerRef: React.RefObject<HTMLDivElement>;\n overlayRef: React.RefObject<HTMLDivElement>;\n onPress: (event: BaseUIPointerEvent) => void;\n onRelease: (event: BaseUIMouseEvent | null) => void;\n onDrag: (event: BaseUIMouseEvent) => void;\n onNestedDrag: (event: BaseUIMouseEvent, percentageDragged: number) => void;\n onNestedOpenChange: (o: boolean) => void;\n onNestedRelease: (event: BaseUIMouseEvent, open: boolean) => void;\n dismissible: boolean;\n isOpen: boolean;\n isDragging: boolean;\n keyboardIsOpen: React.MutableRefObject<boolean>;\n snapPointsOffset: number[] | null;\n snapPoints?: (number | string)[] | null;\n activeSnapPointIndex?: number | null;\n modal: boolean;\n shouldFade: boolean;\n activeSnapPoint?: number | string | null;\n setActiveSnapPoint: (o: number | string | null) => void;\n closeDrawer: () => void;\n openProp?: boolean;\n onOpenChange?: (o: boolean) => void;\n direction: DrawerDirection;\n shouldScaleBackground: boolean;\n setBackgroundColorOnScale: boolean;\n noBodyStyles: boolean;\n handleOnly?: boolean;\n container?: HTMLElement | null;\n autoFocus?: boolean;\n shouldAnimate?: React.RefObject<boolean>;\n}\n\nexport const DrawerContext = React.createContext<DrawerContextValue>({\n drawerRef: { current: null },\n overlayRef: { current: null },\n onPress: () => {},\n onRelease: () => {},\n onDrag: () => {},\n onNestedDrag: () => {},\n onNestedOpenChange: () => {},\n onNestedRelease: () => {},\n openProp: undefined,\n dismissible: false,\n isOpen: false,\n isDragging: false,\n keyboardIsOpen: { current: false },\n snapPointsOffset: null,\n snapPoints: null,\n handleOnly: false,\n modal: false,\n shouldFade: false,\n activeSnapPoint: null,\n onOpenChange: () => {},\n setActiveSnapPoint: () => {},\n closeDrawer: () => {},\n direction: \"bottom\",\n shouldAnimate: { current: true },\n shouldScaleBackground: false,\n setBackgroundColorOnScale: true,\n noBodyStyles: false,\n container: null,\n autoFocus: false,\n});\n\nexport const useDrawerContext = () => {\n const context = React.useContext(DrawerContext);\n if (!context) {\n throw new Error(\"useDrawerContext must be used within a Drawer.Root\");\n }\n return context;\n};\n","export function isMobileFirefox(): boolean | undefined {\n const userAgent = navigator.userAgent;\n return (\n typeof window !== 'undefined' &&\n ((/Firefox/.test(userAgent) && /Mobile/.test(userAgent)) || // Android Firefox\n /FxiOS/.test(userAgent)) // iOS Firefox\n );\n}\n\nexport function isMac(): boolean | undefined {\n return testPlatform(/^Mac/);\n}\n\nexport function isIPhone(): boolean | undefined {\n return testPlatform(/^iPhone/);\n}\n\nexport function isSafari(): boolean | undefined {\n return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n}\n\nexport function isIPad(): boolean | undefined {\n return (\n testPlatform(/^iPad/) ||\n // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.\n (isMac() && navigator.maxTouchPoints > 1)\n );\n}\n\nexport function isIOS(): boolean | undefined {\n return isIPhone() || isIPad();\n}\n\nexport function testPlatform(re: RegExp): boolean | undefined {\n return typeof window !== 'undefined' && window.navigator != null ? re.test(window.navigator.platform) : undefined;\n}\n","// @ts-nocheck [FIXME] See after monorepo migration\n// This code comes from https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/overlays/src/usePreventScroll.ts\nimport { useEffect, useLayoutEffect } from \"react\";\nimport { isIOS } from \"./browser\";\n\nconst KEYBOARD_BUFFER = 24;\n\nexport const useIsomorphicLayoutEffect =\n typeof window !== \"undefined\" ? useLayoutEffect : useEffect;\n\ninterface PreventScrollOptions {\n /** Whether the scroll lock is disabled. */\n isDisabled?: boolean;\n focusCallback?: () => void;\n}\n\nfunction chain(...callbacks: any[]): (...args: any[]) => void {\n return (...args: any[]) => {\n for (const callback of callbacks) {\n if (typeof callback === \"function\") {\n callback(...args);\n }\n }\n };\n}\n\n// @ts-ignore\nconst visualViewport = typeof document !== \"undefined\" && window.visualViewport;\n\nexport function isScrollable(node: Element): boolean {\n const style = window.getComputedStyle(node);\n return /(auto|scroll)/.test(\n style.overflow + style.overflowX + style.overflowY\n );\n}\n\nexport function getScrollParent(node: Element): Element {\n if (isScrollable(node)) {\n node = node.parentElement as HTMLElement;\n }\n\n while (node && !isScrollable(node)) {\n node = node.parentElement as HTMLElement;\n }\n\n return node || document.scrollingElement || document.documentElement;\n}\n\n// HTML input types that do not cause the software keyboard to appear.\nconst nonTextInputTypes = new Set([\n \"checkbox\",\n \"radio\",\n \"range\",\n \"color\",\n \"file\",\n \"image\",\n \"button\",\n \"submit\",\n \"reset\",\n]);\n\n// The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position\nlet preventScrollCount = 0;\nlet restore: () => void;\n\n/**\n * Prevents scrolling on the document body on mount, and\n * restores it on unmount. Also ensures that content does not\n * shift due to the scrollbars disappearing.\n */\nexport function usePreventScroll(options: PreventScrollOptions = {}) {\n const { isDisabled } = options;\n\n useIsomorphicLayoutEffect(() => {\n if (isDisabled) {\n return;\n }\n\n preventScrollCount++;\n if (preventScrollCount === 1) {\n if (isIOS()) {\n restore = preventScrollMobileSafari();\n }\n }\n\n return () => {\n preventScrollCount--;\n if (preventScrollCount === 0) {\n restore?.();\n }\n };\n }, [isDisabled]);\n}\n\n// Mobile Safari is a whole different beast. Even with overflow: hidden,\n// it still scrolls the page in many situations:\n//\n// 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.\n// 2. When the keyboard is visible, the viewport does not resize. Instead, the keyboard covers part of\n// it, so it becomes scrollable.\n// 3. When tapping on an input, the page always scrolls so that the input is centered in the visual viewport.\n// This may cause even fixed position elements to scroll off the screen.\n// 4. When using the next/previous buttons in the keyboard to navigate between inputs, the whole page always\n// scrolls, even if the input is inside a nested scrollable element that could be scrolled instead.\n//\n// In order to work around these cases, and prevent scrolling without jankiness, we do a few things:\n//\n// 1. Prevent default on `touchmove` events that are not in a scrollable element. This prevents touch scrolling\n// on the window.\n// 2. Prevent default on `touchmove` events inside a scrollable element when the scroll position is at the\n// top or bottom. This avoids the whole page scrolling instead, but does prevent overscrolling.\n// 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.\n// 4. When focusing an input, apply a transform to trick Safari into thinking the input is at the top\n// of the page, which prevents it from scrolling the page. After the input is focused, scroll the element\n// into view ourselves, without scrolling the whole page.\n// 5. Offset the body by the scroll position using a negative margin and scroll to the top. This should appear the\n// same visually, but makes the actual scroll position always zero. This is required to make all of the\n// above work or Safari will still try to scroll the page when focusing an input.\n// 6. As a last resort, handle window scroll events, and scroll back to the top. This can happen when attempting\n// to navigate to an input with the next/previous buttons that's outside a modal.\nfunction preventScrollMobileSafari() {\n let scrollable: Element;\n let lastY = 0;\n const onTouchStart = (e: TouchEvent) => {\n // Store the nearest scrollable parent element from the element that the user touched.\n scrollable = getScrollParent(e.target as Element);\n if (\n scrollable === document.documentElement &&\n scrollable === document.body\n ) {\n return;\n }\n\n lastY = e.changedTouches[0].pageY;\n };\n\n const onTouchMove = (e: TouchEvent) => {\n // Prevent scrolling the window.\n if (\n !scrollable ||\n scrollable === document.documentElement ||\n scrollable === document.body\n ) {\n e.preventDefault();\n return;\n }\n\n // Prevent scrolling up when at the top and scrolling down when at the bottom\n // of a nested scrollable area, otherwise mobile Safari will start scrolling\n // the window instead. Unfortunately, this disables bounce scrolling when at\n // the top but it's the best we can do.\n const y = e.changedTouches[0].pageY;\n const scrollTop = scrollable.scrollTop;\n const bottom = scrollable.scrollHeight - scrollable.clientHeight;\n\n if (bottom === 0) {\n return;\n }\n\n if ((scrollTop <= 0 && y > lastY) || (scrollTop >= bottom && y < lastY)) {\n e.preventDefault();\n }\n\n lastY = y;\n };\n\n const onTouchEnd = (e: TouchEvent) => {\n const target = e.target as HTMLElement;\n\n // Apply this change if we're not already focused on the target element\n if (isInput(target) && target !== document.activeElement) {\n e.preventDefault();\n\n // Apply a transform to trick Safari into thinking the input is at the top of the page\n // so it doesn't try to scroll it into view. When tapping on an input, this needs to\n // be done before the \"focus\" event, so we have to focus the element ourselves.\n target.style.transform = \"translateY(-2000px)\";\n target.focus();\n requestAnimationFrame(() => {\n target.style.transform = \"\";\n });\n }\n };\n\n const onFocus = (e: FocusEvent) => {\n const target = e.target as HTMLElement;\n if (isInput(target)) {\n // Transform also needs to be applied in the focus event in cases where focus moves\n // other than tapping on an input directly, e.g. the next/previous buttons in the\n // software keyboard. In these cases, it seems applying the transform in the focus event\n // is good enough, whereas when tapping an input, it must be done before the focus event. 🤷‍♂️\n target.style.transform = \"translateY(-2000px)\";\n requestAnimationFrame(() => {\n target.style.transform = \"\";\n\n // This will have prevented the browser from scrolling the focused element into view,\n // so we need to do this ourselves in a way that doesn't cause the whole page to scroll.\n if (visualViewport) {\n if (visualViewport.height < window.innerHeight) {\n // If the keyboard is already visible, do this after one additional frame\n // to wait for the transform to be removed.\n requestAnimationFrame(() => {\n scrollIntoView(target);\n });\n } else {\n // Otherwise, wait for the visual viewport to resize before scrolling so we can\n // measure the correct position to scroll to.\n visualViewport.addEventListener(\n \"resize\",\n () => scrollIntoView(target),\n { once: true }\n );\n }\n }\n });\n }\n };\n\n const onWindowScroll = () => {\n // Last resort. If the window scrolled, scroll it back to the top.\n // It should always be at the top because the body will have a negative margin (see below).\n window.scrollTo(0, 0);\n };\n\n // Record the original scroll position so we can restore it.\n // Then apply a negative margin to the body to offset it by the scroll position. This will\n // enable us to scroll the window to the top, which is required for the rest of this to work.\n const scrollX = window.pageXOffset;\n const scrollY = window.pageYOffset;\n\n const restoreStyles = chain(\n setStyle(\n document.documentElement,\n \"paddingRight\",\n `${window.innerWidth - document.documentElement.clientWidth}px`\n )\n // setStyle(document.documentElement, 'overflow', 'hidden'),\n // setStyle(document.body, 'marginTop', `-${scrollY}px`),\n );\n\n // Scroll to the top. The negative margin on the body will make this appear the same.\n window.scrollTo(0, 0);\n\n const removeEvents = chain(\n addEvent(document, \"touchstart\", onTouchStart, {\n passive: false,\n capture: true,\n }),\n addEvent(document, \"touchmove\", onTouchMove, {\n passive: false,\n capture: true,\n }),\n addEvent(document, \"touchend\", onTouchEnd, {\n passive: false,\n capture: true,\n }),\n addEvent(document, \"focus\", onFocus, true),\n addEvent(window, \"scroll\", onWindowScroll)\n );\n\n return () => {\n // Restore styles and scroll the page back to where it was.\n restoreStyles();\n removeEvents();\n window.scrollTo(scrollX, scrollY);\n };\n}\n\n// Sets a CSS property on an element, and returns a function to revert it to the previous value.\nfunction setStyle(\n element: HTMLElement,\n style: keyof React.CSSProperties,\n value: string\n) {\n // https://github.com/microsoft/TypeScript/issues/17827#issuecomment-391663310\n // @ts-ignore\n const cur = element.style[style];\n // @ts-ignore\n element.style[style] = value;\n\n return () => {\n // @ts-ignore\n element.style[style] = cur;\n };\n}\n\n// Adds an event listener to an element, and returns a function to remove it.\nfunction addEvent<K extends keyof GlobalEventHandlersEventMap>(\n target: EventTarget,\n event: K,\n handler: (this: Document, ev: GlobalEventHandlersEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n) {\n // @ts-ignore\n target.addEventListener(event, handler, options);\n\n return () => {\n // @ts-ignore\n target.removeEventListener(event, handler, options);\n };\n}\n\nfunction scrollIntoView(target: Element) {\n const root = document.scrollingElement || document.documentElement;\n while (target && target !== root) {\n // Find the parent scrollable element and adjust the scroll position if the target is not already in view.\n const scrollable = getScrollParent(target);\n if (\n scrollable !== document.documentElement &&\n scrollable !== document.body &&\n scrollable !== target\n ) {\n const scrollableTop = scrollable.getBoundingClientRect().top;\n const targetTop = target.getBoundingClientRect().top;\n const targetBottom = target.getBoundingClientRect().bottom;\n // Buffer is needed for some edge cases\n const keyboardHeight =\n scrollable.getBoundingClientRect().bottom + KEYBOARD_BUFFER;\n\n if (targetBottom > keyboardHeight) {\n scrollable.scrollTop += targetTop - scrollableTop;\n }\n }\n\n // @ts-ignore\n target = scrollable.parentElement;\n }\n}\n\nexport function isInput(target: Element) {\n return (\n (target instanceof HTMLInputElement &&\n !nonTextInputTypes.has(target.type)) ||\n target instanceof HTMLTextAreaElement ||\n (target instanceof HTMLElement && target.isContentEditable)\n );\n}\n","// This code comes from https://github.com/radix-ui/primitives/tree/main/packages/react/compose-refs\n\nimport * as React from 'react';\n\ntype PossibleRef<T> = React.Ref<T> | undefined;\n\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef<T>(ref: PossibleRef<T>, value: T) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref !== null && ref !== undefined) {\n (ref as React.MutableRefObject<T>).current = value;\n }\n}\n\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs<T>(...refs: PossibleRef<T>[]) {\n return (node: T) => refs.forEach((ref) => setRef(ref, node));\n}\n\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs<T>(...refs: PossibleRef<T>[]) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { composeRefs, useComposedRefs };\n","import { AnyFunction, DrawerDirection } from './types';\n\ninterface Style {\n [key: string]: string;\n}\n\nconst cache = new WeakMap();\n\nexport function isInView(el: HTMLElement): boolean {\n const rect = el.getBoundingClientRect();\n\n if (!window.visualViewport) return false;\n\n return (\n rect.top >= 0 &&\n rect.left >= 0 &&\n // Need + 40 for safari detection\n rect.bottom <= window.visualViewport.height - 40 &&\n rect.right <= window.visualViewport.width\n );\n}\n\nexport function set(el: Element | HTMLElement | null | undefined, styles: Style, ignoreCache = false) {\n if (!el || !(el instanceof HTMLElement)) return;\n const originalStyles: Style = {};\n\n Object.entries(styles).forEach(([key, value]: [string, string]) => {\n if (key.startsWith('--')) {\n el.style.setProperty(key, value);\n return;\n }\n\n originalStyles[key] = (el.style as any)[key];\n (el.style as any)[key] = value;\n });\n\n if (ignoreCache) return;\n\n cache.set(el, originalStyles);\n}\n\nexport function reset(el: Element | HTMLElement | null, prop?: string) {\n if (!el || !(el instanceof HTMLElement)) return;\n const originalStyles = cache.get(el);\n\n if (!originalStyles) {\n return;\n }\n\n if (prop) {\n (el.style as any)[prop] = originalStyles[prop];\n } else {\n Object.entries(originalStyles).forEach(([key, value]) => {\n (el.style as any)[key] = value;\n });\n }\n}\n\nexport const isVertical = (direction: DrawerDirection) => {\n switch (direction) {\n case 'top':\n case 'bottom':\n return true;\n case 'left':\n case 'right':\n return false;\n default:\n return direction satisfies never;\n }\n};\n\nexport function getTranslate(element: HTMLElement, direction: DrawerDirection): number | null {\n if (!element) {\n return null;\n }\n const style = window.getComputedStyle(element);\n const transform =\n // @ts-ignore\n style.transform || style.webkitTransform || style.mozTransform;\n let mat = transform.match(/^matrix3d\\((.+)\\)$/);\n if (mat) {\n // https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix3d\n return parseFloat(mat[1].split(', ')[isVertical(direction) ? 13 : 12]);\n }\n // https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix\n mat = transform.match(/^matrix\\((.+)\\)$/);\n return mat ? parseFloat(mat[1].split(', ')[isVertical(direction) ? 5 : 4]) : null;\n}\n\nexport function dampenValue(v: number) {\n return 8 * (Math.log(v + 1) - 2);\n}\n\nexport function assignStyle(element: HTMLElement | null | undefined, style: Partial<CSSStyleDeclaration>) {\n if (!element) return () => {};\n\n const prevStyle = element.style.cssText;\n Object.assign(element.style, style);\n\n return () => {\n element.style.cssText = prevStyle;\n };\n}\n\n/**\n * Receives functions as arguments and returns a new function that calls all.\n */\nexport function chain<T>(...fns: T[]) {\n return (...args: T extends AnyFunction ? Parameters<T> : never) => {\n for (const fn of fns) {\n if (typeof fn === 'function') {\n // @ts-ignore\n fn(...args);\n }\n }\n };\n}\n","export const TRANSITIONS = {\n DURATION: 0.5,\n EASE: [0.32, 0.72, 0, 1],\n};\n\nexport const VELOCITY_THRESHOLD = 0.4;\n\nexport const CLOSE_THRESHOLD = 0.25;\n\nexport const SCROLL_LOCK_TIMEOUT = 100;\n\nexport const BORDER_RADIUS = 8;\n\nexport const NESTED_DISPLACEMENT = 16;\n\nexport const WINDOW_TOP_OFFSET = 26;\n\nexport const DRAG_CLASS = 'vaul-dragging';\n","// This code comes from https://github.com/radix-ui/primitives/blob/main/packages/react/use-controllable-state/src/useControllableState.tsx\n\nimport React from 'react';\n\ntype UseControllableStateParams<T> = {\n prop?: T | undefined;\n defaultProp?: T | undefined;\n onChange?: (state: T) => void;\n};\n\ntype SetStateFn<T> = (prevState?: T) => T;\n\nfunction useCallbackRef<T extends (...args: any[]) => any>(callback: T | undefined): T {\n const callbackRef = React.useRef(callback);\n\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n\n // https://github.com/facebook/react/issues/19240\n return React.useMemo(() => ((...args) => callbackRef.current?.(...args)) as T, []);\n}\n\nfunction useUncontrolledState<T>({ defaultProp, onChange }: Omit<UseControllableStateParams<T>, 'prop'>) {\n const uncontrolledState = React.useState<T | undefined>(defaultProp);\n const [value] = uncontrolledState;\n const prevValueRef = React.useRef(value);\n const handleChange = useCallbackRef(onChange);\n\n React.useEffect(() => {\n if (prevValueRef.current !== value) {\n handleChange(value as T);\n prevValueRef.current = value;\n }\n }, [value, prevValueRef, handleChange]);\n\n return uncontrolledState;\n}\nexport function useControllableState<T>({ prop, defaultProp, onChange = () => {} }: UseControllableStateParams<T>) {\n const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({\n defaultProp,\n onChange,\n });\n const isControlled = prop !== undefined;\n const value = isControlled ? prop : uncontrolledProp;\n const handleChange = useCallbackRef(onChange);\n\n const setValue: React.Dispatch<React.SetStateAction<T | undefined>> = React.useCallback(\n (nextValue) => {\n if (isControlled) {\n const setter = nextValue as SetStateFn<T>;\n const value = typeof nextValue === 'function' ? setter(prop) : nextValue;\n if (value !== prop) handleChange(value as T);\n } else {\n setUncontrolledProp(nextValue);\n }\n },\n [isControlled, prop, setUncontrolledProp, handleChange],\n );\n\n return [value, setValue] as const;\n}\n","// @ts-nocheck [FIXME] See after monorepo migration\nimport React from \"react\";\nimport { set, isVertical } from \"./helpers\";\nimport { TRANSITIONS, VELOCITY_THRESHOLD } from \"./constants\";\nimport { useControllableState } from \"./use-controllable-state\";\nimport { DrawerDirection } from \"./types\";\n\nexport function useSnapPoints({\n activeSnapPointProp,\n setActiveSnapPointProp,\n snapPoints,\n drawerRef,\n overlayRef,\n fadeFromIndex,\n onSnapPointChange,\n direction = \"bottom\",\n container,\n snapToSequentialPoint,\n}: {\n activeSnapPointProp?: number | string | null;\n setActiveSnapPointProp?(snapPoint: number | null | string): void;\n snapPoints?: (number | string)[];\n fadeFromIndex?: number;\n drawerRef: React.RefObject<HTMLDivElement>;\n overlayRef: React.RefObject<HTMLDivElement>;\n onSnapPointChange(activeSnapPointIndex: number): void;\n direction?: DrawerDirection;\n container?: HTMLElement | null | undefined;\n snapToSequentialPoint?: boolean;\n}) {\n const [activeSnapPoint, setActiveSnapPoint] = useControllableState<\n string | number | null\n >({\n prop: activeSnapPointProp,\n defaultProp: snapPoints?.[0],\n onChange: setActiveSnapPointProp,\n });\n\n const [windowDimensions, setWindowDimensions] = React.useState(\n typeof window !== \"undefined\"\n ? {\n innerWidth: window.innerWidth,\n innerHeight: window.innerHeight,\n }\n : undefined\n );\n\n React.useEffect(() => {\n function onResize() {\n setWindowDimensions({\n innerWidth: window.innerWidth,\n innerHeight: window.innerHeight,\n });\n }\n window.addEventListener(\"resize\", onResize);\n\n return () => window.removeEventListener(\"resize\", onResize);\n }, []);\n\n const isLastSnapPoint = React.useMemo(\n () => activeSnapPoint === snapPoints?.[snapPoints.length - 1] || null,\n [snapPoints, activeSnapPoint]\n );\n\n const activeSnapPointIndex = React.useMemo(\n () =>\n snapPoints?.findIndex((snapPoint) => snapPoint === activeSnapPoint) ??\n null,\n [snapPoints, activeSnapPoint]\n );\n\n const shouldFade =\n (snapPoints &&\n snapPoints.length > 0 &&\n (fadeFromIndex || fadeFromIndex === 0) &&\n !Number.isNaN(fadeFromIndex) &&\n snapPoints[fadeFromIndex] === activeSnapPoint) ||\n !snapPoints;\n\n const snapPointsOffset = React.useMemo(() => {\n const containerSize = container\n ? {\n width: container.getBoundingClientRect().width,\n height: container.getBoundingClientRect().height,\n }\n : typeof window !== \"undefined\"\n ? { width: window.innerWidth, height: window.innerHeight }\n : { width: 0, height: 0 };\n\n return (\n snapPoints?.map((snapPoint) => {\n const isPx = typeof snapPoint === \"string\";\n let snapPointAsNumber = 0;\n\n if (isPx) {\n snapPointAsNumber = parseInt(snapPoint, 10);\n }\n\n if (isVertical(direction)) {\n const height = isPx\n ? snapPointAsNumber\n : windowDimensions\n ? snapPoint * containerSize.height\n : 0;\n\n if (windowDimensions) {\n return direction === \"bottom\"\n ? containerSize.height - height\n : -containerSize.height + height;\n }\n\n return height;\n }\n const width = isPx\n ? snapPointAsNumber\n : windowDimensions\n ? snapPoint * containerSize.width\n : 0;\n\n if (windowDimensions) {\n return direction === \"right\"\n ? containerSize.width - width\n : -containerSize.width + width;\n }\n\n return width;\n }) ?? []\n );\n }, [snapPoints, windowDimensions, container]);\n\n const activeSnapPointOffset = React.useMemo(\n () =>\n activeSnapPointIndex !== null\n ? snapPointsOffset?.[activeSnapPointIndex]\n : null,\n [snapPointsOffset, activeSnapPointIndex]\n );\n\n const snapToPoint = React.useCallback(\n (dimension: number) => {\n const newSnapPointIndex =\n snapPointsOffset?.findIndex(\n (snapPointDim) => snapPointDim === dimension\n ) ?? null;\n onSnapPointChange(newSnapPointIndex);\n\n set(drawerRef.current, {\n transition: `transform ${\n TRANSITIONS.DURATION\n }s cubic-bezier(${TRANSITIONS.EASE.join(\",\")})`,\n transform: isVertical(direction)\n ? `translate3d(0, ${dimension}px, 0)`\n : `translate3d(${dimension}px, 0, 0)`,\n });\n\n if (\n snapPointsOffset &&\n newSnapPointIndex !== snapPointsOffset.length - 1 &&\n fadeFromIndex !== undefined &&\n newSnapPointIndex !== fadeFromIndex &&\n newSnapPointIndex < fadeFromIndex\n ) {\n set(overlayRef.current, {\n transition: `opacity ${\n TRANSITIONS.DURATION\n }s cubic-bezier(${TRANSITIONS.EASE.join(\",\")})`,\n opacity: \"0\",\n });\n } else {\n set(overlayRef.current, {\n transition: `opacity ${\n TRANSITIONS.DURATION\n }s cubic-bezier(${TRANSITIONS.EASE.join(\",\")})`,\n opacity: \"1\",\n });\n }\n\n setActiveSnapPoint(snapPoints?.[Math.max(newSnapPointIndex, 0)]);\n },\n [\n drawerRef.current,\n snapPoints,\n snapPointsOffset,\n fadeFromIndex,\n overlayRef,\n setActiveSnapPoint,\n ]\n );\n\n React.useEffect(() => {\n if (activeSnapPoint || activeSnapPointProp) {\n const newIndex =\n snapPoints?.findIndex(\n (snapPoint) =>\n snapPoint === activeSnapPointProp || snapPoint === activeSnapPoint\n ) ?? -1;\n if (\n snapPointsOffset &&\n newIndex !== -1 &&\n typeof snapPointsOffset[newIndex] === \"number\"\n ) {\n snapToPoint(snapPointsOffset[newIndex] as number);\n }\n }\n }, [\n activeSnapPoint,\n activeSnapPointProp,\n snapPoints,\n snapPointsOffset,\n snapToPoint,\n ]);\n\n function onRelease({\n draggedDistance,\n closeDrawer,\n velocity,\n dismissible,\n }: {\n draggedDistance: number;\n closeDrawer: () => void;\n velocity: number;\n dismissible: boolean;\n }) {\n if (fadeFromIndex === undefined) return;\n\n const currentPosition =\n direction === \"bottom\" || direction === \"right\"\n ? (activeSnapPointOffset ?? 0) - draggedDistance\n : (activeSnapPointOffset ?? 0) + draggedDistance;\n const isOverlaySnapPoint = activeSnapPointIndex === fadeFromIndex - 1;\n const isFirst = activeSnapPointIndex === 0;\n const hasDraggedUp = draggedDistance > 0;\n\n if (isOverlaySnapPoint) {\n set(overlayRef.current, {\n transition: `opacity ${\n TRANSITIONS.DURATION\n }s cubic-bezier(${TRANSITIONS.EASE.join(\",\")})`,\n });\n }\n\n if (!snapToSequentialPoint && velocity > 2 && !hasDraggedUp) {\n if (dismissible) closeDrawer();\n else snapToPoint(snapPointsOffset[0]); // snap to initial point\n return;\n }\n\n if (\n !snapToSequentialPoint &&\n velocity > 2 &&\n hasDraggedUp &&\n snapPointsOffset &&\n snapPoints\n ) {\n snapToPoint(snapPointsOffset[snapPoints.length - 1] as number);\n return;\n }\n\n // Find the closest snap point to the current position\n const closestSnapPoint = snapPointsOffset?.reduce((prev, curr) => {\n if (typeof prev !== \"number\" || typeof curr !== \"number\") return prev;\n\n return Math.abs(curr - currentPosition) < Math.abs(prev - currentPosition)\n ? curr\n : prev;\n });\n\n const dim = isVertical(direction) ? window.innerHeight : window.innerWidth;\n if (\n velocity > VELOCITY_THRESHOLD &&\n Math.abs(draggedDistance) < dim * 0.4\n ) {\n const dragDirection = hasDraggedUp ? 1 : -1; // 1 = up, -1 = down\n\n // Don't do anything if we swipe upwards while being on the last snap point\n if (dragDirection > 0 && isLastSnapPoint && snapPoints) {\n snapToPoint(snapPointsOffset[snapPoints.length - 1]);\n return;\n }\n\n if (isFirst && dragDirection < 0 && dismissible) {\n closeDrawer();\n }\n\n if (activeSnapPointIndex === null) return;\n\n snapToPoint(snapPointsOffset[activeSnapPointIndex + dragDirection]);\n return;\n }\n\n snapToPoint(closestSnapPoint);\n }\n\n function onDrag({ draggedDistance }: { draggedDistance: number }) {\n if (activeSnapPointOffset === null) return;\n const newValue =\n direction === \"bottom\" || direction === \"right\"\n ? activeSnapPointOffset - draggedDistance\n : activeSnapPointOffset + draggedDistance;\n\n // Don't do anything if we exceed the last(biggest) snap point\n if (\n (direction === \"bottom\" || direction === \"right\") &&\n newValue < snapPointsOffset[snapPointsOffset.length - 1]\n ) {\n return;\n }\n if (\n (direction === \"top\" || direction === \"left\") &&\n newValue > snapPointsOffset[snapPointsOffset.length - 1]\n ) {\n return;\n }\n\n set(drawerRef.current, {\n transform: isVertical(direction)\n ? `translate3d(0, ${newValue}px, 0)`\n : `translate3d(${newValue}px, 0, 0)`,\n });\n }\n\n function getPercentageDragged(\n absDraggedDistance: number,\n isDraggingDown: boolean\n ) {\n if (\n !snapPoints ||\n typeof activeSnapPointIndex !== \"number\" ||\n !snapPointsOffset ||\n fadeFromIndex === undefined\n )\n return null;\n\n // If this is true we are dragging to a snap point that is supposed to have an overlay\n const isOverlaySnapPoint = activeSnapPointIndex === fadeFromIndex - 1;\n const isOverlaySnapPointOrHigher = activeSnapPointIndex >= fadeFromIndex;\n\n if (isOverlaySnapPointOrHigher && isDraggingDown) {\n return 0;\n }\n\n // Don't animate, but still use this one if we are dragging away from the overlaySnapPoint\n if (isOverlaySnapPoint && !isDraggingDown) return 1;\n if (!shouldFade && !isOverlaySnapPoint) return null;\n\n // Either fadeFrom index or the one before\n const targetSnapPointIndex = isOverlaySnapPoint\n ? activeSnapPointIndex + 1\n : activeSnapPointIndex - 1;\n\n // Get the distance from overlaySnapPoint to the one before or vice-versa to calculate the opacity percentage accordingly\n const snapPointDistance = isOverlaySnapPoint\n ? snapPointsOffset[targetSnapPointIndex] -\n snapPointsOffset[targetSnapPointIndex - 1]\n : snapPointsOffset[targetSnapPointIndex + 1] -\n snapPointsOffset[targetSnapPointIndex];\n\n const percentageDragged = absDraggedDistance / Math.abs(snapPointDistance);\n\n if (isOverlaySnapPoint) {\n return 1 - percentageDragged;\n } else {\n return percentageDragged;\n }\n }\n\n return {\n isLastSnapPoint,\n activeSnapPoint,\n shouldFade,\n getPercentageDragged,\n setActiveSnapPoint,\n activeSnapPointIndex,\n onRelease,\n onDrag,\n snapPointsOffset,\n };\n}\n","import React, { useMemo } from 'react';\nimport { useDrawerContext } from './context';\nimport { assignStyle, chain, isVertical, reset } from './helpers';\nimport { BORDER_RADIUS, TRANSITIONS, WINDOW_TOP_OFFSET } from './constants';\n\nconst noop = () => () => {};\n\nexport function useScaleBackground() {\n const { direction, isOpen, shouldScaleBackground, setBackgroundColorOnScale, noBodyStyles } = useDrawerContext();\n const timeoutIdRef = React.useRef<number | null>(null);\n const initialBackgroundColor = useMemo(() => document.body.style.backgroundColor, []);\n\n function getScale() {\n return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;\n }\n\n React.useEffect(() => {\n if (isOpen && shouldScaleBackground) {\n if (timeoutIdRef.current) clearTimeout(timeoutIdRef.current);\n const wrapper =\n (document.querySelector('[data-vaul-drawer-wrapper]') as HTMLElement) ||\n (document.querySelector('[vaul-drawer-wrapper]') as HTMLElement);\n\n if (!wrapper) return;\n\n chain(\n setBackgroundColorOnScale && !noBodyStyles ? assignStyle(document.body, { background: 'black' }) : noop,\n assignStyle(wrapper, {\n transformOrigin: isVertical(direction) ? 'top' : 'left',\n transitionProperty: 'transform, border-radius',\n transitionDuration: `${TRANSITIONS.DURATION}s`,\n transitionTimingFunction: `cubic-bezier(${TRANSITIONS.EASE.join(',')})`,\n }),\n );\n\n const wrapperStylesCleanup = assignStyle(wrapper, {\n borderRadius: `${BORDER_RADIUS}px`,\n overflow: 'hidden',\n ...(isVertical(direction)\n ? {\n transform: `scale(${getScale()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,\n }\n : {\n transform: `scale(${getScale()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,\n }),\n });\n\n return () => {\n wrapperStylesCleanup();\n timeoutIdRef.current = window.setTimeout(() => {\n if (initialBackgroundColor) {\n document.body.style.background = initialBackgroundColor;\n } else {\n document.body.style.removeProperty('background');\n }\n }, TRANSITIONS.DURATION * 1000);\n };\n }\n }, [isOpen, shouldScaleBackground, initialBackgroundColor]);\n}\n","import React from 'react';\nimport { isSafari } from './browser';\n\nlet previousBodyPosition: Record<string, string> | null = null;\n\n/**\n * This hook is necessary to prevent buggy behavior on iOS devices (need to test on Android).\n * I won't get into too much detail about what bugs it solves, but so far I've found that setting the body to `position: fixed` is the most reliable way to prevent those bugs.\n * Issues that this hook solves:\n * https://github.com/emilkowalski/vaul/issues/435\n * https://github.com/emilkowalski/vaul/issues/433\n * And more that I discovered, but were just not reported.\n */\n\nexport function usePositionFixed({\n isOpen,\n modal,\n nested,\n hasBeenOpened,\n preventScrollRestoration,\n noBodyStyles,\n}: {\n isOpen: boolean;\n modal: boolean;\n nested: boolean;\n hasBeenOpened: boolean;\n preventScrollRestoration: boolean;\n noBodyStyles: boolean;\n}) {\n const [activeUrl, setActiveUrl] = React.useState(() => (typeof window !== 'undefined' ? window.location.href : ''));\n const scrollPos = React.useRef(0);\n\n const setPositionFixed = React.useCallback(() => {\n // All browsers on iOS will return true here.\n if (!isSafari()) return;\n\n // If previousBodyPosition is already set, don't set it again.\n if (previousBodyPosition === null && isOpen && !noBodyStyles) {\n previousBodyPosition = {\n position: document.body.style.position,\n top: document.body.style.top,\n left: document.body.style.left,\n height: document.body.style.height,\n right: 'unset',\n };\n\n // Update the dom inside an animation frame\n const { scrollX, innerHeight } = window;\n\n document.body.style.setProperty('position', 'fixed', 'important');\n Object.assign(document.body.style, {\n top: `${-scrollPos.current}px`,\n left: `${-scrollX}px`,\n right: '0px',\n height: 'auto',\n });\n\n window.setTimeout(\n () =>\n window.requestAnimationFrame(() => {\n // Attempt to check if the bottom bar appeared due to the position change\n const bottomBarHeight = innerHeight - window.innerHeight;\n if (bottomBarHeight && scrollPos.current >= innerHeight) {\n // Move the content further up so that the bottom bar doesn't hide it\n document.body.style.top = `${-(scrollPos.current + bottomBarHeight)}px`;\n }\n }),\n 300,\n );\n }\n }, [isOpen]);\n\n const restorePositionSetting = React.useCallback(() => {\n // All browsers on iOS will return true here.\n if (!isSafari()) return;\n\n if (previousBodyPosition !== null && !noBodyStyles) {\n // Convert the position from \"px\" to Int\n const y = -parseInt(document.body.style.top, 10);\n const x = -parseInt(document.body.style.left, 10);\n\n // Restore styles\n Object.assign(document.body.style, previousBodyPosition);\n\n window.requestAnimationFrame(() => {\n if (preventScrollRestoration && activeUrl !== window.location.href) {\n setActiveUrl(window.location.href);\n return;\n }\n\n window.scrollTo(x, y);\n });\n\n previousBodyPosition = null;\n }\n }, [activeUrl]);\n\n React.useEffect(() => {\n function onScroll() {\n scrollPos.current = window.scrollY;\n }\n\n onScroll();\n\n window.addEventListener('scroll', onScroll);\n\n return () => {\n window.removeEventListener('scroll', onScroll);\n };\n }, []);\n\n React.useEffect(() => {\n if (!modal) return;\n\n return () => {\n if (typeof document === 'undefined') return;\n\n // Another drawer is opened, safe to ignore the execution\n const hasDrawerOpened = !!document.querySelector('[data-vaul-drawer]');\n if (hasDrawerOpened) return;\n\n restorePositionSetting();\n };\n }, [modal, restorePositionSetting]);\n\n React.useEffect(() => {\n if (nested || !hasBeenOpened) return;\n // This is needed to force Safari toolbar to show **before** the drawer starts animating to prevent a gnarly shift from happening\n if (isOpen) {\n // avoid for standalone mode (PWA)\n const isStandalone = window.matchMedia('(display-mode: standalone)').matches;\n !isStandalone && setPositionFixed();\n\n if (!modal) {\n window.setTimeout(() => {\n restorePositionSetting();\n }, 500);\n }\n } else {\n restorePositionSetting();\n }\n }, [isOpen, hasBeenOpened, activeUrl, modal, nested, setPositionFixed, restorePositionSetting]);\n\n return { restorePositionSetting };\n}\n","// @ts-nocheck [FIXME] See after monorepo migration\n\"use client\";\n\nimport { Dialog as DialogPrimitive } from \"@base-ui/react\";\nimport React from \"react\";\nimport {\n BaseUIMouseEvent,\n BaseUIPointerEvent,\n DrawerContext,\n useDrawerContext,\n} from \"./context\";\nimport { usePreventScroll, isInput } from \"./use-prevent-scroll\";\nimport { useComposedRefs } from \"./use-composed-refs\";\nimport { useSnapPoints } from \"./use-snap-points\";\nimport { set, getTranslate, dampenValue, isVertical, reset } from \"./helpers\";\nimport {\n TRANSITIONS,\n VELOCITY_THRESHOLD,\n CLOSE_THRESHOLD,\n SCROLL_LOCK_TIMEOUT,\n BORDER_RADIUS,\n NESTED_DISPLACEMENT,\n WINDOW_TOP_OFFSET,\n DRAG_CLASS,\n} from \"./constants\";\nimport { DrawerDirection } from \"./types\";\nimport { useControllableState } from \"./use-controllable-state\";\nimport { useScaleBackground } from \"./use-scale-background\";\nimport { usePositionFixed } from \"./use-position-fixed\";\nimport { isIOS, isMobileFirefox } from \"./browser\";\n\nimport \"./index.css\";\n\nexport interface WithFadeFromProps {\n /**\n * Array of numbers from 0 to 100 that corresponds to % of the screen a given snap point should take up.\n * Should go from least visible. Example `[0.2, 0.5, 0.8]`.\n * You can also use px values, which doesn't take screen height into account.\n */\n snapPoints: (number | string)[];\n /**\n * Index of a `snapPoint` from which the overlay fade should be applied. Defaults to the last snap point.\n */\n fadeFromIndex: number;\n}\n\nexport interface WithoutFadeFromProps {\n /**\n * Array of numbers from 0 to 100 that corresponds to % of the screen a given snap point should take up.\n * Should go from least visible. Example `[0.2, 0.5, 0.8]`.\n * You can also use px values, which doesn't take screen height into account.\n */\n snapPoints?: (number | string)[];\n fadeFromIndex?: never;\n}\n\nexport type DialogProps = {\n activeSnapPoint?: number | string | null;\n setActiveSnapPoint?: (snapPoint: number | string | null) => void;\n children?: React.ReactNode;\n open?: boolean;\n /**\n * Number between 0 and 1 that determines when the drawer should be closed.\n * Example: threshold of 0.5 would close the drawer if the user swiped for 50% of the height of the drawer or more.\n * @default 0.25\n */\n closeThreshold?: number;\n /**\n * When `true` the `body` doesn't get any styles assigned from Vaul\n */\n noBodyStyles?: boolean;\n onOpenChange?: (open: boolean) => void;\n shouldScaleBackground?: boolean;\n /**\n * When `false` we don't change body's background color when the drawer is open.\n * @default true\n */\n setBackgroundColorOnScale?: boolean;\n /**\n * Duration for which the drawer is not draggable after scrolling content inside of the drawer.\n * @default 500ms\n */\n scrollLockTimeout?: number;\n /**\n * When `true`, don't move the drawer upwards if there's space, but rather only change it's height so it's fully scrollable when the keyboard is open\n */\n fixed?: boolean;\n /**\n * When `true` only allows the drawer to be dragged by the `<Drawer.Handle />` component.\n * @default false\n */\n handleOnly?: boolean;\n /**\n * When `false` dragging, clicking outside, pressing esc, etc. will not close the drawer.\n * Use this in comination with the `open` prop, otherwise you won't be able to open/close the drawer.\n * @default true\n */\n dismissible?: boolean;\n onDrag?: (event: BaseUIMouseEvent, percentageDragged: number) => void;\n onRelease?: (event: BaseUIMouseEvent, open: boolean) => void;\n /**\n * When `false` it allows to interact with elements outside of the drawer without closing it.\n * @default true\n */\n modal?: boolean;\n nested?: boolean;\n onClose?: () => void;\n /**\n * Direction of the drawer. Can be `top` or `bottom`, `left`, `right`.\n * @default 'bottom'\n */\n direction?: \"top\" | \"bottom\" | \"left\" | \"right\";\n /**\n * Opened by default, skips initial enter animation. Still reacts to `open` state changes\n * @default false\n */\n defaultOpen?: boolean;\n /**\n * When set to `true` prevents scrolling on the document body on mount, and restores it on unmount.\n * @default false\n */\n disablePreventScroll?: boolean;\n /**\n * When `true` Vaul will reposition inputs rather than scroll then into view if the keyboard is in the way.\n * Setting it to `false` will fall back to the default browser behavior.\n * @default true when {@link snapPoints} is defined\n */\n repositionInputs?: boolean;\n /**\n * Disabled velocity based swiping for snap points.\n * This means that a snap point won't be skipped even if the velocity is high enough.\n * Useful if each snap point in a drawer is equally important.\n * @default false\n */\n snapToSequentialPoint?: boolean;\n container?: HTMLElement | null;\n /**\n * Gets triggered after the open or close animation ends, it receives an `open` argument with the `open` state of the drawer by the time the function was triggered.\n * Useful to revert any state changes for example.\n */\n onAnimationEnd?: (open: boolean) => void;\n preventScrollRestoration?: boolean;\n autoFocus?: boolean;\n} & (WithFadeFromProps | WithoutFadeFromProps);\n\nexport function Root({\n open: openProp,\n onOpenChange,\n children,\n onDrag: onDragProp,\n onRelease: onReleaseProp,\n snapPoints,\n shouldScaleBackground = false,\n setBackgroundColorOnScale = true,\n closeThreshold = CLOSE_THRESHOLD,\n scrollLockTimeout = SCROLL_LOCK_TIMEOUT,\n dismissible = true,\n handleOnly = false,\n fadeFromIndex = snapPoints && snapPoints.length - 1,\n activeSnapPoint: activeSnapPointProp,\n setActiveSnapPoint: setActiveSnapPointProp,\n fixed,\n modal = true,\n onClose,\n nested,\n noBodyStyles = false,\n direction = \"bottom\",\n defaultOpen = false,\n disablePreventScroll = true,\n snapToSequentialPoint = false,\n preventScrollRestoration = false,\n repositionInputs = true,\n onAnimationEnd,\n container,\n autoFocus = false,\n}: DialogProps) {\n const [isOpen = false, setIsOpen] = useControllableState({\n defaultProp: defaultOpen,\n prop: openProp,\n onChange: (o: boolean) => {\n onOpenChange?.(o);\n\n if (!o && !nested) {\n restorePositionSetting();\n }\n\n setTimeout(() => {\n onAnimationEnd?.(o);\n }, TRANSITIONS.DURATION * 1000);\n\n if (o && !modal) {\n if (typeof window !== \"undefined\") {\n window.requestAnimationFrame(() => {\n document.body.style.pointerEvents = \"auto\";\n });\n }\n }\n\n if (!o) {\n // This will be removed when the exit animation ends (`500ms`)\n document.body.style.pointerEvents = \"auto\";\n }\n },\n });\n const [hasBeenOpened, setHasBeenOpened] = React.useState<boolean>(false);\n const [isDragging, setIsDragging] = React.useState<boolean>(false);\n const [justReleased, setJustReleased] = React.useState<boolean>(false);\n const overlayRef = React.useRef<HTMLDivElement>(null);\n const openTime = React.useRef<Date | null>(null);\n const dragStartTime = React.useRef<Date | null>(null);\n const dragEndTime = React.useRef<Date | null>(null);\n const lastTimeDragPrevented = React.useRef<Date | null>(null);\n const isAllowedToDrag = React.useRef<boolean>(false);\n const nestedOpenChangeTimer = React.useRef<NodeJS.Timeout | null>(null);\n const pointerStart = React.useRef(0);\n const keyboardIsOpen = React.useRef(false);\n const shouldAnimate = React.useRef(!defaultOpen);\n const previousDiffFromInitial = React.useRef(0);\n const drawerRef = React.useRef<HTMLDivElement>(null);\n const drawerHeightRef = React.useRef(\n drawerRef.current?.getBoundingClientRect().height || 0\n );\n const drawerWidthRef = React.useRef(\n drawerRef.current?.getBoundingClientRect().width || 0\n );\n const initialDrawerHeight = React.useRef(0);\n\n const onSnapPointChange = React.useCallback(\n (activeSnapPointIndex: number) => {\n // Change openTime ref when we reach the last snap point to prevent dragging for 500ms incase it's scrollable.\n if (snapPoints && activeSnapPointIndex === snapPointsOffset.length - 1)\n openTime.current = new Date();\n },\n []\n );\n\n const {\n activeSnapPoint,\n activeSnapPointIndex,\n setActiveSnapPoint,\n onRelease: onReleaseSnapPoints,\n snapPointsOffset,\n onDrag: onDragSnapPoints,\n shouldFade,\n getPercentageDragged: getSnapPointsPercentageDragged,\n } = useSnapPoints({\n snapPoints,\n activeSnapPointProp,\n setActiveSnapPointProp,\n drawerRef,\n fadeFromIndex,\n overlayRef,\n onSnapPointChange,\n direction,\n container,\n snapToSequentialPoint,\n });\n\n usePreventScroll({\n isDisabled:\n !isOpen ||\n isDragging ||\n !modal ||\n justReleased ||\n !hasBeenOpened ||\n !repositionInputs ||\n !disablePreventScroll,\n });\n\n const { restorePositionSetting } = usePositionFixed({\n isOpen,\n modal,\n nested: nested ?? false,\n hasBeenOpened,\n preventScrollRestoration,\n noBodyStyles,\n });\n\n function getScale() {\n return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;\n }\n\n function onPress(event: BaseUIPointerEvent) {\n if (!dismissible && !snapPoints) return;\n if (drawerRef.current && !drawerRef.current.contains(event.target as Node))\n return;\n\n drawerHeightRef.current =\n drawerRef.current?.getBoundingClientRect().height || 0;\n drawerWidthRef.current =\n drawerRef.current?.getBoundingClientRect().width || 0;\n setIsDragging(true);\n dragStartTime.current = new Date();\n\n // iOS doesn't trigger mouseUp after scrolling so we need to listen to touched in order to disallow dragging\n if (isIOS()) {\n window.addEventListener(\n \"touchend\",\n () => (isAllowedToDrag.current = false),\n { once: true }\n );\n }\n // Ensure we maintain correct pointer capture even when going outside of the drawer\n (event.target as HTMLElement).setPointerCapture(event.pointerId);\n\n pointerStart.current = isVertical(direction) ? event.pageY : event.pageX;\n }\n\n function shouldDrag(el: EventTarget, isDraggingInDirection: boolean) {\n let element = el as HTMLElement;\n const highlightedText = window.getSelection()?.toString();\n const swipeAmount = drawerRef.current\n ? getTranslate(drawerRef.current, direction)\n : null;\n const date = new Date();\n\n // Fixes https://github.com/emilkowalski/vaul/issues/483\n if (element.tagName === \"SELECT\") {\n return false;\n }\n\n if (\n element.hasAttribute(\"data-vaul-no-drag\") ||\n element.closest(\"[data-vaul-no-drag]\")\n ) {\n return false;\n }\n\n if (direction === \"right\" || direction === \"left\") {\n return true;\n }\n\n // Allow scrolling when animating\n if (openTime.current && date.getTime() - openTime.current.getTime() < 500) {\n return false;\n }\n\n if (swipeAmount !== null) {\n if (direction === \"bottom\" ? swipeAmount > 0 : swipeAmount < 0) {\n return true;\n }\n }\n\n // Don't drag if there's highlighted text\n if (highlightedText && highlightedText.length > 0) {\n return false;\n }\n\n // Disallow dragging if drawer was scrolled within `scrollLockTimeout`\n if (\n lastTimeDragPrevented.current &&\n date.getTime() - lastTimeDragPrevented.current.getTime() <\n scrollLockTimeout &&\n swipeAmount === 0\n ) {\n lastTimeDragPrevented.current = date;\n return false;\n }\n\n if (isDraggingInDirection) {\n lastTimeDragPrevented.current = date;\n\n // We are dragging down so we should allow scrolling\n return false;\n }\n\n // Keep climbing up the DOM tree as long as there's a parent\n while (element) {\n // Check if the element is scrollable\n if (element.scrollHeight > element.clientHeight) {\n if (element.scrollTop !== 0) {\n lastTimeDragPrevented.current = new Date();\n\n // The element is scrollable and not scrolled to the top, so don't drag\n return false;\n }\n\n if (element.getAttribute(\"role\") === \"dialog\") {\n return true;\n }\n }\n\n // Move up to the parent element\n element = element.parentNode as HTMLElement;\n }\n\n // No scrollable parents not scrolled to the top found, so drag\n return true;\n }\n\n function onDrag(event: BaseUIMouseEvent) {\n if (!drawerRef.current) {\n return;\n }\n\n // We need to know how much of the drawer has been dragged in percentages so that we can transform background accordingly\n if (isDragging) {\n const directionMultiplier =\n direction === \"bottom\" || direction === \"right\" ? 1 : -1;\n const draggedDistance =\n (pointerStart.current -\n (isVertical(direction) ? event.pageY : event.pageX)) *\n directionMultiplier;\n const isDraggingInDirection = draggedDistance > 0;\n\n // Pre condition for disallowing dragging in the close direction.\n const noCloseSnapPointsPreCondition =\n snapPoints && !dismissible && !isDraggingInDirection;\n\n // Disallow dragging down to close when first snap point is the active one and dismissible prop is set to false.\n if (noCloseSnapPointsPreCondition && activeSnapPointIndex === 0) return;\n\n // We need to capture last time when drag with scroll was triggered and have a timeout between\n const absDraggedDistance = Math.abs(draggedDistance);\n const wrapper = document.querySelector(\"[data-vaul-drawer-wrapper]\");\n const drawerDimension =\n direction === \"bottom\" || direction === \"top\"\n ? drawerHeightRef.current\n : drawerWidthRef.current;\n\n // Calculate the percentage dragged, where 1 is the closed position\n let percentageDragged = absDraggedDistance / drawerDimension;\n const snapPointPercentageDragged = getSnapPointsPercentageDragged(\n absDraggedDistance,\n isDraggingInDirection\n );\n\n if (snapPointPercentageDragged !== null) {\n percentageDragged = snapPointPercentageDragged;\n }\n\n // Disallow close dragging beyond the smallest snap point.\n if (noCloseSnapPointsPreCondition && percentageDragged >= 1) {\n return;\n }\n\n if (\n !isAllowedToDrag.current &&\n !shouldDrag(event.target, isDraggingInDirection)\n )\n return;\n drawerRef.current.classList.add(DRAG_CLASS);\n // If shouldDrag gave true once after pressing down on the drawer, we set isAllowedToDrag to true and it will remain true until we let go, there's no reason to disable dragging mid way, ever, and that's the solution to it\n isAllowedToDrag.current = true;\n set(drawerRef.current, {\n transition: \"none\",\n });\n\n set(overlayRef.current, {\n transition: \"none\",\n });\n\n if (snapPoints) {\n onDragSnapPoints({ draggedDistance });\n }\n\n // Run this only if snapPoints are not defined or if we are at the last snap point (highest one)\n if (isDraggingInDirection && !snapPoints) {\n const dampenedDraggedDistance = dampenValue(draggedDistance);\n\n const translateValue =\n Math.min(dampenedDraggedDistance * -1, 0) * directionMultiplier;\n set(drawerRef.current, {\n transform: isVertical(direction)\n ? `translate3d(0, ${translateValue}px, 0)`\n : `translate3d(${translateValue}px, 0, 0)`,\n });\n return;\n }\n\n const opacityValue = 1 - percentageDragged;\n\n if (\n shouldFade ||\n (fadeFromIndex && activeSnapPointIndex === fadeFromIndex - 1)\n ) {\n onDragProp?.(event, percentageDragged);\n\n set(\n overlayRef.current,\n {\n opacity: `${opacityValue}`,\n transition: \"none\",\n },\n true\n );\n }\n\n if (wrapper && overlayRef.current && shouldScaleBackground) {\n // Calculate percentageDragged as a fraction (0 to 1)\n const scaleValue = Math.min(\n getScale() + percentageDragged * (1 - getScale()),\n 1\n );\n const borderRadiusValue = 8 - percentageDragged * 8;\n\n const translateValue = Math.max(0, 14 - percentageDragged * 14);\n\n set(\n wrapper,\n {\n borderRadius: `${borderRadiusValue}px`,\n transform: isVertical(direction)\n ? `scale(${scaleValue}) translate3d(0, ${translateValue}px, 0)`\n : `scale(${scaleValue}) translate3d(${translateValue}px, 0, 0)`,\n transition: \"none\",\n },\n true\n );\n }\n\n if (!snapPoints) {\n const translateValue = absDraggedDistance * directionMultiplier;\n\n set(drawerRef.current, {\n transform: isVertical(direction)\n ? `translate3d(0, ${translateValue}px, 0)`\n : `translate3d(${translateValue}px, 0, 0)`,\n });\n }\n }\n }\n\n React.useEffect(() => {\n window.requestAnimationFrame(() => {\n shouldAnimate.current = true;\n });\n }, []);\n\n React.useEffect(() => {\n function onVisualViewportChange() {\n if (!drawerRef.current || !repositionInputs) return;\n\n const focusedElement = document.activeElement as HTMLElement;\n if (isInput(focusedElement) || keyboardIsOpen.current) {\n const visualViewportHeight = window.visualViewport?.height || 0;\n const totalHeight = window.innerHeight;\n // This is the height of the keyboard\n let diffFromInitial = totalHeight - visualViewportHeight;\n const drawerHeight =\n drawerRef.current.getBoundingClientRect().height || 0;\n // Adjust drawer height only if it's tall enough\n const isTallEnough = drawerHeight > totalHeight * 0.8;\n\n if (!initialDrawerHeight.current) {\n initialDrawerHeight.current = drawerHeight;\n }\n const offsetFromTop = drawerRef.current.getBoundingClientRect().top;\n\n // visualViewport height may change due to somq e subtle changes to the keyboard. Checking if the height changed by 60 or more will make sure that they keyboard really changed its open state.\n if (Math.abs(previousDiffFromInitial.current - diffFromInitial) > 60) {\n keyboardIsOpen.current = !keyboardIsOpen.current;\n }\n\n if (\n snapPoints &&\n snapPoints.length > 0 &&\n snapPointsOffset &&\n activeSnapPointIndex\n ) {\n const activeSnapPointHeight =\n snapPointsOffset[activeSnapPointIndex] || 0;\n diffFromInitial += activeSnapPointHeight;\n }\n previousDiffFromInitial.current = diffFromInitial;\n // We don't have to change the height if the input is in view, when we are here we are in the opened keyboard state so we can correctly check if the input is in view\n if (drawerHeight > visualViewportHeight || keyboardIsOpen.current) {\n const height = drawerRef.current.getBoundingClientRect().height;\n let newDrawerHeight = height;\n\n if (height > visualViewportHeight) {\n newDrawerHeight =\n visualViewportHeight -\n (isTallEnough ? offsetFromTop : WINDOW_TOP_OFFSET);\n }\n // When fixed, don't move the drawer upwards if there's space, but rather only change it's height so it's fully scrollable when the keyboard is open\n if (fixed) {\n drawerRef.current.style.height = `${\n height - Math.max(diffFromInitial, 0)\n }px`;\n } else {\n drawerRef.current.style.height = `${Math.max(\n newDrawerHeight,\n visualViewportHeight - offsetFromTop\n )}px`;\n }\n } else if (!isMobileFirefox()) {\n drawerRef.current.style.height = `${initialDrawerHeight.current}px`;\n }\n\n if (snapPoints && snapPoints.length > 0 && !keyboardIsOpen.current) {\n drawerRef.current.style.bottom = `0px`;\n } else {\n // Negative bottom value would never make sense\n drawerRef.current.style.bottom = `${Math.max(diffFromInitial, 0)}px`;\n }\n }\n }\n\n window.visualViewport?.addEventListener(\"resize\", onVisualViewportChange);\n return () =>\n window.visualViewport?.removeEventListener(\n \"resize\",\n onVisualViewportChange\n );\n }, [activeSnapPointIndex, snapPoints, snapPointsOffset]);\n\n function closeDrawer(fromWithin?: boolean) {\n cancelDrag();\n onClose?.();\n\n if (!fromWithin) {\n setIsOpen(false);\n }\n\n setTimeout(() => {\n if (snapPoints) {\n setActiveSnapPoint(snapPoints[0]);\n }\n }, TRANSITIONS.DURATION * 1000); // seconds to ms\n }\n\n function resetDrawer() {\n if (!drawerRef.current) return;\n const wrapper = document.querySelector(\"[data-vaul-drawer-wrapper]\");\n const currentSwipeAmount = getTranslate(drawerRef.current, direction);\n\n set(drawerRef.current, {\n transform: \"translate3d(0, 0, 0)\",\n transition: `transform ${\n TRANSITIONS.DURATION\n }s cubic-bezier(${TRANSITIONS.EASE.join(\",\")})`,\n });\n\n set(overlayRef.current, {\n transition: `opacity ${\n TRANSITIONS.DURATION\n }s cubic-bezier(${TRANSITIONS.EASE.join(\",\")})`,\n opacity: \"1\",\n });\n\n // Don't reset background if swiped upwards\n if (\n shouldScaleBackground &&\n currentSwipeAmount &&\n currentSwipeAmount > 0 &&\n isOpen\n ) {\n set(\n wrapper,\n {\n borderRadius: `${BORDER_RADIUS}px`,\n overflow: \"hidden\",\n ...(isVertical(direction)\n ? {\n transform: `scale(${getScale()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,\n transformOrigin: \"top\",\n }\n : {\n transform: `scale(${getScale()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,\n transformOrigin: \"left\",\n }),\n transitionProperty: \"transform, border-radius\",\n transitionDuration: `${TRANSITIONS.DURATION}s`,\n transitionTimingFunction: `cubic-bezier(${TRANSITIONS.EASE.join(\n \",\"\n )})`,\n },\n true\n );\n }\n }\n\n function cancelDrag() {\n if (!isDragging || !drawerRef.current) return;\n\n drawerRef.current.classList.remove(DRAG_CLASS);\n isAllowedToDrag.current = false;\n setIsDragging(false);\n dragEndTime.current = new Date();\n }\n\n function onRelease(event: BaseUIMouseEvent | null) {\n if (!isDragging || !drawerRef.current) return;\n\n drawerRef.current.classList.remove(DRAG_CLASS);\n isAllowedToDrag.current = false;\n setIsDragging(false);\n dragEndTime.current = new Date();\n const swipeAmount = getTranslate(drawerRef.current, direction);\n\n if (\n !event ||\n !shouldDrag(event.target, false) ||\n !swipeAmount ||\n Number.isNaN(swipeAmount)\n )\n return;\n\n if (dragStartTime.current === null) return;\n\n const timeTaken =\n dragEndTime.current.getTime() - dragStartTime.current.getTime();\n const distMoved =\n pointerStart.current -\n (isVertical(direction) ? event.pageY : event.pageX);\n const velocity = Math.abs(distMoved) / timeTaken;\n\n if (velocity > 0.05) {\n // `justReleased` is needed to prevent the drawer from focusing on an input when the drag ends, as it's not the intent most of the time.\n setJustReleased(true);\n\n setTimeout(() => {\n setJustReleased(false);\n }, 200);\n }\n\n if (snapPoints) {\n const directionMultiplier =\n direction === \"bottom\" || direction === \"right\" ? 1 : -1;\n onReleaseSnapPoints({\n draggedDistance: distMoved * directionMultiplier,\n closeDrawer,\n velocity,\n dismissible,\n });\n onReleaseProp?.(event, true);\n return;\n }\n\n // Moved upwards, don't do anything\n if (\n direction === \"bottom\" || direction === \"right\"\n ? distMoved > 0\n : distMoved < 0\n ) {\n resetDrawer();\n onReleaseProp?.(event, true);\n return;\n }\n\n if (velocity > VELOCITY_THRESHOLD) {\n closeDrawer();\n onReleaseProp?.(event, false);\n return;\n }\n\n const visibleDrawerHeight = Math.min(\n drawerRef.current.getBoundingClientRect().height ?? 0,\n window.innerHeight\n );\n const visibleDrawerWidth = Math.min(\n drawerRef.current.getBoundingClientRect().width ?? 0,\n window.innerWidth\n );\n\n const isHorizontalSwipe = direction === \"left\" || direction === \"right\";\n if (\n Math.abs(swipeAmount) >=\n (isHorizontalSwipe ? visibleDrawerWidth : visibleDrawerHeight) *\n closeThreshold\n ) {\n closeDrawer();\n onReleaseProp?.(event, false);\n return;\n }\n\n onReleaseProp?.(event, true);\n resetDrawer();\n }\n\n React.useEffect(() => {\n // Trigger enter animation without using CSS animation\n if (isOpen) {\n set(document.documentElement, {\n scrollBehavior: \"auto\",\n });\n\n openTime.current = new Date();\n }\n\n return () => {\n reset(document.documentElement, \"scrollBehavior\");\n };\n }, [isOpen]);\n\n function onNestedOpenChange(o: boolean) {\n const scale = o\n ? (window.innerWidth - NESTED_DISPLACEMENT) / window.innerWidth\n : 1;\n\n const initialTranslate = o ? -NESTED_DISPLACEMENT : 0;\n\n if (nestedOpenChangeTimer.current) {\n window.clearTimeout(nestedOpenChangeTimer.current);\n }\n\n set(drawerRef.current, {\n transition: `transform ${\n TRANSITIONS.DURATION\n }s cubic-bezier(${TRANSITIONS.EASE.join(\",\")})`,\n transform: isVertical(direction)\n ? `scale(${scale}) translate3d(0, ${initialTranslate}px, 0)`\n : `scale(${scale}) translate3d(${initialTranslate}px, 0, 0)`,\n });\n\n if (!o && drawerRef.current) {\n nestedOpenChangeTimer.current = setTimeout(() => {\n const translateValue = getTranslate(\n drawerRef.current as HTMLElement,\n direction\n );\n set(drawerRef.current, {\n transition: \"none\",\n transform: isVertical(direction)\n ? `translate3d(0, ${translateValue}px, 0)`\n : `translate3d(${translateValue}px, 0, 0)`,\n });\n }, 500);\n }\n }\n\n function onNestedDrag(_event: BaseUIMouseEvent, percentageDragged: number) {\n if (percentageDragged < 0) return;\n\n const initialScale =\n (window.innerWidth - NESTED_DISPLACEMENT) / window.innerWidth;\n const newScale = initialScale + percentageDragged * (1 - initialScale);\n const newTranslate =\n -NESTED_DISPLACEMENT + percentageDragged * NESTED_DISPLACEMENT;\n\n set(drawerRef.current, {\n transform: isVertical(direction)\n ? `scale(${newScale}) translate3d(0, ${newTranslate}px, 0)`\n : `scale(${newScale}) translate3d(${newTranslate}px, 0, 0)`,\n transition: \"none\",\n });\n }\n\n function onNestedRelease(_event: BaseUIMouseEvent, o: boolean) {\n const dim = isVertical(direction) ? window.innerHeight : window.innerWidth;\n const scale = o ? (dim - NESTED_DISPLACEMENT) / dim : 1;\n const translate = o ? -NESTED_DISPLACEMENT : 0;\n\n if (o) {\n set(drawerRef.current, {\n transition: `transform ${\n TRANSITIONS.DURATION\n }s cubic-bezier(${TRANSITIONS.EASE.join(\",\")})`,\n transform: isVertical(direction)\n ? `scale(${scale}) translate3d(0, ${translate}px, 0)`\n : `scale(${scale}) translate3d(${translate}px, 0, 0)`,\n });\n }\n }\n\n React.useEffect(() => {\n if (!modal) {\n // Need to do this manually unfortunately\n window.requestAnimationFrame(() => {\n document.body.style.pointerEvents = \"auto\";\n });\n }\n }, [modal]);\n\n return (\n <DialogPrimitive.Root\n defaultOpen={defaultOpen}\n onOpenChange={(open) => {\n if (!dismissible && !open) return;\n if (open) {\n setHasBeenOpened(true);\n } else {\n closeDrawer(true);\n }\n\n setIsOpen(open);\n }}\n open={isOpen}\n modal={modal}\n >\n <DrawerContext.Provider\n value={{\n activeSnapPoint,\n snapPoints,\n setActiveSnapPoint,\n drawerRef,\n overlayRef,\n onOpenChange,\n onPress,\n onRelease,\n onDrag,\n dismissible,\n shouldAnimate,\n handleOnly,\n isOpen,\n isDragging,\n shouldFade,\n closeDrawer,\n onNestedDrag,\n onNestedOpenChange,\n onNestedRelease,\n keyboardIsOpen,\n modal,\n snapPointsOffset,\n activeSnapPointIndex,\n direction,\n shouldScaleBackground,\n setBackgroundColorOnScale,\n noBodyStyles,\n container,\n autoFocus,\n }}\n >\n {children}\n </DrawerContext.Provider>\n </DialogPrimitive.Root>\n );\n}\n\nexport const Overlay = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Backdrop>\n>(function ({ ...rest }, ref) {\n const {\n overlayRef,\n snapPoints,\n onRelease,\n shouldFade,\n isOpen,\n modal,\n shouldAnimate,\n } = useDrawerContext();\n const composedRef = useComposedRefs(ref, overlayRef);\n const hasSnapPoints = snapPoints && snapPoints.length > 0;\n const onMouseUp = React.useCallback(\n (event: BaseUIMouseEvent) => onRelease(event),\n [onRelease]\n );\n\n // Overlay is the component that is locking scroll, removing it will unlock the scroll without having to dig into Radix's Dialog library\n if (!modal) {\n return null;\n }\n\n return (\n <DialogPrimitive.Backdrop\n onMouseUp={onMouseUp}\n ref={composedRef}\n data-vaul-overlay=\"\"\n data-vaul-snap-points={isOpen && hasSnapPoints ? \"true\" : \"false\"}\n data-vaul-snap-points-overlay={isOpen && shouldFade ? \"true\" : \"false\"}\n data-vaul-animate={shouldAnimate?.current ? \"true\" : \"false\"}\n {...rest}\n />\n );\n});\n\nOverlay.displayName = \"Drawer.Overlay\";\n\nexport type ContentProps = React.ComponentPropsWithoutRef<\n typeof DialogPrimitive.Popup\n>;\n\nexport const Content = React.forwardRef<HTMLDivElement, ContentProps>(function (\n { style, ...rest },\n ref\n) {\n const {\n drawerRef,\n onPress,\n onRelease,\n onDrag,\n keyboardIsOpen,\n snapPointsOffset,\n activeSnapPointIndex,\n modal,\n isOpen,\n direction,\n snapPoints,\n container,\n handleOnly,\n shouldAnimate,\n autoFocus,\n } = useDrawerContext();\n // Needed to use transition instead of animations\n const [delayedSnapPoints, setDelayedSnapPoints] = React.useState(false);\n const composedRef = useComposedRefs(ref, drawerRef);\n const pointerStartRef = React.useRef<{ x: number; y: number } | null>(null);\n const lastKnownPointerEventRef = React.useRef<BaseUIMouseEvent | null>(null);\n const wasBeyondThePointRef = React.useRef(false);\n const hasSnapPoints = snapPoints && snapPoints.length > 0;\n useScaleBackground();\n\n const isDeltaInDirection = (\n delta: { x: number; y: number },\n direction: DrawerDirection,\n threshold = 0\n ) => {\n if (wasBeyondThePointRef.current) return true;\n\n const deltaY = Math.abs(delta.y);\n const deltaX = Math.abs(delta.x);\n const isDeltaX = deltaX > deltaY;\n const dFactor = [\"bottom\", \"right\"].includes(direction) ? 1 : -1;\n\n if (direction === \"left\" || direction === \"right\") {\n const isReverseDirection = delta.x * dFactor < 0;\n if (!isReverseDirection && deltaX >= 0 && deltaX <= threshold) {\n return isDeltaX;\n }\n } else {\n const isReverseDirection = delta.y * dFactor < 0;\n if (!isReverseDirection && deltaY >= 0 && deltaY <= threshold) {\n return !isDeltaX;\n }\n }\n\n wasBeyondThePointRef.current = true;\n return true;\n };\n\n React.useEffect(() => {\n if (hasSnapPoints) {\n window.requestAnimationFrame(() => {\n setDelayedSnapPoints(true);\n });\n }\n }, []);\n\n function handleOnPointerUp(event: BaseUIMouseEvent | null) {\n pointerStartRef.current = null;\n wasBeyondThePointRef.current = false;\n onRelease(event);\n }\n\n return (\n <DialogPrimitive.Viewport>\n <DialogPrimitive.Popup\n data-vaul-drawer-direction={direction}\n data-vaul-drawer=\"\"\n data-vaul-delayed-snap-points={delayedSnapPoints ? \"true\" : \"false\"}\n data-vaul-snap-points={isOpen && hasSnapPoints ? \"true\" : \"false\"}\n data-vaul-custom-container={container ? \"true\" : \"false\"}\n data-vaul-animate={shouldAnimate?.current ? \"true\" : \"false\"}\n {...rest}\n ref={composedRef}\n style={\n snapPointsOffset && snapPointsOffset.length > 0\n ? ({\n // @ts-ignore This should not be an error\n \"--snap-point-height\": `${snapPointsOffset[\n activeSnapPointIndex ?? 0\n ]!}px`,\n ...style,\n } as React.CSSProperties)\n : style\n }\n onPointerDown={(event) => {\n if (handleOnly) return;\n rest.onPointerDown?.(event);\n pointerStartRef.current = { x: event.pageX, y: event.pageY };\n onPress(event);\n }}\n onPointerMove={(event) => {\n lastKnownPointerEventRef.current = event;\n if (handleOnly) return;\n rest.onPointerMove?.(event);\n if (!pointerStartRef.current) return;\n const yPosition = event.pageY - pointerStartRef.current.y;\n const xPosition = event.pageX - pointerStartRef.current.x;\n\n const swipeStartThreshold = event.pointerType === \"touch\" ? 10 : 2;\n const delta = { x: xPosition, y: yPosition };\n\n const isAllowedToSwipe = isDeltaInDirection(\n delta,\n direction,\n swipeStartThreshold\n );\n if (isAllowedToSwipe) onDrag(event);\n else if (\n Math.abs(xPosition) > swipeStartThreshold ||\n Math.abs(yPosition) > swipeStartThreshold\n ) {\n pointerStartRef.current = null;\n }\n }}\n onPointerUp={(event) => {\n rest.onPointerUp?.(event);\n pointerStartRef.current = null;\n wasBeyondThePointRef.current = false;\n onRelease(event);\n }}\n onPointerOut={(event) => {\n rest.onPointerOut?.(event);\n handleOnPointerUp(lastKnownPointerEventRef.current);\n }}\n onContextMenu={(event) => {\n rest.onContextMenu?.(event);\n if (lastKnownPointerEventRef.current) {\n handleOnPointerUp(lastKnownPointerEventRef.current);\n }\n }}\n />\n </DialogPrimitive.Viewport>\n );\n});\n\nContent.displayName = \"Drawer.Content\";\n\nexport type HandleProps = React.ComponentPropsWithoutRef<\"div\"> & {\n preventCycle?: boolean;\n};\n\nconst LONG_HANDLE_PRESS_TIMEOUT = 250;\nconst DOUBLE_TAP_TIMEOUT = 120;\n\nexport const Handle = React.forwardRef<HTMLDivElement, HandleProps>(function (\n { preventCycle = false, children, ...rest },\n ref\n) {\n const {\n closeDrawer,\n isDragging,\n snapPoints,\n activeSnapPoint,\n setActiveSnapPoint,\n dismissible,\n handleOnly,\n isOpen,\n onPress,\n onDrag,\n } = useDrawerContext();\n\n const closeTimeoutIdRef = React.useRef<number | null>(null);\n const shouldCancelInteractionRef = React.useRef(false);\n\n function handleStartCycle() {\n // Stop if this is the second click of a double click\n if (shouldCancelInteractionRef.current) {\n handleCancelInteraction();\n return;\n }\n window.setTimeout(() => {\n handleCycleSnapPoints();\n }, DOUBLE_TAP_TIMEOUT);\n }\n\n function handleCycleSnapPoints() {\n // Prevent accidental taps while resizing drawer\n if (isDragging || preventCycle || shouldCancelInteractionRef.current) {\n handleCancelInteraction();\n return;\n }\n // Make sure to clear the timeout id if the user releases the handle before the cancel timeout\n handleCancelInteraction();\n\n if (!snapPoints || snapPoints.length === 0) {\n if (!dismissible) {\n closeDrawer();\n }\n return;\n }\n\n const isLastSnapPoint =\n activeSnapPoint === snapPoints[snapPoints.length - 1];\n\n if (isLastSnapPoint && dismissible) {\n closeDrawer();\n return;\n }\n\n const currentSnapIndex = snapPoints.findIndex(\n (point) => point === activeSnapPoint\n );\n if (currentSnapIndex === -1) return; // activeSnapPoint not found in snapPoints\n const nextSnapPoint = snapPoints[currentSnapIndex + 1];\n setActiveSnapPoint(nextSnapPoint);\n }\n\n function handleStartInteraction() {\n closeTimeoutIdRef.current = window.setTimeout(() => {\n // Cancel click interaction on a long press\n shouldCancelInteractionRef.current = true;\n }, LONG_HANDLE_PRESS_TIMEOUT);\n }\n\n function handleCancelInteraction() {\n if (closeTimeoutIdRef.current) {\n window.clearTimeout(closeTimeoutIdRef.current);\n }\n shouldCancelInteractionRef.current = false;\n }\n\n return (\n <div\n onClick={handleStartCycle}\n onPointerCancel={handleCancelInteraction}\n onPointerDown={(e) => {\n if (handleOnly)\n onPress({\n ...e,\n preventBaseUIHandler: () => {},\n });\n handleStartInteraction();\n }}\n onPointerMove={(e) => {\n if (handleOnly)\n onDrag({\n ...e,\n preventBaseUIHandler: () => {},\n });\n }}\n // onPointerUp is already handled by the content component\n ref={ref}\n data-vaul-drawer-visible={isOpen ? \"true\" : \"false\"}\n data-vaul-handle=\"\"\n aria-hidden=\"true\"\n {...rest}\n >\n {/* Expand handle's hit area beyond what's visible to ensure a 44x44 tap target for touch devices */}\n <span data-vaul-handle-hitarea=\"\" aria-hidden=\"true\">\n {children}\n </span>\n </div>\n );\n});\n\nHandle.displayName = \"Drawer.Handle\";\n\nexport function NestedRoot({\n onDrag,\n onOpenChange,\n open: nestedIsOpen,\n ...rest\n}: DialogProps) {\n const { onNestedDrag, onNestedOpenChange, onNestedRelease } =\n useDrawerContext();\n\n if (!onNestedDrag) {\n throw new Error(\"Drawer.NestedRoot must be placed in another drawer\");\n }\n\n return (\n <Root\n nested\n open={nestedIsOpen}\n onClose={() => {\n onNestedOpenChange(false);\n }}\n onDrag={(e, p) => {\n onNestedDrag(e, p);\n onDrag?.(e, p);\n }}\n onOpenChange={(o) => {\n if (o) {\n onNestedOpenChange(o);\n }\n onOpenChange?.(o);\n }}\n onRelease={onNestedRelease}\n {...rest}\n />\n );\n}\n\ntype PortalProps = React.ComponentPropsWithoutRef<\n typeof DialogPrimitive.Portal\n>;\n\nexport function Portal(props: PortalProps) {\n const context = useDrawerContext();\n const { container = context.container, ...portalProps } = props;\n\n return <DialogPrimitive.Portal container={container} {...portalProps} />;\n}\n\nexport const Drawer = {\n Root,\n NestedRoot,\n Content,\n Overlay,\n Trigger: DialogPrimitive.Trigger,\n Portal,\n Handle,\n Close: DialogPrimitive.Close,\n Title: DialogPrimitive.Title,\n Description: DialogPrimitive.Description,\n};\n"],"mappings":";;;;;;;;AA+CA,MAAa,gBAAgB,MAAM,cAAkC;CACnE,WAAW,EAAE,SAAS,MAAM;CAC5B,YAAY,EAAE,SAAS,MAAM;CAC7B,eAAe;CACf,iBAAiB;CACjB,cAAc;CACd,oBAAoB;CACpB,0BAA0B;CAC1B,uBAAuB;CACvB,UAAU;CACV,aAAa;CACb,QAAQ;CACR,YAAY;CACZ,gBAAgB,EAAE,SAAS,OAAO;CAClC,kBAAkB;CAClB,YAAY;CACZ,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