@wordpress/block-editor 15.7.1-next.2f1c7c01b.0 → 15.8.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 (187) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-card/index.js +76 -34
  3. package/build/components/block-card/index.js.map +2 -2
  4. package/build/components/block-inspector/edit-contents.js +72 -0
  5. package/build/components/block-inspector/edit-contents.js.map +7 -0
  6. package/build/components/block-inspector/index.js +32 -9
  7. package/build/components/block-inspector/index.js.map +3 -3
  8. package/build/components/block-list/index.js +9 -9
  9. package/build/components/block-list/index.js.map +2 -2
  10. package/build/components/block-switcher/index.js +24 -123
  11. package/build/components/block-switcher/index.js.map +3 -3
  12. package/build/components/block-toolbar/block-toolbar-icon.js +175 -0
  13. package/build/components/block-toolbar/block-toolbar-icon.js.map +7 -0
  14. package/build/components/block-toolbar/index.js +51 -53
  15. package/build/components/block-toolbar/index.js.map +3 -3
  16. package/build/components/block-toolbar/pattern-overrides-dropdown.js +93 -0
  17. package/build/components/block-toolbar/pattern-overrides-dropdown.js.map +7 -0
  18. package/build/components/block-tools/index.js +10 -3
  19. package/build/components/block-tools/index.js.map +2 -2
  20. package/build/components/border-radius-control/utils.js +7 -3
  21. package/build/components/border-radius-control/utils.js.map +2 -2
  22. package/build/components/content-lock/modify-content-lock-menu-item.js +3 -3
  23. package/build/components/content-lock/modify-content-lock-menu-item.js.map +2 -2
  24. package/build/components/global-styles/border-panel.js +11 -7
  25. package/build/components/global-styles/border-panel.js.map +2 -2
  26. package/build/components/global-styles/color-panel.js +35 -27
  27. package/build/components/global-styles/color-panel.js.map +2 -2
  28. package/build/components/global-styles/typography-panel.js +3 -2
  29. package/build/components/global-styles/typography-panel.js.map +2 -2
  30. package/build/components/inserter/media-tab/media-tab.js +2 -1
  31. package/build/components/inserter/media-tab/media-tab.js.map +2 -2
  32. package/build/components/inspector-controls-tabs/index.js +2 -1
  33. package/build/components/inspector-controls-tabs/index.js.map +2 -2
  34. package/build/components/inspector-controls-tabs/styles-tab.js +55 -1
  35. package/build/components/inspector-controls-tabs/styles-tab.js.map +3 -3
  36. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +1 -1
  37. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +2 -2
  38. package/build/components/keyboard-shortcuts/index.js +8 -0
  39. package/build/components/keyboard-shortcuts/index.js.map +2 -2
  40. package/build/components/rich-text/index.js +1 -0
  41. package/build/components/rich-text/index.js.map +2 -2
  42. package/build/hooks/border.js +10 -5
  43. package/build/hooks/border.js.map +3 -3
  44. package/build/hooks/color.js +31 -9
  45. package/build/hooks/color.js.map +3 -3
  46. package/build/hooks/content-lock-ui.js +4 -5
  47. package/build/hooks/content-lock-ui.js.map +2 -2
  48. package/build/hooks/dimensions.js +9 -4
  49. package/build/hooks/dimensions.js.map +2 -2
  50. package/build/hooks/fit-text.js +19 -75
  51. package/build/hooks/fit-text.js.map +3 -3
  52. package/build/hooks/font-size.js +5 -2
  53. package/build/hooks/font-size.js.map +2 -2
  54. package/build/hooks/layout.js +4 -1
  55. package/build/hooks/layout.js.map +2 -2
  56. package/build/hooks/spacing-visualizer.js +5 -0
  57. package/build/hooks/spacing-visualizer.js.map +2 -2
  58. package/build/hooks/typography.js +23 -14
  59. package/build/hooks/typography.js.map +3 -3
  60. package/build/store/private-selectors.js +21 -1
  61. package/build/store/private-selectors.js.map +2 -2
  62. package/build/store/reducer.js +4 -0
  63. package/build/store/reducer.js.map +2 -2
  64. package/build/store/selectors.js +9 -3
  65. package/build/store/selectors.js.map +2 -2
  66. package/build/utils/fit-text-frontend.js +1 -0
  67. package/build/utils/fit-text-frontend.js.map +2 -2
  68. package/build/utils/fit-text-utils.js +1 -1
  69. package/build/utils/fit-text-utils.js.map +1 -1
  70. package/build-module/components/block-card/index.js +82 -32
  71. package/build-module/components/block-card/index.js.map +2 -2
  72. package/build-module/components/block-inspector/edit-contents.js +51 -0
  73. package/build-module/components/block-inspector/edit-contents.js.map +7 -0
  74. package/build-module/components/block-inspector/index.js +32 -9
  75. package/build-module/components/block-inspector/index.js.map +2 -2
  76. package/build-module/components/block-list/index.js +11 -11
  77. package/build-module/components/block-list/index.js.map +2 -2
  78. package/build-module/components/block-switcher/index.js +24 -124
  79. package/build-module/components/block-switcher/index.js.map +2 -2
  80. package/build-module/components/block-toolbar/block-toolbar-icon.js +144 -0
  81. package/build-module/components/block-toolbar/block-toolbar-icon.js.map +7 -0
  82. package/build-module/components/block-toolbar/index.js +51 -53
  83. package/build-module/components/block-toolbar/index.js.map +2 -2
  84. package/build-module/components/block-toolbar/pattern-overrides-dropdown.js +76 -0
  85. package/build-module/components/block-toolbar/pattern-overrides-dropdown.js.map +7 -0
  86. package/build-module/components/block-tools/index.js +10 -3
  87. package/build-module/components/block-tools/index.js.map +2 -2
  88. package/build-module/components/border-radius-control/utils.js +7 -3
  89. package/build-module/components/border-radius-control/utils.js.map +2 -2
  90. package/build-module/components/content-lock/modify-content-lock-menu-item.js +3 -3
  91. package/build-module/components/content-lock/modify-content-lock-menu-item.js.map +2 -2
  92. package/build-module/components/global-styles/border-panel.js +11 -7
  93. package/build-module/components/global-styles/border-panel.js.map +2 -2
  94. package/build-module/components/global-styles/color-panel.js +34 -27
  95. package/build-module/components/global-styles/color-panel.js.map +2 -2
  96. package/build-module/components/global-styles/typography-panel.js +3 -2
  97. package/build-module/components/global-styles/typography-panel.js.map +2 -2
  98. package/build-module/components/inserter/media-tab/media-tab.js +2 -1
  99. package/build-module/components/inserter/media-tab/media-tab.js.map +2 -2
  100. package/build-module/components/inspector-controls-tabs/index.js +2 -1
  101. package/build-module/components/inspector-controls-tabs/index.js.map +2 -2
  102. package/build-module/components/inspector-controls-tabs/styles-tab.js +55 -1
  103. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +2 -2
  104. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +1 -1
  105. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +2 -2
  106. package/build-module/components/keyboard-shortcuts/index.js +8 -0
  107. package/build-module/components/keyboard-shortcuts/index.js.map +2 -2
  108. package/build-module/components/rich-text/index.js +1 -0
  109. package/build-module/components/rich-text/index.js.map +2 -2
  110. package/build-module/hooks/border.js +10 -5
  111. package/build-module/hooks/border.js.map +3 -3
  112. package/build-module/hooks/color.js +31 -9
  113. package/build-module/hooks/color.js.map +3 -3
  114. package/build-module/hooks/content-lock-ui.js +4 -5
  115. package/build-module/hooks/content-lock-ui.js.map +2 -2
  116. package/build-module/hooks/dimensions.js +9 -4
  117. package/build-module/hooks/dimensions.js.map +2 -2
  118. package/build-module/hooks/fit-text.js +18 -66
  119. package/build-module/hooks/fit-text.js.map +2 -2
  120. package/build-module/hooks/font-size.js +5 -2
  121. package/build-module/hooks/font-size.js.map +2 -2
  122. package/build-module/hooks/layout.js +4 -1
  123. package/build-module/hooks/layout.js.map +2 -2
  124. package/build-module/hooks/spacing-visualizer.js +5 -0
  125. package/build-module/hooks/spacing-visualizer.js.map +2 -2
  126. package/build-module/hooks/typography.js +23 -14
  127. package/build-module/hooks/typography.js.map +3 -3
  128. package/build-module/store/private-selectors.js +20 -1
  129. package/build-module/store/private-selectors.js.map +2 -2
  130. package/build-module/store/reducer.js +4 -0
  131. package/build-module/store/reducer.js.map +2 -2
  132. package/build-module/store/selectors.js +9 -3
  133. package/build-module/store/selectors.js.map +2 -2
  134. package/build-module/utils/fit-text-frontend.js +1 -0
  135. package/build-module/utils/fit-text-frontend.js.map +2 -2
  136. package/build-module/utils/fit-text-utils.js +1 -1
  137. package/build-module/utils/fit-text-utils.js.map +1 -1
  138. package/build-style/style-rtl.css +31 -71
  139. package/build-style/style.css +31 -71
  140. package/package.json +37 -37
  141. package/src/components/block-card/index.js +95 -38
  142. package/src/components/block-card/style.scss +17 -1
  143. package/src/components/block-inspector/edit-contents.js +64 -0
  144. package/src/components/block-inspector/index.js +35 -13
  145. package/src/components/block-inspector/style.scss +6 -3
  146. package/src/components/block-list/index.js +11 -9
  147. package/src/components/block-switcher/index.js +51 -180
  148. package/src/components/block-switcher/style.scss +0 -70
  149. package/src/components/block-switcher/test/index.js +17 -18
  150. package/src/components/block-toolbar/block-toolbar-icon.js +173 -0
  151. package/src/components/block-toolbar/index.js +50 -52
  152. package/src/components/block-toolbar/pattern-overrides-dropdown.js +99 -0
  153. package/src/components/block-toolbar/style.scss +21 -21
  154. package/src/components/block-toolbar/test/block-toolbar-icon.js +182 -0
  155. package/src/components/block-tools/index.js +11 -1
  156. package/src/components/border-radius-control/test/utils.js +90 -0
  157. package/src/components/border-radius-control/utils.js +7 -3
  158. package/src/components/content-lock/modify-content-lock-menu-item.js +9 -3
  159. package/src/components/global-styles/border-panel.js +11 -7
  160. package/src/components/global-styles/color-panel.js +32 -26
  161. package/src/components/global-styles/typography-panel.js +2 -1
  162. package/src/components/inserter/media-tab/media-tab.js +7 -1
  163. package/src/components/inspector-controls-tabs/index.js +1 -0
  164. package/src/components/inspector-controls-tabs/styles-tab.js +58 -0
  165. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +5 -1
  166. package/src/components/keyboard-shortcuts/index.js +9 -0
  167. package/src/components/rich-text/index.js +1 -0
  168. package/src/hooks/border.js +12 -6
  169. package/src/hooks/color.js +40 -13
  170. package/src/hooks/content-lock-ui.js +9 -6
  171. package/src/hooks/dimensions.js +25 -17
  172. package/src/hooks/fit-text.js +23 -84
  173. package/src/hooks/font-size.js +7 -2
  174. package/src/hooks/layout.js +11 -7
  175. package/src/hooks/spacing-visualizer.js +9 -1
  176. package/src/hooks/typography.js +24 -18
  177. package/src/store/private-selectors.js +26 -1
  178. package/src/store/reducer.js +6 -0
  179. package/src/store/selectors.js +17 -3
  180. package/src/utils/fit-text-frontend.js +1 -0
  181. package/src/utils/fit-text-utils.js +1 -1
  182. package/tsconfig.tsbuildinfo +1 -1
  183. package/build/components/block-inspector/edit-contents-button.js +0 -61
  184. package/build/components/block-inspector/edit-contents-button.js.map +0 -7
  185. package/build-module/components/block-inspector/edit-contents-button.js +0 -40
  186. package/build-module/components/block-inspector/edit-contents-button.js.map +0 -7
  187. package/src/components/block-inspector/edit-contents-button.js +0 -46
