Repository navigation
feat(sheet): floating side sheet that mounts in a container - #156
Merged
Merged
Conversation
CodeLoom's Automations page needs a right-side panel for automation details and the create/edit form. Extend Sheet instead of adding a Drawer: - Left and right sheets float 8px in from the edges with every corner rounded, and become a bottom sheet at 768px and below, where `draggable` shows the grip. - A `mount` other than document.body makes the sheet and its scrim cover that element (data-contained, position: absolute). - The slide is a CSS transition: in 260ms on the new --cui-motion-ease-drawer token, out 200ms ease-out. The root holds the content through its exit and a reopen mid-exit turns it around. - The page takes clicks during the exit. Kobalte's body pointer lock outlived the close, so the sheet relies on its scrim instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 7100f31 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Owner
Author
Motion, before and after (right sheet,
|
| Moment | Before | After |
|---|---|---|
| Pointer open | @keyframes slide, 200ms ease-out, edge-attached |
transition: transform 260ms, cubic-bezier(0.32, 0.72, 0, 1), floating 8px inset |
| Scrim in | keyframe fade 200ms | opacity transition 260ms ease-out |
| Pointer close, +30ms | already unmounted (no exit) | still mounted, transform transition 200ms ease-out, at 132px |
| Pointer close, +150ms | gone | at 389px, scrim opacity 0.007 |
| Page during exit | body pointer-events: none until unmount |
clickable (scrim and content inert) |
| Reopen 80ms into the exit | n/a | turns around from 344px (no restart) |
| Keyboard open or close | data-motion="none", no motion |
unchanged |
| Reduced motion | keyframe fade in, no exit | opacity only, 260ms in and 200ms out, transform none |
| Phone (≤768px) | side sheet stays a 24rem side panel | bottom sheet, translateY(100%), grip shown |
Browser evidence
journeys/sheet-drawer.mjsondesignsystem-sheet--drawer, dark and light: closed, then Enter on "New automation" (focus inside,data-motion=none, 8px insets, scrim limited to the island), Escape returns focus, Enter on a row, Edit swaps in place on the same element, a scrim click returns focus to the row, and at 390×844 a full-width bottom sheet with the grip. Axe: no violations in any state.journeys/sheet-swap.mjsondesignsystem-sheet--drawer-nonmodal: a row click while open swaps the title. The same element keepsdata-expandedthe whole time (MutationObserver).
Contributor
CodeUI package previewBuilt from npm install https://pkg.pr.new/riccardoperra/codeui/@codeui/solid@7100f3187acf80660c11f5fee4d9876d206ad722Installing |
Contributor
|
Docs preview deployed to Cloudflare Pages.
Built from 7100f31. |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
CodeLoom's Automations page needs a right-side panel for automation details and the create/edit form. DESIGN.md §1 rule 8 (one component per pattern) says extend
Sheet, so there is no new Drawer. Before this change the Sheet had no exit animation at all: Kobalte alpha.5 unmounts a closed dialog at once.What changed
side="left" | "right"floats 8px in from the top, bottom and its edge, with every corner rounded. It is 24rem wide by default (--cui-sheet-width). At ≤768px it becomes a bottom sheet, anddraggableshows the grip there only.mountset to anything other thandocument.bodymakes the content and scrimposition: absolute(data-contained), so they cover that element. For CodeLoom that is the content island, not the sidebar.slow) on--cui-motion-ease-drawer, exit 200ms (panel) ease-out, and the scrim fades with it. The root holds the content through the exit (createPopMotionnow takes an exit predicate). Reopening mid-exit turns the slide around. Keyboard opens and closes still don't animate. Reduced motion fades in place.--cui-motion-ease-draweris promoted from proposed to a real token.Sheet/Drawer(modal) andSheet/Drawer Nonmodal(row clicks swap the content).Scope
The brief targeted
feat/upgrade-solid2-kobalte. That branch merged intomainas #141 and was deleted, so this PR is rebased ontomainand uses the renamed package,@codeui/solid.Tradeoffs
disableOutsidePointerEvents={false}. Kobalte's bodypointer-events: noneoutlived the close (its effect cleanup runs while the layer still counts as blocking), so every click during the exit was lost. The scrim catches outside clicks instead. A parts user with a modal sheet and noOverlaynow lets clicks reach the page.contentProps.onInteractOutside→preventDefault()on row targets. Otherwise a row click dismisses it first. This is documented and the story shows it.slow) instead of the 280ms in DESIGN's old Slide row, so no new duration token is needed. DESIGN.md is updated to match.Blast Radius
Sheet consumers. Side sheets change look (inset, rounded) and turn into bottom sheets on a phone. The
SheetPlacementunion is now a plain object, becausedraggableis allowed on every side. Popover and menu exits sharecreatePopMotion, which keeps its default Pop predicate.Verification
api:checkanddocs:lintpass.docs:check-llmsneeds a running docs URL and was not run.journeys/sheet-drawer.mjs10/10 andjourneys/sheet-swap.mjs3/3, with axe clean in every state. The motion numbers, measured withscripts/sheet-motion.mjs, are in the first comment.🤖 Generated with Claude Code