@thecb/components 9.2.9 → 9.2.10-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 (24) hide show
  1. package/dist/index.cjs.js +55 -34
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +55 -34
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/src/apps/checkout/pages/payment/sub-pages/payment-amount/PaymentAmount_old.js +49322 -0
  6. package/package.json +1 -1
  7. package/src/.DS_Store +0 -0
  8. package/src/components/.DS_Store +0 -0
  9. package/src/components/atoms/.DS_Store +0 -0
  10. package/src/components/atoms/icons/.DS_Store +0 -0
  11. package/src/components/atoms/icons/AccountNumberImage.js +0 -2
  12. package/src/components/atoms/icons/BankIcon.js +0 -2
  13. package/src/components/atoms/icons/CheckmarkIcon.js +0 -2
  14. package/src/components/atoms/icons/GenericCard.js +0 -2
  15. package/src/components/atoms/icons/GenericCardLarge.js +0 -2
  16. package/src/components/atoms/icons/RoutingNumberImage.js +0 -2
  17. package/src/components/molecules/account-and-routing-modal/AccountAndRoutingModal.js +2 -0
  18. package/src/components/molecules/modal/Modal.js +17 -1
  19. package/src/components/molecules/terms-and-conditions/TermsAndConditions.js +6 -1
  20. package/src/components/molecules/terms-and-conditions/TermsAndConditions.stories.js +10 -2
  21. package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV1.js +3 -1
  22. package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV2.js +3 -1
  23. package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.js +5 -1
  24. package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.stories.js +8 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "9.2.9",
