@wordpress/block-library 8.7.0 → 8.9.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 (416) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/column/index.js +2 -1
  3. package/build/column/index.js.map +1 -1
  4. package/build/columns/edit.js +24 -6
  5. package/build/columns/edit.js.map +1 -1
  6. package/build/columns/index.js +2 -1
  7. package/build/columns/index.js.map +1 -1
  8. package/build/columns/utils.js +4 -9
  9. package/build/columns/utils.js.map +1 -1
  10. package/build/cover/edit/index.js +46 -50
  11. package/build/cover/edit/index.js.map +1 -1
  12. package/build/cover/edit/{resizable-cover.js → resizable-cover-popover.js} +32 -6
  13. package/build/cover/edit/resizable-cover-popover.js.map +1 -0
  14. package/build/cover/index.js +12 -0
  15. package/build/cover/index.js.map +1 -1
  16. package/build/cover/transforms.js +10 -7
  17. package/build/cover/transforms.js.map +1 -1
  18. package/build/details/edit.js +67 -0
  19. package/build/details/edit.js.map +1 -0
  20. package/build/details/index.js +110 -0
  21. package/build/details/index.js.map +1 -0
  22. package/build/details/save.js +33 -0
  23. package/build/details/save.js.map +1 -0
  24. package/build/details-content/edit.js +34 -0
  25. package/build/details-content/edit.js.map +1 -0
  26. package/build/details-content/index.js +94 -0
  27. package/build/details-content/index.js.map +1 -0
  28. package/build/details-content/save.js +20 -0
  29. package/build/details-content/save.js.map +1 -0
  30. package/build/details-summary/edit.js +42 -0
  31. package/build/details-summary/edit.js.map +1 -0
  32. package/build/details-summary/index.js +97 -0
  33. package/build/details-summary/index.js.map +1 -0
  34. package/build/details-summary/save.js +24 -0
  35. package/build/details-summary/save.js.map +1 -0
  36. package/build/embed/deprecated.js +4 -1
  37. package/build/embed/deprecated.js.map +1 -1
  38. package/build/embed/embed-link-settings.native.js +1 -1
  39. package/build/embed/embed-link-settings.native.js.map +1 -1
  40. package/build/embed/embed-placeholder.js +1 -1
  41. package/build/embed/embed-placeholder.js.map +1 -1
  42. package/build/embed/index.js +4 -1
  43. package/build/embed/index.js.map +1 -1
  44. package/build/embed/transforms.js +4 -1
  45. package/build/embed/transforms.js.map +1 -1
  46. package/build/embed/util.js +4 -1
  47. package/build/embed/util.js.map +1 -1
  48. package/build/file/edit.native.js +0 -2
  49. package/build/file/edit.native.js.map +1 -1
  50. package/build/gallery/use-get-media.native.js +2 -1
  51. package/build/gallery/use-get-media.native.js.map +1 -1
  52. package/build/group/edit.js +3 -1
  53. package/build/group/edit.js.map +1 -1
  54. package/build/group/index.js +3 -0
  55. package/build/group/index.js.map +1 -1
  56. package/build/image/edit.js +16 -13
  57. package/build/image/edit.js.map +1 -1
  58. package/build/image/index.js +5 -3
  59. package/build/image/index.js.map +1 -1
  60. package/build/index.js +24 -6
  61. package/build/index.js.map +1 -1
  62. package/build/index.native.js +9 -5
  63. package/build/index.native.js.map +1 -1
  64. package/build/media-text/edit.js +4 -2
  65. package/build/media-text/edit.js.map +1 -1
  66. package/build/media-text/index.js +3 -0
  67. package/build/media-text/index.js.map +1 -1
  68. package/build/media-text/media-container.js +2 -6
  69. package/build/media-text/media-container.js.map +1 -1
  70. package/build/media-text/media-container.native.js +3 -3
  71. package/build/media-text/media-container.native.js.map +1 -1
  72. package/build/navigation/deprecated.js +8 -11
  73. package/build/navigation/deprecated.js.map +1 -1
  74. package/build/navigation/edit/index.js +32 -64
  75. package/build/navigation/edit/index.js.map +1 -1
  76. package/build/navigation/edit/unsaved-inner-blocks.js +1 -14
  77. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  78. package/build/post-author/index.js +0 -1
  79. package/build/post-author/index.js.map +1 -1
  80. package/build/post-date/edit.js +4 -2
  81. package/build/post-date/edit.js.map +1 -1
  82. package/build/post-excerpt/edit.js +2 -2
  83. package/build/post-excerpt/edit.js.map +1 -1
  84. package/build/post-featured-image/dimension-controls.js +2 -1
  85. package/build/post-featured-image/dimension-controls.js.map +1 -1
  86. package/build/post-featured-image/edit.js +16 -27
  87. package/build/post-featured-image/edit.js.map +1 -1
  88. package/build/post-time-to-read/edit.js +1 -1
  89. package/build/post-time-to-read/edit.js.map +1 -1
  90. package/build/post-time-to-read/index.js +7 -0
  91. package/build/post-time-to-read/index.js.map +1 -1
  92. package/build/query/deprecated.js +8 -6
  93. package/build/query/deprecated.js.map +1 -1
  94. package/build/query/edit/inspector-controls/create-new-post-link.js +41 -0
  95. package/build/query/edit/inspector-controls/create-new-post-link.js.map +1 -0
  96. package/build/query/edit/inspector-controls/index.js +14 -6
  97. package/build/query/edit/inspector-controls/index.js.map +1 -1
  98. package/build/query/edit/pattern-selection-modal.js +2 -1
  99. package/build/query/edit/pattern-selection-modal.js.map +1 -1
  100. package/build/query/index.js +5 -12
  101. package/build/query/index.js.map +1 -1
  102. package/build/site-logo/edit.js +114 -16
  103. package/build/site-logo/edit.js.map +1 -1
  104. package/build/site-logo/index.js +1 -1
  105. package/build/social-link/icons/chain.js +1 -1
  106. package/build/social-link/icons/chain.js.map +1 -1
  107. package/build/social-link/icons/mail.js +1 -1
  108. package/build/social-link/icons/mail.js.map +1 -1
  109. package/build/spacer/controls.js +25 -6
  110. package/build/spacer/controls.js.map +1 -1
  111. package/build/spacer/edit.js +129 -13
  112. package/build/spacer/edit.js.map +1 -1
  113. package/build/spacer/save.js +2 -2
  114. package/build/spacer/save.js.map +1 -1
  115. package/build/table/state.js +35 -35
  116. package/build/table/state.js.map +1 -1
  117. package/build/template-part/edit/index.js +2 -1
  118. package/build/template-part/edit/index.js.map +1 -1
  119. package/build/template-part/edit/utils/hooks.js +2 -2
  120. package/build/template-part/edit/utils/hooks.js.map +1 -1
  121. package/build/term-description/index.js +1 -2
  122. package/build/term-description/index.js.map +1 -1
  123. package/build/utils/migrate-font-family.js +12 -5
  124. package/build/utils/migrate-font-family.js.map +1 -1
  125. package/build/video/edit.native.js +4 -3
  126. package/build/video/edit.native.js.map +1 -1
  127. package/build-module/column/index.js +2 -1
  128. package/build-module/column/index.js.map +1 -1
  129. package/build-module/columns/edit.js +24 -6
  130. package/build-module/columns/edit.js.map +1 -1
  131. package/build-module/columns/index.js +2 -1
  132. package/build-module/columns/index.js.map +1 -1
  133. package/build-module/columns/utils.js +4 -8
  134. package/build-module/columns/utils.js.map +1 -1
  135. package/build-module/cover/edit/index.js +48 -52
  136. package/build-module/cover/edit/index.js.map +1 -1
  137. package/build-module/cover/edit/{resizable-cover.js → resizable-cover-popover.js} +31 -6
  138. package/build-module/cover/edit/resizable-cover-popover.js.map +1 -0
  139. package/build-module/cover/index.js +12 -0
  140. package/build-module/cover/index.js.map +1 -1
  141. package/build-module/cover/transforms.js +5 -1
  142. package/build-module/cover/transforms.js.map +1 -1
  143. package/build-module/details/edit.js +52 -0
  144. package/build-module/details/edit.js.map +1 -0
  145. package/build-module/details/index.js +91 -0
  146. package/build-module/details/index.js.map +1 -0
  147. package/build-module/details/save.js +20 -0
  148. package/build-module/details/save.js.map +1 -0
  149. package/build-module/details-content/edit.js +23 -0
  150. package/build-module/details-content/edit.js.map +1 -0
  151. package/build-module/details-content/index.js +76 -0
  152. package/build-module/details-content/index.js.map +1 -0
  153. package/build-module/details-content/save.js +11 -0
  154. package/build-module/details-content/save.js.map +1 -0
  155. package/build-module/details-summary/edit.js +30 -0
  156. package/build-module/details-summary/edit.js.map +1 -0
  157. package/build-module/details-summary/index.js +79 -0
  158. package/build-module/details-summary/index.js.map +1 -0
  159. package/build-module/details-summary/save.js +16 -0
  160. package/build-module/details-summary/save.js.map +1 -0
  161. package/build-module/embed/deprecated.js +4 -1
  162. package/build-module/embed/deprecated.js.map +1 -1
  163. package/build-module/embed/embed-link-settings.native.js +1 -1
  164. package/build-module/embed/embed-link-settings.native.js.map +1 -1
  165. package/build-module/embed/embed-placeholder.js +1 -1
  166. package/build-module/embed/embed-placeholder.js.map +1 -1
  167. package/build-module/embed/index.js +4 -1
  168. package/build-module/embed/index.js.map +1 -1
  169. package/build-module/embed/transforms.js +4 -1
  170. package/build-module/embed/transforms.js.map +1 -1
  171. package/build-module/embed/util.js +4 -1
  172. package/build-module/embed/util.js.map +1 -1
  173. package/build-module/file/edit.native.js +0 -2
  174. package/build-module/file/edit.native.js.map +1 -1
  175. package/build-module/gallery/use-get-media.native.js +2 -1
  176. package/build-module/gallery/use-get-media.native.js.map +1 -1
  177. package/build-module/group/edit.js +3 -1
  178. package/build-module/group/edit.js.map +1 -1
  179. package/build-module/group/index.js +3 -0
  180. package/build-module/group/index.js.map +1 -1
  181. package/build-module/image/edit.js +16 -13
  182. package/build-module/image/edit.js.map +1 -1
  183. package/build-module/image/index.js +5 -3
  184. package/build-module/image/index.js.map +1 -1
  185. package/build-module/index.js +21 -6
  186. package/build-module/index.js.map +1 -1
  187. package/build-module/index.native.js +9 -5
  188. package/build-module/index.native.js.map +1 -1
  189. package/build-module/media-text/edit.js +4 -2
  190. package/build-module/media-text/edit.js.map +1 -1
  191. package/build-module/media-text/index.js +3 -0
  192. package/build-module/media-text/index.js.map +1 -1
  193. package/build-module/media-text/media-container.js +1 -5
  194. package/build-module/media-text/media-container.js.map +1 -1
  195. package/build-module/media-text/media-container.native.js +1 -1
  196. package/build-module/media-text/media-container.native.js.map +1 -1
  197. package/build-module/navigation/deprecated.js +8 -10
  198. package/build-module/navigation/deprecated.js.map +1 -1
  199. package/build-module/navigation/edit/index.js +31 -63
  200. package/build-module/navigation/edit/index.js.map +1 -1
  201. package/build-module/navigation/edit/unsaved-inner-blocks.js +1 -14
  202. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  203. package/build-module/post-author/index.js +0 -1
  204. package/build-module/post-author/index.js.map +1 -1
  205. package/build-module/post-date/edit.js +4 -2
  206. package/build-module/post-date/edit.js.map +1 -1
  207. package/build-module/post-excerpt/edit.js +2 -2
  208. package/build-module/post-excerpt/edit.js.map +1 -1
  209. package/build-module/post-featured-image/dimension-controls.js +2 -1
  210. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  211. package/build-module/post-featured-image/edit.js +16 -27
  212. package/build-module/post-featured-image/edit.js.map +1 -1
  213. package/build-module/post-time-to-read/edit.js +1 -1
  214. package/build-module/post-time-to-read/edit.js.map +1 -1
  215. package/build-module/post-time-to-read/index.js +7 -0
  216. package/build-module/post-time-to-read/index.js.map +1 -1
  217. package/build-module/query/deprecated.js +5 -2
  218. package/build-module/query/deprecated.js.map +1 -1
  219. package/build-module/query/edit/inspector-controls/create-new-post-link.js +33 -0
  220. package/build-module/query/edit/inspector-controls/create-new-post-link.js.map +1 -0
  221. package/build-module/query/edit/inspector-controls/index.js +12 -7
  222. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  223. package/build-module/query/edit/pattern-selection-modal.js +2 -1
  224. package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
  225. package/build-module/query/index.js +5 -10
  226. package/build-module/query/index.js.map +1 -1
  227. package/build-module/site-logo/edit.js +115 -18
  228. package/build-module/site-logo/edit.js.map +1 -1
  229. package/build-module/site-logo/index.js +1 -1
  230. package/build-module/social-link/icons/chain.js +1 -1
  231. package/build-module/social-link/icons/chain.js.map +1 -1
  232. package/build-module/social-link/icons/mail.js +1 -1
  233. package/build-module/social-link/icons/mail.js.map +1 -1
  234. package/build-module/spacer/controls.js +27 -9
  235. package/build-module/spacer/controls.js.map +1 -1
  236. package/build-module/spacer/edit.js +129 -14
  237. package/build-module/spacer/edit.js.map +1 -1
  238. package/build-module/spacer/save.js +3 -3
  239. package/build-module/spacer/save.js.map +1 -1
  240. package/build-module/table/state.js +35 -33
  241. package/build-module/table/state.js.map +1 -1
  242. package/build-module/template-part/edit/index.js +2 -1
  243. package/build-module/template-part/edit/index.js.map +1 -1
  244. package/build-module/template-part/edit/utils/hooks.js +2 -2
  245. package/build-module/template-part/edit/utils/hooks.js.map +1 -1
  246. package/build-module/term-description/index.js +1 -2
  247. package/build-module/term-description/index.js.map +1 -1
  248. package/build-module/utils/migrate-font-family.js +9 -1
  249. package/build-module/utils/migrate-font-family.js.map +1 -1
  250. package/build-module/video/edit.native.js +4 -3
  251. package/build-module/video/edit.native.js.map +1 -1
  252. package/build-style/columns/style-rtl.css +4 -1
  253. package/build-style/columns/style.css +4 -1
  254. package/build-style/common-rtl.css +1 -1
  255. package/build-style/common.css +1 -1
  256. package/build-style/cover/editor-rtl.css +9 -10
  257. package/build-style/cover/editor.css +9 -10
  258. package/build-style/cover/style-rtl.css +1 -1
  259. package/build-style/cover/style.css +1 -1
  260. package/build-style/details/style-rtl.css +91 -0
  261. package/build-style/details/style.css +91 -0
  262. package/build-style/details-summary/editor-rtl.css +91 -0
  263. package/build-style/details-summary/editor.css +91 -0
  264. package/build-style/details-summary/style-rtl.css +91 -0
  265. package/build-style/details-summary/style.css +91 -0
  266. package/build-style/editor-rtl.css +97 -74
  267. package/build-style/editor.css +97 -74
  268. package/build-style/file/style-rtl.css +4 -3
  269. package/build-style/file/style.css +4 -3
  270. package/build-style/html/editor-rtl.css +2 -2
  271. package/build-style/html/editor.css +2 -2
  272. package/build-style/image/editor-rtl.css +1 -1
  273. package/build-style/image/editor.css +1 -1
  274. package/build-style/post-excerpt/style-rtl.css +1 -1
  275. package/build-style/post-excerpt/style.css +1 -1
  276. package/build-style/pullquote/style-rtl.css +4 -1
  277. package/build-style/pullquote/style.css +4 -1
  278. package/build-style/query/editor-rtl.css +8 -12
  279. package/build-style/query/editor.css +8 -12
  280. package/build-style/search/style-rtl.css +2 -0
  281. package/build-style/search/style.css +2 -0
  282. package/build-style/shortcode/editor-rtl.css +15 -35
  283. package/build-style/shortcode/editor.css +15 -35
  284. package/build-style/site-logo/editor-rtl.css +46 -0
  285. package/build-style/site-logo/editor.css +46 -0
  286. package/build-style/spacer/editor-rtl.css +4 -2
  287. package/build-style/spacer/editor.css +4 -2
  288. package/build-style/style-rtl.css +25 -8
  289. package/build-style/style.css +25 -8
  290. package/build-style/template-part/editor-rtl.css +8 -12
  291. package/build-style/template-part/editor.css +8 -12
  292. package/package.json +31 -31
  293. package/src/buttons/test/__snapshots__/edit.native.js.snap +18 -0
  294. package/src/buttons/test/edit.native.js +123 -2
  295. package/src/column/block.json +2 -1
  296. package/src/columns/block.json +2 -1
  297. package/src/columns/edit.js +33 -9
  298. package/src/columns/style.scss +5 -1
  299. package/src/columns/utils.js +8 -9
  300. package/src/common.scss +1 -1
  301. package/src/cover/block.json +12 -0
  302. package/src/cover/edit/index.js +44 -37
  303. package/src/cover/edit/resizable-cover-popover.js +82 -0
  304. package/src/cover/editor.scss +20 -13
  305. package/src/cover/index.php +9 -10
  306. package/src/cover/style.scss +1 -1
  307. package/src/cover/test/edit.js +1 -1
  308. package/src/cover/transforms.js +4 -1
  309. package/src/details/block.json +54 -0
  310. package/src/details/edit.js +59 -0
  311. package/src/details/index.js +35 -0
  312. package/src/details/save.js +15 -0
  313. package/src/details/style.scss +3 -0
  314. package/src/details-content/block.json +50 -0
  315. package/src/details-content/edit.js +29 -0
  316. package/src/details-content/index.js +23 -0
  317. package/src/details-content/save.js +12 -0
  318. package/src/details-summary/block.json +53 -0
  319. package/src/details-summary/edit.js +27 -0
  320. package/src/details-summary/editor.scss +3 -0
  321. package/src/details-summary/index.js +23 -0
  322. package/src/details-summary/save.js +13 -0
  323. package/src/details-summary/style.scss +3 -0
  324. package/src/editor.scss +1 -0
  325. package/src/embed/block.json +4 -1
  326. package/src/embed/embed-link-settings.native.js +1 -1
  327. package/src/embed/embed-placeholder.js +1 -1
  328. package/src/file/edit.native.js +0 -2
  329. package/src/file/style.scss +5 -2
  330. package/src/gallery/test/index.native.js +4 -4
  331. package/src/gallery/test/use-get-media.native.js +24 -0
  332. package/src/gallery/use-get-media.native.js +1 -1
  333. package/src/group/block.json +3 -0
  334. package/src/group/edit.js +8 -2
  335. package/src/heading/test/__snapshots__/index.native.js.snap +12 -0
  336. package/src/heading/test/index.native.js +71 -0
  337. package/src/html/editor.scss +2 -21
  338. package/src/image/block.json +5 -3
  339. package/src/image/edit.js +21 -17
  340. package/src/image/editor.scss +1 -1
  341. package/src/index.js +13 -3
  342. package/src/index.native.js +9 -5
  343. package/src/list/test/edit.native.js +7 -7
  344. package/src/media-text/block.json +3 -0
  345. package/src/media-text/edit.js +2 -1
  346. package/src/media-text/media-container.js +1 -5
  347. package/src/media-text/media-container.native.js +1 -1
  348. package/src/navigation/deprecated.js +15 -19
  349. package/src/navigation/edit/index.js +32 -106
  350. package/src/navigation/edit/unsaved-inner-blocks.js +34 -46
  351. package/src/navigation/index.php +15 -12
  352. package/src/paragraph/test/edit.native.js +616 -1
  353. package/src/post-author/block.json +0 -1
  354. package/src/post-date/edit.js +4 -0
  355. package/src/post-date/index.php +17 -8
  356. package/src/post-excerpt/edit.js +1 -1
  357. package/src/post-excerpt/index.php +3 -3
  358. package/src/post-excerpt/style.scss +2 -1
  359. package/src/post-featured-image/dimension-controls.js +5 -1
  360. package/src/post-featured-image/edit.js +14 -34
  361. package/src/post-featured-image/index.php +1 -1
  362. package/src/post-time-to-read/block.json +7 -0
  363. package/src/post-time-to-read/edit.js +1 -1
  364. package/src/post-time-to-read/index.php +3 -3
  365. package/src/preformatted/test/__snapshots__/edit.native.js.snap +2 -2
  366. package/src/preformatted/test/edit.native.js +42 -2
  367. package/src/pullquote/style.scss +5 -1
  368. package/src/pullquote/test/edit.native.js +65 -0
  369. package/src/query/deprecated.js +4 -1
  370. package/src/query/edit/inspector-controls/create-new-post-link.js +26 -0
  371. package/src/query/edit/inspector-controls/index.js +13 -6
  372. package/src/query/edit/pattern-selection-modal.js +1 -0
  373. package/src/query/editor.scss +8 -11
  374. package/src/query/index.js +1 -7
  375. package/src/quote/test/edit.native.js +88 -0
  376. package/src/search/index.php +1 -1
  377. package/src/search/style.scss +3 -0
  378. package/src/shortcode/editor.scss +6 -5
  379. package/src/site-logo/block.json +1 -1
  380. package/src/site-logo/edit.js +123 -9
  381. package/src/site-logo/editor.scss +57 -0
  382. package/src/social-link/icons/chain.js +1 -1
  383. package/src/social-link/icons/mail.js +1 -1
  384. package/src/social-link/index.php +2 -2
  385. package/src/spacer/controls.js +42 -17
  386. package/src/spacer/edit.js +176 -18
  387. package/src/spacer/editor.scss +2 -1
  388. package/src/spacer/save.js +3 -3
  389. package/src/style.scss +2 -0
  390. package/src/table/state.js +83 -66
  391. package/src/template-part/edit/index.js +1 -0
  392. package/src/template-part/edit/utils/hooks.js +2 -2
  393. package/src/template-part/editor.scss +9 -11
  394. package/src/term-description/block.json +1 -2
  395. package/src/utils/migrate-font-family.js +8 -1
  396. package/src/verse/test/edit.native.js +28 -0
  397. package/src/video/edit.native.js +2 -2
  398. package/tsconfig.json +1 -0
  399. package/build/cover/edit/resizable-cover.js.map +0 -1
  400. package/build/media-text/media-container-icon.js +0 -27
  401. package/build/media-text/media-container-icon.js.map +0 -1
  402. package/build/query/hooks.js +0 -72
  403. package/build/query/hooks.js.map +0 -1
  404. package/build/utils/clean-empty-object.js +0 -34
  405. package/build/utils/clean-empty-object.js.map +0 -1
  406. package/build-module/cover/edit/resizable-cover.js.map +0 -1
  407. package/build-module/media-text/media-container-icon.js +0 -17
  408. package/build-module/media-text/media-container-icon.js.map +0 -1
  409. package/build-module/query/hooks.js +0 -59
  410. package/build-module/query/hooks.js.map +0 -1
  411. package/build-module/utils/clean-empty-object.js +0 -25
  412. package/build-module/utils/clean-empty-object.js.map +0 -1
  413. package/src/cover/edit/resizable-cover.js +0 -61
  414. package/src/media-text/media-container-icon.js +0 -12
  415. package/src/query/hooks.js +0 -53
  416. package/src/utils/clean-empty-object.js +0 -28
