[Workspace Chrome] Bootstrap new grid layout components#223890
[Workspace Chrome] Bootstrap new grid layout components#223890Dosant merged 18 commits intoelastic:mainfrom
Conversation
…out-fix-scroll
There was a problem hiding this comment.
Pull Request Overview
Bootstraps a new @kbn/core-chrome-layout-components package to provide composable React primitives for Kibana’s Chrome layout, including region components, a debug overlay, Storybook stories, and initial docs.
- Adds layout region components (Banner, Header, Navigation, Sidebar, Panels, Application, Footer) and a debug overlay with Emotion styling.
- Sets up Jest and Storybook configuration, introduces a
Boxutility, and updatespackage.jsonand CODEOWNERS. - Provides a README with usage examples (Storybook-driven) and API documentation.
Reviewed Changes
Copilot reviewed 44 out of 44 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/core/packages/chrome/layout/core-chrome-layout-components/jest.config.js | Jest config for the new layout package |
| src/core/packages/chrome/layout/core-chrome-layout-components/index.ts | Exports core components and config provider |
| src/core/packages/chrome/layout/core-chrome-layout-components/header/* | Header region component and styles |
| src/core/packages/chrome/layout/core-chrome-layout-components/footer/* | Footer region component and styles |
| src/core/packages/chrome/layout/core-chrome-layout-components/banner/* | Banner region component and styles |
| src/core/packages/chrome/layout/core-chrome-layout-components/application/* | Application region component, overflow handling |
| src/core/packages/chrome/layout/core-chrome-layout-components/debug/* | LayoutDebugOverlay for visualizing grid slots |
| src/core/packages/chrome/layout/core-chrome-layout-components/stories/* | Storybook stories for layout and Box examples |
| src/core/packages/chrome/layout/core-chrome-layout-components/README.md | Documentation and usage examples |
| package.json | Registers the new layout package |
| .github/CODEOWNERS | Adds ownership for the new package |
Comments suppressed due to low confidence (7)
src/core/packages/chrome/layout/core-chrome-layout-components/README.md:55
- The snippet uses
<ChromeLayoutComponent>but the actual component name isChromeLayout. Update this to<ChromeLayout>for accuracy.
<ChromeLayoutComponent
src/core/packages/chrome/layout/core-chrome-layout-components/README.md:41
- The README references
LayoutConfigProvider, but the package exportsChromeLayoutConfigProvider. Update the import and usage to match the actual export.
LayoutConfigProvider,
src/core/packages/chrome/layout/core-chrome-layout-components/banner/index.ts:10
- The public API exports
LayoutBannerbut does not export itsLayoutBannerPropstype. Consider addingtype LayoutBannerPropsto maintain consistency with other components.
export { LayoutBanner } from './layout_banner';
src/core/packages/chrome/layout/core-chrome-layout-components/footer/index.ts:10
- The API surface exports
LayoutFooterbut omits theLayoutFooterPropstype. For consistency, exporttype LayoutFooterPropsas well.
export { LayoutFooter } from './layout_footer';
src/core/packages/chrome/layout/core-chrome-layout-components/jest.config.js:14
- Jest is configured for this package, but there are no test files present yet. Consider adding basic unit or snapshot tests for the new components to ensure they behave as expected.
};
src/core/packages/chrome/layout/core-chrome-layout-components/application/layout_application.styles.ts:15
- The CSS grid-area is set to "app" but other slot names and variables use "application". This mismatch will break layout alignment—rename to
grid-area: application;to match the rest of the system.
grid-area: app;
src/core/packages/chrome/layout/core-chrome-layout-components/application/layout_application.styles.ts:11
- The import path '../types' does not exist in this package. You need to add or correct the
types.tsfile so thatEmotionFncan be resolved, otherwise this will cause a build error.
import { EmotionFn } from '../types';
src/core/packages/chrome/layout/core-chrome-layout-components/footer/layout_footer.tsx
Show resolved
Hide resolved
|
Pinging @elastic/appex-sharedux (Team:SharedUX) |
clintandrewhall
left a comment
There was a problem hiding this comment.
Awesome work. Please address my comments before shipping. Thank you for tackling this!
|
|
||
| import { styles } from './layout_application.styles'; | ||
|
|
||
| export const LayoutApplication = ({ children }: { children: ReactNode }) => { |
There was a problem hiding this comment.
nit: let's be sure these have docblocks
There was a problem hiding this comment.
I added them, but I'm not sure they are helpful, especially since most of these are private components.
| grid-area: banner; | ||
| overflow: hidden; | ||
| position: sticky; | ||
| width: var(--kbn-layout--banner-width); |
There was a problem hiding this comment.
So we decided to leverage the CSS variables, which is fine... but we should be sure to document this fact in the README and/or the global style component.
src/core/packages/chrome/layout/core-chrome-layout-components/debug/LayoutDebugOverlay.tsx
Show resolved
Hide resolved
src/core/packages/chrome/layout/core-chrome-layout-components/debug/LayoutDebugOverlay.tsx
Outdated
Show resolved
Hide resolved
src/core/packages/chrome/layout/core-chrome-layout-components/debug/LayoutDebugOverlay.tsx
Outdated
Show resolved
Hide resolved
src/core/packages/chrome/layout/core-chrome-layout-components/debug/LayoutDebugOverlay.tsx
Outdated
Show resolved
Hide resolved
src/core/packages/chrome/layout/core-chrome-layout-components/layout.types.ts
Outdated
Show resolved
Hide resolved
| import React from 'react'; | ||
|
|
||
| export interface LayoutStyleArgs { | ||
| bannerHeight: number; |
There was a problem hiding this comment.
| bannerHeight: number; | |
| /** The height of the top-most banner */ | |
| bannerHeight: number; |
There was a problem hiding this comment.
I am adding the comments, but I am not sure how valuable they are? aren't they just repeat what the prop name or component name says? e.g. bannerHeight === /** The height of the top-most banner */
There was a problem hiding this comment.
I think you have to address the public API exports called out by CI. Props tend to be publicly exposed from packages, and it's always nice to have them documented, (even if they feel redundant).
|
|
||
| export type Slot = React.ReactNode | ((props: SlotProps) => React.ReactNode); | ||
|
|
||
| export interface ChromeLayoutSlots { |
There was a problem hiding this comment.
nit: are all of these, indeed, optional?
There was a problem hiding this comment.
my current thinking, they are. there is "isChromeVisible" state when we hide everything except application. I am thinking now I'd do it by hiding everything using these props
| const sidebar = css` | ||
| --kbn-layout--sidebar-top: ${bannerHeight}px; | ||
| --kbn-layout--sidebar-height: calc(100vh - var(--kbn-layout--sidebar-top)); | ||
| --kbn-layout--sidebar-width: ${sidebarWidth}px; |
There was a problem hiding this comment.
My only concern with putting this here, and not in the style property of the actual component, is a potential thrash if the sidebar is resized with a drag. Having this update with a debounce for consumers to alleviate performance issues would only be available if the node were sized with the raw value.
I'm ok shipping it this way, but at some point we might need to explore the performance implications, if any.
There was a problem hiding this comment.
I see... another problem will be animation - (open/closing a panel). will likely have to also change something around these variables
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Public APIs missing exports
History
|
…and `content` area (#225824) ## Summary Based on the [discussion](https://elastic.slack.com/archives/C08GKQQ85U4/p1751027960744299) this PR slightly reworks the layout introduced in #223890. For the Application Menu Bar, we need a header that is technically part of the application grid cell. This PR introduces `applicationTopBar` (and `applicationBottomBar` for consistency). It also adds a new set of variables: `--kbn-application--content-[top|bottom|left|right|height|width]`, which will represent the "safe" application content space for applications to use. - `applicationBottomBar` now works like the previous `footer`, but it is implemented differently—it is part of the application cell instead of being its own grid cell. - I kept the global `footer` just in case we need it and to properly debug/test that the variables work correctly. I adjusted it to take up the full width, similar to the banner. ## Before  ## After 
This is largely based of @clintandrewhall's work that he extracted from the new workspace layout poc. These components are a decent starting point for new grid layout and I validated that the layout mostly works for Kibana (fixing a couple of edge cases)
I believe the components are ready to be merged into the main branch to make future reviews easier:
Bootstraps a new
@kbn/core-chrome-layout-componentspackage to provide composable React primitives for Kibana’s Chrome layout, including region components, a debug overlay, Storybook stories, and initial docs.yarn storybook sharedux