@thecb/components 7.8.2 → 7.8.3-beta.1
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 +214 -197
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +214 -197
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/payment-form-ach/PaymentFormACH.js +33 -8
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +35 -10
- package/src/components/molecules/terms-and-conditions/TermsAndConditions.js +3 -1
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.js +3 -2
package/package.json
CHANGED
|
@@ -14,6 +14,9 @@ import {
|
|
|
14
14
|
} from "../../atoms/form-layouts";
|
|
15
15
|
import AccountAndRoutingModal from "../account-and-routing-modal";
|
|
16
16
|
import { noop } from "../../../util/general";
|
|
17
|
+
import { Cluster, Cover } from "../../atoms/layouts";
|
|
18
|
+
import TermsAndConditionsModal from "../terms-and-conditions-modal/TermsAndConditionsModal";
|
|
19
|
+
import Text from "../../atoms/text";
|
|
17
20
|
|
|
18
21
|
const PaymentFormACH = ({
|
|
19
22
|
variant = "default",
|
|
@@ -28,13 +31,17 @@ const PaymentFormACH = ({
|
|
|
28
31
|
handleSubmit = noop,
|
|
29
32
|
showWalletCheckbox,
|
|
30
33
|
saveToWallet,
|
|
31
|
-
walletCheckboxMarked
|
|
34
|
+
walletCheckboxMarked,
|
|
35
|
+
termsContent,
|
|
36
|
+
termsTitle = "Terms & Conditions"
|
|
32
37
|
}) => {
|
|
33
38
|
if (clearOnDismount) {
|
|
34
39
|
useEffect(() => () => actions.form.clear(), []);
|
|
35
40
|
}
|
|
36
41
|
const [showRouting, toggleShowRouting] = useState(false);
|
|
37
42
|
const [showAccount, toggleShowAccount] = useState(false);
|
|
43
|
+
const [termsModalOpen, setTermsModalOpen] = useState(false);
|
|
44
|
+
const showTerms = !!termsContent;
|
|
38
45
|
|
|
39
46
|
const nameErrors = {
|
|
40
47
|
[required.error]: "Name is required"
|
|
@@ -153,13 +160,31 @@ const PaymentFormACH = ({
|
|
|
153
160
|
hidden={hideDefaultPayment}
|
|
154
161
|
/>
|
|
155
162
|
)}
|
|
156
|
-
{showWalletCheckbox && (
|
|
157
|
-
<
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
+
{(showWalletCheckbox || showTerms) && (
|
|
164
|
+
<Cluster childGap={"4px"}>
|
|
165
|
+
{showWalletCheckbox && (
|
|
166
|
+
<Checkbox
|
|
167
|
+
name="bank checkbox"
|
|
168
|
+
title="Save checking account to wallet."
|
|
169
|
+
checked={walletCheckboxMarked}
|
|
170
|
+
onChange={saveToWallet}
|
|
171
|
+
/>
|
|
172
|
+
)}
|
|
173
|
+
{showTerms && (
|
|
174
|
+
<Cover singleChild>
|
|
175
|
+
<Cluster childGap={0}>
|
|
176
|
+
<Text>View </Text>
|
|
177
|
+
<TermsAndConditionsModal
|
|
178
|
+
link={termsTitle}
|
|
179
|
+
terms={termsContent}
|
|
180
|
+
title={termsTitle}
|
|
181
|
+
isOpen={termsModalOpen}
|
|
182
|
+
toggleOpen={setTermsModalOpen}
|
|
183
|
+
/>
|
|
184
|
+
</Cluster>
|
|
185
|
+
</Cover>
|
|
186
|
+
)}
|
|
187
|
+
</Cluster>
|
|
163
188
|
)}
|
|
164
189
|
</FormInputColumn>
|
|
165
190
|
</FormContainer>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useContext } from "react";
|
|
1
|
+
import React, { useEffect, useContext, useState } from "react";
|
|
2
2
|
import { ThemeContext } from "styled-components";
|
|
3
3
|
import {
|
|
4
4
|
required,
|
|
@@ -26,8 +26,10 @@ import {
|
|
|
26
26
|
FormContainer,
|
|
27
27
|
FormInputRow
|
|
28
28
|
} from "../../atoms/form-layouts";
|
|
29
|
-
import { Box } from "../../atoms/layouts";
|
|
29
|
+
import { Box, Cluster, Cover } from "../../atoms/layouts";
|
|
30
30
|
import withWindowSize from "../../withWindowSize";
|
|
31
|
+
import TermsAndConditionsModal from "../terms-and-conditions-modal/TermsAndConditionsModal";
|
|
32
|
+
import Text from "../../atoms/text";
|
|
31
33
|
|
|
32
34
|
const PaymentFormCard = ({
|
|
33
35
|
variant = "default",
|
|
@@ -40,9 +42,14 @@ const PaymentFormCard = ({
|
|
|
40
42
|
showWalletCheckbox,
|
|
41
43
|
saveToWallet,
|
|
42
44
|
walletCheckboxMarked,
|
|
43
|
-
deniedCards
|
|
45
|
+
deniedCards,
|
|
46
|
+
termsContent,
|
|
47
|
+
termsTitle = "Terms & Conditions"
|
|
44
48
|
}) => {
|
|
45
49
|
const { isMobile } = useContext(ThemeContext);
|
|
50
|
+
const [termsModalOpen, setTermsModalOpen] = useState(false);
|
|
51
|
+
const showTerms = !!termsContent;
|
|
52
|
+
|
|
46
53
|
useEffect(() => {
|
|
47
54
|
if (deniedCards) {
|
|
48
55
|
deniedCards.map(card =>
|
|
@@ -177,13 +184,31 @@ const PaymentFormCard = ({
|
|
|
177
184
|
/>
|
|
178
185
|
</Box>
|
|
179
186
|
)}
|
|
180
|
-
{showWalletCheckbox && (
|
|
181
|
-
<
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
+
{(showWalletCheckbox || showTerms) && (
|
|
188
|
+
<Cluster childGap={"4px"}>
|
|
189
|
+
{showWalletCheckbox && (
|
|
190
|
+
<Checkbox
|
|
191
|
+
name="credit card checkbox"
|
|
192
|
+
title="Save credit card to wallet."
|
|
193
|
+
checked={walletCheckboxMarked}
|
|
194
|
+
onChange={saveToWallet}
|
|
195
|
+
/>
|
|
196
|
+
)}
|
|
197
|
+
{showTerms && (
|
|
198
|
+
<Cover singleChild>
|
|
199
|
+
<Cluster childGap={0}>
|
|
200
|
+
<Text>View </Text>
|
|
201
|
+
<TermsAndConditionsModal
|
|
202
|
+
link={termsTitle}
|
|
203
|
+
terms={termsContent}
|
|
204
|
+
title={termsTitle}
|
|
205
|
+
isOpen={termsModalOpen}
|
|
206
|
+
toggleOpen={setTermsModalOpen}
|
|
207
|
+
/>
|
|
208
|
+
</Cluster>
|
|
209
|
+
</Cover>
|
|
210
|
+
)}
|
|
211
|
+
</Cluster>
|
|
187
212
|
)}
|
|
188
213
|
</FormInputColumn>
|
|
189
214
|
</FormContainer>
|
|
@@ -9,7 +9,8 @@ const TermsAndConditions = ({
|
|
|
9
9
|
isChecked,
|
|
10
10
|
html,
|
|
11
11
|
terms,
|
|
12
|
-
error = false
|
|
12
|
+
error = false,
|
|
13
|
+
linkVariant
|
|
13
14
|
}) => {
|
|
14
15
|
const [showTerms, toggleShowTerms] = useState(false);
|
|
15
16
|
return (
|
|
@@ -31,6 +32,7 @@ const TermsAndConditions = ({
|
|
|
31
32
|
terms={terms}
|
|
32
33
|
isOpen={showTerms}
|
|
33
34
|
toggleOpen={toggleShowTerms}
|
|
35
|
+
linkVariant={linkVariant}
|
|
34
36
|
/>
|
|
35
37
|
)}
|
|
36
38
|
</Stack>
|
|
@@ -14,6 +14,7 @@ const TermsAndConditionsModal = ({
|
|
|
14
14
|
acceptText,
|
|
15
15
|
terms,
|
|
16
16
|
variant,
|
|
17
|
+
linkVariant = "p",
|
|
17
18
|
themeValues
|
|
18
19
|
}) => (
|
|
19
20
|
<Modal
|
|
@@ -42,14 +43,14 @@ const TermsAndConditionsModal = ({
|
|
|
42
43
|
}}
|
|
43
44
|
>
|
|
44
45
|
<Text
|
|
45
|
-
variant={
|
|
46
|
+
variant={linkVariant}
|
|
46
47
|
onClick={() => toggleOpen(true)}
|
|
47
48
|
onKeyPress={e => e.key === "Enter" && toggleOpen(true)}
|
|
48
49
|
tabIndex="0"
|
|
49
50
|
color={themeValues.linkColor}
|
|
50
51
|
weight={themeValues.fontWeight}
|
|
51
52
|
hoverStyles={themeValues.modalLinkHoverFocus}
|
|
52
|
-
extraStyles={`display: inline-block; width: fit-content
|
|
53
|
+
extraStyles={`display: inline-block; width: fit-content; cursor: pointer`}
|
|
53
54
|
>
|
|
54
55
|
{link}
|
|
55
56
|
</Text>
|