diff --git a/docs/manifest.json b/docs/manifest.json index 4264870ae044a..7886fe11ea062 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -1067,6 +1067,12 @@ "markdown_source": "../packages/components/src/navigation/README.md", "parent": "components" }, + { + "title": "Navigator", + "slug": "navigator", + "markdown_source": "../packages/components/src/navigator/README.md", + "parent": "components" + }, { "title": "Notice", "slug": "notice", diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index da076b23a46d4..df9fef03d219b 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -8,6 +8,10 @@ - Removed the deprecated `onClickOutside` prop from the `Popover` component ([#34537](https://github.com/WordPress/gutenberg/pull/34537)). - Changed `RangeControl` component to not apply `shiftStep` to inputs from its `` ([35020](https://github.com/WordPress/gutenberg/pull/35020)). +### New Feature + +- Add an experimental `Navigator` components ([#34904](https://github.com/WordPress/gutenberg/pull/34904)) as a replacement for the previous `Navigation` related components. + ### Bug Fix - Fixed rounding of value in `RangeControl` component when it loses focus while the `SHIFT` key is held. ([#35020](https://github.com/WordPress/gutenberg/pull/35020)). diff --git a/packages/components/src/index.js b/packages/components/src/index.js index b605bd852db99..4e3560104e3b3 100644 --- a/packages/components/src/index.js +++ b/packages/components/src/index.js @@ -96,6 +96,11 @@ export { default as __experimentalNavigationBackButton } from './navigation/back export { default as __experimentalNavigationGroup } from './navigation/group'; export { default as __experimentalNavigationItem } from './navigation/item'; export { default as __experimentalNavigationMenu } from './navigation/menu'; +export { + Navigator as __experimentalNavigator, + NavigatorScreen as __experimentalNavigatorScreen, + useNavigator as __experimentalUseNavigator, +} from './navigator'; export { default as Notice } from './notice'; export { default as __experimentalNumberControl } from './number-control'; export { default as NoticeList } from './notice/list'; @@ -157,6 +162,7 @@ export { useCustomUnits as __experimentalUseCustomUnits, parseUnit as __experimentalParseUnit, } from './unit-control'; +export { View as __experimentalView } from './view'; export { VisuallyHidden } from './visually-hidden'; export { VStack as __experimentalVStack } from './v-stack'; export { default as IsolatedEventContainer } from './isolated-event-container'; diff --git a/packages/components/src/navigator/README.md b/packages/components/src/navigator/README.md new file mode 100644 index 0000000000000..99eb5e78413f4 --- /dev/null +++ b/packages/components/src/navigator/README.md @@ -0,0 +1,88 @@ +# Navigator + +
+This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes. +
+ +The Navigator components allows rendering nested panels or menus (also called screens) and navigate between these different states. The Global Styles sidebar is an example of this. + +The components is not opinionated in terms of UI, it lets compose any UI components to navigate between the nested screens. + +## Usage + +```jsx +import { + __experimentalNavigator as Navigator, + __experimentalNavigatorScreen as NavigatorScreen, + __experimentalUseNavigator as useNavigator, +} from '@wordpress/components'; + +function NavigatorButton( { + path, + isBack = false, + ...props +} ) { + const navigator = useNavigator(); + return ( +