/* Copyright (C) 2023-2026 QuantumNous This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ 'use client' import { Drawer as DrawerPrimitive } from '@base-ui/react/drawer' import * as React from 'react' import { cn } from '@/lib/utils' type DrawerContextProps = { hasSnapPoints: boolean modal: DrawerPrimitive.Root.Props['modal'] showSwipeHandle: boolean swipeDirection: NonNullable } const DrawerContext = React.createContext(null) function useDrawer() { const context = React.useContext(DrawerContext) if (!context) { throw new Error('useDrawer must be used within a Drawer.') } return context } function Drawer({ modal = true, showSwipeHandle = false, snapPoints, swipeDirection = 'down', ...props }: DrawerPrimitive.Root.Props & { showSwipeHandle?: boolean }) { const hasSnapPoints = snapPoints != null && snapPoints.length > 0 const contextValue = React.useMemo( () => ({ hasSnapPoints, modal, showSwipeHandle, swipeDirection }), [hasSnapPoints, modal, showSwipeHandle, swipeDirection] ) return ( ) } function DrawerTrigger({ ...props }: DrawerPrimitive.Trigger.Props) { return } function DrawerPortal({ ...props }: DrawerPrimitive.Portal.Props) { return } function DrawerClose({ ...props }: DrawerPrimitive.Close.Props) { return } function DrawerOverlay({ className, ...props }: DrawerPrimitive.Backdrop.Props) { return ( ) } function DrawerSwipeHandle({ className, ...props }: React.ComponentProps<'div'>) { return (