@wordpress/block-library 9.25.0 → 9.26.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 (120) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/avatar/edit.js +84 -39
  3. package/build/avatar/edit.js.map +1 -1
  4. package/build/avatar/user-control.js +32 -17
  5. package/build/avatar/user-control.js.map +1 -1
  6. package/build/embed/variations.js +0 -10
  7. package/build/embed/variations.js.map +1 -1
  8. package/build/form/edit.js +0 -1
  9. package/build/form/edit.js.map +1 -1
  10. package/build/form/index.js +3 -3
  11. package/build/form/index.js.map +1 -1
  12. package/build/form-input/index.js +2 -1
  13. package/build/form-input/index.js.map +1 -1
  14. package/build/form-submission-notification/index.js +2 -1
  15. package/build/form-submission-notification/index.js.map +1 -1
  16. package/build/form-submit-button/index.js +2 -1
  17. package/build/form-submit-button/index.js.map +1 -1
  18. package/build/image/image.js +1 -0
  19. package/build/image/image.js.map +1 -1
  20. package/build/image/view.js +0 -3
  21. package/build/image/view.js.map +1 -1
  22. package/build/navigation-link/edit.js +11 -0
  23. package/build/navigation-link/edit.js.map +1 -1
  24. package/build/post-author/edit.js +75 -18
  25. package/build/post-author/edit.js.map +1 -1
  26. package/build/post-navigation-link/edit.js +72 -33
  27. package/build/post-navigation-link/edit.js.map +1 -1
  28. package/build/site-logo/edit.js +53 -19
  29. package/build/site-logo/edit.js.map +1 -1
  30. package/build/social-link/edit.js +21 -5
  31. package/build/social-link/edit.js.map +1 -1
  32. package/build/social-link/edit.native.js +13 -5
  33. package/build/social-link/edit.native.js.map +1 -1
  34. package/build/social-link/social-list.js +17 -25
  35. package/build/social-link/social-list.js.map +1 -1
  36. package/build/social-links/edit.js +8 -5
  37. package/build/social-links/edit.js.map +1 -1
  38. package/build/video/tracks-editor.js +23 -9
  39. package/build/video/tracks-editor.js.map +1 -1
  40. package/build-module/avatar/edit.js +83 -38
  41. package/build-module/avatar/edit.js.map +1 -1
  42. package/build-module/avatar/user-control.js +33 -18
  43. package/build-module/avatar/user-control.js.map +1 -1
  44. package/build-module/embed/variations.js +0 -10
  45. package/build-module/embed/variations.js.map +1 -1
  46. package/build-module/form/edit.js +0 -1
  47. package/build-module/form/edit.js.map +1 -1
  48. package/build-module/form/index.js +3 -3
  49. package/build-module/form/index.js.map +1 -1
  50. package/build-module/form-input/index.js +2 -1
  51. package/build-module/form-input/index.js.map +1 -1
  52. package/build-module/form-submission-notification/index.js +2 -1
  53. package/build-module/form-submission-notification/index.js.map +1 -1
  54. package/build-module/form-submit-button/index.js +2 -1
  55. package/build-module/form-submit-button/index.js.map +1 -1
  56. package/build-module/image/image.js +1 -0
  57. package/build-module/image/image.js.map +1 -1
  58. package/build-module/image/view.js +0 -3
  59. package/build-module/image/view.js.map +1 -1
  60. package/build-module/navigation-link/edit.js +11 -0
  61. package/build-module/navigation-link/edit.js.map +1 -1
  62. package/build-module/post-author/edit.js +76 -19
  63. package/build-module/post-author/edit.js.map +1 -1
  64. package/build-module/post-navigation-link/edit.js +73 -34
  65. package/build-module/post-navigation-link/edit.js.map +1 -1
  66. package/build-module/site-logo/edit.js +54 -20
  67. package/build-module/site-logo/edit.js.map +1 -1
  68. package/build-module/social-link/edit.js +24 -8
  69. package/build-module/social-link/edit.js.map +1 -1
  70. package/build-module/social-link/edit.native.js +15 -6
  71. package/build-module/social-link/edit.native.js.map +1 -1
  72. package/build-module/social-link/social-list.js +16 -21
  73. package/build-module/social-link/social-list.js.map +1 -1
  74. package/build-module/social-links/edit.js +8 -5
  75. package/build-module/social-links/edit.js.map +1 -1
  76. package/build-module/video/tracks-editor.js +24 -10
  77. package/build-module/video/tracks-editor.js.map +1 -1
  78. package/build-style/calendar/style-rtl.css +7 -7
  79. package/build-style/calendar/style.css +7 -7
  80. package/build-style/comments-pagination/editor-rtl.css +0 -12
  81. package/build-style/comments-pagination/editor.css +0 -14
  82. package/build-style/comments-pagination/style-rtl.css +0 -7
  83. package/build-style/comments-pagination/style.css +0 -9
  84. package/build-style/editor-rtl.css +0 -17
  85. package/build-style/editor.css +0 -19
  86. package/build-style/navigation/style-rtl.css +4 -0
  87. package/build-style/navigation/style.css +4 -0
  88. package/build-style/style-rtl.css +11 -14
  89. package/build-style/style.css +11 -16
  90. package/package.json +35 -35
  91. package/src/avatar/edit.js +99 -51
  92. package/src/avatar/user-control.js +34 -29
  93. package/src/calendar/style.scss +10 -10
  94. package/src/comments-pagination/editor.scss +0 -15
  95. package/src/comments-pagination/style.scss +0 -8
  96. package/src/editor.scss +0 -1
  97. package/src/embed/variations.js +0 -8
  98. package/src/form/block.json +1 -2
  99. package/src/form/edit.js +0 -1
  100. package/src/form/index.js +1 -0
  101. package/src/form-input/index.js +1 -0
  102. package/src/form-submission-notification/index.js +1 -0
  103. package/src/form-submit-button/index.js +1 -0
  104. package/src/image/image.js +1 -0
  105. package/src/image/index.php +4 -1
  106. package/src/image/view.js +0 -3
  107. package/src/navigation/style.scss +8 -0
  108. package/src/navigation-link/edit.js +14 -1
  109. package/src/post-author/edit.js +91 -27
  110. package/src/post-navigation-link/edit.js +96 -51
  111. package/src/site-logo/edit.js +69 -26
  112. package/src/social-link/edit.js +18 -7
  113. package/src/social-link/edit.native.js +10 -4
  114. package/src/social-link/index.php +13 -0
  115. package/src/social-link/social-list.js +15 -20
  116. package/src/social-links/edit.js +6 -7
  117. package/src/video/tracks-editor.js +18 -6
  118. package/build-style/post-author/editor-rtl.css +0 -140
  119. package/build-style/post-author/editor.css +0 -140
  120. package/src/post-author/editor.scss +0 -7
