@wordpress/edit-site 4.1.1 → 4.3.1

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 (170) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-template/new-template-part.js +2 -9
  3. package/build/components/add-new-template/new-template-part.js.map +1 -1
  4. package/build/components/add-new-template/new-template.js +28 -12
  5. package/build/components/add-new-template/new-template.js.map +1 -1
  6. package/build/components/block-editor/index.js +53 -4
  7. package/build/components/block-editor/index.js.map +1 -1
  8. package/build/components/editor/index.js +12 -4
  9. package/build/components/editor/index.js.map +1 -1
  10. package/build/components/global-styles/border-panel.js +25 -24
  11. package/build/components/global-styles/border-panel.js.map +1 -1
  12. package/build/components/global-styles/color-indicator-wrapper.js +37 -0
  13. package/build/components/global-styles/color-indicator-wrapper.js.map +1 -0
  14. package/build/components/global-styles/dimensions-panel.js +6 -2
  15. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  16. package/build/components/global-styles/header.js +1 -4
  17. package/build/components/global-styles/header.js.map +1 -1
  18. package/build/components/global-styles/icon-with-current-color.js +34 -0
  19. package/build/components/global-styles/icon-with-current-color.js.map +1 -0
  20. package/build/components/global-styles/navigation-button.js +7 -3
  21. package/build/components/global-styles/navigation-button.js.map +1 -1
  22. package/build/components/global-styles/palette.js +8 -5
  23. package/build/components/global-styles/palette.js.map +1 -1
  24. package/build/components/global-styles/preview.js +142 -26
  25. package/build/components/global-styles/preview.js.map +1 -1
  26. package/build/components/global-styles/screen-block-list.js +50 -6
  27. package/build/components/global-styles/screen-block-list.js.map +1 -1
  28. package/build/components/global-styles/screen-colors.js +11 -3
  29. package/build/components/global-styles/screen-colors.js.map +1 -1
  30. package/build/components/global-styles/screen-root.js +7 -5
  31. package/build/components/global-styles/screen-root.js.map +1 -1
  32. package/build/components/global-styles/screen-style-variations.js +12 -5
  33. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  34. package/build/components/header/document-actions/index.js +13 -11
  35. package/build/components/header/document-actions/index.js.map +1 -1
  36. package/build/components/header/index.js +5 -3
  37. package/build/components/header/index.js.map +1 -1
  38. package/build/components/header/more-menu/index.js +9 -1
  39. package/build/components/header/more-menu/index.js.map +1 -1
  40. package/build/components/header/more-menu/site-export.js +5 -2
  41. package/build/components/header/more-menu/site-export.js.map +1 -1
  42. package/build/components/header/plugin-more-menu-item/index.js +5 -0
  43. package/build/components/header/plugin-more-menu-item/index.js.map +1 -1
  44. package/build/components/list/actions/rename-menu-item.js +3 -10
  45. package/build/components/list/actions/rename-menu-item.js.map +1 -1
  46. package/build/components/preferences-modal/enable-feature.js +40 -0
  47. package/build/components/preferences-modal/enable-feature.js.map +1 -0
  48. package/build/components/preferences-modal/index.js +68 -0
  49. package/build/components/preferences-modal/index.js.map +1 -0
  50. package/build/components/sidebar/index.js +12 -1
  51. package/build/components/sidebar/index.js.map +1 -1
  52. package/build/components/sidebar/navigation-menu-sidebar/index.js +40 -0
  53. package/build/components/sidebar/navigation-menu-sidebar/index.js.map +1 -0
  54. package/build/components/sidebar/navigation-menu-sidebar/navigation-inspector.js +185 -0
  55. package/build/components/sidebar/navigation-menu-sidebar/navigation-inspector.js.map +1 -0
  56. package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js +54 -0
  57. package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +1 -0
  58. package/build/components/template-part-converter/convert-to-regular.js +6 -0
  59. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  60. package/build/index.js +1 -0
  61. package/build/index.js.map +1 -1
  62. package/build/store/actions.js +3 -3
  63. package/build/store/actions.js.map +1 -1
  64. package/build/store/selectors.js +3 -1
  65. package/build/store/selectors.js.map +1 -1
  66. package/build-module/components/add-new-template/new-template-part.js +3 -10
  67. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  68. package/build-module/components/add-new-template/new-template.js +27 -12
  69. package/build-module/components/add-new-template/new-template.js.map +1 -1
  70. package/build-module/components/block-editor/index.js +51 -6
  71. package/build-module/components/block-editor/index.js.map +1 -1
  72. package/build-module/components/editor/index.js +12 -5
  73. package/build-module/components/editor/index.js.map +1 -1
  74. package/build-module/components/global-styles/border-panel.js +27 -26
  75. package/build-module/components/global-styles/border-panel.js.map +1 -1
  76. package/build-module/components/global-styles/color-indicator-wrapper.js +25 -0
  77. package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -0
  78. package/build-module/components/global-styles/dimensions-panel.js +6 -2
  79. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  80. package/build-module/components/global-styles/header.js +2 -5
  81. package/build-module/components/global-styles/header.js.map +1 -1
  82. package/build-module/components/global-styles/icon-with-current-color.js +22 -0
  83. package/build-module/components/global-styles/icon-with-current-color.js.map +1 -0
  84. package/build-module/components/global-styles/navigation-button.js +7 -3
  85. package/build-module/components/global-styles/navigation-button.js.map +1 -1
  86. package/build-module/components/global-styles/palette.js +8 -6
  87. package/build-module/components/global-styles/palette.js.map +1 -1
  88. package/build-module/components/global-styles/preview.js +141 -27
  89. package/build-module/components/global-styles/preview.js.map +1 -1
  90. package/build-module/components/global-styles/screen-block-list.js +49 -6
  91. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  92. package/build-module/components/global-styles/screen-colors.js +10 -3
  93. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  94. package/build-module/components/global-styles/screen-root.js +8 -7
  95. package/build-module/components/global-styles/screen-root.js.map +1 -1
  96. package/build-module/components/global-styles/screen-style-variations.js +13 -6
  97. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  98. package/build-module/components/header/document-actions/index.js +13 -11
  99. package/build-module/components/header/document-actions/index.js.map +1 -1
  100. package/build-module/components/header/index.js +5 -3
  101. package/build-module/components/header/index.js.map +1 -1
  102. package/build-module/components/header/more-menu/index.js +8 -1
  103. package/build-module/components/header/more-menu/index.js.map +1 -1
  104. package/build-module/components/header/more-menu/site-export.js +5 -2
  105. package/build-module/components/header/more-menu/site-export.js.map +1 -1
  106. package/build-module/components/header/plugin-more-menu-item/index.js +4 -0
  107. package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -1
  108. package/build-module/components/list/actions/rename-menu-item.js +4 -11
  109. package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
  110. package/build-module/components/preferences-modal/enable-feature.js +27 -0
  111. package/build-module/components/preferences-modal/enable-feature.js.map +1 -0
  112. package/build-module/components/preferences-modal/index.js +57 -0
  113. package/build-module/components/preferences-modal/index.js.map +1 -0
  114. package/build-module/components/sidebar/index.js +11 -1
  115. package/build-module/components/sidebar/index.js.map +1 -1
  116. package/build-module/components/sidebar/navigation-menu-sidebar/index.js +26 -0
  117. package/build-module/components/sidebar/navigation-menu-sidebar/index.js.map +1 -0
  118. package/build-module/components/sidebar/navigation-menu-sidebar/navigation-inspector.js +168 -0
  119. package/build-module/components/sidebar/navigation-menu-sidebar/navigation-inspector.js.map +1 -0
  120. package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js +45 -0
  121. package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +1 -0
  122. package/build-module/components/template-part-converter/convert-to-regular.js +6 -0
  123. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  124. package/build-module/index.js +1 -0
  125. package/build-module/index.js.map +1 -1
  126. package/build-module/store/actions.js +3 -3
  127. package/build-module/store/actions.js.map +1 -1
  128. package/build-module/store/selectors.js +3 -1
  129. package/build-module/store/selectors.js.map +1 -1
  130. package/build-style/style-rtl.css +88 -6
  131. package/build-style/style.css +88 -6
  132. package/package.json +29 -29
  133. package/src/components/add-new-template/new-template-part.js +3 -12
  134. package/src/components/add-new-template/new-template.js +49 -12
  135. package/src/components/block-editor/index.js +79 -9
  136. package/src/components/editor/index.js +19 -1
  137. package/src/components/global-styles/border-panel.js +32 -26
  138. package/src/components/global-styles/color-indicator-wrapper.js +23 -0
  139. package/src/components/global-styles/dimensions-panel.js +7 -2
  140. package/src/components/global-styles/header.js +2 -7
  141. package/src/components/global-styles/icon-with-current-color.js +21 -0
  142. package/src/components/global-styles/navigation-button.js +6 -4
  143. package/src/components/global-styles/palette.js +8 -11
  144. package/src/components/global-styles/preview.js +186 -29
  145. package/src/components/global-styles/screen-block-list.js +64 -11
  146. package/src/components/global-styles/screen-colors.js +7 -6
  147. package/src/components/global-styles/screen-root.js +15 -17
  148. package/src/components/global-styles/screen-style-variations.js +13 -4
  149. package/src/components/global-styles/style.scss +20 -7
  150. package/src/components/header/document-actions/index.js +14 -10
  151. package/src/components/header/index.js +6 -1
  152. package/src/components/header/more-menu/index.js +15 -0
  153. package/src/components/header/more-menu/site-export.js +13 -2
  154. package/src/components/header/plugin-more-menu-item/index.js +2 -0
  155. package/src/components/header/style.scss +45 -0
  156. package/src/components/list/actions/rename-menu-item.js +3 -13
  157. package/src/components/preferences-modal/enable-feature.js +24 -0
  158. package/src/components/preferences-modal/index.js +76 -0
  159. package/src/components/sidebar/index.js +12 -0
  160. package/src/components/sidebar/navigation-menu-sidebar/index.js +34 -0
  161. package/src/components/sidebar/navigation-menu-sidebar/navigation-inspector.js +224 -0
  162. package/src/components/sidebar/navigation-menu-sidebar/navigation-menu.js +62 -0
  163. package/src/components/sidebar/navigation-menu-sidebar/style.scss +42 -0
  164. package/src/components/sidebar/style.scss +1 -1
  165. package/src/components/template-part-converter/convert-to-regular.js +9 -0
  166. package/src/index.js +1 -0
  167. package/src/store/actions.js +4 -4
  168. package/src/store/selectors.js +10 -0
  169. package/src/store/test/selectors.js +4 -0
  170. package/src/style.scss +1 -0
