-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Expand file tree
/
Copy pathrange.ionic.scss
More file actions
224 lines (175 loc) · 6.06 KB
/
range.ionic.scss
File metadata and controls
224 lines (175 loc) · 6.06 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
@use "../../themes/ionic/ionic.globals.scss" as globals;
@import "./range.common";
// Ionic Range
// --------------------------------------------------
:host {
--knob-border-radius: #{globals.$ion-border-radius-full};
--knob-background: #{globals.$ion-bg-input-default};
--knob-box-shadow: none;
--knob-size: #{globals.$ion-scale-600};
--knob-handle-size: #{globals.$ion-scale-1100};
--bar-height: #{globals.$ion-scale-200};
--bar-background: #{globals.$ion-bg-neutral-subtle-default};
--bar-background-active: #{globals.ion-color(primary, base)};
--bar-border-radius: #{globals.$ion-border-radius-400};
--height: #{globals.$ion-scale-1100};
@include globals.typography(globals.$ion-body-md-regular);
z-index: globals.$ion-z-index-100;
}
:host(.range-item-start-adjustment) {
@include padding(null, null, null, globals.$ion-space-600);
}
:host(.range-item-end-adjustment) {
@include padding(null, globals.$ion-space-600, null, null);
}
:host(.ion-color) .range-bar-active,
:host(.ion-color) .range-tick-active {
background: globals.current-color(base);
}
::slotted(ion-icon[slot]) {
font-size: globals.$ion-font-size-600;
}
::slotted([slot="start"]) {
@include margin(0, globals.$ion-space-400, 0, 0);
}
::slotted([slot="end"]) {
@include margin(0, 0, 0, globals.$ion-space-400);
}
::slotted([slot="label"]) {
max-width: globals.$ion-scale-5000;
}
:host(.range-has-pin:not(.range-label-placement-stacked)) {
/**
* The pin should not overlap any elements that are
* above the range. By adding padding to the top of the
* range, it provides a buffer for the pin to move into
* when it is pressed.
*
* The padding is not included when the label is stacked
* because the pin is below the label.
* It still requires a buffer to prevent the pin from
* overlapping the range. The buffer is added to the
* bottom of the range label instead of the host.
*/
@include padding(calc(globals.$ion-space-100 + globals.$ion-scale-600), null, null, null);
}
:host(.range-has-pin.range-label-placement-stacked) .label-text-wrapper {
/**
* The pin should not overlap the stacked label. By adding
* margin to the bottom of the label, it provides a buffer
* for the pin to move into when it is pressed.
*/
@include margin(null, null, calc(globals.$ion-space-200 + globals.$ion-font-size-300), null);
}
.range-bar.range-bar-active {
bottom: 0;
width: auto;
background: var(--bar-background-active);
&.has-ticks {
@include border-radius(0);
@include margin(null, calc(-1 * globals.$ion-scale-100 * 0.5), null, calc(-1 * globals.$ion-scale-100 * 0.5));
}
}
.range-tick {
@include margin-horizontal(calc(globals.$ion-scale-100 * -0.5), null);
@include border-radius(globals.$ion-border-radius-0);
position: absolute;
top: calc((var(--height) * 0.5) - (globals.$ion-scale-300 * 0.5));
width: globals.$ion-scale-100;
height: globals.$ion-scale-300;
background: globals.$ion-primitives-neutral-100;
pointer-events: none;
}
.range-tick-active {
background: var(--bar-background-active);
}
.range-pin {
@include padding(null, null, globals.$ion-space-100, null);
min-width: globals.$ion-scale-700;
transform: translate3d(0, calc(-100%), 0);
background: transparent;
color: globals.$ion-text-default;
font-size: globals.$ion-font-size-300;
text-align: center;
}
.range-knob {
border-width: globals.$ion-border-size-025;
border-style: globals.$ion-border-style-solid;
border-color: globals.$ion-border-primary;
box-sizing: border-box;
}
// Ionic Range: Disabled (based on iOS Range)
// --------------------------------------------------
// When the range is disabled, the entire range,
// range label, any slotted labels, and any slotted
// icons need to receive the same opacity.
:host(.range-disabled) {
--bar-background: #{globals.$ion-bg-neutral-subtle-default};
.range-knob {
border-color: globals.$ion-border-input-default;
background: globals.$ion-bg-input-disabled;
}
}
// Range Label Placement - Start
// ----------------------------------------------------------------
:host(.range-label-placement-start) .label-text-wrapper {
/**
* The margin between the label and
* the range should be on the end
* when the label sits at the start.
*/
@include margin(0, globals.$ion-space-400, 0, 0);
}
// Range Label Placement - End
// ----------------------------------------------------------------
:host(.range-label-placement-end) .label-text-wrapper {
/**
* The margin between the label and
* the range should be on the start
* when the label sits at the end.
*/
@include margin(0, 0, 0, globals.$ion-space-400);
}
// Range Label Placement - Fixed
// ----------------------------------------------------------------
:host(.range-label-placement-fixed) .label-text-wrapper {
/**
* The margin between the label and
* the range should be on the end
* when the label sits at the start.
*/
@include margin(0, globals.$ion-space-400, 0, 0);
}
// Range Label Placement - Stacked
// ----------------------------------------------------------------
:host(.range-label-placement-stacked) .label-text-wrapper {
@include transform(scale(0.75));
/**
* The margin between the label and
* the range should be on the bottom
* when the label sits on top.
*/
@include margin(null, 0, globals.$ion-space-400, 0);
/**
* Label text should not extend
* beyond the bounds of the range.
*/
max-width: calc(100% / 0.75);
}
:host(.in-item.range-label-placement-stacked) .label-text-wrapper {
@include margin(globals.$ion-space-250, null, globals.$ion-space-400, null);
}
:host(.in-item.range-label-placement-stacked) .native-wrapper {
@include margin(null, null, globals.$ion-space-0, null);
}
// Range Focus
// ----------------------------------------------------------------
.range-knob-handle.ion-focused .range-knob {
@include globals.focused-state();
}
// Range Pressed
// ----------------------------------------------------------------
.range-knob-handle.ion-activated .range-knob,
.range-knob-handle.range-knob-pressed .range-knob {
background: globals.$ion-bg-input-press;
}