zudoku 0.13.6 → 0.14.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/cli.js +2 -2
- package/dist/app/entry.client.js +2 -2
- package/dist/app/entry.client.js.map +1 -1
- package/dist/app/entry.server.js +3 -0
- package/dist/app/entry.server.js.map +1 -1
- package/dist/app/main.d.ts +1 -0
- package/dist/app/main.js +7 -22
- package/dist/app/main.js.map +1 -1
- package/dist/app/standalone.js.map +1 -1
- package/dist/cli/common/machine-id/lib.js.map +1 -1
- package/dist/cli/common/outdated.js.map +1 -1
- package/dist/cli/common/utils/box.js.map +1 -1
- package/dist/config/validators/InputSidebarSchema.d.ts +2 -2
- package/dist/config/validators/SidebarSchema.d.ts +24 -1
- package/dist/config/validators/SidebarSchema.js +76 -39
- package/dist/config/validators/SidebarSchema.js.map +1 -1
- package/dist/config/validators/validate.d.ts +329 -264
- package/dist/config/validators/validate.js +11 -10
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/components/Header.js +5 -1
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/Heading.d.ts +1 -1
- package/dist/lib/components/SyntaxHighlight.js +4 -1
- package/dist/lib/components/SyntaxHighlight.js.map +1 -1
- package/dist/lib/components/TopNavigation.js +30 -5
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/context/ZudokuContext.d.ts +6 -12
- package/dist/lib/components/context/ZudokuContext.js +26 -20
- package/dist/lib/components/context/ZudokuContext.js.map +1 -1
- package/dist/lib/components/navigation/Sidebar.js +3 -3
- package/dist/lib/components/navigation/Sidebar.js.map +1 -1
- package/dist/lib/components/navigation/SidebarCategory.js +2 -4
- package/dist/lib/components/navigation/SidebarCategory.js.map +1 -1
- package/dist/lib/components/navigation/SidebarItem.js +1 -3
- package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
- package/dist/lib/components/navigation/utils.js +10 -14
- package/dist/lib/components/navigation/utils.js.map +1 -1
- package/dist/lib/core/DevPortalContext.d.ts +3 -7
- package/dist/lib/core/DevPortalContext.js.map +1 -1
- package/dist/lib/core/plugins.d.ts +1 -0
- package/dist/lib/core/plugins.js.map +1 -1
- package/dist/lib/plugins/api-keys/CreateApiKey.js +1 -1
- package/dist/lib/plugins/api-keys/CreateApiKey.js.map +1 -1
- package/dist/lib/plugins/markdown/index.d.ts +5 -6
- package/dist/lib/plugins/markdown/index.js +31 -3
- package/dist/lib/plugins/markdown/index.js.map +1 -1
- package/dist/lib/plugins/markdown/resolver.d.ts +38 -0
- package/dist/lib/plugins/markdown/resolver.js +75 -0
- package/dist/lib/plugins/markdown/resolver.js.map +1 -0
- package/dist/lib/plugins/openapi/Endpoint.js.map +1 -1
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js +2 -2
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/client/worker.js.map +1 -1
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/Playground.js +1 -1
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +1 -1
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -1
- package/dist/lib/ui/Accordion.d.ts +7 -0
- package/dist/lib/ui/Accordion.js +14 -0
- package/dist/lib/ui/Accordion.js.map +1 -0
- package/dist/lib/ui/Alert.d.ts +8 -0
- package/dist/lib/ui/Alert.js +23 -0
- package/dist/lib/ui/Alert.js.map +1 -0
- package/dist/lib/ui/AlertDialog.d.ts +20 -0
- package/dist/lib/ui/AlertDialog.js +27 -0
- package/dist/lib/ui/AlertDialog.js.map +1 -0
- package/dist/lib/ui/AspectRatio.d.ts +3 -0
- package/dist/lib/ui/AspectRatio.js +4 -0
- package/dist/lib/ui/AspectRatio.js.map +1 -0
- package/dist/lib/ui/Badge.d.ts +9 -0
- package/dist/lib/ui/Badge.js +21 -0
- package/dist/lib/ui/Badge.js.map +1 -0
- package/dist/lib/ui/Breadcrumb.d.ts +19 -0
- package/dist/lib/ui/Breadcrumb.js +24 -0
- package/dist/lib/ui/Breadcrumb.js.map +1 -0
- package/dist/lib/ui/Button.d.ts +2 -3
- package/dist/lib/ui/Button.js +1 -1
- package/dist/lib/ui/Button.js.map +1 -1
- package/dist/lib/ui/Carousel.d.ts +18 -0
- package/dist/lib/ui/Carousel.js +99 -0
- package/dist/lib/ui/Carousel.js.map +1 -0
- package/dist/lib/ui/Checkbox.d.ts +4 -0
- package/dist/lib/ui/Checkbox.js +9 -0
- package/dist/lib/ui/Checkbox.js.map +1 -0
- package/dist/lib/ui/Collapsible.d.ts +5 -0
- package/dist/lib/ui/Collapsible.js +6 -0
- package/dist/lib/ui/Collapsible.js.map +1 -0
- package/dist/lib/{components → ui}/Dialog.js +2 -2
- package/dist/lib/ui/Dialog.js.map +1 -0
- package/dist/lib/ui/Form.d.ts +23 -0
- package/dist/lib/ui/Form.js +63 -0
- package/dist/lib/ui/Form.js.map +1 -0
- package/dist/lib/ui/HoverCard.d.ts +6 -0
- package/dist/lib/ui/HoverCard.js +10 -0
- package/dist/lib/ui/HoverCard.js.map +1 -0
- package/dist/lib/ui/Label.d.ts +5 -0
- package/dist/lib/ui/Label.js +10 -0
- package/dist/lib/ui/Label.js.map +1 -0
- package/dist/lib/ui/Pagination.d.ts +28 -0
- package/dist/lib/ui/Pagination.js +24 -0
- package/dist/lib/ui/Pagination.js.map +1 -0
- package/dist/lib/ui/Popover.d.ts +6 -0
- package/dist/lib/ui/Popover.js +10 -0
- package/dist/lib/ui/Popover.js.map +1 -0
- package/dist/lib/ui/Progress.d.ts +4 -0
- package/dist/lib/ui/Progress.js +8 -0
- package/dist/lib/ui/Progress.js.map +1 -0
- package/dist/lib/ui/RadioGroup.d.ts +5 -0
- package/dist/lib/ui/RadioGroup.js +15 -0
- package/dist/lib/ui/RadioGroup.js.map +1 -0
- package/dist/lib/ui/ScrollArea.d.ts +5 -0
- package/dist/lib/ui/ScrollArea.js +12 -0
- package/dist/lib/ui/ScrollArea.js.map +1 -0
- package/dist/lib/ui/Select.js.map +1 -0
- package/dist/lib/ui/Skeleton.d.ts +2 -0
- package/dist/lib/ui/Skeleton.js +7 -0
- package/dist/lib/ui/Skeleton.js.map +1 -0
- package/dist/lib/ui/Slider.d.ts +4 -0
- package/dist/lib/ui/Slider.js +8 -0
- package/dist/lib/ui/Slider.js.map +1 -0
- package/dist/lib/ui/Switch.d.ts +4 -0
- package/dist/lib/ui/Switch.js +8 -0
- package/dist/lib/ui/Switch.js.map +1 -0
- package/dist/lib/ui/Textarea.d.ts +4 -0
- package/dist/lib/ui/Textarea.js +9 -0
- package/dist/lib/ui/Textarea.js.map +1 -0
- package/dist/lib/ui/Toggle.d.ts +12 -0
- package/dist/lib/ui/Toggle.js +26 -0
- package/dist/lib/ui/Toggle.js.map +1 -0
- package/dist/lib/ui/ToggleGroup.d.ts +12 -0
- package/dist/lib/ui/ToggleGroup.js +21 -0
- package/dist/lib/ui/ToggleGroup.js.map +1 -0
- package/dist/lib/ui/Tooltip.d.ts +7 -0
- package/dist/lib/ui/Tooltip.js +11 -0
- package/dist/lib/ui/Tooltip.js.map +1 -0
- package/dist/lib/util/MdxComponents.js.map +1 -1
- package/dist/lib/util/useScrollToAnchor.js.map +1 -1
- package/dist/vite/build.js +7 -2
- package/dist/vite/build.js.map +1 -1
- package/dist/vite/config.js +11 -6
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/debug.d.ts +1 -0
- package/dist/vite/debug.js +10 -0
- package/dist/vite/debug.js.map +1 -0
- package/dist/vite/plugin-component.js +17 -7
- package/dist/vite/plugin-component.js.map +1 -1
- package/dist/vite/plugin-config-reload.js +0 -2
- package/dist/vite/plugin-config-reload.js.map +1 -1
- package/dist/vite/plugin-docs.js +37 -26
- package/dist/vite/plugin-docs.js.map +1 -1
- package/dist/vite/plugin-frontmatter.d.ts +2 -1
- package/dist/vite/plugin-frontmatter.js +27 -24
- package/dist/vite/plugin-frontmatter.js.map +1 -1
- package/dist/vite/plugin-sidebar.js +7 -6
- package/dist/vite/plugin-sidebar.js.map +1 -1
- package/dist/vite/plugin.js +1 -1
- package/dist/vite/plugin.js.map +1 -1
- package/dist/vite/prerender.d.ts +5 -1
- package/dist/vite/prerender.js +6 -5
- package/dist/vite/prerender.js.map +1 -1
- package/lib/{utils-G5XSiZc9.js → AnchorLink-BbB2q-jx.js} +231 -275
- package/lib/AnchorLink-BbB2q-jx.js.map +1 -0
- package/lib/{AuthenticationPlugin-tBvLKsFg.js → AuthenticationPlugin-C9BHGXlE.js} +2 -2
- package/lib/{AuthenticationPlugin-tBvLKsFg.js.map → AuthenticationPlugin-C9BHGXlE.js.map} +1 -1
- package/lib/{CategoryHeading-D2WS6sRI.js → CategoryHeading-Bb9dqxD3.js} +4 -4
- package/lib/{CategoryHeading-D2WS6sRI.js.map → CategoryHeading-Bb9dqxD3.js.map} +1 -1
- package/lib/{DeveloperHint-CRiZjqd2.js → DeveloperHint-DHdLXGHA.js} +2 -2
- package/lib/{DeveloperHint-CRiZjqd2.js.map → DeveloperHint-DHdLXGHA.js.map} +1 -1
- package/lib/{Markdown-DM4zv3MA.js → Markdown-BDcCAWwm.js} +4268 -6651
- package/lib/Markdown-BDcCAWwm.js.map +1 -0
- package/lib/{MdxPage-tWI_P8wP.js → MdxPage-DKMH_t0f.js} +31 -29
- package/lib/{MdxPage-tWI_P8wP.js.map → MdxPage-DKMH_t0f.js.map} +1 -1
- package/lib/{OperationList-Cd3lue0b.js → OperationList-DnaAtLxP.js} +131 -127
- package/lib/OperationList-DnaAtLxP.js.map +1 -0
- package/lib/{Route-DI0Y0pIV.js → Route-DSbLrlig.js} +2 -2
- package/lib/{Route-DI0Y0pIV.js.map → Route-DSbLrlig.js.map} +1 -1
- package/lib/Select-Bagt3Bme.js +223 -0
- package/lib/Select-Bagt3Bme.js.map +1 -0
- package/lib/{SlotletProvider-CBqY8mp6.js → SlotletProvider-4Naek_5M.js} +4 -4
- package/lib/{SlotletProvider-CBqY8mp6.js.map → SlotletProvider-4Naek_5M.js.map} +1 -1
- package/lib/Spinner-C6zroowC.js +40 -0
- package/lib/Spinner-C6zroowC.js.map +1 -0
- package/lib/StaggeredRender-DDHSzQKE.js +17 -0
- package/lib/StaggeredRender-DDHSzQKE.js.map +1 -0
- package/lib/{ZudokuContext-DEoP3GGJ.js → ZudokuContext-BKXGJTmu.js} +460 -411
- package/lib/ZudokuContext-BKXGJTmu.js.map +1 -0
- package/lib/__vite-browser-external-BYRIRx8p.js +9 -0
- package/lib/__vite-browser-external-BYRIRx8p.js.map +1 -0
- package/lib/assets/worker-Bf8vjASY.js.map +1 -1
- package/lib/cn-BmFQLtkS.js +2279 -0
- package/lib/cn-BmFQLtkS.js.map +1 -0
- package/lib/hook-sn0zMTkE.js +229 -0
- package/lib/hook-sn0zMTkE.js.map +1 -0
- package/lib/{index-Bs9roz8y.js → index-B3F9d8oi.js} +1201 -1429
- package/lib/index-B3F9d8oi.js.map +1 -0
- package/lib/index-BuAyrJe3.js +46 -0
- package/lib/index-BuAyrJe3.js.map +1 -0
- package/lib/index.esm-C5mr_sKO.js +1193 -0
- package/lib/index.esm-C5mr_sKO.js.map +1 -0
- package/lib/ui/Accordion.js +47 -0
- package/lib/ui/Accordion.js.map +1 -0
- package/lib/ui/Alert.js +51 -0
- package/lib/ui/Alert.js.map +1 -0
- package/lib/ui/AlertDialog.js +114 -0
- package/lib/ui/AlertDialog.js.map +1 -0
- package/lib/ui/AspectRatio.js +6 -0
- package/lib/ui/AspectRatio.js.map +1 -0
- package/lib/ui/Badge.js +27 -0
- package/lib/ui/Badge.js.map +1 -0
- package/lib/ui/Breadcrumb.js +94 -0
- package/lib/ui/Breadcrumb.js.map +1 -0
- package/lib/ui/Button.js +49 -0
- package/lib/ui/Button.js.map +1 -0
- package/lib/ui/Callout.js +77 -0
- package/lib/ui/Callout.js.map +1 -0
- package/lib/ui/Card.js +62 -0
- package/lib/ui/Card.js.map +1 -0
- package/lib/ui/Carousel.js +1410 -0
- package/lib/ui/Carousel.js.map +1 -0
- package/lib/ui/Checkbox.js +28 -0
- package/lib/ui/Checkbox.js.map +1 -0
- package/lib/ui/Collapsible.js +8 -0
- package/lib/ui/Collapsible.js.map +1 -0
- package/lib/ui/Dialog.js +101 -0
- package/lib/ui/Dialog.js.map +1 -0
- package/lib/ui/Drawer.js +1153 -0
- package/lib/ui/Drawer.js.map +1 -0
- package/lib/ui/DropdownMenu.js +145 -0
- package/lib/ui/DropdownMenu.js.map +1 -0
- package/lib/ui/Form.js +95 -0
- package/lib/ui/Form.js.map +1 -0
- package/lib/ui/HoverCard.js +24 -0
- package/lib/ui/HoverCard.js.map +1 -0
- package/lib/ui/Input.js +22 -0
- package/lib/ui/Input.js.map +1 -0
- package/lib/ui/Label.js +20 -0
- package/lib/ui/Label.js.map +1 -0
- package/lib/ui/Pagination.js +106 -0
- package/lib/ui/Pagination.js.map +1 -0
- package/lib/ui/Popover.js +24 -0
- package/lib/ui/Popover.js.map +1 -0
- package/lib/ui/Progress.js +27 -0
- package/lib/ui/Progress.js.map +1 -0
- package/lib/ui/RadioGroup.js +32 -0
- package/lib/ui/RadioGroup.js.map +1 -0
- package/lib/ui/ScrollArea.js +39 -0
- package/lib/ui/ScrollArea.js.map +1 -0
- package/lib/ui/Select.js +122 -0
- package/lib/ui/Select.js.map +1 -0
- package/lib/ui/Skeleton.js +18 -0
- package/lib/ui/Skeleton.js.map +1 -0
- package/lib/ui/Slider.js +24 -0
- package/lib/ui/Slider.js.map +1 -0
- package/lib/ui/Switch.js +28 -0
- package/lib/ui/Switch.js.map +1 -0
- package/lib/ui/Tabs.js +47 -0
- package/lib/ui/Tabs.js.map +1 -0
- package/lib/ui/Textarea.js +21 -0
- package/lib/ui/Textarea.js.map +1 -0
- package/lib/ui/Toggle.js +38 -0
- package/lib/ui/Toggle.js.map +1 -0
- package/lib/ui/ToggleGroup.js +42 -0
- package/lib/ui/ToggleGroup.js.map +1 -0
- package/lib/ui/Tooltip.js +24 -0
- package/lib/ui/Tooltip.js.map +1 -0
- package/lib/{urql-core-KJnLL26g.js → urql-core-CqTI9H6N.js} +289 -261
- package/lib/urql-core-CqTI9H6N.js.map +1 -0
- package/lib/zudoku.auth-clerk.js +1 -1
- package/lib/zudoku.auth-openid.js +2 -2
- package/lib/zudoku.components.js +889 -2876
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.openapi-worker.js +1 -1
- package/lib/zudoku.plugin-api-keys.js +21 -18
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-custom-pages.js +14 -13
- package/lib/zudoku.plugin-custom-pages.js.map +1 -1
- package/lib/zudoku.plugin-markdown.js +93 -27
- package/lib/zudoku.plugin-markdown.js.map +1 -1
- package/lib/zudoku.plugin-openapi.js +6 -6
- package/package.json +30 -8
- package/src/app/entry.client.tsx +4 -2
- package/src/app/entry.server.tsx +4 -0
- package/src/app/main.css +4 -0
- package/src/app/main.tsx +10 -26
- package/src/app/standalone.tsx +1 -1
- package/src/lib/components/Header.tsx +10 -2
- package/src/lib/components/SyntaxHighlight.tsx +5 -1
- package/src/lib/components/TopNavigation.tsx +58 -24
- package/src/lib/components/context/ZudokuContext.ts +28 -20
- package/src/lib/components/navigation/Sidebar.tsx +5 -5
- package/src/lib/components/navigation/SidebarCategory.tsx +2 -4
- package/src/lib/components/navigation/SidebarItem.tsx +1 -3
- package/src/lib/components/navigation/utils.ts +11 -16
- package/src/lib/core/DevPortalContext.ts +3 -7
- package/src/lib/core/plugins.ts +2 -0
- package/src/lib/plugins/api-keys/CreateApiKey.tsx +2 -2
- package/src/lib/plugins/markdown/index.tsx +49 -12
- package/src/lib/plugins/markdown/resolver.ts +92 -0
- package/src/lib/plugins/openapi/Endpoint.tsx +2 -2
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +1 -1
- package/src/lib/plugins/openapi/Sidecar.tsx +3 -3
- package/src/lib/plugins/openapi/client/worker.ts +2 -2
- package/src/lib/plugins/openapi/index.tsx +1 -1
- package/src/lib/plugins/openapi/playground/Playground.tsx +3 -3
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +1 -1
- package/src/lib/ui/Accordion.tsx +56 -0
- package/src/lib/ui/{Note.tsx → Alert.tsx} +11 -10
- package/src/lib/ui/AlertDialog.tsx +139 -0
- package/src/lib/ui/AspectRatio.tsx +5 -0
- package/src/lib/ui/Badge.tsx +36 -0
- package/src/lib/ui/Breadcrumb.tsx +115 -0
- package/src/lib/ui/Button.tsx +1 -1
- package/src/lib/ui/Carousel.tsx +260 -0
- package/src/lib/ui/Checkbox.tsx +28 -0
- package/src/lib/ui/Collapsible.tsx +9 -0
- package/src/lib/{components → ui}/Dialog.tsx +4 -3
- package/src/lib/ui/Form.tsx +177 -0
- package/src/lib/ui/HoverCard.tsx +27 -0
- package/src/lib/ui/Label.tsx +24 -0
- package/src/lib/ui/Pagination.tsx +117 -0
- package/src/lib/ui/Popover.tsx +29 -0
- package/src/lib/ui/Progress.tsx +26 -0
- package/src/lib/ui/RadioGroup.tsx +42 -0
- package/src/lib/ui/ScrollArea.tsx +46 -0
- package/src/lib/ui/Skeleton.tsx +15 -0
- package/src/lib/ui/Slider.tsx +26 -0
- package/src/lib/ui/Switch.tsx +27 -0
- package/src/lib/ui/Textarea.tsx +23 -0
- package/src/lib/ui/Toggle.tsx +43 -0
- package/src/lib/ui/ToggleGroup.tsx +59 -0
- package/src/lib/ui/Tooltip.tsx +28 -0
- package/src/lib/util/MdxComponents.tsx +0 -1
- package/src/lib/util/useScrollToAnchor.ts +1 -1
- package/dist/internal.d.ts +0 -1
- package/dist/internal.js +0 -2
- package/dist/internal.js.map +0 -1
- package/dist/lib/components/Dialog.js.map +0 -1
- package/dist/lib/components/Select.js.map +0 -1
- package/dist/lib/plugins/markdown/generateRoutes.d.ts +0 -3
- package/dist/lib/plugins/markdown/generateRoutes.js +0 -21
- package/dist/lib/plugins/markdown/generateRoutes.js.map +0 -1
- package/dist/lib/ui/Note.d.ts +0 -8
- package/dist/lib/ui/Note.js +0 -23
- package/dist/lib/ui/Note.js.map +0 -1
- package/lib/Input-CO-1DOZa.js +0 -2229
- package/lib/Input-CO-1DOZa.js.map +0 -1
- package/lib/Markdown-DM4zv3MA.js.map +0 -1
- package/lib/OperationList-Cd3lue0b.js.map +0 -1
- package/lib/Spinner-DFQhPMBl.js +0 -505
- package/lib/Spinner-DFQhPMBl.js.map +0 -1
- package/lib/ZudokuContext-DEoP3GGJ.js.map +0 -1
- package/lib/index-Bs9roz8y.js.map +0 -1
- package/lib/index-CBr6BM_4.js +0 -2867
- package/lib/index-CBr6BM_4.js.map +0 -1
- package/lib/index-UUT9q9f9.js +0 -124
- package/lib/index-UUT9q9f9.js.map +0 -1
- package/lib/joinPath-B7kNnUX4.js +0 -8
- package/lib/joinPath-B7kNnUX4.js.map +0 -1
- package/lib/urql-core-KJnLL26g.js.map +0 -1
- package/lib/utils-G5XSiZc9.js.map +0 -1
- package/src/lib/plugins/markdown/generateRoutes.tsx +0 -38
- /package/dist/lib/{components → ui}/Dialog.d.ts +0 -0
- /package/dist/lib/{components → ui}/Select.d.ts +0 -0
- /package/dist/lib/{components → ui}/Select.js +0 -0
- /package/src/lib/{components → ui}/Select.tsx +0 -0
package/lib/ui/Drawer.js
ADDED
|
@@ -0,0 +1,1153 @@
|
|
|
1
|
+
import { j as X } from "../jsx-runtime-B6kdoens.js";
|
|
2
|
+
import * as wt from "react";
|
|
3
|
+
import r, { useMemo as Se, useLayoutEffect as Re, useEffect as De } from "react";
|
|
4
|
+
import * as Z from "@radix-ui/react-dialog";
|
|
5
|
+
import { c as it } from "../cn-BmFQLtkS.js";
|
|
6
|
+
function Te(t) {
|
|
7
|
+
if (typeof document > "u") return;
|
|
8
|
+
let n = document.head || document.getElementsByTagName("head")[0], e = document.createElement("style");
|
|
9
|
+
e.type = "text/css", n.appendChild(e), e.styleSheet ? e.styleSheet.cssText = t : e.appendChild(document.createTextNode(t));
|
|
10
|
+
}
|
|
11
|
+
const qt = r.createContext({
|
|
12
|
+
drawerRef: {
|
|
13
|
+
current: null
|
|
14
|
+
},
|
|
15
|
+
overlayRef: {
|
|
16
|
+
current: null
|
|
17
|
+
},
|
|
18
|
+
onPress: () => {
|
|
19
|
+
},
|
|
20
|
+
onRelease: () => {
|
|
21
|
+
},
|
|
22
|
+
onDrag: () => {
|
|
23
|
+
},
|
|
24
|
+
onNestedDrag: () => {
|
|
25
|
+
},
|
|
26
|
+
onNestedOpenChange: () => {
|
|
27
|
+
},
|
|
28
|
+
onNestedRelease: () => {
|
|
29
|
+
},
|
|
30
|
+
openProp: void 0,
|
|
31
|
+
dismissible: !1,
|
|
32
|
+
isOpen: !1,
|
|
33
|
+
isDragging: !1,
|
|
34
|
+
keyboardIsOpen: {
|
|
35
|
+
current: !1
|
|
36
|
+
},
|
|
37
|
+
snapPointsOffset: null,
|
|
38
|
+
snapPoints: null,
|
|
39
|
+
handleOnly: !1,
|
|
40
|
+
modal: !1,
|
|
41
|
+
shouldFade: !1,
|
|
42
|
+
activeSnapPoint: null,
|
|
43
|
+
onOpenChange: () => {
|
|
44
|
+
},
|
|
45
|
+
setActiveSnapPoint: () => {
|
|
46
|
+
},
|
|
47
|
+
closeDrawer: () => {
|
|
48
|
+
},
|
|
49
|
+
direction: "bottom",
|
|
50
|
+
shouldAnimate: {
|
|
51
|
+
current: !0
|
|
52
|
+
},
|
|
53
|
+
shouldScaleBackground: !1,
|
|
54
|
+
setBackgroundColorOnScale: !0,
|
|
55
|
+
noBodyStyles: !1,
|
|
56
|
+
container: null,
|
|
57
|
+
autoFocus: !1
|
|
58
|
+
}), st = () => {
|
|
59
|
+
const t = r.useContext(qt);
|
|
60
|
+
if (!t)
|
|
61
|
+
throw new Error("useDrawerContext must be used within a Drawer.Root");
|
|
62
|
+
return t;
|
|
63
|
+
};
|
|
64
|
+
Te(`[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(
|
|
65
|
+
[data-state=closed]
|
|
66
|
+
){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)}}`);
|
|
67
|
+
function Ee() {
|
|
68
|
+
const t = navigator.userAgent;
|
|
69
|
+
return typeof window < "u" && (/Firefox/.test(t) && /Mobile/.test(t) || // Android Firefox
|
|
70
|
+
/FxiOS/.test(t));
|
|
71
|
+
}
|
|
72
|
+
function xe() {
|
|
73
|
+
return Mt(/^Mac/);
|
|
74
|
+
}
|
|
75
|
+
function Oe() {
|
|
76
|
+
return Mt(/^iPhone/);
|
|
77
|
+
}
|
|
78
|
+
function Wt() {
|
|
79
|
+
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
80
|
+
}
|
|
81
|
+
function Ce() {
|
|
82
|
+
return Mt(/^iPad/) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
83
|
+
xe() && navigator.maxTouchPoints > 1;
|
|
84
|
+
}
|
|
85
|
+
function Xt() {
|
|
86
|
+
return Oe() || Ce();
|
|
87
|
+
}
|
|
88
|
+
function Mt(t) {
|
|
89
|
+
return typeof window < "u" && window.navigator != null ? t.test(window.navigator.platform) : void 0;
|
|
90
|
+
}
|
|
91
|
+
const $e = 24, Ae = typeof window < "u" ? Re : De;
|
|
92
|
+
function zt(...t) {
|
|
93
|
+
return (...n) => {
|
|
94
|
+
for (let e of t)
|
|
95
|
+
typeof e == "function" && e(...n);
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
const xt = typeof document < "u" && window.visualViewport;
|
|
99
|
+
function Vt(t) {
|
|
100
|
+
let n = window.getComputedStyle(t);
|
|
101
|
+
return /(auto|scroll)/.test(n.overflow + n.overflowX + n.overflowY);
|
|
102
|
+
}
|
|
103
|
+
function Kt(t) {
|
|
104
|
+
for (Vt(t) && (t = t.parentElement); t && !Vt(t); )
|
|
105
|
+
t = t.parentElement;
|
|
106
|
+
return t || document.scrollingElement || document.documentElement;
|
|
107
|
+
}
|
|
108
|
+
const Ne = /* @__PURE__ */ new Set([
|
|
109
|
+
"checkbox",
|
|
110
|
+
"radio",
|
|
111
|
+
"range",
|
|
112
|
+
"color",
|
|
113
|
+
"file",
|
|
114
|
+
"image",
|
|
115
|
+
"button",
|
|
116
|
+
"submit",
|
|
117
|
+
"reset"
|
|
118
|
+
]);
|
|
119
|
+
let yt = 0, Ot;
|
|
120
|
+
function Me(t = {}) {
|
|
121
|
+
let { isDisabled: n } = t;
|
|
122
|
+
Ae(() => {
|
|
123
|
+
if (!n)
|
|
124
|
+
return yt++, yt === 1 && Xt() && (Ot = Pe()), () => {
|
|
125
|
+
yt--, yt === 0 && (Ot == null || Ot());
|
|
126
|
+
};
|
|
127
|
+
}, [
|
|
128
|
+
n
|
|
129
|
+
]);
|
|
130
|
+
}
|
|
131
|
+
function Pe() {
|
|
132
|
+
let t, n = 0, e = (p) => {
|
|
133
|
+
t = Kt(p.target), !(t === document.documentElement && t === document.body) && (n = p.changedTouches[0].pageY);
|
|
134
|
+
}, a = (p) => {
|
|
135
|
+
if (!t || t === document.documentElement || t === document.body) {
|
|
136
|
+
p.preventDefault();
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
let w = p.changedTouches[0].pageY, B = t.scrollTop, k = t.scrollHeight - t.clientHeight;
|
|
140
|
+
k !== 0 && ((B <= 0 && w > n || B >= k && w < n) && p.preventDefault(), n = w);
|
|
141
|
+
}, i = (p) => {
|
|
142
|
+
let w = p.target;
|
|
143
|
+
At(w) && w !== document.activeElement && (p.preventDefault(), w.style.transform = "translateY(-2000px)", w.focus(), requestAnimationFrame(() => {
|
|
144
|
+
w.style.transform = "";
|
|
145
|
+
}));
|
|
146
|
+
}, o = (p) => {
|
|
147
|
+
let w = p.target;
|
|
148
|
+
At(w) && (w.style.transform = "translateY(-2000px)", requestAnimationFrame(() => {
|
|
149
|
+
w.style.transform = "", xt && (xt.height < window.innerHeight ? requestAnimationFrame(() => {
|
|
150
|
+
Yt(w);
|
|
151
|
+
}) : xt.addEventListener("resize", () => Yt(w), {
|
|
152
|
+
once: !0
|
|
153
|
+
}));
|
|
154
|
+
}));
|
|
155
|
+
}, f = () => {
|
|
156
|
+
window.scrollTo(0, 0);
|
|
157
|
+
}, m = window.pageXOffset, R = window.pageYOffset, T = zt(Ie(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`));
|
|
158
|
+
window.scrollTo(0, 0);
|
|
159
|
+
let g = zt(mt(document, "touchstart", e, {
|
|
160
|
+
passive: !1,
|
|
161
|
+
capture: !0
|
|
162
|
+
}), mt(document, "touchmove", a, {
|
|
163
|
+
passive: !1,
|
|
164
|
+
capture: !0
|
|
165
|
+
}), mt(document, "touchend", i, {
|
|
166
|
+
passive: !1,
|
|
167
|
+
capture: !0
|
|
168
|
+
}), mt(document, "focus", o, !0), mt(window, "scroll", f));
|
|
169
|
+
return () => {
|
|
170
|
+
T(), g(), window.scrollTo(m, R);
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function Ie(t, n, e) {
|
|
174
|
+
let a = t.style[n];
|
|
175
|
+
return t.style[n] = e, () => {
|
|
176
|
+
t.style[n] = a;
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function mt(t, n, e, a) {
|
|
180
|
+
return t.addEventListener(n, e, a), () => {
|
|
181
|
+
t.removeEventListener(n, e, a);
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function Yt(t) {
|
|
185
|
+
let n = document.scrollingElement || document.documentElement;
|
|
186
|
+
for (; t && t !== n; ) {
|
|
187
|
+
let e = Kt(t);
|
|
188
|
+
if (e !== document.documentElement && e !== document.body && e !== t) {
|
|
189
|
+
let a = e.getBoundingClientRect().top, i = t.getBoundingClientRect().top, o = t.getBoundingClientRect().bottom;
|
|
190
|
+
const f = e.getBoundingClientRect().bottom + $e;
|
|
191
|
+
o > f && (e.scrollTop += i - a);
|
|
192
|
+
}
|
|
193
|
+
t = e.parentElement;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function At(t) {
|
|
197
|
+
return t instanceof HTMLInputElement && !Ne.has(t.type) || t instanceof HTMLTextAreaElement || t instanceof HTMLElement && t.isContentEditable;
|
|
198
|
+
}
|
|
199
|
+
function _e(t, n) {
|
|
200
|
+
typeof t == "function" ? t(n) : t != null && (t.current = n);
|
|
201
|
+
}
|
|
202
|
+
function He(...t) {
|
|
203
|
+
return (n) => t.forEach((e) => _e(e, n));
|
|
204
|
+
}
|
|
205
|
+
function Gt(...t) {
|
|
206
|
+
return wt.useCallback(He(...t), t);
|
|
207
|
+
}
|
|
208
|
+
const Jt = /* @__PURE__ */ new WeakMap();
|
|
209
|
+
function C(t, n, e = !1) {
|
|
210
|
+
if (!t || !(t instanceof HTMLElement)) return;
|
|
211
|
+
let a = {};
|
|
212
|
+
Object.entries(n).forEach(([i, o]) => {
|
|
213
|
+
if (i.startsWith("--")) {
|
|
214
|
+
t.style.setProperty(i, o);
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
a[i] = t.style[i], t.style[i] = o;
|
|
218
|
+
}), !e && Jt.set(t, a);
|
|
219
|
+
}
|
|
220
|
+
function ke(t, n) {
|
|
221
|
+
if (!t || !(t instanceof HTMLElement)) return;
|
|
222
|
+
let e = Jt.get(t);
|
|
223
|
+
e && (t.style[n] = e[n]);
|
|
224
|
+
}
|
|
225
|
+
const $ = (t) => {
|
|
226
|
+
switch (t) {
|
|
227
|
+
case "top":
|
|
228
|
+
case "bottom":
|
|
229
|
+
return !0;
|
|
230
|
+
case "left":
|
|
231
|
+
case "right":
|
|
232
|
+
return !1;
|
|
233
|
+
default:
|
|
234
|
+
return t;
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
function bt(t, n) {
|
|
238
|
+
if (!t)
|
|
239
|
+
return null;
|
|
240
|
+
const e = window.getComputedStyle(t), a = (
|
|
241
|
+
// @ts-ignore
|
|
242
|
+
e.transform || e.webkitTransform || e.mozTransform
|
|
243
|
+
);
|
|
244
|
+
let i = a.match(/^matrix3d\((.+)\)$/);
|
|
245
|
+
return i ? parseFloat(i[1].split(", ")[$(n) ? 13 : 12]) : (i = a.match(/^matrix\((.+)\)$/), i ? parseFloat(i[1].split(", ")[$(n) ? 5 : 4]) : null);
|
|
246
|
+
}
|
|
247
|
+
function Le(t) {
|
|
248
|
+
return 8 * (Math.log(t + 1) - 2);
|
|
249
|
+
}
|
|
250
|
+
function Ct(t, n) {
|
|
251
|
+
if (!t) return () => {
|
|
252
|
+
};
|
|
253
|
+
const e = t.style.cssText;
|
|
254
|
+
return Object.assign(t.style, n), () => {
|
|
255
|
+
t.style.cssText = e;
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
function Be(...t) {
|
|
259
|
+
return (...n) => {
|
|
260
|
+
for (const e of t)
|
|
261
|
+
typeof e == "function" && e(...n);
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
const x = {
|
|
265
|
+
DURATION: 0.5,
|
|
266
|
+
EASE: [
|
|
267
|
+
0.32,
|
|
268
|
+
0.72,
|
|
269
|
+
0,
|
|
270
|
+
1
|
|
271
|
+
]
|
|
272
|
+
}, Qt = 0.4, Fe = 0.25, Ue = 100, Zt = 8, nt = 16, Nt = 26, $t = "vaul-dragging";
|
|
273
|
+
function te(t) {
|
|
274
|
+
const n = r.useRef(t);
|
|
275
|
+
return r.useEffect(() => {
|
|
276
|
+
n.current = t;
|
|
277
|
+
}), r.useMemo(() => (...e) => n.current == null ? void 0 : n.current.call(n, ...e), []);
|
|
278
|
+
}
|
|
279
|
+
function je({ defaultProp: t, onChange: n }) {
|
|
280
|
+
const e = r.useState(t), [a] = e, i = r.useRef(a), o = te(n);
|
|
281
|
+
return r.useEffect(() => {
|
|
282
|
+
i.current !== a && (o(a), i.current = a);
|
|
283
|
+
}, [
|
|
284
|
+
a,
|
|
285
|
+
i,
|
|
286
|
+
o
|
|
287
|
+
]), e;
|
|
288
|
+
}
|
|
289
|
+
function ee({ prop: t, defaultProp: n, onChange: e = () => {
|
|
290
|
+
} }) {
|
|
291
|
+
const [a, i] = je({
|
|
292
|
+
defaultProp: n,
|
|
293
|
+
onChange: e
|
|
294
|
+
}), o = t !== void 0, f = o ? t : a, m = te(e), R = r.useCallback((T) => {
|
|
295
|
+
if (o) {
|
|
296
|
+
const p = typeof T == "function" ? T(t) : T;
|
|
297
|
+
p !== t && m(p);
|
|
298
|
+
} else
|
|
299
|
+
i(T);
|
|
300
|
+
}, [
|
|
301
|
+
o,
|
|
302
|
+
t,
|
|
303
|
+
i,
|
|
304
|
+
m
|
|
305
|
+
]);
|
|
306
|
+
return [
|
|
307
|
+
f,
|
|
308
|
+
R
|
|
309
|
+
];
|
|
310
|
+
}
|
|
311
|
+
function We({ activeSnapPointProp: t, setActiveSnapPointProp: n, snapPoints: e, drawerRef: a, overlayRef: i, fadeFromIndex: o, onSnapPointChange: f, direction: m = "bottom", container: R, snapToSequentialPoint: T }) {
|
|
312
|
+
const [g, p] = ee({
|
|
313
|
+
prop: t,
|
|
314
|
+
defaultProp: e == null ? void 0 : e[0],
|
|
315
|
+
onChange: n
|
|
316
|
+
}), [w, B] = r.useState(typeof window < "u" ? {
|
|
317
|
+
innerWidth: window.innerWidth,
|
|
318
|
+
innerHeight: window.innerHeight
|
|
319
|
+
} : void 0);
|
|
320
|
+
r.useEffect(() => {
|
|
321
|
+
function u() {
|
|
322
|
+
B({
|
|
323
|
+
innerWidth: window.innerWidth,
|
|
324
|
+
innerHeight: window.innerHeight
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
return window.addEventListener("resize", u), () => window.removeEventListener("resize", u);
|
|
328
|
+
}, []);
|
|
329
|
+
const k = r.useMemo(() => g === (e == null ? void 0 : e[e.length - 1]) || null, [
|
|
330
|
+
e,
|
|
331
|
+
g
|
|
332
|
+
]), E = r.useMemo(() => {
|
|
333
|
+
var u;
|
|
334
|
+
return (u = e == null ? void 0 : e.findIndex((b) => b === g)) != null ? u : null;
|
|
335
|
+
}, [
|
|
336
|
+
e,
|
|
337
|
+
g
|
|
338
|
+
]), F = e && e.length > 0 && (o || o === 0) && !Number.isNaN(o) && e[o] === g || !e, h = r.useMemo(() => {
|
|
339
|
+
const u = R ? {
|
|
340
|
+
width: R.getBoundingClientRect().width,
|
|
341
|
+
height: R.getBoundingClientRect().height
|
|
342
|
+
} : typeof window < "u" ? {
|
|
343
|
+
width: window.innerWidth,
|
|
344
|
+
height: window.innerHeight
|
|
345
|
+
} : {
|
|
346
|
+
width: 0,
|
|
347
|
+
height: 0
|
|
348
|
+
};
|
|
349
|
+
var b;
|
|
350
|
+
return (b = e == null ? void 0 : e.map((y) => {
|
|
351
|
+
const I = typeof y == "string";
|
|
352
|
+
let M = 0;
|
|
353
|
+
if (I && (M = parseInt(y, 10)), $(m)) {
|
|
354
|
+
const l = I ? M : w ? y * u.height : 0;
|
|
355
|
+
return w ? m === "bottom" ? u.height - l : -u.height + l : l;
|
|
356
|
+
}
|
|
357
|
+
const j = I ? M : w ? y * u.width : 0;
|
|
358
|
+
return w ? m === "right" ? u.width - j : -u.width + j : j;
|
|
359
|
+
})) != null ? b : [];
|
|
360
|
+
}, [
|
|
361
|
+
e,
|
|
362
|
+
w,
|
|
363
|
+
R
|
|
364
|
+
]), N = r.useMemo(() => E !== null ? h == null ? void 0 : h[E] : null, [
|
|
365
|
+
h,
|
|
366
|
+
E
|
|
367
|
+
]), A = r.useCallback((u) => {
|
|
368
|
+
var b;
|
|
369
|
+
const y = (b = h == null ? void 0 : h.findIndex((I) => I === u)) != null ? b : null;
|
|
370
|
+
f(y), C(a.current, {
|
|
371
|
+
transition: `transform ${x.DURATION}s cubic-bezier(${x.EASE.join(",")})`,
|
|
372
|
+
transform: $(m) ? `translate3d(0, ${u}px, 0)` : `translate3d(${u}px, 0, 0)`
|
|
373
|
+
}), h && y !== h.length - 1 && o !== void 0 && y !== o && y < o ? C(i.current, {
|
|
374
|
+
transition: `opacity ${x.DURATION}s cubic-bezier(${x.EASE.join(",")})`,
|
|
375
|
+
opacity: "0"
|
|
376
|
+
}) : C(i.current, {
|
|
377
|
+
transition: `opacity ${x.DURATION}s cubic-bezier(${x.EASE.join(",")})`,
|
|
378
|
+
opacity: "1"
|
|
379
|
+
}), p(e == null ? void 0 : e[Math.max(y, 0)]);
|
|
380
|
+
}, [
|
|
381
|
+
a.current,
|
|
382
|
+
e,
|
|
383
|
+
h,
|
|
384
|
+
o,
|
|
385
|
+
i,
|
|
386
|
+
p
|
|
387
|
+
]);
|
|
388
|
+
r.useEffect(() => {
|
|
389
|
+
if (g || t) {
|
|
390
|
+
var u;
|
|
391
|
+
const b = (u = e == null ? void 0 : e.findIndex((y) => y === t || y === g)) != null ? u : -1;
|
|
392
|
+
h && b !== -1 && typeof h[b] == "number" && A(h[b]);
|
|
393
|
+
}
|
|
394
|
+
}, [
|
|
395
|
+
g,
|
|
396
|
+
t,
|
|
397
|
+
e,
|
|
398
|
+
h,
|
|
399
|
+
A
|
|
400
|
+
]);
|
|
401
|
+
function d({ draggedDistance: u, closeDrawer: b, velocity: y, dismissible: I }) {
|
|
402
|
+
if (o === void 0) return;
|
|
403
|
+
const M = m === "bottom" || m === "right" ? (N ?? 0) - u : (N ?? 0) + u, j = E === o - 1, l = E === 0, U = u > 0;
|
|
404
|
+
if (j && C(i.current, {
|
|
405
|
+
transition: `opacity ${x.DURATION}s cubic-bezier(${x.EASE.join(",")})`
|
|
406
|
+
}), !T && y > 2 && !U) {
|
|
407
|
+
I ? b() : A(h[0]);
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
if (!T && y > 2 && U && h && e) {
|
|
411
|
+
A(h[e.length - 1]);
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
const _ = h == null ? void 0 : h.reduce((P, K) => typeof P != "number" || typeof K != "number" ? P : Math.abs(K - M) < Math.abs(P - M) ? K : P), W = $(m) ? window.innerHeight : window.innerWidth;
|
|
415
|
+
if (y > Qt && Math.abs(u) < W * 0.4) {
|
|
416
|
+
const P = U ? 1 : -1;
|
|
417
|
+
if (P > 0 && k && e) {
|
|
418
|
+
A(h[e.length - 1]);
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
if (l && P < 0 && I && b(), E === null) return;
|
|
422
|
+
A(h[E + P]);
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
A(_);
|
|
426
|
+
}
|
|
427
|
+
function Y({ draggedDistance: u }) {
|
|
428
|
+
if (N === null) return;
|
|
429
|
+
const b = m === "bottom" || m === "right" ? N - u : N + u;
|
|
430
|
+
(m === "bottom" || m === "right") && b < h[h.length - 1] || (m === "top" || m === "left") && b > h[h.length - 1] || C(a.current, {
|
|
431
|
+
transform: $(m) ? `translate3d(0, ${b}px, 0)` : `translate3d(${b}px, 0, 0)`
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
function tt(u, b) {
|
|
435
|
+
if (!e || typeof E != "number" || !h || o === void 0) return null;
|
|
436
|
+
const y = E === o - 1;
|
|
437
|
+
if (E >= o && b)
|
|
438
|
+
return 0;
|
|
439
|
+
if (y && !b) return 1;
|
|
440
|
+
if (!F && !y) return null;
|
|
441
|
+
const M = y ? E + 1 : E - 1, j = y ? h[M] - h[M - 1] : h[M + 1] - h[M], l = u / Math.abs(j);
|
|
442
|
+
return y ? 1 - l : l;
|
|
443
|
+
}
|
|
444
|
+
return {
|
|
445
|
+
isLastSnapPoint: k,
|
|
446
|
+
activeSnapPoint: g,
|
|
447
|
+
shouldFade: F,
|
|
448
|
+
getPercentageDragged: tt,
|
|
449
|
+
setActiveSnapPoint: p,
|
|
450
|
+
activeSnapPointIndex: E,
|
|
451
|
+
onRelease: d,
|
|
452
|
+
onDrag: Y,
|
|
453
|
+
snapPointsOffset: h
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
const ze = () => () => {
|
|
457
|
+
};
|
|
458
|
+
function Ve() {
|
|
459
|
+
const { direction: t, isOpen: n, shouldScaleBackground: e, setBackgroundColorOnScale: a, noBodyStyles: i } = st(), o = r.useRef(null), f = Se(() => document.body.style.backgroundColor, []);
|
|
460
|
+
function m() {
|
|
461
|
+
return (window.innerWidth - Nt) / window.innerWidth;
|
|
462
|
+
}
|
|
463
|
+
r.useEffect(() => {
|
|
464
|
+
if (n && e) {
|
|
465
|
+
o.current && clearTimeout(o.current);
|
|
466
|
+
const R = document.querySelector("[data-vaul-drawer-wrapper]") || document.querySelector("[vaul-drawer-wrapper]");
|
|
467
|
+
if (!R) return;
|
|
468
|
+
Be(a && !i ? Ct(document.body, {
|
|
469
|
+
background: "black"
|
|
470
|
+
}) : ze, Ct(R, {
|
|
471
|
+
transformOrigin: $(t) ? "top" : "left",
|
|
472
|
+
transitionProperty: "transform, border-radius",
|
|
473
|
+
transitionDuration: `${x.DURATION}s`,
|
|
474
|
+
transitionTimingFunction: `cubic-bezier(${x.EASE.join(",")})`
|
|
475
|
+
}));
|
|
476
|
+
const T = Ct(R, {
|
|
477
|
+
borderRadius: `${Zt}px`,
|
|
478
|
+
overflow: "hidden",
|
|
479
|
+
...$(t) ? {
|
|
480
|
+
transform: `scale(${m()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`
|
|
481
|
+
} : {
|
|
482
|
+
transform: `scale(${m()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
return () => {
|
|
486
|
+
T(), o.current = window.setTimeout(() => {
|
|
487
|
+
f ? document.body.style.background = f : document.body.style.removeProperty("background");
|
|
488
|
+
}, x.DURATION * 1e3);
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
}, [
|
|
492
|
+
n,
|
|
493
|
+
e,
|
|
494
|
+
f
|
|
495
|
+
]);
|
|
496
|
+
}
|
|
497
|
+
let pt = null;
|
|
498
|
+
function Ye({ isOpen: t, modal: n, nested: e, hasBeenOpened: a, preventScrollRestoration: i, noBodyStyles: o }) {
|
|
499
|
+
const [f, m] = r.useState(() => typeof window < "u" ? window.location.href : ""), R = r.useRef(0), T = r.useCallback(() => {
|
|
500
|
+
if (Wt() && pt === null && t && !o) {
|
|
501
|
+
pt = {
|
|
502
|
+
position: document.body.style.position,
|
|
503
|
+
top: document.body.style.top,
|
|
504
|
+
left: document.body.style.left,
|
|
505
|
+
height: document.body.style.height,
|
|
506
|
+
right: "unset"
|
|
507
|
+
};
|
|
508
|
+
const { scrollX: p, innerHeight: w } = window;
|
|
509
|
+
document.body.style.setProperty("position", "fixed", "important"), Object.assign(document.body.style, {
|
|
510
|
+
top: `${-R.current}px`,
|
|
511
|
+
left: `${-p}px`,
|
|
512
|
+
right: "0px",
|
|
513
|
+
height: "auto"
|
|
514
|
+
}), window.setTimeout(() => window.requestAnimationFrame(() => {
|
|
515
|
+
const B = w - window.innerHeight;
|
|
516
|
+
B && R.current >= w && (document.body.style.top = `${-(R.current + B)}px`);
|
|
517
|
+
}), 300);
|
|
518
|
+
}
|
|
519
|
+
}, [
|
|
520
|
+
t
|
|
521
|
+
]), g = r.useCallback(() => {
|
|
522
|
+
if (Wt() && pt !== null && !o) {
|
|
523
|
+
const p = -parseInt(document.body.style.top, 10), w = -parseInt(document.body.style.left, 10);
|
|
524
|
+
Object.assign(document.body.style, pt), window.requestAnimationFrame(() => {
|
|
525
|
+
if (i && f !== window.location.href) {
|
|
526
|
+
m(window.location.href);
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
window.scrollTo(w, p);
|
|
530
|
+
}), pt = null;
|
|
531
|
+
}
|
|
532
|
+
}, [
|
|
533
|
+
f
|
|
534
|
+
]);
|
|
535
|
+
return r.useEffect(() => {
|
|
536
|
+
function p() {
|
|
537
|
+
R.current = window.scrollY;
|
|
538
|
+
}
|
|
539
|
+
return p(), window.addEventListener("scroll", p), () => {
|
|
540
|
+
window.removeEventListener("scroll", p);
|
|
541
|
+
};
|
|
542
|
+
}, []), r.useEffect(() => {
|
|
543
|
+
if (n)
|
|
544
|
+
return () => {
|
|
545
|
+
typeof document > "u" || document.querySelector("[data-vaul-drawer]") || g();
|
|
546
|
+
};
|
|
547
|
+
}, [
|
|
548
|
+
n,
|
|
549
|
+
g
|
|
550
|
+
]), r.useEffect(() => {
|
|
551
|
+
e || !a || (t ? (!window.matchMedia("(display-mode: standalone)").matches && T(), n || window.setTimeout(() => {
|
|
552
|
+
g();
|
|
553
|
+
}, 500)) : g());
|
|
554
|
+
}, [
|
|
555
|
+
t,
|
|
556
|
+
a,
|
|
557
|
+
f,
|
|
558
|
+
n,
|
|
559
|
+
e,
|
|
560
|
+
T,
|
|
561
|
+
g
|
|
562
|
+
]), {
|
|
563
|
+
restorePositionSetting: g
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
function ne({ open: t, onOpenChange: n, children: e, onDrag: a, onRelease: i, snapPoints: o, shouldScaleBackground: f = !1, setBackgroundColorOnScale: m = !0, closeThreshold: R = Fe, scrollLockTimeout: T = Ue, dismissible: g = !0, handleOnly: p = !1, fadeFromIndex: w = o && o.length - 1, activeSnapPoint: B, setActiveSnapPoint: k, fixed: E, modal: F = !0, onClose: h, nested: N, noBodyStyles: A = !1, direction: d = "bottom", defaultOpen: Y = !1, disablePreventScroll: tt = !0, snapToSequentialPoint: u = !1, preventScrollRestoration: b = !1, repositionInputs: y = !0, onAnimationEnd: I, container: M, autoFocus: j = !1 }) {
|
|
567
|
+
var l, U;
|
|
568
|
+
const [_ = !1, W] = ee({
|
|
569
|
+
defaultProp: Y,
|
|
570
|
+
prop: t,
|
|
571
|
+
onChange: (s) => {
|
|
572
|
+
n == null || n(s), !s && !N && me(), setTimeout(() => {
|
|
573
|
+
I == null || I(s);
|
|
574
|
+
}, x.DURATION * 1e3), s && !F && typeof window < "u" && window.requestAnimationFrame(() => {
|
|
575
|
+
document.body.style.pointerEvents = "auto";
|
|
576
|
+
}), s || (document.body.style.pointerEvents = "auto");
|
|
577
|
+
}
|
|
578
|
+
}), [P, K] = r.useState(!1), [G, lt] = r.useState(!1), [se, Pt] = r.useState(!1), rt = r.useRef(null), ht = r.useRef(null), St = r.useRef(null), Rt = r.useRef(null), ut = r.useRef(null), ct = r.useRef(!1), Dt = r.useRef(null), Tt = r.useRef(0), at = r.useRef(!1), It = r.useRef(!Y), _t = r.useRef(0), c = r.useRef(null), Ht = r.useRef(((l = c.current) == null ? void 0 : l.getBoundingClientRect().height) || 0), kt = r.useRef(((U = c.current) == null ? void 0 : U.getBoundingClientRect().width) || 0), Et = r.useRef(0), le = r.useCallback((s) => {
|
|
579
|
+
o && s === dt.length - 1 && (ht.current = /* @__PURE__ */ new Date());
|
|
580
|
+
}, []), { activeSnapPoint: ue, activeSnapPointIndex: ot, setActiveSnapPoint: Lt, onRelease: ce, snapPointsOffset: dt, onDrag: de, shouldFade: Bt, getPercentageDragged: fe } = We({
|
|
581
|
+
snapPoints: o,
|
|
582
|
+
activeSnapPointProp: B,
|
|
583
|
+
setActiveSnapPointProp: k,
|
|
584
|
+
drawerRef: c,
|
|
585
|
+
fadeFromIndex: w,
|
|
586
|
+
overlayRef: rt,
|
|
587
|
+
onSnapPointChange: le,
|
|
588
|
+
direction: d,
|
|
589
|
+
container: M,
|
|
590
|
+
snapToSequentialPoint: u
|
|
591
|
+
});
|
|
592
|
+
Me({
|
|
593
|
+
isDisabled: !_ || G || !F || se || !P || !y || !tt
|
|
594
|
+
});
|
|
595
|
+
const { restorePositionSetting: me } = Ye({
|
|
596
|
+
isOpen: _,
|
|
597
|
+
modal: F,
|
|
598
|
+
nested: N ?? !1,
|
|
599
|
+
hasBeenOpened: P,
|
|
600
|
+
preventScrollRestoration: b,
|
|
601
|
+
noBodyStyles: A
|
|
602
|
+
});
|
|
603
|
+
function gt() {
|
|
604
|
+
return (window.innerWidth - Nt) / window.innerWidth;
|
|
605
|
+
}
|
|
606
|
+
function pe(s) {
|
|
607
|
+
var S, D;
|
|
608
|
+
!g && !o || c.current && !c.current.contains(s.target) || (Ht.current = ((S = c.current) == null ? void 0 : S.getBoundingClientRect().height) || 0, kt.current = ((D = c.current) == null ? void 0 : D.getBoundingClientRect().width) || 0, lt(!0), St.current = /* @__PURE__ */ new Date(), Xt() && window.addEventListener("touchend", () => ct.current = !1, {
|
|
609
|
+
once: !0
|
|
610
|
+
}), s.target.setPointerCapture(s.pointerId), Tt.current = $(d) ? s.pageY : s.pageX);
|
|
611
|
+
}
|
|
612
|
+
function Ft(s, S) {
|
|
613
|
+
var D;
|
|
614
|
+
let v = s;
|
|
615
|
+
const O = (D = window.getSelection()) == null ? void 0 : D.toString(), L = c.current ? bt(c.current, d) : null, H = /* @__PURE__ */ new Date();
|
|
616
|
+
if (v.tagName === "SELECT" || v.hasAttribute("data-vaul-no-drag") || v.closest("[data-vaul-no-drag]"))
|
|
617
|
+
return !1;
|
|
618
|
+
if (d === "right" || d === "left")
|
|
619
|
+
return !0;
|
|
620
|
+
if (ht.current && H.getTime() - ht.current.getTime() < 500)
|
|
621
|
+
return !1;
|
|
622
|
+
if (L !== null && (d === "bottom" ? L > 0 : L < 0))
|
|
623
|
+
return !0;
|
|
624
|
+
if (O && O.length > 0)
|
|
625
|
+
return !1;
|
|
626
|
+
if (ut.current && H.getTime() - ut.current.getTime() < T && L === 0 || S)
|
|
627
|
+
return ut.current = H, !1;
|
|
628
|
+
for (; v; ) {
|
|
629
|
+
if (v.scrollHeight > v.clientHeight) {
|
|
630
|
+
if (v.scrollTop !== 0)
|
|
631
|
+
return ut.current = /* @__PURE__ */ new Date(), !1;
|
|
632
|
+
if (v.getAttribute("role") === "dialog")
|
|
633
|
+
return !0;
|
|
634
|
+
}
|
|
635
|
+
v = v.parentNode;
|
|
636
|
+
}
|
|
637
|
+
return !0;
|
|
638
|
+
}
|
|
639
|
+
function we(s) {
|
|
640
|
+
if (c.current && G) {
|
|
641
|
+
const S = d === "bottom" || d === "right" ? 1 : -1, D = (Tt.current - ($(d) ? s.pageY : s.pageX)) * S, v = D > 0, O = o && !g && !v;
|
|
642
|
+
if (O && ot === 0) return;
|
|
643
|
+
const L = Math.abs(D), H = document.querySelector("[data-vaul-drawer-wrapper]"), J = d === "bottom" || d === "top" ? Ht.current : kt.current;
|
|
644
|
+
let z = L / J;
|
|
645
|
+
const et = fe(L, v);
|
|
646
|
+
if (et !== null && (z = et), O && z >= 1 || !ct.current && !Ft(s.target, v)) return;
|
|
647
|
+
if (c.current.classList.add($t), ct.current = !0, C(c.current, {
|
|
648
|
+
transition: "none"
|
|
649
|
+
}), C(rt.current, {
|
|
650
|
+
transition: "none"
|
|
651
|
+
}), o && de({
|
|
652
|
+
draggedDistance: D
|
|
653
|
+
}), v && !o) {
|
|
654
|
+
const q = Le(D), vt = Math.min(q * -1, 0) * S;
|
|
655
|
+
C(c.current, {
|
|
656
|
+
transform: $(d) ? `translate3d(0, ${vt}px, 0)` : `translate3d(${vt}px, 0, 0)`
|
|
657
|
+
});
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
const Q = 1 - z;
|
|
661
|
+
if ((Bt || w && ot === w - 1) && (a == null || a(s, z), C(rt.current, {
|
|
662
|
+
opacity: `${Q}`,
|
|
663
|
+
transition: "none"
|
|
664
|
+
}, !0)), H && rt.current && f) {
|
|
665
|
+
const q = Math.min(gt() + z * (1 - gt()), 1), vt = 8 - z * 8, jt = Math.max(0, 14 - z * 14);
|
|
666
|
+
C(H, {
|
|
667
|
+
borderRadius: `${vt}px`,
|
|
668
|
+
transform: $(d) ? `scale(${q}) translate3d(0, ${jt}px, 0)` : `scale(${q}) translate3d(${jt}px, 0, 0)`,
|
|
669
|
+
transition: "none"
|
|
670
|
+
}, !0);
|
|
671
|
+
}
|
|
672
|
+
if (!o) {
|
|
673
|
+
const q = L * S;
|
|
674
|
+
C(c.current, {
|
|
675
|
+
transform: $(d) ? `translate3d(0, ${q}px, 0)` : `translate3d(${q}px, 0, 0)`
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
r.useEffect(() => {
|
|
681
|
+
window.requestAnimationFrame(() => {
|
|
682
|
+
It.current = !0;
|
|
683
|
+
});
|
|
684
|
+
}, []), r.useEffect(() => {
|
|
685
|
+
var s;
|
|
686
|
+
function S() {
|
|
687
|
+
if (!c.current || !y) return;
|
|
688
|
+
const D = document.activeElement;
|
|
689
|
+
if (At(D) || at.current) {
|
|
690
|
+
var v;
|
|
691
|
+
const O = ((v = window.visualViewport) == null ? void 0 : v.height) || 0, L = window.innerHeight;
|
|
692
|
+
let H = L - O;
|
|
693
|
+
const J = c.current.getBoundingClientRect().height || 0, z = J > L * 0.8;
|
|
694
|
+
Et.current || (Et.current = J);
|
|
695
|
+
const et = c.current.getBoundingClientRect().top;
|
|
696
|
+
if (Math.abs(_t.current - H) > 60 && (at.current = !at.current), o && o.length > 0 && dt && ot) {
|
|
697
|
+
const Q = dt[ot] || 0;
|
|
698
|
+
H += Q;
|
|
699
|
+
}
|
|
700
|
+
if (_t.current = H, J > O || at.current) {
|
|
701
|
+
const Q = c.current.getBoundingClientRect().height;
|
|
702
|
+
let q = Q;
|
|
703
|
+
Q > O && (q = O - (z ? et : Nt)), E ? c.current.style.height = `${Q - Math.max(H, 0)}px` : c.current.style.height = `${Math.max(q, O - et)}px`;
|
|
704
|
+
} else Ee() || (c.current.style.height = `${Et.current}px`);
|
|
705
|
+
o && o.length > 0 && !at.current ? c.current.style.bottom = "0px" : c.current.style.bottom = `${Math.max(H, 0)}px`;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
return (s = window.visualViewport) == null || s.addEventListener("resize", S), () => {
|
|
709
|
+
var D;
|
|
710
|
+
return (D = window.visualViewport) == null ? void 0 : D.removeEventListener("resize", S);
|
|
711
|
+
};
|
|
712
|
+
}, [
|
|
713
|
+
ot,
|
|
714
|
+
o,
|
|
715
|
+
dt
|
|
716
|
+
]);
|
|
717
|
+
function ft(s) {
|
|
718
|
+
he(), h == null || h(), s || W(!1), setTimeout(() => {
|
|
719
|
+
o && Lt(o[0]);
|
|
720
|
+
}, x.DURATION * 1e3);
|
|
721
|
+
}
|
|
722
|
+
function Ut() {
|
|
723
|
+
if (!c.current) return;
|
|
724
|
+
const s = document.querySelector("[data-vaul-drawer-wrapper]"), S = bt(c.current, d);
|
|
725
|
+
C(c.current, {
|
|
726
|
+
transform: "translate3d(0, 0, 0)",
|
|
727
|
+
transition: `transform ${x.DURATION}s cubic-bezier(${x.EASE.join(",")})`
|
|
728
|
+
}), C(rt.current, {
|
|
729
|
+
transition: `opacity ${x.DURATION}s cubic-bezier(${x.EASE.join(",")})`,
|
|
730
|
+
opacity: "1"
|
|
731
|
+
}), f && S && S > 0 && _ && C(s, {
|
|
732
|
+
borderRadius: `${Zt}px`,
|
|
733
|
+
overflow: "hidden",
|
|
734
|
+
...$(d) ? {
|
|
735
|
+
transform: `scale(${gt()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,
|
|
736
|
+
transformOrigin: "top"
|
|
737
|
+
} : {
|
|
738
|
+
transform: `scale(${gt()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,
|
|
739
|
+
transformOrigin: "left"
|
|
740
|
+
},
|
|
741
|
+
transitionProperty: "transform, border-radius",
|
|
742
|
+
transitionDuration: `${x.DURATION}s`,
|
|
743
|
+
transitionTimingFunction: `cubic-bezier(${x.EASE.join(",")})`
|
|
744
|
+
}, !0);
|
|
745
|
+
}
|
|
746
|
+
function he() {
|
|
747
|
+
!G || !c.current || (c.current.classList.remove($t), ct.current = !1, lt(!1), Rt.current = /* @__PURE__ */ new Date());
|
|
748
|
+
}
|
|
749
|
+
function ge(s) {
|
|
750
|
+
if (!G || !c.current) return;
|
|
751
|
+
c.current.classList.remove($t), ct.current = !1, lt(!1), Rt.current = /* @__PURE__ */ new Date();
|
|
752
|
+
const S = bt(c.current, d);
|
|
753
|
+
if (!s || !Ft(s.target, !1) || !S || Number.isNaN(S) || St.current === null) return;
|
|
754
|
+
const D = Rt.current.getTime() - St.current.getTime(), v = Tt.current - ($(d) ? s.pageY : s.pageX), O = Math.abs(v) / D;
|
|
755
|
+
if (O > 0.05 && (Pt(!0), setTimeout(() => {
|
|
756
|
+
Pt(!1);
|
|
757
|
+
}, 200)), o) {
|
|
758
|
+
ce({
|
|
759
|
+
draggedDistance: v * (d === "bottom" || d === "right" ? 1 : -1),
|
|
760
|
+
closeDrawer: ft,
|
|
761
|
+
velocity: O,
|
|
762
|
+
dismissible: g
|
|
763
|
+
}), i == null || i(s, !0);
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
if (d === "bottom" || d === "right" ? v > 0 : v < 0) {
|
|
767
|
+
Ut(), i == null || i(s, !0);
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
if (O > Qt) {
|
|
771
|
+
ft(), i == null || i(s, !1);
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
var L;
|
|
775
|
+
const H = Math.min((L = c.current.getBoundingClientRect().height) != null ? L : 0, window.innerHeight);
|
|
776
|
+
var J;
|
|
777
|
+
const z = Math.min((J = c.current.getBoundingClientRect().width) != null ? J : 0, window.innerWidth), et = d === "left" || d === "right";
|
|
778
|
+
if (Math.abs(S) >= (et ? z : H) * R) {
|
|
779
|
+
ft(), i == null || i(s, !1);
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
i == null || i(s, !0), Ut();
|
|
783
|
+
}
|
|
784
|
+
r.useEffect(() => (_ && (C(document.documentElement, {
|
|
785
|
+
scrollBehavior: "auto"
|
|
786
|
+
}), ht.current = /* @__PURE__ */ new Date()), () => {
|
|
787
|
+
ke(document.documentElement, "scrollBehavior");
|
|
788
|
+
}), [
|
|
789
|
+
_
|
|
790
|
+
]);
|
|
791
|
+
function ve(s) {
|
|
792
|
+
const S = s ? (window.innerWidth - nt) / window.innerWidth : 1, D = s ? -nt : 0;
|
|
793
|
+
Dt.current && window.clearTimeout(Dt.current), C(c.current, {
|
|
794
|
+
transition: `transform ${x.DURATION}s cubic-bezier(${x.EASE.join(",")})`,
|
|
795
|
+
transform: `scale(${S}) translate3d(0, ${D}px, 0)`
|
|
796
|
+
}), !s && c.current && (Dt.current = setTimeout(() => {
|
|
797
|
+
const v = bt(c.current, d);
|
|
798
|
+
C(c.current, {
|
|
799
|
+
transition: "none",
|
|
800
|
+
transform: $(d) ? `translate3d(0, ${v}px, 0)` : `translate3d(${v}px, 0, 0)`
|
|
801
|
+
});
|
|
802
|
+
}, 500));
|
|
803
|
+
}
|
|
804
|
+
function ye(s, S) {
|
|
805
|
+
if (S < 0) return;
|
|
806
|
+
const D = (window.innerWidth - nt) / window.innerWidth, v = D + S * (1 - D), O = -nt + S * nt;
|
|
807
|
+
C(c.current, {
|
|
808
|
+
transform: $(d) ? `scale(${v}) translate3d(0, ${O}px, 0)` : `scale(${v}) translate3d(${O}px, 0, 0)`,
|
|
809
|
+
transition: "none"
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
function be(s, S) {
|
|
813
|
+
const D = $(d) ? window.innerHeight : window.innerWidth, v = S ? (D - nt) / D : 1, O = S ? -nt : 0;
|
|
814
|
+
S && C(c.current, {
|
|
815
|
+
transition: `transform ${x.DURATION}s cubic-bezier(${x.EASE.join(",")})`,
|
|
816
|
+
transform: $(d) ? `scale(${v}) translate3d(0, ${O}px, 0)` : `scale(${v}) translate3d(${O}px, 0, 0)`
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
return r.useEffect(() => {
|
|
820
|
+
F || window.requestAnimationFrame(() => {
|
|
821
|
+
document.body.style.pointerEvents = "auto";
|
|
822
|
+
});
|
|
823
|
+
}, [
|
|
824
|
+
F
|
|
825
|
+
]), /* @__PURE__ */ r.createElement(Z.Root, {
|
|
826
|
+
defaultOpen: Y,
|
|
827
|
+
onOpenChange: (s) => {
|
|
828
|
+
!g && !s || (s ? K(!0) : ft(!0), W(s));
|
|
829
|
+
},
|
|
830
|
+
open: _
|
|
831
|
+
}, /* @__PURE__ */ r.createElement(qt.Provider, {
|
|
832
|
+
value: {
|
|
833
|
+
activeSnapPoint: ue,
|
|
834
|
+
snapPoints: o,
|
|
835
|
+
setActiveSnapPoint: Lt,
|
|
836
|
+
drawerRef: c,
|
|
837
|
+
overlayRef: rt,
|
|
838
|
+
onOpenChange: n,
|
|
839
|
+
onPress: pe,
|
|
840
|
+
onRelease: ge,
|
|
841
|
+
onDrag: we,
|
|
842
|
+
dismissible: g,
|
|
843
|
+
shouldAnimate: It,
|
|
844
|
+
handleOnly: p,
|
|
845
|
+
isOpen: _,
|
|
846
|
+
isDragging: G,
|
|
847
|
+
shouldFade: Bt,
|
|
848
|
+
closeDrawer: ft,
|
|
849
|
+
onNestedDrag: ye,
|
|
850
|
+
onNestedOpenChange: ve,
|
|
851
|
+
onNestedRelease: be,
|
|
852
|
+
keyboardIsOpen: at,
|
|
853
|
+
modal: F,
|
|
854
|
+
snapPointsOffset: dt,
|
|
855
|
+
activeSnapPointIndex: ot,
|
|
856
|
+
direction: d,
|
|
857
|
+
shouldScaleBackground: f,
|
|
858
|
+
setBackgroundColorOnScale: m,
|
|
859
|
+
noBodyStyles: A,
|
|
860
|
+
container: M,
|
|
861
|
+
autoFocus: j
|
|
862
|
+
}
|
|
863
|
+
}, e));
|
|
864
|
+
}
|
|
865
|
+
const re = /* @__PURE__ */ r.forwardRef(function({ ...t }, n) {
|
|
866
|
+
const { overlayRef: e, snapPoints: a, onRelease: i, shouldFade: o, isOpen: f, modal: m, shouldAnimate: R } = st(), T = Gt(n, e), g = a && a.length > 0;
|
|
867
|
+
if (!m)
|
|
868
|
+
return null;
|
|
869
|
+
const p = r.useCallback((w) => i(w), [
|
|
870
|
+
i
|
|
871
|
+
]);
|
|
872
|
+
return /* @__PURE__ */ r.createElement(Z.Overlay, {
|
|
873
|
+
onMouseUp: p,
|
|
874
|
+
ref: T,
|
|
875
|
+
"data-vaul-overlay": "",
|
|
876
|
+
"data-vaul-snap-points": f && g ? "true" : "false",
|
|
877
|
+
"data-vaul-snap-points-overlay": f && o ? "true" : "false",
|
|
878
|
+
"data-vaul-animate": R != null && R.current ? "true" : "false",
|
|
879
|
+
...t
|
|
880
|
+
});
|
|
881
|
+
});
|
|
882
|
+
re.displayName = "Drawer.Overlay";
|
|
883
|
+
const ae = /* @__PURE__ */ r.forwardRef(function({ onPointerDownOutside: t, style: n, onOpenAutoFocus: e, ...a }, i) {
|
|
884
|
+
const { drawerRef: o, onPress: f, onRelease: m, onDrag: R, keyboardIsOpen: T, snapPointsOffset: g, activeSnapPointIndex: p, modal: w, isOpen: B, direction: k, snapPoints: E, container: F, handleOnly: h, shouldAnimate: N, autoFocus: A } = st(), [d, Y] = r.useState(!1), tt = Gt(i, o), u = r.useRef(null), b = r.useRef(null), y = r.useRef(!1), I = E && E.length > 0;
|
|
885
|
+
Ve();
|
|
886
|
+
const M = (l, U, _ = 0) => {
|
|
887
|
+
if (y.current) return !0;
|
|
888
|
+
const W = Math.abs(l.y), P = Math.abs(l.x), K = P > W, G = [
|
|
889
|
+
"bottom",
|
|
890
|
+
"right"
|
|
891
|
+
].includes(U) ? 1 : -1;
|
|
892
|
+
if (U === "left" || U === "right") {
|
|
893
|
+
if (!(l.x * G < 0) && P >= 0 && P <= _)
|
|
894
|
+
return K;
|
|
895
|
+
} else if (!(l.y * G < 0) && W >= 0 && W <= _)
|
|
896
|
+
return !K;
|
|
897
|
+
return y.current = !0, !0;
|
|
898
|
+
};
|
|
899
|
+
r.useEffect(() => {
|
|
900
|
+
I && window.requestAnimationFrame(() => {
|
|
901
|
+
Y(!0);
|
|
902
|
+
});
|
|
903
|
+
}, []);
|
|
904
|
+
function j(l) {
|
|
905
|
+
u.current = null, y.current = !1, m(l);
|
|
906
|
+
}
|
|
907
|
+
return /* @__PURE__ */ r.createElement(Z.Content, {
|
|
908
|
+
"data-vaul-drawer-direction": k,
|
|
909
|
+
"data-vaul-drawer": "",
|
|
910
|
+
"data-vaul-delayed-snap-points": d ? "true" : "false",
|
|
911
|
+
"data-vaul-snap-points": B && I ? "true" : "false",
|
|
912
|
+
"data-vaul-custom-container": F ? "true" : "false",
|
|
913
|
+
"data-vaul-animate": N != null && N.current ? "true" : "false",
|
|
914
|
+
...a,
|
|
915
|
+
ref: tt,
|
|
916
|
+
style: g && g.length > 0 ? {
|
|
917
|
+
"--snap-point-height": `${g[p ?? 0]}px`,
|
|
918
|
+
...n
|
|
919
|
+
} : n,
|
|
920
|
+
onPointerDown: (l) => {
|
|
921
|
+
h || (a.onPointerDown == null || a.onPointerDown.call(a, l), u.current = {
|
|
922
|
+
x: l.pageX,
|
|
923
|
+
y: l.pageY
|
|
924
|
+
}, f(l));
|
|
925
|
+
},
|
|
926
|
+
onOpenAutoFocus: (l) => {
|
|
927
|
+
e == null || e(l), A || l.preventDefault();
|
|
928
|
+
},
|
|
929
|
+
onPointerDownOutside: (l) => {
|
|
930
|
+
if (t == null || t(l), !w || l.defaultPrevented) {
|
|
931
|
+
l.preventDefault();
|
|
932
|
+
return;
|
|
933
|
+
}
|
|
934
|
+
T.current && (T.current = !1);
|
|
935
|
+
},
|
|
936
|
+
onFocusOutside: (l) => {
|
|
937
|
+
if (!w) {
|
|
938
|
+
l.preventDefault();
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
},
|
|
942
|
+
onPointerMove: (l) => {
|
|
943
|
+
if (b.current = l, h || (a.onPointerMove == null || a.onPointerMove.call(a, l), !u.current)) return;
|
|
944
|
+
const U = l.pageY - u.current.y, _ = l.pageX - u.current.x, W = l.pointerType === "touch" ? 10 : 2;
|
|
945
|
+
M({
|
|
946
|
+
x: _,
|
|
947
|
+
y: U
|
|
948
|
+
}, k, W) ? R(l) : (Math.abs(_) > W || Math.abs(U) > W) && (u.current = null);
|
|
949
|
+
},
|
|
950
|
+
onPointerUp: (l) => {
|
|
951
|
+
a.onPointerUp == null || a.onPointerUp.call(a, l), u.current = null, y.current = !1, m(l);
|
|
952
|
+
},
|
|
953
|
+
onPointerOut: (l) => {
|
|
954
|
+
a.onPointerOut == null || a.onPointerOut.call(a, l), j(b.current);
|
|
955
|
+
},
|
|
956
|
+
onContextMenu: (l) => {
|
|
957
|
+
a.onContextMenu == null || a.onContextMenu.call(a, l), b.current && j(b.current);
|
|
958
|
+
}
|
|
959
|
+
});
|
|
960
|
+
});
|
|
961
|
+
ae.displayName = "Drawer.Content";
|
|
962
|
+
const qe = 250, Xe = 120, oe = /* @__PURE__ */ r.forwardRef(function({ preventCycle: t = !1, children: n, ...e }, a) {
|
|
963
|
+
const { closeDrawer: i, isDragging: o, snapPoints: f, activeSnapPoint: m, setActiveSnapPoint: R, dismissible: T, handleOnly: g, isOpen: p, onPress: w, onDrag: B } = st(), k = r.useRef(null), E = r.useRef(!1);
|
|
964
|
+
function F() {
|
|
965
|
+
if (E.current) {
|
|
966
|
+
A();
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
window.setTimeout(() => {
|
|
970
|
+
h();
|
|
971
|
+
}, Xe);
|
|
972
|
+
}
|
|
973
|
+
function h() {
|
|
974
|
+
if (o || t || E.current) {
|
|
975
|
+
A();
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
978
|
+
if (A(), !f || f.length === 0) {
|
|
979
|
+
T || i();
|
|
980
|
+
return;
|
|
981
|
+
}
|
|
982
|
+
if (m === f[f.length - 1] && T) {
|
|
983
|
+
i();
|
|
984
|
+
return;
|
|
985
|
+
}
|
|
986
|
+
const Y = f.findIndex((u) => u === m);
|
|
987
|
+
if (Y === -1) return;
|
|
988
|
+
const tt = f[Y + 1];
|
|
989
|
+
R(tt);
|
|
990
|
+
}
|
|
991
|
+
function N() {
|
|
992
|
+
k.current = window.setTimeout(() => {
|
|
993
|
+
E.current = !0;
|
|
994
|
+
}, qe);
|
|
995
|
+
}
|
|
996
|
+
function A() {
|
|
997
|
+
k.current && window.clearTimeout(k.current), E.current = !1;
|
|
998
|
+
}
|
|
999
|
+
return /* @__PURE__ */ r.createElement("div", {
|
|
1000
|
+
onClick: F,
|
|
1001
|
+
onPointerCancel: A,
|
|
1002
|
+
onPointerDown: (d) => {
|
|
1003
|
+
g && w(d), N();
|
|
1004
|
+
},
|
|
1005
|
+
onPointerMove: (d) => {
|
|
1006
|
+
g && B(d);
|
|
1007
|
+
},
|
|
1008
|
+
// onPointerUp is already handled by the content component
|
|
1009
|
+
ref: a,
|
|
1010
|
+
"data-vaul-drawer-visible": p ? "true" : "false",
|
|
1011
|
+
"data-vaul-handle": "",
|
|
1012
|
+
"aria-hidden": "true",
|
|
1013
|
+
...e
|
|
1014
|
+
}, /* @__PURE__ */ r.createElement("span", {
|
|
1015
|
+
"data-vaul-handle-hitarea": "",
|
|
1016
|
+
"aria-hidden": "true"
|
|
1017
|
+
}, n));
|
|
1018
|
+
});
|
|
1019
|
+
oe.displayName = "Drawer.Handle";
|
|
1020
|
+
function Ke({ onDrag: t, onOpenChange: n, ...e }) {
|
|
1021
|
+
const { onNestedDrag: a, onNestedOpenChange: i, onNestedRelease: o } = st();
|
|
1022
|
+
if (!a)
|
|
1023
|
+
throw new Error("Drawer.NestedRoot must be placed in another drawer");
|
|
1024
|
+
return /* @__PURE__ */ r.createElement(ne, {
|
|
1025
|
+
nested: !0,
|
|
1026
|
+
onClose: () => {
|
|
1027
|
+
i(!1);
|
|
1028
|
+
},
|
|
1029
|
+
onDrag: (f, m) => {
|
|
1030
|
+
a(f, m), t == null || t(f, m);
|
|
1031
|
+
},
|
|
1032
|
+
onOpenChange: (f) => {
|
|
1033
|
+
f && i(f);
|
|
1034
|
+
},
|
|
1035
|
+
onRelease: o,
|
|
1036
|
+
...e
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
function Ge(t) {
|
|
1040
|
+
const n = st(), { container: e = n.container, ...a } = t;
|
|
1041
|
+
return /* @__PURE__ */ r.createElement(Z.Portal, {
|
|
1042
|
+
container: e,
|
|
1043
|
+
...a
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
const V = {
|
|
1047
|
+
Root: ne,
|
|
1048
|
+
NestedRoot: Ke,
|
|
1049
|
+
Content: ae,
|
|
1050
|
+
Overlay: re,
|
|
1051
|
+
Trigger: Z.Trigger,
|
|
1052
|
+
Portal: Ge,
|
|
1053
|
+
Handle: oe,
|
|
1054
|
+
Close: Z.Close,
|
|
1055
|
+
Title: Z.Title,
|
|
1056
|
+
Description: Z.Description
|
|
1057
|
+
}, Je = ({
|
|
1058
|
+
shouldScaleBackground: t = !0,
|
|
1059
|
+
...n
|
|
1060
|
+
}) => /* @__PURE__ */ X.jsx(
|
|
1061
|
+
V.Root,
|
|
1062
|
+
{
|
|
1063
|
+
shouldScaleBackground: t,
|
|
1064
|
+
...n
|
|
1065
|
+
}
|
|
1066
|
+
);
|
|
1067
|
+
Je.displayName = "Drawer";
|
|
1068
|
+
const ln = V.Trigger, Qe = V.Portal, un = V.Close, ie = wt.forwardRef(({ className: t, ...n }, e) => /* @__PURE__ */ X.jsx(
|
|
1069
|
+
V.Overlay,
|
|
1070
|
+
{
|
|
1071
|
+
ref: e,
|
|
1072
|
+
className: it("fixed inset-0 z-50 bg-black/80", t),
|
|
1073
|
+
...n
|
|
1074
|
+
}
|
|
1075
|
+
));
|
|
1076
|
+
ie.displayName = V.Overlay.displayName;
|
|
1077
|
+
const Ze = wt.forwardRef(
|
|
1078
|
+
({ className: t, children: n, hideBar: e = !0, ...a }, i) => /* @__PURE__ */ X.jsxs(Qe, { children: [
|
|
1079
|
+
/* @__PURE__ */ X.jsx(ie, {}),
|
|
1080
|
+
/* @__PURE__ */ X.jsxs(
|
|
1081
|
+
V.Content,
|
|
1082
|
+
{
|
|
1083
|
+
ref: i,
|
|
1084
|
+
className: it(
|
|
1085
|
+
"fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
|
|
1086
|
+
t
|
|
1087
|
+
),
|
|
1088
|
+
...a,
|
|
1089
|
+
children: [
|
|
1090
|
+
!e && /* @__PURE__ */ X.jsx("div", { className: "mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted" }),
|
|
1091
|
+
n
|
|
1092
|
+
]
|
|
1093
|
+
}
|
|
1094
|
+
)
|
|
1095
|
+
] })
|
|
1096
|
+
);
|
|
1097
|
+
Ze.displayName = "DrawerContent";
|
|
1098
|
+
const tn = ({
|
|
1099
|
+
className: t,
|
|
1100
|
+
...n
|
|
1101
|
+
}) => /* @__PURE__ */ X.jsx(
|
|
1102
|
+
"div",
|
|
1103
|
+
{
|
|
1104
|
+
className: it("grid gap-1.5 p-4 text-center sm:text-left", t),
|
|
1105
|
+
...n
|
|
1106
|
+
}
|
|
1107
|
+
);
|
|
1108
|
+
tn.displayName = "DrawerHeader";
|
|
1109
|
+
const en = ({
|
|
1110
|
+
className: t,
|
|
1111
|
+
...n
|
|
1112
|
+
}) => /* @__PURE__ */ X.jsx(
|
|
1113
|
+
"div",
|
|
1114
|
+
{
|
|
1115
|
+
className: it("mt-auto flex flex-col gap-2 p-4", t),
|
|
1116
|
+
...n
|
|
1117
|
+
}
|
|
1118
|
+
);
|
|
1119
|
+
en.displayName = "DrawerFooter";
|
|
1120
|
+
const nn = wt.forwardRef(({ className: t, ...n }, e) => /* @__PURE__ */ X.jsx(
|
|
1121
|
+
V.Title,
|
|
1122
|
+
{
|
|
1123
|
+
ref: e,
|
|
1124
|
+
className: it(
|
|
1125
|
+
"text-lg font-semibold leading-none tracking-tight",
|
|
1126
|
+
t
|
|
1127
|
+
),
|
|
1128
|
+
...n
|
|
1129
|
+
}
|
|
1130
|
+
));
|
|
1131
|
+
nn.displayName = V.Title.displayName;
|
|
1132
|
+
const rn = wt.forwardRef(({ className: t, ...n }, e) => /* @__PURE__ */ X.jsx(
|
|
1133
|
+
V.Description,
|
|
1134
|
+
{
|
|
1135
|
+
ref: e,
|
|
1136
|
+
className: it("text-sm text-muted-foreground", t),
|
|
1137
|
+
...n
|
|
1138
|
+
}
|
|
1139
|
+
));
|
|
1140
|
+
rn.displayName = V.Description.displayName;
|
|
1141
|
+
export {
|
|
1142
|
+
Je as Drawer,
|
|
1143
|
+
un as DrawerClose,
|
|
1144
|
+
Ze as DrawerContent,
|
|
1145
|
+
rn as DrawerDescription,
|
|
1146
|
+
en as DrawerFooter,
|
|
1147
|
+
tn as DrawerHeader,
|
|
1148
|
+
ie as DrawerOverlay,
|
|
1149
|
+
Qe as DrawerPortal,
|
|
1150
|
+
nn as DrawerTitle,
|
|
1151
|
+
ln as DrawerTrigger
|
|
1152
|
+
};
|
|
1153
|
+
//# sourceMappingURL=Drawer.js.map
|