Skip to content

fix(flex): ensure utility styles override component styles (DS-5175) - #438

Merged
KamilEmeleev merged 5 commits into
mainfrom
fix/ds-5175
Aug 3, 2026
Merged

fix(flex): ensure utility styles override component styles (DS-5175)#438
KamilEmeleev merged 5 commits into
mainfrom
fix/ds-5175

Conversation

@KamilEmeleev

@KamilEmeleev KamilEmeleev commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added flexible layout styling for alignment, direction, wrapping, justification, display mode, and gap settings.
    • Added responsive FlexBox utility classes for supported breakpoints.
    • Flex gap now automatically applies to row and column gaps when separate values aren’t specified.
    • Added strongly typed flex layout options for improved configuration support.
  • Bug Fixes

    • Corrected handling of valid order values, including zero.

@KamilEmeleev KamilEmeleev added the bug Something isn't working label Jul 30, 2026
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@KamilEmeleev, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 23 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 89423f9e-0544-4600-bb4d-f2e4be03071c

📥 Commits

Reviewing files that changed from the base of the PR and between ddea296 and e38993e.

📒 Files selected for processing (2)
  • packages/components/src/components/layout/flex/flex.stories.tsx
  • packages/components/src/components/layout/flex/flex.test.ts
📝 Walkthrough

Walkthrough

Flex prop types moved to a shared module. The flex helper now handles order: 0 and gap fallbacks. FlexBox applies CSS module classes directly. New CSS utilities and tests cover layout and responsive breakpoint classes.

Changes

Flex utility migration

Layer / File(s) Summary
Flex contracts and helper behavior
packages/components/src/components/layout/flex/types.ts, packages/components/src/components/layout/flex/flex.ts
Flex prop constants and types are centralized. The helper preserves order: 0 and applies gap to row and column gaps when specific values are absent.
CSS utilities and component wiring
packages/components/src/components/FlexBox/FlexBox.module.css, packages/components/src/components/FlexBox/FlexBox.tsx, packages/components/src/components/layout/flex/index.ts, packages/components/src/components/layout/flex/flex.stories.tsx
FlexBox now applies CSS module classes directly. The CSS module defines layout, direction, alignment, justification, wrapping, and gap classes. The index re-exports the shared types.
Flex behavior validation
packages/components/src/components/layout/flex/flex.test.ts, packages/components/src/components/FlexBox/FlexBox.test.tsx
Tests verify helper output, gap fallback behavior, FlexBox utility classes, and responsive breakpoint classes.

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

🚥 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 clearly and concisely describes the primary change: ensuring Flex utility styles override component styles.
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
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ds-5175

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 Jul 30, 2026

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit e38993e):

https://react-koobiq-next--prs-438-8ws4eeb6.web.app

