@wordpress/customize-widgets 4.35.0 → 5.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.
Files changed (75) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/build/components/block-appender/index.js +2 -2
  3. package/build/components/block-appender/index.js.map +1 -1
  4. package/build/components/block-inspector-button/index.js +5 -4
  5. package/build/components/block-inspector-button/index.js.map +1 -1
  6. package/build/components/customize-widgets/index.js +24 -18
  7. package/build/components/customize-widgets/index.js.map +1 -1
  8. package/build/components/error-boundary/index.js +12 -10
  9. package/build/components/error-boundary/index.js.map +1 -1
  10. package/build/components/focus-control/index.js +5 -4
  11. package/build/components/focus-control/index.js.map +1 -1
  12. package/build/components/header/index.js +48 -44
  13. package/build/components/header/index.js.map +1 -1
  14. package/build/components/inserter/index.js +25 -21
  15. package/build/components/inserter/index.js.map +1 -1
  16. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +2 -2
  17. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  18. package/build/components/keyboard-shortcut-help-modal/index.js +50 -45
  19. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  20. package/build/components/keyboard-shortcut-help-modal/shortcut.js +30 -26
  21. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  22. package/build/components/more-menu/index.js +65 -54
  23. package/build/components/more-menu/index.js.map +1 -1
  24. package/build/components/sidebar-block-editor/index.js +42 -34
  25. package/build/components/sidebar-block-editor/index.js.map +1 -1
  26. package/build/components/sidebar-block-editor/sidebar-editor-provider.js +5 -4
  27. package/build/components/sidebar-block-editor/sidebar-editor-provider.js.map +1 -1
  28. package/build/components/sidebar-controls/index.js +5 -4
  29. package/build/components/sidebar-controls/index.js.map +1 -1
  30. package/build/components/welcome-guide/index.js +44 -33
  31. package/build/components/welcome-guide/index.js.map +1 -1
  32. package/build/filters/move-to-sidebar.js +16 -12
  33. package/build/filters/move-to-sidebar.js.map +1 -1
  34. package/build/filters/wide-widget-display.js +2 -2
  35. package/build/filters/wide-widget-display.js.map +1 -1
  36. package/build/index.js +3 -3
  37. package/build/index.js.map +1 -1
  38. package/build-module/components/block-appender/index.js +2 -2
  39. package/build-module/components/block-appender/index.js.map +1 -1
  40. package/build-module/components/block-inspector-button/index.js +5 -4
  41. package/build-module/components/block-inspector-button/index.js.map +1 -1
  42. package/build-module/components/customize-widgets/index.js +25 -18
  43. package/build-module/components/customize-widgets/index.js.map +1 -1
  44. package/build-module/components/error-boundary/index.js +12 -10
  45. package/build-module/components/error-boundary/index.js.map +1 -1
  46. package/build-module/components/focus-control/index.js +5 -4
  47. package/build-module/components/focus-control/index.js.map +1 -1
  48. package/build-module/components/header/index.js +50 -44
  49. package/build-module/components/header/index.js.map +1 -1
  50. package/build-module/components/inserter/index.js +26 -21
  51. package/build-module/components/inserter/index.js.map +1 -1
  52. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +2 -2
  53. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  54. package/build-module/components/keyboard-shortcut-help-modal/index.js +51 -45
  55. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  56. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +32 -26
  57. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  58. package/build-module/components/more-menu/index.js +67 -54
  59. package/build-module/components/more-menu/index.js.map +1 -1
  60. package/build-module/components/sidebar-block-editor/index.js +44 -34
  61. package/build-module/components/sidebar-block-editor/index.js.map +1 -1
  62. package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js +5 -4
  63. package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js.map +1 -1
  64. package/build-module/components/sidebar-controls/index.js +5 -4
  65. package/build-module/components/sidebar-controls/index.js.map +1 -1
  66. package/build-module/components/welcome-guide/index.js +45 -33
  67. package/build-module/components/welcome-guide/index.js.map +1 -1
  68. package/build-module/filters/move-to-sidebar.js +18 -12
  69. package/build-module/filters/move-to-sidebar.js.map +1 -1
  70. package/build-module/filters/wide-widget-display.js +2 -2
  71. package/build-module/filters/wide-widget-display.js.map +1 -1
  72. package/build-module/index.js +3 -3
  73. package/build-module/index.js.map +1 -1
  74. package/package.json +24 -23
  75. package/src/index.js +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 5.0.0 (2024-05-31)
