-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathstyles.ts
157 lines (138 loc) · 3.31 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/**
* External dependencies
*/
import styled from '@emotion/styled';
import { css } from '@emotion/react';
/**
* Internal dependencies
*/
import Button from '../button';
import { Heading } from '../heading';
import { HStack } from '../h-stack';
import { space } from '../utils/space';
import { COLORS, CONFIG, font } from '../utils';
import { View } from '../view';
import InputControl from '../input-control';
import {
Container as InputControlContainer,
Input,
BackdropUI as InputBackdropUI,
} from '../input-control/styles/input-control-styles';
import ColorIndicator from '../color-indicator';
export const IndicatorStyled = styled( ColorIndicator )`
&& {
flex-shrink: 0;
width: ${ space( 6 ) };
height: ${ space( 6 ) };
}
`;
export const NameInputControl = styled( InputControl )`
${ InputControlContainer } {
background: ${ COLORS.gray[ 100 ] };
border-radius: ${ CONFIG.controlBorderRadius };
${ Input }${ Input }${ Input }${ Input } {
height: ${ space( 8 ) };
}
${ InputBackdropUI }${ InputBackdropUI }${ InputBackdropUI } {
border-color: transparent;
box-shadow: none;
}
}
`;
const buttonStyleReset = ( {
as,
}: {
as: React.ComponentProps< typeof View >[ 'as' ];
} ) => {
if ( as === 'button' ) {
return css`
display: flex;
align-items: center;
width: 100%;
appearance: none;
background: transparent;
border: none;
border-radius: 0;
padding: 0;
cursor: pointer;
&:hover {
color: ${ COLORS.theme.accent };
}
`;
}
return null;
};
export const PaletteItem = styled( View )`
${ buttonStyleReset }
padding-block: 3px;
padding-inline-start: ${ space( 3 ) };
border: 1px solid ${ CONFIG.surfaceBorderColor };
border-bottom-color: transparent;
font-size: ${ font( 'default.fontSize' ) };
&:focus-visible {
border-color: transparent;
box-shadow: 0 0 0 var( --wp-admin-border-width-focus )
${ COLORS.theme.accent };
// Windows high contrast mode.
outline: 2px solid transparent;
outline-offset: 0;
}
border-top-left-radius: ${ CONFIG.controlBorderRadius };
border-top-right-radius: ${ CONFIG.controlBorderRadius };
& + & {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
&:last-child {
border-bottom-left-radius: ${ CONFIG.controlBorderRadius };
border-bottom-right-radius: ${ CONFIG.controlBorderRadius };
border-bottom-color: ${ CONFIG.surfaceBorderColor };
}
&.is-selected + & {
border-top-color: transparent;
}
&.is-selected {
border-color: ${ COLORS.theme.accent };
}
`;
export const NameContainer = styled.div`
line-height: ${ space( 8 ) };
margin-left: ${ space( 2 ) };
margin-right: ${ space( 2 ) };
white-space: nowrap;
overflow: hidden;
`;
export const PaletteHeading = styled( Heading )`
text-transform: uppercase;
line-height: ${ space( 6 ) };
font-weight: 500;
&&& {
font-size: 11px;
margin-bottom: 0;
}
`;
export const PaletteActionsContainer = styled( View )`
height: ${ space( 6 ) };
display: flex;
`;
export const PaletteHStackHeader = styled( HStack )`
margin-bottom: ${ space( 2 ) };
`;
export const PaletteEditStyles = styled( View )`
&&& {
.components-button.has-icon {
min-width: 0;
padding: 0;
}
}
`;
export const DoneButton = styled( Button )`
&& {
color: ${ COLORS.theme.accent };
}
`;
export const RemoveButton = styled( Button )`
&& {
margin-top: ${ space( 1 ) };
}
`;