@elliemae/ds-tabs 2.2.0-alpha.2 → 2.2.0-beta.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 (102) hide show
  1. package/cjs/DSTabs.js +40 -58
  2. package/cjs/DSTabsCTX.js +25 -51
  3. package/cjs/DSTabsDatatestid.js +14 -42
  4. package/cjs/DSTabsTypes.js +2 -27
  5. package/cjs/config/useCrossRef.js +11 -38
  6. package/cjs/config/useTabs.js +36 -53
  7. package/cjs/defaultProps.js +13 -39
  8. package/cjs/exportsRelated/DSTab.js +32 -46
  9. package/cjs/index.js +17 -38
  10. package/cjs/parts/carousel/Carousel.js +53 -61
  11. package/cjs/parts/carousel/styles.js +63 -77
  12. package/cjs/parts/carousel/useCarousel.js +49 -51
  13. package/cjs/parts/carousel/useCarouselCallbacks.js +36 -53
  14. package/cjs/parts/tabBar/TabBar.js +120 -124
  15. package/cjs/parts/tabBar/styles.js +195 -289
  16. package/cjs/parts/tabBar/useTabBar.js +55 -67
  17. package/cjs/parts/tabsContent/TabsContent.js +45 -49
  18. package/cjs/parts/tabsContent/styles.js +15 -39
  19. package/cjs/parts/tabsPanel/TabsPanels.js +58 -60
  20. package/cjs/parts/tabsPanel/styles.js +23 -43
  21. package/cjs/propTypes.js +29 -54
  22. package/cjs/utils/constants.js +16 -44
  23. package/cjs/utils/helpers.js +22 -46
  24. package/cjs/utils/hooks/useKeyboardNavigation.js +43 -59
  25. package/cjs/utils/hooks/useTabsCallbacks.js +33 -49
  26. package/esm/DSTabs.js +25 -24
  27. package/esm/DSTabsCTX.js +20 -22
  28. package/esm/DSTabsDatatestid.js +10 -13
  29. package/esm/DSTabsTypes.js +1 -2
  30. package/esm/config/useCrossRef.js +4 -6
  31. package/esm/config/useTabs.js +22 -14
  32. package/esm/defaultProps.js +8 -9
  33. package/esm/exportsRelated/DSTab.js +19 -15
  34. package/esm/index.js +4 -9
  35. package/esm/parts/carousel/Carousel.js +38 -25
  36. package/esm/parts/carousel/styles.js +52 -48
  37. package/esm/parts/carousel/useCarousel.js +34 -15
  38. package/esm/parts/carousel/useCarouselCallbacks.js +28 -20
  39. package/esm/parts/tabBar/TabBar.js +102 -93
  40. package/esm/parts/tabBar/styles.js +183 -262
  41. package/esm/parts/tabBar/useTabBar.js +36 -27
  42. package/esm/parts/tabsContent/TabsContent.js +35 -19
  43. package/esm/parts/tabsContent/styles.js +7 -10
  44. package/esm/parts/tabsPanel/TabsPanels.js +45 -28
  45. package/esm/parts/tabsPanel/styles.js +15 -14
  46. package/esm/propTypes.js +24 -25
  47. package/esm/utils/constants.js +8 -15
  48. package/esm/utils/helpers.js +11 -16
  49. package/esm/utils/hooks/useKeyboardNavigation.js +39 -30
  50. package/esm/utils/hooks/useTabsCallbacks.js +27 -18
  51. package/package.json +6 -6
  52. package/types/DSTabs.d.ts +2 -2
  53. package/cjs/DSTabs.js.map +0 -7
  54. package/cjs/DSTabsCTX.js.map +0 -7
  55. package/cjs/DSTabsDatatestid.js.map +0 -7
  56. package/cjs/DSTabsTypes.js.map +0 -7
  57. package/cjs/config/useCrossRef.js.map +0 -7
  58. package/cjs/config/useTabs.js.map +0 -7
  59. package/cjs/defaultProps.js.map +0 -7
  60. package/cjs/exportsRelated/DSTab.js.map +0 -7
  61. package/cjs/index.js.map +0 -7
  62. package/cjs/parts/carousel/Carousel.js.map +0 -7
  63. package/cjs/parts/carousel/styles.js.map +0 -7
  64. package/cjs/parts/carousel/useCarousel.js.map +0 -7
  65. package/cjs/parts/carousel/useCarouselCallbacks.js.map +0 -7
  66. package/cjs/parts/tabBar/TabBar.js.map +0 -7
  67. package/cjs/parts/tabBar/styles.js.map +0 -7
  68. package/cjs/parts/tabBar/useTabBar.js.map +0 -7
  69. package/cjs/parts/tabsContent/TabsContent.js.map +0 -7
  70. package/cjs/parts/tabsContent/styles.js.map +0 -7
  71. package/cjs/parts/tabsPanel/TabsPanels.js.map +0 -7
  72. package/cjs/parts/tabsPanel/styles.js.map +0 -7
  73. package/cjs/propTypes.js.map +0 -7
  74. package/cjs/utils/constants.js.map +0 -7
  75. package/cjs/utils/helpers.js.map +0 -7
  76. package/cjs/utils/hooks/useKeyboardNavigation.js.map +0 -7
  77. package/cjs/utils/hooks/useTabsCallbacks.js.map +0 -7
  78. package/esm/DSTabs.js.map +0 -7
  79. package/esm/DSTabsCTX.js.map +0 -7
  80. package/esm/DSTabsDatatestid.js.map +0 -7
  81. package/esm/DSTabsTypes.js.map +0 -7
  82. package/esm/config/useCrossRef.js.map +0 -7
  83. package/esm/config/useTabs.js.map +0 -7
  84. package/esm/defaultProps.js.map +0 -7
  85. package/esm/exportsRelated/DSTab.js.map +0 -7
  86. package/esm/index.js.map +0 -7
  87. package/esm/parts/carousel/Carousel.js.map +0 -7
  88. package/esm/parts/carousel/styles.js.map +0 -7
  89. package/esm/parts/carousel/useCarousel.js.map +0 -7
  90. package/esm/parts/carousel/useCarouselCallbacks.js.map +0 -7
  91. package/esm/parts/tabBar/TabBar.js.map +0 -7
  92. package/esm/parts/tabBar/styles.js.map +0 -7
  93. package/esm/parts/tabBar/useTabBar.js.map +0 -7
  94. package/esm/parts/tabsContent/TabsContent.js.map +0 -7
  95. package/esm/parts/tabsContent/styles.js.map +0 -7
  96. package/esm/parts/tabsPanel/TabsPanels.js.map +0 -7
  97. package/esm/parts/tabsPanel/styles.js.map +0 -7
  98. package/esm/propTypes.js.map +0 -7
  99. package/esm/utils/constants.js.map +0 -7
  100. package/esm/utils/helpers.js.map +0 -7
  101. package/esm/utils/hooks/useKeyboardNavigation.js.map +0 -7
  102. package/esm/utils/hooks/useTabsCallbacks.js.map +0 -7
