@wordpress/block-editor 9.7.0 → 9.8.1-next.957ca95e4c.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 (396) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-alignment-control/use-available-alignments.js +1 -1
  3. package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
  4. package/build/components/block-edit-visually-button/index.js +46 -0
  5. package/build/components/block-edit-visually-button/index.js.map +1 -0
  6. package/build/components/block-list/block-list-compact.native.js +73 -0
  7. package/build/components/block-list/block-list-compact.native.js.map +1 -0
  8. package/build/components/block-list/use-block-props/use-focus-first-element.js +1 -1
  9. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  10. package/build/components/block-popover/inbetween.js +4 -2
  11. package/build/components/block-popover/inbetween.js.map +1 -1
  12. package/build/components/block-popover/index.js +11 -7
  13. package/build/components/block-popover/index.js.map +1 -1
  14. package/build/components/block-settings-menu/index.js +2 -6
  15. package/build/components/block-settings-menu/index.js.map +1 -1
  16. package/build/components/block-switcher/index.js +10 -16
  17. package/build/components/block-switcher/index.js.map +1 -1
  18. package/build/components/block-toolbar/index.js +5 -1
  19. package/build/components/block-toolbar/index.js.map +1 -1
  20. package/build/components/block-tools/selected-block-popover.js +10 -2
  21. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  22. package/build/components/block-tools/use-block-toolbar-popover-props.js +126 -0
  23. package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -0
  24. package/build/components/border-radius-control/all-input-control.js +31 -3
  25. package/build/components/border-radius-control/all-input-control.js.map +1 -1
  26. package/build/components/border-radius-control/index.js +20 -6
  27. package/build/components/border-radius-control/index.js.map +1 -1
  28. package/build/components/border-radius-control/input-controls.js +21 -6
  29. package/build/components/border-radius-control/input-controls.js.map +1 -1
  30. package/build/components/border-radius-control/utils.js +13 -16
  31. package/build/components/border-radius-control/utils.js.map +1 -1
  32. package/build/components/colors/with-colors.js +17 -4
  33. package/build/components/colors/with-colors.js.map +1 -1
  34. package/build/components/colors-gradients/control.js +1 -0
  35. package/build/components/colors-gradients/control.js.map +1 -1
  36. package/build/components/copy-handler/index.js +6 -0
  37. package/build/components/copy-handler/index.js.map +1 -1
  38. package/build/components/date-format-picker/index.js +2 -7
  39. package/build/components/date-format-picker/index.js.map +1 -1
  40. package/build/components/duotone/components.js +5 -5
  41. package/build/components/duotone/components.js.map +1 -1
  42. package/build/components/font-family/index.js +1 -1
  43. package/build/components/font-family/index.js.map +1 -1
  44. package/build/components/font-sizes/with-font-sizes.js +17 -4
  45. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  46. package/build/components/index.js +9 -0
  47. package/build/components/index.js.map +1 -1
  48. package/build/components/inner-blocks/index.native.js +6 -2
  49. package/build/components/inner-blocks/index.native.js.map +1 -1
  50. package/build/components/inserter/search-items.js +22 -4
  51. package/build/components/inserter/search-items.js.map +1 -1
  52. package/build/components/link-control/link-preview.js +0 -1
  53. package/build/components/link-control/link-preview.js.map +1 -1
  54. package/build/components/list-view/block-select-button.js +5 -2
  55. package/build/components/list-view/block-select-button.js.map +1 -1
  56. package/build/components/list-view/use-block-selection.js +1 -7
  57. package/build/components/list-view/use-block-selection.js.map +1 -1
  58. package/build/components/rich-text/index.js +10 -0
  59. package/build/components/rich-text/index.js.map +1 -1
  60. package/build/components/rich-text/use-enter.js +0 -4
  61. package/build/components/rich-text/use-enter.js.map +1 -1
  62. package/build/components/rich-text/use-format-types.js +8 -11
  63. package/build/components/rich-text/use-format-types.js.map +1 -1
  64. package/build/components/spacing-sizes-control/all-input-control.js +53 -0
  65. package/build/components/spacing-sizes-control/all-input-control.js.map +1 -0
  66. package/build/components/spacing-sizes-control/axial-input-controls.js +69 -0
  67. package/build/components/spacing-sizes-control/axial-input-controls.js.map +1 -0
  68. package/build/components/spacing-sizes-control/index.js +100 -0
  69. package/build/components/spacing-sizes-control/index.js.map +1 -0
  70. package/build/components/spacing-sizes-control/input-controls.js +52 -0
  71. package/build/components/spacing-sizes-control/input-controls.js.map +1 -0
  72. package/build/components/spacing-sizes-control/linked-button.js +38 -0
  73. package/build/components/spacing-sizes-control/linked-button.js.map +1 -0
  74. package/build/components/spacing-sizes-control/spacing-input-control.js +213 -0
  75. package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -0
  76. package/build/components/spacing-sizes-control/utils.js +233 -0
  77. package/build/components/spacing-sizes-control/utils.js.map +1 -0
  78. package/build/components/text-decoration-control/index.js +28 -17
  79. package/build/components/text-decoration-control/index.js.map +1 -1
  80. package/build/components/text-transform-control/index.js +21 -14
  81. package/build/components/text-transform-control/index.js.map +1 -1
  82. package/build/components/url-input/index.js +1 -1
  83. package/build/components/url-input/index.js.map +1 -1
  84. package/build/components/writing-flow/index.js +2 -0
  85. package/build/components/writing-flow/index.js.map +1 -1
  86. package/build/components/writing-flow/use-multi-selection.js +4 -2
  87. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  88. package/build/components/writing-flow/use-select-all.js +7 -10
  89. package/build/components/writing-flow/use-select-all.js.map +1 -1
  90. package/build/components/writing-flow/use-selection-observer.js +10 -2
  91. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  92. package/build/hooks/align.js +3 -1
  93. package/build/hooks/align.js.map +1 -1
  94. package/build/hooks/anchor.js +3 -7
  95. package/build/hooks/anchor.js.map +1 -1
  96. package/build/hooks/border-radius.js +2 -7
  97. package/build/hooks/border-radius.js.map +1 -1
  98. package/build/hooks/border.js +2 -2
  99. package/build/hooks/border.js.map +1 -1
  100. package/build/hooks/color.js +4 -1
  101. package/build/hooks/color.js.map +1 -1
  102. package/build/hooks/dimensions.js +15 -0
  103. package/build/hooks/dimensions.js.map +1 -1
  104. package/build/hooks/duotone.js +4 -4
  105. package/build/hooks/duotone.js.map +1 -1
  106. package/build/hooks/font-appearance.js +2 -1
  107. package/build/hooks/font-appearance.js.map +1 -1
  108. package/build/hooks/font-family.js +3 -1
  109. package/build/hooks/font-family.js.map +1 -1
  110. package/build/hooks/font-size.js +3 -1
  111. package/build/hooks/font-size.js.map +1 -1
  112. package/build/hooks/gap.js +25 -6
  113. package/build/hooks/gap.js.map +1 -1
  114. package/build/hooks/generated-class-name.js +1 -7
  115. package/build/hooks/generated-class-name.js.map +1 -1
  116. package/build/hooks/layout.js +23 -13
  117. package/build/hooks/layout.js.map +1 -1
  118. package/build/hooks/letter-spacing.js +2 -1
  119. package/build/hooks/letter-spacing.js.map +1 -1
  120. package/build/hooks/line-height.js +2 -1
  121. package/build/hooks/line-height.js.map +1 -1
  122. package/build/hooks/lock.js +3 -7
  123. package/build/hooks/lock.js.map +1 -1
  124. package/build/hooks/margin.js +28 -12
  125. package/build/hooks/margin.js.map +1 -1
  126. package/build/hooks/padding.js +19 -8
  127. package/build/hooks/padding.js.map +1 -1
  128. package/build/hooks/style.js +4 -50
  129. package/build/hooks/style.js.map +1 -1
  130. package/build/hooks/text-decoration.js +2 -1
  131. package/build/hooks/text-decoration.js.map +1 -1
  132. package/build/hooks/text-transform.js +2 -1
  133. package/build/hooks/text-transform.js.map +1 -1
  134. package/build/layouts/constrained.js +225 -0
  135. package/build/layouts/constrained.js.map +1 -0
  136. package/build/layouts/flex.js +1 -1
  137. package/build/layouts/flex.js.map +1 -1
  138. package/build/layouts/flow.js +18 -152
  139. package/build/layouts/flow.js.map +1 -1
  140. package/build/layouts/index.js +3 -1
  141. package/build/layouts/index.js.map +1 -1
  142. package/build/layouts/utils.js +43 -0
  143. package/build/layouts/utils.js.map +1 -1
  144. package/build/store/actions.js +25 -3
  145. package/build/store/actions.js.map +1 -1
  146. package/build/store/selectors.js +4 -6
  147. package/build/store/selectors.js.map +1 -1
  148. package/build-module/components/block-alignment-control/use-available-alignments.js +1 -1
  149. package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
  150. package/build-module/components/block-edit-visually-button/index.js +35 -0
  151. package/build-module/components/block-edit-visually-button/index.js.map +1 -0
  152. package/build-module/components/block-list/block-list-compact.native.js +58 -0
  153. package/build-module/components/block-list/block-list-compact.native.js.map +1 -0
  154. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +1 -1
  155. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  156. package/build-module/components/block-popover/inbetween.js +4 -2
  157. package/build-module/components/block-popover/inbetween.js.map +1 -1
  158. package/build-module/components/block-popover/index.js +9 -7
  159. package/build-module/components/block-popover/index.js.map +1 -1
  160. package/build-module/components/block-settings-menu/index.js +3 -6
  161. package/build-module/components/block-settings-menu/index.js.map +1 -1
  162. package/build-module/components/block-switcher/index.js +10 -16
  163. package/build-module/components/block-switcher/index.js.map +1 -1
  164. package/build-module/components/block-toolbar/index.js +4 -1
  165. package/build-module/components/block-toolbar/index.js.map +1 -1
  166. package/build-module/components/block-tools/selected-block-popover.js +8 -2
  167. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  168. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +114 -0
  169. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -0
  170. package/build-module/components/border-radius-control/all-input-control.js +32 -4
  171. package/build-module/components/border-radius-control/all-input-control.js.map +1 -1
  172. package/build-module/components/border-radius-control/index.js +20 -6
  173. package/build-module/components/border-radius-control/index.js.map +1 -1
  174. package/build-module/components/border-radius-control/input-controls.js +22 -7
  175. package/build-module/components/border-radius-control/input-controls.js.map +1 -1
  176. package/build-module/components/border-radius-control/utils.js +13 -16
  177. package/build-module/components/border-radius-control/utils.js.map +1 -1
  178. package/build-module/components/colors/with-colors.js +16 -3
  179. package/build-module/components/colors/with-colors.js.map +1 -1
  180. package/build-module/components/colors-gradients/control.js +1 -0
  181. package/build-module/components/colors-gradients/control.js.map +1 -1
  182. package/build-module/components/copy-handler/index.js +7 -1
  183. package/build-module/components/copy-handler/index.js.map +1 -1
  184. package/build-module/components/date-format-picker/index.js +2 -6
  185. package/build-module/components/date-format-picker/index.js.map +1 -1
  186. package/build-module/components/duotone/components.js +5 -5
  187. package/build-module/components/duotone/components.js.map +1 -1
  188. package/build-module/components/font-family/index.js +1 -1
  189. package/build-module/components/font-family/index.js.map +1 -1
  190. package/build-module/components/font-sizes/with-font-sizes.js +16 -3
  191. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  192. package/build-module/components/index.js +1 -0
  193. package/build-module/components/index.js.map +1 -1
  194. package/build-module/components/inner-blocks/index.native.js +5 -2
  195. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  196. package/build-module/components/inserter/search-items.js +19 -5
  197. package/build-module/components/inserter/search-items.js.map +1 -1
  198. package/build-module/components/link-control/link-preview.js +0 -1
  199. package/build-module/components/link-control/link-preview.js.map +1 -1
  200. package/build-module/components/list-view/block-select-button.js +5 -2
  201. package/build-module/components/list-view/block-select-button.js.map +1 -1
  202. package/build-module/components/list-view/use-block-selection.js +1 -6
  203. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  204. package/build-module/components/rich-text/index.js +10 -0
  205. package/build-module/components/rich-text/index.js.map +1 -1
  206. package/build-module/components/rich-text/use-enter.js +0 -4
  207. package/build-module/components/rich-text/use-enter.js.map +1 -1
  208. package/build-module/components/rich-text/use-format-types.js +8 -10
  209. package/build-module/components/rich-text/use-format-types.js.map +1 -1
  210. package/build-module/components/spacing-sizes-control/all-input-control.js +41 -0
  211. package/build-module/components/spacing-sizes-control/all-input-control.js.map +1 -0
  212. package/build-module/components/spacing-sizes-control/axial-input-controls.js +57 -0
  213. package/build-module/components/spacing-sizes-control/axial-input-controls.js.map +1 -0
  214. package/build-module/components/spacing-sizes-control/index.js +83 -0
  215. package/build-module/components/spacing-sizes-control/index.js.map +1 -0
  216. package/build-module/components/spacing-sizes-control/input-controls.js +41 -0
  217. package/build-module/components/spacing-sizes-control/input-controls.js.map +1 -0
  218. package/build-module/components/spacing-sizes-control/linked-button.js +28 -0
  219. package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -0
  220. package/build-module/components/spacing-sizes-control/spacing-input-control.js +197 -0
  221. package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -0
  222. package/build-module/components/spacing-sizes-control/utils.js +203 -0
  223. package/build-module/components/spacing-sizes-control/utils.js.map +1 -0
  224. package/build-module/components/text-decoration-control/index.js +25 -18
  225. package/build-module/components/text-decoration-control/index.js.map +1 -1
  226. package/build-module/components/text-transform-control/index.js +19 -15
  227. package/build-module/components/text-transform-control/index.js.map +1 -1
  228. package/build-module/components/url-input/index.js +1 -1
  229. package/build-module/components/url-input/index.js.map +1 -1
  230. package/build-module/components/writing-flow/index.js +2 -0
  231. package/build-module/components/writing-flow/index.js.map +1 -1
  232. package/build-module/components/writing-flow/use-multi-selection.js +4 -2
  233. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  234. package/build-module/components/writing-flow/use-select-all.js +7 -10
  235. package/build-module/components/writing-flow/use-select-all.js.map +1 -1
  236. package/build-module/components/writing-flow/use-selection-observer.js +10 -2
  237. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  238. package/build-module/hooks/align.js +4 -2
  239. package/build-module/hooks/align.js.map +1 -1
  240. package/build-module/hooks/anchor.js +3 -6
  241. package/build-module/hooks/anchor.js.map +1 -1
  242. package/build-module/hooks/border-radius.js +2 -7
  243. package/build-module/hooks/border-radius.js.map +1 -1
  244. package/build-module/hooks/border.js +2 -2
  245. package/build-module/hooks/border.js.map +1 -1
  246. package/build-module/hooks/color.js +4 -1
  247. package/build-module/hooks/color.js.map +1 -1
  248. package/build-module/hooks/dimensions.js +13 -0
  249. package/build-module/hooks/dimensions.js.map +1 -1
  250. package/build-module/hooks/duotone.js +4 -4
  251. package/build-module/hooks/duotone.js.map +1 -1
  252. package/build-module/hooks/font-appearance.js +2 -1
  253. package/build-module/hooks/font-appearance.js.map +1 -1
  254. package/build-module/hooks/font-family.js +3 -1
  255. package/build-module/hooks/font-family.js.map +1 -1
  256. package/build-module/hooks/font-size.js +3 -1
  257. package/build-module/hooks/font-size.js.map +1 -1
  258. package/build-module/hooks/gap.js +21 -4
  259. package/build-module/hooks/gap.js.map +1 -1
  260. package/build-module/hooks/generated-class-name.js +1 -6
  261. package/build-module/hooks/generated-class-name.js.map +1 -1
  262. package/build-module/hooks/layout.js +24 -14
  263. package/build-module/hooks/layout.js.map +1 -1
  264. package/build-module/hooks/letter-spacing.js +2 -1
  265. package/build-module/hooks/letter-spacing.js.map +1 -1
  266. package/build-module/hooks/line-height.js +2 -1
  267. package/build-module/hooks/line-height.js.map +1 -1
  268. package/build-module/hooks/lock.js +3 -6
  269. package/build-module/hooks/lock.js.map +1 -1
  270. package/build-module/hooks/margin.js +26 -12
  271. package/build-module/hooks/margin.js.map +1 -1
  272. package/build-module/hooks/padding.js +17 -8
  273. package/build-module/hooks/padding.js.map +1 -1
  274. package/build-module/hooks/style.js +7 -53
  275. package/build-module/hooks/style.js.map +1 -1
  276. package/build-module/hooks/text-decoration.js +2 -1
  277. package/build-module/hooks/text-decoration.js.map +1 -1
  278. package/build-module/hooks/text-transform.js +2 -1
  279. package/build-module/hooks/text-transform.js.map +1 -1
  280. package/build-module/layouts/constrained.js +207 -0
  281. package/build-module/layouts/constrained.js.map +1 -0
  282. package/build-module/layouts/flex.js +1 -1
  283. package/build-module/layouts/flex.js.map +1 -1
  284. package/build-module/layouts/flow.js +20 -147
  285. package/build-module/layouts/flow.js.map +1 -1
  286. package/build-module/layouts/index.js +2 -1
  287. package/build-module/layouts/index.js.map +1 -1
  288. package/build-module/layouts/utils.js +40 -0
  289. package/build-module/layouts/utils.js.map +1 -1
  290. package/build-module/store/actions.js +25 -3
  291. package/build-module/store/actions.js.map +1 -1
  292. package/build-module/store/selectors.js +5 -7
  293. package/build-module/store/selectors.js.map +1 -1
  294. package/build-style/style-rtl.css +157 -61
  295. package/build-style/style.css +157 -61
  296. package/package.json +30 -28
  297. package/src/components/block-alignment-control/use-available-alignments.js +1 -1
  298. package/src/components/block-edit-visually-button/index.js +39 -0
  299. package/src/components/block-list/block-list-compact.native.js +62 -0
  300. package/src/components/block-list/style.scss +29 -6
  301. package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -1
  302. package/src/components/block-popover/inbetween.js +4 -1
  303. package/src/components/block-popover/index.js +22 -15
  304. package/src/components/block-settings-menu/index.js +11 -15
  305. package/src/components/block-switcher/index.js +9 -13
  306. package/src/components/block-switcher/test/index.js +2 -2
  307. package/src/components/block-toolbar/index.js +2 -0
  308. package/src/components/block-tools/selected-block-popover.js +7 -0
  309. package/src/components/block-tools/use-block-toolbar-popover-props.js +123 -0
  310. package/src/components/border-radius-control/all-input-control.js +41 -4
  311. package/src/components/border-radius-control/index.js +25 -5
  312. package/src/components/border-radius-control/input-controls.js +40 -13
  313. package/src/components/border-radius-control/test/utils.js +22 -60
  314. package/src/components/border-radius-control/utils.js +12 -16
  315. package/src/components/button-block-appender/style.scss +23 -0
  316. package/src/components/colors/with-colors.js +11 -1
  317. package/src/components/colors-gradients/control.js +1 -0
  318. package/src/components/copy-handler/index.js +18 -0
  319. package/src/components/date-format-picker/index.js +12 -14
  320. package/src/components/date-format-picker/style.scss +0 -4
  321. package/src/components/duotone/components.js +5 -5
  322. package/src/components/duotone-control/style.scss +0 -4
  323. package/src/components/font-appearance-control/style.scss +0 -2
  324. package/src/components/font-family/index.js +1 -1
  325. package/src/components/font-sizes/with-font-sizes.js +11 -1
  326. package/src/components/index.js +1 -0
  327. package/src/components/inner-blocks/index.native.js +5 -1
  328. package/src/components/inserter/search-items.js +17 -5
  329. package/src/components/link-control/link-preview.js +0 -1
  330. package/src/components/link-control/test/index.js +540 -893
  331. package/src/components/list-view/block-select-button.js +7 -2
  332. package/src/components/list-view/style.scss +11 -4
  333. package/src/components/list-view/use-block-selection.js +2 -8
  334. package/src/components/media-replace-flow/style.scss +1 -0
  335. package/src/components/rich-text/index.js +9 -0
  336. package/src/components/rich-text/use-enter.js +0 -3
  337. package/src/components/rich-text/use-format-types.js +6 -6
  338. package/src/components/spacing-sizes-control/all-input-control.js +40 -0
  339. package/src/components/spacing-sizes-control/axial-input-controls.js +62 -0
  340. package/src/components/spacing-sizes-control/index.js +91 -0
  341. package/src/components/spacing-sizes-control/input-controls.js +46 -0
  342. package/src/components/spacing-sizes-control/linked-button.js +25 -0
  343. package/src/components/spacing-sizes-control/spacing-input-control.js +285 -0
  344. package/src/components/spacing-sizes-control/style.scss +122 -0
  345. package/src/components/spacing-sizes-control/test/utils.js +182 -0
  346. package/src/components/spacing-sizes-control/utils.js +222 -0
  347. package/src/components/text-decoration-control/index.js +41 -30
  348. package/src/components/text-decoration-control/stories/index.js +37 -0
  349. package/src/components/text-transform-control/index.js +27 -27
  350. package/src/components/text-transform-control/stories/index.js +37 -0
  351. package/src/components/url-input/index.js +1 -1
  352. package/src/components/url-input/style.scss +2 -2
  353. package/src/components/url-popover/style.scss +0 -3
  354. package/src/components/writing-flow/index.js +2 -0
  355. package/src/components/writing-flow/use-multi-selection.js +4 -1
  356. package/src/components/writing-flow/use-select-all.js +10 -13
  357. package/src/components/writing-flow/use-selection-observer.js +10 -2
  358. package/src/hooks/align.js +2 -2
  359. package/src/hooks/anchor.js +1 -6
  360. package/src/hooks/border-radius.js +2 -6
  361. package/src/hooks/border.js +2 -2
  362. package/src/hooks/color.js +13 -3
  363. package/src/hooks/dimensions.js +14 -0
  364. package/src/hooks/duotone.js +4 -4
  365. package/src/hooks/font-appearance.js +1 -0
  366. package/src/hooks/font-family.js +2 -0
  367. package/src/hooks/font-size.js +2 -0
  368. package/src/hooks/gap.js +42 -19
  369. package/src/hooks/generated-class-name.js +6 -9
  370. package/src/hooks/layout.js +47 -16
  371. package/src/hooks/letter-spacing.js +1 -0
  372. package/src/hooks/line-height.js +1 -0
  373. package/src/hooks/lock.js +1 -6
  374. package/src/hooks/margin.js +49 -17
  375. package/src/hooks/padding.js +41 -14
  376. package/src/hooks/style.js +5 -56
  377. package/src/hooks/test/gap.js +16 -0
  378. package/src/hooks/text-decoration.js +1 -0
  379. package/src/hooks/text-transform.js +1 -0
  380. package/src/hooks/typography.scss +0 -7
  381. package/src/layouts/constrained.js +220 -0
  382. package/src/layouts/flex.js +1 -1
  383. package/src/layouts/flow.js +17 -173
  384. package/src/layouts/index.js +2 -1
  385. package/src/layouts/test/constrained.js +21 -0
  386. package/src/layouts/utils.js +34 -0
  387. package/src/store/actions.js +32 -4
  388. package/src/store/selectors.js +5 -4
  389. package/src/style.scss +1 -2
  390. package/build/components/block-settings-menu/block-edit-visually-button.js +0 -70
  391. package/build/components/block-settings-menu/block-edit-visually-button.js.map +0 -1
  392. package/build-module/components/block-settings-menu/block-edit-visually-button.js +0 -56
  393. package/build-module/components/block-settings-menu/block-edit-visually-button.js.map +0 -1
  394. package/src/components/block-settings-menu/block-edit-visually-button.js +0 -52
  395. package/src/components/text-decoration-control/style.scss +0 -18
  396. package/src/components/text-transform-control/style.scss +0 -18
