@wordpress/block-editor 11.3.6 → 11.5.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 (357) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/build/components/block-lock/modal.js +1 -0
  3. package/build/components/block-lock/modal.js.map +1 -1
  4. package/build/components/block-popover/inbetween.js +10 -33
  5. package/build/components/block-popover/inbetween.js.map +1 -1
  6. package/build/components/block-settings-menu/block-settings-dropdown.js +2 -2
  7. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  8. package/build/components/block-styles/index.js +2 -1
  9. package/build/components/block-styles/index.js.map +1 -1
  10. package/build/components/block-types-list/index.native.js +2 -0
  11. package/build/components/block-types-list/index.native.js.map +1 -1
  12. package/build/components/child-layout-control/index.js +107 -0
  13. package/build/components/child-layout-control/index.js.map +1 -0
  14. package/build/components/colors-gradients/control.js +6 -3
  15. package/build/components/colors-gradients/control.js.map +1 -1
  16. package/build/components/date-format-picker/index.js +3 -3
  17. package/build/components/date-format-picker/index.js.map +1 -1
  18. package/build/components/font-appearance-control/index.js +0 -3
  19. package/build/components/font-appearance-control/index.js.map +1 -1
  20. package/build/components/global-styles/dimensions-panel.js +594 -0
  21. package/build/components/global-styles/dimensions-panel.js.map +1 -0
  22. package/build/components/global-styles/hooks.js +142 -45
  23. package/build/components/global-styles/hooks.js.map +1 -1
  24. package/build/components/global-styles/index.js +38 -0
  25. package/build/components/global-styles/index.js.map +1 -1
  26. package/build/components/global-styles/typography-panel.js +434 -0
  27. package/build/components/global-styles/typography-panel.js.map +1 -0
  28. package/build/components/global-styles/use-global-styles-output.js +7 -3
  29. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  30. package/build/components/global-styles/utils.js +2 -0
  31. package/build/components/global-styles/utils.js.map +1 -1
  32. package/build/components/iframe/index.js +17 -11
  33. package/build/components/iframe/index.js.map +1 -1
  34. package/build/components/image-editor/aspect-ratio-dropdown.js +2 -1
  35. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  36. package/build/components/image-size-control/index.js +6 -11
  37. package/build/components/image-size-control/index.js.map +1 -1
  38. package/build/components/index.native.js +23 -0
  39. package/build/components/index.native.js.map +1 -1
  40. package/build/components/inserter/block-patterns-tab.js +9 -15
  41. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  42. package/build/components/inserter/block-types-tab.native.js +4 -1
  43. package/build/components/inserter/block-types-tab.native.js.map +1 -1
  44. package/build/components/inserter/reusable-blocks-tab.native.js +4 -1
  45. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  46. package/build/components/inserter/search-results.native.js +4 -1
  47. package/build/components/inserter/search-results.native.js.map +1 -1
  48. package/build/components/inspector-controls/block-support-tools-panel.js +1 -1
  49. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  50. package/build/components/inspector-controls/fill.js +38 -9
  51. package/build/components/inspector-controls/fill.js.map +1 -1
  52. package/build/components/link-control/index.js +55 -28
  53. package/build/components/link-control/index.js.map +1 -1
  54. package/build/components/link-control/settings-drawer.js +72 -30
  55. package/build/components/link-control/settings-drawer.js.map +1 -1
  56. package/build/components/link-control/settings.js +53 -0
  57. package/build/components/link-control/settings.js.map +1 -0
  58. package/build/components/list-view/block.js +4 -2
  59. package/build/components/list-view/block.js.map +1 -1
  60. package/build/components/list-view/expander.js +2 -1
  61. package/build/components/list-view/expander.js.map +1 -1
  62. package/build/components/list-view/index.js +6 -1
  63. package/build/components/list-view/index.js.map +1 -1
  64. package/build/components/off-canvas-editor/appender.js +5 -10
  65. package/build/components/off-canvas-editor/appender.js.map +1 -1
  66. package/build/components/off-canvas-editor/block-contents.js +3 -2
  67. package/build/components/off-canvas-editor/block-contents.js.map +1 -1
  68. package/build/components/off-canvas-editor/branch.js +1 -0
  69. package/build/components/off-canvas-editor/branch.js.map +1 -1
  70. package/build/components/off-canvas-editor/index.js +7 -3
  71. package/build/components/off-canvas-editor/index.js.map +1 -1
  72. package/build/components/off-canvas-editor/leaf-more-menu.js +24 -4
  73. package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
  74. package/build/components/off-canvas-editor/link-ui.js +2 -0
  75. package/build/components/off-canvas-editor/link-ui.js.map +1 -1
  76. package/build/components/responsive-block-control/index.js +1 -0
  77. package/build/components/responsive-block-control/index.js.map +1 -1
  78. package/build/components/rich-text/index.js +9 -45
  79. package/build/components/rich-text/index.js.map +1 -1
  80. package/build/components/rich-text/use-delete.js +73 -0
  81. package/build/components/rich-text/use-delete.js.map +1 -0
  82. package/build/components/rich-text/use-input-rules.js +14 -6
  83. package/build/components/rich-text/use-input-rules.js.map +1 -1
  84. package/build/components/url-input/index.js +2 -2
  85. package/build/components/url-input/index.js.map +1 -1
  86. package/build/components/writing-flow/use-selection-observer.js +4 -1
  87. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  88. package/build/hooks/align.js +3 -1
  89. package/build/hooks/align.js.map +1 -1
  90. package/build/hooks/dimensions.js +78 -190
  91. package/build/hooks/dimensions.js.map +1 -1
  92. package/build/hooks/duotone.js +94 -25
  93. package/build/hooks/duotone.js.map +1 -1
  94. package/build/hooks/font-family.js +2 -76
  95. package/build/hooks/font-family.js.map +1 -1
  96. package/build/hooks/font-size.js +3 -51
  97. package/build/hooks/font-size.js.map +1 -1
  98. package/build/hooks/gap.js +0 -201
  99. package/build/hooks/gap.js.map +1 -1
  100. package/build/hooks/index.js +2 -0
  101. package/build/hooks/index.js.map +1 -1
  102. package/build/hooks/layout.js +14 -5
  103. package/build/hooks/layout.js.map +1 -1
  104. package/build/hooks/line-height.js +0 -42
  105. package/build/hooks/line-height.js.map +1 -1
  106. package/build/hooks/margin.js +7 -163
  107. package/build/hooks/margin.js.map +1 -1
  108. package/build/hooks/padding.js +7 -163
  109. package/build/hooks/padding.js.map +1 -1
  110. package/build/hooks/typography.js +98 -128
  111. package/build/hooks/typography.js.map +1 -1
  112. package/build/hooks/utils.js +75 -0
  113. package/build/hooks/utils.js.map +1 -1
  114. package/build/layouts/flex.js +1 -0
  115. package/build/layouts/flex.js.map +1 -1
  116. package/build/store/actions.js +24 -12
  117. package/build/store/actions.js.map +1 -1
  118. package/build/store/reducer.js +53 -47
  119. package/build/store/reducer.js.map +1 -1
  120. package/build/store/selectors.js +22 -1
  121. package/build/store/selectors.js.map +1 -1
  122. package/build/utils/parse-css-unit-to-px.js +36 -3
  123. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  124. package/build-module/components/block-lock/modal.js +1 -0
  125. package/build-module/components/block-lock/modal.js.map +1 -1
  126. package/build-module/components/block-popover/inbetween.js +10 -33
  127. package/build-module/components/block-popover/inbetween.js.map +1 -1
  128. package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -2
  129. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  130. package/build-module/components/block-styles/index.js +2 -1
  131. package/build-module/components/block-styles/index.js.map +1 -1
  132. package/build-module/components/block-types-list/index.native.js +2 -0
  133. package/build-module/components/block-types-list/index.native.js.map +1 -1
  134. package/build-module/components/child-layout-control/index.js +98 -0
  135. package/build-module/components/child-layout-control/index.js.map +1 -0
  136. package/build-module/components/colors-gradients/control.js +6 -3
  137. package/build-module/components/colors-gradients/control.js.map +1 -1
  138. package/build-module/components/date-format-picker/index.js +4 -4
  139. package/build-module/components/date-format-picker/index.js.map +1 -1
  140. package/build-module/components/font-appearance-control/index.js +2 -1
  141. package/build-module/components/font-appearance-control/index.js.map +1 -1
  142. package/build-module/components/global-styles/dimensions-panel.js +574 -0
  143. package/build-module/components/global-styles/dimensions-panel.js.map +1 -0
  144. package/build-module/components/global-styles/hooks.js +138 -46
  145. package/build-module/components/global-styles/hooks.js.map +1 -1
  146. package/build-module/components/global-styles/index.js +3 -1
  147. package/build-module/components/global-styles/index.js.map +1 -1
  148. package/build-module/components/global-styles/typography-panel.js +415 -0
  149. package/build-module/components/global-styles/typography-panel.js.map +1 -0
  150. package/build-module/components/global-styles/use-global-styles-output.js +7 -3
  151. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  152. package/build-module/components/global-styles/utils.js +2 -0
  153. package/build-module/components/global-styles/utils.js.map +1 -1
  154. package/build-module/components/iframe/index.js +17 -11
  155. package/build-module/components/iframe/index.js.map +1 -1
  156. package/build-module/components/image-editor/aspect-ratio-dropdown.js +2 -1
  157. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  158. package/build-module/components/image-size-control/index.js +7 -12
  159. package/build-module/components/image-size-control/index.js.map +1 -1
  160. package/build-module/components/index.native.js +2 -1
  161. package/build-module/components/index.native.js.map +1 -1
  162. package/build-module/components/inserter/block-patterns-tab.js +9 -15
  163. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  164. package/build-module/components/inserter/block-types-tab.native.js +3 -1
  165. package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
  166. package/build-module/components/inserter/reusable-blocks-tab.native.js +3 -1
  167. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  168. package/build-module/components/inserter/search-results.native.js +3 -1
  169. package/build-module/components/inserter/search-results.native.js.map +1 -1
  170. package/build-module/components/inspector-controls/block-support-tools-panel.js +1 -1
  171. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  172. package/build-module/components/inspector-controls/fill.js +39 -9
  173. package/build-module/components/inspector-controls/fill.js.map +1 -1
  174. package/build-module/components/link-control/index.js +56 -28
  175. package/build-module/components/link-control/index.js.map +1 -1
  176. package/build-module/components/link-control/settings-drawer.js +68 -30
  177. package/build-module/components/link-control/settings-drawer.js.map +1 -1
  178. package/build-module/components/link-control/settings.js +44 -0
  179. package/build-module/components/link-control/settings.js.map +1 -0
  180. package/build-module/components/list-view/block.js +4 -2
  181. package/build-module/components/list-view/block.js.map +1 -1
  182. package/build-module/components/list-view/expander.js +2 -1
  183. package/build-module/components/list-view/expander.js.map +1 -1
  184. package/build-module/components/list-view/index.js +6 -1
  185. package/build-module/components/list-view/index.js.map +1 -1
  186. package/build-module/components/off-canvas-editor/appender.js +5 -10
  187. package/build-module/components/off-canvas-editor/appender.js.map +1 -1
  188. package/build-module/components/off-canvas-editor/block-contents.js +3 -2
  189. package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
  190. package/build-module/components/off-canvas-editor/branch.js +1 -0
  191. package/build-module/components/off-canvas-editor/branch.js.map +1 -1
  192. package/build-module/components/off-canvas-editor/index.js +7 -3
  193. package/build-module/components/off-canvas-editor/index.js.map +1 -1
  194. package/build-module/components/off-canvas-editor/leaf-more-menu.js +27 -7
  195. package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
  196. package/build-module/components/off-canvas-editor/link-ui.js +2 -0
  197. package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
  198. package/build-module/components/responsive-block-control/index.js +1 -0
  199. package/build-module/components/responsive-block-control/index.js.map +1 -1
  200. package/build-module/components/rich-text/index.js +9 -45
  201. package/build-module/components/rich-text/index.js.map +1 -1
  202. package/build-module/components/rich-text/use-delete.js +62 -0
  203. package/build-module/components/rich-text/use-delete.js.map +1 -0
  204. package/build-module/components/rich-text/use-input-rules.js +14 -6
  205. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  206. package/build-module/components/url-input/index.js +2 -2
  207. package/build-module/components/url-input/index.js.map +1 -1
  208. package/build-module/components/writing-flow/use-selection-observer.js +4 -1
  209. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  210. package/build-module/hooks/align.js +3 -1
  211. package/build-module/hooks/align.js.map +1 -1
  212. package/build-module/hooks/dimensions.js +81 -187
  213. package/build-module/hooks/dimensions.js.map +1 -1
  214. package/build-module/hooks/duotone.js +86 -24
  215. package/build-module/hooks/duotone.js.map +1 -1
  216. package/build-module/hooks/font-family.js +3 -69
  217. package/build-module/hooks/font-family.js.map +1 -1
  218. package/build-module/hooks/font-size.js +6 -47
  219. package/build-module/hooks/font-size.js.map +1 -1
  220. package/build-module/hooks/gap.js +0 -182
  221. package/build-module/hooks/gap.js.map +1 -1
  222. package/build-module/hooks/index.js +1 -0
  223. package/build-module/hooks/index.js.map +1 -1
  224. package/build-module/hooks/layout.js +14 -5
  225. package/build-module/hooks/layout.js.map +1 -1
  226. package/build-module/hooks/line-height.js +0 -38
  227. package/build-module/hooks/line-height.js.map +1 -1
  228. package/build-module/hooks/margin.js +4 -143
  229. package/build-module/hooks/margin.js.map +1 -1
  230. package/build-module/hooks/padding.js +4 -143
  231. package/build-module/hooks/padding.js.map +1 -1
  232. package/build-module/hooks/typography.js +97 -123
  233. package/build-module/hooks/typography.js.map +1 -1
  234. package/build-module/hooks/utils.js +70 -0
  235. package/build-module/hooks/utils.js.map +1 -1
  236. package/build-module/layouts/flex.js +1 -0
  237. package/build-module/layouts/flex.js.map +1 -1
  238. package/build-module/store/actions.js +24 -12
  239. package/build-module/store/actions.js.map +1 -1
  240. package/build-module/store/reducer.js +53 -45
  241. package/build-module/store/reducer.js.map +1 -1
  242. package/build-module/store/selectors.js +22 -1
  243. package/build-module/store/selectors.js.map +1 -1
  244. package/build-module/utils/parse-css-unit-to-px.js +36 -3
  245. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  246. package/build-style/style-rtl.css +54 -64
  247. package/build-style/style.css +54 -64
  248. package/package.json +31 -31
  249. package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +24 -24
  250. package/src/components/block-lock/modal.js +1 -0
  251. package/src/components/block-lock/style.scss +0 -9
  252. package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +20 -20
  253. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +15 -15
  254. package/src/components/block-popover/inbetween.js +21 -53
  255. package/src/components/block-settings-menu/block-settings-dropdown.js +4 -1
  256. package/src/components/block-styles/index.js +5 -1
  257. package/src/components/block-types-list/index.native.js +2 -0
  258. package/src/components/child-layout-control/index.js +106 -0
  259. package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
  260. package/src/components/colors-gradients/control.js +3 -0
  261. package/src/components/date-format-picker/index.js +6 -8
  262. package/src/components/date-format-picker/style.scss +0 -5
  263. package/src/components/font-appearance-control/index.js +1 -1
  264. package/src/components/global-styles/dimensions-panel.js +627 -0
  265. package/src/components/global-styles/hooks.js +229 -66
  266. package/src/components/global-styles/index.js +9 -0
  267. package/src/components/global-styles/typography-panel.js +428 -0
  268. package/src/components/global-styles/use-global-styles-output.js +10 -5
  269. package/src/components/global-styles/utils.js +2 -0
  270. package/src/components/iframe/index.js +20 -18
  271. package/src/components/image-editor/aspect-ratio-dropdown.js +1 -0
  272. package/src/components/image-size-control/index.js +10 -12
  273. package/src/components/image-size-control/style.scss +3 -21
  274. package/src/components/index.native.js +5 -0
  275. package/src/components/inner-blocks/test/__snapshots__/index.js.snap +1 -1
  276. package/src/components/inserter/block-patterns-tab.js +9 -23
  277. package/src/components/inserter/block-types-tab.native.js +2 -0
  278. package/src/components/inserter/reusable-blocks-tab.native.js +2 -0
  279. package/src/components/inserter/search-results.native.js +2 -0
  280. package/src/components/inserter/test/__snapshots__/index.native.js.snap +15 -15
  281. package/src/components/inspector-controls/block-support-tools-panel.js +0 -1
  282. package/src/components/inspector-controls/fill.js +32 -8
  283. package/src/components/link-control/index.js +69 -34
  284. package/src/components/link-control/settings-drawer.js +85 -29
  285. package/src/components/link-control/settings.js +42 -0
  286. package/src/components/link-control/style.scss +63 -37
  287. package/src/components/link-control/test/index.js +347 -9
  288. package/src/components/list-view/block.js +7 -1
  289. package/src/components/list-view/expander.js +1 -0
  290. package/src/components/list-view/index.js +5 -0
  291. package/src/components/media-replace-flow/style.scss +7 -9
  292. package/src/components/media-replace-flow/test/index.js +1 -1
  293. package/src/components/off-canvas-editor/appender.js +13 -16
  294. package/src/components/off-canvas-editor/block-contents.js +2 -1
  295. package/src/components/off-canvas-editor/branch.js +1 -0
  296. package/src/components/off-canvas-editor/index.js +8 -2
  297. package/src/components/off-canvas-editor/leaf-more-menu.js +52 -15
  298. package/src/components/off-canvas-editor/link-ui.js +2 -0
  299. package/src/components/responsive-block-control/index.js +1 -0
  300. package/src/components/rich-text/index.js +8 -46
  301. package/src/components/rich-text/use-delete.js +59 -0
  302. package/src/components/rich-text/use-input-rules.js +13 -5
  303. package/src/components/url-input/index.js +3 -2
  304. package/src/components/url-popover/stories/index.js +1 -0
  305. package/src/components/writing-flow/use-selection-observer.js +5 -1
  306. package/src/hooks/align.js +1 -1
  307. package/src/hooks/dimensions.js +97 -269
  308. package/src/hooks/duotone.js +100 -30
  309. package/src/hooks/font-family.js +0 -58
  310. package/src/hooks/font-size.js +1 -36
  311. package/src/hooks/gap.js +0 -201
  312. package/src/hooks/index.js +1 -0
  313. package/src/hooks/layout.js +19 -6
  314. package/src/hooks/line-height.js +0 -33
  315. package/src/hooks/margin.js +1 -164
  316. package/src/hooks/padding.js +1 -163
  317. package/src/hooks/test/__snapshots__/align.native.js.snap +24 -24
  318. package/src/hooks/test/duotone.js +102 -0
  319. package/src/hooks/typography.js +112 -213
  320. package/src/hooks/utils.js +90 -0
  321. package/src/layouts/flex.js +1 -0
  322. package/src/store/actions.js +12 -4
  323. package/src/store/reducer.js +68 -43
  324. package/src/store/selectors.js +20 -1
  325. package/src/store/test/actions.js +4 -2
  326. package/src/utils/parse-css-unit-to-px.js +35 -5
  327. package/src/utils/test/parse-css-unit-to-px.js +12 -0
  328. package/build/hooks/child-layout.js +0 -213
  329. package/build/hooks/child-layout.js.map +0 -1
  330. package/build/hooks/font-appearance.js +0 -188
  331. package/build/hooks/font-appearance.js.map +0 -1
  332. package/build/hooks/letter-spacing.js +0 -129
  333. package/build/hooks/letter-spacing.js.map +0 -1
  334. package/build/hooks/min-height.js +0 -139
  335. package/build/hooks/min-height.js.map +0 -1
  336. package/build/hooks/text-decoration.js +0 -130
  337. package/build/hooks/text-decoration.js.map +0 -1
  338. package/build/hooks/text-transform.js +0 -130
  339. package/build/hooks/text-transform.js.map +0 -1
  340. package/build-module/hooks/child-layout.js +0 -193
  341. package/build-module/hooks/child-layout.js.map +0 -1
  342. package/build-module/hooks/font-appearance.js +0 -161
  343. package/build-module/hooks/font-appearance.js.map +0 -1
  344. package/build-module/hooks/letter-spacing.js +0 -107
  345. package/build-module/hooks/letter-spacing.js.map +0 -1
  346. package/build-module/hooks/min-height.js +0 -116
  347. package/build-module/hooks/min-height.js.map +0 -1
  348. package/build-module/hooks/text-decoration.js +0 -108
  349. package/build-module/hooks/text-decoration.js.map +0 -1
  350. package/build-module/hooks/text-transform.js +0 -108
  351. package/build-module/hooks/text-transform.js.map +0 -1
  352. package/src/hooks/child-layout.js +0 -195
  353. package/src/hooks/font-appearance.js +0 -146
  354. package/src/hooks/letter-spacing.js +0 -101
  355. package/src/hooks/min-height.js +0 -104
  356. package/src/hooks/text-decoration.js +0 -102
  357. package/src/hooks/text-transform.js +0 -101
