@wordpress/block-library 9.0.4 → 9.0.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 (45) hide show
  1. package/build/block/index.js +5 -1
  2. package/build/block/index.js.map +1 -1
  3. package/build/image/image.js +11 -13
  4. package/build/image/image.js.map +1 -1
  5. package/build/list-item/hooks/use-merge.js +8 -1
  6. package/build/list-item/hooks/use-merge.js.map +1 -1
  7. package/build/media-text/edit.js +3 -2
  8. package/build/media-text/edit.js.map +1 -1
  9. package/build/query/edit/inspector-controls/index.js +3 -2
  10. package/build/query/edit/inspector-controls/index.js.map +1 -1
  11. package/build/utils/hooks.js +12 -0
  12. package/build/utils/hooks.js.map +1 -1
  13. package/build-module/block/index.js +5 -1
  14. package/build-module/block/index.js.map +1 -1
  15. package/build-module/image/image.js +6 -8
  16. package/build-module/image/image.js.map +1 -1
  17. package/build-module/list-item/hooks/use-merge.js +8 -1
  18. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  19. package/build-module/media-text/edit.js +3 -2
  20. package/build-module/media-text/edit.js.map +1 -1
  21. package/build-module/query/edit/inspector-controls/index.js +3 -2
  22. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  23. package/build-module/utils/hooks.js +11 -0
  24. package/build-module/utils/hooks.js.map +1 -1
  25. package/build-style/post-comments-form/style-rtl.css +11 -10
  26. package/build-style/post-comments-form/style.css +11 -10
  27. package/build-style/social-links/style-rtl.css +91 -91
  28. package/build-style/social-links/style.css +91 -91
  29. package/build-style/style-rtl.css +102 -101
  30. package/build-style/style.css +102 -101
  31. package/package.json +6 -6
  32. package/src/block/block.json +5 -1
  33. package/src/image/image.js +12 -9
  34. package/src/image/index.php +26 -5
  35. package/src/list-item/hooks/use-merge.js +19 -5
  36. package/src/media-text/edit.js +3 -2
  37. package/src/post-comments-form/style.scss +15 -12
  38. package/src/query/edit/inspector-controls/index.js +3 -2
  39. package/src/social-links/style.scss +2 -2
  40. package/src/utils/hooks.js +14 -0
  41. package/build/utils/constants.js +0 -15
  42. package/build/utils/constants.js.map +0 -1
  43. package/build-module/utils/constants.js +0 -9
  44. package/build-module/utils/constants.js.map +0 -1
  45. package/src/utils/constants.js +0 -8
@@ -46,7 +46,7 @@ import {
46
46
  TEMPLATE,
47
47
  } from './constants';
48
48
  import { unlock } from '../lock-unlock';
49
- import { TOOLSPANEL_DROPDOWNMENU_PROPS } from '../utils/constants';
49
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
50
50
 
51
51
  const { ResolutionTool } = unlock( blockEditorPrivateApis );
52
52
 
@@ -276,6 +276,7 @@ function MediaTextEdit( {
276
276
  mediaSizeSlug: newMediaSizeSlug,
277
277
  } );
278
278
  };
279
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
279
280
 
280
281
  const mediaTextGeneralSettings = (
281
282
  <ToolsPanel
@@ -290,7 +291,7 @@ function MediaTextEdit( {
290
291
  mediaSizeSlug: undefined,
291
292
  } );
292
293
  } }
293
- dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }
294
+ dropdownMenuProps={ dropdownMenuProps }
294
295
  >
295
296
  <ToolsPanelItem
296
297
  label={ __( 'Media width' ) }
@@ -1,3 +1,18 @@
1
+ // Allow these default styles to be overridden by global styles.
2
+ :where(.wp-block-post-comments-form) {
3
+ textarea,
4
+ input:not([type="submit"]) {
5
+ border: 1px solid $gray-600;
6
+ font-size: 1em;
7
+ font-family: inherit;
8
+ }
9
+
10
+ textarea,
11
+ input:where(:not([type="submit"]):not([type="checkbox"])) {
12
+ padding: calc(0.667em + 2px); // The extra 2px is added to match outline buttons.
13
+ }
14
+ }
15
+
1
16
  .wp-block-post-comments-form {
2
17
  // This block has customizable padding, border-box makes that more predictable.
3
18
  box-sizing: border-box;
@@ -31,18 +46,6 @@
31
46
  overflow-wrap: break-word;
32
47
  }
33
48
 
34
- textarea,
35
- input:not([type="submit"]) {
36
- border: 1px solid $gray-600;
37
- font-size: 1em;
38
- font-family: inherit;
39
- }
40
-
41
- textarea,
42
- input:not([type="submit"]):not([type="checkbox"]) {
43
- padding: calc(0.667em + 2px); // The extra 2px is added to match outline buttons.
44
- }
45
-
46
49
  .comment-form {
47
50
  textarea,
48
51
  // Make sure to not set display block on hidden input fields, to prevent
@@ -34,7 +34,7 @@ import {
34
34
  isControlAllowed,
35
35
  useTaxonomies,
36
36
  } from '../../utils';
37
- import { TOOLSPANEL_DROPDOWNMENU_PROPS } from '../../../utils/constants';
37
+ import { useToolsPanelDropdownMenuProps } from '../../../utils/hooks';
38
38
 
39
39
  const { BlockInfo } = unlock( blockEditorPrivateApis );
40
40
 
@@ -128,6 +128,7 @@ export default function QueryInspectorControls( props ) {
128
128
  showAuthorControl ||
129
129
  showSearchControl ||
130
130
  showParentControl;
131
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
131
132
 
132
133
  return (
133
134
  <>
@@ -221,7 +222,7 @@ export default function QueryInspectorControls( props ) {
221
222
  } );
222
223
  setQuerySearch( '' );
223
224
  } }
