diff --git a/core/src/components/radio-group/radio-group.scss b/core/src/components/radio-group/radio-group.common.scss similarity index 74% rename from core/src/components/radio-group/radio-group.scss rename to core/src/components/radio-group/radio-group.common.scss index 40686271a9..d05b6edae7 100644 --- a/core/src/components/radio-group/radio-group.scss +++ b/core/src/components/radio-group/radio-group.common.scss @@ -1,6 +1,4 @@ -@import "../../themes/native/native.globals"; - -// Radio Group +// Radio Group: Common // -------------------------------------------------- ion-radio-group { @@ -8,31 +6,19 @@ ion-radio-group { vertical-align: top; } -.radio-group-wrapper { - display: inline; -} - // Radio Group: Top // -------------------------------------------------- -.radio-group-top { - line-height: 1.5; -} - /** * Error text should only be shown when .ion-invalid is present * on the radio group. Otherwise the helper text should be shown. */ .radio-group-top .error-text { display: none; - - color: ion-color(danger, base); } .radio-group-top .helper-text { display: block; - - color: $text-color-step-300; } .ion-touched.ion-invalid .radio-group-top .error-text { diff --git a/core/src/components/radio-group/radio-group.ionic.scss b/core/src/components/radio-group/radio-group.ionic.scss new file mode 100644 index 0000000000..b45d765e48 --- /dev/null +++ b/core/src/components/radio-group/radio-group.ionic.scss @@ -0,0 +1,38 @@ +@use "../../themes/ionic/ionic.globals" as globals; +@import "./radio-group.common"; + +// Ionic Radio Group Top +// -------------------------------------------------- + +.radio-group-top { + @include globals.typography(globals.$ion-body-md-regular); + + margin-bottom: globals.$ion-space-400; +} + +.radio-group-top .error-text { + color: globals.$ion-semantics-danger-800; +} + +.radio-group-top .helper-text { + color: globals.$ion-primitives-neutral-800; +} + +// Radio Group Top: in List +// -------------------------------------------------- + +// Add padding to the error and helper text when used in a +// list to align them with the list header and item text. +ion-list .radio-group-top { + /* stylelint-disable */ + @include globals.ltr() { + padding-right: globals.$ion-space-400; + padding-left: calc(globals.$ion-space-400 + var(--ion-safe-area-left, 0px)); + } + + @include globals.rtl() { + padding-right: calc(globals.$ion-space-400 + var(--ion-safe-area-right, 0px)); + padding-left: globals.$ion-space-400; + } + /* stylelint-enable */ +} diff --git a/core/src/components/radio-group/radio-group.ios.scss b/core/src/components/radio-group/radio-group.ios.scss index 91fba201c5..67fccf8513 100644 --- a/core/src/components/radio-group/radio-group.ios.scss +++ b/core/src/components/radio-group/radio-group.ios.scss @@ -1,5 +1,5 @@ @import "../../themes/native/native.globals.ios"; -@import "./radio-group"; +@import "./radio-group.native"; @import "../item/item.ios.vars"; // iOS Radio Group Top in List diff --git a/core/src/components/radio-group/radio-group.md.scss b/core/src/components/radio-group/radio-group.md.scss index 9ac3a3c00f..009a8fe58c 100644 --- a/core/src/components/radio-group/radio-group.md.scss +++ b/core/src/components/radio-group/radio-group.md.scss @@ -1,5 +1,5 @@ @import "../../themes/native/native.globals.md"; -@import "./radio-group"; +@import "./radio-group.native"; @import "../item/item.md.vars"; // Material Design Radio Group Top in List diff --git a/core/src/components/radio-group/radio-group.native.scss b/core/src/components/radio-group/radio-group.native.scss new file mode 100644 index 0000000000..c0a65bdd95 --- /dev/null +++ b/core/src/components/radio-group/radio-group.native.scss @@ -0,0 +1,24 @@ +@import "./radio-group.common"; +@import "../../themes/native/native.globals"; + +// Radio Group: Native +// -------------------------------------------------- + +.radio-group-wrapper { + display: inline; +} + +// Radio Group: Top +// -------------------------------------------------- + +.radio-group-top { + line-height: 1.5; +} + +.radio-group-top .error-text { + color: ion-color(danger, base); +} + +.radio-group-top .helper-text { + color: $text-color-step-300; +} diff --git a/core/src/components/radio-group/radio-group.tsx b/core/src/components/radio-group/radio-group.tsx index 52907b3d4d..71ee98b0ce 100644 --- a/core/src/components/radio-group/radio-group.tsx +++ b/core/src/components/radio-group/radio-group.tsx @@ -15,6 +15,7 @@ import type { RadioGroupChangeEventDetail, RadioGroupCompareFn } from './radio-g styleUrls: { ios: 'radio-group.ios.scss', md: 'radio-group.md.scss', + ionic: 'radio-group.ionic.scss', }, }) export class RadioGroup implements ComponentInterface { diff --git a/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts b/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts index e33d0a3546..a3d12d63e2 100644 --- a/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts +++ b/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts @@ -152,7 +152,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => /** * Rendering is different across modes */ -configs({ modes: ['ios', 'md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { +configs({ modes: ['ios', 'md', 'ionic-md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { test.describe(title('radio-group: supporting text rendering'), () => { test('should not have visual regressions when rendering helper text', async ({ page }) => { await page.setContent( diff --git a/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts-snapshots/radio-group-error-text-ionic-md-ltr-light-Mobile-Chrome-linux.png b/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts-snapshots/radio-group-error-text-ionic-md-ltr-light-Mobile-Chrome-linux.png new file mode 100644 index 0000000000..4640d38fb7 Binary files /dev/null and b/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts-snapshots/radio-group-error-text-ionic-md-ltr-light-Mobile-Chrome-linux.png differ diff --git a/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts-snapshots/radio-group-error-text-ionic-md-ltr-light-Mobile-Firefox-linux.png b/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts-snapshots/radio-group-error-text-ionic-md-ltr-light-Mobile-Firefox-linux.png new file mode 100644 index 0000000000..2159c0c2b8 Binary files /dev/null and b/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts-snapshots/radio-group-error-text-ionic-md-ltr-light-Mobile-Firefox-linux.png differ diff --git a/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts-snapshots/radio-group-error-text-ionic-md-ltr-light-Mobile-Safari-linux.png b/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts-snapshots/radio-group-error-text-ionic-md-ltr-light-Mobile-Safari-linux.png new file mode 100644 index 0000000000..c9b5101727 Binary files /dev/null and b/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts-snapshots/radio-group-error-text-ionic-md-ltr-light-Mobile-Safari-linux.png differ diff --git a/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts-snapshots/radio-group-helper-text-ionic-md-ltr-light-Mobile-Chrome-linux.png b/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts-snapshots/radio-group-helper-text-ionic-md-ltr-light-Mobile-Chrome-linux.png new file mode 100644 index 0000000000..09b0377970 Binary files /dev/null and b/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts-snapshots/radio-group-helper-text-ionic-md-ltr-light-Mobile-Chrome-linux.png differ diff --git a/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts-snapshots/radio-group-helper-text-ionic-md-ltr-light-Mobile-Firefox-linux.png b/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts-snapshots/radio-group-helper-text-ionic-md-ltr-light-Mobile-Firefox-linux.png new file mode 100644 index 0000000000..7e1643be9b Binary files /dev/null and b/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts-snapshots/radio-group-helper-text-ionic-md-ltr-light-Mobile-Firefox-linux.png differ diff --git a/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts-snapshots/radio-group-helper-text-ionic-md-ltr-light-Mobile-Safari-linux.png b/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts-snapshots/radio-group-helper-text-ionic-md-ltr-light-Mobile-Safari-linux.png new file mode 100644 index 0000000000..341a6d59b0 Binary files /dev/null and b/core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts-snapshots/radio-group-helper-text-ionic-md-ltr-light-Mobile-Safari-linux.png differ