diff --git a/.loki/reference/chrome_iphone7_Components_ChoiceList_Choice_Children.png b/.loki/reference/chrome_iphone7_Components_ChoiceList_Choice_Children.png new file mode 100644 index 0000000000..b78e708903 Binary files /dev/null and b/.loki/reference/chrome_iphone7_Components_ChoiceList_Choice_Children.png differ diff --git a/.loki/reference/chrome_laptop_Components_ChoiceList_Choice_Children.png b/.loki/reference/chrome_laptop_Components_ChoiceList_Choice_Children.png new file mode 100644 index 0000000000..1790b99931 Binary files /dev/null and b/.loki/reference/chrome_laptop_Components_ChoiceList_Choice_Children.png differ diff --git a/packages/design-system/src/components/ChoiceList/Choice.tsx b/packages/design-system/src/components/ChoiceList/Choice.tsx index d0c164297c..c6f70fb562 100644 --- a/packages/design-system/src/components/ChoiceList/Choice.tsx +++ b/packages/design-system/src/components/ChoiceList/Choice.tsx @@ -213,41 +213,41 @@ export class Choice extends React.PureComponent< 'ds-c-choice--small': size === 'small', }); - const choiceWrapperClasses = classNames(className, 'ds-c-choice-wrapper'); - // Remove props we have our own implementations for if (inputProps.id) delete inputProps.id; if (inputProps.onChange) delete inputProps.onChange; return (
- { - this.input = ref; - if (inputRef) { - inputRef(ref); - } - }} - {...inputProps} - /> - - {label || children} - +
+ { + this.input = ref; + if (inputRef) { + inputRef(ref); + } + }} + {...inputProps} + /> + + {label || children} + +
{this.checked() ? checkedChildren : uncheckedChildren}
); diff --git a/packages/design-system/src/components/ChoiceList/ChoiceList.stories.jsx b/packages/design-system/src/components/ChoiceList/ChoiceList.stories.jsx index 16abbdac9e..87f678149a 100644 --- a/packages/design-system/src/components/ChoiceList/ChoiceList.stories.jsx +++ b/packages/design-system/src/components/ChoiceList/ChoiceList.stories.jsx @@ -1,5 +1,5 @@ import React from 'react'; - +import { Alert } from '../Alert'; import ChoiceList from './ChoiceList'; import Choice from './Choice'; @@ -23,7 +23,7 @@ export default { { label: 'Disabled choice 3', value: 'C', disabled: true }, ], }, - subcomponents: { Choice }, + subcomponents: { Alert, Choice }, }; const Template = (args) => ; @@ -64,3 +64,35 @@ InverseOption.args = { InverseOption.parameters = { backgrounds: { default: process.env.STORYBOOK_DS === 'medicare' ? 'Mgov dark' : 'Hcgov dark' }, }; + +export const ChoiceChildren = Template.bind({}); +ChoiceChildren.args = { + name: 'radio_choices', + type: 'radio', + choices: [ + { + label: 'Choice 1', + value: 'A', + defaultChecked: true, + checkedChildren: ( + + Based on the household information you provided, this option will give you the maximum + savings. We are adding some filler text just to show what it looks like when you have a + long alert as the checkedChildren of a Choice component. + + ), + }, + { + label: 'Choice 2', + requirementLabel: 'Choice hint text', + value: 'B', + checkedChildren: ( + + Based on the household information you provided, you can actually save more with the other + option. You are free to change this at any point during the application process until you + have signed and submitted your final application. + + ), + }, + ], +}; diff --git a/packages/design-system/src/components/ChoiceList/__snapshots__/ChoiceList.test.tsx.snap b/packages/design-system/src/components/ChoiceList/__snapshots__/ChoiceList.test.tsx.snap index e6aa22acf0..b5fc4f4043 100644 --- a/packages/design-system/src/components/ChoiceList/__snapshots__/ChoiceList.test.tsx.snap +++ b/packages/design-system/src/components/ChoiceList/__snapshots__/ChoiceList.test.tsx.snap @@ -15,47 +15,51 @@ exports[`ChoiceList Radio buttons and Checkboxes is a radio button group 1`] = ` Foo -
- -
-
- -
diff --git a/packages/design-system/src/components/MonthPicker/__snapshots__/MonthPicker.test.jsx.snap b/packages/design-system/src/components/MonthPicker/__snapshots__/MonthPicker.test.jsx.snap index 9ac499c913..f4a18b4376 100644 --- a/packages/design-system/src/components/MonthPicker/__snapshots__/MonthPicker.test.jsx.snap +++ b/packages/design-system/src/components/MonthPicker/__snapshots__/MonthPicker.test.jsx.snap @@ -45,29 +45,33 @@ exports[`MonthPicker renders a snapshot 1`] = ` aria-atomic={null} aria-live={null} aria-relevant={null} - className="ds-c-month-picker__month ds-c-choice-wrapper" + className="ds-c-month-picker__month" > - - + + Jan + + +
  • @@ -75,29 +79,33 @@ exports[`MonthPicker renders a snapshot 1`] = ` aria-atomic={null} aria-live={null} aria-relevant={null} - className="ds-c-month-picker__month ds-c-choice-wrapper" + className="ds-c-month-picker__month" > - - + + Feb + + +
  • @@ -105,29 +113,33 @@ exports[`MonthPicker renders a snapshot 1`] = ` aria-atomic={null} aria-live={null} aria-relevant={null} - className="ds-c-month-picker__month ds-c-choice-wrapper" + className="ds-c-month-picker__month" > - - + + Mar + + +
  • @@ -135,29 +147,33 @@ exports[`MonthPicker renders a snapshot 1`] = ` aria-atomic={null} aria-live={null} aria-relevant={null} - className="ds-c-month-picker__month ds-c-choice-wrapper" + className="ds-c-month-picker__month" > - - + + Apr + + +
  • @@ -165,29 +181,33 @@ exports[`MonthPicker renders a snapshot 1`] = ` aria-atomic={null} aria-live={null} aria-relevant={null} - className="ds-c-month-picker__month ds-c-choice-wrapper" + className="ds-c-month-picker__month" > - - + + May + + +
  • @@ -195,29 +215,33 @@ exports[`MonthPicker renders a snapshot 1`] = ` aria-atomic={null} aria-live={null} aria-relevant={null} - className="ds-c-month-picker__month ds-c-choice-wrapper" + className="ds-c-month-picker__month" > - - + + Jun + + +
  • @@ -225,29 +249,33 @@ exports[`MonthPicker renders a snapshot 1`] = ` aria-atomic={null} aria-live={null} aria-relevant={null} - className="ds-c-month-picker__month ds-c-choice-wrapper" + className="ds-c-month-picker__month" > - - + + Jul + + +
  • @@ -255,29 +283,33 @@ exports[`MonthPicker renders a snapshot 1`] = ` aria-atomic={null} aria-live={null} aria-relevant={null} - className="ds-c-month-picker__month ds-c-choice-wrapper" + className="ds-c-month-picker__month" > - - + + Aug + + +
  • @@ -285,29 +317,33 @@ exports[`MonthPicker renders a snapshot 1`] = ` aria-atomic={null} aria-live={null} aria-relevant={null} - className="ds-c-month-picker__month ds-c-choice-wrapper" + className="ds-c-month-picker__month" > - - + + Sep + + +
  • @@ -315,29 +351,33 @@ exports[`MonthPicker renders a snapshot 1`] = ` aria-atomic={null} aria-live={null} aria-relevant={null} - className="ds-c-month-picker__month ds-c-choice-wrapper" + className="ds-c-month-picker__month" > - - + + Oct + + +
  • @@ -345,29 +385,33 @@ exports[`MonthPicker renders a snapshot 1`] = ` aria-atomic={null} aria-live={null} aria-relevant={null} - className="ds-c-month-picker__month ds-c-choice-wrapper" + className="ds-c-month-picker__month" > - - + + Nov + + +
  • @@ -375,29 +419,33 @@ exports[`MonthPicker renders a snapshot 1`] = ` aria-atomic={null} aria-live={null} aria-relevant={null} - className="ds-c-month-picker__month ds-c-choice-wrapper" + className="ds-c-month-picker__month" > - - + + Dec + + +
  • diff --git a/packages/design-system/src/styles/components/_Choice.scss b/packages/design-system/src/styles/components/_Choice.scss index a27ae37649..b0d9564c07 100644 --- a/packages/design-system/src/styles/components/_Choice.scss +++ b/packages/design-system/src/styles/components/_Choice.scss @@ -14,7 +14,8 @@ $ds-c-inset-border-width: $spacer-half; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0; - max-width: $input-max-width; + // max-width: $input-max-width; + max-width: $measure-base; } // Styles for label