Skip to content

feat(Panel, CompassPanel): Removed CompassPanel component. Updated Panel component for use in with compass#12372

Open
tlabaj wants to merge 1 commit intopatternfly:mainfrom
tlabaj:panel_compass
Open

feat(Panel, CompassPanel): Removed CompassPanel component. Updated Panel component for use in with compass#12372
tlabaj wants to merge 1 commit intopatternfly:mainfrom
tlabaj:panel_compass

Conversation

@tlabaj
Copy link
Copy Markdown
Contributor

@tlabaj tlabaj commented Apr 22, 2026

What: Closes #

Summary

Replaces the Compass-specific CompassPanel wrapper with the shared Panel API and extends Panel with several layout/style modifiers. Compass examples and the CompassMainHeader title/toolbar path now use PanelPanelMainPanelMainBody. Panel docs and tests are updated to match.

Compass

  • Removed CompassPanel and its unit tests / snapshots; dropped its export from Compass / package surface.
  • CompassMainHeader: Renders the title/toolbar layout with Panel, PanelMain, and PanelMainBody around CompassMainHeaderContent. The compassPanelProps object is typed as Omit<PanelProps, 'children'> (replaces CompassPanelProps).
  • Docs & examples: Compass.md and structure examples now describe Panel / PanelMain / PanelMainBody instead of CompassPanel.
  • JSDoc: CompassContent and CompassMainHeaderContent text updated to reference the Panel stack.
  • Tests: CompassMainHeader tests and snapshots expect the Panel root (e.g. pf-v6-c-panel) instead of the old compass panel class.
  • Demos: CompassBasic, CompassDockLayout, CompassDemo, and CompassDockDemo use the Panel stack. CompassDemo: Restores prior CompassPanel behavior by passing isPill on Panel where the old code used isPill, and using style={{ padding: 0 }} on PanelMainBody where the old code used hasNoPadding (no hasNoPadding on Panel in core today).

Panel

New optional props (JSDoc @beta) on Panel, applied via css() and existing PatternFly pf-m-* modifiers in @patternfly/react-styles:

Prop Modifier
hasNoBorder pf-m-no-border
isFullHeight pf-m-full-height
isGlass pf-m-glass
isAutoHeight pf-m-scrollable-auto-height
isPill pf-m-pill

(isScrollable / variant remain as before.)

Panel — docs & examples

  • PanelPill.tsx: Pill Panel with a single “Main content” line in the body.
  • PanelScrollableWithAutoHeight.tsx: Scrollable panel with auto height in a short parent container.
  • Panel.md: New sections for Pill and Scrollable with auto height (and ordering adjusted vs. “Scrollable” / “Scrollable with header and footer” as implemented).

Panel — tests

  • import '@testing-library/jest-dom' so toBeVisible / toHaveClass / etc. are typed and available.
  • Unit tests for each new boolean: class present when true, absent when false / undefined.
  • Snapshots for representative combinations (e.g. hasNoBorder, isFullHeight, isGlass, isAutoHeight with isScrollable, isPill).

Breaking changes

  • CompassPanel is removed; consumers should use Panel + PanelMain + PanelMainBody (and compassPanelProps now matches Panel only — old CompassPanel-only flags like isPill / hasNoBorder on that API are now expressed with Panel props or, for “no body padding,” via PanelMainBody / layout as needed).

Summary by CodeRabbit

  • New Features

    • Added beta props to Panel: isAutoHeight, hasNoBorder, isFullHeight, isGlass, and isPill for additional visual variants.
    • Added new Panel examples demonstrating scrollable with auto height and pill configurations.
  • Breaking Changes

    • Removed CompassPanel component; use PatternFly Panel component instead.
  • Documentation

    • Updated Compass examples to use Panel component composition.

@tlabaj tlabaj requested review from a team, mcoker, nicolethoen and wise-king-sullyman and removed request for a team April 22, 2026 20:19
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

Walkthrough

The PR removes the CompassPanel component and replaces its usage across the Compass suite with the shared Panel component. New optional modifier props (isPill, hasNoBorder, isFullHeight, isGlass, isAutoHeight) are added to Panel. All Compass components, examples, demos, and tests are updated accordingly. PatternFly dependency is bumped to 6.5.0-prerelease.72 across packages.

