Skip to content

Commit 3201a19

Browse files
committed
fix select tokens
1 parent 01fe718 commit 3201a19

File tree

3 files changed

+114
-53
lines changed

3 files changed

+114
-53
lines changed

core/src/components/select/select.common.scss

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@use "../../themes/mixins" as mixins;
2-
@import "./select.vars";
32

43
// Select
54
// --------------------------------------------------
@@ -50,7 +49,6 @@
5049
position: relative;
5150

5251
width: 100%;
53-
min-height: 44px;
5452

5553
white-space: nowrap;
5654

@@ -75,10 +73,6 @@
7573
pointer-events: none;
7674
}
7775

78-
:host(.ion-focused) button {
79-
border: 2px solid #5e9ed6;
80-
}
81-
8276
/**
8377
* Select can be slotted
8478
* in components such as item and
@@ -149,8 +143,6 @@ button {
149143
.select-text {
150144
flex: 1;
151145

152-
min-width: 16px;
153-
154146
font-size: inherit;
155147

156148
text-overflow: ellipsis;
@@ -194,15 +186,6 @@ button {
194186
box-sizing: border-box;
195187
}
196188

197-
.select-wrapper .select-placeholder {
198-
/**
199-
* When the floating label appears on top of the
200-
* select, we need to fade the text out so that the
201-
* label does not overlap with the placeholder.
202-
*/
203-
transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);
204-
}
205-
206189
.select-wrapper-inner {
207190
display: flex;
208191

@@ -299,18 +282,6 @@ button {
299282

300283
align-items: center;
301284

302-
/**
303-
* Label text should not extend
304-
* beyond the bounds of the select.
305-
* However, we do not set the max
306-
* width to 100% because then
307-
* only the label would show and users
308-
* would not be able to see what they are typing.
309-
*/
310-
max-width: 200px;
311-
312-
transition: color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
313-
314285
/**
315286
* This ensures that double tapping this text
316287
* clicks the <label> and focuses the input
@@ -359,13 +330,6 @@ button {
359330

360331
align-items: center;
361332

362-
/**
363-
* When the floating label appears on top of the
364-
* input, we need to fade the input out so that the
365-
* label does not overlap with the placeholder.
366-
*/
367-
transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);
368-
369333
/**
370334
* This ensures that the .select-text gets
371335
* truncated with ellipses when the text is
@@ -411,18 +375,6 @@ button {
411375
flex-direction: row-reverse;
412376
}
413377

414-
/**
415-
* Label is on the left of the select in LTR and
416-
* on the right in RTL. Label also has a fixed width.
417-
*/
418-
:host(.select-label-placement-fixed) .label-text-wrapper {
419-
flex: 0 0 100px;
420-
421-
width: 100px;
422-
min-width: 100px;
423-
max-width: 200px;
424-
}
425-
426378
// Select Label Placement - Stacked and Floating
427379
// ----------------------------------------------------------------
428380

core/src/components/select/select.ionic.scss

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
--highlight-color-focused: #{globals.$ion-border-focus-default};
2121
--highlight-color-valid: #{globals.$ion-semantics-success-900};
2222
--highlight-color-invalid: #{globals.$ion-semantics-danger-800};
23+
24+
min-height: globals.$ion-scale-1100;
2325
}
2426

2527
// Select Hint Text
@@ -34,12 +36,29 @@
3436
color: globals.$ion-primitives-neutral-800;
3537
}
3638

39+
.select-text {
40+
min-width: globals.$ion-space-400;
41+
}
42+
3743
// Select Label
3844
// ----------------------------------------------------------------
3945

4046
.label-text-wrapper {
4147
@include globals.typography(globals.$ion-body-sm-medium);
4248

49+
/**
50+
* Label text should not extend
51+
* beyond the bounds of the select.
52+
* However, we do not set the max
53+
* width to 100% because then
54+
* only the label would show and users
55+
* would not be able to see what they are typing.
56+
*/
57+
max-width: globals.$ion-scale-5000;
58+
59+
transition: color globals.$ion-transition-time-150 globals.$ion-transition-curve-expressive,
60+
transform globals.$ion-transition-time-150 globals.$ion-transition-curve-expressive;
61+
4362
color: globals.$ion-primitives-neutral-1000;
4463
}
4564

@@ -56,6 +75,16 @@
5675
@include globals.margin(0, globals.$ion-space-100, 0, 0);
5776
}
5877

78+
:host(.select-label-placement-fixed) .label-text-wrapper {
79+
$text-wrapper-width: calc(globals.$ion-scale-2400 + globals.$ion-space-100);
80+
81+
flex: 0 0 $text-wrapper-width;
82+
83+
width: $text-wrapper-width;
84+
min-width: $text-wrapper-width;
85+
max-width: globals.$ion-scale-5000;
86+
}
87+
5988
// Select Label Placement - End
6089
// ----------------------------------------------------------------
6190

@@ -90,6 +119,15 @@
90119
background: transparent;
91120
}
92121

122+
.select-wrapper .select-placeholder {
123+
/**
124+
* When the floating label appears on top of the
125+
* select, we need to fade the text out so that the
126+
* label does not overlap with the placeholder.
127+
*/
128+
transition: opacity globals.$ion-transition-time-150 globals.$ion-transition-curve-expressive;
129+
}
130+
93131
// Select Inner Wrapper
94132
// ----------------------------------------------------------------
95133

@@ -117,6 +155,13 @@
117155
.native-wrapper {
118156
@include globals.typography(globals.$ion-body-md-regular);
119157

158+
/**
159+
* When the floating label appears on top of the
160+
* input, we need to fade the input out so that the
161+
* label does not overlap with the placeholder.
162+
*/
163+
transition: opacity globals.$ion-transition-time-150 globals.$ion-transition-curve-expressive;
164+
120165
color: globals.$ion-primitives-neutral-1200;
121166
}
122167

@@ -144,10 +189,10 @@
144189
::slotted(ion-button[slot="start"].button-has-icon-only),
145190
::slotted(ion-button[slot="end"].button-has-icon-only) {
146191
--border-radius: 50%;
147-
--padding-start: 8px;
148-
--padding-end: 8px;
149-
--padding-top: 8px;
150-
--padding-bottom: 8px;
192+
--padding-start: #{globals.$ion-space-200};
193+
--padding-end: #{globals.$ion-space-200};
194+
--padding-top: #{globals.$ion-space-200};
195+
--padding-bottom: #{globals.$ion-space-200};
151196

152197
aspect-ratio: 1;
153198
}
@@ -162,7 +207,7 @@
162207
}
163208

164209
.select-icon {
165-
transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
210+
transition: transform 0.15s globals.$ion-transition-curve-expressive;
166211
}
167212

168213
/**

core/src/components/select/select.native.scss

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
@import "../../themes/native/native.globals";
22
@import "./select.common";
3+
@import "./select.vars";
34

45
// Select: Native
56
// --------------------------------------------------
67

78
:host {
89
--placeholder-opacity: #{$placeholder-opacity};
910

11+
min-height: 44px;
12+
1013
font-family: $font-family-base;
1114

1215
z-index: $z-index-item-input;
1316
}
1417

18+
// Select Used in ion-item
19+
// --------------------------------------------------
20+
21+
:host(.ion-focused) button {
22+
border: 2px solid #5e9ed6;
23+
}
24+
1525
// Select Icon
1626
// --------------------------------------------------
1727

@@ -41,6 +51,15 @@
4151
@include border-radius(var(--border-radius));
4252
}
4353

54+
.select-wrapper .select-placeholder {
55+
/**
56+
* When the floating label appears on top of the
57+
* select, we need to fade the text out so that the
58+
* label does not overlap with the placeholder.
59+
*/
60+
transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);
61+
}
62+
4463
// Select Bottom Content
4564
// ----------------------------------------------------------------
4665

@@ -62,6 +81,30 @@
6281
color: $text-color-step-300;
6382
}
6483

84+
// Select Text
85+
// --------------------------------------------------
86+
87+
.select-text {
88+
min-width: 16px;
89+
}
90+
91+
// Select Label
92+
// ----------------------------------------------------------------
93+
94+
.label-text-wrapper {
95+
/**
96+
* Label text should not extend
97+
* beyond the bounds of the select.
98+
* However, we do not set the max
99+
* width to 100% because then
100+
* only the label would show and users
101+
* would not be able to see what they are typing.
102+
*/
103+
max-width: 200px;
104+
105+
transition: color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
106+
}
107+
65108
// Select Label Placement - Start
66109
// ----------------------------------------------------------------
67110

@@ -95,6 +138,15 @@
95138
* when the label sits at the start.
96139
*/
97140
@include margin(0, $form-control-label-margin, 0, 0);
141+
/**
142+
* Label is on the left of the select in LTR and
143+
* on the right in RTL. Label also has a fixed width.
144+
*/
145+
flex: 0 0 100px;
146+
147+
width: 100px;
148+
min-width: 100px;
149+
max-width: 200px;
98150
}
99151

100152
// Select Label Placement - Stacked and Floating
@@ -170,3 +222,15 @@
170222
::slotted([slot="end"]:first-of-type) {
171223
margin-inline-start: $form-control-label-margin;
172224
}
225+
226+
// Select Native Wrapper
227+
// ----------------------------------------------------------------
228+
229+
.native-wrapper {
230+
/**
231+
* When the floating label appears on top of the
232+
* input, we need to fade the input out so that the
233+
* label does not overlap with the placeholder.
234+
*/
235+
transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);
236+
}

0 commit comments

Comments
 (0)