diff --git a/package-lock.json b/package-lock.json
index 25144ad2de978..b5af2577f57a0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -55216,6 +55216,7 @@
"@wordpress/icons": "file:../icons",
"@wordpress/plugins": "file:../plugins",
"@wordpress/preferences": "file:../preferences",
+ "@wordpress/private-apis": "file:../private-apis",
"@wordpress/viewport": "file:../viewport",
"classnames": "^2.3.1"
},
@@ -70031,6 +70032,7 @@
"@wordpress/icons": "file:../icons",
"@wordpress/plugins": "file:../plugins",
"@wordpress/preferences": "file:../preferences",
+ "@wordpress/private-apis": "file:../private-apis",
"@wordpress/viewport": "file:../viewport",
"classnames": "^2.3.1"
}
diff --git a/packages/interface/lock-unlock.js b/packages/interface/lock-unlock.js
new file mode 100644
index 0000000000000..b6e29bb71c7c0
--- /dev/null
+++ b/packages/interface/lock-unlock.js
@@ -0,0 +1,10 @@
+/**
+ * WordPress dependencies
+ */
+import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
+
+export const { lock, unlock } =
+ __dangerousOptInToUnstableAPIsOnlyForCoreModules(
+ 'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
+ '@wordpress/interface'
+ );
diff --git a/packages/interface/package.json b/packages/interface/package.json
index df3d53990e0f5..7356a7b52d1d4 100644
--- a/packages/interface/package.json
+++ b/packages/interface/package.json
@@ -42,6 +42,7 @@
"@wordpress/icons": "file:../icons",
"@wordpress/plugins": "file:../plugins",
"@wordpress/preferences": "file:../preferences",
+ "@wordpress/private-apis": "file:../private-apis",
"@wordpress/viewport": "file:../viewport",
"classnames": "^2.3.1"
},
diff --git a/packages/interface/src/components/preferences-modal-tabs/index.js b/packages/interface/src/components/preferences-modal-tabs/index.js
index bc8f7358b834d..985d963227257 100644
--- a/packages/interface/src/components/preferences-modal-tabs/index.js
+++ b/packages/interface/src/components/preferences-modal-tabs/index.js
@@ -13,15 +13,22 @@ import {
__experimentalText as Text,
__experimentalTruncate as Truncate,
FlexItem,
- TabPanel,
Card,
CardHeader,
CardBody,
+ privateApis as componentsPrivateApis,
} from '@wordpress/components';
-import { useMemo, useCallback, useState } from '@wordpress/element';
+import { useMemo, useState } from '@wordpress/element';
import { chevronLeft, chevronRight, Icon } from '@wordpress/icons';
import { isRTL, __ } from '@wordpress/i18n';
+/**
+ * Internal dependencies
+ */
+import { unlock } from '../../../lock-unlock';
+
+const { Tabs } = unlock( componentsPrivateApis );
+
const PREFERENCES_MENU = 'preferences-menu';
export default function PreferencesModalTabs( { sections } ) {
@@ -32,7 +39,7 @@ export default function PreferencesModalTabs( { sections } ) {
const [ activeMenu, setActiveMenu ] = useState( PREFERENCES_MENU );
/**
* Create helper objects from `sections` for easier data handling.
- * `tabs` is used for creating the `TabPanel` and `sectionsContentMap`
+ * `tabs` is used for creating the `Tabs` and `sectionsContentMap`
* is used for easier access to active tab's content.
*/
const { tabs, sectionsContentMap } = useMemo( () => {
@@ -53,26 +60,41 @@ export default function PreferencesModalTabs( { sections } ) {
return mappedTabs;
}, [ sections ] );
- const getCurrentTab = useCallback(
- ( tab ) => sectionsContentMap[ tab.name ] || null,
- [ sectionsContentMap ]
- );
-
let modalContent;
// We render different components based on the viewport size.
if ( isLargeViewport ) {
modalContent = (
-