@thecb/components 9.3.2-beta.1 → 9.3.4-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/index.cjs.js +153 -52
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.d.ts +3 -1
  4. package/dist/index.esm.js +153 -53
  5. package/dist/index.esm.js.map +1 -1
  6. package/package.json +1 -1
  7. package/src/.DS_Store +0 -0
  8. package/src/components/atoms/button-with-action/ButtonWithAction.js +76 -70
  9. package/src/components/atoms/checkbox/Checkbox.js +8 -1
  10. package/src/components/atoms/checkbox/Checkbox.stories.js +1 -0
  11. package/src/components/atoms/country-dropdown/CountryDropdown.js +2 -0
  12. package/src/components/atoms/dropdown/Dropdown.js +8 -5
  13. package/src/components/atoms/form-layouts/FormInput.js +3 -0
  14. package/src/components/atoms/form-select/FormSelect.js +3 -1
  15. package/src/components/atoms/icons/AccountNumberImage.js +2 -0
  16. package/src/components/atoms/icons/BankIcon.js +2 -0
  17. package/src/components/atoms/icons/CheckmarkIcon.js +2 -0
  18. package/src/components/atoms/icons/GenericCard.js +2 -0
  19. package/src/components/atoms/icons/GenericCardLarge.js +2 -0
  20. package/src/components/atoms/icons/KebabMenuIcon.d.ts +1 -0
  21. package/src/components/atoms/icons/KebabMenuIcon.js +38 -0
  22. package/src/components/atoms/icons/RoutingNumberImage.js +2 -0
  23. package/src/components/atoms/icons/TrashIcon.js +42 -40
  24. package/src/components/atoms/icons/icons.stories.js +3 -1
  25. package/src/components/atoms/icons/index.d.ts +1 -0
  26. package/src/components/atoms/icons/index.js +3 -1
  27. package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.js +3 -1
  28. package/src/components/molecules/address-form/AddressForm.js +5 -0
  29. package/src/components/molecules/email-form/EmailForm.js +3 -1
  30. package/src/components/molecules/modal/Modal.js +2 -1
  31. package/src/components/molecules/payment-form-ach/PaymentFormACH.js +6 -0
  32. package/src/components/molecules/payment-form-card/PaymentFormCard.js +5 -0
  33. package/src/components/molecules/phone-form/PhoneForm.js +3 -1
  34. package/src/components/molecules/popup-menu/PopupMenu.js +152 -0
  35. package/src/components/molecules/popup-menu/PopupMenu.stories.js +40 -0
  36. package/src/components/molecules/popup-menu/PopupMenu.styled.js +20 -0
  37. package/src/components/molecules/popup-menu/PopupMenu.theme.js +11 -0
  38. package/src/components/molecules/popup-menu/index.d.ts +25 -0
  39. package/src/components/molecules/popup-menu/index.js +3 -0
  40. package/src/components/molecules/popup-menu/popup-menu-item/PopupMenuItem.js +79 -0
  41. package/src/components/molecules/popup-menu/popup-menu-item/PopupMenuItem.styled.js +27 -0
  42. package/src/components/molecules/popup-menu/popup-menu-item/PopupMenuItem.theme.js +23 -0
  43. package/src/components/molecules/radio-section/RadioSection.js +9 -2
  44. package/src/components/molecules/radio-section/RadioSection.stories.js +4 -2
  45. package/src/components/molecules/radio-section/radio-button/RadioButton.js +3 -1
  46. package/src/components/molecules/terms-and-conditions/TermsAndConditions.stories.js +3 -1
  47. package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV2.js +4 -0
