Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/boot/CHANGELOG.md
Comment thread
simison marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## Unreleased

### Breaking Changes

- Migrate component styles to CSS modules. Global `boot-*` class names and the package stylesheet entry are removed; styles are now scoped modules injected at runtime ([#80359](https://github.com/WordPress/gutenberg/pull/80359)).

### Code Quality

- Declare CSS module side effects for correct tree shaking ([#80359](https://github.com/WordPress/gutenberg/pull/80359)).

## 0.18.0 (2026-07-14)

### Enhancements
Expand Down
3 changes: 3 additions & 0 deletions packages/boot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
},
"wpScriptModuleExports": "./build-module/index.mjs",
"types": "build-types",
"sideEffects": [
"src/**/*.module.scss"
],
"dependencies": {
"@wordpress/a11y": "file:../a11y",
"@wordpress/admin-ui": "file:../admin-ui",
Expand Down
7 changes: 4 additions & 3 deletions packages/boot/src/components/app/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { store as coreStore } from '@wordpress/core-data';
* Internal dependencies
*/
import Root from '../root';
import layoutStyles from '../root/style.module.scss';
import type { Route, RouteConfig, RouteLoaderContext } from '../../store/types';
import { unlock } from '../../lock-unlock';

Expand All @@ -37,7 +38,7 @@ const {
// Not found component
function NotFoundComponent() {
return (
<div className="boot-layout__stage">
<div className={ layoutStyles.stage }>
<Page title={ __( 'Route not found' ) } hasPadding>
{ __( "The page you're looking for does not exist" ) }
</Page>
Expand Down Expand Up @@ -133,12 +134,12 @@ function createRouteFromDefinition( route: Route, parentRoute: AnyRoute ) {
return (
<>
{ Stage && (
<div className="boot-layout__stage">
<div className={ layoutStyles.stage }>
<Stage />
</div>
) }
{ Inspector && showInspector && (
<div className="boot-layout__inspector">
<div className={ layoutStyles.inspector }>
<Inspector />
</div>
) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { chevronRightSmall, chevronLeftSmall } from '@wordpress/icons';
*/
import { wrapIcon } from '../items';
import type { IconType } from '../../../store/types';
import navigationItemStyles from '../navigation-item/style.module.scss';

interface DrilldownItemProps {
/**
Expand Down Expand Up @@ -71,7 +72,10 @@ export default function DrilldownItem( {

return (
<Item
className={ clsx( 'boot-navigation-item', className ) }
className={ clsx(
navigationItemStyles[ 'navigation-item' ],
className
) }
onClick={ handleClick }
>
<HStack
Expand Down
16 changes: 10 additions & 6 deletions packages/boot/src/components/navigation/dropdown-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import { STORE_NAME } from '../../../store';
import NavigationItem from '../navigation-item';
import { wrapIcon } from '../items';
import type { IconType, MenuItem } from '../../../store/types';
import './style.scss';
import styles from './style.module.scss';
import navigationItemStyles from '../navigation-item/style.module.scss';

const ANIMATION_DURATION = 0.2;

Expand Down Expand Up @@ -79,9 +80,12 @@ export default function DropdownItem( {
const items = menuItems.filter( ( item ) => item.parent === id );
const disableMotion = useReducedMotion();
return (
<div className="boot-dropdown-item">
<div>
<Item
className={ clsx( 'boot-navigation-item', className ) }
className={ clsx(
navigationItemStyles[ 'navigation-item' ],
className
) }
onClick={ ( e ) => {
e.preventDefault();
e.stopPropagation();
Expand All @@ -98,8 +102,8 @@ export default function DropdownItem( {
<FlexBlock>{ children }</FlexBlock>
<WCIcon
icon={ chevronDownSmall }
className={ clsx( 'boot-dropdown-item__chevron', {
'is-up': isExpanded,
className={ clsx( styles.chevron, {
[ styles[ 'is-up' ] ]: isExpanded,
} ) }
/>
</HStack>
Expand All @@ -115,7 +119,7 @@ export default function DropdownItem( {
duration: disableMotion ? 0 : ANIMATION_DURATION,
ease: 'easeOut',
} }
className="boot-dropdown-item__children"
className={ styles.children }
>
{ items.map( ( item, index ) => (
<NavigationItem
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@use "@wordpress/base-styles/variables";

.boot-dropdown-item__children {
.children {
display: flex;
flex-direction: column;

Expand All @@ -16,8 +16,12 @@
variables.$grid-unit-40 -
Comment thread
simison marked this conversation as resolved.
Resolved
$padding-to-avoid-cutting-focus-ring;
overflow: hidden;

:global(.components-item) {
min-height: variables.$grid-unit-30;
}
}

.boot-dropdown-item__chevron.is-up {
.chevron.is-up {
transform: rotate(180deg);
}
7 changes: 6 additions & 1 deletion packages/boot/src/components/navigation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import NavigationItem from './navigation-item';
import DrilldownItem from './drilldown-item';
import DropdownItem from './dropdown-item';
import NavigationScreen from './navigation-screen';
import navigationItemStyles from './navigation-item/style.module.scss';
import { useSidebarParent } from './use-sidebar-parent';
import type { MenuItem } from '../../store/types';

Expand Down Expand Up @@ -79,7 +80,11 @@ function Navigation() {
<DropdownItem
key={ item.id }
id={ item.id }
className="boot-navigation-item"
className={
navigationItemStyles[
'navigation-item'
]
}
icon={ item.icon }
shouldShowPlaceholder={ hasRealIcons }
isExpanded={ parentDropdownId === item.id }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
import RouterLinkItem from '../router-link-item';
import { wrapIcon } from '../items';
import type { IconType } from '../../../store/types';
import './style.scss';
import styles from './style.module.scss';

interface NavigationItemProps {
/**
Expand Down Expand Up @@ -70,7 +70,7 @@ export default function NavigationItem( {
<Item
as="a"
href={ to }
className={ clsx( 'boot-navigation-item', className ) }
className={ clsx( styles[ 'navigation-item' ], className ) }
>
{ content }
</Item>
Expand All @@ -80,7 +80,7 @@ export default function NavigationItem( {
return (
<RouterLinkItem
to={ to }
className={ clsx( 'boot-navigation-item', className ) }
className={ clsx( styles[ 'navigation-item' ], className ) }
>
{ content }
</RouterLinkItem>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@use "@wordpress/base-styles/variables";
@use "@wordpress/base-styles/mixins";

.boot-navigation-item.components-item {
.navigation-item:global(.components-item) {
color: var(--wpds-color-foreground-interactive-neutral);
padding-inline: variables.$grid-unit-05;
padding-block: 0;
Expand All @@ -14,10 +14,6 @@
align-items: center;
@include mixins.body-medium();

.boot-dropdown-item__children & {
min-height: variables.$grid-unit-30;
}

// Rounded focus ring
border-radius: var(--wpds-border-radius-sm);

Expand Down Expand Up @@ -47,6 +43,6 @@
}

&.with-suffix {
padding-right: variables.$grid-unit-20;
padding-inline-end: variables.$grid-unit-20;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { useReducedMotion } from '@wordpress/compose';
/**
* Internal dependencies
*/
import './style.scss';
import styles from './style.module.scss';

const ANIMATION_DURATION = 0.3;
const slideVariants = {
Expand Down Expand Up @@ -76,19 +76,11 @@ export default function NavigationScreen( {
};

return (
<div
className="boot-navigation-screen"
style={ {
overflow: 'hidden',
position: 'relative',
display: 'grid',
gridTemplateColumns: '1fr',
gridTemplateRows: '1fr',
} }
>
<div className={ styles.screen }>
<AnimatePresence initial={ false }>
<motion.div
key={ navigationKey }
className={ styles.panel }
custom={ animationDirection }
variants={ slideVariants }
initial="initial"
Expand All @@ -99,16 +91,8 @@ export default function NavigationScreen( {
duration: disableMotion ? 0 : ANIMATION_DURATION,
ease: [ 0.33, 0, 0, 1 ],
} }
style={ {
width: '100%',
gridColumn: '1',
gridRow: '1',
} }
>
<HStack
spacing={ 2 }
className="boot-navigation-screen__title-icon"
>
<HStack spacing={ 2 } className={ styles[ 'title-icon' ] }>
{ ! isRoot && (
<Button
ref={ backButtonRef }
Expand All @@ -120,21 +104,19 @@ export default function NavigationScreen( {
/>
) }
<Heading
className="boot-navigation-screen__title"
className={ styles.title }
level={ 1 }
size="15px"
>
{ title }
</Heading>
{ actions && (
<div className="boot-navigation-screen__actions">
{ actions }
</div>
<div className={ styles.actions }>{ actions }</div>
) }
</HStack>

{ description && (
<div className="boot-navigation-screen__description">
<div className={ styles.description }>
{ description }
</div>
) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,43 @@
@use "@wordpress/base-styles/variables";

.boot-navigation-screen {
.screen {
overflow: hidden;
position: relative;
display: grid;
grid-template-columns: 1fr;
grid-template-rows: 1fr;
// Avoid cutting off focus ring of the last menu item
padding-block-end: variables.$grid-unit-05;
}

.boot-navigation-screen .components-text {
.screen :global(.components-text) {
color: var(--wpds-color-foreground-content-neutral);
}

.boot-navigation-screen__title-icon {
.panel {
width: 100%;
grid-column: 1;
grid-row: 1;
}

.title-icon {
position: sticky;
top: 0;
padding:
variables.$grid-unit-15 variables.$grid-unit-20
variables.$grid-unit-10 variables.$grid-unit-20;
padding-block: variables.$grid-unit-15 variables.$grid-unit-10;
padding-inline: variables.$grid-unit-20;
}

.boot-navigation-screen__title {
.title {
flex-grow: 1;
overflow-wrap: break-word;

&#{&},
&#{&} .boot-navigation-screen__title {
&#{&} .title {
line-height: variables.$font-line-height-x-large;
color: var(--wpds-color-foreground-content-neutral);
}
}

.boot-navigation-screen__actions {
.actions {
display: flex;
flex-shrink: 0;
}
Loading
Loading