UNPKG

@arolariu/components

Version:

A collection of reusable components for React applications, built as ESM & CJS modules with tree shake, minify and bundler optimizations enabled, for the lowest bundle size (import cost)!

1 lines 6.51 kB
{"version":3,"file":"components\\ui\\drawer.cjs","sources":["webpack://@arolariu/components/./src/components/ui/drawer.tsx"],"sourcesContent":["\r\n\r\nimport * as React from \"react\";\r\nimport { cn } from \"./../../lib/utils\";\r\nimport { Drawer as DrawerPrimitive } from \"vaul\";\r\n\r\nfunction Drawer({\r\n ...props\r\n}: React.ComponentProps<typeof DrawerPrimitive.Root>) {\r\n return <DrawerPrimitive.Root data-slot=\"drawer\" {...props} />;\r\n}\r\n\r\nfunction DrawerTrigger({\r\n ...props\r\n}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {\r\n return <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...props} />;\r\n}\r\n\r\nfunction DrawerPortal({\r\n ...props\r\n}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {\r\n return <DrawerPrimitive.Portal data-slot=\"drawer-portal\" {...props} />;\r\n}\r\n\r\nfunction DrawerClose({\r\n ...props\r\n}: React.ComponentProps<typeof DrawerPrimitive.Close>) {\r\n return <DrawerPrimitive.Close data-slot=\"drawer-close\" {...props} />;\r\n}\r\n\r\nfunction DrawerOverlay({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {\r\n return (\r\n <DrawerPrimitive.Overlay\r\n data-slot=\"drawer-overlay\"\r\n className={cn(\r\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DrawerContent({\r\n className,\r\n children,\r\n ...props\r\n}: React.ComponentProps<typeof DrawerPrimitive.Content>) {\r\n return (\r\n <DrawerPortal data-slot=\"drawer-portal\">\r\n <DrawerOverlay />\r\n <DrawerPrimitive.Content\r\n data-slot=\"drawer-content\"\r\n className={cn(\r\n \"group/drawer-content bg-white fixed z-50 flex h-auto flex-col dark:bg-neutral-950\",\r\n \"data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg\",\r\n \"data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg\",\r\n \"data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 sm:data-[vaul-drawer-direction=right]:max-w-sm\",\r\n \"data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 sm:data-[vaul-drawer-direction=left]:max-w-sm\",\r\n className\r\n )}\r\n {...props}\r\n >\r\n <div className=\"bg-neutral-100 mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block dark:bg-neutral-800\" />\r\n {children}\r\n </DrawerPrimitive.Content>\r\n </DrawerPortal>\r\n );\r\n}\r\n\r\nfunction DrawerHeader({ className, ...props }: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot=\"drawer-header\"\r\n className={cn(\"flex flex-col gap-1.5 p-4\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DrawerFooter({ className, ...props }: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot=\"drawer-footer\"\r\n className={cn(\"mt-auto flex flex-col gap-2 p-4\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DrawerTitle({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof DrawerPrimitive.Title>) {\r\n return (\r\n <DrawerPrimitive.Title\r\n data-slot=\"drawer-title\"\r\n className={cn(\r\n \"text-neutral-950 font-semibold dark:text-neutral-50\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DrawerDescription({\r\n className,\r\n ...props\r\n}: React.ComponentProps<typeof DrawerPrimitive.Description>) {\r\n return (\r\n <DrawerPrimitive.Description\r\n data-slot=\"drawer-description\"\r\n className={cn(\r\n \"text-neutral-500 text-sm dark:text-neutral-400\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nexport {\r\n Drawer,\r\n DrawerPortal,\r\n DrawerOverlay,\r\n DrawerTrigger,\r\n DrawerClose,\r\n DrawerContent,\r\n DrawerHeader,\r\n DrawerFooter,\r\n DrawerTitle,\r\n DrawerDescription,\r\n};\r\n"],"names":["Drawer","props","DrawerPrimitive","DrawerTrigger","DrawerPortal","DrawerClose","DrawerOverlay","className","cn","DrawerContent","children","DrawerHeader","DrawerFooter","DrawerTitle","DrawerDescription"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAASA,OAAO,EACd,GAAGC,OAC+C;IAClD,OAAO,WAAP,GAAO,qCAACC,8BAAAA,MAAAA,CAAAA,IAAoB;QAAC,aAAU;QAAU,GAAGD,KAAK;;AAC3D;AAEA,SAASE,cAAc,EACrB,GAAGF,OACkD;IACrD,OAAO,WAAP,GAAO,qCAACC,8BAAAA,MAAAA,CAAAA,OAAuB;QAAC,aAAU;QAAkB,GAAGD,KAAK;;AACtE;AAEA,SAASG,aAAa,EACpB,GAAGH,OACiD;IACpD,OAAO,WAAP,GAAO,qCAACC,8BAAAA,MAAAA,CAAAA,MAAsB;QAAC,aAAU;QAAiB,GAAGD,KAAK;;AACpE;AAEA,SAASI,YAAY,EACnB,GAAGJ,OACgD;IACnD,OAAO,WAAP,GAAO,qCAACC,8BAAAA,MAAAA,CAAAA,KAAqB;QAAC,aAAU;QAAgB,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