6
+
7
+ ### Breaking Changes
8
+
9
+ - Variables like `process.env.IS_GUTENBERG_PLUGIN` have been replaced by `globalThis.IS_GUTENBERG_PLUGIN`. Build systems using `process.env` should be updated ([#61486](https://github.com/WordPress/gutenberg/pull/61486)).
10
+ - Increase the minimum required Node.js version to v18.12.0 matching long-term support releases ([#31270](https://github.com/WordPress/gutenberg/pull/61930)). Learn more about [Node.js releases](https://nodejs.org/en/about/previous-releases).
11
+
5
12
  ## 4.35.0 (2024-05-16)
6
13
 
7
14
  ## 4.34.0 (2024-05-02)
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = BlockAppender;
7
- var _react = require("react");
8
7
  var _element = require("@wordpress/element");
9
8
  var _blockEditor = require("@wordpress/block-editor");
10
9
  var _data = require("@wordpress/data");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
11
  /**
12
12
  * WordPress dependencies
13
13
  */
@@ -28,7 +28,7 @@ function BlockAppender(props) {
28
28
  }
29
29
  }
30
30
  }, [isBlocksListEmpty]);
31
- return (0, _react.createElement)(_blockEditor.ButtonBlockAppender, {
31
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.ButtonBlockAppender, {
32
32
  ...props,
33
33
  ref: ref
34
34
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_blockEditor","_data","BlockAppender","props","ref","useRef","isBlocksListEmpty","useSelect","select","blockEditorStore","getBlockCount","useEffect","current","ownerDocument","activeElement","body","focus","_react","createElement","ButtonBlockAppender"],"sources":["@wordpress/customize-widgets/src/components/block-appender/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport {\n\tButtonBlockAppender,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\nexport default function BlockAppender( props ) {\n\tconst ref = useRef();\n\tconst isBlocksListEmpty = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockCount() === 0\n\t);\n\n\t// Move the focus to the block appender to prevent focus from\n\t// being lost when emptying the widget area.\n\tuseEffect( () => {\n\t\tif ( isBlocksListEmpty && ref.current ) {\n\t\t\tconst { ownerDocument } = ref.current;\n\n\t\t\tif (\n\t\t\t\t! ownerDocument.activeElement ||\n\t\t\t\townerDocument.activeElement === ownerDocument.body\n\t\t\t) {\n\t\t\t\tref.current.focus();\n\t\t\t}\n\t\t}\n\t}, [ isBlocksListEmpty ] );\n\n\treturn <ButtonBlockAppender { ...props } ref={ ref } />;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,KAAA,GAAAF,OAAA;AARA;AACA;AACA;;AAQe,SAASG,aAAaA,CAAEC,KAAK,EAAG;EAC9C,MAAMC,GAAG,GAAG,IAAAC,eAAM,EAAC,CAAC;EACpB,MAAMC,iBAAiB,GAAG,IAAAC,eAAS,EAChCC,MAAM,IAAMA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,aAAa,CAAC,CAAC,KAAK,CAC9D,CAAC;;EAED;EACA;EACA,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAKL,iBAAiB,IAAIF,GAAG,CAACQ,OAAO,EAAG;MACvC,MAAM;QAAEC;MAAc,CAAC,GAAGT,GAAG,CAACQ,OAAO;MAErC,IACC,CAAEC,aAAa,CAACC,aAAa,IAC7BD,aAAa,CAACC,aAAa,KAAKD,aAAa,CAACE,IAAI,EACjD;QACDX,GAAG,CAACQ,OAAO,CAACI,KAAK,CAAC,CAAC;MACpB;IACD;EACD,CAAC,EAAE,CAAEV,iBAAiB,CAAG,CAAC;EAE1B,OAAO,IAAAW,MAAA,CAAAC,aAAA,EAAClB,YAAA,CAAAmB,mBAAmB;IAAA,GAAMhB,KAAK;IAAGC,GAAG,EAAGA;EAAK,CAAE,CAAC;AACxD","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_blockEditor","_data","_jsxRuntime","BlockAppender","props","ref","useRef","isBlocksListEmpty","useSelect","select","blockEditorStore","getBlockCount","useEffect","current","ownerDocument","activeElement","body","focus","jsx","ButtonBlockAppender"],"sources":["@wordpress/customize-widgets/src/components/block-appender/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport {\n\tButtonBlockAppender,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\nexport default function BlockAppender( props ) {\n\tconst ref = useRef();\n\tconst isBlocksListEmpty = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockCount() === 0\n\t);\n\n\t// Move the focus to the block appender to prevent focus from\n\t// being lost when emptying the widget area.\n\tuseEffect( () => {\n\t\tif ( isBlocksListEmpty && ref.current ) {\n\t\t\tconst { ownerDocument } = ref.current;\n\n\t\t\tif (\n\t\t\t\t! ownerDocument.activeElement ||\n\t\t\t\townerDocument.activeElement === ownerDocument.body\n\t\t\t) {\n\t\t\t\tref.current.focus();\n\t\t\t}\n\t\t}\n\t}, [ isBlocksListEmpty ] );\n\n\treturn <ButtonBlockAppender { ...props } ref={ ref } />;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,KAAA,GAAAF,OAAA;AAA4C,IAAAG,WAAA,GAAAH,OAAA;AAR5C;AACA;AACA;;AAQe,SAASI,aAAaA,CAAEC,KAAK,EAAG;EAC9C,MAAMC,GAAG,GAAG,IAAAC,eAAM,EAAC,CAAC;EACpB,MAAMC,iBAAiB,GAAG,IAAAC,eAAS,EAChCC,MAAM,IAAMA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,aAAa,CAAC,CAAC,KAAK,CAC9D,CAAC;;EAED;EACA;EACA,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAKL,iBAAiB,IAAIF,GAAG,CAACQ,OAAO,EAAG;MACvC,MAAM;QAAEC;MAAc,CAAC,GAAGT,GAAG,CAACQ,OAAO;MAErC,IACC,CAAEC,aAAa,CAACC,aAAa,IAC7BD,aAAa,CAACC,aAAa,KAAKD,aAAa,CAACE,IAAI,EACjD;QACDX,GAAG,CAACQ,OAAO,CAACI,KAAK,CAAC,CAAC;MACpB;IACD;EACD,CAAC,EAAE,CAAEV,iBAAiB,CAAG,CAAC;EAE1B,oBAAO,IAAAL,WAAA,CAAAgB,GAAA,EAAClB,YAAA,CAAAmB,mBAAmB;IAAA,GAAMf,KAAK;IAAGC,GAAG,EAAGA;EAAK,CAAE,CAAC;AACxD","ignoreList":[]}
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _react = require("react");
8
7
  var _element = require("@wordpress/element");
9
8
  var _i18n = require("@wordpress/i18n");
10
9
  var _components = require("@wordpress/components");
11
10
  var _data = require("@wordpress/data");
12
11
  var _blockEditor = require("@wordpress/block-editor");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
13
  /**
14
14
  * WordPress dependencies
15
15
  */
@@ -21,7 +21,7 @@ function BlockInspectorButton({
21
21
  }) {
22
22
  const selectedBlockClientId = (0, _data.useSelect)(select => select(_blockEditor.store).getSelectedBlockClientId(), []);
23
23
  const selectedBlock = (0, _element.useMemo)(() => document.getElementById(`block-${selectedBlockClientId}`), [selectedBlockClientId]);
24
- return (0, _react.createElement)(_components.MenuItem, {
24
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
25
25
  onClick: () => {
26
26
  // Open the inspector.
27
27
  inspector.open({
@@ -30,8 +30,9 @@ function BlockInspectorButton({
30
30
  // Then close the dropdown menu.
31
31
  closeMenu();
32
32
  },
33
- ...props
34
- }, (0, _i18n.__)('Show more settings'));
33
+ ...props,
34
+ children: (0, _i18n.__)('Show more settings')
35
+ });
35
36
  }
36
37
  var _default = exports.default = BlockInspectorButton;
37
38
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_i18n","_components","_data","_blockEditor","BlockInspectorButton","inspector","closeMenu","props","selectedBlockClientId","useSelect","select","blockEditorStore","getSelectedBlockClientId","selectedBlock","useMemo","document","getElementById","_react","createElement","MenuItem","onClick","open","returnFocusWhenClose","__","_default","exports","default"],"sources":["@wordpress/customize-widgets/src/components/block-inspector-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction BlockInspectorButton( { inspector, closeMenu, ...props } ) {\n\tconst selectedBlockClientId = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSelectedBlockClientId(),\n\t\t[]\n\t);\n\n\tconst selectedBlock = useMemo(\n\t\t() => document.getElementById( `block-${ selectedBlockClientId }` ),\n\t\t[ selectedBlockClientId ]\n\t);\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\t// Open the inspector.\n\t\t\t\tinspector.open( {\n\t\t\t\t\treturnFocusWhenClose: selectedBlock,\n\t\t\t\t} );\n\t\t\t\t// Then close the dropdown menu.\n\t\t\t\tcloseMenu();\n\t\t\t} }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ __( 'Show more settings' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport default BlockInspectorButton;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAPA;AACA;AACA;;AAOA,SAASK,oBAAoBA,CAAE;EAAEC,SAAS;EAAEC,SAAS;EAAE,GAAGC;AAAM,CAAC,EAAG;EACnE,MAAMC,qBAAqB,GAAG,IAAAC,eAAS,EACpCC,MAAM,IAAMA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,wBAAwB,CAAC,CAAC,EACnE,EACD,CAAC;EAED,MAAMC,aAAa,GAAG,IAAAC,gBAAO,EAC5B,MAAMC,QAAQ,CAACC,cAAc,CAAG,SAASR,qBAAuB,EAAE,CAAC,EACnE,CAAEA,qBAAqB,CACxB,CAAC;EAED,OACC,IAAAS,MAAA,CAAAC,aAAA,EAACjB,WAAA,CAAAkB,QAAQ;IACRC,OAAO,EAAGA,CAAA,KAAM;MACf;MACAf,SAAS,CAACgB,IAAI,CAAE;QACfC,oBAAoB,EAAET;MACvB,CAAE,CAAC;MACH;MACAP,SAAS,CAAC,CAAC;IACZ,CAAG;IAAA,GACEC;EAAK,GAER,IAAAgB,QAAE,EAAE,oBAAqB,CAClB,CAAC;AAEb;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEctB,oBAAoB","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_i18n","_components","_data","_blockEditor","_jsxRuntime","BlockInspectorButton","inspector","closeMenu","props","selectedBlockClientId","useSelect","select","blockEditorStore","getSelectedBlockClientId","selectedBlock","useMemo","document","getElementById","jsx","MenuItem","onClick","open","returnFocusWhenClose","children","__","_default","exports","default"],"sources":["@wordpress/customize-widgets/src/components/block-inspector-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction BlockInspectorButton( { inspector, closeMenu, ...props } ) {\n\tconst selectedBlockClientId = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSelectedBlockClientId(),\n\t\t[]\n\t);\n\n\tconst selectedBlock = useMemo(\n\t\t() => document.getElementById( `block-${ selectedBlockClientId }` ),\n\t\t[ selectedBlockClientId ]\n\t);\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\t// Open the inspector.\n\t\t\t\tinspector.open( {\n\t\t\t\t\treturnFocusWhenClose: selectedBlock,\n\t\t\t\t} );\n\t\t\t\t// Then close the dropdown menu.\n\t\t\t\tcloseMenu();\n\t\t\t} }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ __( 'Show more settings' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport default BlockInspectorButton;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAAoE,IAAAK,WAAA,GAAAL,OAAA;AAPpE;AACA;AACA;;AAOA,SAASM,oBAAoBA,CAAE;EAAEC,SAAS;EAAEC,SAAS;EAAE,GAAGC;AAAM,CAAC,EAAG;EACnE,MAAMC,qBAAqB,GAAG,IAAAC,eAAS,EACpCC,MAAM,IAAMA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,wBAAwB,CAAC,CAAC,EACnE,EACD,CAAC;EAED,MAAMC,aAAa,GAAG,IAAAC,gBAAO,EAC5B,MAAMC,QAAQ,CAACC,cAAc,CAAG,SAASR,qBAAuB,EAAE,CAAC,EACnE,CAAEA,qBAAqB,CACxB,CAAC;EAED,oBACC,IAAAL,WAAA,CAAAc,GAAA,EAACjB,WAAA,CAAAkB,QAAQ;IACRC,OAAO,EAAGA,CAAA,KAAM;MACf;MACAd,SAAS,CAACe,IAAI,CAAE;QACfC,oBAAoB,EAAER;MACvB,CAAE,CAAC;MACH;MACAP,SAAS,CAAC,CAAC;IACZ,CAAG;IAAA,GACEC,KAAK;IAAAe,QAAA,EAER,IAAAC,QAAE,EAAE,oBAAqB;EAAC,CACnB,CAAC;AAEb;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEctB,oBAAoB","ignoreList":[]}
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = CustomizeWidgets;
8
- var _react = require("react");
9
8
  var _element = require("@wordpress/element");
10
9
  var _components = require("@wordpress/components");
11
10
  var _errorBoundary = _interopRequireDefault(require("../error-boundary"));
@@ -13,6 +12,7 @@ var _sidebarBlockEditor = _interopRequireDefault(require("../sidebar-block-edito
13
12
  var _focusControl = _interopRequireDefault(require("../focus-control"));
14
13
  var _sidebarControls = _interopRequireDefault(require("../sidebar-controls"));
15
14
  var _useClearSelectedBlock = _interopRequireDefault(require("./use-clear-selected-block"));
15
+ var _jsxRuntime = require("react/jsx-runtime");
16
16
  /**
17
17
  * WordPress dependencies
18
18
  */
@@ -40,26 +40,32 @@ function CustomizeWidgets({
40
40
  unsubscribers.forEach(unsubscriber => unsubscriber());
41
41
  };
42
42
  }, [sidebarControls]);
43
- const activeSidebar = activeSidebarControl && (0, _element.createPortal)((0, _react.createElement)(_errorBoundary.default, null, (0, _react.createElement)(_sidebarBlockEditor.default, {
44
- key: activeSidebarControl.id,
45
- blockEditorSettings: blockEditorSettings,
46
- sidebar: activeSidebarControl.sidebarAdapter,
47
- inserter: activeSidebarControl.inserter,
48
- inspector: activeSidebarControl.inspector
49
- })), activeSidebarControl.container[0]);
43
+ const activeSidebar = activeSidebarControl && (0, _element.createPortal)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_errorBoundary.default, {
44
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarBlockEditor.default, {
45
+ blockEditorSettings: blockEditorSettings,
46
+ sidebar: activeSidebarControl.sidebarAdapter,
47
+ inserter: activeSidebarControl.inserter,
48
+ inspector: activeSidebarControl.inspector
49
+ }, activeSidebarControl.id)
50
+ }), activeSidebarControl.container[0]);
50
51
 
51
52
  // We have to portal this to the parent of both the editor and the inspector,
52
53
  // so that the popovers will appear above both of them.
53
- const popover = parentContainer && (0, _element.createPortal)((0, _react.createElement)("div", {
54
+ const popover = parentContainer && (0, _element.createPortal)( /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
54
55
  className: "customize-widgets-popover",
55
- ref: popoverRef
56
- }, (0, _react.createElement)(_components.Popover.Slot, null)), parentContainer);
57
- return (0, _react.createElement)(_components.SlotFillProvider, null, (0, _react.createElement)(_sidebarControls.default, {
58
- sidebarControls: sidebarControls,
59
- activeSidebarControl: activeSidebarControl
60
- }, (0, _react.createElement)(_focusControl.default, {
61
- api: api,
62
- sidebarControls: sidebarControls
63
- }, activeSidebar, popover)));
56
+ ref: popoverRef,
57
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Popover.Slot, {})
58
+ }), parentContainer);
59
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SlotFillProvider, {
60
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarControls.default, {
61
+ sidebarControls: sidebarControls,
62
+ activeSidebarControl: activeSidebarControl,
63
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_focusControl.default, {
64
+ api: api,
65
+ sidebarControls: sidebarControls,
66
+ children: [activeSidebar, popover]
67
+ })
68
+ })
69
+ });
64
70
  }
