From d637d8afa0fe10943bd8dc652ac1676b784bbfd5 Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Tue, 1 Oct 2024 14:47:37 +0200 Subject: [PATCH] Navigator: use stable export instead of experimental export (#65753) * Navigator: use stable export instead of experimental export * More clear export of useNavigator --- Co-authored-by: ciampo Co-authored-by: mirka <0mirka00@git.wordpress.org> --- .../inserter/mobile-tab-navigation.js | 23 +++++++--------- packages/components/src/index.ts | 7 +++-- .../components/global-styles-sidebar/index.js | 2 +- .../font-library-modal/font-card.js | 2 +- .../font-library-modal/font-collection.js | 18 ++++++------- .../font-library-modal/installed-fonts.js | 20 +++++++------- .../global-styles/font-sizes/font-size.js | 2 +- .../src/components/global-styles/header.js | 4 +-- .../global-styles/navigation-button.js | 7 +++-- .../global-styles/screen-revisions/index.js | 2 +- .../global-styles/shadows-edit-panel.js | 2 +- .../src/components/global-styles/ui.js | 11 ++++---- .../preferences-modal-tabs/index.js | 26 +++++++------------ 13 files changed, 57 insertions(+), 69 deletions(-) diff --git a/packages/block-editor/src/components/inserter/mobile-tab-navigation.js b/packages/block-editor/src/components/inserter/mobile-tab-navigation.js index fa8191cc5eaaa0..5f34c3c21d832f 100644 --- a/packages/block-editor/src/components/inserter/mobile-tab-navigation.js +++ b/packages/block-editor/src/components/inserter/mobile-tab-navigation.js @@ -10,10 +10,7 @@ import { __experimentalSpacer as Spacer, __experimentalHeading as Heading, __experimentalView as View, - __experimentalNavigatorProvider as NavigatorProvider, - __experimentalNavigatorScreen as NavigatorScreen, - __experimentalNavigatorButton as NavigatorButton, - __experimentalNavigatorBackButton as NavigatorBackButton, + Navigator, FlexBlock, } from '@wordpress/components'; import { Icon, chevronRight, chevronLeft } from '@wordpress/icons'; @@ -24,7 +21,7 @@ function ScreenHeader( { title } ) { - - + { categories.map( ( category ) => ( - - + ) ) } - + { categories.map( ( category ) => ( - { children( category ) } - + ) ) } - + ); } diff --git a/packages/components/src/index.ts b/packages/components/src/index.ts index cc3c0265c42208..fe3642f7700772 100644 --- a/packages/components/src/index.ts +++ b/packages/components/src/index.ts @@ -130,9 +130,12 @@ export { NavigatorButton as __experimentalNavigatorButton, NavigatorBackButton as __experimentalNavigatorBackButton, NavigatorToParentButton as __experimentalNavigatorToParentButton, - useNavigator as __experimentalUseNavigator, } from './navigator/legacy'; -export { Navigator, useNavigator } from './navigator'; +export { + Navigator, + useNavigator, + 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'; diff --git a/packages/edit-site/src/components/global-styles-sidebar/index.js b/packages/edit-site/src/components/global-styles-sidebar/index.js index b314b5d7e75244..966005907cda4a 100644 --- a/packages/edit-site/src/components/global-styles-sidebar/index.js +++ b/packages/edit-site/src/components/global-styles-sidebar/index.js @@ -6,7 +6,7 @@ import { FlexBlock, Flex, Button, - __experimentalUseNavigator as useNavigator, + useNavigator, } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { styles, seen, backup } from '@wordpress/icons'; diff --git a/packages/edit-site/src/components/global-styles/font-library-modal/font-card.js b/packages/edit-site/src/components/global-styles/font-library-modal/font-card.js index 579c6564fdf3e7..61f8c28c77144f 100644 --- a/packages/edit-site/src/components/global-styles/font-library-modal/font-card.js +++ b/packages/edit-site/src/components/global-styles/font-library-modal/font-card.js @@ -3,7 +3,7 @@ */ import { _n, sprintf, isRTL } from '@wordpress/i18n'; import { - __experimentalUseNavigator as useNavigator, + useNavigator, __experimentalText as Text, Button, Flex, diff --git a/packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js b/packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js index ce7b4c1766c64f..caf339091de752 100644 --- a/packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js +++ b/packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js @@ -13,9 +13,7 @@ import { __experimentalText as Text, __experimentalHStack as HStack, __experimentalVStack as VStack, - __experimentalNavigatorProvider as NavigatorProvider, - __experimentalNavigatorScreen as NavigatorScreen, - __experimentalNavigatorBackButton as NavigatorBackButton, + Navigator, __experimentalHeading as Heading, Notice, SelectControl, @@ -284,11 +282,11 @@ function FontCollection( { slug } ) { { ! isLoading && ( <> - - + @@ -378,11 +376,11 @@ function FontCollection( { slug } ) { { /* eslint-enable jsx-a11y/no-redundant-roles */ } - + - + - - - + + { selectedFont && ( - - + { notice && ( ) } - + - + - { /* eslint-enable jsx-a11y/no-redundant-roles */ } - - + + - ; + return ; } function NavigationBackButtonAsItem( props ) { - return ; + return ; } export { NavigationButtonAsItem, NavigationBackButtonAsItem }; diff --git a/packages/edit-site/src/components/global-styles/screen-revisions/index.js b/packages/edit-site/src/components/global-styles/screen-revisions/index.js index de27e92113b554..89af705cd92504 100644 --- a/packages/edit-site/src/components/global-styles/screen-revisions/index.js +++ b/packages/edit-site/src/components/global-styles/screen-revisions/index.js @@ -3,7 +3,7 @@ */ import { __, sprintf } from '@wordpress/i18n'; import { - __experimentalUseNavigator as useNavigator, + useNavigator, __experimentalConfirmDialog as ConfirmDialog, Spinner, } from '@wordpress/components'; diff --git a/packages/edit-site/src/components/global-styles/shadows-edit-panel.js b/packages/edit-site/src/components/global-styles/shadows-edit-panel.js index ec1dd1a900c3bf..f12f960f6a36bb 100644 --- a/packages/edit-site/src/components/global-styles/shadows-edit-panel.js +++ b/packages/edit-site/src/components/global-styles/shadows-edit-panel.js @@ -15,7 +15,7 @@ import { __experimentalUnitControl as UnitControl, __experimentalGrid as Grid, __experimentalDropdownContentWrapper as DropdownContentWrapper, - __experimentalUseNavigator as useNavigator, + useNavigator, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, __experimentalConfirmDialog as ConfirmDialog, diff --git a/packages/edit-site/src/components/global-styles/ui.js b/packages/edit-site/src/components/global-styles/ui.js index b1550d2a245131..fbc3e461e6abb6 100644 --- a/packages/edit-site/src/components/global-styles/ui.js +++ b/packages/edit-site/src/components/global-styles/ui.js @@ -2,9 +2,8 @@ * WordPress dependencies */ import { - __experimentalNavigatorProvider as NavigatorProvider, - __experimentalNavigatorScreen as NavigatorScreen, - __experimentalUseNavigator as useNavigator, + Navigator, + useNavigator, createSlotFill, DropdownMenu, MenuGroup, @@ -124,7 +123,7 @@ function GlobalStylesActionMenu() { function GlobalStylesNavigationScreen( { className, ...props } ) { return ( - @@ -385,7 +384,7 @@ function GlobalStylesUI() { - + ); } export { GlobalStylesMenuSlot }; diff --git a/packages/preferences/src/components/preferences-modal-tabs/index.js b/packages/preferences/src/components/preferences-modal-tabs/index.js index d87e565f5e3364..f73bdd7f029dc7 100644 --- a/packages/preferences/src/components/preferences-modal-tabs/index.js +++ b/packages/preferences/src/components/preferences-modal-tabs/index.js @@ -3,10 +3,7 @@ */ import { useViewportMatch } from '@wordpress/compose'; import { - __experimentalNavigatorProvider as NavigatorProvider, - __experimentalNavigatorScreen as NavigatorScreen, - __experimentalNavigatorButton as NavigatorButton, - __experimentalNavigatorBackButton as NavigatorBackButton, + Navigator, __experimentalItemGroup as ItemGroup, __experimentalItem as Item, __experimentalHStack as HStack, @@ -98,17 +95,14 @@ export default function PreferencesModalTabs( { sections } ) { ); } else { modalContent = ( - - + + { tabs.map( ( tab ) => { return ( - - + ); } ) } - + { sections.length && sections.map( ( section ) => { return ( - @@ -151,7 +145,7 @@ export default function PreferencesModalTabs( { sections } ) { size="small" gap="6" > - { section.content } - + ); } ) } - + ); }