@clayui/css 3.40.1 → 3.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,386 +1,71 @@
1
- // Simple Toggle Switch
2
-
3
- .simple-toggle-switch {
4
- &.toggle-switch {
5
- align-items: center;
6
- display: inline-flex;
7
- }
8
-
9
- .toggle-switch-check + .toggle-switch-label {
10
- margin-right: $simple-toggle-switch-label-spacer-x;
11
- }
12
-
13
- .toggle-switch-label + .toggle-switch-check-bar {
14
- margin-left: $simple-toggle-switch-label-spacer-x;
15
- }
16
-
17
- .toggle-switch-label {
18
- line-height: $simple-toggle-switch-label-line-height;
19
- margin-bottom: 0;
20
- max-width: calc(
21
- 100% - #{clay-data-label-text-position(
22
- $toggle-switch-bar-width,
23
- $toggle-switch-bar-padding
24
- )}
25
- );
26
-
27
- @include clay-scale-component {
28
- max-width: calc(
29
- 100% - #{clay-data-label-text-position(
30
- $toggle-switch-bar-width-mobile,
31
- $toggle-switch-bar-padding-mobile
32
- )}
33
- );
34
- }
35
- }
36
- }
37
-
38
- .simple-toggle-switch-reverse {
39
- .toggle-switch-label {
40
- margin-right: $simple-toggle-switch-label-spacer-x;
41
- }
42
-
43
- .toggle-switch-check-bar {
44
- order: 5;
45
-
46
- .toggle-switch-bar {
47
- order: 0;
48
- }
49
- }
50
-
51
- .toggle-switch-bar {
52
- order: 5;
53
- }
54
- }
55
-
56
1
  // Toggle Switch
57
2
 
58
- label.toggle-switch {
59
- cursor: $toggle-switch-cursor;
60
-
61
- &.disabled {
62
- cursor: $toggle-switch-disabled-cursor;
63
- }
64
- }
65
-
66
3
  .toggle-switch {
67
- display: inline-block;
68
- font-weight: $toggle-switch-font-weight;
69
- max-width: 100%;
70
- position: relative;
71
-
72
- &.disabled {
73
- .toggle-switch-label {
74
- color: $toggle-switch-label-disabled-color;
75
- cursor: $toggle-switch-disabled-cursor;
76
- }
77
-
78
- .toggle-switch-text {
79
- color: $toggle-switch-text-disabled-color;
80
- }
81
- }
4
+ @include clay-toggle-switch-variant($toggle-switch);
82
5
  }
83
6
 
84
7
  .toggle-switch-check-bar {
85
- display: inline-flex;
86
- position: relative;
8
+ @include clay-css($toggle-switch-check-bar);
87
9
  }
88
10
 
89
11
  .toggle-switch-bar {
90
- .toggle-switch-handle {
91
- display: block;
92
- min-width: $toggle-switch-bar-width;
93
- text-transform: uppercase;
94
- }
95
-
96
- .toggle-switch-icon {
97
- font-size: $toggle-switch-bar-font-size;
98
-
99
- .lexicon-icon {
100
- margin-top: -0.2em;
101
- }
102
- }
103
-
104
- .button-icon {
105
- font-size: $toggle-switch-button-font-size;
106
- }
12
+ @include clay-toggle-switch-bar-variant($toggle-switch-bar);
107
13
  }
108
14
 
