@wordpress/block-library 9.24.0 → 9.25.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 (202) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/button/edit.js +29 -17
  3. package/build/button/edit.js.map +1 -1
  4. package/build/columns/edit.js +18 -22
  5. package/build/columns/edit.js.map +1 -1
  6. package/build/comment-author-name/edit.js +41 -12
  7. package/build/comment-author-name/edit.js.map +1 -1
  8. package/build/comment-date/edit.js +41 -12
  9. package/build/comment-date/edit.js.map +1 -1
  10. package/build/comment-edit-link/edit.js +27 -7
  11. package/build/comment-edit-link/edit.js.map +1 -1
  12. package/build/comments/edit/comments-inspector-controls.js +1 -3
  13. package/build/comments/edit/comments-inspector-controls.js.map +1 -1
  14. package/build/comments-pagination/edit.js +23 -9
  15. package/build/comments-pagination/edit.js.map +1 -1
  16. package/build/comments-title/edit.js +41 -12
  17. package/build/comments-title/edit.js.map +1 -1
  18. package/build/details/edit.js +27 -3
  19. package/build/details/edit.js.map +1 -1
  20. package/build/embed/edit.js +2 -4
  21. package/build/embed/edit.js.map +1 -1
  22. package/build/embed/embed-controls.js +41 -22
  23. package/build/embed/embed-controls.js.map +1 -1
  24. package/build/file/inspector.js +73 -30
  25. package/build/file/inspector.js.map +1 -1
  26. package/build/form/edit.js +67 -37
  27. package/build/form/edit.js.map +1 -1
  28. package/build/form-input/edit.js +47 -18
  29. package/build/form-input/edit.js.map +1 -1
  30. package/build/latest-posts/edit.js +154 -82
  31. package/build/latest-posts/edit.js.map +1 -1
  32. package/build/list/ordered-list-settings.js +131 -52
  33. package/build/list/ordered-list-settings.js.map +1 -1
  34. package/build/navigation/edit/index.js +93 -51
  35. package/build/navigation/edit/index.js.map +1 -1
  36. package/build/navigation/edit/overlay-menu-preview.js +43 -27
  37. package/build/navigation/edit/overlay-menu-preview.js.map +1 -1
  38. package/build/navigation-link/index.js +3 -0
  39. package/build/navigation-link/index.js.map +1 -1
  40. package/build/navigation-link/transforms.js +2 -0
  41. package/build/navigation-link/transforms.js.map +1 -1
  42. package/build/navigation-link/update-attributes.js +1 -0
  43. package/build/navigation-link/update-attributes.js.map +1 -1
  44. package/build/navigation-submenu/index.js +3 -0
  45. package/build/navigation-submenu/index.js.map +1 -1
  46. package/build/post-comments-count/index.js +3 -1
  47. package/build/post-comments-count/index.js.map +1 -1
  48. package/build/post-comments-count/transforms.js +26 -0
  49. package/build/post-comments-count/transforms.js.map +1 -0
  50. package/build/post-comments-link/index.js +3 -1
  51. package/build/post-comments-link/index.js.map +1 -1
  52. package/build/post-comments-link/transforms.js +26 -0
  53. package/build/post-comments-link/transforms.js.map +1 -0
  54. package/build/post-title/edit.js +56 -18
  55. package/build/post-title/edit.js.map +1 -1
  56. package/build/query/edit/enhanced-pagination-modal.js +1 -1
  57. package/build/query/edit/enhanced-pagination-modal.js.map +1 -1
  58. package/build/query/edit/inspector-controls/enhanced-pagination-control.js +3 -6
  59. package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  60. package/build/rss/edit.js +120 -46
  61. package/build/rss/edit.js.map +1 -1
  62. package/build/separator/edit.js +52 -20
  63. package/build/separator/edit.js.map +1 -1
  64. package/build/shortcode/index.js +2 -1
  65. package/build/shortcode/index.js.map +1 -1
  66. package/build/social-link/variations.js +53 -48
  67. package/build/social-link/variations.js.map +1 -1
  68. package/build/social-links/edit.js +35 -45
  69. package/build/social-links/edit.js.map +1 -1
  70. package/build/video/tracks-editor.js +40 -12
  71. package/build/video/tracks-editor.js.map +1 -1
  72. package/build-module/button/edit.js +30 -18
  73. package/build-module/button/edit.js.map +1 -1
  74. package/build-module/columns/edit.js +18 -22
  75. package/build-module/columns/edit.js.map +1 -1
  76. package/build-module/comment-author-name/edit.js +42 -13
  77. package/build-module/comment-author-name/edit.js.map +1 -1
  78. package/build-module/comment-date/edit.js +42 -13
  79. package/build-module/comment-date/edit.js.map +1 -1
  80. package/build-module/comment-edit-link/edit.js +28 -8
  81. package/build-module/comment-edit-link/edit.js.map +1 -1
  82. package/build-module/comments/edit/comments-inspector-controls.js +1 -3
  83. package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
  84. package/build-module/comments-pagination/edit.js +24 -10
  85. package/build-module/comments-pagination/edit.js.map +1 -1
  86. package/build-module/comments-title/edit.js +42 -13
  87. package/build-module/comments-title/edit.js.map +1 -1
  88. package/build-module/details/edit.js +29 -5
  89. package/build-module/details/edit.js.map +1 -1
  90. package/build-module/embed/edit.js +2 -4
  91. package/build-module/embed/edit.js.map +1 -1
  92. package/build-module/embed/embed-controls.js +42 -23
  93. package/build-module/embed/embed-controls.js.map +1 -1
  94. package/build-module/file/inspector.js +74 -31
  95. package/build-module/file/inspector.js.map +1 -1
  96. package/build-module/form/edit.js +68 -38
  97. package/build-module/form/edit.js.map +1 -1
  98. package/build-module/form-input/edit.js +48 -19
  99. package/build-module/form-input/edit.js.map +1 -1
  100. package/build-module/latest-posts/edit.js +155 -83
  101. package/build-module/latest-posts/edit.js.map +1 -1
  102. package/build-module/list/ordered-list-settings.js +132 -53
  103. package/build-module/list/ordered-list-settings.js.map +1 -1
  104. package/build-module/navigation/edit/index.js +94 -52
  105. package/build-module/navigation/edit/index.js.map +1 -1
  106. package/build-module/navigation/edit/overlay-menu-preview.js +44 -28
  107. package/build-module/navigation/edit/overlay-menu-preview.js.map +1 -1
  108. package/build-module/navigation-link/index.js +3 -0
  109. package/build-module/navigation-link/index.js.map +1 -1
  110. package/build-module/navigation-link/transforms.js +2 -0
  111. package/build-module/navigation-link/transforms.js.map +1 -1
  112. package/build-module/navigation-link/update-attributes.js +1 -0
  113. package/build-module/navigation-link/update-attributes.js.map +1 -1
  114. package/build-module/navigation-submenu/index.js +3 -0
  115. package/build-module/navigation-submenu/index.js.map +1 -1
  116. package/build-module/post-comments-count/index.js +3 -1
  117. package/build-module/post-comments-count/index.js.map +1 -1
  118. package/build-module/post-comments-count/transforms.js +19 -0
  119. package/build-module/post-comments-count/transforms.js.map +1 -0
  120. package/build-module/post-comments-link/index.js +3 -1
  121. package/build-module/post-comments-link/index.js.map +1 -1
  122. package/build-module/post-comments-link/transforms.js +19 -0
  123. package/build-module/post-comments-link/transforms.js.map +1 -0
  124. package/build-module/post-title/edit.js +57 -19
  125. package/build-module/post-title/edit.js.map +1 -1
  126. package/build-module/query/edit/enhanced-pagination-modal.js +1 -1
  127. package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
  128. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +3 -6
  129. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  130. package/build-module/rss/edit.js +121 -47
  131. package/build-module/rss/edit.js.map +1 -1
  132. package/build-module/separator/edit.js +54 -22
  133. package/build-module/separator/edit.js.map +1 -1
  134. package/build-module/shortcode/index.js +2 -1
  135. package/build-module/shortcode/index.js.map +1 -1
  136. package/build-module/social-link/variations.js +53 -48
  137. package/build-module/social-link/variations.js.map +1 -1
  138. package/build-module/social-links/edit.js +37 -47
  139. package/build-module/social-links/edit.js.map +1 -1
  140. package/build-module/video/tracks-editor.js +41 -13
  141. package/build-module/video/tracks-editor.js.map +1 -1
  142. package/build-style/editor-rtl.css +9 -4
  143. package/build-style/editor.css +9 -4
  144. package/build-style/gallery/style-rtl.css +1 -0
  145. package/build-style/gallery/style.css +1 -0
  146. package/build-style/navigation/editor-rtl.css +8 -3
  147. package/build-style/navigation/editor.css +8 -3
  148. package/build-style/pullquote/editor-rtl.css +1 -1
  149. package/build-style/pullquote/editor.css +1 -1
  150. package/build-style/pullquote/style-rtl.css +2 -3
  151. package/build-style/pullquote/style.css +2 -3
  152. package/build-style/pullquote/theme-rtl.css +2 -2
  153. package/build-style/pullquote/theme.css +2 -2
  154. package/build-style/style-rtl.css +3 -3
  155. package/build-style/style.css +3 -3
  156. package/build-style/theme-rtl.css +2 -2
  157. package/build-style/theme.css +2 -2
  158. package/package.json +35 -35
  159. package/src/button/edit.js +44 -29
  160. package/src/columns/edit.js +20 -31
  161. package/src/comment-author-name/edit.js +54 -13
  162. package/src/comment-date/edit.js +50 -15
  163. package/src/comment-edit-link/edit.js +39 -11
  164. package/src/comments/edit/comments-inspector-controls.js +0 -2
  165. package/src/comments-pagination/edit.js +29 -9
  166. package/src/comments-title/edit.js +53 -15
  167. package/src/details/edit.js +36 -4
  168. package/src/embed/edit.js +3 -5
  169. package/src/embed/embed-controls.js +55 -33
  170. package/src/file/inspector.js +99 -45
  171. package/src/form/edit.js +91 -46
  172. package/src/form-input/edit.js +56 -18
  173. package/src/gallery/style.scss +1 -0
  174. package/src/latest-posts/edit.js +206 -98
  175. package/src/list/ordered-list-settings.js +172 -62
  176. package/src/navigation/edit/index.js +127 -64
  177. package/src/navigation/edit/overlay-menu-preview.js +43 -26
  178. package/src/navigation/editor.scss +8 -4
  179. package/src/navigation-link/block.json +3 -0
  180. package/src/navigation-link/index.php +4 -0
  181. package/src/navigation-link/transforms.js +2 -1
  182. package/src/navigation-link/update-attributes.js +1 -0
  183. package/src/navigation-submenu/block.json +3 -0
  184. package/src/navigation-submenu/index.php +4 -0
  185. package/src/post-comments-count/index.js +2 -0
  186. package/src/post-comments-count/transforms.js +20 -0
  187. package/src/post-comments-link/index.js +2 -0
  188. package/src/post-comments-link/transforms.js +20 -0
  189. package/src/post-title/edit.js +76 -24
  190. package/src/pullquote/editor.scss +1 -1
  191. package/src/pullquote/style.scss +2 -3
  192. package/src/pullquote/theme.scss +2 -2
  193. package/src/query/edit/enhanced-pagination-modal.js +1 -5
  194. package/src/query/edit/inspector-controls/enhanced-pagination-control.js +3 -13
  195. package/src/rss/edit.js +141 -55
  196. package/src/separator/edit.js +66 -21
  197. package/src/shortcode/block.json +2 -1
  198. package/src/site-title/index.php +1 -1
  199. package/src/social-link/index.php +49 -49
  200. package/src/social-link/variations.js +53 -48
  201. package/src/social-links/edit.js +39 -60
  202. package/src/video/tracks-editor.js +57 -16
