@moda/om 18.4.0 → 18.5.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 +1844 -1728
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1845 -1730
- package/dist/index.esm.js.map +1 -1
- package/dist/src/components/NavigationPreventer/NavigationPreventer.d.ts +7 -0
- package/dist/src/components/NavigationPreventer/index.d.ts +1 -0
- package/dist/src/components/NavigationPreventer/usePreventNavigation.d.ts +1 -0
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/utilities/preventNavigation.d.ts +1 -0
- package/dist/styles.css +1 -1
- package/dist/test/setupTests.d.ts +0 -1
- package/package.json +12 -12
- package/src/components/ModalOverlay/ModalOverlay.test.tsx +2 -2
- package/src/components/NavigationPreventer/NavigationPreventer.tsx +17 -0
- package/src/components/NavigationPreventer/index.ts +1 -0
- package/src/components/NavigationPreventer/usePreventNavigation.ts +12 -0
- package/src/components/index.ts +1 -0
- package/src/hooks/useBreakpoint.ts +2 -2
- package/src/utilities/preventNavigation.ts +4 -0
package/dist/index.cjs.js
CHANGED
|
@@ -1019,62 +1019,62 @@ var colorStringExports = colorString.exports;
|
|
|
1019
1019
|
__exportStar(helpers, exports);
|
|
1020
1020
|
})(dist$4);
|
|
1021
1021
|
|
|
1022
|
-
function _iterableToArrayLimit(
|
|
1023
|
-
var
|
|
1024
|
-
if (null !=
|
|
1025
|
-
var
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1022
|
+
function _iterableToArrayLimit(r, l) {
|
|
1023
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
1024
|
+
if (null != t) {
|
|
1025
|
+
var e,
|
|
1026
|
+
n,
|
|
1027
|
+
i,
|
|
1028
|
+
u,
|
|
1029
|
+
a = [],
|
|
1030
|
+
f = !0,
|
|
1031
|
+
o = !1;
|
|
1032
1032
|
try {
|
|
1033
|
-
if (
|
|
1034
|
-
if (Object(
|
|
1035
|
-
|
|
1036
|
-
} else for (; !(
|
|
1037
|
-
} catch (
|
|
1038
|
-
|
|
1033
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
1034
|
+
if (Object(t) !== t) return;
|
|
1035
|
+
f = !1;
|
|
1036
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
1037
|
+
} catch (r) {
|
|
1038
|
+
o = !0, n = r;
|
|
1039
1039
|
} finally {
|
|
1040
1040
|
try {
|
|
1041
|
-
if (!
|
|
1041
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
1042
1042
|
} finally {
|
|
1043
|
-
if (
|
|
1043
|
+
if (o) throw n;
|
|
1044
1044
|
}
|
|
1045
1045
|
}
|
|
1046
|
-
return
|
|
1046
|
+
return a;
|
|
1047
1047
|
}
|
|
1048
1048
|
}
|
|
1049
|
-
function ownKeys(
|
|
1050
|
-
var
|
|
1049
|
+
function ownKeys(e, r) {
|
|
1050
|
+
var t = Object.keys(e);
|
|
1051
1051
|
if (Object.getOwnPropertySymbols) {
|
|
1052
|
-
var
|
|
1053
|
-
|
|
1054
|
-
return Object.getOwnPropertyDescriptor(
|
|
1055
|
-
})),
|
|
1052
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
1053
|
+
r && (o = o.filter(function (r) {
|
|
1054
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
1055
|
+
})), t.push.apply(t, o);
|
|
1056
1056
|
}
|
|
1057
|
-
return
|
|
1057
|
+
return t;
|
|
1058
1058
|
}
|
|
1059
|
-
function _objectSpread2(
|
|
1060
|
-
for (var
|
|
1061
|
-
var
|
|
1062
|
-
|
|
1063
|
-
_defineProperty$1(
|
|
1064
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
|
1065
|
-
Object.defineProperty(
|
|
1059
|
+
function _objectSpread2(e) {
|
|
1060
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
1061
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
1062
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
1063
|
+
_defineProperty$1(e, r, t[r]);
|
|
1064
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
1065
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
1066
1066
|
});
|
|
1067
1067
|
}
|
|
1068
|
-
return
|
|
1068
|
+
return e;
|
|
1069
1069
|
}
|
|
1070
|
-
function _typeof$1(
|
|
1070
|
+
function _typeof$1(o) {
|
|
1071
1071
|
"@babel/helpers - typeof";
|
|
1072
1072
|
|
|
1073
|
-
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (
|
|
1074
|
-
return typeof
|
|
1075
|
-
} : function (
|
|
1076
|
-
return
|
|
1077
|
-
}, _typeof$1(
|
|
1073
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
1074
|
+
return typeof o;
|
|
1075
|
+
} : function (o) {
|
|
1076
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
1077
|
+
}, _typeof$1(o);
|
|
1078
1078
|
}
|
|
1079
1079
|
function _defineProperty$1(obj, key, value) {
|
|
1080
1080
|
key = _toPropertyKey$1(key);
|
|
@@ -1348,7 +1348,9 @@ var stringifyProps = function stringifyProps(props) {
|
|
|
1348
1348
|
|
|
1349
1349
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1350
1350
|
|
|
1351
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
1351
|
+
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
1352
|
+
|
|
1353
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1352
1354
|
var isEmpty = function isEmpty(obj) {
|
|
1353
1355
|
return Object.entries(obj || {}).length === 0;
|
|
1354
1356
|
};
|
|
@@ -1671,7 +1673,7 @@ var RemoveScroll = /*#__PURE__*/React__namespace.forwardRef(function (props, par
|
|
|
1671
1673
|
var SideCar = sideCar;
|
|
1672
1674
|
var containerRef = useMergeRefs([ref, parentRef]);
|
|
1673
1675
|
var containerProps = _assign(_assign({}, rest), callbacks);
|
|
1674
|
-
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, enabled && /*#__PURE__*/React__namespace.createElement(SideCar, {
|
|
1676
|
+
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, enabled && ( /*#__PURE__*/React__namespace.createElement(SideCar, {
|
|
1675
1677
|
sideCar: effectCar$1,
|
|
1676
1678
|
removeScrollBar: removeScrollBar,
|
|
1677
1679
|
shards: shards,
|
|
@@ -1681,12 +1683,12 @@ var RemoveScroll = /*#__PURE__*/React__namespace.forwardRef(function (props, par
|
|
|
1681
1683
|
allowPinchZoom: !!allowPinchZoom,
|
|
1682
1684
|
lockRef: ref,
|
|
1683
1685
|
gapMode: gapMode
|
|
1684
|
-
}), forwardProps ? /*#__PURE__*/React__namespace.cloneElement(React__namespace.Children.only(children), _assign(_assign({}, containerProps), {
|
|
1686
|
+
})), forwardProps ? ( /*#__PURE__*/React__namespace.cloneElement(React__namespace.Children.only(children), _assign(_assign({}, containerProps), {
|
|
1685
1687
|
ref: containerRef
|
|
1686
|
-
})) : /*#__PURE__*/React__namespace.createElement(Container, _assign({}, containerProps, {
|
|
1688
|
+
}))) : ( /*#__PURE__*/React__namespace.createElement(Container, _assign({}, containerProps, {
|
|
1687
1689
|
className: className,
|
|
1688
1690
|
ref: containerRef
|
|
1689
|
-
}), children));
|
|
1691
|
+
}), children)));
|
|
1690
1692
|
});
|
|
1691
1693
|
RemoveScroll.defaultProps = {
|
|
1692
1694
|
enabled: true,
|
|
@@ -1715,123 +1717,84 @@ function _extends() {
|
|
|
1715
1717
|
|
|
1716
1718
|
var propTypes = {exports: {}};
|
|
1717
1719
|
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1720
|
+
/**
|
|
1721
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1722
|
+
*
|
|
1723
|
+
* This source code is licensed under the MIT license found in the
|
|
1724
|
+
* LICENSE file in the root directory of this source tree.
|
|
1725
|
+
*/
|
|
1726
|
+
var ReactPropTypesSecret_1;
|
|
1727
|
+
var hasRequiredReactPropTypesSecret;
|
|
1728
|
+
function requireReactPropTypesSecret() {
|
|
1729
|
+
if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
|
|
1730
|
+
hasRequiredReactPropTypesSecret = 1;
|
|
1731
|
+
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
1732
|
+
ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
1733
|
+
return ReactPropTypesSecret_1;
|
|
1734
|
+
}
|
|
1721
1735
|
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
w = b ? Symbol["for"]("react.fundamental") : 60117,
|
|
1743
|
-
x = b ? Symbol["for"]("react.responder") : 60118,
|
|
1744
|
-
y = b ? Symbol["for"]("react.scope") : 60119;
|
|
1745
|
-
function z(a) {
|
|
1746
|
-
if ("object" === _typeof$1(a) && null !== a) {
|
|
1747
|
-
var u = a.$$typeof;
|
|
1748
|
-
switch (u) {
|
|
1749
|
-
case c:
|
|
1750
|
-
switch (a = a.type, a) {
|
|
1751
|
-
case l:
|
|
1752
|
-
case m:
|
|
1753
|
-
case e:
|
|
1754
|
-
case g:
|
|
1755
|
-
case f:
|
|
1756
|
-
case p:
|
|
1757
|
-
return a;
|
|
1758
|
-
default:
|
|
1759
|
-
switch (a = a && a.$$typeof, a) {
|
|
1760
|
-
case k:
|
|
1761
|
-
case n:
|
|
1762
|
-
case t:
|
|
1763
|
-
case r:
|
|
1764
|
-
case h:
|
|
1765
|
-
return a;
|
|
1766
|
-
default:
|
|
1767
|
-
return u;
|
|
1768
|
-
}
|
|
1769
|
-
}
|
|
1770
|
-
case d:
|
|
1771
|
-
return u;
|
|
1736
|
+
/**
|
|
1737
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1738
|
+
*
|
|
1739
|
+
* This source code is licensed under the MIT license found in the
|
|
1740
|
+
* LICENSE file in the root directory of this source tree.
|
|
1741
|
+
*/
|
|
1742
|
+
var factoryWithThrowingShims;
|
|
1743
|
+
var hasRequiredFactoryWithThrowingShims;
|
|
1744
|
+
function requireFactoryWithThrowingShims() {
|
|
1745
|
+
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
|
|
1746
|
+
hasRequiredFactoryWithThrowingShims = 1;
|
|
1747
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
1748
|
+
function emptyFunction() {}
|
|
1749
|
+
function emptyFunctionWithReset() {}
|
|
1750
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
1751
|
+
factoryWithThrowingShims = function factoryWithThrowingShims() {
|
|
1752
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
1753
|
+
if (secret === ReactPropTypesSecret) {
|
|
1754
|
+
// It is still safe when called from React.
|
|
1755
|
+
return;
|
|
1772
1756
|
}
|
|
1757
|
+
var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
|
|
1758
|
+
err.name = 'Invariant Violation';
|
|
1759
|
+
throw err;
|
|
1773
1760
|
}
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
return z(a) === n;
|
|
1806
|
-
};
|
|
1807
|
-
reactIs_production_min.isFragment = function (a) {
|
|
1808
|
-
return z(a) === e;
|
|
1809
|
-
};
|
|
1810
|
-
reactIs_production_min.isLazy = function (a) {
|
|
1811
|
-
return z(a) === t;
|
|
1812
|
-
};
|
|
1813
|
-
reactIs_production_min.isMemo = function (a) {
|
|
1814
|
-
return z(a) === r;
|
|
1815
|
-
};
|
|
1816
|
-
reactIs_production_min.isPortal = function (a) {
|
|
1817
|
-
return z(a) === d;
|
|
1818
|
-
};
|
|
1819
|
-
reactIs_production_min.isProfiler = function (a) {
|
|
1820
|
-
return z(a) === g;
|
|
1821
|
-
};
|
|
1822
|
-
reactIs_production_min.isStrictMode = function (a) {
|
|
1823
|
-
return z(a) === f;
|
|
1824
|
-
};
|
|
1825
|
-
reactIs_production_min.isSuspense = function (a) {
|
|
1826
|
-
return z(a) === p;
|
|
1827
|
-
};
|
|
1828
|
-
reactIs_production_min.isValidElementType = function (a) {
|
|
1829
|
-
return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === _typeof$1(a) && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
|
|
1761
|
+
shim.isRequired = shim;
|
|
1762
|
+
function getShim() {
|
|
1763
|
+
return shim;
|
|
1764
|
+
}
|
|
1765
|
+
// Important!
|
|
1766
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
1767
|
+
var ReactPropTypes = {
|
|
1768
|
+
array: shim,
|
|
1769
|
+
bigint: shim,
|
|
1770
|
+
bool: shim,
|
|
1771
|
+
func: shim,
|
|
1772
|
+
number: shim,
|
|
1773
|
+
object: shim,
|
|
1774
|
+
string: shim,
|
|
1775
|
+
symbol: shim,
|
|
1776
|
+
any: shim,
|
|
1777
|
+
arrayOf: getShim,
|
|
1778
|
+
element: shim,
|
|
1779
|
+
elementType: shim,
|
|
1780
|
+
instanceOf: getShim,
|
|
1781
|
+
node: shim,
|
|
1782
|
+
objectOf: getShim,
|
|
1783
|
+
oneOf: getShim,
|
|
1784
|
+
oneOfType: getShim,
|
|
1785
|
+
shape: getShim,
|
|
1786
|
+
exact: getShim,
|
|
1787
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
1788
|
+
resetWarningCache: emptyFunction
|
|
1789
|
+
};
|
|
1790
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1791
|
+
return ReactPropTypes;
|
|
1830
1792
|
};
|
|
1831
|
-
|
|
1832
|
-
return reactIs_production_min;
|
|
1793
|
+
return factoryWithThrowingShims;
|
|
1833
1794
|
}
|
|
1834
1795
|
|
|
1796
|
+
var reactIs = {exports: {}};
|
|
1797
|
+
|
|
1835
1798
|
var reactIs_development = {};
|
|
1836
1799
|
|
|
1837
1800
|
var hasRequiredReactIs_development;
|
|
@@ -1997,71 +1960,186 @@ function requireReactIs_development() {
|
|
|
1997
1960
|
return reactIs_development;
|
|
1998
1961
|
}
|
|
1999
1962
|
|
|
2000
|
-
var
|
|
2001
|
-
function requireReactIs() {
|
|
2002
|
-
if (hasRequiredReactIs) return reactIs.exports;
|
|
2003
|
-
hasRequiredReactIs = 1;
|
|
2004
|
-
if (process.env.NODE_ENV === 'production') {
|
|
2005
|
-
reactIs.exports = requireReactIs_production_min();
|
|
2006
|
-
} else {
|
|
2007
|
-
reactIs.exports = requireReactIs_development();
|
|
2008
|
-
}
|
|
2009
|
-
return reactIs.exports;
|
|
2010
|
-
}
|
|
2011
|
-
|
|
2012
|
-
/*
|
|
2013
|
-
object-assign
|
|
2014
|
-
(c) Sindre Sorhus
|
|
2015
|
-
@license MIT
|
|
2016
|
-
*/
|
|
2017
|
-
var objectAssign;
|
|
2018
|
-
var hasRequiredObjectAssign;
|
|
2019
|
-
function requireObjectAssign() {
|
|
2020
|
-
if (hasRequiredObjectAssign) return objectAssign;
|
|
2021
|
-
hasRequiredObjectAssign = 1;
|
|
2022
|
-
/* eslint-disable no-unused-vars */
|
|
2023
|
-
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
2024
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2025
|
-
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
2026
|
-
function toObject(val) {
|
|
2027
|
-
if (val === null || val === undefined) {
|
|
2028
|
-
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
2029
|
-
}
|
|
2030
|
-
return Object(val);
|
|
2031
|
-
}
|
|
2032
|
-
function shouldUseNative() {
|
|
2033
|
-
try {
|
|
2034
|
-
if (!Object.assign) {
|
|
2035
|
-
return false;
|
|
2036
|
-
}
|
|
2037
|
-
|
|
2038
|
-
// Detect buggy property enumeration order in older V8 versions.
|
|
2039
|
-
|
|
2040
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
2041
|
-
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
2042
|
-
test1[5] = 'de';
|
|
2043
|
-
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
2044
|
-
return false;
|
|
2045
|
-
}
|
|
2046
|
-
|
|
2047
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
2048
|
-
var test2 = {};
|
|
2049
|
-
for (var i = 0; i < 10; i++) {
|
|
2050
|
-
test2['_' + String.fromCharCode(i)] = i;
|
|
2051
|
-
}
|
|
2052
|
-
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
2053
|
-
return test2[n];
|
|
2054
|
-
});
|
|
2055
|
-
if (order2.join('') !== '0123456789') {
|
|
2056
|
-
return false;
|
|
2057
|
-
}
|
|
1963
|
+
var reactIs_production_min = {};
|
|
2058
1964
|
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
1965
|
+
var hasRequiredReactIs_production_min;
|
|
1966
|
+
function requireReactIs_production_min() {
|
|
1967
|
+
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
1968
|
+
hasRequiredReactIs_production_min = 1;
|
|
1969
|
+
var b = "function" === typeof Symbol && Symbol["for"],
|
|
1970
|
+
c = b ? Symbol["for"]("react.element") : 60103,
|
|
1971
|
+
d = b ? Symbol["for"]("react.portal") : 60106,
|
|
1972
|
+
e = b ? Symbol["for"]("react.fragment") : 60107,
|
|
1973
|
+
f = b ? Symbol["for"]("react.strict_mode") : 60108,
|
|
1974
|
+
g = b ? Symbol["for"]("react.profiler") : 60114,
|
|
1975
|
+
h = b ? Symbol["for"]("react.provider") : 60109,
|
|
1976
|
+
k = b ? Symbol["for"]("react.context") : 60110,
|
|
1977
|
+
l = b ? Symbol["for"]("react.async_mode") : 60111,
|
|
1978
|
+
m = b ? Symbol["for"]("react.concurrent_mode") : 60111,
|
|
1979
|
+
n = b ? Symbol["for"]("react.forward_ref") : 60112,
|
|
1980
|
+
p = b ? Symbol["for"]("react.suspense") : 60113,
|
|
1981
|
+
q = b ? Symbol["for"]("react.suspense_list") : 60120,
|
|
1982
|
+
r = b ? Symbol["for"]("react.memo") : 60115,
|
|
1983
|
+
t = b ? Symbol["for"]("react.lazy") : 60116,
|
|
1984
|
+
v = b ? Symbol["for"]("react.block") : 60121,
|
|
1985
|
+
w = b ? Symbol["for"]("react.fundamental") : 60117,
|
|
1986
|
+
x = b ? Symbol["for"]("react.responder") : 60118,
|
|
1987
|
+
y = b ? Symbol["for"]("react.scope") : 60119;
|
|
1988
|
+
function z(a) {
|
|
1989
|
+
if ("object" === _typeof$1(a) && null !== a) {
|
|
1990
|
+
var u = a.$$typeof;
|
|
1991
|
+
switch (u) {
|
|
1992
|
+
case c:
|
|
1993
|
+
switch (a = a.type, a) {
|
|
1994
|
+
case l:
|
|
1995
|
+
case m:
|
|
1996
|
+
case e:
|
|
1997
|
+
case g:
|
|
1998
|
+
case f:
|
|
1999
|
+
case p:
|
|
2000
|
+
return a;
|
|
2001
|
+
default:
|
|
2002
|
+
switch (a = a && a.$$typeof, a) {
|
|
2003
|
+
case k:
|
|
2004
|
+
case n:
|
|
2005
|
+
case t:
|
|
2006
|
+
case r:
|
|
2007
|
+
case h:
|
|
2008
|
+
return a;
|
|
2009
|
+
default:
|
|
2010
|
+
return u;
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
case d:
|
|
2014
|
+
return u;
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
function A(a) {
|
|
2019
|
+
return z(a) === m;
|
|
2020
|
+
}
|
|
2021
|
+
reactIs_production_min.AsyncMode = l;
|
|
2022
|
+
reactIs_production_min.ConcurrentMode = m;
|
|
2023
|
+
reactIs_production_min.ContextConsumer = k;
|
|
2024
|
+
reactIs_production_min.ContextProvider = h;
|
|
2025
|
+
reactIs_production_min.Element = c;
|
|
2026
|
+
reactIs_production_min.ForwardRef = n;
|
|
2027
|
+
reactIs_production_min.Fragment = e;
|
|
2028
|
+
reactIs_production_min.Lazy = t;
|
|
2029
|
+
reactIs_production_min.Memo = r;
|
|
2030
|
+
reactIs_production_min.Portal = d;
|
|
2031
|
+
reactIs_production_min.Profiler = g;
|
|
2032
|
+
reactIs_production_min.StrictMode = f;
|
|
2033
|
+
reactIs_production_min.Suspense = p;
|
|
2034
|
+
reactIs_production_min.isAsyncMode = function (a) {
|
|
2035
|
+
return A(a) || z(a) === l;
|
|
2036
|
+
};
|
|
2037
|
+
reactIs_production_min.isConcurrentMode = A;
|
|
2038
|
+
reactIs_production_min.isContextConsumer = function (a) {
|
|
2039
|
+
return z(a) === k;
|
|
2040
|
+
};
|
|
2041
|
+
reactIs_production_min.isContextProvider = function (a) {
|
|
2042
|
+
return z(a) === h;
|
|
2043
|
+
};
|
|
2044
|
+
reactIs_production_min.isElement = function (a) {
|
|
2045
|
+
return "object" === _typeof$1(a) && null !== a && a.$$typeof === c;
|
|
2046
|
+
};
|
|
2047
|
+
reactIs_production_min.isForwardRef = function (a) {
|
|
2048
|
+
return z(a) === n;
|
|
2049
|
+
};
|
|
2050
|
+
reactIs_production_min.isFragment = function (a) {
|
|
2051
|
+
return z(a) === e;
|
|
2052
|
+
};
|
|
2053
|
+
reactIs_production_min.isLazy = function (a) {
|
|
2054
|
+
return z(a) === t;
|
|
2055
|
+
};
|
|
2056
|
+
reactIs_production_min.isMemo = function (a) {
|
|
2057
|
+
return z(a) === r;
|
|
2058
|
+
};
|
|
2059
|
+
reactIs_production_min.isPortal = function (a) {
|
|
2060
|
+
return z(a) === d;
|
|
2061
|
+
};
|
|
2062
|
+
reactIs_production_min.isProfiler = function (a) {
|
|
2063
|
+
return z(a) === g;
|
|
2064
|
+
};
|
|
2065
|
+
reactIs_production_min.isStrictMode = function (a) {
|
|
2066
|
+
return z(a) === f;
|
|
2067
|
+
};
|
|
2068
|
+
reactIs_production_min.isSuspense = function (a) {
|
|
2069
|
+
return z(a) === p;
|
|
2070
|
+
};
|
|
2071
|
+
reactIs_production_min.isValidElementType = function (a) {
|
|
2072
|
+
return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === _typeof$1(a) && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
|
|
2073
|
+
};
|
|
2074
|
+
reactIs_production_min.typeOf = z;
|
|
2075
|
+
return reactIs_production_min;
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
var hasRequiredReactIs;
|
|
2079
|
+
function requireReactIs() {
|
|
2080
|
+
if (hasRequiredReactIs) return reactIs.exports;
|
|
2081
|
+
hasRequiredReactIs = 1;
|
|
2082
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2083
|
+
reactIs.exports = requireReactIs_production_min();
|
|
2084
|
+
} else {
|
|
2085
|
+
reactIs.exports = requireReactIs_development();
|
|
2086
|
+
}
|
|
2087
|
+
return reactIs.exports;
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
/*
|
|
2091
|
+
object-assign
|
|
2092
|
+
(c) Sindre Sorhus
|
|
2093
|
+
@license MIT
|
|
2094
|
+
*/
|
|
2095
|
+
var objectAssign;
|
|
2096
|
+
var hasRequiredObjectAssign;
|
|
2097
|
+
function requireObjectAssign() {
|
|
2098
|
+
if (hasRequiredObjectAssign) return objectAssign;
|
|
2099
|
+
hasRequiredObjectAssign = 1;
|
|
2100
|
+
/* eslint-disable no-unused-vars */
|
|
2101
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
2102
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2103
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
2104
|
+
function toObject(val) {
|
|
2105
|
+
if (val === null || val === undefined) {
|
|
2106
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
2107
|
+
}
|
|
2108
|
+
return Object(val);
|
|
2109
|
+
}
|
|
2110
|
+
function shouldUseNative() {
|
|
2111
|
+
try {
|
|
2112
|
+
if (!Object.assign) {
|
|
2113
|
+
return false;
|
|
2114
|
+
}
|
|
2115
|
+
|
|
2116
|
+
// Detect buggy property enumeration order in older V8 versions.
|
|
2117
|
+
|
|
2118
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
2119
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
2120
|
+
test1[5] = 'de';
|
|
2121
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
2122
|
+
return false;
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2125
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
2126
|
+
var test2 = {};
|
|
2127
|
+
for (var i = 0; i < 10; i++) {
|
|
2128
|
+
test2['_' + String.fromCharCode(i)] = i;
|
|
2129
|
+
}
|
|
2130
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
2131
|
+
return test2[n];
|
|
2132
|
+
});
|
|
2133
|
+
if (order2.join('') !== '0123456789') {
|
|
2134
|
+
return false;
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
2138
|
+
var test3 = {};
|
|
2139
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
2140
|
+
test3[letter] = letter;
|
|
2141
|
+
});
|
|
2142
|
+
if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') {
|
|
2065
2143
|
return false;
|
|
2066
2144
|
}
|
|
2067
2145
|
return true;
|
|
@@ -2095,22 +2173,6 @@ function requireObjectAssign() {
|
|
|
2095
2173
|
return objectAssign;
|
|
2096
2174
|
}
|
|
2097
2175
|
|
|
2098
|
-
/**
|
|
2099
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
2100
|
-
*
|
|
2101
|
-
* This source code is licensed under the MIT license found in the
|
|
2102
|
-
* LICENSE file in the root directory of this source tree.
|
|
2103
|
-
*/
|
|
2104
|
-
var ReactPropTypesSecret_1;
|
|
2105
|
-
var hasRequiredReactPropTypesSecret;
|
|
2106
|
-
function requireReactPropTypesSecret() {
|
|
2107
|
-
if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
|
|
2108
|
-
hasRequiredReactPropTypesSecret = 1;
|
|
2109
|
-
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
2110
|
-
ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
2111
|
-
return ReactPropTypesSecret_1;
|
|
2112
|
-
}
|
|
2113
|
-
|
|
2114
2176
|
var has;
|
|
2115
2177
|
var hasRequiredHas;
|
|
2116
2178
|
function requireHas() {
|
|
@@ -2751,66 +2813,6 @@ function requireFactoryWithTypeCheckers() {
|
|
|
2751
2813
|
return factoryWithTypeCheckers;
|
|
2752
2814
|
}
|
|
2753
2815
|
|
|
2754
|
-
/**
|
|
2755
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
2756
|
-
*
|
|
2757
|
-
* This source code is licensed under the MIT license found in the
|
|
2758
|
-
* LICENSE file in the root directory of this source tree.
|
|
2759
|
-
*/
|
|
2760
|
-
var factoryWithThrowingShims;
|
|
2761
|
-
var hasRequiredFactoryWithThrowingShims;
|
|
2762
|
-
function requireFactoryWithThrowingShims() {
|
|
2763
|
-
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
|
|
2764
|
-
hasRequiredFactoryWithThrowingShims = 1;
|
|
2765
|
-
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
2766
|
-
function emptyFunction() {}
|
|
2767
|
-
function emptyFunctionWithReset() {}
|
|
2768
|
-
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
2769
|
-
factoryWithThrowingShims = function factoryWithThrowingShims() {
|
|
2770
|
-
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
2771
|
-
if (secret === ReactPropTypesSecret) {
|
|
2772
|
-
// It is still safe when called from React.
|
|
2773
|
-
return;
|
|
2774
|
-
}
|
|
2775
|
-
var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
|
|
2776
|
-
err.name = 'Invariant Violation';
|
|
2777
|
-
throw err;
|
|
2778
|
-
}
|
|
2779
|
-
shim.isRequired = shim;
|
|
2780
|
-
function getShim() {
|
|
2781
|
-
return shim;
|
|
2782
|
-
}
|
|
2783
|
-
// Important!
|
|
2784
|
-
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
2785
|
-
var ReactPropTypes = {
|
|
2786
|
-
array: shim,
|
|
2787
|
-
bigint: shim,
|
|
2788
|
-
bool: shim,
|
|
2789
|
-
func: shim,
|
|
2790
|
-
number: shim,
|
|
2791
|
-
object: shim,
|
|
2792
|
-
string: shim,
|
|
2793
|
-
symbol: shim,
|
|
2794
|
-
any: shim,
|
|
2795
|
-
arrayOf: getShim,
|
|
2796
|
-
element: shim,
|
|
2797
|
-
elementType: shim,
|
|
2798
|
-
instanceOf: getShim,
|
|
2799
|
-
node: shim,
|
|
2800
|
-
objectOf: getShim,
|
|
2801
|
-
oneOf: getShim,
|
|
2802
|
-
oneOfType: getShim,
|
|
2803
|
-
shape: getShim,
|
|
2804
|
-
exact: getShim,
|
|
2805
|
-
checkPropTypes: emptyFunctionWithReset,
|
|
2806
|
-
resetWarningCache: emptyFunction
|
|
2807
|
-
};
|
|
2808
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
2809
|
-
return ReactPropTypes;
|
|
2810
|
-
};
|
|
2811
|
-
return factoryWithThrowingShims;
|
|
2812
|
-
}
|
|
2813
|
-
|
|
2814
2816
|
/**
|
|
2815
2817
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
2816
2818
|
*
|
|
@@ -2989,7 +2991,7 @@ var FocusLock = /*#__PURE__*/React__namespace.forwardRef(function FocusLockUI(pr
|
|
|
2989
2991
|
var hasLeadingGuards = noFocusGuards !== true;
|
|
2990
2992
|
var hasTailingGuards = hasLeadingGuards && noFocusGuards !== 'tail';
|
|
2991
2993
|
var mergedRef = useMergeRefs([parentRef, setObserveNode]);
|
|
2992
|
-
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, hasLeadingGuards && [
|
|
2994
|
+
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, hasLeadingGuards && [
|
|
2993
2995
|
// nearest focus guard
|
|
2994
2996
|
React__namespace.createElement("div", {
|
|
2995
2997
|
key: "guard-first",
|
|
@@ -3086,6 +3088,9 @@ function deferAction(action) {
|
|
|
3086
3088
|
var effectCar = createSidecarMedium();
|
|
3087
3089
|
var focusHiddenMarker = 'data-focus-on-hidden';
|
|
3088
3090
|
|
|
3091
|
+
var PREVENT_SCROLL = {
|
|
3092
|
+
preventScroll: true
|
|
3093
|
+
};
|
|
3089
3094
|
var FocusOn$1 = /*#__PURE__*/React__namespace.forwardRef(function (props, parentRef) {
|
|
3090
3095
|
var _a = React__namespace.useState(false),
|
|
3091
3096
|
lockProps = _a[0],
|
|
@@ -3093,6 +3098,7 @@ var FocusOn$1 = /*#__PURE__*/React__namespace.forwardRef(function (props, parent
|
|
|
3093
3098
|
var children = props.children,
|
|
3094
3099
|
autoFocus = props.autoFocus,
|
|
3095
3100
|
shards = props.shards,
|
|
3101
|
+
crossFrame = props.crossFrame,
|
|
3096
3102
|
_b = props.enabled,
|
|
3097
3103
|
enabled = _b === void 0 ? true : _b,
|
|
3098
3104
|
_c = props.scrollLock,
|
|
@@ -3110,7 +3116,7 @@ var FocusOn$1 = /*#__PURE__*/React__namespace.forwardRef(function (props, parent
|
|
|
3110
3116
|
style = props.style,
|
|
3111
3117
|
as = props.as,
|
|
3112
3118
|
gapMode = props.gapMode,
|
|
3113
|
-
rest = __rest$a(props, ["children", "autoFocus", "shards", "enabled", "scrollLock", "focusLock", "returnFocus", "inert", "allowPinchZoom", "sideCar", "className", "shouldIgnore", "preventScrollOnFocus", "style", "as", "gapMode"]);
|
|
3119
|
+
rest = __rest$a(props, ["children", "autoFocus", "shards", "crossFrame", "enabled", "scrollLock", "focusLock", "returnFocus", "inert", "allowPinchZoom", "sideCar", "className", "shouldIgnore", "preventScrollOnFocus", "style", "as", "gapMode"]);
|
|
3114
3120
|
var SideCar = sideCar;
|
|
3115
3121
|
var onActivation = lockProps.onActivation,
|
|
3116
3122
|
onDeactivation = lockProps.onDeactivation,
|
|
@@ -3132,20 +3138,19 @@ var FocusOn$1 = /*#__PURE__*/React__namespace.forwardRef(function (props, parent
|
|
|
3132
3138
|
returnFocus: returnFocus,
|
|
3133
3139
|
autoFocus: autoFocus,
|
|
3134
3140
|
shards: shards,
|
|
3141
|
+
crossFrame: crossFrame,
|
|
3135
3142
|
onActivation: onActivation,
|
|
3136
3143
|
onDeactivation: onDeactivation,
|
|
3137
3144
|
className: className,
|
|
3138
3145
|
whiteList: shouldIgnore,
|
|
3139
3146
|
lockProps: appliedLockProps,
|
|
3140
|
-
focusOptions: preventScrollOnFocus ?
|
|
3141
|
-
preventScroll: true
|
|
3142
|
-
} : undefined,
|
|
3147
|
+
focusOptions: preventScrollOnFocus ? PREVENT_SCROLL : undefined,
|
|
3143
3148
|
as: RemoveScroll
|
|
3144
|
-
}, children), enabled && /*#__PURE__*/React__namespace.createElement(SideCar, _assign({}, rest, {
|
|
3149
|
+
}, children), enabled && ( /*#__PURE__*/React__namespace.createElement(SideCar, _assign({}, rest, {
|
|
3145
3150
|
sideCar: effectCar,
|
|
3146
3151
|
setLockProps: setLockProps,
|
|
3147
3152
|
shards: shards
|
|
3148
|
-
})));
|
|
3153
|
+
}))));
|
|
3149
3154
|
});
|
|
3150
3155
|
|
|
3151
3156
|
function _setPrototypeOf(o, p) {
|
|
@@ -3275,6 +3280,9 @@ var toArray = function toArray(a) {
|
|
|
3275
3280
|
var asArray = function asArray(a) {
|
|
3276
3281
|
return Array.isArray(a) ? a : [a];
|
|
3277
3282
|
};
|
|
3283
|
+
var getFirst = function getFirst(a) {
|
|
3284
|
+
return Array.isArray(a) ? a[0] : a;
|
|
3285
|
+
};
|
|
3278
3286
|
|
|
3279
3287
|
var isElementHidden = function isElementHidden(node) {
|
|
3280
3288
|
// we can measure only "elements"
|
|
@@ -3389,16 +3397,28 @@ var tabbables = ['button:enabled', 'select:enabled', 'textarea:enabled', 'input:
|
|
|
3389
3397
|
var queryTabbables = tabbables.join(',');
|
|
3390
3398
|
var queryGuardTabbables = "".concat(queryTabbables, ", [data-focus-guard]");
|
|
3391
3399
|
var getFocusablesWithShadowDom = function getFocusablesWithShadowDom(parent, withGuards) {
|
|
3392
|
-
|
|
3393
|
-
return toArray(((_a = parent.shadowRoot) === null || _a === void 0 ? void 0 : _a.children) || parent.children).reduce(function (acc, child) {
|
|
3400
|
+
return toArray((parent.shadowRoot || parent).children).reduce(function (acc, child) {
|
|
3394
3401
|
return acc.concat(child.matches(withGuards ? queryGuardTabbables : queryTabbables) ? [child] : [], getFocusablesWithShadowDom(child));
|
|
3395
3402
|
}, []);
|
|
3396
3403
|
};
|
|
3404
|
+
var getFocusablesWithIFrame = function getFocusablesWithIFrame(parent, withGuards) {
|
|
3405
|
+
var _a;
|
|
3406
|
+
// contentDocument of iframe will be null if current origin cannot access it
|
|
3407
|
+
if (parent instanceof HTMLIFrameElement && ((_a = parent.contentDocument) === null || _a === void 0 ? void 0 : _a.body)) {
|
|
3408
|
+
return getFocusables([parent.contentDocument.body], withGuards);
|
|
3409
|
+
}
|
|
3410
|
+
return [parent];
|
|
3411
|
+
};
|
|
3397
3412
|
var getFocusables = function getFocusables(parents, withGuards) {
|
|
3398
3413
|
return parents.reduce(function (acc, parent) {
|
|
3414
|
+
var _a;
|
|
3415
|
+
var focusableWithShadowDom = getFocusablesWithShadowDom(parent, withGuards);
|
|
3416
|
+
var focusableWithIframes = (_a = []).concat.apply(_a, focusableWithShadowDom.map(function (node) {
|
|
3417
|
+
return getFocusablesWithIFrame(node, withGuards);
|
|
3418
|
+
}));
|
|
3399
3419
|
return acc.concat(
|
|
3400
3420
|
// add all tabbables inside and within shadow DOMs in DOM order
|
|
3401
|
-
|
|
3421
|
+
focusableWithIframes,
|
|
3402
3422
|
// add if node is tabbable itself
|
|
3403
3423
|
parent.parentNode ? toArray(parent.parentNode.querySelectorAll(queryTabbables)).filter(function (node) {
|
|
3404
3424
|
return node === parent;
|
|
@@ -3471,6 +3491,14 @@ var contains$1 = function contains(scope, element) {
|
|
|
3471
3491
|
return true;
|
|
3472
3492
|
}
|
|
3473
3493
|
return toArray(scope.children).some(function (child) {
|
|
3494
|
+
var _a;
|
|
3495
|
+
if (child instanceof HTMLIFrameElement) {
|
|
3496
|
+
var iframeBody = (_a = child.contentDocument) === null || _a === void 0 ? void 0 : _a.body;
|
|
3497
|
+
if (iframeBody) {
|
|
3498
|
+
return contains(iframeBody, element);
|
|
3499
|
+
}
|
|
3500
|
+
return false;
|
|
3501
|
+
}
|
|
3474
3502
|
return contains(child, element);
|
|
3475
3503
|
});
|
|
3476
3504
|
}
|
|
@@ -3499,7 +3527,6 @@ var filterNested = function filterNested(nodes) {
|
|
|
3499
3527
|
/* eslint-enable */
|
|
3500
3528
|
}
|
|
3501
3529
|
}
|
|
3502
|
-
|
|
3503
3530
|
return nodes.filter(function (_, index) {
|
|
3504
3531
|
return !contained.has(index);
|
|
3505
3532
|
});
|
|
@@ -3526,34 +3553,51 @@ var getAllAffectedNodes = function getAllAffectedNodes(node) {
|
|
|
3526
3553
|
}, []);
|
|
3527
3554
|
};
|
|
3528
3555
|
|
|
3529
|
-
var
|
|
3530
|
-
|
|
3556
|
+
var safeProbe = function safeProbe(cb) {
|
|
3557
|
+
try {
|
|
3558
|
+
return cb();
|
|
3559
|
+
} catch (e) {
|
|
3560
|
+
return undefined;
|
|
3561
|
+
}
|
|
3531
3562
|
};
|
|
3563
|
+
|
|
3532
3564
|
/**
|
|
3533
3565
|
* returns active element from document or from nested shadowdoms
|
|
3534
3566
|
*/
|
|
3535
|
-
var getActiveElement = function getActiveElement() {
|
|
3536
|
-
|
|
3567
|
+
var getActiveElement = function getActiveElement(inDocument) {
|
|
3568
|
+
if (inDocument === void 0) {
|
|
3569
|
+
inDocument = document;
|
|
3570
|
+
}
|
|
3571
|
+
if (!inDocument || !inDocument.activeElement) {
|
|
3572
|
+
return undefined;
|
|
3573
|
+
}
|
|
3574
|
+
var activeElement = inDocument.activeElement;
|
|
3575
|
+
return activeElement.shadowRoot ? getActiveElement(activeElement.shadowRoot) : activeElement instanceof HTMLIFrameElement && safeProbe(function () {
|
|
3576
|
+
return activeElement.contentWindow.document;
|
|
3577
|
+
}) ? getActiveElement(activeElement.contentWindow.document) : activeElement;
|
|
3537
3578
|
};
|
|
3538
3579
|
|
|
3539
|
-
var focusInFrame = function focusInFrame(frame) {
|
|
3540
|
-
return frame ===
|
|
3580
|
+
var focusInFrame = function focusInFrame(frame, activeElement) {
|
|
3581
|
+
return frame === activeElement;
|
|
3541
3582
|
};
|
|
3542
|
-
var focusInsideIframe = function focusInsideIframe(topNode) {
|
|
3583
|
+
var focusInsideIframe = function focusInsideIframe(topNode, activeElement) {
|
|
3543
3584
|
return Boolean(toArray(topNode.querySelectorAll('iframe')).some(function (node) {
|
|
3544
|
-
return focusInFrame(node);
|
|
3585
|
+
return focusInFrame(node, activeElement);
|
|
3545
3586
|
}));
|
|
3546
3587
|
};
|
|
3547
3588
|
/**
|
|
3548
3589
|
* @returns {Boolean} true, if the current focus is inside given node or nodes
|
|
3549
3590
|
*/
|
|
3550
|
-
var focusInside = function focusInside(topNode) {
|
|
3551
|
-
|
|
3591
|
+
var focusInside = function focusInside(topNode, activeElement) {
|
|
3592
|
+
// const activeElement = document && getActiveElement();
|
|
3593
|
+
if (activeElement === void 0) {
|
|
3594
|
+
activeElement = getActiveElement(getFirst(topNode).ownerDocument);
|
|
3595
|
+
}
|
|
3552
3596
|
if (!activeElement || activeElement.dataset && activeElement.dataset.focusGuard) {
|
|
3553
3597
|
return false;
|
|
3554
3598
|
}
|
|
3555
3599
|
return getAllAffectedNodes(topNode).some(function (node) {
|
|
3556
|
-
return contains$1(node, activeElement) || focusInsideIframe(node);
|
|
3600
|
+
return contains$1(node, activeElement) || focusInsideIframe(node, activeElement);
|
|
3557
3601
|
});
|
|
3558
3602
|
};
|
|
3559
3603
|
|
|
@@ -3562,13 +3606,16 @@ var focusInside = function focusInside(topNode) {
|
|
|
3562
3606
|
* ie contained inside a node focus-lock shall ignore
|
|
3563
3607
|
* @returns {boolean} focus is currently is in "allow" area
|
|
3564
3608
|
*/
|
|
3565
|
-
var focusIsHidden = function focusIsHidden() {
|
|
3566
|
-
|
|
3609
|
+
var focusIsHidden = function focusIsHidden(inDocument) {
|
|
3610
|
+
if (inDocument === void 0) {
|
|
3611
|
+
inDocument = document;
|
|
3612
|
+
}
|
|
3613
|
+
var activeElement = getActiveElement(inDocument);
|
|
3567
3614
|
if (!activeElement) {
|
|
3568
3615
|
return false;
|
|
3569
3616
|
}
|
|
3570
3617
|
// this does not support setting FOCUS_ALLOW within shadow dom
|
|
3571
|
-
return toArray(
|
|
3618
|
+
return toArray(inDocument.querySelectorAll("[".concat(FOCUS_ALLOW, "]"))).some(function (node) {
|
|
3572
3619
|
return contains$1(node, activeElement);
|
|
3573
3620
|
});
|
|
3574
3621
|
};
|
|
@@ -3786,7 +3833,7 @@ var reorderNodes = function reorderNodes(srcNodes, dstNodes) {
|
|
|
3786
3833
|
* @param lastNode
|
|
3787
3834
|
*/
|
|
3788
3835
|
var getFocusMerge = function getFocusMerge(topNode, lastNode) {
|
|
3789
|
-
var activeElement = document
|
|
3836
|
+
var activeElement = getActiveElement(asArray(topNode).length > 0 ? document : getFirst(topNode).ownerDocument);
|
|
3790
3837
|
var entries = getAllAffectedNodes(topNode).filter(isNotAGuard);
|
|
3791
3838
|
var commonParent = getTopCommonParent(activeElement || topNode, topNode, entries);
|
|
3792
3839
|
var visibilityCache = new Map();
|
|
@@ -3812,9 +3859,15 @@ var getFocusMerge = function getFocusMerge(topNode, lastNode) {
|
|
|
3812
3859
|
});
|
|
3813
3860
|
var newId = newFocus(innerNodes, outerNodes, activeElement, lastNode);
|
|
3814
3861
|
if (newId === NEW_FOCUS) {
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3862
|
+
var focusNode = pickAutofocus(anyFocusable, innerNodes, allParentAutofocusables(entries, visibilityCache));
|
|
3863
|
+
if (focusNode) {
|
|
3864
|
+
return {
|
|
3865
|
+
node: focusNode
|
|
3866
|
+
};
|
|
3867
|
+
} else {
|
|
3868
|
+
console.warn('focus-lock: cannot find any node to move focus into');
|
|
3869
|
+
return undefined;
|
|
3870
|
+
}
|
|
3818
3871
|
}
|
|
3819
3872
|
if (newId === undefined) {
|
|
3820
3873
|
return newId;
|
|
@@ -4472,7 +4525,6 @@ function RemoveScrollSideCar(props) {
|
|
|
4472
4525
|
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
4473
4526
|
// other axis might be not scrollable
|
|
4474
4527
|
}
|
|
4475
|
-
|
|
4476
4528
|
if (!canBeScrolledInMainDirection) {
|
|
4477
4529
|
return false;
|
|
4478
4530
|
}
|
|
@@ -5238,6 +5290,7 @@ function _curryN(length, received, fn) {
|
|
|
5238
5290
|
var argsIdx = 0;
|
|
5239
5291
|
var left = length;
|
|
5240
5292
|
var combinedIdx = 0;
|
|
5293
|
+
var hasPlaceholder = false;
|
|
5241
5294
|
while (combinedIdx < received.length || argsIdx < arguments.length) {
|
|
5242
5295
|
var result;
|
|
5243
5296
|
if (combinedIdx < received.length && (!_isPlaceholder(received[combinedIdx]) || argsIdx >= arguments.length)) {
|
|
@@ -5249,10 +5302,12 @@ function _curryN(length, received, fn) {
|
|
|
5249
5302
|
combined[combinedIdx] = result;
|
|
5250
5303
|
if (!_isPlaceholder(result)) {
|
|
5251
5304
|
left -= 1;
|
|
5305
|
+
} else {
|
|
5306
|
+
hasPlaceholder = true;
|
|
5252
5307
|
}
|
|
5253
5308
|
combinedIdx += 1;
|
|
5254
5309
|
}
|
|
5255
|
-
return left <= 0 ? fn.apply(this, combined) : _arity(left, _curryN(length, combined, fn));
|
|
5310
|
+
return !hasPlaceholder && left <= 0 ? fn.apply(this, combined) : _arity(Math.max(0, left), _curryN(length, combined, fn));
|
|
5256
5311
|
};
|
|
5257
5312
|
}
|
|
5258
5313
|
|
|
@@ -5306,6 +5361,7 @@ _curry2(function curryN(length, fn) {
|
|
|
5306
5361
|
}
|
|
5307
5362
|
return _arity(length, _curryN(length, [], fn));
|
|
5308
5363
|
});
|
|
5364
|
+
var curryN$1 = curryN;
|
|
5309
5365
|
|
|
5310
5366
|
/**
|
|
5311
5367
|
* Optimized internal three-arity curry function.
|
|
@@ -5464,15 +5520,16 @@ function _objectIs(a, b) {
|
|
|
5464
5520
|
}
|
|
5465
5521
|
var _objectIs$1 = typeof Object.is === 'function' ? Object.is : _objectIs;
|
|
5466
5522
|
|
|
5467
|
-
var toString$
|
|
5523
|
+
var toString$2 = Object.prototype.toString;
|
|
5468
5524
|
var _isArguments = /*#__PURE__*/
|
|
5469
5525
|
function () {
|
|
5470
|
-
return toString$
|
|
5471
|
-
return toString$
|
|
5526
|
+
return toString$2.call(arguments) === '[object Arguments]' ? function _isArguments(x) {
|
|
5527
|
+
return toString$2.call(x) === '[object Arguments]';
|
|
5472
5528
|
} : function _isArguments(x) {
|
|
5473
5529
|
return _has('callee', x);
|
|
5474
5530
|
};
|
|
5475
5531
|
}();
|
|
5532
|
+
var _isArguments$1 = _isArguments;
|
|
5476
5533
|
|
|
5477
5534
|
var hasEnumBug = ! /*#__PURE__*/
|
|
5478
5535
|
{
|
|
@@ -5524,7 +5581,7 @@ _curry1(function keys(obj) {
|
|
|
5524
5581
|
}
|
|
5525
5582
|
var prop, nIdx;
|
|
5526
5583
|
var ks = [];
|
|
5527
|
-
var checkArgsLength = hasArgsEnumBug && _isArguments(obj);
|
|
5584
|
+
var checkArgsLength = hasArgsEnumBug && _isArguments$1(obj);
|
|
5528
5585
|
for (prop in obj) {
|
|
5529
5586
|
if (_has(prop, obj) && (!checkArgsLength || prop !== 'length')) {
|
|
5530
5587
|
ks[ks.length] = prop;
|
|
@@ -5542,6 +5599,7 @@ _curry1(function keys(obj) {
|
|
|
5542
5599
|
}
|
|
5543
5600
|
return ks;
|
|
5544
5601
|
});
|
|
5602
|
+
var keys$1 = keys;
|
|
5545
5603
|
|
|
5546
5604
|
/**
|
|
5547
5605
|
* Gives a single-word string description of the (native) type of a value,
|
|
@@ -5566,6 +5624,7 @@ _curry1(function keys(obj) {
|
|
|
5566
5624
|
* R.type([]); //=> "Array"
|
|
5567
5625
|
* R.type(/[A-z]/); //=> "RegExp"
|
|
5568
5626
|
* R.type(() => {}); //=> "Function"
|
|
5627
|
+
* R.type(async () => {}); //=> "AsyncFunction"
|
|
5569
5628
|
* R.type(undefined); //=> "Undefined"
|
|
5570
5629
|
*/
|
|
5571
5630
|
|
|
@@ -5573,6 +5632,7 @@ var type = /*#__PURE__*/
|
|
|
5573
5632
|
_curry1(function type(val) {
|
|
5574
5633
|
return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1);
|
|
5575
5634
|
});
|
|
5635
|
+
var type$1 = type;
|
|
5576
5636
|
|
|
5577
5637
|
/**
|
|
5578
5638
|
* private _uniqContentEquals function.
|
|
@@ -5600,8 +5660,8 @@ function _equals(a, b, stackA, stackB) {
|
|
|
5600
5660
|
if (_objectIs$1(a, b)) {
|
|
5601
5661
|
return true;
|
|
5602
5662
|
}
|
|
5603
|
-
var typeA = type(a);
|
|
5604
|
-
if (typeA !== type(b)) {
|
|
5663
|
+
var typeA = type$1(a);
|
|
5664
|
+
if (typeA !== type$1(b)) {
|
|
5605
5665
|
return false;
|
|
5606
5666
|
}
|
|
5607
5667
|
if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') {
|
|
@@ -5680,8 +5740,8 @@ function _equals(a, b, stackA, stackB) {
|
|
|
5680
5740
|
// Values of other types are only equal if identical.
|
|
5681
5741
|
return false;
|
|
5682
5742
|
}
|
|
5683
|
-
var keysA = keys(a);
|
|
5684
|
-
if (keysA.length !== keys(b).length) {
|
|
5743
|
+
var keysA = keys$1(a);
|
|
5744
|
+
if (keysA.length !== keys$1(b).length) {
|
|
5685
5745
|
return false;
|
|
5686
5746
|
}
|
|
5687
5747
|
var extendedStackA = stackA.concat([a]);
|
|
@@ -5727,6 +5787,7 @@ var equals = /*#__PURE__*/
|
|
|
5727
5787
|
_curry2(function equals(a, b) {
|
|
5728
5788
|
return _equals(a, b, [], []);
|
|
5729
5789
|
});
|
|
5790
|
+
var equals$1 = equals;
|
|
5730
5791
|
|
|
5731
5792
|
function _indexOf(list, a, idx) {
|
|
5732
5793
|
var inf, item; // Array.prototype.indexOf doesn't exist below IE9
|
|
@@ -5774,7 +5835,7 @@ function _indexOf(list, a, idx) {
|
|
|
5774
5835
|
} // anything else not covered above, defer to R.equals
|
|
5775
5836
|
|
|
5776
5837
|
while (idx < list.length) {
|
|
5777
|
-
if (equals(list[idx], a)) {
|
|
5838
|
+
if (equals$1(list[idx], a)) {
|
|
5778
5839
|
return idx;
|
|
5779
5840
|
}
|
|
5780
5841
|
idx += 1;
|
|
@@ -5814,6 +5875,7 @@ var _toISOString = typeof Date.prototype.toISOString === 'function' ? function _
|
|
|
5814
5875
|
} : function _toISOString(d) {
|
|
5815
5876
|
return d.getUTCFullYear() + '-' + pad(d.getUTCMonth() + 1) + '-' + pad(d.getUTCDate()) + 'T' + pad(d.getUTCHours()) + ':' + pad(d.getUTCMinutes()) + ':' + pad(d.getUTCSeconds()) + '.' + (d.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) + 'Z';
|
|
5816
5877
|
};
|
|
5878
|
+
var _toISOString$1 = _toISOString;
|
|
5817
5879
|
|
|
5818
5880
|
function _complement(f) {
|
|
5819
5881
|
return function () {
|
|
@@ -5904,10 +5966,11 @@ _dispatchable(['fantasy-land/filter', 'filter'], _xfilter, function (pred, filte
|
|
|
5904
5966
|
acc[key] = filterable[key];
|
|
5905
5967
|
}
|
|
5906
5968
|
return acc;
|
|
5907
|
-
}, {}, keys(filterable)) :
|
|
5969
|
+
}, {}, keys$1(filterable)) :
|
|
5908
5970
|
// else
|
|
5909
5971
|
_filter(pred, filterable);
|
|
5910
5972
|
}));
|
|
5973
|
+
var filter$1 = filter;
|
|
5911
5974
|
|
|
5912
5975
|
/**
|
|
5913
5976
|
* The complement of [`filter`](#filter).
|
|
@@ -5936,8 +5999,9 @@ _dispatchable(['fantasy-land/filter', 'filter'], _xfilter, function (pred, filte
|
|
|
5936
5999
|
|
|
5937
6000
|
var reject = /*#__PURE__*/
|
|
5938
6001
|
_curry2(function reject(pred, filterable) {
|
|
5939
|
-
return filter(_complement(pred), filterable);
|
|
6002
|
+
return filter$1(_complement(pred), filterable);
|
|
5940
6003
|
});
|
|
6004
|
+
var reject$1 = reject;
|
|
5941
6005
|
|
|
5942
6006
|
function _toString(x, seen) {
|
|
5943
6007
|
var recur = function recur(y) {
|
|
@@ -5954,13 +6018,13 @@ function _toString(x, seen) {
|
|
|
5954
6018
|
case '[object Arguments]':
|
|
5955
6019
|
return '(function() { return arguments; }(' + _map(recur, x).join(', ') + '))';
|
|
5956
6020
|
case '[object Array]':
|
|
5957
|
-
return '[' + _map(recur, x).concat(mapPairs(x, reject(function (k) {
|
|
6021
|
+
return '[' + _map(recur, x).concat(mapPairs(x, reject$1(function (k) {
|
|
5958
6022
|
return /^\d+$/.test(k);
|
|
5959
|
-
}, keys(x)))).join(', ') + ']';
|
|
6023
|
+
}, keys$1(x)))).join(', ') + ']';
|
|
5960
6024
|
case '[object Boolean]':
|
|
5961
6025
|
return _typeof$1(x) === 'object' ? 'new Boolean(' + recur(x.valueOf()) + ')' : x.toString();
|
|
5962
6026
|
case '[object Date]':
|
|
5963
|
-
return 'new Date(' + (isNaN(x.valueOf()) ? recur(NaN) : _quote(_toISOString(x))) + ')';
|
|
6027
|
+
return 'new Date(' + (isNaN(x.valueOf()) ? recur(NaN) : _quote(_toISOString$1(x))) + ')';
|
|
5964
6028
|
case '[object Map]':
|
|
5965
6029
|
return 'new Map(' + recur(Array.from(x)) + ')';
|
|
5966
6030
|
case '[object Null]':
|
|
@@ -5980,7 +6044,7 @@ function _toString(x, seen) {
|
|
|
5980
6044
|
return repr;
|
|
5981
6045
|
}
|
|
5982
6046
|
}
|
|
5983
|
-
return '{' + mapPairs(x, keys(x)).join(', ') + '}';
|
|
6047
|
+
return '{' + mapPairs(x, keys$1(x)).join(', ') + '}';
|
|
5984
6048
|
}
|
|
5985
6049
|
}
|
|
5986
6050
|
|
|
@@ -6025,6 +6089,7 @@ var toString = /*#__PURE__*/
|
|
|
6025
6089
|
_curry1(function toString(val) {
|
|
6026
6090
|
return _toString(val, []);
|
|
6027
6091
|
});
|
|
6092
|
+
var toString$1 = toString;
|
|
6028
6093
|
|
|
6029
6094
|
/**
|
|
6030
6095
|
* Returns the larger of its two arguments.
|
|
@@ -6063,13 +6128,14 @@ _curry2(function max(a, b) {
|
|
|
6063
6128
|
if (maxByType !== undefined) {
|
|
6064
6129
|
return maxByType === _typeof$1(a) ? a : b;
|
|
6065
6130
|
}
|
|
6066
|
-
var stringA = toString(a);
|
|
6067
|
-
var maxByStringValue = safeMax(stringA, toString(b));
|
|
6131
|
+
var stringA = toString$1(a);
|
|
6132
|
+
var maxByStringValue = safeMax(stringA, toString$1(b));
|
|
6068
6133
|
if (maxByStringValue !== undefined) {
|
|
6069
6134
|
return maxByStringValue === stringA ? a : b;
|
|
6070
6135
|
}
|
|
6071
6136
|
return b;
|
|
6072
6137
|
});
|
|
6138
|
+
var max$1 = max;
|
|
6073
6139
|
|
|
6074
6140
|
var XMap = /*#__PURE__*/
|
|
6075
6141
|
function () {
|
|
@@ -6089,6 +6155,7 @@ var _xmap = function _xmap(f) {
|
|
|
6089
6155
|
return new XMap(f, xf);
|
|
6090
6156
|
};
|
|
6091
6157
|
};
|
|
6158
|
+
var _xmap$1 = _xmap;
|
|
6092
6159
|
|
|
6093
6160
|
/**
|
|
6094
6161
|
* Takes a function and
|
|
@@ -6128,21 +6195,22 @@ var _xmap = function _xmap(f) {
|
|
|
6128
6195
|
|
|
6129
6196
|
var map = /*#__PURE__*/
|
|
6130
6197
|
_curry2( /*#__PURE__*/
|
|
6131
|
-
_dispatchable(['fantasy-land/map', 'map'], _xmap, function map(fn, functor) {
|
|
6198
|
+
_dispatchable(['fantasy-land/map', 'map'], _xmap$1, function map(fn, functor) {
|
|
6132
6199
|
switch (Object.prototype.toString.call(functor)) {
|
|
6133
6200
|
case '[object Function]':
|
|
6134
|
-
return curryN(functor.length, function () {
|
|
6201
|
+
return curryN$1(functor.length, function () {
|
|
6135
6202
|
return fn.call(this, functor.apply(this, arguments));
|
|
6136
6203
|
});
|
|
6137
6204
|
case '[object Object]':
|
|
6138
6205
|
return _arrayReduce(function (acc, key) {
|
|
6139
6206
|
acc[key] = fn(functor[key]);
|
|
6140
6207
|
return acc;
|
|
6141
|
-
}, {}, keys(functor));
|
|
6208
|
+
}, {}, keys$1(functor));
|
|
6142
6209
|
default:
|
|
6143
6210
|
return _map(fn, functor);
|
|
6144
6211
|
}
|
|
6145
6212
|
}));
|
|
6213
|
+
var map$1 = map;
|
|
6146
6214
|
|
|
6147
6215
|
function _isString(x) {
|
|
6148
6216
|
return Object.prototype.toString.call(x) === '[object String]';
|
|
@@ -6189,11 +6257,12 @@ _curry1(function isArrayLike(x) {
|
|
|
6189
6257
|
}
|
|
6190
6258
|
return false;
|
|
6191
6259
|
});
|
|
6260
|
+
var _isArrayLike$1 = _isArrayLike;
|
|
6192
6261
|
|
|
6193
6262
|
var symIterator = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator';
|
|
6194
6263
|
function _createReduce(arrayReduce, methodReduce, iterableReduce) {
|
|
6195
6264
|
return function _reduce(xf, acc, list) {
|
|
6196
|
-
if (_isArrayLike(list)) {
|
|
6265
|
+
if (_isArrayLike$1(list)) {
|
|
6197
6266
|
return arrayReduce(xf, acc, list);
|
|
6198
6267
|
}
|
|
6199
6268
|
if (list == null) {
|
|
@@ -6258,6 +6327,7 @@ _curry2(function bind(fn, thisObj) {
|
|
|
6258
6327
|
return fn.apply(thisObj, arguments);
|
|
6259
6328
|
});
|
|
6260
6329
|
});
|
|
6330
|
+
var bind$1 = bind;
|
|
6261
6331
|
|
|
6262
6332
|
function _xIterableReduce(xf, acc, iter) {
|
|
6263
6333
|
var step = iter.next();
|
|
@@ -6272,10 +6342,11 @@ function _xIterableReduce(xf, acc, iter) {
|
|
|
6272
6342
|
return xf['@@transducer/result'](acc);
|
|
6273
6343
|
}
|
|
6274
6344
|
function _xMethodReduce(xf, acc, obj, methodName) {
|
|
6275
|
-
return xf['@@transducer/result'](obj[methodName](bind(xf['@@transducer/step'], xf), acc));
|
|
6345
|
+
return xf['@@transducer/result'](obj[methodName](bind$1(xf['@@transducer/step'], xf), acc));
|
|
6276
6346
|
}
|
|
6277
6347
|
var _xReduce = /*#__PURE__*/
|
|
6278
6348
|
_createReduce(_xArrayReduce, _xMethodReduce, _xIterableReduce);
|
|
6349
|
+
var _xReduce$1 = _xReduce;
|
|
6279
6350
|
|
|
6280
6351
|
var XWrap = /*#__PURE__*/
|
|
6281
6352
|
function () {
|
|
@@ -6352,8 +6423,9 @@ function _xwrap(fn) {
|
|
|
6352
6423
|
|
|
6353
6424
|
var reduce = /*#__PURE__*/
|
|
6354
6425
|
_curry3(function (xf, acc, list) {
|
|
6355
|
-
return _xReduce(typeof xf === 'function' ? _xwrap(xf) : xf, acc, list);
|
|
6426
|
+
return _xReduce$1(typeof xf === 'function' ? _xwrap(xf) : xf, acc, list);
|
|
6356
6427
|
});
|
|
6428
|
+
var reduce$1 = reduce;
|
|
6357
6429
|
|
|
6358
6430
|
function _identity(x) {
|
|
6359
6431
|
return x;
|
|
@@ -6381,6 +6453,7 @@ function _identity(x) {
|
|
|
6381
6453
|
|
|
6382
6454
|
var identity = /*#__PURE__*/
|
|
6383
6455
|
_curry1(_identity);
|
|
6456
|
+
var identity$1 = identity;
|
|
6384
6457
|
|
|
6385
6458
|
/**
|
|
6386
6459
|
* Returns a function, `fn`, which encapsulates `if/else, if/else, ...` logic.
|
|
@@ -6416,7 +6489,7 @@ _curry1(_identity);
|
|
|
6416
6489
|
|
|
6417
6490
|
var cond = /*#__PURE__*/
|
|
6418
6491
|
_curry1(function cond(pairs) {
|
|
6419
|
-
var arity = reduce(max, 0, map(function (pair) {
|
|
6492
|
+
var arity = reduce$1(max$1, 0, map$1(function (pair) {
|
|
6420
6493
|
return pair[0].length;
|
|
6421
6494
|
}, pairs));
|
|
6422
6495
|
return _arity(arity, function () {
|
|
@@ -6596,12 +6669,14 @@ function hasOrAdd(item, shouldAdd, set) {
|
|
|
6596
6669
|
}
|
|
6597
6670
|
} // A simple Set type that honours R.equals semantics
|
|
6598
6671
|
|
|
6672
|
+
var _Set$1 = _Set;
|
|
6673
|
+
|
|
6599
6674
|
var XUniqBy = /*#__PURE__*/
|
|
6600
6675
|
function () {
|
|
6601
6676
|
function XUniqBy(f, xf) {
|
|
6602
6677
|
this.xf = xf;
|
|
6603
6678
|
this.f = f;
|
|
6604
|
-
this.set = new _Set();
|
|
6679
|
+
this.set = new _Set$1();
|
|
6605
6680
|
}
|
|
6606
6681
|
XUniqBy.prototype['@@transducer/init'] = _xfBase.init;
|
|
6607
6682
|
XUniqBy.prototype['@@transducer/result'] = _xfBase.result;
|
|
@@ -6640,7 +6715,7 @@ function _xuniqBy(f) {
|
|
|
6640
6715
|
var uniqBy = /*#__PURE__*/
|
|
6641
6716
|
_curry2( /*#__PURE__*/
|
|
6642
6717
|
_dispatchable([], _xuniqBy, function (fn, list) {
|
|
6643
|
-
var set = new _Set();
|
|
6718
|
+
var set = new _Set$1();
|
|
6644
6719
|
var result = [];
|
|
6645
6720
|
var idx = 0;
|
|
6646
6721
|
var appliedItem, item;
|
|
@@ -6675,7 +6750,7 @@ var uniqBy$1 = uniqBy;
|
|
|
6675
6750
|
*/
|
|
6676
6751
|
|
|
6677
6752
|
var uniq = /*#__PURE__*/
|
|
6678
|
-
uniqBy$1(identity);
|
|
6753
|
+
uniqBy$1(identity$1);
|
|
6679
6754
|
var uniq$1 = uniq;
|
|
6680
6755
|
|
|
6681
6756
|
function _isNumber(x) {
|
|
@@ -7188,239 +7263,513 @@ var ExceedConstrain = function ExceedConstrain(_ref) {
|
|
|
7188
7263
|
|
|
7189
7264
|
var reactInputMask = {exports: {}};
|
|
7190
7265
|
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
|
|
7266
|
+
/**
|
|
7267
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
7268
|
+
*
|
|
7269
|
+
* This source code is licensed under the MIT license found in the
|
|
7270
|
+
* LICENSE file in the root directory of this source tree.
|
|
7271
|
+
*/
|
|
7272
|
+
var invariant_1;
|
|
7273
|
+
var hasRequiredInvariant;
|
|
7274
|
+
function requireInvariant() {
|
|
7275
|
+
if (hasRequiredInvariant) return invariant_1;
|
|
7276
|
+
hasRequiredInvariant = 1;
|
|
7277
|
+
|
|
7278
|
+
/**
|
|
7279
|
+
* Use invariant() to assert state which your program assumes to be true.
|
|
7280
|
+
*
|
|
7281
|
+
* Provide sprintf-style format (only %s is supported) and arguments
|
|
7282
|
+
* to provide information about what broke and what you were
|
|
7283
|
+
* expecting.
|
|
7284
|
+
*
|
|
7285
|
+
* The invariant message will be stripped in production, but the invariant
|
|
7286
|
+
* will remain to ensure logic does not differ in production.
|
|
7287
|
+
*/
|
|
7288
|
+
|
|
7289
|
+
var NODE_ENV = process.env.NODE_ENV;
|
|
7290
|
+
var invariant = function invariant(condition, format, a, b, c, d, e, f) {
|
|
7291
|
+
if (NODE_ENV !== 'production') {
|
|
7292
|
+
if (format === undefined) {
|
|
7293
|
+
throw new Error('invariant requires an error message argument');
|
|
7294
|
+
}
|
|
7206
7295
|
}
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
var
|
|
7213
|
-
|
|
7296
|
+
if (!condition) {
|
|
7297
|
+
var error;
|
|
7298
|
+
if (format === undefined) {
|
|
7299
|
+
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
7300
|
+
} else {
|
|
7301
|
+
var args = [a, b, c, d, e, f];
|
|
7302
|
+
var argIndex = 0;
|
|
7303
|
+
error = new Error(format.replace(/%s/g, function () {
|
|
7304
|
+
return args[argIndex++];
|
|
7305
|
+
}));
|
|
7306
|
+
error.name = 'Invariant Violation';
|
|
7214
7307
|
}
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7308
|
+
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
7309
|
+
throw error;
|
|
7310
|
+
}
|
|
7311
|
+
};
|
|
7312
|
+
invariant_1 = invariant;
|
|
7313
|
+
return invariant_1;
|
|
7314
|
+
}
|
|
7315
|
+
|
|
7316
|
+
/**
|
|
7317
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
7318
|
+
*
|
|
7319
|
+
* This source code is licensed under the MIT license found in the
|
|
7320
|
+
* LICENSE file in the root directory of this source tree.
|
|
7321
|
+
*/
|
|
7322
|
+
var warning_1;
|
|
7323
|
+
var hasRequiredWarning;
|
|
7324
|
+
function requireWarning() {
|
|
7325
|
+
if (hasRequiredWarning) return warning_1;
|
|
7326
|
+
hasRequiredWarning = 1;
|
|
7327
|
+
|
|
7328
|
+
/**
|
|
7329
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
7330
|
+
* This can be used to log issues in development environments in critical
|
|
7331
|
+
* paths. Removing the logging code for production environments will keep the
|
|
7332
|
+
* same logic and follow the same code paths.
|
|
7333
|
+
*/
|
|
7334
|
+
|
|
7335
|
+
var __DEV__ = process.env.NODE_ENV !== 'production';
|
|
7336
|
+
var warning = function warning() {};
|
|
7337
|
+
if (__DEV__) {
|
|
7338
|
+
var printWarning = function printWarning(format, args) {
|
|
7339
|
+
var len = arguments.length;
|
|
7340
|
+
args = new Array(len > 1 ? len - 1 : 0);
|
|
7341
|
+
for (var key = 1; key < len; key++) {
|
|
7342
|
+
args[key - 1] = arguments[key];
|
|
7343
|
+
}
|
|
7344
|
+
var argIndex = 0;
|
|
7345
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
7346
|
+
return args[argIndex++];
|
|
7347
|
+
});
|
|
7348
|
+
if (typeof console !== 'undefined') {
|
|
7349
|
+
console.error(message);
|
|
7350
|
+
}
|
|
7351
|
+
try {
|
|
7352
|
+
// --- Welcome to debugging React ---
|
|
7353
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
7354
|
+
// to find the callsite that caused this warning to fire.
|
|
7355
|
+
throw new Error(message);
|
|
7356
|
+
} catch (x) {}
|
|
7357
|
+
};
|
|
7358
|
+
warning = function warning(condition, format, args) {
|
|
7359
|
+
var len = arguments.length;
|
|
7360
|
+
args = new Array(len > 2 ? len - 2 : 0);
|
|
7361
|
+
for (var key = 2; key < len; key++) {
|
|
7362
|
+
args[key - 2] = arguments[key];
|
|
7363
|
+
}
|
|
7364
|
+
if (format === undefined) {
|
|
7365
|
+
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
7366
|
+
}
|
|
7367
|
+
if (!condition) {
|
|
7368
|
+
printWarning.apply(null, [format].concat(args));
|
|
7369
|
+
}
|
|
7370
|
+
};
|
|
7220
7371
|
}
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7372
|
+
warning_1 = warning;
|
|
7373
|
+
return warning_1;
|
|
7374
|
+
}
|
|
7375
|
+
|
|
7376
|
+
var reactInputMask_development;
|
|
7377
|
+
var hasRequiredReactInputMask_development;
|
|
7378
|
+
function requireReactInputMask_development() {
|
|
7379
|
+
if (hasRequiredReactInputMask_development) return reactInputMask_development;
|
|
7380
|
+
hasRequiredReactInputMask_development = 1;
|
|
7381
|
+
function _interopDefault(ex) {
|
|
7382
|
+
return ex && _typeof$1(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
|
|
7229
7383
|
}
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7384
|
+
var React$1 = _interopDefault(React);
|
|
7385
|
+
var reactDom = require$$1;
|
|
7386
|
+
var invariant = _interopDefault(requireInvariant());
|
|
7387
|
+
var warning = _interopDefault(requireWarning());
|
|
7388
|
+
function _defaults2(obj, defaults) {
|
|
7389
|
+
var keys = Object.getOwnPropertyNames(defaults);
|
|
7390
|
+
for (var i = 0; i < keys.length; i++) {
|
|
7391
|
+
var key = keys[i];
|
|
7392
|
+
var value = Object.getOwnPropertyDescriptor(defaults, key);
|
|
7393
|
+
if (value && value.configurable && obj[key] === undefined) {
|
|
7394
|
+
Object.defineProperty(obj, key, value);
|
|
7395
|
+
}
|
|
7396
|
+
}
|
|
7397
|
+
return obj;
|
|
7233
7398
|
}
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
}))).name = "Invariant Violation";
|
|
7399
|
+
function _extends() {
|
|
7400
|
+
_extends = Object.assign || function (target) {
|
|
7401
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
7402
|
+
var source = arguments[i];
|
|
7403
|
+
for (var key in source) {
|
|
7404
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
7405
|
+
target[key] = source[key];
|
|
7406
|
+
}
|
|
7243
7407
|
}
|
|
7244
|
-
throw l.framesToPop = 1, l;
|
|
7245
7408
|
}
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
if ("selectionStart" in e && "selectionEnd" in e) e.selectionStart = t, e.selectionEnd = n;else {
|
|
7250
|
-
var a = e.createTextRange();
|
|
7251
|
-
a.collapse(!0), a.moveStart("character", t), a.moveEnd("character", n - t), a.select();
|
|
7252
|
-
}
|
|
7409
|
+
return target;
|
|
7410
|
+
};
|
|
7411
|
+
return _extends.apply(this, arguments);
|
|
7253
7412
|
}
|
|
7254
|
-
function
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7413
|
+
function _inheritsLoose(subClass, superClass) {
|
|
7414
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
7415
|
+
subClass.prototype.constructor = subClass;
|
|
7416
|
+
_defaults2(subClass, superClass);
|
|
7417
|
+
}
|
|
7418
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
7419
|
+
if (source == null) return {};
|
|
7420
|
+
var target = {};
|
|
7421
|
+
var sourceKeys = Object.keys(source);
|
|
7422
|
+
var key, i;
|
|
7423
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
7424
|
+
key = sourceKeys[i];
|
|
7425
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
7426
|
+
target[key] = source[key];
|
|
7260
7427
|
}
|
|
7261
|
-
return
|
|
7262
|
-
start: t,
|
|
7263
|
-
end: n,
|
|
7264
|
-
length: n - t
|
|
7265
|
-
};
|
|
7428
|
+
return target;
|
|
7266
7429
|
}
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
function
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7430
|
+
function _assertThisInitialized(self) {
|
|
7431
|
+
if (self === void 0) {
|
|
7432
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
7433
|
+
}
|
|
7434
|
+
return self;
|
|
7435
|
+
}
|
|
7436
|
+
function setInputSelection(input, start, end) {
|
|
7437
|
+
if ('selectionStart' in input && 'selectionEnd' in input) {
|
|
7438
|
+
input.selectionStart = start;
|
|
7439
|
+
input.selectionEnd = end;
|
|
7440
|
+
} else {
|
|
7441
|
+
var range = input.createTextRange();
|
|
7442
|
+
range.collapse(true);
|
|
7443
|
+
range.moveStart('character', start);
|
|
7444
|
+
range.moveEnd('character', end - start);
|
|
7445
|
+
range.select();
|
|
7446
|
+
}
|
|
7447
|
+
}
|
|
7448
|
+
function getInputSelection(input) {
|
|
7449
|
+
var start = 0;
|
|
7450
|
+
var end = 0;
|
|
7451
|
+
if ('selectionStart' in input && 'selectionEnd' in input) {
|
|
7452
|
+
start = input.selectionStart;
|
|
7453
|
+
end = input.selectionEnd;
|
|
7454
|
+
} else {
|
|
7455
|
+
var range = document.selection.createRange();
|
|
7456
|
+
if (range.parentElement() === input) {
|
|
7457
|
+
start = -range.moveStart('character', -input.value.length);
|
|
7458
|
+
end = -range.moveEnd('character', -input.value.length);
|
|
7459
|
+
}
|
|
7460
|
+
}
|
|
7461
|
+
return {
|
|
7462
|
+
start: start,
|
|
7463
|
+
end: end,
|
|
7464
|
+
length: end - start
|
|
7285
7465
|
};
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7466
|
+
}
|
|
7467
|
+
var defaultFormatChars = {
|
|
7468
|
+
'9': '[0-9]',
|
|
7469
|
+
'a': '[A-Za-z]',
|
|
7470
|
+
'*': '[A-Za-z0-9]'
|
|
7471
|
+
};
|
|
7472
|
+
var defaultMaskChar = '_';
|
|
7473
|
+
function parseMask(mask, maskChar, formatChars) {
|
|
7474
|
+
var parsedMaskString = '';
|
|
7475
|
+
var prefix = '';
|
|
7476
|
+
var lastEditablePosition = null;
|
|
7477
|
+
var permanents = [];
|
|
7478
|
+
if (maskChar === undefined) {
|
|
7479
|
+
maskChar = defaultMaskChar;
|
|
7480
|
+
}
|
|
7481
|
+
if (formatChars == null) {
|
|
7482
|
+
formatChars = defaultFormatChars;
|
|
7483
|
+
}
|
|
7484
|
+
if (!mask || typeof mask !== 'string') {
|
|
7485
|
+
return {
|
|
7486
|
+
maskChar: maskChar,
|
|
7487
|
+
formatChars: formatChars,
|
|
7488
|
+
mask: null,
|
|
7489
|
+
prefix: null,
|
|
7490
|
+
lastEditablePosition: null,
|
|
7491
|
+
permanents: []
|
|
7492
|
+
};
|
|
7493
|
+
}
|
|
7494
|
+
var isPermanent = false;
|
|
7495
|
+
mask.split('').forEach(function (character) {
|
|
7496
|
+
if (!isPermanent && character === '\\') {
|
|
7497
|
+
isPermanent = true;
|
|
7498
|
+
} else {
|
|
7499
|
+
if (isPermanent || !formatChars[character]) {
|
|
7500
|
+
permanents.push(parsedMaskString.length);
|
|
7501
|
+
if (parsedMaskString.length === permanents.length - 1) {
|
|
7502
|
+
prefix += character;
|
|
7503
|
+
}
|
|
7504
|
+
} else {
|
|
7505
|
+
lastEditablePosition = parsedMaskString.length + 1;
|
|
7506
|
+
}
|
|
7507
|
+
parsedMaskString += character;
|
|
7508
|
+
isPermanent = false;
|
|
7509
|
+
}
|
|
7510
|
+
});
|
|
7511
|
+
return {
|
|
7512
|
+
maskChar: maskChar,
|
|
7513
|
+
formatChars: formatChars,
|
|
7514
|
+
prefix: prefix,
|
|
7515
|
+
mask: parsedMaskString,
|
|
7516
|
+
lastEditablePosition: lastEditablePosition,
|
|
7517
|
+
permanents: permanents
|
|
7296
7518
|
};
|
|
7297
7519
|
}
|
|
7298
|
-
|
|
7299
|
-
|
|
7520
|
+
|
|
7521
|
+
/* eslint no-use-before-define: ["error", { functions: false }] */
|
|
7522
|
+
function isPermanentCharacter(maskOptions, pos) {
|
|
7523
|
+
return maskOptions.permanents.indexOf(pos) !== -1;
|
|
7300
7524
|
}
|
|
7301
|
-
function isAllowedCharacter(
|
|
7302
|
-
var
|
|
7303
|
-
|
|
7304
|
-
if (!
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7525
|
+
function isAllowedCharacter(maskOptions, pos, character) {
|
|
7526
|
+
var mask = maskOptions.mask,
|
|
7527
|
+
formatChars = maskOptions.formatChars;
|
|
7528
|
+
if (!character) {
|
|
7529
|
+
return false;
|
|
7530
|
+
}
|
|
7531
|
+
if (isPermanentCharacter(maskOptions, pos)) {
|
|
7532
|
+
return mask[pos] === character;
|
|
7533
|
+
}
|
|
7534
|
+
var ruleChar = mask[pos];
|
|
7535
|
+
var charRule = formatChars[ruleChar];
|
|
7536
|
+
return new RegExp(charRule).test(character);
|
|
7308
7537
|
}
|
|
7309
|
-
function isEmpty(
|
|
7310
|
-
return
|
|
7311
|
-
return isPermanentCharacter(
|
|
7538
|
+
function isEmpty(maskOptions, value) {
|
|
7539
|
+
return value.split('').every(function (character, i) {
|
|
7540
|
+
return isPermanentCharacter(maskOptions, i) || !isAllowedCharacter(maskOptions, i, character);
|
|
7312
7541
|
});
|
|
7313
7542
|
}
|
|
7314
|
-
function getFilledLength(
|
|
7315
|
-
var
|
|
7316
|
-
|
|
7317
|
-
if (!
|
|
7318
|
-
|
|
7319
|
-
|
|
7543
|
+
function getFilledLength(maskOptions, value) {
|
|
7544
|
+
var maskChar = maskOptions.maskChar,
|
|
7545
|
+
prefix = maskOptions.prefix;
|
|
7546
|
+
if (!maskChar) {
|
|
7547
|
+
while (value.length > prefix.length && isPermanentCharacter(maskOptions, value.length - 1)) {
|
|
7548
|
+
value = value.slice(0, value.length - 1);
|
|
7549
|
+
}
|
|
7550
|
+
return value.length;
|
|
7320
7551
|
}
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7552
|
+
var filledLength = prefix.length;
|
|
7553
|
+
for (var i = value.length; i >= prefix.length; i--) {
|
|
7554
|
+
var character = value[i];
|
|
7555
|
+
var isEnteredCharacter = !isPermanentCharacter(maskOptions, i) && isAllowedCharacter(maskOptions, i, character);
|
|
7556
|
+
if (isEnteredCharacter) {
|
|
7557
|
+
filledLength = i + 1;
|
|
7325
7558
|
break;
|
|
7326
7559
|
}
|
|
7327
7560
|
}
|
|
7328
|
-
return
|
|
7561
|
+
return filledLength;
|
|
7329
7562
|
}
|
|
7330
|
-
function isFilled(
|
|
7331
|
-
return getFilledLength(
|
|
7563
|
+
function isFilled(maskOptions, value) {
|
|
7564
|
+
return getFilledLength(maskOptions, value) === maskOptions.mask.length;
|
|
7332
7565
|
}
|
|
7333
|
-
function formatValue(
|
|
7334
|
-
var
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
if (!
|
|
7338
|
-
|
|
7339
|
-
|
|
7566
|
+
function formatValue(maskOptions, value) {
|
|
7567
|
+
var maskChar = maskOptions.maskChar,
|
|
7568
|
+
mask = maskOptions.mask,
|
|
7569
|
+
prefix = maskOptions.prefix;
|
|
7570
|
+
if (!maskChar) {
|
|
7571
|
+
value = insertString(maskOptions, '', value, 0);
|
|
7572
|
+
if (value.length < prefix.length) {
|
|
7573
|
+
value = prefix;
|
|
7574
|
+
}
|
|
7575
|
+
while (value.length < mask.length && isPermanentCharacter(maskOptions, value.length)) {
|
|
7576
|
+
value += mask[value.length];
|
|
7577
|
+
}
|
|
7578
|
+
return value;
|
|
7340
7579
|
}
|
|
7341
|
-
if (
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
l = e.split("");
|
|
7351
|
-
if (r) return l.map(function (e, t) {
|
|
7352
|
-
return t < a || i <= t ? e : isPermanentCharacter(n, t) ? o[t] : r;
|
|
7353
|
-
}).join("");
|
|
7354
|
-
for (var u = i; u < l.length; u++) isPermanentCharacter(n, u) && (l[u] = "");
|
|
7355
|
-
return a = Math.max(s.length, a), l.splice(a, i - a), e = l.join(""), formatValue(n, e);
|
|
7356
|
-
}
|
|
7357
|
-
function insertString(r, o, e, s) {
|
|
7358
|
-
var l = r.mask,
|
|
7359
|
-
u = r.maskChar,
|
|
7360
|
-
c = r.prefix,
|
|
7361
|
-
t = e.split(""),
|
|
7362
|
-
h = isFilled(r, o);
|
|
7363
|
-
return !u && s > o.length && (o += l.slice(o.length, s)), t.every(function (e) {
|
|
7364
|
-
for (; i = e, isPermanentCharacter(r, a = s) && i !== l[a];) {
|
|
7365
|
-
if (s >= o.length && (o += l[s]), t = e, n = s, u && isPermanentCharacter(r, n) && t === u) return !0;
|
|
7366
|
-
if (++s >= l.length) return !1;
|
|
7580
|
+
if (value) {
|
|
7581
|
+
var emptyValue = formatValue(maskOptions, '');
|
|
7582
|
+
return insertString(maskOptions, emptyValue, value, 0);
|
|
7583
|
+
}
|
|
7584
|
+
for (var i = 0; i < mask.length; i++) {
|
|
7585
|
+
if (isPermanentCharacter(maskOptions, i)) {
|
|
7586
|
+
value += mask[i];
|
|
7587
|
+
} else {
|
|
7588
|
+
value += maskChar;
|
|
7367
7589
|
}
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
}), o;
|
|
7371
|
-
}
|
|
7372
|
-
function getInsertStringLength(a, e, t, i) {
|
|
7373
|
-
var r = a.mask,
|
|
7374
|
-
o = a.maskChar,
|
|
7375
|
-
n = t.split(""),
|
|
7376
|
-
s = i;
|
|
7377
|
-
return n.every(function (e) {
|
|
7378
|
-
for (; n = e, isPermanentCharacter(a, t = i) && n !== r[t];) if (++i >= r.length) return !1;
|
|
7379
|
-
var t, n;
|
|
7380
|
-
return (isAllowedCharacter(a, i, e) || e === o) && i++, i < r.length;
|
|
7381
|
-
}), i - s;
|
|
7382
|
-
}
|
|
7383
|
-
function getLeftEditablePosition(e, t) {
|
|
7384
|
-
for (var n = t; 0 <= n; --n) if (!isPermanentCharacter(e, n)) return n;
|
|
7385
|
-
return null;
|
|
7386
|
-
}
|
|
7387
|
-
function getRightEditablePosition(e, t) {
|
|
7388
|
-
for (var n = e.mask, a = t; a < n.length; ++a) if (!isPermanentCharacter(e, a)) return a;
|
|
7389
|
-
return null;
|
|
7390
|
-
}
|
|
7391
|
-
function getStringValue(e) {
|
|
7392
|
-
return e || 0 === e ? e + "" : "";
|
|
7590
|
+
}
|
|
7591
|
+
return value;
|
|
7393
7592
|
}
|
|
7394
|
-
function
|
|
7395
|
-
var
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7593
|
+
function clearRange(maskOptions, value, start, len) {
|
|
7594
|
+
var end = start + len;
|
|
7595
|
+
var maskChar = maskOptions.maskChar,
|
|
7596
|
+
mask = maskOptions.mask,
|
|
7597
|
+
prefix = maskOptions.prefix;
|
|
7598
|
+
var arrayValue = value.split('');
|
|
7599
|
+
if (!maskChar) {
|
|
7600
|
+
// remove any permanent chars after clear range, they will be added back by formatValue
|
|
7601
|
+
for (var i = end; i < arrayValue.length; i++) {
|
|
7602
|
+
if (isPermanentCharacter(maskOptions, i)) {
|
|
7603
|
+
arrayValue[i] = '';
|
|
7604
|
+
}
|
|
7605
|
+
}
|
|
7606
|
+
start = Math.max(prefix.length, start);
|
|
7607
|
+
arrayValue.splice(start, end - start);
|
|
7608
|
+
value = arrayValue.join('');
|
|
7609
|
+
return formatValue(maskOptions, value);
|
|
7406
7610
|
}
|
|
7407
|
-
return
|
|
7408
|
-
|
|
7409
|
-
|
|
7611
|
+
return arrayValue.map(function (character, i) {
|
|
7612
|
+
if (i < start || i >= end) {
|
|
7613
|
+
return character;
|
|
7614
|
+
}
|
|
7615
|
+
if (isPermanentCharacter(maskOptions, i)) {
|
|
7616
|
+
return mask[i];
|
|
7617
|
+
}
|
|
7618
|
+
return maskChar;
|
|
7619
|
+
}).join('');
|
|
7620
|
+
}
|
|
7621
|
+
function insertString(maskOptions, value, insertStr, insertPosition) {
|
|
7622
|
+
var mask = maskOptions.mask,
|
|
7623
|
+
maskChar = maskOptions.maskChar,
|
|
7624
|
+
prefix = maskOptions.prefix;
|
|
7625
|
+
var arrayInsertStr = insertStr.split('');
|
|
7626
|
+
var isInputFilled = isFilled(maskOptions, value);
|
|
7627
|
+
var isUsablePosition = function isUsablePosition(pos, character) {
|
|
7628
|
+
return !isPermanentCharacter(maskOptions, pos) || character === mask[pos];
|
|
7629
|
+
};
|
|
7630
|
+
var isUsableCharacter = function isUsableCharacter(character, pos) {
|
|
7631
|
+
return !maskChar || !isPermanentCharacter(maskOptions, pos) || character !== maskChar;
|
|
7632
|
+
};
|
|
7633
|
+
if (!maskChar && insertPosition > value.length) {
|
|
7634
|
+
value += mask.slice(value.length, insertPosition);
|
|
7635
|
+
}
|
|
7636
|
+
arrayInsertStr.every(function (insertCharacter) {
|
|
7637
|
+
while (!isUsablePosition(insertPosition, insertCharacter)) {
|
|
7638
|
+
if (insertPosition >= value.length) {
|
|
7639
|
+
value += mask[insertPosition];
|
|
7640
|
+
}
|
|
7641
|
+
if (!isUsableCharacter(insertCharacter, insertPosition)) {
|
|
7642
|
+
return true;
|
|
7643
|
+
}
|
|
7644
|
+
insertPosition++; // stop iteration if maximum value length reached
|
|
7645
|
+
|
|
7646
|
+
if (insertPosition >= mask.length) {
|
|
7647
|
+
return false;
|
|
7648
|
+
}
|
|
7649
|
+
}
|
|
7650
|
+
var isAllowed = isAllowedCharacter(maskOptions, insertPosition, insertCharacter) || insertCharacter === maskChar;
|
|
7651
|
+
if (!isAllowed) {
|
|
7652
|
+
return true;
|
|
7653
|
+
}
|
|
7654
|
+
if (insertPosition < value.length) {
|
|
7655
|
+
if (maskChar || isInputFilled || insertPosition < prefix.length) {
|
|
7656
|
+
value = value.slice(0, insertPosition) + insertCharacter + value.slice(insertPosition + 1);
|
|
7657
|
+
} else {
|
|
7658
|
+
value = value.slice(0, insertPosition) + insertCharacter + value.slice(insertPosition);
|
|
7659
|
+
value = formatValue(maskOptions, value);
|
|
7660
|
+
}
|
|
7661
|
+
} else if (!maskChar) {
|
|
7662
|
+
value += insertCharacter;
|
|
7663
|
+
}
|
|
7664
|
+
insertPosition++; // stop iteration if maximum value length reached
|
|
7665
|
+
|
|
7666
|
+
return insertPosition < mask.length;
|
|
7667
|
+
});
|
|
7668
|
+
return value;
|
|
7669
|
+
}
|
|
7670
|
+
function getInsertStringLength(maskOptions, value, insertStr, insertPosition) {
|
|
7671
|
+
var mask = maskOptions.mask,
|
|
7672
|
+
maskChar = maskOptions.maskChar;
|
|
7673
|
+
var arrayInsertStr = insertStr.split('');
|
|
7674
|
+
var initialInsertPosition = insertPosition;
|
|
7675
|
+
var isUsablePosition = function isUsablePosition(pos, character) {
|
|
7676
|
+
return !isPermanentCharacter(maskOptions, pos) || character === mask[pos];
|
|
7677
|
+
};
|
|
7678
|
+
arrayInsertStr.every(function (insertCharacter) {
|
|
7679
|
+
while (!isUsablePosition(insertPosition, insertCharacter)) {
|
|
7680
|
+
insertPosition++; // stop iteration if maximum value length reached
|
|
7681
|
+
|
|
7682
|
+
if (insertPosition >= mask.length) {
|
|
7683
|
+
return false;
|
|
7684
|
+
}
|
|
7685
|
+
}
|
|
7686
|
+
var isAllowed = isAllowedCharacter(maskOptions, insertPosition, insertCharacter) || insertCharacter === maskChar;
|
|
7687
|
+
if (isAllowed) {
|
|
7688
|
+
insertPosition++;
|
|
7689
|
+
} // stop iteration if maximum value length reached
|
|
7690
|
+
|
|
7691
|
+
return insertPosition < mask.length;
|
|
7692
|
+
});
|
|
7693
|
+
return insertPosition - initialInsertPosition;
|
|
7694
|
+
}
|
|
7695
|
+
function getLeftEditablePosition(maskOptions, pos) {
|
|
7696
|
+
for (var i = pos; i >= 0; --i) {
|
|
7697
|
+
if (!isPermanentCharacter(maskOptions, i)) {
|
|
7698
|
+
return i;
|
|
7699
|
+
}
|
|
7700
|
+
}
|
|
7701
|
+
return null;
|
|
7702
|
+
}
|
|
7703
|
+
function getRightEditablePosition(maskOptions, pos) {
|
|
7704
|
+
var mask = maskOptions.mask;
|
|
7705
|
+
for (var i = pos; i < mask.length; ++i) {
|
|
7706
|
+
if (!isPermanentCharacter(maskOptions, i)) {
|
|
7707
|
+
return i;
|
|
7708
|
+
}
|
|
7709
|
+
}
|
|
7710
|
+
return null;
|
|
7711
|
+
}
|
|
7712
|
+
function getStringValue(value) {
|
|
7713
|
+
return !value && value !== 0 ? '' : value + '';
|
|
7714
|
+
}
|
|
7715
|
+
function processChange(maskOptions, value, selection, previousValue, previousSelection) {
|
|
7716
|
+
var mask = maskOptions.mask,
|
|
7717
|
+
prefix = maskOptions.prefix,
|
|
7718
|
+
lastEditablePosition = maskOptions.lastEditablePosition;
|
|
7719
|
+
var newValue = value;
|
|
7720
|
+
var enteredString = '';
|
|
7721
|
+
var formattedEnteredStringLength = 0;
|
|
7722
|
+
var removedLength = 0;
|
|
7723
|
+
var cursorPosition = Math.min(previousSelection.start, selection.start);
|
|
7724
|
+
if (selection.end > previousSelection.start) {
|
|
7725
|
+
enteredString = newValue.slice(previousSelection.start, selection.end);
|
|
7726
|
+
formattedEnteredStringLength = getInsertStringLength(maskOptions, previousValue, enteredString, cursorPosition);
|
|
7727
|
+
if (!formattedEnteredStringLength) {
|
|
7728
|
+
removedLength = 0;
|
|
7729
|
+
} else {
|
|
7730
|
+
removedLength = previousSelection.length;
|
|
7731
|
+
}
|
|
7732
|
+
} else if (newValue.length < previousValue.length) {
|
|
7733
|
+
removedLength = previousValue.length - newValue.length;
|
|
7734
|
+
}
|
|
7735
|
+
newValue = previousValue;
|
|
7736
|
+
if (removedLength) {
|
|
7737
|
+
if (removedLength === 1 && !previousSelection.length) {
|
|
7738
|
+
var deleteFromRight = previousSelection.start === selection.start;
|
|
7739
|
+
cursorPosition = deleteFromRight ? getRightEditablePosition(maskOptions, selection.start) : getLeftEditablePosition(maskOptions, selection.start);
|
|
7740
|
+
}
|
|
7741
|
+
newValue = clearRange(maskOptions, newValue, cursorPosition, removedLength);
|
|
7742
|
+
}
|
|
7743
|
+
newValue = insertString(maskOptions, newValue, enteredString, cursorPosition);
|
|
7744
|
+
cursorPosition = cursorPosition + formattedEnteredStringLength;
|
|
7745
|
+
if (cursorPosition >= mask.length) {
|
|
7746
|
+
cursorPosition = mask.length;
|
|
7747
|
+
} else if (cursorPosition < prefix.length && !formattedEnteredStringLength) {
|
|
7748
|
+
cursorPosition = prefix.length;
|
|
7749
|
+
} else if (cursorPosition >= prefix.length && cursorPosition < lastEditablePosition && formattedEnteredStringLength) {
|
|
7750
|
+
cursorPosition = getRightEditablePosition(maskOptions, cursorPosition);
|
|
7751
|
+
}
|
|
7752
|
+
newValue = formatValue(maskOptions, newValue);
|
|
7753
|
+
if (!enteredString) {
|
|
7754
|
+
enteredString = null;
|
|
7755
|
+
}
|
|
7756
|
+
return {
|
|
7757
|
+
value: newValue,
|
|
7758
|
+
enteredString: enteredString,
|
|
7410
7759
|
selection: {
|
|
7411
|
-
start:
|
|
7412
|
-
end:
|
|
7760
|
+
start: cursorPosition,
|
|
7761
|
+
end: cursorPosition
|
|
7413
7762
|
}
|
|
7414
7763
|
};
|
|
7415
7764
|
}
|
|
7416
7765
|
function isWindowsPhoneBrowser() {
|
|
7417
|
-
var
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
return
|
|
7766
|
+
var windows = new RegExp('windows', 'i');
|
|
7767
|
+
var phone = new RegExp('phone', 'i');
|
|
7768
|
+
var ua = navigator.userAgent;
|
|
7769
|
+
return windows.test(ua) && phone.test(ua);
|
|
7421
7770
|
}
|
|
7422
|
-
function isFunction(
|
|
7423
|
-
return
|
|
7771
|
+
function isFunction(value) {
|
|
7772
|
+
return typeof value === 'function';
|
|
7424
7773
|
}
|
|
7425
7774
|
function getRequestAnimationFrame() {
|
|
7426
7775
|
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
|
|
@@ -7428,964 +7777,179 @@ function requireReactInputMask_production_min() {
|
|
|
7428
7777
|
function getCancelAnimationFrame() {
|
|
7429
7778
|
return window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame;
|
|
7430
7779
|
}
|
|
7431
|
-
function defer(
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7780
|
+
function defer(fn) {
|
|
7781
|
+
var hasCancelAnimationFrame = !!getCancelAnimationFrame();
|
|
7782
|
+
var deferFn;
|
|
7783
|
+
if (hasCancelAnimationFrame) {
|
|
7784
|
+
deferFn = getRequestAnimationFrame();
|
|
7785
|
+
} else {
|
|
7786
|
+
deferFn = function deferFn() {
|
|
7787
|
+
return setTimeout(fn, 1000 / 60);
|
|
7788
|
+
};
|
|
7789
|
+
}
|
|
7790
|
+
return deferFn(fn);
|
|
7435
7791
|
}
|
|
7436
|
-
function cancelDefer(
|
|
7437
|
-
|
|
7792
|
+
function cancelDefer(deferId) {
|
|
7793
|
+
var cancelFn = getCancelAnimationFrame() || clearTimeout;
|
|
7794
|
+
cancelFn(deferId);
|
|
7438
7795
|
}
|
|
7439
|
-
var InputElement =
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
return e ? e.value : null;
|
|
7458
|
-
}, f.setInputValue = function (e) {
|
|
7459
|
-
var t = f.getInputDOMNode();
|
|
7460
|
-
t && (f.value = e, t.value = e);
|
|
7461
|
-
}, f.setCursorToEnd = function () {
|
|
7462
|
-
var e = getFilledLength(f.maskOptions, f.value),
|
|
7463
|
-
t = getRightEditablePosition(f.maskOptions, e);
|
|
7464
|
-
null !== t && f.setCursorPosition(t);
|
|
7465
|
-
}, f.setSelection = function (e, t, n) {
|
|
7466
|
-
void 0 === n && (n = {});
|
|
7467
|
-
var a = f.getInputDOMNode(),
|
|
7468
|
-
i = f.isFocused();
|
|
7469
|
-
a && i && (n.deferred || setInputSelection(a, e, t), null !== f.selectionDeferId && cancelDefer(f.selectionDeferId), f.selectionDeferId = defer(function () {
|
|
7470
|
-
f.selectionDeferId = null, setInputSelection(a, e, t);
|
|
7471
|
-
}), f.previousSelection = {
|
|
7472
|
-
start: e,
|
|
7473
|
-
end: t,
|
|
7474
|
-
length: Math.abs(t - e)
|
|
7475
|
-
});
|
|
7476
|
-
}, f.getSelection = function () {
|
|
7477
|
-
return getInputSelection(f.getInputDOMNode());
|
|
7478
|
-
}, f.getCursorPosition = function () {
|
|
7479
|
-
return f.getSelection().start;
|
|
7480
|
-
}, f.setCursorPosition = function (e) {
|
|
7481
|
-
f.setSelection(e, e);
|
|
7482
|
-
}, f.isFocused = function () {
|
|
7483
|
-
return f.focused;
|
|
7484
|
-
}, f.getBeforeMaskedValueChangeConfig = function () {
|
|
7485
|
-
var e = f.maskOptions,
|
|
7486
|
-
t = e.mask,
|
|
7487
|
-
n = e.maskChar,
|
|
7488
|
-
a = e.permanents,
|
|
7489
|
-
i = e.formatChars;
|
|
7490
|
-
return {
|
|
7491
|
-
mask: t,
|
|
7492
|
-
maskChar: n,
|
|
7493
|
-
permanents: a,
|
|
7494
|
-
alwaysShowMask: !!f.props.alwaysShowMask,
|
|
7495
|
-
formatChars: i
|
|
7496
|
-
};
|
|
7497
|
-
}, f.isInputAutofilled = function (e, t, n, a) {
|
|
7498
|
-
var i = f.getInputDOMNode();
|
|
7499
|
-
try {
|
|
7500
|
-
if (i.matches(":-webkit-autofill")) return !0;
|
|
7501
|
-
} catch (r) {}
|
|
7502
|
-
return !f.focused || a.end < n.length && t.end === e.length;
|
|
7503
|
-
}, f.onChange = function (e) {
|
|
7504
|
-
var t = _assertThisInitialized(_assertThisInitialized(f)).beforePasteState,
|
|
7505
|
-
n = _assertThisInitialized(_assertThisInitialized(f)).previousSelection,
|
|
7506
|
-
a = f.props.beforeMaskedValueChange,
|
|
7507
|
-
i = f.getInputValue(),
|
|
7508
|
-
r = f.value,
|
|
7509
|
-
o = f.getSelection();
|
|
7510
|
-
f.isInputAutofilled(i, o, r, n) && (r = formatValue(f.maskOptions, ""), n = {
|
|
7511
|
-
start: 0,
|
|
7512
|
-
end: 0,
|
|
7513
|
-
length: 0
|
|
7514
|
-
}), t && (n = t.selection, r = t.value, o = {
|
|
7515
|
-
start: n.start + i.length,
|
|
7516
|
-
end: n.start + i.length,
|
|
7517
|
-
length: 0
|
|
7518
|
-
}, i = r.slice(0, n.start) + i + r.slice(n.end), f.beforePasteState = null);
|
|
7519
|
-
var s = processChange(f.maskOptions, i, o, r, n),
|
|
7520
|
-
l = s.enteredString,
|
|
7521
|
-
u = s.selection,
|
|
7522
|
-
c = s.value;
|
|
7523
|
-
if (isFunction(a)) {
|
|
7524
|
-
var h = a({
|
|
7525
|
-
value: c,
|
|
7526
|
-
selection: u
|
|
7527
|
-
}, {
|
|
7528
|
-
value: r,
|
|
7529
|
-
selection: n
|
|
7530
|
-
}, l, f.getBeforeMaskedValueChangeConfig());
|
|
7531
|
-
c = h.value, u = h.selection;
|
|
7796
|
+
var InputElement = /*#__PURE__*/
|
|
7797
|
+
function (_React$Component) {
|
|
7798
|
+
_inheritsLoose(InputElement, _React$Component);
|
|
7799
|
+
function InputElement(props) {
|
|
7800
|
+
var _this;
|
|
7801
|
+
_this = _React$Component.call(this, props) || this;
|
|
7802
|
+
_this.focused = false;
|
|
7803
|
+
_this.mounted = false;
|
|
7804
|
+
_this.previousSelection = null;
|
|
7805
|
+
_this.selectionDeferId = null;
|
|
7806
|
+
_this.saveSelectionLoopDeferId = null;
|
|
7807
|
+
_this.saveSelectionLoop = function () {
|
|
7808
|
+
_this.previousSelection = _this.getSelection();
|
|
7809
|
+
_this.saveSelectionLoopDeferId = defer(_this.saveSelectionLoop);
|
|
7810
|
+
};
|
|
7811
|
+
_this.runSaveSelectionLoop = function () {
|
|
7812
|
+
if (_this.saveSelectionLoopDeferId === null) {
|
|
7813
|
+
_this.saveSelectionLoop();
|
|
7532
7814
|
}
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
|
|
7539
|
-
a = n.mask,
|
|
7540
|
-
i = n.prefix;
|
|
7541
|
-
if (f.focused = !0, f.mounted = !0, a) {
|
|
7542
|
-
if (f.value) getFilledLength(f.maskOptions, f.value) < f.maskOptions.mask.length && f.setCursorToEnd();else {
|
|
7543
|
-
var r = formatValue(f.maskOptions, i),
|
|
7544
|
-
o = formatValue(f.maskOptions, r),
|
|
7545
|
-
s = getFilledLength(f.maskOptions, o),
|
|
7546
|
-
l = getRightEditablePosition(f.maskOptions, s),
|
|
7547
|
-
u = {
|
|
7548
|
-
start: l,
|
|
7549
|
-
end: l
|
|
7550
|
-
};
|
|
7551
|
-
if (isFunction(t)) {
|
|
7552
|
-
var c = t({
|
|
7553
|
-
value: o,
|
|
7554
|
-
selection: u
|
|
7555
|
-
}, {
|
|
7556
|
-
value: f.value,
|
|
7557
|
-
selection: null
|
|
7558
|
-
}, null, f.getBeforeMaskedValueChangeConfig());
|
|
7559
|
-
o = c.value, u = c.selection;
|
|
7560
|
-
}
|
|
7561
|
-
var h = o !== f.getInputValue();
|
|
7562
|
-
h && f.setInputValue(o), h && isFunction(f.props.onChange) && f.props.onChange(e), f.setSelection(u.start, u.end);
|
|
7563
|
-
}
|
|
7564
|
-
f.runSaveSelectionLoop();
|
|
7815
|
+
};
|
|
7816
|
+
_this.stopSaveSelectionLoop = function () {
|
|
7817
|
+
if (_this.saveSelectionLoopDeferId !== null) {
|
|
7818
|
+
cancelDefer(_this.saveSelectionLoopDeferId);
|
|
7819
|
+
_this.saveSelectionLoopDeferId = null;
|
|
7820
|
+
_this.previousSelection = null;
|
|
7565
7821
|
}
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
if (f.stopSaveSelectionLoop(), f.focused = !1, n && !f.props.alwaysShowMask && isEmpty(f.maskOptions, f.value)) {
|
|
7571
|
-
var a = "";
|
|
7572
|
-
if (isFunction(t)) a = t({
|
|
7573
|
-
value: a,
|
|
7574
|
-
selection: null
|
|
7575
|
-
}, {
|
|
7576
|
-
value: f.value,
|
|
7577
|
-
selection: f.previousSelection
|
|
7578
|
-
}, null, f.getBeforeMaskedValueChangeConfig()).value;
|
|
7579
|
-
var i = a !== f.getInputValue();
|
|
7580
|
-
i && f.setInputValue(a), i && isFunction(f.props.onChange) && f.props.onChange(e);
|
|
7822
|
+
};
|
|
7823
|
+
_this.getInputDOMNode = function () {
|
|
7824
|
+
if (!_this.mounted) {
|
|
7825
|
+
return null;
|
|
7581
7826
|
}
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
var t = Math.abs(e.clientX - f.mouseDownX),
|
|
7589
|
-
n = Math.abs(e.clientY - f.mouseDownY),
|
|
7590
|
-
a = Math.max(t, n),
|
|
7591
|
-
i = new Date().getTime() - f.mouseDownTime;
|
|
7592
|
-
(a <= 10 && i <= 200 || a <= 5 && i <= 300) && f.setCursorToEnd();
|
|
7593
|
-
}
|
|
7594
|
-
};
|
|
7595
|
-
document.addEventListener("mouseup", r);
|
|
7827
|
+
var input = reactDom.findDOMNode(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
7828
|
+
var isDOMNode = typeof window !== 'undefined' && input instanceof window.Element; // workaround for react-test-renderer
|
|
7829
|
+
// https://github.com/sanniassin/react-input-mask/issues/147
|
|
7830
|
+
|
|
7831
|
+
if (input && !isDOMNode) {
|
|
7832
|
+
return null;
|
|
7596
7833
|
}
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
isFunction(f.props.onPaste) && f.props.onPaste(e), e.defaultPrevented || (f.beforePasteState = {
|
|
7600
|
-
value: f.getInputValue(),
|
|
7601
|
-
selection: f.getSelection()
|
|
7602
|
-
}, f.setInputValue(""));
|
|
7603
|
-
}, f.handleRef = function (e) {
|
|
7604
|
-
null == f.props.children && isFunction(f.props.inputRef) && f.props.inputRef(e);
|
|
7605
|
-
};
|
|
7606
|
-
var t = e.mask,
|
|
7607
|
-
n = e.maskChar,
|
|
7608
|
-
a = e.formatChars,
|
|
7609
|
-
i = e.alwaysShowMask,
|
|
7610
|
-
r = e.beforeMaskedValueChange,
|
|
7611
|
-
o = e.defaultValue,
|
|
7612
|
-
s = e.value;
|
|
7613
|
-
f.maskOptions = parseMask(t, n, a), null == o && (o = ""), null == s && (s = o);
|
|
7614
|
-
var l = getStringValue(s);
|
|
7615
|
-
if (f.maskOptions.mask && (i || l) && (l = formatValue(f.maskOptions, l), isFunction(r))) {
|
|
7616
|
-
var u = e.value;
|
|
7617
|
-
null == e.value && (u = o), l = r({
|
|
7618
|
-
value: l,
|
|
7619
|
-
selection: null
|
|
7620
|
-
}, {
|
|
7621
|
-
value: u = getStringValue(u),
|
|
7622
|
-
selection: null
|
|
7623
|
-
}, null, f.getBeforeMaskedValueChangeConfig()).value;
|
|
7624
|
-
}
|
|
7625
|
-
return f.value = l, f;
|
|
7626
|
-
}
|
|
7627
|
-
_inheritsLoose(e, c);
|
|
7628
|
-
var t = e.prototype;
|
|
7629
|
-
return t.componentDidMount = function () {
|
|
7630
|
-
this.mounted = !0, this.getInputDOMNode() && (this.isWindowsPhoneBrowser = isWindowsPhoneBrowser(), this.maskOptions.mask && this.getInputValue() !== this.value && this.setInputValue(this.value));
|
|
7631
|
-
}, t.componentDidUpdate = function () {
|
|
7632
|
-
var e = this.previousSelection,
|
|
7633
|
-
t = this.props,
|
|
7634
|
-
n = t.beforeMaskedValueChange,
|
|
7635
|
-
a = t.alwaysShowMask,
|
|
7636
|
-
i = t.mask,
|
|
7637
|
-
r = t.maskChar,
|
|
7638
|
-
o = t.formatChars,
|
|
7639
|
-
s = this.maskOptions,
|
|
7640
|
-
l = a || this.isFocused(),
|
|
7641
|
-
u = null != this.props.value,
|
|
7642
|
-
c = u ? getStringValue(this.props.value) : this.value,
|
|
7643
|
-
h = e ? e.start : null;
|
|
7644
|
-
if (this.maskOptions = parseMask(i, r, o), this.maskOptions.mask) {
|
|
7645
|
-
!s.mask && this.isFocused() && this.runSaveSelectionLoop();
|
|
7646
|
-
var f = this.maskOptions.mask && this.maskOptions.mask !== s.mask;
|
|
7647
|
-
if (s.mask || u || (c = this.getInputValue()), (f || this.maskOptions.mask && (c || l)) && (c = formatValue(this.maskOptions, c)), f) {
|
|
7648
|
-
var p = getFilledLength(this.maskOptions, c);
|
|
7649
|
-
(null === h || p < h) && (h = isFilled(this.maskOptions, c) ? p : getRightEditablePosition(this.maskOptions, p));
|
|
7834
|
+
if (input.nodeName !== 'INPUT') {
|
|
7835
|
+
input = input.querySelector('input');
|
|
7650
7836
|
}
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
start: h,
|
|
7654
|
-
end: h
|
|
7655
|
-
};
|
|
7656
|
-
if (isFunction(n)) {
|
|
7657
|
-
var m = n({
|
|
7658
|
-
value: c,
|
|
7659
|
-
selection: d
|
|
7660
|
-
}, {
|
|
7661
|
-
value: this.value,
|
|
7662
|
-
selection: this.previousSelection
|
|
7663
|
-
}, null, this.getBeforeMaskedValueChangeConfig());
|
|
7664
|
-
c = m.value, d = m.selection;
|
|
7837
|
+
if (!input) {
|
|
7838
|
+
throw new Error('react-input-mask: inputComponent doesn\'t contain input node');
|
|
7665
7839
|
}
|
|
7666
|
-
|
|
7667
|
-
var g = this.getInputValue() !== this.value;
|
|
7668
|
-
g ? (this.setInputValue(this.value), this.forceUpdate()) : f && this.forceUpdate();
|
|
7669
|
-
var v = !1;
|
|
7670
|
-
null != d.start && null != d.end && (v = !e || e.start !== d.start || e.end !== d.end), (v || g) && this.setSelection(d.start, d.end);
|
|
7671
|
-
} else s.mask && (this.stopSaveSelectionLoop(), this.forceUpdate());
|
|
7672
|
-
}, t.componentWillUnmount = function () {
|
|
7673
|
-
this.mounted = !1, null !== this.selectionDeferId && cancelDefer(this.selectionDeferId), this.stopSaveSelectionLoop();
|
|
7674
|
-
}, t.render = function () {
|
|
7675
|
-
var t,
|
|
7676
|
-
e = this.props,
|
|
7677
|
-
n = (e.mask, e.alwaysShowMask, e.maskChar, e.formatChars, e.inputRef, e.beforeMaskedValueChange, e.children),
|
|
7678
|
-
a = _objectWithoutPropertiesLoose(e, ["mask", "alwaysShowMask", "maskChar", "formatChars", "inputRef", "beforeMaskedValueChange", "children"]);
|
|
7679
|
-
if (n) {
|
|
7680
|
-
isFunction(n) || invariant_1(!1);
|
|
7681
|
-
var i = ["onChange", "onPaste", "onMouseDown", "onFocus", "onBlur", "value", "disabled", "readOnly"],
|
|
7682
|
-
r = _extends({}, a);
|
|
7683
|
-
i.forEach(function (e) {
|
|
7684
|
-
return delete r[e];
|
|
7685
|
-
}), t = n(r), i.filter(function (e) {
|
|
7686
|
-
return null != t.props[e] && t.props[e] !== a[e];
|
|
7687
|
-
}).length && invariant_1(!1);
|
|
7688
|
-
} else t = React$1.createElement("input", _extends({
|
|
7689
|
-
ref: this.handleRef
|
|
7690
|
-
}, a));
|
|
7691
|
-
var o = {
|
|
7692
|
-
onFocus: this.onFocus,
|
|
7693
|
-
onBlur: this.onBlur
|
|
7840
|
+
return input;
|
|
7694
7841
|
};
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
function
|
|
7711
|
-
|
|
7712
|
-
|
|
7842
|
+
_this.getInputValue = function () {
|
|
7843
|
+
var input = _this.getInputDOMNode();
|
|
7844
|
+
if (!input) {
|
|
7845
|
+
return null;
|
|
7846
|
+
}
|
|
7847
|
+
return input.value;
|
|
7848
|
+
};
|
|
7849
|
+
_this.setInputValue = function (value) {
|
|
7850
|
+
var input = _this.getInputDOMNode();
|
|
7851
|
+
if (!input) {
|
|
7852
|
+
return;
|
|
7853
|
+
}
|
|
7854
|
+
_this.value = value;
|
|
7855
|
+
input.value = value;
|
|
7856
|
+
};
|
|
7857
|
+
_this.setCursorToEnd = function () {
|
|
7858
|
+
var filledLength = getFilledLength(_this.maskOptions, _this.value);
|
|
7859
|
+
var pos = getRightEditablePosition(_this.maskOptions, filledLength);
|
|
7860
|
+
if (pos !== null) {
|
|
7861
|
+
_this.setCursorPosition(pos);
|
|
7862
|
+
}
|
|
7863
|
+
};
|
|
7864
|
+
_this.setSelection = function (start, end, options) {
|
|
7865
|
+
if (options === void 0) {
|
|
7866
|
+
options = {};
|
|
7867
|
+
}
|
|
7868
|
+
var input = _this.getInputDOMNode();
|
|
7869
|
+
var isFocused = _this.isFocused(); // don't change selection on unfocused input
|
|
7870
|
+
// because Safari sets focus on selection change (#154)
|
|
7713
7871
|
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7872
|
+
if (!input || !isFocused) {
|
|
7873
|
+
return;
|
|
7874
|
+
}
|
|
7875
|
+
var _options = options,
|
|
7876
|
+
deferred = _options.deferred;
|
|
7877
|
+
if (!deferred) {
|
|
7878
|
+
setInputSelection(input, start, end);
|
|
7879
|
+
}
|
|
7880
|
+
if (_this.selectionDeferId !== null) {
|
|
7881
|
+
cancelDefer(_this.selectionDeferId);
|
|
7882
|
+
} // deferred selection update is required for pre-Lollipop Android browser,
|
|
7883
|
+
// but for consistent behavior we do it for all browsers
|
|
7724
7884
|
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7885
|
+
_this.selectionDeferId = defer(function () {
|
|
7886
|
+
_this.selectionDeferId = null;
|
|
7887
|
+
setInputSelection(input, start, end);
|
|
7888
|
+
});
|
|
7889
|
+
_this.previousSelection = {
|
|
7890
|
+
start: start,
|
|
7891
|
+
end: end,
|
|
7892
|
+
length: Math.abs(end - start)
|
|
7893
|
+
};
|
|
7894
|
+
};
|
|
7895
|
+
_this.getSelection = function () {
|
|
7896
|
+
var input = _this.getInputDOMNode();
|
|
7897
|
+
return getInputSelection(input);
|
|
7898
|
+
};
|
|
7899
|
+
_this.getCursorPosition = function () {
|
|
7900
|
+
return _this.getSelection().start;
|
|
7901
|
+
};
|
|
7902
|
+
_this.setCursorPosition = function (pos) {
|
|
7903
|
+
_this.setSelection(pos, pos);
|
|
7904
|
+
};
|
|
7905
|
+
_this.isFocused = function () {
|
|
7906
|
+
return _this.focused;
|
|
7907
|
+
};
|
|
7908
|
+
_this.getBeforeMaskedValueChangeConfig = function () {
|
|
7909
|
+
var _this$maskOptions = _this.maskOptions,
|
|
7910
|
+
mask = _this$maskOptions.mask,
|
|
7911
|
+
maskChar = _this$maskOptions.maskChar,
|
|
7912
|
+
permanents = _this$maskOptions.permanents,
|
|
7913
|
+
formatChars = _this$maskOptions.formatChars;
|
|
7914
|
+
var alwaysShowMask = _this.props.alwaysShowMask;
|
|
7915
|
+
return {
|
|
7916
|
+
mask: mask,
|
|
7917
|
+
maskChar: maskChar,
|
|
7918
|
+
permanents: permanents,
|
|
7919
|
+
alwaysShowMask: !!alwaysShowMask,
|
|
7920
|
+
formatChars: formatChars
|
|
7921
|
+
};
|
|
7922
|
+
};
|
|
7923
|
+
_this.isInputAutofilled = function (value, selection, previousValue, previousSelection) {
|
|
7924
|
+
var input = _this.getInputDOMNode(); // only check for positive match because it will be false negative
|
|
7925
|
+
// in case of autofill simulation in tests
|
|
7926
|
+
//
|
|
7927
|
+
// input.matches throws an exception if selector isn't supported
|
|
7751
7928
|
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
var warning_1;
|
|
7759
|
-
var hasRequiredWarning;
|
|
7760
|
-
function requireWarning() {
|
|
7761
|
-
if (hasRequiredWarning) return warning_1;
|
|
7762
|
-
hasRequiredWarning = 1;
|
|
7929
|
+
try {
|
|
7930
|
+
if (input.matches(':-webkit-autofill')) {
|
|
7931
|
+
return true;
|
|
7932
|
+
}
|
|
7933
|
+
} catch (e) {} // if input isn't focused then change event must have been triggered
|
|
7934
|
+
// either by autofill or event simulation in tests
|
|
7763
7935
|
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
* same logic and follow the same code paths.
|
|
7769
|
-
*/
|
|
7936
|
+
if (!_this.focused) {
|
|
7937
|
+
return true;
|
|
7938
|
+
} // if cursor has moved to the end while previousSelection forbids it
|
|
7939
|
+
// then it must be autofill
|
|
7770
7940
|
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
});
|
|
7784
|
-
if (typeof console !== 'undefined') {
|
|
7785
|
-
console.error(message);
|
|
7786
|
-
}
|
|
7787
|
-
try {
|
|
7788
|
-
// --- Welcome to debugging React ---
|
|
7789
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
7790
|
-
// to find the callsite that caused this warning to fire.
|
|
7791
|
-
throw new Error(message);
|
|
7792
|
-
} catch (x) {}
|
|
7793
|
-
};
|
|
7794
|
-
warning = function warning(condition, format, args) {
|
|
7795
|
-
var len = arguments.length;
|
|
7796
|
-
args = new Array(len > 2 ? len - 2 : 0);
|
|
7797
|
-
for (var key = 2; key < len; key++) {
|
|
7798
|
-
args[key - 2] = arguments[key];
|
|
7799
|
-
}
|
|
7800
|
-
if (format === undefined) {
|
|
7801
|
-
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
7802
|
-
}
|
|
7803
|
-
if (!condition) {
|
|
7804
|
-
printWarning.apply(null, [format].concat(args));
|
|
7805
|
-
}
|
|
7806
|
-
};
|
|
7807
|
-
}
|
|
7808
|
-
warning_1 = warning;
|
|
7809
|
-
return warning_1;
|
|
7810
|
-
}
|
|
7811
|
-
|
|
7812
|
-
var reactInputMask_development;
|
|
7813
|
-
var hasRequiredReactInputMask_development;
|
|
7814
|
-
function requireReactInputMask_development() {
|
|
7815
|
-
if (hasRequiredReactInputMask_development) return reactInputMask_development;
|
|
7816
|
-
hasRequiredReactInputMask_development = 1;
|
|
7817
|
-
function _interopDefault(ex) {
|
|
7818
|
-
return ex && _typeof$1(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
|
|
7819
|
-
}
|
|
7820
|
-
var React$1 = _interopDefault(React);
|
|
7821
|
-
var reactDom = require$$1;
|
|
7822
|
-
var invariant = _interopDefault(requireInvariant());
|
|
7823
|
-
var warning = _interopDefault(requireWarning());
|
|
7824
|
-
function _defaults2(obj, defaults) {
|
|
7825
|
-
var keys = Object.getOwnPropertyNames(defaults);
|
|
7826
|
-
for (var i = 0; i < keys.length; i++) {
|
|
7827
|
-
var key = keys[i];
|
|
7828
|
-
var value = Object.getOwnPropertyDescriptor(defaults, key);
|
|
7829
|
-
if (value && value.configurable && obj[key] === undefined) {
|
|
7830
|
-
Object.defineProperty(obj, key, value);
|
|
7831
|
-
}
|
|
7832
|
-
}
|
|
7833
|
-
return obj;
|
|
7834
|
-
}
|
|
7835
|
-
function _extends() {
|
|
7836
|
-
_extends = Object.assign || function (target) {
|
|
7837
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
7838
|
-
var source = arguments[i];
|
|
7839
|
-
for (var key in source) {
|
|
7840
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
7841
|
-
target[key] = source[key];
|
|
7842
|
-
}
|
|
7843
|
-
}
|
|
7844
|
-
}
|
|
7845
|
-
return target;
|
|
7846
|
-
};
|
|
7847
|
-
return _extends.apply(this, arguments);
|
|
7848
|
-
}
|
|
7849
|
-
function _inheritsLoose(subClass, superClass) {
|
|
7850
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
7851
|
-
subClass.prototype.constructor = subClass;
|
|
7852
|
-
_defaults2(subClass, superClass);
|
|
7853
|
-
}
|
|
7854
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
7855
|
-
if (source == null) return {};
|
|
7856
|
-
var target = {};
|
|
7857
|
-
var sourceKeys = Object.keys(source);
|
|
7858
|
-
var key, i;
|
|
7859
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
7860
|
-
key = sourceKeys[i];
|
|
7861
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
7862
|
-
target[key] = source[key];
|
|
7863
|
-
}
|
|
7864
|
-
return target;
|
|
7865
|
-
}
|
|
7866
|
-
function _assertThisInitialized(self) {
|
|
7867
|
-
if (self === void 0) {
|
|
7868
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
7869
|
-
}
|
|
7870
|
-
return self;
|
|
7871
|
-
}
|
|
7872
|
-
function setInputSelection(input, start, end) {
|
|
7873
|
-
if ('selectionStart' in input && 'selectionEnd' in input) {
|
|
7874
|
-
input.selectionStart = start;
|
|
7875
|
-
input.selectionEnd = end;
|
|
7876
|
-
} else {
|
|
7877
|
-
var range = input.createTextRange();
|
|
7878
|
-
range.collapse(true);
|
|
7879
|
-
range.moveStart('character', start);
|
|
7880
|
-
range.moveEnd('character', end - start);
|
|
7881
|
-
range.select();
|
|
7882
|
-
}
|
|
7883
|
-
}
|
|
7884
|
-
function getInputSelection(input) {
|
|
7885
|
-
var start = 0;
|
|
7886
|
-
var end = 0;
|
|
7887
|
-
if ('selectionStart' in input && 'selectionEnd' in input) {
|
|
7888
|
-
start = input.selectionStart;
|
|
7889
|
-
end = input.selectionEnd;
|
|
7890
|
-
} else {
|
|
7891
|
-
var range = document.selection.createRange();
|
|
7892
|
-
if (range.parentElement() === input) {
|
|
7893
|
-
start = -range.moveStart('character', -input.value.length);
|
|
7894
|
-
end = -range.moveEnd('character', -input.value.length);
|
|
7895
|
-
}
|
|
7896
|
-
}
|
|
7897
|
-
return {
|
|
7898
|
-
start: start,
|
|
7899
|
-
end: end,
|
|
7900
|
-
length: end - start
|
|
7901
|
-
};
|
|
7902
|
-
}
|
|
7903
|
-
var defaultFormatChars = {
|
|
7904
|
-
'9': '[0-9]',
|
|
7905
|
-
'a': '[A-Za-z]',
|
|
7906
|
-
'*': '[A-Za-z0-9]'
|
|
7907
|
-
};
|
|
7908
|
-
var defaultMaskChar = '_';
|
|
7909
|
-
function parseMask(mask, maskChar, formatChars) {
|
|
7910
|
-
var parsedMaskString = '';
|
|
7911
|
-
var prefix = '';
|
|
7912
|
-
var lastEditablePosition = null;
|
|
7913
|
-
var permanents = [];
|
|
7914
|
-
if (maskChar === undefined) {
|
|
7915
|
-
maskChar = defaultMaskChar;
|
|
7916
|
-
}
|
|
7917
|
-
if (formatChars == null) {
|
|
7918
|
-
formatChars = defaultFormatChars;
|
|
7919
|
-
}
|
|
7920
|
-
if (!mask || typeof mask !== 'string') {
|
|
7921
|
-
return {
|
|
7922
|
-
maskChar: maskChar,
|
|
7923
|
-
formatChars: formatChars,
|
|
7924
|
-
mask: null,
|
|
7925
|
-
prefix: null,
|
|
7926
|
-
lastEditablePosition: null,
|
|
7927
|
-
permanents: []
|
|
7928
|
-
};
|
|
7929
|
-
}
|
|
7930
|
-
var isPermanent = false;
|
|
7931
|
-
mask.split('').forEach(function (character) {
|
|
7932
|
-
if (!isPermanent && character === '\\') {
|
|
7933
|
-
isPermanent = true;
|
|
7934
|
-
} else {
|
|
7935
|
-
if (isPermanent || !formatChars[character]) {
|
|
7936
|
-
permanents.push(parsedMaskString.length);
|
|
7937
|
-
if (parsedMaskString.length === permanents.length - 1) {
|
|
7938
|
-
prefix += character;
|
|
7939
|
-
}
|
|
7940
|
-
} else {
|
|
7941
|
-
lastEditablePosition = parsedMaskString.length + 1;
|
|
7942
|
-
}
|
|
7943
|
-
parsedMaskString += character;
|
|
7944
|
-
isPermanent = false;
|
|
7945
|
-
}
|
|
7946
|
-
});
|
|
7947
|
-
return {
|
|
7948
|
-
maskChar: maskChar,
|
|
7949
|
-
formatChars: formatChars,
|
|
7950
|
-
prefix: prefix,
|
|
7951
|
-
mask: parsedMaskString,
|
|
7952
|
-
lastEditablePosition: lastEditablePosition,
|
|
7953
|
-
permanents: permanents
|
|
7954
|
-
};
|
|
7955
|
-
}
|
|
7956
|
-
|
|
7957
|
-
/* eslint no-use-before-define: ["error", { functions: false }] */
|
|
7958
|
-
function isPermanentCharacter(maskOptions, pos) {
|
|
7959
|
-
return maskOptions.permanents.indexOf(pos) !== -1;
|
|
7960
|
-
}
|
|
7961
|
-
function isAllowedCharacter(maskOptions, pos, character) {
|
|
7962
|
-
var mask = maskOptions.mask,
|
|
7963
|
-
formatChars = maskOptions.formatChars;
|
|
7964
|
-
if (!character) {
|
|
7965
|
-
return false;
|
|
7966
|
-
}
|
|
7967
|
-
if (isPermanentCharacter(maskOptions, pos)) {
|
|
7968
|
-
return mask[pos] === character;
|
|
7969
|
-
}
|
|
7970
|
-
var ruleChar = mask[pos];
|
|
7971
|
-
var charRule = formatChars[ruleChar];
|
|
7972
|
-
return new RegExp(charRule).test(character);
|
|
7973
|
-
}
|
|
7974
|
-
function isEmpty(maskOptions, value) {
|
|
7975
|
-
return value.split('').every(function (character, i) {
|
|
7976
|
-
return isPermanentCharacter(maskOptions, i) || !isAllowedCharacter(maskOptions, i, character);
|
|
7977
|
-
});
|
|
7978
|
-
}
|
|
7979
|
-
function getFilledLength(maskOptions, value) {
|
|
7980
|
-
var maskChar = maskOptions.maskChar,
|
|
7981
|
-
prefix = maskOptions.prefix;
|
|
7982
|
-
if (!maskChar) {
|
|
7983
|
-
while (value.length > prefix.length && isPermanentCharacter(maskOptions, value.length - 1)) {
|
|
7984
|
-
value = value.slice(0, value.length - 1);
|
|
7985
|
-
}
|
|
7986
|
-
return value.length;
|
|
7987
|
-
}
|
|
7988
|
-
var filledLength = prefix.length;
|
|
7989
|
-
for (var i = value.length; i >= prefix.length; i--) {
|
|
7990
|
-
var character = value[i];
|
|
7991
|
-
var isEnteredCharacter = !isPermanentCharacter(maskOptions, i) && isAllowedCharacter(maskOptions, i, character);
|
|
7992
|
-
if (isEnteredCharacter) {
|
|
7993
|
-
filledLength = i + 1;
|
|
7994
|
-
break;
|
|
7995
|
-
}
|
|
7996
|
-
}
|
|
7997
|
-
return filledLength;
|
|
7998
|
-
}
|
|
7999
|
-
function isFilled(maskOptions, value) {
|
|
8000
|
-
return getFilledLength(maskOptions, value) === maskOptions.mask.length;
|
|
8001
|
-
}
|
|
8002
|
-
function formatValue(maskOptions, value) {
|
|
8003
|
-
var maskChar = maskOptions.maskChar,
|
|
8004
|
-
mask = maskOptions.mask,
|
|
8005
|
-
prefix = maskOptions.prefix;
|
|
8006
|
-
if (!maskChar) {
|
|
8007
|
-
value = insertString(maskOptions, '', value, 0);
|
|
8008
|
-
if (value.length < prefix.length) {
|
|
8009
|
-
value = prefix;
|
|
8010
|
-
}
|
|
8011
|
-
while (value.length < mask.length && isPermanentCharacter(maskOptions, value.length)) {
|
|
8012
|
-
value += mask[value.length];
|
|
8013
|
-
}
|
|
8014
|
-
return value;
|
|
8015
|
-
}
|
|
8016
|
-
if (value) {
|
|
8017
|
-
var emptyValue = formatValue(maskOptions, '');
|
|
8018
|
-
return insertString(maskOptions, emptyValue, value, 0);
|
|
8019
|
-
}
|
|
8020
|
-
for (var i = 0; i < mask.length; i++) {
|
|
8021
|
-
if (isPermanentCharacter(maskOptions, i)) {
|
|
8022
|
-
value += mask[i];
|
|
8023
|
-
} else {
|
|
8024
|
-
value += maskChar;
|
|
8025
|
-
}
|
|
8026
|
-
}
|
|
8027
|
-
return value;
|
|
8028
|
-
}
|
|
8029
|
-
function clearRange(maskOptions, value, start, len) {
|
|
8030
|
-
var end = start + len;
|
|
8031
|
-
var maskChar = maskOptions.maskChar,
|
|
8032
|
-
mask = maskOptions.mask,
|
|
8033
|
-
prefix = maskOptions.prefix;
|
|
8034
|
-
var arrayValue = value.split('');
|
|
8035
|
-
if (!maskChar) {
|
|
8036
|
-
// remove any permanent chars after clear range, they will be added back by formatValue
|
|
8037
|
-
for (var i = end; i < arrayValue.length; i++) {
|
|
8038
|
-
if (isPermanentCharacter(maskOptions, i)) {
|
|
8039
|
-
arrayValue[i] = '';
|
|
8040
|
-
}
|
|
8041
|
-
}
|
|
8042
|
-
start = Math.max(prefix.length, start);
|
|
8043
|
-
arrayValue.splice(start, end - start);
|
|
8044
|
-
value = arrayValue.join('');
|
|
8045
|
-
return formatValue(maskOptions, value);
|
|
8046
|
-
}
|
|
8047
|
-
return arrayValue.map(function (character, i) {
|
|
8048
|
-
if (i < start || i >= end) {
|
|
8049
|
-
return character;
|
|
8050
|
-
}
|
|
8051
|
-
if (isPermanentCharacter(maskOptions, i)) {
|
|
8052
|
-
return mask[i];
|
|
8053
|
-
}
|
|
8054
|
-
return maskChar;
|
|
8055
|
-
}).join('');
|
|
8056
|
-
}
|
|
8057
|
-
function insertString(maskOptions, value, insertStr, insertPosition) {
|
|
8058
|
-
var mask = maskOptions.mask,
|
|
8059
|
-
maskChar = maskOptions.maskChar,
|
|
8060
|
-
prefix = maskOptions.prefix;
|
|
8061
|
-
var arrayInsertStr = insertStr.split('');
|
|
8062
|
-
var isInputFilled = isFilled(maskOptions, value);
|
|
8063
|
-
var isUsablePosition = function isUsablePosition(pos, character) {
|
|
8064
|
-
return !isPermanentCharacter(maskOptions, pos) || character === mask[pos];
|
|
8065
|
-
};
|
|
8066
|
-
var isUsableCharacter = function isUsableCharacter(character, pos) {
|
|
8067
|
-
return !maskChar || !isPermanentCharacter(maskOptions, pos) || character !== maskChar;
|
|
8068
|
-
};
|
|
8069
|
-
if (!maskChar && insertPosition > value.length) {
|
|
8070
|
-
value += mask.slice(value.length, insertPosition);
|
|
8071
|
-
}
|
|
8072
|
-
arrayInsertStr.every(function (insertCharacter) {
|
|
8073
|
-
while (!isUsablePosition(insertPosition, insertCharacter)) {
|
|
8074
|
-
if (insertPosition >= value.length) {
|
|
8075
|
-
value += mask[insertPosition];
|
|
8076
|
-
}
|
|
8077
|
-
if (!isUsableCharacter(insertCharacter, insertPosition)) {
|
|
8078
|
-
return true;
|
|
8079
|
-
}
|
|
8080
|
-
insertPosition++; // stop iteration if maximum value length reached
|
|
8081
|
-
|
|
8082
|
-
if (insertPosition >= mask.length) {
|
|
8083
|
-
return false;
|
|
8084
|
-
}
|
|
8085
|
-
}
|
|
8086
|
-
var isAllowed = isAllowedCharacter(maskOptions, insertPosition, insertCharacter) || insertCharacter === maskChar;
|
|
8087
|
-
if (!isAllowed) {
|
|
8088
|
-
return true;
|
|
8089
|
-
}
|
|
8090
|
-
if (insertPosition < value.length) {
|
|
8091
|
-
if (maskChar || isInputFilled || insertPosition < prefix.length) {
|
|
8092
|
-
value = value.slice(0, insertPosition) + insertCharacter + value.slice(insertPosition + 1);
|
|
8093
|
-
} else {
|
|
8094
|
-
value = value.slice(0, insertPosition) + insertCharacter + value.slice(insertPosition);
|
|
8095
|
-
value = formatValue(maskOptions, value);
|
|
8096
|
-
}
|
|
8097
|
-
} else if (!maskChar) {
|
|
8098
|
-
value += insertCharacter;
|
|
8099
|
-
}
|
|
8100
|
-
insertPosition++; // stop iteration if maximum value length reached
|
|
8101
|
-
|
|
8102
|
-
return insertPosition < mask.length;
|
|
8103
|
-
});
|
|
8104
|
-
return value;
|
|
8105
|
-
}
|
|
8106
|
-
function getInsertStringLength(maskOptions, value, insertStr, insertPosition) {
|
|
8107
|
-
var mask = maskOptions.mask,
|
|
8108
|
-
maskChar = maskOptions.maskChar;
|
|
8109
|
-
var arrayInsertStr = insertStr.split('');
|
|
8110
|
-
var initialInsertPosition = insertPosition;
|
|
8111
|
-
var isUsablePosition = function isUsablePosition(pos, character) {
|
|
8112
|
-
return !isPermanentCharacter(maskOptions, pos) || character === mask[pos];
|
|
8113
|
-
};
|
|
8114
|
-
arrayInsertStr.every(function (insertCharacter) {
|
|
8115
|
-
while (!isUsablePosition(insertPosition, insertCharacter)) {
|
|
8116
|
-
insertPosition++; // stop iteration if maximum value length reached
|
|
8117
|
-
|
|
8118
|
-
if (insertPosition >= mask.length) {
|
|
8119
|
-
return false;
|
|
8120
|
-
}
|
|
8121
|
-
}
|
|
8122
|
-
var isAllowed = isAllowedCharacter(maskOptions, insertPosition, insertCharacter) || insertCharacter === maskChar;
|
|
8123
|
-
if (isAllowed) {
|
|
8124
|
-
insertPosition++;
|
|
8125
|
-
} // stop iteration if maximum value length reached
|
|
8126
|
-
|
|
8127
|
-
return insertPosition < mask.length;
|
|
8128
|
-
});
|
|
8129
|
-
return insertPosition - initialInsertPosition;
|
|
8130
|
-
}
|
|
8131
|
-
function getLeftEditablePosition(maskOptions, pos) {
|
|
8132
|
-
for (var i = pos; i >= 0; --i) {
|
|
8133
|
-
if (!isPermanentCharacter(maskOptions, i)) {
|
|
8134
|
-
return i;
|
|
8135
|
-
}
|
|
8136
|
-
}
|
|
8137
|
-
return null;
|
|
8138
|
-
}
|
|
8139
|
-
function getRightEditablePosition(maskOptions, pos) {
|
|
8140
|
-
var mask = maskOptions.mask;
|
|
8141
|
-
for (var i = pos; i < mask.length; ++i) {
|
|
8142
|
-
if (!isPermanentCharacter(maskOptions, i)) {
|
|
8143
|
-
return i;
|
|
8144
|
-
}
|
|
8145
|
-
}
|
|
8146
|
-
return null;
|
|
8147
|
-
}
|
|
8148
|
-
function getStringValue(value) {
|
|
8149
|
-
return !value && value !== 0 ? '' : value + '';
|
|
8150
|
-
}
|
|
8151
|
-
function processChange(maskOptions, value, selection, previousValue, previousSelection) {
|
|
8152
|
-
var mask = maskOptions.mask,
|
|
8153
|
-
prefix = maskOptions.prefix,
|
|
8154
|
-
lastEditablePosition = maskOptions.lastEditablePosition;
|
|
8155
|
-
var newValue = value;
|
|
8156
|
-
var enteredString = '';
|
|
8157
|
-
var formattedEnteredStringLength = 0;
|
|
8158
|
-
var removedLength = 0;
|
|
8159
|
-
var cursorPosition = Math.min(previousSelection.start, selection.start);
|
|
8160
|
-
if (selection.end > previousSelection.start) {
|
|
8161
|
-
enteredString = newValue.slice(previousSelection.start, selection.end);
|
|
8162
|
-
formattedEnteredStringLength = getInsertStringLength(maskOptions, previousValue, enteredString, cursorPosition);
|
|
8163
|
-
if (!formattedEnteredStringLength) {
|
|
8164
|
-
removedLength = 0;
|
|
8165
|
-
} else {
|
|
8166
|
-
removedLength = previousSelection.length;
|
|
8167
|
-
}
|
|
8168
|
-
} else if (newValue.length < previousValue.length) {
|
|
8169
|
-
removedLength = previousValue.length - newValue.length;
|
|
8170
|
-
}
|
|
8171
|
-
newValue = previousValue;
|
|
8172
|
-
if (removedLength) {
|
|
8173
|
-
if (removedLength === 1 && !previousSelection.length) {
|
|
8174
|
-
var deleteFromRight = previousSelection.start === selection.start;
|
|
8175
|
-
cursorPosition = deleteFromRight ? getRightEditablePosition(maskOptions, selection.start) : getLeftEditablePosition(maskOptions, selection.start);
|
|
8176
|
-
}
|
|
8177
|
-
newValue = clearRange(maskOptions, newValue, cursorPosition, removedLength);
|
|
8178
|
-
}
|
|
8179
|
-
newValue = insertString(maskOptions, newValue, enteredString, cursorPosition);
|
|
8180
|
-
cursorPosition = cursorPosition + formattedEnteredStringLength;
|
|
8181
|
-
if (cursorPosition >= mask.length) {
|
|
8182
|
-
cursorPosition = mask.length;
|
|
8183
|
-
} else if (cursorPosition < prefix.length && !formattedEnteredStringLength) {
|
|
8184
|
-
cursorPosition = prefix.length;
|
|
8185
|
-
} else if (cursorPosition >= prefix.length && cursorPosition < lastEditablePosition && formattedEnteredStringLength) {
|
|
8186
|
-
cursorPosition = getRightEditablePosition(maskOptions, cursorPosition);
|
|
8187
|
-
}
|
|
8188
|
-
newValue = formatValue(maskOptions, newValue);
|
|
8189
|
-
if (!enteredString) {
|
|
8190
|
-
enteredString = null;
|
|
8191
|
-
}
|
|
8192
|
-
return {
|
|
8193
|
-
value: newValue,
|
|
8194
|
-
enteredString: enteredString,
|
|
8195
|
-
selection: {
|
|
8196
|
-
start: cursorPosition,
|
|
8197
|
-
end: cursorPosition
|
|
8198
|
-
}
|
|
8199
|
-
};
|
|
8200
|
-
}
|
|
8201
|
-
function isWindowsPhoneBrowser() {
|
|
8202
|
-
var windows = new RegExp('windows', 'i');
|
|
8203
|
-
var phone = new RegExp('phone', 'i');
|
|
8204
|
-
var ua = navigator.userAgent;
|
|
8205
|
-
return windows.test(ua) && phone.test(ua);
|
|
8206
|
-
}
|
|
8207
|
-
function isFunction(value) {
|
|
8208
|
-
return typeof value === 'function';
|
|
8209
|
-
}
|
|
8210
|
-
function getRequestAnimationFrame() {
|
|
8211
|
-
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
|
|
8212
|
-
}
|
|
8213
|
-
function getCancelAnimationFrame() {
|
|
8214
|
-
return window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame;
|
|
8215
|
-
}
|
|
8216
|
-
function defer(fn) {
|
|
8217
|
-
var hasCancelAnimationFrame = !!getCancelAnimationFrame();
|
|
8218
|
-
var deferFn;
|
|
8219
|
-
if (hasCancelAnimationFrame) {
|
|
8220
|
-
deferFn = getRequestAnimationFrame();
|
|
8221
|
-
} else {
|
|
8222
|
-
deferFn = function deferFn() {
|
|
8223
|
-
return setTimeout(fn, 1000 / 60);
|
|
8224
|
-
};
|
|
8225
|
-
}
|
|
8226
|
-
return deferFn(fn);
|
|
8227
|
-
}
|
|
8228
|
-
function cancelDefer(deferId) {
|
|
8229
|
-
var cancelFn = getCancelAnimationFrame() || clearTimeout;
|
|
8230
|
-
cancelFn(deferId);
|
|
8231
|
-
}
|
|
8232
|
-
var InputElement = /*#__PURE__*/
|
|
8233
|
-
function (_React$Component) {
|
|
8234
|
-
_inheritsLoose(InputElement, _React$Component);
|
|
8235
|
-
function InputElement(props) {
|
|
8236
|
-
var _this;
|
|
8237
|
-
_this = _React$Component.call(this, props) || this;
|
|
8238
|
-
_this.focused = false;
|
|
8239
|
-
_this.mounted = false;
|
|
8240
|
-
_this.previousSelection = null;
|
|
8241
|
-
_this.selectionDeferId = null;
|
|
8242
|
-
_this.saveSelectionLoopDeferId = null;
|
|
8243
|
-
_this.saveSelectionLoop = function () {
|
|
8244
|
-
_this.previousSelection = _this.getSelection();
|
|
8245
|
-
_this.saveSelectionLoopDeferId = defer(_this.saveSelectionLoop);
|
|
8246
|
-
};
|
|
8247
|
-
_this.runSaveSelectionLoop = function () {
|
|
8248
|
-
if (_this.saveSelectionLoopDeferId === null) {
|
|
8249
|
-
_this.saveSelectionLoop();
|
|
8250
|
-
}
|
|
8251
|
-
};
|
|
8252
|
-
_this.stopSaveSelectionLoop = function () {
|
|
8253
|
-
if (_this.saveSelectionLoopDeferId !== null) {
|
|
8254
|
-
cancelDefer(_this.saveSelectionLoopDeferId);
|
|
8255
|
-
_this.saveSelectionLoopDeferId = null;
|
|
8256
|
-
_this.previousSelection = null;
|
|
8257
|
-
}
|
|
8258
|
-
};
|
|
8259
|
-
_this.getInputDOMNode = function () {
|
|
8260
|
-
if (!_this.mounted) {
|
|
8261
|
-
return null;
|
|
8262
|
-
}
|
|
8263
|
-
var input = reactDom.findDOMNode(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
8264
|
-
var isDOMNode = typeof window !== 'undefined' && input instanceof window.Element; // workaround for react-test-renderer
|
|
8265
|
-
// https://github.com/sanniassin/react-input-mask/issues/147
|
|
8266
|
-
|
|
8267
|
-
if (input && !isDOMNode) {
|
|
8268
|
-
return null;
|
|
8269
|
-
}
|
|
8270
|
-
if (input.nodeName !== 'INPUT') {
|
|
8271
|
-
input = input.querySelector('input');
|
|
8272
|
-
}
|
|
8273
|
-
if (!input) {
|
|
8274
|
-
throw new Error('react-input-mask: inputComponent doesn\'t contain input node');
|
|
8275
|
-
}
|
|
8276
|
-
return input;
|
|
8277
|
-
};
|
|
8278
|
-
_this.getInputValue = function () {
|
|
8279
|
-
var input = _this.getInputDOMNode();
|
|
8280
|
-
if (!input) {
|
|
8281
|
-
return null;
|
|
8282
|
-
}
|
|
8283
|
-
return input.value;
|
|
8284
|
-
};
|
|
8285
|
-
_this.setInputValue = function (value) {
|
|
8286
|
-
var input = _this.getInputDOMNode();
|
|
8287
|
-
if (!input) {
|
|
8288
|
-
return;
|
|
8289
|
-
}
|
|
8290
|
-
_this.value = value;
|
|
8291
|
-
input.value = value;
|
|
8292
|
-
};
|
|
8293
|
-
_this.setCursorToEnd = function () {
|
|
8294
|
-
var filledLength = getFilledLength(_this.maskOptions, _this.value);
|
|
8295
|
-
var pos = getRightEditablePosition(_this.maskOptions, filledLength);
|
|
8296
|
-
if (pos !== null) {
|
|
8297
|
-
_this.setCursorPosition(pos);
|
|
8298
|
-
}
|
|
8299
|
-
};
|
|
8300
|
-
_this.setSelection = function (start, end, options) {
|
|
8301
|
-
if (options === void 0) {
|
|
8302
|
-
options = {};
|
|
8303
|
-
}
|
|
8304
|
-
var input = _this.getInputDOMNode();
|
|
8305
|
-
var isFocused = _this.isFocused(); // don't change selection on unfocused input
|
|
8306
|
-
// because Safari sets focus on selection change (#154)
|
|
8307
|
-
|
|
8308
|
-
if (!input || !isFocused) {
|
|
8309
|
-
return;
|
|
8310
|
-
}
|
|
8311
|
-
var _options = options,
|
|
8312
|
-
deferred = _options.deferred;
|
|
8313
|
-
if (!deferred) {
|
|
8314
|
-
setInputSelection(input, start, end);
|
|
8315
|
-
}
|
|
8316
|
-
if (_this.selectionDeferId !== null) {
|
|
8317
|
-
cancelDefer(_this.selectionDeferId);
|
|
8318
|
-
} // deferred selection update is required for pre-Lollipop Android browser,
|
|
8319
|
-
// but for consistent behavior we do it for all browsers
|
|
8320
|
-
|
|
8321
|
-
_this.selectionDeferId = defer(function () {
|
|
8322
|
-
_this.selectionDeferId = null;
|
|
8323
|
-
setInputSelection(input, start, end);
|
|
8324
|
-
});
|
|
8325
|
-
_this.previousSelection = {
|
|
8326
|
-
start: start,
|
|
8327
|
-
end: end,
|
|
8328
|
-
length: Math.abs(end - start)
|
|
8329
|
-
};
|
|
8330
|
-
};
|
|
8331
|
-
_this.getSelection = function () {
|
|
8332
|
-
var input = _this.getInputDOMNode();
|
|
8333
|
-
return getInputSelection(input);
|
|
8334
|
-
};
|
|
8335
|
-
_this.getCursorPosition = function () {
|
|
8336
|
-
return _this.getSelection().start;
|
|
8337
|
-
};
|
|
8338
|
-
_this.setCursorPosition = function (pos) {
|
|
8339
|
-
_this.setSelection(pos, pos);
|
|
8340
|
-
};
|
|
8341
|
-
_this.isFocused = function () {
|
|
8342
|
-
return _this.focused;
|
|
8343
|
-
};
|
|
8344
|
-
_this.getBeforeMaskedValueChangeConfig = function () {
|
|
8345
|
-
var _this$maskOptions = _this.maskOptions,
|
|
8346
|
-
mask = _this$maskOptions.mask,
|
|
8347
|
-
maskChar = _this$maskOptions.maskChar,
|
|
8348
|
-
permanents = _this$maskOptions.permanents,
|
|
8349
|
-
formatChars = _this$maskOptions.formatChars;
|
|
8350
|
-
var alwaysShowMask = _this.props.alwaysShowMask;
|
|
8351
|
-
return {
|
|
8352
|
-
mask: mask,
|
|
8353
|
-
maskChar: maskChar,
|
|
8354
|
-
permanents: permanents,
|
|
8355
|
-
alwaysShowMask: !!alwaysShowMask,
|
|
8356
|
-
formatChars: formatChars
|
|
8357
|
-
};
|
|
8358
|
-
};
|
|
8359
|
-
_this.isInputAutofilled = function (value, selection, previousValue, previousSelection) {
|
|
8360
|
-
var input = _this.getInputDOMNode(); // only check for positive match because it will be false negative
|
|
8361
|
-
// in case of autofill simulation in tests
|
|
8362
|
-
//
|
|
8363
|
-
// input.matches throws an exception if selector isn't supported
|
|
8364
|
-
|
|
8365
|
-
try {
|
|
8366
|
-
if (input.matches(':-webkit-autofill')) {
|
|
8367
|
-
return true;
|
|
8368
|
-
}
|
|
8369
|
-
} catch (e) {} // if input isn't focused then change event must have been triggered
|
|
8370
|
-
// either by autofill or event simulation in tests
|
|
8371
|
-
|
|
8372
|
-
if (!_this.focused) {
|
|
8373
|
-
return true;
|
|
8374
|
-
} // if cursor has moved to the end while previousSelection forbids it
|
|
8375
|
-
// then it must be autofill
|
|
8376
|
-
|
|
8377
|
-
return previousSelection.end < previousValue.length && selection.end === value.length;
|
|
8378
|
-
};
|
|
8379
|
-
_this.onChange = function (event) {
|
|
8380
|
-
var _assertThisInitialize = _assertThisInitialized(_assertThisInitialized(_this)),
|
|
8381
|
-
beforePasteState = _assertThisInitialize.beforePasteState;
|
|
8382
|
-
var _assertThisInitialize2 = _assertThisInitialized(_assertThisInitialized(_this)),
|
|
8383
|
-
previousSelection = _assertThisInitialize2.previousSelection;
|
|
8384
|
-
var beforeMaskedValueChange = _this.props.beforeMaskedValueChange;
|
|
8385
|
-
var value = _this.getInputValue();
|
|
8386
|
-
var previousValue = _this.value;
|
|
8387
|
-
var selection = _this.getSelection(); // autofill replaces entire value, ignore old one
|
|
8388
|
-
// https://github.com/sanniassin/react-input-mask/issues/113
|
|
7941
|
+
return previousSelection.end < previousValue.length && selection.end === value.length;
|
|
7942
|
+
};
|
|
7943
|
+
_this.onChange = function (event) {
|
|
7944
|
+
var _assertThisInitialize = _assertThisInitialized(_assertThisInitialized(_this)),
|
|
7945
|
+
beforePasteState = _assertThisInitialize.beforePasteState;
|
|
7946
|
+
var _assertThisInitialize2 = _assertThisInitialized(_assertThisInitialized(_this)),
|
|
7947
|
+
previousSelection = _assertThisInitialize2.previousSelection;
|
|
7948
|
+
var beforeMaskedValueChange = _this.props.beforeMaskedValueChange;
|
|
7949
|
+
var value = _this.getInputValue();
|
|
7950
|
+
var previousValue = _this.value;
|
|
7951
|
+
var selection = _this.getSelection(); // autofill replaces entire value, ignore old one
|
|
7952
|
+
// https://github.com/sanniassin/react-input-mask/issues/113
|
|
8389
7953
|
|
|
8390
7954
|
if (_this.isInputAutofilled(value, selection, previousValue, previousSelection)) {
|
|
8391
7955
|
previousValue = formatValue(_this.maskOptions, '');
|
|
@@ -8544,207 +8108,718 @@ function requireReactInputMask_development() {
|
|
|
8544
8108
|
} // event.clipboardData might not work in Android browser
|
|
8545
8109
|
// cleaning input to get raw text inside onChange handler
|
|
8546
8110
|
|
|
8547
|
-
if (!event.defaultPrevented) {
|
|
8548
|
-
_this.beforePasteState = {
|
|
8549
|
-
value: _this.getInputValue(),
|
|
8550
|
-
selection: _this.getSelection()
|
|
8551
|
-
};
|
|
8552
|
-
_this.setInputValue('');
|
|
8553
|
-
}
|
|
8111
|
+
if (!event.defaultPrevented) {
|
|
8112
|
+
_this.beforePasteState = {
|
|
8113
|
+
value: _this.getInputValue(),
|
|
8114
|
+
selection: _this.getSelection()
|
|
8115
|
+
};
|
|
8116
|
+
_this.setInputValue('');
|
|
8117
|
+
}
|
|
8118
|
+
};
|
|
8119
|
+
_this.handleRef = function (ref) {
|
|
8120
|
+
if (_this.props.children == null && isFunction(_this.props.inputRef)) {
|
|
8121
|
+
_this.props.inputRef(ref);
|
|
8122
|
+
}
|
|
8123
|
+
};
|
|
8124
|
+
var _mask = props.mask,
|
|
8125
|
+
_maskChar = props.maskChar,
|
|
8126
|
+
_formatChars = props.formatChars,
|
|
8127
|
+
_alwaysShowMask = props.alwaysShowMask,
|
|
8128
|
+
_beforeMaskedValueChange = props.beforeMaskedValueChange;
|
|
8129
|
+
var defaultValue = props.defaultValue,
|
|
8130
|
+
_value = props.value;
|
|
8131
|
+
_this.maskOptions = parseMask(_mask, _maskChar, _formatChars);
|
|
8132
|
+
if (defaultValue == null) {
|
|
8133
|
+
defaultValue = '';
|
|
8134
|
+
}
|
|
8135
|
+
if (_value == null) {
|
|
8136
|
+
_value = defaultValue;
|
|
8137
|
+
}
|
|
8138
|
+
var _newValue = getStringValue(_value);
|
|
8139
|
+
if (_this.maskOptions.mask && (_alwaysShowMask || _newValue)) {
|
|
8140
|
+
_newValue = formatValue(_this.maskOptions, _newValue);
|
|
8141
|
+
if (isFunction(_beforeMaskedValueChange)) {
|
|
8142
|
+
var oldValue = props.value;
|
|
8143
|
+
if (props.value == null) {
|
|
8144
|
+
oldValue = defaultValue;
|
|
8145
|
+
}
|
|
8146
|
+
oldValue = getStringValue(oldValue);
|
|
8147
|
+
var modifiedValue = _beforeMaskedValueChange({
|
|
8148
|
+
value: _newValue,
|
|
8149
|
+
selection: null
|
|
8150
|
+
}, {
|
|
8151
|
+
value: oldValue,
|
|
8152
|
+
selection: null
|
|
8153
|
+
}, null, _this.getBeforeMaskedValueChangeConfig());
|
|
8154
|
+
_newValue = modifiedValue.value;
|
|
8155
|
+
}
|
|
8156
|
+
}
|
|
8157
|
+
_this.value = _newValue;
|
|
8158
|
+
return _this;
|
|
8159
|
+
}
|
|
8160
|
+
var _proto = InputElement.prototype;
|
|
8161
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
8162
|
+
this.mounted = true; // workaround for react-test-renderer
|
|
8163
|
+
// https://github.com/sanniassin/react-input-mask/issues/147
|
|
8164
|
+
|
|
8165
|
+
if (!this.getInputDOMNode()) {
|
|
8166
|
+
return;
|
|
8167
|
+
}
|
|
8168
|
+
this.isWindowsPhoneBrowser = isWindowsPhoneBrowser();
|
|
8169
|
+
if (this.maskOptions.mask && this.getInputValue() !== this.value) {
|
|
8170
|
+
this.setInputValue(this.value);
|
|
8171
|
+
}
|
|
8172
|
+
};
|
|
8173
|
+
_proto.componentDidUpdate = function componentDidUpdate() {
|
|
8174
|
+
var previousSelection = this.previousSelection;
|
|
8175
|
+
var _this$props = this.props,
|
|
8176
|
+
beforeMaskedValueChange = _this$props.beforeMaskedValueChange,
|
|
8177
|
+
alwaysShowMask = _this$props.alwaysShowMask,
|
|
8178
|
+
mask = _this$props.mask,
|
|
8179
|
+
maskChar = _this$props.maskChar,
|
|
8180
|
+
formatChars = _this$props.formatChars;
|
|
8181
|
+
var previousMaskOptions = this.maskOptions;
|
|
8182
|
+
var showEmpty = alwaysShowMask || this.isFocused();
|
|
8183
|
+
var hasValue = this.props.value != null;
|
|
8184
|
+
var newValue = hasValue ? getStringValue(this.props.value) : this.value;
|
|
8185
|
+
var cursorPosition = previousSelection ? previousSelection.start : null;
|
|
8186
|
+
this.maskOptions = parseMask(mask, maskChar, formatChars);
|
|
8187
|
+
if (!this.maskOptions.mask) {
|
|
8188
|
+
if (previousMaskOptions.mask) {
|
|
8189
|
+
this.stopSaveSelectionLoop(); // render depends on this.maskOptions and this.value,
|
|
8190
|
+
// call forceUpdate to keep it in sync
|
|
8191
|
+
|
|
8192
|
+
this.forceUpdate();
|
|
8193
|
+
}
|
|
8194
|
+
return;
|
|
8195
|
+
} else if (!previousMaskOptions.mask && this.isFocused()) {
|
|
8196
|
+
this.runSaveSelectionLoop();
|
|
8197
|
+
}
|
|
8198
|
+
var isMaskChanged = this.maskOptions.mask && this.maskOptions.mask !== previousMaskOptions.mask;
|
|
8199
|
+
if (!previousMaskOptions.mask && !hasValue) {
|
|
8200
|
+
newValue = this.getInputValue();
|
|
8201
|
+
}
|
|
8202
|
+
if (isMaskChanged || this.maskOptions.mask && (newValue || showEmpty)) {
|
|
8203
|
+
newValue = formatValue(this.maskOptions, newValue);
|
|
8204
|
+
}
|
|
8205
|
+
if (isMaskChanged) {
|
|
8206
|
+
var filledLength = getFilledLength(this.maskOptions, newValue);
|
|
8207
|
+
if (cursorPosition === null || filledLength < cursorPosition) {
|
|
8208
|
+
if (isFilled(this.maskOptions, newValue)) {
|
|
8209
|
+
cursorPosition = filledLength;
|
|
8210
|
+
} else {
|
|
8211
|
+
cursorPosition = getRightEditablePosition(this.maskOptions, filledLength);
|
|
8212
|
+
}
|
|
8213
|
+
}
|
|
8214
|
+
}
|
|
8215
|
+
if (this.maskOptions.mask && isEmpty(this.maskOptions, newValue) && !showEmpty && (!hasValue || !this.props.value)) {
|
|
8216
|
+
newValue = '';
|
|
8217
|
+
}
|
|
8218
|
+
var newSelection = {
|
|
8219
|
+
start: cursorPosition,
|
|
8220
|
+
end: cursorPosition
|
|
8221
|
+
};
|
|
8222
|
+
if (isFunction(beforeMaskedValueChange)) {
|
|
8223
|
+
var modifiedValue = beforeMaskedValueChange({
|
|
8224
|
+
value: newValue,
|
|
8225
|
+
selection: newSelection
|
|
8226
|
+
}, {
|
|
8227
|
+
value: this.value,
|
|
8228
|
+
selection: this.previousSelection
|
|
8229
|
+
}, null, this.getBeforeMaskedValueChangeConfig());
|
|
8230
|
+
newValue = modifiedValue.value;
|
|
8231
|
+
newSelection = modifiedValue.selection;
|
|
8232
|
+
}
|
|
8233
|
+
this.value = newValue;
|
|
8234
|
+
var isValueChanged = this.getInputValue() !== this.value; // render depends on this.maskOptions and this.value,
|
|
8235
|
+
// call forceUpdate to keep it in sync
|
|
8236
|
+
|
|
8237
|
+
if (isValueChanged) {
|
|
8238
|
+
this.setInputValue(this.value);
|
|
8239
|
+
this.forceUpdate();
|
|
8240
|
+
} else if (isMaskChanged) {
|
|
8241
|
+
this.forceUpdate();
|
|
8242
|
+
}
|
|
8243
|
+
var isSelectionChanged = false;
|
|
8244
|
+
if (newSelection.start != null && newSelection.end != null) {
|
|
8245
|
+
isSelectionChanged = !previousSelection || previousSelection.start !== newSelection.start || previousSelection.end !== newSelection.end;
|
|
8246
|
+
}
|
|
8247
|
+
if (isSelectionChanged || isValueChanged) {
|
|
8248
|
+
this.setSelection(newSelection.start, newSelection.end);
|
|
8249
|
+
}
|
|
8250
|
+
};
|
|
8251
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
8252
|
+
this.mounted = false;
|
|
8253
|
+
if (this.selectionDeferId !== null) {
|
|
8254
|
+
cancelDefer(this.selectionDeferId);
|
|
8255
|
+
}
|
|
8256
|
+
this.stopSaveSelectionLoop();
|
|
8257
|
+
};
|
|
8258
|
+
_proto.render = function render() {
|
|
8259
|
+
var _this$props2 = this.props,
|
|
8260
|
+
mask = _this$props2.mask;
|
|
8261
|
+
_this$props2.alwaysShowMask;
|
|
8262
|
+
var maskChar = _this$props2.maskChar,
|
|
8263
|
+
formatChars = _this$props2.formatChars,
|
|
8264
|
+
inputRef = _this$props2.inputRef;
|
|
8265
|
+
_this$props2.beforeMaskedValueChange;
|
|
8266
|
+
var children = _this$props2.children,
|
|
8267
|
+
restProps = _objectWithoutPropertiesLoose(_this$props2, ["mask", "alwaysShowMask", "maskChar", "formatChars", "inputRef", "beforeMaskedValueChange", "children"]);
|
|
8268
|
+
var inputElement;
|
|
8269
|
+
process.env.NODE_ENV !== "production" ? warning(
|
|
8270
|
+
// parse mask to test against actual mask prop as this.maskOptions
|
|
8271
|
+
// will be updated later in componentDidUpdate
|
|
8272
|
+
!restProps.maxLength || !parseMask(mask, maskChar, formatChars).mask, 'react-input-mask: maxLength property shouldn\'t be passed to the masked input. It breaks masking and unnecessary because length is limited by the mask length.') : void 0;
|
|
8273
|
+
if (children) {
|
|
8274
|
+
!isFunction(children) ? process.env.NODE_ENV !== "production" ? invariant(false, 'react-input-mask: children must be a function') : invariant(false) : void 0;
|
|
8275
|
+
var controlledProps = ['onChange', 'onPaste', 'onMouseDown', 'onFocus', 'onBlur', 'value', 'disabled', 'readOnly'];
|
|
8276
|
+
var childrenProps = _extends({}, restProps);
|
|
8277
|
+
controlledProps.forEach(function (propId) {
|
|
8278
|
+
return delete childrenProps[propId];
|
|
8279
|
+
});
|
|
8280
|
+
inputElement = children(childrenProps);
|
|
8281
|
+
var conflictProps = controlledProps.filter(function (propId) {
|
|
8282
|
+
return inputElement.props[propId] != null && inputElement.props[propId] !== restProps[propId];
|
|
8283
|
+
});
|
|
8284
|
+
!!conflictProps.length ? process.env.NODE_ENV !== "production" ? invariant(false, "react-input-mask: the following props should be passed to the react-input-mask's component and should not be altered in children's function: " + conflictProps.join(', ')) : invariant(false) : void 0;
|
|
8285
|
+
process.env.NODE_ENV !== "production" ? warning(!inputRef, 'react-input-mask: inputRef is ignored when children is passed, attach ref to the children instead') : void 0;
|
|
8286
|
+
} else {
|
|
8287
|
+
inputElement = React$1.createElement("input", _extends({
|
|
8288
|
+
ref: this.handleRef
|
|
8289
|
+
}, restProps));
|
|
8290
|
+
}
|
|
8291
|
+
var changedProps = {
|
|
8292
|
+
onFocus: this.onFocus,
|
|
8293
|
+
onBlur: this.onBlur
|
|
8554
8294
|
};
|
|
8555
|
-
|
|
8556
|
-
if (
|
|
8557
|
-
|
|
8295
|
+
if (this.maskOptions.mask) {
|
|
8296
|
+
if (!restProps.disabled && !restProps.readOnly) {
|
|
8297
|
+
changedProps.onChange = this.onChange;
|
|
8298
|
+
changedProps.onPaste = this.onPaste;
|
|
8299
|
+
changedProps.onMouseDown = this.onMouseDown;
|
|
8300
|
+
}
|
|
8301
|
+
if (restProps.value != null) {
|
|
8302
|
+
changedProps.value = this.value;
|
|
8558
8303
|
}
|
|
8559
|
-
};
|
|
8560
|
-
var _mask = props.mask,
|
|
8561
|
-
_maskChar = props.maskChar,
|
|
8562
|
-
_formatChars = props.formatChars,
|
|
8563
|
-
_alwaysShowMask = props.alwaysShowMask,
|
|
8564
|
-
_beforeMaskedValueChange = props.beforeMaskedValueChange;
|
|
8565
|
-
var defaultValue = props.defaultValue,
|
|
8566
|
-
_value = props.value;
|
|
8567
|
-
_this.maskOptions = parseMask(_mask, _maskChar, _formatChars);
|
|
8568
|
-
if (defaultValue == null) {
|
|
8569
|
-
defaultValue = '';
|
|
8570
8304
|
}
|
|
8571
|
-
|
|
8572
|
-
|
|
8305
|
+
inputElement = React$1.cloneElement(inputElement, changedProps);
|
|
8306
|
+
return inputElement;
|
|
8307
|
+
};
|
|
8308
|
+
return InputElement;
|
|
8309
|
+
}(React$1.Component);
|
|
8310
|
+
reactInputMask_development = InputElement;
|
|
8311
|
+
return reactInputMask_development;
|
|
8312
|
+
}
|
|
8313
|
+
|
|
8314
|
+
var reactInputMask_production_min;
|
|
8315
|
+
var hasRequiredReactInputMask_production_min;
|
|
8316
|
+
function requireReactInputMask_production_min() {
|
|
8317
|
+
if (hasRequiredReactInputMask_production_min) return reactInputMask_production_min;
|
|
8318
|
+
hasRequiredReactInputMask_production_min = 1;
|
|
8319
|
+
function _interopDefault(e) {
|
|
8320
|
+
return e && "object" == _typeof$1(e) && "default" in e ? e["default"] : e;
|
|
8321
|
+
}
|
|
8322
|
+
var React$1 = _interopDefault(React),
|
|
8323
|
+
reactDom = require$$1;
|
|
8324
|
+
function _defaults2(e, t) {
|
|
8325
|
+
for (var n = Object.getOwnPropertyNames(t), a = 0; a < n.length; a++) {
|
|
8326
|
+
var i = n[a],
|
|
8327
|
+
r = Object.getOwnPropertyDescriptor(t, i);
|
|
8328
|
+
r && r.configurable && e[i] === undefined && Object.defineProperty(e, i, r);
|
|
8329
|
+
}
|
|
8330
|
+
return e;
|
|
8331
|
+
}
|
|
8332
|
+
function _extends() {
|
|
8333
|
+
return (_extends = Object.assign || function (e) {
|
|
8334
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
8335
|
+
var n = arguments[t];
|
|
8336
|
+
for (var a in n) Object.prototype.hasOwnProperty.call(n, a) && (e[a] = n[a]);
|
|
8573
8337
|
}
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8338
|
+
return e;
|
|
8339
|
+
}).apply(this, arguments);
|
|
8340
|
+
}
|
|
8341
|
+
function _inheritsLoose(e, t) {
|
|
8342
|
+
e.prototype = Object.create(t.prototype), _defaults2(e.prototype.constructor = e, t);
|
|
8343
|
+
}
|
|
8344
|
+
function _objectWithoutPropertiesLoose(e, t) {
|
|
8345
|
+
if (null == e) return {};
|
|
8346
|
+
var n,
|
|
8347
|
+
a,
|
|
8348
|
+
i = {},
|
|
8349
|
+
r = Object.keys(e);
|
|
8350
|
+
for (a = 0; a < r.length; a++) n = r[a], 0 <= t.indexOf(n) || (i[n] = e[n]);
|
|
8351
|
+
return i;
|
|
8352
|
+
}
|
|
8353
|
+
function _assertThisInitialized(e) {
|
|
8354
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
8355
|
+
return e;
|
|
8356
|
+
}
|
|
8357
|
+
var invariant = function invariant(e, t, n, a, i, r, o, s) {
|
|
8358
|
+
if (!e) {
|
|
8359
|
+
var l;
|
|
8360
|
+
if (t === undefined) l = new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else {
|
|
8361
|
+
var u = [n, a, i, r, o, s],
|
|
8362
|
+
c = 0;
|
|
8363
|
+
(l = new Error(t.replace(/%s/g, function () {
|
|
8364
|
+
return u[c++];
|
|
8365
|
+
}))).name = "Invariant Violation";
|
|
8591
8366
|
}
|
|
8367
|
+
throw l.framesToPop = 1, l;
|
|
8368
|
+
}
|
|
8369
|
+
},
|
|
8370
|
+
invariant_1 = invariant;
|
|
8371
|
+
function setInputSelection(e, t, n) {
|
|
8372
|
+
if ("selectionStart" in e && "selectionEnd" in e) e.selectionStart = t, e.selectionEnd = n;else {
|
|
8373
|
+
var a = e.createTextRange();
|
|
8374
|
+
a.collapse(!0), a.moveStart("character", t), a.moveEnd("character", n - t), a.select();
|
|
8375
|
+
}
|
|
8376
|
+
}
|
|
8377
|
+
function getInputSelection(e) {
|
|
8378
|
+
var t = 0,
|
|
8379
|
+
n = 0;
|
|
8380
|
+
if ("selectionStart" in e && "selectionEnd" in e) t = e.selectionStart, n = e.selectionEnd;else {
|
|
8381
|
+
var a = document.selection.createRange();
|
|
8382
|
+
a.parentElement() === e && (t = -a.moveStart("character", -e.value.length), n = -a.moveEnd("character", -e.value.length));
|
|
8383
|
+
}
|
|
8384
|
+
return {
|
|
8385
|
+
start: t,
|
|
8386
|
+
end: n,
|
|
8387
|
+
length: n - t
|
|
8388
|
+
};
|
|
8389
|
+
}
|
|
8390
|
+
var defaultFormatChars = {
|
|
8391
|
+
9: "[0-9]",
|
|
8392
|
+
a: "[A-Za-z]",
|
|
8393
|
+
"*": "[A-Za-z0-9]"
|
|
8394
|
+
},
|
|
8395
|
+
defaultMaskChar = "_";
|
|
8396
|
+
function parseMask(e, t, n) {
|
|
8397
|
+
var a = "",
|
|
8398
|
+
i = "",
|
|
8399
|
+
r = null,
|
|
8400
|
+
o = [];
|
|
8401
|
+
if (t === undefined && (t = defaultMaskChar), null == n && (n = defaultFormatChars), !e || "string" != typeof e) return {
|
|
8402
|
+
maskChar: t,
|
|
8403
|
+
formatChars: n,
|
|
8404
|
+
mask: null,
|
|
8405
|
+
prefix: null,
|
|
8406
|
+
lastEditablePosition: null,
|
|
8407
|
+
permanents: []
|
|
8408
|
+
};
|
|
8409
|
+
var s = !1;
|
|
8410
|
+
return e.split("").forEach(function (e) {
|
|
8411
|
+
s = !s && "\\" === e || (s || !n[e] ? (o.push(a.length), a.length === o.length - 1 && (i += e)) : r = a.length + 1, a += e, !1);
|
|
8412
|
+
}), {
|
|
8413
|
+
maskChar: t,
|
|
8414
|
+
formatChars: n,
|
|
8415
|
+
prefix: i,
|
|
8416
|
+
mask: a,
|
|
8417
|
+
lastEditablePosition: r,
|
|
8418
|
+
permanents: o
|
|
8419
|
+
};
|
|
8420
|
+
}
|
|
8421
|
+
function isPermanentCharacter(e, t) {
|
|
8422
|
+
return -1 !== e.permanents.indexOf(t);
|
|
8423
|
+
}
|
|
8424
|
+
function isAllowedCharacter(e, t, n) {
|
|
8425
|
+
var a = e.mask,
|
|
8426
|
+
i = e.formatChars;
|
|
8427
|
+
if (!n) return !1;
|
|
8428
|
+
if (isPermanentCharacter(e, t)) return a[t] === n;
|
|
8429
|
+
var r = i[a[t]];
|
|
8430
|
+
return new RegExp(r).test(n);
|
|
8431
|
+
}
|
|
8432
|
+
function isEmpty(n, e) {
|
|
8433
|
+
return e.split("").every(function (e, t) {
|
|
8434
|
+
return isPermanentCharacter(n, t) || !isAllowedCharacter(n, t, e);
|
|
8435
|
+
});
|
|
8436
|
+
}
|
|
8437
|
+
function getFilledLength(e, t) {
|
|
8438
|
+
var n = e.maskChar,
|
|
8439
|
+
a = e.prefix;
|
|
8440
|
+
if (!n) {
|
|
8441
|
+
for (; t.length > a.length && isPermanentCharacter(e, t.length - 1);) t = t.slice(0, t.length - 1);
|
|
8442
|
+
return t.length;
|
|
8443
|
+
}
|
|
8444
|
+
for (var i = a.length, r = t.length; r >= a.length; r--) {
|
|
8445
|
+
var o = t[r];
|
|
8446
|
+
if (!isPermanentCharacter(e, r) && isAllowedCharacter(e, r, o)) {
|
|
8447
|
+
i = r + 1;
|
|
8448
|
+
break;
|
|
8592
8449
|
}
|
|
8593
|
-
_this.value = _newValue;
|
|
8594
|
-
return _this;
|
|
8595
8450
|
}
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8451
|
+
return i;
|
|
8452
|
+
}
|
|
8453
|
+
function isFilled(e, t) {
|
|
8454
|
+
return getFilledLength(e, t) === e.mask.length;
|
|
8455
|
+
}
|
|
8456
|
+
function formatValue(e, t) {
|
|
8457
|
+
var n = e.maskChar,
|
|
8458
|
+
a = e.mask,
|
|
8459
|
+
i = e.prefix;
|
|
8460
|
+
if (!n) {
|
|
8461
|
+
for ((t = insertString(e, "", t, 0)).length < i.length && (t = i); t.length < a.length && isPermanentCharacter(e, t.length);) t += a[t.length];
|
|
8462
|
+
return t;
|
|
8463
|
+
}
|
|
8464
|
+
if (t) return insertString(e, formatValue(e, ""), t, 0);
|
|
8465
|
+
for (var r = 0; r < a.length; r++) isPermanentCharacter(e, r) ? t += a[r] : t += n;
|
|
8466
|
+
return t;
|
|
8467
|
+
}
|
|
8468
|
+
function clearRange(n, e, a, t) {
|
|
8469
|
+
var i = a + t,
|
|
8470
|
+
r = n.maskChar,
|
|
8471
|
+
o = n.mask,
|
|
8472
|
+
s = n.prefix,
|
|
8473
|
+
l = e.split("");
|
|
8474
|
+
if (r) return l.map(function (e, t) {
|
|
8475
|
+
return t < a || i <= t ? e : isPermanentCharacter(n, t) ? o[t] : r;
|
|
8476
|
+
}).join("");
|
|
8477
|
+
for (var u = i; u < l.length; u++) isPermanentCharacter(n, u) && (l[u] = "");
|
|
8478
|
+
return a = Math.max(s.length, a), l.splice(a, i - a), e = l.join(""), formatValue(n, e);
|
|
8479
|
+
}
|
|
8480
|
+
function insertString(r, o, e, s) {
|
|
8481
|
+
var l = r.mask,
|
|
8482
|
+
u = r.maskChar,
|
|
8483
|
+
c = r.prefix,
|
|
8484
|
+
t = e.split(""),
|
|
8485
|
+
h = isFilled(r, o);
|
|
8486
|
+
return !u && s > o.length && (o += l.slice(o.length, s)), t.every(function (e) {
|
|
8487
|
+
for (; i = e, isPermanentCharacter(r, a = s) && i !== l[a];) {
|
|
8488
|
+
if (s >= o.length && (o += l[s]), t = e, n = s, u && isPermanentCharacter(r, n) && t === u) return !0;
|
|
8489
|
+
if (++s >= l.length) return !1;
|
|
8603
8490
|
}
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8491
|
+
var t, n, a, i;
|
|
8492
|
+
return !isAllowedCharacter(r, s, e) && e !== u || (s < o.length ? o = u || h || s < c.length ? o.slice(0, s) + e + o.slice(s + 1) : (o = o.slice(0, s) + e + o.slice(s), formatValue(r, o)) : u || (o += e), ++s < l.length);
|
|
8493
|
+
}), o;
|
|
8494
|
+
}
|
|
8495
|
+
function getInsertStringLength(a, e, t, i) {
|
|
8496
|
+
var r = a.mask,
|
|
8497
|
+
o = a.maskChar,
|
|
8498
|
+
n = t.split(""),
|
|
8499
|
+
s = i;
|
|
8500
|
+
return n.every(function (e) {
|
|
8501
|
+
for (; n = e, isPermanentCharacter(a, t = i) && n !== r[t];) if (++i >= r.length) return !1;
|
|
8502
|
+
var t, n;
|
|
8503
|
+
return (isAllowedCharacter(a, i, e) || e === o) && i++, i < r.length;
|
|
8504
|
+
}), i - s;
|
|
8505
|
+
}
|
|
8506
|
+
function getLeftEditablePosition(e, t) {
|
|
8507
|
+
for (var n = t; 0 <= n; --n) if (!isPermanentCharacter(e, n)) return n;
|
|
8508
|
+
return null;
|
|
8509
|
+
}
|
|
8510
|
+
function getRightEditablePosition(e, t) {
|
|
8511
|
+
for (var n = e.mask, a = t; a < n.length; ++a) if (!isPermanentCharacter(e, a)) return a;
|
|
8512
|
+
return null;
|
|
8513
|
+
}
|
|
8514
|
+
function getStringValue(e) {
|
|
8515
|
+
return e || 0 === e ? e + "" : "";
|
|
8516
|
+
}
|
|
8517
|
+
function processChange(e, t, n, a, i) {
|
|
8518
|
+
var r = e.mask,
|
|
8519
|
+
o = e.prefix,
|
|
8520
|
+
s = e.lastEditablePosition,
|
|
8521
|
+
l = t,
|
|
8522
|
+
u = "",
|
|
8523
|
+
c = 0,
|
|
8524
|
+
h = 0,
|
|
8525
|
+
f = Math.min(i.start, n.start);
|
|
8526
|
+
if (n.end > i.start ? h = (c = getInsertStringLength(e, a, u = l.slice(i.start, n.end), f)) ? i.length : 0 : l.length < a.length && (h = a.length - l.length), l = a, h) {
|
|
8527
|
+
if (1 === h && !i.length) f = i.start === n.start ? getRightEditablePosition(e, n.start) : getLeftEditablePosition(e, n.start);
|
|
8528
|
+
l = clearRange(e, l, f, h);
|
|
8529
|
+
}
|
|
8530
|
+
return l = insertString(e, l, u, f), (f += c) >= r.length ? f = r.length : f < o.length && !c ? f = o.length : f >= o.length && f < s && c && (f = getRightEditablePosition(e, f)), u || (u = null), {
|
|
8531
|
+
value: l = formatValue(e, l),
|
|
8532
|
+
enteredString: u,
|
|
8533
|
+
selection: {
|
|
8534
|
+
start: f,
|
|
8535
|
+
end: f
|
|
8607
8536
|
}
|
|
8608
8537
|
};
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8538
|
+
}
|
|
8539
|
+
function isWindowsPhoneBrowser() {
|
|
8540
|
+
var e = new RegExp("windows", "i"),
|
|
8541
|
+
t = new RegExp("phone", "i"),
|
|
8542
|
+
n = navigator.userAgent;
|
|
8543
|
+
return e.test(n) && t.test(n);
|
|
8544
|
+
}
|
|
8545
|
+
function isFunction(e) {
|
|
8546
|
+
return "function" == typeof e;
|
|
8547
|
+
}
|
|
8548
|
+
function getRequestAnimationFrame() {
|
|
8549
|
+
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
|
|
8550
|
+
}
|
|
8551
|
+
function getCancelAnimationFrame() {
|
|
8552
|
+
return window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame;
|
|
8553
|
+
}
|
|
8554
|
+
function defer(e) {
|
|
8555
|
+
return (!!getCancelAnimationFrame() ? getRequestAnimationFrame() : function () {
|
|
8556
|
+
return setTimeout(e, 1e3 / 60);
|
|
8557
|
+
})(e);
|
|
8558
|
+
}
|
|
8559
|
+
function cancelDefer(e) {
|
|
8560
|
+
(getCancelAnimationFrame() || clearTimeout)(e);
|
|
8561
|
+
}
|
|
8562
|
+
var InputElement = function (c) {
|
|
8563
|
+
function e(e) {
|
|
8564
|
+
var f = c.call(this, e) || this;
|
|
8565
|
+
f.focused = !1, f.mounted = !1, f.previousSelection = null, f.selectionDeferId = null, f.saveSelectionLoopDeferId = null, f.saveSelectionLoop = function () {
|
|
8566
|
+
f.previousSelection = f.getSelection(), f.saveSelectionLoopDeferId = defer(f.saveSelectionLoop);
|
|
8567
|
+
}, f.runSaveSelectionLoop = function () {
|
|
8568
|
+
null === f.saveSelectionLoopDeferId && f.saveSelectionLoop();
|
|
8569
|
+
}, f.stopSaveSelectionLoop = function () {
|
|
8570
|
+
null !== f.saveSelectionLoopDeferId && (cancelDefer(f.saveSelectionLoopDeferId), f.saveSelectionLoopDeferId = null, f.previousSelection = null);
|
|
8571
|
+
}, f.getInputDOMNode = function () {
|
|
8572
|
+
if (!f.mounted) return null;
|
|
8573
|
+
var e = reactDom.findDOMNode(_assertThisInitialized(_assertThisInitialized(f))),
|
|
8574
|
+
t = "undefined" != typeof window && e instanceof window.Element;
|
|
8575
|
+
if (e && !t) return null;
|
|
8576
|
+
if ("INPUT" !== e.nodeName && (e = e.querySelector("input")), !e) throw new Error("react-input-mask: inputComponent doesn't contain input node");
|
|
8577
|
+
return e;
|
|
8578
|
+
}, f.getInputValue = function () {
|
|
8579
|
+
var e = f.getInputDOMNode();
|
|
8580
|
+
return e ? e.value : null;
|
|
8581
|
+
}, f.setInputValue = function (e) {
|
|
8582
|
+
var t = f.getInputDOMNode();
|
|
8583
|
+
t && (f.value = e, t.value = e);
|
|
8584
|
+
}, f.setCursorToEnd = function () {
|
|
8585
|
+
var e = getFilledLength(f.maskOptions, f.value),
|
|
8586
|
+
t = getRightEditablePosition(f.maskOptions, e);
|
|
8587
|
+
null !== t && f.setCursorPosition(t);
|
|
8588
|
+
}, f.setSelection = function (e, t, n) {
|
|
8589
|
+
void 0 === n && (n = {});
|
|
8590
|
+
var a = f.getInputDOMNode(),
|
|
8591
|
+
i = f.isFocused();
|
|
8592
|
+
a && i && (n.deferred || setInputSelection(a, e, t), null !== f.selectionDeferId && cancelDefer(f.selectionDeferId), f.selectionDeferId = defer(function () {
|
|
8593
|
+
f.selectionDeferId = null, setInputSelection(a, e, t);
|
|
8594
|
+
}), f.previousSelection = {
|
|
8595
|
+
start: e,
|
|
8596
|
+
end: t,
|
|
8597
|
+
length: Math.abs(t - e)
|
|
8598
|
+
});
|
|
8599
|
+
}, f.getSelection = function () {
|
|
8600
|
+
return getInputSelection(f.getInputDOMNode());
|
|
8601
|
+
}, f.getCursorPosition = function () {
|
|
8602
|
+
return f.getSelection().start;
|
|
8603
|
+
}, f.setCursorPosition = function (e) {
|
|
8604
|
+
f.setSelection(e, e);
|
|
8605
|
+
}, f.isFocused = function () {
|
|
8606
|
+
return f.focused;
|
|
8607
|
+
}, f.getBeforeMaskedValueChangeConfig = function () {
|
|
8608
|
+
var e = f.maskOptions,
|
|
8609
|
+
t = e.mask,
|
|
8610
|
+
n = e.maskChar,
|
|
8611
|
+
a = e.permanents,
|
|
8612
|
+
i = e.formatChars;
|
|
8613
|
+
return {
|
|
8614
|
+
mask: t,
|
|
8615
|
+
maskChar: n,
|
|
8616
|
+
permanents: a,
|
|
8617
|
+
alwaysShowMask: !!f.props.alwaysShowMask,
|
|
8618
|
+
formatChars: i
|
|
8619
|
+
};
|
|
8620
|
+
}, f.isInputAutofilled = function (e, t, n, a) {
|
|
8621
|
+
var i = f.getInputDOMNode();
|
|
8622
|
+
try {
|
|
8623
|
+
if (i.matches(":-webkit-autofill")) return !0;
|
|
8624
|
+
} catch (r) {}
|
|
8625
|
+
return !f.focused || a.end < n.length && t.end === e.length;
|
|
8626
|
+
}, f.onChange = function (e) {
|
|
8627
|
+
var t = _assertThisInitialized(_assertThisInitialized(f)).beforePasteState,
|
|
8628
|
+
n = _assertThisInitialized(_assertThisInitialized(f)).previousSelection,
|
|
8629
|
+
a = f.props.beforeMaskedValueChange,
|
|
8630
|
+
i = f.getInputValue(),
|
|
8631
|
+
r = f.value,
|
|
8632
|
+
o = f.getSelection();
|
|
8633
|
+
f.isInputAutofilled(i, o, r, n) && (r = formatValue(f.maskOptions, ""), n = {
|
|
8634
|
+
start: 0,
|
|
8635
|
+
end: 0,
|
|
8636
|
+
length: 0
|
|
8637
|
+
}), t && (n = t.selection, r = t.value, o = {
|
|
8638
|
+
start: n.start + i.length,
|
|
8639
|
+
end: n.start + i.length,
|
|
8640
|
+
length: 0
|
|
8641
|
+
}, i = r.slice(0, n.start) + i + r.slice(n.end), f.beforePasteState = null);
|
|
8642
|
+
var s = processChange(f.maskOptions, i, o, r, n),
|
|
8643
|
+
l = s.enteredString,
|
|
8644
|
+
u = s.selection,
|
|
8645
|
+
c = s.value;
|
|
8646
|
+
if (isFunction(a)) {
|
|
8647
|
+
var h = a({
|
|
8648
|
+
value: c,
|
|
8649
|
+
selection: u
|
|
8650
|
+
}, {
|
|
8651
|
+
value: r,
|
|
8652
|
+
selection: n
|
|
8653
|
+
}, l, f.getBeforeMaskedValueChangeConfig());
|
|
8654
|
+
c = h.value, u = h.selection;
|
|
8629
8655
|
}
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
}
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8656
|
+
f.setInputValue(c), isFunction(f.props.onChange) && f.props.onChange(e), f.isWindowsPhoneBrowser ? f.setSelection(u.start, u.end, {
|
|
8657
|
+
deferred: !0
|
|
8658
|
+
}) : f.setSelection(u.start, u.end);
|
|
8659
|
+
}, f.onFocus = function (e) {
|
|
8660
|
+
var t = f.props.beforeMaskedValueChange,
|
|
8661
|
+
n = f.maskOptions,
|
|
8662
|
+
a = n.mask,
|
|
8663
|
+
i = n.prefix;
|
|
8664
|
+
if (f.focused = !0, f.mounted = !0, a) {
|
|
8665
|
+
if (f.value) getFilledLength(f.maskOptions, f.value) < f.maskOptions.mask.length && f.setCursorToEnd();else {
|
|
8666
|
+
var r = formatValue(f.maskOptions, i),
|
|
8667
|
+
o = formatValue(f.maskOptions, r),
|
|
8668
|
+
s = getFilledLength(f.maskOptions, o),
|
|
8669
|
+
l = getRightEditablePosition(f.maskOptions, s),
|
|
8670
|
+
u = {
|
|
8671
|
+
start: l,
|
|
8672
|
+
end: l
|
|
8673
|
+
};
|
|
8674
|
+
if (isFunction(t)) {
|
|
8675
|
+
var c = t({
|
|
8676
|
+
value: o,
|
|
8677
|
+
selection: u
|
|
8678
|
+
}, {
|
|
8679
|
+
value: f.value,
|
|
8680
|
+
selection: null
|
|
8681
|
+
}, null, f.getBeforeMaskedValueChangeConfig());
|
|
8682
|
+
o = c.value, u = c.selection;
|
|
8683
|
+
}
|
|
8684
|
+
var h = o !== f.getInputValue();
|
|
8685
|
+
h && f.setInputValue(o), h && isFunction(f.props.onChange) && f.props.onChange(e), f.setSelection(u.start, u.end);
|
|
8648
8686
|
}
|
|
8687
|
+
f.runSaveSelectionLoop();
|
|
8649
8688
|
}
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8689
|
+
isFunction(f.props.onFocus) && f.props.onFocus(e);
|
|
8690
|
+
}, f.onBlur = function (e) {
|
|
8691
|
+
var t = f.props.beforeMaskedValueChange,
|
|
8692
|
+
n = f.maskOptions.mask;
|
|
8693
|
+
if (f.stopSaveSelectionLoop(), f.focused = !1, n && !f.props.alwaysShowMask && isEmpty(f.maskOptions, f.value)) {
|
|
8694
|
+
var a = "";
|
|
8695
|
+
if (isFunction(t)) a = t({
|
|
8696
|
+
value: a,
|
|
8697
|
+
selection: null
|
|
8698
|
+
}, {
|
|
8699
|
+
value: f.value,
|
|
8700
|
+
selection: f.previousSelection
|
|
8701
|
+
}, null, f.getBeforeMaskedValueChangeConfig()).value;
|
|
8702
|
+
var i = a !== f.getInputValue();
|
|
8703
|
+
i && f.setInputValue(a), i && isFunction(f.props.onChange) && f.props.onChange(e);
|
|
8704
|
+
}
|
|
8705
|
+
isFunction(f.props.onBlur) && f.props.onBlur(e);
|
|
8706
|
+
}, f.onMouseDown = function (e) {
|
|
8707
|
+
if (!f.focused && document.addEventListener) {
|
|
8708
|
+
f.mouseDownX = e.clientX, f.mouseDownY = e.clientY, f.mouseDownTime = new Date().getTime();
|
|
8709
|
+
var r = function r(e) {
|
|
8710
|
+
if (document.removeEventListener("mouseup", r), f.focused) {
|
|
8711
|
+
var t = Math.abs(e.clientX - f.mouseDownX),
|
|
8712
|
+
n = Math.abs(e.clientY - f.mouseDownY),
|
|
8713
|
+
a = Math.max(t, n),
|
|
8714
|
+
i = new Date().getTime() - f.mouseDownTime;
|
|
8715
|
+
(a <= 10 && i <= 200 || a <= 5 && i <= 300) && f.setCursorToEnd();
|
|
8716
|
+
}
|
|
8717
|
+
};
|
|
8718
|
+
document.addEventListener("mouseup", r);
|
|
8719
|
+
}
|
|
8720
|
+
isFunction(f.props.onMouseDown) && f.props.onMouseDown(e);
|
|
8721
|
+
}, f.onPaste = function (e) {
|
|
8722
|
+
isFunction(f.props.onPaste) && f.props.onPaste(e), e.defaultPrevented || (f.beforePasteState = {
|
|
8723
|
+
value: f.getInputValue(),
|
|
8724
|
+
selection: f.getSelection()
|
|
8725
|
+
}, f.setInputValue(""));
|
|
8726
|
+
}, f.handleRef = function (e) {
|
|
8727
|
+
null == f.props.children && isFunction(f.props.inputRef) && f.props.inputRef(e);
|
|
8657
8728
|
};
|
|
8658
|
-
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
|
|
8729
|
+
var t = e.mask,
|
|
8730
|
+
n = e.maskChar,
|
|
8731
|
+
a = e.formatChars,
|
|
8732
|
+
i = e.alwaysShowMask,
|
|
8733
|
+
r = e.beforeMaskedValueChange,
|
|
8734
|
+
o = e.defaultValue,
|
|
8735
|
+
s = e.value;
|
|
8736
|
+
f.maskOptions = parseMask(t, n, a), null == o && (o = ""), null == s && (s = o);
|
|
8737
|
+
var l = getStringValue(s);
|
|
8738
|
+
if (f.maskOptions.mask && (i || l) && (l = formatValue(f.maskOptions, l), isFunction(r))) {
|
|
8739
|
+
var u = e.value;
|
|
8740
|
+
null == e.value && (u = o), l = r({
|
|
8741
|
+
value: l,
|
|
8742
|
+
selection: null
|
|
8662
8743
|
}, {
|
|
8663
|
-
value:
|
|
8664
|
-
selection:
|
|
8665
|
-
}, null,
|
|
8666
|
-
newValue = modifiedValue.value;
|
|
8667
|
-
newSelection = modifiedValue.selection;
|
|
8668
|
-
}
|
|
8669
|
-
this.value = newValue;
|
|
8670
|
-
var isValueChanged = this.getInputValue() !== this.value; // render depends on this.maskOptions and this.value,
|
|
8671
|
-
// call forceUpdate to keep it in sync
|
|
8672
|
-
|
|
8673
|
-
if (isValueChanged) {
|
|
8674
|
-
this.setInputValue(this.value);
|
|
8675
|
-
this.forceUpdate();
|
|
8676
|
-
} else if (isMaskChanged) {
|
|
8677
|
-
this.forceUpdate();
|
|
8678
|
-
}
|
|
8679
|
-
var isSelectionChanged = false;
|
|
8680
|
-
if (newSelection.start != null && newSelection.end != null) {
|
|
8681
|
-
isSelectionChanged = !previousSelection || previousSelection.start !== newSelection.start || previousSelection.end !== newSelection.end;
|
|
8682
|
-
}
|
|
8683
|
-
if (isSelectionChanged || isValueChanged) {
|
|
8684
|
-
this.setSelection(newSelection.start, newSelection.end);
|
|
8685
|
-
}
|
|
8686
|
-
};
|
|
8687
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
8688
|
-
this.mounted = false;
|
|
8689
|
-
if (this.selectionDeferId !== null) {
|
|
8690
|
-
cancelDefer(this.selectionDeferId);
|
|
8691
|
-
}
|
|
8692
|
-
this.stopSaveSelectionLoop();
|
|
8693
|
-
};
|
|
8694
|
-
_proto.render = function render() {
|
|
8695
|
-
var _this$props2 = this.props,
|
|
8696
|
-
mask = _this$props2.mask;
|
|
8697
|
-
_this$props2.alwaysShowMask;
|
|
8698
|
-
var maskChar = _this$props2.maskChar,
|
|
8699
|
-
formatChars = _this$props2.formatChars,
|
|
8700
|
-
inputRef = _this$props2.inputRef;
|
|
8701
|
-
_this$props2.beforeMaskedValueChange;
|
|
8702
|
-
var children = _this$props2.children,
|
|
8703
|
-
restProps = _objectWithoutPropertiesLoose(_this$props2, ["mask", "alwaysShowMask", "maskChar", "formatChars", "inputRef", "beforeMaskedValueChange", "children"]);
|
|
8704
|
-
var inputElement;
|
|
8705
|
-
process.env.NODE_ENV !== "production" ? warning(
|
|
8706
|
-
// parse mask to test against actual mask prop as this.maskOptions
|
|
8707
|
-
// will be updated later in componentDidUpdate
|
|
8708
|
-
!restProps.maxLength || !parseMask(mask, maskChar, formatChars).mask, 'react-input-mask: maxLength property shouldn\'t be passed to the masked input. It breaks masking and unnecessary because length is limited by the mask length.') : void 0;
|
|
8709
|
-
if (children) {
|
|
8710
|
-
!isFunction(children) ? process.env.NODE_ENV !== "production" ? invariant(false, 'react-input-mask: children must be a function') : invariant(false) : void 0;
|
|
8711
|
-
var controlledProps = ['onChange', 'onPaste', 'onMouseDown', 'onFocus', 'onBlur', 'value', 'disabled', 'readOnly'];
|
|
8712
|
-
var childrenProps = _extends({}, restProps);
|
|
8713
|
-
controlledProps.forEach(function (propId) {
|
|
8714
|
-
return delete childrenProps[propId];
|
|
8715
|
-
});
|
|
8716
|
-
inputElement = children(childrenProps);
|
|
8717
|
-
var conflictProps = controlledProps.filter(function (propId) {
|
|
8718
|
-
return inputElement.props[propId] != null && inputElement.props[propId] !== restProps[propId];
|
|
8719
|
-
});
|
|
8720
|
-
!!conflictProps.length ? process.env.NODE_ENV !== "production" ? invariant(false, "react-input-mask: the following props should be passed to the react-input-mask's component and should not be altered in children's function: " + conflictProps.join(', ')) : invariant(false) : void 0;
|
|
8721
|
-
process.env.NODE_ENV !== "production" ? warning(!inputRef, 'react-input-mask: inputRef is ignored when children is passed, attach ref to the children instead') : void 0;
|
|
8722
|
-
} else {
|
|
8723
|
-
inputElement = React$1.createElement("input", _extends({
|
|
8724
|
-
ref: this.handleRef
|
|
8725
|
-
}, restProps));
|
|
8744
|
+
value: u = getStringValue(u),
|
|
8745
|
+
selection: null
|
|
8746
|
+
}, null, f.getBeforeMaskedValueChangeConfig()).value;
|
|
8726
8747
|
}
|
|
8727
|
-
|
|
8748
|
+
return f.value = l, f;
|
|
8749
|
+
}
|
|
8750
|
+
_inheritsLoose(e, c);
|
|
8751
|
+
var t = e.prototype;
|
|
8752
|
+
return t.componentDidMount = function () {
|
|
8753
|
+
this.mounted = !0, this.getInputDOMNode() && (this.isWindowsPhoneBrowser = isWindowsPhoneBrowser(), this.maskOptions.mask && this.getInputValue() !== this.value && this.setInputValue(this.value));
|
|
8754
|
+
}, t.componentDidUpdate = function () {
|
|
8755
|
+
var e = this.previousSelection,
|
|
8756
|
+
t = this.props,
|
|
8757
|
+
n = t.beforeMaskedValueChange,
|
|
8758
|
+
a = t.alwaysShowMask,
|
|
8759
|
+
i = t.mask,
|
|
8760
|
+
r = t.maskChar,
|
|
8761
|
+
o = t.formatChars,
|
|
8762
|
+
s = this.maskOptions,
|
|
8763
|
+
l = a || this.isFocused(),
|
|
8764
|
+
u = null != this.props.value,
|
|
8765
|
+
c = u ? getStringValue(this.props.value) : this.value,
|
|
8766
|
+
h = e ? e.start : null;
|
|
8767
|
+
if (this.maskOptions = parseMask(i, r, o), this.maskOptions.mask) {
|
|
8768
|
+
!s.mask && this.isFocused() && this.runSaveSelectionLoop();
|
|
8769
|
+
var f = this.maskOptions.mask && this.maskOptions.mask !== s.mask;
|
|
8770
|
+
if (s.mask || u || (c = this.getInputValue()), (f || this.maskOptions.mask && (c || l)) && (c = formatValue(this.maskOptions, c)), f) {
|
|
8771
|
+
var p = getFilledLength(this.maskOptions, c);
|
|
8772
|
+
(null === h || p < h) && (h = isFilled(this.maskOptions, c) ? p : getRightEditablePosition(this.maskOptions, p));
|
|
8773
|
+
}
|
|
8774
|
+
!this.maskOptions.mask || !isEmpty(this.maskOptions, c) || l || u && this.props.value || (c = "");
|
|
8775
|
+
var d = {
|
|
8776
|
+
start: h,
|
|
8777
|
+
end: h
|
|
8778
|
+
};
|
|
8779
|
+
if (isFunction(n)) {
|
|
8780
|
+
var m = n({
|
|
8781
|
+
value: c,
|
|
8782
|
+
selection: d
|
|
8783
|
+
}, {
|
|
8784
|
+
value: this.value,
|
|
8785
|
+
selection: this.previousSelection
|
|
8786
|
+
}, null, this.getBeforeMaskedValueChangeConfig());
|
|
8787
|
+
c = m.value, d = m.selection;
|
|
8788
|
+
}
|
|
8789
|
+
this.value = c;
|
|
8790
|
+
var g = this.getInputValue() !== this.value;
|
|
8791
|
+
g ? (this.setInputValue(this.value), this.forceUpdate()) : f && this.forceUpdate();
|
|
8792
|
+
var v = !1;
|
|
8793
|
+
null != d.start && null != d.end && (v = !e || e.start !== d.start || e.end !== d.end), (v || g) && this.setSelection(d.start, d.end);
|
|
8794
|
+
} else s.mask && (this.stopSaveSelectionLoop(), this.forceUpdate());
|
|
8795
|
+
}, t.componentWillUnmount = function () {
|
|
8796
|
+
this.mounted = !1, null !== this.selectionDeferId && cancelDefer(this.selectionDeferId), this.stopSaveSelectionLoop();
|
|
8797
|
+
}, t.render = function () {
|
|
8798
|
+
var t,
|
|
8799
|
+
e = this.props,
|
|
8800
|
+
n = (e.mask, e.alwaysShowMask, e.maskChar, e.formatChars, e.inputRef, e.beforeMaskedValueChange, e.children),
|
|
8801
|
+
a = _objectWithoutPropertiesLoose(e, ["mask", "alwaysShowMask", "maskChar", "formatChars", "inputRef", "beforeMaskedValueChange", "children"]);
|
|
8802
|
+
if (n) {
|
|
8803
|
+
isFunction(n) || invariant_1(!1);
|
|
8804
|
+
var i = ["onChange", "onPaste", "onMouseDown", "onFocus", "onBlur", "value", "disabled", "readOnly"],
|
|
8805
|
+
r = _extends({}, a);
|
|
8806
|
+
i.forEach(function (e) {
|
|
8807
|
+
return delete r[e];
|
|
8808
|
+
}), t = n(r), i.filter(function (e) {
|
|
8809
|
+
return null != t.props[e] && t.props[e] !== a[e];
|
|
8810
|
+
}).length && invariant_1(!1);
|
|
8811
|
+
} else t = React$1.createElement("input", _extends({
|
|
8812
|
+
ref: this.handleRef
|
|
8813
|
+
}, a));
|
|
8814
|
+
var o = {
|
|
8728
8815
|
onFocus: this.onFocus,
|
|
8729
8816
|
onBlur: this.onBlur
|
|
8730
8817
|
};
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
changedProps.onChange = this.onChange;
|
|
8734
|
-
changedProps.onPaste = this.onPaste;
|
|
8735
|
-
changedProps.onMouseDown = this.onMouseDown;
|
|
8736
|
-
}
|
|
8737
|
-
if (restProps.value != null) {
|
|
8738
|
-
changedProps.value = this.value;
|
|
8739
|
-
}
|
|
8740
|
-
}
|
|
8741
|
-
inputElement = React$1.cloneElement(inputElement, changedProps);
|
|
8742
|
-
return inputElement;
|
|
8743
|
-
};
|
|
8744
|
-
return InputElement;
|
|
8818
|
+
return this.maskOptions.mask && (a.disabled || a.readOnly || (o.onChange = this.onChange, o.onPaste = this.onPaste, o.onMouseDown = this.onMouseDown), null != a.value && (o.value = this.value)), t = React$1.cloneElement(t, o);
|
|
8819
|
+
}, e;
|
|
8745
8820
|
}(React$1.Component);
|
|
8746
|
-
|
|
8747
|
-
return
|
|
8821
|
+
reactInputMask_production_min = InputElement;
|
|
8822
|
+
return reactInputMask_production_min;
|
|
8748
8823
|
}
|
|
8749
8824
|
|
|
8750
8825
|
if (process.env.NODE_ENV === 'production') {
|
|
@@ -8825,7 +8900,7 @@ var cardTypes$1 = {
|
|
|
8825
8900
|
unionpay: {
|
|
8826
8901
|
niceType: "UnionPay",
|
|
8827
8902
|
type: "unionpay",
|
|
8828
|
-
patterns: [620, [
|
|
8903
|
+
patterns: [620, [62100, 62182], [62184, 62187], [62185, 62197], [62200, 62205], [622010, 622999], 622018, [62207, 62209], [623, 626], 6270, 6272, 6276, [627700, 627779], [627781, 627799], [6282, 6289], 6291, 6292, 810, [8110, 8131], [8132, 8151], [8152, 8163], [8164, 8171]],
|
|
8829
8904
|
gaps: [4, 8, 12],
|
|
8830
8905
|
lengths: [14, 15, 16, 17, 18, 19],
|
|
8831
8906
|
code: {
|
|
@@ -8946,10 +9021,10 @@ function addMatchingCardsToResults(cardNumber, cardConfiguration, results) {
|
|
|
8946
9021
|
var i, patternLength;
|
|
8947
9022
|
for (i = 0; i < cardConfiguration.patterns.length; i++) {
|
|
8948
9023
|
var pattern = cardConfiguration.patterns[i];
|
|
8949
|
-
if (!matches_1.matches(cardNumber, pattern)) {
|
|
9024
|
+
if (!(0, matches_1.matches)(cardNumber, pattern)) {
|
|
8950
9025
|
continue;
|
|
8951
9026
|
}
|
|
8952
|
-
var clonedCardConfiguration = clone_1$1.clone(cardConfiguration);
|
|
9027
|
+
var clonedCardConfiguration = (0, clone_1$1.clone)(cardConfiguration);
|
|
8953
9028
|
if (Array.isArray(pattern)) {
|
|
8954
9029
|
patternLength = String(pattern[0]).length;
|
|
8955
9030
|
} else {
|
|
@@ -9043,13 +9118,13 @@ var cardNames = {
|
|
|
9043
9118
|
HIPERCARD: "hipercard"
|
|
9044
9119
|
};
|
|
9045
9120
|
var ORIGINAL_TEST_ORDER = [cardNames.VISA, cardNames.MASTERCARD, cardNames.AMERICAN_EXPRESS, cardNames.DINERS_CLUB, cardNames.DISCOVER, cardNames.JCB, cardNames.UNIONPAY, cardNames.MAESTRO, cardNames.ELO, cardNames.MIR, cardNames.HIPER, cardNames.HIPERCARD];
|
|
9046
|
-
var testOrder = clone_1.clone(ORIGINAL_TEST_ORDER);
|
|
9121
|
+
var testOrder = (0, clone_1.clone)(ORIGINAL_TEST_ORDER);
|
|
9047
9122
|
function findType(cardType) {
|
|
9048
9123
|
return customCards[cardType] || cardTypes[cardType];
|
|
9049
9124
|
}
|
|
9050
9125
|
function getAllCardTypes() {
|
|
9051
9126
|
return testOrder.map(function (cardType) {
|
|
9052
|
-
return clone_1.clone(findType(cardType));
|
|
9127
|
+
return (0, clone_1.clone)(findType(cardType));
|
|
9053
9128
|
});
|
|
9054
9129
|
}
|
|
9055
9130
|
function getCardPosition(name, ignoreErrorForNotExisting) {
|
|
@@ -9064,7 +9139,7 @@ function getCardPosition(name, ignoreErrorForNotExisting) {
|
|
|
9064
9139
|
}
|
|
9065
9140
|
function creditCardType(cardNumber) {
|
|
9066
9141
|
var results = [];
|
|
9067
|
-
if (!is_valid_input_type_1.isValidInputType(cardNumber)) {
|
|
9142
|
+
if (!(0, is_valid_input_type_1.isValidInputType)(cardNumber)) {
|
|
9068
9143
|
return results;
|
|
9069
9144
|
}
|
|
9070
9145
|
if (cardNumber.length === 0) {
|
|
@@ -9072,16 +9147,16 @@ function creditCardType(cardNumber) {
|
|
|
9072
9147
|
}
|
|
9073
9148
|
testOrder.forEach(function (cardType) {
|
|
9074
9149
|
var cardConfiguration = findType(cardType);
|
|
9075
|
-
add_matching_cards_to_results_1.addMatchingCardsToResults(cardNumber, cardConfiguration, results);
|
|
9150
|
+
(0, add_matching_cards_to_results_1.addMatchingCardsToResults)(cardNumber, cardConfiguration, results);
|
|
9076
9151
|
});
|
|
9077
|
-
var bestMatch = find_best_match_1.findBestMatch(results);
|
|
9152
|
+
var bestMatch = (0, find_best_match_1.findBestMatch)(results);
|
|
9078
9153
|
if (bestMatch) {
|
|
9079
9154
|
return [bestMatch];
|
|
9080
9155
|
}
|
|
9081
9156
|
return results;
|
|
9082
9157
|
}
|
|
9083
9158
|
creditCardType.getTypeInfo = function (cardType) {
|
|
9084
|
-
return clone_1.clone(findType(cardType));
|
|
9159
|
+
return (0, clone_1.clone)(findType(cardType));
|
|
9085
9160
|
};
|
|
9086
9161
|
creditCardType.removeCard = function (name) {
|
|
9087
9162
|
var position = getCardPosition(name);
|
|
@@ -9097,12 +9172,12 @@ creditCardType.addCard = function (config) {
|
|
|
9097
9172
|
creditCardType.updateCard = function (cardType, updates) {
|
|
9098
9173
|
var originalObject = customCards[cardType] || cardTypes[cardType];
|
|
9099
9174
|
if (!originalObject) {
|
|
9100
|
-
throw new Error("\""
|
|
9175
|
+
throw new Error("\"".concat(cardType, "\" is not a recognized type. Use `addCard` instead.'"));
|
|
9101
9176
|
}
|
|
9102
9177
|
if (updates.type && originalObject.type !== updates.type) {
|
|
9103
9178
|
throw new Error("Cannot overwrite type parameter.");
|
|
9104
9179
|
}
|
|
9105
|
-
var clonedCard = clone_1.clone(originalObject);
|
|
9180
|
+
var clonedCard = (0, clone_1.clone)(originalObject);
|
|
9106
9181
|
clonedCard = __assign$8(__assign$8({}, clonedCard), updates);
|
|
9107
9182
|
customCards[clonedCard.type] = clonedCard;
|
|
9108
9183
|
};
|
|
@@ -9112,7 +9187,7 @@ creditCardType.changeOrder = function (name, position) {
|
|
|
9112
9187
|
testOrder.splice(position, 0, name);
|
|
9113
9188
|
};
|
|
9114
9189
|
creditCardType.resetModifications = function () {
|
|
9115
|
-
testOrder = clone_1.clone(ORIGINAL_TEST_ORDER);
|
|
9190
|
+
testOrder = (0, clone_1.clone)(ORIGINAL_TEST_ORDER);
|
|
9116
9191
|
customCards = {};
|
|
9117
9192
|
};
|
|
9118
9193
|
creditCardType.types = cardNames;
|
|
@@ -9194,8 +9269,8 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
9194
9269
|
"aria-label": label || placeholder,
|
|
9195
9270
|
ref: ref,
|
|
9196
9271
|
onChange: function onChange(event) {
|
|
9197
|
-
_onChange === null || _onChange === void 0
|
|
9198
|
-
onChangeEvent === null || onChangeEvent === void 0
|
|
9272
|
+
_onChange === null || _onChange === void 0 || _onChange(event.target.value);
|
|
9273
|
+
onChangeEvent === null || onChangeEvent === void 0 || onChangeEvent(event);
|
|
9199
9274
|
}
|
|
9200
9275
|
}, rest));
|
|
9201
9276
|
});
|
|
@@ -9653,12 +9728,12 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
9653
9728
|
var handleClear = React.useCallback(function () {
|
|
9654
9729
|
var _ref$current;
|
|
9655
9730
|
setValue(DEFAULT_INPUT_VALUE);
|
|
9656
|
-
onChange === null || onChange === void 0
|
|
9657
|
-
onClear === null || onClear === void 0
|
|
9658
|
-
(_ref$current = ref.current) === null || _ref$current === void 0
|
|
9731
|
+
onChange === null || onChange === void 0 || onChange(DEFAULT_INPUT_VALUE);
|
|
9732
|
+
onClear === null || onClear === void 0 || onClear();
|
|
9733
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.focus();
|
|
9659
9734
|
}, [onClear, onChange]);
|
|
9660
9735
|
var handleChange = React.useCallback(function (value) {
|
|
9661
|
-
onChange === null || onChange === void 0
|
|
9736
|
+
onChange === null || onChange === void 0 || onChange(value);
|
|
9662
9737
|
setValue(value);
|
|
9663
9738
|
}, [onChange, setValue]);
|
|
9664
9739
|
React.useEffect(function () {
|
|
@@ -9680,16 +9755,16 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
9680
9755
|
}, /*#__PURE__*/React.createElement(Exit20, null)));
|
|
9681
9756
|
};
|
|
9682
9757
|
|
|
9683
|
-
var t
|
|
9758
|
+
var t = function t(_t) {
|
|
9684
9759
|
return "object" == _typeof$1(_t) && null != _t && 1 === _t.nodeType;
|
|
9685
9760
|
},
|
|
9686
|
-
e = function e(t, _e) {
|
|
9761
|
+
e$1 = function e(t, _e) {
|
|
9687
9762
|
return (!_e || "hidden" !== t) && "visible" !== t && "clip" !== t;
|
|
9688
9763
|
},
|
|
9689
9764
|
n = function n(t, _n) {
|
|
9690
9765
|
if (t.clientHeight < t.scrollHeight || t.clientWidth < t.scrollWidth) {
|
|
9691
9766
|
var _l = getComputedStyle(t, null);
|
|
9692
|
-
return e(_l.overflowY, _n) || e(_l.overflowX, _n) || function (t) {
|
|
9767
|
+
return e$1(_l.overflowY, _n) || e$1(_l.overflowX, _n) || function (t) {
|
|
9693
9768
|
var e = function (t) {
|
|
9694
9769
|
if (!t.ownerDocument || !t.ownerDocument.defaultView) return null;
|
|
9695
9770
|
try {
|
|
@@ -9721,11 +9796,11 @@ var t$1 = function t(_t) {
|
|
|
9721
9796
|
m = "function" == typeof a ? a : function (t) {
|
|
9722
9797
|
return t !== a;
|
|
9723
9798
|
};
|
|
9724
|
-
if (!t
|
|
9799
|
+
if (!t(e)) throw new TypeError("Invalid target");
|
|
9725
9800
|
var p = document.scrollingElement || document.documentElement,
|
|
9726
9801
|
w = [],
|
|
9727
9802
|
W = e;
|
|
9728
|
-
for (; t
|
|
9803
|
+
for (; t(W) && m(W);) {
|
|
9729
9804
|
if (W = i(W), W === p) {
|
|
9730
9805
|
w.push(W);
|
|
9731
9806
|
break;
|
|
@@ -9783,42 +9858,53 @@ var t$1 = function t(_t) {
|
|
|
9783
9858
|
return k;
|
|
9784
9859
|
};
|
|
9785
9860
|
|
|
9786
|
-
var o = function o(
|
|
9787
|
-
return !1 ===
|
|
9861
|
+
var o = function o(t) {
|
|
9862
|
+
return !1 === t ? {
|
|
9788
9863
|
block: "end",
|
|
9789
9864
|
inline: "nearest"
|
|
9790
|
-
} : function (
|
|
9791
|
-
return
|
|
9792
|
-
}(
|
|
9865
|
+
} : function (t) {
|
|
9866
|
+
return t === Object(t) && 0 !== Object.keys(t).length;
|
|
9867
|
+
}(t) ? t : {
|
|
9793
9868
|
block: "start",
|
|
9794
9869
|
inline: "nearest"
|
|
9795
9870
|
};
|
|
9796
9871
|
};
|
|
9797
|
-
function
|
|
9798
|
-
if (!
|
|
9799
|
-
var o =
|
|
9872
|
+
function e(e, r) {
|
|
9873
|
+
if (!e.isConnected || !function (t) {
|
|
9874
|
+
var o = t;
|
|
9800
9875
|
for (; o && o.parentNode;) {
|
|
9801
9876
|
if (o.parentNode === document) return !0;
|
|
9802
9877
|
o = o.parentNode instanceof ShadowRoot ? o.parentNode.host : o.parentNode;
|
|
9803
9878
|
}
|
|
9804
9879
|
return !1;
|
|
9805
|
-
}(
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
|
|
9880
|
+
}(e)) return;
|
|
9881
|
+
var n = function (t) {
|
|
9882
|
+
var o = window.getComputedStyle(t);
|
|
9883
|
+
return {
|
|
9884
|
+
top: parseFloat(o.scrollMarginTop) || 0,
|
|
9885
|
+
right: parseFloat(o.scrollMarginRight) || 0,
|
|
9886
|
+
bottom: parseFloat(o.scrollMarginBottom) || 0,
|
|
9887
|
+
left: parseFloat(o.scrollMarginLeft) || 0
|
|
9888
|
+
};
|
|
9889
|
+
}(e);
|
|
9890
|
+
if (function (t) {
|
|
9891
|
+
return "object" == _typeof$1(t) && "function" == typeof t.behavior;
|
|
9892
|
+
}(r)) return r.behavior(o$1(e, r));
|
|
9893
|
+
var l = "boolean" == typeof r || null == r ? void 0 : r.behavior;
|
|
9894
|
+
var _iterator = _createForOfIteratorHelper(o$1(e, o(r))),
|
|
9811
9895
|
_step;
|
|
9812
9896
|
try {
|
|
9813
9897
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
9814
9898
|
var _step$value = _step.value,
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
i.
|
|
9819
|
-
|
|
9820
|
-
|
|
9821
|
-
|
|
9899
|
+
a = _step$value.el,
|
|
9900
|
+
i = _step$value.top,
|
|
9901
|
+
s = _step$value.left;
|
|
9902
|
+
var _t = i - n.top + n.bottom,
|
|
9903
|
+
_o = s - n.left + n.right;
|
|
9904
|
+
a.scroll({
|
|
9905
|
+
top: _t,
|
|
9906
|
+
left: _o,
|
|
9907
|
+
behavior: l
|
|
9822
9908
|
});
|
|
9823
9909
|
}
|
|
9824
9910
|
} catch (err) {
|
|
@@ -9842,7 +9928,7 @@ var SelectOption = function SelectOption(_ref) {
|
|
|
9842
9928
|
}, [onClick, option]);
|
|
9843
9929
|
React.useEffect(function () {
|
|
9844
9930
|
if (active && ref.current) {
|
|
9845
|
-
|
|
9931
|
+
e(ref.current, {
|
|
9846
9932
|
scrollMode: 'if-needed',
|
|
9847
9933
|
block: 'nearest'
|
|
9848
9934
|
});
|
|
@@ -10083,7 +10169,7 @@ var Select = function Select(_ref) {
|
|
|
10083
10169
|
value: autoSelect ? option.value : value !== null && value !== void 0 ? value : option.value
|
|
10084
10170
|
}
|
|
10085
10171
|
});
|
|
10086
|
-
onChange === null || onChange === void 0
|
|
10172
|
+
onChange === null || onChange === void 0 || onChange(option.value);
|
|
10087
10173
|
}, [autoSelect, value, dispatch, onChange]);
|
|
10088
10174
|
var handleFocus = React.useCallback(function (option) {
|
|
10089
10175
|
return dispatch({
|
|
@@ -10417,7 +10503,7 @@ var CreditCardNumberInput = function CreditCardNumberInput(_ref) {
|
|
|
10417
10503
|
}, [propsValue, value, setValue]);
|
|
10418
10504
|
var handleChange = React.useCallback(function (event) {
|
|
10419
10505
|
setValue(event.target.value);
|
|
10420
|
-
onChange === null || onChange === void 0
|
|
10506
|
+
onChange === null || onChange === void 0 || onChange(event.target.value);
|
|
10421
10507
|
}, [setValue, onChange]);
|
|
10422
10508
|
|
|
10423
10509
|
// TODO: get rid of the any, the types of react-input-mask are incorrect here, it should expect a function as a child, but it expects a ReactNode
|
|
@@ -10480,7 +10566,7 @@ var Expandable = function Expandable(_ref) {
|
|
|
10480
10566
|
setExpanded(function (expanded) {
|
|
10481
10567
|
return !expanded;
|
|
10482
10568
|
});
|
|
10483
|
-
onToggle === null || onToggle === void 0
|
|
10569
|
+
onToggle === null || onToggle === void 0 || onToggle();
|
|
10484
10570
|
}, [onToggle]);
|
|
10485
10571
|
return /*#__PURE__*/React.createElement("div", _extends$1({
|
|
10486
10572
|
className: classNames('Expandable', "Expandable--".concat(background, "-background"), {
|
|
@@ -10912,7 +10998,7 @@ var ModalOverlay = function ModalOverlay(_ref) {
|
|
|
10912
10998
|
document.body.appendChild(element);
|
|
10913
10999
|
return function () {
|
|
10914
11000
|
var _element$parentElemen;
|
|
10915
|
-
element === null || element === void 0
|
|
11001
|
+
element === null || element === void 0 || (_element$parentElemen = element.parentElement) === null || _element$parentElemen === void 0 || _element$parentElemen.removeChild(element);
|
|
10916
11002
|
};
|
|
10917
11003
|
}, [element]);
|
|
10918
11004
|
if (!element) return null;
|
|
@@ -10929,6 +11015,35 @@ var ModalOverlay = function ModalOverlay(_ref) {
|
|
|
10929
11015
|
}, children))), element);
|
|
10930
11016
|
};
|
|
10931
11017
|
|
|
11018
|
+
var preventNavigation = function preventNavigation(event) {
|
|
11019
|
+
event.preventDefault();
|
|
11020
|
+
event.returnValue = '';
|
|
11021
|
+
};
|
|
11022
|
+
|
|
11023
|
+
var usePreventNavigation = function usePreventNavigation() {
|
|
11024
|
+
var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
11025
|
+
React.useEffect(function () {
|
|
11026
|
+
if (enabled) {
|
|
11027
|
+
window.addEventListener('beforeunload', preventNavigation);
|
|
11028
|
+
return function () {
|
|
11029
|
+
return window.removeEventListener('beforeunload', preventNavigation);
|
|
11030
|
+
};
|
|
11031
|
+
}
|
|
11032
|
+
}, [enabled]);
|
|
11033
|
+
};
|
|
11034
|
+
|
|
11035
|
+
var NavigationPreventer = function NavigationPreventer(_ref) {
|
|
11036
|
+
var _ref$enabled = _ref.enabled,
|
|
11037
|
+
enabled = _ref$enabled === void 0 ? false : _ref$enabled,
|
|
11038
|
+
_ref$message = _ref.message,
|
|
11039
|
+
message = _ref$message === void 0 ? 'Changes that you made may not be saved.' : _ref$message;
|
|
11040
|
+
usePreventNavigation(enabled);
|
|
11041
|
+
return /*#__PURE__*/React.createElement(reactRouterDom.Prompt, {
|
|
11042
|
+
when: enabled,
|
|
11043
|
+
message: message
|
|
11044
|
+
});
|
|
11045
|
+
};
|
|
11046
|
+
|
|
10932
11047
|
var __assign$1 = undefined && undefined.__assign || function () {
|
|
10933
11048
|
__assign$1 = Object.assign || function (t) {
|
|
10934
11049
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -11613,6 +11728,7 @@ exports.Mirror = Mirror;
|
|
|
11613
11728
|
exports.Modal = Modal;
|
|
11614
11729
|
exports.ModalOverlay = ModalOverlay;
|
|
11615
11730
|
exports.MultiSelect = MultiSelect;
|
|
11731
|
+
exports.NavigationPreventer = NavigationPreventer;
|
|
11616
11732
|
exports.NoLineDivider = NoLineDivider;
|
|
11617
11733
|
exports.Oval = Oval;
|
|
11618
11734
|
exports.Overlay = Overlay;
|