@elliemae/ds-tabs 2.0.0-next.9 → 2.0.0-rc.12
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/Carousel.js +21 -14
- package/cjs/DSTab.js +13 -10
- package/cjs/DSTabs.js +41 -38
- package/cjs/PanelContainer.js +7 -0
- package/cjs/SubTabBar.js +38 -29
- package/cjs/TabBar.js +45 -38
- package/cjs/TabTypes.js +3 -0
- package/cjs/TabsImpl.js +5 -0
- package/cjs/TabsPanels.js +6 -7
- package/esm/Carousel.js +19 -10
- package/esm/DSTab.js +13 -10
- package/esm/DSTabs.js +41 -38
- package/esm/PanelContainer.js +7 -0
- package/esm/SubTabBar.js +38 -29
- package/esm/TabBar.js +45 -37
- package/esm/TabTypes.js +3 -0
- package/esm/TabsImpl.js +5 -0
- package/esm/TabsPanels.js +6 -6
- package/package.json +14 -7
- package/types/DSTab.d.ts +34 -5
- package/types/DSTabs.d.ts +127 -18
package/cjs/Carousel.js
CHANGED
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
4
|
require('core-js/modules/web.dom-collections.iterator.js');
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.reduce.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.reduce.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
5
10
|
var React = require('react');
|
|
6
|
-
var
|
|
7
|
-
var ChevronLeft = require('@elliemae/ds-icons/ChevronLeft');
|
|
11
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
8
12
|
var styled = require('styled-components');
|
|
9
13
|
var DSButton = require('@elliemae/ds-button');
|
|
10
14
|
var useResize = require('./useResize.js');
|
|
@@ -14,16 +18,17 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
14
18
|
|
|
15
19
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
16
20
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
|
-
var ChevronRight__default = /*#__PURE__*/_interopDefaultLegacy(ChevronRight);
|
|
18
|
-
var ChevronLeft__default = /*#__PURE__*/_interopDefaultLegacy(ChevronLeft);
|
|
19
21
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
20
22
|
var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
|
|
21
23
|
|
|
22
24
|
const CarouselBtn = /*#__PURE__*/styled__default["default"](DSButton__default["default"]).withConfig({
|
|
23
25
|
componentId: "sc-1317h31-0"
|
|
24
|
-
})(["position:absolute;z-index:1;margin:0;&:focus{& span{background-color:", ";background-size:90%;border-radius:2px;border-color:transparent;}}&&{width:16px;height:calc(100% - 2px);@media (min-width:", "){height:calc(100% - 4px);&:focus{& span{background-color:unset;}}}}", " && .em-ds-icon{height:16px;width:16px;}"], props => props.theme.colors.brand[200],
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
})(["position:absolute;z-index:1;margin:0;&:focus{& span{background-color:", ";background-size:90%;border-radius:2px;border-color:transparent;}}&&{width:16px;height:calc(100% - 2px);@media (min-width:", "){height:calc(100% - 4px);&:focus{& span{background-color:unset;}}}}", " && .em-ds-icon{height:16px;width:16px;}"], props => props.theme.colors.brand[200], _ref => {
|
|
27
|
+
let {
|
|
28
|
+
theme
|
|
29
|
+
} = _ref;
|
|
30
|
+
return theme.breakpoints.medium;
|
|
31
|
+
}, props => props.right ? 'right: 0;' : 'left: 0;');
|
|
27
32
|
const CarouselWrapper = /*#__PURE__*/styled__default["default"].span.withConfig({
|
|
28
33
|
componentId: "sc-1317h31-1"
|
|
29
34
|
})(["position:relative;padding:0 16px;width:100%;"]);
|
|
@@ -41,10 +46,11 @@ function isVisibleElement(el, container) {
|
|
|
41
46
|
return isVisible;
|
|
42
47
|
}
|
|
43
48
|
|
|
44
|
-
const Carousel =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
const Carousel = _ref2 => {
|
|
50
|
+
let {
|
|
51
|
+
children,
|
|
52
|
+
onScroll
|
|
53
|
+
} = _ref2;
|
|
48
54
|
const itemsRef = React.useRef([]);
|
|
49
55
|
const wrapRef = React.useRef(null);
|
|
50
56
|
const leftRef = React.useRef(null);
|
|
@@ -121,7 +127,8 @@ const Carousel = ({
|
|
|
121
127
|
onScroll(e);
|
|
122
128
|
};
|
|
123
129
|
|
|
124
|
-
const handleClick = (e
|
|
130
|
+
const handleClick = function (e) {
|
|
131
|
+
let onClick = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => {};
|
|
125
132
|
const tabListDomEl = wrapRef.current;
|
|
126
133
|
const el = e.target;
|
|
127
134
|
const rect = el.getBoundingClientRect();
|
|
@@ -152,7 +159,7 @@ const Carousel = ({
|
|
|
152
159
|
buttonType: "link",
|
|
153
160
|
innerRef: leftRef,
|
|
154
161
|
size: "s",
|
|
155
|
-
icon: /*#__PURE__*/_jsx__default["default"](
|
|
162
|
+
icon: /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronLeft, {
|
|
156
163
|
size: "s",
|
|
157
164
|
color: ['brand-primary', '600']
|
|
158
165
|
}),
|
|
@@ -164,7 +171,7 @@ const Carousel = ({
|
|
|
164
171
|
right: true,
|
|
165
172
|
size: "s",
|
|
166
173
|
buttonType: "link",
|
|
167
|
-
icon: /*#__PURE__*/_jsx__default["default"](
|
|
174
|
+
icon: /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronRight, {
|
|
168
175
|
size: "s",
|
|
169
176
|
color: ['brand-primary', '600']
|
|
170
177
|
}),
|
package/cjs/DSTab.js
CHANGED
|
@@ -10,16 +10,19 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
10
10
|
|
|
11
11
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
12
12
|
|
|
13
|
-
const DSTab =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
const DSTab = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
tabId = '',
|
|
16
|
+
title = '',
|
|
17
|
+
required = false
|
|
18
|
+
} = _ref;
|
|
19
|
+
return /*#__PURE__*/_jsx__default["default"]("div", {
|
|
20
|
+
"aria-labelledby": "".concat(tabId, "-label"),
|
|
21
|
+
tabId: tabId,
|
|
22
|
+
title: title,
|
|
23
|
+
required: required
|
|
24
|
+
});
|
|
25
|
+
};
|
|
23
26
|
|
|
24
27
|
DSTab.displayName = 'DSTab';
|
|
25
28
|
const props = {
|
package/cjs/DSTabs.js
CHANGED
|
@@ -13,44 +13,47 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
13
13
|
|
|
14
14
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
15
15
|
|
|
16
|
-
const DSTabs =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
16
|
+
const DSTabs = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
containerProps = {},
|
|
19
|
+
innerRef,
|
|
20
|
+
animated = true,
|
|
21
|
+
enableMouseEvents = false,
|
|
22
|
+
allowTextSelection = false,
|
|
23
|
+
onTabChange = () => null,
|
|
24
|
+
tabsListAriaLabel = 'Tab list',
|
|
25
|
+
type = TabTypes.TabTypes.NORMAL,
|
|
26
|
+
tabBarExtraContent = undefined,
|
|
27
|
+
children: tabs,
|
|
28
|
+
onlyRenderActiveTab = false,
|
|
29
|
+
activeTab,
|
|
30
|
+
withCarousel = false,
|
|
31
|
+
firstSubtabRef,
|
|
32
|
+
lastTabRef,
|
|
33
|
+
flexibleTabsHeaders,
|
|
34
|
+
fixedTabsHeaders,
|
|
35
|
+
isDSMobile = false
|
|
36
|
+
} = _ref;
|
|
37
|
+
return /*#__PURE__*/_jsx__default["default"](TabsImpl, {
|
|
38
|
+
activeTab: activeTab,
|
|
39
|
+
firstSubtabRef: firstSubtabRef,
|
|
40
|
+
lastTabRef: lastTabRef,
|
|
41
|
+
allowTextSelection: allowTextSelection,
|
|
42
|
+
animated: animated,
|
|
43
|
+
containerProps: containerProps,
|
|
44
|
+
enableMouseEvents: enableMouseEvents,
|
|
45
|
+
innerRef: innerRef,
|
|
46
|
+
onlyRenderActiveTab: onlyRenderActiveTab,
|
|
47
|
+
onTabChange: onTabChange,
|
|
48
|
+
tabBarExtraContent: tabBarExtraContent,
|
|
49
|
+
tabsListAriaLabel: tabsListAriaLabel,
|
|
50
|
+
type: type,
|
|
51
|
+
withCarousel: withCarousel,
|
|
52
|
+
flexibleTabsHeaders: flexibleTabsHeaders,
|
|
53
|
+
fixedTabsHeaders: fixedTabsHeaders,
|
|
54
|
+
isDSMobile: isDSMobile
|
|
55
|
+
}, void 0, tabs);
|
|
56
|
+
};
|
|
54
57
|
|
|
55
58
|
const props = {
|
|
56
59
|
/** Whether the tab transition should animate or not */
|
package/cjs/PanelContainer.js
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
4
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
7
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
10
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
5
12
|
var React = require('react');
|
|
6
13
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
7
14
|
var jsxRuntime = require('react/jsx-runtime');
|
package/cjs/SubTabBar.js
CHANGED
|
@@ -11,35 +11,44 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
11
11
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
12
12
|
|
|
13
13
|
const blockName = 'tabs-tab-bar';
|
|
14
|
-
const SubTabList = dsClassnames.aggregatedClasses('div')(blockName, 'subtabs-list',
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
withCarousel,
|
|
22
|
-
tabs = [],
|
|
23
|
-
activeTab = '',
|
|
24
|
-
onTabClick = () => null,
|
|
25
|
-
firstSubtabRef,
|
|
26
|
-
handleUpArrow
|
|
27
|
-
}) => /*#__PURE__*/_jsx__default["default"](TabBar, {
|
|
28
|
-
activeTab: activeTab,
|
|
29
|
-
onTabClick: onTabClick,
|
|
30
|
-
handleUpArrow: handleUpArrow,
|
|
31
|
-
firstSubtabRef: firstSubtabRef,
|
|
32
|
-
renderCustomTabBar: ({
|
|
33
|
-
tabsComponents,
|
|
34
|
-
innerRef
|
|
35
|
-
}) => /*#__PURE__*/_jsx__default["default"](SubTabList, {
|
|
36
|
-
withCarousel: withCarousel,
|
|
37
|
-
innerRef: innerRef,
|
|
38
|
-
"data-testid": "subtabs-list"
|
|
39
|
-
}, void 0, withCarousel ? /*#__PURE__*/_jsx__default["default"](Carousel, {}, void 0, tabsComponents) : tabsComponents),
|
|
40
|
-
showSelectionIndicator: false,
|
|
41
|
-
showSeparator: true,
|
|
42
|
-
tabs: tabs
|
|
14
|
+
const SubTabList = dsClassnames.aggregatedClasses('div')(blockName, 'subtabs-list', _ref => {
|
|
15
|
+
let {
|
|
16
|
+
withCarousel
|
|
17
|
+
} = _ref;
|
|
18
|
+
return {
|
|
19
|
+
carousel: withCarousel
|
|
20
|
+
};
|
|
43
21
|
});
|
|
44
22
|
|
|
23
|
+
const SubTabBar = _ref2 => {
|
|
24
|
+
let {
|
|
25
|
+
withCarousel,
|
|
26
|
+
tabs = [],
|
|
27
|
+
activeTab = '',
|
|
28
|
+
onTabClick = () => null,
|
|
29
|
+
firstSubtabRef,
|
|
30
|
+
handleUpArrow
|
|
31
|
+
} = _ref2;
|
|
32
|
+
return /*#__PURE__*/_jsx__default["default"](TabBar, {
|
|
33
|
+
activeTab: activeTab,
|
|
34
|
+
onTabClick: onTabClick,
|
|
35
|
+
handleUpArrow: handleUpArrow,
|
|
36
|
+
firstSubtabRef: firstSubtabRef,
|
|
37
|
+
renderCustomTabBar: _ref3 => {
|
|
38
|
+
let {
|
|
39
|
+
tabsComponents,
|
|
40
|
+
innerRef
|
|
41
|
+
} = _ref3;
|
|
42
|
+
return /*#__PURE__*/_jsx__default["default"](SubTabList, {
|
|
43
|
+
withCarousel: withCarousel,
|
|
44
|
+
innerRef: innerRef,
|
|
45
|
+
"data-testid": "subtabs-list"
|
|
46
|
+
}, void 0, withCarousel ? /*#__PURE__*/_jsx__default["default"](Carousel, {}, void 0, tabsComponents) : tabsComponents);
|
|
47
|
+
},
|
|
48
|
+
showSelectionIndicator: false,
|
|
49
|
+
showSeparator: true,
|
|
50
|
+
tabs: tabs
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
45
54
|
module.exports = SubTabBar;
|
package/cjs/TabBar.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
-
|
|
4
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
5
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
5
6
|
var React = require('react');
|
|
6
7
|
var lodash = require('lodash');
|
|
7
8
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
@@ -15,7 +16,6 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
15
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
17
|
|
|
17
18
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
18
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
19
19
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
20
20
|
var RequiredMark__default = /*#__PURE__*/_interopDefaultLegacy(RequiredMark);
|
|
21
21
|
var memoizeOne__default = /*#__PURE__*/_interopDefaultLegacy(memoizeOne);
|
|
@@ -25,43 +25,52 @@ const blockName = 'tabs-tab-bar';
|
|
|
25
25
|
const gradientWidth = 24;
|
|
26
26
|
const StyledTabWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
27
27
|
componentId: "sc-7sdovg-0"
|
|
28
|
-
})(["display:flex;flex:1;flex-wrap:nowrap;", ";"],
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
28
|
+
})(["display:flex;flex:1;flex-wrap:nowrap;", ";"], _ref => {
|
|
29
|
+
let {
|
|
30
|
+
flexibleTabsHeaders
|
|
31
|
+
} = _ref;
|
|
32
|
+
return flexibleTabsHeaders ? '' : 'overflow-x: hidden';
|
|
33
|
+
});
|
|
34
|
+
const StyledTabList = dsClassnames.aggregatedClasses('div')(blockName, 'list', _ref2 => {
|
|
35
|
+
let {
|
|
36
|
+
withCarousel,
|
|
37
|
+
flexibleTabsHeaders,
|
|
38
|
+
fixedTabsHeaders,
|
|
39
|
+
isDSMobile,
|
|
40
|
+
withLeftGradients,
|
|
41
|
+
withRightGradients
|
|
42
|
+
} = _ref2;
|
|
43
|
+
return {
|
|
44
|
+
carousel: withCarousel,
|
|
45
|
+
'flexible-table-headers': isDSMobile && flexibleTabsHeaders,
|
|
46
|
+
'fixed-table-headers': isDSMobile && fixedTabsHeaders,
|
|
47
|
+
'left-gradients': isDSMobile && flexibleTabsHeaders && withLeftGradients,
|
|
48
|
+
'right-gradients': isDSMobile && flexibleTabsHeaders && withRightGradients
|
|
49
|
+
};
|
|
50
|
+
}, {
|
|
45
51
|
propsToRemoveFromFinalElement: ['withCarousel', 'flexibleTabsHeaders', 'fixedTabsHeaders', 'withLeftGradients', 'withRightGradients', 'isDSMobile']
|
|
46
52
|
});
|
|
47
53
|
const TabContainer = dsClassnames.aggregatedClasses('button', {
|
|
48
54
|
role: 'tab'
|
|
49
|
-
})(blockName, 'tab',
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
})(blockName, 'tab', _ref3 => {
|
|
56
|
+
let {
|
|
57
|
+
isActive,
|
|
58
|
+
showSeparator,
|
|
59
|
+
disabled
|
|
60
|
+
} = _ref3;
|
|
61
|
+
return {
|
|
62
|
+
active: isActive,
|
|
63
|
+
separator: showSeparator,
|
|
64
|
+
disabled
|
|
65
|
+
};
|
|
66
|
+
});
|
|
58
67
|
const SelectionIndicator = dsClassnames.aggregatedClasses('div')(blockName, 'selection-indicator');
|
|
59
68
|
|
|
60
69
|
class TabBar extends React.Component {
|
|
61
70
|
constructor(_props) {
|
|
62
71
|
super(_props);
|
|
63
72
|
|
|
64
|
-
|
|
73
|
+
this.handleTabClick = (tabId, e) => {
|
|
65
74
|
const {
|
|
66
75
|
tabListRef,
|
|
67
76
|
props
|
|
@@ -96,9 +105,9 @@ class TabBar extends React.Component {
|
|
|
96
105
|
|
|
97
106
|
e.preventDefault();
|
|
98
107
|
onTabClick(tabId);
|
|
99
|
-
}
|
|
108
|
+
};
|
|
100
109
|
|
|
101
|
-
|
|
110
|
+
this.handleKeyPress = (tabId, e, index) => {
|
|
102
111
|
const {
|
|
103
112
|
tabs,
|
|
104
113
|
handleDownArrow,
|
|
@@ -135,9 +144,9 @@ class TabBar extends React.Component {
|
|
|
135
144
|
if (e.keyCode === 38 && handleUpArrow) {
|
|
136
145
|
handleUpArrow(e);
|
|
137
146
|
}
|
|
138
|
-
}
|
|
147
|
+
};
|
|
139
148
|
|
|
140
|
-
|
|
149
|
+
this.handleTabsHeadersHorizontalScroll = lodash.debounce(() => {
|
|
141
150
|
const {
|
|
142
151
|
tabListRef,
|
|
143
152
|
props
|
|
@@ -161,9 +170,8 @@ class TabBar extends React.Component {
|
|
|
161
170
|
withRightGradients
|
|
162
171
|
});
|
|
163
172
|
}
|
|
164
|
-
}, 50)
|
|
165
|
-
|
|
166
|
-
_defineProperty__default["default"](this, "renderTabs", memoizeOne__default["default"]((activeTab, tabs) => {
|
|
173
|
+
}, 50);
|
|
174
|
+
this.renderTabs = memoizeOne__default["default"]((activeTab, tabs) => {
|
|
167
175
|
const {
|
|
168
176
|
showSeparator
|
|
169
177
|
} = this.props;
|
|
@@ -212,8 +220,7 @@ class TabBar extends React.Component {
|
|
|
212
220
|
})]
|
|
213
221
|
}, tabId)];
|
|
214
222
|
}, null);
|
|
215
|
-
})
|
|
216
|
-
|
|
223
|
+
});
|
|
217
224
|
this.tabListRef = /*#__PURE__*/React__default["default"].createRef();
|
|
218
225
|
this.resizeObserver = new resizeObserver.ResizeObserver(() => this.setIndicatorStyle());
|
|
219
226
|
this.state = {
|
package/cjs/TabTypes.js
CHANGED
package/cjs/TabsImpl.js
CHANGED
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
4
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
5
5
|
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
6
11
|
var React = require('react');
|
|
7
12
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
8
13
|
var TabsPanels = require('./TabsPanels.js');
|
package/cjs/TabsPanels.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
4
|
require('core-js/modules/web.dom-collections.iterator.js');
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
6
7
|
var React = require('react');
|
|
7
8
|
var memoizeOne = require('memoize-one');
|
|
8
9
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
@@ -12,7 +13,6 @@ var PanelContainer = require('./PanelContainer.js');
|
|
|
12
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
14
|
|
|
14
15
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
15
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
16
16
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
17
|
var memoizeOne__default = /*#__PURE__*/_interopDefaultLegacy(memoizeOne);
|
|
18
18
|
var SwipeableViews__default = /*#__PURE__*/_interopDefaultLegacy(SwipeableViews);
|
|
@@ -25,10 +25,9 @@ const getIndexById = (children, activeId) => children && children.findIndex(item
|
|
|
25
25
|
const getIdByIndex = (children, index) => children && children[index].props.tabId;
|
|
26
26
|
|
|
27
27
|
class TabsPanels extends React.Component {
|
|
28
|
-
constructor(
|
|
29
|
-
super(...
|
|
30
|
-
|
|
31
|
-
_defineProperty__default["default"](this, "renderPanels", memoizeOne__default["default"]((activeTab, tabsComponents) => {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
this.renderPanels = memoizeOne__default["default"]((activeTab, tabsComponents) => {
|
|
32
31
|
const {
|
|
33
32
|
animated,
|
|
34
33
|
onlyRenderActiveTab,
|
|
@@ -59,7 +58,7 @@ class TabsPanels extends React.Component {
|
|
|
59
58
|
style: style
|
|
60
59
|
}, panelId, shouldRender && content);
|
|
61
60
|
}, null);
|
|
62
|
-
})
|
|
61
|
+
});
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
render() {
|
package/esm/Carousel.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.reduce.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.reduce.js';
|
|
6
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
3
8
|
import React, { useRef, useState, useEffect } from 'react';
|
|
4
|
-
import ChevronRight from '@elliemae/ds-icons
|
|
5
|
-
import ChevronLeft from '@elliemae/ds-icons/ChevronLeft';
|
|
9
|
+
import { ChevronLeft, ChevronRight } from '@elliemae/ds-icons';
|
|
6
10
|
import styled from 'styled-components';
|
|
7
11
|
import DSButton from '@elliemae/ds-button';
|
|
8
12
|
import { useResize } from './useResize.js';
|
|
@@ -10,9 +14,12 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
10
14
|
|
|
11
15
|
const CarouselBtn = /*#__PURE__*/styled(DSButton).withConfig({
|
|
12
16
|
componentId: "sc-1317h31-0"
|
|
13
|
-
})(["position:absolute;z-index:1;margin:0;&:focus{& span{background-color:", ";background-size:90%;border-radius:2px;border-color:transparent;}}&&{width:16px;height:calc(100% - 2px);@media (min-width:", "){height:calc(100% - 4px);&:focus{& span{background-color:unset;}}}}", " && .em-ds-icon{height:16px;width:16px;}"], props => props.theme.colors.brand[200],
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
})(["position:absolute;z-index:1;margin:0;&:focus{& span{background-color:", ";background-size:90%;border-radius:2px;border-color:transparent;}}&&{width:16px;height:calc(100% - 2px);@media (min-width:", "){height:calc(100% - 4px);&:focus{& span{background-color:unset;}}}}", " && .em-ds-icon{height:16px;width:16px;}"], props => props.theme.colors.brand[200], _ref => {
|
|
18
|
+
let {
|
|
19
|
+
theme
|
|
20
|
+
} = _ref;
|
|
21
|
+
return theme.breakpoints.medium;
|
|
22
|
+
}, props => props.right ? 'right: 0;' : 'left: 0;');
|
|
16
23
|
const CarouselWrapper = /*#__PURE__*/styled.span.withConfig({
|
|
17
24
|
componentId: "sc-1317h31-1"
|
|
18
25
|
})(["position:relative;padding:0 16px;width:100%;"]);
|
|
@@ -30,10 +37,11 @@ function isVisibleElement(el, container) {
|
|
|
30
37
|
return isVisible;
|
|
31
38
|
}
|
|
32
39
|
|
|
33
|
-
const Carousel =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
const Carousel = _ref2 => {
|
|
41
|
+
let {
|
|
42
|
+
children,
|
|
43
|
+
onScroll
|
|
44
|
+
} = _ref2;
|
|
37
45
|
const itemsRef = useRef([]);
|
|
38
46
|
const wrapRef = useRef(null);
|
|
39
47
|
const leftRef = useRef(null);
|
|
@@ -110,7 +118,8 @@ const Carousel = ({
|
|
|
110
118
|
onScroll(e);
|
|
111
119
|
};
|
|
112
120
|
|
|
113
|
-
const handleClick = (e
|
|
121
|
+
const handleClick = function (e) {
|
|
122
|
+
let onClick = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => {};
|
|
114
123
|
const tabListDomEl = wrapRef.current;
|
|
115
124
|
const el = e.target;
|
|
116
125
|
const rect = el.getBoundingClientRect();
|
package/esm/DSTab.js
CHANGED
|
@@ -2,16 +2,19 @@ import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
|
2
2
|
import 'react';
|
|
3
3
|
import { PropTypes, describe } from 'react-desc';
|
|
4
4
|
|
|
5
|
-
const DSTab =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
const DSTab = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
tabId = '',
|
|
8
|
+
title = '',
|
|
9
|
+
required = false
|
|
10
|
+
} = _ref;
|
|
11
|
+
return /*#__PURE__*/_jsx("div", {
|
|
12
|
+
"aria-labelledby": "".concat(tabId, "-label"),
|
|
13
|
+
tabId: tabId,
|
|
14
|
+
title: title,
|
|
15
|
+
required: required
|
|
16
|
+
});
|
|
17
|
+
};
|
|
15
18
|
|
|
16
19
|
DSTab.displayName = 'DSTab';
|
|
17
20
|
const props = {
|
package/esm/DSTabs.js
CHANGED
|
@@ -5,44 +5,47 @@ import { TabTypes } from './TabTypes.js';
|
|
|
5
5
|
import TabsImpl from './TabsImpl.js';
|
|
6
6
|
import { DSTab } from './DSTab.js';
|
|
7
7
|
|
|
8
|
-
const DSTabs =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
8
|
+
const DSTabs = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
containerProps = {},
|
|
11
|
+
innerRef,
|
|
12
|
+
animated = true,
|
|
13
|
+
enableMouseEvents = false,
|
|
14
|
+
allowTextSelection = false,
|
|
15
|
+
onTabChange = () => null,
|
|
16
|
+
tabsListAriaLabel = 'Tab list',
|
|
17
|
+
type = TabTypes.NORMAL,
|
|
18
|
+
tabBarExtraContent = undefined,
|
|
19
|
+
children: tabs,
|
|
20
|
+
onlyRenderActiveTab = false,
|
|
21
|
+
activeTab,
|
|
22
|
+
withCarousel = false,
|
|
23
|
+
firstSubtabRef,
|
|
24
|
+
lastTabRef,
|
|
25
|
+
flexibleTabsHeaders,
|
|
26
|
+
fixedTabsHeaders,
|
|
27
|
+
isDSMobile = false
|
|
28
|
+
} = _ref;
|
|
29
|
+
return /*#__PURE__*/_jsx(TabsImpl, {
|
|
30
|
+
activeTab: activeTab,
|
|
31
|
+
firstSubtabRef: firstSubtabRef,
|
|
32
|
+
lastTabRef: lastTabRef,
|
|
33
|
+
allowTextSelection: allowTextSelection,
|
|
34
|
+
animated: animated,
|
|
35
|
+
containerProps: containerProps,
|
|
36
|
+
enableMouseEvents: enableMouseEvents,
|
|
37
|
+
innerRef: innerRef,
|
|
38
|
+
onlyRenderActiveTab: onlyRenderActiveTab,
|
|
39
|
+
onTabChange: onTabChange,
|
|
40
|
+
tabBarExtraContent: tabBarExtraContent,
|
|
41
|
+
tabsListAriaLabel: tabsListAriaLabel,
|
|
42
|
+
type: type,
|
|
43
|
+
withCarousel: withCarousel,
|
|
44
|
+
flexibleTabsHeaders: flexibleTabsHeaders,
|
|
45
|
+
fixedTabsHeaders: fixedTabsHeaders,
|
|
46
|
+
isDSMobile: isDSMobile
|
|
47
|
+
}, void 0, tabs);
|
|
48
|
+
};
|
|
46
49
|
|
|
47
50
|
const props = {
|
|
48
51
|
/** Whether the tab transition should animate or not */
|
package/esm/PanelContainer.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
5
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
3
10
|
import React from 'react';
|
|
4
11
|
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
5
12
|
import { jsx } from 'react/jsx-runtime';
|
package/esm/SubTabBar.js
CHANGED
|
@@ -5,35 +5,44 @@ import TabBar from './TabBar.js';
|
|
|
5
5
|
import Carousel from './Carousel.js';
|
|
6
6
|
|
|
7
7
|
const blockName = 'tabs-tab-bar';
|
|
8
|
-
const SubTabList = aggregatedClasses('div')(blockName, 'subtabs-list',
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
withCarousel,
|
|
16
|
-
tabs = [],
|
|
17
|
-
activeTab = '',
|
|
18
|
-
onTabClick = () => null,
|
|
19
|
-
firstSubtabRef,
|
|
20
|
-
handleUpArrow
|
|
21
|
-
}) => /*#__PURE__*/_jsx(TabBar, {
|
|
22
|
-
activeTab: activeTab,
|
|
23
|
-
onTabClick: onTabClick,
|
|
24
|
-
handleUpArrow: handleUpArrow,
|
|
25
|
-
firstSubtabRef: firstSubtabRef,
|
|
26
|
-
renderCustomTabBar: ({
|
|
27
|
-
tabsComponents,
|
|
28
|
-
innerRef
|
|
29
|
-
}) => /*#__PURE__*/_jsx(SubTabList, {
|
|
30
|
-
withCarousel: withCarousel,
|
|
31
|
-
innerRef: innerRef,
|
|
32
|
-
"data-testid": "subtabs-list"
|
|
33
|
-
}, void 0, withCarousel ? /*#__PURE__*/_jsx(Carousel, {}, void 0, tabsComponents) : tabsComponents),
|
|
34
|
-
showSelectionIndicator: false,
|
|
35
|
-
showSeparator: true,
|
|
36
|
-
tabs: tabs
|
|
8
|
+
const SubTabList = aggregatedClasses('div')(blockName, 'subtabs-list', _ref => {
|
|
9
|
+
let {
|
|
10
|
+
withCarousel
|
|
11
|
+
} = _ref;
|
|
12
|
+
return {
|
|
13
|
+
carousel: withCarousel
|
|
14
|
+
};
|
|
37
15
|
});
|
|
38
16
|
|
|
17
|
+
const SubTabBar = _ref2 => {
|
|
18
|
+
let {
|
|
19
|
+
withCarousel,
|
|
20
|
+
tabs = [],
|
|
21
|
+
activeTab = '',
|
|
22
|
+
onTabClick = () => null,
|
|
23
|
+
firstSubtabRef,
|
|
24
|
+
handleUpArrow
|
|
25
|
+
} = _ref2;
|
|
26
|
+
return /*#__PURE__*/_jsx(TabBar, {
|
|
27
|
+
activeTab: activeTab,
|
|
28
|
+
onTabClick: onTabClick,
|
|
29
|
+
handleUpArrow: handleUpArrow,
|
|
30
|
+
firstSubtabRef: firstSubtabRef,
|
|
31
|
+
renderCustomTabBar: _ref3 => {
|
|
32
|
+
let {
|
|
33
|
+
tabsComponents,
|
|
34
|
+
innerRef
|
|
35
|
+
} = _ref3;
|
|
36
|
+
return /*#__PURE__*/_jsx(SubTabList, {
|
|
37
|
+
withCarousel: withCarousel,
|
|
38
|
+
innerRef: innerRef,
|
|
39
|
+
"data-testid": "subtabs-list"
|
|
40
|
+
}, void 0, withCarousel ? /*#__PURE__*/_jsx(Carousel, {}, void 0, tabsComponents) : tabsComponents);
|
|
41
|
+
},
|
|
42
|
+
showSelectionIndicator: false,
|
|
43
|
+
showSeparator: true,
|
|
44
|
+
tabs: tabs
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
39
48
|
export { SubTabBar as default };
|
package/esm/TabBar.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import
|
|
2
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
3
4
|
import React, { Component } from 'react';
|
|
4
5
|
import { debounce } from 'lodash';
|
|
5
6
|
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
@@ -14,43 +15,52 @@ const blockName = 'tabs-tab-bar';
|
|
|
14
15
|
const gradientWidth = 24;
|
|
15
16
|
const StyledTabWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
16
17
|
componentId: "sc-7sdovg-0"
|
|
17
|
-
})(["display:flex;flex:1;flex-wrap:nowrap;", ";"],
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
})(["display:flex;flex:1;flex-wrap:nowrap;", ";"], _ref => {
|
|
19
|
+
let {
|
|
20
|
+
flexibleTabsHeaders
|
|
21
|
+
} = _ref;
|
|
22
|
+
return flexibleTabsHeaders ? '' : 'overflow-x: hidden';
|
|
23
|
+
});
|
|
24
|
+
const StyledTabList = aggregatedClasses('div')(blockName, 'list', _ref2 => {
|
|
25
|
+
let {
|
|
26
|
+
withCarousel,
|
|
27
|
+
flexibleTabsHeaders,
|
|
28
|
+
fixedTabsHeaders,
|
|
29
|
+
isDSMobile,
|
|
30
|
+
withLeftGradients,
|
|
31
|
+
withRightGradients
|
|
32
|
+
} = _ref2;
|
|
33
|
+
return {
|
|
34
|
+
carousel: withCarousel,
|
|
35
|
+
'flexible-table-headers': isDSMobile && flexibleTabsHeaders,
|
|
36
|
+
'fixed-table-headers': isDSMobile && fixedTabsHeaders,
|
|
37
|
+
'left-gradients': isDSMobile && flexibleTabsHeaders && withLeftGradients,
|
|
38
|
+
'right-gradients': isDSMobile && flexibleTabsHeaders && withRightGradients
|
|
39
|
+
};
|
|
40
|
+
}, {
|
|
34
41
|
propsToRemoveFromFinalElement: ['withCarousel', 'flexibleTabsHeaders', 'fixedTabsHeaders', 'withLeftGradients', 'withRightGradients', 'isDSMobile']
|
|
35
42
|
});
|
|
36
43
|
const TabContainer = aggregatedClasses('button', {
|
|
37
44
|
role: 'tab'
|
|
38
|
-
})(blockName, 'tab',
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
})(blockName, 'tab', _ref3 => {
|
|
46
|
+
let {
|
|
47
|
+
isActive,
|
|
48
|
+
showSeparator,
|
|
49
|
+
disabled
|
|
50
|
+
} = _ref3;
|
|
51
|
+
return {
|
|
52
|
+
active: isActive,
|
|
53
|
+
separator: showSeparator,
|
|
54
|
+
disabled
|
|
55
|
+
};
|
|
56
|
+
});
|
|
47
57
|
const SelectionIndicator = aggregatedClasses('div')(blockName, 'selection-indicator');
|
|
48
58
|
|
|
49
59
|
class TabBar extends Component {
|
|
50
60
|
constructor(_props) {
|
|
51
61
|
super(_props);
|
|
52
62
|
|
|
53
|
-
|
|
63
|
+
this.handleTabClick = (tabId, e) => {
|
|
54
64
|
const {
|
|
55
65
|
tabListRef,
|
|
56
66
|
props
|
|
@@ -85,9 +95,9 @@ class TabBar extends Component {
|
|
|
85
95
|
|
|
86
96
|
e.preventDefault();
|
|
87
97
|
onTabClick(tabId);
|
|
88
|
-
}
|
|
98
|
+
};
|
|
89
99
|
|
|
90
|
-
|
|
100
|
+
this.handleKeyPress = (tabId, e, index) => {
|
|
91
101
|
const {
|
|
92
102
|
tabs,
|
|
93
103
|
handleDownArrow,
|
|
@@ -124,9 +134,9 @@ class TabBar extends Component {
|
|
|
124
134
|
if (e.keyCode === 38 && handleUpArrow) {
|
|
125
135
|
handleUpArrow(e);
|
|
126
136
|
}
|
|
127
|
-
}
|
|
137
|
+
};
|
|
128
138
|
|
|
129
|
-
|
|
139
|
+
this.handleTabsHeadersHorizontalScroll = debounce(() => {
|
|
130
140
|
const {
|
|
131
141
|
tabListRef,
|
|
132
142
|
props
|
|
@@ -150,9 +160,8 @@ class TabBar extends Component {
|
|
|
150
160
|
withRightGradients
|
|
151
161
|
});
|
|
152
162
|
}
|
|
153
|
-
}, 50)
|
|
154
|
-
|
|
155
|
-
_defineProperty(this, "renderTabs", memoizeOne((activeTab, tabs) => {
|
|
163
|
+
}, 50);
|
|
164
|
+
this.renderTabs = memoizeOne((activeTab, tabs) => {
|
|
156
165
|
const {
|
|
157
166
|
showSeparator
|
|
158
167
|
} = this.props;
|
|
@@ -201,8 +210,7 @@ class TabBar extends Component {
|
|
|
201
210
|
})]
|
|
202
211
|
}, tabId)];
|
|
203
212
|
}, null);
|
|
204
|
-
})
|
|
205
|
-
|
|
213
|
+
});
|
|
206
214
|
this.tabListRef = /*#__PURE__*/React.createRef();
|
|
207
215
|
this.resizeObserver = new ResizeObserver(() => this.setIndicatorStyle());
|
|
208
216
|
this.state = {
|
package/esm/TabTypes.js
CHANGED
package/esm/TabsImpl.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
8
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
package/esm/TabsPanels.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
2
|
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
4
5
|
import React, { Component } from 'react';
|
|
5
6
|
import memoizeOne from 'memoize-one';
|
|
6
7
|
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
@@ -15,10 +16,9 @@ const getIndexById = (children, activeId) => children && children.findIndex(item
|
|
|
15
16
|
const getIdByIndex = (children, index) => children && children[index].props.tabId;
|
|
16
17
|
|
|
17
18
|
class TabsPanels extends Component {
|
|
18
|
-
constructor(
|
|
19
|
-
super(...
|
|
20
|
-
|
|
21
|
-
_defineProperty(this, "renderPanels", memoizeOne((activeTab, tabsComponents) => {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.renderPanels = memoizeOne((activeTab, tabsComponents) => {
|
|
22
22
|
const {
|
|
23
23
|
animated,
|
|
24
24
|
onlyRenderActiveTab,
|
|
@@ -49,7 +49,7 @@ class TabsPanels extends Component {
|
|
|
49
49
|
style: style
|
|
50
50
|
}, panelId, shouldRender && content);
|
|
51
51
|
}, null);
|
|
52
|
-
})
|
|
52
|
+
});
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
render() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-tabs",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Tabs",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -72,20 +72,27 @@
|
|
|
72
72
|
"build": "node ../../scripts/build/build.js"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@elliemae/ds-button": "2.0.0-
|
|
76
|
-
"@elliemae/ds-classnames": "2.0.0-
|
|
77
|
-
"@elliemae/ds-form": "2.0.0-
|
|
78
|
-
"@elliemae/ds-icons": "2.0.0-
|
|
75
|
+
"@elliemae/ds-button": "2.0.0-rc.12",
|
|
76
|
+
"@elliemae/ds-classnames": "2.0.0-rc.12",
|
|
77
|
+
"@elliemae/ds-form": "2.0.0-rc.12",
|
|
78
|
+
"@elliemae/ds-icons": "2.0.0-rc.12",
|
|
79
79
|
"memoize-one": "~5.1.1",
|
|
80
80
|
"prop-types": "~15.7.2",
|
|
81
|
-
"react-desc": "
|
|
81
|
+
"react-desc": "~4.1.3",
|
|
82
82
|
"react-swipeable-views": "~0.13.9",
|
|
83
83
|
"resize-observer": "~1.0.2"
|
|
84
84
|
},
|
|
85
|
+
"devDependencies": {
|
|
86
|
+
"@testing-library/jest-dom": "~5.15.0",
|
|
87
|
+
"@testing-library/react": "~12.1.2",
|
|
88
|
+
"@testing-library/user-event": "~13.5.0",
|
|
89
|
+
"styled-components": "~5.3.3"
|
|
90
|
+
},
|
|
85
91
|
"peerDependencies": {
|
|
86
92
|
"lodash": "^4.17.21",
|
|
87
93
|
"react": "^17.0.2",
|
|
88
|
-
"react-dom": "^17.0.2"
|
|
94
|
+
"react-dom": "^17.0.2",
|
|
95
|
+
"styled-components": "^5.3.3"
|
|
89
96
|
},
|
|
90
97
|
"publishConfig": {
|
|
91
98
|
"access": "public",
|
package/types/DSTab.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
1
2
|
/// <reference types="react" />
|
|
2
3
|
declare const DSTab: {
|
|
3
4
|
({ tabId, title, required }: {
|
|
@@ -8,15 +9,43 @@ declare const DSTab: {
|
|
|
8
9
|
displayName: string;
|
|
9
10
|
propTypes: {
|
|
10
11
|
/** unique id for tab */
|
|
11
|
-
tabId:
|
|
12
|
+
tabId: {
|
|
13
|
+
defaultValue<T = unknown>(arg: T): {
|
|
14
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
15
|
+
};
|
|
16
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
17
|
+
};
|
|
12
18
|
/** tab title */
|
|
13
|
-
title:
|
|
19
|
+
title: {
|
|
20
|
+
defaultValue<T = unknown>(arg: T): {
|
|
21
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
22
|
+
};
|
|
23
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
24
|
+
};
|
|
14
25
|
/** Show a required mark next to the title */
|
|
15
|
-
required:
|
|
26
|
+
required: {
|
|
27
|
+
defaultValue<T = unknown>(arg: T): {
|
|
28
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
29
|
+
};
|
|
30
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
31
|
+
};
|
|
16
32
|
/** Whether or not it's a ds-tab from DSMobile tabs */
|
|
17
|
-
isDSMobile:
|
|
33
|
+
isDSMobile: {
|
|
34
|
+
defaultValue<T = unknown>(arg: T): {
|
|
35
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
36
|
+
};
|
|
37
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
38
|
+
};
|
|
18
39
|
};
|
|
19
40
|
};
|
|
20
|
-
declare const DSTabWithSchema:
|
|
41
|
+
declare const DSTabWithSchema: {
|
|
42
|
+
(props?: {
|
|
43
|
+
tabId?: string | undefined;
|
|
44
|
+
title?: string | undefined;
|
|
45
|
+
required?: boolean | undefined;
|
|
46
|
+
} | undefined): JSX.Element;
|
|
47
|
+
propTypes: unknown;
|
|
48
|
+
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
49
|
+
};
|
|
21
50
|
export { DSTab, DSTabWithSchema };
|
|
22
51
|
export default DSTab;
|
package/types/DSTabs.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
1
2
|
/// <reference types="react" />
|
|
2
3
|
declare const DSTabs: {
|
|
3
4
|
({ containerProps, innerRef, animated, enableMouseEvents, allowTextSelection, onTabChange, tabsListAriaLabel, type, tabBarExtraContent, children: tabs, onlyRenderActiveTab, activeTab, withCarousel, firstSubtabRef, lastTabRef, flexibleTabsHeaders, fixedTabsHeaders, isDSMobile, }: {
|
|
@@ -22,43 +23,151 @@ declare const DSTabs: {
|
|
|
22
23
|
}): JSX.Element;
|
|
23
24
|
propTypes: {
|
|
24
25
|
/** Whether the tab transition should animate or not */
|
|
25
|
-
animated:
|
|
26
|
+
animated: {
|
|
27
|
+
defaultValue<T = unknown>(arg: T): {
|
|
28
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
29
|
+
};
|
|
30
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
31
|
+
};
|
|
26
32
|
/** Enables tab transition with mouse drag events */
|
|
27
|
-
enableMouseEvents:
|
|
33
|
+
enableMouseEvents: {
|
|
34
|
+
defaultValue<T = unknown>(arg: T): {
|
|
35
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
36
|
+
};
|
|
37
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
38
|
+
};
|
|
28
39
|
/** Allow text selection when mouse drag events are active */
|
|
29
|
-
allowTextSelection:
|
|
40
|
+
allowTextSelection: {
|
|
41
|
+
defaultValue<T = unknown>(arg: T): {
|
|
42
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
43
|
+
};
|
|
44
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
45
|
+
};
|
|
30
46
|
/** Handler when a user clicks on a different tab */
|
|
31
|
-
onTabChange:
|
|
47
|
+
onTabChange: {
|
|
48
|
+
defaultValue<T = unknown>(arg: T): {
|
|
49
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
50
|
+
};
|
|
51
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
52
|
+
};
|
|
32
53
|
/** Tab type */
|
|
33
|
-
type:
|
|
54
|
+
type: {
|
|
55
|
+
defaultValue<T = unknown>(arg: T): {
|
|
56
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
57
|
+
};
|
|
58
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
59
|
+
};
|
|
34
60
|
/** Extra content next to the tabs pills */
|
|
35
|
-
tabBarExtraContent:
|
|
61
|
+
tabBarExtraContent: {
|
|
62
|
+
defaultValue<T = unknown>(arg: T): {
|
|
63
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
64
|
+
};
|
|
65
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
66
|
+
};
|
|
36
67
|
/** Only renders the active tab in the DOM */
|
|
37
|
-
onlyRenderActiveTab:
|
|
68
|
+
onlyRenderActiveTab: {
|
|
69
|
+
defaultValue<T = unknown>(arg: T): {
|
|
70
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
71
|
+
};
|
|
72
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
73
|
+
};
|
|
38
74
|
/** Mobile only flexible tabs mode */
|
|
39
|
-
flexibleTabsHeaders:
|
|
75
|
+
flexibleTabsHeaders: {
|
|
76
|
+
defaultValue<T = unknown>(arg: T): {
|
|
77
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
78
|
+
};
|
|
79
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
80
|
+
};
|
|
40
81
|
/** Mobile only fixed tabs mode */
|
|
41
|
-
fixedTabsHeaders:
|
|
82
|
+
fixedTabsHeaders: {
|
|
83
|
+
defaultValue<T = unknown>(arg: T): {
|
|
84
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
85
|
+
};
|
|
86
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
87
|
+
};
|
|
42
88
|
/** Whether or not it's a ds-tab from DSMobile tabs */
|
|
43
|
-
isDSMobile:
|
|
89
|
+
isDSMobile: {
|
|
90
|
+
defaultValue<T = unknown>(arg: T): {
|
|
91
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
92
|
+
};
|
|
93
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
94
|
+
};
|
|
44
95
|
/** Activate carousel behavior */
|
|
45
|
-
withCarousel:
|
|
96
|
+
withCarousel: {
|
|
97
|
+
defaultValue<T = unknown>(arg: T): {
|
|
98
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
99
|
+
};
|
|
100
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
101
|
+
};
|
|
46
102
|
/** The active tabId */
|
|
47
|
-
activeTab:
|
|
103
|
+
activeTab: {
|
|
104
|
+
defaultValue<T = unknown>(arg: T): {
|
|
105
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
106
|
+
};
|
|
107
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
108
|
+
};
|
|
48
109
|
/** tabs children */
|
|
49
110
|
children: any;
|
|
50
111
|
/** Aria label for the list */
|
|
51
|
-
tabsListAriaLabel:
|
|
112
|
+
tabsListAriaLabel: {
|
|
113
|
+
defaultValue<T = unknown>(arg: T): {
|
|
114
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
115
|
+
};
|
|
116
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
117
|
+
};
|
|
52
118
|
/** Additional properties for the container */
|
|
53
|
-
containerProps:
|
|
119
|
+
containerProps: {
|
|
120
|
+
defaultValue<T = unknown>(arg: T): {
|
|
121
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
122
|
+
};
|
|
123
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
124
|
+
};
|
|
54
125
|
/** REF */
|
|
55
|
-
innerRef:
|
|
126
|
+
innerRef: {
|
|
127
|
+
defaultValue<T = unknown>(arg: T): {
|
|
128
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
129
|
+
};
|
|
130
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
131
|
+
};
|
|
56
132
|
/** internal ref to handle keyboard a11y behavior */
|
|
57
|
-
firstSubtabRef:
|
|
133
|
+
firstSubtabRef: {
|
|
134
|
+
defaultValue<T = unknown>(arg: T): {
|
|
135
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
136
|
+
};
|
|
137
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
138
|
+
};
|
|
58
139
|
/** internal ref to handle keyboard a11y behavior */
|
|
59
|
-
lastTabRef:
|
|
140
|
+
lastTabRef: {
|
|
141
|
+
defaultValue<T = unknown>(arg: T): {
|
|
142
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
143
|
+
};
|
|
144
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
145
|
+
};
|
|
60
146
|
};
|
|
61
147
|
};
|
|
62
|
-
declare const DSTabsWithSchema:
|
|
148
|
+
declare const DSTabsWithSchema: {
|
|
149
|
+
(props?: {
|
|
150
|
+
containerProps?: {} | undefined;
|
|
151
|
+
innerRef: any;
|
|
152
|
+
animated?: boolean | undefined;
|
|
153
|
+
enableMouseEvents?: boolean | undefined;
|
|
154
|
+
allowTextSelection?: boolean | undefined;
|
|
155
|
+
onTabChange?: (() => null) | undefined;
|
|
156
|
+
tabsListAriaLabel?: string | undefined;
|
|
157
|
+
type?: string | undefined;
|
|
158
|
+
tabBarExtraContent?: undefined;
|
|
159
|
+
children: any;
|
|
160
|
+
onlyRenderActiveTab?: boolean | undefined;
|
|
161
|
+
activeTab: any;
|
|
162
|
+
withCarousel?: boolean | undefined;
|
|
163
|
+
firstSubtabRef: any;
|
|
164
|
+
lastTabRef: any;
|
|
165
|
+
flexibleTabsHeaders: any;
|
|
166
|
+
fixedTabsHeaders: any;
|
|
167
|
+
isDSMobile?: boolean | undefined;
|
|
168
|
+
} | undefined): JSX.Element;
|
|
169
|
+
propTypes: unknown;
|
|
170
|
+
toTypescript: () => import("react-desc").TypescriptSchema; /** Handler when a user clicks on a different tab */
|
|
171
|
+
};
|
|
63
172
|
export { DSTabs, DSTabsWithSchema };
|
|
64
173
|
export default DSTabs;
|