UNPKG

6.97 kBSCSSView Raw
1@import "../../themes/ionic.globals.wp";
2
3// Windows Toggle
4// --------------------------------------------------
5
6/// @prop - Color of the toggle
7$toggle-wp-inactive-color: #323232 !default;
8
9/// @prop - Color of the checked toggle
10$toggle-wp-active-color: color($colors-wp, primary) !default;
11
12/// @prop - Width of the toggle track
13$toggle-wp-track-width: 40px !default;
14
15/// @prop - Height of the toggle track
16$toggle-wp-track-height: 18px !default;
17
18/// @prop - Background color of the toggle track
19$toggle-wp-track-background-color-off: transparent !default;
20
21/// @prop - Background color of the checked toggle track
22$toggle-wp-track-background-color-on: $toggle-wp-active-color !default;
23
24/// @prop - Border width of the toggle track
25$toggle-wp-track-border-width: 2px !default;
26
27/// @prop - Border color of the toggle track
28$toggle-wp-track-border-color-off: $toggle-wp-inactive-color !default;
29
30/// @prop - Border color of the checked toggle track
31$toggle-wp-track-border-color-on: $toggle-wp-active-color !default;
32
33/// @prop - Width of the toggle handle
34$toggle-wp-handle-width: 10px !default;
35
36/// @prop - Height of the toggle handle
37$toggle-wp-handle-height: 10px !default;
38
39/// @prop - Top of the toggle handle
40$toggle-wp-handle-top: 2px !default;
41
42/// @prop - Left of the toggle handle
43$toggle-wp-handle-left: 2px !default;
44
45/// @prop - Border radius of the toggle handle
46$toggle-wp-handle-border-radius: 50% !default;
47
48/// @prop - Background color of the toggle handle
49$toggle-wp-handle-background-color-off: $toggle-wp-inactive-color !default;
50
51/// @prop - Background color of the checked toggle handle
52$toggle-wp-handle-background-color-on: color-contrast($colors-wp, $toggle-wp-active-color) !default;
53
54/// @prop - Margin of the toggle
55$toggle-wp-media-margin: 0 !default;
56
57/// @prop - Transition duration of the toggle icon
58$toggle-wp-transition-duration: 300ms !default;
59
60/// @prop - Opacity of the disabled toggle
61$toggle-wp-disabled-opacity: .3 !default;
62
63// deprecated
64$toggle-wp-item-left-padding: null !default;
65
66/// @prop - Padding top of the toggle positioned on the start in an item
67$toggle-wp-item-start-padding-top: 12px !default;
68
69/// @prop - Padding end of the toggle positioned on the start in an item
70$toggle-wp-item-start-padding-end: 18px !default;
71
72/// @prop - Padding bottom of the toggle positioned on the start in an item
73$toggle-wp-item-start-padding-bottom: 12px !default;
74
75/// @prop - Padding start the toggle positioned on the start in an item
76$toggle-wp-item-start-padding-start: 2px !default;
77
78// deprecated
79$toggle-wp-item-right-padding: null !default;
80
81/// @prop - Padding top of the toggle positioned on the end in an item
82$toggle-wp-item-end-padding-top: 12px !default;
83
84/// @prop - Padding end of the toggle positioned on the end in an item
85$toggle-wp-item-end-padding-end: ($item-wp-padding-end / 2) !default;
86
87/// @prop - Padding bottom of the toggle positioned on the end in an item
88$toggle-wp-item-end-padding-bottom: 12px !default;
89
90/// @prop - Padding start of the toggle positioned on the end in an item
91$toggle-wp-item-end-padding-start: $item-wp-padding-start !default;
92
93// Windows Toggle
94// -----------------------------------------
95
96.toggle-wp {
97 position: relative;
98 display: block;
99
100 width: $toggle-wp-track-width;
101 height: $toggle-wp-track-height;
102
103 box-sizing: content-box;
104
105 contain: strict;
106}
107
108
109// Windows Toggle Background Track: Unchecked
110// -----------------------------------------
111
112.toggle-wp .toggle-icon {
113 @include border-radius($toggle-wp-track-height);
114
115 position: relative;
116 display: block;
117
118 width: 100%;
119 height: 100%;
120
121 border: $toggle-wp-track-border-width solid $toggle-wp-track-border-color-off;
122 background-color: $toggle-wp-track-background-color-off;
123
124 pointer-events: none;
125
126 contain: strict;
127}
128
129
130// Windows Toggle Inner Knob: Unchecked
131// -----------------------------------------
132
133.toggle-wp .toggle-inner {
134 @include position($toggle-wp-handle-top, null, null, $toggle-wp-handle-left);
135 @include border-radius($toggle-wp-handle-border-radius);
136
137 position: absolute;
138
139 width: $toggle-wp-handle-width;
140 height: $toggle-wp-handle-height;
141
142 background-color: $toggle-wp-handle-background-color-off;
143
144 transition-duration: $toggle-wp-transition-duration;
145 transition-property: transform, background-color;
146
147 will-change: transform, background-color;
148}
149
150
151// Windows Toggle Background Track: Checked
152// -----------------------------------------
153
154.toggle-wp.toggle-checked .toggle-icon {
155 border-color: $toggle-wp-track-background-color-on;
156 background-color: $toggle-wp-track-background-color-on;
157}
158
159
160// Windows Toggle Inner Knob: Checked
161// -----------------------------------------
162
163.toggle-wp.toggle-checked .toggle-inner {
164 @include transform(translate3d($toggle-wp-track-width - $toggle-wp-handle-width - ($toggle-wp-track-border-width * 2) - ($toggle-wp-handle-left * 2), 0, 0));
165
166 background-color: $toggle-wp-handle-background-color-on;
167}
168
169
170// Windows Toggle: Disabled
171// -----------------------------------------
172
173.toggle-wp.toggle-disabled,
174.item-wp.item-toggle-disabled ion-label {
175 opacity: $toggle-wp-disabled-opacity;
176
177 pointer-events: none;
178}
179
180.toggle-wp.toggle-disabled ion-radio {
181 opacity: $toggle-wp-disabled-opacity;
182}
183
184
185// Windows Toggle Within An Item
186// -----------------------------------------
187
188.item-wp .toggle-wp {
189 @include margin($toggle-wp-media-margin);
190
191 cursor: pointer;
192
193 @include deprecated-variable(padding, $toggle-wp-item-right-padding) {
194 @include padding($toggle-wp-item-end-padding-top, $toggle-wp-item-end-padding-end, $toggle-wp-item-end-padding-bottom, $toggle-wp-item-end-padding-start);
195 }
196}
197
198.item-wp .toggle-wp[item-left], // deprecated
199.item-wp .toggle-wp[item-start] {
200 @include deprecated-variable(padding, $toggle-wp-item-left-padding) {
201 @include padding($toggle-wp-item-start-padding-top, $toggle-wp-item-start-padding-end, $toggle-wp-item-start-padding-bottom, $toggle-wp-item-start-padding-start);
202 }
203}
204
205.item-wp.item-toggle ion-label {
206 @include margin-horizontal(0, null);
207}
208
209
210// Windows Color Mixin
211// --------------------------------------------------
212
213@mixin toggle-theme-wp($color-name, $color-base, $color-contrast) {
214
215 .toggle-wp-#{$color-name}.toggle-checked .toggle-icon {
216 border-color: $color-base;
217 background-color: $color-base;
218 }
219
220 .toggle-wp-#{$color-name}.toggle-checked .toggle-inner {
221 background-color: $color-contrast;
222 }
223}
224
225
226// Generate Windows Toggle Auxiliary Colors
227// --------------------------------------------------
228
229@each $color-name, $color-base, $color-contrast in get-colors($colors-wp) {
230
231 @include toggle-theme-wp($color-name, $color-base, $color-contrast);
232
233}