@wordpress/block-library 9.19.4 → 9.19.6

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 (49) hide show
  1. package/build/details/edit.js +28 -8
  2. package/build/details/edit.js.map +1 -1
  3. package/build/embed/variations.js +0 -10
  4. package/build/embed/variations.js.map +1 -1
  5. package/build/image/edit.js +0 -6
  6. package/build/image/edit.js.map +1 -1
  7. package/build/navigation-link/edit.js +27 -8
  8. package/build/navigation-link/edit.js.map +1 -1
  9. package/build/post-template/edit.js +5 -3
  10. package/build/post-template/edit.js.map +1 -1
  11. package/build/query/edit/inspector-controls/index.js +30 -19
  12. package/build/query/edit/inspector-controls/index.js.map +1 -1
  13. package/build/query/edit/query-content.js +1 -6
  14. package/build/query/edit/query-content.js.map +1 -1
  15. package/build-module/details/edit.js +30 -10
  16. package/build-module/details/edit.js.map +1 -1
  17. package/build-module/embed/variations.js +0 -10
  18. package/build-module/embed/variations.js.map +1 -1
  19. package/build-module/image/edit.js +0 -6
  20. package/build-module/image/edit.js.map +1 -1
  21. package/build-module/navigation-link/edit.js +28 -9
  22. package/build-module/navigation-link/edit.js.map +1 -1
  23. package/build-module/post-template/edit.js +5 -3
  24. package/build-module/post-template/edit.js.map +1 -1
  25. package/build-module/query/edit/inspector-controls/index.js +31 -20
  26. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  27. package/build-module/query/edit/query-content.js +1 -6
  28. package/build-module/query/edit/query-content.js.map +1 -1
  29. package/build-style/button/style-rtl.css +0 -1
  30. package/build-style/button/style.css +0 -1
  31. package/build-style/buttons/style-rtl.css +3 -0
  32. package/build-style/buttons/style.css +3 -0
  33. package/build-style/post-comments-form/style-rtl.css +0 -3
  34. package/build-style/post-comments-form/style.css +0 -3
  35. package/build-style/style-rtl.css +3 -4
  36. package/build-style/style.css +3 -4
  37. package/package.json +18 -18
  38. package/src/button/style.scss +0 -1
  39. package/src/buttons/style.scss +5 -0
  40. package/src/details/edit.js +38 -8
  41. package/src/embed/variations.js +0 -8
  42. package/src/image/edit.js +0 -4
  43. package/src/navigation-link/edit.js +45 -11
  44. package/src/post-author/index.php +1 -1
  45. package/src/post-author-name/index.php +1 -1
  46. package/src/post-comments-form/style.scss +0 -5
  47. package/src/post-template/edit.js +4 -3
  48. package/src/query/edit/inspector-controls/index.js +50 -34
  49. package/src/query/edit/query-content.js +2 -8
@@ -5,11 +5,12 @@ import {
5
5
  TextControl,
6
6
  SelectControl,
7
7
  RangeControl,
8
- __experimentalToggleGroupControl as ToggleGroupControl,
9
- __experimentalToggleGroupControlOption as ToggleGroupControlOption,
10
8
  Notice,
9
+ __experimentalVStack as VStack,
11
10
  __experimentalToolsPanel as ToolsPanel,
12
11
  __experimentalToolsPanelItem as ToolsPanelItem,
12
+ __experimentalToggleGroupControl as ToggleGroupControl,
13
+ __experimentalToggleGroupControlOption as ToggleGroupControlOption,
13
14
  } from '@wordpress/components';
14
15
  import { useSelect } from '@wordpress/data';
15
16
  import { store as coreStore } from '@wordpress/core-data';
@@ -113,8 +114,7 @@ export default function QueryInspectorControls( props ) {
113
114
  }, [ querySearch, onChangeDebounced ] );
114
115
 
115
116
  const orderByOptions = useOrderByOptions( postType );
116
- const showInheritControl =
117
- ! isSingular && isControlAllowed( allowedControls, 'inherit' );
117
+ const showInheritControl = isControlAllowed( allowedControls, 'inherit' );
118
118
  const showPostTypeControl =
119
119
  ! inherit && isControlAllowed( allowedControls, 'postType' );
