@wordpress/edit-site 4.1.0 → 4.3.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 (170) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-template/new-template-part.js +2 -9
  3. package/build/components/add-new-template/new-template-part.js.map +1 -1
  4. package/build/components/add-new-template/new-template.js +28 -12
  5. package/build/components/add-new-template/new-template.js.map +1 -1
  6. package/build/components/block-editor/index.js +53 -4
  7. package/build/components/block-editor/index.js.map +1 -1
  8. package/build/components/editor/index.js +9 -3
  9. package/build/components/editor/index.js.map +1 -1
  10. package/build/components/global-styles/border-panel.js +25 -24
  11. package/build/components/global-styles/border-panel.js.map +1 -1
  12. package/build/components/global-styles/color-indicator-wrapper.js +37 -0
  13. package/build/components/global-styles/color-indicator-wrapper.js.map +1 -0
  14. package/build/components/global-styles/dimensions-panel.js +6 -2
  15. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  16. package/build/components/global-styles/header.js +1 -4
  17. package/build/components/global-styles/header.js.map +1 -1
  18. package/build/components/global-styles/icon-with-current-color.js +34 -0
  19. package/build/components/global-styles/icon-with-current-color.js.map +1 -0
  20. package/build/components/global-styles/navigation-button.js +7 -3
  21. package/build/components/global-styles/navigation-button.js.map +1 -1
  22. package/build/components/global-styles/palette.js +8 -5
  23. package/build/components/global-styles/palette.js.map +1 -1
  24. package/build/components/global-styles/preview.js +142 -26
  25. package/build/components/global-styles/preview.js.map +1 -1
  26. package/build/components/global-styles/screen-block-list.js +2 -2
  27. package/build/components/global-styles/screen-block-list.js.map +1 -1
  28. package/build/components/global-styles/screen-colors.js +11 -3
  29. package/build/components/global-styles/screen-colors.js.map +1 -1
  30. package/build/components/global-styles/screen-root.js +7 -5
  31. package/build/components/global-styles/screen-root.js.map +1 -1
  32. package/build/components/global-styles/screen-style-variations.js +12 -5
  33. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  34. package/build/components/header/document-actions/index.js +13 -11
  35. package/build/components/header/document-actions/index.js.map +1 -1
  36. package/build/components/header/index.js +5 -3
  37. package/build/components/header/index.js.map +1 -1
  38. package/build/components/header/more-menu/index.js +9 -1
  39. package/build/components/header/more-menu/index.js.map +1 -1
  40. package/build/components/header/more-menu/site-export.js +5 -2
  41. package/build/components/header/more-menu/site-export.js.map +1 -1
  42. package/build/components/header/plugin-more-menu-item/index.js +5 -0
  43. package/build/components/header/plugin-more-menu-item/index.js.map +1 -1
  44. package/build/components/list/actions/rename-menu-item.js +3 -10
  45. package/build/components/list/actions/rename-menu-item.js.map +1 -1
  46. package/build/components/preferences-modal/enable-feature.js +40 -0
  47. package/build/components/preferences-modal/enable-feature.js.map +1 -0
  48. package/build/components/preferences-modal/index.js +68 -0
  49. package/build/components/preferences-modal/index.js.map +1 -0
  50. package/build/components/sidebar/index.js +12 -1
  51. package/build/components/sidebar/index.js.map +1 -1
  52. package/build/components/sidebar/navigation-menu-sidebar/index.js +40 -0
  53. package/build/components/sidebar/navigation-menu-sidebar/index.js.map +1 -0
  54. package/build/components/sidebar/navigation-menu-sidebar/navigation-inspector.js +185 -0
  55. package/build/components/sidebar/navigation-menu-sidebar/navigation-inspector.js.map +1 -0
  56. package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js +54 -0
  57. package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +1 -0
  58. package/build/components/template-part-converter/convert-to-regular.js +6 -0
  59. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  60. package/build/index.js +1 -0
  61. package/build/index.js.map +1 -1
  62. package/build/store/actions.js +3 -3
  63. package/build/store/actions.js.map +1 -1
  64. package/build/store/selectors.js +3 -1
  65. package/build/store/selectors.js.map +1 -1
  66. package/build-module/components/add-new-template/new-template-part.js +3 -10
  67. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  68. package/build-module/components/add-new-template/new-template.js +27 -12
  69. package/build-module/components/add-new-template/new-template.js.map +1 -1
  70. package/build-module/components/block-editor/index.js +51 -6
  71. package/build-module/components/block-editor/index.js.map +1 -1
  72. package/build-module/components/editor/index.js +8 -3
  73. package/build-module/components/editor/index.js.map +1 -1
  74. package/build-module/components/global-styles/border-panel.js +27 -26
  75. package/build-module/components/global-styles/border-panel.js.map +1 -1
  76. package/build-module/components/global-styles/color-indicator-wrapper.js +25 -0
  77. package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -0
  78. package/build-module/components/global-styles/dimensions-panel.js +6 -2
  79. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  80. package/build-module/components/global-styles/header.js +2 -5
  81. package/build-module/components/global-styles/header.js.map +1 -1
  82. package/build-module/components/global-styles/icon-with-current-color.js +22 -0
  83. package/build-module/components/global-styles/icon-with-current-color.js.map +1 -0
  84. package/build-module/components/global-styles/navigation-button.js +7 -3
  85. package/build-module/components/global-styles/navigation-button.js.map +1 -1
  86. package/build-module/components/global-styles/palette.js +8 -6
  87. package/build-module/components/global-styles/palette.js.map +1 -1
  88. package/build-module/components/global-styles/preview.js +141 -27
  89. package/build-module/components/global-styles/preview.js.map +1 -1
  90. package/build-module/components/global-styles/screen-block-list.js +2 -2
  91. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  92. package/build-module/components/global-styles/screen-colors.js +10 -3
  93. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  94. package/build-module/components/global-styles/screen-root.js +8 -7
  95. package/build-module/components/global-styles/screen-root.js.map +1 -1
  96. package/build-module/components/global-styles/screen-style-variations.js +13 -6
  97. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  98. package/build-module/components/header/document-actions/index.js +13 -11
  99. package/build-module/components/header/document-actions/index.js.map +1 -1
  100. package/build-module/components/header/index.js +5 -3
  101. package/build-module/components/header/index.js.map +1 -1
  102. package/build-module/components/header/more-menu/index.js +8 -1
  103. package/build-module/components/header/more-menu/index.js.map +1 -1
  104. package/build-module/components/header/more-menu/site-export.js +5 -2
  105. package/build-module/components/header/more-menu/site-export.js.map +1 -1
  106. package/build-module/components/header/plugin-more-menu-item/index.js +4 -0
  107. package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -1
  108. package/build-module/components/list/actions/rename-menu-item.js +4 -11
  109. package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
  110. package/build-module/components/preferences-modal/enable-feature.js +27 -0
  111. package/build-module/components/preferences-modal/enable-feature.js.map +1 -0
  112. package/build-module/components/preferences-modal/index.js +57 -0
  113. package/build-module/components/preferences-modal/index.js.map +1 -0
  114. package/build-module/components/sidebar/index.js +11 -1
  115. package/build-module/components/sidebar/index.js.map +1 -1
  116. package/build-module/components/sidebar/navigation-menu-sidebar/index.js +26 -0
  117. package/build-module/components/sidebar/navigation-menu-sidebar/index.js.map +1 -0
  118. package/build-module/components/sidebar/navigation-menu-sidebar/navigation-inspector.js +168 -0
  119. package/build-module/components/sidebar/navigation-menu-sidebar/navigation-inspector.js.map +1 -0
  120. package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js +45 -0
  121. package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +1 -0
  122. package/build-module/components/template-part-converter/convert-to-regular.js +6 -0
  123. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  124. package/build-module/index.js +1 -0
  125. package/build-module/index.js.map +1 -1
  126. package/build-module/store/actions.js +3 -3
  127. package/build-module/store/actions.js.map +1 -1
  128. package/build-module/store/selectors.js +3 -1
  129. package/build-module/store/selectors.js.map +1 -1
  130. package/build-style/style-rtl.css +86 -5
  131. package/build-style/style.css +86 -5
  132. package/package.json +29 -29
  133. package/src/components/add-new-template/new-template-part.js +3 -12
  134. package/src/components/add-new-template/new-template.js +49 -12
  135. package/src/components/block-editor/index.js +79 -9
  136. package/src/components/editor/index.js +13 -0
  137. package/src/components/global-styles/border-panel.js +32 -26
  138. package/src/components/global-styles/color-indicator-wrapper.js +23 -0
  139. package/src/components/global-styles/dimensions-panel.js +7 -2
  140. package/src/components/global-styles/header.js +2 -7
  141. package/src/components/global-styles/icon-with-current-color.js +21 -0
  142. package/src/components/global-styles/navigation-button.js +6 -4
  143. package/src/components/global-styles/palette.js +8 -11
  144. package/src/components/global-styles/preview.js +186 -29
  145. package/src/components/global-styles/screen-block-list.js +1 -3
  146. package/src/components/global-styles/screen-colors.js +7 -6
  147. package/src/components/global-styles/screen-root.js +15 -17
  148. package/src/components/global-styles/screen-style-variations.js +13 -4
  149. package/src/components/global-styles/style.scss +18 -6
  150. package/src/components/header/document-actions/index.js +14 -10
  151. package/src/components/header/index.js +6 -1
  152. package/src/components/header/more-menu/index.js +15 -0
  153. package/src/components/header/more-menu/site-export.js +13 -2
  154. package/src/components/header/plugin-more-menu-item/index.js +2 -0
  155. package/src/components/header/style.scss +45 -0
  156. package/src/components/list/actions/rename-menu-item.js +3 -13
  157. package/src/components/preferences-modal/enable-feature.js +24 -0
  158. package/src/components/preferences-modal/index.js +76 -0
  159. package/src/components/sidebar/index.js +12 -0
  160. package/src/components/sidebar/navigation-menu-sidebar/index.js +34 -0
  161. package/src/components/sidebar/navigation-menu-sidebar/navigation-inspector.js +224 -0
  162. package/src/components/sidebar/navigation-menu-sidebar/navigation-menu.js +62 -0
  163. package/src/components/sidebar/navigation-menu-sidebar/style.scss +42 -0
  164. package/src/components/sidebar/style.scss +1 -1
  165. package/src/components/template-part-converter/convert-to-regular.js +9 -0
  166. package/src/index.js +1 -0
  167. package/src/store/actions.js +4 -4
  168. package/src/store/selectors.js +10 -0
  169. package/src/store/test/selectors.js +4 -0
  170. package/src/style.scss +1 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 4.3.0 (2022-04-08)
6
+
7
+ ## 4.2.0 (2022-03-23)
8
+
5
9
  ## 4.1.0 (2022-03-11)
6
10
 
7
11
  ## 4.0.0 (2022-02-10)
