@elliemae/ds-tabs 2.3.0-alpha.8 → 2.3.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/DSTabs.js +45 -0
- package/cjs/DSTabsCTX.js +30 -0
- package/cjs/DSTabsDatatestid.js +18 -0
- package/cjs/DSTabsTypes.js +2 -0
- package/cjs/config/useCrossRef.js +17 -0
- package/cjs/config/useTabs.js +51 -0
- package/cjs/defaultProps.js +27 -0
- package/cjs/exportsRelated/DSTab.js +32 -0
- package/cjs/index.js +17 -0
- package/cjs/parts/carousel/Carousel.js +69 -0
- package/cjs/parts/carousel/styles.js +65 -0
- package/cjs/parts/carousel/useCarousel.js +78 -0
- package/cjs/parts/carousel/useCarouselCallbacks.js +72 -0
- package/cjs/parts/tabBar/TabBar.js +168 -0
- package/cjs/parts/tabBar/styles.js +200 -0
- package/cjs/parts/tabBar/useTabBar.js +87 -0
- package/cjs/parts/tabsContent/TabsContent.js +49 -0
- package/cjs/parts/tabsContent/styles.js +15 -0
- package/cjs/parts/tabsPanel/TabsPanels.js +77 -0
- package/cjs/parts/tabsPanel/styles.js +25 -0
- package/cjs/propTypes.js +33 -0
- package/cjs/utils/constants.js +28 -0
- package/cjs/utils/helpers.js +75 -0
- package/cjs/utils/hooks/useKeyboardNavigation.js +61 -0
- package/cjs/utils/hooks/useTabsCallbacks.js +41 -0
- package/esm/DSTabs.js +35 -0
- package/esm/DSTabsCTX.js +25 -0
- package/esm/DSTabsDatatestid.js +14 -0
- package/esm/DSTabsTypes.js +1 -0
- package/{dist/esm → esm}/config/useCrossRef.js +4 -6
- package/esm/config/useTabs.js +47 -0
- package/{dist/esm → esm}/defaultProps.js +8 -9
- package/esm/exportsRelated/DSTab.js +21 -0
- package/esm/index.js +4 -0
- package/esm/parts/carousel/Carousel.js +61 -0
- package/esm/parts/carousel/styles.js +54 -0
- package/{dist/esm → esm}/parts/carousel/useCarousel.js +34 -15
- package/{dist/esm → esm}/parts/carousel/useCarouselCallbacks.js +28 -20
- package/esm/parts/tabBar/TabBar.js +159 -0
- package/esm/parts/tabBar/styles.js +186 -0
- package/{dist/esm → esm}/parts/tabBar/useTabBar.js +35 -27
- package/esm/parts/tabsContent/TabsContent.js +40 -0
- package/esm/parts/tabsContent/styles.js +7 -0
- package/esm/parts/tabsPanel/TabsPanels.js +67 -0
- package/esm/parts/tabsPanel/styles.js +17 -0
- package/esm/propTypes.js +28 -0
- package/esm/utils/constants.js +20 -0
- package/{dist/esm → esm}/utils/helpers.js +28 -23
- package/esm/utils/hooks/useKeyboardNavigation.js +57 -0
- package/esm/utils/hooks/useTabsCallbacks.js +37 -0
- package/package.json +70 -72
- package/types/DSTabs.d.ts +14 -0
- package/types/DSTabsCTX.d.ts +4 -0
- package/types/DSTabsDatatestid.d.ts +12 -0
- package/types/DSTabsTypes.d.ts +205 -0
- package/types/config/useCrossRef.d.ts +2 -0
- package/types/config/useTabs.d.ts +2 -0
- package/types/defaultProps.d.ts +2 -0
- package/types/exportsRelated/DSTab.d.ts +14 -0
- package/types/index.d.ts +5 -0
- package/types/parts/carousel/Carousel.d.ts +3 -0
- package/types/parts/carousel/styles.d.ts +9 -0
- package/types/parts/carousel/useCarousel.d.ts +2 -0
- package/types/parts/carousel/useCarouselCallbacks.d.ts +2 -0
- package/types/parts/tabBar/TabBar.d.ts +2 -0
- package/types/parts/tabBar/styles.d.ts +7 -0
- package/types/parts/tabBar/useTabBar.d.ts +2 -0
- package/types/parts/tabsContent/TabsContent.d.ts +2 -0
- package/types/parts/tabsContent/styles.d.ts +1 -0
- package/types/parts/tabsPanel/TabsPanels.d.ts +2 -0
- package/types/parts/tabsPanel/styles.d.ts +2 -0
- package/types/propTypes.d.ts +54 -0
- package/types/tests/DSTabs.callbacks.test.d.ts +1 -0
- package/types/tests/DSTabs.func.test.d.ts +1 -0
- package/types/tests/DSTabs.keyboard.test.d.ts +1 -0
- package/types/tests/DSTabs.test.d.ts +1 -0
- package/types/utils/constants.d.ts +18 -0
- package/types/utils/helpers.d.ts +9 -0
- package/types/utils/hooks/useKeyboardNavigation.d.ts +2 -0
- package/types/utils/hooks/useTabsCallbacks.d.ts +2 -0
- package/dist/cjs/DSTabs.js +0 -63
- package/dist/cjs/DSTabs.js.map +0 -7
- package/dist/cjs/DSTabsCTX.js +0 -56
- package/dist/cjs/DSTabsCTX.js.map +0 -7
- package/dist/cjs/DSTabsDatatestid.js +0 -46
- package/dist/cjs/DSTabsDatatestid.js.map +0 -7
- package/dist/cjs/DSTabsTypes.js +0 -27
- package/dist/cjs/DSTabsTypes.js.map +0 -7
- package/dist/cjs/config/useCrossRef.js +0 -44
- package/dist/cjs/config/useCrossRef.js.map +0 -7
- package/dist/cjs/config/useTabs.js +0 -68
- package/dist/cjs/config/useTabs.js.map +0 -7
- package/dist/cjs/defaultProps.js +0 -53
- package/dist/cjs/defaultProps.js.map +0 -7
- package/dist/cjs/exportsRelated/DSTab.js +0 -46
- package/dist/cjs/exportsRelated/DSTab.js.map +0 -7
- package/dist/cjs/index.js +0 -38
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/parts/carousel/Carousel.js +0 -77
- package/dist/cjs/parts/carousel/Carousel.js.map +0 -7
- package/dist/cjs/parts/carousel/styles.js +0 -79
- package/dist/cjs/parts/carousel/styles.js.map +0 -7
- package/dist/cjs/parts/carousel/useCarousel.js +0 -80
- package/dist/cjs/parts/carousel/useCarousel.js.map +0 -7
- package/dist/cjs/parts/carousel/useCarouselCallbacks.js +0 -89
- package/dist/cjs/parts/carousel/useCarouselCallbacks.js.map +0 -7
- package/dist/cjs/parts/tabBar/TabBar.js +0 -171
- package/dist/cjs/parts/tabBar/TabBar.js.map +0 -7
- package/dist/cjs/parts/tabBar/styles.js +0 -294
- package/dist/cjs/parts/tabBar/styles.js.map +0 -7
- package/dist/cjs/parts/tabBar/useTabBar.js +0 -100
- package/dist/cjs/parts/tabBar/useTabBar.js.map +0 -7
- package/dist/cjs/parts/tabsContent/TabsContent.js +0 -53
- package/dist/cjs/parts/tabsContent/TabsContent.js.map +0 -7
- package/dist/cjs/parts/tabsContent/styles.js +0 -39
- package/dist/cjs/parts/tabsContent/styles.js.map +0 -7
- package/dist/cjs/parts/tabsPanel/TabsPanels.js +0 -79
- package/dist/cjs/parts/tabsPanel/TabsPanels.js.map +0 -7
- package/dist/cjs/parts/tabsPanel/styles.js +0 -45
- package/dist/cjs/parts/tabsPanel/styles.js.map +0 -7
- package/dist/cjs/propTypes.js +0 -58
- package/dist/cjs/propTypes.js.map +0 -7
- package/dist/cjs/utils/constants.js +0 -56
- package/dist/cjs/utils/constants.js.map +0 -7
- package/dist/cjs/utils/helpers.js +0 -88
- package/dist/cjs/utils/helpers.js.map +0 -7
- package/dist/cjs/utils/hooks/useKeyboardNavigation.js +0 -77
- package/dist/cjs/utils/hooks/useKeyboardNavigation.js.map +0 -7
- package/dist/cjs/utils/hooks/useTabsCallbacks.js +0 -60
- package/dist/cjs/utils/hooks/useTabsCallbacks.js.map +0 -7
- package/dist/esm/DSTabs.js +0 -34
- package/dist/esm/DSTabs.js.map +0 -7
- package/dist/esm/DSTabsCTX.js +0 -27
- package/dist/esm/DSTabsCTX.js.map +0 -7
- package/dist/esm/DSTabsDatatestid.js +0 -17
- package/dist/esm/DSTabsDatatestid.js.map +0 -7
- package/dist/esm/DSTabsTypes.js +0 -2
- package/dist/esm/DSTabsTypes.js.map +0 -7
- package/dist/esm/config/useCrossRef.js.map +0 -7
- package/dist/esm/config/useTabs.js +0 -39
- package/dist/esm/config/useTabs.js.map +0 -7
- package/dist/esm/defaultProps.js.map +0 -7
- package/dist/esm/exportsRelated/DSTab.js +0 -17
- package/dist/esm/exportsRelated/DSTab.js.map +0 -7
- package/dist/esm/index.js +0 -9
- package/dist/esm/index.js.map +0 -7
- package/dist/esm/parts/carousel/Carousel.js +0 -48
- package/dist/esm/parts/carousel/Carousel.js.map +0 -7
- package/dist/esm/parts/carousel/styles.js +0 -50
- package/dist/esm/parts/carousel/styles.js.map +0 -7
- package/dist/esm/parts/carousel/useCarousel.js.map +0 -7
- package/dist/esm/parts/carousel/useCarouselCallbacks.js.map +0 -7
- package/dist/esm/parts/tabBar/TabBar.js +0 -149
- package/dist/esm/parts/tabBar/TabBar.js.map +0 -7
- package/dist/esm/parts/tabBar/styles.js +0 -265
- package/dist/esm/parts/tabBar/styles.js.map +0 -7
- package/dist/esm/parts/tabBar/useTabBar.js.map +0 -7
- package/dist/esm/parts/tabsContent/TabsContent.js +0 -24
- package/dist/esm/parts/tabsContent/TabsContent.js.map +0 -7
- package/dist/esm/parts/tabsContent/styles.js +0 -10
- package/dist/esm/parts/tabsContent/styles.js.map +0 -7
- package/dist/esm/parts/tabsPanel/TabsPanels.js +0 -50
- package/dist/esm/parts/tabsPanel/TabsPanels.js.map +0 -7
- package/dist/esm/parts/tabsPanel/styles.js +0 -16
- package/dist/esm/parts/tabsPanel/styles.js.map +0 -7
- package/dist/esm/propTypes.js +0 -29
- package/dist/esm/propTypes.js.map +0 -7
- package/dist/esm/utils/constants.js +0 -27
- package/dist/esm/utils/constants.js.map +0 -7
- package/dist/esm/utils/helpers.js.map +0 -7
- package/dist/esm/utils/hooks/useKeyboardNavigation.js +0 -48
- package/dist/esm/utils/hooks/useKeyboardNavigation.js.map +0 -7
- package/dist/esm/utils/hooks/useTabsCallbacks.js +0 -31
- package/dist/esm/utils/hooks/useTabsCallbacks.js.map +0 -7
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/DSTabsTypes.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\nimport type React from 'react';\nimport { TabTypes } from './utils/constants';\n\n// **** **** **** **** **** **** **** **** CONSTANT TYPES **** **** **** **** **** **** **** **** **** //\n\ntype TabTypesT = typeof TabTypes[keyof typeof TabTypes];\n\n// **** **** **** **** **** **** **** **** COMPONENT TYPES **** **** **** **** **** **** **** **** **** //\n\nexport interface DSTabsPropsT {\n containerProps?: Record<string, unknown>;\n innerRef?: React.MutableRefObject<HTMLDivElement>;\n animated?: boolean;\n enableMouseEvents?: boolean;\n allowTextSelection?: boolean;\n onTabChange?: (tabId: string, e?: React.MouseEvent) => void;\n tabsListAriaLabel?: string;\n type?: TabTypesT;\n tabBarExtraContent?: React.ReactNode;\n children: React.ReactElement<DSTabPropsWithDefaultT>[];\n onlyRenderActiveTab?: boolean;\n activeTab?: string;\n withCarousel?: boolean;\n firstSubtabRef?: React.MutableRefObject<HTMLElement>;\n lastTabRef?: React.MutableRefObject<HTMLElement>;\n fixedTabsHeaders?: boolean;\n isDSMobile?: boolean;\n showSelectionIndicator?: boolean;\n showSeparator?: boolean;\n}\n\nexport interface DSTabsPropsWithDefaultsT {\n containerProps: Record<string, unknown>;\n innerRef?: React.MutableRefObject<HTMLDivElement>;\n animated: boolean;\n enableMouseEvents: boolean;\n allowTextSelection: boolean;\n onTabChange: (tabId: string, e?: React.MouseEvent) => void;\n tabsListAriaLabel: string;\n type: TabTypesT;\n tabBarExtraContent?: React.ReactNode;\n children: React.ReactElement<DSTabPropsWithDefaultT>[];\n onlyRenderActiveTab: boolean;\n activeTab?: string;\n withCarousel: boolean;\n firstSubtabRef?: React.MutableRefObject<HTMLElement>;\n lastTabRef?: React.MutableRefObject<HTMLElement>;\n fixedTabsHeaders: boolean;\n isDSMobile: boolean;\n showSelectionIndicator: boolean;\n showSeparator: boolean;\n}\n\nexport interface DSTabsDefaultPropsT {\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: TabTypesT;\n onlyRenderActiveTab: boolean;\n fixedTabsHeaders: boolean;\n children: React.ReactElement<DSTabPropsWithDefaultT>[];\n withCarousel: boolean;\n isDSMobile: boolean;\n showSelectionIndicator: boolean;\n showSeparator: boolean;\n}\n\nexport interface CarouselPropsT {\n children: React.ReactNode[];\n updateIndicatorStyle?: () => void;\n}\n\nexport interface DSTabPropsT {\n tabId: string;\n title?: string;\n required?: boolean;\n children?: React.ReactNode;\n style?: Record<string, unknown>;\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\nexport interface DSTabPropsWithDefaultT {\n tabId: string;\n title: string;\n required: boolean;\n children?: React.ReactNode;\n style?: Record<string, unknown>;\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\nexport interface CarouselButtonsPropsT {\n leftButtonOnClick: () => void;\n rightButtonOnClick: () => void;\n showChevrons: ShowChevronsT;\n type: TabTypesT;\n}\n\n// **** **** **** **** **** **** **** **** CONTEXT AND HOOK TYPES **** **** **** **** **** **** **** **** **** //\n\nexport interface DSTabsUseCrossRefContextT {\n lastTabInternalRef: React.MutableRefObject<HTMLButtonElement | null | undefined>;\n firstSubtabInternalRef: React.MutableRefObject<HTMLButtonElement | null | undefined>;\n}\n\nexport interface DSTabsUseTabsContextT {\n props: DSTabsPropsWithDefaultsT;\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\nexport interface UseRezisePropsT {\n ref: React.MutableRefObject<HTMLDivElement | null>;\n callback: () => void;\n}\n\nexport interface UseCarouselPropsT {\n updateIndicatorStyle?: () => void;\n}\n\nexport interface ShowChevronsT {\n right: boolean;\n left: boolean;\n}\n\nexport interface MobileGradientsT {\n right: boolean;\n left: boolean;\n}\n\nexport interface IndicatorStyleT {\n left: string;\n width: string;\n backgroundWithTransparent: string;\n}\nexport interface UseCarouselReturnTypeT {\n showChevrons: ShowChevronsT;\n leftButtonOnClick: () => void;\n rightButtonOnClick: () => void;\n handleOnClick: (e: React.MouseEvent) => void;\n handleOnScroll: (e: React.UIEvent) => void;\n}\n\nexport interface UseCarouselCallbacksPropsT {\n getVisibleItemsOffset: () => number;\n recalcChevrons: () => void;\n updateIndicatorStyle?: () => void;\n}\n\nexport interface UseCarouselCallbacksReturnTypeT {\n leftButtonOnClick: () => void;\n rightButtonOnClick: () => void;\n handleOnClick: (e: React.MouseEvent) => void;\n handleOnScroll: (e: React.UIEvent) => void;\n}\n\nexport interface UseKeyboardNavigationReturnTypeT {\n handleOnKeyDown: (e: React.KeyboardEvent) => void;\n}\n\nexport interface UseTabsCallbacksReturnTypeT {\n handleOnTabChange: (tabId: string, e?: React.MouseEvent) => void;\n handleOnMouseDown: (e: React.MouseEvent) => void;\n}\n\nexport interface UseTabBarReturnTypeT {\n updateIndicatorStyle: () => void;\n updateMobileGradients: () => void;\n setIndicatorStyle: React.Dispatch<React.SetStateAction<IndicatorStyleT>>;\n indicatorStyle: IndicatorStyleT;\n mobileGradients: MobileGradientsT;\n}\n\n// **** **** **** **** **** **** **** **** HELPERS TYPES **** **** **** **** **** **** **** **** **** //\n\nexport interface VisibleDimensionsT {\n width: number;\n height: number;\n}\n\nexport interface CenterTabPropsT {\n e?: React.MouseEvent | React.FocusEvent;\n listRef: React.MutableRefObject<HTMLDivElement | null>;\n}\n\n// **** **** **** **** **** **** **** **** STYLED TYPES **** **** **** **** **** **** **** **** **** //\n\nexport interface StyledTabWrapperPropsT {\n isDSMobile: boolean;\n fixedTabsHeaders: boolean;\n}\n\nexport interface StyledTabListPropsT {\n withCarousel: boolean;\n isDSMobile: boolean;\n fixedTabsHeaders: boolean;\n mobileGradients: MobileGradientsT;\n indicatorStyle: IndicatorStyleT;\n tabType: TabTypesT;\n}\n\nexport interface StyledSubTabsListPropsT {\n withCarousel: boolean;\n}\n\nexport interface StyledTabButtonPropsT {\n isActive: boolean;\n disabled: boolean;\n showSeparator: boolean;\n isDSMobile: boolean;\n fixedTabsHeaders: boolean;\n withCarousel: boolean;\n tabType: TabTypesT;\n}\n\nexport interface StyledCarouselButtonWrapperPropsT {\n right?: boolean;\n tabType: TabTypesT;\n}\n\nexport interface StyledPanelContainerPropsT {\n hidden: boolean;\n isDSMobile: boolean;\n}\n\nexport interface StyledSelectionIndicatoPropsT {\n isDSMobile: boolean;\n tabType: TabTypesT;\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;ACAA,YAAuB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
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 useCrossRef_exports = {};
|
|
29
|
-
__export(useCrossRef_exports, {
|
|
30
|
-
useCrossRef: () => useCrossRef
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_react = require("react");
|
|
34
|
-
const useCrossRef = () => {
|
|
35
|
-
const firstSubtabInternalRef = (0, import_react.useRef)();
|
|
36
|
-
const lastTabInternalRef = (0, import_react.useRef)();
|
|
37
|
-
const ctx = (0, import_react.useMemo)(() => ({
|
|
38
|
-
firstSubtabInternalRef,
|
|
39
|
-
lastTabInternalRef
|
|
40
|
-
}), []);
|
|
41
|
-
return ctx;
|
|
42
|
-
};
|
|
43
|
-
module.exports = __toCommonJS(useCrossRef_exports);
|
|
44
|
-
//# sourceMappingURL=useCrossRef.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/config/useCrossRef.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useRef, useMemo } from 'react';\nimport type { DSTabsUseCrossRefContextT } from '../DSTabsTypes';\n\nexport const useCrossRef = (): DSTabsUseCrossRefContextT => {\n const firstSubtabInternalRef = useRef<HTMLButtonElement>();\n const lastTabInternalRef = useRef<HTMLButtonElement>();\n\n const ctx = useMemo(\n () => ({\n firstSubtabInternalRef,\n lastTabInternalRef,\n }),\n [],\n );\n\n return ctx;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAgC;AAGzB,MAAM,cAAc,MAAiC;AAC1D,QAAM,yBAAyB;AAC/B,QAAM,qBAAqB;AAE3B,QAAM,MAAM,0BACV,MAAO;AAAA,IACL;AAAA,IACA;AAAA,MAEF;AAGF,SAAO;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
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 useTabs_exports = {};
|
|
29
|
-
__export(useTabs_exports, {
|
|
30
|
-
useTabs: () => useTabs
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_react = require("react");
|
|
34
|
-
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
35
|
-
var import_defaultProps = require("../defaultProps");
|
|
36
|
-
const useTabs = (props) => {
|
|
37
|
-
const propsWithDefaults = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_defaultProps.tabsDefaultProps);
|
|
38
|
-
const { activeTab, children } = propsWithDefaults;
|
|
39
|
-
const tabsRef = (0, import_react.useRef)({});
|
|
40
|
-
const tabsRefAsArray = (0, import_react.useRef)([]);
|
|
41
|
-
const focusableTabsRef = (0, import_react.useRef)([]);
|
|
42
|
-
const carouselOnlyListRef = (0, import_react.useRef)(null);
|
|
43
|
-
const tabsListRef = (0, import_react.useRef)(null);
|
|
44
|
-
const actualActiveTabRef = (0, import_react.useRef)(null);
|
|
45
|
-
const [internalActiveTab, setInternalActiveTab] = (0, import_react.useState)(children?.[0]?.props?.tabId);
|
|
46
|
-
const actualActiveTab = (0, import_react.useMemo)(() => {
|
|
47
|
-
if (activeTab !== void 0)
|
|
48
|
-
return activeTab;
|
|
49
|
-
return internalActiveTab;
|
|
50
|
-
}, [activeTab, internalActiveTab]);
|
|
51
|
-
(0, import_react.useEffect)(() => {
|
|
52
|
-
actualActiveTabRef.current = focusableTabsRef.current.find((el) => el.dataset.tabId === actualActiveTab) ?? null;
|
|
53
|
-
}, [actualActiveTab]);
|
|
54
|
-
const ctx = (0, import_react.useMemo)(() => ({
|
|
55
|
-
props: propsWithDefaults,
|
|
56
|
-
tabsRef,
|
|
57
|
-
focusableTabsRef,
|
|
58
|
-
tabsListRef,
|
|
59
|
-
tabsRefAsArray,
|
|
60
|
-
setInternalActiveTab,
|
|
61
|
-
actualActiveTab,
|
|
62
|
-
actualActiveTabRef,
|
|
63
|
-
carouselOnlyListRef
|
|
64
|
-
}), [actualActiveTab, propsWithDefaults]);
|
|
65
|
-
return ctx;
|
|
66
|
-
};
|
|
67
|
-
module.exports = __toCommonJS(useTabs_exports);
|
|
68
|
-
//# sourceMappingURL=useTabs.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/config/useTabs.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useRef, useState, useMemo, useEffect } from 'react';\nimport { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { tabsDefaultProps } from '../defaultProps';\nimport type { DSTabsPropsT, DSTabsUseTabsContextT, DSTabsPropsWithDefaultsT } from '../DSTabsTypes';\n\nexport const useTabs = (props: DSTabsPropsT): DSTabsUseTabsContextT => {\n const propsWithDefaults = useMemoMergePropsWithDefault(props, tabsDefaultProps) as DSTabsPropsWithDefaultsT;\n\n const { activeTab, children } = propsWithDefaults;\n\n const tabsRef = useRef<Record<number, HTMLButtonElement>>({});\n const tabsRefAsArray = useRef<HTMLButtonElement[]>([]);\n const focusableTabsRef = useRef<HTMLButtonElement[]>([]);\n const carouselOnlyListRef = useRef<HTMLDivElement | null>(null);\n const tabsListRef = useRef<HTMLDivElement | null>(null);\n const actualActiveTabRef = useRef<HTMLButtonElement | null>(null);\n\n const [internalActiveTab, setInternalActiveTab] = useState<string>(children?.[0]?.props?.tabId);\n\n const actualActiveTab = useMemo(() => {\n if (activeTab !== undefined) return activeTab;\n return internalActiveTab;\n }, [activeTab, internalActiveTab]);\n\n useEffect(() => {\n actualActiveTabRef.current = focusableTabsRef.current.find((el) => el.dataset.tabId === actualActiveTab) ?? null;\n }, [actualActiveTab]);\n\n const ctx = useMemo(\n () => ({\n props: propsWithDefaults,\n tabsRef,\n focusableTabsRef,\n tabsListRef,\n tabsRefAsArray,\n setInternalActiveTab,\n actualActiveTab,\n actualActiveTabRef,\n carouselOnlyListRef,\n }),\n [actualActiveTab, propsWithDefaults],\n );\n\n return ctx;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAqD;AACrD,8BAA6C;AAC7C,0BAAiC;AAG1B,MAAM,UAAU,CAAC,UAA+C;AACrE,QAAM,oBAAoB,0DAA6B,OAAO;AAE9D,QAAM,EAAE,WAAW,aAAa;AAEhC,QAAM,UAAU,yBAA0C;AAC1D,QAAM,iBAAiB,yBAA4B;AACnD,QAAM,mBAAmB,yBAA4B;AACrD,QAAM,sBAAsB,yBAA8B;AAC1D,QAAM,cAAc,yBAA8B;AAClD,QAAM,qBAAqB,yBAAiC;AAE5D,QAAM,CAAC,mBAAmB,wBAAwB,2BAAiB,WAAW,IAAI,OAAO;AAEzF,QAAM,kBAAkB,0BAAQ,MAAM;AACpC,QAAI,cAAc;AAAW,aAAO;AACpC,WAAO;AAAA,KACN,CAAC,WAAW;AAEf,8BAAU,MAAM;AACd,uBAAmB,UAAU,iBAAiB,QAAQ,KAAK,CAAC,OAAO,GAAG,QAAQ,UAAU,oBAAoB;AAAA,KAC3G,CAAC;AAEJ,QAAM,MAAM,0BACV,MAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MAEF,CAAC,iBAAiB;AAGpB,SAAO;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/cjs/defaultProps.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
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 defaultProps_exports = {};
|
|
29
|
-
__export(defaultProps_exports, {
|
|
30
|
-
tabsDefaultProps: () => tabsDefaultProps
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_constants = require("./utils/constants");
|
|
34
|
-
const noop = () => {
|
|
35
|
-
};
|
|
36
|
-
const tabsDefaultProps = {
|
|
37
|
-
containerProps: {},
|
|
38
|
-
animated: true,
|
|
39
|
-
enableMouseEvents: false,
|
|
40
|
-
allowTextSelection: false,
|
|
41
|
-
onTabChange: noop,
|
|
42
|
-
tabsListAriaLabel: "Tab list",
|
|
43
|
-
type: import_constants.TabTypes.NORMAL,
|
|
44
|
-
onlyRenderActiveTab: false,
|
|
45
|
-
withCarousel: false,
|
|
46
|
-
isDSMobile: false,
|
|
47
|
-
showSelectionIndicator: true,
|
|
48
|
-
children: [],
|
|
49
|
-
fixedTabsHeaders: false,
|
|
50
|
-
showSeparator: true
|
|
51
|
-
};
|
|
52
|
-
module.exports = __toCommonJS(defaultProps_exports);
|
|
53
|
-
//# sourceMappingURL=defaultProps.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/defaultProps.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { TabTypes } from './utils/constants';\nimport type { DSTabsDefaultPropsT } from './DSTabsTypes';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\n\nexport const tabsDefaultProps: DSTabsDefaultPropsT = {\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;ACAA,YAAuB;ADAvB,uBAAyB;AAIzB,MAAM,OAAO,MAAY;AAAA;AAElB,MAAM,mBAAwC;AAAA,EACnD,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
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
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 DSTab_exports = {};
|
|
29
|
-
__export(DSTab_exports, {
|
|
30
|
-
DSTab: () => DSTab,
|
|
31
|
-
DSTabWithSchema: () => DSTabWithSchema,
|
|
32
|
-
default: () => DSTab_default
|
|
33
|
-
});
|
|
34
|
-
var React = __toESM(require("react"));
|
|
35
|
-
var import_react = __toESM(require("react"));
|
|
36
|
-
var import_react_desc = require("react-desc");
|
|
37
|
-
var import_propTypes = require("../propTypes");
|
|
38
|
-
const DSTab = (props) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, {
|
|
39
|
-
...props
|
|
40
|
-
});
|
|
41
|
-
DSTab.propTypes = import_propTypes.tabPropTypes;
|
|
42
|
-
const DSTabWithSchema = (0, import_react_desc.describe)(DSTab);
|
|
43
|
-
DSTabWithSchema.propTypes = import_propTypes.tabPropTypes;
|
|
44
|
-
var DSTab_default = DSTab;
|
|
45
|
-
module.exports = __toCommonJS(DSTab_exports);
|
|
46
|
-
//# sourceMappingURL=DSTab.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/exportsRelated/DSTab.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport type { WeakValidationMap } from 'react';\nimport { describe } from 'react-desc';\nimport { tabPropTypes } from '../propTypes';\nimport type { DSTabPropsT } from '../DSTabsTypes';\n\nconst DSTab = (props: DSTabPropsT): JSX.Element => <React.Fragment {...props} />;\n\nDSTab.propTypes = tabPropTypes as WeakValidationMap<unknown>;\nconst DSTabWithSchema = describe<DSTabPropsT>(DSTab);\nDSTabWithSchema.propTypes = tabPropTypes;\n\nexport { DSTab, DSTabWithSchema };\nexport default DSTab;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAElB,wBAAyB;AACzB,uBAA6B;AAG7B,MAAM,QAAQ,CAAC,UAAoC,mDAAC,qBAAM,UAAP;AAAA,KAAoB;AAAA;AAEvE,MAAM,YAAY;AAClB,MAAM,kBAAkB,gCAAsB;AAC9C,gBAAgB,YAAY;AAG5B,IAAO,gBAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/cjs/index.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
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 src_exports = {};
|
|
29
|
-
__export(src_exports, {
|
|
30
|
-
TabTypes: () => import_constants.TabTypes
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
__reExport(src_exports, require("./exportsRelated/DSTab"));
|
|
34
|
-
__reExport(src_exports, require("./DSTabs"));
|
|
35
|
-
var import_constants = require("./utils/constants");
|
|
36
|
-
__reExport(src_exports, require("./DSTabsDatatestid"));
|
|
37
|
-
module.exports = __toCommonJS(src_exports);
|
|
38
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export * from './exportsRelated/DSTab';\nexport * from './DSTabs';\nexport { TabTypes } from './utils/constants';\nexport * from './DSTabsDatatestid';\n\nexport type { DSTabsPropsT, DSTabPropsT } from './DSTabsTypes';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc;AACd,wBAAc;AACd,uBAAyB;AACzB,wBAAc;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
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 Carousel_exports = {};
|
|
29
|
-
__export(Carousel_exports, {
|
|
30
|
-
Carousel: () => Carousel
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_react = require("react");
|
|
34
|
-
var import_ds_icon = require("@elliemae/ds-icon");
|
|
35
|
-
var import_ds_button = require("@elliemae/ds-button");
|
|
36
|
-
var import_ds_icons = require("@elliemae/ds-icons");
|
|
37
|
-
var import_styles = require("./styles");
|
|
38
|
-
var import_useCarousel = require("./useCarousel");
|
|
39
|
-
var import_DSTabsCTX = require("../../DSTabsCTX");
|
|
40
|
-
var import_DSTabsDatatestid = require("../../DSTabsDatatestid");
|
|
41
|
-
const Carousel = ({ children, updateIndicatorStyle }) => {
|
|
42
|
-
const { showChevrons, leftButtonOnClick, rightButtonOnClick, handleOnClick, handleOnScroll } = (0, import_useCarousel.useCarousel)({
|
|
43
|
-
updateIndicatorStyle
|
|
44
|
-
});
|
|
45
|
-
const {
|
|
46
|
-
carouselOnlyListRef,
|
|
47
|
-
props: { type }
|
|
48
|
-
} = (0, import_react.useContext)(import_DSTabsCTX.DSTabsContext);
|
|
49
|
-
return /* @__PURE__ */ React.createElement(import_styles.StyledCarouselWrapper, null, showChevrons.left && /* @__PURE__ */ React.createElement(import_styles.StyledCarouselButtonWrapper, {
|
|
50
|
-
tabType: type
|
|
51
|
-
}, /* @__PURE__ */ React.createElement(import_styles.StyledCarouselBtn, {
|
|
52
|
-
size: "s",
|
|
53
|
-
onClick: leftButtonOnClick,
|
|
54
|
-
tabIndex: -1,
|
|
55
|
-
"data-testid": import_DSTabsDatatestid.DSTabsDatatestid.CAROUSEL.BUTTON_LEFT,
|
|
56
|
-
buttonType: import_ds_button.BUTTON_TYPES.ICON
|
|
57
|
-
}, /* @__PURE__ */ React.createElement(import_ds_icons.ChevronLeft, {
|
|
58
|
-
size: import_ds_icon.DSIconSizes.S
|
|
59
|
-
}))), showChevrons.right && /* @__PURE__ */ React.createElement(import_styles.StyledCarouselButtonWrapper, {
|
|
60
|
-
tabType: type,
|
|
61
|
-
right: showChevrons.right
|
|
62
|
-
}, /* @__PURE__ */ React.createElement(import_styles.StyledCarouselBtn, {
|
|
63
|
-
size: "s",
|
|
64
|
-
onClick: rightButtonOnClick,
|
|
65
|
-
tabIndex: -1,
|
|
66
|
-
"data-testid": import_DSTabsDatatestid.DSTabsDatatestid.CAROUSEL.BUTTON_RIGHT,
|
|
67
|
-
buttonType: import_ds_button.BUTTON_TYPES.ICON
|
|
68
|
-
}, /* @__PURE__ */ React.createElement(import_ds_icons.ChevronRight, {
|
|
69
|
-
size: import_ds_icon.DSIconSizes.S
|
|
70
|
-
}))), /* @__PURE__ */ React.createElement(import_styles.StyledChildrenWrap, {
|
|
71
|
-
ref: carouselOnlyListRef,
|
|
72
|
-
onClick: handleOnClick,
|
|
73
|
-
onScroll: handleOnScroll
|
|
74
|
-
}, children));
|
|
75
|
-
};
|
|
76
|
-
module.exports = __toCommonJS(Carousel_exports);
|
|
77
|
-
//# sourceMappingURL=Carousel.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/parts/carousel/Carousel.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useContext } from 'react';\nimport { DSIconSizes } from '@elliemae/ds-icon';\nimport { BUTTON_TYPES } from '@elliemae/ds-button';\nimport { ChevronRight, ChevronLeft } from '@elliemae/ds-icons';\nimport { StyledCarouselBtn, StyledCarouselButtonWrapper, StyledCarouselWrapper, StyledChildrenWrap } from './styles';\nimport { useCarousel } from './useCarousel';\nimport { DSTabsContext } from '../../DSTabsCTX';\nimport { DSTabsDatatestid } from '../../DSTabsDatatestid';\nimport type { CarouselPropsT } from '../../DSTabsTypes';\n\nexport const Carousel = ({ children, updateIndicatorStyle }: CarouselPropsT): JSX.Element => {\n const { showChevrons, leftButtonOnClick, rightButtonOnClick, handleOnClick, handleOnScroll } = useCarousel({\n updateIndicatorStyle,\n });\n\n const {\n carouselOnlyListRef,\n props: { type },\n } = useContext(DSTabsContext);\n\n return (\n <StyledCarouselWrapper>\n {showChevrons.left && (\n <StyledCarouselButtonWrapper tabType={type}>\n <StyledCarouselBtn\n size=\"s\"\n onClick={leftButtonOnClick}\n tabIndex={-1}\n data-testid={DSTabsDatatestid.CAROUSEL.BUTTON_LEFT}\n buttonType={BUTTON_TYPES.ICON}\n >\n <ChevronLeft size={DSIconSizes.S} />\n </StyledCarouselBtn>\n </StyledCarouselButtonWrapper>\n )}\n {showChevrons.right && (\n <StyledCarouselButtonWrapper tabType={type} right={showChevrons.right}>\n <StyledCarouselBtn\n size=\"s\"\n onClick={rightButtonOnClick}\n tabIndex={-1}\n data-testid={DSTabsDatatestid.CAROUSEL.BUTTON_RIGHT}\n buttonType={BUTTON_TYPES.ICON}\n >\n <ChevronRight size={DSIconSizes.S} />\n </StyledCarouselBtn>\n </StyledCarouselButtonWrapper>\n )}\n <StyledChildrenWrap ref={carouselOnlyListRef} onClick={handleOnClick} onScroll={handleOnScroll}>\n {children}\n </StyledChildrenWrap>\n </StyledCarouselWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA2B;AAC3B,qBAA4B;AAC5B,uBAA6B;AAC7B,sBAA0C;AAC1C,oBAA0G;AAC1G,yBAA4B;AAC5B,uBAA8B;AAC9B,8BAAiC;AAG1B,MAAM,WAAW,CAAC,EAAE,UAAU,2BAAwD;AAC3F,QAAM,EAAE,cAAc,mBAAmB,oBAAoB,eAAe,mBAAmB,oCAAY;AAAA,IACzG;AAAA;AAGF,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE;AAAA,MACP,6BAAW;AAEf,SACE,oCAAC,qCAAD,MACG,aAAa,QACZ,oCAAC,2CAAD;AAAA,IAA6B,SAAS;AAAA,KACpC,oCAAC,iCAAD;AAAA,IACE,MAAK;AAAA,IACL,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAa,yCAAiB,SAAS;AAAA,IACvC,YAAY,8BAAa;AAAA,KAEzB,oCAAC,6BAAD;AAAA,IAAa,MAAM,2BAAY;AAAA,QAIpC,aAAa,SACZ,oCAAC,2CAAD;AAAA,IAA6B,SAAS;AAAA,IAAM,OAAO,aAAa;AAAA,KAC9D,oCAAC,iCAAD;AAAA,IACE,MAAK;AAAA,IACL,SAAS;AAAA,IACT,UAAU;AAAA,IACV,eAAa,yCAAiB,SAAS;AAAA,IACvC,YAAY,8BAAa;AAAA,KAEzB,oCAAC,8BAAD;AAAA,IAAc,MAAM,2BAAY;AAAA,QAItC,oCAAC,kCAAD;AAAA,IAAoB,KAAK;AAAA,IAAqB,SAAS;AAAA,IAAe,UAAU;AAAA,KAC7E;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
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
|
-
StyledCarouselBtn: () => StyledCarouselBtn,
|
|
31
|
-
StyledCarouselButtonWrapper: () => StyledCarouselButtonWrapper,
|
|
32
|
-
StyledCarouselWrapper: () => StyledCarouselWrapper,
|
|
33
|
-
StyledChildrenWrap: () => StyledChildrenWrap
|
|
34
|
-
});
|
|
35
|
-
var React = __toESM(require("react"));
|
|
36
|
-
var import_styled_components = __toESM(require("styled-components"));
|
|
37
|
-
var import_ds_button = require("@elliemae/ds-button");
|
|
38
|
-
var import_constants = require("../../utils/constants");
|
|
39
|
-
const StyledCarouselBtn = (0, import_styled_components.default)(import_ds_button.DSButtonV2)`
|
|
40
|
-
margin: 0;
|
|
41
|
-
min-width: ${({ theme }) => theme.space.xs};
|
|
42
|
-
width: ${({ theme }) => theme.space.xs};
|
|
43
|
-
|
|
44
|
-
&:hover:not(:disabled) {
|
|
45
|
-
background-color: transparent;
|
|
46
|
-
}
|
|
47
|
-
background-color: transparent;
|
|
48
|
-
border-radius: 0px;
|
|
49
|
-
|
|
50
|
-
& .em-ds-icon svg {
|
|
51
|
-
fill: ${({ theme }) => theme.colors.brand[600]};
|
|
52
|
-
}
|
|
53
|
-
`;
|
|
54
|
-
const StyledCarouselWrapper = import_styled_components.default.span`
|
|
55
|
-
position: relative;
|
|
56
|
-
width: 100%;
|
|
57
|
-
display: flex;
|
|
58
|
-
`;
|
|
59
|
-
const StyledChildrenWrap = import_styled_components.default.div`
|
|
60
|
-
display: flex;
|
|
61
|
-
flex-wrap: nowrap;
|
|
62
|
-
flex: 1;
|
|
63
|
-
overflow-x: hidden;
|
|
64
|
-
`;
|
|
65
|
-
const StyledCarouselButtonWrapper = import_styled_components.default.div`
|
|
66
|
-
max-width: 16px;
|
|
67
|
-
position: absolute;
|
|
68
|
-
z-index: 200;
|
|
69
|
-
${({ right }) => right ? "right: 0;" : `left: 0;`}
|
|
70
|
-
width: 16px;
|
|
71
|
-
height: ${({ tabType }) => tabType === import_constants.TabTypes.NORMAL ? "32px" : "22px"};
|
|
72
|
-
padding-top: ${({ tabType }) => tabType === import_constants.TabTypes.NORMAL ? "5px" : "0px"};
|
|
73
|
-
background: white;
|
|
74
|
-
${({ theme, tabType }) => tabType === import_constants.TabTypes.NORMAL ? `
|
|
75
|
-
background: linear-gradient(to bottom, white 0px, white 30px, ${theme.colors.neutral[400]} 30px, ${theme.colors.neutral[400]} 31px, white 31px , white 32px );
|
|
76
|
-
` : ``};
|
|
77
|
-
`;
|
|
78
|
-
module.exports = __toCommonJS(styles_exports);
|
|
79
|
-
//# sourceMappingURL=styles.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/parts/carousel/styles.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import styled from 'styled-components';\nimport { DSButtonV2 } from '@elliemae/ds-button';\nimport { TabTypes } from '../../utils/constants';\nimport type { StyledCarouselButtonWrapperPropsT } from '../../DSTabsTypes';\n\nexport const StyledCarouselBtn = styled(DSButtonV2)`\n margin: 0;\n min-width: ${({ theme }) => theme.space.xs};\n width: ${({ theme }) => theme.space.xs};\n\n &:hover:not(:disabled) {\n background-color: transparent;\n }\n background-color: transparent;\n border-radius: 0px;\n\n & .em-ds-icon svg {\n fill: ${({ theme }) => theme.colors.brand[600]};\n }\n`;\n\nexport const StyledCarouselWrapper = styled.span`\n position: relative;\n width: 100%;\n display: flex;\n`;\n\nexport const StyledChildrenWrap = styled.div`\n display: flex;\n flex-wrap: nowrap;\n flex: 1;\n overflow-x: hidden;\n`;\n\nexport const StyledCarouselButtonWrapper = styled.div<StyledCarouselButtonWrapperPropsT>`\n max-width: 16px;\n position: absolute;\n z-index: 200;\n ${({ right }) => (right ? 'right: 0;' : `left: 0;`)}\n width: 16px;\n height: ${({ tabType }) => (tabType === TabTypes.NORMAL ? '32px' : '22px')};\n padding-top: ${({ tabType }) => (tabType === TabTypes.NORMAL ? '5px' : '0px')};\n background: white;\n ${({ theme, tabType }) =>\n tabType === TabTypes.NORMAL\n ? `\n background: linear-gradient(to bottom, white 0px, white 30px, ${theme.colors.neutral[400]} 30px, ${theme.colors.neutral[400]} 31px, white 31px , white 32px );\n `\n : ``};\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,+BAAmB;AACnB,uBAA2B;AAC3B,uBAAyB;AAGlB,MAAM,oBAAoB,sCAAO;AAAA;AAAA,eAEzB,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA,WAC/B,CAAC,EAAE,YAAY,MAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAS1B,CAAC,EAAE,YAAY,MAAM,OAAO,MAAM;AAAA;AAAA;AAIvC,MAAM,wBAAwB,iCAAO;AAAA;AAAA;AAAA;AAAA;AAMrC,MAAM,qBAAqB,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAOlC,MAAM,8BAA8B,iCAAO;AAAA;AAAA;AAAA;AAAA,IAI9C,CAAC,EAAE,YAAa,QAAQ,cAAc;AAAA;AAAA,YAE9B,CAAC,EAAE,cAAe,YAAY,0BAAS,SAAS,SAAS;AAAA,iBACpD,CAAC,EAAE,cAAe,YAAY,0BAAS,SAAS,QAAQ;AAAA;AAAA,IAErE,CAAC,EAAE,OAAO,cACV,YAAY,0BAAS,SACjB;AAAA,sEAC8D,MAAM,OAAO,QAAQ,cAAc,MAAM,OAAO,QAAQ;AAAA,KAEtH;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
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 useCarousel_exports = {};
|
|
29
|
-
__export(useCarousel_exports, {
|
|
30
|
-
useCarousel: () => useCarousel
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_react = require("react");
|
|
34
|
-
var import_resize_observer = __toESM(require("@react-hook/resize-observer"));
|
|
35
|
-
var import_DSTabsCTX = require("../../DSTabsCTX");
|
|
36
|
-
var import_helpers = require("../../utils/helpers");
|
|
37
|
-
var import_useCarouselCallbacks = require("./useCarouselCallbacks");
|
|
38
|
-
const useCarousel = ({ updateIndicatorStyle }) => {
|
|
39
|
-
const { carouselOnlyListRef } = (0, import_react.useContext)(import_DSTabsCTX.DSTabsContext);
|
|
40
|
-
const [showChevrons, setShowChevrons] = (0, import_react.useState)({
|
|
41
|
-
right: false,
|
|
42
|
-
left: false
|
|
43
|
-
});
|
|
44
|
-
const { tabsRefAsArray } = (0, import_react.useContext)(import_DSTabsCTX.DSTabsContext);
|
|
45
|
-
const shouldShowLeft = (0, import_react.useCallback)(() => carouselOnlyListRef.current ? carouselOnlyListRef.current.scrollLeft > 0 : false, [carouselOnlyListRef]);
|
|
46
|
-
const shouldShowRight = (0, import_react.useCallback)(() => carouselOnlyListRef.current ? carouselOnlyListRef.current.scrollLeft < carouselOnlyListRef.current.scrollWidth - carouselOnlyListRef.current.clientWidth : false, [carouselOnlyListRef]);
|
|
47
|
-
const recalcChevrons = (0, import_react.useCallback)(() => {
|
|
48
|
-
setShowChevrons({ right: shouldShowRight(), left: shouldShowLeft() });
|
|
49
|
-
}, [shouldShowLeft, shouldShowRight]);
|
|
50
|
-
const getVisibleItemsOffset = (0, import_react.useCallback)(() => {
|
|
51
|
-
if (tabsRefAsArray.current) {
|
|
52
|
-
const scroll = tabsRefAsArray.current.reduce((acc, c) => {
|
|
53
|
-
if ((0, import_helpers.isElementVisibleCarousel)(c, carouselOnlyListRef.current)) {
|
|
54
|
-
const styles = window.getComputedStyle(c);
|
|
55
|
-
const width = c.clientWidth;
|
|
56
|
-
const margin = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
|
|
57
|
-
return acc + (width + margin);
|
|
58
|
-
}
|
|
59
|
-
return acc;
|
|
60
|
-
}, 0);
|
|
61
|
-
return scroll - 16;
|
|
62
|
-
}
|
|
63
|
-
return 0;
|
|
64
|
-
}, [tabsRefAsArray, carouselOnlyListRef]);
|
|
65
|
-
(0, import_resize_observer.default)(carouselOnlyListRef, recalcChevrons);
|
|
66
|
-
const { leftButtonOnClick, rightButtonOnClick, handleOnClick, handleOnScroll } = (0, import_useCarouselCallbacks.useCarouselCallbacks)({
|
|
67
|
-
getVisibleItemsOffset,
|
|
68
|
-
recalcChevrons,
|
|
69
|
-
updateIndicatorStyle
|
|
70
|
-
});
|
|
71
|
-
return {
|
|
72
|
-
showChevrons,
|
|
73
|
-
leftButtonOnClick,
|
|
74
|
-
rightButtonOnClick,
|
|
75
|
-
handleOnClick,
|
|
76
|
-
handleOnScroll
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
module.exports = __toCommonJS(useCarousel_exports);
|
|
80
|
-
//# sourceMappingURL=useCarousel.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/parts/carousel/useCarousel.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useCallback, useState, useContext } from 'react';\nimport useResizeObserver from '@react-hook/resize-observer';\nimport { DSTabsContext } from '../../DSTabsCTX';\nimport { isElementVisibleCarousel } from '../../utils/helpers';\nimport { useCarouselCallbacks } from './useCarouselCallbacks';\nimport type { UseCarouselPropsT, UseCarouselReturnTypeT, ShowChevronsT } from '../../DSTabsTypes';\n\nexport const useCarousel = ({ updateIndicatorStyle }: UseCarouselPropsT): UseCarouselReturnTypeT => {\n const { carouselOnlyListRef } = useContext(DSTabsContext);\n\n const [showChevrons, setShowChevrons] = useState<ShowChevronsT>({\n right: false,\n left: false,\n });\n\n const { tabsRefAsArray } = useContext(DSTabsContext);\n\n const shouldShowLeft = useCallback(\n () => (carouselOnlyListRef.current ? carouselOnlyListRef.current.scrollLeft > 0 : false),\n\n [carouselOnlyListRef],\n );\n\n const shouldShowRight = useCallback(\n () =>\n carouselOnlyListRef.current\n ? carouselOnlyListRef.current.scrollLeft <\n carouselOnlyListRef.current.scrollWidth - carouselOnlyListRef.current.clientWidth\n : false,\n [carouselOnlyListRef],\n );\n\n const recalcChevrons = useCallback(() => {\n setShowChevrons({ right: shouldShowRight(), left: shouldShowLeft() });\n }, [shouldShowLeft, shouldShowRight]);\n\n const getVisibleItemsOffset = useCallback(() => {\n if (tabsRefAsArray.current) {\n const scroll = tabsRefAsArray.current.reduce((acc, c) => {\n if (isElementVisibleCarousel(c, carouselOnlyListRef.current)) {\n const styles = window.getComputedStyle(c);\n const width = c.clientWidth;\n const margin = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);\n\n return acc + (width + margin);\n }\n return acc;\n }, 0);\n\n return scroll - 16;\n }\n return 0;\n }, [tabsRefAsArray, carouselOnlyListRef]);\n\n useResizeObserver(carouselOnlyListRef, recalcChevrons);\n\n const { leftButtonOnClick, rightButtonOnClick, handleOnClick, handleOnScroll } = useCarouselCallbacks({\n getVisibleItemsOffset,\n recalcChevrons,\n updateIndicatorStyle,\n });\n\n return {\n showChevrons,\n leftButtonOnClick,\n rightButtonOnClick,\n handleOnClick,\n handleOnScroll,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkD;AAClD,6BAA8B;AAC9B,uBAA8B;AAC9B,qBAAyC;AACzC,kCAAqC;AAG9B,MAAM,cAAc,CAAC,EAAE,2BAAsE;AAClG,QAAM,EAAE,wBAAwB,6BAAW;AAE3C,QAAM,CAAC,cAAc,mBAAmB,2BAAwB;AAAA,IAC9D,OAAO;AAAA,IACP,MAAM;AAAA;AAGR,QAAM,EAAE,mBAAmB,6BAAW;AAEtC,QAAM,iBAAiB,8BACrB,MAAO,oBAAoB,UAAU,oBAAoB,QAAQ,aAAa,IAAI,OAElF,CAAC;AAGH,QAAM,kBAAkB,8BACtB,MACE,oBAAoB,UAChB,oBAAoB,QAAQ,aAC5B,oBAAoB,QAAQ,cAAc,oBAAoB,QAAQ,cACtE,OACN,CAAC;AAGH,QAAM,iBAAiB,8BAAY,MAAM;AACvC,oBAAgB,EAAE,OAAO,mBAAmB,MAAM;AAAA,KACjD,CAAC,gBAAgB;AAEpB,QAAM,wBAAwB,8BAAY,MAAM;AAC9C,QAAI,eAAe,SAAS;AAC1B,YAAM,SAAS,eAAe,QAAQ,OAAO,CAAC,KAAK,MAAM;AACvD,YAAI,6CAAyB,GAAG,oBAAoB,UAAU;AAC5D,gBAAM,SAAS,OAAO,iBAAiB;AACvC,gBAAM,QAAQ,EAAE;AAChB,gBAAM,SAAS,WAAW,OAAO,cAAc,WAAW,OAAO;AAEjE,iBAAO,MAAO,SAAQ;AAAA;AAExB,eAAO;AAAA,SACN;AAEH,aAAO,SAAS;AAAA;AAElB,WAAO;AAAA,KACN,CAAC,gBAAgB;AAEpB,sCAAkB,qBAAqB;AAEvC,QAAM,EAAE,mBAAmB,oBAAoB,eAAe,mBAAmB,sDAAqB;AAAA,IACpG;AAAA,IACA;AAAA,IACA;AAAA;AAGF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|