224
- dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }
225
+ dropdownMenuProps={ dropdownMenuProps }
225
226
  >
226
227
  { showTaxControl && (
227
228
  <ToolsPanelItem
@@ -107,7 +107,7 @@
107
107
  }
108
108
 
109
109
  // Provide colors for a range of icons.
110
- .wp-block-social-links:not(.is-style-logos-only) {
110
+ :where(.wp-block-social-links:not(.is-style-logos-only)) {
111
111
  // Generic items such as mail, feed, etc.
112
112
  @import "../social-link/socials-with-bg.scss";
113
113
  }
@@ -116,7 +116,7 @@
116
116
  // The specificity for this selector has not been reduced to 0-1-0 as per
117
117
  // global styles variation selectors as the lack of background should be
118
118
  // enforced for this block style.
119
- .wp-block-social-links.is-style-logos-only {
119
+ :where(.wp-block-social-links.is-style-logos-only) {
120
120
  .wp-social-link {
121
121
  background: none;
122
122
 
@@ -6,6 +6,7 @@ import { useLayoutEffect, useEffect, useRef } from '@wordpress/element';
6
6
  import { getBlobByURL, isBlobURL, revokeBlobURL } from '@wordpress/blob';
7
7
  import { store as blockEditorStore } from '@wordpress/block-editor';
8
8
  import { store as coreStore } from '@wordpress/core-data';
9
+ import { useViewportMatch } from '@wordpress/compose';
9
10
 
10
11
  /**
11
12
  * Returns whether the current user can edit the given entity.
@@ -84,3 +85,16 @@ export function useUploadMediaFromBlobURL( args = {} ) {
84
85
  } );
85
86
  }, [ getSettings ] );
86
87
  }
88
+
89
+ export function useToolsPanelDropdownMenuProps() {
90
+ const isMobile = useViewportMatch( 'medium', '<' );
91
+ return ! isMobile
92
+ ? {
93
+ popoverProps: {
94
+ placement: 'left-start',
95
+ // For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
96
+ offset: 259,
97
+ },
98
+ }
99
+ : {};
100
+ }
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.TOOLSPANEL_DROPDOWNMENU_PROPS = void 0;
7
- // The following dropdown menu props aim to provide a consistent offset and
8
- // placement for ToolsPanel menus for block controls to match color popovers.
9
- const TOOLSPANEL_DROPDOWNMENU_PROPS = exports.TOOLSPANEL_DROPDOWNMENU_PROPS = {
10
- popoverProps: {
11
- placement: 'left-start',
12
- offset: 259 // Inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
13
- }
14
- };
15
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["TOOLSPANEL_DROPDOWNMENU_PROPS","exports","popoverProps","placement","offset"],"sources":["@wordpress/block-library/src/utils/constants.js"],"sourcesContent":["// The following dropdown menu props aim to provide a consistent offset and\n// placement for ToolsPanel menus for block controls to match color popovers.\nexport const TOOLSPANEL_DROPDOWNMENU_PROPS = {\n\tpopoverProps: {\n\t\tplacement: 'left-start',\n\t\toffset: 259, // Inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t},\n};\n"],"mappings":";;;;;;AAAA;AACA;AACO,MAAMA,6BAA6B,GAAAC,OAAA,CAAAD,6BAAA,GAAG;EAC5CE,YAAY,EAAE;IACbC,SAAS,EAAE,YAAY;IACvBC,MAAM,EAAE,GAAG,CAAE;EACd;AACD,CAAC","ignoreList":[]}
@@ -1,9 +0,0 @@
1
- // The following dropdown menu props aim to provide a consistent offset and
2
- // placement for ToolsPanel menus for block controls to match color popovers.
3
- export const TOOLSPANEL_DROPDOWNMENU_PROPS = {
4
- popoverProps: {
5
- placement: 'left-start',
6
- offset: 259 // Inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
7
- }
8
- };
9
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["TOOLSPANEL_DROPDOWNMENU_PROPS","popoverProps","placement","offset"],"sources":["@wordpress/block-library/src/utils/constants.js"],"sourcesContent":["// The following dropdown menu props aim to provide a consistent offset and\n// placement for ToolsPanel menus for block controls to match color popovers.\nexport const TOOLSPANEL_DROPDOWNMENU_PROPS = {\n\tpopoverProps: {\n\t\tplacement: 'left-start',\n\t\toffset: 259, // Inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA,OAAO,MAAMA,6BAA6B,GAAG;EAC5CC,YAAY,EAAE;IACbC,SAAS,EAAE,YAAY;IACvBC,MAAM,EAAE,GAAG,CAAE;EACd;AACD,CAAC","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- // The following dropdown menu props aim to provide a consistent offset and
2
- // placement for ToolsPanel menus for block controls to match color popovers.
3
- export const TOOLSPANEL_DROPDOWNMENU_PROPS = {
4
- popoverProps: {
5
- placement: 'left-start',
6
- offset: 259, // Inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
7
- },
8
- };