@wordpress/edit-site 4.3.5 → 4.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.
- package/CHANGELOG.md +4 -0
- package/build/components/block-editor/index.js +1 -1
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +100 -79
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +3 -3
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/header.js +15 -11
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/navigation-button.js +4 -4
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +1 -1
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +1 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +3 -3
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-root.js +13 -3
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +1 -1
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +18 -7
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +1 -5
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +1 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/navigation-menu-sidebar/index.js +4 -2
- package/build/components/sidebar/navigation-menu-sidebar/index.js.map +1 -1
- package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js +1 -5
- package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build/index.js +0 -1
- package/build/index.js.map +1 -1
- package/build-module/components/block-editor/index.js +2 -2
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +103 -80
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +4 -4
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/header.js +16 -11
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +3 -3
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +2 -2
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +2 -2
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +4 -4
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +15 -5
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +2 -2
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +17 -7
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +1 -5
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -3
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/navigation-menu-sidebar/index.js +4 -2
- package/build-module/components/sidebar/navigation-menu-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js +1 -5
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build-module/index.js +0 -1
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +58 -29
- package/build-style/style.css +58 -29
- package/package.json +29 -29
- package/src/components/block-editor/index.js +2 -2
- package/src/components/global-styles/border-panel.js +112 -109
- package/src/components/global-styles/context-menu.js +7 -7
- package/src/components/global-styles/header.js +20 -17
- package/src/components/global-styles/navigation-button.js +3 -3
- package/src/components/global-styles/palette.js +3 -3
- package/src/components/global-styles/screen-block-list.js +3 -3
- package/src/components/global-styles/screen-colors.js +7 -7
- package/src/components/global-styles/screen-root.js +34 -24
- package/src/components/global-styles/screen-typography.js +3 -3
- package/src/components/global-styles/test/use-global-styles-output.js +1 -0
- package/src/components/global-styles/use-global-styles-output.js +30 -7
- package/src/components/header/style.scss +14 -29
- package/src/components/secondary-sidebar/list-view-sidebar.js +1 -5
- package/src/components/sidebar/index.js +2 -2
- package/src/components/sidebar/navigation-menu-sidebar/index.js +4 -1
- package/src/components/sidebar/navigation-menu-sidebar/navigation-menu.js +1 -7
- package/src/components/sidebar/style.scss +56 -0
- package/src/index.js +0 -1
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
import { __experimentalBorderRadiusControl as BorderRadiusControl } from '@wordpress/block-editor';
|
|
4
5
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from '@wordpress/block-editor';
|
|
9
|
-
import {
|
|
6
|
+
__experimentalBorderBoxControl as BorderBoxControl,
|
|
7
|
+
__experimentalHasSplitBorders as hasSplitBorders,
|
|
8
|
+
__experimentalIsDefinedBorder as isDefinedBorder,
|
|
10
9
|
__experimentalToolsPanel as ToolsPanel,
|
|
11
10
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
12
|
-
__experimentalUnitControl as UnitControl,
|
|
13
|
-
__experimentalUseCustomUnits as useCustomUnits,
|
|
14
11
|
} from '@wordpress/components';
|
|
12
|
+
import { useCallback } from '@wordpress/element';
|
|
15
13
|
import { __ } from '@wordpress/i18n';
|
|
16
14
|
|
|
17
15
|
/**
|
|
@@ -24,8 +22,6 @@ import {
|
|
|
24
22
|
useStyle,
|
|
25
23
|
} from './hooks';
|
|
26
24
|
|
|
27
|
-
const MIN_BORDER_WIDTH = 0;
|
|
28
|
-
|
|
29
25
|
export function useHasBorderPanel( name ) {
|
|
30
26
|
const controls = [
|
|
31
27
|
useHasBorderColorControl( name ),
|
|
@@ -69,63 +65,45 @@ function useHasBorderWidthControl( name ) {
|
|
|
69
65
|
);
|
|
70
66
|
}
|
|
71
67
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const createHasValueCallback = ( feature ) => () =>
|
|
77
|
-
!! userBorderStyles?.[ feature ];
|
|
68
|
+
function applyFallbackStyle( border ) {
|
|
69
|
+
if ( ! border ) {
|
|
70
|
+
return border;
|
|
71
|
+
}
|
|
78
72
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
setStyle( value || undefined );
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const units = useCustomUnits( {
|
|
86
|
-
availableUnits: useSetting( 'spacing.units' )[ 0 ] || [
|
|
87
|
-
'px',
|
|
88
|
-
'em',
|
|
89
|
-
'rem',
|
|
90
|
-
],
|
|
91
|
-
} );
|
|
92
|
-
|
|
93
|
-
// Border width.
|
|
94
|
-
const showBorderWidth = useHasBorderWidthControl( name );
|
|
95
|
-
const [ borderWidthValue, setBorderWidth ] = useStyle(
|
|
96
|
-
'border.width',
|
|
97
|
-
name
|
|
98
|
-
);
|
|
73
|
+
if ( ! border.style && ( border.color || border.width ) ) {
|
|
74
|
+
return { ...border, style: 'solid' };
|
|
75
|
+
}
|
|
99
76
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const [ borderStyle, setBorderStyle ] = useStyle( 'border.style', name );
|
|
77
|
+
return border;
|
|
78
|
+
}
|
|
103
79
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
80
|
+
function applyAllFallbackStyles( border ) {
|
|
81
|
+
if ( ! border ) {
|
|
82
|
+
return border;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if ( hasSplitBorders( border ) ) {
|
|
86
|
+
return {
|
|
87
|
+
top: applyFallbackStyle( border.top ),
|
|
88
|
+
right: applyFallbackStyle( border.right ),
|
|
89
|
+
bottom: applyFallbackStyle( border.bottom ),
|
|
90
|
+
left: applyFallbackStyle( border.left ),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return applyFallbackStyle( border );
|
|
95
|
+
}
|
|
110
96
|
|
|
111
|
-
|
|
112
|
-
|
|
97
|
+
export default function BorderPanel( { name } ) {
|
|
98
|
+
// To better reflect if the user has customized a value we need to
|
|
99
|
+
// ensure the style value being checked is from the `user` origin.
|
|
100
|
+
const [ userBorderStyles ] = useStyle( 'border', name, 'user' );
|
|
101
|
+
const [ border, setBorder ] = useStyle( 'border', name );
|
|
102
|
+
const colors = useColorsPerOrigin( name );
|
|
113
103
|
|
|
114
|
-
// Border color.
|
|
115
104
|
const showBorderColor = useHasBorderColorControl( name );
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
const disableCustomGradients = ! useSetting( 'color.customGradient' )[ 0 ];
|
|
119
|
-
|
|
120
|
-
const borderColorSettings = [
|
|
121
|
-
{
|
|
122
|
-
label: __( 'Color' ),
|
|
123
|
-
colors: useColorsPerOrigin( name ),
|
|
124
|
-
colorValue: borderColor,
|
|
125
|
-
onColorChange: handleOnChangeWithStyle( setBorderColor ),
|
|
126
|
-
clearable: false,
|
|
127
|
-
},
|
|
128
|
-
];
|
|
105
|
+
const showBorderStyle = useHasBorderStyleControl( name );
|
|
106
|
+
const showBorderWidth = useHasBorderWidthControl( name );
|
|
129
107
|
|
|
130
108
|
// Border radius.
|
|
131
109
|
const showBorderRadius = useHasBorderRadiusControl( name );
|
|
@@ -141,60 +119,83 @@ export default function BorderPanel( { name } ) {
|
|
|
141
119
|
return !! borderValues;
|
|
142
120
|
};
|
|
143
121
|
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
122
|
+
const resetBorder = () => {
|
|
123
|
+
if ( hasBorderRadius() ) {
|
|
124
|
+
return setBorder( { radius: userBorderStyles.radius } );
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
setBorder( undefined );
|
|
149
128
|
};
|
|
150
129
|
|
|
130
|
+
const resetAll = useCallback( () => setBorder( undefined ), [ setBorder ] );
|
|
131
|
+
const onBorderChange = useCallback(
|
|
132
|
+
( newBorder ) => {
|
|
133
|
+
// Ensure we have a visible border style when a border width or
|
|
134
|
+
// color is being selected.
|
|
135
|
+
const newBorderWithStyle = applyAllFallbackStyles( newBorder );
|
|
136
|
+
|
|
137
|
+
// As we can't conditionally generate styles based on if other
|
|
138
|
+
// style properties have been set we need to force split border
|
|
139
|
+
// definitions for user set border styles. Border radius is derived
|
|
140
|
+
// from the same property i.e. `border.radius` if it is a string
|
|
141
|
+
// that is used. The longhand border radii styles are only generated
|
|
142
|
+
// if that property is an object.
|
|
143
|
+
//
|
|
144
|
+
// For borders (color, style, and width) those are all properties on
|
|
145
|
+
// the `border` style property. This means if the theme.json defined
|
|
146
|
+
// split borders and the user condenses them into a flat border or
|
|
147
|
+
// vice-versa we'd get both sets of styles which would conflict.
|
|
148
|
+
const updatedBorder = ! hasSplitBorders( newBorderWithStyle )
|
|
149
|
+
? {
|
|
150
|
+
top: newBorderWithStyle,
|
|
151
|
+
right: newBorderWithStyle,
|
|
152
|
+
bottom: newBorderWithStyle,
|
|
153
|
+
left: newBorderWithStyle,
|
|
154
|
+
}
|
|
155
|
+
: {
|
|
156
|
+
color: null,
|
|
157
|
+
style: null,
|
|
158
|
+
width: null,
|
|
159
|
+
...newBorderWithStyle,
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// As radius is maintained separately to color, style, and width
|
|
163
|
+
// maintain its value. Undefined values here will be cleaned when
|
|
164
|
+
// global styles are saved.
|
|
165
|
+
setBorder( { radius: border?.radius, ...updatedBorder } );
|
|
166
|
+
},
|
|
167
|
+
[ setBorder ]
|
|
168
|
+
);
|
|
169
|
+
|
|
151
170
|
return (
|
|
152
171
|
<ToolsPanel label={ __( 'Border' ) } resetAll={ resetAll }>
|
|
153
|
-
{ showBorderWidth && (
|
|
154
|
-
<ToolsPanelItem
|
|
155
|
-
className="single-column"
|
|
156
|
-
hasValue={ createHasValueCallback( 'width' ) }
|
|
157
|
-
label={ __( 'Width' ) }
|
|
158
|
-
onDeselect={ createResetCallback( setBorderWidth ) }
|
|
159
|
-
isShownByDefault={ true }
|
|
160
|
-
>
|
|
161
|
-
<UnitControl
|
|
162
|
-
value={ borderWidthValue }
|
|
163
|
-
label={ __( 'Width' ) }
|
|
164
|
-
min={ MIN_BORDER_WIDTH }
|
|
165
|
-
onChange={ handleOnChangeWithStyle( setBorderWidth ) }
|
|
166
|
-
units={ units }
|
|
167
|
-
/>
|
|
168
|
-
</ToolsPanelItem>
|
|
169
|
-
) }
|
|
170
|
-
{ showBorderStyle && (
|
|
171
|
-
<ToolsPanelItem
|
|
172
|
-
className="single-column"
|
|
173
|
-
hasValue={ createHasValueCallback( 'style' ) }
|
|
174
|
-
label={ __( 'Style' ) }
|
|
175
|
-
onDeselect={ createResetCallback( setBorderStyle ) }
|
|
176
|
-
isShownByDefault={ true }
|
|
177
|
-
>
|
|
178
|
-
<BorderStyleControl
|
|
179
|
-
value={ borderStyle }
|
|
180
|
-
onChange={ handleOnChange( setBorderStyle ) }
|
|
181
|
-
/>
|
|
182
|
-
</ToolsPanelItem>
|
|
183
|
-
) }
|
|
184
|
-
{ showBorderColor && (
|
|
172
|
+
{ ( showBorderWidth || showBorderColor ) && (
|
|
185
173
|
<ToolsPanelItem
|
|
186
|
-
hasValue={
|
|
187
|
-
label={ __( '
|
|
188
|
-
onDeselect={
|
|
174
|
+
hasValue={ () => isDefinedBorder( userBorderStyles ) }
|
|
175
|
+
label={ __( 'Border' ) }
|
|
176
|
+
onDeselect={ () => resetBorder() }
|
|
189
177
|
isShownByDefault={ true }
|
|
190
178
|
>
|
|
191
|
-
<
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
179
|
+
<BorderBoxControl
|
|
180
|
+
colors={ colors }
|
|
181
|
+
enableAlpha={ true }
|
|
182
|
+
onChange={ onBorderChange }
|
|
183
|
+
showStyle={ showBorderStyle }
|
|
184
|
+
value={ border }
|
|
185
|
+
popoverClassNames={ {
|
|
186
|
+
linked:
|
|
187
|
+
'edit-site-global-styles-sidebar__border-box-control__popover',
|
|
188
|
+
top:
|
|
189
|
+
'edit-site-global-styles-sidebar__border-box-control__popover-top',
|
|
190
|
+
right:
|
|
191
|
+
'edit-site-global-styles-sidebar__border-box-control__popover-right',
|
|
192
|
+
bottom:
|
|
193
|
+
'edit-site-global-styles-sidebar__border-box-control__popover-bottom',
|
|
194
|
+
left:
|
|
195
|
+
'edit-site-global-styles-sidebar__border-box-control__popover-left',
|
|
196
|
+
} }
|
|
197
|
+
__experimentalHasMultipleOrigins={ true }
|
|
198
|
+
__experimentalIsRenderedInSidebar={ true }
|
|
198
199
|
/>
|
|
199
200
|
</ToolsPanelItem>
|
|
200
201
|
) }
|
|
@@ -202,12 +203,14 @@ export default function BorderPanel( { name } ) {
|
|
|
202
203
|
<ToolsPanelItem
|
|
203
204
|
hasValue={ hasBorderRadius }
|
|
204
205
|
label={ __( 'Radius' ) }
|
|
205
|
-
onDeselect={
|
|
206
|
+
onDeselect={ () => setBorderRadius( undefined ) }
|
|
206
207
|
isShownByDefault={ true }
|
|
207
208
|
>
|
|
208
209
|
<BorderRadiusControl
|
|
209
210
|
values={ borderRadiusValues }
|
|
210
|
-
onChange={
|
|
211
|
+
onChange={ ( value ) => {
|
|
212
|
+
setBorderRadius( value || undefined );
|
|
213
|
+
} }
|
|
211
214
|
/>
|
|
212
215
|
</ToolsPanelItem>
|
|
213
216
|
) }
|
|
@@ -12,7 +12,7 @@ import { useHasBorderPanel } from './border-panel';
|
|
|
12
12
|
import { useHasColorPanel } from './color-utils';
|
|
13
13
|
import { useHasDimensionsPanel } from './dimensions-panel';
|
|
14
14
|
import { useHasTypographyPanel } from './typography-panel';
|
|
15
|
-
import {
|
|
15
|
+
import { NavigationButtonAsItem } from './navigation-button';
|
|
16
16
|
|
|
17
17
|
function ContextMenu( { name, parentMenu = '' } ) {
|
|
18
18
|
const hasTypographyPanel = useHasTypographyPanel( name );
|
|
@@ -24,28 +24,28 @@ function ContextMenu( { name, parentMenu = '' } ) {
|
|
|
24
24
|
return (
|
|
25
25
|
<ItemGroup>
|
|
26
26
|
{ hasTypographyPanel && (
|
|
27
|
-
<
|
|
27
|
+
<NavigationButtonAsItem
|
|
28
28
|
icon={ typography }
|
|
29
29
|
path={ parentMenu + '/typography' }
|
|
30
30
|
>
|
|
31
31
|
{ __( 'Typography' ) }
|
|
32
|
-
</
|
|
32
|
+
</NavigationButtonAsItem>
|
|
33
33
|
) }
|
|
34
34
|
{ hasColorPanel && (
|
|
35
|
-
<
|
|
35
|
+
<NavigationButtonAsItem
|
|
36
36
|
icon={ color }
|
|
37
37
|
path={ parentMenu + '/colors' }
|
|
38
38
|
>
|
|
39
39
|
{ __( 'Colors' ) }
|
|
40
|
-
</
|
|
40
|
+
</NavigationButtonAsItem>
|
|
41
41
|
) }
|
|
42
42
|
{ hasLayoutPanel && (
|
|
43
|
-
<
|
|
43
|
+
<NavigationButtonAsItem
|
|
44
44
|
icon={ layout }
|
|
45
45
|
path={ parentMenu + '/layout' }
|
|
46
46
|
>
|
|
47
47
|
{ __( 'Layout' ) }
|
|
48
|
-
</
|
|
48
|
+
</NavigationButtonAsItem>
|
|
49
49
|
) }
|
|
50
50
|
</ItemGroup>
|
|
51
51
|
);
|
|
@@ -7,30 +7,33 @@ import {
|
|
|
7
7
|
__experimentalSpacer as Spacer,
|
|
8
8
|
__experimentalHeading as Heading,
|
|
9
9
|
__experimentalView as View,
|
|
10
|
+
__experimentalNavigatorBackButton as NavigatorBackButton,
|
|
10
11
|
} from '@wordpress/components';
|
|
11
12
|
import { isRTL, __ } from '@wordpress/i18n';
|
|
12
13
|
import { chevronRight, chevronLeft } from '@wordpress/icons';
|
|
13
14
|
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
import { NavigationBackButton } from './navigation-button';
|
|
18
|
-
|
|
19
15
|
function ScreenHeader( { title, description } ) {
|
|
20
16
|
return (
|
|
21
|
-
<VStack spacing={
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
<VStack spacing={ 0 }>
|
|
18
|
+
<View>
|
|
19
|
+
<Spacer marginBottom={ 0 } paddingX={ 4 } paddingY={ 3 }>
|
|
20
|
+
<HStack spacing={ 2 }>
|
|
21
|
+
<NavigatorBackButton
|
|
22
|
+
style={
|
|
23
|
+
// TODO: This style override is also used in ToolsPanelHeader.
|
|
24
|
+
// It should be supported out-of-the-box by Button.
|
|
25
|
+
{ minWidth: 24, padding: 0 }
|
|
26
|
+
}
|
|
27
|
+
icon={ isRTL() ? chevronRight : chevronLeft }
|
|
28
|
+
isSmall
|
|
29
|
+
aria-label={ __( 'Navigate to the previous view' ) }
|
|
30
|
+
/>
|
|
31
|
+
<Spacer>
|
|
32
|
+
<Heading level={ 5 }>{ title }</Heading>
|
|
33
|
+
</Spacer>
|
|
34
|
+
</HStack>
|
|
32
35
|
</Spacer>
|
|
33
|
-
</
|
|
36
|
+
</View>
|
|
34
37
|
{ description && (
|
|
35
38
|
<p className="edit-site-global-styles-header__description">
|
|
36
39
|
{ description }
|
|
@@ -28,12 +28,12 @@ function GenericNavigationButton( { icon, children, ...props } ) {
|
|
|
28
28
|
);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
function
|
|
31
|
+
function NavigationButtonAsItem( props ) {
|
|
32
32
|
return <NavigatorButton as={ GenericNavigationButton } { ...props } />;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
function
|
|
35
|
+
function NavigationBackButtonAsItem( props ) {
|
|
36
36
|
return <NavigatorBackButton as={ GenericNavigationButton } { ...props } />;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
export {
|
|
39
|
+
export { NavigationButtonAsItem, NavigationBackButtonAsItem };
|
|
@@ -16,7 +16,7 @@ import { useMemo } from '@wordpress/element';
|
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
18
|
import Subtitle from './subtitle';
|
|
19
|
-
import {
|
|
19
|
+
import { NavigationButtonAsItem } from './navigation-button';
|
|
20
20
|
import { useSetting } from './hooks';
|
|
21
21
|
import ColorIndicatorWrapper from './color-indicator-wrapper';
|
|
22
22
|
|
|
@@ -58,7 +58,7 @@ function Palette( { name } ) {
|
|
|
58
58
|
<VStack spacing={ 3 }>
|
|
59
59
|
<Subtitle>{ __( 'Palette' ) }</Subtitle>
|
|
60
60
|
<ItemGroup isBordered isSeparated>
|
|
61
|
-
<
|
|
61
|
+
<NavigationButtonAsItem path={ screenPath }>
|
|
62
62
|
<HStack
|
|
63
63
|
direction={
|
|
64
64
|
colors.length === 0 ? 'row-reverse' : 'row'
|
|
@@ -73,7 +73,7 @@ function Palette( { name } ) {
|
|
|
73
73
|
</ZStack>
|
|
74
74
|
<FlexItem>{ paletteButtonText }</FlexItem>
|
|
75
75
|
</HStack>
|
|
76
|
-
</
|
|
76
|
+
</NavigationButtonAsItem>
|
|
77
77
|
</ItemGroup>
|
|
78
78
|
</VStack>
|
|
79
79
|
);
|
|
@@ -22,7 +22,7 @@ import { useHasColorPanel } from './color-utils';
|
|
|
22
22
|
import { useHasDimensionsPanel } from './dimensions-panel';
|
|
23
23
|
import { useHasTypographyPanel } from './typography-panel';
|
|
24
24
|
import ScreenHeader from './header';
|
|
25
|
-
import {
|
|
25
|
+
import { NavigationButtonAsItem } from './navigation-button';
|
|
26
26
|
|
|
27
27
|
function useSortedBlockTypes() {
|
|
28
28
|
const blockItems = useSelect(
|
|
@@ -61,12 +61,12 @@ function BlockMenuItem( { block } ) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
return (
|
|
64
|
-
<
|
|
64
|
+
<NavigationButtonAsItem path={ '/blocks/' + block.name }>
|
|
65
65
|
<HStack justify="flex-start">
|
|
66
66
|
<BlockIcon icon={ block.icon } />
|
|
67
67
|
<FlexItem>{ block.title }</FlexItem>
|
|
68
68
|
</HStack>
|
|
69
|
-
</
|
|
69
|
+
</NavigationButtonAsItem>
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
*/
|
|
16
16
|
import ScreenHeader from './header';
|
|
17
17
|
import Palette from './palette';
|
|
18
|
-
import {
|
|
18
|
+
import { NavigationButtonAsItem } from './navigation-button';
|
|
19
19
|
import { getSupportedGlobalStylesPanels, useStyle } from './hooks';
|
|
20
20
|
import Subtitle from './subtitle';
|
|
21
21
|
import ColorIndicatorWrapper from './color-indicator-wrapper';
|
|
@@ -33,7 +33,7 @@ function BackgroundColorItem( { name, parentMenu } ) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
|
-
<
|
|
36
|
+
<NavigationButtonAsItem path={ parentMenu + '/colors/background' }>
|
|
37
37
|
<HStack justify="flex-start">
|
|
38
38
|
<ColorIndicatorWrapper expanded={ false }>
|
|
39
39
|
<ColorIndicator
|
|
@@ -42,7 +42,7 @@ function BackgroundColorItem( { name, parentMenu } ) {
|
|
|
42
42
|
</ColorIndicatorWrapper>
|
|
43
43
|
<FlexItem>{ __( 'Background' ) }</FlexItem>
|
|
44
44
|
</HStack>
|
|
45
|
-
</
|
|
45
|
+
</NavigationButtonAsItem>
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -56,14 +56,14 @@ function TextColorItem( { name, parentMenu } ) {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
return (
|
|
59
|
-
<
|
|
59
|
+
<NavigationButtonAsItem path={ parentMenu + '/colors/text' }>
|
|
60
60
|
<HStack justify="flex-start">
|
|
61
61
|
<ColorIndicatorWrapper expanded={ false }>
|
|
62
62
|
<ColorIndicator colorValue={ color } />
|
|
63
63
|
</ColorIndicatorWrapper>
|
|
64
64
|
<FlexItem>{ __( 'Text' ) }</FlexItem>
|
|
65
65
|
</HStack>
|
|
66
|
-
</
|
|
66
|
+
</NavigationButtonAsItem>
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -77,14 +77,14 @@ function LinkColorItem( { name, parentMenu } ) {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
return (
|
|
80
|
-
<
|
|
80
|
+
<NavigationButtonAsItem path={ parentMenu + '/colors/link' }>
|
|
81
81
|
<HStack justify="flex-start">
|
|
82
82
|
<ColorIndicatorWrapper expanded={ false }>
|
|
83
83
|
<ColorIndicator colorValue={ color } />
|
|
84
84
|
</ColorIndicatorWrapper>
|
|
85
85
|
<FlexItem>{ __( 'Links' ) }</FlexItem>
|
|
86
86
|
</HStack>
|
|
87
|
-
</
|
|
87
|
+
</NavigationButtonAsItem>
|
|
88
88
|
);
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
__experimentalItemGroup as ItemGroup,
|
|
6
|
-
__experimentalItem as Item,
|
|
7
6
|
__experimentalHStack as HStack,
|
|
7
|
+
__experimentalSpacer as Spacer,
|
|
8
8
|
__experimentalVStack as VStack,
|
|
9
9
|
FlexItem,
|
|
10
10
|
CardBody,
|
|
@@ -21,7 +21,7 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
21
21
|
* Internal dependencies
|
|
22
22
|
*/
|
|
23
23
|
import { IconWithCurrentColor } from './icon-with-current-color';
|
|
24
|
-
import {
|
|
24
|
+
import { NavigationButtonAsItem } from './navigation-button';
|
|
25
25
|
import ContextMenu from './context-menu';
|
|
26
26
|
import StylesPreview from './preview';
|
|
27
27
|
|
|
@@ -37,48 +37,58 @@ function ScreenRoot() {
|
|
|
37
37
|
return (
|
|
38
38
|
<Card size="small">
|
|
39
39
|
<CardBody>
|
|
40
|
-
<VStack spacing={
|
|
40
|
+
<VStack spacing={ 4 }>
|
|
41
41
|
<Card>
|
|
42
42
|
<CardMedia>
|
|
43
43
|
<StylesPreview />
|
|
44
44
|
</CardMedia>
|
|
45
45
|
</Card>
|
|
46
46
|
{ !! variations?.length && (
|
|
47
|
-
<
|
|
48
|
-
<
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
<ItemGroup>
|
|
48
|
+
<NavigationButtonAsItem path="/variations">
|
|
49
|
+
<HStack justify="space-between">
|
|
50
|
+
<FlexItem>
|
|
51
|
+
{ __( 'Browse styles' ) }
|
|
52
|
+
</FlexItem>
|
|
53
|
+
<IconWithCurrentColor
|
|
54
|
+
icon={
|
|
55
|
+
isRTL() ? chevronLeft : chevronRight
|
|
56
|
+
}
|
|
57
|
+
/>
|
|
58
|
+
</HStack>
|
|
59
|
+
</NavigationButtonAsItem>
|
|
60
|
+
</ItemGroup>
|
|
57
61
|
) }
|
|
62
|
+
<ContextMenu />
|
|
58
63
|
</VStack>
|
|
59
64
|
</CardBody>
|
|
60
65
|
|
|
61
|
-
<CardBody>
|
|
62
|
-
<ContextMenu />
|
|
63
|
-
</CardBody>
|
|
64
|
-
|
|
65
66
|
<CardDivider />
|
|
66
67
|
|
|
67
68
|
<CardBody>
|
|
69
|
+
<Spacer
|
|
70
|
+
as="p"
|
|
71
|
+
paddingTop={ 2 }
|
|
72
|
+
/*
|
|
73
|
+
* 13px matches the text inset of the NavigationButton (12px padding, plus the width of the button's border).
|
|
74
|
+
* This is an ad hoc override for this particular instance only and should be reconsidered before making into a pattern.
|
|
75
|
+
*/
|
|
76
|
+
paddingX="13px"
|
|
77
|
+
marginBottom={ 4 }
|
|
78
|
+
>
|
|
79
|
+
{ __(
|
|
80
|
+
'Customize the appearance of specific blocks for the whole site.'
|
|
81
|
+
) }
|
|
82
|
+
</Spacer>
|
|
68
83
|
<ItemGroup>
|
|
69
|
-
<
|
|
70
|
-
{ __(
|
|
71
|
-
'Customize the appearance of specific blocks for the whole site.'
|
|
72
|
-
) }
|
|
73
|
-
</Item>
|
|
74
|
-
<NavigationButton path="/blocks">
|
|
84
|
+
<NavigationButtonAsItem path="/blocks">
|
|
75
85
|
<HStack justify="space-between">
|
|
76
86
|
<FlexItem>{ __( 'Blocks' ) }</FlexItem>
|
|
77
87
|
<IconWithCurrentColor
|
|
78
88
|
icon={ isRTL() ? chevronLeft : chevronRight }
|
|
79
89
|
/>
|
|
80
90
|
</HStack>
|
|
81
|
-
</
|
|
91
|
+
</NavigationButtonAsItem>
|
|
82
92
|
</ItemGroup>
|
|
83
93
|
</CardBody>
|
|
84
94
|
</Card>
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
15
|
import ScreenHeader from './header';
|
|
16
|
-
import {
|
|
16
|
+
import { NavigationButtonAsItem } from './navigation-button';
|
|
17
17
|
import { useStyle } from './hooks';
|
|
18
18
|
import Subtitle from './subtitle';
|
|
19
19
|
import TypographyPanel from './typography-panel';
|
|
@@ -44,7 +44,7 @@ function Item( { name, parentMenu, element, label } ) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
return (
|
|
47
|
-
<
|
|
47
|
+
<NavigationButtonAsItem path={ parentMenu + '/typography/' + element }>
|
|
48
48
|
<HStack justify="flex-start">
|
|
49
49
|
<FlexItem
|
|
50
50
|
className="edit-site-global-styles-screen-typography__indicator"
|
|
@@ -62,7 +62,7 @@ function Item( { name, parentMenu, element, label } ) {
|
|
|
62
62
|
</FlexItem>
|
|
63
63
|
<FlexItem>{ label }</FlexItem>
|
|
64
64
|
</HStack>
|
|
65
|
-
</
|
|
65
|
+
</NavigationButtonAsItem>
|
|
66
66
|
);
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -379,6 +379,7 @@ describe( 'global styles renderer', () => {
|
|
|
379
379
|
expect( toStyles( tree, blockSelectors ) ).toEqual(
|
|
380
380
|
'body {margin: 0;}' +
|
|
381
381
|
'body{background-color: red;margin: 10px;padding: 10px;}h1{font-size: 42px;}.wp-block-group{margin-top: 10px;margin-right: 20px;margin-bottom: 30px;margin-left: 40px;padding-top: 11px;padding-right: 22px;padding-bottom: 33px;padding-left: 44px;}h1,h2,h3,h4,h5,h6{color: orange;}h1 a,h2 a,h3 a,h4 a,h5 a,h6 a{color: hotpink;}' +
|
|
382
|
+
'.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }' +
|
|
382
383
|
'.has-white-color{color: var(--wp--preset--color--white) !important;}.has-white-background-color{background-color: var(--wp--preset--color--white) !important;}.has-white-border-color{border-color: var(--wp--preset--color--white) !important;}.has-black-color{color: var(--wp--preset--color--black) !important;}.has-black-background-color{background-color: var(--wp--preset--color--black) !important;}.has-black-border-color{border-color: var(--wp--preset--color--black) !important;}h1.has-blue-color,h2.has-blue-color,h3.has-blue-color,h4.has-blue-color,h5.has-blue-color,h6.has-blue-color{color: var(--wp--preset--color--blue) !important;}h1.has-blue-background-color,h2.has-blue-background-color,h3.has-blue-background-color,h4.has-blue-background-color,h5.has-blue-background-color,h6.has-blue-background-color{background-color: var(--wp--preset--color--blue) !important;}h1.has-blue-border-color,h2.has-blue-border-color,h3.has-blue-border-color,h4.has-blue-border-color,h5.has-blue-border-color,h6.has-blue-border-color{border-color: var(--wp--preset--color--blue) !important;}'
|
|
383
384
|
);
|
|
384
385
|
} );
|