@thecb/components 4.1.32-beta.0 → 4.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 +85 -15
- package/package.json +1 -1
- package/src/components/atoms/formatted-credit-card/FormattedCreditCard.js +59 -33
- package/src/components/molecules/collapsible-section/CollapsibleSection.js +1 -1
- package/src/components/molecules/editable-list/EditableList.js +6 -2
- package/src/components/molecules/editable-list/EditableList.styled.js +4 -2
- package/src/components/molecules/radio-section/RadioSection.js +47 -2
- package/src/constants/colors.js +2 -0
package/dist/index.cjs.js
CHANGED
|
@@ -4859,7 +4859,8 @@ var HINT_GREEN = "#E8FFEF";
|
|
|
4859
4859
|
var SEA_GREEN = "#317D4F"; // YELLOW
|
|
4860
4860
|
|
|
4861
4861
|
var SELECTIVE_YELLOW = "#F8B700";
|
|
4862
|
-
var MUSTARD_YELLOW = "#FFD459";
|
|
4862
|
+
var MUSTARD_YELLOW = "#FFD459";
|
|
4863
|
+
var FIRE_YELLOW = "#B34A00"; // ORANGE
|
|
4863
4864
|
|
|
4864
4865
|
var CARROT_ORANGE = "#ED9620";
|
|
4865
4866
|
var ZEST_ORANGE = "#F47820";
|
|
@@ -4961,6 +4962,7 @@ var colors = /*#__PURE__*/Object.freeze({
|
|
|
4961
4962
|
SEA_GREEN: SEA_GREEN,
|
|
4962
4963
|
SELECTIVE_YELLOW: SELECTIVE_YELLOW,
|
|
4963
4964
|
MUSTARD_YELLOW: MUSTARD_YELLOW,
|
|
4965
|
+
FIRE_YELLOW: FIRE_YELLOW,
|
|
4964
4966
|
CARROT_ORANGE: CARROT_ORANGE,
|
|
4965
4967
|
ZEST_ORANGE: ZEST_ORANGE,
|
|
4966
4968
|
APRICOT_ORANGE: APRICOT_ORANGE,
|
|
@@ -20899,6 +20901,9 @@ function _templateObject$q() {
|
|
|
20899
20901
|
|
|
20900
20902
|
return data;
|
|
20901
20903
|
}
|
|
20904
|
+
var ACTIVE = "ACTIVE";
|
|
20905
|
+
var EXPIRING_SOON = "EXPIRING_SOON";
|
|
20906
|
+
var EXPIRED = "EXPIRED";
|
|
20902
20907
|
var CreditCardWrapper = styled__default.div(_templateObject$q());
|
|
20903
20908
|
var CCIconWrapper = styled__default.div(_templateObject2$e());
|
|
20904
20909
|
|
|
@@ -20906,7 +20911,34 @@ var FormattedCreditCard = function FormattedCreditCard(_ref) {
|
|
|
20906
20911
|
var lastFour = _ref.lastFour,
|
|
20907
20912
|
autoPay = _ref.autoPay,
|
|
20908
20913
|
expireDate = _ref.expireDate,
|
|
20914
|
+
expirationStatus = _ref.expirationStatus,
|
|
20909
20915
|
themeValues = _ref.themeValues;
|
|
20916
|
+
|
|
20917
|
+
var renderCardStatus = function renderCardStatus() {
|
|
20918
|
+
switch (expirationStatus) {
|
|
20919
|
+
case ACTIVE:
|
|
20920
|
+
return /*#__PURE__*/React__default.createElement(Paragraph$1, {
|
|
20921
|
+
variant: "pXS",
|
|
20922
|
+
color: ASH_GREY,
|
|
20923
|
+
textAlign: "left"
|
|
20924
|
+
}, "Exp Date ", expireDate);
|
|
20925
|
+
|
|
20926
|
+
case EXPIRING_SOON:
|
|
20927
|
+
return /*#__PURE__*/React__default.createElement(Paragraph$1, {
|
|
20928
|
+
variant: "pXS",
|
|
20929
|
+
color: FIRE_YELLOW,
|
|
20930
|
+
textAlign: "left"
|
|
20931
|
+
}, "Expiring Soon ", expireDate);
|
|
20932
|
+
|
|
20933
|
+
case EXPIRED:
|
|
20934
|
+
return /*#__PURE__*/React__default.createElement(Paragraph$1, {
|
|
20935
|
+
variant: "pXS",
|
|
20936
|
+
color: ASH_GREY,
|
|
20937
|
+
textAlign: "left"
|
|
20938
|
+
}, "Expired");
|
|
20939
|
+
}
|
|
20940
|
+
};
|
|
20941
|
+
|
|
20910
20942
|
return /*#__PURE__*/React__default.createElement(CreditCardWrapper, null, /*#__PURE__*/React__default.createElement(CCIconWrapper, null, /*#__PURE__*/React__default.createElement(GenericCard, null)), /*#__PURE__*/React__default.createElement(Stack, {
|
|
20911
20943
|
childGap: "0"
|
|
20912
20944
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
@@ -20917,18 +20949,14 @@ var FormattedCreditCard = function FormattedCreditCard(_ref) {
|
|
|
20917
20949
|
color: themeValues.textColor,
|
|
20918
20950
|
textAlign: "left",
|
|
20919
20951
|
extraStyles: "display: inline-block;"
|
|
20920
|
-
}, "Card ending in ".concat(lastFour)), expireDate && /*#__PURE__*/React__default.createElement(
|
|
20921
|
-
variant: "pXS",
|
|
20922
|
-
color: ASH_GREY,
|
|
20923
|
-
textAlign: "left"
|
|
20924
|
-
}, "Exp ".concat(expireDate))), autoPay && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
20952
|
+
}, "Card ending in ".concat(lastFour)), expireDate && /*#__PURE__*/React__default.createElement(React.Fragment, null, renderCardStatus())), autoPay && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
20925
20953
|
variant: "p",
|
|
20926
20954
|
color: themeValues.autopayTextColor,
|
|
20927
20955
|
extraStyles: "font-style: italic;"
|
|
20928
20956
|
}, "Autopay Enabled")));
|
|
20929
20957
|
};
|
|
20930
20958
|
|
|
20931
|
-
var FormattedCreditCard$1 = themeComponent(FormattedCreditCard, "FormattedCreditCard", fallbackValues$j
|
|
20959
|
+
var FormattedCreditCard$1 = themeComponent(FormattedCreditCard, "FormattedCreditCard", fallbackValues$j);
|
|
20932
20960
|
|
|
20933
20961
|
function _templateObject3$8() {
|
|
20934
20962
|
var data = _taggedTemplateLiteral(["\n display: block;\n top: auto;\n bottom: 6px;\n left: 2px;\n transition-duration: 0.13s;\n transition-delay: 0.13s;\n transition-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);\n margin-top: 12px;\n background-color: ", ";\n\n &, &::before, &::after {\n background-color: ", ";\n width: 30px;\n height: 3px;\n position: absolute;\n transition-property: transform;\n transition-duration: 0.15s;\n transition-timing-function: ease;\n }\n\n &::before, &::after {\n content: \"\";\n display: block;\n }\n\n &::before {\n top: -10px;\n transition: top 0.12s 0.2s cubic-bezier(0.33333, 0.66667, 0.66667, 1), \n transform 0.13s cubic-bezier(0.55, 0.055, 0.675, 0.19);\n }\n\n &::after {\n bottom: -10px;\n top: -20px;\n transition: top 0.2s 0.2s cubic-bezier(0.33333, 0.66667, 0.66667, 1), \n opacity 0.1s linear;\n }\n\n &.active, &.active::before, &.active::after {\n background-color: ", ";\n }\n\n &.active {\n transform: translate3d(0, -10px, 0) rotate(-45deg);\n transition-delay: 0.22s;\n transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);\n }\n\n &.active::after {\n top: 0;\n opacity: 0;\n transition: top 0.2s cubic-bezier(0.33333, 0, 0.66667, 0.33333), \n opacity: 0.1s 0.22s linear;\n }\n\n &.active::before {\n top: 0;\n transform: rotate(-90deg);\n transition: top 0.1s 0.16s cubic-bezier(0.33333, 0, 0.66667, 0.33333), \n transform 0.13s 0.25s cubic-bezier(0.215, 0.61, 0.355, 1);\n }\n"]);
|
|
@@ -34627,7 +34655,7 @@ var CollapsibleSection = function CollapsibleSection(_ref) {
|
|
|
34627
34655
|
initial: initiallyOpen ? "open" : "closed",
|
|
34628
34656
|
exit: "closed",
|
|
34629
34657
|
variants: wrapper,
|
|
34630
|
-
extraStyles: "transform-origin: 100% 0;
|
|
34658
|
+
extraStyles: "transform-origin: 100% 0;"
|
|
34631
34659
|
}, children))));
|
|
34632
34660
|
};
|
|
34633
34661
|
|
|
@@ -34706,7 +34734,7 @@ function _templateObject2$j() {
|
|
|
34706
34734
|
}
|
|
34707
34735
|
|
|
34708
34736
|
function _templateObject$x() {
|
|
34709
|
-
var data = _taggedTemplateLiteral(["\n box-sizing: border-box;\n background: ", ";\n height: ", ";\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 1.5rem;\n :not(:last-child),\n :not(:first-child) {\n box-shadow: inset 0px -1px 0px 0px rgb(202, 206, 216);\n }\n :first-child {\n border-top-left-radius: 3px;\n border-top-right-radius: 3px;\n }\n :last-child {\n border-bottom-left-radius: 3px;\n border-bottom-right-radius: 3px;\n box-shadow: none;\n }\n"]);
|
|
34737
|
+
var data = _taggedTemplateLiteral(["\n box-sizing: border-box;\n background: ", ";\n border-color: ", ";\n height: ", ";\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 1.5rem;\n :not(:last-child),\n :not(:first-child) {\n box-shadow: inset 0px -1px 0px 0px rgb(202, 206, 216);\n }\n :first-child {\n border-top-left-radius: 3px;\n border-top-right-radius: 3px;\n }\n :last-child {\n border-bottom-left-radius: 3px;\n border-bottom-right-radius: 3px;\n box-shadow: none;\n }\n"]);
|
|
34710
34738
|
|
|
34711
34739
|
_templateObject$x = function _templateObject() {
|
|
34712
34740
|
return data;
|
|
@@ -34714,12 +34742,18 @@ function _templateObject$x() {
|
|
|
34714
34742
|
|
|
34715
34743
|
return data;
|
|
34716
34744
|
}
|
|
34717
|
-
var EditableListItem = styled__default.div(_templateObject$x(),
|
|
34718
|
-
var
|
|
34745
|
+
var EditableListItem = styled__default.div(_templateObject$x(), function (_ref) {
|
|
34746
|
+
var disabled = _ref.disabled;
|
|
34747
|
+
return disabled ? "rgba(246, 246, 249, 0.7)" : WHITE;
|
|
34748
|
+
}, GHOST_GREY, function (_ref2) {
|
|
34749
|
+
var listItemSize = _ref2.listItemSize;
|
|
34719
34750
|
return listItemSize === "big" ? "120px" : "72px";
|
|
34720
34751
|
});
|
|
34721
34752
|
var EditableListItemControls = styled__default.div(_templateObject2$j());
|
|
34722
34753
|
|
|
34754
|
+
var ACTIVE$1 = "ACTIVE";
|
|
34755
|
+
var EXPIRED$1 = "EXPIRED";
|
|
34756
|
+
|
|
34723
34757
|
var EditableList = function EditableList(_ref) {
|
|
34724
34758
|
var _ref$title = _ref.title,
|
|
34725
34759
|
title = _ref$title === void 0 ? "" : _ref$title,
|
|
@@ -34762,16 +34796,20 @@ var EditableList = function EditableList(_ref) {
|
|
|
34762
34796
|
borderRadius: "4px",
|
|
34763
34797
|
extraStyles: "box-shadow: 0px 2px 14px 0px rgb(246, 246, 249),\n 0px 3px 8px 0px rgb(202, 206, 216);"
|
|
34764
34798
|
}, items.map(function (item) {
|
|
34799
|
+
var _item$expirationStatu;
|
|
34800
|
+
|
|
34765
34801
|
var _useState = React.useState(false),
|
|
34766
34802
|
_useState2 = _slicedToArray(_useState, 2),
|
|
34767
34803
|
modalOpen = _useState2[0],
|
|
34768
34804
|
toggleModal = _useState2[1];
|
|
34769
34805
|
|
|
34806
|
+
var expiredItem = (_item$expirationStatu = item === null || item === void 0 ? void 0 : item.expirationStatus) !== null && _item$expirationStatu !== void 0 ? _item$expirationStatu : ACTIVE$1;
|
|
34770
34807
|
return /*#__PURE__*/React__default.createElement(EditableListItem, {
|
|
34771
|
-
listItemSize: !!item.id && autoPayMethods.some(function (methodID) {
|
|
34808
|
+
listItemSize: !!item.id && (autoPayMethods === null || autoPayMethods === void 0 ? void 0 : autoPayMethods.some(function (methodID) {
|
|
34772
34809
|
return methodID === item.id;
|
|
34773
|
-
}) ? "big" : listItemSize,
|
|
34774
|
-
key: item.id || item
|
|
34810
|
+
})) ? "big" : listItemSize,
|
|
34811
|
+
key: item.id || item,
|
|
34812
|
+
disabled: expiredItem === EXPIRED$1
|
|
34775
34813
|
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
34776
34814
|
variant: "p",
|
|
34777
34815
|
color: CHARADE_GREY
|
|
@@ -39566,6 +39604,10 @@ function _templateObject$A() {
|
|
|
39566
39604
|
|
|
39567
39605
|
*/
|
|
39568
39606
|
|
|
39607
|
+
var ACTIVE$2 = "ACTIVE";
|
|
39608
|
+
var EXPIRING_SOON$1 = "EXPIRING_SOON";
|
|
39609
|
+
var EXPIRED$2 = "EXPIRED";
|
|
39610
|
+
|
|
39569
39611
|
var RadioSection = function RadioSection(_ref) {
|
|
39570
39612
|
var themeValues = _ref.themeValues,
|
|
39571
39613
|
isMobile = _ref.isMobile,
|
|
@@ -39588,6 +39630,34 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
39588
39630
|
}
|
|
39589
39631
|
};
|
|
39590
39632
|
|
|
39633
|
+
var renderCardStatus = function renderCardStatus(item) {
|
|
39634
|
+
var expirationStatus = item.expirationStatus,
|
|
39635
|
+
expireDate = item.expireDate;
|
|
39636
|
+
|
|
39637
|
+
switch (expirationStatus) {
|
|
39638
|
+
case ACTIVE$2:
|
|
39639
|
+
return /*#__PURE__*/React__default.createElement(Text$1, {
|
|
39640
|
+
variant: "pXS",
|
|
39641
|
+
color: ASH_GREY,
|
|
39642
|
+
extraStyles: "text-align: right;"
|
|
39643
|
+
}, "Exp Date ", expireDate);
|
|
39644
|
+
|
|
39645
|
+
case EXPIRING_SOON$1:
|
|
39646
|
+
return /*#__PURE__*/React__default.createElement(Text$1, {
|
|
39647
|
+
variant: "pXS",
|
|
39648
|
+
color: FIRE_YELLOW,
|
|
39649
|
+
extraStyles: "text-align: right;"
|
|
39650
|
+
}, "Expiring Soon ", expireDate);
|
|
39651
|
+
|
|
39652
|
+
case EXPIRED$2:
|
|
39653
|
+
return /*#__PURE__*/React__default.createElement(Text$1, {
|
|
39654
|
+
variant: "pXS",
|
|
39655
|
+
color: ASH_GREY,
|
|
39656
|
+
extraStyles: "text-align: right;"
|
|
39657
|
+
}, "Expired");
|
|
39658
|
+
}
|
|
39659
|
+
};
|
|
39660
|
+
|
|
39591
39661
|
var wrapper = {
|
|
39592
39662
|
open: {
|
|
39593
39663
|
height: openHeight,
|
|
@@ -39704,7 +39774,7 @@ var RadioSection = function RadioSection(_ref) {
|
|
|
39704
39774
|
isMobile: isMobile,
|
|
39705
39775
|
alt: icon.altText
|
|
39706
39776
|
});
|
|
39707
|
-
})))), /*#__PURE__*/React__default.createElement(AnimatePresence, {
|
|
39777
|
+
})), section.shouldDisplayCardExpiration && /*#__PURE__*/React__default.createElement(React.Fragment, null, renderCardStatus(section)))), /*#__PURE__*/React__default.createElement(AnimatePresence, {
|
|
39708
39778
|
initial: false
|
|
39709
39779
|
}, openSection === section.id && /*#__PURE__*/React__default.createElement(Motion, {
|
|
39710
39780
|
key: "content-".concat(section.id),
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { Fragment } from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import GenericCard from "../icons/GenericCard";
|
|
4
4
|
import Text from "../text";
|
|
@@ -6,7 +6,11 @@ import Paragraph from "../paragraph";
|
|
|
6
6
|
import { Box, Stack } from "../layouts";
|
|
7
7
|
import { fallbackValues } from "./FormattedCreditCard.theme";
|
|
8
8
|
import { themeComponent } from "../../../util/themeUtils";
|
|
9
|
-
import { ASH_GREY } from "../../../constants/colors";
|
|
9
|
+
import { ASH_GREY, FIRE_YELLOW } from "../../../constants/colors";
|
|
10
|
+
|
|
11
|
+
const ACTIVE = "ACTIVE";
|
|
12
|
+
const EXPIRING_SOON = "EXPIRING_SOON";
|
|
13
|
+
const EXPIRED = "EXPIRED";
|
|
10
14
|
|
|
11
15
|
export const CreditCardWrapper = styled.div`
|
|
12
16
|
display: flex;
|
|
@@ -25,43 +29,65 @@ const FormattedCreditCard = ({
|
|
|
25
29
|
lastFour,
|
|
26
30
|
autoPay,
|
|
27
31
|
expireDate,
|
|
32
|
+
expirationStatus,
|
|
28
33
|
themeValues
|
|
29
|
-
}) =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
<Stack childGap="0">
|
|
35
|
-
<Box padding="0">
|
|
36
|
-
<Text
|
|
37
|
-
variant="p"
|
|
38
|
-
padding="0 0 0 8px"
|
|
39
|
-
color={themeValues.textColor}
|
|
40
|
-
textAlign="left"
|
|
41
|
-
extraStyles={`display: inline-block;`}
|
|
42
|
-
>
|
|
43
|
-
{`Card ending in ${lastFour}`}
|
|
44
|
-
</Text>
|
|
45
|
-
{expireDate && (
|
|
34
|
+
}) => {
|
|
35
|
+
const renderCardStatus = () => {
|
|
36
|
+
switch (expirationStatus) {
|
|
37
|
+
case ACTIVE:
|
|
38
|
+
return (
|
|
46
39
|
<Paragraph variant="pXS" color={ASH_GREY} textAlign="left">
|
|
47
|
-
|
|
40
|
+
Exp Date {expireDate}
|
|
41
|
+
</Paragraph>
|
|
42
|
+
);
|
|
43
|
+
case EXPIRING_SOON:
|
|
44
|
+
return (
|
|
45
|
+
<Paragraph variant="pXS" color={FIRE_YELLOW} textAlign="left">
|
|
46
|
+
Expiring Soon {expireDate}
|
|
48
47
|
</Paragraph>
|
|
48
|
+
);
|
|
49
|
+
case EXPIRED:
|
|
50
|
+
return (
|
|
51
|
+
<Paragraph variant="pXS" color={ASH_GREY} textAlign="left">
|
|
52
|
+
Expired
|
|
53
|
+
</Paragraph>
|
|
54
|
+
);
|
|
55
|
+
default:
|
|
56
|
+
null;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
return (
|
|
60
|
+
<CreditCardWrapper>
|
|
61
|
+
<CCIconWrapper>
|
|
62
|
+
<GenericCard />
|
|
63
|
+
</CCIconWrapper>
|
|
64
|
+
<Stack childGap="0">
|
|
65
|
+
<Box padding="0">
|
|
66
|
+
<Text
|
|
67
|
+
variant="p"
|
|
68
|
+
padding="0 0 0 8px"
|
|
69
|
+
color={themeValues.textColor}
|
|
70
|
+
textAlign="left"
|
|
71
|
+
extraStyles={`display: inline-block;`}
|
|
72
|
+
>
|
|
73
|
+
{`Card ending in ${lastFour}`}
|
|
74
|
+
</Text>
|
|
75
|
+
{expireDate && <Fragment>{renderCardStatus()}</Fragment>}
|
|
76
|
+
</Box>
|
|
77
|
+
{autoPay && (
|
|
78
|
+
<Text
|
|
79
|
+
variant="p"
|
|
80
|
+
color={themeValues.autopayTextColor}
|
|
81
|
+
extraStyles={`font-style: italic;`}
|
|
82
|
+
>{`Autopay Enabled`}</Text>
|
|
49
83
|
)}
|
|
50
|
-
</
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
color={themeValues.autopayTextColor}
|
|
55
|
-
extraStyles={`font-style: italic;`}
|
|
56
|
-
>{`Autopay Enabled`}</Text>
|
|
57
|
-
)}
|
|
58
|
-
</Stack>
|
|
59
|
-
</CreditCardWrapper>
|
|
60
|
-
);
|
|
84
|
+
</Stack>
|
|
85
|
+
</CreditCardWrapper>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
61
88
|
|
|
62
89
|
export default themeComponent(
|
|
63
90
|
FormattedCreditCard,
|
|
64
91
|
"FormattedCreditCard",
|
|
65
|
-
fallbackValues
|
|
66
|
-
"default"
|
|
92
|
+
fallbackValues
|
|
67
93
|
);
|
|
@@ -113,7 +113,7 @@ const CollapsibleSection = ({
|
|
|
113
113
|
initial={initiallyOpen ? "open" : "closed"}
|
|
114
114
|
exit="closed"
|
|
115
115
|
variants={wrapper}
|
|
116
|
-
extraStyles={`transform-origin: 100% 0
|
|
116
|
+
extraStyles={`transform-origin: 100% 0;`}
|
|
117
117
|
>
|
|
118
118
|
{children}
|
|
119
119
|
</Motion>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
|
|
3
2
|
import {
|
|
4
3
|
EditableListItem,
|
|
5
4
|
EditableListItemControls
|
|
@@ -15,6 +14,9 @@ import {
|
|
|
15
14
|
CHARADE_GREY
|
|
16
15
|
} from "../../../constants/colors";
|
|
17
16
|
|
|
17
|
+
const ACTIVE = "ACTIVE";
|
|
18
|
+
const EXPIRED = "EXPIRED";
|
|
19
|
+
|
|
18
20
|
const EditableList = ({
|
|
19
21
|
title = "",
|
|
20
22
|
titleWeight = "400",
|
|
@@ -57,15 +59,17 @@ const EditableList = ({
|
|
|
57
59
|
>
|
|
58
60
|
{items.map(item => {
|
|
59
61
|
const [modalOpen, toggleModal] = useState(false);
|
|
62
|
+
const expiredItem = item?.expirationStatus ?? ACTIVE;
|
|
60
63
|
return (
|
|
61
64
|
<EditableListItem
|
|
62
65
|
listItemSize={
|
|
63
66
|
!!item.id &&
|
|
64
|
-
autoPayMethods
|
|
67
|
+
autoPayMethods?.some(methodID => methodID === item.id)
|
|
65
68
|
? "big"
|
|
66
69
|
: listItemSize
|
|
67
70
|
}
|
|
68
71
|
key={item.id || item}
|
|
72
|
+
disabled={expiredItem === EXPIRED}
|
|
69
73
|
>
|
|
70
74
|
<Text variant="p" color={CHARADE_GREY}>
|
|
71
75
|
{renderItem(item)}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
|
-
import { WHITE } from "../../../constants/colors";
|
|
2
|
+
import { WHITE, GHOST_GREY } from "../../../constants/colors";
|
|
3
3
|
|
|
4
4
|
export const EditableListItem = styled.div`
|
|
5
5
|
box-sizing: border-box;
|
|
6
|
-
background: ${
|
|
6
|
+
background: ${({ disabled }) =>
|
|
7
|
+
disabled ? `rgba(246, 246, 249, 0.7)` : WHITE};
|
|
8
|
+
border-color: ${GHOST_GREY};
|
|
7
9
|
height: ${({ listItemSize }) => (listItemSize === "big" ? "120px" : "72px")};
|
|
8
10
|
display: flex;
|
|
9
11
|
justify-content: space-between;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
1
|
+
import React, { Fragment, useState } from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import { themeComponent } from "../../../util/themeUtils";
|
|
4
4
|
import { fallbackValues } from "./RadioSection.theme";
|
|
@@ -7,7 +7,7 @@ import RadioButton from "../../atoms/radio-button";
|
|
|
7
7
|
import { Box, Cluster, Stack, Motion } from "../../atoms/layouts";
|
|
8
8
|
import { noop } from "../../../util/general";
|
|
9
9
|
import Text from "../../atoms/text";
|
|
10
|
-
import { CHARADE_GREY } from "../../../constants/colors";
|
|
10
|
+
import { CHARADE_GREY, ASH_GREY, FIRE_YELLOW } from "../../../constants/colors";
|
|
11
11
|
/*
|
|
12
12
|
Takes an array of section objects, each object should look like:
|
|
13
13
|
{
|
|
@@ -28,6 +28,10 @@ import { CHARADE_GREY } from "../../../constants/colors";
|
|
|
28
28
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
+
const ACTIVE = "ACTIVE";
|
|
32
|
+
const EXPIRING_SOON = "EXPIRING_SOON";
|
|
33
|
+
const EXPIRED = "EXPIRED";
|
|
34
|
+
|
|
31
35
|
const RadioSection = ({
|
|
32
36
|
themeValues,
|
|
33
37
|
isMobile,
|
|
@@ -45,6 +49,44 @@ const RadioSection = ({
|
|
|
45
49
|
}
|
|
46
50
|
};
|
|
47
51
|
|
|
52
|
+
const renderCardStatus = item => {
|
|
53
|
+
const { expirationStatus, expireDate } = item;
|
|
54
|
+
switch (expirationStatus) {
|
|
55
|
+
case ACTIVE:
|
|
56
|
+
return (
|
|
57
|
+
<Text
|
|
58
|
+
variant="pXS"
|
|
59
|
+
color={ASH_GREY}
|
|
60
|
+
extraStyles={`text-align: right;`}
|
|
61
|
+
>
|
|
62
|
+
Exp Date {expireDate}
|
|
63
|
+
</Text>
|
|
64
|
+
);
|
|
65
|
+
case EXPIRING_SOON:
|
|
66
|
+
return (
|
|
67
|
+
<Text
|
|
68
|
+
variant="pXS"
|
|
69
|
+
color={FIRE_YELLOW}
|
|
70
|
+
extraStyles={`text-align: right;`}
|
|
71
|
+
>
|
|
72
|
+
Expiring Soon {expireDate}
|
|
73
|
+
</Text>
|
|
74
|
+
);
|
|
75
|
+
case EXPIRED:
|
|
76
|
+
return (
|
|
77
|
+
<Text
|
|
78
|
+
variant="pXS"
|
|
79
|
+
color={ASH_GREY}
|
|
80
|
+
extraStyles={`text-align: right;`}
|
|
81
|
+
>
|
|
82
|
+
Expired
|
|
83
|
+
</Text>
|
|
84
|
+
);
|
|
85
|
+
default:
|
|
86
|
+
null;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
48
90
|
const wrapper = {
|
|
49
91
|
open: {
|
|
50
92
|
height: openHeight,
|
|
@@ -186,6 +228,9 @@ const RadioSection = ({
|
|
|
186
228
|
))}
|
|
187
229
|
</Cluster>
|
|
188
230
|
)}
|
|
231
|
+
{section.shouldDisplayCardExpiration && (
|
|
232
|
+
<Fragment>{renderCardStatus(section)}</Fragment>
|
|
233
|
+
)}
|
|
189
234
|
</Cluster>
|
|
190
235
|
</Box>
|
|
191
236
|
<AnimatePresence initial={false}>
|
package/src/constants/colors.js
CHANGED
|
@@ -64,6 +64,7 @@ const SEA_GREEN = "#317D4F";
|
|
|
64
64
|
// YELLOW
|
|
65
65
|
const SELECTIVE_YELLOW = "#F8B700";
|
|
66
66
|
const MUSTARD_YELLOW = "#FFD459";
|
|
67
|
+
const FIRE_YELLOW = "#B34A00";
|
|
67
68
|
// ORANGE
|
|
68
69
|
const CARROT_ORANGE = "#ED9620";
|
|
69
70
|
const ZEST_ORANGE = "#F47820";
|
|
@@ -166,6 +167,7 @@ export {
|
|
|
166
167
|
SEA_GREEN,
|
|
167
168
|
SELECTIVE_YELLOW,
|
|
168
169
|
MUSTARD_YELLOW,
|
|
170
|
+
FIRE_YELLOW,
|
|
169
171
|
CARROT_ORANGE,
|
|
170
172
|
ZEST_ORANGE,
|
|
171
173
|
APRICOT_ORANGE,
|