@wordpress/block-library 8.33.0 → 8.34.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 (259) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/block/edit.js +15 -8
  3. package/build/block/edit.js.map +1 -1
  4. package/build/block-keyboard-shortcuts/index.js +95 -0
  5. package/build/block-keyboard-shortcuts/index.js.map +1 -0
  6. package/build/column/edit.js +28 -19
  7. package/build/column/edit.js.map +1 -1
  8. package/build/column/edit.native.js +3 -1
  9. package/build/column/edit.native.js.map +1 -1
  10. package/build/columns/edit.js +69 -53
  11. package/build/columns/edit.js.map +1 -1
  12. package/build/columns/variations.js +18 -28
  13. package/build/columns/variations.js.map +1 -1
  14. package/build/comment-template/util.js +3 -1
  15. package/build/comment-template/util.js.map +1 -1
  16. package/build/cover/shared.js +3 -1
  17. package/build/cover/shared.js.map +1 -1
  18. package/build/embed/embed-placeholder.js +8 -3
  19. package/build/embed/embed-placeholder.js.map +1 -1
  20. package/build/embed/util.js +3 -1
  21. package/build/embed/util.js.map +1 -1
  22. package/build/embed/variations.js +3 -1
  23. package/build/embed/variations.js.map +1 -1
  24. package/build/embed/wp-embed-preview.js +6 -2
  25. package/build/embed/wp-embed-preview.js.map +1 -1
  26. package/build/group/index.js +0 -8
  27. package/build/group/index.js.map +1 -1
  28. package/build/group/placeholder.js +18 -19
  29. package/build/group/placeholder.js.map +1 -1
  30. package/build/image/image.js +3 -1
  31. package/build/image/image.js.map +1 -1
  32. package/build/image/view.js +3 -1
  33. package/build/image/view.js.map +1 -1
  34. package/build/index.js +9 -1
  35. package/build/index.js.map +1 -1
  36. package/build/list-item/hooks/use-merge.js +12 -4
  37. package/build/list-item/hooks/use-merge.js.map +1 -1
  38. package/build/list-item/hooks/use-outdent-list-item.js +15 -5
  39. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
  40. package/build/navigation/edit/are-blocks-dirty.js +9 -3
  41. package/build/navigation/edit/are-blocks-dirty.js.map +1 -1
  42. package/build/navigation/edit/deleted-navigation-warning.js +1 -1
  43. package/build/navigation/edit/deleted-navigation-warning.js.map +1 -1
  44. package/build/navigation/edit/menu-inspector-controls.js +3 -1
  45. package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
  46. package/build/navigation/edit/navigation-menu-selector.js +1 -1
  47. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  48. package/build/navigation/index.js +0 -9
  49. package/build/navigation/index.js.map +1 -1
  50. package/build/navigation/view.js +3 -1
  51. package/build/navigation/view.js.map +1 -1
  52. package/build/navigation-link/edit.js +94 -85
  53. package/build/navigation-link/edit.js.map +1 -1
  54. package/build/navigation-link/link-ui.js +2 -7
  55. package/build/navigation-link/link-ui.js.map +1 -1
  56. package/build/paragraph/index.js +0 -1
  57. package/build/paragraph/index.js.map +1 -1
  58. package/build/paragraph/transforms.js +0 -1
  59. package/build/paragraph/transforms.js.map +1 -1
  60. package/build/post-excerpt/edit.js +3 -1
  61. package/build/post-excerpt/edit.js.map +1 -1
  62. package/build/post-featured-image/dimension-controls.js +3 -1
  63. package/build/post-featured-image/dimension-controls.js.map +1 -1
  64. package/build/post-navigation-link/variations.js +3 -1
  65. package/build/post-navigation-link/variations.js.map +1 -1
  66. package/build/post-template/edit.js +18 -8
  67. package/build/post-template/edit.js.map +1 -1
  68. package/build/post-terms/edit.js +3 -1
  69. package/build/post-terms/edit.js.map +1 -1
  70. package/build/private-apis.js +21 -0
  71. package/build/private-apis.js.map +1 -0
  72. package/build/query/edit/enhanced-pagination-modal.js +1 -1
  73. package/build/query/edit/enhanced-pagination-modal.js.map +1 -1
  74. package/build/query/edit/inspector-controls/author-control.js +6 -2
  75. package/build/query/edit/inspector-controls/author-control.js.map +1 -1
  76. package/build/query/edit/inspector-controls/create-new-post-link.js +3 -1
  77. package/build/query/edit/inspector-controls/create-new-post-link.js.map +1 -1
  78. package/build/query/edit/inspector-controls/enhanced-pagination-control.js +6 -3
  79. package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  80. package/build/query/edit/inspector-controls/parent-control.js +18 -6
  81. package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
  82. package/build/query/edit/inspector-controls/taxonomy-controls.js +9 -3
  83. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  84. package/build/query/utils.js +3 -1
  85. package/build/query/utils.js.map +1 -1
  86. package/build/query-title/variations.js +3 -1
  87. package/build/query-title/variations.js.map +1 -1
  88. package/build/social-link/edit.js +1 -1
  89. package/build/social-link/edit.js.map +1 -1
  90. package/build/social-link/variations.js +3 -1
  91. package/build/social-link/variations.js.map +1 -1
  92. package/build/template-part/variations.js +6 -2
  93. package/build/template-part/variations.js.map +1 -1
  94. package/build-module/block/edit.js +15 -8
  95. package/build-module/block/edit.js.map +1 -1
  96. package/build-module/block-keyboard-shortcuts/index.js +88 -0
  97. package/build-module/block-keyboard-shortcuts/index.js.map +1 -0
  98. package/build-module/column/edit.js +28 -19
  99. package/build-module/column/edit.js.map +1 -1
  100. package/build-module/column/edit.native.js +3 -1
  101. package/build-module/column/edit.native.js.map +1 -1
  102. package/build-module/columns/edit.js +69 -53
  103. package/build-module/columns/edit.js.map +1 -1
  104. package/build-module/columns/variations.js +18 -28
  105. package/build-module/columns/variations.js.map +1 -1
  106. package/build-module/comment-template/util.js +3 -1
  107. package/build-module/comment-template/util.js.map +1 -1
  108. package/build-module/cover/shared.js +3 -1
  109. package/build-module/cover/shared.js.map +1 -1
  110. package/build-module/embed/embed-placeholder.js +9 -4
  111. package/build-module/embed/embed-placeholder.js.map +1 -1
  112. package/build-module/embed/util.js +3 -1
  113. package/build-module/embed/util.js.map +1 -1
  114. package/build-module/embed/variations.js +3 -1
  115. package/build-module/embed/variations.js.map +1 -1
  116. package/build-module/embed/wp-embed-preview.js +6 -2
  117. package/build-module/embed/wp-embed-preview.js.map +1 -1
  118. package/build-module/group/index.js +0 -8
  119. package/build-module/group/index.js.map +1 -1
  120. package/build-module/group/placeholder.js +18 -19
  121. package/build-module/group/placeholder.js.map +1 -1
  122. package/build-module/image/image.js +3 -1
  123. package/build-module/image/image.js.map +1 -1
  124. package/build-module/image/view.js +3 -1
  125. package/build-module/image/view.js.map +1 -1
  126. package/build-module/index.js +1 -0
  127. package/build-module/index.js.map +1 -1
  128. package/build-module/list-item/hooks/use-merge.js +12 -4
  129. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  130. package/build-module/list-item/hooks/use-outdent-list-item.js +15 -5
  131. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
  132. package/build-module/navigation/edit/are-blocks-dirty.js +9 -3
  133. package/build-module/navigation/edit/are-blocks-dirty.js.map +1 -1
  134. package/build-module/navigation/edit/deleted-navigation-warning.js +1 -1
  135. package/build-module/navigation/edit/deleted-navigation-warning.js.map +1 -1
  136. package/build-module/navigation/edit/menu-inspector-controls.js +3 -1
  137. package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
  138. package/build-module/navigation/edit/navigation-menu-selector.js +1 -1
  139. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  140. package/build-module/navigation/index.js +0 -9
  141. package/build-module/navigation/index.js.map +1 -1
  142. package/build-module/navigation/view.js +3 -1
  143. package/build-module/navigation/view.js.map +1 -1
  144. package/build-module/navigation-link/edit.js +94 -85
  145. package/build-module/navigation-link/edit.js.map +1 -1
  146. package/build-module/navigation-link/link-ui.js +3 -8
  147. package/build-module/navigation-link/link-ui.js.map +1 -1
  148. package/build-module/paragraph/index.js +0 -1
  149. package/build-module/paragraph/index.js.map +1 -1
  150. package/build-module/paragraph/transforms.js +0 -1
  151. package/build-module/paragraph/transforms.js.map +1 -1
  152. package/build-module/post-excerpt/edit.js +3 -1
  153. package/build-module/post-excerpt/edit.js.map +1 -1
  154. package/build-module/post-featured-image/dimension-controls.js +3 -1
  155. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  156. package/build-module/post-navigation-link/variations.js +3 -1
  157. package/build-module/post-navigation-link/variations.js.map +1 -1
  158. package/build-module/post-template/edit.js +18 -8
  159. package/build-module/post-template/edit.js.map +1 -1
  160. package/build-module/post-terms/edit.js +3 -1
  161. package/build-module/post-terms/edit.js.map +1 -1
  162. package/build-module/private-apis.js +14 -0
  163. package/build-module/private-apis.js.map +1 -0
  164. package/build-module/query/edit/enhanced-pagination-modal.js +1 -1
  165. package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
  166. package/build-module/query/edit/inspector-controls/author-control.js +6 -2
  167. package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
  168. package/build-module/query/edit/inspector-controls/create-new-post-link.js +3 -1
  169. package/build-module/query/edit/inspector-controls/create-new-post-link.js.map +1 -1
  170. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +6 -3
  171. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  172. package/build-module/query/edit/inspector-controls/parent-control.js +18 -6
  173. package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
  174. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +9 -3
  175. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  176. package/build-module/query/utils.js +3 -1
  177. package/build-module/query/utils.js.map +1 -1
  178. package/build-module/query-title/variations.js +3 -1
  179. package/build-module/query-title/variations.js.map +1 -1
  180. package/build-module/social-link/edit.js +1 -1
  181. package/build-module/social-link/edit.js.map +1 -1
  182. package/build-module/social-link/variations.js +3 -1
  183. package/build-module/social-link/variations.js.map +1 -1
  184. package/build-module/template-part/variations.js +6 -2
  185. package/build-module/template-part/variations.js.map +1 -1
  186. package/build-style/editor-rtl.css +15 -49
  187. package/build-style/editor.css +15 -49
  188. package/build-style/embed/editor-rtl.css +0 -3
  189. package/build-style/embed/editor.css +0 -3
  190. package/build-style/group/editor-rtl.css +0 -44
  191. package/build-style/group/editor.css +0 -44
  192. package/build-style/group/style-rtl.css +4 -0
  193. package/build-style/group/style.css +4 -0
  194. package/build-style/navigation-link/style-rtl.css +0 -8
  195. package/build-style/navigation-link/style.css +0 -8
  196. package/build-style/post-featured-image/editor-rtl.css +1 -0
  197. package/build-style/post-featured-image/editor.css +1 -0
  198. package/build-style/site-logo/editor-rtl.css +1 -0
  199. package/build-style/site-logo/editor.css +1 -0
  200. package/build-style/social-link/editor-rtl.css +13 -2
  201. package/build-style/social-link/editor.css +13 -2
  202. package/build-style/style-rtl.css +4 -8
  203. package/build-style/style.css +4 -8
  204. package/package.json +35 -34
  205. package/src/block/edit.js +19 -12
  206. package/src/block-keyboard-shortcuts/index.js +113 -0
  207. package/src/column/edit.js +26 -20
  208. package/src/column/edit.native.js +3 -1
  209. package/src/columns/edit.js +93 -83
  210. package/src/columns/variations.js +12 -34
  211. package/src/comment-template/util.js +3 -1
  212. package/src/cover/shared.js +3 -1
  213. package/src/embed/editor.scss +0 -2
  214. package/src/embed/embed-placeholder.js +21 -9
  215. package/src/embed/util.js +3 -1
  216. package/src/embed/variations.js +3 -1
  217. package/src/embed/wp-embed-preview.js +6 -2
  218. package/src/gallery/test/helpers.native.js +3 -3
  219. package/src/group/editor.scss +0 -47
  220. package/src/group/index.js +0 -8
  221. package/src/group/placeholder.js +18 -18
  222. package/src/group/style.scss +5 -0
  223. package/src/image/image.js +3 -1
  224. package/src/image/view.js +3 -1
  225. package/src/index.js +2 -0
  226. package/src/list-item/hooks/use-merge.js +12 -4
  227. package/src/list-item/hooks/use-outdent-list-item.js +15 -5
  228. package/src/navigation/block.json +0 -9
  229. package/src/navigation/edit/are-blocks-dirty.js +8 -3
  230. package/src/navigation/edit/deleted-navigation-warning.js +1 -1
  231. package/src/navigation/edit/menu-inspector-controls.js +3 -1
  232. package/src/navigation/edit/navigation-menu-selector.js +1 -1
  233. package/src/navigation/edit/test/navigation-menu-selector.js +5 -5
  234. package/src/navigation/view.js +3 -1
  235. package/src/navigation-link/edit.js +91 -91
  236. package/src/navigation-link/link-ui.js +74 -89
  237. package/src/navigation-link/style.scss +0 -12
  238. package/src/paragraph/block.json +0 -1
  239. package/src/post-excerpt/edit.js +3 -1
  240. package/src/post-featured-image/dimension-controls.js +3 -1
  241. package/src/post-featured-image/editor.scss +1 -0
  242. package/src/post-navigation-link/variations.js +3 -1
  243. package/src/post-template/edit.js +9 -4
  244. package/src/post-terms/edit.js +3 -1
  245. package/src/private-apis.js +13 -0
  246. package/src/query/edit/enhanced-pagination-modal.js +5 -1
  247. package/src/query/edit/inspector-controls/author-control.js +6 -2
  248. package/src/query/edit/inspector-controls/create-new-post-link.js +3 -1
  249. package/src/query/edit/inspector-controls/enhanced-pagination-control.js +13 -3
  250. package/src/query/edit/inspector-controls/parent-control.js +18 -6
  251. package/src/query/edit/inspector-controls/taxonomy-controls.js +9 -3
  252. package/src/query/index.php +1 -1
  253. package/src/query/utils.js +3 -1
  254. package/src/query-title/variations.js +3 -1
  255. package/src/site-logo/editor.scss +1 -0
  256. package/src/social-link/edit.js +2 -2
  257. package/src/social-link/editor.scss +25 -11
  258. package/src/social-link/variations.js +3 -1
  259. package/src/template-part/variations.js +6 -2