@@ -8,70 +8,180 @@ import {
8
8
  PanelBody,
9
9
  ToggleControl,
10
10
  SelectControl,
11
+ __experimentalToolsPanel as ToolsPanel,
12
+ __experimentalToolsPanelItem as ToolsPanelItem,
11
13
  } from '@wordpress/components';
14
+ import { Platform } from '@wordpress/element';
12
15
 
13
- const OrderedListSettings = ( { setAttributes, reversed, start, type } ) => (
14
- <InspectorControls>
15
- <PanelBody title={ __( 'Settings' ) }>
16
- <SelectControl
17
- __next40pxDefaultSize
18
- __nextHasNoMarginBottom
19
- label={ __( 'List style' ) }
20
- options={ [
21
- {
22
- label: __( 'Numbers' ),
23
- value: 'decimal',
24
- },
25
- {
26
- label: __( 'Uppercase letters' ),
27
- value: 'upper-alpha',
28
- },
29
- {
30
- label: __( 'Lowercase letters' ),
31
- value: 'lower-alpha',
32
- },
33
- {
34
- label: __( 'Uppercase Roman numerals' ),
35
- value: 'upper-roman',
36
- },
37
- {
38
- label: __( 'Lowercase Roman numerals' ),
39
- value: 'lower-roman',
40
- },
41
- ] }
42
- value={ type }
43
- onChange={ ( newValue ) => setAttributes( { type: newValue } ) }
44
- />
45
- <TextControl
46
- __next40pxDefaultSize
47
- __nextHasNoMarginBottom
48
- label={ __( 'Start value' ) }
49
- type="number"
50
- onChange={ ( value ) => {
51
- const int = parseInt( value, 10 );
16
+ /**
17
+ * Internal dependencies
18
+ */
19
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
20
+
21
+ const LIST_STYLE_OPTIONS = [
22
+ {
23
+ label: __( 'Numbers' ),
24
+ value: 'decimal',
25
+ },
26
+ {
27
+ label: __( 'Uppercase letters' ),
28
+ value: 'upper-alpha',
29
+ },
30
+ {
31
+ label: __( 'Lowercase letters' ),
32
+ value: 'lower-alpha',
33
+ },
34
+ {
35
+ label: __( 'Uppercase Roman numerals' ),
36
+ value: 'upper-roman',
37
+ },
38
+ {
39
+ label: __( 'Lowercase Roman numerals' ),
40
+ value: 'lower-roman',
41
+ },
42
+ ];
43
+
44
+ const OrderedListSettings = ( { setAttributes, reversed, start, type } ) => {
45
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
46
+
47
+ return (
48
+ <InspectorControls>
49
+ { Platform.isNative ? (
50
+ <PanelBody title={ __( 'Settings' ) }>
51
+ <SelectControl
52
+ __next40pxDefaultSize
53
+ __nextHasNoMarginBottom
54
+ label={ __( 'List style' ) }
55
+ options={ LIST_STYLE_OPTIONS }
56
+ value={ type }
57
+ onChange={ ( newValue ) =>
58
+ setAttributes( { type: newValue } )
59
+ }
60
+ />
61
+ <TextControl
62
+ __next40pxDefaultSize
63
+ __nextHasNoMarginBottom
64
+ label={ __( 'Start value' ) }
65
+ type="number"
66
+ onChange={ ( value ) => {
67
+ const int = parseInt( value, 10 );
68
+
69
+ setAttributes( {
70
+ // It should be possible to unset the value,
71
+ // e.g. with an empty string.
72
+ start: isNaN( int ) ? undefined : int,
73
+ } );
74
+ } }
75
+ value={
76
+ Number.isInteger( start )
77
+ ? start.toString( 10 )
78
+ : ''
79
+ }
80
+ step="1"
81
+ />
82
+ <ToggleControl
83
+ __nextHasNoMarginBottom
84
+ label={ __( 'Reverse order' ) }
85
+ checked={ reversed || false }
86
+ onChange={ ( value ) => {
87
+ setAttributes( {
88
+ // Unset the attribute if not reversed.
89
+ reversed: value || undefined,
90
+ } );
91
+ } }
92
+ />
93
+ </PanelBody>
94
+ ) : (
95
+ <ToolsPanel
96
+ label={ __( 'Settings' ) }
97
+ resetAll={ () => {
98
+ setAttributes( {
99
+ type: undefined,
100
+ start: undefined,
101
+ reversed: undefined,
102
+ } );
103
+ } }
104
+ dropdownMenuProps={ dropdownMenuProps }
105
+ >
106
+ <ToolsPanelItem
107
+ label={ __( 'List style' ) }
108
+ isShownByDefault
109
+ hasValue={ () => !! type }
110
+ onDeselect={ () =>
111
+ setAttributes( {
112
+ type: undefined,
113
+ } )
114
+ }
115
+ >
116
+ <SelectControl
117
+ __next40pxDefaultSize
118
+ __nextHasNoMarginBottom
119
+ label={ __( 'List style' ) }
120
+ options={ LIST_STYLE_OPTIONS }
121
+ value={ type || 'decimal' }
122
+ onChange={ ( newValue ) =>
123
+ setAttributes( { type: newValue } )
124
+ }
125
+ />
126
+ </ToolsPanelItem>
127
+ <ToolsPanelItem
128
+ label={ __( 'Start value' ) }
129
+ isShownByDefault
130
+ hasValue={ () => !! start }
131
+ onDeselect={ () =>
132
+ setAttributes( {
133
+ start: undefined,
134
+ } )
135
+ }
136
+ >
137
+ <TextControl
138
+ __next40pxDefaultSize
139
+ __nextHasNoMarginBottom
140
+ label={ __( 'Start value' ) }
141
+ type="number"
142
+ onChange={ ( value ) => {
143
+ const int = parseInt( value, 10 );
52
144
 
53
- setAttributes( {
54
- // It should be possible to unset the value,
55
- // e.g. with an empty string.
56
- start: isNaN( int ) ? undefined : int,
57
- } );
58
- } }
59
- value={ Number.isInteger( start ) ? start.toString( 10 ) : '' }
60
- step="1"
61
- />
62
- <ToggleControl
63
- __nextHasNoMarginBottom
64
- label={ __( 'Reverse order' ) }
65
- checked={ reversed || false }
66
- onChange={ ( value ) => {
67
- setAttributes( {
68
- // Unset the attribute if not reversed.
69
- reversed: value || undefined,
70
- } );
71
- } }
72
- />
73
- </PanelBody>
74
- </InspectorControls>
75
- );
145
+ setAttributes( {
146
+ // It should be possible to unset the value,
147
+ // e.g. with an empty string.
148
+ start: isNaN( int ) ? undefined : int,
149
+ } );
150
+ } }
151
+ value={
152
+ Number.isInteger( start )
153
+ ? start.toString( 10 )
154
+ : ''
155
+ }
156
+ step="1"
157
+ />
158
+ </ToolsPanelItem>
159
+ <ToolsPanelItem
160
+ label={ __( 'Reverse order' ) }
161
+ isShownByDefault
162
+ hasValue={ () => !! reversed }
163
+ onDeselect={ () =>
164
+ setAttributes( {
165
+ reversed: undefined,
166
+ } )
167
+ }
168
+ >
169
+ <ToggleControl
170
+ __nextHasNoMarginBottom
171
+ label={ __( 'Reverse order' ) }
172
+ checked={ reversed || false }
173
+ onChange={ ( value ) => {
174
+ setAttributes( {
175
+ // Unset the attribute if not reversed.
176
+ reversed: value || undefined,
177
+ } );
178
+ } }
179
+ />
180
+ </ToolsPanelItem>
181
+ </ToolsPanel>
182
+ ) }
183
+ </InspectorControls>
184
+ );
185
+ };
76
186
 
