Skip to content

PLASMA-7864: revert Flow - #3023

Open
oki1oki wants to merge 2 commits into
devfrom
PLASMA-7864
Open

PLASMA-7864: revert Flow#3023
oki1oki wants to merge 2 commits into
devfrom
PLASMA-7864

Conversation

@oki1oki

@oki1oki oki1oki commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

SDDS-SCAN

Flow

  • компонент добавлен в поставку

SDDS-SERV

Flow

  • документация компонента добавлена в поставку

What/why changed

  • компонент Flow добавлен в поставку

Summary by CodeRabbit

  • New Features

    • Added the Flow component to the public package exports.
    • Added interactive Storybook examples with controls for layout, orientation, spacing, alignment, and wrapping.
  • Documentation

    • Added Flow component documentation in English and Russian.
    • Included API details, usage guidance, and examples for horizontal and vertical overflow and fixed items-per-line wrapping.

@oki1oki oki1oki self-assigned this Aug 6, 2026
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR exports the Flow component, adds a configurable Storybook story, and adds Flow documentation with examples to the Scan and Serv documentation sites.

Changes

Flow component

Layer / File(s) Summary
Flow export and Storybook coverage
packages/sdds-scan/src/index.ts, packages/sdds-scan/src/components/Flow/Flow.stories.tsx
Flow is now publicly exported. The Storybook story provides controls for layout, dimensions, spacing, alignment, and item count.
Flow documentation examples
website/sdds-scan-docs/docs/components/Flow.mdx, website/sdds-serv-docs/docs/components/Flow.mdx
Both documentation sites describe Flow properties and show horizontal, vertical, and row-limited layouts.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels: changelog-skip

Suggested reviewers: neretin-trike, shuga2704, titankuzmich, yakutoc, yeti-or

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title identifies the Flow component change and matches the pull request objective to restore Flow and its documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch PLASMA-7864

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: dependency version conflict. Check your lock file or package.json.


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.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Theme Builder app deployed!

https://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-3023/

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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/sdds-scan/src/components/Flow/Flow.stories.tsx`:
- Around line 35-39: Constrain the itemsCount control configuration to
non-negative integer values, and update the story’s rendering path to normalize
itemsCount before passing it to new Array. Apply the same validation and
normalization to both itemsCount control definitions, preserving valid
array-length behavior.
- Line 30: Update the Flow story’s meta type from Meta<typeof Flow> to a
Storybook-specific type extending ComponentProps<typeof Flow> with itemsCount,
containerWidth, and containerHeight, then derive the story type with
StoryObj<typeof meta>.
🪄 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: 16ad388c-7cc5-48c5-9986-d25a8094435e

📥 Commits

Reviewing files that changed from the base of the PR and between 54970bf and b197256.

📒 Files selected for processing (4)
  • packages/sdds-scan/src/components/Flow/Flow.stories.tsx
  • packages/sdds-scan/src/index.ts
  • website/sdds-scan-docs/docs/components/Flow.mdx
  • website/sdds-serv-docs/docs/components/Flow.mdx

box-sizing: content-box;
`;

const meta: Meta<typeof Flow> = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

ast-grep outline packages/sdds-scan/src/components/Flow/Flow.ts --items all
rg -n -C 3 '\b(itemsCount|containerWidth|containerHeight)\b' \
  packages/sdds-scan/src/components/Flow

Repository: salute-developers/plasma

Length of output: 3904


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- package metadata / storybook version ---\n'
for f in package.json pnpm-lock.yaml yarn.lock package-lock.json; do
  if [ -f "$f" ]; then
    echo "### $f"
    if [ "$f" = "package.json" ]; then
      jq -r '.dependencies["`@storybook/react`"], .devDependencies["`@storybook/react`"], .devDependencies.storybook, .dependencies.storybook' "$f" 2>/dev/null || rg -n '"(`@storybook/react`|storybook)"' "$f" || true
    else
      rg -n '`@storybook/react`|storybook' "$f" | head -80 || true
    fi
  fi
done

printf '\n--- Flow stories imports and meta/story/render ---\n'
sed -n '1,140p' packages/sdds-scan/src/components/Flow/Flow.stories.tsx | cat -n

printf '\n--- Flow config/props references ---\n'
sed -n '1,260p' packages/sdds-

Repository: salute-developers/plasma

Length of output: 253


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- package metadata / Storybook version ---'
for f in package.json pnpm-lock.yaml yarn.lock package-lock.json; do
  if [ -f "$f" ]; then
    printf '%s\n' "### $f"
    if [ "$f" = "package.json" ]; then
      jq -r '.dependencies["`@storybook/react`"], .devDependencies["`@storybook/react`"], .devDependencies.storybook, .dependencies.storybook' "$f" 2>/dev/null || rg -n '"(`@storybook/react`|storybook)"' "$f" || true
    else
      rg -n '`@storybook/react`|storybook' "$f" | head -80 || true
    fi
  fi
