@elliemae/ds-tabs 2.3.0-next.0 → 3.0.0-alpha.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.
Files changed (174) hide show
  1. package/dist/cjs/DSTabs.js +63 -0
  2. package/dist/cjs/DSTabs.js.map +7 -0
  3. package/dist/cjs/DSTabsCTX.js +56 -0
  4. package/dist/cjs/DSTabsCTX.js.map +7 -0
  5. package/dist/cjs/DSTabsDatatestid.js +46 -0
  6. package/dist/cjs/DSTabsDatatestid.js.map +7 -0
  7. package/dist/cjs/DSTabsTypes.js +27 -0
  8. package/dist/cjs/DSTabsTypes.js.map +7 -0
  9. package/dist/cjs/config/useCrossRef.js +44 -0
  10. package/dist/cjs/config/useCrossRef.js.map +7 -0
  11. package/dist/cjs/config/useTabs.js +68 -0
  12. package/dist/cjs/config/useTabs.js.map +7 -0
  13. package/dist/cjs/defaultProps.js +53 -0
  14. package/dist/cjs/defaultProps.js.map +7 -0
  15. package/dist/cjs/exportsRelated/DSTab.js +46 -0
  16. package/dist/cjs/exportsRelated/DSTab.js.map +7 -0
  17. package/dist/cjs/index.js +38 -0
  18. package/dist/cjs/index.js.map +7 -0
  19. package/dist/cjs/parts/carousel/Carousel.js +77 -0
  20. package/dist/cjs/parts/carousel/Carousel.js.map +7 -0
  21. package/dist/cjs/parts/carousel/styles.js +79 -0
  22. package/dist/cjs/parts/carousel/styles.js.map +7 -0
  23. package/dist/cjs/parts/carousel/useCarousel.js +80 -0
  24. package/dist/cjs/parts/carousel/useCarousel.js.map +7 -0
  25. package/dist/cjs/parts/carousel/useCarouselCallbacks.js +89 -0
  26. package/dist/cjs/parts/carousel/useCarouselCallbacks.js.map +7 -0
  27. package/dist/cjs/parts/tabBar/TabBar.js +171 -0
  28. package/dist/cjs/parts/tabBar/TabBar.js.map +7 -0
  29. package/dist/cjs/parts/tabBar/styles.js +294 -0
  30. package/dist/cjs/parts/tabBar/styles.js.map +7 -0
  31. package/dist/cjs/parts/tabBar/useTabBar.js +100 -0
  32. package/dist/cjs/parts/tabBar/useTabBar.js.map +7 -0
  33. package/dist/cjs/parts/tabsContent/TabsContent.js +53 -0
  34. package/dist/cjs/parts/tabsContent/TabsContent.js.map +7 -0
  35. package/dist/cjs/parts/tabsContent/styles.js +39 -0
  36. package/dist/cjs/parts/tabsContent/styles.js.map +7 -0
  37. package/dist/cjs/parts/tabsPanel/TabsPanels.js +79 -0
  38. package/dist/cjs/parts/tabsPanel/TabsPanels.js.map +7 -0
  39. package/dist/cjs/parts/tabsPanel/styles.js +45 -0
  40. package/dist/cjs/parts/tabsPanel/styles.js.map +7 -0
  41. package/dist/cjs/propTypes.js +58 -0
  42. package/dist/cjs/propTypes.js.map +7 -0
  43. package/dist/cjs/utils/constants.js +56 -0
  44. package/dist/cjs/utils/constants.js.map +7 -0
  45. package/dist/cjs/utils/helpers.js +88 -0
  46. package/dist/cjs/utils/helpers.js.map +7 -0
  47. package/dist/cjs/utils/hooks/useKeyboardNavigation.js +77 -0
  48. package/dist/cjs/utils/hooks/useKeyboardNavigation.js.map +7 -0
  49. package/dist/cjs/utils/hooks/useTabsCallbacks.js +60 -0
  50. package/dist/cjs/utils/hooks/useTabsCallbacks.js.map +7 -0
  51. package/dist/esm/DSTabs.js +34 -0
  52. package/dist/esm/DSTabs.js.map +7 -0
  53. package/dist/esm/DSTabsCTX.js +27 -0
  54. package/dist/esm/DSTabsCTX.js.map +7 -0
  55. package/dist/esm/DSTabsDatatestid.js +17 -0
  56. package/dist/esm/DSTabsDatatestid.js.map +7 -0
  57. package/dist/esm/DSTabsTypes.js +2 -0
  58. package/dist/esm/DSTabsTypes.js.map +7 -0
  59. package/{esm → dist/esm}/config/useCrossRef.js +6 -4
  60. package/dist/esm/config/useCrossRef.js.map +7 -0
  61. package/dist/esm/config/useTabs.js +39 -0
  62. package/dist/esm/config/useTabs.js.map +7 -0
  63. package/{esm → dist/esm}/defaultProps.js +9 -8
  64. package/dist/esm/defaultProps.js.map +7 -0
  65. package/dist/esm/exportsRelated/DSTab.js +17 -0
  66. package/dist/esm/exportsRelated/DSTab.js.map +7 -0
  67. package/dist/esm/index.js +9 -0
  68. package/dist/esm/index.js.map +7 -0
  69. package/dist/esm/parts/carousel/Carousel.js +48 -0
  70. package/dist/esm/parts/carousel/Carousel.js.map +7 -0
  71. package/dist/esm/parts/carousel/styles.js +50 -0
  72. package/dist/esm/parts/carousel/styles.js.map +7 -0
  73. package/{esm → dist/esm}/parts/carousel/useCarousel.js +15 -34
  74. package/dist/esm/parts/carousel/useCarousel.js.map +7 -0
  75. package/{esm → dist/esm}/parts/carousel/useCarouselCallbacks.js +20 -28
  76. package/dist/esm/parts/carousel/useCarouselCallbacks.js.map +7 -0
  77. package/dist/esm/parts/tabBar/TabBar.js +149 -0
  78. package/dist/esm/parts/tabBar/TabBar.js.map +7 -0
  79. package/dist/esm/parts/tabBar/styles.js +265 -0
  80. package/dist/esm/parts/tabBar/styles.js.map +7 -0
  81. package/{esm → dist/esm}/parts/tabBar/useTabBar.js +27 -35
  82. package/dist/esm/parts/tabBar/useTabBar.js.map +7 -0
  83. package/dist/esm/parts/tabsContent/TabsContent.js +24 -0
  84. package/dist/esm/parts/tabsContent/TabsContent.js.map +7 -0
  85. package/dist/esm/parts/tabsContent/styles.js +10 -0
  86. package/dist/esm/parts/tabsContent/styles.js.map +7 -0
  87. package/dist/esm/parts/tabsPanel/TabsPanels.js +50 -0
  88. package/dist/esm/parts/tabsPanel/TabsPanels.js.map +7 -0
  89. package/dist/esm/parts/tabsPanel/styles.js +16 -0
  90. package/dist/esm/parts/tabsPanel/styles.js.map +7 -0
  91. package/dist/esm/propTypes.js +29 -0
  92. package/dist/esm/propTypes.js.map +7 -0
  93. package/dist/esm/utils/constants.js +27 -0
  94. package/dist/esm/utils/constants.js.map +7 -0
  95. package/{esm → dist/esm}/utils/helpers.js +23 -28
  96. package/dist/esm/utils/helpers.js.map +7 -0
  97. package/dist/esm/utils/hooks/useKeyboardNavigation.js +48 -0
  98. package/dist/esm/utils/hooks/useKeyboardNavigation.js.map +7 -0
  99. package/dist/esm/utils/hooks/useTabsCallbacks.js +31 -0
  100. package/dist/esm/utils/hooks/useTabsCallbacks.js.map +7 -0
  101. package/{types → dist/types}/DSTabs.d.ts +2 -2
  102. package/{types → dist/types}/DSTabsCTX.d.ts +0 -0
  103. package/{types → dist/types}/DSTabsDatatestid.d.ts +0 -0
  104. package/{types → dist/types}/DSTabsTypes.d.ts +0 -0
  105. package/{types → dist/types}/config/useCrossRef.d.ts +0 -0
  106. package/{types → dist/types}/config/useTabs.d.ts +0 -0
  107. package/{types → dist/types}/defaultProps.d.ts +0 -0
  108. package/{types → dist/types}/exportsRelated/DSTab.d.ts +0 -0
  109. package/{types → dist/types}/index.d.ts +0 -0
  110. package/{types → dist/types}/parts/carousel/Carousel.d.ts +0 -0
  111. package/{types → dist/types}/parts/carousel/styles.d.ts +1 -1
  112. package/{types → dist/types}/parts/carousel/useCarousel.d.ts +0 -0
  113. package/{types → dist/types}/parts/carousel/useCarouselCallbacks.d.ts +0 -0
  114. package/{types → dist/types}/parts/tabBar/TabBar.d.ts +0 -0
  115. package/{types → dist/types}/parts/tabBar/styles.d.ts +0 -0
  116. package/{types → dist/types}/parts/tabBar/useTabBar.d.ts +0 -0
  117. package/{types → dist/types}/parts/tabsContent/TabsContent.d.ts +0 -0
  118. package/{types → dist/types}/parts/tabsContent/styles.d.ts +0 -0
  119. package/{types → dist/types}/parts/tabsPanel/TabsPanels.d.ts +0 -0
  120. package/{types → dist/types}/parts/tabsPanel/styles.d.ts +0 -0
  121. package/{types → dist/types}/propTypes.d.ts +0 -0
  122. package/{types → dist/types}/tests/DSTabs.callbacks.test.d.ts +0 -0
  123. package/{types → dist/types}/tests/DSTabs.func.test.d.ts +0 -0
  124. package/{types → dist/types}/tests/DSTabs.keyboard.test.d.ts +0 -0
  125. package/{types → dist/types}/tests/DSTabs.test.d.ts +0 -0
  126. package/{types → dist/types}/utils/constants.d.ts +0 -0
  127. package/{types → dist/types}/utils/helpers.d.ts +0 -0
  128. package/{types → dist/types}/utils/hooks/useKeyboardNavigation.d.ts +0 -0
  129. package/{types → dist/types}/utils/hooks/useTabsCallbacks.d.ts +0 -0
  130. package/package.json +77 -69
  131. package/cjs/DSTabs.js +0 -45
  132. package/cjs/DSTabsCTX.js +0 -30
  133. package/cjs/DSTabsDatatestid.js +0 -18
  134. package/cjs/DSTabsTypes.js +0 -2
  135. package/cjs/config/useCrossRef.js +0 -17
  136. package/cjs/config/useTabs.js +0 -51
  137. package/cjs/defaultProps.js +0 -27
  138. package/cjs/exportsRelated/DSTab.js +0 -32
  139. package/cjs/index.js +0 -17
  140. package/cjs/parts/carousel/Carousel.js +0 -69
  141. package/cjs/parts/carousel/styles.js +0 -65
  142. package/cjs/parts/carousel/useCarousel.js +0 -78
  143. package/cjs/parts/carousel/useCarouselCallbacks.js +0 -72
  144. package/cjs/parts/tabBar/TabBar.js +0 -168
  145. package/cjs/parts/tabBar/styles.js +0 -200
  146. package/cjs/parts/tabBar/useTabBar.js +0 -87
  147. package/cjs/parts/tabsContent/TabsContent.js +0 -49
  148. package/cjs/parts/tabsContent/styles.js +0 -15
  149. package/cjs/parts/tabsPanel/TabsPanels.js +0 -77
  150. package/cjs/parts/tabsPanel/styles.js +0 -25
  151. package/cjs/propTypes.js +0 -33
  152. package/cjs/utils/constants.js +0 -28
  153. package/cjs/utils/helpers.js +0 -75
  154. package/cjs/utils/hooks/useKeyboardNavigation.js +0 -61
  155. package/cjs/utils/hooks/useTabsCallbacks.js +0 -41
  156. package/esm/DSTabs.js +0 -35
  157. package/esm/DSTabsCTX.js +0 -25
  158. package/esm/DSTabsDatatestid.js +0 -14
  159. package/esm/DSTabsTypes.js +0 -1
  160. package/esm/config/useTabs.js +0 -47
  161. package/esm/exportsRelated/DSTab.js +0 -21
  162. package/esm/index.js +0 -4
  163. package/esm/parts/carousel/Carousel.js +0 -61
  164. package/esm/parts/carousel/styles.js +0 -54
  165. package/esm/parts/tabBar/TabBar.js +0 -159
  166. package/esm/parts/tabBar/styles.js +0 -186
  167. package/esm/parts/tabsContent/TabsContent.js +0 -40
  168. package/esm/parts/tabsContent/styles.js +0 -7
  169. package/esm/parts/tabsPanel/TabsPanels.js +0 -67
  170. package/esm/parts/tabsPanel/styles.js +0 -17
  171. package/esm/propTypes.js +0 -28
  172. package/esm/utils/constants.js +0 -20
  173. package/esm/utils/hooks/useKeyboardNavigation.js +0 -57
  174. package/esm/utils/hooks/useTabsCallbacks.js +0 -37
