From 07ab679555afe6189b0260d247d7f4b9ff561cba Mon Sep 17 00:00:00 2001 From: coi Date: Sat, 18 Apr 2026 03:10:23 +0900 Subject: [PATCH] refactor(base-drawer): rewrite base drawer wrapper for @base-ui/react/drawer Replace vaul with @base-ui/react/drawer as the primitive behind the base drawer wrapper. Keep the public API aligned with the radix drawer shape while rewriting DrawerContent to compose Backdrop, Viewport, Popup, and Content internally. Keep the registry dependency change in the same commit so the wrapper rewrite lands as one source-level migration step. --- apps/v4/registry/bases/base/ui/_registry.ts | 4 +- apps/v4/registry/bases/base/ui/drawer.tsx | 68 +++++++++++---------- 2 files changed, 37 insertions(+), 35 deletions(-) diff --git a/apps/v4/registry/bases/base/ui/_registry.ts b/apps/v4/registry/bases/base/ui/_registry.ts index 185cfdd042..6befff838c 100644 --- a/apps/v4/registry/bases/base/ui/_registry.ts +++ b/apps/v4/registry/bases/base/ui/_registry.ts @@ -351,7 +351,7 @@ export const ui: Registry["items"] = [ { name: "drawer", type: "registry:ui", - dependencies: ["vaul"], + dependencies: ["@base-ui/react"], files: [ { path: "ui/drawer.tsx", @@ -363,7 +363,7 @@ export const ui: Registry["items"] = [ docs: "https://ui.shadcn.com/docs/components/base/drawer", examples: "https://raw.githubusercontent.com/shadcn-ui/ui/refs/heads/main/apps/v4/registry/bases/base/examples/drawer-example.tsx", - api: "https://vaul.emilkowal.ski/getting-started", + api: "https://base-ui.com/react/components/drawer.md", }, }, }, diff --git a/apps/v4/registry/bases/base/ui/drawer.tsx b/apps/v4/registry/bases/base/ui/drawer.tsx index 8efcca212b..a7b615c801 100644 --- a/apps/v4/registry/bases/base/ui/drawer.tsx +++ b/apps/v4/registry/bases/base/ui/drawer.tsx @@ -1,42 +1,37 @@ "use client" import * as React from "react" -import { Drawer as DrawerPrimitive } from "vaul" +import { Drawer as DrawerPrimitive } from "@base-ui/react/drawer" import { cn } from "@/registry/bases/base/lib/utils" -function Drawer({ - ...props -}: React.ComponentProps) { +function Drawer({ ...props }: DrawerPrimitive.Root.Props) { return } -function DrawerTrigger({ - ...props -}: React.ComponentProps) { +function DrawerTrigger({ ...props }: DrawerPrimitive.Trigger.Props) { return } -function DrawerPortal({ - ...props -}: React.ComponentProps) { +function DrawerPortal({ ...props }: DrawerPrimitive.Portal.Props) { return } -function DrawerClose({ - ...props -}: React.ComponentProps) { +function DrawerClose({ ...props }: DrawerPrimitive.Close.Props) { return } function DrawerOverlay({ className, ...props -}: React.ComponentProps) { +}: DrawerPrimitive.Backdrop.Props) { return ( - ) @@ -46,21 +41,28 @@ function DrawerContent({ className, children, ...props -}: React.ComponentProps) { +}: DrawerPrimitive.Popup.Props) { return ( - -
- {children} - + +
+ + {children} + + + ) } @@ -69,7 +71,10 @@ function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) { return (
) @@ -85,10 +90,7 @@ function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) { ) } -function DrawerTitle({ - className, - ...props -}: React.ComponentProps) { +function DrawerTitle({ className, ...props }: DrawerPrimitive.Title.Props) { return ( ) { +}: DrawerPrimitive.Description.Props) { return (