@wordpress/block-library 9.14.0 → 9.15.1

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
@@ -12,11 +12,13 @@
12
12
  },
13
13
  "isLink": {
14
14
  "type": "boolean",
15
- "default": true
15
+ "default": true,
16
+ "role": "content"
16
17
  },
17
18
  "linkTarget": {
18
19
  "type": "string",
19
- "default": "_self"
20
+ "default": "_self",
21
+ "role": "content"
20
22
  },
21
23
  "shouldSyncIcon": {
22
24
  "type": "boolean"
@@ -20,11 +20,13 @@
20
20
  },
21
21
  "isLink": {
22
22
  "type": "boolean",
23
- "default": true
23
+ "default": true,
24
+ "role": "content"
24
25
  },
25
26
  "linkTarget": {
26
27
  "type": "string",
27
- "default": "_self"
28
+ "default": "_self",
29
+ "role": "content"
28
30
  }
29
31
  },
30
32
  "example": {
@@ -17,10 +17,19 @@ import {
17
17
  useBlockProps,
18
18
  HeadingLevelDropdown,
19
19
  } from '@wordpress/block-editor';
20
- import { ToggleControl, PanelBody } from '@wordpress/components';
20
+ import {
21
+ ToggleControl,
22
+ __experimentalToolsPanel as ToolsPanel,
23
+ __experimentalToolsPanelItem as ToolsPanelItem,
24
+ } from '@wordpress/components';
21
25
  import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
22
26
  import { decodeEntities } from '@wordpress/html-entities';
23
27
 
28
+ /**
29
+ * Internal dependencies
30
+ */
31
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
32
+
24
33
  export default function SiteTitleEdit( {
25
34
  attributes,
26
35
  setAttributes,
@@ -43,6 +52,7 @@ export default function SiteTitleEdit( {
43
52
  };
44
53
  }, [] );
45
54
  const { editEntityRecord } = useDispatch( coreStore );
55
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
46
56
 
47
57
  function setTitle( newTitle ) {
48
58
  editEntityRecord( 'root', 'site', undefined, {
@@ -109,26 +119,53 @@ export default function SiteTitleEdit( {
109
119
  />
110
120
  </BlockControls>
111
121
  <InspectorControls>
112
- <PanelBody title={ __( 'Settings' ) }>
113
- <ToggleControl
114
- __nextHasNoMarginBottom
122
+ <ToolsPanel
123
+ label={ __( 'Settings' ) }
124
+ resetAll={ () => {
125
+ setAttributes( {
126
+ isLink: true,
127
+ linkTarget: '_self',
128
+ } );
129
+ } }
130
+ dropdownMenuProps={ dropdownMenuProps }
131
+ >
132
+ <ToolsPanelItem
133
+ hasValue={ () => ! isLink }
115
134
  label={ __( 'Make title link to home' ) }
116
- onChange={ () => setAttributes( { isLink: ! isLink } ) }
117
- checked={ isLink }
118
- />
119
- { isLink && (
135
+ onDeselect={ () => setAttributes( { isLink: true } ) }
136
+ isShownByDefault
137
+ >
120
138
  <ToggleControl
121
139
  __nextHasNoMarginBottom
122
- label={ __( 'Open in new tab' ) }
123
- onChange={ ( value ) =>
124
- setAttributes( {
125
- linkTarget: value ? '_blank' : '_self',
126
- } )
140
+ label={ __( 'Make title link to home' ) }
141
+ onChange={ () =>
142
+ setAttributes( { isLink: ! isLink } )
127
143
  }
128
- checked={ linkTarget === '_blank' }
144
+ checked={ isLink }
129
145
  />
146
+ </ToolsPanelItem>
147
+ { isLink && (
148
+ <ToolsPanelItem
149
+ hasValue={ () => linkTarget !== '_self' }
150
+ label={ __( 'Open in new tab' ) }
151
+ onDeselect={ () =>
152
+ setAttributes( { linkTarget: '_self' } )
153
+ }
154
+ isShownByDefault
155
+ >
156
+ <ToggleControl
157
+ __nextHasNoMarginBottom
158
+ label={ __( 'Open in new tab' ) }
159
+ onChange={ ( value ) =>
160
+ setAttributes( {
161
+ linkTarget: value ? '_blank' : '_self',
162
+ } )
163
+ }
164
+ checked={ linkTarget === '_blank' }
165
+ />
166
+ </ToolsPanelItem>
130
167
  ) }
131
- </PanelBody>
168
+ </ToolsPanel>
132
169
  </InspectorControls>
133
170
  { siteTitleContent }
134
171
  </>
@@ -22,10 +22,10 @@ import { useState, useRef } from '@wordpress/element';
22
22
  import {
23
23
  Button,
24
24
  Dropdown,
25
- PanelBody,
26
- PanelRow,
27
25
  TextControl,
28
26
  ToolbarButton,
27
+ __experimentalToolsPanel as ToolsPanel,
28
+ __experimentalToolsPanelItem as ToolsPanelItem,
29
29
  __experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,
30
30
  } from '@wordpress/components';
31
31
  import { useMergeRefs } from '@wordpress/compose';
@@ -36,6 +36,7 @@ import { keyboardReturn } from '@wordpress/icons';
36
36
  * Internal dependencies
37
37
  */
38
38
  import { getIconBySite, getNameBySite } from './social-list';
39
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
39
40
 
40
41
  const SocialLinkURLPopover = ( {
41
42
  url,
@@ -109,6 +110,7 @@ const SocialLinkEdit = ( {
109
110
  clientId,
110
111
  } ) => {
111
112
  const { url, service, label = '', rel } = attributes;
113
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
112
114
  const {
113
115
  showLabels,
114
116
  iconColor,
@@ -195,8 +197,21 @@ const SocialLinkEdit = ( {
195
197
  </BlockControls>
196
198
  ) }
197
199
  <InspectorControls>
198
- <PanelBody title={ __( 'Settings' ) }>
199
- <PanelRow>
200
+ <ToolsPanel
201
+ label={ __( 'Settings' ) }
202
+ resetAll={ () => {
203
+ setAttributes( { label: undefined } );
204
+ } }
205
+ dropdownMenuProps={ dropdownMenuProps }
206
+ >
207
+ <ToolsPanelItem
208
+ isShownByDefault
209
+ label={ __( 'Text' ) }
210
+ hasValue={ () => !! label }
211
+ onDeselect={ () => {
212
+ setAttributes( { label: undefined } );
213
+ } }
214
+ >
200
215
  <TextControl
201
216
  __next40pxDefaultSize
202
217
  __nextHasNoMarginBottom
@@ -210,8 +225,8 @@ const SocialLinkEdit = ( {
210
225
  }
211
226
  placeholder={ socialLinkName }
212
227
  />
213
- </PanelRow>
214
- </PanelBody>
228
+ </ToolsPanelItem>
229
+ </ToolsPanel>
215
230
  </InspectorControls>
216
231
  <InspectorControls group="advanced">
217
232
  <TextControl
@@ -22,14 +22,20 @@ import {
22
22
  import {
23
23
  MenuGroup,
24
24
  MenuItem,
25
- PanelBody,
26
25
  ToggleControl,
27
26
  ToolbarDropdownMenu,
27
+ __experimentalToolsPanel as ToolsPanel,
28
+ __experimentalToolsPanelItem as ToolsPanelItem,
28
29
  } from '@wordpress/components';
29
30
  import { __ } from '@wordpress/i18n';
30
31
  import { check } from '@wordpress/icons';
31
32
  import { useSelect } from '@wordpress/data';
32
33
 
34
+ /**
35
+ * Internal dependencies
36
+ */
37
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
38
+
33
39
  const sizeOptions = [
34
40
  { name: __( 'Small' ), value: 'has-small-icon-size' },
35
41
  { name: __( 'Normal' ), value: 'has-normal-icon-size' },
@@ -68,6 +74,8 @@ export function SocialLinksEdit( props ) {
68
74
 
69
75
  const logosOnly = attributes.className?.includes( 'is-style-logos-only' );
70
76
 
77
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
78
+
71
79
  // Remove icon background color when logos only style is selected or
72
80
  // restore it when any other style is selected.
73
81
  const backgroundBackupRef = useRef( {} );
@@ -198,24 +206,53 @@ export function SocialLinksEdit( props ) {
198
206
  </ToolbarDropdownMenu>
199
207
  </BlockControls>
200
208
  <InspectorControls>
201
- <PanelBody title={ __( 'Settings' ) }>
202
- <ToggleControl
203
- __nextHasNoMarginBottom
209
+ <ToolsPanel
210
+ label={ __( 'Settings' ) }
211
+ resetAll={ () => {
212
+ setAttributes( {
213
+ openInNewTab: false,
214
+ showLabels: false,
215
+ } );
216
+ } }
217
+ dropdownMenuProps={ dropdownMenuProps }
218
+ >
219
+ <ToolsPanelItem
220
+ isShownByDefault
204
221
  label={ __( 'Open links in new tab' ) }
205
- checked={ openInNewTab }
206
- onChange={ () =>
207
- setAttributes( { openInNewTab: ! openInNewTab } )
222
+ hasValue={ () => !! openInNewTab }
223
+ onDeselect={ () =>
224
+ setAttributes( { openInNewTab: false } )
208
225
  }
209
- />
210
- <ToggleControl
211
- __nextHasNoMarginBottom
226
+ >
227
+ <ToggleControl
228
+ __nextHasNoMarginBottom
229
+ label={ __( 'Open links in new tab' ) }
230
+ checked={ openInNewTab }
231
+ onChange={ () =>
232
+ setAttributes( {
233
+ openInNewTab: ! openInNewTab,
234
+ } )
235
+ }
236
+ />
237
+ </ToolsPanelItem>
238
+ <ToolsPanelItem
239
+ isShownByDefault
212
240
  label={ __( 'Show text' ) }
213
- checked={ showLabels }
214
- onChange={ () =>
215
- setAttributes( { showLabels: ! showLabels } )
241
+ hasValue={ () => !! showLabels }
242
+ onDeselect={ () =>
243
+ setAttributes( { showLabels: false } )
216
244
  }
217
- />
218
- </PanelBody>
245
+ >
246
+ <ToggleControl
247
+ __nextHasNoMarginBottom
248
+ label={ __( 'Show text' ) }
249
+ checked={ showLabels }
250
+ onChange={ () =>
251
+ setAttributes( { showLabels: ! showLabels } )
252
+ }
253
+ />
254
+ </ToolsPanelItem>
255
+ </ToolsPanel>
219
256
  </InspectorControls>
220
257
  { colorGradientSettings.hasColorsOrGradients && (
221
258
  <InspectorControls group="color">
@@ -10,10 +10,11 @@ import {
10
10
  privateApis as blockEditorPrivateApis,
11
11
  } from '@wordpress/block-editor';
12
12
  import {
13
- PanelBody,
14
13
  __experimentalUseCustomUnits as useCustomUnits,
15
14
  __experimentalUnitControl as UnitControl,
16
15
  __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
16
+ __experimentalToolsPanel as ToolsPanel,
17
+ __experimentalToolsPanelItem as ToolsPanelItem,
17
18
  } from '@wordpress/components';
18
19
  import { useInstanceId } from '@wordpress/compose';
19
20
  import { View } from '@wordpress/primitives';
@@ -94,28 +95,54 @@ export default function SpacerControls( {
94
95
  } ) {
95
96
  return (
96
97
  <InspectorControls>
97
- <PanelBody title={ __( 'Settings' ) }>
98
+ <ToolsPanel
99
+ label={ __( 'Settings' ) }
100
+ resetAll={ () => {
101
+ setAttributes( {
102
+ width: undefined,
103
+ height: '100px',
104
+ } );
105
+ } }
106
+ >
98
107
  { orientation === 'horizontal' && (
99
- <DimensionInput
108
+ <ToolsPanelItem
100
109
  label={ __( 'Width' ) }
101
- value={ width }
102
- onChange={ ( nextWidth ) =>
103
- setAttributes( { width: nextWidth } )
110
+ isShownByDefault
111
+ hasValue={ () => width !== undefined }
112
+ onDeselect={ () =>
113
+ setAttributes( { width: undefined } )
104
114
  }
105
- isResizing={ isResizing }
106
- />
115
+ >
116
+ <DimensionInput
117
+ label={ __( 'Width' ) }
118
+ value={ width }
119
+ onChange={ ( nextWidth ) =>
120
+ setAttributes( { width: nextWidth } )
121
+ }
122
+ isResizing={ isResizing }
123
+ />
124
+ </ToolsPanelItem>
107
125
  ) }
108
126
  { orientation !== 'horizontal' && (
109
- <DimensionInput
127
+ <ToolsPanelItem
110
128
  label={ __( 'Height' ) }
111
- value={ height }
112
- onChange={ ( nextHeight ) =>
113
- setAttributes( { height: nextHeight } )
129
+ isShownByDefault
130
+ hasValue={ () => height !== '100px' }
131
+ onDeselect={ () =>
132
+ setAttributes( { height: '100px' } )
114
133
  }
115
- isResizing={ isResizing }
116
- />
134
+ >
135
+ <DimensionInput
136
+ label={ __( 'Height' ) }
137
+ value={ height }
138
+ onChange={ ( nextHeight ) =>
139
+ setAttributes( { height: nextHeight } )
140
+ }
141
+ isResizing={ isResizing }
142
+ />
143
+ </ToolsPanelItem>
117
144
  ) }
118
- </PanelBody>
145
+ </ToolsPanel>
119
146
  </InspectorControls>
120
147
  );
121
148
  }
package/src/style.scss CHANGED
@@ -37,6 +37,7 @@
37
37
  @import "./post-author-biography/style.scss";
38
38
  @import "./post-comments-form/style.scss";
39
39
  @import "./post-content/style.scss";
40
+ @import "./post-comments-link/style.scss";
40
41
  @import "./post-date/style.scss";
41
42
  @import "./post-excerpt/style.scss";
42
43
  @import "./post-featured-image/style.scss";
@@ -50,6 +51,7 @@
50
51
  @import "./post-template/style.scss";
51
52
  @import "./query-pagination/style.scss";
52
53
  @import "./query-title/style.scss";
54
+ @import "./query-total/style.scss";
53
55
  @import "./quote/style.scss";
54
56
  @import "./read-more/style.scss";
55
57
  @import "./rss/style.scss";
@@ -195,11 +195,14 @@
195
195
  "width": true
196
196
  }
197
197
  },
198
- "__experimentalSelector": ".wp-block-table > table",
199
198
  "interactivity": {
200
199
  "clientNavigation": true
201
200
  }
202
201
  },
202
+ "selectors": {
203
+ "root": ".wp-block-table > table",
204
+ "spacing": ".wp-block-table"
205
+ },
203
206
  "styles": [
204
207
  {
205
208
  "name": "regular",
package/src/table/edit.js CHANGED
@@ -20,12 +20,13 @@ import {
20
20
  import { __ } from '@wordpress/i18n';
21
21
  import {
22
22
  Button,
23
- PanelBody,
24
23
  Placeholder,
25
24
  TextControl,
26
25
  ToggleControl,
27
26
  ToolbarDropdownMenu,
28
27
  __experimentalHasSplitBorders as hasSplitBorders,
28
+ __experimentalToolsPanel as ToolsPanel,
29
+ __experimentalToolsPanelItem as ToolsPanelItem,
29
30
  } from '@wordpress/components';
30
31
  import {
31
32
  alignLeft,
@@ -56,6 +57,7 @@ import {
56
57
  isEmptyTableSection,
57
58
  } from './state';
58
59
  import { Caption } from '../utils/caption';
60
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
59
61
 
60
62
  const ALIGNMENT_CONTROLS = [
61
63
  {
@@ -108,6 +110,8 @@ function TableEdit( {
108
110
  const tableRef = useRef();
109
111
  const [ hasTableCreated, setHasTableCreated ] = useState( false );
110
112
 
113
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
114
+
111
115
  /**
112
116
  * Updates the initial column count used for table creation.
113
117
  *
@@ -473,33 +477,67 @@ function TableEdit( {
473
477
  </>
474
478
  ) }
475
479
  <InspectorControls>
476
- <PanelBody
477
- title={ __( 'Settings' ) }
478
- className="blocks-table-settings"
480
+ <ToolsPanel
481
+ label={ __( 'Settings' ) }
482
+ resetAll={ () => {
483
+ setAttributes( {
484
+ hasFixedLayout: true,
485
+ head: [],
486
+ foot: [],
487
+ } );
488
+ } }
489
+ dropdownMenuProps={ dropdownMenuProps }
479
490
  >
480
- <ToggleControl
481
- __nextHasNoMarginBottom
491
+ <ToolsPanelItem
492
+ hasValue={ () => hasFixedLayout !== true }
482
493
  label={ __( 'Fixed width table cells' ) }
483
- checked={ !! hasFixedLayout }
484
- onChange={ onChangeFixedLayout }
485
- />
494
+ onDeselect={ () =>
495
+ setAttributes( { hasFixedLayout: true } )
496
+ }
497
+ isShownByDefault
498
+ >
499
+ <ToggleControl
500
+ __nextHasNoMarginBottom
501
+ label={ __( 'Fixed width table cells' ) }
502
+ checked={ !! hasFixedLayout }
503
+ onChange={ onChangeFixedLayout }
504
+ />
505
+ </ToolsPanelItem>
486
506
  { ! isEmpty && (
487
507
  <>
488
- <ToggleControl
489
- __nextHasNoMarginBottom
508
+ <ToolsPanelItem
509
+ hasValue={ () => head && head.length }
490
510
  label={ __( 'Header section' ) }
491
- checked={ !! ( head && head.length ) }
492
- onChange={ onToggleHeaderSection }
493
- />
494
- <ToggleControl
495
- __nextHasNoMarginBottom
511
+ onDeselect={ () =>
512
+ setAttributes( { head: [] } )
513
+ }
514
+ isShownByDefault
515
+ >
516
+ <ToggleControl
517
+ __nextHasNoMarginBottom
518
+ label={ __( 'Header section' ) }
519
+ checked={ !! ( head && head.length ) }
520
+ onChange={ onToggleHeaderSection }
521
+ />
522
+ </ToolsPanelItem>
523
+ <ToolsPanelItem
524
+ hasValue={ () => foot && foot.length }
496
525
  label={ __( 'Footer section' ) }
497
- checked={ !! ( foot && foot.length ) }
498
- onChange={ onToggleFooterSection }
499
- />
526
+ onDeselect={ () =>
527
+ setAttributes( { foot: [] } )
528
+ }
529
+ isShownByDefault
530
+ >
531
+ <ToggleControl
532
+ __nextHasNoMarginBottom
533
+ label={ __( 'Footer section' ) }
534
+ checked={ !! ( foot && foot.length ) }
535
+ onChange={ onToggleFooterSection }
536
+ />
537
+ </ToolsPanelItem>
500
538
  </>
501
539
  ) }
502
- </PanelBody>
540
+ </ToolsPanel>
503
541
  </InspectorControls>
504
542
  { ! isEmpty && (
505
543
  <table
@@ -62,57 +62,5 @@
62
62
  }
63
63
  }
64
64
  },
65
- "example": {
66
- "innerBlocks": [
67
- {
68
- "name": "core/heading",
69
- "attributes": {
70
- "level": 2,
71
- "content": "Heading"
72
- }
73
- },
74
- {
75
- "name": "core/heading",
76
- "attributes": {
77
- "level": 3,
78
- "content": "Subheading"
79
- }
80
- },
81
- {
82
- "name": "core/heading",
83
- "attributes": {
84
- "level": 2,
85
- "content": "Heading"
86
- }
87
- },
88
- {
89
- "name": "core/heading",
90
- "attributes": {
91
- "level": 3,
92
- "content": "Subheading"
93
- }
94
- }
95
- ],
96
- "attributes": {
97
- "headings": [
98
- {
99
- "content": "Heading",
100
- "level": 2
101
- },
102
- {
103
- "content": "Subheading",
104
- "level": 3
105
- },
106
- {
107
- "content": "Heading",
108
- "level": 2
109
- },
110
- {
111
- "content": "Subheading",
112
- "level": 3
113
- }
114
- ]
115
- }
116
- },
117
65
  "style": "wp-block-table-of-contents"
118
66
  }
@@ -122,7 +122,7 @@ export default function TableOfContentsEdit( {
122
122
  'Only including headings from the current page (if the post is paginated).'
123
123
  )
124
124
  : __(
125
- 'Toggle to only include headings from the current page (if the post is paginated).'
125
+ 'Include headings from all pages (if the post is paginated).'
126
126
  )
127
127
  }
128
128
  />
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
+ import { __ } from '@wordpress/i18n';
4
5
  import { tableOfContents as icon } from '@wordpress/icons';
5
6
 
6
7
  /**
@@ -19,6 +20,58 @@ export const settings = {
19
20
  icon,
20
21
  edit,
21
22
  save,
23
+ example: {
24
+ innerBlocks: [
25
+ {
26
+ name: 'core/heading',
27
+ attributes: {
28
+ level: 2,
29
+ content: __( 'Heading' ),
30
+ },
31
+ },
32
+ {
33
+ name: 'core/heading',
34
+ attributes: {
35
+ level: 3,
36
+ content: __( 'Subheading' ),
37
+ },
38
+ },
39
+ {
40
+ name: 'core/heading',
41
+ attributes: {
42
+ level: 2,
43
+ content: __( 'Heading' ),
44
+ },
45
+ },
46
+ {
47
+ name: 'core/heading',
48
+ attributes: {
49
+ level: 3,
50
+ content: __( 'Subheading' ),
51
+ },
52
+ },
53
+ ],
54
+ attributes: {
55
+ headings: [
56
+ {
57
+ content: __( 'Heading' ),
58
+ level: 2,
59
+ },
60
+ {
61
+ content: __( 'Subheading' ),
62
+ level: 3,
63
+ },
64
+ {
65
+ content: __( 'Heading' ),
66
+ level: 2,
67
+ },
68
+ {
69
+ content: __( 'Subheading' ),
70
+ level: 3,
71
+ },
72
+ ],
73
+ },
74
+ },
22
75
  };
23
76
 
24
77
  export const init = () => initBlock( { name, metadata, settings } );