-
-
Notifications
You must be signed in to change notification settings - Fork 472
feat(Splitter): add support for pixel sizing and constraints #2362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v2
Are you sure you want to change the base?
Conversation
commit: |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughAdd pixel-based sizing support to the Splitter component. Introduces a Changes
Sequence DiagramsequenceDiagram
participant RO as ResizeObserver
participant SG as SplitterGroup
participant UC as Unit Converter
participant Layout as Layout Engine
participant A11y as Accessibility
RO->>SG: Group element resized
SG->>SG: Update groupSizeInPixels
SG->>UC: getGroupSizeInPixels + panelData
UC->>UC: convertPanelConstraintsToPercent<br/>(px → % conversion)
UC->>SG: Return panelConstraintsInPercent
SG->>Layout: recalculateLayoutForPixelPanels<br/>(prevSize, nextSize)
Layout->>Layout: Recompute percent for px panels<br/>Scale non-px panels to 100%
Layout->>SG: Updated layout array
SG->>A11y: getPanelDataWithPercentConstraints()
A11y->>A11y: Update ARIA values & attributes<br/>for accessibility reflection
SG->>SG: Emit layout change events
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (8)
🔇 Additional comments (22)
✏️ Tip: You can disable this entire section by setting Comment |
This pull request adds pixel-based sizing to the Splitter component, allowing panels to be sized in fixed pixels (
px) alongside the existing percentage (%) support. The changes handle pixel sizing across layout calculations, persistence, collapse/expand operations, and panel constraints, with automatic conversion between units as needed.Changes:
Added a new
sizeUnitprop toSplitterPanelto specify whether a panel uses pixel or percent sizing, with corresponding support throughout the sizing logic. [1] [2] [3]Updated layout calculation and persistence logic to convert between percent and pixel units, ensuring fixed-width panels maintain their size during resizing and when persisting state. [1] [2] [3] [4]
Refactored constraint validation to internally normalize all constraints to percent-based values and recalculate layouts when the container size changes. [1] [2] [3]
Updated collapse and expand operations to store and restore panel sizes in their original unit, converting as needed between percent and pixel values. [1] [2] [3]
Updated documentation with descriptions and examples of the new pixel sizing feature. [1] [2]
Closes #836, #2069
Summary by CodeRabbit
Release Notes
New Features
sizeUnitprop, enabling fixed-size panels alongside fluid panelsDocumentation
✏️ Tip: You can customize this high-level summary in your review settings.