@wordpress/block-library 8.20.0 → 8.21.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 (277) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +12 -0
  3. package/build/block/index.js +2 -1
  4. package/build/block/index.js.map +1 -1
  5. package/build/code/edit.native.js +8 -2
  6. package/build/code/edit.native.js.map +1 -1
  7. package/build/cover/deprecated.js +110 -1
  8. package/build/cover/deprecated.js.map +1 -1
  9. package/build/cover/edit/index.js +9 -3
  10. package/build/cover/edit/index.js.map +1 -1
  11. package/build/cover/edit/inspector-controls.js +1 -2
  12. package/build/cover/edit/inspector-controls.js.map +1 -1
  13. package/build/cover/index.js +0 -3
  14. package/build/cover/index.js.map +1 -1
  15. package/build/cover/save.js +2 -1
  16. package/build/cover/save.js.map +1 -1
  17. package/build/cover/shared.js +1 -1
  18. package/build/cover/shared.js.map +1 -1
  19. package/build/footnotes/index.js +1 -0
  20. package/build/footnotes/index.js.map +1 -1
  21. package/build/form/edit.js +138 -0
  22. package/build/form/edit.js.map +1 -0
  23. package/build/form/index.js +92 -0
  24. package/build/form/index.js.map +1 -0
  25. package/build/form/init.js +13 -0
  26. package/build/form/init.js.map +1 -0
  27. package/build/form/save.js +28 -0
  28. package/build/form/save.js.map +1 -0
  29. package/build/form/utils.js +24 -0
  30. package/build/form/utils.js.map +1 -0
  31. package/build/form/variations.js +95 -0
  32. package/build/form/variations.js.map +1 -0
  33. package/build/form/view.js +42 -0
  34. package/build/form/view.js.map +1 -0
  35. package/build/form-input/edit.js +124 -0
  36. package/build/form-input/edit.js.map +1 -0
  37. package/build/form-input/index.js +105 -0
  38. package/build/form-input/index.js.map +1 -0
  39. package/build/form-input/init.js +13 -0
  40. package/build/form-input/init.js.map +1 -0
  41. package/build/form-input/save.js +87 -0
  42. package/build/form-input/save.js.map +1 -0
  43. package/build/form-input/variations.js +93 -0
  44. package/build/form-input/variations.js.map +1 -0
  45. package/build/form-submission-notification/edit.js +59 -0
  46. package/build/form-submission-notification/edit.js.map +1 -0
  47. package/build/form-submission-notification/index.js +56 -0
  48. package/build/form-submission-notification/index.js.map +1 -0
  49. package/build/form-submission-notification/init.js +13 -0
  50. package/build/form-submission-notification/init.js.map +1 -0
  51. package/build/form-submission-notification/save.js +33 -0
  52. package/build/form-submission-notification/save.js.map +1 -0
  53. package/build/form-submission-notification/variations.js +63 -0
  54. package/build/form-submission-notification/variations.js.map +1 -0
  55. package/build/form-submit-button/edit.js +32 -0
  56. package/build/form-submit-button/edit.js.map +1 -0
  57. package/build/form-submit-button/index.js +44 -0
  58. package/build/form-submit-button/index.js.map +1 -0
  59. package/build/form-submit-button/init.js +13 -0
  60. package/build/form-submit-button/init.js.map +1 -0
  61. package/build/form-submit-button/save.js +22 -0
  62. package/build/form-submit-button/save.js.map +1 -0
  63. package/build/group/index.js +0 -1
  64. package/build/group/index.js.map +1 -1
  65. package/build/heading/index.js +3 -2
  66. package/build/heading/index.js.map +1 -1
  67. package/build/image/image.js +4 -1
  68. package/build/image/image.js.map +1 -1
  69. package/build/image/view.js +82 -40
  70. package/build/image/view.js.map +1 -1
  71. package/build/index.js +10 -0
  72. package/build/index.js.map +1 -1
  73. package/build/latest-posts/edit.js +6 -2
  74. package/build/latest-posts/edit.js.map +1 -1
  75. package/build/list-item/hooks/use-merge.js +15 -15
  76. package/build/list-item/hooks/use-merge.js.map +1 -1
  77. package/build/lock-unlock.js +1 -1
  78. package/build/lock-unlock.js.map +1 -1
  79. package/build/missing/edit.native.js +14 -62
  80. package/build/missing/edit.native.js.map +1 -1
  81. package/build/navigation/edit/index.js +0 -1
  82. package/build/navigation/edit/index.js.map +1 -1
  83. package/build/navigation/index.js +2 -1
  84. package/build/navigation/index.js.map +1 -1
  85. package/build/navigation/view.js +27 -5
  86. package/build/navigation/view.js.map +1 -1
  87. package/build/page-list-item/edit.js +3 -1
  88. package/build/page-list-item/edit.js.map +1 -1
  89. package/build/paragraph/index.js +7 -0
  90. package/build/paragraph/index.js.map +1 -1
  91. package/build/pattern/index.js +2 -1
  92. package/build/pattern/index.js.map +1 -1
  93. package/build/template-part/index.js +2 -1
  94. package/build/template-part/index.js.map +1 -1
  95. package/build-module/block/index.js +2 -1
  96. package/build-module/block/index.js.map +1 -1
  97. package/build-module/code/edit.native.js +8 -2
  98. package/build-module/code/edit.native.js.map +1 -1
  99. package/build-module/cover/deprecated.js +110 -1
  100. package/build-module/cover/deprecated.js.map +1 -1
  101. package/build-module/cover/edit/index.js +9 -3
  102. package/build-module/cover/edit/index.js.map +1 -1
  103. package/build-module/cover/edit/inspector-controls.js +1 -2
  104. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  105. package/build-module/cover/index.js +0 -3
  106. package/build-module/cover/index.js.map +1 -1
  107. package/build-module/cover/save.js +2 -1
  108. package/build-module/cover/save.js.map +1 -1
  109. package/build-module/cover/shared.js +1 -1
  110. package/build-module/cover/shared.js.map +1 -1
  111. package/build-module/footnotes/index.js +1 -0
  112. package/build-module/footnotes/index.js.map +1 -1
  113. package/build-module/form/edit.js +130 -0
  114. package/build-module/form/edit.js.map +1 -0
  115. package/build-module/form/index.js +82 -0
  116. package/build-module/form/index.js.map +1 -0
  117. package/build-module/form/init.js +6 -0
  118. package/build-module/form/init.js.map +1 -0
  119. package/build-module/form/save.js +20 -0
  120. package/build-module/form/save.js.map +1 -0
  121. package/build-module/form/utils.js +15 -0
  122. package/build-module/form/utils.js.map +1 -0
  123. package/build-module/form/variations.js +86 -0
  124. package/build-module/form/variations.js.map +1 -0
  125. package/build-module/form/view.js +40 -0
  126. package/build-module/form/view.js.map +1 -0
  127. package/build-module/form-input/edit.js +115 -0
  128. package/build-module/form-input/edit.js.map +1 -0
  129. package/build-module/form-input/index.js +95 -0
  130. package/build-module/form-input/index.js.map +1 -0
  131. package/build-module/form-input/init.js +6 -0
  132. package/build-module/form-input/init.js.map +1 -0
  133. package/build-module/form-input/save.js +80 -0
  134. package/build-module/form-input/save.js.map +1 -0
  135. package/build-module/form-input/variations.js +85 -0
  136. package/build-module/form-input/variations.js.map +1 -0
  137. package/build-module/form-submission-notification/edit.js +50 -0
  138. package/build-module/form-submission-notification/edit.js.map +1 -0
  139. package/build-module/form-submission-notification/index.js +47 -0
  140. package/build-module/form-submission-notification/index.js.map +1 -0
  141. package/build-module/form-submission-notification/init.js +6 -0
  142. package/build-module/form-submission-notification/init.js.map +1 -0
  143. package/build-module/form-submission-notification/save.js +25 -0
  144. package/build-module/form-submission-notification/save.js.map +1 -0
  145. package/build-module/form-submission-notification/variations.js +55 -0
  146. package/build-module/form-submission-notification/variations.js.map +1 -0
  147. package/build-module/form-submit-button/edit.js +24 -0
  148. package/build-module/form-submit-button/edit.js.map +1 -0
  149. package/build-module/form-submit-button/index.js +34 -0
  150. package/build-module/form-submit-button/index.js.map +1 -0
  151. package/build-module/form-submit-button/init.js +6 -0
  152. package/build-module/form-submit-button/init.js.map +1 -0
  153. package/build-module/form-submit-button/save.js +14 -0
  154. package/build-module/form-submit-button/save.js.map +1 -0
  155. package/build-module/group/index.js +0 -1
  156. package/build-module/group/index.js.map +1 -1
  157. package/build-module/heading/index.js +3 -2
  158. package/build-module/heading/index.js.map +1 -1
  159. package/build-module/image/image.js +4 -1
  160. package/build-module/image/image.js.map +1 -1
  161. package/build-module/image/view.js +82 -40
  162. package/build-module/image/view.js.map +1 -1
  163. package/build-module/index.js +10 -0
  164. package/build-module/index.js.map +1 -1
  165. package/build-module/latest-posts/edit.js +6 -2
  166. package/build-module/latest-posts/edit.js.map +1 -1
  167. package/build-module/list-item/hooks/use-merge.js +15 -15
  168. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  169. package/build-module/lock-unlock.js +1 -1
  170. package/build-module/lock-unlock.js.map +1 -1
  171. package/build-module/missing/edit.native.js +17 -65
  172. package/build-module/missing/edit.native.js.map +1 -1
  173. package/build-module/navigation/edit/index.js +0 -1
  174. package/build-module/navigation/edit/index.js.map +1 -1
  175. package/build-module/navigation/index.js +2 -1
  176. package/build-module/navigation/index.js.map +1 -1
  177. package/build-module/navigation/view.js +27 -5
  178. package/build-module/navigation/view.js.map +1 -1
  179. package/build-module/page-list-item/edit.js +3 -1
  180. package/build-module/page-list-item/edit.js.map +1 -1
  181. package/build-module/paragraph/index.js +7 -0
  182. package/build-module/paragraph/index.js.map +1 -1
  183. package/build-module/pattern/index.js +2 -1
  184. package/build-module/pattern/index.js.map +1 -1
  185. package/build-module/template-part/index.js +2 -1
  186. package/build-module/template-part/index.js.map +1 -1
  187. package/build-style/editor-rtl.css +50 -0
  188. package/build-style/editor.css +50 -0
  189. package/build-style/form-input/editor-rtl.css +106 -0
  190. package/build-style/form-input/editor.css +106 -0
  191. package/build-style/form-input/style-rtl.css +135 -0
  192. package/build-style/form-input/style.css +135 -0
  193. package/build-style/form-submission-notification/editor-rtl.css +118 -0
  194. package/build-style/form-submission-notification/editor.css +118 -0
  195. package/build-style/form-submit-button/style-rtl.css +91 -0
  196. package/build-style/form-submit-button/style.css +91 -0
  197. package/build-style/image/style-rtl.css +39 -5
  198. package/build-style/image/style.css +39 -5
  199. package/build-style/query/style-rtl.css +0 -10
  200. package/build-style/query/style.css +0 -10
  201. package/build-style/style-rtl.css +87 -5
  202. package/build-style/style.css +87 -5
  203. package/package.json +32 -32
  204. package/src/block/block.json +2 -1
  205. package/src/code/edit.native.js +15 -1
  206. package/src/cover/block.json +0 -3
  207. package/src/cover/deprecated.js +151 -1
  208. package/src/cover/edit/index.js +12 -3
  209. package/src/cover/edit/inspector-controls.js +19 -25
  210. package/src/cover/save.js +2 -1
  211. package/src/cover/shared.js +1 -1
  212. package/src/editor.scss +2 -0
  213. package/src/footnotes/block.json +1 -0
  214. package/src/form/block.json +60 -0
  215. package/src/form/edit.js +179 -0
  216. package/src/form/index.js +20 -0
  217. package/src/form/index.php +214 -0
  218. package/src/form/init.js +6 -0
  219. package/src/form/save.js +20 -0
  220. package/src/form/utils.js +39 -0
  221. package/src/form/variations.js +139 -0
  222. package/src/form/view.js +41 -0
  223. package/src/form-input/block.json +73 -0
  224. package/src/form-input/edit.js +151 -0
  225. package/src/form-input/editor.scss +24 -0
  226. package/src/form-input/index.js +20 -0
  227. package/src/form-input/index.php +45 -0
  228. package/src/form-input/init.js +6 -0
  229. package/src/form-input/save.js +83 -0
  230. package/src/form-input/style.scss +61 -0
  231. package/src/form-input/variations.js +82 -0
  232. package/src/form-submission-notification/block.json +19 -0
  233. package/src/form-submission-notification/edit.js +63 -0
  234. package/src/form-submission-notification/editor.scss +45 -0
  235. package/src/form-submission-notification/index.js +26 -0
  236. package/src/form-submission-notification/index.php +48 -0
  237. package/src/form-submission-notification/init.js +6 -0
  238. package/src/form-submission-notification/save.js +28 -0
  239. package/src/form-submission-notification/variations.js +59 -0
  240. package/src/form-submit-button/block.json +14 -0
  241. package/src/form-submit-button/edit.js +33 -0
  242. package/src/form-submit-button/index.js +18 -0
  243. package/src/form-submit-button/init.js +6 -0
  244. package/src/form-submit-button/save.js +14 -0
  245. package/src/form-submit-button/style.scss +3 -0
  246. package/src/group/block.json +0 -1
  247. package/src/heading/index.js +4 -2
  248. package/src/image/image.js +10 -0
  249. package/src/image/index.php +128 -82
  250. package/src/image/style.scss +49 -5
  251. package/src/image/view.js +100 -52
  252. package/src/index.js +10 -0
  253. package/src/latest-posts/edit.js +11 -2
  254. package/src/latest-posts/index.php +17 -8
  255. package/src/list-item/hooks/use-merge.js +20 -23
  256. package/src/lock-unlock.js +1 -1
  257. package/src/missing/edit.native.js +17 -115
  258. package/src/missing/style.native.scss +0 -67
  259. package/src/missing/test/edit-integration.native.js +135 -49
  260. package/src/missing/test/edit.native.js +0 -41
  261. package/src/navigation/block.json +2 -1
  262. package/src/navigation/edit/index.js +0 -1
  263. package/src/navigation/index.php +28 -8
  264. package/src/navigation/view.js +25 -6
  265. package/src/page-list-item/edit.js +2 -0
  266. package/src/paragraph/index.js +10 -0
  267. package/src/pattern/block.json +2 -1
  268. package/src/pattern/index.php +0 -3
  269. package/src/post-navigation-link/index.php +2 -1
  270. package/src/preformatted/test/edit.native.js +38 -0
  271. package/src/query/index.php +3 -2
  272. package/src/query/style.scss +0 -11
  273. package/src/search/index.php +0 -4
  274. package/src/style.scss +1 -0
  275. package/src/template-part/block.json +2 -1
  276. package/src/template-part/index.php +4 -7
  277. package/src/verse/test/edit.native.js +37 -0
