Skip to content

feat: migrate sheet to drawer#654

Merged
rohanchkrabrty merged 3 commits intomainfrom
migrate-drawer
Feb 27, 2026
Merged

feat: migrate sheet to drawer#654
rohanchkrabrty merged 3 commits intomainfrom
migrate-drawer

Conversation

@rohanchkrabrty
Copy link
Contributor

@rohanchkrabrty rohanchkrabrty commented Feb 24, 2026

Description

This PR migrates Sheet component to use Base UI Drawer

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor (no functional changes, no bug fixes just code improvements)
  • Chore (changes to the build process or auxiliary tools and libraries such as documentation generation)
  • Style (changes that do not affect the meaning of the code (white-space, formatting, etc))
  • Test (adding missing tests or correcting existing tests)
  • Improvement (Improvements to existing code)
  • Other (please specify)

How Has This Been Tested?

[Describe the tests that you ran to verify your changes]

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (.mdx files)
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

Screenshots (if appropriate):

[Add screenshots here]

Related Issues

[Link any related issues here using #issue-number]

Summary by CodeRabbit

  • New Features

    • Introduced a Drawer component with multi-side positioning (top/right/bottom/left), swipe-to-dismiss, and composable subcomponents.
  • Documentation

    • Added comprehensive Drawer docs, demos, and playground; removed Sheet documentation.
  • Examples

    • Added interactive Drawer examples/playground; removed corresponding Sheet examples.
  • Tests

    • Added comprehensive Drawer tests; removed legacy Sheet tests.
  • Chores

    • Replaced Sheet with Drawer across the site and package exports; updated overview and README; test environment polyfill added.

@rohanchkrabrty rohanchkrabrty self-assigned this Feb 24, 2026
@vercel
Copy link

vercel bot commented Feb 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
apsara Ready Ready Preview, Comment Feb 27, 2026 7:47am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e0961a6 and c612acf.

📒 Files selected for processing (3)
  • apps/www/src/app/examples/page.tsx
  • apps/www/src/components/playground/index.ts
  • packages/raystack/index.tsx

📝 Walkthrough

Walkthrough

Replaces the Sheet component with a new Drawer implementation across UI code, styles, tests, docs, examples, and public exports; adds Drawer primitives, types, demos, and a test suite; removes Sheet files and exports; updates @base-ui/react dependency and test PointerEvent polyfill. (50 words)

Changes

Cohort / File(s) Summary
Drawer implementation
packages/raystack/components/drawer/drawer.tsx, packages/raystack/components/drawer/drawer-root.tsx, packages/raystack/components/drawer/drawer-content.tsx, packages/raystack/components/drawer/drawer-misc.tsx, packages/raystack/components/drawer/index.tsx
Adds new Drawer public API: Root, Content, misc subcomponents (Header, Title, Description, Body, Footer), forwardRefs, side/swipe mapping, displayName updates, and re-exports/types.
Drawer styles & tests
packages/raystack/components/drawer/drawer.module.css, packages/raystack/components/drawer/__tests__/drawer.test.tsx
Adds CSS module for four orientations, animations, backdrop, and comprehensive unit tests covering rendering, positioning, close behaviors, controlled mode, and accessibility.
Sheet removal (implementation & styles & tests)
packages/raystack/components/sheet/sheet.tsx, packages/raystack/components/sheet/sheet-content.tsx, packages/raystack/components/sheet/sheet.module.css, packages/raystack/components/sheet/__tests__/sheet.test.tsx, packages/raystack/components/sheet/index.tsx
Removes Sheet implementation, content component, CSS, tests, and public re-export, removing Sheet from the package API surface.
Docs & demos — Drawer added
apps/www/src/content/docs/components/drawer/index.mdx, apps/www/src/content/docs/components/drawer/demo.ts, apps/www/src/content/docs/components/drawer/props.ts
Adds Drawer documentation page, demo playground, example code generation, and prop interfaces.
Docs & demos — Sheet removed
apps/www/src/content/docs/components/sheet/index.mdx, apps/www/src/content/docs/components/sheet/demo.ts, apps/www/src/content/docs/components/sheet/props.ts
Deletes Sheet documentation, demos, and prop declarations.
Examples & playground updates
apps/www/src/app/examples/page.tsx, apps/www/src/components/playground/drawer-examples.tsx, apps/www/src/components/playground/index.ts
Replaces Sheet usage with Drawer in example page, adds DrawerExamples component, and updates playground exports (removes sheet-examples export).
Overview & README update
apps/www/src/content/docs/(overview)/index.mdx, packages/raystack/README.md
Replaces Sheet entry with Drawer in components overview and README overlay list.
Public API & package index
packages/raystack/index.tsx
Adds Drawer to public exports and removes Sheet from the package index.
Dependency & test setup
packages/raystack/package.json, packages/raystack/vitest.setup.ts
Bumps @base-ui/react to ^1.2.0 and adds a PointerEvent polyfill in Vitest setup.
App example file update
apps/www/src/app/examples/page.tsx
Replaces Sheet imports/usages and state (dialogSheetOpendialogDrawerOpen), updates JSX to use Drawer with Drawer.Content and Drawer.Title (side='right').

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant App as Client App
  participant DrawerRoot as Drawer.Root
  participant Portal as Portal/Viewport
  participant DrawerContent as Drawer.Content

  User->>App: Click Trigger (open)
  App->>DrawerRoot: set open=true (onOpenChange)
  DrawerRoot->>Portal: mount Backdrop & Viewport
  Portal->>DrawerContent: render panel (side)
  DrawerContent-->>User: visible drawer (title/body/close)
  User->>DrawerContent: Click Close / Escape / Backdrop
  DrawerContent->>DrawerRoot: onOpenChange(false)
  DrawerRoot->>Portal: unmount panel & backdrop
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Possibly related PRs

Suggested labels

Do not merge

Suggested reviewers

  • rohilsurana
  • rsbh

Poem

🐰 I hopped where sheets once swayed aside,
A drawer now glides with gentle pride,
Tests hum, docs shine bright and clear,
I nudged the UI — give a cheer! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: migrating the Sheet component to a Drawer component across the codebase.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch migrate-drawer

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/www/src/content/docs/components/drawer/demo.ts`:
- Around line 5-18: getCode currently passes all props to both <Drawer> and
<Drawer.Content> by calling getPropsString(props) twice; filter props into
rootProps and contentProps first (e.g., remove content-only keys like
showCloseButton from rootProps) and then call getPropsString(rootProps) for the
Drawer root and getPropsString(contentProps) for Drawer.Content so content-only
props aren’t added to the root and avoid React unknown-prop warnings. Ensure the
unique symbols referenced are getCode and getPropsString and specifically
exclude showCloseButton (and any other content-only keys) from the rootProps
set.

In `@apps/www/src/content/docs/components/drawer/index.mdx`:
- Around line 77-83: Update the "Accessibility" section to qualify behaviors
based on the Drawer component's modal prop: state that aria-modal="true" and
full focus trapping apply when modal is true, focus is restored on close when
trapping is enabled (modal === true or modal === 'trap-focus'), and that Escape
key and swipe-to-close gestures are supported regardless of modal mode; keep the
note that the title is announced via aria-labelledby and explicitly mention
which behaviors are conditional on modal vs non-modal modes.

In `@apps/www/src/content/docs/components/drawer/props.ts`:
- Around line 37-41: The docs currently type overlayProps as a minimal object
with only className and style which is inconsistent with DrawerContentProps
expecting DrawerPrimitive.Backdrop.Props; update the overlayProps declaration to
use the fuller Backdrop props type (e.g. overlayProps?:
DrawerPrimitive.Backdrop.Props) so handlers/ARIA and other attributes are
exposed, and ensure the JSDoc comment reflects "full backdrop props" rather than
just className/style; adjust imports or namespace references if necessary to
resolve DrawerPrimitive.Backdrop.Props.

In `@packages/raystack/components/drawer/__tests__/drawer.test.tsx`:
- Around line 1-4: Tests are failing due to missing PointerEvent in jsdom; add a
polyfill so PointerEvent exists during tests—either add it to your global test
setup (vitest setupFiles) or at the top of this test module (before using
fireEvent/userEvent) by defining global.PointerEvent/window.PointerEvent if
absent; ensure the polyfill extends MouseEvent and accepts type/props so
existing tests using fireEvent/userEvent behave normally (reference this test
module imports: fireEvent, render, screen, waitFor and userEvent).

In `@packages/raystack/components/drawer/drawer-root.tsx`:
- Around line 5-27: The sideToSwipeDirection mapping uses 'top'/'bottom' but
Base UI expects 'up'|'down'|'left'|'right', so update sideToSwipeDirection in
drawer-root.tsx to map top => 'up' and bottom => 'down' (keep left/right as
'left'/'right'), and ensure the type for sideToSwipeDirection/swipeDirection
(and the Side mapping) aligns with DrawerPrimitive.Root's expected
swipeDirection union used in DrawerRoot so the computed swipeDirection passed to
DrawerPrimitive.Root is valid.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4262f37 and cdbed73.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (26)
  • apps/www/src/app/examples/page.tsx
  • apps/www/src/components/playground/drawer-examples.tsx
  • apps/www/src/components/playground/index.ts
  • apps/www/src/components/playground/sheet-examples.tsx
  • apps/www/src/content/docs/(overview)/index.mdx
  • apps/www/src/content/docs/components/drawer/demo.ts
  • apps/www/src/content/docs/components/drawer/index.mdx
  • apps/www/src/content/docs/components/drawer/props.ts
  • apps/www/src/content/docs/components/sheet/demo.ts
  • apps/www/src/content/docs/components/sheet/index.mdx
  • apps/www/src/content/docs/components/sheet/props.ts
  • packages/raystack/README.md
  • packages/raystack/components/drawer/__tests__/drawer.test.tsx
  • packages/raystack/components/drawer/drawer-content.tsx
  • packages/raystack/components/drawer/drawer-misc.tsx
  • packages/raystack/components/drawer/drawer-root.tsx
  • packages/raystack/components/drawer/drawer.module.css
  • packages/raystack/components/drawer/drawer.tsx
  • packages/raystack/components/drawer/index.tsx
  • packages/raystack/components/sheet/__tests__/sheet.test.tsx
  • packages/raystack/components/sheet/index.tsx
  • packages/raystack/components/sheet/sheet-content.tsx
  • packages/raystack/components/sheet/sheet.module.css
  • packages/raystack/components/sheet/sheet.tsx
  • packages/raystack/index.tsx
  • packages/raystack/package.json
💤 Files with no reviewable changes (9)
  • packages/raystack/components/sheet/index.tsx
  • apps/www/src/components/playground/sheet-examples.tsx
  • packages/raystack/components/sheet/tests/sheet.test.tsx
  • apps/www/src/content/docs/components/sheet/props.ts
  • packages/raystack/components/sheet/sheet-content.tsx
  • packages/raystack/components/sheet/sheet.tsx
  • apps/www/src/content/docs/components/sheet/demo.ts
  • packages/raystack/components/sheet/sheet.module.css
  • apps/www/src/content/docs/components/sheet/index.mdx

@rohanchkrabrty rohanchkrabrty merged commit 3392aa7 into main Feb 27, 2026
3 of 5 checks passed
@rohanchkrabrty rohanchkrabrty deleted the migrate-drawer branch February 27, 2026 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants