Skip to content

Commit 9e30629

Browse files
authored
feat(select): add ionic theme styles (#29989)
1 parent 1b6f07d commit 9e30629

File tree

94 files changed

+573
-216
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+573
-216
lines changed

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

Lines changed: 2 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "../../themes/mixins" as mixins;
12
@import "./select.vars";
23

34
// Select
@@ -31,7 +32,6 @@
3132
--padding-bottom: 0px;
3233
--padding-start: 0px;
3334
--placeholder-color: currentColor;
34-
--placeholder-opacity: #{$placeholder-opacity};
3535
--background: transparent;
3636
--border-style: solid;
3737
--highlight-color-focused: #{ion-color(primary, base)};
@@ -52,12 +52,9 @@
5252
width: 100%;
5353
min-height: 44px;
5454

55-
font-family: $font-family-base;
56-
5755
white-space: nowrap;
5856

5957
cursor: pointer;
60-
z-index: $z-index-item-input;
6158
}
6259

6360
/**
@@ -115,17 +112,13 @@
115112
}
116113

117114
button {
118-
@include visually-hidden();
115+
@include mixins.visually-hidden();
119116
}
120117

121118
// Select Icon
122119
// --------------------------------------------------
123120

124121
.select-icon {
125-
@include margin(0, 0, 0, $select-icon-margin-start);
126-
127-
position: relative;
128-
129122
/**
130123
* Prevent the icon from shrinking when the label and/or
131124
* selected item text is long enough to fill the rest of
@@ -143,18 +136,6 @@ button {
143136
color: inherit;
144137
}
145138

146-
/**
147-
* The select icon should be centered with
148-
* the entire container not just the control
149-
* with floating/stacked labels.
150-
*/
151-
:host(.select-label-placement-stacked) .select-icon,
152-
:host(.select-label-placement-floating) .select-icon {
153-
position: absolute;
154-
155-
height: 100%;
156-
}
157-
158139
/**
159140
* This positions the icon at the correct
160141
* edge of the component with LTR and RTL
@@ -193,9 +174,6 @@ button {
193174
// --------------------------------------------------
194175

195176
.select-wrapper {
196-
@include padding(var(--padding-top), var(--padding-end), var(--padding-bottom), var(--padding-start));
197-
@include border-radius(var(--border-radius));
198-
199177
display: flex;
200178

201179
position: relative;
@@ -389,15 +367,6 @@ button {
389367
flex-direction: row;
390368
}
391369

392-
:host(.select-label-placement-start) .label-text-wrapper {
393-
/**
394-
* The margin between the label and
395-
* the select should be on the end
396-
* when the label sits at the start.
397-
*/
398-
@include margin(0, $form-control-label-margin, 0, 0);
399-
}
400-
401370
// Select Label Placement - End
402371
// ----------------------------------------------------------------
403372

@@ -409,27 +378,6 @@ button {
409378
flex-direction: row-reverse;
410379
}
411380

412-
/**
413-
* The margin between the label and
414-
* the select should be on the start
415-
* when the label sits at the end.
416-
*/
417-
:host(.select-label-placement-end) .label-text-wrapper {
418-
@include margin(0, 0, 0, $form-control-label-margin);
419-
}
420-
421-
// Select Label Placement - Fixed
422-
// ----------------------------------------------------------------
423-
424-
:host(.select-label-placement-fixed) .label-text-wrapper {
425-
/**
426-
* The margin between the label and
427-
* the select should be on the end
428-
* when the label sits at the start.
429-
*/
430-
@include margin(0, $form-control-label-margin, 0, 0);
431-
}
432-
433381
/**
434382
* Label is on the left of the select in LTR and
435383
* on the right in RTL. Label also has a fixed width.
@@ -488,28 +436,11 @@ button {
488436
*/
489437
:host(.select-label-placement-stacked) .native-wrapper,
490438
:host(.select-label-placement-floating) .native-wrapper {
491-
@include margin(1px, 0, 0, 0);
492-
493439
flex-grow: 1;
494440

495441
width: 100%;
496442
}
497443

498-
/**
499-
* This makes the label sit over the select
500-
* when the select is blurred and has no value.
501-
* The label should not sit over the select if the
502-
* select has a placeholder.
503-
* Note: This is different from what ion-input does
504-
* because the activating the select causes an overlay
505-
* to appear. This makes it hard to read the placeholder.
506-
* With ion-input, the input just focuses and the placeholder
507-
* is still easy to read.
508-
*/
509-
:host(.select-label-placement-floating) .label-text-wrapper {
510-
@include transform(translateY(100%), scale(1));
511-
}
512-
513444
/**
514445
* The placeholder should be hidden when the label
515446
* is on top of the select. This prevents the label
@@ -537,19 +468,6 @@ button {
537468
opacity: 1;
538469
}
539470

540-
/**
541-
* This makes the label sit above the input.
542-
*/
543-
:host(.label-floating) .label-text-wrapper {
544-
@include transform(translateY(50%), scale(#{$form-control-label-stacked-scale}));
545-
546-
/**
547-
* Label text should not extend
548-
* beyond the bounds of the input.
549-
*/
550-
max-width: calc(100% / #{$form-control-label-stacked-scale});
551-
}
552-
553471
// Start/End Slots
554472
// ----------------------------------------------------------------
555473

@@ -564,11 +482,9 @@ button {
564482
}
565483

566484
::slotted([slot="start"]:last-of-type) {
567-
margin-inline-end: $form-control-label-margin;
568485
margin-inline-start: 0;
569486
}
570487

571488
::slotted([slot="end"]:first-of-type) {
572-
margin-inline-start: $form-control-label-margin;
573489
margin-inline-end: 0;
574490
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
@use "../../themes/ionic/ionic.globals.scss" as globals;
2+
3+
// Select Fill: Outline (Ionic Theme)
4+
// ----------------------------------------------------------------
5+
6+
:host(.ion-color) {
7+
--border-color: #{globals.current-color(base)};
8+
}
9+
10+
// Select Label
11+
// ----------------------------------------------------------------
12+
13+
:host(.select-fill-outline) .label-text-wrapper {
14+
/**
15+
* The label should appear on top of an outline
16+
* container that overlaps it so it is always clickable.
17+
*/
18+
position: relative;
19+
}
20+
21+
// Select Inner Wrapper
22+
// ----------------------------------------------------------------
23+
24+
:host(.select-fill-outline) .select-wrapper-inner {
25+
@include globals.border-radius(var(--border-radius));
26+
@include globals.padding(var(--padding-top), var(--padding-end), var(--padding-bottom), var(--padding-start));
27+
28+
/**
29+
* Apply the background to the native select
30+
* wrapper to only style the select.
31+
*/
32+
background: var(--background);
33+
}
34+
35+
// Outline Container
36+
// ----------------------------------------------------------------
37+
38+
:host(.select-fill-outline) .select-outline {
39+
@include globals.position(0, 0, 0, 0);
40+
@include globals.border-radius(var(--border-radius));
41+
42+
position: absolute;
43+
44+
width: 100%;
45+
height: 100%;
46+
47+
pointer-events: none;
48+
49+
border: var(--border-width) var(--border-style) var(--border-color);
50+
51+
box-sizing: border-box;
52+
}

0 commit comments

Comments
 (0)