@wordpress/boot 0.27.0 → 0.28.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 (63) hide show
  1. package/build-module/components/app/index.mjs.map +1 -1
  2. package/build-module/components/app/router.mjs +24 -24
  3. package/build-module/components/app/router.mjs.map +1 -1
  4. package/build-module/components/app/use-route-focus.mjs +162 -0
  5. package/build-module/components/app/use-route-focus.mjs.map +1 -0
  6. package/build-module/components/app/use-route-title.mjs +6 -1
  7. package/build-module/components/app/use-route-title.mjs.map +1 -1
  8. package/build-module/components/canvas/index.mjs +1 -1
  9. package/build-module/components/canvas/index.mjs.map +1 -1
  10. package/build-module/components/canvas/use-navigate-to-entity-record.mjs +20 -12
  11. package/build-module/components/canvas/use-navigate-to-entity-record.mjs.map +1 -1
  12. package/build-module/components/navigation/drilldown-item/index.mjs +3 -3
  13. package/build-module/components/navigation/drilldown-item/index.mjs.map +1 -1
  14. package/build-module/components/navigation/dropdown-item/index.mjs +3 -3
  15. package/build-module/components/navigation/dropdown-item/index.mjs.map +1 -1
  16. package/build-module/components/navigation/navigation-item/index.mjs +3 -3
  17. package/build-module/components/navigation/navigation-item/index.mjs.map +1 -1
  18. package/build-module/components/navigation/navigation-screen/index.mjs +5 -5
  19. package/build-module/components/navigation/navigation-screen/index.mjs.map +1 -1
  20. package/build-module/components/navigation/router-link-item.mjs.map +1 -1
  21. package/build-module/components/plugin-area/index.mjs +5 -1
  22. package/build-module/components/plugin-area/index.mjs.map +1 -1
  23. package/build-module/components/root/index.mjs +28 -25
  24. package/build-module/components/root/index.mjs.map +1 -1
  25. package/build-module/components/root/single-page.mjs +28 -25
  26. package/build-module/components/root/single-page.mjs.map +1 -1
  27. package/build-module/components/save-button/index.mjs +8 -3
  28. package/build-module/components/save-button/index.mjs.map +1 -1
  29. package/build-module/components/save-panel/index.mjs +3 -1
  30. package/build-module/components/save-panel/index.mjs.map +1 -1
  31. package/build-module/components/sidebar/index.mjs +11 -11
  32. package/build-module/components/sidebar/index.mjs.map +1 -1
  33. package/build-types/components/app/use-route-focus.d.ts +14 -0
  34. package/build-types/components/app/use-route-focus.d.ts.map +1 -0
  35. package/build-types/components/canvas/use-navigate-to-entity-record.d.ts +3 -1
  36. package/build-types/components/canvas/use-navigate-to-entity-record.d.ts.map +1 -1
  37. package/build-types/components/root/index.d.ts.map +1 -1
  38. package/build-types/components/root/single-page.d.ts.map +1 -1
  39. package/build-types/components/save-button/index.d.ts.map +1 -1
  40. package/build-types/components/save-panel/index.d.ts.map +1 -1
  41. package/build-types/components/sidebar/index.d.ts.map +1 -1
  42. package/package.json +35 -28
  43. package/src/components/app/test/fixtures/own-focus.tsx +22 -0
  44. package/src/components/app/test/fixtures/settings-general.tsx +21 -0
  45. package/src/components/app/test/fixtures/settings.tsx +10 -0
  46. package/src/components/app/test/navigation-focus.browser.test.tsx +108 -0
  47. package/src/components/app/use-route-focus.ts +53 -0
  48. package/src/components/canvas/index.tsx +1 -1
  49. package/src/components/canvas/use-navigate-to-entity-record.ts +33 -16
  50. package/src/components/navigation/drilldown-item/index.tsx +3 -3
  51. package/src/components/navigation/dropdown-item/index.tsx +3 -3
  52. package/src/components/navigation/navigation-item/index.tsx +3 -3
  53. package/src/components/navigation/navigation-item/style.module.scss +13 -7
  54. package/src/components/navigation/navigation-screen/style.module.scss +1 -1
  55. package/src/components/navigation/router-link-item.tsx +3 -3
  56. package/src/components/root/_layout.module.scss +7 -0
  57. package/src/components/root/index.tsx +4 -1
  58. package/src/components/root/single-page.tsx +4 -1
  59. package/src/components/root/test/admin-scheme-sidebar.browser.test.tsx +120 -0
  60. package/src/components/save-button/index.tsx +7 -2
  61. package/src/components/save-panel/index.tsx +4 -1
  62. package/src/components/sidebar/index.tsx +10 -6
  63. package/src/components/sidebar/style.module.scss +1 -0