@@ -76,6 +76,7 @@ const PaymentFormACH = ({
76
76
  showErrors={showErrors}
77
77
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
78
78
  autocompleteValue="name"
79
+ isRequired={true}
79
80
  />
80
81
  <FormInput
81
82
  labelTextWhenNoError="Routing number"
@@ -97,6 +98,7 @@ const PaymentFormACH = ({
97
98
  />
98
99
  )}
99
100
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
101
+ isRequired={true}
100
102
  />
101
103
  <FormInput
102
104
  labelTextWhenNoError="Confirm routing number"
@@ -107,6 +109,7 @@ const PaymentFormACH = ({
107
109
  showErrors={showErrors}
108
110
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
109
111
  isNum
112
+ isRequired={true}
110
113
  />
111
114
  <FormInput
112
115
  labelTextWhenNoError="Account number"
@@ -128,6 +131,7 @@ const PaymentFormACH = ({
128
131
  />
129
132
  )}
130
133
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
134
+ isRequired={true}
131
135
  />
132
136
  <FormInput
133
137
  labelTextWhenNoError="Confirm account number"
@@ -137,6 +141,7 @@ const PaymentFormACH = ({
137
141
  fieldActions={actions.fields.confirmAccountNumber}
138
142
  showErrors={showErrors}
139
143
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
144
+ isRequired={true}
140
145
  isNum
141
146
  />
142
147
  {allowBankAccountType && (
@@ -152,6 +157,7 @@ const PaymentFormACH = ({
152
157
  showErrors={showErrors}
153
158
  errorMessages={accountTypeErrors}
154
159
  field={fields.accountType}
160
+ isRequired={true}
155
161
  />
156
162
  )}
157
163
  {!hideDefaultPayment && (
@@ -121,6 +121,7 @@ const PaymentFormCard = ({
121
121
  showErrors={showErrors}
122
122
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
123
123
  autocompleteValue="cc-name"
124
+ isRequired={true}
124
125
  />
125
126
  <FormInput
126
127
  labelTextWhenNoError="Credit card number"
@@ -133,6 +134,7 @@ const PaymentFormCard = ({
133
134
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
134
135
  isNum
135
136
  autocompleteValue="cc-number"
137
+ isRequired={true}
136
138
  />
137
139
  <FormInputRow
138
140
  breakpoint={isMobile ? "1000rem" : "21rem"}
@@ -150,6 +152,7 @@ const PaymentFormCard = ({
150
152
  isNum
151
153
  removeFromValue={/\//} // removes "/" from browser autofill
152
154
  autocompleteValue="cc-exp"
155
+ isRequired={true}
153
156
  />
154
157
  <FormInput
155
158
  labelTextWhenNoError="CVV"
@@ -166,6 +169,7 @@ const PaymentFormCard = ({
166
169
  }
167
170
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
168
171
  autocompleteValue="cc-csc"
172
+ isRequired={true}
169
173
  />
170
174
  </FormInputRow>
171
175
  {!hideZipCode && (
@@ -184,6 +188,7 @@ const PaymentFormCard = ({
184
188
  showErrors={showErrors}
185
189
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
186
190
  autocompleteValue="billing postal-code"
191
+ isRequired={true}
187
192
  />
188
193
  </Box>
189
194
  )}
@@ -19,7 +19,8 @@ const PhoneForm = ({
19
19
  handleSubmit = noop,
20
20
  showWalletCheckbox,
21
21
  saveToWallet,
22
- walletCheckboxMarked
22
+ walletCheckboxMarked,
23
+ isRequired = false
23
24
  }) => {
24
25
  if (clearOnDismount) {
25
26
  useEffect(() => () => actions.form.clear(), []);
@@ -43,6 +44,7 @@ const PhoneForm = ({
43
44
  autocompleteValue="tel-national"
44
45
  dataQa="Phone number"
45
46
  isNum={true}
47
+ isRequired={isRequired}
46
48
  />
47
49
  {showWalletCheckbox && (
48
50
  <Checkbox
@@ -0,0 +1,152 @@
1
+ import React, { useState, useRef, useEffect } from "react";
2
+ import { themeComponent } from "../../../util/themeUtils";
3
+ import Text from "../../atoms/text";
4
+ import { Box } from "../../atoms/layouts";
5
+ import PopupMenuItem from "./popup-menu-item/PopupMenuItem";
6
+ import { fallbackValues } from "./PopupMenu.theme";
7
+ import { PopupMenuContainer, PopupMenuTriggerButton } from "./PopupMenu.styled";
8
+
9
+ const PopupMenu = ({
10
+ menuId = "popup-menu",
11
+ menuItems = [],
12
+ themeValues,
13
+ triggerText = "trigger text",
14
+ hasIcon = false,
15
+ icon: Icon,
16
+ iconHelpText = "", // for screen-readers, required if using an icon for trigger
17
+ menuFocus,
18
+ containerExtraStyles,
19
+ textExtraStyles,
20
+ minWidth = "250px",
21
+ maxWidth = "300px",
22
+ height = "auto",
23
+ position,
24
+ transform = "none",
25
+ buttonExtraStyles,
26
+ popupExtraStyles
27
+ }) => {
28
+ const {
29
+ hoverColor,
30
+ activeColor,
31
+ menuTriggerColor,
32
+ backgroundColor
33
+ } = themeValues;
34
+ const { top = `${height}px`, right = "auto", bottom = "auto", left = "0" } =
35
+ position ?? {};
36
+ const [isMenuOpen, setIsMenuOpen] = useState(false);
37
+ const menuRef = useRef();
38
+ const triggerRef = useRef();
39
+ const toggleMenu = menuState => setIsMenuOpen(menuState);
40
+
41
+ useEffect(() => {
42
+ const checkIfClickedOutside = e => {
43
+ // If the menu is open and the clicked target is not within the menu or the trigger
44
+ if (
45
+ isMenuOpen &&
46
+ menuRef.current &&
47
+ !menuRef.current.contains(e.target) &&
48
+ triggerRef.current &&
49
+ !triggerRef.current.contains(e.target)
50
+ ) {
51
+ toggleMenu(false);
52
+ }
53
+ };
54
+
55
+ document.addEventListener("click", checkIfClickedOutside);
56
+
57
+ return () => {
58
+ document.removeEventListener("click", checkIfClickedOutside);
59
+ };
60
+ }, [isMenuOpen]);
61
+
62
+ return (
63
+ <PopupMenuContainer extraStyles={containerExtraStyles}>
64
+ <PopupMenuTriggerButton
65
+ ref={triggerRef}
66
+ action={() => {
67
+ toggleMenu(!isMenuOpen);
68
+ }}
69
+ onKeyDown={e => {
70
+ if (e.key === "Escape") {
71
+ toggleMenu(false);
72
+ }
73
+ }}
74
+ contentOverride
75
+ variant="smallGhost"
76
+ tabIndex="0"
77
+ id={menuId}
78
+ borderRadius="8px"
79
+ aria-haspopup="true"
80
+ aria-expanded={isMenuOpen}
81
+ aria-controls={`${menuId}-container`}
82
+ extraStyles={buttonExtraStyles}
83
+ >
84
+ {hasIcon && (
85
+ <>
86
+ <Icon />
87
+ <Box padding="0" srOnly>
88
+ <Text id={`btn${menuId}_info`}>{iconHelpText}</Text>
89
+ </Box>
90
+ </>
91
+ )}
92
+ {!hasIcon && (
93
+ <Text
94
+ color={menuTriggerColor}
95
+ extraStyles={`&:active { color: ${activeColor}; } &:hover { color: ${hoverColor} }; ${textExtraStyles}`}
96
+ >
97
+ {triggerText}
98
+ </Text>
99
+ )}
100
+ </PopupMenuTriggerButton>
101
+ <Box
102
+ as="div"
103
+ id={`${menuId}-container`}
104
+ ref={menuRef}
105
+ onKeyDown={e => {
106
+ if (e.key === "Escape") {
107
+ toggleMenu(false);
108
+ }
109
+ }}
110
+ background={backgroundColor}
111
+ borderRadius="8px"
112
+ boxShadow={`
113
+ 0px 7px 32px 0px rgba(41, 42, 51, 0.2),
114
+ 0px 1px 4px 0px rgba(41, 42, 51, 0.2),
115
+ 0px 1px 8px -1px rgba(41, 42, 51, 0.3);
116
+ `}
117
+ role="menu"
118
+ aria-labelledby={menuId}
119
+ tabIndex={menuFocus && isMenuOpen ? "0" : "-1"}
120
+ minWidth={minWidth}
121
+ maxWidth={maxWidth}
122
+ extraStyles={`
123
+ display: ${isMenuOpen ? "block" : "none"};
124
+ position: absolute;
125
+ padding: 8px 8px 3px 8px;
126
+ top: ${top};
127
+ left: ${left};
128
+ right: ${right};
129
+ bottom: ${bottom};
130
+ height: ${height};
131
+ transform: ${transform};
132
+ ${popupExtraStyles};
133
+ `}
134
+ >
135
+ {menuItems.map((item, index) => (
136
+ <PopupMenuItem
137
+ key={index}
138
+ id={`${menuId}-item-${index}`}
139
+ closeMenuCallback={() => {
140
+ toggleMenu(false);
141
+ // focus back to trigger button when menu closes
142
+ triggerRef.current.focus();
143
+ }}
144
+ {...item}
145
+ />
146
+ ))}
147
+ </Box>
148
+ </PopupMenuContainer>
149
+ );
150
+ };
151
+
152
+ export default themeComponent(PopupMenu, "PopupMenu", fallbackValues);
@@ -0,0 +1,40 @@
1
+ import React from "react";
2
+ import { KebabMenuIcon, TrashIcon } from "../../atoms";
3
+ import PopupMenu from "./PopupMenu";
4
+ import page from "../../../../.storybook/page";
5
+ import { noop } from "../../../util/general";
6
+
7
+ const menuItems = [
8
+ {
9
+ text: "Account Details",
10
+ action: noop
11
+ },
12
+ {
13
+ text: "Remove",
14
+ action: noop,
15
+ isDeleteAction: true,
16
+ hasIcon: true,
17
+ icon: TrashIcon
18
+ }
19
+ ];
20
+
21
+ const story = page({
22
+ title: "Components|Molecules/PopupMenu",
23
+ Component: PopupMenu
24
+ });
25
+
26
+ export const popupMenu = () => (
27
+ <PopupMenu
28
+ hasIcon="true"
29
+ menuItems={menuItems}
30
+ icon={KebabMenuIcon}
31
+ minWidth={"50px"}
32
+ maxWidth={"208px"}
33
+ position={{ top: "0", left: "auto", right: "63px" }}
34
+ menuId={"menuId"}
35
+ containerExtraStyles={`margin-bottom: 100px;`}
36
+ buttonExtraStyles={`margin: 0 0 0 auto;`}
37
+ popupExtraStyles={`padding: 8px 8px 3px 8px;`}
38
+ />
39
+ );
40
+ export default story;
@@ -0,0 +1,20 @@
1
+ import styled from "styled-components";
2
+ import { ButtonWithAction } from "../../atoms";
3
+ import { Box } from "../../atoms";
4
+
5
+ export const PopupMenuContainer = styled(Box)`
6
+ display: flex;
7
+ position: relative;
8
+ padding: 0;
9
+ `;
10
+
11
+ export const PopupMenuTriggerButton = styled(ButtonWithAction)`
12
+ padding: 10px 15px;
13
+ min-width: auto;
14
+ &:active,
15
+ &:focus {
16
+ outline: none;
17
+ border: 1px solid rgba(196, 206, 244, 1);
18
+ background-color: rgba(235, 239, 251, 1);
19
+ }
20
+ `;
@@ -0,0 +1,11 @@
1
+ const hoverColor = "#116285";
2
+ const activeColor = "#0E506D";
3
+ const menuTriggerColor = "#15749D";
4
+ const backgroundColor = "white";
5
+
6
+ export const fallbackValues = {
7
+ hoverColor,
8
+ activeColor,
9
+ menuTriggerColor,
10
+ backgroundColor
11
+ };
@@ -0,0 +1,25 @@
1
+ import React, { ReactNode } from "react";
2
+ import Expand from "../../../util/expand";
3
+
4
+ export interface PopupMenuProps {
5
+ menuId?: string;
6
+ children?: ReactNode;
7
+ triggerText?: string | JSX.Element;
8
+ hasIcon?: boolean;
9
+ iconHelpText?: string; // for screen-readers, required if using an icon for trigger
10
+ menuFocus?: boolean;
11
+ containerExtraStyles?: string;
12
+ textExtraStyles?: string;
13
+ minWidth?: string;
14
+ maxWidth?: string;
15
+ height?: string;
16
+ position?: { top: string; right: string; bottom: string; left: string };
17
+ transform?: string;
18
+ disclosedExtraStyles?: string;
19
+ borderColor?: string;
20
+ backgroundColor?: string;
21
+ popupExtraStyles?: string;
22
+ }
23
+
24
+ export const PopupMenu: React.FC<Expand<PopupMenuProps> &
25
+ React.HTMLAttributes<HTMLElement>>;
@@ -0,0 +1,3 @@
1
+ import PopupMenu from "./PopupMenu";
2
+
3
+ export default PopupMenu;
@@ -0,0 +1,79 @@
1
+ import React from "react";
2
+ import { themeComponent } from "../../../../util/themeUtils";
3
+ import { Box, Text } from "../../../atoms";
4
+ import { fallbackValues } from "./PopupMenuItem.theme";
5
+ import { FONT_WEIGHT_SEMIBOLD } from "../../../../constants/style_constants";
6
+ import { PopupMenuItemContainer } from "./PopupMenuItem.styled";
7
+
8
+ const PopupMenuItem = ({
9
+ id,
10
+ closeMenuCallback,
11
+ action,
12
+ themeValues,
13
+ text,
14
+ hasIcon = false,
15
+ isDeleteAction = false,
16
+ icon: Icon,
17
+ textExtraStyles,
18
+ hoverStyles,
19
+ activeStyles,
20
+ extraStyles,
21
+ ...rest
22
+ }) => {
23
+ return (
24
+ <PopupMenuItemContainer
25
+ id={id}
26
+ role="menuItem"
27
+ text={text}
28
+ action={() => {
29
+ action();
30
+ closeMenuCallback();
31
+ }}
32
+ variant="smallGhost"
33
+ isDeleteAction={isDeleteAction}
34
+ theme={themeValues}
35
+ contentOverride
36
+ textExtraStyles={textExtraStyles}
37
+ hoverStyles={hoverStyles}
38
+ extraStyles={extraStyles}
39
+ activeStyles={`outline: none; ${activeStyles}`}
40
+ {...rest}
41
+ >
42
+ <Box
43
+ extraStyles={`
44
+ display: flex;
45
+ gap: 8px;
46
+ justify-content: center;
47
+ padding: 0;
48
+ `}
49
+ >
50
+ {hasIcon && (
51
+ <Icon
52
+ iconFill={
53
+ isDeleteAction
54
+ ? themeValues.menuItemColorDelete
55
+ : themeValues.menuItemColor
56
+ }
57
+ />
58
+ )}
59
+ {text && (
60
+ <Text
61
+ variant="pS"
62
+ weight={FONT_WEIGHT_SEMIBOLD}
63
+ fontFamily="Public Sans, sans-serif"
64
+ color={
65
+ isDeleteAction
66
+ ? themeValues.menuItemColorDelete
67
+ : themeValues.menuItemColor
68
+ }
69
+ extraStyles={textExtraStyles}
70
+ >
71
+ {text}
72
+ </Text>
73
+ )}
74
+ </Box>
75
+ </PopupMenuItemContainer>
76
+ );
77
+ };
78
+
79
+ export default themeComponent(PopupMenuItem, "PopupMenuItem", fallbackValues);
@@ -0,0 +1,27 @@
1
+ import styled from "styled-components";
2
+ import ButtonWithAction from "../../../atoms/button-with-action/ButtonWithAction";
3
+
4
+ export const PopupMenuItemContainer = styled(ButtonWithAction)`
5
+ width: 100%;
6
+ margin: 0;
7
+ padding: 17px 11px;
8
+ margin-bottom: 5px;
9
+ border: 0;
10
+ cursor: pointer;
11
+ text-decoration: none;
12
+ ${({ theme, isDeleteAction }) => `
13
+ background-color: ${theme.menuItemBackgroundColor};
14
+ color: ${isDeleteAction ? theme.menuItemColorDelete : theme.menuItemColor};
15
+ `}
16
+ &:hover,
17
+ &:active {
18
+ text-decoration: none;
19
+ ${({ theme, isDeleteAction }) => `
20
+ background-color: ${
21
+ isDeleteAction
22
+ ? theme.menuItemHoverBackgroundColorDelete
23
+ : theme.menuItemHoverBackgroundColor
24
+ };
25
+ `}
26
+ }
27
+ `;
@@ -0,0 +1,23 @@
1
+ import {
2
+ ROYAL_BLUE_VIVID,
3
+ CORNFLOWER_BLUE,
4
+ RAZZMATAZZ_RED,
5
+ BLUSH_RED,
6
+ WHITE
7
+ } from "../../../../constants/colors";
8
+
9
+ const menuItemBackgroundColor = WHITE;
10
+ const menuItemColor = ROYAL_BLUE_VIVID;
11
+ const menuItemColorDelete = RAZZMATAZZ_RED;
12
+ const menuItemHoverBackgroundColor = CORNFLOWER_BLUE;
13
+ const menuItemHoverBackgroundColorDelete = BLUSH_RED;
14
+ const menuItemHoverColor = ROYAL_BLUE_VIVID;
15
+
16
+ export const fallbackValues = {
17
+ menuItemBackgroundColor,
18
+ menuItemColor,
19
+ menuItemColorDelete,
20
+ menuItemHoverBackgroundColor,
21
+ menuItemHoverBackgroundColorDelete,
22
+ menuItemHoverColor
23
+ };
@@ -47,7 +47,8 @@ const RadioSection = ({
47
47
  initiallyOpen = true,
48
48
  openHeight = "auto",
49
49
  containerStyles = "",
50
- ariaDescribedBy
50
+ ariaDescribedBy,
51
+ isSectionRequired = false
51
52
  }) => {
52
53
  const handleKeyDown = (id, e) => {
53
54
  if (e?.keyCode === 13 || e?.keyCode === 32) {
@@ -105,7 +106,11 @@ const RadioSection = ({
105
106
  borderRadius="4px"
106
107
  extraStyles={containerStyles}
107
108
  >
108
- <Stack childGap="0" role="radiogroup">
109
+ <Stack
110
+ childGap="0"
111
+ aria-role="radiogroup"
112
+ aria-required={isSectionRequired}
113
+ >
109
114
  {sections
110
115
  .filter(section => !section.hidden)
111
116
  .map(section => (
@@ -124,6 +129,7 @@ const RadioSection = ({
124
129
  role="radio"
125
130
  aria-checked={openSection === section.id}
126
131
  aria-disabled={section.disabled}
132
+ aria-required={section?.required}
127
133
  >
128
134
  <Stack childGap="0">
129
135
  <Box
@@ -177,6 +183,7 @@ const RadioSection = ({
177
183
  : () => toggleOpenSection(section.id)
178
184
  }
179
185
  tabIndex="-1"
186
+ isRequired={section?.required}
180
187
  />
181
188
  </Box>
182
189
  )}
@@ -49,9 +49,10 @@ const sections = [
49
49
  title: "New Card",
50
50
  content: <p>The form to add a credit card would go here.</p>,
51
51
  rightIconsLabel: cardIconsLabel,
52
- rightIcons: cardIcons
52
+ rightIcons: cardIcons,
53
+ required: true
53
54
  },
54
- { id: "bar", title: "Bar", content: <div>Content 1</div> },
55
+ { id: "bar", title: "Bar", content: <div>Content 1</div>, required: true },
55
56
  { id: "baz", title: "Baz", content: <div>Content 2</div> }
56
57
  ];
57
58
 
@@ -65,6 +66,7 @@ export const radioSection = () => {
65
66
  openSection={openSection}
66
67
  staggeredAnimation={boolean("staggeredAnimation", false, "props")}
67
68
  sections={sections}
69
+ isSectionRequired={true}
68
70
  />
69
71
  );
70
72
  };
@@ -19,7 +19,8 @@ const RadioButton = ({
19
19
  ariaDescribedBy = "",
20
20
  themeValues,
21
21
  ariaLabelledBy = "",
22
- ariaLabel = null
22
+ ariaLabel = null,
23
+ isRequired = false
23
24
  }) => {
24
25
  const buttonBorder = {
25
26
  onFocused: {
@@ -93,6 +94,7 @@ const RadioButton = ({
93
94
  onClick={toggleRadio}
94
95
  aria-describedby={ariaDescribedBy}
95
96
  tabIndex="-1"
97
+ required={isRequired}
96
98
  {...extraProps}
97
99
  />
98
100
  <Motion
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { text, boolean } from "@storybook/addon-knobs";
2
+ import { text, boolean, select } from "@storybook/addon-knobs";
3
3
 
4
4
  import TermsAndConditions from "./TermsAndConditions";
5
5
  import page from "../../../../.storybook/page";
@@ -9,11 +9,13 @@ const groupId = "props";
9
9
 
10
10
  export const termsAndConditions = () => (
11
11
  <TermsAndConditions
12
+ version={select("version", ["v1", "v2"], "v1", groupId)}
12
13
  onCheck={noop}
13
14
  isChecked={boolean("isChecked", false, groupId)}
14
15
  html={text("html", "terms and conditions summary", groupId)}
15
16
  terms={text("terms", "terms and conditions modal text", groupId)}
16
17
  error={boolean("error", false, groupId)}
18
+ description={text("description", "I definitely agree to the", groupId)}
17
19
  />
18
20
  );
19
21
 
@@ -11,6 +11,8 @@ import {
11
11
  import { generateShadows } from "../../../util/generateShadows";
12
12
  import { useScrollTo } from "../../../hooks";
13
13
 
14
+ const TermsAndConditionsTitleDivId = "terms-and-conditions-title";
15
+
14
16
  const TermsAndConditionsControlV2 = ({
15
17
  showCheckbox = true,
16
18
  onCheck,
@@ -57,6 +59,7 @@ const TermsAndConditionsControlV2 = ({
57
59
  onChange={onCheck}
58
60
  checkboxMargin={checkboxMargin}
59
61
  extraStyles={`align-self: flex-start;`}
62
+ labelledById={TermsAndConditionsTitleDivId}
60
63
  />
61
64
  )}
62
65
  <Stack childGap="0.25rem" fullHeight>
@@ -65,6 +68,7 @@ const TermsAndConditionsControlV2 = ({
65
68
  align="center"
66
69
  nowrap
67
70
  extraStyles={`padding-right: 2px; > div > * { margin: 4px 2px; };`}
71
+ id={TermsAndConditionsTitleDivId}
68
72
  >
69
73
  {description && <Text color={CHARADE_GREY}>{description}</Text>}
70
74
  {terms && (