@zohodesk/components 1.6.34 → 1.6.35
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/CHANGELOG.md +4 -0
- package/assets/Appearance/dark/mode/Component_v1_DarkMode.module.css +20 -0
- package/assets/Appearance/dark/themes/blue/blue_componentsCTA_DarkModifyCategory.module.css +2 -0
- package/assets/Appearance/dark/themes/green/green_componentsCTA_DarkModifyCategory.module.css +2 -0
- package/assets/Appearance/dark/themes/orange/orange_componentsCTA_DarkModifyCategory.module.css +2 -0
- package/assets/Appearance/dark/themes/red/red_componentsCTA_DarkModifyCategory.module.css +2 -0
- package/assets/Appearance/dark/themes/yellow/yellow_componentsCTA_DarkModifyCategory.module.css +2 -0
- package/assets/Appearance/light/mode/Component_v1_LightMode.module.css +20 -0
- package/assets/Appearance/light/themes/blue/blue_componentsCTA_LightModifyCategory.module.css +2 -0
- package/assets/Appearance/light/themes/green/green_componentsCTA_LightModifyCategory.module.css +2 -0
- package/assets/Appearance/light/themes/orange/orange_componentsCTA_LightModifyCategory.module.css +2 -0
- package/assets/Appearance/light/themes/red/red_componentsCTA_LightModifyCategory.module.css +2 -0
- package/assets/Appearance/light/themes/yellow/yellow_componentsCTA_LightModifyCategory.module.css +2 -0
- package/assets/Appearance/pureDark/mode/Component_v1_PureDarkMode.module.css +20 -0
- package/assets/Appearance/pureDark/themes/blue/blue_componentsCTA_PureDarkModifyCategory.module.css +2 -0
- package/assets/Appearance/pureDark/themes/green/green_componentsCTA_PureDarkModifyCategory.module.css +2 -0
- package/assets/Appearance/pureDark/themes/orange/orange_componentsCTA_PureDarkModifyCategory.module.css +2 -0
- package/assets/Appearance/pureDark/themes/red/red_componentsCTA_PureDarkModifyCategory.module.css +2 -0
- package/assets/Appearance/pureDark/themes/yellow/yellow_componentsCTA_PureDarkModifyCategory.module.css +2 -0
- package/cbt.config.js +1 -0
- package/es/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +497 -497
- package/es/index.d.ts +39 -0
- package/es/index.js +12 -12
- package/es/v1/Tab/Tab.js +159 -0
- package/es/v1/Tab/TabList.js +153 -0
- package/es/v1/Tab/TabMoreMenu.js +245 -0
- package/es/v1/Tab/TabPanel.js +51 -0
- package/es/v1/Tab/Tabs.js +125 -0
- package/es/v1/Tab/__tests__/Tab.spec.js +1082 -0
- package/es/v1/Tab/__tests__/__snapshots__/Tab.spec.js.snap +4933 -0
- package/es/v1/Tab/constants/index.js +112 -0
- package/es/v1/Tab/constants/presets.js +36 -0
- package/es/v1/Tab/context.js +19 -0
- package/es/v1/Tab/core/Tab.js +60 -0
- package/es/v1/Tab/core/TabList.js +51 -0
- package/es/v1/Tab/core/TabListFocusScope.js +18 -0
- package/es/v1/Tab/core/TabPanel.js +54 -0
- package/es/v1/Tab/core/Tabs.js +45 -0
- package/es/v1/Tab/core/index.js +6 -0
- package/es/v1/Tab/css/Tab_v1.module.css +335 -0
- package/es/v1/Tab/css/cssJSLogic.js +1 -0
- package/es/v1/Tab/css/tab.cva.js +205 -0
- package/es/v1/Tab/index.js +8 -0
- package/es/v1/Tab/props/defaultProps.js +55 -0
- package/es/v1/Tab/props/propTypes.js +221 -0
- package/es/v1/Tab/utils/pinSelectedTab.js +44 -0
- package/lib/DateTime/__tests__/__snapshots__/DateTime.spec.js.snap +497 -497
- package/lib/index.d.ts +39 -0
- package/lib/index.js +270 -173
- package/lib/v1/Tab/Tab.js +180 -0
- package/lib/v1/Tab/TabList.js +191 -0
- package/lib/v1/Tab/TabMoreMenu.js +284 -0
- package/lib/v1/Tab/TabPanel.js +64 -0
- package/lib/v1/Tab/Tabs.js +151 -0
- package/lib/v1/Tab/__tests__/Tab.spec.js +1174 -0
- package/lib/v1/Tab/__tests__/__snapshots__/Tab.spec.js.snap +4933 -0
- package/lib/v1/Tab/constants/index.js +113 -0
- package/lib/v1/Tab/constants/presets.js +64 -0
- package/lib/v1/Tab/context.js +30 -0
- package/lib/v1/Tab/core/Tab.js +89 -0
- package/lib/v1/Tab/core/TabList.js +82 -0
- package/lib/v1/Tab/core/TabListFocusScope.js +28 -0
- package/lib/v1/Tab/core/TabPanel.js +85 -0
- package/lib/v1/Tab/core/Tabs.js +63 -0
- package/lib/v1/Tab/core/index.js +109 -0
- package/lib/v1/Tab/css/Tab_v1.module.css +335 -0
- package/lib/v1/Tab/css/cssJSLogic.js +25 -0
- package/lib/v1/Tab/css/tab.cva.js +192 -0
- package/lib/v1/Tab/index.js +159 -0
- package/lib/v1/Tab/props/defaultProps.js +69 -0
- package/lib/v1/Tab/props/propTypes.js +246 -0
- package/lib/v1/Tab/utils/pinSelectedTab.js +59 -0
- package/package.json +13 -11
- package/tsconfig.jest.json +5 -0
- package/tsconfig.json +9 -0
- package/ut.config.js +2 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { TabPanel as TabPanelCore } from "./core";
|
|
5
|
+
import { useTabsStyle } from "./context";
|
|
6
|
+
import { PANEL_SCROLL } from "./constants";
|
|
7
|
+
import { TabPanel_defaultProps } from "./props/defaultProps";
|
|
8
|
+
import { TabPanel_propTypes } from "./props/propTypes";
|
|
9
|
+
|
|
10
|
+
const TabPanel = props => {
|
|
11
|
+
const {
|
|
12
|
+
value,
|
|
13
|
+
children,
|
|
14
|
+
shouldUnmount,
|
|
15
|
+
isStatic,
|
|
16
|
+
scroll,
|
|
17
|
+
customClass,
|
|
18
|
+
customAttributes,
|
|
19
|
+
a11yAttributes,
|
|
20
|
+
customId,
|
|
21
|
+
testId,
|
|
22
|
+
dataSelectorId
|
|
23
|
+
} = props;
|
|
24
|
+
const {
|
|
25
|
+
panel: panelAttributes
|
|
26
|
+
} = customAttributes;
|
|
27
|
+
const {
|
|
28
|
+
getClasses
|
|
29
|
+
} = useTabsStyle('TabPanel');
|
|
30
|
+
return /*#__PURE__*/React.createElement(TabPanelCore, _extends({
|
|
31
|
+
value: value,
|
|
32
|
+
shouldUnmount: shouldUnmount,
|
|
33
|
+
isStatic: isStatic,
|
|
34
|
+
scroll: scroll === PANEL_SCROLL.NONE ? 'hidden' : scroll
|
|
35
|
+
}, panelAttributes, a11yAttributes, {
|
|
36
|
+
className: ({
|
|
37
|
+
isHidden
|
|
38
|
+
}) => getClasses({
|
|
39
|
+
isHidden,
|
|
40
|
+
customClass
|
|
41
|
+
}).panel,
|
|
42
|
+
customId: customId,
|
|
43
|
+
testId: testId,
|
|
44
|
+
"data-selector-id": dataSelectorId
|
|
45
|
+
}), children);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default TabPanel;
|
|
49
|
+
TabPanel.displayName = 'TabPanel';
|
|
50
|
+
TabPanel.defaultProps = TabPanel_defaultProps;
|
|
51
|
+
TabPanel.propTypes = TabPanel_propTypes;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
import React, { memo, useMemo, useRef } from 'react';
|
|
4
|
+
import { Tabs as TabsCore } from "./core";
|
|
5
|
+
import { withComponentRegistrar } from '@zohodesk/dotkit/es/react/ComponentRegistry';
|
|
6
|
+
import { useUniqueId } from "../../Provider/IdProvider";
|
|
7
|
+
import TabsStyleContext from "./context";
|
|
8
|
+
import { tab_cva } from "./css/tab.cva";
|
|
9
|
+
import { POSITION, POSITION_ORIENTATION, POSITION_DIRECTION } from "./constants";
|
|
10
|
+
import { Tabs_defaultProps } from "./props/defaultProps";
|
|
11
|
+
import { Tabs_propTypes } from "./props/propTypes";
|
|
12
|
+
|
|
13
|
+
const Tabs = props => {
|
|
14
|
+
const {
|
|
15
|
+
children,
|
|
16
|
+
selectedValue,
|
|
17
|
+
defaultValue,
|
|
18
|
+
onChange,
|
|
19
|
+
position,
|
|
20
|
+
labelStyle,
|
|
21
|
+
activation,
|
|
22
|
+
size,
|
|
23
|
+
variant,
|
|
24
|
+
isFullWidth,
|
|
25
|
+
hasScroll,
|
|
26
|
+
hasSurface,
|
|
27
|
+
hasListBorder,
|
|
28
|
+
hasListPadding,
|
|
29
|
+
textTransform,
|
|
30
|
+
textTruncate,
|
|
31
|
+
iconPlacement,
|
|
32
|
+
iconSpacing,
|
|
33
|
+
uniqueId,
|
|
34
|
+
customProps,
|
|
35
|
+
customAttributes,
|
|
36
|
+
a11yAttributes,
|
|
37
|
+
customId,
|
|
38
|
+
testId,
|
|
39
|
+
dataSelectorId,
|
|
40
|
+
customClass
|
|
41
|
+
} = props;
|
|
42
|
+
const {
|
|
43
|
+
root: rootProps
|
|
44
|
+
} = customProps;
|
|
45
|
+
const {
|
|
46
|
+
root: rootAttributes
|
|
47
|
+
} = customAttributes;
|
|
48
|
+
const getNextId = useUniqueId('dotTabs');
|
|
49
|
+
const scopeIdRef = useRef(null);
|
|
50
|
+
|
|
51
|
+
if (scopeIdRef.current === null) {
|
|
52
|
+
scopeIdRef.current = getNextId();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const resolvedPosition = position || POSITION.TOP;
|
|
56
|
+
const resolvedOrientation = POSITION_ORIENTATION[resolvedPosition];
|
|
57
|
+
const styleValue = useMemo(() => {
|
|
58
|
+
const styleProps = {
|
|
59
|
+
size,
|
|
60
|
+
variant,
|
|
61
|
+
position: resolvedPosition,
|
|
62
|
+
orientation: resolvedOrientation,
|
|
63
|
+
labelStyle,
|
|
64
|
+
iconPlacement,
|
|
65
|
+
isFullWidth,
|
|
66
|
+
hasScroll,
|
|
67
|
+
hasSurface,
|
|
68
|
+
hasListBorder,
|
|
69
|
+
hasListPadding,
|
|
70
|
+
iconSpacing,
|
|
71
|
+
customClass
|
|
72
|
+
};
|
|
73
|
+
return {
|
|
74
|
+
size,
|
|
75
|
+
variant,
|
|
76
|
+
position: resolvedPosition,
|
|
77
|
+
orientation: resolvedOrientation,
|
|
78
|
+
labelStyle,
|
|
79
|
+
isFullWidth,
|
|
80
|
+
hasScroll,
|
|
81
|
+
hasSurface,
|
|
82
|
+
hasListBorder,
|
|
83
|
+
hasListPadding,
|
|
84
|
+
textTransform,
|
|
85
|
+
textTruncate,
|
|
86
|
+
iconPlacement,
|
|
87
|
+
iconSpacing,
|
|
88
|
+
classes: tab_cva({
|
|
89
|
+
props: styleProps
|
|
90
|
+
}),
|
|
91
|
+
getClasses: (extra = {}) => tab_cva({
|
|
92
|
+
props: { ...styleProps,
|
|
93
|
+
...extra,
|
|
94
|
+
customClass: { ...styleProps.customClass,
|
|
95
|
+
...extra.customClass
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
};
|
|
100
|
+
}, [size, variant, resolvedPosition, resolvedOrientation, labelStyle, isFullWidth, hasScroll, hasSurface, hasListBorder, hasListPadding, textTransform, textTruncate, iconPlacement, iconSpacing, customClass]);
|
|
101
|
+
return /*#__PURE__*/React.createElement(TabsCore, _extends({
|
|
102
|
+
selectedValue: selectedValue,
|
|
103
|
+
defaultValue: defaultValue,
|
|
104
|
+
onChange: onChange,
|
|
105
|
+
orientation: resolvedOrientation,
|
|
106
|
+
activation: activation,
|
|
107
|
+
uniqueId: uniqueId || scopeIdRef.current,
|
|
108
|
+
displayMode: "flex",
|
|
109
|
+
direction: POSITION_DIRECTION[resolvedPosition]
|
|
110
|
+
}, rootProps, rootAttributes, a11yAttributes, {
|
|
111
|
+
className: styleValue.classes.root,
|
|
112
|
+
customId: customId,
|
|
113
|
+
testId: testId,
|
|
114
|
+
"data-selector-id": dataSelectorId
|
|
115
|
+
}), /*#__PURE__*/React.createElement(TabsStyleContext.Provider, {
|
|
116
|
+
value: styleValue
|
|
117
|
+
}, children));
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
Tabs.displayName = 'Tabs';
|
|
121
|
+
Tabs.defaultProps = Tabs_defaultProps;
|
|
122
|
+
Tabs.propTypes = Tabs_propTypes;
|
|
123
|
+
export default withComponentRegistrar( /*#__PURE__*/memo(Tabs), {
|
|
124
|
+
name: 'ZDC_V1_Tab'
|
|
125
|
+
});
|