@onepercentio/one-ui 0.20.4 → 0.21.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/.babelrc +6 -0
- package/.prod.babelrc +8 -2
- package/dist/assets/styles/variables.scss +1 -0
- package/dist/components/AdaptiveButton/AdaptiveButton.js +2 -2
- package/dist/components/AdaptiveContainer/AdaptiveContainer.js +28 -26
- package/dist/components/AdaptiveContainer/AdaptiveContainer.module.scss +3 -1
- package/dist/components/AdaptiveDialog/AdaptiveDialog.js +9 -9
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.js +14 -14
- package/dist/components/AnchoredTooltip/AnchoredTooltip.js +30 -30
- package/dist/components/AnimatedEntrance/AnimatedEntrance.d.ts +1 -1
- package/dist/components/AnimatedEntrance/AnimatedEntrance.js +34 -45
- package/dist/components/AsyncWrapper/AsyncWrapper.js +2 -2
- package/dist/components/Avatar/Avatar.js +4 -4
- package/dist/components/BucketFill/BucketFill.js +9 -9
- package/dist/components/Button/Button.js +4 -4
- package/dist/components/Card/Card.js +1 -1
- package/dist/components/Chart/Chart.view.js +34 -34
- package/dist/components/CheckBox/CheckBox.js +3 -3
- package/dist/components/Collapsable/Collapsable.js +18 -18
- package/dist/components/Countdown/Countdown.js +16 -16
- package/dist/components/Divider/Divider.js +1 -1
- package/dist/components/EmailInput/EmailInput.d.ts +1 -1
- package/dist/components/EmailInput/EmailInput.js +4 -4
- package/dist/components/FadeIn/FadeIn.js +9 -9
- package/dist/components/FileInput/FileInput.js +6 -6
- package/dist/components/FileInput/View/BigFactory/BigFactory.js +1 -1
- package/dist/components/FileInput/View/Compact/Compact.js +6 -6
- package/dist/components/FlowController/FlowController.js +4 -4
- package/dist/components/Form/Form.js +17 -28
- package/dist/components/Freeze/Freeze.js +1 -1
- package/dist/components/HSForms/HSForms.js +9 -11
- package/dist/components/Header/Header.js +7 -7
- package/dist/components/HeaderCloseBtn/HeaderCloseBtn.js +1 -1
- package/dist/components/InfinityScroll/InfinityScroll.js +25 -25
- package/dist/components/Input/Input.js +13 -13
- package/dist/components/InstantCounter/InstantCounter.js +9 -9
- package/dist/components/LavaLamp/LavaLamp.data.js +25 -25
- package/dist/components/LavaLamp/LavaLamp.js +7 -7
- package/dist/components/LavaLamp/v2/LavaLamp.js +29 -45
- package/dist/components/LinkToId/LinkToId.js +7 -7
- package/dist/components/Loader/Loader.js +2 -2
- package/dist/components/LoaderDotsIndicator/LoaderDotsIndicator.js +6 -6
- package/dist/components/LoopableVideo/LoopableVideo.js +4 -4
- package/dist/components/MainGrid/MainGrid.js +2 -2
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.js +2 -2
- package/dist/components/Notification/Notification.js +1 -1
- package/dist/components/OrderableList/OrderableList.js +113 -138
- package/dist/components/PaginationIndicator/PaginationIndicator.js +50 -50
- package/dist/components/Parallax/Parallax.js +39 -39
- package/dist/components/Parallax/math/helpers.js +18 -19
- package/dist/components/PasswordInput/PasswordInput.d.ts +1 -1
- package/dist/components/PasswordInput/PasswordInput.js +10 -10
- package/dist/components/PingPongText/PingPongText.js +15 -15
- package/dist/components/PixelatedScan/PixelatedScan.js +19 -19
- package/dist/components/Portal/Portal.js +10 -10
- package/dist/components/ProgressBar/ProgressBar.js +6 -6
- package/dist/components/ProgressTexts/ProgressTexts.js +3 -3
- package/dist/components/Radio/Radio.js +3 -3
- package/dist/components/SectionContainer/SectionContainer.js +1 -1
- package/dist/components/Select/Select.js +13 -13
- package/dist/components/Select/Select.module.scss +8 -5
- package/dist/components/Skeleton/Skeleton.js +1 -1
- package/dist/components/Spacing/Spacing.js +1 -1
- package/dist/components/StaticScroller/StaticScroller.js +12 -12
- package/dist/components/Switch/Switch.js +2 -2
- package/dist/components/Table/Table.js +11 -11
- package/dist/components/Tabs/Tabs.d.ts +6 -1
- package/dist/components/Tabs/Tabs.js +28 -9
- package/dist/components/Tabs/Tabs.module.scss +20 -2
- package/dist/components/Text/Text.js +5 -5
- package/dist/components/Transition/MasksFactory/DiagonalReveal.js +5 -5
- package/dist/components/Transition/MasksFactory/DiagonalSquareToBalls.js +17 -17
- package/dist/components/Transition/MasksFactory/PhysicsSquares.js +13 -13
- package/dist/components/Transition/MasksFactory/SquareToBalls.js +9 -9
- package/dist/components/Transition/MasksFactory/utils.js +8 -8
- package/dist/components/Transition/Transition.js +49 -49
- package/dist/components/UncontrolledTransition/UncontrolledTransition.js +7 -7
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.js +44 -82
- package/dist/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.js +6 -6
- package/dist/context/AsyncProcess.js +19 -42
- package/dist/context/CustomBrowserRouter.js +6 -6
- package/dist/context/OneUIProvider.js +15 -15
- package/dist/hooks/logs/useDependencyChangeDetection.js +2 -5
- package/dist/hooks/persistence/useLocalStorage.js +7 -7
- package/dist/hooks/shims/ObjectWatchShim.js +1 -15
- package/dist/hooks/ui/useAdaptiveImage.js +6 -6
- package/dist/hooks/ui/useBreakpoint.js +5 -5
- package/dist/hooks/ui/useCustomScrollbar.js +2 -2
- package/dist/hooks/ui/useMouseHover.js +4 -4
- package/dist/hooks/ui/usePaginationControls.js +34 -34
- package/dist/hooks/ui/useSnapToViewport.js +3 -3
- package/dist/hooks/ui/useTilt.js +38 -38
- package/dist/hooks/ui/useZoomable.js +20 -20
- package/dist/hooks/useAsyncControl.js +21 -38
- package/dist/hooks/useContainedRepositioning.js +22 -22
- package/dist/hooks/useCustomHistory.js +2 -2
- package/dist/hooks/useElementFit.js +6 -6
- package/dist/hooks/useFirestoreWatch.js +26 -39
- package/dist/hooks/useForm.js +8 -8
- package/dist/hooks/useFreeze.js +1 -1
- package/dist/hooks/useHero.d.ts +1 -0
- package/dist/hooks/useHero.js +132 -91
- package/dist/hooks/useHero.module.scss +7 -0
- package/dist/hooks/useIntersection.js +3 -3
- package/dist/hooks/useMergeRefs.js +3 -7
- package/dist/hooks/useObserve.js +5 -5
- package/dist/hooks/usePagination.js +39 -59
- package/dist/hooks/usePooledOperation.js +8 -22
- package/dist/hooks/usePooling.js +17 -33
- package/dist/hooks/useRebound.js +5 -5
- package/dist/hooks/useShortIntl.js +13 -13
- package/dist/hooks/utility/useEvents.js +5 -5
- package/dist/hooks/utility/useModule.js +3 -3
- package/dist/hooks/utility/useQuery.js +1 -1
- package/dist/models/DebugLogger.js +2 -2
- package/dist/models/GenericContract.js +1 -1
- package/dist/storybookUtils/index.js +1 -1
- package/dist/types.d.ts +11 -4
- package/dist/utility.d.js +3 -3
- package/dist/utils/blockchain.js +29 -102
- package/dist/utils/flatten.js +3 -3
- package/dist/utils/html.utils.js +1 -1
- package/package.json +2 -1
- package/src/types.ts +155 -41
|
@@ -11,17 +11,17 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
13
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0)
|
|
14
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
15
15
|
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
|
16
16
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
17
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
18
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
19
19
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
20
20
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
const MAX_BALLS = 7;
|
|
22
|
+
const eachBallWidthEm = 1.2;
|
|
23
|
+
const CENTER_GUIDE_BALL = 1;
|
|
24
|
+
let PaginationIndicatorMode = /*#__PURE__*/function (PaginationIndicatorMode) {
|
|
25
25
|
PaginationIndicatorMode[PaginationIndicatorMode["CENTERED"] = 0] = "CENTERED";
|
|
26
26
|
PaginationIndicatorMode[PaginationIndicatorMode["START"] = 1] = "START";
|
|
27
27
|
return PaginationIndicatorMode;
|
|
@@ -31,49 +31,49 @@ var PaginationIndicatorMode = /*#__PURE__*/function (PaginationIndicatorMode) {
|
|
|
31
31
|
**/
|
|
32
32
|
exports.PaginationIndicatorMode = PaginationIndicatorMode;
|
|
33
33
|
function PaginationIndicatorView(_ref) {
|
|
34
|
-
|
|
34
|
+
let size = _ref.size,
|
|
35
35
|
currentPage = _ref.page,
|
|
36
36
|
decimalPages = _ref.pages,
|
|
37
37
|
className = _ref.className,
|
|
38
38
|
onClickPage = _ref.onClickPage,
|
|
39
39
|
_ref$mode = _ref.mode,
|
|
40
40
|
mode = _ref$mode === void 0 ? PaginationIndicatorMode.CENTERED : _ref$mode;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
const page = (0, _react.useMemo)(function () {
|
|
42
|
+
const floor = Math.floor(decimalPages);
|
|
43
|
+
const modulus = decimalPages % floor;
|
|
44
44
|
if (currentPage > floor) {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const currentFloorModulus = currentPage % floor;
|
|
46
|
+
const equivalent = currentFloorModulus * 100 / modulus;
|
|
47
47
|
return floor + equivalent / 100;
|
|
48
48
|
} else {
|
|
49
49
|
return currentPage;
|
|
50
50
|
}
|
|
51
51
|
}, [currentPage, decimalPages]);
|
|
52
|
-
|
|
52
|
+
const rand = (0, _react.useMemo)(function () {
|
|
53
53
|
return Math.random().toString();
|
|
54
54
|
}, []);
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
const pageIndex = page - 1;
|
|
56
|
+
const pages = (0, _react.useMemo)(function () {
|
|
57
57
|
return Math.ceil(decimalPages);
|
|
58
58
|
}, [decimalPages]);
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
const numBalls = (0, _react.useMemo)(function () {
|
|
60
|
+
const numBalls = pages >= MAX_BALLS ? MAX_BALLS : Math.ceil(pages);
|
|
61
61
|
return numBalls;
|
|
62
62
|
}, [pages]);
|
|
63
|
-
|
|
63
|
+
const indexForTheBallsCenter = (0, _react.useMemo)(function () {
|
|
64
64
|
return (numBalls - 1) / 2;
|
|
65
65
|
}, [numBalls]);
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
const balls = (0, _react.useMemo)(function () {
|
|
67
|
+
const indexForLastPages = pages + 1 - indexForTheBallsCenter;
|
|
68
68
|
/**
|
|
69
69
|
* Is the page index (position of the center)
|
|
70
70
|
* after the first pages and
|
|
71
71
|
* before the last pages */
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
const isCenterPage = numBalls >= MAX_BALLS && pageIndex > indexForTheBallsCenter && pageIndex < indexForLastPages - 1;
|
|
73
|
+
let modulus = pageIndex % (1 + (indexForTheBallsCenter - Math.floor(indexForTheBallsCenter)));
|
|
74
|
+
const resetPageIndex = isCenterPage ? indexForTheBallsCenter + modulus : pages < MAX_BALLS ? pageIndex : pageIndex >= indexForLastPages - 1 ? numBalls - (pages - pageIndex) : pageIndex;
|
|
75
|
+
const left = eachBallWidthEm * resetPageIndex;
|
|
76
|
+
const _ref2 = mode === PaginationIndicatorMode.CENTERED ? {
|
|
77
77
|
pushBallsToRightBy: Math.min(pages, MAX_BALLS) * eachBallWidthEm,
|
|
78
78
|
pushBallsToLeftBy: left,
|
|
79
79
|
pushGuideToRightBy: 0
|
|
@@ -85,13 +85,13 @@ function PaginationIndicatorView(_ref) {
|
|
|
85
85
|
pushBallsToRightBy = _ref2.pushBallsToRightBy,
|
|
86
86
|
pushBallsToLeftBy = _ref2.pushBallsToLeftBy,
|
|
87
87
|
pushGuideToRightBy = _ref2.pushGuideToRightBy;
|
|
88
|
-
|
|
88
|
+
let pushToLeft = 0;
|
|
89
89
|
return new Array(CENTER_GUIDE_BALL + numBalls).fill(undefined).map(function (_, i) {
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
const isLastBall = i === numBalls - 1;
|
|
91
|
+
const isFirstBall = i === 0;
|
|
92
92
|
if (i === numBalls) {
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
const diameter = 0.45 * 2;
|
|
94
|
+
const padding = (eachBallWidthEm - diameter) / 2;
|
|
95
95
|
return /*#__PURE__*/_react.default.createElement("rect", {
|
|
96
96
|
fill: "#fff",
|
|
97
97
|
width: "".concat(diameter, "em"),
|
|
@@ -101,7 +101,7 @@ function PaginationIndicatorView(_ref) {
|
|
|
101
101
|
rx: "".concat(diameter / 2, "em")
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
const ballSize = numBalls < MAX_BALLS ? 0.5 : page <= indexForTheBallsCenter + 1 && isLastBall ? 0 : pageIndex >= indexForLastPages - 1 && isFirstBall ? 0 : isCenterPage ? isFirstBall ? 0.5 - modulus * 0.5 : isLastBall ? modulus * 0.5 : 0.5 : 0.5;
|
|
105
105
|
if (i === 0 && mode === PaginationIndicatorMode.START) pushToLeft = (0.5 - ballSize) * 2.4;
|
|
106
106
|
return /*#__PURE__*/_react.default.createElement("rect", {
|
|
107
107
|
key: "guide-".concat(i),
|
|
@@ -112,18 +112,18 @@ function PaginationIndicatorView(_ref) {
|
|
|
112
112
|
rx: "".concat(ballSize * 1.2 / 2, "em"),
|
|
113
113
|
onClick: function onClick() {
|
|
114
114
|
if (onClickPage) {
|
|
115
|
-
|
|
115
|
+
const pageClicked = (!isCenterPage ? pageIndex >= indexForLastPages - 1 ? Math.floor(page) - resetPageIndex - 1 : 0 : Math.floor(page) - (indexForTheBallsCenter + 1)) + 1 + i;
|
|
116
116
|
onClickPage(Math.round(pageClicked));
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
120
|
});
|
|
121
121
|
}, [indexForTheBallsCenter, pageIndex, pages]);
|
|
122
|
-
|
|
122
|
+
const _balls$reverse = balls.reverse(),
|
|
123
123
|
_balls$reverse2 = _toArray(_balls$reverse),
|
|
124
124
|
guideBall = _balls$reverse2[0],
|
|
125
125
|
pageBalls = _balls$reverse2.slice(1);
|
|
126
|
-
|
|
126
|
+
let width = eachBallWidthEm * Math.min(pages, MAX_BALLS) * 2;
|
|
127
127
|
if (mode === PaginationIndicatorMode.START) width /= 2;
|
|
128
128
|
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
129
129
|
version: "1.1",
|
|
@@ -172,24 +172,24 @@ function PaginationIndicatorView(_ref) {
|
|
|
172
172
|
}, pageBalls));
|
|
173
173
|
}
|
|
174
174
|
function _PaginationIndicator(_ref3, ref) {
|
|
175
|
-
|
|
175
|
+
let scrollableRef = _ref3.scrollableRef,
|
|
176
176
|
estimatedWidth = _ref3.estimatedWidth,
|
|
177
177
|
size = _ref3.size,
|
|
178
178
|
_ref3$className = _ref3.className,
|
|
179
179
|
className = _ref3$className === void 0 ? "" : _ref3$className,
|
|
180
180
|
onClickPage = _ref3.onClickPage;
|
|
181
|
-
|
|
181
|
+
const _useState = (0, _react.useState)(1),
|
|
182
182
|
_useState2 = _slicedToArray(_useState, 2),
|
|
183
183
|
currentPage = _useState2[0],
|
|
184
184
|
setCurrentPage = _useState2[1];
|
|
185
|
-
|
|
185
|
+
const _useState3 = (0, _react.useState)(),
|
|
186
186
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
187
187
|
defs = _useState4[0],
|
|
188
188
|
setDefs = _useState4[1];
|
|
189
|
-
|
|
189
|
+
const refreshPages = (0, _react.useCallback)(function () {
|
|
190
190
|
if (!scrollableRef.current) return;
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
const maxWidth = estimatedWidth === undefined ? scrollableRef.current.scrollWidth : estimatedWidth;
|
|
192
|
+
const pages = maxWidth / scrollableRef.current.clientWidth;
|
|
193
193
|
if (pages > 1) setDefs({
|
|
194
194
|
pages: pages
|
|
195
195
|
});
|
|
@@ -197,14 +197,14 @@ function _PaginationIndicator(_ref3, ref) {
|
|
|
197
197
|
(0, _react.useEffect)(function () {
|
|
198
198
|
return refreshPages();
|
|
199
199
|
}, [refreshPages]);
|
|
200
|
-
|
|
200
|
+
const updatePageIndicators = (0, _react.useCallback)(function (target, pages) {
|
|
201
201
|
if (!scrollableRef.current) return;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
202
|
+
const eachPageWidth = scrollableRef.current.clientWidth;
|
|
203
|
+
const page = 1 + target.scrollLeft / eachPageWidth;
|
|
204
|
+
const lastPageProgress = Math.floor(pages) + 1;
|
|
205
|
+
const maximumProgress = pages + 1;
|
|
206
|
+
const diffToMax = maximumProgress - lastPageProgress;
|
|
207
|
+
const currentProgressOnDiff = page - lastPageProgress;
|
|
208
208
|
if (page > lastPageProgress) setCurrentPage(lastPageProgress + currentProgressOnDiff / diffToMax);else setCurrentPage(page);
|
|
209
209
|
}, []);
|
|
210
210
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
@@ -214,8 +214,8 @@ function _PaginationIndicator(_ref3, ref) {
|
|
|
214
214
|
}, []);
|
|
215
215
|
(0, _react.useEffect)(function () {
|
|
216
216
|
if (!defs) return;
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
const el = scrollableRef.current;
|
|
218
|
+
const onScroll = function onScroll(e) {
|
|
219
219
|
return updatePageIndicators(e.currentTarget, defs.pages);
|
|
220
220
|
};
|
|
221
221
|
updatePageIndicators(el, defs.pages);
|
|
@@ -226,7 +226,7 @@ function _PaginationIndicator(_ref3, ref) {
|
|
|
226
226
|
el.removeEventListener("scroll", onScroll);
|
|
227
227
|
};
|
|
228
228
|
}, [defs]);
|
|
229
|
-
|
|
229
|
+
const pages = (0, _react.useMemo)(function () {
|
|
230
230
|
return defs ? defs.pages : undefined;
|
|
231
231
|
}, [defs]);
|
|
232
232
|
return !pages ? null : /*#__PURE__*/_react.default.createElement(PaginationIndicatorView, {
|
|
@@ -11,7 +11,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _ParallaxModule = _interopRequireDefault(require("./Parallax.module.scss"));
|
|
12
12
|
var _lodash = require("lodash");
|
|
13
13
|
var _helpers = require("./math/helpers");
|
|
14
|
-
|
|
14
|
+
const _excluded = ["children", "className", "active", "onClick", "reflection", "maxParallax"];
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
17
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -19,21 +19,21 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
19
19
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
20
20
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
21
21
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
22
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
23
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0)
|
|
22
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
23
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
24
24
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
25
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
26
26
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
27
|
-
|
|
27
|
+
const MAXIMUM_PARALLAX = {
|
|
28
28
|
x: 20,
|
|
29
29
|
y: 20
|
|
30
30
|
};
|
|
31
31
|
function calculateDistanceRelativeToBounds(mousePosition, elementInitialPosition, elementSizeDimension) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
const normalizeInitialPosition = mousePosition - elementInitialPosition;
|
|
33
|
+
const doNotAllowGoingBeyondLowerLimit = Math.max(normalizeInitialPosition, 0);
|
|
34
|
+
const doNotAllowHoingBeyondHigherLimit = Math.min(doNotAllowGoingBeyondLowerLimit, elementSizeDimension);
|
|
35
|
+
const threeRule = doNotAllowHoingBeyondHigherLimit * 100 / elementSizeDimension;
|
|
36
|
+
const result = Math.round(threeRule) / 100;
|
|
37
37
|
return result;
|
|
38
38
|
}
|
|
39
39
|
function givenTheRelativePositionHowMuchToRotate(relativePosition, maxRotation) {
|
|
@@ -43,7 +43,7 @@ function givenTheRelativePositionHowMuchToRotate(relativePosition, maxRotation)
|
|
|
43
43
|
* It holds a children and animates it according to mouse position
|
|
44
44
|
**/
|
|
45
45
|
function Parallax(_ref, ref) {
|
|
46
|
-
|
|
46
|
+
let children = _ref.children,
|
|
47
47
|
_ref$className = _ref.className,
|
|
48
48
|
className = _ref$className === void 0 ? "" : _ref$className,
|
|
49
49
|
active = _ref.active,
|
|
@@ -52,13 +52,13 @@ function Parallax(_ref, ref) {
|
|
|
52
52
|
_ref$maxParallax = _ref.maxParallax,
|
|
53
53
|
maxParallax = _ref$maxParallax === void 0 ? MAXIMUM_PARALLAX : _ref$maxParallax,
|
|
54
54
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
const parallaxableRef = (0, _react.useRef)(null);
|
|
56
|
+
const reflectionRef = (0, _react.useRef)(null);
|
|
57
|
+
const multiplierRef = (0, _react.useRef)(1);
|
|
58
|
+
const initialPositionRef = (0, _react.useRef)();
|
|
59
59
|
(0, _react.useEffect)(function () {
|
|
60
60
|
if (ref) ref.current = parallaxableRef.current;
|
|
61
|
-
|
|
61
|
+
const el = parallaxableRef.current;
|
|
62
62
|
if (active && !initialPositionRef.current) {
|
|
63
63
|
initialPositionRef.current = getComputedStyle(el).transform;
|
|
64
64
|
if (initialPositionRef.current === "none") initialPositionRef.current = "";
|
|
@@ -67,11 +67,11 @@ function Parallax(_ref, ref) {
|
|
|
67
67
|
// eslint-disable-next-line
|
|
68
68
|
}, [active]);
|
|
69
69
|
(0, _react.useEffect)(function () {
|
|
70
|
-
|
|
70
|
+
const el = parallaxableRef.current;
|
|
71
71
|
if (active) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
const updatePositions = function updatePositions(relativeToX, relativeToY) {
|
|
73
|
+
const rect = el.getBoundingClientRect();
|
|
74
|
+
const _width$height = {
|
|
75
75
|
width: [rect.left, el.clientWidth],
|
|
76
76
|
height: [rect.top, el.clientHeight]
|
|
77
77
|
},
|
|
@@ -81,12 +81,12 @@ function Parallax(_ref, ref) {
|
|
|
81
81
|
_width$height$height = _slicedToArray(_width$height.height, 2),
|
|
82
82
|
y0 = _width$height$height[0],
|
|
83
83
|
yH = _width$height$height[1];
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
const distanceOffRight = calculateDistanceRelativeToBounds(relativeToX, x0, xW);
|
|
85
|
+
const distanceOffBottom = calculateDistanceRelativeToBounds(relativeToY, y0, yH);
|
|
86
|
+
const howMuchToRotateY = givenTheRelativePositionHowMuchToRotate(distanceOffRight, maxParallax.y) * multiplierRef.current;
|
|
87
|
+
const howMuchToRotateX = givenTheRelativePositionHowMuchToRotate(distanceOffBottom, maxParallax.x) * multiplierRef.current;
|
|
88
|
+
const howMuchToOpacify = Math.abs(Math.abs(distanceOffBottom - 0.5) / 0.5);
|
|
89
|
+
const howMuchToOpacifyHorizontal = Math.max(Math.abs(Math.abs(distanceOffRight - 0.5) / 0.5), Math.abs(Math.abs(distanceOffBottom - 0.5) / 0.5));
|
|
90
90
|
el.style.transform = "".concat(initialPositionRef.current, " rotateY(").concat(howMuchToRotateY, "deg) rotateX(").concat(-howMuchToRotateX, "deg) translateZ(").concat(multiplierRef.current === 1 ? 0 : -30, "px)");
|
|
91
91
|
if (reflectionRef.current) {
|
|
92
92
|
reflectionRef.current.style.left = "".concat((1 - distanceOffRight) * 100, "%");
|
|
@@ -94,45 +94,45 @@ function Parallax(_ref, ref) {
|
|
|
94
94
|
reflectionRef.current.style.opacity = "".concat(Math.min(howMuchToOpacify, howMuchToOpacifyHorizontal));
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
const handler = (0, _lodash.throttle)(function (_ref2) {
|
|
98
|
+
let x = _ref2.x,
|
|
99
99
|
y = _ref2.y;
|
|
100
100
|
updatePositions(x, y);
|
|
101
101
|
}, 1000 / 30);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
const touchHandler = (0, _lodash.throttle)(function (_ref3) {
|
|
103
|
+
let touches = _ref3.touches;
|
|
104
|
+
const _touches$ = touches[0],
|
|
105
105
|
pageX = _touches$.pageX,
|
|
106
106
|
pageY = _touches$.pageY;
|
|
107
107
|
updatePositions(pageX, pageY);
|
|
108
108
|
}, 1000 / 30);
|
|
109
|
-
|
|
109
|
+
const mouseDownHandler = function mouseDownHandler() {
|
|
110
110
|
multiplierRef.current = 1.5;
|
|
111
111
|
};
|
|
112
|
-
|
|
112
|
+
const mouseUpHandler = function mouseUpHandler() {
|
|
113
113
|
multiplierRef.current = 1;
|
|
114
114
|
};
|
|
115
115
|
window.addEventListener("mousemove", handler);
|
|
116
116
|
window.addEventListener("touchmove", touchHandler);
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
let _inverseMatrix;
|
|
118
|
+
const _limits = {
|
|
119
119
|
beta: undefined,
|
|
120
120
|
gamma: undefined
|
|
121
121
|
};
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
const orientationListener = function orientationListener(_ref4) {
|
|
123
|
+
let beta = _ref4.beta,
|
|
124
124
|
gamma = _ref4.gamma;
|
|
125
125
|
beta = beta * 0.5;
|
|
126
126
|
gamma = gamma * 0.5;
|
|
127
127
|
if (!_inverseMatrix) {
|
|
128
128
|
window.removeEventListener("mousemove", handler);
|
|
129
129
|
window.removeEventListener("touchmove", touchHandler);
|
|
130
|
-
|
|
130
|
+
const offset = 12.5;
|
|
131
131
|
_limits.beta = [beta - offset, beta + offset];
|
|
132
132
|
_limits.gamma = [gamma - offset, gamma + offset];
|
|
133
133
|
}
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
const _beta = Math.min(_limits.beta[1], Math.max(_limits.beta[0], beta));
|
|
135
|
+
const _gamma = Math.min(_limits.gamma[1], Math.max(_limits.gamma[0], gamma));
|
|
136
136
|
if (!_inverseMatrix) {
|
|
137
137
|
_inverseMatrix = (0, _helpers.flattenMatrix)((0, _helpers.invertMatrix)((0, _helpers.generateMatrixFromOperations)({
|
|
138
138
|
type: "rotateY",
|
|
@@ -13,7 +13,7 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
|
|
|
13
13
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
14
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
15
15
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
16
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
16
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
17
17
|
function IDENTITY_MATRIX() {
|
|
18
18
|
return [[1, 0, 0, 0],
|
|
19
19
|
// cos, -sin, ?
|
|
@@ -24,17 +24,16 @@ function IDENTITY_MATRIX() {
|
|
|
24
24
|
[0, 0, 0, 1]];
|
|
25
25
|
}
|
|
26
26
|
function generateMatrixFromOperations() {
|
|
27
|
-
|
|
27
|
+
let resultingMatrix = undefined;
|
|
28
28
|
for (var _len = arguments.length, operations = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
29
29
|
operations[_key] = arguments[_key];
|
|
30
30
|
}
|
|
31
|
-
for (
|
|
32
|
-
|
|
33
|
-
var matrix = operation.type === "matrix" ? operation.matrix : IDENTITY_MATRIX();
|
|
31
|
+
for (let operation of operations) {
|
|
32
|
+
const matrix = operation.type === "matrix" ? operation.matrix : IDENTITY_MATRIX();
|
|
34
33
|
switch (operation.type) {
|
|
35
34
|
case "perspective":
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
const f = Math.tan(Math.PI * 0.5 - 0.5 * operation.fieldOfViewInRadians);
|
|
36
|
+
const rangeInv = 1.0 / (operation.near - operation.far);
|
|
38
37
|
matrix[0][0] = f / operation.aspect;
|
|
39
38
|
matrix[1][1] = f;
|
|
40
39
|
matrix[2][2] = (operation.near + operation.far) * rangeInv;
|
|
@@ -50,9 +49,9 @@ function generateMatrixFromOperations() {
|
|
|
50
49
|
case "rotateX":
|
|
51
50
|
case "rotateY":
|
|
52
51
|
case "rotateZ":
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
const angleToRadians = operation.angle * Math.PI / 180;
|
|
53
|
+
const sinAngle = Math.sin(angleToRadians);
|
|
54
|
+
const cosAngle = Math.cos(angleToRadians);
|
|
56
55
|
switch (operation.type) {
|
|
57
56
|
case "rotateZ":
|
|
58
57
|
matrix[0][0] = cosAngle;
|
|
@@ -89,14 +88,14 @@ function generateMatrixFromOperations() {
|
|
|
89
88
|
return resultingMatrix || IDENTITY_MATRIX();
|
|
90
89
|
}
|
|
91
90
|
function multiplyMatrixes(matrix1, matrix2) {
|
|
92
|
-
|
|
91
|
+
const resultingMatrix = [];
|
|
93
92
|
if (process.env.NODE_ENV === "development" && matrix2.length !== matrix1[0].length) {
|
|
94
93
|
throw new Error("For the multiplication of matrixes to work you need to provide the matrix1 containing the amount of columns as the same amount of rows from matrix 2.\nYou provided ".concat(matrix1[0].length, " columns and ").concat(matrix2.length, " rows"));
|
|
95
94
|
}
|
|
96
|
-
for (
|
|
97
|
-
for (
|
|
98
|
-
|
|
99
|
-
for (
|
|
95
|
+
for (let i0 in matrix1) {
|
|
96
|
+
for (let i in matrix2[0]) {
|
|
97
|
+
let dimensionResult = 0;
|
|
98
|
+
for (let i2 in matrix1[0]) {
|
|
100
99
|
dimensionResult += matrix1[i0][i2] * matrix2[i2][i];
|
|
101
100
|
}
|
|
102
101
|
if (!resultingMatrix[i0]) resultingMatrix[i0] = [];
|
|
@@ -106,9 +105,9 @@ function multiplyMatrixes(matrix1, matrix2) {
|
|
|
106
105
|
return resultingMatrix;
|
|
107
106
|
}
|
|
108
107
|
function invertMatrix(matrix) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
const m = flattenMatrix(matrix);
|
|
109
|
+
let det = 0;
|
|
110
|
+
const inv = [];
|
|
112
111
|
inv[0] = m[5] * m[10] * m[15] - m[5] * m[11] * m[14] - m[9] * m[6] * m[15] + m[9] * m[7] * m[14] + m[13] * m[6] * m[11] - m[13] * m[7] * m[10];
|
|
113
112
|
inv[4] = -m[4] * m[10] * m[15] + m[4] * m[11] * m[14] + m[8] * m[6] * m[15] - m[8] * m[7] * m[14] - m[12] * m[6] * m[11] + m[12] * m[7] * m[10];
|
|
114
113
|
inv[8] = m[4] * m[9] * m[15] - m[4] * m[11] * m[13] - m[8] * m[5] * m[15] + m[8] * m[7] * m[13] + m[12] * m[5] * m[11] - m[12] * m[7] * m[9];
|
|
@@ -129,7 +128,7 @@ function invertMatrix(matrix) {
|
|
|
129
128
|
if (det === 0) throw new Error("Determinator is equal to 0. This matrix cannot be inverted");
|
|
130
129
|
det = 1.0 / det;
|
|
131
130
|
return inv.reduce(function (r, val, i) {
|
|
132
|
-
|
|
131
|
+
const row = Math.floor(i / 4);
|
|
133
132
|
if (!r[row]) r[row] = [];
|
|
134
133
|
r[row][i % 4] = val * det;
|
|
135
134
|
return r;
|
|
@@ -37,7 +37,7 @@ declare const _default: React.ForwardRefExoticComponent<(({
|
|
|
37
37
|
Icon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
38
38
|
onChange?: React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
|
|
39
39
|
containerProps?: Omit<React.HTMLProps<HTMLDivElement>, "ref"> | undefined;
|
|
40
|
-
} & Omit<React.HTMLProps<HTMLInputElement | HTMLTextAreaElement>, "ref" | "onChange"> & React.RefAttributes<any>, "
|
|
40
|
+
} & Omit<React.HTMLProps<HTMLInputElement | HTMLTextAreaElement>, "ref" | "onChange"> & React.RefAttributes<any>, "ref" | "onChange" | "value">) & React.RefAttributes<{
|
|
41
41
|
validatePassword: (pass: string) => boolean;
|
|
42
42
|
}>>;
|
|
43
43
|
export default _default;
|
|
@@ -16,21 +16,21 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
16
16
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
17
17
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
18
18
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
19
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
20
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0)
|
|
19
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
20
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
21
21
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
22
|
-
|
|
22
|
+
const BASE_VALIDATION = [{
|
|
23
23
|
code: "size",
|
|
24
24
|
validate: function validate(pass) {
|
|
25
25
|
return pass.length >= 8;
|
|
26
26
|
}
|
|
27
27
|
}];
|
|
28
|
-
|
|
28
|
+
const RULES = [{
|
|
29
29
|
code: "duplication",
|
|
30
30
|
validate: function validate(pass) {
|
|
31
|
-
for (
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
for (let i = 0; i < pass.length; i++) {
|
|
32
|
+
const charCode = pass.charCodeAt(i);
|
|
33
|
+
const firstNext = pass.charCodeAt(i + 1) || 0,
|
|
34
34
|
secondNext = pass.charCodeAt(i + 2) || 0;
|
|
35
35
|
if (firstNext - charCode === 1 && secondNext - firstNext === 1) {
|
|
36
36
|
return false;
|
|
@@ -44,11 +44,11 @@ var RULES = [{
|
|
|
44
44
|
* A Input based wrapper to handle inputing of password
|
|
45
45
|
**/
|
|
46
46
|
function PasswordInput(props, ref) {
|
|
47
|
-
|
|
47
|
+
const _useState = (0, _react.useState)(false),
|
|
48
48
|
_useState2 = _slicedToArray(_useState, 2),
|
|
49
49
|
isPasswordVisibile = _useState2[0],
|
|
50
50
|
setIPV = _useState2[1];
|
|
51
|
-
|
|
51
|
+
const _useOneUIConfig = (0, _OneUIProvider.useOneUIConfig)("component.passwordInput.iconSrc"),
|
|
52
52
|
passwordHidden = _useOneUIConfig.passwordHidden,
|
|
53
53
|
passwordVisible = _useOneUIConfig.passwordVisible;
|
|
54
54
|
function _validatePassword(password) {
|
|
@@ -73,7 +73,7 @@ function PasswordInput(props, ref) {
|
|
|
73
73
|
};
|
|
74
74
|
});
|
|
75
75
|
function _onChange(e) {
|
|
76
|
-
|
|
76
|
+
const password = e.target.value;
|
|
77
77
|
switch (props.mode) {
|
|
78
78
|
case "comparision":
|
|
79
79
|
case "creation":
|
|
@@ -13,33 +13,33 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
15
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const HOW_MUCH_PIXELS_TO_SCROLL_PER_SECOND = 50;
|
|
17
|
+
const RIGHT_TEXT_MULTIPLIER = 5;
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* A component that keeps an overflow piece of text visible by continously scrolling it back and forward
|
|
21
21
|
**/
|
|
22
22
|
function PingPongText(_ref) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
let props = _extends({}, _ref);
|
|
24
|
+
const textRef = (0, _react.useRef)(null);
|
|
25
|
+
const _useMouseHover = (0, _useMouseHover2.default)(),
|
|
26
26
|
uiEvents = _useMouseHover.uiEvents,
|
|
27
27
|
hovering = _useMouseHover.hovering;
|
|
28
28
|
(0, _react.useEffect)(function () {
|
|
29
29
|
if (!hovering) {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
let scrollingInterval;
|
|
31
|
+
let scrollStartTimeout;
|
|
32
32
|
scrollStartTimeout = setTimeout(function () {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
const textEl = textRef.current;
|
|
34
|
+
const overflowWidth = textEl.scrollWidth;
|
|
35
|
+
const viewWidth = textEl.clientWidth;
|
|
36
|
+
const secondsPerFrame = 1000 / 60;
|
|
37
|
+
const howMuchToMove = secondsPerFrame * HOW_MUCH_PIXELS_TO_SCROLL_PER_SECOND / 1000;
|
|
38
38
|
if (overflowWidth > viewWidth) {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
let scrollText = function scrollText() {
|
|
40
|
+
let direction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "r";
|
|
41
41
|
return setInterval(function () {
|
|
42
|
-
|
|
42
|
+
const reachedEnd = direction === "r" ? textEl.scrollLeft >= overflowWidth - viewWidth : textEl.scrollLeft === 0;
|
|
43
43
|
if (reachedEnd) {
|
|
44
44
|
clearInterval(scrollingInterval);
|
|
45
45
|
scrollStartTimeout = setTimeout(function () {
|