@elliemae/ds-tabs 3.52.0-rc.2 → 3.52.0-rc.20
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/dist/cjs/DSTabs.js +3 -3
- package/dist/cjs/DSTabs.js.map +2 -2
- package/dist/cjs/DSTabsCTX.js +1 -1
- package/dist/cjs/DSTabsCTX.js.map +2 -2
- package/dist/cjs/config/useTabs.js +1 -1
- package/dist/cjs/config/useTabs.js.map +2 -2
- package/dist/cjs/{utils/constants.js → constants/index.js} +40 -13
- package/dist/cjs/constants/index.js.map +7 -0
- package/dist/cjs/exported-related/DSTab.js +1 -1
- package/dist/cjs/exported-related/DSTab.js.map +2 -2
- package/dist/cjs/index.js +12 -6
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/parts/carousel/Carousel.js +3 -3
- package/dist/cjs/parts/carousel/Carousel.js.map +2 -2
- package/dist/cjs/parts/carousel/styles.js +4 -4
- package/dist/cjs/parts/carousel/styles.js.map +2 -2
- package/dist/cjs/parts/carousel/useCarouselCallbacks.js.map +2 -2
- package/dist/cjs/parts/tabBar/TabBar.js +9 -111
- package/dist/cjs/parts/tabBar/TabBar.js.map +3 -3
- package/dist/cjs/parts/tabBar/TabBarItemRenderer.js +136 -0
- package/dist/cjs/parts/tabBar/TabBarItemRenderer.js.map +7 -0
- package/dist/cjs/parts/tabBar/styles.js +17 -7
- package/dist/cjs/parts/tabBar/styles.js.map +2 -2
- package/dist/cjs/parts/tabBar/useTabBar.js +4 -4
- package/dist/cjs/parts/tabBar/useTabBar.js.map +2 -2
- package/dist/cjs/parts/tabsContent/TabsContent.js +2 -2
- package/dist/cjs/parts/tabsContent/TabsContent.js.map +2 -2
- package/dist/cjs/parts/tabsPanel/TabsPanels.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +27 -13
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/sharedTypes.js.map +1 -1
- package/dist/cjs/typescript-testing/typescript-tabs-valid.js +6 -6
- package/dist/cjs/typescript-testing/typescript-tabs-valid.js.map +2 -2
- package/dist/cjs/utils/helpers.js +1 -1
- package/dist/cjs/utils/helpers.js.map +1 -1
- package/dist/cjs/utils/hooks/useTabsCallbacks.js.map +2 -2
- package/dist/esm/DSTabs.js +4 -4
- package/dist/esm/DSTabs.js.map +2 -2
- package/dist/esm/DSTabsCTX.js +1 -1
- package/dist/esm/DSTabsCTX.js.map +2 -2
- package/dist/esm/config/useTabs.js +2 -2
- package/dist/esm/config/useTabs.js.map +2 -2
- package/dist/esm/constants/index.js +53 -0
- package/dist/esm/constants/index.js.map +7 -0
- package/dist/esm/exported-related/DSTab.js +2 -2
- package/dist/esm/exported-related/DSTab.js.map +2 -2
- package/dist/esm/index.js +18 -5
- package/dist/esm/index.js.map +3 -3
- package/dist/esm/parts/carousel/Carousel.js +3 -3
- package/dist/esm/parts/carousel/Carousel.js.map +2 -2
- package/dist/esm/parts/carousel/styles.js +4 -4
- package/dist/esm/parts/carousel/styles.js.map +2 -2
- package/dist/esm/parts/carousel/useCarouselCallbacks.js.map +2 -2
- package/dist/esm/parts/tabBar/TabBar.js +11 -115
- package/dist/esm/parts/tabBar/TabBar.js.map +3 -3
- package/dist/esm/parts/tabBar/TabBarItemRenderer.js +106 -0
- package/dist/esm/parts/tabBar/TabBarItemRenderer.js.map +7 -0
- package/dist/esm/parts/tabBar/styles.js +17 -7
- package/dist/esm/parts/tabBar/styles.js.map +2 -2
- package/dist/esm/parts/tabBar/useTabBar.js +4 -4
- package/dist/esm/parts/tabBar/useTabBar.js.map +2 -2
- package/dist/esm/parts/tabsContent/TabsContent.js +2 -2
- package/dist/esm/parts/tabsContent/TabsContent.js.map +1 -1
- package/dist/esm/parts/tabsPanel/TabsPanels.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +33 -14
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-tabs-valid.js +7 -7
- package/dist/esm/typescript-testing/typescript-tabs-valid.js.map +2 -2
- package/dist/esm/utils/helpers.js +1 -1
- package/dist/esm/utils/helpers.js.map +1 -1
- package/dist/esm/utils/hooks/useTabsCallbacks.js.map +2 -2
- package/dist/types/constants/index.d.ts +44 -0
- package/dist/types/index.d.ts +3 -4
- package/dist/types/parts/carousel/Carousel.d.ts +1 -1
- package/dist/types/parts/carousel/styles.d.ts +2 -2
- package/dist/types/parts/tabBar/TabBarItemRenderer.d.ts +2 -0
- package/dist/types/parts/tabBar/styles.d.ts +1 -0
- package/dist/types/react-desc-prop-types.d.ts +10 -485
- package/dist/types/sharedTypes.d.ts +2 -2
- package/dist/types/tests/DSTabs.PUI-15144.test.d.ts +1 -0
- package/dist/types/tests/DSTabs.PUI-15145.test.d.ts +1 -0
- package/dist/types/tests/DSTabs.data-testid.test.d.ts +1 -0
- package/dist/types/tests/DSTabs.exports.test.d.ts +1 -0
- package/dist/types/tests/DStabs.default-props.test.d.ts +1 -0
- package/dist/types/tests/axe-tabs.test.d.ts +1 -0
- package/package.json +9 -9
- package/dist/cjs/DSTabsDatatestid.js +0 -47
- package/dist/cjs/DSTabsDatatestid.js.map +0 -7
- package/dist/cjs/utils/constants.js.map +0 -7
- package/dist/esm/DSTabsDatatestid.js +0 -17
- package/dist/esm/DSTabsDatatestid.js.map +0 -7
- package/dist/esm/utils/constants.js +0 -26
- package/dist/esm/utils/constants.js.map +0 -7
- package/dist/types/DSTabsDatatestid.d.ts +0 -12
- package/dist/types/utils/constants.d.ts +0 -17
|
@@ -1,139 +1,35 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import { useContext } from "react";
|
|
4
4
|
import { Carousel } from "../carousel/Carousel.js";
|
|
5
5
|
import { useTabBar } from "./useTabBar.js";
|
|
6
6
|
import {
|
|
7
|
-
StyledTabButton,
|
|
8
7
|
StyledMobileGradient,
|
|
9
8
|
StyledTabList,
|
|
10
9
|
StyledTabWrapper,
|
|
11
10
|
StyledSelectionIndicator,
|
|
12
|
-
StyledSubTabsList
|
|
13
|
-
StyledRequiredMark
|
|
11
|
+
StyledSubTabsList
|
|
14
12
|
} from "./styles.js";
|
|
15
|
-
import { DSTabsContext
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { TabTypes } from "../../utils/constants.js";
|
|
13
|
+
import { DSTabsContext } from "../../DSTabsCTX.js";
|
|
14
|
+
import { TABS_DATA_TESTID, TAB_TYPES } from "../../constants/index.js";
|
|
15
|
+
import { TabBarItemRenderer } from "./TabBarItemRenderer.js";
|
|
19
16
|
import { useTabsCallbacks } from "../../utils/hooks/useTabsCallbacks.js";
|
|
20
|
-
import { DSTabsDatatestid } from "../../DSTabsDatatestid.js";
|
|
21
17
|
const TabBar = () => {
|
|
22
18
|
const {
|
|
23
|
-
tabsRef,
|
|
24
|
-
focusableTabsRef,
|
|
25
19
|
tabsListRef,
|
|
26
|
-
|
|
27
|
-
carouselOnlyListRef,
|
|
28
|
-
actualActiveTab,
|
|
29
|
-
props: { type, fixedTabsHeaders, withCarousel, isDSMobile, showSeparator, children: tabs }
|
|
20
|
+
props: { type, fixedTabsHeaders, withCarousel, isDSMobile }
|
|
30
21
|
} = useContext(DSTabsContext);
|
|
31
|
-
const { lastTabInternalRef, firstSubtabInternalRef } = useContext(DSTabsCrossRefContext);
|
|
32
22
|
const { handleOnTabChange } = useTabsCallbacks();
|
|
33
|
-
const { handleOnKeyDown } = useKeyboardNavigation();
|
|
34
23
|
const { indicatorStyle, mobileGradients, updateMobileGradients, updateIndicatorStyle } = useTabBar();
|
|
35
|
-
|
|
36
|
-
const availableTabIndexes = [];
|
|
37
|
-
return React2.Children.map(tabs, (tab, index) => {
|
|
38
|
-
const {
|
|
39
|
-
tabId = "",
|
|
40
|
-
title = "",
|
|
41
|
-
style,
|
|
42
|
-
required = false,
|
|
43
|
-
disabled = false,
|
|
44
|
-
applyAriaDisabled = false,
|
|
45
|
-
ref,
|
|
46
|
-
onClick,
|
|
47
|
-
onKeyDown
|
|
48
|
-
} = tab.props;
|
|
49
|
-
if (!disabled) availableTabIndexes.push(index);
|
|
50
|
-
return /* @__PURE__ */ jsxs(
|
|
51
|
-
StyledTabButton,
|
|
52
|
-
{
|
|
53
|
-
role: "tab",
|
|
54
|
-
innerRef: (tabButtonRef) => {
|
|
55
|
-
if (tabButtonRef && tabsRefAsArray.current && focusableTabsRef.current && tabsRef.current) {
|
|
56
|
-
tabsRefAsArray.current[index] = tabButtonRef;
|
|
57
|
-
if (!disabled && !focusableTabsRef.current.includes(tabButtonRef))
|
|
58
|
-
focusableTabsRef.current.push(tabButtonRef);
|
|
59
|
-
tabsRef.current[index] = tabButtonRef;
|
|
60
|
-
if (type === TabTypes.SUBTABS && firstSubtabInternalRef && index === availableTabIndexes[0]) {
|
|
61
|
-
firstSubtabInternalRef.current = tabButtonRef;
|
|
62
|
-
}
|
|
63
|
-
if (type !== TabTypes.SUBTABS && index === availableTabIndexes[availableTabIndexes.length - 1]) {
|
|
64
|
-
lastTabInternalRef.current = tabButtonRef;
|
|
65
|
-
}
|
|
66
|
-
if (ref) ref.current = tabButtonRef;
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
type: "button",
|
|
70
|
-
"aria-controls": tabId,
|
|
71
|
-
"aria-selected": actualActiveTab === tabId && !applyAriaDisabled,
|
|
72
|
-
"aria-disabled": disabled || applyAriaDisabled,
|
|
73
|
-
isDSMobile,
|
|
74
|
-
fixedTabsHeaders,
|
|
75
|
-
tabType: type,
|
|
76
|
-
"data-required": required,
|
|
77
|
-
"data-tab-id": tabId,
|
|
78
|
-
"data-index": index,
|
|
79
|
-
withCarousel,
|
|
80
|
-
isActive: actualActiveTab === tabId,
|
|
81
|
-
disabled,
|
|
82
|
-
showSeparator: showSeparator && type !== TabTypes.NORMAL,
|
|
83
|
-
"data-testid": type === TabTypes.NORMAL ? DSTabsDatatestid.TAB_BUTTON : DSTabsDatatestid.SUBTAB_BUTTON,
|
|
84
|
-
id: `${tabId}-label`,
|
|
85
|
-
onClick: (e) => {
|
|
86
|
-
if (applyAriaDisabled) return;
|
|
87
|
-
if (!disabled) {
|
|
88
|
-
handleOnTabChange(tabId, e);
|
|
89
|
-
updateIndicatorStyle();
|
|
90
|
-
}
|
|
91
|
-
if (onClick && !disabled) onClick(tabId, e);
|
|
92
|
-
},
|
|
93
|
-
onFocus: (e) => {
|
|
94
|
-
if (withCarousel) centerTab({ e, listRef: carouselOnlyListRef });
|
|
95
|
-
},
|
|
96
|
-
onKeyDown: (e) => {
|
|
97
|
-
if (e.key === "Enter") e.stopPropagation();
|
|
98
|
-
if (!disabled) handleOnKeyDown(e);
|
|
99
|
-
if (onKeyDown && !disabled) onKeyDown(e);
|
|
100
|
-
},
|
|
101
|
-
style,
|
|
102
|
-
children: [
|
|
103
|
-
title,
|
|
104
|
-
required && /* @__PURE__ */ jsx(StyledRequiredMark, { children: "\u25CF" })
|
|
105
|
-
]
|
|
106
|
-
},
|
|
107
|
-
tabId
|
|
108
|
-
);
|
|
109
|
-
});
|
|
110
|
-
}, [
|
|
111
|
-
tabs,
|
|
112
|
-
actualActiveTab,
|
|
113
|
-
isDSMobile,
|
|
114
|
-
fixedTabsHeaders,
|
|
115
|
-
type,
|
|
116
|
-
withCarousel,
|
|
117
|
-
showSeparator,
|
|
118
|
-
tabsRefAsArray,
|
|
119
|
-
focusableTabsRef,
|
|
120
|
-
tabsRef,
|
|
121
|
-
firstSubtabInternalRef,
|
|
122
|
-
lastTabInternalRef,
|
|
123
|
-
handleOnTabChange,
|
|
124
|
-
updateIndicatorStyle,
|
|
125
|
-
carouselOnlyListRef,
|
|
126
|
-
handleOnKeyDown
|
|
127
|
-
]);
|
|
128
|
-
if (type === TabTypes.SUBTABS && !isDSMobile) {
|
|
24
|
+
if (type === TAB_TYPES.SUBTABS && !isDSMobile) {
|
|
129
25
|
return /* @__PURE__ */ jsx(
|
|
130
26
|
StyledSubTabsList,
|
|
131
27
|
{
|
|
132
28
|
withCarousel,
|
|
133
|
-
"data-testid":
|
|
29
|
+
"data-testid": TABS_DATA_TESTID.SUB_TAB_LIST,
|
|
134
30
|
role: withCarousel ? void 0 : "tablist",
|
|
135
31
|
innerRef: tabsListRef,
|
|
136
|
-
children: withCarousel ? /* @__PURE__ */ jsx(Carousel, { children:
|
|
32
|
+
children: withCarousel ? /* @__PURE__ */ jsx(Carousel, { children: /* @__PURE__ */ jsx(TabBarItemRenderer, {}) }) : /* @__PURE__ */ jsx(TabBarItemRenderer, {})
|
|
137
33
|
}
|
|
138
34
|
);
|
|
139
35
|
}
|
|
@@ -143,7 +39,7 @@ const TabBar = () => {
|
|
|
143
39
|
withCarousel,
|
|
144
40
|
role: withCarousel ? void 0 : "tablist",
|
|
145
41
|
innerRef: tabsListRef,
|
|
146
|
-
"data-testid":
|
|
42
|
+
"data-testid": TABS_DATA_TESTID.TAB_LIST,
|
|
147
43
|
isDSMobile,
|
|
148
44
|
fixedTabsHeaders,
|
|
149
45
|
mobileGradients,
|
|
@@ -159,7 +55,7 @@ const TabBar = () => {
|
|
|
159
55
|
}
|
|
160
56
|
},
|
|
161
57
|
children: [
|
|
162
|
-
/* @__PURE__ */ jsx(StyledTabWrapper, { "data-testid": "tab-wrapper", isDSMobile, fixedTabsHeaders, children: !isDSMobile && withCarousel ? /* @__PURE__ */ jsx(Carousel, { updateIndicatorStyle, children:
|
|
58
|
+
/* @__PURE__ */ jsx(StyledTabWrapper, { "data-testid": "tab-wrapper", isDSMobile, fixedTabsHeaders, children: !isDSMobile && withCarousel ? /* @__PURE__ */ jsx(Carousel, { updateIndicatorStyle, children: /* @__PURE__ */ jsx(TabBarItemRenderer, {}) }) : /* @__PURE__ */ jsx(TabBarItemRenderer, {}) }),
|
|
163
59
|
/* @__PURE__ */ jsx(StyledSelectionIndicator, { isDSMobile, tabType: type }),
|
|
164
60
|
isDSMobile && !fixedTabsHeaders && /* @__PURE__ */ jsx(
|
|
165
61
|
StyledMobileGradient,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/tabBar/TabBar.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport React, {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport React, { useContext } from 'react';\nimport { Carousel } from '../carousel/Carousel.js';\nimport { useTabBar } from './useTabBar.js';\nimport {\n StyledMobileGradient,\n StyledTabList,\n StyledTabWrapper,\n StyledSelectionIndicator,\n StyledSubTabsList,\n} from './styles.js';\nimport { DSTabsContext } from '../../DSTabsCTX.js';\n\nimport { TABS_DATA_TESTID, TAB_TYPES } from '../../constants/index.js';\n\nimport { TabBarItemRenderer } from './TabBarItemRenderer.js';\nimport { useTabsCallbacks } from '../../utils/hooks/useTabsCallbacks.js';\n\nexport const TabBar = (): JSX.Element => {\n const {\n tabsListRef,\n props: { type, fixedTabsHeaders, withCarousel, isDSMobile },\n } = useContext(DSTabsContext);\n\n const { handleOnTabChange } = useTabsCallbacks();\n const { indicatorStyle, mobileGradients, updateMobileGradients, updateIndicatorStyle } = useTabBar();\n\n if (type === TAB_TYPES.SUBTABS && !isDSMobile) {\n return (\n <StyledSubTabsList\n withCarousel={withCarousel}\n data-testid={TABS_DATA_TESTID.SUB_TAB_LIST}\n role={withCarousel ? undefined : 'tablist'}\n innerRef={tabsListRef}\n >\n {withCarousel ? (\n <Carousel>\n <TabBarItemRenderer />\n </Carousel>\n ) : (\n <TabBarItemRenderer />\n )}\n </StyledSubTabsList>\n );\n }\n\n return (\n <StyledTabList\n withCarousel={withCarousel}\n role={withCarousel ? undefined : 'tablist'}\n innerRef={tabsListRef}\n data-testid={TABS_DATA_TESTID.TAB_LIST}\n isDSMobile={isDSMobile}\n fixedTabsHeaders={fixedTabsHeaders}\n mobileGradients={mobileGradients}\n onScroll={updateMobileGradients}\n indicatorStyle={indicatorStyle}\n tabType={type}\n onMouseDown={(e) => {\n /**\n * [PUI-15396](https://jira.elliemae.io/browse/PUI-15396)\n * This is a workaround for an issue where clicks on tab buttons within a carousel\n * sometimes fail to trigger state updates. The problem occurs because:\n *\n * 1. When clicking on certain tabs, the click event reaches the tablist\n * wrapper instead of the tab button\n * 2. The carousel's scroll logic interferes with the normal event propagation\n * 3. This prevents the tab's onClick handler from being called consistently\n *\n * By adding an onMouseDown handler at the tablist level, we can:\n * - Capture the event earlier in the event cycle (before onClick)\n * - Check if the clicked element has a tab ID (data-tab-id attribute)\n * - Directly call handleOnTabChange with the appropriate tab ID\n *\n * This ensures the tab state updates correctly regardless of event bubbling issues\n * or interference from the carousel's scroll behavior.\n */\n const target = e.target as HTMLElement;\n const { dataset, ariaDisabled } = target;\n if (dataset.tabId && ariaDisabled !== 'true') {\n handleOnTabChange(dataset.tabId, e);\n updateIndicatorStyle();\n }\n }}\n >\n <StyledTabWrapper data-testid=\"tab-wrapper\" isDSMobile={isDSMobile} fixedTabsHeaders={fixedTabsHeaders}>\n {!isDSMobile && withCarousel ? (\n <Carousel updateIndicatorStyle={updateIndicatorStyle}>\n <TabBarItemRenderer />\n </Carousel>\n ) : (\n <TabBarItemRenderer />\n )}\n </StyledTabWrapper>\n <StyledSelectionIndicator isDSMobile={isDSMobile} tabType={type} />\n {isDSMobile && !fixedTabsHeaders && (\n <StyledMobileGradient\n mobileGradients={mobileGradients}\n left={tabsListRef.current?.scrollLeft}\n width={tabsListRef.current?.scrollWidth}\n />\n )}\n </StyledTabList>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACqCX,cAUR,YAVQ;AApCZ,SAAgB,kBAAkB;AAClC,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;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AAAA;AAAA,YACC;AAAA,YACA,MAAM,YAAY,SAAS;AAAA,YAC3B,OAAO,YAAY,SAAS;AAAA;AAAA,QAC9B;AAAA;AAAA;AAAA,EAEJ;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createElement } from "react";
|
|
4
|
+
import React2, { useContext } from "react";
|
|
5
|
+
import { useTabBar } from "./useTabBar.js";
|
|
6
|
+
import { StyledTabButton, StyledRequiredMark, ScreenReaderOnly } from "./styles.js";
|
|
7
|
+
import { DSTabsContext, DSTabsCrossRefContext } from "../../DSTabsCTX.js";
|
|
8
|
+
import { useKeyboardNavigation } from "../../utils/hooks/useKeyboardNavigation.js";
|
|
9
|
+
import { centerTab } from "../../utils/helpers.js";
|
|
10
|
+
import { useTabsCallbacks } from "../../utils/hooks/useTabsCallbacks.js";
|
|
11
|
+
import { TABS_DATA_TESTID, TAB_TYPES } from "../../constants/index.js";
|
|
12
|
+
const TabBarItemRenderer = React2.memo(() => {
|
|
13
|
+
const {
|
|
14
|
+
tabsRef,
|
|
15
|
+
focusableTabsRef,
|
|
16
|
+
tabsRefAsArray,
|
|
17
|
+
carouselOnlyListRef,
|
|
18
|
+
actualActiveTab,
|
|
19
|
+
props: { type, fixedTabsHeaders, withCarousel, isDSMobile, showSeparator, children: tabs }
|
|
20
|
+
} = useContext(DSTabsContext);
|
|
21
|
+
const { lastTabInternalRef, firstSubtabInternalRef } = useContext(DSTabsCrossRefContext);
|
|
22
|
+
const { handleOnTabChange } = useTabsCallbacks();
|
|
23
|
+
const { handleOnKeyDown } = useKeyboardNavigation();
|
|
24
|
+
const { updateIndicatorStyle } = useTabBar();
|
|
25
|
+
const availableTabIndexes = [];
|
|
26
|
+
return React2.Children.map(tabs, (tab, index) => {
|
|
27
|
+
const {
|
|
28
|
+
tabId = "",
|
|
29
|
+
title = "",
|
|
30
|
+
style,
|
|
31
|
+
required = false,
|
|
32
|
+
disabled = false,
|
|
33
|
+
applyAriaDisabled = false,
|
|
34
|
+
ref,
|
|
35
|
+
onClick,
|
|
36
|
+
onKeyDown,
|
|
37
|
+
...rest
|
|
38
|
+
} = tab.props;
|
|
39
|
+
if (!disabled) availableTabIndexes.push(index);
|
|
40
|
+
return /* @__PURE__ */ createElement(
|
|
41
|
+
StyledTabButton,
|
|
42
|
+
{
|
|
43
|
+
...rest,
|
|
44
|
+
key: tabId,
|
|
45
|
+
role: "tab",
|
|
46
|
+
innerRef: (tabButtonRef) => {
|
|
47
|
+
if (tabButtonRef && tabsRefAsArray.current && focusableTabsRef.current && tabsRef.current) {
|
|
48
|
+
tabsRefAsArray.current[index] = tabButtonRef;
|
|
49
|
+
if (!disabled && !focusableTabsRef.current.includes(tabButtonRef))
|
|
50
|
+
focusableTabsRef.current.push(tabButtonRef);
|
|
51
|
+
tabsRef.current[index] = tabButtonRef;
|
|
52
|
+
if (type === TAB_TYPES.SUBTABS && firstSubtabInternalRef && index === availableTabIndexes[0]) {
|
|
53
|
+
firstSubtabInternalRef.current = tabButtonRef;
|
|
54
|
+
}
|
|
55
|
+
if (type !== TAB_TYPES.SUBTABS && index === availableTabIndexes[availableTabIndexes.length - 1]) {
|
|
56
|
+
lastTabInternalRef.current = tabButtonRef;
|
|
57
|
+
}
|
|
58
|
+
if (ref) ref.current = tabButtonRef;
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
type: "button",
|
|
62
|
+
"aria-controls": tabId,
|
|
63
|
+
"aria-selected": actualActiveTab === tabId && !applyAriaDisabled,
|
|
64
|
+
"aria-disabled": disabled || applyAriaDisabled,
|
|
65
|
+
isDSMobile,
|
|
66
|
+
fixedTabsHeaders,
|
|
67
|
+
tabType: type,
|
|
68
|
+
"data-required": required,
|
|
69
|
+
"data-tab-id": tabId,
|
|
70
|
+
"data-index": index,
|
|
71
|
+
withCarousel,
|
|
72
|
+
isActive: actualActiveTab === tabId,
|
|
73
|
+
disabled,
|
|
74
|
+
showSeparator: showSeparator && type !== TAB_TYPES.NORMAL,
|
|
75
|
+
"data-testid": type === TAB_TYPES.NORMAL ? TABS_DATA_TESTID.TAB_BUTTON : TABS_DATA_TESTID.SUBTAB_BUTTON,
|
|
76
|
+
id: `${tabId}-label`,
|
|
77
|
+
onClick: (e) => {
|
|
78
|
+
if (applyAriaDisabled) return;
|
|
79
|
+
if (!disabled) {
|
|
80
|
+
handleOnTabChange(tabId, e);
|
|
81
|
+
updateIndicatorStyle();
|
|
82
|
+
}
|
|
83
|
+
if (onClick && !disabled) onClick(tabId, e);
|
|
84
|
+
},
|
|
85
|
+
onFocus: (e) => {
|
|
86
|
+
if (withCarousel) centerTab({ e, listRef: carouselOnlyListRef });
|
|
87
|
+
},
|
|
88
|
+
onKeyDown: (e) => {
|
|
89
|
+
if (e.key === "Enter") e.stopPropagation();
|
|
90
|
+
if (!disabled) handleOnKeyDown(e);
|
|
91
|
+
if (onKeyDown && !disabled) onKeyDown(e);
|
|
92
|
+
},
|
|
93
|
+
style
|
|
94
|
+
},
|
|
95
|
+
title,
|
|
96
|
+
required && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
97
|
+
/* @__PURE__ */ jsx(StyledRequiredMark, { "aria-hidden": "true", children: "\u25CF" }),
|
|
98
|
+
/* @__PURE__ */ jsx(ScreenReaderOnly, { children: "Required" })
|
|
99
|
+
] })
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
export {
|
|
104
|
+
TabBarItemRenderer
|
|
105
|
+
};
|
|
106
|
+
//# sourceMappingURL=TabBarItemRenderer.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/tabBar/TabBarItemRenderer.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\n\nimport { useTabBar } from './useTabBar.js';\nimport { StyledTabButton, StyledRequiredMark, ScreenReaderOnly } from './styles.js';\nimport { DSTabsContext, DSTabsCrossRefContext } from '../../DSTabsCTX.js';\nimport { useKeyboardNavigation } from '../../utils/hooks/useKeyboardNavigation.js';\nimport { centerTab } from '../../utils/helpers.js';\n\nimport { useTabsCallbacks } from '../../utils/hooks/useTabsCallbacks.js';\n\nimport type { DSTabT } from '../../react-desc-prop-types.js';\nimport { TABS_DATA_TESTID, TAB_TYPES } from '../../constants/index.js';\n\nexport const TabBarItemRenderer: React.ComponentType<Record<never, never>> = React.memo(() => {\n const {\n tabsRef,\n focusableTabsRef,\n tabsRefAsArray,\n carouselOnlyListRef,\n actualActiveTab,\n props: { type, fixedTabsHeaders, withCarousel, isDSMobile, showSeparator, children: tabs },\n } = useContext(DSTabsContext);\n\n const { lastTabInternalRef, firstSubtabInternalRef } = useContext(DSTabsCrossRefContext);\n const { handleOnTabChange } = useTabsCallbacks();\n const { handleOnKeyDown } = useKeyboardNavigation();\n\n const { updateIndicatorStyle } = useTabBar();\n const availableTabIndexes: number[] = [];\n\n return React.Children.map(tabs, (tab: React.ReactElement<DSTabT.Props>, index) => {\n const {\n tabId = '',\n title = '',\n style,\n required = false,\n disabled = false,\n applyAriaDisabled = false,\n ref,\n onClick,\n onKeyDown,\n ...rest\n } = tab.props;\n if (!disabled) availableTabIndexes.push(index);\n return (\n <StyledTabButton\n {...rest}\n key={tabId}\n role=\"tab\"\n // eslint-disable-next-line complexity\n innerRef={(tabButtonRef: HTMLButtonElement) => {\n if (tabButtonRef && tabsRefAsArray.current && focusableTabsRef.current && tabsRef.current) {\n tabsRefAsArray.current[index] = tabButtonRef;\n if (!disabled && !focusableTabsRef.current.includes(tabButtonRef))\n focusableTabsRef.current.push(tabButtonRef);\n tabsRef.current[index] = tabButtonRef;\n if (type === TAB_TYPES.SUBTABS && firstSubtabInternalRef && index === availableTabIndexes[0]) {\n firstSubtabInternalRef.current = tabButtonRef;\n }\n if (type !== TAB_TYPES.SUBTABS && index === availableTabIndexes[availableTabIndexes.length - 1]) {\n lastTabInternalRef.current = tabButtonRef;\n }\n if (ref) ref.current = tabButtonRef;\n }\n }}\n type=\"button\"\n aria-controls={tabId}\n aria-selected={actualActiveTab === tabId && !applyAriaDisabled}\n aria-disabled={disabled || applyAriaDisabled}\n isDSMobile={isDSMobile}\n fixedTabsHeaders={fixedTabsHeaders}\n tabType={type}\n data-required={required}\n data-tab-id={tabId}\n data-index={index}\n withCarousel={withCarousel}\n isActive={actualActiveTab === tabId}\n disabled={disabled}\n showSeparator={showSeparator && type !== TAB_TYPES.NORMAL}\n data-testid={type === TAB_TYPES.NORMAL ? TABS_DATA_TESTID.TAB_BUTTON : TABS_DATA_TESTID.SUBTAB_BUTTON}\n id={`${tabId}-label`}\n onClick={(e) => {\n /** [PUI-15772] - Tabs Pre Refactor\n * Click handler for tab buttons. It:\n * 1. Prevents tab change if aria-disabled is true\n * 2. Updates active tab and indicator style if not disabled\n * 3. Calls the user's onClick callback if provided\n */\n if (applyAriaDisabled) return;\n if (!disabled) {\n handleOnTabChange(tabId, e);\n updateIndicatorStyle();\n }\n if (onClick && !disabled) onClick(tabId, e);\n }}\n onFocus={(e) => {\n /** [PUI-15772] - Tabs Pre Refactor\n * Focus handler for carousel tabs. It:\n * 1. Centers the focused tab in the carousel viewport\n * 2. Only applies when withCarousel prop is true\n */\n if (withCarousel) centerTab({ e, listRef: carouselOnlyListRef });\n }}\n onKeyDown={(e) => {\n /** [PUI-15772] - Tabs Pre Refactor\n * Keyboard navigation handler. It:\n * 1. Prevents Enter key propagation\n * 2. Handles keyboard navigation if not disabled\n * 3. Calls the user's onKeyDown callback if provided\n */\n if (e.key === 'Enter') e.stopPropagation();\n if (!disabled) handleOnKeyDown(e);\n if (onKeyDown && !disabled) onKeyDown(e);\n }}\n style={style}\n >\n {title}\n {required && (\n <>\n <StyledRequiredMark aria-hidden=\"true\">●</StyledRequiredM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C;AAAA,QACA;AAAA;AAAA,MAEC;AAAA,MACA,YACC,iCACE;AAAA,4BAAC,sBAAmB,eAAY,QAAO,oBAAO;AAAA,QAC9C,oBAAC,oBAAiB,sBAAQ;AAAA,SAC5B;AAAA,IAEJ;AAAA,EAEJ,CAAC;AACH,CAAC;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { styled, safariAndFirefoxBold, onlySafariAndFirefox, th } from "@elliemae/ds-system";
|
|
3
|
-
import {
|
|
3
|
+
import { TAB_TYPES } from "../../constants/index.js";
|
|
4
4
|
const StyledSelectionIndicator = styled.div`
|
|
5
5
|
position: absolute;
|
|
6
6
|
height: ${({ isDSMobile }) => isDSMobile ? "2px" : "3px"};
|
|
7
7
|
top: ${({ tabType, isDSMobile }) => {
|
|
8
8
|
if (isDSMobile) return `35px`;
|
|
9
|
-
if (tabType ===
|
|
9
|
+
if (tabType === TAB_TYPES.NORMAL_SMALL) return `15px`;
|
|
10
10
|
return `25px`;
|
|
11
11
|
}};
|
|
12
12
|
z-index: 1;
|
|
@@ -52,7 +52,7 @@ const StyledTabButton = styled.button`
|
|
|
52
52
|
cursor: pointer;
|
|
53
53
|
transition: 100ms cubic-bezier(0, 0, 0.42, 1);
|
|
54
54
|
text-transform: ${({ tabType, isDSMobile }) => {
|
|
55
|
-
if (tabType ===
|
|
55
|
+
if (tabType === TAB_TYPES.SUBTABS) return "capitalize";
|
|
56
56
|
return isDSMobile ? "none" : "uppercase";
|
|
57
57
|
}};
|
|
58
58
|
letter-spacing: 0px;
|
|
@@ -73,7 +73,7 @@ const StyledTabButton = styled.button`
|
|
|
73
73
|
color: ${({ theme }) => theme.colors.neutral[700]};
|
|
74
74
|
${onlySafariAndFirefox("-webkit-text-stroke: 0.4px transparent;")}
|
|
75
75
|
|
|
76
|
-
${({ tabType }) => tabType ===
|
|
76
|
+
${({ tabType }) => tabType === TAB_TYPES.NORMAL ? `height: 32px;` : `height: 22px;`}
|
|
77
77
|
|
|
78
78
|
${({ theme, isActive, disabled }) => isActive && !disabled ? `
|
|
79
79
|
font-weight: ${theme.fontWeights.semibold};
|
|
@@ -112,7 +112,7 @@ const StyledTabButton = styled.button`
|
|
|
112
112
|
right: -16px;
|
|
113
113
|
top: 50%;
|
|
114
114
|
transform: translateY(-50%);
|
|
115
|
-
height: ${tabType ===
|
|
115
|
+
height: ${tabType === TAB_TYPES.SUBTABS ? `10px` : `16px`};
|
|
116
116
|
background: ${theme.colors.neutral[400]};
|
|
117
117
|
}` : ``}
|
|
118
118
|
|
|
@@ -131,7 +131,7 @@ const StyledTabButton = styled.button`
|
|
|
131
131
|
border: 2px solid ${theme.colors.brand[700]};
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
${tabType !==
|
|
134
|
+
${tabType !== TAB_TYPES.SUBTABS && isActive ? `
|
|
135
135
|
&:before {
|
|
136
136
|
position: absolute;
|
|
137
137
|
content: '';
|
|
@@ -204,7 +204,7 @@ const StyledTabList = styled.div`
|
|
|
204
204
|
z-index: 0;
|
|
205
205
|
${({ withCarousel, isDSMobile }) => withCarousel && !isDSMobile ? `max-width: 100%;` : ""}
|
|
206
206
|
|
|
207
|
-
${({ theme, isDSMobile, tabType }) => tabType !==
|
|
207
|
+
${({ theme, isDSMobile, tabType }) => tabType !== TAB_TYPES.NORMAL_SMALL && !isDSMobile ? `
|
|
208
208
|
&:after {
|
|
209
209
|
content: '';
|
|
210
210
|
position: absolute;
|
|
@@ -262,7 +262,17 @@ const StyledRequiredMark = styled.span`
|
|
|
262
262
|
position: absolute;
|
|
263
263
|
top: 5px;
|
|
264
264
|
`;
|
|
265
|
+
const ScreenReaderOnly = styled.div`
|
|
266
|
+
clip: rect(0 0 0 0);
|
|
267
|
+
clip-path: inset(50%);
|
|
268
|
+
height: 1px;
|
|
269
|
+
overflow: hidden;
|
|
270
|
+
position: absolute;
|
|
271
|
+
white-space: nowrap;
|
|
272
|
+
width: 1px;
|
|
273
|
+
`;
|
|
265
274
|
export {
|
|
275
|
+
ScreenReaderOnly,
|
|
266
276
|
StyledMobileGradient,
|
|
267
277
|
StyledRequiredMark,
|
|
268
278
|
StyledSelectionIndicator,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/tabBar/styles.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable indent */\n/* eslint-disable max-lines */\nimport { styled, safariAndFirefoxBold, onlySafariAndFirefox, th } from '@elliemae/ds-system';\nimport { TabTypes } from '../../utils/constants.js';\nimport type { DSTabsInternalsT } from '../../sharedTypes.js';\n\ninterface StyledSelectionIndicatoPropsT {\n isDSMobile: boolean;\n tabType: DSTabsInternalsT.TabTypesT;\n}\n\ninterface StyledSubTabsListPropsT {\n withCarousel: boolean;\n}\n\ninterface StyledTabButtonPropsT {\n isActive: boolean;\n disabled: boolean;\n showSeparator: boolean;\n isDSMobile: boolean;\n fixedTabsHeaders: boolean;\n withCarousel: boolean;\n tabType: DSTabsInternalsT.TabTypesT;\n}\n\ninterface StyledTabListPropsT {\n withCarousel: boolean;\n isDSMobile: boolean;\n fixedTabsHeaders: boolean;\n mobileGradients: DSTabsInternalsT.MobileGradientsT;\n indicatorStyle: DSTabsInternalsT.IndicatorStyleT;\n tabType: DSTabsInternalsT.TabTypesT;\n}\n\ninterface StyledMobileGradientPropsT {\n mobileGradients: DSTabsInternalsT.MobileGradientsT;\n left: number | undefined;\n width: number | undefined;\n}\n\ninterface StyledTabWrapperPropsT {\n isDSMobile: boolean;\n fixedTabsHeaders: boolean;\n}\n\nexport const StyledSelectionIndicator = styled.div<StyledSelectionIndicatoPropsT>`\n position: absolute;\n height: ${({ isDSMobile }) => (isDSMobile ? '2px' : '3px')};\n top: ${({ tabType, isDSMobile }) => {\n if (isDSMobile) return `35px`;\n if (tabType === TabTypes.NORMAL_SMALL) return `15px`;\n return `25px`;\n }};\n z-index: 1;\n margin-top: ${({ theme }) => theme.space.xxxs};\n pointer-events: none;\n transition: 200ms cubic-bezier(0.36, 0, 1, 1);\n\n ${({ isDSMobile }) =>\n isDSMobile\n ? ` \n margin-left: 0;\n margin-top: 3px;\n `\n : ``}\n`;\n\nexport const StyledMobileGradient = styled.div.attrs(({ left = 0, width = 0 }: StyledMobileGradientPropsT) => ({\n style: { left: left - 10, maxWidth: width - left },\n}))<StyledMobileGradientPropsT>`\n position: fixed;\n z-index: 15;\n top: 0;\n width: calc(100% + 20px);\n height: 40px;\n pointer-events: none;\n\n ${({ mobileGradients: { left, right } }) => {\n if (right && left)\n return `background: linear-gradient(90deg, #FFFFFF 10px, #FFFFFF00 34px, #FFFFFF00 calc(100% - 44px), #FFFFFF calc(100% - 20px));`;\n if (right)\n return `background: linear-gradient(90deg, #FFFFFF00 0%, #FFFFFF00 calc(100% - 44px), #FFFFFF calc(100% - 20px));`;\n if (left) return `background: linear-gradient(90deg, #FFFFFF 10px, #FFFFFF00 34px, #FFFFFF00 100%);`;\n return '';\n }};\n`;\n\n/** CSS Setters */\n\nexport const StyledTabWrapper = styled.div<StyledTabWrapperPropsT>`\n display: flex;\n flex: 1;\n flex-wrap: nowrap;\n ${({ fixedTabsHeaders, isDSMobile }) => (!fixedTabsHeaders && isDSMobile ? '' : 'overflow-x: hidden;')}\n ${({ theme, isDSMobile }) => (isDSMobile ? `border-bottom: 1px solid ${theme.colors.neutral[200]};` : ``)}\n`;\n\nexport const StyledTabButton = styled.button<StyledTabButtonPropsT>`\n position: relative;\n background-color: transparent;\n border: none;\n cursor: pointer;\n transition: 100ms cubic-bezier(0, 0, 0.42, 1);\n text-transform: ${({ tabType, isDSMobile }) => {\n if (tabType === TabTypes.SUBTABS) return 'capitalize';\n return isDSMobile ? 'none' : 'uppercase';\n }};\n letter-spacing: 0px;\n white-space: nowrap;\n padding: 2px 0;\n margin-right: ${({ fixedTabsHeaders, isDSMobile }) => {\n if (fixedTabsHeaders) return '0px';\n if (!fixedTabsHeaders && isDSMobile) return '14px';\n return '16px';\n }};\n\n margin-left: ${({ fixedTabsHeaders, isDSMobile }) => {\n if (fixedTabsHeaders) return '0px';\n if (!fixedTabsHeaders && isDSMobile) return '14px';\n return '16px';\n }};\n\n color: ${({ theme }) => theme.colors.neutral[700]};\n ${onlySafariAndFirefox('-webkit-text-stroke: 0.4px transparent;')}\n\n ${({ tabType }) => (tabType === TabTypes.NORMAL ? `height: 32px;` : `height: 22px;`)}\n\n ${({ theme, isActive, disabled }) =>\n isActive && !disabled\n ? `\n font-weight: ${theme.fontWeights.semibold};\n ${safariAndFirefoxBold(`#353C46`)}\n\n &:hover {\n ${safariAndFirefoxBold(`#1E79C2`)}\n }\n \n `\n : `\n \n `}\n\n ${({ theme, disabled }) =>\n disabled\n ? `\n color: ${theme.colors.neutral[500]};\n cursor: not-allowed;\n `\n : `\n &:hover {\n color: ${theme.colors.brand[600]};\n }\n `}\n\n ${({ theme }) => `\n &[aria-disabled='true'] {\n color: ${theme.colors.neutral[500]};\n cursor: not-allowed;\n }\n `}\n\n ${({ theme, showSeparator, tabType }) =>\n showSeparator\n ? `\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: ${tabType === TabTypes.SUBTABS ? `10px` : `16px`};\n background: ${theme.colors.neutral[400]};\n }`\n : ``}\n\n ${({ theme, isDSMobile, tabType, isActive }) =>\n !isDSMobile\n ? `\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 ${theme.colors.brand[700]};\n }\n\n ${\n tabType !== TabTypes.SUBTABS && isActive\n ? `\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 }\n \n `\n : ``}\n\n \n \n${({ theme, isActive, disabled, isDSMobile }) =>\n isDSMobile\n ? `\n height: 40px;\n color: ${disabled ? theme.colors.neutral[500] : theme.colors.neutral[700]};\n font-weight: ${theme.fontWeights.regular};\n padding: 0;\n font-size: 16px;\n line-height: 1.3;\n ${String(onlySafariAndFirefox('-webkit-text-stroke: 0.4px transparent;'))} \n\n &:focus {\n font-weight: ${theme.fontWeights.regular};\n ${safariAndFirefoxBold('#006AA9')}\n }\n\n ${\n isActive\n ? `\n font-weight: ${theme.fontWeights.regular};\n ${safariAndFirefoxBold('#006AA9')}\n `\n : ``\n }\n\n ${\n isActive && !disabled\n ? `\n color: ${theme.colors.brand[700]};\n line-height: 1.3;\n font-weight: ${theme.fontWeights.regular};\n -webkit-font-smoothing: subpixel-antialiased; \n -webkit-text-stroke: 0.4px ${theme.colors.brand[700]};`\n : ``\n }\n\n ${\n !disabled\n ? `\n &:hover,\n &:focus {\n outline: none;\n color: ${theme.colors.brand[700]};\n ${safariAndFirefoxBold('#006AA9')}\n }`\n : ``\n }\n\n `\n : ``}\n`;\n\nexport const StyledSubTabsList = styled.div<StyledSubTabsListPropsT>`\n position: relative;\n display: flex;\n flex-wrap: nowrap;\n flex: 1;\n width: 100%;\n ${({ withCarousel }) => (withCarousel ? 'max-width: 100%;' : '')}\n`;\n\nexport const StyledTabList = styled.div<StyledTabListPropsT>`\n position: relative;\n display: flex;\n flex-wrap: nowrap;\n flex: 1;\n width: 100%;\n z-index: 0;\n ${({ withCarousel, isDSMobile }) => (withCarousel && !isDSMobile ? `max-width: 100%;` : '')}\n\n ${({ theme, isDSMobile, tabType }) =>\n tabType !== TabTypes.NORMAL_SMALL && !isDSMobile\n ? `\n &:after {\n content: '';\n position: absolute;\n width: 100%;\n height: 1px;\n box-shadow: 0px 0px 0px 1px ${theme.colors.neutral[400]};\n pointer-events: none;\n bottom: 0px;\n }\n `\n : ``}\n\n ${StyledTabButton} {\n padding-bottom: 0;\n padding-top: 0;\n }\n\n ${({ theme, isDSMobile }) =>\n isDSMobile\n ? `\n \n background: ${theme.colors.neutral['000']};`\n : ``}\n\n ${({ isDSMobile, fixedTabsHeaders }) =>\n isDSMobile\n ? `\n ${\n !fixedTabsHeaders\n ? `\n z-index: 0;\n overflow-x: auto;\n overflow-y: hidden;\n &::-webkit-scrollbar {\n display: none;\n }`\n : `\n display: flex;\n ${StyledTabButton} {\n flex: 1;\n overflow-x: hidden;\n }`\n }`\n : ``}\n\n ${StyledSelectionIndicator} {\n ${({ indicatorStyle }) => `\n width: ${indicatorStyle.width}px;\n left: ${indicatorStyle.left}px;\n `}\n }\n\n ${StyledSelectionIndicator} {\n background: ${(props) => {\n const { theme, indicatorStyle, isDSMobile } = props;\n return !isDSMobile\n ? `linear-gradient(to right, transparent 0px, transparent 16px, ${th.color('brand-600')(\n props,\n )} 16px, ${th.color('brand-600')(props)} ${indicatorStyle.width - 16}px, transparent ${\n indicatorStyle.width - 16\n }px, transparent ${indicatorStyle.width}px )`\n : theme.colors.brand[600];\n }};\n }\n`;\n\nexport const StyledRequiredMark = styled.span`\n color: ${({ theme }) => theme.colors.danger[900]};\n font-size: 6px;\n margin-left: 2px;\n position: absolute;\n top: 5px;\n`;\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,QAAQ,sBAAsB,sBAAsB,UAAU;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable indent */\n/* eslint-disable max-lines */\nimport { styled, safariAndFirefoxBold, onlySafariAndFirefox, th } from '@elliemae/ds-system';\n\nimport type { DSTabsInternalsT } from '../../sharedTypes.js';\nimport { TAB_TYPES } from '../../constants/index.js';\n\ninterface StyledSelectionIndicatoPropsT {\n isDSMobile: boolean;\n tabType: DSTabsInternalsT.TabTypesT;\n}\n\ninterface StyledSubTabsListPropsT {\n withCarousel: boolean;\n}\n\ninterface StyledTabButtonPropsT {\n isActive: boolean;\n disabled: boolean;\n showSeparator: boolean;\n isDSMobile: boolean;\n fixedTabsHeaders: boolean;\n withCarousel: boolean;\n tabType: DSTabsInternalsT.TabTypesT;\n}\n\ninterface StyledTabListPropsT {\n withCarousel: boolean;\n isDSMobile: boolean;\n fixedTabsHeaders: boolean;\n mobileGradients: DSTabsInternalsT.MobileGradientsT;\n indicatorStyle: DSTabsInternalsT.IndicatorStyleT;\n tabType: DSTabsInternalsT.TabTypesT;\n}\n\ninterface StyledMobileGradientPropsT {\n mobileGradients: DSTabsInternalsT.MobileGradientsT;\n left: number | undefined;\n width: number | undefined;\n}\n\ninterface StyledTabWrapperPropsT {\n isDSMobile: boolean;\n fixedTabsHeaders: boolean;\n}\n\nexport const StyledSelectionIndicator = styled.div<StyledSelectionIndicatoPropsT>`\n position: absolute;\n height: ${({ isDSMobile }) => (isDSMobile ? '2px' : '3px')};\n top: ${({ tabType, isDSMobile }) => {\n if (isDSMobile) return `35px`;\n if (tabType === TAB_TYPES.NORMAL_SMALL) return `15px`;\n return `25px`;\n }};\n z-index: 1;\n margin-top: ${({ theme }) => theme.space.xxxs};\n pointer-events: none;\n transition: 200ms cubic-bezier(0.36, 0, 1, 1);\n\n ${({ isDSMobile }) =>\n isDSMobile\n ? ` \n margin-left: 0;\n margin-top: 3px;\n `\n : ``}\n`;\n\nexport const StyledMobileGradient = styled.div.attrs(({ left = 0, width = 0 }: StyledMobileGradientPropsT) => ({\n style: { left: left - 10, maxWidth: width - left },\n}))<StyledMobileGradientPropsT>`\n position: fixed;\n z-index: 15;\n top: 0;\n width: calc(100% + 20px);\n height: 40px;\n pointer-events: none;\n\n ${({ mobileGradients: { left, right } }) => {\n if (right && left)\n return `background: linear-gradient(90deg, #FFFFFF 10px, #FFFFFF00 34px, #FFFFFF00 calc(100% - 44px), #FFFFFF calc(100% - 20px));`;\n if (right)\n return `background: linear-gradient(90deg, #FFFFFF00 0%, #FFFFFF00 calc(100% - 44px), #FFFFFF calc(100% - 20px));`;\n if (left) return `background: linear-gradient(90deg, #FFFFFF 10px, #FFFFFF00 34px, #FFFFFF00 100%);`;\n return '';\n }};\n`;\n\n/** CSS Setters */\n\nexport const StyledTabWrapper = styled.div<StyledTabWrapperPropsT>`\n display: flex;\n flex: 1;\n flex-wrap: nowrap;\n ${({ fixedTabsHeaders, isDSMobile }) => (!fixedTabsHeaders && isDSMobile ? '' : 'overflow-x: hidden;')}\n ${({ theme, isDSMobile }) => (isDSMobile ? `border-bottom: 1px solid ${theme.colors.neutral[200]};` : ``)}\n`;\n\nexport const StyledTabButton = styled.button<StyledTabButtonPropsT>`\n position: relative;\n background-color: transparent;\n border: none;\n cursor: pointer;\n transition: 100ms cubic-bezier(0, 0, 0.42, 1);\n text-transform: ${({ tabType, isDSMobile }) => {\n if (tabType === TAB_TYPES.SUBTABS) return 'capitalize';\n return isDSMobile ? 'none' : 'uppercase';\n }};\n letter-spacing: 0px;\n white-space: nowrap;\n padding: 2px 0;\n margin-right: ${({ fixedTabsHeaders, isDSMobile }) => {\n if (fixedTabsHeaders) return '0px';\n if (!fixedTabsHeaders && isDSMobile) return '14px';\n return '16px';\n }};\n\n margin-left: ${({ fixedTabsHeaders, isDSMobile }) => {\n if (fixedTabsHeaders) return '0px';\n if (!fixedTabsHeaders && isDSMobile) return '14px';\n return '16px';\n }};\n\n color: ${({ theme }) => theme.colors.neutral[700]};\n ${onlySafariAndFirefox('-webkit-text-stroke: 0.4px transparent;')}\n\n ${({ tabType }) => (tabType === TAB_TYPES.NORMAL ? `height: 32px;` : `height: 22px;`)}\n\n ${({ theme, isActive, disabled }) =>\n isActive && !disabled\n ? `\n font-weight: ${theme.fontWeights.semibold};\n ${safariAndFirefoxBold(`#353C46`)}\n\n &:hover {\n ${safariAndFirefoxBold(`#1E79C2`)}\n }\n \n `\n : `\n \n `}\n\n ${({ theme, disabled }) =>\n disabled\n ? `\n color: ${theme.colors.neutral[500]};\n cursor: not-allowed;\n `\n : `\n &:hover {\n color: ${theme.colors.brand[600]};\n }\n `}\n\n ${({ theme }) => `\n &[aria-disabled='true'] {\n color: ${theme.colors.neutral[500]};\n cursor: not-allowed;\n }\n `}\n\n ${({ theme, showSeparator, tabType }) =>\n showSeparator\n ? `\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: ${tabType === TAB_TYPES.SUBTABS ? `10px` : `16px`};\n background: ${theme.colors.neutral[400]};\n }`\n : ``}\n\n ${({ theme, isDSMobile, tabType, isActive }) =>\n !isDSMobile\n ? `\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 ${theme.colors.brand[700]};\n }\n\n ${\n tabType !== TAB_TYPES.SUBTABS && isActive\n ? `\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 }\n \n `\n : ``}\n\n \n \n${({ theme, isActive, disabled, isDSMobile }) =>\n isDSMobile\n ? `\n height: 40px;\n color: ${disabled ? theme.colors.neutral[500] : theme.colors.neutral[700]};\n font-weight: ${theme.fontWeights.regular};\n padding: 0;\n font-size: 16px;\n line-height: 1.3;\n ${String(onlySafariAndFirefox('-webkit-text-stroke: 0.4px transparent;'))} \n\n &:focus {\n font-weight: ${theme.fontWeights.regular};\n ${safariAndFirefoxBold('#006AA9')}\n }\n\n ${\n isActive\n ? `\n font-weight: ${theme.fontWeights.regular};\n ${safariAndFirefoxBold('#006AA9')}\n `\n : ``\n }\n\n ${\n isActive && !disabled\n ? `\n color: ${theme.colors.brand[700]};\n line-height: 1.3;\n font-weight: ${theme.fontWeights.regular};\n -webkit-font-smoothing: subpixel-antialiased; \n -webkit-text-stroke: 0.4px ${theme.colors.brand[700]};`\n : ``\n }\n\n ${\n !disabled\n ? `\n &:hover,\n &:focus {\n outline: none;\n color: ${theme.colors.brand[700]};\n ${safariAndFirefoxBold('#006AA9')}\n }`\n : ``\n }\n\n `\n : ``}\n`;\n\nexport const StyledSubTabsList = styled.div<StyledSubTabsListPropsT>`\n position: relative;\n display: flex;\n flex-wrap: nowrap;\n flex: 1;\n width: 100%;\n ${({ withCarousel }) => (withCarousel ? 'max-width: 100%;' : '')}\n`;\n\nexport const StyledTabList = styled.div<StyledTabListPropsT>`\n position: relative;\n display: flex;\n flex-wrap: nowrap;\n flex: 1;\n width: 100%;\n z-index: 0;\n ${({ withCarousel, isDSMobile }) => (withCarousel && !isDSMobile ? `max-width: 100%;` : '')}\n\n ${({ theme, isDSMobile, tabType }) =>\n tabType !== TAB_TYPES.NORMAL_SMALL && !isDSMobile\n ? `\n &:after {\n content: '';\n position: absolute;\n width: 100%;\n height: 1px;\n box-shadow: 0px 0px 0px 1px ${theme.colors.neutral[400]};\n pointer-events: none;\n bottom: 0px;\n }\n `\n : ``}\n\n ${StyledTabButton} {\n padding-bottom: 0;\n padding-top: 0;\n }\n\n ${({ theme, isDSMobile }) =>\n isDSMobile\n ? `\n \n background: ${theme.colors.neutral['000']};`\n : ``}\n\n ${({ isDSMobile, fixedTabsHeaders }) =>\n isDSMobile\n ? `\n ${\n !fixedTabsHeaders\n ? `\n z-index: 0;\n overflow-x: auto;\n overflow-y: hidden;\n &::-webkit-scrollbar {\n display: none;\n }`\n : `\n display: flex;\n ${StyledTabButton} {\n flex: 1;\n overflow-x: hidden;\n }`\n }`\n : ``}\n\n ${StyledSelectionIndicator} {\n ${({ indicatorStyle }) => `\n width: ${indicatorStyle.width}px;\n left: ${indicatorStyle.left}px;\n `}\n }\n\n ${StyledSelectionIndicator} {\n background: ${(props) => {\n const { theme, indicatorStyle, isDSMobile } = props;\n return !isDSMobile\n ? `linear-gradient(to right, transparent 0px, transparent 16px, ${th.color('brand-600')(\n props,\n )} 16px, ${th.color('brand-600')(props)} ${indicatorStyle.width - 16}px, transparent ${\n indicatorStyle.width - 16\n }px, transparent ${indicatorStyle.width}px )`\n : theme.colors.brand[600];\n }};\n }\n`;\n\nexport const StyledRequiredMark = styled.span`\n color: ${({ theme }) => theme.colors.danger[900]};\n font-size: 6px;\n margin-left: 2px;\n position: absolute;\n top: 5px;\n`;\n\nexport const ScreenReaderOnly = styled.div`\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n height: 1px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,QAAQ,sBAAsB,sBAAsB,UAAU;AAGvE,SAAS,iBAAiB;AAyCnB,MAAM,2BAA2B,OAAO;AAAA;AAAA,YAEnC,CAAC,EAAE,WAAW,MAAO,aAAa,QAAQ,KAAM;AAAA,SACnD,CAAC,EAAE,SAAS,WAAW,MAAM;AAClC,MAAI,WAAY,QAAO;AACvB,MAAI,YAAY,UAAU,aAAc,QAAO;AAC/C,SAAO;AACT,CAAC;AAAA;AAAA,gBAEa,CAAC,EAAE,MAAM,MAAM,MAAM,MAAM,IAAI;AAAA;AAAA;AAAA;AAAA,IAI3C,CAAC,EAAE,WAAW,MACd,aACI;AAAA;AAAA;AAAA,MAIA,EAAE;AAAA;AAGH,MAAM,uBAAuB,OAAO,IAAI,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,EAAE,OAAmC;AAAA,EAC7G,OAAO,EAAE,MAAM,OAAO,IAAI,UAAU,QAAQ,KAAK;AACnD,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQE,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,UAEF,eAAe;AAAA;AAAA;AAAA,UAInB,KACE,EAAE;AAAA;AAAA,IAEN,wBAAwB;AAAA,MACtB,CAAC,EAAE,eAAe,MAAM;AAAA,eACf,eAAe,KAAK;AAAA,cACrB,eAAe,IAAI;AAAA,OAC1B;AAAA;AAAA;AAAA,IAGH,wBAAwB;AAAA,kBACV,CAAC,UAAU;AACvB,QAAM,EAAE,OAAO,gBAAgB,WAAW,IAAI;AAC9C,SAAO,CAAC,aACJ,gEAAgE,GAAG,MAAM,WAAW;AAAA,IAClF;AAAA,EACF,CAAC,UAAU,GAAG,MAAM,WAAW,EAAE,KAAK,CAAC,IAAI,eAAe,QAAQ,EAAE,mBAClE,eAAe,QAAQ,EACzB,mBAAmB,eAAe,KAAK,SACvC,MAAM,OAAO,MAAM,GAAG;AAC5B,CAAC;AAAA;AAAA;AAIE,MAAM,qBAAqB,OAAO;AAAA,WAC9B,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,OAAO,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAO3C,MAAM,mBAAmB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,7 +3,7 @@ import { useCallback, useLayoutEffect, useState, useContext } from "react";
|
|
|
3
3
|
import { useResizeObserver } from "./useResizeObserver.js";
|
|
4
4
|
import { isElementVisible, shouldHaveLeftGradient, shouldHaveRightGradient } from "../../utils/helpers.js";
|
|
5
5
|
import { DSTabsContext } from "../../DSTabsCTX.js";
|
|
6
|
-
import {
|
|
6
|
+
import { DEFAULT_INDICATOR_STYLES } from "../../constants/index.js";
|
|
7
7
|
const useTabBar = () => {
|
|
8
8
|
const {
|
|
9
9
|
actualActiveTab,
|
|
@@ -15,12 +15,12 @@ const useTabBar = () => {
|
|
|
15
15
|
left: false,
|
|
16
16
|
right: false
|
|
17
17
|
});
|
|
18
|
-
const [indicatorStyle, setIndicatorStyle] = useState(
|
|
18
|
+
const [indicatorStyle, setIndicatorStyle] = useState(DEFAULT_INDICATOR_STYLES);
|
|
19
19
|
const getIndicatorStyles = useCallback(() => {
|
|
20
20
|
if (tabsListRef.current) {
|
|
21
21
|
const tabList = tabsListRef.current;
|
|
22
22
|
const activeTabButton = actualActiveTabRef.current;
|
|
23
|
-
if (!activeTabButton || !isElementVisible(activeTabButton, tabList)) return
|
|
23
|
+
if (!activeTabButton || !isElementVisible(activeTabButton, tabList)) return DEFAULT_INDICATOR_STYLES;
|
|
24
24
|
const missingMargins = isDSMobile ? 0 : 16;
|
|
25
25
|
const tabClientWidth = isDSMobile && !fixedTabsHeaders ? activeTabButton.clientWidth : activeTabButton.clientWidth + missingMargins * 2;
|
|
26
26
|
const position = isDSMobile && !fixedTabsHeaders ? activeTabButton.getBoundingClientRect().left - tabList.getBoundingClientRect().left + tabList.scrollLeft : activeTabButton.getBoundingClientRect().left - tabList.getBoundingClientRect().left - missingMargins;
|
|
@@ -29,7 +29,7 @@ const useTabBar = () => {
|
|
|
29
29
|
width: Math.round(tabClientWidth)
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return DEFAULT_INDICATOR_STYLES;
|
|
33
33
|
}, [actualActiveTabRef, fixedTabsHeaders, isDSMobile, tabsListRef]);
|
|
34
34
|
const updateIndicatorStyle = useCallback(
|
|
35
35
|
() => setTimeout(() => setIndicatorStyle(getIndicatorStyles()), 100),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/tabBar/useTabBar.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\nimport { useCallback, useLayoutEffect, useState, useContext } from 'react';\nimport { useResizeObserver } from './useResizeObserver.js';\nimport { isElementVisible, shouldHaveLeftGradient, shouldHaveRightGradient } from '../../utils/helpers.js';\nimport { DSTabsContext } from '../../DSTabsCTX.js';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,aAAa,iBAAiB,UAAU,kBAAkB;AACnE,SAAS,yBAAyB;AAClC,SAAS,kBAAkB,wBAAwB,+BAA+B;AAClF,SAAS,qBAAqB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\nimport { useCallback, useLayoutEffect, useState, useContext } from 'react';\nimport { useResizeObserver } from './useResizeObserver.js';\nimport { isElementVisible, shouldHaveLeftGradient, shouldHaveRightGradient } from '../../utils/helpers.js';\nimport { DSTabsContext } from '../../DSTabsCTX.js';\n\nimport type { DSTabsInternalsT } from '../../sharedTypes.js';\nimport { DEFAULT_INDICATOR_STYLES } from '../../constants/index.js';\n\ninterface UseTabBarReturnTypeT {\n updateIndicatorStyle: () => void;\n updateMobileGradients: () => void;\n setIndicatorStyle: React.Dispatch<React.SetStateAction<DSTabsInternalsT.IndicatorStyleT>>;\n indicatorStyle: DSTabsInternalsT.IndicatorStyleT;\n mobileGradients: DSTabsInternalsT.MobileGradientsT;\n}\n\nexport const useTabBar = (): UseTabBarReturnTypeT => {\n const {\n actualActiveTab,\n actualActiveTabRef,\n tabsListRef,\n props: { showSelectionIndicator, isDSMobile, fixedTabsHeaders },\n } = useContext(DSTabsContext);\n\n const [mobileGradients, setMobileGradients] = useState<DSTabsInternalsT.MobileGradientsT>({\n left: false,\n right: false,\n });\n const [indicatorStyle, setIndicatorStyle] = useState<DSTabsInternalsT.IndicatorStyleT>(DEFAULT_INDICATOR_STYLES);\n\n const getIndicatorStyles = useCallback(() => {\n if (tabsListRef.current) {\n const tabList = tabsListRef.current;\n const activeTabButton = actualActiveTabRef.current;\n\n if (!activeTabButton || !isElementVisible(activeTabButton, tabList)) return DEFAULT_INDICATOR_STYLES;\n\n // The missingMargins are to make the selection indicator white marks work properly in desktop, we need\n // the full width of the tab button with margins.\n const missingMargins = isDSMobile ? 0 : 16;\n\n const tabClientWidth =\n isDSMobile && !fixedTabsHeaders\n ? activeTabButton.clientWidth\n : activeTabButton.clientWidth + missingMargins * 2;\n\n // The reason why we use the tabList.scrollLeft is due to the centerOnTabChange (only in Mobile and FlexibleTabs)\n // behavior that adds scroll to the tabList\n const position =\n isDSMobile && !fixedTabsHeaders\n ? activeTabButton.getBoundingClientRect().left - tabList.getBoundingClientRect().left + tabList.scrollLeft\n : activeTabButton.getBoundingClientRect().left - tabList.getBoundingClientRect().left - missingMargins;\n\n return {\n left: Math.round(position),\n width: Math.round(tabClientWidth),\n };\n }\n return DEFAULT_INDICATOR_STYLES;\n }, [actualActiveTabRef, fixedTabsHeaders, isDSMobile, tabsListRef]);\n\n /** [PUI-15772] - Tabs Pre Refactor\n * Updates indicator style with a delay. It:\n * 1. Uses setTimeout to delay style updates\n * 2. Called on resize and tab changes\n */\n const updateIndicatorStyle = useCallback(\n () => setTimeout(() => setIndicatorStyle(getIndicatorStyles()), 100),\n [getIndicatorStyles, setIndicatorStyle],\n );\n\n useResizeObserver(updateIndicatorStyle, tabsListRef.current);\n useResizeObserver(updateIndicatorStyle, actualActiveTabRef.current);\n\n /** [PUI-15772] - Tabs Pre Refactor\n * Updates mobile gradient visibility. It:\n * 1. Calculates scroll position\n * 2. Updates gradient visibility based on scroll\n */\n const updateMobileGradients = useCallback(() => {\n if (tabsListRef.current && isDSMobile && !fixedTabsHeaders) {\n const { scrollLeft, scrollWidth, clientWidth } = tabsListRef.current;\n setMobileGradients({\n left: shouldHaveLeftGradient(scrollLeft),\n right: shouldHaveRightGradient(scrollLeft, clientWidth, scrollWidth),\n });\n }\n }, [fixedTabsHeaders, isDSMobile, tabsListRef]);\n\n useLayoutEffect(() => {\n if (showSelectionIndicator) {\n updateIndicatorStyle();\n }\n if (isDSMobile && !fixedTabsHeaders) {\n updateMobileGradients();\n }\n }, [\n updateMobileGradients,\n showSelectionIndicator,\n updateIndicatorStyle,\n isDSMobile,\n fixedTabsHeaders,\n actualAct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uB;AAAA,IAC3B,MAAM,WAAW,MAAM,kBAAkB,mBAAmB,CAAC,GAAG,GAAG;AAAA,IACnE,CAAC,oBAAoB,iBAAiB;AAAA,EACxC;AAEA,oBAAkB,sBAAsB,YAAY,OAAO;AAC3D,oBAAkB,sBAAsB,mBAAmB,OAAO;AAOlE,QAAM,wBAAwB,YAAY,MAAM;AAC9C,QAAI,YAAY,WAAW,cAAc,CAAC,kBAAkB;AAC1D,YAAM,EAAE,YAAY,aAAa,YAAY,IAAI,YAAY;AAC7D,yBAAmB;AAAA,QACjB,MAAM,uBAAuB,UAAU;AAAA,QACvC,OAAO,wBAAwB,YAAY,aAAa,WAAW;AAAA,MACrE,CAAC;AAAA,IACH;AAAA,EACF,GAAG,CAAC,kBAAkB,YAAY,WAAW,CAAC;AAE9C,kBAAgB,MAAM;AACpB,QAAI,wBAAwB;AAC1B,2BAAqB;AAAA,IACvB;AACA,QAAI,cAAc,CAAC,kBAAkB;AACnC,4BAAsB;AAAA,IACxB;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -6,7 +6,7 @@ import { TabsPanels } from "../tabsPanel/TabsPanels.js";
|
|
|
6
6
|
import { TabBar } from "../tabBar/TabBar.js";
|
|
7
7
|
import { StyledTabBarContainer } from "./styles.js";
|
|
8
8
|
import { DSTabsContext } from "../../DSTabsCTX.js";
|
|
9
|
-
import {
|
|
9
|
+
import { TABS_DATA_TESTID } from "../../constants/index.js";
|
|
10
10
|
const TabsContent = () => {
|
|
11
11
|
const {
|
|
12
12
|
props,
|
|
@@ -21,7 +21,7 @@ const TabsContent = () => {
|
|
|
21
21
|
...xstyledProps,
|
|
22
22
|
...containerProps,
|
|
23
23
|
ref: innerRef,
|
|
24
|
-
"data-testid":
|
|
24
|
+
"data-testid": TABS_DATA_TESTID.TABS_CONTAINER,
|
|
25
25
|
children: [
|
|
26
26
|
/* @__PURE__ */ jsxs(StyledTabBarContainer, { "aria-label": tabsListAriaLabel, children: [
|
|
27
27
|
/* @__PURE__ */ jsx(TabBar, {}),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/tabsContent/TabsContent.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { TabsPanels } from '../tabsPanel/TabsPanels.js';\nimport { TabBar } from '../tabBar/TabBar.js';\nimport { StyledTabBarContainer } from './styles.js';\nimport { DSTabsContext } from '../../DSTabsCTX.js';\nimport {
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { TabsPanels } from '../tabsPanel/TabsPanels.js';\nimport { TabBar } from '../tabBar/TabBar.js';\nimport { StyledTabBarContainer } from './styles.js';\nimport { DSTabsContext } from '../../DSTabsCTX.js';\nimport { TABS_DATA_TESTID } from '../../constants/index.js';\n\nexport const TabsContent = (): JSX.Element => {\n const {\n props,\n props: { containerProps, innerRef, tabsListAriaLabel, tabBarExtraContent, TabBarExtraContent },\n } = useContext(DSTabsContext);\n\n const globalProps = useGetGlobalAttributes(props);\n const xstyledProps = useGetXstyledProps(props);\n\n return (\n <div\n {...globalProps}\n {...xstyledProps}\n {...containerProps}\n ref={innerRef}\n data-testid={TABS_DATA_TESTID.TABS_CONTAINER}\n >\n <StyledTabBarContainer aria-label={tabsListAriaLabel}>\n <TabBar />\n {TabBarExtraContent ? <TabBarExtraContent /> : null}\n {tabBarExtraContent || null}\n </StyledTabBarContainer>\n <TabsPanels />\n </div>\n );\n};\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACyBjB,SACE,KADF;AAzBN,SAAgB,kBAAkB;AAClC,SAAS,wBAAwB,0BAA0B;AAC3D,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,6BAA6B;AACtC,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AAE1B,MAAM,cAAc,MAAmB;AAC5C,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,gBAAgB,UAAU,mBAAmB,oBAAoB,mBAAmB;AAAA,EAC/F,IAAI,WAAW,aAAa;AAE5B,QAAM,cAAc,uBAAuB,KAAK;AAChD,QAAM,eAAe,mBAAmB,KAAK;AAE7C,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACJ,KAAK;AAAA,MACL,eAAa,iBAAiB;AAAA,MAE9B;AAAA,6BAAC,yBAAsB,cAAY,mBACjC;AAAA,8BAAC,UAAO;AAAA,UACP,qBAAqB,oBAAC,sBAAmB,IAAK;AAAA,UAC9C,sBAAsB;AAAA,WACzB;AAAA,QACA,oBAAC,cAAW;AAAA;AAAA;AAAA,EACd;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|