UNPKG

5.67 kBSCSSView Raw
1// Some things copied from WinJS with <3
2
3
4// LTR mixin definition
5@mixin LTR {
6 html[dir='ltr'] & {
7 @content;
8 }
9}
10
11// RTL mixin definition
12@mixin RTL {
13 html[dir='rtl'] & {
14 @content;
15 }
16}
17
18// Use baseRTL for a root element of a control that needs rtl support
19@mixin baseRtl {
20 @include RTL {
21 direction: rtl;
22 unicode-bidi: bidi-override;
23 }
24}
25
26/*
27 Common CSS property mixins with support for RTL.
28 Use these mixins when you want to automatically create RTL versions of your properties.
29 They are in alphabetical order (a-z).
30*/
31
32@mixin border-color($top, $right, $bottom, $left) {
33 border-color: $top $right $bottom $left;
34 @include RTL {
35 border-color: $top $left $bottom $right;
36 }
37}
38
39@mixin border-left($width, $style, $color) {
40 @include LTR {
41 border-left: $width $style $color;
42 }
43 @include RTL {
44 border-right: $width $style $color;
45 }
46}
47
48@mixin border-left-color($color) {
49 @include LTR {
50 border-left-color: $color;
51 }
52 @include RTL {
53 border-right-color: $color;
54 }
55}
56
57@mixin border-left-style($style) {
58 @include LTR {
59 border-left-style: $style;
60 }
61 @include RTL {
62 border-right-style: $style;
63 }
64}
65
66@mixin border-left-width($width) {
67 @include LTR {
68 border-left-width: $width;
69 }
70 @include RTL {
71 border-right-width: $width;
72 }
73}
74
75@mixin border-radius($topLeft, $topRight, $bottomRight, $bottomLeft) {
76 border-radius: $topLeft $topRight $bottomRight $bottomLeft;
77 @include RTL {
78 border-radius: $topRight $topLeft $bottomLeft $bottomRight;
79 }
80}
81
82@mixin border-right($width, $style, $color) {
83 @include LTR {
84 border-right: $width $style $color;
85 }
86 @include RTL {
87 border-left: $width $style $color;
88 }
89}
90
91@mixin border-right-color($color) {
92 @include LTR {
93 border-right-color: $color;
94 }
95 @include RTL {
96 border-left-color: $color;
97 }
98}
99
100@mixin border-right-style($style) {
101 @include LTR {
102 border-right-style: $style;
103 }
104 @include RTL {
105 border-left-style: $style;
106 }
107}
108
109@mixin border-right-width($width) {
110 @include LTR {
111 border-right-width: $width;
112 }
113 @include RTL {
114 border-left-width: $width;
115 }
116}
117
118@mixin clear($side) {
119 @if $side == left {
120 @include LTR {
121 clear: $side;
122 }
123 @include RTL {
124 clear: right;
125 }
126 } @else if $side == right {
127 @include LTR {
128 clear: $side;
129 }
130
131 @include RTL {
132 clear: left;
133 }
134 } @else {
135 clear: $side;
136 }
137}
138
139@mixin float($direction) {
140 @if $direction == left {
141 @include LTR {
142 float: left;
143 }
144 @include RTL {
145 float: right;
146 }
147 } @else {
148 @include LTR {
149 float: right;
150 }
151 @include RTL {
152 float: left;
153 }
154 }
155}
156
157@mixin left($distance) {
158 @include LTR {
159 left: $distance;
160 }
161 @include RTL {
162 right: $distance;
163 }
164}
165
166@mixin margin($top, $right, $bottom, $left) {
167 margin: $top $right $bottom $left;
168 @include RTL {
169 margin: $top $left $bottom $right;
170 }
171}
172
173@mixin margin-left($distance) {
174 @include LTR {
175 margin-left: $distance;
176 }
177 @include RTL {
178 margin-right: $distance;
179 }
180}
181
182@mixin margin-right($distance) {
183 @include LTR {
184 margin-right: $distance;
185 }
186 @include RTL {
187 margin-left: $distance;
188 }
189}
190
191@mixin padding($top, $right, $bottom, $left) {
192 padding: $top $right $bottom $left;
193 @include RTL {
194 padding: $top $left $bottom $right;
195 }
196}
197
198@mixin padding-left($distance) {
199 @include LTR {
200 padding-left: $distance;
201 }
202 @include RTL {
203 padding-right: $distance;
204 }
205}
206
207@mixin padding-right($distance) {
208 @include LTR {
209 padding-right: $distance;
210 }
211 @include RTL {
212 padding-left: $distance;
213 }
214}
215
216@mixin right($distance) {
217 @include LTR {
218 right: $distance;
219 }
220 @include RTL {
221 left: $distance;
222 }
223}
224
225@mixin text-align($direction) {
226 @if $direction == left {
227 @include LTR {
228 text-align: left;
229 }
230 @include RTL {
231 text-align: right;
232 }
233 } @else {
234 @include LTR {
235 text-align: right;
236 }
237 @include RTL {
238 text-align: left;
239 }
240 }
241}
242
243@mixin box-shadow($left, $etc) {
244 @include LTR {
245 box-shadow: $left $etc;
246 }
247
248 @include RTL {
249 box-shadow: -$left $etc;
250 }
251}
252
253@mixin transform-scaleX($scaleX: 1) {
254 @include LTR {
255 transform: scaleX($scaleX);
256 }
257 @include RTL {
258 transform: scaleX(-$scaleX);
259 }
260}
261
262@mixin transform-translateX($distance) {
263 @include LTR {
264 transform: translateX($distance);
265 }
266 @include RTL {
267 transform: translateX(-$distance);
268 }
269}
270
271// only supported when ONLY left/right are declared
272@mixin transition-property($direction) {
273 @if $direction == left {
274 @include LTR {
275 transition-property: left;
276 }
277 @include RTL {
278 transition-property: right;
279 }
280 } @else {
281 @include LTR {
282 transition-property: right;
283 }
284 @include RTL {
285 transition-property: left;
286 }
287 }
288}
289
290// Disables high contrast color adjusts for Edge/IE11
291@mixin highContrastAdjust {
292 @media screen and (-ms-high-contrast: active), screen and (-ms-high-contrast: black-on-white) {
293 -ms-high-contrast-adjust: none;
294 }
295}
\No newline at end of file