@thecb/components 4.1.8-beta.1 → 4.1.10-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 +109 -35
- package/package.json +1 -1
- package/src/components/atoms/dropdown/Dropdown.js +7 -3
- package/src/components/atoms/icons/CarrotIcon.js +45 -0
- package/src/components/atoms/icons/index.js +3 -1
- package/src/components/molecules/nav-menu/NavMenuDesktop.js +3 -3
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +29 -1
- package/src/components/molecules/payment-form-card/PaymentFormCard.state.js +23 -3
package/dist/index.cjs.js
CHANGED
|
@@ -14720,6 +14720,47 @@ var StatusUnknownIcon = function StatusUnknownIcon() {
|
|
|
14720
14720
|
}))));
|
|
14721
14721
|
};
|
|
14722
14722
|
|
|
14723
|
+
var CarrotIcon = function CarrotIcon(_ref) {
|
|
14724
|
+
var themeValues = _ref.themeValues;
|
|
14725
|
+
return /*#__PURE__*/React__default.createElement("svg", {
|
|
14726
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14727
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
14728
|
+
width: "10",
|
|
14729
|
+
height: "5",
|
|
14730
|
+
viewBox: "0 0 10 5"
|
|
14731
|
+
}, /*#__PURE__*/React__default.createElement("defs", null, /*#__PURE__*/React__default.createElement("path", {
|
|
14732
|
+
id: "carrot-path-1",
|
|
14733
|
+
d: "M6.99999958 9.9999994L11.9999993 14.9999991 16.999999 9.9999994z"
|
|
14734
|
+
})), /*#__PURE__*/React__default.createElement("g", {
|
|
14735
|
+
fill: "none",
|
|
14736
|
+
fillRule: "evenodd",
|
|
14737
|
+
stroke: "none",
|
|
14738
|
+
strokeWidth: "1"
|
|
14739
|
+
}, /*#__PURE__*/React__default.createElement("g", {
|
|
14740
|
+
transform: "translate(-423 -974)"
|
|
14741
|
+
}, /*#__PURE__*/React__default.createElement("g", {
|
|
14742
|
+
transform: "translate(372 958)"
|
|
14743
|
+
}, /*#__PURE__*/React__default.createElement("g", {
|
|
14744
|
+
transform: "translate(44 6)"
|
|
14745
|
+
}, /*#__PURE__*/React__default.createElement("mask", {
|
|
14746
|
+
id: "carrot-mask-2",
|
|
14747
|
+
fill: "#fff"
|
|
14748
|
+
}, /*#__PURE__*/React__default.createElement("use", {
|
|
14749
|
+
xlinkHref: "#carrot-path-1"
|
|
14750
|
+
})), /*#__PURE__*/React__default.createElement("use", {
|
|
14751
|
+
fill: "#000",
|
|
14752
|
+
xlinkHref: "#carrot-path-1"
|
|
14753
|
+
}), /*#__PURE__*/React__default.createElement("g", {
|
|
14754
|
+
fill: themeValues.singleIconColor,
|
|
14755
|
+
fillRule: "nonzero",
|
|
14756
|
+
mask: "url(#carrot-mask-2)"
|
|
14757
|
+
}, /*#__PURE__*/React__default.createElement("g", null, /*#__PURE__*/React__default.createElement("path", {
|
|
14758
|
+
d: "M0 0H24V24H0z"
|
|
14759
|
+
}))))))));
|
|
14760
|
+
};
|
|
14761
|
+
|
|
14762
|
+
var CarrotIcon$1 = themeComponent(CarrotIcon, "Icons", fallbackValues$2, "darkMode");
|
|
14763
|
+
|
|
14723
14764
|
var color$2 = "#15749D";
|
|
14724
14765
|
var hoverColor$1 = "#116285";
|
|
14725
14766
|
var activeColor$1 = "#0E506D";
|
|
@@ -18866,7 +18907,7 @@ function _templateObject3$5() {
|
|
|
18866
18907
|
}
|
|
18867
18908
|
|
|
18868
18909
|
function _templateObject2$b() {
|
|
18869
|
-
var data = _taggedTemplateLiteral(["\n transform-origin: 0 0;\n border: 1px solid ", ";\n border-radius: 2px;\n background-color: ", ";\n padding: 8px 0 8px;\n position: absolute;\n width: 100%;\n max-height: ", ";\n overflow-y: scroll;\n z-index: 1;\n box-sizing: border-box;\n &:focus {\n outline: none;\n }\n"]);
|
|
18910
|
+
var data = _taggedTemplateLiteral(["\n transform-origin: 0 0;\n border: 1px solid ", ";\n border-radius: 2px;\n background-color: ", ";\n padding: 8px 0 8px;\n position: absolute;\n width: ", ";\n min-width: 100%;\n max-height: ", ";\n overflow-y: scroll;\n z-index: 1;\n box-sizing: border-box;\n &:focus {\n outline: none;\n }\n"]);
|
|
18870
18911
|
|
|
18871
18912
|
_templateObject2$b = function _templateObject2() {
|
|
18872
18913
|
return data;
|
|
@@ -18876,7 +18917,7 @@ function _templateObject2$b() {
|
|
|
18876
18917
|
}
|
|
18877
18918
|
|
|
18878
18919
|
function _templateObject$n() {
|
|
18879
|
-
var data = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n transition: transform 0.3s ease;\n ", "\n"]);
|
|
18920
|
+
var data = _taggedTemplateLiteral(["\n display: flex;\n padding-left: 8px;\n flex-direction: column;\n justify-content: center;\n transition: transform 0.3s ease;\n ", "\n"]);
|
|
18880
18921
|
|
|
18881
18922
|
_templateObject$n = function _templateObject() {
|
|
18882
18923
|
return data;
|
|
@@ -18889,47 +18930,52 @@ var IconWrapper = styled__default.div(_templateObject$n(), function (_ref) {
|
|
|
18889
18930
|
return open ? "transform: rotate(-180deg)" : "";
|
|
18890
18931
|
});
|
|
18891
18932
|
var DropdownContentWrapper = styled__default.div(_templateObject2$b(), GREY_CHATEAU, WHITE, function (_ref2) {
|
|
18892
|
-
var
|
|
18933
|
+
var widthFitOptions = _ref2.widthFitOptions;
|
|
18934
|
+
return widthFitOptions ? "fit-content" : "100%";
|
|
18935
|
+
}, function (_ref3) {
|
|
18936
|
+
var maxHeight = _ref3.maxHeight;
|
|
18893
18937
|
return maxHeight || "400px";
|
|
18894
18938
|
});
|
|
18895
|
-
var DropdownItemWrapper = styled__default.div(_templateObject3$5(), function (
|
|
18896
|
-
var selected =
|
|
18897
|
-
themeValues =
|
|
18939
|
+
var DropdownItemWrapper = styled__default.div(_templateObject3$5(), function (_ref4) {
|
|
18940
|
+
var selected = _ref4.selected,
|
|
18941
|
+
themeValues = _ref4.themeValues;
|
|
18898
18942
|
return selected ? themeValues.selectedColor : WHITE;
|
|
18899
|
-
}, function (_ref4) {
|
|
18900
|
-
var disabled = _ref4.disabled;
|
|
18901
|
-
return disabled ? "default" : "pointer";
|
|
18902
18943
|
}, function (_ref5) {
|
|
18903
|
-
var
|
|
18904
|
-
|
|
18905
|
-
themeValues = _ref5.themeValues;
|
|
18906
|
-
return selected ? themeValues.selectedColor : disabled ? WHITE : themeValues.hoverColor;
|
|
18944
|
+
var disabled = _ref5.disabled;
|
|
18945
|
+
return disabled ? "default" : "pointer";
|
|
18907
18946
|
}, function (_ref6) {
|
|
18908
18947
|
var selected = _ref6.selected,
|
|
18909
18948
|
disabled = _ref6.disabled,
|
|
18910
18949
|
themeValues = _ref6.themeValues;
|
|
18911
18950
|
return selected ? themeValues.selectedColor : disabled ? WHITE : themeValues.hoverColor;
|
|
18951
|
+
}, function (_ref7) {
|
|
18952
|
+
var selected = _ref7.selected,
|
|
18953
|
+
disabled = _ref7.disabled,
|
|
18954
|
+
themeValues = _ref7.themeValues;
|
|
18955
|
+
return selected ? themeValues.selectedColor : disabled ? WHITE : themeValues.hoverColor;
|
|
18912
18956
|
});
|
|
18913
|
-
var SearchInput = styled__default.input(_templateObject4$2(), function (
|
|
18914
|
-
var themeValues =
|
|
18957
|
+
var SearchInput = styled__default.input(_templateObject4$2(), function (_ref8) {
|
|
18958
|
+
var themeValues = _ref8.themeValues;
|
|
18915
18959
|
return themeValues.hoverColor && themeValues.hoverColor;
|
|
18916
18960
|
});
|
|
18917
18961
|
|
|
18918
|
-
var Dropdown = function Dropdown(
|
|
18962
|
+
var Dropdown = function Dropdown(_ref9) {
|
|
18919
18963
|
var _options$find;
|
|
18920
18964
|
|
|
18921
|
-
var placeholder =
|
|
18922
|
-
options =
|
|
18923
|
-
value =
|
|
18924
|
-
isOpen =
|
|
18925
|
-
isError =
|
|
18926
|
-
onSelect =
|
|
18927
|
-
|
|
18928
|
-
disabledValues =
|
|
18929
|
-
|
|
18930
|
-
onClick =
|
|
18931
|
-
themeValues =
|
|
18932
|
-
maxHeight =
|
|
18965
|
+
var placeholder = _ref9.placeholder,
|
|
18966
|
+
options = _ref9.options,
|
|
18967
|
+
value = _ref9.value,
|
|
18968
|
+
isOpen = _ref9.isOpen,
|
|
18969
|
+
isError = _ref9.isError,
|
|
18970
|
+
onSelect = _ref9.onSelect,
|
|
18971
|
+
_ref9$disabledValues = _ref9.disabledValues,
|
|
18972
|
+
disabledValues = _ref9$disabledValues === void 0 ? [] : _ref9$disabledValues,
|
|
18973
|
+
_ref9$onClick = _ref9.onClick,
|
|
18974
|
+
onClick = _ref9$onClick === void 0 ? noop : _ref9$onClick,
|
|
18975
|
+
themeValues = _ref9.themeValues,
|
|
18976
|
+
maxHeight = _ref9.maxHeight,
|
|
18977
|
+
_ref9$widthFitOptions = _ref9.widthFitOptions,
|
|
18978
|
+
widthFitOptions = _ref9$widthFitOptions === void 0 ? false : _ref9$widthFitOptions;
|
|
18933
18979
|
|
|
18934
18980
|
var _useState = React.useState(""),
|
|
18935
18981
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -19025,7 +19071,7 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19025
19071
|
break;
|
|
19026
19072
|
}
|
|
19027
19073
|
|
|
19028
|
-
if (keyCode > 64 && keyCode < 91 || keyCode == 32) {
|
|
19074
|
+
if (keyCode > 64 && keyCode < 91 || keyCode == 32 || keyCode == 189) {
|
|
19029
19075
|
e.preventDefault();
|
|
19030
19076
|
setInputValue(inputValue + key);
|
|
19031
19077
|
}
|
|
@@ -19096,6 +19142,7 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19096
19142
|
maxHeight: maxHeight,
|
|
19097
19143
|
open: isOpen,
|
|
19098
19144
|
ref: dropdownRef,
|
|
19145
|
+
widthFitOptions: widthFitOptions,
|
|
19099
19146
|
tabIndex: 0
|
|
19100
19147
|
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
19101
19148
|
childGap: "0"
|
|
@@ -36550,9 +36597,9 @@ var fallbackValues$u = {
|
|
|
36550
36597
|
var NavMenuDesktop = function NavMenuDesktop(_ref) {
|
|
36551
36598
|
var id = _ref.id,
|
|
36552
36599
|
_ref$top = _ref.top,
|
|
36553
|
-
top = _ref$top === void 0 ? "
|
|
36600
|
+
top = _ref$top === void 0 ? "115%" : _ref$top,
|
|
36554
36601
|
_ref$left = _ref.left,
|
|
36555
|
-
left = _ref$left === void 0 ? "-
|
|
36602
|
+
left = _ref$left === void 0 ? "-165%" : _ref$left,
|
|
36556
36603
|
_ref$menuContent = _ref.menuContent,
|
|
36557
36604
|
menuContent = _ref$menuContent === void 0 ? [] : _ref$menuContent,
|
|
36558
36605
|
_ref$visible = _ref.visible,
|
|
@@ -36575,7 +36622,7 @@ var NavMenuDesktop = function NavMenuDesktop(_ref) {
|
|
|
36575
36622
|
extraStyles: "position: relative; ".concat(menuCarat),
|
|
36576
36623
|
background: themeValues.backgroundColor,
|
|
36577
36624
|
borderRadius: "5px",
|
|
36578
|
-
boxShadow: "0px
|
|
36625
|
+
boxShadow: "0px 1px 8px -1px rgba(0, 0, 0, 0.3), 0px 1px 4px 0px ".concat(themeValues.shadowColor, ", 0px 7px 32px 0px ").concat(themeValues.shadowColor),
|
|
36579
36626
|
onMouseEnter: onMouseEnter,
|
|
36580
36627
|
onMouseLeave: onMouseLeave,
|
|
36581
36628
|
onFocus: onFocus,
|
|
@@ -39296,6 +39343,8 @@ var expirationDateErrors = (_expirationDateErrors = {}, _defineProperty(_expirat
|
|
|
39296
39343
|
var cvvErrors = (_cvvErrors = {}, _defineProperty(_cvvErrors, required.error, "CVV is required"), _defineProperty(_cvvErrors, hasLength.error, "CVV is invalid"), _cvvErrors);
|
|
39297
39344
|
var zipCodeErrors = (_zipCodeErrors = {}, _defineProperty(_zipCodeErrors, required.error, "Zip code is required"), _defineProperty(_zipCodeErrors, hasLength.error, "Zip code is invalid"), _zipCodeErrors);
|
|
39298
39345
|
|
|
39346
|
+
var countryErrorMessages = _defineProperty({}, required.error, "Country is required");
|
|
39347
|
+
|
|
39299
39348
|
var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
39300
39349
|
var _ref$variant = _ref.variant,
|
|
39301
39350
|
variant = _ref$variant === void 0 ? "default" : _ref$variant,
|
|
@@ -39330,11 +39379,29 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
39330
39379
|
};
|
|
39331
39380
|
}
|
|
39332
39381
|
}, []);
|
|
39382
|
+
var isUS = fields.country.rawValue === "US";
|
|
39333
39383
|
return /*#__PURE__*/React__default.createElement(FormContainer$1, {
|
|
39334
39384
|
variant: variant,
|
|
39335
39385
|
role: "form",
|
|
39336
39386
|
"aria-label": "Card payment"
|
|
39337
|
-
}, /*#__PURE__*/React__default.createElement(FormInputColumn, null, /*#__PURE__*/React__default.createElement(
|
|
39387
|
+
}, /*#__PURE__*/React__default.createElement(FormInputColumn, null, /*#__PURE__*/React__default.createElement(CountryDropdown, {
|
|
39388
|
+
labelTextWhenNoError: "Country",
|
|
39389
|
+
errorMessages: countryErrorMessages,
|
|
39390
|
+
field: fields.country,
|
|
39391
|
+
onChange: function onChange(value) {
|
|
39392
|
+
actions.fields.country.set(value); // temporary measure to not dirty fields until
|
|
39393
|
+
// we can write a reset function for fields
|
|
39394
|
+
|
|
39395
|
+
if (fields.stateProvince.rawValue) {
|
|
39396
|
+
actions.fields.stateProvince.set("");
|
|
39397
|
+
}
|
|
39398
|
+
|
|
39399
|
+
if (fields.zipCode.rawValue) {
|
|
39400
|
+
actions.fields.zipCode.set("");
|
|
39401
|
+
}
|
|
39402
|
+
},
|
|
39403
|
+
showErrors: showErrors
|
|
39404
|
+
}), /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
39338
39405
|
labelTextWhenNoError: "Name on card",
|
|
39339
39406
|
errorMessages: nameOnCardErrors,
|
|
39340
39407
|
field: fields.nameOnCard,
|
|
@@ -39379,6 +39446,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
39379
39446
|
padding: isMobile ? "0" : "0 0.5rem 0 0",
|
|
39380
39447
|
width: isMobile ? "100%" : "50%"
|
|
39381
39448
|
}, /*#__PURE__*/React__default.createElement(FormInput$1, {
|
|
39449
|
+
isNum: isUS,
|
|
39450
|
+
formatter: isUS ? zipFormat : null,
|
|
39382
39451
|
labelTextWhenNoError: "Zip code",
|
|
39383
39452
|
errorMessages: zipCodeErrors,
|
|
39384
39453
|
field: fields.zipCode,
|
|
@@ -39408,6 +39477,10 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
39408
39477
|
};
|
|
39409
39478
|
|
|
39410
39479
|
var formConfig$7 = {
|
|
39480
|
+
country: {
|
|
39481
|
+
defaultValue: "US",
|
|
39482
|
+
validators: [required()]
|
|
39483
|
+
},
|
|
39411
39484
|
nameOnCard: {
|
|
39412
39485
|
validators: [required()]
|
|
39413
39486
|
},
|
|
@@ -39424,8 +39497,8 @@ var formConfig$7 = {
|
|
|
39424
39497
|
constraints: [onlyIntegers(), hasLength(0, 4)]
|
|
39425
39498
|
},
|
|
39426
39499
|
zipCode: {
|
|
39427
|
-
validators: [required(), hasLength(5, 5)],
|
|
39428
|
-
constraints: [onlyIntegers(), hasLength(0,
|
|
39500
|
+
validators: [required(), validateWhen(validateWhen(hasLength(5, 5), hasLength(0, 5)), matchesRegex("US"), "country"), validateWhen(validateWhen(hasLength(9, 9), hasLength(6, 9)), matchesRegex("US"), "country")],
|
|
39501
|
+
constraints: [validateWhen(onlyIntegers(), matchesRegex("US"), "country"), validateWhen(hasLength(0, 9), matchesRegex("US"), "country")]
|
|
39429
39502
|
}
|
|
39430
39503
|
};
|
|
39431
39504
|
|
|
@@ -40690,6 +40763,7 @@ exports.Breadcrumb = Breadcrumbs;
|
|
|
40690
40763
|
exports.ButtonWithAction = ButtonWithAction;
|
|
40691
40764
|
exports.ButtonWithLink = ButtonWithLink;
|
|
40692
40765
|
exports.CalendarIcon = CalendarIcon;
|
|
40766
|
+
exports.CarrotIcon = CarrotIcon$1;
|
|
40693
40767
|
exports.Center = Center;
|
|
40694
40768
|
exports.CenterSingle = CenterSingle$1;
|
|
40695
40769
|
exports.CenterStack = CenterStack$1;
|
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@ import { themeComponent } from "../../../util/themeUtils";
|
|
|
17
17
|
|
|
18
18
|
const IconWrapper = styled.div`
|
|
19
19
|
display: flex;
|
|
20
|
+
padding-left: 8px;
|
|
20
21
|
flex-direction: column;
|
|
21
22
|
justify-content: center;
|
|
22
23
|
transition: transform 0.3s ease;
|
|
@@ -30,7 +31,8 @@ const DropdownContentWrapper = styled.div`
|
|
|
30
31
|
background-color: ${WHITE};
|
|
31
32
|
padding: 8px 0 8px;
|
|
32
33
|
position: absolute;
|
|
33
|
-
width: 100
|
|
34
|
+
width: ${({ widthFitOptions }) => (widthFitOptions ? "fit-content" : "100%")};
|
|
35
|
+
min-width: 100%;
|
|
34
36
|
max-height: ${({ maxHeight }) => maxHeight || "400px"};
|
|
35
37
|
overflow-y: scroll;
|
|
36
38
|
z-index: 1;
|
|
@@ -89,7 +91,8 @@ const Dropdown = ({
|
|
|
89
91
|
disabledValues = [],
|
|
90
92
|
onClick = noop,
|
|
91
93
|
themeValues,
|
|
92
|
-
maxHeight
|
|
94
|
+
maxHeight,
|
|
95
|
+
widthFitOptions = false
|
|
93
96
|
}) => {
|
|
94
97
|
const [inputValue, setInputValue] = useState("");
|
|
95
98
|
const [optionsState, setOptionsState] = useState([]);
|
|
@@ -151,7 +154,7 @@ const Dropdown = ({
|
|
|
151
154
|
setInputValue(inputValue.slice(0, -1));
|
|
152
155
|
break;
|
|
153
156
|
}
|
|
154
|
-
if ((keyCode > 64 && keyCode < 91) || keyCode == 32) {
|
|
157
|
+
if ((keyCode > 64 && keyCode < 91) || keyCode == 32 || keyCode == 189) {
|
|
155
158
|
e.preventDefault();
|
|
156
159
|
setInputValue(inputValue + key);
|
|
157
160
|
}
|
|
@@ -247,6 +250,7 @@ const Dropdown = ({
|
|
|
247
250
|
maxHeight={maxHeight}
|
|
248
251
|
open={isOpen}
|
|
249
252
|
ref={dropdownRef}
|
|
253
|
+
widthFitOptions={widthFitOptions}
|
|
250
254
|
tabIndex={0}
|
|
251
255
|
>
|
|
252
256
|
<Stack childGap="0">
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { fallbackValues } from "./Icons.theme";
|
|
3
|
+
import { themeComponent } from "../../../util/themeUtils";
|
|
4
|
+
|
|
5
|
+
const CarrotIcon = ({ themeValues }) => {
|
|
6
|
+
return (
|
|
7
|
+
<svg
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
10
|
+
width="10"
|
|
11
|
+
height="5"
|
|
12
|
+
viewBox="0 0 10 5"
|
|
13
|
+
>
|
|
14
|
+
<defs>
|
|
15
|
+
<path
|
|
16
|
+
id="carrot-path-1"
|
|
17
|
+
d="M6.99999958 9.9999994L11.9999993 14.9999991 16.999999 9.9999994z"
|
|
18
|
+
></path>
|
|
19
|
+
</defs>
|
|
20
|
+
<g fill="none" fillRule="evenodd" stroke="none" strokeWidth="1">
|
|
21
|
+
<g transform="translate(-423 -974)">
|
|
22
|
+
<g transform="translate(372 958)">
|
|
23
|
+
<g transform="translate(44 6)">
|
|
24
|
+
<mask id="carrot-mask-2" fill="#fff">
|
|
25
|
+
<use xlinkHref="#carrot-path-1"></use>
|
|
26
|
+
</mask>
|
|
27
|
+
<use fill="#000" xlinkHref="#carrot-path-1"></use>
|
|
28
|
+
<g
|
|
29
|
+
fill={themeValues.singleIconColor}
|
|
30
|
+
fillRule="nonzero"
|
|
31
|
+
mask="url(#carrot-mask-2)"
|
|
32
|
+
>
|
|
33
|
+
<g>
|
|
34
|
+
<path d="M0 0H24V24H0z"></path>
|
|
35
|
+
</g>
|
|
36
|
+
</g>
|
|
37
|
+
</g>
|
|
38
|
+
</g>
|
|
39
|
+
</g>
|
|
40
|
+
</g>
|
|
41
|
+
</svg>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default themeComponent(CarrotIcon, "Icons", fallbackValues, "darkMode");
|
|
@@ -39,6 +39,7 @@ import RejectedVelocityIcon from "./RejectedVelocityIcon";
|
|
|
39
39
|
import SuccessfulIcon from "./SuccessfulIcon";
|
|
40
40
|
import VoidedIcon from "./VoidedIcon";
|
|
41
41
|
import StatusUnknownIcon from "./StatusUnknownIcon";
|
|
42
|
+
import CarrotIcon from "./CarrotIcon";
|
|
42
43
|
|
|
43
44
|
export {
|
|
44
45
|
AccountsIcon,
|
|
@@ -81,5 +82,6 @@ export {
|
|
|
81
82
|
RejectedVelocityIcon,
|
|
82
83
|
SuccessfulIcon,
|
|
83
84
|
VoidedIcon,
|
|
84
|
-
StatusUnknownIcon
|
|
85
|
+
StatusUnknownIcon,
|
|
86
|
+
CarrotIcon
|
|
85
87
|
};
|
|
@@ -5,8 +5,8 @@ import { themeComponent } from "../../../util/themeUtils";
|
|
|
5
5
|
|
|
6
6
|
const NavMenuDesktop = ({
|
|
7
7
|
id,
|
|
8
|
-
top = "
|
|
9
|
-
left = "-
|
|
8
|
+
top = "115%",
|
|
9
|
+
left = "-165%",
|
|
10
10
|
menuContent = [],
|
|
11
11
|
visible = true,
|
|
12
12
|
onMouseEnter,
|
|
@@ -25,7 +25,7 @@ const NavMenuDesktop = ({
|
|
|
25
25
|
extraStyles={`position: relative; ${menuCarat}`}
|
|
26
26
|
background={themeValues.backgroundColor}
|
|
27
27
|
borderRadius="5px"
|
|
28
|
-
boxShadow={`0px
|
|
28
|
+
boxShadow={`0px 1px 8px -1px rgba(0, 0, 0, 0.3), 0px 1px 4px 0px ${themeValues.shadowColor}, 0px 7px 32px 0px ${themeValues.shadowColor}`}
|
|
29
29
|
onMouseEnter={onMouseEnter}
|
|
30
30
|
onMouseLeave={onMouseLeave}
|
|
31
31
|
onFocus={onFocus}
|
|
@@ -2,8 +2,13 @@ import React, { useEffect, useState } from "react";
|
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import { required, hasLength, matchesRegex } from "redux-freeform";
|
|
4
4
|
import Checkbox from "../../atoms/checkbox";
|
|
5
|
+
import CountryDropdown from "../../atoms/country-dropdown";
|
|
5
6
|
import { checkCardBrand, noop } from "../../../util/general";
|
|
6
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
expirationDateFormat,
|
|
9
|
+
creditCardFormat,
|
|
10
|
+
zipFormat
|
|
11
|
+
} from "../../../util/formats";
|
|
7
12
|
import {
|
|
8
13
|
FormInput,
|
|
9
14
|
FormInputColumn,
|
|
@@ -36,6 +41,9 @@ const zipCodeErrors = {
|
|
|
36
41
|
[required.error]: "Zip code is required",
|
|
37
42
|
[hasLength.error]: "Zip code is invalid"
|
|
38
43
|
};
|
|
44
|
+
const countryErrorMessages = {
|
|
45
|
+
[required.error]: "Country is required"
|
|
46
|
+
};
|
|
39
47
|
|
|
40
48
|
const PaymentFormCard = ({
|
|
41
49
|
variant = "default",
|
|
@@ -61,9 +69,27 @@ const PaymentFormCard = ({
|
|
|
61
69
|
return () => actions.form.clear();
|
|
62
70
|
}
|
|
63
71
|
}, []);
|
|
72
|
+
const isUS = fields.country.rawValue === "US";
|
|
64
73
|
return (
|
|
65
74
|
<FormContainer variant={variant} role="form" aria-label="Card payment">
|
|
66
75
|
<FormInputColumn>
|
|
76
|
+
<CountryDropdown
|
|
77
|
+
labelTextWhenNoError="Country"
|
|
78
|
+
errorMessages={countryErrorMessages}
|
|
79
|
+
field={fields.country}
|
|
80
|
+
onChange={value => {
|
|
81
|
+
actions.fields.country.set(value);
|
|
82
|
+
// temporary measure to not dirty fields until
|
|
83
|
+
// we can write a reset function for fields
|
|
84
|
+
if (fields.stateProvince.rawValue) {
|
|
85
|
+
actions.fields.stateProvince.set("");
|
|
86
|
+
}
|
|
87
|
+
if (fields.zipCode.rawValue) {
|
|
88
|
+
actions.fields.zipCode.set("");
|
|
89
|
+
}
|
|
90
|
+
}}
|
|
91
|
+
showErrors={showErrors}
|
|
92
|
+
/>
|
|
67
93
|
<FormInput
|
|
68
94
|
labelTextWhenNoError="Name on card"
|
|
69
95
|
errorMessages={nameOnCardErrors}
|
|
@@ -111,6 +137,8 @@ const PaymentFormCard = ({
|
|
|
111
137
|
width={isMobile ? "100%" : "50%"}
|
|
112
138
|
>
|
|
113
139
|
<FormInput
|
|
140
|
+
isNum={isUS}
|
|
141
|
+
formatter={isUS ? zipFormat : null}
|
|
114
142
|
labelTextWhenNoError="Zip code"
|
|
115
143
|
errorMessages={zipCodeErrors}
|
|
116
144
|
field={fields.zipCode}
|
|
@@ -3,12 +3,17 @@ import {
|
|
|
3
3
|
required,
|
|
4
4
|
onlyIntegers,
|
|
5
5
|
hasLength,
|
|
6
|
-
matchesRegex
|
|
6
|
+
matchesRegex,
|
|
7
|
+
validateWhen
|
|
7
8
|
} from "redux-freeform";
|
|
8
9
|
|
|
9
10
|
//TODO: Will make zip code able to have more than 5 digits once we add in the FormattedInput because it will have issues with format of 60606-1111.
|
|
10
11
|
|
|
11
12
|
const formConfig = {
|
|
13
|
+
country: {
|
|
14
|
+
defaultValue: "US",
|
|
15
|
+
validators: [required()]
|
|
16
|
+
},
|
|
12
17
|
nameOnCard: {
|
|
13
18
|
validators: [required()]
|
|
14
19
|
},
|
|
@@ -29,8 +34,23 @@ const formConfig = {
|
|
|
29
34
|
constraints: [onlyIntegers(), hasLength(0, 4)]
|
|
30
35
|
},
|
|
31
36
|
zipCode: {
|
|
32
|
-
validators: [
|
|
33
|
-
|
|
37
|
+
validators: [
|
|
38
|
+
required(),
|
|
39
|
+
validateWhen(
|
|
40
|
+
validateWhen(hasLength(5, 5), hasLength(0, 5)),
|
|
41
|
+
matchesRegex("US"),
|
|
42
|
+
"country"
|
|
43
|
+
),
|
|
44
|
+
validateWhen(
|
|
45
|
+
validateWhen(hasLength(9, 9), hasLength(6, 9)),
|
|
46
|
+
matchesRegex("US"),
|
|
47
|
+
"country"
|
|
48
|
+
)
|
|
49
|
+
],
|
|
50
|
+
constraints: [
|
|
51
|
+
validateWhen(onlyIntegers(), matchesRegex("US"), "country"),
|
|
52
|
+
validateWhen(hasLength(0, 9), matchesRegex("US"), "country")
|
|
53
|
+
]
|
|
34
54
|
}
|
|
35
55
|
};
|
|
36
56
|
|