@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,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _core = require("./core");
|
|
11
|
+
|
|
12
|
+
var _context = require("./context");
|
|
13
|
+
|
|
14
|
+
var _constants = require("./constants");
|
|
15
|
+
|
|
16
|
+
var _defaultProps = require("./props/defaultProps");
|
|
17
|
+
|
|
18
|
+
var _propTypes = require("./props/propTypes");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
+
|
|
22
|
+
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); }
|
|
23
|
+
|
|
24
|
+
var TabPanel = function TabPanel(props) {
|
|
25
|
+
var value = props.value,
|
|
26
|
+
children = props.children,
|
|
27
|
+
shouldUnmount = props.shouldUnmount,
|
|
28
|
+
isStatic = props.isStatic,
|
|
29
|
+
scroll = props.scroll,
|
|
30
|
+
customClass = props.customClass,
|
|
31
|
+
customAttributes = props.customAttributes,
|
|
32
|
+
a11yAttributes = props.a11yAttributes,
|
|
33
|
+
customId = props.customId,
|
|
34
|
+
testId = props.testId,
|
|
35
|
+
dataSelectorId = props.dataSelectorId;
|
|
36
|
+
var panelAttributes = customAttributes.panel;
|
|
37
|
+
|
|
38
|
+
var _useTabsStyle = (0, _context.useTabsStyle)('TabPanel'),
|
|
39
|
+
getClasses = _useTabsStyle.getClasses;
|
|
40
|
+
|
|
41
|
+
return /*#__PURE__*/_react["default"].createElement(_core.TabPanel, _extends({
|
|
42
|
+
value: value,
|
|
43
|
+
shouldUnmount: shouldUnmount,
|
|
44
|
+
isStatic: isStatic,
|
|
45
|
+
scroll: scroll === _constants.PANEL_SCROLL.NONE ? 'hidden' : scroll
|
|
46
|
+
}, panelAttributes, a11yAttributes, {
|
|
47
|
+
className: function className(_ref) {
|
|
48
|
+
var isHidden = _ref.isHidden;
|
|
49
|
+
return getClasses({
|
|
50
|
+
isHidden: isHidden,
|
|
51
|
+
customClass: customClass
|
|
52
|
+
}).panel;
|
|
53
|
+
},
|
|
54
|
+
customId: customId,
|
|
55
|
+
testId: testId,
|
|
56
|
+
"data-selector-id": dataSelectorId
|
|
57
|
+
}), children);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
var _default = TabPanel;
|
|
61
|
+
exports["default"] = _default;
|
|
62
|
+
TabPanel.displayName = 'TabPanel';
|
|
63
|
+
TabPanel.defaultProps = _defaultProps.TabPanel_defaultProps;
|
|
64
|
+
TabPanel.propTypes = _propTypes.TabPanel_propTypes;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _core = require("./core");
|
|
13
|
+
|
|
14
|
+
var _ComponentRegistry = require("@zohodesk/dotkit/es/react/ComponentRegistry");
|
|
15
|
+
|
|
16
|
+
var _IdProvider = require("../../Provider/IdProvider");
|
|
17
|
+
|
|
18
|
+
var _context = _interopRequireDefault(require("./context"));
|
|
19
|
+
|
|
20
|
+
var _tab = require("./css/tab.cva");
|
|
21
|
+
|
|
22
|
+
var _constants = require("./constants");
|
|
23
|
+
|
|
24
|
+
var _defaultProps = require("./props/defaultProps");
|
|
25
|
+
|
|
26
|
+
var _propTypes = require("./props/propTypes");
|
|
27
|
+
|
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
|
+
|
|
30
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
+
|
|
32
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
+
|
|
34
|
+
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); }
|
|
35
|
+
|
|
36
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
37
|
+
|
|
38
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
39
|
+
|
|
40
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
41
|
+
|
|
42
|
+
var Tabs = function Tabs(props) {
|
|
43
|
+
var children = props.children,
|
|
44
|
+
selectedValue = props.selectedValue,
|
|
45
|
+
defaultValue = props.defaultValue,
|
|
46
|
+
onChange = props.onChange,
|
|
47
|
+
position = props.position,
|
|
48
|
+
labelStyle = props.labelStyle,
|
|
49
|
+
activation = props.activation,
|
|
50
|
+
size = props.size,
|
|
51
|
+
variant = props.variant,
|
|
52
|
+
isFullWidth = props.isFullWidth,
|
|
53
|
+
hasScroll = props.hasScroll,
|
|
54
|
+
hasSurface = props.hasSurface,
|
|
55
|
+
hasListBorder = props.hasListBorder,
|
|
56
|
+
hasListPadding = props.hasListPadding,
|
|
57
|
+
textTransform = props.textTransform,
|
|
58
|
+
textTruncate = props.textTruncate,
|
|
59
|
+
iconPlacement = props.iconPlacement,
|
|
60
|
+
iconSpacing = props.iconSpacing,
|
|
61
|
+
uniqueId = props.uniqueId,
|
|
62
|
+
customProps = props.customProps,
|
|
63
|
+
customAttributes = props.customAttributes,
|
|
64
|
+
a11yAttributes = props.a11yAttributes,
|
|
65
|
+
customId = props.customId,
|
|
66
|
+
testId = props.testId,
|
|
67
|
+
dataSelectorId = props.dataSelectorId,
|
|
68
|
+
customClass = props.customClass;
|
|
69
|
+
var rootProps = customProps.root;
|
|
70
|
+
var rootAttributes = customAttributes.root;
|
|
71
|
+
var getNextId = (0, _IdProvider.useUniqueId)('dotTabs');
|
|
72
|
+
var scopeIdRef = (0, _react.useRef)(null);
|
|
73
|
+
|
|
74
|
+
if (scopeIdRef.current === null) {
|
|
75
|
+
scopeIdRef.current = getNextId();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
var resolvedPosition = position || _constants.POSITION.TOP;
|
|
79
|
+
var resolvedOrientation = _constants.POSITION_ORIENTATION[resolvedPosition];
|
|
80
|
+
var styleValue = (0, _react.useMemo)(function () {
|
|
81
|
+
var styleProps = {
|
|
82
|
+
size: size,
|
|
83
|
+
variant: variant,
|
|
84
|
+
position: resolvedPosition,
|
|
85
|
+
orientation: resolvedOrientation,
|
|
86
|
+
labelStyle: labelStyle,
|
|
87
|
+
iconPlacement: iconPlacement,
|
|
88
|
+
isFullWidth: isFullWidth,
|
|
89
|
+
hasScroll: hasScroll,
|
|
90
|
+
hasSurface: hasSurface,
|
|
91
|
+
hasListBorder: hasListBorder,
|
|
92
|
+
hasListPadding: hasListPadding,
|
|
93
|
+
iconSpacing: iconSpacing,
|
|
94
|
+
customClass: customClass
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
size: size,
|
|
98
|
+
variant: variant,
|
|
99
|
+
position: resolvedPosition,
|
|
100
|
+
orientation: resolvedOrientation,
|
|
101
|
+
labelStyle: labelStyle,
|
|
102
|
+
isFullWidth: isFullWidth,
|
|
103
|
+
hasScroll: hasScroll,
|
|
104
|
+
hasSurface: hasSurface,
|
|
105
|
+
hasListBorder: hasListBorder,
|
|
106
|
+
hasListPadding: hasListPadding,
|
|
107
|
+
textTransform: textTransform,
|
|
108
|
+
textTruncate: textTruncate,
|
|
109
|
+
iconPlacement: iconPlacement,
|
|
110
|
+
iconSpacing: iconSpacing,
|
|
111
|
+
classes: (0, _tab.tab_cva)({
|
|
112
|
+
props: styleProps
|
|
113
|
+
}),
|
|
114
|
+
getClasses: function getClasses() {
|
|
115
|
+
var extra = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
116
|
+
return (0, _tab.tab_cva)({
|
|
117
|
+
props: _objectSpread(_objectSpread(_objectSpread({}, styleProps), extra), {}, {
|
|
118
|
+
customClass: _objectSpread(_objectSpread({}, styleProps.customClass), extra.customClass)
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}, [size, variant, resolvedPosition, resolvedOrientation, labelStyle, isFullWidth, hasScroll, hasSurface, hasListBorder, hasListPadding, textTransform, textTruncate, iconPlacement, iconSpacing, customClass]);
|
|
124
|
+
return /*#__PURE__*/_react["default"].createElement(_core.Tabs, _extends({
|
|
125
|
+
selectedValue: selectedValue,
|
|
126
|
+
defaultValue: defaultValue,
|
|
127
|
+
onChange: onChange,
|
|
128
|
+
orientation: resolvedOrientation,
|
|
129
|
+
activation: activation,
|
|
130
|
+
uniqueId: uniqueId || scopeIdRef.current,
|
|
131
|
+
displayMode: "flex",
|
|
132
|
+
direction: _constants.POSITION_DIRECTION[resolvedPosition]
|
|
133
|
+
}, rootProps, rootAttributes, a11yAttributes, {
|
|
134
|
+
className: styleValue.classes.root,
|
|
135
|
+
customId: customId,
|
|
136
|
+
testId: testId,
|
|
137
|
+
"data-selector-id": dataSelectorId
|
|
138
|
+
}), /*#__PURE__*/_react["default"].createElement(_context["default"].Provider, {
|
|
139
|
+
value: styleValue
|
|
140
|
+
}, children));
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
Tabs.displayName = 'Tabs';
|
|
144
|
+
Tabs.defaultProps = _defaultProps.Tabs_defaultProps;
|
|
145
|
+
Tabs.propTypes = _propTypes.Tabs_propTypes;
|
|
146
|
+
|
|
147
|
+
var _default = (0, _ComponentRegistry.withComponentRegistrar)( /*#__PURE__*/(0, _react.memo)(Tabs), {
|
|
148
|
+
name: 'ZDC_V1_Tab'
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
exports["default"] = _default;
|