@elliemae/ds-tabs 3.55.0-next.6 → 3.55.0-next.8
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/tabsPanel/TabsPanels.js +58 -69
- package/dist/cjs/parts/tabsPanel/TabsPanels.js.map +3 -3
- package/dist/cjs/parts/tabsPanel/styles.js +0 -4
- package/dist/cjs/parts/tabsPanel/styles.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +2 -2
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/esm/parts/tabsPanel/TabsPanels.js +54 -65
- package/dist/esm/parts/tabsPanel/TabsPanels.js.map +2 -2
- package/dist/esm/parts/tabsPanel/styles.js +0 -4
- package/dist/esm/parts/tabsPanel/styles.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +2 -2
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/types/parts/tabsPanel/TabsPanels.d.ts +1 -1
- package/dist/types/react-desc-prop-types.d.ts +1 -2
- package/package.json +9 -10
|
@@ -33,27 +33,34 @@ __export(TabsPanels_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(TabsPanels_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
-
var import_react = require("react");
|
|
37
|
-
var
|
|
38
|
-
var import_react_swipeable_views = __toESM(require("react-swipeable-views"));
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_ds_swipe_card = require("@elliemae/ds-swipe-card");
|
|
39
38
|
var import_styles = require("./styles.js");
|
|
40
39
|
var import_DSTabsCTX = require("../../DSTabsCTX.js");
|
|
40
|
+
const CardRender = (props) => {
|
|
41
|
+
const { content, tabPanelsProps, isDSMobile, hide, style, role, tabId, ...rest } = props;
|
|
42
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
43
|
+
import_styles.StyledPanelContainer,
|
|
44
|
+
{
|
|
45
|
+
id: tabId,
|
|
46
|
+
...tabPanelsProps,
|
|
47
|
+
...rest,
|
|
48
|
+
isDSMobile,
|
|
49
|
+
hide,
|
|
50
|
+
style,
|
|
51
|
+
role,
|
|
52
|
+
children: content
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
};
|
|
41
56
|
const TabsPanels = () => {
|
|
42
57
|
const {
|
|
43
58
|
actualActiveTab,
|
|
44
59
|
focusableTabsRef,
|
|
45
|
-
props: {
|
|
46
|
-
animated,
|
|
47
|
-
enableMouseEvents,
|
|
48
|
-
onlyRenderActiveTab,
|
|
49
|
-
children: tabs,
|
|
50
|
-
isDSMobile,
|
|
51
|
-
tabPanelsProps,
|
|
52
|
-
swipeableViewsContainerProps
|
|
53
|
-
},
|
|
60
|
+
props: { onlyRenderActiveTab, children: tabs, isDSMobile, tabPanelsProps, animated },
|
|
54
61
|
globalClickHandler
|
|
55
|
-
} = (0,
|
|
56
|
-
const handleOnChangeIndex = (0,
|
|
62
|
+
} = (0, import_react.useContext)(import_DSTabsCTX.DSTabsContext);
|
|
63
|
+
const handleOnChangeIndex = (0, import_react.useCallback)(
|
|
57
64
|
(index, indexLatest) => {
|
|
58
65
|
if (!focusableTabsRef.current) return;
|
|
59
66
|
const offset = index - indexLatest;
|
|
@@ -72,65 +79,47 @@ const TabsPanels = () => {
|
|
|
72
79
|
},
|
|
73
80
|
[actualActiveTab, focusableTabsRef, globalClickHandler]
|
|
74
81
|
);
|
|
75
|
-
const panels = (0,
|
|
76
|
-
const
|
|
77
|
-
return import_react2.default.Children.map(tabs, (tab) => {
|
|
82
|
+
const panels = (0, import_react.useMemo)(() => {
|
|
83
|
+
const mapResult = import_react.default.Children.map(tabs, (tab, index) => {
|
|
78
84
|
const { tabId: panelId = "", style, children: content, disabled, applyAriaDisabled } = tab.props;
|
|
79
85
|
const isActive = actualActiveTab === panelId;
|
|
80
86
|
const shouldRender = !onlyRenderActiveTab || isActive;
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
{
|
|
88
|
-
...tabPanelsProps,
|
|
89
|
-
getOwnerProps,
|
|
90
|
-
getOwnerPropsArguments,
|
|
91
|
-
key: panelId,
|
|
92
|
-
id: panelId,
|
|
93
|
-
"aria-labelledby": `${panelId}-label`,
|
|
94
|
-
"aria-hidden": !isActive || !!applyAriaDisabled,
|
|
95
|
-
"data-panel-id": panelId,
|
|
96
|
-
"data-testid": "ds-tabs-tab-panel",
|
|
97
|
-
hide: !isActive,
|
|
98
|
-
onClick: (event) => globalClickHandler({ event, target: "panel" }),
|
|
99
|
-
role: "tabpanel",
|
|
100
|
-
style: {
|
|
101
|
-
...tabPanelsProps?.style || {},
|
|
102
|
-
...style || {}
|
|
103
|
-
},
|
|
104
|
-
isDSMobile
|
|
105
|
-
},
|
|
106
|
-
content
|
|
107
|
-
);
|
|
108
|
-
});
|
|
109
|
-
}, [animated, tabs, actualActiveTab, onlyRenderActiveTab, tabPanelsProps, globalClickHandler, isDSMobile]);
|
|
110
|
-
const indexExclusiveToSwipeableIndexThatReliesOnReactChildrenToArrayWhichAutoFiltersNull = (0, import_react2.useMemo)(() => {
|
|
111
|
-
const childrenArray = import_react2.default.Children.toArray(tabs);
|
|
112
|
-
const index = childrenArray.findIndex((tab) => tab.props.tabId === actualActiveTab);
|
|
113
|
-
if (index === -1) return 0;
|
|
114
|
-
return index;
|
|
115
|
-
}, [actualActiveTab, tabs]);
|
|
116
|
-
if (animated) {
|
|
117
|
-
const Comp = import_react_swipeable_views.default?.default ?? import_react_swipeable_views.default;
|
|
118
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
119
|
-
Comp,
|
|
120
|
-
{
|
|
121
|
-
...swipeableViewsContainerProps,
|
|
87
|
+
const baseDescriptor = {
|
|
88
|
+
index,
|
|
89
|
+
tabId: panelId,
|
|
90
|
+
isActive: Boolean(isActive),
|
|
91
|
+
isDSMobile: Boolean(isDSMobile),
|
|
92
|
+
content: shouldRender && !disabled ? content : null,
|
|
122
93
|
style: {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
...swipeableViewsContainerProps?.style || {}
|
|
94
|
+
...tabPanelsProps?.style || {},
|
|
95
|
+
...style || {}
|
|
126
96
|
},
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
97
|
+
tabPanelsProps,
|
|
98
|
+
"aria-hidden": !(isActive && !applyAriaDisabled),
|
|
99
|
+
"data-panel-id": panelId,
|
|
100
|
+
"data-testid": "ds-tabs-tab-panel",
|
|
101
|
+
hide: !isActive,
|
|
102
|
+
onClick: (event) => globalClickHandler({ event, target: "panel" }),
|
|
103
|
+
role: "tabpanel"
|
|
104
|
+
};
|
|
105
|
+
return baseDescriptor;
|
|
106
|
+
});
|
|
107
|
+
return mapResult || [];
|
|
108
|
+
}, [tabs, actualActiveTab, onlyRenderActiveTab, tabPanelsProps, globalClickHandler, isDSMobile]);
|
|
109
|
+
const activeSlide = (() => {
|
|
110
|
+
const idx = panels.findIndex((panel) => panel.isActive);
|
|
111
|
+
return idx >= 0 ? idx : 0;
|
|
112
|
+
})();
|
|
113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
114
|
+
import_ds_swipe_card.DSSwipeCard,
|
|
115
|
+
{
|
|
116
|
+
activeSlide,
|
|
117
|
+
onSwipe: (i) => handleOnChangeIndex(i, activeSlide),
|
|
118
|
+
enableTouch: true,
|
|
119
|
+
enableAnimation: animated,
|
|
120
|
+
CardRender,
|
|
121
|
+
slidesProps: panels
|
|
122
|
+
}
|
|
123
|
+
);
|
|
135
124
|
};
|
|
136
125
|
//# sourceMappingURL=TabsPanels.js.map
|
|
@@ -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 React, { useMemo, useContext, useCallback } from 'react';\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["/* eslint-disable arrow-body-style */\n/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\nimport React, { useMemo, useContext, useCallback } from 'react';\nimport { DSSwipeCard } from '@elliemae/ds-swipe-card';\nimport type { DSSwipeCardT } from '@elliemae/ds-swipe-card/src/react-desc-prop-types.js';\nimport type { GlobalAttributesT } from '@elliemae/ds-props-helpers';\nimport { StyledPanelContainer } from './styles.js';\nimport { DSTabsContext } from '../../DSTabsCTX.js';\nimport type { DSTabT } from '../../react-desc-prop-types.js';\n/**\n * Describes the data needed to render a single Tab panel slide.\n */\ninterface PanelDescriptor extends Record<string, unknown> {\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\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 { content, tabPanelsProps, isDSMobile, hide, style, role, tabId, ...rest } = props;\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 >\n {content}\n </StyledPanelContainer>\n );\n};\n\nexport const TabsPanels = (): JSX.Element => {\n const {\n actualActiveTab,\n focusableTabsRef,\n props: { onlyRenderActiveTab, children: tabs, isDSMobile, tabPanelsProps, animated },\n globalClickHandler,\n } = useContext(DSTabsContext);\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 // this component is based on React.children, swipeable views want an index in the array, not a tabId\n // two bad patterns relying on each others results in:\n // - because of react.children,\n // to guarantee predictability in finding the index based on tabId we should never return \"null\" which is not part of React.Children.toArray\n //\n // when not using swipeable views, we don't need to find the index based on tabId\n // so even if we return null the variable\n // indexExclusiveToSwipeableIndexThatReliesOnReactChildrenToArrayWhichAutoFiltersNull\n // (which will be calculating the wrong index)\n // will have no impact on the rendering\n // https://react.dev/reference/react/Children#children-toarray-caveats\n // Caveats\n // Empty nodes (null, undefined, and Booleans) will be omitted in the returned array.\n //\n // So, long story short,\n // 1 - do not remove next line, keep the <div /> instead of null when \"animated\"\n // 2 - NEVER EVER BUILD API BASED ON REACT.CHILDREN (if you are writing code post 2022 and you are not working on a legacy codebase)\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 };\n\n return baseDescriptor;\n\n // (\n // <StyledPanelContainer\n // {...tabPanelsProps}\n\n // isDSMobile={isDSMobile}\n // >\n // {}\n // </StyledPanelContainer>\n // );\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 activeSlide = (() => {\n const idx = panels.findIndex((panel) => panel.isActive);\n return idx >= 0 ? idx : 0;\n })();\n\n return (\n <DSSwipeCard<PanelDescriptor>\n activeSlide={activeSlide}\n onSwipe={(i) => handleOnChangeIndex(i, activeSlide)}\n enableTouch\n enableAnim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;",
|
|
6
|
+
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -42,9 +42,5 @@ const StyledPanelContainer = (0, import_ds_system.styled)("div", {
|
|
|
42
42
|
&:focus {
|
|
43
43
|
outline: none;
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
${({ hide }) => hide ? "visibility: hidden; position: absolute;" : ""}
|
|
47
|
-
|
|
48
|
-
${({ isDSMobile }) => isDSMobile ? `padding-top: 0;` : ``}
|
|
49
45
|
`;
|
|
50
46
|
//# sourceMappingURL=styles.js.map
|
|
@@ -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 { styled } from '@elliemae/ds-system';\nimport { TABS_SLOTS, DSTabsName } from '../../constants/index.js';\n\ninterface StyledPanelContainerPropsT {\n hide: boolean;\n isDSMobile: boolean;\n}\n\nexport const StyledPanelContainer = styled('div', {\n name: DSTabsName,\n slot: TABS_SLOTS.TAB_PANEL,\n})<StyledPanelContainerPropsT>`\n padding-top: 8px;\n &:focus {\n outline: none;\n }\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AACvB,uBAAuC;AAOhC,MAAM,2BAAuB,yBAAO,OAAO;AAAA,EAChD,MAAM;AAAA,EACN,MAAM,4BAAW;AACnB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import { styled } from '@elliemae/ds-system';\nimport { TABS_SLOTS, DSTabsName } from '../../constants/index.js';\n\ninterface StyledPanelContainerPropsT {\n hide: boolean;\n isDSMobile: boolean;\n}\n\nexport const StyledPanelContainer = styled('div', {\n name: DSTabsName,\n slot: TABS_SLOTS.TAB_PANEL,\n})<StyledPanelContainerPropsT>`\n padding-top: 8px;\n &:focus {\n outline: none;\n }\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AACvB,uBAAuC;AAOhC,MAAM,2BAAuB,yBAAO,OAAO;AAAA,EAChD,MAAM;AAAA,EACN,MAAM,4BAAW;AACnB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -59,7 +59,7 @@ const DSTabsPropTypes = {
|
|
|
59
59
|
...import_ds_props_helpers.globalAttributesPropTypes,
|
|
60
60
|
...import_ds_props_helpers.xstyledPropTypes,
|
|
61
61
|
animated: import_ds_props_helpers.PropTypes.bool.description("Whether the Tab transition should animate or not.").defaultValue(true),
|
|
62
|
-
enableMouseEvents: import_ds_props_helpers.PropTypes.bool.description("Enables Tab transition with mouse drag events.").defaultValue(false),
|
|
62
|
+
enableMouseEvents: import_ds_props_helpers.PropTypes.bool.description("Enables Tab transition with mouse drag events.").defaultValue(false).deprecated({ version: "3.55.x", message: "This prop is no longer supported." }),
|
|
63
63
|
allowTextSelection: import_ds_props_helpers.PropTypes.bool.description("Allows text selection when mouse drag events are active.").defaultValue(false),
|
|
64
64
|
onTabChange: import_ds_props_helpers.PropTypes.func.description("Handler when a user clicks on a different Tab.").defaultValue("() => {}"),
|
|
65
65
|
type: import_ds_props_helpers.PropTypes.oneOf(import_constants.TAB_TYPES_VALUES_AS_ARRAY).description("Tab type.").defaultValue(import_constants.TAB_TYPES_VALUES_AS_ARRAY[0]),
|
|
@@ -75,7 +75,7 @@ const DSTabsPropTypes = {
|
|
|
75
75
|
containerProps: import_ds_props_helpers.PropTypes.object.description("Additional properties for the container.").defaultValue({}),
|
|
76
76
|
innerRef: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.func, import_ds_props_helpers.PropTypes.shape({ current: import_ds_props_helpers.PropTypes.any })]).description("Ref to the container.").defaultValue(void 0),
|
|
77
77
|
tabPanelsProps: import_ds_props_helpers.PropTypes.shape(import_ds_props_helpers.globalAttributesPropTypes).description("Additional properties for the tab container.").defaultValue({}),
|
|
78
|
-
swipeableViewsContainerProps: import_ds_props_helpers.PropTypes.object.description("Additional properties for the swipeable container.").defaultValue({}),
|
|
78
|
+
swipeableViewsContainerProps: import_ds_props_helpers.PropTypes.object.description("Additional properties for the swipeable container.").defaultValue(void 0).deprecated({ version: "3.55.x", message: "This prop is no longer supported." }),
|
|
79
79
|
firstSubtabRef: import_ds_props_helpers.PropTypes.shape({ current: import_ds_props_helpers.PropTypes.any }).description("Ref to the first subtab element.").defaultValue(void 0),
|
|
80
80
|
lastTabRef: import_ds_props_helpers.PropTypes.shape({ current: import_ds_props_helpers.PropTypes.any }).description("Ref to the last tab element.").defaultValue(void 0),
|
|
81
81
|
TabBarExtraContent: import_ds_props_helpers.PropTypes.element.description("Additional content to display in the tab bar."),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/react-desc-prop-types.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import type { DSPropTypesSchema, GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport type {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,8BAKO;
|
|
4
|
+
"sourcesContent": ["import type { DSPropTypesSchema, GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport type { DSTabsInternalsT } from './sharedTypes.js';\n\nimport { DSTabsName, TABS_SLOTS, TAB_TYPES, TAB_TYPES_VALUES_AS_ARRAY } from './constants/index.js';\n\nconst noop = (): void => {};\n\nexport declare namespace DSTabT {\n export interface DefaultProps {\n tabId: string;\n applyAriaDisabled: boolean;\n }\n\n export interface OptionalProps {\n style?: Record<string, unknown>;\n title?: string;\n required?: boolean;\n disabled?: boolean;\n ref?: React.MutableRefObject<HTMLButtonElement>;\n onClick?: (tabId: string | number, e: React.MouseEvent) => null | void;\n onKeyDown?: (e: React.KeyboardEvent) => null | void;\n }\n\n export interface RequiredProps {\n children: TypescriptHelpersT.ReactChildrenComplete;\n }\n\n export interface Props extends Partial<DefaultProps>, OptionalProps, RequiredProps {}\n}\n\nexport declare namespace DSTabsT {\n export interface DefaultProps {\n containerProps: Record<string, unknown>;\n animated: boolean;\n enableMouseEvents: boolean;\n allowTextSelection: boolean;\n onTabChange: (tabId: string, e?: React.MouseEvent) => void;\n tabsListAriaLabel: string;\n type: DSTabsInternalsT.TabTypesT;\n children: React.ReactElement<DSTabT.Props>[] | readonly React.ReactElement<DSTabT.Props>[];\n onlyRenderActiveTab: boolean;\n fixedTabsHeaders: boolean;\n withCarousel: boolean;\n isDSMobile: boolean;\n showSelectionIndicator: boolean;\n showSeparator: boolean;\n tabPanelsProps: GlobalAttributesT<HTMLDivElement>;\n swipeableViewsContainerProps: object;\n }\n\n export interface OptionalProps {\n firstSubtabRef?: React.MutableRefObject<HTMLElement>;\n lastTabRef?: React.MutableRefObject<HTMLElement>;\n TabBarExtraContent?: React.ComponentType;\n tabBarExtraContent?: React.ReactNode;\n activeTab?: string;\n innerRef?: React.MutableRefObject<HTMLDivElement>;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLElement>, keyof DefaultProps | keyof XstyledProps>,\n XstyledProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLElement>, keyof DefaultProps | keyof XstyledProps>,\n XstyledProps {}\n}\n\nexport const DSTabPropTypes: DSPropTypesSchema<DSTabT.Props> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n tabId: PropTypes.string.description('Unique Tab id.').defaultValue(''),\n title: PropTypes.string.description('Tab title.').defaultValue(''),\n required: PropTypes.bool.description('Show a required mark next to the title.').defaultValue(false),\n disabled: PropTypes.bool.description('Disables Tab.').defaultValue(false),\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION.',\n )\n .defaultValue(false),\n style: PropTypes.object.description('Custom styles for the tab.').defaultValue({}),\n ref: PropTypes.shape({ current: PropTypes.any }).description('Ref to the tab element.').defaultValue(undefined),\n onClick: PropTypes.func.description('Click handler for the tab.').defaultValue(undefined),\n onKeyDown: PropTypes.func.description('Keydown handler for the tab.').defaultValue(undefined),\n children: PropTypes.node.description('Content of the tab.').isRequired,\n};\n\nexport const DSTabsPropTypes: DSPropTypesSchema<DSTabsT.Props> = {\n ...getPropsPerSlotPropTypes(DSTabsName, TABS_SLOTS),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n animated: PropTypes.bool.description('Whether the Tab transition should animate or not.').defaultValue(true),\n enableMouseEvents: PropTypes.bool\n .description('Enables Tab transition with mouse drag events.')\n .defaultValue(false)\n .deprecated({ version: '3.55.x', message: 'This prop is no longer supported.' }),\n allowTextSelection: PropTypes.bool\n .description('Allows text selection when mouse drag events are active.')\n .defaultValue(false),\n onTabChange: PropTypes.func.description('Handler when a user clicks on a different Tab.').defaultValue('() => {}'),\n type: PropTypes.oneOf(TAB_TYPES_VALUES_AS_ARRAY).description('Tab type.').defaultValue(TAB_TYPES_VALUES_AS_ARRAY[0]),\n fixedTabsHeaders: PropTypes.bool.description('Fixes the tab headers.').defaultValue(false),\n isDSMobile: PropTypes.bool.description('Indicates if the component is in mobile mode.').defaultValue(false),\n showSelectionIndicator: PropTypes.bool\n .description('Shows the selection indicator for the active tab.')\n .defaultValue(true),\n showSeparator: PropTypes.bool.description('Shows a separator between tabs.').defaultValue(true),\n\n onlyRenderActiveTab: PropTypes.bool.description('Only renders the active Tab in the DOM.').defaultValue(false),\n withCarousel: PropTypes.bool.description('Activate carousel behavior.').defaultValue(false),\n activeTab: PropTypes.string\n .description('Passing a value makes DSTabs a controlled component.')\n .defaultValue('First DSTab children.'),\n children: PropTypes.node.description('Use DSTab component as children.').isRequired,\n tabsListAriaLabel: PropTypes.string.description('Aria label for the list.').defaultValue('Tab list.'),\n containerProps: PropTypes.object.description('Additional properties for the container.').defaultValue({}),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })])\n .description('Ref to the container.')\n .defaultValue(undefined),\n tabPanelsProps: PropTypes.shape(globalAttributesPropTypes)\n .description('Additional properties for the tab container.')\n .defaultValue({}),\n swipeableViewsContainerProps: PropTypes.object\n .description('Additional properties for the swipeable container.')\n .defaultValue(undefined)\n .deprecated({ version: '3.55.x', message: 'This prop is no longer supported.' }),\n firstSubtabRef: PropTypes.shape({ current: PropTypes.any })\n .description('Ref to the first subtab element.')\n .defaultValue(undefined),\n lastTabRef: PropTypes.shape({ current: PropTypes.any })\n .description('Ref to the last tab element.')\n .defaultValue(undefined),\n TabBarExtraContent: PropTypes.element.description('Additional content to display in the tab bar.'),\n tabBarExtraContent: PropTypes.node\n .description('Additional content to display in the tab bar.')\n .defaultValue(undefined),\n};\n\nexport const DSTabsDefaultProps: DSTabsT.DefaultProps = {\n containerProps: {},\n animated: true,\n enableMouseEvents: false,\n allowTextSelection: false,\n onTabChange: noop,\n tabsListAriaLabel: 'Tab list',\n type: TAB_TYPES.NORMAL,\n onlyRenderActiveTab: false,\n withCarousel: false,\n isDSMobile: false,\n showSelectionIndicator: true,\n children: [],\n fixedTabsHeaders: false,\n showSeparator: true,\n tabPanelsProps: {},\n swipeableViewsContainerProps: {},\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,8BAKO;AAIP,uBAA6E;AAE7E,MAAM,OAAO,MAAY;AAAC;AAmEnB,MAAM,iBAAkD;AAAA,EAC7D,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAO,kCAAU,OAAO,YAAY,gBAAgB,EAAE,aAAa,EAAE;AAAA,EACrE,OAAO,kCAAU,OAAO,YAAY,YAAY,EAAE,aAAa,EAAE;AAAA,EACjE,UAAU,kCAAU,KAAK,YAAY,yCAAyC,EAAE,aAAa,KAAK;AAAA,EAClG,UAAU,kCAAU,KAAK,YAAY,eAAe,EAAE,aAAa,KAAK;AAAA,EACxE,mBAAmB,kCAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AAAA,EACrB,OAAO,kCAAU,OAAO,YAAY,4BAA4B,EAAE,aAAa,CAAC,CAAC;AAAA,EACjF,KAAK,kCAAU,MAAM,EAAE,SAAS,kCAAU,IAAI,CAAC,EAAE,YAAY,yBAAyB,EAAE,aAAa,MAAS;AAAA,EAC9G,SAAS,kCAAU,KAAK,YAAY,4BAA4B,EAAE,aAAa,MAAS;AAAA,EACxF,WAAW,kCAAU,KAAK,YAAY,8BAA8B,EAAE,aAAa,MAAS;AAAA,EAC5F,UAAU,kCAAU,KAAK,YAAY,qBAAqB,EAAE;AAC9D;AAEO,MAAM,kBAAoD;AAAA,EAC/D,OAAG,kDAAyB,6BAAY,2BAAU;AAAA,EAClD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,UAAU,kCAAU,KAAK,YAAY,mDAAmD,EAAE,aAAa,IAAI;AAAA,EAC3G,mBAAmB,kCAAU,KAC1B,YAAY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oD,EAChE,aAAa,MAAS,EACtB,WAAW,EAAE,SAAS,UAAU,SAAS,oCAAoC,CAAC;AAAA,EACjF,gBAAgB,kCAAU,MAAM,EAAE,SAAS,kCAAU,IAAI,CAAC,EACvD,YAAY,kCAAkC,EAC9C,aAAa,MAAS;AAAA,EACzB,YAAY,kCAAU,MAAM,EAAE,SAAS,kCAAU,IAAI,CAAC,EACnD,YAAY,8BAA8B,EAC1C,aAAa,MAAS;AAAA,EACzB,oBAAoB,kCAAU,QAAQ,YAAY,+CAA+C;AAAA,EACjG,oBAAoB,kCAAU,KAC3B,YAAY,+CAA+C,EAC3D,aAAa,MAAS;AAC3B;AAEO,MAAM,qBAA2C;AAAA,EACtD,gBAAgB,CAAC;AAAA,EACjB,UAAU;AAAA,EACV,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,MAAM,2BAAU;AAAA,EAChB,qBAAqB;AAAA,EACrB,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,wBAAwB;AAAA,EACxB,UAAU,CAAC;AAAA,EACX,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,gBAAgB,CAAC;AAAA,EACjB,8BAA8B,CAAC;AACjC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { createElement } from "react";
|
|
4
3
|
import React2, { useMemo, useContext, useCallback } from "react";
|
|
5
|
-
import
|
|
4
|
+
import { DSSwipeCard } from "@elliemae/ds-swipe-card";
|
|
6
5
|
import { StyledPanelContainer } from "./styles.js";
|
|
7
6
|
import { DSTabsContext } from "../../DSTabsCTX.js";
|
|
7
|
+
const CardRender = (props) => {
|
|
8
|
+
const { content, tabPanelsProps, isDSMobile, hide, style, role, tabId, ...rest } = props;
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
StyledPanelContainer,
|
|
11
|
+
{
|
|
12
|
+
id: tabId,
|
|
13
|
+
...tabPanelsProps,
|
|
14
|
+
...rest,
|
|
15
|
+
isDSMobile,
|
|
16
|
+
hide,
|
|
17
|
+
style,
|
|
18
|
+
role,
|
|
19
|
+
children: content
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
};
|
|
8
23
|
const TabsPanels = () => {
|
|
9
24
|
const {
|
|
10
25
|
actualActiveTab,
|
|
11
26
|
focusableTabsRef,
|
|
12
|
-
props: {
|
|
13
|
-
animated,
|
|
14
|
-
enableMouseEvents,
|
|
15
|
-
onlyRenderActiveTab,
|
|
16
|
-
children: tabs,
|
|
17
|
-
isDSMobile,
|
|
18
|
-
tabPanelsProps,
|
|
19
|
-
swipeableViewsContainerProps
|
|
20
|
-
},
|
|
27
|
+
props: { onlyRenderActiveTab, children: tabs, isDSMobile, tabPanelsProps, animated },
|
|
21
28
|
globalClickHandler
|
|
22
29
|
} = useContext(DSTabsContext);
|
|
23
30
|
const handleOnChangeIndex = useCallback(
|
|
@@ -40,65 +47,47 @@ const TabsPanels = () => {
|
|
|
40
47
|
[actualActiveTab, focusableTabsRef, globalClickHandler]
|
|
41
48
|
);
|
|
42
49
|
const panels = useMemo(() => {
|
|
43
|
-
const
|
|
44
|
-
return React2.Children.map(tabs, (tab) => {
|
|
50
|
+
const mapResult = React2.Children.map(tabs, (tab, index) => {
|
|
45
51
|
const { tabId: panelId = "", style, children: content, disabled, applyAriaDisabled } = tab.props;
|
|
46
52
|
const isActive = actualActiveTab === panelId;
|
|
47
53
|
const shouldRender = !onlyRenderActiveTab || isActive;
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
{
|
|
55
|
-
...tabPanelsProps,
|
|
56
|
-
getOwnerProps,
|
|
57
|
-
getOwnerPropsArguments,
|
|
58
|
-
key: panelId,
|
|
59
|
-
id: panelId,
|
|
60
|
-
"aria-labelledby": `${panelId}-label`,
|
|
61
|
-
"aria-hidden": !isActive || !!applyAriaDisabled,
|
|
62
|
-
"data-panel-id": panelId,
|
|
63
|
-
"data-testid": "ds-tabs-tab-panel",
|
|
64
|
-
hide: !isActive,
|
|
65
|
-
onClick: (event) => globalClickHandler({ event, target: "panel" }),
|
|
66
|
-
role: "tabpanel",
|
|
67
|
-
style: {
|
|
68
|
-
...tabPanelsProps?.style || {},
|
|
69
|
-
...style || {}
|
|
70
|
-
},
|
|
71
|
-
isDSMobile
|
|
72
|
-
},
|
|
73
|
-
content
|
|
74
|
-
);
|
|
75
|
-
});
|
|
76
|
-
}, [animated, tabs, actualActiveTab, onlyRenderActiveTab, tabPanelsProps, globalClickHandler, isDSMobile]);
|
|
77
|
-
const indexExclusiveToSwipeableIndexThatReliesOnReactChildrenToArrayWhichAutoFiltersNull = useMemo(() => {
|
|
78
|
-
const childrenArray = React2.Children.toArray(tabs);
|
|
79
|
-
const index = childrenArray.findIndex((tab) => tab.props.tabId === actualActiveTab);
|
|
80
|
-
if (index === -1) return 0;
|
|
81
|
-
return index;
|
|
82
|
-
}, [actualActiveTab, tabs]);
|
|
83
|
-
if (animated) {
|
|
84
|
-
const Comp = SwipeableViews?.default ?? SwipeableViews;
|
|
85
|
-
return /* @__PURE__ */ jsx(
|
|
86
|
-
Comp,
|
|
87
|
-
{
|
|
88
|
-
...swipeableViewsContainerProps,
|
|
54
|
+
const baseDescriptor = {
|
|
55
|
+
index,
|
|
56
|
+
tabId: panelId,
|
|
57
|
+
isActive: Boolean(isActive),
|
|
58
|
+
isDSMobile: Boolean(isDSMobile),
|
|
59
|
+
content: shouldRender && !disabled ? content : null,
|
|
89
60
|
style: {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
...swipeableViewsContainerProps?.style || {}
|
|
61
|
+
...tabPanelsProps?.style || {},
|
|
62
|
+
...style || {}
|
|
93
63
|
},
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
64
|
+
tabPanelsProps,
|
|
65
|
+
"aria-hidden": !(isActive && !applyAriaDisabled),
|
|
66
|
+
"data-panel-id": panelId,
|
|
67
|
+
"data-testid": "ds-tabs-tab-panel",
|
|
68
|
+
hide: !isActive,
|
|
69
|
+
onClick: (event) => globalClickHandler({ event, target: "panel" }),
|
|
70
|
+
role: "tabpanel"
|
|
71
|
+
};
|
|
72
|
+
return baseDescriptor;
|
|
73
|
+
});
|
|
74
|
+
return mapResult || [];
|
|
75
|
+
}, [tabs, actualActiveTab, onlyRenderActiveTab, tabPanelsProps, globalClickHandler, isDSMobile]);
|
|
76
|
+
const activeSlide = (() => {
|
|
77
|
+
const idx = panels.findIndex((panel) => panel.isActive);
|
|
78
|
+
return idx >= 0 ? idx : 0;
|
|
79
|
+
})();
|
|
80
|
+
return /* @__PURE__ */ jsx(
|
|
81
|
+
DSSwipeCard,
|
|
82
|
+
{
|
|
83
|
+
activeSlide,
|
|
84
|
+
onSwipe: (i) => handleOnChangeIndex(i, activeSlide),
|
|
85
|
+
enableTouch: true,
|
|
86
|
+
enableAnimation: animated,
|
|
87
|
+
CardRender,
|
|
88
|
+
slidesProps: panels
|
|
89
|
+
}
|
|
90
|
+
);
|
|
102
91
|
};
|
|
103
92
|
export {
|
|
104
93
|
TabsPanels
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/tabsPanel/TabsPanels.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable arrow-body-style */\n/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\nimport React, { useMemo, useContext, useCallback } from 'react';\nimport
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable arrow-body-style */\n/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\nimport React, { useMemo, useContext, useCallback } from 'react';\nimport { DSSwipeCard } from '@elliemae/ds-swipe-card';\nimport type { DSSwipeCardT } from '@elliemae/ds-swipe-card/src/react-desc-prop-types.js';\nimport type { GlobalAttributesT } from '@elliemae/ds-props-helpers';\nimport { StyledPanelContainer } from './styles.js';\nimport { DSTabsContext } from '../../DSTabsCTX.js';\nimport type { DSTabT } from '../../react-desc-prop-types.js';\n/**\n * Describes the data needed to render a single Tab panel slide.\n */\ninterface PanelDescriptor extends Record<string, unknown> {\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\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 { content, tabPanelsProps, isDSMobile, hide, style, role, tabId, ...rest } = props;\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 >\n {content}\n </StyledPanelContainer>\n );\n};\n\nexport const TabsPanels = (): JSX.Element => {\n const {\n actualActiveTab,\n focusableTabsRef,\n props: { onlyRenderActiveTab, children: tabs, isDSMobile, tabPanelsProps, animated },\n globalClickHandler,\n } = useContext(DSTabsContext);\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 // this component is based on React.children, swipeable views want an index in the array, not a tabId\n // two bad patterns relying on each others results in:\n // - because of react.children,\n // to guarantee predictability in finding the index based on tabId we should never return \"null\" which is not part of React.Children.toArray\n //\n // when not using swipeable views, we don't need to find the index based on tabId\n // so even if we return null the variable\n // indexExclusiveToSwipeableIndexThatReliesOnReactChildrenToArrayWhichAutoFiltersNull\n // (which will be calculating the wrong index)\n // will have no impact on the rendering\n // https://react.dev/reference/react/Children#children-toarray-caveats\n // Caveats\n // Empty nodes (null, undefined, and Booleans) will be omitted in the returned array.\n //\n // So, long story short,\n // 1 - do not remove next line, keep the <div /> instead of null when \"animated\"\n // 2 - NEVER EVER BUILD API BASED ON REACT.CHILDREN (if you are writing code post 2022 and you are not working on a legacy codebase)\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 };\n\n return baseDescriptor;\n\n // (\n // <StyledPanelContainer\n // {...tabPanelsProps}\n\n // isDSMobile={isDSMobile}\n // >\n // {}\n // </StyledPanelContainer>\n // );\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 activeSlide = (() => {\n const idx = panels.findIndex((panel) => panel.isActive);\n return idx >= 0 ? idx : 0;\n })();\n\n return (\n <DSSwipeCard<PanelDescriptor>\n activeSlide={activeSlide}\n onSwipe={(i) => handleOnChangeIndex(i, activeSlide)}\n enableTouch\n enableAnimation={animated}\n CardRender={CardRender}\n slidesProps={panels}\n />\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACoCnB;AAlCJ,OAAOA,UAAS,SAAS,YAAY,mBAAmB;AACxD,SAAS,mBAAmB;AAG5B,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AAyB9B,MAAM,aAAiF,CAAC,UAAU;AAChG,QAAM,EAAE,SAAS,gBAAgB,YAAY,MAAM,OAAO,MAAM,OAAO,GAAG,KAAK,IAAI;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,QACA,OAAO;AAAA,QACP,UAAU,QAAQ,QAAQ;AAAA,QAC1B,YAAY,QAAQ,UAAU;AAAA,QAC9B,SAAS,gBAAgB,CAAC,WAAW,UAAU;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,MACR;AAEA,aAAO;AAAA,IAWT,CAAC;AAGD,WAAO,aAAa,CAAC;AAAA,EACvB,GAAG,CAAC,MAAM,iBAAiB,qBAAqB,gBAAgB,oBAAoB,UAAU,CAAC;AAG/F,QAAM,eAAe,MAAM;AACzB,UAAM,MAAM,OAAO,UAAU,CAAC,UAAU,MAAM,QAAQ;AACtD,WAAO,OAAO,IAAI,MAAM;AAAA,EAC1B,GAAG;AAEH,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,SAAS,CAAC,MAAM,oBAAoB,GAAG,WAAW;AAAA,MAClD,aAAW;AAAA,MACX,iBAAiB;AAAA,MACjB;AAAA,MACA,aAAa;AAAA;AAAA,EACf;AAEJ;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -9,10 +9,6 @@ const StyledPanelContainer = styled("div", {
|
|
|
9
9
|
&:focus {
|
|
10
10
|
outline: none;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
${({ hide }) => hide ? "visibility: hidden; position: absolute;" : ""}
|
|
14
|
-
|
|
15
|
-
${({ isDSMobile }) => isDSMobile ? `padding-top: 0;` : ``}
|
|
16
12
|
`;
|
|
17
13
|
export {
|
|
18
14
|
StyledPanelContainer
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/tabsPanel/styles.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\nimport { TABS_SLOTS, DSTabsName } from '../../constants/index.js';\n\ninterface StyledPanelContainerPropsT {\n hide: boolean;\n isDSMobile: boolean;\n}\n\nexport const StyledPanelContainer = styled('div', {\n name: DSTabsName,\n slot: TABS_SLOTS.TAB_PANEL,\n})<StyledPanelContainerPropsT>`\n padding-top: 8px;\n &:focus {\n outline: none;\n }\n
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;AACvB,SAAS,YAAY,kBAAkB;AAOhC,MAAM,uBAAuB,OAAO,OAAO;AAAA,EAChD,MAAM;AAAA,EACN,MAAM,WAAW;AACnB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\nimport { TABS_SLOTS, DSTabsName } from '../../constants/index.js';\n\ninterface StyledPanelContainerPropsT {\n hide: boolean;\n isDSMobile: boolean;\n}\n\nexport const StyledPanelContainer = styled('div', {\n name: DSTabsName,\n slot: TABS_SLOTS.TAB_PANEL,\n})<StyledPanelContainerPropsT>`\n padding-top: 8px;\n &:focus {\n outline: none;\n }\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,cAAc;AACvB,SAAS,YAAY,kBAAkB;AAOhC,MAAM,uBAAuB,OAAO,OAAO;AAAA,EAChD,MAAM;AAAA,EACN,MAAM,WAAW;AACnB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -29,7 +29,7 @@ const DSTabsPropTypes = {
|
|
|
29
29
|
...globalAttributesPropTypes,
|
|
30
30
|
...xstyledPropTypes,
|
|
31
31
|
animated: PropTypes.bool.description("Whether the Tab transition should animate or not.").defaultValue(true),
|
|
32
|
-
enableMouseEvents: PropTypes.bool.description("Enables Tab transition with mouse drag events.").defaultValue(false),
|
|
32
|
+
enableMouseEvents: PropTypes.bool.description("Enables Tab transition with mouse drag events.").defaultValue(false).deprecated({ version: "3.55.x", message: "This prop is no longer supported." }),
|
|
33
33
|
allowTextSelection: PropTypes.bool.description("Allows text selection when mouse drag events are active.").defaultValue(false),
|
|
34
34
|
onTabChange: PropTypes.func.description("Handler when a user clicks on a different Tab.").defaultValue("() => {}"),
|
|
35
35
|
type: PropTypes.oneOf(TAB_TYPES_VALUES_AS_ARRAY).description("Tab type.").defaultValue(TAB_TYPES_VALUES_AS_ARRAY[0]),
|
|
@@ -45,7 +45,7 @@ const DSTabsPropTypes = {
|
|
|
45
45
|
containerProps: PropTypes.object.description("Additional properties for the container.").defaultValue({}),
|
|
46
46
|
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description("Ref to the container.").defaultValue(void 0),
|
|
47
47
|
tabPanelsProps: PropTypes.shape(globalAttributesPropTypes).description("Additional properties for the tab container.").defaultValue({}),
|
|
48
|
-
swipeableViewsContainerProps: PropTypes.object.description("Additional properties for the swipeable container.").defaultValue({}),
|
|
48
|
+
swipeableViewsContainerProps: PropTypes.object.description("Additional properties for the swipeable container.").defaultValue(void 0).deprecated({ version: "3.55.x", message: "This prop is no longer supported." }),
|
|
49
49
|
firstSubtabRef: PropTypes.shape({ current: PropTypes.any }).description("Ref to the first subtab element.").defaultValue(void 0),
|
|
50
50
|
lastTabRef: PropTypes.shape({ current: PropTypes.any }).description("Ref to the last tab element.").defaultValue(void 0),
|
|
51
51
|
TabBarExtraContent: PropTypes.element.description("Additional content to display in the tab bar."),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSPropTypesSchema, GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport type {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACCvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { DSPropTypesSchema, GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport type { DSTabsInternalsT } from './sharedTypes.js';\n\nimport { DSTabsName, TABS_SLOTS, TAB_TYPES, TAB_TYPES_VALUES_AS_ARRAY } from './constants/index.js';\n\nconst noop = (): void => {};\n\nexport declare namespace DSTabT {\n export interface DefaultProps {\n tabId: string;\n applyAriaDisabled: boolean;\n }\n\n export interface OptionalProps {\n style?: Record<string, unknown>;\n title?: string;\n required?: boolean;\n disabled?: boolean;\n ref?: React.MutableRefObject<HTMLButtonElement>;\n onClick?: (tabId: string | number, e: React.MouseEvent) => null | void;\n onKeyDown?: (e: React.KeyboardEvent) => null | void;\n }\n\n export interface RequiredProps {\n children: TypescriptHelpersT.ReactChildrenComplete;\n }\n\n export interface Props extends Partial<DefaultProps>, OptionalProps, RequiredProps {}\n}\n\nexport declare namespace DSTabsT {\n export interface DefaultProps {\n containerProps: Record<string, unknown>;\n animated: boolean;\n enableMouseEvents: boolean;\n allowTextSelection: boolean;\n onTabChange: (tabId: string, e?: React.MouseEvent) => void;\n tabsListAriaLabel: string;\n type: DSTabsInternalsT.TabTypesT;\n children: React.ReactElement<DSTabT.Props>[] | readonly React.ReactElement<DSTabT.Props>[];\n onlyRenderActiveTab: boolean;\n fixedTabsHeaders: boolean;\n withCarousel: boolean;\n isDSMobile: boolean;\n showSelectionIndicator: boolean;\n showSeparator: boolean;\n tabPanelsProps: GlobalAttributesT<HTMLDivElement>;\n swipeableViewsContainerProps: object;\n }\n\n export interface OptionalProps {\n firstSubtabRef?: React.MutableRefObject<HTMLElement>;\n lastTabRef?: React.MutableRefObject<HTMLElement>;\n TabBarExtraContent?: React.ComponentType;\n tabBarExtraContent?: React.ReactNode;\n activeTab?: string;\n innerRef?: React.MutableRefObject<HTMLDivElement>;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLElement>, keyof DefaultProps | keyof XstyledProps>,\n XstyledProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLElement>, keyof DefaultProps | keyof XstyledProps>,\n XstyledProps {}\n}\n\nexport const DSTabPropTypes: DSPropTypesSchema<DSTabT.Props> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n tabId: PropTypes.string.description('Unique Tab id.').defaultValue(''),\n title: PropTypes.string.description('Tab title.').defaultValue(''),\n required: PropTypes.bool.description('Show a required mark next to the title.').defaultValue(false),\n disabled: PropTypes.bool.description('Disables Tab.').defaultValue(false),\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION.',\n )\n .defaultValue(false),\n style: PropTypes.object.description('Custom styles for the tab.').defaultValue({}),\n ref: PropTypes.shape({ current: PropTypes.any }).description('Ref to the tab element.').defaultValue(undefined),\n onClick: PropTypes.func.description('Click handler for the tab.').defaultValue(undefined),\n onKeyDown: PropTypes.func.description('Keydown handler for the tab.').defaultValue(undefined),\n children: PropTypes.node.description('Content of the tab.').isRequired,\n};\n\nexport const DSTabsPropTypes: DSPropTypesSchema<DSTabsT.Props> = {\n ...getPropsPerSlotPropTypes(DSTabsName, TABS_SLOTS),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n animated: PropTypes.bool.description('Whether the Tab transition should animate or not.').defaultValue(true),\n enableMouseEvents: PropTypes.bool\n .description('Enables Tab transition with mouse drag events.')\n .defaultValue(false)\n .deprecated({ version: '3.55.x', message: 'This prop is no longer supported.' }),\n allowTextSelection: PropTypes.bool\n .description('Allows text selection when mouse drag events are active.')\n .defaultValue(false),\n onTabChange: PropTypes.func.description('Handler when a user clicks on a different Tab.').defaultValue('() => {}'),\n type: PropTypes.oneOf(TAB_TYPES_VALUES_AS_ARRAY).description('Tab type.').defaultValue(TAB_TYPES_VALUES_AS_ARRAY[0]),\n fixedTabsHeaders: PropTypes.bool.description('Fixes the tab headers.').defaultValue(false),\n isDSMobile: PropTypes.bool.description('Indicates if the component is in mobile mode.').defaultValue(false),\n showSelectionIndicator: PropTypes.bool\n .description('Shows the selection indicator for the active tab.')\n .defaultValue(true),\n showSeparator: PropTypes.bool.description('Shows a separator between tabs.').defaultValue(true),\n\n onlyRenderActiveTab: PropTypes.bool.description('Only renders the active Tab in the DOM.').defaultValue(false),\n withCarousel: PropTypes.bool.description('Activate carousel behavior.').defaultValue(false),\n activeTab: PropTypes.string\n .description('Passing a value makes DSTabs a controlled component.')\n .defaultValue('First DSTab children.'),\n children: PropTypes.node.description('Use DSTab component as children.').isRequired,\n tabsListAriaLabel: PropTypes.string.description('Aria label for the list.').defaultValue('Tab list.'),\n containerProps: PropTypes.object.description('Additional properties for the container.').defaultValue({}),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })])\n .description('Ref to the container.')\n .defaultValue(undefined),\n tabPanelsProps: PropTypes.shape(globalAttributesPropTypes)\n .description('Additional properties for the tab container.')\n .defaultValue({}),\n swipeableViewsContainerProps: PropTypes.object\n .description('Additional properties for the swipeable container.')\n .defaultValue(undefined)\n .deprecated({ version: '3.55.x', message: 'This prop is no longer supported.' }),\n firstSubtabRef: PropTypes.shape({ current: PropTypes.any })\n .description('Ref to the first subtab element.')\n .defaultValue(undefined),\n lastTabRef: PropTypes.shape({ current: PropTypes.any })\n .description('Ref to the last tab element.')\n .defaultValue(undefined),\n TabBarExtraContent: PropTypes.element.description('Additional content to display in the tab bar.'),\n tabBarExtraContent: PropTypes.node\n .description('Additional content to display in the tab bar.')\n .defaultValue(undefined),\n};\n\nexport const DSTabsDefaultProps: DSTabsT.DefaultProps = {\n containerProps: {},\n animated: true,\n enableMouseEvents: false,\n allowTextSelection: false,\n onTabChange: noop,\n tabsListAriaLabel: 'Tab list',\n type: TAB_TYPES.NORMAL,\n onlyRenderActiveTab: false,\n withCarousel: false,\n isDSMobile: false,\n showSelectionIndicator: true,\n children: [],\n fixedTabsHeaders: false,\n showSeparator: true,\n tabPanelsProps: {},\n swipeableViewsContainerProps: {},\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP,SAAS,YAAY,YAAY,WAAW,iCAAiC;AAE7E,MAAM,OAAO,MAAY;AAAC;AAmEnB,MAAM,iBAAkD;AAAA,EAC7D,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAO,UAAU,OAAO,YAAY,gBAAgB,EAAE,aAAa,EAAE;AAAA,EACrE,OAAO,UAAU,OAAO,YAAY,YAAY,EAAE,aAAa,EAAE;AAAA,EACjE,UAAU,UAAU,KAAK,YAAY,yCAAyC,EAAE,aAAa,KAAK;AAAA,EAClG,UAAU,UAAU,KAAK,YAAY,eAAe,EAAE,aAAa,KAAK;AAAA,EACxE,mBAAmB,UAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AAAA,EACrB,OAAO,UAAU,OAAO,YAAY,4BAA4B,EAAE,aAAa,CAAC,CAAC;AAAA,EAC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7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const TabsPanels: () => JSX.Element
|
|
1
|
+
export declare const TabsPanels: () => JSX.Element;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { DSPropTypesSchema, GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';
|
|
2
2
|
import type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';
|
|
3
|
-
import type { SwipeableViewsProps } from 'react-swipeable-views';
|
|
4
3
|
import type { DSTabsInternalsT } from './sharedTypes.js';
|
|
5
4
|
export declare namespace DSTabT {
|
|
6
5
|
interface DefaultProps {
|
|
@@ -39,7 +38,7 @@ export declare namespace DSTabsT {
|
|
|
39
38
|
showSelectionIndicator: boolean;
|
|
40
39
|
showSeparator: boolean;
|
|
41
40
|
tabPanelsProps: GlobalAttributesT<HTMLDivElement>;
|
|
42
|
-
swipeableViewsContainerProps:
|
|
41
|
+
swipeableViewsContainerProps: object;
|
|
43
42
|
}
|
|
44
43
|
interface OptionalProps {
|
|
45
44
|
firstSubtabRef?: React.MutableRefObject<HTMLElement>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-tabs",
|
|
3
|
-
"version": "3.55.0-next.
|
|
3
|
+
"version": "3.55.0-next.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Tabs",
|
|
6
6
|
"files": [
|
|
@@ -37,20 +37,19 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@react-hook/resize-observer": "~1.2.6",
|
|
40
|
-
"
|
|
41
|
-
"@elliemae/ds-
|
|
42
|
-
"@elliemae/ds-
|
|
43
|
-
"@elliemae/ds-
|
|
44
|
-
"@elliemae/ds-system": "3.55.0-next.
|
|
45
|
-
"@elliemae/ds-typescript-helpers": "3.55.0-next.
|
|
46
|
-
"@elliemae/ds-icons": "3.55.0-next.6"
|
|
40
|
+
"@elliemae/ds-button-v2": "3.55.0-next.8",
|
|
41
|
+
"@elliemae/ds-icon": "3.55.0-next.8",
|
|
42
|
+
"@elliemae/ds-props-helpers": "3.55.0-next.8",
|
|
43
|
+
"@elliemae/ds-icons": "3.55.0-next.8",
|
|
44
|
+
"@elliemae/ds-system": "3.55.0-next.8",
|
|
45
|
+
"@elliemae/ds-typescript-helpers": "3.55.0-next.8"
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
49
48
|
"@elliemae/pui-cli": "9.0.0-next.65",
|
|
50
49
|
"jest": "~29.7.0",
|
|
51
50
|
"styled-components": "~5.3.9",
|
|
52
|
-
"@elliemae/ds-monorepo-devops": "3.55.0-next.
|
|
53
|
-
"@elliemae/ds-test-utils": "3.55.0-next.
|
|
51
|
+
"@elliemae/ds-monorepo-devops": "3.55.0-next.8",
|
|
52
|
+
"@elliemae/ds-test-utils": "3.55.0-next.8"
|
|
54
53
|
},
|
|
55
54
|
"peerDependencies": {
|
|
56
55
|
"lodash-es": "^4.17.21",
|