@elliemae/ds-tabs 2.2.0-alpha.2 → 2.2.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/cjs/DSTabs.js +40 -58
  2. package/cjs/DSTabsCTX.js +25 -51
  3. package/cjs/DSTabsDatatestid.js +14 -42
  4. package/cjs/DSTabsTypes.js +2 -27
  5. package/cjs/config/useCrossRef.js +11 -38
  6. package/cjs/config/useTabs.js +36 -53
  7. package/cjs/defaultProps.js +13 -39
  8. package/cjs/exportsRelated/DSTab.js +32 -46
  9. package/cjs/index.js +17 -38
  10. package/cjs/parts/carousel/Carousel.js +53 -61
  11. package/cjs/parts/carousel/styles.js +63 -77
  12. package/cjs/parts/carousel/useCarousel.js +49 -51
  13. package/cjs/parts/carousel/useCarouselCallbacks.js +36 -53
  14. package/cjs/parts/tabBar/TabBar.js +128 -124
  15. package/cjs/parts/tabBar/styles.js +195 -289
  16. package/cjs/parts/tabBar/useTabBar.js +53 -74
  17. package/cjs/parts/tabsContent/TabsContent.js +45 -49
  18. package/cjs/parts/tabsContent/styles.js +15 -39
  19. package/cjs/parts/tabsPanel/TabsPanels.js +58 -60
  20. package/cjs/parts/tabsPanel/styles.js +23 -43
  21. package/cjs/propTypes.js +29 -54
  22. package/cjs/utils/constants.js +16 -44
  23. package/cjs/utils/helpers.js +50 -46
  24. package/cjs/utils/hooks/useKeyboardNavigation.js +43 -59
  25. package/cjs/utils/hooks/useTabsCallbacks.js +26 -60
  26. package/esm/DSTabs.js +25 -24
  27. package/esm/DSTabsCTX.js +20 -22
  28. package/esm/DSTabsDatatestid.js +10 -13
  29. package/esm/DSTabsTypes.js +1 -2
  30. package/esm/config/useCrossRef.js +4 -6
  31. package/esm/config/useTabs.js +22 -14
  32. package/esm/defaultProps.js +8 -9
  33. package/esm/exportsRelated/DSTab.js +19 -15
  34. package/esm/index.js +4 -9
  35. package/esm/parts/carousel/Carousel.js +38 -25
  36. package/esm/parts/carousel/styles.js +52 -48
  37. package/esm/parts/carousel/useCarousel.js +34 -15
  38. package/esm/parts/carousel/useCarouselCallbacks.js +28 -20
  39. package/esm/parts/tabBar/TabBar.js +110 -93
  40. package/esm/parts/tabBar/styles.js +183 -262
  41. package/esm/parts/tabBar/useTabBar.js +35 -35
  42. package/esm/parts/tabsContent/TabsContent.js +35 -19
  43. package/esm/parts/tabsContent/styles.js +7 -10
  44. package/esm/parts/tabsPanel/TabsPanels.js +45 -28
  45. package/esm/parts/tabsPanel/styles.js +15 -14
  46. package/esm/propTypes.js +24 -25
  47. package/esm/utils/constants.js +8 -15
  48. package/esm/utils/helpers.js +38 -16
  49. package/esm/utils/hooks/useKeyboardNavigation.js +39 -30
  50. package/esm/utils/hooks/useTabsCallbacks.js +21 -30
  51. package/package.json +6 -6
  52. package/types/DSTabs.d.ts +2 -2
  53. package/types/DSTabsTypes.d.ts +4 -0
  54. package/types/utils/helpers.d.ts +2 -1
  55. package/cjs/DSTabs.js.map +0 -7
  56. package/cjs/DSTabsCTX.js.map +0 -7
  57. package/cjs/DSTabsDatatestid.js.map +0 -7
  58. package/cjs/DSTabsTypes.js.map +0 -7
  59. package/cjs/config/useCrossRef.js.map +0 -7
  60. package/cjs/config/useTabs.js.map +0 -7
  61. package/cjs/defaultProps.js.map +0 -7
  62. package/cjs/exportsRelated/DSTab.js.map +0 -7
  63. package/cjs/index.js.map +0 -7
  64. package/cjs/parts/carousel/Carousel.js.map +0 -7
  65. package/cjs/parts/carousel/styles.js.map +0 -7
  66. package/cjs/parts/carousel/useCarousel.js.map +0 -7
  67. package/cjs/parts/carousel/useCarouselCallbacks.js.map +0 -7
  68. package/cjs/parts/tabBar/TabBar.js.map +0 -7
  69. package/cjs/parts/tabBar/styles.js.map +0 -7
  70. package/cjs/parts/tabBar/useTabBar.js.map +0 -7
  71. package/cjs/parts/tabsContent/TabsContent.js.map +0 -7
  72. package/cjs/parts/tabsContent/styles.js.map +0 -7
  73. package/cjs/parts/tabsPanel/TabsPanels.js.map +0 -7
  74. package/cjs/parts/tabsPanel/styles.js.map +0 -7
  75. package/cjs/propTypes.js.map +0 -7
  76. package/cjs/utils/constants.js.map +0 -7
  77. package/cjs/utils/helpers.js.map +0 -7
  78. package/cjs/utils/hooks/useKeyboardNavigation.js.map +0 -7
  79. package/cjs/utils/hooks/useTabsCallbacks.js.map +0 -7
  80. package/esm/DSTabs.js.map +0 -7
  81. package/esm/DSTabsCTX.js.map +0 -7
  82. package/esm/DSTabsDatatestid.js.map +0 -7
  83. package/esm/DSTabsTypes.js.map +0 -7
  84. package/esm/config/useCrossRef.js.map +0 -7
  85. package/esm/config/useTabs.js.map +0 -7
  86. package/esm/defaultProps.js.map +0 -7
  87. package/esm/exportsRelated/DSTab.js.map +0 -7
  88. package/esm/index.js.map +0 -7
  89. package/esm/parts/carousel/Carousel.js.map +0 -7
  90. package/esm/parts/carousel/styles.js.map +0 -7
  91. package/esm/parts/carousel/useCarousel.js.map +0 -7
  92. package/esm/parts/carousel/useCarouselCallbacks.js.map +0 -7
  93. package/esm/parts/tabBar/TabBar.js.map +0 -7
  94. package/esm/parts/tabBar/styles.js.map +0 -7
  95. package/esm/parts/tabBar/useTabBar.js.map +0 -7
  96. package/esm/parts/tabsContent/TabsContent.js.map +0 -7
  97. package/esm/parts/tabsContent/styles.js.map +0 -7
  98. package/esm/parts/tabsPanel/TabsPanels.js.map +0 -7
  99. package/esm/parts/tabsPanel/styles.js.map +0 -7
  100. package/esm/propTypes.js.map +0 -7
  101. package/esm/utils/constants.js.map +0 -7
  102. package/esm/utils/helpers.js.map +0 -7
  103. package/esm/utils/hooks/useKeyboardNavigation.js.map +0 -7
  104. package/esm/utils/hooks/useTabsCallbacks.js.map +0 -7