65
71
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_components","_errorBoundary","_interopRequireDefault","_sidebarBlockEditor","_focusControl","_sidebarControls","_useClearSelectedBlock","CustomizeWidgets","api","sidebarControls","blockEditorSettings","activeSidebarControl","setActiveSidebarControl","useState","parentContainer","document","getElementById","popoverRef","useRef","useClearSelectedBlock","useEffect","unsubscribers","map","sidebarControl","subscribe","expanded","forEach","unsubscriber","activeSidebar","createPortal","_react","createElement","default","key","id","sidebar","sidebarAdapter","inserter","inspector","container","popover","className","ref","Popover","Slot","SlotFillProvider"],"sources":["@wordpress/customize-widgets/src/components/customize-widgets/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useRef, createPortal } from '@wordpress/element';\nimport { SlotFillProvider, Popover } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ErrorBoundary from '../error-boundary';\nimport SidebarBlockEditor from '../sidebar-block-editor';\nimport FocusControl from '../focus-control';\nimport SidebarControls from '../sidebar-controls';\nimport useClearSelectedBlock from './use-clear-selected-block';\n\nexport default function CustomizeWidgets( {\n\tapi,\n\tsidebarControls,\n\tblockEditorSettings,\n} ) {\n\tconst [ activeSidebarControl, setActiveSidebarControl ] = useState( null );\n\tconst parentContainer = document.getElementById(\n\t\t'customize-theme-controls'\n\t);\n\tconst popoverRef = useRef();\n\n\tuseClearSelectedBlock( activeSidebarControl, popoverRef );\n\n\tuseEffect( () => {\n\t\tconst unsubscribers = sidebarControls.map( ( sidebarControl ) =>\n\t\t\tsidebarControl.subscribe( ( expanded ) => {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tsetActiveSidebarControl( sidebarControl );\n\t\t\t\t}\n\t\t\t} )\n\t\t);\n\n\t\treturn () => {\n\t\t\tunsubscribers.forEach( ( unsubscriber ) => unsubscriber() );\n\t\t};\n\t}, [ sidebarControls ] );\n\n\tconst activeSidebar =\n\t\tactiveSidebarControl &&\n\t\tcreatePortal(\n\t\t\t<ErrorBoundary>\n\t\t\t\t<SidebarBlockEditor\n\t\t\t\t\tkey={ activeSidebarControl.id }\n\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\tsidebar={ activeSidebarControl.sidebarAdapter }\n\t\t\t\t\tinserter={ activeSidebarControl.inserter }\n\t\t\t\t\tinspector={ activeSidebarControl.inspector }\n\t\t\t\t/>\n\t\t\t</ErrorBoundary>,\n\t\t\tactiveSidebarControl.container[ 0 ]\n\t\t);\n\n\t// We have to portal this to the parent of both the editor and the inspector,\n\t// so that the popovers will appear above both of them.\n\tconst popover =\n\t\tparentContainer &&\n\t\tcreatePortal(\n\t\t\t<div className=\"customize-widgets-popover\" ref={ popoverRef }>\n\t\t\t\t<Popover.Slot />\n\t\t\t</div>,\n\t\t\tparentContainer\n\t\t);\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<SidebarControls\n\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\tactiveSidebarControl={ activeSidebarControl }\n\t\t\t>\n\t\t\t\t<FocusControl api={ api } sidebarControls={ sidebarControls }>\n\t\t\t\t\t{ activeSidebar }\n\t\t\t\t\t{ popover }\n\t\t\t\t</FocusControl>\n\t\t\t</SidebarControls>\n\t\t</SlotFillProvider>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,cAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,aAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,gBAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,sBAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAbA;AACA;AACA;;AAIA;AACA;AACA;;AAOe,SAASQ,gBAAgBA,CAAE;EACzCC,GAAG;EACHC,eAAe;EACfC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,oBAAoB,EAAEC,uBAAuB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,IAAK,CAAC;EAC1E,MAAMC,eAAe,GAAGC,QAAQ,CAACC,cAAc,CAC9C,0BACD,CAAC;EACD,MAAMC,UAAU,GAAG,IAAAC,eAAM,EAAC,CAAC;EAE3B,IAAAC,8B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AC,aAAA,EAAC1B,gBAAA,CAAA2B,OAAe;IACfvB,eAAe,EAAGA,eAAiB;IACnCE,oBAAoB,EAAGA;EAAsB,GAE7C,IAAAmB,MAAA,CAAAC,aAAA,EAAC3B,aAAA,CAAA4B,OAAY;IAACxB,GAAG,EAAGA,GAAK;IAACC,eAAe,EAAGA;EAAiB,GAC1DmB,aAAa,EACbY,OACW,CACE,CACA,CAAC;AAErB","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_components","_errorBoundary","_interopRequireDefault","_sidebarBlockEditor","_focusControl","_sidebarControls","_useClearSelectedBlock","_jsxRuntime","CustomizeWidgets","api","sidebarControls","blockEditorSettings","activeSidebarControl","setActiveSidebarControl","useState","parentContainer","document","getElementById","popoverRef","useRef","useClearSelectedBlock","useEffect","unsubscribers","map","sidebarControl","subscribe","expanded","forEach","unsubscriber","activeSidebar","createPortal","jsx","default","children","sidebar","sidebarAdapter","inserter","inspector","id","container","popover","className","ref","Popover","Slot","SlotFillProvider","jsxs"],"sources":["@wordpress/customize-widgets/src/components/customize-widgets/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useRef, createPortal } from '@wordpress/element';\nimport { SlotFillProvider, Popover } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ErrorBoundary from '../error-boundary';\nimport SidebarBlockEditor from '../sidebar-block-editor';\nimport FocusControl from '../focus-control';\nimport SidebarControls from '../sidebar-controls';\nimport useClearSelectedBlock from './use-clear-selected-block';\n\nexport default function CustomizeWidgets( {\n\tapi,\n\tsidebarControls,\n\tblockEditorSettings,\n} ) {\n\tconst [ activeSidebarControl, setActiveSidebarControl ] = useState( null );\n\tconst parentContainer = document.getElementById(\n\t\t'customize-theme-controls'\n\t);\n\tconst popoverRef = useRef();\n\n\tuseClearSelectedBlock( activeSidebarControl, popoverRef );\n\n\tuseEffect( () => {\n\t\tconst unsubscribers = sidebarControls.map( ( sidebarControl ) =>\n\t\t\tsidebarControl.subscribe( ( expanded ) => {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tsetActiveSidebarControl( sidebarControl );\n\t\t\t\t}\n\t\t\t} )\n\t\t);\n\n\t\treturn () => {\n\t\t\tunsubscribers.forEach( ( unsubscriber ) => unsubscriber() );\n\t\t};\n\t}, [ sidebarControls ] );\n\n\tconst activeSidebar =\n\t\tactiveSidebarControl &&\n\t\tcreatePortal(\n\t\t\t<ErrorBoundary>\n\t\t\t\t<SidebarBlockEditor\n\t\t\t\t\tkey={ activeSidebarControl.id }\n\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\tsidebar={ activeSidebarControl.sidebarAdapter }\n\t\t\t\t\tinserter={ activeSidebarControl.inserter }\n\t\t\t\t\tinspector={ activeSidebarControl.inspector }\n\t\t\t\t/>\n\t\t\t</ErrorBoundary>,\n\t\t\tactiveSidebarControl.container[ 0 ]\n\t\t);\n\n\t// We have to portal this to the parent of both the editor and the inspector,\n\t// so that the popovers will appear above both of them.\n\tconst popover =\n\t\tparentContainer &&\n\t\tcreatePortal(\n\t\t\t<div className=\"customize-widgets-popover\" ref={ popoverRef }>\n\t\t\t\t<Popover.Slot />\n\t\t\t</div>,\n\t\t\tparentContainer\n\t\t);\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<SidebarControls\n\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\tactiveSidebarControl={ activeSidebarControl }\n\t\t\t>\n\t\t\t\t<FocusControl api={ api } sidebarControls={ sidebarControls }>\n\t\t\t\t\t{ activeSidebar }\n\t\t\t\t\t{ popover }\n\t\t\t\t</FocusControl>\n\t\t\t</SidebarControls>\n\t\t</SlotFillProvider>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,cAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,aAA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C,SAAS,EAAGzB,oBAAoB,CAACyB;IAAW,GAJtCzB,oBAAoB,CAAC0B,EAK3B;EAAC,CACY,CAAC,EAChB1B,oBAAoB,CAAC2B,SAAS,CAAE,CAAC,CAClC,CAAC;;EAEF;EACA;EACA,MAAMC,OAAO,GACZzB,eAAe,IACf,IAAAe,qBAAY,gBACX,IAAAvB,WAAA,CAAAwB,GAAA;IAAKU,SAAS,EAAC,2BAA2B;IAACC,GAAG,EAAGxB,UAAY;IAAAe,QAAA,eAC5D,IAAA1B,WAAA,CAAAwB,GAAA,EAAC/B,WAAA,CAAA2C,OAAO,CAACC,IAAI,IAAE;EAAC,CACZ,CAAC,EACN7B,eACD,CAAC;EAEF,oBACC,IAAAR,WAAA,CAAAwB,GAAA,EAAC/B,WAAA,CAAA6C,gBAAgB;IAAAZ,QAAA,eAChB,IAAA1B,WAAA,CAAAwB,GAAA,EAAC1B,gBAAA,CAAA2B,OAAe;MACftB,eAAe,EAAGA,eAAiB;MACnCE,oBAAoB,EAAGA,oBAAsB;MAAAqB,QAAA,eAE7C,IAAA1B,WAAA,CAAAuC,IAAA,EAAC1C,aAAA,CAAA4B,OAAY;QAACvB,GAAG,EAAGA,GAAK;QAACC,eAAe,EAAGA,eAAiB;QAAAuB,QAAA,GAC1DJ,aAAa,EACbW,OAAO;MAAA,CACI;IAAC,CACC;EAAC,CACD,CAAC;AAErB","ignoreList":[]}
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _react = require("react");
8
7
  var _element = require("@wordpress/element");