@@ -368,7 +368,9 @@ const variations = [
368
368
  * Block by providing its attributes.
369
369
  */
370
370
  variations.forEach( ( variation ) => {
371
- if ( variation.isActive ) return;
371
+ if ( variation.isActive ) {
372
+ return;
373
+ }
372
374
  variation.isActive = ( blockAttributes, variationAttributes ) =>
373
375
  blockAttributes.providerNameSlug ===
374
376
  variationAttributes.providerNameSlug;
@@ -20,10 +20,14 @@ export default function WpEmbedPreview( { html } ) {
20
20
  const iframe = doc.querySelector( 'iframe' );
21
21
  const iframeProps = {};
22
22
 
23
- if ( ! iframe ) return iframeProps;
23
+ if ( ! iframe ) {
24
+ return iframeProps;
25
+ }
24
26
 
25
27
  Array.from( iframe.attributes ).forEach( ( { name, value } ) => {
26
- if ( name === 'style' ) return;
28
+ if ( name === 'style' ) {
29
+ return;
30
+ }
27
31
  iframeProps[ attributeMap[ name ] || name ] = value;
28
32
  } );
29
33
 
@@ -65,9 +65,9 @@ export const initializeWithGalleryBlock = async ( {
65
65
  /**
66
66
  * Gets a gallery item within a Gallery block.
67
67
  *
68
- * @param {import('react-test-renderer').ReactTestInstance} galleryBlock Gallery block instance.
69
- * @param {number} rowIndex Row position within the Gallery block.
70
- * @return {import('react-test-renderer').ReactTestInstance} Gallery item.
68
+ * @param {HTMLElement} galleryBlock Gallery block instance.
69
+ * @param {number} rowIndex Row position within the Gallery block.
70
+ * @return {HTMLElement} Gallery item.
71
71
  */
72
72
  export const getGalleryItem = ( galleryBlock, rowIndex ) =>
73
73
  getInnerBlock( galleryBlock, 'Image', { rowIndex } );
@@ -53,50 +53,3 @@
53
53
  }
54
54
  }
55
55
 
56
- .wp-block-group__placeholder {
57
- .wp-block-group-placeholder__variations {
58
- list-style: none;
59
- display: flex;
60
- justify-content: center;
61
- flex-direction: row;
62
- flex-wrap: wrap;
63
- width: 100%;
64
- padding: 0;
65
- margin: 0;
66
- }
67
- .components-placeholder__instructions {
68
- margin-bottom: 18px;
69
- }
70
- .wp-block-group-placeholder__variations svg {
71
- fill: $gray-400 !important;
72
- }
73
- .wp-block-group-placeholder__variations svg:hover {
74
- fill: var(--wp-admin-theme-color) !important;
75
- }
76
- .wp-block-group-placeholder__variations > li {
77
- margin: 0 $grid-unit-15 $grid-unit-15 $grid-unit-15;
78
- width: auto;
79
- display: flex;
80
- flex-direction: column;
81
- align-items: center;
82
- }
83
- .wp-block-group-placeholder__variations li > .wp-block-group-placeholder__variation-button {
84
- width: 44px;
85
- height: 32px;
86
- padding: 0;
87
- &:hover {
88
- box-shadow: none;
89
- }
90
- }
91
- .components-placeholder {
92
- min-height: auto;
93
- padding: $grid-unit-30;
94
- align-items: center;
95
- }
96
- .is-small,
97
- .is-medium {
98
- .wp-block-group-placeholder__variations > li {
99
- margin: $grid-unit-15;
100
- }
101
- }
102
- }
@@ -22,14 +22,6 @@ export { metadata, name };
22
22
  export const settings = {
23
23
  icon,
24
24
  example: {
25
- attributes: {
26
- style: {
27
- color: {
28
- text: '#000000',
29
- background: '#ffffff',
30
- },
31
- },
32
- },
33
25
  innerBlocks: [
34
26
  {
35
27
  name: 'core/paragraph',
@@ -20,42 +20,41 @@ const getGroupPlaceholderIcons = ( name = 'group' ) => {
20
20
  group: (
21
21
  <SVG
22
22
  xmlns="http://www.w3.org/2000/svg"
23
- width="44"
24
- height="32"
25
- viewBox="0 0 44 32"
23
+ width="48"
24
+ height="48"
25
+ viewBox="0 0 48 48"
26
26
  >
27
- <Path d="M42 0H2C.9 0 0 .9 0 2v28c0 1.1.9 2 2 2h40c1.1 0 2-.9 2-2V2c0-1.1-.9-2-2-2z" />
27
+ <Path d="M0 10a2 2 0 0 1 2-2h44a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Z" />
28
28
  </SVG>
29
29
  ),
30
30
  'group-row': (
31
31
  <SVG
32
32
  xmlns="http://www.w3.org/2000/svg"
33
- width="44"
34
- height="32"
35
- viewBox="0 0 44 32"
33
+ width="48"
34
+ height="48"
35
+ viewBox="0 0 48 48"
36
36
  >
37
- <Path d="M42 0H23.5c-.6 0-1 .4-1 1v30c0 .6.4 1 1 1H42c1.1 0 2-.9 2-2V2c0-1.1-.9-2-2-2zM20.5 0H2C.9 0 0 .9 0 2v28c0 1.1.9 2 2 2h18.5c.6 0 1-.4 1-1V1c0-.6-.4-1-1-1z" />
37
+ <Path d="M0 10a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Zm25 0a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H27a2 2 0 0 1-2-2V10Z" />
38
38
  </SVG>
39
39
  ),
40
40
  'group-stack': (
41
41
  <SVG
42
42
  xmlns="http://www.w3.org/2000/svg"
43
- width="44"
44
- height="32"
45
- viewBox="0 0 44 32"
43
+ width="48"
44
+ height="48"
45
+ viewBox="0 0 48 48"
46
46
  >
47
- <Path d="M42 0H2C.9 0 0 .9 0 2v12.5c0 .6.4 1 1 1h42c.6 0 1-.4 1-1V2c0-1.1-.9-2-2-2zm1 16.5H1c-.6 0-1 .4-1 1V30c0 1.1.9 2 2 2h40c1.1 0 2-.9 2-2V17.5c0-.6-.4-1-1-1z" />
47
+ <Path d="M0 10a2 2 0 0 1 2-2h44a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Zm0 17a2 2 0 0 1 2-2h44a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V27Z" />
48
48
  </SVG>
49
49
  ),
50
50
  'group-grid': (
51
51
  <SVG
52
52
  xmlns="http://www.w3.org/2000/svg"
53
- width="44"
54
- height="32"
55
- viewBox="0 0 44 32"
53
+ width="48"
54
+ height="48"
55
+ viewBox="0 0 48 48"
56
56
  >
57
- <Path d="m20.30137,-0.00025l-18.9728,0c-0.86524,0.07234 -1.41711,0.79149 -1.41711,1.89149l0,12.64468c0,0.6 0.73401,0.96383 1.0304,0.96383l19.67469,0.03617c0.29639,0 1.0304,-0.4 1.0304,-1l-0.03576,-12.7532c0,-1.1 -0.76644,-1.78297 -1.30983,-1.78297zm0.52975,16.60851l-19.99654,-0.03617c-0.29639,0 -0.92312,0.36383 -0.92312,0.96383l-0.03576,12.68085c0,1.1 0.8022,1.81915 1.34559,1.81915l19.00857,0c0.54339,0 1.45287,-0.71915 1.45287,-1.81915l0,-12.53617c0,-0.6 -0.5552,-1.07234 -0.8516,-1.07234z" />
58
- <Path d="m42.73056,-0.03617l-18.59217,0c-0.84788,0.07234 -1.38868,0.79149 -1.38868,1.89149l0,12.64468c0,0.6 0.71928,0.96383 1.00973,0.96383l19.27997,0.03617c0.29045,0 1.00973,-0.4 1.00973,-1l-0.03504,-12.7532c0,-1.1 -0.75106,-1.78297 -1.28355,-1.78297zm0.51912,16.60851l-19.59537,-0.03617c-0.29045,0 -0.9046,0.36383 -0.9046,0.96383l-0.03504,12.68085c0,1.1 0.78611,1.81915 1.31859,1.81915l18.62721,0c0.53249,0 1.42372,-0.71915 1.42372,-1.81915l0,-12.53617c0,-0.6 -0.54407,-1.07234 -0.83451,-1.07234z" />
57
+ <Path d="M0 10a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Zm25 0a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H27a2 2 0 0 1-2-2V10ZM0 27a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V27Zm25 0a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H27a2 2 0 0 1-2-2V27Z" />
59
58
  </SVG>
60
59
  ),
61
60
  };
@@ -159,11 +158,12 @@ function GroupPlaceHolder( { name, onSelect } ) {
159
158
  { variations.map( ( variation ) => (
160
159
  <li key={ variation.name }>
161
160
  <Button
161
+ __next40pxDefaultSize
162
162
  variant="tertiary"
163
163
  icon={ getGroupPlaceholderIcons(
164
164
  variation.name
165
165
  ) }
166
- iconSize={ 44 }
166
+ iconSize={ 48 }
167
167
  onClick={ () => onSelect( variation ) }
168
168
  className="wp-block-group-placeholder__variation-button"
169
169
  label={ `${ variation.title }: ${ variation.description }` }
@@ -2,3 +2,8 @@
2
2
  // This block has customizable padding, border-box makes that more predictable.
3
3
  box-sizing: border-box;
4
4
  }
5
+
6
+ // We need this so groups with negative margins overlap as expected.
7
+ :where(.wp-block-group.wp-block-group-is-layout-constrained) {
8
+ position: relative;
9
+ }
@@ -200,7 +200,9 @@ export default function Image( {
200
200
  return;
201
201
  }
202
202
 
203
- if ( externalBlob ) return;
203
+ if ( externalBlob ) {
204
+ return;
205
+ }
204
206
 
205
207
  window
206
208
  // Avoid cache, which seems to help avoid CORS problems.
package/src/image/view.js CHANGED
@@ -174,7 +174,9 @@ const { state, actions, callbacks } = store(
174
174
  },
175
175
  callbacks: {
176
176
  setOverlayStyles() {
177
- if ( ! imageRef ) return;
177
+ if ( ! imageRef ) {
178
+ return;
179
+ }
178
180
 
179
181
  let {
180
182
  naturalWidth,
package/src/index.js CHANGED
@@ -330,3 +330,5 @@ export const __experimentalRegisterExperimentalCoreBlocks = process.env
330
330
  .forEach( ( { init } ) => init() );
331
331
  }
332
332
  : undefined;
333
+
334
+ export { privateApis } from './private-apis';
@@ -35,8 +35,12 @@ export default function useMerge( clientId, onMerge ) {
35
35
  function getParentListItemId( id ) {
36
36
  const listId = getBlockRootClientId( id );
37
37
  const parentListItemId = getBlockRootClientId( listId );
38
- if ( ! parentListItemId ) return;
39
- if ( getBlockName( parentListItemId ) !== 'core/list-item' ) return;
38
+ if ( ! parentListItemId ) {
39
+ return;
40
+ }
41
+ if ( getBlockName( parentListItemId ) !== 'core/list-item' ) {
42
+ return;
43
+ }
40
44
  return parentListItemId;
41
45
  }
42
46
 
@@ -49,9 +53,13 @@ export default function useMerge( clientId, onMerge ) {
49
53
  */
50
54
  function _getNextId( id ) {
51
55
  const next = getNextBlockClientId( id );
52
- if ( next ) return next;
56
+ if ( next ) {
57
+ return next;
58
+ }
53
59
  const parentListItemId = getParentListItemId( id );
54
- if ( ! parentListItemId ) return;
60
+ if ( ! parentListItemId ) {
61
+ return;
62
+ }
55
63
  return _getNextId( parentListItemId );
56
64
  }
57
65
 
@@ -27,8 +27,12 @@ export default function useOutdentListItem() {
27
27
  function getParentListItemId( id ) {
28
28
  const listId = getBlockRootClientId( id );
29
29
  const parentListItemId = getBlockRootClientId( listId );
30
- if ( ! parentListItemId ) return;
31
- if ( getBlockName( parentListItemId ) !== 'core/list-item' ) return;
30
+ if ( ! parentListItemId ) {
31
+ return;
32
+ }
33
+ if ( getBlockName( parentListItemId ) !== 'core/list-item' ) {
34
+ return;
35
+ }
32
36
  return parentListItemId;
33
37
  }
34
38
 
@@ -37,17 +41,23 @@ export default function useOutdentListItem() {
37
41
  clientIds = [ clientIds ];
38
42
  }
39
43
 
40
- if ( ! clientIds.length ) return;
44
+ if ( ! clientIds.length ) {
45
+ return;
46
+ }
41
47
 
42
48
  const firstClientId = clientIds[ 0 ];
43
49
 
44
50
  // Can't outdent if it's not a list item.
45
- if ( getBlockName( firstClientId ) !== 'core/list-item' ) return;
51
+ if ( getBlockName( firstClientId ) !== 'core/list-item' ) {
52
+ return;
53
+ }
46
54
 
47
55
  const parentListItemId = getParentListItemId( firstClientId );
48
56
 
49
57
  // Can't outdent if it's at the top level.
50
- if ( ! parentListItemId ) return;
58
+ if ( ! parentListItemId ) {
59
+ return;
60
+ }
51
61
 
52
62
  const parentListId = getBlockRootClientId( firstClientId );
53
63
  const lastClientId = clientIds[ clientIds.length - 1 ];
@@ -137,15 +137,6 @@
137
137
  "type": "flex"
138
138
  }
139
139
  },
140
- "__experimentalStyle": {
141
- "elements": {
142
- "link": {
143
- "color": {
144
- "text": "inherit"
145
- }
146
- }
147
- }
148
- },
149
140
  "interactivity": true,
150
141
  "renaming": false
151
142
  },
@@ -30,7 +30,9 @@ const isDeepEqual = ( x, y, shouldSkip ) => {
30
30
  y !== null &&
31
31
  y !== undefined
32
32
  ) {
33
- if ( Object.keys( x ).length !== Object.keys( y ).length ) return false;
33
+ if ( Object.keys( x ).length !== Object.keys( y ).length ) {
34
+ return false;
35
+ }
34
36
 
35
37
  for ( const prop in x ) {
36
38
  if ( y.hasOwnProperty( prop ) ) {
@@ -39,9 +41,12 @@ const isDeepEqual = ( x, y, shouldSkip ) => {
39
41
  return true;
40
42
  }
41
43
 
42
- if ( ! isDeepEqual( x[ prop ], y[ prop ], shouldSkip ) )
44
+ if ( ! isDeepEqual( x[ prop ], y[ prop ], shouldSkip ) ) {
43
45
  return false;
44
- } else return false;
46
+ }
47
+ } else {
48
+ return false;
49
+ }
45
50
  }
46
51
 
47
52
  return true;
@@ -11,7 +11,7 @@ function DeletedNavigationWarning( { onCreateNew } ) {
11
11
  <Warning>
12
12
  { createInterpolateElement(
13
13
  __(
14
- 'Navigation Menu has been deleted or is unavailable. <button>Create a new menu?</button>'
14
+ 'Navigation Menu has been deleted or is unavailable. <button>Create a new Menu?</button>'
15
15
  ),
16
16
  {
17
17
  button: <Button onClick={ onCreateNew } variant="link" />,
@@ -49,7 +49,9 @@ function AdditionalBlockContent( { block, insertedBlock, setInsertedBlock } ) {
49
49
 
50
50
  const setInsertedBlockAttributes =
51
51
  ( _insertedBlockClientId ) => ( _updatedAttributes ) => {
52
- if ( ! _insertedBlockClientId ) return;
52
+ if ( ! _insertedBlockClientId ) {
53
+ return;
54
+ }
53
55
  updateBlockAttributes( _insertedBlockClientId, _updatedAttributes );
54
56
  };
55
57
 
@@ -202,7 +202,7 @@ function NavigationMenuSelector( {
202
202
  ! hasResolvedNavigationMenus
203
203
  }
204
204
  >
205
- { __( 'Create new menu' ) }
205
+ { __( 'Create new Menu' ) }
206
206
  </MenuItem>
207
207
  </MenuGroup>
208
208
  ) }
@@ -191,7 +191,7 @@ describe( 'NavigationMenuSelector', () => {
191
191
  expect( toolsGroup ).toBeInTheDocument();
192
192
 
193
193
  const createMenuButton = screen.getByRole( 'menuitem', {
194
- name: 'Create new menu',
194
+ name: 'Create new Menu',
195
195
  } );
196
196
 
197
197
  expect( createMenuButton ).toBeInTheDocument();
@@ -236,7 +236,7 @@ describe( 'NavigationMenuSelector', () => {
236
236
  await user.click( toggleButton );
237
237
 
238
238
  const createMenuButton = screen.getByRole( 'menuitem', {
239
- name: 'Create new menu',
239
+ name: 'Create new Menu',
240
240
  } );
241
241
 
242
242
  await user.click( createMenuButton );
@@ -268,7 +268,7 @@ describe( 'NavigationMenuSelector', () => {
268
268
 
269
269
  await user.click(
270
270
  screen.getByRole( 'menuitem', {
271
- name: 'Create new menu',
271
+ name: 'Create new Menu',
272
272
  } )
273
273
  );
274
274
 
@@ -293,7 +293,7 @@ describe( 'NavigationMenuSelector', () => {
293
293
  // Check the "Create menu" button is disabled.
294
294
  expect(
295
295
  screen.queryByRole( 'menuitem', {
296
- name: 'Create new menu',
296
+ name: 'Create new Menu',
297
297
  } )
298
298
  ).toBeDisabled();
299
299
 
@@ -318,7 +318,7 @@ describe( 'NavigationMenuSelector', () => {
318
318
  // Check the button is enabled again.
319
319
  expect(
320
320
  screen.queryByRole( 'menuitem', {
321
- name: 'Create new menu',
321
+ name: 'Create new Menu',
322
322
  } )
323
323
  ).toBeEnabled();
324
324
  } );
@@ -94,7 +94,9 @@ const { state, actions } = store(
94
94
  const ctx = getContext();
95
95
  const { ref } = getElement();
96
96
  // Safari won't send focus to the clicked element, so we need to manually place it: https://bugs.webkit.org/show_bug.cgi?id=22261
97
- if ( window.document.activeElement !== ref ) ref.focus();
97
+ if ( window.document.activeElement !== ref ) {
98
+ ref.focus();
99
+ }
98
100
  const { menuOpenedBy } = state;
99
101
  if ( menuOpenedBy.click || menuOpenedBy.focus ) {
100
102
  actions.closeMenu( 'click' );
@@ -153,6 +153,82 @@ function getMissingText( type ) {
153
153
  return missingText;
154
154
  }
155
155
 
156
+ /*
157
+ * Warning, this duplicated in
158
+ * packages/block-library/src/navigation-submenu/edit.js
159
+ * Consider reuseing this components for both blocks.
160
+ */
161
+ function Controls( { attributes, setAttributes, setIsLabelFieldFocused } ) {
162
+ const { label, url, description, title, rel } = attributes;
163
+ return (
164
+ <PanelBody title={ __( 'Settings' ) }>
165
+ <TextControl
166
+ __nextHasNoMarginBottom
167
+ __next40pxDefaultSize
168
+ value={ label ? stripHTML( label ) : '' }
169
+ onChange={ ( labelValue ) => {
170
+ setAttributes( { label: labelValue } );
171
+ } }
172
+ label={ __( 'Text' ) }
173
+ autoComplete="off"
174
+ onFocus={ () => setIsLabelFieldFocused( true ) }
175
+ onBlur={ () => setIsLabelFieldFocused( false ) }
176
+ />
177
+ <TextControl
178
+ __nextHasNoMarginBottom
179
+ __next40pxDefaultSize
180
+ value={ url ? safeDecodeURI( url ) : '' }
181
+ onChange={ ( urlValue ) => {
182
+ updateAttributes(
183
+ { url: urlValue },
184
+ setAttributes,
185
+ attributes
186
+ );
187
+ } }
188
+ label={ __( 'Link' ) }
189
+ autoComplete="off"
190
+ />
191
+ <TextareaControl
192
+ __nextHasNoMarginBottom
193
+ value={ description || '' }
194
+ onChange={ ( descriptionValue ) => {
195
+ setAttributes( { description: descriptionValue } );
196
+ } }
197
+ label={ __( 'Description' ) }
198
+ help={ __(
199
+ 'The description will be displayed in the menu if the current theme supports it.'
200
+ ) }
201
+ />
202
+ <TextControl
203
+ __nextHasNoMarginBottom
204
+ __next40pxDefaultSize
205
+ value={ title || '' }
206
+ onChange={ ( titleValue ) => {
207
+ setAttributes( { title: titleValue } );
208
+ } }
209
+ label={ __( 'Title attribute' ) }
210
+ autoComplete="off"
211
+ help={ __(
212
+ 'Additional information to help clarify the purpose of the link.'
213
+ ) }
214
+ />
215
+ <TextControl
216
+ __nextHasNoMarginBottom
217
+ __next40pxDefaultSize
218
+ value={ rel || '' }
219
+ onChange={ ( relValue ) => {
220
+ setAttributes( { rel: relValue } );
221
+ } }
222
+ label={ __( 'Rel attribute' ) }
223
+ autoComplete="off"
224
+ help={ __(
225
+ 'The relationship of the linked URL as space-separated link types.'
226
+ ) }
227
+ />
228
+ </PanelBody>
229
+ );
230
+ }
231
+
156
232
  export default function NavigationLinkEdit( {
157
233
  attributes,
158
234
  isSelected,
@@ -163,7 +239,7 @@ export default function NavigationLinkEdit( {
163
239
  context,
164
240
  clientId,
165
241
  } ) {
166
- const { id, label, type, url, description, rel, title, kind } = attributes;
242
+ const { id, label, type, url, description, kind } = attributes;
167
243
 
168
244
  const [ isInvalid, isDraft ] = useIsInvalidLink( kind, type, id );
169
245
  const { maxNestingLevel } = context;
@@ -171,9 +247,11 @@ export default function NavigationLinkEdit( {
171
247
  const {
172
248
  replaceBlock,
173
249
  __unstableMarkNextChangeAsNotPersistent,
250
+ selectBlock,
174
251
  selectPreviousBlock,
175
252
  } = useDispatch( blockEditorStore );
176
- const [ isLinkOpen, setIsLinkOpen ] = useState( false );
253
+ // Have the link editing ui open on mount when lacking a url and selected.
254
+ const [ isLinkOpen, setIsLinkOpen ] = useState( isSelected && ! url );
177
255
  // Store what element opened the popover, so we know where to return focus to (toolbar button vs navigation link text)
178
256
  const [ openedBy, setOpenedBy ] = useState( null );
179
257
  // Use internal state instead of a ref to make sure that the component
@@ -228,27 +306,19 @@ export default function NavigationLinkEdit( {
228
306
  * Transform to submenu block.
229
307
  */
230
308
  const transformToSubmenu = () => {
231
- const innerBlocks = getBlocks( clientId );
309
+ let innerBlocks = getBlocks( clientId );
310
+ if ( innerBlocks.length === 0 ) {
311
+ innerBlocks = [ createBlock( 'core/navigation-link' ) ];
312
+ selectBlock( innerBlocks[ 0 ].clientId );
313
+ }
232
314
  const newSubmenu = createBlock(
233
315
  'core/navigation-submenu',
234
316
  attributes,
235
- innerBlocks.length > 0
236
- ? innerBlocks
237
- : [ createBlock( 'core/navigation-link' ) ]
317
+ innerBlocks
238
318
  );
239
319
  replaceBlock( clientId, newSubmenu );
240
320
  };
241
321
 
242
- useEffect( () => {
243
- // Show the LinkControl on mount if the URL is empty
244
- // ( When adding a new menu item)
245
- // This can't be done in the useState call because it conflicts
246
- // with the autofocus behavior of the BlockListBlock component.
247
- if ( ! url ) {
248
- setIsLinkOpen( true );
249
- }
250
- }, [ url ] );
251
-
252
322
  useEffect( () => {
253
323
  // If block has inner blocks, transform to Submenu.
254
324
  if ( hasChildren ) {
@@ -259,16 +329,6 @@ export default function NavigationLinkEdit( {
259
329
  }
260
330
  }, [ hasChildren ] );
261
331
 
262
- /**
263
- * The hook shouldn't be necessary but due to a focus loss happening
264
- * when selecting a suggestion in the link popover, we force close on block unselection.
265
- */
266
- useEffect( () => {
267
- if ( ! isSelected ) {
268
- setIsLinkOpen( false );
269
- }
270
- }, [ isSelected ] );
271
-
272
332
  // If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.
273
333
  useEffect( () => {
274
334
  // We only want to do this when the URL has gone from nothing to a new URL AND the label looks like a URL
@@ -420,71 +480,11 @@ export default function NavigationLinkEdit( {
420
480
  </BlockControls>
421
481
  { /* Warning, this duplicated in packages/block-library/src/navigation-submenu/edit.js */ }
422
482
  <InspectorControls>
423
- <PanelBody title={ __( 'Settings' ) }>
424
- <TextControl
425
- __nextHasNoMarginBottom
426
- __next40pxDefaultSize
427
- value={ label ? stripHTML( label ) : '' }
428
- onChange={ ( labelValue ) => {
429
- setAttributes( { label: labelValue } );
430
- } }
431
- label={ __( 'Text' ) }
432
- autoComplete="off"
433
- onFocus={ () => setIsLabelFieldFocused( true ) }
434
- onBlur={ () => setIsLabelFieldFocused( false ) }
435
- />
436
- <TextControl
437
- __nextHasNoMarginBottom
438
- __next40pxDefaultSize
439
- value={ url ? safeDecodeURI( url ) : '' }
440
- onChange={ ( urlValue ) => {
441
- updateAttributes(
442
- { url: urlValue },
443
- setAttributes,
444
- attributes
445
- );
446
- } }
447
- label={ __( 'Link' ) }
448
- autoComplete="off"
449
- />
450
- <TextareaControl
451
- __nextHasNoMarginBottom
452
- value={ description || '' }
453
- onChange={ ( descriptionValue ) => {
454
- setAttributes( { description: descriptionValue } );
455
- } }
456
- label={ __( 'Description' ) }
457
- help={ __(
458
- 'The description will be displayed in the menu if the current theme supports it.'
459
- ) }
460
- />
461
- <TextControl
462
- __nextHasNoMarginBottom
463
- __next40pxDefaultSize
464
- value={ title || '' }
465
- onChange={ ( titleValue ) => {
466
- setAttributes( { title: titleValue } );
467
- } }
468
- label={ __( 'Title attribute' ) }
469
- autoComplete="off"
470
- help={ __(
471
- 'Additional information to help clarify the purpose of the link.'
472
- ) }
473
- />
474
- <TextControl
475
- __nextHasNoMarginBottom
476
- __next40pxDefaultSize
477
- value={ rel || '' }
478
- onChange={ ( relValue ) => {
479
- setAttributes( { rel: relValue } );
480
- } }
481
- label={ __( 'Rel attribute' ) }
482
- autoComplete="off"
483
- help={ __(
484
- 'The relationship of the linked URL as space-separated link types.'
485
- ) }
486
- />
487
- </PanelBody>
483
+ <Controls
484
+ attributes={ attributes }
485
+ setAttributes={ setAttributes }
486
+ setIsLabelFieldFocused={ setIsLabelFieldFocused }
487
+ />
488
488
  </InspectorControls>
489
489
  <div { ...blockProps }>
490
490
  { /* eslint-disable jsx-a11y/anchor-is-valid */ }