@wordpress/block-editor 14.2.0 → 14.2.1-next.1f6eadc42.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 (235) hide show
  1. package/build/components/block-breadcrumb/index.js +4 -10
  2. package/build/components/block-breadcrumb/index.js.map +1 -1
  3. package/build/components/block-compare/block-view.js +2 -4
  4. package/build/components/block-compare/block-view.js.map +1 -1
  5. package/build/components/block-edit/multiple-usage-warning.js +4 -8
  6. package/build/components/block-edit/multiple-usage-warning.js.map +1 -1
  7. package/build/components/block-inspector/index.js +0 -2
  8. package/build/components/block-inspector/index.js.map +1 -1
  9. package/build/components/block-list/block-invalid-warning.js +2 -4
  10. package/build/components/block-list/block-invalid-warning.js.map +1 -1
  11. package/build/components/block-list/index.js +14 -3
  12. package/build/components/block-list/index.js.map +1 -1
  13. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +7 -0
  14. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -1
  15. package/build/components/block-list/zoom-out-separator.js +98 -0
  16. package/build/components/block-list/zoom-out-separator.js.map +1 -0
  17. package/build/components/block-mover/button.js +2 -4
  18. package/build/components/block-mover/button.js.map +1 -1
  19. package/build/components/block-mover/index.js +2 -4
  20. package/build/components/block-mover/index.js.map +1 -1
  21. package/build/components/block-pattern-setup/index.js +2 -7
  22. package/build/components/block-pattern-setup/index.js.map +1 -1
  23. package/build/components/block-patterns-list/index.js +2 -7
  24. package/build/components/block-patterns-list/index.js.map +1 -1
  25. package/build/components/block-switcher/index.js +8 -2
  26. package/build/components/block-switcher/index.js.map +1 -1
  27. package/build/components/block-switcher/pattern-transformations-menu.js +2 -7
  28. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  29. package/build/components/block-toolbar/index.js +10 -4
  30. package/build/components/block-toolbar/index.js.map +1 -1
  31. package/build/components/block-tools/index.js +1 -1
  32. package/build/components/block-tools/index.js.map +1 -1
  33. package/build/components/block-tools/zoom-out-mode-inserters.js +3 -12
  34. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  35. package/build/components/block-tools/zoom-out-toolbar.js +13 -3
  36. package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
  37. package/build/components/button-block-appender/index.js +7 -21
  38. package/build/components/button-block-appender/index.js.map +1 -1
  39. package/build/components/global-styles/shadow-panel-components.js +2 -11
  40. package/build/components/global-styles/shadow-panel-components.js.map +1 -1
  41. package/build/components/grid/grid-item-resizer.js +2 -2
  42. package/build/components/grid/grid-item-resizer.js.map +1 -1
  43. package/build/components/iframe/get-compatibility-styles.js +1 -1
  44. package/build/components/iframe/get-compatibility-styles.js.map +1 -1
  45. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +23 -13
  46. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  47. package/build/components/inserter/index.js +4 -11
  48. package/build/components/inserter/index.js.map +1 -1
  49. package/build/components/inserter/media-tab/media-list.js +1 -5
  50. package/build/components/inserter/media-tab/media-list.js.map +1 -1
  51. package/build/components/inserter/media-tab/media-preview.js +1 -5
  52. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  53. package/build/components/inserter/quick-inserter.js +0 -4
  54. package/build/components/inserter/quick-inserter.js.map +1 -1
  55. package/build/components/inserter-listbox/index.js +2 -8
  56. package/build/components/inserter-listbox/index.js.map +1 -1
  57. package/build/components/inserter-listbox/item.js +2 -10
  58. package/build/components/inserter-listbox/item.js.map +1 -1
  59. package/build/components/inserter-listbox/row.js +1 -9
  60. package/build/components/inserter-listbox/row.js.map +1 -1
  61. package/build/components/list-view/index.js +3 -7
  62. package/build/components/list-view/index.js.map +1 -1
  63. package/build/components/media-placeholder/index.js +4 -4
  64. package/build/components/media-placeholder/index.js.map +1 -1
  65. package/build/components/spacing-sizes-control/index.js +8 -9
  66. package/build/components/spacing-sizes-control/index.js.map +1 -1
  67. package/build/components/spacing-sizes-control/linked-button.js +35 -0
  68. package/build/components/spacing-sizes-control/linked-button.js.map +1 -0
  69. package/build/components/spacing-sizes-control/utils.js +4 -15
  70. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  71. package/build/components/use-block-drop-zone/index.js +27 -1
  72. package/build/components/use-block-drop-zone/index.js.map +1 -1
  73. package/build/hooks/block-bindings.js +1 -0
  74. package/build/hooks/block-bindings.js.map +1 -1
  75. package/build/hooks/layout.js +0 -1
  76. package/build/hooks/layout.js.map +1 -1
  77. package/build/layouts/constrained.js +5 -6
  78. package/build/layouts/constrained.js.map +1 -1
  79. package/build/layouts/grid.js +19 -16
  80. package/build/layouts/grid.js.map +1 -1
  81. package/build/private-apis.js +0 -2
  82. package/build/private-apis.js.map +1 -1
  83. package/build/store/private-selectors.js +3 -3
  84. package/build/store/private-selectors.js.map +1 -1
  85. package/build/store/reducer.js +0 -2
  86. package/build/store/reducer.js.map +1 -1
  87. package/build-module/components/block-breadcrumb/index.js +4 -10
  88. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  89. package/build-module/components/block-compare/block-view.js +2 -4
  90. package/build-module/components/block-compare/block-view.js.map +1 -1
  91. package/build-module/components/block-edit/multiple-usage-warning.js +4 -8
  92. package/build-module/components/block-edit/multiple-usage-warning.js.map +1 -1
  93. package/build-module/components/block-inspector/index.js +0 -2
  94. package/build-module/components/block-inspector/index.js.map +1 -1
  95. package/build-module/components/block-list/block-invalid-warning.js +2 -4
  96. package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
  97. package/build-module/components/block-list/index.js +14 -3
  98. package/build-module/components/block-list/index.js.map +1 -1
  99. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +8 -1
  100. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -1
  101. package/build-module/components/block-list/zoom-out-separator.js +90 -0
  102. package/build-module/components/block-list/zoom-out-separator.js.map +1 -0
  103. package/build-module/components/block-mover/button.js +2 -4
  104. package/build-module/components/block-mover/button.js.map +1 -1
  105. package/build-module/components/block-mover/index.js +2 -4
  106. package/build-module/components/block-mover/index.js.map +1 -1
  107. package/build-module/components/block-pattern-setup/index.js +2 -7
  108. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  109. package/build-module/components/block-patterns-list/index.js +2 -7
  110. package/build-module/components/block-patterns-list/index.js.map +1 -1
  111. package/build-module/components/block-switcher/index.js +8 -2
  112. package/build-module/components/block-switcher/index.js.map +1 -1
  113. package/build-module/components/block-switcher/pattern-transformations-menu.js +2 -7
  114. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  115. package/build-module/components/block-toolbar/index.js +10 -4
  116. package/build-module/components/block-toolbar/index.js.map +1 -1
  117. package/build-module/components/block-tools/index.js +1 -1
  118. package/build-module/components/block-tools/index.js.map +1 -1
  119. package/build-module/components/block-tools/zoom-out-mode-inserters.js +3 -13
  120. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  121. package/build-module/components/block-tools/zoom-out-toolbar.js +13 -3
  122. package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
  123. package/build-module/components/button-block-appender/index.js +8 -23
  124. package/build-module/components/button-block-appender/index.js.map +1 -1
  125. package/build-module/components/global-styles/shadow-panel-components.js +2 -11
  126. package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
  127. package/build-module/components/grid/grid-item-resizer.js +2 -2
  128. package/build-module/components/grid/grid-item-resizer.js.map +1 -1
  129. package/build-module/components/iframe/get-compatibility-styles.js +1 -1
  130. package/build-module/components/iframe/get-compatibility-styles.js.map +1 -1
  131. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +23 -13
  132. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  133. package/build-module/components/inserter/index.js +4 -11
  134. package/build-module/components/inserter/index.js.map +1 -1
  135. package/build-module/components/inserter/media-tab/media-list.js +1 -5
  136. package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
  137. package/build-module/components/inserter/media-tab/media-preview.js +2 -6
  138. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
  139. package/build-module/components/inserter/quick-inserter.js +1 -5
  140. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  141. package/build-module/components/inserter-listbox/index.js +1 -5
  142. package/build-module/components/inserter-listbox/index.js.map +1 -1
  143. package/build-module/components/inserter-listbox/item.js +3 -11
  144. package/build-module/components/inserter-listbox/item.js.map +1 -1
  145. package/build-module/components/inserter-listbox/row.js +2 -10
  146. package/build-module/components/inserter-listbox/row.js.map +1 -1
  147. package/build-module/components/list-view/index.js +3 -7
  148. package/build-module/components/list-view/index.js.map +1 -1
  149. package/build-module/components/media-placeholder/index.js +4 -4
  150. package/build-module/components/media-placeholder/index.js.map +1 -1
  151. package/build-module/components/spacing-sizes-control/index.js +9 -10
  152. package/build-module/components/spacing-sizes-control/index.js.map +1 -1
  153. package/build-module/components/spacing-sizes-control/linked-button.js +28 -0
  154. package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -0
  155. package/build-module/components/spacing-sizes-control/utils.js +4 -15
  156. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  157. package/build-module/components/use-block-drop-zone/index.js +27 -1
  158. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  159. package/build-module/hooks/block-bindings.js +1 -0
  160. package/build-module/hooks/block-bindings.js.map +1 -1
  161. package/build-module/hooks/layout.js +0 -1
  162. package/build-module/hooks/layout.js.map +1 -1
  163. package/build-module/layouts/constrained.js +7 -8
  164. package/build-module/layouts/constrained.js.map +1 -1
  165. package/build-module/layouts/grid.js +21 -18
  166. package/build-module/layouts/grid.js.map +1 -1
  167. package/build-module/private-apis.js +0 -2
  168. package/build-module/private-apis.js.map +1 -1
  169. package/build-module/store/private-selectors.js +3 -3
  170. package/build-module/store/private-selectors.js.map +1 -1
  171. package/build-module/store/reducer.js +0 -2
  172. package/build-module/store/reducer.js.map +1 -1
  173. package/build-style/content-rtl.css +17 -0
  174. package/build-style/content.css +17 -0
  175. package/build-style/style-rtl.css +13 -82
  176. package/build-style/style.css +13 -82
  177. package/package.json +32 -32
  178. package/src/components/block-breadcrumb/index.js +2 -6
  179. package/src/components/block-breadcrumb/style.scss +1 -30
  180. package/src/components/block-compare/block-view.js +1 -2
  181. package/src/components/block-compare/test/__snapshots__/block-view.js.snap +1 -1
  182. package/src/components/block-edit/multiple-usage-warning.js +2 -4
  183. package/src/components/block-inspector/index.js +0 -1
  184. package/src/components/block-inspector/style.scss +2 -4
  185. package/src/components/block-list/block-invalid-warning.js +1 -2
  186. package/src/components/block-list/content.scss +21 -0
  187. package/src/components/block-list/index.js +59 -38
  188. package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +13 -1
  189. package/src/components/block-list/zoom-out-separator.js +110 -0
  190. package/src/components/block-mover/button.js +1 -2
  191. package/src/components/block-mover/index.js +1 -2
  192. package/src/components/block-pattern-setup/index.js +3 -11
  193. package/src/components/block-patterns-list/index.js +3 -8
  194. package/src/components/block-switcher/index.js +19 -3
  195. package/src/components/block-switcher/pattern-transformations-menu.js +3 -8
  196. package/src/components/block-switcher/style.scss +0 -24
  197. package/src/components/block-toolbar/index.js +10 -3
  198. package/src/components/block-toolbar/style.scss +4 -1
  199. package/src/components/block-tools/index.js +1 -1
  200. package/src/components/block-tools/zoom-out-mode-inserters.js +0 -12
  201. package/src/components/block-tools/zoom-out-toolbar.js +11 -0
  202. package/src/components/button-block-appender/index.js +16 -25
  203. package/src/components/global-styles/shadow-panel-components.js +2 -10
  204. package/src/components/grid/grid-item-resizer.js +2 -2
  205. package/src/components/iframe/get-compatibility-styles.js +6 -1
  206. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +32 -15
  207. package/src/components/inserter/index.js +4 -10
  208. package/src/components/inserter/media-tab/media-list.js +1 -4
  209. package/src/components/inserter/media-tab/media-preview.js +3 -6
  210. package/src/components/inserter/quick-inserter.js +1 -4
  211. package/src/components/inserter/style.scss +4 -9
  212. package/src/components/inserter-listbox/index.js +1 -4
  213. package/src/components/inserter-listbox/item.js +3 -13
  214. package/src/components/inserter-listbox/row.js +2 -9
  215. package/src/components/list-view/index.js +3 -8
  216. package/src/components/media-placeholder/README.md +2 -2
  217. package/src/components/media-placeholder/index.js +7 -4
  218. package/src/components/spacing-sizes-control/index.js +10 -13
  219. package/src/components/spacing-sizes-control/linked-button.js +32 -0
  220. package/src/components/spacing-sizes-control/test/utils.js +14 -15
  221. package/src/components/spacing-sizes-control/utils.js +5 -18
  222. package/src/components/use-block-drop-zone/index.js +33 -1
  223. package/src/hooks/block-bindings.js +1 -1
  224. package/src/hooks/layout.js +0 -1
  225. package/src/hooks/layout.scss +6 -20
  226. package/src/layouts/constrained.js +9 -7
  227. package/src/layouts/grid.js +29 -22
  228. package/src/private-apis.js +0 -2
  229. package/src/store/private-selectors.js +6 -3
  230. package/src/store/reducer.js +0 -2
  231. package/build/components/spacing-sizes-control/sides-dropdown/index.js +0 -86
  232. package/build/components/spacing-sizes-control/sides-dropdown/index.js.map +0 -1
  233. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js +0 -81
  234. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js.map +0 -1
  235. package/src/components/spacing-sizes-control/sides-dropdown/index.js +0 -91
