diff --git a/docs/manifest.json b/docs/manifest.json index 937e1489896d37..02ac6098ef9679 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -1068,9 +1068,9 @@ "parent": "components" }, { - "title": "NavigatorRoot", - "slug": "navigator-root", - "markdown_source": "../packages/components/src/navigator/navigator-root/README.md", + "title": "NavigatorProvider", + "slug": "navigator-provider", + "markdown_source": "../packages/components/src/navigator/navigator-provider/README.md", "parent": "components" }, { diff --git a/packages/components/src/index.js b/packages/components/src/index.js index 45a28e78e2d854..28f8e245941e81 100644 --- a/packages/components/src/index.js +++ b/packages/components/src/index.js @@ -97,7 +97,7 @@ export { default as __experimentalNavigationGroup } from './navigation/group'; export { default as __experimentalNavigationItem } from './navigation/item'; export { default as __experimentalNavigationMenu } from './navigation/menu'; export { - NavigatorRoot as __experimentalNavigatorRoot, + NavigatorProvider as __experimentalNavigatorProvider, NavigatorScreen as __experimentalNavigatorScreen, useNavigator as __experimentalUseNavigator, } from './navigator'; diff --git a/packages/components/src/navigator/index.js b/packages/components/src/navigator/index.js index d9d78702505ee5..b30e5cdf396de8 100644 --- a/packages/components/src/navigator/index.js +++ b/packages/components/src/navigator/index.js @@ -1,3 +1,3 @@ -export { default as NavigatorRoot } from './navigator-root'; +export { default as NavigatorProvider } from './navigator-provider'; export { default as NavigatorScreen } from './navigator-screen'; export { default as useNavigator } from './use-navigator'; diff --git a/packages/components/src/navigator/navigator-root/README.md b/packages/components/src/navigator/navigator-provider/README.md similarity index 79% rename from packages/components/src/navigator/navigator-root/README.md rename to packages/components/src/navigator/navigator-provider/README.md index 7a43029297a42e..dead39a0bb7f6d 100644 --- a/packages/components/src/navigator/navigator-root/README.md +++ b/packages/components/src/navigator/navigator-provider/README.md @@ -1,10 +1,10 @@ -# `NavigatorRoot` +# `NavigatorProvider`
This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
-The `NavigatorRoot` component allows rendering nested panels or menus (via the [`NavigatorScreen` component](/packages/components/src/navigator/navigator-screen/README.md)) and navigate between these different states (via the `useNavigator` hook). The Global Styles sidebar is an example of this. +The `NavigatorProvider` component allows rendering nested panels or menus (via the [`NavigatorScreen` component](/packages/components/src/navigator/navigator-screen/README.md)) and navigate between these different states (via the `useNavigator` hook). The Global Styles sidebar is an example of this. The `Navigator*` family of components is _not_ opinionated in terms of UI, and can be composed with any UI components to navigate between the nested screens. @@ -12,7 +12,7 @@ The `Navigator*` family of components is _not_ opinionated in terms of UI, and c ```jsx import { - __experimentalNavigatorRoot as NavigatorRoot, + __experimentalNavigatorProvider as NavigatorProvider, __experimentalNavigatorScreen as NavigatorScreen, __experimentalUseNavigator as useNavigator, } from '@wordpress/components'; @@ -32,7 +32,7 @@ function NavigatorButton( { } const MyNavigation = () => ( - +

This is the home screen.

@@ -46,7 +46,7 @@ const MyNavigation = () => ( Go back
-
+ ); ``` diff --git a/packages/components/src/navigator/navigator-root/component.js b/packages/components/src/navigator/navigator-provider/component.js similarity index 79% rename from packages/components/src/navigator/navigator-root/component.js rename to packages/components/src/navigator/navigator-provider/component.js index 9924d4deb5271b..a49553ac5377c4 100644 --- a/packages/components/src/navigator/navigator-root/component.js +++ b/packages/components/src/navigator/navigator-provider/component.js @@ -8,7 +8,7 @@ import { useState } from '@wordpress/element'; */ import { NavigatorContext } from '../context'; -function NavigatorRoot( { initialPath, children } ) { +function NavigatorProvider( { initialPath, children } ) { const [ path, setPath ] = useState( { path: initialPath } ); return ( @@ -18,4 +18,4 @@ function NavigatorRoot( { initialPath, children } ) { ); } -export default NavigatorRoot; +export default NavigatorProvider; diff --git a/packages/components/src/navigator/navigator-root/index.js b/packages/components/src/navigator/navigator-provider/index.js similarity index 100% rename from packages/components/src/navigator/navigator-root/index.js rename to packages/components/src/navigator/navigator-provider/index.js diff --git a/packages/components/src/navigator/navigator-screen/README.md b/packages/components/src/navigator/navigator-screen/README.md index 26740c481577c1..65957155b04881 100644 --- a/packages/components/src/navigator/navigator-screen/README.md +++ b/packages/components/src/navigator/navigator-screen/README.md @@ -4,11 +4,11 @@ This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes. -The `NavigatorScreen` component represents a single view/screen/panel/menu and is supposed to be used in combination with [the `NavigatorRoot` component](/packages/components/src/navigator/navigator-root/README.md). +The `NavigatorScreen` component represents a single view/screen/panel/menu and is supposed to be used in combination with [the `NavigatorProvider` component](/packages/components/src/navigator/navigator-provider/README.md). ## Usage -Refer to [the `NavigatorRoot` component](/packages/components/src/navigator/navigator-root/README.md#usage) for a usage example. +Refer to [the `NavigatorProvider` component](/packages/components/src/navigator/navigator-provider/README.md#usage) for a usage example. ## Props diff --git a/packages/components/src/navigator/stories/index.js b/packages/components/src/navigator/stories/index.js index b5e895679b6521..42a5a639e6e671 100644 --- a/packages/components/src/navigator/stories/index.js +++ b/packages/components/src/navigator/stories/index.js @@ -2,11 +2,11 @@ * Internal dependencies */ import Button from '../../button'; -import { NavigatorRoot, NavigatorScreen, useNavigator } from '../'; +import { NavigatorProvider, NavigatorScreen, useNavigator } from '../'; export default { title: 'Components (Experimental)/Navigator', - component: NavigatorRoot, + component: NavigatorProvider, }; function NavigatorButton( { path, isBack = false, ...props } ) { @@ -20,7 +20,7 @@ function NavigatorButton( { path, isBack = false, ...props } ) { } const MyNavigation = () => ( - +

This is the home screen.

@@ -34,7 +34,7 @@ const MyNavigation = () => ( Go back
-
+ ); export const _default = () => { diff --git a/packages/components/src/navigator/test/index.js b/packages/components/src/navigator/test/index.js index 74f3588bcffdbf..31e8305e2a1dd7 100644 --- a/packages/components/src/navigator/test/index.js +++ b/packages/components/src/navigator/test/index.js @@ -6,7 +6,7 @@ import { render, screen, fireEvent } from '@testing-library/react'; /** * Internal dependencies */ -import { NavigatorRoot, NavigatorScreen, useNavigator } from '../'; +import { NavigatorProvider, NavigatorScreen, useNavigator } from '../'; jest.mock( 'framer-motion', () => { const actual = jest.requireActual( 'framer-motion' ); @@ -47,7 +47,7 @@ const MyNavigation = ( { initialPath = PATHS.HOME, onNavigatorButtonClick, } ) => ( - +

This is the home screen.

{ /* A `NavigatorScreen` with `path={ PATHS.NOT_FOUND }` is purposefully not included */ } -
+ ); const getNavigationScreenByText = ( text, { throwIfNotFound = true } = {} ) => { diff --git a/packages/edit-site/src/components/sidebar/global-styles-sidebar.js b/packages/edit-site/src/components/sidebar/global-styles-sidebar.js index 94e10c446222c3..46b465cc492b57 100644 --- a/packages/edit-site/src/components/sidebar/global-styles-sidebar.js +++ b/packages/edit-site/src/components/sidebar/global-styles-sidebar.js @@ -8,7 +8,7 @@ import { map } from 'lodash'; */ import { Button, - __experimentalNavigatorRoot as NavigatorRoot, + __experimentalNavigatorProvider as NavigatorProvider, __experimentalNavigatorScreen as NavigatorScreen, __experimentalUseNavigator as useNavigator, __experimentalItemGroup as ItemGroup, @@ -257,7 +257,7 @@ export default function GlobalStylesSidebar() { } > - + @@ -324,7 +324,7 @@ export default function GlobalStylesSidebar() { setSetting={ setSetting } /> ) ) } - + ); }