Skip to content

Commit 230abcc

Browse files
committed
feat(radio-group): add helper and error text to the ionic theme
1 parent 0e55445 commit 230abcc

13 files changed

+66
-16
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 & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,26 @@
11
@import "../../themes/native/native.globals";
22

3-
// Radio Group
3+
// Radio Group: Common
44
// --------------------------------------------------
55

66
ion-radio-group {
77
// Prevents additional pixels from being rendered on top
88
vertical-align: top;
99
}
1010

11-
.radio-group-wrapper {
12-
display: inline;
13-
}
14-
1511
// Radio Group: Top
1612
// --------------------------------------------------
1713

18-
.radio-group-top {
19-
line-height: 1.5;
20-
}
21-
2214
/**
2315
* Error text should only be shown when .ion-invalid is present
2416
* on the radio group. Otherwise the helper text should be shown.
2517
*/
2618
.radio-group-top .error-text {
2719
display: none;
28-
29-
color: ion-color(danger, base);
3020
}
3121

3222
.radio-group-top .helper-text {
3323
display: block;
34-
35-
color: $text-color-step-300;
3624
}
3725

3826
.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-100;
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 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 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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@import "./radio-group.common";
2+
3+
// Radio Group: Native
4+
// --------------------------------------------------
5+
6+
.radio-group-wrapper {
7+
display: inline;
8+
}
9+
10+
// Radio Group: Top
11+
// --------------------------------------------------
12+
13+
.radio-group-top {
14+
line-height: 1.5;
15+
}
16+
17+
.radio-group-top .error-text {
18+
color: ion-color(danger, base);
19+
}
20+
21+
.radio-group-top .helper-text {
22+
color: $text-color-step-300;
23+
}

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)