@@ -5,28 +5,28 @@ exports[`BlockDraggable moves blocks: Initial order 1`] = `
5
5
  <p>This is a paragraph.</p>
6
6
  <!-- /wp:paragraph -->
7
7
 
8
- <!-- wp:image {\\"sizeSlug\\":\\"large\\"} -->
9
- <figure class=\\"wp-block-image size-large\\"><img src=\\"https://cldup.com/cXyG__fTLN.jpg\\" alt=\\"\\"/></figure>
8
+ <!-- wp:image {"sizeSlug":"large"} -->
9
+ <figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
10
10
  <!-- /wp:image -->
11
11
 
12
12
  <!-- wp:spacer -->
13
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
13
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
14
14
  <!-- /wp:spacer -->
15
15
 
16
- <!-- wp:gallery {\\"linkTo\\":\\"none\\"} -->
17
- <figure class=\\"wp-block-gallery has-nested-images columns-default is-cropped\\"><!-- wp:image {\\"sizeSlug\\":\\"large\\",\\"linkDestination\\":\\"none\\"} -->
18
- <figure class=\\"wp-block-image size-large\\"><img src=\\"https://cldup.com/cXyG__fTLN.jpg\\" alt=\\"\\"/></figure>
16
+ <!-- wp:gallery {"linkTo":"none"} -->
17
+ <figure class="wp-block-gallery has-nested-images columns-default is-cropped"><!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
18
+ <figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
19
19
  <!-- /wp:image -->
20
20
 
21
- <!-- wp:image {\\"sizeSlug\\":\\"large\\",\\"linkDestination\\":\\"none\\"} -->
22
- <figure class=\\"wp-block-image size-large\\"><img src=\\"https://cldup.com/cXyG__fTLN.jpg\\" alt=\\"\\"/></figure>
21
+ <!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
22
+ <figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
23
23
  <!-- /wp:image --></figure>
24
24
  <!-- /wp:gallery -->"
25
25
  `;
