Skip to content

Commit b8249bc

Browse files
committed
refactor(select): update styles to support customization
1 parent 20267bd commit b8249bc

10 files changed

+22
-20
lines changed

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@
33
// Select Fill: Outline (Ionic Theme)
44
// ----------------------------------------------------------------
55

6-
:host(.select-fill-outline) {
7-
// TODO(ROU-10778, ROU-10875): Sync the color names to the design system of
8-
// ios and md. This will allow us to have a single color map.
9-
--border-color: #{globals.current-color(neutral)};
10-
--border-radius: #{globals.$ion-border-radius-400};
11-
--border-width: #{globals.$ion-border-size-025};
12-
}
13-
146
:host(.ion-color) {
157
--border-color: #{globals.current-color(base)};
168
}

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

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
:host {
99
--background: #{globals.$ion-primitives-base-white};
10+
// TODO(ROU-10778, ROU-10875): Sync the color names to the design system of
11+
// ios and md. This will allow us to have a single color map.
12+
--border-color: #{globals.current-color(neutral)};
13+
--border-radius: #{globals.$ion-border-radius-400};
14+
--border-width: #{globals.$ion-border-size-025};
1015
--padding-start: #{globals.$ion-space-400};
1116
--padding-end: #{globals.$ion-space-400};
1217
--padding-top: #{globals.$ion-space-300};
@@ -62,16 +67,6 @@
6267
@include globals.margin(0, 0, globals.$ion-space-100, 0);
6368
}
6469

65-
// Select Text
66-
// ----------------------------------------------------------------
67-
68-
// Targets the text inside the select and the placeholder
69-
.select-text {
70-
@include globals.typography(globals.$ion-body-md-regular);
71-
72-
color: globals.$ion-primitives-neutral-1200;
73-
}
74-
7570
// Select Wrapper
7671
// ----------------------------------------------------------------
7772

@@ -85,6 +80,9 @@
8580
// ----------------------------------------------------------------
8681

8782
.select-wrapper-inner {
83+
@include globals.border-radius(var(--border-radius));
84+
@include globals.padding(var(--padding-top), var(--padding-end), var(--padding-bottom), var(--padding-start));
85+
8886
position: relative;
8987

9088
height: globals.$ion-scale-1200;
@@ -104,6 +102,12 @@
104102
// Select Native Wrapper
105103
// ----------------------------------------------------------------
106104

105+
.native-wrapper {
106+
@include globals.typography(globals.$ion-body-md-regular);
107+
108+
color: globals.$ion-primitives-neutral-1200;
109+
}
110+
107111
:host(.select-label-placement-stacked) .native-wrapper,
108112
:host(.select-label-placement-floating) .native-wrapper {
109113
/**

core/src/components/select/test/custom/select.e2e.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expect } from '@playwright/test';
22
import { configs, test } from '@utils/test/playwright';
33

4-
configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
4+
configs({ modes: ['ios', 'md', 'ionic-md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
55
test.describe(title('select: custom'), () => {
66
test('should be able to customize select using css apis', async ({ page }) => {
77
test.info().annotations.push({
@@ -64,6 +64,10 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
6464
ion-select::part(label) {
6565
color: green;
6666
}
67+
68+
ion-select::part(placeholder) {
69+
color: purple;
70+
}
6771
</style>
6872
`,
6973
config
2.4 KB
Loading
3.3 KB
Loading
2.44 KB
Loading
3.45 KB
Loading
Loading
3.36 KB
Loading

core/src/components/select/test/fill/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848
<div class="grid">
4949
<div class="grid-item">
5050
<h2>No Fill</h2>
51-
<ion-select class="no-fill" label="Fruit" value="apple"></ion-select>
51+
<ion-select class="no-fill" label="Fruit" value="apple">
52+
<ion-select-option value="apple">Apple</ion-select-option>
53+
</ion-select>
5254
</div>
5355

5456
<div class="grid-item">

0 commit comments

Comments
 (0)