@@ -1,50 +1,54 @@
1
- import * as React from "react";
2
- import styled from "styled-components";
3
- import { DSButtonV2 } from "@elliemae/ds-button";
4
- import { TabTypes } from "../../utils/constants";
5
- const StyledCarouselBtn = styled(DSButtonV2)`
6
- margin: 0;
7
- min-width: ${({ theme }) => theme.space.xs};
8
- width: ${({ theme }) => theme.space.xs};
1
+ import styled from 'styled-components';
2
+ import { DSButtonV2 } from '@elliemae/ds-button';
3
+ import { TabTypes } from '../../utils/constants.js';
9
4
 
10
- &:hover:not(:disabled) {
11
- background-color: transparent;
12
- }
13
- background-color: transparent;
14
- border-radius: 0px;
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
+ });
15
53
 
16
- & .em-ds-icon svg {
17
- fill: ${({ theme }) => theme.colors.brand[600]};
18
- }
19
- `;
20
- const StyledCarouselWrapper = styled.span`
21
- position: relative;
22
- width: 100%;
23
- display: flex;
24
- `;
25
- const StyledChildrenWrap = styled.div`
26
- display: flex;
27
- flex-wrap: nowrap;
28
- flex: 1;
29
- overflow-x: hidden;
30
- `;
31
- const StyledCarouselButtonWrapper = styled.div`
32
- max-width: 16px;
33
- position: absolute;
34
- z-index: 200;
35
- ${({ right }) => right ? "right: 0;" : `left: 0;`}
36
- width: 16px;
37
- height: ${({ tabType }) => tabType === TabTypes.NORMAL ? "32px" : "22px"};
38
- padding-top: ${({ tabType }) => tabType === TabTypes.NORMAL ? "5px" : "0px"};
39
- background: white;
40
- ${({ theme, tabType }) => tabType === TabTypes.NORMAL ? `
41
- background: linear-gradient(to bottom, white 0px, white 30px, ${theme.colors.neutral[400]} 30px, ${theme.colors.neutral[400]} 31px, white 31px , white 32px );
42
- ` : ``};
43
- `;
44
- export {
45
- StyledCarouselBtn,
46
- StyledCarouselButtonWrapper,
47
- StyledCarouselWrapper,
48
- StyledChildrenWrap
49
- };
50
- //# sourceMappingURL=styles.js.map
54
+ export { StyledCarouselBtn, StyledCarouselButtonWrapper, StyledCarouselWrapper, StyledChildrenWrap };
@@ -1,20 +1,34 @@
1
- import * as React from "react";
2
- import { useCallback, useState, useContext } from "react";
3
- import useResizeObserver from "@react-hook/resize-observer";
4
- import { DSTabsContext } from "../../DSTabsCTX";
5
- import { isElementVisibleCarousel } from "../../utils/helpers";
6
- import { useCarouselCallbacks } from "./useCarouselCallbacks";
7
- const useCarousel = ({ updateIndicatorStyle }) => {
8
- const { carouselOnlyListRef } = useContext(DSTabsContext);
1
+ import 'core-js/modules/web.dom-collections.iterator.js';
2
+ import 'core-js/modules/esnext.async-iterator.reduce.js';
3
+ import 'core-js/modules/esnext.iterator.constructor.js';
4
+ import 'core-js/modules/esnext.iterator.reduce.js';
5
+ import { useContext, useState, useCallback } from 'react';
6
+ import useResizeObserver from '@react-hook/resize-observer';
7
+ import { DSTabsContext } from '../../DSTabsCTX.js';
8
+ import { isElementVisibleCarousel } from '../../utils/helpers.js';
9
+ import { useCarouselCallbacks } from './useCarouselCallbacks.js';
10
+
11
+ const useCarousel = _ref => {
12
+ let {
13
+ updateIndicatorStyle
14
+ } = _ref;
15
+ const {
16
+ carouselOnlyListRef
17
+ } = useContext(DSTabsContext);
9
18
  const [showChevrons, setShowChevrons] = useState({
10
19
  right: false,
11
20
  left: false
12
21
  });
13
- const { tabsRefAsArray } = useContext(DSTabsContext);
22
+ const {
23
+ tabsRefAsArray
24
+ } = useContext(DSTabsContext);
14
25
  const shouldShowLeft = useCallback(() => carouselOnlyListRef.current ? carouselOnlyListRef.current.scrollLeft > 0 : false, [carouselOnlyListRef]);
15
26
  const shouldShowRight = useCallback(() => carouselOnlyListRef.current ? carouselOnlyListRef.current.scrollLeft < carouselOnlyListRef.current.scrollWidth - carouselOnlyListRef.current.clientWidth : false, [carouselOnlyListRef]);
16
27
  const recalcChevrons = useCallback(() => {
17
- setShowChevrons({ right: shouldShowRight(), left: shouldShowLeft() });
28
+ setShowChevrons({
29
+ right: shouldShowRight(),
30
+ left: shouldShowLeft()
31
+ });
18
32
  }, [shouldShowLeft, shouldShowRight]);
19
33
  const getVisibleItemsOffset = useCallback(() => {
20
34
  if (tabsRefAsArray.current) {
@@ -25,14 +39,21 @@ const useCarousel = ({ updateIndicatorStyle }) => {
25
39
  const margin = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
26
40
  return acc + (width + margin);
27
41
  }
42
+
28
43
  return acc;
29
44
  }, 0);
30
45
  return scroll - 16;
31
46
  }
47
+
32
48
  return 0;
33
49
  }, [tabsRefAsArray, carouselOnlyListRef]);