109
15
  .toggle-switch-check {
110
- bottom: 0;
111
- font-size: 62.5%;
112
- height: $toggle-switch-bar-height;
113
- opacity: 0;
114
- position: absolute;
115
- width: $toggle-switch-bar-width;
116
- z-index: 2;
117
-
118
- @include clay-scale-component {
119
- height: $toggle-switch-bar-height-mobile;
120
- width: $toggle-switch-bar-width-mobile;
121
- }
122
-
123
- &:empty ~ .toggle-switch-bar {
124
- display: inline-flex;
125
- font-size: $toggle-switch-bar-font-size;
126
- height: $toggle-switch-bar-height;
127
- line-height: $toggle-switch-bar-height;
128
- position: relative;
129
- text-indent: 0;
130
-
131
- -ms-user-select: none;
132
- user-select: none;
133
-
134
- &:after {
135
- background-color: $toggle-switch-button-bg;
136
- border-color: $toggle-switch-button-border-color;
137
-
138
- @include border-radius($toggle-switch-button-border-radius);
139
-
140
- border-style: solid;
141
- border-width: $toggle-switch-button-border-width;
142
- bottom: $toggle-switch-bar-padding;
143
- content: '';
144
- display: block;
145
- height: $toggle-switch-button-width;
146
- left: $toggle-switch-bar-padding;
147
- position: absolute;
148
- top: $toggle-switch-bar-padding;
149
- transition: $toggle-switch-transition;
150
- width: $toggle-switch-button-width;
151
- }
152
-
153
- &:before {
154
- background-color: $toggle-switch-bar-bg;
155
- border-color: $toggle-switch-bar-border-color;
156
-
157
- @include border-radius($toggle-switch-bar-border-radius);
158
-
159
- border-style: solid;
160
- border-width: $toggle-switch-bar-border-width;
161
- bottom: 0;
162
- content: ' ';
163
- display: block;
164
- left: 0;
165
- position: absolute;
166
- top: 0;
167
- transition: $toggle-switch-transition;
168
- width: $toggle-switch-bar-width;
169
- }
170
-
171
- .toggle-switch-handle {
172
- &:after {
173
- content: attr(data-label-off);
174
- margin-left: clay-data-label-text-position(
175
- $toggle-switch-bar-width,
176
- $toggle-switch-bar-padding
177
- );
178
- transition: $toggle-switch-transition;
179
- white-space: nowrap;
180
- }
181
-
182
- &:before {
183
- transition: $toggle-switch-transition;
184
- }
185
- }
186
-
187
- .toggle-switch-icon {
188
- color: $toggle-switch-bar-icon-color;
189
- left: $toggle-switch-bar-padding;
190
- line-height: $toggle-switch-button-width;
191
- position: absolute;
192
- text-align: center;
193
- text-indent: 0;
194
- top: $toggle-switch-bar-padding;
195
- transition: $toggle-switch-transition;
196
- width: $toggle-switch-button-width;
197
- z-index: 1;
198
- }
199
-
200
- .toggle-switch-icon-on {
201
- left: $toggle-switch-bar-padding;
202
- opacity: 0;
203
- }
204
-
205
- .toggle-switch-icon-off {
206
- left: $toggle-switch-bar-width - $toggle-switch-bar-padding -
207
- $toggle-switch-button-width;
208
- }
209
-
210
- .button-icon {
211
- color: $toggle-switch-button-icon-color;
212
- }
213
-
214
- .button-icon-on {
215
- opacity: 0;
216
- }
217
- }
218
-
219
- &:checked ~ .toggle-switch-bar {
220
- &:after {
221
- background-color: $toggle-switch-button-on-bg;
222
- border-color: $toggle-switch-button-on-border-color;
223
-
224
- @include border-radius($toggle-switch-button-on-border-radius);
225
-
226
- border-style: solid;
227
- border-width: $toggle-switch-button-border-width;
228
- left: $toggle-switch-bar-width - $toggle-switch-bar-padding -
229
- $toggle-switch-button-width;
230
- }
231
-
232
- &:before {
233
- background-color: $toggle-switch-bar-on-bg;
234
- border-color: $toggle-switch-bar-on-border-color;
235
-
236
- @include border-radius($toggle-switch-bar-border-radius);
237
-
238
- border-style: solid;
239
- border-width: $toggle-switch-bar-border-width;
240
- }
241
-
242
- .toggle-switch-handle:after {
243
- content: attr(data-label-on);
244
- }
245
-
246
- .toggle-switch-icon {
247
- color: $toggle-switch-bar-on-icon-color;
248
- }
249
-
250
- .button-icon {
251
- color: $toggle-switch-button-on-icon-color;
252
- left: $toggle-switch-bar-width - $toggle-switch-bar-padding -
253
- $toggle-switch-button-width;
254
- }
255
-
256
- .button-icon-on,
257
- .toggle-switch-icon-on {
258
- opacity: 1;
259
- }
260
-
261
- .button-icon-off,
262
- .toggle-switch-icon-off {
263
- opacity: 0;
264
- }
265
- }
266
-
267
- &:disabled,
268
- &.disabled {
269
- ~ .toggle-switch-bar {
270
- cursor: $toggle-switch-disabled-cursor;
271
- opacity: $toggle-switch-disabled-opacity;
272
- }
273
- }
274
-
275
- &:focus ~ .toggle-switch-bar:before {
276
- box-shadow: $toggle-switch-bar-focus-box-shadow;
277
- }
16
+ @include clay-toggle-switch-check-variant($toggle-switch-check);
278
17
  }
279
18
 
280
19
  .toggle-switch-label {
281
- display: block;
282
- margin-bottom: 2px;
20
+ @include clay-css($toggle-switch-label);
283
21
  }
284
22
 
285
23
  .toggle-switch-text {
286
- display: block;
287
- font-size: $toggle-switch-text-font-size;
24
+ @include clay-css($toggle-switch-text);
288
25
  }
289
26
 
290
27
  .toggle-switch-text-left {
291
- display: inline-flex;
292
- line-height: $toggle-switch-bar-height;
293
- margin-right: 8px;
294
- }
295
-
296
- .toggle-switch-text-right {
297
- display: inline-flex;
298
- line-height: $toggle-switch-bar-height;
299
- margin-left: 8px;
300
- }
28
+ $breakpoint-down: setter(
29
+ map-get($toggle-switch-text-left, breakpoint-down),
30
+ sm
31
+ );
301
32
 
