@wordpress/block-library 9.14.0 → 9.15.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 (344) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/build/archives/edit.js +83 -36
  4. package/build/archives/edit.js.map +1 -1
  5. package/build/button/deprecated.js +182 -1
  6. package/build/button/deprecated.js.map +1 -1
  7. package/build/button/edit.js +47 -25
  8. package/build/button/edit.js.map +1 -1
  9. package/build/button/index.js +8 -2
  10. package/build/button/index.js.map +1 -1
  11. package/build/button/save.js +8 -5
  12. package/build/button/save.js.map +1 -1
  13. package/build/column/edit.js +33 -13
  14. package/build/column/edit.js.map +1 -1
  15. package/build/columns/edit.js +50 -27
  16. package/build/columns/edit.js.map +1 -1
  17. package/build/comments/index.js +1 -0
  18. package/build/comments/index.js.map +1 -1
  19. package/build/cover/edit/index.js +9 -3
  20. package/build/cover/edit/index.js.map +1 -1
  21. package/build/cover/edit.native.js +1 -1
  22. package/build/cover/edit.native.js.map +1 -1
  23. package/build/details/edit.js +29 -7
  24. package/build/details/edit.js.map +1 -1
  25. package/build/image/transforms.js +1 -0
  26. package/build/image/transforms.js.map +1 -1
  27. package/build/latest-posts/deprecated.js +12 -0
  28. package/build/latest-posts/deprecated.js.map +1 -1
  29. package/build/latest-posts/index.js +12 -0
  30. package/build/latest-posts/index.js.map +1 -1
  31. package/build/loginout/edit.js +42 -13
  32. package/build/loginout/edit.js.map +1 -1
  33. package/build/media-text/edit.js +59 -31
  34. package/build/media-text/edit.js.map +1 -1
  35. package/build/more/edit.js +28 -7
  36. package/build/more/edit.js.map +1 -1
  37. package/build/navigation/edit/navigation-menu-selector.js +5 -3
  38. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  39. package/build/navigation-link/edit.js +95 -55
  40. package/build/navigation-link/edit.js.map +1 -1
  41. package/build/navigation-submenu/edit.js +105 -53
  42. package/build/navigation-submenu/edit.js.map +1 -1
  43. package/build/page-list/edit.js +44 -25
  44. package/build/page-list/edit.js.map +1 -1
  45. package/build/paragraph/edit.js +14 -4
  46. package/build/paragraph/edit.js.map +1 -1
  47. package/build/post-author/edit.js +15 -3
  48. package/build/post-author/edit.js.map +1 -1
  49. package/build/post-author/index.js +4 -2
  50. package/build/post-author/index.js.map +1 -1
  51. package/build/post-author-name/edit.js +11 -5
  52. package/build/post-author-name/edit.js.map +1 -1
  53. package/build/post-author-name/index.js +4 -2
  54. package/build/post-author-name/index.js.map +1 -1
  55. package/build/post-comments-form/index.js +6 -1
  56. package/build/post-comments-form/index.js.map +1 -1
  57. package/build/post-comments-link/index.js +8 -1
  58. package/build/post-comments-link/index.js.map +1 -1
  59. package/build/post-date/edit.js +58 -18
  60. package/build/post-date/edit.js.map +1 -1
  61. package/build/post-date/index.js +2 -1
  62. package/build/post-date/index.js.map +1 -1
  63. package/build/post-excerpt/edit.js +42 -18
  64. package/build/post-excerpt/edit.js.map +1 -1
  65. package/build/post-featured-image/dimension-controls.js +17 -19
  66. package/build/post-featured-image/dimension-controls.js.map +1 -1
  67. package/build/post-featured-image/edit.js +45 -11
  68. package/build/post-featured-image/edit.js.map +1 -1
  69. package/build/post-featured-image/index.js +6 -3
  70. package/build/post-featured-image/index.js.map +1 -1
  71. package/build/post-navigation-link/index.js +11 -7
  72. package/build/post-navigation-link/index.js.map +1 -1
  73. package/build/post-navigation-link/variations.js +2 -2
  74. package/build/post-navigation-link/variations.js.map +1 -1
  75. package/build/post-template/index.js +11 -1
  76. package/build/post-template/index.js.map +1 -1
  77. package/build/post-title/index.js +6 -3
  78. package/build/post-title/index.js.map +1 -1
  79. package/build/query-no-results/index.js +10 -9
  80. package/build/query-no-results/index.js.map +1 -1
  81. package/build/query-pagination/edit.js +47 -17
  82. package/build/query-pagination/edit.js.map +1 -1
  83. package/build/query-pagination/query-pagination-label-control.js +1 -1
  84. package/build/query-pagination/query-pagination-label-control.js.map +1 -1
  85. package/build/query-pagination-numbers/edit.js +33 -15
  86. package/build/query-pagination-numbers/edit.js.map +1 -1
  87. package/build/query-total/edit.js +8 -10
  88. package/build/query-total/edit.js.map +1 -1
  89. package/build/query-total/index.js +8 -1
  90. package/build/query-total/index.js.map +1 -1
  91. package/build/read-more/index.js +7 -1
  92. package/build/read-more/index.js.map +1 -1
  93. package/build/site-logo/index.js +4 -2
  94. package/build/site-logo/index.js.map +1 -1
  95. package/build/site-title/edit.js +41 -12
  96. package/build/site-title/edit.js.map +1 -1
  97. package/build/site-title/index.js +4 -2
  98. package/build/site-title/index.js.map +1 -1
  99. package/build/social-link/edit.js +19 -3
  100. package/build/social-link/edit.js.map +1 -1
  101. package/build/social-links/edit.js +41 -12
  102. package/build/social-links/edit.js.map +1 -1
  103. package/build/spacer/controls.js +34 -12
  104. package/build/spacer/controls.js.map +1 -1
  105. package/build/table/edit.js +48 -15
  106. package/build/table/edit.js.map +1 -1
  107. package/build/table/index.js +4 -1
  108. package/build/table/index.js.map +1 -1
  109. package/build/table-of-contents/edit.js +1 -1
  110. package/build/table-of-contents/edit.js.map +1 -1
  111. package/build/table-of-contents/index.js +24 -23
  112. package/build/table-of-contents/index.js.map +1 -1
  113. package/build/tag-cloud/edit.js +56 -11
  114. package/build/tag-cloud/edit.js.map +1 -1
  115. package/build/video/edit-common-settings.js +90 -30
  116. package/build/video/edit-common-settings.js.map +1 -1
  117. package/build/video/edit.js +20 -49
  118. package/build/video/edit.js.map +1 -1
  119. package/build/video/poster-image.js +81 -0
  120. package/build/video/poster-image.js.map +1 -0
  121. package/build/video/tracks-editor.js +1 -1
  122. package/build/video/tracks-editor.js.map +1 -1
  123. package/build-module/archives/edit.js +84 -37
  124. package/build-module/archives/edit.js.map +1 -1
  125. package/build-module/button/deprecated.js +183 -2
  126. package/build-module/button/deprecated.js.map +1 -1
  127. package/build-module/button/edit.js +50 -28
  128. package/build-module/button/edit.js.map +1 -1
  129. package/build-module/button/index.js +8 -2
  130. package/build-module/button/index.js.map +1 -1
  131. package/build-module/button/save.js +9 -6
  132. package/build-module/button/save.js.map +1 -1
  133. package/build-module/column/edit.js +34 -14
  134. package/build-module/column/edit.js.map +1 -1
  135. package/build-module/columns/edit.js +52 -29
  136. package/build-module/columns/edit.js.map +1 -1
  137. package/build-module/comments/index.js +1 -0
  138. package/build-module/comments/index.js.map +1 -1
  139. package/build-module/cover/edit/index.js +9 -3
  140. package/build-module/cover/edit/index.js.map +1 -1
  141. package/build-module/cover/edit.native.js +2 -2
  142. package/build-module/cover/edit.native.js.map +1 -1
  143. package/build-module/details/edit.js +30 -8
  144. package/build-module/details/edit.js.map +1 -1
  145. package/build-module/image/transforms.js +1 -0
  146. package/build-module/image/transforms.js.map +1 -1
  147. package/build-module/latest-posts/deprecated.js +12 -0
  148. package/build-module/latest-posts/deprecated.js.map +1 -1
  149. package/build-module/latest-posts/index.js +12 -0
  150. package/build-module/latest-posts/index.js.map +1 -1
  151. package/build-module/loginout/edit.js +42 -14
  152. package/build-module/loginout/edit.js.map +1 -1
  153. package/build-module/media-text/edit.js +59 -31
  154. package/build-module/media-text/edit.js.map +1 -1
  155. package/build-module/more/edit.js +28 -8
  156. package/build-module/more/edit.js.map +1 -1
  157. package/build-module/navigation/edit/navigation-menu-selector.js +5 -3
  158. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  159. package/build-module/navigation-link/edit.js +96 -56
  160. package/build-module/navigation-link/edit.js.map +1 -1
  161. package/build-module/navigation-submenu/edit.js +106 -54
  162. package/build-module/navigation-submenu/edit.js.map +1 -1
  163. package/build-module/page-list/edit.js +45 -26
  164. package/build-module/page-list/edit.js.map +1 -1
  165. package/build-module/paragraph/edit.js +15 -6
  166. package/build-module/paragraph/edit.js.map +1 -1
  167. package/build-module/post-author/edit.js +16 -4
  168. package/build-module/post-author/edit.js.map +1 -1
  169. package/build-module/post-author/index.js +4 -2
  170. package/build-module/post-author/index.js.map +1 -1
  171. package/build-module/post-author-name/edit.js +12 -6
  172. package/build-module/post-author-name/edit.js.map +1 -1
  173. package/build-module/post-author-name/index.js +4 -2
  174. package/build-module/post-author-name/index.js.map +1 -1
  175. package/build-module/post-comments-form/index.js +6 -1
  176. package/build-module/post-comments-form/index.js.map +1 -1
  177. package/build-module/post-comments-link/index.js +8 -1
  178. package/build-module/post-comments-link/index.js.map +1 -1
  179. package/build-module/post-date/edit.js +59 -19
  180. package/build-module/post-date/edit.js.map +1 -1
  181. package/build-module/post-date/index.js +2 -1
  182. package/build-module/post-date/index.js.map +1 -1
  183. package/build-module/post-excerpt/edit.js +44 -20
  184. package/build-module/post-excerpt/edit.js.map +1 -1
  185. package/build-module/post-featured-image/dimension-controls.js +18 -20
  186. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  187. package/build-module/post-featured-image/edit.js +47 -13
  188. package/build-module/post-featured-image/edit.js.map +1 -1
  189. package/build-module/post-featured-image/index.js +6 -3
  190. package/build-module/post-featured-image/index.js.map +1 -1
  191. package/build-module/post-navigation-link/index.js +12 -7
  192. package/build-module/post-navigation-link/index.js.map +1 -1
  193. package/build-module/post-navigation-link/variations.js +2 -2
  194. package/build-module/post-navigation-link/variations.js.map +1 -1
  195. package/build-module/post-template/index.js +11 -1
  196. package/build-module/post-template/index.js.map +1 -1
  197. package/build-module/post-title/index.js +6 -3
  198. package/build-module/post-title/index.js.map +1 -1
  199. package/build-module/query-no-results/index.js +10 -9
  200. package/build-module/query-no-results/index.js.map +1 -1
  201. package/build-module/query-pagination/edit.js +49 -19
  202. package/build-module/query-pagination/edit.js.map +1 -1
  203. package/build-module/query-pagination/query-pagination-label-control.js +1 -1
  204. package/build-module/query-pagination/query-pagination-label-control.js.map +1 -1
  205. package/build-module/query-pagination-numbers/edit.js +34 -16
  206. package/build-module/query-pagination-numbers/edit.js.map +1 -1
  207. package/build-module/query-total/edit.js +8 -10
  208. package/build-module/query-total/edit.js.map +1 -1
  209. package/build-module/query-total/index.js +8 -1
  210. package/build-module/query-total/index.js.map +1 -1
  211. package/build-module/read-more/index.js +7 -1
  212. package/build-module/read-more/index.js.map +1 -1
  213. package/build-module/site-logo/index.js +4 -2
  214. package/build-module/site-logo/index.js.map +1 -1
  215. package/build-module/site-title/edit.js +42 -13
  216. package/build-module/site-title/edit.js.map +1 -1
  217. package/build-module/site-title/index.js +4 -2
  218. package/build-module/site-title/index.js.map +1 -1
  219. package/build-module/social-link/edit.js +20 -4
  220. package/build-module/social-link/edit.js.map +1 -1
  221. package/build-module/social-links/edit.js +42 -13
  222. package/build-module/social-links/edit.js.map +1 -1
  223. package/build-module/spacer/controls.js +35 -13
  224. package/build-module/spacer/controls.js.map +1 -1
  225. package/build-module/table/edit.js +49 -16
  226. package/build-module/table/edit.js.map +1 -1
  227. package/build-module/table/index.js +4 -1
  228. package/build-module/table/index.js.map +1 -1
  229. package/build-module/table-of-contents/edit.js +1 -1
  230. package/build-module/table-of-contents/edit.js.map +1 -1
  231. package/build-module/table-of-contents/index.js +26 -25
  232. package/build-module/table-of-contents/index.js.map +1 -1
  233. package/build-module/tag-cloud/edit.js +57 -12
  234. package/build-module/tag-cloud/edit.js.map +1 -1
  235. package/build-module/video/edit-common-settings.js +91 -31
  236. package/build-module/video/edit-common-settings.js.map +1 -1
  237. package/build-module/video/edit.js +24 -53
  238. package/build-module/video/edit.js.map +1 -1
  239. package/build-module/video/poster-image.js +74 -0
  240. package/build-module/video/poster-image.js.map +1 -0
  241. package/build-module/video/tracks-editor.js +1 -1
  242. package/build-module/video/tracks-editor.js.map +1 -1
  243. package/build-style/comment-template/style-rtl.css +0 -1
  244. package/build-style/comment-template/style.css +0 -1
  245. package/build-style/editor-rtl.css +4 -19
  246. package/build-style/editor.css +4 -19
  247. package/build-style/form-input/style-rtl.css +0 -2
  248. package/build-style/form-input/style.css +0 -2
  249. package/build-style/freeform/editor-rtl.css +4 -8
  250. package/build-style/freeform/editor.css +4 -8
  251. package/build-style/{post-template/editor.css → post-comments-link/style-rtl.css} +2 -4
  252. package/build-style/{post-template/editor-rtl.css → post-comments-link/style.css} +2 -4
  253. package/build-style/post-template/style-rtl.css +1 -0
  254. package/build-style/post-template/style.css +1 -0
  255. package/build-style/query-total/style-rtl.css +103 -0
  256. package/build-style/query-total/style.css +103 -0
  257. package/build-style/read-more/style-rtl.css +0 -1
  258. package/build-style/read-more/style.css +0 -1
  259. package/build-style/style-rtl.css +9 -4
  260. package/build-style/style.css +9 -4
  261. package/build-style/tag-cloud/editor-rtl.css +0 -5
  262. package/build-style/tag-cloud/editor.css +0 -5
  263. package/package.json +35 -35
  264. package/src/archives/edit.js +94 -36
  265. package/src/audio/test/__snapshots__/edit.native.js.snap +1 -1
  266. package/src/block/index.php +20 -0
  267. package/src/button/block.json +17 -2
  268. package/src/button/deprecated.js +189 -0
  269. package/src/button/edit.js +60 -31
  270. package/src/button/save.js +6 -1
  271. package/src/column/edit.js +34 -13
  272. package/src/columns/edit.js +71 -40
  273. package/src/comments/index.js +1 -0
  274. package/src/cover/edit/index.js +12 -5
  275. package/src/cover/edit.native.js +5 -2
  276. package/src/cover/test/edit.js +5 -7
  277. package/src/details/edit.js +40 -11
  278. package/src/editor.scss +0 -1
  279. package/src/file/test/__snapshots__/edit.native.js.snap +1 -1
  280. package/src/image/transforms.js +1 -0
  281. package/src/latest-posts/block.json +12 -0
  282. package/src/loginout/edit.js +56 -20
  283. package/src/media-text/edit.js +57 -28
  284. package/src/more/edit.js +39 -12
  285. package/src/navigation/edit/navigation-menu-selector.js +9 -2
  286. package/src/navigation/index.php +2 -2
  287. package/src/navigation-link/edit.js +101 -61
  288. package/src/navigation-link/index.php +16 -1
  289. package/src/navigation-submenu/edit.js +113 -57
  290. package/src/page-list/edit.js +52 -31
  291. package/src/paragraph/edit.js +18 -4
  292. package/src/post-author/block.json +4 -2
  293. package/src/post-author/edit.js +17 -3
  294. package/src/post-author/index.php +4 -0
  295. package/src/post-author-name/block.json +4 -2
  296. package/src/post-author-name/edit.js +17 -4
  297. package/src/post-author-name/index.php +4 -0
  298. package/src/post-comments-form/block.json +6 -1
  299. package/src/post-comments-link/block.json +8 -1
  300. package/src/post-comments-link/style.scss +4 -0
  301. package/src/post-content/index.php +23 -0
  302. package/src/post-date/block.json +2 -1
  303. package/src/post-date/edit.js +79 -25
  304. package/src/post-excerpt/edit.js +59 -22
  305. package/src/post-featured-image/block.json +6 -3
  306. package/src/post-featured-image/dimension-controls.js +18 -21
  307. package/src/post-featured-image/edit.js +67 -10
  308. package/src/post-navigation-link/block.json +0 -6
  309. package/src/post-navigation-link/index.js +11 -0
  310. package/src/post-navigation-link/variations.js +2 -2
  311. package/src/post-template/block.json +11 -1
  312. package/src/post-template/style.scss +2 -0
  313. package/src/post-title/block.json +6 -3
  314. package/src/query-no-results/block.json +0 -10
  315. package/src/query-no-results/index.js +11 -0
  316. package/src/query-pagination/edit.js +57 -15
  317. package/src/query-pagination/query-pagination-label-control.js +1 -3
  318. package/src/query-pagination-numbers/edit.js +41 -19
  319. package/src/query-pagination-previous/index.php +21 -14
  320. package/src/query-total/block.json +8 -1
  321. package/src/query-total/edit.js +11 -13
  322. package/src/query-total/index.php +9 -13
  323. package/src/query-total/style.scss +4 -0
  324. package/src/read-more/index.js +6 -0
  325. package/src/site-logo/block.json +4 -2
  326. package/src/site-title/block.json +4 -2
  327. package/src/site-title/edit.js +52 -15
  328. package/src/social-link/edit.js +21 -6
  329. package/src/social-links/edit.js +52 -15
  330. package/src/spacer/controls.js +42 -15
  331. package/src/style.scss +2 -0
  332. package/src/table/block.json +4 -1
  333. package/src/table/edit.js +58 -20
  334. package/src/table-of-contents/block.json +0 -52
  335. package/src/table-of-contents/edit.js +1 -1
  336. package/src/table-of-contents/index.js +53 -0
  337. package/src/tag-cloud/edit.js +60 -8
  338. package/src/tag-cloud/editor.scss +0 -8
  339. package/src/video/edit-common-settings.js +97 -39
  340. package/src/video/edit.js +29 -75
  341. package/src/video/poster-image.js +86 -0
  342. package/src/video/tracks-editor.js +1 -1
  343. package/tsconfig.json +0 -2
  344. package/src/post-template/editor.scss +0 -7
