@elliemae/ds-tabs 3.0.0-next.1 → 3.0.0-next.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/DSTabs.js +63 -0
- package/dist/cjs/DSTabs.js.map +7 -0
- package/dist/cjs/DSTabsCTX.js +56 -0
- package/dist/cjs/DSTabsCTX.js.map +7 -0
- package/dist/cjs/DSTabsDatatestid.js +46 -0
- package/dist/cjs/DSTabsDatatestid.js.map +7 -0
- package/dist/cjs/config/useCrossRef.js +44 -0
- package/dist/cjs/config/useCrossRef.js.map +7 -0
- package/dist/cjs/config/useTabs.js +74 -0
- package/dist/cjs/config/useTabs.js.map +7 -0
- package/dist/cjs/exported-related/DSTab.js +58 -0
- package/dist/cjs/exported-related/DSTab.js.map +7 -0
- package/dist/cjs/index.js +38 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/parts/carousel/Carousel.js +77 -0
- package/dist/cjs/parts/carousel/Carousel.js.map +7 -0
- package/dist/cjs/parts/carousel/styles.js +79 -0
- package/dist/cjs/parts/carousel/styles.js.map +7 -0
- package/dist/cjs/parts/carousel/useCarousel.js +80 -0
- package/dist/cjs/parts/carousel/useCarousel.js.map +7 -0
- package/dist/cjs/parts/carousel/useCarouselCallbacks.js +89 -0
- package/dist/cjs/parts/carousel/useCarouselCallbacks.js.map +7 -0
- package/dist/cjs/parts/tabBar/TabBar.js +171 -0
- package/dist/cjs/parts/tabBar/TabBar.js.map +7 -0
- package/dist/cjs/parts/tabBar/styles.js +294 -0
- package/dist/cjs/parts/tabBar/styles.js.map +7 -0
- package/dist/cjs/parts/tabBar/useTabBar.js +103 -0
- package/dist/cjs/parts/tabBar/useTabBar.js.map +7 -0
- package/dist/cjs/parts/tabsContent/TabsContent.js +69 -0
- package/dist/cjs/parts/tabsContent/TabsContent.js.map +7 -0
- package/dist/cjs/parts/tabsContent/styles.js +39 -0
- package/dist/cjs/parts/tabsContent/styles.js.map +7 -0
- package/dist/cjs/parts/tabsPanel/TabsPanels.js +95 -0
- package/dist/cjs/parts/tabsPanel/TabsPanels.js.map +7 -0
- package/dist/cjs/parts/tabsPanel/styles.js +45 -0
- package/dist/cjs/parts/tabsPanel/styles.js.map +7 -0
- package/dist/cjs/propTypes.js +77 -0
- package/dist/cjs/propTypes.js.map +7 -0
- package/dist/cjs/sharedTypes.js +27 -0
- package/dist/cjs/sharedTypes.js.map +7 -0
- package/dist/cjs/utils/constants.js +56 -0
- package/dist/cjs/utils/constants.js.map +7 -0
- package/dist/cjs/utils/helpers.js +84 -0
- package/dist/cjs/utils/helpers.js.map +7 -0
- package/dist/cjs/utils/hooks/useKeyboardNavigation.js +77 -0
- package/dist/cjs/utils/hooks/useKeyboardNavigation.js.map +7 -0
- package/dist/cjs/utils/hooks/useTabsCallbacks.js +60 -0
- package/dist/cjs/utils/hooks/useTabsCallbacks.js.map +7 -0
- package/dist/esm/DSTabs.js +34 -0
- package/dist/esm/DSTabs.js.map +7 -0
- package/dist/esm/DSTabsCTX.js +27 -0
- package/dist/esm/DSTabsCTX.js.map +7 -0
- package/dist/esm/DSTabsDatatestid.js +17 -0
- package/dist/esm/DSTabsDatatestid.js.map +7 -0
- package/{esm → dist/esm}/config/useCrossRef.js +6 -4
- package/dist/esm/config/useCrossRef.js.map +7 -0
- package/dist/esm/config/useTabs.js +45 -0
- package/dist/esm/config/useTabs.js.map +7 -0
- package/dist/esm/exported-related/DSTab.js +31 -0
- package/dist/esm/exported-related/DSTab.js.map +7 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/parts/carousel/Carousel.js +48 -0
- package/dist/esm/parts/carousel/Carousel.js.map +7 -0
- package/dist/esm/parts/carousel/styles.js +50 -0
- package/dist/esm/parts/carousel/styles.js.map +7 -0
- package/{esm → dist/esm}/parts/carousel/useCarousel.js +15 -34
- package/dist/esm/parts/carousel/useCarousel.js.map +7 -0
- package/{esm → dist/esm}/parts/carousel/useCarouselCallbacks.js +20 -28
- package/dist/esm/parts/carousel/useCarouselCallbacks.js.map +7 -0
- package/dist/esm/parts/tabBar/TabBar.js +149 -0
- package/dist/esm/parts/tabBar/TabBar.js.map +7 -0
- package/dist/esm/parts/tabBar/styles.js +265 -0
- package/dist/esm/parts/tabBar/styles.js.map +7 -0
- package/{esm → dist/esm}/parts/tabBar/useTabBar.js +26 -31
- package/dist/esm/parts/tabBar/useTabBar.js.map +7 -0
- package/dist/esm/parts/tabsContent/TabsContent.js +42 -0
- package/dist/esm/parts/tabsContent/TabsContent.js.map +7 -0
- package/dist/esm/parts/tabsContent/styles.js +10 -0
- package/dist/esm/parts/tabsContent/styles.js.map +7 -0
- package/dist/esm/parts/tabsPanel/TabsPanels.js +66 -0
- package/dist/esm/parts/tabsPanel/TabsPanels.js.map +7 -0
- package/dist/esm/parts/tabsPanel/styles.js +16 -0
- package/dist/esm/parts/tabsPanel/styles.js.map +7 -0
- package/dist/esm/propTypes.js +48 -0
- package/dist/esm/propTypes.js.map +7 -0
- package/dist/esm/sharedTypes.js +2 -0
- package/dist/esm/sharedTypes.js.map +7 -0
- package/dist/esm/utils/constants.js +27 -0
- package/dist/esm/utils/constants.js.map +7 -0
- package/{esm → dist/esm}/utils/helpers.js +19 -28
- package/dist/esm/utils/helpers.js.map +7 -0
- package/dist/esm/utils/hooks/useKeyboardNavigation.js +48 -0
- package/dist/esm/utils/hooks/useKeyboardNavigation.js.map +7 -0
- package/dist/esm/utils/hooks/useTabsCallbacks.js +31 -0
- package/dist/esm/utils/hooks/useTabsCallbacks.js.map +7 -0
- package/package.json +79 -70
- package/cjs/DSTabs.js +0 -45
- package/cjs/DSTabsCTX.js +0 -30
- package/cjs/DSTabsDatatestid.js +0 -18
- package/cjs/DSTabsTypes.js +0 -2
- package/cjs/config/useCrossRef.js +0 -17
- package/cjs/config/useTabs.js +0 -51
- package/cjs/defaultProps.js +0 -27
- package/cjs/exportsRelated/DSTab.js +0 -32
- package/cjs/index.js +0 -17
- package/cjs/parts/carousel/Carousel.js +0 -69
- package/cjs/parts/carousel/styles.js +0 -65
- package/cjs/parts/carousel/useCarousel.js +0 -78
- package/cjs/parts/carousel/useCarouselCallbacks.js +0 -72
- package/cjs/parts/tabBar/TabBar.js +0 -168
- package/cjs/parts/tabBar/styles.js +0 -200
- package/cjs/parts/tabBar/useTabBar.js +0 -87
- package/cjs/parts/tabsContent/TabsContent.js +0 -49
- package/cjs/parts/tabsContent/styles.js +0 -15
- package/cjs/parts/tabsPanel/TabsPanels.js +0 -77
- package/cjs/parts/tabsPanel/styles.js +0 -25
- package/cjs/propTypes.js +0 -33
- package/cjs/utils/constants.js +0 -28
- package/cjs/utils/helpers.js +0 -75
- package/cjs/utils/hooks/useKeyboardNavigation.js +0 -61
- package/cjs/utils/hooks/useTabsCallbacks.js +0 -41
- package/esm/DSTabs.js +0 -35
- package/esm/DSTabsCTX.js +0 -25
- package/esm/DSTabsDatatestid.js +0 -14
- package/esm/DSTabsTypes.js +0 -1
- package/esm/config/useTabs.js +0 -47
- package/esm/defaultProps.js +0 -23
- package/esm/exportsRelated/DSTab.js +0 -21
- package/esm/index.js +0 -4
- package/esm/parts/carousel/Carousel.js +0 -61
- package/esm/parts/carousel/styles.js +0 -54
- package/esm/parts/tabBar/TabBar.js +0 -159
- package/esm/parts/tabBar/styles.js +0 -186
- package/esm/parts/tabsContent/TabsContent.js +0 -40
- package/esm/parts/tabsContent/styles.js +0 -7
- package/esm/parts/tabsPanel/TabsPanels.js +0 -67
- package/esm/parts/tabsPanel/styles.js +0 -17
- package/esm/propTypes.js +0 -28
- package/esm/utils/constants.js +0 -20
- package/esm/utils/hooks/useKeyboardNavigation.js +0 -57
- package/esm/utils/hooks/useTabsCallbacks.js +0 -37
- package/types/DSTabs.d.ts +0 -14
- package/types/DSTabsCTX.d.ts +0 -4
- package/types/DSTabsDatatestid.d.ts +0 -12
- package/types/DSTabsTypes.d.ts +0 -205
- package/types/config/useCrossRef.d.ts +0 -2
- package/types/config/useTabs.d.ts +0 -2
- package/types/defaultProps.d.ts +0 -2
- package/types/exportsRelated/DSTab.d.ts +0 -14
- package/types/index.d.ts +0 -5
- package/types/parts/carousel/Carousel.d.ts +0 -3
- package/types/parts/carousel/styles.d.ts +0 -9
- package/types/parts/carousel/useCarousel.d.ts +0 -2
- package/types/parts/carousel/useCarouselCallbacks.d.ts +0 -2
- package/types/parts/tabBar/TabBar.d.ts +0 -2
- package/types/parts/tabBar/styles.d.ts +0 -7
- package/types/parts/tabBar/useTabBar.d.ts +0 -2
- package/types/parts/tabsContent/TabsContent.d.ts +0 -2
- package/types/parts/tabsContent/styles.d.ts +0 -1
- package/types/parts/tabsPanel/TabsPanels.d.ts +0 -2
- package/types/parts/tabsPanel/styles.d.ts +0 -2
- package/types/propTypes.d.ts +0 -54
- package/types/tests/DSTabs.callbacks.test.d.ts +0 -1
- package/types/tests/DSTabs.func.test.d.ts +0 -1
- package/types/tests/DSTabs.keyboard.test.d.ts +0 -1
- package/types/tests/DSTabs.test.d.ts +0 -1
- package/types/utils/constants.d.ts +0 -18
- package/types/utils/helpers.d.ts +0 -9
- package/types/utils/hooks/useKeyboardNavigation.d.ts +0 -2
- package/types/utils/hooks/useTabsCallbacks.d.ts +0 -2
|
@@ -0,0 +1,95 @@
|
|
|
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 TabsPanels_exports = {};
|
|
29
|
+
__export(TabsPanels_exports, {
|
|
30
|
+
TabsPanels: () => TabsPanels
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = __toESM(require("react"));
|
|
34
|
+
var import_react_swipeable_views = __toESM(require("react-swipeable-views"));
|
|
35
|
+
var import_styles = require("./styles");
|
|
36
|
+
var import_DSTabsCTX = require("../../DSTabsCTX");
|
|
37
|
+
var import_useTabsCallbacks = require("../../utils/hooks/useTabsCallbacks");
|
|
38
|
+
const TabsPanels = () => {
|
|
39
|
+
const {
|
|
40
|
+
actualActiveTab,
|
|
41
|
+
focusableTabsRef,
|
|
42
|
+
props: { animated, enableMouseEvents, onlyRenderActiveTab, children: tabs, isDSMobile }
|
|
43
|
+
} = (0, import_react.useContext)(import_DSTabsCTX.DSTabsContext);
|
|
44
|
+
const { handleOnTabChange, handleOnMouseDown } = (0, import_useTabsCallbacks.useTabsCallbacks)();
|
|
45
|
+
const handleOnChangeIndex = (0, import_react.useCallback)((index, indexLatest) => {
|
|
46
|
+
if (!focusableTabsRef.current)
|
|
47
|
+
return;
|
|
48
|
+
const offset = index - indexLatest;
|
|
49
|
+
if (focusableTabsRef.current) {
|
|
50
|
+
const currentIndexFocusable = focusableTabsRef.current?.findIndex((el) => el.dataset.tabId === actualActiveTab);
|
|
51
|
+
const newFocusableIndex = currentIndexFocusable >= 0 ? currentIndexFocusable + offset : -1;
|
|
52
|
+
if (newFocusableIndex < 0 || newFocusableIndex > focusableTabsRef.current?.length || !focusableTabsRef.current?.[newFocusableIndex])
|
|
53
|
+
return;
|
|
54
|
+
handleOnTabChange(focusableTabsRef.current[newFocusableIndex].dataset?.tabId);
|
|
55
|
+
focusableTabsRef.current[newFocusableIndex].click();
|
|
56
|
+
}
|
|
57
|
+
}, [actualActiveTab, focusableTabsRef, handleOnTabChange]);
|
|
58
|
+
const firstSlideToShow = (0, import_react.useMemo)(() => {
|
|
59
|
+
const childrenArray = import_react.default.Children.toArray(tabs);
|
|
60
|
+
const index = childrenArray.filter((tab) => tab.props.disabled !== true).findIndex((tab) => tab.props.tabId === actualActiveTab);
|
|
61
|
+
if (index === -1)
|
|
62
|
+
return 0;
|
|
63
|
+
return index;
|
|
64
|
+
}, [actualActiveTab, tabs]);
|
|
65
|
+
const panels = (0, import_react.useMemo)(() => import_react.default.Children.map(tabs, (tab) => {
|
|
66
|
+
const { tabId: panelId = "", style, children: content, disabled } = tab.props;
|
|
67
|
+
const isActive = actualActiveTab === panelId;
|
|
68
|
+
const shouldRender = !onlyRenderActiveTab || isActive;
|
|
69
|
+
if (disabled)
|
|
70
|
+
return null;
|
|
71
|
+
return shouldRender && /* @__PURE__ */ import_react.default.createElement(import_styles.StyledPanelContainer, {
|
|
72
|
+
key: panelId,
|
|
73
|
+
id: panelId,
|
|
74
|
+
"aria-labelledby": `${panelId}-label`,
|
|
75
|
+
"aria-hidden": !isActive,
|
|
76
|
+
"data-panel-id": panelId,
|
|
77
|
+
"data-testid": "ds-tabs-tab-panel",
|
|
78
|
+
hidden: !isActive,
|
|
79
|
+
onMouseDown: handleOnMouseDown,
|
|
80
|
+
role: "tabpanel",
|
|
81
|
+
style,
|
|
82
|
+
isDSMobile
|
|
83
|
+
}, content);
|
|
84
|
+
}), [actualActiveTab, handleOnMouseDown, isDSMobile, onlyRenderActiveTab, tabs]);
|
|
85
|
+
if (animated) {
|
|
86
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react_swipeable_views.default, {
|
|
87
|
+
enableMouseEvents,
|
|
88
|
+
index: firstSlideToShow,
|
|
89
|
+
onChangeIndex: handleOnChangeIndex
|
|
90
|
+
}, panels);
|
|
91
|
+
}
|
|
92
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, panels);
|
|
93
|
+
};
|
|
94
|
+
module.exports = __toCommonJS(TabsPanels_exports);
|
|
95
|
+
//# sourceMappingURL=TabsPanels.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/parts/tabsPanel/TabsPanels.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\nimport React, { useMemo, useContext, useCallback } from 'react';\nimport SwipeableViews from 'react-swipeable-views';\nimport { StyledPanelContainer } from './styles';\nimport { DSTabsContext } from '../../DSTabsCTX';\nimport { useTabsCallbacks } from '../../utils/hooks/useTabsCallbacks';\nimport type { DSTabT } from '../../propTypes';\n\nexport const TabsPanels = (): JSX.Element => {\n const {\n actualActiveTab,\n focusableTabsRef,\n props: { animated, enableMouseEvents, onlyRenderActiveTab, children: tabs, isDSMobile },\n } = useContext(DSTabsContext);\n\n const { handleOnTabChange, handleOnMouseDown } = useTabsCallbacks();\n\n const handleOnChangeIndex = useCallback(\n (index: number, indexLatest: number) => {\n if (!focusableTabsRef.current) return;\n\n const offset = index - indexLatest;\n\n if (focusableTabsRef.current) {\n const currentIndexFocusable = focusableTabsRef.current?.findIndex((el) => el.dataset.tabId === actualActiveTab);\n\n const newFocusableIndex = currentIndexFocusable >= 0 ? currentIndexFocusable + offset : -1;\n\n if (\n newFocusableIndex < 0 ||\n newFocusableIndex > focusableTabsRef.current?.length ||\n !focusableTabsRef.current?.[newFocusableIndex]\n )\n return;\n handleOnTabChange(focusableTabsRef.current[newFocusableIndex].dataset?.tabId as string);\n\n // swiping does not trigger centerTab function inside handleOnTabChange because there is no event\n // by clicking we are manually forcing to center the tab\n\n focusableTabsRef.current[newFocusableIndex].click();\n }\n },\n [actualActiveTab, focusableTabsRef, handleOnTabChange],\n );\n\n const firstSlideToShow = useMemo(() => {\n const childrenArray = React.Children.toArray(tabs) as React.ReactElement<DSTabT.Props>[];\n const index = childrenArray\n .filter((tab) => tab.props.disabled !== true)\n .findIndex((tab) => tab.props.tabId === actualActiveTab);\n\n if (index === -1) return 0;\n return index;\n }, [actualActiveTab, tabs]);\n\n const panels = useMemo(\n () =>\n React.Children.map(tabs, (tab: React.ReactElement<DSTabT.Props>) => {\n const { tabId: panelId = '', style, children: content, disabled } = tab.props;\n const isActive = actualActiveTab === panelId;\n const shouldRender = !onlyRenderActiveTab || isActive;\n\n if (disabled) return null;\n return (\n shouldRender && (\n <StyledPanelContainer\n key={panelId}\n id={panelId}\n aria-labelledby={`${panelId}-label`}\n aria-hidden={!isActive}\n data-panel-id={panelId}\n data-testid=\"ds-tabs-tab-panel\"\n hidden={!isActive}\n onMouseDown={handleOnMouseDown}\n role=\"tabpanel\"\n style={style}\n isDSMobile={isDSMobile}\n >\n {content}\n </StyledPanelContainer>\n )\n );\n }),\n [actualActiveTab, handleOnMouseDown, isDSMobile, onlyRenderActiveTab, tabs],\n );\n\n if (animated) {\n return (\n <SwipeableViews\n enableMouseEvents={enableMouseEvents}\n index={firstSlideToShow}\n onChangeIndex={handleOnChangeIndex}\n >\n {panels}\n </SwipeableViews>\n );\n }\n\n return <>{panels}</>;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAwD;AACxD,mCAA2B;AAC3B,oBAAqC;AACrC,uBAA8B;AAC9B,8BAAiC;AAG1B,MAAM,aAAa,MAAmB;AAC3C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,OAAO,EAAE,UAAU,mBAAmB,qBAAqB,UAAU,MAAM;AAAA,MACzE,6BAAW;AAEf,QAAM,EAAE,mBAAmB,sBAAsB;AAEjD,QAAM,sBAAsB,8BAC1B,CAAC,OAAe,gBAAwB;AACtC,QAAI,CAAC,iBAAiB;AAAS;AAE/B,UAAM,SAAS,QAAQ;AAEvB,QAAI,iBAAiB,SAAS;AAC5B,YAAM,wBAAwB,iBAAiB,SAAS,UAAU,CAAC,OAAO,GAAG,QAAQ,UAAU;AAE/F,YAAM,oBAAoB,yBAAyB,IAAI,wBAAwB,SAAS;AAExF,UACE,oBAAoB,KACpB,oBAAoB,iBAAiB,SAAS,UAC9C,CAAC,iBAAiB,UAAU;AAE5B;AACF,wBAAkB,iBAAiB,QAAQ,mBAAmB,SAAS;AAKvE,uBAAiB,QAAQ,mBAAmB;AAAA;AAAA,KAGhD,CAAC,iBAAiB,kBAAkB;AAGtC,QAAM,mBAAmB,0BAAQ,MAAM;AACrC,UAAM,gBAAgB,qBAAM,SAAS,QAAQ;AAC7C,UAAM,QAAQ,cACX,OAAO,CAAC,QAAQ,IAAI,MAAM,aAAa,MACvC,UAAU,CAAC,QAAQ,IAAI,MAAM,UAAU;AAE1C,QAAI,UAAU;AAAI,aAAO;AACzB,WAAO;AAAA,KACN,CAAC,iBAAiB;AAErB,QAAM,SAAS,0BACb,MACE,qBAAM,SAAS,IAAI,MAAM,CAAC,QAA0C;AAClE,UAAM,EAAE,OAAO,UAAU,IAAI,OAAO,UAAU,SAAS,aAAa,IAAI;AACxE,UAAM,WAAW,oBAAoB;AACrC,UAAM,eAAe,CAAC,uBAAuB;AAE7C,QAAI;AAAU,aAAO;AACrB,WACE,gBACE,mDAAC,oCAAD;AAAA,MACE,KAAK;AAAA,MACL,IAAI;AAAA,MACJ,mBAAiB,GAAG;AAAA,MACpB,eAAa,CAAC;AAAA,MACd,iBAAe;AAAA,MACf,eAAY;AAAA,MACZ,QAAQ,CAAC;AAAA,MACT,aAAa;AAAA,MACb,MAAK;AAAA,MACL;AAAA,MACA;AAAA,OAEC;AAAA,MAKX,CAAC,iBAAiB,mBAAmB,YAAY,qBAAqB;AAGxE,MAAI,UAAU;AACZ,WACE,mDAAC,sCAAD;AAAA,MACE;AAAA,MACA,OAAO;AAAA,MACP,eAAe;AAAA,OAEd;AAAA;AAKP,SAAO,wFAAG;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
StyledPanelContainer: () => StyledPanelContainer
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
34
|
+
const StyledPanelContainer = import_styled_components.default.div`
|
|
35
|
+
padding-top: 8px;
|
|
36
|
+
&:focus {
|
|
37
|
+
outline: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
${({ hidden }) => hidden ? "visibility: hidden;" : ""}
|
|
41
|
+
|
|
42
|
+
${({ isDSMobile }) => isDSMobile ? `padding-top: 0;` : ``}
|
|
43
|
+
`;
|
|
44
|
+
module.exports = __toCommonJS(styles_exports);
|
|
45
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/parts/tabsPanel/styles.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import styled from 'styled-components';\n\ninterface StyledPanelContainerPropsT {\n hidden: boolean;\n isDSMobile: boolean;\n}\n\nexport const StyledPanelContainer = styled.div<StyledPanelContainerPropsT>`\n padding-top: 8px;\n &:focus {\n outline: none;\n }\n\n ${({ hidden }) => (hidden ? 'visibility: hidden;' : '')}\n\n ${({ isDSMobile }) => (isDSMobile ? `padding-top: 0;` : ``)}\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,+BAAmB;AAOZ,MAAM,uBAAuB,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMvC,CAAC,EAAE,aAAc,SAAS,wBAAwB;AAAA;AAAA,IAElD,CAAC,EAAE,iBAAkB,aAAa,oBAAoB;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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 propTypes_exports = {};
|
|
29
|
+
__export(propTypes_exports, {
|
|
30
|
+
tabPropTypes: () => tabPropTypes,
|
|
31
|
+
tabsDefaultProps: () => tabsDefaultProps,
|
|
32
|
+
tabsPropTypes: () => tabsPropTypes
|
|
33
|
+
});
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_react_desc = require("react-desc");
|
|
36
|
+
var import_constants = require("./utils/constants");
|
|
37
|
+
const noop = () => {
|
|
38
|
+
};
|
|
39
|
+
const tabPropTypes = {
|
|
40
|
+
tabId: import_react_desc.PropTypes.string.description("Unique Tab id.").defaultValue(""),
|
|
41
|
+
title: import_react_desc.PropTypes.string.description("Tab title.").defaultValue(""),
|
|
42
|
+
required: import_react_desc.PropTypes.bool.description("Show a required mark next to the title.").defaultValue(false),
|
|
43
|
+
disabled: import_react_desc.PropTypes.bool.description("Disables Tab.").defaultValue(false)
|
|
44
|
+
};
|
|
45
|
+
const tabsPropTypes = {
|
|
46
|
+
animated: import_react_desc.PropTypes.bool.description("Whether the Tab transition should animate or not.").defaultValue(true),
|
|
47
|
+
enableMouseEvents: import_react_desc.PropTypes.bool.description("Enables Tab transition with mouse drag events.").defaultValue(false),
|
|
48
|
+
allowTextSelection: import_react_desc.PropTypes.bool.description("Allows text selection when mouse drag events are active.").defaultValue(false),
|
|
49
|
+
onTabChange: import_react_desc.PropTypes.func.description("Handler when a user clicks on a different Tab.").defaultValue("() => {}"),
|
|
50
|
+
type: import_react_desc.PropTypes.oneOf(import_constants.TabTypesValuesAsArray).description("Tab type.").defaultValue(import_constants.TabTypesValuesAsArray[0]),
|
|
51
|
+
tabBarExtraContent: import_react_desc.PropTypes.element.description("Extra content next to the Tab Bar.").defaultValue(void 0),
|
|
52
|
+
onlyRenderActiveTab: import_react_desc.PropTypes.bool.description("Only renders the active Tab in the DOM.").defaultValue(false),
|
|
53
|
+
withCarousel: import_react_desc.PropTypes.bool.description("Activate carousel behavior.").defaultValue(false),
|
|
54
|
+
activeTab: import_react_desc.PropTypes.string.description("Passing a value makes DSTabs a controlled component.").defaultValue("First DSTab children."),
|
|
55
|
+
children: import_react_desc.PropTypes.node.description("Use DSTab component as children.").isRequired,
|
|
56
|
+
tabsListAriaLabel: import_react_desc.PropTypes.string.description("Aria label for the list.").defaultValue("Tab list."),
|
|
57
|
+
containerProps: import_react_desc.PropTypes.object.description("Additional properties for the container.").defaultValue({}),
|
|
58
|
+
innerRef: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.func, import_react_desc.PropTypes.shape({ current: import_react_desc.PropTypes.any })]).description("Ref to the container.").defaultValue(void 0)
|
|
59
|
+
};
|
|
60
|
+
const tabsDefaultProps = {
|
|
61
|
+
containerProps: {},
|
|
62
|
+
animated: true,
|
|
63
|
+
enableMouseEvents: false,
|
|
64
|
+
allowTextSelection: false,
|
|
65
|
+
onTabChange: noop,
|
|
66
|
+
tabsListAriaLabel: "Tab list",
|
|
67
|
+
type: import_constants.TabTypes.NORMAL,
|
|
68
|
+
onlyRenderActiveTab: false,
|
|
69
|
+
withCarousel: false,
|
|
70
|
+
isDSMobile: false,
|
|
71
|
+
showSelectionIndicator: true,
|
|
72
|
+
children: [],
|
|
73
|
+
fixedTabsHeaders: false,
|
|
74
|
+
showSeparator: true
|
|
75
|
+
};
|
|
76
|
+
module.exports = __toCommonJS(propTypes_exports);
|
|
77
|
+
//# sourceMappingURL=propTypes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/propTypes.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { PropTypes } from 'react-desc';\nimport { TabTypes, TabTypesValuesAsArray } from './utils/constants';\nimport type { DSTabsInternalsT } from './sharedTypes';\n\nconst noop = (): void => {};\n\nexport declare namespace DSTabT {\n export interface PropsOptional {\n style?: Record<string, unknown>;\n title?: string;\n required?: boolean;\n disabled?: boolean;\n ref?: React.MutableRefObject<HTMLButtonElement>;\n onClick?: (tabId: string, e: React.MouseEvent) => null | void;\n onKeyDown?: (e: React.KeyboardEvent) => null | void;\n }\n\n export interface PropsRequired {\n children: React.ReactNode;\n tabId: string;\n }\n\n export interface Props extends PropsOptional, PropsRequired {}\n}\n\nexport declare namespace DSTabsT {\n export interface DefaultProps {\n containerProps: Record<string, unknown>;\n animated: boolean;\n enableMouseEvents: boolean;\n allowTextSelection: boolean;\n onTabChange: (tabId: string, e?: React.MouseEvent) => void;\n tabsListAriaLabel: string;\n type: DSTabsInternalsT.TabTypesT;\n children: React.ReactElement<DSTabT.Props>[];\n onlyRenderActiveTab: boolean;\n fixedTabsHeaders: boolean;\n withCarousel: boolean;\n isDSMobile: boolean;\n showSelectionIndicator: boolean;\n showSeparator: boolean;\n }\n\n export interface PropsOptional {\n firstSubtabRef?: React.MutableRefObject<HTMLElement>;\n lastTabRef?: React.MutableRefObject<HTMLElement>;\n tabBarExtraContent?: React.ReactNode;\n activeTab?: string;\n innerRef?: React.MutableRefObject<HTMLDivElement>;\n }\n\n export interface Props extends Partial<DefaultProps>, PropsOptional {}\n\n export interface InternalProps extends DefaultProps, PropsOptional {}\n}\n\nexport const tabPropTypes = {\n tabId: PropTypes.string.description('Unique Tab id.').defaultValue(''),\n title: PropTypes.string.description('Tab title.').defaultValue(''),\n required: PropTypes.bool.description('Show a required mark next to the title.').defaultValue(false),\n disabled: PropTypes.bool.description('Disables Tab.').defaultValue(false),\n};\n\nexport const tabsPropTypes = {\n animated: PropTypes.bool.description('Whether the Tab transition should animate or not.').defaultValue(true),\n enableMouseEvents: PropTypes.bool.description('Enables Tab transition with mouse drag events.').defaultValue(false),\n allowTextSelection: PropTypes.bool\n .description('Allows text selection when mouse drag events are active.')\n .defaultValue(false),\n onTabChange: PropTypes.func.description('Handler when a user clicks on a different Tab.').defaultValue('() => {}'),\n type: PropTypes.oneOf(TabTypesValuesAsArray).description('Tab type.').defaultValue(TabTypesValuesAsArray[0]),\n tabBarExtraContent: PropTypes.element.description('Extra content next to the Tab Bar.').defaultValue(undefined),\n onlyRenderActiveTab: PropTypes.bool.description('Only renders the active Tab in the DOM.').defaultValue(false),\n withCarousel: PropTypes.bool.description('Activate carousel behavior.').defaultValue(false),\n activeTab: PropTypes.string\n .description('Passing a value makes DSTabs a controlled component.')\n .defaultValue('First DSTab children.'),\n children: PropTypes.node.description('Use DSTab component as children.').isRequired,\n tabsListAriaLabel: PropTypes.string.description('Aria label for the list.').defaultValue('Tab list.'),\n containerProps: PropTypes.object.description('Additional properties for the container.').defaultValue({}),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })])\n .description('Ref to the container.')\n .defaultValue(undefined),\n};\n\nexport const tabsDefaultProps: DSTabsT.DefaultProps = {\n containerProps: {},\n animated: true,\n enableMouseEvents: false,\n allowTextSelection: false,\n onTabChange: noop,\n tabsListAriaLabel: 'Tab list',\n type: TabTypes.NORMAL,\n onlyRenderActiveTab: false,\n withCarousel: false,\n isDSMobile: false,\n showSelectionIndicator: true,\n children: [],\n fixedTabsHeaders: false,\n showSeparator: true,\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAA0B;AAC1B,uBAAgD;AAGhD,MAAM,OAAO,MAAY;AAAA;AAoDlB,MAAM,eAAe;AAAA,EAC1B,OAAO,4BAAU,OAAO,YAAY,kBAAkB,aAAa;AAAA,EACnE,OAAO,4BAAU,OAAO,YAAY,cAAc,aAAa;AAAA,EAC/D,UAAU,4BAAU,KAAK,YAAY,2CAA2C,aAAa;AAAA,EAC7F,UAAU,4BAAU,KAAK,YAAY,iBAAiB,aAAa;AAAA;AAG9D,MAAM,gBAAgB;AAAA,EAC3B,UAAU,4BAAU,KAAK,YAAY,qDAAqD,aAAa;AAAA,EACvG,mBAAmB,4BAAU,KAAK,YAAY,kDAAkD,aAAa;AAAA,EAC7G,oBAAoB,4BAAU,KAC3B,YAAY,4DACZ,aAAa;AAAA,EAChB,aAAa,4BAAU,KAAK,YAAY,kDAAkD,aAAa;AAAA,EACvG,MAAM,4BAAU,MAAM,wCAAuB,YAAY,aAAa,aAAa,uCAAsB;AAAA,EACzG,oBAAoB,4BAAU,QAAQ,YAAY,sCAAsC,aAAa;AAAA,EACrG,qBAAqB,4BAAU,KAAK,YAAY,2CAA2C,aAAa;AAAA,EACxG,cAAc,4BAAU,KAAK,YAAY,+BAA+B,aAAa;AAAA,EACrF,WAAW,4BAAU,OAClB,YAAY,wDACZ,aAAa;AAAA,EAChB,UAAU,4BAAU,KAAK,YAAY,oCAAoC;AAAA,EACzE,mBAAmB,4BAAU,OAAO,YAAY,4BAA4B,aAAa;AAAA,EACzF,gBAAgB,4BAAU,OAAO,YAAY,4CAA4C,aAAa;AAAA,EACtG,UAAU,4BAAU,UAAU,CAAC,4BAAU,MAAM,4BAAU,MAAM,EAAE,SAAS,4BAAU,SACjF,YAAY,yBACZ,aAAa;AAAA;AAGX,MAAM,mBAAyC;AAAA,EACpD,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,MAAM,0BAAS;AAAA,EACf,qBAAqB;AAAA,EACrB,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,wBAAwB;AAAA,EACxB,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,eAAe;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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 __reExport = (target, module2, copyDefault, desc) => {
|
|
9
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(module2))
|
|
11
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
12
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (module2, isNodeMode) => {
|
|
17
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
20
|
+
return (module2, temp) => {
|
|
21
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
22
|
+
};
|
|
23
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
24
|
+
var sharedTypes_exports = {};
|
|
25
|
+
var React = __toESM(require("react"));
|
|
26
|
+
module.exports = __toCommonJS(sharedTypes_exports);
|
|
27
|
+
//# sourceMappingURL=sharedTypes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/sharedTypes.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { TabTypes } from './utils/constants';\nimport type { DSTabsT } from './propTypes';\n\nexport namespace DSTabsInternalsT {\n export type TabTypesT = typeof TabTypes[keyof typeof TabTypes];\n\n export interface MobileGradientsT {\n right: boolean;\n left: boolean;\n }\n\n export interface IndicatorStyleT {\n left: string;\n width: string;\n backgroundWithTransparent: string;\n }\n\n export interface ShowChevronsT {\n right: boolean;\n left: boolean;\n }\n\n export interface DSTabsUseTabsContextT {\n props: DSTabsT.InternalProps;\n tabsRef: React.MutableRefObject<Record<number, HTMLButtonElement> | null>;\n focusableTabsRef: React.MutableRefObject<HTMLButtonElement[] | null>;\n tabsListRef: React.MutableRefObject<HTMLDivElement | null>;\n tabsRefAsArray: React.MutableRefObject<HTMLButtonElement[] | null>;\n actualActiveTabRef: React.MutableRefObject<HTMLButtonElement | null>;\n carouselOnlyListRef: React.MutableRefObject<HTMLDivElement | null>;\n setInternalActiveTab: React.Dispatch<React.SetStateAction<string>>;\n actualActiveTab: string;\n }\n\n export interface DSTabsUseCrossRefContextT {\n lastTabInternalRef: React.MutableRefObject<HTMLButtonElement | null | undefined>;\n firstSubtabInternalRef: React.MutableRefObject<HTMLButtonElement | null | undefined>;\n }\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;ACAA,YAAuB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 constants_exports = {};
|
|
29
|
+
__export(constants_exports, {
|
|
30
|
+
MOBILE_GRADIENT_WIDTH: () => MOBILE_GRADIENT_WIDTH,
|
|
31
|
+
TabTypes: () => TabTypes,
|
|
32
|
+
TabTypesValuesAsArray: () => TabTypesValuesAsArray,
|
|
33
|
+
defaultIndicatorStyles: () => defaultIndicatorStyles,
|
|
34
|
+
gradientOffsetsAccordingType: () => gradientOffsetsAccordingType
|
|
35
|
+
});
|
|
36
|
+
var React = __toESM(require("react"));
|
|
37
|
+
const TabTypes = {
|
|
38
|
+
NORMAL: "normal",
|
|
39
|
+
NORMAL_SMALL: "normal_small",
|
|
40
|
+
SUBTABS: "subtabs"
|
|
41
|
+
};
|
|
42
|
+
const TabTypesValuesAsArray = Object.values(TabTypes);
|
|
43
|
+
const MOBILE_GRADIENT_WIDTH = 24;
|
|
44
|
+
const defaultIndicatorStyles = {
|
|
45
|
+
left: "0px",
|
|
46
|
+
width: "0px",
|
|
47
|
+
backgroundWithTransparent: ""
|
|
48
|
+
};
|
|
49
|
+
const gradientOffsetsAccordingType = {
|
|
50
|
+
normal_small: 14,
|
|
51
|
+
normal: 16,
|
|
52
|
+
subtabs: 16,
|
|
53
|
+
fixedTabsHeaders: 0
|
|
54
|
+
};
|
|
55
|
+
module.exports = __toCommonJS(constants_exports);
|
|
56
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/utils/constants.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export const TabTypes = {\n NORMAL: 'normal' as const,\n NORMAL_SMALL: 'normal_small' as const,\n SUBTABS: 'subtabs' as const,\n};\n\nexport const TabTypesValuesAsArray = Object.values(TabTypes);\n\nexport const MOBILE_GRADIENT_WIDTH = 24;\n\nexport const defaultIndicatorStyles = {\n left: '0px',\n width: '0px',\n backgroundWithTransparent: '',\n};\n\nexport const gradientOffsetsAccordingType = {\n normal_small: 14,\n normal: 16,\n subtabs: 16,\n fixedTabsHeaders: 0,\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,WAAW;AAAA,EACtB,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,SAAS;AAAA;AAGJ,MAAM,wBAAwB,OAAO,OAAO;AAE5C,MAAM,wBAAwB;AAE9B,MAAM,yBAAyB;AAAA,EACpC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,2BAA2B;AAAA;AAGtB,MAAM,+BAA+B;AAAA,EAC1C,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,kBAAkB;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
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 helpers_exports = {};
|
|
29
|
+
__export(helpers_exports, {
|
|
30
|
+
centerTab: () => centerTab,
|
|
31
|
+
getVisibleDimensions: () => getVisibleDimensions,
|
|
32
|
+
isElementVisible: () => isElementVisible,
|
|
33
|
+
isElementVisibleCarousel: () => isElementVisibleCarousel,
|
|
34
|
+
shouldHaveLeftGradient: () => shouldHaveLeftGradient,
|
|
35
|
+
shouldHaveRightGradient: () => shouldHaveRightGradient
|
|
36
|
+
});
|
|
37
|
+
var React = __toESM(require("react"));
|
|
38
|
+
var import_constants = require("./constants");
|
|
39
|
+
const isElementVisible = (tab, tabList) => {
|
|
40
|
+
const tabDimensions = tab.getBoundingClientRect();
|
|
41
|
+
const tabListDimensions = tabList.getBoundingClientRect();
|
|
42
|
+
return tabDimensions.left <= tabListDimensions.left ? tabListDimensions.left - tabDimensions.left <= tabDimensions.width : tabDimensions.right - tabListDimensions.right <= tabDimensions.width;
|
|
43
|
+
};
|
|
44
|
+
const isElementVisibleCarousel = (tab, tabContainer, firstOrLastItem = true) => {
|
|
45
|
+
if (tab && tabContainer) {
|
|
46
|
+
const tabDimensions = tab.getBoundingClientRect();
|
|
47
|
+
const tabContainerDimensions = tabContainer.getBoundingClientRect();
|
|
48
|
+
const offset = firstOrLastItem ? 16 : 32;
|
|
49
|
+
const tabDimensionsLeft = Math.floor(tabDimensions.left - offset);
|
|
50
|
+
const tabDimensionsRight = Math.floor(tabDimensions.right + offset);
|
|
51
|
+
const tabContainerDimensionsLeft = Math.floor(tabContainerDimensions.left);
|
|
52
|
+
const tabContainerDimensionsRight = Math.floor(tabContainerDimensions.right);
|
|
53
|
+
return tabDimensionsLeft >= tabContainerDimensionsLeft && tabDimensionsRight <= tabContainerDimensionsRight;
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
};
|
|
57
|
+
const centerTab = ({ e, listRef }) => {
|
|
58
|
+
if (listRef.current) {
|
|
59
|
+
const { offsetLeft } = e?.target;
|
|
60
|
+
const { width: tabWidth } = (e?.target).getBoundingClientRect();
|
|
61
|
+
const { width: listWidth } = listRef.current.getBoundingClientRect();
|
|
62
|
+
const extraSideSpace = listWidth - tabWidth;
|
|
63
|
+
const leftOffsetToCenter = extraSideSpace > 0 ? extraSideSpace / 2 : 0;
|
|
64
|
+
const centeredLeftOffset = offsetLeft > leftOffsetToCenter ? offsetLeft - leftOffsetToCenter : 0;
|
|
65
|
+
listRef.current.scrollTo({
|
|
66
|
+
top: 0,
|
|
67
|
+
left: centeredLeftOffset,
|
|
68
|
+
behavior: "smooth"
|
|
69
|
+
});
|
|
70
|
+
e?.preventDefault();
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const getVisibleDimensions = (node, referenceNode) => {
|
|
74
|
+
const nodeDimensions = node.getBoundingClientRect();
|
|
75
|
+
const referenceNodeDimensions = referenceNode.getBoundingClientRect();
|
|
76
|
+
return {
|
|
77
|
+
width: Math.min(node.clientWidth, referenceNodeDimensions.left + referenceNode.clientWidth - nodeDimensions.left, node.clientWidth - (referenceNodeDimensions.left - nodeDimensions.left)),
|
|
78
|
+
height: Math.min(node.clientHeight, referenceNodeDimensions.top + referenceNode.clientHeight - nodeDimensions.top, node.clientHeight - (referenceNodeDimensions.top - nodeDimensions.top))
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
const shouldHaveLeftGradient = (scrollLeft) => Math.abs(scrollLeft) > import_constants.MOBILE_GRADIENT_WIDTH;
|
|
82
|
+
const shouldHaveRightGradient = (scrollLeft, clientWidth, scrollWidth) => Math.abs(scrollLeft) <= scrollWidth - (clientWidth + import_constants.MOBILE_GRADIENT_WIDTH);
|
|
83
|
+
module.exports = __toCommonJS(helpers_exports);
|
|
84
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/utils/helpers.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { MOBILE_GRADIENT_WIDTH } from './constants';\n\ninterface VisibleDimensionsT {\n width: number;\n height: number;\n}\n\ninterface CenterTabPropsT {\n e?: React.MouseEvent | React.FocusEvent;\n listRef: React.MutableRefObject<HTMLDivElement | null>;\n}\n\nexport const isElementVisible = (tab: HTMLElement, tabList: HTMLElement): boolean => {\n const tabDimensions = tab.getBoundingClientRect();\n const tabListDimensions = tabList.getBoundingClientRect();\n\n return tabDimensions.left <= tabListDimensions.left\n ? tabListDimensions.left - tabDimensions.left <= tabDimensions.width\n : tabDimensions.right - tabListDimensions.right <= tabDimensions.width;\n};\n\nexport const isElementVisibleCarousel = (\n tab: HTMLElement | null,\n tabContainer: HTMLDivElement | null,\n firstOrLastItem = true,\n): boolean => {\n if (tab && tabContainer) {\n const tabDimensions = tab.getBoundingClientRect();\n const tabContainerDimensions = tabContainer.getBoundingClientRect();\n\n const offset = firstOrLastItem ? 16 : 32;\n const tabDimensionsLeft = Math.floor(tabDimensions.left - offset);\n const tabDimensionsRight = Math.floor(tabDimensions.right + offset);\n\n const tabContainerDimensionsLeft = Math.floor(tabContainerDimensions.left);\n const tabContainerDimensionsRight = Math.floor(tabContainerDimensions.right);\n\n return tabDimensionsLeft >= tabContainerDimensionsLeft && tabDimensionsRight <= tabContainerDimensionsRight;\n }\n return false;\n};\n\nexport const centerTab = ({ e, listRef }: CenterTabPropsT) => {\n if (listRef.current) {\n const { offsetLeft } = e?.target as HTMLButtonElement;\n const { width: tabWidth } = (e?.target as HTMLButtonElement).getBoundingClientRect();\n const { width: listWidth } = listRef.current.getBoundingClientRect();\n const extraSideSpace = listWidth - tabWidth;\n const leftOffsetToCenter = extraSideSpace > 0 ? extraSideSpace / 2 : 0;\n const centeredLeftOffset = offsetLeft > leftOffsetToCenter ? offsetLeft - leftOffsetToCenter : 0;\n listRef.current.scrollTo({\n top: 0,\n left: centeredLeftOffset,\n behavior: 'smooth',\n });\n\n e?.preventDefault();\n }\n};\n\nexport const getVisibleDimensions = (node: HTMLElement, referenceNode: HTMLElement): VisibleDimensionsT => {\n const nodeDimensions = node.getBoundingClientRect();\n const referenceNodeDimensions = referenceNode.getBoundingClientRect();\n\n return {\n width: Math.min(\n node.clientWidth,\n referenceNodeDimensions.left + referenceNode.clientWidth - nodeDimensions.left,\n node.clientWidth - (referenceNodeDimensions.left - nodeDimensions.left),\n ),\n height: Math.min(\n node.clientHeight,\n referenceNodeDimensions.top + referenceNode.clientHeight - nodeDimensions.top,\n node.clientHeight - (referenceNodeDimensions.top - nodeDimensions.top),\n ),\n };\n};\n\nexport const shouldHaveLeftGradient = (scrollLeft: number): boolean => Math.abs(scrollLeft) > MOBILE_GRADIENT_WIDTH;\n\nexport const shouldHaveRightGradient = (scrollLeft: number, clientWidth: number, scrollWidth: number): boolean =>\n Math.abs(scrollLeft) <= scrollWidth - (clientWidth + MOBILE_GRADIENT_WIDTH);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,uBAAsC;AAY/B,MAAM,mBAAmB,CAAC,KAAkB,YAAkC;AACnF,QAAM,gBAAgB,IAAI;AAC1B,QAAM,oBAAoB,QAAQ;AAElC,SAAO,cAAc,QAAQ,kBAAkB,OAC3C,kBAAkB,OAAO,cAAc,QAAQ,cAAc,QAC7D,cAAc,QAAQ,kBAAkB,SAAS,cAAc;AAAA;AAG9D,MAAM,2BAA2B,CACtC,KACA,cACA,kBAAkB,SACN;AACZ,MAAI,OAAO,cAAc;AACvB,UAAM,gBAAgB,IAAI;AAC1B,UAAM,yBAAyB,aAAa;AAE5C,UAAM,SAAS,kBAAkB,KAAK;AACtC,UAAM,oBAAoB,KAAK,MAAM,cAAc,OAAO;AAC1D,UAAM,qBAAqB,KAAK,MAAM,cAAc,QAAQ;AAE5D,UAAM,6BAA6B,KAAK,MAAM,uBAAuB;AACrE,UAAM,8BAA8B,KAAK,MAAM,uBAAuB;AAEtE,WAAO,qBAAqB,8BAA8B,sBAAsB;AAAA;AAElF,SAAO;AAAA;AAGF,MAAM,YAAY,CAAC,EAAE,GAAG,cAA+B;AAC5D,MAAI,QAAQ,SAAS;AACnB,UAAM,EAAE,eAAe,GAAG;AAC1B,UAAM,EAAE,OAAO,aAAc,IAAG,QAA6B;AAC7D,UAAM,EAAE,OAAO,cAAc,QAAQ,QAAQ;AAC7C,UAAM,iBAAiB,YAAY;AACnC,UAAM,qBAAqB,iBAAiB,IAAI,iBAAiB,IAAI;AACrE,UAAM,qBAAqB,aAAa,qBAAqB,aAAa,qBAAqB;AAC/F,YAAQ,QAAQ,SAAS;AAAA,MACvB,KAAK;AAAA,MACL,MAAM;AAAA,MACN,UAAU;AAAA;AAGZ,OAAG;AAAA;AAAA;AAIA,MAAM,uBAAuB,CAAC,MAAmB,kBAAmD;AACzG,QAAM,iBAAiB,KAAK;AAC5B,QAAM,0BAA0B,cAAc;AAE9C,SAAO;AAAA,IACL,OAAO,KAAK,IACV,KAAK,aACL,wBAAwB,OAAO,cAAc,cAAc,eAAe,MAC1E,KAAK,cAAe,yBAAwB,OAAO,eAAe;AAAA,IAEpE,QAAQ,KAAK,IACX,KAAK,cACL,wBAAwB,MAAM,cAAc,eAAe,eAAe,KAC1E,KAAK,eAAgB,yBAAwB,MAAM,eAAe;AAAA;AAAA;AAKjE,MAAM,yBAAyB,CAAC,eAAgC,KAAK,IAAI,cAAc;AAEvF,MAAM,0BAA0B,CAAC,YAAoB,aAAqB,gBAC/E,KAAK,IAAI,eAAe,cAAe,eAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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 useKeyboardNavigation_exports = {};
|
|
29
|
+
__export(useKeyboardNavigation_exports, {
|
|
30
|
+
useKeyboardNavigation: () => useKeyboardNavigation
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = require("react");
|
|
34
|
+
var import_DSTabsCTX = require("../../DSTabsCTX");
|
|
35
|
+
const useKeyboardNavigation = () => {
|
|
36
|
+
const { focusableTabsRef } = (0, import_react.useContext)(import_DSTabsCTX.DSTabsContext);
|
|
37
|
+
const { firstSubtabInternalRef, lastTabInternalRef } = (0, import_react.useContext)(import_DSTabsCTX.DSTabsCrossRefContext);
|
|
38
|
+
const handleOnKeyDown = (0, import_react.useCallback)((e) => {
|
|
39
|
+
if (e.key === "ArrowRight" && focusableTabsRef.current) {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
e.stopPropagation();
|
|
42
|
+
const nextTab = focusableTabsRef.current[focusableTabsRef?.current?.indexOf?.(e.target) + 1];
|
|
43
|
+
if (nextTab)
|
|
44
|
+
nextTab.focus();
|
|
45
|
+
if (!nextTab)
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (e.key === "ArrowLeft" && focusableTabsRef.current) {
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
const prevTab = focusableTabsRef.current[focusableTabsRef?.current?.indexOf?.(e.target) - 1];
|
|
52
|
+
if (prevTab)
|
|
53
|
+
prevTab.focus();
|
|
54
|
+
if (!prevTab)
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (e.key === "ArrowDown") {
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
e.stopPropagation();
|
|
60
|
+
const canFocusCrossTabs = firstSubtabInternalRef?.current && lastTabInternalRef?.current;
|
|
61
|
+
if (canFocusCrossTabs)
|
|
62
|
+
firstSubtabInternalRef.current?.focus();
|
|
63
|
+
}
|
|
64
|
+
if (e.key === "ArrowUp") {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
e.stopPropagation();
|
|
67
|
+
const canFocusCrossTabs = firstSubtabInternalRef?.current && lastTabInternalRef?.current;
|
|
68
|
+
if (canFocusCrossTabs)
|
|
69
|
+
lastTabInternalRef.current?.focus();
|
|
70
|
+
}
|
|
71
|
+
}, [firstSubtabInternalRef, lastTabInternalRef, focusableTabsRef]);
|
|
72
|
+
return {
|
|
73
|
+
handleOnKeyDown
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
module.exports = __toCommonJS(useKeyboardNavigation_exports);
|
|
77
|
+
//# sourceMappingURL=useKeyboardNavigation.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/utils/hooks/useKeyboardNavigation.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport React, { useCallback, useContext } from 'react';\nimport { DSTabsContext, DSTabsCrossRefContext } from '../../DSTabsCTX';\n\ninterface UseKeyboardNavigationReturnTypeT {\n handleOnKeyDown: (e: React.KeyboardEvent) => void;\n}\n\nexport const useKeyboardNavigation = (): UseKeyboardNavigationReturnTypeT => {\n const { focusableTabsRef } = useContext(DSTabsContext);\n const { firstSubtabInternalRef, lastTabInternalRef } = useContext(DSTabsCrossRefContext);\n\n const handleOnKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === 'ArrowRight' && focusableTabsRef.current) {\n e.preventDefault();\n e.stopPropagation();\n const nextTab =\n focusableTabsRef.current[focusableTabsRef?.current?.indexOf?.(e.target as HTMLButtonElement) + 1];\n if (nextTab) nextTab.focus();\n if (!nextTab) return;\n }\n\n if (e.key === 'ArrowLeft' && focusableTabsRef.current) {\n e.preventDefault();\n e.stopPropagation();\n const prevTab =\n focusableTabsRef.current[focusableTabsRef?.current?.indexOf?.(e.target as HTMLButtonElement) - 1];\n if (prevTab) prevTab.focus();\n if (!prevTab) return;\n }\n\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n e.stopPropagation();\n const canFocusCrossTabs = firstSubtabInternalRef?.current && lastTabInternalRef?.current;\n if (canFocusCrossTabs) firstSubtabInternalRef.current?.focus();\n }\n\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n e.stopPropagation();\n const canFocusCrossTabs = firstSubtabInternalRef?.current && lastTabInternalRef?.current;\n if (canFocusCrossTabs) lastTabInternalRef.current?.focus();\n }\n },\n [firstSubtabInternalRef, lastTabInternalRef, focusableTabsRef],\n );\n\n return {\n handleOnKeyDown,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAA+C;AAC/C,uBAAqD;AAM9C,MAAM,wBAAwB,MAAwC;AAC3E,QAAM,EAAE,qBAAqB,6BAAW;AACxC,QAAM,EAAE,wBAAwB,uBAAuB,6BAAW;AAElE,QAAM,kBAAkB,8BACtB,CAAC,MAA2B;AAC1B,QAAI,EAAE,QAAQ,gBAAgB,iBAAiB,SAAS;AACtD,QAAE;AACF,QAAE;AACF,YAAM,UACJ,iBAAiB,QAAQ,kBAAkB,SAAS,UAAU,EAAE,UAA+B;AACjG,UAAI;AAAS,gBAAQ;AACrB,UAAI,CAAC;AAAS;AAAA;AAGhB,QAAI,EAAE,QAAQ,eAAe,iBAAiB,SAAS;AACrD,QAAE;AACF,QAAE;AACF,YAAM,UACJ,iBAAiB,QAAQ,kBAAkB,SAAS,UAAU,EAAE,UAA+B;AACjG,UAAI;AAAS,gBAAQ;AACrB,UAAI,CAAC;AAAS;AAAA;AAGhB,QAAI,EAAE,QAAQ,aAAa;AACzB,QAAE;AACF,QAAE;AACF,YAAM,oBAAoB,wBAAwB,WAAW,oBAAoB;AACjF,UAAI;AAAmB,+BAAuB,SAAS;AAAA;AAGzD,QAAI,EAAE,QAAQ,WAAW;AACvB,QAAE;AACF,QAAE;AACF,YAAM,oBAAoB,wBAAwB,WAAW,oBAAoB;AACjF,UAAI;AAAmB,2BAAmB,SAAS;AAAA;AAAA,KAGvD,CAAC,wBAAwB,oBAAoB;AAG/C,SAAO;AAAA,IACL;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
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 useTabsCallbacks_exports = {};
|
|
29
|
+
__export(useTabsCallbacks_exports, {
|
|
30
|
+
useTabsCallbacks: () => useTabsCallbacks
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react = require("react");
|
|
34
|
+
var import_helpers = require("../helpers");
|
|
35
|
+
var import_DSTabsCTX = require("../../DSTabsCTX");
|
|
36
|
+
const useTabsCallbacks = () => {
|
|
37
|
+
const {
|
|
38
|
+
setInternalActiveTab,
|
|
39
|
+
tabsListRef,
|
|
40
|
+
props: { onTabChange, isDSMobile, allowTextSelection, fixedTabsHeaders }
|
|
41
|
+
} = (0, import_react.useContext)(import_DSTabsCTX.DSTabsContext);
|
|
42
|
+
const handleOnTabChange = (0, import_react.useCallback)((tabId, e) => {
|
|
43
|
+
setInternalActiveTab(tabId);
|
|
44
|
+
onTabChange(tabId, e);
|
|
45
|
+
if (isDSMobile && !fixedTabsHeaders && e) {
|
|
46
|
+
(0, import_helpers.centerTab)({ e, listRef: tabsListRef });
|
|
47
|
+
}
|
|
48
|
+
}, [fixedTabsHeaders, isDSMobile, onTabChange, setInternalActiveTab, tabsListRef]);
|
|
49
|
+
const handleOnMouseDown = (0, import_react.useCallback)((e) => {
|
|
50
|
+
const role = e.target.getAttribute("role");
|
|
51
|
+
if (role !== "tabpanel" && allowTextSelection)
|
|
52
|
+
e.stopPropagation();
|
|
53
|
+
}, [allowTextSelection]);
|
|
54
|
+
return {
|
|
55
|
+
handleOnTabChange,
|
|
56
|
+
handleOnMouseDown
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
module.exports = __toCommonJS(useTabsCallbacks_exports);
|
|
60
|
+
//# sourceMappingURL=useTabsCallbacks.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/utils/hooks/useTabsCallbacks.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useCallback, useContext } from 'react';\nimport { centerTab } from '../helpers';\nimport { DSTabsContext } from '../../DSTabsCTX';\n\ninterface UseTabsCallbacksReturnTypeT {\n handleOnTabChange: (tabId: string, e?: React.MouseEvent) => void;\n handleOnMouseDown: (e: React.MouseEvent) => void;\n}\n\nexport const useTabsCallbacks = (): UseTabsCallbacksReturnTypeT => {\n const {\n setInternalActiveTab,\n tabsListRef,\n props: { onTabChange, isDSMobile, allowTextSelection, fixedTabsHeaders },\n } = useContext(DSTabsContext);\n\n const handleOnTabChange = useCallback(\n (tabId: string, e?: React.MouseEvent) => {\n setInternalActiveTab(tabId);\n onTabChange(tabId, e);\n if (isDSMobile && !fixedTabsHeaders && e) {\n centerTab({ e, listRef: tabsListRef });\n }\n },\n [fixedTabsHeaders, isDSMobile, onTabChange, setInternalActiveTab, tabsListRef],\n );\n\n const handleOnMouseDown = useCallback(\n (e: React.MouseEvent) => {\n const role = (e.target as HTMLElement).getAttribute('role');\n if (role !== 'tabpanel' && allowTextSelection) e.stopPropagation();\n },\n [allowTextSelection],\n );\n\n return {\n handleOnTabChange,\n handleOnMouseDown,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA+C;AAC/C,qBAA0B;AAC1B,uBAA8B;AAOvB,MAAM,mBAAmB,MAAmC;AACjE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,OAAO,EAAE,aAAa,YAAY,oBAAoB;AAAA,MACpD,6BAAW;AAEf,QAAM,oBAAoB,8BACxB,CAAC,OAAe,MAAyB;AACvC,yBAAqB;AACrB,gBAAY,OAAO;AACnB,QAAI,cAAc,CAAC,oBAAoB,GAAG;AACxC,oCAAU,EAAE,GAAG,SAAS;AAAA;AAAA,KAG5B,CAAC,kBAAkB,YAAY,aAAa,sBAAsB;AAGpE,QAAM,oBAAoB,8BACxB,CAAC,MAAwB;AACvB,UAAM,OAAQ,EAAE,OAAuB,aAAa;AACpD,QAAI,SAAS,cAAc;AAAoB,QAAE;AAAA,KAEnD,CAAC;AAGH,SAAO;AAAA,IACL;AAAA,IACA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|