@@ -5,65 +5,222 @@ import {
5
5
  __unstableIframe as Iframe,
6
6
  __unstableEditorStyles as EditorStyles,
7
7
  } from '@wordpress/block-editor';
8
+ import {
9
+ __unstableMotion as motion,
10
+ __experimentalHStack as HStack,
11
+ __experimentalVStack as VStack,
12
+ } from '@wordpress/components';
13
+ import { useReducedMotion, useResizeObserver } from '@wordpress/compose';
14
+ import { useState } from '@wordpress/element';
8
15
 
9
16
  /**
10
17
  * Internal dependencies
11
18
  */
12
- import { useStyle } from './hooks';
19
+ import { useSetting, useStyle } from './hooks';
13
20
  import { useGlobalStylesOutput } from './use-global-styles-output';
14
21
 
15
- const StylesPreview = ( { height = 150 } ) => {
22
+ const firstFrame = {
23
+ start: {
24
+ opacity: 1,
25
+ display: 'block',
26
+ },
27
+ hover: {
28
+ opacity: 0,
29
+ display: 'none',
30
+ },
31
+ };
32
+
33
+ const secondFrame = {
34
+ hover: {
35
+ opacity: 1,
36
+ display: 'block',
37
+ },
38
+ start: {
39
+ opacity: 0,
40
+ display: 'none',
41
+ },
42
+ };
43
+
44
+ const normalizedWidth = 248;
45
+ const normalizedHeight = 152;
46
+
47
+ const normalizedColorSwatchSize = 32;
48
+
49
+ const StylesPreview = ( { label, isFocused } ) => {
50
+ const [ fontWeight ] = useStyle( 'typography.fontWeight' );
16
51
  const [ fontFamily = 'serif' ] = useStyle( 'typography.fontFamily' );
52
+ const [ headingFontFamily = fontFamily ] = useStyle(
53
+ 'elements.h1.typography.fontFamily'
54
+ );
55
+ const [ headingFontWeight = fontWeight ] = useStyle(
56
+ 'elements.h1.typography.fontWeight'
57
+ );
17
58
  const [ textColor = 'black' ] = useStyle( 'color.text' );
59
+ const [ headingColor = textColor ] = useStyle( 'elements.h1.color.text' );
18
60
  const [ linkColor = 'blue' ] = useStyle( 'elements.link.color.text' );
19
61
  const [ backgroundColor = 'white' ] = useStyle( 'color.background' );
20
62
  const [ gradientValue ] = useStyle( 'color.gradient' );
21
63
  const [ styles ] = useGlobalStylesOutput();
64
+ const disableMotion = useReducedMotion();
65
+ const [ coreColors ] = useSetting( 'color.palette.core' );
66
+ const [ themeColors ] = useSetting( 'color.palette.theme' );
67
+ const [ customColors ] = useSetting( 'color.palette.custom' );
68
+ const [ isHovered, setIsHovered ] = useState( false );
69
+ const [ containerResizeListener, { width } ] = useResizeObserver();
70
+ const ratio = width ? width / normalizedWidth : 1;
71
+
72
+ const paletteColors = ( themeColors ?? [] )
73
+ .concat( customColors ?? [] )
74
+ .concat( coreColors ?? [] );
75
+ const highlightedColors = paletteColors
76
+ .filter(
77
+ // we exclude these two colors because they are already visible in the preview.
78
+ ( { color } ) => color !== backgroundColor && color !== headingColor
79
+ )
80
+ .slice( 0, 2 );
22
81
 
23
82
  return (
24
83
  <Iframe
25
84
  className="edit-site-global-styles-preview__iframe"
26
85
  head={ <EditorStyles styles={ styles } /> }
27
- style={ { height } }
86
+ style={ {
87
+ height: normalizedHeight * ratio,
88
+ visibility: ! width ? 'hidden' : 'visible',
89
+ } }
90
+ onMouseEnter={ () => setIsHovered( true ) }
91
+ onMouseLeave={ () => setIsHovered( false ) }
92
+ tabIndex={ -1 }
28
93
  >
29
- <div
94
+ { containerResizeListener }
95
+ <motion.div
30
96
  style={ {
31
- display: 'flex',
32
- gap: 20,
33
- alignItems: 'center',
34
- justifyContent: 'center',
35
- height: '100%',
36
- transform: `scale(${ height / 150 })`,
97
+ height: normalizedHeight * ratio,
98
+ width: '100%',
37
99
  background: gradientValue ?? backgroundColor,
38
100
  cursor: 'pointer',
39
101
  } }
102
+ initial="start"
103
+ animate={
104
+ ( isHovered || isFocused ) && ! disableMotion
105
+ ? 'hover'
106
+ : 'start'
107
+ }
40
108
  >
41
- <div style={ { fontFamily, fontSize: '80px' } }>Aa</div>
42
- <div
109
+ <motion.div
110
+ variants={ firstFrame }
43
111
  style={ {
44
- display: 'flex',
45
- gap: 20,
46
- flexDirection: 'column',
112
+ height: '100%',
113
+ overflow: 'hidden',
47
114
  } }
48
115
  >
49
- <div
116
+ <HStack
117
+ spacing={ 10 * ratio }
118
+ justify="center"
50
119
  style={ {
51
- height: 40,
52
- width: 40,
53
- background: textColor,
54
- borderRadius: 20,
120
+ height: '100%',
121
+ overflow: 'hidden',
55
122
  } }
56
- />{ ' ' }
57
- <div
123
+ >
124
+ <div
125
+ style={ {
126
+ fontFamily: headingFontFamily,
127
+ fontSize: 65 * ratio,
128
+ color: headingColor,
129
+ fontWeight: headingFontWeight,
130
+ } }
131
+ >
132
+ Aa
133
+ </div>
134
+ <VStack spacing={ 4 * ratio }>
135
+ { highlightedColors.map( ( { slug, color } ) => (
136
+ <div
137
+ key={ slug }
138
+ style={ {
139
+ height:
140
+ normalizedColorSwatchSize * ratio,
141
+ width:
142
+ normalizedColorSwatchSize * ratio,
143
+ background: color,
144
+ borderRadius:
145
+ ( normalizedColorSwatchSize *
146
+ ratio ) /
147
+ 2,
148
+ } }
149
+ />
150
+ ) ) }
151
+ </VStack>
152
+ </HStack>
153
+ </motion.div>
154
+ <motion.div
155
+ variants={ secondFrame }
156
+ style={ {
157
+ height: '100%',
158
+ overflow: 'hidden',
159
+ } }
160
+ >
161
+ <VStack
162
+ spacing={ 3 * ratio }
163
+ justify="center"
58
164
  style={ {
59
- height: 40,
60
- width: 40,
61
- background: linkColor,
62
- borderRadius: 20,
165
+ height: '100%',
166
+ overflow: 'hidden',
167
+ padding: 10 * ratio,
168
+ boxSizing: 'border-box',
63
169
  } }
64
- />
65
- </div>
66
- </div>
170
+ >
171
+ { label && (
172
+ <div
173
+ style={ {
174
+ fontSize: 35 * ratio,
175
+ fontFamily: headingFontFamily,
176
+ color: headingColor,
177
+ fontWeight: headingFontWeight,
178
+ lineHeight: '1em',
179
+ } }
180
+ >
181
+ { label }
182
+ </div>
183
+ ) }
184
+ <HStack spacing={ 2 * ratio } justify="flex-start">
185
+ <div
186
+ style={ {
187
+ fontFamily,
188
+ fontSize: 24 * ratio,
189
+ color: textColor,
190
+ } }
191
+ >
192
+ Aa
193
+ </div>
194
+ <div
195
+ style={ {
196
+ fontFamily,
197
+ fontSize: 24 * ratio,
198
+ color: linkColor,
199
+ } }
200
+ >
201
+ Aa
202
+ </div>
203
+ </HStack>
204
+ { paletteColors && (
205
+ <HStack spacing={ 0 }>
206
+ { paletteColors
207
+ .slice( 0, 4 )
208
+ .map( ( { color }, index ) => (
209
+ <div
210
+ key={ index }
211
+ style={ {
212
+ height: 10 * ratio,
213
+ width: 30 * ratio,
214
+ background: color,
215
+ flexGrow: 1,
216
+ } }
217
+ />
218
+ ) ) }
219
+ </HStack>
220
+ ) }
221
+ </VStack>
222
+ </motion.div>
223
+ </motion.div>
67
224
  </Iframe>
68
225
  );
69
226
  };
@@ -2,13 +2,17 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { store as blocksStore } from '@wordpress/blocks';
5
- import { useSelect } from '@wordpress/data';
6
- import { __ } from '@wordpress/i18n';
5
+ import { __, sprintf, _n } from '@wordpress/i18n';
7
6
  import {
8
7
  FlexItem,
8
+ SearchControl,
9
9
  __experimentalHStack as HStack,
10
10
  } from '@wordpress/components';
11
+ import { useSelect } from '@wordpress/data';
12
+ import { useState, useMemo, useEffect, useRef } from '@wordpress/element';
11
13
  import { BlockIcon } from '@wordpress/block-editor';
14
+ import { useDebounce } from '@wordpress/compose';
15
+ import { speak } from '@wordpress/a11y';
12
16
 
13
17
  /**
14
18
  * Internal dependencies
@@ -59,9 +63,7 @@ function BlockMenuItem( { block } ) {
59
63
  return (
60
64
  <NavigationButton path={ '/blocks/' + block.name }>
61
65
  <HStack justify="flex-start">
62
- <FlexItem>
63
- <BlockIcon icon={ block.icon } />
64
- </FlexItem>
66
+ <BlockIcon icon={ block.icon } />
65
67
  <FlexItem>{ block.title }</FlexItem>
66
68
  </HStack>
67
69
  </NavigationButton>
@@ -70,6 +72,45 @@ function BlockMenuItem( { block } ) {
70
72
 
71
73
  function ScreenBlockList() {
72
74
  const sortedBlockTypes = useSortedBlockTypes();
75
+ const [ filterValue, setFilterValue ] = useState( '' );
76
+ const debouncedSpeak = useDebounce( speak, 500 );
77
+ const isMatchingSearchTerm = useSelect(
78
+ ( select ) => select( blocksStore ).isMatchingSearchTerm,
79
+ []
80
+ );
81
+ const filteredBlockTypes = useMemo( () => {
82
+ if ( ! filterValue ) {
83
+ return sortedBlockTypes;
84
+ }
85
+ return sortedBlockTypes.filter( ( blockType ) =>
86
+ isMatchingSearchTerm( blockType, filterValue )
87
+ );
88
+ }, [ filterValue, sortedBlockTypes, isMatchingSearchTerm ] );
89
+
90
+ const blockTypesListRef = useRef();
91
+
92
+ // Announce search results on change
93
+ useEffect( () => {
94
+ if ( ! filterValue ) {
95
+ return;
96
+ }
97
+ // We extract the results from the wrapper div's `ref` because
98
+ // filtered items can contain items that will eventually not
99
+ // render and there is no reliable way to detect when a child
100
+ // will return `null`.
101
+ // TODO: We should find a better way of handling this as it's
102
+ // fragile and depends on the number of rendered elements of `BlockMenuItem`,
103
+ // which is now one.
104
+ // @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116
105
+ const count = blockTypesListRef.current.childElementCount;
106
+ const resultsFoundMessage = sprintf(
107
+ /* translators: %d: number of results. */
108
+ _n( '%d result found.', '%d results found.', count ),
109
+ count
110
+ );
111
+ debouncedSpeak( resultsFoundMessage, count );
112
+ }, [ filterValue, debouncedSpeak ] );
113
+
73
114
  return (
74
115
  <>
75
116
  <ScreenHeader
@@ -78,12 +119,24 @@ function ScreenBlockList() {
78
119
  'Customize the appearance of specific blocks and for the whole site.'
79
120
  ) }
80
121
  />
81
- { sortedBlockTypes.map( ( block ) => (
82
- <BlockMenuItem
83
- block={ block }
84
- key={ 'menu-itemblock-' + block.name }
85
- />
86
- ) ) }
122
+ <SearchControl
123
+ className="edit-site-block-types-search"
124
+ onChange={ setFilterValue }
125
+ value={ filterValue }
126
+ label={ __( 'Search for blocks' ) }
127
+ placeholder={ __( 'Search' ) }
128
+ />
129
+ <div
130
+ ref={ blockTypesListRef }
131
+ className="edit-site-block-types-item-list"
132
+ >
133
+ { filteredBlockTypes.map( ( block ) => (
134
+ <BlockMenuItem
135
+ block={ block }
136
+ key={ 'menu-itemblock-' + block.name }
137
+ />
138
+ ) ) }
139
+ </div>
87
140
  </>
88
141
  );
89
142
  }
@@ -18,6 +18,7 @@ import Palette from './palette';
18
18
  import { NavigationButton } from './navigation-button';
19
19
  import { getSupportedGlobalStylesPanels, useStyle } from './hooks';
20
20
  import Subtitle from './subtitle';
21
+ import ColorIndicatorWrapper from './color-indicator-wrapper';
21
22
 
22
23
  function BackgroundColorItem( { name, parentMenu } ) {
23
24
  const supports = getSupportedGlobalStylesPanels( name );
@@ -34,11 +35,11 @@ function BackgroundColorItem( { name, parentMenu } ) {
34
35
  return (
35
36
  <NavigationButton path={ parentMenu + '/colors/background' }>
36
37
  <HStack justify="flex-start">
37
- <FlexItem>
38
+ <ColorIndicatorWrapper expanded={ false }>
38
39
  <ColorIndicator
39
40
  colorValue={ gradientValue ?? backgroundColor }
40
41
  />
41
- </FlexItem>
42
+ </ColorIndicatorWrapper>
42
43
  <FlexItem>{ __( 'Background' ) }</FlexItem>
43
44
  </HStack>
44
45
  </NavigationButton>
@@ -57,9 +58,9 @@ function TextColorItem( { name, parentMenu } ) {
57
58
  return (
58
59
  <NavigationButton path={ parentMenu + '/colors/text' }>
59
60
  <HStack justify="flex-start">
60
- <FlexItem>
61
+ <ColorIndicatorWrapper expanded={ false }>
61
62
  <ColorIndicator colorValue={ color } />
62
- </FlexItem>
63
+ </ColorIndicatorWrapper>
63
64
  <FlexItem>{ __( 'Text' ) }</FlexItem>
64
65
  </HStack>
65
66
  </NavigationButton>
@@ -78,9 +79,9 @@ function LinkColorItem( { name, parentMenu } ) {
78
79
  return (
79
80
  <NavigationButton path={ parentMenu + '/colors/link' }>
80
81
  <HStack justify="flex-start">
81
- <FlexItem>
82
+ <ColorIndicatorWrapper expanded={ false }>
82
83
  <ColorIndicator colorValue={ color } />
83
- </FlexItem>
84
+ </ColorIndicatorWrapper>
84
85
  <FlexItem>{ __( 'Links' ) }</FlexItem>
85
86
  </HStack>
86
87
  </NavigationButton>
@@ -10,15 +10,17 @@ import {
10
10
  CardBody,
11
11
  Card,
12
12
  CardDivider,
13
+ CardMedia,
13
14
  } from '@wordpress/components';
14
15
  import { isRTL, __ } from '@wordpress/i18n';
15
- import { chevronLeft, chevronRight, Icon } from '@wordpress/icons';
16
+ import { chevronLeft, chevronRight } from '@wordpress/icons';
16
17
  import { useSelect } from '@wordpress/data';
17
18
  import { store as coreStore } from '@wordpress/core-data';
18
19
 
19
20
  /**
20
21
  * Internal dependencies
21
22
  */
23
+ import { IconWithCurrentColor } from './icon-with-current-color';
22
24
  import { NavigationButton } from './navigation-button';
23
25
  import ContextMenu from './context-menu';
24
26
  import StylesPreview from './preview';
@@ -37,19 +39,19 @@ function ScreenRoot() {
37
39
  <CardBody>
38
40
  <VStack spacing={ 2 }>
39
41
  <Card>
40
- <StylesPreview />
42
+ <CardMedia>
43
+ <StylesPreview />
44
+ </CardMedia>
41
45
  </Card>
42
46
  { !! variations?.length && (
43
47
  <NavigationButton path="/variations">
44
48
  <HStack justify="space-between">
45
- <FlexItem>{ __( 'Other styles' ) }</FlexItem>
46
- <FlexItem>
47
- <Icon
48
- icon={
49
- isRTL() ? chevronLeft : chevronRight
50
- }
51
- />
52
- </FlexItem>
49
+ <FlexItem>{ __( 'Browse styles' ) }</FlexItem>
50
+ <IconWithCurrentColor
51
+ icon={
52
+ isRTL() ? chevronLeft : chevronRight
53
+ }
54
+ />
53
55
  </HStack>
54
56
  </NavigationButton>
55
57
  ) }
@@ -72,13 +74,9 @@ function ScreenRoot() {
72
74
  <NavigationButton path="/blocks">
73
75
  <HStack justify="space-between">
74
76
  <FlexItem>{ __( 'Blocks' ) }</FlexItem>
75
- <FlexItem>
76
- <Icon
77
- icon={
78
- isRTL() ? chevronLeft : chevronRight
79
- }
80
- />
81
- </FlexItem>
77
+ <IconWithCurrentColor
78
+ icon={ isRTL() ? chevronLeft : chevronRight }
79
+ />
82
80
  </HStack>
83
81
  </NavigationButton>
84
82
  </ItemGroup>
@@ -9,7 +9,7 @@ import classnames from 'classnames';
9
9
  */
10
10
  import { store as coreStore } from '@wordpress/core-data';
11
11
  import { useSelect } from '@wordpress/data';
12
- import { useMemo, useContext } from '@wordpress/element';
12
+ import { useMemo, useContext, useState } from '@wordpress/element';
13
13
  import { ENTER } from '@wordpress/keycodes';
14
14
  import {
15
15
  __experimentalGrid as Grid,
@@ -31,6 +31,7 @@ function compareVariations( a, b ) {
31
31
  }
32
32
 
33
33
  function Variation( { variation } ) {
34
+ const [ isFocused, setIsFocused ] = useState( false );
34
35
  const { base, user, setUserConfig } = useContext( GlobalStylesContext );
35
36
  const context = useMemo( () => {
36
37
  return {
@@ -77,8 +78,16 @@ function Variation( { variation } ) {
77
78
  onClick={ selectVariation }
78
79
  onKeyDown={ selectOnEnter }
79
80
  tabIndex="0"
81
+ aria-label={ variation?.title }
82
+ onFocus={ () => setIsFocused( true ) }
83
+ onBlur={ () => setIsFocused( false ) }
80
84
  >
81
- <StylesPreview height={ 100 } />
85
+ <div className="edit-site-global-styles-variations_item-preview">
86
+ <StylesPreview
87
+ label={ variation?.title }
88
+ isFocused={ isFocused }
89
+ />
90
+ </div>
82
91
  </div>
83
92
  </GlobalStylesContext.Provider>
84
93
  );
@@ -96,7 +105,7 @@ function ScreenStyleVariations() {
96
105
  const withEmptyVariation = useMemo( () => {
97
106
  return [
98
107
  {
99
- name: __( 'Default' ),
108
+ title: __( 'Default' ),
100
109
  settings: {},
101
110
  styles: {},
102
111
  },
@@ -108,7 +117,7 @@ function ScreenStyleVariations() {
108
117
  <>
109
118
  <ScreenHeader
110
119
  back="/"
111
- title={ __( 'Other styles' ) }
120
+ title={ __( 'Browse styles' ) }
112
121
  description={ __(
113
122
  'Choose a different style combination for the theme styles'
114
123
  ) }
@@ -44,7 +44,8 @@
44
44
  }
45
45
  }
46
46
 
47
- .edit-site-global-styles-header__description {
47
+ .edit-site-global-styles-header__description,
48
+ .edit-site-block-types-search {
48
49
  padding: 0 $grid-unit-20;
49
50
  }
50
51
 
@@ -73,19 +74,31 @@
73
74
 
74
75
  .edit-site-global-styles-variations_item {
75
76
  box-sizing: border-box;
76
- padding: $border-width * 2;
77
- border-radius: $radius-block-ui;
78
- border: $gray-200 $border-width solid;
79
77
 
80
- &.is-active {
78
+ .edit-site-global-styles-variations_item-preview {
79
+ padding: $border-width * 2;
80
+ border-radius: $radius-block-ui;
81
+ border: $gray-200 $border-width solid;
82
+ }
83
+
84
+ &.is-active .edit-site-global-styles-variations_item-preview {
81
85
  border: $gray-900 $border-width solid;
82
86
  }
83
87
 
84
- &:hover {
88
+ &:hover .edit-site-global-styles-variations_item-preview {
85
89
  border: var(--wp-admin-theme-color) $border-width solid;
86
90
  }
87
91
 
88
- &:focus {
92
+ &:focus .edit-site-global-styles-variations_item-preview {
89
93
  border: var(--wp-admin-theme-color) $border-width solid;
90
94
  }
91
95
  }
96
+
97
+ .edit-site-global-styles-icon-with-current-color {
98
+ fill: currentColor;
99
+ }
100
+
101
+ .edit-site-global-styles__color-indicator-wrapper {
102
+ // Match the height of the rest of the icons (24px).
103
+ height: $grid-unit * 3;
104
+ }
@@ -53,21 +53,23 @@ function useSecondaryText() {
53
53
  }
54
54
 
55
55
  /**
56
- * @param {Object} props Props for the DocumentActions component.
57
- * @param {string} props.entityTitle The title to display.
58
- * @param {string} props.entityLabel A label to use for entity-related options.
59
- * E.g. "template" would be used for "edit
60
- * template" and "show template details".
61
- * @param {boolean} props.isLoaded Whether the data is available.
62
- * @param {Function} props.children React component to use for the
63
- * information dropdown area. Should be a
64
- * function which accepts dropdown props.
56
+ * @param {Object} props Props for the DocumentActions component.
57
+ * @param {string} props.entityTitle The title to display.
58
+ * @param {string} props.entityLabel A label to use for entity-related options.
59
+ * E.g. "template" would be used for "edit
60
+ * template" and "show template details".
61
+ * @param {boolean} props.isLoaded Whether the data is available.
62
+ * @param {Function} props.children React component to use for the
63
+ * information dropdown area. Should be a
64
+ * function which accepts dropdown props.
65
+ * @param {boolean} props.showIconLabels Whether buttons display icons or text labels.
65
66
  */
66
67
  export default function DocumentActions( {
67
68
  entityTitle,
68
69
  entityLabel,
69
70
  isLoaded,
70
71
  children: dropdownContent,
72
+ showIconLabels,
71
73
  } ) {
72
74
  const { label } = useSecondaryText();
73
75
 
@@ -144,7 +146,9 @@ export default function DocumentActions( {
144
146
  __( 'Show %s details' ),
145
147
  entityLabel
146
148
  ) }
147
- />
149
+ >
150
+ { showIconLabels && __( 'Details' ) }
151
+ </Button>
148
152
  ) }
149
153
  contentClassName="edit-site-document-actions__info-dropdown"
150
154
  renderContent={ dropdownContent }
@@ -34,6 +34,7 @@ const preventDefault = ( event ) => {
34
34
  export default function Header( {
35
35
  openEntitiesSavedStates,
36
36
  isEntitiesSavedStatesOpen,
37
+ showIconLabels,
37
38
  } ) {
38
39
  const inserterButton = useRef();
39
40
  const {
@@ -122,7 +123,10 @@ export default function Header( {
122
123
  'Toggle block inserter',
123
124
  'Generic label for block inserter button'
124
125
  ) }
125
- />
126
+ >
127
+ { showIconLabels &&
128
+ ( ! isInserterOpen ? __( 'Add' ) : __( 'Close' ) ) }
129
+ </Button>
126
130
  { isLargeViewport && (
127
131
  <>
128
132
  <ToolbarItem
@@ -155,6 +159,7 @@ export default function Header( {
155
159
  : 'template'
156
160
  }
157
161
  isLoaded={ isLoaded }
162
+ showIconLabels={ showIconLabels }
158
163
  >
159
164
  { ( { onClose } ) => (
160
165
  <TemplateDetails
@@ -14,6 +14,7 @@ import { PreferenceToggleMenuItem } from '@wordpress/preferences';
14
14
  * Internal dependencies
15
15
  */
16
16
  import KeyboardShortcutHelpModal from '../../keyboard-shortcut-help-modal';
17
+ import EditSitePreferencesModal from '../../preferences-modal';
17
18
  import ToolsMoreMenuGroup from '../tools-more-menu-group';
18
19
  import SiteExport from './site-export';
19
20
  import WelcomeGuideMenuItem from './welcome-guide-menu-item';
@@ -26,6 +27,11 @@ export default function MoreMenu() {
26
27
  false
27
28
  );
28
29
 
30
+ const [ isPreferencesModalActive, togglePreferencesModal ] = useReducer(
31
+ ( isActive ) => ! isActive,
32
+ false
33
+ );
34
+
29
35
  useShortcut( 'core/edit-site/keyboard-shortcuts', toggleModal );
30
36
 
31
37
  return (
@@ -99,6 +105,11 @@ export default function MoreMenu() {
99
105
  fillProps={ { onClose } }
100
106
  />
101
107
  </MenuGroup>
108
+ <MenuGroup>
109
+ <MenuItem onClick={ togglePreferencesModal }>
110
+ { __( 'Preferences' ) }
111
+ </MenuItem>
112
+ </MenuGroup>
102
113
  </>
103
114
  ) }
104
115
  </MoreMenuDropdown>
@@ -106,6 +117,10 @@ export default function MoreMenu() {
106
117
  isModalActive={ isModalActive }
107
118
  toggleModal={ toggleModal }
108
119
  />
120
+ <EditSitePreferencesModal
121
+ isModalActive={ isPreferencesModalActive }
122
+ toggleModal={ togglePreferencesModal }
123
+ />
109
124
  </>
110
125
  );
111
126
  }