mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-11-03 03:18:52 +00:00
Upstream sync from shadcn-ui/ui (1686 commits since last merge base). Key changes: - packages/shadcn upgraded to 4.1.0 (CLI font transformers, scaffold from github, chart colors) - apps/v4 replaces apps/www as the primary docs/registry app - Font system: 25+ heading font registries, font markers utility, @supports override - Chart improvements: recharts v3 compat, radial chart fixes - templates/ updated with monorepo variants (astro, vite, react-router, start) - skills/shadcn AI skill definitions added - deprecated/ removed (auth, auth-firebase, cli, www) Preserved Hanzo-only paths: app/, pkg/, demo/, docs/, template/next/
126 lines
2.8 KiB
TypeScript
126 lines
2.8 KiB
TypeScript
"use client"
|
|
|
|
import * as React from "react"
|
|
import { Drawer as DrawerPrimitive } from "vaul"
|
|
|
|
import { cn } from "@/registry/bases/base/lib/utils"
|
|
|
|
function Drawer({
|
|
...props
|
|
}: React.ComponentProps<typeof DrawerPrimitive.Root>) {
|
|
return <DrawerPrimitive.Root data-slot="drawer" {...props} />
|
|
}
|
|
|
|
function DrawerTrigger({
|
|
...props
|
|
}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
|
|
return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />
|
|
}
|
|
|
|
function DrawerPortal({
|
|
...props
|
|
}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
|
|
return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />
|
|
}
|
|
|
|
function DrawerClose({
|
|
...props
|
|
}: React.ComponentProps<typeof DrawerPrimitive.Close>) {
|
|
return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />
|
|
}
|
|
|
|
function DrawerOverlay({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
|
|
return (
|
|
<DrawerPrimitive.Overlay
|
|
data-slot="drawer-overlay"
|
|
className={cn("cn-drawer-overlay fixed inset-0 z-50", className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function DrawerContent({
|
|
className,
|
|
children,
|
|
...props
|
|
}: React.ComponentProps<typeof DrawerPrimitive.Content>) {
|
|
return (
|
|
<DrawerPortal data-slot="drawer-portal">
|
|
<DrawerOverlay />
|
|
<DrawerPrimitive.Content
|
|
data-slot="drawer-content"
|
|
className={cn(
|
|
"cn-drawer-content group/drawer-content fixed z-50",
|
|
className
|
|
)}
|
|
{...props}
|
|
>
|
|
<div className="cn-drawer-handle mx-auto hidden shrink-0 group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
|
|
{children}
|
|
</DrawerPrimitive.Content>
|
|
</DrawerPortal>
|
|
)
|
|
}
|
|
|
|
function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
return (
|
|
<div
|
|
data-slot="drawer-header"
|
|
className={cn("cn-drawer-header flex flex-col", className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
return (
|
|
<div
|
|
data-slot="drawer-footer"
|
|
className={cn("cn-drawer-footer mt-auto flex flex-col", className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function DrawerTitle({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<typeof DrawerPrimitive.Title>) {
|
|
return (
|
|
<DrawerPrimitive.Title
|
|
data-slot="drawer-title"
|
|
className={cn("cn-drawer-title cn-font-heading", className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function DrawerDescription({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<typeof DrawerPrimitive.Description>) {
|
|
return (
|
|
<DrawerPrimitive.Description
|
|
data-slot="drawer-description"
|
|
className={cn("cn-drawer-description", className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export {
|
|
Drawer,
|
|
DrawerPortal,
|
|
DrawerOverlay,
|
|
DrawerTrigger,
|
|
DrawerClose,
|
|
DrawerContent,
|
|
DrawerHeader,
|
|
DrawerFooter,
|
|
DrawerTitle,
|
|
DrawerDescription,
|
|
}
|