@wordpress/block-library 9.16.0 → 9.17.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 (215) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/archives/edit.js +2 -2
  3. package/build/archives/edit.js.map +1 -1
  4. package/build/categories/edit.js +115 -37
  5. package/build/categories/edit.js.map +1 -1
  6. package/build/comments/edit/comments-inspector-controls.js +6 -5
  7. package/build/comments/edit/comments-inspector-controls.js.map +1 -1
  8. package/build/comments-pagination/index.js +5 -0
  9. package/build/comments-pagination/index.js.map +1 -1
  10. package/build/cover/edit/inspector-controls.js +2 -9
  11. package/build/cover/edit/inspector-controls.js.map +1 -1
  12. package/build/details/edit.js +16 -2
  13. package/build/details/edit.js.map +1 -1
  14. package/build/details/index.js +9 -0
  15. package/build/details/index.js.map +1 -1
  16. package/build/details/save.js +2 -0
  17. package/build/details/save.js.map +1 -1
  18. package/build/embed/transforms.js +5 -2
  19. package/build/embed/transforms.js.map +1 -1
  20. package/build/form/variations.js +1 -1
  21. package/build/form/variations.js.map +1 -1
  22. package/build/group/edit.js +2 -9
  23. package/build/group/edit.js.map +1 -1
  24. package/build/home-link/edit.js +1 -2
  25. package/build/home-link/edit.js.map +1 -1
  26. package/build/latest-comments/edit.js +73 -26
  27. package/build/latest-comments/edit.js.map +1 -1
  28. package/build/latest-posts/constants.js +2 -1
  29. package/build/latest-posts/constants.js.map +1 -1
  30. package/build/latest-posts/edit.js +91 -38
  31. package/build/latest-posts/edit.js.map +1 -1
  32. package/build/list-item/index.js +1 -1
  33. package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -4
  34. package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
  35. package/build/navigation/edit/use-generate-default-navigation-title.js +4 -4
  36. package/build/navigation/edit/use-generate-default-navigation-title.js.map +1 -1
  37. package/build/navigation-link/edit.js +14 -19
  38. package/build/navigation-link/edit.js.map +1 -1
  39. package/build/navigation-submenu/index.js +7 -0
  40. package/build/navigation-submenu/index.js.map +1 -1
  41. package/build/page-list/edit.js +1 -1
  42. package/build/page-list/edit.js.map +1 -1
  43. package/build/paragraph/edit.js +4 -14
  44. package/build/paragraph/edit.js.map +1 -1
  45. package/build/pattern/index.js +1 -1
  46. package/build/post-content/index.js +1 -0
  47. package/build/post-content/index.js.map +1 -1
  48. package/build/post-date/edit.js +1 -1
  49. package/build/post-date/edit.js.map +1 -1
  50. package/build/post-featured-image/edit.js +0 -6
  51. package/build/post-featured-image/edit.js.map +1 -1
  52. package/build/post-navigation-link/variations.js +2 -2
  53. package/build/post-navigation-link/variations.js.map +1 -1
  54. package/build/post-terms/edit.js +1 -0
  55. package/build/post-terms/edit.js.map +1 -1
  56. package/build/post-time-to-read/index.js +1 -1
  57. package/build/query/edit/query-content.js +2 -6
  58. package/build/query/edit/query-content.js.map +1 -1
  59. package/build/query-no-results/index.js +1 -1
  60. package/build/query-pagination-numbers/edit.js +1 -1
  61. package/build/query-pagination-numbers/edit.js.map +1 -1
  62. package/build/query-title/edit.js +1 -0
  63. package/build/query-title/edit.js.map +1 -1
  64. package/build/read-more/edit.js +25 -7
  65. package/build/read-more/edit.js.map +1 -1
  66. package/build/search/edit.js +67 -49
  67. package/build/search/edit.js.map +1 -1
  68. package/build/separator/edit.js +2 -4
  69. package/build/separator/edit.js.map +1 -1
  70. package/build/spacer/controls.js +13 -9
  71. package/build/spacer/controls.js.map +1 -1
  72. package/build/spacer/edit.js +23 -21
  73. package/build/spacer/edit.js.map +1 -1
  74. package/build/template-part/edit/advanced-controls.js +2 -9
  75. package/build/template-part/edit/advanced-controls.js.map +1 -1
  76. package/build/utils/messages.js +22 -0
  77. package/build/utils/messages.js.map +1 -0
  78. package/build/video/edit-common-settings.js +1 -1
  79. package/build/video/edit-common-settings.js.map +1 -1
  80. package/build-module/archives/edit.js +2 -2
  81. package/build-module/archives/edit.js.map +1 -1
  82. package/build-module/categories/edit.js +116 -38
  83. package/build-module/categories/edit.js.map +1 -1
  84. package/build-module/comments/edit/comments-inspector-controls.js +5 -4
  85. package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
  86. package/build-module/comments-pagination/index.js +5 -0
  87. package/build-module/comments-pagination/index.js.map +1 -1
  88. package/build-module/cover/edit/inspector-controls.js +1 -8
  89. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  90. package/build-module/details/edit.js +17 -3
  91. package/build-module/details/edit.js.map +1 -1
  92. package/build-module/details/index.js +9 -0
  93. package/build-module/details/index.js.map +1 -1
  94. package/build-module/details/save.js +2 -0
  95. package/build-module/details/save.js.map +1 -1
  96. package/build-module/embed/transforms.js +5 -2
  97. package/build-module/embed/transforms.js.map +1 -1
  98. package/build-module/form/variations.js +1 -1
  99. package/build-module/form/variations.js.map +1 -1
  100. package/build-module/group/edit.js +1 -8
  101. package/build-module/group/edit.js.map +1 -1
  102. package/build-module/home-link/edit.js +1 -2
  103. package/build-module/home-link/edit.js.map +1 -1
  104. package/build-module/latest-comments/edit.js +74 -27
  105. package/build-module/latest-comments/edit.js.map +1 -1
  106. package/build-module/latest-posts/constants.js +1 -0
  107. package/build-module/latest-posts/constants.js.map +1 -1
  108. package/build-module/latest-posts/edit.js +93 -40
  109. package/build-module/latest-posts/edit.js.map +1 -1
  110. package/build-module/list-item/index.js +1 -1
  111. package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -4
  112. package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
  113. package/build-module/navigation/edit/use-generate-default-navigation-title.js +4 -4
  114. package/build-module/navigation/edit/use-generate-default-navigation-title.js.map +1 -1
  115. package/build-module/navigation-link/edit.js +15 -20
  116. package/build-module/navigation-link/edit.js.map +1 -1
  117. package/build-module/navigation-submenu/index.js +7 -0
  118. package/build-module/navigation-submenu/index.js.map +1 -1
  119. package/build-module/page-list/edit.js +1 -1
  120. package/build-module/page-list/edit.js.map +1 -1
  121. package/build-module/paragraph/edit.js +5 -15
  122. package/build-module/paragraph/edit.js.map +1 -1
  123. package/build-module/pattern/index.js +1 -1
  124. package/build-module/post-content/index.js +1 -0
  125. package/build-module/post-content/index.js.map +1 -1
  126. package/build-module/post-date/edit.js +1 -1
  127. package/build-module/post-date/edit.js.map +1 -1
  128. package/build-module/post-featured-image/edit.js +0 -6
  129. package/build-module/post-featured-image/edit.js.map +1 -1
  130. package/build-module/post-navigation-link/variations.js +2 -2
  131. package/build-module/post-navigation-link/variations.js.map +1 -1
  132. package/build-module/post-terms/edit.js +1 -0
  133. package/build-module/post-terms/edit.js.map +1 -1
  134. package/build-module/post-time-to-read/index.js +1 -1
  135. package/build-module/query/edit/query-content.js +1 -5
  136. package/build-module/query/edit/query-content.js.map +1 -1
  137. package/build-module/query-no-results/index.js +1 -1
  138. package/build-module/query-pagination-numbers/edit.js +1 -1
  139. package/build-module/query-pagination-numbers/edit.js.map +1 -1
  140. package/build-module/query-title/edit.js +1 -0
  141. package/build-module/query-title/edit.js.map +1 -1
  142. package/build-module/read-more/edit.js +26 -8
  143. package/build-module/read-more/edit.js.map +1 -1
  144. package/build-module/search/edit.js +68 -50
  145. package/build-module/search/edit.js.map +1 -1
  146. package/build-module/separator/edit.js +1 -3
  147. package/build-module/separator/edit.js.map +1 -1
  148. package/build-module/spacer/controls.js +13 -9
  149. package/build-module/spacer/controls.js.map +1 -1
  150. package/build-module/spacer/edit.js +24 -22
  151. package/build-module/spacer/edit.js.map +1 -1
  152. package/build-module/template-part/edit/advanced-controls.js +1 -8
  153. package/build-module/template-part/edit/advanced-controls.js.map +1 -1
  154. package/build-module/utils/messages.js +15 -0
  155. package/build-module/utils/messages.js.map +1 -0
  156. package/build-module/video/edit-common-settings.js +1 -1
  157. package/build-module/video/edit-common-settings.js.map +1 -1
  158. package/build-style/editor-rtl.css +8 -45
  159. package/build-style/editor.css +8 -45
  160. package/build-style/gallery/editor-rtl.css +0 -44
  161. package/build-style/gallery/editor.css +0 -44
  162. package/build-style/navigation-link/editor-rtl.css +3 -0
  163. package/build-style/navigation-link/editor.css +3 -0
  164. package/build-style/paragraph/editor-rtl.css +4 -0
  165. package/build-style/paragraph/editor.css +4 -0
  166. package/build-style/post-featured-image/editor-rtl.css +1 -1
  167. package/build-style/post-featured-image/editor.css +1 -1
  168. package/package.json +35 -35
  169. package/src/archives/edit.js +2 -2
  170. package/src/categories/edit.js +133 -45
  171. package/src/comments/edit/comments-inspector-controls.js +5 -8
  172. package/src/comments-pagination/block.json +5 -0
  173. package/src/cover/edit/inspector-controls.js +1 -21
  174. package/src/details/block.json +9 -0
  175. package/src/details/edit.js +18 -2
  176. package/src/details/save.js +6 -2
  177. package/src/embed/transforms.js +3 -1
  178. package/src/form/variations.js +1 -1
  179. package/src/gallery/editor.scss +0 -56
  180. package/src/group/edit.js +1 -20
  181. package/src/home-link/edit.js +0 -6
  182. package/src/latest-comments/edit.js +93 -33
  183. package/src/latest-posts/constants.js +1 -0
  184. package/src/latest-posts/edit.js +119 -44
  185. package/src/list/test/edit.native.js +9 -9
  186. package/src/list-item/block.json +1 -1
  187. package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +4 -4
  188. package/src/navigation/edit/use-generate-default-navigation-title.js +4 -4
  189. package/src/navigation-link/edit.js +25 -29
  190. package/src/navigation-link/editor.scss +27 -18
  191. package/src/navigation-submenu/index.js +7 -0
  192. package/src/navigation-submenu/index.php +21 -4
  193. package/src/page-list/edit.js +52 -50
  194. package/src/paragraph/edit.js +3 -18
  195. package/src/paragraph/editor.scss +7 -0
  196. package/src/pattern/block.json +1 -1
  197. package/src/post-content/block.json +1 -0
  198. package/src/post-date/edit.js +1 -3
  199. package/src/post-featured-image/edit.js +2 -15
  200. package/src/post-featured-image/editor.scss +2 -2
  201. package/src/post-navigation-link/variations.js +2 -2
  202. package/src/post-terms/edit.js +1 -0
  203. package/src/post-time-to-read/block.json +1 -1
  204. package/src/query/edit/query-content.js +1 -11
  205. package/src/query-no-results/block.json +1 -1
  206. package/src/query-pagination-numbers/edit.js +1 -1
  207. package/src/query-title/edit.js +1 -0
  208. package/src/read-more/edit.js +35 -11
  209. package/src/search/edit.js +99 -74
  210. package/src/separator/edit.js +1 -6
  211. package/src/spacer/controls.js +10 -9
  212. package/src/spacer/edit.js +25 -23
  213. package/src/template-part/edit/advanced-controls.js +1 -21
  214. package/src/utils/messages.js +31 -0
  215. package/src/video/edit-common-settings.js +1 -1