@@ -48,9 +48,6 @@ function NewTemplatePart(_ref) {
48
48
  const {
49
49
  saveEntityRecord
50
50
  } = (0, _data.useDispatch)(_coreData.store);
51
- const {
52
- getLastEntitySaveError
53
- } = (0, _data.useSelect)(_coreData.store);
54
51
 
55
52
  async function createTemplatePart(_ref2) {
56
53
  let {
@@ -74,13 +71,9 @@ function NewTemplatePart(_ref) {
74
71
  title,
75
72
  content: '',
76
73
  area
74
+ }, {
75
+ throwOnError: true
77
76
  });
78
- const lastEntitySaveError = getLastEntitySaveError('postType', 'wp_template_part', templatePart.id);
79
-
80
- if (lastEntitySaveError) {
81
- throw lastEntitySaveError;
82
- }
83
-
84
77
  setIsModalOpen(false); // Navigate to the created template part editor.
85
78
 
86
79
  history.push({
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template-part.js"],"names":["NewTemplatePart","postType","history","isModalOpen","setIsModalOpen","createErrorNotice","noticesStore","saveEntityRecord","coreStore","getLastEntitySaveError","createTemplatePart","title","area","type","cleanSlug","replace","templatePart","slug","content","lastEntitySaveError","id","push","postId","error","errorMessage","message","code","labels","add_new"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AAIe,SAASA,eAAT,OAAyC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACvD,QAAMC,OAAO,GAAG,yBAAhB;AACA,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkC,uBAAU,KAAV,CAAxC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAwB,uBAAaC,cAAb,CAA9B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAuB,uBAAaC,eAAb,CAA7B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAA6B,qBAAWD,eAAX,CAAnC;;AAEA,iBAAeE,kBAAf,QAAqD;AAAA,QAAlB;AAAEC,MAAAA,KAAF;AAASC,MAAAA;AAAT,KAAkB;;AACpD,QAAK,CAAED,KAAP,EAAe;AACdN,MAAAA,iBAAiB,CAAE,cAAI,uBAAJ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nB,CADD,EASGzB,WAAW,IACZ,4BAAC,gCAAD;AACC,IAAA,UAAU,EAAG,MAAMC,cAAc,CAAE,KAAF,CADlC;AAEC,IAAA,QAAQ,EAAGM;AAFZ,IAVF,CADD;AAkBA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useHistory } from '../routes';\nimport CreateTemplatePartModal from '../create-template-part-modal';\n\nexport default function NewTemplatePart( { postType } ) {\n\tconst history = useHistory();\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { getLastEntitySaveError } = useSelect( coreStore );\n\n\tasync function createTemplatePart( { title, area } ) {\n\t\tif ( ! title ) {\n\t\t\tcreateErrorNotice( __( 'Title is not defined.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\t// Currently template parts only allow latin chars.\n\t\t\t// Fallback slug will receive suffix by default.\n\t\t\tconst cleanSlug =\n\t\t\t\tkebabCase( title ).replace( /[^\\w-]+/g, '' ) ||\n\t\t\t\t'wp-custom-part';\n\n\t\t\tconst templatePart = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t{\n\t\t\t\t\tslug: cleanSlug,\n\t\t\t\t\ttitle,\n\t\t\t\t\tcontent: '',\n\t\t\t\t\tarea,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst lastEntitySaveError = getLastEntitySaveError(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\ttemplatePart.id\n\t\t\t);\n\t\t\tif ( lastEntitySaveError ) {\n\t\t\t\tthrow lastEntitySaveError;\n\t\t\t}\n\n\t\t\tsetIsModalOpen( false );\n\n\t\t\t// Navigate to the created template part editor.\n\t\t\thistory.push( {\n\t\t\t\tpostId: templatePart.id,\n\t\t\t\tpostType: templatePart.type,\n\t\t\t} );\n\n\t\t\t// TODO: Add a success notice?\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'An error occurred while creating the template part.'\n\t\t\t\t\t );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\n\t\t\tsetIsModalOpen( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ postType.labels.add_new }\n\t\t\t</Button>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => setIsModalOpen( false ) }\n\t\t\t\t\tonCreate={ createTemplatePart }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template-part.js"],"names":["NewTemplatePart","postType","history","isModalOpen","setIsModalOpen","createErrorNotice","noticesStore","saveEntityRecord","coreStore","createTemplatePart","title","area","type","cleanSlug","replace","templatePart","slug","content","throwOnError","push","postId","id","error","errorMessage","message","code","labels","add_new"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AAIe,SAASA,eAAT,OAAyC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;A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;AAAEX,QAAAA,IAAI,EAAE;AAAR,OAAhB,CAAjB;AAEAR,MAAAA,cAAc,CAAE,KAAF,CAAd;AACA;AACD;;AAED,SACC,qDACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,OAAO,EAAG,MAAM;AACfA,MAAAA,cAAc,CAAE,IAAF,CAAd;AACA;AAJF,KAMGH,QAAQ,CAACyB,MAAT,CAAgBC,OANnB,CADD,EASGxB,WAAW,IACZ,4BAAC,gCAAD;AACC,IAAA,UAAU,EAAG,MAAMC,cAAc,CAAE,KAAF,CADlC;AAEC,IAAA,QAAQ,EAAGK;AAFZ,IAVF,CADD;AAkBA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useHistory } from '../routes';\nimport CreateTemplatePartModal from '../create-template-part-modal';\n\nexport default function NewTemplatePart( { postType } ) {\n\tconst history = useHistory();\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tasync function createTemplatePart( { title, area } ) {\n\t\tif ( ! title ) {\n\t\t\tcreateErrorNotice( __( 'Title is not defined.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\t// Currently template parts only allow latin chars.\n\t\t\t// Fallback slug will receive suffix by default.\n\t\t\tconst cleanSlug =\n\t\t\t\tkebabCase( title ).replace( /[^\\w-]+/g, '' ) ||\n\t\t\t\t'wp-custom-part';\n\n\t\t\tconst templatePart = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t{\n\t\t\t\t\tslug: cleanSlug,\n\t\t\t\t\ttitle,\n\t\t\t\t\tcontent: '',\n\t\t\t\t\tarea,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tsetIsModalOpen( false );\n\n\t\t\t// Navigate to the created template part editor.\n\t\t\thistory.push( {\n\t\t\t\tpostId: templatePart.id,\n\t\t\t\tpostType: templatePart.type,\n\t\t\t} );\n\n\t\t\t// TODO: Add a success notice?\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'An error occurred while creating the template part.'\n\t\t\t\t\t );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\n\t\t\tsetIsModalOpen( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ postType.labels.add_new }\n\t\t\t</Button>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => setIsModalOpen( false ) }\n\t\t\t\t\tonCreate={ createTemplatePart }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
@@ -17,6 +17,8 @@ var _coreData = require("@wordpress/core-data");
17
17
 
18
18
  var _editor = require("@wordpress/editor");
19
19
 
20
+ var _icons = require("@wordpress/icons");
21
+
20
22
  var _i18n = require("@wordpress/i18n");
21
23
 
22
24
  var _notices = require("@wordpress/notices");
@@ -34,7 +36,22 @@ var _routes = require("../routes");
34
36
  /**
35
37
  * Internal dependencies
36
38
  */
37
- const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'single-post', 'page', 'archive', 'search', '404', 'index'];
39
+ const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'single-post', 'page', 'index', 'archive', 'author', 'category', 'date', 'tag', 'taxonomy', 'search', '404'];
40
+ const TEMPLATE_ICONS = {
41
+ 'front-page': _icons.home,
42
+ 'single-post': _icons.post,
43
+ page: _icons.page,
44
+ archive: _icons.archive,
45
+ search: _icons.search,
46
+ 404: _icons.notFound,
47
+ index: _icons.list,
48
+ category: _icons.category,
49
+ author: _icons.postAuthor,
50
+ taxonomy: _icons.blockMeta,
51
+ date: _icons.postDate,
52
+ tag: _icons.tag,
53
+ attachment: _icons.media
54
+ };
38
55
 
39
56
  function NewTemplate(_ref) {
40
57
  let {
@@ -56,9 +73,6 @@ function NewTemplate(_ref) {
56
73
  const {
57
74
  createErrorNotice
58
75
  } = (0, _data.useDispatch)(_notices.store);
59
- const {
60
- getLastEntitySaveError
61
- } = (0, _data.useSelect)(_coreData.store);
62
76
 
63
77
  async function createTemplate(_ref2) {
64
78
  let {
@@ -78,13 +92,9 @@ function NewTemplate(_ref) {
78
92
  slug: slug.toString(),
79
93
  status: 'publish',
80
94
  title
81
- });
82
- const lastEntitySaveError = getLastEntitySaveError('postType', 'wp_template', template.id);
83
-
84
- if (lastEntitySaveError) {
85
- throw lastEntitySaveError;
86
- } // Navigate to the created template editor.
87
-
95
+ }, {
96
+ throwOnError: true
97
+ }); // Navigate to the created template editor.
88
98
 
89
99
  history.push({
90
100
  postId: template.id,
@@ -103,8 +113,12 @@ function NewTemplate(_ref) {
103
113
 
104
114
  if (!missingTemplates.length) {
105
115
  return null;
106
- }
116
+ } // Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.
117
+
107
118
 
119
+ missingTemplates.sort((template1, template2) => {
120
+ return DEFAULT_TEMPLATE_SLUGS.indexOf(template1.slug) - DEFAULT_TEMPLATE_SLUGS.indexOf(template2.slug);
121
+ });
108
122
  return (0, _element.createElement)(_components.DropdownMenu, {
109
123
  className: "edit-site-new-template-dropdown",
110
124
  icon: null,
@@ -127,6 +141,8 @@ function NewTemplate(_ref) {
127
141
  slug
128
142
  } = _ref3;
129
143
  return (0, _element.createElement)(_components.MenuItem, {
144
+ icon: TEMPLATE_ICONS[slug],
145
+ iconPosition: "left",
130
146
  info: description,
131
147
  key: slug,
132
148
  onClick: () => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template.js"],"names":["DEFAULT_TEMPLATE_SLUGS","NewTemplate","postType","history","templates","defaultTemplateTypes","select","coreStore","getEntityRecords","per_page","editorStore","__experimentalGetDefaultTemplateTypes","saveEntityRecord","createErrorNotice","noticesStore","getLastEntitySaveError","createTemplate","slug","title","description","template","excerpt","toString","status","lastEntitySaveError","id","push","postId","type","error","errorMessage","message","code","existingTemplateSlugs","missingTemplates","length","labels","add_new","add_new_item","noArrow","variant"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AAGA,MAAMA,sBAAsB,GAAG,CAC9B,YAD8B,EAE9B,aAF8B,EAG9B,MAH8B,EAI9B,SAJ8B,EAK9B,QAL8B,EAM9B,KAN8B,EAO9B,OAP8B,CAA/B;;AAUe,SAASC,WAAT,OAAqC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACnD,QAAMC,OAAO,GAAG,yBAAhB;AACA,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,MAAsC,qBACzCC,MAAF,KAAgB;AACfF,IAAAA,SAAS,EAAEE,MAAM,CAAEC,eAAF,CAAN,CAAoBC,gBAApB,CACV,UADU,EAEV,aAFU,EAGV;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KAHU,CADI;AAMfJ,IAAAA,oBAAoB,EAAEC,MAAM,CAC3BI,aAD2B,CAAN,CAEpBC,qCAFoB;AANP,GAAhB,CAD2C,EAW3C,EAX2C,CAA5C;AAaA,QAAM;AAAEC,IAAAA;A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EAAgB,MAAhB,CAA9B;AAEA,QAAM8B,gBAAgB,GAAG,oBACxB7B,oBADwB,EAEtBe,QAAF,IACC,sBAAUpB,sBAAV,EAAkCoB,QAAQ,CAACH,IAA3C,KACA,CAAE,sBAAUgB,qBAAV,EAAiCb,QAAQ,CAACH,IAA1C,CAJqB,CAAzB;;AAOA,MAAK,CAAEiB,gBAAgB,CAACC,MAAxB,EAAiC;AAChC,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,wBAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,IAAI,EAAG,IAFR;AAGC,IAAA,IAAI,EAAGjC,QAAQ,CAACkC,MAAT,CAAgBC,OAHxB;AAIC,IAAA,KAAK,EAAGnC,QAAQ,CAACkC,MAAT,CAAgBE,YAJzB;AAKC,IAAA,YAAY,EAAG;AACdC,MAAAA,OAAO,EAAE;AADK,KALhB;AAQC,IAAA,WAAW,EAAG;AACbC,MAAAA,OAAO,EAAE;AADI;AARf,KAYG,MACD,4BAAC,yBAAD;AAAe,IAAA,SAAS,EAAC;AAAzB,KACC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAGtC,QAAQ,CAACkC,MAAT,CAAgBE;AAAnC,KACG,iBACDJ,gBADC,EAED;AAAA,QAAE;AAAEhB,MAAAA,KAAF;AAASC,MAAAA,WAAT;AAAsBF,MAAAA;AAAtB,KAAF;AAAA,WACC,4BAAC,oBAAD;AACC,MAAA,IAAI,EAAGE,WADR;AAEC,MAAA,GAAG,EAAGF,IAFP;AAGC,MAAA,OAAO,EAAG,MAAM;AACfD,QAAAA,cAAc,CAAE;AAAEC,UAAAA;AAAF,SAAF,CAAd,CADe,CAEf;AACA;AANF,OAQGC,KARH,CADD;AAAA,GAFC,CADH,CADD,CAbF,CADD;AAoCA","sourcesContent":["/**\n * External dependencies\n */\nimport { filter, find, includes, map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tNavigableMenu,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useHistory } from '../routes';\n\nconst DEFAULT_TEMPLATE_SLUGS = [\n\t'front-page',\n\t'single-post',\n\t'page',\n\t'archive',\n\t'search',\n\t'404',\n\t'index',\n];\n\nexport default function NewTemplate( { postType } ) {\n\tconst history = useHistory();\n\tconst { templates, defaultTemplateTypes } = useSelect(\n\t\t( select ) => ( {\n\t\t\ttemplates: select( coreStore ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{ per_page: -1 }\n\t\t\t),\n\t\t\tdefaultTemplateTypes: select(\n\t\t\t\teditorStore\n\t\t\t).__experimentalGetDefaultTemplateTypes(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { getLastEntitySaveError } = useSelect( coreStore );\n\n\tasync function createTemplate( { slug } ) {\n\t\ttry {\n\t\t\tconst { title, description } = find( defaultTemplateTypes, {\n\t\t\t\tslug,\n\t\t\t} );\n\n\t\t\tconst template = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{\n\t\t\t\t\texcerpt: description,\n\t\t\t\t\t// Slugs need to be strings, so this is for template `404`\n\t\t\t\t\tslug: slug.toString(),\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\ttitle,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst lastEntitySaveError = getLastEntitySaveError(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\ttemplate.id\n\t\t\t);\n\t\t\tif ( lastEntitySaveError ) {\n\t\t\t\tthrow lastEntitySaveError;\n\t\t\t}\n\n\t\t\t// Navigate to the created template editor.\n\t\t\thistory.push( {\n\t\t\t\tpostId: template.id,\n\t\t\t\tpostType: template.type,\n\t\t\t} );\n\n\t\t\t// TODO: Add a success notice?\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the template.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t}\n\n\tconst existingTemplateSlugs = map( templates, 'slug' );\n\n\tconst missingTemplates = filter(\n\t\tdefaultTemplateTypes,\n\t\t( template ) =>\n\t\t\tincludes( DEFAULT_TEMPLATE_SLUGS, template.slug ) &&\n\t\t\t! includes( existingTemplateSlugs, template.slug )\n\t);\n\n\tif ( ! missingTemplates.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName=\"edit-site-new-template-dropdown\"\n\t\t\ticon={ null }\n\t\t\ttext={ postType.labels.add_new }\n\t\t\tlabel={ postType.labels.add_new_item }\n\t\t\tpopoverProps={ {\n\t\t\t\tnoArrow: false,\n\t\t\t} }\n\t\t\ttoggleProps={ {\n\t\t\t\tvariant: 'primary',\n\t\t\t} }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<NavigableMenu className=\"edit-site-new-template-dropdown__popover\">\n\t\t\t\t\t<MenuGroup label={ postType.labels.add_new_item }>\n\t\t\t\t\t\t{ map(\n\t\t\t\t\t\t\tmissingTemplates,\n\t\t\t\t\t\t\t( { title, description, slug } ) => (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tinfo={ description }\n\t\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tcreateTemplate( { slug } );\n\t\t\t\t\t\t\t\t\t\t// We will be navigated way so no need to close the dropdown.\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</NavigableMenu>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template.js"],"names":["DEFAULT_TEMPLATE_SLUGS","TEMPLATE_ICONS","home","post","page","archive","search","notFound","index","list","category","author","postAuthor","taxonomy","blockMeta","date","postDate","tag","attachment","media","NewTemplate","postType","history","templates","defaultTemplateTypes","select","coreStore","getEntityRecords","per_page","editorStore","__experimentalGetDefaultTemplateTypes","saveEntityRecord","createErrorNotice","noticesStore","createTemplate","slug","title","description","template","excerpt","toString","status","throwOnError","push","postId","id","type","error","errorMessage","message","code","existingTemplateSlugs","missingTemplates","length","sort","template1","template2","indexOf","labels","add_new","add_new_item","noArrow","variant"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAMA;;AACA;;AACA;;AACA;;AAeA;;AACA;;AAKA;;AAtCA;AACA;AACA;;AAGA;AACA;AACA;;AA4BA;AACA;AACA;AAGA,MAAMA,sBAAsB,GAAG,CAC9B,YAD8B,EAE9B,aAF8B,EAG9B,MAH8B,EAI9B,OAJ8B,EAK9B,SAL8B,EAM9B,QAN8B,EAO9B,UAP8B,EAQ9B,MAR8B,EAS9B,KAT8B,EAU9B,UAV8B,EAW9B,QAX8B,EAY9B,KAZ8B,CAA/B;AAeA,MAAMC,cAAc,GAAG;AACtB,gBAAcC,WADQ;AAEtB,iBAAeC,WAFO;AAGtBC,EAAAA,IAAI,EAAJA,WAHsB;AAItBC,EAAAA,OAAO,EAAPA,cAJsB;AAKtBC,EAAAA,MAAM,EAANA,aALsB;AAMtB,OAAKC,eANiB;AAOtBC,EAAAA,KAAK,EAAEC,WAPe;AAQtBC,EAAAA,QAAQ,EAARA,eARsB;AAStB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MAAAA,OAAO,EAAE;AADK,KALhB;AAQC,IAAA,WAAW,EAAG;AACbC,MAAAA,OAAO,EAAE;AADI;AARf,KAYG,MACD,4BAAC,yBAAD;AAAe,IAAA,SAAS,EAAC;AAAzB,KACC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAGzC,QAAQ,CAACqC,MAAT,CAAgBE;AAAnC,KACG,iBACDR,gBADC,EAED;AAAA,QAAE;AAAEhB,MAAAA,KAAF;AAASC,MAAAA,WAAT;AAAsBF,MAAAA;AAAtB,KAAF;AAAA,WACC,4BAAC,oBAAD;AACC,MAAA,IAAI,EAAGlC,cAAc,CAAEkC,IAAF,CADtB;AAEC,MAAA,YAAY,EAAC,MAFd;AAGC,MAAA,IAAI,EAAGE,WAHR;AAIC,MAAA,GAAG,EAAGF,IAJP;AAKC,MAAA,OAAO,EAAG,MAAM;AACfD,QAAAA,cAAc,CAAE;AAAEC,UAAAA;AAAF,SAAF,CAAd,CADe,CAEf;AACA;AARF,OAUGC,KAVH,CADD;AAAA,GAFC,CADH,CADD,CAbF,CADD;AAsCA","sourcesContent":["/**\n * External dependencies\n */\nimport { filter, find, includes, map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tNavigableMenu,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport {\n\tarchive,\n\tblockMeta,\n\tcategory,\n\thome,\n\tlist,\n\tmedia,\n\tnotFound,\n\tpage,\n\tpost,\n\tpostAuthor,\n\tpostDate,\n\tsearch,\n\ttag,\n} from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useHistory } from '../routes';\n\nconst DEFAULT_TEMPLATE_SLUGS = [\n\t'front-page',\n\t'single-post',\n\t'page',\n\t'index',\n\t'archive',\n\t'author',\n\t'category',\n\t'date',\n\t'tag',\n\t'taxonomy',\n\t'search',\n\t'404',\n];\n\nconst TEMPLATE_ICONS = {\n\t'front-page': home,\n\t'single-post': post,\n\tpage,\n\tarchive,\n\tsearch,\n\t404: notFound,\n\tindex: list,\n\tcategory,\n\tauthor: postAuthor,\n\ttaxonomy: blockMeta,\n\tdate: postDate,\n\ttag,\n\tattachment: media,\n};\n\nexport default function NewTemplate( { postType } ) {\n\tconst history = useHistory();\n\tconst { templates, defaultTemplateTypes } = useSelect(\n\t\t( select ) => ( {\n\t\t\ttemplates: select( coreStore ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{ per_page: -1 }\n\t\t\t),\n\t\t\tdefaultTemplateTypes: select(\n\t\t\t\teditorStore\n\t\t\t).__experimentalGetDefaultTemplateTypes(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tasync function createTemplate( { slug } ) {\n\t\ttry {\n\t\t\tconst { title, description } = find( defaultTemplateTypes, {\n\t\t\t\tslug,\n\t\t\t} );\n\n\t\t\tconst template = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{\n\t\t\t\t\texcerpt: description,\n\t\t\t\t\t// Slugs need to be strings, so this is for template `404`\n\t\t\t\t\tslug: slug.toString(),\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\ttitle,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// Navigate to the created template editor.\n\t\t\thistory.push( {\n\t\t\t\tpostId: template.id,\n\t\t\t\tpostType: template.type,\n\t\t\t} );\n\n\t\t\t// TODO: Add a success notice?\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the template.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t}\n\n\tconst existingTemplateSlugs = map( templates, 'slug' );\n\n\tconst missingTemplates = filter(\n\t\tdefaultTemplateTypes,\n\t\t( template ) =>\n\t\t\tincludes( DEFAULT_TEMPLATE_SLUGS, template.slug ) &&\n\t\t\t! includes( existingTemplateSlugs, template.slug )\n\t);\n\n\tif ( ! missingTemplates.length ) {\n\t\treturn null;\n\t}\n\n\t// Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.\n\tmissingTemplates.sort( ( template1, template2 ) => {\n\t\treturn (\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template1.slug ) -\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template2.slug )\n\t\t);\n\t} );\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName=\"edit-site-new-template-dropdown\"\n\t\t\ticon={ null }\n\t\t\ttext={ postType.labels.add_new }\n\t\t\tlabel={ postType.labels.add_new_item }\n\t\t\tpopoverProps={ {\n\t\t\t\tnoArrow: false,\n\t\t\t} }\n\t\t\ttoggleProps={ {\n\t\t\t\tvariant: 'primary',\n\t\t\t} }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<NavigableMenu className=\"edit-site-new-template-dropdown__popover\">\n\t\t\t\t\t<MenuGroup label={ postType.labels.add_new_item }>\n\t\t\t\t\t\t{ map(\n\t\t\t\t\t\t\tmissingTemplates,\n\t\t\t\t\t\t\t( { title, description, slug } ) => (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\ticon={ TEMPLATE_ICONS[ slug ] }\n\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\tinfo={ description }\n\t\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tcreateTemplate( { slug } );\n\t\t\t\t\t\t\t\t\t\t// We will be navigated way so no need to close the dropdown.\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</NavigableMenu>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"]}
@@ -23,6 +23,14 @@ var _compose = require("@wordpress/compose");
23
23
 
24
24
  var _reusableBlocks = require("@wordpress/reusable-blocks");
25
25
 
26
+ var _icons = require("@wordpress/icons");
27
+
28
+ var _components = require("@wordpress/components");
29
+
30
+ var _i18n = require("@wordpress/i18n");
31
+
32
+ var _interface = require("@wordpress/interface");
33
+
26
34
  var _templatePartConverter = _interopRequireDefault(require("../template-part-converter"));
27
35
 
28
36
  var _navigateToLink = _interopRequireDefault(require("../navigate-to-link"));
@@ -61,19 +69,37 @@ function BlockEditor(_ref) {
61
69
  setIsInserterOpen
62
70
  } = _ref;
63
71
  const {
64
- settings,
72
+ settings
73
+ } = (0, _data.useSelect)(select => {
74
+ let storedSettings = select(_store.store).getSettings(setIsInserterOpen);
75
+
76
+ if (!storedSettings.__experimentalBlockPatterns) {
77
+ storedSettings = { ...storedSettings,
78
+ __experimentalBlockPatterns: select(_coreData.store).getBlockPatterns()
79
+ };
80
+ }
81
+
82
+ if (!storedSettings.__experimentalBlockPatternCategories) {
83
+ storedSettings = { ...storedSettings,
84
+ __experimentalBlockPatternCategories: select(_coreData.store).getBlockPatternCategories()
85
+ };
86
+ }
87
+
88
+ return {
89
+ settings: storedSettings
90
+ };
91
+ }, [setIsInserterOpen]);
92
+ const {
65
93
  templateType,
66
94
  templateId,
67
95
  page
68
96
  } = (0, _data.useSelect)(select => {
69
97
  const {
70
- getSettings,
71
98
  getEditedPostType,
72
99
  getEditedPostId,
73
100
  getPage
74
101
  } = select(_store.store);
75
102
  return {
76
- settings: getSettings(setIsInserterOpen),
77
103
  templateType: getEditedPostType(),
78
104
  templateId: getEditedPostId(),
79
105
  page: getPage()
@@ -83,6 +109,12 @@ function BlockEditor(_ref) {
83
109
  const {
84
110
  setPage
85
111
  } = (0, _data.useDispatch)(_store.store);
112
+ const {
113
+ enableComplementaryArea
114
+ } = (0, _data.useDispatch)(_interface.store);
115
+ const openNavigationSidebar = (0, _element.useCallback)(() => {
116
+ enableComplementaryArea('core/edit-site', 'edit-site/navigation-menu');
117
+ }, [enableComplementaryArea]);
86
118
  const contentRef = (0, _element.useRef)();
87
119
  const mergedRefs = (0, _compose.useMergeRefs)([contentRef, (0, _blockEditor.__unstableUseTypingObserver)()]);
88
120
  const isMobileViewport = (0, _compose.useViewportMatch)('small', '<');
@@ -90,6 +122,23 @@ function BlockEditor(_ref) {
90
122
  clearSelectedBlock
91
123
  } = (0, _data.useDispatch)(_blockEditor.store);
92
124
  const isTemplatePart = templateType === 'wp_template_part';
125
+
126
+ const NavMenuSidebarToggle = () => (0, _element.createElement)(_components.ToolbarGroup, null, (0, _element.createElement)(_components.ToolbarButton, {
127
+ className: "components-toolbar__control",
128
+ label: (0, _i18n.__)('Open list view'),
129
+ onClick: openNavigationSidebar,
130
+ icon: _icons.listView
131
+ })); // Conditionally include NavMenu sidebar in Plugin only.
132
+ // Optimise for dead code elimination.
133
+ // See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.
134
+
135
+
136
+ let MaybeNavMenuSidebarToggle = 'Fragment';
137
+
138
+ if (process.env.IS_GUTENBERG_PLUGIN) {
139
+ MaybeNavMenuSidebarToggle = NavMenuSidebarToggle;
140
+ }
141
+
93
142
  return (0, _element.createElement)(_blockEditor.BlockEditorProvider, {
94
143
  settings: settings,
95
144
  value: blocks,
@@ -128,6 +177,6 @@ function BlockEditor(_ref) {
128
177
  return (0, _element.createElement)(_blockInspectorButton.default, {
129
178
  onClick: onClose
130
179
  });
131
- })), (0, _element.createElement)(_reusableBlocks.ReusableBlocksMenuItems, null));
180
+ }), (0, _element.createElement)(_blockEditor.__unstableBlockToolbarLastItem, null, (0, _element.createElement)(_blockEditor.__unstableBlockNameContext.Consumer, null, blockName => blockName === 'core/navigation' && (0, _element.createElement)(MaybeNavMenuSidebarToggle, null)))), (0, _element.createElement)(_reusableBlocks.ReusableBlocksMenuItems, null));
132
181
  }
133
182
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["LAYOUT","type","alignments","BlockEditor","setIsInserterOpen","settings","templateType","templateId","page","select","getSettings","getEditedPostType","getEditedPostId","getPage","editSiteStore","blocks","onInput","onChange","setPage","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","blockEditorStore","isTemplatePart","fillProps","event","target","currentTarget","undefined","onClose"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAKA;;AAEA;;AACA;;AAWA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAnCA;AACA;AACA;;AAGA;AACA;AACA;;AAkBA;AACA;AACA;AAUA,MAAMA,MAAM,GAAG;AACdC,EAAAA,IAAI,EAAE,SADQ;AAEd;AACAC,EAAAA,UAAU,EAAE;AAHE,CAAf;;AAMe,SAASC,WAAT,OAA8C;AAAA,MAAxB;AAAEC,IAAAA;AAAF,GAAwB;AAC5D,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,YAAZ;AAA0BC,IAAAA,UAA1B;AAAsCC,IAAAA;AAAtC,MAA+C,qBAClDC,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,WADK;AAELC,MAAAA,iBAFK;AAGLC,MAAAA,eAHK;AAILC,MAAAA;AAJK,QAKFJ,MAAM,CAAEK,YAAF,CALV;AAOA,WAAO;AACNT,MAAAA,QAAQ,EAAEK,WAAW,CAAEN,iBAAF,CADf;AAENE,MAAAA,YAAY,EAAEK,iBAAiB,EAFzB;AAGNJ,MAAAA,UAAU,EA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,KAAiBD,KAAK,CAACE,aAA5B,EAA4C;AAC3CN,QAAAA,kBAAkB;AAClB;AACD;AAVF,KAYC,4BAAC,yCAAD,CAA8B,QAA9B,OAZD,EAaC,4BAAC,mBAAD,OAbD,EAcC,4BAAC,wBAAD,CACC;AADD;AAEC,IAAA,GAAG,EAAGf,UAFP;AAGC,IAAA,cAAc,EACbiB,cAAc,IACd;AACA,KAAEH,gBANJ;AAQC,IAAA,QAAQ,EAAGhB,QARZ;AASC,IAAA,UAAU,EAAGe;AATd,KAWC,4BAAC,sBAAD;AACC,IAAA,SAAS,EAAC,mDADX;AAEC,IAAA,oBAAoB,EAAGpB,MAFxB;AAGC,IAAA,cAAc,EAAGwB,cAAc,GAAG,KAAH,GAAWK;AAH3C,IAXD,CAdD,EA+BC,4BAAC,iDAAD,QACG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,4BAAC,6BAAD;AAAsB,MAAA,OAAO,EAAGA;AAAhC,MADC;AAAA,GADH,CA/BD,CAxBD,EA6DC,4BAAC,uCAAD,OA7DD,CADD;AAiEA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockEditorProvider,\n\t__experimentalLinkControl,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tBlockEditorKeyboardShortcuts,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useMergeRefs, useViewportMatch } from '@wordpress/compose';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartConverter from '../template-part-converter';\nimport NavigateToLink from '../navigate-to-link';\nimport { SidebarInspectorFill } from '../sidebar';\nimport { store as editSiteStore } from '../../store';\nimport BlockInspectorButton from './block-inspector-button';\nimport EditTemplatePartMenuButton from '../edit-template-part-menu-button';\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\n\nconst LAYOUT = {\n\ttype: 'default',\n\t// At the root level of the site editor, no alignments should be allowed.\n\talignments: [],\n};\n\nexport default function BlockEditor( { setIsInserterOpen } ) {\n\tconst { settings, templateType, templateId, page } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetSettings,\n\t\t\t\tgetEditedPostType,\n\t\t\t\tgetEditedPostId,\n\t\t\t\tgetPage,\n\t\t\t} = select( editSiteStore );\n\n\t\t\treturn {\n\t\t\t\tsettings: getSettings( setIsInserterOpen ),\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\ttemplateId: getEditedPostId(),\n\t\t\t\tpage: getPage(),\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpen ]\n\t);\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\tconst { setPage } = useDispatch( editSiteStore );\n\tconst contentRef = useRef();\n\tconst mergedRefs = useMergeRefs( [ contentRef, useTypingObserver() ] );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tconst isTemplatePart = templateType === 'wp_template_part';\n\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t<EditTemplatePartMenuButton />\n\t\t\t<TemplatePartConverter />\n\t\t\t<__experimentalLinkControl.ViewerFill>\n\t\t\t\t{ useCallback(\n\t\t\t\t\t( fillProps ) => (\n\t\t\t\t\t\t<NavigateToLink\n\t\t\t\t\t\t\t{ ...fillProps }\n\t\t\t\t\t\t\tactivePage={ page }\n\t\t\t\t\t\t\tonActivePageChange={ setPage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\t[ page ]\n\t\t\t\t) }\n\t\t\t</__experimentalLinkControl.ViewerFill>\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\t\t\t<BlockTools\n\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t'is-focus-mode': isTemplatePart,\n\t\t\t\t} ) }\n\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t\t<BackButton />\n\t\t\t\t<ResizableEditor\n\t\t\t\t\t// Reinitialize the editor and reset the states when the template changes.\n\t\t\t\t\tkey={ templateId }\n\t\t\t\t\tenableResizing={\n\t\t\t\t\t\tisTemplatePart &&\n\t\t\t\t\t\t// Disable resizing in mobile viewport.\n\t\t\t\t\t\t! isMobileViewport\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tcontentRef={ mergedRefs }\n\t\t\t\t>\n\t\t\t\t\t<BlockList\n\t\t\t\t\t\tclassName=\"edit-site-block-editor__block-list wp-site-blocks\"\n\t\t\t\t\t\t__experimentalLayout={ LAYOUT }\n\t\t\t\t\t\trenderAppender={ isTemplatePart ? false : undefined }\n\t\t\t\t\t/>\n\t\t\t\t</ResizableEditor>\n\t\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t\t</BlockTools>\n\t\t\t<ReusableBlocksMenuItems />\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/index.js"],"names":["LAYOUT","type","alignments","BlockEditor","setIsInserterOpen","settings","select","storedSettings","editSiteStore","getSettings","__experimentalBlockPatterns","coreStore","getBlockPatterns","__experimentalBlockPatternCategories","getBlockPatternCategories","templateType","templateId","page","getEditedPostType","getEditedPostId","getPage","blocks","onInput","onChange","setPage","enableComplementaryArea","interfaceStore","openNavigationSidebar","contentRef","mergedRefs","isMobileViewport","clearSelectedBlock","blockEditorStore","isTemplatePart","NavMenuSidebarToggle","listView","MaybeNavMenuSidebarToggle","process","env","IS_GUTENBERG_PLUGIN","fillProps","event","target","currentTarget","undefined","onClose","blockName"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAKA;;AAEA;;AACA;;AAaA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAzCA;AACA;AACA;;AAGA;AACA;AACA;;AAwBA;AACA;AACA;AAUA,MAAMA,MAAM,GAAG;AACdC,EAAAA,IAAI,EAAE,SADQ;AAEd;AACAC,EAAAA,UAAU,EAAE;AAHE,CAAf;;AAMe,SAASC,WAAT,OAA8C;AAAA,MAAxB;AAAEC,IAAAA;AAAF,GAAwB;AAC5D,QAAM;AAAEC,IAAAA;AAAF,MAAe,qBAClBC,MAAF,IAAc;AACb,QAAIC,cAAc,GAAGD,MAAM,CAAEE,YAAF,CAAN,CAAwBC,WAAxB,CACpBL,iBADoB,CAArB;;AAIA,QAAK,CAAEG,cAAc,CAACG,2BAAtB,EAAoD;AACnDH,MAAAA,cAAc,GAAG,EAChB,GAAGA,cADa;AAEhBG,QAAAA,2BAA2B,EAAEJ,MAAM,CAClCK,eADkC,CAAN,CAE3BC,gBAF2B;AAFb,OAAjB;AAMA;;AAED,QAAK,CAAEL,cAAc,CAACM,oCAAtB,EAA6D;AAC5DN,MAAAA,cAAc,GAAG,EAChB,GAAGA,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,OAbD,EAcC,4BAAC,wBAAD,CACC;AADD;AAEC,IAAA,GAAG,EAAGf,UAFP;AAGC,IAAA,cAAc,EACbiB,cAAc,IACd;AACA,KAAEH,gBANJ;AAQC,IAAA,QAAQ,EAAGzB,QARZ;AASC,IAAA,UAAU,EAAGwB;AATd,KAWC,4BAAC,sBAAD;AACC,IAAA,SAAS,EAAC,mDADX;AAEC,IAAA,oBAAoB,EAAG7B,MAFxB;AAGC,IAAA,cAAc,EAAGiC,cAAc,GAAG,KAAH,GAAWW;AAH3C,IAXD,CAdD,EA+BC,4BAAC,iDAAD,QACG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,4BAAC,6BAAD;AAAsB,MAAA,OAAO,EAAGA;AAAhC,MADC;AAAA,GADH,CA/BD,EAoCC,4BAAC,2CAAD,QACC,4BAAC,uCAAD,CAA4B,QAA5B,QACKC,SAAF,IACDA,SAAS,KAAK,iBAAd,IACC,4BAAC,yBAAD,OAHH,CADD,CApCD,CAxBD,EAsEC,4BAAC,uCAAD,OAtED,CADD;AA0EA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';\nimport {\n\tBlockList,\n\tBlockEditorProvider,\n\t__experimentalLinkControl,\n\tBlockInspector,\n\tBlockTools,\n\t__unstableBlockToolbarLastItem,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tBlockEditorKeyboardShortcuts,\n\tstore as blockEditorStore,\n\t__unstableBlockNameContext,\n} from '@wordpress/block-editor';\nimport { useMergeRefs, useViewportMatch } from '@wordpress/compose';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\nimport { listView } from '@wordpress/icons';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartConverter from '../template-part-converter';\nimport NavigateToLink from '../navigate-to-link';\nimport { SidebarInspectorFill } from '../sidebar';\nimport { store as editSiteStore } from '../../store';\nimport BlockInspectorButton from './block-inspector-button';\nimport EditTemplatePartMenuButton from '../edit-template-part-menu-button';\nimport BackButton from './back-button';\nimport ResizableEditor from './resizable-editor';\n\nconst LAYOUT = {\n\ttype: 'default',\n\t// At the root level of the site editor, no alignments should be allowed.\n\talignments: [],\n};\n\nexport default function BlockEditor( { setIsInserterOpen } ) {\n\tconst { settings } = useSelect(\n\t\t( select ) => {\n\t\t\tlet storedSettings = select( editSiteStore ).getSettings(\n\t\t\t\tsetIsInserterOpen\n\t\t\t);\n\n\t\t\tif ( ! storedSettings.__experimentalBlockPatterns ) {\n\t\t\t\tstoredSettings = {\n\t\t\t\t\t...storedSettings,\n\t\t\t\t\t__experimentalBlockPatterns: select(\n\t\t\t\t\t\tcoreStore\n\t\t\t\t\t).getBlockPatterns(),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif ( ! storedSettings.__experimentalBlockPatternCategories ) {\n\t\t\t\tstoredSettings = {\n\t\t\t\t\t...storedSettings,\n\t\t\t\t\t__experimentalBlockPatternCategories: select(\n\t\t\t\t\t\tcoreStore\n\t\t\t\t\t).getBlockPatternCategories(),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tsettings: storedSettings,\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpen ]\n\t);\n\n\tconst { templateType, templateId, page } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostType, getEditedPostId, getPage } = select(\n\t\t\t\teditSiteStore\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\ttemplateType: getEditedPostType(),\n\t\t\t\ttemplateId: getEditedPostId(),\n\t\t\t\tpage: getPage(),\n\t\t\t};\n\t\t},\n\t\t[ setIsInserterOpen ]\n\t);\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\ttemplateType\n\t);\n\tconst { setPage } = useDispatch( editSiteStore );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst openNavigationSidebar = useCallback( () => {\n\t\tenableComplementaryArea(\n\t\t\t'core/edit-site',\n\t\t\t'edit-site/navigation-menu'\n\t\t);\n\t}, [ enableComplementaryArea ] );\n\tconst contentRef = useRef();\n\tconst mergedRefs = useMergeRefs( [ contentRef, useTypingObserver() ] );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\n\tconst isTemplatePart = templateType === 'wp_template_part';\n\n\tconst NavMenuSidebarToggle = () => (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName=\"components-toolbar__control\"\n\t\t\t\tlabel={ __( 'Open list view' ) }\n\t\t\t\tonClick={ openNavigationSidebar }\n\t\t\t\ticon={ listView }\n\t\t\t/>\n\t\t</ToolbarGroup>\n\t);\n\n\t// Conditionally include NavMenu sidebar in Plugin only.\n\t// Optimise for dead code elimination.\n\t// See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.\n\tlet MaybeNavMenuSidebarToggle = 'Fragment';\n\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\tMaybeNavMenuSidebarToggle = NavMenuSidebarToggle;\n\t}\n\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ settings }\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t<EditTemplatePartMenuButton />\n\t\t\t<TemplatePartConverter />\n\t\t\t<__experimentalLinkControl.ViewerFill>\n\t\t\t\t{ useCallback(\n\t\t\t\t\t( fillProps ) => (\n\t\t\t\t\t\t<NavigateToLink\n\t\t\t\t\t\t\t{ ...fillProps }\n\t\t\t\t\t\t\tactivePage={ page }\n\t\t\t\t\t\t\tonActivePageChange={ setPage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\t[ page ]\n\t\t\t\t) }\n\t\t\t</__experimentalLinkControl.ViewerFill>\n\t\t\t<SidebarInspectorFill>\n\t\t\t\t<BlockInspector />\n\t\t\t</SidebarInspectorFill>\n\t\t\t<BlockTools\n\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t'is-focus-mode': isTemplatePart,\n\t\t\t\t} ) }\n\t\t\t\t__unstableContentRef={ contentRef }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t// Clear selected block when clicking on the gray background.\n\t\t\t\t\tif ( event.target === event.currentTarget ) {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t\t<BackButton />\n\t\t\t\t<ResizableEditor\n\t\t\t\t\t// Reinitialize the editor and reset the states when the template changes.\n\t\t\t\t\tkey={ templateId }\n\t\t\t\t\tenableResizing={\n\t\t\t\t\t\tisTemplatePart &&\n\t\t\t\t\t\t// Disable resizing in mobile viewport.\n\t\t\t\t\t\t! isMobileViewport\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tcontentRef={ mergedRefs }\n\t\t\t\t>\n\t\t\t\t\t<BlockList\n\t\t\t\t\t\tclassName=\"edit-site-block-editor__block-list wp-site-blocks\"\n\t\t\t\t\t\t__experimentalLayout={ LAYOUT }\n\t\t\t\t\t\trenderAppender={ isTemplatePart ? false : undefined }\n\t\t\t\t\t/>\n\t\t\t\t</ResizableEditor>\n\t\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t<__unstableBlockToolbarLastItem>\n\t\t\t\t\t<__unstableBlockNameContext.Consumer>\n\t\t\t\t\t\t{ ( blockName ) =>\n\t\t\t\t\t\t\tblockName === 'core/navigation' && (\n\t\t\t\t\t\t\t\t<MaybeNavMenuSidebarToggle />\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t</__unstableBlockNameContext.Consumer>\n\t\t\t\t</__unstableBlockToolbarLastItem>\n\t\t\t</BlockTools>\n\t\t\t<ReusableBlocksMenuItems />\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
@@ -25,6 +25,8 @@ var _i18n = require("@wordpress/i18n");
25
25
 
26
26
  var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
27
27
 
28
+ var _preferences = require("@wordpress/preferences");
29
+
28
30
  var _header = _interopRequireDefault(require("../header"));
29
31
 
30
32
  var _sidebar = require("../sidebar");
@@ -84,7 +86,8 @@ function Editor(_ref) {
84
86
  isNavigationOpen,
85
87
  previousShortcut,
86
88
  nextShortcut,
87
- editorMode
89
+ editorMode,
90
+ showIconLabels
88
91
  } = (0, _data.useSelect)(select => {
89
92
  const {
90
93
  isInserterOpened,
@@ -116,7 +119,8 @@ function Editor(_ref) {
116
119
  isNavigationOpen: isNavigationOpened(),
117
120
  previousShortcut: select(_keyboardShortcuts.store).getAllShortcutKeyCombinations('core/edit-site/previous-region'),
118
121
  nextShortcut: select(_keyboardShortcuts.store).getAllShortcutKeyCombinations('core/edit-site/next-region'),
119
- editorMode: getEditorMode()
122
+ editorMode: getEditorMode(),
123
+ showIconLabels: select(_preferences.store).get('core/edit-site', 'showIconLabels')
120
124
  };
121
125
  }, []);
122
126
  const {
@@ -187,13 +191,15 @@ function Editor(_ref) {
187
191
  onError: onError
188
192
  }, (0, _element.createElement)(_keyboardShortcuts2.default.Register, null), (0, _element.createElement)(_sidebar.SidebarComplementaryAreaFills, null), (0, _element.createElement)(_interface.InterfaceSkeleton, {
189
193
  labels: interfaceLabels,
194
+ className: showIconLabels && 'show-icon-labels',
190
195
  secondarySidebar: secondarySidebar(),
191
196
  sidebar: sidebarIsOpened && (0, _element.createElement)(_interface.ComplementaryArea.Slot, {
192
197
  scope: "core/edit-site"
193
198
  }),
194
199
  drawer: (0, _element.createElement)(_navigationSidebar.default.Slot, null),
195
200
  header: (0, _element.createElement)(_header.default, {
196
- openEntitiesSavedStates: openEntitiesSavedStates
201
+ openEntitiesSavedStates: openEntitiesSavedStates,
202
+ showIconLabels: showIconLabels
197
203
  }),
198
204
  notices: (0, _element.createElement)(_editor.EditorSnackbars, null),
199
205
  content: (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_editor.EditorNotices, null), editorMode === 'visual' && template && (0, _element.createElement)(_blockEditor2.default, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/editor/index.js"],"names":["interfaceLabels","secondarySidebar","drawer","Editor","onError","isInserterOpen","isListViewOpen","sidebarIsOpened","settings","entityId","templateType","page","template","templateResolved","isNavigationOpen","previousShortcut","nextShortcut","editorMode","select","isInserterOpened","isListViewOpened","getSettings","getEditedPostType","getEditedPostId","getPage","isNavigationOpened","getEditorMode","editSiteStore","hasFinishedResolution","getEntityRecord","coreStore","postType","postId","interfaceStore","getActiveComplementaryArea","name","keyboardShortcutsStore","getAllShortcutKeyCombinations","setPage","setIsInserterOpened","enableComplementaryArea","isEntitiesSavedStatesOpen","setIsEntitiesSavedStatesOpen","openEntitiesSavedStates","closeEntitiesSavedStates","blockContext","context","queryContext","newQueryContext","document","body","classList","add","remove","openGlobalStylesOnLoad","searchParams","URLSearchParams","window","location","search","get","isReady","siteUrl","undefined","previous","next"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAzCA;AACA;AACA;;A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QADC,IAEA,4BAAC,mBAAD,OAZH,EAcGC,gBAAgB,IACjB,CAAED,QADD,KAEDJ,QAFC,aAEDA,QAFC,uBAEDA,QAAQ,CAAEsD,OAFT,KAGDrD,QAHC,IAIA,4BAAC,kBAAD;AACC,MAAA,MAAM,EAAC,SADR;AAEC,MAAA,aAAa,EACZ;AAHF,OAMG,cACD,2EADC,CANH,CAlBH,EA6BC,4BAAC,2BAAD;AACC,MAAA,uBAAuB,EACtBkC;AAFF,MA7BD,CApBF;AAwDC,IAAA,OAAO,EACN,qDACGF,yBAAyB,GAC1B,4BAAC,2BAAD;AACC,MAAA,KAAK,EACJG;AAFF,MAD0B,GAO1B;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,4BAAC,kBAAD;AACC,MAAA,OAAO,EAAC,WADT;AAEC,MAAA,SAAS,EAAC,4CAFX;AAGC,MAAA,OAAO,EACND,uBAJF;AAMC,uBACC;AAPF,OAUG,cACD,iBADC,CAVH,CADD,CARF,CAzDF;AAoFC,IAAA,MAAM,EACL,4BAAC,4BAAD;AACC,MAAA,aAAa,EAAG,cACf,UADe;AADjB,MArFF;AA2FC,IAAA,SAAS,EAAG;AACXqB,MAAAA,QAAQ,EAAEjD,gBADC;AAEXkD,MAAAA,IAAI,EAAEjD;AAFK;AA3Fb,IAHD,EAmGC,4BAAC,qBAAD,OAnGD,EAoGC,4BAAC,mBAAD,CAAS,IAAT,OApGD,CAFD,CADD,CALD,CADD,CADD,CAHF,CADD;AA4HA;;eACcb,M","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState, useMemo, useCallback } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Popover, Button, Notice } from '@wordpress/components';\nimport { EntityProvider, store as coreStore } from '@wordpress/core-data';\nimport { BlockContextProvider, BlockBreadcrumb } from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tEditorNotices,\n\tEditorSnackbars,\n\tEntitiesSavedStates,\n} from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tShortcutProvider,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport Header from '../header';\nimport { SidebarComplementaryAreaFills } from '../sidebar';\nimport NavigationSidebar from '../navigation-sidebar';\nimport BlockEditor from '../block-editor';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport URLQueryController from '../url-query-controller';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport ErrorBoundary from '../error-boundary';\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from './global-styles-renderer';\nimport { GlobalStylesProvider } from '../global-styles/global-styles-provider';\nimport useTitle from '../routes/use-title';\n\nconst interfaceLabels = {\n\tsecondarySidebar: __( 'Block Library' ),\n\tdrawer: __( 'Navigation Sidebar' ),\n};\n\nfunction Editor( { onError } ) {\n\tconst {\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tsidebarIsOpened,\n\t\tsettings,\n\t\tentityId,\n\t\ttemplateType,\n\t\tpage,\n\t\ttemplate,\n\t\ttemplateResolved,\n\t\tisNavigationOpen,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t\teditorMode,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t\tgetSettings,\n\t\t\tgetEditedPostType,\n\t\t\tgetEditedPostId,\n\t\t\tgetPage,\n\t\t\tisNavigationOpened,\n\t\t\tgetEditorMode,\n\t\t} = select( editSiteStore );\n\t\tconst { hasFinishedResolution, getEntityRecord } = select( coreStore );\n\t\tconst postType = getEditedPostType();\n\t\tconst postId = getEditedPostId();\n\n\t\t// The currently selected entity to display. Typically template or template part.\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tsidebarIsOpened: !! select(\n\t\t\t\tinterfaceStore\n\t\t\t).getActiveComplementaryArea( editSiteStore.name ),\n\t\t\tsettings: getSettings(),\n\t\t\ttemplateType: postType,\n\t\t\tpage: getPage(),\n\t\t\ttemplate: postId\n\t\t\t\t? getEntityRecord( 'postType', postType, postId )\n\t\t\t\t: null,\n\t\t\ttemplateResolved: postId\n\t\t\t\t? hasFinishedResolution( 'getEntityRecord', [\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpostType,\n\t\t\t\t\t\tpostId,\n\t\t\t\t ] )\n\t\t\t\t: false,\n\t\t\tentityId: postId,\n\t\t\tisNavigationOpen: isNavigationOpened(),\n\t\t\tpreviousShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-site/previous-region' ),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-site/next-region' ),\n\t\t\teditorMode: getEditorMode(),\n\t\t};\n\t}, [] );\n\tconst { setPage, setIsInserterOpened } = useDispatch( editSiteStore );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst [\n\t\tisEntitiesSavedStatesOpen,\n\t\tsetIsEntitiesSavedStatesOpen,\n\t] = useState( false );\n\tconst openEntitiesSavedStates = useCallback(\n\t\t() => setIsEntitiesSavedStatesOpen( true ),\n\t\t[]\n\t);\n\tconst closeEntitiesSavedStates = useCallback( () => {\n\t\tsetIsEntitiesSavedStatesOpen( false );\n\t}, [] );\n\n\tconst blockContext = useMemo(\n\t\t() => ( {\n\t\t\t...page?.context,\n\t\t\tqueryContext: [\n\t\t\t\tpage?.context.queryContext || { page: 1 },\n\t\t\t\t( newQueryContext ) =>\n\t\t\t\t\tsetPage( {\n\t\t\t\t\t\t...page,\n\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\t...page?.context,\n\t\t\t\t\t\t\tqueryContext: {\n\t\t\t\t\t\t\t\t...page?.context.queryContext,\n\t\t\t\t\t\t\t\t...newQueryContext,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t} ),\n\t\t\t],\n\t\t} ),\n\t\t[ page?.context ]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( isNavigationOpen ) {\n\t\t\tdocument.body.classList.add( 'is-navigation-sidebar-open' );\n\t\t} else {\n\t\t\tdocument.body.classList.remove( 'is-navigation-sidebar-open' );\n\t\t}\n\t}, [ isNavigationOpen ] );\n\n\tuseEffect(\n\t\tfunction openGlobalStylesOnLoad() {\n\t\t\tconst searchParams = new URLSearchParams( window.location.search );\n\t\t\tif ( searchParams.get( 'styles' ) === 'open' ) {\n\t\t\t\tenableComplementaryArea(\n\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t'edit-site/global-styles'\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\t// Don't render the Editor until the settings are set and loaded.\n\tconst isReady =\n\t\tsettings?.siteUrl &&\n\t\ttemplateType !== undefined &&\n\t\tentityId !== undefined;\n\n\tconst secondarySidebar = () => {\n\t\tif ( isInserterOpen ) {\n\t\t\treturn <InserterSidebar />;\n\t\t}\n\t\tif ( isListViewOpen ) {\n\t\t\treturn <ListViewSidebar />;\n\t\t}\n\t\treturn null;\n\t};\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URlQueryController> from double-announcing.\n\tuseTitle( isReady && __( 'Editor (beta)' ) );\n\n\treturn (\n\t\t<>\n\t\t\t<URLQueryController />\n\t\t\t{ isReady && (\n\t\t\t\t<ShortcutProvider>\n\t\t\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t\t\t<EntityProvider\n\t\t\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\t\t\ttype={ templateType }\n\t\t\t\t\t\t\tid={ entityId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<GlobalStylesProvider>\n\t\t\t\t\t\t\t\t<BlockContextProvider value={ blockContext }>\n\t\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t\t<ErrorBoundary onError={ onError }>\n\t\t\t\t\t\t\t\t\t\t<KeyboardShortcuts.Register />\n\t\t\t\t\t\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\t\t\t\t\t\tlabels={ interfaceLabels }\n\t\t\t\t\t\t\t\t\t\t\tsecondarySidebar={ secondarySidebar() }\n\t\t\t\t\t\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\t\t\t\t\t\tsidebarIsOpened && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdrawer={\n\t\t\t\t\t\t\t\t\t\t\t\t<NavigationSidebar.Slot />\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\theader={\n\t\t\t\t\t\t\t\t\t\t\t\t<Header\n\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\t\t\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<EditorNotices />\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ editorMode === 'visual' &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttemplate && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<BlockEditor\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsInserterOpen={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsInserterOpened\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ editorMode === 'text' &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttemplate && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeEditor />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ templateResolved &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t! template &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsettings?.siteUrl &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tentityId && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisDismissible={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tactions={\n\t\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ isEntitiesSavedStatesOpen ? (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<EntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclose={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcloseEntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"edit-site-editor__toggle-save-panel\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-editor__toggle-save-panel-button\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-expanded={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Open save panel'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tfooter={\n\t\t\t\t\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\t\t\t\t\trootLabelText={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Template'\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tshortcuts={ {\n\t\t\t\t\t\t\t\t\t\t\t\tprevious: previousShortcut,\n\t\t\t\t\t\t\t\t\t\t\t\tnext: nextShortcut,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<WelcomeGuide />\n\t\t\t\t\t\t\t\t\t\t<Popover.Slot />\n\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t\t\t\t</GlobalStylesProvider>\n\t\t\t\t\t\t</EntityProvider>\n\t\t\t\t\t</EntityProvider>\n\t\t\t\t</ShortcutProvider>\n\t\t\t) }\n\t\t</>\n\t);\n}\nexport default Editor;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/editor/index.js"],"names":["interfaceLabels","secondarySidebar","drawer","Editor","onError","isInserterOpen","isListViewOpen","sidebarIsOpened","settings","entityId","templateType","page","template","templateResolved","isNavigationOpen","previousShortcut","nextShortcut","editorMode","showIconLabels","select","isInserterOpened","isListViewOpened","getSettings","getEditedPostType","getEditedPostId","getPage","isNavigationOpened","getEditorMode","editSiteStore","hasFinishedResolution","getEntityRecord","coreStore","postType","postId","interfaceStore","getActiveComplementaryArea","name","keyboardShortcutsStore","getAllShortcutKeyCombinations","preferencesStore","get","setPage","setIsInserterOpened","enableComplementaryArea","isEntitiesSavedStatesOpen","setIsEntitiesSavedStatesOpen","openEntitiesSavedStates","closeEntitiesSavedStates","blockContext","context","queryContext","newQueryContext","document","body","classList","add","remove","openGlobalStylesOnLoad","searchParams","URLSearchParams","window","location","search","isReady","siteUrl","undefined","previous","next"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA1CA;AACA;AACA;;AAuBA;AACA;AACA;AAiBA,MAAMA,eAAe,GAAG;AACvBC,EAAAA,gBAAgB,EAAE,cAAI,eAAJ,CADK;AAEvBC,EAAAA,MAAM,EAAE,cAAI,oBAAJ;AAFe,CAAxB;;AAKA,SAASC,MAAT,OAA+B;AAAA,MAAd;AAAEC,IAAAA;AAAF,GAAc;AAC9B,QAAM;AACLC,IAAAA,cADK;AAELC,IAAAA,cAFK;AAGLC,IAAAA,eAHK;AAILC,IAAAA,QAJK;AAKLC,IAAAA,QALK;AAMLC,IAAAA,YANK;AAOLC,IAAAA,IAPK;AAQLC,IAAAA,QARK;AASLC,IAAAA,gBATK;AAULC,IAAAA,gBAVK;AAWLC,IAAAA,gBAXK;AAYLC,IAAAA,YAZK;AAaLC,IAAAA,UAbK;AAcLC,IAAAA;AAdK,MAeF,qBAAaC,MAAF,IAAc;AAC5B,UAAM;AACLC,MAAAA,gBADK;AAELC,MAAAA,gBAFK;AAGLC,MAAAA,WAHK;AAILC,MAAAA,iBAJK;AAKLC,MAAAA,eALK;AAMLC,MAAAA,OANK;AAOLC,MAAAA,kBAPK;AAQL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EAAC,WADT;AAEC,MAAA,SAAS,EAAC,4CAFX;AAGC,MAAA,OAAO,EACND,uBAJF;AAMC,uBACC;AAPF,OAUG,cACD,iBADC,CAVH,CADD,CARF,CAhEF;AA2FC,IAAA,MAAM,EACL,4BAAC,4BAAD;AACC,MAAA,aAAa,EAAG,cACf,UADe;AADjB,MA5FF;AAkGC,IAAA,SAAS,EAAG;AACXoB,MAAAA,QAAQ,EAAEnD,gBADC;AAEXoD,MAAAA,IAAI,EAAEnD;AAFK;AAlGb,IAHD,EA0GC,4BAAC,qBAAD,OA1GD,EA2GC,4BAAC,mBAAD,CAAS,IAAT,OA3GD,CAFD,CADD,CALD,CADD,CADD,CAHF,CADD;AAmIA;;eACcb,M","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState, useMemo, useCallback } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Popover, Button, Notice } from '@wordpress/components';\nimport { EntityProvider, store as coreStore } from '@wordpress/core-data';\nimport { BlockContextProvider, BlockBreadcrumb } from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tEditorNotices,\n\tEditorSnackbars,\n\tEntitiesSavedStates,\n} from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tShortcutProvider,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Header from '../header';\nimport { SidebarComplementaryAreaFills } from '../sidebar';\nimport NavigationSidebar from '../navigation-sidebar';\nimport BlockEditor from '../block-editor';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport URLQueryController from '../url-query-controller';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport ErrorBoundary from '../error-boundary';\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from './global-styles-renderer';\nimport { GlobalStylesProvider } from '../global-styles/global-styles-provider';\nimport useTitle from '../routes/use-title';\n\nconst interfaceLabels = {\n\tsecondarySidebar: __( 'Block Library' ),\n\tdrawer: __( 'Navigation Sidebar' ),\n};\n\nfunction Editor( { onError } ) {\n\tconst {\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tsidebarIsOpened,\n\t\tsettings,\n\t\tentityId,\n\t\ttemplateType,\n\t\tpage,\n\t\ttemplate,\n\t\ttemplateResolved,\n\t\tisNavigationOpen,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t\teditorMode,\n\t\tshowIconLabels,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t\tgetSettings,\n\t\t\tgetEditedPostType,\n\t\t\tgetEditedPostId,\n\t\t\tgetPage,\n\t\t\tisNavigationOpened,\n\t\t\tgetEditorMode,\n\t\t} = select( editSiteStore );\n\t\tconst { hasFinishedResolution, getEntityRecord } = select( coreStore );\n\t\tconst postType = getEditedPostType();\n\t\tconst postId = getEditedPostId();\n\n\t\t// The currently selected entity to display. Typically template or template part.\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tsidebarIsOpened: !! select(\n\t\t\t\tinterfaceStore\n\t\t\t).getActiveComplementaryArea( editSiteStore.name ),\n\t\t\tsettings: getSettings(),\n\t\t\ttemplateType: postType,\n\t\t\tpage: getPage(),\n\t\t\ttemplate: postId\n\t\t\t\t? getEntityRecord( 'postType', postType, postId )\n\t\t\t\t: null,\n\t\t\ttemplateResolved: postId\n\t\t\t\t? hasFinishedResolution( 'getEntityRecord', [\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpostType,\n\t\t\t\t\t\tpostId,\n\t\t\t\t ] )\n\t\t\t\t: false,\n\t\t\tentityId: postId,\n\t\t\tisNavigationOpen: isNavigationOpened(),\n\t\t\tpreviousShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-site/previous-region' ),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-site/next-region' ),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { setPage, setIsInserterOpened } = useDispatch( editSiteStore );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst [\n\t\tisEntitiesSavedStatesOpen,\n\t\tsetIsEntitiesSavedStatesOpen,\n\t] = useState( false );\n\tconst openEntitiesSavedStates = useCallback(\n\t\t() => setIsEntitiesSavedStatesOpen( true ),\n\t\t[]\n\t);\n\tconst closeEntitiesSavedStates = useCallback( () => {\n\t\tsetIsEntitiesSavedStatesOpen( false );\n\t}, [] );\n\n\tconst blockContext = useMemo(\n\t\t() => ( {\n\t\t\t...page?.context,\n\t\t\tqueryContext: [\n\t\t\t\tpage?.context.queryContext || { page: 1 },\n\t\t\t\t( newQueryContext ) =>\n\t\t\t\t\tsetPage( {\n\t\t\t\t\t\t...page,\n\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\t...page?.context,\n\t\t\t\t\t\t\tqueryContext: {\n\t\t\t\t\t\t\t\t...page?.context.queryContext,\n\t\t\t\t\t\t\t\t...newQueryContext,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t} ),\n\t\t\t],\n\t\t} ),\n\t\t[ page?.context ]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( isNavigationOpen ) {\n\t\t\tdocument.body.classList.add( 'is-navigation-sidebar-open' );\n\t\t} else {\n\t\t\tdocument.body.classList.remove( 'is-navigation-sidebar-open' );\n\t\t}\n\t}, [ isNavigationOpen ] );\n\n\tuseEffect(\n\t\tfunction openGlobalStylesOnLoad() {\n\t\t\tconst searchParams = new URLSearchParams( window.location.search );\n\t\t\tif ( searchParams.get( 'styles' ) === 'open' ) {\n\t\t\t\tenableComplementaryArea(\n\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t'edit-site/global-styles'\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\t// Don't render the Editor until the settings are set and loaded.\n\tconst isReady =\n\t\tsettings?.siteUrl &&\n\t\ttemplateType !== undefined &&\n\t\tentityId !== undefined;\n\n\tconst secondarySidebar = () => {\n\t\tif ( isInserterOpen ) {\n\t\t\treturn <InserterSidebar />;\n\t\t}\n\t\tif ( isListViewOpen ) {\n\t\t\treturn <ListViewSidebar />;\n\t\t}\n\t\treturn null;\n\t};\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URlQueryController> from double-announcing.\n\tuseTitle( isReady && __( 'Editor (beta)' ) );\n\n\treturn (\n\t\t<>\n\t\t\t<URLQueryController />\n\t\t\t{ isReady && (\n\t\t\t\t<ShortcutProvider>\n\t\t\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t\t\t<EntityProvider\n\t\t\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\t\t\ttype={ templateType }\n\t\t\t\t\t\t\tid={ entityId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<GlobalStylesProvider>\n\t\t\t\t\t\t\t\t<BlockContextProvider value={ blockContext }>\n\t\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t\t<ErrorBoundary onError={ onError }>\n\t\t\t\t\t\t\t\t\t\t<KeyboardShortcuts.Register />\n\t\t\t\t\t\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\t\t\t\t\t\tlabels={ interfaceLabels }\n\t\t\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\t\t\tshowIconLabels &&\n\t\t\t\t\t\t\t\t\t\t\t\t'show-icon-labels'\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tsecondarySidebar={ secondarySidebar() }\n\t\t\t\t\t\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\t\t\t\t\t\tsidebarIsOpened && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdrawer={\n\t\t\t\t\t\t\t\t\t\t\t\t<NavigationSidebar.Slot />\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\theader={\n\t\t\t\t\t\t\t\t\t\t\t\t<Header\n\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowIconLabels={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tshowIconLabels\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\t\t\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<EditorNotices />\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ editorMode === 'visual' &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttemplate && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<BlockEditor\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsInserterOpen={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsInserterOpened\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ editorMode === 'text' &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttemplate && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<CodeEditor />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ templateResolved &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t! template &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsettings?.siteUrl &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tentityId && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisDismissible={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tactions={\n\t\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ isEntitiesSavedStatesOpen ? (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<EntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclose={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcloseEntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"edit-site-editor__toggle-save-panel\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-editor__toggle-save-panel-button\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\topenEntitiesSavedStates\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taria-expanded={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Open save panel'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tfooter={\n\t\t\t\t\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\t\t\t\t\trootLabelText={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Template'\n\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tshortcuts={ {\n\t\t\t\t\t\t\t\t\t\t\t\tprevious: previousShortcut,\n\t\t\t\t\t\t\t\t\t\t\t\tnext: nextShortcut,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<WelcomeGuide />\n\t\t\t\t\t\t\t\t\t\t<Popover.Slot />\n\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t\t\t\t</GlobalStylesProvider>\n\t\t\t\t\t\t</EntityProvider>\n\t\t\t\t\t</EntityProvider>\n\t\t\t\t</ShortcutProvider>\n\t\t\t) }\n\t\t</>\n\t);\n}\nexport default Editor;\n"]}
@@ -23,10 +23,7 @@ var _hooks = require("./hooks");
23
23
  /**
24
24
  * Internal dependencies
25
25
  */
26
- const MIN_BORDER_WIDTH = 0; // Defining empty array here instead of inline avoids unnecessary re-renders of
27
- // color control.
28
-
29
- const EMPTY_ARRAY = [];
26
+ const MIN_BORDER_WIDTH = 0;
30
27
 
31
28
  function useHasBorderPanel(name) {
32
29
  const controls = [useHasBorderColorControl(name), useHasBorderRadiusControl(name), useHasBorderStyleControl(name), useHasBorderWidthControl(name)];
@@ -77,13 +74,29 @@ function BorderPanel(_ref) {
77
74
  const [borderWidthValue, setBorderWidth] = (0, _hooks.useStyle)('border.width', name); // Border style.
78
75
 
79
76
  const showBorderStyle = useHasBorderStyleControl(name);
80
- const [borderStyle, setBorderStyle] = (0, _hooks.useStyle)('border.style', name); // Border color.
77
+ const [borderStyle, setBorderStyle] = (0, _hooks.useStyle)('border.style', name); // When we set a border color or width ensure we have a style so the user
78
+ // can see a visible border.
79
+
80
+ const handleOnChangeWithStyle = setStyle => value => {
81
+ if (!!value && !borderStyle) {
82
+ setBorderStyle('solid');
83
+ }
84
+
85
+ setStyle(value || undefined);
86
+ }; // Border color.
87
+
81
88
 
82
89
  const showBorderColor = useHasBorderColorControl(name);
83
90
  const [borderColor, setBorderColor] = (0, _hooks.useStyle)('border.color', name);
84
- const [colors = EMPTY_ARRAY] = (0, _hooks.useSetting)('color.palette');
85
91
  const disableCustomColors = !(0, _hooks.useSetting)('color.custom')[0];
86
- const disableCustomGradients = !(0, _hooks.useSetting)('color.customGradient')[0]; // Border radius.
92
+ const disableCustomGradients = !(0, _hooks.useSetting)('color.customGradient')[0];
93
+ const borderColorSettings = [{
94
+ label: (0, _i18n.__)('Color'),
95
+ colors: (0, _hooks.useColorsPerOrigin)(name),
96
+ colorValue: borderColor,
97
+ onColorChange: handleOnChangeWithStyle(setBorderColor),
98
+ clearable: false
99
+ }]; // Border radius.
87
100
 
88
101
  const showBorderRadius = useHasBorderRadiusControl(name);
89
102
  const [borderRadiusValues, setBorderRadius] = (0, _hooks.useStyle)('border.radius', name);
@@ -103,16 +116,6 @@ function BorderPanel(_ref) {
103
116
  setBorderRadius(undefined);
104
117
  setBorderStyle(undefined);
105
118
  setBorderWidth(undefined);
106
- }; // When we set a border color or width ensure we have a style so the user
107
- // can see a visible border.
108
-
109
-
110
- const handleOnChangeWithStyle = setStyle => value => {
111
- if (!!value && !borderStyle) {
112
- setBorderStyle('solid');
113
- }
114
-
115
- setStyle(value || undefined);
116
119
  };
117
120
 
118
121
  return (0, _element.createElement)(_components.__experimentalToolsPanel, {
@@ -144,15 +147,13 @@ function BorderPanel(_ref) {
144
147
  label: (0, _i18n.__)('Color'),
145
148
  onDeselect: createResetCallback(setBorderColor),
146
149
  isShownByDefault: true
147
- }, (0, _element.createElement)(_blockEditor.__experimentalColorGradientControl, {
148
- label: (0, _i18n.__)('Color'),
149
- colorValue: borderColor,
150
- colors: colors,
151
- gradients: undefined,
150
+ }, (0, _element.createElement)(_blockEditor.__experimentalColorGradientSettingsDropdown, {
151
+ __experimentalHasMultipleOrigins: true,
152
+ __experimentalIsRenderedInSidebar: true,
152
153
  disableCustomColors: disableCustomColors,
153
154
  disableCustomGradients: disableCustomGradients,
154
- onColorChange: handleOnChangeWithStyle(setBorderColor),
155
- clearable: false
155
+ enableAlpha: true,
156
+ settings: borderColorSettings
156
157
  })), showBorderRadius && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
157
158
  hasValue: hasBorderRadius,
158
159
  label: (0, _i18n.__)('Radius'),
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/border-panel.js"],"names":["MIN_BORDER_WIDTH","EMPTY_ARRAY","useHasBorderPanel","name","controls","useHasBorderColorControl","useHasBorderRadiusControl","useHasBorderStyleControl","useHasBorderWidthControl","some","Boolean","supports","includes","BorderPanel","userBorderStyles","createHasValueCallback","feature","createResetCallback","setStyle","undefined","handleOnChange","value","units","availableUnits","showBorderWidth","borderWidthValue","setBorderWidth","showBorderStyle","borderStyle","setBorderStyle","showBorderColor","borderColor","setBorderColor","colors","disableCustomColors","disableCustomGradients","showBorderRadius","borderRadiusValues","setBorderRadius","hasBorderRadius","borderValues","radius","Object","entries","resetAll","handleOnChangeWithStyle"],"mappings":";;;;;;;;;;AAGA;;AAKA;;AAMA;;AAKA;;AAnBA;AACA;AACA;;AAcA;AACA;AACA;AAGA,MAAMA,gBAAgB,GAAG,CAAzB,C,CAEA;AACA;;AAC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T;AAGC,IAAA,UAAU,EAAGtB,mBAAmB,CAAEqB,eAAF,CAHjC;AAIC,IAAA,gBAAgB,EAAG;AAJpB,KAMC,4BAAC,8CAAD;AACC,IAAA,MAAM,EAAGD,kBADV;AAEC,IAAA,QAAQ,EAAGjB,cAAc,CAAEkB,eAAF;AAF1B,IAND,CAtDF,CADD;AAqEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalBorderRadiusControl as BorderRadiusControl,\n\t__experimentalBorderStyleControl as BorderStyleControl,\n\t__experimentalColorGradientControl as ColorGradientControl,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getSupportedGlobalStylesPanels, useSetting, useStyle } from './hooks';\n\nconst MIN_BORDER_WIDTH = 0;\n\n// Defining empty array here instead of inline avoids unnecessary re-renders of\n// color control.\nconst EMPTY_ARRAY = [];\n\nexport function useHasBorderPanel( name ) {\n\tconst controls = [\n\t\tuseHasBorderColorControl( name ),\n\t\tuseHasBorderRadiusControl( name ),\n\t\tuseHasBorderStyleControl( name ),\n\t\tuseHasBorderWidthControl( name ),\n\t];\n\n\treturn controls.some( Boolean );\n}\n\nfunction useHasBorderColorControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.color', name )[ 0 ] &&\n\t\tsupports.includes( 'borderColor' )\n\t);\n}\n\nfunction useHasBorderRadiusControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.radius', name )[ 0 ] &&\n\t\tsupports.includes( 'borderRadius' )\n\t);\n}\n\nfunction useHasBorderStyleControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.style', name )[ 0 ] &&\n\t\tsupports.includes( 'borderStyle' )\n\t);\n}\n\nfunction useHasBorderWidthControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.width', name )[ 0 ] &&\n\t\tsupports.includes( 'borderWidth' )\n\t);\n}\n\nexport default function BorderPanel( { name } ) {\n\t// To better reflect if the user has customized a value we need to\n\t// ensure the style value being checked is from the `user` origin.\n\tconst [ userBorderStyles ] = useStyle( 'border', name, 'user' );\n\tconst createHasValueCallback = ( feature ) => () =>\n\t\t!! userBorderStyles?.[ feature ];\n\n\tconst createResetCallback = ( setStyle ) => () => setStyle( undefined );\n\n\tconst handleOnChange = ( setStyle ) => ( value ) => {\n\t\tsetStyle( value || undefined );\n\t};\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' )[ 0 ] || [\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t],\n\t} );\n\n\t// Border width.\n\tconst showBorderWidth = useHasBorderWidthControl( name );\n\tconst [ borderWidthValue, setBorderWidth ] = useStyle(\n\t\t'border.width',\n\t\tname\n\t);\n\n\t// Border style.\n\tconst showBorderStyle = useHasBorderStyleControl( name );\n\tconst [ borderStyle, setBorderStyle ] = useStyle( 'border.style', name );\n\n\t// Border color.\n\tconst showBorderColor = useHasBorderColorControl( name );\n\tconst [ borderColor, setBorderColor ] = useStyle( 'border.color', name );\n\tconst [ colors = EMPTY_ARRAY ] = useSetting( 'color.palette' );\n\tconst disableCustomColors = ! useSetting( 'color.custom' )[ 0 ];\n\tconst disableCustomGradients = ! useSetting( 'color.customGradient' )[ 0 ];\n\n\t// Border radius.\n\tconst showBorderRadius = useHasBorderRadiusControl( name );\n\tconst [ borderRadiusValues, setBorderRadius ] = useStyle(\n\t\t'border.radius',\n\t\tname\n\t);\n\tconst hasBorderRadius = () => {\n\t\tconst borderValues = userBorderStyles?.radius;\n\t\tif ( typeof borderValues === 'object' ) {\n\t\t\treturn Object.entries( borderValues ).some( Boolean );\n\t\t}\n\t\treturn !! borderValues;\n\t};\n\n\tconst resetAll = () => {\n\t\tsetBorderColor( undefined );\n\t\tsetBorderRadius( undefined );\n\t\tsetBorderStyle( undefined );\n\t\tsetBorderWidth( undefined );\n\t};\n\n\t// When we set a border color or width ensure we have a style so the user\n\t// can see a visible border.\n\tconst handleOnChangeWithStyle = ( setStyle ) => ( value ) => {\n\t\tif ( !! value && ! borderStyle ) {\n\t\t\tsetBorderStyle( 'solid' );\n\t\t}\n\n\t\tsetStyle( value || undefined );\n\t};\n\n\treturn (\n\t\t<ToolsPanel label={ __( 'Border' ) } resetAll={ resetAll }>\n\t\t\t{ showBorderWidth && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ createHasValueCallback( 'width' ) }\n\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\tonDeselect={ createResetCallback( setBorderWidth ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\tvalue={ borderWidthValue }\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tmin={ MIN_BORDER_WIDTH }\n\t\t\t\t\t\tonChange={ handleOnChangeWithStyle( setBorderWidth ) }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderStyle && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ createHasValueCallback( 'style' ) }\n\t\t\t\t\tlabel={ __( 'Style' ) }\n\t\t\t\t\tonDeselect={ createResetCallback( setBorderStyle ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BorderStyleControl\n\t\t\t\t\t\tvalue={ borderStyle }\n\t\t\t\t\t\tonChange={ handleOnChange( setBorderStyle ) }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderColor && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ createHasValueCallback( 'color' ) }\n\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\tonDeselect={ createResetCallback( setBorderColor ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<ColorGradientControl\n\t\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\t\tcolorValue={ borderColor }\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tgradients={ undefined }\n\t\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\t\tdisableCustomGradients={ disableCustomGradients }\n\t\t\t\t\t\tonColorChange={ handleOnChangeWithStyle(\n\t\t\t\t\t\t\tsetBorderColor\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tclearable={ false }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderRadius && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasBorderRadius }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\tonDeselect={ createResetCallback( setBorderRadius ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BorderRadiusControl\n\t\t\t\t\t\tvalues={ borderRadiusValues }\n\t\t\t\t\t\tonChange={ handleOnChange( setBorderRadius ) }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</ToolsPanel>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/border-panel.js"],"names":["MIN_BORDER_WIDTH","useHasBorderPanel","name","controls","useHasBorderColorControl","useHasBorderRadiusControl","useHasBorderStyleControl","useHasBorderWidthControl","some","Boolean","supports","includes","BorderPanel","userBorderStyles","createHasValueCallback","feature","createResetCallback","setStyle","undefined","handleOnChange","value","units","availableUnits","showBorderWidth","borderWidthValue","setBorderWidth","showBorderStyle","borderStyle","setBorderStyle","handleOnChangeWithStyle","showBorderColor","borderColor","setBorderColor","disableCustomColors","disableCustomGradients","borderColorSettings","label","colors","colorValue","onColorChange","clearable","showBorderRadius","borderRadiusValues","setBorderRadius","hasBorderRadius","borderValues","radius","Object","entries","resetAll"],"mappings":";;;;;;;;;;AAGA;;AAKA;;AAMA;;AAKA;;AAnBA;AACA;AACA;;AAcA;AACA;AACA;AAQA,MAAMA,gBAAgB,GAAG,CAAzB;;AAEO,SAASC,iBAAT,CAA4BC,IAA5B,EAAmC;AACzC,QAAMC,QAAQ,GAAG,CAChBC,wBAAwB,CAAEF,IAAF,CADR,EAEhBG,yBAAyB,CAAEH,IAAF,CAFT,EAGhBI,wBAAwB,CAAEJ,IAAF,CAHR,EAIhBK,wBAAwB,CAAEL,IAAF,CAJR,CAAjB;AAOA,SAAOC,QAAQ,CAACK,IAAT,CAAeC,OAAf,CAAP;AACA;;AAED,SAASL,wBAAT,CAAmCF,IAAnC,EAA0C;AACzC,QAAMQ,QAAQ,GAAG,2CAAgCR,IAAhC,CAAjB;AACA,SACC,uBAAY,cAAZ,EAA4BA,IAA5B,EAAoC,CAApC,KACAQ,QAAQ,CAACC,QAAT,CAAmB,aAAnB,CAFD;AAIA;;AAED,SAASN,yBAAT,CAAoCH,IAApC,EAA2C;AAC1C,QAAMQ,QAAQ,GAAG,2CAAgCR,IAAhC,CAAjB;AACA,SACC,uBAAY,eAAZ,EAA6BA,IAA7B,EAAqC,CAArC,KACAQ,QAAQ,CAACC,QAAT,CAAmB,cAAnB,CAFD;AAIA;;AAED,SAASL,wBAAT,CAAmCJ,IAAnC,EAA0C;AACzC,QAAMQ,QAAQ,GAAG,2CAAgCR,IAAhC,CAAjB;AACA,SACC,uBAAY,cAAZ,EAA4BA,IAA5B,EAAoC,CAApC,KACAQ,QAAQ,CAACC,QAAT,CAA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AAK,EAAG,cAAI,OAAJ,CAFT;AAGC,IAAA,UAAU,EAAGE,mBAAmB,CAAEgB,cAAF,CAHjC;AAIC,IAAA,gBAAgB,EAAG;AAJpB,KAMC,4BAAC,wDAAD;AACC,IAAA,gCAAgC,MADjC;AAEC,IAAA,iCAAiC,MAFlC;AAGC,IAAA,mBAAmB,EAAGC,mBAHvB;AAIC,IAAA,sBAAsB,EAAGC,sBAJ1B;AAKC,IAAA,WAAW,MALZ;AAMC,IAAA,QAAQ,EAAGC;AANZ,IAND,CAjCF,EAiDGM,gBAAgB,IACjB,4BAAC,wCAAD;AACC,IAAA,QAAQ,EAAGG,eADZ;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAFT;AAGC,IAAA,UAAU,EAAG5B,mBAAmB,CAAE2B,eAAF,CAHjC;AAIC,IAAA,gBAAgB,EAAG;AAJpB,KAMC,4BAAC,8CAAD;AACC,IAAA,MAAM,EAAGD,kBADV;AAEC,IAAA,QAAQ,EAAGvB,cAAc,CAAEwB,eAAF;AAF1B,IAND,CAlDF,CADD;AAiEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalBorderRadiusControl as BorderRadiusControl,\n\t__experimentalBorderStyleControl as BorderStyleControl,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseColorsPerOrigin,\n\tuseSetting,\n\tuseStyle,\n} from './hooks';\n\nconst MIN_BORDER_WIDTH = 0;\n\nexport function useHasBorderPanel( name ) {\n\tconst controls = [\n\t\tuseHasBorderColorControl( name ),\n\t\tuseHasBorderRadiusControl( name ),\n\t\tuseHasBorderStyleControl( name ),\n\t\tuseHasBorderWidthControl( name ),\n\t];\n\n\treturn controls.some( Boolean );\n}\n\nfunction useHasBorderColorControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.color', name )[ 0 ] &&\n\t\tsupports.includes( 'borderColor' )\n\t);\n}\n\nfunction useHasBorderRadiusControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.radius', name )[ 0 ] &&\n\t\tsupports.includes( 'borderRadius' )\n\t);\n}\n\nfunction useHasBorderStyleControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.style', name )[ 0 ] &&\n\t\tsupports.includes( 'borderStyle' )\n\t);\n}\n\nfunction useHasBorderWidthControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'border.width', name )[ 0 ] &&\n\t\tsupports.includes( 'borderWidth' )\n\t);\n}\n\nexport default function BorderPanel( { name } ) {\n\t// To better reflect if the user has customized a value we need to\n\t// ensure the style value being checked is from the `user` origin.\n\tconst [ userBorderStyles ] = useStyle( 'border', name, 'user' );\n\tconst createHasValueCallback = ( feature ) => () =>\n\t\t!! userBorderStyles?.[ feature ];\n\n\tconst createResetCallback = ( setStyle ) => () => setStyle( undefined );\n\n\tconst handleOnChange = ( setStyle ) => ( value ) => {\n\t\tsetStyle( value || undefined );\n\t};\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' )[ 0 ] || [\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t],\n\t} );\n\n\t// Border width.\n\tconst showBorderWidth = useHasBorderWidthControl( name );\n\tconst [ borderWidthValue, setBorderWidth ] = useStyle(\n\t\t'border.width',\n\t\tname\n\t);\n\n\t// Border style.\n\tconst showBorderStyle = useHasBorderStyleControl( name );\n\tconst [ borderStyle, setBorderStyle ] = useStyle( 'border.style', name );\n\n\t// When we set a border color or width ensure we have a style so the user\n\t// can see a visible border.\n\tconst handleOnChangeWithStyle = ( setStyle ) => ( value ) => {\n\t\tif ( !! value && ! borderStyle ) {\n\t\t\tsetBorderStyle( 'solid' );\n\t\t}\n\n\t\tsetStyle( value || undefined );\n\t};\n\n\t// Border color.\n\tconst showBorderColor = useHasBorderColorControl( name );\n\tconst [ borderColor, setBorderColor ] = useStyle( 'border.color', name );\n\tconst disableCustomColors = ! useSetting( 'color.custom' )[ 0 ];\n\tconst disableCustomGradients = ! useSetting( 'color.customGradient' )[ 0 ];\n\n\tconst borderColorSettings = [\n\t\t{\n\t\t\tlabel: __( 'Color' ),\n\t\t\tcolors: useColorsPerOrigin( name ),\n\t\t\tcolorValue: borderColor,\n\t\t\tonColorChange: handleOnChangeWithStyle( setBorderColor ),\n\t\t\tclearable: false,\n\t\t},\n\t];\n\n\t// Border radius.\n\tconst showBorderRadius = useHasBorderRadiusControl( name );\n\tconst [ borderRadiusValues, setBorderRadius ] = useStyle(\n\t\t'border.radius',\n\t\tname\n\t);\n\tconst hasBorderRadius = () => {\n\t\tconst borderValues = userBorderStyles?.radius;\n\t\tif ( typeof borderValues === 'object' ) {\n\t\t\treturn Object.entries( borderValues ).some( Boolean );\n\t\t}\n\t\treturn !! borderValues;\n\t};\n\n\tconst resetAll = () => {\n\t\tsetBorderColor( undefined );\n\t\tsetBorderRadius( undefined );\n\t\tsetBorderStyle( undefined );\n\t\tsetBorderWidth( undefined );\n\t};\n\n\treturn (\n\t\t<ToolsPanel label={ __( 'Border' ) } resetAll={ resetAll }>\n\t\t\t{ showBorderWidth && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ createHasValueCallback( 'width' ) }\n\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\tonDeselect={ createResetCallback( setBorderWidth ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\tvalue={ borderWidthValue }\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tmin={ MIN_BORDER_WIDTH }\n\t\t\t\t\t\tonChange={ handleOnChangeWithStyle( setBorderWidth ) }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderStyle && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ createHasValueCallback( 'style' ) }\n\t\t\t\t\tlabel={ __( 'Style' ) }\n\t\t\t\t\tonDeselect={ createResetCallback( setBorderStyle ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BorderStyleControl\n\t\t\t\t\t\tvalue={ borderStyle }\n\t\t\t\t\t\tonChange={ handleOnChange( setBorderStyle ) }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderColor && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ createHasValueCallback( 'color' ) }\n\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\tonDeselect={ createResetCallback( setBorderColor ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\t\tdisableCustomGradients={ disableCustomGradients }\n\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\tsettings={ borderColorSettings }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderRadius && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasBorderRadius }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\tonDeselect={ createResetCallback( setBorderRadius ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BorderRadiusControl\n\t\t\t\t\t\tvalues={ borderRadiusValues }\n\t\t\t\t\t\tonChange={ handleOnChange( setBorderRadius ) }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</ToolsPanel>\n\t);\n}\n"]}