@thecb/components 10.1.3-beta.3 → 10.2.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 +2968 -2959
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +2968 -2959
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/button-with-action/ButtonWithAction.js +7 -5
- package/src/components/atoms/button-with-action/ButtonWithAction.stories.js +4 -1
- package/src/components/atoms/button-with-link/ButtonWithLink.js +5 -1
- package/src/components/atoms/layouts/Box.styled.js +15 -0
- package/src/components/molecules/obligation/modules/AutopayModalModule.js +5 -5
- package/dist/src/apps/checkout/pages/payment/sub-pages/payment-amount/PaymentAmount_old.js +0 -49322
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/icons/.DS_Store +0 -0
package/package.json
CHANGED
|
@@ -68,6 +68,7 @@ const ButtonWithAction = forwardRef(
|
|
|
68
68
|
text,
|
|
69
69
|
textWrap = false,
|
|
70
70
|
isLoading = false,
|
|
71
|
+
disabled = false,
|
|
71
72
|
loadingColor = "white",
|
|
72
73
|
dataQa = null,
|
|
73
74
|
textExtraStyles,
|
|
@@ -114,8 +115,8 @@ const ButtonWithAction = forwardRef(
|
|
|
114
115
|
color: #FFFFFF;
|
|
115
116
|
cursor: default;
|
|
116
117
|
&:focus {
|
|
117
|
-
|
|
118
|
-
outline:
|
|
118
|
+
outline: 3px solid #6D717E;
|
|
119
|
+
outline-offset: 2px;
|
|
119
120
|
}
|
|
120
121
|
${extraDisabledStyles}
|
|
121
122
|
`;
|
|
@@ -129,11 +130,12 @@ const ButtonWithAction = forwardRef(
|
|
|
129
130
|
minWidth={themeValues.minWidth}
|
|
130
131
|
background={themeValues.backgroundColor}
|
|
131
132
|
border={themeValues.border}
|
|
132
|
-
hoverStyles={hoverStyles}
|
|
133
|
-
activeStyles={activeStyles}
|
|
133
|
+
hoverStyles={disabled ? disabledStyles : hoverStyles}
|
|
134
|
+
activeStyles={disabled ? disabledStyles : activeStyles}
|
|
134
135
|
disabledStyles={disabledStyles}
|
|
136
|
+
aria-disabled={disabled}
|
|
135
137
|
as="button"
|
|
136
|
-
onClick={isLoading ? undefined : action}
|
|
138
|
+
onClick={isLoading || disabled ? undefined : action}
|
|
137
139
|
borderRadius="2px"
|
|
138
140
|
theme={themeContext}
|
|
139
141
|
extraStyles={`margin: 0.5rem; ${extraStyles}`}
|
|
@@ -18,12 +18,15 @@ const variants = {
|
|
|
18
18
|
const defaultValue = "primary";
|
|
19
19
|
const groupId = "props";
|
|
20
20
|
|
|
21
|
+
const buttonHandler = () => console.log("Button selected");
|
|
22
|
+
|
|
21
23
|
export const buttonWithAction = () => (
|
|
22
24
|
<ButtonWithAction
|
|
23
25
|
variant={select(variantsLabel, variants, defaultValue, groupId)}
|
|
24
26
|
text={text("text", "button", "props")}
|
|
25
27
|
isLoading={boolean("isLoading", false, "props")}
|
|
26
|
-
action={text("action",
|
|
28
|
+
action={text("action", buttonHandler, "props")}
|
|
29
|
+
disabled={boolean("disabled", false, "props")}
|
|
27
30
|
/>
|
|
28
31
|
);
|
|
29
32
|
|
|
@@ -57,7 +57,11 @@ const ButtonWithLink = ({
|
|
|
57
57
|
text-decoration: none; }`}
|
|
58
58
|
dataQa={dataQa}
|
|
59
59
|
>
|
|
60
|
-
<ButtonWithAction
|
|
60
|
+
<ButtonWithAction
|
|
61
|
+
{...otherProps}
|
|
62
|
+
disabled={disabled}
|
|
63
|
+
extraStyles={extraStyles}
|
|
64
|
+
/>
|
|
61
65
|
</ButtonWithLinkWrapper>
|
|
62
66
|
);
|
|
63
67
|
};
|
|
@@ -107,6 +107,21 @@ export const BoxWrapper = styled(
|
|
|
107
107
|
: ``}
|
|
108
108
|
`}
|
|
109
109
|
}
|
|
110
|
+
|
|
111
|
+
&[aria-disabled="true"] {
|
|
112
|
+
${({ disabledStyles, as }) =>
|
|
113
|
+
css`
|
|
114
|
+
${disabledStyles}
|
|
115
|
+
${as === "button"
|
|
116
|
+
? ` > * > span {
|
|
117
|
+
${disabledStyles}
|
|
118
|
+
border: none;
|
|
119
|
+
outline: none;
|
|
120
|
+
box-shadow: none;
|
|
121
|
+
}`
|
|
122
|
+
: ``}
|
|
123
|
+
`}
|
|
124
|
+
}
|
|
110
125
|
|
|
111
126
|
& * {
|
|
112
127
|
color: ${({ color }) => color};
|
|
@@ -43,7 +43,7 @@ const AutopayModal = ({
|
|
|
43
43
|
};
|
|
44
44
|
const plan = isPaymentPlan ? "your payment plan" : "autopay";
|
|
45
45
|
const shortPlan = isPaymentPlan ? "Payment Plan" : "Autopay";
|
|
46
|
-
const deactivateText = `
|
|
46
|
+
const deactivateText = `deactivate ${shortPlan} for ${description}: ${subDescription}`;
|
|
47
47
|
const activateText = `Set Up ${shortPlan} for ${description}: ${subDescription}`;
|
|
48
48
|
const nextDate = dueDate || nextAutopayDate;
|
|
49
49
|
const modalExtraProps = {
|
|
@@ -51,13 +51,13 @@ const AutopayModal = ({
|
|
|
51
51
|
? titleCaseString(deactivateText)
|
|
52
52
|
: titleCaseString(activateText),
|
|
53
53
|
modalBodyText: autoPayActive
|
|
54
|
-
? `Are you sure you want to
|
|
55
|
-
!inactive && nextDate
|
|
56
|
-
?
|
|
54
|
+
? `Are you sure you want to deactivate ${plan}? ${
|
|
55
|
+
!inactive && nextDate
|
|
56
|
+
? `Your next payment will be due on ${nextDate}.`
|
|
57
57
|
: ""
|
|
58
58
|
}`
|
|
59
59
|
: generateMethodNeededText(plan, allowedPaymentInstruments),
|
|
60
|
-
continueButtonText: autoPayActive ? `
|
|
60
|
+
continueButtonText: autoPayActive ? `Disable ${shortPlan}` : "Add",
|
|
61
61
|
useDangerButton: autoPayActive,
|
|
62
62
|
continueAction: autoPayActive
|
|
63
63
|
? () => {
|