@@ -1,294 +1,200 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
- }
18
- return target;
19
- };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
- var styles_exports = {};
29
- __export(styles_exports, {
30
- StyledRequiredMark: () => StyledRequiredMark,
31
- StyledSelectionIndicator: () => StyledSelectionIndicator,
32
- StyledSubTabsList: () => StyledSubTabsList,
33
- StyledTabButton: () => StyledTabButton,
34
- StyledTabList: () => StyledTabList,
35
- StyledTabWrapper: () => StyledTabWrapper
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
6
+ var styled = require('styled-components');
7
+ var dsSystem = require('@elliemae/ds-system');
8
+ var constants = require('../../utils/constants.js');
9
+
10
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
+
12
+ var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
13
+ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
14
+
15
+ var _templateObject;
16
+ const StyledSelectionIndicator = /*#__PURE__*/styled__default["default"].div.withConfig({
17
+ componentId: "sc-3hla56-0"
18
+ })(["position:absolute;height:3px;top:", ";margin-top:", ";pointer-events:none;transition:200ms cubic-bezier(0.36,0,1,1);z-index:10;", ""], _ref => {
19
+ let {
20
+ tabType,
21
+ isDSMobile
22
+ } = _ref;
23
+ if (isDSMobile) return "35px";
24
+ if (tabType === constants.TabTypes.NORMAL_SMALL) return "15px";
25
+ return "25px";
26
+ }, _ref2 => {
27
+ let {
28
+ theme
29
+ } = _ref2;
30
+ return theme.space.xxxs;
31
+ }, _ref3 => {
32
+ let {
33
+ isDSMobile
34
+ } = _ref3;
35
+ return isDSMobile ? " \n margin-left: 0;\n margin-top: 3px;\n " : "";
36
36
  });
37
- var React = __toESM(require("react"));
38
- var import_styled_components = __toESM(require("styled-components"));
39
- var import_ds_system = __toESM(require("@elliemae/ds-system"));
40
- var import_constants = __toESM(require("../../utils/constants"));
41
- const StyledSelectionIndicator = import_styled_components.default.div`
42
- position: absolute;
43
- height: 3px;
44
- top: ${({ tabType, isDSMobile }) => {
45
- if (isDSMobile)
46
- return `35px`;
47
- if (tabType === import_constants.TabTypes.NORMAL_SMALL)
48
- return `15px`;
49
- return `25px`;
50
- }};
51
- margin-top: ${({ theme }) => theme.space.xxxs};
52
- pointer-events: none;
53
- transition: 200ms cubic-bezier(0.36, 0, 1, 1);
54
- z-index: 10;
55
- ${({ isDSMobile }) => isDSMobile ? `
56
- margin-left: 0;
57
- margin-top: 3px;
58
- ` : ``}
59
- `;
60
- const mobileGradientsSettings = import_ds_system.css`
61
- ${({ theme, mobileGradients, isDSMobile, fixedTabsHeaders }) => {
62
- if (isDSMobile && !fixedTabsHeaders) {
63
- if (mobileGradients.right && mobileGradients.left)
64
- 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%);`;
65
- if (mobileGradients.right)
66
- return `background: linear-gradient(90deg, ${theme.colors.brand[200]} 0%, ${theme.colors.brand[200]} 80%, rgba(238,238,238,0) 100%);`;
67
- if (mobileGradients.left)
68
- return `background: linear-gradient(90deg, rgba(238,238,238,0) 0%, ${theme.colors.brand[200]} 20%, ${theme.colors.brand[200]} 100%);`;
69
- }
70
- return ``;
71
- }}
72
- `;
73
- const StyledTabWrapper = import_styled_components.default.div`
74
- display: flex;
75
- flex: 1;
76
- flex-wrap: nowrap;
77
- ${({ fixedTabsHeaders, isDSMobile }) => !fixedTabsHeaders && isDSMobile ? "" : "overflow-x: hidden;"}
78
- ${({ theme, isDSMobile }) => isDSMobile ? `border-bottom: 1px solid ${theme.colors.brand[300]};` : ``}
79
- `;
80
- const StyledTabButton = import_styled_components.default.button`
81
- position: relative;
82
- background-color: transparent;
83
- border: none;
84
- cursor: pointer;
85
- transition: 100ms cubic-bezier(0, 0, 0.42, 1);
86
- text-transform: ${({ tabType }) => tabType === import_constants.TabTypes.SUBTABS ? `capitalize` : `uppercase`};
87
- letter-spacing: 0px;
88
- white-space: nowrap;
89
- padding: 2px 0;
90
- margin-right: ${({ fixedTabsHeaders, isDSMobile }) => {
91
- if (fixedTabsHeaders)
92
- return "0px";
93
- if (!fixedTabsHeaders && isDSMobile)
94
- return "14px";
95
- return "16px";
96
- }};
97
-
98
- margin-left: ${({ fixedTabsHeaders, isDSMobile }) => {
99
- if (fixedTabsHeaders)
100
- return "0px";
101
- if (!fixedTabsHeaders && isDSMobile)
102
- return "14px";
103
- return "16px";
104
- }};
105
-
106
- color: ${({ theme }) => theme.colors.neutral[700]};
107
- ${(0, import_ds_system.onlySafariAndFirefox)("-webkit-text-stroke: 0.4px transparent;")}
108
-
109
- ${({ tabType }) => tabType === import_constants.TabTypes.NORMAL ? `height: 32px;` : `height: 22px;`}
110
-
111
- ${({ theme, isActive, disabled }) => isActive && !disabled ? `
112
- font-weight: ${theme.fontWeights.semibold};
113
- ${(0, import_ds_system.safariAndFirefoxBold)(`#353C46`)}
114
-
115
- &:hover {
116
- ${(0, import_ds_system.safariAndFirefoxBold)(`#1E79C2`)}
117
- }
118
-
119
- ` : `
120
-
121
- `}
122
-
123
- ${({ theme, disabled }) => disabled ? `
124
- color: ${theme.colors.neutral[500]};
125
- cursor: not-allowed;
126
- ` : `
127
- &:hover {
128
- color: ${theme.colors.brand[600]};
129
- }
130
- `}
131
-
132
-
133
- ${({ theme, showSeparator, tabType }) => showSeparator ? `
134
- &:not(:last-of-type):before
135
- {
136
- content: "";
137
- position: absolute;
138
- width: 1px;
139
- right: -16px;
140
- top: 50%;
141
- transform: translateY(-50%);
142
- height: ${tabType === import_constants.TabTypes.SUBTABS ? `10px` : `16px`};
143
- background: ${theme.colors.neutral[400]};
144
- }` : ``}
145
-
146
- ${({ theme, isDSMobile, tabType, isActive }) => !isDSMobile ? `
147
- &:focus {
148
- outline: none;
149
- &:after {
150
- position: absolute;
151
- content: '';
152
- top: 0;
153
- left: -16px;
154
- width: calc(100% + 32px);
155
- height: 100%;
156
- z-index: 5;
157
- border-radius: 2px;
158
- border: 2px solid ${theme.colors.brand[700]};
159
- }
160
-
161
- ${tabType !== import_constants.TabTypes.SUBTABS && isActive ? `
162
- &:before {
163
- position: absolute;
164
- content: '';
165
- left: -16px;
166
- right: 0;
167
- top: calc(100% - 2px);
168
- transform: none;
169
- width: calc(100% + 32px);
170
- height: 2px;
171
- z-index: 10;
172
- 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%);
173
- }
174
- ` : ``}
175
- }
176
-
177
- ` : ``}
178
-
179
-
180
-
181
- ${({ theme, isActive, disabled, isDSMobile }) => isDSMobile ? `
182
- height: 40px;
183
- color: ${theme.colors.brand[600]};
184
- font-weight: ${theme.fontWeights.regular};
185
- padding: 0;
186
- font-size: 13px;
187
- line-height: 1.3;
188
- ${(0, import_ds_system.onlySafariAndFirefox)("-webkit-text-stroke: 0.4px transparent;")}
189
-
190
- &:focus {
191
- font-weight: ${theme.fontWeights.regular};
192
- font-size: 13px;
193
- ${(0, import_ds_system.safariAndFirefoxBold)("#006AA9")}
194
- }
195
-
196
- ${isActive ? `
197
- font-weight: ${theme.fontWeights.regular};
198
- font-size: 13px;
199
- ${(0, import_ds_system.safariAndFirefoxBold)("#006AA9")}
200
- ` : ``}
201
-
202
- ${isActive && !disabled ? `
203
- font-size: 13px;
204
- color: ${theme.colors.brand[700]};
205
- line-height: 1.3;
206
- font-weight: ${theme.fontWeights.regular};
207
- -webkit-font-smoothing: subpixel-antialiased;
208
- -webkit-text-stroke: 0.4px ${theme.colors.brand[700]};` : ``}
37
+ const mobileGradientsSettings = dsSystem.css(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n ", "\n"])), _ref4 => {
38
+ let {
39
+ theme,
40
+ mobileGradients,
41
+ isDSMobile,
42
+ fixedTabsHeaders
43
+ } = _ref4;
209
44
 
210
- ${!disabled ? `
211
- &:hover,
212
- &:focus {
213
- outline: none;
214
- color: ${theme.colors.brand[700]};
215
- ${(0, import_ds_system.safariAndFirefoxBold)("#006AA9")}
216
- }` : ``}
217
-
218
- ` : ``}
219
- `;
220
- const StyledSubTabsList = import_styled_components.default.div`
221
- position: relative;
222
- display: flex;
223
- flex-wrap: nowrap;
224
- flex: 1;
225
- width: 100%;
226
- ${({ withCarousel }) => withCarousel ? "max-width: 100%;" : ""}
227
- `;
228
- const StyledTabList = import_styled_components.default.div`
229
- position: relative;
230
- display: flex;
231
- flex-wrap: nowrap;
232
- flex: 1;
233
- width: 100%;
234
- ${({ withCarousel, isDSMobile }) => withCarousel && !isDSMobile ? `max-width: 100%;` : ""}
235
-
236
- ${({ theme, isDSMobile, tabType }) => tabType !== import_constants.TabTypes.NORMAL_SMALL && !isDSMobile ? `
237
- &:after {
238
- content: '';
239
- position: absolute;
240
- width: 100%;
241
- height: 1px;
242
- box-shadow: 0px 0px 0px 1px ${theme.colors.neutral[400]};
243
- pointer-events: none;
244
- bottom: 0px;
245
- }
246
- ` : ``}
247
-
248
- ${StyledTabButton} {
249
- padding-bottom: 0;
250
- padding-top: 0;
45
+ if (isDSMobile && !fixedTabsHeaders) {
46
+ 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%);");
47
+ 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%);");
48
+ 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%);");
251
49
  }
252
50
 
253
- ${({ theme, isDSMobile }) => isDSMobile ? `
254
-
255
- background: ${theme.colors.brand[200]};` : ``}
256
-
257
- ${mobileGradientsSettings}
258
-
259
-
260
- ${({ isDSMobile, fixedTabsHeaders }) => isDSMobile ? `
261
- ${!fixedTabsHeaders ? `
262
- z-index: 0;
263
- overflow-x: auto;
264
- overflow-y: hidden;
265
- scrollbar-width: thin;
266
- &::-webkit-scrollbar {
267
- display: none;
268
- }` : `
269
- display: flex;
270
- ${StyledTabButton} {
271
- flex: 1;
272
- overflow-x: hidden;
273
- }`}` : ``}
274
-
275
- ${StyledSelectionIndicator} {
276
- ${({ indicatorStyle }) => `
277
- width: ${indicatorStyle.width};
278
- left: ${indicatorStyle.left};
279
- `}
280
- }
51
+ return "";
52
+ });
53
+ const StyledTabWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
54
+ componentId: "sc-3hla56-1"
55
+ })(["display:flex;flex:1;flex-wrap:nowrap;", " ", ""], _ref5 => {
56
+ let {
57
+ fixedTabsHeaders,
58
+ isDSMobile
59
+ } = _ref5;
60
+ return !fixedTabsHeaders && isDSMobile ? '' : 'overflow-x: hidden;';
61
+ }, _ref6 => {
62
+ let {
63
+ theme,
64
+ isDSMobile
65
+ } = _ref6;
66
+ return isDSMobile ? "border-bottom: 1px solid ".concat(theme.colors.brand[300], ";") : "";
67
+ });
68
+ const StyledTabButton = /*#__PURE__*/styled__default["default"].button.withConfig({
69
+ componentId: "sc-3hla56-2"
70
+ })(["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 => {
71
+ let {
72
+ tabType
73
+ } = _ref7;
74
+ return tabType === constants.TabTypes.SUBTABS ? "capitalize" : "uppercase";
75
+ }, _ref8 => {
76
+ let {
77
+ fixedTabsHeaders,
78
+ isDSMobile
79
+ } = _ref8;
80
+ if (fixedTabsHeaders) return '0px';
81
+ if (!fixedTabsHeaders && isDSMobile) return '14px';
82
+ return '16px';
83
+ }, _ref9 => {
84
+ let {
85
+ fixedTabsHeaders,
86
+ isDSMobile
87
+ } = _ref9;
88
+ if (fixedTabsHeaders) return '0px';
89
+ if (!fixedTabsHeaders && isDSMobile) return '14px';
90
+ return '16px';
91
+ }, _ref10 => {
92
+ let {
93
+ theme
94
+ } = _ref10;
95
+ return theme.colors.neutral[700];
96
+ }, dsSystem.onlySafariAndFirefox('-webkit-text-stroke: 0.4px transparent;'), _ref11 => {
97
+ let {
98
+ tabType
99
+ } = _ref11;
100
+ return tabType === constants.TabTypes.NORMAL ? "height: 32px;" : "height: 22px;";
101
+ }, _ref12 => {
102
+ let {
103
+ theme,
104
+ isActive,
105
+ disabled
106
+ } = _ref12;
107
+ return isActive && !disabled ? "\n font-weight: ".concat(theme.fontWeights.semibold, ";\n ").concat(dsSystem.safariAndFirefoxBold("#353C46"), "\n\n &:hover {\n ").concat(dsSystem.safariAndFirefoxBold("#1E79C2"), "\n }\n \n ") : "\n \n ";
108
+ }, _ref13 => {
109
+ let {
110
+ theme,
111
+ disabled
112
+ } = _ref13;
113
+ 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 ");
114
+ }, _ref14 => {
115
+ let {
116
+ theme,
117
+ showSeparator,
118
+ tabType
119
+ } = _ref14;
120
+ 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 === constants.TabTypes.SUBTABS ? "10px" : "16px", ";\n background: ").concat(theme.colors.neutral[400], ";\n }") : "";
121
+ }, _ref15 => {
122
+ let {
123
+ theme,
124
+ isDSMobile,
125
+ tabType,
126
+ isActive
127
+ } = _ref15;
128
+ 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 !== constants.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 ") : "";
129
+ }, _ref16 => {
130
+ let {
131
+ theme,
132
+ isActive,
133
+ disabled,
134
+ isDSMobile
135
+ } = _ref16;
136
+ 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(dsSystem.onlySafariAndFirefox('-webkit-text-stroke: 0.4px transparent;'), " \n\n &:focus {\n font-weight: ").concat(theme.fontWeights.regular, ";\n font-size: 13px;\n ").concat(dsSystem.safariAndFirefoxBold('#006AA9'), "\n }\n\n ").concat(isActive ? "\n font-weight: ".concat(theme.fontWeights.regular, ";\n font-size: 13px;\n ").concat(dsSystem.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(dsSystem.safariAndFirefoxBold('#006AA9'), "\n }") : "", "\n\n ") : "";
137
+ });
138
+ const StyledSubTabsList = /*#__PURE__*/styled__default["default"].div.withConfig({
139
+ componentId: "sc-3hla56-3"
140
+ })(["position:relative;display:flex;flex-wrap:nowrap;flex:1;width:100%;", ""], _ref17 => {
141
+ let {
142
+ withCarousel
143
+ } = _ref17;
144
+ return withCarousel ? 'max-width: 100%;' : '';
145
+ });
146
+ const StyledTabList = /*#__PURE__*/styled__default["default"].div.withConfig({
147
+ componentId: "sc-3hla56-4"
148
+ })(["position:relative;display:flex;flex-wrap:nowrap;flex:1;width:100%;", " ", " ", "{padding-bottom:0;padding-top:0;}", " ", " ", " ", "{", "}", "{background:", ";}"], _ref18 => {
149
+ let {
150
+ withCarousel,
151
+ isDSMobile
152
+ } = _ref18;
153
+ return withCarousel && !isDSMobile ? "max-width: 100%;" : '';
154
+ }, _ref19 => {
155
+ let {
156
+ theme,
157
+ isDSMobile,
158
+ tabType
159
+ } = _ref19;
160
+ return tabType !== constants.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 ") : "";
161
+ }, StyledTabButton, _ref20 => {
162
+ let {
163
+ theme,
164
+ isDSMobile
165
+ } = _ref20;
166
+ return isDSMobile ? "\n \n background: ".concat(theme.colors.brand[200], ";") : "";
167
+ }, mobileGradientsSettings, _ref21 => {
168
+ let {
169
+ isDSMobile,
170
+ fixedTabsHeaders
171
+ } = _ref21;
172
+ 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 }")) : "";
173
+ }, StyledSelectionIndicator, _ref22 => {
174
+ let {
175
+ indicatorStyle
176
+ } = _ref22;
177
+ return "\n width: ".concat(indicatorStyle.width, ";\n left: ").concat(indicatorStyle.left, ";\n ");
178
+ }, StyledSelectionIndicator, _ref23 => {
179
+ let {
180
+ theme,
181
+ indicatorStyle,
182
+ isDSMobile
183
+ } = _ref23;
184
+ return !isDSMobile ? indicatorStyle.backgroundWithTransparent : theme.colors.brand[600];
185
+ });
186
+ const StyledRequiredMark = /*#__PURE__*/styled__default["default"].span.withConfig({
187
+ componentId: "sc-3hla56-5"
188
+ })(["color:", ";font-size:6px;margin-left:2px;position:absolute;top:5px;"], _ref24 => {
189
+ let {
190
+ theme
191
+ } = _ref24;
192
+ return theme.colors.danger[900];
193
+ });
281
194
 
282
- ${StyledSelectionIndicator} {
283
- background: ${({ theme, indicatorStyle, isDSMobile }) => !isDSMobile ? indicatorStyle.backgroundWithTransparent : theme.colors.brand[600]};
284
- }
285
- `;
286
- const StyledRequiredMark = import_styled_components.default.span`
287
- color: ${({ theme }) => theme.colors.danger[900]};
288
- font-size: 6px;
289
- margin-left: 2px;
290
- position: absolute;
291
- top: 5px;
292
- `;
293
- module.exports = __toCommonJS(styles_exports);
294
- //# sourceMappingURL=styles.js.map
195
+ exports.StyledRequiredMark = StyledRequiredMark;
196
+ exports.StyledSelectionIndicator = StyledSelectionIndicator;
197
+ exports.StyledSubTabsList = StyledSubTabsList;
198
+ exports.StyledTabButton = StyledTabButton;
199
+ exports.StyledTabList = StyledTabList;
200
+ exports.StyledTabWrapper = StyledTabWrapper;
@@ -1,101 +1,80 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __reExport = (target, module2, copyDefault, desc) => {
13
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
- for (let key of __getOwnPropNames(module2))
15
- if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
- }
18
- return target;
19
- };
20
- var __toESM = (module2, isNodeMode) => {
21
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
- };
23
- var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
- return (module2, temp) => {
25
- return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
- };
27
- })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
- var useTabBar_exports = {};
29
- __export(useTabBar_exports, {
30
- useTabBar: () => useTabBar
31
- });
32
- var React = __toESM(require("react"));
33
- var import_react = __toESM(require("react"));
34
- var import_resize_observer = __toESM(require("@react-hook/resize-observer"));
35
- var import_helpers = __toESM(require("../../utils/helpers"));
36
- var import_DSTabsCTX = __toESM(require("../../DSTabsCTX"));
37
- var import_constants = __toESM(require("../../utils/constants"));
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('core-js/modules/web.dom-collections.iterator.js');
6
+ var React = require('react');
7
+ var useResizeObserver = require('@react-hook/resize-observer');
8
+ var helpers = require('../../utils/helpers.js');
9
+ var DSTabsCTX = require('../../DSTabsCTX.js');
10
+ var constants = require('../../utils/constants.js');
11
+
12
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
+
14
+ var useResizeObserver__default = /*#__PURE__*/_interopDefaultLegacy(useResizeObserver);
15
+
38
16
  const useTabBar = () => {
39
17
  const {
40
18
  actualActiveTab,
41
19
  actualActiveTabRef,
42
20
  tabsListRef,
43
- props: { showSelectionIndicator, isDSMobile, fixedTabsHeaders }
44
- } = (0, import_react.useContext)(import_DSTabsCTX.DSTabsContext);
45
- const [mobileGradients, setMobileGradients] = (0, import_react.useState)({ left: false, right: false });
46
- const [indicatorStyle, setIndicatorStyle] = (0, import_react.useState)(import_constants.defaultIndicatorStyles);
47
- const getIndicatorStyles = (0, import_react.useCallback)(() => {
21
+ props: {
22
+ showSelectionIndicator,
23
+ isDSMobile,
24
+ fixedTabsHeaders
25
+ }
26
+ } = React.useContext(DSTabsCTX.DSTabsContext);
27
+ const [mobileGradients, setMobileGradients] = React.useState({
28
+ left: false,
29
+ right: false
30
+ });
31
+ const [indicatorStyle, setIndicatorStyle] = React.useState(constants.defaultIndicatorStyles);
32
+ const getIndicatorStyles = React.useCallback(() => {
48
33
  if (tabsListRef.current) {
49
34
  const tabList = tabsListRef.current;
50
35
  const activeTabButton = actualActiveTabRef.current;
51
- if (!activeTabButton || !(0, import_helpers.isElementVisible)(activeTabButton, tabList))
52
- return import_constants.defaultIndicatorStyles;
36
+ if (!activeTabButton || !helpers.isElementVisible(activeTabButton, tabList)) return constants.defaultIndicatorStyles; // The missingMargins are to make the selection indicator white marks work properly in desktop, we need
37
+ // the full width of the tab button with margins.
38
+
53
39
  const missingMargins = isDSMobile ? 0 : 16;
54
- const tabClientWidth = isDSMobile && !fixedTabsHeaders ? activeTabButton.clientWidth : activeTabButton.clientWidth + missingMargins * 2;
40
+ 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)
41
+ // behavior that adds scroll to the tabList
42
+
55
43
  const position = isDSMobile && !fixedTabsHeaders ? activeTabButton.getBoundingClientRect().left - tabList.getBoundingClientRect().left + tabList.scrollLeft : activeTabButton.getBoundingClientRect().left - tabList.getBoundingClientRect().left - missingMargins;
56
- const backgroundWithTransparent = `linear-gradient(to right, transparent 0px, transparent 16px, #1E79C2 16px, #1E79C2 ${tabClientWidth - 16}px,transparent ${tabClientWidth - 16}px,transparent ${tabClientWidth}px )`;
44
+ 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 )");
57
45
  return {
58
- left: `${position}px`,
59
- width: `${tabClientWidth}px`,
46
+ left: "".concat(position, "px"),
47
+ width: "".concat(tabClientWidth, "px"),
60
48
  backgroundWithTransparent
61
49
  };
62
50
  }
63
- return import_constants.defaultIndicatorStyles;
51
+
52
+ return constants.defaultIndicatorStyles;
64
53
  }, [actualActiveTabRef, fixedTabsHeaders, isDSMobile, tabsListRef]);