@@ -1,41 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var React = require('react');
6
- var helpers = require('../helpers.js');
7
- var DSTabsCTX = require('../../DSTabsCTX.js');
8
-
9
- const useTabsCallbacks = () => {
10
- const {
11
- setInternalActiveTab,
12
- tabsListRef,
13
- props: {
14
- onTabChange,
15
- isDSMobile,
16
- allowTextSelection,
17
- fixedTabsHeaders
18
- }
19
- } = React.useContext(DSTabsCTX.DSTabsContext);
20
- const handleOnTabChange = React.useCallback((tabId, e) => {
21
- setInternalActiveTab(tabId);
22
- onTabChange(tabId, e);
23
-
24
- if (isDSMobile && !fixedTabsHeaders && e) {
25
- helpers.centerTab({
26
- e,
27
- listRef: tabsListRef
28
- });
29
- }
30
- }, [fixedTabsHeaders, isDSMobile, onTabChange, setInternalActiveTab, tabsListRef]);
31
- const handleOnMouseDown = React.useCallback(e => {
32
- const role = e.target.getAttribute('role');
33
- if (role !== 'tabpanel' && allowTextSelection) e.stopPropagation();
34
- }, [allowTextSelection]);
35
- return {
36
- handleOnTabChange,
37
- handleOnMouseDown
38
- };
39
- };
40
-
41
- exports.useTabsCallbacks = useTabsCallbacks;
package/esm/DSTabs.js DELETED
@@ -1,35 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import { describe } from 'react-desc';
3
- import { tabsPropTypes } from './propTypes.js';
4
- import { DSTabsContext, DSTabsCrossRefContext } from './DSTabsCTX.js';
5
- import { TabsContent } from './parts/tabsContent/TabsContent.js';
6
- import { useTabs } from './config/useTabs.js';
7
- import { useCrossRef } from './config/useCrossRef.js';
8
- import { TabTypes } from './utils/constants.js';
9
-
10
- var _TabsContent, _TabsContent2;
11
-
12
- const DSTabs = props => {
13
- const ctx = useTabs(props);
14
- const crossRefsCtx = useCrossRef();
15
- const {
16
- type
17
- } = props;
18
-
19
- if (type === TabTypes.SUBTABS) {
20
- return /*#__PURE__*/_jsx(DSTabsContext.Provider, {
21
- value: ctx
22
- }, void 0, _TabsContent || (_TabsContent = /*#__PURE__*/_jsx(TabsContent, {})));
23
- }
24
-
25
- return /*#__PURE__*/_jsx(DSTabsCrossRefContext.Provider, {
26
- value: crossRefsCtx
27
- }, void 0, /*#__PURE__*/_jsx(DSTabsContext.Provider, {
28
- value: ctx
29
- }, void 0, _TabsContent2 || (_TabsContent2 = /*#__PURE__*/_jsx(TabsContent, {}))));
30
- };
31
-
32
- const DSTabsWithSchema = describe(DSTabs);
33
- DSTabsWithSchema.propTypes = tabsPropTypes;
34
-
35
- export { DSTabs, DSTabsWithSchema, DSTabs as default };
package/esm/DSTabsCTX.js DELETED
@@ -1,25 +0,0 @@
1
- import { createContext, createRef } from 'react';
2
- import { tabsDefaultProps } from './defaultProps.js';
3
-
4
- // eslint-disable-next-line @typescript-eslint/no-empty-function
5
- const noop = () => {};
6
-
7
- const defaultContext = {
8
- props: tabsDefaultProps,
9
- tabsRef: /*#__PURE__*/createRef(),
10
- tabsListRef: /*#__PURE__*/createRef(),
11
- carouselOnlyListRef: /*#__PURE__*/createRef(),
12
- focusableTabsRef: /*#__PURE__*/createRef(),
13
- tabsRefAsArray: /*#__PURE__*/createRef(),
14
- actualActiveTabRef: /*#__PURE__*/createRef(),
15
- setInternalActiveTab: noop,
16
- actualActiveTab: ''
17
- };
18
- const defaultCrossRefsContext = {
19
- lastTabInternalRef: /*#__PURE__*/createRef(),
20
- firstSubtabInternalRef: /*#__PURE__*/createRef()
21
- };
22
- const DSTabsContext = /*#__PURE__*/createContext(defaultContext);
23
- const DSTabsCrossRefContext = /*#__PURE__*/createContext(defaultCrossRefsContext);
24
-
25
- export { DSTabsContext, DSTabsCrossRefContext };
@@ -1,14 +0,0 @@
1
- const DSTabsDatatestid = {
2
- TABS_CONTAINER: 'ds-tabs-container',
3
- TAB_BUTTON: 'ds-tabs-tab-button',
4
- SUBTAB_BUTTON: 'ds-tabs-subtab-button',
5
- TAB_PANEL: 'ds-tabs-tab-panel',
6
- SUB_TAB_LIST: 'subtabs-list',
7
- TAB_LIST: 'tab-list',
8
- CAROUSEL: {
9
- BUTTON_RIGHT: 'chevron-right',
10
- BUTTON_LEFT: 'chevron-left'
11
- }
12
- };
13
-
14
- export { DSTabsDatatestid };
@@ -1 +0,0 @@
1
-
@@ -1,47 +0,0 @@
1
- import 'core-js/modules/web.dom-collections.iterator.js';
2
- import 'core-js/modules/esnext.async-iterator.find.js';
3
- import 'core-js/modules/esnext.iterator.constructor.js';
4
- import 'core-js/modules/esnext.iterator.find.js';
5
- import { useRef, useState, useMemo, useEffect } from 'react';
6
- import { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';
7
- import { tabsDefaultProps } from '../defaultProps.js';
8
-
9
- const useTabs = props => {
10
- var _children$, _children$$props;
11
-
12
- const propsWithDefaults = useMemoMergePropsWithDefault(props, tabsDefaultProps);
13
- const {
14
- activeTab,
15
- children
16
- } = propsWithDefaults;
17
- const tabsRef = useRef({});
18
- const tabsRefAsArray = useRef([]);
19
- const focusableTabsRef = useRef([]);
20
- const carouselOnlyListRef = useRef(null);
21
- const tabsListRef = useRef(null);
22
- const actualActiveTabRef = useRef(null);
23
- const [internalActiveTab, setInternalActiveTab] = useState(children === null || children === void 0 ? void 0 : (_children$ = children[0]) === null || _children$ === void 0 ? void 0 : (_children$$props = _children$.props) === null || _children$$props === void 0 ? void 0 : _children$$props.tabId);
24
- const actualActiveTab = useMemo(() => {
25
- if (activeTab !== undefined) return activeTab;
26
- return internalActiveTab;
27
- }, [activeTab, internalActiveTab]);
28
- useEffect(() => {
29
- var _focusableTabsRef$cur;
30
-
31
- actualActiveTabRef.current = (_focusableTabsRef$cur = focusableTabsRef.current.find(el => el.dataset.tabId === actualActiveTab)) !== null && _focusableTabsRef$cur !== void 0 ? _focusableTabsRef$cur : null;
32
- }, [actualActiveTab]);
33
- const ctx = useMemo(() => ({
34
- props: propsWithDefaults,
35
- tabsRef,
36
- focusableTabsRef,
37
- tabsListRef,
38
- tabsRefAsArray,
39
- setInternalActiveTab,
40
- actualActiveTab,
41
- actualActiveTabRef,
42
- carouselOnlyListRef
43
- }), [actualActiveTab, propsWithDefaults]);
44
- return ctx;
45
- };
46
-
47
- export { useTabs };
@@ -1,21 +0,0 @@
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';
6
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
- import React from 'react';
8
- import { describe } from 'react-desc';
9
- import { tabPropTypes } from '../propTypes.js';
10
- import { jsx } from 'react/jsx-runtime';
11
-
12
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
-
14
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
-
16
- const DSTab = props => /*#__PURE__*/jsx(React.Fragment, _objectSpread({}, props));
17
-
18
- const DSTabWithSchema = describe(DSTab);
19
- DSTabWithSchema.propTypes = tabPropTypes;
20
-
21
- export { DSTab, DSTabWithSchema, DSTab as default };
package/esm/index.js DELETED
@@ -1,4 +0,0 @@
1
- export { DSTab, DSTabWithSchema } from './exportsRelated/DSTab.js';
2
- export { DSTabs, DSTabsWithSchema } from './DSTabs.js';
3
- export { TabTypes } from './utils/constants.js';
4
- export { DSTabsDatatestid } from './DSTabsDatatestid.js';
@@ -1,61 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import { useContext } from 'react';
3
- import { DSIconSizes } from '@elliemae/ds-icon';
4
- import { BUTTON_TYPES } from '@elliemae/ds-button';
5
- import { ChevronLeft, ChevronRight } from '@elliemae/ds-icons';
6
- import { StyledCarouselWrapper, StyledCarouselButtonWrapper, StyledCarouselBtn, StyledChildrenWrap } from './styles.js';
7
- import { useCarousel } from './useCarousel.js';
8
- import { DSTabsContext } from '../../DSTabsCTX.js';
9
- import { DSTabsDatatestid } from '../../DSTabsDatatestid.js';
10
- import { jsx } from 'react/jsx-runtime';
11
-
12
- const Carousel = _ref => {
13
- let {
14
- children,
15
- updateIndicatorStyle
16
- } = _ref;
17
- const {
18
- showChevrons,
19
- leftButtonOnClick,
20
- rightButtonOnClick,
21
- handleOnClick,
22
- handleOnScroll
23
- } = useCarousel({
24
- updateIndicatorStyle
25
- });
26
- const {
27
- carouselOnlyListRef,
28
- props: {
29
- type
30
- }
31
- } = useContext(DSTabsContext);
32
- return /*#__PURE__*/_jsx(StyledCarouselWrapper, {}, void 0, showChevrons.left && /*#__PURE__*/_jsx(StyledCarouselButtonWrapper, {
33
- tabType: type
34
- }, void 0, /*#__PURE__*/_jsx(StyledCarouselBtn, {
35
- size: "s",
36
- onClick: leftButtonOnClick,
37
- tabIndex: -1,
38
- "data-testid": DSTabsDatatestid.CAROUSEL.BUTTON_LEFT,
39
- buttonType: BUTTON_TYPES.ICON
40
- }, void 0, /*#__PURE__*/_jsx(ChevronLeft, {
41
- size: DSIconSizes.S
42
- }))), showChevrons.right && /*#__PURE__*/_jsx(StyledCarouselButtonWrapper, {
43
- tabType: type,
44
- right: showChevrons.right
45
- }, void 0, /*#__PURE__*/_jsx(StyledCarouselBtn, {
46
- size: "s",
47
- onClick: rightButtonOnClick,
48
- tabIndex: -1,
49
- "data-testid": DSTabsDatatestid.CAROUSEL.BUTTON_RIGHT,
50
- buttonType: BUTTON_TYPES.ICON
51
- }, void 0, /*#__PURE__*/_jsx(ChevronRight, {
52
- size: DSIconSizes.S
53
- }))), /*#__PURE__*/jsx(StyledChildrenWrap, {
54
- ref: carouselOnlyListRef,
55
- onClick: handleOnClick,
56
- onScroll: handleOnScroll,
57
- children: children
58
- }));
59
- };
60
-
61
- export { Carousel };
@@ -1,54 +0,0 @@
1
- import styled from 'styled-components';
2
- import { DSButtonV2 } from '@elliemae/ds-button';
3
- import { TabTypes } from '../../utils/constants.js';
4
-
5
- const StyledCarouselBtn = /*#__PURE__*/styled(DSButtonV2).withConfig({
6
- componentId: "sc-prv5a7-0"
7
- })(["margin:0;min-width:", ";width:", ";&:hover:not(:disabled){background-color:transparent;}background-color:transparent;border-radius:0px;& .em-ds-icon svg{fill:", ";}"], _ref => {
8
- let {
9
- theme
10
- } = _ref;
11
- return theme.space.xs;
12
- }, _ref2 => {
13
- let {
14
- theme
15
- } = _ref2;
16
- return theme.space.xs;
17
- }, _ref3 => {
18
- let {
19
- theme
20
- } = _ref3;
21
- return theme.colors.brand[600];
22
- });
23
- const StyledCarouselWrapper = /*#__PURE__*/styled.span.withConfig({
24
- componentId: "sc-prv5a7-1"
25
- })(["position:relative;width:100%;display:flex;"]);
26
- const StyledChildrenWrap = /*#__PURE__*/styled.div.withConfig({
27
- componentId: "sc-prv5a7-2"
28
- })(["display:flex;flex-wrap:nowrap;flex:1;overflow-x:hidden;"]);
29
- const StyledCarouselButtonWrapper = /*#__PURE__*/styled.div.withConfig({
30
- componentId: "sc-prv5a7-3"
31
- })(["max-width:16px;position:absolute;z-index:200;", " width:16px;height:", ";padding-top:", ";background:white;", ";"], _ref4 => {
32
- let {
33
- right
34
- } = _ref4;
35
- return right ? 'right: 0;' : "left: 0;";
36
- }, _ref5 => {
37
- let {
38
- tabType
39
- } = _ref5;
40
- return tabType === TabTypes.NORMAL ? '32px' : '22px';
41
- }, _ref6 => {
42
- let {
43
- tabType
44
- } = _ref6;
45
- return tabType === TabTypes.NORMAL ? '5px' : '0px';
46
- }, _ref7 => {
47
- let {
48
- theme,
49
- tabType
50
- } = _ref7;
51
- return tabType === TabTypes.NORMAL ? "\n background: linear-gradient(to bottom, white 0px, white 30px, ".concat(theme.colors.neutral[400], " 30px, ").concat(theme.colors.neutral[400], " 31px, white 31px , white 32px );\n ") : "";
52
- });
53
-
54
- export { StyledCarouselBtn, StyledCarouselButtonWrapper, StyledCarouselWrapper, StyledChildrenWrap };
@@ -1,159 +0,0 @@
1
- import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import 'core-js/modules/esnext.async-iterator.map.js';
3
- import 'core-js/modules/esnext.iterator.map.js';
4
- import React, { useContext, useMemo } from 'react';
5
- import { Carousel } from '../carousel/Carousel.js';
6
- import { useTabBar } from './useTabBar.js';
7
- import { StyledTabButton, StyledRequiredMark, StyledSubTabsList, StyledTabList, StyledTabWrapper, StyledSelectionIndicator } from './styles.js';
8
- import { DSTabsContext, DSTabsCrossRefContext } from '../../DSTabsCTX.js';
9
- import { useKeyboardNavigation } from '../../utils/hooks/useKeyboardNavigation.js';
10
- import { centerTab } from '../../utils/helpers.js';
11
- import { TabTypes } from '../../utils/constants.js';
12
- import { useTabsCallbacks } from '../../utils/hooks/useTabsCallbacks.js';
13
- import { DSTabsDatatestid } from '../../DSTabsDatatestid.js';
14
- import { jsxs, jsx } from 'react/jsx-runtime';
15
-
16
- var _StyledRequiredMark;
17
- const TabBar = () => {
18
- const {
19
- tabsRef,
20
- focusableTabsRef,
21
- tabsListRef,
22
- tabsRefAsArray,
23
- carouselOnlyListRef,
24
- actualActiveTab,
25
- props: {
26
- type,
27
- fixedTabsHeaders,
28
- withCarousel,
29
- isDSMobile,
30
- showSeparator,
31
- children: tabs
32
- }
33
- } = useContext(DSTabsContext);
34
- const {
35
- lastTabInternalRef,
36
- firstSubtabInternalRef
37
- } = useContext(DSTabsCrossRefContext);
38
- const {
39
- handleOnTabChange
40
- } = useTabsCallbacks();
41
- const {
42
- handleOnKeyDown
43
- } = useKeyboardNavigation();
44
- const {
45
- indicatorStyle,
46
- mobileGradients,
47
- updateMobileGradients,
48
- updateIndicatorStyle
49
- } = useTabBar();
50
- const renderTabs = useMemo(() => {
51
- const availableTabIndexes = [];
52
- return React.Children.map(tabs, (tab, index) => {
53
- const {
54
- tabId = '',
55
- title = '',
56
- style,
57
- required = false,
58
- disabled = false,
59
- ref,
60
- onClick,
61
- onKeyDown
62
- } = tab.props;
63
- if (!disabled) availableTabIndexes.push(index);
64
- return /*#__PURE__*/jsxs(StyledTabButton, {
65
- role: "tab",
66
- ref: t => {
67
- if (tabsRefAsArray.current && focusableTabsRef.current && tabsRef.current) {
68
- tabsRefAsArray.current[index] = t;
69
- if (!disabled && !focusableTabsRef.current.includes(t)) focusableTabsRef.current.push(t);
70
- tabsRef.current[index] = t;
71
-
72
- if (type === TabTypes.SUBTABS && firstSubtabInternalRef && index === availableTabIndexes[0]) {
73
- firstSubtabInternalRef.current = t;
74
- }
75
-
76
- if (type !== TabTypes.SUBTABS && index === availableTabIndexes[availableTabIndexes.length - 1]) {
77
- lastTabInternalRef.current = t;
78
- }
79
-
80
- if (ref) ref.current = t;
81
- }
82
- },
83
- type: "button",
84
- "aria-controls": tabId,
85
- "aria-selected": actualActiveTab === tabId,
86
- "aria-disabled": disabled,
87
- "aria-labelledby": "".concat(tabId, "-label"),
88
- isDSMobile: isDSMobile,
89
- fixedTabsHeaders: fixedTabsHeaders,
90
- tabType: type,
91
- title: title,
92
- "data-required": required,
93
- "data-tab-id": tabId,
94
- "data-index": index,
95
- withCarousel: withCarousel,
96
- isActive: actualActiveTab === tabId,
97
- disabled: disabled,
98
- showSeparator: showSeparator && type !== TabTypes.NORMAL,
99
- "data-testid": type === TabTypes.NORMAL ? DSTabsDatatestid.TAB_BUTTON : DSTabsDatatestid.SUBTAB_BUTTON,
100
- id: "".concat(tabId, "-label"),
101
- onClick: e => {
102
- if (!disabled) {
103
- handleOnTabChange(tabId, e);
104
- updateIndicatorStyle();
105
- }
106
-
107
- if (onClick && !disabled) onClick(tabId, e);
108
- },
109
- onFocus: e => {
110
- if (withCarousel) centerTab({
111
- e,
112
- listRef: carouselOnlyListRef
113
- });
114
- },
115
- onKeyDown: e => {
116
- if (e.key === 'Enter') e.stopPropagation();
117
- if (!disabled) handleOnKeyDown(e);
118
- if (onKeyDown && !disabled) onKeyDown(e);
119
- },
120
- style: style,
121
- children: [title, required && (_StyledRequiredMark || (_StyledRequiredMark = /*#__PURE__*/_jsx(StyledRequiredMark, {}, void 0, "\u25CF")))]
122
- }, tabId);
123
- });
124
- }, [tabs, actualActiveTab, isDSMobile, fixedTabsHeaders, type, withCarousel, showSeparator, tabsRefAsArray, focusableTabsRef, tabsRef, firstSubtabInternalRef, lastTabInternalRef, handleOnTabChange, updateIndicatorStyle, carouselOnlyListRef, handleOnKeyDown]);
125
-
126
- if (type === TabTypes.SUBTABS && !isDSMobile) {
127
- return /*#__PURE__*/jsx(StyledSubTabsList, {
128
- withCarousel: withCarousel,
129
- "data-testid": DSTabsDatatestid.SUB_TAB_LIST,
130
- ref: tabsListRef,
131
- role: "tablist",
132
- children: withCarousel ? /*#__PURE__*/_jsx(Carousel, {}, void 0, renderTabs) : renderTabs
133
- });
134
- }
135
-
136
- return /*#__PURE__*/jsxs(StyledTabList, {
137
- withCarousel: withCarousel,
138
- ref: tabsListRef,
139
- role: "tablist",
140
- "data-testid": DSTabsDatatestid.TAB_LIST,
141
- isDSMobile: isDSMobile,
142
- fixedTabsHeaders: fixedTabsHeaders,
143
- mobileGradients: mobileGradients,
144
- onScroll: updateMobileGradients,
145
- indicatorStyle: indicatorStyle,
146
- tabType: type,
147
- children: [/*#__PURE__*/_jsx(StyledTabWrapper, {
148
- isDSMobile: isDSMobile,
149
- fixedTabsHeaders: fixedTabsHeaders
150
- }, void 0, !isDSMobile && withCarousel ? /*#__PURE__*/_jsx(Carousel, {
151
- updateIndicatorStyle: updateIndicatorStyle
152
- }, void 0, renderTabs) : renderTabs), /*#__PURE__*/_jsx(StyledSelectionIndicator, {
153
- isDSMobile: isDSMobile,
154
- tabType: type
155
- })]
156
- });
157
- };
158
-
159
- export { TabBar };
@@ -1,186 +0,0 @@
1
- import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
2
- import styled from 'styled-components';
3
- import { css, onlySafariAndFirefox, safariAndFirefoxBold } from '@elliemae/ds-system';
4
- import { TabTypes } from '../../utils/constants.js';
5
-
6
- var _templateObject;
7
- const StyledSelectionIndicator = /*#__PURE__*/styled.div.withConfig({
8
- componentId: "sc-3hla56-0"
9
- })(["position:absolute;height:3px;top:", ";margin-top:", ";pointer-events:none;transition:200ms cubic-bezier(0.36,0,1,1);z-index:10;", ""], _ref => {
10
- let {
11
- tabType,
12
- isDSMobile
13
- } = _ref;
14
- if (isDSMobile) return "35px";
15
- if (tabType === TabTypes.NORMAL_SMALL) return "15px";
16
- return "25px";
17
- }, _ref2 => {
18
- let {
19
- theme
20
- } = _ref2;
21
- return theme.space.xxxs;
22
- }, _ref3 => {
23
- let {
24
- isDSMobile
25
- } = _ref3;
26
- return isDSMobile ? " \n margin-left: 0;\n margin-top: 3px;\n " : "";
27
- });
28
- const mobileGradientsSettings = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n"])), _ref4 => {
29
- let {
30
- theme,
31
- mobileGradients,
32
- isDSMobile,
33
- fixedTabsHeaders
34
- } = _ref4;
35
-
36
- if (isDSMobile && !fixedTabsHeaders) {
37
- if (mobileGradients.right && mobileGradients.left) return "background: linear-gradient(90deg, rgba(238,238,238,0) 0%, ".concat(theme.colors.brand[200], " 20%, ").concat(theme.colors.brand[200], " 80%, rgba(238,238,238,0) 100%);");
38
- if (mobileGradients.right) return "background: linear-gradient(90deg, ".concat(theme.colors.brand[200], " 0%, ").concat(theme.colors.brand[200], " 80%, rgba(238,238,238,0) 100%);");
39
- if (mobileGradients.left) return "background: linear-gradient(90deg, rgba(238,238,238,0) 0%, ".concat(theme.colors.brand[200], " 20%, ").concat(theme.colors.brand[200], " 100%);");
40
- }
41
-
42
- return "";
43
- });
44
- const StyledTabWrapper = /*#__PURE__*/styled.div.withConfig({
45
- componentId: "sc-3hla56-1"
46
- })(["display:flex;flex:1;flex-wrap:nowrap;", " ", ""], _ref5 => {
47
- let {
48
- fixedTabsHeaders,
49
- isDSMobile
50
- } = _ref5;
51
- return !fixedTabsHeaders && isDSMobile ? '' : 'overflow-x: hidden;';
52
- }, _ref6 => {
53
- let {
54
- theme,
55
- isDSMobile
56
- } = _ref6;
57
- return isDSMobile ? "border-bottom: 1px solid ".concat(theme.colors.brand[300], ";") : "";
58
- });
59
- const StyledTabButton = /*#__PURE__*/styled.button.withConfig({
60
- componentId: "sc-3hla56-2"
61
- })(["position:relative;background-color:transparent;border:none;cursor:pointer;transition:100ms cubic-bezier(0,0,0.42,1);text-transform:", ";letter-spacing:0px;white-space:nowrap;padding:2px 0;margin-right:", ";margin-left:", ";color:", ";", " ", " ", " ", " ", " ", " ", ""], _ref7 => {
62
- let {
63
- tabType
64
- } = _ref7;
65
- return tabType === TabTypes.SUBTABS ? "capitalize" : "uppercase";
66
- }, _ref8 => {
67
- let {
68
- fixedTabsHeaders,
69
- isDSMobile
70
- } = _ref8;
71
- if (fixedTabsHeaders) return '0px';
72
- if (!fixedTabsHeaders && isDSMobile) return '14px';
73
- return '16px';
74
- }, _ref9 => {
75
- let {
76
- fixedTabsHeaders,
77
- isDSMobile
78
- } = _ref9;
79
- if (fixedTabsHeaders) return '0px';
80
- if (!fixedTabsHeaders && isDSMobile) return '14px';
81
- return '16px';
82
- }, _ref10 => {
83
- let {
84
- theme
85
- } = _ref10;
86
- return theme.colors.neutral[700];
87
- }, onlySafariAndFirefox('-webkit-text-stroke: 0.4px transparent;'), _ref11 => {
88
- let {
89
- tabType
90
- } = _ref11;
91
- return tabType === TabTypes.NORMAL ? "height: 32px;" : "height: 22px;";
92
- }, _ref12 => {
93
- let {
94
- theme,
95
- isActive,
96
- disabled
97
- } = _ref12;
98
- return isActive && !disabled ? "\n font-weight: ".concat(theme.fontWeights.semibold, ";\n ").concat(safariAndFirefoxBold("#353C46"), "\n\n &:hover {\n ").concat(safariAndFirefoxBold("#1E79C2"), "\n }\n \n ") : "\n \n ";
99
- }, _ref13 => {
100
- let {
101
- theme,
102
- disabled
103
- } = _ref13;
104
- return disabled ? "\n color: ".concat(theme.colors.neutral[500], ";\n cursor: not-allowed;\n ") : "\n &:hover {\n color: ".concat(theme.colors.brand[600], ";\n }\n ");
105
- }, _ref14 => {
106
- let {
107
- theme,
108
- showSeparator,
109
- tabType
110
- } = _ref14;
111
- return showSeparator ? "\n &:not(:last-of-type):before\n {\n content: \"\";\n position: absolute;\n width: 1px;\n right: -16px;\n top: 50%;\n transform: translateY(-50%);\n height: ".concat(tabType === TabTypes.SUBTABS ? "10px" : "16px", ";\n background: ").concat(theme.colors.neutral[400], ";\n }") : "";
112
- }, _ref15 => {
113
- let {
114
- theme,
115
- isDSMobile,
116
- tabType,
117
- isActive
118
- } = _ref15;
119
- return !isDSMobile ? "\n &:focus {\n outline: none;\n &:after {\n position: absolute;\n content: '';\n top: 0;\n left: -16px;\n width: calc(100% + 32px);\n height: 100%;\n z-index: 5;\n border-radius: 2px;\n border: 2px solid ".concat(theme.colors.brand[700], ";\n }\n\n ").concat(tabType !== TabTypes.SUBTABS && isActive ? "\n &:before {\n position: absolute;\n content: '';\n left: -16px;\n right: 0;\n top: calc(100% - 2px);\n transform: none;\n width: calc(100% + 32px);\n height: 2px;\n z-index: 10;\n background: linear-gradient(to right, transparent 0px, transparent 12px, white 12px, white 16px, transparent 16px,transparent calc(100% - 16px), white calc(100% - 16px), white calc(100% - 12px), transparent calc(100% - 12px), transparent 100%);\n }\n " : "", "\n }\n \n ") : "";
120
- }, _ref16 => {
121
- let {
122
- theme,
123
- isActive,
124
- disabled,
125
- isDSMobile
126
- } = _ref16;
127
- return isDSMobile ? "\n height: 40px;\n color: ".concat(theme.colors.brand[600], ";\n font-weight: ").concat(theme.fontWeights.regular, ";\n padding: 0;\n font-size: 13px;\n line-height: 1.3;\n ").concat(onlySafariAndFirefox('-webkit-text-stroke: 0.4px transparent;'), " \n\n &:focus {\n font-weight: ").concat(theme.fontWeights.regular, ";\n font-size: 13px;\n ").concat(safariAndFirefoxBold('#006AA9'), "\n }\n\n ").concat(isActive ? "\n font-weight: ".concat(theme.fontWeights.regular, ";\n font-size: 13px;\n ").concat(safariAndFirefoxBold('#006AA9'), "\n ") : "", "\n\n ").concat(isActive && !disabled ? "\n font-size: 13px;\n color: ".concat(theme.colors.brand[700], ";\n line-height: 1.3;\n font-weight: ").concat(theme.fontWeights.regular, ";\n -webkit-font-smoothing: subpixel-antialiased; \n -webkit-text-stroke: 0.4px ").concat(theme.colors.brand[700], ";") : "", "\n\n ").concat(!disabled ? "\n &:hover,\n &:focus {\n outline: none;\n color: ".concat(theme.colors.brand[700], ";\n ").concat(safariAndFirefoxBold('#006AA9'), "\n }") : "", "\n\n ") : "";
128
- });
129
- const StyledSubTabsList = /*#__PURE__*/styled.div.withConfig({
130
- componentId: "sc-3hla56-3"
131
- })(["position:relative;display:flex;flex-wrap:nowrap;flex:1;width:100%;", ""], _ref17 => {
132
- let {
133
- withCarousel
134
- } = _ref17;
135
- return withCarousel ? 'max-width: 100%;' : '';
136
- });
137
- const StyledTabList = /*#__PURE__*/styled.div.withConfig({
138
- componentId: "sc-3hla56-4"
139
- })(["position:relative;display:flex;flex-wrap:nowrap;flex:1;width:100%;", " ", " ", "{padding-bottom:0;padding-top:0;}", " ", " ", " ", "{", "}", "{background:", ";}"], _ref18 => {
140
- let {
141
- withCarousel,
142
- isDSMobile
143
- } = _ref18;
144
- return withCarousel && !isDSMobile ? "max-width: 100%;" : '';
145
- }, _ref19 => {
146
- let {
147
- theme,
148
- isDSMobile,
149
- tabType
150
- } = _ref19;
151
- return tabType !== TabTypes.NORMAL_SMALL && !isDSMobile ? "\n &:after {\n content: '';\n position: absolute;\n width: 100%;\n height: 1px;\n box-shadow: 0px 0px 0px 1px ".concat(theme.colors.neutral[400], ";\n pointer-events: none;\n bottom: 0px;\n }\n ") : "";
152
- }, StyledTabButton, _ref20 => {
153
- let {
154
- theme,
155
- isDSMobile
156
- } = _ref20;
157
- return isDSMobile ? "\n \n background: ".concat(theme.colors.brand[200], ";") : "";
158
- }, mobileGradientsSettings, _ref21 => {
159
- let {
160
- isDSMobile,
161
- fixedTabsHeaders
162
- } = _ref21;
163
- return isDSMobile ? "\n ".concat(!fixedTabsHeaders ? "\n z-index: 0;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: thin;\n &::-webkit-scrollbar {\n display: none;\n }" : "\n display: flex;\n ".concat(StyledTabButton, " {\n flex: 1;\n overflow-x: hidden;\n }")) : "";
164
- }, StyledSelectionIndicator, _ref22 => {
165
- let {
166
- indicatorStyle
167
- } = _ref22;
168
- return "\n width: ".concat(indicatorStyle.width, ";\n left: ").concat(indicatorStyle.left, ";\n ");
169
- }, StyledSelectionIndicator, _ref23 => {
170
- let {
171
- theme,
172
- indicatorStyle,
173
- isDSMobile
174
- } = _ref23;
175
- return !isDSMobile ? indicatorStyle.backgroundWithTransparent : theme.colors.brand[600];
176
- });
177
- const StyledRequiredMark = /*#__PURE__*/styled.span.withConfig({
178
- componentId: "sc-3hla56-5"
179
- })(["color:", ";font-size:6px;margin-left:2px;position:absolute;top:5px;"], _ref24 => {
180
- let {
181
- theme
182
- } = _ref24;
183
- return theme.colors.danger[900];
184
- });
185
-
186
- export { StyledRequiredMark, StyledSelectionIndicator, StyledSubTabsList, StyledTabButton, StyledTabList, StyledTabWrapper };