@@ -7,14 +7,50 @@ import { __ } from '@wordpress/i18n';
7
7
  /**
8
8
  * Internal dependencies
9
9
  */
10
- import { getAllValue, hasMixedValues, hasDefinedValues } from './utils';
10
+ import {
11
+ getAllValue,
12
+ getAllUnit,
13
+ hasMixedValues,
14
+ hasDefinedValues,
15
+ } from './utils';
16
+
17
+ export default function AllInputControl( {
18
+ onChange,
19
+ selectedUnits,
20
+ setSelectedUnits,
21
+ values,
22
+ ...props
23
+ } ) {
24
+ let allValue = getAllValue( values );
25
+
26
+ if ( allValue === undefined ) {
27
+ // If we don't have any value set the unit to any current selection
28
+ // or the most common unit from the individual radii values.
29
+ allValue = getAllUnit( selectedUnits );
30
+ }
11
31
 
12
- export default function AllInputControl( { onChange, values, ...props } ) {
13
- const allValue = getAllValue( values );
14
32
  const hasValues = hasDefinedValues( values );
15
33
  const isMixed = hasValues && hasMixedValues( values );
16
34
  const allPlaceholder = isMixed ? __( 'Mixed' ) : null;
17
35
 
36
+ // Filter out CSS-unit-only values to prevent invalid styles.
37
+ const handleOnChange = ( next ) => {
38
+ const isNumeric = ! isNaN( parseFloat( next ) );
39
+ const nextValue = isNumeric ? next : undefined;
40
+ onChange( nextValue );
41
+ };
42
+
43
+ // Store current unit selection for use as fallback for individual
44
+ // radii controls.
45
+ const handleOnUnitChange = ( unit ) => {
46
+ setSelectedUnits( {
47
+ topLeft: unit,
48
+ topRight: unit,
49
+ bottomLeft: unit,
50
+ bottomRight: unit,
51
+ } );
52
+ };
53
+
18
54
  return (
19
55
  <UnitControl
20
56
  { ...props }
@@ -22,7 +58,8 @@ export default function AllInputControl( { onChange, values, ...props } ) {
22
58
  disableUnits={ isMixed }
23
59
  isOnly
24
60
  value={ allValue }
25
- onChange={ onChange }
61
+ onChange={ handleOnChange }
62
+ onUnitChange={ handleOnUnitChange }
26
63
  placeholder={ allPlaceholder }
27
64
  />
28
65
  );
@@ -25,10 +25,10 @@ import {
25
25
  } from './utils';
26
26
 
27
27
  const DEFAULT_VALUES = {
28
- topLeft: null,
29
- topRight: null,
30
- bottomLeft: null,
31
- bottomRight: null,
28
+ topLeft: undefined,
29
+ topRight: undefined,
30
+ bottomLeft: undefined,
31
+ bottomRight: undefined,
32
32
  };
33
33
  const MIN_BORDER_RADIUS_VALUE = 0;
34
34
  const MAX_BORDER_RADIUS_VALUES = {
@@ -51,11 +51,27 @@ export default function BorderRadiusControl( { onChange, values } ) {
51
51
  ! hasDefinedValues( values ) || ! hasMixedValues( values )
52
52
  );
53
53
 
54
+ // Tracking selected units via internal state allows filtering of CSS unit
55
+ // only values from being saved while maintaining preexisting unit selection
56
+ // behaviour. Filtering CSS unit only values prevents invalid style values.
57
+ const [ selectedUnits, setSelectedUnits ] = useState( {
58
+ flat:
59
+ typeof values === 'string'
60
+ ? parseQuantityAndUnitFromRawValue( values )[ 1 ]
61
+ : undefined,
62
+ topLeft: parseQuantityAndUnitFromRawValue( values?.topLeft )[ 1 ],
63
+ topRight: parseQuantityAndUnitFromRawValue( values?.topRight )[ 1 ],
64
+ bottomLeft: parseQuantityAndUnitFromRawValue( values?.bottomLeft )[ 1 ],
65
+ bottomRight: parseQuantityAndUnitFromRawValue(
66
+ values?.bottomRight
67
+ )[ 1 ],
68
+ } );
69
+
54
70
  const units = useCustomUnits( {
55
71
  availableUnits: useSetting( 'spacing.units' ) || [ 'px', 'em', 'rem' ],
56
72
  } );
57
73
 
58
- const unit = getAllUnit( values );
74
+ const unit = getAllUnit( selectedUnits );
59
75
  const unitConfig = units && units.find( ( item ) => item.value === unit );
60
76
  const step = unitConfig?.step || 1;
61
77
 
@@ -82,6 +98,8 @@ export default function BorderRadiusControl( { onChange, values } ) {
82
98
  values={ values }
83
99
  min={ MIN_BORDER_RADIUS_VALUE }
84
100
  onChange={ onChange }
101
+ selectedUnits={ selectedUnits }
102
+ setSelectedUnits={ setSelectedUnits }
85
103
  units={ units }
86
104
  />
87
105
  <RangeControl
@@ -101,6 +119,8 @@ export default function BorderRadiusControl( { onChange, values } ) {
101
119
  <InputControls
102
120
  min={ MIN_BORDER_RADIUS_VALUE }
103
121
  onChange={ onChange }
122
+ selectedUnits={ selectedUnits }
123
+ setSelectedUnits={ setSelectedUnits }
104
124
  values={ values || DEFAULT_VALUES }
105
125
  units={ units }
106
126
  />
@@ -2,6 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import {
5
+ __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
5
6
  __experimentalUnitControl as UnitControl,
6
7
  Tooltip,
7
8
  } from '@wordpress/components';
@@ -16,6 +17,8 @@ const CORNERS = {
16
17
 
17
18
  export default function BoxInputControls( {
18
19
  onChange,
20
+ selectedUnits,
21
+ setSelectedUnits,
19
22
  values: valuesProp,
20
23
  ...props
21
24
  } ) {
@@ -24,12 +27,22 @@ export default function BoxInputControls( {
24
27
  return;
25
28
  }
26
29
 
30
+ // Filter out CSS-unit-only values to prevent invalid styles.
31
+ const isNumeric = ! isNaN( parseFloat( next ) );
32
+ const nextValue = isNumeric ? next : undefined;
33
+
27
34
  onChange( {
28
35
  ...values,
29
- [ corner ]: next ? next : undefined,
36
+ [ corner ]: nextValue,
30
37
  } );
31
38
  };
32
39
 
40
+ const createHandleOnUnitChange = ( side ) => ( next ) => {
41
+ const newUnits = { ...selectedUnits };
42
+ newUnits[ side ] = next;
43
+ setSelectedUnits( newUnits );
44
+ };
45
+
33
46
  // For shorthand style & backwards compatibility, handle flat string value.
34
47
  const values =
35
48
  typeof valuesProp !== 'string'
@@ -46,18 +59,32 @@ export default function BoxInputControls( {
46
59
  // https://github.com/WordPress/gutenberg/pull/24966#issuecomment-685875026
47
60
  return (
48
61
  <div className="components-border-radius-control__input-controls-wrapper">
49
- { Object.entries( CORNERS ).map( ( [ key, label ] ) => (
50
- <Tooltip text={ label } position="top" key={ key }>
51
- <div className="components-border-radius-control__tooltip-wrapper">
52
- <UnitControl
53
- { ...props }
54
- aria-label={ label }
55
- value={ values[ key ] }
56
- onChange={ createHandleOnChange( key ) }
57
- />
58
- </div>
59
- </Tooltip>
60
- ) ) }
62
+ { Object.entries( CORNERS ).map( ( [ corner, label ] ) => {
63
+ const [ parsedQuantity, parsedUnit ] =
64
+ parseQuantityAndUnitFromRawValue( values[ corner ] );
65
+
66
+ const computedUnit = values[ corner ]
67
+ ? parsedUnit
68
+ : selectedUnits[ corner ] || selectedUnits.flat;
69
+
70
+ return (
71
+ <Tooltip text={ label } position="top" key={ corner }>
72
+ <div className="components-border-radius-control__tooltip-wrapper">
73
+ <UnitControl
74
+ { ...props }
75
+ aria-label={ label }
76
+ value={ [ parsedQuantity, computedUnit ].join(
77
+ ''
78
+ ) }
79
+ onChange={ createHandleOnChange( corner ) }
80
+ onUnitChange={ createHandleOnUnitChange(
81
+ corner
82
+ ) }
83
+ />
84
+ </div>
85
+ </Tooltip>
86
+ );
87
+ } ) }
61
88
  </div>
62
89
  );
63
90
  }
@@ -9,73 +9,35 @@ import {
9
9
  mode,
10
10
  } from '../utils';
11
11
 
12
- describe( 'getAllUnit', () => {
13
- describe( 'when provided string based values', () => {
14
- it( 'should return valid unit when passed a valid unit', () => {
15
- expect( getAllUnit( '32em' ) ).toBe( 'em' );
16
- } );
17
-
18
- it( 'should fall back to px when passed an invalid unit', () => {
19
- expect( getAllUnit( '32apples' ) ).toBe( 'px' );
20
- } );
12
+ const defaultUnitSelections = {
13
+ flat: undefined,
14
+ topLeft: '%',
15
+ topRight: 'rem',
16
+ bottomLeft: 'rem',
17
+ bottomRight: 'vw',
18
+ };
21
19
 
22
- it( 'should fall back to px when passed a value without a unit', () => {
23
- expect( getAllUnit( '32' ) ).toBe( 'px' );
24
- } );
20
+ describe( 'getAllUnit', () => {
21
+ it( 'should return flat radius unit when selected', () => {
22
+ const selectedUnits = { ...defaultUnitSelections, flat: 'em' };
23
+ expect( getAllUnit( selectedUnits ) ).toBe( 'em' );
25
24
  } );
26
25
 
27
- describe( 'when provided object based values', () => {
28
- it( 'should return the most common value', () => {
29
- const values = {
30
- bottomLeft: '2em',
31
- bottomRight: '2em',
32
- topLeft: '0',
33
- topRight: '2px',
34
- };
35
- expect( getAllUnit( values ) ).toBe( 'em' );
36
- } );
37
-
38
- it( 'should return the real value when the most common value is undefined', () => {
39
- const values = {
40
- bottomLeft: '0',
41
- bottomRight: '0',
42
- topLeft: '0',
43
- topRight: '2em',
44
- };
45
- expect( getAllUnit( values ) ).toBe( 'em' );
46
- } );
26
+ it( 'should return most common corner unit', () => {
27
+ expect( getAllUnit( defaultUnitSelections ) ).toBe( 'rem' );
28
+ } );
47
29
 
48
- it( 'should return the most common value there are no undefined values', () => {
49
- const values = {
50
- bottomLeft: '1em',
51
- bottomRight: '1em',
52
- topLeft: '2px',
53
- topRight: '2em',
54
- };
55
- expect( getAllUnit( values ) ).toBe( 'em' );
56
- } );
30
+ it( 'should return a real unit when the most common is undefined', () => {
31
+ expect( getAllUnit( { bottomRight: '%' } ) ).toBe( '%' );
32
+ } );
57
33
 
58
- it( 'should fall back to px when all values are undefined or equivalent', () => {
59
- const values = {
60
- bottomLeft: '0',
61
- bottomRight: undefined,
62
- topLeft: undefined,
63
- topRight: '0',
64
- };
65
- expect( getAllUnit( values ) ).toBe( 'px' );
66
- } );
34
+ it( 'should return most common corner unit when some are unselected', () => {
35
+ const selectedUnits = { ...defaultUnitSelections, topLeft: undefined };
36
+ expect( getAllUnit( selectedUnits ) ).toBe( 'rem' );
67
37
  } );
68
38
 
69
- describe( 'when provided invalid values', () => {
70
- it( 'should return px when passed an array', () => {
71
- expect( getAllUnit( [] ) ).toBe( 'px' );
72
- } );
73
- it( 'should return px when passed a boolean', () => {
74
- expect( getAllUnit( false ) ).toBe( 'px' );
75
- } );
76
- it( 'should return px when passed undefined', () => {
77
- expect( getAllUnit( false ) ).toBe( 'px' );
78
- } );
39
+ it( 'should fallback to px when all values are undefined', () => {
40
+ expect( getAllUnit( {} ) ).toBe( 'px' );
79
41
  } );
80
42
  } );
81
43
 
@@ -28,24 +28,20 @@ export function mode( inputArray ) {
28
28
  }
29
29
 
30
30
  /**
31
- * Returns the most common CSS unit in the radius values.
32
- * Falls back to `px` as a default unit.
31
+ * Returns the most common CSS unit from the current CSS unit selections.
33
32
  *
34
- * @param {Object|string} values Radius values.
35
- * @return {string} Most common CSS unit in values. Default: `px`.
33
+ * - If a single flat border radius is set, its unit will be used
34
+ * - If individual corner selections, the most common of those will be used
35
+ * - Failing any unit selections a default of 'px' is returned.
36
+ *
37
+ * @param {Object} selectedUnits Unit selections for flat radius & each corner.
38
+ * @return {string} Most common CSS unit from current selections. Default: `px`.
36
39
  */
37
- export function getAllUnit( values = {} ) {
38
- if ( typeof values === 'string' ) {
39
- const [ , unit ] = parseQuantityAndUnitFromRawValue( values );
40
- return unit || 'px';
41
- }
42
-
43
- const allUnits = Object.values( values ).map( ( value ) => {
44
- const [ , unit ] = parseQuantityAndUnitFromRawValue( value );
45
- return unit;
46
- } );
47
-
48
- return mode( allUnits ) || 'px';
40
+ export function getAllUnit( selectedUnits = {} ) {
41
+ const { flat, ...cornerUnits } = selectedUnits;
42
+ return (
43
+ flat || mode( Object.values( cornerUnits ).filter( Boolean ) ) || 'px'
44
+ );
49
45
  }
50
46
 
51
47
  /**
@@ -31,3 +31,26 @@
31
31
  color: $black;
32
32
  }
33
33
  }
34
+
35
+ // When the appender shows up in empty container blocks, such as Group and Columns, add an extra click state.
36
+ .block-list-appender:only-child {
37
+ .is-layout-constrained.block-editor-block-list__block:not(.is-selected) > &,
38
+ .is-layout-flow.block-editor-block-list__block:not(.is-selected) > & {
39
+ pointer-events: none;
40
+
41
+ &::after {
42
+ content: "";
43
+ position: absolute;
44
+ top: 0;
45
+ right: 0;
46
+ bottom: 0;
47
+ left: 0;
48
+ pointer-events: none;
49
+ @include placeholder-style();
50
+ }
51
+
52
+ .block-editor-inserter {
53
+ visibility: hidden;
54
+ }
55
+ }
56
+ }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { kebabCase, reduce, upperFirst } from 'lodash';
4
+ import { kebabCase, reduce } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -20,6 +20,16 @@ import {
20
20
  } from './utils';
21
21
  import useSetting from '../use-setting';
22
22
 
23
+ /**
24
+ * Capitalizes the first letter in a string.
25
+ *
26
+ * @param {string} str The string whose first letter the function will capitalize.
27
+ *
28
+ * @return {string} Capitalized string.
29
+ */
30
+ const upperFirst = ( [ firstLetter, ...rest ] ) =>
31
+ firstLetter.toUpperCase() + rest.join( '' );
32
+
23
33
  /**
24
34
  * Higher order component factory for injecting the `colorsArray` argument as
25
35
  * the colors prop in the `withCustomColors` HOC.
@@ -92,6 +92,7 @@ function ColorGradientControlInner( {
92
92
  ),
93
93
  [ TAB_GRADIENT.value ]: (
94
94
  <GradientPicker
95
+ __nextHasNoMargin
95
96
  value={ gradientValue }
96
97
  onChange={
97
98
  canChooseAColor
@@ -6,6 +6,7 @@ import {
6
6
  serialize,
7
7
  pasteHandler,
8
8
  store as blocksStore,
9
+ createBlock,
9
10
  } from '@wordpress/blocks';
10
11
  import {
11
12
  documentHasSelection,
@@ -155,6 +156,23 @@ export function useClipboardHandler() {
155
156
  );
156
157
  blocks = [ head, ...inBetweenBlocks, tail ];
157
158
  }
159
+
160
+ const wrapperBlockName = event.clipboardData.getData(
161
+ '__unstableWrapperBlockName'
162
+ );
163
+
164
+ if ( wrapperBlockName ) {
165
+ blocks = createBlock(
166
+ wrapperBlockName,
167
+ JSON.parse(
168
+ event.clipboardData.getData(
169
+ '__unstableWrapperBlockAttributes'
170
+ )
171
+ ),
172
+ blocks
173
+ );
174
+ }
175
+
158
176
  const serialized = serialize( blocks );
159
177
 
160
178
  event.clipboardData.setData(
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { uniq } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -83,15 +78,17 @@ function NonDefaultControls( { format, onChange } ) {
83
78
  // 2022) in German (de). The resultant array is de-duplicated as some
84
79
  // languages will use the same format string for short, medium, and long
85
80
  // formats.
86
- const suggestedFormats = uniq( [
87
- 'Y-m-d',
88
- _x( 'n/j/Y', 'short date format' ),
89
- _x( 'n/j/Y g:i A', 'short date format with time' ),
90
- _x( 'M j, Y', 'medium date format' ),
91
- _x( 'M j, Y g:i A', 'medium date format with time' ),
92
- _x( 'F j, Y', 'long date format' ),
93
- _x( 'M j', 'short date format without the year' ),
94
- ] );
81
+ const suggestedFormats = [
82
+ ...new Set( [
83
+ 'Y-m-d',
84
+ _x( 'n/j/Y', 'short date format' ),
85
+ _x( 'n/j/Y g:i A', 'short date format with time' ),
86
+ _x( 'M j, Y', 'medium date format' ),
87
+ _x( 'M j, Y g:i A', 'medium date format with time' ),
88
+ _x( 'F j, Y', 'long date format' ),
89
+ _x( 'M j', 'short date format without the year' ),
90
+ ] ),
91
+ ];
95
92
 
96
93
  const suggestedOptions = suggestedFormats.map(
97
94
  ( suggestedFormat, index ) => ( {
@@ -116,6 +113,7 @@ function NonDefaultControls( { format, onChange } ) {
116
113
  <>
117
114
  <BaseControl className="block-editor-date-format-picker__custom-format-select-control">
118
115
  <CustomSelectControl
116
+ __nextUnconstrainedWidth
119
117
  label={ __( 'Choose a format' ) }
120
118
  options={ [ ...suggestedOptions, customOption ] }
121
119
  value={
@@ -11,10 +11,6 @@
11
11
  &.components-base-control {
12
12
  margin-bottom: 0;
13
13
  }
14
-
15
- .components-custom-select-control__button {
16
- width: 100%;
17
- }
18
14
  }
19
15
 
20
16
  .block-editor-date-format-picker__custom-format-select-control__custom-option {
@@ -11,9 +11,9 @@ import { __unstableGetValuesFromColors as getValuesFromColors } from './index';
11
11
  /**
12
12
  * SVG and stylesheet needed for rendering the duotone filter.
13
13
  *
14
- * @param {Object} props Duotone props.
15
- * @param {string} props.selector Selector to apply the filter to.
16
- * @param {string} props.id Unique id for this duotone filter.
14
+ * @param {Object} props Duotone props.
15
+ * @param {string} props.selector Selector to apply the filter to.
16
+ * @param {string} props.id Unique id for this duotone filter.
17
17
  *
18
18
  * @return {WPElement} Duotone element.
19
19
  */
@@ -29,8 +29,8 @@ ${ selector } {
29
29
  /**
30
30
  * Stylesheet for disabling a global styles duotone filter.
31
31
  *
32
- * @param {Object} props Duotone props.
33
- * @param {string} props.selector Selector to disable the filter for.
32
+ * @param {Object} props Duotone props.
33
+ * @param {string} props.selector Selector to disable the filter for.
34
34
  *
35
35
  * @return {WPElement} Filter none style element.
36
36
  */
@@ -18,10 +18,6 @@ $swatch-columns: math.floor(math.div($popover-width + $swatch-gap - 2 * $popover
18
18
  padding: 0;
19
19
  }
20
20
 
21
- .components-custom-gradient-picker__gradient-bar {
22
- margin: $grid-unit-20 0 $grid-unit-15;
23
- }
24
-
25
21
  .components-circular-option-picker__swatches {
26
22
  display: grid;
27
23
  grid-template-columns: repeat($swatch-columns, $swatch-size);
@@ -1,6 +1,4 @@
1
1
  .components-font-appearance-control {
2
- margin-bottom: 24px;
3
-
4
2
  ul {
5
3
  li {
6
4
  color: $gray-900;
@@ -40,7 +40,7 @@ export default function FontFamilyControl( {
40
40
  ];
41
41
  return (
42
42
  <SelectControl
43
- label={ __( 'Font family' ) }
43
+ label={ __( 'Font' ) }
44
44
  options={ options }
45
45
  value={ value }
46
46
  onChange={ onChange }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { find, pickBy, reduce, some, upperFirst } from 'lodash';
4
+ import { find, pickBy, reduce, some } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -17,6 +17,16 @@ import useSetting from '../use-setting';
17
17
 
18
18
  const DEFAULT_FONT_SIZES = [];
19
19
 
20
+ /**
21
+ * Capitalizes the first letter in a string.
22
+ *
23
+ * @param {string} str The string whose first letter the function will capitalize.
24
+ *
25
+ * @return {string} Capitalized string.
26
+ */
27
+ const upperFirst = ( [ firstLetter, ...rest ] ) =>
28
+ firstLetter.toUpperCase() + rest.join( '' );
29
+
20
30
  /**
21
31
  * Higher-order component, which handles font size logic for class generation,
22
32
  * font size value retrieval, and font size change handling.
@@ -93,6 +93,7 @@ export { default as URLInputButton } from './url-input/button';
93
93
  export { default as URLPopover } from './url-popover';
94
94
  export { __experimentalImageURLInputUI } from './url-popover/image-url-input-ui';
95
95
  export { default as withColorContext } from './color-palette/with-color-context';
96
+ export { default as __experimentalSpacingSizesControl } from './spacing-sizes-control';
96
97
 
97
98
  /*
98
99
  * Content Related Components
@@ -21,6 +21,7 @@ import getBlockContext from './get-block-context';
21
21
  * Internal dependencies
22
22
  */
23
23
  import BlockList from '../block-list';
24
+ import BlockListCompact from '../block-list/block-list-compact';
24
25
  import { useBlockEditContext } from '../block-edit/context';
25
26
  import useBlockSync from '../provider/use-block-sync';
26
27
  import { BlockContextProvider } from '../block-context';
@@ -96,6 +97,7 @@ function UncontrolledInnerBlocks( props ) {
96
97
  blockWidth,
97
98
  __experimentalLayout: layout = defaultLayout,
98
99
  gridProperties,
100
+ useCompactList,
99
101
  } = props;
100
102
 
101
103
  const block = useSelect(
@@ -112,8 +114,10 @@ function UncontrolledInnerBlocks( props ) {
112
114
  templateInsertUpdatesSelection
113
115
  );
114
116
 
117
+ const BlockListComponent = useCompactList ? BlockListCompact : BlockList;
118
+
115
119
  let blockList = (
116
- <BlockList
120
+ <BlockListComponent
117
121
  marginVertical={ marginVertical }
118
122
  marginHorizontal={ marginHorizontal }
119
123
  rootClientId={ clientId }
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { deburr, find, words } from 'lodash';
4
+ import { noCase } from 'change-case';
5
+ import removeAccents from 'remove-accents';
6
+ import { find } from 'lodash';
5
7
 
6
8
  // Default search helpers.
7
9
  const defaultGetName = ( item ) => item.name || '';
@@ -21,7 +23,7 @@ const defaultGetCollection = () => null;
21
23
  function normalizeSearchInput( input = '' ) {
22
24
  // Disregard diacritics.
23
25
  // Input: "média"
24
- input = deburr( input );
26
+ input = removeAccents( input );
25
27
 
26
28
  // Accommodate leading slash, matching autocomplete expectations.
27
29
  // Input: "/media"
@@ -34,6 +36,17 @@ function normalizeSearchInput( input = '' ) {
34
36
  return input;
35
37
  }
36
38
 
39
+ /**
40
+ * Extracts words from an input string.
41
+ *
42
+ * @param {string} input The input string.
43
+ *
44
+ * @return {Array} Words, extracted from the input string.
45
+ */
46
+ function extractWords( input = '' ) {
47
+ return noCase( input ).split( ' ' ).filter( Boolean );
48
+ }
49
+
37
50
  /**
38
51
  * Converts the search term into a list of normalized terms.
39
52
  *
@@ -42,8 +55,7 @@ function normalizeSearchInput( input = '' ) {
42
55
  * @return {string[]} The normalized list of search terms.
43
56
  */
44
57
  export const getNormalizedSearchTerms = ( input = '' ) => {
45
- // Extract words.
46
- return words( normalizeSearchInput( input ) );
58
+ return extractWords( normalizeSearchInput( input ) );
47
59
  };
48
60
 
49
61
  const removeMatchingTerms = ( unmatchedTerms, unprocessedTerms ) => {
@@ -150,7 +162,7 @@ export function getItemSearchRank( item, searchTerm, config = {} ) {
150
162
  category,
151
163
  collection,
152
164
  ].join( ' ' );
153
- const normalizedSearchTerms = words( normalizedSearchInput );
165
+ const normalizedSearchTerms = extractWords( normalizedSearchInput );
154
166
  const unmatchedTerms = removeMatchingTerms(
155
167
  normalizedSearchTerms,
156
168
  terms