@@ -1154,6 +1154,54 @@ section.wp-block-cover-image > h2,
1154
1154
  text-decoration: none;
1155
1155
  }
1156
1156
 
1157
+ .wp-block-form-input__label {
1158
+ width: 100%;
1159
+ display: flex;
1160
+ flex-direction: column;
1161
+ gap: 0.25em;
1162
+ margin-bottom: 0.5em;
1163
+ /*
1164
+ Small tweak to left-align the checkbox.
1165
+ Even though `:has` is not currently supported in Firefox, this is a small tweak
1166
+ and does not affect the functionality of the block or the user's experience.
1167
+ There will be a minor inconsistency between browsers. However, it's more important to provide
1168
+ a better experience for 80+% of users, until Firefox catches up and supports `:has`.
1169
+ */
1170
+ }
1171
+ .wp-block-form-input__label.is-label-inline {
1172
+ flex-direction: row;
1173
+ gap: 0.5em;
1174
+ align-items: center;
1175
+ }
1176
+ .wp-block-form-input__label.is-label-inline .wp-block-form-input__label-content {
1177
+ margin-bottom: 0.5em;
1178
+ }
1179
+ .wp-block-form-input__label:has(input[type=checkbox]) {
1180
+ width: -moz-fit-content;
1181
+ width: fit-content;
1182
+ flex-direction: row-reverse;
1183
+ }
1184
+
1185
+ .wp-block-form-input__label-content {
1186
+ width: -moz-fit-content;
1187
+ width: fit-content;
1188
+ }
1189
+
1190
+ .wp-block-form-input__input {
1191
+ padding: 0 0.5em;
1192
+ font-size: 1em;
1193
+ margin-bottom: 0.5em;
1194
+ }
1195
+ .wp-block-form-input__input[type=text], .wp-block-form-input__input[type=password], .wp-block-form-input__input[type=date], .wp-block-form-input__input[type=datetime], .wp-block-form-input__input[type=datetime-local], .wp-block-form-input__input[type=email], .wp-block-form-input__input[type=month], .wp-block-form-input__input[type=number], .wp-block-form-input__input[type=search], .wp-block-form-input__input[type=tel], .wp-block-form-input__input[type=time], .wp-block-form-input__input[type=url], .wp-block-form-input__input[type=week] {
1196
+ min-height: 2em;
1197
+ line-height: 2;
1198
+ border: 1px solid;
1199
+ }
1200
+
1201
+ textarea.wp-block-form-input__input {
1202
+ min-height: 10em;
1203
+ }
1204
+
1157
1205
  .wp-block-gallery:not(.has-nested-images),