@@ -18,7 +18,7 @@ const MailIcon = () => (0, _element.createElement)(_primitives.SVG, {
18
18
  viewBox: "0 0 24 24",
19
19
  version: "1.1"
20
20
  }, (0, _element.createElement)(_primitives.Path, {
21
- d: "M20,4H4C2.895,4,2,4.895,2,6v12c0,1.105,0.895,2,2,2h16c1.105,0,2-0.895,2-2V6C22,4.895,21.105,4,20,4z M20,8.236l-8,4.882 L4,8.236V6h16V8.236z"
21
+ d: "M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l7.5 5.6 7.5-5.6V17zm0-9.1L12 13.6 4.5 7.9V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v.9z"
22
22
  }));
23
23
 
24
24
  exports.MailIcon = MailIcon;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/social-link/icons/mail.js"],"names":["MailIcon"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAMA,QAAQ,GAAG,MACvB,4BAAC,eAAD;AAAK,EAAA,KAAK,EAAC,IAAX;AAAgB,EAAA,MAAM,EAAC,IAAvB;AAA4B,EAAA,OAAO,EAAC,WAApC;AAAgD,EAAA,OAAO,EAAC;AAAxD,GACC,4BAAC,gBAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Path, SVG } from '@wordpress/primitives';\n\nexport const MailIcon = () => (\n\t<SVG width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\">\n\t\t<Path d=\"M20,4H4C2.895,4,2,4.895,2,6v12c0,1.105,0.895,2,2,2h16c1.105,0,2-0.895,2-2V6C22,4.895,21.105,4,20,4z M20,8.236l-8,4.882 L4,8.236V6h16V8.236z\" />\n\t</SVG>\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/social-link/icons/mail.js"],"names":["MailIcon"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAMA,QAAQ,GAAG,MACvB,4BAAC,eAAD;AAAK,EAAA,KAAK,EAAC,IAAX;AAAgB,EAAA,MAAM,EAAC,IAAvB;AAA4B,EAAA,OAAO,EAAC,WAApC;AAAgD,EAAA,OAAO,EAAC;AAAxD,GACC,4BAAC,gBAAD;AAAM,EAAA,CAAC,EAAC;AAAR,EADD,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Path, SVG } from '@wordpress/primitives';\n\nexport const MailIcon = () => (\n\t<SVG width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" version=\"1.1\">\n\t\t<Path d=\"M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l7.5 5.6 7.5-5.6V17zm0-9.1L12 13.6 4.5 7.9V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v.9z\" />\n\t</SVG>\n);\n"]}
