@wordpress/interface 5.25.1-next.79a6196f.0 → 5.27.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 +4 -0
- package/build/components/index.js +0 -28
- package/build/components/index.js.map +1 -1
- package/build/components/interface-skeleton/index.js +1 -1
- package/build/components/interface-skeleton/index.js.map +1 -1
- package/build-module/components/index.js +0 -4
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/interface-skeleton/index.js +2 -2
- package/build-module/components/interface-skeleton/index.js.map +1 -1
- package/build-style/style-rtl.css +1 -95
- package/build-style/style.css +1 -95
- package/lock-unlock.js +10 -0
- package/package.json +14 -13
- package/src/components/index.js +0 -4
- package/src/components/interface-skeleton/index.js +2 -2
- package/src/components/pinned-items/style.scss +0 -3
- package/src/style.scss +0 -4
- package/build/components/preferences-modal/index.js +0 -24
- package/build/components/preferences-modal/index.js.map +0 -1
- package/build/components/preferences-modal-base-option/index.js +0 -32
- package/build/components/preferences-modal-base-option/index.js.map +0 -1
- package/build/components/preferences-modal-section/index.js +0 -25
- package/build/components/preferences-modal-section/index.js.map +0 -1
- package/build/components/preferences-modal-tabs/index.js +0 -111
- package/build/components/preferences-modal-tabs/index.js.map +0 -1
- package/build-module/components/preferences-modal/index.js +0 -17
- package/build-module/components/preferences-modal/index.js.map +0 -1
- package/build-module/components/preferences-modal-base-option/index.js +0 -24
- package/build-module/components/preferences-modal-base-option/index.js.map +0 -1
- package/build-module/components/preferences-modal-section/index.js +0 -18
- package/build-module/components/preferences-modal-section/index.js.map +0 -1
- package/build-module/components/preferences-modal-tabs/index.js +0 -104
- package/build-module/components/preferences-modal-tabs/index.js.map +0 -1
- package/src/components/preferences-modal/README.md +0 -69
- package/src/components/preferences-modal/index.js +0 -17
- package/src/components/preferences-modal/style.scss +0 -21
- package/src/components/preferences-modal-base-option/README.md +0 -42
- package/src/components/preferences-modal-base-option/index.js +0 -21
- package/src/components/preferences-modal-base-option/style.scss +0 -10
- package/src/components/preferences-modal-section/README.md +0 -30
- package/src/components/preferences-modal-section/index.js +0 -19
- package/src/components/preferences-modal-section/style.scss +0 -28
- package/src/components/preferences-modal-tabs/README.md +0 -14
- package/src/components/preferences-modal-tabs/index.js +0 -156
- package/src/components/preferences-modal-tabs/style.scss +0 -49
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
5
|
-
import {
|
|
6
|
-
__experimentalNavigatorProvider as NavigatorProvider,
|
|
7
|
-
__experimentalNavigatorScreen as NavigatorScreen,
|
|
8
|
-
__experimentalNavigatorButton as NavigatorButton,
|
|
9
|
-
__experimentalNavigatorBackButton as NavigatorBackButton,
|
|
10
|
-
__experimentalItemGroup as ItemGroup,
|
|
11
|
-
__experimentalItem as Item,
|
|
12
|
-
__experimentalHStack as HStack,
|
|
13
|
-
__experimentalText as Text,
|
|
14
|
-
__experimentalTruncate as Truncate,
|
|
15
|
-
FlexItem,
|
|
16
|
-
TabPanel,
|
|
17
|
-
Card,
|
|
18
|
-
CardHeader,
|
|
19
|
-
CardBody,
|
|
20
|
-
} from '@wordpress/components';
|
|
21
|
-
import { useMemo, useCallback, useState } from '@wordpress/element';
|
|
22
|
-
import { chevronLeft, chevronRight, Icon } from '@wordpress/icons';
|
|
23
|
-
import { isRTL, __ } from '@wordpress/i18n';
|
|
24
|
-
|
|
25
|
-
const PREFERENCES_MENU = 'preferences-menu';
|
|
26
|
-
|
|
27
|
-
export default function PreferencesModalTabs( { sections } ) {
|
|
28
|
-
const isLargeViewport = useViewportMatch( 'medium' );
|
|
29
|
-
|
|
30
|
-
// This is also used to sync the two different rendered components
|
|
31
|
-
// between small and large viewports.
|
|
32
|
-
const [ activeMenu, setActiveMenu ] = useState( PREFERENCES_MENU );
|
|
33
|
-
/**
|
|
34
|
-
* Create helper objects from `sections` for easier data handling.
|
|
35
|
-
* `tabs` is used for creating the `TabPanel` and `sectionsContentMap`
|
|
36
|
-
* is used for easier access to active tab's content.
|
|
37
|
-
*/
|
|
38
|
-
const { tabs, sectionsContentMap } = useMemo( () => {
|
|
39
|
-
let mappedTabs = {
|
|
40
|
-
tabs: [],
|
|
41
|
-
sectionsContentMap: {},
|
|
42
|
-
};
|
|
43
|
-
if ( sections.length ) {
|
|
44
|
-
mappedTabs = sections.reduce(
|
|
45
|
-
( accumulator, { name, tabLabel: title, content } ) => {
|
|
46
|
-
accumulator.tabs.push( { name, title } );
|
|
47
|
-
accumulator.sectionsContentMap[ name ] = content;
|
|
48
|
-
return accumulator;
|
|
49
|
-
},
|
|
50
|
-
{ tabs: [], sectionsContentMap: {} }
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
return mappedTabs;
|
|
54
|
-
}, [ sections ] );
|
|
55
|
-
|
|
56
|
-
const getCurrentTab = useCallback(
|
|
57
|
-
( tab ) => sectionsContentMap[ tab.name ] || null,
|
|
58
|
-
[ sectionsContentMap ]
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
let modalContent;
|
|
62
|
-
// We render different components based on the viewport size.
|
|
63
|
-
if ( isLargeViewport ) {
|
|
64
|
-
modalContent = (
|
|
65
|
-
<TabPanel
|
|
66
|
-
className="interface-preferences__tabs"
|
|
67
|
-
tabs={ tabs }
|
|
68
|
-
initialTabName={
|
|
69
|
-
activeMenu !== PREFERENCES_MENU ? activeMenu : undefined
|
|
70
|
-
}
|
|
71
|
-
onSelect={ setActiveMenu }
|
|
72
|
-
orientation="vertical"
|
|
73
|
-
>
|
|
74
|
-
{ getCurrentTab }
|
|
75
|
-
</TabPanel>
|
|
76
|
-
);
|
|
77
|
-
} else {
|
|
78
|
-
modalContent = (
|
|
79
|
-
<NavigatorProvider
|
|
80
|
-
initialPath="/"
|
|
81
|
-
className="interface-preferences__provider"
|
|
82
|
-
>
|
|
83
|
-
<NavigatorScreen path="/">
|
|
84
|
-
<Card isBorderless size="small">
|
|
85
|
-
<CardBody>
|
|
86
|
-
<ItemGroup>
|
|
87
|
-
{ tabs.map( ( tab ) => {
|
|
88
|
-
return (
|
|
89
|
-
<NavigatorButton
|
|
90
|
-
key={ tab.name }
|
|
91
|
-
path={ tab.name }
|
|
92
|
-
as={ Item }
|
|
93
|
-
isAction
|
|
94
|
-
>
|
|
95
|
-
<HStack justify="space-between">
|
|
96
|
-
<FlexItem>
|
|
97
|
-
<Truncate>
|
|
98
|
-
{ tab.title }
|
|
99
|
-
</Truncate>
|
|
100
|
-
</FlexItem>
|
|
101
|
-
<FlexItem>
|
|
102
|
-
<Icon
|
|
103
|
-
icon={
|
|
104
|
-
isRTL()
|
|
105
|
-
? chevronLeft
|
|
106
|
-
: chevronRight
|
|
107
|
-
}
|
|
108
|
-
/>
|
|
109
|
-
</FlexItem>
|
|
110
|
-
</HStack>
|
|
111
|
-
</NavigatorButton>
|
|
112
|
-
);
|
|
113
|
-
} ) }
|
|
114
|
-
</ItemGroup>
|
|
115
|
-
</CardBody>
|
|
116
|
-
</Card>
|
|
117
|
-
</NavigatorScreen>
|
|
118
|
-
{ sections.length &&
|
|
119
|
-
sections.map( ( section ) => {
|
|
120
|
-
return (
|
|
121
|
-
<NavigatorScreen
|
|
122
|
-
key={ `${ section.name }-menu` }
|
|
123
|
-
path={ section.name }
|
|
124
|
-
>
|
|
125
|
-
<Card isBorderless size="large">
|
|
126
|
-
<CardHeader
|
|
127
|
-
isBorderless={ false }
|
|
128
|
-
justify="left"
|
|
129
|
-
size="small"
|
|
130
|
-
gap="6"
|
|
131
|
-
>
|
|
132
|
-
<NavigatorBackButton
|
|
133
|
-
icon={
|
|
134
|
-
isRTL()
|
|
135
|
-
? chevronRight
|
|
136
|
-
: chevronLeft
|
|
137
|
-
}
|
|
138
|
-
aria-label={ __(
|
|
139
|
-
'Navigate to the previous view'
|
|
140
|
-
) }
|
|
141
|
-
/>
|
|
142
|
-
<Text size="16">
|
|
143
|
-
{ section.tabLabel }
|
|
144
|
-
</Text>
|
|
145
|
-
</CardHeader>
|
|
146
|
-
<CardBody>{ section.content }</CardBody>
|
|
147
|
-
</Card>
|
|
148
|
-
</NavigatorScreen>
|
|
149
|
-
);
|
|
150
|
-
} ) }
|
|
151
|
-
</NavigatorProvider>
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return modalContent;
|
|
156
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
$vertical-tabs-width: 160px;
|
|
2
|
-
|
|
3
|
-
.interface-preferences__tabs {
|
|
4
|
-
.components-tab-panel__tabs {
|
|
5
|
-
position: absolute;
|
|
6
|
-
top: $header-height + $grid-unit-30;
|
|
7
|
-
// Aligns button text instead of button box.
|
|
8
|
-
left: $grid-unit-20;
|
|
9
|
-
width: $vertical-tabs-width;
|
|
10
|
-
|
|
11
|
-
.components-tab-panel__tabs-item {
|
|
12
|
-
border-radius: $radius-block-ui;
|
|
13
|
-
font-weight: 400;
|
|
14
|
-
|
|
15
|
-
&.is-active {
|
|
16
|
-
background: $gray-100;
|
|
17
|
-
box-shadow: none;
|
|
18
|
-
font-weight: 500;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
&.is-active::after {
|
|
22
|
-
content: none;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
&:focus:not(:disabled) {
|
|
26
|
-
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
27
|
-
// Windows high contrast mode.
|
|
28
|
-
outline: 2px solid transparent;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&:focus-visible::before {
|
|
32
|
-
content: none;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.components-tab-panel__tab-content {
|
|
38
|
-
padding-left: $grid-unit-30;
|
|
39
|
-
margin-left: $vertical-tabs-width;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
@media (max-width: #{ ($break-medium - 1) }) {
|
|
44
|
-
// Keep the navigator component from overflowing the modal content area
|
|
45
|
-
// to ensure that sticky position elements stick where intended.
|
|
46
|
-
.interface-preferences__provider {
|
|
47
|
-
height: 100%;
|
|
48
|
-
}
|
|
49
|
-
}
|