@elliemae/ds-tabs 2.0.0-rc.9 → 2.0.2
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/DSTabs.js +27 -108
- package/cjs/DSTabsCTX.js +30 -0
- package/cjs/DSTabsDatatestid.js +18 -0
- package/cjs/DSTabsTypes.js +2 -0
- package/cjs/config/useCrossRef.js +17 -0
- package/cjs/config/useTabs.js +51 -0
- package/cjs/defaultProps.js +27 -0
- package/cjs/exportsRelated/DSTab.js +32 -0
- package/cjs/index.js +5 -5
- package/cjs/parts/carousel/Carousel.js +71 -0
- package/cjs/parts/carousel/styles.js +60 -0
- package/cjs/parts/carousel/useCarousel.js +78 -0
- package/cjs/parts/carousel/useCarouselCallbacks.js +72 -0
- package/cjs/parts/tabBar/TabBar.js +160 -0
- package/cjs/parts/tabBar/styles.js +199 -0
- package/cjs/parts/tabBar/useTabBar.js +98 -0
- package/cjs/parts/tabsContent/TabsContent.js +49 -0
- package/cjs/parts/tabsContent/styles.js +15 -0
- package/cjs/parts/tabsPanel/TabsPanels.js +77 -0
- package/cjs/parts/tabsPanel/styles.js +25 -0
- package/cjs/propTypes.js +33 -0
- package/cjs/utils/constants.js +29 -0
- package/cjs/utils/helpers.js +47 -0
- package/cjs/utils/hooks/useKeyboardNavigation.js +61 -0
- package/cjs/utils/hooks/useTabsCallbacks.js +59 -0
- package/esm/DSTabs.js +29 -110
- package/esm/DSTabsCTX.js +25 -0
- package/esm/DSTabsDatatestid.js +14 -0
- package/esm/DSTabsTypes.js +1 -0
- package/esm/config/useCrossRef.js +13 -0
- package/esm/config/useTabs.js +47 -0
- package/esm/defaultProps.js +23 -0
- package/esm/exportsRelated/DSTab.js +21 -0
- package/esm/index.js +4 -3
- package/esm/parts/carousel/Carousel.js +63 -0
- package/esm/parts/carousel/styles.js +49 -0
- package/esm/parts/carousel/useCarousel.js +70 -0
- package/esm/parts/carousel/useCarouselCallbacks.js +68 -0
- package/esm/parts/tabBar/TabBar.js +151 -0
- package/esm/parts/tabBar/styles.js +185 -0
- package/esm/parts/tabBar/useTabBar.js +90 -0
- package/esm/parts/tabsContent/TabsContent.js +40 -0
- package/esm/parts/tabsContent/styles.js +7 -0
- package/esm/parts/tabsPanel/TabsPanels.js +67 -0
- package/esm/parts/tabsPanel/styles.js +17 -0
- package/esm/propTypes.js +28 -0
- package/esm/utils/constants.js +21 -0
- package/esm/utils/helpers.js +37 -0
- package/esm/utils/hooks/useKeyboardNavigation.js +57 -0
- package/esm/utils/hooks/useTabsCallbacks.js +55 -0
- package/package.json +91 -35
- package/types/DSTabs.d.ts +6 -165
- package/types/DSTabsCTX.d.ts +4 -0
- package/types/DSTabsDatatestid.d.ts +12 -0
- package/types/DSTabsTypes.d.ts +202 -0
- package/types/config/useCrossRef.d.ts +2 -0
- package/types/config/useTabs.d.ts +2 -0
- package/types/defaultProps.d.ts +2 -0
- package/types/exportsRelated/DSTab.d.ts +14 -0
- package/types/index.d.ts +4 -3
- package/types/parts/carousel/Carousel.d.ts +3 -0
- package/types/parts/carousel/styles.d.ts +9 -0
- package/types/parts/carousel/useCarousel.d.ts +2 -0
- package/types/parts/carousel/useCarouselCallbacks.d.ts +2 -0
- package/types/parts/tabBar/TabBar.d.ts +2 -0
- package/types/parts/tabBar/styles.d.ts +7 -0
- package/types/parts/tabBar/useTabBar.d.ts +2 -0
- package/types/parts/tabsContent/TabsContent.d.ts +2 -0
- package/types/parts/tabsContent/styles.d.ts +1 -0
- package/types/parts/tabsPanel/TabsPanels.d.ts +2 -0
- package/types/parts/tabsPanel/styles.d.ts +2 -0
- package/types/propTypes.d.ts +54 -0
- package/types/tests/{DSTabs.events.test.d.ts → DSTabs.callbacks.test.d.ts} +0 -0
- package/types/tests/DSTabs.func.test.d.ts +1 -0
- package/types/tests/DSTabs.keyboard.test.d.ts +1 -0
- package/types/utils/constants.d.ts +19 -0
- package/types/utils/helpers.d.ts +8 -0
- package/types/utils/hooks/useKeyboardNavigation.d.ts +2 -0
- package/types/utils/hooks/useTabsCallbacks.d.ts +2 -0
- package/cjs/Carousel.js +0 -205
- package/cjs/DSTab.js +0 -46
- package/cjs/PanelContainer.js +0 -48
- package/cjs/SubTabBar.js +0 -54
- package/cjs/TabBar.js +0 -421
- package/cjs/TabTypes.js +0 -15
- package/cjs/TabsImpl.js +0 -120
- package/cjs/TabsPanels.js +0 -85
- package/cjs/useResize.js +0 -24
- package/esm/Carousel.js +0 -196
- package/esm/DSTab.js +0 -36
- package/esm/PanelContainer.js +0 -40
- package/esm/SubTabBar.js +0 -48
- package/esm/TabBar.js +0 -410
- package/esm/TabTypes.js +0 -10
- package/esm/TabsImpl.js +0 -113
- package/esm/TabsPanels.js +0 -75
- package/esm/useResize.js +0 -20
- package/types/Carousel.d.ts +0 -16
- package/types/DSTab.d.ts +0 -51
- package/types/PanelContainer.d.ts +0 -20
- package/types/SubTabBar.d.ts +0 -23
- package/types/TabBar.d.ts +0 -30
- package/types/TabTypes.d.ts +0 -5
- package/types/TabsImpl.d.ts +0 -37
- package/types/TabsPanels.d.ts +0 -5
- package/types/useResize.d.ts +0 -1
package/cjs/TabsPanels.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
|
-
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
|
-
require('core-js/modules/esnext.iterator.map.js');
|
|
8
|
-
var React = require('react');
|
|
9
|
-
var memoizeOne = require('memoize-one');
|
|
10
|
-
var dsClassnames = require('@elliemae/ds-classnames');
|
|
11
|
-
var SwipeableViews = require('react-swipeable-views');
|
|
12
|
-
var PanelContainer = require('./PanelContainer.js');
|
|
13
|
-
|
|
14
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
-
|
|
16
|
-
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
17
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
18
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
19
|
-
var memoizeOne__default = /*#__PURE__*/_interopDefaultLegacy(memoizeOne);
|
|
20
|
-
var SwipeableViews__default = /*#__PURE__*/_interopDefaultLegacy(SwipeableViews);
|
|
21
|
-
|
|
22
|
-
const blockName = 'tabs-panels';
|
|
23
|
-
const Panels = dsClassnames.aggregatedClasses('div')(blockName);
|
|
24
|
-
|
|
25
|
-
const getIndexById = (children, activeId) => children && children.findIndex(item => item.props.tabId === activeId);
|
|
26
|
-
|
|
27
|
-
const getIdByIndex = (children, index) => children && children[index].props.tabId;
|
|
28
|
-
|
|
29
|
-
class TabsPanels extends React.Component {
|
|
30
|
-
constructor() {
|
|
31
|
-
super(...arguments);
|
|
32
|
-
|
|
33
|
-
_defineProperty__default["default"](this, "renderPanels", memoizeOne__default["default"]((activeTab, tabsComponents) => {
|
|
34
|
-
const {
|
|
35
|
-
animated,
|
|
36
|
-
onlyRenderActiveTab,
|
|
37
|
-
allowTextSelection
|
|
38
|
-
} = this.props;
|
|
39
|
-
return React__default["default"].Children.map(tabsComponents, tab => {
|
|
40
|
-
const {
|
|
41
|
-
tabId: panelId,
|
|
42
|
-
style,
|
|
43
|
-
children: content
|
|
44
|
-
} = tab.props;
|
|
45
|
-
const isActive = activeTab === panelId;
|
|
46
|
-
const shouldRender = !onlyRenderActiveTab || isActive;
|
|
47
|
-
return /*#__PURE__*/_jsx__default["default"](PanelContainer, {
|
|
48
|
-
"aria-labelledby": "".concat(panelId, "-label"),
|
|
49
|
-
lastTabRef: this.props.lastTabRef,
|
|
50
|
-
firstSubtabRef: this.props.firstTabRefByParent,
|
|
51
|
-
classProps: {
|
|
52
|
-
isActive
|
|
53
|
-
},
|
|
54
|
-
"data-panel-id": panelId,
|
|
55
|
-
hidden: !animated && !isActive,
|
|
56
|
-
onMouseDown: e => {
|
|
57
|
-
const role = e.target.getAttribute('role');
|
|
58
|
-
if (role !== 'tabpanel' && allowTextSelection) e.stopPropagation();
|
|
59
|
-
},
|
|
60
|
-
role: "tabpanel",
|
|
61
|
-
style: style
|
|
62
|
-
}, panelId, shouldRender && content);
|
|
63
|
-
}, null);
|
|
64
|
-
}));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
render() {
|
|
68
|
-
const {
|
|
69
|
-
activeTab,
|
|
70
|
-
tabsComponents,
|
|
71
|
-
animated,
|
|
72
|
-
onTabChange,
|
|
73
|
-
enableMouseEvents
|
|
74
|
-
} = this.props;
|
|
75
|
-
const panels = animated ? /*#__PURE__*/_jsx__default["default"](SwipeableViews__default["default"], {
|
|
76
|
-
enableMouseEvents: enableMouseEvents,
|
|
77
|
-
index: getIndexById(tabsComponents, activeTab),
|
|
78
|
-
onChangeIndex: index => onTabChange(getIdByIndex(tabsComponents, index))
|
|
79
|
-
}, void 0, this.renderPanels(activeTab, tabsComponents)) : this.renderPanels(activeTab, tabsComponents);
|
|
80
|
-
return /*#__PURE__*/_jsx__default["default"](Panels, {}, void 0, panels);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
module.exports = TabsPanels;
|
package/cjs/useResize.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var lodash = require('lodash');
|
|
7
|
-
|
|
8
|
-
function useResize(ref, callback) {
|
|
9
|
-
var _ref$current;
|
|
10
|
-
|
|
11
|
-
const {
|
|
12
|
-
right,
|
|
13
|
-
left
|
|
14
|
-
} = (ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getBoundingClientRect()) || {
|
|
15
|
-
right: null,
|
|
16
|
-
left: null
|
|
17
|
-
};
|
|
18
|
-
const handleResize = lodash.debounce(callback, 300);
|
|
19
|
-
React.useLayoutEffect(() => {
|
|
20
|
-
handleResize();
|
|
21
|
-
}, [right, left]);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
exports.useResize = useResize;
|
package/esm/Carousel.js
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
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';
|
|
8
|
-
import React, { useRef, useState, useEffect } from 'react';
|
|
9
|
-
import { ChevronLeft, ChevronRight } from '@elliemae/ds-icons';
|
|
10
|
-
import styled from 'styled-components';
|
|
11
|
-
import DSButton from '@elliemae/ds-button';
|
|
12
|
-
import { useResize } from './useResize.js';
|
|
13
|
-
import { jsx } from 'react/jsx-runtime';
|
|
14
|
-
|
|
15
|
-
const CarouselBtn = /*#__PURE__*/styled(DSButton).withConfig({
|
|
16
|
-
componentId: "sc-1317h31-0"
|
|
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;');
|
|
23
|
-
const CarouselWrapper = /*#__PURE__*/styled.span.withConfig({
|
|
24
|
-
componentId: "sc-1317h31-1"
|
|
25
|
-
})(["position:relative;padding:0 16px;width:100%;"]);
|
|
26
|
-
const ChildrenWrap = /*#__PURE__*/styled.div.withConfig({
|
|
27
|
-
componentId: "sc-1317h31-2"
|
|
28
|
-
})(["display:flex;flex-wrap:nowrap;flex:1;overflow:hidden;"]);
|
|
29
|
-
|
|
30
|
-
function isVisibleElement(el, container) {
|
|
31
|
-
const rect = el.getBoundingClientRect();
|
|
32
|
-
const cRect = container.getBoundingClientRect();
|
|
33
|
-
const elemLeft = rect.left + 3;
|
|
34
|
-
const elemRight = rect.right - 3; // Only completely visible elements return true:
|
|
35
|
-
|
|
36
|
-
const isVisible = elemLeft >= cRect.left && elemRight <= cRect.right;
|
|
37
|
-
return isVisible;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const Carousel = _ref2 => {
|
|
41
|
-
let {
|
|
42
|
-
children,
|
|
43
|
-
onScroll
|
|
44
|
-
} = _ref2;
|
|
45
|
-
const itemsRef = useRef([]);
|
|
46
|
-
const wrapRef = useRef(null);
|
|
47
|
-
const leftRef = useRef(null);
|
|
48
|
-
const rightRef = useRef(null);
|
|
49
|
-
|
|
50
|
-
const shouldShowLeft = () => children && children[0] && wrapRef.current && itemsRef.current[0] && !isVisibleElement(itemsRef.current[0], wrapRef.current);
|
|
51
|
-
|
|
52
|
-
const shouldShowRight = () => children && children[children.length - 1] && wrapRef.current && itemsRef.current[children.length - 1] && !isVisibleElement(itemsRef.current[children.length - 1], wrapRef.current);
|
|
53
|
-
|
|
54
|
-
const [{
|
|
55
|
-
right,
|
|
56
|
-
left,
|
|
57
|
-
CHEVRON_FOCUS_FLAG
|
|
58
|
-
}, setShow] = useState({
|
|
59
|
-
right: false,
|
|
60
|
-
left: false,
|
|
61
|
-
CHEVRON_FOCUS_FLAG: false // flag to replace lack of callback in useState hook
|
|
62
|
-
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
const recalcChevrons = () => setShow({
|
|
66
|
-
right: shouldShowRight(),
|
|
67
|
-
left: shouldShowLeft()
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
recalcChevrons();
|
|
72
|
-
}, []);
|
|
73
|
-
useEffect(() => {
|
|
74
|
-
if (CHEVRON_FOCUS_FLAG) {
|
|
75
|
-
// focus opposite chevron when current one hides
|
|
76
|
-
if (!left && right && rightRef.current) {
|
|
77
|
-
rightRef.current.focus();
|
|
78
|
-
} else if (!right && left && leftRef.current) {
|
|
79
|
-
leftRef.current.focus();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
setShow({
|
|
83
|
-
right,
|
|
84
|
-
left,
|
|
85
|
-
CHEVRON_FOCUS_FLAG: false
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}, [CHEVRON_FOCUS_FLAG]);
|
|
89
|
-
useResize(wrapRef, recalcChevrons);
|
|
90
|
-
|
|
91
|
-
const getVisibleItemsOffset = () => itemsRef.current.reduce((acc, c) => {
|
|
92
|
-
if (isVisibleElement(c, wrapRef.current)) {
|
|
93
|
-
const styles = window.getComputedStyle(c);
|
|
94
|
-
const width = c.offsetWidth;
|
|
95
|
-
const margin = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
|
|
96
|
-
return acc + (width + margin);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return acc;
|
|
100
|
-
}, 0);
|
|
101
|
-
|
|
102
|
-
const rightClick = () => {
|
|
103
|
-
wrapRef.current.scrollLeft += getVisibleItemsOffset();
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const leftClick = () => {
|
|
107
|
-
wrapRef.current.scrollLeft -= getVisibleItemsOffset();
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const handleScroll = e => {
|
|
111
|
-
// forces render when element.scrollTop is changed (out of react flow)
|
|
112
|
-
setShow({
|
|
113
|
-
right: shouldShowRight(),
|
|
114
|
-
left: shouldShowLeft(),
|
|
115
|
-
// to trigger focus logic at effect above
|
|
116
|
-
CHEVRON_FOCUS_FLAG: true
|
|
117
|
-
});
|
|
118
|
-
onScroll(e);
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
const handleClick = function (e) {
|
|
122
|
-
let onClick = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => {};
|
|
123
|
-
const tabListDomEl = wrapRef.current;
|
|
124
|
-
const el = e.target;
|
|
125
|
-
const rect = el.getBoundingClientRect();
|
|
126
|
-
const cRect = tabListDomEl.getBoundingClientRect();
|
|
127
|
-
|
|
128
|
-
if (!isVisibleElement(el, tabListDomEl)) {
|
|
129
|
-
const containerWidth = cRect.width;
|
|
130
|
-
const halfContainer = containerWidth / 2;
|
|
131
|
-
const elementScrollPosition = rect.left - cRect.left;
|
|
132
|
-
const positionInContainer = elementScrollPosition % containerWidth;
|
|
133
|
-
const width = el.offsetWidth; // align to right
|
|
134
|
-
|
|
135
|
-
if (positionInContainer > halfContainer) {
|
|
136
|
-
wrapRef.current.scrollLeft += width + positionInContainer - containerWidth;
|
|
137
|
-
} else {
|
|
138
|
-
// align left
|
|
139
|
-
wrapRef.current.scrollLeft += positionInContainer;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
recalcChevrons();
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
onClick(e);
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
return /*#__PURE__*/_jsx(CarouselWrapper, {}, void 0, left && /*#__PURE__*/_jsx(CarouselBtn, {
|
|
149
|
-
"data-testid": "chevron-left",
|
|
150
|
-
buttonType: "link",
|
|
151
|
-
innerRef: leftRef,
|
|
152
|
-
size: "s",
|
|
153
|
-
icon: /*#__PURE__*/_jsx(ChevronLeft, {
|
|
154
|
-
size: "s",
|
|
155
|
-
color: ['brand-primary', '600']
|
|
156
|
-
}),
|
|
157
|
-
onClick: leftClick,
|
|
158
|
-
tabIndex: -1
|
|
159
|
-
}), right && /*#__PURE__*/_jsx(CarouselBtn, {
|
|
160
|
-
"data-testid": "chevron-right",
|
|
161
|
-
innerRef: rightRef,
|
|
162
|
-
right: true,
|
|
163
|
-
size: "s",
|
|
164
|
-
buttonType: "link",
|
|
165
|
-
icon: /*#__PURE__*/_jsx(ChevronRight, {
|
|
166
|
-
size: "s",
|
|
167
|
-
color: ['brand-primary', '600']
|
|
168
|
-
}),
|
|
169
|
-
onClick: rightClick,
|
|
170
|
-
tabIndex: -1
|
|
171
|
-
}), /*#__PURE__*/jsx(ChildrenWrap, {
|
|
172
|
-
onScroll: handleScroll,
|
|
173
|
-
ref: wrapRef,
|
|
174
|
-
children: React.Children.map(children, (child, idx) => /*#__PURE__*/React.cloneElement(child, {
|
|
175
|
-
onClick: e => {
|
|
176
|
-
var _child$props;
|
|
177
|
-
|
|
178
|
-
return handleClick(e, (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.onClick);
|
|
179
|
-
},
|
|
180
|
-
key: 'carousel'.concat(idx),
|
|
181
|
-
ref: el => {
|
|
182
|
-
itemsRef.current[idx] = el; // keep old refs
|
|
183
|
-
|
|
184
|
-
if (typeof child.ref === 'function') {
|
|
185
|
-
child.ref(el);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}))
|
|
189
|
-
}));
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
Carousel.defaultProps = {
|
|
193
|
-
onScroll: () => null
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
export { Carousel as default };
|
package/esm/DSTab.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import 'react';
|
|
3
|
-
import { PropTypes, describe } from 'react-desc';
|
|
4
|
-
|
|
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
|
-
};
|
|
18
|
-
|
|
19
|
-
DSTab.displayName = 'DSTab';
|
|
20
|
-
const props = {
|
|
21
|
-
/** unique id for tab */
|
|
22
|
-
tabId: PropTypes.string.description('unique id for tab'),
|
|
23
|
-
|
|
24
|
-
/** tab title */
|
|
25
|
-
title: PropTypes.string.description('tab title'),
|
|
26
|
-
|
|
27
|
-
/** Show a required mark next to the title */
|
|
28
|
-
required: PropTypes.bool.description('Show a required mark next to the title'),
|
|
29
|
-
|
|
30
|
-
/** Whether or not it's a ds-tab from DSMobile tabs */
|
|
31
|
-
isDSMobile: PropTypes.bool.description("Whether or not it's a ds-tab from DSMobile tabs")
|
|
32
|
-
};
|
|
33
|
-
const DSTabWithSchema = describe(DSTab);
|
|
34
|
-
DSTabWithSchema.propTypes = props;
|
|
35
|
-
|
|
36
|
-
export { DSTab, DSTabWithSchema, DSTab as default };
|
package/esm/PanelContainer.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
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';
|
|
10
|
-
import React from 'react';
|
|
11
|
-
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
12
|
-
import { jsx } from 'react/jsx-runtime';
|
|
13
|
-
|
|
14
|
-
const _excluded = ["children", "lastTabRef", "firstSubtabRef"];
|
|
15
|
-
|
|
16
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
-
|
|
18
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
19
|
-
const blockName = 'tabs-panels';
|
|
20
|
-
const PC = aggregatedClasses('div')(blockName, 'panel');
|
|
21
|
-
|
|
22
|
-
const PanelContainer = _ref => {
|
|
23
|
-
let {
|
|
24
|
-
children,
|
|
25
|
-
lastTabRef,
|
|
26
|
-
firstSubtabRef
|
|
27
|
-
} = _ref,
|
|
28
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
-
|
|
30
|
-
// inject ref to handle focus on first subtab child
|
|
31
|
-
const child = React.Children.map(children, (c, i) => i === 0 && c ? /*#__PURE__*/React.cloneElement(c, {
|
|
32
|
-
firstSubtabRef,
|
|
33
|
-
lastTabRef
|
|
34
|
-
}) : c);
|
|
35
|
-
return /*#__PURE__*/jsx(PC, _objectSpread(_objectSpread({}, rest), {}, {
|
|
36
|
-
children: child
|
|
37
|
-
}));
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export { PanelContainer as default };
|
package/esm/SubTabBar.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import 'react';
|
|
3
|
-
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
4
|
-
import TabBar from './TabBar.js';
|
|
5
|
-
import Carousel from './Carousel.js';
|
|
6
|
-
|
|
7
|
-
const blockName = 'tabs-tab-bar';
|
|
8
|
-
const SubTabList = aggregatedClasses('div')(blockName, 'subtabs-list', _ref => {
|
|
9
|
-
let {
|
|
10
|
-
withCarousel
|
|
11
|
-
} = _ref;
|
|
12
|
-
return {
|
|
13
|
-
carousel: withCarousel
|
|
14
|
-
};
|
|
15
|
-
});
|
|
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
|
-
|
|
48
|
-
export { SubTabBar as default };
|