@wordpress/boot 0.19.0 → 0.21.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.
- package/CHANGELOG.md +38 -0
- package/README.md +4 -0
- package/build-module/components/app/index.mjs.map +2 -2
- package/build-module/components/app/router.mjs +100 -4
- package/build-module/components/app/router.mjs.map +3 -3
- package/build-module/components/app/use-route-title.mjs.map +2 -2
- package/build-module/components/canvas/back-button.mjs.map +2 -2
- package/build-module/components/canvas/index.mjs +72 -13
- package/build-module/components/canvas/index.mjs.map +2 -2
- package/build-module/components/canvas/site-preview.mjs +50 -0
- package/build-module/components/canvas/site-preview.mjs.map +7 -0
- package/build-module/components/canvas/use-navigate-to-entity-record.mjs +122 -0
- package/build-module/components/canvas/use-navigate-to-entity-record.mjs.map +7 -0
- package/build-module/components/canvas/viewport.mjs +18 -0
- package/build-module/components/canvas/viewport.mjs.map +7 -0
- package/build-module/components/canvas-renderer/index.mjs.map +2 -2
- package/build-module/components/error-boundary/index.mjs +129 -0
- package/build-module/components/error-boundary/index.mjs.map +7 -0
- package/build-module/components/navigation/drilldown-item/index.mjs +91 -1
- package/build-module/components/navigation/drilldown-item/index.mjs.map +3 -3
- package/build-module/components/navigation/dropdown-item/index.mjs +99 -12
- package/build-module/components/navigation/dropdown-item/index.mjs.map +4 -4
- package/build-module/components/navigation/index.mjs +1 -2
- package/build-module/components/navigation/index.mjs.map +2 -2
- package/build-module/components/navigation/items.mjs.map +2 -2
- package/build-module/components/navigation/navigation-item/index.mjs +88 -15
- package/build-module/components/navigation/navigation-item/index.mjs.map +3 -3
- package/build-module/components/navigation/navigation-screen/index.mjs +111 -38
- package/build-module/components/navigation/navigation-screen/index.mjs.map +3 -3
- package/build-module/components/navigation/path-matching.mjs.map +2 -2
- package/build-module/components/navigation/router-link-item.mjs.map +2 -2
- package/build-module/components/navigation/use-sidebar-parent.mjs +1 -1
- package/build-module/components/navigation/use-sidebar-parent.mjs.map +2 -2
- package/build-module/components/plugin-area/index.mjs +29 -0
- package/build-module/components/plugin-area/index.mjs.map +7 -0
- package/build-module/components/root/index.mjs +220 -122
- package/build-module/components/root/index.mjs.map +3 -3
- package/build-module/components/root/single-page.mjs +139 -47
- package/build-module/components/root/single-page.mjs.map +3 -3
- package/build-module/components/root/use-sync-body-background.mjs.map +2 -2
- package/build-module/components/save-button/index.mjs +127 -16
- package/build-module/components/save-button/index.mjs.map +3 -3
- package/build-module/components/save-panel/index.mjs +91 -1
- package/build-module/components/save-panel/index.mjs.map +3 -3
- package/build-module/components/save-panel/use-save-shortcut.mjs.map +2 -2
- package/build-module/components/sidebar/index.mjs +90 -10
- package/build-module/components/sidebar/index.mjs.map +3 -3
- package/build-module/index.mjs +0 -16
- package/build-module/index.mjs.map +3 -3
- package/build-module/lock-unlock.mjs.map +2 -2
- package/build-module/store/actions.mjs +8 -0
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/index.mjs.map +2 -2
- package/build-module/store/reducer.mjs +16 -1
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +9 -0
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-types/components/app/index.d.ts.map +1 -1
- package/build-types/components/app/router.d.ts +0 -3
- package/build-types/components/app/router.d.ts.map +1 -1
- package/build-types/components/app/use-route-title.d.ts.map +1 -1
- package/build-types/components/canvas/back-button.d.ts.map +1 -1
- package/build-types/components/canvas/index.d.ts +0 -3
- package/build-types/components/canvas/index.d.ts.map +1 -1
- package/build-types/components/canvas/site-preview.d.ts +10 -0
- package/build-types/components/canvas/site-preview.d.ts.map +1 -0
- package/build-types/components/canvas/use-navigate-to-entity-record.d.ts +40 -0
- package/build-types/components/canvas/use-navigate-to-entity-record.d.ts.map +1 -0
- package/build-types/components/canvas/viewport.d.ts +15 -0
- package/build-types/components/canvas/viewport.d.ts.map +1 -0
- package/build-types/components/canvas-renderer/index.d.ts.map +1 -1
- package/build-types/components/error-boundary/index.d.ts +22 -0
- package/build-types/components/error-boundary/index.d.ts.map +1 -0
- package/build-types/components/navigation/drilldown-item/index.d.ts.map +1 -1
- package/build-types/components/navigation/dropdown-item/index.d.ts +0 -1
- package/build-types/components/navigation/dropdown-item/index.d.ts.map +1 -1
- package/build-types/components/navigation/index.d.ts.map +1 -1
- package/build-types/components/navigation/items.d.ts +0 -3
- package/build-types/components/navigation/items.d.ts.map +1 -1
- package/build-types/components/navigation/navigation-item/index.d.ts +0 -1
- package/build-types/components/navigation/navigation-item/index.d.ts.map +1 -1
- package/build-types/components/navigation/navigation-screen/index.d.ts +0 -7
- package/build-types/components/navigation/navigation-screen/index.d.ts.map +1 -1
- package/build-types/components/navigation/path-matching.d.ts +0 -3
- package/build-types/components/navigation/path-matching.d.ts.map +1 -1
- package/build-types/components/navigation/router-link-item.d.ts.map +1 -1
- package/build-types/components/navigation/use-sidebar-parent.d.ts.map +1 -1
- package/build-types/components/plugin-area/index.d.ts +12 -0
- package/build-types/components/plugin-area/index.d.ts.map +1 -0
- package/build-types/components/root/index.d.ts +0 -1
- package/build-types/components/root/index.d.ts.map +1 -1
- package/build-types/components/root/single-page.d.ts +0 -1
- package/build-types/components/root/single-page.d.ts.map +1 -1
- package/build-types/components/root/use-sync-body-background.d.ts +1 -1
- package/build-types/components/root/use-sync-body-background.d.ts.map +1 -1
- package/build-types/components/save-button/index.d.ts +0 -4
- package/build-types/components/save-button/index.d.ts.map +1 -1
- package/build-types/components/save-panel/index.d.ts.map +1 -1
- package/build-types/components/save-panel/use-save-shortcut.d.ts.map +1 -1
- package/build-types/components/sidebar/index.d.ts +0 -1
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/index.d.ts +0 -5
- package/build-types/index.d.ts.map +1 -1
- package/build-types/lock-unlock.d.ts.map +1 -1
- package/build-types/store/actions.d.ts +15 -5
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/index.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +0 -3
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +12 -3
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/store/types.d.ts +34 -6
- package/build-types/store/types.d.ts.map +1 -1
- package/package.json +28 -25
- package/src/components/app/index.tsx +0 -7
- package/src/components/app/router.tsx +19 -18
- package/src/components/app/use-route-title.ts +0 -7
- package/src/components/canvas/back-button.tsx +0 -3
- package/src/components/canvas/index.tsx +117 -22
- package/src/components/canvas/site-preview.tsx +64 -0
- package/src/components/canvas/use-navigate-to-entity-record.ts +220 -0
- package/src/components/canvas/viewport.ts +34 -0
- package/src/components/canvas-renderer/index.tsx +0 -7
- package/src/components/error-boundary/index.tsx +71 -0
- package/src/components/error-boundary/style.module.scss +13 -0
- package/src/components/navigation/drilldown-item/index.tsx +2 -13
- package/src/components/navigation/dropdown-item/index.tsx +11 -19
- package/src/components/navigation/dropdown-item/{style.scss → style.module.scss} +6 -2
- package/src/components/navigation/index.tsx +1 -9
- package/src/components/navigation/items.tsx +0 -7
- package/src/components/navigation/navigation-item/index.tsx +3 -18
- package/src/components/navigation/navigation-item/{style.scss → style.module.scss} +7 -14
- package/src/components/navigation/navigation-screen/index.tsx +6 -26
- package/src/components/navigation/navigation-screen/{style.scss → style.module.scss} +10 -9
- package/src/components/navigation/path-matching.ts +0 -3
- package/src/components/navigation/router-link-item.tsx +0 -11
- package/src/components/navigation/use-sidebar-parent.ts +1 -13
- package/src/components/plugin-area/index.tsx +34 -0
- package/src/components/root/{style.scss → _layout.module.scss} +71 -40
- package/src/components/root/_view-transitions.module.scss +205 -0
- package/src/components/root/index.tsx +44 -35
- package/src/components/root/single-page.tsx +15 -18
- package/src/components/root/style.module.scss +2 -0
- package/src/components/root/use-sync-body-background.ts +1 -4
- package/src/components/save-button/index.tsx +36 -21
- package/src/components/save-button/style.module.scss +10 -0
- package/src/components/save-panel/index.tsx +2 -8
- package/src/components/save-panel/style.module.scss +7 -0
- package/src/components/save-panel/use-save-shortcut.ts +0 -3
- package/src/components/sidebar/index.tsx +5 -12
- package/src/components/sidebar/style.module.scss +29 -0
- package/src/index.tsx +0 -5
- package/src/lock-unlock.ts +0 -3
- package/src/store/actions.ts +18 -4
- package/src/store/index.ts +0 -7
- package/src/store/reducer.ts +19 -3
- package/src/store/selectors.ts +28 -3
- package/src/store/types.ts +37 -6
- package/build-style/style-rtl.css +0 -132
- package/build-style/style.css +0 -132
- package/build-style/view-transitions-rtl.css +0 -189
- package/build-style/view-transitions.css +0 -189
- package/build-types/components/site-hub/index.d.ts +0 -4
- package/build-types/components/site-hub/index.d.ts.map +0 -1
- package/build-types/components/site-icon/index.d.ts +0 -9
- package/build-types/components/site-icon/index.d.ts.map +0 -1
- package/build-types/components/site-icon-link/index.d.ts +0 -8
- package/build-types/components/site-icon-link/index.d.ts.map +0 -1
- package/build-types/components/user-theme-provider/index.d.ts +0 -6
- package/build-types/components/user-theme-provider/index.d.ts.map +0 -1
- package/src/components/save-button/style.scss +0 -9
- package/src/components/sidebar/style.scss +0 -23
- package/src/style.scss +0 -33
- package/src/view-transitions.scss +0 -221
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@use "@wordpress/base-styles/variables";
|
|
2
|
+
|
|
3
|
+
// The surfaces this sits in are sized by their container, so fill the height
|
|
4
|
+
// available and centre the message in it rather than leaving it at the top of
|
|
5
|
+
// an otherwise empty area.
|
|
6
|
+
.error-boundary {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
min-height: 100%;
|
|
12
|
+
padding: variables.$grid-unit-20;
|
|
13
|
+
}
|
|
@@ -1,27 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import clsx from 'clsx';
|
|
5
2
|
import type { ReactNode } from 'react';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* WordPress dependencies
|
|
9
|
-
*/
|
|
10
3
|
import {
|
|
11
4
|
FlexBlock,
|
|
12
5
|
__experimentalItem as Item,
|
|
13
|
-
// @ts-ignore
|
|
14
6
|
__experimentalHStack as HStack,
|
|
15
7
|
Icon as WCIcon,
|
|
16
8
|
} from '@wordpress/components';
|
|
17
9
|
import { isRTL } from '@wordpress/i18n';
|
|
18
10
|
import { chevronRightSmall, chevronLeftSmall } from '@wordpress/icons';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Internal dependencies
|
|
22
|
-
*/
|
|
23
11
|
import { wrapIcon } from '../items';
|
|
24
12
|
import type { IconType } from '../../../store/types';
|
|
13
|
+
import styles from '../navigation-item/style.module.scss';
|
|
25
14
|
|
|
26
15
|
interface DrilldownItemProps {
|
|
27
16
|
/**
|
|
@@ -71,7 +60,7 @@ export default function DrilldownItem( {
|
|
|
71
60
|
|
|
72
61
|
return (
|
|
73
62
|
<Item
|
|
74
|
-
className={ clsx(
|
|
63
|
+
className={ clsx( styles.item, className ) }
|
|
75
64
|
onClick={ handleClick }
|
|
76
65
|
>
|
|
77
66
|
<HStack
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import clsx from 'clsx';
|
|
5
2
|
import type { ReactNode } from 'react';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* WordPress dependencies
|
|
9
|
-
*/
|
|
10
3
|
import {
|
|
11
4
|
FlexBlock,
|
|
12
5
|
__experimentalItem as Item,
|
|
13
|
-
// @ts-ignore
|
|
14
6
|
__experimentalHStack as HStack,
|
|
15
7
|
Icon as WCIcon,
|
|
16
8
|
__unstableMotion as motion,
|
|
@@ -19,15 +11,12 @@ import {
|
|
|
19
11
|
import { chevronDownSmall } from '@wordpress/icons';
|
|
20
12
|
import { useReducedMotion } from '@wordpress/compose';
|
|
21
13
|
import { useSelect } from '@wordpress/data';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Internal dependencies
|
|
25
|
-
*/
|
|
26
14
|
import { STORE_NAME } from '../../../store';
|
|
27
15
|
import NavigationItem from '../navigation-item';
|
|
28
16
|
import { wrapIcon } from '../items';
|
|
29
17
|
import type { IconType, MenuItem } from '../../../store/types';
|
|
30
|
-
import '
|
|
18
|
+
import navigationItemStyles from '../navigation-item/style.module.scss';
|
|
19
|
+
import styles from './style.module.scss';
|
|
31
20
|
|
|
32
21
|
const ANIMATION_DURATION = 0.2;
|
|
33
22
|
|
|
@@ -72,16 +61,16 @@ export default function DropdownItem( {
|
|
|
72
61
|
}: DropdownItemProps ) {
|
|
73
62
|
const menuItems: MenuItem[] = useSelect(
|
|
74
63
|
( select ) =>
|
|
75
|
-
// @ts-
|
|
64
|
+
// @ts-expect-error Store types are not available when selecting by store name.
|
|
76
65
|
select( STORE_NAME ).getMenuItems(),
|
|
77
66
|
[]
|
|
78
67
|
);
|
|
79
68
|
const items = menuItems.filter( ( item ) => item.parent === id );
|
|
80
69
|
const disableMotion = useReducedMotion();
|
|
81
70
|
return (
|
|
82
|
-
<div className=
|
|
71
|
+
<div className={ styles.dropdown }>
|
|
83
72
|
<Item
|
|
84
|
-
className={ clsx(
|
|
73
|
+
className={ clsx( navigationItemStyles.item, className ) }
|
|
85
74
|
onClick={ ( e ) => {
|
|
86
75
|
e.preventDefault();
|
|
87
76
|
e.stopPropagation();
|
|
@@ -98,8 +87,8 @@ export default function DropdownItem( {
|
|
|
98
87
|
<FlexBlock>{ children }</FlexBlock>
|
|
99
88
|
<WCIcon
|
|
100
89
|
icon={ chevronDownSmall }
|
|
101
|
-
className={ clsx(
|
|
102
|
-
'is-up': isExpanded,
|
|
90
|
+
className={ clsx( styles.chevron, {
|
|
91
|
+
[ styles[ 'is-up' ] ]: isExpanded,
|
|
103
92
|
} ) }
|
|
104
93
|
/>
|
|
105
94
|
</HStack>
|
|
@@ -115,11 +104,14 @@ export default function DropdownItem( {
|
|
|
115
104
|
duration: disableMotion ? 0 : ANIMATION_DURATION,
|
|
116
105
|
ease: 'easeOut',
|
|
117
106
|
} }
|
|
118
|
-
className=
|
|
107
|
+
className={ styles[ 'dropdown-children' ] }
|
|
119
108
|
>
|
|
120
109
|
{ items.map( ( item, index ) => (
|
|
121
110
|
<NavigationItem
|
|
122
111
|
key={ index }
|
|
112
|
+
className={
|
|
113
|
+
navigationItemStyles[ 'is-compact' ]
|
|
114
|
+
}
|
|
123
115
|
to={ item.to }
|
|
124
116
|
shouldShowPlaceholder={ false }
|
|
125
117
|
>
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
@use "@wordpress/base-styles/variables";
|
|
2
2
|
|
|
3
|
-
.
|
|
3
|
+
.dropdown {
|
|
4
|
+
display: block;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.dropdown-children {
|
|
4
8
|
display: flex;
|
|
5
9
|
flex-direction: column;
|
|
6
10
|
|
|
@@ -18,6 +22,6 @@
|
|
|
18
22
|
overflow: hidden;
|
|
19
23
|
}
|
|
20
24
|
|
|
21
|
-
.
|
|
25
|
+
.chevron.is-up {
|
|
22
26
|
transform: rotate(180deg);
|
|
23
27
|
}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { useState, useMemo, useRef } from '@wordpress/element';
|
|
5
2
|
import { useSelect } from '@wordpress/data';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
3
|
import { STORE_NAME } from '../../store';
|
|
11
4
|
import NavigationItem from './navigation-item';
|
|
12
5
|
import DrilldownItem from './drilldown-item';
|
|
@@ -24,7 +17,7 @@ function Navigation() {
|
|
|
24
17
|
useSidebarParent();
|
|
25
18
|
const menuItems = useSelect(
|
|
26
19
|
( select ) =>
|
|
27
|
-
// @ts-
|
|
20
|
+
// @ts-expect-error Store types are not available when selecting by store name.
|
|
28
21
|
select( STORE_NAME ).getMenuItems() as MenuItem[],
|
|
29
22
|
[]
|
|
30
23
|
);
|
|
@@ -79,7 +72,6 @@ function Navigation() {
|
|
|
79
72
|
<DropdownItem
|
|
80
73
|
key={ item.id }
|
|
81
74
|
id={ item.id }
|
|
82
|
-
className="boot-navigation-item"
|
|
83
75
|
icon={ item.icon }
|
|
84
76
|
shouldShowPlaceholder={ hasRealIcons }
|
|
85
77
|
isExpanded={ parentDropdownId === item.id }
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { isValidElement } from '@wordpress/element';
|
|
5
2
|
import { Dashicon, Icon as WCIcon } from '@wordpress/components';
|
|
6
3
|
import { SVG } from '@wordpress/primitives';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
4
|
import type { IconType } from '../../store/types';
|
|
12
5
|
|
|
13
6
|
/**
|
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import clsx from 'clsx';
|
|
5
2
|
import type { ReactNode } from 'react';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* WordPress dependencies
|
|
9
|
-
*/
|
|
10
3
|
import {
|
|
11
4
|
FlexBlock,
|
|
12
5
|
__experimentalItem as Item,
|
|
13
|
-
// @ts-ignore
|
|
14
6
|
__experimentalHStack as HStack,
|
|
15
7
|
} from '@wordpress/components';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Internal dependencies
|
|
19
|
-
*/
|
|
20
8
|
import RouterLinkItem from '../router-link-item';
|
|
21
9
|
import { wrapIcon } from '../items';
|
|
22
10
|
import type { IconType } from '../../../store/types';
|
|
23
|
-
import './style.scss';
|
|
11
|
+
import styles from './style.module.scss';
|
|
24
12
|
|
|
25
13
|
interface NavigationItemProps {
|
|
26
14
|
/**
|
|
@@ -70,7 +58,7 @@ export default function NavigationItem( {
|
|
|
70
58
|
<Item
|
|
71
59
|
as="a"
|
|
72
60
|
href={ to }
|
|
73
|
-
className={ clsx(
|
|
61
|
+
className={ clsx( styles.item, className ) }
|
|
74
62
|
>
|
|
75
63
|
{ content }
|
|
76
64
|
</Item>
|
|
@@ -78,10 +66,7 @@ export default function NavigationItem( {
|
|
|
78
66
|
}
|
|
79
67
|
|
|
80
68
|
return (
|
|
81
|
-
<RouterLinkItem
|
|
82
|
-
to={ to }
|
|
83
|
-
className={ clsx( 'boot-navigation-item', className ) }
|
|
84
|
-
>
|
|
69
|
+
<RouterLinkItem to={ to } className={ clsx( styles.item, className ) }>
|
|
85
70
|
{ content }
|
|
86
71
|
</RouterLinkItem>
|
|
87
72
|
);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
@use "@wordpress/base-styles/variables";
|
|
2
2
|
@use "@wordpress/base-styles/mixins";
|
|
3
3
|
|
|
4
|
-
.
|
|
4
|
+
// Override Item's default styles without depending on its class names.
|
|
5
|
+
.item.item {
|
|
5
6
|
color: var(--wpds-color-foreground-interactive-neutral);
|
|
6
7
|
padding-inline: variables.$grid-unit-05;
|
|
7
8
|
padding-block: 0;
|
|
@@ -14,29 +15,21 @@
|
|
|
14
15
|
align-items: center;
|
|
15
16
|
@include mixins.body-medium();
|
|
16
17
|
|
|
17
|
-
.boot-dropdown-item__children & {
|
|
18
|
-
min-height: variables.$grid-unit-30;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
18
|
// Rounded focus ring
|
|
22
19
|
border-radius: var(--wpds-border-radius-sm);
|
|
23
20
|
|
|
24
|
-
&.active,
|
|
25
21
|
&:hover,
|
|
26
22
|
&:focus,
|
|
27
23
|
&[aria-current="true"] {
|
|
28
24
|
color: var(--wpds-color-foreground-interactive-brand-active);
|
|
29
25
|
}
|
|
30
26
|
|
|
31
|
-
&.active {
|
|
32
|
-
font-weight: var(--wpds-typography-font-weight-emphasis);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
27
|
svg:last-child {
|
|
36
28
|
padding: variables.$grid-unit-05;
|
|
37
29
|
}
|
|
38
30
|
|
|
39
|
-
&[aria-current="
|
|
31
|
+
&[aria-current="page"],
|
|
32
|
+
&[data-status="active"] {
|
|
40
33
|
color: var(--wpds-color-foreground-interactive-brand-active);
|
|
41
34
|
font-weight: var(--wpds-typography-font-weight-emphasis);
|
|
42
35
|
}
|
|
@@ -45,8 +38,8 @@
|
|
|
45
38
|
&:focus-visible {
|
|
46
39
|
transform: translateZ(0);
|
|
47
40
|
}
|
|
41
|
+
}
|
|
48
42
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
43
|
+
.item.is-compact {
|
|
44
|
+
min-height: variables.$grid-unit-30;
|
|
52
45
|
}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import type { ReactNode, RefObject } from 'react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
2
|
import {
|
|
10
3
|
__experimentalHeading as Heading,
|
|
11
4
|
__unstableMotion as motion,
|
|
@@ -16,11 +9,7 @@ import {
|
|
|
16
9
|
import { isRTL, __ } from '@wordpress/i18n';
|
|
17
10
|
import { chevronRight, chevronLeft } from '@wordpress/icons';
|
|
18
11
|
import { useReducedMotion } from '@wordpress/compose';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Internal dependencies
|
|
22
|
-
*/
|
|
23
|
-
import './style.scss';
|
|
12
|
+
import styles from './style.module.scss';
|
|
24
13
|
|
|
25
14
|
const ANIMATION_DURATION = 0.3;
|
|
26
15
|
const slideVariants = {
|
|
@@ -77,7 +66,7 @@ export default function NavigationScreen( {
|
|
|
77
66
|
|
|
78
67
|
return (
|
|
79
68
|
<div
|
|
80
|
-
className=
|
|
69
|
+
className={ styles.screen }
|
|
81
70
|
style={ {
|
|
82
71
|
overflow: 'hidden',
|
|
83
72
|
position: 'relative',
|
|
@@ -105,10 +94,7 @@ export default function NavigationScreen( {
|
|
|
105
94
|
gridRow: '1',
|
|
106
95
|
} }
|
|
107
96
|
>
|
|
108
|
-
<HStack
|
|
109
|
-
spacing={ 2 }
|
|
110
|
-
className="boot-navigation-screen__title-icon"
|
|
111
|
-
>
|
|
97
|
+
<HStack spacing={ 2 } className={ styles[ 'title-icon' ] }>
|
|
112
98
|
{ ! isRoot && (
|
|
113
99
|
<Button
|
|
114
100
|
ref={ backButtonRef }
|
|
@@ -120,24 +106,18 @@ export default function NavigationScreen( {
|
|
|
120
106
|
/>
|
|
121
107
|
) }
|
|
122
108
|
<Heading
|
|
123
|
-
className=
|
|
109
|
+
className={ styles.title }
|
|
124
110
|
level={ 1 }
|
|
125
111
|
size="15px"
|
|
126
112
|
>
|
|
127
113
|
{ title }
|
|
128
114
|
</Heading>
|
|
129
115
|
{ actions && (
|
|
130
|
-
<div className=
|
|
131
|
-
{ actions }
|
|
132
|
-
</div>
|
|
116
|
+
<div className={ styles.actions }>{ actions }</div>
|
|
133
117
|
) }
|
|
134
118
|
</HStack>
|
|
135
119
|
|
|
136
|
-
{ description &&
|
|
137
|
-
<div className="boot-navigation-screen__description">
|
|
138
|
-
{ description }
|
|
139
|
-
</div>
|
|
140
|
-
) }
|
|
120
|
+
{ description && <div>{ description }</div> }
|
|
141
121
|
|
|
142
122
|
{ content }
|
|
143
123
|
</motion.div>
|
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
@use "@wordpress/base-styles/variables";
|
|
2
2
|
|
|
3
|
-
.
|
|
3
|
+
.screen {
|
|
4
4
|
// Avoid cutting off focus ring of the last menu item
|
|
5
5
|
padding-block-end: variables.$grid-unit-05;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
.
|
|
8
|
+
.screen :global(.components-text) {
|
|
9
9
|
color: var(--wpds-color-foreground-content-neutral);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
.
|
|
12
|
+
.title-icon {
|
|
13
13
|
position: sticky;
|
|
14
14
|
top: 0;
|
|
15
|
-
padding:
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
padding-block-start: variables.$grid-unit-15;
|
|
16
|
+
padding-inline-end: variables.$grid-unit-20;
|
|
17
|
+
padding-block-end: variables.$grid-unit-10;
|
|
18
|
+
padding-inline-start: variables.$grid-unit-20;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
.
|
|
21
|
+
.title {
|
|
21
22
|
flex-grow: 1;
|
|
22
23
|
overflow-wrap: break-word;
|
|
23
24
|
|
|
24
25
|
&#{&},
|
|
25
|
-
&#{&} .
|
|
26
|
+
&#{&} .title {
|
|
26
27
|
line-height: variables.$font-line-height-x-large;
|
|
27
28
|
color: var(--wpds-color-foreground-content-neutral);
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
.
|
|
32
|
+
.actions {
|
|
32
33
|
display: flex;
|
|
33
34
|
flex-shrink: 0;
|
|
34
35
|
}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import type { ForwardedRef } from 'react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
2
|
import { forwardRef } from '@wordpress/element';
|
|
10
3
|
import { __experimentalItem as Item } from '@wordpress/components';
|
|
11
4
|
import { privateApis as routePrivateApis } from '@wordpress/route';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
5
|
import { unlock } from '../../lock-unlock';
|
|
17
6
|
|
|
18
7
|
const { createLink } = unlock( routePrivateApis );
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { privateApis as routePrivateApis } from '@wordpress/route';
|
|
5
2
|
import { useEffect, useState } from '@wordpress/element';
|
|
6
3
|
import { useSelect } from '@wordpress/data';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
4
|
import { unlock } from '../../lock-unlock';
|
|
12
|
-
|
|
13
5
|
const { useRouter, useMatches } = unlock( routePrivateApis );
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
6
|
import { STORE_NAME } from '../../store';
|
|
19
7
|
import {
|
|
20
8
|
findDrilldownParent,
|
|
@@ -37,7 +25,7 @@ export function useSidebarParent() {
|
|
|
37
25
|
const router = useRouter();
|
|
38
26
|
const menuItems = useSelect(
|
|
39
27
|
( select ) =>
|
|
40
|
-
// @ts-
|
|
28
|
+
// @ts-expect-error Store types are not available when selecting by store name.
|
|
41
29
|
select( STORE_NAME ).getMenuItems(),
|
|
42
30
|
[]
|
|
43
31
|
);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useDispatch } from '@wordpress/data';
|
|
2
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
3
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
4
|
+
import { PluginArea as WPPluginArea } from '@wordpress/plugins';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Mounts every plugin registered with `registerPlugin`, so the fills they
|
|
8
|
+
* render reach their slots.
|
|
9
|
+
*
|
|
10
|
+
* Sits at the root rather than with the editor: a plugin's fills mostly target
|
|
11
|
+
* editor slots, but the component holding them is also where it registers
|
|
12
|
+
* commands and extends a list, which the routes without a canvas need too.
|
|
13
|
+
*
|
|
14
|
+
* @return The mount point. Renders whatever the plugins do, and nothing itself.
|
|
15
|
+
*/
|
|
16
|
+
export default function PluginArea() {
|
|
17
|
+
const { createErrorNotice } = useDispatch( noticesStore );
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<WPPluginArea
|
|
21
|
+
onError={ ( name ) => {
|
|
22
|
+
createErrorNotice(
|
|
23
|
+
sprintf(
|
|
24
|
+
/* translators: %s: plugin name */
|
|
25
|
+
__(
|
|
26
|
+
'The "%s" plugin has encountered an error and cannot be rendered.'
|
|
27
|
+
),
|
|
28
|
+
name
|
|
29
|
+
)
|
|
30
|
+
);
|
|
31
|
+
} }
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
}
|