UNPKG

@wordpress/editor

Version:
8 lines (7 loc) 2.97 kB
{ "version": 3, "sources": ["../../../src/components/sidebar/header.js"], "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { sidebars } from './constants';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst SidebarHeader = ( _, ref ) => {\n\tconst { postTypeLabel, isRevisionsMode } = useSelect( ( select ) => {\n\t\tconst { getPostTypeLabel } = select( editorStore );\n\t\tconst { isRevisionsMode: _isRevisionsMode } = unlock(\n\t\t\tselect( editorStore )\n\t\t);\n\t\treturn {\n\t\t\tpostTypeLabel: getPostTypeLabel(),\n\t\t\tisRevisionsMode: _isRevisionsMode(),\n\t\t};\n\t}, [] );\n\n\tlet documentLabel;\n\tif ( isRevisionsMode ) {\n\t\tdocumentLabel = __( 'Revision' );\n\t} else if ( postTypeLabel ) {\n\t\tdocumentLabel = decodeEntities( postTypeLabel );\n\t} else {\n\t\t// translators: Default label for the Document sidebar tab, not selected.\n\t\tdocumentLabel = _x( 'Document', 'noun, panel' );\n\t}\n\n\treturn (\n\t\t<Tabs.TabList ref={ ref }>\n\t\t\t<Tabs.Tab\n\t\t\t\ttabId={ sidebars.document }\n\t\t\t\t// Used for focus management in the SettingsSidebar component.\n\t\t\t\tdata-tab-id={ sidebars.document }\n\t\t\t>\n\t\t\t\t{ documentLabel }\n\t\t\t</Tabs.Tab>\n\t\t\t<Tabs.Tab\n\t\t\t\ttabId={ sidebars.block }\n\t\t\t\t// Used for focus management in the SettingsSidebar component.\n\t\t\t\tdata-tab-id={ sidebars.block }\n\t\t\t>\n\t\t\t\t{ /* translators: Text label for the Block Settings Sidebar tab. */ }\n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