Changes

Cohort / File(s) Summary
Package version updates
packages/react-core/package.json, packages/react-docs/package.json, packages/react-styles/package.json, packages/react-tokens/package.json
Bumped @patternfly/patternfly from 6.5.0-prerelease.71 to 6.5.0-prerelease.72 in devDependencies.
CompassPanel removal
packages/react-core/src/components/Compass/CompassPanel.tsx, packages/react-core/src/components/Compass/index.ts
Deleted entire CompassPanel component and its export; removed CompassPanelProps interface and related Compass-specific modifiers.
Compass component updates
packages/react-core/src/components/Compass/CompassContent.tsx, packages/react-core/src/components/Compass/CompassMainHeader.tsx, packages/react-core/src/components/Compass/CompassMainHeaderContent.tsx
Updated JSDoc and props to reference Panel instead of CompassPanel; CompassMainHeader.compassPanelProps type changed from Omit<CompassPanelProps, 'children'> to Omit<PanelProps, 'children'> with updated JSX wrapper structure.
Compass test updates
packages/react-core/src/components/Compass/__tests__/CompassMainHeader.test.tsx, packages/react-core/src/components/Compass/__tests__/CompassPanel.test.tsx
Updated CompassMainHeader tests to validate Panel style classes; removed all 86 lines of CompassPanel test coverage.
Panel component enhancements
packages/react-core/src/components/Panel/Panel.tsx, packages/react-core/src/components/Panel/__tests__/Panel.test.tsx
Added @beta modifier props (isAutoHeight, hasNoBorder, isFullHeight, isGlass, isPill) to PanelProps; expanded test coverage with behavioral and snapshot tests for new modifiers.
Panel documentation and examples
packages/react-core/src/components/Panel/examples/Panel.md, packages/react-core/src/components/Panel/examples/PanelPill.tsx, packages/react-core/src/components/Panel/examples/PanelScrollableWithAutoHeight.tsx
Added references to new "Pill" and "Scrollable with auto height" examples; created corresponding example components showcasing new Panel modifiers.
Compass examples and documentation
packages/react-core/src/components/Compass/examples/Compass.md, packages/react-core/src/components/Compass/examples/CompassBasic.tsx, packages/react-core/src/components/Compass/examples/CompassDockLayout.tsx, packages/react-core/src/demos/Compass/examples/CompassDemo.tsx, packages/react-core/src/demos/Compass/examples/CompassDockDemo.tsx
Replaced CompassPanel with Panel/PanelMain/PanelMainBody compositions throughout examples and demos; updated documentation and JSX hierarchy; inline styling replaces removed modifiers where applicable.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • Panel - Glass related react follow up #12271: This PR directly implements the follow-up work described in the issue by adding new Panel modifier props, removing CompassPanel, and updating all Compass demos/tests to use the shared Panel component.

Possibly related PRs

Suggested reviewers

  • mcoker
  • kmcfaul
  • thatblindgeye
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is somewhat garbled with unclear phrasing ('for use in with compass'). While it mentions the main changes (CompassPanel removal and Panel updates), the syntax is awkward and doesn't clearly convey the primary intent. Consider revising the title for clarity, such as 'feat(Compass): Replace CompassPanel with Panel component' or 'feat(Compass, Panel): Remove CompassPanel and migrate to Panel API'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@patternfly-build
Copy link
Copy Markdown
Collaborator

patternfly-build commented Apr 22, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/react-core/src/components/Compass/CompassMainHeader.tsx (1)

21-24: Consider adding a PanelMainBody prop passthrough for migration parity.

compassPanelProps now only reaches the outer Panel, but the no-padding replacement lives on PanelMainBody. Consumers using the title/toolbar shortcut can’t apply that without switching to custom children and recreating the title/toolbar wrappers.

