@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
|
@@ -19,37 +19,37 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
19
19
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
20
20
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
21
21
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
22
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
23
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0)
|
|
22
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
23
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
24
24
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
|
-
|
|
25
|
+
const AnimDuration = Number(_PixelatedScanModule.default.animationDuration);
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* This effect scans up and down on the div with a following pixelated trail
|
|
29
29
|
**/
|
|
30
30
|
function PixelatedScan(_ref) {
|
|
31
|
-
|
|
31
|
+
let squaresByLine = _ref.squaresByLine,
|
|
32
32
|
color = _ref.color,
|
|
33
33
|
_ref$className = _ref.className,
|
|
34
34
|
className = _ref$className === void 0 ? "" : _ref$className;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
const iteration = (0, _react.useRef)(0);
|
|
36
|
+
const tableRef = (0, _react.useRef)(null);
|
|
37
|
+
const _useState = (0, _react.useState)(),
|
|
38
38
|
_useState2 = _slicedToArray(_useState, 2),
|
|
39
39
|
config = _useState2[0],
|
|
40
40
|
setConfig = _useState2[1];
|
|
41
41
|
(0, _react.useEffect)(function () {
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
const squareSize = tableRef.current.clientWidth / squaresByLine;
|
|
43
|
+
const howMuchLines = tableRef.current.clientHeight / squareSize;
|
|
44
44
|
setConfig({
|
|
45
45
|
squareSize: squareSize,
|
|
46
46
|
howMuchLines: howMuchLines
|
|
47
47
|
});
|
|
48
48
|
}, []);
|
|
49
|
-
|
|
49
|
+
const rowsDef = (0, _react.useMemo)(function () {
|
|
50
50
|
return new Array(Math.ceil((config === null || config === void 0 ? void 0 : config.howMuchLines) || 0)).fill(undefined);
|
|
51
51
|
}, [config]);
|
|
52
|
-
|
|
52
|
+
const lineDef = (0, _react.useMemo)(function () {
|
|
53
53
|
return new Array(squaresByLine).fill(undefined);
|
|
54
54
|
}, [config]);
|
|
55
55
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -77,14 +77,14 @@ function PixelatedScan(_ref) {
|
|
|
77
77
|
})));
|
|
78
78
|
}
|
|
79
79
|
function GridRow(_ref2) {
|
|
80
|
-
|
|
80
|
+
let onFinish = _ref2.onFinish,
|
|
81
81
|
squares = _ref2.squares,
|
|
82
82
|
size = _ref2.size,
|
|
83
83
|
baseColor = _ref2.baseColor,
|
|
84
84
|
lineCount = _ref2.lineCount,
|
|
85
85
|
lineIndex = _ref2.lineIndex;
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
const ref = (0, _react.useRef)(null);
|
|
87
|
+
const gridItemsRefs = (0, _react.useRef)([]);
|
|
88
88
|
(0, _react.useEffect)(function () {
|
|
89
89
|
var _ref$current;
|
|
90
90
|
function updateColor() {
|
|
@@ -116,15 +116,15 @@ function GridRow(_ref2) {
|
|
|
116
116
|
}));
|
|
117
117
|
}
|
|
118
118
|
function _GridItem(_ref3, externalRef) {
|
|
119
|
-
|
|
119
|
+
let size = _ref3.size,
|
|
120
120
|
_ref3$baseColor = _ref3.baseColor,
|
|
121
121
|
baseColor = _ref3$baseColor === void 0 ? "#ff0" : _ref3$baseColor;
|
|
122
|
-
|
|
122
|
+
const ref = (0, _react.useRef)(null);
|
|
123
123
|
function calculateNewRandomColorStrength() {
|
|
124
|
-
|
|
124
|
+
const color = _chromaJs.default.hex(baseColor).alpha(1 - Math.random() * 0.3);
|
|
125
125
|
return color;
|
|
126
126
|
}
|
|
127
|
-
|
|
127
|
+
const _useState3 = (0, _react.useState)(calculateNewRandomColorStrength),
|
|
128
128
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
129
129
|
randomColorStrength = _useState4[0],
|
|
130
130
|
setRandomColorStrength = _useState4[1];
|
|
@@ -146,4 +146,4 @@ function _GridItem(_ref3, externalRef) {
|
|
|
146
146
|
})
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
|
-
|
|
149
|
+
const GridItem = /*#__PURE__*/(0, _react.forwardRef)(_GridItem);
|
|
@@ -9,7 +9,7 @@ exports.default = Portal;
|
|
|
9
9
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _PortalModule = _interopRequireDefault(require("./Portal.module.scss"));
|
|
12
|
-
|
|
12
|
+
const _excluded = ["name", "className"];
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -19,22 +19,22 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
19
19
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
20
20
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
21
21
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
22
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
23
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0)
|
|
22
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
23
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
24
24
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
25
|
/**
|
|
26
26
|
* A react portal implementation with current page fallback
|
|
27
27
|
**/
|
|
28
28
|
function Portal(_ref2) {
|
|
29
|
-
|
|
29
|
+
let to = _ref2.to,
|
|
30
30
|
children = _ref2.children;
|
|
31
|
-
|
|
31
|
+
const _useState = (0, _react.useState)(),
|
|
32
32
|
_useState2 = _slicedToArray(_useState, 2),
|
|
33
33
|
target = _useState2[0],
|
|
34
34
|
setTarget = _useState2[1];
|
|
35
35
|
(0, _react.useEffect)(function () {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const els = document.querySelectorAll("[data-one-portal=\"".concat(to, "\"]"));
|
|
37
|
+
let latestEl;
|
|
38
38
|
els.forEach(function (el) {
|
|
39
39
|
var _latestEl;
|
|
40
40
|
latestEl = Number(el.getAttribute("data-timestamp")) > Number(((_latestEl = latestEl) === null || _latestEl === void 0 ? void 0 : _latestEl.timestamp) || 0) ? el : latestEl;
|
|
@@ -44,11 +44,11 @@ function Portal(_ref2) {
|
|
|
44
44
|
return target === undefined ? null : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, target === null ? children : /*#__PURE__*/_reactDom.default.createPortal(children, target));
|
|
45
45
|
}
|
|
46
46
|
function _PortalReceiver(_ref3, _ref) {
|
|
47
|
-
|
|
47
|
+
let name = _ref3.name,
|
|
48
48
|
_ref3$className = _ref3.className,
|
|
49
49
|
className = _ref3$className === void 0 ? "" : _ref3$className,
|
|
50
50
|
props = _objectWithoutProperties(_ref3, _excluded);
|
|
51
|
-
|
|
51
|
+
const timestamp = (0, _react.useMemo)(function () {
|
|
52
52
|
return Date.now();
|
|
53
53
|
}, []);
|
|
54
54
|
return /*#__PURE__*/_react.default.createElement("div", _extends({
|
|
@@ -58,5 +58,5 @@ function _PortalReceiver(_ref3, _ref) {
|
|
|
58
58
|
"data-timestamp": timestamp
|
|
59
59
|
}, props));
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
const PortalReceiver = /*#__PURE__*/(0, _react.forwardRef)(_PortalReceiver);
|
|
62
62
|
exports.PortalReceiver = PortalReceiver;
|
|
@@ -15,7 +15,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
15
15
|
* Shows a progress bar
|
|
16
16
|
**/
|
|
17
17
|
function ProgressBar(_ref) {
|
|
18
|
-
|
|
18
|
+
let size = _ref.size,
|
|
19
19
|
progress = _ref.progress,
|
|
20
20
|
_ref$style = _ref.style,
|
|
21
21
|
style = _ref$style === void 0 ? "guide" : _ref$style;
|
|
@@ -35,15 +35,15 @@ function ProgressBar(_ref) {
|
|
|
35
35
|
}));
|
|
36
36
|
}
|
|
37
37
|
function BalancedProgressBar(_ref2) {
|
|
38
|
-
|
|
38
|
+
let min = _ref2.min,
|
|
39
39
|
max = _ref2.max,
|
|
40
40
|
current = _ref2.current,
|
|
41
41
|
size = _ref2.size,
|
|
42
42
|
style = _ref2.style;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
const progress = (0, _react.useMemo)(function () {
|
|
44
|
+
const progressVal = current - min;
|
|
45
|
+
const maxVal = max - min;
|
|
46
|
+
const currProgress = progressVal * 100 / maxVal;
|
|
47
47
|
return currProgress;
|
|
48
48
|
}, [min, max, current]);
|
|
49
49
|
return /*#__PURE__*/_react.default.createElement(ProgressBar, {
|
|
@@ -13,14 +13,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
13
13
|
* Displays new texts as they are pushed into the steps property allowing for a nice progress follow experience
|
|
14
14
|
**/
|
|
15
15
|
function ProgressTexts(_ref) {
|
|
16
|
-
|
|
16
|
+
let steps = _ref.steps,
|
|
17
17
|
currentStep = _ref.currentStep,
|
|
18
18
|
_ref$spacingOnEachSte = _ref.spacingOnEachStep,
|
|
19
19
|
spacingOnEachStep = _ref$spacingOnEachSte === void 0 ? true : _ref$spacingOnEachSte;
|
|
20
|
-
|
|
20
|
+
const _currentStep = steps[currentStep];
|
|
21
21
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, steps.map(function (s, i) {
|
|
22
22
|
function whichClassToUse(step, stepType, currentStep, currentStepType) {
|
|
23
|
-
|
|
23
|
+
const classes = [_ProgressTextsModule.default.container];
|
|
24
24
|
|
|
25
25
|
// Decides the color
|
|
26
26
|
if (stepType !== "final") classes.push(step < currentStep ? _ProgressTextsModule.default.disabled : _ProgressTextsModule.default.loading);
|
|
@@ -7,7 +7,7 @@ exports.default = Radio;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _OneUIProvider = require("../../context/OneUIProvider");
|
|
9
9
|
var _RadioModule = _interopRequireDefault(require("./Radio.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 radio with nice guidelines
|
|
17
17
|
**/
|
|
18
18
|
function Radio(_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 Radio(_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.radio.Component", "span");
|
|
30
30
|
return /*#__PURE__*/_react.default.createElement("label", {
|
|
31
31
|
className: "".concat(_RadioModule.default.container, " ").concat(className),
|
|
32
32
|
style: {
|
|
@@ -21,7 +21,7 @@ function createId() {
|
|
|
21
21
|
* This component wraps a section and limits it's content as well as defining an id to reference this section
|
|
22
22
|
**/
|
|
23
23
|
function SectionContainer(_ref, ref) {
|
|
24
|
-
|
|
24
|
+
let children = _ref.children,
|
|
25
25
|
section = _ref.section,
|
|
26
26
|
_ref$className = _ref.className,
|
|
27
27
|
className = _ref$className === void 0 ? "" : _ref$className,
|
|
@@ -13,7 +13,7 @@ var _Input = _interopRequireDefault(require("../Input"));
|
|
|
13
13
|
var _Loader = _interopRequireDefault(require("../Loader"));
|
|
14
14
|
var _OneUIProvider = require("../../context/OneUIProvider");
|
|
15
15
|
var _AnchoredTooltip = require("../AnchoredTooltip/AnchoredTooltip");
|
|
16
|
-
|
|
16
|
+
const _excluded = ["items", "selected", "label", "onClick", "loading", "rootClassName", "dropdownClassName", "alignTo", "filter"];
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
18
|
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); }
|
|
19
19
|
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; }
|
|
@@ -21,8 +21,8 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
21
21
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
22
22
|
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."); }
|
|
23
23
|
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); }
|
|
24
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
25
|
-
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)
|
|
24
|
+
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; }
|
|
25
|
+
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; } }
|
|
26
26
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
27
27
|
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; }
|
|
28
28
|
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; }
|
|
@@ -30,7 +30,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
30
30
|
* A dropdown select
|
|
31
31
|
**/
|
|
32
32
|
function Select(_ref) {
|
|
33
|
-
|
|
33
|
+
let items = _ref.items,
|
|
34
34
|
selected = _ref.selected,
|
|
35
35
|
label = _ref.label,
|
|
36
36
|
_onClick = _ref.onClick,
|
|
@@ -43,22 +43,22 @@ function Select(_ref) {
|
|
|
43
43
|
alignTo = _ref$alignTo === void 0 ? _AnchoredTooltip.AnchoredTooltipAlignment.CENTER : _ref$alignTo,
|
|
44
44
|
filter = _ref.filter,
|
|
45
45
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
const StateIndicator = (0, _OneUIProvider.useOneUIContext)().component.select.StateIndicator;
|
|
47
|
+
const collapsableRef = (0, _react.useRef)(null);
|
|
48
|
+
const _selected = (0, _react.useMemo)(function () {
|
|
49
49
|
return items.find(function (a) {
|
|
50
50
|
return a.value === selected;
|
|
51
51
|
});
|
|
52
52
|
}, [selected, items]);
|
|
53
|
-
|
|
53
|
+
const _useState = (0, _react.useState)(false),
|
|
54
54
|
_useState2 = _slicedToArray(_useState, 2),
|
|
55
55
|
open = _useState2[0],
|
|
56
56
|
setOpen = _useState2[1];
|
|
57
|
-
|
|
57
|
+
const _useState3 = (0, _react.useState)(""),
|
|
58
58
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
59
59
|
filterTerm = _useState4[0],
|
|
60
60
|
setFilterTerm = _useState4[1];
|
|
61
|
-
|
|
61
|
+
const filteredItems = (0, _react.useMemo)(function () {
|
|
62
62
|
if (filter && filterTerm) return items.filter(function (item) {
|
|
63
63
|
return filter(item, filterTerm);
|
|
64
64
|
});else return items;
|
|
@@ -69,12 +69,12 @@ function Select(_ref) {
|
|
|
69
69
|
(0, _react.useLayoutEffect)(function () {
|
|
70
70
|
if (open) setFilterTerm("");
|
|
71
71
|
}, [open]);
|
|
72
|
-
|
|
72
|
+
const dropdownClassNames = _drop ? {
|
|
73
73
|
dropdown: _drop
|
|
74
74
|
} : (0, _OneUIProvider.useOneUIConfig)("component.select.className", {});
|
|
75
75
|
(0, _react.useEffect)(function () {
|
|
76
76
|
if (open) {
|
|
77
|
-
|
|
77
|
+
const close = function close() {
|
|
78
78
|
setOpen(false);
|
|
79
79
|
};
|
|
80
80
|
window.addEventListener("click", close);
|
|
@@ -115,7 +115,7 @@ function Select(_ref) {
|
|
|
115
115
|
className: _SelectModule.default.searchInput
|
|
116
116
|
}, /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
117
117
|
onChange: function onChange(_ref2) {
|
|
118
|
-
|
|
118
|
+
let value = _ref2.target.value;
|
|
119
119
|
return setFilterTerm(value);
|
|
120
120
|
},
|
|
121
121
|
decoration: /*#__PURE__*/_react.default.createElement("span", null, "\uD83D\uDD0E\xA0"),
|
|
@@ -19,12 +19,15 @@
|
|
|
19
19
|
.empty {
|
|
20
20
|
opacity: 0.3;
|
|
21
21
|
}
|
|
22
|
-
.input
|
|
23
|
-
transition: opacity $fast;
|
|
22
|
+
.input {
|
|
24
23
|
cursor: pointer;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
input {
|
|
25
|
+
transition: opacity $fast;
|
|
26
|
+
padding-right: 30px;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
text-overflow: ellipsis;
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
}
|
|
28
31
|
}
|
|
29
32
|
.indicator {
|
|
30
33
|
display: flex;
|
|
@@ -14,7 +14,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
14
14
|
* So it's width and height is translated to em units
|
|
15
15
|
**/
|
|
16
16
|
function Skeleton(_ref) {
|
|
17
|
-
|
|
17
|
+
let width = _ref.width,
|
|
18
18
|
_ref$height = _ref.height,
|
|
19
19
|
height = _ref$height === void 0 ? 1 : _ref$height;
|
|
20
20
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
@@ -11,7 +11,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
11
11
|
* A component to inject some spacing between component when required
|
|
12
12
|
**/
|
|
13
13
|
function Spacing(_ref) {
|
|
14
|
-
|
|
14
|
+
let size = _ref.size;
|
|
15
15
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
16
16
|
className: "".concat(_SpacingModule.default.spacing, " ").concat(_SpacingModule.default["spacing_".concat(size)])
|
|
17
17
|
});
|
|
@@ -8,7 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _StaticScrollerModule = _interopRequireDefault(require("./StaticScroller.module.scss"));
|
|
10
10
|
var _lodash = require("lodash");
|
|
11
|
-
|
|
11
|
+
const _excluded = ["children"];
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -19,17 +19,17 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
19
19
|
* Mantains a static content at the start of the container and when scrolled animates it's concealment
|
|
20
20
|
**/
|
|
21
21
|
function StaticScroller(_ref, ref) {
|
|
22
|
-
|
|
22
|
+
let children = _ref.children,
|
|
23
23
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
24
|
-
|
|
24
|
+
const rootRef = (0, _react.useMemo)(function () {
|
|
25
25
|
return ref || /*#__PURE__*/(0, _react.createRef)();
|
|
26
26
|
}, [ref]);
|
|
27
27
|
(0, _react.useLayoutEffect)(function () {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
const el = rootRef.current;
|
|
29
|
+
let latestScroll;
|
|
30
|
+
const child = el.children[0];
|
|
31
|
+
const checkIfNeedsToHide = (0, _lodash.debounce)(function () {
|
|
32
|
+
const direction = el.scrollLeft > latestScroll ? "in" : "out";
|
|
33
33
|
if (el.scrollLeft < child.clientWidth) {
|
|
34
34
|
el.scrollTo({
|
|
35
35
|
left: direction === "in" ? child.clientWidth : 0,
|
|
@@ -38,15 +38,15 @@ function StaticScroller(_ref, ref) {
|
|
|
38
38
|
}
|
|
39
39
|
latestScroll = undefined;
|
|
40
40
|
}, 500);
|
|
41
|
-
|
|
41
|
+
const throtleSetLast = (0, _lodash.throttle)(function (last) {
|
|
42
42
|
latestScroll = last;
|
|
43
43
|
}, 1000 / 5, {
|
|
44
44
|
leading: true,
|
|
45
45
|
trailing: false
|
|
46
46
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
const onScroll = function onScroll() {
|
|
48
|
+
const min = Math.min(el.scrollLeft, child.clientWidth);
|
|
49
|
+
const opacity = String(1 - min / child.clientWidth);
|
|
50
50
|
child.style.opacity = opacity;
|
|
51
51
|
checkIfNeedsToHide();
|
|
52
52
|
throtleSetLast(el.scrollLeft);
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = Switch;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _SwitchModule = _interopRequireDefault(require("./Switch.module.scss"));
|
|
9
|
-
|
|
9
|
+
const _excluded = ["enabled", "onToggle", "size", "disabled"];
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
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); }
|
|
12
12
|
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; }
|
|
@@ -15,7 +15,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
15
15
|
* Switchs between states
|
|
16
16
|
**/
|
|
17
17
|
function Switch(_ref) {
|
|
18
|
-
|
|
18
|
+
let enabled = _ref.enabled,
|
|
19
19
|
onToggle = _ref.onToggle,
|
|
20
20
|
size = _ref.size,
|
|
21
21
|
disabled = _ref.disabled,
|
|
@@ -18,17 +18,17 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
18
18
|
* A simple table layout
|
|
19
19
|
**/
|
|
20
20
|
function Table(_ref) {
|
|
21
|
-
|
|
21
|
+
let paginable = _ref.paginable,
|
|
22
22
|
heading = _ref.heading,
|
|
23
23
|
order = _ref.order,
|
|
24
24
|
items = _ref.items,
|
|
25
25
|
_ref$className = _ref.className,
|
|
26
26
|
className = _ref$className === void 0 ? "" : _ref$className;
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const transitionRef = (0, _react.useRef)(null);
|
|
28
|
+
const _useOneUIContext$comp = (0, _OneUIProvider.useOneUIContext)().component.table.controls,
|
|
29
29
|
_useOneUIContext$comp2 = _useOneUIContext$comp.NextPage,
|
|
30
30
|
NextPage = _useOneUIContext$comp2 === void 0 ? function (_ref2) {
|
|
31
|
-
|
|
31
|
+
let disabled = _ref2.disabled;
|
|
32
32
|
return /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
33
33
|
disabled: disabled,
|
|
34
34
|
variant: "filled"
|
|
@@ -36,15 +36,15 @@ function Table(_ref) {
|
|
|
36
36
|
} : _useOneUIContext$comp2,
|
|
37
37
|
_useOneUIContext$comp3 = _useOneUIContext$comp.PrevPage,
|
|
38
38
|
PrevPage = _useOneUIContext$comp3 === void 0 ? function (_ref3) {
|
|
39
|
-
|
|
39
|
+
let disabled = _ref3.disabled;
|
|
40
40
|
return /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
41
41
|
disabled: disabled,
|
|
42
42
|
variant: "filled"
|
|
43
43
|
}, "<");
|
|
44
44
|
} : _useOneUIContext$comp3;
|
|
45
|
-
|
|
45
|
+
const _useMemo = (0, _react.useMemo)(function () {
|
|
46
46
|
if (paginable) {
|
|
47
|
-
|
|
47
|
+
const numPages = Math.ceil(paginable.totalItems / 5);
|
|
48
48
|
return {
|
|
49
49
|
items: items.slice((paginable.currentPage - 1) * 5, (paginable.currentPage - 1) * 5 + 5),
|
|
50
50
|
pages: numPages
|
|
@@ -56,7 +56,7 @@ function Table(_ref) {
|
|
|
56
56
|
}, [items, paginable === null || paginable === void 0 ? void 0 : paginable.currentPage, paginable === null || paginable === void 0 ? void 0 : paginable.totalItems]),
|
|
57
57
|
itemsToShow = _useMemo.items,
|
|
58
58
|
pages = _useMemo.pages;
|
|
59
|
-
|
|
59
|
+
const Wrapper = paginable ? _UncontrolledTransition.default : "div";
|
|
60
60
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(TableContext.Provider, {
|
|
61
61
|
value: {
|
|
62
62
|
itemsToShow: itemsToShow,
|
|
@@ -93,10 +93,10 @@ function Table(_ref) {
|
|
|
93
93
|
disabled: paginable.currentPage === pages
|
|
94
94
|
})))) : null);
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
const TableContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
97
97
|
function TableComp(_ref4) {
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
let className = _ref4.className;
|
|
99
|
+
const _useContext = (0, _react.useContext)(TableContext),
|
|
100
100
|
itemsToShow = _useContext.itemsToShow,
|
|
101
101
|
keys = _useContext.keys,
|
|
102
102
|
heading = _useContext.heading;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { ReactElement } from "react";
|
|
2
|
+
export declare enum TabType {
|
|
3
|
+
FULL = 0,
|
|
4
|
+
UNDERLINE = 1
|
|
5
|
+
}
|
|
2
6
|
/**
|
|
3
7
|
* Show tabs for toggling between options
|
|
4
8
|
**/
|
|
5
|
-
export default function Tabs<O extends string>({ options, selected, onSelect, itemClassName, className, }: {
|
|
9
|
+
export default function Tabs<O extends string | number>({ options, selected, onSelect, itemClassName, className, type, }: {
|
|
6
10
|
options: Readonly<{
|
|
7
11
|
id: O;
|
|
8
12
|
label: string | ReactElement;
|
|
@@ -11,4 +15,5 @@ export default function Tabs<O extends string>({ options, selected, onSelect, it
|
|
|
11
15
|
onSelect: (option: O) => void;
|
|
12
16
|
itemClassName?: string;
|
|
13
17
|
className?: string;
|
|
18
|
+
type?: TabType;
|
|
14
19
|
}): JSX.Element;
|
|
@@ -4,33 +4,52 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.TabType = void 0;
|
|
7
8
|
exports.default = Tabs;
|
|
8
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
10
|
var _TabsModule = _interopRequireDefault(require("./Tabs.module.scss"));
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
13
|
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; }
|
|
14
|
+
let TabType = /*#__PURE__*/function (TabType) {
|
|
15
|
+
TabType[TabType["FULL"] = 0] = "FULL";
|
|
16
|
+
TabType[TabType["UNDERLINE"] = 1] = "UNDERLINE";
|
|
17
|
+
return TabType;
|
|
18
|
+
}({});
|
|
13
19
|
/**
|
|
14
20
|
* Show tabs for toggling between options
|
|
15
21
|
**/
|
|
22
|
+
exports.TabType = TabType;
|
|
16
23
|
function Tabs(_ref) {
|
|
17
|
-
|
|
24
|
+
let options = _ref.options,
|
|
18
25
|
selected = _ref.selected,
|
|
19
26
|
onSelect = _ref.onSelect,
|
|
20
27
|
_ref$itemClassName = _ref.itemClassName,
|
|
21
28
|
itemClassName = _ref$itemClassName === void 0 ? "" : _ref$itemClassName,
|
|
22
29
|
_ref$className = _ref.className,
|
|
23
|
-
className = _ref$className === void 0 ? "" : _ref$className
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
className = _ref$className === void 0 ? "" : _ref$className,
|
|
31
|
+
_ref$type = _ref.type,
|
|
32
|
+
type = _ref$type === void 0 ? TabType.UNDERLINE : _ref$type;
|
|
33
|
+
const selectedRef = (0, _react.useRef)(null);
|
|
34
|
+
const guideRef = (0, _react.useRef)(null);
|
|
26
35
|
(0, _react.useEffect)(function () {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
const guideStyle = guideRef.current.style;
|
|
37
|
+
const currEl = selectedRef.current;
|
|
38
|
+
guideStyle["opacity"] = currEl ? "1" : guideStyle["opacity"];
|
|
39
|
+
guideStyle["width"] = currEl ? currEl.clientWidth + "px" : "0px";
|
|
40
|
+
guideStyle["left"] = currEl ? currEl.offsetLeft + "px" : guideStyle["left"] || "initial";
|
|
41
|
+
if (type === TabType.FULL) {
|
|
42
|
+
guideStyle["height"] = currEl ? currEl.clientHeight + "px" : "";
|
|
43
|
+
guideStyle["top"] = currEl ? currEl.offsetTop + "px" : guideStyle["top"] || "initial";
|
|
44
|
+
} else {
|
|
45
|
+
guideStyle["top"] = currEl ? currEl.offsetTop + currEl.clientHeight + "px" : guideStyle["top"] || "initial";
|
|
46
|
+
}
|
|
31
47
|
}, [selected]);
|
|
48
|
+
(0, _react.useEffect)(function () {
|
|
49
|
+
guideRef.current.classList.add(_TabsModule.default.enableTransition);
|
|
50
|
+
}, []);
|
|
32
51
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
33
|
-
className: "".concat(_TabsModule.default.container, " ").concat(className)
|
|
52
|
+
className: "".concat(_TabsModule.default.container, " ").concat(className, " ").concat(_TabsModule.default[TabType[type]])
|
|
34
53
|
}, options.map(function (o) {
|
|
35
54
|
return /*#__PURE__*/_react.default.createElement("p", {
|
|
36
55
|
ref: selected === o.id ? selectedRef : undefined,
|
|
@@ -11,11 +11,29 @@
|
|
|
11
11
|
font-weight: bold;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
&.FULL {
|
|
15
|
+
p {
|
|
16
|
+
transition: color 250ms linear;
|
|
17
|
+
padding: 16px 40px;
|
|
18
|
+
z-index: 1;
|
|
19
|
+
margin: 0px;
|
|
20
|
+
|
|
21
|
+
&.selected {
|
|
22
|
+
color: var(--tab-selected-color);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
.guide {
|
|
26
|
+
box-shadow: $elevation;
|
|
27
|
+
border-radius: 24px / 50%;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
14
30
|
}
|
|
15
31
|
|
|
16
32
|
.guide {
|
|
17
33
|
height: 0.1em;
|
|
18
|
-
background-color: $digitalBlue;
|
|
34
|
+
background-color: var(--tab-guide-color, $digitalBlue);
|
|
19
35
|
position: absolute;
|
|
20
|
-
|
|
36
|
+
&.enableTransition {
|
|
37
|
+
transition: left $fast, width $fast, top $fast, height $fast;
|
|
38
|
+
}
|
|
21
39
|
}
|