@wordpress/block-library 9.33.8 → 9.33.10

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 (65) hide show
  1. package/build/accordion/view.js +46 -4
  2. package/build/accordion/view.js.map +2 -2
  3. package/build/accordion-heading/block.json +1 -1
  4. package/build/accordion-heading/deprecated.js +121 -2
  5. package/build/accordion-heading/deprecated.js.map +2 -2
  6. package/build/accordion-heading/save.js +1 -0
  7. package/build/accordion-heading/save.js.map +2 -2
  8. package/build/accordion-panel/block.json +1 -1
  9. package/build/freeform/block.json +1 -2
  10. package/build/math/edit.js +4 -1
  11. package/build/math/edit.js.map +2 -2
  12. package/build/missing/block.json +1 -1
  13. package/build/navigation-link/edit.js +1 -1
  14. package/build/navigation-link/edit.js.map +2 -2
  15. package/build/pattern/block.json +1 -1
  16. package/build-module/accordion/view.js +46 -4
  17. package/build-module/accordion/view.js.map +2 -2
  18. package/build-module/accordion-heading/block.json +1 -1
  19. package/build-module/accordion-heading/deprecated.js +123 -3
  20. package/build-module/accordion-heading/deprecated.js.map +2 -2
  21. package/build-module/accordion-heading/save.js +1 -0
  22. package/build-module/accordion-heading/save.js.map +2 -2
  23. package/build-module/accordion-panel/block.json +1 -1
  24. package/build-module/freeform/block.json +1 -2
  25. package/build-module/math/edit.js +4 -1
  26. package/build-module/math/edit.js.map +2 -2
  27. package/build-module/missing/block.json +1 -1
  28. package/build-module/navigation-link/edit.js +1 -1
  29. package/build-module/navigation-link/edit.js.map +2 -2
  30. package/build-module/pattern/block.json +1 -1
  31. package/build-style/accordion/style-rtl.css +3 -0
  32. package/build-style/accordion/style.css +3 -0
  33. package/build-style/accordion-heading/style-rtl.css +2 -19
  34. package/build-style/accordion-heading/style.css +2 -19
  35. package/build-style/accordion-item/style-rtl.css +0 -7
  36. package/build-style/accordion-item/style.css +0 -7
  37. package/build-style/accordion-panel/style-rtl.css +1 -4
  38. package/build-style/accordion-panel/style.css +1 -4
  39. package/build-style/classic-rtl.css +24 -0
  40. package/build-style/classic.css +24 -0
  41. package/build-style/media-text/style-rtl.css +2 -0
  42. package/build-style/media-text/style.css +2 -0
  43. package/build-style/style-rtl.css +8 -29
  44. package/build-style/style.css +8 -29
  45. package/package.json +11 -11
  46. package/src/accordion/style.scss +4 -0
  47. package/src/accordion/view.js +60 -3
  48. package/src/accordion-heading/block.json +1 -1
  49. package/src/accordion-heading/deprecated.js +123 -2
  50. package/src/accordion-heading/save.js +1 -0
  51. package/src/accordion-heading/style.scss +2 -38
  52. package/src/accordion-item/index.php +1 -0
  53. package/src/accordion-item/style.scss +2 -9
  54. package/src/accordion-panel/block.json +1 -1
  55. package/src/accordion-panel/style.scss +1 -5
  56. package/src/classic.scss +38 -0
  57. package/src/embed/test/index.js +2 -0
  58. package/src/freeform/block.json +1 -2
  59. package/src/math/edit.js +4 -1
  60. package/src/media-text/style.scss +2 -0
  61. package/src/missing/block.json +1 -1
  62. package/src/navigation-link/edit.js +1 -1
  63. package/src/pattern/block.json +1 -1
  64. package/src/style.scss +1 -0
  65. package/src/term-template/index.php +1 -1