@@ -2,70 +2,128 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import {
5
- PanelBody,
6
5
  ToggleControl,
7
6
  SelectControl,
8
7
  Disabled,
8
+ __experimentalToolsPanel as ToolsPanel,
9
+ __experimentalToolsPanelItem as ToolsPanelItem,
9
10
  } from '@wordpress/components';
10
11
  import { __ } from '@wordpress/i18n';
11
12
  import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
12
13
  import ServerSideRender from '@wordpress/server-side-render';
13
14
 
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
19
+
14
20
  export default function ArchivesEdit( { attributes, setAttributes } ) {
15
21
  const { showLabel, showPostCounts, displayAsDropdown, type } = attributes;
16
22
 
23
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
24
+
17
25
  return (
18
26
  <>
19
27
  <InspectorControls>
20
- <PanelBody title={ __( 'Settings' ) }>
21
- <ToggleControl
22
- __nextHasNoMarginBottom
28
+ <ToolsPanel
29
+ label={ __( 'Settings' ) }
30
+ resetAll={ () => {
31
+ setAttributes( {
32
+ displayAsDropdown: false,
33
+ showLabel: false,
34
+ showPostCounts: false,
35
+ type: 'monthly',
36
+ } );
37
+ } }
38
+ dropdownMenuProps={ dropdownMenuProps }
39
+ >
40
+ <ToolsPanelItem
23
41
  label={ __( 'Display as dropdown' ) }
24
- checked={ displayAsDropdown }
25
- onChange={ () =>
26
- setAttributes( {
27
- displayAsDropdown: ! displayAsDropdown,
28
- } )
42
+ isShownByDefault
43
+ hasValue={ () => displayAsDropdown }
44
+ onDeselect={ () =>
45
+ setAttributes( { displayAsDropdown: false } )
29
46
  }
30
- />
31
- { displayAsDropdown && (
47
+ >
32
48
  <ToggleControl
33
49
  __nextHasNoMarginBottom
34
- label={ __( 'Show label' ) }
35
- checked={ showLabel }
50
+ label={ __( 'Display as dropdown' ) }
51
+ checked={ displayAsDropdown }
36
52
  onChange={ () =>
37
53
  setAttributes( {
38
- showLabel: ! showLabel,
54
+ displayAsDropdown: ! displayAsDropdown,
39
55
  } )
40
56
  }
41
57
  />
58
+ </ToolsPanelItem>
59
+
60
+ { displayAsDropdown && (
61
+ <ToolsPanelItem
62
+ label={ __( 'Show label' ) }
63
+ isShownByDefault
64
+ hasValue={ () => showLabel }
65
+ onDeselect={ () =>
66
+ setAttributes( { showLabel: false } )
67
+ }
68
+ >
69
+ <ToggleControl
70
+ __nextHasNoMarginBottom
71
+ label={ __( 'Show label' ) }
72
+ checked={ showLabel }
73
+ onChange={ () =>
74
+ setAttributes( {
75
+ showLabel: ! showLabel,
76
+ } )
77
+ }
78
+ />
79
+ </ToolsPanelItem>
42
80
  ) }
43
- <ToggleControl
44
- __nextHasNoMarginBottom
81
+
82
+ <ToolsPanelItem
45
83
  label={ __( 'Show post counts' ) }
46
- checked={ showPostCounts }
47
- onChange={ () =>
48
- setAttributes( {
49
- showPostCounts: ! showPostCounts,
50
- } )
84
+ isShownByDefault
85
+ hasValue={ () => showPostCounts }
86
+ onDeselect={ () =>
87
+ setAttributes( { showPostCounts: false } )
51
88
  }
52
- />
53
- <SelectControl
54
- __next40pxDefaultSize
55
- __nextHasNoMarginBottom
89
+ >
90
+ <ToggleControl
91
+ __nextHasNoMarginBottom
92
+ label={ __( 'Show post counts' ) }
93
+ checked={ showPostCounts }
94
+ onChange={ () =>
95
+ setAttributes( {
96
+ showPostCounts: ! showPostCounts,
97
+ } )
98
+ }
99
+ />
100
+ </ToolsPanelItem>
101
+
102
+ <ToolsPanelItem
56
103
  label={ __( 'Group by' ) }
57
- options={ [
58
- { label: __( 'Year' ), value: 'yearly' },
59
- { label: __( 'Month' ), value: 'monthly' },
60
- { label: __( 'Week' ), value: 'weekly' },
61
- { label: __( 'Day' ), value: 'daily' },
62
- ] }
63
- value={ type }
64
- onChange={ ( value ) =>
65
- setAttributes( { type: value } )
104
+ isShownByDefault
105
+ hasValue={ () => !! type }
106
+ onDeselect={ () =>
107
+ setAttributes( { type: 'monthly' } )
66
108
  }
67
- />
68
- </PanelBody>
109
+ >
110
+ <SelectControl
111
+ __next40pxDefaultSize
112
+ __nextHasNoMarginBottom
113
+ label={ __( 'Group by' ) }
114
+ options={ [
115
+ { label: __( 'Year' ), value: 'yearly' },
116
+ { label: __( 'Month' ), value: 'monthly' },
117
+ { label: __( 'Week' ), value: 'weekly' },
118
+ { label: __( 'Day' ), value: 'daily' },
119
+ ] }
120
+ value={ type }
121
+ onChange={ ( value ) =>
122
+ setAttributes( { type: value } )
123
+ }
124
+ />
125
+ </ToolsPanelItem>
126
+ </ToolsPanel>
69
127
  </InspectorControls>
70
128
  <div { ...useBlockProps() }>
71
129
  <Disabled>
@@ -89,7 +89,7 @@ exports[`Audio block renders audio block error state without crashing 1`] = `
89
89
  <Svg
90
90
  height={16}
91
91
  style={{}}
92
- viewBox="-2 -2 24 24"
92
+ viewBox="0 0 24 24"
93
93
  width={16}
94
94
  xmlns="http://www.w3.org/2000/svg"
95
95
  >
@@ -87,6 +87,26 @@ function render_block_core_block( $attributes ) {
87
87
  add_filter( 'render_block_context', $filter_block_context, 1 );
88
88
  }
89
89
 
90
+ $ignored_hooked_blocks = get_post_meta( $attributes['ref'], '_wp_ignored_hooked_blocks', true );
91
+ if ( ! empty( $ignored_hooked_blocks ) ) {
92
+ $ignored_hooked_blocks = json_decode( $ignored_hooked_blocks, true );
93
+ $attributes['metadata'] = array(
94
+ 'ignoredHookedBlocks' => $ignored_hooked_blocks,
95
+ );
96
+ }
97
+
98
+ // Wrap in "Block" block so the Block Hooks algorithm can insert blocks
99
+ // that are hooked as first or last child of `core/block`.
100
+ $content = get_comment_delimited_block_content(
101
+ 'core/block',
102
+ $attributes,
103
+ $content
104
+ );
105
+ // Apply Block Hooks.
106
+ $content = apply_block_hooks_to_content( $content, $reusable_block );
107
+ // Remove block wrapper.
108
+ $content = remove_serialized_parent_block( $content );
109
+
90
110
  $content = do_blocks( $content );
91
111
  unset( $seen_refs[ $attributes['ref'] ] );
92
112
 
@@ -85,6 +85,16 @@
85
85
  }
86
86
  },
87
87
  "typography": {
88
+ "__experimentalSkipSerialization": [
89
+ "fontSize",
90
+ "lineHeight",
91
+ "fontFamily",
92
+ "fontWeight",
93
+ "fontStyle",
94
+ "textTransform",
95
+ "textDecoration",
96
+ "letterSpacing"
97
+ ],
88
98
  "fontSize": true,
89
99
  "lineHeight": true,
90
100
  "__experimentalFontFamily": true,
@@ -122,7 +132,6 @@
122
132
  "width": true
123
133
  }
124
134
  },
125
- "__experimentalSelector": ".wp-block-button .wp-block-button__link",
126
135
  "interactivity": {
127
136
  "clientNavigation": true
128
137
  }
@@ -132,5 +141,11 @@
132
141
  { "name": "outline", "label": "Outline" }
133
142
  ],
134
143
  "editorStyle": "wp-block-button-editor",
135
- "style": "wp-block-button"
144
+ "style": "wp-block-button",
145
+ "selectors": {
146
+ "root": ".wp-block-button .wp-block-button__link",
147
+ "typography": {
148
+ "writingMode": ".wp-block-button"
149
+ }
150
+ }
136
151
  }
@@ -14,6 +14,8 @@ import {
14
14
  __experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,
15
15
  __experimentalGetColorClassesAndStyles as getColorClassesAndStyles,
16
16
  __experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,
17
+ __experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,
18
+ __experimentalGetElementClassName,
17
19
  } from '@wordpress/block-editor';
18
20
  import { compose } from '@wordpress/compose';
19
21
 
@@ -132,6 +134,192 @@ const blockAttributes = {
132
134
  },
133
135
  };
134
136
 
137
+ const v12 = {
138
+ attributes: {
139
+ tagName: {
140
+ type: 'string',
141
+ enum: [ 'a', 'button' ],
142
+ default: 'a',
143
+ },
144
+ type: {
145
+ type: 'string',
146
+ default: 'button',
147
+ },
148
+ textAlign: {
149
+ type: 'string',
150
+ },
151
+ url: {
152
+ type: 'string',
153
+ source: 'attribute',
154
+ selector: 'a',
155
+ attribute: 'href',
156
+ },
157
+ title: {
158
+ type: 'string',
159
+ source: 'attribute',
160
+ selector: 'a,button',
161
+ attribute: 'title',
162
+ role: 'content',
163
+ },
164
+ text: {
165
+ type: 'rich-text',
166
+ source: 'rich-text',
167
+ selector: 'a,button',
168
+ role: 'content',
169
+ },
170
+ linkTarget: {
171
+ type: 'string',
172
+ source: 'attribute',
173
+ selector: 'a',
174
+ attribute: 'target',
175
+ role: 'content',
176
+ },
177
+ rel: {
178
+ type: 'string',
179
+ source: 'attribute',
180
+ selector: 'a',
181
+ attribute: 'rel',
182
+ role: 'content',
183
+ },
184
+ placeholder: {
185
+ type: 'string',
186
+ },
187
+ backgroundColor: {
188
+ type: 'string',
189
+ },
190
+ textColor: {
191
+ type: 'string',
192
+ },
193
+ gradient: {
194
+ type: 'string',
195
+ },
196
+ width: {
197
+ type: 'number',
198
+ },
199
+ },
200
+ supports: {
201
+ anchor: true,
202
+ align: true,
203
+ alignWide: false,
204
+ color: {
205
+ __experimentalSkipSerialization: true,
206
+ gradients: true,
207
+ __experimentalDefaultControls: {
208
+ background: true,
209
+ text: true,
210
+ },
211
+ },
212
+ typography: {
213
+ fontSize: true,
214
+ lineHeight: true,
215
+ __experimentalFontFamily: true,
216
+ __experimentalFontWeight: true,
217
+ __experimentalFontStyle: true,
218
+ __experimentalTextTransform: true,
219
+ __experimentalTextDecoration: true,
220
+ __experimentalLetterSpacing: true,
221
+ __experimentalWritingMode: true,
222
+ __experimentalDefaultControls: {
223
+ fontSize: true,
224
+ },
225
+ },
226
+ reusable: false,
227
+ shadow: {
228
+ __experimentalSkipSerialization: true,
229
+ },
230
+ spacing: {
231
+ __experimentalSkipSerialization: true,
232
+ padding: [ 'horizontal', 'vertical' ],
233
+ __experimentalDefaultControls: {
234
+ padding: true,
235
+ },
236
+ },
237
+ __experimentalBorder: {
238
+ color: true,
239
+ radius: true,
240
+ style: true,
241
+ width: true,
242
+ __experimentalSkipSerialization: true,
243
+ __experimentalDefaultControls: {
244
+ color: true,
245
+ radius: true,
246
+ style: true,
247
+ width: true,
248
+ },
249
+ },
250
+ __experimentalSelector: '.wp-block-button__link',
251
+ interactivity: {
252
+ clientNavigation: true,
253
+ },
254
+ },
255
+ save( { attributes, className } ) {
256
+ const {
257
+ tagName,
258
+ type,
259
+ textAlign,
260
+ fontSize,
261
+ linkTarget,
262
+ rel,
263
+ style,
264
+ text,
265
+ title,
266
+ url,
267
+ width,
268
+ } = attributes;
269
+
270
+ const TagName = tagName || 'a';
271
+ const isButtonTag = 'button' === TagName;
272
+ const buttonType = type || 'button';
273
+ const borderProps = getBorderClassesAndStyles( attributes );
274
+ const colorProps = getColorClassesAndStyles( attributes );
275
+ const spacingProps = getSpacingClassesAndStyles( attributes );
276
+ const shadowProps = getShadowClassesAndStyles( attributes );
277
+ const buttonClasses = clsx(
278
+ 'wp-block-button__link',
279
+ colorProps.className,
280
+ borderProps.className,
281
+ {
282
+ [ `has-text-align-${ textAlign }` ]: textAlign,
283
+ // For backwards compatibility add style that isn't provided via
284
+ // block support.
285
+ 'no-border-radius': style?.border?.radius === 0,
286
+ },
287
+ __experimentalGetElementClassName( 'button' )
288
+ );
289
+ const buttonStyle = {
290
+ ...borderProps.style,
291
+ ...colorProps.style,
292
+ ...spacingProps.style,
293
+ ...shadowProps.style,
294
+ };
295
+
296
+ // The use of a `title` attribute here is soft-deprecated, but still applied
297
+ // if it had already been assigned, for the sake of backward-compatibility.
298
+ // A title will no longer be assigned for new or updated button block links.
299
+
300
+ const wrapperClasses = clsx( className, {
301
+ [ `has-custom-width wp-block-button__width-${ width }` ]: width,
302
+ [ `has-custom-font-size` ]: fontSize || style?.typography?.fontSize,
303
+ } );
304
+
305
+ return (
306
+ <div { ...useBlockProps.save( { className: wrapperClasses } ) }>
307
+ <RichText.Content
308
+ tagName={ TagName }
309
+ type={ isButtonTag ? buttonType : null }
310
+ className={ buttonClasses }
311
+ href={ isButtonTag ? null : url }
312
+ title={ title }
313
+ style={ buttonStyle }
314
+ value={ text }
315
+ target={ isButtonTag ? null : linkTarget }
316
+ rel={ isButtonTag ? null : rel }
317
+ />
318
+ </div>
319
+ );
320
+ },
321
+ };
322
+
135
323
  const v11 = {
136
324
  attributes: {
137
325
  url: {
@@ -399,6 +587,7 @@ const v10 = {
399
587
  };
400
588
 
401
589
  const deprecated = [
590
+ v12,
402
591
  v11,
403
592
  v10,
404
593
  {
@@ -9,6 +9,7 @@ import clsx from 'clsx';
9
9
  import { NEW_TAB_TARGET, NOFOLLOW_REL } from './constants';
10
10
  import { getUpdatedLinkAttributes } from './get-updated-link-attributes';
11
11
  import removeAnchorTag from '../utils/remove-anchor-tag';
12
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
12
13
 
13
14
  /**
14
15
  * WordPress dependencies
@@ -16,12 +17,13 @@ import removeAnchorTag from '../utils/remove-anchor-tag';
16
17
  import { __ } from '@wordpress/i18n';
17
18
  import { useEffect, useState, useRef, useMemo } from '@wordpress/element';
18
19
  import {
19
- Button,
20
- ButtonGroup,
21
- PanelBody,
22
20
  TextControl,
23
21
  ToolbarButton,
24
22
  Popover,
23
+ __experimentalToolsPanel as ToolsPanel,
24
+ __experimentalToolsPanelItem as ToolsPanelItem,
25
+ __experimentalToggleGroupControl as ToggleGroupControl,
26
+ __experimentalToggleGroupControlOption as ToggleGroupControlOption,
25
27
  } from '@wordpress/components';
26
28
  import {
27
29
  AlignmentControl,
@@ -37,6 +39,8 @@ import {
37
39
  __experimentalGetElementClassName,
38
40
  store as blockEditorStore,
39
41
  useBlockEditingMode,
42
+ getTypographyClassesAndStyles as useTypographyProps,
43
+ useSettings,
40
44
  } from '@wordpress/block-editor';
41
45
  import { displayShortcut, isKeyboardEvent, ENTER } from '@wordpress/keycodes';
42
46
  import { link, linkOff } from '@wordpress/icons';
@@ -114,35 +118,43 @@ function useEnter( props ) {
114
118
  }
115
119
 
116
120
  function WidthPanel( { selectedWidth, setAttributes } ) {
117
- function handleChange( newWidth ) {
118
- // Check if we are toggling the width off
119
- const width = selectedWidth === newWidth ? undefined : newWidth;
120
-
121
- // Update attributes.
122
- setAttributes( { width } );
123
- }
121
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
124
122
 
125
123
  return (
126
- <PanelBody title={ __( 'Settings' ) }>
127
- <ButtonGroup aria-label={ __( 'Button width' ) }>
128
- { [ 25, 50, 75, 100 ].map( ( widthValue ) => {
129
- return (
130
- <Button
131
- key={ widthValue }
132
- size="small"
133
- variant={
134
- widthValue === selectedWidth
135
- ? 'primary'
136
- : undefined
137
- }
138
- onClick={ () => handleChange( widthValue ) }
139
- >
140
- { widthValue }%
141
- </Button>
142
- );
143
- } ) }
144
- </ButtonGroup>
145
- </PanelBody>
124
+ <ToolsPanel
125
+ label={ __( 'Settings' ) }
126
+ resetAll={ () => setAttributes( { width: undefined } ) }
127
+ dropdownMenuProps={ dropdownMenuProps }
128
+ >
129
+ <ToolsPanelItem
130
+ label={ __( 'Width' ) }
131
+ isShownByDefault
132
+ hasValue={ () => !! selectedWidth }
133
+ onDeselect={ () => setAttributes( { width: undefined } ) }
134
+ __nextHasNoMarginBottom
135
+ >
136
+ <ToggleGroupControl
137
+ label={ __( 'Width' ) }
138
+ value={ selectedWidth }
139
+ onChange={ ( newWidth ) =>
140
+ setAttributes( { width: newWidth } )
141
+ }
142
+ isBlock
143
+ __next40pxDefaultSize
144
+ __nextHasNoMarginBottom
145
+ >
146
+ { [ 25, 50, 75, 100 ].map( ( widthValue ) => {
147
+ return (
148
+ <ToggleGroupControlOption
149
+ key={ widthValue }
150
+ value={ widthValue }
151
+ label={ `${ widthValue }%` }
152
+ />
153
+ );
154
+ } ) }
155
+ </ToggleGroupControl>
156
+ </ToolsPanelItem>
157
+ </ToolsPanel>
146
158
  );
147
159
  }
148
160
 
@@ -256,6 +268,19 @@ function ButtonEdit( props ) {
256
268
  [ context, isSelected, metadata?.bindings?.url ]
257
269
  );
258
270
 
271
+ const [ fluidTypographySettings, layout ] = useSettings(
272
+ 'typography.fluid',
273
+ 'layout'
274
+ );
275
+ const typographyProps = useTypographyProps( attributes, {
276
+ typography: {
277
+ fluid: fluidTypographySettings,
278
+ },
279
+ layout: {
280
+ wideSize: layout?.wideSize,
281
+ },
282
+ } );
283
+
259
284
  return (
260
285
  <>
261
286
  <div
@@ -263,7 +288,6 @@ function ButtonEdit( props ) {
263
288
  className={ clsx( blockProps.className, {
264
289
  [ `has-custom-width wp-block-button__width-${ width }` ]:
265
290
  width,
266
- [ `has-custom-font-size` ]: blockProps.style.fontSize,
267
291
  } ) }
268
292
  >
269
293
  <RichText
@@ -282,11 +306,14 @@ function ButtonEdit( props ) {
282
306
  'wp-block-button__link',
283
307
  colorProps.className,
284
308
  borderProps.className,
309
+ typographyProps.className,
285
310
  {
286
311
  [ `has-text-align-${ textAlign }` ]: textAlign,
287
312
  // For backwards compatibility add style that isn't
288
313
  // provided via block support.
289
314
  'no-border-radius': style?.border?.radius === 0,
315
+ [ `has-custom-font-size` ]:
316
+ blockProps.style.fontSize,
290
317
  },
291
318
  __experimentalGetElementClassName( 'button' )
292
319
  ) }
@@ -295,6 +322,8 @@ function ButtonEdit( props ) {
295
322
  ...colorProps.style,
296
323
  ...spacingProps.style,
297
324
  ...shadowProps.style,
325
+ ...typographyProps.style,
326
+ writingMode: undefined,
298
327
  } }
299
328
  onReplace={ onReplace }
300
329
  onMerge={ mergeBlocks }
@@ -14,6 +14,7 @@ import {
14
14
  __experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,
15
15
  __experimentalGetShadowClassesAndStyles as getShadowClassesAndStyles,
16
16
  __experimentalGetElementClassName,
17
+ getTypographyClassesAndStyles,
17
18
  } from '@wordpress/block-editor';
18
19
 
19
20
  export default function save( { attributes, className } ) {
@@ -38,15 +39,18 @@ export default function save( { attributes, className } ) {
38
39
  const colorProps = getColorClassesAndStyles( attributes );
39
40
  const spacingProps = getSpacingClassesAndStyles( attributes );
40
41
  const shadowProps = getShadowClassesAndStyles( attributes );
42
+ const typographyProps = getTypographyClassesAndStyles( attributes );
41
43
  const buttonClasses = clsx(
42
44
  'wp-block-button__link',
43
45
  colorProps.className,
44
46
  borderProps.className,
47
+ typographyProps.className,
45
48
  {
46
49
  [ `has-text-align-${ textAlign }` ]: textAlign,
47
50
  // For backwards compatibility add style that isn't provided via
48
51
  // block support.
49
52
  'no-border-radius': style?.border?.radius === 0,
53
+ [ `has-custom-font-size` ]: fontSize || style?.typography?.fontSize,
50
54
  },
51
55
  __experimentalGetElementClassName( 'button' )
52
56
  );
@@ -55,6 +59,8 @@ export default function save( { attributes, className } ) {
55
59
  ...colorProps.style,
56
60
  ...spacingProps.style,
57
61
  ...shadowProps.style,
62
+ ...typographyProps.style,
63
+ writingMode: undefined,
58
64
  };
59
65
 
60
66
  // The use of a `title` attribute here is soft-deprecated, but still applied
@@ -63,7 +69,6 @@ export default function save( { attributes, className } ) {
63
69
 
64
70
  const wrapperClasses = clsx( className, {
65
71
  [ `has-custom-width wp-block-button__width-${ width }` ]: width,
66
- [ `has-custom-font-size` ]: fontSize || style?.typography?.fontSize,
67
72
  } );
68
73
 
69
74
  return (