Skip to content

Commit

Permalink
fix: change #radio group and #toggle-button group property from `dire…
Browse files Browse the repository at this point in the history
…ction` to `label_direction`
  • Loading branch information
tujoworker committed Jul 4, 2019
1 parent 9dcdc94 commit 6fe9a37
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ draft: true
| `status` | _(optional)_ uses the `form-status` component to show failure messages. |
| `status_state` | _(optional)_ defines the state of the status. Currently there are two statuses `[error, info]`. Defaults to `error`. |
| `label` | _(optional)_ use either the `label` property or provide custom one. |
| `direction` | _(optional)_ to define the `label` layout direction on how the next element should be placed on. Can be either `vertical` or `horizontal`. Defaults to `horizontal`. |
| `label_direction` | _(optional)_ to define the `label` layout direction on how the next element should be placed on. Can be either `vertical` or `horizontal`. Defaults to `horizontal`. |
| `vertical` | _(optional)_ is a short hand to define a `vertical` direction if set to `true`. |
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ draft: true
| `status` | _(optional)_ uses the `form-status` component to show failure messages. |
| `status_state` | _(optional)_ defines the state of the status. Currently there are two statuses `[error, info]`. Defaults to `error`. |
| `label` | _(optional)_ use either the `label` property or provide custom one. |
| `direction` | _(optional)_ to define the `label` layout direction on how the next element should be placed on. Can be either `vertical` or `horizontal`. Defaults to `horizontal`. |
| `label_direction` | _(optional)_ to define the `label` layout direction on how the next element should be placed on. Can be either `vertical` or `horizontal`. Defaults to `horizontal`. |
| `vertical` | _(optional)_ is a short hand to define a `vertical` direction if set to `true`. |
8 changes: 4 additions & 4 deletions packages/dnb-ui-lib/src/components/radio/RadioGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const propTypes = {
status_state: PropTypes.string,
status_animation: PropTypes.string,
layout_direction: PropTypes.oneOf(['column', 'row']),
direction: PropTypes.oneOf(['horizontal', 'vertical']),
label_direction: PropTypes.oneOf(['horizontal', 'vertical']),
vertical: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
value: PropTypes.string,
attributes: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
Expand Down Expand Up @@ -62,7 +62,7 @@ export const defaultProps = {
status: null,
status_state: 'error',
status_animation: null,
direction: 'horizontal',
label_direction: null,
vertical: null,
layout_direction: 'row',
value: null,
Expand Down Expand Up @@ -137,7 +137,7 @@ export default class RadioGroup extends PureComponent {
status,
status_state,
status_animation,
direction,
label_direction,
vertical,
layout_direction,
label,
Expand Down Expand Up @@ -196,7 +196,7 @@ export default class RadioGroup extends PureComponent {
id,
label,
label_id: id, // send the id along, so the FormRow component can use it
direction,
direction: label_direction,
vertical,
disabled,
no_fieldset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ exports[`Radio group component have to match group snapshot 1`] = `
className={null}
custom_element={null}
custom_method={null}
direction="horizontal"
disabled={null}
id="group"
label="Label"
label_direction={null}
layout_direction="row"
name="group"
no_fieldset={true}
Expand All @@ -121,7 +121,7 @@ exports[`Radio group component have to match group snapshot 1`] = `
<FormRow
class={null}
className={null}
direction="horizontal"
direction={null}
disabled={null}
id="group"
label="Label"
Expand All @@ -136,7 +136,7 @@ exports[`Radio group component have to match group snapshot 1`] = `
>
<Fieldset>
<div
className="dnb-form-row dnb-form-row--horizontal"
className="dnb-form-row"
>
<FormLabel
class={null}
Expand All @@ -152,13 +152,13 @@ exports[`Radio group component have to match group snapshot 1`] = `
vertical={null}
>
<Element
className="dnb-form-label dnb-form-label--horizontal dnb-form-row__label"
className="dnb-form-label dnb-form-row__label"
htmlFor="group"
id="group-label"
is="label"
>
<label
className="dnb-form-label dnb-form-label--horizontal dnb-form-row__label"
className="dnb-form-label dnb-form-row__label"
htmlFor="group"
id="group-label"
>
Expand Down Expand Up @@ -215,14 +215,14 @@ exports[`Radio group component have to match group snapshot 1`] = `
>
<Element
aria-hidden={true}
className="dnb-form-label dnb-form-label--horizontal"
className="dnb-form-label"
htmlFor="radio-1"
id="radio-1-label"
is="label"
>
<label
aria-hidden={true}
className="dnb-form-label dnb-form-label--horizontal"
className="dnb-form-label"
htmlFor="radio-1"
id="radio-1-label"
>
Expand Down Expand Up @@ -304,14 +304,14 @@ exports[`Radio group component have to match group snapshot 1`] = `
>
<Element
aria-hidden={true}
className="dnb-form-label dnb-form-label--horizontal"
className="dnb-form-label"
htmlFor="radio-2"
id="radio-2-label"
is="label"
>
<label
aria-hidden={true}
className="dnb-form-label dnb-form-label--horizontal"
className="dnb-form-label"
htmlFor="radio-2"
id="radio-2-label"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const propTypes = {
status_state: PropTypes.string,
status_animation: PropTypes.string,
layout_direction: PropTypes.oneOf(['column', 'row']),
direction: PropTypes.oneOf(['horizontal', 'vertical']),
label_direction: PropTypes.oneOf(['horizontal', 'vertical']),
vertical: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
value: PropTypes.string,
values: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
Expand Down Expand Up @@ -68,7 +68,7 @@ export const defaultProps = {
status: null,
status_state: 'error',
status_animation: null,
direction: 'horizontal',
label_direction: null,
vertical: null,
layout_direction: 'row',
value: null,
Expand Down Expand Up @@ -172,7 +172,7 @@ export default class ToggleButtonGroup extends PureComponent {
status,
status_state,
status_animation,
direction,
label_direction,
vertical,
layout_direction,
label,
Expand Down Expand Up @@ -250,7 +250,7 @@ export default class ToggleButtonGroup extends PureComponent {
id,
label,
label_id: id, // send the id along, so the FormRow component can use it
direction,
direction: label_direction,
vertical,
disabled
// status,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,10 @@ exports[`ToggleButton group component have to match group snapshot 1`] = `
className={null}
custom_element={null}
custom_method={null}
direction="horizontal"
disabled={null}
id="group"
label="Label"
label_direction={null}
layout_direction="row"
left_component={null}
multiselect={null}
Expand All @@ -290,7 +290,7 @@ exports[`ToggleButton group component have to match group snapshot 1`] = `
<FormRow
class={null}
className={null}
direction="horizontal"
direction={null}
disabled={null}
id="group"
label="Label"
Expand All @@ -308,7 +308,7 @@ exports[`ToggleButton group component have to match group snapshot 1`] = `
className="dnb-form-row__wrapper"
>
<div
className="dnb-form-row dnb-form-row--horizontal"
className="dnb-form-row"
>
<FormLabel
class={null}
Expand All @@ -324,12 +324,12 @@ exports[`ToggleButton group component have to match group snapshot 1`] = `
vertical={null}
>
<Element
className="dnb-form-label dnb-form-label--horizontal dnb-form-row__label"
className="dnb-form-label dnb-form-row__label"
id="group-label"
is="legend"
>
<legend
className="dnb-form-label dnb-form-label--horizontal dnb-form-row__label"
className="dnb-form-label dnb-form-row__label"
id="group-label"
>
Label
Expand Down
19 changes: 18 additions & 1 deletion packages/dnb-ui-lib/stories/components/Radio.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,31 @@ export default [
<Radio.Group
label="Vertical group with error:"
layout_direction="column"
vertical="true"
label_direction="vertical"
// vertical="true"
status="Error message Potenti viverra facilisi blandit sodales lorem est fusce pulvinar a imperdiet quis mi parturient mattis feugiat tellus ipsum magnis rutrum"
>
<Radio label="First" value="first" />
<Radio label="Second" value="second" />
<Radio label="Third" value="third" checked />
</Radio.Group>
</Box>
<Box>
<FormRow direction="vertical">
<Radio.Group label="Vertical with FormRow:">
<Radio label="First" value="first" />
<Radio label="Second" value="second" />
<Radio label="Third" value="third" checked />
</Radio.Group>
</FormRow>
</Box>
<Box>
<Radio.Group label="Vertical label:" label_direction="vertical">
<Radio label="First" value="first" />
<Radio label="Second" value="second" />
<Radio label="Third" value="third" checked />
</Radio.Group>
</Box>
<Box>
<Radio.Group
label="Group with error:"
Expand Down
3 changes: 2 additions & 1 deletion packages/dnb-ui-lib/stories/components/ToggleButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ export default [
<ToggleButton.Group
label="Vertical group with error:"
layout_direction="column"
vertical="true"
label_direction="vertical"
// vertical="true"
status="Error message Potenti viverra facilisi blandit sodales lorem est fusce pulvinar a imperdiet quis mi parturient mattis feugiat tellus ipsum magnis rutrum"
>
<ToggleButton text="First" value="first" />
Expand Down

0 comments on commit 6fe9a37

Please sign in to comment.