120
120
  const postTypeControlLabel = __( 'Post type' );
@@ -185,6 +185,10 @@ export default function QueryInspectorControls( props ) {
185
185
  const showDisplayPanel =
186
186
  showPostCountControl || showOffSetControl || showPagesControl;
187
187
 
188
+ // The block cannot inherit a default WordPress query in singular content (e.g., post, page, 404, blank).
189
+ // Warn users but still permit this type of query for exceptional cases in Classic and Hybrid themes.
190
+ const hasInheritanceWarning = isSingular && inherit;
191
+
188
192
  return (
189
193
  <>
190
194
  { showSettingsPanel && (
@@ -208,36 +212,48 @@ export default function QueryInspectorControls( props ) {
208
212
  onDeselect={ () => setQuery( { inherit: true } ) }
209
213
  isShownByDefault
210
214
  >
211
- <ToggleGroupControl
212
- __next40pxDefaultSize
213
- __nextHasNoMarginBottom
214
- label={ __( 'Query type' ) }
215
- isBlock
216
- onChange={ ( value ) => {
217
- setQuery( {
218
- inherit: value === 'default',
219
- } );
220
- } }
221
- help={
222
- inherit
223
- ? __(
224
- 'Display a list of posts or custom post types based on the current template.'
225
- )
226
- : __(
227
- 'Display a list of posts or custom post types based on specific criteria.'
228
- )
229
- }
230
- value={ !! inherit ? 'default' : 'custom' }
231
- >
232
- <ToggleGroupControlOption
233
- value="default"
234
- label={ __( 'Default' ) }
235
- />
236
- <ToggleGroupControlOption
237
- value="custom"
238
- label={ __( 'Custom' ) }
239
- />
240
- </ToggleGroupControl>
215
+ <VStack spacing={ 4 }>
216
+ <ToggleGroupControl
217
+ __next40pxDefaultSize
218
+ __nextHasNoMarginBottom
219
+ label={ __( 'Query type' ) }
220
+ isBlock
221
+ onChange={ ( value ) => {
222
+ setQuery( {
223
+ inherit: value === 'default',
224
+ } );
225
+ } }
226
+ help={
227
+ inherit
228
+ ? __(
229
+ 'Display a list of posts or custom post types based on the current template.'
230
+ )
231
+ : __(
232
+ 'Display a list of posts or custom post types based on specific criteria.'
233
+ )
234
+ }
235
+ value={ !! inherit ? 'default' : 'custom' }
236
+ >
237
+ <ToggleGroupControlOption
238
+ value="default"
239
+ label={ __( 'Default' ) }
240
+ />
241
+ <ToggleGroupControlOption
242
+ value="custom"
243
+ label={ __( 'Custom' ) }
244
+ />
245
+ </ToggleGroupControl>
246
+ { hasInheritanceWarning && (
247
+ <Notice
248
+ status="warning"
249
+ isDismissible={ false }
250
+ >
251
+ { __(
252
+ 'Cannot inherit the current template query when placed inside the singular content (e.g., post, page, 404, blank).'
253
+ ) }
254
+ </Notice>
255
+ ) }
256
+ </VStack>
241
257
  </ToolsPanelItem>
242
258
  ) }
243
259
 
@@ -98,21 +98,15 @@ export default function QueryContent( {
98
98
  } else if ( ! query.perPage && postsPerPage ) {
99
99
  newQuery.perPage = postsPerPage;
100
100
  }
101
- // We need to reset the `inherit` value if in a singular template, as queries
102
- // are not inherited when in singular content (e.g. post, page, 404, blank).
103
- if ( isSingular && query.inherit ) {
104
- newQuery.inherit = false;
105
- }
101
+
106
102
  if ( !! Object.keys( newQuery ).length ) {
107
103
  __unstableMarkNextChangeAsNotPersistent();
108
104
  updateQuery( newQuery );
109
105
  }
110
106
  }, [
111
107
  query.perPage,
112
- query.inherit,
113
- postsPerPage,
114
108
  inherit,
115
- isSingular,
109
+ postsPerPage,
116
110
  __unstableMarkNextChangeAsNotPersistent,
117
111
  updateQuery,
118
112
  ] );