26
26
 
27
27
  exports[`BlockDraggable moves blocks: Paragraph block moved from first to second position 1`] = `
28
- "<!-- wp:image {\\"sizeSlug\\":\\"large\\"} -->
29
- <figure class=\\"wp-block-image size-large\\"><img src=\\"https://cldup.com/cXyG__fTLN.jpg\\" alt=\\"\\"/></figure>
28
+ "<!-- wp:image {"sizeSlug":"large"} -->
29
+ <figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
30
30
  <!-- /wp:image -->
31
31
 
32
32
  <!-- wp:paragraph -->
@@ -34,40 +34,40 @@ exports[`BlockDraggable moves blocks: Paragraph block moved from first to second
34
34
  <!-- /wp:paragraph -->
35
35
 
36
36
  <!-- wp:spacer -->
37
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
37
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
38
38
  <!-- /wp:spacer -->
39
39
 
40
- <!-- wp:gallery {\\"linkTo\\":\\"none\\"} -->
41
- <figure class=\\"wp-block-gallery has-nested-images columns-default is-cropped\\"><!-- wp:image {\\"sizeSlug\\":\\"large\\",\\"linkDestination\\":\\"none\\"} -->
42
- <figure class=\\"wp-block-image size-large\\"><img src=\\"https://cldup.com/cXyG__fTLN.jpg\\" alt=\\"\\"/></figure>
40
+ <!-- wp:gallery {"linkTo":"none"} -->
41
+ <figure class="wp-block-gallery has-nested-images columns-default is-cropped"><!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
42
+ <figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
43
43
  <!-- /wp:image -->