302
- @include clay-scale-component {
303
- .toggle-switch-bar {
304
- .toggle-switch-handle {
305
- min-width: $toggle-switch-bar-width-mobile;
306
- }
33
+ @include clay-css($toggle-switch-text-left);
307
34
 
308
- .toggle-switch-icon {
309
- font-size: $toggle-switch-bar-font-size-mobile;
310
- }
311
-
312
- .button-icon {
313
- font-size: $toggle-switch-button-font-size-mobile;
314
- }
35
+ @include media-breakpoint-down($breakpoint-down) {
36
+ @include clay-css(map-get($toggle-switch-text-left, mobile));
315
37
  }
38
+ }
316
39
 
317
- .toggle-switch-check {
318
- &:empty ~ .toggle-switch-bar {
319
- height: $toggle-switch-bar-height-mobile;
320
- line-height: $toggle-switch-bar-height-mobile;
321
- text-indent: 0;
322
-
323
- &:after {
324
- bottom: $toggle-switch-bar-padding-mobile;
325
- height: $toggle-switch-button-width-mobile;
326
- left: $toggle-switch-bar-padding-mobile;
327
- top: $toggle-switch-bar-padding-mobile;
328
- width: $toggle-switch-button-width-mobile;
329
- }
330
-
331
- &:before {
332
- width: $toggle-switch-bar-width-mobile;
333
- }
334
-
335
- .toggle-switch-handle:after {
336
- margin-left: clay-data-label-text-position(
337
- $toggle-switch-bar-width-mobile,
338
- $toggle-switch-bar-padding-mobile
339
- );
340
- }
40
+ .toggle-switch-text-right {
41
+ $breakpoint-down: setter(
42
+ map-get($toggle-switch-text-right, breakpoint-down),
43
+ sm
44
+ );
341
45
 
342
- .toggle-switch-icon {
343
- left: $toggle-switch-bar-padding-mobile;
344
- line-height: $toggle-switch-button-width-mobile;
345
- top: $toggle-switch-bar-padding-mobile;
346
- width: $toggle-switch-button-width-mobile;
347
- }
46
+ @include clay-css($toggle-switch-text-right);
348
47
 
349
- .toggle-switch-icon-on {
350
- left: $toggle-switch-bar-padding-mobile;
351
- }
48
+ @include media-breakpoint-down($breakpoint-down) {
49
+ @include clay-css(map-get($toggle-switch-text-right, mobile));
50
+ }
51
+ }
352
52
 
353
- .toggle-switch-icon-off {
354
- left: $toggle-switch-bar-width-mobile -
355
- $toggle-switch-bar-padding-mobile -
356
- $toggle-switch-button-width-mobile;
357
- }
358
- }
53
+ // Simple Toggle Switch
359
54
 
360
- &:checked ~ .toggle-switch-bar {
361
- &:after {
362
- left: $toggle-switch-bar-width-mobile -
363
- $toggle-switch-bar-padding-mobile -
364
- $toggle-switch-button-width-mobile;
365
- }
55
+ .simple-toggle-switch {
56
+ @include clay-toggle-switch-variant($simple-toggle-switch);
366
57
 
367
- .toggle-switch-handle:after {
368
- margin-left: clay-data-label-text-position(
369
- $toggle-switch-bar-width-mobile,
370
- $toggle-switch-bar-padding-mobile
371
- );
372
- }
58
+ // deprecated
373
59
 
374
- .button-icon {
375
- left: $toggle-switch-bar-width-mobile -
376
- $toggle-switch-bar-padding-mobile -
377
- $toggle-switch-button-width-mobile;
378
- }
379
- }
60
+ .toggle-switch-check + .toggle-switch-label {
61
+ margin-right: $simple-toggle-switch-label-spacer-x;
380
62
  }
381
63
 
382
- .toggle-switch-text-left,
383
- .toggle-switch-text-right {
384
- line-height: $toggle-switch-bar-height-mobile;
64
+ .toggle-switch-label + .toggle-switch-check-bar {
65
+ margin-left: $simple-toggle-switch-label-spacer-x;
385
66
  }
386
67
  }
68
+
69
+ .simple-toggle-switch-reverse {
70
+ @include clay-toggle-switch-variant($simple-toggle-switch-reverse);
71
+ }
@@ -8,6 +8,24 @@
8
8
  @import '_lx-icons-generated.scss';
9
9
  @import '_type-conversion-functions.scss';
10
10
 
11
+ /// A helper function that calculates text-indent of data-label-on and data-label-off in a `.toggle-switch`.
12
+ /// @param {Number} $toggle-switch-width - Width of switch bar
13
+ /// @param {Number} $toggle-switch-padding - Space between button and bar
14
+ /// @param {Number} $label-spacer-x[8px] - Space between toggle-switch-bar and data-label
15
+
16
+ @function clay-data-label-text-position(
17
+ $toggle-switch-width,
18
+ $toggle-switch-padding,
19
+ $label-spacer-x: 8px
20
+ ) {
21
+ @if ($toggle-switch-padding < 0) {
22
+ $toggle-switch-width: $toggle-switch-width +
23
+ abs($toggle-switch-padding);
24
+ }
25
+
26
+ @return $toggle-switch-width + $label-spacer-x;
27
+ }
28
+
11
29
  /// A function that returns a new map with all the keys and values including nested keys and values from both `$map1` and `$map2`. If both `$map1` and `$map2` have the same key, `$map2`’s value takes precedence.
12
30
  /// @param {Map, Null} $map1[()]
13
31
  /// @param {Map, Null} $map2[()]