@@ -1,7 +1,6 @@
1
1
  import { useCallback, useMemo } from '@wordpress/element';
2
2
  import { useDispatch, useRegistry, useSelect } from '@wordpress/data';
3
3
  import { store as coreStore } from '@wordpress/core-data';
4
- import { store as editorStore } from '@wordpress/editor';
5
4
  import { store as noticesStore } from '@wordpress/notices';
6
5
  import { decodeEntities } from '@wordpress/html-entities';
7
6
  import { __, sprintf } from '@wordpress/i18n';
@@ -44,9 +43,14 @@ interface NavigateParams {
44
43
  * gates the inspector's edit affordance and `onNavigateToPreviousEntityRecord`
45
44
  * gates the document bar's back button.
46
45
  *
46
+ * @param postType Post type rendered in the canvas, if the route names one.
47
+ * @param postId Post ID rendered in the canvas, if the route names one.
47
48
  * @return The two callbacks, for spreading into the editor settings.
48
49
  */
49
- export default function useNavigateToEntityRecord() {
50
+ export default function useNavigateToEntityRecord(
51
+ postType?: string,
52
+ postId?: string
53
+ ) {
50
54
  const navigate = useNavigate() as Navigate;
51
55
  const search = useSearch( { strict: false } ) as { focusMode?: unknown };
52
56
  const registry = useRegistry();
@@ -63,20 +67,33 @@ export default function useNavigateToEntityRecord() {
63
67
  * Stash the block selected in the entity being left, so returning to
64
68
  * it can restore the user's place. The edits hold the external
65
69
  * client ID, which `onChangeSelection` has already resolved.
70
+ *
71
+ * The entity being left is the one the canvas shows. A route that
72
+ * names none shows the homepage, which the editor resolves the same
73
+ * way.
66
74
  */
67
- const currentPostType = (
68
- registry.select( editorStore ) as any
69
- ).getCurrentPostType();
70
- const currentPostId = (
71
- registry.select( editorStore ) as any
72
- ).getCurrentPostId();
73
- const edits = registry
74
- .select( coreStore )
75
- .getEntityRecordEdits(
76
- 'postType',
77
- currentPostType,
78
- currentPostId
79
- ) as { selection?: { selectionStart?: { clientId?: string } } };
75
+ const homePage =
76
+ postType || postId
77
+ ? null
78
+ : ( unlock(
79
+ registry.select( coreStore )
80
+ ).getHomePage() as {
81
+ postType?: string;
82
+ postId?: string;
83
+ } | null );
84
+ const currentPostType = postType || homePage?.postType;
85
+ const currentPostId = postId || homePage?.postId;
86
+ const edits = (
87
+ currentPostType && currentPostId
88
+ ? registry
89
+ .select( coreStore )
90
+ .getEntityRecordEdits(
91
+ 'postType',
92
+ currentPostType,
93
+ currentPostId
94
+ )
95
+ : undefined
96
+ ) as { selection?: { selectionStart?: { clientId?: string } } };
80
97
  const selectedBlock = edits?.selection?.selectionStart?.clientId;
81
98
 
82
99
  if ( selectedBlock ) {
@@ -119,7 +136,7 @@ export default function useNavigateToEntityRecord() {
119
136
  } );
120
137
  }
121
138
  },
122
- [ navigate, registry, getEntityLink ]
139
+ [ navigate, registry, getEntityLink, postType, postId ]
123
140
  );
124
141
 
125
142
  /*
@@ -2,7 +2,7 @@ import clsx from 'clsx';
2
2
  import type { ReactNode } from 'react';
3
3
  import {
4
4
  FlexBlock,
5
- __experimentalItem as Item,
5
+ __experimentalItem as WCItem,
6
6
  __experimentalHStack as HStack,
7
7
  Icon as WCIcon,
8
8
  } from '@wordpress/components';
@@ -59,7 +59,7 @@ export default function DrilldownItem( {
59
59
  };
60
60
 
61
61
  return (
62
- <Item
62
+ <WCItem
63
63
  className={ clsx( styles.item, className ) }
64
64
  onClick={ handleClick }
65
65
  >
@@ -74,6 +74,6 @@ export default function DrilldownItem( {
74
74
  icon={ isRTL() ? chevronLeftSmall : chevronRightSmall }
75
75
  />
76
76
  </HStack>
77
- </Item>
77
+ </WCItem>
78
78
  );
79
79
  }
@@ -2,7 +2,7 @@ import clsx from 'clsx';
2
2
  import type { ReactNode } from 'react';
3
3
  import {
4
4
  FlexBlock,
5
- __experimentalItem as Item,
5
+ __experimentalItem as WCItem,
6
6
  __experimentalHStack as HStack,
7
7
  Icon as WCIcon,
8
8
  __unstableMotion as motion,
@@ -69,7 +69,7 @@ export default function DropdownItem( {
69
69
  const disableMotion = useReducedMotion();
70
70
  return (
71
71
  <div className={ styles.dropdown }>
72
- <Item
72
+ <WCItem
73
73
  className={ clsx( navigationItemStyles.item, className ) }
74
74
  onClick={ ( e ) => {
75
75
  e.preventDefault();
@@ -92,7 +92,7 @@ export default function DropdownItem( {
92
92
  } ) }
93
93
  />
94
94
  </HStack>
95
- </Item>
95
+ </WCItem>
96
96
  <AnimatePresence initial={ false }>
97
97
  { isExpanded && (
98
98
  <motion.div
@@ -2,7 +2,7 @@ import clsx from 'clsx';
2
2
  import type { ReactNode } from 'react';
3
3
  import {
4
4
  FlexBlock,
5
- __experimentalItem as Item,
5
+ __experimentalItem as WCItem,
6
6
  __experimentalHStack as HStack,
7
7
  } from '@wordpress/components';
8
8
  import RouterLinkItem from '../router-link-item';
@@ -55,13 +55,13 @@ export default function NavigationItem( {
55
55
  if ( isExternal ) {
56
56
  // Render as a regular anchor tag for external URLs
57
57
  return (
58
- <Item
58
+ <WCItem
59
59
  as="a"
60
60
  href={ to }
61
61
  className={ clsx( styles.item, className ) }
62
62
  >
63
63
  { content }
64
- </Item>
64
+ </WCItem>
65
65
  );
66
66
  }
67
67
 
@@ -18,22 +18,28 @@
18
18
  // Rounded focus ring
19
19
  border-radius: var(--wpds-border-radius-sm);
20
20
 
21
- &:hover,
22
- &:focus,
23
- &[aria-current="true"] {
24
- color: var(--wpds-color-foreground-interactive-brand-active);
25
- }
26
-
27
21
  svg:last-child {
28
22
  padding: variables.$grid-unit-05;
29
23
  }
30
24
 
25
+ // The current item is a persistent selection, so it uses the resting
26
+ // brand color. Hover and focus follow it to show the interaction state.
27
+ &[aria-current="true"],
28
+ &[aria-current="page"],
29
+ &[data-status="active"] {
30
+ color: var(--wpds-color-foreground-interactive-brand);
31
+ }
32
+
31
33
  &[aria-current="page"],
32
34
  &[data-status="active"] {
33
- color: var(--wpds-color-foreground-interactive-brand-active);
34
35
  font-weight: var(--wpds-typography-font-weight-emphasis);
35
36
  }
36
37
 
38
+ &:hover,
39
+ &:focus {
40
+ color: var(--wpds-color-foreground-interactive-brand-active);
41
+ }
42
+
37
43
  // Make sure the focus style is drawn on top of the current item background.
38
44
  &:focus-visible {
39
45
  transform: translateZ(0);
@@ -24,7 +24,7 @@
24
24
 
25
25
  &#{&},
26
26
  &#{&} .title {
27
- line-height: variables.$font-line-height-x-large;
27
+ line-height: var(--wpds-typography-line-height-xl);
28
28
  color: var(--wpds-color-foreground-content-neutral);
29
29
  }
30
30
  }
@@ -1,16 +1,16 @@
1
1
  import type { ForwardedRef } from 'react';
2
2
  import { forwardRef } from '@wordpress/element';
3
- import { __experimentalItem as Item } from '@wordpress/components';
3
+ import { __experimentalItem as WCItem } from '@wordpress/components';
4
4
  import { privateApis as routePrivateApis } from '@wordpress/route';
5
5
  import { unlock } from '../../lock-unlock';
6
6
 
7
7
  const { createLink } = unlock( routePrivateApis );
8
8
 
9
9
  function AnchorOnlyItem(
10
- props: React.ComponentProps< typeof Item >,
10
+ props: React.ComponentProps< typeof WCItem >,
11
11
  forwardedRef: ForwardedRef< HTMLAnchorElement >
12
12
  ) {
13
- return <Item as="a" ref={ forwardedRef } { ...props } />;
13
+ return <WCItem as="a" ref={ forwardedRef } { ...props } />;
14
14
  }
15
15
 
16
16
  const RouterLinkItem = createLink( forwardRef( AnchorOnlyItem ) );
@@ -110,6 +110,13 @@
110
110
  .layout-single-page & {
111
111
  margin-top: 0;
112
112
  margin-inline-start: 0;
113
+
114
+ // Keep the app pinned to the viewport instead of letting it
115
+ // scroll away when the wp-admin menu is taller than the window.
116
+ position: sticky;
117
+ top: variables.$admin-bar-height;
118
+ // Subtract the bottom margin so the page doesn't overflow.
119
+ height: calc(100vh - #{variables.$admin-bar-height} - #{variables.$grid-unit-10});
113
120
  }
114
121
  }
115
122
  }
@@ -1,5 +1,6 @@
1
1
  import clsx from 'clsx';
2
2
  import { privateApis as routePrivateApis } from '@wordpress/route';
3
+ import { privateApis as coreDataPrivateApis } from '@wordpress/core-data';
3
4
  import { SnackbarNotices } from '@wordpress/notices';
4
5
  import { useViewportMatch, useReducedMotion } from '@wordpress/compose';
5
6
  import {
@@ -11,7 +12,6 @@ import {
11
12
  import { menu } from '@wordpress/icons';
12
13
  import { useState, useEffect, useMemo } from '@wordpress/element';
13
14
  import { __, isRTL } from '@wordpress/i18n';
14
- import { UnsavedChangesWarning } from '@wordpress/editor';
15
15
  import { Page, getAdminThemeColors } from '@wordpress/admin-ui';
16
16
  import { Tooltip } from '@wordpress/ui';
17
17
  import { ThemeProvider } from '@wordpress/theme';
@@ -21,12 +21,14 @@ import CanvasRenderer from '../canvas-renderer';
21
21
  import ErrorBoundary from '../error-boundary';
22
22
  import PluginArea from '../plugin-area';
23
23
  import useRouteTitle from '../app/use-route-title';
24
+ import useRouteFocus from '../app/use-route-focus';
24
25
  import { unlock } from '../../lock-unlock';
25
26
  import type { CanvasData } from '../../store/types';
26
27
  import useSyncBodyBackground from './use-sync-body-background';
27
28
  import styles from './style.module.scss';
28
29
 
29
30
  const { useLocation, useMatches, Outlet } = unlock( routePrivateApis );
31
+ const { UnsavedChangesWarning } = unlock( coreDataPrivateApis );
30
32
 
31
33
  export default function Root() {
32
34
  const matches = useMatches();
@@ -52,6 +54,7 @@ export default function Root() {
52
54
  const themeColors = useMemo( getAdminThemeColors, [] );
53
55
 
54
56
  const layoutRef = useSyncBodyBackground();
57
+ useRouteFocus( layoutRef );
55
58
 
56
59
  return (
57
60
  <SlotFillProvider>
@@ -1,11 +1,11 @@
1
1
  import clsx from 'clsx';
2
2
  import { privateApis as routePrivateApis } from '@wordpress/route';
3
+ import { privateApis as coreDataPrivateApis } from '@wordpress/core-data';
3
4
  import { SnackbarNotices } from '@wordpress/notices';
4
5
  import { SlotFillProvider } from '@wordpress/components';
5
6
  import { useMemo } from '@wordpress/element';
6
7
  import { getAdminThemeColors } from '@wordpress/admin-ui';
7
8
  import { ThemeProvider } from '@wordpress/theme';
8
- import { UnsavedChangesWarning } from '@wordpress/editor';
9
9
  import SavePanel from '../save-panel';
10
10
  import CanvasRenderer from '../canvas-renderer';
11
11
  import PluginArea from '../plugin-area';
@@ -14,8 +14,10 @@ import type { CanvasData } from '../../store/types';
14
14
  import useSyncBodyBackground from './use-sync-body-background';
15
15
  import styles from './style.module.scss';
16
16
  import useRouteTitle from '../app/use-route-title';
17
+ import useRouteFocus from '../app/use-route-focus';
17
18
 
18
19
  const { useMatches, Outlet } = unlock( routePrivateApis );
20
+ const { UnsavedChangesWarning } = unlock( coreDataPrivateApis );
19
21
 
20
22
  /**
21
23
  * Root component for single page mode (no sidebar).
@@ -35,6 +37,7 @@ export default function RootSinglePage() {
35
37
  const themeColors = useMemo( getAdminThemeColors, [] );
36
38
 
37
39
  const layoutRef = useSyncBodyBackground();
40
+ useRouteFocus( layoutRef );
38
41
 
39
42
  return (
40
43
  <SlotFillProvider>
@@ -0,0 +1,120 @@
1
+ import { afterEach, describe, expect, it, vi } from 'vitest';
2
+ import { render } from 'vitest-browser-react';
3
+ import { getAdminThemeColors } from '@wordpress/admin-ui';
4
+ import { ThemeProvider } from '@wordpress/theme';
5
+ import styles from '../style.module.scss';
6
+
7
+ function hexToChannels( hex: string ) {
8
+ return [ 1, 3, 5 ].map( ( i ) => parseInt( hex.slice( i, i + 2 ), 16 ) );
9
+ }
10
+
11
+ describe( 'admin color scheme sidebar', () => {
12
+ afterEach( () => {
13
+ document.body.className = '';
14
+ } );
15
+
16
+ // The sidebar should stay close to the `$base-color` of the Core scheme in
17
+ // WordPress 7.1 and later. Ectoplasm matches its original Core color.
18
+ // `tolerance` is the largest difference allowed in each sRGB channel.
19
+ it.each( [
20
+ { scheme: 'blue', core: '#245278', tolerance: 4 },
21
+ { scheme: 'sunrise', core: '#8a312d', tolerance: 4 },
22
+ { scheme: 'ectoplasm', core: '#523f6d', tolerance: 0 },
23
+ ] )(
24
+ 'matches the Core sidebar color in the $scheme scheme',
25
+ async ( { scheme, core, tolerance } ) => {
26
+ document.body.className = `admin-color-${ scheme }`;
27
+
28
+ const view = await render(
29
+ <ThemeProvider color={ getAdminThemeColors() }>
30
+ <div className={ styles.layout }>sidebar</div>
31
+ </ThemeProvider>
32
+ );
33
+
34
+ const sidebarColor = getComputedStyle(
35
+ view.getByText( 'sidebar' ).element()
36
+ ).backgroundColor;
37
+ const actual = sidebarColor.match( /\d+/g )!.map( Number );
38
+
39
+ // An opaque color, `rgb( r, g, b )`, has no alpha channel.
40
+ expect( actual ).toHaveLength( 3 );
41
+
42
+ hexToChannels( core ).forEach( ( channel, index ) => {
43
+ expect(
44
+ Math.abs( channel - actual[ index ] )
45
+ ).toBeLessThanOrEqual( tolerance );
46
+ } );
47
+ }
48
+ );
49
+
50
+ it.each( [ 'modern', 'fresh', 'midnight' ] )(
51
+ 'keeps a white label on the brand fill in the %s scheme',
52
+ async ( scheme ) => {
53
+ document.body.className = `admin-color-${ scheme }`;
54
+ const onColorWarnings = vi.fn();
55
+
56
+ const view = await render(
57
+ <ThemeProvider
58
+ color={ getAdminThemeColors() }
59
+ onColorWarnings={ onColorWarnings }
60
+ >
61
+ <div
62
+ style={ {
63
+ color: 'var(--wpds-color-foreground-interactive-brand-strong)',
64
+ } }
65
+ >
66
+ label
67
+ </div>
68
+ </ThemeProvider>
69
+ );
70
+
71
+ const label = getComputedStyle(
72
+ view.getByText( 'label' ).element()
73
+ )
74
+ .color.match( /\d+/g )!
75
+ .map( Number );
76
+
77
+ // A light label, close to white.
78
+ label.slice( 0, 3 ).forEach( ( channel ) => {
79
+ expect( channel ).toBeGreaterThanOrEqual( 230 );
80
+ } );
81
+ // The label meets its contrast targets on the fill and its active state.
82
+ expect( onColorWarnings ).toHaveBeenCalledWith( [] );
83
+ }
84
+ );
85
+
86
+ // Ectoplasm's brand fill should stay close to Core's original lime.
87
+ it( 'keeps the Ectoplasm brand fill close to Core lime with a dark label', async () => {
88
+ document.body.className = 'admin-color-ectoplasm';
89
+
90
+ const view = await render(
91
+ <ThemeProvider color={ getAdminThemeColors() }>
92
+ <div
93
+ style={ {
94
+ background:
95
+ 'var(--wpds-color-background-interactive-brand-strong)',
96
+ color: 'var(--wpds-color-foreground-interactive-brand-strong)',
97
+ } }
98
+ >
99
+ button
100
+ </div>
101
+ </ThemeProvider>
102
+ );
103
+
104
+ const { backgroundColor, color } = getComputedStyle(
105
+ view.getByText( 'button' ).element()
106
+ );
107
+ const fill = backgroundColor.match( /\d+/g )!.map( Number );
108
+ const label = color.match( /\d+/g )!.map( Number );
109
+
110
+ hexToChannels( '#a3b745' ).forEach( ( channel, index ) => {
111
+ expect( Math.abs( channel - fill[ index ] ) ).toBeLessThanOrEqual(
112
+ 16
113
+ );
114
+ } );
115
+ // A dark label, close to black.
116
+ label.slice( 0, 3 ).forEach( ( channel ) => {
117
+ expect( channel ).toBeLessThanOrEqual( 40 );
118
+ } );
119
+ } );
120
+ } );
@@ -1,14 +1,16 @@
1
1
  import { useEffect, useState } from '@wordpress/element';
2
2
  import { useSelect } from '@wordpress/data';
3
3
  import { _n, __, sprintf } from '@wordpress/i18n';
4
- import { store as coreStore } from '@wordpress/core-data';
4
+ import {
5
+ privateApis as coreDataPrivateApis,
6
+ store as coreStore,
7
+ } from '@wordpress/core-data';
5
8
  import {
6
9
  ariaKeyShortcut,
7
10
  displayShortcut,
8
11
  shortcutAriaLabel,
9
12
  } from '@wordpress/keycodes';
10
13
  import { check } from '@wordpress/icons';
11
- import { EntitiesSavedStates } from '@wordpress/editor';
12
14
  import { Button, Modal } from '@wordpress/components';
13
15
  import {
14
16
  KeyboardShortcutDescription,
@@ -18,6 +20,9 @@ import {
18
20
  } from '@wordpress/ui';
19
21
  import styles from './style.module.scss';
20
22
  import useSaveShortcut from '../save-panel/use-save-shortcut';
23
+ import { unlock } from '../../lock-unlock';
24
+
25
+ const { EntitiesSavedStates } = unlock( coreDataPrivateApis );
21
26
 
22
27
  export default function SaveButton() {
23
28
  const [ isSaveViewOpen, setIsSaveViewOpened ] = useState( false );
@@ -1,10 +1,13 @@
1
1
  import { useState } from '@wordpress/element';
2
2
  import { Modal } from '@wordpress/components';
3
- import { EntitiesSavedStates } from '@wordpress/editor';
3
+ import { privateApis as coreDataPrivateApis } from '@wordpress/core-data';
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import useSaveShortcut from './use-save-shortcut';
6
+ import { unlock } from '../../lock-unlock';
6
7
  import styles from './style.module.scss';
7
8
 
9
+ const { EntitiesSavedStates } = unlock( coreDataPrivateApis );
10
+
8
11
  export default function SavePanel() {
9
12
  const [ isOpen, setIsOpen ] = useState< boolean >( false );
10
13
  useSaveShortcut( {
@@ -1,7 +1,10 @@
1
- import { Button } from '@wordpress/components';
2
1
  import { useSelect } from '@wordpress/data';
3
2
  import { __, isRTL } from '@wordpress/i18n';
4
3
  import { chevronLeft, chevronRight } from '@wordpress/icons';
4
+ import {
5
+ // eslint-disable-next-line @wordpress/use-recommended-components
6
+ ButtonLink,
7
+ } from '@wordpress/ui';
5
8
  import Navigation from '../navigation';
6
9
  import SaveButton from '../save-button';
7
10
  import { store as bootStore } from '../../store';
@@ -13,15 +16,16 @@ function DashboardBackButton() {
13
16
  []
14
17
  );
15
18
  return (
16
- <Button
17
- __next40pxDefaultSize
19
+ <ButtonLink
20
+ variant="minimal"
21
+ tone="neutral"
18
22
  className={ styles[ 'back-button' ] }
19
23
  href={ dashboardLink || '/' }
20
- icon={ isRTL() ? chevronRight : chevronLeft }
21
- label={ __( 'Go to the Dashboard' ) }
24
+ aria-label={ __( 'Go to the Dashboard' ) }
22
25
  >
26
+ <ButtonLink.Icon icon={ isRTL() ? chevronRight : chevronLeft } />
23
27
  { __( 'Dashboard' ) }
24
- </Button>
28
+ </ButtonLink>
25
29
  );
26
30
  }
27
31
 
@@ -26,4 +26,5 @@
26
26
  margin-inline-end: variables.$grid-unit-15;
27
27
  margin-block-end: variables.$grid-unit-10;
28
28
  margin-inline-start: variables.$grid-unit-15;
29
+ justify-content: flex-start;
29
30
  }