-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathstyle.scss
245 lines (213 loc) · 5.58 KB
/
style.scss
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
.components-button {
display: inline-flex;
text-decoration: none;
font-size: $default-font-size;
margin: 0;
border: 0;
cursor: pointer;
-webkit-appearance: none;
background: none;
transition: box-shadow 0.1s linear;
@include reduce-motion("transition");
height: $icon-button-size;
align-items: center;
box-sizing: border-box;
padding: 0 8px;
overflow: hidden;
border-radius: 3px;
color: $dark-gray-500;
&:not(:disabled):not([aria-disabled="true"]):not(.is-secondary):not(.is-primary):not(.is-tertiary):not(.is-link):hover {
@include button-style__hover;
}
// Default button style
&.is-secondary {
border-width: $border-width;
border-style: solid;
white-space: nowrap;
color: color(theme(button) shade(6%));
border-color: color(theme(button) shade(6%));
background: #f3f5f6;
&:not(:disabled):not([aria-disabled="true"]):hover {
background: #f1f1f1;
border-color: color(theme(button) shade(25%));
color: color(theme(button) shade(25%));
text-decoration: none;
}
&:focus:enabled {
background: #f3f5f6;
color: color(theme(button) shade(25%));
border-color: color(theme(button) shade(5%));
box-shadow: 0 0 0 $border-width color(theme(button) shade(5%));
text-decoration: none;
}
&:not([aria-disabled="true"]):active:enabled {
background: #f3f5f6;
color: color(theme(button) shade(5%));
border-color: #7e8993;
box-shadow: none;
}
&:disabled,
&[aria-disabled="true"] {
color: #a0a5aa;
border-color: #ddd;
background: #f7f7f7;
text-shadow: 0 $border-width 0 #fff;
transform: none;
opacity: 1;
}
}
&.is-primary {
border-width: $border-width;
border-style: solid;
white-space: nowrap;
background: color(theme(button));
border-color: color(theme(button));
color: $white;
text-decoration: none;
text-shadow: none;
&:not(:disabled):not([aria-disabled="true"]):hover,
&:focus:enabled {
background: color(theme(button) shade(10%));
border-color: color(theme(button) shade(10%));
color: $white;
}
&:focus:enabled {
box-shadow:
0 0 0 $border-width $white,
0 0 0 3px color(theme(button));
}
&:not([aria-disabled="true"]):active:enabled {
background: color(theme(button) shade(20%));
border-color: color(theme(button) shade(20%));
color: $white;
}
&:disabled,
&:disabled:active:enabled,
&[aria-disabled="true"],
&[aria-disabled="true"]:enabled, // This catches a situation where a Button is aria-disabled, but not disabled.
&[aria-disabled="true"]:active:enabled {
color: color(theme(button) tint(40%));
background: color(theme(button) tint(10%));
border-color: color(theme(button) tint(10%));
opacity: 1;
&:focus:enabled {
box-shadow:
0 0 0 $border-width $white,
0 0 0 3px color(theme(button));
}
}
&.is-busy,
&.is-busy:disabled,
&.is-busy[aria-disabled="true"] {
color: $white;
background-size: 100px 100%;
// Disable reason: This function call looks nicer when each argument is on its own line.
/* stylelint-disable */
background-image: linear-gradient(
-45deg,
theme(button) 28%,
color(theme(button) shade(20%)) 28%,
color(theme(button) shade(20%)) 72%,
theme(button) 72%
);
/* stylelint-enable */
border-color: color(theme(button));
}
}
/* Buttons that look like links, for a cross of good semantics with the visual */
&.is-link {
margin: 0;
padding: 0;
box-shadow: none;
border: 0;
border-radius: 0;
background: none;
outline: none;
text-align: left;
/* Mimics the default link style in common.css */
color: #0073aa;
text-decoration: underline;
transition-property: border, background, color;
transition-duration: 0.05s;
transition-timing-function: ease-in-out;
@include reduce-motion("transition");
height: auto;
&:not(:disabled):not([aria-disabled="true"]):hover,
&:not([aria-disabled="true"]):active {
color: #00a0d2;
}
&:focus {
color: #124964;
box-shadow:
0 0 0 $border-width #5b9dd9,
0 0 2px $border-width rgba(30, 140, 190, 0.8);
}
}
/* Link buttons that are red to indicate destructive behavior. */
&.is-link.is-destructive {
color: $alert-red;
}
&:not([aria-disabled="true"]):active {
color: inherit;
}
&:disabled,
&[aria-disabled="true"] {
cursor: default;
opacity: 0.3;
}
&:focus:not(:disabled) {
@include button-style__focus-active;
}
&.is-busy,
&.is-secondary.is-busy,
&.is-secondary.is-busy:disabled,
&.is-secondary.is-busy[aria-disabled="true"] {
animation: components-button__busy-animation 2500ms infinite linear;
background-size: 100px 100%;
background-image: repeating-linear-gradient(-45deg, $light-gray-500, $white 11px, $white 10px, $light-gray-500 20px);
opacity: 1;
}
&.is-small {
height: 24px;
line-height: 22px;
padding: 0 8px;
font-size: 11px;
}
// Buttons that are text-based.
&.is-tertiary {
color: theme(outlines);
.dashicon {
display: inline-block;
flex: 0 0 auto;
}
&:not([aria-disabled="true"]):active:focus:enabled {
box-shadow: none;
}
&:not(:disabled):not([aria-disabled="true"]):hover {
color: color(theme(outlines) shade(25%));
}
}
&.has-icon {
.dashicon {
display: inline-block;
flex: 0 0 auto;
}
&.has-text svg {
margin-right: 8px;
}
}
svg {
fill: currentColor;
outline: none;
}
// Fixes a Safari+VoiceOver bug, where the screen reader text is announced not respecting the source order.
// See https://core.trac.wordpress.org/ticket/42006 and https://github.com/h5bp/html5-boilerplate/issues/1985
.screen-reader-text {
height: auto;
}
}
@keyframes components-button__busy-animation {
0% {
background-position: 200px 0;
}
}