@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.
- package/cjs/DSTabs.js +40 -58
- package/cjs/DSTabsCTX.js +25 -51
- package/cjs/DSTabsDatatestid.js +14 -42
- package/cjs/DSTabsTypes.js +2 -27
- package/cjs/config/useCrossRef.js +11 -38
- package/cjs/config/useTabs.js +36 -53
- package/cjs/defaultProps.js +13 -39
- package/cjs/exportsRelated/DSTab.js +32 -46
- package/cjs/index.js +17 -38
- package/cjs/parts/carousel/Carousel.js +53 -61
- package/cjs/parts/carousel/styles.js +63 -77
- package/cjs/parts/carousel/useCarousel.js +49 -51
- package/cjs/parts/carousel/useCarouselCallbacks.js +36 -53
- package/cjs/parts/tabBar/TabBar.js +120 -124
- package/cjs/parts/tabBar/styles.js +195 -289
- package/cjs/parts/tabBar/useTabBar.js +55 -67
- package/cjs/parts/tabsContent/TabsContent.js +45 -49
- package/cjs/parts/tabsContent/styles.js +15 -39
- package/cjs/parts/tabsPanel/TabsPanels.js +58 -60
- package/cjs/parts/tabsPanel/styles.js +23 -43
- package/cjs/propTypes.js +29 -54
- package/cjs/utils/constants.js +16 -44
- package/cjs/utils/helpers.js +22 -46
- package/cjs/utils/hooks/useKeyboardNavigation.js +43 -59
- package/cjs/utils/hooks/useTabsCallbacks.js +33 -49
- package/esm/DSTabs.js +25 -24
- package/esm/DSTabsCTX.js +20 -22
- package/esm/DSTabsDatatestid.js +10 -13
- package/esm/DSTabsTypes.js +1 -2
- package/esm/config/useCrossRef.js +4 -6
- package/esm/config/useTabs.js +22 -14
- package/esm/defaultProps.js +8 -9
- package/esm/exportsRelated/DSTab.js +19 -15
- package/esm/index.js +4 -9
- package/esm/parts/carousel/Carousel.js +38 -25
- package/esm/parts/carousel/styles.js +52 -48
- package/esm/parts/carousel/useCarousel.js +34 -15
- package/esm/parts/carousel/useCarouselCallbacks.js +28 -20
- package/esm/parts/tabBar/TabBar.js +102 -93
- package/esm/parts/tabBar/styles.js +183 -262
- package/esm/parts/tabBar/useTabBar.js +36 -27
- package/esm/parts/tabsContent/TabsContent.js +35 -19
- package/esm/parts/tabsContent/styles.js +7 -10
- package/esm/parts/tabsPanel/TabsPanels.js +45 -28
- package/esm/parts/tabsPanel/styles.js +15 -14
- package/esm/propTypes.js +24 -25
- package/esm/utils/constants.js +8 -15
- package/esm/utils/helpers.js +11 -16
- package/esm/utils/hooks/useKeyboardNavigation.js +39 -30
- package/esm/utils/hooks/useTabsCallbacks.js +27 -18
- package/package.json +6 -6
- package/types/DSTabs.d.ts +2 -2
- package/cjs/DSTabs.js.map +0 -7
- package/cjs/DSTabsCTX.js.map +0 -7
- package/cjs/DSTabsDatatestid.js.map +0 -7
- package/cjs/DSTabsTypes.js.map +0 -7
- package/cjs/config/useCrossRef.js.map +0 -7
- package/cjs/config/useTabs.js.map +0 -7
- package/cjs/defaultProps.js.map +0 -7
- package/cjs/exportsRelated/DSTab.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/parts/carousel/Carousel.js.map +0 -7
- package/cjs/parts/carousel/styles.js.map +0 -7
- package/cjs/parts/carousel/useCarousel.js.map +0 -7
- package/cjs/parts/carousel/useCarouselCallbacks.js.map +0 -7
- package/cjs/parts/tabBar/TabBar.js.map +0 -7
- package/cjs/parts/tabBar/styles.js.map +0 -7
- package/cjs/parts/tabBar/useTabBar.js.map +0 -7
- package/cjs/parts/tabsContent/TabsContent.js.map +0 -7
- package/cjs/parts/tabsContent/styles.js.map +0 -7
- package/cjs/parts/tabsPanel/TabsPanels.js.map +0 -7
- package/cjs/parts/tabsPanel/styles.js.map +0 -7
- package/cjs/propTypes.js.map +0 -7
- package/cjs/utils/constants.js.map +0 -7
- package/cjs/utils/helpers.js.map +0 -7
- package/cjs/utils/hooks/useKeyboardNavigation.js.map +0 -7
- package/cjs/utils/hooks/useTabsCallbacks.js.map +0 -7
- package/esm/DSTabs.js.map +0 -7
- package/esm/DSTabsCTX.js.map +0 -7
- package/esm/DSTabsDatatestid.js.map +0 -7
- package/esm/DSTabsTypes.js.map +0 -7
- package/esm/config/useCrossRef.js.map +0 -7
- package/esm/config/useTabs.js.map +0 -7
- package/esm/defaultProps.js.map +0 -7
- package/esm/exportsRelated/DSTab.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/parts/carousel/Carousel.js.map +0 -7
- package/esm/parts/carousel/styles.js.map +0 -7
- package/esm/parts/carousel/useCarousel.js.map +0 -7
- package/esm/parts/carousel/useCarouselCallbacks.js.map +0 -7
- package/esm/parts/tabBar/TabBar.js.map +0 -7
- package/esm/parts/tabBar/styles.js.map +0 -7
- package/esm/parts/tabBar/useTabBar.js.map +0 -7
- package/esm/parts/tabsContent/TabsContent.js.map +0 -7
- package/esm/parts/tabsContent/styles.js.map +0 -7
- package/esm/parts/tabsPanel/TabsPanels.js.map +0 -7
- package/esm/parts/tabsPanel/styles.js.map +0 -7
- package/esm/propTypes.js.map +0 -7
- package/esm/utils/constants.js.map +0 -7
- package/esm/utils/helpers.js.map +0 -7
- package/esm/utils/hooks/useKeyboardNavigation.js.map +0 -7
- package/esm/utils/hooks/useTabsCallbacks.js.map +0 -7
|
@@ -1,265 +1,186 @@
|
|
|
1
|
-
import
|
|
2
|
-
import styled from
|
|
3
|
-
import {
|
|
4
|
-
import { TabTypes } from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}}
|
|
36
|
-
`;
|
|
37
|
-
const StyledTabWrapper = styled.div`
|
|
38
|
-
display: flex;
|
|
39
|
-
flex: 1;
|
|
40
|
-
flex-wrap: nowrap;
|
|
41
|
-
${({ fixedTabsHeaders, isDSMobile }) => !fixedTabsHeaders && isDSMobile ? "" : "overflow-x: hidden;"}
|
|
42
|
-
${({ theme, isDSMobile }) => isDSMobile ? `border-bottom: 1px solid ${theme.colors.brand[300]};` : ``}
|
|
43
|
-
`;
|
|
44
|
-
const StyledTabButton = styled.button`
|
|
45
|
-
position: relative;
|
|
46
|
-
background-color: transparent;
|
|
47
|
-
border: none;
|
|
48
|
-
cursor: pointer;
|
|
49
|
-
transition: 100ms cubic-bezier(0, 0, 0.42, 1);
|
|
50
|
-
text-transform: ${({ tabType }) => tabType === TabTypes.SUBTABS ? `capitalize` : `uppercase`};
|
|
51
|
-
letter-spacing: 0px;
|
|
52
|
-
white-space: nowrap;
|
|
53
|
-
padding: 2px 0;
|
|
54
|
-
margin-right: ${({ fixedTabsHeaders, isDSMobile }) => {
|
|
55
|
-
if (fixedTabsHeaders)
|
|
56
|
-
return "0px";
|
|
57
|
-
if (!fixedTabsHeaders && isDSMobile)
|
|
58
|
-
return "14px";
|
|
59
|
-
return "16px";
|
|
60
|
-
}};
|
|
61
|
-
|
|
62
|
-
margin-left: ${({ fixedTabsHeaders, isDSMobile }) => {
|
|
63
|
-
if (fixedTabsHeaders)
|
|
64
|
-
return "0px";
|
|
65
|
-
if (!fixedTabsHeaders && isDSMobile)
|
|
66
|
-
return "14px";
|
|
67
|
-
return "16px";
|
|
68
|
-
}};
|
|
69
|
-
|
|
70
|
-
color: ${({ theme }) => theme.colors.neutral[700]};
|
|
71
|
-
${onlySafariAndFirefox("-webkit-text-stroke: 0.4px transparent;")}
|
|
72
|
-
|
|
73
|
-
${({ tabType }) => tabType === TabTypes.NORMAL ? `height: 32px;` : `height: 22px;`}
|
|
74
|
-
|
|
75
|
-
${({ theme, isActive, disabled }) => isActive && !disabled ? `
|
|
76
|
-
font-weight: ${theme.fontWeights.semibold};
|
|
77
|
-
${safariAndFirefoxBold(`#353C46`)}
|
|
78
|
-
|
|
79
|
-
&:hover {
|
|
80
|
-
${safariAndFirefoxBold(`#1E79C2`)}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
` : `
|
|
84
|
-
|
|
85
|
-
`}
|
|
86
|
-
|
|
87
|
-
${({ theme, disabled }) => disabled ? `
|
|
88
|
-
color: ${theme.colors.neutral[500]};
|
|
89
|
-
cursor: not-allowed;
|
|
90
|
-
` : `
|
|
91
|
-
&:hover {
|
|
92
|
-
color: ${theme.colors.brand[600]};
|
|
93
|
-
}
|
|
94
|
-
`}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
${({ theme, showSeparator, tabType }) => showSeparator ? `
|
|
98
|
-
&:not(:last-of-type):before
|
|
99
|
-
{
|
|
100
|
-
content: "";
|
|
101
|
-
position: absolute;
|
|
102
|
-
width: 1px;
|
|
103
|
-
right: -16px;
|
|
104
|
-
top: 50%;
|
|
105
|
-
transform: translateY(-50%);
|
|
106
|
-
height: ${tabType === TabTypes.SUBTABS ? `10px` : `16px`};
|
|
107
|
-
background: ${theme.colors.neutral[400]};
|
|
108
|
-
}` : ``}
|
|
109
|
-
|
|
110
|
-
${({ theme, isDSMobile, tabType, isActive }) => !isDSMobile ? `
|
|
111
|
-
&:focus {
|
|
112
|
-
outline: none;
|
|
113
|
-
&:after {
|
|
114
|
-
position: absolute;
|
|
115
|
-
content: '';
|
|
116
|
-
top: 0;
|
|
117
|
-
left: -16px;
|
|
118
|
-
width: calc(100% + 32px);
|
|
119
|
-
height: 100%;
|
|
120
|
-
z-index: 5;
|
|
121
|
-
border-radius: 2px;
|
|
122
|
-
border: 2px solid ${theme.colors.brand[700]};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
${tabType !== TabTypes.SUBTABS && isActive ? `
|
|
126
|
-
&:before {
|
|
127
|
-
position: absolute;
|
|
128
|
-
content: '';
|
|
129
|
-
left: -16px;
|
|
130
|
-
right: 0;
|
|
131
|
-
top: calc(100% - 2px);
|
|
132
|
-
transform: none;
|
|
133
|
-
width: calc(100% + 32px);
|
|
134
|
-
height: 2px;
|
|
135
|
-
z-index: 10;
|
|
136
|
-
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%);
|
|
137
|
-
}
|
|
138
|
-
` : ``}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
` : ``}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
${({ theme, isActive, disabled, isDSMobile }) => isDSMobile ? `
|
|
146
|
-
height: 40px;
|
|
147
|
-
color: ${theme.colors.brand[600]};
|
|
148
|
-
font-weight: ${theme.fontWeights.regular};
|
|
149
|
-
padding: 0;
|
|
150
|
-
font-size: 13px;
|
|
151
|
-
line-height: 1.3;
|
|
152
|
-
${onlySafariAndFirefox("-webkit-text-stroke: 0.4px transparent;")}
|
|
153
|
-
|
|
154
|
-
&:focus {
|
|
155
|
-
font-weight: ${theme.fontWeights.regular};
|
|
156
|
-
font-size: 13px;
|
|
157
|
-
${safariAndFirefoxBold("#006AA9")}
|
|
158
|
-
}
|
|
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;
|
|
159
35
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
` : ``}
|
|
165
|
-
|
|
166
|
-
${isActive && !disabled ? `
|
|
167
|
-
font-size: 13px;
|
|
168
|
-
color: ${theme.colors.brand[700]};
|
|
169
|
-
line-height: 1.3;
|
|
170
|
-
font-weight: ${theme.fontWeights.regular};
|
|
171
|
-
-webkit-font-smoothing: subpixel-antialiased;
|
|
172
|
-
-webkit-text-stroke: 0.4px ${theme.colors.brand[700]};` : ``}
|
|
173
|
-
|
|
174
|
-
${!disabled ? `
|
|
175
|
-
&:hover,
|
|
176
|
-
&:focus {
|
|
177
|
-
outline: none;
|
|
178
|
-
color: ${theme.colors.brand[700]};
|
|
179
|
-
${safariAndFirefoxBold("#006AA9")}
|
|
180
|
-
}` : ``}
|
|
181
|
-
|
|
182
|
-
` : ``}
|
|
183
|
-
`;
|
|
184
|
-
const StyledSubTabsList = styled.div`
|
|
185
|
-
position: relative;
|
|
186
|
-
display: flex;
|
|
187
|
-
flex-wrap: nowrap;
|
|
188
|
-
flex: 1;
|
|
189
|
-
width: 100%;
|
|
190
|
-
${({ withCarousel }) => withCarousel ? "max-width: 100%;" : ""}
|
|
191
|
-
`;
|
|
192
|
-
const StyledTabList = styled.div`
|
|
193
|
-
position: relative;
|
|
194
|
-
display: flex;
|
|
195
|
-
flex-wrap: nowrap;
|
|
196
|
-
flex: 1;
|
|
197
|
-
width: 100%;
|
|
198
|
-
${({ withCarousel, isDSMobile }) => withCarousel && !isDSMobile ? `max-width: 100%;` : ""}
|
|
199
|
-
|
|
200
|
-
${({ theme, isDSMobile, tabType }) => tabType !== TabTypes.NORMAL_SMALL && !isDSMobile ? `
|
|
201
|
-
&:after {
|
|
202
|
-
content: '';
|
|
203
|
-
position: absolute;
|
|
204
|
-
width: 100%;
|
|
205
|
-
height: 1px;
|
|
206
|
-
box-shadow: 0px 0px 0px 1px ${theme.colors.neutral[400]};
|
|
207
|
-
pointer-events: none;
|
|
208
|
-
bottom: 0px;
|
|
209
|
-
}
|
|
210
|
-
` : ``}
|
|
211
|
-
|
|
212
|
-
${StyledTabButton} {
|
|
213
|
-
padding-bottom: 0;
|
|
214
|
-
padding-top: 0;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
${({ theme, isDSMobile }) => isDSMobile ? `
|
|
218
|
-
|
|
219
|
-
background: ${theme.colors.brand[200]};` : ``}
|
|
220
|
-
|
|
221
|
-
${mobileGradientsSettings}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
${({ isDSMobile, fixedTabsHeaders }) => isDSMobile ? `
|
|
225
|
-
${!fixedTabsHeaders ? `
|
|
226
|
-
z-index: 0;
|
|
227
|
-
overflow-x: auto;
|
|
228
|
-
overflow-y: hidden;
|
|
229
|
-
scrollbar-width: thin;
|
|
230
|
-
&::-webkit-scrollbar {
|
|
231
|
-
display: none;
|
|
232
|
-
}` : `
|
|
233
|
-
display: flex;
|
|
234
|
-
${StyledTabButton} {
|
|
235
|
-
flex: 1;
|
|
236
|
-
overflow-x: hidden;
|
|
237
|
-
}`}` : ``}
|
|
238
|
-
|
|
239
|
-
${StyledSelectionIndicator} {
|
|
240
|
-
${({ indicatorStyle }) => `
|
|
241
|
-
width: ${indicatorStyle.width};
|
|
242
|
-
left: ${indicatorStyle.left};
|
|
243
|
-
`}
|
|
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%);");
|
|
244
40
|
}
|
|
245
41
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
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 };
|
|
@@ -1,41 +1,57 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import useResizeObserver from
|
|
4
|
-
import { isElementVisible, shouldHaveLeftGradient, shouldHaveRightGradient } from
|
|
5
|
-
import { DSTabsContext } from
|
|
6
|
-
import { defaultIndicatorStyles } from
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
|
+
import { useContext, useState, useCallback, useEffect, useLayoutEffect } from 'react';
|
|
3
|
+
import useResizeObserver from '@react-hook/resize-observer';
|
|
4
|
+
import { isElementVisible, shouldHaveLeftGradient, shouldHaveRightGradient } from '../../utils/helpers.js';
|
|
5
|
+
import { DSTabsContext } from '../../DSTabsCTX.js';
|
|
6
|
+
import { defaultIndicatorStyles } from '../../utils/constants.js';
|
|
7
|
+
|
|
7
8
|
const useTabBar = () => {
|
|
8
9
|
const {
|
|
9
10
|
actualActiveTab,
|
|
10
11
|
actualActiveTabRef,
|
|
11
12
|
tabsListRef,
|
|
12
|
-
props: {
|
|
13
|
+
props: {
|
|
14
|
+
showSelectionIndicator,
|
|
15
|
+
isDSMobile,
|
|
16
|
+
fixedTabsHeaders
|
|
17
|
+
}
|
|
13
18
|
} = useContext(DSTabsContext);
|
|
14
|
-
const [mobileGradients, setMobileGradients] = useState({
|
|
19
|
+
const [mobileGradients, setMobileGradients] = useState({
|
|
20
|
+
left: false,
|
|
21
|
+
right: false
|
|
22
|
+
});
|
|
15
23
|
const [indicatorStyle, setIndicatorStyle] = useState(defaultIndicatorStyles);
|
|
16
24
|
const getIndicatorStyles = useCallback(() => {
|
|
17
25
|
if (tabsListRef.current) {
|
|
18
26
|
const tabList = tabsListRef.current;
|
|
19
27
|
const activeTabButton = actualActiveTabRef.current;
|
|
20
|
-
if (!activeTabButton || !isElementVisible(activeTabButton, tabList))
|
|
21
|
-
|
|
28
|
+
if (!activeTabButton || !isElementVisible(activeTabButton, tabList)) return defaultIndicatorStyles; // The missingMargins are to make the selection indicator white marks work properly in desktop, we need
|
|
29
|
+
// the full width of the tab button with margins.
|
|
30
|
+
|
|
22
31
|
const missingMargins = isDSMobile ? 0 : 16;
|
|
23
|
-
const tabClientWidth = isDSMobile && !fixedTabsHeaders ? activeTabButton.clientWidth : activeTabButton.clientWidth + missingMargins * 2;
|
|
32
|
+
const tabClientWidth = isDSMobile && !fixedTabsHeaders ? activeTabButton.clientWidth : activeTabButton.clientWidth + missingMargins * 2; // The reason why we use the tabList.scrollLeft is due to the centerOnTabChange (only in Mobile and FlexibleTabs)
|
|
33
|
+
// behavior that adds scroll to the tabList
|
|
34
|
+
|
|
24
35
|
const position = isDSMobile && !fixedTabsHeaders ? activeTabButton.getBoundingClientRect().left - tabList.getBoundingClientRect().left + tabList.scrollLeft : activeTabButton.getBoundingClientRect().left - tabList.getBoundingClientRect().left - missingMargins;
|
|
25
|
-
const backgroundWithTransparent =
|
|
36
|
+
const backgroundWithTransparent = "linear-gradient(to right, transparent 0px, transparent 16px, #1E79C2 16px, #1E79C2 ".concat(tabClientWidth - 16, "px,transparent ").concat(tabClientWidth - 16, "px,transparent ").concat(tabClientWidth, "px )");
|
|
26
37
|
return {
|
|
27
|
-
left:
|
|
28
|
-
width:
|
|
38
|
+
left: "".concat(position, "px"),
|
|
39
|
+
width: "".concat(tabClientWidth, "px"),
|
|
29
40
|
backgroundWithTransparent
|
|
30
41
|
};
|
|
31
42
|
}
|
|
43
|
+
|
|
32
44
|
return defaultIndicatorStyles;
|
|
33
45
|
}, [actualActiveTabRef, fixedTabsHeaders, isDSMobile, tabsListRef]);
|
|
34
46
|
const updateIndicatorStyle = useCallback(() => setTimeout(() => setIndicatorStyle(getIndicatorStyles()), 100), [getIndicatorStyles, setIndicatorStyle]);
|
|
35
47
|
useResizeObserver(tabsListRef, updateIndicatorStyle);
|
|
36
48
|
const updateMobileGradients = useCallback(() => {
|
|
37
49
|
if (tabsListRef.current && isDSMobile && !fixedTabsHeaders) {
|
|
38
|
-
const {
|
|
50
|
+
const {
|
|
51
|
+
scrollLeft,
|
|
52
|
+
scrollWidth,
|
|
53
|
+
clientWidth
|
|
54
|
+
} = tabsListRef.current;
|
|
39
55
|
setMobileGradients({
|
|
40
56
|
left: shouldHaveLeftGradient(scrollLeft),
|
|
41
57
|
right: shouldHaveRightGradient(scrollLeft, clientWidth, scrollWidth)
|
|
@@ -46,21 +62,16 @@ const useTabBar = () => {
|
|
|
46
62
|
if (showSelectionIndicator) {
|
|
47
63
|
updateIndicatorStyle();
|
|
48
64
|
}
|
|
65
|
+
|
|
49
66
|
if (isDSMobile && !fixedTabsHeaders) {
|
|
50
67
|
updateMobileGradients();
|
|
51
68
|
}
|
|
52
|
-
}, [
|
|
53
|
-
updateIndicatorStyle,
|
|
54
|
-
showSelectionIndicator,
|
|
55
|
-
actualActiveTab,
|
|
56
|
-
updateMobileGradients,
|
|
57
|
-
isDSMobile,
|
|
58
|
-
fixedTabsHeaders
|
|
59
|
-
]);
|
|
69
|
+
}, [updateIndicatorStyle, showSelectionIndicator, actualActiveTab, updateMobileGradients, isDSMobile, fixedTabsHeaders]);
|
|
60
70
|
useLayoutEffect(() => {
|
|
61
71
|
if (showSelectionIndicator) {
|
|
62
72
|
updateIndicatorStyle();
|
|
63
73
|
}
|
|
74
|
+
|
|
64
75
|
if (isDSMobile && !fixedTabsHeaders) {
|
|
65
76
|
updateMobileGradients();
|
|
66
77
|
}
|
|
@@ -73,7 +84,5 @@ const useTabBar = () => {
|
|
|
73
84
|
updateMobileGradients
|
|
74
85
|
};
|
|
75
86
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
};
|
|
79
|
-
//# sourceMappingURL=useTabBar.js.map
|
|
87
|
+
|
|
88
|
+
export { useTabBar };
|
|
@@ -1,24 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
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 _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
+
import { useContext } from 'react';
|
|
9
|
+
import { TabsPanels } from '../tabsPanel/TabsPanels.js';
|
|
10
|
+
import { TabBar } from '../tabBar/TabBar.js';
|
|
11
|
+
import { StyledTabBarContainer } from './styles.js';
|
|
12
|
+
import { DSTabsContext } from '../../DSTabsCTX.js';
|
|
13
|
+
import { DSTabsDatatestid } from '../../DSTabsDatatestid.js';
|
|
14
|
+
import { jsxs } from 'react/jsx-runtime';
|
|
15
|
+
|
|
16
|
+
var _TabBar, _TabsPanels;
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
8
21
|
const TabsContent = () => {
|
|
9
22
|
const {
|
|
10
|
-
props: {
|
|
23
|
+
props: {
|
|
24
|
+
containerProps,
|
|
25
|
+
innerRef,
|
|
26
|
+
tabsListAriaLabel,
|
|
27
|
+
tabBarExtraContent
|
|
28
|
+
}
|
|
11
29
|
} = useContext(DSTabsContext);
|
|
12
|
-
return
|
|
13
|
-
...containerProps,
|
|
30
|
+
return /*#__PURE__*/jsxs("div", _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
14
31
|
ref: innerRef,
|
|
15
|
-
"data-testid": DSTabsDatatestid.TABS_CONTAINER
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
32
|
+
"data-testid": DSTabsDatatestid.TABS_CONTAINER,
|
|
33
|
+
children: [/*#__PURE__*/_jsx(StyledTabBarContainer, {
|
|
34
|
+
"aria-label": tabsListAriaLabel,
|
|
35
|
+
role: "tablist"
|
|
36
|
+
}, void 0, _TabBar || (_TabBar = /*#__PURE__*/_jsx(TabBar, {})), tabBarExtraContent), _TabsPanels || (_TabsPanels = /*#__PURE__*/_jsx(TabsPanels, {}))]
|
|
37
|
+
}));
|
|
20
38
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=TabsContent.js.map
|
|
39
|
+
|
|
40
|
+
export { TabsContent };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const StyledTabBarContainer = styled.div
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
StyledTabBarContainer
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=styles.js.map
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
const StyledTabBarContainer = /*#__PURE__*/styled.div.withConfig({
|
|
4
|
+
componentId: "sc-vm3k1y-0"
|
|
5
|
+
})(["display:flex;overflow-x:hidden;"]);
|
|
6
|
+
|
|
7
|
+
export { StyledTabBarContainer };
|