34
50
  useResizeObserver(carouselOnlyListRef, recalcChevrons);
35
- const { leftButtonOnClick, rightButtonOnClick, handleOnClick, handleOnScroll } = useCarouselCallbacks({
51
+ const {
52
+ leftButtonOnClick,
53
+ rightButtonOnClick,
54
+ handleOnClick,
55
+ handleOnScroll
56
+ } = useCarouselCallbacks({
36
57
  getVisibleItemsOffset,
37
58
  recalcChevrons,
38
59
  updateIndicatorStyle
@@ -45,7 +66,5 @@ const useCarousel = ({ updateIndicatorStyle }) => {
45
66
  handleOnScroll
46
67
  };
47
68
  };
48
- export {
49
- useCarousel
50
- };
51
- //# sourceMappingURL=useCarousel.js.map
69
+
70
+ export { useCarousel };
@@ -1,13 +1,18 @@
1
- import * as React from "react";
2
- import { useCallback, useContext } from "react";
3
- import { isElementVisibleCarousel } from "../../utils/helpers";
4
- import { DSTabsContext } from "../../DSTabsCTX";
5
- const useCarouselCallbacks = ({
6
- getVisibleItemsOffset,
7
- updateIndicatorStyle,
8
- recalcChevrons
9
- }) => {
10
- const { focusableTabsRef, carouselOnlyListRef } = useContext(DSTabsContext);
1
+ import { useContext, useCallback } from 'react';
2
+ import { isElementVisibleCarousel } from '../../utils/helpers.js';
3
+ import { DSTabsContext } from '../../DSTabsCTX.js';
4
+
5
+ /* eslint-disable max-statements */
6
+ const useCarouselCallbacks = _ref => {
7
+ let {
8
+ getVisibleItemsOffset,
9
+ updateIndicatorStyle,
10
+ recalcChevrons
11
+ } = _ref;
12
+ const {
13
+ focusableTabsRef,
14
+ carouselOnlyListRef
15
+ } = useContext(DSTabsContext);
11
16
  const rightButtonOnClick = useCallback(() => {
12
17
  if (carouselOnlyListRef.current) {
13
18
  carouselOnlyListRef.current.scrollLeft += getVisibleItemsOffset();
@@ -20,25 +25,30 @@ const useCarouselCallbacks = ({
20
25
  }, [getVisibleItemsOffset, carouselOnlyListRef]);
21
26
  const handleOnScroll = useCallback(() => {
22
27
  recalcChevrons();
23
- if (updateIndicatorStyle)
24
- updateIndicatorStyle();
28
+ if (updateIndicatorStyle) updateIndicatorStyle();
25
29
  }, [recalcChevrons, updateIndicatorStyle]);
26
- const handleOnClick = useCallback(({ target }) => {
27
- if (focusableTabsRef.current && target.getAttribute("role") === "tab") {
30
+ const handleOnClick = useCallback(_ref2 => {
31
+ let {
32
+ target
33
+ } = _ref2;
34
+
35
+ if (focusableTabsRef.current && target.getAttribute('role') === 'tab') {
28
36
  const tabList = carouselOnlyListRef.current;
29
37
  const tabButton = target;
30
38
  const tabButtonDimensions = tabButton.getBoundingClientRect();
31
- const tabListDimensions = tabList?.getBoundingClientRect();
39
+ const tabListDimensions = tabList === null || tabList === void 0 ? void 0 : tabList.getBoundingClientRect();
32
40
  const tabButtonIndex = tabButton.dataset.index;
33
41
  const lastItemIndex = focusableTabsRef.current.length.toString();
34
42
  const magicNumber = 34;
35
- const firstOrLastItem = tabButtonIndex === "0" || tabButtonIndex === lastItemIndex;
43
+ const firstOrLastItem = tabButtonIndex === '0' || tabButtonIndex === lastItemIndex;
44
+
36
45
  if (!isElementVisibleCarousel(tabButton, tabList, firstOrLastItem) && tabListDimensions && carouselOnlyListRef.current) {
37
46
  const containerWidth = tabListDimensions.width;
38
47
  const halfContainer = containerWidth / 2;
39
48
  const elementScrollPosition = tabButtonDimensions.left - tabListDimensions.left;
40
49
  const positionInContainer = elementScrollPosition % containerWidth;
41
50
  const width = tabButton.offsetWidth + magicNumber;
51
+
42
52
  if (positionInContainer > halfContainer) {
43
53
  carouselOnlyListRef.current.scrollLeft += width + positionInContainer - containerWidth;
44
54
  } else {
@@ -54,7 +64,5 @@ const useCarouselCallbacks = ({
54
64
  handleOnScroll
55
65
  };
56
66
  };
57
- export {
58
- useCarouselCallbacks
59
- };
60
- //# sourceMappingURL=useCarouselCallbacks.js.map
67
+
68
+ export { useCarouselCallbacks };
@@ -1,20 +1,18 @@
1
- import * as React from "react";
2
- import React2, { useMemo, useContext } from "react";
3
- import { Carousel } from "../carousel/Carousel";
4
- import { useTabBar } from "./useTabBar";
5
- import {
6
- StyledTabButton,
7
- StyledTabList,
8
- StyledTabWrapper,
9
- StyledSelectionIndicator,
10
- StyledSubTabsList,
11
- StyledRequiredMark
12
- } from "./styles";
13
- import { DSTabsContext, DSTabsCrossRefContext } from "../../DSTabsCTX";
14
- import { useKeyboardNavigation } from "../../utils/hooks/useKeyboardNavigation";
15
- import { TabTypes } from "../../utils/constants";
16
- import { useTabsCallbacks } from "../../utils/hooks/useTabsCallbacks";
17
- import { DSTabsDatatestid } from "../../DSTabsDatatestid";
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 { TabTypes } from '../../utils/constants.js';
11
+ import { useTabsCallbacks } from '../../utils/hooks/useTabsCallbacks.js';
12
+ import { DSTabsDatatestid } from '../../DSTabsDatatestid.js';
13
+ import { jsxs, jsx } from 'react/jsx-runtime';
14
+
15
+ var _StyledRequiredMark;
18
16
  const TabBar = () => {
19
17
  const {
20
18
  tabsRef,
@@ -22,121 +20,132 @@ const TabBar = () => {
22
20
  tabsListRef,
23
21
  tabsRefAsArray,
24
22
  actualActiveTab,
25
- props: { type, fixedTabsHeaders, withCarousel, isDSMobile, showSeparator, children: tabs }
23
+ props: {
24
+ type,
25
+ fixedTabsHeaders,
26
+ withCarousel,
27
+ isDSMobile,
28
+ showSeparator,
29
+ children: tabs
30
+ }
26
31
  } = useContext(DSTabsContext);
27
- const { lastTabInternalRef, firstSubtabInternalRef } = useContext(DSTabsCrossRefContext);
28
- const { handleOnTabChange } = useTabsCallbacks();
29
- const { handleOnKeyDown } = useKeyboardNavigation();
30
- const { indicatorStyle, mobileGradients, updateMobileGradients, updateIndicatorStyle } = useTabBar();
32
+ const {
33
+ lastTabInternalRef,
34
+ firstSubtabInternalRef
35
+ } = useContext(DSTabsCrossRefContext);
36
+ const {
37
+ handleOnTabChange
38
+ } = useTabsCallbacks();
39
+ const {
40
+ handleOnKeyDown
41
+ } = useKeyboardNavigation();
42
+ const {
43
+ indicatorStyle,
44
+ mobileGradients,
45
+ updateMobileGradients,
46
+ updateIndicatorStyle
47
+ } = useTabBar();
31
48
  const renderTabs = useMemo(() => {
32
49
  const availableTabIndexes = [];
33
- return React2.Children.map(tabs, (tab, index) => {
34
- const { tabId = "", title = "", style, required = false, disabled = false, ref, onClick, onKeyDown } = tab.props;
35
- if (!disabled)
36
- availableTabIndexes.push(index);
37
- return /* @__PURE__ */ React2.createElement(StyledTabButton, {
38
- key: tabId,
50
+ return React.Children.map(tabs, (tab, index) => {
51
+ const {
52
+ tabId = '',
53
+ title = '',
54
+ style,
55
+ required = false,
56
+ disabled = false,
57
+ ref,
58
+ onClick,
59
+ onKeyDown
60
+ } = tab.props;
61
+ if (!disabled) availableTabIndexes.push(index);
62
+ return /*#__PURE__*/jsxs(StyledTabButton, {
39
63
  role: "tab",
40
- ref: (t) => {
64
+ ref: t => {
41
65
  if (tabsRefAsArray.current && focusableTabsRef.current && tabsRef.current) {
42
66
  tabsRefAsArray.current[index] = t;
43
- if (!disabled && !focusableTabsRef.current.includes(t))
44
- focusableTabsRef.current.push(t);
67
+ if (!disabled && !focusableTabsRef.current.includes(t)) focusableTabsRef.current.push(t);
45
68
  tabsRef.current[index] = t;
69
+
46
70
  if (type === TabTypes.SUBTABS && firstSubtabInternalRef && index === availableTabIndexes[0]) {
47
71
  firstSubtabInternalRef.current = t;
48
72
  }
73
+
49
74
  if (type !== TabTypes.SUBTABS && index === availableTabIndexes[availableTabIndexes.length - 1]) {
50
75
  lastTabInternalRef.current = t;
51
76
  }
52
- if (ref)
53
- ref.current = t;
77
+
78
+ if (ref) ref.current = t;
54
79
  }
55
80
  },
56
81
  type: "button",
57
82
  "aria-controls": tabId,
58
83
  "aria-selected": actualActiveTab === tabId,
59
84
  "aria-disabled": disabled,
60
- "aria-labelledby": `${tabId}-label`,
61
- isDSMobile,
62
- fixedTabsHeaders,
85
+ "aria-labelledby": "".concat(tabId, "-label"),
86
+ isDSMobile: isDSMobile,
87
+ fixedTabsHeaders: fixedTabsHeaders,
63
88
  tabType: type,
64
- title,
89
+ title: title,
65
90
  "data-required": required,
66
91
  "data-tab-id": tabId,
67
92
  "data-index": index,
68
- withCarousel,
93
+ withCarousel: withCarousel,
69
94
  isActive: actualActiveTab === tabId,
70
- disabled,
95
+ disabled: disabled,
71
96
  showSeparator: showSeparator && type !== TabTypes.NORMAL,
72
97
  "data-testid": type === TabTypes.NORMAL ? DSTabsDatatestid.TAB_BUTTON : DSTabsDatatestid.SUBTAB_BUTTON,
73
- id: `${tabId}-label`,
74
- onClick: (e) => {
98
+ id: "".concat(tabId, "-label"),
99
+ onClick: e => {
75
100
  if (!disabled) {
76
101
  handleOnTabChange(tabId, e);
77
102
  updateIndicatorStyle();
78
103
  }
79
- if (onClick && !disabled)
80
- onClick(tabId, e);
104
+
105
+ if (onClick && !disabled) onClick(tabId, e);
81
106
  },
82
- onKeyDown: (e) => {
83
- if (e.key === "Enter")
84
- e.stopPropagation();
85
- if (!disabled)
86
- handleOnKeyDown(e);
87
- if (onKeyDown && !disabled)
88
- onKeyDown(e);
107
+ onKeyDown: e => {
108
+ if (e.key === 'Enter') e.stopPropagation();
109
+ if (!disabled) handleOnKeyDown(e);
110
+ if (onKeyDown && !disabled) onKeyDown(e);
89
111
  },
90
- style
91
- }, title, required && /* @__PURE__ */ React2.createElement(StyledRequiredMark, null, "\u25CF"));
112
+ style: style,
113
+ children: [title, required && (_StyledRequiredMark || (_StyledRequiredMark = /*#__PURE__*/_jsx(StyledRequiredMark, {}, void 0, "\u25CF")))]
114
+ }, tabId);
92
115
  });
93
- }, [
94
- tabs,
95
- actualActiveTab,
96
- isDSMobile,
97
- fixedTabsHeaders,
98
- type,
99
- withCarousel,
100
- showSeparator,
101
- tabsRefAsArray,
102
- focusableTabsRef,
103
- tabsRef,
104
- firstSubtabInternalRef,
105
- lastTabInternalRef,
106
- handleOnTabChange,
107
- updateIndicatorStyle,
108
- handleOnKeyDown
109
- ]);
116
+ }, [tabs, actualActiveTab, isDSMobile, fixedTabsHeaders, type, withCarousel, showSeparator, tabsRefAsArray, focusableTabsRef, tabsRef, firstSubtabInternalRef, lastTabInternalRef, handleOnTabChange, updateIndicatorStyle, handleOnKeyDown]);
117
+
110
118
  if (type === TabTypes.SUBTABS && !isDSMobile) {
111
- return /* @__PURE__ */ React2.createElement(StyledSubTabsList, {
112
- withCarousel,
119
+ return /*#__PURE__*/jsx(StyledSubTabsList, {
120
+ withCarousel: withCarousel,
113
121
  "data-testid": DSTabsDatatestid.SUB_TAB_LIST,
114
122
  ref: tabsListRef,
115
- role: "tablist"
116
- }, withCarousel ? /* @__PURE__ */ React2.createElement(Carousel, null, renderTabs) : renderTabs);
123
+ role: "tablist",
124
+ children: withCarousel ? /*#__PURE__*/_jsx(Carousel, {}, void 0, renderTabs) : renderTabs
125
+ });
117
126
  }
118
- return /* @__PURE__ */ React2.createElement(StyledTabList, {
119
- withCarousel,
127
+
128
+ return /*#__PURE__*/jsxs(StyledTabList, {
129
+ withCarousel: withCarousel,
120
130
  ref: tabsListRef,
121
131
  role: "tablist",
122
132
  "data-testid": DSTabsDatatestid.TAB_LIST,
123
- isDSMobile,
124
- fixedTabsHeaders,
125
- mobileGradients,
133
+ isDSMobile: isDSMobile,
134
+ fixedTabsHeaders: fixedTabsHeaders,
135
+ mobileGradients: mobileGradients,
126
136
  onScroll: updateMobileGradients,
127
- indicatorStyle,
128
- tabType: type
129
- }, /* @__PURE__ */ React2.createElement(StyledTabWrapper, {
130
- isDSMobile,
131
- fixedTabsHeaders
132
- }, !isDSMobile && withCarousel ? /* @__PURE__ */ React2.createElement(Carousel, {
133
- updateIndicatorStyle
134
- }, renderTabs) : renderTabs), /* @__PURE__ */ React2.createElement(StyledSelectionIndicator, {
135
- isDSMobile,
136
- tabType: type
137
- }));
138
- };
139
- export {
140
- TabBar
137
+ indicatorStyle: indicatorStyle,
138
+ tabType: type,
139
+ children: [/*#__PURE__*/_jsx(StyledTabWrapper, {
140
+ isDSMobile: isDSMobile,
141
+ fixedTabsHeaders: fixedTabsHeaders
142
+ }, void 0, !isDSMobile && withCarousel ? /*#__PURE__*/_jsx(Carousel, {
143
+ updateIndicatorStyle: updateIndicatorStyle
144
+ }, void 0, renderTabs) : renderTabs), /*#__PURE__*/_jsx(StyledSelectionIndicator, {
145
+ isDSMobile: isDSMobile,
146
+ tabType: type
147
+ })]
148
+ });
141
149
  };
142
- //# sourceMappingURL=TabBar.js.map
150
+
151
+ export { TabBar };