forked from ionic-team/ionic-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoggle.ios.scss
More file actions
252 lines (165 loc) 路 7.39 KB
/
Copy pathtoggle.ios.scss
File metadata and controls
252 lines (165 loc) 路 7.39 KB
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
@import "../../themes/ionic.globals.ios";
// iOS Toggle
// --------------------------------------------------
/// @prop - Width of the toggle
$toggle-ios-width: 51px !default;
/// @prop - Height of the toggle
$toggle-ios-height: 32px !default;
/// @prop - Border width of the toggle
$toggle-ios-border-width: 2px !default;
/// @prop - Border radius of the toggle
$toggle-ios-border-radius: $toggle-ios-height / 2 !default;
/// @prop - Background color of the unchecked toggle
$toggle-ios-background-color-off: $list-ios-background-color !default;
/// @prop - Border color of the unchecked toggle
$toggle-ios-border-color-off: grayscale(lighten($list-ios-border-color, 11%)) !default;
/// @prop - Background color of the checked toggle
$toggle-ios-background-color-on: color($colors-ios, primary) !default;
/// @prop - Width of the toggle handle
$toggle-ios-handle-width: $toggle-ios-height - ($toggle-ios-border-width * 2) !default;
/// @prop - Height of the toggle handle
$toggle-ios-handle-height: $toggle-ios-handle-width !default;
/// @prop - Border radius of the toggle handle
$toggle-ios-handle-border-radius: $toggle-ios-handle-height / 2 !default;
/// @prop - Box shadow of the toggle handle
$toggle-ios-handle-box-shadow: 0 3px 12px rgba(0, 0, 0, .16), 0 3px 1px rgba(0, 0, 0, .1) !default;
/// @prop - Background color of the toggle handle
$toggle-ios-handle-background-color: $toggle-ios-background-color-off !default;
/// @prop - Margin of the toggle handle
$toggle-ios-media-margin: 0 !default;
/// @prop - Transition duration of the toggle icon
$toggle-ios-transition-duration: 300ms !default;
/// @prop - Opacity of the disabled toggle
$toggle-ios-disabled-opacity: .3 !default;
// deprecated
$toggle-ios-item-left-padding: null !default;
/// @prop - Padding top of the toggle positioned on the start in an item
$toggle-ios-item-start-padding-top: 6px !default;
/// @prop - Padding end of the toggle positioned on the start in an item
$toggle-ios-item-start-padding-end: 16px !default;
/// @prop - Padding bottom of the toggle positioned on the start in an item
$toggle-ios-item-start-padding-bottom: 5px !default;
/// @prop - Padding start of the toggle positioned on the start in an item
$toggle-ios-item-start-padding-start: 0 !default;
// deprecated
$toggle-ios-item-right-padding: null !default;
/// @prop - Padding top of the toggle positioned on the end in an item
$toggle-ios-item-end-padding-top: 6px !default;
/// @prop - Padding end of the toggle positioned on the end in an item
$toggle-ios-item-end-padding-end: ($item-ios-padding-end / 2) !default;
/// @prop - Padding bottom of the toggle positioned on the end in an item
$toggle-ios-item-end-padding-bottom: 5px !default;
/// @prop - Padding start of the toggle positioned on the end in an item
$toggle-ios-item-end-padding-start: $item-ios-padding-start !default;
// iOS Toggle
// -----------------------------------------
.toggle-ios {
position: relative;
width: $toggle-ios-width;
height: $toggle-ios-height;
box-sizing: content-box;
contain: strict;
}
// iOS Toggle Background Track: Unchecked
// -----------------------------------------
.toggle-ios .toggle-icon {
@include border-radius($toggle-ios-border-radius);
position: relative;
display: block;
width: 100%;
height: 100%;
background-color: $toggle-ios-border-color-off;
transition: background-color $toggle-ios-transition-duration;
pointer-events: none;
}
// iOS Toggle Background Oval: Unchecked
// -----------------------------------------
.toggle-ios .toggle-icon::before {
@include position($toggle-ios-border-width, $toggle-ios-border-width, $toggle-ios-border-width, $toggle-ios-border-width);
@include border-radius($toggle-ios-border-radius);
position: absolute;
background-color: $toggle-ios-background-color-off;
content: "";
transform: scale3d(1, 1, 1);
transition: transform $toggle-ios-transition-duration;
}
// iOS Toggle Inner Knob: Unchecked
// -----------------------------------------
.toggle-ios .toggle-inner {
@include position($toggle-ios-border-width, null, null, $toggle-ios-border-width);
@include border-radius($toggle-ios-handle-border-radius);
position: absolute;
width: $toggle-ios-handle-width;
height: $toggle-ios-handle-height;
background-color: $toggle-ios-handle-background-color;
box-shadow: $toggle-ios-handle-box-shadow;
transition: transform $toggle-ios-transition-duration, width 120ms ease-in-out 80ms, left 110ms ease-in-out 80ms, right 110ms ease-in-out 80ms;
will-change: transform;
contain: strict;
}
// iOS Toggle Background Track: Checked
// -----------------------------------------
.toggle-ios.toggle-checked .toggle-icon {
background-color: $toggle-ios-background-color-on;
}
// iOS Toggle Background Oval: Activated or Checked
// -----------------------------------------
.toggle-ios.toggle-activated .toggle-icon::before,
.toggle-ios.toggle-checked .toggle-icon::before {
transform: scale3d(0, 0, 0);
}
// iOS Toggle Inner Knob: Checked
// -----------------------------------------
.toggle-ios.toggle-checked .toggle-inner {
@include transform(translate3d($toggle-ios-width - $toggle-ios-handle-width - ($toggle-ios-border-width * 2), 0, 0));
}
// iOS Toggle Background Oval: Activated and Checked
// -----------------------------------------
.toggle-ios.toggle-activated.toggle-checked .toggle-inner::before {
transform: scale3d(0, 0, 0);
}
// iOS Toggle Inner Knob: Activated and Unchecked
// -----------------------------------------
.toggle-ios.toggle-activated .toggle-inner {
width: $toggle-ios-handle-width + 6;
}
// iOS Toggle Inner Knob: Activated and Checked
// -----------------------------------------
.toggle-ios.toggle-activated.toggle-checked .toggle-inner {
// when pressing down on the toggle and IS checked
// make the knob wider and move it left a bit
@include position-horizontal($toggle-ios-border-width - 6, null);
}
// iOS Toggle: Disabled
// -----------------------------------------
.toggle-ios.toggle-disabled,
.item-ios.item-toggle-disabled ion-label {
opacity: $toggle-ios-disabled-opacity;
pointer-events: none;
}
// iOS Toggle Within An Item
// -----------------------------------------
.item-ios .toggle-ios {
@include margin($toggle-ios-media-margin);
@include deprecated-variable(padding, $toggle-ios-item-right-padding) {
@include padding($toggle-ios-item-end-padding-top, $toggle-ios-item-end-padding-end, $toggle-ios-item-end-padding-bottom, $toggle-ios-item-end-padding-start);
}
}
.item-ios .toggle-ios[item-left], // deprecated
.item-ios .toggle-ios[item-start] {
@include deprecated-variable(padding, $toggle-ios-item-left-padding) {
@include padding($toggle-ios-item-start-padding-top, $toggle-ios-item-start-padding-end, $toggle-ios-item-start-padding-bottom, $toggle-ios-item-start-padding-start);
}
}
// iOS Toggle Color Mixin
// --------------------------------------------------
@mixin ios-toggle-theme($color-name, $color-base) {
.toggle-ios-#{$color-name}.toggle-checked .toggle-icon {
background-color: $color-base;
}
}
// Generate iOS Toggle Colors
// --------------------------------------------------
@each $color-name, $color-base, $color-contrast in get-colors($colors-ios) {
@include ios-toggle-theme($color-name, $color-base);
}