@wordpress/block-library 8.20.1 → 8.21.1-next.f8d8eceb.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 (412) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +12 -0
  3. package/build/avatar/index.js +5 -1
  4. package/build/avatar/index.js.map +1 -1
  5. package/build/block/edit-title.native.js +11 -3
  6. package/build/block/edit-title.native.js.map +1 -1
  7. package/build/block/index.js +2 -1
  8. package/build/block/index.js.map +1 -1
  9. package/build/code/edit.native.js +8 -2
  10. package/build/code/edit.native.js.map +1 -1
  11. package/build/column/edit.js +2 -1
  12. package/build/column/edit.js.map +1 -1
  13. package/build/column/edit.native.js +2 -1
  14. package/build/column/edit.native.js.map +1 -1
  15. package/build/columns/edit.native.js +2 -1
  16. package/build/columns/edit.native.js.map +1 -1
  17. package/build/cover/controls.native.js +2 -1
  18. package/build/cover/controls.native.js.map +1 -1
  19. package/build/cover/deprecated.js +110 -1
  20. package/build/cover/deprecated.js.map +1 -1
  21. package/build/cover/edit/index.js +11 -4
  22. package/build/cover/edit/index.js.map +1 -1
  23. package/build/cover/edit/inspector-controls.js +3 -3
  24. package/build/cover/edit/inspector-controls.js.map +1 -1
  25. package/build/cover/index.js +0 -3
  26. package/build/cover/index.js.map +1 -1
  27. package/build/cover/save.js +2 -1
  28. package/build/cover/save.js.map +1 -1
  29. package/build/cover/shared.js +1 -1
  30. package/build/cover/shared.js.map +1 -1
  31. package/build/file/view.js +1 -1
  32. package/build/file/view.js.map +1 -1
  33. package/build/footnotes/index.js +1 -0
  34. package/build/footnotes/index.js.map +1 -1
  35. package/build/form/edit.js +138 -0
  36. package/build/form/edit.js.map +1 -0
  37. package/build/form/index.js +92 -0
  38. package/build/form/index.js.map +1 -0
  39. package/build/form/init.js +13 -0
  40. package/build/form/init.js.map +1 -0
  41. package/build/form/save.js +28 -0
  42. package/build/form/save.js.map +1 -0
  43. package/build/form/utils.js +24 -0
  44. package/build/form/utils.js.map +1 -0
  45. package/build/form/variations.js +95 -0
  46. package/build/form/variations.js.map +1 -0
  47. package/build/form/view.js +42 -0
  48. package/build/form/view.js.map +1 -0
  49. package/build/form-input/edit.js +124 -0
  50. package/build/form-input/edit.js.map +1 -0
  51. package/build/form-input/index.js +105 -0
  52. package/build/form-input/index.js.map +1 -0
  53. package/build/form-input/init.js +13 -0
  54. package/build/form-input/init.js.map +1 -0
  55. package/build/form-input/save.js +87 -0
  56. package/build/form-input/save.js.map +1 -0
  57. package/build/form-input/variations.js +93 -0
  58. package/build/form-input/variations.js.map +1 -0
  59. package/build/form-submission-notification/edit.js +59 -0
  60. package/build/form-submission-notification/edit.js.map +1 -0
  61. package/build/form-submission-notification/index.js +56 -0
  62. package/build/form-submission-notification/index.js.map +1 -0
  63. package/build/form-submission-notification/init.js +13 -0
  64. package/build/form-submission-notification/init.js.map +1 -0
  65. package/build/form-submission-notification/save.js +33 -0
  66. package/build/form-submission-notification/save.js.map +1 -0
  67. package/build/form-submission-notification/variations.js +63 -0
  68. package/build/form-submission-notification/variations.js.map +1 -0
  69. package/build/form-submit-button/edit.js +32 -0
  70. package/build/form-submit-button/edit.js.map +1 -0
  71. package/build/form-submit-button/index.js +44 -0
  72. package/build/form-submit-button/index.js.map +1 -0
  73. package/build/form-submit-button/init.js +13 -0
  74. package/build/form-submit-button/init.js.map +1 -0
  75. package/build/form-submit-button/save.js +22 -0
  76. package/build/form-submit-button/save.js.map +1 -0
  77. package/build/group/edit.js +2 -11
  78. package/build/group/edit.js.map +1 -1
  79. package/build/group/index.js +0 -1
  80. package/build/group/index.js.map +1 -1
  81. package/build/heading/index.js +3 -2
  82. package/build/heading/index.js.map +1 -1
  83. package/build/html/preview.js +2 -4
  84. package/build/html/preview.js.map +1 -1
  85. package/build/image/image.js +15 -6
  86. package/build/image/image.js.map +1 -1
  87. package/build/image/view.js +71 -39
  88. package/build/image/view.js.map +1 -1
  89. package/build/index.js +10 -0
  90. package/build/index.js.map +1 -1
  91. package/build/latest-posts/edit.js +6 -2
  92. package/build/latest-posts/edit.js.map +1 -1
  93. package/build/list-item/hooks/use-merge.js +15 -15
  94. package/build/list-item/hooks/use-merge.js.map +1 -1
  95. package/build/lock-unlock.js +1 -1
  96. package/build/lock-unlock.js.map +1 -1
  97. package/build/missing/edit.native.js +54 -64
  98. package/build/missing/edit.native.js.map +1 -1
  99. package/build/navigation/edit/index.js +0 -1
  100. package/build/navigation/edit/index.js.map +1 -1
  101. package/build/navigation/index.js +2 -1
  102. package/build/navigation/index.js.map +1 -1
  103. package/build/navigation/view.js +27 -5
  104. package/build/navigation/view.js.map +1 -1
  105. package/build/page-list-item/edit.js +3 -1
  106. package/build/page-list-item/edit.js.map +1 -1
  107. package/build/paragraph/edit.js +1 -1
  108. package/build/paragraph/edit.js.map +1 -1
  109. package/build/paragraph/index.js +7 -0
  110. package/build/paragraph/index.js.map +1 -1
  111. package/build/pattern/index.js +2 -1
  112. package/build/pattern/index.js.map +1 -1
  113. package/build/post-featured-image/dimension-controls.js +2 -2
  114. package/build/post-featured-image/dimension-controls.js.map +1 -1
  115. package/build/query/edit/enhanced-pagination-modal.js +27 -13
  116. package/build/query/edit/enhanced-pagination-modal.js.map +1 -1
  117. package/build/query/edit/inspector-controls/enhanced-pagination-control.js +15 -12
  118. package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  119. package/build/query/utils.js +29 -8
  120. package/build/query/utils.js.map +1 -1
  121. package/build/query/view.js +4 -2
  122. package/build/query/view.js.map +1 -1
  123. package/build/search/edit.js +1 -2
  124. package/build/search/edit.js.map +1 -1
  125. package/build/social-link/edit.native.js +7 -19
  126. package/build/social-link/edit.native.js.map +1 -1
  127. package/build/spacer/controls.js +3 -3
  128. package/build/spacer/controls.js.map +1 -1
  129. package/build/spacer/controls.native.js +2 -1
  130. package/build/spacer/controls.native.js.map +1 -1
  131. package/build/spacer/edit.js +1 -1
  132. package/build/spacer/edit.js.map +1 -1
  133. package/build/spacer/edit.native.js +5 -1
  134. package/build/spacer/edit.native.js.map +1 -1
  135. package/build/tag-cloud/edit.js +2 -1
  136. package/build/tag-cloud/edit.js.map +1 -1
  137. package/build/template-part/edit/inner-blocks.js +2 -2
  138. package/build/template-part/edit/inner-blocks.js.map +1 -1
  139. package/build/template-part/index.js +2 -1
  140. package/build/template-part/index.js.map +1 -1
  141. package/build/term-description/index.js +0 -1
  142. package/build/term-description/index.js.map +1 -1
  143. package/build-module/avatar/index.js +5 -1
  144. package/build-module/avatar/index.js.map +1 -1
  145. package/build-module/block/edit-title.native.js +12 -4
  146. package/build-module/block/edit-title.native.js.map +1 -1
  147. package/build-module/block/index.js +2 -1
  148. package/build-module/block/index.js.map +1 -1
  149. package/build-module/code/edit.native.js +8 -2
  150. package/build-module/code/edit.native.js.map +1 -1
  151. package/build-module/column/edit.js +3 -2
  152. package/build-module/column/edit.js.map +1 -1
  153. package/build-module/column/edit.native.js +3 -2
  154. package/build-module/column/edit.native.js.map +1 -1
  155. package/build-module/columns/edit.native.js +3 -2
  156. package/build-module/columns/edit.native.js.map +1 -1
  157. package/build-module/cover/controls.native.js +3 -2
  158. package/build-module/cover/controls.native.js.map +1 -1
  159. package/build-module/cover/deprecated.js +110 -1
  160. package/build-module/cover/deprecated.js.map +1 -1
  161. package/build-module/cover/edit/index.js +12 -5
  162. package/build-module/cover/edit/index.js.map +1 -1
  163. package/build-module/cover/edit/inspector-controls.js +4 -4
  164. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  165. package/build-module/cover/index.js +0 -3
  166. package/build-module/cover/index.js.map +1 -1
  167. package/build-module/cover/save.js +2 -1
  168. package/build-module/cover/save.js.map +1 -1
  169. package/build-module/cover/shared.js +1 -1
  170. package/build-module/cover/shared.js.map +1 -1
  171. package/build-module/file/view.js +2 -2
  172. package/build-module/file/view.js.map +1 -1
  173. package/build-module/footnotes/index.js +1 -0
  174. package/build-module/footnotes/index.js.map +1 -1
  175. package/build-module/form/edit.js +130 -0
  176. package/build-module/form/edit.js.map +1 -0
  177. package/build-module/form/index.js +82 -0
  178. package/build-module/form/index.js.map +1 -0
  179. package/build-module/form/init.js +6 -0
  180. package/build-module/form/init.js.map +1 -0
  181. package/build-module/form/save.js +20 -0
  182. package/build-module/form/save.js.map +1 -0
  183. package/build-module/form/utils.js +15 -0
  184. package/build-module/form/utils.js.map +1 -0
  185. package/build-module/form/variations.js +86 -0
  186. package/build-module/form/variations.js.map +1 -0
  187. package/build-module/form/view.js +40 -0
  188. package/build-module/form/view.js.map +1 -0
  189. package/build-module/form-input/edit.js +115 -0
  190. package/build-module/form-input/edit.js.map +1 -0
  191. package/build-module/form-input/index.js +95 -0
  192. package/build-module/form-input/index.js.map +1 -0
  193. package/build-module/form-input/init.js +6 -0
  194. package/build-module/form-input/init.js.map +1 -0
  195. package/build-module/form-input/save.js +80 -0
  196. package/build-module/form-input/save.js.map +1 -0
  197. package/build-module/form-input/variations.js +85 -0
  198. package/build-module/form-input/variations.js.map +1 -0
  199. package/build-module/form-submission-notification/edit.js +50 -0
  200. package/build-module/form-submission-notification/edit.js.map +1 -0
  201. package/build-module/form-submission-notification/index.js +47 -0
  202. package/build-module/form-submission-notification/index.js.map +1 -0
  203. package/build-module/form-submission-notification/init.js +6 -0
  204. package/build-module/form-submission-notification/init.js.map +1 -0
  205. package/build-module/form-submission-notification/save.js +25 -0
  206. package/build-module/form-submission-notification/save.js.map +1 -0
  207. package/build-module/form-submission-notification/variations.js +55 -0
  208. package/build-module/form-submission-notification/variations.js.map +1 -0
  209. package/build-module/form-submit-button/edit.js +24 -0
  210. package/build-module/form-submit-button/edit.js.map +1 -0
  211. package/build-module/form-submit-button/index.js +34 -0
  212. package/build-module/form-submit-button/index.js.map +1 -0
  213. package/build-module/form-submit-button/init.js +6 -0
  214. package/build-module/form-submit-button/init.js.map +1 -0
  215. package/build-module/form-submit-button/save.js +14 -0
  216. package/build-module/form-submit-button/save.js.map +1 -0
  217. package/build-module/group/edit.js +3 -12
  218. package/build-module/group/edit.js.map +1 -1
  219. package/build-module/group/index.js +0 -1
  220. package/build-module/group/index.js.map +1 -1
  221. package/build-module/heading/index.js +3 -2
  222. package/build-module/heading/index.js.map +1 -1
  223. package/build-module/html/preview.js +2 -4
  224. package/build-module/html/preview.js.map +1 -1
  225. package/build-module/image/image.js +16 -7
  226. package/build-module/image/image.js.map +1 -1
  227. package/build-module/image/view.js +71 -39
  228. package/build-module/image/view.js.map +1 -1
  229. package/build-module/index.js +10 -0
  230. package/build-module/index.js.map +1 -1
  231. package/build-module/latest-posts/edit.js +6 -2
  232. package/build-module/latest-posts/edit.js.map +1 -1
  233. package/build-module/list-item/hooks/use-merge.js +15 -15
  234. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  235. package/build-module/lock-unlock.js +1 -1
  236. package/build-module/lock-unlock.js.map +1 -1
  237. package/build-module/missing/edit.native.js +58 -68
  238. package/build-module/missing/edit.native.js.map +1 -1
  239. package/build-module/navigation/edit/index.js +0 -1
  240. package/build-module/navigation/edit/index.js.map +1 -1
  241. package/build-module/navigation/index.js +2 -1
  242. package/build-module/navigation/index.js.map +1 -1
  243. package/build-module/navigation/view.js +27 -5
  244. package/build-module/navigation/view.js.map +1 -1
  245. package/build-module/page-list-item/edit.js +3 -1
  246. package/build-module/page-list-item/edit.js.map +1 -1
  247. package/build-module/paragraph/edit.js +2 -2
  248. package/build-module/paragraph/edit.js.map +1 -1
  249. package/build-module/paragraph/index.js +7 -0
  250. package/build-module/paragraph/index.js.map +1 -1
  251. package/build-module/pattern/index.js +2 -1
  252. package/build-module/pattern/index.js.map +1 -1
  253. package/build-module/post-featured-image/dimension-controls.js +3 -3
  254. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  255. package/build-module/query/edit/enhanced-pagination-modal.js +28 -14
  256. package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
  257. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +17 -14
  258. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  259. package/build-module/query/utils.js +27 -5
  260. package/build-module/query/utils.js.map +1 -1
  261. package/build-module/query/view.js +4 -2
  262. package/build-module/query/view.js.map +1 -1
  263. package/build-module/search/edit.js +2 -3
  264. package/build-module/search/edit.js.map +1 -1
  265. package/build-module/social-link/edit.native.js +8 -20
  266. package/build-module/social-link/edit.native.js.map +1 -1
  267. package/build-module/spacer/controls.js +4 -4
  268. package/build-module/spacer/controls.js.map +1 -1
  269. package/build-module/spacer/controls.native.js +3 -2
  270. package/build-module/spacer/controls.native.js.map +1 -1
  271. package/build-module/spacer/edit.js +2 -2
  272. package/build-module/spacer/edit.js.map +1 -1
  273. package/build-module/spacer/edit.native.js +6 -2
  274. package/build-module/spacer/edit.native.js.map +1 -1
  275. package/build-module/tag-cloud/edit.js +3 -2
  276. package/build-module/tag-cloud/edit.js.map +1 -1
  277. package/build-module/template-part/edit/inner-blocks.js +3 -3
  278. package/build-module/template-part/edit/inner-blocks.js.map +1 -1
  279. package/build-module/template-part/index.js +2 -1
  280. package/build-module/template-part/index.js.map +1 -1
  281. package/build-module/term-description/index.js +0 -1
  282. package/build-module/term-description/index.js.map +1 -1
  283. package/build-style/editor-rtl.css +50 -0
  284. package/build-style/editor.css +50 -0
  285. package/build-style/file/style-rtl.css +0 -5
  286. package/build-style/file/style.css +0 -5
  287. package/build-style/form-input/editor-rtl.css +106 -0
  288. package/build-style/form-input/editor.css +106 -0
  289. package/build-style/form-input/style-rtl.css +135 -0
  290. package/build-style/form-input/style.css +135 -0
  291. package/build-style/form-submission-notification/editor-rtl.css +118 -0
  292. package/build-style/form-submission-notification/editor.css +118 -0
  293. package/build-style/form-submit-button/style-rtl.css +91 -0
  294. package/build-style/form-submit-button/style.css +91 -0
  295. package/build-style/image/style-rtl.css +39 -5
  296. package/build-style/image/style.css +39 -5
  297. package/build-style/navigation/style-rtl.css +5 -0
  298. package/build-style/navigation/style.css +5 -0
  299. package/build-style/query/style-rtl.css +0 -10
  300. package/build-style/query/style.css +0 -10
  301. package/build-style/style-rtl.css +92 -10
  302. package/build-style/style.css +92 -10
  303. package/package.json +32 -32
  304. package/src/avatar/block.json +5 -1
  305. package/src/block/block.json +2 -1
  306. package/src/block/edit-title.native.js +16 -13
  307. package/src/calendar/index.php +2 -6
  308. package/src/code/edit.native.js +15 -1
  309. package/src/column/edit.js +3 -8
  310. package/src/column/edit.native.js +3 -8
  311. package/src/columns/edit.native.js +3 -8
  312. package/src/comment-author-avatar/index.php +1 -1
  313. package/src/cover/block.json +0 -3
  314. package/src/cover/controls.native.js +3 -8
  315. package/src/cover/deprecated.js +151 -1
  316. package/src/cover/edit/index.js +15 -5
  317. package/src/cover/edit/inspector-controls.js +22 -33
  318. package/src/cover/save.js +2 -1
  319. package/src/cover/shared.js +1 -1
  320. package/src/editor.scss +2 -0
  321. package/src/file/index.php +2 -1
  322. package/src/file/style.scss +0 -6
  323. package/src/file/view.js +2 -2
  324. package/src/footnotes/block.json +1 -0
  325. package/src/form/block.json +60 -0
  326. package/src/form/edit.js +179 -0
  327. package/src/form/index.js +20 -0
  328. package/src/form/index.php +214 -0
  329. package/src/form/init.js +6 -0
  330. package/src/form/save.js +20 -0
  331. package/src/form/utils.js +39 -0
  332. package/src/form/variations.js +139 -0
  333. package/src/form/view.js +41 -0
  334. package/src/form-input/block.json +73 -0
  335. package/src/form-input/edit.js +151 -0
  336. package/src/form-input/editor.scss +24 -0
  337. package/src/form-input/index.js +20 -0
  338. package/src/form-input/index.php +45 -0
  339. package/src/form-input/init.js +6 -0
  340. package/src/form-input/save.js +83 -0
  341. package/src/form-input/style.scss +61 -0
  342. package/src/form-input/variations.js +82 -0
  343. package/src/form-submission-notification/block.json +19 -0
  344. package/src/form-submission-notification/edit.js +63 -0
  345. package/src/form-submission-notification/editor.scss +45 -0
  346. package/src/form-submission-notification/index.js +26 -0
  347. package/src/form-submission-notification/index.php +48 -0
  348. package/src/form-submission-notification/init.js +6 -0
  349. package/src/form-submission-notification/save.js +28 -0
  350. package/src/form-submission-notification/variations.js +59 -0
  351. package/src/form-submit-button/block.json +14 -0
  352. package/src/form-submit-button/edit.js +33 -0
  353. package/src/form-submit-button/index.js +18 -0
  354. package/src/form-submit-button/init.js +6 -0
  355. package/src/form-submit-button/save.js +14 -0
  356. package/src/form-submit-button/style.scss +3 -0
  357. package/src/freeform/test/__snapshots__/index.native.js.snap +7 -0
  358. package/src/freeform/test/index.native.js +57 -0
  359. package/src/group/block.json +0 -1
  360. package/src/group/edit.js +2 -7
  361. package/src/heading/index.js +4 -2
  362. package/src/html/preview.js +9 -4
  363. package/src/image/image.js +27 -6
  364. package/src/image/index.php +128 -83
  365. package/src/image/style.scss +49 -5
  366. package/src/image/view.js +93 -51
  367. package/src/index.js +10 -0
  368. package/src/latest-posts/edit.js +11 -2
  369. package/src/latest-posts/index.php +17 -8
  370. package/src/list-item/hooks/use-merge.js +20 -23
  371. package/src/lock-unlock.js +1 -1
  372. package/src/missing/edit.native.js +56 -117
  373. package/src/missing/style.native.scss +0 -67
  374. package/src/missing/test/edit-integration.native.js +135 -49
  375. package/src/missing/test/edit.native.js +0 -41
  376. package/src/navigation/block.json +2 -1
  377. package/src/navigation/edit/index.js +0 -1
  378. package/src/navigation/index.php +28 -8
  379. package/src/navigation/style.scss +6 -1
  380. package/src/navigation/view.js +25 -6
  381. package/src/page-list-item/edit.js +2 -0
  382. package/src/paragraph/edit.js +2 -2
  383. package/src/paragraph/index.js +10 -0
  384. package/src/pattern/block.json +2 -1
  385. package/src/pattern/index.php +0 -3
  386. package/src/post-featured-image/dimension-controls.js +3 -3
  387. package/src/post-navigation-link/index.php +2 -1
  388. package/src/preformatted/test/edit.native.js +38 -0
  389. package/src/query/edit/enhanced-pagination-modal.js +37 -21
  390. package/src/query/edit/inspector-controls/enhanced-pagination-control.js +18 -22
  391. package/src/query/index.php +100 -10
  392. package/src/query/style.scss +0 -11
  393. package/src/query/utils.js +29 -8
  394. package/src/query/view.js +11 -2
  395. package/src/query-pagination-next/index.php +1 -1
  396. package/src/query-pagination-previous/index.php +1 -1
  397. package/src/search/edit.js +5 -3
  398. package/src/search/index.php +0 -4
  399. package/src/social-link/edit.native.js +12 -26
  400. package/src/social-link/editor.native.scss +0 -9
  401. package/src/social-link/index.php +2 -2
  402. package/src/spacer/controls.js +9 -12
  403. package/src/spacer/controls.native.js +3 -8
  404. package/src/spacer/edit.js +2 -2
  405. package/src/spacer/edit.native.js +6 -5
  406. package/src/style.scss +1 -0
  407. package/src/tag-cloud/edit.js +3 -7
  408. package/src/template-part/block.json +2 -1
  409. package/src/template-part/edit/inner-blocks.js +3 -3
  410. package/src/template-part/index.php +4 -7
  411. package/src/term-description/block.json +0 -1
  412. package/src/verse/test/edit.native.js +37 -0