44
44
 
45
- <!-- wp:image {\\"sizeSlug\\":\\"large\\",\\"linkDestination\\":\\"none\\"} -->
46
- <figure class=\\"wp-block-image size-large\\"><img src=\\"https://cldup.com/cXyG__fTLN.jpg\\" alt=\\"\\"/></figure>
45
+ <!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
46
+ <figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
47
47
  <!-- /wp:image --></figure>
48
48
  <!-- /wp:gallery -->"
49
49
  `;
50
50
 
51
51
  exports[`BlockDraggable moves blocks: Spacer block moved from third to first position 1`] = `
52
52
  "<!-- wp:spacer -->
53
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
53
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
54
54
  <!-- /wp:spacer -->
55
55
 
56
- <!-- wp:image {\\"sizeSlug\\":\\"large\\"} -->
57
- <figure class=\\"wp-block-image size-large\\"><img src=\\"https://cldup.com/cXyG__fTLN.jpg\\" alt=\\"\\"/></figure>
56
+ <!-- wp:image {"sizeSlug":"large"} -->
57
+ <figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
58
58
  <!-- /wp:image -->
59
59
 
60
60
  <!-- wp:paragraph -->
61
61
  <p>This is a paragraph.</p>
62
62
  <!-- /wp:paragraph -->
63
63
 
64
- <!-- wp:gallery {\\"linkTo\\":\\"none\\"} -->
65
- <figure class=\\"wp-block-gallery has-nested-images columns-default is-cropped\\"><!-- wp:image {\\"sizeSlug\\":\\"large\\",\\"linkDestination\\":\\"none\\"} -->
66
- <figure class=\\"wp-block-image size-large\\"><img src=\\"https://cldup.com/cXyG__fTLN.jpg\\" alt=\\"\\"/></figure>
64
+ <!-- wp:gallery {"linkTo":"none"} -->
65
+ <figure class="wp-block-gallery has-nested-images columns-default is-cropped"><!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
66
+ <figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
67
67
  <!-- /wp:image -->
68
68
 
69
- <!-- wp:image {\\"sizeSlug\\":\\"large\\",\\"linkDestination\\":\\"none\\"} -->
70
- <figure class=\\"wp-block-image size-large\\"><img src=\\"https://cldup.com/cXyG__fTLN.jpg\\" alt=\\"\\"/></figure>
69
+ <!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
70
+ <figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
71
71
  <!-- /wp:image --></figure>
72
72
  <!-- /wp:gallery -->"
73
73
  `;
@@ -187,6 +187,7 @@ export default function BlockLockModal( { clientId, onClose } ) {
187
187
  </ul>
188
188
  { hasTemplateLock && (
189
189
  <ToggleControl
190
+ __nextHasNoMarginBottom
190
191
  className="block-editor-block-lock-modal__template-lock"
191
192
  label={ __( 'Apply to all blocks inside' ) }
192
193
  checked={ applyTemplateLock }
@@ -18,11 +18,6 @@
18
18
  .components-checkbox-control__label {
19
19
  font-weight: 600;
20
20
  }
21
-
22
- .components-base-control__field {
23
- align-items: center;
24
- display: flex;
25
- }
26
21
  }
27
22
  .block-editor-block-lock-modal__checklist-item {
28
23
  display: flex;
@@ -48,10 +43,6 @@
48
43
  border-top: $border-width solid $gray-300;
49
44
  margin-top: $grid-unit-20;
50
45
  padding: $grid-unit-15 0;
51
-
52
- .components-base-control__field {
53
- margin: 0;
54
- }
55
46
  }
56
47
 
57
48
  .block-editor-block-lock-modal__actions {
@@ -6,25 +6,25 @@ exports[`Block Actions Menu block options copies and pastes a block 1`] = `
6
6
  <!-- /wp:paragraph -->
7
7
 
8
8
  <!-- wp:heading -->
9
- <h2 class=\\"wp-block-heading\\"></h2>
9
+ <h2 class="wp-block-heading"></h2>
10
10
  <!-- /wp:heading -->
11
11
 
12
12
  <!-- wp:spacer -->
13
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
13
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
14
14
  <!-- /wp:spacer -->
15
15
 
16
16
  <!-- wp:heading -->
17
- <h2 class=\\"wp-block-heading\\"></h2>
17
+ <h2 class="wp-block-heading"></h2>
18
18
  <!-- /wp:heading -->"
19
19
  `;
20
20
 
21
21
  exports[`Block Actions Menu block options cuts and pastes a block 1`] = `
22
22
  "<!-- wp:spacer -->
23
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
23
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
24
24
  <!-- /wp:spacer -->
25
25
 
26
26
  <!-- wp:heading -->
27
- <h2 class=\\"wp-block-heading\\"></h2>
27
+ <h2 class="wp-block-heading"></h2>
28
28
  <!-- /wp:heading -->
29
29
 
30
30
  <!-- wp:paragraph -->
@@ -38,15 +38,15 @@ exports[`Block Actions Menu block options does not replace a non empty Paragraph
38
38
  <!-- /wp:paragraph -->
39
39
 
40
40
  <!-- wp:heading -->
41
- <h2 class=\\"wp-block-heading\\"></h2>
41
+ <h2 class="wp-block-heading"></h2>
42
42
  <!-- /wp:heading -->
43
43
 
44
44
  <!-- wp:spacer -->
45
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
45
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
46
46
  <!-- /wp:spacer -->
47
47
 
48
48
  <!-- wp:heading -->
49
- <h2 class=\\"wp-block-heading\\"></h2>
49
+ <h2 class="wp-block-heading"></h2>
50
50
  <!-- /wp:heading -->"
51
51
  `;
52
52
 
@@ -56,29 +56,29 @@ exports[`Block Actions Menu block options duplicates a block 1`] = `
56
56
  <!-- /wp:paragraph -->
57
57
 
58
58
  <!-- wp:spacer -->
59
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
59
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
60
60
  <!-- /wp:spacer -->
61
61
 
62
62
  <!-- wp:spacer -->
63
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
63
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
64
64
  <!-- /wp:spacer -->
65
65
 
66
66
  <!-- wp:heading -->
67
- <h2 class=\\"wp-block-heading\\"></h2>
67
+ <h2 class="wp-block-heading"></h2>
68
68
  <!-- /wp:heading -->"
69
69
  `;
70
70
 
71
71
  exports[`Block Actions Menu block options transforms a Paragraph block into a Pullquote block 1`] = `
72
72
  "<!-- wp:pullquote -->
73
- <figure class=\\"wp-block-pullquote\\"><blockquote><p>Hello!</p></blockquote></figure>
73
+ <figure class="wp-block-pullquote"><blockquote><p>Hello!</p></blockquote></figure>
74
74
  <!-- /wp:pullquote -->
75
75
 
76
76
  <!-- wp:spacer -->
77
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
77
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
78
78
  <!-- /wp:spacer -->
79
79
 
80
80
  <!-- wp:heading -->
81
- <h2 class=\\"wp-block-heading\\"></h2>
81
+ <h2 class="wp-block-heading"></h2>
82
82
  <!-- /wp:heading -->"
83
83
  `;
84
84
 
@@ -88,11 +88,11 @@ exports[`Block Actions Menu moving blocks disables the Move Down button for the
88
88
  <!-- /wp:paragraph -->
89
89
 
90
90
  <!-- wp:spacer -->
91
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
91
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
92
92
  <!-- /wp:spacer -->
93
93
 
94
94
  <!-- wp:heading -->
95
- <h2 class=\\"wp-block-heading\\"></h2>
95
+ <h2 class="wp-block-heading"></h2>
96
96
  <!-- /wp:heading -->"
97
97
  `;
98
98
 
@@ -102,17 +102,17 @@ exports[`Block Actions Menu moving blocks disables the Move Up button for the fi
102
102
  <!-- /wp:paragraph -->
103
103
 
104
104
  <!-- wp:spacer -->
105
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
105
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
106
106
  <!-- /wp:spacer -->
107
107
 
108
108
  <!-- wp:heading -->
109
- <h2 class=\\"wp-block-heading\\"></h2>
109
+ <h2 class="wp-block-heading"></h2>
110
110
  <!-- /wp:heading -->"
111
111
  `;
112
112
 
113
113
  exports[`Block Actions Menu moving blocks moves blocks up and down 1`] = `
114
114
  "<!-- wp:heading -->
115
- <h2 class=\\"wp-block-heading\\"></h2>
115
+ <h2 class="wp-block-heading"></h2>
116
116
  <!-- /wp:heading -->
117
117
 
118
118
  <!-- wp:paragraph -->
@@ -120,6 +120,6 @@ exports[`Block Actions Menu moving blocks moves blocks up and down 1`] = `
120
120
  <!-- /wp:paragraph -->
121
121
 
122
122
  <!-- wp:spacer -->
123
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
123
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
124
124
  <!-- /wp:spacer -->"
125
125
  `;
@@ -6,11 +6,11 @@ exports[`Block Mover Picker moving blocks disables the Move Down button for the
6
6
  <!-- /wp:paragraph -->
7
7
 
8
8
  <!-- wp:spacer -->
9
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
9
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
10
10
  <!-- /wp:spacer -->
11
11
 
12
12
  <!-- wp:heading -->
13
- <h2 class=\\"wp-block-heading\\"></h2>
13
+ <h2 class="wp-block-heading"></h2>
14
14
  <!-- /wp:heading -->"
15
15
  `;
16
16
 
@@ -20,17 +20,17 @@ exports[`Block Mover Picker moving blocks disables the Move Up button for the fi
20
20
  <!-- /wp:paragraph -->
21
21
 
22
22
  <!-- wp:spacer -->
23
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
23
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
24
24
  <!-- /wp:spacer -->
25
25
 
26
26
  <!-- wp:heading -->
27
- <h2 class=\\"wp-block-heading\\"></h2>
27
+ <h2 class="wp-block-heading"></h2>
28
28
  <!-- /wp:heading -->"
29
29
  `;
30
30
 
31
31
  exports[`Block Mover Picker moving blocks moves blocks up and down 1`] = `
32
32
  "<!-- wp:heading -->
33
- <h2 class=\\"wp-block-heading\\"></h2>
33
+ <h2 class="wp-block-heading"></h2>
34
34
  <!-- /wp:heading -->
35
35
 
36
36
  <!-- wp:paragraph -->
@@ -38,19 +38,19 @@ exports[`Block Mover Picker moving blocks moves blocks up and down 1`] = `
38
38
  <!-- /wp:paragraph -->
39
39
 
40
40
  <!-- wp:spacer -->
41
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
41
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
42
42
  <!-- /wp:spacer -->"
43
43
  `;
44
44
 
45
45
  exports[`Block Mover Picker should match snapshot 1`] = `
46
- Array [
46
+ [
47
47
  <View>
48
48
  <View
49
49
  accessibilityHint="Double tap to move the block to the left"
50
50
  accessibilityLabel="Move block left from position 2 to position 1"
51
51
  accessibilityRole="button"
52
52
  accessibilityState={
53
- Object {
53
+ {
54
54
  "disabled": false,
55
55
  }
56
56
  }
@@ -65,7 +65,7 @@ Array [
65
65
  onResponderTerminationRequest={[Function]}
66
66
  onStartShouldSetResponder={[Function]}
67
67
  style={
68
- Object {
68
+ {
69
69
  "alignItems": "center",
70
70
  "flex": 1,
71
71
  "justifyContent": "center",
@@ -81,7 +81,7 @@ Array [
81
81
  onGestureHandlerEvent={[Function]}
82
82
  onGestureHandlerStateChange={[Function]}
83
83
  style={
84
- Object {
84
+ {
85
85
  "alignItems": "center",
86
86
  "aspectRatio": 1,
87
87
  "flex": 1,
@@ -93,7 +93,7 @@ Array [
93
93
  >
94
94
  <View
95
95
  style={
96
- Object {
96
+ {
97
97
  "flexDirection": "row",
98
98
  }
99
99
  }
@@ -109,7 +109,7 @@ Array [
109
109
  accessibilityLabel="Move block right"
110
110
  accessibilityRole="button"
111
111
  accessibilityState={
112
- Object {
112
+ {
113
113
  "disabled": true,
114
114
  }
115
115
  }
@@ -124,7 +124,7 @@ Array [
124
124
  onResponderTerminationRequest={[Function]}
125
125
  onStartShouldSetResponder={[Function]}
126
126
  style={
127
- Object {
127
+ {
128
128
  "alignItems": "center",
129
129
  "flex": 1,
130
130
  "justifyContent": "center",
@@ -140,7 +140,7 @@ Array [
140
140
  onGestureHandlerEvent={[Function]}
141
141
  onGestureHandlerStateChange={[Function]}
142
142
  style={
143
- Object {
143
+ {
144
144
  "alignItems": "center",
145
145
  "aspectRatio": 1,
146
146
  "flex": 1,
@@ -152,7 +152,7 @@ Array [
152
152
  >
153
153
  <View
154
154
  style={
155
- Object {
155
+ {
156
156
  "flexDirection": "row",
157
157
  }
158
158
  }
@@ -68,53 +68,6 @@ function BlockPopoverInbetween( {
68
68
  const previousElement = useBlockElement( previousClientId );
69
69
  const nextElement = useBlockElement( nextClientId );
70
70
  const isVertical = orientation === 'vertical';
71
- const style = useMemo( () => {
72
- if (
73
- // popoverRecomputeCounter is by definition always equal or greater than 0.
74
- // This check is only there to satisfy the correctness of the
75
- // exhaustive-deps rule for the `useMemo` hook.
76
- popoverRecomputeCounter < 0 ||
77
- ( ! previousElement && ! nextElement ) ||
78
- ! isVisible
79
- ) {
80
- return {};
81
- }
82
-
83
- const previousRect = previousElement
84
- ? previousElement.getBoundingClientRect()
85
- : null;
86
- const nextRect = nextElement
87
- ? nextElement.getBoundingClientRect()
88
- : null;
89
-
90
- if ( isVertical ) {
91
- return {
92
- width: previousRect ? previousRect.width : nextRect.width,
93
- height:
94
- nextRect && previousRect
95
- ? nextRect.top - previousRect.bottom
96
- : 0,
97
- };
98
- }
99
-
100
- let width = 0;
101
- if ( previousRect && nextRect ) {
102
- width = isRTL()
103
- ? previousRect.left - nextRect.right
104
- : nextRect.left - previousRect.right;
105
- }
106
-
107
- return {
108
- width,
109
- height: previousRect ? previousRect.height : nextRect.height,
110
- };
111
- }, [
112
- previousElement,
113
- nextElement,
114
- isVertical,
115
- popoverRecomputeCounter,
116
- isVisible,
117
- ] );
118
71
 
119
72
  const popoverAnchor = useMemo( () => {
120
73
  if (
@@ -142,10 +95,17 @@ function BlockPopoverInbetween( {
142
95
 
143
96
  let left = 0;
144
97
  let top = 0;
98
+ let width = 0;
99
+ let height = 0;
145
100
 
146
101
  if ( isVertical ) {
147
102
  // vertical
148
103
  top = previousRect ? previousRect.bottom : nextRect.top;
104
+ width = previousRect ? previousRect.width : nextRect.width;
105
+ height =
106
+ nextRect && previousRect
107
+ ? nextRect.top - previousRect.bottom
108
+ : 0;
149
109
 
150
110
  if ( isRTL() ) {
151
111
  // vertical, rtl
@@ -158,21 +118,32 @@ function BlockPopoverInbetween( {
158
118
  }
159
119
  } else {
160
120
  top = previousRect ? previousRect.top : nextRect.top;
121
+ height = previousRect
122
+ ? previousRect.height
123
+ : nextRect.height;
161
124
 
162
125
  if ( isRTL() ) {
163
126
  // non vertical, rtl
164
127
  left = previousRect
165
128
  ? previousRect.left
166
129
  : nextRect.right;
130
+ width =
131
+ previousRect && nextRect
132
+ ? previousRect.left - nextRect.right
133
+ : 0;
167
134
  } else {
168
135
  // non vertical, ltr
169
136
  left = previousRect
170
137
  ? previousRect.right
171
138
  : nextRect.left;
139
+ width =
140
+ previousRect && nextRect
141
+ ? nextRect.left - previousRect.right
142
+ : 0;
172
143
  }
173
144
  }
174
145
 
175
- return new window.DOMRect( left, top, 0, 0 );
146
+ return new window.DOMRect( left, top, width, height );
176
147
  },
177
148
  };
178
149
  }, [
@@ -267,13 +238,10 @@ function BlockPopoverInbetween( {
267
238
  ) }
268
239
  resize={ false }
269
240
  flip={ false }
270
- placement="bottom-start"
241
+ placement="overlay"
271
242
  variant="unstyled"
272
243
  >
273
- <div
274
- className="block-editor-block-popover__inbetween-container"
275
- style={ style }
276
- >
244
+ <div className="block-editor-block-popover__inbetween-container">
277
245
  { children }
278
246
  </div>
279
247
  </Popover>
@@ -147,7 +147,9 @@ export function BlockSettingsDropdown( {
147
147
  __experimentalSelectBlock
148
148
  ? () => {
149
149
  const blockToSelect =
150
- previousBlockClientId || nextBlockClientId;
150
+ previousBlockClientId ||
151
+ nextBlockClientId ||
152
+ firstParentClientId;
151
153
 
152
154
  if (
153
155
  blockToSelect &&
@@ -166,6 +168,7 @@ export function BlockSettingsDropdown( {
166
168
  __experimentalSelectBlock,
167
169
  previousBlockClientId,
168
170
  nextBlockClientId,
171
+ firstParentClientId,
169
172
  selectedBlockClientIds,
170
173
  ]
171
174
  );
@@ -99,7 +99,11 @@ function BlockStyles( { clientId, onSwitch = noop, onHoverClassName = noop } ) {
99
99
  } ) }
100
100
  </div>
101
101
  { hoveredStyle && ! isMobileViewport && (
102
- <Popover placement="left-start" offset={ 20 }>
102
+ <Popover
103
+ placement="left-start"
104
+ offset={ 20 }
105
+ focusOnMount={ false }
106
+ >
103
107
  <div
104
108
  className="block-editor-block-styles__preview-panel"
105
109
  onMouseLeave={ () => styleItemHandler( null ) }
@@ -32,6 +32,7 @@ export default function BlockTypesList( {
32
32
  name,
33
33
  sections,
34
34
  onSelect,
35
+ label,
35
36
  listProps,
36
37
  initialNumToRender = 3,
37
38
  } ) {
@@ -154,6 +155,7 @@ export default function BlockTypesList( {
154
155
  <SectionList
155
156
  onLayout={ onLayout }
156
157
  testID={ `InserterUI-${ name }` }
158
+ accessibilityLabel={ label }
157
159
  keyboardShouldPersistTaps="always"
158
160
  sections={ sections }
159
161
  initialNumToRender={ initialNumToRender }
@@ -0,0 +1,106 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import {
5
+ __experimentalToggleGroupControl as ToggleGroupControl,
6
+ __experimentalToggleGroupControlOption as ToggleGroupControlOption,
7
+ __experimentalUnitControl as UnitControl,
8
+ } from '@wordpress/components';
9
+ import { __ } from '@wordpress/i18n';
10
+ import { useEffect } from '@wordpress/element';
11
+
12
+ function helpText( selfStretch, parentLayout ) {
13
+ const { orientation = 'horizontal' } = parentLayout;
14
+
15
+ if ( selfStretch === 'fill' ) {
16
+ return __( 'Stretch to fill available space.' );
17
+ }
18
+ if ( selfStretch === 'fixed' && orientation === 'horizontal' ) {
19
+ return __( 'Specify a fixed width.' );
20
+ } else if ( selfStretch === 'fixed' ) {
21
+ return __( 'Specify a fixed height.' );
22
+ }
23
+ return __( 'Fit contents.' );
24
+ }
25
+
26
+ /**
27
+ * Form to edit the child layout value.
28
+ *
29
+ * @param {Object} props Props.
30
+ * @param {Object} props.value The child layout value.
31
+ * @param {Function} props.onChange Function to update the child layout value.
32
+ * @param {Object} props.parentLayout The parent layout value.
33
+ *
34
+ * @return {WPElement} child layout edit element.
35
+ */
36
+ export default function ChildLayoutControl( {
37
+ value: childLayout = {},
38
+ onChange,
39
+ parentLayout,
40
+ } ) {
41
+ const { selfStretch, flexSize } = childLayout;
42
+
43
+ useEffect( () => {
44
+ if ( selfStretch === 'fixed' && ! flexSize ) {
45
+ onChange( {
46
+ ...childLayout,
47
+ selfStretch: 'fit',
48
+ } );
49
+ }
50
+ }, [] );
51
+
52
+ return (
53
+ <>
54
+ <ToggleGroupControl
55
+ __nextHasNoMarginBottom
56
+ size={ '__unstable-large' }
57
+ label={ childLayoutOrientation( parentLayout ) }
58
+ value={ selfStretch || 'fit' }
59
+ help={ helpText( selfStretch, parentLayout ) }
60
+ onChange={ ( value ) => {
61
+ const newFlexSize = value !== 'fixed' ? null : flexSize;
62
+ onChange( {
63
+ ...childLayout,
64
+ selfStretch: value,
65
+ flexSize: newFlexSize,
66
+ } );
67
+ } }
68
+ isBlock={ true }
69
+ >
70
+ <ToggleGroupControlOption
71
+ key={ 'fit' }
72
+ value={ 'fit' }
73
+ label={ __( 'Fit' ) }
74
+ />
75
+ <ToggleGroupControlOption
76
+ key={ 'fill' }
77
+ value={ 'fill' }
78
+ label={ __( 'Fill' ) }
79
+ />
80
+ <ToggleGroupControlOption
81
+ key={ 'fixed' }
82
+ value={ 'fixed' }
83
+ label={ __( 'Fixed' ) }
84
+ />
85
+ </ToggleGroupControl>
86
+ { selfStretch === 'fixed' && (
87
+ <UnitControl
88
+ size={ '__unstable-large' }
89
+ onChange={ ( value ) => {
90
+ onChange( {
91
+ ...childLayout,
92
+ flexSize: value,
93
+ } );
94
+ } }
95
+ value={ flexSize }
96
+ />
97
+ ) }
98
+ </>
99
+ );
100
+ }
101
+
102
+ export function childLayoutOrientation( parentLayout ) {
103
+ const { orientation = 'horizontal' } = parentLayout;
104
+
105
+ return orientation === 'horizontal' ? __( 'Width' ) : __( 'Height' );
106
+ }
@@ -158,7 +158,7 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
158
158
  <button
159
159
  aria-expanded="false"
160
160
  aria-haspopup="true"
161
- aria-label="Custom color picker. The currently selected color is called \\"red\\" and has a value of \\"f00\\"."
161
+ aria-label="Custom color picker. The currently selected color is called "red" and has a value of "f00"."
162
162
  class="components-flex components-color-palette__custom-color emotion-10 emotion-5"
163
163
  data-wp-c16t="true"
164
164
  data-wp-component="Flex"