@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.
Files changed (124) hide show
  1. package/.babelrc +6 -0
  2. package/.prod.babelrc +8 -2
  3. package/dist/assets/styles/variables.scss +1 -0
  4. package/dist/components/AdaptiveButton/AdaptiveButton.js +2 -2
  5. package/dist/components/AdaptiveContainer/AdaptiveContainer.js +28 -26
  6. package/dist/components/AdaptiveContainer/AdaptiveContainer.module.scss +3 -1
  7. package/dist/components/AdaptiveDialog/AdaptiveDialog.js +9 -9
  8. package/dist/components/AdaptiveSidebar/AdaptiveSidebar.js +14 -14
  9. package/dist/components/AnchoredTooltip/AnchoredTooltip.js +30 -30
  10. package/dist/components/AnimatedEntrance/AnimatedEntrance.d.ts +1 -1
  11. package/dist/components/AnimatedEntrance/AnimatedEntrance.js +34 -45
  12. package/dist/components/AsyncWrapper/AsyncWrapper.js +2 -2
  13. package/dist/components/Avatar/Avatar.js +4 -4
  14. package/dist/components/BucketFill/BucketFill.js +9 -9
  15. package/dist/components/Button/Button.js +4 -4
  16. package/dist/components/Card/Card.js +1 -1
  17. package/dist/components/Chart/Chart.view.js +34 -34
  18. package/dist/components/CheckBox/CheckBox.js +3 -3
  19. package/dist/components/Collapsable/Collapsable.js +18 -18
  20. package/dist/components/Countdown/Countdown.js +16 -16
  21. package/dist/components/Divider/Divider.js +1 -1
  22. package/dist/components/EmailInput/EmailInput.d.ts +1 -1
  23. package/dist/components/EmailInput/EmailInput.js +4 -4
  24. package/dist/components/FadeIn/FadeIn.js +9 -9
  25. package/dist/components/FileInput/FileInput.js +6 -6
  26. package/dist/components/FileInput/View/BigFactory/BigFactory.js +1 -1
  27. package/dist/components/FileInput/View/Compact/Compact.js +6 -6
  28. package/dist/components/FlowController/FlowController.js +4 -4
  29. package/dist/components/Form/Form.js +17 -28
  30. package/dist/components/Freeze/Freeze.js +1 -1
  31. package/dist/components/HSForms/HSForms.js +9 -11
  32. package/dist/components/Header/Header.js +7 -7
  33. package/dist/components/HeaderCloseBtn/HeaderCloseBtn.js +1 -1
  34. package/dist/components/InfinityScroll/InfinityScroll.js +25 -25
  35. package/dist/components/Input/Input.js +13 -13
  36. package/dist/components/InstantCounter/InstantCounter.js +9 -9
  37. package/dist/components/LavaLamp/LavaLamp.data.js +25 -25
  38. package/dist/components/LavaLamp/LavaLamp.js +7 -7
  39. package/dist/components/LavaLamp/v2/LavaLamp.js +29 -45
  40. package/dist/components/LinkToId/LinkToId.js +7 -7
  41. package/dist/components/Loader/Loader.js +2 -2
  42. package/dist/components/LoaderDotsIndicator/LoaderDotsIndicator.js +6 -6
  43. package/dist/components/LoopableVideo/LoopableVideo.js +4 -4
  44. package/dist/components/MainGrid/MainGrid.js +2 -2
  45. package/dist/components/MutableHamburgerButton/MutableHamburgerButton.js +2 -2
  46. package/dist/components/Notification/Notification.js +1 -1
  47. package/dist/components/OrderableList/OrderableList.js +113 -138
  48. package/dist/components/PaginationIndicator/PaginationIndicator.js +50 -50
  49. package/dist/components/Parallax/Parallax.js +39 -39
  50. package/dist/components/Parallax/math/helpers.js +18 -19
  51. package/dist/components/PasswordInput/PasswordInput.d.ts +1 -1
  52. package/dist/components/PasswordInput/PasswordInput.js +10 -10
  53. package/dist/components/PingPongText/PingPongText.js +15 -15
  54. package/dist/components/PixelatedScan/PixelatedScan.js +19 -19
  55. package/dist/components/Portal/Portal.js +10 -10
  56. package/dist/components/ProgressBar/ProgressBar.js +6 -6
  57. package/dist/components/ProgressTexts/ProgressTexts.js +3 -3
  58. package/dist/components/Radio/Radio.js +3 -3
  59. package/dist/components/SectionContainer/SectionContainer.js +1 -1
  60. package/dist/components/Select/Select.js +13 -13
  61. package/dist/components/Select/Select.module.scss +8 -5
  62. package/dist/components/Skeleton/Skeleton.js +1 -1
  63. package/dist/components/Spacing/Spacing.js +1 -1
  64. package/dist/components/StaticScroller/StaticScroller.js +12 -12
  65. package/dist/components/Switch/Switch.js +2 -2
  66. package/dist/components/Table/Table.js +11 -11
  67. package/dist/components/Tabs/Tabs.d.ts +6 -1
  68. package/dist/components/Tabs/Tabs.js +28 -9
  69. package/dist/components/Tabs/Tabs.module.scss +20 -2
  70. package/dist/components/Text/Text.js +5 -5
  71. package/dist/components/Transition/MasksFactory/DiagonalReveal.js +5 -5
  72. package/dist/components/Transition/MasksFactory/DiagonalSquareToBalls.js +17 -17
  73. package/dist/components/Transition/MasksFactory/PhysicsSquares.js +13 -13
  74. package/dist/components/Transition/MasksFactory/SquareToBalls.js +9 -9
  75. package/dist/components/Transition/MasksFactory/utils.js +8 -8
  76. package/dist/components/Transition/Transition.js +49 -49
  77. package/dist/components/UncontrolledTransition/UncontrolledTransition.js +7 -7
  78. package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.js +44 -82
  79. package/dist/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.js +6 -6
  80. package/dist/context/AsyncProcess.js +19 -42
  81. package/dist/context/CustomBrowserRouter.js +6 -6
  82. package/dist/context/OneUIProvider.js +15 -15
  83. package/dist/hooks/logs/useDependencyChangeDetection.js +2 -5
  84. package/dist/hooks/persistence/useLocalStorage.js +7 -7
  85. package/dist/hooks/shims/ObjectWatchShim.js +1 -15
  86. package/dist/hooks/ui/useAdaptiveImage.js +6 -6
  87. package/dist/hooks/ui/useBreakpoint.js +5 -5
  88. package/dist/hooks/ui/useCustomScrollbar.js +2 -2
  89. package/dist/hooks/ui/useMouseHover.js +4 -4
  90. package/dist/hooks/ui/usePaginationControls.js +34 -34
  91. package/dist/hooks/ui/useSnapToViewport.js +3 -3
  92. package/dist/hooks/ui/useTilt.js +38 -38
  93. package/dist/hooks/ui/useZoomable.js +20 -20
  94. package/dist/hooks/useAsyncControl.js +21 -38
  95. package/dist/hooks/useContainedRepositioning.js +22 -22
  96. package/dist/hooks/useCustomHistory.js +2 -2
  97. package/dist/hooks/useElementFit.js +6 -6
  98. package/dist/hooks/useFirestoreWatch.js +26 -39
  99. package/dist/hooks/useForm.js +8 -8
  100. package/dist/hooks/useFreeze.js +1 -1
  101. package/dist/hooks/useHero.d.ts +1 -0
  102. package/dist/hooks/useHero.js +132 -91
  103. package/dist/hooks/useHero.module.scss +7 -0
  104. package/dist/hooks/useIntersection.js +3 -3
  105. package/dist/hooks/useMergeRefs.js +3 -7
  106. package/dist/hooks/useObserve.js +5 -5
  107. package/dist/hooks/usePagination.js +39 -59
  108. package/dist/hooks/usePooledOperation.js +8 -22
  109. package/dist/hooks/usePooling.js +17 -33
  110. package/dist/hooks/useRebound.js +5 -5
  111. package/dist/hooks/useShortIntl.js +13 -13
  112. package/dist/hooks/utility/useEvents.js +5 -5
  113. package/dist/hooks/utility/useModule.js +3 -3
  114. package/dist/hooks/utility/useQuery.js +1 -1
  115. package/dist/models/DebugLogger.js +2 -2
  116. package/dist/models/GenericContract.js +1 -1
  117. package/dist/storybookUtils/index.js +1 -1
  118. package/dist/types.d.ts +11 -4
  119. package/dist/utility.d.js +3 -3
  120. package/dist/utils/blockchain.js +29 -102
  121. package/dist/utils/flatten.js +3 -3
  122. package/dist/utils/html.utils.js +1 -1
  123. package/package.json +2 -1
  124. package/src/types.ts +155 -41