@@ -15,6 +15,8 @@ var _components = require("@wordpress/components");
15
15
 
16
16
  var _compose = require("@wordpress/compose");
17
17
 
18
+ var _primitives = require("@wordpress/primitives");
19
+
18
20
  var _constants = require("./constants");
19
21
 
20
22
  /**
@@ -33,7 +35,8 @@ function DimensionInput(_ref) {
33
35
  isResizing,
34
36
  value = ''
35
37
  } = _ref;
36
- const inputId = (0, _compose.useInstanceId)(_components.__experimentalUnitControl, 'block-spacer-height-input'); // In most contexts the spacer size cannot meaningfully be set to a
38
+ const inputId = (0, _compose.useInstanceId)(_components.__experimentalUnitControl, 'block-spacer-height-input');
39
+ const spacingSizes = (0, _blockEditor.useSetting)('spacing.spacingSizes'); // In most contexts the spacer size cannot meaningfully be set to a
37
40
  // percentage, since this is relative to the parent container. This
38
41
  // unit is disabled from the UI.
39
42
 
@@ -50,22 +53,38 @@ function DimensionInput(_ref) {
50
53
  });
51
54
 
52
55
  const handleOnChange = unprocessedValue => {
53
- onChange(unprocessedValue);
56
+ onChange(unprocessedValue.all);
54
57
  }; // Force the unit to update to `px` when the Spacer is being resized.
55
58
 
56
59
 
57
60
  const [parsedQuantity, parsedUnit] = (0, _components.__experimentalParseQuantityAndUnitFromRawValue)(value);
58
- const computedValue = [parsedQuantity, isResizing ? 'px' : parsedUnit].join('');
59
- return (0, _element.createElement)(_components.__experimentalUnitControl, {
61
+ const computedValue = (0, _blockEditor.isValueSpacingPreset)(value) ? value : [parsedQuantity, isResizing ? 'px' : parsedUnit].join('');
62
+ return (0, _element.createElement)(_element.Fragment, null, (!spacingSizes || (spacingSizes === null || spacingSizes === void 0 ? void 0 : spacingSizes.length) === 0) && (0, _element.createElement)(_components.BaseControl, {
60
63
  label: label,
64
+ id: inputId
65
+ }, (0, _element.createElement)(_components.__experimentalUnitControl, {
61
66
  id: inputId,
62
67
  isResetValueOnUnitChange: true,
63
68
  min: _constants.MIN_SPACER_SIZE,
64
69
  onChange: handleOnChange,
65
- __unstableInputWidth: '80px',
70
+ style: {
71
+ maxWidth: 80
72
+ },
66
73
  value: computedValue,
67
74
  units: units
68
- });
75
+ })), (spacingSizes === null || spacingSizes === void 0 ? void 0 : spacingSizes.length) > 0 && (0, _element.createElement)(_primitives.View, {
76
+ className: "tools-panel-item-spacing"
77
+ }, (0, _element.createElement)(_blockEditor.__experimentalSpacingSizesControl, {
78
+ values: {
79
+ all: computedValue
80
+ },
81
+ onChange: handleOnChange,
82
+ label: label,
83
+ sides: ['all'],
84
+ units: units,
85
+ allowReset: false,
86
+ splitOnAxis: false
87
+ })));
69
88
  }
70
89
 
71
90
  function SpacerControls(_ref3) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/spacer/controls.js"],"names":["DimensionInput","label","onChange","isResizing","value","inputId","UnitControl","availableUnitSettings","undefined","filter","availableUnit","units","availableUnits","defaultValues","px","em","rem","vw","vh","handleOnChange","unprocessedValue","parsedQuantity","parsedUnit","computedValue","join","MIN_SPACER_SIZE","SpacerControls","setAttributes","orientation","height","width","nextWidth","nextHeight"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAMA;;AAKA;;AAhBA;AACA;AACA;;AAWA;AACA;AACA;AAGA,SAASA,cAAT,OAAuE;AAAA;;AAAA,MAA9C;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAT;AAAmBC,IAAAA,UAAnB;AAA+BC,IAAAA,KAAK,GAAG;AAAvC,GAA8C;AACtE,QAAMC,OAAO,GAAG,4BAAeC,qCAAf,EAA4B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AAAA,KAJuC;AAKvC3B,IAAAA;AALuC,GAMpC;AACH,SACC,4BAAC,8BAAD,QACC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,UAAJ;AAAnB,KACGyB,WAAW,KAAK,YAAhB,IACD,4BAAC,cAAD;AACC,IAAA,KAAK,EAAG,cAAI,OAAJ,CADT;AAEC,IAAA,KAAK,EAAGE,KAFT;AAGC,IAAA,QAAQ,EAAKC,SAAF,IACVJ,aAAa,CAAE;AAAEG,MAAAA,KAAK,EAAEC;AAAT,KAAF,CAJf;AAMC,IAAA,UAAU,EAAG5B;AANd,IAFF,EAWGyB,WAAW,KAAK,YAAhB,IACD,4BAAC,cAAD;AACC,IAAA,KAAK,EAAG,cAAI,QAAJ,CADT;AAEC,IAAA,KAAK,EAAGC,MAFT;AAGC,IAAA,QAAQ,EAAKG,UAAF,IACVL,aAAa,CAAE;AAAEE,MAAAA,MAAM,EAAEG;AAAV,KAAF,CAJf;AAMC,IAAA,UAAU,EAAG7B;AANd,IAZF,CADD,CADD;AA0BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, useSetting } from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { MIN_SPACER_SIZE } from './constants';\n\nfunction DimensionInput( { label, onChange, isResizing, value = '' } ) {\n\tconst inputId = useInstanceId( UnitControl, 'block-spacer-height-input' );\n\n\t// In most contexts the spacer size cannot meaningfully be set to a\n\t// percentage, since this is relative to the parent container. This\n\t// unit is disabled from the UI.\n\tconst availableUnitSettings = (\n\t\tuseSetting( 'spacing.units' ) || undefined\n\t)?.filter( ( availableUnit ) => availableUnit !== '%' );\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnitSettings || [\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t\t'vh',\n\t\t],\n\t\tdefaultValues: { px: 100, em: 10, rem: 10, vw: 10, vh: 25 },\n\t} );\n\n\tconst handleOnChange = ( unprocessedValue ) => {\n\t\tonChange( unprocessedValue );\n\t};\n\n\t// Force the unit to update to `px` when the Spacer is being resized.\n\tconst [ parsedQuantity, parsedUnit ] =\n\t\tparseQuantityAndUnitFromRawValue( value );\n\tconst computedValue = [\n\t\tparsedQuantity,\n\t\tisResizing ? 'px' : parsedUnit,\n\t].join( '' );\n\n\treturn (\n\t\t<UnitControl\n\t\t\tlabel={ label }\n\t\t\tid={ inputId }\n\t\t\tisResetValueOnUnitChange\n\t\t\tmin={ MIN_SPACER_SIZE }\n\t\t\tonChange={ handleOnChange }\n\t\t\t__unstableInputWidth={ '80px' }\n\t\t\tvalue={ computedValue }\n\t\t\tunits={ units }\n\t\t/>\n\t);\n}\n\nexport default function SpacerControls( {\n\tsetAttributes,\n\torientation,\n\theight,\n\twidth,\n\tisResizing,\n} ) {\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t{ orientation === 'horizontal' && (\n\t\t\t\t\t<DimensionInput\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tvalue={ width }\n\t\t\t\t\t\tonChange={ ( nextWidth ) =>\n\t\t\t\t\t\t\tsetAttributes( { width: nextWidth } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ orientation !== 'horizontal' && (\n\t\t\t\t\t<DimensionInput\n\t\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\t\tvalue={ height }\n\t\t\t\t\t\tonChange={ ( nextHeight ) =>\n\t\t\t\t\t\t\tsetAttributes( { height: nextHeight } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/spacer/controls.js"],"names":["DimensionInput","label","onChange","isResizing","value","inputId","UnitControl","spacingSizes","availableUnitSettings","undefined","filter","availableUnit","units","availableUnits","defaultValues","px","em","rem","vw","vh","handleOnChange","unprocessedValue","all","parsedQuantity","parsedUnit","computedValue","join","length","MIN_SPACER_SIZE","maxWidth","SpacerControls","setAttributes","orientation","height","width","nextWidth","nextHeight"],"mappings":";;;;;;;;;AAGA;;AACA;;AAMA;;AAOA;;AACA;;AAKA;;AAvBA;AACA;AACA;;AAkBA;AACA;AACA;AAGA,SAASA,cAAT,OAAuE;AAAA;;AAAA,MAA9C;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAT;AAAmBC,IAAAA,UAAnB;AAA+BC,IAAAA,KAAK,GAAG;AAAvC,GAA8C;AACtE,QAAMC,OAAO,GAAG,4BAAeC,qCAAf,EAA4B,2BAA5B,CAAhB;AACA,QAAMC,YAAY,GAAG,6BAAY,sBAAZ,CAArB,CAFsE,CAGtE;AACA;AACA;;AACA,QAAMC,qBAAqB,YAC1B,6BAAY,eAAZ,KAAiCC,SADP,0CAAG,MAE3BC,MAF2B,CAEjBC,aAAF,IAAqBA,aAAa,KAAK,GAFpB,CAA9B;AAIA,QAAMC,KAAK,GAAG,8CAAgB;AAC7BC,IAAAA,cAAc,EAAEL,qBAAqB,IAAI,CACxC,IADwC,EAExC,IAFwC,EAGxC,KAHwC,EAIxC,IAJwC,EAKxC,IALwC,CADZ;AAQ7BM,IAAAA,aAAa,EAAE;AAAEC,MAAAA,EAAE,EAAE,GAAN;AAAWC,MAAAA,EAAE,EAAE,EAAf;AAAmBC,MAAAA,GAAG,EAAE,EAAxB;AAA4BC,MAAAA,EAAE,EAAE,EAAhC;AAAoCC,MAAAA,EAAE,EAA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ALT;AAMC,IAAA,UAAU,EAAG,KANd;AAOC,IAAA,WAAW,EAAG;AAPf,IADD,CAhBF,CADD;AA+BA;;AAEc,SAASkB,cAAT,QAMX;AAAA,MANoC;AACvCC,IAAAA,aADuC;AAEvCC,IAAAA,WAFuC;AAGvCC,IAAAA,MAHuC;AAIvCC,IAAAA,KAJuC;AAKvC/B,IAAAA;AALuC,GAMpC;AACH,SACC,4BAAC,8BAAD,QACC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,UAAJ;AAAnB,KACG6B,WAAW,KAAK,YAAhB,IACD,4BAAC,cAAD;AACC,IAAA,KAAK,EAAG,cAAI,OAAJ,CADT;AAEC,IAAA,KAAK,EAAGE,KAFT;AAGC,IAAA,QAAQ,EAAKC,SAAF,IACVJ,aAAa,CAAE;AAAEG,MAAAA,KAAK,EAAEC;AAAT,KAAF,CAJf;AAMC,IAAA,UAAU,EAAGhC;AANd,IAFF,EAWG6B,WAAW,KAAK,YAAhB,IACD,4BAAC,cAAD;AACC,IAAA,KAAK,EAAG,cAAI,QAAJ,CADT;AAEC,IAAA,KAAK,EAAGC,MAFT;AAGC,IAAA,QAAQ,EAAKG,UAAF,IACVL,aAAa,CAAE;AAAEE,MAAAA,MAAM,EAAEG;AAAV,KAAF,CAJf;AAMC,IAAA,UAAU,EAAGjC;AANd,IAZF,CADD,CADD;AA0BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInspectorControls,\n\tuseSetting,\n\t__experimentalSpacingSizesControl as SpacingSizesControl,\n\tisValueSpacingPreset,\n} from '@wordpress/block-editor';\nimport {\n\tBaseControl,\n\tPanelBody,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { View } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport { MIN_SPACER_SIZE } from './constants';\n\nfunction DimensionInput( { label, onChange, isResizing, value = '' } ) {\n\tconst inputId = useInstanceId( UnitControl, 'block-spacer-height-input' );\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\t// In most contexts the spacer size cannot meaningfully be set to a\n\t// percentage, since this is relative to the parent container. This\n\t// unit is disabled from the UI.\n\tconst availableUnitSettings = (\n\t\tuseSetting( 'spacing.units' ) || undefined\n\t)?.filter( ( availableUnit ) => availableUnit !== '%' );\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnitSettings || [\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t\t'vh',\n\t\t],\n\t\tdefaultValues: { px: 100, em: 10, rem: 10, vw: 10, vh: 25 },\n\t} );\n\n\tconst handleOnChange = ( unprocessedValue ) => {\n\t\tonChange( unprocessedValue.all );\n\t};\n\n\t// Force the unit to update to `px` when the Spacer is being resized.\n\tconst [ parsedQuantity, parsedUnit ] =\n\t\tparseQuantityAndUnitFromRawValue( value );\n\tconst computedValue = isValueSpacingPreset( value )\n\t\t? value\n\t\t: [ parsedQuantity, isResizing ? 'px' : parsedUnit ].join( '' );\n\n\treturn (\n\t\t<>\n\t\t\t{ ( ! spacingSizes || spacingSizes?.length === 0 ) && (\n\t\t\t\t<BaseControl label={ label } id={ inputId }>\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\tid={ inputId }\n\t\t\t\t\t\tisResetValueOnUnitChange\n\t\t\t\t\t\tmin={ MIN_SPACER_SIZE }\n\t\t\t\t\t\tonChange={ handleOnChange }\n\t\t\t\t\t\tstyle={ { maxWidth: 80 } }\n\t\t\t\t\t\tvalue={ computedValue }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t/>\n\t\t\t\t</BaseControl>\n\t\t\t) }\n\n\t\t\t{ spacingSizes?.length > 0 && (\n\t\t\t\t<View className=\"tools-panel-item-spacing\">\n\t\t\t\t\t<SpacingSizesControl\n\t\t\t\t\t\tvalues={ { all: computedValue } }\n\t\t\t\t\t\tonChange={ handleOnChange }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tsides={ [ 'all' ] }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\tsplitOnAxis={ false }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default function SpacerControls( {\n\tsetAttributes,\n\torientation,\n\theight,\n\twidth,\n\tisResizing,\n} ) {\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t{ orientation === 'horizontal' && (\n\t\t\t\t\t<DimensionInput\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tvalue={ width }\n\t\t\t\t\t\tonChange={ ( nextWidth ) =>\n\t\t\t\t\t\t\tsetAttributes( { width: nextWidth } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ orientation !== 'horizontal' && (\n\t\t\t\t\t<DimensionInput\n\t\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\t\tvalue={ height }\n\t\t\t\t\t\tonChange={ ( nextHeight ) =>\n\t\t\t\t\t\t\tsetAttributes( { height: nextHeight } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n}\n"]}
@@ -19,6 +19,8 @@ var _components = require("@wordpress/components");
19
19
 
20
20
  var _primitives = require("@wordpress/primitives");
21
21
 
22
+ var _data = require("@wordpress/data");
23
+
22
24
  var _controls = _interopRequireDefault(require("./controls"));
23
25
 
24
26
  var _constants = require("./constants");
@@ -94,22 +96,38 @@ const SpacerEdit = _ref2 => {
94
96
  setAttributes,
95
97
  toggleSelection,
96
98
  context,
97
- __unstableParentLayout: parentLayout
99
+ __unstableParentLayout: parentLayout,
100
+ className
98
101
  } = _ref2;
102
+ const disableCustomSpacingSizes = (0, _data.useSelect)(select => {
103
+ const editorSettings = select(_blockEditor.store).getSettings();
104
+ return editorSettings === null || editorSettings === void 0 ? void 0 : editorSettings.disableCustomSpacingSizes;
105
+ });
99
106
  const {
100
107
  orientation
101
108
  } = context;
102
109
  const {
103
110
  orientation: parentOrientation,
104
111
  type
105
- } = parentLayout || {}; // If the spacer is inside a flex container, it should either inherit the orientation
112
+ } = parentLayout || {}; // Check if the spacer is inside a flex container.
113
+
114
+ const isFlexLayout = type === 'flex'; // If the spacer is inside a flex container, it should either inherit the orientation
106
115
  // of the parent or use the flex default orientation.
107
116
 
108
- const inheritedOrientation = !parentOrientation && type === 'flex' ? 'horizontal' : parentOrientation || orientation;
117
+ const inheritedOrientation = !parentOrientation && isFlexLayout ? 'horizontal' : parentOrientation || orientation;
109
118
  const {
110
119
  height,
111
- width
120
+ width,
121
+ style: blockStyle = {}
112
122
  } = attributes;
123
+ const {
124
+ layout = {}
125
+ } = blockStyle;
126
+ const {
127
+ selfStretch,
128
+ flexSize
129
+ } = layout;
130
+ const spacingSizes = (0, _blockEditor.useSetting)('spacing.spacingSizes');
113
131
  const [isResizing, setIsResizing] = (0, _element.useState)(false);
114
132
  const [temporaryHeight, setTemporaryHeight] = (0, _element.useState)(null);
115
133
  const [temporaryWidth, setTemporaryWidth] = (0, _element.useState)(null);
@@ -120,6 +138,18 @@ const SpacerEdit = _ref2 => {
120
138
 
121
139
  const handleOnVerticalResizeStop = newHeight => {
122
140
  onResizeStop();
141
+
142
+ if (isFlexLayout) {
143
+ setAttributes({
144
+ style: { ...blockStyle,
145
+ layout: { ...layout,
146
+ flexSize: newHeight,
147
+ selfStretch: 'fixed'
148
+ }
149
+ }
150
+ });
151
+ }
152
+
123
153
  setAttributes({
124
154
  height: newHeight
125
155
  });
@@ -128,17 +158,50 @@ const SpacerEdit = _ref2 => {
128
158
 
129
159
  const handleOnHorizontalResizeStop = newWidth => {
130
160
  onResizeStop();
161
+
162
+ if (isFlexLayout) {
163
+ setAttributes({
164
+ style: { ...blockStyle,
165
+ layout: { ...layout,
166
+ flexSize: newWidth,
167
+ selfStretch: 'fixed'
168
+ }
169
+ }
170
+ });
171
+ }
172
+
131
173
  setAttributes({
132
174
  width: newWidth
133
175
  });
134
176
  setTemporaryWidth(null);
135
177
  };
136
178
 
179
+ const getHeightForVerticalBlocks = () => {
180
+ if (isFlexLayout) {
181
+ return undefined;
182
+ }
183
+
184
+ return temporaryHeight || (0, _blockEditor.getSpacingPresetCssVar)(height) || undefined;
185
+ };
186
+
187
+ const getWidthForHorizontalBlocks = () => {
188
+ if (isFlexLayout) {
189
+ return undefined;
190
+ }
191
+
192
+ return temporaryWidth || (0, _blockEditor.getSpacingPresetCssVar)(width) || undefined;
193
+ };
194
+
195
+ const sizeConditionalOnOrientation = inheritedOrientation === 'horizontal' ? temporaryWidth || flexSize : temporaryHeight || flexSize;
137
196
  const style = {
138
- height: inheritedOrientation === 'horizontal' ? 24 : temporaryHeight || height || undefined,
139
- width: inheritedOrientation === 'horizontal' ? temporaryWidth || width || undefined : undefined,
197
+ height: inheritedOrientation === 'horizontal' ? 24 : getHeightForVerticalBlocks(),
198
+ width: inheritedOrientation === 'horizontal' ? getWidthForHorizontalBlocks() : undefined,
140
199
  // In vertical flex containers, the spacer shrinks to nothing without a minimum width.
141
- minWidth: inheritedOrientation === 'vertical' && type === 'flex' ? 48 : undefined
200
+ minWidth: inheritedOrientation === 'vertical' && isFlexLayout ? 48 : undefined,
201
+ // Add flex-basis so temporary sizes are respected.
202
+ flexBasis: isFlexLayout ? sizeConditionalOnOrientation : undefined,
203
+ // Remove flex-grow when resizing.
204
+ flexGrow: isFlexLayout && isResizing ? 0 : undefined
142
205
  };
143
206
 
144
207
  const resizableBoxWithOrientation = blockOrientation => {
@@ -188,16 +251,69 @@ const SpacerEdit = _ref2 => {
188
251
  };
189
252
 
190
253
  (0, _element.useEffect)(() => {
191
- if (inheritedOrientation === 'horizontal' && !width) {
254
+ if (isFlexLayout && selfStretch !== 'fill' && selfStretch !== 'fit' && !flexSize) {
255
+ if (inheritedOrientation === 'horizontal') {
256
+ // If spacer is moving from a vertical container to a horizontal container,
257
+ // it might not have width but have height instead.
258
+ const newSize = (0, _blockEditor.getCustomValueFromPreset)(width, spacingSizes) || (0, _blockEditor.getCustomValueFromPreset)(height, spacingSizes) || '100px';
259
+ setAttributes({
260
+ width: '0px',
261
+ style: { ...blockStyle,
262
+ layout: { ...layout,
263
+ flexSize: newSize,
264
+ selfStretch: 'fixed'
265
+ }
266
+ }
267
+ });
268
+ } else {
269
+ const newSize = (0, _blockEditor.getCustomValueFromPreset)(height, spacingSizes) || (0, _blockEditor.getCustomValueFromPreset)(width, spacingSizes) || '100px';
270
+ setAttributes({
271
+ height: '0px',
272
+ style: { ...blockStyle,
273
+ layout: { ...layout,
274
+ flexSize: newSize,
275
+ selfStretch: 'fixed'
276
+ }
277
+ }
278
+ });
279
+ }
280
+ } else if (isFlexLayout && (selfStretch === 'fill' || selfStretch === 'fit')) {
281
+ if (inheritedOrientation === 'horizontal') {
282
+ setAttributes({
283
+ width: undefined
284
+ });
285
+ } else {
286
+ setAttributes({
287
+ height: undefined
288
+ });
289
+ }
290
+ } else if (!isFlexLayout && (selfStretch || flexSize)) {
291
+ if (inheritedOrientation === 'horizontal') {
292
+ setAttributes({
293
+ width: flexSize
294
+ });
295
+ } else {
296
+ setAttributes({
297
+ height: flexSize
298
+ });
299
+ }
300
+
192
301
  setAttributes({
193
- height: '0px',
194
- width: '72px'
302
+ style: { ...blockStyle,
303
+ layout: { ...layout,
304
+ flexSize: undefined,
305
+ selfStretch: undefined
306
+ }
307
+ }
195
308
  });
196
309
  }
197
- }, []);
310
+ }, [blockStyle, flexSize, height, inheritedOrientation, isFlexLayout, layout, selfStretch, setAttributes, spacingSizes, width]);
198
311
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_primitives.View, (0, _blockEditor.useBlockProps)({
199
- style
200
- }), resizableBoxWithOrientation(inheritedOrientation)), (0, _element.createElement)(_controls.default, {
312
+ style,
313
+ className: (0, _classnames.default)(className, {
314
+ 'custom-sizes-disabled': disableCustomSpacingSizes
315
+ })
316
+ }), resizableBoxWithOrientation(inheritedOrientation)), !isFlexLayout && (0, _element.createElement)(_controls.default, {
201
317
  setAttributes: setAttributes,
202
318
  height: temporaryHeight || height,
203
319
  width: temporaryWidth || width,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/spacer/edit.js"],"names":["ResizableSpacer","orientation","onResizeStart","onResize","onResizeStop","isSelected","isResizing","setIsResizing","props","getCurrentSize","elt","clientWidth","clientHeight","getNextVal","_event","_direction","nextVal","axis","position","isVisible","SpacerEdit","attributes","setAttributes","toggleSelection","context","__unstableParentLayout","parentLayout","parentOrientation","type","inheritedOrientation","height","width","temporaryHeight","setTemporaryHeight","temporaryWidth","setTemporaryWidth","handleOnVerticalResizeStop","newHeight","handleOnHorizontalResizeStop","newWidth","style","undefined","minWidth","resizableBoxWithOrientation","blockOrientation","MIN_SPACER_SIZE","top","right","bottom","left","topRight","bottomRight","bottomLeft","topLeft"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AAKA;;AACA;;AAEA;;AAKA;;AACA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAIA,MAAMA,eAAe,GAAG,QASjB;AAAA,MATmB;AACzBC,IAAAA,WADyB;AAEzBC,IAAAA,aAFyB;AAGzBC,IAAAA,QAHyB;AAIzBC,IAAAA,YAJyB;AAKzBC,IAAAA,UALyB;AAMzBC,IAAAA,UANyB;AAOzBC,IAAAA,aAPyB;AAQzB,OAAGC;AARsB,GASnB;;AACN,QAAMC,cAAc,GAAKC,GAAF,IAAW;AACjC,WAAOT,WAAW,KAAK,YAAhB,GACJS,GAAG,CAACC,WADA,GAEJD,GAAG,CAACE,Y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A;AAIRC,QAAAA,IAAI,EAAE,KAJE;AAKRC,QAAAA,QAAQ,EAAE,KALF;AAMRC,QAAAA,WAAW,EAAE,KANL;AAORC,QAAAA,UAAU,EAAE,KAPJ;AAQRC,QAAAA,OAAO,EAAE;AARD,OAFV;AAYC,MAAA,WAAW,EAAGT,gBAZf;AAaC,MAAA,aAAa,EAAG1C,aAbjB;AAcC,MAAA,QAAQ,EAAG+B,kBAdZ;AAeC,MAAA,YAAY,EAAGG,0BAfhB;AAgBC,MAAA,UAAU,EAAG/B,UAhBd;AAiBC,MAAA,UAAU,EAAGC,UAjBd;AAkBC,MAAA,aAAa,EAAGC;AAlBjB,MADD,CADD;AAwBA,GAlDD;;AAoDA,0BAAW,MAAM;AAChB,QAAKsB,oBAAoB,KAAK,YAAzB,IAAyC,CAAEE,KAAhD,EAAwD;AACvDT,MAAAA,aAAa,CAAE;AACdQ,QAAAA,MAAM,EAAE,KADM;AAEdC,QAAAA,KAAK,EAAE;AAFO,OAAF,CAAb;AAIA;AACD,GAPD,EAOG,EAPH;AASA,SACC,qDACC,4BAAC,gBAAD,EAAW,gCAAe;AAAES,IAAAA;AAAF,GAAf,CAAX,EACGG,2BAA2B,CAAEd,oBAAF,CAD9B,CADD,EAIC,4BAAC,iBAAD;AACC,IAAA,aAAa,EAAGP,aADjB;AAEC,IAAA,MAAM,EAAGU,eAAe,IAAIF,MAF7B;AAGC,IAAA,KAAK,EAAGI,cAAc,IAAIH,KAH3B;AAIC,IAAA,WAAW,EAAGF,oBAJf;AAKC,IAAA,UAAU,EAAGvB;AALd,IAJD,CADD;AAcA,CAjID;;eAmIec,U","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { ResizableBox } from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\nimport { View } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport SpacerControls from './controls';\nimport { MIN_SPACER_SIZE } from './constants';\n\nconst ResizableSpacer = ( {\n\torientation,\n\tonResizeStart,\n\tonResize,\n\tonResizeStop,\n\tisSelected,\n\tisResizing,\n\tsetIsResizing,\n\t...props\n} ) => {\n\tconst getCurrentSize = ( elt ) => {\n\t\treturn orientation === 'horizontal'\n\t\t\t? elt.clientWidth\n\t\t\t: elt.clientHeight;\n\t};\n\n\tconst getNextVal = ( elt ) => {\n\t\treturn `${ getCurrentSize( elt ) }px`;\n\t};\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tclassName={ classnames( 'block-library-spacer__resize-container', {\n\t\t\t\t'resize-horizontal': orientation === 'horizontal',\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t\t'is-selected': isSelected,\n\t\t\t} ) }\n\t\t\tonResizeStart={ ( _event, _direction, elt ) => {\n\t\t\t\tconst nextVal = getNextVal( elt );\n\t\t\t\tonResizeStart( nextVal );\n\t\t\t\tonResize( nextVal );\n\t\t\t} }\n\t\t\tonResize={ ( _event, _direction, elt ) => {\n\t\t\t\tonResize( getNextVal( elt ) );\n\t\t\t\tif ( ! isResizing ) {\n\t\t\t\t\tsetIsResizing( true );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tonResizeStop={ ( _event, _direction, elt ) => {\n\t\t\t\tconst nextVal = getCurrentSize( elt );\n\t\t\t\tonResizeStop( `${ nextVal }px` );\n\t\t\t\tsetIsResizing( false );\n\t\t\t} }\n\t\t\t__experimentalShowTooltip={ true }\n\t\t\t__experimentalTooltipProps={ {\n\t\t\t\taxis: orientation === 'horizontal' ? 'x' : 'y',\n\t\t\t\tposition: 'corner',\n\t\t\t\tisVisible: isResizing,\n\t\t\t} }\n\t\t\tshowHandle={ isSelected }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n};\n\nconst SpacerEdit = ( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\ttoggleSelection,\n\tcontext,\n\t__unstableParentLayout: parentLayout,\n} ) => {\n\tconst { orientation } = context;\n\tconst { orientation: parentOrientation, type } = parentLayout || {};\n\t// If the spacer is inside a flex container, it should either inherit the orientation\n\t// of the parent or use the flex default orientation.\n\tconst inheritedOrientation =\n\t\t! parentOrientation && type === 'flex'\n\t\t\t? 'horizontal'\n\t\t\t: parentOrientation || orientation;\n\tconst { height, width } = attributes;\n\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst [ temporaryHeight, setTemporaryHeight ] = useState( null );\n\tconst [ temporaryWidth, setTemporaryWidth ] = useState( null );\n\n\tconst onResizeStart = () => toggleSelection( false );\n\tconst onResizeStop = () => toggleSelection( true );\n\n\tconst handleOnVerticalResizeStop = ( newHeight ) => {\n\t\tonResizeStop();\n\n\t\tsetAttributes( { height: newHeight } );\n\t\tsetTemporaryHeight( null );\n\t};\n\n\tconst handleOnHorizontalResizeStop = ( newWidth ) => {\n\t\tonResizeStop();\n\t\tsetAttributes( { width: newWidth } );\n\t\tsetTemporaryWidth( null );\n\t};\n\n\tconst style = {\n\t\theight:\n\t\t\tinheritedOrientation === 'horizontal'\n\t\t\t\t? 24\n\t\t\t\t: temporaryHeight || height || undefined,\n\t\twidth:\n\t\t\tinheritedOrientation === 'horizontal'\n\t\t\t\t? temporaryWidth || width || undefined\n\t\t\t\t: undefined,\n\t\t// In vertical flex containers, the spacer shrinks to nothing without a minimum width.\n\t\tminWidth:\n\t\t\tinheritedOrientation === 'vertical' && type === 'flex'\n\t\t\t\t? 48\n\t\t\t\t: undefined,\n\t};\n\n\tconst resizableBoxWithOrientation = ( blockOrientation ) => {\n\t\tif ( blockOrientation === 'horizontal' ) {\n\t\t\treturn (\n\t\t\t\t<ResizableSpacer\n\t\t\t\t\tminWidth={ MIN_SPACER_SIZE }\n\t\t\t\t\tenable={ {\n\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\tright: true,\n\t\t\t\t\t\tbottom: false,\n\t\t\t\t\t\tleft: false,\n\t\t\t\t\t\ttopRight: false,\n\t\t\t\t\t\tbottomRight: false,\n\t\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\t\ttopLeft: false,\n\t\t\t\t\t} }\n\t\t\t\t\torientation={ blockOrientation }\n\t\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\t\tonResize={ setTemporaryWidth }\n\t\t\t\t\tonResizeStop={ handleOnHorizontalResizeStop }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\tsetIsResizing={ setIsResizing }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ResizableSpacer\n\t\t\t\t\tminHeight={ MIN_SPACER_SIZE }\n\t\t\t\t\tenable={ {\n\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\tright: false,\n\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\tleft: false,\n\t\t\t\t\t\ttopRight: false,\n\t\t\t\t\t\tbottomRight: false,\n\t\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\t\ttopLeft: false,\n\t\t\t\t\t} }\n\t\t\t\t\torientation={ blockOrientation }\n\t\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\t\tonResize={ setTemporaryHeight }\n\t\t\t\t\tonResizeStop={ handleOnVerticalResizeStop }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\tsetIsResizing={ setIsResizing }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t};\n\n\tuseEffect( () => {\n\t\tif ( inheritedOrientation === 'horizontal' && ! width ) {\n\t\t\tsetAttributes( {\n\t\t\t\theight: '0px',\n\t\t\t\twidth: '72px',\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t<View { ...useBlockProps( { style } ) }>\n\t\t\t\t{ resizableBoxWithOrientation( inheritedOrientation ) }\n\t\t\t</View>\n\t\t\t<SpacerControls\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\theight={ temporaryHeight || height }\n\t\t\t\twidth={ temporaryWidth || width }\n\t\t\t\torientation={ inheritedOrientation }\n\t\t\t\tisResizing={ isResizing }\n\t\t\t/>\n\t\t</>\n\t);\n};\n\nexport default SpacerEdit;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/spacer/edit.js"],"names":["ResizableSpacer","orientation","onResizeStart","onResize","onResizeStop","isSelected","isResizing","setIsResizing","props","getCurrentSize","elt","clientWidth","clientHeight","getNextVal","_event","_direction","nextVal","axis","position","isVisible","SpacerEdit","attributes","setAttributes","toggleSelection","context","__unstableParentLayout","parentLayout","className","disableCustomSpacingSizes","select","editorSettings","blockEditorStore","getSettings","parentOrientation","type","isFlexLayout","inheritedOrientation","height","width","style","blockStyle","layout","selfStretch","flexSize","spacingSizes","temporaryHeight","setTemporaryHeight","temporaryWidth","setTemporaryWidth","handleOnVerticalResizeStop","newHeight","handleOnHorizontalResizeStop","newWidth","getHeightForVerticalBlocks","undefined","getWidthForHorizontalBlocks","sizeConditionalOnOrientation","minWidth","flexBasis","flexGrow","resizableBoxWithOrientation","blockOrientation","MIN_SPACER_SIZE","top","right","bottom","left","topRight","bottomRight","bottomLeft","topLeft","newSize"],"mappings":";;;;;;;;;AAgBA;;;;AAbA;;AAKA;;AAOA;;AAEA;;AACA;;AAKA;;AACA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AAIA,MAAMA,eAAe,GAAG,QASjB;AAAA,MATmB;AACzBC,IAAAA,WADyB;AAEzBC,IAAAA,aAFyB;AAGzBC,IAAAA,QAHyB;AAIzBC,IAAAA,YAJyB;AAKzBC,IAAAA,UALyB;AAMzBC,IAAAA,UANyB;AAOzBC,IAAAA,aAPyB;AAQzB,OAAGC;AARsB,GASnB;;AACN,QAAMC,cAAc,GAAKC,GAAF,IAAW;AACjC,WAAOT,WAAW,KAAK,YAAhB,GACJS,GAAG,CAACC,WADA,GAEJD,GAAG,CAACE,YAFP;AAGA,GAJD;;AAMA,QAAMC,UAAU,GAAKH,GAAF,I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ANE,EAOFC,WAPE,EAQFpB,aARE,EASFsB,YATE,EAUFN,KAVE,CA5EH;AAyFA,SACC,qDACC,4BAAC,gBAAD,EACM,gCAAe;AACnBC,IAAAA,KADmB;AAEnBZ,IAAAA,SAAS,EAAE,yBAAYA,SAAZ,EAAuB;AACjC,+BAAyBC;AADQ,KAAvB;AAFQ,GAAf,CADN,EAQGgC,2BAA2B,CAAExB,oBAAF,CAR9B,CADD,EAWG,CAAED,YAAF,IACD,4BAAC,iBAAD;AACC,IAAA,aAAa,EAAGb,aADjB;AAEC,IAAA,MAAM,EAAGuB,eAAe,IAAIR,MAF7B;AAGC,IAAA,KAAK,EAAGU,cAAc,IAAIT,KAH3B;AAIC,IAAA,WAAW,EAAGF,oBAJf;AAKC,IAAA,UAAU,EAAG9B;AALd,IAZF,CADD;AAuBA,CAxRD;;eA0Rec,U","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tuseSetting,\n\tgetCustomValueFromPreset,\n\tgetSpacingPresetCssVar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ResizableBox } from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\nimport { View } from '@wordpress/primitives';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport SpacerControls from './controls';\nimport { MIN_SPACER_SIZE } from './constants';\n\nconst ResizableSpacer = ( {\n\torientation,\n\tonResizeStart,\n\tonResize,\n\tonResizeStop,\n\tisSelected,\n\tisResizing,\n\tsetIsResizing,\n\t...props\n} ) => {\n\tconst getCurrentSize = ( elt ) => {\n\t\treturn orientation === 'horizontal'\n\t\t\t? elt.clientWidth\n\t\t\t: elt.clientHeight;\n\t};\n\n\tconst getNextVal = ( elt ) => {\n\t\treturn `${ getCurrentSize( elt ) }px`;\n\t};\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tclassName={ classnames( 'block-library-spacer__resize-container', {\n\t\t\t\t'resize-horizontal': orientation === 'horizontal',\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t\t'is-selected': isSelected,\n\t\t\t} ) }\n\t\t\tonResizeStart={ ( _event, _direction, elt ) => {\n\t\t\t\tconst nextVal = getNextVal( elt );\n\t\t\t\tonResizeStart( nextVal );\n\t\t\t\tonResize( nextVal );\n\t\t\t} }\n\t\t\tonResize={ ( _event, _direction, elt ) => {\n\t\t\t\tonResize( getNextVal( elt ) );\n\t\t\t\tif ( ! isResizing ) {\n\t\t\t\t\tsetIsResizing( true );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tonResizeStop={ ( _event, _direction, elt ) => {\n\t\t\t\tconst nextVal = getCurrentSize( elt );\n\t\t\t\tonResizeStop( `${ nextVal }px` );\n\t\t\t\tsetIsResizing( false );\n\t\t\t} }\n\t\t\t__experimentalShowTooltip={ true }\n\t\t\t__experimentalTooltipProps={ {\n\t\t\t\taxis: orientation === 'horizontal' ? 'x' : 'y',\n\t\t\t\tposition: 'corner',\n\t\t\t\tisVisible: isResizing,\n\t\t\t} }\n\t\t\tshowHandle={ isSelected }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n};\n\nconst SpacerEdit = ( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\ttoggleSelection,\n\tcontext,\n\t__unstableParentLayout: parentLayout,\n\tclassName,\n} ) => {\n\tconst disableCustomSpacingSizes = useSelect( ( select ) => {\n\t\tconst editorSettings = select( blockEditorStore ).getSettings();\n\t\treturn editorSettings?.disableCustomSpacingSizes;\n\t} );\n\tconst { orientation } = context;\n\tconst { orientation: parentOrientation, type } = parentLayout || {};\n\t// Check if the spacer is inside a flex container.\n\tconst isFlexLayout = type === 'flex';\n\t// If the spacer is inside a flex container, it should either inherit the orientation\n\t// of the parent or use the flex default orientation.\n\tconst inheritedOrientation =\n\t\t! parentOrientation && isFlexLayout\n\t\t\t? 'horizontal'\n\t\t\t: parentOrientation || orientation;\n\tconst { height, width, style: blockStyle = {} } = attributes;\n\n\tconst { layout = {} } = blockStyle;\n\tconst { selfStretch, flexSize } = layout;\n\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst [ temporaryHeight, setTemporaryHeight ] = useState( null );\n\tconst [ temporaryWidth, setTemporaryWidth ] = useState( null );\n\n\tconst onResizeStart = () => toggleSelection( false );\n\tconst onResizeStop = () => toggleSelection( true );\n\n\tconst handleOnVerticalResizeStop = ( newHeight ) => {\n\t\tonResizeStop();\n\n\t\tif ( isFlexLayout ) {\n\t\t\tsetAttributes( {\n\t\t\t\tstyle: {\n\t\t\t\t\t...blockStyle,\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...layout,\n\t\t\t\t\t\tflexSize: newHeight,\n\t\t\t\t\t\tselfStretch: 'fixed',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tsetAttributes( { height: newHeight } );\n\t\tsetTemporaryHeight( null );\n\t};\n\n\tconst handleOnHorizontalResizeStop = ( newWidth ) => {\n\t\tonResizeStop();\n\n\t\tif ( isFlexLayout ) {\n\t\t\tsetAttributes( {\n\t\t\t\tstyle: {\n\t\t\t\t\t...blockStyle,\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...layout,\n\t\t\t\t\t\tflexSize: newWidth,\n\t\t\t\t\t\tselfStretch: 'fixed',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\n\t\tsetAttributes( { width: newWidth } );\n\t\tsetTemporaryWidth( null );\n\t};\n\n\tconst getHeightForVerticalBlocks = () => {\n\t\tif ( isFlexLayout ) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn temporaryHeight || getSpacingPresetCssVar( height ) || undefined;\n\t};\n\n\tconst getWidthForHorizontalBlocks = () => {\n\t\tif ( isFlexLayout ) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn temporaryWidth || getSpacingPresetCssVar( width ) || undefined;\n\t};\n\n\tconst sizeConditionalOnOrientation =\n\t\tinheritedOrientation === 'horizontal'\n\t\t\t? temporaryWidth || flexSize\n\t\t\t: temporaryHeight || flexSize;\n\n\tconst style = {\n\t\theight:\n\t\t\tinheritedOrientation === 'horizontal'\n\t\t\t\t? 24\n\t\t\t\t: getHeightForVerticalBlocks(),\n\t\twidth:\n\t\t\tinheritedOrientation === 'horizontal'\n\t\t\t\t? getWidthForHorizontalBlocks()\n\t\t\t\t: undefined,\n\t\t// In vertical flex containers, the spacer shrinks to nothing without a minimum width.\n\t\tminWidth:\n\t\t\tinheritedOrientation === 'vertical' && isFlexLayout\n\t\t\t\t? 48\n\t\t\t\t: undefined,\n\t\t// Add flex-basis so temporary sizes are respected.\n\t\tflexBasis: isFlexLayout ? sizeConditionalOnOrientation : undefined,\n\t\t// Remove flex-grow when resizing.\n\t\tflexGrow: isFlexLayout && isResizing ? 0 : undefined,\n\t};\n\n\tconst resizableBoxWithOrientation = ( blockOrientation ) => {\n\t\tif ( blockOrientation === 'horizontal' ) {\n\t\t\treturn (\n\t\t\t\t<ResizableSpacer\n\t\t\t\t\tminWidth={ MIN_SPACER_SIZE }\n\t\t\t\t\tenable={ {\n\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\tright: true,\n\t\t\t\t\t\tbottom: false,\n\t\t\t\t\t\tleft: false,\n\t\t\t\t\t\ttopRight: false,\n\t\t\t\t\t\tbottomRight: false,\n\t\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\t\ttopLeft: false,\n\t\t\t\t\t} }\n\t\t\t\t\torientation={ blockOrientation }\n\t\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\t\tonResize={ setTemporaryWidth }\n\t\t\t\t\tonResizeStop={ handleOnHorizontalResizeStop }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\tsetIsResizing={ setIsResizing }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ResizableSpacer\n\t\t\t\t\tminHeight={ MIN_SPACER_SIZE }\n\t\t\t\t\tenable={ {\n\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\tright: false,\n\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\tleft: false,\n\t\t\t\t\t\ttopRight: false,\n\t\t\t\t\t\tbottomRight: false,\n\t\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\t\ttopLeft: false,\n\t\t\t\t\t} }\n\t\t\t\t\torientation={ blockOrientation }\n\t\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\t\tonResize={ setTemporaryHeight }\n\t\t\t\t\tonResizeStop={ handleOnVerticalResizeStop }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\tsetIsResizing={ setIsResizing }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t};\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tisFlexLayout &&\n\t\t\tselfStretch !== 'fill' &&\n\t\t\tselfStretch !== 'fit' &&\n\t\t\t! flexSize\n\t\t) {\n\t\t\tif ( inheritedOrientation === 'horizontal' ) {\n\t\t\t\t// If spacer is moving from a vertical container to a horizontal container,\n\t\t\t\t// it might not have width but have height instead.\n\t\t\t\tconst newSize =\n\t\t\t\t\tgetCustomValueFromPreset( width, spacingSizes ) ||\n\t\t\t\t\tgetCustomValueFromPreset( height, spacingSizes ) ||\n\t\t\t\t\t'100px';\n\t\t\t\tsetAttributes( {\n\t\t\t\t\twidth: '0px',\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\t...blockStyle,\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\tflexSize: newSize,\n\t\t\t\t\t\t\tselfStretch: 'fixed',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tconst newSize =\n\t\t\t\t\tgetCustomValueFromPreset( height, spacingSizes ) ||\n\t\t\t\t\tgetCustomValueFromPreset( width, spacingSizes ) ||\n\t\t\t\t\t'100px';\n\t\t\t\tsetAttributes( {\n\t\t\t\t\theight: '0px',\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\t...blockStyle,\n\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\tflexSize: newSize,\n\t\t\t\t\t\t\tselfStretch: 'fixed',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t} else if (\n\t\t\tisFlexLayout &&\n\t\t\t( selfStretch === 'fill' || selfStretch === 'fit' )\n\t\t) {\n\t\t\tif ( inheritedOrientation === 'horizontal' ) {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\twidth: undefined,\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\theight: undefined,\n\t\t\t\t} );\n\t\t\t}\n\t\t} else if ( ! isFlexLayout && ( selfStretch || flexSize ) ) {\n\t\t\tif ( inheritedOrientation === 'horizontal' ) {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\twidth: flexSize,\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\theight: flexSize,\n\t\t\t\t} );\n\t\t\t}\n\t\t\tsetAttributes( {\n\t\t\t\tstyle: {\n\t\t\t\t\t...blockStyle,\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...layout,\n\t\t\t\t\t\tflexSize: undefined,\n\t\t\t\t\t\tselfStretch: undefined,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t}, [\n\t\tblockStyle,\n\t\tflexSize,\n\t\theight,\n\t\tinheritedOrientation,\n\t\tisFlexLayout,\n\t\tlayout,\n\t\tselfStretch,\n\t\tsetAttributes,\n\t\tspacingSizes,\n\t\twidth,\n\t] );\n\n\treturn (\n\t\t<>\n\t\t\t<View\n\t\t\t\t{ ...useBlockProps( {\n\t\t\t\t\tstyle,\n\t\t\t\t\tclassName: classnames( className, {\n\t\t\t\t\t\t'custom-sizes-disabled': disableCustomSpacingSizes,\n\t\t\t\t\t} ),\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t{ resizableBoxWithOrientation( inheritedOrientation ) }\n\t\t\t</View>\n\t\t\t{ ! isFlexLayout && (\n\t\t\t\t<SpacerControls\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\theight={ temporaryHeight || height }\n\t\t\t\t\twidth={ temporaryWidth || width }\n\t\t\t\t\torientation={ inheritedOrientation }\n\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport default SpacerEdit;\n"]}
@@ -21,8 +21,8 @@ function save(_ref) {
21
21
  } = _ref;
22
22
  return (0, _element.createElement)("div", _blockEditor.useBlockProps.save({
23
23
  style: {
24
- height,
25
- width
24
+ height: (0, _blockEditor.getSpacingPresetCssVar)(height),
25
+ width: (0, _blockEditor.getSpacingPresetCssVar)(width)
26
26
  },
27
27
  'aria-hidden': true
28
28
  }));
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/spacer/save.js"],"names":["save","attributes","height","width","useBlockProps","style"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,IAAT,OAAmD;AAAA,MAApC;AAAEC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV;AAAd,GAAoC;AACjE,SACC,mCACMC,2BAAcJ,IAAd,CAAoB;AACxBK,IAAAA,KAAK,EAAE;AACNH,MAAAA,MADM;AAENC,MAAAA;AAFM,KADiB;AAKxB,mBAAe;AALS,GAApB,CADN,CADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes: { height, width } } ) {\n\treturn (\n\t\t<div\n\t\t\t{ ...useBlockProps.save( {\n\t\t\t\tstyle: {\n\t\t\t\t\theight,\n\t\t\t\t\twidth,\n\t\t\t\t},\n\t\t\t\t'aria-hidden': true,\n\t\t\t} ) }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/spacer/save.js"],"names":["save","attributes","height","width","useBlockProps","style"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,IAAT,OAAmD;AAAA,MAApC;AAAEC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV;AAAd,GAAoC;AACjE,SACC,mCACMC,2BAAcJ,IAAd,CAAoB;AACxBK,IAAAA,KAAK,EAAE;AACNH,MAAAA,MAAM,EAAE,yCAAwBA,MAAxB,CADF;AAENC,MAAAA,KAAK,EAAE,yCAAwBA,KAAxB;AAFD,KADiB;AAKxB,mBAAe;AALS,GAApB,CADN,CADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useBlockProps, getSpacingPresetCssVar } from '@wordpress/block-editor';\n\nexport default function save( { attributes: { height, width } } ) {\n\treturn (\n\t\t<div\n\t\t\t{ ...useBlockProps.save( {\n\t\t\t\tstyle: {\n\t\t\t\t\theight: getSpacingPresetCssVar( height ),\n\t\t\t\t\twidth: getSpacingPresetCssVar( width ),\n\t\t\t\t},\n\t\t\t\t'aria-hidden': true,\n\t\t\t} ) }\n\t\t/>\n\t);\n}\n"]}
@@ -15,12 +15,6 @@ exports.isEmptyRow = isEmptyRow;
15
15
  exports.isEmptyTableSection = isEmptyTableSection;
16
16
  exports.toggleSection = toggleSection;
17
17
  exports.updateSelectedCell = updateSelectedCell;
18
-
19
- var _lodash = require("lodash");
20
-
21
- /**
22
- * External dependencies
23
- */
24
18
  const INHERITED_COLUMN_ATTRIBUTES = ['align'];
