@bydata/react-supertabs 1.1.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.
@@ -0,0 +1,1196 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.emitter = exports["default"] = exports.SubTab = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactRouterDom = require("react-router-dom");
9
+ var _superDnd = require("super-dnd");
10
+ var _ClickOutsideListener = _interopRequireDefault(require("./ClickOutsideListener"));
11
+ var _reactHoverText = _interopRequireDefault(require("react-hover-text"));
12
+ var _superAvatar = _interopRequireDefault(require("super-avatar"));
13
+ var _SuperLink = _interopRequireDefault(require("./SuperLink"));
14
+ var _TabStack = _interopRequireDefault(require("./TabStack"));
15
+ var _TabContext = require("./TabContext");
16
+ var _eventEmitter = _interopRequireDefault(require("./eventEmitter"));
17
+ var _Utils = require("./Utils");
18
+ var _Constants = require("./Constants");
19
+ require("./SuperTabs.scss");
20
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
21
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
22
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
23
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
24
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
25
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
26
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
27
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
28
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
29
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
30
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
31
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
32
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
33
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
34
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
35
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
36
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
37
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
38
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
39
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
40
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
41
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
42
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } // components
43
+ // contexts
44
+ // services
45
+ // utils and constants
46
+ // styles
47
+ var emitter = exports.emitter = new _eventEmitter["default"]();
48
+ var tooltipStyles = {
49
+ position: "fixed",
50
+ zIndex: 100000,
51
+ boxShadow: "0px 1px 10px 0px rgba(0, 0, 0, 0.10)",
52
+ marginBottom: "5px",
53
+ minWidth: "fit-content"
54
+ };
55
+ var filterSubTabs = function filterSubTabs(subTabs) {
56
+ // const subTabsInList = [];
57
+ var subTabsInNavbar = [];
58
+ subTabs.forEach(function (subTab) {
59
+ if (subTab.order !== 0) {
60
+ subTabsInNavbar.push(subTab);
61
+ // } else {
62
+ // subTabsInList.push(subTab);
63
+ }
64
+ });
65
+ return {
66
+ subTabsInNavbar: subTabsInNavbar
67
+ };
68
+ // return { subTabsInList, subTabsInNavbar };
69
+ };
70
+ var getActiveParentTabName = function getActiveParentTabName(url, homeUrl) {
71
+ if (homeUrl === '/') {
72
+ return url.split('/')[1]; // ex. /organization/1 => organization, /recruiter/home => recruiter
73
+ }
74
+ return url.split('/')[2]; // ex. /app/organization/1 => organization, /app/recruiter/home => recruiter
75
+ };
76
+
77
+ // function calculateTransitionDuration(totalWidth, avgWidth = maxTabWidth) {
78
+ // // return (totalWidth / avgWidth) * 100;
79
+ // // return (totalWidth / transitionDurationExtended) * avgWidth;
80
+ // return (totalWidth / avgWidth) * transitionDurationExtended;
81
+ // }
82
+
83
+ var SuperTabs = function SuperTabs(_ref) {
84
+ var Suffix = _ref.Suffix;
85
+ var draggingTimeOutRef = (0, _react.useRef)(null);
86
+ var timeOutRef = (0, _react.useRef)(null);
87
+ var addButtonCallBackRefs = (0, _react.useRef)({});
88
+ var transitionTimeOutRef = (0, _react.useRef)(null);
89
+ var expandingTabIdRef = (0, _react.useRef)(null);
90
+ var _useTabContext = (0, _TabContext.useTabContext)(),
91
+ lastOpenedUrl = _useTabContext.lastOpenedUrl,
92
+ SITE_PAGES = _useTabContext.SITE_PAGES,
93
+ SITE_PREFIX = _useTabContext.SITE_PREFIX,
94
+ tabs = _useTabContext.tabs,
95
+ updateTabs = _useTabContext.updateTabs,
96
+ closeTab = _useTabContext.closeTab,
97
+ reorderTabs = _useTabContext.reorderTabs,
98
+ activeTab = _useTabContext.activeTab,
99
+ activeTabRef = _useTabContext.activeTabRef,
100
+ updateActiveTab = _useTabContext.updateActiveTab,
101
+ activeSubTab = _useTabContext.activeSubTab,
102
+ updateActiveSubTab = _useTabContext.updateActiveSubTab,
103
+ subTabWrapperWidth = _useTabContext.subTabWrapperWidth,
104
+ setSubTabWrapperWidth = _useTabContext.setSubTabWrapperWidth,
105
+ expandedTabID = _useTabContext.expandedTabID,
106
+ updateExpandedID = _useTabContext.updateExpandedID,
107
+ expandedTabIDRef = _useTabContext.expandedTabIDRef,
108
+ updateCurrentTab = _useTabContext.updateCurrentTab,
109
+ hasPrivilege = _useTabContext.hasPrivilege,
110
+ subTabChange = _useTabContext.subTabChange,
111
+ updateSubTabChange = _useTabContext.updateSubTabChange,
112
+ superTabsWrapperElemRef = _useTabContext.superTabsWrapperElemRef,
113
+ maxWidth = _useTabContext.maxWidth,
114
+ updateMaxWidth = _useTabContext.updateMaxWidth,
115
+ resetMaxWidth = _useTabContext.resetMaxWidth,
116
+ currentEntityId = _useTabContext.currentEntityId,
117
+ homeUrl = _useTabContext.homeUrl,
118
+ preventHomeRedirect = _useTabContext.preventHomeRedirect,
119
+ hiddenExternalToolbars = _useTabContext.hiddenExternalToolbars,
120
+ tabModePreference = _useTabContext.tabModePreference,
121
+ isMobileView = _useTabContext.isMobileView,
122
+ isDefaultExpanded = _useTabContext.isDefaultExpanded;
123
+ var isMobile = window.innerWidth < 640;
124
+ (0, _react.useLayoutEffect)(function () {
125
+ var _superTabsWrapperElem;
126
+ if (!isDefaultExpanded) return;
127
+ var storedExpandedIds = JSON.parse(sessionStorage.getItem("".concat(SITE_PREFIX, "expandedIds"))) || [];
128
+ if (!storedExpandedIds.length) return;
129
+ (_superTabsWrapperElem = superTabsWrapperElemRef.current) === null || _superTabsWrapperElem === void 0 || (_superTabsWrapperElem = _superTabsWrapperElem.classList) === null || _superTabsWrapperElem === void 0 || _superTabsWrapperElem.add('nested-tabs-visible');
130
+ }, [isDefaultExpanded, SITE_PREFIX]);
131
+ (0, _react.useLayoutEffect)(function () {
132
+ _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
133
+ return _regenerator().w(function (_context) {
134
+ while (1) switch (_context.n) {
135
+ case 0:
136
+ _context.n = 1;
137
+ return document.fonts.load(_Constants.fontStyle);
138
+ case 1:
139
+ updateMaxWidth();
140
+ case 2:
141
+ return _context.a(2);
142
+ }
143
+ }, _callee);
144
+ }))();
145
+ }, [updateMaxWidth]);
146
+ var history = (0, _reactRouterDom.useHistory)();
147
+ var location = (0, _reactRouterDom.useLocation)();
148
+ var _useState = (0, _react.useState)(function (isDefaultExpanded) {
149
+ if (isDefaultExpanded) updateMaxWidth();
150
+ return isDefaultExpanded;
151
+ }),
152
+ _useState2 = _slicedToArray(_useState, 2),
153
+ isSubTabCollapsing = _useState2[0],
154
+ setIsSubTabCollapsing = _useState2[1];
155
+ var _useState3 = (0, _react.useState)(null),
156
+ _useState4 = _slicedToArray(_useState3, 2),
157
+ closingTabID = _useState4[0],
158
+ setClosingTabID = _useState4[1];
159
+ var _useState5 = (0, _react.useState)(false),
160
+ _useState6 = _slicedToArray(_useState5, 2),
161
+ showMainMenu = _useState6[0],
162
+ setShowMainMenu = _useState6[1];
163
+ var _useState7 = (0, _react.useState)(false),
164
+ _useState8 = _slicedToArray(_useState7, 2),
165
+ isHoveringBrand = _useState8[0],
166
+ setIsHoveringBrand = _useState8[1];
167
+
168
+ // Refs for hover timeout management
169
+ var hoverTimeoutRef = (0, _react.useRef)(null);
170
+ var hoverOffTimeoutRef = (0, _react.useRef)(null);
171
+ (0, _react.useEffect)(function () {
172
+ var unsub = emitter.subscribe('bindCallback', function (_ref3) {
173
+ var id = _ref3.id,
174
+ callback = _ref3.callback;
175
+ return addButtonCallBackRefs.current[id] = callback;
176
+ });
177
+ return unsub;
178
+ }, [activeTab]);
179
+
180
+ // for adjusting width and animation of subtab wrapper when we open new tab from tab list.
181
+ (0, _react.useLayoutEffect)(function () {
182
+ if (subTabChange && !expandedTabID) {
183
+ var _subTabChange$newTab, _subTabChange$oldTab;
184
+ if (!(subTabChange !== null && subTabChange !== void 0 && subTabChange.oldTab) || (subTabChange === null || subTabChange === void 0 || (_subTabChange$newTab = subTabChange.newTab) === null || _subTabChange$newTab === void 0 ? void 0 : _subTabChange$newTab.id) === (subTabChange === null || subTabChange === void 0 || (_subTabChange$oldTab = subTabChange.oldTab) === null || _subTabChange$oldTab === void 0 ? void 0 : _subTabChange$oldTab.id)) return;
185
+ var openingTab = document.querySelector("#tab-".concat(subTabChange.parentTabId, "-").concat(subTabChange.newTab.id.toString().replace('/', '-')));
186
+ var closingTab = document.querySelector("#tab-".concat(subTabChange.parentTabId, "-").concat(subTabChange.oldTab.id.toString().replace('/', '-')));
187
+ var subTabGroup = document.querySelector(".sub-tabs-wrapper.tab-".concat(subTabChange.parentTabId));
188
+ var openingTabWidth = openingTab.style.width;
189
+ var closingTabWidth = (0, _Utils.calculateWidth)({
190
+ text: (0, _Utils.getTitle)(subTabChange.oldTab),
191
+ hasAvatar: subTabChange.oldTab.showAvatar,
192
+ addMargin: true
193
+ });
194
+ var subTabGroupWidth = "".concat(subTabGroup.scrollWidth, "px");
195
+ var subTabGroupUpdatedWidth = (0, _Utils.getCssUnitDifference)(openingTabWidth, "-42px");
196
+
197
+ // const isNewTabSmaller = getCssUnitDifference(openingTabWidth, `${closingTabWidth}px`).includes('-');
198
+ // setSubTabWrapperWidth(subTabGroupUpdatedWidth)
199
+
200
+ if (closingTab) {
201
+ closingTab.style.width = "".concat(closingTabWidth, "px");
202
+ closingTab.style.marginLeft = "".concat(_Constants.MarginLeft, "px");
203
+ closingTab.classList.add('slide-out');
204
+ }
205
+ subTabGroup.style.width = subTabGroupWidth;
206
+ subTabGroup.style.transition = "width ".concat(_Constants.transitionDuration, "ms");
207
+ openingTab.style.width = "0px";
208
+ openingTab.style.marginLeft = "0px";
209
+ openingTab.style.transition = "opacity 50ms";
210
+ openingTab.style.opacity = "0";
211
+ setTimeout(function () {
212
+ if (closingTab) {
213
+ closingTab.style.opacity = "0";
214
+ closingTab.style.width = "0px";
215
+ closingTab.style.marginLeft = "0px";
216
+ }
217
+
218
+ // openingTab.classList.add('fade-in');
219
+ openingTab.style.width = openingTabWidth;
220
+ openingTab.style.marginLeft = "".concat(_Constants.MarginLeft, "px");
221
+
222
+ // if (!isNewTabSmaller) subTabGroup.style.width = subTabGroupUpdatedWidth;
223
+ // if (!isNewTabSmaller) setSubTabWrapperWidth(subTabGroupUpdatedWidth);
224
+ setSubTabWrapperWidth(function (prev) {
225
+ return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, currentEntityId + '_' + activeTabRef.current.id, subTabGroupUpdatedWidth));
226
+ });
227
+ subTabGroup.style.width = subTabGroupUpdatedWidth;
228
+ setTimeout(function () {
229
+ // subTabGroup.style.removeProperty('width');
230
+ openingTab.style.opacity = "1";
231
+ subTabGroup.style.removeProperty('transition');
232
+ // openingTab.style.removeProperty('transition');
233
+ // openingTab.style.removeProperty('opacity');
234
+ setTimeout(function () {
235
+ if (closingTab) closingTab.classList.remove('slide-out');
236
+ // if (isNewTabSmaller) subTabGroup.style.width = subTabGroupUpdatedWidth;
237
+ // if (isNewTabSmaller) setSubTabWrapperWidth(subTabGroupUpdatedWidth);
238
+ // if (isNewTabSmaller) {
239
+ // setSubTabWrapperWidth(prev => ({ ...prev, [activeTabRef.current.id]: subTabGroupUpdatedWidth }));
240
+ // subTabGroup.style.width = subTabGroupUpdatedWidth;
241
+ // }
242
+
243
+ setTimeout(function () {
244
+ // if (isNewTabSmaller) subTabGroup.style.removeProperty('transition');
245
+ updateSubTabChange(null);
246
+ }, _Constants.transitionDuration);
247
+
248
+ // subTabGroup.style.removeProperty('width');
249
+
250
+ // openingTab.style.removeProperty('width');
251
+ // openingTab.style.removeProperty('margin-left');
252
+ openingTab.style.removeProperty('transition');
253
+ openingTab.style.removeProperty('opacity');
254
+ }, _Constants.transitionDuration);
255
+ // parentSuperTab.style.removeProperty('width');
256
+ // subTabGroup.style.width = 'unset';
257
+ // parentSuperTab.style.width = 'unset';
258
+ // openingTab.classList.remove('fade-in');
259
+ }, _Constants.transitionDuration);
260
+ }, _Constants.transitionDuration);
261
+ }
262
+ }, [expandedTabID, subTabChange, currentEntityId]);
263
+
264
+ // useEffect(() => {
265
+ // const openedPage = SITE_PAGES.find(page => page.url === location.pathname);
266
+ // if (openedPage?.containsSubTabs) {
267
+ // toggleSubTabs(openedPage);
268
+ // }
269
+ // // eslint-disable-next-line react-hooks/exhaustive-deps
270
+ // }, [SITE_PAGES]);
271
+
272
+ (0, _react.useEffect)(function () {
273
+ SITE_PAGES.forEach(function (page) {
274
+ // const pageUrl = removeAfterLastSlashIfEndsWithHome(page.url);
275
+ // const locationPathname = removeAfterLastSlashIfEndsWithHome(location.pathname);
276
+
277
+ // console.log('pageUrl === locationPathname', page.url, location.pathname, pageUrl, locationPathname);
278
+
279
+ // if (pageUrl === locationPathname) {
280
+ // updateActiveTab(tabs.filter(tab => tab.url === page.url)[0]);
281
+ // } else {
282
+ // console.log('locationPathname else');
283
+ // }
284
+
285
+ if (page.url === location.pathname) {
286
+ updateTabs(function (prev) {
287
+ var newTabs = structuredClone(prev);
288
+ // Check by both URL and ID to prevent duplicates
289
+ var openedTabIndex = newTabs.findIndex(function (tab) {
290
+ return tab.url === page.url || tab.id === page.id;
291
+ });
292
+ if (openedTabIndex !== -1) {
293
+ // Page is already opened, update the lastOpened flag
294
+ newTabs = newTabs.map(function (tab, index) {
295
+ return _objectSpread(_objectSpread({}, tab), {}, {
296
+ lastOpened: index === openedTabIndex
297
+ });
298
+ });
299
+ return newTabs;
300
+ }
301
+ for (var i = 0; i < newTabs.length; i++) {
302
+ newTabs[i].lastOpened = false;
303
+ }
304
+ newTabs.push(_objectSpread(_objectSpread({}, page), {}, {
305
+ subTabs: [],
306
+ lastOpened: true
307
+ }));
308
+ return newTabs;
309
+ });
310
+ }
311
+ });
312
+ return function () {
313
+ if (draggingTimeOutRef.current) clearTimeout(draggingTimeOutRef.current);
314
+ };
315
+ }, [SITE_PAGES, location.pathname, updateTabs]);
316
+ (0, _react.useEffect)(function () {
317
+ return function () {
318
+ clearTimeout(timeOutRef.current);
319
+ clearTimeout(transitionTimeOutRef.current);
320
+ clearTimeout(hoverTimeoutRef.current);
321
+ clearTimeout(hoverOffTimeoutRef.current);
322
+ };
323
+ }, []);
324
+
325
+ // Hover handlers for brand wrapper
326
+ var handleBrandHoverEnter = function handleBrandHoverEnter() {
327
+ console.log('handleBrandHoverEnter', isMobile, preventHomeRedirect);
328
+
329
+ // Skip hover functionality on mobile devices to avoid conflicts
330
+ if (isMobile) return;
331
+
332
+ // Clear any existing hover-off timeout
333
+ if (hoverOffTimeoutRef.current) {
334
+ clearTimeout(hoverOffTimeoutRef.current);
335
+ hoverOffTimeoutRef.current = null;
336
+ }
337
+
338
+ // Set hover timeout with delay to prevent accidental triggers
339
+ hoverTimeoutRef.current = setTimeout(function () {
340
+ if (!preventHomeRedirect && !isMobile) {
341
+ setIsHoveringBrand(true);
342
+ setShowMainMenu(true);
343
+ }
344
+ }, 300); // 300ms delay before showing menu
345
+ };
346
+ var handleBrandHoverLeave = function handleBrandHoverLeave() {
347
+ // Skip hover functionality on mobile devices
348
+ if (isMobile) return;
349
+
350
+ // Clear any existing hover timeout
351
+ if (hoverTimeoutRef.current) {
352
+ clearTimeout(hoverTimeoutRef.current);
353
+ hoverTimeoutRef.current = null;
354
+ }
355
+
356
+ // Set hover-off timeout with delay to prevent flickering
357
+ hoverOffTimeoutRef.current = setTimeout(function () {
358
+ setIsHoveringBrand(false);
359
+ setShowMainMenu(false);
360
+ }, 150); // 150ms delay before hiding menu
361
+ };
362
+ var handleMenuHoverEnter = function handleMenuHoverEnter() {
363
+ // Skip hover functionality on mobile devices
364
+ if (isMobile) return;
365
+
366
+ // Clear hover-off timeout when user hovers over menu
367
+ if (hoverOffTimeoutRef.current) {
368
+ clearTimeout(hoverOffTimeoutRef.current);
369
+ hoverOffTimeoutRef.current = null;
370
+ }
371
+ };
372
+ var handleMenuHoverLeave = function handleMenuHoverLeave() {
373
+ // Skip hover functionality on mobile devices
374
+ if (isMobile) return;
375
+
376
+ // Start hide timeout when leaving menu
377
+ hoverOffTimeoutRef.current = setTimeout(function () {
378
+ setIsHoveringBrand(false);
379
+ setShowMainMenu(false);
380
+ }, 150);
381
+ };
382
+ var handleDragStart = function handleDragStart() {
383
+ var superTabsWrapperElem = superTabsWrapperElemRef.current;
384
+ if (superTabsWrapperElem) superTabsWrapperElem.classList.add('dragging-in-progress');
385
+ var tabsWithChildWrapperElem = document.querySelector('.tab-with-child-wrapper');
386
+ if (tabsWithChildWrapperElem) tabsWithChildWrapperElem.classList.add('dragging-in-progress');
387
+ };
388
+ var handleDragEnd = function handleDragEnd(res) {
389
+ var destination = res.destination,
390
+ source = res.source;
391
+ draggingTimeOutRef.current = setTimeout(function () {
392
+ var superTabsWrapperElem = superTabsWrapperElemRef.current;
393
+ if (superTabsWrapperElem) superTabsWrapperElem.classList.remove('dragging-in-progress');
394
+ }, _Constants.transitionDuration);
395
+ var tabsWithChildWrapperElem = document.querySelector('.tab-with-child-wrapper');
396
+ if (tabsWithChildWrapperElem) tabsWithChildWrapperElem.classList.remove('dragging-in-progress');
397
+ if (!destination) return;
398
+ if (destination.index === source.index) return;
399
+ reorderTabs({
400
+ tab: tabs[source.index],
401
+ order: destination.index + 1
402
+ });
403
+ updateTabs(function (prev) {
404
+ var updatedTabs = (0, _Utils.reorder)(prev, source.index, destination.index);
405
+ return updatedTabs;
406
+ });
407
+ };
408
+ var handleSubTabDragStart = function handleSubTabDragStart() {
409
+ var subTabsWrapperElem = document.querySelector('.sub-tabs-wrapper.expanded');
410
+ if (subTabsWrapperElem) subTabsWrapperElem.classList.add('dragging-in-progress');
411
+ };
412
+ var handleSubTabDragEnd = function handleSubTabDragEnd(res, parentId) {
413
+ draggingTimeOutRef.current = setTimeout(function () {
414
+ var subTabsWrapperElem = document.querySelector('.sub-tabs-wrapper.expanded');
415
+ if (subTabsWrapperElem) subTabsWrapperElem.classList.remove('dragging-in-progress');
416
+ }, _Constants.transitionDuration);
417
+ var destination = res.destination,
418
+ source = res.source;
419
+ if (!destination) return;
420
+ if (destination.index === source.index) return;
421
+ var parentIndex = tabs.findIndex(function (tab) {
422
+ return tab.id === parentId;
423
+ });
424
+ reorderTabs({
425
+ tab: tabs[parentIndex].subTabs.filter(function (t) {
426
+ return t.order !== 0;
427
+ })[source.index],
428
+ order: destination.index + 1
429
+ });
430
+ updateTabs(function (prev) {
431
+ var parentIndex = prev.findIndex(function (tab) {
432
+ return tab.id === activeTab.id;
433
+ });
434
+ var updatedTabs = (0, _Utils.reorderSubTabs)(prev[parentIndex].subTabs, source.index, destination.index);
435
+ prev[parentIndex].subTabs = updatedTabs;
436
+ return _toConsumableArray(prev);
437
+ });
438
+ };
439
+ var handleTabClose = function handleTabClose() {
440
+ var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
441
+ tab = _ref4.tab,
442
+ tabIndex = _ref4.tabIndex,
443
+ isSubTab = _ref4.isSubTab,
444
+ parentIndex = _ref4.parentIndex;
445
+ closeTab({
446
+ tab: tab,
447
+ isSubTab: isSubTab
448
+ });
449
+ updateSubTabChange(null);
450
+ var appId = !isSubTab ? tab.id : tabs[parentIndex].id;
451
+ emitter.emit('superTabClose', {
452
+ appId: appId,
453
+ tab: tab,
454
+ isSubTab: isSubTab
455
+ });
456
+
457
+ // const id = !isSubTab ? tab.id : activeTab.id;
458
+ if (isSubTab ? tabs[parentIndex].subTabs.length <= 2 : tab.id === expandedTabID) {
459
+ updateExpandedID(null);
460
+ }
461
+
462
+ // if (lastOpenedSubTabs.hasOwnProperty(appId)) {
463
+ // setLastOpenedSubTabs((prev) => {
464
+ // const updated = { ...prev };
465
+ // if (lastOpenedSubTabs[appId]?.id === tab.id) {
466
+ // updated[appId] = null;
467
+ // }
468
+ // return updated;
469
+ // });
470
+ // }
471
+
472
+ if (!isSubTab) {
473
+ if (activeSubTab.url && (0, _Utils.isChildPath)(tab.url, activeSubTab.url)) {
474
+ updateActiveSubTab({});
475
+ }
476
+ } else {
477
+ setSubTabWrapperWidth(function (prev) {
478
+ var updated = _objectSpread({}, prev);
479
+ delete updated[currentEntityId + '_' + appId];
480
+ return updated;
481
+ });
482
+ }
483
+ };
484
+ var toggleSubTabs = function toggleSubTabs(tab, subTabs) {
485
+ clearTimeout(timeOutRef.current);
486
+ var id = tab.id;
487
+ var isTabExpanded = expandedTabID === id;
488
+ if (isTabExpanded) {
489
+ setIsSubTabCollapsing(true);
490
+ transitionTimeOutRef.current = setTimeout(function () {
491
+ if (superTabsWrapperElemRef.current) superTabsWrapperElemRef.current.style.setProperty('--transition-duration-extended', "".concat(_Constants.transitionDuration, "ms"));
492
+ setIsSubTabCollapsing(false);
493
+ }, 1000);
494
+ setTimeout(function () {
495
+ resetMaxWidth(null);
496
+ }, 200);
497
+ } else {
498
+ if (superTabsWrapperElemRef.current) superTabsWrapperElemRef.current.style.setProperty('--transition-duration-extended', "".concat(_Constants.transitionDurationExtended, "ms"));
499
+ // expandedTabIDRef.current = id;
500
+ updateMaxWidth();
501
+ // let parentTabsWidth = HomeTabWidth;
502
+ // document.querySelectorAll('.parent-super-tab').forEach((elem) => {
503
+ // parentTabsWidth += (elem.offsetWidth + MainTabGap);
504
+ // });
505
+ // console.log('parentTabsWidth', parentTabsWidth);
506
+ }
507
+ if (isTabExpanded) {
508
+ // document.querySelectorAll('.sub-tabs-wrapper.expanded .sub-tab-group .sub-tab:not(.active, .show)').forEach((elem) => {
509
+ document.querySelectorAll(".tab-".concat(id, ".sub-tabs-wrapper .sub-tab-group .sub-tab:not(.active, .show)")).forEach(function (elem) {
510
+ elem.classList.add('hide-sub-tab');
511
+ });
512
+ timeOutRef.current = setTimeout(function () {
513
+ var _superTabsWrapperElem2;
514
+ // document.querySelectorAll('.sub-tabs-wrapper.expanded .sub-tab-group .sub-tab:not(.active, .show)').forEach((elem) => {
515
+ document.querySelectorAll(".tab-".concat(id, ".sub-tabs-wrapper .sub-tab-group .sub-tab:not(.active, .show)")).forEach(function (elem) {
516
+ elem.classList.remove('hide-sub-tab');
517
+ });
518
+ (_superTabsWrapperElem2 = superTabsWrapperElemRef.current) === null || _superTabsWrapperElem2 === void 0 || _superTabsWrapperElem2.classList.remove('nested-tabs-visible');
519
+ var storedExpandedIds = JSON.parse(sessionStorage.getItem("".concat(SITE_PREFIX, "expandedIds"))) || [];
520
+ if (storedExpandedIds.some(function (_ref5) {
521
+ var id = _ref5.id;
522
+ return id === tab.id;
523
+ })) {
524
+ sessionStorage.setItem("".concat(SITE_PREFIX, "expandedIds"), JSON.stringify(storedExpandedIds.filter(function (_ref6) {
525
+ var id = _ref6.id;
526
+ return id !== tab.id;
527
+ })));
528
+ }
529
+ updateExpandedID(null);
530
+ }, 200);
531
+ } else {
532
+ var _superTabsWrapperElem3;
533
+ // let subTabsWidth = 0;
534
+ // tab?.subTabs?.forEach(subTab => {
535
+ // // if (openedSubTab?.id !== subTab.id) {
536
+ // // const title = (subTab.title || subTab.name || (subTab?.firstName ? `${subTab.firstName} ${subTab.lastName || ''}` : 'Untitled')).trim();
537
+ // // subTabsWidth += calculateWidth(title, subTab.showAvatar);
538
+ // // }
539
+ // const title = (subTab.title || subTab.name || (subTab?.firstName ? `${subTab.firstName} ${subTab.lastName || ''}` : 'Untitled')).trim();
540
+ // subTabsWidth += calculateWidth({ text: title, hasAvatar: subTab.showAvatar, addMargin: true });
541
+ // })
542
+ // const transitionDuration = subTabsWidth > 0 ? calculateTransitionDuration(Math.ceil(subTabsWidth)) : transitionDurationExtended;
543
+ // superTabsWrapperElemRef.current?.style.setProperty('--transition-duration-extended', `${transitionDuration}ms`);
544
+ // console.log('transitionDuration', subTabsWidth, Math.ceil(subTabsWidth), transitionDuration);
545
+
546
+ (_superTabsWrapperElem3 = superTabsWrapperElemRef.current) === null || _superTabsWrapperElem3 === void 0 || _superTabsWrapperElem3.classList.add('nested-tabs-visible');
547
+ expandedTabIDRef.current = id;
548
+ updateExpandedID(id);
549
+ updateMaxWidth();
550
+ }
551
+ };
552
+ var closeSubTabStack = function closeSubTabStack() {
553
+ var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : expandedTabID;
554
+ clearTimeout(timeOutRef.current);
555
+ setClosingTabID(id);
556
+ if (expandingTabIdRef.current === id) {
557
+ var subTabOpenElem = document.querySelector(".tab-".concat(id, ".sub-tabs-wrapper .sub-tab-group .sub-tab.show"));
558
+ if (subTabOpenElem) {
559
+ subTabOpenElem.style.width = '0px';
560
+ }
561
+ }
562
+ var subTabElems = document.querySelectorAll(".tab-".concat(id, ".sub-tabs-wrapper .sub-tab-group .sub-tab"));
563
+ subTabElems === null || subTabElems === void 0 || subTabElems.forEach(function (elem) {
564
+ setTimeout(function () {
565
+ elem.classList.add('hide-sub-tab');
566
+ }, 0);
567
+ });
568
+ if (!expandingTabIdRef.current) {
569
+ subTabElems === null || subTabElems === void 0 || subTabElems.forEach(function (elem) {
570
+ elem.style.width = '0px';
571
+ elem.style.marginLeft = '0px';
572
+ });
573
+ }
574
+ updateExpandedID(null);
575
+ timeOutRef.current = setTimeout(function () {
576
+ setClosingTabID(null);
577
+ if (!expandingTabIdRef.current) {
578
+ var _superTabsWrapperElem4;
579
+ (_superTabsWrapperElem4 = superTabsWrapperElemRef.current) === null || _superTabsWrapperElem4 === void 0 || _superTabsWrapperElem4.classList.remove('nested-tabs-visible');
580
+ }
581
+ subTabElems === null || subTabElems === void 0 || subTabElems.forEach(function (elem) {
582
+ elem.classList.remove('hide-sub-tab');
583
+ });
584
+ if (expandingTabIdRef.current) expandingTabIdRef.current = null;
585
+ }, _Constants.transitionDurationExtended);
586
+ };
587
+ var handleTabClick = function handleTabClick() {
588
+ var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
589
+ tab = _ref7.tab,
590
+ parentId = _ref7.parentId,
591
+ isSubTab = _ref7.isSubTab,
592
+ _ref7$ignoreActiveTab = _ref7.ignoreActiveTabUpdate,
593
+ ignoreActiveTabUpdate = _ref7$ignoreActiveTab === void 0 ? false : _ref7$ignoreActiveTab,
594
+ _ref7$sort = _ref7.sort,
595
+ sort = _ref7$sort === void 0 ? false : _ref7$sort;
596
+ if (location.pathname === tab.url.split('?')[0]) return;
597
+ updateCurrentTab({
598
+ tab: tab,
599
+ ignoreActiveTabUpdate: ignoreActiveTabUpdate,
600
+ parentId: parentId,
601
+ isSubTab: isSubTab,
602
+ sort: sort
603
+ });
604
+ setTimeout(function () {
605
+ // expandedTabIDRef.current = null;
606
+ updateMaxWidth();
607
+ }, 0);
608
+ if (isSubTab) {
609
+ // lastOpenedUrl.current[parentId] = tab;
610
+ // updateActiveSubTab(tab);
611
+ // setLastOpenedSubTabs((prev) => {
612
+ // const updated = { ...prev };
613
+ // updated[parentId] = isSubTab ? tab : null;
614
+ // return updated;
615
+ // });
616
+ if (subTabWrapperWidth[currentEntityId + '_' + parentId]) {
617
+ setSubTabWrapperWidth(function (prev) {
618
+ var updated = _objectSpread({}, prev);
619
+ delete updated[currentEntityId + '_' + parentId];
620
+ return updated;
621
+ });
622
+ }
623
+ } else {
624
+ var storedExpandedIds = JSON.parse(sessionStorage.getItem("".concat(SITE_PREFIX, "expandedIds"))) || [];
625
+ var isTabExpanded = storedExpandedIds.find(function (_ref8) {
626
+ var id = _ref8.id;
627
+ return id === tab.id;
628
+ });
629
+ if (expandedTabID && tab.id !== expandedTabID) {
630
+ closeSubTabStack();
631
+ } else if (superTabsWrapperElemRef.current) {
632
+ // superTabsWrapperElemRef.current.style.setProperty('--transition-duration-extended', `${transitionDuration}ms`);
633
+ superTabsWrapperElemRef.current.style.setProperty('--transition-duration-extended', "".concat(isTabExpanded ? _Constants.transitionDurationExtended : _Constants.transitionDuration, "ms"));
634
+ // if (activeTab?.id && activeTab.id !== tab.id) closeSubTabStack(activeTab.id);
635
+ }
636
+ if (isTabExpanded) {
637
+ expandingTabIdRef.current = tab.id;
638
+ sessionStorage.setItem("".concat(SITE_PREFIX, "expandedIds"), JSON.stringify(storedExpandedIds.map(function (item) {
639
+ return _objectSpread(_objectSpread({}, item), {}, {
640
+ active: item.id === tab.id
641
+ });
642
+ })));
643
+ requestAnimationFrame(function () {
644
+ var _superTabsWrapperElem5;
645
+ updateExpandedID(tab.id);
646
+ (_superTabsWrapperElem5 = superTabsWrapperElemRef.current) === null || _superTabsWrapperElem5 === void 0 || (_superTabsWrapperElem5 = _superTabsWrapperElem5.classList) === null || _superTabsWrapperElem5 === void 0 || _superTabsWrapperElem5.add('nested-tabs-visible');
647
+ updateMaxWidth();
648
+ });
649
+ }
650
+ var subTabsWrapperElem = document.querySelectorAll('.sub-tabs-wrapper');
651
+ subTabsWrapperElem.forEach(function (elem) {
652
+ elem.style.transition = "width ease-out ".concat(expandedTabID ? _Constants.transitionDurationExtended : _Constants.transitionDuration, "ms");
653
+ });
654
+ setTimeout(function () {
655
+ subTabsWrapperElem.forEach(function (elem) {
656
+ elem.style.removeProperty('transition');
657
+ });
658
+ }, (expandedTabID ? _Constants.transitionDurationExtended : _Constants.transitionDuration) + 50);
659
+
660
+ // if (ignoreActiveTabUpdate) return;
661
+ // lastOpenedUrl.current[tab.id] = tab;
662
+ // updateActiveTab(tab);
663
+ // if (activeSubTab.url && isChildPath(tab.url, activeSubTab.url)) {
664
+ // updateActiveSubTab({});
665
+ // }
666
+ // updateActiveSubTab({});
667
+ // setLastOpenedSubTabs((prev) => {
668
+ // const updated = { ...prev };
669
+ // updated[tab.id] = null;
670
+ // return updated;
671
+ // });
672
+ }
673
+ };
674
+
675
+ // useEffect(() => {
676
+ // if (activeTab) {
677
+ // setLastOpenedSubTabs((prev) => {
678
+ // const updated = { ...prev };
679
+ // if (activeSubTab?.url && activeTab?.url && isChildPath(activeTab?.url, activeSubTab?.url)) {
680
+ // updated[activeTab.id] = activeSubTab;
681
+ // }
682
+ // return updated;
683
+ // });
684
+ // }
685
+ // }, [activeTab, activeSubTab]);
686
+
687
+ return /*#__PURE__*/_react["default"].createElement("div", {
688
+ className: "super-tabs-wrapper",
689
+ ref: superTabsWrapperElemRef
690
+ }, /*#__PURE__*/_react["default"].createElement(_reactRouterDom.NavLink, {
691
+ to: homeUrl,
692
+ className: "home-tab"
693
+ // activeClassName="active"
694
+ // title="Home"
695
+ ,
696
+ onMouseEnter: handleBrandHoverEnter,
697
+ onMouseLeave: handleBrandHoverLeave,
698
+ onClick: function onClick(e) {
699
+ if (preventHomeRedirect) {
700
+ e.preventDefault();
701
+ setShowMainMenu(true);
702
+ return;
703
+ }
704
+ // if (expandedTabID || activeTab?.id) {
705
+ if (expandedTabID) {
706
+ // updateExpandedID(null);
707
+ // closeSubTabStack(expandedTabID ?? activeTab.id);
708
+ closeSubTabStack(expandedTabID);
709
+ }
710
+ updateActiveTab({});
711
+ updateActiveSubTab({});
712
+ updateCurrentTab({
713
+ tab: (0, _Utils.getHomeTab)(homeUrl),
714
+ isHomeTab: true
715
+ });
716
+ },
717
+ exact: true
718
+ }, /*#__PURE__*/_react["default"].createElement("div", {
719
+ className: "brand-wrapper"
720
+ }, /*#__PURE__*/_react["default"].createElement("span", {
721
+ className: "brand-logo ".concat((0, _Utils.isDev)() ? 'dev' : '')
722
+ }))), showMainMenu && /*#__PURE__*/_react["default"].createElement(_ClickOutsideListener["default"], {
723
+ onOutsideClick: function onOutsideClick() {
724
+ // Only close via click outside if not triggered by hover
725
+ if (!isHoveringBrand) {
726
+ setShowMainMenu(false);
727
+ }
728
+ }
729
+ }, /*#__PURE__*/_react["default"].createElement("div", {
730
+ className: "app-pages-wrapper",
731
+ onMouseEnter: handleMenuHoverEnter,
732
+ onMouseLeave: handleMenuHoverLeave
733
+ }, SITE_PAGES.map(function (page, index) {
734
+ var _page$isExternal;
735
+ if (isMobile && !(page !== null && page !== void 0 && page.showInMobile) || !hasPrivilege(page.privilege)) {
736
+ return null;
737
+ }
738
+ return /*#__PURE__*/_react["default"].createElement("div", {
739
+ key: index,
740
+ className: "module",
741
+ onClick: function onClick() {
742
+ return setShowMainMenu(false);
743
+ }
744
+ }, /*#__PURE__*/_react["default"].createElement(_SuperLink["default"], {
745
+ tab: page,
746
+ isSubTab: false,
747
+ isExternal: (_page$isExternal = page.isExternal) !== null && _page$isExternal !== void 0 ? _page$isExternal : undefined
748
+ }, page.title));
749
+ }))), /*#__PURE__*/_react["default"].createElement(_superDnd.DragDropContext, {
750
+ onDragStart: handleDragStart,
751
+ onDragEnd: handleDragEnd
752
+ }, /*#__PURE__*/_react["default"].createElement(_superDnd.Droppable, {
753
+ droppableId: "HEADER_TABS",
754
+ direction: "horizontal"
755
+ }, function (provided) {
756
+ return /*#__PURE__*/_react["default"].createElement("div", _extends({
757
+ className: "main-tabs"
758
+ }, provided.droppableProps, {
759
+ ref: provided.innerRef
760
+ }), tabs.map(function (tab, index) {
761
+ var _tab$subTabs, _tab$subTabs2, _tab$subTabs3, _tab$subTabs4;
762
+ var url = tab.url;
763
+ var pathname = window.location.pathname;
764
+ var formattedPathname = getActiveParentTabName(pathname, homeUrl);
765
+ var tabUrl = getActiveParentTabName(tab.url, homeUrl);
766
+ if (tabUrl === formattedPathname) {
767
+ url = pathname;
768
+ }
769
+ var hasAccessToTab = hasPrivilege(tab.privilege);
770
+ var showNotificationDot = tab.showNotificationDot || false;
771
+ // const hasSubTabs = tab?.subTabs?.length > 0;
772
+ var containsSubTabs = tab === null || tab === void 0 ? void 0 : tab.containsSubTabs;
773
+ var showSubTabs = expandedTabID === tab.id;
774
+ var isTabClosing = closingTabID === tab.id;
775
+ var isActive = tabUrl === formattedPathname;
776
+
777
+ // const isActiveWithSubTabsExpanded = isActive && containsSubTabs && showSubTabs;
778
+ // const openedSubTab = lastOpenedSubTabs[tab.id];
779
+ // const isSubTabOpened = tab?.subTabs?.some(t => t.id === openedSubTab?.id)
780
+ // const subTabsLength = (isSubTabOpened ? tab?.subTabs?.length - 1 : tab?.subTabs?.length) || 0;
781
+ var hasAddBtnPrivilege = typeof tab.showAddButton === 'boolean' ? tab.showAddButton : _typeof(tab.showAddButton) === 'object' && Array.isArray(tab.showAddButton) ? hasPrivilege(tab.showAddButton) : false;
782
+ var showAddButton = hasAddBtnPrivilege && !isMobileView ? (tab === null || tab === void 0 || (_tab$subTabs = tab.subTabs) === null || _tab$subTabs === void 0 ? void 0 : _tab$subTabs.length) <= 1 : false;
783
+ var showChevron = (tab === null || tab === void 0 || (_tab$subTabs2 = tab.subTabs) === null || _tab$subTabs2 === void 0 ? void 0 : _tab$subTabs2.length) > 1;
784
+ var widthLessThan520 = window.innerWidth < 520;
785
+ var isMobileScreen = window.innerWidth < 640;
786
+ if (widthLessThan520 && !tab.lastOpened && !tab.isFixed) return null;
787
+ var shrinkedTab = tab.id === expandedTabID ? false : expandedTabID;
788
+ var additionalWidth = 0; // tab.url === pathname ? 24 : 0 + hiddenExternalToolbars[tab.id] ? 24 : 0;
789
+ var width = (0, _Utils.getTextWidth)(tab.title, _Constants.fontStyle) + 42 + additionalWidth;
790
+ var subTabWithOpenOrderOne = (tab === null || tab === void 0 || (_tab$subTabs3 = tab.subTabs) === null || _tab$subTabs3 === void 0 ? void 0 : _tab$subTabs3.length) >= 1 && tab.subTabs.find(function (t) {
791
+ return t.open_order === 1;
792
+ });
793
+ var isSubTabActive = tab.url !== pathname && isActive;
794
+ var hasCloseButton = false; // isSubTabActive; // TODO: This will be used in next release (pending for design update)
795
+ var hasToolbarButton = tab.url !== pathname && hiddenExternalToolbars[subTabWithOpenOrderOne === null || subTabWithOpenOrderOne === void 0 ? void 0 : subTabWithOpenOrderOne.id];
796
+ var subTabWithOpenOrderOneWidth = subTabWithOpenOrderOne && (0, _Utils.calculateWidth)({
797
+ text: (0, _Utils.getTitle)(subTabWithOpenOrderOne),
798
+ hasAvatar: subTabWithOpenOrderOne.showAvatar,
799
+ hasCloseButton: hasCloseButton,
800
+ hasToolbarButton: hasToolbarButton
801
+ });
802
+ var isExpandedTab = expandedTabID === tab.id;
803
+ var subTabsWidth = isDefaultExpanded && isExpandedTab ? tab === null || tab === void 0 || (_tab$subTabs4 = tab.subTabs) === null || _tab$subTabs4 === void 0 ? void 0 : _tab$subTabs4.map(function (subTab) {
804
+ var title = (0, _Utils.getTitle)(subTab);
805
+ return (0, _Utils.calculateWidth)({
806
+ text: title,
807
+ hasAvatar: subTab.showAvatar,
808
+ hasCloseButton: hasCloseButton,
809
+ hasToolbarButton: hasToolbarButton,
810
+ addMargin: true
811
+ });
812
+ }).reduce(function (acc, width) {
813
+ return acc + width;
814
+ }, 0) : subTabWithOpenOrderOneWidth || 0;
815
+ var getItemStyle = function getItemStyle(draggableStyle) {
816
+ return _objectSpread({
817
+ maxWidth: expandedTabID ? "".concat(tab.width + additionalWidth || width, "px") : "".concat(width, "px")
818
+ }, draggableStyle);
819
+ };
820
+ var _filterSubTabs = filterSubTabs(tab.subTabs),
821
+ subTabsInNavbar = _filterSubTabs.subTabsInNavbar;
822
+ var getStylesForSubTabsWrapper = function getStylesForSubTabsWrapper(tab, isActive) {
823
+ if (isActive) {
824
+ if (showSubTabs || isSubTabCollapsing || !subTabsWidth) {
825
+ return {
826
+ width: '100%'
827
+ };
828
+ } else if (subTabWrapperWidth[currentEntityId + '_' + tab.id] && isSubTabActive) {
829
+ return {
830
+ width: subTabWrapperWidth[currentEntityId + '_' + tab.id] + (hasToolbarButton ? _Constants.ToolbarButtonWidth : 0)
831
+ };
832
+ } else {
833
+ return {
834
+ width: "".concat(subTabsWidth + (showChevron || showAddButton ? 42 : 5), "px")
835
+ };
836
+ }
837
+ }
838
+ return {
839
+ width: '0px'
840
+ };
841
+ };
842
+ return containsSubTabs ? /*#__PURE__*/_react["default"].createElement(_superDnd.Draggable, {
843
+ draggableId: String(index),
844
+ index: index,
845
+ key: index,
846
+ isDragDisabled: isMobileScreen
847
+ }, function (provided, snapshot) {
848
+ return /*#__PURE__*/_react["default"].createElement("div", _extends({}, provided.draggableProps, provided.dragHandleProps, {
849
+ ref: provided.innerRef
850
+ // (snapshot.isDragging ? " dragging" : "") +
851
+ ,
852
+ className: 'tab-with-child-wrapper parent-super-tab' + " tab-".concat(tab.id) + (isActive ? ' active' : '') + (closingTabID === tab.id ? ' stack-closing' : '') + (shrinkedTab ? ' shrinked-parent-tab' : '') + (snapshot.isDragging ? ' dragging' : '')
853
+ }), /*#__PURE__*/_react["default"].createElement("div", {
854
+ className: 'child-tabs-wrapper tab-' + tab.id + (showSubTabs ? ' expanded' : '')
855
+ // (isActive ? ' active' : '')
856
+ }, /*#__PURE__*/_react["default"].createElement(_reactHoverText["default"], {
857
+ content: tab.title,
858
+ delay: 500,
859
+ followCursor: true,
860
+ placement: "bottom",
861
+ stylingOptions: tooltipStyles
862
+ }, /*#__PURE__*/_react["default"].createElement(_reactRouterDom.NavLink, {
863
+ to: tab.url,
864
+ className: "tab" + " tab-" + tab.id + ((expandedTabID ? tab.width : maxWidth) && (0, _Utils.compareDecimals)(expandedTabID ? tab.width || width : maxWidth, width) === -1 ? ' fade-at-end' : '') + (!hasAccessToTab ? ' disabled-tab' : '') + (containsSubTabs ? ' has-child' : '') + (shrinkedTab ? ' shrinked-tab' : '')
865
+ // (showSubTabs ? ' expanded' : '')
866
+ ,
867
+ style: {
868
+ maxWidth: expandedTabID ? "".concat((tab.width + additionalWidth || width) - 10, "px") : "".concat(width, "px")
869
+ }
870
+ // title={tab.title}
871
+ ,
872
+ onClick: function onClick(e) {
873
+ var ignoreActiveTabUpdate = false;
874
+ if (containsSubTabs && !isActive) {
875
+ var _lastOpenedUrl$curren;
876
+ var lastOpenedTab = (_lastOpenedUrl$curren = lastOpenedUrl.current) === null || _lastOpenedUrl$curren === void 0 ? void 0 : _lastOpenedUrl$curren[currentEntityId + '_' + tab.id];
877
+ updateActiveTab(tab);
878
+ ignoreActiveTabUpdate = true;
879
+ var lastOpenedTabUrl = lastOpenedTab === null || lastOpenedTab === void 0 ? void 0 : lastOpenedTab.url;
880
+ if (lastOpenedTabUrl && tabModePreference.includes(lastOpenedTab === null || lastOpenedTab === void 0 ? void 0 : lastOpenedTab.tabId)) {
881
+ lastOpenedTabUrl += "?edit=true";
882
+ }
883
+ if (lastOpenedTab !== null && lastOpenedTab !== void 0 && lastOpenedTab.url && (lastOpenedTab === null || lastOpenedTab === void 0 ? void 0 : lastOpenedTab.url) !== tab.url) {
884
+ e.preventDefault();
885
+ if ((lastOpenedTab === null || lastOpenedTab === void 0 ? void 0 : lastOpenedTab.url) !== tab.url) {
886
+ updateActiveSubTab(lastOpenedTab || {});
887
+ // setLastOpenedSubTabs((prev) => {
888
+ // const updated = { ...prev };
889
+ // updated[tab.id] = lastOpenedTab;
890
+ // return updated;
891
+ // });
892
+ }
893
+ history.push(lastOpenedTabUrl || tab.url);
894
+ // } else {
895
+ // setTimeout(() => {
896
+ // toggleSubTabs(tab);
897
+ // }, 0);
898
+ }
899
+ }
900
+ handleTabClick({
901
+ tab: tab,
902
+ parentId: tab.id,
903
+ ignoreActiveTabUpdate: ignoreActiveTabUpdate
904
+ });
905
+ },
906
+ exact: tab.fixed
907
+ }, /*#__PURE__*/_react["default"].createElement(TabContentWrapper, {
908
+ tab: tab,
909
+ index: index,
910
+ isActive: tab.url === pathname,
911
+ handleTabClose: handleTabClose,
912
+ isSubTab: false,
913
+ containsSubTabs: containsSubTabs,
914
+ SITE_PREFIX: SITE_PREFIX,
915
+ Suffix: (Suffix === null || Suffix === void 0 ? void 0 : Suffix[tab === null || tab === void 0 ? void 0 : tab.id]) || null
916
+ })))), containsSubTabs && /*#__PURE__*/_react["default"].createElement("div", {
917
+ className: "sub-tabs-wrapper tab-".concat(tab.id, " ").concat(showSubTabs ? 'expanded' : ''),
918
+ style: getStylesForSubTabsWrapper(tab, isActive)
919
+ }, /*#__PURE__*/_react["default"].createElement(_superDnd.DragDropContext, {
920
+ onDragStart: handleSubTabDragStart,
921
+ onDragEnd: function onDragEnd(res) {
922
+ return handleSubTabDragEnd(res, tab.id);
923
+ }
924
+ }, /*#__PURE__*/_react["default"].createElement(_superDnd.Droppable, {
925
+ droppableId: "HEADER_SUB_TABS_".concat(tab.id),
926
+ direction: "horizontal"
927
+ }, function (subprovided) {
928
+ return /*#__PURE__*/_react["default"].createElement("div", _extends({
929
+ className: "sub-tab-group",
930
+ ref: subprovided.innerRef
931
+ }, subprovided.droppableProps), subTabsInNavbar.map(function (subTab, subIndex) {
932
+ return /*#__PURE__*/_react["default"].createElement(SubTab, {
933
+ activeTab: activeTab,
934
+ closingTabID: closingTabID,
935
+ expandedTabID: expandedTabID,
936
+ maxWidth: maxWidth,
937
+ showSubTabs: showSubTabs,
938
+ subIndex: subIndex,
939
+ hasSingleSubTab: tab.subTabs.length === 1,
940
+ subTab: subTab,
941
+ tab: tab,
942
+ tabUrl: tabUrl,
943
+ handleTabClick: handleTabClick,
944
+ handleTabClose: handleTabClose,
945
+ SITE_PREFIX: SITE_PREFIX,
946
+ index: index,
947
+ key: subTab.id
948
+ });
949
+ }), subprovided.placeholder);
950
+ })), (showChevron || showAddButton) && /*#__PURE__*/_react["default"].createElement(_TabStack["default"], {
951
+ handleTabClick: handleTabClick,
952
+ handleTabClose: handleTabClose,
953
+ index: index,
954
+ isActive: isActive,
955
+ isTabClosing: isTabClosing,
956
+ showAddButton: showAddButton,
957
+ showChevron: showChevron,
958
+ showSubTabs: showSubTabs,
959
+ subTabsInList: tab.subTabs,
960
+ tab: tab,
961
+ toggleSubTabs: toggleSubTabs,
962
+ addButtonCallBackRefs: addButtonCallBackRefs,
963
+ SITE_PREFIX: SITE_PREFIX,
964
+ isMobileView: isMobileView
965
+ })));
966
+ }) : /*#__PURE__*/_react["default"].createElement(_superDnd.Draggable, {
967
+ key: index,
968
+ draggableId: String(index),
969
+ index: index,
970
+ isDragDisabled: isMobileScreen
971
+ }, function (provided, snapshot) {
972
+ return /*#__PURE__*/_react["default"].createElement(_reactHoverText["default"], {
973
+ content: tab.title,
974
+ delay: 500,
975
+ followCursor: true,
976
+ placement: "bottom",
977
+ stylingOptions: tooltipStyles
978
+ }, /*#__PURE__*/_react["default"].createElement(_reactRouterDom.NavLink, _extends({}, provided.draggableProps, provided.dragHandleProps, {
979
+ ref: provided.innerRef,
980
+ to: url,
981
+ onClick: function onClick() {
982
+ handleTabClick({
983
+ tab: tab
984
+ });
985
+ },
986
+ className: "tab parent-super-tab" + (snapshot.isDragging ? " dragging" : "") + (maxWidth && (0, _Utils.compareDecimals)(maxWidth, width) === -1 ? ' fade-at-end' : '') + (expandedTabID ? ' shrinked-tab' : '') + (!hasAccessToTab ? " disabled-tab" : ""),
987
+ style: getItemStyle(provided.draggableProps.style),
988
+ exact: true
989
+ // exact={tab.exact}
990
+ // title={tab.title}
991
+ }), /*#__PURE__*/_react["default"].createElement(TabContentWrapper, {
992
+ tab: tab,
993
+ index: index,
994
+ isActive: tab.url === pathname,
995
+ showNotificationDot: showNotificationDot,
996
+ handleTabClose: handleTabClose,
997
+ isSubTab: false,
998
+ SITE_PREFIX: SITE_PREFIX,
999
+ Suffix: (Suffix === null || Suffix === void 0 ? void 0 : Suffix[tab === null || tab === void 0 ? void 0 : tab.id]) || null
1000
+ })));
1001
+ });
1002
+ }), provided.placeholder);
1003
+ })));
1004
+ };
1005
+ var TabContentWrapper = function TabContentWrapper(_ref9) {
1006
+ var tab = _ref9.tab,
1007
+ index = _ref9.index,
1008
+ tabTitle = _ref9.tabTitle,
1009
+ _ref9$isActive = _ref9.isActive,
1010
+ isActive = _ref9$isActive === void 0 ? false : _ref9$isActive,
1011
+ handleTabClose = _ref9.handleTabClose,
1012
+ isSubTab = _ref9.isSubTab,
1013
+ _ref9$Suffix = _ref9.Suffix,
1014
+ Suffix = _ref9$Suffix === void 0 ? null : _ref9$Suffix,
1015
+ parentIndex = _ref9.parentIndex,
1016
+ containsSubTabs = _ref9.containsSubTabs,
1017
+ setShowTooltip = _ref9.setShowTooltip;
1018
+ // const isFixed = tab.isFixed || false;
1019
+ var showAvatar = tab.showAvatar || false;
1020
+ var showNotificationDot = tab.showNotificationDot || false;
1021
+ var title = tabTitle !== null && tabTitle !== void 0 ? tabTitle : (0, _Utils.getTitle)(tab);
1022
+ var _useTabContext2 = (0, _TabContext.useTabContext)(),
1023
+ hiddenExternalToolbars = _useTabContext2.hiddenExternalToolbars,
1024
+ showExternalToolbar = _useTabContext2.showExternalToolbar;
1025
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
1026
+ className: "tab-content-wrapper"
1027
+ }, !isSubTab && /*#__PURE__*/_react["default"].createElement("div", {
1028
+ className: "single-tab ".concat(showNotificationDot ? 'show-notification-dot' : '')
1029
+ }), /*#__PURE__*/_react["default"].createElement("div", {
1030
+ className: "tab-title-wrapper"
1031
+ }, showAvatar && /*#__PURE__*/_react["default"].createElement(_superAvatar["default"], {
1032
+ firstName: tab.firstName,
1033
+ lastName: tab.lastName,
1034
+ imgSrc: tab.imgSrc || tab.img_url,
1035
+ width: 20,
1036
+ height: 20,
1037
+ fontSize: 8,
1038
+ borderRadius: 12
1039
+ }), /*#__PURE__*/_react["default"].createElement("div", {
1040
+ className: "tab-title"
1041
+ }, /*#__PURE__*/_react["default"].createElement("div", null, title))), isActive && /*#__PURE__*/_react["default"].createElement("div", {
1042
+ className: "tab-close-btn-wrapper"
1043
+ }, /*#__PURE__*/_react["default"].createElement("button", {
1044
+ className: "tab-close-btn",
1045
+ title: "Close tab",
1046
+ onClick: function onClick(e) {
1047
+ e.preventDefault();
1048
+ e.stopPropagation();
1049
+ handleTabClose({
1050
+ tab: tab,
1051
+ index: index,
1052
+ isSubTab: isSubTab,
1053
+ parentIndex: parentIndex
1054
+ });
1055
+ }
1056
+ })), isActive && false && /*#__PURE__*/_react["default"].createElement("div", {
1057
+ className: "active-sub-tab-btn-wrapper"
1058
+ }, hiddenExternalToolbars[tab.id] && /*#__PURE__*/_react["default"].createElement("div", {
1059
+ className: "tab-hide-toolbar-btn-wrapper",
1060
+ onClick: function onClick(e) {
1061
+ e.preventDefault();
1062
+ showExternalToolbar(tab.id);
1063
+ setShowTooltip(false);
1064
+ setTimeout(function () {
1065
+ setShowTooltip(true);
1066
+ }, 100);
1067
+ }
1068
+ }, /*#__PURE__*/_react["default"].createElement("button", {
1069
+ className: "tab-hide-toolbar-btn",
1070
+ title: "Show Toolbar"
1071
+ })))), Suffix && isActive && window.innerWidth < 640 && /*#__PURE__*/_react["default"].createElement(Suffix, null), !isActive && /*#__PURE__*/_react["default"].createElement("div", {
1072
+ className: "tab-close-btn-wrapper"
1073
+ }, /*#__PURE__*/_react["default"].createElement("button", {
1074
+ className: "tab-close-btn",
1075
+ title: "Close tab",
1076
+ onClick: function onClick(e) {
1077
+ e.preventDefault();
1078
+ e.stopPropagation();
1079
+ handleTabClose({
1080
+ tab: tab,
1081
+ index: index,
1082
+ isSubTab: isSubTab,
1083
+ parentIndex: parentIndex
1084
+ });
1085
+ }
1086
+ })));
1087
+ };
1088
+ var SubTab = exports.SubTab = function SubTab(_ref0) {
1089
+ var _subTab$url;
1090
+ var activeTab = _ref0.activeTab,
1091
+ closingTabID = _ref0.closingTabID,
1092
+ expandedTabID = _ref0.expandedTabID,
1093
+ maxWidth = _ref0.maxWidth,
1094
+ showSubTabs = _ref0.showSubTabs,
1095
+ subIndex = _ref0.subIndex,
1096
+ subTab = _ref0.subTab,
1097
+ tab = _ref0.tab,
1098
+ tabUrl = _ref0.tabUrl,
1099
+ handleTabClick = _ref0.handleTabClick,
1100
+ handleTabClose = _ref0.handleTabClose,
1101
+ SITE_PREFIX = _ref0.SITE_PREFIX,
1102
+ index = _ref0.index,
1103
+ hasSingleSubTab = _ref0.hasSingleSubTab;
1104
+ // const { closingUnexpandedSubTab, openingUnexpandedSubTab, subTabChange } = useTabContext();
1105
+ var _useState9 = (0, _react.useState)(true),
1106
+ _useState0 = _slicedToArray(_useState9, 2),
1107
+ showTooltip = _useState0[0],
1108
+ setShowTooltip = _useState0[1];
1109
+ var _useTabContext3 = (0, _TabContext.useTabContext)(),
1110
+ hiddenExternalToolbars = _useTabContext3.hiddenExternalToolbars,
1111
+ tabModePreference = _useTabContext3.tabModePreference;
1112
+ var subTabUrl = (_subTab$url = subTab.url) !== null && _subTab$url !== void 0 ? _subTab$url : "/".concat(tabUrl, "/f-").concat(subTab.id);
1113
+ var subTabUrlWithoutSearchParam = subTabUrl.split('?')[0];
1114
+ var pathname = window.location.pathname;
1115
+ var isSubTabActive = subTabUrlWithoutSearchParam === pathname;
1116
+ var title = (0, _Utils.getTitle)(subTab);
1117
+ var hasToolbarButton = isSubTabActive && hiddenExternalToolbars[subTab.id];
1118
+ var hasCloseButton = false; // isSubTabActive; // TODO: This will be used in next release (pending for design update)
1119
+ var width = (0, _Utils.calculateWidth)({
1120
+ text: title,
1121
+ hasAvatar: subTab.showAvatar,
1122
+ addMargin: false,
1123
+ hasToolbarButton: hasToolbarButton,
1124
+ hasCloseButton: hasCloseButton
1125
+ });
1126
+ var additionalWidth = 0; // (hasToolbarButton ? ToolbarButtonWidth : 0) + (hasCloseButton ? CloseButtonWidth : 0);
1127
+ var isEditMode = tabModePreference.includes(subTab.tabId);
1128
+ if (isEditMode) {
1129
+ subTabUrl += "?edit=true";
1130
+ }
1131
+
1132
+ // const show = (subTab.id === openedSubTab?.id && (activeTab.id === tab.id || closingTabID === tab.id)) || (hasSingleSubTab && activeTab.id === tab.id);
1133
+ // const isTabClosing = subTabChange?.oldTab?.id === subTab.id;
1134
+ // const isTabOpening = subTabChange?.newTab?.id === subTab.id;
1135
+ var show = subTab.open_order === 1 && (activeTab.id === tab.id || closingTabID === tab.id) || hasSingleSubTab && activeTab.id === tab.id;
1136
+ var getItemStyle = function getItemStyle(isVisible, draggableStyle, width) {
1137
+ // const duration = tab.id === 6 ? calculateTransitionDuration(Math.ceil(width)) : transitionDurationExtended;
1138
+ // const transition = `transition: all ${duration}ms, opacity ${transitionDuration}ms ${duration}ms`;
1139
+
1140
+ return _objectSpread({
1141
+ // calculateWidth({ text: title, hasAvatar: subTab.showAvatar, });
1142
+ marginLeft: isVisible ? "".concat(_Constants.MarginLeft, "px") : '0px',
1143
+ // maxWidth: maxWidth ? `${maxWidth}px` : `${width}px`,
1144
+ width: isVisible ? "".concat(expandedTabID === tab.id || closingTabID === tab.id ? subTab.width + additionalWidth || width : width, "px") : '0px',
1145
+ opacity: isVisible ? 1 : 0
1146
+ }, draggableStyle);
1147
+ };
1148
+ return /*#__PURE__*/_react["default"].createElement(_superDnd.Draggable, {
1149
+ key: subIndex,
1150
+ draggableId: String(subIndex),
1151
+ isDragDisabled: !showSubTabs,
1152
+ index: subIndex
1153
+ }, function (subprovided, snapshot) {
1154
+ return /*#__PURE__*/_react["default"].createElement(_reactHoverText["default"], {
1155
+ content: title,
1156
+ delay: 500,
1157
+ followCursor: true,
1158
+ show: showTooltip,
1159
+ placement: "bottom",
1160
+ stylingOptions: tooltipStyles
1161
+ }, /*#__PURE__*/_react["default"].createElement(_reactRouterDom.NavLink, _extends({}, subprovided.draggableProps, subprovided.dragHandleProps, {
1162
+ ref: subprovided.innerRef,
1163
+ to: subTabUrl,
1164
+ id: "tab-".concat(tab.id, "-") + subTab.id.toString().replace('/', '-'),
1165
+ className: "tab sub-tab" + (show ? ' show' : '') + (
1166
+ // (isTabClosing ? ' slide-out' : '') +
1167
+ // (isTabOpening ? ' fade-in' : '') +
1168
+ expandedTabID && subTab.width && (0, _Utils.compareDecimals)(subTab.width, width) === -1 ? ' fade-at-end' : '') + (
1169
+ // (closingUnexpandedSubTab || openingUnexpandedSubTab ? ' no-transition' : '') +
1170
+ snapshot.isDragging ? ' dragging' : '') + (subTab.isFixed ? ' fixed' : ''),
1171
+ style: getItemStyle(showSubTabs || show, subprovided.draggableProps.style, width)
1172
+ // title={subTab.name}
1173
+ ,
1174
+ exact: false,
1175
+ onClick: function onClick() {
1176
+ return handleTabClick({
1177
+ tab: subTab,
1178
+ parentId: tab.id,
1179
+ isSubTab: true
1180
+ });
1181
+ }
1182
+ // key={subIndex}
1183
+ }), /*#__PURE__*/_react["default"].createElement(TabContentWrapper, {
1184
+ tab: subTab,
1185
+ tabTitle: title,
1186
+ isActive: isSubTabActive,
1187
+ index: subIndex,
1188
+ handleTabClose: handleTabClose,
1189
+ isSubTab: true,
1190
+ SITE_PREFIX: SITE_PREFIX,
1191
+ parentIndex: index,
1192
+ setShowTooltip: setShowTooltip
1193
+ })));
1194
+ });
1195
+ };
1196
+ var _default = exports["default"] = SuperTabs;