@@ -6,7 +6,7 @@ import clsx from 'clsx';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { Button, Tooltip, VisuallyHidden } from '@wordpress/components';
9
+ import { Button } from '@wordpress/components';
10
10
  import { forwardRef, useRef } from '@wordpress/element';
11
11
  import { _x, sprintf } from '@wordpress/i18n';
12
12
  import { Icon, plus } from '@wordpress/icons';
@@ -43,22 +43,22 @@ function ButtonBlockAppender(
43
43
  blockTitle,
44
44
  hasSingleBlockType,
45
45
  } ) => {
46
- let label;
47
- if ( hasSingleBlockType ) {
48
- label = sprintf(
49
- // translators: %s: the name of the block when there is only one
50
- _x( 'Add %s', 'directly add the only allowed block' ),
51
- blockTitle
52
- );
53
- } else {
54
- label = _x(
55
- 'Add block',
56
- 'Generic label for block inserter button'
57
- );
58
- }
59
46
  const isToggleButton = ! hasSingleBlockType;
47
+ const label = hasSingleBlockType
48
+ ? sprintf(
49
+ // translators: %s: the name of the block when there is only one
50
+ _x(
51
+ 'Add %s',
52
+ 'directly add the only allowed block'
53
+ ),
54
+ blockTitle
55
+ )
56
+ : _x(
57
+ 'Add block',
58
+ 'Generic label for block inserter button'
59
+ );
60
60
 
61
- let inserterButton = (
61
+ return (
62
62
  <Button
63
63
  // TODO: Switch to `true` (40px size) if possible
64
64
  __next40pxDefaultSize={ false }
@@ -76,20 +76,11 @@ function ButtonBlockAppender(
76
76
  // eslint-disable-next-line no-restricted-syntax
77
77
  disabled={ disabled }
78
78
  label={ label }
79
+ showTooltip
79
80
  >
80
- { ! hasSingleBlockType && (
81
- <VisuallyHidden as="span">{ label }</VisuallyHidden>
82
- ) }
83
81
  <Icon icon={ plus } />
84
82
  </Button>
85
83
  );
86
-
87
- if ( isToggleButton || hasSingleBlockType ) {
88
- inserterButton = (
89
- <Tooltip text={ label }>{ inserterButton }</Tooltip>
90
- );
91
- }
92
- return inserterButton;
93
84
  } }
94
85
  isAppender
95
86
  />
@@ -10,7 +10,7 @@ import {
10
10
  Button,
11
11
  FlexItem,
12
12
  Dropdown,
13
- privateApis as componentsPrivateApis,
13
+ Composite,
14
14
  } from '@wordpress/components';
15
15
  import { useMemo } from '@wordpress/element';
16
16
  import { shadow as shadowIcon, Icon, check } from '@wordpress/icons';
@@ -20,11 +20,6 @@ import { shadow as shadowIcon, Icon, check } from '@wordpress/icons';
20
20
  */
21
21
  import clsx from 'clsx';
22
22
 
23
- /**
24
- * Internal dependencies
25
- */
26
- import { unlock } from '../../lock-unlock';
27
-
28
23
  /**
29
24
  * Shared reference to an empty array for cases where it is important to avoid
30
25
  * returning a new array reference on every invocation.
@@ -32,9 +27,6 @@ import { unlock } from '../../lock-unlock';
32
27
  * @type {Array}
33
28
  */
34
29
  const EMPTY_ARRAY = [];
35
- const { CompositeItemV2: CompositeItem, CompositeV2: Composite } = unlock(
36
- componentsPrivateApis
37
- );
38
30
 
39
31
  export function ShadowPopoverContainer( { shadow, onShadowChange, settings } ) {
40
32
  const shadows = useShadowPresets( settings );
@@ -88,7 +80,7 @@ export function ShadowPresets( { presets, activeShadow, onSelect } ) {
88
80
 
89
81
  export function ShadowIndicator( { type, label, isActive, onSelect, shadow } ) {
90
82
  return (
91
- <CompositeItem
83
+ <Composite.Item
92
84
  role="option"
93
85
  aria-label={ label }
94
86
  aria-selected={ isActive }
@@ -73,8 +73,8 @@ function GridItemResizerInner( {
73
73
  }, [ blockElement, rootBlockElement ] );
74
74
 
75
75
  const justification = {
76
- right: 'flex-start',
77
- left: 'flex-end',
76
+ right: 'left',
77
+ left: 'right',
78
78
  };
79
79
 
80
80
  const alignment = {
@@ -40,7 +40,12 @@ export function getCompatibilityStyles() {
40
40
  // Don't try to add the reset styles, which were removed as a dependency
41
41
  // from `edit-blocks` for the iframe since we don't need to reset admin
42
42
  // styles.
43
- if ( ownerNode.id === 'wp-reset-editor-styles-css' ) {
43
+ if (
44
+ [
45
+ 'wp-reset-editor-styles-css',
46
+ 'wp-reset-editor-styles-rtl-css',
47
+ ].includes( ownerNode.id )
48
+ ) {
44
49
  return accumulator;
45
50
  }
46
51
 
@@ -17,6 +17,7 @@ import {
17
17
  __experimentalText as Text,
18
18
  FlexBlock,
19
19
  } from '@wordpress/components';
20
+ import { useSelect } from '@wordpress/data';
20
21
 
21
22
  /**
22
23
  * Internal dependencies
@@ -32,6 +33,7 @@ import {
32
33
  myPatternsCategory,
33
34
  INSERTER_PATTERN_TYPES,
34
35
  } from './utils';
36
+ import { store as blockEditorStore } from '../../../store';
35
37
 
36
38
  const noop = () => {};
37
39
 
@@ -42,6 +44,11 @@ export function PatternCategoryPreviews( {
42
44
  category,
43
45
  showTitlesAsTooltip,
44
46
  } ) {
47
+ const isZoomOutMode = useSelect(
48
+ ( select ) =>
49
+ select( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out',
50
+ []
51
+ );
45
52
  const [ allPatterns, , onClickPattern ] = usePatternsState(
46
53
  onInsert,
47
54
  rootClientId,
@@ -163,22 +170,32 @@ export function PatternCategoryPreviews( {
163
170
  </Text>
164
171
  ) }
165
172
  </VStack>
166
-
167
173
  { currentCategoryPatterns.length > 0 && (
168
- <BlockPatternsList
169
- ref={ scrollContainerRef }
170
- shownPatterns={ pagingProps.categoryPatternsAsyncList }
171
- blockPatterns={ pagingProps.categoryPatterns }
172
- onClickPattern={ onClickPattern }
173
- onHover={ onHover }
174
- label={ category.label }
175
- orientation="vertical"
176
- category={ category.name }
177
- isDraggable
178
- showTitlesAsTooltip={ showTitlesAsTooltip }
179
- patternFilter={ patternSourceFilter }
180
- pagingProps={ pagingProps }
181
- />
174
+ <>
175
+ { isZoomOutMode && (
176
+ <Text
177
+ size="12"
178
+ as="p"
179
+ className="block-editor-inserter__help-text"
180
+ >
181
+ { __( 'Drag and drop patterns into the canvas.' ) }
182
+ </Text>
183
+ ) }
184
+ <BlockPatternsList
185
+ ref={ scrollContainerRef }
186
+ shownPatterns={ pagingProps.categoryPatternsAsyncList }
187
+ blockPatterns={ pagingProps.categoryPatterns }
188
+ onClickPattern={ onClickPattern }
189
+ onHover={ onHover }
190
+ label={ category.label }
191
+ orientation="vertical"
192
+ category={ category.name }
193
+ isDraggable
194
+ showTitlesAsTooltip={ showTitlesAsTooltip }
195
+ patternFilter={ patternSourceFilter }
196
+ pagingProps={ pagingProps }
197
+ />
198
+ </>
182
199
  ) }
183
200
  </>
184
201
  );
@@ -9,7 +9,7 @@ import clsx from 'clsx';
9
9
  import { speak } from '@wordpress/a11y';
10
10
  import { __, _x, sprintf } from '@wordpress/i18n';
11
11
  import { Dropdown, Button } from '@wordpress/components';
12
- import { forwardRef, Component } from '@wordpress/element';
12
+ import { Component } from '@wordpress/element';
13
13
  import { withDispatch, withSelect } from '@wordpress/data';
14
14
  import { compose, ifCondition } from '@wordpress/compose';
15
15
  import { createBlock, store as blocksStore } from '@wordpress/blocks';
@@ -76,7 +76,7 @@ const defaultRenderToggle = ( {
76
76
  );
77
77
  };
78
78
 
79
- class PrivateInserter extends Component {
79
+ class Inserter extends Component {
80
80
  constructor() {
81
81
  super( ...arguments );
82
82
 
@@ -222,7 +222,7 @@ class PrivateInserter extends Component {
222
222
  }
223
223
  }
224
224
 
225
- export const ComposedPrivateInserter = compose( [
225
+ export default compose( [
226
226
  withSelect(
227
227
  ( select, { clientId, rootClientId, shouldDirectInsert = true } ) => {
228
228
  const {
@@ -418,10 +418,4 @@ export const ComposedPrivateInserter = compose( [
418
418
  ( { hasItems, isAppender, rootClientId, clientId } ) =>
419
419
  hasItems || ( ! isAppender && ! rootClientId && ! clientId )
420
420
  ),
421
- ] )( PrivateInserter );
422
-
423
- const Inserter = forwardRef( ( props, ref ) => {
424
- return <ComposedPrivateInserter ref={ ref } { ...props } />;
425
- } );
426
-
427
- export default Inserter;
421
+ ] )( Inserter );
@@ -1,16 +1,13 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { privateApis as componentsPrivateApis } from '@wordpress/components';
4
+ import { Composite } from '@wordpress/components';
5
5
  import { __ } from '@wordpress/i18n';
6
6
 
7
7
  /**
8
8
  * Internal dependencies
9
9
  */
10
10
  import { MediaPreview } from './media-preview';
11
- import { unlock } from '../../../lock-unlock';
12
-
13
- const { CompositeV2: Composite } = unlock( componentsPrivateApis );
14
11
 
15
12
  function MediaList( {
16
13
  mediaList,
@@ -16,7 +16,7 @@ import {
16
16
  Flex,
17
17
  FlexItem,
18
18
  Button,
19
- privateApis as componentsPrivateApis,
19
+ Composite,
20
20
  __experimentalVStack as VStack,
21
21
  } from '@wordpress/components';
22
22
  import { __, sprintf } from '@wordpress/i18n';
@@ -33,7 +33,6 @@ import { isBlobURL } from '@wordpress/blob';
33
33
  import InserterDraggableBlocks from '../../inserter-draggable-blocks';
34
34
  import { getBlockAndPreviewFromMedia } from './utils';
35
35
  import { store as blockEditorStore } from '../../../store';
36
- import { unlock } from '../../../lock-unlock';
37
36
 
38
37
  const ALLOWED_MEDIA_TYPES = [ 'image' ];
39
38
  const MAXIMUM_TITLE_LENGTH = 25;
@@ -43,8 +42,6 @@ const MEDIA_OPTIONS_POPOVER_PROPS = {
43
42
  'block-editor-inserter__media-list__item-preview-options__popover',
44
43
  };
45
44
 
46
- const { CompositeItemV2: CompositeItem } = unlock( componentsPrivateApis );
47
-
48
45
  function MediaPreviewOptions( { category, media } ) {
49
46
  if ( ! category.getReportUrl ) {
50
47
  return null;
@@ -249,7 +246,7 @@ export function MediaPreview( { media, onClick, category } ) {
249
246
  onMouseLeave={ onMouseLeave }
250
247
  >
251
248
  <Tooltip text={ truncatedTitle || title }>
252
- <CompositeItem
249
+ <Composite.Item
253
250
  render={
254
251
  <div
255
252
  aria-label={ title }
@@ -267,7 +264,7 @@ export function MediaPreview( { media, onClick, category } ) {
267
264
  </div>
268
265
  ) }
269
266
  </div>
270
- </CompositeItem>
267
+ </Composite.Item>
271
268
  </Tooltip>
272
269
  { ! isInserting && (
273
270
  <MediaPreviewOptions
@@ -9,7 +9,7 @@ import clsx from 'clsx';
9
9
  import { useState, useEffect } from '@wordpress/element';
10
10
  import { __ } from '@wordpress/i18n';
11
11
  import { Button, SearchControl } from '@wordpress/components';
12
- import { useDispatch, useSelect } from '@wordpress/data';
12
+ import { useSelect } from '@wordpress/data';
13
13
 
14
14
  /**
15
15
  * Internal dependencies
@@ -82,8 +82,6 @@ export default function QuickInserter( {
82
82
  }
83
83
  }, [ setInserterIsOpened ] );
84
84
 
85
- const { showInsertionPoint } = useDispatch( blockEditorStore );
86
-
87
85
  // When clicking Browse All select the appropriate block so as
88
86
  // the insertion point can work as expected.
89
87
  const onBrowseAll = () => {
@@ -93,7 +91,6 @@ export default function QuickInserter( {
93
91
  filterValue,
94
92
  onSelect,
95
93
  } );
96
- showInsertionPoint( rootClientId, insertionIndex );
97
94
  };
98
95
 
99
96
  let maxBlockPatterns = 0;
@@ -155,15 +155,6 @@ $block-inserter-tabs-height: 44px;
155
155
  text-align: right;
156
156
  }
157
157
 
158
- .block-editor-inserter__manage-reusable-blocks-container {
159
- margin: auto $grid-unit-20 $grid-unit-20;
160
- }
161
-
162
- .block-editor-inserter__manage-reusable-blocks {
163
- justify-content: center;
164
- width: 100%;
165
- }
166
-
167
158
  .block-editor-inserter__no-results,
168
159
  .block-editor-inserter__patterns-loading {
169
160
  padding: $grid-unit-40;
@@ -709,3 +700,7 @@ $block-inserter-tabs-height: 44px;
709
700
  }
710
701
  }
711
702
  }
703
+
704
+ .block-editor-tabbed-sidebar__tabpanel .block-editor-inserter__help-text {
705
+ padding: 0 $grid-unit-30 $grid-unit-20;
706
+ }
@@ -1,19 +1,16 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { privateApis as componentsPrivateApis } from '@wordpress/components';
4
+ import { Composite } from '@wordpress/components';
5
5
 
6
6
  /**
7
7
  * Internal dependencies
8
8
  */
9
- import { unlock } from '../../lock-unlock';
10
9
 
11
10
  export { default as InserterListboxGroup } from './group';
12
11
  export { default as InserterListboxRow } from './row';
13
12
  export { default as InserterListboxItem } from './item';
14
13
 
15
- const { CompositeV2: Composite } = unlock( componentsPrivateApis );
16
-
17
14
  function InserterListbox( { children } ) {
18
15
  return (
19
16
  <Composite focusShift focusWrap="horizontal" render={ <></> }>
@@ -1,28 +1,18 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import {
5
- Button,
6
- privateApis as componentsPrivateApis,
7
- } from '@wordpress/components';
4
+ import { Button, Composite } from '@wordpress/components';
8
5
  import { forwardRef } from '@wordpress/element';
9
6
 
10
- /**
11
- * Internal dependencies
12
- */
13
- import { unlock } from '../../lock-unlock';
14
-
15
- const { CompositeItemV2: CompositeItem } = unlock( componentsPrivateApis );
16
-
17
7
  function InserterListboxItem(
18
8
  { isFirst, as: Component, children, ...props },
19
9
  ref
20
10
  ) {
21
11
  return (
22
- <CompositeItem
12
+ <Composite.Item
23
13
  ref={ ref }
24
14
  role="option"
25
- // Use the CompositeItem `accessibleWhenDisabled` prop
15
+ // Use the Composite.Item `accessibleWhenDisabled` prop
26
16
  // over Button's `isFocusable`. The latter was shown to
27
17
  // cause an issue with tab order in the inserter list.
28
18
  accessibleWhenDisabled
@@ -2,17 +2,10 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { forwardRef } from '@wordpress/element';
5
- import { privateApis as componentsPrivateApis } from '@wordpress/components';
6
-
7
- /**
8
- * Internal dependencies
9
- */
10
- import { unlock } from '../../lock-unlock';
11
-
12
- const { CompositeGroupV2: CompositeGroup } = unlock( componentsPrivateApis );
5
+ import { Composite } from '@wordpress/components';
13
6
 
14
7
  function InserterListboxRow( props, ref ) {
15
- return <CompositeGroup role="presentation" ref={ ref } { ...props } />;
8
+ return <Composite.Group role="presentation" ref={ ref } { ...props } />;
16
9
  }
17
10
 
18
11
  export default forwardRef( InserterListboxRow );
@@ -119,20 +119,16 @@ function ListViewComponent(
119
119
  const blockIndexes = useListViewBlockIndexes( clientIdsTree );
120
120
 
121
121
  const { getBlock } = useSelect( blockEditorStore );
122
- const { visibleBlockCount, shouldShowInnerBlocks } = useSelect(
122
+ const { visibleBlockCount } = useSelect(
123
123
  ( select ) => {
124
- const {
125
- getGlobalBlockCount,
126
- getClientIdsOfDescendants,
127
- __unstableGetEditorMode,
128
- } = select( blockEditorStore );
124
+ const { getGlobalBlockCount, getClientIdsOfDescendants } =
125
+ select( blockEditorStore );
129
126
  const draggedBlockCount =
130
127
  draggedClientIds?.length > 0
131
128
  ? getClientIdsOfDescendants( draggedClientIds ).length + 1
132
129
  : 0;
133
130
  return {
134
131
  visibleBlockCount: getGlobalBlockCount() - draggedBlockCount,
135
- shouldShowInnerBlocks: __unstableGetEditorMode() !== 'zoom-out',
136
132
  };
137
133
  },
138
134
  [ draggedClientIds ]
@@ -397,7 +393,6 @@ function ListViewComponent(
397
393
  fixedListWindow={ fixedListWindow }
398
394
  selectedClientIds={ selectedClientIds }
399
395
  isExpanded={ isExpanded }
400
- shouldShowInnerBlocks={ shouldShowInnerBlocks }
401
396
  showAppender={ showAppender }
402
397
  />
403
398
  </ListViewContext.Provider>
@@ -198,9 +198,9 @@ Callback called when urls can be configured. No media insertion from url will be
198
198
 
199
199
  ### handleUpload
200
200
 
201
- When set to false the handling of the upload is left to the calling component.
201
+ When the value is set to `false` or returned as `false`, the handling of the upload is left to the consumer component. The function signature accepts an array containing the files to be uploaded.
202
202
 
203
- - Type: `Boolean`
203
+ - Type: `Boolean|Function`
204
204
  - Required: No
205
205
  - Default: `true`
206
206
  - Platform: Web
@@ -172,7 +172,10 @@ export function MediaPlaceholder( {
172
172
  };
173
173
 
174
174
  const onFilesUpload = ( files ) => {
175
- if ( ! handleUpload ) {
175
+ if (
176
+ ! handleUpload ||
177
+ ( typeof handleUpload === 'function' && ! handleUpload( files ) )
178
+ ) {
176
179
  return onSelect( files );
177
180
  }
178
181
  onFilesPreUpload( files );
@@ -320,15 +323,15 @@ export function MediaPlaceholder( {
320
323
 
321
324
  if ( isAudio ) {
322
325
  instructions = __(
323
- 'Upload an audio file, pick one from your media library, or add one with a URL.'
326
+ 'Upload or drag an audio file here, or pick one from your library.'
324
327
  );
325
328
  } else if ( isImage ) {
326
329
  instructions = __(
327
- 'Upload an image file, pick one from your media library, or add one with a URL.'
330
+ 'Upload or drag an image file here, or pick one from your library.'
328
331
  );
329
332
  } else if ( isVideo ) {
330
333
  instructions = __(
331
- 'Upload a video file, pick one from your media library, or add one with a URL.'
334
+ 'Upload or drag a video file here, or pick one from your library.'
332
335
  );
333
336
  }
334
337
  }
@@ -7,7 +7,7 @@ import {
7
7
  __experimentalVStack as VStack,
8
8
  } from '@wordpress/components';
9
9
  import { useState } from '@wordpress/element';
10
- import { __, _x, sprintf } from '@wordpress/i18n';
10
+ import { __, sprintf } from '@wordpress/i18n';
11
11
 
12
12
  /**
13
13
  * Internal dependencies
@@ -15,7 +15,7 @@ import { __, _x, sprintf } from '@wordpress/i18n';
15
15
  import AxialInputControls from './input-controls/axial';
16
16
  import SeparatedInputControls from './input-controls/separated';
17
17
  import SingleInputControl from './input-controls/single';
18
- import SidesDropdown from './sides-dropdown';
18
+ import LinkedButton from './linked-button';
19
19
  import useSpacingSizes from './hooks/use-spacing-sizes';
20
20
  import {
21
21
  ALL_SIDES,
@@ -47,6 +47,10 @@ export default function SpacingSizesControl( {
47
47
 
48
48
  const [ view, setView ] = useState( getInitialView( inputValues, sides ) );
49
49
 
50
+ const toggleLinked = () => {
51
+ setView( view === VIEWS.axial ? VIEWS.custom : VIEWS.axial );
52
+ };
53
+
50
54
  const handleOnChange = ( nextValue ) => {
51
55
  const newValues = { ...values, ...nextValue };
52
56
  onChange( newValues );
@@ -91,12 +95,6 @@ export default function SpacingSizesControl( {
91
95
  sideLabel
92
96
  ).trim();
93
97
 
94
- const dropdownLabelText = sprintf(
95
- // translators: %s: The current spacing property e.g. "Padding", "Margin".
96
- _x( '%s options', 'Button label to reveal side configuration options' ),
97
- labelProp
98
- );
99
-
100
98
  return (
101
99
  <fieldset className="spacing-sizes-control">
102
100
  <HStack className="spacing-sizes-control__header">
@@ -107,11 +105,10 @@ export default function SpacingSizesControl( {
107
105
  { label }
108
106
  </BaseControl.VisualLabel>
109
107
  { ! hasOneSide && ! hasOnlyAxialSides && (
110
- <SidesDropdown
111
- label={ dropdownLabelText }
112
- onChange={ setView }
113
- sides={ sides }
114
- value={ view }
108
+ <LinkedButton
109
+ label={ labelProp }
110
+ onClick={ toggleLinked }
111
+ isLinked={ view === VIEWS.axial }
115
112
  />
116
113
  ) }
117
114
  </HStack>
@@ -0,0 +1,32 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { Button, Tooltip } from '@wordpress/components';
5
+ import { link, linkOff } from '@wordpress/icons';
6
+ import { __, sprintf } from '@wordpress/i18n';
7
+
8
+ export default function LinkedButton( { isLinked, ...props } ) {
9
+ const label = isLinked
10
+ ? sprintf(
11
+ // translators: 1. Type of spacing being modified (padding, margin, etc).
12
+ __( 'Unlink %1$s' ),
13
+ props.label.toLowerCase()
14
+ ).trim()
15
+ : sprintf(
16
+ // translators: 1. Type of spacing being modified (padding, margin, etc).
17
+ __( 'Link %1$s' ),
18
+ props.label.toLowerCase()
19
+ ).trim();
20
+
21
+ return (
22
+ <Tooltip text={ label }>
23
+ <Button
24
+ { ...props }
25
+ size="small"
26
+ icon={ isLinked ? link : linkOff }
27
+ iconSize={ 24 }
28
+ aria-label={ label }
29
+ />
30
+ </Tooltip>
31
+ );
32
+ }
@@ -373,8 +373,8 @@ describe( 'getInitialView', () => {
373
373
  getInitialView( { top: '1em', right: '10px' }, ALL_SIDES )
374
374
  ).toBe( VIEWS.custom );
375
375
  } );
376
- it( 'should not return custom view if there is only a single side value', () => {
377
- expect( getInitialView( { top: '1em' }, ALL_SIDES ) ).not.toBe(
376
+ it( 'should return custom view if there is only a single side value', () => {
377
+ expect( getInitialView( { top: '1em' }, ALL_SIDES ) ).toBe(
378
378
  VIEWS.custom
379
379
  );
380
380
  } );
@@ -387,20 +387,19 @@ describe( 'getInitialView', () => {
387
387
  );
388
388
  } );
389
389
 
390
- it( 'should return the single side view if there is only a single side value set and supported sides > 1', () => {
391
- expect( getInitialView( { top: '1em' }, ALL_SIDES ) ).toBe(
392
- VIEWS.top
393
- );
394
- expect( getInitialView( { right: '1em' }, ALL_SIDES ) ).toBe(
395
- VIEWS.right
396
- );
397
- expect( getInitialView( { bottom: '1em' }, ALL_SIDES ) ).toBe(
398
- VIEWS.bottom
399
- );
400
- expect( getInitialView( { left: '1em' }, ALL_SIDES ) ).toBe(
401
- VIEWS.left
402
- );
390
+ it( 'should return single side when only single side supported and no value defined', () => {
391
+ expect( getInitialView( {}, [ 'top' ] ) ).toBe( VIEWS.top );
392
+ } );
393
+
394
+ it( 'should return single side when only single side supported and all values defined', () => {
395
+ expect(
396
+ getInitialView(
397
+ { top: '1em', right: '2em', bottom: '1em', left: '2em' },
398
+ [ 'top' ]
399
+ )
400
+ ).toBe( VIEWS.top );
403
401
  } );
402
+
404
403
  it( 'should return single side view when only one side is supported', () => {
405
404
  expect( getInitialView( { top: '1em' }, [ 'top' ] ) ).toBe(
406
405
  VIEWS.top