9
8
  var _i18n = require("@wordpress/i18n");
10
9
  var _components = require("@wordpress/components");
11
10
  var _blockEditor = require("@wordpress/block-editor");
12
11
  var _compose = require("@wordpress/compose");
13
12
  var _hooks = require("@wordpress/hooks");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
14
  /**
15
15
  * WordPress dependencies
16
16
  */
@@ -20,10 +20,11 @@ function CopyButton({
20
20
  children
21
21
  }) {
22
22
  const ref = (0, _compose.useCopyToClipboard)(text);
23
- return (0, _react.createElement)(_components.Button, {
23
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
24
24
  variant: "secondary",
25
- ref: ref
26
- }, children);
25
+ ref: ref,
26
+ children: children
27
+ });
27
28
  }
28
29
  class ErrorBoundary extends _element.Component {
29
30
  constructor() {
@@ -45,13 +46,14 @@ class ErrorBoundary extends _element.Component {
45
46
  if (!error) {
46
47
  return this.props.children;
47
48
  }
48
- return (0, _react.createElement)(_blockEditor.Warning, {
49
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.Warning, {
49
50
  className: "customize-widgets-error-boundary",
50
- actions: [(0, _react.createElement)(CopyButton, {
51
- key: "copy-error",
52
- text: error.stack
53
- }, (0, _i18n.__)('Copy Error'))]
54
- }, (0, _i18n.__)('The editor has encountered an unexpected error.'));
51
+ actions: [/*#__PURE__*/(0, _jsxRuntime.jsx)(CopyButton, {
52
+ text: error.stack,
53
+ children: (0, _i18n.__)('Copy Error')
54
+ }, "copy-error")],
55
+ children: (0, _i18n.__)('The editor has encountered an unexpected error.')
56
+ });
55
57
  }
56
58
  }
57
59
  exports.default = ErrorBoundary;
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_i18n","_components","_blockEditor","_compose","_hooks","CopyButton","text","children","ref","useCopyToClipboard","_react","createElement","Button","variant","ErrorBoundary","Component","constructor","arguments","state","error","componentDidCatch","setState","doAction","render","props","Warning","className","actions","key","stack","__","exports","default"],"sources":["@wordpress/customize-widgets/src/components/error-boundary/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error ) {\n\t\tthis.setState( { error } );\n\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error );\n\t}\n\n\trender() {\n\t\tconst { error } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn (\n\t\t\t<Warning\n\t\t\t\tclassName=\"customize-widgets-error-boundary\"\n\t\t\t\tactions={ [\n\t\t\t\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t\t\t\t{ __( 'Copy Error' ) }\n\t\t\t\t\t</CopyButton>,\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t{ __( 'The editor has encountered an unexpected error.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AARA;AACA;AACA;;AAQA,SAASM,UAAUA,CAAE;EAAEC,IAAI;EAAEC;AAAS,CAAC,EAAG;EACzC,MAAMC,GAAG,GAAG,IAAAC,2BAAkB,EAAEH,IAAK,CAAC;EACtC,OACC,IAAAI,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAW,MAAM;IAACC,OAAO,EAAC,WAAW;IAACL,GAAG,EAAGA;EAAK,GACpCD,QACK,CAAC;AAEX;AAEe,MAAMO,aAAa,SAASC,kBAAS,CAAC;EACpDC,WAAWA,CAAA,EAAG;IACb,KAAK,CAAE,GAAGC,SAAU,CAAC;IACrB,IAAI,CAACC,KAAK,GAAG;MACZC,KAAK,EAAE;IACR,CAAC;EACF;EAEAC,iBAAiBA,CAAED,KAAK,EAAG;IAC1B,IAAI,CAACE,QAAQ,CAAE;MAAEF;IAAM,CAAE,CAAC;IAE1B,IAAAG,eAAQ,EAAE,kCAAkC,EAAEH,KAAM,CAAC;EACtD;EAEAI,MAAMA,CAAA,EAAG;IACR,MAAM;MAAEJ;IAAM,CAAC,GAAG,IAAI,CAACD,KAAK;IAC5B,IAAK,CAAEC,KAAK,EAAG;MACd,OAAO,IAAI,CAACK,KAAK,CAACjB,QAAQ;IAC3B;IAEA,OACC,IAAAG,MAAA,CAAAC,aAAA,EAACT,YAAA,CAAAuB,OAAO;MACPC,SAAS,EAAC,kCAAkC;MAC5CC,OAAO,EAAG,CACT,IAAAjB,MAAA,CAAAC,aAAA,EAACN,UAAU;QAACuB,GAAG,EAAC,YAAY;QAACtB,IAAI,EAAGa,KAAK,CAACU;MAAO,GAC9C,IAAAC,QAAE,EAAE,YAAa,CACR,CAAC;IACX,GAED,IAAAA,QAAE,EAAE,iDAAkD,CAChD,CAAC;EAEZ;AACD;AAACC,OAAA,CAAAC,OAAA,GAAAlB,aAAA","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_i18n","_components","_blockEditor","_compose","_hooks","_jsxRuntime","CopyButton","text","children","ref","useCopyToClipboard","jsx","Button","variant","ErrorBoundary","Component","constructor","arguments","state","error","componentDidCatch","setState","doAction","render","props","Warning","className","actions","stack","__","exports","default"],"sources":["@wordpress/customize-widgets/src/components/error-boundary/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error ) {\n\t\tthis.setState( { error } );\n\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error );\n\t}\n\n\trender() {\n\t\tconst { error } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn (\n\t\t\t<Warning\n\t\t\t\tclassName=\"customize-widgets-error-boundary\"\n\t\t\t\tactions={ [\n\t\t\t\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t\t\t\t{ __( 'Copy Error' ) }\n\t\t\t\t\t</CopyButton>,\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t{ __( 'The editor has encountered an unexpected error.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA4C,IAAAM,WAAA,GAAAN,OAAA;AAR5C;AACA;AACA;;AAQA,SAASO,UAAUA,CAAE;EAAEC,IAAI;EAAEC;AAAS,CAAC,EAAG;EACzC,MAAMC,GAAG,GAAG,IAAAC,2BAAkB,EAAEH,IAAK,CAAC;EACtC,oBACC,IAAAF,WAAA,CAAAM,GAAA,EAACV,WAAA,CAAAW,MAAM;IAACC,OAAO,EAAC,WAAW;IAACJ,GAAG,EAAGA,GAAK;IAAAD,QAAA,EACpCA;EAAQ,CACH,CAAC;AAEX;AAEe,MAAMM,aAAa,SAASC,kBAAS,CAAC;EACpDC,WAAWA,CAAA,EAAG;IACb,KAAK,CAAE,GAAGC,SAAU,CAAC;IACrB,IAAI,CAACC,KAAK,GAAG;MACZC,KAAK,EAAE;IACR,CAAC;EACF;EAEAC,iBAAiBA,CAAED,KAAK,EAAG;IAC1B,IAAI,CAACE,QAAQ,CAAE;MAAEF;IAAM,CAAE,CAAC;IAE1B,IAAAG,eAAQ,EAAE,kCAAkC,EAAEH,KAAM,CAAC;EACtD;EAEAI,MAAMA,CAAA,EAAG;IACR,MAAM;MAAEJ;IAAM,CAAC,GAAG,IAAI,CAACD,KAAK;IAC5B,IAAK,CAAEC,KAAK,EAAG;MACd,OAAO,IAAI,CAACK,KAAK,CAAChB,QAAQ;IAC3B;IAEA,oBACC,IAAAH,WAAA,CAAAM,GAAA,EAACT,YAAA,CAAAuB,OAAO;MACPC,SAAS,EAAC,kCAAkC;MAC5CC,OAAO,EAAG,cACT,IAAAtB,WAAA,CAAAM,GAAA,EAACL,UAAU;QAAkBC,IAAI,EAAGY,KAAK,CAACS,KAAO;QAAApB,QAAA,EAC9C,IAAAqB,QAAE,EAAE,YAAa;MAAC,GADL,YAEJ,CAAC,CACX;MAAArB,QAAA,EAED,IAAAqB,QAAE,EAAE,iDAAkD;IAAC,CACjD,CAAC;EAEZ;AACD;AAACC,OAAA,CAAAC,OAAA,GAAAjB,aAAA","ignoreList":[]}
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = FocusControl;
7
7
  exports.useFocusControl = void 0;
8
- var _react = require("react");
9
8
  var _element = require("@wordpress/element");
10
9
  var _utils = require("../../utils");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
11
  /**
12
12
  * WordPress dependencies
13
13
  */
@@ -63,9 +63,10 @@ function FocusControl({
63
63
  };
64
64
  }, [api, focusWidget]);