25
19
  /**
26
20
  * Creates a table state.
@@ -117,12 +111,14 @@ function updateSelectedCell(state, selection, updateCell) {
117
111
  sectionName: selectionSectionName,
118
112
  rowIndex: selectionRowIndex
119
113
  } = selection;
120
- return (0, _lodash.mapValues)(tableSections, (section, sectionName) => {
114
+ return Object.fromEntries(Object.entries(tableSections).map(_ref3 => {
115
+ let [sectionName, section] = _ref3;
116
+
121
117
  if (selectionSectionName && selectionSectionName !== sectionName) {
122
- return section;
118
+ return [sectionName, section];
123
119
  }
124
120
 
125
- return section.map((row, rowIndex) => {
121
+ return [sectionName, section.map((row, rowIndex) => {
126
122
  if (selectionRowIndex && selectionRowIndex !== rowIndex) {
127
123
  return row;
128
124
  }
@@ -142,8 +138,8 @@ function updateSelectedCell(state, selection, updateCell) {
142
138
  return updateCell(cellAttributes);
143
139
  })
144
140
  };
145
- });
146
- });
141
+ })];
142
+ }));
147
143
  }
148
144
  /**
149
145
  * Returns whether the cell at `cellLocation` is included in the selection `selection`.
@@ -181,14 +177,14 @@ function isCellSelected(cellLocation, selection) {
181
177
  */