@@ -19,6 +19,7 @@ store("core/fit-text", {
19
19
  context.fontSize = optimizeFitText(ref, applyFontSize);
20
20
  });
21
21
  resizeObserver.observe(ref.parentElement);
22
+ resizeObserver.observe(ref);
22
23
  return () => {
23
24
  if (resizeObserver) {
24
25
  resizeObserver.disconnect();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/fit-text-frontend.js"],
4
- "sourcesContent": ["/**\n * Frontend fit text functionality.\n * Automatically detects and initializes fit text on blocks with the has-fit-text class.\n * Supports both initial page load and Interactivity API client-side navigation.\n */\n\n/**\n * WordPress dependencies\n */\nimport { store, getElement, getContext } from '@wordpress/interactivity';\n\n/**\n * Internal dependencies\n */\nimport { optimizeFitText } from './fit-text-utils';\n\n// Initialize via Interactivity API for client-side navigation\nstore( 'core/fit-text', {\n\tcallbacks: {\n\t\tinit() {\n\t\t\tconst context = getContext();\n\t\t\tconst { ref } = getElement();\n\n\t\t\tconst applyFontSize = ( fontSize ) => {\n\t\t\t\tif ( fontSize === 0 ) {\n\t\t\t\t\tref.style.fontSize = '';\n\t\t\t\t} else {\n\t\t\t\t\tref.style.fontSize = `${ fontSize }px`;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t// Initial fit text optimization.\n\t\t\tcontext.fontSize = optimizeFitText( ref, applyFontSize );\n\n\t\t\t// Starts ResizeObserver to handle dynamic resizing.\n\t\t\tif ( window.ResizeObserver && ref.parentElement ) {\n\t\t\t\tconst resizeObserver = new window.ResizeObserver( () => {\n\t\t\t\t\tcontext.fontSize = optimizeFitText( ref, applyFontSize );\n\t\t\t\t} );\n\t\t\t\tresizeObserver.observe( ref.parentElement );\n\n\t\t\t\t// Return cleanup function to be called when element is removed.\n\t\t\t\treturn () => {\n\t\t\t\t\tif ( resizeObserver ) {\n\t\t\t\t\t\tresizeObserver.disconnect();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t},\n} );\n"],
5
- "mappings": ";AASA,SAAS,OAAO,YAAY,kBAAkB;AAK9C,SAAS,uBAAuB;AAGhC,MAAO,iBAAiB;AAAA,EACvB,WAAW;AAAA,IACV,OAAO;AACN,YAAM,UAAU,WAAW;AAC3B,YAAM,EAAE,IAAI,IAAI,WAAW;AAE3B,YAAM,gBAAgB,CAAE,aAAc;AACrC,YAAK,aAAa,GAAI;AACrB,cAAI,MAAM,WAAW;AAAA,QACtB,OAAO;AACN,cAAI,MAAM,WAAW,GAAI,QAAS;AAAA,QACnC;AAAA,MACD;AAGA,cAAQ,WAAW,gBAAiB,KAAK,aAAc;AAGvD,UAAK,OAAO,kBAAkB,IAAI,eAAgB;AACjD,cAAM,iBAAiB,IAAI,OAAO,eAAgB,MAAM;AACvD,kBAAQ,WAAW,gBAAiB,KAAK,aAAc;AAAA,QACxD,CAAE;AACF,uBAAe,QAAS,IAAI,aAAc;AAG1C,eAAO,MAAM;AACZ,cAAK,gBAAiB;AACrB,2BAAe,WAAW;AAAA,UAC3B;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD,CAAE;",
4
+ "sourcesContent": ["/**\n * Frontend fit text functionality.\n * Automatically detects and initializes fit text on blocks with the has-fit-text class.\n * Supports both initial page load and Interactivity API client-side navigation.\n */\n\n/**\n * WordPress dependencies\n */\nimport { store, getElement, getContext } from '@wordpress/interactivity';\n\n/**\n * Internal dependencies\n */\nimport { optimizeFitText } from './fit-text-utils';\n\n// Initialize via Interactivity API for client-side navigation\nstore( 'core/fit-text', {\n\tcallbacks: {\n\t\tinit() {\n\t\t\tconst context = getContext();\n\t\t\tconst { ref } = getElement();\n\n\t\t\tconst applyFontSize = ( fontSize ) => {\n\t\t\t\tif ( fontSize === 0 ) {\n\t\t\t\t\tref.style.fontSize = '';\n\t\t\t\t} else {\n\t\t\t\t\tref.style.fontSize = `${ fontSize }px`;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t// Initial fit text optimization.\n\t\t\tcontext.fontSize = optimizeFitText( ref, applyFontSize );\n\n\t\t\t// Starts ResizeObserver to handle dynamic resizing.\n\t\t\tif ( window.ResizeObserver && ref.parentElement ) {\n\t\t\t\tconst resizeObserver = new window.ResizeObserver( () => {\n\t\t\t\t\tcontext.fontSize = optimizeFitText( ref, applyFontSize );\n\t\t\t\t} );\n\t\t\t\tresizeObserver.observe( ref.parentElement );\n\t\t\t\tresizeObserver.observe( ref );\n\n\t\t\t\t// Return cleanup function to be called when element is removed.\n\t\t\t\treturn () => {\n\t\t\t\t\tif ( resizeObserver ) {\n\t\t\t\t\t\tresizeObserver.disconnect();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t},\n} );\n"],
5
+ "mappings": ";AASA,SAAS,OAAO,YAAY,kBAAkB;AAK9C,SAAS,uBAAuB;AAGhC,MAAO,iBAAiB;AAAA,EACvB,WAAW;AAAA,IACV,OAAO;AACN,YAAM,UAAU,WAAW;AAC3B,YAAM,EAAE,IAAI,IAAI,WAAW;AAE3B,YAAM,gBAAgB,CAAE,aAAc;AACrC,YAAK,aAAa,GAAI;AACrB,cAAI,MAAM,WAAW;AAAA,QACtB,OAAO;AACN,cAAI,MAAM,WAAW,GAAI,QAAS;AAAA,QACnC;AAAA,MACD;AAGA,cAAQ,WAAW,gBAAiB,KAAK,aAAc;AAGvD,UAAK,OAAO,kBAAkB,IAAI,eAAgB;AACjD,cAAM,iBAAiB,IAAI,OAAO,eAAgB,MAAM;AACvD,kBAAQ,WAAW,gBAAiB,KAAK,aAAc;AAAA,QACxD,CAAE;AACF,uBAAe,QAAS,IAAI,aAAc;AAC1C,uBAAe,QAAS,GAAI;AAG5B,eAAO,MAAM;AACZ,cAAK,gBAAiB;AACrB,2BAAe,WAAW;AAAA,UAC3B;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD,CAAE;",
6
6
  "names": []
7
7
  }
@@ -2,7 +2,7 @@
2
2
  function findOptimalFontSize(textElement, applyFontSize) {
3
3
  const alreadyHasScrollableHeight = textElement.scrollHeight > textElement.clientHeight;
4
4
  let minSize = 5;
5
- let maxSize = 600;
5
+ let maxSize = 2400;
6
6
  let bestSize = minSize;
7
7
  while (minSize <= maxSize) {
8
8
  const midSize = Math.floor((minSize + maxSize) / 2);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/fit-text-utils.js"],
4
- "sourcesContent": ["/**\n * Shared utility functions for fit text functionality.\n * Uses callback-based approach for maximum code reuse between editor and frontend.\n */\n\n/**\n * Find optimal font size using simple binary search between 5-600px.\n *\n * @param {HTMLElement} textElement The text element\n * @param {Function} applyFontSize Function that receives font size in pixels\n * @return {number} Optimal font size\n */\nfunction findOptimalFontSize( textElement, applyFontSize ) {\n\tconst alreadyHasScrollableHeight =\n\t\ttextElement.scrollHeight > textElement.clientHeight;\n\tlet minSize = 5;\n\tlet maxSize = 600;\n\tlet bestSize = minSize;\n\n\twhile ( minSize <= maxSize ) {\n\t\tconst midSize = Math.floor( ( minSize + maxSize ) / 2 );\n\t\tapplyFontSize( midSize );\n\n\t\tconst fitsWidth = textElement.scrollWidth <= textElement.clientWidth;\n\t\tconst fitsHeight =\n\t\t\talreadyHasScrollableHeight ||\n\t\t\ttextElement.scrollHeight <= textElement.clientHeight;\n\n\t\tif ( fitsWidth && fitsHeight ) {\n\t\t\tbestSize = midSize;\n\t\t\tminSize = midSize + 1;\n\t\t} else {\n\t\t\tmaxSize = midSize - 1;\n\t\t}\n\t}\n\n\treturn bestSize;\n}\n\n/**\n * Complete fit text optimization for a single text element.\n * Handles the full flow using callbacks for font size application.\n *\n * @param {HTMLElement} textElement The text element (paragraph, heading, etc.)\n * @param {Function} applyFontSize Function that receives font size in pixels (0 to clear, >0 to apply)\n */\nexport function optimizeFitText( textElement, applyFontSize ) {\n\tif ( ! textElement ) {\n\t\treturn;\n\t}\n\n\tapplyFontSize( 0 );\n\n\tconst optimalSize = findOptimalFontSize( textElement, applyFontSize );\n\n\tapplyFontSize( optimalSize );\n\treturn optimalSize;\n}\n"],
4
+ "sourcesContent": ["/**\n * Shared utility functions for fit text functionality.\n * Uses callback-based approach for maximum code reuse between editor and frontend.\n */\n\n/**\n * Find optimal font size using simple binary search between 5-600px.\n *\n * @param {HTMLElement} textElement The text element\n * @param {Function} applyFontSize Function that receives font size in pixels\n * @return {number} Optimal font size\n */\nfunction findOptimalFontSize( textElement, applyFontSize ) {\n\tconst alreadyHasScrollableHeight =\n\t\ttextElement.scrollHeight > textElement.clientHeight;\n\tlet minSize = 5;\n\tlet maxSize = 2400;\n\tlet bestSize = minSize;\n\n\twhile ( minSize <= maxSize ) {\n\t\tconst midSize = Math.floor( ( minSize + maxSize ) / 2 );\n\t\tapplyFontSize( midSize );\n\n\t\tconst fitsWidth = textElement.scrollWidth <= textElement.clientWidth;\n\t\tconst fitsHeight =\n\t\t\talreadyHasScrollableHeight ||\n\t\t\ttextElement.scrollHeight <= textElement.clientHeight;\n\n\t\tif ( fitsWidth && fitsHeight ) {\n\t\t\tbestSize = midSize;\n\t\t\tminSize = midSize + 1;\n\t\t} else {\n\t\t\tmaxSize = midSize - 1;\n\t\t}\n\t}\n\n\treturn bestSize;\n}\n\n/**\n * Complete fit text optimization for a single text element.\n * Handles the full flow using callbacks for font size application.\n *\n * @param {HTMLElement} textElement The text element (paragraph, heading, etc.)\n * @param {Function} applyFontSize Function that receives font size in pixels (0 to clear, >0 to apply)\n */\nexport function optimizeFitText( textElement, applyFontSize ) {\n\tif ( ! textElement ) {\n\t\treturn;\n\t}\n\n\tapplyFontSize( 0 );\n\n\tconst optimalSize = findOptimalFontSize( textElement, applyFontSize );\n\n\tapplyFontSize( optimalSize );\n\treturn optimalSize;\n}\n"],
5
5
  "mappings": ";AAYA,SAAS,oBAAqB,aAAa,eAAgB;AAC1D,QAAM,6BACL,YAAY,eAAe,YAAY;AACxC,MAAI,UAAU;AACd,MAAI,UAAU;AACd,MAAI,WAAW;AAEf,SAAQ,WAAW,SAAU;AAC5B,UAAM,UAAU,KAAK,OAAS,UAAU,WAAY,CAAE;AACtD,kBAAe,OAAQ;AAEvB,UAAM,YAAY,YAAY,eAAe,YAAY;AACzD,UAAM,aACL,8BACA,YAAY,gBAAgB,YAAY;AAEzC,QAAK,aAAa,YAAa;AAC9B,iBAAW;AACX,gBAAU,UAAU;AAAA,IACrB,OAAO;AACN,gBAAU,UAAU;AAAA,IACrB;AAAA,EACD;AAEA,SAAO;AACR;AASO,SAAS,gBAAiB,aAAa,eAAgB;AAC7D,MAAK,CAAE,aAAc;AACpB;AAAA,EACD;AAEA,gBAAe,CAAE;AAEjB,QAAM,cAAc,oBAAqB,aAAa,aAAc;AAEpE,gBAAe,WAAY;AAC3B,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -360,8 +360,10 @@ iframe[name=editor-canvas] {
360
360
  border-top: 1px solid #ddd;
361
361
  }
362
362
 
363
- .block-editor-block-inspector-edit-contents-button {
364
- margin-top: 8px;
363
+ .block-editor-block-inspector-edit-contents {
364
+ margin: 0 16px 16px 16px;
365
+ }
366
+ .block-editor-block-inspector-edit-contents .block-editor-block-inspector-edit-contents__button {
365
367
  justify-content: center;
366
368
  }
367
369
 
@@ -659,6 +661,19 @@ iframe[name=editor-canvas] {
659
661
  display: flex;
660
662
  padding: 16px;
661
663
  }
664
+ .block-editor-block-card.is-parent {
665
+ padding-bottom: 4px;
666
+ }
667
+ .block-editor-block-card.is-child {
668
+ padding-top: 4px;
669
+ }
670
+
671
+ .block-editor-block-card__parent-select-button {
672
+ padding: 0;
673
+ align-items: start;
674
+ text-align: start;
675
+ height: auto !important;
676
+ }
662
677
 
663
678
  .block-editor-block-card__title {
664
679
  font-weight: 499;
@@ -677,7 +692,8 @@ iframe[name=editor-canvas] {
677
692
  padding: 3px 0;
678
693
  }
679
694
 
680
- .block-editor-block-card .block-editor-block-icon {
695
+ .block-editor-block-card .block-editor-block-icon,
696
+ .block-editor-block-card__child-indicator-icon {
681
697
  flex: 0 0 24px;
682
698
  margin-right: 0;
683
699
  margin-left: 12px;
@@ -1192,45 +1208,6 @@ iframe[name=editor-canvas] {
1192
1208
  box-sizing: border-box !important;
1193
1209
  }
1194
1210
 
1195
- .block-editor-block-switcher {
1196
- position: relative;
1197
- }
1198
- .block-editor-block-switcher .components-button.components-dropdown-menu__toggle.has-icon.has-icon {
1199
- min-width: 36px;
1200
- }
1201
-
1202
- .block-editor-block-switcher__no-switcher-icon,
1203
- .block-editor-block-switcher__toggle {
1204
- position: relative;
1205
- }
1206
-
1207
- .components-button.block-editor-block-switcher__toggle,
1208
- .components-button.block-editor-block-switcher__no-switcher-icon {
1209
- margin: 0;
1210
- display: block;
1211
- height: 48px;
1212
- }
1213
- .components-button.block-editor-block-switcher__toggle .block-editor-block-icon,
1214
- .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon {
1215
- margin: auto;
1216
- }
1217
-
1218
- .components-button.block-editor-block-switcher__no-switcher-icon {
1219
- display: flex;
1220
- }
1221
- .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon {
1222
- margin-left: auto;
1223
- margin-right: auto;
1224
- min-width: 24px !important;
1225
- }
1226
-
1227
- .components-button.block-editor-block-switcher__no-switcher-icon[aria-disabled=true] {
1228
- color: #1e1e1e;
1229
- }
1230
- .components-button.block-editor-block-switcher__no-switcher-icon[aria-disabled=true]:hover {
1231
- color: #1e1e1e;
1232
- }
1233
-
1234
1211
  .components-popover.block-editor-block-switcher__popover .components-popover__content {
1235
1212
  min-width: 300px;
1236
1213
  }
@@ -1274,25 +1251,6 @@ iframe[name=editor-canvas] {
1274
1251
  font-weight: 499;
1275
1252
  }
1276
1253
 
1277
- .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon {
1278
- min-width: 36px;
1279
- }
1280
- .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon,
1281
- .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle {
1282
- height: 48px;
1283
- }
1284
- .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon,
1285
- .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-switcher__transform,
1286
- .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle .block-editor-block-icon,
1287
- .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle .block-editor-block-switcher__transform {
1288
- width: 48px;
1289
- height: 48px;
1290
- }
1291
- .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-switcher__transform,
1292
- .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle .block-editor-block-switcher__transform {
1293
- padding: 12px;
1294
- }
1295
-
1296
1254
  .block-editor-block-switcher__preview-patterns-container {
1297
1255
  padding-bottom: 16px;
1298
1256
  }
@@ -3552,10 +3510,13 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
3552
3510
  background: color-mix(in srgb, var(--wp-block-synced-color) 10%, transparent);
3553
3511
  border-radius: 2px;
3554
3512
  }
3555
- .block-editor-block-toolbar.is-synced .block-editor-block-switcher .components-button .block-editor-block-icon, .block-editor-block-toolbar.is-connected .block-editor-block-switcher .components-button .block-editor-block-icon {
3556
- color: var(--wp-block-synced-color);
3513
+ .block-editor-block-toolbar .components-button.block-editor-block-toolbar__block-icon-button[aria-disabled=true] {
3514
+ color: #1e1e1e;
3515
+ }
3516
+ .block-editor-block-toolbar .components-button.block-editor-block-toolbar__block-icon-button[aria-disabled=true]:hover {
3517
+ color: #1e1e1e;
3557
3518
  }
3558
- .block-editor-block-toolbar.is-synced .block-editor-block-switcher__no-switcher-icon[aria-disabled=true] .block-editor-block-icon, .block-editor-block-toolbar.is-connected .block-editor-block-switcher__no-switcher-icon[aria-disabled=true] .block-editor-block-icon {
3519
+ .block-editor-block-toolbar.is-synced .block-editor-block-toolbar__block-icon, .block-editor-block-toolbar.is-connected .block-editor-block-toolbar__block-icon {
3559
3520
  color: var(--wp-block-synced-color);
3560
3521
  }
3561
3522
  .block-editor-block-toolbar > :last-child,
@@ -3649,15 +3610,15 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
3649
3610
  width: 2px;
3650
3611
  }
3651
3612
 
3652
- .block-editor-block-toolbar__block-controls .block-editor-block-switcher .components-dropdown-menu__toggle .block-editor-block-icon,
3653
- .block-editor-block-toolbar__block-controls .block-editor-block-switcher__no-switcher-icon .block-editor-block-icon {
3654
- width: 24px !important;
3655
- margin: 0 !important;
3656
- }
3657
3613
  .block-editor-block-toolbar__block-controls .components-toolbar-group {
3658
3614
  padding: 0;
3659
3615
  }
3660
3616
 
3617
+ .block-editor-block-toolbar__pattern-overrides-popover .components-popover__content {
3618
+ min-width: 260px;
3619
+ padding: 16px;
3620
+ }
3621
+
3661
3622
  .block-editor-block-toolbar .components-toolbar-group,
3662
3623
  .block-editor-block-toolbar .components-toolbar,
3663
3624
  .block-editor-rich-text__inline-format-toolbar-group .components-toolbar-group,
@@ -3684,8 +3645,7 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
3684
3645
  padding-right: 6px;
3685
3646
  padding-left: 6px;
3686
3647
  }
3687
- .show-icon-labels .block-editor-block-switcher .components-dropdown-menu__toggle .block-editor-block-icon,
3688
- .show-icon-labels .block-editor-block-switcher__no-switcher-icon .block-editor-block-icon {
3648
+ .show-icon-labels .block-editor-block-icon {
3689
3649
  width: 0 !important;
3690
3650
  height: 0 !important;
3691
3651
  min-width: 0 !important;
@@ -360,8 +360,10 @@ iframe[name=editor-canvas] {
360
360
  border-top: 1px solid #ddd;
361
361
  }
362
362
 
363
- .block-editor-block-inspector-edit-contents-button {
364
- margin-top: 8px;
363
+ .block-editor-block-inspector-edit-contents {
364
+ margin: 0 16px 16px 16px;
365
+ }
366
+ .block-editor-block-inspector-edit-contents .block-editor-block-inspector-edit-contents__button {
365
367
  justify-content: center;
366
368
  }
367
369
 
@@ -659,6 +661,19 @@ iframe[name=editor-canvas] {
659
661
  display: flex;
660
662
  padding: 16px;
661
663
  }
664
+ .block-editor-block-card.is-parent {
665
+ padding-bottom: 4px;
666
+ }
667
+ .block-editor-block-card.is-child {
668
+ padding-top: 4px;
669
+ }
670
+
671
+ .block-editor-block-card__parent-select-button {
672
+ padding: 0;
673
+ align-items: start;
674
+ text-align: start;
675
+ height: auto !important;
676
+ }
662
677
 
663
678
  .block-editor-block-card__title {
664
679
  font-weight: 499;
@@ -677,7 +692,8 @@ iframe[name=editor-canvas] {
677
692
  padding: 3px 0;
678
693
  }
679
694
 
680
- .block-editor-block-card .block-editor-block-icon {
695
+ .block-editor-block-card .block-editor-block-icon,
696
+ .block-editor-block-card__child-indicator-icon {
681
697
  flex: 0 0 24px;
682
698
  margin-left: 0;
683
699
  margin-right: 12px;
@@ -1192,45 +1208,6 @@ iframe[name=editor-canvas] {
1192
1208
  box-sizing: border-box !important;
1193
1209
  }
1194
1210
 
1195
- .block-editor-block-switcher {
1196
- position: relative;
1197
- }
1198
- .block-editor-block-switcher .components-button.components-dropdown-menu__toggle.has-icon.has-icon {
1199
- min-width: 36px;
1200
- }
1201
-
1202
- .block-editor-block-switcher__no-switcher-icon,
1203
- .block-editor-block-switcher__toggle {
1204
- position: relative;
1205
- }
1206
-
1207
- .components-button.block-editor-block-switcher__toggle,
1208
- .components-button.block-editor-block-switcher__no-switcher-icon {
1209
- margin: 0;
1210
- display: block;
1211
- height: 48px;
1212
- }
1213
- .components-button.block-editor-block-switcher__toggle .block-editor-block-icon,
1214
- .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon {
1215
- margin: auto;
1216
- }
1217
-
1218
- .components-button.block-editor-block-switcher__no-switcher-icon {
1219
- display: flex;
1220
- }
1221
- .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon {
1222
- margin-right: auto;
1223
- margin-left: auto;
1224
- min-width: 24px !important;
1225
- }
1226
-
1227
- .components-button.block-editor-block-switcher__no-switcher-icon[aria-disabled=true] {
1228
- color: #1e1e1e;
1229
- }
1230
- .components-button.block-editor-block-switcher__no-switcher-icon[aria-disabled=true]:hover {
1231
- color: #1e1e1e;
1232
- }
1233
-
1234
1211
  .components-popover.block-editor-block-switcher__popover .components-popover__content {
1235
1212
  min-width: 300px;
1236
1213
  }
@@ -1274,25 +1251,6 @@ iframe[name=editor-canvas] {
1274
1251
  font-weight: 499;
1275
1252
  }
1276
1253
 
1277
- .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon {
1278
- min-width: 36px;
1279
- }
1280
- .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon,
1281
- .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle {
1282
- height: 48px;
1283
- }
1284
- .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-icon,
1285
- .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-switcher__transform,
1286
- .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle .block-editor-block-icon,
1287
- .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle .block-editor-block-switcher__transform {
1288
- width: 48px;
1289
- height: 48px;
1290
- }
1291
- .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__no-switcher-icon .block-editor-block-switcher__transform,
1292
- .block-editor-block-contextual-toolbar .components-button.block-editor-block-switcher__toggle .block-editor-block-switcher__transform {
1293
- padding: 12px;
1294
- }
1295
-
1296
1254
  .block-editor-block-switcher__preview-patterns-container {
1297
1255
  padding-bottom: 16px;
1298
1256
  }
@@ -3554,10 +3512,13 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
3554
3512
  background: color-mix(in srgb, var(--wp-block-synced-color) 10%, transparent);
3555
3513
  border-radius: 2px;
3556
3514
  }
3557
- .block-editor-block-toolbar.is-synced .block-editor-block-switcher .components-button .block-editor-block-icon, .block-editor-block-toolbar.is-connected .block-editor-block-switcher .components-button .block-editor-block-icon {
3558
- color: var(--wp-block-synced-color);
3515
+ .block-editor-block-toolbar .components-button.block-editor-block-toolbar__block-icon-button[aria-disabled=true] {
3516
+ color: #1e1e1e;
3517
+ }
3518
+ .block-editor-block-toolbar .components-button.block-editor-block-toolbar__block-icon-button[aria-disabled=true]:hover {
3519
+ color: #1e1e1e;
3559
3520
  }
3560
- .block-editor-block-toolbar.is-synced .block-editor-block-switcher__no-switcher-icon[aria-disabled=true] .block-editor-block-icon, .block-editor-block-toolbar.is-connected .block-editor-block-switcher__no-switcher-icon[aria-disabled=true] .block-editor-block-icon {
3521
+ .block-editor-block-toolbar.is-synced .block-editor-block-toolbar__block-icon, .block-editor-block-toolbar.is-connected .block-editor-block-toolbar__block-icon {
3561
3522
  color: var(--wp-block-synced-color);
3562
3523
  }
3563
3524
  .block-editor-block-toolbar > :last-child,
@@ -3651,15 +3612,15 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
3651
3612
  width: 2px;
3652
3613
  }
3653
3614
 
3654
- .block-editor-block-toolbar__block-controls .block-editor-block-switcher .components-dropdown-menu__toggle .block-editor-block-icon,
3655
- .block-editor-block-toolbar__block-controls .block-editor-block-switcher__no-switcher-icon .block-editor-block-icon {
3656
- width: 24px !important;
3657
- margin: 0 !important;
3658
- }
3659
3615
  .block-editor-block-toolbar__block-controls .components-toolbar-group {
3660
3616
  padding: 0;
3661
3617
  }
3662
3618
 
3619
+ .block-editor-block-toolbar__pattern-overrides-popover .components-popover__content {
3620
+ min-width: 260px;
3621
+ padding: 16px;
3622
+ }
3623
+
3663
3624
  .block-editor-block-toolbar .components-toolbar-group,
3664
3625
  .block-editor-block-toolbar .components-toolbar,
3665
3626
  .block-editor-rich-text__inline-format-toolbar-group .components-toolbar-group,
@@ -3686,8 +3647,7 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
3686
3647
  padding-left: 6px;
3687
3648
  padding-right: 6px;
3688
3649
  }
3689
- .show-icon-labels .block-editor-block-switcher .components-dropdown-menu__toggle .block-editor-block-icon,
3690
- .show-icon-labels .block-editor-block-switcher__no-switcher-icon .block-editor-block-icon {
3650
+ .show-icon-labels .block-editor-block-icon {
3691
3651
  width: 0 !important;
3692
3652
  height: 0 !important;
3693
3653
  min-width: 0 !important;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "15.7.1-next.2f1c7c01b.0",
3
+ "version": "15.8.0",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -55,41 +55,41 @@
55
55
  "@emotion/react": "^11.7.1",
56
56
  "@emotion/styled": "^11.6.0",
57
57
  "@react-spring/web": "^9.4.5",
58
- "@wordpress/a11y": "^4.34.1-next.2f1c7c01b.0",
59
- "@wordpress/api-fetch": "^7.34.1-next.2f1c7c01b.0",
60
- "@wordpress/base-styles": "^6.10.1-next.2f1c7c01b.0",
61
- "@wordpress/blob": "^4.34.1-next.2f1c7c01b.0",
62
- "@wordpress/block-serialization-default-parser": "^5.34.1-next.2f1c7c01b.0",
63
- "@wordpress/blocks": "^15.7.1-next.2f1c7c01b.0",
64
- "@wordpress/commands": "^1.34.1-next.2f1c7c01b.0",
65
- "@wordpress/components": "^30.7.2-next.2f1c7c01b.0",
66
- "@wordpress/compose": "^7.34.1-next.2f1c7c01b.0",
67
- "@wordpress/data": "^10.34.1-next.2f1c7c01b.0",
68
- "@wordpress/date": "^5.34.1-next.2f1c7c01b.0",
69
- "@wordpress/deprecated": "^4.34.1-next.2f1c7c01b.0",
70
- "@wordpress/dom": "^4.34.1-next.2f1c7c01b.0",
71
- "@wordpress/element": "^6.34.1-next.2f1c7c01b.0",
72
- "@wordpress/escape-html": "^3.34.1-next.2f1c7c01b.0",
73
- "@wordpress/global-styles-engine": "^1.1.1-next.2f1c7c01b.0",
74
- "@wordpress/hooks": "^4.34.1-next.2f1c7c01b.0",
75
- "@wordpress/html-entities": "^4.34.1-next.2f1c7c01b.0",
76
- "@wordpress/i18n": "^6.7.1-next.2f1c7c01b.0",
77
- "@wordpress/icons": "^11.1.1-next.2f1c7c01b.0",
78
- "@wordpress/interactivity": "^6.34.1-next.2f1c7c01b.0",
79
- "@wordpress/is-shallow-equal": "^5.34.1-next.2f1c7c01b.0",
80
- "@wordpress/keyboard-shortcuts": "^5.34.1-next.2f1c7c01b.0",
81
- "@wordpress/keycodes": "^4.34.1-next.2f1c7c01b.0",
82
- "@wordpress/notices": "^5.34.1-next.2f1c7c01b.0",
83
- "@wordpress/preferences": "^4.34.1-next.2f1c7c01b.0",
84
- "@wordpress/priority-queue": "^3.34.1-next.2f1c7c01b.0",
85
- "@wordpress/private-apis": "^1.34.1-next.2f1c7c01b.0",
86
- "@wordpress/rich-text": "^7.34.1-next.2f1c7c01b.0",
87
- "@wordpress/style-engine": "^2.34.1-next.2f1c7c01b.0",
88
- "@wordpress/token-list": "^3.34.1-next.2f1c7c01b.0",
89
- "@wordpress/upload-media": "^0.19.1-next.2f1c7c01b.0",
90
- "@wordpress/url": "^4.34.1-next.2f1c7c01b.0",
91
- "@wordpress/warning": "^3.34.1-next.2f1c7c01b.0",
92
- "@wordpress/wordcount": "^4.34.1-next.2f1c7c01b.0",
58
+ "@wordpress/a11y": "^4.35.0",
59
+ "@wordpress/api-fetch": "^7.35.0",
60
+ "@wordpress/base-styles": "^6.11.0",
61
+ "@wordpress/blob": "^4.35.0",
62
+ "@wordpress/block-serialization-default-parser": "^5.35.0",
63
+ "@wordpress/blocks": "^15.8.0",
64
+ "@wordpress/commands": "^1.35.0",
65
+ "@wordpress/components": "^30.8.0",
66
+ "@wordpress/compose": "^7.35.0",
67
+ "@wordpress/data": "^10.35.0",
68
+ "@wordpress/date": "^5.35.0",
69
+ "@wordpress/deprecated": "^4.35.0",
70
+ "@wordpress/dom": "^4.35.0",
71
+ "@wordpress/element": "^6.35.0",
72
+ "@wordpress/escape-html": "^3.35.0",
73
+ "@wordpress/global-styles-engine": "^1.2.0",
74
+ "@wordpress/hooks": "^4.35.0",
75
+ "@wordpress/html-entities": "^4.35.0",
76
+ "@wordpress/i18n": "^6.8.0",
77
+ "@wordpress/icons": "^11.2.0",
78
+ "@wordpress/interactivity": "^6.35.0",
79
+ "@wordpress/is-shallow-equal": "^5.35.0",
80
+ "@wordpress/keyboard-shortcuts": "^5.35.0",
81
+ "@wordpress/keycodes": "^4.35.0",
82
+ "@wordpress/notices": "^5.35.0",
83
+ "@wordpress/preferences": "^4.35.0",
84
+ "@wordpress/priority-queue": "^3.35.0",
85
+ "@wordpress/private-apis": "^1.35.0",
86
+ "@wordpress/rich-text": "^7.35.0",
87
+ "@wordpress/style-engine": "^2.35.0",
88
+ "@wordpress/token-list": "^3.35.0",
89
+ "@wordpress/upload-media": "^0.20.0",
90
+ "@wordpress/url": "^4.35.0",
91
+ "@wordpress/warning": "^3.35.0",
92
+ "@wordpress/wordcount": "^4.35.0",
93
93
  "change-case": "^4.1.2",
94
94
  "clsx": "^2.1.1",
95
95
  "colord": "^2.7.0",
@@ -112,5 +112,5 @@
112
112
  "publishConfig": {
113
113
  "access": "public"
114
114
  },
115
- "gitHead": "c6ddcdf455bc02567a2c9e03de6862a2061b85e8"
115
+ "gitHead": "77aa1f194edceafe8ac2a1b9438bf84b557e76e3"
116
116
  }
@@ -8,6 +8,7 @@ import clsx from 'clsx';
8
8
  */
9
9
  import {
10
10
  Button,
11
+ Icon,
11
12
  __experimentalText as Text,
12
13
  __experimentalVStack as VStack,
13
14
  privateApis as componentsPrivateApis,
@@ -15,7 +16,12 @@ import {
15
16
  import { useDispatch, useSelect } from '@wordpress/data';
16
17
  import deprecated from '@wordpress/deprecated';
17
18
  import { __, isRTL } from '@wordpress/i18n';
18
- import { chevronLeft, chevronRight } from '@wordpress/icons';
19
+ import {
20
+ chevronLeft,
21
+ chevronRight,
22
+ arrowRight,
23
+ arrowLeft,
24
+ } from '@wordpress/icons';
19
25
 
20
26
  /**
21
27
  * Internal dependencies
@@ -26,6 +32,22 @@ import BlockIcon from '../block-icon';
26
32
 
27
33
  const { Badge } = unlock( componentsPrivateApis );
28
34
 
35
+ function OptionalParentSelectButton( { children, onClick } ) {
36
+ if ( ! onClick ) {
37
+ return children;
38
+ }
39
+
40
+ return (
41
+ <Button
42
+ __next40pxDefaultSize
43
+ className="block-editor-block-card__parent-select-button"
44
+ onClick={ onClick }
45
+ >
46
+ { children }
47
+ </Button>
48
+ );
49
+ }
50
+
29
51
  /**
30
52
  * A card component that displays block information including title, icon, and description.
31
53
  * Can be used to show block metadata and navigation controls for parent blocks.
@@ -54,6 +76,9 @@ const { Badge } = unlock( componentsPrivateApis );
54
76
  * @param {string} [props.className] Additional classes to apply to the card.
55
77
  * @param {string} [props.name] Custom block name to display before the title.
56
78
  * @param {string} [props.allowParentNavigation] Show a back arrow to the parent block in some situations.
79
+ * @param {string} [props.parentClientId] The parent clientId, if this card is for a parent block.
80
+ * @param {string} [props.isChild] Whether the block card is for a child block, in which case, indent the block using an arrow.
81
+ * @param {string} [props.clientId] Whether the block card is for a child block, in which case, indent the block using an arrow.
57
82
  * @param {Element} [props.children] Children.
58
83
  * @return {Element} Block card component.
59
84
  */
@@ -65,7 +90,10 @@ function BlockCard( {
65
90
  className,
66
91
  name,
67
92
  allowParentNavigation,
93
+ parentClientId,
94
+ isChild,
68
95
  children,
96
+ clientId,
69
97
  } ) {
70
98
  if ( blockType ) {
71
99
  deprecated( '`blockType` property in `BlockCard component`', {
@@ -77,56 +105,85 @@ function BlockCard( {
77
105
 
78
106
  const parentNavBlockClientId = useSelect(
79
107
  ( select ) => {
80
- if ( ! allowParentNavigation ) {
108
+ if ( parentClientId || isChild || ! allowParentNavigation ) {
81
109
  return;
82
110
  }
83
- const { getSelectedBlockClientId, getBlockParentsByBlockName } =
84
- select( blockEditorStore );
85
-
86
- const _selectedBlockClientId = getSelectedBlockClientId();
111
+ const { getBlockParentsByBlockName } = select( blockEditorStore );
87
112
 
88
113
  return getBlockParentsByBlockName(
89
- _selectedBlockClientId,
114
+ clientId,
90
115
  'core/navigation',
91
116
  true
92
117
  )[ 0 ];
93
118
  },
94
- [ allowParentNavigation ]
119
+ [ clientId, allowParentNavigation, isChild, parentClientId ]
95
120
  );
96
121
 
97
122
  const { selectBlock } = useDispatch( blockEditorStore );
98
123
 
124
+ const TitleElement = parentClientId ? 'div' : 'h2';
125
+
99
126
  return (
100
- <div className={ clsx( 'block-editor-block-card', className ) }>
101
- { allowParentNavigation &&
102
- parentNavBlockClientId && ( // This is only used by the Navigation block for now. It's not ideal having Navigation block specific code here.
103
- <Button
104
- onClick={ () => selectBlock( parentNavBlockClientId ) }
105
- label={ __( 'Go to parent Navigation block' ) }
106
- style={
107
- // TODO: This style override is also used in ToolsPanelHeader.
108
- // It should be supported out-of-the-box by Button.
109
- { minWidth: 24, padding: 0 }
110
- }
111
- icon={ isRTL() ? chevronRight : chevronLeft }
112
- size="small"
113
- />
114
- ) }
115
- <BlockIcon icon={ icon } showColors />
116
- <VStack spacing={ 1 }>
117
- <h2 className="block-editor-block-card__title">
118
- <span className="block-editor-block-card__name">
119
- { !! name?.length ? name : title }
120
- </span>
121
- { !! name?.length && <Badge>{ title }</Badge> }
122
- </h2>
123
- { description && (
124
- <Text className="block-editor-block-card__description">
125
- { description }
126
- </Text>
127
- ) }
128
- { children }
129
- </VStack>
127
+ <div
128
+ className={ clsx(
129
+ 'block-editor-block-card',
130
+ {
131
+ 'is-parent': parentClientId,
132
+ 'is-child': isChild,
133
+ },
134
+ className
135
+ ) }
136
+ >
137
+ { parentNavBlockClientId && ( // This is only used by the Navigation block for now. It's not ideal having Navigation block specific code here.
138
+ <Button
139
+ onClick={ () => selectBlock( parentNavBlockClientId ) }
140
+ label={
141
+ parentNavBlockClientId
142
+ ? __( 'Go to parent Navigation block' )
143
+ : // TODO - improve copy, not sure that we should use the term 'section'
144
+ __( 'Go to parent section' )
145
+ }
146
+ style={
147
+ // TODO: This style override is also used in ToolsPanelHeader.
148
+ // It should be supported out-of-the-box by Button.
149
+ { minWidth: 24, padding: 0 }
150
+ }
151
+ icon={ isRTL() ? chevronRight : chevronLeft }
152
+ size="small"
153
+ />
154
+ ) }
155
+ { isChild && (
156
+ <span className="block-editor-block-card__child-indicator-icon">
157
+ <Icon icon={ isRTL() ? arrowLeft : arrowRight } />
158
+ </span>
159
+ ) }
160
+ <OptionalParentSelectButton
161
+ onClick={
162
+ parentClientId
163
+ ? () => {
164
+ selectBlock( parentClientId );
165
+ }
166
+ : undefined
167
+ }
168
+ >
169
+ <BlockIcon icon={ icon } showColors />
170
+ <VStack spacing={ 1 }>
171
+ <TitleElement className="block-editor-block-card__title">
172
+ <span className="block-editor-block-card__name">
173
+ { !! name?.length ? name : title }
174
+ </span>
175
+ { ! parentClientId && ! isChild && !! name?.length && (
176
+ <Badge>{ title }</Badge>
177
+ ) }
178
+ </TitleElement>
179
+ { ! parentClientId && ! isChild && description && (
180
+ <Text className="block-editor-block-card__description">
181
+ { description }
182
+ </Text>
183
+ ) }
184
+ { children }
185
+ </VStack>
186
+ </OptionalParentSelectButton>
130
187
  </div>
131
188
  );
132
189
  }