65
65
  const context = (0, _element.useMemo)(() => [focusedWidgetIdRef, focusWidget], [focusedWidgetIdRef, focusWidget]);
66
- return (0, _react.createElement)(FocusControlContext.Provider, {
67
- value: context
68
- }, children);
66
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(FocusControlContext.Provider, {
67
+ value: context,
68
+ children: children
69
+ });
69
70
  }
70
71
  const useFocusControl = () => (0, _element.useContext)(FocusControlContext);
71
72
  exports.useFocusControl = useFocusControl;
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_utils","FocusControlContext","createContext","FocusControl","api","sidebarControls","children","focusedWidgetIdRef","setFocusedWidgetIdRef","useState","current","focusWidget","useCallback","widgetId","sidebarControl","widgets","setting","get","includes","sectionInstance","expand","completeCallback","useEffect","handleFocus","settingId","settingIdToWidgetId","previewBound","handleReady","previewer","preview","bind","unbind","context","useMemo","_react","createElement","Provider","value","useFocusControl","useContext","exports"],"sources":["@wordpress/customize-widgets/src/components/focus-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseState,\n\tuseEffect,\n\tuseContext,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { settingIdToWidgetId } from '../../utils';\n\nconst FocusControlContext = createContext();\n\nexport default function FocusControl( { api, sidebarControls, children } ) {\n\tconst [ focusedWidgetIdRef, setFocusedWidgetIdRef ] = useState( {\n\t\tcurrent: null,\n\t} );\n\n\tconst focusWidget = useCallback(\n\t\t( widgetId ) => {\n\t\t\tfor ( const sidebarControl of sidebarControls ) {\n\t\t\t\tconst widgets = sidebarControl.setting.get();\n\n\t\t\t\tif ( widgets.includes( widgetId ) ) {\n\t\t\t\t\tsidebarControl.sectionInstance.expand( {\n\t\t\t\t\t\t// Schedule it after the complete callback so that\n\t\t\t\t\t\t// it won't be overridden by the \"Back\" button focus.\n\t\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t\t// Create a \"ref-like\" object every time to ensure\n\t\t\t\t\t\t\t// the same widget id can also triggers the focus control.\n\t\t\t\t\t\t\tsetFocusedWidgetIdRef( { current: widgetId } );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[ sidebarControls ]\n\t);\n\n\tuseEffect( () => {\n\t\tfunction handleFocus( settingId ) {\n\t\t\tconst widgetId = settingIdToWidgetId( settingId );\n\n\t\t\tfocusWidget( widgetId );\n\t\t}\n\n\t\tlet previewBound = false;\n\n\t\tfunction handleReady() {\n\t\t\tapi.previewer.preview.bind(\n\t\t\t\t'focus-control-for-setting',\n\t\t\t\thandleFocus\n\t\t\t);\n\t\t\tpreviewBound = true;\n\t\t}\n\n\t\tapi.previewer.bind( 'ready', handleReady );\n\n\t\treturn () => {\n\t\t\tapi.previewer.unbind( 'ready', handleReady );\n\t\t\tif ( previewBound ) {\n\t\t\t\tapi.previewer.preview.unbind(\n\t\t\t\t\t'focus-control-for-setting',\n\t\t\t\t\thandleFocus\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\t}, [ api, focusWidget ] );\n\n\tconst context = useMemo(\n\t\t() => [ focusedWidgetIdRef, focusWidget ],\n\t\t[ focusedWidgetIdRef, focusWidget ]\n\t);\n\n\treturn (\n\t\t<FocusControlContext.Provider value={ context }>\n\t\t\t{ children }\n\t\t</FocusControlContext.Provider>\n\t);\n}\n\nexport const useFocusControl = () => useContext( FocusControlContext );\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAYA,IAAAC,MAAA,GAAAD,OAAA;AAfA;AACA;AACA;;AAUA;AACA;AACA;;AAGA,MAAME,mBAAmB,GAAG,IAAAC,sBAAa,EAAC,CAAC;AAE5B,SAASC,YAAYA,CAAE;EAAEC,GAAG;EAAEC,eAAe;EAAEC;AAAS,CAAC,EAAG;EAC1E,MAAM,CAAEC,kBAAkB,EAAEC,qBAAqB,CAAE,GAAG,IAAAC,iBAAQ,EAAE;IAC/DC,OAAO,EAAE;EACV,CAAE,CAAC;EAEH,MAAMC,WAAW,GAAG,IAAAC,oBAAW,EAC5BC,QAAQ,IAAM;IACf,KAAM,MAAMC,cAAc,IAAIT,eAAe,EAAG;MAC/C,MAAMU,OAAO,GAAGD,cA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AACC,KAAK,EAAGL;EAAS,GAC5C1B,QAC2B,CAAC;AAEjC;AAEO,MAAMgC,eAAe,GAAGA,CAAA,KAAM,IAAAC,mBAAU,EAAEtC,mBAAoB,CAAC;AAACuC,OAAA,CAAAF,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_utils","_jsxRuntime","FocusControlContext","createContext","FocusControl","api","sidebarControls","children","focusedWidgetIdRef","setFocusedWidgetIdRef","useState","current","focusWidget","useCallback","widgetId","sidebarControl","widgets","setting","get","includes","sectionInstance","expand","completeCallback","useEffect","handleFocus","settingId","settingIdToWidgetId","previewBound","handleReady","previewer","preview","bind","unbind","context","useMemo","jsx","Provider","value","useFocusControl","useContext","exports"],"sources":["@wordpress/customize-widgets/src/components/focus-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseState,\n\tuseEffect,\n\tuseContext,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { settingIdToWidgetId } from '../../utils';\n\nconst FocusControlContext = createContext();\n\nexport default function FocusControl( { api, sidebarControls, children } ) {\n\tconst [ focusedWidgetIdRef, setFocusedWidgetIdRef ] = useState( {\n\t\tcurrent: null,\n\t} );\n\n\tconst focusWidget = useCallback(\n\t\t( widgetId ) => {\n\t\t\tfor ( const sidebarControl of sidebarControls ) {\n\t\t\t\tconst widgets = sidebarControl.setting.get();\n\n\t\t\t\tif ( widgets.includes( widgetId ) ) {\n\t\t\t\t\tsidebarControl.sectionInstance.expand( {\n\t\t\t\t\t\t// Schedule it after the complete callback so that\n\t\t\t\t\t\t// it won't be overridden by the \"Back\" button focus.\n\t\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t\t// Create a \"ref-like\" object every time to ensure\n\t\t\t\t\t\t\t// the same widget id can also triggers the focus control.\n\t\t\t\t\t\t\tsetFocusedWidgetIdRef( { current: widgetId } );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[ sidebarControls ]\n\t);\n\n\tuseEffect( () => {\n\t\tfunction handleFocus( settingId ) {\n\t\t\tconst widgetId = settingIdToWidgetId( settingId );\n\n\t\t\tfocusWidget( widgetId );\n\t\t}\n\n\t\tlet previewBound = false;\n\n\t\tfunction handleReady() {\n\t\t\tapi.previewer.preview.bind(\n\t\t\t\t'focus-control-for-setting',\n\t\t\t\thandleFocus\n\t\t\t);\n\t\t\tpreviewBound = true;\n\t\t}\n\n\t\tapi.previewer.bind( 'ready', handleReady );\n\n\t\treturn () => {\n\t\t\tapi.previewer.unbind( 'ready', handleReady );\n\t\t\tif ( previewBound ) {\n\t\t\t\tapi.previewer.preview.unbind(\n\t\t\t\t\t'focus-control-for-setting',\n\t\t\t\t\thandleFocus\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\t}, [ api, focusWidget ] );\n\n\tconst context = useMemo(\n\t\t() => [ focusedWidgetIdRef, focusWidget ],\n\t\t[ focusedWidgetIdRef, focusWidget ]\n\t);\n\n\treturn (\n\t\t<FocusControlContext.Provider value={ context }>\n\t\t\t{ children }\n\t\t</FocusControlContext.Provider>\n\t);\n}\n\nexport const useFocusControl = () => useContext( FocusControlContext );\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAYA,IAAAC,MAAA,GAAAD,OAAA;AAAkD,IAAAE,WAAA,GAAAF,OAAA;AAflD;AACA;AACA;;AAUA;AACA;AACA;;AAGA,MAAMG,mBAAmB,GAAG,IAAAC,sBAAa,EAAC,CAAC;AAE5B,SAASC,YAAYA,CAAE;EAAEC,GAAG;EAAEC,eAAe;EAAEC;AAAS,CAAC,EAAG;EAC1E,MAAM,CAAEC,kBAAkB,EAAEC,qBAAqB,CAAE,GAAG,IAAAC,iBAAQ,EAAE;IAC/DC,OAAO,EAAE;EACV,CAAE,CAAC;EAEH,MAAMC,WAAW,GAAG,IAAAC,o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BAAkB,EAAEI,WAAW,CAClC,CAAC;EAED,oBACC,IAAAX,WAAA,CAAAkC,GAAA,EAACjC,mBAAmB,CAACkC,QAAQ;IAACC,KAAK,EAAGJ,OAAS;IAAA1B,QAAA,EAC5CA;EAAQ,CACmB,CAAC;AAEjC;AAEO,MAAM+B,eAAe,GAAGA,CAAA,KAAM,IAAAC,mBAAU,EAAErC,mBAAoB,CAAC;AAACsC,OAAA,CAAAF,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _react = require("react");
9
8
  var _clsx = _interopRequireDefault(require("clsx"));
10
9
  var _components = require("@wordpress/components");
11
10
  var _blockEditor = require("@wordpress/block-editor");
@@ -15,6 +14,7 @@ var _i18n = require("@wordpress/i18n");
15
14
  var _icons = require("@wordpress/icons");
16
15
  var _inserter = _interopRequireDefault(require("../inserter"));
17
16
  var _moreMenu = _interopRequireDefault(require("../more-menu"));
17
+ var _jsxRuntime = require("react/jsx-runtime");
18
18
  /**
19
19
  * External dependencies
20
20
  */
@@ -41,49 +41,53 @@ function Header({
41
41
  setUndoRedo([sidebar.hasUndo(), sidebar.hasRedo()]);
42
42
  });
43
43
  }, [sidebar]);
44
- return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
45
- className: (0, _clsx.default)('customize-widgets-header', {
46
- 'is-fixed-toolbar-active': isFixedToolbarActive
47
- })
48
- }, (0, _react.createElement)(_blockEditor.NavigableToolbar, {
49
- className: "customize-widgets-header-toolbar",
50
- "aria-label": (0, _i18n.__)('Document tools')
51
- }, (0, _react.createElement)(_components.ToolbarButton, {
52
- icon: !(0, _i18n.isRTL)() ? _icons.undo : _icons.redo
53
- /* translators: button label text should, if possible, be under 16 characters. */,
54
- label: (0, _i18n.__)('Undo'),
55
- shortcut: _keycodes.displayShortcut.primary('z')
56
- // If there are no undo levels we don't want to actually disable this
57
- // button, because it will remove focus for keyboard users.
58
- // See: https://github.com/WordPress/gutenberg/issues/3486
59
- ,
60
- "aria-disabled": !hasUndo,
61
- onClick: sidebar.undo,
62
- className: "customize-widgets-editor-history-button undo-button"
63
- }), (0, _react.createElement)(_components.ToolbarButton, {
64
- icon: !(0, _i18n.isRTL)() ? _icons.redo : _icons.undo
65
- /* translators: button label text should, if possible, be under 16 characters. */,
66
- label: (0, _i18n.__)('Redo'),
67
- shortcut: shortcut
68
- // If there are no undo levels we don't want to actually disable this
69
- // button, because it will remove focus for keyboard users.
70
- // See: https://github.com/WordPress/gutenberg/issues/3486
71
- ,
72
- "aria-disabled": !hasRedo,
73
- onClick: sidebar.redo,
74
- className: "customize-widgets-editor-history-button redo-button"
75
- }), (0, _react.createElement)(_components.ToolbarButton, {
76
- className: "customize-widgets-header-toolbar__inserter-toggle",
77
- isPressed: isInserterOpened,
78
- variant: "primary",
79
- icon: _icons.plus,
80
- label: (0, _i18n._x)('Add block', 'Generic label for block inserter button'),
81
- onClick: () => {
82
- setIsInserterOpened(isOpen => !isOpen);
83
- }
84
- }), (0, _react.createElement)(_moreMenu.default, null))), (0, _element.createPortal)((0, _react.createElement)(_inserter.default, {
85
- setIsOpened: setIsInserterOpened
86
- }), inserter.contentContainer[0]));
44
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
45
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
46
+ className: (0, _clsx.default)('customize-widgets-header', {
47
+ 'is-fixed-toolbar-active': isFixedToolbarActive
48
+ }),
49
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_blockEditor.NavigableToolbar, {
50
+ className: "customize-widgets-header-toolbar",
51
+ "aria-label": (0, _i18n.__)('Document tools'),
52
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarButton, {
53
+ icon: !(0, _i18n.isRTL)() ? _icons.undo : _icons.redo
54
+ /* translators: button label text should, if possible, be under 16 characters. */,
55
+ label: (0, _i18n.__)('Undo'),
56
+ shortcut: _keycodes.displayShortcut.primary('z')
57
+ // If there are no undo levels we don't want to actually disable this
58
+ // button, because it will remove focus for keyboard users.
59
+ // See: https://github.com/WordPress/gutenberg/issues/3486
60
+ ,
61
+ "aria-disabled": !hasUndo,
62
+ onClick: sidebar.undo,
63
+ className: "customize-widgets-editor-history-button undo-button"
64
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarButton, {
65
+ icon: !(0, _i18n.isRTL)() ? _icons.redo : _icons.undo
66
+ /* translators: button label text should, if possible, be under 16 characters. */,
67
+ label: (0, _i18n.__)('Redo'),
68
+ shortcut: shortcut
69
+ // If there are no undo levels we don't want to actually disable this
70
+ // button, because it will remove focus for keyboard users.
71
+ // See: https://github.com/WordPress/gutenberg/issues/3486
72
+ ,
73
+ "aria-disabled": !hasRedo,
74
+ onClick: sidebar.redo,
75
+ className: "customize-widgets-editor-history-button redo-button"
76
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarButton, {
77
+ className: "customize-widgets-header-toolbar__inserter-toggle",
78
+ isPressed: isInserterOpened,
79
+ variant: "primary",
80
+ icon: _icons.plus,
81
+ label: (0, _i18n._x)('Add block', 'Generic label for block inserter button'),
82
+ onClick: () => {
83
+ setIsInserterOpened(isOpen => !isOpen);
84
+ }
85
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_moreMenu.default, {})]
86
+ })
87
+ }), (0, _element.createPortal)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_inserter.default, {
88
+ setIsOpened: setIsInserterOpened
89
+ }), inserter.contentContainer[0])]
90
+ });
87
91
  }