Possible API extension
 export interface CompassMainHeaderProps extends Omit<React.HTMLProps<HTMLDivElement>, 'title'> {
@@
   compassPanelProps?: Omit<PanelProps, 'children'>;
+  /** Additional props passed to the PanelMainBody that wraps the main header content when using the title or toolbar props. */
+  compassPanelMainBodyProps?: Omit<React.ComponentProps<typeof PanelMainBody>, 'children'>;
 }
 
 export const CompassMainHeader: React.FunctionComponent<CompassMainHeaderProps> = ({
@@
   children,
   compassPanelProps,
+  compassPanelMainBodyProps,
   ...props
 }: CompassMainHeaderProps) => {
@@
       <Panel {...compassPanelProps}>
         <PanelMain>
-          <PanelMainBody>
+          <PanelMainBody {...compassPanelMainBodyProps}>
             <CompassMainHeaderContent>

Also applies to: 37-40

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-core/src/components/Compass/CompassMainHeader.tsx` around
lines 21 - 24, The current CompassMainHeader component only exposes
compassPanelProps to the outer Panel but not to the inner PanelMainBody,
preventing consumers from toggling things like no-padding when using
title/toolbar; add a new prop (e.g., compassPanelMainBodyProps?:
Omit<PanelMainBodyProps,'children'>) to the CompassMainHeader props, thread that
prop into the JSX where PanelMainBody is rendered inside CompassMainHeader
(apply the props to the PanelMainBody element), and update the component prop
typing and any usages or tests (also replicate the same change at the other
related spot referenced in the comment) so consumers can pass no-padding and
other PanelMainBody-specific options without needing to provide children.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/react-core/src/components/Compass/CompassMainHeader.tsx`:
- Around line 21-24: The current CompassMainHeader component only exposes
compassPanelProps to the outer Panel but not to the inner PanelMainBody,
preventing consumers from toggling things like no-padding when using
title/toolbar; add a new prop (e.g., compassPanelMainBodyProps?:
Omit<PanelMainBodyProps,'children'>) to the CompassMainHeader props, thread that
prop into the JSX where PanelMainBody is rendered inside CompassMainHeader
(apply the props to the PanelMainBody element), and update the component prop
typing and any usages or tests (also replicate the same change at the other
related spot referenced in the comment) so consumers can pass no-padding and
other PanelMainBody-specific options without needing to provide children.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cbf54911-dac2-4c40-a44d-9489cf0ba7c3

📥 Commits

Reviewing files that changed from the base of the PR and between a426464 and 2f8b4a1.

⛔ Files ignored due to path filters (4)
  • packages/react-core/src/components/Compass/__tests__/__snapshots__/CompassMainHeader.test.tsx.snap is excluded by !**/*.snap
  • packages/react-core/src/components/Compass/__tests__/__snapshots__/CompassPanel.test.tsx.snap is excluded by !**/*.snap
  • packages/react-core/src/components/Panel/__tests__/__snapshots__/Panel.test.tsx.snap is excluded by !**/*.snap
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (21)
  • packages/react-core/package.json
  • packages/react-core/src/components/Compass/CompassContent.tsx
  • packages/react-core/src/components/Compass/CompassMainHeader.tsx
  • packages/react-core/src/components/Compass/CompassMainHeaderContent.tsx
  • packages/react-core/src/components/Compass/CompassPanel.tsx
  • packages/react-core/src/components/Compass/__tests__/CompassMainHeader.test.tsx
  • packages/react-core/src/components/Compass/__tests__/CompassPanel.test.tsx
  • packages/react-core/src/components/Compass/examples/Compass.md
  • packages/react-core/src/components/Compass/examples/CompassBasic.tsx
  • packages/react-core/src/components/Compass/examples/CompassDockLayout.tsx
  • packages/react-core/src/components/Compass/index.ts
  • packages/react-core/src/components/Panel/Panel.tsx
  • packages/react-core/src/components/Panel/__tests__/Panel.test.tsx
  • packages/react-core/src/components/Panel/examples/Panel.md
  • packages/react-core/src/components/Panel/examples/PanelPill.tsx
  • packages/react-core/src/components/Panel/examples/PanelScrollableWithAutoHeight.tsx
  • packages/react-core/src/demos/Compass/examples/CompassDemo.tsx
  • packages/react-core/src/demos/Compass/examples/CompassDockDemo.tsx
  • packages/react-docs/package.json
  • packages/react-styles/package.json
  • packages/react-tokens/package.json
💤 Files with no reviewable changes (3)
  • packages/react-core/src/components/Compass/index.ts
  • packages/react-core/src/components/Compass/tests/CompassPanel.test.tsx
  • packages/react-core/src/components/Compass/CompassPanel.tsx

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants