-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Expand file tree
/
Copy pathtoggle.ionic.scss
More file actions
161 lines (126 loc) · 4.19 KB
/
toggle.ionic.scss
File metadata and controls
161 lines (126 loc) · 4.19 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
@use "../../themes/ionic/ionic.globals.scss" as globals;
@use "./toggle.common";
// Ionic Toggle
// -----------------------------------------
:host {
--track-background: #{globals.$ion-primitives-neutral-500};
--track-background-checked: #{globals.ion-color(primary, base)};
--border-radius: #{globals.$ion-border-radius-full};
--focus-ring-color: #{globals.$ion-border-focus-default};
--focus-ring-width: #{globals.$ion-border-size-050};
--handle-background: #{globals.$ion-primitives-base-white};
--handle-background-checked: #{globals.$ion-primitives-base-white};
--handle-border-radius: #{globals.$ion-border-radius-full};
--handle-height: #{globals.$ion-scale-500};
--handle-max-height: #{globals.$ion-scale-500};
--handle-width: #{globals.$ion-scale-500};
--handle-spacing: #{globals.$ion-space-050};
--handle-transition: transform 300ms, width 120ms ease-in-out 80ms, left 110ms ease-in-out 80ms,
right 110ms ease-in-out 80ms;
@include globals.typography(globals.$ion-body-md-regular);
width: 100%;
z-index: 2; // TODO(ROU-10853): replace this value with a layer token.
}
// Toggle Wrapper
// --------------------------------------------------
.toggle-wrapper {
align-items: center;
min-height: globals.$ion-scale-1200;
}
// Toggle Native Wrapper
// ----------------------------------------------------------------
.native-wrapper .toggle-icon {
width: globals.$ion-scale-1100;
height: globals.$ion-scale-600;
/**
* The handle box shadow should not
* overflow outside of the track container.
*/
overflow: hidden;
}
:host(.ion-color.toggle-checked) .toggle-icon {
background: globals.current-color(base);
}
// Toggle Bottom Content
// ----------------------------------------------------------------
.toggle-bottom {
@include globals.typography(globals.$ion-body-md-regular);
}
// Toggle Hint Text
// ----------------------------------------------------------------
.toggle-bottom .error-text {
color: globals.$ion-semantics-danger-900;
}
.toggle-bottom .helper-text {
color: globals.$ion-primitives-neutral-900;
}
// Toggle Native Wrapper: Focused
// ----------------------------------------------------------------
:host(.ion-focused) .toggle-icon {
outline: var(--focus-ring-width) globals.$ion-border-style-solid var(--focus-ring-color);
outline-offset: var(--focus-ring-width);
}
:host(.ion-focused) {
outline: none;
}
// Toggle Native Wrapper: Pressed
// ----------------------------------------------------------------
:host(.ion-activated) .toggle-icon {
background: globals.$ion-bg-neutral-base-press;
}
:host(.ion-activated.toggle-checked) .toggle-icon {
background: globals.$ion-bg-primary-base-press;
}
// Ionic Toggle: Disabled
// ----------------------------------------------------------
:host(.toggle-disabled) .toggle-icon::after {
@include globals.disabled-state();
}
// Ionic Toggle Inner Knob: Unchecked
// ----------------------------------------------------------
.toggle-inner {
will-change: background-color, transform;
display: flex;
align-items: center;
justify-content: center;
color: globals.$ion-primitives-neutral-1200;
}
.toggle-inner .toggle-switch-icon {
width: globals.$ion-scale-400;
height: globals.$ion-scale-400;
}
// Toggle Label Placement - Start/Default
// ----------------------------------------------------------------
/**
* Label is on the left of the input in LTR and
* on the right in RTL.
*/
:host .toggle-wrapper {
justify-content: space-between;
}
:host .label-text-wrapper {
/**
* The margin between the label and
* the input should be on the end
* when the label sits at the start.
*/
@include globals.margin(null, globals.$ion-space-400, null, 0);
color: globals.$ion-primitives-neutral-1200;
}
// Toggle Label Placement - End
// ----------------------------------------------------------------
/**
* Label is on the right of the input in LTR and
* on the left in RTL.
*/
:host(.toggle-label-placement-end) .toggle-wrapper {
justify-content: start;
}
/**
* The margin between the label and
* the input should be on the start
* when the label sits at the end.
*/
:host(.toggle-label-placement-end) .label-text-wrapper {
@include globals.margin(null, 0, null, globals.$ion-space-400);
}