3
+ "version": "9.2.10-beta.0",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
package/src/.DS_Store ADDED
Binary file
Binary file
Binary file
@@ -7,8 +7,6 @@ const AccountNumberImage = () => {
7
7
  width="371"
8
8
  height="164"
9
9
  viewBox="0 0 371 164"
10
- role="img"
11
- aria-label="A check with the account number highlighted in the bottom center"
12
10
  >
13
11
  <g fill="none" fillRule="evenodd" stroke="none" strokeWidth="1">
14
12
  <g transform="translate(-364 -546)">
@@ -8,8 +8,6 @@ export const BankIcon = () => {
8
8
  viewBox="0 0 28 18"
9
9
  fill="none"
10
10
  xmlns="http://www.w3.org/2000/svg"
11
- role="img"
12
- aria-label="Check Payment"
13
11
  >
14
12
  <path
15
13
  d="M0 2.25C0 1.00736 1.04467 0 2.33333 0H25.6667C26.9553 0 28 1.00736 28 2.25V15.75C28 16.9926 26.9553 18 25.6667 18H2.33333C1.04467 18 0 16.9926 0 15.75V2.25Z"
@@ -9,8 +9,6 @@ const CheckmarkIcon = () => (
9
9
  version="1.1"
10
10
  xmlns="http://www.w3.org/2000/svg"
11
11
  xmlnsXlink="http://www.w3.org/1999/xlink"
12
- role="img"
13
- aria-label="Successful payment, green checkmark"
14
12
  >
15
13
  <g
16
14
  id="Cityville-Checkout---Desktop---Logged-In"
@@ -7,8 +7,6 @@ const GenericCard = () => (
7
7
  viewBox="0 0 28 18"
8
8
  fill="none"
9
9
  xmlns="http://www.w3.org/2000/svg"
10
- role="img"
11
- aria-label="Card Payment"
12
10
  >
13
11
  <rect width="28" height="18" rx="2" fill="#15749D" />
14
12
  <path
@@ -8,8 +8,6 @@ const GenericCardLarge = () => {
8
8
  viewBox="0 0 36 24"
9
9
  fill="none"
10
10
  xmlns="http://www.w3.org/2000/svg"
11
- role="img"
12
- aria-label="Card Payment"
13
11
  >
14
12
  <rect width="36" height="24" rx="2" fill="#15749D" />
15
13
  <path
@@ -7,8 +7,6 @@ const RoutingNumberImage = () => {
7
7
  width="371"
8
8
  height="164"
9
9
  viewBox="0 0 371 164"
10
- role="img"
11
- aria-label="A check with the routing number highlighted in the lower left hand corner"
12
10
  >
13
11
  <g fill="none" fillRule="evenodd" stroke="none" strokeWidth="1">
14
12
  <g transform="translate(-365 -522)">
@@ -60,6 +60,8 @@ const AccountAndRoutingModal = ({
60
60
  weight={themeValues.fontWeight}
61
61
  hoverStyles={themeValues.modalLinkHoverFocus}
62
62
  extraStyles={`cursor: pointer;`}
63
+ role="button"
64
+ className="modal-trigger"
63
65
  >
64
66
  {link}
65
67
  </Text>
@@ -45,10 +45,13 @@ const Modal = ({
45
45
  isLoading,
46
46
  buttonExtraStyles,
47
47
  children,
48
- dataQa = null
48
+ dataQa = null,
49
+ initialFocusSelector = "",
50
+ modalName = ""
49
51
  }) => {
50
52
  const { isMobile } = useContext(ThemeContext);
51
53
  const modalContainerRef = useRef(null);
54
+
52
55
  return (
53
56
  <div ref={modalContainerRef} data-qa={dataQa}>
54
57
  {modalOpen && (
@@ -71,6 +74,9 @@ const Modal = ({
71
74
  overflow: "auto"
72
75
  }}
73
76
  underlayClickExits={underlayClickExits}
77
+ aria-modal={true}
78
+ aria-name={!!modalName.length ? modalName : modalHeaderText}
79
+ initialFocus={initialFocusSelector}
74
80
  >
75
81
  <Box
76
82
  padding="0"
@@ -125,6 +131,8 @@ const Modal = ({
125
131
  dataQa={cancelButtonText}
126
132
  extraStyles={buttonExtraStyles}
127
133
  className="modal-cancel-button"
134
+ role="button"
135
+ name={cancelButtonText}
128
136
  />
129
137
  </Box>
130
138
  <Box width="100%" padding="0">
@@ -139,6 +147,8 @@ const Modal = ({
139
147
  disabled={isContinueActionDisabled}
140
148
  extraStyles={buttonExtraStyles}
141
149
  className="modal-continue-button"
150
+ role="button"
151
+ name={continueButtonText}
142
152
  />
143
153
  </Box>
144
154
  </Stack>
@@ -157,6 +167,8 @@ const Modal = ({
157
167
  dataQa={cancelButtonText}
158
168
  extraStyles={buttonExtraStyles}
159
169
  className="modal-cancel-button"
170
+ role="button"
171
+ name={cancelButtonText}
160
172
  />
161
173
  <ButtonWithAction
162
174
  variant={
@@ -169,6 +181,8 @@ const Modal = ({
169
181
  disabled={isContinueActionDisabled}
170
182
  extraStyles={buttonExtraStyles}
171
183
  className="modal-continue-button"
184
+ role="button"
185
+ name={continueButtonText}
172
186
  />
173
187
  </Stack>
174
188
  )}
@@ -182,6 +196,8 @@ const Modal = ({
182
196
  dataQa={closeButtonText}
183
197
  extraStyles={buttonExtraStyles}
184
198
  className="modal-close-button"
199
+ role="button"
200
+ name={closeButtonText}
185
201
  />
186
202
  </Box>
187
203
  )}
@@ -8,7 +8,12 @@ const TermsAndConditions = ({ version = "v1", ...rest }) => {
8
8
  ? TermsAndConditionsControlV1
9
9
  : TermsAndConditionsControlV2;
10
10
 
11
- return <TermsAndConditionsControl {...rest} />;
11
+ return (
12
+ <TermsAndConditionsControl
13
+ initialFocusSelector="[role='button']:not(.modal-trigger)"
14
+ {...rest}
15
+ />
16
+ );
12
17
  };
13
18
 
14
19
  export default TermsAndConditions;
@@ -7,13 +7,21 @@ import { noop } from "../../../util/general";
7
7
 
8
8
  const groupId = "props";
9
9
 
10
+ const Terms = () => (
11
+ <p>
12
+ Terms and <a href="#">conditions</a> modal content.
13
+ </p>
14
+ );
15
+
10
16
  export const termsAndConditions = () => (
11
17
  <TermsAndConditions
12
18
  onCheck={noop}
13
19
  isChecked={boolean("isChecked", false, groupId)}
14
- html={text("html", "terms and conditions summary", groupId)}
15
- terms={text("terms", "terms and conditions modal text", groupId)}
20
+ html={text("html", "Terms and Conditions html", groupId)}
21
+ modalName="Terms and Conditions Modal"
22
+ terms={<Terms />}
16
23
  error={boolean("error", false, groupId)}
24
+ initialFocusSelector="[role='button']:not(.modal-trigger)"
17
25
  />
18
26
  );
19
27
 
@@ -10,7 +10,8 @@ const TermsAndConditionsControlV1 = ({
10
10
  html,
11
11
  terms,
12
12
  error = false,
13
- linkVariant
13
+ linkVariant,
14
+ initialFocusSelector = ""
14
15
  }) => {
15
16
  const [showTerms, toggleShowTerms] = useState(false);
16
17
  return (
@@ -33,6 +34,7 @@ const TermsAndConditionsControlV1 = ({
33
34
  isOpen={showTerms}
34
35
  toggleOpen={toggleShowTerms}
35
36
  linkVariant={linkVariant}
37
+ initialFocusSelector={initialFocusSelector}
36
38
  />
37
39
  )}
38
40
  </Stack>
@@ -26,7 +26,8 @@ const TermsAndConditionsControlV2 = ({
26
26
  modalVariant = "default",
27
27
  containerBackground = ATHENS_GREY,
28
28
  checkboxMargin = "4px 8px 4px 4px",
29
- modalTitle = "Terms and Conditions"
29
+ modalTitle = "Terms and Conditions",
30
+ initialFocusSelector = ""
30
31
  }) => {
31
32
  const [showTerms, toggleShowTerms] = useState(false);
32
33
  const standardBoxShadow = generateShadows().standard.base;
@@ -75,6 +76,7 @@ const TermsAndConditionsControlV2 = ({
75
76
  toggleOpen={toggleTerms}
76
77
  linkVariant={modalVariant}
77
78
  title={modalTitle}
79
+ initialFocusSelector={initialFocusSelector}
78
80
  />
79
81
  )}
80
82
  </Cluster>
@@ -15,7 +15,8 @@ const TermsAndConditionsModal = ({
15
15
  terms,
16
16
  variant,
17
17
  linkVariant = "p",
18
- themeValues
18
+ themeValues,
19
+ initialFocusSelector = ""
19
20
  }) => (
20
21
  <Modal
21
22
  modalOpen={isOpen}
@@ -42,6 +43,7 @@ const TermsAndConditionsModal = ({
42
43
  toggleAccepted(true);
43
44
  toggleOpen(false);
44
45
  }}
46
+ initialFocusSelector={initialFocusSelector}
45
47
  >
46
48
  <Text
47
49
  variant={linkVariant}
@@ -52,6 +54,8 @@ const TermsAndConditionsModal = ({
52
54
  weight={themeValues.fontWeight}
53
55
  hoverStyles={themeValues.modalLinkHoverFocus}
54
56
  extraStyles={`display: inline-block; width: fit-content; cursor: pointer`}
57
+ role="button" // This should always be a "button" since it opens a modal
58
+ className="modal-trigger"
55
59
  >
56
60
  {link}
57
61
  </Text>
@@ -20,17 +20,22 @@ const linkVariants = {
20
20
  pXL: "PXL"
21
21
  };
22
22
 
23
+ const Terms = () => (
24
+ <p>
25
+ Terms content with a <a href="#">link</a> that should NOT get initial focus.
26
+ Instead, the <code>Cancel</code> button below should.
27
+ </p>
28
+ );
23
29
  export const termsAndConditionsModal = () => (
24
30
  <TermsAndConditionsModal
25
31
  link={text("text", "Show modal", groupId)}
26
32
  title={text("title", "Title", groupId)}
27
33
  isOpen={boolean("isOpen", false, groupId)}
28
- // toggleOpen={setShowTerms}
29
- // toggleAccepted={toggleTermsAccepted}
30
34
  acceptText={text("acceptText", "Accept", groupId)}
31
- terms={text("terms", "terms and conditions", groupId)}
35
+ terms={<Terms />}
32
36
  variant={select("variants", variants, "default", groupId)}
33
37
  linkVariant={select("linkVariants", linkVariants, groupId)}
38
+ initialFocusSelector="[name='Cancel']"
34
39
  />
35
40
  );
36
41