1158
1206
  .blocks-gallery-grid:not(.has-nested-images) {
1159
1207
  display: flex;
@@ -1617,21 +1665,46 @@ h6.has-text-align-left[style*=writing-mode]:where([style*="vertical-lr"]) {
1617
1665
 
1618
1666
  .wp-lightbox-container {
1619
1667
  position: relative;
1668
+ display: flex;
1669
+ flex-direction: column;
1670
+ }
1671
+ .wp-lightbox-container img {
1672
+ cursor: zoom-in;
1673
+ }
1674
+ .wp-lightbox-container img:hover + button {
1675
+ opacity: 1;
1620
1676
  }
1621
1677
  .wp-lightbox-container button {
1678
+ opacity: 0;
1622
1679
  border: none;
1623
- background: none;
1680
+ background: #000;
1624
1681
  cursor: zoom-in;
1625
- width: 100%;
1626
- height: 100%;
1682
+ width: 24px;
1683
+ height: 24px;
1627
1684
  position: absolute;
1628
1685
  z-index: 100;
1686
+ top: 10px;
1687
+ left: 10px;
1688
+ text-align: center;
1689
+ padding: 0;
1690
+ border-radius: 10%;
1629
1691
  }
1630
1692
  .wp-lightbox-container button:focus-visible {
1631
1693
  outline: 5px auto #212121;
1632
1694
  outline: 5px auto -webkit-focus-ring-color;
1633
1695
  outline-offset: 5px;
1634
1696
  }
1697
+ .wp-lightbox-container button:hover {
1698
+ cursor: pointer;
1699
+ opacity: 1;
1700
+ }
1701
+ .wp-lightbox-container button:focus {
1702
+ opacity: 1;
1703
+ }
1704
+ .wp-lightbox-container button:hover, .wp-lightbox-container button:focus, .wp-lightbox-container button:not(:hover):not(:active):not(.has-background) {
1705
+ background: #000;
1706
+ border: none;
1707
+ }
1635
1708
 
1636
1709
  .wp-lightbox-overlay {
1637
1710
  position: fixed;
@@ -1647,11 +1720,20 @@ h6.has-text-align-left[style*=writing-mode]:where([style*="vertical-lr"]) {
1647
1720
  }
1648
1721
  .wp-lightbox-overlay .close-button {
1649
1722
  position: absolute;
1650
- top: calc(env(safe-area-inset-top) + 20px);
1651
- left: calc(env(safe-area-inset-left) + 20px);
1723
+ top: calc(env(safe-area-inset-top) + 16px);
1724
+ left: calc(env(safe-area-inset-left) + 16px);
1652
1725
  padding: 0;
1653
1726
  cursor: pointer;
1654
1727
  z-index: 5000000;
1728
+ min-width: 40px;
1729
+ min-height: 40px;
1730
+ display: flex;
1731
+ align-items: center;
1732
+ justify-content: center;
1733
+ }
1734
+ .wp-lightbox-overlay .close-button:hover, .wp-lightbox-overlay .close-button:focus, .wp-lightbox-overlay .close-button:not(:hover):not(:active):not(.has-background) {
1735
+ background: none;
1736
+ border: none;
1655
1737
  }
1656
1738
  .wp-lightbox-overlay .lightbox-image-container {
1657
1739
  position: absolute;
@@ -1162,6 +1162,54 @@ section.wp-block-cover-image > h2,
1162
1162
  text-decoration: none;
1163
1163
  }
1164
1164
 
1165
+ .wp-block-form-input__label {
1166
+ width: 100%;
1167
+ display: flex;
1168
+ flex-direction: column;
1169
+ gap: 0.25em;
1170
+ margin-bottom: 0.5em;
1171
+ /*
1172
+ Small tweak to left-align the checkbox.
1173
+ Even though `:has` is not currently supported in Firefox, this is a small tweak
1174
+ and does not affect the functionality of the block or the user's experience.
1175
+ There will be a minor inconsistency between browsers. However, it's more important to provide
1176
+ a better experience for 80+% of users, until Firefox catches up and supports `:has`.
1177
+ */
1178
+ }
1179
+ .wp-block-form-input__label.is-label-inline {
1180
+ flex-direction: row;
1181
+ gap: 0.5em;
1182
+ align-items: center;
1183
+ }
1184
+ .wp-block-form-input__label.is-label-inline .wp-block-form-input__label-content {
1185
+ margin-bottom: 0.5em;
1186
+ }
1187
+ .wp-block-form-input__label:has(input[type=checkbox]) {
1188
+ width: -moz-fit-content;
1189
+ width: fit-content;
1190
+ flex-direction: row-reverse;
1191
+ }
1192
+
1193
+ .wp-block-form-input__label-content {
1194
+ width: -moz-fit-content;
1195
+ width: fit-content;
1196
+ }
1197
+
1198
+ .wp-block-form-input__input {
1199
+ padding: 0 0.5em;
1200
+ font-size: 1em;
1201
+ margin-bottom: 0.5em;
1202
+ }
1203
+ .wp-block-form-input__input[type=text], .wp-block-form-input__input[type=password], .wp-block-form-input__input[type=date], .wp-block-form-input__input[type=datetime], .wp-block-form-input__input[type=datetime-local], .wp-block-form-input__input[type=email], .wp-block-form-input__input[type=month], .wp-block-form-input__input[type=number], .wp-block-form-input__input[type=search], .wp-block-form-input__input[type=tel], .wp-block-form-input__input[type=time], .wp-block-form-input__input[type=url], .wp-block-form-input__input[type=week] {
1204
+ min-height: 2em;
1205
+ line-height: 2;
1206
+ border: 1px solid;
1207
+ }
1208
+
1209
+ textarea.wp-block-form-input__input {
1210
+ min-height: 10em;
1211
+ }
1212
+
1165
1213
  .wp-block-gallery:not(.has-nested-images),
1166
1214
  .blocks-gallery-grid:not(.has-nested-images) {
1167
1215
  display: flex;
@@ -1631,21 +1679,46 @@ h6.has-text-align-left[style*=writing-mode]:where([style*="vertical-lr"]) {
1631
1679
 
1632
1680
  .wp-lightbox-container {
1633
1681
  position: relative;
1682
+ display: flex;
1683
+ flex-direction: column;
1684
+ }
1685
+ .wp-lightbox-container img {
1686
+ cursor: zoom-in;
1687
+ }
1688
+ .wp-lightbox-container img:hover + button {
1689
+ opacity: 1;
1634
1690
  }
1635
1691
  .wp-lightbox-container button {
1692
+ opacity: 0;
1636
1693
  border: none;
1637
- background: none;
1694
+ background: #000;
1638
1695
  cursor: zoom-in;
1639
- width: 100%;
1640
- height: 100%;
1696
+ width: 24px;
1697
+ height: 24px;
1641
1698
  position: absolute;
1642
1699
  z-index: 100;
1700
+ top: 10px;
1701
+ right: 10px;
1702
+ text-align: center;
1703
+ padding: 0;
1704
+ border-radius: 10%;
1643
1705
  }
1644
1706
  .wp-lightbox-container button:focus-visible {
1645
1707
  outline: 5px auto #212121;
1646
1708
  outline: 5px auto -webkit-focus-ring-color;
1647
1709
  outline-offset: 5px;
1648
1710
  }
1711
+ .wp-lightbox-container button:hover {
1712
+ cursor: pointer;
1713
+ opacity: 1;
1714
+ }
1715
+ .wp-lightbox-container button:focus {
1716
+ opacity: 1;
1717
+ }
1718
+ .wp-lightbox-container button:hover, .wp-lightbox-container button:focus, .wp-lightbox-container button:not(:hover):not(:active):not(.has-background) {
1719
+ background: #000;
1720
+ border: none;
1721
+ }
1649
1722
 
1650
1723
  .wp-lightbox-overlay {
1651
1724
  position: fixed;
@@ -1661,11 +1734,20 @@ h6.has-text-align-left[style*=writing-mode]:where([style*="vertical-lr"]) {
1661
1734
  }
1662
1735
  .wp-lightbox-overlay .close-button {
1663
1736
  position: absolute;
1664
- top: calc(env(safe-area-inset-top) + 20px);
1665
- right: calc(env(safe-area-inset-right) + 20px);
1737
+ top: calc(env(safe-area-inset-top) + 16px);
1738
+ right: calc(env(safe-area-inset-right) + 16px);
1666
1739
  padding: 0;
1667
1740
  cursor: pointer;
1668
1741
  z-index: 5000000;
1742
+ min-width: 40px;
1743
+ min-height: 40px;
1744
+ display: flex;
1745
+ align-items: center;
1746
+ justify-content: center;
1747
+ }
1748
+ .wp-lightbox-overlay .close-button:hover, .wp-lightbox-overlay .close-button:focus, .wp-lightbox-overlay .close-button:not(:hover):not(:active):not(.has-background) {
1749
+ background: none;
1750
+ border: none;
1669
1751
  }
1670
1752
  .wp-lightbox-overlay .lightbox-image-container {
1671
1753
  position: absolute;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "8.20.0",
3
+ "version": "8.21.0",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -31,36 +31,36 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.43.0",
35
- "@wordpress/api-fetch": "^6.40.0",
36
- "@wordpress/autop": "^3.43.0",
37
- "@wordpress/blob": "^3.43.0",
38
- "@wordpress/block-editor": "^12.11.0",
39
- "@wordpress/blocks": "^12.20.0",
40
- "@wordpress/components": "^25.9.0",
41
- "@wordpress/compose": "^6.20.0",
42
- "@wordpress/core-data": "^6.20.0",
43
- "@wordpress/data": "^9.13.0",
44
- "@wordpress/date": "^4.43.0",
45
- "@wordpress/deprecated": "^3.43.0",
46
- "@wordpress/dom": "^3.43.0",
47
- "@wordpress/element": "^5.20.0",
48
- "@wordpress/escape-html": "^2.43.0",
49
- "@wordpress/hooks": "^3.43.0",
50
- "@wordpress/html-entities": "^3.43.0",
51
- "@wordpress/i18n": "^4.43.0",
52
- "@wordpress/icons": "^9.34.0",
53
- "@wordpress/interactivity": "^2.4.0",
54
- "@wordpress/keycodes": "^3.43.0",
55
- "@wordpress/notices": "^4.11.0",
56
- "@wordpress/primitives": "^3.41.0",
57
- "@wordpress/private-apis": "^0.25.0",
58
- "@wordpress/reusable-blocks": "^4.20.0",
59
- "@wordpress/rich-text": "^6.20.0",
60
- "@wordpress/server-side-render": "^4.20.0",
61
- "@wordpress/url": "^3.44.0",
62
- "@wordpress/viewport": "^5.20.0",
63
- "@wordpress/wordcount": "^3.43.0",
34
+ "@wordpress/a11y": "^3.44.0",
35
+ "@wordpress/api-fetch": "^6.41.0",
36
+ "@wordpress/autop": "^3.44.0",
37
+ "@wordpress/blob": "^3.44.0",
38
+ "@wordpress/block-editor": "^12.12.0",
39
+ "@wordpress/blocks": "^12.21.0",
40
+ "@wordpress/components": "^25.10.0",
41
+ "@wordpress/compose": "^6.21.0",
42
+ "@wordpress/core-data": "^6.21.0",
43
+ "@wordpress/data": "^9.14.0",
44
+ "@wordpress/date": "^4.44.0",
45
+ "@wordpress/deprecated": "^3.44.0",
46
+ "@wordpress/dom": "^3.44.0",
47
+ "@wordpress/element": "^5.21.0",
48
+ "@wordpress/escape-html": "^2.44.0",
49
+ "@wordpress/hooks": "^3.44.0",
50
+ "@wordpress/html-entities": "^3.44.0",
51
+ "@wordpress/i18n": "^4.44.0",
52
+ "@wordpress/icons": "^9.35.0",
53
+ "@wordpress/interactivity": "^2.5.0",
54
+ "@wordpress/keycodes": "^3.44.0",
55
+ "@wordpress/notices": "^4.12.0",
56
+ "@wordpress/primitives": "^3.42.0",
57
+ "@wordpress/private-apis": "^0.26.0",
58
+ "@wordpress/reusable-blocks": "^4.21.0",
59
+ "@wordpress/rich-text": "^6.21.0",
60
+ "@wordpress/server-side-render": "^4.21.0",
61
+ "@wordpress/url": "^3.45.0",
62
+ "@wordpress/viewport": "^5.21.0",
63
+ "@wordpress/wordcount": "^3.44.0",
64
64
  "change-case": "^4.1.2",
65
65
  "classnames": "^2.3.1",
66
66
  "colord": "^2.7.0",
@@ -78,5 +78,5 @@
78
78
  "publishConfig": {
79
79
  "access": "public"
80
80
  },
81
- "gitHead": "9b8e598c5418d38fe72197c24ef1d3dd6c712151"
81
+ "gitHead": "f83bb1a71e8fa416131b81a9f282a72a1dc6c694"
82
82
  }
@@ -15,6 +15,7 @@
15
15
  "supports": {
16
16
  "customClassName": false,
17
17
  "html": false,
18
- "inserter": false
18
+ "inserter": false,
19
+ "renaming": false
19
20
  }
20
21
  }
@@ -9,6 +9,7 @@ import { View } from 'react-native';
9
9
  import { PlainText } from '@wordpress/block-editor';
10
10
  import { __ } from '@wordpress/i18n';
11
11
  import { usePreferredColorSchemeStyle } from '@wordpress/compose';
12
+ import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
12
13
 
13
14
  /**
14
15
  * Internal dependencies
@@ -22,7 +23,15 @@ import styles from './theme.scss';
22
23
  // Note: styling is applied directly to the (nested) PlainText component. Web-side components
23
24
  // apply it to the container 'div' but we don't have a proper proposal for cascading styling yet.
24
25
  export function CodeEdit( props ) {
25
- const { attributes, setAttributes, onFocus, onBlur, style } = props;
26
+ const {
27
+ attributes,
28
+ setAttributes,
29
+ onFocus,
30
+ onBlur,
31
+ style,
32
+ insertBlocksAfter,
33
+ mergeBlocks,
34
+ } = props;
26
35
  const codeStyle = {
27
36
  ...usePreferredColorSchemeStyle(
28
37
  styles.blockCode,
@@ -40,16 +49,21 @@ export function CodeEdit( props ) {
40
49
  <View>
41
50
  <PlainText
42
51
  value={ attributes.content }
52
+ identifier="content"
43
53
  style={ codeStyle }
44
54
  multiline={ true }
45
55
  underlineColorAndroid="transparent"
46
56
  onChange={ ( content ) => setAttributes( { content } ) }
57
+ onMerge={ mergeBlocks }
47
58
  placeholder={ __( 'Write code…' ) }
48
59
  aria-label={ __( 'Code' ) }
49
60
  isSelected={ props.isSelected }
50
61
  onFocus={ onFocus }
51
62
  onBlur={ onBlur }
52
63
  placeholderTextColor={ placeholderStyle.color }
64
+ __unstableOnSplitAtDoubleLineEnd={ () =>
65
+ insertBlocksAfter( createBlock( getDefaultBlockName() ) )
66
+ }
53
67
  />
54
68
  </View>
55
69
  );
@@ -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": {
@@ -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 ];
@@ -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,
@@ -531,7 +539,8 @@ function CoverEdit( {
531
539
  ) : (
532
540
  <div
533
541
  ref={ mediaElement }
534
- role="img"
542
+ role={ alt ? 'img' : undefined }
543
+ aria-label={ alt ? alt : undefined }
535
544
  className={ classnames(
536
545
  classes,
537
546
  'wp-block-cover__image-background'
@@ -112,7 +112,6 @@ export default function CoverInspectorControls( {
112
112
  isImageBackground,
113
113
  mediaElement,
114
114
  url,
115
- isImgElement,
116
115
  overlayColor,
117
116
  } = currentSettings;
118
117
 
@@ -202,32 +201,27 @@ export default function CoverInspectorControls( {
202
201
  }
203
202
  />
204
203
  ) }
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 />
204
+ { ! useFeaturedImage && url && ! isVideoBackground && (
205
+ <TextareaControl
206
+ __nextHasNoMarginBottom
207
+ label={ __( 'Alternative text' ) }
208
+ value={ alt }
209
+ onChange={ ( newAlt ) =>
210
+ setAttributes( { alt: newAlt } )
211
+ }
212
+ help={
213
+ <>
214
+ <ExternalLink href="https://www.w3.org/WAI/tutorials/images/decision-tree">
224
215
  { __(
225
- 'Leave empty if decorative.'
216
+ 'Describe the purpose of the image.'
226
217
  ) }
227
- </>
228
- }
229
- />
230
- ) }
218
+ </ExternalLink>
219
+ <br />
220
+ { __( 'Leave empty if decorative.' ) }
221
+ </>
222
+ }
223
+ />
224
+ ) }
231
225
  <PanelRow>
232
226
  <Button
233
227
  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
  }