done

printf '%s\n' ''
printf '%s\n' '--- Flow stories imports and meta/story/render ---'
sed -n '1,145p' packages/sdds-scan/src/components/Flow/Flow.stories.tsx | cat -n

printf '%s\n' ''
printf '%s\n' '--- Flow config/props references ---'
sed -n '1,260p' packages/sdds-scan/src/components/Flow/Flow.config.ts 2>/dev/null | cat -n || true
sed -n '1,40p' packages/sdds-scan/src/components/Flow/Flow.ts | cat -n || true

printf '%s\n' ''
printf '%s\n' '--- package.json package-specific ts/storybook deps ---'
if [ -f package.json ]; then jq '.scripts, .dependencies, .devDependencies' package.json | rg -n '"(storybook|`@storybook/react`|typescript|eslint|`@typescript-eslint`|prettier|typescript-eslint|eslint)\b|build-storybook|storybook"' -C 2 || true; fi

Repository: salute-developers/plasma

Length of output: 11904


🌐 Web query:

@storybook/react Metas generic component satisfies Meta<T> story args generic

💡 Result:

In Storybook for React, using the satisfies Meta pattern correctly connects your component's type or props interface to Storybook's metadata, enabling robust TypeScript inference [1][2]. When you define your default export with satisfies Meta, TypeScript validates that the component prop and any args provided in the meta object match the component's actual interface [1][3]. Key aspects of this pattern include: 1. Type Inference: By using satisfies Meta (or passing a specific Props interface instead of typeof Component), you gain full type-checking for args at both the meta level and the individual story level [1][4]. 2. StoryObj Connection: The standard practice is to then define your story type as type Story = StoryObj [1][5]. By passing the meta type (rather than the component type) to StoryObj, TypeScript understands the relationship between your meta-level args and story-level args, preventing errors when required properties are already provided in the meta configuration [1][2]. 3. Custom Args: If your component has custom props or you are using extended args, you can pass the specific type to Meta, such as satisfies Meta<ComponentProps & { customArg: string }> [6][7]. This ensures that any custom arguments are type-safe and available in your story render functions [6][4]. This approach is the recommended pattern in modern Storybook (CSF3+) to ensure that TypeScript provides helpful warnings for missing required arguments or invalid property assignments [8][2].

Citations:


Add Storybook-only args to the story type.

Meta<typeof Flow> validates args against Flow props, so itemsCount, containerWidth, and containerHeight do not pass as story args. Use a Story-specific type, e.g. Meta<ComponentProps<typeof Flow> & { itemsCount: number; containerWidth: string; containerHeight: string }>, and derive StoryObj<typeof meta>.

🤖 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/sdds-scan/src/components/Flow/Flow.stories.tsx` at line 30, Update
the Flow story’s meta type from Meta<typeof Flow> to a Storybook-specific type
extending ComponentProps<typeof Flow> with itemsCount, containerWidth, and
containerHeight, then derive the story type with StoryObj<typeof meta>.

Comment on lines +35 to +39
itemsCount: {
control: {
type: 'number',
},
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Constrain itemsCount to valid array lengths.

A negative or fractional value from the number control makes new Array(itemsCount) throw. Limit the control to non-negative integers and normalize the value before rendering.

Proposed fix
         itemsCount: {
             control: {
                 type: 'number',
+                min: 0,
+                max: 24,
+                step: 1,
             },
         },
@@
     render: ({ itemsCount, containerWidth, containerHeight, ...args }: ComponentProps<typeof Flow>) => {
         const hasLines = Boolean(args.itemsPerLine);
+        const safeItemsCount = Math.min(24, Math.max(0, Math.trunc(itemsCount || 0)));
 
         return (
             <FlowCustom {...args} style={{ width: containerWidth, height: containerHeight }}>
-                {new Array(itemsCount).fill(null).map((width, index) => (
+                {new Array(safeItemsCount).fill(null).map((width, index) => (

Also applies to: 109-113

🤖 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/sdds-scan/src/components/Flow/Flow.stories.tsx` around lines 35 -
39, Constrain the itemsCount control configuration to non-negative integer
values, and update the story’s rendering path to normalize itemsCount before
passing it to new Array. Apply the same validation and normalization to both
itemsCount control definitions, preserving valid array-length behavior.

@Yakutoc
Yakutoc removed the request for review from TitanKuzmich August 7, 2026 04:33

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@oki1oki А для sdds-serv не вижу, что добавлен import и re-export

@oki1oki oki1oki Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

У sdds-serv не было только доки, импорты и сторибук корректны

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants