@wordpress/edit-site 6.7.1-next.1f6eadc42.0 → 6.8.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 (113) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/editor/index.js +1 -5
  3. package/build/components/editor/index.js.map +1 -1
  4. package/build/components/editor-canvas-container/index.js +6 -17
  5. package/build/components/editor-canvas-container/index.js.map +1 -1
  6. package/build/components/global-styles/font-library-modal/font-card.js +2 -4
  7. package/build/components/global-styles/font-library-modal/font-card.js.map +1 -1
  8. package/build/components/global-styles/font-library-modal/font-collection.js +2 -4
  9. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  10. package/build/components/global-styles/font-library-modal/index.js +28 -28
  11. package/build/components/global-styles/font-library-modal/index.js.map +1 -1
  12. package/build/components/global-styles/font-library-modal/installed-fonts.js +4 -8
  13. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  14. package/build/components/global-styles/font-library-modal/upload-fonts.js +2 -4
  15. package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  16. package/build/components/global-styles/palette.js +2 -4
  17. package/build/components/global-styles/palette.js.map +1 -1
  18. package/build/components/global-styles/root-menu.js +12 -1
  19. package/build/components/global-styles/root-menu.js.map +1 -1
  20. package/build/components/global-styles/screen-background.js +40 -0
  21. package/build/components/global-styles/screen-background.js.map +1 -0
  22. package/build/components/global-styles/screen-layout.js +1 -8
  23. package/build/components/global-styles/screen-layout.js.map +1 -1
  24. package/build/components/global-styles/screen-revisions/revisions-buttons.js +2 -4
  25. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  26. package/build/components/global-styles/screen-root.js +3 -0
  27. package/build/components/global-styles/screen-root.js.map +1 -1
  28. package/build/components/global-styles/shadows-edit-panel.js +14 -58
  29. package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
  30. package/build/components/global-styles/ui.js +4 -0
  31. package/build/components/global-styles/ui.js.map +1 -1
  32. package/build/components/post-list/index.js +35 -2
  33. package/build/components/post-list/index.js.map +1 -1
  34. package/build/components/sidebar-dataviews/dataview-item.js +3 -1
  35. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  36. package/build/components/sidebar-dataviews/default-views.js +79 -47
  37. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  38. package/build/components/sidebar-dataviews/index.js +4 -1
  39. package/build/components/sidebar-dataviews/index.js.map +1 -1
  40. package/build/hooks/push-changes-to-global-styles/index.js +1 -0
  41. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  42. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +1 -0
  43. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  44. package/build-module/components/editor/index.js +2 -6
  45. package/build-module/components/editor/index.js.map +1 -1
  46. package/build-module/components/editor-canvas-container/index.js +7 -18
  47. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  48. package/build-module/components/global-styles/font-library-modal/font-card.js +2 -4
  49. package/build-module/components/global-styles/font-library-modal/font-card.js.map +1 -1
  50. package/build-module/components/global-styles/font-library-modal/font-collection.js +2 -4
  51. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  52. package/build-module/components/global-styles/font-library-modal/index.js +28 -28
  53. package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
  54. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +4 -8
  55. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  56. package/build-module/components/global-styles/font-library-modal/upload-fonts.js +2 -4
  57. package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  58. package/build-module/components/global-styles/palette.js +2 -4
  59. package/build-module/components/global-styles/palette.js.map +1 -1
  60. package/build-module/components/global-styles/root-menu.js +13 -2
  61. package/build-module/components/global-styles/root-menu.js.map +1 -1
  62. package/build-module/components/global-styles/screen-background.js +34 -0
  63. package/build-module/components/global-styles/screen-background.js.map +1 -0
  64. package/build-module/components/global-styles/screen-layout.js +1 -8
  65. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  66. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +2 -4
  67. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  68. package/build-module/components/global-styles/screen-root.js +3 -0
  69. package/build-module/components/global-styles/screen-root.js.map +1 -1
  70. package/build-module/components/global-styles/shadows-edit-panel.js +17 -61
  71. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
  72. package/build-module/components/global-styles/ui.js +4 -0
  73. package/build-module/components/global-styles/ui.js.map +1 -1
  74. package/build-module/components/post-list/index.js +35 -2
  75. package/build-module/components/post-list/index.js.map +1 -1
  76. package/build-module/components/sidebar-dataviews/dataview-item.js +3 -1
  77. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  78. package/build-module/components/sidebar-dataviews/default-views.js +79 -48
  79. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  80. package/build-module/components/sidebar-dataviews/index.js +5 -2
  81. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  82. package/build-module/hooks/push-changes-to-global-styles/index.js +1 -0
  83. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  84. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +1 -0
  85. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  86. package/build-style/posts-rtl.css +5 -5
  87. package/build-style/posts.css +5 -5
  88. package/build-style/style-rtl.css +15 -19
  89. package/build-style/style.css +15 -19
  90. package/package.json +41 -41
  91. package/src/components/editor/index.js +2 -4
  92. package/src/components/editor-canvas-container/index.js +7 -18
  93. package/src/components/global-styles/font-library-modal/font-card.js +1 -2
  94. package/src/components/global-styles/font-library-modal/font-collection.js +1 -2
  95. package/src/components/global-styles/font-library-modal/index.js +26 -26
  96. package/src/components/global-styles/font-library-modal/installed-fonts.js +2 -4
  97. package/src/components/global-styles/font-library-modal/style.scss +19 -12
  98. package/src/components/global-styles/font-library-modal/upload-fonts.js +1 -2
  99. package/src/components/global-styles/palette.js +1 -2
  100. package/src/components/global-styles/root-menu.js +16 -0
  101. package/src/components/global-styles/screen-background.js +37 -0
  102. package/src/components/global-styles/screen-layout.js +3 -13
  103. package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -2
  104. package/src/components/global-styles/screen-root.js +7 -3
  105. package/src/components/global-styles/shadows-edit-panel.js +11 -70
  106. package/src/components/global-styles/style.scss +8 -0
  107. package/src/components/global-styles/ui.js +5 -0
  108. package/src/components/post-list/index.js +48 -2
  109. package/src/components/sidebar-dataviews/dataview-item.js +2 -0
  110. package/src/components/sidebar-dataviews/default-views.js +92 -58
  111. package/src/components/sidebar-dataviews/index.js +7 -2
  112. package/src/components/sidebar-dataviews/style.scss +4 -0
  113. package/src/style.scss +0 -16
@@ -13,7 +13,6 @@ import {
13
13
  __experimentalItemGroup as ItemGroup,
14
14
  __experimentalInputControl as InputControl,
15
15
  __experimentalUnitControl as UnitControl,
16
- __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
17
16
  __experimentalGrid as Grid,
18
17
  __experimentalDropdownContentWrapper as DropdownContentWrapper,
19
18
  __experimentalUseNavigator as useNavigator,
@@ -21,7 +20,6 @@ import {
21
20
  __experimentalToggleGroupControlOption as ToggleGroupControlOption,
22
21
  __experimentalConfirmDialog as ConfirmDialog,
23
22
  Dropdown,
24
- RangeControl,
25
23
  Button,
26
24
  Flex,
27
25
  FlexItem,
@@ -35,7 +33,6 @@ import {
35
33
  plus,
36
34
  shadow as shadowIcon,
37
35
  reset,
38
- settings,
39
36
  moreVertical,
40
37
  } from '@wordpress/icons';
41
38
  import { useState, useMemo } from '@wordpress/element';
@@ -51,7 +48,6 @@ import {
51
48
  getShadowParts,
52
49
  shadowStringToObject,
53
50
  shadowObjectToString,
54
- CUSTOM_VALUE_SETTINGS,
55
51
  } from './shadow-utils';
56
52
 
57
53
  const { useGlobalSetting } = unlock( blockEditorPrivateApis );
@@ -234,8 +230,7 @@ export default function ShadowsEditPanel() {
234
230
  >
235
231
  <FlexItem>
236
232
  <Button
237
- // TODO: Switch to `true` (40px size) if possible
238
- __next40pxDefaultSize={ false }
233
+ __next40pxDefaultSize
239
234
  variant="tertiary"
240
235
  onClick={ () =>
241
236
  setIsRenameModalVisible( false )
@@ -246,8 +241,7 @@ export default function ShadowsEditPanel() {
246
241
  </FlexItem>
247
242
  <FlexItem>
248
243
  <Button
249
- // TODO: Switch to `true` (40px size) if possible
250
- __next40pxDefaultSize={ false }
244
+ __next40pxDefaultSize
251
245
  variant="primary"
252
246
  type="submit"
253
247
  >
@@ -381,8 +375,7 @@ function ShadowItem( { shadow, onChange, canRemove, onRemove } ) {
381
375
  <HStack align="center" justify="flex-start" spacing={ 0 }>
382
376
  <FlexItem style={ { flexGrow: 1 } }>
383
377
  <Button
384
- // TODO: Switch to `true` (40px size) if possible
385
- __next40pxDefaultSize={ false }
378
+ __next40pxDefaultSize
386
379
  icon={ shadowIcon }
387
380
  { ...toggleProps }
388
381
  >
@@ -394,8 +387,7 @@ function ShadowItem( { shadow, onChange, canRemove, onRemove } ) {
394
387
  { canRemove && (
395
388
  <FlexItem>
396
389
  <Button
397
- // TODO: Switch to `true` (40px size) if possible
398
- __next40pxDefaultSize={ false }
390
+ __next40pxDefaultSize
399
391
  icon={ reset }
400
392
  { ...removeButtonProps }
401
393
  />
@@ -468,13 +460,11 @@ function ShadowPopover( { shadowObj, onChange } ) {
468
460
  <ShadowInputControl
469
461
  label={ __( 'X Position' ) }
470
462
  value={ shadowObj.x }
471
- hasNegativeRange
472
463
  onChange={ ( value ) => onShadowChange( 'x', value ) }
473
464
  />
474
465
  <ShadowInputControl
475
466
  label={ __( 'Y Position' ) }
476
467
  value={ shadowObj.y }
477
- hasNegativeRange
478
468
  onChange={ ( value ) => onShadowChange( 'y', value ) }
479
469
  />
480
470
  <ShadowInputControl
@@ -485,7 +475,6 @@ function ShadowPopover( { shadowObj, onChange } ) {
485
475
  <ShadowInputControl
486
476
  label={ __( 'Spread' ) }
487
477
  value={ shadowObj.spread }
488
- hasNegativeRange
489
478
  onChange={ ( value ) => onShadowChange( 'spread', value ) }
490
479
  />
491
480
  </Grid>
@@ -493,16 +482,7 @@ function ShadowPopover( { shadowObj, onChange } ) {
493
482
  );
494
483
  }
495
484
 
496
- function ShadowInputControl( { label, value, onChange, hasNegativeRange } ) {
497
- const [ isCustomInput, setIsCustomInput ] = useState( false );
498
- const [ parsedQuantity, parsedUnit ] =
499
- parseQuantityAndUnitFromRawValue( value );
500
-
501
- const sliderOnChange = ( next ) => {
502
- onChange(
503
- next !== undefined ? [ next, parsedUnit || 'px' ].join( '' ) : '0px'
504
- );
505
- };
485
+ function ShadowInputControl( { label, value, onChange } ) {
506
486
  const onValueChange = ( next ) => {
507
487
  const isNumeric = next !== undefined && ! isNaN( parseFloat( next ) );
508
488
  const nextValue = isNumeric ? next : '0px';
@@ -510,50 +490,11 @@ function ShadowInputControl( { label, value, onChange, hasNegativeRange } ) {
510
490
  };
511
491
 
512
492
  return (
513
- <VStack justify="flex-start">
514
- <HStack justify="space-between">
515
- <Subtitle>{ label }</Subtitle>
516
- <Button
517
- label={ __( 'Use custom size' ) }
518
- icon={ settings }
519
- onClick={ () => {
520
- setIsCustomInput( ! isCustomInput );
521
- } }
522
- isPressed={ isCustomInput }
523
- size="small"
524
- />
525
- </HStack>
526
- { isCustomInput ? (
527
- <UnitControl
528
- label={ label }
529
- hideLabelFromVision
530
- __next40pxDefaultSize
531
- value={ value }
532
- onChange={ onValueChange }
533
- />
534
- ) : (
535
- <RangeControl
536
- value={ parsedQuantity ?? 0 }
537
- onChange={ sliderOnChange }
538
- withInputField={ false }
539
- __next40pxDefaultSize
540
- __nextHasNoMarginBottom
541
- min={
542
- hasNegativeRange
543
- ? -(
544
- CUSTOM_VALUE_SETTINGS[ parsedUnit ?? 'px' ]
545
- ?.max ?? 10
546
- )
547
- : 0
548
- }
549
- max={
550
- CUSTOM_VALUE_SETTINGS[ parsedUnit ?? 'px' ]?.max ?? 10
551
- }
552
- step={
553
- CUSTOM_VALUE_SETTINGS[ parsedUnit ?? 'px' ]?.step ?? 0.1
554
- }
555
- />
556
- ) }
557
- </VStack>
493
+ <UnitControl
494
+ label={ label }
495
+ __next40pxDefaultSize
496
+ value={ value }
497
+ onChange={ onValueChange }
498
+ />
558
499
  );
559
500
  }
@@ -221,3 +221,11 @@
221
221
  fill: currentColor;
222
222
  }
223
223
 
224
+ .edit-site-global-styles-screen-root__active-style-tile {
225
+ // Todo: revisit use of Card component and/or remove override
226
+ // The &#{&} is a workaround for the specificity of the Card component.
227
+ &#{&},
228
+ &#{&} .edit-site-global-styles-screen-root__active-style-tile-preview {
229
+ border-radius: $radius-small;
230
+ }
231
+ }
@@ -38,6 +38,7 @@ import FontSize from './font-sizes/font-size';
38
38
  import FontSizes from './font-sizes/font-sizes';
39
39
  import ScreenColors from './screen-colors';
40
40
  import ScreenColorPalette from './screen-color-palette';
41
+ import ScreenBackground from './screen-background';
41
42
  import { ScreenShadows, ScreenShadowsEdit } from './screen-shadows';
42
43
  import ScreenLayout from './screen-layout';
43
44
  import ScreenStyleVariations from './screen-style-variations';
@@ -372,6 +373,10 @@ function GlobalStylesUI() {
372
373
  <ScreenRevisions />
373
374
  </GlobalStylesNavigationScreen>
374
375
 
376
+ <GlobalStylesNavigationScreen path="/background">
377
+ <ScreenBackground />
378
+ </GlobalStylesNavigationScreen>
379
+
375
380
  { blocks.map( ( block ) => (
376
381
  <GlobalStylesNavigationScreen
377
382
  key={ 'menu-block-' + block.name }
@@ -179,6 +179,7 @@ function getItemId( item ) {
179
179
 
180
180
  export default function PostList( { postType } ) {
181
181
  const [ view, setView ] = useView( postType );
182
+ const defaultViews = useDefaultViews( { postType } );
182
183
  const history = useHistory();
183
184
  const location = useLocation();
184
185
  const {
@@ -202,7 +203,26 @@ export default function PostList( { postType } ) {
202
203
  [ history ]
203
204
  );
204
205
 
205
- const { isLoading: isLoadingFields, fields } = usePostFields( view.type );
206
+ const getActiveViewFilters = ( views, match ) => {
207
+ const found = views.find( ( { slug } ) => slug === match );
208
+ return found?.filters ?? [];
209
+ };
210
+
211
+ const { isLoading: isLoadingFields, fields: _fields } = usePostFields(
212
+ view.type
213
+ );
214
+ const fields = useMemo( () => {
215
+ const activeViewFilters = getActiveViewFilters(
216
+ defaultViews,
217
+ activeView
218
+ ).map( ( { field } ) => field );
219
+ return _fields.map( ( field ) => ( {
220
+ ...field,
221
+ elements: activeViewFilters.includes( field.id )
222
+ ? []
223
+ : field.elements,
224
+ } ) );
225
+ }, [ _fields, defaultViews, activeView ] );
206
226
 
207
227
  const queryArgs = useMemo( () => {
208
228
  const filters = {};
@@ -225,6 +245,32 @@ export default function PostList( { postType } ) {
225
245
  filters.author_exclude = filter.value;
226
246
  }
227
247
  } );
248
+
249
+ // The bundled views want data filtered without displaying the filter.
250
+ const activeViewFilters = getActiveViewFilters(
251
+ defaultViews,
252
+ activeView
253
+ );
254
+ activeViewFilters.forEach( ( filter ) => {
255
+ if (
256
+ filter.field === 'status' &&
257
+ filter.operator === OPERATOR_IS_ANY
258
+ ) {
259
+ filters.status = filter.value;
260
+ }
261
+ if (
262
+ filter.field === 'author' &&
263
+ filter.operator === OPERATOR_IS_ANY
264
+ ) {
265
+ filters.author = filter.value;
266
+ } else if (
267
+ filter.field === 'author' &&
268
+ filter.operator === OPERATOR_IS_NONE
269
+ ) {
270
+ filters.author_exclude = filter.value;
271
+ }
272
+ } );
273
+
228
274
  // We want to provide a different default item for the status filter
229
275
  // than the REST API provides.
230
276
  if ( ! filters.status || filters.status === '' ) {
@@ -240,7 +286,7 @@ export default function PostList( { postType } ) {
240
286
  search: view.search,
241
287
  ...filters,
242
288
  };
243
- }, [ view ] );
289
+ }, [ view, activeView, defaultViews ] );
244
290
  const {
245
291
  records,
246
292
  isResolving: isLoadingData,
@@ -27,6 +27,7 @@ export default function DataViewItem( {
27
27
  isActive,
28
28
  isCustom,
29
29
  suffix,
30
+ navigationItemSuffix,
30
31
  } ) {
31
32
  const {
32
33
  params: { postType },
@@ -55,6 +56,7 @@ export default function DataViewItem( {
55
56
  <SidebarNavigationItem
56
57
  icon={ iconToUse }
57
58
  { ...linkInfo }
59
+ suffix={ navigationItemSuffix }
58
60
  aria-current={ isActive ? 'true' : undefined }
59
61
  >
60
62
  { title }
@@ -13,7 +13,7 @@ import {
13
13
  notAllowed,
14
14
  } from '@wordpress/icons';
15
15
  import { useSelect } from '@wordpress/data';
16
- import { store as coreStore } from '@wordpress/core-data';
16
+ import { store as coreStore, useEntityRecords } from '@wordpress/core-data';
17
17
  import { useMemo } from '@wordpress/element';
18
18
 
19
19
  /**
@@ -68,6 +68,50 @@ const DEFAULT_POST_BASE = {
68
68
  layout: defaultLayouts[ LAYOUT_LIST ].layout,
69
69
  };
70
70
 
71
+ export function useDefaultViewsWithItemCounts( { postType } ) {
72
+ const defaultViews = useDefaultViews( { postType } );
73
+ const { records, totalItems } = useEntityRecords( 'postType', postType, {
74
+ per_page: -1,
75
+ status: [ 'any', 'trash' ],
76
+ } );
77
+
78
+ return useMemo( () => {
79
+ if ( ! defaultViews ) {
80
+ return [];
81
+ }
82
+
83
+ // If there are no records, return the default views with no counts.
84
+ if ( ! records ) {
85
+ return defaultViews;
86
+ }
87
+
88
+ const counts = {
89
+ drafts: records.filter( ( record ) => record.status === 'draft' )
90
+ .length,
91
+ future: records.filter( ( record ) => record.status === 'future' )
92
+ .length,
93
+ pending: records.filter( ( record ) => record.status === 'pending' )
94
+ .length,
95
+ private: records.filter( ( record ) => record.status === 'private' )
96
+ .length,
97
+ published: records.filter(
98
+ ( record ) => record.status === 'publish'
99
+ ).length,
100
+ trash: records.filter( ( record ) => record.status === 'trash' )
101
+ .length,
102
+ };
103
+
104
+ // All items excluding trashed items as per the default "all" status query.
105
+ counts.all = totalItems ? totalItems - counts.trash : 0;
106
+
107
+ // Filter out views with > 0 item counts.
108
+ return defaultViews.map( ( _view ) => {
109
+ _view.count = counts[ _view.slug ];
110
+ return _view;
111
+ } );
112
+ }, [ defaultViews, records, totalItems ] );
113
+ }
114
+
71
115
  export function useDefaultViews( { postType } ) {
72
116
  const labels = useSelect(
73
117
  ( select ) => {
@@ -88,76 +132,66 @@ export function useDefaultViews( { postType } ) {
88
132
  title: __( 'Published' ),
89
133
  slug: 'published',
90
134
  icon: published,
91
- view: {
92
- ...DEFAULT_POST_BASE,
93
- filters: [
94
- {
95
- field: 'status',
96
- operator: OPERATOR_IS_ANY,
97
- value: 'publish',
98
- },
99
- ],
100
- },
135
+ view: DEFAULT_POST_BASE,
136
+ filters: [
137
+ {
138
+ field: 'status',
139
+ operator: OPERATOR_IS_ANY,
140
+ value: 'publish',
141
+ },
142
+ ],
101
143
  },
102
144
  {
103
145
  title: __( 'Scheduled' ),
104
146
  slug: 'future',
105
147
  icon: scheduled,
106
- view: {
107
- ...DEFAULT_POST_BASE,
108
- filters: [
109
- {
110
- field: 'status',
111
- operator: OPERATOR_IS_ANY,
112
- value: 'future',
113
- },
114
- ],
115
- },
148
+ view: DEFAULT_POST_BASE,
149
+ filters: [
150
+ {
151
+ field: 'status',
152
+ operator: OPERATOR_IS_ANY,
153
+ value: 'future',
154
+ },
155
+ ],
116
156
  },
117
157
  {
118
158
  title: __( 'Drafts' ),
119
159
  slug: 'drafts',
120
160
  icon: drafts,
121
- view: {
122
- ...DEFAULT_POST_BASE,
123
- filters: [
124
- {
125
- field: 'status',
126
- operator: OPERATOR_IS_ANY,
127
- value: 'draft',
128
- },
129
- ],
130
- },
161
+ view: DEFAULT_POST_BASE,
162
+ filters: [
163
+ {
164
+ field: 'status',
165
+ operator: OPERATOR_IS_ANY,
166
+ value: 'draft',
167
+ },
168
+ ],
131
169
  },
132
170
  {
133
171
  title: __( 'Pending' ),
134
172
  slug: 'pending',
135
173
  icon: pending,
136
- view: {
137
- ...DEFAULT_POST_BASE,
138
- filters: [
139
- {
140
- field: 'status',
141
- operator: OPERATOR_IS_ANY,
142
- value: 'pending',
143
- },
144
- ],
145
- },
174
+ view: DEFAULT_POST_BASE,
175
+ filters: [
176
+ {
177
+ field: 'status',
178
+ operator: OPERATOR_IS_ANY,
179
+ value: 'pending',
180
+ },
181
+ ],
146
182
  },
147
183
  {
148
184
  title: __( 'Private' ),
149
185
  slug: 'private',
150
186
  icon: notAllowed,
151
- view: {
152
- ...DEFAULT_POST_BASE,
153
- filters: [
154
- {
155
- field: 'status',
156
- operator: OPERATOR_IS_ANY,
157
- value: 'private',
158
- },
159
- ],
160
- },
187
+ view: DEFAULT_POST_BASE,
188
+ filters: [
189
+ {
190
+ field: 'status',
191
+ operator: OPERATOR_IS_ANY,
192
+ value: 'private',
193
+ },
194
+ ],
161
195
  },
162
196
  {
163
197
  title: __( 'Trash' ),
@@ -167,14 +201,14 @@ export function useDefaultViews( { postType } ) {
167
201
  ...DEFAULT_POST_BASE,
168
202
  type: LAYOUT_TABLE,
169
203
  layout: defaultLayouts[ LAYOUT_TABLE ].layout,
170
- filters: [
171
- {
172
- field: 'status',
173
- operator: OPERATOR_IS_ANY,
174
- value: 'trash',
175
- },
176
- ],
177
204
  },
205
+ filters: [
206
+ {
207
+ field: 'status',
208
+ operator: OPERATOR_IS_ANY,
209
+ value: 'trash',
210
+ },
211
+ ],
178
212
  },
179
213
  ];
180
214
  }, [ labels ] );
@@ -7,7 +7,7 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
7
7
  /**
8
8
  * Internal dependencies
9
9
  */
10
- import { useDefaultViews } from './default-views';
10
+ import { useDefaultViewsWithItemCounts } from './default-views';
11
11
  import { unlock } from '../../lock-unlock';
12
12
  import DataViewItem from './dataview-item';
13
13
  import CustomDataViewsList from './custom-dataviews-list';
@@ -18,7 +18,9 @@ export default function DataViewsSidebarContent() {
18
18
  const {
19
19
  params: { postType, activeView = 'all', isCustom = 'false' },
20
20
  } = useLocation();
21
- const defaultViews = useDefaultViews( { postType } );
21
+
22
+ const defaultViews = useDefaultViewsWithItemCounts( { postType } );
23
+
22
24
  if ( ! postType ) {
23
25
  return null;
24
26
  }
@@ -34,6 +36,9 @@ export default function DataViewsSidebarContent() {
34
36
  slug={ dataview.slug }
35
37
  title={ dataview.title }
36
38
  icon={ dataview.icon }
39
+ navigationItemSuffix={
40
+ <span>{ dataview.count }</span>
41
+ }
37
42
  type={ dataview.view.type }
38
43
  isActive={
39
44
  ! isCustomBoolean &&
@@ -15,6 +15,10 @@
15
15
  min-width: initial;
16
16
  }
17
17
 
18
+ .edit-site-sidebar-navigation-item.with-suffix {
19
+ padding-right: $grid-unit-10;
20
+ }
21
+
18
22
  &:hover,
19
23
  &:focus,
20
24
  &[aria-current] {
package/src/style.scss CHANGED
@@ -91,20 +91,4 @@ body.js.site-editor-php {
91
91
  }
92
92
  }
93
93
 
94
- /**
95
- * Animations
96
- */
97
-
98
- // These keyframes should not be part of the _animations.scss mixins file.
99
- // Because keyframe animations can't be defined as mixins properly, they are duplicated.
100
- // Since they are intended only for the editor, we add them here instead.
101
- @keyframes edit-post__fade-in-animation {
102
- from {
103
- opacity: 0;
104
- }
105
- to {
106
- opacity: 1;
107
- }
108
- }
109
-
110
94
  @include wordpress-admin-schemes();