@elliemae/ds-tabs 2.3.0-alpha.9 → 2.3.0-next.11
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 +45 -0
- package/cjs/DSTabsCTX.js +30 -0
- package/cjs/DSTabsDatatestid.js +18 -0
- package/cjs/DSTabsTypes.js +2 -0
- package/cjs/config/useCrossRef.js +17 -0
- package/cjs/config/useTabs.js +54 -0
- package/cjs/defaultProps.js +27 -0
- package/cjs/exportsRelated/DSTab.js +32 -0
- package/cjs/index.js +17 -0
- package/cjs/parts/carousel/Carousel.js +69 -0
- package/cjs/parts/carousel/styles.js +65 -0
- package/cjs/parts/carousel/useCarousel.js +78 -0
- package/cjs/parts/carousel/useCarouselCallbacks.js +72 -0
- package/cjs/parts/tabBar/TabBar.js +168 -0
- package/cjs/parts/tabBar/styles.js +200 -0
- package/cjs/parts/tabBar/useTabBar.js +87 -0
- package/cjs/parts/tabsContent/TabsContent.js +49 -0
- package/cjs/parts/tabsContent/styles.js +15 -0
- package/cjs/parts/tabsPanel/TabsPanels.js +102 -0
- package/cjs/parts/tabsPanel/styles.js +25 -0
- package/cjs/propTypes.js +33 -0
- package/cjs/utils/constants.js +28 -0
- package/cjs/utils/helpers.js +71 -0
- package/cjs/utils/hooks/useKeyboardNavigation.js +61 -0
- package/cjs/utils/hooks/useTabsCallbacks.js +41 -0
- package/esm/DSTabs.js +35 -0
- package/esm/DSTabsCTX.js +25 -0
- package/esm/DSTabsDatatestid.js +14 -0
- package/esm/DSTabsTypes.js +1 -0
- package/{dist/esm → esm}/config/useCrossRef.js +4 -6
- package/esm/config/useTabs.js +50 -0
- package/{dist/esm → esm}/defaultProps.js +8 -9
- package/esm/exportsRelated/DSTab.js +21 -0
- package/esm/index.js +4 -0
- package/esm/parts/carousel/Carousel.js +61 -0
- package/esm/parts/carousel/styles.js +54 -0
- package/{dist/esm → esm}/parts/carousel/useCarousel.js +34 -15
- package/{dist/esm → esm}/parts/carousel/useCarouselCallbacks.js +28 -20
- package/esm/parts/tabBar/TabBar.js +159 -0
- package/esm/parts/tabBar/styles.js +186 -0
- package/{dist/esm → esm}/parts/tabBar/useTabBar.js +35 -27
- package/esm/parts/tabsContent/TabsContent.js +40 -0
- package/esm/parts/tabsContent/styles.js +7 -0
- package/esm/parts/tabsPanel/TabsPanels.js +92 -0
- package/esm/parts/tabsPanel/styles.js +17 -0
- package/esm/propTypes.js +28 -0
- package/esm/utils/constants.js +20 -0
- package/{dist/esm → esm}/utils/helpers.js +26 -23
- package/esm/utils/hooks/useKeyboardNavigation.js +57 -0
- package/esm/utils/hooks/useTabsCallbacks.js +37 -0
- package/package.json +70 -72
- package/{dist/types → types}/DSTabs.d.ts +2 -2
- package/{dist/types → types}/DSTabsCTX.d.ts +0 -0
- package/{dist/types → types}/DSTabsDatatestid.d.ts +0 -0
- package/{dist/types → types}/DSTabsTypes.d.ts +0 -0
- package/{dist/types → types}/config/useCrossRef.d.ts +0 -0
- package/{dist/types → types}/config/useTabs.d.ts +0 -0
- package/{dist/types → types}/defaultProps.d.ts +0 -0
- package/{dist/types → types}/exportsRelated/DSTab.d.ts +0 -0
- package/{dist/types → types}/index.d.ts +0 -0
- package/{dist/types → types}/parts/carousel/Carousel.d.ts +0 -0
- package/{dist/types → types}/parts/carousel/styles.d.ts +1 -4
- package/{dist/types → types}/parts/carousel/useCarousel.d.ts +0 -0
- package/{dist/types → types}/parts/carousel/useCarouselCallbacks.d.ts +0 -0
- package/{dist/types → types}/parts/tabBar/TabBar.d.ts +0 -0
- package/{dist/types → types}/parts/tabBar/styles.d.ts +0 -0
- package/{dist/types → types}/parts/tabBar/useTabBar.d.ts +0 -0
- package/{dist/types → types}/parts/tabsContent/TabsContent.d.ts +0 -0
- package/{dist/types → types}/parts/tabsContent/styles.d.ts +0 -0
- package/{dist/types → types}/parts/tabsPanel/TabsPanels.d.ts +0 -0
- package/{dist/types → types}/parts/tabsPanel/styles.d.ts +0 -0
- package/{dist/types → types}/propTypes.d.ts +0 -0
- package/{dist/types → types}/tests/DSTabs.callbacks.test.d.ts +0 -0
- package/{dist/types → types}/tests/DSTabs.func.test.d.ts +0 -0
- package/{dist/types → types}/tests/DSTabs.keyboard.test.d.ts +0 -0
- package/{dist/types → types}/tests/DSTabs.test.d.ts +0 -0
- package/{dist/types → types}/utils/constants.d.ts +0 -0
- package/{dist/types → types}/utils/helpers.d.ts +1 -3
- package/{dist/types → types}/utils/hooks/useKeyboardNavigation.d.ts +0 -0
- package/{dist/types → types}/utils/hooks/useTabsCallbacks.d.ts +0 -0
- package/dist/cjs/DSTabs.js +0 -63
- package/dist/cjs/DSTabs.js.map +0 -7
- package/dist/cjs/DSTabsCTX.js +0 -56
- package/dist/cjs/DSTabsCTX.js.map +0 -7
- package/dist/cjs/DSTabsDatatestid.js +0 -46
- package/dist/cjs/DSTabsDatatestid.js.map +0 -7
- package/dist/cjs/DSTabsTypes.js +0 -27
- package/dist/cjs/DSTabsTypes.js.map +0 -7
- package/dist/cjs/config/useCrossRef.js +0 -44
- package/dist/cjs/config/useCrossRef.js.map +0 -7
- package/dist/cjs/config/useTabs.js +0 -68
- package/dist/cjs/config/useTabs.js.map +0 -7
- package/dist/cjs/defaultProps.js +0 -53
- package/dist/cjs/defaultProps.js.map +0 -7
- package/dist/cjs/exportsRelated/DSTab.js +0 -46
- package/dist/cjs/exportsRelated/DSTab.js.map +0 -7
- package/dist/cjs/index.js +0 -38
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/parts/carousel/Carousel.js +0 -77
- package/dist/cjs/parts/carousel/Carousel.js.map +0 -7
- package/dist/cjs/parts/carousel/styles.js +0 -79
- package/dist/cjs/parts/carousel/styles.js.map +0 -7
- package/dist/cjs/parts/carousel/useCarousel.js +0 -80
- package/dist/cjs/parts/carousel/useCarousel.js.map +0 -7
- package/dist/cjs/parts/carousel/useCarouselCallbacks.js +0 -89
- package/dist/cjs/parts/carousel/useCarouselCallbacks.js.map +0 -7
- package/dist/cjs/parts/tabBar/TabBar.js +0 -171
- package/dist/cjs/parts/tabBar/TabBar.js.map +0 -7
- package/dist/cjs/parts/tabBar/styles.js +0 -294
- package/dist/cjs/parts/tabBar/styles.js.map +0 -7
- package/dist/cjs/parts/tabBar/useTabBar.js +0 -100
- package/dist/cjs/parts/tabBar/useTabBar.js.map +0 -7
- package/dist/cjs/parts/tabsContent/TabsContent.js +0 -53
- package/dist/cjs/parts/tabsContent/TabsContent.js.map +0 -7
- package/dist/cjs/parts/tabsContent/styles.js +0 -39
- package/dist/cjs/parts/tabsContent/styles.js.map +0 -7
- package/dist/cjs/parts/tabsPanel/TabsPanels.js +0 -79
- package/dist/cjs/parts/tabsPanel/TabsPanels.js.map +0 -7
- package/dist/cjs/parts/tabsPanel/styles.js +0 -45
- package/dist/cjs/parts/tabsPanel/styles.js.map +0 -7
- package/dist/cjs/propTypes.js +0 -58
- package/dist/cjs/propTypes.js.map +0 -7
- package/dist/cjs/utils/constants.js +0 -56
- package/dist/cjs/utils/constants.js.map +0 -7
- package/dist/cjs/utils/helpers.js +0 -88
- package/dist/cjs/utils/helpers.js.map +0 -7
- package/dist/cjs/utils/hooks/useKeyboardNavigation.js +0 -77
- package/dist/cjs/utils/hooks/useKeyboardNavigation.js.map +0 -7
- package/dist/cjs/utils/hooks/useTabsCallbacks.js +0 -60
- package/dist/cjs/utils/hooks/useTabsCallbacks.js.map +0 -7
- package/dist/esm/DSTabs.js +0 -34
- package/dist/esm/DSTabs.js.map +0 -7
- package/dist/esm/DSTabsCTX.js +0 -27
- package/dist/esm/DSTabsCTX.js.map +0 -7
- package/dist/esm/DSTabsDatatestid.js +0 -17
- package/dist/esm/DSTabsDatatestid.js.map +0 -7
- package/dist/esm/DSTabsTypes.js +0 -2
- package/dist/esm/DSTabsTypes.js.map +0 -7
- package/dist/esm/config/useCrossRef.js.map +0 -7
- package/dist/esm/config/useTabs.js +0 -39
- package/dist/esm/config/useTabs.js.map +0 -7
- package/dist/esm/defaultProps.js.map +0 -7
- package/dist/esm/exportsRelated/DSTab.js +0 -17
- package/dist/esm/exportsRelated/DSTab.js.map +0 -7
- package/dist/esm/index.js +0 -9
- package/dist/esm/index.js.map +0 -7
- package/dist/esm/parts/carousel/Carousel.js +0 -48
- package/dist/esm/parts/carousel/Carousel.js.map +0 -7
- package/dist/esm/parts/carousel/styles.js +0 -50
- package/dist/esm/parts/carousel/styles.js.map +0 -7
- package/dist/esm/parts/carousel/useCarousel.js.map +0 -7
- package/dist/esm/parts/carousel/useCarouselCallbacks.js.map +0 -7
- package/dist/esm/parts/tabBar/TabBar.js +0 -149
- package/dist/esm/parts/tabBar/TabBar.js.map +0 -7
- package/dist/esm/parts/tabBar/styles.js +0 -265
- package/dist/esm/parts/tabBar/styles.js.map +0 -7
- package/dist/esm/parts/tabBar/useTabBar.js.map +0 -7
- package/dist/esm/parts/tabsContent/TabsContent.js +0 -24
- package/dist/esm/parts/tabsContent/TabsContent.js.map +0 -7
- package/dist/esm/parts/tabsContent/styles.js +0 -10
- package/dist/esm/parts/tabsContent/styles.js.map +0 -7
- package/dist/esm/parts/tabsPanel/TabsPanels.js +0 -50
- package/dist/esm/parts/tabsPanel/TabsPanels.js.map +0 -7
- package/dist/esm/parts/tabsPanel/styles.js +0 -16
- package/dist/esm/parts/tabsPanel/styles.js.map +0 -7
- package/dist/esm/propTypes.js +0 -29
- package/dist/esm/propTypes.js.map +0 -7
- package/dist/esm/utils/constants.js +0 -27
- package/dist/esm/utils/constants.js.map +0 -7
- package/dist/esm/utils/helpers.js.map +0 -7
- package/dist/esm/utils/hooks/useKeyboardNavigation.js +0 -48
- package/dist/esm/utils/hooks/useKeyboardNavigation.js.map +0 -7
- package/dist/esm/utils/hooks/useTabsCallbacks.js +0 -31
- package/dist/esm/utils/hooks/useTabsCallbacks.js.map +0 -7
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
|
-
import { safariAndFirefoxBold, onlySafariAndFirefox, css } from "@elliemae/ds-system";
|
|
4
|
-
import { TabTypes } from "../../utils/constants";
|
|
5
|
-
const StyledSelectionIndicator = styled.div`
|
|
6
|
-
position: absolute;
|
|
7
|
-
height: 3px;
|
|
8
|
-
top: ${({ tabType, isDSMobile }) => {
|
|
9
|
-
if (isDSMobile)
|
|
10
|
-
return `35px`;
|
|
11
|
-
if (tabType === TabTypes.NORMAL_SMALL)
|
|
12
|
-
return `15px`;
|
|
13
|
-
return `25px`;
|
|
14
|
-
}};
|
|
15
|
-
margin-top: ${({ theme }) => theme.space.xxxs};
|
|
16
|
-
pointer-events: none;
|
|
17
|
-
transition: 200ms cubic-bezier(0.36, 0, 1, 1);
|
|
18
|
-
z-index: 10;
|
|
19
|
-
${({ isDSMobile }) => isDSMobile ? `
|
|
20
|
-
margin-left: 0;
|
|
21
|
-
margin-top: 3px;
|
|
22
|
-
` : ``}
|
|
23
|
-
`;
|
|
24
|
-
const mobileGradientsSettings = css`
|
|
25
|
-
${({ theme, mobileGradients, isDSMobile, fixedTabsHeaders }) => {
|
|
26
|
-
if (isDSMobile && !fixedTabsHeaders) {
|
|
27
|
-
if (mobileGradients.right && mobileGradients.left)
|
|
28
|
-
return `background: linear-gradient(90deg, rgba(238,238,238,0) 0%, ${theme.colors.brand[200]} 20%, ${theme.colors.brand[200]} 80%, rgba(238,238,238,0) 100%);`;
|
|
29
|
-
if (mobileGradients.right)
|
|
30
|
-
return `background: linear-gradient(90deg, ${theme.colors.brand[200]} 0%, ${theme.colors.brand[200]} 80%, rgba(238,238,238,0) 100%);`;
|
|
31
|
-
if (mobileGradients.left)
|
|
32
|
-
return `background: linear-gradient(90deg, rgba(238,238,238,0) 0%, ${theme.colors.brand[200]} 20%, ${theme.colors.brand[200]} 100%);`;
|
|
33
|
-
}
|
|
34
|
-
return ``;
|
|
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
|
-
}
|
|
159
|
-
|
|
160
|
-
${isActive ? `
|
|
161
|
-
font-weight: ${theme.fontWeights.regular};
|
|
162
|
-
font-size: 13px;
|
|
163
|
-
${safariAndFirefoxBold("#006AA9")}
|
|
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
|
-
`}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
${StyledSelectionIndicator} {
|
|
247
|
-
background: ${({ theme, indicatorStyle, isDSMobile }) => !isDSMobile ? indicatorStyle.backgroundWithTransparent : theme.colors.brand[600]};
|
|
248
|
-
}
|
|
249
|
-
`;
|
|
250
|
-
const StyledRequiredMark = styled.span`
|
|
251
|
-
color: ${({ theme }) => theme.colors.danger[900]};
|
|
252
|
-
font-size: 6px;
|
|
253
|
-
margin-left: 2px;
|
|
254
|
-
position: absolute;
|
|
255
|
-
top: 5px;
|
|
256
|
-
`;
|
|
257
|
-
export {
|
|
258
|
-
StyledRequiredMark,
|
|
259
|
-
StyledSelectionIndicator,
|
|
260
|
-
StyledSubTabsList,
|
|
261
|
-
StyledTabButton,
|
|
262
|
-
StyledTabList,
|
|
263
|
-
StyledTabWrapper
|
|
264
|
-
};
|
|
265
|
-
//# sourceMappingURL=styles.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 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 from 'styled-components';\nimport { safariAndFirefoxBold, onlySafariAndFirefox, css } from '@elliemae/ds-system';\nimport { TabTypes } from '../../utils/constants';\nimport type {\n StyledSelectionIndicatoPropsT,\n StyledSubTabsListPropsT,\n StyledTabListPropsT,\n StyledTabButtonPropsT,\n StyledTabWrapperPropsT,\n} from '../../DSTabsTypes';\n\nexport const StyledSelectionIndicator = styled.div<StyledSelectionIndicatoPropsT>`\n position: absolute;\n height: 3px;\n top: ${({ tabType, isDSMobile }) => {\n if (isDSMobile) return `35px`;\n if (tabType === TabTypes.NORMAL_SMALL) return `15px`;\n return `25px`;\n }};\n margin-top: ${({ theme }) => theme.space.xxxs};\n pointer-events: none;\n transition: 200ms cubic-bezier(0.36, 0, 1, 1);\n z-index: 10;\n ${({ isDSMobile }) =>\n isDSMobile\n ? ` \n margin-left: 0;\n margin-top: 3px;\n `\n : ``}\n`;\n\nconst mobileGradientsSettings = css<StyledTabListPropsT>`\n ${({ theme, mobileGradients, isDSMobile, fixedTabsHeaders }) => {\n if (isDSMobile && !fixedTabsHeaders) {\n if (mobileGradients.right && mobileGradients.left)\n return `background: linear-gradient(90deg, rgba(238,238,238,0) 0%, ${theme.colors.brand[200]} 20%, ${theme.colors.brand[200]} 80%, rgba(238,238,238,0) 100%);`;\n if (mobileGradients.right)\n return `background: linear-gradient(90deg, ${theme.colors.brand[200]} 0%, ${theme.colors.brand[200]} 80%, rgba(238,238,238,0) 100%);`;\n if (mobileGradients.left)\n return `background: linear-gradient(90deg, rgba(238,238,238,0) 0%, ${theme.colors.brand[200]} 20%, ${theme.colors.brand[200]} 100%);`;\n }\n return ``;\n }}\n`;\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.brand[300]};` : ``)}\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 }) => (tabType === TabTypes.SUBTABS ? `capitalize` : `uppercase`)};\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\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: ${theme.colors.brand[600]};\n font-weight: ${theme.fontWeights.regular};\n padding: 0;\n font-size: 13px;\n line-height: 1.3;\n ${onlySafariAndFirefox('-webkit-text-stroke: 0.4px transparent;')} \n\n &:focus {\n font-weight: ${theme.fontWeights.regular};\n font-size: 13px;\n ${safariAndFirefoxBold('#006AA9')}\n }\n\n ${\n isActive\n ? `\n font-weight: ${theme.fontWeights.regular};\n font-size: 13px;\n ${safariAndFirefoxBold('#006AA9')}\n `\n : ``\n }\n\n ${\n isActive && !disabled\n ? `\n font-size: 13px;\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 ${({ 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.brand[200]};`\n : ``}\n\n ${mobileGradientsSettings}\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 scrollbar-width: thin;\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};\n left: ${indicatorStyle.left};\n `}\n }\n\n ${StyledSelectionIndicator} {\n background: ${({ theme, indicatorStyle, isDSMobile }) =>\n !isDSMobile ? indicatorStyle.backgroundWithTransparent : theme.colors.brand[600]};\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;ACEA;AACA;AACA;AASO,MAAM,2BAA2B,OAAO;AAAA;AAAA;AAAA,SAGtC,CAAC,EAAE,SAAS,iBAAiB;AAClC,MAAI;AAAY,WAAO;AACvB,MAAI,YAAY,SAAS;AAAc,WAAO;AAC9C,SAAO;AAAA;AAAA,gBAEK,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA,IAIvC,CAAC,EAAE,iBACH,aACI;AAAA;AAAA;AAAA,MAIA;AAAA;AA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@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 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 '@react-hook/resize-observer';\nimport { isElementVisible, shouldHaveLeftGradient, shouldHaveRightGradient } from '../../utils/helpers';\nimport { DSTabsContext } from '../../DSTabsCTX';\nimport { defaultIndicatorStyles } from '../../utils/constants';\nimport type { IndicatorStyleT, MobileGradientsT, UseTabBarReturnTypeT } from '../../DSTabsTypes';\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<MobileGradientsT>({ left: false, right: false });\n const [indicatorStyle, setIndicatorStyle] = useState<IndicatorStyleT>(defaultIndicatorStyles);\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 defaultIndicatorStyles;\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 const backgroundWithTransparent = `linear-gradient(to right, transparent 0px, transparent 16px, #1E79C2 16px, #1E79C2 ${\n tabClientWidth - 16\n }px,transparent ${tabClientWidth - 16}px,transparent ${tabClientWidth}px )`;\n\n return {\n left: `${position}px`,\n width: `${tabClientWidth}px`,\n backgroundWithTransparent,\n };\n }\n return defaultIndicatorStyles;\n }, [actualActiveTabRef, fixedTabsHeaders, isDSMobile, tabsListRef]);\n\n const updateIndicatorStyle = useCallback(\n () => setTimeout(() => setIndicatorStyle(getIndicatorStyles()), 100),\n [getIndicatorStyles, setIndicatorStyle],\n );\n\n useResizeObserver(tabsListRef, updateIndicatorStyle);\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 actualActiveTab,\n ]);\n\n return {\n updateIndicatorStyle,\n setIndicatorStyle,\n indicatorStyle,\n mobileGradients,\n updateMobileGradients,\n };\n};\n"],
|
|
5
|
-
"mappings": "AAAA;ACCA;AACA;AACA;AACA;AACA;AAGO,MAAM,YAAY,MAA4B;AACnD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,wBAAwB,YAAY;AAAA,MAC3C,WAAW;AAEf,QAAM,CAAC,iBAAiB,sBAAsB,SAA2B,EAAE,MAAM,OAAO,OAAO;AAC/F,QAAM,CAAC,gBAAgB,qBAAqB,SAA0B;AAEtE,QAA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
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import React2, { useContext } from "react";
|
|
3
|
-
import { TabsPanels } from "../tabsPanel/TabsPanels";
|
|
4
|
-
import { TabBar } from "../tabBar/TabBar";
|
|
5
|
-
import { StyledTabBarContainer } from "./styles";
|
|
6
|
-
import { DSTabsContext } from "../../DSTabsCTX";
|
|
7
|
-
import { DSTabsDatatestid } from "../../DSTabsDatatestid";
|
|
8
|
-
const TabsContent = () => {
|
|
9
|
-
const {
|
|
10
|
-
props: { containerProps, innerRef, tabsListAriaLabel, tabBarExtraContent }
|
|
11
|
-
} = useContext(DSTabsContext);
|
|
12
|
-
return /* @__PURE__ */ React2.createElement("div", {
|
|
13
|
-
...containerProps,
|
|
14
|
-
ref: innerRef,
|
|
15
|
-
"data-testid": DSTabsDatatestid.TABS_CONTAINER
|
|
16
|
-
}, /* @__PURE__ */ React2.createElement(StyledTabBarContainer, {
|
|
17
|
-
"aria-label": tabsListAriaLabel,
|
|
18
|
-
role: "tablist"
|
|
19
|
-
}, /* @__PURE__ */ React2.createElement(TabBar, null), tabBarExtraContent), /* @__PURE__ */ React2.createElement(TabsPanels, null));
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
TabsContent
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=TabsContent.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 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 { TabsPanels } from '../tabsPanel/TabsPanels';\nimport { TabBar } from '../tabBar/TabBar';\nimport { StyledTabBarContainer } from './styles';\nimport { DSTabsContext } from '../../DSTabsCTX';\nimport { DSTabsDatatestid } from '../../DSTabsDatatestid';\n\nexport const TabsContent = (): JSX.Element => {\n const {\n props: { containerProps, innerRef, tabsListAriaLabel, tabBarExtraContent },\n } = useContext(DSTabsContext);\n\n return (\n <div {...containerProps} ref={innerRef} data-testid={DSTabsDatatestid.TABS_CONTAINER}>\n <StyledTabBarContainer aria-label={tabsListAriaLabel} role=\"tablist\">\n <TabBar />\n {tabBarExtraContent}\n </StyledTabBarContainer>\n <TabsPanels />\n </div>\n );\n};\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AAEO,MAAM,cAAc,MAAmB;AAC5C,QAAM;AAAA,IACJ,OAAO,EAAE,gBAAgB,UAAU,mBAAmB;AAAA,MACpD,WAAW;AAEf,SACE,qCAAC,OAAD;AAAA,OAAS;AAAA,IAAgB,KAAK;AAAA,IAAU,eAAa,iBAAiB;AAAA,KACpE,qCAAC,uBAAD;AAAA,IAAuB,cAAY;AAAA,IAAmB,MAAK;AAAA,KACzD,qCAAC,QAAD,OACC,qBAEH,qCAAC,YAAD;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/tabsContent/styles.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import styled from 'styled-components';\n\nexport const StyledTabBarContainer = styled.div`\n display: flex;\n overflow-x: hidden;\n`;\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AAEO,MAAM,wBAAwB,OAAO;AAAA;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import React2, { useMemo, useContext, useCallback } from "react";
|
|
3
|
-
import SwipeableViews from "react-swipeable-views";
|
|
4
|
-
import { getIdByIndex, getIndexById } from "../../utils/helpers";
|
|
5
|
-
import { StyledPanelContainer } from "./styles";
|
|
6
|
-
import { DSTabsContext } from "../../DSTabsCTX";
|
|
7
|
-
import { useTabsCallbacks } from "../../utils/hooks/useTabsCallbacks";
|
|
8
|
-
const TabsPanels = () => {
|
|
9
|
-
const {
|
|
10
|
-
actualActiveTab,
|
|
11
|
-
focusableTabsRef,
|
|
12
|
-
props: { animated, enableMouseEvents, onlyRenderActiveTab, children: tabs, isDSMobile }
|
|
13
|
-
} = useContext(DSTabsContext);
|
|
14
|
-
const { handleOnTabChange, handleOnMouseDown } = useTabsCallbacks();
|
|
15
|
-
const handleOnChangeIndex = useCallback((index) => {
|
|
16
|
-
handleOnTabChange(getIdByIndex(tabs, index));
|
|
17
|
-
if (focusableTabsRef.current)
|
|
18
|
-
focusableTabsRef.current[index].click();
|
|
19
|
-
}, [focusableTabsRef, handleOnTabChange, tabs]);
|
|
20
|
-
const panels = useMemo(() => React2.Children.map(tabs, (tab) => {
|
|
21
|
-
const { tabId: panelId = "", style, children: content } = tab.props;
|
|
22
|
-
const isActive = actualActiveTab === panelId;
|
|
23
|
-
const shouldRender = !onlyRenderActiveTab || isActive;
|
|
24
|
-
return shouldRender && /* @__PURE__ */ React2.createElement(StyledPanelContainer, {
|
|
25
|
-
key: panelId,
|
|
26
|
-
id: panelId,
|
|
27
|
-
"aria-labelledby": `${panelId}-label`,
|
|
28
|
-
"aria-hidden": !isActive,
|
|
29
|
-
"data-panel-id": panelId,
|
|
30
|
-
"data-testid": "ds-tabs-tab-panel",
|
|
31
|
-
hidden: !isActive,
|
|
32
|
-
onMouseDown: handleOnMouseDown,
|
|
33
|
-
role: "tabpanel",
|
|
34
|
-
style,
|
|
35
|
-
isDSMobile
|
|
36
|
-
}, content);
|
|
37
|
-
}), [actualActiveTab, handleOnMouseDown, isDSMobile, onlyRenderActiveTab, tabs]);
|
|
38
|
-
if (animated) {
|
|
39
|
-
return /* @__PURE__ */ React2.createElement(SwipeableViews, {
|
|
40
|
-
enableMouseEvents,
|
|
41
|
-
index: getIndexById(tabs, actualActiveTab),
|
|
42
|
-
onChangeIndex: handleOnChangeIndex
|
|
43
|
-
}, panels);
|
|
44
|
-
}
|
|
45
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, panels);
|
|
46
|
-
};
|
|
47
|
-
export {
|
|
48
|
-
TabsPanels
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=TabsPanels.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/tabsPanel/TabsPanels.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\nimport React, { useMemo, useContext, useCallback } from 'react';\nimport SwipeableViews from 'react-swipeable-views';\nimport { getIdByIndex, getIndexById } from '../../utils/helpers';\nimport { StyledPanelContainer } from './styles';\nimport { DSTabsContext } from '../../DSTabsCTX';\nimport { useTabsCallbacks } from '../../utils/hooks/useTabsCallbacks';\nimport { DSTabPropsWithDefaultT } from '../../DSTabsTypes';\n\nexport const TabsPanels = (): JSX.Element => {\n const {\n actualActiveTab,\n focusableTabsRef,\n props: { animated, enableMouseEvents, onlyRenderActiveTab, children: tabs, isDSMobile },\n } = useContext(DSTabsContext);\n\n const { handleOnTabChange, handleOnMouseDown } = useTabsCallbacks();\n\n const handleOnChangeIndex = useCallback(\n (index: number) => {\n handleOnTabChange(getIdByIndex(tabs, index));\n\n if (focusableTabsRef.current) focusableTabsRef.current[index].click();\n },\n [focusableTabsRef, handleOnTabChange, tabs],\n );\n\n const panels = useMemo(\n () =>\n React.Children.map(tabs, (tab: React.ReactElement<DSTabPropsWithDefaultT>) => {\n const { tabId: panelId = '', style, children: content } = tab.props;\n const isActive = actualActiveTab === panelId;\n const shouldRender = !onlyRenderActiveTab || isActive;\n return (\n shouldRender && (\n <StyledPanelContainer\n key={panelId}\n id={panelId}\n aria-labelledby={`${panelId}-label`}\n aria-hidden={!isActive}\n data-panel-id={panelId}\n data-testid=\"ds-tabs-tab-panel\"\n hidden={!isActive}\n onMouseDown={handleOnMouseDown}\n role=\"tabpanel\"\n style={style}\n isDSMobile={isDSMobile}\n >\n {content}\n </StyledPanelContainer>\n )\n );\n }),\n [actualActiveTab, handleOnMouseDown, isDSMobile, onlyRenderActiveTab, tabs],\n );\n\n if (animated) {\n return (\n <SwipeableViews\n enableMouseEvents={enableMouseEvents}\n index={getIndexById(tabs, actualActiveTab)}\n onChangeIndex={handleOnChangeIndex}\n >\n {panels}\n </SwipeableViews>\n );\n }\n\n return <>{panels}</>;\n};\n"],
|
|
5
|
-
"mappings": "AAAA;ACCA;AACA;AACA;AACA;AACA;AACA;AAGO,MAAM,aAAa,MAAmB;AAC3C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,OAAO,EAAE,UAAU,mBAAmB,qBAAqB,UAAU,MAAM;AAAA,MACzE,WAAW;AAEf,QAAM,EAAE,mBAAmB,sBAAsB;AAEjD,QAAM,sBAAsB,YAC1B,CAAC,UAAkB;AACjB,sBAAkB,aAAa,MAAM;AAErC,QAAI,iBAAiB;AAAS,uBAAiB,QAAQ,OAAO;AAAA,KAEhE,CAAC,kBAAkB,mBAAmB;AAGxC,QAAM,SAAS,QACb,MACE,OAAM,SAAS,IAAI,MAAM,CAAC,QAAoD;AAC5E,UAAM,EAAE,OAAO,UAAU,IAAI,OAAO,UAAU,YAAY,IAAI;AAC9D,UAAM,WAAW,oBAAoB;AACrC,UAAM,eAAe,CAAC,uBAAuB;AAC7C,WACE,gBACE,qCAAC,sBAAD;AAAA,MACE,KAAK;AAAA,MACL,IAAI;AAAA,MACJ,mBAAiB,GAAG;AAAA,MACpB,eAAa,CAAC;AAAA,MACd,iBAAe;AAAA,MACf,eAAY;AAAA,MACZ,QAAQ,CAAC;AAAA,MACT,aAAa;AAAA,MACb,MAAK;AAAA,MACL;AAAA,MACA;AAAA,OAEC;AAAA,MAKX,CAAC,iBAAiB,mBAAmB,YAAY,qBAAqB;AAGxE,MAAI,UAAU;AACZ,WACE,qCAAC,gBAAD;AAAA,MACE;AAAA,MACA,OAAO,aAAa,MAAM;AAAA,MAC1B,eAAe;AAAA,OAEd;AAAA;AAKP,SAAO,4DAAG;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
|
-
const StyledPanelContainer = styled.div`
|
|
4
|
-
padding-top: 8px;
|
|
5
|
-
&:focus {
|
|
6
|
-
outline: none;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
${({ hidden }) => hidden ? "visibility: hidden;" : ""}
|
|
10
|
-
|
|
11
|
-
${({ isDSMobile }) => isDSMobile ? `padding-top: 0;` : ``}
|
|
12
|
-
`;
|
|
13
|
-
export {
|
|
14
|
-
StyledPanelContainer
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=styles.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/tabsPanel/styles.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import styled from 'styled-components';\nimport type { StyledPanelContainerPropsT } from '../../DSTabsTypes';\n\nexport const StyledPanelContainer = styled.div<StyledPanelContainerPropsT>`\n padding-top: 8px;\n &:focus {\n outline: none;\n }\n\n ${({ hidden }) => (hidden ? 'visibility: hidden;' : '')}\n\n ${({ isDSMobile }) => (isDSMobile ? `padding-top: 0;` : ``)}\n`;\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AAGO,MAAM,uBAAuB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMvC,CAAC,EAAE,aAAc,SAAS,wBAAwB;AAAA;AAAA,IAElD,CAAC,EAAE,iBAAkB,aAAa,oBAAoB;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/esm/propTypes.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { PropTypes } from "react-desc";
|
|
3
|
-
import { TabTypesValuesAsArray } from "./utils/constants";
|
|
4
|
-
const tabPropTypes = {
|
|
5
|
-
tabId: PropTypes.string.description("Unique Tab id.").defaultValue(""),
|
|
6
|
-
title: PropTypes.string.description("Tab title.").defaultValue(""),
|
|
7
|
-
required: PropTypes.bool.description("Show a required mark next to the title.").defaultValue(false),
|
|
8
|
-
disabled: PropTypes.bool.description("Disables Tab.").defaultValue(false)
|
|
9
|
-
};
|
|
10
|
-
const tabsPropTypes = {
|
|
11
|
-
animated: PropTypes.bool.description("Whether the Tab transition should animate or not.").defaultValue(true),
|
|
12
|
-
enableMouseEvents: PropTypes.bool.description("Enables Tab transition with mouse drag events.").defaultValue(false),
|
|
13
|
-
allowTextSelection: PropTypes.bool.description("Allows text selection when mouse drag events are active.").defaultValue(false),
|
|
14
|
-
onTabChange: PropTypes.func.description("Handler when a user clicks on a different Tab.").defaultValue("() => {}"),
|
|
15
|
-
type: PropTypes.oneOf(TabTypesValuesAsArray).description("Tab type.").defaultValue(TabTypesValuesAsArray[0]),
|
|
16
|
-
tabBarExtraContent: PropTypes.element.description("Extra content next to the Tab Bar.").defaultValue(void 0),
|
|
17
|
-
onlyRenderActiveTab: PropTypes.bool.description("Only renders the active Tab in the DOM.").defaultValue(false),
|
|
18
|
-
withCarousel: PropTypes.bool.description("Activate carousel behavior.").defaultValue(false),
|
|
19
|
-
activeTab: PropTypes.string.description("Passing a value makes DSTabs a controlled component.").defaultValue("First DSTab children."),
|
|
20
|
-
children: PropTypes.node.description("Use DSTab component as children.").isRequired,
|
|
21
|
-
tabsListAriaLabel: PropTypes.string.description("Aria label for the list.").defaultValue("Tab list."),
|
|
22
|
-
containerProps: PropTypes.object.description("Additional properties for the container.").defaultValue({}),
|
|
23
|
-
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description("Ref to the container.").defaultValue(void 0)
|
|
24
|
-
};
|
|
25
|
-
export {
|
|
26
|
-
tabPropTypes,
|
|
27
|
-
tabsPropTypes
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=propTypes.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/propTypes.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from 'react-desc';\nimport { TabTypesValuesAsArray } from './utils/constants';\n\nexport const tabPropTypes = {\n tabId: PropTypes.string.description('Unique Tab id.').defaultValue(''),\n title: PropTypes.string.description('Tab title.').defaultValue(''),\n required: PropTypes.bool.description('Show a required mark next to the title.').defaultValue(false),\n disabled: PropTypes.bool.description('Disables Tab.').defaultValue(false),\n};\n\nexport const tabsPropTypes = {\n animated: PropTypes.bool.description('Whether the Tab transition should animate or not.').defaultValue(true),\n enableMouseEvents: PropTypes.bool.description('Enables Tab transition with mouse drag events.').defaultValue(false),\n allowTextSelection: PropTypes.bool\n .description('Allows text selection when mouse drag events are active.')\n .defaultValue(false),\n onTabChange: PropTypes.func.description('Handler when a user clicks on a different Tab.').defaultValue('() => {}'),\n type: PropTypes.oneOf(TabTypesValuesAsArray).description('Tab type.').defaultValue(TabTypesValuesAsArray[0]),\n tabBarExtraContent: PropTypes.element.description('Extra content next to the Tab Bar.').defaultValue(undefined),\n onlyRenderActiveTab: PropTypes.bool.description('Only renders the active Tab in the DOM.').defaultValue(false),\n withCarousel: PropTypes.bool.description('Activate carousel behavior.').defaultValue(false),\n activeTab: PropTypes.string\n .description('Passing a value makes DSTabs a controlled component.')\n .defaultValue('First DSTab children.'),\n children: PropTypes.node.description('Use DSTab component as children.').isRequired,\n tabsListAriaLabel: PropTypes.string.description('Aria label for the list.').defaultValue('Tab list.'),\n containerProps: PropTypes.object.description('Additional properties for the container.').defaultValue({}),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })])\n .description('Ref to the container.')\n .defaultValue(undefined),\n};\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;AAEO,MAAM,eAAe;AAAA,EAC1B,OAAO,UAAU,OAAO,YAAY,kBAAkB,aAAa;AAAA,EACnE,OAAO,UAAU,OAAO,YAAY,cAAc,aAAa;AAAA,EAC/D,UAAU,UAAU,KAAK,YAAY,2CAA2C,aAAa;AAAA,EAC7F,UAAU,UAAU,KAAK,YAAY,iBAAiB,aAAa;AAAA;AAG9D,MAAM,gBAAgB;AAAA,EAC3B,UAAU,UAAU,KAAK,YAAY,qDAAqD,aAAa;AAAA,EACvG,mBAAmB,UAAU,KAAK,YAAY,kDAAkD,aAAa;AAAA,EAC7G,oBAAoB,UAAU,KAC3B,YAAY,4DACZ,aAAa;AAAA,EAChB,aAAa,UAAU,KAAK,YAAY,kDAAkD,aAAa;AAAA,EACvG,MAAM,UAAU,MAAM,uBAAuB,YAAY,aAAa,aAAa,sBAAsB;AAAA,EACzG,oBAAoB,UAAU,QAAQ,YAAY,sCAAsC,aAAa;AAAA,EACrG,qBAAqB,UAAU,KAAK,YAAY,2CAA2C,aAAa;AAAA,EACxG,cAAc,UAAU,KAAK,YAAY,+BAA+B,aAAa;AAAA,EACrF,WAAW,UAAU,OAClB,YAAY,wDACZ,aAAa;AAAA,EAChB,UAAU,UAAU,KAAK,YAAY,oCAAoC;AAAA,EACzE,mBAAmB,UAAU,OAAO,YAAY,4BAA4B,aAAa;AAAA,EACzF,gBAAgB,UAAU,OAAO,YAAY,4CAA4C,aAAa;AAAA,EACtG,UAAU,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU,MAAM,EAAE,SAAS,UAAU,SACjF,YAAY,yBACZ,aAAa;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
const TabTypes = {
|
|
3
|
-
NORMAL: "normal",
|
|
4
|
-
NORMAL_SMALL: "normal_small",
|
|
5
|
-
SUBTABS: "subtabs"
|
|
6
|
-
};
|
|
7
|
-
const TabTypesValuesAsArray = Object.values(TabTypes);
|
|
8
|
-
const MOBILE_GRADIENT_WIDTH = 24;
|
|
9
|
-
const defaultIndicatorStyles = {
|
|
10
|
-
left: "0px",
|
|
11
|
-
width: "0px",
|
|
12
|
-
backgroundWithTransparent: ""
|
|
13
|
-
};
|
|
14
|
-
const gradientOffsetsAccordingType = {
|
|
15
|
-
normal_small: 14,
|
|
16
|
-
normal: 16,
|
|
17
|
-
subtabs: 16,
|
|
18
|
-
fixedTabsHeaders: 0
|
|
19
|
-
};
|
|
20
|
-
export {
|
|
21
|
-
MOBILE_GRADIENT_WIDTH,
|
|
22
|
-
TabTypes,
|
|
23
|
-
TabTypesValuesAsArray,
|
|
24
|
-
defaultIndicatorStyles,
|
|
25
|
-
gradientOffsetsAccordingType
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/constants.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const TabTypes = {\n NORMAL: 'normal' as const,\n NORMAL_SMALL: 'normal_small' as const,\n SUBTABS: 'subtabs' as const,\n};\n\nexport const TabTypesValuesAsArray = Object.values(TabTypes);\n\nexport const MOBILE_GRADIENT_WIDTH = 24;\n\nexport const defaultIndicatorStyles = {\n left: '0px',\n width: '0px',\n backgroundWithTransparent: '',\n};\n\nexport const gradientOffsetsAccordingType = {\n normal_small: 14,\n normal: 16,\n subtabs: 16,\n fixedTabsHeaders: 0,\n};\n"],
|
|
5
|
-
"mappings": "AAAA;ACAO,MAAM,WAAW;AAAA,EACtB,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,SAAS;AAAA;AAGJ,MAAM,wBAAwB,OAAO,OAAO;AAE5C,MAAM,wBAAwB;AAE9B,MAAM,yBAAyB;AAAA,EACpC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,2BAA2B;AAAA;AAGtB,MAAM,+BAA+B;AAAA,EAC1C,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,kBAAkB;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/helpers.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { CenterTabPropsT, DSTabPropsWithDefaultT, VisibleDimensionsT } from '../DSTabsTypes';\nimport { MOBILE_GRADIENT_WIDTH } from './constants';\n\nexport const isElementVisible = (tab: HTMLElement, tabList: HTMLElement): boolean => {\n const tabDimensions = tab.getBoundingClientRect();\n const tabListDimensions = tabList.getBoundingClientRect();\n\n return tabDimensions.left <= tabListDimensions.left\n ? tabListDimensions.left - tabDimensions.left <= tabDimensions.width\n : tabDimensions.right - tabListDimensions.right <= tabDimensions.width;\n};\n\nexport const isElementVisibleCarousel = (\n tab: HTMLElement | null,\n tabContainer: HTMLDivElement | null,\n firstOrLastItem = true,\n): boolean => {\n if (tab && tabContainer) {\n const tabDimensions = tab.getBoundingClientRect();\n const tabContainerDimensions = tabContainer.getBoundingClientRect();\n\n const offset = firstOrLastItem ? 16 : 32;\n const tabDimensionsLeft = Math.floor(tabDimensions.left - offset);\n const tabDimensionsRight = Math.floor(tabDimensions.right + offset);\n\n const tabContainerDimensionsLeft = Math.floor(tabContainerDimensions.left);\n const tabContainerDimensionsRight = Math.floor(tabContainerDimensions.right);\n\n return tabDimensionsLeft >= tabContainerDimensionsLeft && tabDimensionsRight <= tabContainerDimensionsRight;\n }\n return false;\n};\n\nexport const centerTab = ({ e, listRef }: CenterTabPropsT) => {\n if (listRef.current) {\n const { offsetLeft } = e?.target as HTMLButtonElement;\n const { width: tabWidth } = (e?.target as HTMLButtonElement).getBoundingClientRect();\n const { width: listWidth } = listRef.current.getBoundingClientRect();\n const extraSideSpace = listWidth - tabWidth;\n const leftOffsetToCenter = extraSideSpace > 0 ? extraSideSpace / 2 : 0;\n const centeredLeftOffset = offsetLeft > leftOffsetToCenter ? offsetLeft - leftOffsetToCenter : 0;\n listRef.current.scrollTo({\n top: 0,\n left: centeredLeftOffset,\n behavior: 'smooth',\n });\n\n e?.preventDefault();\n }\n};\n\nexport const getVisibleDimensions = (node: HTMLElement, referenceNode: HTMLElement): VisibleDimensionsT => {\n const nodeDimensions = node.getBoundingClientRect();\n const referenceNodeDimensions = referenceNode.getBoundingClientRect();\n\n return {\n width: Math.min(\n node.clientWidth,\n referenceNodeDimensions.left + referenceNode.clientWidth - nodeDimensions.left,\n node.clientWidth - (referenceNodeDimensions.left - nodeDimensions.left),\n ),\n height: Math.min(\n node.clientHeight,\n referenceNodeDimensions.top + referenceNode.clientHeight - nodeDimensions.top,\n node.clientHeight - (referenceNodeDimensions.top - nodeDimensions.top),\n ),\n };\n};\n\nexport const getIndexById = (children: React.ReactElement<DSTabPropsWithDefaultT>[], activeId?: string): number =>\n children && children.findIndex((item: React.ReactElement<DSTabPropsWithDefaultT>) => item.props.tabId === activeId);\n\nexport const getIdByIndex = (children: React.ReactElement<DSTabPropsWithDefaultT>[], index: number): string =>\n (children && children[index].props.tabId) || '';\n\nexport const shouldHaveLeftGradient = (scrollLeft: number): boolean => Math.abs(scrollLeft) > MOBILE_GRADIENT_WIDTH;\n\nexport const shouldHaveRightGradient = (scrollLeft: number, clientWidth: number, scrollWidth: number): boolean =>\n Math.abs(scrollLeft) <= scrollWidth - (clientWidth + MOBILE_GRADIENT_WIDTH);\n"],
|
|
5
|
-
"mappings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,eAAe,MAC1E,KAAK,cAAe,yBAAwB,OAAO,eAAe;AAAA,IAEpE,QAAQ,KAAK,IACX,KAAK,cACL,wBAAwB,MAAM,cAAc,eAAe,eAAe,KAC1E,KAAK,eAAgB,yBAAwB,MAAM,eAAe;AAAA;AAAA;AAKjE,MAAM,eAAe,CAAC,UAAwD,aACnF,YAAY,SAAS,UAAU,CAAC,SAAqD,KAAK,MAAM,UAAU;AAErG,MAAM,eAAe,CAAC,UAAwD,UAClF,YAAY,SAAS,OAAO,MAAM,SAAU;AAExC,MAAM,yBAAyB,CAAC,eAAgC,KAAK,IAAI,cAAc;AAEvF,MAAM,0BAA0B,CAAC,YAAoB,aAAqB,gBAC/E,KAAK,IAAI,eAAe,cAAe,eAAc;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { useCallback, useContext } from "react";
|
|
3
|
-
import { DSTabsContext, DSTabsCrossRefContext } from "../../DSTabsCTX";
|
|
4
|
-
const useKeyboardNavigation = () => {
|
|
5
|
-
const { focusableTabsRef } = useContext(DSTabsContext);
|
|
6
|
-
const { firstSubtabInternalRef, lastTabInternalRef } = useContext(DSTabsCrossRefContext);
|
|
7
|
-
const handleOnKeyDown = useCallback((e) => {
|
|
8
|
-
if (e.key === "ArrowRight" && focusableTabsRef.current) {
|
|
9
|
-
e.preventDefault();
|
|
10
|
-
e.stopPropagation();
|
|
11
|
-
const nextTab = focusableTabsRef.current[focusableTabsRef?.current?.indexOf?.(e.target) + 1];
|
|
12
|
-
if (nextTab)
|
|
13
|
-
nextTab.focus();
|
|
14
|
-
if (!nextTab)
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
if (e.key === "ArrowLeft" && focusableTabsRef.current) {
|
|
18
|
-
e.preventDefault();
|
|
19
|
-
e.stopPropagation();
|
|
20
|
-
const prevTab = focusableTabsRef.current[focusableTabsRef?.current?.indexOf?.(e.target) - 1];
|
|
21
|
-
if (prevTab)
|
|
22
|
-
prevTab.focus();
|
|
23
|
-
if (!prevTab)
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (e.key === "ArrowDown") {
|
|
27
|
-
e.preventDefault();
|
|
28
|
-
e.stopPropagation();
|
|
29
|
-
const canFocusCrossTabs = firstSubtabInternalRef?.current && lastTabInternalRef?.current;
|
|
30
|
-
if (canFocusCrossTabs)
|
|
31
|
-
firstSubtabInternalRef.current?.focus();
|
|
32
|
-
}
|
|
33
|
-
if (e.key === "ArrowUp") {
|
|
34
|
-
e.preventDefault();
|
|
35
|
-
e.stopPropagation();
|
|
36
|
-
const canFocusCrossTabs = firstSubtabInternalRef?.current && lastTabInternalRef?.current;
|
|
37
|
-
if (canFocusCrossTabs)
|
|
38
|
-
lastTabInternalRef.current?.focus();
|
|
39
|
-
}
|
|
40
|
-
}, [firstSubtabInternalRef, lastTabInternalRef, focusableTabsRef]);
|
|
41
|
-
return {
|
|
42
|
-
handleOnKeyDown
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
export {
|
|
46
|
-
useKeyboardNavigation
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=useKeyboardNavigation.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/utils/hooks/useKeyboardNavigation.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport React, { useCallback, useContext } from 'react';\nimport { DSTabsContext, DSTabsCrossRefContext } from '../../DSTabsCTX';\nimport type { UseKeyboardNavigationReturnTypeT } from '../../DSTabsTypes';\n\nexport const useKeyboardNavigation = (): UseKeyboardNavigationReturnTypeT => {\n const { focusableTabsRef } = useContext(DSTabsContext);\n const { firstSubtabInternalRef, lastTabInternalRef } = useContext(DSTabsCrossRefContext);\n\n const handleOnKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === 'ArrowRight' && focusableTabsRef.current) {\n e.preventDefault();\n e.stopPropagation();\n const nextTab =\n focusableTabsRef.current[focusableTabsRef?.current?.indexOf?.(e.target as HTMLButtonElement) + 1];\n if (nextTab) nextTab.focus();\n if (!nextTab) return;\n }\n\n if (e.key === 'ArrowLeft' && focusableTabsRef.current) {\n e.preventDefault();\n e.stopPropagation();\n const prevTab =\n focusableTabsRef.current[focusableTabsRef?.current?.indexOf?.(e.target as HTMLButtonElement) - 1];\n if (prevTab) prevTab.focus();\n if (!prevTab) return;\n }\n\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n e.stopPropagation();\n const canFocusCrossTabs = firstSubtabInternalRef?.current && lastTabInternalRef?.current;\n if (canFocusCrossTabs) firstSubtabInternalRef.current?.focus();\n }\n\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n e.stopPropagation();\n const canFocusCrossTabs = firstSubtabInternalRef?.current && lastTabInternalRef?.current;\n if (canFocusCrossTabs) lastTabInternalRef.current?.focus();\n }\n },\n [firstSubtabInternalRef, lastTabInternalRef, focusableTabsRef],\n );\n\n return {\n handleOnKeyDown,\n };\n};\n"],
|
|
5
|
-
"mappings": "AAAA;ACEA;AACA;AAGO,MAAM,wBAAwB,MAAwC;AAC3E,QAAM,EAAE,qBAAqB,WAAW;AACxC,QAAM,EAAE,wBAAwB,uBAAuB,WAAW;AAElE,QAAM,kBAAkB,YACtB,CAAC,MAA2B;AAC1B,QAAI,EAAE,QAAQ,gBAAgB,iBAAiB,SAAS;AACtD,QAAE;AACF,QAAE;AACF,YAAM,UACJ,iBAAiB,QAAQ,kBAAkB,SAAS,UAAU,EAAE,UAA+B;AACjG,UAAI;AAAS,gBAAQ;AACrB,UAAI,CAAC;AAAS;AAAA;AAGhB,QAAI,EAAE,QAAQ,eAAe,iBAAiB,SAAS;AACrD,QAAE;AACF,QAAE;AACF,YAAM,UACJ,iBAAiB,QAAQ,kBAAkB,SAAS,UAAU,EAAE,UAA+B;AACjG,UAAI;AAAS,gBAAQ;AACrB,UAAI,CAAC;AAAS;AAAA;AAGhB,QAAI,EAAE,QAAQ,aAAa;AACzB,QAAE;AACF,QAAE;AACF,YAAM,oBAAoB,wBAAwB,WAAW,oBAAoB;AACjF,UAAI;AAAmB,+BAAuB,SAAS;AAAA;AAGzD,QAAI,EAAE,QAAQ,WAAW;AACvB,QAAE;AACF,QAAE;AACF,YAAM,oBAAoB,wBAAwB,WAAW,oBAAoB;AACjF,UAAI;AAAmB,2BAAmB,SAAS;AAAA;AAAA,KAGvD,CAAC,wBAAwB,oBAAoB;AAG/C,SAAO;AAAA,IACL;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|