@zohodesk/components 1.2.4 → 1.2.6
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/README.md +8 -0
- package/coverage/Button/Button.js.html +1 -1
- package/coverage/Button/css/Button.module.css.html +1 -1
- package/coverage/Button/css/cssJSLogic.js.html +1 -1
- package/coverage/Button/css/index.html +1 -1
- package/coverage/Button/index.html +1 -1
- package/coverage/Button/props/defaultProps.js.html +1 -1
- package/coverage/Button/props/index.html +1 -1
- package/coverage/Button/props/propTypes.js.html +1 -1
- package/coverage/Buttongroup/Buttongroup.js.html +1 -1
- package/coverage/Buttongroup/Buttongroup.module.css.html +1 -1
- package/coverage/Buttongroup/index.html +1 -1
- package/coverage/Buttongroup/props/defaultProps.js.html +1 -1
- package/coverage/Buttongroup/props/index.html +1 -1
- package/coverage/Buttongroup/props/propTypes.js.html +1 -1
- package/coverage/index.html +1 -1
- package/coverage/utils/dummyFunction.js.html +1 -1
- package/coverage/utils/index.html +1 -1
- package/es/AppContainer/AppContainer.js +3 -0
- package/es/v1/Accordion/Accordion.js +65 -0
- package/es/v1/Accordion/AccordionItem.js +57 -0
- package/es/v1/Accordion/index.js +2 -0
- package/es/v1/Animation/Animation.js +127 -0
- package/es/v1/AppContainer/AppContainer.js +137 -0
- package/es/v1/Avatar/Avatar.js +189 -0
- package/es/v1/AvatarTeam/AvatarTeam.js +70 -0
- package/es/v1/Button/Button.js +68 -0
- package/es/v1/Buttongroup/Buttongroup.js +31 -0
- package/es/v1/Card/Card.js +271 -0
- package/es/v1/CheckBox/CheckBox.js +155 -0
- package/es/v1/DateTime/CalendarView.js +218 -0
- package/es/v1/DateTime/DateTime.js +783 -0
- package/es/v1/DateTime/DateTimePopupFooter.js +47 -0
- package/es/v1/DateTime/DateTimePopupHeader.js +105 -0
- package/es/v1/DateTime/DateWidget.js +1098 -0
- package/es/v1/DateTime/DaysRow.js +31 -0
- package/es/v1/DateTime/Time.js +166 -0
- package/es/v1/DateTime/YearView.js +264 -0
- package/es/v1/DateTime/index.js +1 -0
- package/es/v1/DropBox/DropBox.js +91 -0
- package/es/v1/DropBox/DropBoxElement/DropBoxElement.js +132 -0
- package/es/v1/DropDown/DropDown.js +73 -0
- package/es/v1/DropDown/DropDownHeading.js +44 -0
- package/es/v1/DropDown/DropDownItem.js +76 -0
- package/es/v1/DropDown/DropDownSearch.js +63 -0
- package/es/v1/DropDown/DropDownSeparator.js +15 -0
- package/es/v1/Heading/Heading.js +32 -0
- package/es/v1/Label/Label.js +40 -0
- package/es/v1/Layout/Box.js +115 -0
- package/es/v1/Layout/Container.js +132 -0
- package/es/v1/Layout/index.js +2 -0
- package/es/v1/ListItem/ListContainer.js +102 -0
- package/es/v1/ListItem/ListItem.js +124 -0
- package/es/v1/ListItem/ListItemWithAvatar.js +145 -0
- package/es/v1/ListItem/ListItemWithCheckBox.js +104 -0
- package/es/v1/ListItem/ListItemWithIcon.js +127 -0
- package/es/v1/ListItem/ListItemWithRadio.js +105 -0
- package/es/v1/ListItem/index.js +6 -0
- package/es/v1/Modal/Modal.js +154 -0
- package/es/v1/MultiSelect/AdvancedGroupMultiSelect.js +1079 -0
- package/es/v1/MultiSelect/AdvancedMultiSelect.js +568 -0
- package/es/v1/MultiSelect/EmptyState.js +64 -0
- package/es/v1/MultiSelect/MobileHeader/MobileHeader.js +50 -0
- package/es/v1/MultiSelect/MultiSelect.js +1120 -0
- package/es/v1/MultiSelect/MultiSelectHeader.js +32 -0
- package/es/v1/MultiSelect/MultiSelectWithAvatar.js +216 -0
- package/es/v1/MultiSelect/SelectedOptions.js +82 -0
- package/es/v1/MultiSelect/Suggestions.js +142 -0
- package/es/v1/MultiSelect/index.js +4 -0
- package/es/v1/PopOver/PopOver.js +211 -0
- package/es/v1/Popup/Popup.js +645 -0
- package/es/v1/Radio/Radio.js +115 -0
- package/es/v1/Responsive/CustomResponsive.js +195 -0
- package/es/v1/Responsive/RefWrapper.js +39 -0
- package/es/v1/Responsive/ResizeComponent.js +197 -0
- package/es/v1/Responsive/ResizeObserver.js +140 -0
- package/es/v1/Responsive/Responsive.js +194 -0
- package/es/v1/Responsive/index.js +9 -0
- package/es/v1/ResponsiveDropBox/ResponsiveDropBox.js +58 -0
- package/es/v1/Ribbon/Ribbon.js +33 -0
- package/es/v1/RippleEffect/RippleEffect.js +24 -0
- package/es/v1/Select/GroupSelect.js +803 -0
- package/es/v1/Select/Select.js +969 -0
- package/es/v1/Select/SelectWithAvatar.js +344 -0
- package/es/v1/Select/SelectWithIcon.js +535 -0
- package/es/v1/Select/index.js +4 -0
- package/es/v1/Stencils/Stencils.js +26 -0
- package/es/v1/Switch/Switch.js +94 -0
- package/es/v1/Tab/Tab.js +108 -0
- package/es/v1/Tab/TabContent.js +30 -0
- package/es/v1/Tab/TabContentWrapper.js +29 -0
- package/es/v1/Tab/TabWrapper.js +57 -0
- package/es/v1/Tab/Tabs.js +612 -0
- package/es/v1/Tab/index.js +5 -0
- package/es/v1/Tag/Tag.js +134 -0
- package/es/v1/TextBox/TextBox.js +154 -0
- package/es/v1/TextBoxIcon/TextBoxIcon.js +158 -0
- package/es/v1/Textarea/Textarea.js +102 -0
- package/es/v1/Tooltip/Tooltip.js +518 -0
- package/es/v1/Typography/Typography.js +38 -0
- package/es/v1/Typography/css/Typography.module.css +376 -0
- package/es/v1/Typography/css/cssJSLogic.js +46 -0
- package/es/v1/Typography/css/letterSpacingMap.js +12 -0
- package/es/v1/Typography/props/defaultProps.js +8 -0
- package/es/v1/Typography/props/propTypes.js +24 -0
- package/es/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +69 -0
- package/es/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +100 -0
- package/es/v1/semantic/Button/Button.js +53 -0
- package/es/v1/semantic/index.js +1 -0
- package/lib/AppContainer/AppContainer.js +5 -0
- package/lib/v1/Accordion/Accordion.js +96 -0
- package/lib/v1/Accordion/AccordionItem.js +68 -0
- package/lib/v1/Accordion/index.js +23 -0
- package/lib/v1/Animation/Animation.js +143 -0
- package/lib/v1/AppContainer/AppContainer.js +209 -0
- package/lib/v1/Avatar/Avatar.js +246 -0
- package/lib/v1/AvatarTeam/AvatarTeam.js +81 -0
- package/lib/v1/Button/Button.js +82 -0
- package/lib/v1/Buttongroup/Buttongroup.js +44 -0
- package/lib/v1/Card/Card.js +365 -0
- package/lib/v1/CheckBox/CheckBox.js +166 -0
- package/lib/v1/DateTime/CalendarView.js +285 -0
- package/lib/v1/DateTime/DateTime.js +872 -0
- package/lib/v1/DateTime/DateTimePopupFooter.js +96 -0
- package/lib/v1/DateTime/DateTimePopupHeader.js +166 -0
- package/lib/v1/DateTime/DateWidget.js +1125 -0
- package/lib/v1/DateTime/DaysRow.js +80 -0
- package/lib/v1/DateTime/Time.js +254 -0
- package/lib/v1/DateTime/YearView.js +325 -0
- package/lib/v1/DateTime/index.js +15 -0
- package/lib/v1/DropBox/DropBox.js +119 -0
- package/lib/v1/DropBox/DropBoxElement/DropBoxElement.js +145 -0
- package/lib/v1/DropDown/DropDown.js +170 -0
- package/lib/v1/DropDown/DropDownHeading.js +93 -0
- package/lib/v1/DropDown/DropDownItem.js +127 -0
- package/lib/v1/DropDown/DropDownSearch.js +113 -0
- package/lib/v1/DropDown/DropDownSeparator.js +64 -0
- package/lib/v1/Heading/Heading.js +49 -0
- package/lib/v1/Label/Label.js +51 -0
- package/lib/v1/Layout/Box.js +128 -0
- package/lib/v1/Layout/Container.js +145 -0
- package/lib/v1/Layout/index.js +23 -0
- package/lib/v1/ListItem/ListContainer.js +120 -0
- package/lib/v1/ListItem/ListItem.js +138 -0
- package/lib/v1/ListItem/ListItemWithAvatar.js +162 -0
- package/lib/v1/ListItem/ListItemWithCheckBox.js +125 -0
- package/lib/v1/ListItem/ListItemWithIcon.js +143 -0
- package/lib/v1/ListItem/ListItemWithRadio.js +126 -0
- package/lib/v1/ListItem/index.js +55 -0
- package/lib/v1/Modal/Modal.js +212 -0
- package/lib/v1/MultiSelect/AdvancedGroupMultiSelect.js +1167 -0
- package/lib/v1/MultiSelect/AdvancedMultiSelect.js +634 -0
- package/lib/v1/MultiSelect/EmptyState.js +112 -0
- package/lib/v1/MultiSelect/MobileHeader/MobileHeader.js +62 -0
- package/lib/v1/MultiSelect/MultiSelect.js +1201 -0
- package/lib/v1/MultiSelect/MultiSelectHeader.js +78 -0
- package/lib/v1/MultiSelect/MultiSelectWithAvatar.js +270 -0
- package/lib/v1/MultiSelect/SelectedOptions.js +126 -0
- package/lib/v1/MultiSelect/Suggestions.js +195 -0
- package/lib/v1/MultiSelect/index.js +39 -0
- package/lib/v1/PopOver/PopOver.js +293 -0
- package/lib/v1/Popup/Popup.js +715 -0
- package/lib/v1/Radio/Radio.js +126 -0
- package/lib/v1/Responsive/CustomResponsive.js +242 -0
- package/lib/v1/Responsive/RefWrapper.js +57 -0
- package/lib/v1/Responsive/ResizeComponent.js +268 -0
- package/lib/v1/Responsive/ResizeObserver.js +168 -0
- package/lib/v1/Responsive/Responsive.js +274 -0
- package/lib/v1/Responsive/index.js +55 -0
- package/lib/v1/ResponsiveDropBox/ResponsiveDropBox.js +79 -0
- package/lib/v1/Ribbon/Ribbon.js +44 -0
- package/lib/v1/RippleEffect/RippleEffect.js +39 -0
- package/lib/v1/Select/GroupSelect.js +877 -0
- package/lib/v1/Select/Select.js +1013 -0
- package/lib/v1/Select/SelectWithAvatar.js +394 -0
- package/lib/v1/Select/SelectWithIcon.js +597 -0
- package/lib/v1/Select/index.js +39 -0
- package/lib/v1/Stencils/Stencils.js +43 -0
- package/lib/v1/Switch/Switch.js +108 -0
- package/lib/v1/Tab/Tab.js +132 -0
- package/lib/v1/Tab/TabContent.js +42 -0
- package/lib/v1/Tab/TabContentWrapper.js +42 -0
- package/lib/v1/Tab/TabWrapper.js +89 -0
- package/lib/v1/Tab/Tabs.js +680 -0
- package/lib/v1/Tab/index.js +47 -0
- package/lib/v1/Tag/Tag.js +154 -0
- package/lib/v1/TextBox/TextBox.js +168 -0
- package/lib/v1/TextBoxIcon/TextBoxIcon.js +196 -0
- package/lib/v1/Textarea/Textarea.js +118 -0
- package/lib/v1/Tooltip/Tooltip.js +586 -0
- package/lib/v1/Typography/Typography.js +56 -0
- package/lib/v1/Typography/css/Typography.module.css +376 -0
- package/lib/v1/Typography/css/cssJSLogic.js +41 -0
- package/lib/v1/Typography/css/letterSpacingMap.js +20 -0
- package/lib/v1/Typography/props/defaultProps.js +15 -0
- package/lib/v1/Typography/props/propTypes.js +35 -0
- package/lib/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +90 -0
- package/lib/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +126 -0
- package/lib/v1/semantic/Button/Button.js +63 -0
- package/lib/v1/semantic/index.js +15 -0
- package/package.json +1 -1
- package/result.json +1 -1
|
@@ -0,0 +1,108 @@
|
|
|
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 _defaultProps = require("../../Switch/props/defaultProps");
|
|
11
|
+
|
|
12
|
+
var _propTypes = require("../../Switch/props/propTypes");
|
|
13
|
+
|
|
14
|
+
var _Layout = require("../Layout");
|
|
15
|
+
|
|
16
|
+
var _Label = _interopRequireDefault(require("../Label/Label"));
|
|
17
|
+
|
|
18
|
+
var _SwitchModule = _interopRequireDefault(require("../../Switch/Switch.module.css"));
|
|
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 Switch = function Switch(props) {
|
|
25
|
+
var id = props.id,
|
|
26
|
+
name = props.name,
|
|
27
|
+
value = props.value,
|
|
28
|
+
checked = props.checked,
|
|
29
|
+
disabled = props.disabled,
|
|
30
|
+
isReadOnly = props.isReadOnly,
|
|
31
|
+
size = props.size,
|
|
32
|
+
text = props.text,
|
|
33
|
+
labelSize = props.labelSize,
|
|
34
|
+
labelPalette = props.labelPalette,
|
|
35
|
+
title = props.title,
|
|
36
|
+
disableTitle = props.disableTitle,
|
|
37
|
+
dataId = props.dataId,
|
|
38
|
+
dataSelectorId = props.dataSelectorId,
|
|
39
|
+
customClass = props.customClass,
|
|
40
|
+
customProps = props.customProps;
|
|
41
|
+
|
|
42
|
+
function onChange(e) {
|
|
43
|
+
var onChange = props.onChange;
|
|
44
|
+
onChange && onChange(!checked, e);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
var _customProps$SwitchPr = customProps.SwitchProps,
|
|
48
|
+
SwitchProps = _customProps$SwitchPr === void 0 ? {} : _customProps$SwitchPr,
|
|
49
|
+
_customProps$LabelPro = customProps.LabelProps,
|
|
50
|
+
LabelProps = _customProps$LabelPro === void 0 ? {} : _customProps$LabelPro;
|
|
51
|
+
var _customClass$customSw = customClass.customSwitchWrap,
|
|
52
|
+
customSwitchWrap = _customClass$customSw === void 0 ? '' : _customClass$customSw,
|
|
53
|
+
_customClass$customSw2 = customClass.customSwitch,
|
|
54
|
+
customSwitch = _customClass$customSw2 === void 0 ? '' : _customClass$customSw2,
|
|
55
|
+
_customClass$customSw3 = customClass.customSwitchSize,
|
|
56
|
+
customSwitchSize = _customClass$customSw3 === void 0 ? '' : _customClass$customSw3,
|
|
57
|
+
_customClass$customLa = customClass.customLabel,
|
|
58
|
+
customLabel = _customClass$customLa === void 0 ? '' : _customClass$customLa;
|
|
59
|
+
size !== 'small' ? size = 'switch_medium' : size = 'switch_small';
|
|
60
|
+
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, _extends({
|
|
61
|
+
align: "vertical",
|
|
62
|
+
isCover: false,
|
|
63
|
+
alignBox: "row",
|
|
64
|
+
isInline: true,
|
|
65
|
+
className: "".concat(_SwitchModule["default"].container, " ").concat(customSwitchWrap, " ").concat(disabled ? _SwitchModule["default"].disabled : isReadOnly ? _SwitchModule["default"].readonly : _SwitchModule["default"].effect),
|
|
66
|
+
"data-title": disabled ? disableTitle : title,
|
|
67
|
+
"aria-checked": checked,
|
|
68
|
+
role: "switch",
|
|
69
|
+
tabIndex: isReadOnly || disabled ? '-1' : '0',
|
|
70
|
+
dataSelectorId: dataSelectorId
|
|
71
|
+
}, SwitchProps), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
72
|
+
className: "".concat(_SwitchModule["default"][size], " ").concat(customSwitchSize)
|
|
73
|
+
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
74
|
+
type: "checkbox",
|
|
75
|
+
id: id,
|
|
76
|
+
className: "".concat(_SwitchModule["default"].input, " ").concat(checked ? _SwitchModule["default"].checked : ''),
|
|
77
|
+
name: name,
|
|
78
|
+
value: value,
|
|
79
|
+
checked: checked,
|
|
80
|
+
disabled: disabled,
|
|
81
|
+
readOnly: isReadOnly,
|
|
82
|
+
onClick: !disabled || !isReadOnly ? onChange : null
|
|
83
|
+
}), /*#__PURE__*/_react["default"].createElement("label", {
|
|
84
|
+
htmlFor: id,
|
|
85
|
+
"data-id": dataId,
|
|
86
|
+
"data-test-id": dataId,
|
|
87
|
+
className: "".concat(_SwitchModule["default"].label, " ").concat(_SwitchModule["default"]["".concat(size, "Label")], " ").concat(customSwitch)
|
|
88
|
+
})), text && /*#__PURE__*/_react["default"].createElement(_Label["default"], _extends({
|
|
89
|
+
text: text,
|
|
90
|
+
palette: labelPalette,
|
|
91
|
+
id: id,
|
|
92
|
+
size: labelSize,
|
|
93
|
+
type: "subtitle",
|
|
94
|
+
onClick: !disabled || !isReadOnly ? onChange : null,
|
|
95
|
+
customClass: customLabel
|
|
96
|
+
}, LabelProps)));
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
Switch.defaultProps = _defaultProps.defaultProps;
|
|
100
|
+
Switch.propTypes = _propTypes.propTypes;
|
|
101
|
+
var _default = Switch; // if (__DOCS__) {
|
|
102
|
+
// Switch.docs = {
|
|
103
|
+
// componentGroup: 'Form Elements',
|
|
104
|
+
// folderName: 'Style Guide'
|
|
105
|
+
// };
|
|
106
|
+
// }
|
|
107
|
+
|
|
108
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,132 @@
|
|
|
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"] = Tab;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _defaultProps = require("../../Tab/props/defaultProps");
|
|
13
|
+
|
|
14
|
+
var _propTypes = require("../../Tab/props/propTypes");
|
|
15
|
+
|
|
16
|
+
var _Layout = require("../Layout");
|
|
17
|
+
|
|
18
|
+
var _Common = require("../../utils/Common");
|
|
19
|
+
|
|
20
|
+
var _TabModule = _interopRequireDefault(require("../../Tab/Tab.module.css"));
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
+
|
|
24
|
+
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); }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
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); }
|
|
29
|
+
|
|
30
|
+
var tabTypes = {
|
|
31
|
+
alpha: {
|
|
32
|
+
active: 'alphaActive',
|
|
33
|
+
tab: 'tabAlpha'
|
|
34
|
+
},
|
|
35
|
+
beta: {
|
|
36
|
+
active: 'betaActive',
|
|
37
|
+
tab: 'tabBeta'
|
|
38
|
+
},
|
|
39
|
+
delta: {
|
|
40
|
+
active: 'deltaActive',
|
|
41
|
+
tab: 'tabDelta'
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
function Tab(_ref) {
|
|
46
|
+
var id = _ref.id,
|
|
47
|
+
style = _ref.style,
|
|
48
|
+
text = _ref.text,
|
|
49
|
+
children = _ref.children,
|
|
50
|
+
className = _ref.className,
|
|
51
|
+
dataId = _ref.dataId,
|
|
52
|
+
dataSelectorId = _ref.dataSelectorId,
|
|
53
|
+
title = _ref.title,
|
|
54
|
+
titlePosition = _ref.titlePosition,
|
|
55
|
+
activeClass = _ref.activeClass,
|
|
56
|
+
href = _ref.href,
|
|
57
|
+
isLink = _ref.isLink,
|
|
58
|
+
isDisabled = _ref.isDisabled,
|
|
59
|
+
tourId = _ref.tourId,
|
|
60
|
+
onClick = _ref.onClick,
|
|
61
|
+
isActive = _ref.isActive,
|
|
62
|
+
getTabRef = _ref.getTabRef,
|
|
63
|
+
onSelect = _ref.onSelect,
|
|
64
|
+
type = _ref.type,
|
|
65
|
+
isAnimate = _ref.isAnimate,
|
|
66
|
+
needBorder = _ref.needBorder,
|
|
67
|
+
needAppearance = _ref.needAppearance,
|
|
68
|
+
align = _ref.align,
|
|
69
|
+
isVirtual = _ref.isVirtual,
|
|
70
|
+
customProps = _ref.customProps;
|
|
71
|
+
var clickListener = (0, _react.useCallback)(function (event) {
|
|
72
|
+
if (isLink && event && (event.metaKey || event.altKey || event.ctrlKey || event.shiftKey)) {
|
|
73
|
+
event && event.stopPropagation();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
event && event.preventDefault();
|
|
78
|
+
onSelect(id);
|
|
79
|
+
onClick && onClick(event);
|
|
80
|
+
}, [id, isLink, onSelect, onClick]);
|
|
81
|
+
var styleContent = (0, _react.useMemo)(function () {
|
|
82
|
+
return tabTypes[type] || {
|
|
83
|
+
active: 'active',
|
|
84
|
+
tab: 'tab'
|
|
85
|
+
};
|
|
86
|
+
}, [type]);
|
|
87
|
+
var getTab = (0, _react.useCallback)(function (ref) {
|
|
88
|
+
return getTabRef && getTabRef(id, ref, isVirtual);
|
|
89
|
+
}, [id, isVirtual]);
|
|
90
|
+
var activeWithAppearance = (0, _Common.cs)([_TabModule["default"][styleContent.active], needBorder && !isAnimate && _TabModule["default"]["".concat(styleContent.active, "_border")]]);
|
|
91
|
+
var activeClasses = (0, _Common.cs)([needAppearance && activeWithAppearance, activeClass]);
|
|
92
|
+
var inActiveClasses = needAppearance && (0, _Common.cs)([_TabModule["default"][styleContent.tab], tabTypes[type] && _TabModule["default"]["".concat("".concat(type, "Hover"))]]);
|
|
93
|
+
var tabClass = (0, _Common.cs)([_TabModule["default"].tab, align === 'vertical' ? _TabModule["default"].vertical : _TabModule["default"].horizontal, isDisabled && _TabModule["default"].disabled, needBorder && !isAnimate && needAppearance && _TabModule["default"].border, isActive ? activeClasses : inActiveClasses, className]);
|
|
94
|
+
return /*#__PURE__*/_react["default"].createElement(_Layout.Box, _extends({
|
|
95
|
+
tourId: tourId,
|
|
96
|
+
tagName: isLink ? 'a' : 'div',
|
|
97
|
+
className: tabClass,
|
|
98
|
+
dataId: "".concat(dataId, "_Tab"),
|
|
99
|
+
onClick: !isDisabled ? clickListener : undefined,
|
|
100
|
+
style: style,
|
|
101
|
+
eleRef: getTab,
|
|
102
|
+
"data-title": title,
|
|
103
|
+
"data-title-position": titlePosition,
|
|
104
|
+
adjust: true,
|
|
105
|
+
href: isLink ? href : undefined,
|
|
106
|
+
"data-key": id,
|
|
107
|
+
role: "link",
|
|
108
|
+
"aria-controls": id,
|
|
109
|
+
"aria-selected": isActive ? true : false,
|
|
110
|
+
tabIndex: isLink ? undefined : isActive && !isDisabled ? '0' : '0',
|
|
111
|
+
"aria-label": text ? text : null,
|
|
112
|
+
dataSelectorId: dataSelectorId
|
|
113
|
+
}, customProps), /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
114
|
+
alignBox: "row",
|
|
115
|
+
align: "both",
|
|
116
|
+
className: _TabModule["default"].textContainer
|
|
117
|
+
}, text && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
118
|
+
flexible: true,
|
|
119
|
+
adjust: true,
|
|
120
|
+
className: _TabModule["default"].tabText
|
|
121
|
+
}, text), children ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
122
|
+
shrink: true
|
|
123
|
+
}, children) : null));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
Tab.defaultProps = _defaultProps.Tab_defaultProps;
|
|
127
|
+
Tab.propTypes = _propTypes.Tab_propTypes; // if (__DOCS__) {
|
|
128
|
+
// Tab.docs = {
|
|
129
|
+
// componentGroup: 'Tab',
|
|
130
|
+
// folderName: 'Style Guide'
|
|
131
|
+
// };
|
|
132
|
+
// }
|
|
@@ -0,0 +1,42 @@
|
|
|
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 _defaultProps = require("../../Tab/props/defaultProps");
|
|
11
|
+
|
|
12
|
+
var _propTypes = require("../../Tab/props/propTypes");
|
|
13
|
+
|
|
14
|
+
var _Layout = require("../Layout");
|
|
15
|
+
|
|
16
|
+
var _TabContentModule = _interopRequireDefault(require("../../Tab/TabContent.module.css"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
+
|
|
20
|
+
/* eslint-disable react/forbid-component-props */
|
|
21
|
+
var TabContent = function TabContent(_ref) {
|
|
22
|
+
var children = _ref.children,
|
|
23
|
+
scroll = _ref.scroll,
|
|
24
|
+
dataId = _ref.dataId,
|
|
25
|
+
id = _ref.id,
|
|
26
|
+
dataSelectorId = _ref.dataSelectorId;
|
|
27
|
+
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
28
|
+
className: _TabContentModule["default"].container,
|
|
29
|
+
scroll: scroll,
|
|
30
|
+
dataId: "".concat(dataId, "_TabContent"),
|
|
31
|
+
isScrollAttribute: true,
|
|
32
|
+
"aria-labelledby": id,
|
|
33
|
+
tabindex: "-1",
|
|
34
|
+
role: "tabpanel",
|
|
35
|
+
dataSelectorId: dataSelectorId
|
|
36
|
+
}, children);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
TabContent.defaultProps = _defaultProps.TabContent_defaultProps;
|
|
40
|
+
TabContent.propTypes = _propTypes.TabContent_propTypes;
|
|
41
|
+
var _default = TabContent;
|
|
42
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,42 @@
|
|
|
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 _defaultProps = require("../../Tab/props/defaultProps");
|
|
11
|
+
|
|
12
|
+
var _propTypes = require("../../Tab/props/propTypes");
|
|
13
|
+
|
|
14
|
+
var _Layout = require("../Layout");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
+
|
|
18
|
+
/* eslint-disable react/forbid-component-props */
|
|
19
|
+
var TabContentWrapper = function TabContentWrapper(_ref) {
|
|
20
|
+
var style = _ref.style,
|
|
21
|
+
className = _ref.className,
|
|
22
|
+
children = _ref.children,
|
|
23
|
+
dataId = _ref.dataId,
|
|
24
|
+
selectedTab = _ref.selectedTab,
|
|
25
|
+
onScroll = _ref.onScroll,
|
|
26
|
+
dataSelectorId = _ref.dataSelectorId;
|
|
27
|
+
return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
28
|
+
flexible: true,
|
|
29
|
+
style: style,
|
|
30
|
+
dataId: dataId,
|
|
31
|
+
className: className,
|
|
32
|
+
onScroll: onScroll,
|
|
33
|
+
dataSelectorId: dataSelectorId
|
|
34
|
+
}, _react["default"].Children.map(children, function (child) {
|
|
35
|
+
return /*#__PURE__*/_react["default"].isValidElement(child) && child.props.id === selectedTab ? child : null;
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
TabContentWrapper.defaultProps = _defaultProps.TabContentWrapper_defaultProps;
|
|
40
|
+
TabContentWrapper.propTypes = _propTypes.TabContentWrapper_propTypes;
|
|
41
|
+
var _default = TabContentWrapper;
|
|
42
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,89 @@
|
|
|
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 _defaultProps = require("../../Tab/props/defaultProps");
|
|
13
|
+
|
|
14
|
+
var _propTypes = require("../../Tab/props/propTypes");
|
|
15
|
+
|
|
16
|
+
var _Layout = require("../Layout");
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
25
|
+
|
|
26
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
27
|
+
|
|
28
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
29
|
+
|
|
30
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
31
|
+
|
|
32
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
33
|
+
|
|
34
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
35
|
+
|
|
36
|
+
function TabWrapper(_ref) {
|
|
37
|
+
var defaultTab = _ref.defaultTab,
|
|
38
|
+
hookToDisableInternalState = _ref.hookToDisableInternalState,
|
|
39
|
+
onSelect = _ref.onSelect,
|
|
40
|
+
type = _ref.type,
|
|
41
|
+
isAnimate = _ref.isAnimate,
|
|
42
|
+
needTabBorder = _ref.needTabBorder,
|
|
43
|
+
needBorder = _ref.needBorder,
|
|
44
|
+
needPadding = _ref.needPadding,
|
|
45
|
+
needAppearance = _ref.needAppearance,
|
|
46
|
+
align = _ref.align,
|
|
47
|
+
dataId = _ref.dataId,
|
|
48
|
+
children = _ref.children,
|
|
49
|
+
dataSelectorId = _ref.dataSelectorId;
|
|
50
|
+
|
|
51
|
+
var _useState = (0, _react.useState)(!hookToDisableInternalState ? defaultTab || 0 : null),
|
|
52
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
+
selectedTabInternal = _useState2[0],
|
|
54
|
+
setSelected = _useState2[1];
|
|
55
|
+
|
|
56
|
+
var setSelectedTab = (0, _react.useCallback)(function (id) {
|
|
57
|
+
if (!hookToDisableInternalState) {
|
|
58
|
+
setSelected(id);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
onSelect && onSelect(id);
|
|
62
|
+
}, [hookToDisableInternalState, onSelect]);
|
|
63
|
+
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
64
|
+
alignBox: align === 'vertical' ? 'column' : 'row',
|
|
65
|
+
dataId: dataId,
|
|
66
|
+
dataSelectorId: dataSelectorId
|
|
67
|
+
}, _react["default"].Children.map(children, function (child) {
|
|
68
|
+
var TabsChild = child.type;
|
|
69
|
+
var selectedTab = hookToDisableInternalState ? defaultTab : selectedTabInternal;
|
|
70
|
+
return /*#__PURE__*/_react["default"].createElement(TabsChild // eslint-disable-next-line react/no-array-index-key
|
|
71
|
+
, _extends({}, child.props, {
|
|
72
|
+
selectedTab: selectedTab,
|
|
73
|
+
onSelect: setSelectedTab,
|
|
74
|
+
type: type,
|
|
75
|
+
isAnimate: isAnimate,
|
|
76
|
+
needTabBorder: needTabBorder,
|
|
77
|
+
needBorder: needBorder,
|
|
78
|
+
needPadding: needPadding,
|
|
79
|
+
needAppearance: needAppearance,
|
|
80
|
+
hookToDisableInternalState: hookToDisableInternalState,
|
|
81
|
+
align: align
|
|
82
|
+
}));
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
TabWrapper.propTypes = _propTypes.TabWrapper_propTypes;
|
|
87
|
+
TabWrapper.defaultProps = _defaultProps.TabWrapper_defaultProps;
|
|
88
|
+
var _default = TabWrapper;
|
|
89
|
+
exports["default"] = _default;
|