@@ -12,43 +12,43 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
12
12
  * If it is, it should move it so it can be totally visible inside the container
13
13
  */
14
14
  function useContainedRepositioning(focused, getParent) {
15
- var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
15
+ let _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
16
16
  _ref$offset = _ref.offset,
17
17
  offset = _ref$offset === void 0 ? 16 : _ref$offset,
18
18
  _ref$scale = _ref.scale,
19
19
  scale = _ref$scale === void 0 ? 1 : _ref$scale,
20
20
  _ref$offsetLimit = _ref.offsetLimit,
21
21
  offsetLimit = _ref$offsetLimit === void 0 ? Number.POSITIVE_INFINITY : _ref$offsetLimit;
22
- var elementToCheck = (0, _react.useRef)(null);
22
+ const elementToCheck = (0, _react.useRef)(null);
23
23
  (0, _react.useEffect)(function () {
24
- var el = elementToCheck.current;
24
+ const el = elementToCheck.current;
25
25
  if (!el) return;
26
- var curr = el;
27
- var relativeParent = getParent(curr);
26
+ const curr = el;
27
+ const relativeParent = getParent(curr);
28
28
  if (process.env.NODE_ENV === "development") {
29
29
  if (window.getComputedStyle(el).position !== "relative") throw new Error("The target element MUST have position relative so it can be moved");
30
30
  if (window.getComputedStyle(relativeParent).position !== "relative") throw new Error("The relative to element MUST have position relative so it can calculate correctly the target position");
31
31
  }
32
32
  if (focused) {
33
33
  curr.style.right = "0px";
34
- var reposition = (0, _debounce.default)(function () {
35
- var alreadyRight = Number(curr.style.right.replace("px", ""));
36
- var limitOffset = relativeParent.scrollLeft + relativeParent.clientWidth;
37
- var elWidth = curr.clientWidth * scale;
38
- var offsetOfScale = (elWidth - curr.clientWidth) / 2;
39
- var cardLimit = curr.offsetLeft - offsetOfScale + alreadyRight + elWidth;
40
- var exceedingSpace = cardLimit - limitOffset;
41
- var offsetLeft = curr.offsetLeft - offsetOfScale + alreadyRight - relativeParent.scrollLeft;
42
- var isOverflowedRight = exceedingSpace > 0;
43
- var isOverflowedLeft = offsetLeft < 0;
44
- var limit = exceedingSpace + -offsetLeft;
34
+ const reposition = (0, _debounce.default)(function () {
35
+ const alreadyRight = Number(curr.style.right.replace("px", ""));
36
+ const limitOffset = relativeParent.scrollLeft + relativeParent.clientWidth;
37
+ const elWidth = curr.clientWidth * scale;
38
+ const offsetOfScale = (elWidth - curr.clientWidth) / 2;
39
+ const cardLimit = curr.offsetLeft - offsetOfScale + alreadyRight + elWidth;
40
+ const exceedingSpace = cardLimit - limitOffset;
41
+ const offsetLeft = curr.offsetLeft - offsetOfScale + alreadyRight - relativeParent.scrollLeft;
42
+ const isOverflowedRight = exceedingSpace > 0;
43
+ const isOverflowedLeft = offsetLeft < 0;
44
+ const limit = exceedingSpace + -offsetLeft;
45
45
  if (isOverflowedRight) {
46
- var val = Math.min(exceedingSpace - -Math.min(Math.abs(limit / 2), offset), offsetLimit);
46
+ const val = Math.min(exceedingSpace - -Math.min(Math.abs(limit / 2), offset), offsetLimit);
47
47
  curr.style.right = "".concat(val, "px");
48
48
  }
49
49
  if (isOverflowedLeft) {
50
- var _val = Math.max(offsetLeft - Math.min(Math.abs(limit) / 2, offset), -offsetLimit);
51
- curr.style.right = "".concat(_val, "px");
50
+ const val = Math.max(offsetLeft - Math.min(Math.abs(limit) / 2, offset), -offsetLimit);
51
+ curr.style.right = "".concat(val, "px");
52
52
  }
53
53
  if (isOverflowedLeft || isOverflowedRight) {
54
54
  curr.style.zIndex = "1000";
@@ -63,10 +63,10 @@ function useContainedRepositioning(focused, getParent) {
63
63
  reposition.cancel();
64
64
  relativeParent.removeEventListener("scroll", reposition);
65
65
  el.style.right = "0px";
66
- var restore = function restore(_ref2) {
67
- var propertyName = _ref2.propertyName,
66
+ const restore = function restore(_ref2) {
67
+ let propertyName = _ref2.propertyName,
68
68
  currentTarget = _ref2.currentTarget;
69
- var targetTransformation = window.getComputedStyle(currentTarget).right;
69
+ const targetTransformation = window.getComputedStyle(currentTarget).right;
70
70
  if (propertyName === "right" && targetTransformation === "0px") {
71
71
  curr.style.zIndex = "";
72
72
  el.removeEventListener("transitionend", restore);
@@ -12,8 +12,8 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
12
12
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
13
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
14
14
  function useCustomHistory() {
15
- var customHistory = (0, _reactRouterDom.useHistory)();
16
- var _useLocation = (0, _reactRouterDom.useLocation)(),
15
+ const customHistory = (0, _reactRouterDom.useHistory)();
16
+ const _useLocation = (0, _reactRouterDom.useLocation)(),
17
17
  state = _useLocation.state;
18
18
  return _objectSpread(_objectSpread({}, customHistory), {}, {
19
19
  goBackWithFallback: function goBackWithFallback(fallbackRoute) {
@@ -8,8 +8,8 @@ var _react = require("react");
8
8
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
9
  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."); }
10
10
  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); }
11
- 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; }
12
- 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; } }
11
+ 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; }
12
+ 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; } }
13
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
14
  /**
15
15
  * This hook receives a base width of an element and returns how much items fit **vertically** inside the referenced html element
@@ -17,7 +17,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
17
  * @param baseWidth The base width of each element
18
18
  */
19
19
  function useElementFit(baseWidth, baseHeight) {
20
- var ref = (0, _react.useRef)(null);
20
+ const ref = (0, _react.useRef)(null);
21
21
  function calculateDimension() {
22
22
  var _ref$current, _ref$current2;
23
23
  function fittingRows() {
@@ -25,12 +25,12 @@ function useElementFit(baseWidth, baseHeight) {
25
25
  return Math.ceil(ref.current.clientHeight / baseHeight);
26
26
  }
27
27
  if (window.PRERENDER) return 4;
28
- var width = ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.clientWidth) || window.visualViewport.width;
29
- var maxItemsVertically = Math.floor(width / baseWidth) || 1;
28
+ const width = ((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.clientWidth) || window.visualViewport.width;
29
+ const maxItemsVertically = Math.floor(width / baseWidth) || 1;
30
30
  if (process.env.NODE_ENV === "development") require('../models/DebugLogger').default("".concat(useElementFit.name, ":clientWidth"), (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.clientWidth);
31
31
  return maxItemsVertically * fittingRows();
32
32
  }
33
- var _useState = (0, _react.useState)(window.PRERENDER ? 4 : undefined),
33
+ const _useState = (0, _react.useState)(window.PRERENDER ? 4 : undefined),
34
34
  _useState2 = _slicedToArray(_useState, 2),
35
35
  itemsToShow = _useState2[0],
36
36
  setItemsToShow = _useState2[1];
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = useFirestoreWatch;
7
7
  var _react = require("react");
8
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
9
8
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
10
9
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
10
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
@@ -13,53 +12,41 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
13
12
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
14
13
  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."); }
15
14
  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); }
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
- 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
+ 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; }
16
+ 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; } }
18
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
19
18
  function useFirestoreWatch(queryFactory, params) {
20
- var _useState = (0, _react.useState)(),
19
+ const _useState = (0, _react.useState)(),
21
20
  _useState2 = _slicedToArray(_useState, 2),
22
21
  docsList = _useState2[0],
23
22
  updateList = _useState2[1];
24
23
  (0, _react.useEffect)(function () {
25
- var unsub = queryFactory.apply(void 0, _toConsumableArray(params))(function (changes) {
24
+ const unsub = queryFactory.apply(void 0, _toConsumableArray(params))(function (changes) {
26
25
  updateList(function () {
27
- var prevList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
28
- var _iterator = _createForOfIteratorHelper(changes),
29
- _step;
30
- try {
31
- var _loop = function _loop() {
32
- var docChange = _step.value;
33
- switch (docChange.type) {
34
- case 'added':
35
- if (!prevList.find(function (f) {
36
- return f.id === docChange.doc.id;
37
- })) {
38
- prevList.unshift(docChange.doc);
26
+ let prevList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
27
+ for (let docChange of changes) {
28
+ switch (docChange.type) {
29
+ case 'added':
30
+ if (!prevList.find(function (f) {
31
+ return f.id === docChange.doc.id;
32
+ })) {
33
+ prevList.unshift(docChange.doc);
34
+ }
35
+ break;
36
+ case 'modified':
37
+ prevList = prevList.map(function (item) {
38
+ if (item.id === docChange.doc.id) for (let key in docChange.doc) {
39
+ item[key] = docChange.doc[key];
39
40
  }
40
- break;
41
- case 'modified':
42
- prevList = prevList.map(function (item) {
43
- if (item.id === docChange.doc.id) for (var key in docChange.doc) {
44
- item[key] = docChange.doc[key];
45
- }
46
- return item;
47
- });
48
- break;
49
- case 'removed':
50
- prevList = prevList.filter(function (item) {
51
- return item.id !== docChange.doc.id;
52
- });
53
- break;
54
- }
55
- };
56
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
57
- _loop();
41
+ return item;
42
+ });
43
+ break;
44
+ case 'removed':
45
+ prevList = prevList.filter(function (item) {
46
+ return item.id !== docChange.doc.id;
47
+ });
48
+ break;
58
49
  }
59
- } catch (err) {
60
- _iterator.e(err);
61
- } finally {
62
- _iterator.f();
63
50
  }
64
51
  return _toConsumableArray(prevList);
65
52
  });
@@ -14,28 +14,28 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
14
14
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15
15
  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."); }
16
16
  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); }
17
- 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; }
18
- 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; } }
17
+ 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; }
18
+ 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; } }
19
19
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
20
  function useContextForm(config, initialState) {
21
- var _useState = (0, _react.useState)(initialState),
21
+ const _useState = (0, _react.useState)(initialState),
22
22
  _useState2 = _slicedToArray(_useState, 2),
23
23
  form = _useState2[0],
24
24
  setForm = _useState2[1];
25
- var isValid = (0, _react.useMemo)(function () {
25
+ const isValid = (0, _react.useMemo)(function () {
26
26
  return !Object.keys(config).some(function (a) {
27
27
  return typeof config[a].validator(form[a], form) === "string";
28
28
  });
29
29
  }, [form]);
30
- var _setFormField = function _setFormField(key, value) {
30
+ const _setFormField = function _setFormField(key, value) {
31
31
  setForm(function (prev) {
32
32
  return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, key, value));
33
33
  });
34
34
  };
35
- var validFormFields = (0, _react.useMemo)(function () {
35
+ const validFormFields = (0, _react.useMemo)(function () {
36
36
  return Object.keys(config).reduce(function (result, field) {
37
- var fieldConfig = config[field];
38
- var invalidMessage = fieldConfig.validator(form[field], form);
37
+ const fieldConfig = config[field];
38
+ const invalidMessage = fieldConfig.validator(form[field], form);
39
39
  return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, field, invalidMessage));
40
40
  }, {
41
41
  isValid: isValid
@@ -10,7 +10,7 @@ var _react = require("react");
10
10
  * it returns the previous valid value
11
11
  */
12
12
  function useFreeze(something) {
13
- var currChildOrPrev = (0, _react.useRef)();
13
+ const currChildOrPrev = (0, _react.useRef)();
14
14
  currChildOrPrev.current = something || currChildOrPrev.current;
15
15
  return currChildOrPrev.current || null;
16
16
  }
@@ -56,6 +56,7 @@ export default function useHero(id: string, options?: Partial<{
56
56
  heroRef: React.RefObject<HTMLDivElement>;
57
57
  getHerosOnScreen: () => HTMLDivElement[];
58
58
  trigger: () => void;
59
+ heroComponentRef: (componentId: string) => (elRef: HTMLDivElement | null) => void;
59
60
  };
60
61
  declare type EVENTS_INTERFACE = Parameters<typeof useHero>[2];
61
62
  declare type TRANSITION_TYPES = "ACCELERATION";