Skip to content

Commit 7f24ba0

Browse files
feat(select): add helper and error text to the ionic theme (#30280)
- Adds design for helper and error text to the select for the ionic theme. - Updates tests to add screenshots for ionic theme --------- Co-authored-by: Brandy Smith <[email protected]>
1 parent 7f23c60 commit 7f24ba0

File tree

26 files changed

+66
-12
lines changed

26 files changed

+66
-12
lines changed

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -236,21 +236,12 @@ button {
236236
// ----------------------------------------------------------------
237237

238238
.select-bottom {
239-
/**
240-
* The bottom content should take on the start and end
241-
* padding so it is always aligned with either the label
242-
* or the start of the text select.
243-
*/
244-
@include mixins.padding(5px, var(--padding-end), 0, var(--padding-start));
245-
246239
display: flex;
247240

248241
justify-content: space-between;
249242

250243
border-top: var(--border-width) var(--border-style) var(--border-color);
251244

252-
font-size: dynamic-font(12px);
253-
254245
white-space: normal;
255246
}
256247

@@ -285,8 +276,6 @@ button {
285276

286277
.select-bottom .helper-text {
287278
display: block;
288-
289-
color: $text-color-step-300;
290279
}
291280

292281
:host(.ion-touched.ion-invalid) .select-bottom .error-text {

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
--border-color: #{globals.current-color(base)};
88
}
99

10+
// Select Bottom Content
11+
// ----------------------------------------------------------------
12+
13+
:host(.select-fill-outline) .select-bottom {
14+
border-top: none;
15+
}
16+
1017
// Select Label
1118
// ----------------------------------------------------------------
1219

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@
2222
--highlight-color-invalid: #{globals.$ion-semantics-danger-800};
2323
}
2424

25+
// Select Hint Text
26+
// ----------------------------------------------------------------
27+
28+
.select-bottom {
29+
@include globals.padding(globals.$ion-space-100, null, null, null);
30+
@include globals.typography(globals.$ion-body-sm-medium);
31+
}
32+
33+
.select-bottom .helper-text {
34+
color: globals.$ion-primitives-neutral-800;
35+
}
36+
2537
// Select Label
2638
// ----------------------------------------------------------------
2739

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,27 @@
4141
@include border-radius(var(--border-radius));
4242
}
4343

44+
// Select Bottom Content
45+
// ----------------------------------------------------------------
46+
47+
.select-bottom {
48+
/**
49+
* The bottom content should take on the start and end
50+
* padding so it is always aligned with either the label
51+
* or the start of the text select.
52+
*/
53+
@include padding(5px, var(--padding-end), 0, var(--padding-start));
54+
55+
font-size: dynamic-font(12px);
56+
}
57+
58+
// Select Hint Text
59+
// ----------------------------------------------------------------
60+
61+
.select-bottom .helper-text {
62+
color: $text-color-step-300;
63+
}
64+
4465
// Select Label Placement - Start
4566
// ----------------------------------------------------------------
4667

core/src/components/select/test/bottom-content/select.e2e.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
9898
/**
9999
* Rendering is different across modes
100100
*/
101-
configs({ modes: ['ios', 'md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
101+
configs({ modes: ['ios', 'md', 'ionic-md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
102102
test.describe(title('select: helper text rendering'), () => {
103103
test('should not have visual regressions when rendering helper text', async ({ page }) => {
104104
await page.setContent(`<ion-select label="Label" helper-text="Helper text"></ion-select>`, config);
@@ -213,3 +213,28 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, co
213213
});
214214
});
215215
});
216+
217+
configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ title, screenshot, config }) => {
218+
test.describe(title('select: bottom content'), () => {
219+
test('entire select component should render correctly with no fill', async ({ page }) => {
220+
await page.setContent(
221+
`
222+
<ion-select label="Label" label-placement="stacked" helper-text="Helper text"></ion-select>
223+
`,
224+
config
225+
);
226+
const select = page.locator('ion-select');
227+
await expect(select).toHaveScreenshot(screenshot(`select-full-bottom-no-fill`));
228+
});
229+
test('entire select component should render correctly with outline fill', async ({ page }) => {
230+
await page.setContent(
231+
`
232+
<ion-select fill="outline" label="Label" label-placement="stacked" helper-text="Helper text"></ion-select>
233+
`,
234+
config
235+
);
236+
const select = page.locator('ion-select');
237+
await expect(select).toHaveScreenshot(screenshot(`select-full-bottom-outline`));
238+
});
239+
});
240+
});
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)