| 13542 |
anikendra |
1 |
|
|
|
2 |
/**
|
|
|
3 |
* Toggle
|
|
|
4 |
* --------------------------------------------------
|
|
|
5 |
*/
|
|
|
6 |
|
|
|
7 |
.item-toggle {
|
|
|
8 |
pointer-events: none;
|
|
|
9 |
}
|
|
|
10 |
|
|
|
11 |
.toggle {
|
|
|
12 |
// set the color defaults
|
|
|
13 |
@include toggle-style($toggle-on-default-border, $toggle-on-default-bg);
|
|
|
14 |
|
|
|
15 |
position: relative;
|
|
|
16 |
display: inline-block;
|
|
|
17 |
pointer-events: auto;
|
|
|
18 |
margin: -$toggle-hit-area-expansion;
|
|
|
19 |
padding: $toggle-hit-area-expansion;
|
|
|
20 |
|
|
|
21 |
&.dragging {
|
|
|
22 |
.handle {
|
|
|
23 |
background-color: $toggle-handle-dragging-bg-color !important;
|
|
|
24 |
}
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
&.toggle-light {
|
|
|
28 |
@include toggle-style($toggle-on-light-border, $toggle-on-light-bg);
|
|
|
29 |
}
|
|
|
30 |
&.toggle-stable {
|
|
|
31 |
@include toggle-style($toggle-on-stable-border, $toggle-on-stable-bg);
|
|
|
32 |
}
|
|
|
33 |
&.toggle-positive {
|
|
|
34 |
@include toggle-style($toggle-on-positive-border, $toggle-on-positive-bg);
|
|
|
35 |
}
|
|
|
36 |
&.toggle-calm {
|
|
|
37 |
@include toggle-style($toggle-on-calm-border, $toggle-on-calm-bg);
|
|
|
38 |
}
|
|
|
39 |
&.toggle-assertive {
|
|
|
40 |
@include toggle-style($toggle-on-assertive-border, $toggle-on-assertive-bg);
|
|
|
41 |
}
|
|
|
42 |
&.toggle-balanced {
|
|
|
43 |
@include toggle-style($toggle-on-balanced-border, $toggle-on-balanced-bg);
|
|
|
44 |
}
|
|
|
45 |
&.toggle-energized {
|
|
|
46 |
@include toggle-style($toggle-on-energized-border, $toggle-on-energized-bg);
|
|
|
47 |
}
|
|
|
48 |
&.toggle-royal {
|
|
|
49 |
@include toggle-style($toggle-on-royal-border, $toggle-on-royal-bg);
|
|
|
50 |
}
|
|
|
51 |
&.toggle-dark {
|
|
|
52 |
@include toggle-style($toggle-on-dark-border, $toggle-on-dark-bg);
|
|
|
53 |
}
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
.toggle input {
|
|
|
57 |
// hide the actual input checkbox
|
|
|
58 |
display: none;
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
/* the track appearance when the toggle is "off" */
|
|
|
62 |
.toggle .track {
|
|
|
63 |
@include transition-timing-function(ease-in-out);
|
|
|
64 |
@include transition-duration($toggle-transition-duration);
|
|
|
65 |
@include transition-property((background-color, border));
|
|
|
66 |
|
|
|
67 |
display: inline-block;
|
|
|
68 |
box-sizing: border-box;
|
|
|
69 |
width: $toggle-width;
|
|
|
70 |
height: $toggle-height;
|
|
|
71 |
border: solid $toggle-border-width $toggle-off-border-color;
|
|
|
72 |
border-radius: $toggle-border-radius;
|
|
|
73 |
background-color: $toggle-off-bg-color;
|
|
|
74 |
content: ' ';
|
|
|
75 |
cursor: pointer;
|
|
|
76 |
pointer-events: none;
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
/* Fix to avoid background color bleeding */
|
|
|
80 |
/* (occured on (at least) Android 4.2, Asus MeMO Pad HD7 ME173X) */
|
|
|
81 |
.platform-android4_2 .toggle .track {
|
|
|
82 |
-webkit-background-clip: padding-box;
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
/* the handle (circle) thats inside the toggle's track area */
|
|
|
86 |
/* also the handle's appearance when it is "off" */
|
|
|
87 |
.toggle .handle {
|
|
|
88 |
@include transition($toggle-transition-duration ease-in-out);
|
|
|
89 |
position: absolute;
|
|
|
90 |
display: block;
|
|
|
91 |
width: $toggle-handle-width;
|
|
|
92 |
height: $toggle-handle-height;
|
|
|
93 |
border-radius: $toggle-handle-radius;
|
|
|
94 |
background-color: $toggle-handle-off-bg-color;
|
|
|
95 |
top: $toggle-border-width + $toggle-hit-area-expansion;
|
|
|
96 |
left: $toggle-border-width + $toggle-hit-area-expansion;
|
|
|
97 |
|
|
|
98 |
&:before {
|
|
|
99 |
// used to create a larger (but hidden) hit area to slide the handle
|
|
|
100 |
position: absolute;
|
|
|
101 |
top: -4px;
|
|
|
102 |
left: ( ($toggle-handle-width / 2) * -1) - 8;
|
|
|
103 |
padding: ($toggle-handle-height / 2) + 5 ($toggle-handle-width + 7);
|
|
|
104 |
content: " ";
|
|
|
105 |
}
|
|
|
106 |
}
|
|
|
107 |
|
|
|
108 |
.toggle input:checked + .track .handle {
|
|
|
109 |
// the handle when the toggle is "on"
|
|
|
110 |
@include translate3d($toggle-width - $toggle-handle-width - ($toggle-border-width * 2), 0, 0);
|
|
|
111 |
background-color: $toggle-handle-on-bg-color;
|
|
|
112 |
}
|
|
|
113 |
|
|
|
114 |
.item-toggle.active {
|
|
|
115 |
box-shadow: none;
|
|
|
116 |
}
|
|
|
117 |
|
|
|
118 |
.item-toggle,
|
|
|
119 |
.item-toggle.item-complex .item-content {
|
|
|
120 |
// make sure list item content have enough padding on right to fit the toggle
|
|
|
121 |
padding-right: ($item-padding * 3) + $toggle-width;
|
|
|
122 |
}
|
|
|
123 |
|
|
|
124 |
.item-toggle.item-complex {
|
|
|
125 |
padding-right: 0;
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
.item-toggle .toggle {
|
|
|
129 |
// position the toggle to the right within a list item
|
|
|
130 |
position: absolute;
|
|
|
131 |
top: $item-padding / 2;
|
|
|
132 |
right: $item-padding;
|
|
|
133 |
z-index: $z-index-item-toggle;
|
|
|
134 |
}
|
|
|
135 |
|
|
|
136 |
.toggle input:disabled + .track {
|
|
|
137 |
opacity: .6;
|
|
|
138 |
}
|