@wordpress/edit-widgets 5.9.0 → 5.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 5.11.0 (2023-05-24)
6
+
7
+ ## 5.10.0 (2023-05-10)
8
+
5
9
  ## 5.9.0 (2023-04-26)
6
10
 
7
11
  ## 5.8.0 (2023-04-12)
@@ -35,6 +35,8 @@ var _useLastSelectedWidgetArea = _interopRequireDefault(require("../../hooks/use
35
35
 
36
36
  var _store = require("../../store");
37
37
 
38
+ var _privateApis = require("../../private-apis");
39
+
38
40
  /**
39
41
  * WordPress dependencies
40
42
  */
@@ -42,6 +44,10 @@ var _store = require("../../store");
42
44
  /**
43
45
  * Internal dependencies
44
46
  */
47
+ const {
48
+ useShouldContextualToolbarShow
49
+ } = (0, _privateApis.unlock)(_blockEditor.privateApis);
50
+
45
51
  function Header() {
46
52
  const isMediumViewport = (0, _compose.useViewportMatch)('medium');
47
53
  const inserterButton = (0, _element.useRef)();
@@ -91,6 +97,14 @@ function Header() {
91
97
  };
92
98
 
93
99
  const toggleListView = (0, _element.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
100
+ const {
101
+ shouldShowContextualToolbar,
102
+ canFocusHiddenToolbar,
103
+ fixedToolbarCanBeFocused
104
+ } = useShouldContextualToolbarShow(); // If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.
105
+ // There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.
106
+
107
+ const blockToolbarCanBeFocused = shouldShowContextualToolbar || canFocusHiddenToolbar || fixedToolbarCanBeFocused;
94
108
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("div", {
95
109
  className: "edit-widgets-header"
96
110
  }, (0, _element.createElement)("div", {
@@ -102,7 +116,8 @@ function Header() {
102
116
  className: "edit-widgets-header__title"
103
117
  }, (0, _i18n.__)('Widgets')), (0, _element.createElement)(_blockEditor.NavigableToolbar, {
104
118
  className: "edit-widgets-header-toolbar",
105
- "aria-label": (0, _i18n.__)('Document tools')
119
+ "aria-label": (0, _i18n.__)('Document tools'),
120
+ shouldUseKeyboardFocusShortcut: !blockToolbarCanBeFocused
106
121
  }, (0, _element.createElement)(_components.ToolbarItem, {
107
122
  ref: inserterButton,
108
123
  as: _components.Button,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"names":["Header","isMediumViewport","inserterButton","widgetAreaClientId","isLastSelectedWidgetAreaOpen","select","editWidgetsStore","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","isInserterOpened","isListViewOpened","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","selectBlock","blockEditorStore","handleClick","window","requestAnimationFrame","toggleListView","Button","event","preventDefault","plus","listView"],"mappings":";;;;;;;;;AAYA;;AATA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAaA;AACA;AACA;AAQA,SAASA,MAAT,GAAkB;AACjB,QAAMC,gBAAgB,GAAG,+BAAkB,QAAlB,CAAzB;AACA,QAAMC,cAAc,GAAG,sBAAvB;AACA,QAAMC,kBAAkB,GAAG,yCAA3B;AACA,QAAMC,4BAA4B,GAAG,qBAClCC,MAAF,IACCA,MAAM,CAAEC,YAAF,CAAN,CAA2BC,mBAA3B,CACCJ,kBADD,CAFmC,EAKpC,CAAEA,kBAAF,CALoC,CAArC;AAOA,QAAM;AAAEK,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAqC,qBAAaJ,MAAF,IAAc;AACnE,UAAM;AAAEK,MAAAA,gBAAF;AAAoBC,MAAAA;AAApB,QACLN,MAAM,CAAEC,YAAF,CADP;AAEA,WAAO;AACNE,MAAAA,cAAc,EAAEE,gBAAgB,EAD1B;AAEND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C,IAAA,SAAS,EAAC,8CAHX;AAIC,IAAA,OAAO,EAAC,SAJT;AAKC,IAAA,SAAS,EAAGb,cALb;AAMC,IAAA,WAAW,EAAKc,KAAF,IAAa;AAC1BA,MAAAA,KAAK,CAACC,cAAN;AACA,KARF;AASC,IAAA,OAAO,EAAGN,WATX;AAUC,IAAA,IAAI,EAAGO;AACP;AACP;AAZM;AAaC,IAAA,KAAK,EAAG,cACP,uBADO,EAEP,yCAFO;AAbT,IAJD,EAsBGvB,gBAAgB,IACjB,qDACC,4BAAC,aAAD,OADD,EAEC,4BAAC,aAAD,OAFD,EAGC,4BAAC,uBAAD;AACC,IAAA,EAAE,EAAGoB,kBADN;AAEC,IAAA,SAAS,EAAC,+CAFX;AAGC,IAAA,IAAI,EAAGI,eAHR;AAIC,IAAA,SAAS,EAAGhB;AACZ;AALD;AAMC,IAAA,KAAK,EAAG,cAAI,WAAJ,CANT;AAOC,IAAA,OAAO,EAAGW;AAPX,IAHD,CAvBF,CAdD,CADD,EAsDC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,mBAAD,OADD,EAEC,4BAAC,sBAAD,CAAa,IAAb;AAAkB,IAAA,KAAK,EAAC;AAAxB,IAFD,EAGC,4BAAC,iBAAD,OAHD,CAtDD,CADD,CADD;AAgEA;;eAEcpB,M","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem, VisuallyHidden } from '@wordpress/components';\nimport {\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { PinnedItems } from '@wordpress/interface';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SaveButton from '../save-button';\nimport UndoButton from './undo-redo/undo';\nimport RedoButton from './undo-redo/redo';\nimport MoreMenu from '../more-menu';\nimport useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../store';\n\nfunction Header() {\n\tconst isMediumViewport = useViewportMatch( 'medium' );\n\tconst inserterButton = useRef();\n\tconst widgetAreaClientId = useLastSelectedWidgetArea();\n\tconst isLastSelectedWidgetAreaOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getIsWidgetAreaOpen(\n\t\t\t\twidgetAreaClientId\n\t\t\t),\n\t\t[ widgetAreaClientId ]\n\t);\n\tconst { isInserterOpen, isListViewOpen } = useSelect( ( select ) => {\n\t\tconst { isInserterOpened, isListViewOpened } =\n\t\t\tselect( editWidgetsStore );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t};\n\t}, [] );\n\tconst { setIsWidgetAreaOpen, setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst handleClick = () => {\n\t\tif ( isInserterOpen ) {\n\t\t\t// Focusing the inserter button closes the inserter popover.\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tif ( ! isLastSelectedWidgetAreaOpen ) {\n\t\t\t\t// Select the last selected block if hasn't already.\n\t\t\t\tselectBlock( widgetAreaClientId );\n\t\t\t\t// Open the last selected widget area when opening the inserter.\n\t\t\t\tsetIsWidgetAreaOpen( widgetAreaClientId, true );\n\t\t\t}\n\t\t\t// The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the\n\t\t\t// same tick and pretty much in a random order. The inserter is closed if any other part of the\n\t\t\t// app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then\n\t\t\t// the inserter is visible for a brief moment and then gets auto-closed due to focus moving to\n\t\t\t// the selected block.\n\t\t\twindow.requestAnimationFrame( () => setIsInserterOpened( true ) );\n\t\t}\n\t};\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-widgets-header\">\n\t\t\t\t<div className=\"edit-widgets-header__navigable-toolbar-wrapper\">\n\t\t\t\t\t{ isMediumViewport && (\n\t\t\t\t\t\t<h1 className=\"edit-widgets-header__title\">\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</h1>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isMediumViewport && (\n\t\t\t\t\t\t<VisuallyHidden\n\t\t\t\t\t\t\tas=\"h1\"\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header__title\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t) }\n\t\t\t\t\t<NavigableToolbar\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonClick={ handleClick }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Toggle block inserter',\n\t\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isMediumViewport && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<UndoButton />\n\t\t\t\t\t\t\t\t<RedoButton />\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</NavigableToolbar>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-widgets-header__actions\">\n\t\t\t\t\t<SaveButton />\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t\t<MoreMenu />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Header;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"names":["useShouldContextualToolbarShow","blockEditorPrivateApis","Header","isMediumViewport","inserterButton","widgetAreaClientId","isLastSelectedWidgetAreaOpen","select","editWidgetsStore","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","isInserterOpened","isListViewOpened","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","selectBlock","blockEditorStore","handleClick","window","requestAnimationFrame","toggleListView","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","Button","event","preventDefault","plus","listView"],"mappings":";;;;;;;;;AAaA;;AAVA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAcA;AACA;AACA;AASA,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AEC,IAAA,SAAS,EAAC,+CAFX;AAGC,IAAA,IAAI,EAAGI,eAHR;AAIC,IAAA,SAAS,EAAGpB;AACZ;AALD;AAMC,IAAA,KAAK,EAAG,cAAI,WAAJ,CANT;AAOC,IAAA,OAAO,EAAGW;AAPX,IAHD,CA1BF,CAdD,CADD,EAyDC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,mBAAD,OADD,EAEC,4BAAC,sBAAD,CAAa,IAAb;AAAkB,IAAA,KAAK,EAAC;AAAxB,IAFD,EAGC,4BAAC,iBAAD,OAHD,CAzDD,CADD,CADD;AAmEA;;eAEcpB,M","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem, VisuallyHidden } from '@wordpress/components';\nimport {\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { PinnedItems } from '@wordpress/interface';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SaveButton from '../save-button';\nimport UndoButton from './undo-redo/undo';\nimport RedoButton from './undo-redo/redo';\nimport MoreMenu from '../more-menu';\nimport useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../private-apis';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nfunction Header() {\n\tconst isMediumViewport = useViewportMatch( 'medium' );\n\tconst inserterButton = useRef();\n\tconst widgetAreaClientId = useLastSelectedWidgetArea();\n\tconst isLastSelectedWidgetAreaOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getIsWidgetAreaOpen(\n\t\t\t\twidgetAreaClientId\n\t\t\t),\n\t\t[ widgetAreaClientId ]\n\t);\n\tconst { isInserterOpen, isListViewOpen } = useSelect( ( select ) => {\n\t\tconst { isInserterOpened, isListViewOpened } =\n\t\t\tselect( editWidgetsStore );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t};\n\t}, [] );\n\tconst { setIsWidgetAreaOpen, setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst handleClick = () => {\n\t\tif ( isInserterOpen ) {\n\t\t\t// Focusing the inserter button closes the inserter popover.\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tif ( ! isLastSelectedWidgetAreaOpen ) {\n\t\t\t\t// Select the last selected block if hasn't already.\n\t\t\t\tselectBlock( widgetAreaClientId );\n\t\t\t\t// Open the last selected widget area when opening the inserter.\n\t\t\t\tsetIsWidgetAreaOpen( widgetAreaClientId, true );\n\t\t\t}\n\t\t\t// The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the\n\t\t\t// same tick and pretty much in a random order. The inserter is closed if any other part of the\n\t\t\t// app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then\n\t\t\t// the inserter is visible for a brief moment and then gets auto-closed due to focus moving to\n\t\t\t// the selected block.\n\t\t\twindow.requestAnimationFrame( () => setIsInserterOpened( true ) );\n\t\t}\n\t};\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-widgets-header\">\n\t\t\t\t<div className=\"edit-widgets-header__navigable-toolbar-wrapper\">\n\t\t\t\t\t{ isMediumViewport && (\n\t\t\t\t\t\t<h1 className=\"edit-widgets-header__title\">\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</h1>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isMediumViewport && (\n\t\t\t\t\t\t<VisuallyHidden\n\t\t\t\t\t\t\tas=\"h1\"\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header__title\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t) }\n\t\t\t\t\t<NavigableToolbar\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t\t\tshouldUseKeyboardFocusShortcut={\n\t\t\t\t\t\t\t! blockToolbarCanBeFocused\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonClick={ handleClick }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Toggle block inserter',\n\t\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isMediumViewport && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<UndoButton />\n\t\t\t\t\t\t\t\t<RedoButton />\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</NavigableToolbar>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-widgets-header__actions\">\n\t\t\t\t\t<SaveButton />\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t\t<MoreMenu />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Header;\n"]}
@@ -45,21 +45,16 @@ function ListViewSidebar() {
45
45
  }
46
46
  }
47
47
 
48
- const instanceId = (0, _compose.useInstanceId)(ListViewSidebar);
49
- const labelId = `edit-widgets-editor__list-view-panel-label-${instanceId}`;
50
48
  return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
51
49
  (0, _element.createElement)("div", {
52
- "aria-labelledby": labelId,
53
50
  className: "edit-widgets-editor__list-view-panel",
54
51
  onKeyDown: closeOnEscape
55
52
  }, (0, _element.createElement)("div", {
56
53
  className: "edit-widgets-editor__list-view-panel-header",
57
54
  ref: headerFocusReturnRef
58
- }, (0, _element.createElement)("strong", {
59
- id: labelId
60
- }, (0, _i18n.__)('List View')), (0, _element.createElement)(_components.Button, {
55
+ }, (0, _element.createElement)("strong", null, (0, _i18n.__)('List View')), (0, _element.createElement)(_components.Button, {
61
56
  icon: _icons.closeSmall,
62
- label: (0, _i18n.__)('Close List View Sidebar'),
57
+ label: (0, _i18n.__)('Close'),
63
58
  onClick: () => setIsListViewOpened(false)
64
59
  })), (0, _element.createElement)("div", {
65
60
  className: "edit-widgets-editor__list-view-panel-content",
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["ListViewSidebar","setIsListViewOpened","editWidgetsStore","focusOnMountRef","headerFocusReturnRef","contentFocusReturnRef","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","instanceId","labelId","closeSmall"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AAnBA;AACA;AACA;;AAcA;AACA;AACA;AAGe,SAASA,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,MAA0B,uBAAaC,YAAb,CAAhC;AAEA,QAAMC,eAAe,GAAG,8BAAiB,cAAjB,CAAxB;AACA,QAAMC,oBAAoB,GAAG,8BAA7B;AACA,QAAMC,qBAAqB,GAAG,8BAA9B;;AACA,WAASC,aAAT,CAAwBC,KAAxB,EAAgC;AAC/B,QAAKA,KAAK,CAACC,OAAN,KAAkBC,gBAAlB,IAA4B,CAAEF,KAAK,CAACG,gBAAzC,EAA4D;AAC3DH,MAAAA,KAAK,CAACI,cAAN;AACAV,MAAAA,mBAAmB,CAAE,KAAF,CAAnB;AACA;AACD;;AAED,QAAMW,UAAU,GAAG,4BAAeZ,eAAf,CAAnB;AACA,QAAMa,OAAO,GAAI,8CAA8CD,UAAY,EAA3E;AAEA,SACC;AACA;AACC,yBAAkBC,OADnB;AAEC,MAAA,SAAS,EAAC,sCAFX;AAGC,MAAA,SAAS,EAAGP;AAHb,OAKC;AACC,MAAA,SAAS,EAAC,6CADX;AAEC,MAAA,GAAG,EAAGF;AAFP,OAIC;AAAQ,MAAA,EAAE,EAAGS;AAAb,OAAyB,cAAI,WAAJ,CAAzB,CAJD,EAKC,4BAAC,kBAAD;AACC,MAAA,IAAI,EAAGC,iBADR;AAEC,MAAA,KAAK,EAAG,cAAI,yBAAJ,CAFT;AAGC,MAAA,OAAO,EAAG,MAAMb,mBAAmB,CAAE,KAAF;AAHpC,MALD,CALD,EAgBC;AACC,MAAA,SAAS,EAAC,8CADX;AAEC,MAAA,GAAG,EAAG,2BAAc,CACnBI,qBADmB,EAEnBF,eAFmB,CAAd;AAFP,OAOC,4BAAC,mCAAD,OAPD,CAhBD;AAFD;AA6BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalListView as ListView } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport {\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseInstanceId,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editWidgetsStore );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst headerFocusReturnRef = useFocusReturn();\n\tconst contentFocusReturnRef = useFocusReturn();\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}\n\n\tconst instanceId = useInstanceId( ListViewSidebar );\n\tconst labelId = `edit-widgets-editor__list-view-panel-label-${ instanceId }`;\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\taria-labelledby={ labelId }\n\t\t\tclassName=\"edit-widgets-editor__list-view-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-widgets-editor__list-view-panel-header\"\n\t\t\t\tref={ headerFocusReturnRef }\n\t\t\t>\n\t\t\t\t<strong id={ labelId }>{ __( 'List View' ) }</strong>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close List View Sidebar' ) }\n\t\t\t\t\tonClick={ () => setIsListViewOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-widgets-editor__list-view-panel-content\"\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tcontentFocusReturnRef,\n\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t] ) }\n\t\t\t>\n\t\t\t\t<ListView />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["ListViewSidebar","setIsListViewOpened","editWidgetsStore","focusOnMountRef","headerFocusReturnRef","contentFocusReturnRef","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","closeSmall"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AAlBA;AACA;AACA;;AAaA;AACA;AACA;AAGe,SAASA,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,MAA0B,uBAAaC,YAAb,CAAhC;AAEA,QAAMC,eAAe,GAAG,8BAAiB,cAAjB,CAAxB;AACA,QAAMC,oBAAoB,GAAG,8BAA7B;AACA,QAAMC,qBAAqB,GAAG,8BAA9B;;AACA,WAASC,aAAT,CAAwBC,KAAxB,EAAgC;AAC/B,QAAKA,KAAK,CAACC,OAAN,KAAkBC,gBAAlB,IAA4B,CAAEF,KAAK,CAACG,gBAAzC,EAA4D;AAC3DH,MAAAA,KAAK,CAACI,cAAN;AACAV,MAAAA,mBAAmB,CAAE,KAAF,CAAnB;AACA;AACD;;AAED,SACC;AACA;AACC,MAAA,SAAS,EAAC,sCADX;AAEC,MAAA,SAAS,EAAGK;AAFb,OAIC;AACC,MAAA,SAAS,EAAC,6CADX;AAEC,MAAA,GAAG,EAAGF;AAFP,OAIC,4CAAU,cAAI,WAAJ,CAAV,CAJD,EAKC,4BAAC,kBAAD;AACC,MAAA,IAAI,EAAGQ,iBADR;AAEC,MAAA,KAAK,EAAG,cAAI,OAAJ,CAFT;AAGC,MAAA,OAAO,EAAG,MAAMX,mBAAmB,CAAE,KAAF;AAHpC,MALD,CAJD,EAeC;AACC,MAAA,SAAS,EAAC,8CADX;AAEC,MAAA,GAAG,EAAG,2BAAc,CACnBI,qBADmB,EAEnBF,eAFmB,CAAd;AAFP,OAOC,4BAAC,mCAAD,OAPD,CAfD;AAFD;AA4BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalListView as ListView } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport {\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editWidgetsStore );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst headerFocusReturnRef = useFocusReturn();\n\tconst contentFocusReturnRef = useFocusReturn();\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName=\"edit-widgets-editor__list-view-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-widgets-editor__list-view-panel-header\"\n\t\t\t\tref={ headerFocusReturnRef }\n\t\t\t>\n\t\t\t\t<strong>{ __( 'List View' ) }</strong>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\t\tonClick={ () => setIsListViewOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-widgets-editor__list-view-panel-content\"\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tcontentFocusReturnRef,\n\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t] ) }\n\t\t\t>\n\t\t\t\t<ListView />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
@@ -140,7 +140,7 @@ function Sidebar() {
140
140
  /* translators: button label text should, if possible, be under 16 characters. */
141
141
  ,
142
142
  title: (0, _i18n.__)('Settings'),
143
- closeLabel: (0, _i18n.__)('Close settings'),
143
+ closeLabel: (0, _i18n.__)('Close Settings'),
144
144
  scope: "core/edit-widgets",
145
145
  identifier: currentArea,
146
146
  icon: _icons.cog,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/components/sidebar/index.js"],"names":["SIDEBAR_ACTIVE_BY_DEFAULT","Platform","select","web","native","BLOCK_INSPECTOR_IDENTIFIER","WIDGET_AREAS_IDENTIFIER","ComplementaryAreaTab","identifier","label","isActive","enableComplementaryArea","interfaceStore","editWidgetsStore","name","Sidebar","currentArea","hasSelectedNonAreaBlock","isGeneralSidebarOpen","selectedWidgetAreaBlock","getSelectedBlock","getBlock","getBlockParentsByBlockName","blockEditorStore","getActiveComplementaryArea","selectedBlock","activeArea","currentSelection","widgetAreaBlock","clientId","attributes","cog","id"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AAgBA;;AACA;;AAtCA;AAC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AAC,oBAAD;AACC,MAAA,UAAU,EAAGL,uBADd;AAEC,MAAA,KAAK,EACJa,uBAAuB,GACpBA,uBAAuB,CAACW,UAAxB,CAAmChB,IADf,GAEpB,cAAI,cAAJ,CALL;AAOC,MAAA,QAAQ,EAAGE,WAAW,KAAKV;AAP5B,MADD,CADD,EAYC,wCACC,4BAAC,oBAAD;AACC,MAAA,UAAU,EAAGD,0BADd;AAEC,MAAA,KAAK,EAAG,cAAI,OAAJ,CAFT;AAGC,MAAA,QAAQ,EACPW,WAAW,KAAKX;AAJlB,MADD,CAZD,CAHF;AA0BC,IAAA,eAAe,EAAC;AAChB;AA3BD;AA4BC,IAAA,KAAK,EAAG,cAAI,UAAJ,CA5BT;AA6BC,IAAA,UAAU,EAAG,cAAI,gBAAJ,CA7Bd;AA8BC,IAAA,KAAK,EAAC,mBA9BP;AA+BC,IAAA,UAAU,EAAGW,WA/Bd;AAgCC,IAAA,IAAI,EAAGe,UAhCR;AAiCC,IAAA,iBAAiB,EAAG/B;AAjCrB,KAmCGgB,WAAW,KAAKV,uBAAhB,IACD,4BAAC,oBAAD;AACC,IAAA,oBAAoB,EACnBa,uBADmB,aACnBA,uBADmB,uBACnBA,uBAAuB,CAAEW,UAAzB,CAAoCE;AAFtC,IApCF,EA0CGhB,WAAW,KAAKX,0BAAhB,KACCY,uBAAuB,GACxB,4BAAC,2BAAD,OADwB,GAGxB;AACA;AACA;AAAM,IAAA,SAAS,EAAC;AAAhB,KACG,cAAI,oBAAJ,CADH,CANA,CA1CH,CADD;AAuDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, Platform } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\nimport { cog } from '@wordpress/icons';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';\n\n// Widget areas were one called block areas, so use 'edit-widgets/block-areas'\n// for backwards compatibility.\nconst WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreas from './widget-areas';\nimport { store as editWidgetsStore } from '../../store';\n\nfunction ComplementaryAreaTab( { identifier, label, isActive } ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\treturn (\n\t\t<Button\n\t\t\tonClick={ () =>\n\t\t\t\tenableComplementaryArea( editWidgetsStore.name, identifier )\n\t\t\t}\n\t\t\tclassName={ classnames( 'edit-widgets-sidebar__panel-tab', {\n\t\t\t\t'is-active': isActive,\n\t\t\t} ) }\n\t\t\taria-label={\n\t\t\t\tisActive\n\t\t\t\t\t? // translators: %s: sidebar label e.g: \"Widget Areas\".\n\t\t\t\t\t sprintf( __( '%s (selected)' ), label )\n\t\t\t\t\t: label\n\t\t\t}\n\t\t\tdata-label={ label }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n\nexport default function Sidebar() {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst {\n\t\tcurrentArea,\n\t\thasSelectedNonAreaBlock,\n\t\tisGeneralSidebarOpen,\n\t\tselectedWidgetAreaBlock,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSelectedBlock, getBlock, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\tconst selectedBlock = getSelectedBlock();\n\n\t\tconst activeArea = getActiveComplementaryArea( editWidgetsStore.name );\n\n\t\tlet currentSelection = activeArea;\n\t\tif ( ! currentSelection ) {\n\t\t\tif ( selectedBlock ) {\n\t\t\t\tcurrentSelection = BLOCK_INSPECTOR_IDENTIFIER;\n\t\t\t} else {\n\t\t\t\tcurrentSelection = WIDGET_AREAS_IDENTIFIER;\n\t\t\t}\n\t\t}\n\n\t\tlet widgetAreaBlock;\n\t\tif ( selectedBlock ) {\n\t\t\tif ( selectedBlock.name === 'core/widget-area' ) {\n\t\t\t\twidgetAreaBlock = selectedBlock;\n\t\t\t} else {\n\t\t\t\twidgetAreaBlock = getBlock(\n\t\t\t\t\tgetBlockParentsByBlockName(\n\t\t\t\t\t\tselectedBlock.clientId,\n\t\t\t\t\t\t'core/widget-area'\n\t\t\t\t\t)[ 0 ]\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcurrentArea: currentSelection,\n\t\t\thasSelectedNonAreaBlock: !! (\n\t\t\t\tselectedBlock && selectedBlock.name !== 'core/widget-area'\n\t\t\t),\n\t\t\tisGeneralSidebarOpen: !! activeArea,\n\t\t\tselectedWidgetAreaBlock: widgetAreaBlock,\n\t\t};\n\t}, [] );\n\n\t// currentArea, and isGeneralSidebarOpen are intentionally left out from the dependencies,\n\t// because we want to run the effect when a block is selected/unselected and not when the sidebar state changes.\n\tuseEffect( () => {\n\t\tif (\n\t\t\thasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === WIDGET_AREAS_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tBLOCK_INSPECTOR_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\t! hasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tWIDGET_AREAS_IDENTIFIER\n\t\t\t);\n\t\t}\n\t}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<ul>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<ComplementaryAreaTab\n\t\t\t\t\t\t\tidentifier={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tselectedWidgetAreaBlock\n\t\t\t\t\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t\t\t\t\t: __( 'Widget Areas' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisActive={ currentArea === WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<ComplementaryAreaTab\n\t\t\t\t\t\t\tidentifier={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\t\t\tlabel={ __( 'Block' ) }\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t}\n\t\t\theaderClassName=\"edit-widgets-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\tcloseLabel={ __( 'Close settings' ) }\n\t\t\tscope=\"core/edit-widgets\"\n\t\t\tidentifier={ currentArea }\n\t\t\ticon={ cog }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t{ currentArea === WIDGET_AREAS_IDENTIFIER && (\n\t\t\t\t<WidgetAreas\n\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ currentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\t\t( hasSelectedNonAreaBlock ? (\n\t\t\t\t\t<BlockInspector />\n\t\t\t\t) : (\n\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t</span>\n\t\t\t\t) ) }\n\t\t</ComplementaryArea>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/components/sidebar/index.js"],"names":["SIDEBAR_ACTIVE_BY_DEFAULT","Platform","select","web","native","BLOCK_INSPECTOR_IDENTIFIER","WIDGET_AREAS_IDENTIFIER","ComplementaryAreaTab","identifier","label","isActive","enableComplementaryArea","interfaceStore","editWidgetsStore","name","Sidebar","currentArea","hasSelectedNonAreaBlock","isGeneralSidebarOpen","selectedWidgetAreaBlock","getSelectedBlock","getBlock","getBlockParentsByBlockName","blockEditorStore","getActiveComplementaryArea","selectedBlock","activeArea","currentSelection","widgetAreaBlock","clientId","attributes","cog","id"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AAgBA;;AACA;;AAtCA;AACA;AACA;;AAGA;AACA;AACA;AAgBA,MAAMA,yBAAyB,GAAGC,kBAASC,MAAT,CAAiB;AAClDC,EAAAA,GAAG,EAAE,IAD6C;AAElDC,EAAAA,MAAM,EAAE;AAF0C,CAAjB,CAAlC;;AAKA,MAAMC,0BAA0B,GAAG,8BAAnC,C,CAEA;AACA;;AACA,MAAMC,uBAAuB,GAAG,0BAAhC;AAEA;AACA;AACA;;AAIA,SAASC,oBAAT,OAAiE;AAAA,MAAlC;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,KAAd;AAAqBC,IAAAA;AAArB,GAAkC;AAChE,QAAM;AAAEC,IAAAA;AAAF,MAA8B,uBAAaC,gBAAb,CAApC;AACA,SACC,4BAAC,kBAAD;AACC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UAAU,EAAG,cAAI,gBAAJ,CA7Bd;AA8BC,IAAA,KAAK,EAAC,mBA9BP;AA+BC,IAAA,UAAU,EAAGW,WA/Bd;AAgCC,IAAA,IAAI,EAAGe,UAhCR;AAiCC,IAAA,iBAAiB,EAAG/B;AAjCrB,KAmCGgB,WAAW,KAAKV,uBAAhB,IACD,4BAAC,oBAAD;AACC,IAAA,oBAAoB,EACnBa,uBADmB,aACnBA,uBADmB,uBACnBA,uBAAuB,CAAEW,UAAzB,CAAoCE;AAFtC,IApCF,EA0CGhB,WAAW,KAAKX,0BAAhB,KACCY,uBAAuB,GACxB,4BAAC,2BAAD,OADwB,GAGxB;AACA;AACA;AAAM,IAAA,SAAS,EAAC;AAAhB,KACG,cAAI,oBAAJ,CADH,CANA,CA1CH,CADD;AAuDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, Platform } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\nimport { cog } from '@wordpress/icons';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';\n\n// Widget areas were one called block areas, so use 'edit-widgets/block-areas'\n// for backwards compatibility.\nconst WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreas from './widget-areas';\nimport { store as editWidgetsStore } from '../../store';\n\nfunction ComplementaryAreaTab( { identifier, label, isActive } ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\treturn (\n\t\t<Button\n\t\t\tonClick={ () =>\n\t\t\t\tenableComplementaryArea( editWidgetsStore.name, identifier )\n\t\t\t}\n\t\t\tclassName={ classnames( 'edit-widgets-sidebar__panel-tab', {\n\t\t\t\t'is-active': isActive,\n\t\t\t} ) }\n\t\t\taria-label={\n\t\t\t\tisActive\n\t\t\t\t\t? // translators: %s: sidebar label e.g: \"Widget Areas\".\n\t\t\t\t\t sprintf( __( '%s (selected)' ), label )\n\t\t\t\t\t: label\n\t\t\t}\n\t\t\tdata-label={ label }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n\nexport default function Sidebar() {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst {\n\t\tcurrentArea,\n\t\thasSelectedNonAreaBlock,\n\t\tisGeneralSidebarOpen,\n\t\tselectedWidgetAreaBlock,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSelectedBlock, getBlock, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\tconst selectedBlock = getSelectedBlock();\n\n\t\tconst activeArea = getActiveComplementaryArea( editWidgetsStore.name );\n\n\t\tlet currentSelection = activeArea;\n\t\tif ( ! currentSelection ) {\n\t\t\tif ( selectedBlock ) {\n\t\t\t\tcurrentSelection = BLOCK_INSPECTOR_IDENTIFIER;\n\t\t\t} else {\n\t\t\t\tcurrentSelection = WIDGET_AREAS_IDENTIFIER;\n\t\t\t}\n\t\t}\n\n\t\tlet widgetAreaBlock;\n\t\tif ( selectedBlock ) {\n\t\t\tif ( selectedBlock.name === 'core/widget-area' ) {\n\t\t\t\twidgetAreaBlock = selectedBlock;\n\t\t\t} else {\n\t\t\t\twidgetAreaBlock = getBlock(\n\t\t\t\t\tgetBlockParentsByBlockName(\n\t\t\t\t\t\tselectedBlock.clientId,\n\t\t\t\t\t\t'core/widget-area'\n\t\t\t\t\t)[ 0 ]\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcurrentArea: currentSelection,\n\t\t\thasSelectedNonAreaBlock: !! (\n\t\t\t\tselectedBlock && selectedBlock.name !== 'core/widget-area'\n\t\t\t),\n\t\t\tisGeneralSidebarOpen: !! activeArea,\n\t\t\tselectedWidgetAreaBlock: widgetAreaBlock,\n\t\t};\n\t}, [] );\n\n\t// currentArea, and isGeneralSidebarOpen are intentionally left out from the dependencies,\n\t// because we want to run the effect when a block is selected/unselected and not when the sidebar state changes.\n\tuseEffect( () => {\n\t\tif (\n\t\t\thasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === WIDGET_AREAS_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tBLOCK_INSPECTOR_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\t! hasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tWIDGET_AREAS_IDENTIFIER\n\t\t\t);\n\t\t}\n\t}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<ul>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<ComplementaryAreaTab\n\t\t\t\t\t\t\tidentifier={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tselectedWidgetAreaBlock\n\t\t\t\t\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t\t\t\t\t: __( 'Widget Areas' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisActive={ currentArea === WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<ComplementaryAreaTab\n\t\t\t\t\t\t\tidentifier={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\t\t\tlabel={ __( 'Block' ) }\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t}\n\t\t\theaderClassName=\"edit-widgets-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\tscope=\"core/edit-widgets\"\n\t\t\tidentifier={ currentArea }\n\t\t\ticon={ cog }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t{ currentArea === WIDGET_AREAS_IDENTIFIER && (\n\t\t\t\t<WidgetAreas\n\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ currentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\t\t( hasSelectedNonAreaBlock ? (\n\t\t\t\t\t<BlockInspector />\n\t\t\t\t) : (\n\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t</span>\n\t\t\t\t) ) }\n\t\t</ComplementaryArea>\n\t);\n}\n"]}
@@ -6,7 +6,7 @@ import { createElement, Fragment } from "@wordpress/element";
6
6
  import { useSelect, useDispatch } from '@wordpress/data';
7
7
  import { __, _x } from '@wordpress/i18n';
8
8
  import { Button, ToolbarItem, VisuallyHidden } from '@wordpress/components';
9
- import { NavigableToolbar, store as blockEditorStore } from '@wordpress/block-editor';
9
+ import { NavigableToolbar, store as blockEditorStore, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
10
10
  import { PinnedItems } from '@wordpress/interface';
11
11
  import { listView, plus } from '@wordpress/icons';
12
12
  import { useCallback, useRef } from '@wordpress/element';
@@ -21,6 +21,10 @@ import RedoButton from './undo-redo/redo';
21
21
  import MoreMenu from '../more-menu';
22
22
  import useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';
23
23
  import { store as editWidgetsStore } from '../../store';
24
+ import { unlock } from '../../private-apis';
25
+ const {
26
+ useShouldContextualToolbarShow
27
+ } = unlock(blockEditorPrivateApis);
24
28
 
25
29
  function Header() {
26
30
  const isMediumViewport = useViewportMatch('medium');
@@ -71,6 +75,14 @@ function Header() {
71
75
  };
72
76
 
73
77
  const toggleListView = useCallback(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
78
+ const {
79
+ shouldShowContextualToolbar,
80
+ canFocusHiddenToolbar,
81
+ fixedToolbarCanBeFocused
82
+ } = useShouldContextualToolbarShow(); // If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.
83
+ // There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.
84
+
85
+ const blockToolbarCanBeFocused = shouldShowContextualToolbar || canFocusHiddenToolbar || fixedToolbarCanBeFocused;
74
86
  return createElement(Fragment, null, createElement("div", {
75
87
  className: "edit-widgets-header"
76
88
  }, createElement("div", {
@@ -82,7 +94,8 @@ function Header() {
82
94
  className: "edit-widgets-header__title"
83
95
  }, __('Widgets')), createElement(NavigableToolbar, {
84
96
  className: "edit-widgets-header-toolbar",
85
- "aria-label": __('Document tools')
97
+ "aria-label": __('Document tools'),
98
+ shouldUseKeyboardFocusShortcut: !blockToolbarCanBeFocused
86
99
  }, createElement(ToolbarItem, {
87
100
  ref: inserterButton,
88
101
  as: Button,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"names":["useSelect","useDispatch","__","_x","Button","ToolbarItem","VisuallyHidden","NavigableToolbar","store","blockEditorStore","PinnedItems","listView","plus","useCallback","useRef","useViewportMatch","SaveButton","UndoButton","RedoButton","MoreMenu","useLastSelectedWidgetArea","editWidgetsStore","Header","isMediumViewport","inserterButton","widgetAreaClientId","isLastSelectedWidgetAreaOpen","select","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","isInserterOpened","isListViewOpened","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","selectBlock","handleClick","window","requestAnimationFrame","toggleListView","event","preventDefault"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,MAAT,EAAiBC,WAAjB,EAA8BC,cAA9B,QAAoD,uBAApD;AACA,SACCC,gBADD,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,WAAT,QAA4B,sBAA5B;AACA,SAASC,QAAT,EAAmBC,IAAnB,QAA+B,kBAA/B;AACA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,oBAApC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,UAAP,MAAuB,kBAAvB;AACA,OAAOC,UAAP,MAAuB,kBAAvB;AACA,OAAOC,QAAP,MAAqB,cAArB;AACA,OAAOC,yBAAP,MAAsC,2CAAtC;AACA,SAASZ,KAAK,IAAIa,gBAAlB,QAA0C,aAA1C;;AAEA,SAASC,MAAT,GAAkB;AACjB,QAAMC,gBAAgB,GAAGR,gBAAgB,CAAE,QAAF,CAAzC;AACA,QAAMS,cAAc,GAAGV,MAAM,EAA7B;AACA,QAAMW,kBAAkB,GAAGL,yBAAyB,EAApD;AACA,QAAMM,4BAA4B,GAAG1B,SAAS,CAC3C2B,MAA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* WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem, VisuallyHidden } from '@wordpress/components';\nimport {\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { PinnedItems } from '@wordpress/interface';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SaveButton from '../save-button';\nimport UndoButton from './undo-redo/undo';\nimport RedoButton from './undo-redo/redo';\nimport MoreMenu from '../more-menu';\nimport useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../store';\n\nfunction Header() {\n\tconst isMediumViewport = useViewportMatch( 'medium' );\n\tconst inserterButton = useRef();\n\tconst widgetAreaClientId = useLastSelectedWidgetArea();\n\tconst isLastSelectedWidgetAreaOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getIsWidgetAreaOpen(\n\t\t\t\twidgetAreaClientId\n\t\t\t),\n\t\t[ widgetAreaClientId ]\n\t);\n\tconst { isInserterOpen, isListViewOpen } = useSelect( ( select ) => {\n\t\tconst { isInserterOpened, isListViewOpened } =\n\t\t\tselect( editWidgetsStore );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t};\n\t}, [] );\n\tconst { setIsWidgetAreaOpen, setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst handleClick = () => {\n\t\tif ( isInserterOpen ) {\n\t\t\t// Focusing the inserter button closes the inserter popover.\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tif ( ! isLastSelectedWidgetAreaOpen ) {\n\t\t\t\t// Select the last selected block if hasn't already.\n\t\t\t\tselectBlock( widgetAreaClientId );\n\t\t\t\t// Open the last selected widget area when opening the inserter.\n\t\t\t\tsetIsWidgetAreaOpen( widgetAreaClientId, true );\n\t\t\t}\n\t\t\t// The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the\n\t\t\t// same tick and pretty much in a random order. The inserter is closed if any other part of the\n\t\t\t// app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then\n\t\t\t// the inserter is visible for a brief moment and then gets auto-closed due to focus moving to\n\t\t\t// the selected block.\n\t\t\twindow.requestAnimationFrame( () => setIsInserterOpened( true ) );\n\t\t}\n\t};\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-widgets-header\">\n\t\t\t\t<div className=\"edit-widgets-header__navigable-toolbar-wrapper\">\n\t\t\t\t\t{ isMediumViewport && (\n\t\t\t\t\t\t<h1 className=\"edit-widgets-header__title\">\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</h1>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isMediumViewport && (\n\t\t\t\t\t\t<VisuallyHidden\n\t\t\t\t\t\t\tas=\"h1\"\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header__title\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t) }\n\t\t\t\t\t<NavigableToolbar\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonClick={ handleClick }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Toggle block inserter',\n\t\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isMediumViewport && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<UndoButton />\n\t\t\t\t\t\t\t\t<RedoButton />\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</NavigableToolbar>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-widgets-header__actions\">\n\t\t\t\t\t<SaveButton />\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t\t<MoreMenu />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Header;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"names":["useSelect","useDispatch","__","_x","Button","ToolbarItem","VisuallyHidden","NavigableToolbar","store","blockEditorStore","privateApis","blockEditorPrivateApis","PinnedItems","listView","plus","useCallback","useRef","useViewportMatch","SaveButton","UndoButton","RedoButton","MoreMenu","useLastSelectedWidgetArea","editWidgetsStore","unlock","useShouldContextualToolbarShow","Header","isMediumViewport","inserterButton","widgetAreaClientId","isLastSelectedWidgetAreaOpen","select","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","isInserterOpened","isListViewOpened","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","selectBlock","handleClick","window","requestAnimationFrame","toggleListView","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","event","preventDefault"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,MAAT,EAAiBC,WAAjB,EAA8BC,cAA9B,QAAoD,uBAApD;AACA,SACCC,gBADD,EAECC,KAAK,IAAIC,gBAFV,EAGCC,WAAW,IAAIC,sBAHhB,QAIO,yBAJP;AAKA,SAASC,WAAT,QAA4B,sBAA5B;AACA,SAASC,QAAT,EAAmBC,IAAnB,QAA+B,kBAA/B;AACA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,oBAApC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,UAAP,MAAuB,kBAAvB;AACA,OAAOC,UAAP,MAAuB,kBAAvB;AACA,OAAOC,QAAP,MAAqB,cAArB;AACA,OAAOC,yBAAP,MAAsC,2CAAtC;AACA,SAASd,KAAK,IAAIe,gBAAlB,QAA0C,aAA1C;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAqCD,MAAM,CAAEb,sBAAF,CAAjD;;AAEA,SAASe,MAAT,GAAkB;AACjB,QAAMC,gBAAgB,GAAGV,gBAAgB,CAAE,QAAF,CAAzC;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,QAHR;AAIC,IAAA,SAAS,EAAGqB;AACZ;AALD;AAMC,IAAA,KAAK,EAAGhC,EAAE,CAAE,WAAF,CANX;AAOC,IAAA,OAAO,EAAG0C;AAPX,IAHD,CA1BF,CAdD,CADD,EAyDC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,UAAD,OADD,EAEC,cAAC,WAAD,CAAa,IAAb;AAAkB,IAAA,KAAK,EAAC;AAAxB,IAFD,EAGC,cAAC,QAAD,OAHD,CAzDD,CADD,CADD;AAmEA;;AAED,eAAelB,MAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem, VisuallyHidden } from '@wordpress/components';\nimport {\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { PinnedItems } from '@wordpress/interface';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SaveButton from '../save-button';\nimport UndoButton from './undo-redo/undo';\nimport RedoButton from './undo-redo/redo';\nimport MoreMenu from '../more-menu';\nimport useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../private-apis';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nfunction Header() {\n\tconst isMediumViewport = useViewportMatch( 'medium' );\n\tconst inserterButton = useRef();\n\tconst widgetAreaClientId = useLastSelectedWidgetArea();\n\tconst isLastSelectedWidgetAreaOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getIsWidgetAreaOpen(\n\t\t\t\twidgetAreaClientId\n\t\t\t),\n\t\t[ widgetAreaClientId ]\n\t);\n\tconst { isInserterOpen, isListViewOpen } = useSelect( ( select ) => {\n\t\tconst { isInserterOpened, isListViewOpened } =\n\t\t\tselect( editWidgetsStore );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t};\n\t}, [] );\n\tconst { setIsWidgetAreaOpen, setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst handleClick = () => {\n\t\tif ( isInserterOpen ) {\n\t\t\t// Focusing the inserter button closes the inserter popover.\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tif ( ! isLastSelectedWidgetAreaOpen ) {\n\t\t\t\t// Select the last selected block if hasn't already.\n\t\t\t\tselectBlock( widgetAreaClientId );\n\t\t\t\t// Open the last selected widget area when opening the inserter.\n\t\t\t\tsetIsWidgetAreaOpen( widgetAreaClientId, true );\n\t\t\t}\n\t\t\t// The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the\n\t\t\t// same tick and pretty much in a random order. The inserter is closed if any other part of the\n\t\t\t// app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then\n\t\t\t// the inserter is visible for a brief moment and then gets auto-closed due to focus moving to\n\t\t\t// the selected block.\n\t\t\twindow.requestAnimationFrame( () => setIsInserterOpened( true ) );\n\t\t}\n\t};\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-widgets-header\">\n\t\t\t\t<div className=\"edit-widgets-header__navigable-toolbar-wrapper\">\n\t\t\t\t\t{ isMediumViewport && (\n\t\t\t\t\t\t<h1 className=\"edit-widgets-header__title\">\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</h1>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isMediumViewport && (\n\t\t\t\t\t\t<VisuallyHidden\n\t\t\t\t\t\t\tas=\"h1\"\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header__title\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t) }\n\t\t\t\t\t<NavigableToolbar\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t\t\tshouldUseKeyboardFocusShortcut={\n\t\t\t\t\t\t\t! blockToolbarCanBeFocused\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonClick={ handleClick }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Toggle block inserter',\n\t\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isMediumViewport && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<UndoButton />\n\t\t\t\t\t\t\t\t<RedoButton />\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</NavigableToolbar>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-widgets-header__actions\">\n\t\t\t\t\t<SaveButton />\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t\t<MoreMenu />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Header;\n"]}
@@ -5,7 +5,7 @@ import { createElement } from "@wordpress/element";
5
5
  */
6
6
  import { __experimentalListView as ListView } from '@wordpress/block-editor';
7
7
  import { Button } from '@wordpress/components';
8
- import { useFocusOnMount, useFocusReturn, useInstanceId, useMergeRefs } from '@wordpress/compose';
8
+ import { useFocusOnMount, useFocusReturn, useMergeRefs } from '@wordpress/compose';
9
9
  import { useDispatch } from '@wordpress/data';
10
10
  import { __ } from '@wordpress/i18n';
11
11
  import { closeSmall } from '@wordpress/icons';
@@ -30,21 +30,16 @@ export default function ListViewSidebar() {
30
30
  }
31
31
  }
32
32
 
33
- const instanceId = useInstanceId(ListViewSidebar);
34
- const labelId = `edit-widgets-editor__list-view-panel-label-${instanceId}`;
35
33
  return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
36
34
  createElement("div", {
37
- "aria-labelledby": labelId,
38
35
  className: "edit-widgets-editor__list-view-panel",
39
36
  onKeyDown: closeOnEscape
40
37
  }, createElement("div", {
41
38
  className: "edit-widgets-editor__list-view-panel-header",
42
39
  ref: headerFocusReturnRef
43
- }, createElement("strong", {
44
- id: labelId
45
- }, __('List View')), createElement(Button, {
40
+ }, createElement("strong", null, __('List View')), createElement(Button, {
46
41
  icon: closeSmall,
47
- label: __('Close List View Sidebar'),
42
+ label: __('Close'),
48
43
  onClick: () => setIsListViewOpened(false)
49
44
  })), createElement("div", {
50
45
  className: "edit-widgets-editor__list-view-panel-content",
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["__experimentalListView","ListView","Button","useFocusOnMount","useFocusReturn","useInstanceId","useMergeRefs","useDispatch","__","closeSmall","ESCAPE","store","editWidgetsStore","ListViewSidebar","setIsListViewOpened","focusOnMountRef","headerFocusReturnRef","contentFocusReturnRef","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","instanceId","labelId"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,sBAAsB,IAAIC,QAAnC,QAAmD,yBAAnD;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SACCC,eADD,EAECC,cAFD,EAGCC,aAHD,EAICC,YAJD,QAKO,oBALP;AAMA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SAASC,MAAT,QAAuB,qBAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,eAAe,SAASC,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,MAA0BP,WAAW,CAAEK,gBAAF,CAA3C;AAEA,QAAMG,eAAe,GAAGZ,eAAe,CAAE,cAAF,CAAvC;AACA,QAAMa,oBAAoB,GAAGZ,cAAc,EAA3C;AACA,QAAMa,qBAAqB,GAAGb,cAAc,EAA5C;;AACA,WAASc,aAAT,CAAwBC,KAAxB,EAAgC;AAC/B,QAAKA,KAAK,CAACC,OAAN,KAAkBV,MAAlB,IAA4B,CAAES,KAAK,CAACE,gBAAzC,EAA4D;AAC3DF,MAAAA,KAAK,CAACG,cAAN;AACAR,MAAAA,mBAAmB,CAAE,KAAF,CAAnB;AACA;AACD;;AAED,QAAMS,UAAU,GAAGlB,aAAa,CAAEQ,eAAF,CAAhC;AACA,QAAMW,OAAO,GAAI,8CAA8CD,UAAY,EAA3E;AAEA,SACC;AACA;AACC,yBAAkBC,OADnB;AAEC,MAAA,SAAS,EAAC,sCAFX;AAGC,MAAA,SAAS,EAAGN;AAHb,OAKC;AACC,MAAA,SAAS,EAAC,6CADX;AAEC,MAAA,GAAG,EAAGF;AAFP,OAIC;AAAQ,MAAA,EAAE,EAAGQ;AAAb,OAAyBhB,EAAE,CAAE,WAAF,CAA3B,CAJD,EAKC,cAAC,MAAD;AACC,MAAA,IAAI,EAAGC,UADR;AAEC,MAAA,KAAK,EAAGD,EAAE,CAAE,yBAAF,CAFX;AAGC,MAAA,OAAO,EAAG,MAAMM,mBAAmB,CAAE,KAAF;AAHpC,MALD,CALD,EAgBC;AACC,MAAA,SAAS,EAAC,8CADX;AAEC,MAAA,GAAG,EAAGR,YAAY,CAAE,CACnBW,qBADmB,EAEnBF,eAFmB,CAAF;AAFnB,OAOC,cAAC,QAAD,OAPD,CAhBD;AAFD;AA6BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalListView as ListView } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport {\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseInstanceId,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editWidgetsStore );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst headerFocusReturnRef = useFocusReturn();\n\tconst contentFocusReturnRef = useFocusReturn();\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}\n\n\tconst instanceId = useInstanceId( ListViewSidebar );\n\tconst labelId = `edit-widgets-editor__list-view-panel-label-${ instanceId }`;\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\taria-labelledby={ labelId }\n\t\t\tclassName=\"edit-widgets-editor__list-view-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-widgets-editor__list-view-panel-header\"\n\t\t\t\tref={ headerFocusReturnRef }\n\t\t\t>\n\t\t\t\t<strong id={ labelId }>{ __( 'List View' ) }</strong>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close List View Sidebar' ) }\n\t\t\t\t\tonClick={ () => setIsListViewOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-widgets-editor__list-view-panel-content\"\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tcontentFocusReturnRef,\n\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t] ) }\n\t\t\t>\n\t\t\t\t<ListView />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/list-view-sidebar.js"],"names":["__experimentalListView","ListView","Button","useFocusOnMount","useFocusReturn","useMergeRefs","useDispatch","__","closeSmall","ESCAPE","store","editWidgetsStore","ListViewSidebar","setIsListViewOpened","focusOnMountRef","headerFocusReturnRef","contentFocusReturnRef","closeOnEscape","event","keyCode","defaultPrevented","preventDefault"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,sBAAsB,IAAIC,QAAnC,QAAmD,yBAAnD;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SACCC,eADD,EAECC,cAFD,EAGCC,YAHD,QAIO,oBAJP;AAKA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SAASC,MAAT,QAAuB,qBAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,eAAe,SAASC,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,MAA0BP,WAAW,CAAEK,gBAAF,CAA3C;AAEA,QAAMG,eAAe,GAAGX,eAAe,CAAE,cAAF,CAAvC;AACA,QAAMY,oBAAoB,GAAGX,cAAc,EAA3C;AACA,QAAMY,qBAAqB,GAAGZ,cAAc,EAA5C;;AACA,WAASa,aAAT,CAAwBC,KAAxB,EAAgC;AAC/B,QAAKA,KAAK,CAACC,OAAN,KAAkBV,MAAlB,IAA4B,CAAES,KAAK,CAACE,gBAAzC,EAA4D;AAC3DF,MAAAA,KAAK,CAACG,cAAN;AACAR,MAAAA,mBAAmB,CAAE,KAAF,CAAnB;AACA;AACD;;AAED,SACC;AACA;AACC,MAAA,SAAS,EAAC,sCADX;AAEC,MAAA,SAAS,EAAGI;AAFb,OAIC;AACC,MAAA,SAAS,EAAC,6CADX;AAEC,MAAA,GAAG,EAAGF;AAFP,OAIC,8BAAUR,EAAE,CAAE,WAAF,CAAZ,CAJD,EAKC,cAAC,MAAD;AACC,MAAA,IAAI,EAAGC,UADR;AAEC,MAAA,KAAK,EAAGD,EAAE,CAAE,OAAF,CAFX;AAGC,MAAA,OAAO,EAAG,MAAMM,mBAAmB,CAAE,KAAF;AAHpC,MALD,CAJD,EAeC;AACC,MAAA,SAAS,EAAC,8CADX;AAEC,MAAA,GAAG,EAAGR,YAAY,CAAE,CACnBW,qBADmB,EAEnBF,eAFmB,CAAF;AAFnB,OAOC,cAAC,QAAD,OAPD,CAfD;AAFD;AA4BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalListView as ListView } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport {\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editWidgetsStore );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst headerFocusReturnRef = useFocusReturn();\n\tconst contentFocusReturnRef = useFocusReturn();\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName=\"edit-widgets-editor__list-view-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-widgets-editor__list-view-panel-header\"\n\t\t\t\tref={ headerFocusReturnRef }\n\t\t\t>\n\t\t\t\t<strong>{ __( 'List View' ) }</strong>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\t\tonClick={ () => setIsListViewOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-widgets-editor__list-view-panel-content\"\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tcontentFocusReturnRef,\n\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t] ) }\n\t\t\t>\n\t\t\t\t<ListView />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
@@ -123,7 +123,7 @@ export default function Sidebar() {
123
123
  /* translators: button label text should, if possible, be under 16 characters. */
124
124
  ,
125
125
  title: __('Settings'),
126
- closeLabel: __('Close settings'),
126
+ closeLabel: __('Close Settings'),
127
127
  scope: "core/edit-widgets",
128
128
  identifier: currentArea,
129
129
  icon: cog,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/components/sidebar/index.js"],"names":["classnames","useEffect","Platform","__","sprintf","ComplementaryArea","store","interfaceStore","BlockInspector","blockEditorStore","cog","Button","useSelect","useDispatch","SIDEBAR_ACTIVE_BY_DEFAULT","select","web","native","BLOCK_INSPECTOR_IDENTIFIER","WIDGET_AREAS_IDENTIFIER","WidgetAreas","editWidgetsStore","ComplementaryAreaTab","identifier","label","isActive","enableComplementaryArea","name","Sidebar","currentArea","hasSelectedNonAreaBlock","isGeneralSidebarOpen","selectedWidgetAreaBlock","getSelectedBlock","getBlock","getBlockParentsByBlockName","getActiveComplementaryArea","selectedBlock","activeArea","currentSelection","widgetAreaBlock","clientId","attributes","id"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,iBADD,EAECC,KAAK,IAAIC,cAFV,QAGO,sBAHP;AAIA,SACCC,cADD,EAECF,KAAK,IAAIG,gBAFV,QAGO,yBAHP;AAKA,SAASC,GAAT,QAAoB,kBAApB;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AAEA,MAAMC,yBAAyB,GA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AAF,EAA2BJ,uBAA3B,CArBM,CAAT;AAuBA,SACC,cAAC,iBAAD;AACC,IAAA,SAAS,EAAC,sBADX;AAEC,IAAA,MAAM,EACL,0BACC,0BACC,cAAC,oBAAD;AACC,MAAA,UAAU,EAAGP,uBADd;AAEC,MAAA,KAAK,EACJa,uBAAuB,GACpBA,uBAAuB,CAACU,UAAxB,CAAmCf,IADf,GAEpBxB,EAAE,CAAE,cAAF,CALP;AAOC,MAAA,QAAQ,EAAG0B,WAAW,KAAKV;AAP5B,MADD,CADD,EAYC,0BACC,cAAC,oBAAD;AACC,MAAA,UAAU,EAAGD,0BADd;AAEC,MAAA,KAAK,EAAGf,EAAE,CAAE,OAAF,CAFX;AAGC,MAAA,QAAQ,EACP0B,WAAW,KAAKX;AAJlB,MADD,CAZD,CAHF;AA0BC,IAAA,eAAe,EAAC;AAChB;AA3BD;AA4BC,IAAA,KAAK,EAAGf,EAAE,CAAE,UAAF,CA5BX;AA6BC,IAAA,UAAU,EAAGA,EAAE,CAAE,gBAAF,CA7BhB;AA8BC,IAAA,KAAK,EAAC,mBA9BP;AA+BC,IAAA,UAAU,EAAG0B,WA/Bd;AAgCC,IAAA,IAAI,EAAGnB,GAhCR;AAiCC,IAAA,iBAAiB,EAAGI;AAjCrB,KAmCGe,WAAW,KAAKV,uBAAhB,IACD,cAAC,WAAD;AACC,IAAA,oBAAoB,EACnBa,uBADmB,aACnBA,uBADmB,uBACnBA,uBAAuB,CAAEU,UAAzB,CAAoCC;AAFtC,IApCF,EA0CGd,WAAW,KAAKX,0BAAhB,KACCY,uBAAuB,GACxB,cAAC,cAAD,OADwB,GAGxB;AACA;AACA;AAAM,IAAA,SAAS,EAAC;AAAhB,KACG3B,EAAE,CAAE,oBAAF,CADL,CANA,CA1CH,CADD;AAuDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, Platform } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\nimport { cog } from '@wordpress/icons';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';\n\n// Widget areas were one called block areas, so use 'edit-widgets/block-areas'\n// for backwards compatibility.\nconst WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreas from './widget-areas';\nimport { store as editWidgetsStore } from '../../store';\n\nfunction ComplementaryAreaTab( { identifier, label, isActive } ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\treturn (\n\t\t<Button\n\t\t\tonClick={ () =>\n\t\t\t\tenableComplementaryArea( editWidgetsStore.name, identifier )\n\t\t\t}\n\t\t\tclassName={ classnames( 'edit-widgets-sidebar__panel-tab', {\n\t\t\t\t'is-active': isActive,\n\t\t\t} ) }\n\t\t\taria-label={\n\t\t\t\tisActive\n\t\t\t\t\t? // translators: %s: sidebar label e.g: \"Widget Areas\".\n\t\t\t\t\t sprintf( __( '%s (selected)' ), label )\n\t\t\t\t\t: label\n\t\t\t}\n\t\t\tdata-label={ label }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n\nexport default function Sidebar() {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst {\n\t\tcurrentArea,\n\t\thasSelectedNonAreaBlock,\n\t\tisGeneralSidebarOpen,\n\t\tselectedWidgetAreaBlock,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSelectedBlock, getBlock, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\tconst selectedBlock = getSelectedBlock();\n\n\t\tconst activeArea = getActiveComplementaryArea( editWidgetsStore.name );\n\n\t\tlet currentSelection = activeArea;\n\t\tif ( ! currentSelection ) {\n\t\t\tif ( selectedBlock ) {\n\t\t\t\tcurrentSelection = BLOCK_INSPECTOR_IDENTIFIER;\n\t\t\t} else {\n\t\t\t\tcurrentSelection = WIDGET_AREAS_IDENTIFIER;\n\t\t\t}\n\t\t}\n\n\t\tlet widgetAreaBlock;\n\t\tif ( selectedBlock ) {\n\t\t\tif ( selectedBlock.name === 'core/widget-area' ) {\n\t\t\t\twidgetAreaBlock = selectedBlock;\n\t\t\t} else {\n\t\t\t\twidgetAreaBlock = getBlock(\n\t\t\t\t\tgetBlockParentsByBlockName(\n\t\t\t\t\t\tselectedBlock.clientId,\n\t\t\t\t\t\t'core/widget-area'\n\t\t\t\t\t)[ 0 ]\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcurrentArea: currentSelection,\n\t\t\thasSelectedNonAreaBlock: !! (\n\t\t\t\tselectedBlock && selectedBlock.name !== 'core/widget-area'\n\t\t\t),\n\t\t\tisGeneralSidebarOpen: !! activeArea,\n\t\t\tselectedWidgetAreaBlock: widgetAreaBlock,\n\t\t};\n\t}, [] );\n\n\t// currentArea, and isGeneralSidebarOpen are intentionally left out from the dependencies,\n\t// because we want to run the effect when a block is selected/unselected and not when the sidebar state changes.\n\tuseEffect( () => {\n\t\tif (\n\t\t\thasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === WIDGET_AREAS_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tBLOCK_INSPECTOR_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\t! hasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tWIDGET_AREAS_IDENTIFIER\n\t\t\t);\n\t\t}\n\t}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<ul>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<ComplementaryAreaTab\n\t\t\t\t\t\t\tidentifier={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tselectedWidgetAreaBlock\n\t\t\t\t\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t\t\t\t\t: __( 'Widget Areas' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisActive={ currentArea === WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<ComplementaryAreaTab\n\t\t\t\t\t\t\tidentifier={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\t\t\tlabel={ __( 'Block' ) }\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t}\n\t\t\theaderClassName=\"edit-widgets-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\tcloseLabel={ __( 'Close settings' ) }\n\t\t\tscope=\"core/edit-widgets\"\n\t\t\tidentifier={ currentArea }\n\t\t\ticon={ cog }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t{ currentArea === WIDGET_AREAS_IDENTIFIER && (\n\t\t\t\t<WidgetAreas\n\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ currentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\t\t( hasSelectedNonAreaBlock ? (\n\t\t\t\t\t<BlockInspector />\n\t\t\t\t) : (\n\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t</span>\n\t\t\t\t) ) }\n\t\t</ComplementaryArea>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/components/sidebar/index.js"],"names":["classnames","useEffect","Platform","__","sprintf","ComplementaryArea","store","interfaceStore","BlockInspector","blockEditorStore","cog","Button","useSelect","useDispatch","SIDEBAR_ACTIVE_BY_DEFAULT","select","web","native","BLOCK_INSPECTOR_IDENTIFIER","WIDGET_AREAS_IDENTIFIER","WidgetAreas","editWidgetsStore","ComplementaryAreaTab","identifier","label","isActive","enableComplementaryArea","name","Sidebar","currentArea","hasSelectedNonAreaBlock","isGeneralSidebarOpen","selectedWidgetAreaBlock","getSelectedBlock","getBlock","getBlockParentsByBlockName","getActiveComplementaryArea","selectedBlock","activeArea","currentSelection","widgetAreaBlock","clientId","attributes","id"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,iBADD,EAECC,KAAK,IAAIC,cAFV,QAGO,sBAHP;AAIA,SACCC,cADD,EAECF,KAAK,IAAIG,gBAFV,QAGO,yBAHP;AAKA,SAASC,GAAT,QAAoB,kBAApB;AACA,SAASC,MAAT,QAAuB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\n/**\n * WordPress dependencies\n */\nimport { useEffect, Platform } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\nimport { cog } from '@wordpress/icons';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';\n\n// Widget areas were one called block areas, so use 'edit-widgets/block-areas'\n// for backwards compatibility.\nconst WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreas from './widget-areas';\nimport { store as editWidgetsStore } from '../../store';\n\nfunction ComplementaryAreaTab( { identifier, label, isActive } ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\treturn (\n\t\t<Button\n\t\t\tonClick={ () =>\n\t\t\t\tenableComplementaryArea( editWidgetsStore.name, identifier )\n\t\t\t}\n\t\t\tclassName={ classnames( 'edit-widgets-sidebar__panel-tab', {\n\t\t\t\t'is-active': isActive,\n\t\t\t} ) }\n\t\t\taria-label={\n\t\t\t\tisActive\n\t\t\t\t\t? // translators: %s: sidebar label e.g: \"Widget Areas\".\n\t\t\t\t\t sprintf( __( '%s (selected)' ), label )\n\t\t\t\t\t: label\n\t\t\t}\n\t\t\tdata-label={ label }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n\nexport default function Sidebar() {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst {\n\t\tcurrentArea,\n\t\thasSelectedNonAreaBlock,\n\t\tisGeneralSidebarOpen,\n\t\tselectedWidgetAreaBlock,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSelectedBlock, getBlock, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\tconst selectedBlock = getSelectedBlock();\n\n\t\tconst activeArea = getActiveComplementaryArea( editWidgetsStore.name );\n\n\t\tlet currentSelection = activeArea;\n\t\tif ( ! currentSelection ) {\n\t\t\tif ( selectedBlock ) {\n\t\t\t\tcurrentSelection = BLOCK_INSPECTOR_IDENTIFIER;\n\t\t\t} else {\n\t\t\t\tcurrentSelection = WIDGET_AREAS_IDENTIFIER;\n\t\t\t}\n\t\t}\n\n\t\tlet widgetAreaBlock;\n\t\tif ( selectedBlock ) {\n\t\t\tif ( selectedBlock.name === 'core/widget-area' ) {\n\t\t\t\twidgetAreaBlock = selectedBlock;\n\t\t\t} else {\n\t\t\t\twidgetAreaBlock = getBlock(\n\t\t\t\t\tgetBlockParentsByBlockName(\n\t\t\t\t\t\tselectedBlock.clientId,\n\t\t\t\t\t\t'core/widget-area'\n\t\t\t\t\t)[ 0 ]\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcurrentArea: currentSelection,\n\t\t\thasSelectedNonAreaBlock: !! (\n\t\t\t\tselectedBlock && selectedBlock.name !== 'core/widget-area'\n\t\t\t),\n\t\t\tisGeneralSidebarOpen: !! activeArea,\n\t\t\tselectedWidgetAreaBlock: widgetAreaBlock,\n\t\t};\n\t}, [] );\n\n\t// currentArea, and isGeneralSidebarOpen are intentionally left out from the dependencies,\n\t// because we want to run the effect when a block is selected/unselected and not when the sidebar state changes.\n\tuseEffect( () => {\n\t\tif (\n\t\t\thasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === WIDGET_AREAS_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tBLOCK_INSPECTOR_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\t! hasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tWIDGET_AREAS_IDENTIFIER\n\t\t\t);\n\t\t}\n\t}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<ul>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<ComplementaryAreaTab\n\t\t\t\t\t\t\tidentifier={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tselectedWidgetAreaBlock\n\t\t\t\t\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t\t\t\t\t: __( 'Widget Areas' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisActive={ currentArea === WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<ComplementaryAreaTab\n\t\t\t\t\t\t\tidentifier={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\t\t\tlabel={ __( 'Block' ) }\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t}\n\t\t\theaderClassName=\"edit-widgets-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\tscope=\"core/edit-widgets\"\n\t\t\tidentifier={ currentArea }\n\t\t\ticon={ cog }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t{ currentArea === WIDGET_AREAS_IDENTIFIER && (\n\t\t\t\t<WidgetAreas\n\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ currentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\t\t( hasSelectedNonAreaBlock ? (\n\t\t\t\t\t<BlockInspector />\n\t\t\t\t) : (\n\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t</span>\n\t\t\t\t) ) }\n\t\t</ComplementaryArea>\n\t);\n}\n"]}
@@ -97,7 +97,7 @@
97
97
  --wp-block-synced-color: #7a00df;
98
98
  --wp-block-synced-color--rgb: 122, 0, 223;
99
99
  }
100
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
100
+ @media (min-resolution: 192dpi) {
101
101
  :root {
102
102
  --wp-admin-border-width-focus: 1.5px;
103
103
  }
@@ -633,6 +633,7 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
633
633
  height: 60px;
634
634
  padding: 0 16px;
635
635
  overflow: auto;
636
+ background: #fff;
636
637
  }
637
638
  @media (min-width: 600px) {
638
639
  .edit-widgets-header {
@@ -941,6 +942,12 @@ body.is-fullscreen-mode .edit-widgets-notices__snackbar {
941
942
  }
942
943
  }
943
944
 
945
+ @media (min-width: 782px) {
946
+ .blocks-widgets-container .interface-interface-skeleton__header:not(:focus-within) {
947
+ z-index: 19;
948
+ }
949
+ }
950
+
944
951
  .edit-widgets-welcome-guide {
945
952
  width: 312px;
946
953
  }
@@ -951,8 +958,7 @@ body.is-fullscreen-mode .edit-widgets-notices__snackbar {
951
958
  .edit-widgets-welcome-guide__image > img {
952
959
  display: block;
953
960
  max-width: 100%;
954
- -o-object-fit: cover;
955
- object-fit: cover;
961
+ object-fit: cover;
956
962
  }
957
963
  .edit-widgets-welcome-guide__heading {
958
964
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
@@ -1117,7 +1123,7 @@ body.admin-color-light {
1117
1123
  --wp-admin-theme-color-darker-20--rgb: 0, 97, 135;
1118
1124
  --wp-admin-border-width-focus: 2px;
1119
1125
  }
1120
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
1126
+ @media (min-resolution: 192dpi) {
1121
1127
  body.admin-color-light {
1122
1128
  --wp-admin-border-width-focus: 1.5px;
1123
1129
  }
@@ -1132,7 +1138,7 @@ body.admin-color-modern {
1132
1138
  --wp-admin-theme-color-darker-20--rgb: 24, 58, 214;
1133
1139
  --wp-admin-border-width-focus: 2px;
1134
1140
  }
1135
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
1141
+ @media (min-resolution: 192dpi) {
1136
1142
  body.admin-color-modern {
1137
1143
  --wp-admin-border-width-focus: 1.5px;
1138
1144
  }
@@ -1147,7 +1153,7 @@ body.admin-color-blue {
1147
1153
  --wp-admin-theme-color-darker-20--rgb: 6, 64, 84;
1148
1154
  --wp-admin-border-width-focus: 2px;
1149
1155
  }
1150
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
1156
+ @media (min-resolution: 192dpi) {
1151
1157
  body.admin-color-blue {
1152
1158
  --wp-admin-border-width-focus: 1.5px;
1153
1159
  }
@@ -1162,7 +1168,7 @@ body.admin-color-coffee {
1162
1168
  --wp-admin-theme-color-darker-20--rgb: 43, 39, 36;
1163
1169
  --wp-admin-border-width-focus: 2px;
1164
1170
  }
1165
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
1171
+ @media (min-resolution: 192dpi) {
1166
1172
  body.admin-color-coffee {
1167
1173
  --wp-admin-border-width-focus: 1.5px;
1168
1174
  }
@@ -1177,7 +1183,7 @@ body.admin-color-ectoplasm {
1177
1183
  --wp-admin-theme-color-darker-20--rgb: 58, 44, 77;
1178
1184
  --wp-admin-border-width-focus: 2px;
1179
1185
  }
1180
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
1186
+ @media (min-resolution: 192dpi) {
1181
1187
  body.admin-color-ectoplasm {
1182
1188
  --wp-admin-border-width-focus: 1.5px;
1183
1189
  }
@@ -1192,7 +1198,7 @@ body.admin-color-midnight {
1192
1198
  --wp-admin-theme-color-darker-20--rgb: 208, 44, 33;
1193
1199
  --wp-admin-border-width-focus: 2px;
1194
1200
  }
1195
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
1201
+ @media (min-resolution: 192dpi) {
1196
1202
  body.admin-color-midnight {
1197
1203
  --wp-admin-border-width-focus: 1.5px;
1198
1204
  }
@@ -1207,7 +1213,7 @@ body.admin-color-ocean {
1207
1213
  --wp-admin-theme-color-darker-20--rgb: 76, 96, 102;
1208
1214
  --wp-admin-border-width-focus: 2px;
1209
1215
  }
1210
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
1216
+ @media (min-resolution: 192dpi) {
1211
1217
  body.admin-color-ocean {
1212
1218
  --wp-admin-border-width-focus: 1.5px;
1213
1219
  }
@@ -1222,7 +1228,7 @@ body.admin-color-sunrise {
1222
1228
  --wp-admin-theme-color-darker-20--rgb: 195, 105, 34;
1223
1229
  --wp-admin-border-width-focus: 2px;
1224
1230
  }
1225
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
1231
+ @media (min-resolution: 192dpi) {
1226
1232
  body.admin-color-sunrise {
1227
1233
  --wp-admin-border-width-focus: 1.5px;
1228
1234
  }
@@ -97,7 +97,7 @@
97
97
  --wp-block-synced-color: #7a00df;
98
98
  --wp-block-synced-color--rgb: 122, 0, 223;
99
99
  }
100
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
100
+ @media (min-resolution: 192dpi) {
101
101
  :root {
102
102
  --wp-admin-border-width-focus: 1.5px;
103
103
  }
@@ -633,6 +633,7 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
633
633
  height: 60px;
634
634
  padding: 0 16px;
635
635
  overflow: auto;
636
+ background: #fff;
636
637
  }
637
638
  @media (min-width: 600px) {
638
639
  .edit-widgets-header {
@@ -941,6 +942,12 @@ body.is-fullscreen-mode .edit-widgets-notices__snackbar {
941
942
  }
942
943
  }
943
944
 
945
+ @media (min-width: 782px) {
946
+ .blocks-widgets-container .interface-interface-skeleton__header:not(:focus-within) {
947
+ z-index: 19;
948
+ }
949
+ }
950
+
944
951
  .edit-widgets-welcome-guide {
945
952
  width: 312px;
946
953
  }
@@ -951,8 +958,7 @@ body.is-fullscreen-mode .edit-widgets-notices__snackbar {
951
958
  .edit-widgets-welcome-guide__image > img {
952
959
  display: block;
953
960
  max-width: 100%;
954
- -o-object-fit: cover;
955
- object-fit: cover;
961
+ object-fit: cover;
956
962
  }
957
963
  .edit-widgets-welcome-guide__heading {
958
964
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
@@ -1117,7 +1123,7 @@ body.admin-color-light {
1117
1123
  --wp-admin-theme-color-darker-20--rgb: 0, 97, 135;
1118
1124
  --wp-admin-border-width-focus: 2px;
1119
1125
  }
1120
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
1126
+ @media (min-resolution: 192dpi) {
1121
1127
  body.admin-color-light {
1122
1128
  --wp-admin-border-width-focus: 1.5px;
1123
1129
  }
@@ -1132,7 +1138,7 @@ body.admin-color-modern {
1132
1138
  --wp-admin-theme-color-darker-20--rgb: 24, 58, 214;
1133
1139
  --wp-admin-border-width-focus: 2px;
1134
1140
  }
1135
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
1141
+ @media (min-resolution: 192dpi) {
1136
1142
  body.admin-color-modern {
1137
1143
  --wp-admin-border-width-focus: 1.5px;
1138
1144
  }
@@ -1147,7 +1153,7 @@ body.admin-color-blue {
1147
1153
  --wp-admin-theme-color-darker-20--rgb: 6, 64, 84;
1148
1154
  --wp-admin-border-width-focus: 2px;
1149
1155
  }
1150
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
1156
+ @media (min-resolution: 192dpi) {
1151
1157
  body.admin-color-blue {
1152
1158
  --wp-admin-border-width-focus: 1.5px;
1153
1159
  }
@@ -1162,7 +1168,7 @@ body.admin-color-coffee {
1162
1168
  --wp-admin-theme-color-darker-20--rgb: 43, 39, 36;
1163
1169
  --wp-admin-border-width-focus: 2px;
1164
1170
  }
1165
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
1171
+ @media (min-resolution: 192dpi) {
1166
1172
  body.admin-color-coffee {
1167
1173
  --wp-admin-border-width-focus: 1.5px;
1168
1174
  }
@@ -1177,7 +1183,7 @@ body.admin-color-ectoplasm {
1177
1183
  --wp-admin-theme-color-darker-20--rgb: 58, 44, 77;
1178
1184
  --wp-admin-border-width-focus: 2px;
1179
1185
  }
1180
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
1186
+ @media (min-resolution: 192dpi) {
1181
1187
  body.admin-color-ectoplasm {
1182
1188
  --wp-admin-border-width-focus: 1.5px;
1183
1189
  }
@@ -1192,7 +1198,7 @@ body.admin-color-midnight {
1192
1198
  --wp-admin-theme-color-darker-20--rgb: 208, 44, 33;
1193
1199
  --wp-admin-border-width-focus: 2px;
1194
1200
  }
1195
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
1201
+ @media (min-resolution: 192dpi) {
1196
1202
  body.admin-color-midnight {
1197
1203
  --wp-admin-border-width-focus: 1.5px;
1198
1204
  }
@@ -1207,7 +1213,7 @@ body.admin-color-ocean {
1207
1213
  --wp-admin-theme-color-darker-20--rgb: 76, 96, 102;
1208
1214
  --wp-admin-border-width-focus: 2px;
1209
1215
  }
1210
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
1216
+ @media (min-resolution: 192dpi) {
1211
1217
  body.admin-color-ocean {
1212
1218
  --wp-admin-border-width-focus: 1.5px;
1213
1219
  }
@@ -1222,7 +1228,7 @@ body.admin-color-sunrise {
1222
1228
  --wp-admin-theme-color-darker-20--rgb: 195, 105, 34;
1223
1229
  --wp-admin-border-width-focus: 2px;
1224
1230
  }
1225
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
1231
+ @media (min-resolution: 192dpi) {
1226
1232
  body.admin-color-sunrise {
1227
1233
  --wp-admin-border-width-focus: 1.5px;
1228
1234
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-widgets",
3
- "version": "5.9.0",
3
+ "version": "5.11.0",
4
4
  "description": "Widgets Page module for WordPress..",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,31 +27,31 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/api-fetch": "^6.29.0",
31
- "@wordpress/block-editor": "^12.0.0",
32
- "@wordpress/block-library": "^8.9.0",
33
- "@wordpress/blocks": "^12.9.0",
34
- "@wordpress/components": "^23.9.0",
35
- "@wordpress/compose": "^6.9.0",
36
- "@wordpress/core-data": "^6.9.0",
37
- "@wordpress/data": "^9.2.0",
38
- "@wordpress/deprecated": "^3.32.0",
39
- "@wordpress/dom": "^3.32.0",
40
- "@wordpress/element": "^5.9.0",
41
- "@wordpress/hooks": "^3.32.0",
42
- "@wordpress/i18n": "^4.32.0",
43
- "@wordpress/icons": "^9.23.0",
44
- "@wordpress/interface": "^5.9.0",
45
- "@wordpress/keyboard-shortcuts": "^4.9.0",
46
- "@wordpress/keycodes": "^3.32.0",
47
- "@wordpress/media-utils": "^4.23.0",
48
- "@wordpress/notices": "^4.0.0",
49
- "@wordpress/plugins": "^6.0.0",
50
- "@wordpress/preferences": "^3.9.0",
51
- "@wordpress/private-apis": "^0.14.0",
52
- "@wordpress/reusable-blocks": "^4.9.0",
53
- "@wordpress/url": "^3.33.0",
54
- "@wordpress/widgets": "^3.9.0",
30
+ "@wordpress/api-fetch": "^6.31.0",
31
+ "@wordpress/block-editor": "^12.2.0",
32
+ "@wordpress/block-library": "^8.11.0",
33
+ "@wordpress/blocks": "^12.11.0",
34
+ "@wordpress/components": "^25.0.0",
35
+ "@wordpress/compose": "^6.11.0",
36
+ "@wordpress/core-data": "^6.11.0",
37
+ "@wordpress/data": "^9.4.0",
38
+ "@wordpress/deprecated": "^3.34.0",
39
+ "@wordpress/dom": "^3.34.0",
40
+ "@wordpress/element": "^5.11.0",
41
+ "@wordpress/hooks": "^3.34.0",
42
+ "@wordpress/i18n": "^4.34.0",
43
+ "@wordpress/icons": "^9.25.0",
44
+ "@wordpress/interface": "^5.11.0",
45
+ "@wordpress/keyboard-shortcuts": "^4.11.0",
46
+ "@wordpress/keycodes": "^3.34.0",
47
+ "@wordpress/media-utils": "^4.25.0",
48
+ "@wordpress/notices": "^4.2.0",
49
+ "@wordpress/plugins": "^6.2.0",
50
+ "@wordpress/preferences": "^3.11.0",
51
+ "@wordpress/private-apis": "^0.16.0",
52
+ "@wordpress/reusable-blocks": "^4.11.0",
53
+ "@wordpress/url": "^3.35.0",
54
+ "@wordpress/widgets": "^3.11.0",
55
55
  "classnames": "^2.3.1"
56
56
  },
57
57
  "peerDependencies": {
@@ -61,5 +61,5 @@
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "6df0c62d43b8901414ccd22ffbe56eaa99d012a6"
64
+ "gitHead": "c7c79cb11b677adcbf06cf5f8cfb6c5ec1699f19"
65
65
  }
@@ -7,6 +7,7 @@ import { Button, ToolbarItem, VisuallyHidden } from '@wordpress/components';
7
7
  import {
8
8
  NavigableToolbar,
9
9
  store as blockEditorStore,
10
+ privateApis as blockEditorPrivateApis,
10
11
  } from '@wordpress/block-editor';
11
12
  import { PinnedItems } from '@wordpress/interface';
12
13
  import { listView, plus } from '@wordpress/icons';
@@ -22,6 +23,9 @@ import RedoButton from './undo-redo/redo';
22
23
  import MoreMenu from '../more-menu';
23
24
  import useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';
24
25
  import { store as editWidgetsStore } from '../../store';
26
+ import { unlock } from '../../private-apis';
27
+
28
+ const { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );
25
29
 
26
30
  function Header() {
27
31
  const isMediumViewport = useViewportMatch( 'medium' );
@@ -70,6 +74,18 @@ function Header() {
70
74
  [ setIsListViewOpened, isListViewOpen ]
71
75
  );
72
76
 
77
+ const {
78
+ shouldShowContextualToolbar,
79
+ canFocusHiddenToolbar,
80
+ fixedToolbarCanBeFocused,
81
+ } = useShouldContextualToolbarShow();
82
+ // If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.
83
+ // There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.
84
+ const blockToolbarCanBeFocused =
85
+ shouldShowContextualToolbar ||
86
+ canFocusHiddenToolbar ||
87
+ fixedToolbarCanBeFocused;
88
+
73
89
  return (
74
90
  <>
75
91
  <div className="edit-widgets-header">
@@ -90,6 +106,9 @@ function Header() {
90
106
  <NavigableToolbar
91
107
  className="edit-widgets-header-toolbar"
92
108
  aria-label={ __( 'Document tools' ) }
109
+ shouldUseKeyboardFocusShortcut={
110
+ ! blockToolbarCanBeFocused
111
+ }
93
112
  >
94
113
  <ToolbarItem
95
114
  ref={ inserterButton }
@@ -5,6 +5,7 @@
5
5
  height: $header-height;
6
6
  padding: 0 $grid-unit-20;
7
7
  overflow: auto;
8
+ background: #fff;
8
9
 
9
10
  @include break-small {
10
11
  overflow: visible;
@@ -22,3 +22,15 @@
22
22
  height: 100%;
23
23
  }
24
24
  }
25
+
26
+ .blocks-widgets-container {
27
+ // making the header be lower than the content
28
+ // so the fixed toolbar can be positioned on top of it
29
+ // but only on desktop
30
+ @include break-medium() {
31
+ .interface-interface-skeleton__header:not(:focus-within) {
32
+ z-index: 19;
33
+ }
34
+ }
35
+
36
+ }
@@ -6,7 +6,6 @@ import { Button } from '@wordpress/components';
6
6
  import {
7
7
  useFocusOnMount,
8
8
  useFocusReturn,
9
- useInstanceId,
10
9
  useMergeRefs,
11
10
  } from '@wordpress/compose';
12
11
  import { useDispatch } from '@wordpress/data';
@@ -32,13 +31,9 @@ export default function ListViewSidebar() {
32
31
  }
33
32
  }
34
33
 
35
- const instanceId = useInstanceId( ListViewSidebar );
36
- const labelId = `edit-widgets-editor__list-view-panel-label-${ instanceId }`;
37
-
38
34
  return (
39
35
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
40
36
  <div
41
- aria-labelledby={ labelId }
42
37
  className="edit-widgets-editor__list-view-panel"
43
38
  onKeyDown={ closeOnEscape }
44
39
  >
@@ -46,10 +41,10 @@ export default function ListViewSidebar() {
46
41
  className="edit-widgets-editor__list-view-panel-header"
47
42
  ref={ headerFocusReturnRef }
48
43
  >
49
- <strong id={ labelId }>{ __( 'List View' ) }</strong>
44
+ <strong>{ __( 'List View' ) }</strong>
50
45
  <Button
51
46
  icon={ closeSmall }
52
- label={ __( 'Close List View Sidebar' ) }
47
+ label={ __( 'Close' ) }
53
48
  onClick={ () => setIsListViewOpened( false ) }
54
49
  />
55
50
  </div>
@@ -165,7 +165,7 @@ export default function Sidebar() {
165
165
  headerClassName="edit-widgets-sidebar__panel-tabs"
166
166
  /* translators: button label text should, if possible, be under 16 characters. */
167
167
  title={ __( 'Settings' ) }
168
- closeLabel={ __( 'Close settings' ) }
168
+ closeLabel={ __( 'Close Settings' ) }
169
169
  scope="core/edit-widgets"
170
170
  identifier={ currentArea }
171
171
  icon={ cog }