@thecb/components 5.0.0-beta.9 → 5.2.1
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 +282 -260
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.esm.js +41626 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +7 -3
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/atoms/icons/CashIcon.js +21 -0
- package/src/components/atoms/icons/index.js +3 -1
- package/src/components/molecules/.DS_Store +0 -0
- package/src/components/molecules/modal/Modal.js +1 -1
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +3 -1
- package/src/components/molecules/payment-form-card/PaymentFormCard.state.js +4 -2
- package/src/deprecated/.DS_Store +0 -0
- package/.babelrc +0 -24
- package/.eslintrc.json +0 -29
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -18
- package/.github/stale.yml +0 -17
- package/.github/workflows/bump-version.yml +0 -30
- package/.github/workflows/create-release/build-body.sh +0 -35
- package/.github/workflows/create-release.yml +0 -52
- package/.github/workflows/disabled-workflows/publish-update.yml +0 -73
- package/.prettierignore +0 -3
- package/.storybook/main.js +0 -4
- package/.storybook/page.js +0 -64
- package/.storybook/themes/apc.theme.js +0 -1
- package/.storybook/themes/index.js +0 -2
- package/.storybook/themes/sf.theme.js +0 -1
- package/.tool-versions +0 -1
- package/rollup.config.js +0 -53
package/dist/index.cjs.js
CHANGED
|
@@ -5014,10 +5014,6 @@ var TextSpan = styled__default.span.withConfig({
|
|
|
5014
5014
|
|
|
5015
5015
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
5016
5016
|
|
|
5017
|
-
function unwrapExports (x) {
|
|
5018
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5019
|
-
}
|
|
5020
|
-
|
|
5021
5017
|
function createCommonjsModule(fn, module) {
|
|
5022
5018
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
5023
5019
|
}
|
|
@@ -15277,6 +15273,24 @@ var WarningIconXS = function WarningIconXS() {
|
|
|
15277
15273
|
})))));
|
|
15278
15274
|
};
|
|
15279
15275
|
|
|
15276
|
+
var CashIcon = function CashIcon() {
|
|
15277
|
+
return /*#__PURE__*/React__default.createElement("svg", {
|
|
15278
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
15279
|
+
width: "36",
|
|
15280
|
+
height: "24",
|
|
15281
|
+
fill: "none",
|
|
15282
|
+
viewBox: "0 0 36 24"
|
|
15283
|
+
}, /*#__PURE__*/React__default.createElement("rect", {
|
|
15284
|
+
width: "36",
|
|
15285
|
+
height: "24",
|
|
15286
|
+
fill: "#E8FFEF",
|
|
15287
|
+
rx: "1"
|
|
15288
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
15289
|
+
fill: "#317D4F",
|
|
15290
|
+
d: "M17.178 5.464v1.372c-1.799.294-3.115 1.407-3.094 3.08.021 1.645 1.05 2.597 2.611 2.884l1.617.308c.924.182 1.365.406 1.365 1.085 0 .609-.553 1.092-1.484 1.092-1.036 0-1.743-.455-1.932-1.267l-2.478.021c.175 1.834 1.414 2.8 3.374 3.038v1.197h2.023V17.07c1.876-.266 3.024-1.33 3.024-2.877 0-1.617-.798-2.751-2.702-3.178l-1.603-.357c-.994-.231-1.267-.497-1.267-1.029 0-.546.511-1.015 1.596-1.015 1.015 0 1.302.511 1.393 1.267l2.415-.014c.05-1.484-1.043-2.695-2.835-3.024V5.464h-2.023z"
|
|
15291
|
+
}));
|
|
15292
|
+
};
|
|
15293
|
+
|
|
15280
15294
|
var color$2 = "#15749D";
|
|
15281
15295
|
var hoverColor$1 = "#116285";
|
|
15282
15296
|
var activeColor$1 = "#0E506D";
|
|
@@ -20675,303 +20689,283 @@ var DisplayCard = function DisplayCard(_ref) {
|
|
|
20675
20689
|
}) : /*#__PURE__*/React__default.createElement(React.Fragment, null))))));
|
|
20676
20690
|
};
|
|
20677
20691
|
|
|
20678
|
-
|
|
20679
|
-
|
|
20680
|
-
|
|
20681
|
-
|
|
20682
|
-
var React__default = 'default' in React ? React['default'] : React;
|
|
20683
|
-
|
|
20684
|
-
function _extends() {
|
|
20685
|
-
_extends = Object.assign || function (target) {
|
|
20686
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
20687
|
-
var source = arguments[i];
|
|
20692
|
+
function _extends$2() {
|
|
20693
|
+
_extends$2 = Object.assign || function (target) {
|
|
20694
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
20695
|
+
var source = arguments[i];
|
|
20688
20696
|
|
|
20689
|
-
|
|
20690
|
-
|
|
20691
|
-
|
|
20692
|
-
}
|
|
20697
|
+
for (var key in source) {
|
|
20698
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
20699
|
+
target[key] = source[key];
|
|
20693
20700
|
}
|
|
20694
20701
|
}
|
|
20702
|
+
}
|
|
20695
20703
|
|
|
20696
|
-
|
|
20697
|
-
|
|
20698
|
-
|
|
20699
|
-
return _extends.apply(this, arguments);
|
|
20700
|
-
}
|
|
20704
|
+
return target;
|
|
20705
|
+
};
|
|
20701
20706
|
|
|
20702
|
-
|
|
20703
|
-
|
|
20704
|
-
var target = {};
|
|
20705
|
-
var sourceKeys = Object.keys(source);
|
|
20706
|
-
var key, i;
|
|
20707
|
+
return _extends$2.apply(this, arguments);
|
|
20708
|
+
}
|
|
20707
20709
|
|
|
20708
|
-
|
|
20709
|
-
|
|
20710
|
-
|
|
20711
|
-
|
|
20712
|
-
|
|
20710
|
+
function _objectWithoutPropertiesLoose$1(source, excluded) {
|
|
20711
|
+
if (source == null) return {};
|
|
20712
|
+
var target = {};
|
|
20713
|
+
var sourceKeys = Object.keys(source);
|
|
20714
|
+
var key, i;
|
|
20713
20715
|
|
|
20714
|
-
|
|
20716
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
20717
|
+
key = sourceKeys[i];
|
|
20718
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
20719
|
+
target[key] = source[key];
|
|
20715
20720
|
}
|
|
20716
20721
|
|
|
20717
|
-
|
|
20718
|
-
|
|
20722
|
+
return target;
|
|
20723
|
+
}
|
|
20719
20724
|
|
|
20720
|
-
|
|
20725
|
+
function _objectWithoutProperties$1(source, excluded) {
|
|
20726
|
+
if (source == null) return {};
|
|
20721
20727
|
|
|
20722
|
-
|
|
20728
|
+
var target = _objectWithoutPropertiesLoose$1(source, excluded);
|
|
20723
20729
|
|
|
20724
|
-
|
|
20725
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
20730
|
+
var key, i;
|
|
20726
20731
|
|
|
20727
|
-
|
|
20728
|
-
|
|
20729
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
20730
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
20731
|
-
target[key] = source[key];
|
|
20732
|
-
}
|
|
20733
|
-
}
|
|
20732
|
+
if (Object.getOwnPropertySymbols) {
|
|
20733
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
20734
20734
|
|
|
20735
|
-
|
|
20735
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
20736
|
+
key = sourceSymbolKeys[i];
|
|
20737
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
20738
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
20739
|
+
target[key] = source[key];
|
|
20740
|
+
}
|
|
20736
20741
|
}
|
|
20737
20742
|
|
|
20738
|
-
|
|
20739
|
-
|
|
20740
|
-
}
|
|
20743
|
+
return target;
|
|
20744
|
+
}
|
|
20741
20745
|
|
|
20742
|
-
|
|
20743
|
-
|
|
20744
|
-
|
|
20746
|
+
function _slicedToArray$1(arr, i) {
|
|
20747
|
+
return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _nonIterableRest$1();
|
|
20748
|
+
}
|
|
20745
20749
|
|
|
20746
|
-
|
|
20747
|
-
|
|
20748
|
-
|
|
20750
|
+
function _toConsumableArray$1(arr) {
|
|
20751
|
+
return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _nonIterableSpread$1();
|
|
20752
|
+
}
|
|
20749
20753
|
|
|
20750
|
-
|
|
20751
|
-
|
|
20752
|
-
|
|
20754
|
+
function _arrayWithoutHoles$1(arr) {
|
|
20755
|
+
if (Array.isArray(arr)) {
|
|
20756
|
+
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
|
20753
20757
|
|
|
20754
|
-
|
|
20755
|
-
if (Array.isArray(arr)) return arr;
|
|
20758
|
+
return arr2;
|
|
20756
20759
|
}
|
|
20760
|
+
}
|
|
20761
|
+
|
|
20762
|
+
function _arrayWithHoles$1(arr) {
|
|
20763
|
+
if (Array.isArray(arr)) return arr;
|
|
20764
|
+
}
|
|
20757
20765
|
|
|
20758
|
-
|
|
20759
|
-
|
|
20766
|
+
function _iterableToArray$1(iter) {
|
|
20767
|
+
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
|
20768
|
+
}
|
|
20769
|
+
|
|
20770
|
+
function _iterableToArrayLimit$1(arr, i) {
|
|
20771
|
+
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
|
|
20772
|
+
return;
|
|
20760
20773
|
}
|
|
20761
20774
|
|
|
20762
|
-
|
|
20763
|
-
|
|
20764
|
-
|
|
20765
|
-
|
|
20775
|
+
var _arr = [];
|
|
20776
|
+
var _n = true;
|
|
20777
|
+
var _d = false;
|
|
20778
|
+
var _e = undefined;
|
|
20766
20779
|
|
|
20767
|
-
|
|
20768
|
-
var _n = true
|
|
20769
|
-
|
|
20770
|
-
var _e = undefined;
|
|
20780
|
+
try {
|
|
20781
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
20782
|
+
_arr.push(_s.value);
|
|
20771
20783
|
|
|
20784
|
+
if (i && _arr.length === i) break;
|
|
20785
|
+
}
|
|
20786
|
+
} catch (err) {
|
|
20787
|
+
_d = true;
|
|
20788
|
+
_e = err;
|
|
20789
|
+
} finally {
|
|
20772
20790
|
try {
|
|
20773
|
-
|
|
20774
|
-
_arr.push(_s.value);
|
|
20775
|
-
|
|
20776
|
-
if (i && _arr.length === i) break;
|
|
20777
|
-
}
|
|
20778
|
-
} catch (err) {
|
|
20779
|
-
_d = true;
|
|
20780
|
-
_e = err;
|
|
20791
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
20781
20792
|
} finally {
|
|
20782
|
-
|
|
20783
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
20784
|
-
} finally {
|
|
20785
|
-
if (_d) throw _e;
|
|
20786
|
-
}
|
|
20793
|
+
if (_d) throw _e;
|
|
20787
20794
|
}
|
|
20788
|
-
|
|
20789
|
-
return _arr;
|
|
20790
20795
|
}
|
|
20791
20796
|
|
|
20792
|
-
|
|
20793
|
-
|
|
20794
|
-
}
|
|
20797
|
+
return _arr;
|
|
20798
|
+
}
|
|
20795
20799
|
|
|
20796
|
-
|
|
20797
|
-
|
|
20798
|
-
|
|
20800
|
+
function _nonIterableSpread$1() {
|
|
20801
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
|
20802
|
+
}
|
|
20799
20803
|
|
|
20800
|
-
|
|
20801
|
-
|
|
20802
|
-
|
|
20803
|
-
var format = function format(formatter) {
|
|
20804
|
-
return function (value) {
|
|
20805
|
-
var usedFormat = formatter.formats[value.length];
|
|
20804
|
+
function _nonIterableRest$1() {
|
|
20805
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
20806
|
+
}
|
|
20806
20807
|
|
|
20807
|
-
|
|
20808
|
-
|
|
20809
|
-
|
|
20808
|
+
var getUniqueFormatDelimiters = function getUniqueFormatDelimiters(formats, formatChar) {
|
|
20809
|
+
return _toConsumableArray$1(new Set(formats.join("").split(formatChar).join("").split("")));
|
|
20810
|
+
};
|
|
20811
|
+
var format$1 = function format(formatter) {
|
|
20812
|
+
return function (value) {
|
|
20813
|
+
var usedFormat = formatter.formats[value.length];
|
|
20810
20814
|
|
|
20811
|
-
|
|
20812
|
-
|
|
20813
|
-
|
|
20814
|
-
return v + (valuePieces[i] || "");
|
|
20815
|
-
});
|
|
20816
|
-
return zipped.join("");
|
|
20817
|
-
};
|
|
20818
|
-
};
|
|
20815
|
+
if (!usedFormat) {
|
|
20816
|
+
return value;
|
|
20817
|
+
}
|
|
20819
20818
|
|
|
20820
|
-
|
|
20821
|
-
var
|
|
20822
|
-
var
|
|
20823
|
-
|
|
20824
|
-
formatter.uniqueDelimiters.forEach(function (delim) {
|
|
20825
|
-
return count += format.split(delim).length - 1;
|
|
20819
|
+
var formatPieces = usedFormat.split(formatter.formatChar);
|
|
20820
|
+
var valuePieces = value.split("");
|
|
20821
|
+
var zipped = formatPieces.map(function (v, i) {
|
|
20822
|
+
return v + (valuePieces[i] || "");
|
|
20826
20823
|
});
|
|
20827
|
-
return
|
|
20824
|
+
return zipped.join("");
|
|
20828
20825
|
};
|
|
20826
|
+
};
|
|
20829
20827
|
|
|
20830
|
-
|
|
20831
|
-
|
|
20832
|
-
|
|
20833
|
-
|
|
20834
|
-
|
|
20835
|
-
|
|
20836
|
-
|
|
20837
|
-
|
|
20838
|
-
|
|
20839
|
-
}).join("");
|
|
20840
|
-
};
|
|
20841
|
-
};
|
|
20842
|
-
var inject = function inject(baseString) {
|
|
20843
|
-
return function (start, end, newString) {
|
|
20844
|
-
return baseString.substring(0, start) + newString + baseString.substring(end);
|
|
20845
|
-
};
|
|
20846
|
-
};
|
|
20847
|
-
var formattedToUnformattedIndex = function formattedToUnformattedIndex(formattedIndex, rawValue, formatter) {
|
|
20848
|
-
var maxFormatExceeded = rawValue.length >= formatter.formats.length;
|
|
20828
|
+
var countDelims = function countDelims(formatter, index) {
|
|
20829
|
+
var count = 0;
|
|
20830
|
+
var format = formatter.formats[index];
|
|
20831
|
+
if (!format) return 0;
|
|
20832
|
+
formatter.uniqueDelimiters.forEach(function (delim) {
|
|
20833
|
+
return count += format.split(delim).length - 1;
|
|
20834
|
+
});
|
|
20835
|
+
return count;
|
|
20836
|
+
};
|
|
20849
20837
|
|
|
20850
|
-
|
|
20851
|
-
|
|
20852
|
-
|
|
20853
|
-
|
|
20854
|
-
var beforeString = formatString.slice(0, formattedIndex);
|
|
20855
|
-
return beforeString.split("").filter(function (c) {
|
|
20856
|
-
return c === formatter.formatChar;
|
|
20857
|
-
}).length;
|
|
20838
|
+
var unformat = function unformat(formatter) {
|
|
20839
|
+
return function (formattedValue, formatIndex) {
|
|
20840
|
+
if (formatIndex >= formatter.formats.length) {
|
|
20841
|
+
return formattedValue;
|
|
20858
20842
|
}
|
|
20859
|
-
};
|
|
20860
|
-
var unformattedToFormattedIndex = function unformattedToFormattedIndex(rawIndex, rawValue, formatter, del) {
|
|
20861
|
-
var maxFormatExceeded = rawValue.length >= formatter.formats.length; // If forced to stay formatted, offset by delims - 1
|
|
20862
|
-
// This is done so the component doesn't assume that any added chars will be kept
|
|
20863
|
-
// (i.e. if an external constraint is applied)
|
|
20864
|
-
|
|
20865
|
-
if (maxFormatExceeded) {
|
|
20866
|
-
var delims = countDelims(formatter, rawValue.length - 1);
|
|
20867
|
-
return delims > 0 && !del ? rawIndex + delims - 1 : rawIndex;
|
|
20868
|
-
} else {
|
|
20869
|
-
return formatter.formats[rawValue.length].split(formatter.formatChar).slice(0, rawIndex).reduce(function (acc, curr) {
|
|
20870
|
-
return curr.length + acc;
|
|
20871
|
-
}, 0) + rawIndex;
|
|
20872
|
-
}
|
|
20873
|
-
};
|
|
20874
20843
|
|
|
20875
|
-
|
|
20876
|
-
return {
|
|
20877
|
-
|
|
20878
|
-
|
|
20879
|
-
formatChar: formatChar
|
|
20880
|
-
};
|
|
20844
|
+
var format = formatter.formats[formatIndex];
|
|
20845
|
+
return formattedValue.split("").filter(function (_, i) {
|
|
20846
|
+
return !(format[i] != formatter.formatChar);
|
|
20847
|
+
}).join("");
|
|
20881
20848
|
};
|
|
20849
|
+
};
|
|
20850
|
+
var inject = function inject(baseString) {
|
|
20851
|
+
return function (start, end, newString) {
|
|
20852
|
+
return baseString.substring(0, start) + newString + baseString.substring(end);
|
|
20853
|
+
};
|
|
20854
|
+
};
|
|
20855
|
+
var formattedToUnformattedIndex = function formattedToUnformattedIndex(formattedIndex, rawValue, formatter) {
|
|
20856
|
+
var maxFormatExceeded = rawValue.length >= formatter.formats.length;
|
|
20882
20857
|
|
|
20883
|
-
|
|
20884
|
-
|
|
20885
|
-
|
|
20886
|
-
|
|
20887
|
-
|
|
20888
|
-
|
|
20889
|
-
|
|
20890
|
-
|
|
20891
|
-
|
|
20892
|
-
|
|
20893
|
-
|
|
20894
|
-
|
|
20895
|
-
|
|
20896
|
-
|
|
20897
|
-
}),
|
|
20898
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
20899
|
-
state = _useState2[0],
|
|
20900
|
-
setState = _useState2[1];
|
|
20901
|
-
|
|
20902
|
-
React.useLayoutEffect(function () {
|
|
20903
|
-
// A lot of the work here is cursor manipulation
|
|
20904
|
-
if (inputEl.current && inputEl.current === document.activeElement) {
|
|
20905
|
-
inputEl.current.setSelectionRange(state.selectionStart, state.selectionEnd);
|
|
20906
|
-
}
|
|
20907
|
-
});
|
|
20908
|
-
return React__default.createElement("input", _extends({}, props, {
|
|
20909
|
-
ref: inputEl,
|
|
20910
|
-
value: format(formatter)(value),
|
|
20911
|
-
onKeyDown: function onKeyDown(event) {
|
|
20912
|
-
// Keep track of the state of the input before onChange, including if user is hitting delete
|
|
20913
|
-
setState({
|
|
20914
|
-
rawValue: value,
|
|
20915
|
-
selectionStart: event.target.selectionStart,
|
|
20916
|
-
selectionEnd: event.target.selectionEnd,
|
|
20917
|
-
"delete": event.key === "Backspace" || event.key === "Delete",
|
|
20918
|
-
formattedValue: event.target.value
|
|
20919
|
-
});
|
|
20920
|
-
},
|
|
20921
|
-
onChange: function onChange(event) {
|
|
20922
|
-
/* At the beginning of onChange, event.target.value is a concat of the previous formatted value
|
|
20923
|
-
* and an unformatted injection at the start, end, or in the middle (maybe a deletion). To prepare
|
|
20924
|
-
* the unformatted value for the user's onChange, the formatted string and unformatted injection need
|
|
20925
|
-
* to be separated, then unformat the formatted string, then insert (or delete) the injection from the
|
|
20926
|
-
* old unformatted value.
|
|
20927
|
-
*/
|
|
20928
|
-
var injectionLength = event.target.value.length - state.formattedValue.length;
|
|
20929
|
-
var end = state.selectionStart === state.selectionEnd ? state.selectionStart + injectionLength : state.selectionEnd - 1;
|
|
20930
|
-
var injection = event.target.value.substring(state.selectionStart, end); // Injection is the new unformatted piece of the input
|
|
20931
|
-
// Need to find where to put it
|
|
20932
|
-
|
|
20933
|
-
var rawInjectionPointStart = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter);
|
|
20934
|
-
var rawInjectionPointEnd = formattedToUnformattedIndex(state.selectionEnd, state.rawValue, formatter); // Unformat the previous formatted value for injection
|
|
20935
|
-
// Using the relevant format string, strips away chars not marked with the formatChar
|
|
20936
|
-
|
|
20937
|
-
var unformattedOldValue = unformat(formatter)(state.formattedValue, state.rawValue.length); // Edit the previous unformatted value (either add, update or delete)
|
|
20858
|
+
if (maxFormatExceeded) {
|
|
20859
|
+
return formattedIndex;
|
|
20860
|
+
} else {
|
|
20861
|
+
var formatString = formatter.formats[rawValue.length];
|
|
20862
|
+
var beforeString = formatString.slice(0, formattedIndex);
|
|
20863
|
+
return beforeString.split("").filter(function (c) {
|
|
20864
|
+
return c === formatter.formatChar;
|
|
20865
|
+
}).length;
|
|
20866
|
+
}
|
|
20867
|
+
};
|
|
20868
|
+
var unformattedToFormattedIndex = function unformattedToFormattedIndex(rawIndex, rawValue, formatter, del) {
|
|
20869
|
+
var maxFormatExceeded = rawValue.length >= formatter.formats.length; // If forced to stay formatted, offset by delims - 1
|
|
20870
|
+
// This is done so the component doesn't assume that any added chars will be kept
|
|
20871
|
+
// (i.e. if an external constraint is applied)
|
|
20938
20872
|
|
|
20939
|
-
|
|
20940
|
-
|
|
20941
|
-
|
|
20942
|
-
|
|
20943
|
-
|
|
20873
|
+
if (maxFormatExceeded) {
|
|
20874
|
+
var delims = countDelims(formatter, rawValue.length - 1);
|
|
20875
|
+
return delims > 0 && !del ? rawIndex + delims - 1 : rawIndex;
|
|
20876
|
+
} else {
|
|
20877
|
+
return formatter.formats[rawValue.length].split(formatter.formatChar).slice(0, rawIndex).reduce(function (acc, curr) {
|
|
20878
|
+
return curr.length + acc;
|
|
20879
|
+
}, 0) + rawIndex;
|
|
20880
|
+
}
|
|
20881
|
+
};
|
|
20944
20882
|
|
|
20945
|
-
|
|
20946
|
-
|
|
20947
|
-
|
|
20948
|
-
|
|
20949
|
-
|
|
20950
|
-
"delete": false,
|
|
20951
|
-
formattedValue: state.formattedValue
|
|
20952
|
-
}); // Apply the external onChange function to the raw underlying string
|
|
20953
|
-
// This is where the user generally updates the input value
|
|
20954
|
-
|
|
20955
|
-
if (_onChange) {
|
|
20956
|
-
_onChange(unformattedNewValue);
|
|
20957
|
-
}
|
|
20958
|
-
}
|
|
20959
|
-
}));
|
|
20883
|
+
var createFormat = function createFormat(formats, formatChar) {
|
|
20884
|
+
return {
|
|
20885
|
+
uniqueDelimiters: getUniqueFormatDelimiters(formats, formatChar),
|
|
20886
|
+
formats: formats,
|
|
20887
|
+
formatChar: formatChar
|
|
20960
20888
|
};
|
|
20889
|
+
};
|
|
20961
20890
|
|
|
20962
|
-
|
|
20963
|
-
|
|
20964
|
-
|
|
20891
|
+
var FormattedInput = function FormattedInput(_ref) {
|
|
20892
|
+
var value = _ref.value,
|
|
20893
|
+
formatter = _ref.formatter,
|
|
20894
|
+
_onChange = _ref.onChange,
|
|
20895
|
+
props = _objectWithoutProperties$1(_ref, ["value", "formatter", "onChange"]);
|
|
20965
20896
|
|
|
20966
|
-
|
|
20897
|
+
var inputEl = React.useRef(null);
|
|
20967
20898
|
|
|
20968
|
-
|
|
20969
|
-
|
|
20899
|
+
var _useState = React.useState({
|
|
20900
|
+
selectionStart: 0,
|
|
20901
|
+
selectionEnd: 0,
|
|
20902
|
+
rawValue: value,
|
|
20903
|
+
"delete": false,
|
|
20904
|
+
formattedValue: format$1(formatter)(value)
|
|
20905
|
+
}),
|
|
20906
|
+
_useState2 = _slicedToArray$1(_useState, 2),
|
|
20907
|
+
state = _useState2[0],
|
|
20908
|
+
setState = _useState2[1];
|
|
20970
20909
|
|
|
20971
|
-
|
|
20972
|
-
|
|
20973
|
-
|
|
20974
|
-
|
|
20910
|
+
React.useLayoutEffect(function () {
|
|
20911
|
+
// A lot of the work here is cursor manipulation
|
|
20912
|
+
if (inputEl.current && inputEl.current === document.activeElement) {
|
|
20913
|
+
inputEl.current.setSelectionRange(state.selectionStart, state.selectionEnd);
|
|
20914
|
+
}
|
|
20915
|
+
});
|
|
20916
|
+
return React__default.createElement("input", _extends$2({}, props, {
|
|
20917
|
+
ref: inputEl,
|
|
20918
|
+
value: format$1(formatter)(value),
|
|
20919
|
+
onKeyDown: function onKeyDown(event) {
|
|
20920
|
+
// Keep track of the state of the input before onChange, including if user is hitting delete
|
|
20921
|
+
setState({
|
|
20922
|
+
rawValue: value,
|
|
20923
|
+
selectionStart: event.target.selectionStart,
|
|
20924
|
+
selectionEnd: event.target.selectionEnd,
|
|
20925
|
+
"delete": event.key === "Backspace" || event.key === "Delete",
|
|
20926
|
+
formattedValue: event.target.value
|
|
20927
|
+
});
|
|
20928
|
+
},
|
|
20929
|
+
onChange: function onChange(event) {
|
|
20930
|
+
/* At the beginning of onChange, event.target.value is a concat of the previous formatted value
|
|
20931
|
+
* and an unformatted injection at the start, end, or in the middle (maybe a deletion). To prepare
|
|
20932
|
+
* the unformatted value for the user's onChange, the formatted string and unformatted injection need
|
|
20933
|
+
* to be separated, then unformat the formatted string, then insert (or delete) the injection from the
|
|
20934
|
+
* old unformatted value.
|
|
20935
|
+
*/
|
|
20936
|
+
var injectionLength = event.target.value.length - state.formattedValue.length;
|
|
20937
|
+
var end = state.selectionStart === state.selectionEnd ? state.selectionStart + injectionLength : state.selectionEnd - 1;
|
|
20938
|
+
var injection = event.target.value.substring(state.selectionStart, end); // Injection is the new unformatted piece of the input
|
|
20939
|
+
// Need to find where to put it
|
|
20940
|
+
|
|
20941
|
+
var rawInjectionPointStart = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter);
|
|
20942
|
+
var rawInjectionPointEnd = formattedToUnformattedIndex(state.selectionEnd, state.rawValue, formatter); // Unformat the previous formatted value for injection
|
|
20943
|
+
// Using the relevant format string, strips away chars not marked with the formatChar
|
|
20944
|
+
|
|
20945
|
+
var unformattedOldValue = unformat(formatter)(state.formattedValue, state.rawValue.length); // Edit the previous unformatted value (either add, update or delete)
|
|
20946
|
+
|
|
20947
|
+
var injectIntoOldValue = inject(unformattedOldValue);
|
|
20948
|
+
var unformattedNewValue = state["delete"] ? rawInjectionPointStart === rawInjectionPointEnd ? injectIntoOldValue(rawInjectionPointStart - 1, rawInjectionPointStart, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, injection);
|
|
20949
|
+
var lengthDifference = unformattedNewValue.length - state.rawValue.length;
|
|
20950
|
+
var rawIndex = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter) + lengthDifference; // Find the new cursor position for the potential formatted value
|
|
20951
|
+
// Applied by useLayoutEffect
|
|
20952
|
+
|
|
20953
|
+
var newFormattedCursorPosition = state.selectionStart == state.selectionEnd ? unformattedToFormattedIndex(rawIndex, unformattedNewValue, formatter, state["delete"]) : state["delete"] ? state.selectionStart : state.selectionEnd;
|
|
20954
|
+
setState({
|
|
20955
|
+
selectionStart: newFormattedCursorPosition,
|
|
20956
|
+
selectionEnd: newFormattedCursorPosition,
|
|
20957
|
+
rawValue: state.rawValue,
|
|
20958
|
+
"delete": false,
|
|
20959
|
+
formattedValue: state.formattedValue
|
|
20960
|
+
}); // Apply the external onChange function to the raw underlying string
|
|
20961
|
+
// This is where the user generally updates the input value
|
|
20962
|
+
|
|
20963
|
+
if (_onChange) {
|
|
20964
|
+
_onChange(unformattedNewValue);
|
|
20965
|
+
}
|
|
20966
|
+
}
|
|
20967
|
+
}));
|
|
20968
|
+
};
|
|
20975
20969
|
|
|
20976
20970
|
var linkColor$2 = {
|
|
20977
20971
|
"default": "".concat(MATISSE_BLUE),
|
|
@@ -21073,7 +21067,7 @@ var FormattedInputField = styled__default(function (_ref8) {
|
|
|
21073
21067
|
themeValues = _ref8.themeValues,
|
|
21074
21068
|
props = _objectWithoutProperties(_ref8, _excluded$p);
|
|
21075
21069
|
|
|
21076
|
-
return /*#__PURE__*/React__default.createElement(
|
|
21070
|
+
return /*#__PURE__*/React__default.createElement(FormattedInput, props);
|
|
21077
21071
|
}).withConfig({
|
|
21078
21072
|
displayName: "FormInput__FormattedInputField",
|
|
21079
21073
|
componentId: "sc-l094r1-1"
|
|
@@ -33470,6 +33464,33 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
|
33470
33464
|
return dateValue.isAfter(now, unit);
|
|
33471
33465
|
};
|
|
33472
33466
|
|
|
33467
|
+
const IS_VALID_MONTH = "validator/IS_VALID_MONTH";
|
|
33468
|
+
const IS_VALID_MONTH_ERROR = "error/IS_VALID_MONTH";
|
|
33469
|
+
const isValidMonth = createValidator(
|
|
33470
|
+
IS_VALID_MONTH,
|
|
33471
|
+
IS_VALID_MONTH_ERROR
|
|
33472
|
+
);
|
|
33473
|
+
validatorFns[IS_VALID_MONTH] = (value, args, form) => {
|
|
33474
|
+
if (value === "") {
|
|
33475
|
+
return true;
|
|
33476
|
+
}
|
|
33477
|
+
// Function takes one argument representing the character position
|
|
33478
|
+
// In a date string to identify where the month is
|
|
33479
|
+
// Eg "10/21/2021" - start position is 0
|
|
33480
|
+
// Or "18/03/1990" - start position is 3
|
|
33481
|
+
// Only works with two digit months (01, 02, 03, etc)
|
|
33482
|
+
const monthStartPosition = parseInt(args[0]);
|
|
33483
|
+
const monthEndPosition = monthStartPosition + 2;
|
|
33484
|
+
if (monthStartPosition === NaN) {
|
|
33485
|
+
throw new Error("Month start position has to be a valid integer string");
|
|
33486
|
+
}
|
|
33487
|
+
const month = parseInt(value.slice(monthStartPosition, monthEndPosition));
|
|
33488
|
+
if (month === NaN) {
|
|
33489
|
+
return false;
|
|
33490
|
+
}
|
|
33491
|
+
return month >= 1 && month <= 12;
|
|
33492
|
+
};
|
|
33493
|
+
|
|
33473
33494
|
const MATCHES_REGEX = "validator/MATCHES_REGEX";
|
|
33474
33495
|
const MATCHES_REGEX_ERROR = "error/MATCHES_REGEX";
|
|
33475
33496
|
const matchesRegex = createValidator(MATCHES_REGEX, MATCHES_REGEX_ERROR);
|
|
@@ -34865,11 +34886,11 @@ var zipFormats = ["", "_", "__", "___", "____", "_____", "______", "_____-__", "
|
|
|
34865
34886
|
var creditCardFormats = ["", "_", "__", "___", "____", "____ _", "____ __", "____ ___", "____ ____", "____ ____ _", "____ ____ __", "____ ____ ___", "____ ____ ____", "____ ____ ____ _", "____ ____ ____ __", "____ ____ ____ ___", "____ ____ ____ ____"];
|
|
34866
34887
|
var moneyFormats = ["", "$0.0_", "$0.__", "$_.__", "$__.__", "$___.__", "$_,___.__", "$__,___.__", "$___,___.__", "$_,___,___.__", "$__,___,___.__", "$___,___,___.__", "$_,___,___,___.__", "$__,___,___,___.__", "$___,___,___,___.__", "$_,___,___,___,___.__"];
|
|
34867
34888
|
var expirationDateFormats = ["", "_", "__/", "__/_", "__/__"];
|
|
34868
|
-
var zipFormat =
|
|
34869
|
-
var creditCardFormat =
|
|
34870
|
-
var expirationDateFormat =
|
|
34871
|
-
var phoneFormat =
|
|
34872
|
-
var moneyFormat =
|
|
34889
|
+
var zipFormat = createFormat(zipFormats, formatDelimiter);
|
|
34890
|
+
var creditCardFormat = createFormat(creditCardFormats, formatDelimiter);
|
|
34891
|
+
var expirationDateFormat = createFormat(expirationDateFormats, formatDelimiter);
|
|
34892
|
+
var phoneFormat = createFormat(phoneFormats, formatDelimiter);
|
|
34893
|
+
var moneyFormat = createFormat(moneyFormats, formatDelimiter);
|
|
34873
34894
|
|
|
34874
34895
|
var formats = /*#__PURE__*/Object.freeze({
|
|
34875
34896
|
__proto__: null,
|
|
@@ -38693,7 +38714,7 @@ Styling accomplished with our atoms / layout primitives
|
|
|
38693
38714
|
|
|
38694
38715
|
Cancel button will (for now) always use hideModal as its action
|
|
38695
38716
|
Continue button takes an action, if you want to navigate to
|
|
38696
|
-
a different route (as with a link) connect() and use "push" from connected-react-router
|
|
38717
|
+
a different route (as with a link) connect() and use "push" from @thecb/connected-react-router
|
|
38697
38718
|
*/
|
|
38698
38719
|
|
|
38699
38720
|
var getApplicationNode = function getApplicationNode() {
|
|
@@ -40229,7 +40250,7 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
40229
40250
|
var nameOnCardErrors = _defineProperty({}, required.error, "Name is required");
|
|
40230
40251
|
|
|
40231
40252
|
var creditCardNumberErrors = (_creditCardNumberErro = {}, _defineProperty(_creditCardNumberErro, required.error, "Credit card number is required"), _defineProperty(_creditCardNumberErro, hasLength.error, "Credit card number is invalid"), _defineProperty(_creditCardNumberErro, matchesRegex.error, "".concat(displayCardBrand(fields.creditCardNumber.rawValue), " is not accepted")), _creditCardNumberErro);
|
|
40232
|
-
var expirationDateErrors = (_expirationDateErrors = {}, _defineProperty(_expirationDateErrors, required.error, "Expiration date is required"), _defineProperty(_expirationDateErrors, hasLength.error, "Expiration date is invalid"), _defineProperty(_expirationDateErrors, dateAfterToday.error, "Expiration date is invalid"), _expirationDateErrors);
|
|
40253
|
+
var expirationDateErrors = (_expirationDateErrors = {}, _defineProperty(_expirationDateErrors, required.error, "Expiration date is required"), _defineProperty(_expirationDateErrors, hasLength.error, "Expiration date is invalid"), _defineProperty(_expirationDateErrors, isValidMonth.error, "Expiration month is invalid"), _defineProperty(_expirationDateErrors, dateAfterToday.error, "Expiration date is invalid"), _expirationDateErrors);
|
|
40233
40254
|
var cvvErrors = (_cvvErrors = {}, _defineProperty(_cvvErrors, required.error, "CVV is required"), _defineProperty(_cvvErrors, hasLength.error, "CVV is invalid"), _cvvErrors);
|
|
40234
40255
|
var zipCodeErrors = (_zipCodeErrors = {}, _defineProperty(_zipCodeErrors, required.error, "Zip code is required"), _defineProperty(_zipCodeErrors, hasLength.error, "Zip code is invalid"), _zipCodeErrors);
|
|
40235
40256
|
|
|
@@ -40335,7 +40356,7 @@ var formConfig$8 = {
|
|
|
40335
40356
|
constraints: [onlyIntegers(), hasLength(0, 16)]
|
|
40336
40357
|
},
|
|
40337
40358
|
expirationDate: {
|
|
40338
|
-
validators: [required(), hasLength(4, 4), dateAfterToday("
|
|
40359
|
+
validators: [required(), hasLength(4, 4), isValidMonth(0), dateAfterToday("MMYY", "month", true)],
|
|
40339
40360
|
constraints: [onlyIntegers(), hasLength(0, 4)]
|
|
40340
40361
|
},
|
|
40341
40362
|
cvv: {
|
|
@@ -40391,7 +40412,7 @@ var PhoneForm = function PhoneForm(_ref) {
|
|
|
40391
40412
|
field: fields.phone,
|
|
40392
40413
|
fieldActions: actions.fields.phone,
|
|
40393
40414
|
showErrors: showErrors,
|
|
40394
|
-
formatter:
|
|
40415
|
+
formatter: createFormat(phoneFormats, formatDelimiter),
|
|
40395
40416
|
onKeyUp: function onKeyUp(e) {
|
|
40396
40417
|
return e.key === "Enter" && handleSubmit(e);
|
|
40397
40418
|
},
|
|
@@ -41628,6 +41649,7 @@ exports.ButtonWithAction = ButtonWithAction;
|
|
|
41628
41649
|
exports.ButtonWithLink = ButtonWithLink;
|
|
41629
41650
|
exports.CalendarIcon = CalendarIcon;
|
|
41630
41651
|
exports.CarrotIcon = CarrotIcon$1;
|
|
41652
|
+
exports.CashIcon = CashIcon;
|
|
41631
41653
|
exports.Center = Center;
|
|
41632
41654
|
exports.CenterSingle = CenterSingle$1;
|
|
41633
41655
|
exports.CenterStack = CenterStack$1;
|