PLASMA-7798: update animations (sdds-sbcom) - #3015
Conversation
📝 WalkthroughWalkthroughThe PR adds animation CSS hooks for components, improves switch thumb motion and TextArea controlled-value handling, introduces animated selection indicators for horizontal and vertical Tabs, updates SBCOM tab styling, and documents animation customization examples. ChangesComponent animation and input behavior
Tab selection and theme configuration
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Tabs
participant useTabsSelection
participant ResizeObserver
participant TabsSelection
Tabs->>useTabsSelection: Pass content track ref
useTabsSelection->>ResizeObserver: Observe track and selected item
ResizeObserver-->>useTabsSelection: Report size changes
useTabsSelection-->>TabsSelection: Return selection geometry and styles
TabsSelection-->>Tabs: Render orientation-specific indicator
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 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 |
|
Theme Builder app deployed! https://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-3015/ |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/Tabs/ui/hooks/useTabsSelection.ts`:
- Around line 71-75: Update the setSelection bailout in useTabsSelection to
compare the complete selection state, not only previous.geometry and
nextSelection.geometry, including backgroundColor, divider properties,
borderRadius, opacity, and any other selection fields. Retain previous only when
all selection properties are unchanged; otherwise return nextSelection.
🪄 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: 2e53322c-28dc-464c-b58f-c517bbaf2dc8
📒 Files selected for processing (33)
packages/plasma-new-hope/src/components/Avatar/Avatar.tokens.tspackages/plasma-new-hope/src/components/Avatar/Avatar.tsxpackages/plasma-new-hope/src/components/Spinner/Spinner.tokens.tspackages/plasma-new-hope/src/components/Spinner/Spinner.tsxpackages/plasma-new-hope/src/components/Switch/Switch.styles.tspackages/plasma-new-hope/src/components/Switch/Switch.tokens.tspackages/plasma-new-hope/src/components/Switch/Switch.tsxpackages/plasma-new-hope/src/components/Switch/_toggleSize/base.tspackages/plasma-new-hope/src/components/Tabs/tokens.tspackages/plasma-new-hope/src/components/Tabs/ui/TabsSelection.styles.tspackages/plasma-new-hope/src/components/Tabs/ui/TabsSelection.tsxpackages/plasma-new-hope/src/components/Tabs/ui/hooks/useTabsSelection.tspackages/plasma-new-hope/src/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.styles.tspackages/plasma-new-hope/src/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.tsxpackages/plasma-new-hope/src/components/Tabs/ui/vertical/VerticalTabs/VerticalTabs.styles.tspackages/plasma-new-hope/src/components/Tabs/ui/vertical/VerticalTabs/VerticalTabs.tsxpackages/plasma-new-hope/src/components/TextArea/TextArea.tsxpackages/plasma-new-hope/src/components/TextField/TextField.tokens.tspackages/plasma-new-hope/src/components/TextField/TextField.tsxpackages/plasma-new-hope/src/components/TextField/variations/_label-placement/base.tspackages/sdds-sbcom/src/components/Switch/Switch.config.tspackages/sdds-sbcom/src/components/Tabs/horizontal/HorizontalIconTabItem.config.tspackages/sdds-sbcom/src/components/Tabs/horizontal/HorizontalTabItem.config.tspackages/sdds-sbcom/src/components/Tabs/horizontal/HorizontalTabs.config.tspackages/sdds-sbcom/src/components/Tabs/vertical/VerticalIconTabItem.config.tspackages/sdds-sbcom/src/components/Tabs/vertical/VerticalTabItem.config.tswebsite/sdds-sbcom-docs/docs/components/Avatar.mdxwebsite/sdds-sbcom-docs/docs/components/Button.mdxwebsite/sdds-sbcom-docs/docs/components/Loader.mdxwebsite/sdds-sbcom-docs/docs/components/Switch.mdxwebsite/sdds-sbcom-docs/docs/components/Tabs.mdxwebsite/sdds-sbcom-docs/docs/components/TextArea.mdxwebsite/sdds-sbcom-docs/docs/components/TextField.mdx
| setSelection((previous) => | ||
| !itemChanged && previous && isSameGeometry(previous.geometry, nextSelection.geometry) | ||
| ? previous | ||
| : nextSelection, | ||
| ); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Compare all selection properties before retaining state.
The bailout checks only geometry. A change to backgroundColor, divider properties, borderRadius, or opacity with unchanged geometry keeps stale props on TabsSelection.
Proposed fix
- !itemChanged && previous && isSameGeometry(previous.geometry, nextSelection.geometry)
+ !itemChanged &&
+ previous &&
+ isSameGeometry(previous.geometry, nextSelection.geometry) &&
+ previous.backgroundColor === nextSelection.backgroundColor &&
+ previous.backgroundColorHover === nextSelection.backgroundColorHover &&
+ previous.borderRadius === nextSelection.borderRadius &&
+ previous.dividerColor === nextSelection.dividerColor &&
+ previous.dividerColorHover === nextSelection.dividerColorHover &&
+ previous.dividerHeight === nextSelection.dividerHeight &&
+ previous.dividerWidth === nextSelection.dividerWidth &&
+ previous.opacity === nextSelection.opacity📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| setSelection((previous) => | |
| !itemChanged && previous && isSameGeometry(previous.geometry, nextSelection.geometry) | |
| ? previous | |
| : nextSelection, | |
| ); | |
| setSelection((previous) => | |
| !itemChanged && | |
| previous && | |
| isSameGeometry(previous.geometry, nextSelection.geometry) && | |
| previous.backgroundColor === nextSelection.backgroundColor && | |
| previous.backgroundColorHover === nextSelection.backgroundColorHover && | |
| previous.borderRadius === nextSelection.borderRadius && | |
| previous.dividerColor === nextSelection.dividerColor && | |
| previous.dividerColorHover === nextSelection.dividerColorHover && | |
| previous.dividerHeight === nextSelection.dividerHeight && | |
| previous.dividerWidth === nextSelection.dividerWidth && | |
| previous.opacity === nextSelection.opacity | |
| ? previous | |
| : nextSelection, | |
| ); |
🤖 Prompt for 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.
In `@packages/plasma-new-hope/src/components/Tabs/ui/hooks/useTabsSelection.ts`
around lines 71 - 75, Update the setSelection bailout in useTabsSelection to
compare the complete selection state, not only previous.geometry and
nextSelection.geometry, including backgroundColor, divider properties,
borderRadius, opacity, and any other selection fields. Retain previous only when
all selection properties are unchanged; otherwise return nextSelection.
SDDS-SBCOM
Avatar, Button, Loader, Switch, TextField, TextArea, Tabs
What/why changed
📦 Published PR as canary version:
Canary Versions✨ Test out this PR locally via:
npm install @salutejs/plasma-asdk@0.387.0-canary.3015.31185964477.0 npm install @salutejs/plasma-b2c@1.629.0-canary.3015.31185964477.0 npm install @salutejs/plasma-colors@0.18.0-canary.3015.31185964477.0 npm install @salutejs/plasma-core@1.236.0-canary.3015.31185964477.0 npm install @salutejs/plasma-giga@0.356.0-canary.3015.31185964477.0 npm install @salutejs/plasma-homeds@0.356.0-canary.3015.31185964477.0 npm install @salutejs/plasma-hope@1.383.0-canary.3015.31185964477.0 npm install @salutejs/plasma-icons@1.245.0-canary.3015.31185964477.0 npm install @salutejs/plasma-new-hope@0.373.0-canary.3015.31185964477.0 npm install @salutejs/plasma-tokens@1.147.0-canary.3015.31185964477.0 npm install @salutejs/plasma-tokens-b2b@1.61.0-canary.3015.31185964477.0 npm install @salutejs/plasma-tokens-b2c@0.72.0-canary.3015.31185964477.0 npm install @salutejs/plasma-tokens-core@0.9.0-canary.3015.31185964477.0 npm install @salutejs/plasma-tokens-web@1.76.0-canary.3015.31185964477.0 npm install @salutejs/plasma-typo@0.49.0-canary.3015.31185964477.0 npm install @salutejs/plasma-web@1.631.0-canary.3015.31185964477.0 npm install @salutejs/sdds-bizcom@0.361.0-canary.3015.31185964477.0 npm install @salutejs/sdds-cs@0.365.0-canary.3015.31185964477.0 npm install @salutejs/sdds-dfa@0.359.0-canary.3015.31185964477.0 npm install @salutejs/sdds-finai@0.352.0-canary.3015.31185964477.0 npm install @salutejs/sdds-insol@0.356.0-canary.3015.31185964477.0 npm install @salutejs/sdds-insol-next@0.355.0-canary.3015.31185964477.0 npm install @salutejs/sdds-netology@0.360.0-canary.3015.31185964477.0 npm install @salutejs/sdds-os@0.31.0-canary.3015.31185964477.0 npm install @salutejs/sdds-platform-ai@0.360.0-canary.3015.31185964477.0 npm install @salutejs/sdds-sbcom@0.361.0-canary.3015.31185964477.0 npm install @salutejs/sdds-scan@0.359.0-canary.3015.31185964477.0 npm install @salutejs/sdds-serv@0.360.0-canary.3015.31185964477.0 npm install @salutejs/core-themes@0.37.0-canary.3015.31185964477.0 npm install @salutejs/plasma-themes@0.59.0-canary.3015.31185964477.0 npm install @salutejs/sdds-themes@0.74.0-canary.3015.31185964477.0 npm install @salutejs/sdds-api-tests@0.18.0-canary.3015.31185964477.0 npm install @salutejs/plasma-cy-utils@0.166.0-canary.3015.31185964477.0 npm install @salutejs/plasma-sb-utils@0.237.0-canary.3015.31185964477.0 npm install @salutejs/plasma-tokens-utils@0.57.0-canary.3015.31185964477.0 # or yarn add @salutejs/plasma-asdk@0.387.0-canary.3015.31185964477.0 yarn add @salutejs/plasma-b2c@1.629.0-canary.3015.31185964477.0 yarn add @salutejs/plasma-colors@0.18.0-canary.3015.31185964477.0 yarn add @salutejs/plasma-core@1.236.0-canary.3015.31185964477.0 yarn add @salutejs/plasma-giga@0.356.0-canary.3015.31185964477.0 yarn add @salutejs/plasma-homeds@0.356.0-canary.3015.31185964477.0 yarn add @salutejs/plasma-hope@1.383.0-canary.3015.31185964477.0 yarn add @salutejs/plasma-icons@1.245.0-canary.3015.31185964477.0 yarn add @salutejs/plasma-new-hope@0.373.0-canary.3015.31185964477.0 yarn add @salutejs/plasma-tokens@1.147.0-canary.3015.31185964477.0 yarn add @salutejs/plasma-tokens-b2b@1.61.0-canary.3015.31185964477.0 yarn add @salutejs/plasma-tokens-b2c@0.72.0-canary.3015.31185964477.0 yarn add @salutejs/plasma-tokens-core@0.9.0-canary.3015.31185964477.0 yarn add @salutejs/plasma-tokens-web@1.76.0-canary.3015.31185964477.0 yarn add @salutejs/plasma-typo@0.49.0-canary.3015.31185964477.0 yarn add @salutejs/plasma-web@1.631.0-canary.3015.31185964477.0 yarn add @salutejs/sdds-bizcom@0.361.0-canary.3015.31185964477.0 yarn add @salutejs/sdds-cs@0.365.0-canary.3015.31185964477.0 yarn add @salutejs/sdds-dfa@0.359.0-canary.3015.31185964477.0 yarn add @salutejs/sdds-finai@0.352.0-canary.3015.31185964477.0 yarn add @salutejs/sdds-insol@0.356.0-canary.3015.31185964477.0 yarn add @salutejs/sdds-insol-next@0.355.0-canary.3015.31185964477.0 yarn add @salutejs/sdds-netology@0.360.0-canary.3015.31185964477.0 yarn add @salutejs/sdds-os@0.31.0-canary.3015.31185964477.0 yarn add @salutejs/sdds-platform-ai@0.360.0-canary.3015.31185964477.0 yarn add @salutejs/sdds-sbcom@0.361.0-canary.3015.31185964477.0 yarn add @salutejs/sdds-scan@0.359.0-canary.3015.31185964477.0 yarn add @salutejs/sdds-serv@0.360.0-canary.3015.31185964477.0 yarn add @salutejs/core-themes@0.37.0-canary.3015.31185964477.0 yarn add @salutejs/plasma-themes@0.59.0-canary.3015.31185964477.0 yarn add @salutejs/sdds-themes@0.74.0-canary.3015.31185964477.0 yarn add @salutejs/sdds-api-tests@0.18.0-canary.3015.31185964477.0 yarn add @salutejs/plasma-cy-utils@0.166.0-canary.3015.31185964477.0 yarn add @salutejs/plasma-sb-utils@0.237.0-canary.3015.31185964477.0 yarn add @salutejs/plasma-tokens-utils@0.57.0-canary.3015.31185964477.0Summary by CodeRabbit