88
92
  var _default = exports.default = Header;
89
93
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_blockEditor","_element","_keycodes","_i18n","_icons","_inserter","_moreMenu","Header","sidebar","inserter","isInserterOpened","setIsInserterOpened","isFixedToolbarActive","hasUndo","hasRedo","setUndoRedo","useState","shortcut","isAppleOS","displayShortcut","primaryShift","primary","useEffect","subscribeHistory","_react","createElement","Fragment","className","clsx","NavigableToolbar","__","ToolbarButton","icon","isRTL","undoIcon","redoIcon","label","onClick","undo","redo","isPressed","variant","plus","_x","isOpen","default","createPortal","setIsOpened","contentContainer","_default","exports"],"sources":["@wordpress/customize-widgets/src/components/header/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { NavigableToolbar } from '@wordpress/block-editor';\nimport { createPortal, useEffect, useState } from '@wordpress/element';\nimport { displayShortcut, isAppleOS } from '@wordpress/keycodes';\nimport { __, _x, isRTL } from '@wordpress/i18n';\nimport { plus, undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport MoreMenu from '../more-menu';\n\nfunction Header( {\n\tsidebar,\n\tinserter,\n\tisInserterOpened,\n\tsetIsInserterOpened,\n\tisFixedToolbarActive,\n} ) {\n\tconst [ [ hasUndo, hasRedo ], setUndoRedo ] = useState( [\n\t\tsidebar.hasUndo(),\n\t\tsidebar.hasRedo(),\n\t] );\n\n\tconst shortcut = isAppleOS()\n\t\t? displayShortcut.primaryShift( 'z' )\n\t\t: displayShortcut.primary( 'y' );\n\n\tuseEffect( () => {\n\t\treturn sidebar.subscribeHistory( () => {\n\t\t\tsetUndoRedo( [ sidebar.hasUndo(), sidebar.hasRedo() ] );\n\t\t} );\n\t}, [ sidebar ] );\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tclassName={ clsx( 'customize-widgets-header', {\n\t\t\t\t\t'is-fixed-toolbar-active': isFixedToolbarActive,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<NavigableToolbar\n\t\t\t\t\tclassName=\"customize-widgets-header-toolbar\"\n\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'Undo' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\t\t\t\taria-disabled={ ! hasUndo }\n\t\t\t\t\t\tonClick={ sidebar.undo }\n\t\t\t\t\t\tclassName=\"customize-widgets-editor-history-button undo-button\"\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ ! isRTL() ? redoIcon : undoIcon }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'Redo' ) }\n\t\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\t\t\t\taria-disabled={ ! hasRedo }\n\t\t\t\t\t\tonClick={ sidebar.redo }\n\t\t\t\t\t\tclassName=\"customize-widgets-editor-history-button redo-button\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tclassName=\"customize-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t'Add block',\n\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsInserterOpened( ( isOpen ) => ! isOpen );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<MoreMenu />\n\t\t\t\t</NavigableToolbar>\n\t\t\t</div>\n\n\t\t\t{ createPortal(\n\t\t\t\t<Inserter setIsOpened={ setIsInserterOpened } />,\n\t\t\t\tinserter.contentContainer[ 0 ]\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Header;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAKA,IAAAO,SAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,SAAA,GAAAT,sBAAA,CAAAC,OAAA;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;;AAIA,SAASS,MAAMA,CAAE;EAChBC,OAAO;EACPC,QAAQ;EACRC,gBAAgB;EAChBC,mBAAmB;EACnBC;AACD,CAAC,EAAG;EACH,MAAM,CAAE,CAAEC,OAAO,EAAEC,OAAO,CAAE,EAAEC,WAAW,CAAE,GAAG,IAAAC,iBAAQ,EAAE,CACvDR,OAAO,CAACK,OAAO,CAAC,CAAC,EACjBL,OAAO,CAACM,OAAO,CAAC,CAAC,CAChB,CAAC;EAEH,MAAMG,QAAQ,GAAG,IAAAC,mBAAS,EAAC,CAAC,GACzBC,yBAAe,CAACC,YAAY,CAAE,GAAI,CAAC,GACnCD,yBAAe,CAACE,OAAO,CAAE,GAAI,CAAC;EAEjC,IAAAC,kBAAS,EAAE,MAAM;IAChB,OAAOd,OAAO,CAACe,gBAAgB,CAAE,MAAM;MACtCR,WAAW,CAAE,CAAEP,OAAO,CAACK,OAAO,CAAC,CAAC,EAAEL,OAAO,CAACM,OAAO,CAAC,CAAC,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AAkB;IAC9B+B,OAAO,EAAC,SAAS;IACjBT,IAAI,EAAGU,WAAM;IACbN,KAAK,EAAG,IAAAO,QAAE,EACT,WAAW,EACX,yCACD,CAAG;IACHN,OAAO,EAAGA,CAAA,KAAM;MACf1B,mBAAmB,CAAIiC,MAAM,IAAM,CAAEA,MAAO,CAAC;IAC9C;EAAG,CACH,CAAC,EACF,IAAApB,MAAA,CAAAC,aAAA,EAACnB,SAAA,CAAAuC,OAAQ,MAAE,CACM,CACd,CAAC,EAEJ,IAAAC,qBAAY,EACb,IAAAtB,MAAA,CAAAC,aAAA,EAACpB,SAAA,CAAAwC,OAAQ;IAACE,WAAW,EAAGpC;EAAqB,CAAE,CAAC,EAChDF,QAAQ,CAACuC,gBAAgB,CAAE,CAAC,CAC7B,CACC,CAAC;AAEL;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAL,OAAA,GAEctC,MAAM","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_blockEditor","_element","_keycodes","_i18n","_icons","_inserter","_moreMenu","_jsxRuntime","Header","sidebar","inserter","isInserterOpened","setIsInserterOpened","isFixedToolbarActive","hasUndo","hasRedo","setUndoRedo","useState","shortcut","isAppleOS","displayShortcut","primaryShift","primary","useEffect","subscribeHistory","jsxs","Fragment","children","jsx","className","clsx","NavigableToolbar","__","ToolbarButton","icon","isRTL","undoIcon","redoIcon","label","onClick","undo","redo","isPressed","variant","plus","_x","isOpen","default","createPortal","setIsOpened","contentContainer","_default","exports"],"sources":["@wordpress/customize-widgets/src/components/header/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { NavigableToolbar } from '@wordpress/block-editor';\nimport { createPortal, useEffect, useState } from '@wordpress/element';\nimport { displayShortcut, isAppleOS } from '@wordpress/keycodes';\nimport { __, _x, isRTL } from '@wordpress/i18n';\nimport { plus, undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport MoreMenu from '../more-menu';\n\nfunction Header( {\n\tsidebar,\n\tinserter,\n\tisInserterOpened,\n\tsetIsInserterOpened,\n\tisFixedToolbarActive,\n} ) {\n\tconst [ [ hasUndo, hasRedo ], setUndoRedo ] = useState( [\n\t\tsidebar.hasUndo(),\n\t\tsidebar.hasRedo(),\n\t] );\n\n\tconst shortcut = isAppleOS()\n\t\t? displayShortcut.primaryShift( 'z' )\n\t\t: displayShortcut.primary( 'y' );\n\n\tuseEffect( () => {\n\t\treturn sidebar.subscribeHistory( () => {\n\t\t\tsetUndoRedo( [ sidebar.hasUndo(), sidebar.hasRedo() ] );\n\t\t} );\n\t}, [ sidebar ] );\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tclassName={ clsx( 'customize-widgets-header', {\n\t\t\t\t\t'is-fixed-toolbar-active': isFixedToolbarActive,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<NavigableToolbar\n\t\t\t\t\tclassName=\"customize-widgets-header-toolbar\"\n\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'Undo' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\t\t\t\taria-disabled={ ! hasUndo }\n\t\t\t\t\t\tonClick={ sidebar.undo }\n\t\t\t\t\t\tclassName=\"customize-widgets-editor-history-button undo-button\"\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ ! isRTL() ? redoIcon : undoIcon }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'Redo' ) }\n\t\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\t\t\t\taria-disabled={ ! hasRedo }\n\t\t\t\t\t\tonClick={ sidebar.redo }\n\t\t\t\t\t\tclassName=\"customize-widgets-editor-history-button redo-button\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tclassName=\"customize-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t'Add block',\n\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsInserterOpened( ( isOpen ) => ! isOpen );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<MoreMenu />\n\t\t\t\t</NavigableToolbar>\n\t\t\t</div>\n\n\t\t\t{ createPortal(\n\t\t\t\t<Inserter setIsOpened={ setIsInserterOpened } />,\n\t\t\t\tinserter.contentContainer[ 0 ]\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Header;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAKA,IA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AAA0C,OAAQ;MAACE,WAAW,EAAGrC;IAAqB,CAAE,CAAC,EAChDF,QAAQ,CAACwC,gBAAgB,CAAE,CAAC,CAC7B,CAAC;EAAA,CACA,CAAC;AAEL;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAL,OAAA,GAEcvC,MAAM","ignoreList":[]}
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _react = require("react");
8
7
  var _i18n = require("@wordpress/i18n");
9
8
  var _blockEditor = require("@wordpress/block-editor");
10
9
  var _components = require("@wordpress/components");
@@ -12,6 +11,7 @@ var _compose = require("@wordpress/compose");
12
11
  var _data = require("@wordpress/data");
13
12
  var _icons = require("@wordpress/icons");
14
13
  var _store = require("../../store");
14
+ var _jsxRuntime = require("react/jsx-runtime");
15
15
  /**
16
16
  * WordPress dependencies
17
17
  */
@@ -25,27 +25,31 @@ function Inserter({
25
25
  }) {
26
26
  const inserterTitleId = (0, _compose.useInstanceId)(Inserter, 'customize-widget-layout__inserter-panel-title');
27
27
  const insertionPoint = (0, _data.useSelect)(select => select(_store.store).__experimentalGetInsertionPoint(), []);
28
- return (0, _react.createElement)("div", {
28
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
29
29
  className: "customize-widgets-layout__inserter-panel",
30
- "aria-labelledby": inserterTitleId
31
- }, (0, _react.createElement)("div", {
32
- className: "customize-widgets-layout__inserter-panel-header"
33
- }, (0, _react.createElement)("h2", {
34
- id: inserterTitleId,
35
- className: "customize-widgets-layout__inserter-panel-header-title"
36
- }, (0, _i18n.__)('Add a block')), (0, _react.createElement)(_components.Button, {
37
- className: "customize-widgets-layout__inserter-panel-header-close-button",
38
- icon: _icons.closeSmall,
39
- onClick: () => setIsOpened(false),
40
- "aria-label": (0, _i18n.__)('Close inserter')
41
- })), (0, _react.createElement)("div", {
42
- className: "customize-widgets-layout__inserter-panel-content"
43
- }, (0, _react.createElement)(_blockEditor.__experimentalLibrary, {
44
- rootClientId: insertionPoint.rootClientId,
45
- __experimentalInsertionIndex: insertionPoint.insertionIndex,
46
- showInserterHelpPanel: true,
47
- onSelect: () => setIsOpened(false)
48
- })));
30
+ "aria-labelledby": inserterTitleId,
31
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
32
+ className: "customize-widgets-layout__inserter-panel-header",
33
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
34
+ id: inserterTitleId,
35
+ className: "customize-widgets-layout__inserter-panel-header-title",
36
+ children: (0, _i18n.__)('Add a block')
37
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
38
+ className: "customize-widgets-layout__inserter-panel-header-close-button",
39
+ icon: _icons.closeSmall,
40
+ onClick: () => setIsOpened(false),
41
+ "aria-label": (0, _i18n.__)('Close inserter')
42
+ })]
43
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
44
+ className: "customize-widgets-layout__inserter-panel-content",
45
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.__experimentalLibrary, {
46
+ rootClientId: insertionPoint.rootClientId,
47
+ __experimentalInsertionIndex: insertionPoint.insertionIndex,
48
+ showInserterHelpPanel: true,
49
+ onSelect: () => setIsOpened(false)
50
+ })
51
+ })]
52
+ });
49
53
  }
