-
Notifications
You must be signed in to change notification settings - Fork 13.5k
/
Copy pathselect.md.outline.scss
257 lines (218 loc) · 7.31 KB
/
select.md.outline.scss
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
253
254
255
256
257
@import "./select.vars";
// Select Fill: Outline
// ----------------------------------------------------------------
:host(.select-fill-outline) {
--border-color: #{$background-color-step-300};
--border-radius: 4px;
--padding-start: 16px;
--padding-end: 16px;
min-height: 56px;
}
:host(.select-fill-outline.select-shape-round) {
--border-radius: 28px;
--padding-start: 32px;
--padding-end: 32px;
}
/**
* If the select has a validity state, the
* border should reflect that as a color.
*/
:host(.has-focus.select-fill-outline.ion-valid),
:host(.select-fill-outline.ion-touched.ion-invalid) {
--border-color: var(--highlight-color);
}
/**
* Border should be
* slightly darker on hover.
*/
@media (any-hover: hover) {
:host(.select-fill-outline:hover) {
--border-color: #{$background-color-step-750};
}
}
/**
* The border should get thicker
* and take on component color when
* the select is focused.
*/
:host(.select-fill-outline.select-expanded),
:host(.select-fill-outline.has-focus) {
--border-width: var(--highlight-height);
--border-color: var(--highlight-color);
}
/**
* The bottom content should never have
* a border with the outline style.
*/
:host(.select-fill-outline) .select-bottom {
border-top: none;
}
/**
* Outline selects do not have a bottom border.
* Instead, they have a border that wraps the
* select + label.
*/
:host(.select-fill-outline) .select-wrapper {
border-bottom: none;
}
:host(.select-ltr.select-fill-outline.select-label-placement-stacked) .label-text-wrapper,
:host(.select-ltr.select-fill-outline.select-label-placement-floating) .label-text-wrapper {
// stylelint-disable-next-line property-disallowed-list
transform-origin: left top;
}
:host(.select-rtl.select-fill-outline.select-label-placement-stacked) .label-text-wrapper,
:host(.select-rtl.select-fill-outline.select-label-placement-floating) .label-text-wrapper {
// stylelint-disable-next-line property-disallowed-list
transform-origin: right top;
}
:host(.select-fill-outline.select-label-placement-stacked) .label-text-wrapper,
:host(.select-fill-outline.select-label-placement-floating) .label-text-wrapper {
position: absolute;
/**
* Label text should not extend
* beyond the bounds of the select.
*/
max-width: calc(100% - var(--padding-start) - var(--padding-end));
}
/**
* The label should appear on top of an outline
* container that overlaps it so it is always clickable.
*/
:host(.select-fill-outline) .label-text-wrapper,
:host(.select-fill-outline) .label-text-wrapper {
position: relative;
z-index: 1;
}
/**
* This makes the label sit above the select.
*/
:host(.label-floating.select-fill-outline) .label-text-wrapper {
@include transform(translateY(-32%), scale(#{$form-control-label-stacked-scale}));
@include margin(0);
/**
* Label text should not extend
* beyond the bounds of the select.
*/
max-width: calc((100% - var(--padding-start) - var(--padding-end) - #{$select-md-floating-label-padding * 2}) / #{$form-control-label-stacked-scale});
}
/**
* This ensures that the select does not
* overlap the floating label while still
* remaining visually centered.
*/
:host(.select-fill-outline.select-label-placement-stacked) select,
:host(.select-fill-outline.select-label-placement-floating) select {
@include margin(6px, 0, 6px, 0);
}
// Select Fill: Outline Outline Container
// ----------------------------------------------------------------
:host(.select-fill-outline) .select-outline-container {
@include position(0, 0, 0, 0);
display: flex;
position: absolute;
width: 100%;
height: 100%;
}
:host(.select-fill-outline) .select-outline-start,
:host(.select-fill-outline) .select-outline-end {
pointer-events: none;
}
/**
* By default, each piece of the container should have
* a top and bottom border. This gives the appearance
* of a unified container with a border.
*/
:host(.select-fill-outline) .select-outline-start,
:host(.select-fill-outline) .select-outline-notch,
:host(.select-fill-outline) .select-outline-end {
border-top: var(--border-width) var(--border-style) var(--border-color);
border-bottom: var(--border-width) var(--border-style) var(--border-color);
/**
* `border-box` is applied in the global
* Ionic stylesheet, but since this is in
* the Shadow DOM, these elements do not
* receive the global style. The outline
* pieces for `ion-input` do because that
* component is in the Light DOM.
*/
box-sizing: border-box;
}
/**
* Ensures long labels do not cause the notch to flow
* out of bounds.
*/
:host(.select-fill-outline) .select-outline-notch {
max-width: calc(100% - var(--padding-start) - var(--padding-end));
}
/**
* This element ensures that the notch used
* the size of the scaled text so that the
* border cut out is the correct width.
* The text in this element should not
* be interactive.
*/
:host(.select-fill-outline) .notch-spacer {
/**
* We need $select-md-floating-label-padding of padding on the right.
* However, we also subtracted $select-md-floating-label-padding from
* the width of .select-outline-start
* to create space, so we need to take
* that into consideration here.
*/
@include padding(null, #{$select-md-floating-label-padding * 2}, null, null);
font-size: calc(1em * #{$form-control-label-stacked-scale});
opacity: 0;
pointer-events: none;
}
:host(.select-fill-outline) .select-outline-start {
@include border(null, null, null, var(--border-width) var(--border-style) var(--border-color));
}
:host(.select-fill-outline) .select-outline-start {
@include border-radius(var(--border-radius), 0px, 0px, var(--border-radius));
}
:host(.select-fill-outline) .select-outline-start {
/**
* There should be spacing between the translated text
* and .select-outline-start. However, we can't add this
* spacing onto the notch because it would cause the
* label to look like it is not aligned with the
* text select. Instead, we subtract a few pixels from
* this element.
*/
width: calc(var(--padding-start) - #{$select-md-floating-label-padding});
}
:host(.select-fill-outline) .select-outline-end {
@include border(null, var(--border-width) var(--border-style) var(--border-color), null, null);
}
:host(.select-fill-outline) .select-outline-end {
@include border-radius(0px, var(--border-radius), var(--border-radius), 0px);
}
:host(.select-fill-outline) .select-outline-end {
/**
* The ending outline fragment
* should take up the remaining free space.
*/
flex-grow: 1;
}
/**
* When the select either has focus or a value,
* there should be a "cut out" at the top for
* the floating/stacked label. We simulate this "cut out"
* by removing the top border from the notch fragment.
*/
:host(.label-floating.select-fill-outline) .select-outline-notch {
border-top: none;
}
// Select Icon
// ----------------------------------------------------------------
/**
* When the select has an outline fill and
* in an item, then the icon should
* take on the highlight color.
*/
:host(.in-item.select-expanded.select-fill-outline) .select-wrapper .select-icon,
:host(.in-item.has-focus.select-fill-outline) .select-wrapper .select-icon,
:host(.in-item.has-focus.ion-valid.select-fill-outline) .select-wrapper .select-icon,
:host(.in-item.ion-touched.ion-invalid.select-fill-outline) .select-wrapper .select-icon {
color: var(--highlight-color);
}