@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
|
@@ -14,24 +14,23 @@ 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; } } }; }
|
|
18
17
|
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); }
|
|
19
18
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
20
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."); }
|
|
21
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); }
|
|
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)
|
|
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; } }
|
|
24
23
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
24
|
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; }
|
|
26
25
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
27
26
|
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); }
|
|
28
|
-
|
|
27
|
+
let EntranceType = /*#__PURE__*/function (EntranceType) {
|
|
29
28
|
EntranceType[EntranceType["SLIDE_AND_EXPAND"] = 0] = "SLIDE_AND_EXPAND";
|
|
30
29
|
EntranceType[EntranceType["EXPAND"] = 1] = "EXPAND";
|
|
31
30
|
return EntranceType;
|
|
32
31
|
}({});
|
|
33
32
|
exports.EntranceType = EntranceType;
|
|
34
|
-
|
|
33
|
+
const CONFIGS_BY_ENTRANCE_TYPE = (_CONFIGS_BY_ENTRANCE_ = {}, _defineProperty(_CONFIGS_BY_ENTRANCE_, EntranceType.SLIDE_AND_EXPAND, {
|
|
35
34
|
forward: {
|
|
36
35
|
elementEntering: _AnimatedEntranceModule.default.elementEntering,
|
|
37
36
|
elementExiting: _AnimatedEntranceModule.default.elementExiting
|
|
@@ -51,12 +50,12 @@ var CONFIGS_BY_ENTRANCE_TYPE = (_CONFIGS_BY_ENTRANCE_ = {}, _defineProperty(_CON
|
|
|
51
50
|
}
|
|
52
51
|
}), _CONFIGS_BY_ENTRANCE_);
|
|
53
52
|
function AnimatedEntranceItem(_ref) {
|
|
54
|
-
|
|
53
|
+
let children = _ref.children,
|
|
55
54
|
noEntranceAnimation = _ref.noEntranceAnimation,
|
|
56
55
|
onRemoveChildren = _ref.onRemoveChildren,
|
|
57
56
|
entranceType = _ref.entranceType;
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
const uncontRef = (0, _react.useRef)(null);
|
|
58
|
+
const _useState = (0, _react.useState)(noEntranceAnimation ? children : /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
60
59
|
key: "null"
|
|
61
60
|
})),
|
|
62
61
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -72,8 +71,8 @@ function AnimatedEntranceItem(_ref) {
|
|
|
72
71
|
}, [children.key]);
|
|
73
72
|
(0, _react.useEffect)(function () {
|
|
74
73
|
if (screen === null) return;
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
const x = setTimeout(function () {
|
|
75
|
+
const key = String(typeof screen === "string" ? screen : screen.key);
|
|
77
76
|
if (key === "null" || key.includes("-nullated")) {
|
|
78
77
|
uncontRef.current.sectionRef.current.style.maxHeight = "".concat(uncontRef.current.sectionRef.current.scrollHeight, "px");
|
|
79
78
|
setTimeout(function () {
|
|
@@ -82,8 +81,8 @@ function AnimatedEntranceItem(_ref) {
|
|
|
82
81
|
} else {
|
|
83
82
|
uncontRef.current.sectionRef.current.style.maxHeight = "".concat(uncontRef.current.sectionRef.current.scrollHeight, "px");
|
|
84
83
|
if (!noEntranceAnimation) {
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
const restoreAutoHeight = function restoreAutoHeight(_ref2) {
|
|
85
|
+
let target = _ref2.target,
|
|
87
86
|
currentTarget = _ref2.currentTarget;
|
|
88
87
|
if (target !== currentTarget) return;
|
|
89
88
|
uncontRef.current.sectionRef.current.style.removeProperty("max-height");
|
|
@@ -101,13 +100,13 @@ function AnimatedEntranceItem(_ref) {
|
|
|
101
100
|
clearTimeout(x);
|
|
102
101
|
};
|
|
103
102
|
}, [_typeof(screen) === "object" ? screen === null || screen === void 0 ? void 0 : screen.key : screen]);
|
|
104
|
-
|
|
105
|
-
return
|
|
106
|
-
}, [
|
|
107
|
-
return
|
|
103
|
+
const firstRenderClass = (0, _react.useMemo)(function () {
|
|
104
|
+
return noEntranceAnimation ? "" : _AnimatedEntranceModule.default.maxHeight;
|
|
105
|
+
}, [screen === null]);
|
|
106
|
+
return /*#__PURE__*/_react.default.createElement(_UncontrolledTransition.default, {
|
|
108
107
|
ref: uncontRef,
|
|
109
108
|
transitionType: _Transition.TransitionAnimationTypes.CUSTOM,
|
|
110
|
-
className: "".concat(_AnimatedEntranceModule.default.resetHeight, " ").concat(
|
|
109
|
+
className: "".concat(_AnimatedEntranceModule.default.resetHeight, " ").concat(firstRenderClass),
|
|
111
110
|
lockTransitionWidth: true,
|
|
112
111
|
key: String(children.key).replace("-nullated", ""),
|
|
113
112
|
onDiscardStep: function onDiscardStep(k) {
|
|
@@ -117,28 +116,30 @@ function AnimatedEntranceItem(_ref) {
|
|
|
117
116
|
}
|
|
118
117
|
},
|
|
119
118
|
config: CONFIGS_BY_ENTRANCE_TYPE[entranceType]
|
|
120
|
-
},
|
|
119
|
+
}, screen === null ? /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
120
|
+
key: "null"
|
|
121
|
+
}) : typeof screen === "string" ? children : screen);
|
|
121
122
|
}
|
|
122
123
|
|
|
123
124
|
/**
|
|
124
125
|
* Animates the entrance and exit of a component
|
|
125
126
|
**/
|
|
126
127
|
function AnimatedEntrance(_ref3) {
|
|
127
|
-
|
|
128
|
+
let children = _ref3.children,
|
|
128
129
|
_ref3$entranceType = _ref3.entranceType,
|
|
129
130
|
entranceType = _ref3$entranceType === void 0 ? EntranceType.SLIDE_AND_EXPAND : _ref3$entranceType;
|
|
130
|
-
|
|
131
|
+
const firstRef = (0, _react.useRef)(true);
|
|
131
132
|
(0, _react.useEffect)(function () {
|
|
132
133
|
firstRef.current = false;
|
|
133
134
|
}, []);
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
const prevChildren = (0, _react.useRef)([]);
|
|
136
|
+
const childrenDelayed = (0, _react.useMemo)(function () {
|
|
137
|
+
const newChildren = children.filter(function (c) {
|
|
137
138
|
return !prevChildren.current.find(function (a) {
|
|
138
139
|
return a.key === c.key;
|
|
139
140
|
});
|
|
140
141
|
});
|
|
141
|
-
|
|
142
|
+
const filteredOutChildren = prevChildren.current.map(function (c) {
|
|
142
143
|
return children.find(function (a) {
|
|
143
144
|
return a.key === c.key;
|
|
144
145
|
}) ?
|
|
@@ -150,28 +151,16 @@ function AnimatedEntrance(_ref3) {
|
|
|
150
151
|
key: String(c.key).includes("-nullated") ? c.key : "".concat(c.key, "-nullated")
|
|
151
152
|
});
|
|
152
153
|
});
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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();
|
|
154
|
+
for (let child of newChildren) {
|
|
155
|
+
var _children;
|
|
156
|
+
const previousChildKey = (_children = children[children.indexOf(child) - 1]) === null || _children === void 0 ? void 0 : _children.key;
|
|
157
|
+
if (previousChildKey) {
|
|
158
|
+
filteredOutChildren.splice(filteredOutChildren.findIndex(function (a) {
|
|
159
|
+
return a.key === previousChildKey;
|
|
160
|
+
}) + 1, 0, child);
|
|
161
|
+
} else {
|
|
162
|
+
filteredOutChildren.unshift(child);
|
|
170
163
|
}
|
|
171
|
-
} catch (err) {
|
|
172
|
-
_iterator.e(err);
|
|
173
|
-
} finally {
|
|
174
|
-
_iterator.f();
|
|
175
164
|
}
|
|
176
165
|
return filteredOutChildren;
|
|
177
166
|
}, [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
|
+
let 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
|
+
const _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;
|
|
@@ -14,14 +14,14 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
14
14
|
* A simple avatar that shows the image of the user or it's initials as fallback
|
|
15
15
|
**/
|
|
16
16
|
function Avatar(_ref) {
|
|
17
|
-
|
|
17
|
+
let name = _ref.name,
|
|
18
18
|
imgSrc = _ref.imgSrc,
|
|
19
19
|
_ref$size = _ref.size,
|
|
20
20
|
size = _ref$size === void 0 ? 48 : _ref$size;
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const initials = (0, _react.useMemo)(function () {
|
|
22
|
+
const nameParts = name.trim().split(" ");
|
|
23
23
|
if (nameParts.length === 1) return nameParts[0].charAt(0).toUpperCase();
|
|
24
|
-
|
|
24
|
+
const _ref2 = [nameParts[0], nameParts.slice(-1)[0]],
|
|
25
25
|
firstName = _ref2[0],
|
|
26
26
|
lastName = _ref2[1];
|
|
27
27
|
return "".concat(firstName.charAt(0)).concat(lastName.charAt(0)).toUpperCase();
|
|
@@ -17,17 +17,17 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
17
17
|
* IT IS NOT READY (AND PROBABLY NEVER WILL) FOR FRAGMENT NODES
|
|
18
18
|
**/
|
|
19
19
|
function BucketFill(_ref) {
|
|
20
|
-
|
|
20
|
+
let children = _ref.children,
|
|
21
21
|
background = _ref.background,
|
|
22
22
|
fillTo = _ref.fillTo;
|
|
23
|
-
|
|
23
|
+
const rootRef = (0, _react.useRef)(null);
|
|
24
24
|
function resize() {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
const childs = rootRef.current.children;
|
|
26
|
+
const s = rootRef.current.style;
|
|
27
|
+
const elementAtPosition = fillTo === 0 ? null : childs.item(fillTo - 1);
|
|
28
|
+
const elementOffsetAndHeight = elementAtPosition === null ? 0 : elementAtPosition.offsetTop + elementAtPosition.clientHeight;
|
|
29
|
+
const elementRootHeight = rootRef.current.clientHeight;
|
|
30
|
+
const percentToFill = Math.min(elementOffsetAndHeight * 100 / elementRootHeight, 100);
|
|
31
31
|
s.setProperty("--fill-height", "".concat(percentToFill, "%"));
|
|
32
32
|
s.setProperty("--empty-height", "".concat(100 - percentToFill, "%"));
|
|
33
33
|
s.setProperty("--bg-offset", "".concat(percentToFill === 100 ? -1000 : 100 / ((100 - percentToFill) / 100), "%"));
|
|
@@ -48,7 +48,7 @@ function BucketFill(_ref) {
|
|
|
48
48
|
}, children);
|
|
49
49
|
}
|
|
50
50
|
function IgnoreFill(_ref2) {
|
|
51
|
-
|
|
51
|
+
let children = _ref2.children;
|
|
52
52
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
53
53
|
className: _BucketFillModule.default.ignoreFill
|
|
54
54
|
}, children);
|
|
@@ -9,7 +9,7 @@ exports.default = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _OneUIProvider = require("../../context/OneUIProvider");
|
|
11
11
|
var _ButtonModule = _interopRequireDefault(require("./Button.module.scss"));
|
|
12
|
-
|
|
12
|
+
const _excluded = ["children", "variant", "className"];
|
|
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,14 +20,14 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
20
20
|
* A simple button with the new design
|
|
21
21
|
**/
|
|
22
22
|
function _Button(_ref, ref) {
|
|
23
|
-
|
|
23
|
+
let children = _ref.children,
|
|
24
24
|
_ref$variant = _ref.variant,
|
|
25
25
|
variant = _ref$variant === void 0 ? "transparent" : _ref$variant,
|
|
26
26
|
_ref$className = _ref.className,
|
|
27
27
|
className = _ref$className === void 0 ? "" : _ref$className,
|
|
28
28
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const classNameType = (0, _OneUIProvider.useOneUIConfig)("component.button.className", {});
|
|
30
|
+
const Component = (0, _OneUIProvider.useOneUIConfig)("component.button.Component", "button");
|
|
31
31
|
return /*#__PURE__*/_react.default.createElement(Component, _extends({
|
|
32
32
|
ref: ref,
|
|
33
33
|
className: "".concat(_ButtonModule.default.button, " ").concat(_ButtonModule.default[variant], " ").concat(className, " ").concat(classNameType[variant] || ""),
|
|
@@ -11,7 +11,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
11
11
|
* A card layout that holds content
|
|
12
12
|
**/
|
|
13
13
|
function Card(_ref) {
|
|
14
|
-
|
|
14
|
+
let children = _ref.children,
|
|
15
15
|
_ref$className = _ref.className,
|
|
16
16
|
className = _ref$className === void 0 ? "" : _ref$className;
|
|
17
17
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -16,32 +16,32 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
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 DEFAULT_STYLE = {
|
|
23
23
|
lineColor: "#000",
|
|
24
24
|
pointColor: "#000",
|
|
25
25
|
textColor: "#fff"
|
|
26
26
|
};
|
|
27
27
|
function FloatingTooltip(_ref) {
|
|
28
|
-
|
|
28
|
+
let children = _ref.children,
|
|
29
29
|
x = _ref.x,
|
|
30
30
|
y = _ref.y,
|
|
31
31
|
hoverOnly = _ref.hoverOnly,
|
|
32
32
|
height = _ref.height,
|
|
33
33
|
style = _ref.style;
|
|
34
|
-
|
|
34
|
+
const _useState = (0, _react.useState)(function () {
|
|
35
35
|
return hoverOnly ? false : true;
|
|
36
36
|
}),
|
|
37
37
|
_useState2 = _slicedToArray(_useState, 2),
|
|
38
38
|
ope = _useState2[0],
|
|
39
39
|
setOpen = _useState2[1];
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
const ref = (0, _react.useRef)(null);
|
|
41
|
+
const circleRef = (0, _react.useRef)(null);
|
|
42
42
|
(0, _react.useEffect)(function () {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const animateEl = circleRef.current.children.item(0);
|
|
44
|
+
let interval;
|
|
45
45
|
animateEl.addEventListener("beginEvent", function () {
|
|
46
46
|
interval = setInterval(function () {
|
|
47
47
|
return ref.current.updatePosition();
|
|
@@ -52,7 +52,7 @@ function FloatingTooltip(_ref) {
|
|
|
52
52
|
ref.current.updatePosition();
|
|
53
53
|
});
|
|
54
54
|
}, []);
|
|
55
|
-
|
|
55
|
+
const actions = (0, _react.useMemo)(function () {
|
|
56
56
|
return hoverOnly ? {
|
|
57
57
|
onMouseEnter: function onMouseEnter() {
|
|
58
58
|
return setOpen(true);
|
|
@@ -91,7 +91,7 @@ function FloatingTooltip(_ref) {
|
|
|
91
91
|
* Draws a simple line chart with some animation
|
|
92
92
|
**/
|
|
93
93
|
function ChartView(_ref2) {
|
|
94
|
-
|
|
94
|
+
let _ref2$bounds = _slicedToArray(_ref2.bounds, 2),
|
|
95
95
|
_ref2$bounds$ = _slicedToArray(_ref2$bounds[0], 3),
|
|
96
96
|
startX = _ref2$bounds$[0],
|
|
97
97
|
endX = _ref2$bounds$[1],
|
|
@@ -107,52 +107,52 @@ function ChartView(_ref2) {
|
|
|
107
107
|
label = _ref2.label,
|
|
108
108
|
_ref2$style = _ref2.style,
|
|
109
109
|
groupStyle = _ref2$style === void 0 ? [] : _ref2$style;
|
|
110
|
-
|
|
110
|
+
const _useState3 = (0, _react.useState)(),
|
|
111
111
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
112
112
|
dim = _useState4[0],
|
|
113
113
|
setDIm = _useState4[1];
|
|
114
|
-
|
|
114
|
+
const chartRef = (0, _react.useRef)(null);
|
|
115
115
|
(0, _react.useLayoutEffect)(function () {
|
|
116
116
|
setDIm({
|
|
117
117
|
width: chartRef.current.clientWidth,
|
|
118
118
|
height: chartRef.current.clientHeight
|
|
119
119
|
});
|
|
120
120
|
}, []);
|
|
121
|
-
|
|
121
|
+
const _ref3 = dim || {},
|
|
122
122
|
width = _ref3.width,
|
|
123
123
|
height = _ref3.height;
|
|
124
|
-
|
|
124
|
+
const howMuchStepsY = (0, _react.useMemo)(function () {
|
|
125
125
|
return (endY - startY) / stepsY + 1;
|
|
126
126
|
}, [endY, startY, stepsY]);
|
|
127
|
-
|
|
127
|
+
const yAxis = (0, _react.useMemo)(function () {
|
|
128
128
|
return new Array(howMuchStepsY).fill(undefined).map(function (_, i) {
|
|
129
129
|
return /*#__PURE__*/_react.default.createElement("span", null, label.y(endY - i * stepsY));
|
|
130
130
|
});
|
|
131
131
|
}, [startY, endY, stepsY, howMuchStepsY]);
|
|
132
|
-
|
|
132
|
+
const howMuchStepsX = (0, _react.useMemo)(function () {
|
|
133
133
|
return (endX - startX) / stepsX + 1;
|
|
134
134
|
}, [endX, startX, stepsX]);
|
|
135
|
-
|
|
135
|
+
const xAxis = (0, _react.useMemo)(function () {
|
|
136
136
|
return new Array(howMuchStepsX).fill(undefined).map(function (_, i) {
|
|
137
137
|
return /*#__PURE__*/_react.default.createElement("span", null, label.x(startX + i * stepsX));
|
|
138
138
|
});
|
|
139
139
|
}, [startX, endX, stepsX]);
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
const _useMemo = (0, _react.useMemo)(function () {
|
|
141
|
+
const calculate = function calculate(end, start) {
|
|
142
|
+
let overrideScale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
|
|
143
143
|
return function (point) {
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
const max = end - start;
|
|
145
|
+
const current = point - start;
|
|
146
146
|
return current * overrideScale / max;
|
|
147
147
|
};
|
|
148
148
|
};
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
const calculateX = calculate(endX, startX, width);
|
|
150
|
+
const calculateY = calculate(endY, startY, height);
|
|
151
151
|
return {
|
|
152
152
|
tooltips: points.map(function (pointsCategory, i) {
|
|
153
|
-
|
|
153
|
+
const style = groupStyle[i] || DEFAULT_STYLE;
|
|
154
154
|
return pointsCategory.map(function (_ref4) {
|
|
155
|
-
|
|
155
|
+
let _ref5 = _slicedToArray(_ref4, 4),
|
|
156
156
|
x = _ref5[0],
|
|
157
157
|
y = _ref5[1],
|
|
158
158
|
label = _ref5[2],
|
|
@@ -168,10 +168,10 @@ function ChartView(_ref2) {
|
|
|
168
168
|
});
|
|
169
169
|
}),
|
|
170
170
|
polylines: data.map(function (lineData, i) {
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
const style = groupStyle[i] || DEFAULT_STYLE;
|
|
172
|
+
const calculateLines = function calculateLines(yOverride) {
|
|
173
173
|
return lineData.map(function (_ref6) {
|
|
174
|
-
|
|
174
|
+
let _ref7 = _slicedToArray(_ref6, 2),
|
|
175
175
|
x = _ref7[0],
|
|
176
176
|
y = _ref7[1];
|
|
177
177
|
return "".concat(calculateX(x), ",").concat(yOverride === undefined ? height - calculateY(y) : yOverride);
|
|
@@ -197,12 +197,12 @@ function ChartView(_ref2) {
|
|
|
197
197
|
}, [data, width, height]),
|
|
198
198
|
polylines = _useMemo.polylines,
|
|
199
199
|
tooltips = _useMemo.tooltips;
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
const paddingY = (0, _react.useMemo)(function () {
|
|
201
|
+
const stepSizeY = height / (howMuchStepsY - 1);
|
|
202
202
|
return stepSizeY / 2;
|
|
203
203
|
}, [howMuchStepsY, height]);
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
const paddingX = (0, _react.useMemo)(function () {
|
|
205
|
+
const stepSizeX = width / (howMuchStepsX - 1);
|
|
206
206
|
return stepSizeX / 2;
|
|
207
207
|
}, [howMuchStepsX, width]);
|
|
208
208
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -7,7 +7,7 @@ exports.default = CheckBox;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _OneUIProvider = require("../../context/OneUIProvider");
|
|
9
9
|
var _CheckBoxModule = _interopRequireDefault(require("./CheckBox.module.scss"));
|
|
10
|
-
|
|
10
|
+
const _excluded = ["checked", "onToggle", "label", "className", "size", "groupId", "value"];
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
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); }
|
|
13
13
|
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; }
|
|
@@ -16,7 +16,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
16
16
|
* A simple checkbox with nissan guidelines
|
|
17
17
|
**/
|
|
18
18
|
function CheckBox(_ref) {
|
|
19
|
-
|
|
19
|
+
let checked = _ref.checked,
|
|
20
20
|
onToggle = _ref.onToggle,
|
|
21
21
|
label = _ref.label,
|
|
22
22
|
_ref$className = _ref.className,
|
|
@@ -26,7 +26,7 @@ function CheckBox(_ref) {
|
|
|
26
26
|
groupId = _ref.groupId,
|
|
27
27
|
value = _ref.value,
|
|
28
28
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
-
|
|
29
|
+
const Checkbox = (0, _OneUIProvider.useOneUIConfig)("component.checkbox.Component", "span");
|
|
30
30
|
return /*#__PURE__*/_react.default.createElement("label", {
|
|
31
31
|
className: "".concat(_CheckBoxModule.default.container, " ").concat(className),
|
|
32
32
|
style: {
|
|
@@ -10,7 +10,7 @@ var _FadeIn = _interopRequireDefault(require("../FadeIn"));
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _CollapsableModule = _interopRequireDefault(require("./Collapsable.module.scss"));
|
|
12
12
|
var _AnchoredTooltip = require("../AnchoredTooltip/AnchoredTooltip");
|
|
13
|
-
|
|
13
|
+
const _excluded = ["children", "title", "className", "onToggleOpen", "open", "id", "mode", "contentClassName", "onContentClick", "keepUnderlayingElement", "onClickOut"];
|
|
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; }
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -29,7 +29,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
29
29
|
* Wrapps some content on a collapsable header
|
|
30
30
|
**/
|
|
31
31
|
function Collapsable(_ref, ref) {
|
|
32
|
-
|
|
32
|
+
let children = _ref.children,
|
|
33
33
|
title = _ref.title,
|
|
34
34
|
className = _ref.className,
|
|
35
35
|
onToggleOpen = _ref.onToggleOpen,
|
|
@@ -42,8 +42,8 @@ function Collapsable(_ref, ref) {
|
|
|
42
42
|
keepUnderlayingElement = _ref.keepUnderlayingElement,
|
|
43
43
|
onClickOut = _ref.onClickOut,
|
|
44
44
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const contentRef = (0, _react.useRef)(null);
|
|
46
|
+
const toggleRef = (0, _react.useRef)(null);
|
|
47
47
|
(0, _react.useEffect)(function () {
|
|
48
48
|
if (open && onClickOut) {
|
|
49
49
|
window.addEventListener("click", onClickOut);
|
|
@@ -53,23 +53,23 @@ function Collapsable(_ref, ref) {
|
|
|
53
53
|
}
|
|
54
54
|
}, [!!onClickOut, open]);
|
|
55
55
|
function _redimension() {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
let canShrink = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
57
|
+
const el = contentRef.current;
|
|
58
|
+
const contentEl = el.firstElementChild;
|
|
59
59
|
if (open) {
|
|
60
60
|
el.style.marginTop = "";
|
|
61
61
|
el.style.height = Math.min(canShrink ? contentEl.clientHeight : Number.POSITIVE_INFINITY, el.scrollHeight, visualViewport.height - 16) + "px";
|
|
62
62
|
el.parentElement.style.position = "relative";
|
|
63
63
|
if (mode === "float") {
|
|
64
64
|
el.style.minHeight = el.style.height;
|
|
65
|
-
|
|
65
|
+
const _updateTooltipPositio = (0, _AnchoredTooltip.updateTooltipPosition)(el, toggleRef.current, true, "alignTo" in props ? props.alignTo : _AnchoredTooltip.AnchoredTooltipAlignment.CENTER, "anchorTo" in props ? props.anchorTo : undefined),
|
|
66
66
|
shouldAnchorToBottom = _updateTooltipPositio.shouldAnchorToBottom;
|
|
67
67
|
el.style.minHeight = "";
|
|
68
68
|
if (!shouldAnchorToBottom) {
|
|
69
69
|
el.style.marginTop = el.style.height;
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
const transitionStart = function transitionStart(_ref2) {
|
|
72
|
+
let currentTarget = _ref2.currentTarget,
|
|
73
73
|
target = _ref2.target,
|
|
74
74
|
propertyName = _ref2.propertyName;
|
|
75
75
|
if (currentTarget === target && propertyName == "height" && !shouldAnchorToBottom) {
|
|
@@ -82,7 +82,7 @@ function Collapsable(_ref, ref) {
|
|
|
82
82
|
return el.removeEventListener("transitionstart", transitionStart);
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
const onTransitionEnd = function onTransitionEnd() {
|
|
86
86
|
el.style.height = "auto";
|
|
87
87
|
};
|
|
88
88
|
el.addEventListener("transitionend", onTransitionEnd);
|
|
@@ -98,14 +98,14 @@ function Collapsable(_ref, ref) {
|
|
|
98
98
|
if (el.style.marginTop === "0px") el.style.marginTop = "".concat(el.clientHeight, "px");
|
|
99
99
|
el.style.height = 0 + "px";
|
|
100
100
|
}, 100);
|
|
101
|
-
|
|
101
|
+
const onTransitionEnd = function onTransitionEnd() {
|
|
102
102
|
el.parentElement.style.position = "initial";
|
|
103
103
|
el.classList.remove(_CollapsableModule.default.transitionMarginTop);
|
|
104
|
-
el.removeEventListener("transitionend",
|
|
104
|
+
el.removeEventListener("transitionend", onTransitionEnd);
|
|
105
105
|
};
|
|
106
|
-
el.addEventListener("transitionend",
|
|
106
|
+
el.addEventListener("transitionend", onTransitionEnd);
|
|
107
107
|
return function () {
|
|
108
|
-
el.removeEventListener("transitionend",
|
|
108
|
+
el.removeEventListener("transitionend", onTransitionEnd);
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
}
|
|
@@ -119,7 +119,7 @@ function Collapsable(_ref, ref) {
|
|
|
119
119
|
(0, _react.useLayoutEffect)(function () {
|
|
120
120
|
_redimension();
|
|
121
121
|
}, [open]);
|
|
122
|
-
|
|
122
|
+
const propsToSpread = _objectSpread({}, props);
|
|
123
123
|
delete propsToSpread.alignTo;
|
|
124
124
|
return /*#__PURE__*/_react.default.createElement("div", _extends({
|
|
125
125
|
className: "".concat(_CollapsableModule.default.container, " ").concat(open ? _CollapsableModule.default.open : _CollapsableModule.default.closed, " ").concat(className)
|
|
@@ -143,7 +143,7 @@ function Collapsable(_ref, ref) {
|
|
|
143
143
|
function _collapsableId(type, id) {
|
|
144
144
|
return id ? "collapsable_".concat(type, "_").concat(id) : undefined;
|
|
145
145
|
}
|
|
146
|
-
|
|
146
|
+
let _CollapsableInterface = /*#__PURE__*/function () {
|
|
147
147
|
function _CollapsableInterface(id) {
|
|
148
148
|
_classCallCheck(this, _CollapsableInterface);
|
|
149
149
|
this._id = id;
|
|
@@ -159,7 +159,7 @@ var _CollapsableInterface = /*#__PURE__*/function () {
|
|
|
159
159
|
}, {
|
|
160
160
|
key: "open",
|
|
161
161
|
value: function open(onOpened) {
|
|
162
|
-
|
|
162
|
+
const _this$_getElements = this._getElements(),
|
|
163
163
|
header = _this$_getElements.header,
|
|
164
164
|
content = _this$_getElements.content;
|
|
165
165
|
if (((content === null || content === void 0 ? void 0 : content.clientHeight) || 0) === 0) {
|