@onepercentio/one-ui 0.20.3 → 0.20.4
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 +0 -6
- package/.prod.babelrc +2 -9
- package/dist/components/AdaptiveButton/AdaptiveButton.js +2 -2
- package/dist/components/AdaptiveContainer/AdaptiveContainer.js +26 -26
- 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.js +40 -27
- 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 +35 -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.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 +29 -18
- package/dist/components/Freeze/Freeze.js +1 -1
- package/dist/components/HSForms/HSForms.js +11 -9
- package/dist/components/Header/Header.js +8 -8
- 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 +12 -5
- package/dist/components/LavaLamp/v2/LavaLamp.js +45 -29
- 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 +141 -112
- package/dist/components/PaginationIndicator/PaginationIndicator.js +50 -50
- package/dist/components/Parallax/Parallax.js +39 -39
- package/dist/components/Parallax/math/helpers.js +19 -18
- package/dist/components/PasswordInput/PasswordInput.js +10 -10
- package/dist/components/PingPongText/PingPongText.js +15 -15
- package/dist/components/PixelatedScan/PixelatedScan.js +20 -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/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.js +3 -3
- 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 +82 -44
- package/dist/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.js +6 -6
- package/dist/context/AsyncProcess.js +42 -19
- package/dist/context/CustomBrowserRouter.js +6 -6
- package/dist/context/OneUIProvider.js +15 -15
- package/dist/hooks/logs/useDependencyChangeDetection.js +5 -2
- package/dist/hooks/persistence/useLocalStorage.js +7 -6
- package/dist/hooks/shims/ObjectWatchShim.js +15 -1
- 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.d.ts +2 -1
- package/dist/hooks/ui/usePaginationControls.js +42 -40
- package/dist/hooks/ui/useSnapToViewport.js +3 -3
- package/dist/hooks/ui/useTilt.js +38 -38
- package/dist/hooks/ui/useZoomable.js +46 -38
- package/dist/hooks/ui/useZoomable.module.scss +2 -2
- package/dist/hooks/useAsyncControl.js +39 -22
- 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 +39 -26
- package/dist/hooks/useForm.js +8 -8
- package/dist/hooks/useFreeze.js +1 -1
- package/dist/hooks/useHero.js +90 -78
- package/dist/hooks/useIntersection.js +4 -4
- package/dist/hooks/useMergeRefs.js +7 -3
- package/dist/hooks/useObserve.js +8 -4
- package/dist/hooks/usePagination.js +59 -39
- package/dist/hooks/usePooledOperation.js +22 -8
- package/dist/hooks/usePooling.js +33 -17
- 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/utility.d.js +6 -6
- package/dist/utils/blockchain.js +105 -32
- package/dist/utils/flatten.js +3 -3
- package/dist/utils/html.utils.js +1 -1
- package/package.json +2 -1
- package/dist/hooks/ui/usePaginationControls.e2e.d.ts +0 -4
package/.babelrc
CHANGED
package/.prod.babelrc
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"plugins": [
|
|
3
3
|
["react-remove-properties", { "properties": ["data-testid"] }],
|
|
4
|
-
["remove-object-properties", { "regexp": "data-testid" }]
|
|
5
|
-
"remove-unused-vars"
|
|
4
|
+
["remove-object-properties", { "regexp": "data-testid" }]
|
|
6
5
|
],
|
|
7
6
|
"presets": [
|
|
8
7
|
[
|
|
9
8
|
"@babel/preset-env",
|
|
10
9
|
{
|
|
11
|
-
"targets": "> 0.25%, not dead"
|
|
12
|
-
"exclude": [
|
|
13
|
-
"proposal-dynamic-import",
|
|
14
|
-
"transform-block-scoping",
|
|
15
|
-
"transform-for-of",
|
|
16
|
-
"transform-regenerator"
|
|
17
|
-
]
|
|
10
|
+
"targets": "> 0.25%, not dead"
|
|
18
11
|
}
|
|
19
12
|
],
|
|
20
13
|
"@babel/preset-typescript",
|
|
@@ -8,7 +8,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _AdaptiveContainer = _interopRequireDefault(require("../AdaptiveContainer"));
|
|
9
9
|
var _Button = _interopRequireDefault(require("../Button"));
|
|
10
10
|
var _AdaptiveButtonModule = _interopRequireDefault(require("./AdaptiveButton.module.scss"));
|
|
11
|
-
|
|
11
|
+
var _excluded = ["children", "className"];
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
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); }
|
|
14
14
|
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; }
|
|
@@ -17,7 +17,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
17
17
|
* A button that adapts it's width according to the content size
|
|
18
18
|
**/
|
|
19
19
|
function AdaptiveButton(_ref) {
|
|
20
|
-
|
|
20
|
+
var children = _ref.children,
|
|
21
21
|
_ref$className = _ref.className,
|
|
22
22
|
className = _ref$className === void 0 ? "" : _ref$className,
|
|
23
23
|
buttonProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -9,7 +9,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
var _Transition = require("../Transition");
|
|
10
10
|
var _UncontrolledTransition = _interopRequireDefault(require("../UncontrolledTransition"));
|
|
11
11
|
var _AdaptiveContainerModule = _interopRequireDefault(require("./AdaptiveContainer.module.scss"));
|
|
12
|
-
|
|
12
|
+
var _excluded = ["children", "className", "containerElement", "direction"];
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
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); }
|
|
15
15
|
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; }
|
|
@@ -20,7 +20,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
20
20
|
* A container that animates width changes across content updates
|
|
21
21
|
**/
|
|
22
22
|
function AdaptiveContainer(_ref) {
|
|
23
|
-
|
|
23
|
+
var children = _ref.children,
|
|
24
24
|
_ref$className = _ref.className,
|
|
25
25
|
className = _ref$className === void 0 ? "" : _ref$className,
|
|
26
26
|
_ref$containerElement = _ref.containerElement,
|
|
@@ -28,10 +28,10 @@ function AdaptiveContainer(_ref) {
|
|
|
28
28
|
_ref$direction = _ref.direction,
|
|
29
29
|
direction = _ref$direction === void 0 ? "h" : _ref$direction,
|
|
30
30
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
var uncontrolledRef = (0, _react.useRef)(null);
|
|
32
|
+
var buttonRef = (0, _react.useRef)(null);
|
|
33
33
|
(0, _react.useEffect)(function () {
|
|
34
|
-
|
|
34
|
+
var sectionDiv = uncontrolledRef.current.sectionRef.current;
|
|
35
35
|
if (sectionDiv) if (direction === "h") {
|
|
36
36
|
sectionDiv.style.width = "".concat(sectionDiv.clientWidth, "px");
|
|
37
37
|
sectionDiv.style.height = "";
|
|
@@ -39,38 +39,38 @@ function AdaptiveContainer(_ref) {
|
|
|
39
39
|
sectionDiv.style.height = "".concat(sectionDiv.clientHeight, "px");
|
|
40
40
|
sectionDiv.style.width = "";
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
var t = setTimeout(function () {
|
|
43
43
|
if (uncontrolledRef.current) {
|
|
44
|
-
|
|
45
|
-
if (
|
|
46
|
-
|
|
44
|
+
var _sectionDiv = uncontrolledRef.current.sectionRef.current;
|
|
45
|
+
if (_sectionDiv) {
|
|
46
|
+
var lastChild = _sectionDiv.lastChild;
|
|
47
47
|
if (lastChild) {
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
var resetFactory = function resetFactory(param, target) {
|
|
49
|
+
var instance = function instance(e) {
|
|
50
50
|
if (e.propertyName !== param) return;
|
|
51
51
|
setTimeout(function () {
|
|
52
|
-
if ((
|
|
52
|
+
if ((_sectionDiv === null || _sectionDiv === void 0 ? void 0 : _sectionDiv.style[param]) === "".concat(target, "px")) _sectionDiv.style[param] = "";
|
|
53
53
|
}, 100);
|
|
54
|
-
if (
|
|
54
|
+
if (_sectionDiv) _sectionDiv.removeEventListener("transitionend", instance);
|
|
55
55
|
};
|
|
56
56
|
return instance;
|
|
57
57
|
};
|
|
58
58
|
if (direction === "h") {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (targetWidth ===
|
|
59
|
+
var contentWidth = lastChild.clientWidth;
|
|
60
|
+
var targetWidth = "".concat(contentWidth, "px");
|
|
61
|
+
_sectionDiv.style.width = targetWidth;
|
|
62
|
+
var func = resetFactory("width", contentWidth);
|
|
63
|
+
if (targetWidth === _sectionDiv.style.width) func({
|
|
64
64
|
propertyName: "width"
|
|
65
|
-
});else
|
|
65
|
+
});else _sectionDiv.addEventListener("transitionend", func);
|
|
66
66
|
} else {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (targetHeight ===
|
|
67
|
+
var contentHeight = lastChild.scrollHeight;
|
|
68
|
+
var targetHeight = "".concat(contentHeight, "px");
|
|
69
|
+
_sectionDiv.style.height = targetHeight;
|
|
70
|
+
var _func = resetFactory("height", contentHeight);
|
|
71
|
+
if (targetHeight === _sectionDiv.style.height) _func({
|
|
72
72
|
propertyName: "height"
|
|
73
|
-
});else
|
|
73
|
+
});else _sectionDiv.addEventListener("transitionend", _func);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -80,7 +80,7 @@ function AdaptiveContainer(_ref) {
|
|
|
80
80
|
return clearTimeout(t);
|
|
81
81
|
};
|
|
82
82
|
}, [children.key, direction]);
|
|
83
|
-
|
|
83
|
+
var Wrapper = _Wrapper;
|
|
84
84
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Wrapper, _extends({
|
|
85
85
|
className: "".concat(className),
|
|
86
86
|
ref: buttonRef
|
|
@@ -17,14 +17,14 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
17
17
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
18
|
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."); }
|
|
19
19
|
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); }
|
|
20
|
-
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; }
|
|
21
|
-
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; } }
|
|
20
|
+
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; }
|
|
21
|
+
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; } }
|
|
22
22
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
23
|
/**
|
|
24
24
|
* This component implements a generic drawer that displays it as a drawer on mobile and as a modal on desktop
|
|
25
25
|
**/
|
|
26
26
|
function AdaptiveDialog(_ref) {
|
|
27
|
-
|
|
27
|
+
var onClose = _ref.onClose,
|
|
28
28
|
_ref$open = _ref.open,
|
|
29
29
|
open = _ref$open === void 0 ? false : _ref$open,
|
|
30
30
|
_ref$className = _ref.className,
|
|
@@ -32,19 +32,19 @@ function AdaptiveDialog(_ref) {
|
|
|
32
32
|
onClickOut = _ref.onClickOut,
|
|
33
33
|
children = _ref.children,
|
|
34
34
|
onClosed = _ref.onClosed;
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
var rootDivRef = (0, _react.useRef)(null);
|
|
36
|
+
var _useState = (0, _react.useState)(open),
|
|
37
37
|
_useState2 = _slicedToArray(_useState, 2),
|
|
38
38
|
isVisible = _useState2[0],
|
|
39
39
|
setIsVisible = _useState2[1];
|
|
40
|
-
|
|
40
|
+
var _useState3 = (0, _react.useState)(false),
|
|
41
41
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
42
42
|
expanded = _useState4[0],
|
|
43
43
|
setExpanded = _useState4[1];
|
|
44
44
|
(0, _react.useEffect)(function () {
|
|
45
45
|
if (open) {
|
|
46
46
|
setIsVisible(true);
|
|
47
|
-
|
|
47
|
+
var toggleVisbility = function toggleVisbility(e) {
|
|
48
48
|
if (e.animationName === _AdaptiveDialogModule.default.backdropDismiss) {
|
|
49
49
|
onClosed === null || onClosed === void 0 ? void 0 : onClosed();
|
|
50
50
|
setIsVisible(false);
|
|
@@ -54,7 +54,7 @@ function AdaptiveDialog(_ref) {
|
|
|
54
54
|
rootDivRef.current.addEventListener("animationend", toggleVisbility);
|
|
55
55
|
}
|
|
56
56
|
}, [open]);
|
|
57
|
-
|
|
57
|
+
var globalClassName = {
|
|
58
58
|
backdrop: (0, _OneUIProvider.useOneUIConfig)("component.adaptiveDialog.backdropClassName", ""),
|
|
59
59
|
dialog: (0, _OneUIProvider.useOneUIConfig)("component.adaptiveDialog.dialogClassName", "")
|
|
60
60
|
};
|
|
@@ -63,7 +63,7 @@ function AdaptiveDialog(_ref) {
|
|
|
63
63
|
className: "".concat(_AdaptiveDialogModule.default.backdrop, " ").concat(open ? _AdaptiveDialogModule.default.open : _AdaptiveDialogModule.default.close, " ").concat(expanded ? _AdaptiveDialogModule.default.expanded : "", " ").concat(globalClassName.backdrop),
|
|
64
64
|
onClick: onClickOut,
|
|
65
65
|
onAnimationEnd: function onAnimationEnd(_ref2) {
|
|
66
|
-
|
|
66
|
+
var target = _ref2.target,
|
|
67
67
|
currentTarget = _ref2.currentTarget;
|
|
68
68
|
if (target === currentTarget) target.style.pointerEvents = "initial";
|
|
69
69
|
}
|
|
@@ -12,7 +12,7 @@ var _AdaptiveSidebarModule = _interopRequireDefault(require("./AdaptiveSidebar.m
|
|
|
12
12
|
var _useBreakpoint = _interopRequireDefault(require("../../hooks/ui/useBreakpoint"));
|
|
13
13
|
var _reactDom = require("react-dom");
|
|
14
14
|
var _OneUIProvider = require("../../context/OneUIProvider");
|
|
15
|
-
|
|
15
|
+
var _excluded = ["open", "children", "className", "breakInto", "visibilityControlComponent"];
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
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); }
|
|
18
18
|
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; }
|
|
@@ -20,13 +20,13 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
20
20
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
21
|
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."); }
|
|
22
22
|
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); }
|
|
23
|
-
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; }
|
|
24
|
-
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; } }
|
|
23
|
+
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; }
|
|
24
|
+
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; } }
|
|
25
25
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
26
|
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; }
|
|
27
27
|
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; }
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
var DefaultVisibilityControl = function DefaultVisibilityControl(_ref) {
|
|
29
|
+
var open = _ref.open;
|
|
30
30
|
return /*#__PURE__*/_react.default.createElement(_MutableHamburgerButton.default, {
|
|
31
31
|
size: 48,
|
|
32
32
|
state: open ? "closed" : "default"
|
|
@@ -36,7 +36,7 @@ const DefaultVisibilityControl = function DefaultVisibilityControl(_ref) {
|
|
|
36
36
|
* A component that you can put anywhere but hides when small enough and shows the control via a fixed floating button
|
|
37
37
|
**/
|
|
38
38
|
function AdaptiveSidebar(_ref2, ref) {
|
|
39
|
-
|
|
39
|
+
var externalOpen = _ref2.open,
|
|
40
40
|
children = _ref2.children,
|
|
41
41
|
_ref2$className = _ref2.className,
|
|
42
42
|
className = _ref2$className === void 0 ? "" : _ref2$className,
|
|
@@ -45,15 +45,15 @@ function AdaptiveSidebar(_ref2, ref) {
|
|
|
45
45
|
_ref2$visibilityContr = _ref2.visibilityControlComponent,
|
|
46
46
|
VisibilityControlComponent = _ref2$visibilityContr === void 0 ? DefaultVisibilityControl : _ref2$visibilityContr,
|
|
47
47
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
48
|
-
|
|
48
|
+
var _useState = (0, _react.useState)(false),
|
|
49
49
|
_useState2 = _slicedToArray(_useState, 2),
|
|
50
50
|
open = _useState2[0],
|
|
51
51
|
setOpen = _useState2[1];
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
var containerRef = (0, _react.useRef)(null);
|
|
53
|
+
var _open = externalOpen === undefined ? open : externalOpen;
|
|
54
|
+
var isMobile = (0, _useBreakpoint.default)(breakInto);
|
|
55
|
+
var globalClassName = (0, _OneUIProvider.useOneUIConfig)("component.adaptiveSidebar.className");
|
|
56
|
+
var globalControlClassName = (0, _OneUIProvider.useOneUIConfig)("component.adaptiveSidebar.controlClassName");
|
|
57
57
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
58
58
|
return {
|
|
59
59
|
dismiss: function dismiss() {
|
|
@@ -69,8 +69,8 @@ function AdaptiveSidebar(_ref2, ref) {
|
|
|
69
69
|
top: 0
|
|
70
70
|
});
|
|
71
71
|
}, [_open]);
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
var externalControl = externalOpen !== undefined;
|
|
73
|
+
var content = /*#__PURE__*/_react.default.createElement("div", _extends({
|
|
74
74
|
ref: containerRef,
|
|
75
75
|
className: "".concat(isMobile ? _AdaptiveSidebarModule.default.mobile : _AdaptiveSidebarModule.default.desktop, " ").concat(_AdaptiveSidebarModule.default.container, " ").concat(!externalControl && DefaultVisibilityControl === VisibilityControlComponent ? _AdaptiveSidebarModule.default.defaultPadding : "", " ").concat(_open ? _AdaptiveSidebarModule.default.open : _AdaptiveSidebarModule.default.closed, " ").concat(className, " ").concat(globalClassName)
|
|
76
76
|
}, props), /*#__PURE__*/_react.default.createElement(_ScrollAndFocusLock.default, {
|
|
@@ -11,40 +11,40 @@ var _OneUIProvider = require("../../context/OneUIProvider");
|
|
|
11
11
|
var _FadeIn = _interopRequireDefault(require("../FadeIn"));
|
|
12
12
|
var _AnchoredTooltipModule = _interopRequireDefault(require("./AnchoredTooltip.module.scss"));
|
|
13
13
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
14
|
-
|
|
14
|
+
var _excluded = ["containInViewport", "alignment"];
|
|
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; }
|
|
18
18
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
19
|
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."); }
|
|
20
20
|
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); }
|
|
21
|
-
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; }
|
|
22
|
-
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
|
+
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; }
|
|
22
|
+
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; } }
|
|
23
23
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
24
|
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; }
|
|
25
25
|
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; }
|
|
26
26
|
function getPositionOnViewport(element) {
|
|
27
27
|
return element.getBoundingClientRect();
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
var AnchoredTooltipAlignment = /*#__PURE__*/function (AnchoredTooltipAlignment) {
|
|
30
30
|
AnchoredTooltipAlignment[AnchoredTooltipAlignment["LEFT"] = 0] = "LEFT";
|
|
31
31
|
AnchoredTooltipAlignment[AnchoredTooltipAlignment["CENTER"] = 1] = "CENTER";
|
|
32
32
|
AnchoredTooltipAlignment[AnchoredTooltipAlignment["RIGHT"] = 2] = "RIGHT";
|
|
33
33
|
return AnchoredTooltipAlignment;
|
|
34
34
|
}({});
|
|
35
35
|
exports.AnchoredTooltipAlignment = AnchoredTooltipAlignment;
|
|
36
|
-
|
|
36
|
+
var AnchoredTooltipAnchor = /*#__PURE__*/function (AnchoredTooltipAnchor) {
|
|
37
37
|
AnchoredTooltipAnchor[AnchoredTooltipAnchor["TOP"] = 0] = "TOP";
|
|
38
38
|
AnchoredTooltipAnchor[AnchoredTooltipAnchor["BOTTOM"] = 1] = "BOTTOM";
|
|
39
39
|
return AnchoredTooltipAnchor;
|
|
40
40
|
}({});
|
|
41
41
|
exports.AnchoredTooltipAnchor = AnchoredTooltipAnchor;
|
|
42
42
|
function calculateTooltipFromAnchor(anchorRef, tooltipRef, containInViewport) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
var alignTo = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : AnchoredTooltipAlignment.CENTER;
|
|
44
|
+
var anchorTo = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : AnchoredTooltipAnchor.TOP;
|
|
45
|
+
var anchorPosition = getPositionOnViewport(anchorRef);
|
|
46
|
+
var shouldAnchorToBottom = anchorTo === AnchoredTooltipAnchor.BOTTOM || tooltipRef.clientHeight > anchorPosition.top;
|
|
47
|
+
var top = anchorPosition.top - tooltipRef.clientHeight;
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* The terms mean:
|
|
@@ -52,7 +52,7 @@ function calculateTooltipFromAnchor(anchorRef, tooltipRef, containInViewport) {
|
|
|
52
52
|
* anchorPosition.width = The width of the anchor (visible element)
|
|
53
53
|
* tooltipRef.clientWidth = The width of the content
|
|
54
54
|
*/
|
|
55
|
-
|
|
55
|
+
var left = function () {
|
|
56
56
|
switch (alignTo) {
|
|
57
57
|
case AnchoredTooltipAlignment.CENTER:
|
|
58
58
|
return anchorPosition.left + anchorPosition.width / 2 - tooltipRef.clientWidth / 2;
|
|
@@ -64,23 +64,23 @@ function calculateTooltipFromAnchor(anchorRef, tooltipRef, containInViewport) {
|
|
|
64
64
|
}();
|
|
65
65
|
if (shouldAnchorToBottom) top += tooltipRef.clientHeight + anchorRef.clientHeight;
|
|
66
66
|
if (containInViewport && top < 0) top = 0;
|
|
67
|
-
|
|
67
|
+
var offset = top + tooltipRef.clientHeight - window.innerHeight;
|
|
68
68
|
if (containInViewport && offset > 0) {
|
|
69
69
|
top -= offset;
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
var offsetLeft = left + tooltipRef.clientWidth - window.innerWidth;
|
|
72
72
|
if (containInViewport && offsetLeft > 0) {
|
|
73
73
|
left -= offsetLeft;
|
|
74
74
|
}
|
|
75
75
|
if (containInViewport && left < 0) {
|
|
76
76
|
left = 0;
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
var maxLeftOffsetIndicator = tooltipRef.clientWidth / 2 - 60;
|
|
79
|
+
var tooltipCenter = tooltipRef.clientWidth / 2 + left;
|
|
80
|
+
var anchorPositionCenter = anchorPosition.left + anchorPosition.width / 2;
|
|
81
|
+
var offsetTooltip = anchorPositionCenter - tooltipCenter;
|
|
82
|
+
var minOffsetTooltip = -(tooltipRef.clientWidth / 2) + 60;
|
|
83
|
+
var offsetIndicatorLeft = offsetLeft > 0 ? offsetLeft > maxLeftOffsetIndicator ? maxLeftOffsetIndicator : offsetLeft : offsetTooltip < 0 ? offsetTooltip < minOffsetTooltip ? minOffsetTooltip : offsetTooltip : 0;
|
|
84
84
|
return {
|
|
85
85
|
offset: offset,
|
|
86
86
|
offsetIndicatorLeft: offsetIndicatorLeft,
|
|
@@ -90,16 +90,16 @@ function calculateTooltipFromAnchor(anchorRef, tooltipRef, containInViewport) {
|
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
function updateTooltipPosition(tooltipRef, anchorRef) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
var limitToViewport = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
94
|
+
var alignment = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : AnchoredTooltipAlignment.CENTER;
|
|
95
|
+
var anchorTo = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : AnchoredTooltipAnchor.TOP;
|
|
96
|
+
var _calculateTooltipFrom = calculateTooltipFromAnchor(anchorRef, tooltipRef, limitToViewport, alignment, anchorTo),
|
|
97
97
|
top = _calculateTooltipFrom.top,
|
|
98
98
|
left = _calculateTooltipFrom.left,
|
|
99
99
|
shouldAnchorToBottom = _calculateTooltipFrom.shouldAnchorToBottom,
|
|
100
100
|
offsetIndicatorLeft = _calculateTooltipFrom.offsetIndicatorLeft;
|
|
101
101
|
if (limitToViewport) {
|
|
102
|
-
|
|
102
|
+
var maxHeight = window.innerHeight - top;
|
|
103
103
|
tooltipRef.style.maxHeight = "".concat(maxHeight - 32, "px");
|
|
104
104
|
}
|
|
105
105
|
tooltipRef.style.top = "".concat(top, "px");
|
|
@@ -121,16 +121,16 @@ function updateTooltipPosition(tooltipRef, anchorRef) {
|
|
|
121
121
|
* This tooltip anchors itself to an element and handles positioning relative to the anchored element
|
|
122
122
|
**/
|
|
123
123
|
function AnchoredTooltip(_ref, ref) {
|
|
124
|
-
|
|
124
|
+
var _ref$containInViewpor = _ref.containInViewport,
|
|
125
125
|
containInViewport = _ref$containInViewpor === void 0 ? true : _ref$containInViewpor,
|
|
126
126
|
alignment = _ref.alignment,
|
|
127
127
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
128
|
-
|
|
128
|
+
var open = props.open,
|
|
129
129
|
children = props.children,
|
|
130
130
|
anchorRef = props.anchorRef;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
var tooltipRef = (0, _react.useRef)(null);
|
|
132
|
+
var className = (0, _OneUIProvider.useOneUIConfig)("component.tooltip.className");
|
|
133
|
+
var _useState = (0, _react.useState)(!open),
|
|
134
134
|
_useState2 = _slicedToArray(_useState, 2),
|
|
135
135
|
realClosed = _useState2[0],
|
|
136
136
|
setRealClosed = _useState2[1];
|
|
@@ -147,7 +147,7 @@ function AnchoredTooltip(_ref, ref) {
|
|
|
147
147
|
(0, _react.useEffect)(function () {
|
|
148
148
|
if (open && !realClosed) {
|
|
149
149
|
if (anchorRef.current && tooltipRef.current) updateTooltipPosition(tooltipRef.current, anchorRef.current, containInViewport, alignment);
|
|
150
|
-
|
|
150
|
+
var scrollHandler = function scrollHandler() {
|
|
151
151
|
if (anchorRef.current && tooltipRef.current) updateTooltipPosition(tooltipRef.current, anchorRef.current, containInViewport, alignment);
|
|
152
152
|
};
|
|
153
153
|
window.addEventListener("scroll", scrollHandler, {
|
|
@@ -14,23 +14,24 @@ var _CONFIGS_BY_ENTRANCE_;
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
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); }
|
|
16
16
|
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; }
|
|
17
|
+
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; } } }; }
|
|
17
18
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
18
19
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
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."); }
|
|
20
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); }
|
|
21
|
-
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; }
|
|
22
|
-
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; } }
|
|
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; } }
|
|
23
24
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
25
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
26
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
26
27
|
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); }
|
|
27
|
-
|
|
28
|
+
var EntranceType = /*#__PURE__*/function (EntranceType) {
|
|
28
29
|
EntranceType[EntranceType["SLIDE_AND_EXPAND"] = 0] = "SLIDE_AND_EXPAND";
|
|
29
30
|
EntranceType[EntranceType["EXPAND"] = 1] = "EXPAND";
|
|
30
31
|
return EntranceType;
|
|
31
32
|
}({});
|
|
32
33
|
exports.EntranceType = EntranceType;
|
|
33
|
-
|
|
34
|
+
var CONFIGS_BY_ENTRANCE_TYPE = (_CONFIGS_BY_ENTRANCE_ = {}, _defineProperty(_CONFIGS_BY_ENTRANCE_, EntranceType.SLIDE_AND_EXPAND, {
|
|
34
35
|
forward: {
|
|
35
36
|
elementEntering: _AnimatedEntranceModule.default.elementEntering,
|
|
36
37
|
elementExiting: _AnimatedEntranceModule.default.elementExiting
|
|
@@ -50,12 +51,12 @@ const CONFIGS_BY_ENTRANCE_TYPE = (_CONFIGS_BY_ENTRANCE_ = {}, _defineProperty(_C
|
|
|
50
51
|
}
|
|
51
52
|
}), _CONFIGS_BY_ENTRANCE_);
|
|
52
53
|
function AnimatedEntranceItem(_ref) {
|
|
53
|
-
|
|
54
|
+
var children = _ref.children,
|
|
54
55
|
noEntranceAnimation = _ref.noEntranceAnimation,
|
|
55
56
|
onRemoveChildren = _ref.onRemoveChildren,
|
|
56
57
|
entranceType = _ref.entranceType;
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
var uncontRef = (0, _react.useRef)(null);
|
|
59
|
+
var _useState = (0, _react.useState)(noEntranceAnimation ? children : /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
59
60
|
key: "null"
|
|
60
61
|
})),
|
|
61
62
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -71,8 +72,8 @@ function AnimatedEntranceItem(_ref) {
|
|
|
71
72
|
}, [children.key]);
|
|
72
73
|
(0, _react.useEffect)(function () {
|
|
73
74
|
if (screen === null) return;
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
var x = setTimeout(function () {
|
|
76
|
+
var key = String(typeof screen === "string" ? screen : screen.key);
|
|
76
77
|
if (key === "null" || key.includes("-nullated")) {
|
|
77
78
|
uncontRef.current.sectionRef.current.style.maxHeight = "".concat(uncontRef.current.sectionRef.current.scrollHeight, "px");
|
|
78
79
|
setTimeout(function () {
|
|
@@ -81,8 +82,8 @@ function AnimatedEntranceItem(_ref) {
|
|
|
81
82
|
} else {
|
|
82
83
|
uncontRef.current.sectionRef.current.style.maxHeight = "".concat(uncontRef.current.sectionRef.current.scrollHeight, "px");
|
|
83
84
|
if (!noEntranceAnimation) {
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
var restoreAutoHeight = function restoreAutoHeight(_ref2) {
|
|
86
|
+
var target = _ref2.target,
|
|
86
87
|
currentTarget = _ref2.currentTarget;
|
|
87
88
|
if (target !== currentTarget) return;
|
|
88
89
|
uncontRef.current.sectionRef.current.style.removeProperty("max-height");
|
|
@@ -100,7 +101,7 @@ function AnimatedEntranceItem(_ref) {
|
|
|
100
101
|
clearTimeout(x);
|
|
101
102
|
};
|
|
102
103
|
}, [_typeof(screen) === "object" ? screen === null || screen === void 0 ? void 0 : screen.key : screen]);
|
|
103
|
-
|
|
104
|
+
var className = (0, _react.useMemo)(function () {
|
|
104
105
|
return !noEntranceAnimation ? _AnimatedEntranceModule.default.maxHeight : "";
|
|
105
106
|
}, [String(children.key).includes("-nullated")]);
|
|
106
107
|
return screen === null ? null : /*#__PURE__*/_react.default.createElement(_UncontrolledTransition.default, {
|
|
@@ -123,21 +124,21 @@ function AnimatedEntranceItem(_ref) {
|
|
|
123
124
|
* Animates the entrance and exit of a component
|
|
124
125
|
**/
|
|
125
126
|
function AnimatedEntrance(_ref3) {
|
|
126
|
-
|
|
127
|
+
var children = _ref3.children,
|
|
127
128
|
_ref3$entranceType = _ref3.entranceType,
|
|
128
129
|
entranceType = _ref3$entranceType === void 0 ? EntranceType.SLIDE_AND_EXPAND : _ref3$entranceType;
|
|
129
|
-
|
|
130
|
+
var firstRef = (0, _react.useRef)(true);
|
|
130
131
|
(0, _react.useEffect)(function () {
|
|
131
132
|
firstRef.current = false;
|
|
132
133
|
}, []);
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
var prevChildren = (0, _react.useRef)([]);
|
|
135
|
+
var childrenDelayed = (0, _react.useMemo)(function () {
|
|
136
|
+
var newChildren = children.filter(function (c) {
|
|
136
137
|
return !prevChildren.current.find(function (a) {
|
|
137
138
|
return a.key === c.key;
|
|
138
139
|
});
|
|
139
140
|
});
|
|
140
|
-
|
|
141
|
+
var filteredOutChildren = prevChildren.current.map(function (c) {
|
|
141
142
|
return children.find(function (a) {
|
|
142
143
|
return a.key === c.key;
|
|
143
144
|
}) ?
|
|
@@ -149,16 +150,28 @@ function AnimatedEntrance(_ref3) {
|
|
|
149
150
|
key: String(c.key).includes("-nullated") ? c.key : "".concat(c.key, "-nullated")
|
|
150
151
|
});
|
|
151
152
|
});
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
153
|
+
var _iterator = _createForOfIteratorHelper(newChildren),
|
|
154
|
+
_step;
|
|
155
|
+
try {
|
|
156
|
+
var _loop = function _loop() {
|
|
157
|
+
var _children;
|
|
158
|
+
var child = _step.value;
|
|
159
|
+
var previousChildKey = (_children = children[children.indexOf(child) - 1]) === null || _children === void 0 ? void 0 : _children.key;
|
|
160
|
+
if (previousChildKey) {
|
|
161
|
+
filteredOutChildren.splice(filteredOutChildren.findIndex(function (a) {
|
|
162
|
+
return a.key === previousChildKey;
|
|
163
|
+
}) + 1, 0, child);
|
|
164
|
+
} else {
|
|
165
|
+
filteredOutChildren.unshift(child);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
169
|
+
_loop();
|
|
161
170
|
}
|
|
171
|
+
} catch (err) {
|
|
172
|
+
_iterator.e(err);
|
|
173
|
+
} finally {
|
|
174
|
+
_iterator.f();
|
|
162
175
|
}
|
|
163
176
|
return filteredOutChildren;
|
|
164
177
|
}, [children]);
|
|
@@ -15,12 +15,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
15
15
|
* This is a generic implementation of the loading, and error handling
|
|
16
16
|
**/
|
|
17
17
|
function AsyncWrapper(_ref) {
|
|
18
|
-
|
|
18
|
+
var loading = _ref.loading,
|
|
19
19
|
error = _ref.error,
|
|
20
20
|
onClose = _ref.onClose,
|
|
21
21
|
onRetry = _ref.onRetry,
|
|
22
22
|
children = _ref.children;
|
|
23
|
-
|
|
23
|
+
var _useOneUIContext$comp = (0, _OneUIProvider.useOneUIContext)().component.asyncWrapper,
|
|
24
24
|
_useOneUIContext$comp2 = _useOneUIContext$comp.LoadingComponent,
|
|
25
25
|
LoadingComponent = _useOneUIContext$comp2 === void 0 ? _Loader.default : _useOneUIContext$comp2,
|
|
26
26
|
messages = _useOneUIContext$comp.messages;
|