@@ -19,9 +19,6 @@
19
19
  },
20
20
  "alt": {
21
21
  "type": "string",
22
- "source": "attribute",
23
- "selector": "img",
24
- "attribute": "alt",
25
22
  "default": ""
26
23
  },
27
24
  "hasParallax": {
@@ -22,7 +22,7 @@ import {
22
22
  import { plus } from '@wordpress/icons';
23
23
  import { useState, useCallback, useRef } from '@wordpress/element';
24
24
  import { usePreferredColorSchemeStyle } from '@wordpress/compose';
25
- import { useSetting, MediaUpload } from '@wordpress/block-editor';
25
+ import { useSettings, MediaUpload } from '@wordpress/block-editor';
26
26
  import { __ } from '@wordpress/i18n';
27
27
 
28
28
  /**
@@ -68,14 +68,9 @@ function Controls( {
68
68
  [ minHeight ]
69
69
  );
70
70
 
71
+ const [ availableUnits ] = useSettings( 'spacing.units' );
71
72
  const units = useCustomUnits( {
72
- availableUnits: useSetting( 'spacing.units' ) || [
73
- 'px',
74
- 'em',
75
- 'rem',
76
- 'vw',
77
- 'vh',
78
- ],
73
+ availableUnits: availableUnits || [ 'px', 'em', 'rem', 'vw', 'vh' ],
79
74
  defaultValues: { px: 430, em: 20, rem: 20, vw: 20, vh: 50 },
80
75
  } );
81
76
 
@@ -244,6 +244,156 @@ const v12BlockSupports = {
244
244
  },
245
245
  };
246
246
 
247
+ // Deprecation for blocks that does not have the aria-label when the image background is fixed or repeated.
248
+ const v13 = {
249
+ attributes: v12BlockAttributes,
250
+ supports: v12BlockSupports,
251
+ save( { attributes } ) {
252
+ const {
253
+ backgroundType,
254
+ gradient,
255
+ contentPosition,
256
+ customGradient,
257
+ customOverlayColor,
258
+ dimRatio,
259
+ focalPoint,
260
+ useFeaturedImage,
261
+ hasParallax,
262
+ isDark,
263
+ isRepeated,
264
+ overlayColor,
265
+ url,
266
+ alt,
267
+ id,
268
+ minHeight: minHeightProp,
269
+ minHeightUnit,
270
+ tagName: Tag,
271
+ } = attributes;
272
+ const overlayColorClass = getColorClassName(
273
+ 'background-color',
274
+ overlayColor
275
+ );
276
+ const gradientClass = __experimentalGetGradientClass( gradient );
277
+ const minHeight =
278
+ minHeightProp && minHeightUnit
279
+ ? `${ minHeightProp }${ minHeightUnit }`
280
+ : minHeightProp;
281
+
282
+ const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
283
+ const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
284
+
285
+ const isImgElement = ! ( hasParallax || isRepeated );
286
+
287
+ const style = {
288
+ minHeight: minHeight || undefined,
289
+ };
290
+
291
+ const bgStyle = {
292
+ backgroundColor: ! overlayColorClass
293
+ ? customOverlayColor
294
+ : undefined,
295
+ background: customGradient ? customGradient : undefined,
296
+ };
297
+
298
+ const objectPosition =
299
+ // prettier-ignore
300
+ focalPoint && isImgElement
301
+ ? mediaPosition(focalPoint)
302
+ : undefined;
303
+
304
+ const backgroundImage = url ? `url(${ url })` : undefined;
305
+
306
+ const backgroundPosition = mediaPosition( focalPoint );
307
+
308
+ const classes = classnames(
309
+ {
310
+ 'is-light': ! isDark,
311
+ 'has-parallax': hasParallax,
312
+ 'is-repeated': isRepeated,
313
+ 'has-custom-content-position':
314
+ ! isContentPositionCenter( contentPosition ),
315
+ },
316
+ getPositionClassName( contentPosition )
317
+ );
318
+
319
+ const imgClasses = classnames(
320
+ 'wp-block-cover__image-background',
321
+ id ? `wp-image-${ id }` : null,
322
+ {
323
+ 'has-parallax': hasParallax,
324
+ 'is-repeated': isRepeated,
325
+ }
326
+ );
327
+
328
+ const gradientValue = gradient || customGradient;
329
+
330
+ return (
331
+ <Tag { ...useBlockProps.save( { className: classes, style } ) }>
332
+ <span
333
+ aria-hidden="true"
334
+ className={ classnames(
335
+ 'wp-block-cover__background',
336
+ overlayColorClass,
337
+ dimRatioToClass( dimRatio ),
338
+ {
339
+ 'has-background-dim': dimRatio !== undefined,
340
+ // For backwards compatibility. Former versions of the Cover Block applied
341
+ // `.wp-block-cover__gradient-background` in the presence of
342
+ // media, a gradient and a dim.
343
+ 'wp-block-cover__gradient-background':
344
+ url && gradientValue && dimRatio !== 0,
345
+ 'has-background-gradient': gradientValue,
346
+ [ gradientClass ]: gradientClass,
347
+ }
348
+ ) }
349
+ style={ bgStyle }
350
+ />
351
+
352
+ { ! useFeaturedImage &&
353
+ isImageBackground &&
354
+ url &&
355
+ ( isImgElement ? (
356
+ <img
357
+ className={ imgClasses }
358
+ alt={ alt }
359
+ src={ url }
360
+ style={ { objectPosition } }
361
+ data-object-fit="cover"
362
+ data-object-position={ objectPosition }
363
+ />
364
+ ) : (
365
+ <div
366
+ role="img"
367
+ className={ imgClasses }
368
+ style={ { backgroundPosition, backgroundImage } }
369
+ />
370
+ ) ) }
371
+ { isVideoBackground && url && (
372
+ <video
373
+ className={ classnames(
374
+ 'wp-block-cover__video-background',
375
+ 'intrinsic-ignore'
376
+ ) }
377
+ autoPlay
378
+ muted
379
+ loop
380
+ playsInline
381
+ src={ url }
382
+ style={ { objectPosition } }
383
+ data-object-fit="cover"
384
+ data-object-position={ objectPosition }
385
+ />
386
+ ) }
387
+ <div
388
+ { ...useInnerBlocksProps.save( {
389
+ className: 'wp-block-cover__inner-container',
390
+ } ) }
391
+ />
392
+ </Tag>
393
+ );
394
+ },
395
+ };
396
+
247
397
  // Deprecation for blocks to prevent auto overlay color from overriding previously set values.
248
398
  const v12 = {
249
399
  attributes: v12BlockAttributes,
@@ -1673,4 +1823,4 @@ const v1 = {
1673
1823
  },
1674
1824
  };
1675
1825
 
1676
- export default [ v12, v11, v10, v9, v8, v7, v6, v5, v4, v3, v2, v1 ];
1826
+ export default [ v13, v12, v11, v10, v9, v8, v7, v6, v5, v4, v3, v2, v1 ];
@@ -14,7 +14,7 @@ import {
14
14
  withColors,
15
15
  ColorPalette,
16
16
  useBlockProps,
17
- useSetting,
17
+ useSettings,
18
18
  useInnerBlocksProps,
19
19
  __experimentalUseGradient,
20
20
  store as blockEditorStore,
@@ -166,9 +166,12 @@ function CoverEdit( {
166
166
 
167
167
  const onSelectMedia = async ( newMedia ) => {
168
168
  const mediaAttributes = attributesFromMedia( newMedia );
169
+ const isImage = [ newMedia?.type, newMedia?.media_type ].includes(
170
+ IMAGE_BACKGROUND_TYPE
171
+ );
169
172
 
170
173
  const averageBackgroundColor = await getMediaColor(
171
- newMedia?.type === IMAGE_BACKGROUND_TYPE ? newMedia?.url : undefined
174
+ isImage ? newMedia?.url : undefined
172
175
  );
173
176
 
174
177
  let newOverlayColor = overlayColor.color;
@@ -180,7 +183,12 @@ function CoverEdit( {
180
183
  __unstableMarkNextChangeAsNotPersistent();
181
184
  }
182
185
 
183
- const newDimRatio = dimRatio === 100 ? 50 : dimRatio;
186
+ // Only set a new dimRatio if there was no previous media selected
187
+ // to avoid resetting to 50 if it has been explicitly set to 100.
188
+ // See issue #52835 for context.
189
+ const newDimRatio =
190
+ originalUrl === undefined && dimRatio === 100 ? 50 : dimRatio;
191
+
184
192
  const newIsDark = compositeIsDark(
185
193
  newDimRatio,
186
194
  newOverlayColor,
@@ -310,7 +318,8 @@ function CoverEdit( {
310
318
  const blockProps = useBlockProps( { ref } );
311
319
 
312
320
  // Check for fontSize support before we pass a fontSize attribute to the innerBlocks.
313
- const hasFontSizes = !! useSetting( 'typography.fontSizes' )?.length;
321
+ const [ fontSizes ] = useSettings( 'typography.fontSizes' );
322
+ const hasFontSizes = fontSizes?.length > 0;
314
323
  const innerBlocksTemplate = getInnerBlocksTemplate( {
315
324
  fontSize: hasFontSizes ? 'large' : undefined,
316
325
  } );
@@ -531,7 +540,8 @@ function CoverEdit( {
531
540
  ) : (
532
541
  <div
533
542
  ref={ mediaElement }
534
- role="img"
543
+ role={ alt ? 'img' : undefined }
544
+ aria-label={ alt ? alt : undefined }
535
545
  className={ classnames(
536
546
  classes,
537
547
  'wp-block-cover__image-background'
@@ -20,7 +20,7 @@ import {
20
20
  import { useInstanceId } from '@wordpress/compose';
21
21
  import {
22
22
  InspectorControls,
23
- useSetting,
23
+ useSettings,
24
24
  __experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,
25
25
  __experimentalUseGradient,
26
26
  __experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,
@@ -42,14 +42,9 @@ function CoverHeightInput( {
42
42
  const inputId = `block-cover-height-input-${ instanceId }`;
43
43
  const isPx = unit === 'px';
44
44
 
45
+ const [ availableUnits ] = useSettings( 'spacing.units' );
45
46
  const units = useCustomUnits( {
46
- availableUnits: useSetting( 'spacing.units' ) || [
47
- 'px',
48
- 'em',
49
- 'rem',
50
- 'vw',
51
- 'vh',
52
- ],
47
+ availableUnits: availableUnits || [ 'px', 'em', 'rem', 'vw', 'vh' ],
53
48
  defaultValues: { px: 430, '%': 20, em: 20, rem: 20, vw: 20, vh: 50 },
54
49
  } );
55
50
 
@@ -112,7 +107,6 @@ export default function CoverInspectorControls( {
112
107
  isImageBackground,
113
108
  mediaElement,
114
109
  url,
115
- isImgElement,
116
110
  overlayColor,
117
111
  } = currentSettings;
118
112
 
@@ -202,32 +196,27 @@ export default function CoverInspectorControls( {
202
196
  }
203
197
  />
204
198
  ) }
205
- { ! useFeaturedImage &&
206
- url &&
207
- isImageBackground &&
208
- isImgElement && (
209
- <TextareaControl
210
- __nextHasNoMarginBottom
211
- label={ __( 'Alternative text' ) }
212
- value={ alt }
213
- onChange={ ( newAlt ) =>
214
- setAttributes( { alt: newAlt } )
215
- }
216
- help={
217
- <>
218
- <ExternalLink href="https://www.w3.org/WAI/tutorials/images/decision-tree">
219
- { __(
220
- 'Describe the purpose of the image.'
221
- ) }
222
- </ExternalLink>
223
- <br />
199
+ { ! useFeaturedImage && url && ! isVideoBackground && (
200
+ <TextareaControl
201
+ __nextHasNoMarginBottom
202
+ label={ __( 'Alternative text' ) }
203
+ value={ alt }
204
+ onChange={ ( newAlt ) =>
205
+ setAttributes( { alt: newAlt } )
206
+ }
207
+ help={
208
+ <>
209
+ <ExternalLink href="https://www.w3.org/WAI/tutorials/images/decision-tree">
224
210
  { __(
225
- 'Leave empty if decorative.'
211
+ 'Describe the purpose of the image.'
226
212
  ) }
227
- </>
228
- }
229
- />
230
- ) }
213
+ </ExternalLink>
214
+ <br />
215
+ { __( 'Leave empty if decorative.' ) }
216
+ </>
217
+ }
218
+ />
219
+ ) }
231
220
  <PanelRow>
232
221
  <Button
233
222
  variant="secondary"
package/src/cover/save.js CHANGED
@@ -138,7 +138,8 @@ export default function save( { attributes } ) {
138
138
  />
139
139
  ) : (
140
140
  <div
141
- role="img"
141
+ role={ alt ? 'img' : undefined }
142
+ aria-label={ alt ? alt : undefined }
142
143
  className={ imgClasses }
143
144
  style={ { backgroundPosition, backgroundImage } }
144
145
  />
@@ -29,7 +29,7 @@ export function mediaPosition( { x, y } = DEFAULT_FOCAL_POINT ) {
29
29
  }
30
30
 
31
31
  export function dimRatioToClass( ratio ) {
32
- return ratio === 50 || ! ratio === undefined
32
+ return ratio === 50 || ratio === undefined
33
33
  ? null
34
34
  : 'has-background-dim-' + 10 * Math.round( ratio / 10 );
35
35
  }
package/src/editor.scss CHANGED
@@ -16,6 +16,8 @@
16
16
  @import "./details/editor.scss";
17
17
  @import "./embed/editor.scss";
18
18
  @import "./file/editor.scss";
19
+ @import "./form-input/editor.scss";
20
+ @import "./form-submission-notification/editor.scss";
19
21
  @import "./freeform/editor.scss";
20
22
  @import "./gallery/editor.scss";
21
23
  @import "./group/editor.scss";
@@ -59,7 +59,8 @@ function render_block_core_file( $attributes, $content, $block ) {
59
59
  $processor->next_tag();
60
60
  $processor->set_attribute( 'data-wp-interactive', '' );
61
61
  $processor->next_tag( 'object' );
62
- $processor->set_attribute( 'data-wp-style--display', 'selectors.core.file.hasPdfPreview' );
62
+ $processor->set_attribute( 'data-wp-bind--hidden', '!selectors.core.file.hasPdfPreview' );
63
+ $processor->set_attribute( 'hidden', true );
63
64
  return $processor->get_updated_html();
64
65
  }
65
66
 
@@ -29,12 +29,6 @@
29
29
  margin-bottom: 1em;
30
30
  }
31
31
 
32
- @media (max-width: 768px) {
33
- .wp-block-file__embed {
34
- display: none;
35
- }
36
- }
37
-
38
32
  //This needs a low specificity so it won't override the rules from the button element if defined in theme.json.
39
33
  :where(.wp-block-file__button) {
40
34
  border-radius: 2em;
package/src/file/view.js CHANGED
@@ -5,13 +5,13 @@ import { store } from '@wordpress/interactivity';
5
5
  /**
6
6
  * Internal dependencies
7
7
  */
8
- import { browserSupportsPdfs } from './utils';
8
+ import { browserSupportsPdfs as hasPdfPreview } from './utils';
9
9
 
10
10
  store( {
11
11
  selectors: {
12
12
  core: {
13
13
  file: {
14
- hasPdfPreview: browserSupportsPdfs() ? 'inherit' : 'none',
14
+ hasPdfPreview,
15
15
  },
16
16
  },
17
17
  },
@@ -33,6 +33,7 @@
33
33
  "html": false,
34
34
  "multiple": false,
35
35
  "reusable": false,
36
+ "inserter": false,
36
37
  "spacing": {
37
38
  "margin": true,
38
39
  "padding": true,
@@ -0,0 +1,60 @@
1
+ {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
3
+ "apiVersion": 3,
4
+ "__experimental": true,
5
+ "name": "core/form",
6
+ "title": "Form",
7
+ "category": "common",
8
+ "description": "A form.",
9
+ "keywords": [ "container", "wrapper", "row", "section" ],
10
+ "textdomain": "default",
11
+ "icon": "feedback",
12
+ "attributes": {
13
+ "submissionMethod": {
14
+ "type": "string",
15
+ "default": "email"
16
+ },
17
+ "method": {
18
+ "type": "string",
19
+ "default": "post"
20
+ },
21
+ "action": {
22
+ "type": "string"
23
+ },
24
+ "email": {
25
+ "type": "string"
26
+ }
27
+ },
28
+ "supports": {
29
+ "anchor": true,
30
+ "className": false,
31
+ "color": {
32
+ "gradients": true,
33
+ "link": true,
34
+ "__experimentalDefaultControls": {
35
+ "background": true,
36
+ "text": true,
37
+ "link": true
38
+ }
39
+ },
40
+ "spacing": {
41
+ "margin": true,
42
+ "padding": true
43
+ },
44
+ "typography": {
45
+ "fontSize": true,
46
+ "lineHeight": true,
47
+ "__experimentalFontFamily": true,
48
+ "__experimentalTextDecoration": true,
49
+ "__experimentalFontStyle": true,
50
+ "__experimentalFontWeight": true,
51
+ "__experimentalLetterSpacing": true,
52
+ "__experimentalTextTransform": true,
53
+ "__experimentalDefaultControls": {
54
+ "fontSize": true
55
+ }
56
+ },
57
+ "__experimentalSelector": "form"
58
+ },
59
+ "viewScript": "file:./view.min.js"
60
+ }
@@ -0,0 +1,179 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+ import {
6
+ InnerBlocks,
7
+ useBlockProps,
8
+ useInnerBlocksProps,
9
+ InspectorControls,
10
+ store as blockEditorStore,
11
+ } from '@wordpress/block-editor';
12
+ import { TextControl, SelectControl, PanelBody } from '@wordpress/components';
13
+ import { useSelect } from '@wordpress/data';
14
+
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+ import {
19
+ formSubmissionNotificationSuccess,
20
+ formSubmissionNotificationError,
21
+ } from './utils.js';
22
+
23
+ const ALLOWED_BLOCKS = [
24
+ 'core/paragraph',
25
+ 'core/heading',
26
+ 'core/form-input',
27
+ 'core/form-submit-button',
28
+ 'core/form-submission-notification',
29
+ ];
30
+
31
+ const TEMPLATE = [
32
+ formSubmissionNotificationSuccess,
33
+ formSubmissionNotificationError,
34
+ [
35
+ 'core/form-input',
36
+ {
37
+ type: 'text',
38
+ label: __( 'Name' ),
39
+ required: true,
40
+ },
41
+ ],
42
+ [
43
+ 'core/form-input',
44
+ {
45
+ type: 'email',
46
+ label: __( 'Email' ),
47
+ required: true,
48
+ },
49
+ ],
50
+ [
51
+ 'core/form-input',
52
+ {
53
+ type: 'textarea',
54
+ label: __( 'Comment' ),
55
+ required: true,
56
+ },
57
+ ],
58
+ [ 'core/form-submit-button', {} ],
59
+ ];
60
+
61
+ const Edit = ( { attributes, setAttributes, clientId } ) => {
62
+ const { action, method, email, submissionMethod } = attributes;
63
+ const blockProps = useBlockProps();
64
+
65
+ const { hasInnerBlocks } = useSelect(
66
+ ( select ) => {
67
+ const { getBlock } = select( blockEditorStore );
68
+ const block = getBlock( clientId );
69
+ return {
70
+ hasInnerBlocks: !! ( block && block.innerBlocks.length ),
71
+ };
72
+ },
73
+ [ clientId ]
74
+ );
75
+
76
+ const innerBlocksProps = useInnerBlocksProps( blockProps, {
77
+ allowedBlocks: ALLOWED_BLOCKS,
78
+ template: TEMPLATE,
79
+ renderAppender: hasInnerBlocks
80
+ ? undefined
81
+ : InnerBlocks.ButtonBlockAppender,
82
+ } );
83
+
84
+ return (
85
+ <>
86
+ <InspectorControls>
87
+ <PanelBody title={ __( 'Settings' ) }>
88
+ <SelectControl
89
+ // __nextHasNoMarginBottom
90
+ // size={ '__unstable-large' }
91
+ label={ __( 'Submissions method' ) }
92
+ options={ [
93
+ // TODO: Allow plugins to add their own submission methods.
94
+ {
95
+ label: __( 'Send email' ),
96
+ value: 'email',
97
+ },
98
+ {
99
+ label: __( '- Custom -' ),
100
+ value: 'custom',
101
+ },
102
+ ] }
103
+ value={ submissionMethod }
104
+ onChange={ ( value ) =>
105
+ setAttributes( { submissionMethod: value } )
106
+ }
107
+ help={
108
+ submissionMethod === 'custom'
109
+ ? __(
110
+ 'Select the method to use for form submissions. Additional options for the "custom" mode can be found in the "Advanced" section.'
111
+ )
112
+ : __(
113
+ 'Select the method to use for form submissions.'
114
+ )
115
+ }
116
+ />
117
+ { submissionMethod === 'email' && (
118
+ <TextControl
119
+ __nextHasNoMarginBottom
120
+ autoComplete="off"
121
+ label={ __( 'Email for form submissions' ) }
122
+ value={ email }
123
+ required
124
+ onChange={ ( value ) => {
125
+ setAttributes( { email: value } );
126
+ setAttributes( {
127
+ action: `mailto:${ value }`,
128
+ } );
129
+ setAttributes( { method: 'post' } );
130
+ } }
131
+ help={ __(
132
+ 'The email address where form submissions will be sent. Separate multiple email addresses with a comma.'
133
+ ) }
134
+ />
135
+ ) }
136
+ </PanelBody>
137
+ </InspectorControls>
138
+ { submissionMethod !== 'email' && (
139
+ <InspectorControls group="advanced">
140
+ <SelectControl
141
+ __nextHasNoMarginBottom
142
+ label={ __( 'Method' ) }
143
+ options={ [
144
+ { label: 'Get', value: 'get' },
145
+ { label: 'Post', value: 'post' },
146
+ ] }
147
+ value={ method }
148
+ onChange={ ( value ) =>
149
+ setAttributes( { method: value } )
150
+ }
151
+ help={ __(
152
+ 'Select the method to use for form submissions.'
153
+ ) }
154
+ />
155
+ <TextControl
156
+ __nextHasNoMarginBottom
157
+ autoComplete="off"
158
+ label={ __( 'Form action' ) }
159
+ value={ action }
160
+ onChange={ ( newVal ) => {
161
+ setAttributes( {
162
+ action: newVal,
163
+ } );
164
+ } }
165
+ help={ __(
166
+ 'The URL where the form should be submitted.'
167
+ ) }
168
+ />
169
+ </InspectorControls>
170
+ ) }
171
+ <form
172
+ { ...innerBlocksProps }
173
+ className="wp-block-form"
174
+ encType={ submissionMethod === 'email' ? 'text/plain' : null }
175
+ />
176
+ </>
177
+ );
178
+ };
179
+ export default Edit;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import initBlock from '../utils/init-block';
5
+ import edit from './edit';
6
+ import metadata from './block.json';
7
+ import save from './save';
8
+ import variations from './variations';
9
+
10
+ const { name } = metadata;
11
+
12
+ export { metadata, name };
13
+
14
+ export const settings = {
15
+ edit,
16
+ save,
17
+ variations,
18
+ };
19
+
20
+ export const init = () => initBlock( { name, metadata, settings } );