77
187
  export default OrderedListSettings;
@@ -31,10 +31,12 @@ import { EntityProvider, store as coreStore } from '@wordpress/core-data';
31
31
 
32
32
  import { useDispatch, useSelect } from '@wordpress/data';
33
33
  import {
34
- PanelBody,
35
- ToggleControl,
34
+ __experimentalToolsPanel as ToolsPanel,
35
+ __experimentalToolsPanelItem as ToolsPanelItem,
36
36
  __experimentalToggleGroupControl as ToggleGroupControl,
37
37
  __experimentalToggleGroupControlOption as ToggleGroupControlOption,
38
+ __experimentalVStack as VStack,
39
+ ToggleControl,
38
40
  Button,
39
41
  Spinner,
40
42
  Notice,
@@ -72,6 +74,7 @@ import DeletedNavigationWarning from './deleted-navigation-warning';
72
74
  import AccessibleDescription from './accessible-description';
73
75
  import AccessibleMenuDescription from './accessible-menu-description';
74
76
  import { unlock } from '../../lock-unlock';
77
+ import { useToolsPanelDropdownMenuProps } from '../../utils/hooks';
75
78
 
76
79
  function ColorTools( {
77
80
  textColor,
@@ -591,11 +594,25 @@ function Navigation( {
591
594
  `overlay-menu-preview`
592
595
  );
593
596
 
597
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
598
+
594
599
  const stylingInspectorControls = (
595
600
  <>
596
601
  <InspectorControls>
597
602
  { hasSubmenuIndicatorSetting && (
598
- <PanelBody title={ __( 'Display' ) }>
603
+ <ToolsPanel
604
+ label={ __( 'Display' ) }
605
+ resetAll={ () => {
606
+ setAttributes( {
607
+ showSubmenuIcon: true,
608
+ openSubmenusOnClick: false,
609
+ overlayMenu: 'mobile',
610
+ hasIcon: true,
611
+ icon: 'handle',
612
+ } );
613
+ } }
614
+ dropdownMenuProps={ dropdownMenuProps }
615
+ >
599
616
  { isResponsive && (
600
617
  <>
601
618
  <Button
@@ -623,88 +640,134 @@ function Navigation( {
623
640
  </>
624
641
  ) }
625
642
  </Button>
626
- <div id={ overlayMenuPreviewId }>
627
- { overlayMenuPreview && (
643
+ { overlayMenuPreview && (
644
+ <VStack
645
+ id={ overlayMenuPreviewId }
646
+ spacing={ 4 }
647
+ style={ {
648
+ gridColumn: 'span 2',
649
+ } }
650
+ >
628
651
  <OverlayMenuPreview
629
652
  setAttributes={ setAttributes }
630
653
  hasIcon={ hasIcon }
631
654
  icon={ icon }
632
655
  hidden={ ! overlayMenuPreview }
633
656
  />
634
- ) }
635
- </div>
657
+ </VStack>
658
+ ) }
636
659
  </>
637
660
  ) }
638
- <ToggleGroupControl
639
- __next40pxDefaultSize
640
- __nextHasNoMarginBottom
661
+
662
+ <ToolsPanelItem
663
+ hasValue={ () => overlayMenu !== 'mobile' }
641
664
  label={ __( 'Overlay Menu' ) }
642
- aria-label={ __( 'Configure overlay menu' ) }
643
- value={ overlayMenu }
644
- help={ __(
645
- 'Collapses the navigation options in a menu icon opening an overlay.'
646
- ) }
647
- onChange={ ( value ) =>
648
- setAttributes( { overlayMenu: value } )
665
+ onDeselect={ () =>
666
+ setAttributes( { overlayMenu: 'mobile' } )
649
667
  }
650
- isBlock
668
+ isShownByDefault
651
669
  >
652
- <ToggleGroupControlOption
653
- value="never"
654
- label={ __( 'Off' ) }
655
- />
656
- <ToggleGroupControlOption
657
- value="mobile"
658
- label={ __( 'Mobile' ) }
659
- />
660
- <ToggleGroupControlOption
661
- value="always"
662
- label={ __( 'Always' ) }
663
- />
664
- </ToggleGroupControl>
670
+ <ToggleGroupControl
671
+ __next40pxDefaultSize
672
+ __nextHasNoMarginBottom
673
+ label={ __( 'Overlay Menu' ) }
674
+ aria-label={ __( 'Configure overlay menu' ) }
675
+ value={ overlayMenu }
676
+ help={ __(
677
+ 'Collapses the navigation options in a menu icon opening an overlay.'
678
+ ) }
679
+ onChange={ ( value ) =>
680
+ setAttributes( { overlayMenu: value } )
681
+ }
682
+ isBlock
683
+ >
684
+ <ToggleGroupControlOption
685
+ value="never"
686
+ label={ __( 'Off' ) }
687
+ />
688
+ <ToggleGroupControlOption
689
+ value="mobile"
690
+ label={ __( 'Mobile' ) }
691
+ />
692
+ <ToggleGroupControlOption
693
+ value="always"
694
+ label={ __( 'Always' ) }
695
+ />
696
+ </ToggleGroupControl>
697
+ </ToolsPanelItem>
698
+
665
699
  { hasSubmenus && (
666
700
  <>
667
- <h3>{ __( 'Submenus' ) }</h3>
668
- <ToggleControl
669
- __nextHasNoMarginBottom
670
- checked={ openSubmenusOnClick }
671
- onChange={ ( value ) => {
672
- setAttributes( {
673
- openSubmenusOnClick: value,
674
- ...( value && {
675
- showSubmenuIcon: true,
676
- } ), // Make sure arrows are shown when we toggle this on.
677
- } );
678
- } }
701
+ <h3 className="wp-block-navigation__submenu-header">
702
+ { __( 'Submenus' ) }
703
+ </h3>
704
+ <ToolsPanelItem
705
+ hasValue={ () => openSubmenusOnClick }
679
706
  label={ __( 'Open on click' ) }
680
- />
681
-
682
- <ToggleControl
683
- __nextHasNoMarginBottom
684
- checked={ showSubmenuIcon }
685
- onChange={ ( value ) => {
707
+ onDeselect={ () =>
686
708
  setAttributes( {
687
- showSubmenuIcon: value,
688
- } );
689
- } }
690
- disabled={ attributes.openSubmenusOnClick }
709
+ openSubmenusOnClick: false,
710
+ showSubmenuIcon: true,
711
+ } )
712
+ }
713
+ isShownByDefault
714
+ >
715
+ <ToggleControl
716
+ __nextHasNoMarginBottom
717
+ checked={ openSubmenusOnClick }
718
+ onChange={ ( value ) => {
719
+ setAttributes( {
720
+ openSubmenusOnClick: value,
721
+ ...( value && {
722
+ showSubmenuIcon: true,
723
+ } ), // Make sure arrows are shown when we toggle this on.
724
+ } );
725
+ } }
726
+ label={ __( 'Open on click' ) }
727
+ />
728
+ </ToolsPanelItem>
729
+
730
+ <ToolsPanelItem
731
+ hasValue={ () => ! showSubmenuIcon }
691
732
  label={ __( 'Show arrow' ) }
692
- />
733
+ onDeselect={ () =>
734
+ setAttributes( {
735
+ showSubmenuIcon: true,
736
+ } )
737
+ }
738
+ isDisabled={
739
+ attributes.openSubmenusOnClick
740
+ }
741
+ isShownByDefault
742
+ >
743
+ <ToggleControl
744
+ __nextHasNoMarginBottom
745
+ checked={ showSubmenuIcon }
746
+ onChange={ ( value ) => {
747
+ setAttributes( {
748
+ showSubmenuIcon: value,
749
+ } );
750
+ } }
751
+ disabled={
752
+ attributes.openSubmenusOnClick
753
+ }
754
+ label={ __( 'Show arrow' ) }
755
+ />
756
+ </ToolsPanelItem>
693
757
 
694
758
  { submenuAccessibilityNotice && (
695
- <div>
696
- <Notice
697
- spokenMessage={ null }
698
- status="warning"
699
- isDismissible={ false }
700
- >
701
- { submenuAccessibilityNotice }
702
- </Notice>
703
- </div>
759
+ <Notice
760
+ spokenMessage={ null }
761
+ status="warning"
762
+ isDismissible={ false }
763
+ className="wp-block-navigation__submenu-accessibility-notice"
764
+ >
765
+ { submenuAccessibilityNotice }
766
+ </Notice>
704
767
  ) }
705
768
  </>
706
769
  ) }
707
- </PanelBody>
770
+ </ToolsPanel>
708
771
  ) }
709
772
  </InspectorControls>
710
773
  <InspectorControls group="color">
@@ -5,6 +5,7 @@ import {
5
5
  ToggleControl,
6
6
  __experimentalToggleGroupControl as ToggleGroupControl,
7
7
  __experimentalToggleGroupControlOption as ToggleGroupControlOption,
8
+ __experimentalToolsPanelItem as ToolsPanelItem,
8
9
  } from '@wordpress/components';
9
10
  import { __ } from '@wordpress/i18n';
10
11
 
@@ -16,36 +17,52 @@ import OverlayMenuIcon from './overlay-menu-icon';
16
17
  export default function OverlayMenuPreview( { setAttributes, hasIcon, icon } ) {
17
18
  return (
18
19
  <>
19
- <ToggleControl
20
- __nextHasNoMarginBottom
20
+ <ToolsPanelItem
21
21
  label={ __( 'Show icon button' ) }
22
- help={ __(
23
- 'Configure the visual appearance of the button that toggles the overlay menu.'
24
- ) }
25
- onChange={ ( value ) => setAttributes( { hasIcon: value } ) }
26
- checked={ hasIcon }
27
- />
22
+ isShownByDefault
23
+ hasValue={ () => ! hasIcon }
24
+ onDeselect={ () => setAttributes( { hasIcon: true } ) }
25
+ >
26
+ <ToggleControl
27
+ __nextHasNoMarginBottom
28
+ label={ __( 'Show icon button' ) }
29
+ help={ __(
30
+ 'Configure the visual appearance of the button that toggles the overlay menu.'
31
+ ) }
32
+ onChange={ ( value ) =>
33
+ setAttributes( { hasIcon: value } )
34
+ }
35
+ checked={ hasIcon }
36
+ />
37
+ </ToolsPanelItem>
28
38
 
29
- <ToggleGroupControl
30
- __next40pxDefaultSize
31
- __nextHasNoMarginBottom
32
- className="wp-block-navigation__overlay-menu-icon-toggle-group"
39
+ <ToolsPanelItem
33
40
  label={ __( 'Icon' ) }
34
- value={ icon }
35
- onChange={ ( value ) => setAttributes( { icon: value } ) }
36
- isBlock
41
+ isShownByDefault
42
+ hasValue={ () => icon !== 'handle' }
43
+ onDeselect={ () => setAttributes( { icon: 'handle' } ) }
37
44
  >
38
- <ToggleGroupControlOption
39
- value="handle"
40
- aria-label={ __( 'handle' ) }
41
- label={ <OverlayMenuIcon icon="handle" /> }
42
- />
43
- <ToggleGroupControlOption
44
- value="menu"
45
- aria-label={ __( 'menu' ) }
46
- label={ <OverlayMenuIcon icon="menu" /> }
47
- />
48
- </ToggleGroupControl>
45
+ <ToggleGroupControl
46
+ __next40pxDefaultSize
47
+ __nextHasNoMarginBottom
48
+ className="wp-block-navigation__overlay-menu-icon-toggle-group"
49
+ label={ __( 'Icon' ) }
50
+ value={ icon }
51
+ onChange={ ( value ) => setAttributes( { icon: value } ) }
52
+ isBlock
53
+ >
54
+ <ToggleGroupControlOption
55
+ value="handle"
56
+ aria-label={ __( 'handle' ) }
57
+ label={ <OverlayMenuIcon icon="handle" /> }
58
+ />
59
+ <ToggleGroupControlOption
60
+ value="menu"
61
+ aria-label={ __( 'menu' ) }
62
+ label={ <OverlayMenuIcon icon="menu" /> }
63
+ />
64
+ </ToggleGroupControl>
65
+ </ToolsPanelItem>
49
66
  </>
50
67
  );
51
68
  }
@@ -569,7 +569,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
569
569
  // Ref - https://github.com/WordPress/gutenberg/pull/65075#discussion_r1746282734
570
570
  height: $grid-unit-40 * 2 !important;
571
571
 
572
- margin-bottom: $grid-unit-15;
572
+ grid-column: span 2;
573
573
 
574
574
  &.open {
575
575
  box-shadow: inset 0 0 0 $border-width $gray-200;
@@ -637,7 +637,11 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
637
637
  margin-left: 24px;
638
638
  }
639
639
 
640
- .wp-block-navigation__overlay-menu-icon-toggle-group {
641
- // Counteract the margin added by the block inspector.
642
- margin-bottom: $grid-unit-20;
640
+ .editor-sidebar__panel .wp-block-navigation__submenu-header {
641
+ margin-top: 0;
642
+ margin-bottom: 0;
643
+ }
644
+
645
+ .wp-block-navigation__submenu-accessibility-notice {
646
+ grid-column: span 2;
643
647
  }
@@ -35,6 +35,9 @@
35
35
  "url": {
36
36
  "type": "string"
37
37
  },
38
+ "title": {
39
+ "type": "string"
40
+ },
38
41
  "kind": {
39
42
  "type": "string"
40
43
  },
@@ -249,6 +249,10 @@ function render_block_core_navigation_link( $attributes, $content, $block ) {
249
249
  $html .= ' rel="nofollow"';
250
250
  }
251
251
 
252
+ if ( isset( $attributes['title'] ) ) {
253
+ $html .= ' title="' . esc_attr( $attributes['title'] ) . '"';
254
+ }
255
+
252
256
  // End appending HTML attributes to anchor tag.
253
257
 
254
258
  // Start anchor tag content.
@@ -115,12 +115,13 @@ const transforms = {
115
115
  {
116
116
  type: 'block',
117
117
  blocks: [ 'core/buttons' ],
118
- transform: ( { label, url, rel, opensInNewTab } ) => {
118
+ transform: ( { label, url, rel, title, opensInNewTab } ) => {
119
119
  return createBlock( 'core/buttons', {}, [
120
120
  createBlock( 'core/button', {
121
121
  text: label,
122
122
  url,
123
123
  rel,
124
+ title,
124
125
  linkTarget: opensInNewTab ? '_blank' : undefined,
125
126
  } ),
126
127
  ] );
@@ -19,6 +19,7 @@ import { safeDecodeURI } from '@wordpress/url';
19
19
  * @property {number} [id] A post or term id.
20
20
  * @property {boolean} [opensInNewTab] Sets link target to _blank when true.
21
21
  * @property {string} [url] Link href.
22
+ * @property {string} [title] Link title attribute.
22
23
  */
23
24
  /**
24
25
  * Link Control onChange handler that updates block attributes when a setting is changed.
@@ -30,6 +30,9 @@
30
30
  "url": {
31
31
  "type": "string"
32
32
  },
33
+ "title": {
34
+ "type": "string"
35
+ },
33
36
  "kind": {
34
37
  "type": "string"
35
38
  },
@@ -169,6 +169,10 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
169
169
  $html .= ' rel="nofollow"';
170
170
  }
171
171
 
172
+ if ( isset( $attributes['title'] ) ) {
173
+ $html .= ' title="' . esc_attr( $attributes['title'] ) . '"';
174
+ }
175
+
172
176
  $html .= '>';
173
177
  // End appending HTML attributes to anchor tag.
174
178