@thecb/components 4.1.15 → 4.1.16-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.
- package/dist/index.cjs.js +201 -435
- package/package.json +1 -1
- package/src/components/atoms/checkbox/Checkbox.js +64 -49
- package/src/components/atoms/dropdown/Dropdown.js +2 -2
- package/src/components/atoms/form-select/FormSelect.js +6 -4
- package/src/components/atoms/form-select/FormSelect.styled.js +0 -17
- package/src/components/atoms/text/Text.js +2 -0
- package/src/components/molecules/account-and-routing-modal/AccountAndRoutingModal.js +14 -16
- package/src/components/molecules/account-and-routing-modal/AccountAndRoutingModal.theme.js +6 -11
- package/src/components/molecules/address-form/AddressForm.js +7 -27
- package/src/components/molecules/email-form/EmailForm.js +7 -27
- package/src/components/molecules/email-form/EmailForm.stories.js +4 -1
- package/src/components/molecules/modal/Modal.js +3 -3
- package/src/components/molecules/obligation/modules/AmountModule.stories.js +27 -0
- package/src/components/molecules/obligation/modules/AutopayModalModule.js +47 -38
- package/src/components/molecules/obligation/modules/AutopayModalModule.theme.js +12 -1
- package/src/components/molecules/payment-form-ach/PaymentFormACH.js +22 -57
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +7 -26
- package/src/components/molecules/phone-form/PhoneForm.js +7 -27
- package/src/components/molecules/terms-and-conditions/TermsAndConditions.js +15 -45
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.js +14 -15
- package/src/components/molecules/terms-and-conditions-modal/TermsAndConditionsModal.theme.js +1 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import styled, { css } from "styled-components";
|
|
3
3
|
import { fallbackValues } from "./Checkbox.theme";
|
|
4
4
|
import { noop } from "../../../util/general";
|
|
@@ -44,6 +44,7 @@ const HiddenCheckbox = styled.input.attrs({ type: "checkbox" })`
|
|
|
44
44
|
|
|
45
45
|
const StyledCheckbox = styled.div`
|
|
46
46
|
display: inline-block;
|
|
47
|
+
margin-right: 16px;
|
|
47
48
|
width: 24px;
|
|
48
49
|
height: 24px;
|
|
49
50
|
border-radius: 2px;
|
|
@@ -87,58 +88,72 @@ const Checkbox = ({
|
|
|
87
88
|
checked,
|
|
88
89
|
onChange = noop,
|
|
89
90
|
disabled = false,
|
|
90
|
-
focused = false,
|
|
91
91
|
themeValues,
|
|
92
92
|
hidden = false,
|
|
93
93
|
error = false
|
|
94
|
-
}) =>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
errorStyles={themeValues.errorStyles}
|
|
119
|
-
disabledStyles={themeValues.disabledStyles}
|
|
120
|
-
focusedStyles={themeValues.focusedStyles}
|
|
121
|
-
>
|
|
122
|
-
<CheckboxIcon
|
|
123
|
-
viewBox="0 0 24 24"
|
|
94
|
+
}) => {
|
|
95
|
+
const [focused, setFocused] = useState(false);
|
|
96
|
+
|
|
97
|
+
const handleClick = (e, func) => {
|
|
98
|
+
if (e?.keyCode === 13) {
|
|
99
|
+
func();
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<Box
|
|
105
|
+
padding="0"
|
|
106
|
+
tabIndex="0"
|
|
107
|
+
onFocus={() => setFocused(true)}
|
|
108
|
+
onBlur={() => setFocused(false)}
|
|
109
|
+
onKeyDown={e => handleClick(e, onChange)}
|
|
110
|
+
hiddenStyles={hidden}
|
|
111
|
+
background={themeValues.backgroundColor}
|
|
112
|
+
extraStyles="outline: none;"
|
|
113
|
+
>
|
|
114
|
+
<CheckboxLabelContainer>
|
|
115
|
+
<CheckboxContainer data-qa="Checkbox">
|
|
116
|
+
<HiddenCheckbox
|
|
117
|
+
id={`checkbox-${name}`}
|
|
124
118
|
disabled={disabled}
|
|
125
|
-
|
|
126
|
-
|
|
119
|
+
name={name}
|
|
120
|
+
aria-label={name}
|
|
121
|
+
checked={checked}
|
|
122
|
+
onChange={onChange}
|
|
123
|
+
tabIndex="-1"
|
|
124
|
+
/>
|
|
125
|
+
<StyledCheckbox
|
|
126
|
+
error={error}
|
|
127
|
+
disabled={disabled}
|
|
128
|
+
checked={checked}
|
|
129
|
+
focused={focused}
|
|
130
|
+
defaultStyles={themeValues.defaultStyles}
|
|
131
|
+
checkedStyles={themeValues.checkedStyles}
|
|
132
|
+
errorStyles={themeValues.errorStyles}
|
|
133
|
+
disabledStyles={themeValues.disabledStyles}
|
|
134
|
+
focusedStyles={themeValues.focusedStyles}
|
|
127
135
|
>
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
136
|
+
<CheckboxIcon
|
|
137
|
+
viewBox="0 0 24 24"
|
|
138
|
+
disabled={disabled}
|
|
139
|
+
disabledCheckColor={themeValues.disabledCheckColor}
|
|
140
|
+
checkColor={themeValues.checkColor}
|
|
141
|
+
>
|
|
142
|
+
<polyline points="20 6 9 17 4 12" />
|
|
143
|
+
</CheckboxIcon>
|
|
144
|
+
</StyledCheckbox>
|
|
145
|
+
</CheckboxContainer>
|
|
146
|
+
<Text
|
|
147
|
+
variant="p"
|
|
148
|
+
weight={themeValues.textFontWeight}
|
|
149
|
+
color={themeValues.textColor}
|
|
150
|
+
extraStyles={`margin-left: 1rem`}
|
|
151
|
+
>
|
|
152
|
+
{title}
|
|
153
|
+
</Text>
|
|
154
|
+
</CheckboxLabelContainer>
|
|
155
|
+
</Box>
|
|
156
|
+
);
|
|
157
|
+
};
|
|
143
158
|
|
|
144
159
|
export default themeComponent(Checkbox, "Checkbox", fallbackValues, "default");
|
|
@@ -201,7 +201,6 @@ const Dropdown = ({
|
|
|
201
201
|
<Box
|
|
202
202
|
onKeyDown={onKeyDown}
|
|
203
203
|
onClick={onClick}
|
|
204
|
-
tabIndex={0}
|
|
205
204
|
padding="0"
|
|
206
205
|
width="100%"
|
|
207
206
|
hoverStyles={`background-color: ${themeValues.hoverColor};`}
|
|
@@ -222,7 +221,8 @@ const Dropdown = ({
|
|
|
222
221
|
: GREY_CHATEAU
|
|
223
222
|
}
|
|
224
223
|
borderRadius="2px"
|
|
225
|
-
|
|
224
|
+
tabIndex={0}
|
|
225
|
+
extraStyles={`height: 48px;`}
|
|
226
226
|
dataQa={placeholder}
|
|
227
227
|
>
|
|
228
228
|
<Stack direction="row" bottomItem={2}>
|
|
@@ -2,10 +2,10 @@ import React, { useState, useRef, useEffect } from "react";
|
|
|
2
2
|
import Dropdown from "../dropdown";
|
|
3
3
|
import Text from "../text";
|
|
4
4
|
import { ERROR_COLOR } from "../../../constants/colors";
|
|
5
|
-
import { SelectContainer
|
|
5
|
+
import { SelectContainer } from "./FormSelect.styled";
|
|
6
6
|
import { fallbackValues } from "./FormSelect.theme";
|
|
7
7
|
import { themeComponent } from "../../../util/themeUtils";
|
|
8
|
-
import { Box, Cluster } from "../layouts";
|
|
8
|
+
import { Box, Cluster, Stack } from "../layouts";
|
|
9
9
|
|
|
10
10
|
const FormSelect = ({
|
|
11
11
|
fieldActions,
|
|
@@ -49,12 +49,14 @@ const FormSelect = ({
|
|
|
49
49
|
&::first-letter {
|
|
50
50
|
text-transform: uppercase;
|
|
51
51
|
}`}
|
|
52
|
+
id={labelTextWhenNoError.replace(/\s+/g, "-")}
|
|
52
53
|
>
|
|
53
54
|
{labelTextWhenNoError}
|
|
54
55
|
</Text>
|
|
55
56
|
</Cluster>
|
|
56
57
|
</Box>
|
|
57
58
|
<Dropdown
|
|
59
|
+
aria-labelledby={labelTextWhenNoError.replace(/\s+/g, "-")}
|
|
58
60
|
maxHeight={dropdownMaxHeight}
|
|
59
61
|
placeholder={options[0] ? options[0].text : ""}
|
|
60
62
|
options={options}
|
|
@@ -69,7 +71,7 @@ const FormSelect = ({
|
|
|
69
71
|
}
|
|
70
72
|
onClick={() => setOpen(!open)}
|
|
71
73
|
/>
|
|
72
|
-
<
|
|
74
|
+
<Stack direction="row" justify="space-between">
|
|
73
75
|
{(field.hasErrors && field.dirty) || (field.hasErrors && showErrors) ? (
|
|
74
76
|
<Text
|
|
75
77
|
color={ERROR_COLOR}
|
|
@@ -86,7 +88,7 @@ const FormSelect = ({
|
|
|
86
88
|
) : (
|
|
87
89
|
<Text extraStyles={`height: ${themeValues.lineHeight};`} />
|
|
88
90
|
)}
|
|
89
|
-
</
|
|
91
|
+
</Stack>
|
|
90
92
|
</SelectContainer>
|
|
91
93
|
);
|
|
92
94
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
import {
|
|
3
|
-
STORM_GREY,
|
|
4
3
|
GHOST_GREY,
|
|
5
4
|
ERROR_COLOR,
|
|
6
5
|
MATISSE_BLUE
|
|
@@ -18,22 +17,6 @@ export const SelectContainer = styled.div`
|
|
|
18
17
|
}
|
|
19
18
|
`;
|
|
20
19
|
|
|
21
|
-
export const SelectLabel = styled.label`
|
|
22
|
-
color: ${({ field, showErrors }) =>
|
|
23
|
-
(field.dirty && field.hasErrors) || (field.hasErrors && showErrors)
|
|
24
|
-
? ERROR_COLOR
|
|
25
|
-
: STORM_GREY};
|
|
26
|
-
font-size: 14px;
|
|
27
|
-
line-height: 18px;
|
|
28
|
-
font-weight: ${FONT_WEIGHT_REGULAR};
|
|
29
|
-
margin-bottom: 4px;
|
|
30
|
-
font-family: Public Sans;
|
|
31
|
-
|
|
32
|
-
&::first-letter {
|
|
33
|
-
text-transform: uppercase;
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
20
|
export const SelectField = styled.select`
|
|
38
21
|
border: 1px solid
|
|
39
22
|
${({ field, showErrors }) =>
|
|
@@ -13,6 +13,7 @@ const Text = ({
|
|
|
13
13
|
extraStyles = ``,
|
|
14
14
|
hoverStyles,
|
|
15
15
|
onClick,
|
|
16
|
+
onKeyPress,
|
|
16
17
|
as,
|
|
17
18
|
dataQa,
|
|
18
19
|
children,
|
|
@@ -27,6 +28,7 @@ const Text = ({
|
|
|
27
28
|
extraStyles={extraStyles}
|
|
28
29
|
hoverStyles={hoverStyles}
|
|
29
30
|
onClick={onClick}
|
|
31
|
+
onKeyPress={onKeyPress}
|
|
30
32
|
data-qa={dataQa}
|
|
31
33
|
{...rest}
|
|
32
34
|
>
|
|
@@ -16,24 +16,9 @@ const AccountAndRoutingModal = ({
|
|
|
16
16
|
acceptText,
|
|
17
17
|
content,
|
|
18
18
|
imageType,
|
|
19
|
-
variant,
|
|
20
19
|
themeValues
|
|
21
20
|
}) => (
|
|
22
21
|
<Modal
|
|
23
|
-
ModalLink={() => (
|
|
24
|
-
<Text
|
|
25
|
-
variant={variant === "default" ? "pS" : "pXS"}
|
|
26
|
-
onClick={() => toggleOpen(true)}
|
|
27
|
-
color={themeValues.linkColor}
|
|
28
|
-
weight={themeValues.fontWeight}
|
|
29
|
-
hoverStyles={themeValues.modalLinkHoverFocus}
|
|
30
|
-
extraStyles={`cursor: pointer;`}
|
|
31
|
-
tabIndex="0"
|
|
32
|
-
onKeyPress={e => e.key === "Enter" && toggleOpen(true)}
|
|
33
|
-
>
|
|
34
|
-
{link}
|
|
35
|
-
</Text>
|
|
36
|
-
)}
|
|
37
22
|
modalOpen={isOpen}
|
|
38
23
|
hideModal={() => toggleOpen(false)}
|
|
39
24
|
showModal={() => toggleOpen(true)}
|
|
@@ -63,7 +48,20 @@ const AccountAndRoutingModal = ({
|
|
|
63
48
|
toggleAccepted(true);
|
|
64
49
|
toggleOpen(false);
|
|
65
50
|
}}
|
|
66
|
-
|
|
51
|
+
>
|
|
52
|
+
<Text
|
|
53
|
+
variant="pS"
|
|
54
|
+
onClick={() => toggleOpen(true)}
|
|
55
|
+
onKeyPress={e => e.key === "Enter" && toggleOpen(true)}
|
|
56
|
+
tabIndex="0"
|
|
57
|
+
color={themeValues.linkColor}
|
|
58
|
+
weight={themeValues.fontWeight}
|
|
59
|
+
hoverStyles={themeValues.modalLinkHoverFocus}
|
|
60
|
+
extraStyles={`cursor: pointer;`}
|
|
61
|
+
>
|
|
62
|
+
{link}
|
|
63
|
+
</Text>
|
|
64
|
+
</Modal>
|
|
67
65
|
);
|
|
68
66
|
|
|
69
67
|
export default themeComponent(
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FONT_WEIGHT_REGULAR,
|
|
3
|
-
FONT_WEIGHT_SEMIBOLD
|
|
4
|
-
} from "../../../constants/style_constants";
|
|
1
|
+
import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
|
|
5
2
|
|
|
6
|
-
const linkColor = { default: "#357fb8"
|
|
7
|
-
const fontSize = { default: "1rem"
|
|
8
|
-
const lineHeight = { default: "1.5rem"
|
|
3
|
+
const linkColor = { default: "#357fb8" };
|
|
4
|
+
const fontSize = { default: "1rem" };
|
|
5
|
+
const lineHeight = { default: "1.5rem" };
|
|
9
6
|
const fontWeight = {
|
|
10
|
-
default: FONT_WEIGHT_REGULAR
|
|
11
|
-
footer: FONT_WEIGHT_SEMIBOLD
|
|
7
|
+
default: FONT_WEIGHT_REGULAR
|
|
12
8
|
};
|
|
13
9
|
const modalLinkHoverFocus = {
|
|
14
|
-
default:
|
|
15
|
-
footer: `outline: none; text-decoration: underline;`
|
|
10
|
+
default: `outline: none; text-decoration: underline;`
|
|
16
11
|
};
|
|
17
12
|
|
|
18
13
|
export const fallbackValues = {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React, { useEffect
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
2
|
import { required, hasLength } from "redux-freeform";
|
|
3
|
-
import styled from "styled-components";
|
|
4
3
|
import StateProvinceDropdown from "../../atoms/state-province-dropdown";
|
|
5
4
|
import Checkbox from "../../atoms/checkbox";
|
|
6
5
|
import CountryDropdown from "../../atoms/country-dropdown";
|
|
@@ -12,10 +11,6 @@ import {
|
|
|
12
11
|
FormInputColumn
|
|
13
12
|
} from "../../atoms/form-layouts";
|
|
14
13
|
|
|
15
|
-
const CheckboxWrapper = styled.div`
|
|
16
|
-
outline: none;
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
14
|
const AddressForm = ({
|
|
20
15
|
variant = "default",
|
|
21
16
|
fields,
|
|
@@ -27,13 +22,6 @@ const AddressForm = ({
|
|
|
27
22
|
saveToWallet,
|
|
28
23
|
walletCheckboxMarked
|
|
29
24
|
}) => {
|
|
30
|
-
const [checkboxFocused, focusCheckbox] = useState(false);
|
|
31
|
-
|
|
32
|
-
const handleClick = (e, func) => {
|
|
33
|
-
if (e?.keyCode === 13) {
|
|
34
|
-
func();
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
25
|
if (clearOnDismount) {
|
|
38
26
|
useEffect(() => () => actions.form.clear(), []);
|
|
39
27
|
}
|
|
@@ -120,20 +108,12 @@ const AddressForm = ({
|
|
|
120
108
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
121
109
|
/>
|
|
122
110
|
{showWalletCheckbox && (
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
<Checkbox
|
|
130
|
-
name="address checkbox"
|
|
131
|
-
title="Save address to wallet"
|
|
132
|
-
checked={walletCheckboxMarked}
|
|
133
|
-
onChange={saveToWallet}
|
|
134
|
-
focused={checkboxFocused}
|
|
135
|
-
/>
|
|
136
|
-
</CheckboxWrapper>
|
|
111
|
+
<Checkbox
|
|
112
|
+
name="address checkbox"
|
|
113
|
+
title="Save address to wallet"
|
|
114
|
+
checked={walletCheckboxMarked}
|
|
115
|
+
onChange={saveToWallet}
|
|
116
|
+
/>
|
|
137
117
|
)}
|
|
138
118
|
</FormInputColumn>
|
|
139
119
|
</FormContainer>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React, { useEffect
|
|
2
|
-
import styled from "styled-components";
|
|
1
|
+
import React, { useEffect } from "react";
|
|
3
2
|
import { required, isProbablyEmail } from "redux-freeform";
|
|
4
3
|
import {
|
|
5
4
|
FormInput,
|
|
@@ -10,10 +9,6 @@ import Checkbox from "../../atoms/checkbox";
|
|
|
10
9
|
import Paragraph from "../../atoms/paragraph";
|
|
11
10
|
import { noop } from "../../../util/general";
|
|
12
11
|
|
|
13
|
-
const CheckboxWrapper = styled.div`
|
|
14
|
-
outline: none;
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
12
|
const EmailForm = ({
|
|
18
13
|
variant = "default",
|
|
19
14
|
clearOnDismount,
|
|
@@ -26,13 +21,6 @@ const EmailForm = ({
|
|
|
26
21
|
saveToWallet,
|
|
27
22
|
walletCheckboxMarked
|
|
28
23
|
}) => {
|
|
29
|
-
const [checkboxFocused, focusCheckbox] = useState(false);
|
|
30
|
-
const handleClick = (e, func) => {
|
|
31
|
-
if (e?.keyCode === 13) {
|
|
32
|
-
func();
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
24
|
if (clearOnDismount) {
|
|
37
25
|
useEffect(() => () => actions.form.clear(), []);
|
|
38
26
|
}
|
|
@@ -59,20 +47,12 @@ const EmailForm = ({
|
|
|
59
47
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
60
48
|
/>
|
|
61
49
|
{showWalletCheckbox && (
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<Checkbox
|
|
69
|
-
name="email checkbox"
|
|
70
|
-
title="Save email address to wallet"
|
|
71
|
-
checked={walletCheckboxMarked}
|
|
72
|
-
onChange={saveToWallet}
|
|
73
|
-
focused={checkboxFocused}
|
|
74
|
-
/>
|
|
75
|
-
</CheckboxWrapper>
|
|
50
|
+
<Checkbox
|
|
51
|
+
name="email checkbox"
|
|
52
|
+
title="Save email address to wallet"
|
|
53
|
+
checked={walletCheckboxMarked}
|
|
54
|
+
onChange={saveToWallet}
|
|
55
|
+
/>
|
|
76
56
|
)}
|
|
77
57
|
</FormInputColumn>
|
|
78
58
|
</FormContainer>
|
|
@@ -20,5 +20,8 @@ const ConnectedForm = connect(
|
|
|
20
20
|
EmailFormState.mapDispatchToProps
|
|
21
21
|
)(EmailForm);
|
|
22
22
|
export const emailForm = () => (
|
|
23
|
-
<ConnectedForm
|
|
23
|
+
<ConnectedForm
|
|
24
|
+
showErrors={boolean("showErrors", false, "props")}
|
|
25
|
+
showWalletCheckbox={boolean("showWalletCheckbox", false, "props")}
|
|
26
|
+
/>
|
|
24
27
|
);
|
|
@@ -21,7 +21,6 @@ a different route (as with a link) connect() and use "push" from connected-react
|
|
|
21
21
|
const getApplicationNode = () => document.getElementById("root");
|
|
22
22
|
|
|
23
23
|
const Modal = ({
|
|
24
|
-
ModalLink,
|
|
25
24
|
hideModal,
|
|
26
25
|
continueAction,
|
|
27
26
|
cancelAction,
|
|
@@ -36,12 +35,12 @@ const Modal = ({
|
|
|
36
35
|
defaultWrapper = true,
|
|
37
36
|
onlyCloseButton = false,
|
|
38
37
|
maxHeight,
|
|
39
|
-
underlayClickExits = true
|
|
38
|
+
underlayClickExits = true,
|
|
39
|
+
children
|
|
40
40
|
}) => {
|
|
41
41
|
const { isMobile } = useContext(ThemeContext);
|
|
42
42
|
return (
|
|
43
43
|
<Fragment>
|
|
44
|
-
<ModalLink />
|
|
45
44
|
{modalOpen && (
|
|
46
45
|
<AriaModal
|
|
47
46
|
onExit={hideModal}
|
|
@@ -134,6 +133,7 @@ const Modal = ({
|
|
|
134
133
|
</Box>
|
|
135
134
|
</AriaModal>
|
|
136
135
|
)}
|
|
136
|
+
{children}
|
|
137
137
|
</Fragment>
|
|
138
138
|
);
|
|
139
139
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { text, boolean } from "@storybook/addon-knobs";
|
|
3
|
+
|
|
4
|
+
import AmountModule from "./AmountModule";
|
|
5
|
+
import page from "../../../../../.storybook/page";
|
|
6
|
+
import { noop } from "../../../../util/general";
|
|
7
|
+
|
|
8
|
+
const groupId = "props";
|
|
9
|
+
|
|
10
|
+
export const amountModule = () => (
|
|
11
|
+
<AmountModule
|
|
12
|
+
totalAmountDue={text("totalAmountDue", "123", groupId)}
|
|
13
|
+
autoPayEnabled={boolean("autopayEnabled", true, groupId)}
|
|
14
|
+
isMobile={boolean("isMobile", false, groupId)}
|
|
15
|
+
deactivatePaymentSchedule={noop}
|
|
16
|
+
navigateToSettings={noop}
|
|
17
|
+
autoPaySchedule={{}}
|
|
18
|
+
paymentPlanSchedule={{}}
|
|
19
|
+
isPaymentPlan={boolean("isPaymentPlan", false, groupId)}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const story = page({
|
|
24
|
+
title: "Components|Molecules/AmountModule",
|
|
25
|
+
Component: AmountModule
|
|
26
|
+
});
|
|
27
|
+
export default story;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Modal from "../../modal";
|
|
3
3
|
import ButtonWithAction from "../../../atoms/button-with-action";
|
|
4
|
+
import Text from "../../../atoms/text";
|
|
4
5
|
import { AutopayOnIcon } from "../../../atoms/icons";
|
|
5
6
|
import { Box, Cluster } from "../../../atoms/layouts";
|
|
6
7
|
import { fallbackValues } from "./AutopayModalModule.theme";
|
|
@@ -61,48 +62,56 @@ const AutopayModal = ({
|
|
|
61
62
|
`;
|
|
62
63
|
return (
|
|
63
64
|
<Modal
|
|
64
|
-
ModalLink={() =>
|
|
65
|
-
buttonLinkType ? (
|
|
66
|
-
<ButtonWithAction
|
|
67
|
-
text={autoPayActive ? `Manage ${planType}` : `Set Up ${planType}`}
|
|
68
|
-
variant="tertiary"
|
|
69
|
-
action={() => {
|
|
70
|
-
toggleModal(true);
|
|
71
|
-
}}
|
|
72
|
-
dataQa="Manage Autopay"
|
|
73
|
-
extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
|
|
74
|
-
/>
|
|
75
|
-
) : (
|
|
76
|
-
<Box
|
|
77
|
-
padding="0"
|
|
78
|
-
onClick={() => {
|
|
79
|
-
toggleModal(true);
|
|
80
|
-
}}
|
|
81
|
-
hoverStyles={hoverStyles}
|
|
82
|
-
activeStyles={activeStyles}
|
|
83
|
-
extraStyles={defaultStyles}
|
|
84
|
-
>
|
|
85
|
-
<Cluster
|
|
86
|
-
justify={isMobile ? "flex-start" : "flex-end"}
|
|
87
|
-
align="center"
|
|
88
|
-
>
|
|
89
|
-
<AutopayOnIcon />
|
|
90
|
-
<ButtonWithAction
|
|
91
|
-
text={`${planType} On`}
|
|
92
|
-
variant="smallGhost"
|
|
93
|
-
dataQa="Autopay On"
|
|
94
|
-
textExtraStyles={`font-size: 0.875rem; `}
|
|
95
|
-
extraStyles={`min-width: auto; padding: 0 0 0 6px;`}
|
|
96
|
-
/>
|
|
97
|
-
</Cluster>
|
|
98
|
-
</Box>
|
|
99
|
-
)
|
|
100
|
-
}
|
|
101
65
|
showModal={() => toggleModal(true)}
|
|
102
66
|
hideModal={() => toggleModal(false)}
|
|
103
67
|
modalOpen={modalOpen}
|
|
104
68
|
{...modalExtraProps}
|
|
105
|
-
|
|
69
|
+
>
|
|
70
|
+
{buttonLinkType ? (
|
|
71
|
+
<ButtonWithAction
|
|
72
|
+
text={autoPayActive ? `Manage ${planType}` : `Set Up ${planType}`}
|
|
73
|
+
variant="tertiary"
|
|
74
|
+
action={() => {
|
|
75
|
+
toggleModal(true);
|
|
76
|
+
}}
|
|
77
|
+
dataQa="Manage Autopay"
|
|
78
|
+
extraStyles={isMobile && `flex-grow: 1; width: 100%;`}
|
|
79
|
+
/>
|
|
80
|
+
) : (
|
|
81
|
+
<Box
|
|
82
|
+
padding="0"
|
|
83
|
+
onClick={() => {
|
|
84
|
+
toggleModal(true);
|
|
85
|
+
}}
|
|
86
|
+
hoverStyles={hoverStyles}
|
|
87
|
+
activeStyles={activeStyles}
|
|
88
|
+
extraStyles={defaultStyles}
|
|
89
|
+
>
|
|
90
|
+
<Cluster
|
|
91
|
+
justify={isMobile ? "flex-start" : "flex-end"}
|
|
92
|
+
align="center"
|
|
93
|
+
>
|
|
94
|
+
<AutopayOnIcon />
|
|
95
|
+
<Text
|
|
96
|
+
variant="pS"
|
|
97
|
+
onClick={() => toggleModal(true)}
|
|
98
|
+
onKeyPress={e => {
|
|
99
|
+
console.log({ e });
|
|
100
|
+
e.key === "Enter" && toggleModal(true);
|
|
101
|
+
}}
|
|
102
|
+
tabIndex="0"
|
|
103
|
+
dataQa={`${planType} On`}
|
|
104
|
+
color={themeValues.linkColor}
|
|
105
|
+
weight={themeValues.fontWeight}
|
|
106
|
+
hoverStyles={themeValues.modalLinkHoverFocus}
|
|
107
|
+
extraStyles={`padding: 0 0 0 6px;`}
|
|
108
|
+
>
|
|
109
|
+
{`${planType} On`}
|
|
110
|
+
</Text>
|
|
111
|
+
</Cluster>
|
|
112
|
+
</Box>
|
|
113
|
+
)}
|
|
114
|
+
</Modal>
|
|
106
115
|
);
|
|
107
116
|
};
|
|
108
117
|
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
+
import { FONT_WEIGHT_REGULAR } from "../../../../constants/style_constants";
|
|
2
|
+
|
|
1
3
|
const color = "#15749D";
|
|
2
4
|
const hoverColor = "#116285";
|
|
3
5
|
const activeColor = "#0E506D";
|
|
6
|
+
const linkColor = "#357fb8";
|
|
7
|
+
const fontWeight = FONT_WEIGHT_REGULAR;
|
|
8
|
+
const modalLinkHoverFocus = `outline: none;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
text-decoration: underline;
|
|
11
|
+
text-decoration-color: #357fb8;`;
|
|
4
12
|
|
|
5
13
|
export const fallbackValues = {
|
|
6
14
|
color,
|
|
7
15
|
hoverColor,
|
|
8
|
-
activeColor
|
|
16
|
+
activeColor,
|
|
17
|
+
linkColor,
|
|
18
|
+
fontWeight,
|
|
19
|
+
modalLinkHoverFocus
|
|
9
20
|
};
|