65
- const updateIndicatorStyle = (0, import_react.useCallback)(() => setTimeout(() => setIndicatorStyle(getIndicatorStyles()), 100), [getIndicatorStyles, setIndicatorStyle]);
66
- (0, import_resize_observer.default)(tabsListRef, updateIndicatorStyle);
67
- const updateMobileGradients = (0, import_react.useCallback)(() => {
54
+ const updateIndicatorStyle = React.useCallback(() => setTimeout(() => setIndicatorStyle(getIndicatorStyles()), 100), [getIndicatorStyles, setIndicatorStyle]);
55
+ useResizeObserver__default["default"](tabsListRef, updateIndicatorStyle);
56
+ const updateMobileGradients = React.useCallback(() => {
68
57
  if (tabsListRef.current && isDSMobile && !fixedTabsHeaders) {
69
- const { scrollLeft, scrollWidth, clientWidth } = tabsListRef.current;
58
+ const {
59
+ scrollLeft,
60
+ scrollWidth,
61
+ clientWidth
62
+ } = tabsListRef.current;
70
63
  setMobileGradients({
71
- left: (0, import_helpers.shouldHaveLeftGradient)(scrollLeft),
72
- right: (0, import_helpers.shouldHaveRightGradient)(scrollLeft, clientWidth, scrollWidth)
64
+ left: helpers.shouldHaveLeftGradient(scrollLeft),
65
+ right: helpers.shouldHaveRightGradient(scrollLeft, clientWidth, scrollWidth)
73
66
  });
74
67
  }
75
68
  }, [fixedTabsHeaders, isDSMobile, tabsListRef]);
76
- (0, import_react.useEffect)(() => {
77
- if (showSelectionIndicator) {
78
- updateIndicatorStyle();
79
- }
80
- if (isDSMobile && !fixedTabsHeaders) {
81
- updateMobileGradients();
82
- }
83
- }, [
84
- updateIndicatorStyle,
85
- showSelectionIndicator,
86
- actualActiveTab,
87
- updateMobileGradients,
88
- isDSMobile,
89
- fixedTabsHeaders
90
- ]);
91
- (0, import_react.useLayoutEffect)(() => {
69
+ React.useLayoutEffect(() => {
92
70
  if (showSelectionIndicator) {
93
71
  updateIndicatorStyle();
94
72
  }
73
+
95
74
  if (isDSMobile && !fixedTabsHeaders) {
96
75
  updateMobileGradients();
97
76
  }
98
- }, [updateMobileGradients, showSelectionIndicator, updateIndicatorStyle, isDSMobile, fixedTabsHeaders]);
77
+ }, [updateMobileGradients, showSelectionIndicator, updateIndicatorStyle, isDSMobile, fixedTabsHeaders, actualActiveTab]);
99
78
  return {
100
79
  updateIndicatorStyle,
101
80
  setIndicatorStyle,
@@ -104,5 +83,5 @@ const useTabBar = () => {
104
83
  updateMobileGradients
105
84
  };
106
85
  };
107
- module.exports = __toCommonJS(useTabBar_exports);
108
- //# sourceMappingURL=useTabBar.js.map
86
+
87
+ exports.useTabBar = useTabBar;