-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy path_mixins.scss
335 lines (278 loc) · 6.67 KB
/
_mixins.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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
/**
* Breakpoint mixins
*/
@mixin break-huge() {
@media (min-width: #{ ($break-huge) }) {
@content;
}
}
@mixin break-wide() {
@media (min-width: #{ ($break-wide) }) {
@content;
}
}
@mixin break-xlarge() {
@media (min-width: #{ ($break-xlarge) }) {
@content;
}
}
@mixin break-large() {
@media (min-width: #{ ($break-large) }) {
@content;
}
}
@mixin break-medium() {
@media (min-width: #{ ($break-medium) }) {
@content;
}
}
@mixin break-small() {
@media (min-width: #{ ($break-small) }) {
@content;
}
}
@mixin break-mobile() {
@media (min-width: #{ ($break-mobile) }) {
@content;
}
}
/**
* Long content fade mixin
*
* Creates a fading overlay to signify that the content is longer
* than the space allows.
*/
@mixin long-content-fade($direction: right, $size: 20%, $color: #fff, $edge: 0, $z-index: false) {
content: "";
display: block;
position: absolute;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
pointer-events: none;
@if $z-index {
z-index: $z-index;
}
@if $direction == "bottom" {
background: linear-gradient(to top, rgba($color, 0), $color 90%);
left: $edge;
right: $edge;
top: $edge;
bottom: calc(100% - $size);
width: auto;
}
@if $direction == "top" {
background: linear-gradient(to bottom, rgba($color, 0), $color 90%);
top: calc(100% - $size);
left: $edge;
right: $edge;
bottom: $edge;
width: auto;
}
@if $direction == "left" {
background: linear-gradient(to left, rgba($color, 0), $color 90%);
top: $edge;
left: $edge;
bottom: $edge;
right: auto;
width: $size;
height: auto;
}
@if $direction == "right" {
background: linear-gradient(to right, rgba($color, 0), $color 90%);
top: $edge;
bottom: $edge;
right: $edge;
left: auto;
width: $size;
height: auto;
}
}
/**
* Button states and focus styles
*/
// Buttons with rounded corners.
@mixin button-style__disabled {
opacity: 0.6;
cursor: default;
}
@mixin button-style__hover {
background-color: $white;
color: $dark-gray-900;
box-shadow: inset 0 0 0 1px $light-gray-500, inset 0 0 0 2px $white, 0 1px 1px rgba($dark-gray-900, 0.2);
}
@mixin button-style__active() {
outline: none;
background-color: $white;
color: $dark-gray-900;
box-shadow: inset 0 0 0 1px $light-gray-700, inset 0 0 0 2px $white;
}
@mixin button-style__focus-active() {
background-color: $white;
color: $dark-gray-900;
box-shadow: inset 0 0 0 1px $dark-gray-300, inset 0 0 0 2px $white;
// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 2px solid transparent;
outline-offset: -2px;
}
// Switch.
@mixin switch-style__focus-active() {
box-shadow: 0 0 0 2px $white, 0 0 0 3px $dark-gray-300;
// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 2px solid transparent;
outline-offset: 2px;
}
// Formatting Buttons.
@mixin formatting-button-style__hover {
color: $dark-gray-500;
box-shadow: inset 0 0 0 1px $dark-gray-500, inset 0 0 0 2px $white;
}
@mixin formatting-button-style__active() {
outline: none;
color: $white;
box-shadow: none;
background: $dark-gray-500;
}
@mixin formatting-button-style__focus() {
box-shadow: inset 0 0 0 1px $dark-gray-500, inset 0 0 0 2px $white;
// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 2px solid transparent;
outline-offset: -2px;
}
// Tabs, Inputs, Square buttons.
@mixin input-style__neutral() {
box-shadow: 0 0 0 transparent;
transition: box-shadow 0.1s linear;
border-radius: $radius-round-rectangle;
border: $border-width solid $dark-gray-150;
}
@mixin input-style__focus() {
color: $dark-gray-900;
border-color: $blue-medium-500;
box-shadow: 0 0 0 1px $blue-medium-500;
// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 2px solid transparent;
outline-offset: -2px;
}
// Square buttons.
@mixin square-style__neutral() {
outline-offset: -1px;
}
@mixin square-style__focus() {
color: $dark-gray-900;
outline-offset: -1px;
outline: 1px dotted $dark-gray-500;
}
// Menu items.
@mixin menu-style__neutral() {
border: none;
box-shadow: none;
}
@mixin menu-style__hover() {
color: $dark-gray-900;
border: none;
box-shadow: none;
background: $light-gray-200;
}
@mixin menu-style__focus() {
color: $dark-gray-900;
border: none;
box-shadow: none;
outline-offset: -2px;
outline: 1px dotted $dark-gray-500;
}
// Blocks in the Library.
@mixin block-style__disabled {
opacity: 0.6;
cursor: default;
}
@mixin block-style__hover {
background: $light-gray-200;
color: $dark-gray-900;
}
@mixin block-style__focus-active() {
color: $dark-gray-900;
box-shadow: 0 0 0 2px $blue-medium-500;
// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 2px solid transparent;
outline-offset: -2px;
}
/**
* Applies editor left position to the selector passed as argument
*/
@mixin editor-left($selector) {
#{$selector} { /* Set left position when auto-fold is not on the body element. */
left: 0;
@include break-medium() {
left: $admin-sidebar-width;
}
}
.auto-fold #{$selector} { /* Auto fold is when on smaller breakpoints, nav menu auto collapses. */
@include break-medium() {
left: $admin-sidebar-width-collapsed;
}
@include break-large() {
left: $admin-sidebar-width;
}
}
/* Sidebar manually collapsed. */
.folded #{$selector} {
left: 0;
@include break-medium() {
left: $admin-sidebar-width-collapsed;
}
}
/* Mobile menu opened. */
@media (max-width: #{ ($break-medium) }) {
.auto-fold .wp-responsive-open #{$selector} {
left: $admin-sidebar-width-big;
}
}
/* In small screens with responsive menu expanded there is small white space. */
@media (max-width: #{ ($break-small) }) {
.auto-fold .wp-responsive-open #{$selector} {
margin-left: -18px;
}
}
body.is-fullscreen-mode #{$selector} {
left: 0 !important;
}
}
/**
* Applies editor right position to the selector passed as argument
*/
@mixin editor-right($selector) {
#{ $selector } {
right: 0;
}
.edit-post-layout.is-sidebar-opened #{ $selector } {
right: $sidebar-width;
}
}
/**
* Styles that are reused verbatim in a few places
*/
@mixin caption-style() {
margin-top: 0.5em;
margin-bottom: 1em;
color: $dark-gray-500;
text-align: center;
font-size: $default-font-size;
}
@mixin dropdown-arrow() {
content: "";
pointer-events: none;
display: block;
width: 0;
height: 0;
border-left: 3px solid transparent;
border-right: 3px solid transparent;
border-top: 5px solid currentColor;
margin-left: $grid-size-small;
// This gives the icon space on the right side consistent with the material
// icon standards.
margin-right: 2px;
}