package/src/group/edit.js CHANGED
@@ -18,6 +18,7 @@ import { View } from '@wordpress/primitives';
18
18
  * Internal dependencies
19
19
  */
20
20
  import GroupPlaceHolder, { useShouldShowPlaceHolder } from './placeholder';
21
+ import { htmlElementMessages } from '../utils/messages';
21
22
 
22
23
  /**
23
24
  * Render inspector controls for the Group block.
@@ -29,26 +30,6 @@ import GroupPlaceHolder, { useShouldShowPlaceHolder } from './placeholder';
29
30
  * @return {JSX.Element} The control group.
30
31
  */
31
32
  function GroupEditControls( { tagName, onSelectTagName } ) {
32
- const htmlElementMessages = {
33
- header: __(
34
- 'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'
35
- ),
36
- main: __(
37
- 'The <main> element should be used for the primary content of your document only.'
38
- ),
39
- section: __(
40
- "The <section> element should represent a standalone portion of the document that can't be better represented by another element."
41
- ),
42
- article: __(
43
- 'The <article> element should represent a self-contained, syndicatable portion of the document.'
44
- ),
45
- aside: __(
46
- "The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."
47
- ),
48
- footer: __(
49
- 'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'
50
- ),
51
- };
52
33
  return (
53
34
  <InspectorControls group="advanced">
54
35
  <SelectControl
@@ -51,12 +51,6 @@ export default function HomeEdit( { attributes, setAttributes, context } ) {
51
51
  aria-label={ __( 'Home link text' ) }
52
52
  placeholder={ __( 'Add home link' ) }
53
53
  withoutInteractiveFormatting
54
- allowedFormats={ [
55
- 'core/bold',
56
- 'core/italic',
57
- 'core/image',
58
- 'core/strikethrough',
59
- ] }
60
54
  />
61
55
  </a>
62
56
  </div>
@@ -4,13 +4,19 @@
4
4
  import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
5
5
  import {
6
6
  Disabled,
7
- PanelBody,
8
7
  RangeControl,
9
8
  ToggleControl,
9
+ __experimentalToolsPanel as ToolsPanel,
10
+ __experimentalToolsPanelItem as ToolsPanelItem,
10
11
  } from '@wordpress/components';
11
12
  import ServerSideRender from '@wordpress/server-side-render';
12
13
  import { __ } from '@wordpress/i18n';
13
14
 
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
19
+
14
20
  /**
15
21
  * Minimum number of comments a user can show using this block.
16
22
  *
@@ -36,49 +42,103 @@ export default function LatestComments( { attributes, setAttributes } ) {
36
42
  },
37
43
  };
38
44
 
45
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
46
+
39
47
  return (
40
48
  <div { ...useBlockProps() }>
41
49
  <InspectorControls>
42
- <PanelBody title={ __( 'Settings' ) }>
43
- <ToggleControl
44
- __nextHasNoMarginBottom
50
+ <ToolsPanel
51
+ label={ __( 'Settings' ) }
52
+ resetAll={ () => {
53
+ setAttributes( {
54
+ commentsToShow: 5,
55
+ displayAvatar: true,
56
+ displayDate: true,
57
+ displayExcerpt: true,
58
+ } );
59
+ } }
60
+ dropdownMenuProps={ dropdownMenuProps }
61
+ >
62
+ <ToolsPanelItem
63
+ hasValue={ () => ! displayAvatar }
45
64
  label={ __( 'Display avatar' ) }
46
- checked={ displayAvatar }
47
- onChange={ () =>
48
- setAttributes( { displayAvatar: ! displayAvatar } )
65
+ onDeselect={ () =>
66
+ setAttributes( { displayAvatar: true } )
49
67
  }
50
- />
51
- <ToggleControl
52
- __nextHasNoMarginBottom
68
+ isShownByDefault
69
+ >
70
+ <ToggleControl
71
+ __nextHasNoMarginBottom
72
+ label={ __( 'Display avatar' ) }
73
+ checked={ displayAvatar }
74
+ onChange={ () =>
75
+ setAttributes( {
76
+ displayAvatar: ! displayAvatar,
77
+ } )
78
+ }
79
+ />
80
+ </ToolsPanelItem>
81
+
82
+ <ToolsPanelItem
83
+ hasValue={ () => ! displayDate }
53
84
  label={ __( 'Display date' ) }
54
- checked={ displayDate }
55
- onChange={ () =>
56
- setAttributes( { displayDate: ! displayDate } )
85
+ onDeselect={ () =>
86
+ setAttributes( { displayDate: true } )
57
87
  }
58
- />
59
- <ToggleControl
60
- __nextHasNoMarginBottom
88
+ isShownByDefault
89
+ >
90
+ <ToggleControl
91
+ __nextHasNoMarginBottom
92
+ label={ __( 'Display date' ) }
93
+ checked={ displayDate }
94
+ onChange={ () =>
95
+ setAttributes( { displayDate: ! displayDate } )
96
+ }
97
+ />
98
+ </ToolsPanelItem>
99
+
100
+ <ToolsPanelItem
101
+ hasValue={ () => ! displayExcerpt }
61
102
  label={ __( 'Display excerpt' ) }
62
- checked={ displayExcerpt }
63
- onChange={ () =>
64
- setAttributes( {
65
- displayExcerpt: ! displayExcerpt,
66
- } )
103
+ onDeselect={ () =>
104
+ setAttributes( { displayExcerpt: true } )
67
105
  }
68
- />
69
- <RangeControl
70
- __nextHasNoMarginBottom
71
- __next40pxDefaultSize
106
+ isShownByDefault
107
+ >
108
+ <ToggleControl
109
+ __nextHasNoMarginBottom
110
+ label={ __( 'Display excerpt' ) }
111
+ checked={ displayExcerpt }
112
+ onChange={ () =>
113
+ setAttributes( {
114
+ displayExcerpt: ! displayExcerpt,
115
+ } )
116
+ }
117
+ />
118
+ </ToolsPanelItem>
119
+
120
+ <ToolsPanelItem
121
+ hasValue={ () => commentsToShow !== 5 }
72
122
  label={ __( 'Number of comments' ) }
73
- value={ commentsToShow }
74
- onChange={ ( value ) =>
75
- setAttributes( { commentsToShow: value } )
123
+ onDeselect={ () =>
124
+ setAttributes( { commentsToShow: 5 } )
76
125
  }
77
- min={ MIN_COMMENTS }
78
- max={ MAX_COMMENTS }
79
- required
80
- />
81
- </PanelBody>
126
+ isShownByDefault
127
+ >
128
+ <RangeControl
129
+ __nextHasNoMarginBottom
130
+ __next40pxDefaultSize
131
+ label={ __( 'Number of comments' ) }
132
+ value={ commentsToShow }
133
+ onChange={ ( value ) =>
134
+ setAttributes( { commentsToShow: value } )
135
+ }
136
+ min={ MIN_COMMENTS }
137
+ max={ MAX_COMMENTS }
138
+ required
139
+ />
140
+ </ToolsPanelItem>
141
+ </ToolsPanel>
82
142
  </InspectorControls>
83
143
  <Disabled>
84
144
  <ServerSideRender
@@ -1,3 +1,4 @@
1
1
  export const MIN_EXCERPT_LENGTH = 10;
2
2
  export const MAX_EXCERPT_LENGTH = 100;
3
3
  export const MAX_POSTS_COLUMNS = 6;
4
+ export const DEFAULT_EXCERPT_LENGTH = 55;
@@ -17,6 +17,8 @@ import {
17
17
  ToolbarGroup,
18
18
  __experimentalToggleGroupControl as ToggleGroupControl,
19
19
  __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,
20
+ __experimentalToolsPanel as ToolsPanel,
21
+ __experimentalToolsPanelItem as ToolsPanelItem,
20
22
  } from '@wordpress/components';
21
23
  import { __, _x, sprintf } from '@wordpress/i18n';
22
24
  import { dateI18n, format, getSettings } from '@wordpress/date';
@@ -49,7 +51,9 @@ import {
49
51
  MIN_EXCERPT_LENGTH,
50
52
  MAX_EXCERPT_LENGTH,
51
53
  MAX_POSTS_COLUMNS,
54
+ DEFAULT_EXCERPT_LENGTH,
52
55
  } from './constants';
56
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
53
57
 
54
58
  /**
55
59
  * Module Constants
@@ -77,6 +81,8 @@ function getFeaturedImageDetails( post, size ) {
77
81
 
78
82
  export default function LatestPostsEdit( { attributes, setAttributes } ) {
79
83
  const instanceId = useInstanceId( LatestPostsEdit );
84
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
85
+
80
86
  const {
81
87
  postsToShow,
82
88
  order,
@@ -227,68 +233,137 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
227
233
  const hasPosts = !! latestPosts?.length;
228
234
  const inspectorControls = (
229
235
  <InspectorControls>
230
- <PanelBody title={ __( 'Post content' ) }>
231
- <ToggleControl
232
- __nextHasNoMarginBottom
236
+ <ToolsPanel
237
+ label={ __( 'Post content' ) }
238
+ resetAll={ () =>
239
+ setAttributes( {
240
+ displayPostContent: false,
241
+ displayPostContentRadio: 'excerpt',
242
+ excerptLength: DEFAULT_EXCERPT_LENGTH,
243
+ } )
244
+ }
245
+ dropdownMenuProps={ dropdownMenuProps }
246
+ >
247
+ <ToolsPanelItem
248
+ hasValue={ () => !! displayPostContent }
233
249
  label={ __( 'Post content' ) }
234
- checked={ displayPostContent }
235
- onChange={ ( value ) =>
236
- setAttributes( { displayPostContent: value } )
250
+ onDeselect={ () =>
251
+ setAttributes( { displayPostContent: false } )
237
252
  }
238
- />
253
+ isShownByDefault
254
+ >
255
+ <ToggleControl
256
+ __nextHasNoMarginBottom
257
+ label={ __( 'Post content' ) }
258
+ checked={ displayPostContent }
259
+ onChange={ ( value ) =>
260
+ setAttributes( { displayPostContent: value } )
261
+ }
262
+ />
263
+ </ToolsPanelItem>
239
264
  { displayPostContent && (
240
- <RadioControl
265
+ <ToolsPanelItem
266
+ hasValue={ () => displayPostContentRadio !== 'excerpt' }
241
267
  label={ __( 'Show' ) }
242
- selected={ displayPostContentRadio }
243
- options={ [
244
- { label: __( 'Excerpt' ), value: 'excerpt' },
245
- {
246
- label: __( 'Full post' ),
247
- value: 'full_post',
248
- },
249
- ] }
250
- onChange={ ( value ) =>
268
+ onDeselect={ () =>
251
269
  setAttributes( {
252
- displayPostContentRadio: value,
270
+ displayPostContentRadio: 'excerpt',
253
271
  } )
254
272
  }
255
- />
273
+ isShownByDefault
274
+ >
275
+ <RadioControl
276
+ label={ __( 'Show' ) }
277
+ selected={ displayPostContentRadio }
278
+ options={ [
279
+ { label: __( 'Excerpt' ), value: 'excerpt' },
280
+ {
281
+ label: __( 'Full post' ),
282
+ value: 'full_post',
283
+ },
284
+ ] }
285
+ onChange={ ( value ) =>
286
+ setAttributes( {
287
+ displayPostContentRadio: value,
288
+ } )
289
+ }
290
+ />
291
+ </ToolsPanelItem>
256
292
  ) }
257
293
  { displayPostContent &&
258
294
  displayPostContentRadio === 'excerpt' && (
259
- <RangeControl
260
- __nextHasNoMarginBottom
261
- __next40pxDefaultSize
295
+ <ToolsPanelItem
296
+ hasValue={ () =>
297
+ excerptLength !== DEFAULT_EXCERPT_LENGTH
298
+ }
262
299
  label={ __( 'Max number of words' ) }
263
- value={ excerptLength }
264
- onChange={ ( value ) =>
265
- setAttributes( { excerptLength: value } )
300
+ onDeselect={ () =>
301
+ setAttributes( {
302
+ excerptLength: DEFAULT_EXCERPT_LENGTH,
303
+ } )
266
304
  }
267
- min={ MIN_EXCERPT_LENGTH }
268
- max={ MAX_EXCERPT_LENGTH }
269
- />
305
+ isShownByDefault
306
+ >
307
+ <RangeControl
308
+ __nextHasNoMarginBottom
309
+ __next40pxDefaultSize
310
+ label={ __( 'Max number of words' ) }
311
+ value={ excerptLength }
312
+ onChange={ ( value ) =>
313
+ setAttributes( { excerptLength: value } )
314
+ }
315
+ min={ MIN_EXCERPT_LENGTH }
316
+ max={ MAX_EXCERPT_LENGTH }
317
+ />
318
+ </ToolsPanelItem>
270
319
  ) }
271
- </PanelBody>
320
+ </ToolsPanel>
272
321
 
273
- <PanelBody title={ __( 'Post meta' ) }>
274
- <ToggleControl
275
- __nextHasNoMarginBottom
322
+ <ToolsPanel
323
+ label={ __( 'Post meta' ) }
324
+ resetAll={ () =>
325
+ setAttributes( {
326
+ displayAuthor: false,
327
+ displayPostDate: false,
328
+ } )
329
+ }
330
+ dropdownMenuProps={ dropdownMenuProps }
331
+ >
332
+ <ToolsPanelItem
333
+ hasValue={ () => !! displayAuthor }
276
334
  label={ __( 'Display author name' ) }
277
- checked={ displayAuthor }
278
- onChange={ ( value ) =>
279
- setAttributes( { displayAuthor: value } )
335
+ onDeselect={ () =>
336
+ setAttributes( { displayAuthor: false } )
280
337
  }
281
- />
282
- <ToggleControl
283
- __nextHasNoMarginBottom
338
+ isShownByDefault
339
+ >
340
+ <ToggleControl
341
+ __nextHasNoMarginBottom
342
+ label={ __( 'Display author name' ) }
343
+ checked={ displayAuthor }
344
+ onChange={ ( value ) =>
345
+ setAttributes( { displayAuthor: value } )
346
+ }
347
+ />
348
+ </ToolsPanelItem>
349
+ <ToolsPanelItem
350
+ hasValue={ () => !! displayPostDate }
284
351
  label={ __( 'Display post date' ) }
285
- checked={ displayPostDate }
286
- onChange={ ( value ) =>
287
- setAttributes( { displayPostDate: value } )
352
+ onDeselect={ () =>
353
+ setAttributes( { displayPostDate: false } )
288
354
  }
289
- />
290
- </PanelBody>
291
-
355
+ isShownByDefault
356
+ >
357
+ <ToggleControl
358
+ __nextHasNoMarginBottom
359
+ label={ __( 'Display post date' ) }
360
+ checked={ displayPostDate }
361
+ onChange={ ( value ) =>
362
+ setAttributes( { displayPostDate: value } )
363
+ }
364
+ />
365
+ </ToolsPanelItem>
366
+ </ToolsPanel>
292
367
  <PanelBody title={ __( 'Featured image' ) }>
293
368
  <ToggleControl
294
369
  __nextHasNoMarginBottom
@@ -50,7 +50,7 @@ describe( 'List block', () => {
50
50
  await triggerBlockListLayout( listBlock );
51
51
 
52
52
  // Get List item
53
- const listItemBlock = await getBlock( screen, 'List item' );
53
+ const listItemBlock = await getBlock( screen, 'List Item' );
54
54
  fireEvent.press( listItemBlock );
55
55
 
56
56
  expect( listItemBlock ).toBeVisible();
@@ -75,7 +75,7 @@ describe( 'List block', () => {
75
75
 
76
76
  // Select List Item block
77
77
  const [ listItemBlock ] = screen.getAllByLabelText(
78
- /List item Block\. Row 1/
78
+ /List Item Block\. Row 1/
79
79
  );
80
80
  fireEvent.press( listItemBlock );
81
81
 
@@ -124,7 +124,7 @@ describe( 'List block', () => {
124
124
 
125
125
  // Select List Item block
126
126
  const [ firstNestedLevelBlock ] = within( listBlock ).getAllByLabelText(
127
- /List item Block\. Row 2/
127
+ /List Item Block\. Row 2/
128
128
  );
129
129
  fireEvent.press( firstNestedLevelBlock );
130
130
  await triggerBlockListLayout( firstNestedLevelBlock );
@@ -159,7 +159,7 @@ describe( 'List block', () => {
159
159
 
160
160
  // Select Second List Item block
161
161
  const [ listItemBlock ] = screen.getAllByLabelText(
162
- /List item Block\. Row 2/
162
+ /List Item Block\. Row 2/
163
163
  );
164
164
  fireEvent.press( listItemBlock );
165
165
 
@@ -169,7 +169,7 @@ describe( 'List block', () => {
169
169
 
170
170
  // Await recently indented list item layout
171
171
  const [ listItemBlock1 ] = screen.getAllByLabelText(
172
- /List item Block\. Row 1/
172
+ /List Item Block\. Row 1/
173
173
  );
174
174
  await triggerBlockListLayout( listItemBlock1 );
175
175
 
@@ -203,7 +203,7 @@ describe( 'List block', () => {
203
203
 
204
204
  // Select List Item block
205
205
  const [ firstNestedLevelBlock ] = within( listBlock ).getAllByLabelText(
206
- /List item Block\. Row 1/
206
+ /List Item Block\. Row 1/
207
207
  );
208
208
  fireEvent.press( firstNestedLevelBlock );
209
209
  await triggerBlockListLayout( firstNestedLevelBlock );
@@ -217,7 +217,7 @@ describe( 'List block', () => {
217
217
 
218
218
  // Select nested List Item block
219
219
  const [ listItemBlock ] = within( innerBlockList ).getAllByLabelText(
220
- /List item Block\. Row 1/
220
+ /List Item Block\. Row 1/
221
221
  );
222
222
  fireEvent.press( listItemBlock );
223
223
 
@@ -500,7 +500,7 @@ describe( 'List block', () => {
500
500
 
501
501
  // Select List Item block
502
502
  const [ listItemBlock ] = within( listBlock ).getAllByLabelText(
503
- /List item Block\. Row 1/
503
+ /List Item Block\. Row 1/
504
504
  );
505
505
  fireEvent.press( listItemBlock );
506
506
 
@@ -560,7 +560,7 @@ describe( 'List block', () => {
560
560
 
561
561
  // Select List Item block
562
562
  const [ listItemBlock ] = within( listBlock ).getAllByLabelText(
563
- /List item Block\. Row 1/
563
+ /List Item Block\. Row 1/
564
564
  );
565
565
  fireEvent.press( listItemBlock );
566
566
 
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://schemas.wp.org/trunk/block.json",
3
3
  "apiVersion": 3,
4
4
  "name": "core/list-item",
5
- "title": "List item",
5
+ "title": "List Item",
6
6
  "category": "text",
7
7
  "parent": [ "core/list" ],
8
8
  "allowedBlocks": [ "core/list" ],
@@ -47,7 +47,7 @@ function useConvertClassicToBlockMenu(
47
47
  } catch ( err ) {
48
48
  throw new Error(
49
49
  sprintf(
50
- // translators: %s: the name of a menu (e.g. Header navigation).
50
+ // translators: %s: The name of a menu (e.g. Header menu).
51
51
  __( `Unable to fetch classic menu "%s" from API.` ),
52
52
  menuName
53
53
  ),
@@ -61,7 +61,7 @@ function useConvertClassicToBlockMenu(
61
61
  if ( classicMenuItems === null ) {
62
62
  throw new Error(
63
63
  sprintf(
64
- // translators: %s: the name of a menu (e.g. Header navigation).
64
+ // translators: %s: The name of a menu (e.g. Header menu).
65
65
  __( `Unable to fetch classic menu "%s" from API.` ),
66
66
  menuName
67
67
  )
@@ -98,7 +98,7 @@ function useConvertClassicToBlockMenu(
98
98
  } catch ( err ) {
99
99
  throw new Error(
100
100
  sprintf(
101
- // translators: %s: the name of a menu (e.g. Header navigation).
101
+ // translators: %s: The name of a menu (e.g. Header menu).
102
102
  __( `Unable to create Navigation Menu "%s".` ),
103
103
  menuName
104
104
  ),
@@ -155,7 +155,7 @@ function useConvertClassicToBlockMenu(
155
155
  if ( throwOnError ) {
156
156
  throw new Error(
157
157
  sprintf(
158
- // translators: %s: the name of a menu (e.g. Header navigation).
158
+ // translators: %s: The name of a menu (e.g. Header menu).
159
159
  __( `Unable to create Navigation Menu "%s".` ),
160
160
  menuName
161
161
  ),
@@ -50,12 +50,12 @@ export default function useGenerateDefaultNavigationTitle( clientId ) {
50
50
 
51
51
  const title = area
52
52
  ? sprintf(
53
- // translators: %s: the name of a menu (e.g. Header navigation).
54
- __( '%s navigation' ),
53
+ // translators: %s: the name of a menu (e.g. Header menu).
54
+ __( '%s menu' ),
55
55
  area
56
56
  )
57
- : // translators: 'navigation' as in website navigation.
58
- __( 'Navigation' );
57
+ : // translators: 'menu' as in website navigation menu.
58
+ __( 'Menu' );
59
59
 
60
60
  // Determine how many menus start with the automatic title.
61
61
  const matchingMenuTitleCount = [
@@ -14,7 +14,6 @@ import {
14
14
  TextControl,
15
15
  TextareaControl,
16
16
  ToolbarButton,
17
- Tooltip,
18
17
  ToolbarGroup,
19
18
  } from '@wordpress/components';
20
19
  import { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';
@@ -490,10 +489,6 @@ export default function NavigationLinkEdit( {
490
489
  const placeholderText = `(${
491
490
  isInvalid ? __( 'Invalid' ) : __( 'Draft' )
492
491
  })`;
493
- const tooltipText =
494
- isInvalid || isDraft
495
- ? __( 'This item has been deleted, or is a draft' )
496
- : __( 'This item is missing a link' );
497
492
 
498
493
  return (
499
494
  <>
@@ -533,9 +528,7 @@ export default function NavigationLinkEdit( {
533
528
  { /* eslint-enable */ }
534
529
  { ! url ? (
535
530
  <div className="wp-block-navigation-link__placeholder-text">
536
- <Tooltip text={ tooltipText }>
537
- <span>{ missingText }</span>
538
- </Tooltip>
531
+ <span>{ missingText }</span>
539
532
  </div>
540
533
  ) : (
541
534
  <>
@@ -578,27 +571,30 @@ export default function NavigationLinkEdit( {
578
571
  { ( isInvalid ||
579
572
  isDraft ||
580
573
  isLabelFieldFocused ) && (
581
- <div className="wp-block-navigation-link__placeholder-text wp-block-navigation-link__label">
582
- <Tooltip text={ tooltipText }>
583
- <span
584
- aria-label={ __(
585
- 'Navigation link text'
586
- ) }
587
- >
588
- {
589
- // Some attributes are stored in an escaped form. It's a legacy issue.
590
- // Ideally they would be stored in a raw, unescaped form.
591
- // Unescape is used here to "recover" the escaped characters
592
- // so they display without encoding.
593
- // See `updateAttributes` for more details.
594
- `${ decodeEntities( label ) } ${
595
- isInvalid || isDraft
596
- ? placeholderText
597
- : ''
598
- }`.trim()
599
- }
600
- </span>
601
- </Tooltip>
574
+ <div
575
+ className={ clsx(
576
+ 'wp-block-navigation-link__placeholder-text',
577
+ 'wp-block-navigation-link__label',
578
+ {
579
+ 'is-invalid': isInvalid,
580
+ 'is-draft': isDraft,
581
+ }
582
+ ) }
583
+ >
584
+ <span>
585
+ {
586
+ // Some attributes are stored in an escaped form. It's a legacy issue.
587
+ // Ideally they would be stored in a raw, unescaped form.
588
+ // Unescape is used here to "recover" the escaped characters
589
+ // so they display without encoding.
590
+ // See `updateAttributes` for more details.
591
+ `${ decodeEntities( label ) } ${
592
+ isInvalid || isDraft
593
+ ? placeholderText
594
+ : ''
595
+ }`.trim()
596
+ }
597
+ </span>
602
598
  </div>
603
599
  ) }
604
600
  </>