PLASMA-7394: add custom width/height props for StepItem#2902
PLASMA-7394: add custom width/height props for StepItem#2902TitanKuzmich wants to merge 3 commits into
Conversation
📝 WalkthroughWalkthroughAdds optional ChangesSteps Per-Step Sizing and Documentation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
|
Theme Builder app deployed! https://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-2902/ |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
website/sdds-finai-docs/docs/components/Steps.mdx (1)
415-417:⚠️ Potential issue | 🟡 MinorFix
prevIndextype annotation to match undefined check.Line 415 declares
prevIndexasnumber, but line 416 checksif (prevIndex !== undefined). The parameter should be typed asprevIndex?: numberto accurately reflect that it can be undefined.Suggested fix
- const onChange = (item: StepItemProps, index: number, prevIndex: number) => { + const onChange = (item: StepItemProps, index: number, prevIndex?: number) => {🤖 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 `@website/sdds-finai-docs/docs/components/Steps.mdx` around lines 415 - 417, The onChange function parameter prevIndex is declared as type number but the code immediately checks if prevIndex is undefined, which is incompatible with the current type annotation. Update the prevIndex parameter declaration to use the optional type syntax prevIndex?: number to accurately reflect that this parameter can be undefined, allowing the subsequent undefined check to be valid TypeScript.
🤖 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/Steps/Steps.template-doc.mdx`:
- Around line 415-416: The template documentation has two typing and logic
issues in the Steps examples. First, update the `onChange` callback function
signature to make the `prevIndex` parameter optional by changing `prevIndex:
number` to `prevIndex?: number` to match the actual component contract where
this value can be undefined. Second, in the onClick handler that increments
`current`, add bounds checking to prevent the active step from exceeding the
array length by replacing the simple increment with `Math.min(value + 1,
items.length - 1)` to clamp the value to the valid range.
In `@website/sdds-finai-docs/docs/components/Steps.mdx`:
- Around line 450-452: The onClick function uses a functional updater pattern
with setCurrent but incorrectly references the closure variable current instead
of the updater parameter, which can cause dropped increments during rapid
interactions or batched updates. Replace the onClick function definition to use
the state parameter passed to the updater function instead of the closure
variable, so that setCurrent properly uses the most recent state value. Apply
this fix to all 13 documentation sites listed by updating the line in each
Steps.mdx file where onClick is defined with setCurrent.
---
Outside diff comments:
In `@website/sdds-finai-docs/docs/components/Steps.mdx`:
- Around line 415-417: The onChange function parameter prevIndex is declared as
type number but the code immediately checks if prevIndex is undefined, which is
incompatible with the current type annotation. Update the prevIndex parameter
declaration to use the optional type syntax prevIndex?: number to accurately
reflect that this parameter can be undefined, allowing the subsequent undefined
check to be valid TypeScript.
🪄 Autofix (Beta)
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: 140858cb-fc75-48d2-b6fb-95909a53342d
⛔ Files ignored due to path filters (88)
cypress/snapshots/b2c/chromium/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/b2c/chromium/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/b2c/chromium/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/b2c/chromium/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/b2c/webkit/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/b2c/webkit/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/b2c/webkit/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/b2c/webkit/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/cs/chromium/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/cs/chromium/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/cs/chromium/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/cs/chromium/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/cs/webkit/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/cs/webkit/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/cs/webkit/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/cs/webkit/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/dfa/chromium/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/dfa/chromium/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/dfa/chromium/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/dfa/chromium/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/dfa/webkit/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/dfa/webkit/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/dfa/webkit/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/dfa/webkit/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/finai/chromium/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/finai/chromium/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/finai/chromium/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/finai/chromium/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/finai/webkit/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/finai/webkit/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/finai/webkit/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/finai/webkit/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/giga/chromium/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/giga/chromium/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/giga/chromium/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/giga/chromium/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/giga/webkit/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/giga/webkit/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/giga/webkit/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/giga/webkit/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/homeds/chromium/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/homeds/chromium/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/homeds/chromium/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/homeds/chromium/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/homeds/webkit/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/homeds/webkit/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/homeds/webkit/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/homeds/webkit/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/insol/chromium/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/insol/chromium/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/insol/chromium/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/insol/chromium/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/insol/webkit/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/insol/webkit/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/insol/webkit/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/insol/webkit/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/os/chromium/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/os/chromium/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/os/chromium/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/os/chromium/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/os/webkit/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/os/webkit/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/os/webkit/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/os/webkit/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/platform-ai/chromium/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/platform-ai/chromium/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/platform-ai/chromium/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/platform-ai/chromium/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/platform-ai/webkit/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/platform-ai/webkit/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/platform-ai/webkit/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/platform-ai/webkit/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/serv/chromium/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/serv/chromium/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/serv/chromium/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/serv/chromium/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/serv/webkit/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/serv/webkit/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/serv/webkit/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/serv/webkit/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/web/chromium/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/web/chromium/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/web/chromium/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/web/chromium/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/web/webkit/Steps/Steps -- custom height, orientation=vertical.snap.pngis excluded by!**/*.pngcypress/snapshots/web/webkit/Steps/Steps -- custom step item view.snap.pngis excluded by!**/*.pngcypress/snapshots/web/webkit/Steps/Steps -- custom width, orientation=horizontal.snap.pngis excluded by!**/*.pngcypress/snapshots/web/webkit/Steps/Steps -- status, orientation=vertical.snap.pngis excluded by!**/*.png
📒 Files selected for processing (21)
packages/plasma-new-hope/src/components/Steps/Steps.component-test.tsxpackages/plasma-new-hope/src/components/Steps/Steps.template-doc.mdxpackages/plasma-new-hope/src/components/Steps/Steps.tokens.tspackages/plasma-new-hope/src/components/Steps/Steps.tsxpackages/plasma-new-hope/src/components/Steps/ui/StepItem/StepItem.styles.tspackages/plasma-new-hope/src/components/Steps/ui/StepItem/StepItem.tsxpackages/plasma-new-hope/src/components/Steps/ui/StepItem/StepItem.types.tsutils/plasma-sb-utils/src/components/Steps/Steps.tsxwebsite/plasma-b2c-docs/docs/components/Steps.mdxwebsite/plasma-giga-docs/docs/components/Steps.mdxwebsite/plasma-homeds-docs/docs/components/Steps.mdxwebsite/plasma-web-docs/docs/components/Steps.mdxwebsite/sdds-bizcom-docs/docs/components/Steps.mdxwebsite/sdds-cs-docs/docs/components/Steps.mdxwebsite/sdds-dfa-docs/docs/components/Steps.mdxwebsite/sdds-finai-docs/docs/components/Steps.mdxwebsite/sdds-insol-docs/docs/components/Steps.mdxwebsite/sdds-netology-docs/docs/components/Steps.mdxwebsite/sdds-platform-ai-docs/docs/components/Steps.mdxwebsite/sdds-sbcom-docs/docs/components/Steps.mdxwebsite/sdds-serv-docs/docs/components/Steps.mdx
b78c144 to
692cef2
Compare
692cef2 to
400db2b
Compare
Core
Steps
What/why changed
Summary by CodeRabbit
New Features
heightandwidthproperties for individual steps.Documentation
Tests
📦 Published PR as canary version:
Canary Versions✨ Test out this PR locally via:
npm install @salutejs/plasma-asdk@0.381.0-canary.2902.27826903346.0 npm install @salutejs/plasma-b2c@1.623.0-canary.2902.27826903346.0 npm install @salutejs/plasma-core@1.230.0-canary.2902.27826903346.0 npm install @salutejs/plasma-giga@0.350.0-canary.2902.27826903346.0 npm install @salutejs/plasma-homeds@0.350.0-canary.2902.27826903346.0 npm install @salutejs/plasma-hope@1.377.0-canary.2902.27826903346.0 npm install @salutejs/plasma-new-hope@0.367.0-canary.2902.27826903346.0 npm install @salutejs/plasma-ui@1.353.0-canary.2902.27826903346.0 npm install @salutejs/plasma-web@1.625.0-canary.2902.27826903346.0 npm install @salutejs/sdds-bizcom@0.355.0-canary.2902.27826903346.0 npm install @salutejs/sdds-cs@0.359.0-canary.2902.27826903346.0 npm install @salutejs/sdds-dfa@0.353.0-canary.2902.27826903346.0 npm install @salutejs/sdds-finai@0.346.0-canary.2902.27826903346.0 npm install @salutejs/sdds-insol@0.350.0-canary.2902.27826903346.0 npm install @salutejs/sdds-netology@0.354.0-canary.2902.27826903346.0 npm install @salutejs/sdds-os@0.25.0-canary.2902.27826903346.0 npm install @salutejs/sdds-platform-ai@0.354.0-canary.2902.27826903346.0 npm install @salutejs/sdds-sbcom@0.355.0-canary.2902.27826903346.0 npm install @salutejs/sdds-scan@0.353.0-canary.2902.27826903346.0 npm install @salutejs/sdds-serv@0.354.0-canary.2902.27826903346.0 npm install @salutejs/sdds-api-tests@0.12.0-canary.2902.27826903346.0 npm install @salutejs/plasma-cy-utils@0.160.0-canary.2902.27826903346.0 npm install @salutejs/plasma-sb-utils@0.231.0-canary.2902.27826903346.0 # or yarn add @salutejs/plasma-asdk@0.381.0-canary.2902.27826903346.0 yarn add @salutejs/plasma-b2c@1.623.0-canary.2902.27826903346.0 yarn add @salutejs/plasma-core@1.230.0-canary.2902.27826903346.0 yarn add @salutejs/plasma-giga@0.350.0-canary.2902.27826903346.0 yarn add @salutejs/plasma-homeds@0.350.0-canary.2902.27826903346.0 yarn add @salutejs/plasma-hope@1.377.0-canary.2902.27826903346.0 yarn add @salutejs/plasma-new-hope@0.367.0-canary.2902.27826903346.0 yarn add @salutejs/plasma-ui@1.353.0-canary.2902.27826903346.0 yarn add @salutejs/plasma-web@1.625.0-canary.2902.27826903346.0 yarn add @salutejs/sdds-bizcom@0.355.0-canary.2902.27826903346.0 yarn add @salutejs/sdds-cs@0.359.0-canary.2902.27826903346.0 yarn add @salutejs/sdds-dfa@0.353.0-canary.2902.27826903346.0 yarn add @salutejs/sdds-finai@0.346.0-canary.2902.27826903346.0 yarn add @salutejs/sdds-insol@0.350.0-canary.2902.27826903346.0 yarn add @salutejs/sdds-netology@0.354.0-canary.2902.27826903346.0 yarn add @salutejs/sdds-os@0.25.0-canary.2902.27826903346.0 yarn add @salutejs/sdds-platform-ai@0.354.0-canary.2902.27826903346.0 yarn add @salutejs/sdds-sbcom@0.355.0-canary.2902.27826903346.0 yarn add @salutejs/sdds-scan@0.353.0-canary.2902.27826903346.0 yarn add @salutejs/sdds-serv@0.354.0-canary.2902.27826903346.0 yarn add @salutejs/sdds-api-tests@0.12.0-canary.2902.27826903346.0 yarn add @salutejs/plasma-cy-utils@0.160.0-canary.2902.27826903346.0 yarn add @salutejs/plasma-sb-utils@0.231.0-canary.2902.27826903346.0