Skip to content

Commit e24fcf5

Browse files
feat(radio-group): add helper and error text to the ionic theme (#30271)
- Adds the common stylesheet for the shared styles - Adds design for helper and error text to the radio group for the ionic theme. - Updates tests to add screenshots for ionic theme --------- Co-authored-by: Brandy Smith <[email protected]>
1 parent c37eaab commit e24fcf5

13 files changed

+67
-18
lines changed

core/src/components/radio-group/radio-group.scss renamed to core/src/components/radio-group/radio-group.common.scss

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,24 @@
1-
@import "../../themes/native/native.globals";
2-
3-
// Radio Group
1+
// Radio Group: Common
42
// --------------------------------------------------
53

64
ion-radio-group {
75
// Prevents additional pixels from being rendered on top
86
vertical-align: top;
97
}
108

11-
.radio-group-wrapper {
12-
display: inline;
13-
}
14-
159
// Radio Group: Top
1610
// --------------------------------------------------
1711

18-
.radio-group-top {
19-
line-height: 1.5;
20-
}
21-
2212
/**
2313
* Error text should only be shown when .ion-invalid is present
2414
* on the radio group. Otherwise the helper text should be shown.
2515
*/
2616
.radio-group-top .error-text {
2717
display: none;
28-
29-
color: ion-color(danger, base);
3018
}
3119

3220
.radio-group-top .helper-text {
3321
display: block;
34-
35-
color: $text-color-step-300;
3622
}
3723

3824
.ion-touched.ion-invalid .radio-group-top .error-text {
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@use "../../themes/ionic/ionic.globals" as globals;
2+
@import "./radio-group.common";
3+
4+
// Ionic Radio Group Top
5+
// --------------------------------------------------
6+
7+
.radio-group-top {
8+
@include globals.typography(globals.$ion-body-md-regular);
9+
10+
margin-bottom: globals.$ion-space-400;
11+
}
12+
13+
.radio-group-top .error-text {
14+
color: globals.$ion-semantics-danger-800;
15+
}
16+
17+
.radio-group-top .helper-text {
18+
color: globals.$ion-primitives-neutral-800;
19+
}
20+
21+
// Radio Group Top: in List
22+
// --------------------------------------------------
23+
24+
// Add padding to the error and helper text when used in a
25+
// list to align them with the list header and item text.
26+
ion-list .radio-group-top {
27+
/* stylelint-disable */
28+
@include globals.ltr() {
29+
padding-right: globals.$ion-space-400;
30+
padding-left: calc(globals.$ion-space-400 + var(--ion-safe-area-left, 0px));
31+
}
32+
33+
@include globals.rtl() {
34+
padding-right: calc(globals.$ion-space-400 + var(--ion-safe-area-right, 0px));
35+
padding-left: globals.$ion-space-400;
36+
}
37+
/* stylelint-enable */
38+
}

core/src/components/radio-group/radio-group.ios.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@import "../../themes/native/native.globals.ios";
2-
@import "./radio-group";
2+
@import "./radio-group.native";
33
@import "../item/item.ios.vars";
44

55
// iOS Radio Group Top in List

core/src/components/radio-group/radio-group.md.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@import "../../themes/native/native.globals.md";
2-
@import "./radio-group";
2+
@import "./radio-group.native";
33
@import "../item/item.md.vars";
44

55
// Material Design Radio Group Top in List
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@import "./radio-group.common";
2+
@import "../../themes/native/native.globals";
3+
4+
// Radio Group: Native
5+
// --------------------------------------------------
6+
7+
.radio-group-wrapper {
8+
display: inline;
9+
}
10+
11+
// Radio Group: Top
12+
// --------------------------------------------------
13+
14+
.radio-group-top {
15+
line-height: 1.5;
16+
}
17+
18+
.radio-group-top .error-text {
19+
color: ion-color(danger, base);
20+
}
21+
22+
.radio-group-top .helper-text {
23+
color: $text-color-step-300;
24+
}

core/src/components/radio-group/radio-group.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import type { RadioGroupChangeEventDetail, RadioGroupCompareFn } from './radio-g
1515
styleUrls: {
1616
ios: 'radio-group.ios.scss',
1717
md: 'radio-group.md.scss',
18+
ionic: 'radio-group.ionic.scss',
1819
},
1920
})
2021
export class RadioGroup implements ComponentInterface {

core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
152152
/**
153153
* Rendering is different across modes
154154
*/
155-
configs({ modes: ['ios', 'md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
155+
configs({ modes: ['ios', 'md', 'ionic-md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
156156
test.describe(title('radio-group: supporting text rendering'), () => {
157157
test('should not have visual regressions when rendering helper text', async ({ page }) => {
158158
await page.setContent(
Loading
Loading
Loading

0 commit comments

Comments
 (0)