@elliemae/ds-tabs 3.60.0-next.1 → 3.60.0-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/parts/carousel/Carousel.js +14 -49
- package/dist/cjs/parts/carousel/Carousel.js.map +2 -2
- package/dist/cjs/parts/carousel/styles.js +1 -1
- package/dist/cjs/parts/carousel/styles.js.map +1 -1
- package/dist/cjs/parts/carousel/useCarousel.js +28 -43
- package/dist/cjs/parts/carousel/useCarousel.js.map +3 -3
- package/dist/cjs/parts/tabBar/TabBar.js +3 -1
- package/dist/cjs/parts/tabBar/TabBar.js.map +2 -2
- package/dist/cjs/parts/tabBar/TabBarItemRenderer.js +20 -3
- package/dist/cjs/parts/tabBar/TabBarItemRenderer.js.map +2 -2
- package/dist/cjs/parts/tabsContent/TabsContent.js +13 -5
- package/dist/cjs/parts/tabsContent/TabsContent.js.map +2 -2
- package/dist/cjs/parts/tabsPanel/TabsPanels.js +15 -1
- package/dist/cjs/parts/tabsPanel/TabsPanels.js.map +2 -2
- package/dist/cjs/parts/tabsPanel/styles.js.map +2 -2
- package/dist/esm/parts/carousel/Carousel.js +16 -57
- package/dist/esm/parts/carousel/Carousel.js.map +2 -2
- package/dist/esm/parts/carousel/styles.js +1 -1
- package/dist/esm/parts/carousel/styles.js.map +1 -1
- package/dist/esm/parts/carousel/useCarousel.js +29 -44
- package/dist/esm/parts/carousel/useCarousel.js.map +2 -2
- package/dist/esm/parts/tabBar/TabBar.js +3 -1
- package/dist/esm/parts/tabBar/TabBar.js.map +2 -2
- package/dist/esm/parts/tabBar/TabBarItemRenderer.js +20 -3
- package/dist/esm/parts/tabBar/TabBarItemRenderer.js.map +2 -2
- package/dist/esm/parts/tabsContent/TabsContent.js +13 -5
- package/dist/esm/parts/tabsContent/TabsContent.js.map +2 -2
- package/dist/esm/parts/tabsPanel/TabsPanels.js +15 -1
- package/dist/esm/parts/tabsPanel/TabsPanels.js.map +2 -2
- package/dist/esm/parts/tabsPanel/styles.js.map +2 -2
- package/dist/types/parts/carousel/useCarousel.d.ts +0 -5
- package/dist/types/parts/tabsPanel/styles.d.ts +3 -2
- package/package.json +11 -11
- package/dist/cjs/parts/carousel/useCarouselCallbacks.js +0 -89
- package/dist/cjs/parts/carousel/useCarouselCallbacks.js.map +0 -7
- package/dist/esm/parts/carousel/useCarouselCallbacks.js +0 -59
- package/dist/esm/parts/carousel/useCarouselCallbacks.js.map +0 -7
- package/dist/types/parts/carousel/useCarouselCallbacks.d.ts +0 -12
|
@@ -34,59 +34,24 @@ module.exports = __toCommonJS(Carousel_exports);
|
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_react = require("react");
|
|
37
|
-
var import_ds_icon = require("@elliemae/ds-icon");
|
|
38
|
-
var import_ds_button_v2 = require("@elliemae/ds-button-v2");
|
|
39
|
-
var import_ds_icons = require("@elliemae/ds-icons");
|
|
40
37
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
41
38
|
var import_styles = require("./styles.js");
|
|
42
39
|
var import_useCarousel = require("./useCarousel.js");
|
|
43
40
|
var import_DSTabsCTX = require("../../DSTabsCTX.js");
|
|
44
|
-
var import_constants = require("../../constants/index.js");
|
|
45
41
|
const Carousel = ({ children }) => {
|
|
46
|
-
const {
|
|
47
|
-
const {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"data-testid": import_constants.TABS_DATA_TESTID.CAROUSEL_BUTTON_LEFT,
|
|
61
|
-
buttonType: import_ds_button_v2.BUTTON_TYPES.ICON,
|
|
62
|
-
"aria-label": "Scroll Left",
|
|
63
|
-
getOwnerProps,
|
|
64
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ChevronLeft, { size: import_ds_icon.DSIconSizes.S })
|
|
65
|
-
}
|
|
66
|
-
) }),
|
|
67
|
-
showChevrons.right && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledCarouselButtonWrapper, { tabType: type, right: showChevrons.right, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
68
|
-
import_styles.StyledCarouselBtnRight,
|
|
69
|
-
{
|
|
70
|
-
size: "s",
|
|
71
|
-
onClick: rightButtonOnClick,
|
|
72
|
-
tabIndex: -1,
|
|
73
|
-
"data-testid": import_constants.TABS_DATA_TESTID.CAROUSEL_BUTTON_RIGHT,
|
|
74
|
-
buttonType: import_ds_button_v2.BUTTON_TYPES.ICON,
|
|
75
|
-
"aria-label": "Scroll Right",
|
|
76
|
-
getOwnerProps,
|
|
77
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ChevronRight, { size: import_ds_icon.DSIconSizes.S })
|
|
78
|
-
}
|
|
79
|
-
) }),
|
|
80
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
81
|
-
import_styles.StyledChildrenWrap,
|
|
82
|
-
{
|
|
83
|
-
role: "tablist",
|
|
84
|
-
innerRef: carouselOnlyListRef,
|
|
85
|
-
onClick: handleOnClick,
|
|
86
|
-
onScroll: handleOnScroll,
|
|
87
|
-
children
|
|
88
|
-
}
|
|
89
|
-
)
|
|
90
|
-
] });
|
|
42
|
+
const { handleOnClick } = (0, import_useCarousel.useCarousel)();
|
|
43
|
+
const { carouselOnlyListRef, props } = (0, import_react.useContext)(import_DSTabsCTX.DSTabsContext);
|
|
44
|
+
const { getOwnerProps, getOwnerPropsArguments } = (0, import_ds_props_helpers.useOwnerProps)(props);
|
|
45
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledCarouselWrapper, { getOwnerProps, getOwnerPropsArguments, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
46
|
+
import_styles.StyledChildrenWrap,
|
|
47
|
+
{
|
|
48
|
+
role: "tablist",
|
|
49
|
+
innerRef: carouselOnlyListRef,
|
|
50
|
+
onClick: handleOnClick,
|
|
51
|
+
getOwnerProps,
|
|
52
|
+
getOwnerPropsArguments,
|
|
53
|
+
children
|
|
54
|
+
}
|
|
55
|
+
) });
|
|
91
56
|
};
|
|
92
57
|
//# sourceMappingURL=Carousel.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/carousel/Carousel.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useContext } from 'react';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import { useContext } from 'react';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { StyledCarouselWrapper, StyledChildrenWrap } from './styles.js';\nimport { useCarousel } from './useCarousel.js';\nimport { DSTabsContext } from '../../DSTabsCTX.js';\n\ninterface CarouselPropsT {\n children: React.ReactNode;\n}\n\nexport const Carousel = ({ children }: CarouselPropsT): JSX.Element => {\n const { handleOnClick } = useCarousel();\n\n const { carouselOnlyListRef, props } = useContext(DSTabsContext);\n\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);\n\n return (\n <StyledCarouselWrapper getOwnerProps={getOwnerProps} getOwnerPropsArguments={getOwnerPropsArguments}>\n <StyledChildrenWrap\n role=\"tablist\"\n innerRef={carouselOnlyListRef}\n onClick={handleOnClick}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {children}\n </StyledChildrenWrap>\n </StyledCarouselWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmBjB;AAnBN,mBAA2B;AAC3B,8BAA8B;AAC9B,oBAA0D;AAC1D,yBAA4B;AAC5B,uBAA8B;AAMvB,MAAM,WAAW,CAAC,EAAE,SAAS,MAAmC;AACrE,QAAM,EAAE,cAAc,QAAI,gCAAY;AAEtC,QAAM,EAAE,qBAAqB,MAAM,QAAI,yBAAW,8BAAa;AAE/D,QAAM,EAAE,eAAe,uBAAuB,QAAI,uCAAc,KAAK;AAErE,SACE,4CAAC,uCAAsB,eAA8B,wBACnD;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,UAAU;AAAA,MACV,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MAEC;AAAA;AAAA,EACH,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/carousel/styles.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { css, styled } from '@elliemae/ds-system';\nimport { DSButtonV2 } from '@elliemae/ds-button-v2';\n\nimport type { DSTabsInternalsT } from '../../sharedTypes.js';\nimport { DSTabsName, TABS_SLOTS, TAB_TYPES } from '../../constants/index.js';\n\ninterface StyledCarouselButtonWrapperPropsT {\n right?: boolean;\n tabType: DSTabsInternalsT.TabTypesT;\n}\n\nconst baseCarouselButtonStyles = css`\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 StyledCarouselBtnLeft = styled(DSButtonV2, {\n name: DSTabsName,\n slot: TABS_SLOTS.CAROUSEL_BUTTON_LEFT,\n})`\n ${baseCarouselButtonStyles}\n`;\n\nexport const StyledCarouselBtnRight = styled(DSButtonV2, {\n name: DSTabsName,\n slot: TABS_SLOTS.CAROUSEL_BUTTON_RIGHT,\n})`\n ${baseCarouselButtonStyles}\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:
|
|
4
|
+
"sourcesContent": ["import { css, styled } from '@elliemae/ds-system';\nimport { DSButtonV2 } from '@elliemae/ds-button-v2';\n\nimport type { DSTabsInternalsT } from '../../sharedTypes.js';\nimport { DSTabsName, TABS_SLOTS, TAB_TYPES } from '../../constants/index.js';\n\ninterface StyledCarouselButtonWrapperPropsT {\n right?: boolean;\n tabType: DSTabsInternalsT.TabTypesT;\n}\n\nconst baseCarouselButtonStyles = css`\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 StyledCarouselBtnLeft = styled(DSButtonV2, {\n name: DSTabsName,\n slot: TABS_SLOTS.CAROUSEL_BUTTON_LEFT,\n})`\n ${baseCarouselButtonStyles}\n`;\n\nexport const StyledCarouselBtnRight = styled(DSButtonV2, {\n name: DSTabsName,\n slot: TABS_SLOTS.CAROUSEL_BUTTON_RIGHT,\n})`\n ${baseCarouselButtonStyles}\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: auto;\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 === TAB_TYPES.NORMAL ? '32px' : '22px')};\n padding-top: ${({ tabType }) => (tabType === TAB_TYPES.NORMAL ? '5px' : '0px')};\n background: white;\n ${({ theme, tabType }) =>\n tabType === TAB_TYPES.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
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA4B;AAC5B,0BAA2B;AAG3B,uBAAkD;AAOlD,MAAM,2BAA2B;AAAA;AAAA,eAElB,CAAC,EAAE,MAAM,MAAM,MAAM,MAAM,EAAE;AAAA,WACjC,CAAC,EAAE,MAAM,MAAM,MAAM,MAAM,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAS5B,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA;AAI3C,MAAM,4BAAwB,yBAAO,gCAAY;AAAA,EACtD,MAAM;AAAA,EACN,MAAM,4BAAW;AACnB,CAAC;AAAA,IACG,wBAAwB;AAAA;AAGrB,MAAM,6BAAyB,yBAAO,gCAAY;AAAA,EACvD,MAAM;AAAA,EACN,MAAM,4BAAW;AACnB,CAAC;AAAA,IACG,wBAAwB;AAAA;AAGrB,MAAM,wBAAwB,wBAAO;AAAA;AAAA;AAAA;AAAA;AAMrC,MAAM,qBAAqB,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAOlC,MAAM,8BAA8B,wBAAO;AAAA;AAAA;AAAA;AAAA,IAI9C,CAAC,EAAE,MAAM,MAAO,QAAQ,cAAc,UAAW;AAAA;AAAA,YAEzC,CAAC,EAAE,QAAQ,MAAO,YAAY,2BAAU,SAAS,SAAS,MAAO;AAAA,iBAC5D,CAAC,EAAE,QAAQ,MAAO,YAAY,2BAAU,SAAS,QAAQ,KAAM;AAAA;AAAA,IAE5E,CAAC,EAAE,OAAO,QAAQ,MAClB,YAAY,2BAAU,SAClB;AAAA,sEAC8D,MAAM,OAAO,QAAQ,GAAG,CAAC,UAAU,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA,KAE1H,EAAE;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -33,54 +33,39 @@ __export(useCarousel_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(useCarousel_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_react = require("react");
|
|
36
|
-
var import_resize_observer = __toESM(require("@react-hook/resize-observer"));
|
|
37
36
|
var import_DSTabsCTX = require("../../DSTabsCTX.js");
|
|
38
37
|
var import_helpers = require("../../utils/helpers.js");
|
|
39
|
-
var import_useCarouselCallbacks = require("./useCarouselCallbacks.js");
|
|
40
38
|
const useCarousel = () => {
|
|
41
|
-
const { carouselOnlyListRef } = (0, import_react.useContext)(import_DSTabsCTX.DSTabsContext);
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const margin = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
|
|
65
|
-
return acc + (width + margin);
|
|
39
|
+
const { carouselOnlyListRef, focusableTabsRef } = (0, import_react.useContext)(import_DSTabsCTX.DSTabsContext);
|
|
40
|
+
const handleOnClick = (0, import_react.useCallback)(
|
|
41
|
+
({ target }) => {
|
|
42
|
+
if (focusableTabsRef.current && target.getAttribute("role") === "tab") {
|
|
43
|
+
const tabList = carouselOnlyListRef.current;
|
|
44
|
+
const tabButton = target;
|
|
45
|
+
const tabButtonDimensions = tabButton.getBoundingClientRect();
|
|
46
|
+
const tabListDimensions = tabList?.getBoundingClientRect();
|
|
47
|
+
const tabButtonIndex = tabButton.dataset.index;
|
|
48
|
+
const lastItemIndex = focusableTabsRef.current.length.toString();
|
|
49
|
+
const magicNumber = 34;
|
|
50
|
+
const firstOrLastItem = tabButtonIndex === "0" || tabButtonIndex === lastItemIndex;
|
|
51
|
+
if (!(0, import_helpers.isElementVisibleCarousel)(tabButton, tabList, firstOrLastItem) && tabListDimensions && carouselOnlyListRef.current) {
|
|
52
|
+
const containerWidth = tabListDimensions.width;
|
|
53
|
+
const halfContainer = containerWidth / 2;
|
|
54
|
+
const elementScrollPosition = tabButtonDimensions.left - tabListDimensions.left;
|
|
55
|
+
const positionInContainer = elementScrollPosition % containerWidth;
|
|
56
|
+
const width = tabButton.offsetWidth + magicNumber;
|
|
57
|
+
if (positionInContainer > halfContainer) {
|
|
58
|
+
carouselOnlyListRef.current.scrollLeft += width + positionInContainer - containerWidth;
|
|
59
|
+
} else {
|
|
60
|
+
carouselOnlyListRef.current.scrollLeft += positionInContainer - magicNumber;
|
|
61
|
+
}
|
|
66
62
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return 0;
|
|
72
|
-
}, [tabsRefAsArray, carouselOnlyListRef]);
|
|
73
|
-
(0, import_resize_observer.default)(carouselOnlyListRef, recalcChevrons);
|
|
74
|
-
const { leftButtonOnClick, rightButtonOnClick, handleOnClick, handleOnScroll } = (0, import_useCarouselCallbacks.useCarouselCallbacks)({
|
|
75
|
-
getVisibleItemsOffset,
|
|
76
|
-
recalcChevrons
|
|
77
|
-
});
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
[focusableTabsRef, carouselOnlyListRef]
|
|
66
|
+
);
|
|
78
67
|
return {
|
|
79
|
-
|
|
80
|
-
leftButtonOnClick,
|
|
81
|
-
rightButtonOnClick,
|
|
82
|
-
handleOnClick,
|
|
83
|
-
handleOnScroll
|
|
68
|
+
handleOnClick
|
|
84
69
|
};
|
|
85
70
|
};
|
|
86
71
|
//# sourceMappingURL=useCarousel.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/carousel/useCarousel.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useCallback,
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import { useCallback, useContext } from 'react';\nimport { DSTabsContext } from '../../DSTabsCTX.js';\nimport { isElementVisibleCarousel } from '../../utils/helpers.js';\n\ninterface UseCarouselReturnTypeT {\n handleOnClick: (e: React.MouseEvent) => void;\n}\n\nexport const useCarousel = (): UseCarouselReturnTypeT => {\n const { carouselOnlyListRef, focusableTabsRef } = useContext(DSTabsContext);\n\n /** [PUI-15772] - Tabs Pre Refactor\n * Click handler for carousel tabs. It:\n * 1. Checks if clicked element is a tab\n * 2. Calculates scroll position to center the tab\n * 3. Updates scroll position with magic number adjustments\n * 4. May cause rerenders due to scroll position updates\n */\n const handleOnClick = useCallback(\n ({ target }: React.MouseEvent) => {\n if (focusableTabsRef.current && (target as HTMLButtonElement).getAttribute('role') === 'tab') {\n const tabList = carouselOnlyListRef.current;\n const tabButton = target as HTMLButtonElement;\n const tabButtonDimensions = tabButton.getBoundingClientRect();\n const tabListDimensions = tabList?.getBoundingClientRect();\n const tabButtonIndex = tabButton.dataset.index as string;\n const lastItemIndex = focusableTabsRef.current.length.toString();\n const magicNumber = 34;\n\n const firstOrLastItem = tabButtonIndex === '0' || tabButtonIndex === lastItemIndex;\n\n if (\n !isElementVisibleCarousel(tabButton, tabList, firstOrLastItem) &&\n tabListDimensions &&\n carouselOnlyListRef.current\n ) {\n const containerWidth = tabListDimensions.width;\n const halfContainer = containerWidth / 2;\n const elementScrollPosition = tabButtonDimensions.left - tabListDimensions.left;\n const positionInContainer = elementScrollPosition % containerWidth;\n const width = tabButton.offsetWidth + magicNumber;\n\n if (positionInContainer > halfContainer) {\n carouselOnlyListRef.current.scrollLeft += width + positionInContainer - containerWidth;\n } else {\n carouselOnlyListRef.current.scrollLeft += positionInContainer - magicNumber;\n }\n }\n }\n },\n [focusableTabsRef, carouselOnlyListRef],\n );\n\n return {\n handleOnClick,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwC;AACxC,uBAA8B;AAC9B,qBAAyC;AAMlC,MAAM,cAAc,MAA8B;AACvD,QAAM,EAAE,qBAAqB,iBAAiB,QAAI,yBAAW,8BAAa;AAS1E,QAAM,oBAAgB;AAAA,IACpB,CAAC,EAAE,OAAO,MAAwB;AAChC,UAAI,iBAAiB,WAAY,OAA6B,aAAa,MAAM,MAAM,OAAO;AAC5F,cAAM,UAAU,oBAAoB;AACpC,cAAM,YAAY;AAClB,cAAM,sBAAsB,UAAU,sBAAsB;AAC5D,cAAM,oBAAoB,SAAS,sBAAsB;AACzD,cAAM,iBAAiB,UAAU,QAAQ;AACzC,cAAM,gBAAgB,iBAAiB,QAAQ,OAAO,SAAS;AAC/D,cAAM,cAAc;AAEpB,cAAM,kBAAkB,mBAAmB,OAAO,mBAAmB;AAErE,YACE,KAAC,yCAAyB,WAAW,SAAS,eAAe,KAC7D,qBACA,oBAAoB,SACpB;AACA,gBAAM,iBAAiB,kBAAkB;AACzC,gBAAM,gBAAgB,iBAAiB;AACvC,gBAAM,wBAAwB,oBAAoB,OAAO,kBAAkB;AAC3E,gBAAM,sBAAsB,wBAAwB;AACpD,gBAAM,QAAQ,UAAU,cAAc;AAEtC,cAAI,sBAAsB,eAAe;AACvC,gCAAoB,QAAQ,cAAc,QAAQ,sBAAsB;AAAA,UAC1E,OAAO;AACL,gCAAoB,QAAQ,cAAc,sBAAsB;AAAA,UAClE;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB,mBAAmB;AAAA,EACxC;AAEA,SAAO;AAAA,IACL;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/tabBar/TabBar.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\nimport React, { useContext } from 'react';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { Carousel } from '../carousel/Carousel.js';\nimport { StyledMobileGradient, StyledTabList, StyledTabWrapper, StyledSubTabsList } from './styles.js';\nimport { DSTabsContext } from '../../DSTabsCTX.js';\n\nimport { TABS_DATA_TESTID, TAB_TYPES } from '../../constants/index.js';\n\nimport { TabBarItemRenderer } from './TabBarItemRenderer.js';\n\nexport const TabBar = (): JSX.Element => {\n const {\n tabsListRef,\n props,\n props: { type, fixedTabsHeaders, withCarousel, isDSMobile },\n globalClickHandler,\n mobileGradients,\n updateMobileGradients,\n } = useContext(DSTabsContext);\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);\n\n if (type === TAB_TYPES.SUBTABS && !isDSMobile) {\n return (\n <StyledSubTabsList\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n withCarousel={withCarousel}\n data-testid={TABS_DATA_TESTID.SUB_TAB_LIST}\n role={withCarousel ? undefined : 'tablist'}\n innerRef={tabsListRef}\n >\n {withCarousel ? (\n <Carousel>\n <TabBarItemRenderer />\n </Carousel>\n ) : (\n <TabBarItemRenderer />\n )}\n </StyledSubTabsList>\n );\n }\n\n return (\n <StyledTabList\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n withCarousel={withCarousel}\n role={withCarousel ? undefined : 'tablist'}\n innerRef={tabsListRef}\n data-testid={TABS_DATA_TESTID.TAB_LIST}\n isDSMobile={isDSMobile}\n fixedTabsHeaders={fixedTabsHeaders}\n mobileGradients={mobileGradients}\n onScroll={updateMobileGradients}\n tabType={type}\n onClick={(e) => {\n globalClickHandler({ event: e, target: 'tabsList' });\n }}\n >\n <StyledTabWrapper data-testid=\"tab-wrapper\" isDSMobile={isDSMobile} fixedTabsHeaders={fixedTabsHeaders}>\n {!isDSMobile && withCarousel ? (\n <Carousel>\n <TabBarItemRenderer />\n </Carousel>\n ) : (\n <TabBarItemRenderer />\n )}\n </StyledTabWrapper>\n {isDSMobile && !fixedTabsHeaders && (\n <StyledMobileGradient\n mobileGradients={mobileGradients}\n left={tabsListRef.current?.scrollLeft}\n width={tabsListRef.current?.scrollWidth}\n />\n )}\n </StyledTabList>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADkCX;AAjCZ,mBAAkC;AAClC,8BAA8B;AAC9B,sBAAyB;AACzB,oBAAyF;AACzF,uBAA8B;AAE9B,uBAA4C;AAE5C,gCAAmC;AAE5B,MAAM,SAAS,MAAmB;AACvC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,OAAO,EAAE,MAAM,kBAAkB,cAAc,WAAW;AAAA,IAC1D;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,8BAAa;AAC5B,QAAM,EAAE,eAAe,uBAAuB,QAAI,uCAAc,KAAK;AAErE,MAAI,SAAS,2BAAU,WAAW,CAAC,YAAY;AAC7C,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA,eAAa,kCAAiB;AAAA,QAC9B,MAAM,eAAe,SAAY;AAAA,QACjC,UAAU;AAAA,QAET,yBACC,4CAAC,4BACC,sDAAC,gDAAmB,GACtB,IAEA,4CAAC,gDAAmB;AAAA;AAAA,IAExB;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAM,eAAe,SAAY;AAAA,MACjC,UAAU;AAAA,MACV,eAAa,kCAAiB;AAAA,MAC9B;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV,SAAS;AAAA,MACT,SAAS,CAAC,MAAM;AACd,2BAAmB,EAAE,OAAO,GAAG,QAAQ,WAAW,CAAC;AAAA,MACrD;AAAA,MAEA;AAAA,oDAAC,kCAAiB,eAAY,eAAc,YAAwB,kBACjE,WAAC,cAAc,eACd,4CAAC,4BACC,sDAAC,gDAAmB,GACtB,IAEA,4CAAC,gDAAmB,GAExB;AAAA,QACC,cAAc,CAAC,oBACd;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA,MAAM,YAAY,SAAS;AAAA,YAC3B,OAAO,YAAY,SAAS;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\nimport React, { useContext } from 'react';\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { Carousel } from '../carousel/Carousel.js';\nimport { StyledMobileGradient, StyledTabList, StyledTabWrapper, StyledSubTabsList } from './styles.js';\nimport { DSTabsContext } from '../../DSTabsCTX.js';\n\nimport { TABS_DATA_TESTID, TAB_TYPES } from '../../constants/index.js';\n\nimport { TabBarItemRenderer } from './TabBarItemRenderer.js';\n\nexport const TabBar = (): JSX.Element => {\n const {\n tabsListRef,\n props,\n props: { type, fixedTabsHeaders, withCarousel, isDSMobile },\n globalClickHandler,\n mobileGradients,\n updateMobileGradients,\n } = useContext(DSTabsContext);\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);\n\n if (type === TAB_TYPES.SUBTABS && !isDSMobile) {\n return (\n <StyledSubTabsList\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n withCarousel={withCarousel}\n data-testid={TABS_DATA_TESTID.SUB_TAB_LIST}\n role={withCarousel ? undefined : 'tablist'}\n innerRef={tabsListRef}\n >\n {withCarousel ? (\n <Carousel>\n <TabBarItemRenderer />\n </Carousel>\n ) : (\n <TabBarItemRenderer />\n )}\n </StyledSubTabsList>\n );\n }\n\n return (\n <StyledTabList\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n withCarousel={withCarousel}\n role={withCarousel ? undefined : 'tablist'}\n innerRef={tabsListRef}\n data-testid={TABS_DATA_TESTID.TAB_LIST}\n isDSMobile={isDSMobile}\n fixedTabsHeaders={fixedTabsHeaders}\n mobileGradients={mobileGradients}\n onScroll={updateMobileGradients}\n tabType={type}\n onClick={(e) => {\n globalClickHandler({ event: e, target: 'tabsList' });\n }}\n >\n <StyledTabWrapper data-testid=\"tab-wrapper\" isDSMobile={isDSMobile} fixedTabsHeaders={fixedTabsHeaders}>\n {!isDSMobile && withCarousel ? (\n <Carousel>\n <TabBarItemRenderer />\n </Carousel>\n ) : (\n <TabBarItemRenderer />\n )}\n </StyledTabWrapper>\n {isDSMobile && !fixedTabsHeaders && (\n <StyledMobileGradient\n mobileGradients={mobileGradients}\n left={tabsListRef.current?.scrollLeft}\n width={tabsListRef.current?.scrollWidth}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n )}\n </StyledTabList>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADkCX;AAjCZ,mBAAkC;AAClC,8BAA8B;AAC9B,sBAAyB;AACzB,oBAAyF;AACzF,uBAA8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const TabBarItemRenderer = import_react2.default.memo(() => {
|
|
|
129
129
|
},
|
|
130
130
|
title,
|
|
131
131
|
required && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
132
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
133
|
-
|
|
132
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
133
|
+
import_styles.StyledRequiredMark,
|
|
134
|
+
{
|
|
135
|
+
"aria-hidden": "true",
|
|
136
|
+
getOwnerProps,
|
|
137
|
+
getOwnerPropsArguments,
|
|
138
|
+
children: "\u25CF"
|
|
139
|
+
}
|
|
140
|
+
),
|
|
141
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.ScreenReaderOnly, { getOwnerProps, getOwnerPropsArguments, children: "Required" })
|
|
134
142
|
] }),
|
|
135
|
-
isActive && type !== import_constants.TAB_TYPES.SUBTABS ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
143
|
+
isActive && type !== import_constants.TAB_TYPES.SUBTABS ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
144
|
+
import_styles.StyledSelectionIndicator,
|
|
145
|
+
{
|
|
146
|
+
"aria-hidden": "true",
|
|
147
|
+
isDSMobile,
|
|
148
|
+
tabType: type,
|
|
149
|
+
getOwnerProps,
|
|
150
|
+
getOwnerPropsArguments
|
|
151
|
+
}
|
|
152
|
+
) : null
|
|
136
153
|
);
|
|
137
154
|
});
|
|
138
155
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/tabBar/TabBarItemRenderer.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext } from 'react';\nimport {\n StyledTabButton,\n StyledRequiredMark,\n ScreenReaderOnly,\n StyledSubTabButton,\n StyledSelectionIndicator,\n} from './styles.js';\nimport { DSTabsContext, DSTabsCrossRefContext } from '../../DSTabsCTX.js';\nimport { useKeyboardNavigation } from '../../utils/hooks/useKeyboardNavigation.js';\nimport { centerTab } from '../../utils/helpers.js';\nimport type { DSTabT } from '../../react-desc-prop-types.js';\nimport { TABS_DATA_TESTID, TAB_TYPES } from '../../constants/index.js';\n\nexport const TabBarItemRenderer: React.ComponentType<Record<never, never>> = React.memo(() => {\n const {\n tabsRef,\n focusableTabsRef,\n tabsRefAsArray,\n carouselOnlyListRef,\n actualActiveTab,\n props: { type, fixedTabsHeaders, withCarousel, isDSMobile, showSeparator, children: tabs },\n globalClickHandler,\n } = useContext(DSTabsContext);\n\n const { lastTabInternalRef, firstSubtabInternalRef } = useContext(DSTabsCrossRefContext);\n const { handleOnKeyDown } = useKeyboardNavigation();\n\n const availableTabIndexes: number[] = [];\n\n return React.Children.map(tabs, (tab: React.ReactElement<DSTabT.Props>, index) => {\n const {\n tabId = '',\n title = '',\n style,\n required = false,\n disabled = false,\n applyAriaDisabled = false,\n ref,\n onClick,\n onKeyDown,\n ...rest\n } = tab.props;\n const getOwnerProps = () => tab.props;\n const getOwnerPropsArguments = () => ({ tabId });\n\n if (!disabled) availableTabIndexes.push(index);\n const ButtonComponent = type === TAB_TYPES.SUBTABS ? StyledSubTabButton : StyledTabButton;\n\n const isActive = actualActiveTab === tabId;\n\n return (\n <ButtonComponent\n {...rest}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n key={tabId}\n role=\"tab\"\n // eslint-disable-next-line complexity\n innerRef={(tabButtonRef: HTMLButtonElement) => {\n if (tabButtonRef && tabsRefAsArray.current && focusableTabsRef.current && tabsRef.current) {\n tabsRefAsArray.current[index] = tabButtonRef;\n if (!disabled && !focusableTabsRef.current.includes(tabButtonRef))\n focusableTabsRef.current.push(tabButtonRef);\n tabsRef.current[index] = tabButtonRef;\n if (type === TAB_TYPES.SUBTABS && firstSubtabInternalRef && index === availableTabIndexes[0]) {\n firstSubtabInternalRef.current = tabButtonRef;\n }\n if (type !== TAB_TYPES.SUBTABS && index === availableTabIndexes[availableTabIndexes.length - 1]) {\n lastTabInternalRef.current = tabButtonRef;\n }\n if (ref) ref.current = tabButtonRef;\n }\n }}\n type=\"button\"\n aria-controls={tabId}\n aria-selected={actualActiveTab === tabId && !applyAriaDisabled}\n aria-disabled={disabled || applyAriaDisabled}\n isDSMobile={isDSMobile}\n fixedTabsHeaders={fixedTabsHeaders}\n tabType={type}\n data-required={required}\n data-tab-id={tabId}\n data-index={index}\n withCarousel={withCarousel}\n isActive={isActive}\n disabled={disabled}\n showSeparator={showSeparator && type !== TAB_TYPES.NORMAL}\n data-testid={type === TAB_TYPES.NORMAL ? TABS_DATA_TESTID.TAB_BUTTON : TABS_DATA_TESTID.SUBTAB_BUTTON}\n id={`${tabId}-label`}\n onClick={(e) => {\n /** [PUI-15772] - Tabs Pre Refactor\n * Click handler for tab buttons. It:\n * 1. Prevents tab change if aria-disabled is true\n * 2. Updates active tab and indicator style if not disabled\n * 3. Calls the user's onClick callback if provided\n */\n if (applyAriaDisabled) return;\n if (!disabled) {\n globalClickHandler({ event: e, target: 'tabItem', tabId });\n }\n if (onClick && !disabled) onClick(tabId, e);\n }}\n onFocus={(e) => {\n /** [PUI-15772] - Tabs Pre Refactor\n * Focus handler for carousel tabs. It:\n * 1. Centers the focused tab in the carousel viewport\n * 2. Only applies when withCarousel prop is true\n */\n if (withCarousel) centerTab({ e, listRef: carouselOnlyListRef });\n }}\n onKeyDown={(e) => {\n /** [PUI-15772] - Tabs Pre Refactor\n * Keyboard navigation handler. It:\n * 1. Prevents Enter key propagation\n * 2. Handles keyboard navigation if not disabled\n * 3. Calls the user's onKeyDown callback if provided\n */\n if (e.key === 'Enter') e.stopPropagation();\n if (!disabled) handleOnKeyDown(e);\n if (onKeyDown && !disabled) onKeyDown(e);\n }}\n style={style}\n >\n {title}\n {required && (\n <>\n <StyledRequiredMark
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;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
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport {\n StyledTabButton,\n StyledRequiredMark,\n ScreenReaderOnly,\n StyledSubTabButton,\n StyledSelectionIndicator,\n} from './styles.js';\nimport { DSTabsContext, DSTabsCrossRefContext } from '../../DSTabsCTX.js';\nimport { useKeyboardNavigation } from '../../utils/hooks/useKeyboardNavigation.js';\nimport { centerTab } from '../../utils/helpers.js';\nimport type { DSTabT } from '../../react-desc-prop-types.js';\nimport { TABS_DATA_TESTID, TAB_TYPES } from '../../constants/index.js';\n\nexport const TabBarItemRenderer: React.ComponentType<Record<never, never>> = React.memo(() => {\n const {\n tabsRef,\n focusableTabsRef,\n tabsRefAsArray,\n carouselOnlyListRef,\n actualActiveTab,\n props: { type, fixedTabsHeaders, withCarousel, isDSMobile, showSeparator, children: tabs },\n globalClickHandler,\n } = useContext(DSTabsContext);\n\n const { lastTabInternalRef, firstSubtabInternalRef } = useContext(DSTabsCrossRefContext);\n const { handleOnKeyDown } = useKeyboardNavigation();\n\n const availableTabIndexes: number[] = [];\n\n return React.Children.map(tabs, (tab: React.ReactElement<DSTabT.Props>, index) => {\n const {\n tabId = '',\n title = '',\n style,\n required = false,\n disabled = false,\n applyAriaDisabled = false,\n ref,\n onClick,\n onKeyDown,\n ...rest\n } = tab.props;\n const getOwnerProps = () => tab.props;\n const getOwnerPropsArguments = () => ({ tabId });\n\n if (!disabled) availableTabIndexes.push(index);\n const ButtonComponent = type === TAB_TYPES.SUBTABS ? StyledSubTabButton : StyledTabButton;\n\n const isActive = actualActiveTab === tabId;\n\n return (\n <ButtonComponent\n {...rest}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n key={tabId}\n role=\"tab\"\n // eslint-disable-next-line complexity\n innerRef={(tabButtonRef: HTMLButtonElement) => {\n if (tabButtonRef && tabsRefAsArray.current && focusableTabsRef.current && tabsRef.current) {\n tabsRefAsArray.current[index] = tabButtonRef;\n if (!disabled && !focusableTabsRef.current.includes(tabButtonRef))\n focusableTabsRef.current.push(tabButtonRef);\n tabsRef.current[index] = tabButtonRef;\n if (type === TAB_TYPES.SUBTABS && firstSubtabInternalRef && index === availableTabIndexes[0]) {\n firstSubtabInternalRef.current = tabButtonRef;\n }\n if (type !== TAB_TYPES.SUBTABS && index === availableTabIndexes[availableTabIndexes.length - 1]) {\n lastTabInternalRef.current = tabButtonRef;\n }\n if (ref) ref.current = tabButtonRef;\n }\n }}\n type=\"button\"\n aria-controls={tabId}\n aria-selected={actualActiveTab === tabId && !applyAriaDisabled}\n aria-disabled={disabled || applyAriaDisabled}\n isDSMobile={isDSMobile}\n fixedTabsHeaders={fixedTabsHeaders}\n tabType={type}\n data-required={required}\n data-tab-id={tabId}\n data-index={index}\n withCarousel={withCarousel}\n isActive={isActive}\n disabled={disabled}\n showSeparator={showSeparator && type !== TAB_TYPES.NORMAL}\n data-testid={type === TAB_TYPES.NORMAL ? TABS_DATA_TESTID.TAB_BUTTON : TABS_DATA_TESTID.SUBTAB_BUTTON}\n id={`${tabId}-label`}\n onClick={(e) => {\n /** [PUI-15772] - Tabs Pre Refactor\n * Click handler for tab buttons. It:\n * 1. Prevents tab change if aria-disabled is true\n * 2. Updates active tab and indicator style if not disabled\n * 3. Calls the user's onClick callback if provided\n */\n if (applyAriaDisabled) return;\n if (!disabled) {\n globalClickHandler({ event: e, target: 'tabItem', tabId });\n }\n if (onClick && !disabled) onClick(tabId, e);\n }}\n onFocus={(e) => {\n /** [PUI-15772] - Tabs Pre Refactor\n * Focus handler for carousel tabs. It:\n * 1. Centers the focused tab in the carousel viewport\n * 2. Only applies when withCarousel prop is true\n */\n if (withCarousel) centerTab({ e, listRef: carouselOnlyListRef });\n }}\n onKeyDown={(e) => {\n /** [PUI-15772] - Tabs Pre Refactor\n * Keyboard navigation handler. It:\n * 1. Prevents Enter key propagation\n * 2. Handles keyboard navigation if not disabled\n * 3. Calls the user's onKeyDown callback if provided\n */\n if (e.key === 'Enter') e.stopPropagation();\n if (!disabled) handleOnKeyDown(e);\n if (onKeyDown && !disabled) onKeyDown(e);\n }}\n style={style}\n >\n {title}\n {required && (\n <>\n <StyledRequiredMark\n aria-hidden=\"true\"\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n ●\n </StyledRequiredMark>\n <ScreenReaderOnly getOwnerProps={getOwnerProps} getOwnerPropsArguments={getOwnerPropsArguments}>\n Required\n </ScreenReaderOnly>\n </>\n )}\n {isActive && type !== TAB_TYPES.SUBTABS ? (\n <StyledSelectionIndicator\n aria-hidden=\"true\"\n isDSMobile={isDSMobile}\n tabType={type}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n ) : null}\n </ButtonComponent>\n );\n });\n});\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD8Hb;AA1EJ;AApDN,IAAAA,gBAAkC;AAClC,oBAMO;AACP,uBAAqD;AACrD,mCAAsC;AACtC,qBAA0B;AAE1B,uBAA4C;AAErC,MAAM,qBAAgE,cAAAC,QAAM,KAAK,MAAM;AAC5F,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,MAAM,kBAAkB,cAAc,YAAY,eAAe,UAAU,KAAK;AAAA,IACzF;AAAA,EACF,QAAI,0BAAW,8BAAa;AAE5B,QAAM,EAAE,oBAAoB,uBAAuB,QAAI,0BAAW,sCAAqB;AACvF,QAAM,EAAE,gBAAgB,QAAI,oDAAsB;AAElD,QAAM,sBAAgC,CAAC;AAEvC,SAAO,cAAAA,QAAM,SAAS,IAAI,MAAM,CAAC,KAAuC,UAAU;AAChF,UAAM;AAAA,MACJ,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR;AAAA,MACA,WAAW;AAAA,MACX,WAAW;AAAA,MACX,oBAAoB;AAA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AK;AAAA,QACZ,SAAS,CAAC,MAAM;AAOd,cAAI,kBAAmB;AACvB,cAAI,CAAC,UAAU;AACb,+BAAmB,EAAE,OAAO,GAAG,QAAQ,WAAW,MAAM,CAAC;AAAA,UAC3D;AACA,cAAI,WAAW,CAAC,SAAU,SAAQ,OAAO,CAAC;AAAA,QAC5C;AAAA,QACA,SAAS,CAAC,MAAM;AAMd,cAAI,aAAc,+BAAU,EAAE,GAAG,SAAS,oBAAoB,CAAC;AAAA,QACjE;AAAA,QACA,WAAW,CAAC,MAAM;AAOhB,cAAI,EAAE,QAAQ,QAAS,GAAE,gBAAgB;AACzC,cAAI,CAAC,SAAU,iBAAgB,CAAC;AAChC,cAAI,aAAa,CAAC,SAAU,WAAU,CAAC;AAAA,QACzC;AAAA,QACA;AAAA;AAAA,MAEC;AAAA,MACA,YACC,4EACE;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,eAAY;AAAA,YACZ;AAAA,YACA;AAAA,YACD;AAAA;AAAA,QAED;AAAA,QACA,4CAAC,kCAAiB,eAA8B,wBAAgD,sBAEhG;AAAA,SACF;AAAA,MAED,YAAY,SAAS,2BAAU,UAC9B;AAAA,QAAC;AAAA;AAAA,UACC,eAAY;AAAA,UACZ;AAAA,UACA,SAAS;AAAA,UACT;AAAA,UACA;AAAA;AAAA,MACF,IACE;AAAA,IACN;AAAA,EAEJ,CAAC;AACH,CAAC;",
|
|
6
6
|
"names": ["import_react", "React"]
|
|
7
7
|
}
|
|
@@ -57,11 +57,19 @@ const TabsContent = () => {
|
|
|
57
57
|
getOwnerProps,
|
|
58
58
|
getOwnerPropsArguments,
|
|
59
59
|
children: [
|
|
60
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
61
|
+
import_styles.StyledTabBarContainer,
|
|
62
|
+
{
|
|
63
|
+
"aria-label": tabsListAriaLabel,
|
|
64
|
+
getOwnerProps,
|
|
65
|
+
getOwnerPropsArguments,
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TabBar.TabBar, {}),
|
|
68
|
+
TabBarExtraContent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabBarExtraContent, {}) : null,
|
|
69
|
+
tabBarExtraContent || null
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
),
|
|
65
73
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TabsPanels.TabsPanels, {})
|
|
66
74
|
]
|
|
67
75
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/tabsContent/TabsContent.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext } from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { TabsPanels } from '../tabsPanel/TabsPanels.js';\nimport { TabBar } from '../tabBar/TabBar.js';\nimport { StyledTabBarContainer, StyledTabsContainer } from './styles.js';\nimport { DSTabsContext } from '../../DSTabsCTX.js';\n\nexport const TabsContent = (): JSX.Element => {\n const {\n props,\n props: { containerProps, innerRef, tabsListAriaLabel, tabBarExtraContent, TabBarExtraContent },\n } = useContext(DSTabsContext);\n\n const globalProps = useGetGlobalAttributes(props);\n const xstyledProps = useGetXstyledProps(props);\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);\n\n return (\n <StyledTabsContainer\n {...globalProps}\n {...xstyledProps}\n {...containerProps}\n innerRef={innerRef}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledTabBarContainer
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD0BjB;AA1BN,mBAAkC;AAClC,8BAA0E;AAC1E,wBAA2B;AAC3B,oBAAuB;AACvB,oBAA2D;AAC3D,uBAA8B;AAEvB,MAAM,cAAc,MAAmB;AAC5C,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,gBAAgB,UAAU,mBAAmB,oBAAoB,mBAAmB;AAAA,EAC/F,QAAI,yBAAW,8BAAa;AAE5B,QAAM,kBAAc,gDAAuB,KAAK;AAChD,QAAM,mBAAe,4CAAmB,KAAK;AAC7C,QAAM,EAAE,eAAe,uBAAuB,QAAI,uCAAc,KAAK;AAErE,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MAEA;AAAA,
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { TabsPanels } from '../tabsPanel/TabsPanels.js';\nimport { TabBar } from '../tabBar/TabBar.js';\nimport { StyledTabBarContainer, StyledTabsContainer } from './styles.js';\nimport { DSTabsContext } from '../../DSTabsCTX.js';\n\nexport const TabsContent = (): JSX.Element => {\n const {\n props,\n props: { containerProps, innerRef, tabsListAriaLabel, tabBarExtraContent, TabBarExtraContent },\n } = useContext(DSTabsContext);\n\n const globalProps = useGetGlobalAttributes(props);\n const xstyledProps = useGetXstyledProps(props);\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);\n\n return (\n <StyledTabsContainer\n {...globalProps}\n {...xstyledProps}\n {...containerProps}\n innerRef={innerRef}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledTabBarContainer\n aria-label={tabsListAriaLabel}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <TabBar />\n {TabBarExtraContent ? <TabBarExtraContent /> : null}\n {tabBarExtraContent || null}\n </StyledTabBarContainer>\n <TabsPanels />\n </StyledTabsContainer>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD0BjB;AA1BN,mBAAkC;AAClC,8BAA0E;AAC1E,wBAA2B;AAC3B,oBAAuB;AACvB,oBAA2D;AAC3D,uBAA8B;AAEvB,MAAM,cAAc,MAAmB;AAC5C,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,gBAAgB,UAAU,mBAAmB,oBAAoB,mBAAmB;AAAA,EAC/F,QAAI,yBAAW,8BAAa;AAE5B,QAAM,kBAAc,gDAAuB,KAAK;AAChD,QAAM,mBAAe,4CAAmB,KAAK;AAC7C,QAAM,EAAE,eAAe,uBAAuB,QAAI,uCAAc,KAAK;AAErE,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,cAAY;AAAA,YACZ;AAAA,YACA;AAAA,YAEA;AAAA,0DAAC,wBAAO;AAAA,cACP,qBAAqB,4CAAC,sBAAmB,IAAK;AAAA,cAC9C,sBAAsB;AAAA;AAAA;AAAA,QACzB;AAAA,QACA,4CAAC,gCAAW;AAAA;AAAA;AAAA,EACd;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -38,7 +38,19 @@ var import_react = __toESM(require("react"));
|
|
|
38
38
|
var import_DSTabsCTX = require("../../DSTabsCTX.js");
|
|
39
39
|
var import_styles = require("./styles.js");
|
|
40
40
|
const CardRender = (props) => {
|
|
41
|
-
const {
|
|
41
|
+
const {
|
|
42
|
+
content,
|
|
43
|
+
tabPanelsProps,
|
|
44
|
+
isDSMobile,
|
|
45
|
+
hide,
|
|
46
|
+
style,
|
|
47
|
+
role,
|
|
48
|
+
tabId,
|
|
49
|
+
renderKey,
|
|
50
|
+
getOwnerProps,
|
|
51
|
+
getOwnerPropsArguments,
|
|
52
|
+
...rest
|
|
53
|
+
} = props;
|
|
42
54
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
43
55
|
import_styles.StyledPanelContainer,
|
|
44
56
|
{
|
|
@@ -49,6 +61,8 @@ const CardRender = (props) => {
|
|
|
49
61
|
hide,
|
|
50
62
|
style,
|
|
51
63
|
role,
|
|
64
|
+
getOwnerProps,
|
|
65
|
+
getOwnerPropsArguments,
|
|
52
66
|
children: content
|
|
53
67
|
}
|
|
54
68
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/tabsPanel/TabsPanels.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable arrow-body-style */\n/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport type { DSSwipeCardT } from '@elliemae/ds-swipe-card/src/react-desc-prop-types.js';\nimport React, { useCallback, useContext, useMemo } from 'react';\nimport { DSTabsContext } from '../../DSTabsCTX.js';\nimport type { DSTabT } from '../../react-desc-prop-types.js';\nimport type { PanelDescriptor } from './styles.js';\nimport { StyledDSSwipeCard, StyledPanelContainer } from './styles.js';\n/**\n * Describes the data needed to render a single Tab panel slide.\n */\n\n/**\n * Responsible for rendering a single slide using the provided panel descriptor.\n * Receives a `dsIndex` prop from DSSwipeCard which indicates the slide position.\n */\nconst CardRender: React.ComponentType<DSSwipeCardT.CardRenderProps<PanelDescriptor>> = (props) => {\n const {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable arrow-body-style */\n/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\nimport { useOwnerProps } from '@elliemae/ds-props-helpers';\nimport type { DSSwipeCardT } from '@elliemae/ds-swipe-card/src/react-desc-prop-types.js';\nimport React, { useCallback, useContext, useMemo } from 'react';\nimport { DSTabsContext } from '../../DSTabsCTX.js';\nimport type { DSTabT } from '../../react-desc-prop-types.js';\nimport type { PanelDescriptor } from './styles.js';\nimport { StyledDSSwipeCard, StyledPanelContainer } from './styles.js';\n/**\n * Describes the data needed to render a single Tab panel slide.\n */\n\n/**\n * Responsible for rendering a single slide using the provided panel descriptor.\n * Receives a `dsIndex` prop from DSSwipeCard which indicates the slide position.\n */\nconst CardRender: React.ComponentType<DSSwipeCardT.CardRenderProps<PanelDescriptor>> = (props) => {\n const {\n content,\n tabPanelsProps,\n isDSMobile,\n hide,\n style,\n role,\n tabId,\n renderKey,\n getOwnerProps,\n getOwnerPropsArguments,\n ...rest\n } = props;\n\n // We pass through all attributes, including accessibility and dataset attributes.\n return (\n <StyledPanelContainer\n id={tabId}\n {...tabPanelsProps}\n {...rest}\n // Styled component specific props\n isDSMobile={isDSMobile}\n hide={hide}\n style={style}\n role={role}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {content}\n </StyledPanelContainer>\n );\n};\n\nexport const TabsPanels = (): JSX.Element => {\n const {\n actualActiveTab,\n focusableTabsRef,\n props,\n props: { onlyRenderActiveTab, children: tabs, isDSMobile, tabPanelsProps, animated },\n globalClickHandler,\n userDidChangeTabAtleastOnceRef,\n } = useContext(DSTabsContext);\n\n const { getOwnerProps: getTabPanelsOwnerProps, getOwnerPropsArguments: getTabPanelsOwnerPropsArguments } =\n useOwnerProps(props);\n\n /** [PUI-15772] - Tabs Pre Refactor\n * Handler for swipe gestures and tab index changes. It:\n * 1. Calculates the offset between current and new tab index\n * 2. Finds the new focusable tab based on the offset\n * 3. Updates the active tab and forces a click event\n * 4. May cause unnecessary rerenders due to forced click events\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 globalClickHandler({\n event: { type: 'click' } as React.MouseEvent<HTMLDivElement>,\n target: 'swipeableViews',\n tabId: focusableTabsRef.current[newFocusableIndex].dataset.tabId,\n });\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, globalClickHandler],\n );\n\n const panels: PanelDescriptor[] = useMemo(() => {\n // To preserve indices for swipe behavior, we return a fully-typed placeholder panel\n // instead of null when a panel should not be rendered. This keeps array length stable.\n const mapResult = React.Children.map(tabs, (tab: React.ReactElement<DSTabT.Props>, index: number) => {\n const { tabId: panelId = '', style, children: content, disabled, applyAriaDisabled } = tab.props;\n const isActive = actualActiveTab === panelId;\n const shouldRender = !onlyRenderActiveTab || isActive;\n const getOwnerProps = () => tab.props;\n const getOwnerPropsArguments = () => ({ panelId });\n\n const baseDescriptor: PanelDescriptor = {\n index,\n tabId: panelId,\n isActive: Boolean(isActive),\n isDSMobile: Boolean(isDSMobile),\n content: shouldRender && !disabled ? content : null,\n style: {\n ...(tabPanelsProps?.style || {}),\n ...(style || {}),\n } as React.CSSProperties,\n tabPanelsProps,\n 'aria-hidden': !(isActive && !applyAriaDisabled),\n 'data-panel-id': panelId,\n 'data-testid': 'ds-tabs-tab-panel',\n hide: !isActive,\n onClick: (event: React.MouseEvent<HTMLDivElement>) => globalClickHandler({ event, target: 'panel' }),\n role: 'tabpanel',\n getOwnerProps,\n getOwnerPropsArguments,\n };\n\n return baseDescriptor;\n });\n\n // Children.map can return null if there are no children; ensure an array is returned\n return mapResult || [];\n }, [tabs, actualActiveTab, onlyRenderActiveTab, tabPanelsProps, globalClickHandler, isDSMobile]);\n\n // Safely compute the active slide index. Default to 0 when none found.\n const idx = panels.findIndex((panel) => panel.isActive);\n const activeSlide = idx >= 0 ? idx : 0;\n const handleOnSlide = React.useCallback(\n (index: number) => {\n handleOnChangeIndex(index, activeSlide);\n },\n [handleOnChangeIndex, activeSlide],\n );\n\n return (\n <StyledDSSwipeCard\n activeSlide={activeSlide}\n onSwipe={handleOnSlide}\n enableTouch\n enableAnimation={userDidChangeTabAtleastOnceRef.current && animated}\n CardRender={CardRender}\n slidesProps={panels}\n getOwnerProps={getTabPanelsOwnerProps}\n getOwnerPropsArguments={getTabPanelsOwnerPropsArguments}\n />\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADkCnB;AAhCJ,8BAA8B;AAE9B,mBAAwD;AACxD,uBAA8B;AAG9B,oBAAwD;AASxD,MAAM,aAAiF,CAAC,UAAU;AAChG,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AAGJ,SACE;AAAA,IAAC;AAAA;AAAA,MACC,IAAI;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MAEJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;AAEO,MAAM,aAAa,MAAmB;AAC3C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,qBAAqB,UAAU,MAAM,YAAY,gBAAg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AU;AAAA,QAC/C,OAAO;AAAA,UACL,GAAI,gBAAgB,SAAS,CAAC;AAAA,UAC9B,GAAI,SAAS,CAAC;AAAA,QAChB;AAAA,QACA;AAAA,QACA,eAAe,EAAE,YAAY,CAAC;AAAA,QAC9B,iBAAiB;AAAA,QACjB,eAAe;AAAA,QACf,MAAM,CAAC;AAAA,QACP,SAAS,CAAC,UAA4C,mBAAmB,EAAE,OAAO,QAAQ,QAAQ,CAAC;AAAA,QACnG,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MACF;AAEA,aAAO;AAAA,IACT,CAAC;AAGD,WAAO,aAAa,CAAC;AAAA,EACvB,GAAG,CAAC,MAAM,iBAAiB,qBAAqB,gBAAgB,oBAAoB,UAAU,CAAC;AAG/F,QAAM,MAAM,OAAO,UAAU,CAAC,UAAU,MAAM,QAAQ;AACtD,QAAM,cAAc,OAAO,IAAI,MAAM;AACrC,QAAM,gBAAgB,aAAAA,QAAM;AAAA,IAC1B,CAAC,UAAkB;AACjB,0BAAoB,OAAO,WAAW;AAAA,IACxC;AAAA,IACA,CAAC,qBAAqB,WAAW;AAAA,EACnC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,SAAS;AAAA,MACT,aAAW;AAAA,MACX,iBAAiB,+BAA+B,WAAW;AAAA,MAC3D;AAAA,MACA,aAAa;AAAA,MACb,eAAe;AAAA,MACf,wBAAwB;AAAA;AAAA,EAC1B;AAEJ;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/tabsPanel/styles.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import type { GlobalAttributesT } from '@elliemae/ds-props-helpers';\nimport { DSSwipeCard } from '@elliemae/ds-swipe-card';\nimport { styled } from '@elliemae/ds-system';\nimport { DSTabsName, TABS_SLOTS } from '../../constants/index.js';\n\ninterface StyledPanelContainerPropsT {\n hide: boolean;\n isDSMobile: boolean;\n}\nexport interface PanelDescriptor extends Record<string, unknown
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,2BAA4B;AAC5B,uBAAuB;AACvB,uBAAuC;
|
|
4
|
+
"sourcesContent": ["import type { GlobalAttributesT, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport { DSSwipeCard } from '@elliemae/ds-swipe-card';\nimport { styled } from '@elliemae/ds-system';\nimport { DSTabsName, TABS_SLOTS } from '../../constants/index.js';\nimport type { DSTabT } from '../../react-desc-prop-types.js';\n\ninterface StyledPanelContainerPropsT {\n hide: boolean;\n isDSMobile: boolean;\n}\nexport interface PanelDescriptor extends Record<string, unknown>, ReturnType<typeof useOwnerProps<DSTabT.Props>> {\n index: number;\n tabId: string;\n isActive: boolean;\n isDSMobile: boolean;\n content: React.ReactNode;\n style: React.CSSProperties;\n tabPanelsProps?: GlobalAttributesT<HTMLDivElement>;\n 'aria-hidden': boolean;\n 'data-panel-id': string;\n 'data-testid': string;\n hide: boolean;\n onClick: (event: React.MouseEvent<HTMLDivElement>) => void;\n role: 'tabpanel';\n}\n\nexport const StyledPanelContainer = styled('div', {\n name: DSTabsName,\n slot: TABS_SLOTS.TAB_PANEL,\n})<StyledPanelContainerPropsT>`\n flex: 1 1 auto;\n min-height: 0;\n padding-top: 8px;\n &:focus {\n outline: none;\n }\n\n ${({ isDSMobile }) => (isDSMobile ? `padding-top: 0;` : ``)}\n`;\n\nexport const StyledDSSwipeCard = styled(DSSwipeCard<PanelDescriptor>, {\n name: DSTabsName,\n slot: TABS_SLOTS.TABS_SWIPE_CARD,\n})``;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,2BAA4B;AAC5B,uBAAuB;AACvB,uBAAuC;AAuBhC,MAAM,2BAAuB,yBAAO,OAAO;AAAA,EAChD,MAAM;AAAA,EACN,MAAM,4BAAW;AACnB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQG,CAAC,EAAE,WAAW,MAAO,aAAa,oBAAoB,EAAG;AAAA;AAGtD,MAAM,wBAAoB,yBAAO,kCAA8B;AAAA,EACpE,MAAM;AAAA,EACN,MAAM,4BAAW;AACnB,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,66 +1,25 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { jsx
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useContext } from "react";
|
|
4
|
-
import { DSIconSizes } from "@elliemae/ds-icon";
|
|
5
|
-
import { BUTTON_TYPES } from "@elliemae/ds-button-v2";
|
|
6
|
-
import { ChevronRight, ChevronLeft } from "@elliemae/ds-icons";
|
|
7
4
|
import { useOwnerProps } from "@elliemae/ds-props-helpers";
|
|
8
|
-
import {
|
|
9
|
-
StyledCarouselBtnLeft,
|
|
10
|
-
StyledCarouselBtnRight,
|
|
11
|
-
StyledCarouselButtonWrapper,
|
|
12
|
-
StyledCarouselWrapper,
|
|
13
|
-
StyledChildrenWrap
|
|
14
|
-
} from "./styles.js";
|
|
5
|
+
import { StyledCarouselWrapper, StyledChildrenWrap } from "./styles.js";
|
|
15
6
|
import { useCarousel } from "./useCarousel.js";
|
|
16
7
|
import { DSTabsContext } from "../../DSTabsCTX.js";
|
|
17
|
-
import { TABS_DATA_TESTID } from "../../constants/index.js";
|
|
18
8
|
const Carousel = ({ children }) => {
|
|
19
|
-
const {
|
|
20
|
-
const {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"data-testid": TABS_DATA_TESTID.CAROUSEL_BUTTON_LEFT,
|
|
34
|
-
buttonType: BUTTON_TYPES.ICON,
|
|
35
|
-
"aria-label": "Scroll Left",
|
|
36
|
-
getOwnerProps,
|
|
37
|
-
children: /* @__PURE__ */ jsx(ChevronLeft, { size: DSIconSizes.S })
|
|
38
|
-
}
|
|
39
|
-
) }),
|
|
40
|
-
showChevrons.right && /* @__PURE__ */ jsx(StyledCarouselButtonWrapper, { tabType: type, right: showChevrons.right, children: /* @__PURE__ */ jsx(
|
|
41
|
-
StyledCarouselBtnRight,
|
|
42
|
-
{
|
|
43
|
-
size: "s",
|
|
44
|
-
onClick: rightButtonOnClick,
|
|
45
|
-
tabIndex: -1,
|
|
46
|
-
"data-testid": TABS_DATA_TESTID.CAROUSEL_BUTTON_RIGHT,
|
|
47
|
-
buttonType: BUTTON_TYPES.ICON,
|
|
48
|
-
"aria-label": "Scroll Right",
|
|
49
|
-
getOwnerProps,
|
|
50
|
-
children: /* @__PURE__ */ jsx(ChevronRight, { size: DSIconSizes.S })
|
|
51
|
-
}
|
|
52
|
-
) }),
|
|
53
|
-
/* @__PURE__ */ jsx(
|
|
54
|
-
StyledChildrenWrap,
|
|
55
|
-
{
|
|
56
|
-
role: "tablist",
|
|
57
|
-
innerRef: carouselOnlyListRef,
|
|
58
|
-
onClick: handleOnClick,
|
|
59
|
-
onScroll: handleOnScroll,
|
|
60
|
-
children
|
|
61
|
-
}
|
|
62
|
-
)
|
|
63
|
-
] });
|
|
9
|
+
const { handleOnClick } = useCarousel();
|
|
10
|
+
const { carouselOnlyListRef, props } = useContext(DSTabsContext);
|
|
11
|
+
const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps(props);
|
|
12
|
+
return /* @__PURE__ */ jsx(StyledCarouselWrapper, { getOwnerProps, getOwnerPropsArguments, children: /* @__PURE__ */ jsx(
|
|
13
|
+
StyledChildrenWrap,
|
|
14
|
+
{
|
|
15
|
+
role: "tablist",
|
|
16
|
+
innerRef: carouselOnlyListRef,
|
|
17
|
+
onClick: handleOnClick,
|
|
18
|
+
getOwnerProps,
|
|
19
|
+
getOwnerPropsArguments,
|
|
20
|
+
children
|
|
21
|
+
}
|
|
22
|
+
) });
|
|
64
23
|
};
|
|
65
24
|
export {
|
|
66
25
|
Carousel
|