@wordpress/edit-widgets 5.35.0 → 6.0.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 +7 -0
- package/build/blocks/widget-area/edit/index.js +33 -30
- package/build/blocks/widget-area/edit/index.js.map +1 -1
- package/build/blocks/widget-area/edit/inner-blocks.js +6 -5
- package/build/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build/components/error-boundary/index.js +14 -12
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/header/document-tools/index.js +36 -33
- package/build/components/header/document-tools/index.js.map +1 -1
- package/build/components/header/index.js +32 -22
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/undo-redo/redo.js +2 -2
- package/build/components/header/undo-redo/redo.js.map +1 -1
- package/build/components/header/undo-redo/undo.js +2 -2
- package/build/components/header/undo-redo/undo.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +2 -2
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +53 -48
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +30 -26
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/layout/index.js +11 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/interface.js +16 -13
- package/build/components/layout/interface.js.map +1 -1
- package/build/components/more-menu/index.js +81 -70
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/more-menu/tools-more-menu-group.js +5 -4
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build/components/notices/index.js +15 -13
- package/build/components/notices/index.js.map +1 -1
- package/build/components/save-button/index.js +5 -4
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/secondary-sidebar/index.js +3 -3
- package/build/components/secondary-sidebar/index.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +21 -18
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +21 -15
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +49 -37
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/widget-areas.js +29 -22
- package/build/components/sidebar/widget-areas.js.map +1 -1
- package/build/components/welcome-guide/index.js +80 -53
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-content/index.js +18 -11
- package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-provider/index.js +14 -11
- package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build/filters/move-to-widget-area.js +14 -10
- package/build/filters/move-to-widget-area.js.map +1 -1
- package/build/index.js +3 -3
- package/build/index.js.map +1 -1
- package/build-module/blocks/widget-area/edit/index.js +32 -28
- package/build-module/blocks/widget-area/edit/index.js.map +1 -1
- package/build-module/blocks/widget-area/edit/inner-blocks.js +6 -5
- package/build-module/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build-module/components/error-boundary/index.js +14 -12
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/header/document-tools/index.js +38 -33
- package/build-module/components/header/document-tools/index.js.map +1 -1
- package/build-module/components/header/index.js +34 -22
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/undo-redo/redo.js +2 -2
- package/build-module/components/header/undo-redo/redo.js.map +1 -1
- package/build-module/components/header/undo-redo/undo.js +2 -2
- package/build-module/components/header/undo-redo/undo.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +2 -2
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +54 -48
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +32 -26
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/layout/index.js +12 -8
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/interface.js +17 -13
- package/build-module/components/layout/interface.js.map +1 -1
- package/build-module/components/more-menu/index.js +83 -70
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/more-menu/tools-more-menu-group.js +5 -4
- package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build-module/components/notices/index.js +17 -13
- package/build-module/components/notices/index.js.map +1 -1
- package/build-module/components/save-button/index.js +5 -4
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/index.js +3 -3
- package/build-module/components/secondary-sidebar/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +22 -18
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +22 -15
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +50 -37
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/widget-areas.js +30 -22
- package/build-module/components/sidebar/widget-areas.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +82 -53
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-content/index.js +19 -11
- package/build-module/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-provider/index.js +15 -11
- package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build-module/filters/move-to-widget-area.js +16 -10
- package/build-module/filters/move-to-widget-area.js.map +1 -1
- package/build-module/index.js +3 -3
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +9 -4
- package/build-style/style.css +9 -4
- package/package.json +30 -29
- package/src/components/layout/style.scss +1 -1
- package/src/index.js +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
@@ -15,6 +14,8 @@ import { __ } from '@wordpress/i18n';
|
|
|
15
14
|
*/
|
|
16
15
|
import useWidgetLibraryInsertionPoint from '../../hooks/use-widget-library-insertion-point';
|
|
17
16
|
import { store as editWidgetsStore } from '../../store';
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
19
|
export default function InserterSidebar() {
|
|
19
20
|
const isMobileViewport = useViewportMatch('medium', '<');
|
|
20
21
|
const {
|
|
@@ -33,24 +34,27 @@ export default function InserterSidebar() {
|
|
|
33
34
|
focusOnMount: true
|
|
34
35
|
});
|
|
35
36
|
const libraryRef = useRef();
|
|
36
|
-
return
|
|
37
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
37
38
|
ref: inserterDialogRef,
|
|
38
39
|
...inserterDialogProps,
|
|
39
|
-
className: "edit-widgets-layout__inserter-panel"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
40
|
+
className: "edit-widgets-layout__inserter-panel",
|
|
41
|
+
children: [/*#__PURE__*/_jsx(TagName, {
|
|
42
|
+
className: "edit-widgets-layout__inserter-panel-header",
|
|
43
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
44
|
+
icon: close,
|
|
45
|
+
onClick: closeInserter,
|
|
46
|
+
label: __('Close block inserter')
|
|
47
|
+
})
|
|
48
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
49
|
+
className: "edit-widgets-layout__inserter-panel-content",
|
|
50
|
+
children: /*#__PURE__*/_jsx(Library, {
|
|
51
|
+
showInserterHelpPanel: true,
|
|
52
|
+
shouldFocusBlock: isMobileViewport,
|
|
53
|
+
rootClientId: rootClientId,
|
|
54
|
+
__experimentalInsertionIndex: insertionIndex,
|
|
55
|
+
ref: libraryRef
|
|
56
|
+
})
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
55
59
|
}
|
|
56
60
|
//# sourceMappingURL=inserter-sidebar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Button","VisuallyHidden","close","__experimentalLibrary","Library","useViewportMatch","__experimentalUseDialog","useDialog","useCallback","useRef","useDispatch","__","useWidgetLibraryInsertionPoint","store","editWidgetsStore","InserterSidebar","isMobileViewport","rootClientId","insertionIndex","setIsInserterOpened","closeInserter","TagName","inserterDialogRef","inserterDialogProps","onClose","focusOnMount","libraryRef","
|
|
1
|
+
{"version":3,"names":["Button","VisuallyHidden","close","__experimentalLibrary","Library","useViewportMatch","__experimentalUseDialog","useDialog","useCallback","useRef","useDispatch","__","useWidgetLibraryInsertionPoint","store","editWidgetsStore","jsx","_jsx","jsxs","_jsxs","InserterSidebar","isMobileViewport","rootClientId","insertionIndex","setIsInserterOpened","closeInserter","TagName","inserterDialogRef","inserterDialogProps","onClose","focusOnMount","libraryRef","ref","className","children","icon","onClick","label","showInserterHelpPanel","shouldFocusBlock","__experimentalInsertionIndex"],"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/inserter-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { close } from '@wordpress/icons';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useWidgetLibraryInsertionPoint from '../../hooks/use-widget-library-insertion-point';\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { rootClientId, insertionIndex } = useWidgetLibraryInsertionPoint();\n\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst closeInserter = useCallback( () => {\n\t\treturn setIsInserterOpened( false );\n\t}, [ setIsInserterOpened ] );\n\n\tconst TagName = ! isMobileViewport ? VisuallyHidden : 'div';\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: closeInserter,\n\t\tfocusOnMount: true,\n\t} );\n\n\tconst libraryRef = useRef();\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"edit-widgets-layout__inserter-panel\"\n\t\t>\n\t\t\t<TagName className=\"edit-widgets-layout__inserter-panel-header\">\n\t\t\t\t<Button\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tonClick={ closeInserter }\n\t\t\t\t\tlabel={ __( 'Close block inserter' ) }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t\t<div className=\"edit-widgets-layout__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={ insertionIndex }\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,cAAc,QAAQ,uBAAuB;AAC9D,SAASC,KAAK,QAAQ,kBAAkB;AACxC,SAASC,qBAAqB,IAAIC,OAAO,QAAQ,yBAAyB;AAC1E,SACCC,gBAAgB,EAChBC,uBAAuB,IAAIC,SAAS,QAC9B,oBAAoB;AAC3B,SAASC,WAAW,EAAEC,MAAM,QAAQ,oBAAoB;AACxD,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;;AAE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,gBAAgB,EAAGlB,gBAAkB;QACrCC,YAAY,EAAGA,YAAc;QAC7BkB,4BAA4B,EAAGjB,cAAgB;QAC/CS,GAAG,EAAGD;MAAY,CAClB;IAAC,CACE,CAAC;EAAA,CACF,CAAC;AAER","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
@@ -16,6 +15,8 @@ import { ESCAPE } from '@wordpress/keycodes';
|
|
|
16
15
|
*/
|
|
17
16
|
import { store as editWidgetsStore } from '../../store';
|
|
18
17
|
import { unlock } from '../../lock-unlock';
|
|
18
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
20
|
export default function ListViewSidebar() {
|
|
20
21
|
const {
|
|
21
22
|
setIsListViewOpened
|
|
@@ -41,22 +42,28 @@ export default function ListViewSidebar() {
|
|
|
41
42
|
}
|
|
42
43
|
}, [closeListView]);
|
|
43
44
|
return (
|
|
45
|
+
/*#__PURE__*/
|
|
44
46
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
45
|
-
|
|
47
|
+
_jsxs("div", {
|
|
46
48
|
className: "edit-widgets-editor__list-view-panel",
|
|
47
|
-
onKeyDown: closeOnEscape
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
49
|
+
onKeyDown: closeOnEscape,
|
|
50
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
51
|
+
className: "edit-widgets-editor__list-view-panel-header",
|
|
52
|
+
children: [/*#__PURE__*/_jsx("strong", {
|
|
53
|
+
children: __('List View')
|
|
54
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
55
|
+
icon: closeSmall,
|
|
56
|
+
label: __('Close'),
|
|
57
|
+
onClick: closeListView
|
|
58
|
+
})]
|
|
59
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
60
|
+
className: "edit-widgets-editor__list-view-panel-content",
|
|
61
|
+
ref: useMergeRefs([focusOnMountRef, setDropZoneElement]),
|
|
62
|
+
children: /*#__PURE__*/_jsx(ListView, {
|
|
63
|
+
dropZoneElement: dropZoneElement
|
|
64
|
+
})
|
|
65
|
+
})]
|
|
66
|
+
})
|
|
60
67
|
);
|
|
61
68
|
}
|
|
62
69
|
//# sourceMappingURL=list-view-sidebar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalListView","ListView","Button","useFocusOnMount","useMergeRefs","useDispatch","useSelect","useCallback","useState","__","closeSmall","ESCAPE","store","editWidgetsStore","unlock","ListViewSidebar","setIsListViewOpened","getListViewToggleRef","dropZoneElement","setDropZoneElement","focusOnMountRef","closeListView","current","focus","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","
|
|
1
|
+
{"version":3,"names":["__experimentalListView","ListView","Button","useFocusOnMount","useMergeRefs","useDispatch","useSelect","useCallback","useState","__","closeSmall","ESCAPE","store","editWidgetsStore","unlock","jsx","_jsx","jsxs","_jsxs","ListViewSidebar","setIsListViewOpened","getListViewToggleRef","dropZoneElement","setDropZoneElement","focusOnMountRef","closeListView","current","focus","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","className","onKeyDown","children","icon","label","onClick","ref"],"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/list-view-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalListView as ListView } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { useFocusOnMount, useMergeRefs } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useCallback, useState } from '@wordpress/element';\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';\nimport { unlock } from '../../lock-unlock';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editWidgetsStore );\n\tconst { getListViewToggleRef } = unlock( useSelect( editWidgetsStore ) );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the dropZoneElement updates.\n\tconst [ dropZoneElement, setDropZoneElement ] = useState( null );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\n\t// When closing the list view, focus should return to the toggle button.\n\tconst closeListView = useCallback( () => {\n\t\tsetIsListViewOpened( false );\n\t\tgetListViewToggleRef().current?.focus();\n\t}, [ getListViewToggleRef, setIsListViewOpened ] );\n\n\tconst closeOnEscape = useCallback(\n\t\t( event ) => {\n\t\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcloseListView();\n\t\t\t}\n\t\t},\n\t\t[ closeListView ]\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 className=\"edit-widgets-editor__list-view-panel-header\">\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={ closeListView }\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( [ focusOnMountRef, setDropZoneElement ] ) }\n\t\t\t>\n\t\t\t\t<ListView dropZoneElement={ dropZoneElement } />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,sBAAsB,IAAIC,QAAQ,QAAQ,yBAAyB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,aAAa,CAChB,CAAC;EAED;IAAA;IACC;IACAP,KAAA;MACCe,SAAS,EAAC,sCAAsC;MAChDC,SAAS,EAAGN,aAAe;MAAAO,QAAA,gBAE3BjB,KAAA;QAAKe,SAAS,EAAC,6CAA6C;QAAAE,QAAA,gBAC3DnB,IAAA;UAAAmB,QAAA,EAAU1B,EAAE,CAAE,WAAY;QAAC,CAAU,CAAC,eACtCO,IAAA,CAACd,MAAM;UACNkC,IAAI,EAAG1B,UAAY;UACnB2B,KAAK,EAAG5B,EAAE,CAAE,OAAQ,CAAG;UACvB6B,OAAO,EAAGb;QAAe,CACzB,CAAC;MAAA,CACE,CAAC,eACNT,IAAA;QACCiB,SAAS,EAAC,8CAA8C;QACxDM,GAAG,EAAGnC,YAAY,CAAE,CAAEoB,eAAe,EAAED,kBAAkB,CAAG,CAAG;QAAAY,QAAA,eAE/DnB,IAAA,CAACf,QAAQ;UAACqB,eAAe,EAAGA;QAAiB,CAAE;MAAC,CAC5C,CAAC;IAAA,CACF;EAAC;AAER","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
@@ -25,17 +24,23 @@ const WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';
|
|
|
25
24
|
import WidgetAreas from './widget-areas';
|
|
26
25
|
import { store as editWidgetsStore } from '../../store';
|
|
27
26
|
import { unlock } from '../../lock-unlock';
|
|
27
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
29
|
const {
|
|
29
30
|
Tabs
|
|
30
31
|
} = unlock(componentsPrivateApis);
|
|
31
32
|
function SidebarHeader({
|
|
32
33
|
selectedWidgetAreaBlock
|
|
33
34
|
}) {
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
return /*#__PURE__*/_jsxs(Tabs.TabList, {
|
|
36
|
+
children: [/*#__PURE__*/_jsx(Tabs.Tab, {
|
|
37
|
+
tabId: WIDGET_AREAS_IDENTIFIER,
|
|
38
|
+
children: selectedWidgetAreaBlock ? selectedWidgetAreaBlock.attributes.name : __('Widget Areas')
|
|
39
|
+
}), /*#__PURE__*/_jsx(Tabs.Tab, {
|
|
40
|
+
tabId: BLOCK_INSPECTOR_IDENTIFIER,
|
|
41
|
+
children: __('Block')
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
39
44
|
}
|
|
40
45
|
function SidebarContent({
|
|
41
46
|
hasSelectedNonAreaBlock,
|
|
@@ -59,13 +64,14 @@ function SidebarContent({
|
|
|
59
64
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
65
|
}, [hasSelectedNonAreaBlock, enableComplementaryArea]);
|
|
61
66
|
const tabsContextValue = useContext(Tabs.Context);
|
|
62
|
-
return
|
|
67
|
+
return /*#__PURE__*/_jsx(ComplementaryArea, {
|
|
63
68
|
className: "edit-widgets-sidebar",
|
|
64
|
-
header:
|
|
65
|
-
value: tabsContextValue
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
header: /*#__PURE__*/_jsx(Tabs.Context.Provider, {
|
|
70
|
+
value: tabsContextValue,
|
|
71
|
+
children: /*#__PURE__*/_jsx(SidebarHeader, {
|
|
72
|
+
selectedWidgetAreaBlock: selectedWidgetAreaBlock
|
|
73
|
+
})
|
|
74
|
+
}),
|
|
69
75
|
headerClassName: "edit-widgets-sidebar__panel-tabs"
|
|
70
76
|
/* translators: button label text should, if possible, be under 16 characters. */,
|
|
71
77
|
title: __('Settings'),
|
|
@@ -73,23 +79,29 @@ function SidebarContent({
|
|
|
73
79
|
scope: "core/edit-widgets",
|
|
74
80
|
identifier: currentArea,
|
|
75
81
|
icon: isRTL() ? drawerLeft : drawerRight,
|
|
76
|
-
isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT,
|
|
83
|
+
children: /*#__PURE__*/_jsxs(Tabs.Context.Provider, {
|
|
84
|
+
value: tabsContextValue,
|
|
85
|
+
children: [/*#__PURE__*/_jsx(Tabs.TabPanel, {
|
|
86
|
+
tabId: WIDGET_AREAS_IDENTIFIER,
|
|
87
|
+
focusable: false,
|
|
88
|
+
children: /*#__PURE__*/_jsx(WidgetAreas, {
|
|
89
|
+
selectedWidgetAreaId: selectedWidgetAreaBlock?.attributes.id
|
|
90
|
+
})
|
|
91
|
+
}), /*#__PURE__*/_jsx(Tabs.TabPanel, {
|
|
92
|
+
tabId: BLOCK_INSPECTOR_IDENTIFIER,
|
|
93
|
+
focusable: false,
|
|
94
|
+
children: hasSelectedNonAreaBlock ? /*#__PURE__*/_jsx(BlockInspector, {}) :
|
|
95
|
+
/*#__PURE__*/
|
|
96
|
+
// Pretend that Widget Areas are part of the UI by not
|
|
97
|
+
// showing the Block Inspector when one is selected.
|
|
98
|
+
_jsx("span", {
|
|
99
|
+
className: "block-editor-block-inspector__no-blocks",
|
|
100
|
+
children: __('No block selected.')
|
|
101
|
+
})
|
|
102
|
+
})]
|
|
103
|
+
})
|
|
104
|
+
});
|
|
93
105
|
}
|
|
94
106
|
export default function Sidebar() {
|
|
95
107
|
const {
|
|
@@ -144,7 +156,7 @@ export default function Sidebar() {
|
|
|
144
156
|
enableComplementaryArea(editWidgetsStore.name, newSelectedTabId);
|
|
145
157
|
}
|
|
146
158
|
}, [enableComplementaryArea]);
|
|
147
|
-
return
|
|
159
|
+
return /*#__PURE__*/_jsx(Tabs
|
|
148
160
|
// Due to how this component is controlled (via a value from the
|
|
149
161
|
// `interfaceStore`), when the sidebar closes the currently selected
|
|
150
162
|
// tab can't be found. This causes the component to continuously reset
|
|
@@ -153,12 +165,13 @@ export default function Sidebar() {
|
|
|
153
165
|
, {
|
|
154
166
|
selectedTabId: isGeneralSidebarOpen ? currentArea : null,
|
|
155
167
|
onSelect: onTabSelect,
|
|
156
|
-
selectOnMove: false
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
168
|
+
selectOnMove: false,
|
|
169
|
+
children: /*#__PURE__*/_jsx(SidebarContent, {
|
|
170
|
+
hasSelectedNonAreaBlock: hasSelectedNonAreaBlock,
|
|
171
|
+
currentArea: currentArea,
|
|
172
|
+
isGeneralSidebarOpen: isGeneralSidebarOpen,
|
|
173
|
+
selectedWidgetAreaBlock: selectedWidgetAreaBlock
|
|
174
|
+
})
|
|
175
|
+
});
|
|
163
176
|
}
|
|
164
177
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","Platform","useContext","useCallback","isRTL","__","ComplementaryArea","store","interfaceStore","BlockInspector","blockEditorStore","drawerLeft","drawerRight","privateApis","componentsPrivateApis","useSelect","useDispatch","SIDEBAR_ACTIVE_BY_DEFAULT","select","web","native","BLOCK_INSPECTOR_IDENTIFIER","WIDGET_AREAS_IDENTIFIER","WidgetAreas","editWidgetsStore","unlock","Tabs","SidebarHeader","selectedWidgetAreaBlock","createElement","TabList","Tab","tabId","attributes","name","SidebarContent","hasSelectedNonAreaBlock","currentArea","isGeneralSidebarOpen","enableComplementaryArea","tabsContextValue","Context","className","header","Provider","value","headerClassName","title","closeLabel","scope","identifier","icon","isActiveByDefault","TabPanel","focusable","selectedWidgetAreaId","id","Sidebar","getSelectedBlock","getBlock","getBlockParentsByBlockName","getActiveComplementaryArea","selectedBlock","activeArea","currentSelection","widgetAreaBlock","clientId","onTabSelect","newSelectedTabId","selectedTabId","onSelect","selectOnMove"],"sources":["@wordpress/edit-widgets/src/components/sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseEffect,\n\tPlatform,\n\tuseContext,\n\tuseCallback,\n} from '@wordpress/element';\nimport { isRTL, __ } 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 { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { privateApis as componentsPrivateApis } 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';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction SidebarHeader( { selectedWidgetAreaBlock } ) {\n\treturn (\n\t\t<Tabs.TabList>\n\t\t\t<Tabs.Tab tabId={ WIDGET_AREAS_IDENTIFIER }>\n\t\t\t\t{ selectedWidgetAreaBlock\n\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t: __( 'Widget Areas' ) }\n\t\t\t</Tabs.Tab>\n\t\t\t<Tabs.Tab tabId={ BLOCK_INSPECTOR_IDENTIFIER }>\n\t\t\t\t{ __( 'Block' ) }\n\t\t\t</Tabs.Tab>\n\t\t</Tabs.TabList>\n\t);\n}\n\nfunction SidebarContent( {\n\thasSelectedNonAreaBlock,\n\tcurrentArea,\n\tisGeneralSidebarOpen,\n\tselectedWidgetAreaBlock,\n} ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\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\t// We're intentionally leaving `currentArea` and `isGeneralSidebarOpen`\n\t\t// out of the dep array because we want this effect to run based on\n\t\t// block selection changes, not sidebar state changes.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader\n\t\t\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Context.Provider>\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={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t<WidgetAreas\n\t\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t{ hasSelectedNonAreaBlock ? (\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs.Context.Provider>\n\t\t</ComplementaryArea>\n\t);\n}\n\nexport default function Sidebar() {\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\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\t// `newSelectedTabId` could technically be falsey if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsey handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea(\n\t\t\t\t\teditWidgetsStore.name,\n\t\t\t\t\tnewSelectedTabId\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\t// Due to how this component is controlled (via a value from the\n\t\t\t// `interfaceStore`), when the sidebar closes the currently selected\n\t\t\t// tab can't be found. This causes the component to continuously reset\n\t\t\t// the selection to `null` in an infinite loop. Proactively setting\n\t\t\t// the selected tab to `null` avoids that.\n\t\t\tselectedTabId={ isGeneralSidebarOpen ? currentArea : null }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\thasSelectedNonAreaBlock={ hasSelectedNonAreaBlock }\n\t\t\t\tcurrentArea={ currentArea }\n\t\t\t\tisGeneralSidebarOpen={ isGeneralSidebarOpen }\n\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,SAAS,EACTC,QAAQ,EACRC,UAAU,EACVC,WAAW,QACL,oBAAoB;AAC3B,SAASC,KAAK,EAAEC,EAAE,QAAQ,iBAAiB;AAC3C,SACCC,iBAAiB,EACjBC,KAAK,IAAIC,cAAc,QACjB,sBAAsB;AAC7B,SACCC,cAAc,EACdF,KAAK,IAAIG,gBAAgB,QACnB,yBAAyB;AAEhC,SAASC,UAAU,EAAEC,WAAW,QAAQ,kBAAkB;AAC1D,SAASC,WAAW,IAAIC,qBAAqB,QAAQ,uBAAuB;AAC5E,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AAExD,MAAMC,yBAAyB,GAAGhB,QAAQ,CAACiB,MAAM,CAAE;EAClDC,GAAG,EAAE,IAAI;EACTC,MAAM,EAAE;AACT,CAAE,CAAC;AAEH,MAAMC,0BAA0B,GAAG,8BAA8B;;AAEjE;AACA;AACA,MAAMC,uBAAuB,GAAG,0BAA0B;;AAE1D;AACA;AACA;AACA,OAAOC,WAAW,MAAM,gBAAgB;AACxC,SAAShB,KAAK,IAAIiB,gBAAgB,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAK,CAAC,GAAGD,MAAM,CAAEX,qBAAsB,CAAC;AAEhD,SAASa,aAAaA,CAAE;EAAEC;AAAwB,CAAC,EAAG;EACrD,OACCC,aAAA,CAACH,IAAI,CAACI,OAAO,QACZD,aAAA,CAACH,IAAI,CAACK,GAAG;IAACC,KAAK,EAAGV;EAAyB,GACxCM,uBAAuB,GACtBA,uBA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C,eAAe;IACnB,IAAKH,aAAa,EAAG;MACpB,IAAKA,aAAa,CAAC5B,IAAI,KAAK,kBAAkB,EAAG;QAChD+B,eAAe,GAAGH,aAAa;MAChC,CAAC,MAAM;QACNG,eAAe,GAAGN,QAAQ,CACzBC,0BAA0B,CACzBE,aAAa,CAACI,QAAQ,EACtB,kBACD,CAAC,CAAE,CAAC,CACL,CAAC;MACF;IACD;IAEA,OAAO;MACN7B,WAAW,EAAE2B,gBAAgB;MAC7B5B,uBAAuB,EAAE,CAAC,EACzB0B,aAAa,IAAIA,aAAa,CAAC5B,IAAI,KAAK,kBAAkB,CAC1D;MACDI,oBAAoB,EAAE,CAAC,CAAEyB,UAAU;MACnCnC,uBAAuB,EAAEqC;IAC1B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAM;IAAE1B;EAAwB,CAAC,GAAGvB,WAAW,CAAER,cAAe,CAAC;;EAEjE;EACA;EACA;EACA;EACA,MAAM2D,WAAW,GAAGhE,WAAW,CAC5BiE,gBAAgB,IAAM;IACvB,IAAK,CAAC,CAAEA,gBAAgB,EAAG;MAC1B7B,uBAAuB,CACtBf,gBAAgB,CAACU,IAAI,EACrBkC,gBACD,CAAC;IACF;EACD,CAAC,EACD,CAAE7B,uBAAuB,CAC1B,CAAC;EAED,OACCV,aAAA,CAACH;EACA;EACA;EACA;EACA;EACA;EAAA;IACA2C,aAAa,EAAG/B,oBAAoB,GAAGD,WAAW,GAAG,IAAM;IAC3DiC,QAAQ,EAAGH,WAAa;IACxBI,YAAY,EAAG;EAAO,GAEtB1C,aAAA,CAACM,cAAc;IACdC,uBAAuB,EAAGA,uBAAyB;IACnDC,WAAW,EAAGA,WAAa;IAC3BC,oBAAoB,EAAGA,oBAAsB;IAC7CV,uBAAuB,EAAGA;EAAyB,CACnD,CACI,CAAC;AAET","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useEffect","Platform","useContext","useCallback","isRTL","__","ComplementaryArea","store","interfaceStore","BlockInspector","blockEditorStore","drawerLeft","drawerRight","privateApis","componentsPrivateApis","useSelect","useDispatch","SIDEBAR_ACTIVE_BY_DEFAULT","select","web","native","BLOCK_INSPECTOR_IDENTIFIER","WIDGET_AREAS_IDENTIFIER","WidgetAreas","editWidgetsStore","unlock","jsx","_jsx","jsxs","_jsxs","Tabs","SidebarHeader","selectedWidgetAreaBlock","TabList","children","Tab","tabId","attributes","name","SidebarContent","hasSelectedNonAreaBlock","currentArea","isGeneralSidebarOpen","enableComplementaryArea","tabsContextValue","Context","className","header","Provider","value","headerClassName","title","closeLabel","scope","identifier","icon","isActiveByDefault","TabPanel","focusable","selectedWidgetAreaId","id","Sidebar","getSelectedBlock","getBlock","getBlockParentsByBlockName","getActiveComplementaryArea","selectedBlock","activeArea","currentSelection","widgetAreaBlock","clientId","onTabSelect","newSelectedTabId","selectedTabId","onSelect","selectOnMove"],"sources":["@wordpress/edit-widgets/src/components/sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseEffect,\n\tPlatform,\n\tuseContext,\n\tuseCallback,\n} from '@wordpress/element';\nimport { isRTL, __ } 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 { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { privateApis as componentsPrivateApis } 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';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction SidebarHeader( { selectedWidgetAreaBlock } ) {\n\treturn (\n\t\t<Tabs.TabList>\n\t\t\t<Tabs.Tab tabId={ WIDGET_AREAS_IDENTIFIER }>\n\t\t\t\t{ selectedWidgetAreaBlock\n\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t: __( 'Widget Areas' ) }\n\t\t\t</Tabs.Tab>\n\t\t\t<Tabs.Tab tabId={ BLOCK_INSPECTOR_IDENTIFIER }>\n\t\t\t\t{ __( 'Block' ) }\n\t\t\t</Tabs.Tab>\n\t\t</Tabs.TabList>\n\t);\n}\n\nfunction SidebarContent( {\n\thasSelectedNonAreaBlock,\n\tcurrentArea,\n\tisGeneralSidebarOpen,\n\tselectedWidgetAreaBlock,\n} ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\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\t// We're intentionally leaving `currentArea` and `isGeneralSidebarOpen`\n\t\t// out of the dep array because we want this effect to run based on\n\t\t// block selection changes, not sidebar state changes.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader\n\t\t\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Context.Provider>\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={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t<WidgetAreas\n\t\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t{ hasSelectedNonAreaBlock ? (\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs.Context.Provider>\n\t\t</ComplementaryArea>\n\t);\n}\n\nexport default function Sidebar() {\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\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\t// `newSelectedTabId` could technically be falsey if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsey handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea(\n\t\t\t\t\teditWidgetsStore.name,\n\t\t\t\t\tnewSelectedTabId\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\t// Due to how this component is controlled (via a value from the\n\t\t\t// `interfaceStore`), when the sidebar closes the currently selected\n\t\t\t// tab can't be found. This causes the component to continuously reset\n\t\t\t// the selection to `null` in an infinite loop. Proactively setting\n\t\t\t// the selected tab to `null` avoids that.\n\t\t\tselectedTabId={ isGeneralSidebarOpen ? currentArea : null }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\thasSelectedNonAreaBlock={ hasSelectedNonAreaBlock }\n\t\t\t\tcurrentArea={ currentArea }\n\t\t\t\tisGeneralSidebarOpen={ isGeneralSidebarOpen }\n\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,SAAS,EACTC,QAAQ,EACRC,UAAU,EACVC,WAAW,QACL,oBAAoB;AAC3B,SAASC,KAAK,EAAEC,EAAE,QAAQ,iBAAiB;AAC3C,SACCC,iBAAiB,EACjBC,KAAK,IAAIC,cAAc,QACjB,sBAAsB;AAC7B,SACCC,cAAc,EACdF,KAAK,IAAIG,gBAAgB,QACnB,yBAAyB;AAEhC,SAASC,UAAU,EAAEC,WAAW,QAAQ,kBAAkB;AAC1D,SAASC,WAAW,IAAIC,qBAAqB,QAAQ,uBAAuB;AAC5E,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AAExD,MAAMC,yBAAyB,GAAGhB,QAAQ,CAAC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CAAC,CAAEyB,UAAU;MACnCnC,uBAAuB,EAAEqC;IAC1B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAM;IAAE1B;EAAwB,CAAC,GAAG3B,WAAW,CAAER,cAAe,CAAC;;EAEjE;EACA;EACA;EACA;EACA,MAAM+D,WAAW,GAAGpE,WAAW,CAC5BqE,gBAAgB,IAAM;IACvB,IAAK,CAAC,CAAEA,gBAAgB,EAAG;MAC1B7B,uBAAuB,CACtBnB,gBAAgB,CAACc,IAAI,EACrBkC,gBACD,CAAC;IACF;EACD,CAAC,EACD,CAAE7B,uBAAuB,CAC1B,CAAC;EAED,oBACChB,IAAA,CAACG;EACA;EACA;EACA;EACA;EACA;EAAA;IACA2C,aAAa,EAAG/B,oBAAoB,GAAGD,WAAW,GAAG,IAAM;IAC3DiC,QAAQ,EAAGH,WAAa;IACxBI,YAAY,EAAG,KAAO;IAAAzC,QAAA,eAEtBP,IAAA,CAACY,cAAc;MACdC,uBAAuB,EAAGA,uBAAyB;MACnDC,WAAW,EAAGA,WAAa;MAC3BC,oBAAoB,EAAGA,oBAAsB;MAC7CV,uBAAuB,EAAGA;IAAyB,CACnD;EAAC,CACG,CAAC;AAET","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
@@ -15,6 +14,8 @@ import { safeHTML } from '@wordpress/dom';
|
|
|
15
14
|
* Internal dependencies
|
|
16
15
|
*/
|
|
17
16
|
import { store as editWidgetsStore } from '../../store';
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
19
|
export default function WidgetAreas({
|
|
19
20
|
selectedWidgetAreaId
|
|
20
21
|
}) {
|
|
@@ -28,26 +29,33 @@ export default function WidgetAreas({
|
|
|
28
29
|
} else {
|
|
29
30
|
description = selectedWidgetArea.description;
|
|
30
31
|
}
|
|
31
|
-
return
|
|
32
|
-
className: "edit-widgets-widget-areas"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
32
|
+
return /*#__PURE__*/_jsx("div", {
|
|
33
|
+
className: "edit-widgets-widget-areas",
|
|
34
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
35
|
+
className: "edit-widgets-widget-areas__top-container",
|
|
36
|
+
children: [/*#__PURE__*/_jsx(BlockIcon, {
|
|
37
|
+
icon: blockDefault
|
|
38
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
39
|
+
children: [/*#__PURE__*/_jsx("p", {
|
|
40
|
+
// Use `dangerouslySetInnerHTML` to keep backwards
|
|
41
|
+
// compatibility. Basic markup in the description is an
|
|
42
|
+
// established feature of WordPress.
|
|
43
|
+
// @see https://github.com/WordPress/gutenberg/issues/33106
|
|
44
|
+
dangerouslySetInnerHTML: {
|
|
45
|
+
__html: safeHTML(description)
|
|
46
|
+
}
|
|
47
|
+
}), widgetAreas?.length === 0 && /*#__PURE__*/_jsx("p", {
|
|
48
|
+
children: __('Your theme does not contain any Widget Areas.')
|
|
49
|
+
}), !selectedWidgetArea && /*#__PURE__*/_jsx(Button, {
|
|
50
|
+
href: addQueryArgs('customize.php', {
|
|
51
|
+
'autofocus[panel]': 'widgets',
|
|
52
|
+
return: window.location.pathname
|
|
53
|
+
}),
|
|
54
|
+
variant: "tertiary",
|
|
55
|
+
children: __('Manage with live preview')
|
|
56
|
+
})]
|
|
57
|
+
})]
|
|
58
|
+
})
|
|
59
|
+
});
|
|
52
60
|
}
|
|
53
61
|
//# sourceMappingURL=widget-areas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useMemo","blockDefault","BlockIcon","Button","__","addQueryArgs","safeHTML","store","editWidgetsStore","WidgetAreas","selectedWidgetAreaId","widgetAreas","select","getWidgetAreas","selectedWidgetArea","find","widgetArea","id","description","
|
|
1
|
+
{"version":3,"names":["useSelect","useMemo","blockDefault","BlockIcon","Button","__","addQueryArgs","safeHTML","store","editWidgetsStore","jsx","_jsx","jsxs","_jsxs","WidgetAreas","selectedWidgetAreaId","widgetAreas","select","getWidgetAreas","selectedWidgetArea","find","widgetArea","id","description","className","children","icon","dangerouslySetInnerHTML","__html","length","href","return","window","location","pathname","variant"],"sources":["@wordpress/edit-widgets/src/components/sidebar/widget-areas.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { blockDefault } from '@wordpress/icons';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\nimport { safeHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function WidgetAreas( { selectedWidgetAreaId } ) {\n\tconst widgetAreas = useSelect(\n\t\t( select ) => select( editWidgetsStore ).getWidgetAreas(),\n\t\t[]\n\t);\n\n\tconst selectedWidgetArea = useMemo(\n\t\t() =>\n\t\t\tselectedWidgetAreaId &&\n\t\t\twidgetAreas?.find(\n\t\t\t\t( widgetArea ) => widgetArea.id === selectedWidgetAreaId\n\t\t\t),\n\t\t[ selectedWidgetAreaId, widgetAreas ]\n\t);\n\n\tlet description;\n\tif ( ! selectedWidgetArea ) {\n\t\tdescription = __(\n\t\t\t'Widget Areas are global parts in your site’s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer.'\n\t\t);\n\t} else if ( selectedWidgetAreaId === 'wp_inactive_widgets' ) {\n\t\tdescription = __(\n\t\t\t'Blocks in this Widget Area will not be displayed in your site.'\n\t\t);\n\t} else {\n\t\tdescription = selectedWidgetArea.description;\n\t}\n\n\treturn (\n\t\t<div className=\"edit-widgets-widget-areas\">\n\t\t\t<div className=\"edit-widgets-widget-areas__top-container\">\n\t\t\t\t<BlockIcon icon={ blockDefault } />\n\t\t\t\t<div>\n\t\t\t\t\t<p\n\t\t\t\t\t\t// Use `dangerouslySetInnerHTML` to keep backwards\n\t\t\t\t\t\t// compatibility. Basic markup in the description is an\n\t\t\t\t\t\t// established feature of WordPress.\n\t\t\t\t\t\t// @see https://github.com/WordPress/gutenberg/issues/33106\n\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t__html: safeHTML( description ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ widgetAreas?.length === 0 && (\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Your theme does not contain any Widget Areas.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! selectedWidgetArea && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\thref={ addQueryArgs( 'customize.php', {\n\t\t\t\t\t\t\t\t'autofocus[panel]': 'widgets',\n\t\t\t\t\t\t\t\treturn: window.location.pathname,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Manage with live preview' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,SAAS,QAAQ,yBAAyB;AACnD,SAASC,MAAM,QAAQ,uBAAuB;AAC9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