@elliemae/ds-tabs 2.2.3-rc.1 → 2.2.3
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/cjs/config/useTabs.js +8 -5
- package/cjs/parts/tabBar/TabBar.js +8 -8
- package/cjs/parts/tabsPanel/TabsPanels.js +32 -7
- package/cjs/utils/helpers.js +0 -4
- package/esm/config/useTabs.js +8 -5
- package/esm/parts/tabBar/TabBar.js +8 -8
- package/esm/parts/tabsPanel/TabsPanels.js +32 -7
- package/esm/utils/helpers.js +1 -3
- package/package.json +6 -6
- package/types/utils/helpers.d.ts +1 -3
package/cjs/config/useTabs.js
CHANGED
|
@@ -11,12 +11,9 @@ var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
|
11
11
|
var defaultProps = require('../defaultProps.js');
|
|
12
12
|
|
|
13
13
|
const useTabs = props => {
|
|
14
|
-
var _children$, _children$$props;
|
|
15
|
-
|
|
16
14
|
const propsWithDefaults = dsPropsHelpers.useMemoMergePropsWithDefault(props, defaultProps.tabsDefaultProps);
|
|
17
15
|
const {
|
|
18
|
-
activeTab
|
|
19
|
-
children
|
|
16
|
+
activeTab
|
|
20
17
|
} = propsWithDefaults;
|
|
21
18
|
const tabsRef = React.useRef({});
|
|
22
19
|
const tabsRefAsArray = React.useRef([]);
|
|
@@ -24,7 +21,7 @@ const useTabs = props => {
|
|
|
24
21
|
const carouselOnlyListRef = React.useRef(null);
|
|
25
22
|
const tabsListRef = React.useRef(null);
|
|
26
23
|
const actualActiveTabRef = React.useRef(null);
|
|
27
|
-
const [internalActiveTab, setInternalActiveTab] = React.useState(
|
|
24
|
+
const [internalActiveTab, setInternalActiveTab] = React.useState('');
|
|
28
25
|
const actualActiveTab = React.useMemo(() => {
|
|
29
26
|
if (activeTab !== undefined) return activeTab;
|
|
30
27
|
return internalActiveTab;
|
|
@@ -34,6 +31,12 @@ const useTabs = props => {
|
|
|
34
31
|
|
|
35
32
|
actualActiveTabRef.current = (_focusableTabsRef$cur = focusableTabsRef.current.find(el => el.dataset.tabId === actualActiveTab)) !== null && _focusableTabsRef$cur !== void 0 ? _focusableTabsRef$cur : null;
|
|
36
33
|
}, [actualActiveTab]);
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
if (activeTab === undefined) {
|
|
36
|
+
const firstAvailableTab = focusableTabsRef.current.find(el => el.ariaDisabled !== 'true');
|
|
37
|
+
setInternalActiveTab((firstAvailableTab === null || firstAvailableTab === void 0 ? void 0 : firstAvailableTab.dataset.tabId) || '');
|
|
38
|
+
}
|
|
39
|
+
}, [activeTab]);
|
|
37
40
|
const ctx = React.useMemo(() => ({
|
|
38
41
|
props: propsWithDefaults,
|
|
39
42
|
tabsRef,
|
|
@@ -72,21 +72,21 @@ const TabBar = () => {
|
|
|
72
72
|
if (!disabled) availableTabIndexes.push(index);
|
|
73
73
|
return /*#__PURE__*/jsxRuntime.jsxs(styles.StyledTabButton, {
|
|
74
74
|
role: "tab",
|
|
75
|
-
ref:
|
|
76
|
-
if (tabsRefAsArray.current && focusableTabsRef.current && tabsRef.current) {
|
|
77
|
-
tabsRefAsArray.current[index] =
|
|
78
|
-
if (!disabled && !focusableTabsRef.current.includes(
|
|
79
|
-
tabsRef.current[index] =
|
|
75
|
+
ref: tabButtonRef => {
|
|
76
|
+
if (tabButtonRef && tabsRefAsArray.current && focusableTabsRef.current && tabsRef.current) {
|
|
77
|
+
tabsRefAsArray.current[index] = tabButtonRef;
|
|
78
|
+
if (!disabled && !focusableTabsRef.current.includes(tabButtonRef)) focusableTabsRef.current.push(tabButtonRef);
|
|
79
|
+
tabsRef.current[index] = tabButtonRef;
|
|
80
80
|
|
|
81
81
|
if (type === constants.TabTypes.SUBTABS && firstSubtabInternalRef && index === availableTabIndexes[0]) {
|
|
82
|
-
firstSubtabInternalRef.current =
|
|
82
|
+
firstSubtabInternalRef.current = tabButtonRef;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
if (type !== constants.TabTypes.SUBTABS && index === availableTabIndexes[availableTabIndexes.length - 1]) {
|
|
86
|
-
lastTabInternalRef.current =
|
|
86
|
+
lastTabInternalRef.current = tabButtonRef;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
if (ref) ref.current =
|
|
89
|
+
if (ref) ref.current = tabButtonRef;
|
|
90
90
|
}
|
|
91
91
|
},
|
|
92
92
|
type: "button",
|
|
@@ -3,11 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.async-iterator.to-array.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.to-array.js');
|
|
10
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
6
12
|
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
13
|
require('core-js/modules/esnext.iterator.map.js');
|
|
8
14
|
var React = require('react');
|
|
9
15
|
var SwipeableViews = require('react-swipeable-views');
|
|
10
|
-
var helpers = require('../../utils/helpers.js');
|
|
11
16
|
var styles = require('./styles.js');
|
|
12
17
|
var DSTabsCTX = require('../../DSTabsCTX.js');
|
|
13
18
|
var useTabsCallbacks = require('../../utils/hooks/useTabsCallbacks.js');
|
|
@@ -35,18 +40,38 @@ const TabsPanels = () => {
|
|
|
35
40
|
handleOnTabChange,
|
|
36
41
|
handleOnMouseDown
|
|
37
42
|
} = useTabsCallbacks.useTabsCallbacks();
|
|
38
|
-
const handleOnChangeIndex = React.useCallback(index => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
const handleOnChangeIndex = React.useCallback((index, indexLatest) => {
|
|
44
|
+
if (!focusableTabsRef.current) return;
|
|
45
|
+
const offset = index - indexLatest;
|
|
46
|
+
|
|
47
|
+
if (focusableTabsRef.current) {
|
|
48
|
+
var _focusableTabsRef$cur, _focusableTabsRef$cur2, _focusableTabsRef$cur3, _focusableTabsRef$cur4;
|
|
49
|
+
|
|
50
|
+
const currentIndexFocusable = (_focusableTabsRef$cur = focusableTabsRef.current) === null || _focusableTabsRef$cur === void 0 ? void 0 : _focusableTabsRef$cur.findIndex(el => el.dataset.tabId === actualActiveTab);
|
|
51
|
+
const newFocusableIndex = currentIndexFocusable >= 0 ? currentIndexFocusable + offset : -1;
|
|
52
|
+
if (newFocusableIndex < 0 || newFocusableIndex > ((_focusableTabsRef$cur2 = focusableTabsRef.current) === null || _focusableTabsRef$cur2 === void 0 ? void 0 : _focusableTabsRef$cur2.length) || !((_focusableTabsRef$cur3 = focusableTabsRef.current) !== null && _focusableTabsRef$cur3 !== void 0 && _focusableTabsRef$cur3[newFocusableIndex])) return;
|
|
53
|
+
handleOnTabChange((_focusableTabsRef$cur4 = focusableTabsRef.current[newFocusableIndex].dataset) === null || _focusableTabsRef$cur4 === void 0 ? void 0 : _focusableTabsRef$cur4.tabId); // swiping does not trigger centerTab function inside handleOnTabChange because there is no event
|
|
54
|
+
// by clicking we are manually forcing to center the tab
|
|
55
|
+
|
|
56
|
+
focusableTabsRef.current[newFocusableIndex].click();
|
|
57
|
+
}
|
|
58
|
+
}, [actualActiveTab, focusableTabsRef, handleOnTabChange]);
|
|
59
|
+
const firstSlideToShow = React.useMemo(() => {
|
|
60
|
+
const childrenArray = React__default["default"].Children.toArray(tabs);
|
|
61
|
+
const index = childrenArray.filter(tab => tab.props.disabled !== true).findIndex(tab => tab.props.tabId === actualActiveTab);
|
|
62
|
+
if (index === -1) return 0;
|
|
63
|
+
return index;
|
|
64
|
+
}, [actualActiveTab, tabs]);
|
|
42
65
|
const panels = React.useMemo(() => React__default["default"].Children.map(tabs, tab => {
|
|
43
66
|
const {
|
|
44
67
|
tabId: panelId = '',
|
|
45
68
|
style,
|
|
46
|
-
children: content
|
|
69
|
+
children: content,
|
|
70
|
+
disabled
|
|
47
71
|
} = tab.props;
|
|
48
72
|
const isActive = actualActiveTab === panelId;
|
|
49
73
|
const shouldRender = !onlyRenderActiveTab || isActive;
|
|
74
|
+
if (disabled) return null;
|
|
50
75
|
return shouldRender && /*#__PURE__*/_jsx__default["default"](styles.StyledPanelContainer, {
|
|
51
76
|
id: panelId,
|
|
52
77
|
"aria-labelledby": "".concat(panelId, "-label"),
|
|
@@ -64,7 +89,7 @@ const TabsPanels = () => {
|
|
|
64
89
|
if (animated) {
|
|
65
90
|
return /*#__PURE__*/_jsx__default["default"](SwipeableViews__default["default"], {
|
|
66
91
|
enableMouseEvents: enableMouseEvents,
|
|
67
|
-
index:
|
|
92
|
+
index: firstSlideToShow,
|
|
68
93
|
onChangeIndex: handleOnChangeIndex
|
|
69
94
|
}, void 0, panels);
|
|
70
95
|
}
|
package/cjs/utils/helpers.js
CHANGED
|
@@ -60,14 +60,10 @@ const getVisibleDimensions = (node, referenceNode) => {
|
|
|
60
60
|
height: Math.min(node.clientHeight, referenceNodeDimensions.top + referenceNode.clientHeight - nodeDimensions.top, node.clientHeight - (referenceNodeDimensions.top - nodeDimensions.top))
|
|
61
61
|
};
|
|
62
62
|
};
|
|
63
|
-
const getIndexById = (children, activeId) => children && children.findIndex(item => item.props.tabId === activeId);
|
|
64
|
-
const getIdByIndex = (children, index) => children && children[index].props.tabId || '';
|
|
65
63
|
const shouldHaveLeftGradient = scrollLeft => Math.abs(scrollLeft) > constants.MOBILE_GRADIENT_WIDTH;
|
|
66
64
|
const shouldHaveRightGradient = (scrollLeft, clientWidth, scrollWidth) => Math.abs(scrollLeft) <= scrollWidth - (clientWidth + constants.MOBILE_GRADIENT_WIDTH);
|
|
67
65
|
|
|
68
66
|
exports.centerTab = centerTab;
|
|
69
|
-
exports.getIdByIndex = getIdByIndex;
|
|
70
|
-
exports.getIndexById = getIndexById;
|
|
71
67
|
exports.getVisibleDimensions = getVisibleDimensions;
|
|
72
68
|
exports.isElementVisible = isElementVisible;
|
|
73
69
|
exports.isElementVisibleCarousel = isElementVisibleCarousel;
|
package/esm/config/useTabs.js
CHANGED
|
@@ -7,12 +7,9 @@ import { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';
|
|
|
7
7
|
import { tabsDefaultProps } from '../defaultProps.js';
|
|
8
8
|
|
|
9
9
|
const useTabs = props => {
|
|
10
|
-
var _children$, _children$$props;
|
|
11
|
-
|
|
12
10
|
const propsWithDefaults = useMemoMergePropsWithDefault(props, tabsDefaultProps);
|
|
13
11
|
const {
|
|
14
|
-
activeTab
|
|
15
|
-
children
|
|
12
|
+
activeTab
|
|
16
13
|
} = propsWithDefaults;
|
|
17
14
|
const tabsRef = useRef({});
|
|
18
15
|
const tabsRefAsArray = useRef([]);
|
|
@@ -20,7 +17,7 @@ const useTabs = props => {
|
|
|
20
17
|
const carouselOnlyListRef = useRef(null);
|
|
21
18
|
const tabsListRef = useRef(null);
|
|
22
19
|
const actualActiveTabRef = useRef(null);
|
|
23
|
-
const [internalActiveTab, setInternalActiveTab] = useState(
|
|
20
|
+
const [internalActiveTab, setInternalActiveTab] = useState('');
|
|
24
21
|
const actualActiveTab = useMemo(() => {
|
|
25
22
|
if (activeTab !== undefined) return activeTab;
|
|
26
23
|
return internalActiveTab;
|
|
@@ -30,6 +27,12 @@ const useTabs = props => {
|
|
|
30
27
|
|
|
31
28
|
actualActiveTabRef.current = (_focusableTabsRef$cur = focusableTabsRef.current.find(el => el.dataset.tabId === actualActiveTab)) !== null && _focusableTabsRef$cur !== void 0 ? _focusableTabsRef$cur : null;
|
|
32
29
|
}, [actualActiveTab]);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (activeTab === undefined) {
|
|
32
|
+
const firstAvailableTab = focusableTabsRef.current.find(el => el.ariaDisabled !== 'true');
|
|
33
|
+
setInternalActiveTab((firstAvailableTab === null || firstAvailableTab === void 0 ? void 0 : firstAvailableTab.dataset.tabId) || '');
|
|
34
|
+
}
|
|
35
|
+
}, [activeTab]);
|
|
33
36
|
const ctx = useMemo(() => ({
|
|
34
37
|
props: propsWithDefaults,
|
|
35
38
|
tabsRef,
|
|
@@ -63,21 +63,21 @@ const TabBar = () => {
|
|
|
63
63
|
if (!disabled) availableTabIndexes.push(index);
|
|
64
64
|
return /*#__PURE__*/jsxs(StyledTabButton, {
|
|
65
65
|
role: "tab",
|
|
66
|
-
ref:
|
|
67
|
-
if (tabsRefAsArray.current && focusableTabsRef.current && tabsRef.current) {
|
|
68
|
-
tabsRefAsArray.current[index] =
|
|
69
|
-
if (!disabled && !focusableTabsRef.current.includes(
|
|
70
|
-
tabsRef.current[index] =
|
|
66
|
+
ref: tabButtonRef => {
|
|
67
|
+
if (tabButtonRef && tabsRefAsArray.current && focusableTabsRef.current && tabsRef.current) {
|
|
68
|
+
tabsRefAsArray.current[index] = tabButtonRef;
|
|
69
|
+
if (!disabled && !focusableTabsRef.current.includes(tabButtonRef)) focusableTabsRef.current.push(tabButtonRef);
|
|
70
|
+
tabsRef.current[index] = tabButtonRef;
|
|
71
71
|
|
|
72
72
|
if (type === TabTypes.SUBTABS && firstSubtabInternalRef && index === availableTabIndexes[0]) {
|
|
73
|
-
firstSubtabInternalRef.current =
|
|
73
|
+
firstSubtabInternalRef.current = tabButtonRef;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
if (type !== TabTypes.SUBTABS && index === availableTabIndexes[availableTabIndexes.length - 1]) {
|
|
77
|
-
lastTabInternalRef.current =
|
|
77
|
+
lastTabInternalRef.current = tabButtonRef;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
if (ref) ref.current =
|
|
80
|
+
if (ref) ref.current = tabButtonRef;
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
type: "button",
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/esnext.async-iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.to-array.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.to-array.js';
|
|
6
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
2
8
|
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
3
9
|
import 'core-js/modules/esnext.iterator.map.js';
|
|
4
10
|
import React, { useContext, useCallback, useMemo } from 'react';
|
|
5
11
|
import SwipeableViews from 'react-swipeable-views';
|
|
6
|
-
import { getIdByIndex, getIndexById } from '../../utils/helpers.js';
|
|
7
12
|
import { StyledPanelContainer } from './styles.js';
|
|
8
13
|
import { DSTabsContext } from '../../DSTabsCTX.js';
|
|
9
14
|
import { useTabsCallbacks } from '../../utils/hooks/useTabsCallbacks.js';
|
|
@@ -25,18 +30,38 @@ const TabsPanels = () => {
|
|
|
25
30
|
handleOnTabChange,
|
|
26
31
|
handleOnMouseDown
|
|
27
32
|
} = useTabsCallbacks();
|
|
28
|
-
const handleOnChangeIndex = useCallback(index => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
const handleOnChangeIndex = useCallback((index, indexLatest) => {
|
|
34
|
+
if (!focusableTabsRef.current) return;
|
|
35
|
+
const offset = index - indexLatest;
|
|
36
|
+
|
|
37
|
+
if (focusableTabsRef.current) {
|
|
38
|
+
var _focusableTabsRef$cur, _focusableTabsRef$cur2, _focusableTabsRef$cur3, _focusableTabsRef$cur4;
|
|
39
|
+
|
|
40
|
+
const currentIndexFocusable = (_focusableTabsRef$cur = focusableTabsRef.current) === null || _focusableTabsRef$cur === void 0 ? void 0 : _focusableTabsRef$cur.findIndex(el => el.dataset.tabId === actualActiveTab);
|
|
41
|
+
const newFocusableIndex = currentIndexFocusable >= 0 ? currentIndexFocusable + offset : -1;
|
|
42
|
+
if (newFocusableIndex < 0 || newFocusableIndex > ((_focusableTabsRef$cur2 = focusableTabsRef.current) === null || _focusableTabsRef$cur2 === void 0 ? void 0 : _focusableTabsRef$cur2.length) || !((_focusableTabsRef$cur3 = focusableTabsRef.current) !== null && _focusableTabsRef$cur3 !== void 0 && _focusableTabsRef$cur3[newFocusableIndex])) return;
|
|
43
|
+
handleOnTabChange((_focusableTabsRef$cur4 = focusableTabsRef.current[newFocusableIndex].dataset) === null || _focusableTabsRef$cur4 === void 0 ? void 0 : _focusableTabsRef$cur4.tabId); // swiping does not trigger centerTab function inside handleOnTabChange because there is no event
|
|
44
|
+
// by clicking we are manually forcing to center the tab
|
|
45
|
+
|
|
46
|
+
focusableTabsRef.current[newFocusableIndex].click();
|
|
47
|
+
}
|
|
48
|
+
}, [actualActiveTab, focusableTabsRef, handleOnTabChange]);
|
|
49
|
+
const firstSlideToShow = useMemo(() => {
|
|
50
|
+
const childrenArray = React.Children.toArray(tabs);
|
|
51
|
+
const index = childrenArray.filter(tab => tab.props.disabled !== true).findIndex(tab => tab.props.tabId === actualActiveTab);
|
|
52
|
+
if (index === -1) return 0;
|
|
53
|
+
return index;
|
|
54
|
+
}, [actualActiveTab, tabs]);
|
|
32
55
|
const panels = useMemo(() => React.Children.map(tabs, tab => {
|
|
33
56
|
const {
|
|
34
57
|
tabId: panelId = '',
|
|
35
58
|
style,
|
|
36
|
-
children: content
|
|
59
|
+
children: content,
|
|
60
|
+
disabled
|
|
37
61
|
} = tab.props;
|
|
38
62
|
const isActive = actualActiveTab === panelId;
|
|
39
63
|
const shouldRender = !onlyRenderActiveTab || isActive;
|
|
64
|
+
if (disabled) return null;
|
|
40
65
|
return shouldRender && /*#__PURE__*/_jsx(StyledPanelContainer, {
|
|
41
66
|
id: panelId,
|
|
42
67
|
"aria-labelledby": "".concat(panelId, "-label"),
|
|
@@ -54,7 +79,7 @@ const TabsPanels = () => {
|
|
|
54
79
|
if (animated) {
|
|
55
80
|
return /*#__PURE__*/_jsx(SwipeableViews, {
|
|
56
81
|
enableMouseEvents: enableMouseEvents,
|
|
57
|
-
index:
|
|
82
|
+
index: firstSlideToShow,
|
|
58
83
|
onChangeIndex: handleOnChangeIndex
|
|
59
84
|
}, void 0, panels);
|
|
60
85
|
}
|
package/esm/utils/helpers.js
CHANGED
|
@@ -56,9 +56,7 @@ const getVisibleDimensions = (node, referenceNode) => {
|
|
|
56
56
|
height: Math.min(node.clientHeight, referenceNodeDimensions.top + referenceNode.clientHeight - nodeDimensions.top, node.clientHeight - (referenceNodeDimensions.top - nodeDimensions.top))
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
|
-
const getIndexById = (children, activeId) => children && children.findIndex(item => item.props.tabId === activeId);
|
|
60
|
-
const getIdByIndex = (children, index) => children && children[index].props.tabId || '';
|
|
61
59
|
const shouldHaveLeftGradient = scrollLeft => Math.abs(scrollLeft) > MOBILE_GRADIENT_WIDTH;
|
|
62
60
|
const shouldHaveRightGradient = (scrollLeft, clientWidth, scrollWidth) => Math.abs(scrollLeft) <= scrollWidth - (clientWidth + MOBILE_GRADIENT_WIDTH);
|
|
63
61
|
|
|
64
|
-
export { centerTab,
|
|
62
|
+
export { centerTab, getVisibleDimensions, isElementVisible, isElementVisibleCarousel, shouldHaveLeftGradient, shouldHaveRightGradient };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-tabs",
|
|
3
|
-
"version": "2.2.3
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Tabs",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -128,11 +128,11 @@
|
|
|
128
128
|
"build": "node ../../scripts/build/build.js"
|
|
129
129
|
},
|
|
130
130
|
"dependencies": {
|
|
131
|
-
"@elliemae/ds-button": "2.2.3
|
|
132
|
-
"@elliemae/ds-icon": "2.2.3
|
|
133
|
-
"@elliemae/ds-icons": "2.2.3
|
|
134
|
-
"@elliemae/ds-props-helpers": "2.2.3
|
|
135
|
-
"@elliemae/ds-system": "2.2.3
|
|
131
|
+
"@elliemae/ds-button": "2.2.3",
|
|
132
|
+
"@elliemae/ds-icon": "2.2.3",
|
|
133
|
+
"@elliemae/ds-icons": "2.2.3",
|
|
134
|
+
"@elliemae/ds-props-helpers": "2.2.3",
|
|
135
|
+
"@elliemae/ds-system": "2.2.3",
|
|
136
136
|
"@react-hook/resize-observer": "~1.2.5",
|
|
137
137
|
"prop-types": "~15.7.2",
|
|
138
138
|
"react-desc": "~4.1.3",
|
package/types/utils/helpers.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type { CenterTabPropsT,
|
|
1
|
+
import type { CenterTabPropsT, VisibleDimensionsT } from '../DSTabsTypes';
|
|
2
2
|
export declare const isElementVisible: (tab: HTMLElement, tabList: HTMLElement) => boolean;
|
|
3
3
|
export declare const isElementVisibleCarousel: (tab: HTMLElement | null, tabContainer: HTMLDivElement | null, firstOrLastItem?: boolean) => boolean;
|
|
4
4
|
export declare const centerTab: ({ e, listRef }: CenterTabPropsT) => void;
|
|
5
5
|
export declare const getVisibleDimensions: (node: HTMLElement, referenceNode: HTMLElement) => VisibleDimensionsT;
|
|
6
|
-
export declare const getIndexById: (children: React.ReactElement<DSTabPropsWithDefaultT>[], activeId?: string | undefined) => number;
|
|
7
|
-
export declare const getIdByIndex: (children: React.ReactElement<DSTabPropsWithDefaultT>[], index: number) => string;
|
|
8
6
|
export declare const shouldHaveLeftGradient: (scrollLeft: number) => boolean;
|
|
9
7
|
export declare const shouldHaveRightGradient: (scrollLeft: number, clientWidth: number, scrollWidth: number) => boolean;
|