@thecb/components 9.3.3-beta.20 → 9.3.3
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.
- package/dist/index.cjs.js +2954 -3044
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +2954 -3044
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/account-and-routing-modal/AccountAndRoutingModal.js +3 -0
- package/src/components/molecules/modal/Modal.js +16 -1
- package/src/components/molecules/obligation/modules/AutopayModalModule.js +3 -13
- package/src/components/molecules/payment-form-ach/PaymentFormACH.js +1 -0
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +1 -0
- package/src/components/molecules/popover/Popover.js +2 -1
- package/src/components/molecules/radio-section/RadioSection.js +130 -294
- package/src/components/molecules/radio-section/RadioSection.stories.js +9 -70
- package/src/components/molecules/terms-and-conditions/TermsAndConditions.stories.js +19 -2
- package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV1.js +3 -1
- package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV2.js +3 -1
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.js +5 -1
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.stories.js +8 -3
- package/src/constants/index.js +1 -2
- package/src/constants/keyboard.js +3 -2
|
@@ -3,7 +3,6 @@ import { text, boolean } from "@storybook/addon-knobs";
|
|
|
3
3
|
|
|
4
4
|
import RadioSection from "./RadioSection";
|
|
5
5
|
import page from "../../../../.storybook/page";
|
|
6
|
-
import { Box } from "../../atoms/layouts";
|
|
7
6
|
|
|
8
7
|
const story = page({
|
|
9
8
|
title: "Components|Molecules/RadioSection",
|
|
@@ -44,46 +43,6 @@ const cardIconsLabel = `Accepting ${cardIcons
|
|
|
44
43
|
? ` and ${cardIcon.altText}.`
|
|
45
44
|
: ` ` + cardIcon.altText
|
|
46
45
|
)}`;
|
|
47
|
-
const groupedSections = [
|
|
48
|
-
[
|
|
49
|
-
{
|
|
50
|
-
id: "new-card-section",
|
|
51
|
-
title: "Group 1: New Card",
|
|
52
|
-
content: <p>The form to add a credit card would go here.</p>,
|
|
53
|
-
rightIconsLabel: cardIconsLabel,
|
|
54
|
-
rightIcons: cardIcons,
|
|
55
|
-
required: true
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
id: "new-bank-section",
|
|
59
|
-
title: "Group 1: New Bank Account",
|
|
60
|
-
content: <p>The form to add a credit card would go here.</p>,
|
|
61
|
-
required: true
|
|
62
|
-
}
|
|
63
|
-
],
|
|
64
|
-
[
|
|
65
|
-
{
|
|
66
|
-
id: "bar",
|
|
67
|
-
title: "Group 2: Bar",
|
|
68
|
-
content: <div>Content 1</div>,
|
|
69
|
-
required: true
|
|
70
|
-
}
|
|
71
|
-
],
|
|
72
|
-
[
|
|
73
|
-
{
|
|
74
|
-
id: "bar",
|
|
75
|
-
title: "Group 3: Bar",
|
|
76
|
-
content: <div>Content 1</div>,
|
|
77
|
-
required: true
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
id: "baz",
|
|
81
|
-
title: "Group 3: Baz",
|
|
82
|
-
content: <div>Content 1</div>,
|
|
83
|
-
required: true
|
|
84
|
-
}
|
|
85
|
-
]
|
|
86
|
-
];
|
|
87
46
|
const sections = [
|
|
88
47
|
{
|
|
89
48
|
id: "new-card-section",
|
|
@@ -99,35 +58,15 @@ const sections = [
|
|
|
99
58
|
|
|
100
59
|
export const radioSection = () => {
|
|
101
60
|
const [openSection, setOpenSection] = useState("");
|
|
102
|
-
const [openGroupedSection, setOpenGroupedSection] = useState("");
|
|
103
61
|
return (
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
staggeredAnimation={boolean("staggeredAnimation", false, "props")}
|
|
114
|
-
sections={sections}
|
|
115
|
-
isSectionRequired={true}
|
|
116
|
-
/>
|
|
117
|
-
<Box />
|
|
118
|
-
<p>
|
|
119
|
-
Using <code>groupedSections</code>, a multidimensional array of
|
|
120
|
-
sections, instead of <code>sections</code> prop.
|
|
121
|
-
</p>
|
|
122
|
-
<RadioSection
|
|
123
|
-
isMobile={boolean("isMobile", false, "props")}
|
|
124
|
-
supportsTouch={boolean("isMobile", false, "props")}
|
|
125
|
-
toggleOpenSection={setOpenGroupedSection}
|
|
126
|
-
openSection={openGroupedSection}
|
|
127
|
-
staggeredAnimation={boolean("staggeredAnimation", false, "props")}
|
|
128
|
-
groupedSections={groupedSections}
|
|
129
|
-
isSectionRequired={true}
|
|
130
|
-
/>
|
|
131
|
-
</>
|
|
62
|
+
<RadioSection
|
|
63
|
+
isMobile={boolean("isMobile", false, "props")}
|
|
64
|
+
supportsTouch={boolean("isMobile", false, "props")}
|
|
65
|
+
toggleOpenSection={setOpenSection}
|
|
66
|
+
openSection={openSection}
|
|
67
|
+
staggeredAnimation={boolean("staggeredAnimation", false, "props")}
|
|
68
|
+
sections={sections}
|
|
69
|
+
isSectionRequired={true}
|
|
70
|
+
/>
|
|
132
71
|
);
|
|
133
72
|
};
|
|
@@ -7,14 +7,31 @@ import { noop } from "../../../util/general";
|
|
|
7
7
|
|
|
8
8
|
const groupId = "props";
|
|
9
9
|
|
|
10
|
+
const Terms = () => (
|
|
11
|
+
<p>
|
|
12
|
+
Modal Content: Elit voluptate cupidatat in pariatur anim in excepteur non.{" "}
|
|
13
|
+
<a href="#modal-bottom" id="focus-me">
|
|
14
|
+
Laboris elit laboris labore pariatur incididunt
|
|
15
|
+
</a>{" "}
|
|
16
|
+
proident occaecat laboris sit elit. Dolor irure enim adipisicing irure
|
|
17
|
+
consectetur dolor enim eiusmod elit eiusmod ut. Pariatur ut quis et pariatur
|
|
18
|
+
nulla nostrud sit esse. Veniam est occaecat cupidatat est nulla dolor minim
|
|
19
|
+
nostrud anim ea voluptate. modal content. Elit voluptate cupidatat in
|
|
20
|
+
pariatur anim in excepteur non. Laboris elit laboris labore pariatur
|
|
21
|
+
incididunt proident occaecat laboris sit elit. Dolor irure enim adipisicing
|
|
22
|
+
irure consectetur dolor enim eiusmod elit eiusmod ut. Pariatur ut quis et
|
|
23
|
+
pariatur nulla nostrud sit esse.
|
|
24
|
+
</p>
|
|
25
|
+
);
|
|
26
|
+
|
|
10
27
|
export const termsAndConditions = () => (
|
|
11
28
|
<TermsAndConditions
|
|
12
29
|
version={select("version", ["v1", "v2"], "v1", groupId)}
|
|
13
30
|
onCheck={noop}
|
|
14
31
|
isChecked={boolean("isChecked", false, groupId)}
|
|
15
|
-
|
|
16
|
-
terms={text("terms", "terms and conditions modal text", groupId)}
|
|
32
|
+
terms={<Terms />}
|
|
17
33
|
error={boolean("error", false, groupId)}
|
|
34
|
+
initialFocusSelector={text("initialFocusSelector", "#focus-me", groupId)}
|
|
18
35
|
description={text("description", "I definitely agree to the", groupId)}
|
|
19
36
|
/>
|
|
20
37
|
);
|
|
@@ -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>
|
|
@@ -28,7 +28,8 @@ const TermsAndConditionsControlV2 = ({
|
|
|
28
28
|
modalVariant = "default",
|
|
29
29
|
containerBackground = ATHENS_GREY,
|
|
30
30
|
checkboxMargin = "4px 8px 4px 4px",
|
|
31
|
-
modalTitle = "Terms and Conditions"
|
|
31
|
+
modalTitle = "Terms and Conditions",
|
|
32
|
+
initialFocusSelector = ""
|
|
32
33
|
}) => {
|
|
33
34
|
const [showTerms, toggleShowTerms] = useState(false);
|
|
34
35
|
const standardBoxShadow = generateShadows().standard.base;
|
|
@@ -79,6 +80,7 @@ const TermsAndConditionsControlV2 = ({
|
|
|
79
80
|
toggleOpen={toggleTerms}
|
|
80
81
|
linkVariant={modalVariant}
|
|
81
82
|
title={modalTitle}
|
|
83
|
+
initialFocusSelector={initialFocusSelector}
|
|
82
84
|
/>
|
|
83
85
|
)}
|
|
84
86
|
</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>
|
package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.stories.js
CHANGED
|
@@ -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={
|
|
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
|
|
package/src/constants/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export const ARROW_DOWN = 40;
|
|
2
1
|
export const ARROW_LEFT = 37;
|
|
3
|
-
export const ARROW_RIGHT = 39;
|
|
4
2
|
export const ARROW_UP = 38;
|
|
3
|
+
export const ARROW_RIGHT = 39;
|
|
4
|
+
export const ARROW_DOWN = 40;
|
|
5
5
|
export const ENTER = 13;
|
|
6
|
+
export const ESCAPE = 27;
|
|
6
7
|
export const SPACEBAR = 32;
|