(expires Sat, 08 Aug 2026 09:29:55 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: fc29847d4a9e5cb1adf458c76a9b681c76e2eeff

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/components/src/components/FlexBox/FlexBox.tsx (1)

48-57: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Forward the order flex prop to the class generator.

order is supported by FlexProps, getFlexClassNames, and the stylesheet, but FlexBox never resolves or passes it here. It is instead forwarded through ...other, so order={1} does not apply kbq-flex-order_1.

Proposed fix
       rowGap: rowGapProp,
+      order: orderProp,
       direction: directionProp,
@@
     const rowGap = getResponsiveValue(rowGapProp, breakpoints);
+    const order = getResponsiveValue(orderProp, breakpoints);
@@
       rowGap,
+      order,
       direction,

Add an order assertion to the FlexBox regression test.

🤖 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/components/src/components/FlexBox/FlexBox.tsx` around lines 48 - 57,
Update the FlexBox component’s getFlexClassNames call to resolve and pass the
supported order prop alongside the other flex properties, preventing it from
being handled only through ...other. Add a regression assertion verifying that
FlexBox with order={1} applies the kbq-flex-order_1 class.
packages/components/src/components/layout/flex/flex.css (1)

1-10: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Reset the row and column gap variables.

gap reads --flex-row-gap and --flex-column-gap, but neither is initialized. Custom properties inherit, so a nested .kbq-flex without a gap prop inherits its parent’s gap. Line 2 initializes an unused variable instead.

Proposed fix
 .kbq-flex {
-  --flex-gap: 0;
+  --flex-row-gap: 0;
+  --flex-column-gap: 0;
   --flex-order: 0;
🤖 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/components/src/components/layout/flex/flex.css` around lines 1 - 10,
Initialize the row and column gap custom properties in the .kbq-flex rule to
zero, replacing the unused --flex-gap declaration. Keep the existing gap
declaration using --flex-row-gap and --flex-column-gap so nested flex elements
reset inherited gaps when no explicit gap is provided.
🧹 Nitpick comments (1)
packages/components/src/components/layout/flex/flex.stories.tsx (1)

15-15: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Import FlexProps type-only.

Split FlexProps into import type { FlexProps } from './index' while retaining runtime imports separately. As per coding guidelines, use import type for type-only imports.

🤖 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/components/src/components/layout/flex/flex.stories.tsx` at line 15,
Update the imports in the Flex story to import FlexProps using a type-only
import, while keeping the runtime imports from ./index in a separate regular
import.

Source: Coding guidelines

🤖 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.

Outside diff comments:
In `@packages/components/src/components/FlexBox/FlexBox.tsx`:
- Around line 48-57: Update the FlexBox component’s getFlexClassNames call to
resolve and pass the supported order prop alongside the other flex properties,
preventing it from being handled only through ...other. Add a regression
assertion verifying that FlexBox with order={1} applies the kbq-flex-order_1
class.

In `@packages/components/src/components/layout/flex/flex.css`:
- Around line 1-10: Initialize the row and column gap custom properties in the
.kbq-flex rule to zero, replacing the unused --flex-gap declaration. Keep the
existing gap declaration using --flex-row-gap and --flex-column-gap so nested
flex elements reset inherited gaps when no explicit gap is provided.

---

Nitpick comments:
In `@packages/components/src/components/layout/flex/flex.stories.tsx`:
- Line 15: Update the imports in the Flex story to import FlexProps using a
type-only import, while keeping the runtime imports from ./index in a separate
regular import.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c31703d4-fc3a-4800-bdff-1ac3f75927a3

📥 Commits

Reviewing files that changed from the base of the PR and between d112224 and cfc84d7.

📒 Files selected for processing (10)
  • packages/components/src/components/FlexBox/FlexBox.test.tsx
  • packages/components/src/components/FlexBox/FlexBox.tsx
  • packages/components/src/components/layout/flex/classNames.ts
  • packages/components/src/components/layout/flex/flex.css
  • packages/components/src/components/layout/flex/flex.stories.tsx
  • packages/components/src/components/layout/flex/flex.test.ts
  • packages/components/src/components/layout/flex/flex.ts
  • packages/components/src/components/layout/flex/index.ts
  • packages/components/src/components/layout/flex/types.ts
  • tools/public_api_guard/components/layout.api.md

@KamilEmeleev

Copy link
Copy Markdown
Collaborator Author

@coderabbitai rate limit

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Your plan includes PR reviews subject to rate limits. Reviews are available now.

@KamilEmeleev

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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: 1

🧹 Nitpick comments (1)
packages/components/src/components/layout/flex/flex.ts (1)

23-27: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Cover order: 0 in the flex class tests.

order supports -1, 0, and 1, and .order_0 exists in the CSS module, but the existing test only covers .order_-1. Add an order: 0 class generation assertion.

🤖 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/components/src/components/layout/flex/flex.ts` around lines 23 - 27,
Update the flex class-generation tests for the order prop to include order: 0
and assert that the generated classes contain the existing .order_0 CSS module
class, while preserving the current coverage for other order values.
🤖 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/components/src/components/FlexBox/FlexBox.module.css`:
- Around line 1-13: Initialize --flex-row-gap and --flex-column-gap to normal
within the .base rule before the gap shorthand declaration, so either per-axis
override from FlexBox remains valid when the other gap is unset.

---

Nitpick comments:
In `@packages/components/src/components/layout/flex/flex.ts`:
- Around line 23-27: Update the flex class-generation tests for the order prop
to include order: 0 and assert that the generated classes contain the existing
.order_0 CSS module class, while preserving the current coverage for other order
values.
🪄 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: bd822419-5121-4684-9198-e6d9948466a9

📥 Commits

Reviewing files that changed from the base of the PR and between cfc84d7 and ddea296.

📒 Files selected for processing (5)
  • packages/components/src/components/FlexBox/FlexBox.module.css
  • packages/components/src/components/FlexBox/FlexBox.test.tsx
  • packages/components/src/components/FlexBox/FlexBox.tsx
  • packages/components/src/components/layout/flex/flex.test.ts
  • packages/components/src/components/layout/flex/flex.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/components/src/components/FlexBox/FlexBox.test.tsx
  • packages/components/src/components/layout/flex/flex.test.ts

Comment thread packages/components/src/components/FlexBox/FlexBox.module.css

Copilot AI 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.

Pull request overview

This PR updates the flex layout mixin and the FlexBox component to improve flex option typing, fix order handling (including 0), and adjust how flex-related classes/styles are generated and exported within the components package.

Changes:

  • Extracted flex prop option constants/types into a dedicated types.ts and re-exported them from the flex entrypoint.
  • Fixed order class application so order={0} is not skipped, and added unit tests for the flex mixin.
  • Refactored FlexBox to generate flex classes from its own CSS Module and added tests for class application (including responsive props).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/components/src/components/layout/flex/types.ts Introduces shared typed flex prop option lists and FlexProps/FlexParams types.
packages/components/src/components/layout/flex/index.ts Re-exports the new types alongside the flex mixin.
packages/components/src/components/layout/flex/flex.ts Fixes order handling so 0 is treated as a valid value when building classnames.
packages/components/src/components/layout/flex/flex.test.ts Adds tests for the flex mixin output (needs explicit coverage for order: 0).
packages/components/src/components/layout/flex/flex.stories.tsx Updates story imports to use the package entrypoint exports.
packages/components/src/components/FlexBox/FlexBox.tsx Refactors FlexBox to apply flex-related CSS module classes directly and aligns gap fallback behavior.
packages/components/src/components/FlexBox/FlexBox.test.tsx Adds assertions for applied classes from direct and responsive props.
packages/components/src/components/FlexBox/FlexBox.module.css Adds a FlexBox-local flex styling module using CSS variables and modifier classes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/components/src/components/FlexBox/FlexBox.module.css
Comment thread packages/components/src/components/layout/flex/flex.test.ts
@KamilEmeleev
KamilEmeleev merged commit 5726788 into main Aug 3, 2026
7 checks passed
@KamilEmeleev
KamilEmeleev deleted the fix/ds-5175 branch August 3, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants