@wordpress/block-editor 15.22.1-next.v.202606191442.0 → 15.22.1

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 (352) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +2 -2
  3. package/build/components/block-editing-mode/index.cjs +13 -7
  4. package/build/components/block-editing-mode/index.cjs.map +2 -2
  5. package/build/components/block-inspector/index.cjs +32 -16
  6. package/build/components/block-inspector/index.cjs.map +2 -2
  7. package/build/components/block-rename/modal.cjs +0 -1
  8. package/build/components/block-rename/modal.cjs.map +2 -2
  9. package/build/components/block-toolbar/block-toolbar-icon.cjs +14 -6
  10. package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
  11. package/build/components/colors-gradients/control.cjs +25 -14
  12. package/build/components/colors-gradients/control.cjs.map +2 -2
  13. package/build/components/colors-gradients/dropdown.cjs +4 -1
  14. package/build/components/colors-gradients/dropdown.cjs.map +3 -3
  15. package/build/components/contrast-checker/index.cjs +22 -4
  16. package/build/components/contrast-checker/index.cjs.map +2 -2
  17. package/build/components/date-format-picker/index.cjs +0 -1
  18. package/build/components/date-format-picker/index.cjs.map +2 -2
  19. package/build/components/global-styles/background-panel.cjs +153 -25
  20. package/build/components/global-styles/background-panel.cjs.map +3 -3
  21. package/build/components/global-styles/color-gradient-dropdown-item.cjs +227 -0
  22. package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +7 -0
  23. package/build/components/global-styles/color-panel.cjs +98 -375
  24. package/build/components/global-styles/color-panel.cjs.map +3 -3
  25. package/build/components/global-styles/dimensions-panel.cjs +0 -3
  26. package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
  27. package/build/components/global-styles/hooks.cjs +34 -0
  28. package/build/components/global-styles/hooks.cjs.map +2 -2
  29. package/build/components/global-styles/typography-panel.cjs +82 -10
  30. package/build/components/global-styles/typography-panel.cjs.map +3 -3
  31. package/build/components/inspector-controls/groups.cjs +2 -0
  32. package/build/components/inspector-controls/groups.cjs.map +2 -2
  33. package/build/components/inspector-controls-tabs/styles-tab.cjs +75 -31
  34. package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
  35. package/build/components/link-control/index.cjs +1 -2
  36. package/build/components/link-control/index.cjs.map +2 -2
  37. package/build/components/list-view/block-select-button.cjs +1 -10
  38. package/build/components/list-view/block-select-button.cjs.map +3 -3
  39. package/build/components/provider/use-block-sync.cjs +3 -1
  40. package/build/components/provider/use-block-sync.cjs.map +2 -2
  41. package/build/components/url-popover/image-url-input-ui.cjs +0 -2
  42. package/build/components/url-popover/image-url-input-ui.cjs.map +2 -2
  43. package/build/components/use-block-display-information/index.cjs +10 -3
  44. package/build/components/use-block-display-information/index.cjs.map +2 -2
  45. package/build/hooks/anchor.cjs +0 -1
  46. package/build/hooks/anchor.cjs.map +2 -2
  47. package/build/hooks/background.cjs +124 -75
  48. package/build/hooks/background.cjs.map +3 -3
  49. package/build/hooks/color.cjs +0 -162
  50. package/build/hooks/color.cjs.map +3 -3
  51. package/build/hooks/contrast-checker.cjs +31 -28
  52. package/build/hooks/contrast-checker.cjs.map +3 -3
  53. package/build/hooks/custom-class-name.cjs +0 -1
  54. package/build/hooks/custom-class-name.cjs.map +2 -2
  55. package/build/hooks/elements.cjs +142 -0
  56. package/build/hooks/elements.cjs.map +7 -0
  57. package/build/hooks/grid-visualizer.cjs +21 -11
  58. package/build/hooks/grid-visualizer.cjs.map +2 -2
  59. package/build/hooks/layout-child.cjs +38 -8
  60. package/build/hooks/layout-child.cjs.map +2 -2
  61. package/build/hooks/layout.cjs +6 -3
  62. package/build/hooks/layout.cjs.map +2 -2
  63. package/build/hooks/states.cjs +2 -2
  64. package/build/hooks/states.cjs.map +2 -2
  65. package/build/hooks/style.cjs +8 -4
  66. package/build/hooks/style.cjs.map +2 -2
  67. package/build/hooks/typography.cjs +62 -10
  68. package/build/hooks/typography.cjs.map +3 -3
  69. package/build/layouts/flex.cjs +99 -6
  70. package/build/layouts/flex.cjs.map +2 -2
  71. package/build/utils/block-bindings.cjs +9 -9
  72. package/build/utils/block-bindings.cjs.map +3 -3
  73. package/build/utils/color-values.cjs +10 -1
  74. package/build/utils/color-values.cjs.map +3 -3
  75. package/build/utils/dom.cjs +2 -5
  76. package/build/utils/dom.cjs.map +3 -3
  77. package/build/utils/fit-text-frontend.cjs +6 -2
  78. package/build/utils/fit-text-frontend.cjs.map +3 -3
  79. package/build/utils/fit-text-utils.cjs +1 -1
  80. package/build/utils/fit-text-utils.cjs.map +3 -3
  81. package/build/utils/format-font-style.cjs +1 -1
  82. package/build/utils/format-font-style.cjs.map +3 -3
  83. package/build/utils/format-font-weight.cjs +1 -1
  84. package/build/utils/format-font-weight.cjs.map +3 -3
  85. package/build/utils/get-editor-region.cjs +4 -2
  86. package/build/utils/get-editor-region.cjs.map +3 -3
  87. package/build/utils/get-font-styles-and-weights.cjs +8 -12
  88. package/build/utils/get-font-styles-and-weights.cjs.map +3 -3
  89. package/build/utils/get-px-from-css-unit.cjs +1 -1
  90. package/build/utils/get-px-from-css-unit.cjs.map +1 -1
  91. package/build/utils/index.cjs +1 -1
  92. package/build/utils/index.cjs.map +1 -1
  93. package/build/utils/math.cjs +1 -1
  94. package/build/utils/math.cjs.map +3 -3
  95. package/build/utils/object.cjs +8 -8
  96. package/build/utils/object.cjs.map +3 -3
  97. package/build/utils/order-inserter-block-items.cjs +1 -1
  98. package/build/utils/order-inserter-block-items.cjs.map +3 -3
  99. package/build/utils/pasting.cjs +4 -2
  100. package/build/utils/pasting.cjs.map +3 -3
  101. package/build/utils/selection.cjs +2 -1
  102. package/build/utils/selection.cjs.map +3 -3
  103. package/build/utils/sorting.cjs +9 -3
  104. package/build/utils/sorting.cjs.map +3 -3
  105. package/build/utils/transform-styles/index.cjs +3 -2
  106. package/build/utils/transform-styles/index.cjs.map +3 -3
  107. package/build/utils/transform-styles/postcss-urlrebase.d.cjs +2 -0
  108. package/build/utils/transform-styles/postcss-urlrebase.d.cjs.map +7 -0
  109. package/build/utils/transform-styles/types.cjs +19 -0
  110. package/build/utils/transform-styles/types.cjs.map +7 -0
  111. package/build/utils/types.cjs +19 -0
  112. package/build/utils/types.cjs.map +7 -0
  113. package/build-module/components/block-editing-mode/index.mjs +14 -8
  114. package/build-module/components/block-editing-mode/index.mjs.map +2 -2
  115. package/build-module/components/block-inspector/index.mjs +32 -16
  116. package/build-module/components/block-inspector/index.mjs.map +2 -2
  117. package/build-module/components/block-rename/modal.mjs +0 -1
  118. package/build-module/components/block-rename/modal.mjs.map +2 -2
  119. package/build-module/components/block-toolbar/block-toolbar-icon.mjs +14 -6
  120. package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
  121. package/build-module/components/colors-gradients/control.mjs +27 -15
  122. package/build-module/components/colors-gradients/control.mjs.map +2 -2
  123. package/build-module/components/colors-gradients/dropdown.mjs +4 -1
  124. package/build-module/components/colors-gradients/dropdown.mjs.map +2 -2
  125. package/build-module/components/contrast-checker/index.mjs +18 -4
  126. package/build-module/components/contrast-checker/index.mjs.map +2 -2
  127. package/build-module/components/date-format-picker/index.mjs +0 -1
  128. package/build-module/components/date-format-picker/index.mjs.map +2 -2
  129. package/build-module/components/global-styles/background-panel.mjs +155 -27
  130. package/build-module/components/global-styles/background-panel.mjs.map +2 -2
  131. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +207 -0
  132. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +7 -0
  133. package/build-module/components/global-styles/color-panel.mjs +106 -387
  134. package/build-module/components/global-styles/color-panel.mjs.map +3 -3
  135. package/build-module/components/global-styles/dimensions-panel.mjs +0 -3
  136. package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
  137. package/build-module/components/global-styles/hooks.mjs +33 -0
  138. package/build-module/components/global-styles/hooks.mjs.map +2 -2
  139. package/build-module/components/global-styles/typography-panel.mjs +84 -10
  140. package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
  141. package/build-module/components/inspector-controls/groups.mjs +2 -0
  142. package/build-module/components/inspector-controls/groups.mjs.map +2 -2
  143. package/build-module/components/inspector-controls-tabs/styles-tab.mjs +75 -31
  144. package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
  145. package/build-module/components/link-control/index.mjs +1 -2
  146. package/build-module/components/link-control/index.mjs.map +2 -2
  147. package/build-module/components/list-view/block-select-button.mjs +2 -17
  148. package/build-module/components/list-view/block-select-button.mjs.map +2 -2
  149. package/build-module/components/provider/use-block-sync.mjs +3 -1
  150. package/build-module/components/provider/use-block-sync.mjs.map +2 -2
  151. package/build-module/components/url-popover/image-url-input-ui.mjs +0 -2
  152. package/build-module/components/url-popover/image-url-input-ui.mjs.map +2 -2
  153. package/build-module/components/use-block-display-information/index.mjs +10 -3
  154. package/build-module/components/use-block-display-information/index.mjs.map +2 -2
  155. package/build-module/hooks/anchor.mjs +0 -1
  156. package/build-module/hooks/anchor.mjs.map +2 -2
  157. package/build-module/hooks/background.mjs +123 -75
  158. package/build-module/hooks/background.mjs.map +2 -2
  159. package/build-module/hooks/color.mjs +2 -175
  160. package/build-module/hooks/color.mjs.map +2 -2
  161. package/build-module/hooks/contrast-checker.mjs +32 -19
  162. package/build-module/hooks/contrast-checker.mjs.map +2 -2
  163. package/build-module/hooks/custom-class-name.mjs +0 -1
  164. package/build-module/hooks/custom-class-name.mjs.map +2 -2
  165. package/build-module/hooks/elements.mjs +115 -0
  166. package/build-module/hooks/elements.mjs.map +7 -0
  167. package/build-module/hooks/grid-visualizer.mjs +21 -11
  168. package/build-module/hooks/grid-visualizer.mjs.map +2 -2
  169. package/build-module/hooks/layout-child.mjs +41 -8
  170. package/build-module/hooks/layout-child.mjs.map +2 -2
  171. package/build-module/hooks/layout.mjs +6 -3
  172. package/build-module/hooks/layout.mjs.map +2 -2
  173. package/build-module/hooks/states.mjs +2 -2
  174. package/build-module/hooks/states.mjs.map +2 -2
  175. package/build-module/hooks/style.mjs +9 -5
  176. package/build-module/hooks/style.mjs.map +2 -2
  177. package/build-module/hooks/typography.mjs +62 -10
  178. package/build-module/hooks/typography.mjs.map +2 -2
  179. package/build-module/layouts/flex.mjs +105 -7
  180. package/build-module/layouts/flex.mjs.map +2 -2
  181. package/build-module/utils/block-bindings.mjs +9 -9
  182. package/build-module/utils/block-bindings.mjs.map +3 -3
  183. package/build-module/utils/color-values.mjs +9 -1
  184. package/build-module/utils/color-values.mjs.map +3 -3
  185. package/build-module/utils/dom.mjs +2 -5
  186. package/build-module/utils/dom.mjs.map +3 -3
  187. package/build-module/utils/fit-text-frontend.mjs +6 -2
  188. package/build-module/utils/fit-text-frontend.mjs.map +3 -3
  189. package/build-module/utils/fit-text-utils.mjs +1 -1
  190. package/build-module/utils/fit-text-utils.mjs.map +3 -3
  191. package/build-module/utils/format-font-style.mjs +1 -1
  192. package/build-module/utils/format-font-style.mjs.map +3 -3
  193. package/build-module/utils/format-font-weight.mjs +1 -1
  194. package/build-module/utils/format-font-weight.mjs.map +3 -3
  195. package/build-module/utils/get-editor-region.mjs +4 -2
  196. package/build-module/utils/get-editor-region.mjs.map +3 -3
  197. package/build-module/utils/get-font-styles-and-weights.mjs +8 -12
  198. package/build-module/utils/get-font-styles-and-weights.mjs.map +3 -3
  199. package/build-module/utils/get-px-from-css-unit.mjs +1 -1
  200. package/build-module/utils/get-px-from-css-unit.mjs.map +1 -1
  201. package/build-module/utils/index.mjs +1 -1
  202. package/build-module/utils/index.mjs.map +1 -1
  203. package/build-module/utils/math.mjs +1 -1
  204. package/build-module/utils/math.mjs.map +3 -3
  205. package/build-module/utils/object.mjs +8 -8
  206. package/build-module/utils/object.mjs.map +3 -3
  207. package/build-module/utils/order-inserter-block-items.mjs +1 -1
  208. package/build-module/utils/order-inserter-block-items.mjs.map +3 -3
  209. package/build-module/utils/pasting.mjs +4 -2
  210. package/build-module/utils/pasting.mjs.map +3 -3
  211. package/build-module/utils/selection.mjs +2 -1
  212. package/build-module/utils/selection.mjs.map +3 -3
  213. package/build-module/utils/sorting.mjs +9 -3
  214. package/build-module/utils/sorting.mjs.map +3 -3
  215. package/build-module/utils/transform-styles/index.mjs +3 -2
  216. package/build-module/utils/transform-styles/index.mjs.map +3 -3
  217. package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs +1 -0
  218. package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs.map +7 -0
  219. package/build-module/utils/transform-styles/types.mjs +1 -0
  220. package/build-module/utils/transform-styles/types.mjs.map +7 -0
  221. package/build-module/utils/types.mjs +1 -0
  222. package/build-module/utils/types.mjs.map +7 -0
  223. package/build-style/content-rtl.css +2 -0
  224. package/build-style/content.css +2 -0
  225. package/build-style/style-rtl.css +34 -41
  226. package/build-style/style.css +34 -41
  227. package/build-types/utils/block-bindings.d.ts +27 -0
  228. package/build-types/utils/block-bindings.d.ts.map +1 -0
  229. package/build-types/utils/color-values.d.ts +40 -0
  230. package/build-types/utils/color-values.d.ts.map +1 -0
  231. package/build-types/utils/dom.d.ts +19 -19
  232. package/build-types/utils/dom.d.ts.map +1 -1
  233. package/build-types/utils/fit-text-frontend.d.ts +7 -0
  234. package/build-types/utils/fit-text-frontend.d.ts.map +1 -0
  235. package/build-types/utils/fit-text-utils.d.ts +15 -0
  236. package/build-types/utils/fit-text-utils.d.ts.map +1 -0
  237. package/build-types/utils/format-font-style.d.ts +12 -0
  238. package/build-types/utils/format-font-style.d.ts.map +1 -0
  239. package/build-types/utils/format-font-weight.d.ts +12 -0
  240. package/build-types/utils/format-font-weight.d.ts.map +1 -0
  241. package/build-types/utils/get-editor-region.d.ts +9 -0
  242. package/build-types/utils/get-editor-region.d.ts.map +1 -0
  243. package/build-types/utils/get-font-styles-and-weights.d.ts +16 -0
  244. package/build-types/utils/get-font-styles-and-weights.d.ts.map +1 -0
  245. package/build-types/utils/get-px-from-css-unit.d.ts +10 -0
  246. package/build-types/utils/get-px-from-css-unit.d.ts.map +1 -0
  247. package/build-types/utils/index.d.ts +3 -0
  248. package/build-types/utils/index.d.ts.map +1 -0
  249. package/build-types/utils/math.d.ts +61 -0
  250. package/build-types/utils/math.d.ts.map +1 -0
  251. package/build-types/utils/object.d.ts +39 -0
  252. package/build-types/utils/object.d.ts.map +1 -0
  253. package/build-types/utils/order-inserter-block-items.d.ts +13 -0
  254. package/build-types/utils/order-inserter-block-items.d.ts.map +1 -0
  255. package/build-types/utils/pasting.d.ts +28 -0
  256. package/build-types/utils/pasting.d.ts.map +1 -0
  257. package/build-types/utils/selection.d.ts +21 -0
  258. package/build-types/utils/selection.d.ts.map +1 -0
  259. package/build-types/utils/sorting.d.ts +17 -0
  260. package/build-types/utils/sorting.d.ts.map +1 -0
  261. package/build-types/utils/transform-styles/index.d.ts +15 -0
  262. package/build-types/utils/transform-styles/index.d.ts.map +1 -0
  263. package/build-types/utils/transform-styles/types.d.ts +13 -0
  264. package/build-types/utils/transform-styles/types.d.ts.map +1 -0
  265. package/build-types/utils/types.d.ts +28 -0
  266. package/build-types/utils/types.d.ts.map +1 -0
  267. package/package.json +40 -39
  268. package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -0
  269. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -0
  270. package/src/components/block-editing-mode/index.js +17 -9
  271. package/src/components/block-icon/test/__snapshots__/index.js.snap +1 -0
  272. package/src/components/block-inspector/index.js +20 -10
  273. package/src/components/block-rename/modal.js +0 -1
  274. package/src/components/block-toolbar/block-toolbar-icon.js +22 -6
  275. package/src/components/block-toolbar/test/block-toolbar-icon.js +99 -0
  276. package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +4 -0
  277. package/src/components/colors-gradients/control.js +29 -12
  278. package/src/components/colors-gradients/dropdown.js +4 -1
  279. package/src/components/colors-gradients/style.scss +39 -2
  280. package/src/components/contrast-checker/README.md +9 -0
  281. package/src/components/contrast-checker/index.js +42 -3
  282. package/src/components/date-format-picker/index.js +0 -1
  283. package/src/components/default-block-appender/content.scss +3 -0
  284. package/src/components/global-styles/background-panel.js +201 -34
  285. package/src/components/global-styles/color-gradient-dropdown-item.js +258 -0
  286. package/src/components/global-styles/color-panel.js +125 -487
  287. package/src/components/global-styles/dimensions-panel.js +0 -3
  288. package/src/components/global-styles/hooks.js +45 -0
  289. package/src/components/global-styles/test/background-panel.js +56 -0
  290. package/src/components/global-styles/test/color-panel.js +172 -118
  291. package/src/components/global-styles/test/typography-panel.js +167 -0
  292. package/src/components/global-styles/typography-panel.js +100 -11
  293. package/src/components/inspector-controls/README.md +0 -2
  294. package/src/components/inspector-controls/groups.js +2 -0
  295. package/src/components/inspector-controls-tabs/styles-tab.js +74 -28
  296. package/src/components/link-control/index.js +0 -1
  297. package/src/components/link-control/test/index.js +2 -3
  298. package/src/components/list-view/block-select-button.js +2 -17
  299. package/src/components/provider/use-block-sync.js +3 -1
  300. package/src/components/rich-text/content.scss +2 -0
  301. package/src/components/url-popover/image-url-input-ui.js +0 -2
  302. package/src/components/use-block-display-information/index.js +15 -2
  303. package/src/components/use-block-display-information/test/index.js +140 -0
  304. package/src/hooks/anchor.js +0 -1
  305. package/src/hooks/background.js +210 -133
  306. package/src/hooks/background.scss +0 -35
  307. package/src/hooks/color.js +2 -205
  308. package/src/hooks/color.scss +3 -9
  309. package/src/hooks/contrast-checker.js +60 -17
  310. package/src/hooks/custom-class-name.js +0 -1
  311. package/src/hooks/elements.js +140 -0
  312. package/src/hooks/elements.scss +8 -0
  313. package/src/hooks/grid-visualizer.js +59 -45
  314. package/src/hooks/layout-child.js +51 -12
  315. package/src/hooks/layout.js +6 -3
  316. package/src/hooks/states.js +2 -2
  317. package/src/hooks/style.js +11 -7
  318. package/src/hooks/test/background.js +59 -0
  319. package/src/hooks/test/block-style-state.js +14 -14
  320. package/src/hooks/test/layout.js +6 -6
  321. package/src/hooks/test/style.js +8 -8
  322. package/src/hooks/typography.js +70 -6
  323. package/src/layouts/flex.js +118 -15
  324. package/src/store/test/private-selectors.js +28 -7
  325. package/src/store/test/reducer.js +61 -10
  326. package/src/style.scss +1 -0
  327. package/src/utils/block-bindings.ts +51 -0
  328. package/src/utils/color-values.ts +63 -0
  329. package/src/utils/{dom.js → dom.ts} +27 -27
  330. package/src/utils/{fit-text-frontend.js → fit-text-frontend.ts} +12 -4
  331. package/src/utils/{fit-text-utils.js → fit-text-utils.ts} +15 -7
  332. package/src/utils/{format-font-style.js → format-font-style.ts} +10 -3
  333. package/src/utils/{format-font-weight.js → format-font-weight.ts} +10 -3
  334. package/src/utils/{get-editor-region.js → get-editor-region.ts} +10 -6
  335. package/src/utils/{get-font-styles-and-weights.js → get-font-styles-and-weights.ts} +21 -17
  336. package/src/utils/{math.js → math.ts} +37 -30
  337. package/src/utils/object.ts +89 -0
  338. package/src/utils/{order-inserter-block-items.js → order-inserter-block-items.ts} +8 -5
  339. package/src/utils/{pasting.js → pasting.ts} +18 -11
  340. package/src/utils/{selection.js → selection.ts} +11 -4
  341. package/src/utils/sorting.ts +81 -0
  342. package/src/utils/test/color-values.js +44 -1
  343. package/src/utils/transform-styles/{index.js → index.ts} +25 -25
  344. package/src/utils/transform-styles/postcss-urlrebase.d.ts +15 -0
  345. package/src/utils/transform-styles/types.ts +13 -0
  346. package/src/utils/types.ts +29 -0
  347. package/src/utils/block-bindings.js +0 -46
  348. package/src/utils/color-values.js +0 -28
  349. package/src/utils/object.js +0 -67
  350. package/src/utils/sorting.js +0 -54
  351. /package/src/utils/{get-px-from-css-unit.js → get-px-from-css-unit.ts} +0 -0
  352. /package/src/utils/{index.js → index.ts} +0 -0
@@ -3,10 +3,69 @@
3
3
  */
4
4
  import {
5
5
  setBackgroundStyleDefaults,
6
+ backgroundResetAllFilter,
6
7
  BACKGROUND_BLOCK_DEFAULT_VALUES,
7
8
  } from '../background';
8
9
 
9
10
  describe( 'background', () => {
11
+ describe( 'backgroundResetAllFilter', () => {
12
+ it( 'clears every background-owned value, including a custom legacy color.gradient', () => {
13
+ const result = backgroundResetAllFilter( {
14
+ backgroundColor: 'primary',
15
+ gradient: 'vivid-cyan-blue',
16
+ className: 'is-style-fancy has-background',
17
+ style: {
18
+ color: {
19
+ text: 'var:preset|color|contrast',
20
+ background: 'var:preset|color|base',
21
+ gradient:
22
+ 'linear-gradient(135deg,rgb(100,100,200) 0%,rgb(200,100,100) 100%)',
23
+ },
24
+ spacing: { padding: '10px' },
25
+ background: { backgroundImage: { url: 'image.png' } },
26
+ },
27
+ } );
28
+
29
+ // Background color and gradient attributes are cleared.
30
+ expect( result.backgroundColor ).toBeUndefined();
31
+ expect( result.gradient ).toBeUndefined();
32
+
33
+ // The legacy `color.gradient` (a raw/custom value) is cleared. This
34
+ // is the regression guard: it was previously kept for blocks
35
+ // without `background.gradient` support.
36
+ expect( result.style?.color?.gradient ).toBeUndefined();
37
+ expect( result.style?.color?.background ).toBeUndefined();
38
+ expect( result.style?.background ).toBeUndefined();
39
+
40
+ // Unrelated styles are preserved.
41
+ expect( result.style?.color?.text ).toBe(
42
+ 'var:preset|color|contrast'
43
+ );
44
+ expect( result.style?.spacing ).toEqual( { padding: '10px' } );
45
+
46
+ // The `has-background` class is removed, other classes remain.
47
+ expect( result.className ).toBe( 'is-style-fancy' );
48
+ } );
49
+
50
+ it( 'drops className entirely when has-background was its only value', () => {
51
+ const result = backgroundResetAllFilter( {
52
+ className: 'has-background',
53
+ style: {
54
+ color: { gradient: 'linear-gradient(0deg,#000,#fff)' },
55
+ },
56
+ } );
57
+ expect( result.className ).toBeUndefined();
58
+ } );
59
+
60
+ it( 'leaves className untouched when has-background is not present', () => {
61
+ const result = backgroundResetAllFilter( {
62
+ className: 'is-style-fancy',
63
+ style: {},
64
+ } );
65
+ expect( result.className ).toBe( 'is-style-fancy' );
66
+ } );
67
+ } );
68
+
10
69
  describe( 'setBackgroundStyleDefaults', () => {
11
70
  const backgroundStyles = {
12
71
  backgroundImage: { id: 123, url: 'image.png' },
@@ -38,12 +38,12 @@ describe( 'getStyleForState', () => {
38
38
  it( 'returns the selected viewport state style', () => {
39
39
  const style = {
40
40
  color: { text: '#000000' },
41
- mobile: { color: { text: '#ff0000' } },
41
+ '@mobile': { color: { text: '#ff0000' } },
42
42
  };
43
43
 
44
44
  expect(
45
45
  getStyleForState( style, {
46
- viewport: 'mobile',
46
+ viewport: '@mobile',
47
47
  pseudo: 'default',
48
48
  } )
49
49
  ).toEqual( {
@@ -53,14 +53,14 @@ describe( 'getStyleForState', () => {
53
53
 
54
54
  it( 'returns the selected viewport pseudo state style', () => {
55
55
  const style = {
56
- mobile: {
56
+ '@mobile': {
57
57
  ':hover': { color: { text: '#ff0000' } },
58
58
  },
59
59
  };
60
60
 
61
61
  expect(
62
62
  getStyleForState( style, {
63
- viewport: 'mobile',
63
+ viewport: '@mobile',
64
64
  pseudo: ':hover',
65
65
  } )
66
66
  ).toEqual( {
@@ -105,14 +105,14 @@ describe( 'setStyleForState', () => {
105
105
  setStyleForState(
106
106
  {
107
107
  color: { text: '#000000' },
108
- mobile: { color: { text: '#ff0000' } },
108
+ '@mobile': { color: { text: '#ff0000' } },
109
109
  },
110
- { viewport: 'mobile', pseudo: 'default' },
110
+ { viewport: '@mobile', pseudo: 'default' },
111
111
  { typography: { fontSize: '32px' } }
112
112
  )
113
113
  ).toEqual( {
114
114
  color: { text: '#000000' },
115
- mobile: { typography: { fontSize: '32px' } },
115
+ '@mobile': { typography: { fontSize: '32px' } },
116
116
  } );
117
117
  } );
118
118
 
@@ -121,17 +121,17 @@ describe( 'setStyleForState', () => {
121
121
  setStyleForState(
122
122
  {
123
123
  color: { text: '#000000' },
124
- mobile: {
124
+ '@mobile': {
125
125
  color: { text: '#ff0000' },
126
126
  ':hover': { color: { text: '#00ff00' } },
127
127
  },
128
128
  },
129
- { viewport: 'mobile', pseudo: ':hover' },
129
+ { viewport: '@mobile', pseudo: ':hover' },
130
130
  { typography: { fontSize: '32px' } }
131
131
  )
132
132
  ).toEqual( {
133
133
  color: { text: '#000000' },
134
- mobile: {
134
+ '@mobile': {
135
135
  color: { text: '#ff0000' },
136
136
  ':hover': { typography: { fontSize: '32px' } },
137
137
  },
@@ -234,7 +234,7 @@ describe( 'scopeResetAllFilterToState', () => {
234
234
  const attributes = {
235
235
  style: {
236
236
  color: { text: '#000000' },
237
- mobile: {
237
+ '@mobile': {
238
238
  color: { text: '#ff0000' },
239
239
  ':hover': { color: { text: '#00ff00' } },
240
240
  },
@@ -242,17 +242,17 @@ describe( 'scopeResetAllFilterToState', () => {
242
242
  };
243
243
 
244
244
  const result = scopeResetAllFilterToState(
245
- { viewport: 'mobile', pseudo: ':hover' },
245
+ { viewport: '@mobile', pseudo: ':hover' },
246
246
  innerReset
247
247
  )( attributes );
248
248
 
249
249
  expect( innerReset ).toHaveBeenCalledWith( {
250
- style: attributes.style.mobile[ ':hover' ],
250
+ style: attributes.style[ '@mobile' ][ ':hover' ],
251
251
  } );
252
252
  expect( result ).toEqual( {
253
253
  style: {
254
254
  color: { text: '#000000' },
255
- mobile: { color: { text: '#ff0000' } },
255
+ '@mobile': { color: { text: '#ff0000' } },
256
256
  },
257
257
  } );
258
258
  } );
@@ -52,7 +52,7 @@ describe( 'layout', () => {
52
52
  getResponsiveLayoutStyles( {
53
53
  attributes: {
54
54
  style: {
55
- mobile: {
55
+ '@mobile': {
56
56
  spacing: {
57
57
  blockGap: '12px',
58
58
  },
@@ -74,7 +74,7 @@ describe( 'layout', () => {
74
74
  getResponsiveLayoutStyles( {
75
75
  attributes: {
76
76
  style: {
77
- mobile: {
77
+ '@mobile': {
78
78
  spacing: {
79
79
  blockGap: '12px',
80
80
  },
@@ -96,7 +96,7 @@ describe( 'layout', () => {
96
96
  getResponsiveLayoutStyles( {
97
97
  attributes: {
98
98
  style: {
99
- mobile: {
99
+ '@mobile': {
100
100
  layout: {
101
101
  minimumColumnWidth: '8rem',
102
102
  },
@@ -118,7 +118,7 @@ describe( 'layout', () => {
118
118
  getResponsiveLayoutStyles( {
119
119
  attributes: {
120
120
  style: {
121
- mobile: {
121
+ '@mobile': {
122
122
  layout: {
123
123
  columnCount: 3,
124
124
  },
@@ -140,7 +140,7 @@ describe( 'layout', () => {
140
140
  getResponsiveLayoutStyles( {
141
141
  attributes: {
142
142
  style: {
143
- mobile: {
143
+ '@mobile': {
144
144
  layout: {
145
145
  columnCount: 3,
146
146
  },
@@ -165,7 +165,7 @@ describe( 'layout', () => {
165
165
  getResponsiveLayoutStyles( {
166
166
  attributes: {
167
167
  style: {
168
- tablet: {
168
+ '@tablet': {
169
169
  spacing: {
170
170
  blockGap: '12px',
171
171
  },
@@ -402,7 +402,7 @@ describe( 'getResponsiveStateCSSRules', () => {
402
402
  expect(
403
403
  getResponsiveStateCSSRules(
404
404
  {
405
- mobile: {
405
+ '@mobile': {
406
406
  color: { text: 'red' },
407
407
  },
408
408
  },
@@ -418,7 +418,7 @@ describe( 'getResponsiveStateCSSRules', () => {
418
418
  expect(
419
419
  getResponsiveStateCSSRules(
420
420
  {
421
- mobile: {
421
+ '@mobile': {
422
422
  color: { background: '#ff00d0' },
423
423
  dimensions: { width: '50%' },
424
424
  },
@@ -435,7 +435,7 @@ describe( 'getResponsiveStateCSSRules', () => {
435
435
  expect(
436
436
  getResponsiveStateCSSRules(
437
437
  {
438
- mobile: {
438
+ '@mobile': {
439
439
  dimensions: { objectFit: 'fill' },
440
440
  },
441
441
  },
@@ -451,7 +451,7 @@ describe( 'getResponsiveStateCSSRules', () => {
451
451
  expect(
452
452
  getResponsiveStateCSSRules(
453
453
  {
454
- mobile: {
454
+ '@mobile': {
455
455
  ':hover': {
456
456
  color: { background: 'black' },
457
457
  },
@@ -469,7 +469,7 @@ describe( 'getResponsiveStateCSSRules', () => {
469
469
  expect(
470
470
  getResponsiveStateCSSRules(
471
471
  {
472
- mobile: {
472
+ '@mobile': {
473
473
  elements: {
474
474
  link: {
475
475
  color: { text: 'blue' },
@@ -510,7 +510,7 @@ describe( 'getCanvasStateStyleValue', () => {
510
510
  color: { text: 'red' },
511
511
  },
512
512
  },
513
- { viewport: 'mobile', pseudo: ':hover' }
513
+ { viewport: '@mobile', pseudo: ':hover' }
514
514
  )
515
515
  ).toEqual( {
516
516
  color: { text: 'red' },
@@ -524,13 +524,13 @@ describe( 'getCanvasStateStyleValue', () => {
524
524
  ':hover': {
525
525
  color: { background: 'blue', text: 'red' },
526
526
  },
527
- mobile: {
527
+ '@mobile': {
528
528
  ':hover': {
529
529
  color: { text: 'yellow' },
530
530
  },
531
531
  },
532
532
  },
533
- { viewport: 'mobile', pseudo: ':hover' }
533
+ { viewport: '@mobile', pseudo: ':hover' }
534
534
  )
535
535
  ).toEqual( {
536
536
  color: { background: 'blue', text: 'yellow' },
@@ -4,6 +4,7 @@
4
4
  import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';
5
5
  import { useMemo, useCallback } from '@wordpress/element';
6
6
  import { useSelect } from '@wordpress/data';
7
+ import { __ } from '@wordpress/i18n';
7
8
 
8
9
  /**
9
10
  * Internal dependencies
@@ -20,6 +21,7 @@ import { FONT_SIZE_SUPPORT_KEY } from './font-size';
20
21
  import { TEXT_ALIGN_SUPPORT_KEY } from './text-align';
21
22
  import { FIT_TEXT_SUPPORT_KEY } from './fit-text';
22
23
  import { cleanEmptyObject } from './utils';
24
+ import { extractPresetSlug } from '../utils/color-values';
23
25
  import { store as blockEditorStore } from '../store';
24
26
  import {
25
27
  getStyleForState,
@@ -27,6 +29,7 @@ import {
27
29
  setStyleForState,
28
30
  useBlockStyleState,
29
31
  } from './block-style-state';
32
+ import useBlockColorContrastWarning from './contrast-checker';
30
33
 
31
34
  function omit( object, keys ) {
32
35
  return Object.fromEntries(
@@ -63,6 +66,7 @@ function styleToAttributes( style ) {
63
66
  const updatedStyle = { ...omit( style, [ 'fontFamily' ] ) };
64
67
  const fontSizeValue = style?.typography?.fontSize;
65
68
  const fontFamilyValue = style?.typography?.fontFamily;
69
+ const textColorValue = style?.color?.text;
66
70
  const fontSizeSlug =
67
71
  typeof fontSizeValue === 'string' &&
68
72
  fontSizeValue?.startsWith( 'var:preset|font-size|' )
@@ -73,14 +77,20 @@ function styleToAttributes( style ) {
73
77
  )
74
78
  ? fontFamilyValue.substring( 'var:preset|font-family|'.length )
75
79
  : undefined;
80
+ const textColorSlug = extractPresetSlug( textColorValue, 'color' );
76
81
  updatedStyle.typography = {
77
82
  ...omit( updatedStyle.typography, [ 'fontFamily' ] ),
78
83
  fontSize: fontSizeSlug ? undefined : fontSizeValue,
79
84
  };
85
+ updatedStyle.color = {
86
+ ...updatedStyle.color,
87
+ text: textColorSlug ? undefined : textColorValue,
88
+ };
80
89
  return {
81
90
  style: cleanEmptyObject( updatedStyle ),
82
91
  fontFamily: fontFamilySlug,
83
92
  fontSize: fontSizeSlug,
93
+ textColor: textColorSlug,
84
94
  };
85
95
  }
86
96
 
@@ -96,6 +106,12 @@ function attributesToStyle( attributes ) {
96
106
  ? 'var:preset|font-size|' + attributes.fontSize
97
107
  : attributes.style?.typography?.fontSize,
98
108
  },
109
+ color: {
110
+ ...attributes.style?.color,
111
+ text: attributes.textColor
112
+ ? 'var:preset|color|' + attributes.textColor
113
+ : attributes.style?.color?.text,
114
+ },
99
115
  };
100
116
  }
101
117
 
@@ -122,11 +138,20 @@ function TypographyInspectorControl( { children, resetAllFilter } ) {
122
138
  );
123
139
  }
124
140
 
125
- export function TypographyPanel( { clientId, name, setAttributes, settings } ) {
141
+ export function TypographyPanel( {
142
+ clientId,
143
+ name,
144
+ setAttributes,
145
+ settings,
146
+ // Allows rendering outside the `typography` inspector group (e.g. section
147
+ // blocks direct-render this panel because their support fills are gated
148
+ // off by editing mode). Defaults to the slot-based wrapper.
149
+ asWrapper,
150
+ } ) {
126
151
  const selectedState = useBlockStyleState();
127
152
  const isEnabled = useHasTypographyPanel( settings );
128
153
 
129
- const { style, fontFamily, fontSize, fitText } = useSelect(
154
+ const { style, fontFamily, fontSize, fitText, textColor } = useSelect(
130
155
  ( select ) => {
131
156
  // Early return to avoid subscription when disabled.
132
157
  if ( ! isEnabled ) {
@@ -137,12 +162,14 @@ export function TypographyPanel( { clientId, name, setAttributes, settings } ) {
137
162
  fontFamily: _fontFamily,
138
163
  fontSize: _fontSize,
139
164
  fitText: _fitText,
165
+ textColor: _textColor,
140
166
  } = select( blockEditorStore ).getBlockAttributes( clientId ) || {};
141
167
  return {
142
168
  style: _style,
143
169
  fontFamily: _fontFamily,
144
170
  fontSize: _fontSize,
145
171
  fitText: _fitText,
172
+ textColor: _textColor,
146
173
  };
147
174
  },
148
175
  [ clientId, isEnabled ]
@@ -154,8 +181,15 @@ export function TypographyPanel( { clientId, name, setAttributes, settings } ) {
154
181
  if ( isStateSelected ) {
155
182
  return getStyleForState( style, selectedState );
156
183
  }
157
- return attributesToStyle( { style, fontFamily, fontSize } );
158
- }, [ isStateSelected, selectedState, style, fontSize, fontFamily ] );
184
+ return attributesToStyle( { style, fontFamily, fontSize, textColor } );
185
+ }, [
186
+ isStateSelected,
187
+ selectedState,
188
+ style,
189
+ fontSize,
190
+ fontFamily,
191
+ textColor,
192
+ ] );
159
193
 
160
194
  const onChange = isStateSelected
161
195
  ? ( newStyle ) => {
@@ -177,23 +211,53 @@ export function TypographyPanel( { clientId, name, setAttributes, settings } ) {
177
211
  setAttributes( newAttributes );
178
212
  };
179
213
 
214
+ // Link color failures are reported by the Elements panel, which owns the
215
+ // link color selection.
216
+ const enableContrastChecking =
217
+ ! isStateSelected &&
218
+ ! value?.color?.gradient &&
219
+ !! value?.color?.text &&
220
+ settings?.color?.text &&
221
+ false !== getBlockSupport( name, [ 'color', 'enableContrastChecker' ] );
222
+
223
+ const contrastWarning = useBlockColorContrastWarning( {
224
+ clientId,
225
+ name,
226
+ enabled: !! enableContrastChecking,
227
+ checkLinkColor: false,
228
+ messageOverride: __(
229
+ 'This color has poor contrast against the background. Consider increasing contrast.'
230
+ ),
231
+ } );
232
+
180
233
  if ( ! isEnabled ) {
181
234
  return null;
182
235
  }
183
236
 
184
- const defaultControls = getBlockSupport( name, [
237
+ const typographyDefaultControls = getBlockSupport( name, [
185
238
  TYPOGRAPHY_SUPPORT_KEY,
186
239
  '__experimentalDefaultControls',
187
240
  ] );
241
+ const colorDefaultControls = getBlockSupport( name, [
242
+ 'color',
243
+ '__experimentalDefaultControls',
244
+ ] );
245
+ const defaultControls = {
246
+ ...typographyDefaultControls,
247
+ textColor: colorDefaultControls?.text,
248
+ };
249
+
250
+ const Wrapper = asWrapper || TypographyInspectorControl;
188
251
 
189
252
  return (
190
253
  <StylesTypographyPanel
191
- as={ TypographyInspectorControl }
254
+ as={ Wrapper }
192
255
  panelId={ clientId }
193
256
  settings={ settings }
194
257
  value={ value }
195
258
  onChange={ onChange }
196
259
  defaultControls={ defaultControls }
260
+ contrastWarning={ contrastWarning }
197
261
  />
198
262
  );
199
263
  }
@@ -1,13 +1,18 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { __ } from '@wordpress/i18n';
4
+ import { __, _x } from '@wordpress/i18n';
5
5
  import {
6
6
  justifyLeft,
7
7
  justifyCenter,
8
8
  justifyRight,
9
9
  justifySpaceBetween,
10
10
  justifyStretch,
11
+ justifyTop,
12
+ justifyCenterVertical,
13
+ justifyBottom,
14
+ justifyStretchVertical,
15
+ justifySpaceBetweenVertical,
11
16
  arrowRight,
12
17
  arrowDown,
13
18
  } from '@wordpress/icons';
@@ -62,6 +67,29 @@ const defaultAlignments = {
62
67
  vertical: 'top',
63
68
  };
64
69
 
70
+ const verticalAlignmentOptions = {
71
+ top: {
72
+ icon: justifyTop,
73
+ label: _x( 'Align top', 'Block vertical alignment setting' ),
74
+ },
75
+ center: {
76
+ icon: justifyCenterVertical,
77
+ label: _x( 'Align middle', 'Block vertical alignment setting' ),
78
+ },
79
+ bottom: {
80
+ icon: justifyBottom,
81
+ label: _x( 'Align bottom', 'Block vertical alignment setting' ),
82
+ },
83
+ stretch: {
84
+ icon: justifyStretchVertical,
85
+ label: _x( 'Stretch to fill', 'Block vertical alignment setting' ),
86
+ },
87
+ 'space-between': {
88
+ icon: justifySpaceBetweenVertical,
89
+ label: _x( 'Space between', 'Block vertical alignment setting' ),
90
+ },
91
+ };
92
+
65
93
  const flexWrapOptions = [ 'wrap', 'nowrap' ];
66
94
 
67
95
  export default {
@@ -77,6 +105,7 @@ export default {
77
105
  const {
78
106
  allowOrientation = true,
79
107
  allowJustification = true,
108
+ allowVerticalAlignment = true,
80
109
  allowWrap = true,
81
110
  } = layoutBlockSupport;
82
111
  const hasLayoutValue = ( key, defaultValue ) =>
@@ -84,6 +113,11 @@ export default {
84
113
  ( resetLayout?.[ key ] ?? defaultValue );
85
114
  const hasJustificationValue = () =>
86
115
  hasLayoutValue( 'justifyContent', 'left' );
116
+ const hasVerticalAlignmentValue = () =>
117
+ hasLayoutValue(
118
+ 'verticalAlignment',
119
+ getDefaultVerticalAlignment( layout )
120
+ );
87
121
  const hasOrientationValue = () =>
88
122
  hasLayoutValue( 'orientation', 'horizontal' );
89
123
  const hasWrapValue = () => hasLayoutValue( 'flexWrap', 'wrap' );
@@ -94,6 +128,16 @@ export default {
94
128
  justifyContent: resetLayout?.justifyContent,
95
129
  } )
96
130
  );
131
+ const resetVerticalAlignment = () =>
132
+ onChange(
133
+ cleanEmptyObject( {
134
+ ...layout,
135
+ verticalAlignment: getCompatibleVerticalAlignment(
136
+ resetLayout?.verticalAlignment,
137
+ layout?.orientation
138
+ ),
139
+ } )
140
+ );
97
141
  const resetOrientation = () => {
98
142
  const { verticalAlignment, justifyContent } = layout;
99
143
  const nextOrientation = resetLayout?.orientation;
@@ -163,6 +207,19 @@ export default {
163
207
  ) }
164
208
  </Flex>
165
209
  ) }
210
+ { allowVerticalAlignment && (
211
+ <ToolsPanelItem
212
+ label={ __( 'Alignment' ) }
213
+ hasValue={ hasVerticalAlignmentValue }
214
+ onDeselect={ resetVerticalAlignment }
215
+ panelId={ clientId }
216
+ >
217
+ <FlexLayoutVerticalAlignmentControl
218
+ layout={ layout }
219
+ onChange={ onChange }
220
+ />
221
+ </ToolsPanelItem>
222
+ ) }
166
223
  { allowWrap && (
167
224
  <ToolsPanelItem
168
225
  label={ __( 'Wrapping' ) }
@@ -204,6 +261,7 @@ export default {
204
261
  <FlexLayoutVerticalAlignmentControl
205
262
  layout={ layout }
206
263
  onChange={ onChange }
264
+ isToolbar
207
265
  />
208
266
  ) }
209
267
  </BlockControls>
@@ -325,15 +383,39 @@ export default {
325
383
  },
326
384
  };
327
385
 
328
- function FlexLayoutVerticalAlignmentControl( { layout, onChange } ) {
329
- const { orientation = 'horizontal' } = layout;
386
+ function getDefaultVerticalAlignment( { orientation = 'horizontal' } = {} ) {
387
+ return orientation === 'horizontal'
388
+ ? defaultAlignments.horizontal
389
+ : defaultAlignments.vertical;
390
+ }
330
391
 
331
- const defaultVerticalAlignment =
332
- orientation === 'horizontal'
333
- ? defaultAlignments.horizontal
334
- : defaultAlignments.vertical;
392
+ function getCompatibleVerticalAlignment( verticalAlignment, orientation ) {
393
+ if (
394
+ ( orientation === 'horizontal' &&
395
+ verticalAlignment === 'space-between' ) ||
396
+ ( orientation === 'vertical' && verticalAlignment === 'stretch' )
397
+ ) {
398
+ return undefined;
399
+ }
335
400
 
336
- const { verticalAlignment = defaultVerticalAlignment } = layout;
401
+ return verticalAlignment;
402
+ }
403
+
404
+ function getVerticalAlignmentControls( orientation ) {
405
+ return orientation === 'horizontal'
406
+ ? [ 'top', 'center', 'bottom', 'stretch' ]
407
+ : [ 'top', 'center', 'bottom', 'space-between' ];
408
+ }
409
+
410
+ function FlexLayoutVerticalAlignmentControl( {
411
+ layout,
412
+ onChange,
413
+ isToolbar = false,
414
+ } ) {
415
+ const { orientation = 'horizontal' } = layout;
416
+
417
+ const { verticalAlignment = getDefaultVerticalAlignment( layout ) } =
418
+ layout;
337
419
 
338
420
  const onVerticalAlignmentChange = ( value ) => {
339
421
  onChange( {
@@ -341,17 +423,38 @@ function FlexLayoutVerticalAlignmentControl( { layout, onChange } ) {
341
423
  verticalAlignment: value,
342
424
  } );
343
425
  };
426
+ const controls = getVerticalAlignmentControls( orientation );
427
+
428
+ if ( isToolbar ) {
429
+ return (
430
+ <BlockVerticalAlignmentControl
431
+ onChange={ onVerticalAlignmentChange }
432
+ value={ verticalAlignment }
433
+ controls={ controls }
434
+ />
435
+ );
436
+ }
344
437
 
345
438
  return (
346
- <BlockVerticalAlignmentControl
439
+ <ToggleGroupControl
440
+ __next40pxDefaultSize
441
+ label={ __( 'Alignment' ) }
347
442
  onChange={ onVerticalAlignmentChange }
348
443
  value={ verticalAlignment }
349
- controls={
350
- orientation === 'horizontal'
351
- ? [ 'top', 'center', 'bottom', 'stretch' ]
352
- : [ 'top', 'center', 'bottom', 'space-between' ]
353
- }
354
- />
444
+ className="block-editor-hooks__flex-layout-alignment-controls"
445
+ >
446
+ { controls.map( ( control ) => {
447
+ const { icon, label } = verticalAlignmentOptions[ control ];
448
+ return (
449
+ <ToggleGroupControlOptionIcon
450
+ key={ control }
451
+ value={ control }
452
+ icon={ icon }
453
+ label={ label }
454
+ />
455
+ );
456
+ } ) }
457
+ </ToggleGroupControl>
355
458
  );
356
459
  }
357
460