@moda/om 18.4.0 → 19.0.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 +1851 -1731
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1852 -1733
- 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/Tabs/Tabs.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/Tabs/Tabs.tsx +10 -3
- package/src/components/index.ts +1 -0
- package/src/hooks/useBreakpoint.ts +2 -2
- package/src/utilities/preventNavigation.ts +4 -0
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { useState, useEffect, PureComponent, useRef, Children, isValidElement, cloneElement, createContext, useContext, useCallback, useReducer, useMemo, forwardRef } from 'react';
|
|
3
|
-
import { Link } from 'react-router-dom';
|
|
3
|
+
import { Link, Prompt } from 'react-router-dom';
|
|
4
4
|
import require$$1, { createPortal } from 'react-dom';
|
|
5
5
|
|
|
6
6
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -999,62 +999,62 @@ var colorStringExports = colorString.exports;
|
|
|
999
999
|
__exportStar(helpers, exports);
|
|
1000
1000
|
})(dist$4);
|
|
1001
1001
|
|
|
1002
|
-
function _iterableToArrayLimit(
|
|
1003
|
-
var
|
|
1004
|
-
if (null !=
|
|
1005
|
-
var
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1002
|
+
function _iterableToArrayLimit(r, l) {
|
|
1003
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
1004
|
+
if (null != t) {
|
|
1005
|
+
var e,
|
|
1006
|
+
n,
|
|
1007
|
+
i,
|
|
1008
|
+
u,
|
|
1009
|
+
a = [],
|
|
1010
|
+
f = !0,
|
|
1011
|
+
o = !1;
|
|
1012
1012
|
try {
|
|
1013
|
-
if (
|
|
1014
|
-
if (Object(
|
|
1015
|
-
|
|
1016
|
-
} else for (; !(
|
|
1017
|
-
} catch (
|
|
1018
|
-
|
|
1013
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
1014
|
+
if (Object(t) !== t) return;
|
|
1015
|
+
f = !1;
|
|
1016
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
1017
|
+
} catch (r) {
|
|
1018
|
+
o = !0, n = r;
|
|
1019
1019
|
} finally {
|
|
1020
1020
|
try {
|
|
1021
|
-
if (!
|
|
1021
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
1022
1022
|
} finally {
|
|
1023
|
-
if (
|
|
1023
|
+
if (o) throw n;
|
|
1024
1024
|
}
|
|
1025
1025
|
}
|
|
1026
|
-
return
|
|
1026
|
+
return a;
|
|
1027
1027
|
}
|
|
1028
1028
|
}
|
|
1029
|
-
function ownKeys(
|
|
1030
|
-
var
|
|
1029
|
+
function ownKeys(e, r) {
|
|
1030
|
+
var t = Object.keys(e);
|
|
1031
1031
|
if (Object.getOwnPropertySymbols) {
|
|
1032
|
-
var
|
|
1033
|
-
|
|
1034
|
-
return Object.getOwnPropertyDescriptor(
|
|
1035
|
-
})),
|
|
1032
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
1033
|
+
r && (o = o.filter(function (r) {
|
|
1034
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
1035
|
+
})), t.push.apply(t, o);
|
|
1036
1036
|
}
|
|
1037
|
-
return
|
|
1037
|
+
return t;
|
|
1038
1038
|
}
|
|
1039
|
-
function _objectSpread2(
|
|
1040
|
-
for (var
|
|
1041
|
-
var
|
|
1042
|
-
|
|
1043
|
-
_defineProperty$1(
|
|
1044
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
|
1045
|
-
Object.defineProperty(
|
|
1039
|
+
function _objectSpread2(e) {
|
|
1040
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
1041
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
1042
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
1043
|
+
_defineProperty$1(e, r, t[r]);
|
|
1044
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
1045
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
1046
1046
|
});
|
|
1047
1047
|
}
|
|
1048
|
-
return
|
|
1048
|
+
return e;
|
|
1049
1049
|
}
|
|
1050
|
-
function _typeof$1(
|
|
1050
|
+
function _typeof$1(o) {
|
|
1051
1051
|
"@babel/helpers - typeof";
|
|
1052
1052
|
|
|
1053
|
-
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (
|
|
1054
|
-
return typeof
|
|
1055
|
-
} : function (
|
|
1056
|
-
return
|
|
1057
|
-
}, _typeof$1(
|
|
1053
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
1054
|
+
return typeof o;
|
|
1055
|
+
} : function (o) {
|
|
1056
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
1057
|
+
}, _typeof$1(o);
|
|
1058
1058
|
}
|
|
1059
1059
|
function _defineProperty$1(obj, key, value) {
|
|
1060
1060
|
key = _toPropertyKey$1(key);
|
|
@@ -1328,7 +1328,9 @@ var stringifyProps = function stringifyProps(props) {
|
|
|
1328
1328
|
|
|
1329
1329
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1330
1330
|
|
|
1331
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
1331
|
+
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
1332
|
+
|
|
1333
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1332
1334
|
var isEmpty = function isEmpty(obj) {
|
|
1333
1335
|
return Object.entries(obj || {}).length === 0;
|
|
1334
1336
|
};
|
|
@@ -1651,7 +1653,7 @@ var RemoveScroll = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
|
|
|
1651
1653
|
var SideCar = sideCar;
|
|
1652
1654
|
var containerRef = useMergeRefs([ref, parentRef]);
|
|
1653
1655
|
var containerProps = _assign(_assign({}, rest), callbacks);
|
|
1654
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, enabled && /*#__PURE__*/React.createElement(SideCar, {
|
|
1656
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, enabled && ( /*#__PURE__*/React.createElement(SideCar, {
|
|
1655
1657
|
sideCar: effectCar$1,
|
|
1656
1658
|
removeScrollBar: removeScrollBar,
|
|
1657
1659
|
shards: shards,
|
|
@@ -1661,12 +1663,12 @@ var RemoveScroll = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
|
|
|
1661
1663
|
allowPinchZoom: !!allowPinchZoom,
|
|
1662
1664
|
lockRef: ref,
|
|
1663
1665
|
gapMode: gapMode
|
|
1664
|
-
}), forwardProps ? /*#__PURE__*/React.cloneElement(React.Children.only(children), _assign(_assign({}, containerProps), {
|
|
1666
|
+
})), forwardProps ? ( /*#__PURE__*/React.cloneElement(React.Children.only(children), _assign(_assign({}, containerProps), {
|
|
1665
1667
|
ref: containerRef
|
|
1666
|
-
})) : /*#__PURE__*/React.createElement(Container, _assign({}, containerProps, {
|
|
1668
|
+
}))) : ( /*#__PURE__*/React.createElement(Container, _assign({}, containerProps, {
|
|
1667
1669
|
className: className,
|
|
1668
1670
|
ref: containerRef
|
|
1669
|
-
}), children));
|
|
1671
|
+
}), children)));
|
|
1670
1672
|
});
|
|
1671
1673
|
RemoveScroll.defaultProps = {
|
|
1672
1674
|
enabled: true,
|
|
@@ -1695,123 +1697,84 @@ function _extends() {
|
|
|
1695
1697
|
|
|
1696
1698
|
var propTypes = {exports: {}};
|
|
1697
1699
|
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1700
|
+
/**
|
|
1701
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1702
|
+
*
|
|
1703
|
+
* This source code is licensed under the MIT license found in the
|
|
1704
|
+
* LICENSE file in the root directory of this source tree.
|
|
1705
|
+
*/
|
|
1706
|
+
var ReactPropTypesSecret_1;
|
|
1707
|
+
var hasRequiredReactPropTypesSecret;
|
|
1708
|
+
function requireReactPropTypesSecret() {
|
|
1709
|
+
if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
|
|
1710
|
+
hasRequiredReactPropTypesSecret = 1;
|
|
1711
|
+
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
1712
|
+
ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
1713
|
+
return ReactPropTypesSecret_1;
|
|
1714
|
+
}
|
|
1701
1715
|
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
w = b ? Symbol["for"]("react.fundamental") : 60117,
|
|
1723
|
-
x = b ? Symbol["for"]("react.responder") : 60118,
|
|
1724
|
-
y = b ? Symbol["for"]("react.scope") : 60119;
|
|
1725
|
-
function z(a) {
|
|
1726
|
-
if ("object" === _typeof$1(a) && null !== a) {
|
|
1727
|
-
var u = a.$$typeof;
|
|
1728
|
-
switch (u) {
|
|
1729
|
-
case c:
|
|
1730
|
-
switch (a = a.type, a) {
|
|
1731
|
-
case l:
|
|
1732
|
-
case m:
|
|
1733
|
-
case e:
|
|
1734
|
-
case g:
|
|
1735
|
-
case f:
|
|
1736
|
-
case p:
|
|
1737
|
-
return a;
|
|
1738
|
-
default:
|
|
1739
|
-
switch (a = a && a.$$typeof, a) {
|
|
1740
|
-
case k:
|
|
1741
|
-
case n:
|
|
1742
|
-
case t:
|
|
1743
|
-
case r:
|
|
1744
|
-
case h:
|
|
1745
|
-
return a;
|
|
1746
|
-
default:
|
|
1747
|
-
return u;
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
case d:
|
|
1751
|
-
return u;
|
|
1716
|
+
/**
|
|
1717
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1718
|
+
*
|
|
1719
|
+
* This source code is licensed under the MIT license found in the
|
|
1720
|
+
* LICENSE file in the root directory of this source tree.
|
|
1721
|
+
*/
|
|
1722
|
+
var factoryWithThrowingShims;
|
|
1723
|
+
var hasRequiredFactoryWithThrowingShims;
|
|
1724
|
+
function requireFactoryWithThrowingShims() {
|
|
1725
|
+
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
|
|
1726
|
+
hasRequiredFactoryWithThrowingShims = 1;
|
|
1727
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
1728
|
+
function emptyFunction() {}
|
|
1729
|
+
function emptyFunctionWithReset() {}
|
|
1730
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
1731
|
+
factoryWithThrowingShims = function factoryWithThrowingShims() {
|
|
1732
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
1733
|
+
if (secret === ReactPropTypesSecret) {
|
|
1734
|
+
// It is still safe when called from React.
|
|
1735
|
+
return;
|
|
1752
1736
|
}
|
|
1737
|
+
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');
|
|
1738
|
+
err.name = 'Invariant Violation';
|
|
1739
|
+
throw err;
|
|
1753
1740
|
}
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
return z(a) === n;
|
|
1786
|
-
};
|
|
1787
|
-
reactIs_production_min.isFragment = function (a) {
|
|
1788
|
-
return z(a) === e;
|
|
1789
|
-
};
|
|
1790
|
-
reactIs_production_min.isLazy = function (a) {
|
|
1791
|
-
return z(a) === t;
|
|
1792
|
-
};
|
|
1793
|
-
reactIs_production_min.isMemo = function (a) {
|
|
1794
|
-
return z(a) === r;
|
|
1795
|
-
};
|
|
1796
|
-
reactIs_production_min.isPortal = function (a) {
|
|
1797
|
-
return z(a) === d;
|
|
1798
|
-
};
|
|
1799
|
-
reactIs_production_min.isProfiler = function (a) {
|
|
1800
|
-
return z(a) === g;
|
|
1801
|
-
};
|
|
1802
|
-
reactIs_production_min.isStrictMode = function (a) {
|
|
1803
|
-
return z(a) === f;
|
|
1804
|
-
};
|
|
1805
|
-
reactIs_production_min.isSuspense = function (a) {
|
|
1806
|
-
return z(a) === p;
|
|
1807
|
-
};
|
|
1808
|
-
reactIs_production_min.isValidElementType = function (a) {
|
|
1809
|
-
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);
|
|
1741
|
+
shim.isRequired = shim;
|
|
1742
|
+
function getShim() {
|
|
1743
|
+
return shim;
|
|
1744
|
+
}
|
|
1745
|
+
// Important!
|
|
1746
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
1747
|
+
var ReactPropTypes = {
|
|
1748
|
+
array: shim,
|
|
1749
|
+
bigint: shim,
|
|
1750
|
+
bool: shim,
|
|
1751
|
+
func: shim,
|
|
1752
|
+
number: shim,
|
|
1753
|
+
object: shim,
|
|
1754
|
+
string: shim,
|
|
1755
|
+
symbol: shim,
|
|
1756
|
+
any: shim,
|
|
1757
|
+
arrayOf: getShim,
|
|
1758
|
+
element: shim,
|
|
1759
|
+
elementType: shim,
|
|
1760
|
+
instanceOf: getShim,
|
|
1761
|
+
node: shim,
|
|
1762
|
+
objectOf: getShim,
|
|
1763
|
+
oneOf: getShim,
|
|
1764
|
+
oneOfType: getShim,
|
|
1765
|
+
shape: getShim,
|
|
1766
|
+
exact: getShim,
|
|
1767
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
1768
|
+
resetWarningCache: emptyFunction
|
|
1769
|
+
};
|
|
1770
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1771
|
+
return ReactPropTypes;
|
|
1810
1772
|
};
|
|
1811
|
-
|
|
1812
|
-
return reactIs_production_min;
|
|
1773
|
+
return factoryWithThrowingShims;
|
|
1813
1774
|
}
|
|
1814
1775
|
|
|
1776
|
+
var reactIs = {exports: {}};
|
|
1777
|
+
|
|
1815
1778
|
var reactIs_development = {};
|
|
1816
1779
|
|
|
1817
1780
|
var hasRequiredReactIs_development;
|
|
@@ -1977,71 +1940,186 @@ function requireReactIs_development() {
|
|
|
1977
1940
|
return reactIs_development;
|
|
1978
1941
|
}
|
|
1979
1942
|
|
|
1980
|
-
var
|
|
1981
|
-
function requireReactIs() {
|
|
1982
|
-
if (hasRequiredReactIs) return reactIs.exports;
|
|
1983
|
-
hasRequiredReactIs = 1;
|
|
1984
|
-
if (process.env.NODE_ENV === 'production') {
|
|
1985
|
-
reactIs.exports = requireReactIs_production_min();
|
|
1986
|
-
} else {
|
|
1987
|
-
reactIs.exports = requireReactIs_development();
|
|
1988
|
-
}
|
|
1989
|
-
return reactIs.exports;
|
|
1990
|
-
}
|
|
1991
|
-
|
|
1992
|
-
/*
|
|
1993
|
-
object-assign
|
|
1994
|
-
(c) Sindre Sorhus
|
|
1995
|
-
@license MIT
|
|
1996
|
-
*/
|
|
1997
|
-
var objectAssign;
|
|
1998
|
-
var hasRequiredObjectAssign;
|
|
1999
|
-
function requireObjectAssign() {
|
|
2000
|
-
if (hasRequiredObjectAssign) return objectAssign;
|
|
2001
|
-
hasRequiredObjectAssign = 1;
|
|
2002
|
-
/* eslint-disable no-unused-vars */
|
|
2003
|
-
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
2004
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2005
|
-
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
2006
|
-
function toObject(val) {
|
|
2007
|
-
if (val === null || val === undefined) {
|
|
2008
|
-
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
2009
|
-
}
|
|
2010
|
-
return Object(val);
|
|
2011
|
-
}
|
|
2012
|
-
function shouldUseNative() {
|
|
2013
|
-
try {
|
|
2014
|
-
if (!Object.assign) {
|
|
2015
|
-
return false;
|
|
2016
|
-
}
|
|
2017
|
-
|
|
2018
|
-
// Detect buggy property enumeration order in older V8 versions.
|
|
2019
|
-
|
|
2020
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
2021
|
-
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
2022
|
-
test1[5] = 'de';
|
|
2023
|
-
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
2024
|
-
return false;
|
|
2025
|
-
}
|
|
2026
|
-
|
|
2027
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
2028
|
-
var test2 = {};
|
|
2029
|
-
for (var i = 0; i < 10; i++) {
|
|
2030
|
-
test2['_' + String.fromCharCode(i)] = i;
|
|
2031
|
-
}
|
|
2032
|
-
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
2033
|
-
return test2[n];
|
|
2034
|
-
});
|
|
2035
|
-
if (order2.join('') !== '0123456789') {
|
|
2036
|
-
return false;
|
|
2037
|
-
}
|
|
1943
|
+
var reactIs_production_min = {};
|
|
2038
1944
|
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
1945
|
+
var hasRequiredReactIs_production_min;
|
|
1946
|
+
function requireReactIs_production_min() {
|
|
1947
|
+
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
1948
|
+
hasRequiredReactIs_production_min = 1;
|
|
1949
|
+
var b = "function" === typeof Symbol && Symbol["for"],
|
|
1950
|
+
c = b ? Symbol["for"]("react.element") : 60103,
|
|
1951
|
+
d = b ? Symbol["for"]("react.portal") : 60106,
|
|
1952
|
+
e = b ? Symbol["for"]("react.fragment") : 60107,
|
|
1953
|
+
f = b ? Symbol["for"]("react.strict_mode") : 60108,
|
|
1954
|
+
g = b ? Symbol["for"]("react.profiler") : 60114,
|
|
1955
|
+
h = b ? Symbol["for"]("react.provider") : 60109,
|
|
1956
|
+
k = b ? Symbol["for"]("react.context") : 60110,
|
|
1957
|
+
l = b ? Symbol["for"]("react.async_mode") : 60111,
|
|
1958
|
+
m = b ? Symbol["for"]("react.concurrent_mode") : 60111,
|
|
1959
|
+
n = b ? Symbol["for"]("react.forward_ref") : 60112,
|
|
1960
|
+
p = b ? Symbol["for"]("react.suspense") : 60113,
|
|
1961
|
+
q = b ? Symbol["for"]("react.suspense_list") : 60120,
|
|
1962
|
+
r = b ? Symbol["for"]("react.memo") : 60115,
|
|
1963
|
+
t = b ? Symbol["for"]("react.lazy") : 60116,
|
|
1964
|
+
v = b ? Symbol["for"]("react.block") : 60121,
|
|
1965
|
+
w = b ? Symbol["for"]("react.fundamental") : 60117,
|
|
1966
|
+
x = b ? Symbol["for"]("react.responder") : 60118,
|
|
1967
|
+
y = b ? Symbol["for"]("react.scope") : 60119;
|
|
1968
|
+
function z(a) {
|
|
1969
|
+
if ("object" === _typeof$1(a) && null !== a) {
|
|
1970
|
+
var u = a.$$typeof;
|
|
1971
|
+
switch (u) {
|
|
1972
|
+
case c:
|
|
1973
|
+
switch (a = a.type, a) {
|
|
1974
|
+
case l:
|
|
1975
|
+
case m:
|
|
1976
|
+
case e:
|
|
1977
|
+
case g:
|
|
1978
|
+
case f:
|
|
1979
|
+
case p:
|
|
1980
|
+
return a;
|
|
1981
|
+
default:
|
|
1982
|
+
switch (a = a && a.$$typeof, a) {
|
|
1983
|
+
case k:
|
|
1984
|
+
case n:
|
|
1985
|
+
case t:
|
|
1986
|
+
case r:
|
|
1987
|
+
case h:
|
|
1988
|
+
return a;
|
|
1989
|
+
default:
|
|
1990
|
+
return u;
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
case d:
|
|
1994
|
+
return u;
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
function A(a) {
|
|
1999
|
+
return z(a) === m;
|
|
2000
|
+
}
|
|
2001
|
+
reactIs_production_min.AsyncMode = l;
|
|
2002
|
+
reactIs_production_min.ConcurrentMode = m;
|
|
2003
|
+
reactIs_production_min.ContextConsumer = k;
|
|
2004
|
+
reactIs_production_min.ContextProvider = h;
|
|
2005
|
+
reactIs_production_min.Element = c;
|
|
2006
|
+
reactIs_production_min.ForwardRef = n;
|
|
2007
|
+
reactIs_production_min.Fragment = e;
|
|
2008
|
+
reactIs_production_min.Lazy = t;
|
|
2009
|
+
reactIs_production_min.Memo = r;
|
|
2010
|
+
reactIs_production_min.Portal = d;
|
|
2011
|
+
reactIs_production_min.Profiler = g;
|
|
2012
|
+
reactIs_production_min.StrictMode = f;
|
|
2013
|
+
reactIs_production_min.Suspense = p;
|
|
2014
|
+
reactIs_production_min.isAsyncMode = function (a) {
|
|
2015
|
+
return A(a) || z(a) === l;
|
|
2016
|
+
};
|
|
2017
|
+
reactIs_production_min.isConcurrentMode = A;
|
|
2018
|
+
reactIs_production_min.isContextConsumer = function (a) {
|
|
2019
|
+
return z(a) === k;
|
|
2020
|
+
};
|
|
2021
|
+
reactIs_production_min.isContextProvider = function (a) {
|
|
2022
|
+
return z(a) === h;
|
|
2023
|
+
};
|
|
2024
|
+
reactIs_production_min.isElement = function (a) {
|
|
2025
|
+
return "object" === _typeof$1(a) && null !== a && a.$$typeof === c;
|
|
2026
|
+
};
|
|
2027
|
+
reactIs_production_min.isForwardRef = function (a) {
|
|
2028
|
+
return z(a) === n;
|
|
2029
|
+
};
|
|
2030
|
+
reactIs_production_min.isFragment = function (a) {
|
|
2031
|
+
return z(a) === e;
|
|
2032
|
+
};
|
|
2033
|
+
reactIs_production_min.isLazy = function (a) {
|
|
2034
|
+
return z(a) === t;
|
|
2035
|
+
};
|
|
2036
|
+
reactIs_production_min.isMemo = function (a) {
|
|
2037
|
+
return z(a) === r;
|
|
2038
|
+
};
|
|
2039
|
+
reactIs_production_min.isPortal = function (a) {
|
|
2040
|
+
return z(a) === d;
|
|
2041
|
+
};
|
|
2042
|
+
reactIs_production_min.isProfiler = function (a) {
|
|
2043
|
+
return z(a) === g;
|
|
2044
|
+
};
|
|
2045
|
+
reactIs_production_min.isStrictMode = function (a) {
|
|
2046
|
+
return z(a) === f;
|
|
2047
|
+
};
|
|
2048
|
+
reactIs_production_min.isSuspense = function (a) {
|
|
2049
|
+
return z(a) === p;
|
|
2050
|
+
};
|
|
2051
|
+
reactIs_production_min.isValidElementType = function (a) {
|
|
2052
|
+
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);
|
|
2053
|
+
};
|
|
2054
|
+
reactIs_production_min.typeOf = z;
|
|
2055
|
+
return reactIs_production_min;
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2058
|
+
var hasRequiredReactIs;
|
|
2059
|
+
function requireReactIs() {
|
|
2060
|
+
if (hasRequiredReactIs) return reactIs.exports;
|
|
2061
|
+
hasRequiredReactIs = 1;
|
|
2062
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2063
|
+
reactIs.exports = requireReactIs_production_min();
|
|
2064
|
+
} else {
|
|
2065
|
+
reactIs.exports = requireReactIs_development();
|
|
2066
|
+
}
|
|
2067
|
+
return reactIs.exports;
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
/*
|
|
2071
|
+
object-assign
|
|
2072
|
+
(c) Sindre Sorhus
|
|
2073
|
+
@license MIT
|
|
2074
|
+
*/
|
|
2075
|
+
var objectAssign;
|
|
2076
|
+
var hasRequiredObjectAssign;
|
|
2077
|
+
function requireObjectAssign() {
|
|
2078
|
+
if (hasRequiredObjectAssign) return objectAssign;
|
|
2079
|
+
hasRequiredObjectAssign = 1;
|
|
2080
|
+
/* eslint-disable no-unused-vars */
|
|
2081
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
2082
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2083
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
2084
|
+
function toObject(val) {
|
|
2085
|
+
if (val === null || val === undefined) {
|
|
2086
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
2087
|
+
}
|
|
2088
|
+
return Object(val);
|
|
2089
|
+
}
|
|
2090
|
+
function shouldUseNative() {
|
|
2091
|
+
try {
|
|
2092
|
+
if (!Object.assign) {
|
|
2093
|
+
return false;
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
// Detect buggy property enumeration order in older V8 versions.
|
|
2097
|
+
|
|
2098
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
2099
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
2100
|
+
test1[5] = 'de';
|
|
2101
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
2102
|
+
return false;
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
2106
|
+
var test2 = {};
|
|
2107
|
+
for (var i = 0; i < 10; i++) {
|
|
2108
|
+
test2['_' + String.fromCharCode(i)] = i;
|
|
2109
|
+
}
|
|
2110
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
2111
|
+
return test2[n];
|
|
2112
|
+
});
|
|
2113
|
+
if (order2.join('') !== '0123456789') {
|
|
2114
|
+
return false;
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
2118
|
+
var test3 = {};
|
|
2119
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
2120
|
+
test3[letter] = letter;
|
|
2121
|
+
});
|
|
2122
|
+
if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') {
|
|
2045
2123
|
return false;
|
|
2046
2124
|
}
|
|
2047
2125
|
return true;
|
|
@@ -2075,22 +2153,6 @@ function requireObjectAssign() {
|
|
|
2075
2153
|
return objectAssign;
|
|
2076
2154
|
}
|
|
2077
2155
|
|
|
2078
|
-
/**
|
|
2079
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
2080
|
-
*
|
|
2081
|
-
* This source code is licensed under the MIT license found in the
|
|
2082
|
-
* LICENSE file in the root directory of this source tree.
|
|
2083
|
-
*/
|
|
2084
|
-
var ReactPropTypesSecret_1;
|
|
2085
|
-
var hasRequiredReactPropTypesSecret;
|
|
2086
|
-
function requireReactPropTypesSecret() {
|
|
2087
|
-
if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
|
|
2088
|
-
hasRequiredReactPropTypesSecret = 1;
|
|
2089
|
-
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
2090
|
-
ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
2091
|
-
return ReactPropTypesSecret_1;
|
|
2092
|
-
}
|
|
2093
|
-
|
|
2094
2156
|
var has;
|
|
2095
2157
|
var hasRequiredHas;
|
|
2096
2158
|
function requireHas() {
|
|
@@ -2731,66 +2793,6 @@ function requireFactoryWithTypeCheckers() {
|
|
|
2731
2793
|
return factoryWithTypeCheckers;
|
|
2732
2794
|
}
|
|
2733
2795
|
|
|
2734
|
-
/**
|
|
2735
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
2736
|
-
*
|
|
2737
|
-
* This source code is licensed under the MIT license found in the
|
|
2738
|
-
* LICENSE file in the root directory of this source tree.
|
|
2739
|
-
*/
|
|
2740
|
-
var factoryWithThrowingShims;
|
|
2741
|
-
var hasRequiredFactoryWithThrowingShims;
|
|
2742
|
-
function requireFactoryWithThrowingShims() {
|
|
2743
|
-
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
|
|
2744
|
-
hasRequiredFactoryWithThrowingShims = 1;
|
|
2745
|
-
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
2746
|
-
function emptyFunction() {}
|
|
2747
|
-
function emptyFunctionWithReset() {}
|
|
2748
|
-
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
2749
|
-
factoryWithThrowingShims = function factoryWithThrowingShims() {
|
|
2750
|
-
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
2751
|
-
if (secret === ReactPropTypesSecret) {
|
|
2752
|
-
// It is still safe when called from React.
|
|
2753
|
-
return;
|
|
2754
|
-
}
|
|
2755
|
-
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');
|
|
2756
|
-
err.name = 'Invariant Violation';
|
|
2757
|
-
throw err;
|
|
2758
|
-
}
|
|
2759
|
-
shim.isRequired = shim;
|
|
2760
|
-
function getShim() {
|
|
2761
|
-
return shim;
|
|
2762
|
-
}
|
|
2763
|
-
// Important!
|
|
2764
|
-
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
2765
|
-
var ReactPropTypes = {
|
|
2766
|
-
array: shim,
|
|
2767
|
-
bigint: shim,
|
|
2768
|
-
bool: shim,
|
|
2769
|
-
func: shim,
|
|
2770
|
-
number: shim,
|
|
2771
|
-
object: shim,
|
|
2772
|
-
string: shim,
|
|
2773
|
-
symbol: shim,
|
|
2774
|
-
any: shim,
|
|
2775
|
-
arrayOf: getShim,
|
|
2776
|
-
element: shim,
|
|
2777
|
-
elementType: shim,
|
|
2778
|
-
instanceOf: getShim,
|
|
2779
|
-
node: shim,
|
|
2780
|
-
objectOf: getShim,
|
|
2781
|
-
oneOf: getShim,
|
|
2782
|
-
oneOfType: getShim,
|
|
2783
|
-
shape: getShim,
|
|
2784
|
-
exact: getShim,
|
|
2785
|
-
checkPropTypes: emptyFunctionWithReset,
|
|
2786
|
-
resetWarningCache: emptyFunction
|
|
2787
|
-
};
|
|
2788
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
2789
|
-
return ReactPropTypes;
|
|
2790
|
-
};
|
|
2791
|
-
return factoryWithThrowingShims;
|
|
2792
|
-
}
|
|
2793
|
-
|
|
2794
2796
|
/**
|
|
2795
2797
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
2796
2798
|
*
|
|
@@ -2969,7 +2971,7 @@ var FocusLock = /*#__PURE__*/React.forwardRef(function FocusLockUI(props, parent
|
|
|
2969
2971
|
var hasLeadingGuards = noFocusGuards !== true;
|
|
2970
2972
|
var hasTailingGuards = hasLeadingGuards && noFocusGuards !== 'tail';
|
|
2971
2973
|
var mergedRef = useMergeRefs([parentRef, setObserveNode]);
|
|
2972
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, hasLeadingGuards && [
|
|
2974
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, hasLeadingGuards && [
|
|
2973
2975
|
// nearest focus guard
|
|
2974
2976
|
React.createElement("div", {
|
|
2975
2977
|
key: "guard-first",
|
|
@@ -3066,6 +3068,9 @@ function deferAction(action) {
|
|
|
3066
3068
|
var effectCar = createSidecarMedium();
|
|
3067
3069
|
var focusHiddenMarker = 'data-focus-on-hidden';
|
|
3068
3070
|
|
|
3071
|
+
var PREVENT_SCROLL = {
|
|
3072
|
+
preventScroll: true
|
|
3073
|
+
};
|
|
3069
3074
|
var FocusOn$1 = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
|
|
3070
3075
|
var _a = React.useState(false),
|
|
3071
3076
|
lockProps = _a[0],
|
|
@@ -3073,6 +3078,7 @@ var FocusOn$1 = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
|
|
|
3073
3078
|
var children = props.children,
|
|
3074
3079
|
autoFocus = props.autoFocus,
|
|
3075
3080
|
shards = props.shards,
|
|
3081
|
+
crossFrame = props.crossFrame,
|
|
3076
3082
|
_b = props.enabled,
|
|
3077
3083
|
enabled = _b === void 0 ? true : _b,
|
|
3078
3084
|
_c = props.scrollLock,
|
|
@@ -3090,7 +3096,7 @@ var FocusOn$1 = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
|
|
|
3090
3096
|
style = props.style,
|
|
3091
3097
|
as = props.as,
|
|
3092
3098
|
gapMode = props.gapMode,
|
|
3093
|
-
rest = __rest$a(props, ["children", "autoFocus", "shards", "enabled", "scrollLock", "focusLock", "returnFocus", "inert", "allowPinchZoom", "sideCar", "className", "shouldIgnore", "preventScrollOnFocus", "style", "as", "gapMode"]);
|
|
3099
|
+
rest = __rest$a(props, ["children", "autoFocus", "shards", "crossFrame", "enabled", "scrollLock", "focusLock", "returnFocus", "inert", "allowPinchZoom", "sideCar", "className", "shouldIgnore", "preventScrollOnFocus", "style", "as", "gapMode"]);
|
|
3094
3100
|
var SideCar = sideCar;
|
|
3095
3101
|
var onActivation = lockProps.onActivation,
|
|
3096
3102
|
onDeactivation = lockProps.onDeactivation,
|
|
@@ -3112,20 +3118,19 @@ var FocusOn$1 = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
|
|
|
3112
3118
|
returnFocus: returnFocus,
|
|
3113
3119
|
autoFocus: autoFocus,
|
|
3114
3120
|
shards: shards,
|
|
3121
|
+
crossFrame: crossFrame,
|
|
3115
3122
|
onActivation: onActivation,
|
|
3116
3123
|
onDeactivation: onDeactivation,
|
|
3117
3124
|
className: className,
|
|
3118
3125
|
whiteList: shouldIgnore,
|
|
3119
3126
|
lockProps: appliedLockProps,
|
|
3120
|
-
focusOptions: preventScrollOnFocus ?
|
|
3121
|
-
preventScroll: true
|
|
3122
|
-
} : undefined,
|
|
3127
|
+
focusOptions: preventScrollOnFocus ? PREVENT_SCROLL : undefined,
|
|
3123
3128
|
as: RemoveScroll
|
|
3124
|
-
}, children), enabled && /*#__PURE__*/React.createElement(SideCar, _assign({}, rest, {
|
|
3129
|
+
}, children), enabled && ( /*#__PURE__*/React.createElement(SideCar, _assign({}, rest, {
|
|
3125
3130
|
sideCar: effectCar,
|
|
3126
3131
|
setLockProps: setLockProps,
|
|
3127
3132
|
shards: shards
|
|
3128
|
-
})));
|
|
3133
|
+
}))));
|
|
3129
3134
|
});
|
|
3130
3135
|
|
|
3131
3136
|
function _setPrototypeOf(o, p) {
|
|
@@ -3255,6 +3260,9 @@ var toArray = function toArray(a) {
|
|
|
3255
3260
|
var asArray = function asArray(a) {
|
|
3256
3261
|
return Array.isArray(a) ? a : [a];
|
|
3257
3262
|
};
|
|
3263
|
+
var getFirst = function getFirst(a) {
|
|
3264
|
+
return Array.isArray(a) ? a[0] : a;
|
|
3265
|
+
};
|
|
3258
3266
|
|
|
3259
3267
|
var isElementHidden = function isElementHidden(node) {
|
|
3260
3268
|
// we can measure only "elements"
|
|
@@ -3369,16 +3377,28 @@ var tabbables = ['button:enabled', 'select:enabled', 'textarea:enabled', 'input:
|
|
|
3369
3377
|
var queryTabbables = tabbables.join(',');
|
|
3370
3378
|
var queryGuardTabbables = "".concat(queryTabbables, ", [data-focus-guard]");
|
|
3371
3379
|
var getFocusablesWithShadowDom = function getFocusablesWithShadowDom(parent, withGuards) {
|
|
3372
|
-
|
|
3373
|
-
return toArray(((_a = parent.shadowRoot) === null || _a === void 0 ? void 0 : _a.children) || parent.children).reduce(function (acc, child) {
|
|
3380
|
+
return toArray((parent.shadowRoot || parent).children).reduce(function (acc, child) {
|
|
3374
3381
|
return acc.concat(child.matches(withGuards ? queryGuardTabbables : queryTabbables) ? [child] : [], getFocusablesWithShadowDom(child));
|
|
3375
3382
|
}, []);
|
|
3376
3383
|
};
|
|
3384
|
+
var getFocusablesWithIFrame = function getFocusablesWithIFrame(parent, withGuards) {
|
|
3385
|
+
var _a;
|
|
3386
|
+
// contentDocument of iframe will be null if current origin cannot access it
|
|
3387
|
+
if (parent instanceof HTMLIFrameElement && ((_a = parent.contentDocument) === null || _a === void 0 ? void 0 : _a.body)) {
|
|
3388
|
+
return getFocusables([parent.contentDocument.body], withGuards);
|
|
3389
|
+
}
|
|
3390
|
+
return [parent];
|
|
3391
|
+
};
|
|
3377
3392
|
var getFocusables = function getFocusables(parents, withGuards) {
|
|
3378
3393
|
return parents.reduce(function (acc, parent) {
|
|
3394
|
+
var _a;
|
|
3395
|
+
var focusableWithShadowDom = getFocusablesWithShadowDom(parent, withGuards);
|
|
3396
|
+
var focusableWithIframes = (_a = []).concat.apply(_a, focusableWithShadowDom.map(function (node) {
|
|
3397
|
+
return getFocusablesWithIFrame(node, withGuards);
|
|
3398
|
+
}));
|
|
3379
3399
|
return acc.concat(
|
|
3380
3400
|
// add all tabbables inside and within shadow DOMs in DOM order
|
|
3381
|
-
|
|
3401
|
+
focusableWithIframes,
|
|
3382
3402
|
// add if node is tabbable itself
|
|
3383
3403
|
parent.parentNode ? toArray(parent.parentNode.querySelectorAll(queryTabbables)).filter(function (node) {
|
|
3384
3404
|
return node === parent;
|
|
@@ -3451,6 +3471,14 @@ var contains$1 = function contains(scope, element) {
|
|
|
3451
3471
|
return true;
|
|
3452
3472
|
}
|
|
3453
3473
|
return toArray(scope.children).some(function (child) {
|
|
3474
|
+
var _a;
|
|
3475
|
+
if (child instanceof HTMLIFrameElement) {
|
|
3476
|
+
var iframeBody = (_a = child.contentDocument) === null || _a === void 0 ? void 0 : _a.body;
|
|
3477
|
+
if (iframeBody) {
|
|
3478
|
+
return contains(iframeBody, element);
|
|
3479
|
+
}
|
|
3480
|
+
return false;
|
|
3481
|
+
}
|
|
3454
3482
|
return contains(child, element);
|
|
3455
3483
|
});
|
|
3456
3484
|
}
|
|
@@ -3479,7 +3507,6 @@ var filterNested = function filterNested(nodes) {
|
|
|
3479
3507
|
/* eslint-enable */
|
|
3480
3508
|
}
|
|
3481
3509
|
}
|
|
3482
|
-
|
|
3483
3510
|
return nodes.filter(function (_, index) {
|
|
3484
3511
|
return !contained.has(index);
|
|
3485
3512
|
});
|
|
@@ -3506,34 +3533,51 @@ var getAllAffectedNodes = function getAllAffectedNodes(node) {
|
|
|
3506
3533
|
}, []);
|
|
3507
3534
|
};
|
|
3508
3535
|
|
|
3509
|
-
var
|
|
3510
|
-
|
|
3536
|
+
var safeProbe = function safeProbe(cb) {
|
|
3537
|
+
try {
|
|
3538
|
+
return cb();
|
|
3539
|
+
} catch (e) {
|
|
3540
|
+
return undefined;
|
|
3541
|
+
}
|
|
3511
3542
|
};
|
|
3543
|
+
|
|
3512
3544
|
/**
|
|
3513
3545
|
* returns active element from document or from nested shadowdoms
|
|
3514
3546
|
*/
|
|
3515
|
-
var getActiveElement = function getActiveElement() {
|
|
3516
|
-
|
|
3547
|
+
var getActiveElement = function getActiveElement(inDocument) {
|
|
3548
|
+
if (inDocument === void 0) {
|
|
3549
|
+
inDocument = document;
|
|
3550
|
+
}
|
|
3551
|
+
if (!inDocument || !inDocument.activeElement) {
|
|
3552
|
+
return undefined;
|
|
3553
|
+
}
|
|
3554
|
+
var activeElement = inDocument.activeElement;
|
|
3555
|
+
return activeElement.shadowRoot ? getActiveElement(activeElement.shadowRoot) : activeElement instanceof HTMLIFrameElement && safeProbe(function () {
|
|
3556
|
+
return activeElement.contentWindow.document;
|
|
3557
|
+
}) ? getActiveElement(activeElement.contentWindow.document) : activeElement;
|
|
3517
3558
|
};
|
|
3518
3559
|
|
|
3519
|
-
var focusInFrame = function focusInFrame(frame) {
|
|
3520
|
-
return frame ===
|
|
3560
|
+
var focusInFrame = function focusInFrame(frame, activeElement) {
|
|
3561
|
+
return frame === activeElement;
|
|
3521
3562
|
};
|
|
3522
|
-
var focusInsideIframe = function focusInsideIframe(topNode) {
|
|
3563
|
+
var focusInsideIframe = function focusInsideIframe(topNode, activeElement) {
|
|
3523
3564
|
return Boolean(toArray(topNode.querySelectorAll('iframe')).some(function (node) {
|
|
3524
|
-
return focusInFrame(node);
|
|
3565
|
+
return focusInFrame(node, activeElement);
|
|
3525
3566
|
}));
|
|
3526
3567
|
};
|
|
3527
3568
|
/**
|
|
3528
3569
|
* @returns {Boolean} true, if the current focus is inside given node or nodes
|
|
3529
3570
|
*/
|
|
3530
|
-
var focusInside = function focusInside(topNode) {
|
|
3531
|
-
|
|
3571
|
+
var focusInside = function focusInside(topNode, activeElement) {
|
|
3572
|
+
// const activeElement = document && getActiveElement();
|
|
3573
|
+
if (activeElement === void 0) {
|
|
3574
|
+
activeElement = getActiveElement(getFirst(topNode).ownerDocument);
|
|
3575
|
+
}
|
|
3532
3576
|
if (!activeElement || activeElement.dataset && activeElement.dataset.focusGuard) {
|
|
3533
3577
|
return false;
|
|
3534
3578
|
}
|
|
3535
3579
|
return getAllAffectedNodes(topNode).some(function (node) {
|
|
3536
|
-
return contains$1(node, activeElement) || focusInsideIframe(node);
|
|
3580
|
+
return contains$1(node, activeElement) || focusInsideIframe(node, activeElement);
|
|
3537
3581
|
});
|
|
3538
3582
|
};
|
|
3539
3583
|
|
|
@@ -3542,13 +3586,16 @@ var focusInside = function focusInside(topNode) {
|
|
|
3542
3586
|
* ie contained inside a node focus-lock shall ignore
|
|
3543
3587
|
* @returns {boolean} focus is currently is in "allow" area
|
|
3544
3588
|
*/
|
|
3545
|
-
var focusIsHidden = function focusIsHidden() {
|
|
3546
|
-
|
|
3589
|
+
var focusIsHidden = function focusIsHidden(inDocument) {
|
|
3590
|
+
if (inDocument === void 0) {
|
|
3591
|
+
inDocument = document;
|
|
3592
|
+
}
|
|
3593
|
+
var activeElement = getActiveElement(inDocument);
|
|
3547
3594
|
if (!activeElement) {
|
|
3548
3595
|
return false;
|
|
3549
3596
|
}
|
|
3550
3597
|
// this does not support setting FOCUS_ALLOW within shadow dom
|
|
3551
|
-
return toArray(
|
|
3598
|
+
return toArray(inDocument.querySelectorAll("[".concat(FOCUS_ALLOW, "]"))).some(function (node) {
|
|
3552
3599
|
return contains$1(node, activeElement);
|
|
3553
3600
|
});
|
|
3554
3601
|
};
|
|
@@ -3766,7 +3813,7 @@ var reorderNodes = function reorderNodes(srcNodes, dstNodes) {
|
|
|
3766
3813
|
* @param lastNode
|
|
3767
3814
|
*/
|
|
3768
3815
|
var getFocusMerge = function getFocusMerge(topNode, lastNode) {
|
|
3769
|
-
var activeElement = document
|
|
3816
|
+
var activeElement = getActiveElement(asArray(topNode).length > 0 ? document : getFirst(topNode).ownerDocument);
|
|
3770
3817
|
var entries = getAllAffectedNodes(topNode).filter(isNotAGuard);
|
|
3771
3818
|
var commonParent = getTopCommonParent(activeElement || topNode, topNode, entries);
|
|
3772
3819
|
var visibilityCache = new Map();
|
|
@@ -3792,9 +3839,15 @@ var getFocusMerge = function getFocusMerge(topNode, lastNode) {
|
|
|
3792
3839
|
});
|
|
3793
3840
|
var newId = newFocus(innerNodes, outerNodes, activeElement, lastNode);
|
|
3794
3841
|
if (newId === NEW_FOCUS) {
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3842
|
+
var focusNode = pickAutofocus(anyFocusable, innerNodes, allParentAutofocusables(entries, visibilityCache));
|
|
3843
|
+
if (focusNode) {
|
|
3844
|
+
return {
|
|
3845
|
+
node: focusNode
|
|
3846
|
+
};
|
|
3847
|
+
} else {
|
|
3848
|
+
console.warn('focus-lock: cannot find any node to move focus into');
|
|
3849
|
+
return undefined;
|
|
3850
|
+
}
|
|
3798
3851
|
}
|
|
3799
3852
|
if (newId === undefined) {
|
|
3800
3853
|
return newId;
|
|
@@ -4452,7 +4505,6 @@ function RemoveScrollSideCar(props) {
|
|
|
4452
4505
|
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
4453
4506
|
// other axis might be not scrollable
|
|
4454
4507
|
}
|
|
4455
|
-
|
|
4456
4508
|
if (!canBeScrolledInMainDirection) {
|
|
4457
4509
|
return false;
|
|
4458
4510
|
}
|
|
@@ -5218,6 +5270,7 @@ function _curryN(length, received, fn) {
|
|
|
5218
5270
|
var argsIdx = 0;
|
|
5219
5271
|
var left = length;
|
|
5220
5272
|
var combinedIdx = 0;
|
|
5273
|
+
var hasPlaceholder = false;
|
|
5221
5274
|
while (combinedIdx < received.length || argsIdx < arguments.length) {
|
|
5222
5275
|
var result;
|
|
5223
5276
|
if (combinedIdx < received.length && (!_isPlaceholder(received[combinedIdx]) || argsIdx >= arguments.length)) {
|
|
@@ -5229,10 +5282,12 @@ function _curryN(length, received, fn) {
|
|
|
5229
5282
|
combined[combinedIdx] = result;
|
|
5230
5283
|
if (!_isPlaceholder(result)) {
|
|
5231
5284
|
left -= 1;
|
|
5285
|
+
} else {
|
|
5286
|
+
hasPlaceholder = true;
|
|
5232
5287
|
}
|
|
5233
5288
|
combinedIdx += 1;
|
|
5234
5289
|
}
|
|
5235
|
-
return left <= 0 ? fn.apply(this, combined) : _arity(left, _curryN(length, combined, fn));
|
|
5290
|
+
return !hasPlaceholder && left <= 0 ? fn.apply(this, combined) : _arity(Math.max(0, left), _curryN(length, combined, fn));
|
|
5236
5291
|
};
|
|
5237
5292
|
}
|
|
5238
5293
|
|
|
@@ -5286,6 +5341,7 @@ _curry2(function curryN(length, fn) {
|
|
|
5286
5341
|
}
|
|
5287
5342
|
return _arity(length, _curryN(length, [], fn));
|
|
5288
5343
|
});
|
|
5344
|
+
var curryN$1 = curryN;
|
|
5289
5345
|
|
|
5290
5346
|
/**
|
|
5291
5347
|
* Optimized internal three-arity curry function.
|
|
@@ -5444,15 +5500,16 @@ function _objectIs(a, b) {
|
|
|
5444
5500
|
}
|
|
5445
5501
|
var _objectIs$1 = typeof Object.is === 'function' ? Object.is : _objectIs;
|
|
5446
5502
|
|
|
5447
|
-
var toString$
|
|
5503
|
+
var toString$2 = Object.prototype.toString;
|
|
5448
5504
|
var _isArguments = /*#__PURE__*/
|
|
5449
5505
|
function () {
|
|
5450
|
-
return toString$
|
|
5451
|
-
return toString$
|
|
5506
|
+
return toString$2.call(arguments) === '[object Arguments]' ? function _isArguments(x) {
|
|
5507
|
+
return toString$2.call(x) === '[object Arguments]';
|
|
5452
5508
|
} : function _isArguments(x) {
|
|
5453
5509
|
return _has('callee', x);
|
|
5454
5510
|
};
|
|
5455
5511
|
}();
|
|
5512
|
+
var _isArguments$1 = _isArguments;
|
|
5456
5513
|
|
|
5457
5514
|
var hasEnumBug = ! /*#__PURE__*/
|
|
5458
5515
|
{
|
|
@@ -5504,7 +5561,7 @@ _curry1(function keys(obj) {
|
|
|
5504
5561
|
}
|
|
5505
5562
|
var prop, nIdx;
|
|
5506
5563
|
var ks = [];
|
|
5507
|
-
var checkArgsLength = hasArgsEnumBug && _isArguments(obj);
|
|
5564
|
+
var checkArgsLength = hasArgsEnumBug && _isArguments$1(obj);
|
|
5508
5565
|
for (prop in obj) {
|
|
5509
5566
|
if (_has(prop, obj) && (!checkArgsLength || prop !== 'length')) {
|
|
5510
5567
|
ks[ks.length] = prop;
|
|
@@ -5522,6 +5579,7 @@ _curry1(function keys(obj) {
|
|
|
5522
5579
|
}
|
|
5523
5580
|
return ks;
|
|
5524
5581
|
});
|
|
5582
|
+
var keys$1 = keys;
|
|
5525
5583
|
|
|
5526
5584
|
/**
|
|
5527
5585
|
* Gives a single-word string description of the (native) type of a value,
|
|
@@ -5546,6 +5604,7 @@ _curry1(function keys(obj) {
|
|
|
5546
5604
|
* R.type([]); //=> "Array"
|
|
5547
5605
|
* R.type(/[A-z]/); //=> "RegExp"
|
|
5548
5606
|
* R.type(() => {}); //=> "Function"
|
|
5607
|
+
* R.type(async () => {}); //=> "AsyncFunction"
|
|
5549
5608
|
* R.type(undefined); //=> "Undefined"
|
|
5550
5609
|
*/
|
|
5551
5610
|
|
|
@@ -5553,6 +5612,7 @@ var type = /*#__PURE__*/
|
|
|
5553
5612
|
_curry1(function type(val) {
|
|
5554
5613
|
return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1);
|
|
5555
5614
|
});
|
|
5615
|
+
var type$1 = type;
|
|
5556
5616
|
|
|
5557
5617
|
/**
|
|
5558
5618
|
* private _uniqContentEquals function.
|
|
@@ -5580,8 +5640,8 @@ function _equals(a, b, stackA, stackB) {
|
|
|
5580
5640
|
if (_objectIs$1(a, b)) {
|
|
5581
5641
|
return true;
|
|
5582
5642
|
}
|
|
5583
|
-
var typeA = type(a);
|
|
5584
|
-
if (typeA !== type(b)) {
|
|
5643
|
+
var typeA = type$1(a);
|
|
5644
|
+
if (typeA !== type$1(b)) {
|
|
5585
5645
|
return false;
|
|
5586
5646
|
}
|
|
5587
5647
|
if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') {
|
|
@@ -5660,8 +5720,8 @@ function _equals(a, b, stackA, stackB) {
|
|
|
5660
5720
|
// Values of other types are only equal if identical.
|
|
5661
5721
|
return false;
|
|
5662
5722
|
}
|
|
5663
|
-
var keysA = keys(a);
|
|
5664
|
-
if (keysA.length !== keys(b).length) {
|
|
5723
|
+
var keysA = keys$1(a);
|
|
5724
|
+
if (keysA.length !== keys$1(b).length) {
|
|
5665
5725
|
return false;
|
|
5666
5726
|
}
|
|
5667
5727
|
var extendedStackA = stackA.concat([a]);
|
|
@@ -5707,6 +5767,7 @@ var equals = /*#__PURE__*/
|
|
|
5707
5767
|
_curry2(function equals(a, b) {
|
|
5708
5768
|
return _equals(a, b, [], []);
|
|
5709
5769
|
});
|
|
5770
|
+
var equals$1 = equals;
|
|
5710
5771
|
|
|
5711
5772
|
function _indexOf(list, a, idx) {
|
|
5712
5773
|
var inf, item; // Array.prototype.indexOf doesn't exist below IE9
|
|
@@ -5754,7 +5815,7 @@ function _indexOf(list, a, idx) {
|
|
|
5754
5815
|
} // anything else not covered above, defer to R.equals
|
|
5755
5816
|
|
|
5756
5817
|
while (idx < list.length) {
|
|
5757
|
-
if (equals(list[idx], a)) {
|
|
5818
|
+
if (equals$1(list[idx], a)) {
|
|
5758
5819
|
return idx;
|
|
5759
5820
|
}
|
|
5760
5821
|
idx += 1;
|
|
@@ -5794,6 +5855,7 @@ var _toISOString = typeof Date.prototype.toISOString === 'function' ? function _
|
|
|
5794
5855
|
} : function _toISOString(d) {
|
|
5795
5856
|
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';
|
|
5796
5857
|
};
|
|
5858
|
+
var _toISOString$1 = _toISOString;
|
|
5797
5859
|
|
|
5798
5860
|
function _complement(f) {
|
|
5799
5861
|
return function () {
|
|
@@ -5884,10 +5946,11 @@ _dispatchable(['fantasy-land/filter', 'filter'], _xfilter, function (pred, filte
|
|
|
5884
5946
|
acc[key] = filterable[key];
|
|
5885
5947
|
}
|
|
5886
5948
|
return acc;
|
|
5887
|
-
}, {}, keys(filterable)) :
|
|
5949
|
+
}, {}, keys$1(filterable)) :
|
|
5888
5950
|
// else
|
|
5889
5951
|
_filter(pred, filterable);
|
|
5890
5952
|
}));
|
|
5953
|
+
var filter$1 = filter;
|
|
5891
5954
|
|
|
5892
5955
|
/**
|
|
5893
5956
|
* The complement of [`filter`](#filter).
|
|
@@ -5916,8 +5979,9 @@ _dispatchable(['fantasy-land/filter', 'filter'], _xfilter, function (pred, filte
|
|
|
5916
5979
|
|
|
5917
5980
|
var reject = /*#__PURE__*/
|
|
5918
5981
|
_curry2(function reject(pred, filterable) {
|
|
5919
|
-
return filter(_complement(pred), filterable);
|
|
5982
|
+
return filter$1(_complement(pred), filterable);
|
|
5920
5983
|
});
|
|
5984
|
+
var reject$1 = reject;
|
|
5921
5985
|
|
|
5922
5986
|
function _toString(x, seen) {
|
|
5923
5987
|
var recur = function recur(y) {
|
|
@@ -5934,13 +5998,13 @@ function _toString(x, seen) {
|
|
|
5934
5998
|
case '[object Arguments]':
|
|
5935
5999
|
return '(function() { return arguments; }(' + _map(recur, x).join(', ') + '))';
|
|
5936
6000
|
case '[object Array]':
|
|
5937
|
-
return '[' + _map(recur, x).concat(mapPairs(x, reject(function (k) {
|
|
6001
|
+
return '[' + _map(recur, x).concat(mapPairs(x, reject$1(function (k) {
|
|
5938
6002
|
return /^\d+$/.test(k);
|
|
5939
|
-
}, keys(x)))).join(', ') + ']';
|
|
6003
|
+
}, keys$1(x)))).join(', ') + ']';
|
|
5940
6004
|
case '[object Boolean]':
|
|
5941
6005
|
return _typeof$1(x) === 'object' ? 'new Boolean(' + recur(x.valueOf()) + ')' : x.toString();
|
|
5942
6006
|
case '[object Date]':
|
|
5943
|
-
return 'new Date(' + (isNaN(x.valueOf()) ? recur(NaN) : _quote(_toISOString(x))) + ')';
|
|
6007
|
+
return 'new Date(' + (isNaN(x.valueOf()) ? recur(NaN) : _quote(_toISOString$1(x))) + ')';
|
|
5944
6008
|
case '[object Map]':
|
|
5945
6009
|
return 'new Map(' + recur(Array.from(x)) + ')';
|
|
5946
6010
|
case '[object Null]':
|
|
@@ -5960,7 +6024,7 @@ function _toString(x, seen) {
|
|
|
5960
6024
|
return repr;
|
|
5961
6025
|
}
|
|
5962
6026
|
}
|
|
5963
|
-
return '{' + mapPairs(x, keys(x)).join(', ') + '}';
|
|
6027
|
+
return '{' + mapPairs(x, keys$1(x)).join(', ') + '}';
|
|
5964
6028
|
}
|
|
5965
6029
|
}
|
|
5966
6030
|
|
|
@@ -6005,6 +6069,7 @@ var toString = /*#__PURE__*/
|
|
|
6005
6069
|
_curry1(function toString(val) {
|
|
6006
6070
|
return _toString(val, []);
|
|
6007
6071
|
});
|
|
6072
|
+
var toString$1 = toString;
|
|
6008
6073
|
|
|
6009
6074
|
/**
|
|
6010
6075
|
* Returns the larger of its two arguments.
|
|
@@ -6043,13 +6108,14 @@ _curry2(function max(a, b) {
|
|
|
6043
6108
|
if (maxByType !== undefined) {
|
|
6044
6109
|
return maxByType === _typeof$1(a) ? a : b;
|
|
6045
6110
|
}
|
|
6046
|
-
var stringA = toString(a);
|
|
6047
|
-
var maxByStringValue = safeMax(stringA, toString(b));
|
|
6111
|
+
var stringA = toString$1(a);
|
|
6112
|
+
var maxByStringValue = safeMax(stringA, toString$1(b));
|
|
6048
6113
|
if (maxByStringValue !== undefined) {
|
|
6049
6114
|
return maxByStringValue === stringA ? a : b;
|
|
6050
6115
|
}
|
|
6051
6116
|
return b;
|
|
6052
6117
|
});
|
|
6118
|
+
var max$1 = max;
|
|
6053
6119
|
|
|
6054
6120
|
var XMap = /*#__PURE__*/
|
|
6055
6121
|
function () {
|
|
@@ -6069,6 +6135,7 @@ var _xmap = function _xmap(f) {
|
|
|
6069
6135
|
return new XMap(f, xf);
|
|
6070
6136
|
};
|
|
6071
6137
|
};
|
|
6138
|
+
var _xmap$1 = _xmap;
|
|
6072
6139
|
|
|
6073
6140
|
/**
|
|
6074
6141
|
* Takes a function and
|
|
@@ -6108,21 +6175,22 @@ var _xmap = function _xmap(f) {
|
|
|
6108
6175
|
|
|
6109
6176
|
var map = /*#__PURE__*/
|
|
6110
6177
|
_curry2( /*#__PURE__*/
|
|
6111
|
-
_dispatchable(['fantasy-land/map', 'map'], _xmap, function map(fn, functor) {
|
|
6178
|
+
_dispatchable(['fantasy-land/map', 'map'], _xmap$1, function map(fn, functor) {
|
|
6112
6179
|
switch (Object.prototype.toString.call(functor)) {
|
|
6113
6180
|
case '[object Function]':
|
|
6114
|
-
return curryN(functor.length, function () {
|
|
6181
|
+
return curryN$1(functor.length, function () {
|
|
6115
6182
|
return fn.call(this, functor.apply(this, arguments));
|
|
6116
6183
|
});
|
|
6117
6184
|
case '[object Object]':
|
|
6118
6185
|
return _arrayReduce(function (acc, key) {
|
|
6119
6186
|
acc[key] = fn(functor[key]);
|
|
6120
6187
|
return acc;
|
|
6121
|
-
}, {}, keys(functor));
|
|
6188
|
+
}, {}, keys$1(functor));
|
|
6122
6189
|
default:
|
|
6123
6190
|
return _map(fn, functor);
|
|
6124
6191
|
}
|
|
6125
6192
|
}));
|
|
6193
|
+
var map$1 = map;
|
|
6126
6194
|
|
|
6127
6195
|
function _isString(x) {
|
|
6128
6196
|
return Object.prototype.toString.call(x) === '[object String]';
|
|
@@ -6169,11 +6237,12 @@ _curry1(function isArrayLike(x) {
|
|
|
6169
6237
|
}
|
|
6170
6238
|
return false;
|
|
6171
6239
|
});
|
|
6240
|
+
var _isArrayLike$1 = _isArrayLike;
|
|
6172
6241
|
|
|
6173
6242
|
var symIterator = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator';
|
|
6174
6243
|
function _createReduce(arrayReduce, methodReduce, iterableReduce) {
|
|
6175
6244
|
return function _reduce(xf, acc, list) {
|
|
6176
|
-
if (_isArrayLike(list)) {
|
|
6245
|
+
if (_isArrayLike$1(list)) {
|
|
6177
6246
|
return arrayReduce(xf, acc, list);
|
|
6178
6247
|
}
|
|
6179
6248
|
if (list == null) {
|
|
@@ -6238,6 +6307,7 @@ _curry2(function bind(fn, thisObj) {
|
|
|
6238
6307
|
return fn.apply(thisObj, arguments);
|
|
6239
6308
|
});
|
|
6240
6309
|
});
|
|
6310
|
+
var bind$1 = bind;
|
|
6241
6311
|
|
|
6242
6312
|
function _xIterableReduce(xf, acc, iter) {
|
|
6243
6313
|
var step = iter.next();
|
|
@@ -6252,10 +6322,11 @@ function _xIterableReduce(xf, acc, iter) {
|
|
|
6252
6322
|
return xf['@@transducer/result'](acc);
|
|
6253
6323
|
}
|
|
6254
6324
|
function _xMethodReduce(xf, acc, obj, methodName) {
|
|
6255
|
-
return xf['@@transducer/result'](obj[methodName](bind(xf['@@transducer/step'], xf), acc));
|
|
6325
|
+
return xf['@@transducer/result'](obj[methodName](bind$1(xf['@@transducer/step'], xf), acc));
|
|
6256
6326
|
}
|
|
6257
6327
|
var _xReduce = /*#__PURE__*/
|
|
6258
6328
|
_createReduce(_xArrayReduce, _xMethodReduce, _xIterableReduce);
|
|
6329
|
+
var _xReduce$1 = _xReduce;
|
|
6259
6330
|
|
|
6260
6331
|
var XWrap = /*#__PURE__*/
|
|
6261
6332
|
function () {
|
|
@@ -6332,8 +6403,9 @@ function _xwrap(fn) {
|
|
|
6332
6403
|
|
|
6333
6404
|
var reduce = /*#__PURE__*/
|
|
6334
6405
|
_curry3(function (xf, acc, list) {
|
|
6335
|
-
return _xReduce(typeof xf === 'function' ? _xwrap(xf) : xf, acc, list);
|
|
6406
|
+
return _xReduce$1(typeof xf === 'function' ? _xwrap(xf) : xf, acc, list);
|
|
6336
6407
|
});
|
|
6408
|
+
var reduce$1 = reduce;
|
|
6337
6409
|
|
|
6338
6410
|
function _identity(x) {
|
|
6339
6411
|
return x;
|
|
@@ -6361,6 +6433,7 @@ function _identity(x) {
|
|
|
6361
6433
|
|
|
6362
6434
|
var identity = /*#__PURE__*/
|
|
6363
6435
|
_curry1(_identity);
|
|
6436
|
+
var identity$1 = identity;
|
|
6364
6437
|
|
|
6365
6438
|
/**
|
|
6366
6439
|
* Returns a function, `fn`, which encapsulates `if/else, if/else, ...` logic.
|
|
@@ -6396,7 +6469,7 @@ _curry1(_identity);
|
|
|
6396
6469
|
|
|
6397
6470
|
var cond = /*#__PURE__*/
|
|
6398
6471
|
_curry1(function cond(pairs) {
|
|
6399
|
-
var arity = reduce(max, 0, map(function (pair) {
|
|
6472
|
+
var arity = reduce$1(max$1, 0, map$1(function (pair) {
|
|
6400
6473
|
return pair[0].length;
|
|
6401
6474
|
}, pairs));
|
|
6402
6475
|
return _arity(arity, function () {
|
|
@@ -6576,12 +6649,14 @@ function hasOrAdd(item, shouldAdd, set) {
|
|
|
6576
6649
|
}
|
|
6577
6650
|
} // A simple Set type that honours R.equals semantics
|
|
6578
6651
|
|
|
6652
|
+
var _Set$1 = _Set;
|
|
6653
|
+
|
|
6579
6654
|
var XUniqBy = /*#__PURE__*/
|
|
6580
6655
|
function () {
|
|
6581
6656
|
function XUniqBy(f, xf) {
|
|
6582
6657
|
this.xf = xf;
|
|
6583
6658
|
this.f = f;
|
|
6584
|
-
this.set = new _Set();
|
|
6659
|
+
this.set = new _Set$1();
|
|
6585
6660
|
}
|
|
6586
6661
|
XUniqBy.prototype['@@transducer/init'] = _xfBase.init;
|
|
6587
6662
|
XUniqBy.prototype['@@transducer/result'] = _xfBase.result;
|
|
@@ -6620,7 +6695,7 @@ function _xuniqBy(f) {
|
|
|
6620
6695
|
var uniqBy = /*#__PURE__*/
|
|
6621
6696
|
_curry2( /*#__PURE__*/
|
|
6622
6697
|
_dispatchable([], _xuniqBy, function (fn, list) {
|
|
6623
|
-
var set = new _Set();
|
|
6698
|
+
var set = new _Set$1();
|
|
6624
6699
|
var result = [];
|
|
6625
6700
|
var idx = 0;
|
|
6626
6701
|
var appliedItem, item;
|
|
@@ -6655,7 +6730,7 @@ var uniqBy$1 = uniqBy;
|
|
|
6655
6730
|
*/
|
|
6656
6731
|
|
|
6657
6732
|
var uniq = /*#__PURE__*/
|
|
6658
|
-
uniqBy$1(identity);
|
|
6733
|
+
uniqBy$1(identity$1);
|
|
6659
6734
|
var uniq$1 = uniq;
|
|
6660
6735
|
|
|
6661
6736
|
function _isNumber(x) {
|
|
@@ -7168,239 +7243,513 @@ var ExceedConstrain = function ExceedConstrain(_ref) {
|
|
|
7168
7243
|
|
|
7169
7244
|
var reactInputMask = {exports: {}};
|
|
7170
7245
|
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7246
|
+
/**
|
|
7247
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
7248
|
+
*
|
|
7249
|
+
* This source code is licensed under the MIT license found in the
|
|
7250
|
+
* LICENSE file in the root directory of this source tree.
|
|
7251
|
+
*/
|
|
7252
|
+
var invariant_1;
|
|
7253
|
+
var hasRequiredInvariant;
|
|
7254
|
+
function requireInvariant() {
|
|
7255
|
+
if (hasRequiredInvariant) return invariant_1;
|
|
7256
|
+
hasRequiredInvariant = 1;
|
|
7257
|
+
|
|
7258
|
+
/**
|
|
7259
|
+
* Use invariant() to assert state which your program assumes to be true.
|
|
7260
|
+
*
|
|
7261
|
+
* Provide sprintf-style format (only %s is supported) and arguments
|
|
7262
|
+
* to provide information about what broke and what you were
|
|
7263
|
+
* expecting.
|
|
7264
|
+
*
|
|
7265
|
+
* The invariant message will be stripped in production, but the invariant
|
|
7266
|
+
* will remain to ensure logic does not differ in production.
|
|
7267
|
+
*/
|
|
7268
|
+
|
|
7269
|
+
var NODE_ENV = process.env.NODE_ENV;
|
|
7270
|
+
var invariant = function invariant(condition, format, a, b, c, d, e, f) {
|
|
7271
|
+
if (NODE_ENV !== 'production') {
|
|
7272
|
+
if (format === undefined) {
|
|
7273
|
+
throw new Error('invariant requires an error message argument');
|
|
7274
|
+
}
|
|
7186
7275
|
}
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
var
|
|
7193
|
-
|
|
7276
|
+
if (!condition) {
|
|
7277
|
+
var error;
|
|
7278
|
+
if (format === undefined) {
|
|
7279
|
+
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
7280
|
+
} else {
|
|
7281
|
+
var args = [a, b, c, d, e, f];
|
|
7282
|
+
var argIndex = 0;
|
|
7283
|
+
error = new Error(format.replace(/%s/g, function () {
|
|
7284
|
+
return args[argIndex++];
|
|
7285
|
+
}));
|
|
7286
|
+
error.name = 'Invariant Violation';
|
|
7194
7287
|
}
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7288
|
+
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
7289
|
+
throw error;
|
|
7290
|
+
}
|
|
7291
|
+
};
|
|
7292
|
+
invariant_1 = invariant;
|
|
7293
|
+
return invariant_1;
|
|
7294
|
+
}
|
|
7295
|
+
|
|
7296
|
+
/**
|
|
7297
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
7298
|
+
*
|
|
7299
|
+
* This source code is licensed under the MIT license found in the
|
|
7300
|
+
* LICENSE file in the root directory of this source tree.
|
|
7301
|
+
*/
|
|
7302
|
+
var warning_1;
|
|
7303
|
+
var hasRequiredWarning;
|
|
7304
|
+
function requireWarning() {
|
|
7305
|
+
if (hasRequiredWarning) return warning_1;
|
|
7306
|
+
hasRequiredWarning = 1;
|
|
7307
|
+
|
|
7308
|
+
/**
|
|
7309
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
|
7310
|
+
* This can be used to log issues in development environments in critical
|
|
7311
|
+
* paths. Removing the logging code for production environments will keep the
|
|
7312
|
+
* same logic and follow the same code paths.
|
|
7313
|
+
*/
|
|
7314
|
+
|
|
7315
|
+
var __DEV__ = process.env.NODE_ENV !== 'production';
|
|
7316
|
+
var warning = function warning() {};
|
|
7317
|
+
if (__DEV__) {
|
|
7318
|
+
var printWarning = function printWarning(format, args) {
|
|
7319
|
+
var len = arguments.length;
|
|
7320
|
+
args = new Array(len > 1 ? len - 1 : 0);
|
|
7321
|
+
for (var key = 1; key < len; key++) {
|
|
7322
|
+
args[key - 1] = arguments[key];
|
|
7323
|
+
}
|
|
7324
|
+
var argIndex = 0;
|
|
7325
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
7326
|
+
return args[argIndex++];
|
|
7327
|
+
});
|
|
7328
|
+
if (typeof console !== 'undefined') {
|
|
7329
|
+
console.error(message);
|
|
7330
|
+
}
|
|
7331
|
+
try {
|
|
7332
|
+
// --- Welcome to debugging React ---
|
|
7333
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
7334
|
+
// to find the callsite that caused this warning to fire.
|
|
7335
|
+
throw new Error(message);
|
|
7336
|
+
} catch (x) {}
|
|
7337
|
+
};
|
|
7338
|
+
warning = function warning(condition, format, args) {
|
|
7339
|
+
var len = arguments.length;
|
|
7340
|
+
args = new Array(len > 2 ? len - 2 : 0);
|
|
7341
|
+
for (var key = 2; key < len; key++) {
|
|
7342
|
+
args[key - 2] = arguments[key];
|
|
7343
|
+
}
|
|
7344
|
+
if (format === undefined) {
|
|
7345
|
+
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
7346
|
+
}
|
|
7347
|
+
if (!condition) {
|
|
7348
|
+
printWarning.apply(null, [format].concat(args));
|
|
7349
|
+
}
|
|
7350
|
+
};
|
|
7200
7351
|
}
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7352
|
+
warning_1 = warning;
|
|
7353
|
+
return warning_1;
|
|
7354
|
+
}
|
|
7355
|
+
|
|
7356
|
+
var reactInputMask_development;
|
|
7357
|
+
var hasRequiredReactInputMask_development;
|
|
7358
|
+
function requireReactInputMask_development() {
|
|
7359
|
+
if (hasRequiredReactInputMask_development) return reactInputMask_development;
|
|
7360
|
+
hasRequiredReactInputMask_development = 1;
|
|
7361
|
+
function _interopDefault(ex) {
|
|
7362
|
+
return ex && _typeof$1(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
|
|
7209
7363
|
}
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7364
|
+
var React = _interopDefault(React__default);
|
|
7365
|
+
var reactDom = require$$1;
|
|
7366
|
+
var invariant = _interopDefault(requireInvariant());
|
|
7367
|
+
var warning = _interopDefault(requireWarning());
|
|
7368
|
+
function _defaults2(obj, defaults) {
|
|
7369
|
+
var keys = Object.getOwnPropertyNames(defaults);
|
|
7370
|
+
for (var i = 0; i < keys.length; i++) {
|
|
7371
|
+
var key = keys[i];
|
|
7372
|
+
var value = Object.getOwnPropertyDescriptor(defaults, key);
|
|
7373
|
+
if (value && value.configurable && obj[key] === undefined) {
|
|
7374
|
+
Object.defineProperty(obj, key, value);
|
|
7375
|
+
}
|
|
7376
|
+
}
|
|
7377
|
+
return obj;
|
|
7213
7378
|
}
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
}))).name = "Invariant Violation";
|
|
7379
|
+
function _extends() {
|
|
7380
|
+
_extends = Object.assign || function (target) {
|
|
7381
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
7382
|
+
var source = arguments[i];
|
|
7383
|
+
for (var key in source) {
|
|
7384
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
7385
|
+
target[key] = source[key];
|
|
7386
|
+
}
|
|
7223
7387
|
}
|
|
7224
|
-
throw l.framesToPop = 1, l;
|
|
7225
7388
|
}
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
if ("selectionStart" in e && "selectionEnd" in e) e.selectionStart = t, e.selectionEnd = n;else {
|
|
7230
|
-
var a = e.createTextRange();
|
|
7231
|
-
a.collapse(!0), a.moveStart("character", t), a.moveEnd("character", n - t), a.select();
|
|
7232
|
-
}
|
|
7389
|
+
return target;
|
|
7390
|
+
};
|
|
7391
|
+
return _extends.apply(this, arguments);
|
|
7233
7392
|
}
|
|
7234
|
-
function
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
|
|
7393
|
+
function _inheritsLoose(subClass, superClass) {
|
|
7394
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
7395
|
+
subClass.prototype.constructor = subClass;
|
|
7396
|
+
_defaults2(subClass, superClass);
|
|
7397
|
+
}
|
|
7398
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
7399
|
+
if (source == null) return {};
|
|
7400
|
+
var target = {};
|
|
7401
|
+
var sourceKeys = Object.keys(source);
|
|
7402
|
+
var key, i;
|
|
7403
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
7404
|
+
key = sourceKeys[i];
|
|
7405
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
7406
|
+
target[key] = source[key];
|
|
7240
7407
|
}
|
|
7241
|
-
return
|
|
7242
|
-
start: t,
|
|
7243
|
-
end: n,
|
|
7244
|
-
length: n - t
|
|
7245
|
-
};
|
|
7408
|
+
return target;
|
|
7246
7409
|
}
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
function
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7410
|
+
function _assertThisInitialized(self) {
|
|
7411
|
+
if (self === void 0) {
|
|
7412
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
7413
|
+
}
|
|
7414
|
+
return self;
|
|
7415
|
+
}
|
|
7416
|
+
function setInputSelection(input, start, end) {
|
|
7417
|
+
if ('selectionStart' in input && 'selectionEnd' in input) {
|
|
7418
|
+
input.selectionStart = start;
|
|
7419
|
+
input.selectionEnd = end;
|
|
7420
|
+
} else {
|
|
7421
|
+
var range = input.createTextRange();
|
|
7422
|
+
range.collapse(true);
|
|
7423
|
+
range.moveStart('character', start);
|
|
7424
|
+
range.moveEnd('character', end - start);
|
|
7425
|
+
range.select();
|
|
7426
|
+
}
|
|
7427
|
+
}
|
|
7428
|
+
function getInputSelection(input) {
|
|
7429
|
+
var start = 0;
|
|
7430
|
+
var end = 0;
|
|
7431
|
+
if ('selectionStart' in input && 'selectionEnd' in input) {
|
|
7432
|
+
start = input.selectionStart;
|
|
7433
|
+
end = input.selectionEnd;
|
|
7434
|
+
} else {
|
|
7435
|
+
var range = document.selection.createRange();
|
|
7436
|
+
if (range.parentElement() === input) {
|
|
7437
|
+
start = -range.moveStart('character', -input.value.length);
|
|
7438
|
+
end = -range.moveEnd('character', -input.value.length);
|
|
7439
|
+
}
|
|
7440
|
+
}
|
|
7441
|
+
return {
|
|
7442
|
+
start: start,
|
|
7443
|
+
end: end,
|
|
7444
|
+
length: end - start
|
|
7265
7445
|
};
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7446
|
+
}
|
|
7447
|
+
var defaultFormatChars = {
|
|
7448
|
+
'9': '[0-9]',
|
|
7449
|
+
'a': '[A-Za-z]',
|
|
7450
|
+
'*': '[A-Za-z0-9]'
|
|
7451
|
+
};
|
|
7452
|
+
var defaultMaskChar = '_';
|
|
7453
|
+
function parseMask(mask, maskChar, formatChars) {
|
|
7454
|
+
var parsedMaskString = '';
|
|
7455
|
+
var prefix = '';
|
|
7456
|
+
var lastEditablePosition = null;
|
|
7457
|
+
var permanents = [];
|
|
7458
|
+
if (maskChar === undefined) {
|
|
7459
|
+
maskChar = defaultMaskChar;
|
|
7460
|
+
}
|
|
7461
|
+
if (formatChars == null) {
|
|
7462
|
+
formatChars = defaultFormatChars;
|
|
7463
|
+
}
|
|
7464
|
+
if (!mask || typeof mask !== 'string') {
|
|
7465
|
+
return {
|
|
7466
|
+
maskChar: maskChar,
|
|
7467
|
+
formatChars: formatChars,
|
|
7468
|
+
mask: null,
|
|
7469
|
+
prefix: null,
|
|
7470
|
+
lastEditablePosition: null,
|
|
7471
|
+
permanents: []
|
|
7472
|
+
};
|
|
7473
|
+
}
|
|
7474
|
+
var isPermanent = false;
|
|
7475
|
+
mask.split('').forEach(function (character) {
|
|
7476
|
+
if (!isPermanent && character === '\\') {
|
|
7477
|
+
isPermanent = true;
|
|
7478
|
+
} else {
|
|
7479
|
+
if (isPermanent || !formatChars[character]) {
|
|
7480
|
+
permanents.push(parsedMaskString.length);
|
|
7481
|
+
if (parsedMaskString.length === permanents.length - 1) {
|
|
7482
|
+
prefix += character;
|
|
7483
|
+
}
|
|
7484
|
+
} else {
|
|
7485
|
+
lastEditablePosition = parsedMaskString.length + 1;
|
|
7486
|
+
}
|
|
7487
|
+
parsedMaskString += character;
|
|
7488
|
+
isPermanent = false;
|
|
7489
|
+
}
|
|
7490
|
+
});
|
|
7491
|
+
return {
|
|
7492
|
+
maskChar: maskChar,
|
|
7493
|
+
formatChars: formatChars,
|
|
7494
|
+
prefix: prefix,
|
|
7495
|
+
mask: parsedMaskString,
|
|
7496
|
+
lastEditablePosition: lastEditablePosition,
|
|
7497
|
+
permanents: permanents
|
|
7276
7498
|
};
|
|
7277
7499
|
}
|
|
7278
|
-
|
|
7279
|
-
|
|
7500
|
+
|
|
7501
|
+
/* eslint no-use-before-define: ["error", { functions: false }] */
|
|
7502
|
+
function isPermanentCharacter(maskOptions, pos) {
|
|
7503
|
+
return maskOptions.permanents.indexOf(pos) !== -1;
|
|
7280
7504
|
}
|
|
7281
|
-
function isAllowedCharacter(
|
|
7282
|
-
var
|
|
7283
|
-
|
|
7284
|
-
if (!
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
|
|
7505
|
+
function isAllowedCharacter(maskOptions, pos, character) {
|
|
7506
|
+
var mask = maskOptions.mask,
|
|
7507
|
+
formatChars = maskOptions.formatChars;
|
|
7508
|
+
if (!character) {
|
|
7509
|
+
return false;
|
|
7510
|
+
}
|
|
7511
|
+
if (isPermanentCharacter(maskOptions, pos)) {
|
|
7512
|
+
return mask[pos] === character;
|
|
7513
|
+
}
|
|
7514
|
+
var ruleChar = mask[pos];
|
|
7515
|
+
var charRule = formatChars[ruleChar];
|
|
7516
|
+
return new RegExp(charRule).test(character);
|
|
7288
7517
|
}
|
|
7289
|
-
function isEmpty(
|
|
7290
|
-
return
|
|
7291
|
-
return isPermanentCharacter(
|
|
7518
|
+
function isEmpty(maskOptions, value) {
|
|
7519
|
+
return value.split('').every(function (character, i) {
|
|
7520
|
+
return isPermanentCharacter(maskOptions, i) || !isAllowedCharacter(maskOptions, i, character);
|
|
7292
7521
|
});
|
|
7293
7522
|
}
|
|
7294
|
-
function getFilledLength(
|
|
7295
|
-
var
|
|
7296
|
-
|
|
7297
|
-
if (!
|
|
7298
|
-
|
|
7299
|
-
|
|
7523
|
+
function getFilledLength(maskOptions, value) {
|
|
7524
|
+
var maskChar = maskOptions.maskChar,
|
|
7525
|
+
prefix = maskOptions.prefix;
|
|
7526
|
+
if (!maskChar) {
|
|
7527
|
+
while (value.length > prefix.length && isPermanentCharacter(maskOptions, value.length - 1)) {
|
|
7528
|
+
value = value.slice(0, value.length - 1);
|
|
7529
|
+
}
|
|
7530
|
+
return value.length;
|
|
7300
7531
|
}
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7532
|
+
var filledLength = prefix.length;
|
|
7533
|
+
for (var i = value.length; i >= prefix.length; i--) {
|
|
7534
|
+
var character = value[i];
|
|
7535
|
+
var isEnteredCharacter = !isPermanentCharacter(maskOptions, i) && isAllowedCharacter(maskOptions, i, character);
|
|
7536
|
+
if (isEnteredCharacter) {
|
|
7537
|
+
filledLength = i + 1;
|
|
7305
7538
|
break;
|
|
7306
7539
|
}
|
|
7307
7540
|
}
|
|
7308
|
-
return
|
|
7541
|
+
return filledLength;
|
|
7309
7542
|
}
|
|
7310
|
-
function isFilled(
|
|
7311
|
-
return getFilledLength(
|
|
7543
|
+
function isFilled(maskOptions, value) {
|
|
7544
|
+
return getFilledLength(maskOptions, value) === maskOptions.mask.length;
|
|
7312
7545
|
}
|
|
7313
|
-
function formatValue(
|
|
7314
|
-
var
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
if (!
|
|
7318
|
-
|
|
7319
|
-
|
|
7546
|
+
function formatValue(maskOptions, value) {
|
|
7547
|
+
var maskChar = maskOptions.maskChar,
|
|
7548
|
+
mask = maskOptions.mask,
|
|
7549
|
+
prefix = maskOptions.prefix;
|
|
7550
|
+
if (!maskChar) {
|
|
7551
|
+
value = insertString(maskOptions, '', value, 0);
|
|
7552
|
+
if (value.length < prefix.length) {
|
|
7553
|
+
value = prefix;
|
|
7554
|
+
}
|
|
7555
|
+
while (value.length < mask.length && isPermanentCharacter(maskOptions, value.length)) {
|
|
7556
|
+
value += mask[value.length];
|
|
7557
|
+
}
|
|
7558
|
+
return value;
|
|
7320
7559
|
}
|
|
7321
|
-
if (
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
l = e.split("");
|
|
7331
|
-
if (r) return l.map(function (e, t) {
|
|
7332
|
-
return t < a || i <= t ? e : isPermanentCharacter(n, t) ? o[t] : r;
|
|
7333
|
-
}).join("");
|
|
7334
|
-
for (var u = i; u < l.length; u++) isPermanentCharacter(n, u) && (l[u] = "");
|
|
7335
|
-
return a = Math.max(s.length, a), l.splice(a, i - a), e = l.join(""), formatValue(n, e);
|
|
7336
|
-
}
|
|
7337
|
-
function insertString(r, o, e, s) {
|
|
7338
|
-
var l = r.mask,
|
|
7339
|
-
u = r.maskChar,
|
|
7340
|
-
c = r.prefix,
|
|
7341
|
-
t = e.split(""),
|
|
7342
|
-
h = isFilled(r, o);
|
|
7343
|
-
return !u && s > o.length && (o += l.slice(o.length, s)), t.every(function (e) {
|
|
7344
|
-
for (; i = e, isPermanentCharacter(r, a = s) && i !== l[a];) {
|
|
7345
|
-
if (s >= o.length && (o += l[s]), t = e, n = s, u && isPermanentCharacter(r, n) && t === u) return !0;
|
|
7346
|
-
if (++s >= l.length) return !1;
|
|
7560
|
+
if (value) {
|
|
7561
|
+
var emptyValue = formatValue(maskOptions, '');
|
|
7562
|
+
return insertString(maskOptions, emptyValue, value, 0);
|
|
7563
|
+
}
|
|
7564
|
+
for (var i = 0; i < mask.length; i++) {
|
|
7565
|
+
if (isPermanentCharacter(maskOptions, i)) {
|
|
7566
|
+
value += mask[i];
|
|
7567
|
+
} else {
|
|
7568
|
+
value += maskChar;
|
|
7347
7569
|
}
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
}), o;
|
|
7351
|
-
}
|
|
7352
|
-
function getInsertStringLength(a, e, t, i) {
|
|
7353
|
-
var r = a.mask,
|
|
7354
|
-
o = a.maskChar,
|
|
7355
|
-
n = t.split(""),
|
|
7356
|
-
s = i;
|
|
7357
|
-
return n.every(function (e) {
|
|
7358
|
-
for (; n = e, isPermanentCharacter(a, t = i) && n !== r[t];) if (++i >= r.length) return !1;
|
|
7359
|
-
var t, n;
|
|
7360
|
-
return (isAllowedCharacter(a, i, e) || e === o) && i++, i < r.length;
|
|
7361
|
-
}), i - s;
|
|
7362
|
-
}
|
|
7363
|
-
function getLeftEditablePosition(e, t) {
|
|
7364
|
-
for (var n = t; 0 <= n; --n) if (!isPermanentCharacter(e, n)) return n;
|
|
7365
|
-
return null;
|
|
7366
|
-
}
|
|
7367
|
-
function getRightEditablePosition(e, t) {
|
|
7368
|
-
for (var n = e.mask, a = t; a < n.length; ++a) if (!isPermanentCharacter(e, a)) return a;
|
|
7369
|
-
return null;
|
|
7370
|
-
}
|
|
7371
|
-
function getStringValue(e) {
|
|
7372
|
-
return e || 0 === e ? e + "" : "";
|
|
7570
|
+
}
|
|
7571
|
+
return value;
|
|
7373
7572
|
}
|
|
7374
|
-
function
|
|
7375
|
-
var
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7573
|
+
function clearRange(maskOptions, value, start, len) {
|
|
7574
|
+
var end = start + len;
|
|
7575
|
+
var maskChar = maskOptions.maskChar,
|
|
7576
|
+
mask = maskOptions.mask,
|
|
7577
|
+
prefix = maskOptions.prefix;
|
|
7578
|
+
var arrayValue = value.split('');
|
|
7579
|
+
if (!maskChar) {
|
|
7580
|
+
// remove any permanent chars after clear range, they will be added back by formatValue
|
|
7581
|
+
for (var i = end; i < arrayValue.length; i++) {
|
|
7582
|
+
if (isPermanentCharacter(maskOptions, i)) {
|
|
7583
|
+
arrayValue[i] = '';
|
|
7584
|
+
}
|
|
7585
|
+
}
|
|
7586
|
+
start = Math.max(prefix.length, start);
|
|
7587
|
+
arrayValue.splice(start, end - start);
|
|
7588
|
+
value = arrayValue.join('');
|
|
7589
|
+
return formatValue(maskOptions, value);
|
|
7386
7590
|
}
|
|
7387
|
-
return
|
|
7388
|
-
|
|
7389
|
-
|
|
7591
|
+
return arrayValue.map(function (character, i) {
|
|
7592
|
+
if (i < start || i >= end) {
|
|
7593
|
+
return character;
|
|
7594
|
+
}
|
|
7595
|
+
if (isPermanentCharacter(maskOptions, i)) {
|
|
7596
|
+
return mask[i];
|
|
7597
|
+
}
|
|
7598
|
+
return maskChar;
|
|
7599
|
+
}).join('');
|
|
7600
|
+
}
|
|
7601
|
+
function insertString(maskOptions, value, insertStr, insertPosition) {
|
|
7602
|
+
var mask = maskOptions.mask,
|
|
7603
|
+
maskChar = maskOptions.maskChar,
|
|
7604
|
+
prefix = maskOptions.prefix;
|
|
7605
|
+
var arrayInsertStr = insertStr.split('');
|
|
7606
|
+
var isInputFilled = isFilled(maskOptions, value);
|
|
7607
|
+
var isUsablePosition = function isUsablePosition(pos, character) {
|
|
7608
|
+
return !isPermanentCharacter(maskOptions, pos) || character === mask[pos];
|
|
7609
|
+
};
|
|
7610
|
+
var isUsableCharacter = function isUsableCharacter(character, pos) {
|
|
7611
|
+
return !maskChar || !isPermanentCharacter(maskOptions, pos) || character !== maskChar;
|
|
7612
|
+
};
|
|
7613
|
+
if (!maskChar && insertPosition > value.length) {
|
|
7614
|
+
value += mask.slice(value.length, insertPosition);
|
|
7615
|
+
}
|
|
7616
|
+
arrayInsertStr.every(function (insertCharacter) {
|
|
7617
|
+
while (!isUsablePosition(insertPosition, insertCharacter)) {
|
|
7618
|
+
if (insertPosition >= value.length) {
|
|
7619
|
+
value += mask[insertPosition];
|
|
7620
|
+
}
|
|
7621
|
+
if (!isUsableCharacter(insertCharacter, insertPosition)) {
|
|
7622
|
+
return true;
|
|
7623
|
+
}
|
|
7624
|
+
insertPosition++; // stop iteration if maximum value length reached
|
|
7625
|
+
|
|
7626
|
+
if (insertPosition >= mask.length) {
|
|
7627
|
+
return false;
|
|
7628
|
+
}
|
|
7629
|
+
}
|
|
7630
|
+
var isAllowed = isAllowedCharacter(maskOptions, insertPosition, insertCharacter) || insertCharacter === maskChar;
|
|
7631
|
+
if (!isAllowed) {
|
|
7632
|
+
return true;
|
|
7633
|
+
}
|
|
7634
|
+
if (insertPosition < value.length) {
|
|
7635
|
+
if (maskChar || isInputFilled || insertPosition < prefix.length) {
|
|
7636
|
+
value = value.slice(0, insertPosition) + insertCharacter + value.slice(insertPosition + 1);
|
|
7637
|
+
} else {
|
|
7638
|
+
value = value.slice(0, insertPosition) + insertCharacter + value.slice(insertPosition);
|
|
7639
|
+
value = formatValue(maskOptions, value);
|
|
7640
|
+
}
|
|
7641
|
+
} else if (!maskChar) {
|
|
7642
|
+
value += insertCharacter;
|
|
7643
|
+
}
|
|
7644
|
+
insertPosition++; // stop iteration if maximum value length reached
|
|
7645
|
+
|
|
7646
|
+
return insertPosition < mask.length;
|
|
7647
|
+
});
|
|
7648
|
+
return value;
|
|
7649
|
+
}
|
|
7650
|
+
function getInsertStringLength(maskOptions, value, insertStr, insertPosition) {
|
|
7651
|
+
var mask = maskOptions.mask,
|
|
7652
|
+
maskChar = maskOptions.maskChar;
|
|
7653
|
+
var arrayInsertStr = insertStr.split('');
|
|
7654
|
+
var initialInsertPosition = insertPosition;
|
|
7655
|
+
var isUsablePosition = function isUsablePosition(pos, character) {
|
|
7656
|
+
return !isPermanentCharacter(maskOptions, pos) || character === mask[pos];
|
|
7657
|
+
};
|
|
7658
|
+
arrayInsertStr.every(function (insertCharacter) {
|
|
7659
|
+
while (!isUsablePosition(insertPosition, insertCharacter)) {
|
|
7660
|
+
insertPosition++; // stop iteration if maximum value length reached
|
|
7661
|
+
|
|
7662
|
+
if (insertPosition >= mask.length) {
|
|
7663
|
+
return false;
|
|
7664
|
+
}
|
|
7665
|
+
}
|
|
7666
|
+
var isAllowed = isAllowedCharacter(maskOptions, insertPosition, insertCharacter) || insertCharacter === maskChar;
|
|
7667
|
+
if (isAllowed) {
|
|
7668
|
+
insertPosition++;
|
|
7669
|
+
} // stop iteration if maximum value length reached
|
|
7670
|
+
|
|
7671
|
+
return insertPosition < mask.length;
|
|
7672
|
+
});
|
|
7673
|
+
return insertPosition - initialInsertPosition;
|
|
7674
|
+
}
|
|
7675
|
+
function getLeftEditablePosition(maskOptions, pos) {
|
|
7676
|
+
for (var i = pos; i >= 0; --i) {
|
|
7677
|
+
if (!isPermanentCharacter(maskOptions, i)) {
|
|
7678
|
+
return i;
|
|
7679
|
+
}
|
|
7680
|
+
}
|
|
7681
|
+
return null;
|
|
7682
|
+
}
|
|
7683
|
+
function getRightEditablePosition(maskOptions, pos) {
|
|
7684
|
+
var mask = maskOptions.mask;
|
|
7685
|
+
for (var i = pos; i < mask.length; ++i) {
|
|
7686
|
+
if (!isPermanentCharacter(maskOptions, i)) {
|
|
7687
|
+
return i;
|
|
7688
|
+
}
|
|
7689
|
+
}
|
|
7690
|
+
return null;
|
|
7691
|
+
}
|
|
7692
|
+
function getStringValue(value) {
|
|
7693
|
+
return !value && value !== 0 ? '' : value + '';
|
|
7694
|
+
}
|
|
7695
|
+
function processChange(maskOptions, value, selection, previousValue, previousSelection) {
|
|
7696
|
+
var mask = maskOptions.mask,
|
|
7697
|
+
prefix = maskOptions.prefix,
|
|
7698
|
+
lastEditablePosition = maskOptions.lastEditablePosition;
|
|
7699
|
+
var newValue = value;
|
|
7700
|
+
var enteredString = '';
|
|
7701
|
+
var formattedEnteredStringLength = 0;
|
|
7702
|
+
var removedLength = 0;
|
|
7703
|
+
var cursorPosition = Math.min(previousSelection.start, selection.start);
|
|
7704
|
+
if (selection.end > previousSelection.start) {
|
|
7705
|
+
enteredString = newValue.slice(previousSelection.start, selection.end);
|
|
7706
|
+
formattedEnteredStringLength = getInsertStringLength(maskOptions, previousValue, enteredString, cursorPosition);
|
|
7707
|
+
if (!formattedEnteredStringLength) {
|
|
7708
|
+
removedLength = 0;
|
|
7709
|
+
} else {
|
|
7710
|
+
removedLength = previousSelection.length;
|
|
7711
|
+
}
|
|
7712
|
+
} else if (newValue.length < previousValue.length) {
|
|
7713
|
+
removedLength = previousValue.length - newValue.length;
|
|
7714
|
+
}
|
|
7715
|
+
newValue = previousValue;
|
|
7716
|
+
if (removedLength) {
|
|
7717
|
+
if (removedLength === 1 && !previousSelection.length) {
|
|
7718
|
+
var deleteFromRight = previousSelection.start === selection.start;
|
|
7719
|
+
cursorPosition = deleteFromRight ? getRightEditablePosition(maskOptions, selection.start) : getLeftEditablePosition(maskOptions, selection.start);
|
|
7720
|
+
}
|
|
7721
|
+
newValue = clearRange(maskOptions, newValue, cursorPosition, removedLength);
|
|
7722
|
+
}
|
|
7723
|
+
newValue = insertString(maskOptions, newValue, enteredString, cursorPosition);
|
|
7724
|
+
cursorPosition = cursorPosition + formattedEnteredStringLength;
|
|
7725
|
+
if (cursorPosition >= mask.length) {
|
|
7726
|
+
cursorPosition = mask.length;
|
|
7727
|
+
} else if (cursorPosition < prefix.length && !formattedEnteredStringLength) {
|
|
7728
|
+
cursorPosition = prefix.length;
|
|
7729
|
+
} else if (cursorPosition >= prefix.length && cursorPosition < lastEditablePosition && formattedEnteredStringLength) {
|
|
7730
|
+
cursorPosition = getRightEditablePosition(maskOptions, cursorPosition);
|
|
7731
|
+
}
|
|
7732
|
+
newValue = formatValue(maskOptions, newValue);
|
|
7733
|
+
if (!enteredString) {
|
|
7734
|
+
enteredString = null;
|
|
7735
|
+
}
|
|
7736
|
+
return {
|
|
7737
|
+
value: newValue,
|
|
7738
|
+
enteredString: enteredString,
|
|
7390
7739
|
selection: {
|
|
7391
|
-
start:
|
|
7392
|
-
end:
|
|
7740
|
+
start: cursorPosition,
|
|
7741
|
+
end: cursorPosition
|
|
7393
7742
|
}
|
|
7394
7743
|
};
|
|
7395
7744
|
}
|
|
7396
7745
|
function isWindowsPhoneBrowser() {
|
|
7397
|
-
var
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
return
|
|
7746
|
+
var windows = new RegExp('windows', 'i');
|
|
7747
|
+
var phone = new RegExp('phone', 'i');
|
|
7748
|
+
var ua = navigator.userAgent;
|
|
7749
|
+
return windows.test(ua) && phone.test(ua);
|
|
7401
7750
|
}
|
|
7402
|
-
function isFunction(
|
|
7403
|
-
return
|
|
7751
|
+
function isFunction(value) {
|
|
7752
|
+
return typeof value === 'function';
|
|
7404
7753
|
}
|
|
7405
7754
|
function getRequestAnimationFrame() {
|
|
7406
7755
|
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
|
|
@@ -7408,964 +7757,179 @@ function requireReactInputMask_production_min() {
|
|
|
7408
7757
|
function getCancelAnimationFrame() {
|
|
7409
7758
|
return window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame;
|
|
7410
7759
|
}
|
|
7411
|
-
function defer(
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7760
|
+
function defer(fn) {
|
|
7761
|
+
var hasCancelAnimationFrame = !!getCancelAnimationFrame();
|
|
7762
|
+
var deferFn;
|
|
7763
|
+
if (hasCancelAnimationFrame) {
|
|
7764
|
+
deferFn = getRequestAnimationFrame();
|
|
7765
|
+
} else {
|
|
7766
|
+
deferFn = function deferFn() {
|
|
7767
|
+
return setTimeout(fn, 1000 / 60);
|
|
7768
|
+
};
|
|
7769
|
+
}
|
|
7770
|
+
return deferFn(fn);
|
|
7415
7771
|
}
|
|
7416
|
-
function cancelDefer(
|
|
7417
|
-
|
|
7772
|
+
function cancelDefer(deferId) {
|
|
7773
|
+
var cancelFn = getCancelAnimationFrame() || clearTimeout;
|
|
7774
|
+
cancelFn(deferId);
|
|
7418
7775
|
}
|
|
7419
|
-
var InputElement =
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
return e ? e.value : null;
|
|
7438
|
-
}, f.setInputValue = function (e) {
|
|
7439
|
-
var t = f.getInputDOMNode();
|
|
7440
|
-
t && (f.value = e, t.value = e);
|
|
7441
|
-
}, f.setCursorToEnd = function () {
|
|
7442
|
-
var e = getFilledLength(f.maskOptions, f.value),
|
|
7443
|
-
t = getRightEditablePosition(f.maskOptions, e);
|
|
7444
|
-
null !== t && f.setCursorPosition(t);
|
|
7445
|
-
}, f.setSelection = function (e, t, n) {
|
|
7446
|
-
void 0 === n && (n = {});
|
|
7447
|
-
var a = f.getInputDOMNode(),
|
|
7448
|
-
i = f.isFocused();
|
|
7449
|
-
a && i && (n.deferred || setInputSelection(a, e, t), null !== f.selectionDeferId && cancelDefer(f.selectionDeferId), f.selectionDeferId = defer(function () {
|
|
7450
|
-
f.selectionDeferId = null, setInputSelection(a, e, t);
|
|
7451
|
-
}), f.previousSelection = {
|
|
7452
|
-
start: e,
|
|
7453
|
-
end: t,
|
|
7454
|
-
length: Math.abs(t - e)
|
|
7455
|
-
});
|
|
7456
|
-
}, f.getSelection = function () {
|
|
7457
|
-
return getInputSelection(f.getInputDOMNode());
|
|
7458
|
-
}, f.getCursorPosition = function () {
|
|
7459
|
-
return f.getSelection().start;
|
|
7460
|
-
}, f.setCursorPosition = function (e) {
|
|
7461
|
-
f.setSelection(e, e);
|
|
7462
|
-
}, f.isFocused = function () {
|
|
7463
|
-
return f.focused;
|
|
7464
|
-
}, f.getBeforeMaskedValueChangeConfig = function () {
|
|
7465
|
-
var e = f.maskOptions,
|
|
7466
|
-
t = e.mask,
|
|
7467
|
-
n = e.maskChar,
|
|
7468
|
-
a = e.permanents,
|
|
7469
|
-
i = e.formatChars;
|
|
7470
|
-
return {
|
|
7471
|
-
mask: t,
|
|
7472
|
-
maskChar: n,
|
|
7473
|
-
permanents: a,
|
|
7474
|
-
alwaysShowMask: !!f.props.alwaysShowMask,
|
|
7475
|
-
formatChars: i
|
|
7476
|
-
};
|
|
7477
|
-
}, f.isInputAutofilled = function (e, t, n, a) {
|
|
7478
|
-
var i = f.getInputDOMNode();
|
|
7479
|
-
try {
|
|
7480
|
-
if (i.matches(":-webkit-autofill")) return !0;
|
|
7481
|
-
} catch (r) {}
|
|
7482
|
-
return !f.focused || a.end < n.length && t.end === e.length;
|
|
7483
|
-
}, f.onChange = function (e) {
|
|
7484
|
-
var t = _assertThisInitialized(_assertThisInitialized(f)).beforePasteState,
|
|
7485
|
-
n = _assertThisInitialized(_assertThisInitialized(f)).previousSelection,
|
|
7486
|
-
a = f.props.beforeMaskedValueChange,
|
|
7487
|
-
i = f.getInputValue(),
|
|
7488
|
-
r = f.value,
|
|
7489
|
-
o = f.getSelection();
|
|
7490
|
-
f.isInputAutofilled(i, o, r, n) && (r = formatValue(f.maskOptions, ""), n = {
|
|
7491
|
-
start: 0,
|
|
7492
|
-
end: 0,
|
|
7493
|
-
length: 0
|
|
7494
|
-
}), t && (n = t.selection, r = t.value, o = {
|
|
7495
|
-
start: n.start + i.length,
|
|
7496
|
-
end: n.start + i.length,
|
|
7497
|
-
length: 0
|
|
7498
|
-
}, i = r.slice(0, n.start) + i + r.slice(n.end), f.beforePasteState = null);
|
|
7499
|
-
var s = processChange(f.maskOptions, i, o, r, n),
|
|
7500
|
-
l = s.enteredString,
|
|
7501
|
-
u = s.selection,
|
|
7502
|
-
c = s.value;
|
|
7503
|
-
if (isFunction(a)) {
|
|
7504
|
-
var h = a({
|
|
7505
|
-
value: c,
|
|
7506
|
-
selection: u
|
|
7507
|
-
}, {
|
|
7508
|
-
value: r,
|
|
7509
|
-
selection: n
|
|
7510
|
-
}, l, f.getBeforeMaskedValueChangeConfig());
|
|
7511
|
-
c = h.value, u = h.selection;
|
|
7776
|
+
var InputElement = /*#__PURE__*/
|
|
7777
|
+
function (_React$Component) {
|
|
7778
|
+
_inheritsLoose(InputElement, _React$Component);
|
|
7779
|
+
function InputElement(props) {
|
|
7780
|
+
var _this;
|
|
7781
|
+
_this = _React$Component.call(this, props) || this;
|
|
7782
|
+
_this.focused = false;
|
|
7783
|
+
_this.mounted = false;
|
|
7784
|
+
_this.previousSelection = null;
|
|
7785
|
+
_this.selectionDeferId = null;
|
|
7786
|
+
_this.saveSelectionLoopDeferId = null;
|
|
7787
|
+
_this.saveSelectionLoop = function () {
|
|
7788
|
+
_this.previousSelection = _this.getSelection();
|
|
7789
|
+
_this.saveSelectionLoopDeferId = defer(_this.saveSelectionLoop);
|
|
7790
|
+
};
|
|
7791
|
+
_this.runSaveSelectionLoop = function () {
|
|
7792
|
+
if (_this.saveSelectionLoopDeferId === null) {
|
|
7793
|
+
_this.saveSelectionLoop();
|
|
7512
7794
|
}
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
a = n.mask,
|
|
7520
|
-
i = n.prefix;
|
|
7521
|
-
if (f.focused = !0, f.mounted = !0, a) {
|
|
7522
|
-
if (f.value) getFilledLength(f.maskOptions, f.value) < f.maskOptions.mask.length && f.setCursorToEnd();else {
|
|
7523
|
-
var r = formatValue(f.maskOptions, i),
|
|
7524
|
-
o = formatValue(f.maskOptions, r),
|
|
7525
|
-
s = getFilledLength(f.maskOptions, o),
|
|
7526
|
-
l = getRightEditablePosition(f.maskOptions, s),
|
|
7527
|
-
u = {
|
|
7528
|
-
start: l,
|
|
7529
|
-
end: l
|
|
7530
|
-
};
|
|
7531
|
-
if (isFunction(t)) {
|
|
7532
|
-
var c = t({
|
|
7533
|
-
value: o,
|
|
7534
|
-
selection: u
|
|
7535
|
-
}, {
|
|
7536
|
-
value: f.value,
|
|
7537
|
-
selection: null
|
|
7538
|
-
}, null, f.getBeforeMaskedValueChangeConfig());
|
|
7539
|
-
o = c.value, u = c.selection;
|
|
7540
|
-
}
|
|
7541
|
-
var h = o !== f.getInputValue();
|
|
7542
|
-
h && f.setInputValue(o), h && isFunction(f.props.onChange) && f.props.onChange(e), f.setSelection(u.start, u.end);
|
|
7543
|
-
}
|
|
7544
|
-
f.runSaveSelectionLoop();
|
|
7795
|
+
};
|
|
7796
|
+
_this.stopSaveSelectionLoop = function () {
|
|
7797
|
+
if (_this.saveSelectionLoopDeferId !== null) {
|
|
7798
|
+
cancelDefer(_this.saveSelectionLoopDeferId);
|
|
7799
|
+
_this.saveSelectionLoopDeferId = null;
|
|
7800
|
+
_this.previousSelection = null;
|
|
7545
7801
|
}
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
if (f.stopSaveSelectionLoop(), f.focused = !1, n && !f.props.alwaysShowMask && isEmpty(f.maskOptions, f.value)) {
|
|
7551
|
-
var a = "";
|
|
7552
|
-
if (isFunction(t)) a = t({
|
|
7553
|
-
value: a,
|
|
7554
|
-
selection: null
|
|
7555
|
-
}, {
|
|
7556
|
-
value: f.value,
|
|
7557
|
-
selection: f.previousSelection
|
|
7558
|
-
}, null, f.getBeforeMaskedValueChangeConfig()).value;
|
|
7559
|
-
var i = a !== f.getInputValue();
|
|
7560
|
-
i && f.setInputValue(a), i && isFunction(f.props.onChange) && f.props.onChange(e);
|
|
7802
|
+
};
|
|
7803
|
+
_this.getInputDOMNode = function () {
|
|
7804
|
+
if (!_this.mounted) {
|
|
7805
|
+
return null;
|
|
7561
7806
|
}
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
var t = Math.abs(e.clientX - f.mouseDownX),
|
|
7569
|
-
n = Math.abs(e.clientY - f.mouseDownY),
|
|
7570
|
-
a = Math.max(t, n),
|
|
7571
|
-
i = new Date().getTime() - f.mouseDownTime;
|
|
7572
|
-
(a <= 10 && i <= 200 || a <= 5 && i <= 300) && f.setCursorToEnd();
|
|
7573
|
-
}
|
|
7574
|
-
};
|
|
7575
|
-
document.addEventListener("mouseup", r);
|
|
7807
|
+
var input = reactDom.findDOMNode(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
7808
|
+
var isDOMNode = typeof window !== 'undefined' && input instanceof window.Element; // workaround for react-test-renderer
|
|
7809
|
+
// https://github.com/sanniassin/react-input-mask/issues/147
|
|
7810
|
+
|
|
7811
|
+
if (input && !isDOMNode) {
|
|
7812
|
+
return null;
|
|
7576
7813
|
}
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
isFunction(f.props.onPaste) && f.props.onPaste(e), e.defaultPrevented || (f.beforePasteState = {
|
|
7580
|
-
value: f.getInputValue(),
|
|
7581
|
-
selection: f.getSelection()
|
|
7582
|
-
}, f.setInputValue(""));
|
|
7583
|
-
}, f.handleRef = function (e) {
|
|
7584
|
-
null == f.props.children && isFunction(f.props.inputRef) && f.props.inputRef(e);
|
|
7585
|
-
};
|
|
7586
|
-
var t = e.mask,
|
|
7587
|
-
n = e.maskChar,
|
|
7588
|
-
a = e.formatChars,
|
|
7589
|
-
i = e.alwaysShowMask,
|
|
7590
|
-
r = e.beforeMaskedValueChange,
|
|
7591
|
-
o = e.defaultValue,
|
|
7592
|
-
s = e.value;
|
|
7593
|
-
f.maskOptions = parseMask(t, n, a), null == o && (o = ""), null == s && (s = o);
|
|
7594
|
-
var l = getStringValue(s);
|
|
7595
|
-
if (f.maskOptions.mask && (i || l) && (l = formatValue(f.maskOptions, l), isFunction(r))) {
|
|
7596
|
-
var u = e.value;
|
|
7597
|
-
null == e.value && (u = o), l = r({
|
|
7598
|
-
value: l,
|
|
7599
|
-
selection: null
|
|
7600
|
-
}, {
|
|
7601
|
-
value: u = getStringValue(u),
|
|
7602
|
-
selection: null
|
|
7603
|
-
}, null, f.getBeforeMaskedValueChangeConfig()).value;
|
|
7604
|
-
}
|
|
7605
|
-
return f.value = l, f;
|
|
7606
|
-
}
|
|
7607
|
-
_inheritsLoose(e, c);
|
|
7608
|
-
var t = e.prototype;
|
|
7609
|
-
return t.componentDidMount = function () {
|
|
7610
|
-
this.mounted = !0, this.getInputDOMNode() && (this.isWindowsPhoneBrowser = isWindowsPhoneBrowser(), this.maskOptions.mask && this.getInputValue() !== this.value && this.setInputValue(this.value));
|
|
7611
|
-
}, t.componentDidUpdate = function () {
|
|
7612
|
-
var e = this.previousSelection,
|
|
7613
|
-
t = this.props,
|
|
7614
|
-
n = t.beforeMaskedValueChange,
|
|
7615
|
-
a = t.alwaysShowMask,
|
|
7616
|
-
i = t.mask,
|
|
7617
|
-
r = t.maskChar,
|
|
7618
|
-
o = t.formatChars,
|
|
7619
|
-
s = this.maskOptions,
|
|
7620
|
-
l = a || this.isFocused(),
|
|
7621
|
-
u = null != this.props.value,
|
|
7622
|
-
c = u ? getStringValue(this.props.value) : this.value,
|
|
7623
|
-
h = e ? e.start : null;
|
|
7624
|
-
if (this.maskOptions = parseMask(i, r, o), this.maskOptions.mask) {
|
|
7625
|
-
!s.mask && this.isFocused() && this.runSaveSelectionLoop();
|
|
7626
|
-
var f = this.maskOptions.mask && this.maskOptions.mask !== s.mask;
|
|
7627
|
-
if (s.mask || u || (c = this.getInputValue()), (f || this.maskOptions.mask && (c || l)) && (c = formatValue(this.maskOptions, c)), f) {
|
|
7628
|
-
var p = getFilledLength(this.maskOptions, c);
|
|
7629
|
-
(null === h || p < h) && (h = isFilled(this.maskOptions, c) ? p : getRightEditablePosition(this.maskOptions, p));
|
|
7814
|
+
if (input.nodeName !== 'INPUT') {
|
|
7815
|
+
input = input.querySelector('input');
|
|
7630
7816
|
}
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
start: h,
|
|
7634
|
-
end: h
|
|
7635
|
-
};
|
|
7636
|
-
if (isFunction(n)) {
|
|
7637
|
-
var m = n({
|
|
7638
|
-
value: c,
|
|
7639
|
-
selection: d
|
|
7640
|
-
}, {
|
|
7641
|
-
value: this.value,
|
|
7642
|
-
selection: this.previousSelection
|
|
7643
|
-
}, null, this.getBeforeMaskedValueChangeConfig());
|
|
7644
|
-
c = m.value, d = m.selection;
|
|
7817
|
+
if (!input) {
|
|
7818
|
+
throw new Error('react-input-mask: inputComponent doesn\'t contain input node');
|
|
7645
7819
|
}
|
|
7646
|
-
|
|
7647
|
-
var g = this.getInputValue() !== this.value;
|
|
7648
|
-
g ? (this.setInputValue(this.value), this.forceUpdate()) : f && this.forceUpdate();
|
|
7649
|
-
var v = !1;
|
|
7650
|
-
null != d.start && null != d.end && (v = !e || e.start !== d.start || e.end !== d.end), (v || g) && this.setSelection(d.start, d.end);
|
|
7651
|
-
} else s.mask && (this.stopSaveSelectionLoop(), this.forceUpdate());
|
|
7652
|
-
}, t.componentWillUnmount = function () {
|
|
7653
|
-
this.mounted = !1, null !== this.selectionDeferId && cancelDefer(this.selectionDeferId), this.stopSaveSelectionLoop();
|
|
7654
|
-
}, t.render = function () {
|
|
7655
|
-
var t,
|
|
7656
|
-
e = this.props,
|
|
7657
|
-
n = (e.mask, e.alwaysShowMask, e.maskChar, e.formatChars, e.inputRef, e.beforeMaskedValueChange, e.children),
|
|
7658
|
-
a = _objectWithoutPropertiesLoose(e, ["mask", "alwaysShowMask", "maskChar", "formatChars", "inputRef", "beforeMaskedValueChange", "children"]);
|
|
7659
|
-
if (n) {
|
|
7660
|
-
isFunction(n) || invariant_1(!1);
|
|
7661
|
-
var i = ["onChange", "onPaste", "onMouseDown", "onFocus", "onBlur", "value", "disabled", "readOnly"],
|
|
7662
|
-
r = _extends({}, a);
|
|
7663
|
-
i.forEach(function (e) {
|
|
7664
|
-
return delete r[e];
|
|
7665
|
-
}), t = n(r), i.filter(function (e) {
|
|
7666
|
-
return null != t.props[e] && t.props[e] !== a[e];
|
|
7667
|
-
}).length && invariant_1(!1);
|
|
7668
|
-
} else t = React.createElement("input", _extends({
|
|
7669
|
-
ref: this.handleRef
|
|
7670
|
-
}, a));
|
|
7671
|
-
var o = {
|
|
7672
|
-
onFocus: this.onFocus,
|
|
7673
|
-
onBlur: this.onBlur
|
|
7820
|
+
return input;
|
|
7674
7821
|
};
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
|
|
7686
|
-
|
|
7687
|
-
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
function
|
|
7691
|
-
|
|
7692
|
-
|
|
7822
|
+
_this.getInputValue = function () {
|
|
7823
|
+
var input = _this.getInputDOMNode();
|
|
7824
|
+
if (!input) {
|
|
7825
|
+
return null;
|
|
7826
|
+
}
|
|
7827
|
+
return input.value;
|
|
7828
|
+
};
|
|
7829
|
+
_this.setInputValue = function (value) {
|
|
7830
|
+
var input = _this.getInputDOMNode();
|
|
7831
|
+
if (!input) {
|
|
7832
|
+
return;
|
|
7833
|
+
}
|
|
7834
|
+
_this.value = value;
|
|
7835
|
+
input.value = value;
|
|
7836
|
+
};
|
|
7837
|
+
_this.setCursorToEnd = function () {
|
|
7838
|
+
var filledLength = getFilledLength(_this.maskOptions, _this.value);
|
|
7839
|
+
var pos = getRightEditablePosition(_this.maskOptions, filledLength);
|
|
7840
|
+
if (pos !== null) {
|
|
7841
|
+
_this.setCursorPosition(pos);
|
|
7842
|
+
}
|
|
7843
|
+
};
|
|
7844
|
+
_this.setSelection = function (start, end, options) {
|
|
7845
|
+
if (options === void 0) {
|
|
7846
|
+
options = {};
|
|
7847
|
+
}
|
|
7848
|
+
var input = _this.getInputDOMNode();
|
|
7849
|
+
var isFocused = _this.isFocused(); // don't change selection on unfocused input
|
|
7850
|
+
// because Safari sets focus on selection change (#154)
|
|
7693
7851
|
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7852
|
+
if (!input || !isFocused) {
|
|
7853
|
+
return;
|
|
7854
|
+
}
|
|
7855
|
+
var _options = options,
|
|
7856
|
+
deferred = _options.deferred;
|
|
7857
|
+
if (!deferred) {
|
|
7858
|
+
setInputSelection(input, start, end);
|
|
7859
|
+
}
|
|
7860
|
+
if (_this.selectionDeferId !== null) {
|
|
7861
|
+
cancelDefer(_this.selectionDeferId);
|
|
7862
|
+
} // deferred selection update is required for pre-Lollipop Android browser,
|
|
7863
|
+
// but for consistent behavior we do it for all browsers
|
|
7704
7864
|
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7865
|
+
_this.selectionDeferId = defer(function () {
|
|
7866
|
+
_this.selectionDeferId = null;
|
|
7867
|
+
setInputSelection(input, start, end);
|
|
7868
|
+
});
|
|
7869
|
+
_this.previousSelection = {
|
|
7870
|
+
start: start,
|
|
7871
|
+
end: end,
|
|
7872
|
+
length: Math.abs(end - start)
|
|
7873
|
+
};
|
|
7874
|
+
};
|
|
7875
|
+
_this.getSelection = function () {
|
|
7876
|
+
var input = _this.getInputDOMNode();
|
|
7877
|
+
return getInputSelection(input);
|
|
7878
|
+
};
|
|
7879
|
+
_this.getCursorPosition = function () {
|
|
7880
|
+
return _this.getSelection().start;
|
|
7881
|
+
};
|
|
7882
|
+
_this.setCursorPosition = function (pos) {
|
|
7883
|
+
_this.setSelection(pos, pos);
|
|
7884
|
+
};
|
|
7885
|
+
_this.isFocused = function () {
|
|
7886
|
+
return _this.focused;
|
|
7887
|
+
};
|
|
7888
|
+
_this.getBeforeMaskedValueChangeConfig = function () {
|
|
7889
|
+
var _this$maskOptions = _this.maskOptions,
|
|
7890
|
+
mask = _this$maskOptions.mask,
|
|
7891
|
+
maskChar = _this$maskOptions.maskChar,
|
|
7892
|
+
permanents = _this$maskOptions.permanents,
|
|
7893
|
+
formatChars = _this$maskOptions.formatChars;
|
|
7894
|
+
var alwaysShowMask = _this.props.alwaysShowMask;
|
|
7895
|
+
return {
|
|
7896
|
+
mask: mask,
|
|
7897
|
+
maskChar: maskChar,
|
|
7898
|
+
permanents: permanents,
|
|
7899
|
+
alwaysShowMask: !!alwaysShowMask,
|
|
7900
|
+
formatChars: formatChars
|
|
7901
|
+
};
|
|
7902
|
+
};
|
|
7903
|
+
_this.isInputAutofilled = function (value, selection, previousValue, previousSelection) {
|
|
7904
|
+
var input = _this.getInputDOMNode(); // only check for positive match because it will be false negative
|
|
7905
|
+
// in case of autofill simulation in tests
|
|
7906
|
+
//
|
|
7907
|
+
// input.matches throws an exception if selector isn't supported
|
|
7731
7908
|
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
var warning_1;
|
|
7739
|
-
var hasRequiredWarning;
|
|
7740
|
-
function requireWarning() {
|
|
7741
|
-
if (hasRequiredWarning) return warning_1;
|
|
7742
|
-
hasRequiredWarning = 1;
|
|
7909
|
+
try {
|
|
7910
|
+
if (input.matches(':-webkit-autofill')) {
|
|
7911
|
+
return true;
|
|
7912
|
+
}
|
|
7913
|
+
} catch (e) {} // if input isn't focused then change event must have been triggered
|
|
7914
|
+
// either by autofill or event simulation in tests
|
|
7743
7915
|
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
* same logic and follow the same code paths.
|
|
7749
|
-
*/
|
|
7916
|
+
if (!_this.focused) {
|
|
7917
|
+
return true;
|
|
7918
|
+
} // if cursor has moved to the end while previousSelection forbids it
|
|
7919
|
+
// then it must be autofill
|
|
7750
7920
|
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
});
|
|
7764
|
-
if (typeof console !== 'undefined') {
|
|
7765
|
-
console.error(message);
|
|
7766
|
-
}
|
|
7767
|
-
try {
|
|
7768
|
-
// --- Welcome to debugging React ---
|
|
7769
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
7770
|
-
// to find the callsite that caused this warning to fire.
|
|
7771
|
-
throw new Error(message);
|
|
7772
|
-
} catch (x) {}
|
|
7773
|
-
};
|
|
7774
|
-
warning = function warning(condition, format, args) {
|
|
7775
|
-
var len = arguments.length;
|
|
7776
|
-
args = new Array(len > 2 ? len - 2 : 0);
|
|
7777
|
-
for (var key = 2; key < len; key++) {
|
|
7778
|
-
args[key - 2] = arguments[key];
|
|
7779
|
-
}
|
|
7780
|
-
if (format === undefined) {
|
|
7781
|
-
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
7782
|
-
}
|
|
7783
|
-
if (!condition) {
|
|
7784
|
-
printWarning.apply(null, [format].concat(args));
|
|
7785
|
-
}
|
|
7786
|
-
};
|
|
7787
|
-
}
|
|
7788
|
-
warning_1 = warning;
|
|
7789
|
-
return warning_1;
|
|
7790
|
-
}
|
|
7791
|
-
|
|
7792
|
-
var reactInputMask_development;
|
|
7793
|
-
var hasRequiredReactInputMask_development;
|
|
7794
|
-
function requireReactInputMask_development() {
|
|
7795
|
-
if (hasRequiredReactInputMask_development) return reactInputMask_development;
|
|
7796
|
-
hasRequiredReactInputMask_development = 1;
|
|
7797
|
-
function _interopDefault(ex) {
|
|
7798
|
-
return ex && _typeof$1(ex) === 'object' && 'default' in ex ? ex['default'] : ex;
|
|
7799
|
-
}
|
|
7800
|
-
var React = _interopDefault(React__default);
|
|
7801
|
-
var reactDom = require$$1;
|
|
7802
|
-
var invariant = _interopDefault(requireInvariant());
|
|
7803
|
-
var warning = _interopDefault(requireWarning());
|
|
7804
|
-
function _defaults2(obj, defaults) {
|
|
7805
|
-
var keys = Object.getOwnPropertyNames(defaults);
|
|
7806
|
-
for (var i = 0; i < keys.length; i++) {
|
|
7807
|
-
var key = keys[i];
|
|
7808
|
-
var value = Object.getOwnPropertyDescriptor(defaults, key);
|
|
7809
|
-
if (value && value.configurable && obj[key] === undefined) {
|
|
7810
|
-
Object.defineProperty(obj, key, value);
|
|
7811
|
-
}
|
|
7812
|
-
}
|
|
7813
|
-
return obj;
|
|
7814
|
-
}
|
|
7815
|
-
function _extends() {
|
|
7816
|
-
_extends = Object.assign || function (target) {
|
|
7817
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
7818
|
-
var source = arguments[i];
|
|
7819
|
-
for (var key in source) {
|
|
7820
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
7821
|
-
target[key] = source[key];
|
|
7822
|
-
}
|
|
7823
|
-
}
|
|
7824
|
-
}
|
|
7825
|
-
return target;
|
|
7826
|
-
};
|
|
7827
|
-
return _extends.apply(this, arguments);
|
|
7828
|
-
}
|
|
7829
|
-
function _inheritsLoose(subClass, superClass) {
|
|
7830
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
7831
|
-
subClass.prototype.constructor = subClass;
|
|
7832
|
-
_defaults2(subClass, superClass);
|
|
7833
|
-
}
|
|
7834
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
7835
|
-
if (source == null) return {};
|
|
7836
|
-
var target = {};
|
|
7837
|
-
var sourceKeys = Object.keys(source);
|
|
7838
|
-
var key, i;
|
|
7839
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
7840
|
-
key = sourceKeys[i];
|
|
7841
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
7842
|
-
target[key] = source[key];
|
|
7843
|
-
}
|
|
7844
|
-
return target;
|
|
7845
|
-
}
|
|
7846
|
-
function _assertThisInitialized(self) {
|
|
7847
|
-
if (self === void 0) {
|
|
7848
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
7849
|
-
}
|
|
7850
|
-
return self;
|
|
7851
|
-
}
|
|
7852
|
-
function setInputSelection(input, start, end) {
|
|
7853
|
-
if ('selectionStart' in input && 'selectionEnd' in input) {
|
|
7854
|
-
input.selectionStart = start;
|
|
7855
|
-
input.selectionEnd = end;
|
|
7856
|
-
} else {
|
|
7857
|
-
var range = input.createTextRange();
|
|
7858
|
-
range.collapse(true);
|
|
7859
|
-
range.moveStart('character', start);
|
|
7860
|
-
range.moveEnd('character', end - start);
|
|
7861
|
-
range.select();
|
|
7862
|
-
}
|
|
7863
|
-
}
|
|
7864
|
-
function getInputSelection(input) {
|
|
7865
|
-
var start = 0;
|
|
7866
|
-
var end = 0;
|
|
7867
|
-
if ('selectionStart' in input && 'selectionEnd' in input) {
|
|
7868
|
-
start = input.selectionStart;
|
|
7869
|
-
end = input.selectionEnd;
|
|
7870
|
-
} else {
|
|
7871
|
-
var range = document.selection.createRange();
|
|
7872
|
-
if (range.parentElement() === input) {
|
|
7873
|
-
start = -range.moveStart('character', -input.value.length);
|
|
7874
|
-
end = -range.moveEnd('character', -input.value.length);
|
|
7875
|
-
}
|
|
7876
|
-
}
|
|
7877
|
-
return {
|
|
7878
|
-
start: start,
|
|
7879
|
-
end: end,
|
|
7880
|
-
length: end - start
|
|
7881
|
-
};
|
|
7882
|
-
}
|
|
7883
|
-
var defaultFormatChars = {
|
|
7884
|
-
'9': '[0-9]',
|
|
7885
|
-
'a': '[A-Za-z]',
|
|
7886
|
-
'*': '[A-Za-z0-9]'
|
|
7887
|
-
};
|
|
7888
|
-
var defaultMaskChar = '_';
|
|
7889
|
-
function parseMask(mask, maskChar, formatChars) {
|
|
7890
|
-
var parsedMaskString = '';
|
|
7891
|
-
var prefix = '';
|
|
7892
|
-
var lastEditablePosition = null;
|
|
7893
|
-
var permanents = [];
|
|
7894
|
-
if (maskChar === undefined) {
|
|
7895
|
-
maskChar = defaultMaskChar;
|
|
7896
|
-
}
|
|
7897
|
-
if (formatChars == null) {
|
|
7898
|
-
formatChars = defaultFormatChars;
|
|
7899
|
-
}
|
|
7900
|
-
if (!mask || typeof mask !== 'string') {
|
|
7901
|
-
return {
|
|
7902
|
-
maskChar: maskChar,
|
|
7903
|
-
formatChars: formatChars,
|
|
7904
|
-
mask: null,
|
|
7905
|
-
prefix: null,
|
|
7906
|
-
lastEditablePosition: null,
|
|
7907
|
-
permanents: []
|
|
7908
|
-
};
|
|
7909
|
-
}
|
|
7910
|
-
var isPermanent = false;
|
|
7911
|
-
mask.split('').forEach(function (character) {
|
|
7912
|
-
if (!isPermanent && character === '\\') {
|
|
7913
|
-
isPermanent = true;
|
|
7914
|
-
} else {
|
|
7915
|
-
if (isPermanent || !formatChars[character]) {
|
|
7916
|
-
permanents.push(parsedMaskString.length);
|
|
7917
|
-
if (parsedMaskString.length === permanents.length - 1) {
|
|
7918
|
-
prefix += character;
|
|
7919
|
-
}
|
|
7920
|
-
} else {
|
|
7921
|
-
lastEditablePosition = parsedMaskString.length + 1;
|
|
7922
|
-
}
|
|
7923
|
-
parsedMaskString += character;
|
|
7924
|
-
isPermanent = false;
|
|
7925
|
-
}
|
|
7926
|
-
});
|
|
7927
|
-
return {
|
|
7928
|
-
maskChar: maskChar,
|
|
7929
|
-
formatChars: formatChars,
|
|
7930
|
-
prefix: prefix,
|
|
7931
|
-
mask: parsedMaskString,
|
|
7932
|
-
lastEditablePosition: lastEditablePosition,
|
|
7933
|
-
permanents: permanents
|
|
7934
|
-
};
|
|
7935
|
-
}
|
|
7936
|
-
|
|
7937
|
-
/* eslint no-use-before-define: ["error", { functions: false }] */
|
|
7938
|
-
function isPermanentCharacter(maskOptions, pos) {
|
|
7939
|
-
return maskOptions.permanents.indexOf(pos) !== -1;
|
|
7940
|
-
}
|
|
7941
|
-
function isAllowedCharacter(maskOptions, pos, character) {
|
|
7942
|
-
var mask = maskOptions.mask,
|
|
7943
|
-
formatChars = maskOptions.formatChars;
|
|
7944
|
-
if (!character) {
|
|
7945
|
-
return false;
|
|
7946
|
-
}
|
|
7947
|
-
if (isPermanentCharacter(maskOptions, pos)) {
|
|
7948
|
-
return mask[pos] === character;
|
|
7949
|
-
}
|
|
7950
|
-
var ruleChar = mask[pos];
|
|
7951
|
-
var charRule = formatChars[ruleChar];
|
|
7952
|
-
return new RegExp(charRule).test(character);
|
|
7953
|
-
}
|
|
7954
|
-
function isEmpty(maskOptions, value) {
|
|
7955
|
-
return value.split('').every(function (character, i) {
|
|
7956
|
-
return isPermanentCharacter(maskOptions, i) || !isAllowedCharacter(maskOptions, i, character);
|
|
7957
|
-
});
|
|
7958
|
-
}
|
|
7959
|
-
function getFilledLength(maskOptions, value) {
|
|
7960
|
-
var maskChar = maskOptions.maskChar,
|
|
7961
|
-
prefix = maskOptions.prefix;
|
|
7962
|
-
if (!maskChar) {
|
|
7963
|
-
while (value.length > prefix.length && isPermanentCharacter(maskOptions, value.length - 1)) {
|
|
7964
|
-
value = value.slice(0, value.length - 1);
|
|
7965
|
-
}
|
|
7966
|
-
return value.length;
|
|
7967
|
-
}
|
|
7968
|
-
var filledLength = prefix.length;
|
|
7969
|
-
for (var i = value.length; i >= prefix.length; i--) {
|
|
7970
|
-
var character = value[i];
|
|
7971
|
-
var isEnteredCharacter = !isPermanentCharacter(maskOptions, i) && isAllowedCharacter(maskOptions, i, character);
|
|
7972
|
-
if (isEnteredCharacter) {
|
|
7973
|
-
filledLength = i + 1;
|
|
7974
|
-
break;
|
|
7975
|
-
}
|
|
7976
|
-
}
|
|
7977
|
-
return filledLength;
|
|
7978
|
-
}
|
|
7979
|
-
function isFilled(maskOptions, value) {
|
|
7980
|
-
return getFilledLength(maskOptions, value) === maskOptions.mask.length;
|
|
7981
|
-
}
|
|
7982
|
-
function formatValue(maskOptions, value) {
|
|
7983
|
-
var maskChar = maskOptions.maskChar,
|
|
7984
|
-
mask = maskOptions.mask,
|
|
7985
|
-
prefix = maskOptions.prefix;
|
|
7986
|
-
if (!maskChar) {
|
|
7987
|
-
value = insertString(maskOptions, '', value, 0);
|
|
7988
|
-
if (value.length < prefix.length) {
|
|
7989
|
-
value = prefix;
|
|
7990
|
-
}
|
|
7991
|
-
while (value.length < mask.length && isPermanentCharacter(maskOptions, value.length)) {
|
|
7992
|
-
value += mask[value.length];
|
|
7993
|
-
}
|
|
7994
|
-
return value;
|
|
7995
|
-
}
|
|
7996
|
-
if (value) {
|
|
7997
|
-
var emptyValue = formatValue(maskOptions, '');
|
|
7998
|
-
return insertString(maskOptions, emptyValue, value, 0);
|
|
7999
|
-
}
|
|
8000
|
-
for (var i = 0; i < mask.length; i++) {
|
|
8001
|
-
if (isPermanentCharacter(maskOptions, i)) {
|
|
8002
|
-
value += mask[i];
|
|
8003
|
-
} else {
|
|
8004
|
-
value += maskChar;
|
|
8005
|
-
}
|
|
8006
|
-
}
|
|
8007
|
-
return value;
|
|
8008
|
-
}
|
|
8009
|
-
function clearRange(maskOptions, value, start, len) {
|
|
8010
|
-
var end = start + len;
|
|
8011
|
-
var maskChar = maskOptions.maskChar,
|
|
8012
|
-
mask = maskOptions.mask,
|
|
8013
|
-
prefix = maskOptions.prefix;
|
|
8014
|
-
var arrayValue = value.split('');
|
|
8015
|
-
if (!maskChar) {
|
|
8016
|
-
// remove any permanent chars after clear range, they will be added back by formatValue
|
|
8017
|
-
for (var i = end; i < arrayValue.length; i++) {
|
|
8018
|
-
if (isPermanentCharacter(maskOptions, i)) {
|
|
8019
|
-
arrayValue[i] = '';
|
|
8020
|
-
}
|
|
8021
|
-
}
|
|
8022
|
-
start = Math.max(prefix.length, start);
|
|
8023
|
-
arrayValue.splice(start, end - start);
|
|
8024
|
-
value = arrayValue.join('');
|
|
8025
|
-
return formatValue(maskOptions, value);
|
|
8026
|
-
}
|
|
8027
|
-
return arrayValue.map(function (character, i) {
|
|
8028
|
-
if (i < start || i >= end) {
|
|
8029
|
-
return character;
|
|
8030
|
-
}
|
|
8031
|
-
if (isPermanentCharacter(maskOptions, i)) {
|
|
8032
|
-
return mask[i];
|
|
8033
|
-
}
|
|
8034
|
-
return maskChar;
|
|
8035
|
-
}).join('');
|
|
8036
|
-
}
|
|
8037
|
-
function insertString(maskOptions, value, insertStr, insertPosition) {
|
|
8038
|
-
var mask = maskOptions.mask,
|
|
8039
|
-
maskChar = maskOptions.maskChar,
|
|
8040
|
-
prefix = maskOptions.prefix;
|
|
8041
|
-
var arrayInsertStr = insertStr.split('');
|
|
8042
|
-
var isInputFilled = isFilled(maskOptions, value);
|
|
8043
|
-
var isUsablePosition = function isUsablePosition(pos, character) {
|
|
8044
|
-
return !isPermanentCharacter(maskOptions, pos) || character === mask[pos];
|
|
8045
|
-
};
|
|
8046
|
-
var isUsableCharacter = function isUsableCharacter(character, pos) {
|
|
8047
|
-
return !maskChar || !isPermanentCharacter(maskOptions, pos) || character !== maskChar;
|
|
8048
|
-
};
|
|
8049
|
-
if (!maskChar && insertPosition > value.length) {
|
|
8050
|
-
value += mask.slice(value.length, insertPosition);
|
|
8051
|
-
}
|
|
8052
|
-
arrayInsertStr.every(function (insertCharacter) {
|
|
8053
|
-
while (!isUsablePosition(insertPosition, insertCharacter)) {
|
|
8054
|
-
if (insertPosition >= value.length) {
|
|
8055
|
-
value += mask[insertPosition];
|
|
8056
|
-
}
|
|
8057
|
-
if (!isUsableCharacter(insertCharacter, insertPosition)) {
|
|
8058
|
-
return true;
|
|
8059
|
-
}
|
|
8060
|
-
insertPosition++; // stop iteration if maximum value length reached
|
|
8061
|
-
|
|
8062
|
-
if (insertPosition >= mask.length) {
|
|
8063
|
-
return false;
|
|
8064
|
-
}
|
|
8065
|
-
}
|
|
8066
|
-
var isAllowed = isAllowedCharacter(maskOptions, insertPosition, insertCharacter) || insertCharacter === maskChar;
|
|
8067
|
-
if (!isAllowed) {
|
|
8068
|
-
return true;
|
|
8069
|
-
}
|
|
8070
|
-
if (insertPosition < value.length) {
|
|
8071
|
-
if (maskChar || isInputFilled || insertPosition < prefix.length) {
|
|
8072
|
-
value = value.slice(0, insertPosition) + insertCharacter + value.slice(insertPosition + 1);
|
|
8073
|
-
} else {
|
|
8074
|
-
value = value.slice(0, insertPosition) + insertCharacter + value.slice(insertPosition);
|
|
8075
|
-
value = formatValue(maskOptions, value);
|
|
8076
|
-
}
|
|
8077
|
-
} else if (!maskChar) {
|
|
8078
|
-
value += insertCharacter;
|
|
8079
|
-
}
|
|
8080
|
-
insertPosition++; // stop iteration if maximum value length reached
|
|
8081
|
-
|
|
8082
|
-
return insertPosition < mask.length;
|
|
8083
|
-
});
|
|
8084
|
-
return value;
|
|
8085
|
-
}
|
|
8086
|
-
function getInsertStringLength(maskOptions, value, insertStr, insertPosition) {
|
|
8087
|
-
var mask = maskOptions.mask,
|
|
8088
|
-
maskChar = maskOptions.maskChar;
|
|
8089
|
-
var arrayInsertStr = insertStr.split('');
|
|
8090
|
-
var initialInsertPosition = insertPosition;
|
|
8091
|
-
var isUsablePosition = function isUsablePosition(pos, character) {
|
|
8092
|
-
return !isPermanentCharacter(maskOptions, pos) || character === mask[pos];
|
|
8093
|
-
};
|
|
8094
|
-
arrayInsertStr.every(function (insertCharacter) {
|
|
8095
|
-
while (!isUsablePosition(insertPosition, insertCharacter)) {
|
|
8096
|
-
insertPosition++; // stop iteration if maximum value length reached
|
|
8097
|
-
|
|
8098
|
-
if (insertPosition >= mask.length) {
|
|
8099
|
-
return false;
|
|
8100
|
-
}
|
|
8101
|
-
}
|
|
8102
|
-
var isAllowed = isAllowedCharacter(maskOptions, insertPosition, insertCharacter) || insertCharacter === maskChar;
|
|
8103
|
-
if (isAllowed) {
|
|
8104
|
-
insertPosition++;
|
|
8105
|
-
} // stop iteration if maximum value length reached
|
|
8106
|
-
|
|
8107
|
-
return insertPosition < mask.length;
|
|
8108
|
-
});
|
|
8109
|
-
return insertPosition - initialInsertPosition;
|
|
8110
|
-
}
|
|
8111
|
-
function getLeftEditablePosition(maskOptions, pos) {
|
|
8112
|
-
for (var i = pos; i >= 0; --i) {
|
|
8113
|
-
if (!isPermanentCharacter(maskOptions, i)) {
|
|
8114
|
-
return i;
|
|
8115
|
-
}
|
|
8116
|
-
}
|
|
8117
|
-
return null;
|
|
8118
|
-
}
|
|
8119
|
-
function getRightEditablePosition(maskOptions, pos) {
|
|
8120
|
-
var mask = maskOptions.mask;
|
|
8121
|
-
for (var i = pos; i < mask.length; ++i) {
|
|
8122
|
-
if (!isPermanentCharacter(maskOptions, i)) {
|
|
8123
|
-
return i;
|
|
8124
|
-
}
|
|
8125
|
-
}
|
|
8126
|
-
return null;
|
|
8127
|
-
}
|
|
8128
|
-
function getStringValue(value) {
|
|
8129
|
-
return !value && value !== 0 ? '' : value + '';
|
|
8130
|
-
}
|
|
8131
|
-
function processChange(maskOptions, value, selection, previousValue, previousSelection) {
|
|
8132
|
-
var mask = maskOptions.mask,
|
|
8133
|
-
prefix = maskOptions.prefix,
|
|
8134
|
-
lastEditablePosition = maskOptions.lastEditablePosition;
|
|
8135
|
-
var newValue = value;
|
|
8136
|
-
var enteredString = '';
|
|
8137
|
-
var formattedEnteredStringLength = 0;
|
|
8138
|
-
var removedLength = 0;
|
|
8139
|
-
var cursorPosition = Math.min(previousSelection.start, selection.start);
|
|
8140
|
-
if (selection.end > previousSelection.start) {
|
|
8141
|
-
enteredString = newValue.slice(previousSelection.start, selection.end);
|
|
8142
|
-
formattedEnteredStringLength = getInsertStringLength(maskOptions, previousValue, enteredString, cursorPosition);
|
|
8143
|
-
if (!formattedEnteredStringLength) {
|
|
8144
|
-
removedLength = 0;
|
|
8145
|
-
} else {
|
|
8146
|
-
removedLength = previousSelection.length;
|
|
8147
|
-
}
|
|
8148
|
-
} else if (newValue.length < previousValue.length) {
|
|
8149
|
-
removedLength = previousValue.length - newValue.length;
|
|
8150
|
-
}
|
|
8151
|
-
newValue = previousValue;
|
|
8152
|
-
if (removedLength) {
|
|
8153
|
-
if (removedLength === 1 && !previousSelection.length) {
|
|
8154
|
-
var deleteFromRight = previousSelection.start === selection.start;
|
|
8155
|
-
cursorPosition = deleteFromRight ? getRightEditablePosition(maskOptions, selection.start) : getLeftEditablePosition(maskOptions, selection.start);
|
|
8156
|
-
}
|
|
8157
|
-
newValue = clearRange(maskOptions, newValue, cursorPosition, removedLength);
|
|
8158
|
-
}
|
|
8159
|
-
newValue = insertString(maskOptions, newValue, enteredString, cursorPosition);
|
|
8160
|
-
cursorPosition = cursorPosition + formattedEnteredStringLength;
|
|
8161
|
-
if (cursorPosition >= mask.length) {
|
|
8162
|
-
cursorPosition = mask.length;
|
|
8163
|
-
} else if (cursorPosition < prefix.length && !formattedEnteredStringLength) {
|
|
8164
|
-
cursorPosition = prefix.length;
|
|
8165
|
-
} else if (cursorPosition >= prefix.length && cursorPosition < lastEditablePosition && formattedEnteredStringLength) {
|
|
8166
|
-
cursorPosition = getRightEditablePosition(maskOptions, cursorPosition);
|
|
8167
|
-
}
|
|
8168
|
-
newValue = formatValue(maskOptions, newValue);
|
|
8169
|
-
if (!enteredString) {
|
|
8170
|
-
enteredString = null;
|
|
8171
|
-
}
|
|
8172
|
-
return {
|
|
8173
|
-
value: newValue,
|
|
8174
|
-
enteredString: enteredString,
|
|
8175
|
-
selection: {
|
|
8176
|
-
start: cursorPosition,
|
|
8177
|
-
end: cursorPosition
|
|
8178
|
-
}
|
|
8179
|
-
};
|
|
8180
|
-
}
|
|
8181
|
-
function isWindowsPhoneBrowser() {
|
|
8182
|
-
var windows = new RegExp('windows', 'i');
|
|
8183
|
-
var phone = new RegExp('phone', 'i');
|
|
8184
|
-
var ua = navigator.userAgent;
|
|
8185
|
-
return windows.test(ua) && phone.test(ua);
|
|
8186
|
-
}
|
|
8187
|
-
function isFunction(value) {
|
|
8188
|
-
return typeof value === 'function';
|
|
8189
|
-
}
|
|
8190
|
-
function getRequestAnimationFrame() {
|
|
8191
|
-
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
|
|
8192
|
-
}
|
|
8193
|
-
function getCancelAnimationFrame() {
|
|
8194
|
-
return window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame;
|
|
8195
|
-
}
|
|
8196
|
-
function defer(fn) {
|
|
8197
|
-
var hasCancelAnimationFrame = !!getCancelAnimationFrame();
|
|
8198
|
-
var deferFn;
|
|
8199
|
-
if (hasCancelAnimationFrame) {
|
|
8200
|
-
deferFn = getRequestAnimationFrame();
|
|
8201
|
-
} else {
|
|
8202
|
-
deferFn = function deferFn() {
|
|
8203
|
-
return setTimeout(fn, 1000 / 60);
|
|
8204
|
-
};
|
|
8205
|
-
}
|
|
8206
|
-
return deferFn(fn);
|
|
8207
|
-
}
|
|
8208
|
-
function cancelDefer(deferId) {
|
|
8209
|
-
var cancelFn = getCancelAnimationFrame() || clearTimeout;
|
|
8210
|
-
cancelFn(deferId);
|
|
8211
|
-
}
|
|
8212
|
-
var InputElement = /*#__PURE__*/
|
|
8213
|
-
function (_React$Component) {
|
|
8214
|
-
_inheritsLoose(InputElement, _React$Component);
|
|
8215
|
-
function InputElement(props) {
|
|
8216
|
-
var _this;
|
|
8217
|
-
_this = _React$Component.call(this, props) || this;
|
|
8218
|
-
_this.focused = false;
|
|
8219
|
-
_this.mounted = false;
|
|
8220
|
-
_this.previousSelection = null;
|
|
8221
|
-
_this.selectionDeferId = null;
|
|
8222
|
-
_this.saveSelectionLoopDeferId = null;
|
|
8223
|
-
_this.saveSelectionLoop = function () {
|
|
8224
|
-
_this.previousSelection = _this.getSelection();
|
|
8225
|
-
_this.saveSelectionLoopDeferId = defer(_this.saveSelectionLoop);
|
|
8226
|
-
};
|
|
8227
|
-
_this.runSaveSelectionLoop = function () {
|
|
8228
|
-
if (_this.saveSelectionLoopDeferId === null) {
|
|
8229
|
-
_this.saveSelectionLoop();
|
|
8230
|
-
}
|
|
8231
|
-
};
|
|
8232
|
-
_this.stopSaveSelectionLoop = function () {
|
|
8233
|
-
if (_this.saveSelectionLoopDeferId !== null) {
|
|
8234
|
-
cancelDefer(_this.saveSelectionLoopDeferId);
|
|
8235
|
-
_this.saveSelectionLoopDeferId = null;
|
|
8236
|
-
_this.previousSelection = null;
|
|
8237
|
-
}
|
|
8238
|
-
};
|
|
8239
|
-
_this.getInputDOMNode = function () {
|
|
8240
|
-
if (!_this.mounted) {
|
|
8241
|
-
return null;
|
|
8242
|
-
}
|
|
8243
|
-
var input = reactDom.findDOMNode(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
8244
|
-
var isDOMNode = typeof window !== 'undefined' && input instanceof window.Element; // workaround for react-test-renderer
|
|
8245
|
-
// https://github.com/sanniassin/react-input-mask/issues/147
|
|
8246
|
-
|
|
8247
|
-
if (input && !isDOMNode) {
|
|
8248
|
-
return null;
|
|
8249
|
-
}
|
|
8250
|
-
if (input.nodeName !== 'INPUT') {
|
|
8251
|
-
input = input.querySelector('input');
|
|
8252
|
-
}
|
|
8253
|
-
if (!input) {
|
|
8254
|
-
throw new Error('react-input-mask: inputComponent doesn\'t contain input node');
|
|
8255
|
-
}
|
|
8256
|
-
return input;
|
|
8257
|
-
};
|
|
8258
|
-
_this.getInputValue = function () {
|
|
8259
|
-
var input = _this.getInputDOMNode();
|
|
8260
|
-
if (!input) {
|
|
8261
|
-
return null;
|
|
8262
|
-
}
|
|
8263
|
-
return input.value;
|
|
8264
|
-
};
|
|
8265
|
-
_this.setInputValue = function (value) {
|
|
8266
|
-
var input = _this.getInputDOMNode();
|
|
8267
|
-
if (!input) {
|
|
8268
|
-
return;
|
|
8269
|
-
}
|
|
8270
|
-
_this.value = value;
|
|
8271
|
-
input.value = value;
|
|
8272
|
-
};
|
|
8273
|
-
_this.setCursorToEnd = function () {
|
|
8274
|
-
var filledLength = getFilledLength(_this.maskOptions, _this.value);
|
|
8275
|
-
var pos = getRightEditablePosition(_this.maskOptions, filledLength);
|
|
8276
|
-
if (pos !== null) {
|
|
8277
|
-
_this.setCursorPosition(pos);
|
|
8278
|
-
}
|
|
8279
|
-
};
|
|
8280
|
-
_this.setSelection = function (start, end, options) {
|
|
8281
|
-
if (options === void 0) {
|
|
8282
|
-
options = {};
|
|
8283
|
-
}
|
|
8284
|
-
var input = _this.getInputDOMNode();
|
|
8285
|
-
var isFocused = _this.isFocused(); // don't change selection on unfocused input
|
|
8286
|
-
// because Safari sets focus on selection change (#154)
|
|
8287
|
-
|
|
8288
|
-
if (!input || !isFocused) {
|
|
8289
|
-
return;
|
|
8290
|
-
}
|
|
8291
|
-
var _options = options,
|
|
8292
|
-
deferred = _options.deferred;
|
|
8293
|
-
if (!deferred) {
|
|
8294
|
-
setInputSelection(input, start, end);
|
|
8295
|
-
}
|
|
8296
|
-
if (_this.selectionDeferId !== null) {
|
|
8297
|
-
cancelDefer(_this.selectionDeferId);
|
|
8298
|
-
} // deferred selection update is required for pre-Lollipop Android browser,
|
|
8299
|
-
// but for consistent behavior we do it for all browsers
|
|
8300
|
-
|
|
8301
|
-
_this.selectionDeferId = defer(function () {
|
|
8302
|
-
_this.selectionDeferId = null;
|
|
8303
|
-
setInputSelection(input, start, end);
|
|
8304
|
-
});
|
|
8305
|
-
_this.previousSelection = {
|
|
8306
|
-
start: start,
|
|
8307
|
-
end: end,
|
|
8308
|
-
length: Math.abs(end - start)
|
|
8309
|
-
};
|
|
8310
|
-
};
|
|
8311
|
-
_this.getSelection = function () {
|
|
8312
|
-
var input = _this.getInputDOMNode();
|
|
8313
|
-
return getInputSelection(input);
|
|
8314
|
-
};
|
|
8315
|
-
_this.getCursorPosition = function () {
|
|
8316
|
-
return _this.getSelection().start;
|
|
8317
|
-
};
|
|
8318
|
-
_this.setCursorPosition = function (pos) {
|
|
8319
|
-
_this.setSelection(pos, pos);
|
|
8320
|
-
};
|
|
8321
|
-
_this.isFocused = function () {
|
|
8322
|
-
return _this.focused;
|
|
8323
|
-
};
|
|
8324
|
-
_this.getBeforeMaskedValueChangeConfig = function () {
|
|
8325
|
-
var _this$maskOptions = _this.maskOptions,
|
|
8326
|
-
mask = _this$maskOptions.mask,
|
|
8327
|
-
maskChar = _this$maskOptions.maskChar,
|
|
8328
|
-
permanents = _this$maskOptions.permanents,
|
|
8329
|
-
formatChars = _this$maskOptions.formatChars;
|
|
8330
|
-
var alwaysShowMask = _this.props.alwaysShowMask;
|
|
8331
|
-
return {
|
|
8332
|
-
mask: mask,
|
|
8333
|
-
maskChar: maskChar,
|
|
8334
|
-
permanents: permanents,
|
|
8335
|
-
alwaysShowMask: !!alwaysShowMask,
|
|
8336
|
-
formatChars: formatChars
|
|
8337
|
-
};
|
|
8338
|
-
};
|
|
8339
|
-
_this.isInputAutofilled = function (value, selection, previousValue, previousSelection) {
|
|
8340
|
-
var input = _this.getInputDOMNode(); // only check for positive match because it will be false negative
|
|
8341
|
-
// in case of autofill simulation in tests
|
|
8342
|
-
//
|
|
8343
|
-
// input.matches throws an exception if selector isn't supported
|
|
8344
|
-
|
|
8345
|
-
try {
|
|
8346
|
-
if (input.matches(':-webkit-autofill')) {
|
|
8347
|
-
return true;
|
|
8348
|
-
}
|
|
8349
|
-
} catch (e) {} // if input isn't focused then change event must have been triggered
|
|
8350
|
-
// either by autofill or event simulation in tests
|
|
8351
|
-
|
|
8352
|
-
if (!_this.focused) {
|
|
8353
|
-
return true;
|
|
8354
|
-
} // if cursor has moved to the end while previousSelection forbids it
|
|
8355
|
-
// then it must be autofill
|
|
8356
|
-
|
|
8357
|
-
return previousSelection.end < previousValue.length && selection.end === value.length;
|
|
8358
|
-
};
|
|
8359
|
-
_this.onChange = function (event) {
|
|
8360
|
-
var _assertThisInitialize = _assertThisInitialized(_assertThisInitialized(_this)),
|
|
8361
|
-
beforePasteState = _assertThisInitialize.beforePasteState;
|
|
8362
|
-
var _assertThisInitialize2 = _assertThisInitialized(_assertThisInitialized(_this)),
|
|
8363
|
-
previousSelection = _assertThisInitialize2.previousSelection;
|
|
8364
|
-
var beforeMaskedValueChange = _this.props.beforeMaskedValueChange;
|
|
8365
|
-
var value = _this.getInputValue();
|
|
8366
|
-
var previousValue = _this.value;
|
|
8367
|
-
var selection = _this.getSelection(); // autofill replaces entire value, ignore old one
|
|
8368
|
-
// https://github.com/sanniassin/react-input-mask/issues/113
|
|
7921
|
+
return previousSelection.end < previousValue.length && selection.end === value.length;
|
|
7922
|
+
};
|
|
7923
|
+
_this.onChange = function (event) {
|
|
7924
|
+
var _assertThisInitialize = _assertThisInitialized(_assertThisInitialized(_this)),
|
|
7925
|
+
beforePasteState = _assertThisInitialize.beforePasteState;
|
|
7926
|
+
var _assertThisInitialize2 = _assertThisInitialized(_assertThisInitialized(_this)),
|
|
7927
|
+
previousSelection = _assertThisInitialize2.previousSelection;
|
|
7928
|
+
var beforeMaskedValueChange = _this.props.beforeMaskedValueChange;
|
|
7929
|
+
var value = _this.getInputValue();
|
|
7930
|
+
var previousValue = _this.value;
|
|
7931
|
+
var selection = _this.getSelection(); // autofill replaces entire value, ignore old one
|
|
7932
|
+
// https://github.com/sanniassin/react-input-mask/issues/113
|
|
8369
7933
|
|
|
8370
7934
|
if (_this.isInputAutofilled(value, selection, previousValue, previousSelection)) {
|
|
8371
7935
|
previousValue = formatValue(_this.maskOptions, '');
|
|
@@ -8524,207 +8088,718 @@ function requireReactInputMask_development() {
|
|
|
8524
8088
|
} // event.clipboardData might not work in Android browser
|
|
8525
8089
|
// cleaning input to get raw text inside onChange handler
|
|
8526
8090
|
|
|
8527
|
-
if (!event.defaultPrevented) {
|
|
8528
|
-
_this.beforePasteState = {
|
|
8529
|
-
value: _this.getInputValue(),
|
|
8530
|
-
selection: _this.getSelection()
|
|
8531
|
-
};
|
|
8532
|
-
_this.setInputValue('');
|
|
8533
|
-
}
|
|
8091
|
+
if (!event.defaultPrevented) {
|
|
8092
|
+
_this.beforePasteState = {
|
|
8093
|
+
value: _this.getInputValue(),
|
|
8094
|
+
selection: _this.getSelection()
|
|
8095
|
+
};
|
|
8096
|
+
_this.setInputValue('');
|
|
8097
|
+
}
|
|
8098
|
+
};
|
|
8099
|
+
_this.handleRef = function (ref) {
|
|
8100
|
+
if (_this.props.children == null && isFunction(_this.props.inputRef)) {
|
|
8101
|
+
_this.props.inputRef(ref);
|
|
8102
|
+
}
|
|
8103
|
+
};
|
|
8104
|
+
var _mask = props.mask,
|
|
8105
|
+
_maskChar = props.maskChar,
|
|
8106
|
+
_formatChars = props.formatChars,
|
|
8107
|
+
_alwaysShowMask = props.alwaysShowMask,
|
|
8108
|
+
_beforeMaskedValueChange = props.beforeMaskedValueChange;
|
|
8109
|
+
var defaultValue = props.defaultValue,
|
|
8110
|
+
_value = props.value;
|
|
8111
|
+
_this.maskOptions = parseMask(_mask, _maskChar, _formatChars);
|
|
8112
|
+
if (defaultValue == null) {
|
|
8113
|
+
defaultValue = '';
|
|
8114
|
+
}
|
|
8115
|
+
if (_value == null) {
|
|
8116
|
+
_value = defaultValue;
|
|
8117
|
+
}
|
|
8118
|
+
var _newValue = getStringValue(_value);
|
|
8119
|
+
if (_this.maskOptions.mask && (_alwaysShowMask || _newValue)) {
|
|
8120
|
+
_newValue = formatValue(_this.maskOptions, _newValue);
|
|
8121
|
+
if (isFunction(_beforeMaskedValueChange)) {
|
|
8122
|
+
var oldValue = props.value;
|
|
8123
|
+
if (props.value == null) {
|
|
8124
|
+
oldValue = defaultValue;
|
|
8125
|
+
}
|
|
8126
|
+
oldValue = getStringValue(oldValue);
|
|
8127
|
+
var modifiedValue = _beforeMaskedValueChange({
|
|
8128
|
+
value: _newValue,
|
|
8129
|
+
selection: null
|
|
8130
|
+
}, {
|
|
8131
|
+
value: oldValue,
|
|
8132
|
+
selection: null
|
|
8133
|
+
}, null, _this.getBeforeMaskedValueChangeConfig());
|
|
8134
|
+
_newValue = modifiedValue.value;
|
|
8135
|
+
}
|
|
8136
|
+
}
|
|
8137
|
+
_this.value = _newValue;
|
|
8138
|
+
return _this;
|
|
8139
|
+
}
|
|
8140
|
+
var _proto = InputElement.prototype;
|
|
8141
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
8142
|
+
this.mounted = true; // workaround for react-test-renderer
|
|
8143
|
+
// https://github.com/sanniassin/react-input-mask/issues/147
|
|
8144
|
+
|
|
8145
|
+
if (!this.getInputDOMNode()) {
|
|
8146
|
+
return;
|
|
8147
|
+
}
|
|
8148
|
+
this.isWindowsPhoneBrowser = isWindowsPhoneBrowser();
|
|
8149
|
+
if (this.maskOptions.mask && this.getInputValue() !== this.value) {
|
|
8150
|
+
this.setInputValue(this.value);
|
|
8151
|
+
}
|
|
8152
|
+
};
|
|
8153
|
+
_proto.componentDidUpdate = function componentDidUpdate() {
|
|
8154
|
+
var previousSelection = this.previousSelection;
|
|
8155
|
+
var _this$props = this.props,
|
|
8156
|
+
beforeMaskedValueChange = _this$props.beforeMaskedValueChange,
|
|
8157
|
+
alwaysShowMask = _this$props.alwaysShowMask,
|
|
8158
|
+
mask = _this$props.mask,
|
|
8159
|
+
maskChar = _this$props.maskChar,
|
|
8160
|
+
formatChars = _this$props.formatChars;
|
|
8161
|
+
var previousMaskOptions = this.maskOptions;
|
|
8162
|
+
var showEmpty = alwaysShowMask || this.isFocused();
|
|
8163
|
+
var hasValue = this.props.value != null;
|
|
8164
|
+
var newValue = hasValue ? getStringValue(this.props.value) : this.value;
|
|
8165
|
+
var cursorPosition = previousSelection ? previousSelection.start : null;
|
|
8166
|
+
this.maskOptions = parseMask(mask, maskChar, formatChars);
|
|
8167
|
+
if (!this.maskOptions.mask) {
|
|
8168
|
+
if (previousMaskOptions.mask) {
|
|
8169
|
+
this.stopSaveSelectionLoop(); // render depends on this.maskOptions and this.value,
|
|
8170
|
+
// call forceUpdate to keep it in sync
|
|
8171
|
+
|
|
8172
|
+
this.forceUpdate();
|
|
8173
|
+
}
|
|
8174
|
+
return;
|
|
8175
|
+
} else if (!previousMaskOptions.mask && this.isFocused()) {
|
|
8176
|
+
this.runSaveSelectionLoop();
|
|
8177
|
+
}
|
|
8178
|
+
var isMaskChanged = this.maskOptions.mask && this.maskOptions.mask !== previousMaskOptions.mask;
|
|
8179
|
+
if (!previousMaskOptions.mask && !hasValue) {
|
|
8180
|
+
newValue = this.getInputValue();
|
|
8181
|
+
}
|
|
8182
|
+
if (isMaskChanged || this.maskOptions.mask && (newValue || showEmpty)) {
|
|
8183
|
+
newValue = formatValue(this.maskOptions, newValue);
|
|
8184
|
+
}
|
|
8185
|
+
if (isMaskChanged) {
|
|
8186
|
+
var filledLength = getFilledLength(this.maskOptions, newValue);
|
|
8187
|
+
if (cursorPosition === null || filledLength < cursorPosition) {
|
|
8188
|
+
if (isFilled(this.maskOptions, newValue)) {
|
|
8189
|
+
cursorPosition = filledLength;
|
|
8190
|
+
} else {
|
|
8191
|
+
cursorPosition = getRightEditablePosition(this.maskOptions, filledLength);
|
|
8192
|
+
}
|
|
8193
|
+
}
|
|
8194
|
+
}
|
|
8195
|
+
if (this.maskOptions.mask && isEmpty(this.maskOptions, newValue) && !showEmpty && (!hasValue || !this.props.value)) {
|
|
8196
|
+
newValue = '';
|
|
8197
|
+
}
|
|
8198
|
+
var newSelection = {
|
|
8199
|
+
start: cursorPosition,
|
|
8200
|
+
end: cursorPosition
|
|
8201
|
+
};
|
|
8202
|
+
if (isFunction(beforeMaskedValueChange)) {
|
|
8203
|
+
var modifiedValue = beforeMaskedValueChange({
|
|
8204
|
+
value: newValue,
|
|
8205
|
+
selection: newSelection
|
|
8206
|
+
}, {
|
|
8207
|
+
value: this.value,
|
|
8208
|
+
selection: this.previousSelection
|
|
8209
|
+
}, null, this.getBeforeMaskedValueChangeConfig());
|
|
8210
|
+
newValue = modifiedValue.value;
|
|
8211
|
+
newSelection = modifiedValue.selection;
|
|
8212
|
+
}
|
|
8213
|
+
this.value = newValue;
|
|
8214
|
+
var isValueChanged = this.getInputValue() !== this.value; // render depends on this.maskOptions and this.value,
|
|
8215
|
+
// call forceUpdate to keep it in sync
|
|
8216
|
+
|
|
8217
|
+
if (isValueChanged) {
|
|
8218
|
+
this.setInputValue(this.value);
|
|
8219
|
+
this.forceUpdate();
|
|
8220
|
+
} else if (isMaskChanged) {
|
|
8221
|
+
this.forceUpdate();
|
|
8222
|
+
}
|
|
8223
|
+
var isSelectionChanged = false;
|
|
8224
|
+
if (newSelection.start != null && newSelection.end != null) {
|
|
8225
|
+
isSelectionChanged = !previousSelection || previousSelection.start !== newSelection.start || previousSelection.end !== newSelection.end;
|
|
8226
|
+
}
|
|
8227
|
+
if (isSelectionChanged || isValueChanged) {
|
|
8228
|
+
this.setSelection(newSelection.start, newSelection.end);
|
|
8229
|
+
}
|
|
8230
|
+
};
|
|
8231
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
8232
|
+
this.mounted = false;
|
|
8233
|
+
if (this.selectionDeferId !== null) {
|
|
8234
|
+
cancelDefer(this.selectionDeferId);
|
|
8235
|
+
}
|
|
8236
|
+
this.stopSaveSelectionLoop();
|
|
8237
|
+
};
|
|
8238
|
+
_proto.render = function render() {
|
|
8239
|
+
var _this$props2 = this.props,
|
|
8240
|
+
mask = _this$props2.mask;
|
|
8241
|
+
_this$props2.alwaysShowMask;
|
|
8242
|
+
var maskChar = _this$props2.maskChar,
|
|
8243
|
+
formatChars = _this$props2.formatChars,
|
|
8244
|
+
inputRef = _this$props2.inputRef;
|
|
8245
|
+
_this$props2.beforeMaskedValueChange;
|
|
8246
|
+
var children = _this$props2.children,
|
|
8247
|
+
restProps = _objectWithoutPropertiesLoose(_this$props2, ["mask", "alwaysShowMask", "maskChar", "formatChars", "inputRef", "beforeMaskedValueChange", "children"]);
|
|
8248
|
+
var inputElement;
|
|
8249
|
+
process.env.NODE_ENV !== "production" ? warning(
|
|
8250
|
+
// parse mask to test against actual mask prop as this.maskOptions
|
|
8251
|
+
// will be updated later in componentDidUpdate
|
|
8252
|
+
!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;
|
|
8253
|
+
if (children) {
|
|
8254
|
+
!isFunction(children) ? process.env.NODE_ENV !== "production" ? invariant(false, 'react-input-mask: children must be a function') : invariant(false) : void 0;
|
|
8255
|
+
var controlledProps = ['onChange', 'onPaste', 'onMouseDown', 'onFocus', 'onBlur', 'value', 'disabled', 'readOnly'];
|
|
8256
|
+
var childrenProps = _extends({}, restProps);
|
|
8257
|
+
controlledProps.forEach(function (propId) {
|
|
8258
|
+
return delete childrenProps[propId];
|
|
8259
|
+
});
|
|
8260
|
+
inputElement = children(childrenProps);
|
|
8261
|
+
var conflictProps = controlledProps.filter(function (propId) {
|
|
8262
|
+
return inputElement.props[propId] != null && inputElement.props[propId] !== restProps[propId];
|
|
8263
|
+
});
|
|
8264
|
+
!!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;
|
|
8265
|
+
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;
|
|
8266
|
+
} else {
|
|
8267
|
+
inputElement = React.createElement("input", _extends({
|
|
8268
|
+
ref: this.handleRef
|
|
8269
|
+
}, restProps));
|
|
8270
|
+
}
|
|
8271
|
+
var changedProps = {
|
|
8272
|
+
onFocus: this.onFocus,
|
|
8273
|
+
onBlur: this.onBlur
|
|
8534
8274
|
};
|
|
8535
|
-
|
|
8536
|
-
if (
|
|
8537
|
-
|
|
8275
|
+
if (this.maskOptions.mask) {
|
|
8276
|
+
if (!restProps.disabled && !restProps.readOnly) {
|
|
8277
|
+
changedProps.onChange = this.onChange;
|
|
8278
|
+
changedProps.onPaste = this.onPaste;
|
|
8279
|
+
changedProps.onMouseDown = this.onMouseDown;
|
|
8280
|
+
}
|
|
8281
|
+
if (restProps.value != null) {
|
|
8282
|
+
changedProps.value = this.value;
|
|
8538
8283
|
}
|
|
8539
|
-
};
|
|
8540
|
-
var _mask = props.mask,
|
|
8541
|
-
_maskChar = props.maskChar,
|
|
8542
|
-
_formatChars = props.formatChars,
|
|
8543
|
-
_alwaysShowMask = props.alwaysShowMask,
|
|
8544
|
-
_beforeMaskedValueChange = props.beforeMaskedValueChange;
|
|
8545
|
-
var defaultValue = props.defaultValue,
|
|
8546
|
-
_value = props.value;
|
|
8547
|
-
_this.maskOptions = parseMask(_mask, _maskChar, _formatChars);
|
|
8548
|
-
if (defaultValue == null) {
|
|
8549
|
-
defaultValue = '';
|
|
8550
8284
|
}
|
|
8551
|
-
|
|
8552
|
-
|
|
8285
|
+
inputElement = React.cloneElement(inputElement, changedProps);
|
|
8286
|
+
return inputElement;
|
|
8287
|
+
};
|
|
8288
|
+
return InputElement;
|
|
8289
|
+
}(React.Component);
|
|
8290
|
+
reactInputMask_development = InputElement;
|
|
8291
|
+
return reactInputMask_development;
|
|
8292
|
+
}
|
|
8293
|
+
|
|
8294
|
+
var reactInputMask_production_min;
|
|
8295
|
+
var hasRequiredReactInputMask_production_min;
|
|
8296
|
+
function requireReactInputMask_production_min() {
|
|
8297
|
+
if (hasRequiredReactInputMask_production_min) return reactInputMask_production_min;
|
|
8298
|
+
hasRequiredReactInputMask_production_min = 1;
|
|
8299
|
+
function _interopDefault(e) {
|
|
8300
|
+
return e && "object" == _typeof$1(e) && "default" in e ? e["default"] : e;
|
|
8301
|
+
}
|
|
8302
|
+
var React = _interopDefault(React__default),
|
|
8303
|
+
reactDom = require$$1;
|
|
8304
|
+
function _defaults2(e, t) {
|
|
8305
|
+
for (var n = Object.getOwnPropertyNames(t), a = 0; a < n.length; a++) {
|
|
8306
|
+
var i = n[a],
|
|
8307
|
+
r = Object.getOwnPropertyDescriptor(t, i);
|
|
8308
|
+
r && r.configurable && e[i] === undefined && Object.defineProperty(e, i, r);
|
|
8309
|
+
}
|
|
8310
|
+
return e;
|
|
8311
|
+
}
|
|
8312
|
+
function _extends() {
|
|
8313
|
+
return (_extends = Object.assign || function (e) {
|
|
8314
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
8315
|
+
var n = arguments[t];
|
|
8316
|
+
for (var a in n) Object.prototype.hasOwnProperty.call(n, a) && (e[a] = n[a]);
|
|
8553
8317
|
}
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8318
|
+
return e;
|
|
8319
|
+
}).apply(this, arguments);
|
|
8320
|
+
}
|
|
8321
|
+
function _inheritsLoose(e, t) {
|
|
8322
|
+
e.prototype = Object.create(t.prototype), _defaults2(e.prototype.constructor = e, t);
|
|
8323
|
+
}
|
|
8324
|
+
function _objectWithoutPropertiesLoose(e, t) {
|
|
8325
|
+
if (null == e) return {};
|
|
8326
|
+
var n,
|
|
8327
|
+
a,
|
|
8328
|
+
i = {},
|
|
8329
|
+
r = Object.keys(e);
|
|
8330
|
+
for (a = 0; a < r.length; a++) n = r[a], 0 <= t.indexOf(n) || (i[n] = e[n]);
|
|
8331
|
+
return i;
|
|
8332
|
+
}
|
|
8333
|
+
function _assertThisInitialized(e) {
|
|
8334
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
8335
|
+
return e;
|
|
8336
|
+
}
|
|
8337
|
+
var invariant = function invariant(e, t, n, a, i, r, o, s) {
|
|
8338
|
+
if (!e) {
|
|
8339
|
+
var l;
|
|
8340
|
+
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 {
|
|
8341
|
+
var u = [n, a, i, r, o, s],
|
|
8342
|
+
c = 0;
|
|
8343
|
+
(l = new Error(t.replace(/%s/g, function () {
|
|
8344
|
+
return u[c++];
|
|
8345
|
+
}))).name = "Invariant Violation";
|
|
8571
8346
|
}
|
|
8347
|
+
throw l.framesToPop = 1, l;
|
|
8348
|
+
}
|
|
8349
|
+
},
|
|
8350
|
+
invariant_1 = invariant;
|
|
8351
|
+
function setInputSelection(e, t, n) {
|
|
8352
|
+
if ("selectionStart" in e && "selectionEnd" in e) e.selectionStart = t, e.selectionEnd = n;else {
|
|
8353
|
+
var a = e.createTextRange();
|
|
8354
|
+
a.collapse(!0), a.moveStart("character", t), a.moveEnd("character", n - t), a.select();
|
|
8355
|
+
}
|
|
8356
|
+
}
|
|
8357
|
+
function getInputSelection(e) {
|
|
8358
|
+
var t = 0,
|
|
8359
|
+
n = 0;
|
|
8360
|
+
if ("selectionStart" in e && "selectionEnd" in e) t = e.selectionStart, n = e.selectionEnd;else {
|
|
8361
|
+
var a = document.selection.createRange();
|
|
8362
|
+
a.parentElement() === e && (t = -a.moveStart("character", -e.value.length), n = -a.moveEnd("character", -e.value.length));
|
|
8363
|
+
}
|
|
8364
|
+
return {
|
|
8365
|
+
start: t,
|
|
8366
|
+
end: n,
|
|
8367
|
+
length: n - t
|
|
8368
|
+
};
|
|
8369
|
+
}
|
|
8370
|
+
var defaultFormatChars = {
|
|
8371
|
+
9: "[0-9]",
|
|
8372
|
+
a: "[A-Za-z]",
|
|
8373
|
+
"*": "[A-Za-z0-9]"
|
|
8374
|
+
},
|
|
8375
|
+
defaultMaskChar = "_";
|
|
8376
|
+
function parseMask(e, t, n) {
|
|
8377
|
+
var a = "",
|
|
8378
|
+
i = "",
|
|
8379
|
+
r = null,
|
|
8380
|
+
o = [];
|
|
8381
|
+
if (t === undefined && (t = defaultMaskChar), null == n && (n = defaultFormatChars), !e || "string" != typeof e) return {
|
|
8382
|
+
maskChar: t,
|
|
8383
|
+
formatChars: n,
|
|
8384
|
+
mask: null,
|
|
8385
|
+
prefix: null,
|
|
8386
|
+
lastEditablePosition: null,
|
|
8387
|
+
permanents: []
|
|
8388
|
+
};
|
|
8389
|
+
var s = !1;
|
|
8390
|
+
return e.split("").forEach(function (e) {
|
|
8391
|
+
s = !s && "\\" === e || (s || !n[e] ? (o.push(a.length), a.length === o.length - 1 && (i += e)) : r = a.length + 1, a += e, !1);
|
|
8392
|
+
}), {
|
|
8393
|
+
maskChar: t,
|
|
8394
|
+
formatChars: n,
|
|
8395
|
+
prefix: i,
|
|
8396
|
+
mask: a,
|
|
8397
|
+
lastEditablePosition: r,
|
|
8398
|
+
permanents: o
|
|
8399
|
+
};
|
|
8400
|
+
}
|
|
8401
|
+
function isPermanentCharacter(e, t) {
|
|
8402
|
+
return -1 !== e.permanents.indexOf(t);
|
|
8403
|
+
}
|
|
8404
|
+
function isAllowedCharacter(e, t, n) {
|
|
8405
|
+
var a = e.mask,
|
|
8406
|
+
i = e.formatChars;
|
|
8407
|
+
if (!n) return !1;
|
|
8408
|
+
if (isPermanentCharacter(e, t)) return a[t] === n;
|
|
8409
|
+
var r = i[a[t]];
|
|
8410
|
+
return new RegExp(r).test(n);
|
|
8411
|
+
}
|
|
8412
|
+
function isEmpty(n, e) {
|
|
8413
|
+
return e.split("").every(function (e, t) {
|
|
8414
|
+
return isPermanentCharacter(n, t) || !isAllowedCharacter(n, t, e);
|
|
8415
|
+
});
|
|
8416
|
+
}
|
|
8417
|
+
function getFilledLength(e, t) {
|
|
8418
|
+
var n = e.maskChar,
|
|
8419
|
+
a = e.prefix;
|
|
8420
|
+
if (!n) {
|
|
8421
|
+
for (; t.length > a.length && isPermanentCharacter(e, t.length - 1);) t = t.slice(0, t.length - 1);
|
|
8422
|
+
return t.length;
|
|
8423
|
+
}
|
|
8424
|
+
for (var i = a.length, r = t.length; r >= a.length; r--) {
|
|
8425
|
+
var o = t[r];
|
|
8426
|
+
if (!isPermanentCharacter(e, r) && isAllowedCharacter(e, r, o)) {
|
|
8427
|
+
i = r + 1;
|
|
8428
|
+
break;
|
|
8572
8429
|
}
|
|
8573
|
-
_this.value = _newValue;
|
|
8574
|
-
return _this;
|
|
8575
8430
|
}
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8431
|
+
return i;
|
|
8432
|
+
}
|
|
8433
|
+
function isFilled(e, t) {
|
|
8434
|
+
return getFilledLength(e, t) === e.mask.length;
|
|
8435
|
+
}
|
|
8436
|
+
function formatValue(e, t) {
|
|
8437
|
+
var n = e.maskChar,
|
|
8438
|
+
a = e.mask,
|
|
8439
|
+
i = e.prefix;
|
|
8440
|
+
if (!n) {
|
|
8441
|
+
for ((t = insertString(e, "", t, 0)).length < i.length && (t = i); t.length < a.length && isPermanentCharacter(e, t.length);) t += a[t.length];
|
|
8442
|
+
return t;
|
|
8443
|
+
}
|
|
8444
|
+
if (t) return insertString(e, formatValue(e, ""), t, 0);
|
|
8445
|
+
for (var r = 0; r < a.length; r++) isPermanentCharacter(e, r) ? t += a[r] : t += n;
|
|
8446
|
+
return t;
|
|
8447
|
+
}
|
|
8448
|
+
function clearRange(n, e, a, t) {
|
|
8449
|
+
var i = a + t,
|
|
8450
|
+
r = n.maskChar,
|
|
8451
|
+
o = n.mask,
|
|
8452
|
+
s = n.prefix,
|
|
8453
|
+
l = e.split("");
|
|
8454
|
+
if (r) return l.map(function (e, t) {
|
|
8455
|
+
return t < a || i <= t ? e : isPermanentCharacter(n, t) ? o[t] : r;
|
|
8456
|
+
}).join("");
|
|
8457
|
+
for (var u = i; u < l.length; u++) isPermanentCharacter(n, u) && (l[u] = "");
|
|
8458
|
+
return a = Math.max(s.length, a), l.splice(a, i - a), e = l.join(""), formatValue(n, e);
|
|
8459
|
+
}
|
|
8460
|
+
function insertString(r, o, e, s) {
|
|
8461
|
+
var l = r.mask,
|
|
8462
|
+
u = r.maskChar,
|
|
8463
|
+
c = r.prefix,
|
|
8464
|
+
t = e.split(""),
|
|
8465
|
+
h = isFilled(r, o);
|
|
8466
|
+
return !u && s > o.length && (o += l.slice(o.length, s)), t.every(function (e) {
|
|
8467
|
+
for (; i = e, isPermanentCharacter(r, a = s) && i !== l[a];) {
|
|
8468
|
+
if (s >= o.length && (o += l[s]), t = e, n = s, u && isPermanentCharacter(r, n) && t === u) return !0;
|
|
8469
|
+
if (++s >= l.length) return !1;
|
|
8583
8470
|
}
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8471
|
+
var t, n, a, i;
|
|
8472
|
+
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);
|
|
8473
|
+
}), o;
|
|
8474
|
+
}
|
|
8475
|
+
function getInsertStringLength(a, e, t, i) {
|
|
8476
|
+
var r = a.mask,
|
|
8477
|
+
o = a.maskChar,
|
|
8478
|
+
n = t.split(""),
|
|
8479
|
+
s = i;
|
|
8480
|
+
return n.every(function (e) {
|
|
8481
|
+
for (; n = e, isPermanentCharacter(a, t = i) && n !== r[t];) if (++i >= r.length) return !1;
|
|
8482
|
+
var t, n;
|
|
8483
|
+
return (isAllowedCharacter(a, i, e) || e === o) && i++, i < r.length;
|
|
8484
|
+
}), i - s;
|
|
8485
|
+
}
|
|
8486
|
+
function getLeftEditablePosition(e, t) {
|
|
8487
|
+
for (var n = t; 0 <= n; --n) if (!isPermanentCharacter(e, n)) return n;
|
|
8488
|
+
return null;
|
|
8489
|
+
}
|
|
8490
|
+
function getRightEditablePosition(e, t) {
|
|
8491
|
+
for (var n = e.mask, a = t; a < n.length; ++a) if (!isPermanentCharacter(e, a)) return a;
|
|
8492
|
+
return null;
|
|
8493
|
+
}
|
|
8494
|
+
function getStringValue(e) {
|
|
8495
|
+
return e || 0 === e ? e + "" : "";
|
|
8496
|
+
}
|
|
8497
|
+
function processChange(e, t, n, a, i) {
|
|
8498
|
+
var r = e.mask,
|
|
8499
|
+
o = e.prefix,
|
|
8500
|
+
s = e.lastEditablePosition,
|
|
8501
|
+
l = t,
|
|
8502
|
+
u = "",
|
|
8503
|
+
c = 0,
|
|
8504
|
+
h = 0,
|
|
8505
|
+
f = Math.min(i.start, n.start);
|
|
8506
|
+
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) {
|
|
8507
|
+
if (1 === h && !i.length) f = i.start === n.start ? getRightEditablePosition(e, n.start) : getLeftEditablePosition(e, n.start);
|
|
8508
|
+
l = clearRange(e, l, f, h);
|
|
8509
|
+
}
|
|
8510
|
+
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), {
|
|
8511
|
+
value: l = formatValue(e, l),
|
|
8512
|
+
enteredString: u,
|
|
8513
|
+
selection: {
|
|
8514
|
+
start: f,
|
|
8515
|
+
end: f
|
|
8587
8516
|
}
|
|
8588
8517
|
};
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8518
|
+
}
|
|
8519
|
+
function isWindowsPhoneBrowser() {
|
|
8520
|
+
var e = new RegExp("windows", "i"),
|
|
8521
|
+
t = new RegExp("phone", "i"),
|
|
8522
|
+
n = navigator.userAgent;
|
|
8523
|
+
return e.test(n) && t.test(n);
|
|
8524
|
+
}
|
|
8525
|
+
function isFunction(e) {
|
|
8526
|
+
return "function" == typeof e;
|
|
8527
|
+
}
|
|
8528
|
+
function getRequestAnimationFrame() {
|
|
8529
|
+
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
|
|
8530
|
+
}
|
|
8531
|
+
function getCancelAnimationFrame() {
|
|
8532
|
+
return window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame;
|
|
8533
|
+
}
|
|
8534
|
+
function defer(e) {
|
|
8535
|
+
return (!!getCancelAnimationFrame() ? getRequestAnimationFrame() : function () {
|
|
8536
|
+
return setTimeout(e, 1e3 / 60);
|
|
8537
|
+
})(e);
|
|
8538
|
+
}
|
|
8539
|
+
function cancelDefer(e) {
|
|
8540
|
+
(getCancelAnimationFrame() || clearTimeout)(e);
|
|
8541
|
+
}
|
|
8542
|
+
var InputElement = function (c) {
|
|
8543
|
+
function e(e) {
|
|
8544
|
+
var f = c.call(this, e) || this;
|
|
8545
|
+
f.focused = !1, f.mounted = !1, f.previousSelection = null, f.selectionDeferId = null, f.saveSelectionLoopDeferId = null, f.saveSelectionLoop = function () {
|
|
8546
|
+
f.previousSelection = f.getSelection(), f.saveSelectionLoopDeferId = defer(f.saveSelectionLoop);
|
|
8547
|
+
}, f.runSaveSelectionLoop = function () {
|
|
8548
|
+
null === f.saveSelectionLoopDeferId && f.saveSelectionLoop();
|
|
8549
|
+
}, f.stopSaveSelectionLoop = function () {
|
|
8550
|
+
null !== f.saveSelectionLoopDeferId && (cancelDefer(f.saveSelectionLoopDeferId), f.saveSelectionLoopDeferId = null, f.previousSelection = null);
|
|
8551
|
+
}, f.getInputDOMNode = function () {
|
|
8552
|
+
if (!f.mounted) return null;
|
|
8553
|
+
var e = reactDom.findDOMNode(_assertThisInitialized(_assertThisInitialized(f))),
|
|
8554
|
+
t = "undefined" != typeof window && e instanceof window.Element;
|
|
8555
|
+
if (e && !t) return null;
|
|
8556
|
+
if ("INPUT" !== e.nodeName && (e = e.querySelector("input")), !e) throw new Error("react-input-mask: inputComponent doesn't contain input node");
|
|
8557
|
+
return e;
|
|
8558
|
+
}, f.getInputValue = function () {
|
|
8559
|
+
var e = f.getInputDOMNode();
|
|
8560
|
+
return e ? e.value : null;
|
|
8561
|
+
}, f.setInputValue = function (e) {
|
|
8562
|
+
var t = f.getInputDOMNode();
|
|
8563
|
+
t && (f.value = e, t.value = e);
|
|
8564
|
+
}, f.setCursorToEnd = function () {
|
|
8565
|
+
var e = getFilledLength(f.maskOptions, f.value),
|
|
8566
|
+
t = getRightEditablePosition(f.maskOptions, e);
|
|
8567
|
+
null !== t && f.setCursorPosition(t);
|
|
8568
|
+
}, f.setSelection = function (e, t, n) {
|
|
8569
|
+
void 0 === n && (n = {});
|
|
8570
|
+
var a = f.getInputDOMNode(),
|
|
8571
|
+
i = f.isFocused();
|
|
8572
|
+
a && i && (n.deferred || setInputSelection(a, e, t), null !== f.selectionDeferId && cancelDefer(f.selectionDeferId), f.selectionDeferId = defer(function () {
|
|
8573
|
+
f.selectionDeferId = null, setInputSelection(a, e, t);
|
|
8574
|
+
}), f.previousSelection = {
|
|
8575
|
+
start: e,
|
|
8576
|
+
end: t,
|
|
8577
|
+
length: Math.abs(t - e)
|
|
8578
|
+
});
|
|
8579
|
+
}, f.getSelection = function () {
|
|
8580
|
+
return getInputSelection(f.getInputDOMNode());
|
|
8581
|
+
}, f.getCursorPosition = function () {
|
|
8582
|
+
return f.getSelection().start;
|
|
8583
|
+
}, f.setCursorPosition = function (e) {
|
|
8584
|
+
f.setSelection(e, e);
|
|
8585
|
+
}, f.isFocused = function () {
|
|
8586
|
+
return f.focused;
|
|
8587
|
+
}, f.getBeforeMaskedValueChangeConfig = function () {
|
|
8588
|
+
var e = f.maskOptions,
|
|
8589
|
+
t = e.mask,
|
|
8590
|
+
n = e.maskChar,
|
|
8591
|
+
a = e.permanents,
|
|
8592
|
+
i = e.formatChars;
|
|
8593
|
+
return {
|
|
8594
|
+
mask: t,
|
|
8595
|
+
maskChar: n,
|
|
8596
|
+
permanents: a,
|
|
8597
|
+
alwaysShowMask: !!f.props.alwaysShowMask,
|
|
8598
|
+
formatChars: i
|
|
8599
|
+
};
|
|
8600
|
+
}, f.isInputAutofilled = function (e, t, n, a) {
|
|
8601
|
+
var i = f.getInputDOMNode();
|
|
8602
|
+
try {
|
|
8603
|
+
if (i.matches(":-webkit-autofill")) return !0;
|
|
8604
|
+
} catch (r) {}
|
|
8605
|
+
return !f.focused || a.end < n.length && t.end === e.length;
|
|
8606
|
+
}, f.onChange = function (e) {
|
|
8607
|
+
var t = _assertThisInitialized(_assertThisInitialized(f)).beforePasteState,
|
|
8608
|
+
n = _assertThisInitialized(_assertThisInitialized(f)).previousSelection,
|
|
8609
|
+
a = f.props.beforeMaskedValueChange,
|
|
8610
|
+
i = f.getInputValue(),
|
|
8611
|
+
r = f.value,
|
|
8612
|
+
o = f.getSelection();
|
|
8613
|
+
f.isInputAutofilled(i, o, r, n) && (r = formatValue(f.maskOptions, ""), n = {
|
|
8614
|
+
start: 0,
|
|
8615
|
+
end: 0,
|
|
8616
|
+
length: 0
|
|
8617
|
+
}), t && (n = t.selection, r = t.value, o = {
|
|
8618
|
+
start: n.start + i.length,
|
|
8619
|
+
end: n.start + i.length,
|
|
8620
|
+
length: 0
|
|
8621
|
+
}, i = r.slice(0, n.start) + i + r.slice(n.end), f.beforePasteState = null);
|
|
8622
|
+
var s = processChange(f.maskOptions, i, o, r, n),
|
|
8623
|
+
l = s.enteredString,
|
|
8624
|
+
u = s.selection,
|
|
8625
|
+
c = s.value;
|
|
8626
|
+
if (isFunction(a)) {
|
|
8627
|
+
var h = a({
|
|
8628
|
+
value: c,
|
|
8629
|
+
selection: u
|
|
8630
|
+
}, {
|
|
8631
|
+
value: r,
|
|
8632
|
+
selection: n
|
|
8633
|
+
}, l, f.getBeforeMaskedValueChangeConfig());
|
|
8634
|
+
c = h.value, u = h.selection;
|
|
8609
8635
|
}
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
}
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8636
|
+
f.setInputValue(c), isFunction(f.props.onChange) && f.props.onChange(e), f.isWindowsPhoneBrowser ? f.setSelection(u.start, u.end, {
|
|
8637
|
+
deferred: !0
|
|
8638
|
+
}) : f.setSelection(u.start, u.end);
|
|
8639
|
+
}, f.onFocus = function (e) {
|
|
8640
|
+
var t = f.props.beforeMaskedValueChange,
|
|
8641
|
+
n = f.maskOptions,
|
|
8642
|
+
a = n.mask,
|
|
8643
|
+
i = n.prefix;
|
|
8644
|
+
if (f.focused = !0, f.mounted = !0, a) {
|
|
8645
|
+
if (f.value) getFilledLength(f.maskOptions, f.value) < f.maskOptions.mask.length && f.setCursorToEnd();else {
|
|
8646
|
+
var r = formatValue(f.maskOptions, i),
|
|
8647
|
+
o = formatValue(f.maskOptions, r),
|
|
8648
|
+
s = getFilledLength(f.maskOptions, o),
|
|
8649
|
+
l = getRightEditablePosition(f.maskOptions, s),
|
|
8650
|
+
u = {
|
|
8651
|
+
start: l,
|
|
8652
|
+
end: l
|
|
8653
|
+
};
|
|
8654
|
+
if (isFunction(t)) {
|
|
8655
|
+
var c = t({
|
|
8656
|
+
value: o,
|
|
8657
|
+
selection: u
|
|
8658
|
+
}, {
|
|
8659
|
+
value: f.value,
|
|
8660
|
+
selection: null
|
|
8661
|
+
}, null, f.getBeforeMaskedValueChangeConfig());
|
|
8662
|
+
o = c.value, u = c.selection;
|
|
8663
|
+
}
|
|
8664
|
+
var h = o !== f.getInputValue();
|
|
8665
|
+
h && f.setInputValue(o), h && isFunction(f.props.onChange) && f.props.onChange(e), f.setSelection(u.start, u.end);
|
|
8628
8666
|
}
|
|
8667
|
+
f.runSaveSelectionLoop();
|
|
8629
8668
|
}
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8669
|
+
isFunction(f.props.onFocus) && f.props.onFocus(e);
|
|
8670
|
+
}, f.onBlur = function (e) {
|
|
8671
|
+
var t = f.props.beforeMaskedValueChange,
|
|
8672
|
+
n = f.maskOptions.mask;
|
|
8673
|
+
if (f.stopSaveSelectionLoop(), f.focused = !1, n && !f.props.alwaysShowMask && isEmpty(f.maskOptions, f.value)) {
|
|
8674
|
+
var a = "";
|
|
8675
|
+
if (isFunction(t)) a = t({
|
|
8676
|
+
value: a,
|
|
8677
|
+
selection: null
|
|
8678
|
+
}, {
|
|
8679
|
+
value: f.value,
|
|
8680
|
+
selection: f.previousSelection
|
|
8681
|
+
}, null, f.getBeforeMaskedValueChangeConfig()).value;
|
|
8682
|
+
var i = a !== f.getInputValue();
|
|
8683
|
+
i && f.setInputValue(a), i && isFunction(f.props.onChange) && f.props.onChange(e);
|
|
8684
|
+
}
|
|
8685
|
+
isFunction(f.props.onBlur) && f.props.onBlur(e);
|
|
8686
|
+
}, f.onMouseDown = function (e) {
|
|
8687
|
+
if (!f.focused && document.addEventListener) {
|
|
8688
|
+
f.mouseDownX = e.clientX, f.mouseDownY = e.clientY, f.mouseDownTime = new Date().getTime();
|
|
8689
|
+
var r = function r(e) {
|
|
8690
|
+
if (document.removeEventListener("mouseup", r), f.focused) {
|
|
8691
|
+
var t = Math.abs(e.clientX - f.mouseDownX),
|
|
8692
|
+
n = Math.abs(e.clientY - f.mouseDownY),
|
|
8693
|
+
a = Math.max(t, n),
|
|
8694
|
+
i = new Date().getTime() - f.mouseDownTime;
|
|
8695
|
+
(a <= 10 && i <= 200 || a <= 5 && i <= 300) && f.setCursorToEnd();
|
|
8696
|
+
}
|
|
8697
|
+
};
|
|
8698
|
+
document.addEventListener("mouseup", r);
|
|
8699
|
+
}
|
|
8700
|
+
isFunction(f.props.onMouseDown) && f.props.onMouseDown(e);
|
|
8701
|
+
}, f.onPaste = function (e) {
|
|
8702
|
+
isFunction(f.props.onPaste) && f.props.onPaste(e), e.defaultPrevented || (f.beforePasteState = {
|
|
8703
|
+
value: f.getInputValue(),
|
|
8704
|
+
selection: f.getSelection()
|
|
8705
|
+
}, f.setInputValue(""));
|
|
8706
|
+
}, f.handleRef = function (e) {
|
|
8707
|
+
null == f.props.children && isFunction(f.props.inputRef) && f.props.inputRef(e);
|
|
8637
8708
|
};
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8709
|
+
var t = e.mask,
|
|
8710
|
+
n = e.maskChar,
|
|
8711
|
+
a = e.formatChars,
|
|
8712
|
+
i = e.alwaysShowMask,
|
|
8713
|
+
r = e.beforeMaskedValueChange,
|
|
8714
|
+
o = e.defaultValue,
|
|
8715
|
+
s = e.value;
|
|
8716
|
+
f.maskOptions = parseMask(t, n, a), null == o && (o = ""), null == s && (s = o);
|
|
8717
|
+
var l = getStringValue(s);
|
|
8718
|
+
if (f.maskOptions.mask && (i || l) && (l = formatValue(f.maskOptions, l), isFunction(r))) {
|
|
8719
|
+
var u = e.value;
|
|
8720
|
+
null == e.value && (u = o), l = r({
|
|
8721
|
+
value: l,
|
|
8722
|
+
selection: null
|
|
8642
8723
|
}, {
|
|
8643
|
-
value:
|
|
8644
|
-
selection:
|
|
8645
|
-
}, null,
|
|
8646
|
-
newValue = modifiedValue.value;
|
|
8647
|
-
newSelection = modifiedValue.selection;
|
|
8648
|
-
}
|
|
8649
|
-
this.value = newValue;
|
|
8650
|
-
var isValueChanged = this.getInputValue() !== this.value; // render depends on this.maskOptions and this.value,
|
|
8651
|
-
// call forceUpdate to keep it in sync
|
|
8652
|
-
|
|
8653
|
-
if (isValueChanged) {
|
|
8654
|
-
this.setInputValue(this.value);
|
|
8655
|
-
this.forceUpdate();
|
|
8656
|
-
} else if (isMaskChanged) {
|
|
8657
|
-
this.forceUpdate();
|
|
8658
|
-
}
|
|
8659
|
-
var isSelectionChanged = false;
|
|
8660
|
-
if (newSelection.start != null && newSelection.end != null) {
|
|
8661
|
-
isSelectionChanged = !previousSelection || previousSelection.start !== newSelection.start || previousSelection.end !== newSelection.end;
|
|
8662
|
-
}
|
|
8663
|
-
if (isSelectionChanged || isValueChanged) {
|
|
8664
|
-
this.setSelection(newSelection.start, newSelection.end);
|
|
8665
|
-
}
|
|
8666
|
-
};
|
|
8667
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
8668
|
-
this.mounted = false;
|
|
8669
|
-
if (this.selectionDeferId !== null) {
|
|
8670
|
-
cancelDefer(this.selectionDeferId);
|
|
8671
|
-
}
|
|
8672
|
-
this.stopSaveSelectionLoop();
|
|
8673
|
-
};
|
|
8674
|
-
_proto.render = function render() {
|
|
8675
|
-
var _this$props2 = this.props,
|
|
8676
|
-
mask = _this$props2.mask;
|
|
8677
|
-
_this$props2.alwaysShowMask;
|
|
8678
|
-
var maskChar = _this$props2.maskChar,
|
|
8679
|
-
formatChars = _this$props2.formatChars,
|
|
8680
|
-
inputRef = _this$props2.inputRef;
|
|
8681
|
-
_this$props2.beforeMaskedValueChange;
|
|
8682
|
-
var children = _this$props2.children,
|
|
8683
|
-
restProps = _objectWithoutPropertiesLoose(_this$props2, ["mask", "alwaysShowMask", "maskChar", "formatChars", "inputRef", "beforeMaskedValueChange", "children"]);
|
|
8684
|
-
var inputElement;
|
|
8685
|
-
process.env.NODE_ENV !== "production" ? warning(
|
|
8686
|
-
// parse mask to test against actual mask prop as this.maskOptions
|
|
8687
|
-
// will be updated later in componentDidUpdate
|
|
8688
|
-
!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;
|
|
8689
|
-
if (children) {
|
|
8690
|
-
!isFunction(children) ? process.env.NODE_ENV !== "production" ? invariant(false, 'react-input-mask: children must be a function') : invariant(false) : void 0;
|
|
8691
|
-
var controlledProps = ['onChange', 'onPaste', 'onMouseDown', 'onFocus', 'onBlur', 'value', 'disabled', 'readOnly'];
|
|
8692
|
-
var childrenProps = _extends({}, restProps);
|
|
8693
|
-
controlledProps.forEach(function (propId) {
|
|
8694
|
-
return delete childrenProps[propId];
|
|
8695
|
-
});
|
|
8696
|
-
inputElement = children(childrenProps);
|
|
8697
|
-
var conflictProps = controlledProps.filter(function (propId) {
|
|
8698
|
-
return inputElement.props[propId] != null && inputElement.props[propId] !== restProps[propId];
|
|
8699
|
-
});
|
|
8700
|
-
!!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;
|
|
8701
|
-
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;
|
|
8702
|
-
} else {
|
|
8703
|
-
inputElement = React.createElement("input", _extends({
|
|
8704
|
-
ref: this.handleRef
|
|
8705
|
-
}, restProps));
|
|
8724
|
+
value: u = getStringValue(u),
|
|
8725
|
+
selection: null
|
|
8726
|
+
}, null, f.getBeforeMaskedValueChangeConfig()).value;
|
|
8706
8727
|
}
|
|
8707
|
-
|
|
8728
|
+
return f.value = l, f;
|
|
8729
|
+
}
|
|
8730
|
+
_inheritsLoose(e, c);
|
|
8731
|
+
var t = e.prototype;
|
|
8732
|
+
return t.componentDidMount = function () {
|
|
8733
|
+
this.mounted = !0, this.getInputDOMNode() && (this.isWindowsPhoneBrowser = isWindowsPhoneBrowser(), this.maskOptions.mask && this.getInputValue() !== this.value && this.setInputValue(this.value));
|
|
8734
|
+
}, t.componentDidUpdate = function () {
|
|
8735
|
+
var e = this.previousSelection,
|
|
8736
|
+
t = this.props,
|
|
8737
|
+
n = t.beforeMaskedValueChange,
|
|
8738
|
+
a = t.alwaysShowMask,
|
|
8739
|
+
i = t.mask,
|
|
8740
|
+
r = t.maskChar,
|
|
8741
|
+
o = t.formatChars,
|
|
8742
|
+
s = this.maskOptions,
|
|
8743
|
+
l = a || this.isFocused(),
|
|
8744
|
+
u = null != this.props.value,
|
|
8745
|
+
c = u ? getStringValue(this.props.value) : this.value,
|
|
8746
|
+
h = e ? e.start : null;
|
|
8747
|
+
if (this.maskOptions = parseMask(i, r, o), this.maskOptions.mask) {
|
|
8748
|
+
!s.mask && this.isFocused() && this.runSaveSelectionLoop();
|
|
8749
|
+
var f = this.maskOptions.mask && this.maskOptions.mask !== s.mask;
|
|
8750
|
+
if (s.mask || u || (c = this.getInputValue()), (f || this.maskOptions.mask && (c || l)) && (c = formatValue(this.maskOptions, c)), f) {
|
|
8751
|
+
var p = getFilledLength(this.maskOptions, c);
|
|
8752
|
+
(null === h || p < h) && (h = isFilled(this.maskOptions, c) ? p : getRightEditablePosition(this.maskOptions, p));
|
|
8753
|
+
}
|
|
8754
|
+
!this.maskOptions.mask || !isEmpty(this.maskOptions, c) || l || u && this.props.value || (c = "");
|
|
8755
|
+
var d = {
|
|
8756
|
+
start: h,
|
|
8757
|
+
end: h
|
|
8758
|
+
};
|
|
8759
|
+
if (isFunction(n)) {
|
|
8760
|
+
var m = n({
|
|
8761
|
+
value: c,
|
|
8762
|
+
selection: d
|
|
8763
|
+
}, {
|
|
8764
|
+
value: this.value,
|
|
8765
|
+
selection: this.previousSelection
|
|
8766
|
+
}, null, this.getBeforeMaskedValueChangeConfig());
|
|
8767
|
+
c = m.value, d = m.selection;
|
|
8768
|
+
}
|
|
8769
|
+
this.value = c;
|
|
8770
|
+
var g = this.getInputValue() !== this.value;
|
|
8771
|
+
g ? (this.setInputValue(this.value), this.forceUpdate()) : f && this.forceUpdate();
|
|
8772
|
+
var v = !1;
|
|
8773
|
+
null != d.start && null != d.end && (v = !e || e.start !== d.start || e.end !== d.end), (v || g) && this.setSelection(d.start, d.end);
|
|
8774
|
+
} else s.mask && (this.stopSaveSelectionLoop(), this.forceUpdate());
|
|
8775
|
+
}, t.componentWillUnmount = function () {
|
|
8776
|
+
this.mounted = !1, null !== this.selectionDeferId && cancelDefer(this.selectionDeferId), this.stopSaveSelectionLoop();
|
|
8777
|
+
}, t.render = function () {
|
|
8778
|
+
var t,
|
|
8779
|
+
e = this.props,
|
|
8780
|
+
n = (e.mask, e.alwaysShowMask, e.maskChar, e.formatChars, e.inputRef, e.beforeMaskedValueChange, e.children),
|
|
8781
|
+
a = _objectWithoutPropertiesLoose(e, ["mask", "alwaysShowMask", "maskChar", "formatChars", "inputRef", "beforeMaskedValueChange", "children"]);
|
|
8782
|
+
if (n) {
|
|
8783
|
+
isFunction(n) || invariant_1(!1);
|
|
8784
|
+
var i = ["onChange", "onPaste", "onMouseDown", "onFocus", "onBlur", "value", "disabled", "readOnly"],
|
|
8785
|
+
r = _extends({}, a);
|
|
8786
|
+
i.forEach(function (e) {
|
|
8787
|
+
return delete r[e];
|
|
8788
|
+
}), t = n(r), i.filter(function (e) {
|
|
8789
|
+
return null != t.props[e] && t.props[e] !== a[e];
|
|
8790
|
+
}).length && invariant_1(!1);
|
|
8791
|
+
} else t = React.createElement("input", _extends({
|
|
8792
|
+
ref: this.handleRef
|
|
8793
|
+
}, a));
|
|
8794
|
+
var o = {
|
|
8708
8795
|
onFocus: this.onFocus,
|
|
8709
8796
|
onBlur: this.onBlur
|
|
8710
8797
|
};
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
changedProps.onChange = this.onChange;
|
|
8714
|
-
changedProps.onPaste = this.onPaste;
|
|
8715
|
-
changedProps.onMouseDown = this.onMouseDown;
|
|
8716
|
-
}
|
|
8717
|
-
if (restProps.value != null) {
|
|
8718
|
-
changedProps.value = this.value;
|
|
8719
|
-
}
|
|
8720
|
-
}
|
|
8721
|
-
inputElement = React.cloneElement(inputElement, changedProps);
|
|
8722
|
-
return inputElement;
|
|
8723
|
-
};
|
|
8724
|
-
return InputElement;
|
|
8798
|
+
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.cloneElement(t, o);
|
|
8799
|
+
}, e;
|
|
8725
8800
|
}(React.Component);
|
|
8726
|
-
|
|
8727
|
-
return
|
|
8801
|
+
reactInputMask_production_min = InputElement;
|
|
8802
|
+
return reactInputMask_production_min;
|
|
8728
8803
|
}
|
|
8729
8804
|
|
|
8730
8805
|
if (process.env.NODE_ENV === 'production') {
|
|
@@ -8805,7 +8880,7 @@ var cardTypes$1 = {
|
|
|
8805
8880
|
unionpay: {
|
|
8806
8881
|
niceType: "UnionPay",
|
|
8807
8882
|
type: "unionpay",
|
|
8808
|
-
patterns: [620, [
|
|
8883
|
+
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]],
|
|
8809
8884
|
gaps: [4, 8, 12],
|
|
8810
8885
|
lengths: [14, 15, 16, 17, 18, 19],
|
|
8811
8886
|
code: {
|
|
@@ -8926,10 +9001,10 @@ function addMatchingCardsToResults(cardNumber, cardConfiguration, results) {
|
|
|
8926
9001
|
var i, patternLength;
|
|
8927
9002
|
for (i = 0; i < cardConfiguration.patterns.length; i++) {
|
|
8928
9003
|
var pattern = cardConfiguration.patterns[i];
|
|
8929
|
-
if (!matches_1.matches(cardNumber, pattern)) {
|
|
9004
|
+
if (!(0, matches_1.matches)(cardNumber, pattern)) {
|
|
8930
9005
|
continue;
|
|
8931
9006
|
}
|
|
8932
|
-
var clonedCardConfiguration = clone_1$1.clone(cardConfiguration);
|
|
9007
|
+
var clonedCardConfiguration = (0, clone_1$1.clone)(cardConfiguration);
|
|
8933
9008
|
if (Array.isArray(pattern)) {
|
|
8934
9009
|
patternLength = String(pattern[0]).length;
|
|
8935
9010
|
} else {
|
|
@@ -9023,13 +9098,13 @@ var cardNames = {
|
|
|
9023
9098
|
HIPERCARD: "hipercard"
|
|
9024
9099
|
};
|
|
9025
9100
|
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];
|
|
9026
|
-
var testOrder = clone_1.clone(ORIGINAL_TEST_ORDER);
|
|
9101
|
+
var testOrder = (0, clone_1.clone)(ORIGINAL_TEST_ORDER);
|
|
9027
9102
|
function findType(cardType) {
|
|
9028
9103
|
return customCards[cardType] || cardTypes[cardType];
|
|
9029
9104
|
}
|
|
9030
9105
|
function getAllCardTypes() {
|
|
9031
9106
|
return testOrder.map(function (cardType) {
|
|
9032
|
-
return clone_1.clone(findType(cardType));
|
|
9107
|
+
return (0, clone_1.clone)(findType(cardType));
|
|
9033
9108
|
});
|
|
9034
9109
|
}
|
|
9035
9110
|
function getCardPosition(name, ignoreErrorForNotExisting) {
|
|
@@ -9044,7 +9119,7 @@ function getCardPosition(name, ignoreErrorForNotExisting) {
|
|
|
9044
9119
|
}
|
|
9045
9120
|
function creditCardType(cardNumber) {
|
|
9046
9121
|
var results = [];
|
|
9047
|
-
if (!is_valid_input_type_1.isValidInputType(cardNumber)) {
|
|
9122
|
+
if (!(0, is_valid_input_type_1.isValidInputType)(cardNumber)) {
|
|
9048
9123
|
return results;
|
|
9049
9124
|
}
|
|
9050
9125
|
if (cardNumber.length === 0) {
|
|
@@ -9052,16 +9127,16 @@ function creditCardType(cardNumber) {
|
|
|
9052
9127
|
}
|
|
9053
9128
|
testOrder.forEach(function (cardType) {
|
|
9054
9129
|
var cardConfiguration = findType(cardType);
|
|
9055
|
-
add_matching_cards_to_results_1.addMatchingCardsToResults(cardNumber, cardConfiguration, results);
|
|
9130
|
+
(0, add_matching_cards_to_results_1.addMatchingCardsToResults)(cardNumber, cardConfiguration, results);
|
|
9056
9131
|
});
|
|
9057
|
-
var bestMatch = find_best_match_1.findBestMatch(results);
|
|
9132
|
+
var bestMatch = (0, find_best_match_1.findBestMatch)(results);
|
|
9058
9133
|
if (bestMatch) {
|
|
9059
9134
|
return [bestMatch];
|
|
9060
9135
|
}
|
|
9061
9136
|
return results;
|
|
9062
9137
|
}
|
|
9063
9138
|
creditCardType.getTypeInfo = function (cardType) {
|
|
9064
|
-
return clone_1.clone(findType(cardType));
|
|
9139
|
+
return (0, clone_1.clone)(findType(cardType));
|
|
9065
9140
|
};
|
|
9066
9141
|
creditCardType.removeCard = function (name) {
|
|
9067
9142
|
var position = getCardPosition(name);
|
|
@@ -9077,12 +9152,12 @@ creditCardType.addCard = function (config) {
|
|
|
9077
9152
|
creditCardType.updateCard = function (cardType, updates) {
|
|
9078
9153
|
var originalObject = customCards[cardType] || cardTypes[cardType];
|
|
9079
9154
|
if (!originalObject) {
|
|
9080
|
-
throw new Error("\""
|
|
9155
|
+
throw new Error("\"".concat(cardType, "\" is not a recognized type. Use `addCard` instead.'"));
|
|
9081
9156
|
}
|
|
9082
9157
|
if (updates.type && originalObject.type !== updates.type) {
|
|
9083
9158
|
throw new Error("Cannot overwrite type parameter.");
|
|
9084
9159
|
}
|
|
9085
|
-
var clonedCard = clone_1.clone(originalObject);
|
|
9160
|
+
var clonedCard = (0, clone_1.clone)(originalObject);
|
|
9086
9161
|
clonedCard = __assign$8(__assign$8({}, clonedCard), updates);
|
|
9087
9162
|
customCards[clonedCard.type] = clonedCard;
|
|
9088
9163
|
};
|
|
@@ -9092,7 +9167,7 @@ creditCardType.changeOrder = function (name, position) {
|
|
|
9092
9167
|
testOrder.splice(position, 0, name);
|
|
9093
9168
|
};
|
|
9094
9169
|
creditCardType.resetModifications = function () {
|
|
9095
|
-
testOrder = clone_1.clone(ORIGINAL_TEST_ORDER);
|
|
9170
|
+
testOrder = (0, clone_1.clone)(ORIGINAL_TEST_ORDER);
|
|
9096
9171
|
customCards = {};
|
|
9097
9172
|
};
|
|
9098
9173
|
creditCardType.types = cardNames;
|
|
@@ -9174,8 +9249,8 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
9174
9249
|
"aria-label": label || placeholder,
|
|
9175
9250
|
ref: ref,
|
|
9176
9251
|
onChange: function onChange(event) {
|
|
9177
|
-
_onChange === null || _onChange === void 0
|
|
9178
|
-
onChangeEvent === null || onChangeEvent === void 0
|
|
9252
|
+
_onChange === null || _onChange === void 0 || _onChange(event.target.value);
|
|
9253
|
+
onChangeEvent === null || onChangeEvent === void 0 || onChangeEvent(event);
|
|
9179
9254
|
}
|
|
9180
9255
|
}, rest));
|
|
9181
9256
|
});
|
|
@@ -9633,12 +9708,12 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
9633
9708
|
var handleClear = useCallback(function () {
|
|
9634
9709
|
var _ref$current;
|
|
9635
9710
|
setValue(DEFAULT_INPUT_VALUE);
|
|
9636
|
-
onChange === null || onChange === void 0
|
|
9637
|
-
onClear === null || onClear === void 0
|
|
9638
|
-
(_ref$current = ref.current) === null || _ref$current === void 0
|
|
9711
|
+
onChange === null || onChange === void 0 || onChange(DEFAULT_INPUT_VALUE);
|
|
9712
|
+
onClear === null || onClear === void 0 || onClear();
|
|
9713
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.focus();
|
|
9639
9714
|
}, [onClear, onChange]);
|
|
9640
9715
|
var handleChange = useCallback(function (value) {
|
|
9641
|
-
onChange === null || onChange === void 0
|
|
9716
|
+
onChange === null || onChange === void 0 || onChange(value);
|
|
9642
9717
|
setValue(value);
|
|
9643
9718
|
}, [onChange, setValue]);
|
|
9644
9719
|
useEffect(function () {
|
|
@@ -9660,16 +9735,16 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
9660
9735
|
}, /*#__PURE__*/React__default.createElement(Exit20, null)));
|
|
9661
9736
|
};
|
|
9662
9737
|
|
|
9663
|
-
var t
|
|
9738
|
+
var t = function t(_t) {
|
|
9664
9739
|
return "object" == _typeof$1(_t) && null != _t && 1 === _t.nodeType;
|
|
9665
9740
|
},
|
|
9666
|
-
e = function e(t, _e) {
|
|
9741
|
+
e$1 = function e(t, _e) {
|
|
9667
9742
|
return (!_e || "hidden" !== t) && "visible" !== t && "clip" !== t;
|
|
9668
9743
|
},
|
|
9669
9744
|
n = function n(t, _n) {
|
|
9670
9745
|
if (t.clientHeight < t.scrollHeight || t.clientWidth < t.scrollWidth) {
|
|
9671
9746
|
var _l = getComputedStyle(t, null);
|
|
9672
|
-
return e(_l.overflowY, _n) || e(_l.overflowX, _n) || function (t) {
|
|
9747
|
+
return e$1(_l.overflowY, _n) || e$1(_l.overflowX, _n) || function (t) {
|
|
9673
9748
|
var e = function (t) {
|
|
9674
9749
|
if (!t.ownerDocument || !t.ownerDocument.defaultView) return null;
|
|
9675
9750
|
try {
|
|
@@ -9701,11 +9776,11 @@ var t$1 = function t(_t) {
|
|
|
9701
9776
|
m = "function" == typeof a ? a : function (t) {
|
|
9702
9777
|
return t !== a;
|
|
9703
9778
|
};
|
|
9704
|
-
if (!t
|
|
9779
|
+
if (!t(e)) throw new TypeError("Invalid target");
|
|
9705
9780
|
var p = document.scrollingElement || document.documentElement,
|
|
9706
9781
|
w = [],
|
|
9707
9782
|
W = e;
|
|
9708
|
-
for (; t
|
|
9783
|
+
for (; t(W) && m(W);) {
|
|
9709
9784
|
if (W = i(W), W === p) {
|
|
9710
9785
|
w.push(W);
|
|
9711
9786
|
break;
|
|
@@ -9763,42 +9838,53 @@ var t$1 = function t(_t) {
|
|
|
9763
9838
|
return k;
|
|
9764
9839
|
};
|
|
9765
9840
|
|
|
9766
|
-
var o = function o(
|
|
9767
|
-
return !1 ===
|
|
9841
|
+
var o = function o(t) {
|
|
9842
|
+
return !1 === t ? {
|
|
9768
9843
|
block: "end",
|
|
9769
9844
|
inline: "nearest"
|
|
9770
|
-
} : function (
|
|
9771
|
-
return
|
|
9772
|
-
}(
|
|
9845
|
+
} : function (t) {
|
|
9846
|
+
return t === Object(t) && 0 !== Object.keys(t).length;
|
|
9847
|
+
}(t) ? t : {
|
|
9773
9848
|
block: "start",
|
|
9774
9849
|
inline: "nearest"
|
|
9775
9850
|
};
|
|
9776
9851
|
};
|
|
9777
|
-
function
|
|
9778
|
-
if (!
|
|
9779
|
-
var o =
|
|
9852
|
+
function e(e, r) {
|
|
9853
|
+
if (!e.isConnected || !function (t) {
|
|
9854
|
+
var o = t;
|
|
9780
9855
|
for (; o && o.parentNode;) {
|
|
9781
9856
|
if (o.parentNode === document) return !0;
|
|
9782
9857
|
o = o.parentNode instanceof ShadowRoot ? o.parentNode.host : o.parentNode;
|
|
9783
9858
|
}
|
|
9784
9859
|
return !1;
|
|
9785
|
-
}(
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
9860
|
+
}(e)) return;
|
|
9861
|
+
var n = function (t) {
|
|
9862
|
+
var o = window.getComputedStyle(t);
|
|
9863
|
+
return {
|
|
9864
|
+
top: parseFloat(o.scrollMarginTop) || 0,
|
|
9865
|
+
right: parseFloat(o.scrollMarginRight) || 0,
|
|
9866
|
+
bottom: parseFloat(o.scrollMarginBottom) || 0,
|
|
9867
|
+
left: parseFloat(o.scrollMarginLeft) || 0
|
|
9868
|
+
};
|
|
9869
|
+
}(e);
|
|
9870
|
+
if (function (t) {
|
|
9871
|
+
return "object" == _typeof$1(t) && "function" == typeof t.behavior;
|
|
9872
|
+
}(r)) return r.behavior(o$1(e, r));
|
|
9873
|
+
var l = "boolean" == typeof r || null == r ? void 0 : r.behavior;
|
|
9874
|
+
var _iterator = _createForOfIteratorHelper(o$1(e, o(r))),
|
|
9791
9875
|
_step;
|
|
9792
9876
|
try {
|
|
9793
9877
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
9794
9878
|
var _step$value = _step.value,
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
9798
|
-
i.
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9879
|
+
a = _step$value.el,
|
|
9880
|
+
i = _step$value.top,
|
|
9881
|
+
s = _step$value.left;
|
|
9882
|
+
var _t = i - n.top + n.bottom,
|
|
9883
|
+
_o = s - n.left + n.right;
|
|
9884
|
+
a.scroll({
|
|
9885
|
+
top: _t,
|
|
9886
|
+
left: _o,
|
|
9887
|
+
behavior: l
|
|
9802
9888
|
});
|
|
9803
9889
|
}
|
|
9804
9890
|
} catch (err) {
|
|
@@ -9822,7 +9908,7 @@ var SelectOption = function SelectOption(_ref) {
|
|
|
9822
9908
|
}, [onClick, option]);
|
|
9823
9909
|
useEffect(function () {
|
|
9824
9910
|
if (active && ref.current) {
|
|
9825
|
-
|
|
9911
|
+
e(ref.current, {
|
|
9826
9912
|
scrollMode: 'if-needed',
|
|
9827
9913
|
block: 'nearest'
|
|
9828
9914
|
});
|
|
@@ -10063,7 +10149,7 @@ var Select = function Select(_ref) {
|
|
|
10063
10149
|
value: autoSelect ? option.value : value !== null && value !== void 0 ? value : option.value
|
|
10064
10150
|
}
|
|
10065
10151
|
});
|
|
10066
|
-
onChange === null || onChange === void 0
|
|
10152
|
+
onChange === null || onChange === void 0 || onChange(option.value);
|
|
10067
10153
|
}, [autoSelect, value, dispatch, onChange]);
|
|
10068
10154
|
var handleFocus = useCallback(function (option) {
|
|
10069
10155
|
return dispatch({
|
|
@@ -10397,7 +10483,7 @@ var CreditCardNumberInput = function CreditCardNumberInput(_ref) {
|
|
|
10397
10483
|
}, [propsValue, value, setValue]);
|
|
10398
10484
|
var handleChange = useCallback(function (event) {
|
|
10399
10485
|
setValue(event.target.value);
|
|
10400
|
-
onChange === null || onChange === void 0
|
|
10486
|
+
onChange === null || onChange === void 0 || onChange(event.target.value);
|
|
10401
10487
|
}, [setValue, onChange]);
|
|
10402
10488
|
|
|
10403
10489
|
// 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
|
|
@@ -10460,7 +10546,7 @@ var Expandable = function Expandable(_ref) {
|
|
|
10460
10546
|
setExpanded(function (expanded) {
|
|
10461
10547
|
return !expanded;
|
|
10462
10548
|
});
|
|
10463
|
-
onToggle === null || onToggle === void 0
|
|
10549
|
+
onToggle === null || onToggle === void 0 || onToggle();
|
|
10464
10550
|
}, [onToggle]);
|
|
10465
10551
|
return /*#__PURE__*/React__default.createElement("div", _extends$1({
|
|
10466
10552
|
className: classNames('Expandable', "Expandable--".concat(background, "-background"), {
|
|
@@ -10892,7 +10978,7 @@ var ModalOverlay = function ModalOverlay(_ref) {
|
|
|
10892
10978
|
document.body.appendChild(element);
|
|
10893
10979
|
return function () {
|
|
10894
10980
|
var _element$parentElemen;
|
|
10895
|
-
element === null || element === void 0
|
|
10981
|
+
element === null || element === void 0 || (_element$parentElemen = element.parentElement) === null || _element$parentElemen === void 0 || _element$parentElemen.removeChild(element);
|
|
10896
10982
|
};
|
|
10897
10983
|
}, [element]);
|
|
10898
10984
|
if (!element) return null;
|
|
@@ -10909,6 +10995,35 @@ var ModalOverlay = function ModalOverlay(_ref) {
|
|
|
10909
10995
|
}, children))), element);
|
|
10910
10996
|
};
|
|
10911
10997
|
|
|
10998
|
+
var preventNavigation = function preventNavigation(event) {
|
|
10999
|
+
event.preventDefault();
|
|
11000
|
+
event.returnValue = '';
|
|
11001
|
+
};
|
|
11002
|
+
|
|
11003
|
+
var usePreventNavigation = function usePreventNavigation() {
|
|
11004
|
+
var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
11005
|
+
useEffect(function () {
|
|
11006
|
+
if (enabled) {
|
|
11007
|
+
window.addEventListener('beforeunload', preventNavigation);
|
|
11008
|
+
return function () {
|
|
11009
|
+
return window.removeEventListener('beforeunload', preventNavigation);
|
|
11010
|
+
};
|
|
11011
|
+
}
|
|
11012
|
+
}, [enabled]);
|
|
11013
|
+
};
|
|
11014
|
+
|
|
11015
|
+
var NavigationPreventer = function NavigationPreventer(_ref) {
|
|
11016
|
+
var _ref$enabled = _ref.enabled,
|
|
11017
|
+
enabled = _ref$enabled === void 0 ? false : _ref$enabled,
|
|
11018
|
+
_ref$message = _ref.message,
|
|
11019
|
+
message = _ref$message === void 0 ? 'Changes that you made may not be saved.' : _ref$message;
|
|
11020
|
+
usePreventNavigation(enabled);
|
|
11021
|
+
return /*#__PURE__*/React__default.createElement(Prompt, {
|
|
11022
|
+
when: enabled,
|
|
11023
|
+
message: message
|
|
11024
|
+
});
|
|
11025
|
+
};
|
|
11026
|
+
|
|
10912
11027
|
var __assign$1 = undefined && undefined.__assign || function () {
|
|
10913
11028
|
__assign$1 = Object.assign || function (t) {
|
|
10914
11029
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -11336,21 +11451,25 @@ var Tag = function Tag(_ref) {
|
|
|
11336
11451
|
}, /*#__PURE__*/React__default.createElement(Exit16, null)));
|
|
11337
11452
|
};
|
|
11338
11453
|
|
|
11339
|
-
var _excluded$4 = ["tabs", "onTabClicked", "activeTab", "className"];
|
|
11454
|
+
var _excluded$4 = ["tabs", "onTabClicked", "defaultActiveTab", "activeTab", "className"];
|
|
11340
11455
|
var Tabs = function Tabs(_ref) {
|
|
11341
11456
|
var tabs = _ref.tabs,
|
|
11342
11457
|
onTabClicked = _ref.onTabClicked,
|
|
11458
|
+
defaultActiveTab = _ref.defaultActiveTab,
|
|
11343
11459
|
activeTab = _ref.activeTab,
|
|
11344
11460
|
className = _ref.className,
|
|
11345
11461
|
rest = _objectWithoutProperties(_ref, _excluded$4);
|
|
11346
|
-
var _useState = useState(activeTab || tabs[0].name),
|
|
11462
|
+
var _useState = useState(activeTab || defaultActiveTab || tabs[0].name),
|
|
11347
11463
|
_useState2 = _slicedToArray(_useState, 2),
|
|
11348
11464
|
activePanel = _useState2[0],
|
|
11349
11465
|
setActivePanel = _useState2[1];
|
|
11350
11466
|
var handleTabClick = function handleTabClick(tabName) {
|
|
11351
|
-
setActivePanel(tabName);
|
|
11467
|
+
if (!activeTab) setActivePanel(tabName);
|
|
11352
11468
|
if (onTabClicked) onTabClicked(tabName);
|
|
11353
11469
|
};
|
|
11470
|
+
useEffect(function () {
|
|
11471
|
+
if (activeTab) setActivePanel(activeTab);
|
|
11472
|
+
}, [activeTab]);
|
|
11354
11473
|
return /*#__PURE__*/React__default.createElement("div", _extends$1({
|
|
11355
11474
|
className: classNames('Tabs', className)
|
|
11356
11475
|
}, rest), /*#__PURE__*/React__default.createElement(TabList, {
|
|
@@ -11555,4 +11674,4 @@ var Utilities = {
|
|
|
11555
11674
|
States: States
|
|
11556
11675
|
};
|
|
11557
11676
|
|
|
11558
|
-
export { ArcWindow, AspectRatioBox, Badge, Bradley, Brancusi, Breadcrumb, Breadcrumbs, Breakpoint, BreakpointContext, BreakpointProvider, Button, Checkbox, Circle, Clickable, ColorSwatch, Constrain, ControlLink, CreditCardNumberInput, DEFAULT_PRODUCT_ASPECT_HEIGHT, DEFAULT_PRODUCT_ASPECT_RATIO, DEFAULT_PRODUCT_ASPECT_WIDTH, DefinitionList, Diamond, Divider, ExceedConstrain, Expandable, Field, FocusOn, Field as Input, Keyhole, Label, Loading, LoadingBalls, LoadingShapes, Mirror, Modal, ModalOverlay, MultiSelect, NoLineDivider, Oval, Overlay, POPOVER_MOUSEOUT_DELAY_MS, Paginator, PasswordInput, Popover, PromoBanner, RadioButton, SKU_COLORS, SearchInput, Select, SelectableButton, SlidingPane, Stack, Tab, TabList, TabPanel, TabPanels, Tabs, Tag, Text, TextInput, Textarea, Toast, Triangle, TwoLineDivider, UNMOUNT_DELAY_MS, Utilities, VerticalDivider, Window, discriminate, tokens, useBreakpoint, useClickOutside, useKeyboardListNavigation, useUpdateEffect };
|
|
11677
|
+
export { ArcWindow, AspectRatioBox, Badge, Bradley, Brancusi, Breadcrumb, Breadcrumbs, Breakpoint, BreakpointContext, BreakpointProvider, Button, Checkbox, Circle, Clickable, ColorSwatch, Constrain, ControlLink, CreditCardNumberInput, DEFAULT_PRODUCT_ASPECT_HEIGHT, DEFAULT_PRODUCT_ASPECT_RATIO, DEFAULT_PRODUCT_ASPECT_WIDTH, DefinitionList, Diamond, Divider, ExceedConstrain, Expandable, Field, FocusOn, Field as Input, Keyhole, Label, Loading, LoadingBalls, LoadingShapes, Mirror, Modal, ModalOverlay, MultiSelect, NavigationPreventer, NoLineDivider, Oval, Overlay, POPOVER_MOUSEOUT_DELAY_MS, Paginator, PasswordInput, Popover, PromoBanner, RadioButton, SKU_COLORS, SearchInput, Select, SelectableButton, SlidingPane, Stack, Tab, TabList, TabPanel, TabPanels, Tabs, Tag, Text, TextInput, Textarea, Toast, Triangle, TwoLineDivider, UNMOUNT_DELAY_MS, Utilities, VerticalDivider, Window, discriminate, tokens, useBreakpoint, useClickOutside, useKeyboardListNavigation, useUpdateEffect };
|