@wordpress/edit-site 6.4.0 → 6.5.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 (198) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-pattern/index.js +6 -1
  3. package/build/components/add-new-pattern/index.js.map +1 -1
  4. package/build/components/add-new-post/index.js +2 -1
  5. package/build/components/add-new-post/index.js.map +1 -1
  6. package/build/components/add-new-template/utils.js +2 -2
  7. package/build/components/add-new-template/utils.js.map +1 -1
  8. package/build/components/editor/index.js +71 -20
  9. package/build/components/editor/index.js.map +1 -1
  10. package/build/components/global-styles/font-families.js +3 -4
  11. package/build/components/global-styles/font-families.js.map +1 -1
  12. package/build/components/global-styles/font-library-modal/context.js +0 -5
  13. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  14. package/build/components/global-styles/font-library-modal/font-collection.js +25 -5
  15. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  16. package/build/components/global-styles/font-library-modal/index.js +1 -8
  17. package/build/components/global-styles/font-library-modal/index.js.map +1 -1
  18. package/build/components/global-styles/font-library-modal/installed-fonts.js +21 -6
  19. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  20. package/build/components/global-styles/font-library-modal/upload-fonts.js +2 -3
  21. package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  22. package/build/components/global-styles/screen-typeset.js +40 -0
  23. package/build/components/global-styles/screen-typeset.js.map +1 -0
  24. package/build/components/global-styles/screen-typography-element.js +14 -0
  25. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  26. package/build/components/global-styles/screen-typography.js +4 -6
  27. package/build/components/global-styles/screen-typography.js.map +1 -1
  28. package/build/components/global-styles/shadows-edit-panel.js +50 -59
  29. package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
  30. package/build/components/global-styles/typeset-button.js +97 -0
  31. package/build/components/global-styles/typeset-button.js.map +1 -0
  32. package/build/components/global-styles/typeset.js +80 -0
  33. package/build/components/global-styles/typeset.js.map +1 -0
  34. package/build/components/global-styles/ui.js +4 -0
  35. package/build/components/global-styles/ui.js.map +1 -1
  36. package/build/components/global-styles/utils.js +10 -1
  37. package/build/components/global-styles/utils.js.map +1 -1
  38. package/build/components/page-patterns/fields.js +230 -0
  39. package/build/components/page-patterns/fields.js.map +1 -0
  40. package/build/components/page-patterns/index.js +8 -226
  41. package/build/components/page-patterns/index.js.map +1 -1
  42. package/build/components/page-patterns/use-patterns.js +26 -1
  43. package/build/components/page-patterns/use-patterns.js.map +1 -1
  44. package/build/components/page-templates/fields.js +169 -0
  45. package/build/components/page-templates/fields.js.map +1 -0
  46. package/build/components/page-templates/index.js +10 -177
  47. package/build/components/page-templates/index.js.map +1 -1
  48. package/build/components/post-edit/index.js +18 -6
  49. package/build/components/post-edit/index.js.map +1 -1
  50. package/build/components/post-fields/index.js +19 -15
  51. package/build/components/post-fields/index.js.map +1 -1
  52. package/build/components/post-list/index.js +125 -67
  53. package/build/components/post-list/index.js.map +1 -1
  54. package/build/components/sidebar-dataviews/add-new-view.js +2 -2
  55. package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
  56. package/build/components/sidebar-dataviews/dataview-item.js +2 -3
  57. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  58. package/build/components/sidebar-dataviews/default-views.js +81 -81
  59. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  60. package/build/components/sidebar-dataviews/index.js +3 -42
  61. package/build/components/sidebar-dataviews/index.js.map +1 -1
  62. package/build/components/site-hub/index.js +6 -3
  63. package/build/components/site-hub/index.js.map +1 -1
  64. package/build/components/style-book/index.js +22 -25
  65. package/build/components/style-book/index.js.map +1 -1
  66. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -0
  67. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  68. package/build/hooks/push-changes-to-global-styles/index.js +2 -3
  69. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  70. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +2 -4
  71. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  72. package/build/index.js +0 -2
  73. package/build/index.js.map +1 -1
  74. package/build-module/components/add-new-pattern/index.js +6 -1
  75. package/build-module/components/add-new-pattern/index.js.map +1 -1
  76. package/build-module/components/add-new-post/index.js +2 -1
  77. package/build-module/components/add-new-post/index.js.map +1 -1
  78. package/build-module/components/add-new-template/utils.js +2 -2
  79. package/build-module/components/add-new-template/utils.js.map +1 -1
  80. package/build-module/components/editor/index.js +73 -22
  81. package/build-module/components/editor/index.js.map +1 -1
  82. package/build-module/components/global-styles/font-families.js +3 -4
  83. package/build-module/components/global-styles/font-families.js.map +1 -1
  84. package/build-module/components/global-styles/font-library-modal/context.js +0 -5
  85. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  86. package/build-module/components/global-styles/font-library-modal/font-collection.js +26 -6
  87. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  88. package/build-module/components/global-styles/font-library-modal/index.js +1 -8
  89. package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
  90. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +21 -6
  91. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  92. package/build-module/components/global-styles/font-library-modal/upload-fonts.js +2 -3
  93. package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  94. package/build-module/components/global-styles/screen-typeset.js +34 -0
  95. package/build-module/components/global-styles/screen-typeset.js.map +1 -0
  96. package/build-module/components/global-styles/screen-typography-element.js +14 -0
  97. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  98. package/build-module/components/global-styles/screen-typography.js +4 -6
  99. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  100. package/build-module/components/global-styles/shadows-edit-panel.js +51 -60
  101. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
  102. package/build-module/components/global-styles/typeset-button.js +89 -0
  103. package/build-module/components/global-styles/typeset-button.js.map +1 -0
  104. package/build-module/components/global-styles/typeset.js +71 -0
  105. package/build-module/components/global-styles/typeset.js.map +1 -0
  106. package/build-module/components/global-styles/ui.js +4 -0
  107. package/build-module/components/global-styles/ui.js.map +1 -1
  108. package/build-module/components/global-styles/utils.js +10 -1
  109. package/build-module/components/global-styles/utils.js.map +1 -1
  110. package/build-module/components/page-patterns/fields.js +223 -0
  111. package/build-module/components/page-patterns/fields.js.map +1 -0
  112. package/build-module/components/page-patterns/index.js +11 -229
  113. package/build-module/components/page-patterns/index.js.map +1 -1
  114. package/build-module/components/page-patterns/use-patterns.js +26 -1
  115. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  116. package/build-module/components/page-templates/fields.js +160 -0
  117. package/build-module/components/page-templates/fields.js.map +1 -0
  118. package/build-module/components/page-templates/index.js +12 -178
  119. package/build-module/components/page-templates/index.js.map +1 -1
  120. package/build-module/components/post-edit/index.js +20 -8
  121. package/build-module/components/post-edit/index.js.map +1 -1
  122. package/build-module/components/post-fields/index.js +19 -15
  123. package/build-module/components/post-fields/index.js.map +1 -1
  124. package/build-module/components/post-list/index.js +127 -69
  125. package/build-module/components/post-list/index.js.map +1 -1
  126. package/build-module/components/sidebar-dataviews/add-new-view.js +2 -2
  127. package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
  128. package/build-module/components/sidebar-dataviews/dataview-item.js +2 -3
  129. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  130. package/build-module/components/sidebar-dataviews/default-views.js +81 -81
  131. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  132. package/build-module/components/sidebar-dataviews/index.js +3 -42
  133. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  134. package/build-module/components/site-hub/index.js +7 -4
  135. package/build-module/components/site-hub/index.js.map +1 -1
  136. package/build-module/components/style-book/index.js +23 -26
  137. package/build-module/components/style-book/index.js.map +1 -1
  138. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -0
  139. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  140. package/build-module/hooks/push-changes-to-global-styles/index.js +2 -3
  141. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  142. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +2 -3
  143. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  144. package/build-module/index.js +0 -2
  145. package/build-module/index.js.map +1 -1
  146. package/build-style/posts-rtl.css +190 -11
  147. package/build-style/posts.css +190 -11
  148. package/build-style/style-rtl.css +296 -55
  149. package/build-style/style.css +296 -55
  150. package/package.json +41 -41
  151. package/src/components/add-new-pattern/index.js +8 -3
  152. package/src/components/add-new-post/index.js +2 -1
  153. package/src/components/add-new-template/utils.js +10 -6
  154. package/src/components/editor/index.js +80 -22
  155. package/src/components/editor/style.scss +59 -1
  156. package/src/components/global-styles/font-families.js +3 -5
  157. package/src/components/global-styles/font-library-modal/context.js +0 -5
  158. package/src/components/global-styles/font-library-modal/font-collection.js +34 -10
  159. package/src/components/global-styles/font-library-modal/index.js +2 -7
  160. package/src/components/global-styles/font-library-modal/installed-fonts.js +23 -5
  161. package/src/components/global-styles/font-library-modal/style.scss +1 -1
  162. package/src/components/global-styles/font-library-modal/upload-fonts.js +2 -2
  163. package/src/components/global-styles/screen-typeset.js +42 -0
  164. package/src/components/global-styles/screen-typography-element.js +14 -0
  165. package/src/components/global-styles/screen-typography.js +4 -4
  166. package/src/components/global-styles/shadows-edit-panel.js +66 -73
  167. package/src/components/global-styles/style.scss +4 -7
  168. package/src/components/global-styles/typeset-button.js +93 -0
  169. package/src/components/global-styles/typeset.js +73 -0
  170. package/src/components/global-styles/ui.js +5 -0
  171. package/src/components/global-styles/utils.js +13 -1
  172. package/src/components/layout/style.scss +8 -0
  173. package/src/components/page-patterns/fields.js +251 -0
  174. package/src/components/page-patterns/index.js +15 -244
  175. package/src/components/page-patterns/style.scss +82 -85
  176. package/src/components/page-patterns/use-patterns.js +31 -1
  177. package/src/components/page-templates/fields.js +157 -0
  178. package/src/components/page-templates/index.js +19 -170
  179. package/src/components/page-templates/style.scss +14 -5
  180. package/src/components/post-edit/index.js +27 -8
  181. package/src/components/post-fields/index.js +29 -17
  182. package/src/components/post-list/index.js +134 -74
  183. package/src/components/sidebar-dataviews/add-new-view.js +2 -4
  184. package/src/components/sidebar-dataviews/dataview-item.js +2 -2
  185. package/src/components/sidebar-dataviews/default-views.js +95 -95
  186. package/src/components/sidebar-dataviews/index.js +3 -37
  187. package/src/components/site-hub/index.js +11 -2
  188. package/src/components/site-icon/style.scss +4 -1
  189. package/src/components/style-book/index.js +27 -32
  190. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -0
  191. package/src/hooks/push-changes-to-global-styles/index.js +2 -3
  192. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +2 -3
  193. package/src/index.js +0 -2
  194. package/build/utils/clone-deep.js +0 -15
  195. package/build/utils/clone-deep.js.map +0 -1
  196. package/build-module/utils/clone-deep.js +0 -9
  197. package/build-module/utils/clone-deep.js.map +0 -1
  198. package/src/utils/clone-deep.js +0 -8
@@ -173,9 +173,14 @@ export default function AddNewPattern() {
173
173
  // When we're not handling template parts, we should
174
174
  // add or create the proper pattern category.
175
175
  if ( postType !== TEMPLATE_PART_POST_TYPE ) {
176
- const currentCategory = categoryMap
177
- .values()
178
- .find( ( term ) => term.name === categoryId );
176
+ /*
177
+ * categoryMap.values() returns an iterator.
178
+ * Iterator.prototype.find() is not yet widely supported.
179
+ * Convert to array to use the Array.prototype.find method.
180
+ */
181
+ const currentCategory = Array.from(
182
+ categoryMap.values()
183
+ ).find( ( term ) => term.name === categoryId );
179
184
  if ( currentCategory ) {
180
185
  currentCategoryId =
181
186
  currentCategory.id ||
@@ -95,9 +95,10 @@ export default function AddNewPostModal( { postType, onSave, onClose } ) {
95
95
  size="small"
96
96
  >
97
97
  <form onSubmit={ createPost }>
98
- <VStack spacing={ 3 }>
98
+ <VStack spacing={ 4 }>
99
99
  <TextControl
100
100
  __next40pxDefaultSize
101
+ __nextHasNoMarginBottom
101
102
  label={ __( 'Title' ) }
102
103
  onChange={ setTitle }
103
104
  placeholder={ __( 'No title' ) }
@@ -166,9 +166,11 @@ export function usePostTypeArchiveMenuItems() {
166
166
  // `icon` is the `menu_icon` property of a post type. We
167
167
  // only handle `dashicons` for now, even if the `menu_icon`
168
168
  // also supports urls and svg as values.
169
- icon: postType.icon?.startsWith( 'dashicons-' )
170
- ? postType.icon.slice( 10 )
171
- : archive,
169
+ icon:
170
+ typeof postType.icon === 'string' &&
171
+ postType.icon.startsWith( 'dashicons-' )
172
+ ? postType.icon.slice( 10 )
173
+ : archive,
172
174
  templatePrefix: 'archive',
173
175
  };
174
176
  } ) || [],
@@ -272,9 +274,11 @@ export const usePostTypeMenuItems = ( onClickMenuItem ) => {
272
274
  // `icon` is the `menu_icon` property of a post type. We
273
275
  // only handle `dashicons` for now, even if the `menu_icon`
274
276
  // also supports urls and svg as values.
275
- icon: icon?.startsWith( 'dashicons-' )
276
- ? icon.slice( 10 )
277
- : post,
277
+ icon:
278
+ typeof icon === 'string' &&
279
+ icon.startsWith( 'dashicons-' )
280
+ ? icon.slice( 10 )
281
+ : post,
278
282
  templatePrefix: templatePrefixes[ slug ],
279
283
  };
280
284
  const hasEntities = postTypesInfo?.[ slug ]?.hasEntities;
@@ -7,8 +7,8 @@ import clsx from 'clsx';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { useDispatch, useSelect } from '@wordpress/data';
10
- import { Button } from '@wordpress/components';
11
- import { useInstanceId } from '@wordpress/compose';
10
+ import { Button, __unstableMotion as motion } from '@wordpress/components';
11
+ import { useInstanceId, useReducedMotion } from '@wordpress/compose';
12
12
  import {
13
13
  EditorKeyboardShortcutsRegister,
14
14
  privateApis as editorPrivateApis,
@@ -22,6 +22,7 @@ import { store as noticesStore } from '@wordpress/notices';
22
22
  import { privateApis as routerPrivateApis } from '@wordpress/router';
23
23
  import { store as preferencesStore } from '@wordpress/preferences';
24
24
  import { decodeEntities } from '@wordpress/html-entities';
25
+ import { Icon, homeButton } from '@wordpress/icons';
25
26
 
26
27
  /**
27
28
  * Internal dependencies
@@ -51,7 +52,32 @@ const { Editor, BackButton } = unlock( editorPrivateApis );
51
52
  const { useHistory, useLocation } = unlock( routerPrivateApis );
52
53
  const { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );
53
54
 
55
+ const toggleHomeIconVariants = {
56
+ edit: {
57
+ opacity: 0,
58
+ scale: 0.2,
59
+ },
60
+ hover: {
61
+ opacity: 1,
62
+ scale: 1,
63
+ clipPath: 'inset( 22% round 2px )',
64
+ },
65
+ };
66
+
67
+ const siteIconVariants = {
68
+ edit: {
69
+ clipPath: 'inset(0% round 0)',
70
+ },
71
+ hover: {
72
+ clipPath: 'inset( 22% round 2px )',
73
+ },
74
+ tap: {
75
+ clipPath: 'inset(0% round 0)',
76
+ },
77
+ };
78
+
54
79
  export default function EditSiteEditor( { isPostsList = false } ) {
80
+ const disableMotion = useReducedMotion();
55
81
  const { params } = useLocation();
56
82
  const isLoading = useIsSiteEditorLoading();
57
83
  const {
@@ -65,6 +91,7 @@ export default function EditSiteEditor( { isPostsList = false } ) {
65
91
  showIconLabels,
66
92
  editorCanvasView,
67
93
  currentPostIsTrashed,
94
+ hasSiteIcon,
68
95
  } = useSelect( ( select ) => {
69
96
  const {
70
97
  getEditorCanvasContainerView,
@@ -75,8 +102,9 @@ export default function EditSiteEditor( { isPostsList = false } ) {
75
102
  getEditedPostId,
76
103
  } = unlock( select( editSiteStore ) );
77
104
  const { get } = select( preferencesStore );
78
- const { getCurrentTheme } = select( coreDataStore );
105
+ const { getCurrentTheme, getEntityRecord } = select( coreDataStore );
79
106
  const _context = getEditedPostContext();
107
+ const siteData = getEntityRecord( 'root', '__unstableBase', undefined );
80
108
 
81
109
  // The currently selected entity to display.
82
110
  // Typically template or template part in the site editor.
@@ -93,6 +121,7 @@ export default function EditSiteEditor( { isPostsList = false } ) {
93
121
  currentPostIsTrashed:
94
122
  select( editorStore ).getCurrentPostAttribute( 'status' ) ===
95
123
  'trash',
124
+ hasSiteIcon: !! siteData?.site_icon_url,
96
125
  };
97
126
  }, [] );
98
127
  useEditorTitle();
@@ -179,6 +208,9 @@ export default function EditSiteEditor( { isPostsList = false } ) {
179
208
  getEditorCanvasContainerTitleAndIcon( editorCanvasView );
180
209
 
181
210
  const isReady = ! isLoading;
211
+ const transition = {
212
+ duration: disableMotion ? 0 : 0.2,
213
+ };
182
214
 
183
215
  return (
184
216
  <>
@@ -217,26 +249,52 @@ export default function EditSiteEditor( { isPostsList = false } ) {
217
249
  <BackButton>
218
250
  { ( { length } ) =>
219
251
  length <= 1 && (
220
- <Button
221
- label={ __( 'Open Navigation' ) }
222
- className="edit-site-layout__view-mode-toggle"
223
- onClick={ () => {
224
- setCanvasMode( 'view' );
225
- // TODO: this is a temporary solution to navigate to the posts list if we are
226
- // come here through `posts list` and are in focus mode editing a template, template part etc..
227
- if (
228
- isPostsList &&
229
- params?.focusMode
230
- ) {
231
- history.push( {
232
- page: 'gutenberg-posts-dashboard',
233
- postType: 'post',
234
- } );
235
- }
236
- } }
252
+ <motion.div
253
+ className="edit-site-editor__view-mode-toggle"
254
+ transition={ transition }
255
+ animate="edit"
256
+ initial="edit"
257
+ whileHover="hover"
258
+ whileTap="tap"
237
259
  >
238
- <SiteIcon className="edit-site-layout__view-mode-toggle-icon" />
239
- </Button>
260
+ <Button
261
+ label={ __( 'Open Navigation' ) }
262
+ showTooltip
263
+ tooltipPosition="middle right"
264
+ onClick={ () => {
265
+ setCanvasMode( 'view' );
266
+ // TODO: this is a temporary solution to navigate to the posts list if we are
267
+ // come here through `posts list` and are in focus mode editing a template, template part etc..
268
+ if (
269
+ isPostsList &&
270
+ params?.focusMode
271
+ ) {
272
+ history.push( {
273
+ page: 'gutenberg-posts-dashboard',
274
+ postType: 'post',
275
+ } );
276
+ }
277
+ } }
278
+ >
279
+ <motion.div
280
+ variants={ siteIconVariants }
281
+ >
282
+ <SiteIcon className="edit-site-editor__view-mode-toggle-icon" />
283
+ </motion.div>
284
+ </Button>
285
+ <motion.div
286
+ className={ clsx(
287
+ 'edit-site-editor__back-icon',
288
+ {
289
+ 'has-site-icon':
290
+ hasSiteIcon,
291
+ }
292
+ ) }
293
+ variants={ toggleHomeIconVariants }
294
+ >
295
+ <Icon icon={ homeButton } />
296
+ </motion.div>
297
+ </motion.div>
240
298
  )
241
299
  }
242
300
  </BackButton>
@@ -1,7 +1,7 @@
1
1
  .edit-site-editor__editor-interface {
2
2
  opacity: 1;
3
3
  transition: opacity 0.1s ease-out;
4
- @include reduce-motion("transition");
4
+ @include reduce-motion( "transition" );
5
5
 
6
6
  &.is-loading {
7
7
  opacity: 0;
@@ -17,3 +17,61 @@
17
17
  display: flex;
18
18
  justify-content: center;
19
19
  }
20
+
21
+ .edit-site-editor__view-mode-toggle {
22
+ /* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
23
+ view-transition-name: toggle;
24
+ /* stylelint-enable */
25
+ top: 0;
26
+ left: 0;
27
+ height: $header-height;
28
+ width: $header-height;
29
+ z-index: 100;
30
+
31
+ .components-button {
32
+ color: $white;
33
+ height: 100%;
34
+ width: 100%;
35
+ border-radius: 0;
36
+ overflow: hidden;
37
+ padding: 0;
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+ &:hover,
42
+ &:active {
43
+ color: $white;
44
+ }
45
+
46
+ &:focus {
47
+ box-shadow: none;
48
+ }
49
+ }
50
+
51
+ .edit-site-editor__view-mode-toggle-icon {
52
+ svg,
53
+ img {
54
+ background: $gray-900;
55
+ display: block;
56
+ }
57
+ }
58
+ }
59
+
60
+ .edit-site-editor__back-icon {
61
+ position: absolute;
62
+ top: 0;
63
+ left: 0;
64
+ width: 60px;
65
+ height: 60px;
66
+ display: flex;
67
+ align-items: center;
68
+ justify-content: center;
69
+ background-color: hsla(0, 0%, 80%);
70
+ pointer-events: none;
71
+
72
+ &.has-site-icon {
73
+ background-color: hsla(0, 0%, 100%, 0.6);
74
+ -webkit-backdrop-filter: saturate(180%) blur(15px);
75
+ backdrop-filter: saturate(180%) blur(15px);
76
+ }
77
+ }
@@ -26,7 +26,7 @@ import { unlock } from '../../lock-unlock';
26
26
  const { useGlobalSetting } = unlock( blockEditorPrivateApis );
27
27
 
28
28
  function FontFamilies() {
29
- const { baseCustomFonts, modalTabOpen, setModalTabOpen, setNotice } =
29
+ const { baseCustomFonts, modalTabOpen, setModalTabOpen } =
30
30
  useContext( FontLibraryContext );
31
31
  const [ fontFamilies ] = useGlobalSetting( 'typography.fontFamilies' );
32
32
  const [ baseFontFamilies ] = useGlobalSetting(
@@ -69,7 +69,7 @@ function FontFamilies() {
69
69
  _x( 'Theme', 'font source' )
70
70
  }
71
71
  </Subtitle>
72
- <ItemGroup isBordered isSeparated>
72
+ <ItemGroup size="large" isBordered isSeparated>
73
73
  { themeFonts.map( ( font ) => (
74
74
  <FontFamilyItem
75
75
  key={ font.slug }
@@ -87,7 +87,7 @@ function FontFamilies() {
87
87
  _x( 'Custom', 'font source' )
88
88
  }
89
89
  </Subtitle>
90
- <ItemGroup isBordered isSeparated>
90
+ <ItemGroup size="large" isBordered isSeparated>
91
91
  { customFonts.map( ( font ) => (
92
92
  <FontFamilyItem
93
93
  key={ font.slug }
@@ -112,8 +112,6 @@ function FontFamilies() {
112
112
  variant="secondary"
113
113
  __next40pxDefaultSize
114
114
  onClick={ () => {
115
- // Reset notice when opening the modal.
116
- setNotice( null );
117
115
  setModalTabOpen(
118
116
  hasInstalledFonts
119
117
  ? 'installed-fonts'
@@ -54,7 +54,6 @@ function FontLibraryProvider( { children } ) {
54
54
 
55
55
  const [ isInstalling, setIsInstalling ] = useState( false );
56
56
  const [ refreshKey, setRefreshKey ] = useState( 0 );
57
- const [ notice, setNotice ] = useState( null );
58
57
 
59
58
  const refreshLibrary = () => {
60
59
  setRefreshKey( Date.now() );
@@ -139,8 +138,6 @@ function FontLibraryProvider( { children } ) {
139
138
  }, [ modalTabOpen ] );
140
139
 
141
140
  const handleSetLibraryFontSelected = ( font ) => {
142
- setNotice( null );
143
-
144
141
  // If font is null, reset the selected font
145
142
  if ( ! font ) {
146
143
  setLibraryFontSelected( null );
@@ -527,8 +524,6 @@ function FontLibraryProvider( { children } ) {
527
524
  modalTabOpen,
528
525
  setModalTabOpen,
529
526
  refreshLibrary,
530
- notice,
531
- setNotice,
532
527
  saveFontFamilies,
533
528
  isResolvingLibrary,
534
529
  isInstalling,
@@ -25,6 +25,7 @@ import {
25
25
  DropdownMenu,
26
26
  SearchControl,
27
27
  ProgressBar,
28
+ CheckboxControl,
28
29
  } from '@wordpress/components';
29
30
  import { debounce } from '@wordpress/compose';
30
31
  import { sprintf, __, _x } from '@wordpress/i18n';
@@ -62,20 +63,15 @@ function FontCollection( { slug } ) {
62
63
  };
63
64
 
64
65
  const [ selectedFont, setSelectedFont ] = useState( null );
66
+ const [ notice, setNotice ] = useState( false );
65
67
  const [ fontsToInstall, setFontsToInstall ] = useState( [] );
66
68
  const [ page, setPage ] = useState( 1 );
67
69
  const [ filters, setFilters ] = useState( {} );
68
70
  const [ renderConfirmDialog, setRenderConfirmDialog ] = useState(
69
71
  requiresPermission && ! getGoogleFontsPermissionFromStorage()
70
72
  );
71
- const {
72
- collections,
73
- getFontCollection,
74
- installFonts,
75
- isInstalling,
76
- notice,
77
- setNotice,
78
- } = useContext( FontLibraryContext );
73
+ const { collections, getFontCollection, installFonts, isInstalling } =
74
+ useContext( FontLibraryContext );
79
75
  const selectedCollection = collections.find(
80
76
  ( collection ) => collection.slug === slug
81
77
  );
@@ -115,8 +111,7 @@ function FontCollection( { slug } ) {
115
111
 
116
112
  useEffect( () => {
117
113
  setSelectedFont( null );
118
- setNotice( null );
119
- }, [ slug, setNotice ] );
114
+ }, [ slug ] );
120
115
 
121
116
  useEffect( () => {
122
117
  // If the selected fonts change, reset the selected fonts to install
@@ -175,6 +170,25 @@ function FontCollection( { slug } ) {
175
170
  setFontsToInstall( [] );
176
171
  };
177
172
 
173
+ const selectFontCount =
174
+ fontsToInstall.length > 0 ? fontsToInstall[ 0 ]?.fontFace?.length : 0;
175
+
176
+ // Check if any fonts are selected.
177
+ const isIndeterminate =
178
+ selectFontCount > 0 &&
179
+ selectFontCount !== selectedFont?.fontFace?.length;
180
+
181
+ // Check if all fonts are selected.
182
+ const isSelectAllChecked =
183
+ selectFontCount === selectedFont?.fontFace?.length;
184
+
185
+ // Toggle select all fonts.
186
+ const toggleSelectAll = () => {
187
+ const newFonts = isSelectAllChecked ? [] : [ selectedFont ];
188
+
189
+ setFontsToInstall( newFonts );
190
+ };
191
+
178
192
  const handleInstall = async () => {
179
193
  setNotice( null );
180
194
 
@@ -301,6 +315,8 @@ function FontCollection( { slug } ) {
301
315
  </FlexItem>
302
316
  <FlexItem>
303
317
  <SelectControl
318
+ __nextHasNoMarginBottom
319
+ __next40pxDefaultSize
304
320
  label={ __( 'Category' ) }
305
321
  value={ filters.category }
306
322
  onChange={ handleCategoryFilter }
@@ -400,6 +416,14 @@ function FontCollection( { slug } ) {
400
416
  { __( 'Select font variants to install.' ) }
401
417
  </Text>
402
418
  <Spacer margin={ 4 } />
419
+ <CheckboxControl
420
+ className="font-library-modal__select-all"
421
+ label={ __( 'Select all' ) }
422
+ checked={ isSelectAllChecked }
423
+ onChange={ toggleSelectAll }
424
+ indeterminate={ isIndeterminate }
425
+ __nextHasNoMarginBottom
426
+ />
403
427
  <VStack spacing={ 0 }>
404
428
  <Spacer margin={ 8 } />
405
429
  { getSortedFontFaces( selectedFont ).map(
@@ -44,7 +44,7 @@ function FontLibraryModal( {
44
44
  onRequestClose,
45
45
  defaultTabId = 'installed-fonts',
46
46
  } ) {
47
- const { collections, setNotice } = useContext( FontLibraryContext );
47
+ const { collections } = useContext( FontLibraryContext );
48
48
  const canUserCreate = useSelect( ( select ) => {
49
49
  return select( coreStore ).canUser( 'create', {
50
50
  kind: 'postType',
@@ -59,11 +59,6 @@ function FontLibraryModal( {
59
59
  tabs.push( ...tabsFromCollections( collections || [] ) );
60
60
  }
61
61
 
62
- // Reset notice when new tab is selected.
63
- const onSelect = () => {
64
- setNotice( null );
65
- };
66
-
67
62
  return (
68
63
  <Modal
69
64
  title={ __( 'Fonts' ) }
@@ -72,7 +67,7 @@ function FontLibraryModal( {
72
67
  className="font-library-modal"
73
68
  >
74
69
  <div className="font-library-modal__tabs">
75
- <Tabs defaultTabId={ defaultTabId } onSelect={ onSelect }>
70
+ <Tabs defaultTabId={ defaultTabId }>
76
71
  <Tabs.TabList>
77
72
  { tabs.map( ( { id, title } ) => (
78
73
  <Tabs.Tab key={ id } tabId={ id }>
@@ -53,14 +53,13 @@ function InstalledFonts() {
53
53
  isInstalling,
54
54
  saveFontFamilies,
55
55
  getFontFacesActivated,
56
- notice,
57
- setNotice,
58
56
  } = useContext( FontLibraryContext );
59
57
 
60
58
  const [ fontFamilies, setFontFamilies ] = useGlobalSetting(
61
59
  'typography.fontFamilies'
62
60
  );
63
61
  const [ isConfirmDeleteOpen, setIsConfirmDeleteOpen ] = useState( false );
62
+ const [ notice, setNotice ] = useState( false );
64
63
  const [ baseFontFamilies ] = useGlobalSetting(
65
64
  'typography.fontFamilies',
66
65
  undefined,
@@ -120,6 +119,24 @@ function InstalledFonts() {
120
119
  setIsConfirmDeleteOpen( true );
121
120
  };
122
121
 
122
+ const handleUpdate = async () => {
123
+ setNotice( null );
124
+ try {
125
+ await saveFontFamilies( fontFamilies );
126
+ setNotice( {
127
+ type: 'success',
128
+ message: __( 'Font family updated successfully.' ),
129
+ } );
130
+ } catch ( error ) {
131
+ setNotice( {
132
+ type: 'error',
133
+ message:
134
+ __( 'There was an error updating the font family. ' ) +
135
+ error.message,
136
+ } );
137
+ }
138
+ };
139
+
123
140
  const getFontFacesToDisplay = ( font ) => {
124
141
  if ( ! font ) {
125
142
  return [];
@@ -265,6 +282,7 @@ function InstalledFonts() {
265
282
  font
266
283
  ) }
267
284
  onClick={ () => {
285
+ setNotice( null );
268
286
  handleSetLibraryFontSelected(
269
287
  font
270
288
  );
@@ -305,6 +323,7 @@ function InstalledFonts() {
305
323
  font
306
324
  ) }
307
325
  onClick={ () => {
326
+ setNotice( null );
308
327
  handleSetLibraryFontSelected(
309
328
  font
310
329
  );
@@ -337,6 +356,7 @@ function InstalledFonts() {
337
356
  size="small"
338
357
  onClick={ () => {
339
358
  handleSetLibraryFontSelected( null );
359
+ setNotice( null );
340
360
  } }
341
361
  label={ __( 'Back' ) }
342
362
  />
@@ -406,9 +426,7 @@ function InstalledFonts() {
406
426
  ) }
407
427
  <Button
408
428
  variant="primary"
409
- onClick={ () => {
410
- saveFontFamilies( fontFamilies );
411
- } }
429
+ onClick={ handleUpdate }
412
430
  disabled={ ! fontFamiliesHasChanges }
413
431
  accessibleWhenDisabled
414
432
  >
@@ -69,6 +69,7 @@ $footer-height: 70px;
69
69
  color: $gray-900;
70
70
  }
71
71
 
72
+ // TODO: See if this can be removed after https://github.com/WordPress/gutenberg/issues/38730
72
73
  .font-library-modal__tabpanel-layout .components-base-control__field {
73
74
  margin-bottom: 0;
74
75
  }
@@ -194,4 +195,3 @@ button.font-library-modal__upload-area {
194
195
  padding-left: $grid-unit-20;
195
196
  }
196
197
  }
197
-
@@ -25,9 +25,9 @@ import makeFamiliesFromFaces from './utils/make-families-from-faces';
25
25
  import { loadFontFaceInBrowser } from './utils';
26
26
 
27
27
  function UploadFonts() {
28
- const { installFonts, notice, setNotice } =
29
- useContext( FontLibraryContext );
28
+ const { installFonts } = useContext( FontLibraryContext );
30
29
  const [ isUploading, setIsUploading ] = useState( false );
30
+ const [ notice, setNotice ] = useState( false );
31
31
 
32
32
  const handleDropZone = ( files ) => {
33
33
  handleFilesUpload( files );
@@ -0,0 +1,42 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+ import { useSelect } from '@wordpress/data';
6
+ import { store as editorStore } from '@wordpress/editor';
7
+ import { __experimentalVStack as VStack } from '@wordpress/components';
8
+
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+ import TypographyVariations from './variations/variations-typography';
13
+ import ScreenHeader from './header';
14
+ import FontFamilies from './font-families';
15
+
16
+ function ScreenTypeset() {
17
+ const fontLibraryEnabled = useSelect(
18
+ ( select ) =>
19
+ select( editorStore ).getEditorSettings().fontLibraryEnabled,
20
+ []
21
+ );
22
+
23
+ return (
24
+ <>
25
+ <ScreenHeader
26
+ title={ __( 'Typesets' ) }
27
+ description={ __(
28
+ 'Fonts and typographic styling applied across the site.'
29
+ ) }
30
+ />
31
+ <div className="edit-site-global-styles-screen">
32
+ <VStack spacing={ 7 }>
33
+ <TypographyVariations />
34
+
35
+ { fontLibraryEnabled && <FontFamilies /> }
36
+ </VStack>
37
+ </div>
38
+ </>
39
+ );
40
+ }
41
+
42
+ export default ScreenTypeset;
@@ -67,30 +67,44 @@ function ScreenTypographyElement( { element } ) {
67
67
  >
68
68
  <ToggleGroupControlOption
69
69
  value="heading"
70
+ showTooltip
71
+ aria-label={ __( 'All headings' ) }
70
72
  label={ _x( 'All', 'heading levels' ) }
71
73
  />
72
74
  <ToggleGroupControlOption
73
75
  value="h1"
76
+ showTooltip
77
+ aria-label={ __( 'Heading 1' ) }
74
78
  label={ __( 'H1' ) }
75
79
  />
76
80
  <ToggleGroupControlOption
77
81
  value="h2"
82
+ showTooltip
83
+ aria-label={ __( 'Heading 2' ) }
78
84
  label={ __( 'H2' ) }
79
85
  />
80
86
  <ToggleGroupControlOption
81
87
  value="h3"
88
+ showTooltip
89
+ aria-label={ __( 'Heading 3' ) }
82
90
  label={ __( 'H3' ) }
83
91
  />
84
92
  <ToggleGroupControlOption
85
93
  value="h4"
94
+ showTooltip
95
+ aria-label={ __( 'Heading 4' ) }
86
96
  label={ __( 'H4' ) }
87
97
  />
88
98
  <ToggleGroupControlOption
89
99
  value="h5"
100
+ showTooltip
101
+ aria-label={ __( 'Heading 5' ) }
90
102
  label={ __( 'H5' ) }
91
103
  />
92
104
  <ToggleGroupControlOption
93
105
  value="h6"
106
+ showTooltip
107
+ aria-label={ __( 'Heading 6' ) }
94
108
  label={ __( 'H6' ) }
95
109
  />
96
110
  </ToggleGroupControl>