@moda/om 18.3.2 → 18.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1866 -1745
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1867 -1747
- package/dist/index.esm.js.map +1 -1
- package/dist/src/__mocks__/Icon.d.ts +2 -2
- package/dist/src/components/AspectRatioBox/AspectRatioBox.stories.d.ts +2 -2
- package/dist/src/components/Badge/Badge.stories.d.ts +3 -3
- package/dist/src/components/Breadcrumbs/Breadcrumbs.stories.d.ts +3 -3
- package/dist/src/components/Breakpoint/Breakpoint.stories.d.ts +4 -4
- package/dist/src/components/Button/Button.stories.d.ts +13 -13
- package/dist/src/components/Checkbox/Checkbox.stories.d.ts +7 -7
- package/dist/src/components/Clickable/Clickable.stories.d.ts +4 -4
- package/dist/src/components/ColorSwatch/ColorSwatch.stories.d.ts +6 -6
- package/dist/src/components/Constrain/Constrain.stories.d.ts +5 -5
- package/dist/src/components/Constrain/ExceedConstrain.stories.d.ts +4 -4
- package/dist/src/components/ControlLink/ControlLink.stories.d.ts +3 -3
- package/dist/src/components/CreditCardNumberInput/CreditCardNumberInput.stories.d.ts +2 -2
- package/dist/src/components/DefinitionList/DefinitionList.stories.d.ts +2 -2
- package/dist/src/components/Divider/Divider.stories.d.ts +5 -5
- package/dist/src/components/Expandable/Expandable.stories.d.ts +6 -6
- package/dist/src/components/Field/Field.stories.d.ts +4 -4
- package/dist/src/components/Label/Label.stories.d.ts +2 -2
- package/dist/src/components/Loading/Loading.stories.d.ts +2 -2
- package/dist/src/components/LoadingBalls/LoadingBalls.stories.d.ts +2 -2
- package/dist/src/components/LoadingShapes/LoadingShapes.d.ts +2 -2
- package/dist/src/components/LoadingShapes/LoadingShapes.stories.d.ts +2 -2
- package/dist/src/components/Modal/Modal.stories.d.ts +3 -3
- package/dist/src/components/ModalOverlay/ModalOverlay.stories.d.ts +2 -2
- 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/Overlay/Overlay.stories.d.ts +2 -2
- package/dist/src/components/Paginator/Paginator.stories.d.ts +2 -2
- package/dist/src/components/PasswordInput/PasswordInput.stories.d.ts +2 -2
- package/dist/src/components/Popover/Popover.stories.d.ts +2 -2
- package/dist/src/components/PromoBanner/PromoBanner.stories.d.ts +3 -3
- package/dist/src/components/RadioButton/RadioButton.stories.d.ts +3 -3
- package/dist/src/components/SearchInput/SearchInput.stories.d.ts +3 -3
- package/dist/src/components/Select/Select.stories.d.ts +10 -10
- package/dist/src/components/SelectableButton/SelectableButton.stories.d.ts +4 -4
- package/dist/src/components/Shape/Shape.stories.d.ts +2 -2
- package/dist/src/components/SlidingPane/SlidingPane.stories.d.ts +2 -2
- package/dist/src/components/Stack/Stack.stories.d.ts +5 -5
- package/dist/src/components/Tabs/Tabs.stories.d.ts +3 -3
- package/dist/src/components/Tag/Tag.stories.d.ts +2 -2
- package/dist/src/components/Text/Text.stories.d.ts +5 -5
- package/dist/src/components/TextInput/TextInput.stories.d.ts +2 -2
- package/dist/src/components/Textarea/Textarea.stories.d.ts +2 -2
- package/dist/src/components/Toast/Toast.stories.d.ts +2 -2
- package/dist/src/components/VerticalDivider/VerticalDivider.stories.d.ts +3 -3
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/mixins/font-smoothing/font-smoothing.stories.d.ts +2 -2
- package/dist/src/mixins/overflow-scroll/overflow-scroll.stories.d.ts +3 -3
- package/dist/src/mixins/stack/stack.stories.d.ts +3 -3
- package/dist/src/mixins/thin-underline/thin-underline.stories.d.ts +2 -2
- package/dist/src/mixins/visually-hidden/visually-hidden.stories.d.ts +2 -2
- 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 +13 -13
- package/src/components/Expandable/Expandable.stories.tsx +1 -1
- package/src/components/ModalOverlay/ModalOverlay.test.tsx +2 -2
- package/src/components/NavigationPreventer/NavigationPreventer.tsx +17 -0
- package/src/components/NavigationPreventer/index.ts +1 -0
- package/src/components/NavigationPreventer/usePreventNavigation.ts +12 -0
- package/src/components/index.ts +1 -0
- package/src/hooks/useBreakpoint.ts +2 -2
- package/src/utilities/preventNavigation.ts +4 -0
package/dist/index.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 : {};
|
|
@@ -320,6 +320,8 @@ colors.colors = {
|
|
|
320
320
|
"money-good": "rgb(4, 108, 0)",
|
|
321
321
|
"fuchsia": "rgb(196, 76, 176)",
|
|
322
322
|
"dark-fuchsia": "rgb(180, 60, 160)",
|
|
323
|
+
"teal": "rgb(0, 111, 98)",
|
|
324
|
+
"ivory": "rgb(242, 233, 219)",
|
|
323
325
|
"klein-blue": "rgb(38, 48, 120)",
|
|
324
326
|
"brick": "rgb(147, 58, 32)",
|
|
325
327
|
"goldenrod": "rgb(186, 145, 46)",
|
|
@@ -340,7 +342,9 @@ colors.colors = {
|
|
|
340
342
|
"mint": "rgb(227, 251, 226)",
|
|
341
343
|
"money-good": "rgb(4, 108, 0)",
|
|
342
344
|
"fuchsia": "rgb(196, 76, 176)",
|
|
343
|
-
"dark-fuchsia": "rgb(180, 60, 160)"
|
|
345
|
+
"dark-fuchsia": "rgb(180, 60, 160)",
|
|
346
|
+
"teal": "rgb(0, 111, 98)",
|
|
347
|
+
"ivory": "rgb(242, 233, 219)"
|
|
344
348
|
},
|
|
345
349
|
"global": {
|
|
346
350
|
"klein-blue": "rgb(38, 48, 120)",
|
|
@@ -933,7 +937,7 @@ var colorStringExports = colorString.exports;
|
|
|
933
937
|
return [topY, rightX, bottom, left].reduce(function (acc, value) {
|
|
934
938
|
var _a;
|
|
935
939
|
if (value === undefined) return acc;
|
|
936
|
-
return [acc, (_a = space_1.space.scale[value]) !== null && _a !== void 0 ? _a : value].join(' ');
|
|
940
|
+
return [acc, (_a = space_1.space.scale[Number(value)]) !== null && _a !== void 0 ? _a : value].join(' ');
|
|
937
941
|
}, '');
|
|
938
942
|
};
|
|
939
943
|
exports.spacing = spacing;
|
|
@@ -995,62 +999,62 @@ var colorStringExports = colorString.exports;
|
|
|
995
999
|
__exportStar(helpers, exports);
|
|
996
1000
|
})(dist$4);
|
|
997
1001
|
|
|
998
|
-
function _iterableToArrayLimit(
|
|
999
|
-
var
|
|
1000
|
-
if (null !=
|
|
1001
|
-
var
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
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;
|
|
1008
1012
|
try {
|
|
1009
|
-
if (
|
|
1010
|
-
if (Object(
|
|
1011
|
-
|
|
1012
|
-
} else for (; !(
|
|
1013
|
-
} catch (
|
|
1014
|
-
|
|
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;
|
|
1015
1019
|
} finally {
|
|
1016
1020
|
try {
|
|
1017
|
-
if (!
|
|
1021
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
1018
1022
|
} finally {
|
|
1019
|
-
if (
|
|
1023
|
+
if (o) throw n;
|
|
1020
1024
|
}
|
|
1021
1025
|
}
|
|
1022
|
-
return
|
|
1026
|
+
return a;
|
|
1023
1027
|
}
|
|
1024
1028
|
}
|
|
1025
|
-
function ownKeys(
|
|
1026
|
-
var
|
|
1029
|
+
function ownKeys(e, r) {
|
|
1030
|
+
var t = Object.keys(e);
|
|
1027
1031
|
if (Object.getOwnPropertySymbols) {
|
|
1028
|
-
var
|
|
1029
|
-
|
|
1030
|
-
return Object.getOwnPropertyDescriptor(
|
|
1031
|
-
})),
|
|
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);
|
|
1032
1036
|
}
|
|
1033
|
-
return
|
|
1037
|
+
return t;
|
|
1034
1038
|
}
|
|
1035
|
-
function _objectSpread2(
|
|
1036
|
-
for (var
|
|
1037
|
-
var
|
|
1038
|
-
|
|
1039
|
-
_defineProperty$1(
|
|
1040
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
|
1041
|
-
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));
|
|
1042
1046
|
});
|
|
1043
1047
|
}
|
|
1044
|
-
return
|
|
1048
|
+
return e;
|
|
1045
1049
|
}
|
|
1046
|
-
function _typeof$1(
|
|
1050
|
+
function _typeof$1(o) {
|
|
1047
1051
|
"@babel/helpers - typeof";
|
|
1048
1052
|
|
|
1049
|
-
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (
|
|
1050
|
-
return typeof
|
|
1051
|
-
} : function (
|
|
1052
|
-
return
|
|
1053
|
-
}, _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);
|
|
1054
1058
|
}
|
|
1055
1059
|
function _defineProperty$1(obj, key, value) {
|
|
1056
1060
|
key = _toPropertyKey$1(key);
|
|
@@ -1324,7 +1328,9 @@ var stringifyProps = function stringifyProps(props) {
|
|
|
1324
1328
|
|
|
1325
1329
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1326
1330
|
|
|
1327
|
-
/* 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
|
|
1328
1334
|
var isEmpty = function isEmpty(obj) {
|
|
1329
1335
|
return Object.entries(obj || {}).length === 0;
|
|
1330
1336
|
};
|
|
@@ -1642,11 +1648,12 @@ var RemoveScroll = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
|
|
|
1642
1648
|
allowPinchZoom = props.allowPinchZoom,
|
|
1643
1649
|
_b = props.as,
|
|
1644
1650
|
Container = _b === void 0 ? 'div' : _b,
|
|
1645
|
-
|
|
1651
|
+
gapMode = props.gapMode,
|
|
1652
|
+
rest = __rest$a(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
|
|
1646
1653
|
var SideCar = sideCar;
|
|
1647
1654
|
var containerRef = useMergeRefs([ref, parentRef]);
|
|
1648
1655
|
var containerProps = _assign(_assign({}, rest), callbacks);
|
|
1649
|
-
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, {
|
|
1650
1657
|
sideCar: effectCar$1,
|
|
1651
1658
|
removeScrollBar: removeScrollBar,
|
|
1652
1659
|
shards: shards,
|
|
@@ -1654,13 +1661,14 @@ var RemoveScroll = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
|
|
|
1654
1661
|
inert: inert,
|
|
1655
1662
|
setCallbacks: setCallbacks,
|
|
1656
1663
|
allowPinchZoom: !!allowPinchZoom,
|
|
1657
|
-
lockRef: ref
|
|
1658
|
-
|
|
1664
|
+
lockRef: ref,
|
|
1665
|
+
gapMode: gapMode
|
|
1666
|
+
})), forwardProps ? ( /*#__PURE__*/React.cloneElement(React.Children.only(children), _assign(_assign({}, containerProps), {
|
|
1659
1667
|
ref: containerRef
|
|
1660
|
-
})) : /*#__PURE__*/React.createElement(Container, _assign({}, containerProps, {
|
|
1668
|
+
}))) : ( /*#__PURE__*/React.createElement(Container, _assign({}, containerProps, {
|
|
1661
1669
|
className: className,
|
|
1662
1670
|
ref: containerRef
|
|
1663
|
-
}), children));
|
|
1671
|
+
}), children)));
|
|
1664
1672
|
});
|
|
1665
1673
|
RemoveScroll.defaultProps = {
|
|
1666
1674
|
enabled: true,
|
|
@@ -1689,123 +1697,84 @@ function _extends() {
|
|
|
1689
1697
|
|
|
1690
1698
|
var propTypes = {exports: {}};
|
|
1691
1699
|
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
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
|
+
}
|
|
1695
1715
|
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
w = b ? Symbol["for"]("react.fundamental") : 60117,
|
|
1717
|
-
x = b ? Symbol["for"]("react.responder") : 60118,
|
|
1718
|
-
y = b ? Symbol["for"]("react.scope") : 60119;
|
|
1719
|
-
function z(a) {
|
|
1720
|
-
if ("object" === _typeof$1(a) && null !== a) {
|
|
1721
|
-
var u = a.$$typeof;
|
|
1722
|
-
switch (u) {
|
|
1723
|
-
case c:
|
|
1724
|
-
switch (a = a.type, a) {
|
|
1725
|
-
case l:
|
|
1726
|
-
case m:
|
|
1727
|
-
case e:
|
|
1728
|
-
case g:
|
|
1729
|
-
case f:
|
|
1730
|
-
case p:
|
|
1731
|
-
return a;
|
|
1732
|
-
default:
|
|
1733
|
-
switch (a = a && a.$$typeof, a) {
|
|
1734
|
-
case k:
|
|
1735
|
-
case n:
|
|
1736
|
-
case t:
|
|
1737
|
-
case r:
|
|
1738
|
-
case h:
|
|
1739
|
-
return a;
|
|
1740
|
-
default:
|
|
1741
|
-
return u;
|
|
1742
|
-
}
|
|
1743
|
-
}
|
|
1744
|
-
case d:
|
|
1745
|
-
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;
|
|
1746
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;
|
|
1747
1740
|
}
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
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
|
-
return z(a) === n;
|
|
1780
|
-
};
|
|
1781
|
-
reactIs_production_min.isFragment = function (a) {
|
|
1782
|
-
return z(a) === e;
|
|
1783
|
-
};
|
|
1784
|
-
reactIs_production_min.isLazy = function (a) {
|
|
1785
|
-
return z(a) === t;
|
|
1786
|
-
};
|
|
1787
|
-
reactIs_production_min.isMemo = function (a) {
|
|
1788
|
-
return z(a) === r;
|
|
1789
|
-
};
|
|
1790
|
-
reactIs_production_min.isPortal = function (a) {
|
|
1791
|
-
return z(a) === d;
|
|
1792
|
-
};
|
|
1793
|
-
reactIs_production_min.isProfiler = function (a) {
|
|
1794
|
-
return z(a) === g;
|
|
1795
|
-
};
|
|
1796
|
-
reactIs_production_min.isStrictMode = function (a) {
|
|
1797
|
-
return z(a) === f;
|
|
1798
|
-
};
|
|
1799
|
-
reactIs_production_min.isSuspense = function (a) {
|
|
1800
|
-
return z(a) === p;
|
|
1801
|
-
};
|
|
1802
|
-
reactIs_production_min.isValidElementType = function (a) {
|
|
1803
|
-
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;
|
|
1804
1772
|
};
|
|
1805
|
-
|
|
1806
|
-
return reactIs_production_min;
|
|
1773
|
+
return factoryWithThrowingShims;
|
|
1807
1774
|
}
|
|
1808
1775
|
|
|
1776
|
+
var reactIs = {exports: {}};
|
|
1777
|
+
|
|
1809
1778
|
var reactIs_development = {};
|
|
1810
1779
|
|
|
1811
1780
|
var hasRequiredReactIs_development;
|
|
@@ -1971,68 +1940,183 @@ function requireReactIs_development() {
|
|
|
1971
1940
|
return reactIs_development;
|
|
1972
1941
|
}
|
|
1973
1942
|
|
|
1974
|
-
var
|
|
1975
|
-
function requireReactIs() {
|
|
1976
|
-
if (hasRequiredReactIs) return reactIs.exports;
|
|
1977
|
-
hasRequiredReactIs = 1;
|
|
1978
|
-
if (process.env.NODE_ENV === 'production') {
|
|
1979
|
-
reactIs.exports = requireReactIs_production_min();
|
|
1980
|
-
} else {
|
|
1981
|
-
reactIs.exports = requireReactIs_development();
|
|
1982
|
-
}
|
|
1983
|
-
return reactIs.exports;
|
|
1984
|
-
}
|
|
1985
|
-
|
|
1986
|
-
/*
|
|
1987
|
-
object-assign
|
|
1988
|
-
(c) Sindre Sorhus
|
|
1989
|
-
@license MIT
|
|
1990
|
-
*/
|
|
1991
|
-
var objectAssign;
|
|
1992
|
-
var hasRequiredObjectAssign;
|
|
1993
|
-
function requireObjectAssign() {
|
|
1994
|
-
if (hasRequiredObjectAssign) return objectAssign;
|
|
1995
|
-
hasRequiredObjectAssign = 1;
|
|
1996
|
-
/* eslint-disable no-unused-vars */
|
|
1997
|
-
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
1998
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1999
|
-
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
2000
|
-
function toObject(val) {
|
|
2001
|
-
if (val === null || val === undefined) {
|
|
2002
|
-
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
2003
|
-
}
|
|
2004
|
-
return Object(val);
|
|
2005
|
-
}
|
|
2006
|
-
function shouldUseNative() {
|
|
2007
|
-
try {
|
|
2008
|
-
if (!Object.assign) {
|
|
2009
|
-
return false;
|
|
2010
|
-
}
|
|
2011
|
-
|
|
2012
|
-
// Detect buggy property enumeration order in older V8 versions.
|
|
2013
|
-
|
|
2014
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
2015
|
-
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
2016
|
-
test1[5] = 'de';
|
|
2017
|
-
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
2018
|
-
return false;
|
|
2019
|
-
}
|
|
2020
|
-
|
|
2021
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
2022
|
-
var test2 = {};
|
|
2023
|
-
for (var i = 0; i < 10; i++) {
|
|
2024
|
-
test2['_' + String.fromCharCode(i)] = i;
|
|
2025
|
-
}
|
|
2026
|
-
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
2027
|
-
return test2[n];
|
|
2028
|
-
});
|
|
2029
|
-
if (order2.join('') !== '0123456789') {
|
|
2030
|
-
return false;
|
|
2031
|
-
}
|
|
1943
|
+
var reactIs_production_min = {};
|
|
2032
1944
|
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
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) {
|
|
2036
2120
|
test3[letter] = letter;
|
|
2037
2121
|
});
|
|
2038
2122
|
if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') {
|
|
@@ -2069,22 +2153,6 @@ function requireObjectAssign() {
|
|
|
2069
2153
|
return objectAssign;
|
|
2070
2154
|
}
|
|
2071
2155
|
|
|
2072
|
-
/**
|
|
2073
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
2074
|
-
*
|
|
2075
|
-
* This source code is licensed under the MIT license found in the
|
|
2076
|
-
* LICENSE file in the root directory of this source tree.
|
|
2077
|
-
*/
|
|
2078
|
-
var ReactPropTypesSecret_1;
|
|
2079
|
-
var hasRequiredReactPropTypesSecret;
|
|
2080
|
-
function requireReactPropTypesSecret() {
|
|
2081
|
-
if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
|
|
2082
|
-
hasRequiredReactPropTypesSecret = 1;
|
|
2083
|
-
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
2084
|
-
ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
2085
|
-
return ReactPropTypesSecret_1;
|
|
2086
|
-
}
|
|
2087
|
-
|
|
2088
2156
|
var has;
|
|
2089
2157
|
var hasRequiredHas;
|
|
2090
2158
|
function requireHas() {
|
|
@@ -2725,66 +2793,6 @@ function requireFactoryWithTypeCheckers() {
|
|
|
2725
2793
|
return factoryWithTypeCheckers;
|
|
2726
2794
|
}
|
|
2727
2795
|
|
|
2728
|
-
/**
|
|
2729
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
2730
|
-
*
|
|
2731
|
-
* This source code is licensed under the MIT license found in the
|
|
2732
|
-
* LICENSE file in the root directory of this source tree.
|
|
2733
|
-
*/
|
|
2734
|
-
var factoryWithThrowingShims;
|
|
2735
|
-
var hasRequiredFactoryWithThrowingShims;
|
|
2736
|
-
function requireFactoryWithThrowingShims() {
|
|
2737
|
-
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
|
|
2738
|
-
hasRequiredFactoryWithThrowingShims = 1;
|
|
2739
|
-
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
2740
|
-
function emptyFunction() {}
|
|
2741
|
-
function emptyFunctionWithReset() {}
|
|
2742
|
-
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
2743
|
-
factoryWithThrowingShims = function factoryWithThrowingShims() {
|
|
2744
|
-
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
2745
|
-
if (secret === ReactPropTypesSecret) {
|
|
2746
|
-
// It is still safe when called from React.
|
|
2747
|
-
return;
|
|
2748
|
-
}
|
|
2749
|
-
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');
|
|
2750
|
-
err.name = 'Invariant Violation';
|
|
2751
|
-
throw err;
|
|
2752
|
-
}
|
|
2753
|
-
shim.isRequired = shim;
|
|
2754
|
-
function getShim() {
|
|
2755
|
-
return shim;
|
|
2756
|
-
}
|
|
2757
|
-
// Important!
|
|
2758
|
-
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
2759
|
-
var ReactPropTypes = {
|
|
2760
|
-
array: shim,
|
|
2761
|
-
bigint: shim,
|
|
2762
|
-
bool: shim,
|
|
2763
|
-
func: shim,
|
|
2764
|
-
number: shim,
|
|
2765
|
-
object: shim,
|
|
2766
|
-
string: shim,
|
|
2767
|
-
symbol: shim,
|
|
2768
|
-
any: shim,
|
|
2769
|
-
arrayOf: getShim,
|
|
2770
|
-
element: shim,
|
|
2771
|
-
elementType: shim,
|
|
2772
|
-
instanceOf: getShim,
|
|
2773
|
-
node: shim,
|
|
2774
|
-
objectOf: getShim,
|
|
2775
|
-
oneOf: getShim,
|
|
2776
|
-
oneOfType: getShim,
|
|
2777
|
-
shape: getShim,
|
|
2778
|
-
exact: getShim,
|
|
2779
|
-
checkPropTypes: emptyFunctionWithReset,
|
|
2780
|
-
resetWarningCache: emptyFunction
|
|
2781
|
-
};
|
|
2782
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
2783
|
-
return ReactPropTypes;
|
|
2784
|
-
};
|
|
2785
|
-
return factoryWithThrowingShims;
|
|
2786
|
-
}
|
|
2787
|
-
|
|
2788
2796
|
/**
|
|
2789
2797
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
2790
2798
|
*
|
|
@@ -2963,7 +2971,7 @@ var FocusLock = /*#__PURE__*/React.forwardRef(function FocusLockUI(props, parent
|
|
|
2963
2971
|
var hasLeadingGuards = noFocusGuards !== true;
|
|
2964
2972
|
var hasTailingGuards = hasLeadingGuards && noFocusGuards !== 'tail';
|
|
2965
2973
|
var mergedRef = useMergeRefs([parentRef, setObserveNode]);
|
|
2966
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, hasLeadingGuards && [
|
|
2974
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, hasLeadingGuards && [
|
|
2967
2975
|
// nearest focus guard
|
|
2968
2976
|
React.createElement("div", {
|
|
2969
2977
|
key: "guard-first",
|
|
@@ -3060,6 +3068,9 @@ function deferAction(action) {
|
|
|
3060
3068
|
var effectCar = createSidecarMedium();
|
|
3061
3069
|
var focusHiddenMarker = 'data-focus-on-hidden';
|
|
3062
3070
|
|
|
3071
|
+
var PREVENT_SCROLL = {
|
|
3072
|
+
preventScroll: true
|
|
3073
|
+
};
|
|
3063
3074
|
var FocusOn$1 = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
|
|
3064
3075
|
var _a = React.useState(false),
|
|
3065
3076
|
lockProps = _a[0],
|
|
@@ -3067,6 +3078,7 @@ var FocusOn$1 = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
|
|
|
3067
3078
|
var children = props.children,
|
|
3068
3079
|
autoFocus = props.autoFocus,
|
|
3069
3080
|
shards = props.shards,
|
|
3081
|
+
crossFrame = props.crossFrame,
|
|
3070
3082
|
_b = props.enabled,
|
|
3071
3083
|
enabled = _b === void 0 ? true : _b,
|
|
3072
3084
|
_c = props.scrollLock,
|
|
@@ -3084,7 +3096,7 @@ var FocusOn$1 = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
|
|
|
3084
3096
|
style = props.style,
|
|
3085
3097
|
as = props.as,
|
|
3086
3098
|
gapMode = props.gapMode,
|
|
3087
|
-
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"]);
|
|
3088
3100
|
var SideCar = sideCar;
|
|
3089
3101
|
var onActivation = lockProps.onActivation,
|
|
3090
3102
|
onDeactivation = lockProps.onDeactivation,
|
|
@@ -3106,20 +3118,19 @@ var FocusOn$1 = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
|
|
|
3106
3118
|
returnFocus: returnFocus,
|
|
3107
3119
|
autoFocus: autoFocus,
|
|
3108
3120
|
shards: shards,
|
|
3121
|
+
crossFrame: crossFrame,
|
|
3109
3122
|
onActivation: onActivation,
|
|
3110
3123
|
onDeactivation: onDeactivation,
|
|
3111
3124
|
className: className,
|
|
3112
3125
|
whiteList: shouldIgnore,
|
|
3113
3126
|
lockProps: appliedLockProps,
|
|
3114
|
-
focusOptions: preventScrollOnFocus ?
|
|
3115
|
-
preventScroll: true
|
|
3116
|
-
} : undefined,
|
|
3127
|
+
focusOptions: preventScrollOnFocus ? PREVENT_SCROLL : undefined,
|
|
3117
3128
|
as: RemoveScroll
|
|
3118
|
-
}, children), enabled && /*#__PURE__*/React.createElement(SideCar, _assign({}, rest, {
|
|
3129
|
+
}, children), enabled && ( /*#__PURE__*/React.createElement(SideCar, _assign({}, rest, {
|
|
3119
3130
|
sideCar: effectCar,
|
|
3120
3131
|
setLockProps: setLockProps,
|
|
3121
3132
|
shards: shards
|
|
3122
|
-
})));
|
|
3133
|
+
}))));
|
|
3123
3134
|
});
|
|
3124
3135
|
|
|
3125
3136
|
function _setPrototypeOf(o, p) {
|
|
@@ -3249,6 +3260,9 @@ var toArray = function toArray(a) {
|
|
|
3249
3260
|
var asArray = function asArray(a) {
|
|
3250
3261
|
return Array.isArray(a) ? a : [a];
|
|
3251
3262
|
};
|
|
3263
|
+
var getFirst = function getFirst(a) {
|
|
3264
|
+
return Array.isArray(a) ? a[0] : a;
|
|
3265
|
+
};
|
|
3252
3266
|
|
|
3253
3267
|
var isElementHidden = function isElementHidden(node) {
|
|
3254
3268
|
// we can measure only "elements"
|
|
@@ -3363,16 +3377,28 @@ var tabbables = ['button:enabled', 'select:enabled', 'textarea:enabled', 'input:
|
|
|
3363
3377
|
var queryTabbables = tabbables.join(',');
|
|
3364
3378
|
var queryGuardTabbables = "".concat(queryTabbables, ", [data-focus-guard]");
|
|
3365
3379
|
var getFocusablesWithShadowDom = function getFocusablesWithShadowDom(parent, withGuards) {
|
|
3366
|
-
|
|
3367
|
-
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) {
|
|
3368
3381
|
return acc.concat(child.matches(withGuards ? queryGuardTabbables : queryTabbables) ? [child] : [], getFocusablesWithShadowDom(child));
|
|
3369
3382
|
}, []);
|
|
3370
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
|
+
};
|
|
3371
3392
|
var getFocusables = function getFocusables(parents, withGuards) {
|
|
3372
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
|
+
}));
|
|
3373
3399
|
return acc.concat(
|
|
3374
3400
|
// add all tabbables inside and within shadow DOMs in DOM order
|
|
3375
|
-
|
|
3401
|
+
focusableWithIframes,
|
|
3376
3402
|
// add if node is tabbable itself
|
|
3377
3403
|
parent.parentNode ? toArray(parent.parentNode.querySelectorAll(queryTabbables)).filter(function (node) {
|
|
3378
3404
|
return node === parent;
|
|
@@ -3445,6 +3471,14 @@ var contains$1 = function contains(scope, element) {
|
|
|
3445
3471
|
return true;
|
|
3446
3472
|
}
|
|
3447
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
|
+
}
|
|
3448
3482
|
return contains(child, element);
|
|
3449
3483
|
});
|
|
3450
3484
|
}
|
|
@@ -3473,7 +3507,6 @@ var filterNested = function filterNested(nodes) {
|
|
|
3473
3507
|
/* eslint-enable */
|
|
3474
3508
|
}
|
|
3475
3509
|
}
|
|
3476
|
-
|
|
3477
3510
|
return nodes.filter(function (_, index) {
|
|
3478
3511
|
return !contained.has(index);
|
|
3479
3512
|
});
|
|
@@ -3500,34 +3533,51 @@ var getAllAffectedNodes = function getAllAffectedNodes(node) {
|
|
|
3500
3533
|
}, []);
|
|
3501
3534
|
};
|
|
3502
3535
|
|
|
3503
|
-
var
|
|
3504
|
-
|
|
3536
|
+
var safeProbe = function safeProbe(cb) {
|
|
3537
|
+
try {
|
|
3538
|
+
return cb();
|
|
3539
|
+
} catch (e) {
|
|
3540
|
+
return undefined;
|
|
3541
|
+
}
|
|
3505
3542
|
};
|
|
3543
|
+
|
|
3506
3544
|
/**
|
|
3507
3545
|
* returns active element from document or from nested shadowdoms
|
|
3508
3546
|
*/
|
|
3509
|
-
var getActiveElement = function getActiveElement() {
|
|
3510
|
-
|
|
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;
|
|
3511
3558
|
};
|
|
3512
3559
|
|
|
3513
|
-
var focusInFrame = function focusInFrame(frame) {
|
|
3514
|
-
return frame ===
|
|
3560
|
+
var focusInFrame = function focusInFrame(frame, activeElement) {
|
|
3561
|
+
return frame === activeElement;
|
|
3515
3562
|
};
|
|
3516
|
-
var focusInsideIframe = function focusInsideIframe(topNode) {
|
|
3563
|
+
var focusInsideIframe = function focusInsideIframe(topNode, activeElement) {
|
|
3517
3564
|
return Boolean(toArray(topNode.querySelectorAll('iframe')).some(function (node) {
|
|
3518
|
-
return focusInFrame(node);
|
|
3565
|
+
return focusInFrame(node, activeElement);
|
|
3519
3566
|
}));
|
|
3520
3567
|
};
|
|
3521
3568
|
/**
|
|
3522
3569
|
* @returns {Boolean} true, if the current focus is inside given node or nodes
|
|
3523
3570
|
*/
|
|
3524
|
-
var focusInside = function focusInside(topNode) {
|
|
3525
|
-
|
|
3571
|
+
var focusInside = function focusInside(topNode, activeElement) {
|
|
3572
|
+
// const activeElement = document && getActiveElement();
|
|
3573
|
+
if (activeElement === void 0) {
|
|
3574
|
+
activeElement = getActiveElement(getFirst(topNode).ownerDocument);
|
|
3575
|
+
}
|
|
3526
3576
|
if (!activeElement || activeElement.dataset && activeElement.dataset.focusGuard) {
|
|
3527
3577
|
return false;
|
|
3528
3578
|
}
|
|
3529
3579
|
return getAllAffectedNodes(topNode).some(function (node) {
|
|
3530
|
-
return contains$1(node, activeElement) || focusInsideIframe(node);
|
|
3580
|
+
return contains$1(node, activeElement) || focusInsideIframe(node, activeElement);
|
|
3531
3581
|
});
|
|
3532
3582
|
};
|
|
3533
3583
|
|
|
@@ -3536,13 +3586,16 @@ var focusInside = function focusInside(topNode) {
|
|
|
3536
3586
|
* ie contained inside a node focus-lock shall ignore
|
|
3537
3587
|
* @returns {boolean} focus is currently is in "allow" area
|
|
3538
3588
|
*/
|
|
3539
|
-
var focusIsHidden = function focusIsHidden() {
|
|
3540
|
-
|
|
3589
|
+
var focusIsHidden = function focusIsHidden(inDocument) {
|
|
3590
|
+
if (inDocument === void 0) {
|
|
3591
|
+
inDocument = document;
|
|
3592
|
+
}
|
|
3593
|
+
var activeElement = getActiveElement(inDocument);
|
|
3541
3594
|
if (!activeElement) {
|
|
3542
3595
|
return false;
|
|
3543
3596
|
}
|
|
3544
3597
|
// this does not support setting FOCUS_ALLOW within shadow dom
|
|
3545
|
-
return toArray(
|
|
3598
|
+
return toArray(inDocument.querySelectorAll("[".concat(FOCUS_ALLOW, "]"))).some(function (node) {
|
|
3546
3599
|
return contains$1(node, activeElement);
|
|
3547
3600
|
});
|
|
3548
3601
|
};
|
|
@@ -3760,7 +3813,7 @@ var reorderNodes = function reorderNodes(srcNodes, dstNodes) {
|
|
|
3760
3813
|
* @param lastNode
|
|
3761
3814
|
*/
|
|
3762
3815
|
var getFocusMerge = function getFocusMerge(topNode, lastNode) {
|
|
3763
|
-
var activeElement = document
|
|
3816
|
+
var activeElement = getActiveElement(asArray(topNode).length > 0 ? document : getFirst(topNode).ownerDocument);
|
|
3764
3817
|
var entries = getAllAffectedNodes(topNode).filter(isNotAGuard);
|
|
3765
3818
|
var commonParent = getTopCommonParent(activeElement || topNode, topNode, entries);
|
|
3766
3819
|
var visibilityCache = new Map();
|
|
@@ -3786,9 +3839,15 @@ var getFocusMerge = function getFocusMerge(topNode, lastNode) {
|
|
|
3786
3839
|
});
|
|
3787
3840
|
var newId = newFocus(innerNodes, outerNodes, activeElement, lastNode);
|
|
3788
3841
|
if (newId === NEW_FOCUS) {
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
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
|
+
}
|
|
3792
3851
|
}
|
|
3793
3852
|
if (newId === undefined) {
|
|
3794
3853
|
return newId;
|
|
@@ -4295,6 +4354,7 @@ var elementCouldBeHScrolled = function elementCouldBeHScrolled(node) {
|
|
|
4295
4354
|
return elementCanBeScrolled(node, 'overflowX');
|
|
4296
4355
|
};
|
|
4297
4356
|
var locationCouldBeScrolled = function locationCouldBeScrolled(axis, node) {
|
|
4357
|
+
var ownerDocument = node.ownerDocument;
|
|
4298
4358
|
var current = node;
|
|
4299
4359
|
do {
|
|
4300
4360
|
// Skip over shadow root
|
|
@@ -4311,7 +4371,7 @@ var locationCouldBeScrolled = function locationCouldBeScrolled(axis, node) {
|
|
|
4311
4371
|
}
|
|
4312
4372
|
}
|
|
4313
4373
|
current = current.parentNode;
|
|
4314
|
-
} while (current && current !==
|
|
4374
|
+
} while (current && current !== ownerDocument.body);
|
|
4315
4375
|
return false;
|
|
4316
4376
|
};
|
|
4317
4377
|
var getVScrollVariables = function getVScrollVariables(_a) {
|
|
@@ -4398,9 +4458,7 @@ function RemoveScrollSideCar(props) {
|
|
|
4398
4458
|
var touchStartRef = React.useRef([0, 0]);
|
|
4399
4459
|
var activeAxis = React.useRef();
|
|
4400
4460
|
var id = React.useState(idCounter++)[0];
|
|
4401
|
-
var Style = React.useState(
|
|
4402
|
-
return styleSingleton();
|
|
4403
|
-
})[0];
|
|
4461
|
+
var Style = React.useState(styleSingleton)[0];
|
|
4404
4462
|
var lastProps = React.useRef(props);
|
|
4405
4463
|
React.useEffect(function () {
|
|
4406
4464
|
lastProps.current = props;
|
|
@@ -4447,7 +4505,6 @@ function RemoveScrollSideCar(props) {
|
|
|
4447
4505
|
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
4448
4506
|
// other axis might be not scrollable
|
|
4449
4507
|
}
|
|
4450
|
-
|
|
4451
4508
|
if (!canBeScrolledInMainDirection) {
|
|
4452
4509
|
return false;
|
|
4453
4510
|
}
|
|
@@ -4538,7 +4595,7 @@ function RemoveScrollSideCar(props) {
|
|
|
4538
4595
|
return /*#__PURE__*/React.createElement(React.Fragment, null, inert ? /*#__PURE__*/React.createElement(Style, {
|
|
4539
4596
|
styles: generateStyle(id)
|
|
4540
4597
|
}) : null, removeScrollBar ? /*#__PURE__*/React.createElement(RemoveScrollBar, {
|
|
4541
|
-
gapMode:
|
|
4598
|
+
gapMode: props.gapMode
|
|
4542
4599
|
}) : null);
|
|
4543
4600
|
}
|
|
4544
4601
|
|
|
@@ -5213,6 +5270,7 @@ function _curryN(length, received, fn) {
|
|
|
5213
5270
|
var argsIdx = 0;
|
|
5214
5271
|
var left = length;
|
|
5215
5272
|
var combinedIdx = 0;
|
|
5273
|
+
var hasPlaceholder = false;
|
|
5216
5274
|
while (combinedIdx < received.length || argsIdx < arguments.length) {
|
|
5217
5275
|
var result;
|
|
5218
5276
|
if (combinedIdx < received.length && (!_isPlaceholder(received[combinedIdx]) || argsIdx >= arguments.length)) {
|
|
@@ -5224,10 +5282,12 @@ function _curryN(length, received, fn) {
|
|
|
5224
5282
|
combined[combinedIdx] = result;
|
|
5225
5283
|
if (!_isPlaceholder(result)) {
|
|
5226
5284
|
left -= 1;
|
|
5285
|
+
} else {
|
|
5286
|
+
hasPlaceholder = true;
|
|
5227
5287
|
}
|
|
5228
5288
|
combinedIdx += 1;
|
|
5229
5289
|
}
|
|
5230
|
-
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));
|
|
5231
5291
|
};
|
|
5232
5292
|
}
|
|
5233
5293
|
|
|
@@ -5281,6 +5341,7 @@ _curry2(function curryN(length, fn) {
|
|
|
5281
5341
|
}
|
|
5282
5342
|
return _arity(length, _curryN(length, [], fn));
|
|
5283
5343
|
});
|
|
5344
|
+
var curryN$1 = curryN;
|
|
5284
5345
|
|
|
5285
5346
|
/**
|
|
5286
5347
|
* Optimized internal three-arity curry function.
|
|
@@ -5439,15 +5500,16 @@ function _objectIs(a, b) {
|
|
|
5439
5500
|
}
|
|
5440
5501
|
var _objectIs$1 = typeof Object.is === 'function' ? Object.is : _objectIs;
|
|
5441
5502
|
|
|
5442
|
-
var toString$
|
|
5503
|
+
var toString$2 = Object.prototype.toString;
|
|
5443
5504
|
var _isArguments = /*#__PURE__*/
|
|
5444
5505
|
function () {
|
|
5445
|
-
return toString$
|
|
5446
|
-
return toString$
|
|
5506
|
+
return toString$2.call(arguments) === '[object Arguments]' ? function _isArguments(x) {
|
|
5507
|
+
return toString$2.call(x) === '[object Arguments]';
|
|
5447
5508
|
} : function _isArguments(x) {
|
|
5448
5509
|
return _has('callee', x);
|
|
5449
5510
|
};
|
|
5450
5511
|
}();
|
|
5512
|
+
var _isArguments$1 = _isArguments;
|
|
5451
5513
|
|
|
5452
5514
|
var hasEnumBug = ! /*#__PURE__*/
|
|
5453
5515
|
{
|
|
@@ -5499,7 +5561,7 @@ _curry1(function keys(obj) {
|
|
|
5499
5561
|
}
|
|
5500
5562
|
var prop, nIdx;
|
|
5501
5563
|
var ks = [];
|
|
5502
|
-
var checkArgsLength = hasArgsEnumBug && _isArguments(obj);
|
|
5564
|
+
var checkArgsLength = hasArgsEnumBug && _isArguments$1(obj);
|
|
5503
5565
|
for (prop in obj) {
|
|
5504
5566
|
if (_has(prop, obj) && (!checkArgsLength || prop !== 'length')) {
|
|
5505
5567
|
ks[ks.length] = prop;
|
|
@@ -5517,6 +5579,7 @@ _curry1(function keys(obj) {
|
|
|
5517
5579
|
}
|
|
5518
5580
|
return ks;
|
|
5519
5581
|
});
|
|
5582
|
+
var keys$1 = keys;
|
|
5520
5583
|
|
|
5521
5584
|
/**
|
|
5522
5585
|
* Gives a single-word string description of the (native) type of a value,
|
|
@@ -5541,6 +5604,7 @@ _curry1(function keys(obj) {
|
|
|
5541
5604
|
* R.type([]); //=> "Array"
|
|
5542
5605
|
* R.type(/[A-z]/); //=> "RegExp"
|
|
5543
5606
|
* R.type(() => {}); //=> "Function"
|
|
5607
|
+
* R.type(async () => {}); //=> "AsyncFunction"
|
|
5544
5608
|
* R.type(undefined); //=> "Undefined"
|
|
5545
5609
|
*/
|
|
5546
5610
|
|
|
@@ -5548,6 +5612,7 @@ var type = /*#__PURE__*/
|
|
|
5548
5612
|
_curry1(function type(val) {
|
|
5549
5613
|
return val === null ? 'Null' : val === undefined ? 'Undefined' : Object.prototype.toString.call(val).slice(8, -1);
|
|
5550
5614
|
});
|
|
5615
|
+
var type$1 = type;
|
|
5551
5616
|
|
|
5552
5617
|
/**
|
|
5553
5618
|
* private _uniqContentEquals function.
|
|
@@ -5575,8 +5640,8 @@ function _equals(a, b, stackA, stackB) {
|
|
|
5575
5640
|
if (_objectIs$1(a, b)) {
|
|
5576
5641
|
return true;
|
|
5577
5642
|
}
|
|
5578
|
-
var typeA = type(a);
|
|
5579
|
-
if (typeA !== type(b)) {
|
|
5643
|
+
var typeA = type$1(a);
|
|
5644
|
+
if (typeA !== type$1(b)) {
|
|
5580
5645
|
return false;
|
|
5581
5646
|
}
|
|
5582
5647
|
if (typeof a['fantasy-land/equals'] === 'function' || typeof b['fantasy-land/equals'] === 'function') {
|
|
@@ -5655,8 +5720,8 @@ function _equals(a, b, stackA, stackB) {
|
|
|
5655
5720
|
// Values of other types are only equal if identical.
|
|
5656
5721
|
return false;
|
|
5657
5722
|
}
|
|
5658
|
-
var keysA = keys(a);
|
|
5659
|
-
if (keysA.length !== keys(b).length) {
|
|
5723
|
+
var keysA = keys$1(a);
|
|
5724
|
+
if (keysA.length !== keys$1(b).length) {
|
|
5660
5725
|
return false;
|
|
5661
5726
|
}
|
|
5662
5727
|
var extendedStackA = stackA.concat([a]);
|
|
@@ -5702,6 +5767,7 @@ var equals = /*#__PURE__*/
|
|
|
5702
5767
|
_curry2(function equals(a, b) {
|
|
5703
5768
|
return _equals(a, b, [], []);
|
|
5704
5769
|
});
|
|
5770
|
+
var equals$1 = equals;
|
|
5705
5771
|
|
|
5706
5772
|
function _indexOf(list, a, idx) {
|
|
5707
5773
|
var inf, item; // Array.prototype.indexOf doesn't exist below IE9
|
|
@@ -5749,7 +5815,7 @@ function _indexOf(list, a, idx) {
|
|
|
5749
5815
|
} // anything else not covered above, defer to R.equals
|
|
5750
5816
|
|
|
5751
5817
|
while (idx < list.length) {
|
|
5752
|
-
if (equals(list[idx], a)) {
|
|
5818
|
+
if (equals$1(list[idx], a)) {
|
|
5753
5819
|
return idx;
|
|
5754
5820
|
}
|
|
5755
5821
|
idx += 1;
|
|
@@ -5789,6 +5855,7 @@ var _toISOString = typeof Date.prototype.toISOString === 'function' ? function _
|
|
|
5789
5855
|
} : function _toISOString(d) {
|
|
5790
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';
|
|
5791
5857
|
};
|
|
5858
|
+
var _toISOString$1 = _toISOString;
|
|
5792
5859
|
|
|
5793
5860
|
function _complement(f) {
|
|
5794
5861
|
return function () {
|
|
@@ -5879,10 +5946,11 @@ _dispatchable(['fantasy-land/filter', 'filter'], _xfilter, function (pred, filte
|
|
|
5879
5946
|
acc[key] = filterable[key];
|
|
5880
5947
|
}
|
|
5881
5948
|
return acc;
|
|
5882
|
-
}, {}, keys(filterable)) :
|
|
5949
|
+
}, {}, keys$1(filterable)) :
|
|
5883
5950
|
// else
|
|
5884
5951
|
_filter(pred, filterable);
|
|
5885
5952
|
}));
|
|
5953
|
+
var filter$1 = filter;
|
|
5886
5954
|
|
|
5887
5955
|
/**
|
|
5888
5956
|
* The complement of [`filter`](#filter).
|
|
@@ -5911,8 +5979,9 @@ _dispatchable(['fantasy-land/filter', 'filter'], _xfilter, function (pred, filte
|
|
|
5911
5979
|
|
|
5912
5980
|
var reject = /*#__PURE__*/
|
|
5913
5981
|
_curry2(function reject(pred, filterable) {
|
|
5914
|
-
return filter(_complement(pred), filterable);
|
|
5982
|
+
return filter$1(_complement(pred), filterable);
|
|
5915
5983
|
});
|
|
5984
|
+
var reject$1 = reject;
|
|
5916
5985
|
|
|
5917
5986
|
function _toString(x, seen) {
|
|
5918
5987
|
var recur = function recur(y) {
|
|
@@ -5929,13 +5998,13 @@ function _toString(x, seen) {
|
|
|
5929
5998
|
case '[object Arguments]':
|
|
5930
5999
|
return '(function() { return arguments; }(' + _map(recur, x).join(', ') + '))';
|
|
5931
6000
|
case '[object Array]':
|
|
5932
|
-
return '[' + _map(recur, x).concat(mapPairs(x, reject(function (k) {
|
|
6001
|
+
return '[' + _map(recur, x).concat(mapPairs(x, reject$1(function (k) {
|
|
5933
6002
|
return /^\d+$/.test(k);
|
|
5934
|
-
}, keys(x)))).join(', ') + ']';
|
|
6003
|
+
}, keys$1(x)))).join(', ') + ']';
|
|
5935
6004
|
case '[object Boolean]':
|
|
5936
6005
|
return _typeof$1(x) === 'object' ? 'new Boolean(' + recur(x.valueOf()) + ')' : x.toString();
|
|
5937
6006
|
case '[object Date]':
|
|
5938
|
-
return 'new Date(' + (isNaN(x.valueOf()) ? recur(NaN) : _quote(_toISOString(x))) + ')';
|
|
6007
|
+
return 'new Date(' + (isNaN(x.valueOf()) ? recur(NaN) : _quote(_toISOString$1(x))) + ')';
|
|
5939
6008
|
case '[object Map]':
|
|
5940
6009
|
return 'new Map(' + recur(Array.from(x)) + ')';
|
|
5941
6010
|
case '[object Null]':
|
|
@@ -5955,7 +6024,7 @@ function _toString(x, seen) {
|
|
|
5955
6024
|
return repr;
|
|
5956
6025
|
}
|
|
5957
6026
|
}
|
|
5958
|
-
return '{' + mapPairs(x, keys(x)).join(', ') + '}';
|
|
6027
|
+
return '{' + mapPairs(x, keys$1(x)).join(', ') + '}';
|
|
5959
6028
|
}
|
|
5960
6029
|
}
|
|
5961
6030
|
|
|
@@ -6000,6 +6069,7 @@ var toString = /*#__PURE__*/
|
|
|
6000
6069
|
_curry1(function toString(val) {
|
|
6001
6070
|
return _toString(val, []);
|
|
6002
6071
|
});
|
|
6072
|
+
var toString$1 = toString;
|
|
6003
6073
|
|
|
6004
6074
|
/**
|
|
6005
6075
|
* Returns the larger of its two arguments.
|
|
@@ -6038,13 +6108,14 @@ _curry2(function max(a, b) {
|
|
|
6038
6108
|
if (maxByType !== undefined) {
|
|
6039
6109
|
return maxByType === _typeof$1(a) ? a : b;
|
|
6040
6110
|
}
|
|
6041
|
-
var stringA = toString(a);
|
|
6042
|
-
var maxByStringValue = safeMax(stringA, toString(b));
|
|
6111
|
+
var stringA = toString$1(a);
|
|
6112
|
+
var maxByStringValue = safeMax(stringA, toString$1(b));
|
|
6043
6113
|
if (maxByStringValue !== undefined) {
|
|
6044
6114
|
return maxByStringValue === stringA ? a : b;
|
|
6045
6115
|
}
|
|
6046
6116
|
return b;
|
|
6047
6117
|
});
|
|
6118
|
+
var max$1 = max;
|
|
6048
6119
|
|
|
6049
6120
|
var XMap = /*#__PURE__*/
|
|
6050
6121
|
function () {
|
|
@@ -6064,6 +6135,7 @@ var _xmap = function _xmap(f) {
|
|
|
6064
6135
|
return new XMap(f, xf);
|
|
6065
6136
|
};
|
|
6066
6137
|
};
|
|
6138
|
+
var _xmap$1 = _xmap;
|
|
6067
6139
|
|
|
6068
6140
|
/**
|
|
6069
6141
|
* Takes a function and
|
|
@@ -6103,21 +6175,22 @@ var _xmap = function _xmap(f) {
|
|
|
6103
6175
|
|
|
6104
6176
|
var map = /*#__PURE__*/
|
|
6105
6177
|
_curry2( /*#__PURE__*/
|
|
6106
|
-
_dispatchable(['fantasy-land/map', 'map'], _xmap, function map(fn, functor) {
|
|
6178
|
+
_dispatchable(['fantasy-land/map', 'map'], _xmap$1, function map(fn, functor) {
|
|
6107
6179
|
switch (Object.prototype.toString.call(functor)) {
|
|
6108
6180
|
case '[object Function]':
|
|
6109
|
-
return curryN(functor.length, function () {
|
|
6181
|
+
return curryN$1(functor.length, function () {
|
|
6110
6182
|
return fn.call(this, functor.apply(this, arguments));
|
|
6111
6183
|
});
|
|
6112
6184
|
case '[object Object]':
|
|
6113
6185
|
return _arrayReduce(function (acc, key) {
|
|
6114
6186
|
acc[key] = fn(functor[key]);
|
|
6115
6187
|
return acc;
|
|
6116
|
-
}, {}, keys(functor));
|
|
6188
|
+
}, {}, keys$1(functor));
|
|
6117
6189
|
default:
|
|
6118
6190
|
return _map(fn, functor);
|
|
6119
6191
|
}
|
|
6120
6192
|
}));
|
|
6193
|
+
var map$1 = map;
|
|
6121
6194
|
|
|
6122
6195
|
function _isString(x) {
|
|
6123
6196
|
return Object.prototype.toString.call(x) === '[object String]';
|
|
@@ -6164,11 +6237,12 @@ _curry1(function isArrayLike(x) {
|
|
|
6164
6237
|
}
|
|
6165
6238
|
return false;
|
|
6166
6239
|
});
|
|
6240
|
+
var _isArrayLike$1 = _isArrayLike;
|
|
6167
6241
|
|
|
6168
6242
|
var symIterator = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator';
|
|
6169
6243
|
function _createReduce(arrayReduce, methodReduce, iterableReduce) {
|
|
6170
6244
|
return function _reduce(xf, acc, list) {
|
|
6171
|
-
if (_isArrayLike(list)) {
|
|
6245
|
+
if (_isArrayLike$1(list)) {
|
|
6172
6246
|
return arrayReduce(xf, acc, list);
|
|
6173
6247
|
}
|
|
6174
6248
|
if (list == null) {
|
|
@@ -6233,6 +6307,7 @@ _curry2(function bind(fn, thisObj) {
|
|
|
6233
6307
|
return fn.apply(thisObj, arguments);
|
|
6234
6308
|
});
|
|
6235
6309
|
});
|
|
6310
|
+
var bind$1 = bind;
|
|
6236
6311
|
|
|
6237
6312
|
function _xIterableReduce(xf, acc, iter) {
|
|
6238
6313
|
var step = iter.next();
|
|
@@ -6247,10 +6322,11 @@ function _xIterableReduce(xf, acc, iter) {
|
|
|
6247
6322
|
return xf['@@transducer/result'](acc);
|
|
6248
6323
|
}
|
|
6249
6324
|
function _xMethodReduce(xf, acc, obj, methodName) {
|
|
6250
|
-
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));
|
|
6251
6326
|
}
|
|
6252
6327
|
var _xReduce = /*#__PURE__*/
|
|
6253
6328
|
_createReduce(_xArrayReduce, _xMethodReduce, _xIterableReduce);
|
|
6329
|
+
var _xReduce$1 = _xReduce;
|
|
6254
6330
|
|
|
6255
6331
|
var XWrap = /*#__PURE__*/
|
|
6256
6332
|
function () {
|
|
@@ -6327,8 +6403,9 @@ function _xwrap(fn) {
|
|
|
6327
6403
|
|
|
6328
6404
|
var reduce = /*#__PURE__*/
|
|
6329
6405
|
_curry3(function (xf, acc, list) {
|
|
6330
|
-
return _xReduce(typeof xf === 'function' ? _xwrap(xf) : xf, acc, list);
|
|
6406
|
+
return _xReduce$1(typeof xf === 'function' ? _xwrap(xf) : xf, acc, list);
|
|
6331
6407
|
});
|
|
6408
|
+
var reduce$1 = reduce;
|
|
6332
6409
|
|
|
6333
6410
|
function _identity(x) {
|
|
6334
6411
|
return x;
|
|
@@ -6356,6 +6433,7 @@ function _identity(x) {
|
|
|
6356
6433
|
|
|
6357
6434
|
var identity = /*#__PURE__*/
|
|
6358
6435
|
_curry1(_identity);
|
|
6436
|
+
var identity$1 = identity;
|
|
6359
6437
|
|
|
6360
6438
|
/**
|
|
6361
6439
|
* Returns a function, `fn`, which encapsulates `if/else, if/else, ...` logic.
|
|
@@ -6391,7 +6469,7 @@ _curry1(_identity);
|
|
|
6391
6469
|
|
|
6392
6470
|
var cond = /*#__PURE__*/
|
|
6393
6471
|
_curry1(function cond(pairs) {
|
|
6394
|
-
var arity = reduce(max, 0, map(function (pair) {
|
|
6472
|
+
var arity = reduce$1(max$1, 0, map$1(function (pair) {
|
|
6395
6473
|
return pair[0].length;
|
|
6396
6474
|
}, pairs));
|
|
6397
6475
|
return _arity(arity, function () {
|
|
@@ -6571,12 +6649,14 @@ function hasOrAdd(item, shouldAdd, set) {
|
|
|
6571
6649
|
}
|
|
6572
6650
|
} // A simple Set type that honours R.equals semantics
|
|
6573
6651
|
|
|
6652
|
+
var _Set$1 = _Set;
|
|
6653
|
+
|
|
6574
6654
|
var XUniqBy = /*#__PURE__*/
|
|
6575
6655
|
function () {
|
|
6576
6656
|
function XUniqBy(f, xf) {
|
|
6577
6657
|
this.xf = xf;
|
|
6578
6658
|
this.f = f;
|
|
6579
|
-
this.set = new _Set();
|
|
6659
|
+
this.set = new _Set$1();
|
|
6580
6660
|
}
|
|
6581
6661
|
XUniqBy.prototype['@@transducer/init'] = _xfBase.init;
|
|
6582
6662
|
XUniqBy.prototype['@@transducer/result'] = _xfBase.result;
|
|
@@ -6615,7 +6695,7 @@ function _xuniqBy(f) {
|
|
|
6615
6695
|
var uniqBy = /*#__PURE__*/
|
|
6616
6696
|
_curry2( /*#__PURE__*/
|
|
6617
6697
|
_dispatchable([], _xuniqBy, function (fn, list) {
|
|
6618
|
-
var set = new _Set();
|
|
6698
|
+
var set = new _Set$1();
|
|
6619
6699
|
var result = [];
|
|
6620
6700
|
var idx = 0;
|
|
6621
6701
|
var appliedItem, item;
|
|
@@ -6650,7 +6730,7 @@ var uniqBy$1 = uniqBy;
|
|
|
6650
6730
|
*/
|
|
6651
6731
|
|
|
6652
6732
|
var uniq = /*#__PURE__*/
|
|
6653
|
-
uniqBy$1(identity);
|
|
6733
|
+
uniqBy$1(identity$1);
|
|
6654
6734
|
var uniq$1 = uniq;
|
|
6655
6735
|
|
|
6656
6736
|
function _isNumber(x) {
|
|
@@ -7163,239 +7243,513 @@ var ExceedConstrain = function ExceedConstrain(_ref) {
|
|
|
7163
7243
|
|
|
7164
7244
|
var reactInputMask = {exports: {}};
|
|
7165
7245
|
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
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
|
+
}
|
|
7181
7275
|
}
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
var
|
|
7188
|
-
|
|
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';
|
|
7189
7287
|
}
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
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
|
+
};
|
|
7195
7351
|
}
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
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;
|
|
7204
7363
|
}
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
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;
|
|
7208
7378
|
}
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
}))).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
|
+
}
|
|
7218
7387
|
}
|
|
7219
|
-
throw l.framesToPop = 1, l;
|
|
7220
7388
|
}
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7389
|
+
return target;
|
|
7390
|
+
};
|
|
7391
|
+
return _extends.apply(this, arguments);
|
|
7392
|
+
}
|
|
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];
|
|
7227
7407
|
}
|
|
7408
|
+
return target;
|
|
7228
7409
|
}
|
|
7229
|
-
function
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
if ("selectionStart" in e && "selectionEnd" in e) t = e.selectionStart, n = e.selectionEnd;else {
|
|
7233
|
-
var a = document.selection.createRange();
|
|
7234
|
-
a.parentElement() === e && (t = -a.moveStart("character", -e.value.length), n = -a.moveEnd("character", -e.value.length));
|
|
7410
|
+
function _assertThisInitialized(self) {
|
|
7411
|
+
if (self === void 0) {
|
|
7412
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
7235
7413
|
}
|
|
7236
|
-
return
|
|
7237
|
-
start: t,
|
|
7238
|
-
end: n,
|
|
7239
|
-
length: n - t
|
|
7240
|
-
};
|
|
7414
|
+
return self;
|
|
7241
7415
|
}
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
}
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
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
|
|
7260
7445
|
};
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
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
|
|
7271
7498
|
};
|
|
7272
7499
|
}
|
|
7273
|
-
|
|
7274
|
-
|
|
7500
|
+
|
|
7501
|
+
/* eslint no-use-before-define: ["error", { functions: false }] */
|
|
7502
|
+
function isPermanentCharacter(maskOptions, pos) {
|
|
7503
|
+
return maskOptions.permanents.indexOf(pos) !== -1;
|
|
7275
7504
|
}
|
|
7276
|
-
function isAllowedCharacter(
|
|
7277
|
-
var
|
|
7278
|
-
|
|
7279
|
-
if (!
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
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);
|
|
7283
7517
|
}
|
|
7284
|
-
function isEmpty(
|
|
7285
|
-
return
|
|
7286
|
-
return isPermanentCharacter(
|
|
7518
|
+
function isEmpty(maskOptions, value) {
|
|
7519
|
+
return value.split('').every(function (character, i) {
|
|
7520
|
+
return isPermanentCharacter(maskOptions, i) || !isAllowedCharacter(maskOptions, i, character);
|
|
7287
7521
|
});
|
|
7288
7522
|
}
|
|
7289
|
-
function getFilledLength(
|
|
7290
|
-
var
|
|
7291
|
-
|
|
7292
|
-
if (!
|
|
7293
|
-
|
|
7294
|
-
|
|
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;
|
|
7295
7531
|
}
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
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;
|
|
7300
7538
|
break;
|
|
7301
7539
|
}
|
|
7302
7540
|
}
|
|
7303
|
-
return
|
|
7541
|
+
return filledLength;
|
|
7304
7542
|
}
|
|
7305
|
-
function isFilled(
|
|
7306
|
-
return getFilledLength(
|
|
7543
|
+
function isFilled(maskOptions, value) {
|
|
7544
|
+
return getFilledLength(maskOptions, value) === maskOptions.mask.length;
|
|
7307
7545
|
}
|
|
7308
|
-
function formatValue(
|
|
7309
|
-
var
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
if (!
|
|
7313
|
-
|
|
7314
|
-
|
|
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;
|
|
7315
7559
|
}
|
|
7316
|
-
if (
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
}).join("");
|
|
7329
|
-
for (var u = i; u < l.length; u++) isPermanentCharacter(n, u) && (l[u] = "");
|
|
7330
|
-
return a = Math.max(s.length, a), l.splice(a, i - a), e = l.join(""), formatValue(n, e);
|
|
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;
|
|
7569
|
+
}
|
|
7570
|
+
}
|
|
7571
|
+
return value;
|
|
7331
7572
|
}
|
|
7332
|
-
function
|
|
7333
|
-
var
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
if (
|
|
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
|
+
}
|
|
7342
7585
|
}
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7586
|
+
start = Math.max(prefix.length, start);
|
|
7587
|
+
arrayValue.splice(start, end - start);
|
|
7588
|
+
value = arrayValue.join('');
|
|
7589
|
+
return formatValue(maskOptions, value);
|
|
7590
|
+
}
|
|
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('');
|
|
7346
7600
|
}
|
|
7347
|
-
function
|
|
7348
|
-
var
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
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;
|
|
7357
7649
|
}
|
|
7358
|
-
function
|
|
7359
|
-
|
|
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
|
+
}
|
|
7360
7681
|
return null;
|
|
7361
7682
|
}
|
|
7362
|
-
function getRightEditablePosition(
|
|
7363
|
-
|
|
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
|
+
}
|
|
7364
7690
|
return null;
|
|
7365
7691
|
}
|
|
7366
|
-
function getStringValue(
|
|
7367
|
-
return
|
|
7692
|
+
function getStringValue(value) {
|
|
7693
|
+
return !value && value !== 0 ? '' : value + '';
|
|
7368
7694
|
}
|
|
7369
|
-
function processChange(
|
|
7370
|
-
var
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
if (
|
|
7379
|
-
|
|
7380
|
-
|
|
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;
|
|
7381
7714
|
}
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
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,
|
|
7385
7739
|
selection: {
|
|
7386
|
-
start:
|
|
7387
|
-
end:
|
|
7740
|
+
start: cursorPosition,
|
|
7741
|
+
end: cursorPosition
|
|
7388
7742
|
}
|
|
7389
7743
|
};
|
|
7390
7744
|
}
|
|
7391
7745
|
function isWindowsPhoneBrowser() {
|
|
7392
|
-
var
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
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);
|
|
7396
7750
|
}
|
|
7397
|
-
function isFunction(
|
|
7398
|
-
return
|
|
7751
|
+
function isFunction(value) {
|
|
7752
|
+
return typeof value === 'function';
|
|
7399
7753
|
}
|
|
7400
7754
|
function getRequestAnimationFrame() {
|
|
7401
7755
|
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
|
|
@@ -7403,985 +7757,200 @@ function requireReactInputMask_production_min() {
|
|
|
7403
7757
|
function getCancelAnimationFrame() {
|
|
7404
7758
|
return window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame;
|
|
7405
7759
|
}
|
|
7406
|
-
function defer(
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
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);
|
|
7410
7771
|
}
|
|
7411
|
-
function cancelDefer(
|
|
7412
|
-
|
|
7772
|
+
function cancelDefer(deferId) {
|
|
7773
|
+
var cancelFn = getCancelAnimationFrame() || clearTimeout;
|
|
7774
|
+
cancelFn(deferId);
|
|
7413
7775
|
}
|
|
7414
|
-
var InputElement =
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
return e ? e.value : null;
|
|
7433
|
-
}, f.setInputValue = function (e) {
|
|
7434
|
-
var t = f.getInputDOMNode();
|
|
7435
|
-
t && (f.value = e, t.value = e);
|
|
7436
|
-
}, f.setCursorToEnd = function () {
|
|
7437
|
-
var e = getFilledLength(f.maskOptions, f.value),
|
|
7438
|
-
t = getRightEditablePosition(f.maskOptions, e);
|
|
7439
|
-
null !== t && f.setCursorPosition(t);
|
|
7440
|
-
}, f.setSelection = function (e, t, n) {
|
|
7441
|
-
void 0 === n && (n = {});
|
|
7442
|
-
var a = f.getInputDOMNode(),
|
|
7443
|
-
i = f.isFocused();
|
|
7444
|
-
a && i && (n.deferred || setInputSelection(a, e, t), null !== f.selectionDeferId && cancelDefer(f.selectionDeferId), f.selectionDeferId = defer(function () {
|
|
7445
|
-
f.selectionDeferId = null, setInputSelection(a, e, t);
|
|
7446
|
-
}), f.previousSelection = {
|
|
7447
|
-
start: e,
|
|
7448
|
-
end: t,
|
|
7449
|
-
length: Math.abs(t - e)
|
|
7450
|
-
});
|
|
7451
|
-
}, f.getSelection = function () {
|
|
7452
|
-
return getInputSelection(f.getInputDOMNode());
|
|
7453
|
-
}, f.getCursorPosition = function () {
|
|
7454
|
-
return f.getSelection().start;
|
|
7455
|
-
}, f.setCursorPosition = function (e) {
|
|
7456
|
-
f.setSelection(e, e);
|
|
7457
|
-
}, f.isFocused = function () {
|
|
7458
|
-
return f.focused;
|
|
7459
|
-
}, f.getBeforeMaskedValueChangeConfig = function () {
|
|
7460
|
-
var e = f.maskOptions,
|
|
7461
|
-
t = e.mask,
|
|
7462
|
-
n = e.maskChar,
|
|
7463
|
-
a = e.permanents,
|
|
7464
|
-
i = e.formatChars;
|
|
7465
|
-
return {
|
|
7466
|
-
mask: t,
|
|
7467
|
-
maskChar: n,
|
|
7468
|
-
permanents: a,
|
|
7469
|
-
alwaysShowMask: !!f.props.alwaysShowMask,
|
|
7470
|
-
formatChars: i
|
|
7471
|
-
};
|
|
7472
|
-
}, f.isInputAutofilled = function (e, t, n, a) {
|
|
7473
|
-
var i = f.getInputDOMNode();
|
|
7474
|
-
try {
|
|
7475
|
-
if (i.matches(":-webkit-autofill")) return !0;
|
|
7476
|
-
} catch (r) {}
|
|
7477
|
-
return !f.focused || a.end < n.length && t.end === e.length;
|
|
7478
|
-
}, f.onChange = function (e) {
|
|
7479
|
-
var t = _assertThisInitialized(_assertThisInitialized(f)).beforePasteState,
|
|
7480
|
-
n = _assertThisInitialized(_assertThisInitialized(f)).previousSelection,
|
|
7481
|
-
a = f.props.beforeMaskedValueChange,
|
|
7482
|
-
i = f.getInputValue(),
|
|
7483
|
-
r = f.value,
|
|
7484
|
-
o = f.getSelection();
|
|
7485
|
-
f.isInputAutofilled(i, o, r, n) && (r = formatValue(f.maskOptions, ""), n = {
|
|
7486
|
-
start: 0,
|
|
7487
|
-
end: 0,
|
|
7488
|
-
length: 0
|
|
7489
|
-
}), t && (n = t.selection, r = t.value, o = {
|
|
7490
|
-
start: n.start + i.length,
|
|
7491
|
-
end: n.start + i.length,
|
|
7492
|
-
length: 0
|
|
7493
|
-
}, i = r.slice(0, n.start) + i + r.slice(n.end), f.beforePasteState = null);
|
|
7494
|
-
var s = processChange(f.maskOptions, i, o, r, n),
|
|
7495
|
-
l = s.enteredString,
|
|
7496
|
-
u = s.selection,
|
|
7497
|
-
c = s.value;
|
|
7498
|
-
if (isFunction(a)) {
|
|
7499
|
-
var h = a({
|
|
7500
|
-
value: c,
|
|
7501
|
-
selection: u
|
|
7502
|
-
}, {
|
|
7503
|
-
value: r,
|
|
7504
|
-
selection: n
|
|
7505
|
-
}, l, f.getBeforeMaskedValueChangeConfig());
|
|
7506
|
-
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();
|
|
7507
7794
|
}
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
a = n.mask,
|
|
7515
|
-
i = n.prefix;
|
|
7516
|
-
if (f.focused = !0, f.mounted = !0, a) {
|
|
7517
|
-
if (f.value) getFilledLength(f.maskOptions, f.value) < f.maskOptions.mask.length && f.setCursorToEnd();else {
|
|
7518
|
-
var r = formatValue(f.maskOptions, i),
|
|
7519
|
-
o = formatValue(f.maskOptions, r),
|
|
7520
|
-
s = getFilledLength(f.maskOptions, o),
|
|
7521
|
-
l = getRightEditablePosition(f.maskOptions, s),
|
|
7522
|
-
u = {
|
|
7523
|
-
start: l,
|
|
7524
|
-
end: l
|
|
7525
|
-
};
|
|
7526
|
-
if (isFunction(t)) {
|
|
7527
|
-
var c = t({
|
|
7528
|
-
value: o,
|
|
7529
|
-
selection: u
|
|
7530
|
-
}, {
|
|
7531
|
-
value: f.value,
|
|
7532
|
-
selection: null
|
|
7533
|
-
}, null, f.getBeforeMaskedValueChangeConfig());
|
|
7534
|
-
o = c.value, u = c.selection;
|
|
7535
|
-
}
|
|
7536
|
-
var h = o !== f.getInputValue();
|
|
7537
|
-
h && f.setInputValue(o), h && isFunction(f.props.onChange) && f.props.onChange(e), f.setSelection(u.start, u.end);
|
|
7538
|
-
}
|
|
7539
|
-
f.runSaveSelectionLoop();
|
|
7795
|
+
};
|
|
7796
|
+
_this.stopSaveSelectionLoop = function () {
|
|
7797
|
+
if (_this.saveSelectionLoopDeferId !== null) {
|
|
7798
|
+
cancelDefer(_this.saveSelectionLoopDeferId);
|
|
7799
|
+
_this.saveSelectionLoopDeferId = null;
|
|
7800
|
+
_this.previousSelection = null;
|
|
7540
7801
|
}
|
|
7541
|
-
|
|
7542
|
-
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
if (f.stopSaveSelectionLoop(), f.focused = !1, n && !f.props.alwaysShowMask && isEmpty(f.maskOptions, f.value)) {
|
|
7546
|
-
var a = "";
|
|
7547
|
-
if (isFunction(t)) a = t({
|
|
7548
|
-
value: a,
|
|
7549
|
-
selection: null
|
|
7550
|
-
}, {
|
|
7551
|
-
value: f.value,
|
|
7552
|
-
selection: f.previousSelection
|
|
7553
|
-
}, null, f.getBeforeMaskedValueChangeConfig()).value;
|
|
7554
|
-
var i = a !== f.getInputValue();
|
|
7555
|
-
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;
|
|
7556
7806
|
}
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
var t = Math.abs(e.clientX - f.mouseDownX),
|
|
7564
|
-
n = Math.abs(e.clientY - f.mouseDownY),
|
|
7565
|
-
a = Math.max(t, n),
|
|
7566
|
-
i = new Date().getTime() - f.mouseDownTime;
|
|
7567
|
-
(a <= 10 && i <= 200 || a <= 5 && i <= 300) && f.setCursorToEnd();
|
|
7568
|
-
}
|
|
7569
|
-
};
|
|
7570
|
-
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;
|
|
7571
7813
|
}
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
}
|
|
7578
|
-
|
|
7579
|
-
null == f.props.children && isFunction(f.props.inputRef) && f.props.inputRef(e);
|
|
7814
|
+
if (input.nodeName !== 'INPUT') {
|
|
7815
|
+
input = input.querySelector('input');
|
|
7816
|
+
}
|
|
7817
|
+
if (!input) {
|
|
7818
|
+
throw new Error('react-input-mask: inputComponent doesn\'t contain input node');
|
|
7819
|
+
}
|
|
7820
|
+
return input;
|
|
7580
7821
|
};
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
r = e.beforeMaskedValueChange,
|
|
7586
|
-
o = e.defaultValue,
|
|
7587
|
-
s = e.value;
|
|
7588
|
-
f.maskOptions = parseMask(t, n, a), null == o && (o = ""), null == s && (s = o);
|
|
7589
|
-
var l = getStringValue(s);
|
|
7590
|
-
if (f.maskOptions.mask && (i || l) && (l = formatValue(f.maskOptions, l), isFunction(r))) {
|
|
7591
|
-
var u = e.value;
|
|
7592
|
-
null == e.value && (u = o), l = r({
|
|
7593
|
-
value: l,
|
|
7594
|
-
selection: null
|
|
7595
|
-
}, {
|
|
7596
|
-
value: u = getStringValue(u),
|
|
7597
|
-
selection: null
|
|
7598
|
-
}, null, f.getBeforeMaskedValueChangeConfig()).value;
|
|
7599
|
-
}
|
|
7600
|
-
return f.value = l, f;
|
|
7601
|
-
}
|
|
7602
|
-
_inheritsLoose(e, c);
|
|
7603
|
-
var t = e.prototype;
|
|
7604
|
-
return t.componentDidMount = function () {
|
|
7605
|
-
this.mounted = !0, this.getInputDOMNode() && (this.isWindowsPhoneBrowser = isWindowsPhoneBrowser(), this.maskOptions.mask && this.getInputValue() !== this.value && this.setInputValue(this.value));
|
|
7606
|
-
}, t.componentDidUpdate = function () {
|
|
7607
|
-
var e = this.previousSelection,
|
|
7608
|
-
t = this.props,
|
|
7609
|
-
n = t.beforeMaskedValueChange,
|
|
7610
|
-
a = t.alwaysShowMask,
|
|
7611
|
-
i = t.mask,
|
|
7612
|
-
r = t.maskChar,
|
|
7613
|
-
o = t.formatChars,
|
|
7614
|
-
s = this.maskOptions,
|
|
7615
|
-
l = a || this.isFocused(),
|
|
7616
|
-
u = null != this.props.value,
|
|
7617
|
-
c = u ? getStringValue(this.props.value) : this.value,
|
|
7618
|
-
h = e ? e.start : null;
|
|
7619
|
-
if (this.maskOptions = parseMask(i, r, o), this.maskOptions.mask) {
|
|
7620
|
-
!s.mask && this.isFocused() && this.runSaveSelectionLoop();
|
|
7621
|
-
var f = this.maskOptions.mask && this.maskOptions.mask !== s.mask;
|
|
7622
|
-
if (s.mask || u || (c = this.getInputValue()), (f || this.maskOptions.mask && (c || l)) && (c = formatValue(this.maskOptions, c)), f) {
|
|
7623
|
-
var p = getFilledLength(this.maskOptions, c);
|
|
7624
|
-
(null === h || p < h) && (h = isFilled(this.maskOptions, c) ? p : getRightEditablePosition(this.maskOptions, p));
|
|
7822
|
+
_this.getInputValue = function () {
|
|
7823
|
+
var input = _this.getInputDOMNode();
|
|
7824
|
+
if (!input) {
|
|
7825
|
+
return null;
|
|
7625
7826
|
}
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
var m = n({
|
|
7633
|
-
value: c,
|
|
7634
|
-
selection: d
|
|
7635
|
-
}, {
|
|
7636
|
-
value: this.value,
|
|
7637
|
-
selection: this.previousSelection
|
|
7638
|
-
}, null, this.getBeforeMaskedValueChangeConfig());
|
|
7639
|
-
c = m.value, d = m.selection;
|
|
7827
|
+
return input.value;
|
|
7828
|
+
};
|
|
7829
|
+
_this.setInputValue = function (value) {
|
|
7830
|
+
var input = _this.getInputDOMNode();
|
|
7831
|
+
if (!input) {
|
|
7832
|
+
return;
|
|
7640
7833
|
}
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
g ? (this.setInputValue(this.value), this.forceUpdate()) : f && this.forceUpdate();
|
|
7644
|
-
var v = !1;
|
|
7645
|
-
null != d.start && null != d.end && (v = !e || e.start !== d.start || e.end !== d.end), (v || g) && this.setSelection(d.start, d.end);
|
|
7646
|
-
} else s.mask && (this.stopSaveSelectionLoop(), this.forceUpdate());
|
|
7647
|
-
}, t.componentWillUnmount = function () {
|
|
7648
|
-
this.mounted = !1, null !== this.selectionDeferId && cancelDefer(this.selectionDeferId), this.stopSaveSelectionLoop();
|
|
7649
|
-
}, t.render = function () {
|
|
7650
|
-
var t,
|
|
7651
|
-
e = this.props,
|
|
7652
|
-
n = (e.mask, e.alwaysShowMask, e.maskChar, e.formatChars, e.inputRef, e.beforeMaskedValueChange, e.children),
|
|
7653
|
-
a = _objectWithoutPropertiesLoose(e, ["mask", "alwaysShowMask", "maskChar", "formatChars", "inputRef", "beforeMaskedValueChange", "children"]);
|
|
7654
|
-
if (n) {
|
|
7655
|
-
isFunction(n) || invariant_1(!1);
|
|
7656
|
-
var i = ["onChange", "onPaste", "onMouseDown", "onFocus", "onBlur", "value", "disabled", "readOnly"],
|
|
7657
|
-
r = _extends({}, a);
|
|
7658
|
-
i.forEach(function (e) {
|
|
7659
|
-
return delete r[e];
|
|
7660
|
-
}), t = n(r), i.filter(function (e) {
|
|
7661
|
-
return null != t.props[e] && t.props[e] !== a[e];
|
|
7662
|
-
}).length && invariant_1(!1);
|
|
7663
|
-
} else t = React.createElement("input", _extends({
|
|
7664
|
-
ref: this.handleRef
|
|
7665
|
-
}, a));
|
|
7666
|
-
var o = {
|
|
7667
|
-
onFocus: this.onFocus,
|
|
7668
|
-
onBlur: this.onBlur
|
|
7834
|
+
_this.value = value;
|
|
7835
|
+
input.value = value;
|
|
7669
7836
|
};
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
}
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
var hasRequiredInvariant;
|
|
7685
|
-
function requireInvariant() {
|
|
7686
|
-
if (hasRequiredInvariant) return invariant_1;
|
|
7687
|
-
hasRequiredInvariant = 1;
|
|
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)
|
|
7688
7851
|
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
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
|
|
7699
7864
|
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
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
|
|
7726
7908
|
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
var warning_1;
|
|
7734
|
-
var hasRequiredWarning;
|
|
7735
|
-
function requireWarning() {
|
|
7736
|
-
if (hasRequiredWarning) return warning_1;
|
|
7737
|
-
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
|
|
7738
7915
|
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
* same logic and follow the same code paths.
|
|
7744
|
-
*/
|
|
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
|
|
7745
7920
|
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
});
|
|
7759
|
-
if (typeof console !== 'undefined') {
|
|
7760
|
-
console.error(message);
|
|
7761
|
-
}
|
|
7762
|
-
try {
|
|
7763
|
-
// --- Welcome to debugging React ---
|
|
7764
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
7765
|
-
// to find the callsite that caused this warning to fire.
|
|
7766
|
-
throw new Error(message);
|
|
7767
|
-
} catch (x) {}
|
|
7768
|
-
};
|
|
7769
|
-
warning = function warning(condition, format, args) {
|
|
7770
|
-
var len = arguments.length;
|
|
7771
|
-
args = new Array(len > 2 ? len - 2 : 0);
|
|
7772
|
-
for (var key = 2; key < len; key++) {
|
|
7773
|
-
args[key - 2] = arguments[key];
|
|
7774
|
-
}
|
|
7775
|
-
if (format === undefined) {
|
|
7776
|
-
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
7777
|
-
}
|
|
7778
|
-
if (!condition) {
|
|
7779
|
-
printWarning.apply(null, [format].concat(args));
|
|
7780
|
-
}
|
|
7781
|
-
};
|
|
7782
|
-
}
|
|
7783
|
-
warning_1 = warning;
|
|
7784
|
-
return warning_1;
|
|
7785
|
-
}
|
|
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
|
|
7786
7933
|
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
}
|
|
7808
|
-
return obj;
|
|
7809
|
-
}
|
|
7810
|
-
function _extends() {
|
|
7811
|
-
_extends = Object.assign || function (target) {
|
|
7812
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
7813
|
-
var source = arguments[i];
|
|
7814
|
-
for (var key in source) {
|
|
7815
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
7816
|
-
target[key] = source[key];
|
|
7817
|
-
}
|
|
7818
|
-
}
|
|
7819
|
-
}
|
|
7820
|
-
return target;
|
|
7821
|
-
};
|
|
7822
|
-
return _extends.apply(this, arguments);
|
|
7823
|
-
}
|
|
7824
|
-
function _inheritsLoose(subClass, superClass) {
|
|
7825
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
7826
|
-
subClass.prototype.constructor = subClass;
|
|
7827
|
-
_defaults2(subClass, superClass);
|
|
7828
|
-
}
|
|
7829
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
7830
|
-
if (source == null) return {};
|
|
7831
|
-
var target = {};
|
|
7832
|
-
var sourceKeys = Object.keys(source);
|
|
7833
|
-
var key, i;
|
|
7834
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
7835
|
-
key = sourceKeys[i];
|
|
7836
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
7837
|
-
target[key] = source[key];
|
|
7838
|
-
}
|
|
7839
|
-
return target;
|
|
7840
|
-
}
|
|
7841
|
-
function _assertThisInitialized(self) {
|
|
7842
|
-
if (self === void 0) {
|
|
7843
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
7844
|
-
}
|
|
7845
|
-
return self;
|
|
7846
|
-
}
|
|
7847
|
-
function setInputSelection(input, start, end) {
|
|
7848
|
-
if ('selectionStart' in input && 'selectionEnd' in input) {
|
|
7849
|
-
input.selectionStart = start;
|
|
7850
|
-
input.selectionEnd = end;
|
|
7851
|
-
} else {
|
|
7852
|
-
var range = input.createTextRange();
|
|
7853
|
-
range.collapse(true);
|
|
7854
|
-
range.moveStart('character', start);
|
|
7855
|
-
range.moveEnd('character', end - start);
|
|
7856
|
-
range.select();
|
|
7857
|
-
}
|
|
7858
|
-
}
|
|
7859
|
-
function getInputSelection(input) {
|
|
7860
|
-
var start = 0;
|
|
7861
|
-
var end = 0;
|
|
7862
|
-
if ('selectionStart' in input && 'selectionEnd' in input) {
|
|
7863
|
-
start = input.selectionStart;
|
|
7864
|
-
end = input.selectionEnd;
|
|
7865
|
-
} else {
|
|
7866
|
-
var range = document.selection.createRange();
|
|
7867
|
-
if (range.parentElement() === input) {
|
|
7868
|
-
start = -range.moveStart('character', -input.value.length);
|
|
7869
|
-
end = -range.moveEnd('character', -input.value.length);
|
|
7870
|
-
}
|
|
7871
|
-
}
|
|
7872
|
-
return {
|
|
7873
|
-
start: start,
|
|
7874
|
-
end: end,
|
|
7875
|
-
length: end - start
|
|
7876
|
-
};
|
|
7877
|
-
}
|
|
7878
|
-
var defaultFormatChars = {
|
|
7879
|
-
'9': '[0-9]',
|
|
7880
|
-
'a': '[A-Za-z]',
|
|
7881
|
-
'*': '[A-Za-z0-9]'
|
|
7882
|
-
};
|
|
7883
|
-
var defaultMaskChar = '_';
|
|
7884
|
-
function parseMask(mask, maskChar, formatChars) {
|
|
7885
|
-
var parsedMaskString = '';
|
|
7886
|
-
var prefix = '';
|
|
7887
|
-
var lastEditablePosition = null;
|
|
7888
|
-
var permanents = [];
|
|
7889
|
-
if (maskChar === undefined) {
|
|
7890
|
-
maskChar = defaultMaskChar;
|
|
7891
|
-
}
|
|
7892
|
-
if (formatChars == null) {
|
|
7893
|
-
formatChars = defaultFormatChars;
|
|
7894
|
-
}
|
|
7895
|
-
if (!mask || typeof mask !== 'string') {
|
|
7896
|
-
return {
|
|
7897
|
-
maskChar: maskChar,
|
|
7898
|
-
formatChars: formatChars,
|
|
7899
|
-
mask: null,
|
|
7900
|
-
prefix: null,
|
|
7901
|
-
lastEditablePosition: null,
|
|
7902
|
-
permanents: []
|
|
7903
|
-
};
|
|
7904
|
-
}
|
|
7905
|
-
var isPermanent = false;
|
|
7906
|
-
mask.split('').forEach(function (character) {
|
|
7907
|
-
if (!isPermanent && character === '\\') {
|
|
7908
|
-
isPermanent = true;
|
|
7909
|
-
} else {
|
|
7910
|
-
if (isPermanent || !formatChars[character]) {
|
|
7911
|
-
permanents.push(parsedMaskString.length);
|
|
7912
|
-
if (parsedMaskString.length === permanents.length - 1) {
|
|
7913
|
-
prefix += character;
|
|
7914
|
-
}
|
|
7915
|
-
} else {
|
|
7916
|
-
lastEditablePosition = parsedMaskString.length + 1;
|
|
7917
|
-
}
|
|
7918
|
-
parsedMaskString += character;
|
|
7919
|
-
isPermanent = false;
|
|
7920
|
-
}
|
|
7921
|
-
});
|
|
7922
|
-
return {
|
|
7923
|
-
maskChar: maskChar,
|
|
7924
|
-
formatChars: formatChars,
|
|
7925
|
-
prefix: prefix,
|
|
7926
|
-
mask: parsedMaskString,
|
|
7927
|
-
lastEditablePosition: lastEditablePosition,
|
|
7928
|
-
permanents: permanents
|
|
7929
|
-
};
|
|
7930
|
-
}
|
|
7931
|
-
|
|
7932
|
-
/* eslint no-use-before-define: ["error", { functions: false }] */
|
|
7933
|
-
function isPermanentCharacter(maskOptions, pos) {
|
|
7934
|
-
return maskOptions.permanents.indexOf(pos) !== -1;
|
|
7935
|
-
}
|
|
7936
|
-
function isAllowedCharacter(maskOptions, pos, character) {
|
|
7937
|
-
var mask = maskOptions.mask,
|
|
7938
|
-
formatChars = maskOptions.formatChars;
|
|
7939
|
-
if (!character) {
|
|
7940
|
-
return false;
|
|
7941
|
-
}
|
|
7942
|
-
if (isPermanentCharacter(maskOptions, pos)) {
|
|
7943
|
-
return mask[pos] === character;
|
|
7944
|
-
}
|
|
7945
|
-
var ruleChar = mask[pos];
|
|
7946
|
-
var charRule = formatChars[ruleChar];
|
|
7947
|
-
return new RegExp(charRule).test(character);
|
|
7948
|
-
}
|
|
7949
|
-
function isEmpty(maskOptions, value) {
|
|
7950
|
-
return value.split('').every(function (character, i) {
|
|
7951
|
-
return isPermanentCharacter(maskOptions, i) || !isAllowedCharacter(maskOptions, i, character);
|
|
7952
|
-
});
|
|
7953
|
-
}
|
|
7954
|
-
function getFilledLength(maskOptions, value) {
|
|
7955
|
-
var maskChar = maskOptions.maskChar,
|
|
7956
|
-
prefix = maskOptions.prefix;
|
|
7957
|
-
if (!maskChar) {
|
|
7958
|
-
while (value.length > prefix.length && isPermanentCharacter(maskOptions, value.length - 1)) {
|
|
7959
|
-
value = value.slice(0, value.length - 1);
|
|
7960
|
-
}
|
|
7961
|
-
return value.length;
|
|
7962
|
-
}
|
|
7963
|
-
var filledLength = prefix.length;
|
|
7964
|
-
for (var i = value.length; i >= prefix.length; i--) {
|
|
7965
|
-
var character = value[i];
|
|
7966
|
-
var isEnteredCharacter = !isPermanentCharacter(maskOptions, i) && isAllowedCharacter(maskOptions, i, character);
|
|
7967
|
-
if (isEnteredCharacter) {
|
|
7968
|
-
filledLength = i + 1;
|
|
7969
|
-
break;
|
|
7970
|
-
}
|
|
7971
|
-
}
|
|
7972
|
-
return filledLength;
|
|
7973
|
-
}
|
|
7974
|
-
function isFilled(maskOptions, value) {
|
|
7975
|
-
return getFilledLength(maskOptions, value) === maskOptions.mask.length;
|
|
7976
|
-
}
|
|
7977
|
-
function formatValue(maskOptions, value) {
|
|
7978
|
-
var maskChar = maskOptions.maskChar,
|
|
7979
|
-
mask = maskOptions.mask,
|
|
7980
|
-
prefix = maskOptions.prefix;
|
|
7981
|
-
if (!maskChar) {
|
|
7982
|
-
value = insertString(maskOptions, '', value, 0);
|
|
7983
|
-
if (value.length < prefix.length) {
|
|
7984
|
-
value = prefix;
|
|
7985
|
-
}
|
|
7986
|
-
while (value.length < mask.length && isPermanentCharacter(maskOptions, value.length)) {
|
|
7987
|
-
value += mask[value.length];
|
|
7988
|
-
}
|
|
7989
|
-
return value;
|
|
7990
|
-
}
|
|
7991
|
-
if (value) {
|
|
7992
|
-
var emptyValue = formatValue(maskOptions, '');
|
|
7993
|
-
return insertString(maskOptions, emptyValue, value, 0);
|
|
7994
|
-
}
|
|
7995
|
-
for (var i = 0; i < mask.length; i++) {
|
|
7996
|
-
if (isPermanentCharacter(maskOptions, i)) {
|
|
7997
|
-
value += mask[i];
|
|
7998
|
-
} else {
|
|
7999
|
-
value += maskChar;
|
|
8000
|
-
}
|
|
8001
|
-
}
|
|
8002
|
-
return value;
|
|
8003
|
-
}
|
|
8004
|
-
function clearRange(maskOptions, value, start, len) {
|
|
8005
|
-
var end = start + len;
|
|
8006
|
-
var maskChar = maskOptions.maskChar,
|
|
8007
|
-
mask = maskOptions.mask,
|
|
8008
|
-
prefix = maskOptions.prefix;
|
|
8009
|
-
var arrayValue = value.split('');
|
|
8010
|
-
if (!maskChar) {
|
|
8011
|
-
// remove any permanent chars after clear range, they will be added back by formatValue
|
|
8012
|
-
for (var i = end; i < arrayValue.length; i++) {
|
|
8013
|
-
if (isPermanentCharacter(maskOptions, i)) {
|
|
8014
|
-
arrayValue[i] = '';
|
|
8015
|
-
}
|
|
8016
|
-
}
|
|
8017
|
-
start = Math.max(prefix.length, start);
|
|
8018
|
-
arrayValue.splice(start, end - start);
|
|
8019
|
-
value = arrayValue.join('');
|
|
8020
|
-
return formatValue(maskOptions, value);
|
|
8021
|
-
}
|
|
8022
|
-
return arrayValue.map(function (character, i) {
|
|
8023
|
-
if (i < start || i >= end) {
|
|
8024
|
-
return character;
|
|
8025
|
-
}
|
|
8026
|
-
if (isPermanentCharacter(maskOptions, i)) {
|
|
8027
|
-
return mask[i];
|
|
8028
|
-
}
|
|
8029
|
-
return maskChar;
|
|
8030
|
-
}).join('');
|
|
8031
|
-
}
|
|
8032
|
-
function insertString(maskOptions, value, insertStr, insertPosition) {
|
|
8033
|
-
var mask = maskOptions.mask,
|
|
8034
|
-
maskChar = maskOptions.maskChar,
|
|
8035
|
-
prefix = maskOptions.prefix;
|
|
8036
|
-
var arrayInsertStr = insertStr.split('');
|
|
8037
|
-
var isInputFilled = isFilled(maskOptions, value);
|
|
8038
|
-
var isUsablePosition = function isUsablePosition(pos, character) {
|
|
8039
|
-
return !isPermanentCharacter(maskOptions, pos) || character === mask[pos];
|
|
8040
|
-
};
|
|
8041
|
-
var isUsableCharacter = function isUsableCharacter(character, pos) {
|
|
8042
|
-
return !maskChar || !isPermanentCharacter(maskOptions, pos) || character !== maskChar;
|
|
8043
|
-
};
|
|
8044
|
-
if (!maskChar && insertPosition > value.length) {
|
|
8045
|
-
value += mask.slice(value.length, insertPosition);
|
|
8046
|
-
}
|
|
8047
|
-
arrayInsertStr.every(function (insertCharacter) {
|
|
8048
|
-
while (!isUsablePosition(insertPosition, insertCharacter)) {
|
|
8049
|
-
if (insertPosition >= value.length) {
|
|
8050
|
-
value += mask[insertPosition];
|
|
8051
|
-
}
|
|
8052
|
-
if (!isUsableCharacter(insertCharacter, insertPosition)) {
|
|
8053
|
-
return true;
|
|
8054
|
-
}
|
|
8055
|
-
insertPosition++; // stop iteration if maximum value length reached
|
|
8056
|
-
|
|
8057
|
-
if (insertPosition >= mask.length) {
|
|
8058
|
-
return false;
|
|
8059
|
-
}
|
|
8060
|
-
}
|
|
8061
|
-
var isAllowed = isAllowedCharacter(maskOptions, insertPosition, insertCharacter) || insertCharacter === maskChar;
|
|
8062
|
-
if (!isAllowed) {
|
|
8063
|
-
return true;
|
|
8064
|
-
}
|
|
8065
|
-
if (insertPosition < value.length) {
|
|
8066
|
-
if (maskChar || isInputFilled || insertPosition < prefix.length) {
|
|
8067
|
-
value = value.slice(0, insertPosition) + insertCharacter + value.slice(insertPosition + 1);
|
|
8068
|
-
} else {
|
|
8069
|
-
value = value.slice(0, insertPosition) + insertCharacter + value.slice(insertPosition);
|
|
8070
|
-
value = formatValue(maskOptions, value);
|
|
8071
|
-
}
|
|
8072
|
-
} else if (!maskChar) {
|
|
8073
|
-
value += insertCharacter;
|
|
8074
|
-
}
|
|
8075
|
-
insertPosition++; // stop iteration if maximum value length reached
|
|
8076
|
-
|
|
8077
|
-
return insertPosition < mask.length;
|
|
8078
|
-
});
|
|
8079
|
-
return value;
|
|
8080
|
-
}
|
|
8081
|
-
function getInsertStringLength(maskOptions, value, insertStr, insertPosition) {
|
|
8082
|
-
var mask = maskOptions.mask,
|
|
8083
|
-
maskChar = maskOptions.maskChar;
|
|
8084
|
-
var arrayInsertStr = insertStr.split('');
|
|
8085
|
-
var initialInsertPosition = insertPosition;
|
|
8086
|
-
var isUsablePosition = function isUsablePosition(pos, character) {
|
|
8087
|
-
return !isPermanentCharacter(maskOptions, pos) || character === mask[pos];
|
|
8088
|
-
};
|
|
8089
|
-
arrayInsertStr.every(function (insertCharacter) {
|
|
8090
|
-
while (!isUsablePosition(insertPosition, insertCharacter)) {
|
|
8091
|
-
insertPosition++; // stop iteration if maximum value length reached
|
|
8092
|
-
|
|
8093
|
-
if (insertPosition >= mask.length) {
|
|
8094
|
-
return false;
|
|
8095
|
-
}
|
|
8096
|
-
}
|
|
8097
|
-
var isAllowed = isAllowedCharacter(maskOptions, insertPosition, insertCharacter) || insertCharacter === maskChar;
|
|
8098
|
-
if (isAllowed) {
|
|
8099
|
-
insertPosition++;
|
|
8100
|
-
} // stop iteration if maximum value length reached
|
|
8101
|
-
|
|
8102
|
-
return insertPosition < mask.length;
|
|
8103
|
-
});
|
|
8104
|
-
return insertPosition - initialInsertPosition;
|
|
8105
|
-
}
|
|
8106
|
-
function getLeftEditablePosition(maskOptions, pos) {
|
|
8107
|
-
for (var i = pos; i >= 0; --i) {
|
|
8108
|
-
if (!isPermanentCharacter(maskOptions, i)) {
|
|
8109
|
-
return i;
|
|
8110
|
-
}
|
|
8111
|
-
}
|
|
8112
|
-
return null;
|
|
8113
|
-
}
|
|
8114
|
-
function getRightEditablePosition(maskOptions, pos) {
|
|
8115
|
-
var mask = maskOptions.mask;
|
|
8116
|
-
for (var i = pos; i < mask.length; ++i) {
|
|
8117
|
-
if (!isPermanentCharacter(maskOptions, i)) {
|
|
8118
|
-
return i;
|
|
8119
|
-
}
|
|
8120
|
-
}
|
|
8121
|
-
return null;
|
|
8122
|
-
}
|
|
8123
|
-
function getStringValue(value) {
|
|
8124
|
-
return !value && value !== 0 ? '' : value + '';
|
|
8125
|
-
}
|
|
8126
|
-
function processChange(maskOptions, value, selection, previousValue, previousSelection) {
|
|
8127
|
-
var mask = maskOptions.mask,
|
|
8128
|
-
prefix = maskOptions.prefix,
|
|
8129
|
-
lastEditablePosition = maskOptions.lastEditablePosition;
|
|
8130
|
-
var newValue = value;
|
|
8131
|
-
var enteredString = '';
|
|
8132
|
-
var formattedEnteredStringLength = 0;
|
|
8133
|
-
var removedLength = 0;
|
|
8134
|
-
var cursorPosition = Math.min(previousSelection.start, selection.start);
|
|
8135
|
-
if (selection.end > previousSelection.start) {
|
|
8136
|
-
enteredString = newValue.slice(previousSelection.start, selection.end);
|
|
8137
|
-
formattedEnteredStringLength = getInsertStringLength(maskOptions, previousValue, enteredString, cursorPosition);
|
|
8138
|
-
if (!formattedEnteredStringLength) {
|
|
8139
|
-
removedLength = 0;
|
|
8140
|
-
} else {
|
|
8141
|
-
removedLength = previousSelection.length;
|
|
8142
|
-
}
|
|
8143
|
-
} else if (newValue.length < previousValue.length) {
|
|
8144
|
-
removedLength = previousValue.length - newValue.length;
|
|
8145
|
-
}
|
|
8146
|
-
newValue = previousValue;
|
|
8147
|
-
if (removedLength) {
|
|
8148
|
-
if (removedLength === 1 && !previousSelection.length) {
|
|
8149
|
-
var deleteFromRight = previousSelection.start === selection.start;
|
|
8150
|
-
cursorPosition = deleteFromRight ? getRightEditablePosition(maskOptions, selection.start) : getLeftEditablePosition(maskOptions, selection.start);
|
|
8151
|
-
}
|
|
8152
|
-
newValue = clearRange(maskOptions, newValue, cursorPosition, removedLength);
|
|
8153
|
-
}
|
|
8154
|
-
newValue = insertString(maskOptions, newValue, enteredString, cursorPosition);
|
|
8155
|
-
cursorPosition = cursorPosition + formattedEnteredStringLength;
|
|
8156
|
-
if (cursorPosition >= mask.length) {
|
|
8157
|
-
cursorPosition = mask.length;
|
|
8158
|
-
} else if (cursorPosition < prefix.length && !formattedEnteredStringLength) {
|
|
8159
|
-
cursorPosition = prefix.length;
|
|
8160
|
-
} else if (cursorPosition >= prefix.length && cursorPosition < lastEditablePosition && formattedEnteredStringLength) {
|
|
8161
|
-
cursorPosition = getRightEditablePosition(maskOptions, cursorPosition);
|
|
8162
|
-
}
|
|
8163
|
-
newValue = formatValue(maskOptions, newValue);
|
|
8164
|
-
if (!enteredString) {
|
|
8165
|
-
enteredString = null;
|
|
8166
|
-
}
|
|
8167
|
-
return {
|
|
8168
|
-
value: newValue,
|
|
8169
|
-
enteredString: enteredString,
|
|
8170
|
-
selection: {
|
|
8171
|
-
start: cursorPosition,
|
|
8172
|
-
end: cursorPosition
|
|
8173
|
-
}
|
|
8174
|
-
};
|
|
8175
|
-
}
|
|
8176
|
-
function isWindowsPhoneBrowser() {
|
|
8177
|
-
var windows = new RegExp('windows', 'i');
|
|
8178
|
-
var phone = new RegExp('phone', 'i');
|
|
8179
|
-
var ua = navigator.userAgent;
|
|
8180
|
-
return windows.test(ua) && phone.test(ua);
|
|
8181
|
-
}
|
|
8182
|
-
function isFunction(value) {
|
|
8183
|
-
return typeof value === 'function';
|
|
8184
|
-
}
|
|
8185
|
-
function getRequestAnimationFrame() {
|
|
8186
|
-
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
|
|
8187
|
-
}
|
|
8188
|
-
function getCancelAnimationFrame() {
|
|
8189
|
-
return window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame;
|
|
8190
|
-
}
|
|
8191
|
-
function defer(fn) {
|
|
8192
|
-
var hasCancelAnimationFrame = !!getCancelAnimationFrame();
|
|
8193
|
-
var deferFn;
|
|
8194
|
-
if (hasCancelAnimationFrame) {
|
|
8195
|
-
deferFn = getRequestAnimationFrame();
|
|
8196
|
-
} else {
|
|
8197
|
-
deferFn = function deferFn() {
|
|
8198
|
-
return setTimeout(fn, 1000 / 60);
|
|
8199
|
-
};
|
|
8200
|
-
}
|
|
8201
|
-
return deferFn(fn);
|
|
8202
|
-
}
|
|
8203
|
-
function cancelDefer(deferId) {
|
|
8204
|
-
var cancelFn = getCancelAnimationFrame() || clearTimeout;
|
|
8205
|
-
cancelFn(deferId);
|
|
8206
|
-
}
|
|
8207
|
-
var InputElement = /*#__PURE__*/
|
|
8208
|
-
function (_React$Component) {
|
|
8209
|
-
_inheritsLoose(InputElement, _React$Component);
|
|
8210
|
-
function InputElement(props) {
|
|
8211
|
-
var _this;
|
|
8212
|
-
_this = _React$Component.call(this, props) || this;
|
|
8213
|
-
_this.focused = false;
|
|
8214
|
-
_this.mounted = false;
|
|
8215
|
-
_this.previousSelection = null;
|
|
8216
|
-
_this.selectionDeferId = null;
|
|
8217
|
-
_this.saveSelectionLoopDeferId = null;
|
|
8218
|
-
_this.saveSelectionLoop = function () {
|
|
8219
|
-
_this.previousSelection = _this.getSelection();
|
|
8220
|
-
_this.saveSelectionLoopDeferId = defer(_this.saveSelectionLoop);
|
|
8221
|
-
};
|
|
8222
|
-
_this.runSaveSelectionLoop = function () {
|
|
8223
|
-
if (_this.saveSelectionLoopDeferId === null) {
|
|
8224
|
-
_this.saveSelectionLoop();
|
|
8225
|
-
}
|
|
8226
|
-
};
|
|
8227
|
-
_this.stopSaveSelectionLoop = function () {
|
|
8228
|
-
if (_this.saveSelectionLoopDeferId !== null) {
|
|
8229
|
-
cancelDefer(_this.saveSelectionLoopDeferId);
|
|
8230
|
-
_this.saveSelectionLoopDeferId = null;
|
|
8231
|
-
_this.previousSelection = null;
|
|
8232
|
-
}
|
|
8233
|
-
};
|
|
8234
|
-
_this.getInputDOMNode = function () {
|
|
8235
|
-
if (!_this.mounted) {
|
|
8236
|
-
return null;
|
|
8237
|
-
}
|
|
8238
|
-
var input = reactDom.findDOMNode(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
8239
|
-
var isDOMNode = typeof window !== 'undefined' && input instanceof window.Element; // workaround for react-test-renderer
|
|
8240
|
-
// https://github.com/sanniassin/react-input-mask/issues/147
|
|
8241
|
-
|
|
8242
|
-
if (input && !isDOMNode) {
|
|
8243
|
-
return null;
|
|
8244
|
-
}
|
|
8245
|
-
if (input.nodeName !== 'INPUT') {
|
|
8246
|
-
input = input.querySelector('input');
|
|
8247
|
-
}
|
|
8248
|
-
if (!input) {
|
|
8249
|
-
throw new Error('react-input-mask: inputComponent doesn\'t contain input node');
|
|
8250
|
-
}
|
|
8251
|
-
return input;
|
|
8252
|
-
};
|
|
8253
|
-
_this.getInputValue = function () {
|
|
8254
|
-
var input = _this.getInputDOMNode();
|
|
8255
|
-
if (!input) {
|
|
8256
|
-
return null;
|
|
8257
|
-
}
|
|
8258
|
-
return input.value;
|
|
8259
|
-
};
|
|
8260
|
-
_this.setInputValue = function (value) {
|
|
8261
|
-
var input = _this.getInputDOMNode();
|
|
8262
|
-
if (!input) {
|
|
8263
|
-
return;
|
|
8264
|
-
}
|
|
8265
|
-
_this.value = value;
|
|
8266
|
-
input.value = value;
|
|
8267
|
-
};
|
|
8268
|
-
_this.setCursorToEnd = function () {
|
|
8269
|
-
var filledLength = getFilledLength(_this.maskOptions, _this.value);
|
|
8270
|
-
var pos = getRightEditablePosition(_this.maskOptions, filledLength);
|
|
8271
|
-
if (pos !== null) {
|
|
8272
|
-
_this.setCursorPosition(pos);
|
|
8273
|
-
}
|
|
8274
|
-
};
|
|
8275
|
-
_this.setSelection = function (start, end, options) {
|
|
8276
|
-
if (options === void 0) {
|
|
8277
|
-
options = {};
|
|
8278
|
-
}
|
|
8279
|
-
var input = _this.getInputDOMNode();
|
|
8280
|
-
var isFocused = _this.isFocused(); // don't change selection on unfocused input
|
|
8281
|
-
// because Safari sets focus on selection change (#154)
|
|
8282
|
-
|
|
8283
|
-
if (!input || !isFocused) {
|
|
8284
|
-
return;
|
|
8285
|
-
}
|
|
8286
|
-
var _options = options,
|
|
8287
|
-
deferred = _options.deferred;
|
|
8288
|
-
if (!deferred) {
|
|
8289
|
-
setInputSelection(input, start, end);
|
|
8290
|
-
}
|
|
8291
|
-
if (_this.selectionDeferId !== null) {
|
|
8292
|
-
cancelDefer(_this.selectionDeferId);
|
|
8293
|
-
} // deferred selection update is required for pre-Lollipop Android browser,
|
|
8294
|
-
// but for consistent behavior we do it for all browsers
|
|
8295
|
-
|
|
8296
|
-
_this.selectionDeferId = defer(function () {
|
|
8297
|
-
_this.selectionDeferId = null;
|
|
8298
|
-
setInputSelection(input, start, end);
|
|
8299
|
-
});
|
|
8300
|
-
_this.previousSelection = {
|
|
8301
|
-
start: start,
|
|
8302
|
-
end: end,
|
|
8303
|
-
length: Math.abs(end - start)
|
|
8304
|
-
};
|
|
8305
|
-
};
|
|
8306
|
-
_this.getSelection = function () {
|
|
8307
|
-
var input = _this.getInputDOMNode();
|
|
8308
|
-
return getInputSelection(input);
|
|
8309
|
-
};
|
|
8310
|
-
_this.getCursorPosition = function () {
|
|
8311
|
-
return _this.getSelection().start;
|
|
8312
|
-
};
|
|
8313
|
-
_this.setCursorPosition = function (pos) {
|
|
8314
|
-
_this.setSelection(pos, pos);
|
|
8315
|
-
};
|
|
8316
|
-
_this.isFocused = function () {
|
|
8317
|
-
return _this.focused;
|
|
8318
|
-
};
|
|
8319
|
-
_this.getBeforeMaskedValueChangeConfig = function () {
|
|
8320
|
-
var _this$maskOptions = _this.maskOptions,
|
|
8321
|
-
mask = _this$maskOptions.mask,
|
|
8322
|
-
maskChar = _this$maskOptions.maskChar,
|
|
8323
|
-
permanents = _this$maskOptions.permanents,
|
|
8324
|
-
formatChars = _this$maskOptions.formatChars;
|
|
8325
|
-
var alwaysShowMask = _this.props.alwaysShowMask;
|
|
8326
|
-
return {
|
|
8327
|
-
mask: mask,
|
|
8328
|
-
maskChar: maskChar,
|
|
8329
|
-
permanents: permanents,
|
|
8330
|
-
alwaysShowMask: !!alwaysShowMask,
|
|
8331
|
-
formatChars: formatChars
|
|
8332
|
-
};
|
|
8333
|
-
};
|
|
8334
|
-
_this.isInputAutofilled = function (value, selection, previousValue, previousSelection) {
|
|
8335
|
-
var input = _this.getInputDOMNode(); // only check for positive match because it will be false negative
|
|
8336
|
-
// in case of autofill simulation in tests
|
|
8337
|
-
//
|
|
8338
|
-
// input.matches throws an exception if selector isn't supported
|
|
8339
|
-
|
|
8340
|
-
try {
|
|
8341
|
-
if (input.matches(':-webkit-autofill')) {
|
|
8342
|
-
return true;
|
|
8343
|
-
}
|
|
8344
|
-
} catch (e) {} // if input isn't focused then change event must have been triggered
|
|
8345
|
-
// either by autofill or event simulation in tests
|
|
8346
|
-
|
|
8347
|
-
if (!_this.focused) {
|
|
8348
|
-
return true;
|
|
8349
|
-
} // if cursor has moved to the end while previousSelection forbids it
|
|
8350
|
-
// then it must be autofill
|
|
8351
|
-
|
|
8352
|
-
return previousSelection.end < previousValue.length && selection.end === value.length;
|
|
8353
|
-
};
|
|
8354
|
-
_this.onChange = function (event) {
|
|
8355
|
-
var _assertThisInitialize = _assertThisInitialized(_assertThisInitialized(_this)),
|
|
8356
|
-
beforePasteState = _assertThisInitialize.beforePasteState;
|
|
8357
|
-
var _assertThisInitialize2 = _assertThisInitialized(_assertThisInitialized(_this)),
|
|
8358
|
-
previousSelection = _assertThisInitialize2.previousSelection;
|
|
8359
|
-
var beforeMaskedValueChange = _this.props.beforeMaskedValueChange;
|
|
8360
|
-
var value = _this.getInputValue();
|
|
8361
|
-
var previousValue = _this.value;
|
|
8362
|
-
var selection = _this.getSelection(); // autofill replaces entire value, ignore old one
|
|
8363
|
-
// https://github.com/sanniassin/react-input-mask/issues/113
|
|
8364
|
-
|
|
8365
|
-
if (_this.isInputAutofilled(value, selection, previousValue, previousSelection)) {
|
|
8366
|
-
previousValue = formatValue(_this.maskOptions, '');
|
|
8367
|
-
previousSelection = {
|
|
8368
|
-
start: 0,
|
|
8369
|
-
end: 0,
|
|
8370
|
-
length: 0
|
|
8371
|
-
};
|
|
8372
|
-
} // set value and selection as if we haven't
|
|
8373
|
-
// cleared input in onPaste handler
|
|
8374
|
-
|
|
8375
|
-
if (beforePasteState) {
|
|
8376
|
-
previousSelection = beforePasteState.selection;
|
|
8377
|
-
previousValue = beforePasteState.value;
|
|
8378
|
-
selection = {
|
|
8379
|
-
start: previousSelection.start + value.length,
|
|
8380
|
-
end: previousSelection.start + value.length,
|
|
8381
|
-
length: 0
|
|
8382
|
-
};
|
|
8383
|
-
value = previousValue.slice(0, previousSelection.start) + value + previousValue.slice(previousSelection.end);
|
|
8384
|
-
_this.beforePasteState = null;
|
|
7934
|
+
if (_this.isInputAutofilled(value, selection, previousValue, previousSelection)) {
|
|
7935
|
+
previousValue = formatValue(_this.maskOptions, '');
|
|
7936
|
+
previousSelection = {
|
|
7937
|
+
start: 0,
|
|
7938
|
+
end: 0,
|
|
7939
|
+
length: 0
|
|
7940
|
+
};
|
|
7941
|
+
} // set value and selection as if we haven't
|
|
7942
|
+
// cleared input in onPaste handler
|
|
7943
|
+
|
|
7944
|
+
if (beforePasteState) {
|
|
7945
|
+
previousSelection = beforePasteState.selection;
|
|
7946
|
+
previousValue = beforePasteState.value;
|
|
7947
|
+
selection = {
|
|
7948
|
+
start: previousSelection.start + value.length,
|
|
7949
|
+
end: previousSelection.start + value.length,
|
|
7950
|
+
length: 0
|
|
7951
|
+
};
|
|
7952
|
+
value = previousValue.slice(0, previousSelection.start) + value + previousValue.slice(previousSelection.end);
|
|
7953
|
+
_this.beforePasteState = null;
|
|
8385
7954
|
}
|
|
8386
7955
|
var changedState = processChange(_this.maskOptions, value, selection, previousValue, previousSelection);
|
|
8387
7956
|
var enteredString = changedState.enteredString;
|
|
@@ -8519,207 +8088,718 @@ function requireReactInputMask_development() {
|
|
|
8519
8088
|
} // event.clipboardData might not work in Android browser
|
|
8520
8089
|
// cleaning input to get raw text inside onChange handler
|
|
8521
8090
|
|
|
8522
|
-
if (!event.defaultPrevented) {
|
|
8523
|
-
_this.beforePasteState = {
|
|
8524
|
-
value: _this.getInputValue(),
|
|
8525
|
-
selection: _this.getSelection()
|
|
8526
|
-
};
|
|
8527
|
-
_this.setInputValue('');
|
|
8528
|
-
}
|
|
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
|
|
8529
8274
|
};
|
|
8530
|
-
|
|
8531
|
-
if (
|
|
8532
|
-
|
|
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;
|
|
8533
8283
|
}
|
|
8534
|
-
};
|
|
8535
|
-
var _mask = props.mask,
|
|
8536
|
-
_maskChar = props.maskChar,
|
|
8537
|
-
_formatChars = props.formatChars,
|
|
8538
|
-
_alwaysShowMask = props.alwaysShowMask,
|
|
8539
|
-
_beforeMaskedValueChange = props.beforeMaskedValueChange;
|
|
8540
|
-
var defaultValue = props.defaultValue,
|
|
8541
|
-
_value = props.value;
|
|
8542
|
-
_this.maskOptions = parseMask(_mask, _maskChar, _formatChars);
|
|
8543
|
-
if (defaultValue == null) {
|
|
8544
|
-
defaultValue = '';
|
|
8545
8284
|
}
|
|
8546
|
-
|
|
8547
|
-
|
|
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]);
|
|
8548
8317
|
}
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
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";
|
|
8566
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;
|
|
8567
8429
|
}
|
|
8568
|
-
_this.value = _newValue;
|
|
8569
|
-
return _this;
|
|
8570
8430
|
}
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
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;
|
|
8578
8470
|
}
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
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
|
|
8582
8516
|
}
|
|
8583
8517
|
};
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
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;
|
|
8604
8635
|
}
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
}
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
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);
|
|
8623
8666
|
}
|
|
8667
|
+
f.runSaveSelectionLoop();
|
|
8624
8668
|
}
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
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);
|
|
8632
8708
|
};
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
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
|
|
8637
8723
|
}, {
|
|
8638
|
-
value:
|
|
8639
|
-
selection:
|
|
8640
|
-
}, null,
|
|
8641
|
-
newValue = modifiedValue.value;
|
|
8642
|
-
newSelection = modifiedValue.selection;
|
|
8643
|
-
}
|
|
8644
|
-
this.value = newValue;
|
|
8645
|
-
var isValueChanged = this.getInputValue() !== this.value; // render depends on this.maskOptions and this.value,
|
|
8646
|
-
// call forceUpdate to keep it in sync
|
|
8647
|
-
|
|
8648
|
-
if (isValueChanged) {
|
|
8649
|
-
this.setInputValue(this.value);
|
|
8650
|
-
this.forceUpdate();
|
|
8651
|
-
} else if (isMaskChanged) {
|
|
8652
|
-
this.forceUpdate();
|
|
8653
|
-
}
|
|
8654
|
-
var isSelectionChanged = false;
|
|
8655
|
-
if (newSelection.start != null && newSelection.end != null) {
|
|
8656
|
-
isSelectionChanged = !previousSelection || previousSelection.start !== newSelection.start || previousSelection.end !== newSelection.end;
|
|
8657
|
-
}
|
|
8658
|
-
if (isSelectionChanged || isValueChanged) {
|
|
8659
|
-
this.setSelection(newSelection.start, newSelection.end);
|
|
8660
|
-
}
|
|
8661
|
-
};
|
|
8662
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
8663
|
-
this.mounted = false;
|
|
8664
|
-
if (this.selectionDeferId !== null) {
|
|
8665
|
-
cancelDefer(this.selectionDeferId);
|
|
8666
|
-
}
|
|
8667
|
-
this.stopSaveSelectionLoop();
|
|
8668
|
-
};
|
|
8669
|
-
_proto.render = function render() {
|
|
8670
|
-
var _this$props2 = this.props,
|
|
8671
|
-
mask = _this$props2.mask;
|
|
8672
|
-
_this$props2.alwaysShowMask;
|
|
8673
|
-
var maskChar = _this$props2.maskChar,
|
|
8674
|
-
formatChars = _this$props2.formatChars,
|
|
8675
|
-
inputRef = _this$props2.inputRef;
|
|
8676
|
-
_this$props2.beforeMaskedValueChange;
|
|
8677
|
-
var children = _this$props2.children,
|
|
8678
|
-
restProps = _objectWithoutPropertiesLoose(_this$props2, ["mask", "alwaysShowMask", "maskChar", "formatChars", "inputRef", "beforeMaskedValueChange", "children"]);
|
|
8679
|
-
var inputElement;
|
|
8680
|
-
process.env.NODE_ENV !== "production" ? warning(
|
|
8681
|
-
// parse mask to test against actual mask prop as this.maskOptions
|
|
8682
|
-
// will be updated later in componentDidUpdate
|
|
8683
|
-
!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;
|
|
8684
|
-
if (children) {
|
|
8685
|
-
!isFunction(children) ? process.env.NODE_ENV !== "production" ? invariant(false, 'react-input-mask: children must be a function') : invariant(false) : void 0;
|
|
8686
|
-
var controlledProps = ['onChange', 'onPaste', 'onMouseDown', 'onFocus', 'onBlur', 'value', 'disabled', 'readOnly'];
|
|
8687
|
-
var childrenProps = _extends({}, restProps);
|
|
8688
|
-
controlledProps.forEach(function (propId) {
|
|
8689
|
-
return delete childrenProps[propId];
|
|
8690
|
-
});
|
|
8691
|
-
inputElement = children(childrenProps);
|
|
8692
|
-
var conflictProps = controlledProps.filter(function (propId) {
|
|
8693
|
-
return inputElement.props[propId] != null && inputElement.props[propId] !== restProps[propId];
|
|
8694
|
-
});
|
|
8695
|
-
!!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;
|
|
8696
|
-
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;
|
|
8697
|
-
} else {
|
|
8698
|
-
inputElement = React.createElement("input", _extends({
|
|
8699
|
-
ref: this.handleRef
|
|
8700
|
-
}, restProps));
|
|
8724
|
+
value: u = getStringValue(u),
|
|
8725
|
+
selection: null
|
|
8726
|
+
}, null, f.getBeforeMaskedValueChangeConfig()).value;
|
|
8701
8727
|
}
|
|
8702
|
-
|
|
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 = {
|
|
8703
8795
|
onFocus: this.onFocus,
|
|
8704
8796
|
onBlur: this.onBlur
|
|
8705
8797
|
};
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
changedProps.onChange = this.onChange;
|
|
8709
|
-
changedProps.onPaste = this.onPaste;
|
|
8710
|
-
changedProps.onMouseDown = this.onMouseDown;
|
|
8711
|
-
}
|
|
8712
|
-
if (restProps.value != null) {
|
|
8713
|
-
changedProps.value = this.value;
|
|
8714
|
-
}
|
|
8715
|
-
}
|
|
8716
|
-
inputElement = React.cloneElement(inputElement, changedProps);
|
|
8717
|
-
return inputElement;
|
|
8718
|
-
};
|
|
8719
|
-
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;
|
|
8720
8800
|
}(React.Component);
|
|
8721
|
-
|
|
8722
|
-
return
|
|
8801
|
+
reactInputMask_production_min = InputElement;
|
|
8802
|
+
return reactInputMask_production_min;
|
|
8723
8803
|
}
|
|
8724
8804
|
|
|
8725
8805
|
if (process.env.NODE_ENV === 'production') {
|
|
@@ -8800,7 +8880,7 @@ var cardTypes$1 = {
|
|
|
8800
8880
|
unionpay: {
|
|
8801
8881
|
niceType: "UnionPay",
|
|
8802
8882
|
type: "unionpay",
|
|
8803
|
-
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]],
|
|
8804
8884
|
gaps: [4, 8, 12],
|
|
8805
8885
|
lengths: [14, 15, 16, 17, 18, 19],
|
|
8806
8886
|
code: {
|
|
@@ -8921,10 +9001,10 @@ function addMatchingCardsToResults(cardNumber, cardConfiguration, results) {
|
|
|
8921
9001
|
var i, patternLength;
|
|
8922
9002
|
for (i = 0; i < cardConfiguration.patterns.length; i++) {
|
|
8923
9003
|
var pattern = cardConfiguration.patterns[i];
|
|
8924
|
-
if (!matches_1.matches(cardNumber, pattern)) {
|
|
9004
|
+
if (!(0, matches_1.matches)(cardNumber, pattern)) {
|
|
8925
9005
|
continue;
|
|
8926
9006
|
}
|
|
8927
|
-
var clonedCardConfiguration = clone_1$1.clone(cardConfiguration);
|
|
9007
|
+
var clonedCardConfiguration = (0, clone_1$1.clone)(cardConfiguration);
|
|
8928
9008
|
if (Array.isArray(pattern)) {
|
|
8929
9009
|
patternLength = String(pattern[0]).length;
|
|
8930
9010
|
} else {
|
|
@@ -9018,13 +9098,13 @@ var cardNames = {
|
|
|
9018
9098
|
HIPERCARD: "hipercard"
|
|
9019
9099
|
};
|
|
9020
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];
|
|
9021
|
-
var testOrder = clone_1.clone(ORIGINAL_TEST_ORDER);
|
|
9101
|
+
var testOrder = (0, clone_1.clone)(ORIGINAL_TEST_ORDER);
|
|
9022
9102
|
function findType(cardType) {
|
|
9023
9103
|
return customCards[cardType] || cardTypes[cardType];
|
|
9024
9104
|
}
|
|
9025
9105
|
function getAllCardTypes() {
|
|
9026
9106
|
return testOrder.map(function (cardType) {
|
|
9027
|
-
return clone_1.clone(findType(cardType));
|
|
9107
|
+
return (0, clone_1.clone)(findType(cardType));
|
|
9028
9108
|
});
|
|
9029
9109
|
}
|
|
9030
9110
|
function getCardPosition(name, ignoreErrorForNotExisting) {
|
|
@@ -9039,7 +9119,7 @@ function getCardPosition(name, ignoreErrorForNotExisting) {
|
|
|
9039
9119
|
}
|
|
9040
9120
|
function creditCardType(cardNumber) {
|
|
9041
9121
|
var results = [];
|
|
9042
|
-
if (!is_valid_input_type_1.isValidInputType(cardNumber)) {
|
|
9122
|
+
if (!(0, is_valid_input_type_1.isValidInputType)(cardNumber)) {
|
|
9043
9123
|
return results;
|
|
9044
9124
|
}
|
|
9045
9125
|
if (cardNumber.length === 0) {
|
|
@@ -9047,16 +9127,16 @@ function creditCardType(cardNumber) {
|
|
|
9047
9127
|
}
|
|
9048
9128
|
testOrder.forEach(function (cardType) {
|
|
9049
9129
|
var cardConfiguration = findType(cardType);
|
|
9050
|
-
add_matching_cards_to_results_1.addMatchingCardsToResults(cardNumber, cardConfiguration, results);
|
|
9130
|
+
(0, add_matching_cards_to_results_1.addMatchingCardsToResults)(cardNumber, cardConfiguration, results);
|
|
9051
9131
|
});
|
|
9052
|
-
var bestMatch = find_best_match_1.findBestMatch(results);
|
|
9132
|
+
var bestMatch = (0, find_best_match_1.findBestMatch)(results);
|
|
9053
9133
|
if (bestMatch) {
|
|
9054
9134
|
return [bestMatch];
|
|
9055
9135
|
}
|
|
9056
9136
|
return results;
|
|
9057
9137
|
}
|
|
9058
9138
|
creditCardType.getTypeInfo = function (cardType) {
|
|
9059
|
-
return clone_1.clone(findType(cardType));
|
|
9139
|
+
return (0, clone_1.clone)(findType(cardType));
|
|
9060
9140
|
};
|
|
9061
9141
|
creditCardType.removeCard = function (name) {
|
|
9062
9142
|
var position = getCardPosition(name);
|
|
@@ -9072,12 +9152,12 @@ creditCardType.addCard = function (config) {
|
|
|
9072
9152
|
creditCardType.updateCard = function (cardType, updates) {
|
|
9073
9153
|
var originalObject = customCards[cardType] || cardTypes[cardType];
|
|
9074
9154
|
if (!originalObject) {
|
|
9075
|
-
throw new Error("\""
|
|
9155
|
+
throw new Error("\"".concat(cardType, "\" is not a recognized type. Use `addCard` instead.'"));
|
|
9076
9156
|
}
|
|
9077
9157
|
if (updates.type && originalObject.type !== updates.type) {
|
|
9078
9158
|
throw new Error("Cannot overwrite type parameter.");
|
|
9079
9159
|
}
|
|
9080
|
-
var clonedCard = clone_1.clone(originalObject);
|
|
9160
|
+
var clonedCard = (0, clone_1.clone)(originalObject);
|
|
9081
9161
|
clonedCard = __assign$8(__assign$8({}, clonedCard), updates);
|
|
9082
9162
|
customCards[clonedCard.type] = clonedCard;
|
|
9083
9163
|
};
|
|
@@ -9087,7 +9167,7 @@ creditCardType.changeOrder = function (name, position) {
|
|
|
9087
9167
|
testOrder.splice(position, 0, name);
|
|
9088
9168
|
};
|
|
9089
9169
|
creditCardType.resetModifications = function () {
|
|
9090
|
-
testOrder = clone_1.clone(ORIGINAL_TEST_ORDER);
|
|
9170
|
+
testOrder = (0, clone_1.clone)(ORIGINAL_TEST_ORDER);
|
|
9091
9171
|
customCards = {};
|
|
9092
9172
|
};
|
|
9093
9173
|
creditCardType.types = cardNames;
|
|
@@ -9169,8 +9249,8 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
|
9169
9249
|
"aria-label": label || placeholder,
|
|
9170
9250
|
ref: ref,
|
|
9171
9251
|
onChange: function onChange(event) {
|
|
9172
|
-
_onChange === null || _onChange === void 0
|
|
9173
|
-
onChangeEvent === null || onChangeEvent === void 0
|
|
9252
|
+
_onChange === null || _onChange === void 0 || _onChange(event.target.value);
|
|
9253
|
+
onChangeEvent === null || onChangeEvent === void 0 || onChangeEvent(event);
|
|
9174
9254
|
}
|
|
9175
9255
|
}, rest));
|
|
9176
9256
|
});
|
|
@@ -9628,12 +9708,12 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
9628
9708
|
var handleClear = useCallback(function () {
|
|
9629
9709
|
var _ref$current;
|
|
9630
9710
|
setValue(DEFAULT_INPUT_VALUE);
|
|
9631
|
-
onChange === null || onChange === void 0
|
|
9632
|
-
onClear === null || onClear === void 0
|
|
9633
|
-
(_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();
|
|
9634
9714
|
}, [onClear, onChange]);
|
|
9635
9715
|
var handleChange = useCallback(function (value) {
|
|
9636
|
-
onChange === null || onChange === void 0
|
|
9716
|
+
onChange === null || onChange === void 0 || onChange(value);
|
|
9637
9717
|
setValue(value);
|
|
9638
9718
|
}, [onChange, setValue]);
|
|
9639
9719
|
useEffect(function () {
|
|
@@ -9655,16 +9735,16 @@ var SearchInput = function SearchInput(_ref) {
|
|
|
9655
9735
|
}, /*#__PURE__*/React__default.createElement(Exit20, null)));
|
|
9656
9736
|
};
|
|
9657
9737
|
|
|
9658
|
-
var t
|
|
9738
|
+
var t = function t(_t) {
|
|
9659
9739
|
return "object" == _typeof$1(_t) && null != _t && 1 === _t.nodeType;
|
|
9660
9740
|
},
|
|
9661
|
-
e = function e(t, _e) {
|
|
9741
|
+
e$1 = function e(t, _e) {
|
|
9662
9742
|
return (!_e || "hidden" !== t) && "visible" !== t && "clip" !== t;
|
|
9663
9743
|
},
|
|
9664
9744
|
n = function n(t, _n) {
|
|
9665
9745
|
if (t.clientHeight < t.scrollHeight || t.clientWidth < t.scrollWidth) {
|
|
9666
9746
|
var _l = getComputedStyle(t, null);
|
|
9667
|
-
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) {
|
|
9668
9748
|
var e = function (t) {
|
|
9669
9749
|
if (!t.ownerDocument || !t.ownerDocument.defaultView) return null;
|
|
9670
9750
|
try {
|
|
@@ -9696,11 +9776,11 @@ var t$1 = function t(_t) {
|
|
|
9696
9776
|
m = "function" == typeof a ? a : function (t) {
|
|
9697
9777
|
return t !== a;
|
|
9698
9778
|
};
|
|
9699
|
-
if (!t
|
|
9779
|
+
if (!t(e)) throw new TypeError("Invalid target");
|
|
9700
9780
|
var p = document.scrollingElement || document.documentElement,
|
|
9701
9781
|
w = [],
|
|
9702
9782
|
W = e;
|
|
9703
|
-
for (; t
|
|
9783
|
+
for (; t(W) && m(W);) {
|
|
9704
9784
|
if (W = i(W), W === p) {
|
|
9705
9785
|
w.push(W);
|
|
9706
9786
|
break;
|
|
@@ -9758,42 +9838,53 @@ var t$1 = function t(_t) {
|
|
|
9758
9838
|
return k;
|
|
9759
9839
|
};
|
|
9760
9840
|
|
|
9761
|
-
var o = function o(
|
|
9762
|
-
return !1 ===
|
|
9841
|
+
var o = function o(t) {
|
|
9842
|
+
return !1 === t ? {
|
|
9763
9843
|
block: "end",
|
|
9764
9844
|
inline: "nearest"
|
|
9765
|
-
} : function (
|
|
9766
|
-
return
|
|
9767
|
-
}(
|
|
9845
|
+
} : function (t) {
|
|
9846
|
+
return t === Object(t) && 0 !== Object.keys(t).length;
|
|
9847
|
+
}(t) ? t : {
|
|
9768
9848
|
block: "start",
|
|
9769
9849
|
inline: "nearest"
|
|
9770
9850
|
};
|
|
9771
9851
|
};
|
|
9772
|
-
function
|
|
9773
|
-
if (!
|
|
9774
|
-
var o =
|
|
9852
|
+
function e(e, r) {
|
|
9853
|
+
if (!e.isConnected || !function (t) {
|
|
9854
|
+
var o = t;
|
|
9775
9855
|
for (; o && o.parentNode;) {
|
|
9776
9856
|
if (o.parentNode === document) return !0;
|
|
9777
9857
|
o = o.parentNode instanceof ShadowRoot ? o.parentNode.host : o.parentNode;
|
|
9778
9858
|
}
|
|
9779
9859
|
return !1;
|
|
9780
|
-
}(
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
|
|
9784
|
-
|
|
9785
|
-
|
|
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))),
|
|
9786
9875
|
_step;
|
|
9787
9876
|
try {
|
|
9788
9877
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
9789
9878
|
var _step$value = _step.value,
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
i.
|
|
9794
|
-
|
|
9795
|
-
|
|
9796
|
-
|
|
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
|
|
9797
9888
|
});
|
|
9798
9889
|
}
|
|
9799
9890
|
} catch (err) {
|
|
@@ -9817,7 +9908,7 @@ var SelectOption = function SelectOption(_ref) {
|
|
|
9817
9908
|
}, [onClick, option]);
|
|
9818
9909
|
useEffect(function () {
|
|
9819
9910
|
if (active && ref.current) {
|
|
9820
|
-
|
|
9911
|
+
e(ref.current, {
|
|
9821
9912
|
scrollMode: 'if-needed',
|
|
9822
9913
|
block: 'nearest'
|
|
9823
9914
|
});
|
|
@@ -10058,7 +10149,7 @@ var Select = function Select(_ref) {
|
|
|
10058
10149
|
value: autoSelect ? option.value : value !== null && value !== void 0 ? value : option.value
|
|
10059
10150
|
}
|
|
10060
10151
|
});
|
|
10061
|
-
onChange === null || onChange === void 0
|
|
10152
|
+
onChange === null || onChange === void 0 || onChange(option.value);
|
|
10062
10153
|
}, [autoSelect, value, dispatch, onChange]);
|
|
10063
10154
|
var handleFocus = useCallback(function (option) {
|
|
10064
10155
|
return dispatch({
|
|
@@ -10392,7 +10483,7 @@ var CreditCardNumberInput = function CreditCardNumberInput(_ref) {
|
|
|
10392
10483
|
}, [propsValue, value, setValue]);
|
|
10393
10484
|
var handleChange = useCallback(function (event) {
|
|
10394
10485
|
setValue(event.target.value);
|
|
10395
|
-
onChange === null || onChange === void 0
|
|
10486
|
+
onChange === null || onChange === void 0 || onChange(event.target.value);
|
|
10396
10487
|
}, [setValue, onChange]);
|
|
10397
10488
|
|
|
10398
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
|
|
@@ -10455,7 +10546,7 @@ var Expandable = function Expandable(_ref) {
|
|
|
10455
10546
|
setExpanded(function (expanded) {
|
|
10456
10547
|
return !expanded;
|
|
10457
10548
|
});
|
|
10458
|
-
onToggle === null || onToggle === void 0
|
|
10549
|
+
onToggle === null || onToggle === void 0 || onToggle();
|
|
10459
10550
|
}, [onToggle]);
|
|
10460
10551
|
return /*#__PURE__*/React__default.createElement("div", _extends$1({
|
|
10461
10552
|
className: classNames('Expandable', "Expandable--".concat(background, "-background"), {
|
|
@@ -10887,7 +10978,7 @@ var ModalOverlay = function ModalOverlay(_ref) {
|
|
|
10887
10978
|
document.body.appendChild(element);
|
|
10888
10979
|
return function () {
|
|
10889
10980
|
var _element$parentElemen;
|
|
10890
|
-
element === null || element === void 0
|
|
10981
|
+
element === null || element === void 0 || (_element$parentElemen = element.parentElement) === null || _element$parentElemen === void 0 || _element$parentElemen.removeChild(element);
|
|
10891
10982
|
};
|
|
10892
10983
|
}, [element]);
|
|
10893
10984
|
if (!element) return null;
|
|
@@ -10904,6 +10995,35 @@ var ModalOverlay = function ModalOverlay(_ref) {
|
|
|
10904
10995
|
}, children))), element);
|
|
10905
10996
|
};
|
|
10906
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
|
+
|
|
10907
11027
|
var __assign$1 = undefined && undefined.__assign || function () {
|
|
10908
11028
|
__assign$1 = Object.assign || function (t) {
|
|
10909
11029
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -11550,4 +11670,4 @@ var Utilities = {
|
|
|
11550
11670
|
States: States
|
|
11551
11671
|
};
|
|
11552
11672
|
|
|
11553
|
-
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 };
|
|
11673
|
+
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 };
|