-
Notifications
You must be signed in to change notification settings - Fork 4k
/
styles.ts
129 lines (111 loc) · 2.78 KB
/
styles.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/**
* External dependencies
*/
import { css } from '@emotion/react';
/**
* Internal dependencies
*/
import {
StyledField as BaseControlField,
StyledHelp as BaseControlHelp,
Wrapper as BaseControlWrapper,
} from '../base-control/styles/base-control-styles';
import { COLORS, CONFIG } from '../utils';
import { space } from '../ui/utils/space';
const toolsPanelGrid = {
spacing: css`
column-gap: ${ space( 4 ) };
row-gap: ${ space( 6 ) };
`,
item: {
fullWidth: css`
grid-column: 1 / -1;
`,
},
};
export const ToolsPanel = css`
${ toolsPanelGrid.spacing };
border-top: ${ CONFIG.borderWidth } solid ${ COLORS.gray[ 200 ] };
margin-top: -1px;
padding: ${ space( 4 ) };
`;
/**
* Items injected into a ToolsPanel via a virtual bubbling slot will require
* an inner dom element to be injected. The following rule allows for the
* CSS grid display to be re-established.
*/
export const ToolsPanelWithInnerWrapper = ( columns: number ) => {
return css`
> div:not( :first-of-type ) {
display: grid;
grid-template-columns: ${ `repeat( ${ columns }, 1fr )` };
${ toolsPanelGrid.spacing }
${ toolsPanelGrid.item.fullWidth }
}
`;
};
export const ToolsPanelHiddenInnerWrapper = css`
> div:not( :first-of-type ) {
display: none;
}
`;
export const ToolsPanelHeader = css`
${ toolsPanelGrid.item.fullWidth }
gap: ${ space( 2 ) };
/**
* The targeting of dropdown menu component classes here is a temporary
* measure only.
*
* The following styles should be replaced once the DropdownMenu has been
* refactored and can be targeted via component interpolation.
*/
.components-dropdown-menu {
margin: ${ space( -1 ) } 0;
line-height: 0;
}
&&&& .components-dropdown-menu__toggle {
padding: 0;
min-width: ${ space( 6 ) };
}
`;
export const ToolsPanelHeading = css`
font-size: inherit;
font-weight: 500;
line-height: normal;
/* Required to meet specificity requirements to ensure zero margin */
&& {
margin: 0;
}
`;
export const ToolsPanelItem = css`
${ toolsPanelGrid.item.fullWidth }
/* Clear spacing in and around controls added as panel items. */
/* Remove when they can be addressed via context system. */
& > div,
& > fieldset {
padding-bottom: 0;
margin-bottom: 0;
max-width: 100%;
}
/* Remove BaseControl components margins and leave spacing to grid layout */
&& ${ BaseControlWrapper } {
margin-bottom: 0;
/**
* To maintain proper spacing within a base control, the field's bottom
* margin should only be removed when there is no help text included and
* it is therefore the last-child.
*/
${ BaseControlField }:last-child {
margin-bottom: 0;
}
}
${ BaseControlHelp } {
margin-bottom: 0;
}
`;
export const ToolsPanelItemPlaceholder = css`
display: none;
`;
export const DropdownMenu = css`
min-width: 200px;
`;