@@ -13,6 +13,7 @@ export { metadata, name };
13
13
  export const settings = {
14
14
  edit,
15
15
  save,
16
+ example: {},
16
17
  };
17
18
 
18
19
  export const init = () => initBlock( { name, metadata, settings } );
@@ -595,6 +595,7 @@ export default function Image( {
595
595
  aspectRatio: undefined,
596
596
  lightbox: undefined,
597
597
  } );
598
+ updateImage( DEFAULT_MEDIA_SIZE_SLUG );
598
599
  };
599
600
 
600
601
  const sizeControls = (
@@ -204,6 +204,7 @@ function block_core_image_render_lightbox( $block_content, $block ) {
204
204
  JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP
205
205
  )
206
206
  );
207
+ $p->set_attribute( 'data-wp-key', $unique_image_id );
207
208
 
208
209
  // Image.
209
210
  $p->next_tag( 'img' );
@@ -272,12 +273,14 @@ function block_core_image_print_lightbox_overlay() {
272
273
  <div
273
274
  class="wp-lightbox-overlay zoom"
274
275
  data-wp-interactive="core/image"
276
+ data-wp-router-region='{ "id": "core/image-overlay", "attachTo": "body" }'
277
+ data-wp-key="wp-lightbox-overlay"
275
278
  data-wp-context='{}'
276
279
  data-wp-bind--role="state.roleAttribute"
277
280
  data-wp-bind--aria-label="state.currentImage.ariaLabel"
278
281
  data-wp-bind--aria-modal="state.ariaModal"
279
282
  data-wp-class--active="state.overlayEnabled"
280
- data-wp-class--show-closing-animation="state.showClosingAnimation"
283
+ data-wp-class--show-closing-animation="state.overlayOpened"
281
284
  data-wp-watch="callbacks.setOverlayFocus"
282
285
  data-wp-on--keydown="actions.handleKeydown"
283
286
  data-wp-on-async--touchstart="actions.handleTouchStart"
package/src/image/view.js CHANGED
@@ -110,9 +110,6 @@ const { state, actions, callbacks } = store(
110
110
  },
111
111
  hideLightbox() {
112
112
  if ( state.overlayEnabled ) {
113
- // Starts the overlay closing animation. The showClosingAnimation
114
- // class is used to avoid showing it on page load.
115
- state.showClosingAnimation = true;
116
113
  state.overlayEnabled = false;
117
114
 
118
115
  // Waits until the close animation has completed before allowing a
@@ -310,6 +310,14 @@ button.wp-block-navigation-item__content {
310
310
 
311
311
  .wp-block-navigation-submenu__toggle {
312
312
  cursor: pointer;
313
+
314
+ // Rotate submenu icon when open.
315
+ &[aria-expanded="true"] {
316
+ + .wp-block-navigation__submenu-icon > svg,
317
+ > svg {
318
+ transform: rotate(180deg);
319
+ }
320
+ }
313
321
  }
314
322
 
315
323
  // When set to open on click, a button element is used.
@@ -42,6 +42,7 @@ import { useMergeRefs, usePrevious } from '@wordpress/compose';
42
42
  import { LinkUI } from './link-ui';
43
43
  import { updateAttributes } from './update-attributes';
44
44
  import { getColors } from '../navigation/edit/utils';
45
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
45
46
 
46
47
  const DEFAULT_BLOCK = { name: 'core/navigation-link' };
47
48
  const NESTING_BLOCK_NAMES = [
@@ -175,8 +176,20 @@ function getMissingText( type ) {
175
176
  */
176
177
  function Controls( { attributes, setAttributes, setIsLabelFieldFocused } ) {
177
178
  const { label, url, description, rel } = attributes;
179
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
178
180
  return (
179
- <ToolsPanel label={ __( 'Settings' ) }>
181
+ <ToolsPanel
182
+ label={ __( 'Settings' ) }
183
+ resetAll={ () => {
184
+ setAttributes( {
185
+ label: '',
186
+ url: '',
187
+ description: '',
188
+ rel: '',
189
+ } );
190
+ } }
191
+ dropdownMenuProps={ dropdownMenuProps }
192
+ >
180
193
  <ToolsPanelItem
181
194
  hasValue={ () => !! label }
182
195
  label={ __( 'Text' ) }
@@ -15,15 +15,20 @@ import {
15
15
  } from '@wordpress/block-editor';
16
16
  import {
17
17
  ComboboxControl,
18
- PanelBody,
19
18
  SelectControl,
20
19
  ToggleControl,
21
- __experimentalVStack as VStack,
20
+ __experimentalToolsPanel as ToolsPanel,
21
+ __experimentalToolsPanelItem as ToolsPanelItem,
22
22
  } from '@wordpress/components';
23
23
  import { useSelect, useDispatch } from '@wordpress/data';
24
24
  import { __, sprintf } from '@wordpress/i18n';
25
25
  import { store as coreStore } from '@wordpress/core-data';
26
26
 
27
+ /**
28
+ * Internal dependencies
29
+ */
30
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
31
+
27
32
  const minimumUsersForCombobox = 25;
28
33
 
29
34
  const AUTHORS_QUERY = {
@@ -38,6 +43,8 @@ function PostAuthorEdit( {
38
43
  setAttributes,
39
44
  } ) {
40
45
  const isDescendentOfQueryLoop = Number.isFinite( queryId );
46
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
47
+
41
48
  const { authorId, authorDetails, authors, supportsAuthor } = useSelect(
42
49
  ( select ) => {
43
50
  const { getEditedEntityRecord, getUser, getUsers, getPostType } =
@@ -61,8 +68,15 @@ function PostAuthorEdit( {
61
68
 
62
69
  const { editEntityRecord } = useDispatch( coreStore );
63
70
 
64
- const { textAlign, showAvatar, showBio, byline, isLink, linkTarget } =
65
- attributes;
71
+ const {
72
+ textAlign,
73
+ showAvatar,
74
+ showBio,
75
+ byline,
76
+ isLink,
77
+ linkTarget,
78
+ avatarSize,
79
+ } = attributes;
66
80
  const avatarSizes = [];
67
81
  const authorName = authorDetails?.name || __( 'Post Author' );
68
82
  if ( authorDetails?.avatar_urls ) {
@@ -114,13 +128,21 @@ function PostAuthorEdit( {
114
128
  return (
115
129
  <>
116
130
  <InspectorControls>
117
- <PanelBody title={ __( 'Settings' ) }>
118
- <VStack
119
- spacing={ 4 }
120
- className="wp-block-post-author__inspector-settings"
121
- >
122
- { showAuthorControl &&
123
- ( ( showCombobox && (
131
+ <ToolsPanel
132
+ label={ __( 'Settings' ) }
133
+ resetAll={ () => {
134
+ setAttributes( {
135
+ avatarSize: 48,
136
+ showAvatar: true,
137
+ isLink: false,
138
+ linkTarget: '_self',
139
+ } );
140
+ } }
141
+ dropdownMenuProps={ dropdownMenuProps }
142
+ >
143
+ { showAuthorControl && (
144
+ <div style={ { gridColumn: '1 / -1' } }>
145
+ { ( showCombobox && (
124
146
  <ComboboxControl
125
147
  __next40pxDefaultSize
126
148
  __nextHasNoMarginBottom
@@ -139,21 +161,42 @@ function PostAuthorEdit( {
139
161
  options={ authorOptions }
140
162
  onChange={ handleSelect }
141
163
  />
142
- ) ) }
164
+ ) }
165
+ </div>
166
+ ) }
167
+ <ToolsPanelItem
168
+ label={ __( 'Show avatar' ) }
169
+ isShownByDefault
170
+ hasValue={ () => ! showAvatar }
171
+ onDeselect={ () =>
172
+ setAttributes( { showAvatar: true } )
173
+ }
174
+ >
143
175
  <ToggleControl
144
176
  __nextHasNoMarginBottom
145
177
  label={ __( 'Show avatar' ) }
146
178
  checked={ showAvatar }
147
179
  onChange={ () =>
148
- setAttributes( { showAvatar: ! showAvatar } )
180
+ setAttributes( {
181
+ showAvatar: ! showAvatar,
182
+ } )
149
183
  }
150
184
  />
151
- { showAvatar && (
185
+ </ToolsPanelItem>
186
+ { showAvatar && (
187
+ <ToolsPanelItem
188
+ label={ __( 'Avatar size' ) }
189
+ isShownByDefault
190
+ hasValue={ () => avatarSize !== 48 }
191
+ onDeselect={ () =>
192
+ setAttributes( { avatarSize: 48 } )
193
+ }
194
+ >
152
195
  <SelectControl
153
196
  __next40pxDefaultSize
154
197
  __nextHasNoMarginBottom
155
198
  label={ __( 'Avatar size' ) }
156
- value={ attributes.avatarSize }
199
+ value={ avatarSize }
157
200
  options={ avatarSizes }
158
201
  onChange={ ( size ) => {
159
202
  setAttributes( {
@@ -161,15 +204,31 @@ function PostAuthorEdit( {
161
204
  } );
162
205
  } }
163
206
  />
164
- ) }
207
+ </ToolsPanelItem>
208
+ ) }
209
+ <ToolsPanelItem
210
+ label={ __( 'Show bio' ) }
211
+ isShownByDefault
212
+ hasValue={ () => !! showBio }
213
+ onDeselect={ () =>
214
+ setAttributes( { showBio: undefined } )
215
+ }
216
+ >
165
217
  <ToggleControl
166
218
  __nextHasNoMarginBottom
167
219
  label={ __( 'Show bio' ) }
168
- checked={ showBio }
220
+ checked={ !! showBio }
169
221
  onChange={ () =>
170
222
  setAttributes( { showBio: ! showBio } )
171
223
  }
172
224
  />
225
+ </ToolsPanelItem>
226
+ <ToolsPanelItem
227
+ label={ __( 'Link author name to author page' ) }
228
+ isShownByDefault
229
+ hasValue={ () => !! isLink }
230
+ onDeselect={ () => setAttributes( { isLink: false } ) }
231
+ >
173
232
  <ToggleControl
174
233
  __nextHasNoMarginBottom
175
234
  label={ __( 'Link author name to author page' ) }
@@ -178,7 +237,16 @@ function PostAuthorEdit( {
178
237
  setAttributes( { isLink: ! isLink } )
179
238
  }
180
239
  />
181
- { isLink && (
240
+ </ToolsPanelItem>
241
+ { isLink && (
242
+ <ToolsPanelItem
243
+ label={ __( 'Link target' ) }
244
+ isShownByDefault
245
+ hasValue={ () => linkTarget !== '_self' }
246
+ onDeselect={ () =>
247
+ setAttributes( { linkTarget: '_self' } )
248
+ }
249
+ >
182
250
  <ToggleControl
183
251
  __nextHasNoMarginBottom
184
252
  label={ __( 'Open in new tab' ) }
@@ -189,9 +257,9 @@ function PostAuthorEdit( {
189
257
  }
190
258
  checked={ linkTarget === '_blank' }
191
259
  />
192
- ) }
193
- </VStack>
194
- </PanelBody>
260
+ </ToolsPanelItem>
261
+ ) }
262
+ </ToolsPanel>
195
263
  </InspectorControls>
196
264
 
197
265
  <BlockControls group="block">
@@ -207,12 +275,8 @@ function PostAuthorEdit( {
207
275
  { showAvatar && authorDetails?.avatar_urls && (
208
276
  <div className="wp-block-post-author__avatar">
209
277
  <img
210
- width={ attributes.avatarSize }
211
- src={
212
- authorDetails.avatar_urls[
213
- attributes.avatarSize
214
- ]
215
- }
278
+ width={ avatarSize }
279
+ src={ authorDetails.avatar_urls[ avatarSize ] }
216
280
  alt={ authorDetails.name }
217
281
  />
218
282
  </div>
@@ -9,9 +9,10 @@ import clsx from 'clsx';
9
9
  import {
10
10
  __experimentalToggleGroupControl as ToggleGroupControl,
11
11
  __experimentalToggleGroupControlOption as ToggleGroupControlOption,
12
+ __experimentalToolsPanel as ToolsPanel,
13
+ __experimentalToolsPanelItem as ToolsPanelItem,
12
14
  ToggleControl,
13
15
  SelectControl,
14
- PanelBody,
15
16
  } from '@wordpress/components';
16
17
  import {
17
18
  InspectorControls,
@@ -25,6 +26,11 @@ import { __, _x } from '@wordpress/i18n';
25
26
  import { useSelect } from '@wordpress/data';
26
27
  import { store as coreStore } from '@wordpress/core-data';
27
28
 
29
+ /**
30
+ * Internal dependencies
31
+ */
32
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
33
+
28
34
  export default function PostNavigationLinkEdit( {
29
35
  context: { postType },
30
36
  attributes: {
@@ -94,73 +100,112 @@ export default function PostNavigationLinkEdit( {
94
100
  return [ selectOption, ...taxonomyOptions ];
95
101
  };
96
102
 
103
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
104
+
97
105
  return (
98
106
  <>
99
107
  <InspectorControls>
100
- <PanelBody>
101
- <ToggleControl
102
- __nextHasNoMarginBottom
108
+ <ToolsPanel
109
+ label={ __( 'Settings' ) }
110
+ resetAll={ () => {
111
+ setAttributes( {
112
+ showTitle: false,
113
+ linkLabel: false,
114
+ arrow: 'none',
115
+ } );
116
+ } }
117
+ dropdownMenuProps={ dropdownMenuProps }
118
+ >
119
+ <ToolsPanelItem
103
120
  label={ __( 'Display the title as a link' ) }
104
- help={ __(
105
- 'If you have entered a custom label, it will be prepended before the title.'
106
- ) }
107
- checked={ !! showTitle }
108
- onChange={ () =>
109
- setAttributes( {
110
- showTitle: ! showTitle,
111
- } )
121
+ isShownByDefault
122
+ hasValue={ () => showTitle }
123
+ onDeselect={ () =>
124
+ setAttributes( { showTitle: false } )
112
125
  }
113
- />
114
- { showTitle && (
126
+ >
115
127
  <ToggleControl
116
128
  __nextHasNoMarginBottom
117
- label={ __(
118
- 'Include the label as part of the link'
129
+ label={ __( 'Display the title as a link' ) }
130
+ help={ __(
131
+ 'If you have entered a custom label, it will be prepended before the title.'
119
132
  ) }
120
- checked={ !! linkLabel }
133
+ checked={ !! showTitle }
121
134
  onChange={ () =>
122
135
  setAttributes( {
123
- linkLabel: ! linkLabel,
136
+ showTitle: ! showTitle,
124
137
  } )
125
138
  }
126
139
  />
140
+ </ToolsPanelItem>
141
+ { showTitle && (
142
+ <ToolsPanelItem
143
+ label={ __(
144
+ 'Include the label as part of the link'
145
+ ) }
146
+ isShownByDefault
147
+ hasValue={ () => !! linkLabel }
148
+ onDeselect={ () =>
149
+ setAttributes( { linkLabel: false } )
150
+ }
151
+ >
152
+ <ToggleControl
153
+ __nextHasNoMarginBottom
154
+ label={ __(
155
+ 'Include the label as part of the link'
156
+ ) }
157
+ checked={ !! linkLabel }
158
+ onChange={ () =>
159
+ setAttributes( {
160
+ linkLabel: ! linkLabel,
161
+ } )
162
+ }
163
+ />
164
+ </ToolsPanelItem>
127
165
  ) }
128
- <ToggleGroupControl
129
- __next40pxDefaultSize
130
- __nextHasNoMarginBottom
166
+ <ToolsPanelItem
131
167
  label={ __( 'Arrow' ) }
132
- value={ arrow }
133
- onChange={ ( value ) => {
134
- setAttributes( { arrow: value } );
135
- } }
136
- help={ __(
137
- 'A decorative arrow for the next and previous link.'
138
- ) }
139
- isBlock
168
+ isShownByDefault
169
+ hasValue={ () => arrow !== 'none' }
170
+ onDeselect={ () => setAttributes( { arrow: 'none' } ) }
140
171
  >
141
- <ToggleGroupControlOption
142
- value="none"
143
- label={ _x(
144
- 'None',
145
- 'Arrow option for Next/Previous link'
146
- ) }
147
- />
148
- <ToggleGroupControlOption
149
- value="arrow"
150
- label={ _x(
151
- 'Arrow',
152
- 'Arrow option for Next/Previous link'
153
- ) }
154
- />
155
- <ToggleGroupControlOption
156
- value="chevron"
157
- label={ _x(
158
- 'Chevron',
159
- 'Arrow option for Next/Previous link'
172
+ <ToggleGroupControl
173
+ __next40pxDefaultSize
174
+ __nextHasNoMarginBottom
175
+ label={ __( 'Arrow' ) }
176
+ value={ arrow }
177
+ onChange={ ( value ) => {
178
+ setAttributes( { arrow: value } );
179
+ } }
180
+ help={ __(
181
+ 'A decorative arrow for the next and previous link.'
160
182
  ) }
161
- />
162
- </ToggleGroupControl>
163
- </PanelBody>
183
+ isBlock
184
+ >
185
+ <ToggleGroupControlOption
186
+ value="none"
187
+ label={ _x(
188
+ 'None',
189
+ 'Arrow option for Next/Previous link'
190
+ ) }
191
+ />
192
+ <ToggleGroupControlOption
193
+ value="arrow"
194
+ label={ _x(
195
+ 'Arrow',
196
+ 'Arrow option for Next/Previous link'
197
+ ) }
198
+ />
199
+ <ToggleGroupControlOption
200
+ value="chevron"
201
+ label={ _x(
202
+ 'Chevron',
203
+ 'Arrow option for Next/Previous link'
204
+ ) }
205
+ />
206
+ </ToggleGroupControl>
207
+ </ToolsPanelItem>
208
+ </ToolsPanel>
164
209
  </InspectorControls>
165
210
  <InspectorControls group="advanced">
166
211
  <SelectControl
@@ -14,7 +14,6 @@ import {
14
14
  } from '@wordpress/element';
15
15
  import { __, isRTL } from '@wordpress/i18n';
16
16
  import {
17
- PanelBody,
18
17
  RangeControl,
19
18
  ResizableBox,
20
19
  Spinner,
@@ -24,6 +23,9 @@ import {
24
23
  Button,
25
24
  DropZone,
26
25
  FlexItem,
26
+ PanelBody,
27
+ __experimentalToolsPanel as ToolsPanel,
28
+ __experimentalToolsPanelItem as ToolsPanelItem,
27
29
  __experimentalItemGroup as ItemGroup,
28
30
  __experimentalHStack as HStack,
29
31
  __experimentalTruncate as Truncate,
@@ -47,6 +49,7 @@ import { store as noticesStore } from '@wordpress/notices';
47
49
  * Internal dependencies
48
50
  */
49
51
  import { MIN_SIZE } from '../image/constants';
52
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
50
53
 
51
54
  const ALLOWED_MEDIA_TYPES = [ 'image' ];
52
55
  const ACCEPT_MEDIA_STRING = 'image/*';
@@ -70,6 +73,7 @@ const SiteLogo = ( {
70
73
  const [ { naturalWidth, naturalHeight }, setNaturalSize ] = useState( {} );
71
74
  const [ isEditingImage, setIsEditingImage ] = useState( false );
72
75
  const { toggleSelection } = useDispatch( blockEditorStore );
76
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
73
77
  const { imageEditing, maxWidth, title } = useSelect( ( select ) => {
74
78
  const settings = select( blockEditorStore ).getSettings();
75
79
  const siteEntities = select( coreStore ).getEntityRecord(
@@ -276,31 +280,61 @@ const SiteLogo = ( {
276
280
  return (
277
281
  <>
278
282
  <InspectorControls>
279
- <PanelBody title={ __( 'Settings' ) }>
280
- <RangeControl
281
- __nextHasNoMarginBottom
282
- __next40pxDefaultSize
283
+ <ToolsPanel
284
+ label={ __( 'Settings' ) }
285
+ dropdownMenuProps={ dropdownMenuProps }
286
+ >
287
+ <ToolsPanelItem
288
+ isShownByDefault
289
+ hasValue={ () => !! width }
283
290
  label={ __( 'Image width' ) }
284
- onChange={ ( newWidth ) =>
285
- setAttributes( { width: newWidth } )
291
+ onDeselect={ () =>
292
+ setAttributes( { width: undefined } )
286
293
  }
287
- min={ minWidth }
288
- max={ maxWidthBuffer }
289
- initialPosition={ Math.min(
290
- defaultWidth,
291
- maxWidthBuffer
292
- ) }
293
- value={ width || '' }
294
- disabled={ ! isResizable }
295
- />
296
- <ToggleControl
297
- __nextHasNoMarginBottom
294
+ >
295
+ <RangeControl
296
+ __nextHasNoMarginBottom
297
+ __next40pxDefaultSize
298
+ label={ __( 'Image width' ) }
299
+ onChange={ ( newWidth ) =>
300
+ setAttributes( { width: newWidth } )
301
+ }
302
+ min={ minWidth }
303
+ max={ maxWidthBuffer }
304
+ initialPosition={ Math.min(
305
+ defaultWidth,
306
+ maxWidthBuffer
307
+ ) }
308
+ value={ width || '' }
309
+ disabled={ ! isResizable }
310
+ />
311
+ </ToolsPanelItem>
312
+
313
+ <ToolsPanelItem
314
+ isShownByDefault
315
+ hasValue={ () => ! isLink }
298
316
  label={ __( 'Link image to home' ) }
299
- onChange={ () => setAttributes( { isLink: ! isLink } ) }
300
- checked={ isLink }
301
- />
317
+ onDeselect={ () => setAttributes( { isLink: true } ) }
318
+ >
319
+ <ToggleControl
320
+ __nextHasNoMarginBottom
321
+ label={ __( 'Link image to home' ) }
322
+ onChange={ () =>
323
+ setAttributes( { isLink: ! isLink } )
324
+ }
325
+ checked={ isLink }
326
+ />
327
+ </ToolsPanelItem>
328
+
302
329
  { isLink && (
303
- <>
330
+ <ToolsPanelItem
331
+ isShownByDefault
332
+ hasValue={ () => linkTarget === '_blank' }
333
+ label={ __( 'Open in new tab' ) }
334
+ onDeselect={ () =>
335
+ setAttributes( { linkTarget: '_self' } )
336
+ }
337
+ >
304
338
  <ToggleControl
305
339
  __nextHasNoMarginBottom
306
340
  label={ __( 'Open in new tab' ) }
@@ -311,10 +345,19 @@ const SiteLogo = ( {
311
345
  }
312
346
  checked={ linkTarget === '_blank' }
313
347
  />
314
- </>
348
+ </ToolsPanelItem>
315
349
  ) }
350
+
316
351
  { canUserEdit && (
317
- <>
352
+ <ToolsPanelItem
353
+ isShownByDefault
354
+ hasValue={ () => !! shouldSyncIcon }
355
+ label={ __( 'Use as Site Icon' ) }
356
+ onDeselect={ () => {
357
+ setAttributes( { shouldSyncIcon: false } );
358
+ setIcon( undefined );
359
+ } }
360
+ >
318
361
  <ToggleControl
319
362
  __nextHasNoMarginBottom
320
363
  label={ __( 'Use as Site Icon' ) }
@@ -325,9 +368,9 @@ const SiteLogo = ( {
325
368
  checked={ !! shouldSyncIcon }
326
369
  help={ syncSiteIconHelpText }
327
370
  />
328
- </>
371
+ </ToolsPanelItem>
329
372
  ) }
330
- </PanelBody>
373
+ </ToolsPanel>
331
374
  </InspectorControls>
332
375
  <BlockControls group="block">
333
376
  { canEditImage && ! isEditingImage && (