@@ -19,6 +19,7 @@ export default function save( { attributes } ) {
19
19
  return (
20
20
  <TagName { ...blockProps }>
21
21
  <button
22
+ type="button"
22
23
  className="wp-block-accordion-heading__toggle"
23
24
  style={ spacingProps.style }
24
25
  >
@@ -1,17 +1,3 @@
1
- // In many classic themes, selectors like `.entry-content h1` are used,
2
- // potentially applying relatively high specificity (such as `0-1-1`) to
3
- // heading elements. To properly override those styles, use a selector
4
- // with a specificity of `0-2-0`.
5
- .wp-block-accordion-heading.wp-block-accordion-heading {
6
- // Some themes may have an explicit width. Since it's unpredictable
7
- // what CSS specificity should be used to override them, ensure 100%
8
- // width using min-width instead.
9
- min-width: 100%;
10
- // Some classic themes apply default margins to heading elements,
11
- // so those styles need to be reset.
12
- margin: 0;
13
- }
14
-
15
1
  .wp-block-accordion-heading__toggle {
16
2
  font-family: inherit;
17
3
  font-size: inherit;
@@ -22,7 +8,9 @@
22
8
  text-decoration: inherit;
23
9
  word-spacing: inherit;
24
10
  font-style: inherit;
11
+ background: none;
25
12
  border: none;
13
+ color: inherit;
26
14
  padding: var(--wp--preset--spacing--20, 1em) 0;
27
15
  cursor: pointer;
28
16
  overflow: hidden;
@@ -31,34 +19,10 @@
31
19
  text-align: inherit;
32
20
  width: 100%;
33
21
 
34
- // Some themes may apply colors to button elements with a particularly
35
- // high CSS specificity. Since it's impossible to predict this specificity,
36
- // we reset the colors using `!important`.
37
- background-color: inherit !important;
38
- color: inherit !important;
39
-
40
22
  &:not(:focus-visible) {
41
23
  outline: none;
42
24
  }
43
25
 
44
- &:hover,
45
- &:focus {
46
- // Some themes may apply styles when a button element is hovered
47
- // over or focused. This is not intended for accordion toggle
48
- // buttons, so we reset it here.
49
- text-decoration: none;
50
- background-color: inherit !important;
51
- box-shadow: none;
52
- color: inherit;
53
- border: none;
54
- padding: var(--wp--preset--spacing--20, 1em) 0;
55
- }
56
-
57
- &:focus-visible {
58
- outline: auto;
59
- outline-offset: 0;
60
- }
61
-
62
26
  &:hover .wp-block-accordion-heading__toggle-title {
63
27
  text-decoration: underline;
64
28
  }
@@ -36,6 +36,7 @@ function block_core_accordion_item_render( $attributes, $content ) {
36
36
  $p->set_attribute( 'data-wp-context', '{ "id": "' . $unique_id . '", "openByDefault": ' . $open_by_default . ' }' );
37
37
  $p->set_attribute( 'data-wp-class--is-open', 'state.isOpen' );
38
38
  $p->set_attribute( 'data-wp-init', 'callbacks.initAccordionItems' );
39
+ $p->set_attribute( 'data-wp-on-window--hashchange', 'callbacks.hashChange' );
39
40
 
40
41
  if ( $p->next_tag( array( 'class_name' => 'wp-block-accordion-heading__toggle' ) ) ) {
41
42
  $p->set_attribute( 'data-wp-on--click', 'actions.toggle' );
@@ -1,13 +1,6 @@
1
1
  .wp-block-accordion-item {
2
- display: grid;
3
- grid-template-rows: max-content 0fr;
4
-
5
- &.is-open {
6
- grid-template-rows: max-content 1fr;
7
-
8
- > .wp-block-accordion-heading .wp-block-accordion-heading__toggle-icon {
9
- transform: rotate(45deg);
10
- }
2
+ &.is-open > .wp-block-accordion-heading .wp-block-accordion-heading__toggle-icon {
3
+ transform: rotate(45deg);
11
4
  }
12
5
 
13
6
  /* Add transitions only for users who do not prefer reduced motion */
@@ -50,7 +50,7 @@
50
50
  "layout": {
51
51
  "allowEditing": false
52
52
  },
53
- "blockVisibility": false,
53
+ "visibility": false,
54
54
  "contentRole": true,
55
55
  "allowedBlocks": true,
56
56
  "lock": false
@@ -1,8 +1,4 @@
1
- // Some classic themes may use selectors like `.wp-block .wp-block`
2
- // and apply some kind of width to the blocks. To properly override
3
- // those styles, use a selector with a specificity of `0-2-0`.
4
- .wp-block-accordion-panel.wp-block-accordion-panel {
5
- min-width: 100%;
1
+ .wp-block-accordion-panel {
6
2
 
7
3
  // Prevent blockGap from Accordion Content block from adding extra margin between accordions.
8
4
  &[inert],
package/src/classic.scss CHANGED
@@ -20,3 +20,41 @@
20
20
  background: #32373c;
21
21
  color: $white;
22
22
  }
23
+
24
+ // These rules are needed to enforce the default styling of
25
+ // the Accordion Heading block in the classic theme.
26
+ .wp-block-accordion-heading {
27
+ // Heading elements may have default margins applied, so those
28
+ // styles need to be reset.
29
+ margin: 0;
30
+ }
31
+
32
+ .wp-block-accordion-heading__toggle {
33
+ // Button elements can have colors applied with high CSS specificity,
34
+ // and since this specificity is impossible to predict, we use
35
+ // `!important` to reset the color.
36
+ background-color: inherit !important;
37
+ color: inherit !important;
38
+
39
+ &:not(:focus-visible) {
40
+ outline: none;
41
+ }
42
+
43
+ &:hover,
44
+ &:focus {
45
+ // Sometimes styles are applied when the button element is
46
+ // hovered over or focused. This isn't expected for accordion
47
+ // toggle buttons, so reset those styles here.
48
+ text-decoration: none;
49
+ background-color: inherit !important;
50
+ box-shadow: none;
51
+ color: inherit;
52
+ border: none;
53
+ padding: var(--wp--preset--spacing--20, 1em) 0;
54
+ }
55
+
56
+ &:focus-visible {
57
+ outline-offset: 0;
58
+ outline: auto;
59
+ }
60
+ }
@@ -30,6 +30,7 @@ jest.mock( '@wordpress/data/src/components/use-select', () => () => ( {} ) );
30
30
  describe( 'utils', () => {
31
31
  beforeAll( () => {
32
32
  registerBlockType( DEFAULT_EMBED_BLOCK, {
33
+ apiVersion: 3,
33
34
  title: 'Embed',
34
35
  category: 'embed',
35
36
  attributes,
@@ -148,6 +149,7 @@ describe( 'utils', () => {
148
149
  ).toBeUndefined();
149
150
 
150
151
  registerBlockType( DEFAULT_EMBED_BLOCK, {
152
+ apiVersion: 3,
151
153
  title: 'Embed',
152
154
  category: 'embed',
153
155
  attributes,
@@ -13,13 +13,12 @@
13
13
  }
14
14
  },
15
15
  "supports": {
16
- "html": false,
17
16
  "className": false,
18
17
  "customClassName": false,
19
18
  "lock": false,
20
19
  "reusable": false,
21
20
  "renaming": false,
22
- "blockVisibility": false
21
+ "visibility": false
23
22
  },
24
23
  "editorStyle": "wp-block-freeform-editor"
25
24
  }
package/src/math/edit.js CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  } from '@wordpress/components';
15
15
  import { useState, useEffect, useRef } from '@wordpress/element';
16
16
  import { useDispatch } from '@wordpress/data';
17
+ import { speak } from '@wordpress/a11y';
17
18
 
18
19
  /**
19
20
  * Internal dependencies
@@ -72,7 +73,8 @@ export default function MathEdit( { attributes, setAttributes, isSelected } ) {
72
73
  placement="bottom-start"
73
74
  offset={ 8 }
74
75
  anchor={ blockRef }
75
- focusOnMount="firstContentElement"
76
+ focusOnMount={ false }
77
+ __unstableSlotName="__unstable-block-tools-after"
76
78
  >
77
79
  <div style={ { padding: '4px', minWidth: '300px' } }>
78
80
  <VStack spacing={ 1 }>
@@ -96,6 +98,7 @@ export default function MathEdit( { attributes, setAttributes, isSelected } ) {
96
98
  setError( null );
97
99
  } catch ( err ) {
98
100
  setError( err.message );
101
+ speak( err.message );
99
102
  }
100
103
  setAttributes( {
101
104
  mathML: newMathML,
@@ -108,6 +108,7 @@
108
108
 
109
109
  /* Image fill for versions 8 and onwards */
110
110
  .wp-block-media-text.is-image-fill-element > .wp-block-media-text__media {
111
+ position: relative;
111
112
  height: 100%;
112
113
  min-height: 250px;
113
114
  }
@@ -118,6 +119,7 @@
118
119
  }
119
120
 
120
121
  .wp-block-media-text.is-image-fill-element > .wp-block-media-text__media img {
122
+ position: absolute;
121
123
  width: 100%;
122
124
  height: 100%;
123
125
  object-fit: cover;
@@ -26,7 +26,7 @@
26
26
  "lock": false,
27
27
  "reusable": false,
28
28
  "renaming": false,
29
- "blockVisibility": false,
29
+ "visibility": false,
30
30
  "interactivity": {
31
31
  "clientNavigation": true
32
32
  }
@@ -214,7 +214,7 @@ export default function NavigationLinkEdit( {
214
214
  const ref = useRef();
215
215
  const linkUIref = useRef();
216
216
  const prevUrl = usePrevious( url );
217
- const isNewLink = useRef( ! url );
217
+ const isNewLink = useRef( ! url && ! metadata?.bindings?.url );
218
218
 
219
219
  const {
220
220
  isAtMaxNesting,
@@ -9,7 +9,7 @@
9
9
  "html": false,
10
10
  "inserter": false,
11
11
  "renaming": false,
12
- "blockVisibility": false,
12
+ "visibility": false,
13
13
  "interactivity": {
14
14
  "clientNavigation": true
15
15
  }
package/src/style.scss CHANGED
@@ -1,3 +1,4 @@
1
+ @use "./accordion/style.scss" as *;
1
2
  @use "./accordion-item/style.scss" as *;
2
3
  @use "./accordion-heading/style.scss" as *;
3
4
  @use "./accordion-panel/style.scss" as *;
@@ -59,7 +59,7 @@ function render_block_core_term_template( $attributes, $content, $block ) {
59
59
  $query_args['include'] = array_unique( array_map( 'intval', $query['include'] ) );
60
60
  $query_args['orderby'] = 'include';
61
61
  $query_args['order'] = 'asc';
62
- } elseif ( empty( $query['showNested'] ) ) {
62
+ } elseif ( is_taxonomy_hierarchical( $query['taxonomy'] ) && empty( $query['showNested'] ) ) {
63
63
  // We set parent only when inheriting from the taxonomy archive context or not
64
64
  // showing nested terms, otherwise nested terms are not displayed.
65
65
  $query_args['parent'] = 0;