50
54
  var _default = exports.default = Inserter;
51
55
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_blockEditor","_components","_compose","_data","_icons","_store","Inserter","setIsOpened","inserterTitleId","useInstanceId","insertionPoint","useSelect","select","customizeWidgetsStore","__experimentalGetInsertionPoint","_react","createElement","className","id","__","Button","icon","closeSmall","onClick","__experimentalLibrary","rootClientId","__experimentalInsertionIndex","insertionIndex","showInserterHelpPanel","onSelect","_default","exports","default"],"sources":["@wordpress/customize-widgets/src/components/inserter/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as customizeWidgetsStore } from '../../store';\n\nfunction Inserter( { setIsOpened } ) {\n\tconst inserterTitleId = useInstanceId(\n\t\tInserter,\n\t\t'customize-widget-layout__inserter-panel-title'\n\t);\n\tconst insertionPoint = useSelect(\n\t\t( select ) =>\n\t\t\tselect( customizeWidgetsStore ).__experimentalGetInsertionPoint(),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"customize-widgets-layout__inserter-panel\"\n\t\t\taria-labelledby={ inserterTitleId }\n\t\t>\n\t\t\t<div className=\"customize-widgets-layout__inserter-panel-header\">\n\t\t\t\t<h2\n\t\t\t\t\tid={ inserterTitleId }\n\t\t\t\t\tclassName=\"customize-widgets-layout__inserter-panel-header-title\"\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Add a block' ) }\n\t\t\t\t</h2>\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"customize-widgets-layout__inserter-panel-header-close-button\"\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tonClick={ () => setIsOpened( false ) }\n\t\t\t\t\taria-label={ __( 'Close inserter' ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div className=\"customize-widgets-layout__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\trootClientId={ insertionPoint.rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\tinsertionPoint.insertionIndex\n\t\t\t\t\t}\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tonSelect={ () => setIsOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default Inserter;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GA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M;EAAG,CACvC,CACG,CACD,CAAC;AAER;AAAC,IAAAuB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc1B,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_blockEditor","_components","_compose","_data","_icons","_store","_jsxRuntime","Inserter","setIsOpened","inserterTitleId","useInstanceId","insertionPoint","useSelect","select","customizeWidgetsStore","__experimentalGetInsertionPoint","jsxs","className","children","jsx","id","__","Button","icon","closeSmall","onClick","__experimentalLibrary","rootClientId","__experimentalInsertionIndex","insertionIndex","showInserterHelpPanel","onSelect","_default","exports","default"],"sources":["@wordpress/customize-widgets/src/components/inserter/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as customizeWidgetsStore } from '../../store';\n\nfunction Inserter( { setIsOpened } ) {\n\tconst inserterTitleId = useInstanceId(\n\t\tInserter,\n\t\t'customize-widget-layout__inserter-panel-title'\n\t);\n\tconst insertionPoint = useSelect(\n\t\t( select ) =>\n\t\t\tselect( customizeWidgetsStore ).__experimentalGetInsertionPoint(),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"customize-widgets-layout__inserter-panel\"\n\t\t\taria-labelledby={ inserterTitleId }\n\t\t>\n\t\t\t<div className=\"customize-widgets-layout__inserter-panel-header\">\n\t\t\t\t<h2\n\t\t\t\t\tid={ inserterTitleId }\n\t\t\t\t\tclassName=\"customize-widgets-layout__inserter-panel-header-title\"\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Add a block' ) }\n\t\t\t\t</h2>\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"customize-widgets-layout__inserter-panel-header-close-button\"\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tonClick={ () => setIsOpened( false ) }\n\t\t\t\t\taria-label={ __( 'Close inserter' ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div className=\"customize-widgets-layout__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\trootClientId={ insertionPoint.rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\tinsertionPoint.insertionIndex\n\t\t\t\t\t}\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tonSelect={ () => setIsOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default Inserter;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AAA6D,IAAAO,WAAA,GAAAP,OAAA;AAb7D;AACA;AACA;;AAQA;AACA;AACA;;AAGA,SAASQ,QAAQA,CAAE;EAAEC;AAAY,CAAC,EAAG;EACpC,MAAMC,eAAe,GAAG,IAAAC,sBAAa,EACpCH,QAAQ,EACR,+CACD,CAAC;EACD,MAAMI,cAAc,GAAG,IAAAC,eAAS,EAC7BC,MAAM,IACPA,MAAM,CAAEC,YAAsB,CAAC,CAACC,+BAA+B,CAAC,CAAC,EAClE,EACD,CAAC;EAED,oBACC,IAAAT,WAAA,CAAAU,IAAA;IACCC,SAAS,EAAC,0CAA0C;IACpD,mBAAkBR,eAAiB;IAAAS,QAAA,gBAEnC,IAAAZ,WAAA,CAAAU,IAAA;MAAKC,SAAS,EAAC,iDAAiD;MAAAC,QAAA,gBAC/D,IAAAZ,WAAA,CAAAa,GAAA;QACCC,EAAE,EAAGX,eAAiB;QACtBQ,SAAS,EAAC,uDAAuD;QAAAC,QAAA,EAE/D,IAAAG,QAAE,EAAE,aAAc;MAAC,CAClB,CAAC,eACL,IAAAf,WAAA,CAAAa,GAAA,EAAClB,WAAA,CAAAqB,MAAM;QACNL,SAAS,EAAC,8DAA8D;QACxEM,IAAI,EAAGC,iBAAY;QACnBC,OAAO,EAAGA,CAAA,KAAMjB,WAAW,CAAE,KAAM,CAAG;QACtC,cAAa,IAAAa,QAAE,EAAE,gBAAiB;MAAG,CACrC,CAAC;IAAA,CACE,CAAC,eACN,IAAAf,WAAA,CAAAa,GAAA;MAAKF,SAAS,EAAC,kDAAkD;MAAAC,QAAA,eAChE,IAAAZ,WAAA,CAAAa,GAAA,EAACnB,YAAA,CAAA0B,qBAAO;QACPC,YAAY,EAAGhB,cAAc,CAACgB,YAAc;QAC5CC,4BAA4B,EAC3BjB,cAAc,CAACkB,cACf;QACDC,qBAAqB;QACrBC,QAAQ,EAAGA,CAAA,KAAMvB,WAAW,CAAE,KAAM;MAAG,CACvC;IAAC,CACE,CAAC;EAAA,CACF,CAAC;AAER;AAAC,IAAAwB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc3B,QAAQ","ignoreList":[]}
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _react = require("react");
9
8
  var _data = require("@wordpress/data");
10
9
  var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
11
10
  var _shortcut = _interopRequireDefault(require("./shortcut"));
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
12
  /**
13
13
  * WordPress dependencies
14
14
  */
@@ -39,7 +39,7 @@ function DynamicShortcut({
39
39
  if (!keyCombination) {
40
40
  return null;
41
41
  }
42
- return (0, _react.createElement)(_shortcut.default, {
42
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_shortcut.default, {
43
43
  keyCombination: keyCombination,
44
44
  description: description,
45
45
  aliases: aliases