Skip to content

Commit 8c3bf9e

Browse files
laurensuhSang Kyung Suh
andauthored
bug (radio group): right to left legend alignment fix (#5025)
* bug (radio group): right to left legend alignment fix * bug (radio group): add docs example and fix release notes * bug (radio group): add extra line * bug (radio group): fix regression on checkbox * bug (radio group): pr comment addressed * bug (radio group): pr comment vrt regression fix Co-authored-by: Sang Kyung Suh <[email protected]>
1 parent 3ce19f4 commit 8c3bf9e

File tree

6 files changed

+109
-0
lines changed

6 files changed

+109
-0
lines changed

RELEASENOTES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
#### Changed
2424
- Removed `@noflip` annotation from nubbins to make RTL behavior consistent
2525

26+
### [Radio Group](https://www.lightningdesignsystem.com/components/radio-group)
27+
#### Added
28+
- Added styling changes to support radio group with help text icon.
29+
- Added examples: Required with help text icon and Right to left required with help text icon to documentation
30+
#### Fixed
31+
- Right to left legend to be right aligned and match the alignment of content.
32+
2633
### [Tiles](https://www.lightningdesignsystem.com/components/tiles)
2734
#### Added
2835
- Added annotations for tile board CSS classes.

ui/components/form-element/base/_index.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
padding-top: $spacing-xx-small;
2929
margin-bottom: $spacing-xxx-small;
3030

31+
@include rtl() {
32+
/*! @noflip */
33+
padding-left: $spacing-x-small;
34+
}
35+
3136
&:empty {
3237
margin: 0;
3338
}
@@ -43,6 +48,11 @@
4348
clear: left;
4449
position: relative;
4550

51+
@include rtl() {
52+
/*! @noflip */
53+
clear: right;
54+
}
55+
4656
// Force radios and checkboxes to be on own line when there are multiples in a group
4757
.slds-radio,
4858
.slds-checkbox {
@@ -123,6 +133,14 @@
123133
.slds-form-element__legend {
124134
font-weight: $font-weight-bold;
125135
float: left; // Required to be float: left to accommodate for help-text icon
136+
137+
@include rtl() {
138+
/*! @noflip */
139+
float: right;
140+
141+
/*! @noflip */
142+
padding-right: 0;
143+
}
126144
}
127145

128146
/**

ui/components/radio-group/RELEASENOTES.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44

55
<!-- ## [Unreleased] -->
66

7+
## 2.18.0
8+
9+
### Added
10+
11+
- Added styling changes to support radio group with help text icon.
12+
- Added examples: Required with help text icon and Right to left required with help text icon to documentation
13+
14+
### Fixed
15+
16+
- Right to left legend to be right aligned and match the alignment of content.
17+
718
## 2.17.5
819

920
### Fixed

ui/components/radio-group/base/_index.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,17 @@
151151
.slds-radio [type='radio'] + .slds-radio__label .slds-radio_faux,
152152
.slds-radio [type='radio'] + .slds-radio__label .slds-radio--faux {
153153
margin-right: $spacing-x-small;
154+
155+
@include rtl() {
156+
/*! @noflip */
157+
margin-right: 0;
158+
margin-left: $spacing-x-small;
159+
}
160+
}
161+
162+
.slds-radio .slds-form-element__label {
163+
@include rtl() {
164+
/*! @noflip */
165+
padding-right: 0;
166+
}
154167
}

ui/components/radio-group/base/example.jsx

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import PropTypes from 'prop-types';
66
import classNames from 'classnames';
77
import _ from '../../../shared/helpers';
88
import { FormElementControl } from '../../form-element/';
9+
import ButtonIcon from '../../button-icons/';
10+
911

1012
/// ////////////////////////////////////////
1113
// Partial(s)
@@ -183,6 +185,30 @@ export let states = [
183185
</Fieldset>
184186
)
185187
},
188+
{
189+
id: 'required-help-text-icon',
190+
label: 'Required with Help Text Icon',
191+
element: (
192+
<Fieldset>
193+
<Legend>
194+
<abbr className="slds-required" title="required">
195+
*
196+
</abbr>{' '}
197+
Radio Group Label
198+
</Legend>
199+
<div className="slds-form-element__icon">
200+
<ButtonIcon
201+
symbol="info"
202+
assistiveText="Help"
203+
/>
204+
</div>
205+
<FormElementControl>
206+
<Radio checked label="Radio Label One" />
207+
<Radio label="Radio Label Two" />
208+
</FormElementControl>
209+
</Fieldset>
210+
)
211+
},
186212
{
187213
id: 'rtl',
188214
label: 'Right to Left',
@@ -197,6 +223,32 @@ export let states = [
197223
</Fieldset>
198224
</div>
199225
)
226+
},
227+
{
228+
id: 'rtl-required-help-text-icon',
229+
label: 'Right to Left Required with Help Text Icon',
230+
element: (
231+
<div dir="rtl">
232+
<Fieldset>
233+
<Legend>
234+
<abbr className="slds-required" title="required">
235+
*
236+
</abbr>{' '}
237+
Radio Group Label
238+
</Legend>
239+
<div className="slds-form-element__icon">
240+
<ButtonIcon
241+
symbol="info"
242+
assistiveText="Help"
243+
/>
244+
</div>
245+
<FormElementControl>
246+
<Radio checked label="Radio Label One" name="rtl-required" />
247+
<Radio label="Radio Label Two" name="rtl-required" />
248+
</FormElementControl>
249+
</Fieldset>
250+
</div>
251+
)
200252
}
201253
];
202254

ui/components/radio-group/docs.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,18 @@ When disabling a radio button, either the entire group must be disabled or if on
5959

6060
<CodeView>{getDisplayElementById(Base.states, 'error')}</CodeView>
6161

62+
### Required with Help Text Icon
63+
64+
<CodeView>{getDisplayElementById(Base.states, 'required-help-text-icon')}</CodeView>
65+
6266
### Right to Left
6367

6468
<CodeView>{getDisplayElementById(Base.states, 'rtl')}</CodeView>
6569

70+
### Right to Left Required with Help Text Icon
71+
72+
<CodeView>{getDisplayElementById(Base.states, 'rtl-required-help-text-icon')}</CodeView>
73+
6674
## Styling Hooks Overview
6775

6876
<StylingHooksTable name="radio-group" type="component" />

0 commit comments

Comments
 (0)