PLASMA-6472: Add a snap points feature - #3027
Open
vmytnik wants to merge 1 commit into
Open
Conversation
vmytnik
requested review from
TitanKuzmich,
Yakutoc,
Yeti-or,
neretin-trike and
shuga2704
as code owners
August 7, 2026 11:12
📝 WalkthroughWalkthroughChangesSheet snap-point support
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Sheet
participant useSheetSwipe
participant SnapPointUtils
participant StyledSheetContent
Sheet->>useSheetSwipe: pass snapPoints and defaultSnapPoint
useSheetSwipe->>SnapPointUtils: resolve and sort snap points
Sheet->>useSheetSwipe: forward touch movement
useSheetSwipe->>StyledSheetContent: apply bounded sheet height
useSheetSwipe-->>Sheet: report onSnapPointChange
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Contributor
|
Theme Builder app deployed! https://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-3027/ |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/plasma-new-hope/src/components/Sheet/hooks/useSheetSwipe.ts`:
- Around line 57-59: Normalize the initial `activeSnapPoint` in `useSheetSwipe`
so `defaultSnapPoint` is used only when it belongs to `snapPoints`; otherwise
use the first snap point. Apply this same membership-based fallback during
reopening and all related state synchronization paths around
`setActiveSnapPoint`, keeping the rendered point and stored state consistent.
- Around line 152-162: Update the isSnapEnabled touch-move logic in
useSheetSwipe so upward gestures are intercepted only when a larger resolved
snap height exists. Clamp nextHeight to the largest effective snap height, and
allow the browser’s native scrolling when the sheet is already at that height;
preserve existing handling for downward gestures and valid expansion.
- Around line 196-210: Update the close-threshold check in the snap-enabled
swipe logic around getSortedSnapPoints to use the unclamped height,
startHeight.current - offsetY, instead of currentHeight, while retaining the
clamped value for nearest snap-point selection and height application.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 00ef2ee6-465a-4546-b8ff-5428eb4a76c7
📒 Files selected for processing (9)
packages/plasma-new-hope/src/components/Sheet/Sheet.styles.tspackages/plasma-new-hope/src/components/Sheet/Sheet.template-doc.mdxpackages/plasma-new-hope/src/components/Sheet/Sheet.tsxpackages/plasma-new-hope/src/components/Sheet/Sheet.types.tspackages/plasma-new-hope/src/components/Sheet/hooks/useSheetSwipe.tspackages/plasma-new-hope/src/components/Sheet/index.tspackages/plasma-new-hope/src/components/Sheet/utils/index.tspackages/plasma-new-hope/src/components/Sheet/utils/resolveSnapPoint.tspackages/plasma-new-hope/src/examples/components/Sheet/Sheet.stories.tsx
Contributor
vmytnik
force-pushed
the
PLASMA-6472.sheet-snap-points
branch
from
August 7, 2026 11:55
206169e to
e9c5ef4
Compare
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.
Core
Sheet
What/why changed
Summary by CodeRabbit
New Features
Documentation
📦 Published PR as canary version:
Canary Versions✨ Test out this PR locally via:
npm install @salutejs/plasma-asdk@0.387.0-canary.3027.31176041121.0 npm install @salutejs/plasma-b2c@1.629.0-canary.3027.31176041121.0 npm install @salutejs/plasma-colors@0.18.0-canary.3027.31176041121.0 npm install @salutejs/plasma-core@1.236.0-canary.3027.31176041121.0 npm install @salutejs/plasma-giga@0.356.0-canary.3027.31176041121.0 npm install @salutejs/plasma-homeds@0.356.0-canary.3027.31176041121.0 npm install @salutejs/plasma-hope@1.383.0-canary.3027.31176041121.0 npm install @salutejs/plasma-icons@1.245.0-canary.3027.31176041121.0 npm install @salutejs/plasma-new-hope@0.373.0-canary.3027.31176041121.0 npm install @salutejs/plasma-tokens@1.147.0-canary.3027.31176041121.0 npm install @salutejs/plasma-tokens-b2b@1.61.0-canary.3027.31176041121.0 npm install @salutejs/plasma-tokens-b2c@0.72.0-canary.3027.31176041121.0 npm install @salutejs/plasma-tokens-core@0.9.0-canary.3027.31176041121.0 npm install @salutejs/plasma-tokens-web@1.76.0-canary.3027.31176041121.0 npm install @salutejs/plasma-typo@0.49.0-canary.3027.31176041121.0 npm install @salutejs/plasma-web@1.631.0-canary.3027.31176041121.0 npm install @salutejs/sdds-bizcom@0.361.0-canary.3027.31176041121.0 npm install @salutejs/sdds-cs@0.365.0-canary.3027.31176041121.0 npm install @salutejs/sdds-dfa@0.359.0-canary.3027.31176041121.0 npm install @salutejs/sdds-finai@0.352.0-canary.3027.31176041121.0 npm install @salutejs/sdds-insol@0.356.0-canary.3027.31176041121.0 npm install @salutejs/sdds-insol-next@0.355.0-canary.3027.31176041121.0 npm install @salutejs/sdds-netology@0.360.0-canary.3027.31176041121.0 npm install @salutejs/sdds-os@0.31.0-canary.3027.31176041121.0 npm install @salutejs/sdds-platform-ai@0.360.0-canary.3027.31176041121.0 npm install @salutejs/sdds-sbcom@0.361.0-canary.3027.31176041121.0 npm install @salutejs/sdds-scan@0.359.0-canary.3027.31176041121.0 npm install @salutejs/sdds-serv@0.360.0-canary.3027.31176041121.0 npm install @salutejs/core-themes@0.37.0-canary.3027.31176041121.0 npm install @salutejs/plasma-themes@0.59.0-canary.3027.31176041121.0 npm install @salutejs/sdds-themes@0.74.0-canary.3027.31176041121.0 npm install @salutejs/sdds-api-tests@0.18.0-canary.3027.31176041121.0 npm install @salutejs/plasma-cy-utils@0.166.0-canary.3027.31176041121.0 npm install @salutejs/plasma-sb-utils@0.237.0-canary.3027.31176041121.0 npm install @salutejs/plasma-tokens-utils@0.57.0-canary.3027.31176041121.0 # or yarn add @salutejs/plasma-asdk@0.387.0-canary.3027.31176041121.0 yarn add @salutejs/plasma-b2c@1.629.0-canary.3027.31176041121.0 yarn add @salutejs/plasma-colors@0.18.0-canary.3027.31176041121.0 yarn add @salutejs/plasma-core@1.236.0-canary.3027.31176041121.0 yarn add @salutejs/plasma-giga@0.356.0-canary.3027.31176041121.0 yarn add @salutejs/plasma-homeds@0.356.0-canary.3027.31176041121.0 yarn add @salutejs/plasma-hope@1.383.0-canary.3027.31176041121.0 yarn add @salutejs/plasma-icons@1.245.0-canary.3027.31176041121.0 yarn add @salutejs/plasma-new-hope@0.373.0-canary.3027.31176041121.0 yarn add @salutejs/plasma-tokens@1.147.0-canary.3027.31176041121.0 yarn add @salutejs/plasma-tokens-b2b@1.61.0-canary.3027.31176041121.0 yarn add @salutejs/plasma-tokens-b2c@0.72.0-canary.3027.31176041121.0 yarn add @salutejs/plasma-tokens-core@0.9.0-canary.3027.31176041121.0 yarn add @salutejs/plasma-tokens-web@1.76.0-canary.3027.31176041121.0 yarn add @salutejs/plasma-typo@0.49.0-canary.3027.31176041121.0 yarn add @salutejs/plasma-web@1.631.0-canary.3027.31176041121.0 yarn add @salutejs/sdds-bizcom@0.361.0-canary.3027.31176041121.0 yarn add @salutejs/sdds-cs@0.365.0-canary.3027.31176041121.0 yarn add @salutejs/sdds-dfa@0.359.0-canary.3027.31176041121.0 yarn add @salutejs/sdds-finai@0.352.0-canary.3027.31176041121.0 yarn add @salutejs/sdds-insol@0.356.0-canary.3027.31176041121.0 yarn add @salutejs/sdds-insol-next@0.355.0-canary.3027.31176041121.0 yarn add @salutejs/sdds-netology@0.360.0-canary.3027.31176041121.0 yarn add @salutejs/sdds-os@0.31.0-canary.3027.31176041121.0 yarn add @salutejs/sdds-platform-ai@0.360.0-canary.3027.31176041121.0 yarn add @salutejs/sdds-sbcom@0.361.0-canary.3027.31176041121.0 yarn add @salutejs/sdds-scan@0.359.0-canary.3027.31176041121.0 yarn add @salutejs/sdds-serv@0.360.0-canary.3027.31176041121.0 yarn add @salutejs/core-themes@0.37.0-canary.3027.31176041121.0 yarn add @salutejs/plasma-themes@0.59.0-canary.3027.31176041121.0 yarn add @salutejs/sdds-themes@0.74.0-canary.3027.31176041121.0 yarn add @salutejs/sdds-api-tests@0.18.0-canary.3027.31176041121.0 yarn add @salutejs/plasma-cy-utils@0.166.0-canary.3027.31176041121.0 yarn add @salutejs/plasma-sb-utils@0.237.0-canary.3027.31176041121.0 yarn add @salutejs/plasma-tokens-utils@0.57.0-canary.3027.31176041121.0