182
178
 
183
179
 
184
- function insertRow(state, _ref3) {
180
+ function insertRow(state, _ref4) {
185
181
  var _firstRow$cells;
186
182
 
187
183
  let {
188
184
  sectionName,
189
185
  rowIndex,
190
186
  columnCount
191
- } = _ref3;
187
+ } = _ref4;
192
188
  const firstRow = getFirstRow(state);
193
189
  const cellCount = columnCount === undefined ? firstRow === null || firstRow === void 0 ? void 0 : (_firstRow$cells = firstRow.cells) === null || _firstRow$cells === void 0 ? void 0 : _firstRow$cells.length : columnCount; // Bail early if the function cannot determine how many cells to add.
194
190
 
@@ -204,8 +200,8 @@ function insertRow(state, _ref3) {
204
200
  var _firstRow$cells$index, _firstRow$cells2;
205
201
 
206
202
  const firstCellInColumn = (_firstRow$cells$index = firstRow === null || firstRow === void 0 ? void 0 : (_firstRow$cells2 = firstRow.cells) === null || _firstRow$cells2 === void 0 ? void 0 : _firstRow$cells2[index]) !== null && _firstRow$cells$index !== void 0 ? _firstRow$cells$index : {};
207
- const inheritedAttributes = Object.fromEntries(Object.entries(firstCellInColumn).filter(_ref4 => {
208
- let [key] = _ref4;
203
+ const inheritedAttributes = Object.fromEntries(Object.entries(firstCellInColumn).filter(_ref5 => {
204
+ let [key] = _ref5;
209
205
  return INHERITED_COLUMN_ATTRIBUTES.includes(key);
210
206
  }));
211
207
  return { ...inheritedAttributes,
@@ -228,11 +224,11 @@ function insertRow(state, _ref3) {
228
224
  */
229
225
 
230
226
 
231
- function deleteRow(state, _ref5) {
227
+ function deleteRow(state, _ref6) {
232
228
  let {
233
229
  sectionName,
234
230
  rowIndex
235
- } = _ref5;
231
+ } = _ref6;
236
232
  return {
237
233
  [sectionName]: state[sectionName].filter((row, index) => index !== rowIndex)
238
234
  };
@@ -248,21 +244,23 @@ function deleteRow(state, _ref5) {
248
244
  */
249
245
 
250
246
 
251
- function insertColumn(state, _ref6) {
247
+ function insertColumn(state, _ref7) {
252
248
  let {
253
249
  columnIndex
254
- } = _ref6;
255
- const tableSections = Object.fromEntries(Object.entries(state).filter(_ref7 => {
256
- let [key] = _ref7;
250
+ } = _ref7;
251
+ const tableSections = Object.fromEntries(Object.entries(state).filter(_ref8 => {
252
+ let [key] = _ref8;
257
253
  return ['head', 'body', 'foot'].includes(key);
258
254
  }));
259
- return (0, _lodash.mapValues)(tableSections, (section, sectionName) => {
255
+ return Object.fromEntries(Object.entries(tableSections).map(_ref9 => {
256
+ let [sectionName, section] = _ref9;
257
+
260
258
  // Bail early if the table section is empty.
261
259
  if (isEmptyTableSection(section)) {
262
- return section;
260
+ return [sectionName, section];
263
261
  }
264
262
 
265
- return section.map(row => {
263
+ return [sectionName, section.map(row => {
266
264
  // Bail early if the row is empty or it's an attempt to insert past
267
265
  // the last possible index of the array.
268
266
  if (isEmptyRow(row) || row.cells.length < columnIndex) {
@@ -275,8 +273,8 @@ function insertColumn(state, _ref6) {
275
273
  tag: sectionName === 'head' ? 'th' : 'td'
276
274
  }, ...row.cells.slice(columnIndex)]
277
275
  };
278
- });
279
- });
276
+ })];
277
+ }));
280
278
  }
281
279
  /**
282
280
  * Deletes a column from the table state.
@@ -289,24 +287,26 @@ function insertColumn(state, _ref6) {
289
287
  */
290
288
 
291
289
 
292
- function deleteColumn(state, _ref8) {
290
+ function deleteColumn(state, _ref10) {
293
291
  let {
294
292
  columnIndex
295
- } = _ref8;
296
- const tableSections = Object.fromEntries(Object.entries(state).filter(_ref9 => {
297
- let [key] = _ref9;
293
+ } = _ref10;
294
+ const tableSections = Object.fromEntries(Object.entries(state).filter(_ref11 => {
295
+ let [key] = _ref11;
298
296
  return ['head', 'body', 'foot'].includes(key);
299
297
  }));
300
- return (0, _lodash.mapValues)(tableSections, section => {
298
+ return Object.fromEntries(Object.entries(tableSections).map(_ref12 => {
299
+ let [sectionName, section] = _ref12;
300
+
301
301
  // Bail early if the table section is empty.
302
302
  if (isEmptyTableSection(section)) {
303
- return section;
303
+ return [sectionName, section];
304
304
  }
305
305
 
306
- return section.map(row => ({
306
+ return [sectionName, section.map(row => ({
307
307
  cells: row.cells.length >= columnIndex ? row.cells.filter((cell, index) => index !== columnIndex) : row.cells
308
- })).filter(row => row.cells.length);
309
- });
308
+ })).filter(row => row.cells.length)];
309
+ }));
310
310
  }
311
311
  /**
312
312
  * Toggles the existence of a section.