@thecb/components 4.1.13 → 4.1.14-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 +374 -514
- package/package.json +1 -1
- package/src/components/atoms/checkbox/Checkbox.js +63 -49
- package/src/components/atoms/dropdown/Dropdown.js +2 -2
- package/src/components/atoms/form-layouts/FormLayouts.theme.js +2 -2
- package/src/components/atoms/form-select/FormSelect.js +50 -15
- package/src/components/atoms/form-select/FormSelect.stories.js +4 -2
- package/src/components/atoms/form-select/FormSelect.styled.js +6 -6
- package/src/components/atoms/form-select/FormSelect.theme.js +52 -0
- 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 +12 -40
- 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";
|
|
@@ -87,58 +87,72 @@ const Checkbox = ({
|
|
|
87
87
|
checked,
|
|
88
88
|
onChange = noop,
|
|
89
89
|
disabled = false,
|
|
90
|
-
focused = false,
|
|
91
90
|
themeValues,
|
|
92
91
|
hidden = false,
|
|
93
92
|
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"
|
|
93
|
+
}) => {
|
|
94
|
+
const [focused, setFocused] = useState(false);
|
|
95
|
+
|
|
96
|
+
const handleClick = (e, func) => {
|
|
97
|
+
if (e?.keyCode === 13) {
|
|
98
|
+
func();
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<Box
|
|
104
|
+
padding="0"
|
|
105
|
+
tabIndex="0"
|
|
106
|
+
onFocus={() => setFocused(true)}
|
|
107
|
+
onBlur={() => setFocused(false)}
|
|
108
|
+
onKeyDown={e => handleClick(e, onChange)}
|
|
109
|
+
hiddenStyles={hidden}
|
|
110
|
+
background={themeValues.backgroundColor}
|
|
111
|
+
extraStyles="outline: none;"
|
|
112
|
+
>
|
|
113
|
+
<CheckboxLabelContainer>
|
|
114
|
+
<CheckboxContainer data-qa="Checkbox">
|
|
115
|
+
<HiddenCheckbox
|
|
116
|
+
id={`checkbox-${name}`}
|
|
124
117
|
disabled={disabled}
|
|
125
|
-
|
|
126
|
-
|
|
118
|
+
name={name}
|
|
119
|
+
aria-label={name}
|
|
120
|
+
checked={checked}
|
|
121
|
+
onChange={onChange}
|
|
122
|
+
tabIndex="-1"
|
|
123
|
+
/>
|
|
124
|
+
<StyledCheckbox
|
|
125
|
+
error={error}
|
|
126
|
+
disabled={disabled}
|
|
127
|
+
checked={checked}
|
|
128
|
+
focused={focused}
|
|
129
|
+
defaultStyles={themeValues.defaultStyles}
|
|
130
|
+
checkedStyles={themeValues.checkedStyles}
|
|
131
|
+
errorStyles={themeValues.errorStyles}
|
|
132
|
+
disabledStyles={themeValues.disabledStyles}
|
|
133
|
+
focusedStyles={themeValues.focusedStyles}
|
|
127
134
|
>
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
135
|
+
<CheckboxIcon
|
|
136
|
+
viewBox="0 0 24 24"
|
|
137
|
+
disabled={disabled}
|
|
138
|
+
disabledCheckColor={themeValues.disabledCheckColor}
|
|
139
|
+
checkColor={themeValues.checkColor}
|
|
140
|
+
>
|
|
141
|
+
<polyline points="20 6 9 17 4 12" />
|
|
142
|
+
</CheckboxIcon>
|
|
143
|
+
</StyledCheckbox>
|
|
144
|
+
</CheckboxContainer>
|
|
145
|
+
<Text
|
|
146
|
+
variant="p"
|
|
147
|
+
weight={themeValues.textFontWeight}
|
|
148
|
+
color={themeValues.textColor}
|
|
149
|
+
extraStyles={`margin-left: 1rem`}
|
|
150
|
+
>
|
|
151
|
+
{title}
|
|
152
|
+
</Text>
|
|
153
|
+
</CheckboxLabelContainer>
|
|
154
|
+
</Box>
|
|
155
|
+
);
|
|
156
|
+
};
|
|
143
157
|
|
|
144
158
|
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}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
CHARADE_GREY,
|
|
3
3
|
MATISSE_BLUE,
|
|
4
4
|
WHITE,
|
|
5
5
|
SEASHELL_WHITE,
|
|
@@ -23,7 +23,7 @@ const inputBackgroundColor = {
|
|
|
23
23
|
disabled: `${SEASHELL_WHITE}`
|
|
24
24
|
};
|
|
25
25
|
const color = { default: `${MINESHAFT_GREY}`, disabled: `${DUSTY_GREY}` };
|
|
26
|
-
const labelColor = { default: `${
|
|
26
|
+
const labelColor = { default: `${CHARADE_GREY}`, disabled: `${CHARADE_GREY}` };
|
|
27
27
|
const borderColor = { default: `${GREY_CHATEAU}`, disabled: `${GREY_CHATEAU}` };
|
|
28
28
|
const lineHeight = { default: "1rem", disabled: "1rem" };
|
|
29
29
|
const fontSize = { default: "0.875rem", disabled: "0.875rem" };
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect } from "react";
|
|
2
2
|
import Dropdown from "../dropdown";
|
|
3
3
|
import Text from "../text";
|
|
4
|
-
import {
|
|
4
|
+
import { ERROR_COLOR } from "../../../constants/colors";
|
|
5
5
|
import { SelectContainer, SelectLabel } from "./FormSelect.styled";
|
|
6
|
+
import { fallbackValues } from "./FormSelect.theme";
|
|
7
|
+
import { themeComponent } from "../../../util/themeUtils";
|
|
8
|
+
import { Box, Cluster } from "../layouts";
|
|
6
9
|
|
|
7
10
|
const FormSelect = ({
|
|
8
11
|
fieldActions,
|
|
@@ -12,7 +15,9 @@ const FormSelect = ({
|
|
|
12
15
|
field,
|
|
13
16
|
showErrors,
|
|
14
17
|
onChange,
|
|
15
|
-
dropdownMaxHeight
|
|
18
|
+
dropdownMaxHeight,
|
|
19
|
+
disabledValues,
|
|
20
|
+
themeValues
|
|
16
21
|
}) => {
|
|
17
22
|
const [open, setOpen] = useState(false);
|
|
18
23
|
const dropdownRef = useRef(null);
|
|
@@ -32,33 +37,63 @@ const FormSelect = ({
|
|
|
32
37
|
|
|
33
38
|
return (
|
|
34
39
|
<SelectContainer ref={dropdownRef}>
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
<Box padding="0" minWidth="100%">
|
|
41
|
+
<Cluster justify="space-between" align="center">
|
|
42
|
+
<Text
|
|
43
|
+
as="label"
|
|
44
|
+
variant="pS"
|
|
45
|
+
color={themeValues.labelColor}
|
|
46
|
+
weight={themeValues.fontWeight}
|
|
47
|
+
extraStyles={`word-break: break-word;
|
|
48
|
+
font-family: Public Sans;
|
|
49
|
+
&::first-letter {
|
|
50
|
+
text-transform: uppercase;
|
|
51
|
+
}`}
|
|
52
|
+
>
|
|
53
|
+
{labelTextWhenNoError}
|
|
54
|
+
</Text>
|
|
55
|
+
</Cluster>
|
|
56
|
+
</Box>
|
|
43
57
|
<Dropdown
|
|
44
58
|
maxHeight={dropdownMaxHeight}
|
|
45
59
|
placeholder={options[0] ? options[0].text : ""}
|
|
46
60
|
options={options}
|
|
47
61
|
value={field.rawValue}
|
|
62
|
+
disabledValues={disabledValues}
|
|
48
63
|
isOpen={open}
|
|
49
|
-
isError={
|
|
64
|
+
isError={
|
|
65
|
+
(field.hasErrors && field.dirty) || (field.hasErrors && showErrors)
|
|
66
|
+
}
|
|
50
67
|
onSelect={
|
|
51
68
|
onChange ? value => onChange(value) : value => fieldActions.set(value)
|
|
52
69
|
}
|
|
53
70
|
onClick={() => setOpen(!open)}
|
|
54
71
|
/>
|
|
55
72
|
<SelectLabel field={field} showErrors={showErrors}>
|
|
56
|
-
{(field.hasErrors && field.dirty) || (field.hasErrors && showErrors)
|
|
57
|
-
|
|
58
|
-
|
|
73
|
+
{(field.hasErrors && field.dirty) || (field.hasErrors && showErrors) ? (
|
|
74
|
+
<Text
|
|
75
|
+
color={ERROR_COLOR}
|
|
76
|
+
variant="pXS"
|
|
77
|
+
weight={themeValues.fontWeight}
|
|
78
|
+
extraStyles={`word-break: break-word;
|
|
79
|
+
font-family: Public Sans;
|
|
80
|
+
&::first-letter {
|
|
81
|
+
text-transform: uppercase;
|
|
82
|
+
}`}
|
|
83
|
+
>
|
|
84
|
+
{errorMessages[field.errors[0]]}
|
|
85
|
+
</Text>
|
|
86
|
+
) : (
|
|
87
|
+
<Text extraStyles={`height: ${themeValues.lineHeight};`} />
|
|
88
|
+
)}
|
|
59
89
|
</SelectLabel>
|
|
60
90
|
</SelectContainer>
|
|
61
91
|
);
|
|
62
92
|
};
|
|
63
93
|
|
|
64
|
-
export default
|
|
94
|
+
export default themeComponent(
|
|
95
|
+
FormSelect,
|
|
96
|
+
"FormSelect",
|
|
97
|
+
fallbackValues,
|
|
98
|
+
"default"
|
|
99
|
+
);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
|
-
import { boolean } from "@storybook/addon-knobs";
|
|
4
3
|
import { createFormState, required } from "redux-freeform";
|
|
5
4
|
|
|
6
5
|
import FormSelect from "./FormSelect";
|
|
@@ -18,7 +17,8 @@ const options = [
|
|
|
18
17
|
{ value: "", text: "choose name" },
|
|
19
18
|
{ value: "foo", text: "foo" },
|
|
20
19
|
{ value: "bar", text: "bar" },
|
|
21
|
-
{ value: "baz", text: "baz" }
|
|
20
|
+
{ value: "baz", text: "baz" },
|
|
21
|
+
{ value: "disabled", text: "disabled" }
|
|
22
22
|
];
|
|
23
23
|
|
|
24
24
|
const story = page({
|
|
@@ -32,10 +32,12 @@ const story = page({
|
|
|
32
32
|
|
|
33
33
|
const FormWrapper = ({ fields, actions }) => (
|
|
34
34
|
<FormSelect
|
|
35
|
+
labelTextWhenNoError="Form Select"
|
|
35
36
|
errorMessages={errorMessages}
|
|
36
37
|
options={options}
|
|
37
38
|
field={fields.thing}
|
|
38
39
|
fieldActions={actions.fields.thing}
|
|
40
|
+
disabledValues={["disabled"]}
|
|
39
41
|
/>
|
|
40
42
|
);
|
|
41
43
|
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
import {
|
|
3
|
-
MINESHAFT_GREY,
|
|
4
3
|
STORM_GREY,
|
|
5
|
-
WHITE,
|
|
6
|
-
SEASHELL_WHITE,
|
|
7
|
-
DUSTY_GREY,
|
|
8
4
|
GHOST_GREY,
|
|
9
5
|
ERROR_COLOR,
|
|
10
6
|
MATISSE_BLUE
|
|
@@ -17,6 +13,9 @@ export const SelectContainer = styled.div`
|
|
|
17
13
|
flex-direction: column;
|
|
18
14
|
justify-content: space-between;
|
|
19
15
|
align-items: flex-start;
|
|
16
|
+
> * + * {
|
|
17
|
+
margin-top: 0.25rem;
|
|
18
|
+
}
|
|
20
19
|
`;
|
|
21
20
|
|
|
22
21
|
export const SelectLabel = styled.label`
|
|
@@ -53,8 +52,9 @@ export const SelectField = styled.select`
|
|
|
53
52
|
font-family: Public Sans;
|
|
54
53
|
line-height: 2rem;
|
|
55
54
|
font-weight: ${FONT_WEIGHT_REGULAR};
|
|
56
|
-
background-color: ${({
|
|
57
|
-
|
|
55
|
+
background-color: ${({ themeValues }) =>
|
|
56
|
+
themeValues.inputBackgroundColor && themeValues.inputBackgroundColor};
|
|
57
|
+
color: ${({ themeValues }) => themeValues.color && themeValues.color};
|
|
58
58
|
box-shadow: none;
|
|
59
59
|
|
|
60
60
|
&:focus {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CHARADE_GREY,
|
|
3
|
+
MATISSE_BLUE,
|
|
4
|
+
WHITE,
|
|
5
|
+
SEASHELL_WHITE,
|
|
6
|
+
MINESHAFT_GREY,
|
|
7
|
+
DUSTY_GREY,
|
|
8
|
+
GREY_CHATEAU,
|
|
9
|
+
ATHENS_GREY
|
|
10
|
+
} from "../../../constants/colors";
|
|
11
|
+
import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
|
|
12
|
+
|
|
13
|
+
const linkColor = { default: `${MATISSE_BLUE}`, disabled: `${MATISSE_BLUE}` };
|
|
14
|
+
const formBackgroundColor = {
|
|
15
|
+
default: `${WHITE}`,
|
|
16
|
+
disabled: `${WHITE}`,
|
|
17
|
+
checkout: `${ATHENS_GREY}`,
|
|
18
|
+
collapsible: `${ATHENS_GREY}`
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const inputBackgroundColor = {
|
|
22
|
+
default: `${WHITE}`,
|
|
23
|
+
disabled: `${SEASHELL_WHITE}`
|
|
24
|
+
};
|
|
25
|
+
const color = { default: `${MINESHAFT_GREY}`, disabled: `${DUSTY_GREY}` };
|
|
26
|
+
const labelColor = { default: `${CHARADE_GREY}`, disabled: `${CHARADE_GREY}` };
|
|
27
|
+
const borderColor = { default: `${GREY_CHATEAU}`, disabled: `${GREY_CHATEAU}` };
|
|
28
|
+
const lineHeight = { default: "1rem", disabled: "1rem" };
|
|
29
|
+
const fontSize = { default: "0.875rem", disabled: "0.875rem" };
|
|
30
|
+
const errorFontSize = { default: "0.75rem", disabled: "0.75rem" };
|
|
31
|
+
const fontWeight = {
|
|
32
|
+
default: `${FONT_WEIGHT_REGULAR}`,
|
|
33
|
+
disabled: `${FONT_WEIGHT_REGULAR}`
|
|
34
|
+
};
|
|
35
|
+
const hoverFocusStyles = {
|
|
36
|
+
default: `color: #0E506D; outline: none; text-decoration: underline; `,
|
|
37
|
+
disabled: `color: #6E727E;`
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const fallbackValues = {
|
|
41
|
+
linkColor,
|
|
42
|
+
formBackgroundColor,
|
|
43
|
+
inputBackgroundColor,
|
|
44
|
+
color,
|
|
45
|
+
labelColor,
|
|
46
|
+
borderColor,
|
|
47
|
+
lineHeight,
|
|
48
|
+
fontSize,
|
|
49
|
+
errorFontSize,
|
|
50
|
+
fontWeight,
|
|
51
|
+
hoverFocusStyles
|
|
52
|
+
};
|
|
@@ -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;
|