@zohodesk/components 1.0.0-temp-183 → 1.0.0-temp-185

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.
Files changed (107) hide show
  1. package/.DS_Store +0 -0
  2. package/.cli/PropLessFiles.html +1 -1
  3. package/.cli/propValidation_report.html +1 -1
  4. package/.cli/stringContains.js +1 -0
  5. package/README.md +6 -0
  6. package/assets/Appearance/dark/themes/blue/blue_CTA_DarkModifyCategory.module.css +15 -0
  7. package/assets/Appearance/dark/themes/blue/blue_CTA_DarkTheme.module.css +1 -0
  8. package/assets/Appearance/dark/themes/green/green_CTA_DarkModifyCategory.module.css +15 -0
  9. package/assets/Appearance/dark/themes/green/green_CTA_DarkTheme.module.css +1 -0
  10. package/assets/Appearance/dark/themes/orange/orange_CTA_DarkModifyCategory.module.css +15 -0
  11. package/assets/Appearance/dark/themes/orange/orange_CTA_DarkTheme.module.css +1 -0
  12. package/assets/Appearance/dark/themes/red/red_CTA_DarkModifyCategory.module.css +15 -0
  13. package/assets/Appearance/dark/themes/red/red_CTA_DarkTheme.module.css +1 -0
  14. package/assets/Appearance/dark/themes/yellow/yellow_CTA_DarkModifyCategory.module.css +15 -0
  15. package/assets/Appearance/dark/themes/yellow/yellow_CTA_DarkTheme.module.css +1 -0
  16. package/assets/Appearance/light/themes/blue/blue_CTA_LightModifyCategory.module.css +15 -0
  17. package/assets/Appearance/light/themes/blue/blue_CTA_LightTheme.module.css +1 -0
  18. package/assets/Appearance/light/themes/green/green_CTA_LightModifyCategory.module.css +15 -0
  19. package/assets/Appearance/light/themes/green/green_CTA_LightTheme.module.css +1 -0
  20. package/assets/Appearance/light/themes/orange/orange_CTA_LightModifyCategory.module.css +15 -0
  21. package/assets/Appearance/light/themes/orange/orange_CTA_LightTheme.module.css +1 -0
  22. package/assets/Appearance/light/themes/red/red_CTA_LightModifyCategory.module.css +15 -0
  23. package/assets/Appearance/light/themes/red/red_CTA_LightTheme.module.css +1 -0
  24. package/assets/Appearance/light/themes/yellow/yellow_CTA_LightModifyCategory.module.css +15 -0
  25. package/assets/Appearance/light/themes/yellow/yellow_CTA_LightTheme.module.css +1 -0
  26. package/assets/Appearance/pureDark/themes/blue/blue_CTA_PureDarkModifyCategory.module.css +15 -0
  27. package/assets/Appearance/pureDark/themes/blue/blue_CTA_PureDarkTheme.module.css +1 -0
  28. package/assets/Appearance/pureDark/themes/green/green_CTA_PureDarkModifyCategory.module.css +15 -0
  29. package/assets/Appearance/pureDark/themes/green/green_CTA_PureDarkTheme.module.css +1 -0
  30. package/assets/Appearance/pureDark/themes/orange/orange_CTA_PureDarkModifyCategory.module.css +15 -0
  31. package/assets/Appearance/pureDark/themes/orange/orange_CTA_PureDarkTheme.module.css +1 -0
  32. package/assets/Appearance/pureDark/themes/red/red_CTA_PureDarkModifyCategory.module.css +15 -0
  33. package/assets/Appearance/pureDark/themes/red/red_CTA_PureDarkTheme.module.css +1 -0
  34. package/assets/Appearance/pureDark/themes/yellow/yellow_CTA_PureDarkModifyCategory.module.css +15 -0
  35. package/assets/Appearance/pureDark/themes/yellow/yellow_CTA_PureDarkTheme.module.css +1 -0
  36. package/es/AvatarTeam/AvatarTeam.module.css +2 -0
  37. package/es/CheckBox/CheckBox.module.css +35 -6
  38. package/es/DropBox/DropBoxElement/DropBoxElement.js +2 -1
  39. package/es/Select/Select.js +10 -2
  40. package/es/Select/Select.module.css +26 -1
  41. package/es/Tab/TabContentWrapper.js +8 -4
  42. package/es/Tab/props/defaultProps.js +2 -1
  43. package/es/Tab/props/propTypes.js +3 -1
  44. package/es/Tag/Tag.module.css +75 -17
  45. package/es/TextBox/TextBox.js +7 -1
  46. package/es/TextBox/TextBox.module.css +41 -2
  47. package/es/TextBox/props/defaultProps.js +1 -0
  48. package/es/TextBox/props/propTypes.js +1 -0
  49. package/es/TextBoxIcon/TextBoxIcon.js +2 -0
  50. package/es/TextBoxIcon/props/defaultProps.js +1 -0
  51. package/es/TextBoxIcon/props/propTypes.js +1 -0
  52. package/es/Textarea/Textarea.module.css +31 -2
  53. package/es/Tooltip/Tooltip.js +4 -2
  54. package/es/Tooltip/Tooltip.module.css +0 -4
  55. package/es/common/customscroll.module.css +0 -10
  56. package/es/v1/Select/Select.js +10 -2
  57. package/es/v1/Tab/Tab.js +1 -3
  58. package/es/v1/Tab/TabContent.js +1 -1
  59. package/es/v1/Tab/Tabs.js +175 -262
  60. package/es/v1/Tab/v1Tab.module.css +100 -0
  61. package/es/v1/Tab/v1TabContent.module.css +4 -0
  62. package/es/v1/Tab/v1Tabs.module.css +137 -0
  63. package/es/v1/TextBox/TextBox.js +7 -2
  64. package/es/v1/TextBox/props/defaultProps.js +1 -0
  65. package/es/v1/TextBox/props/propTypes.js +1 -0
  66. package/es/v1/TextBoxIcon/TextBoxIcon.js +3 -1
  67. package/es/v1/TextBoxIcon/props/defaultProps.js +1 -0
  68. package/es/v1/TextBoxIcon/props/propTypes.js +1 -0
  69. package/es/v1/Tooltip/Tooltip.js +4 -2
  70. package/lib/AvatarTeam/AvatarTeam.module.css +2 -0
  71. package/lib/CheckBox/CheckBox.module.css +35 -6
  72. package/lib/DropBox/DropBoxElement/DropBoxElement.js +2 -1
  73. package/lib/Select/Select.js +11 -2
  74. package/lib/Select/Select.module.css +26 -1
  75. package/lib/Tab/TabContentWrapper.js +8 -4
  76. package/lib/Tab/props/defaultProps.js +2 -1
  77. package/lib/Tab/props/propTypes.js +3 -1
  78. package/lib/Tag/Tag.module.css +75 -17
  79. package/lib/TextBox/TextBox.js +9 -1
  80. package/lib/TextBox/TextBox.module.css +41 -2
  81. package/lib/TextBox/props/defaultProps.js +1 -0
  82. package/lib/TextBox/props/propTypes.js +1 -1
  83. package/lib/TextBoxIcon/TextBoxIcon.js +2 -0
  84. package/lib/TextBoxIcon/props/defaultProps.js +1 -0
  85. package/lib/TextBoxIcon/props/propTypes.js +1 -0
  86. package/lib/Textarea/Textarea.module.css +31 -2
  87. package/lib/Tooltip/Tooltip.js +4 -2
  88. package/lib/Tooltip/Tooltip.module.css +0 -4
  89. package/lib/common/customscroll.module.css +0 -10
  90. package/lib/v1/Select/Select.js +11 -2
  91. package/lib/v1/Tab/Tab.js +6 -6
  92. package/lib/v1/Tab/TabContent.js +2 -2
  93. package/lib/v1/Tab/Tabs.js +434 -530
  94. package/lib/v1/Tab/v1Tab.module.css +100 -0
  95. package/lib/v1/Tab/v1TabContent.module.css +4 -0
  96. package/lib/v1/Tab/v1Tabs.module.css +137 -0
  97. package/lib/v1/TextBox/TextBox.js +8 -2
  98. package/lib/v1/TextBox/props/defaultProps.js +1 -0
  99. package/lib/v1/TextBox/props/propTypes.js +1 -1
  100. package/lib/v1/TextBoxIcon/TextBoxIcon.js +3 -1
  101. package/lib/v1/TextBoxIcon/props/defaultProps.js +1 -0
  102. package/lib/v1/TextBoxIcon/props/propTypes.js +1 -0
  103. package/lib/v1/Tooltip/Tooltip.js +4 -2
  104. package/package.json +10 -9
  105. package/propValidationArg.json +2 -2
  106. package/result.json +1 -1
  107. /package/.cli/{AppearanceThemeValidationExcludeFiles.js → ThemeValidationExcludeFiles.js} +0 -0
@@ -5,7 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports["default"] = void 0;
8
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _useEffectCallOnlyAfterState = _interopRequireDefault(require("@zohodesk/hooks/es/utils/useEffectCallOnlyAfterState"));
9
10
  var _Tab = _interopRequireDefault(require("./Tab"));
10
11
  var _defaultProps = require("./props/defaultProps");
11
12
  var _propTypes = require("./props/propTypes");
@@ -14,584 +15,487 @@ var _Layout = require("../Layout");
14
15
  var _ResizeObserver = _interopRequireDefault(require("../Responsive/ResizeObserver"));
15
16
  var _ListItem = _interopRequireDefault(require("../ListItem/ListItem"));
16
17
  var _icons = require("@zohodesk/icons");
17
- var _TabsModule = _interopRequireDefault(require("../../Tab/Tabs.module.css"));
18
+ var _v1TabsModule = _interopRequireDefault(require("./v1Tabs.module.css"));
18
19
  var _Popup = _interopRequireDefault(require("../Popup/Popup"));
19
20
  var _ResponsiveDropBox = _interopRequireDefault(require("../ResponsiveDropBox/ResponsiveDropBox"));
20
21
  var _CustomResponsive = require("../Responsive/CustomResponsive");
21
22
  var _semanticButtonModule = _interopRequireDefault(require("../../semantic/Button/semanticButton.module.css"));
22
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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
+ 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; }
23
26
  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; }
24
27
  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; }
25
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); }
26
29
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
28
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
29
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
30
30
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
31
31
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
32
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
33
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
34
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
35
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
36
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
37
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
38
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
39
- var Tabs = /*#__PURE__*/function (_React$Component) {
40
- _inherits(Tabs, _React$Component);
41
- var _super = _createSuper(Tabs);
42
- function Tabs(props) {
43
- var _this;
44
- _classCallCheck(this, Tabs);
45
- _this = _super.call(this, props);
46
- _this.state = {
47
- totalDimension: null,
48
- tabDimensions: {},
49
- highlightInitialDimension: null,
50
- renderVirtualTabs: true,
51
- tabKeys: []
52
- };
53
- _Common.bind.apply(_assertThisInitialized(_this), ['moreTabSelect', 'onResize', 'onTabResize', 'getHighlightRef', 'getTabsRef', 'getTabRef', 'getHighlightDim', 'onSizeChange', 'onScroll', 'togglePopup', 'setMaxDim']);
54
- _this.tabsObserver = new _ResizeObserver["default"](_this.onResize);
55
- _this.tabObserver = {};
56
- return _this;
32
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
33
+ 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."); }
34
+ 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); }
35
+ 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; }
36
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
37
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
38
+ var Tabs = function Tabs(props) {
39
+ var _useState = (0, _react.useState)(null),
40
+ _useState2 = _slicedToArray(_useState, 2),
41
+ totalDimension = _useState2[0],
42
+ setTotalDimension = _useState2[1];
43
+ var _useState3 = (0, _react.useState)({}),
44
+ _useState4 = _slicedToArray(_useState3, 2),
45
+ tabDimensions = _useState4[0],
46
+ setTabDimensions = _useState4[1];
47
+ var highlightInitialDimension = (0, _react.useRef)(null);
48
+ var _useState5 = (0, _react.useState)(true),
49
+ _useState6 = _slicedToArray(_useState5, 2),
50
+ renderVirtualTabs = _useState6[0],
51
+ setRenderVirtualTabs = _useState6[1];
52
+ var _useState7 = (0, _react.useState)([]),
53
+ _useState8 = _slicedToArray(_useState7, 2),
54
+ tabKeys = _useState8[0],
55
+ setTabKeys = _useState8[1];
56
+ var tabsObserver = (0, _react.useRef)(new _ResizeObserver["default"](onResize));
57
+ var tabObserver = (0, _react.useRef)({});
58
+ var highlight = (0, _react.useRef)(null);
59
+ var tabsEle = (0, _react.useRef)(null);
60
+ var tabElement = (0, _react.useRef)({});
61
+ var style = props.style,
62
+ className = props.className,
63
+ dataId = props.dataId,
64
+ highlightClass = props.highlightClass,
65
+ type = props.type,
66
+ isAnimate = props.isAnimate,
67
+ needTabBorder = props.needTabBorder,
68
+ needBorder = props.needBorder,
69
+ needPadding = props.needPadding,
70
+ align = props.align,
71
+ boxPosition = props.boxPosition,
72
+ removeClose = props.removeClose,
73
+ togglePopup = props.togglePopup,
74
+ needAppearance = props.needAppearance,
75
+ children = props.children,
76
+ onSelect = props.onSelect,
77
+ onScroll = props.onScroll,
78
+ isResponsive = props.isResponsive,
79
+ maxTabsCount = props.maxTabsCount,
80
+ minTabsCount = props.minTabsCount,
81
+ childType = props.childType,
82
+ containerClass = props.containerClass,
83
+ dataSelectorId = props.dataSelectorId,
84
+ selectedTab = props.selectedTab;
85
+ function onTabResize(size, target) {
86
+ var newDim = Object.assign({}, tabDimensions);
87
+ var elemDim = (0, _Common.getTotalDimension)(target, align);
88
+ if (elemDim !== 0) {
89
+ newDim[target.dataset.key] = elemDim;
90
+ }
91
+ setTabDimensions(newDim);
57
92
  }
58
- _createClass(Tabs, [{
59
- key: "onTabResize",
60
- value: function onTabResize(size, target) {
61
- var align = this.props.align;
62
- var tabDimensions = this.state.tabDimensions;
63
- var newDim = Object.assign({}, tabDimensions);
64
- var elemDim = (0, _Common.getTotalDimension)(target, align);
65
- if (elemDim !== 0) {
66
- newDim[target.dataset.key] = elemDim;
93
+ (0, _react.useEffect)(function () {
94
+ var totalDimension = getTotalDimensionLocal();
95
+ var tabDimensions = getTabDimensions();
96
+ var tabKeys = [];
97
+ var restrictedKeys = ['state', 'props', 'refs', 'context'];
98
+ _react["default"].Children.toArray(children).forEach(function (child) {
99
+ if (child && child.props.id && child.type === childType) {
100
+ if (restrictedKeys.includes(child.props.id)) {
101
+ throw new Error('Restricted id name found in Tabs, Please avoid these names => ' + restrictedKeys.toString());
102
+ } else {
103
+ tabKeys.push(child.props.id);
104
+ }
67
105
  }
68
- this.setState({
69
- tabDimensions: newDim
70
- });
106
+ });
107
+ setTotalDimension(totalDimension);
108
+ setTabDimensions(tabDimensions);
109
+ setRenderVirtualTabs(false);
110
+ setTabKeys(tabKeys);
111
+ if (highlight.current) {
112
+ highlightInitialDimension.current = getHighlightDim();
113
+ moveHighlight();
114
+ }
115
+ return function () {
116
+ if (tabsObserver.current) {
117
+ tabsObserver.current.disconnect();
118
+ tabsObserver.current = null;
119
+ }
120
+ if (tabObserver.current) {
121
+ Object.keys(tabObserver.current).forEach(function (observer) {
122
+ tabObserver.current[observer] && tabObserver.current[observer].disconnect();
123
+ });
124
+ tabObserver.current = null;
125
+ }
126
+ };
127
+ }, []);
128
+ function setMaxDim() {
129
+ var totalDimension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
130
+ // let actual = Object.keys(tabDimensions).reduce(
131
+ // (sum, tab) => sum + (tabDimensions[tab] || 0),
132
+ // 0
133
+ // );
134
+ if (totalDimension && tabElement.current[selectedTab]) {
135
+ var newDim = "".concat((0, _Common.remConvert)(totalDimension), "rem");
136
+ align === 'vertical' ? tabElement.current[selectedTab].style.maxWidth = newDim : tabElement.current[selectedTab].style.maxHeight = newDim;
71
137
  }
72
- }, {
73
- key: "componentDidMount",
74
- value: function componentDidMount() {
75
- var _this2 = this;
76
- var _this$props = this.props,
77
- children = _this$props.children,
78
- childType = _this$props.childType;
79
- var totalDimension = this.getTotalDimension();
80
- var tabDimensions = this.getTabDimensions();
81
- var tabKeys = [];
82
- var restrictedKeys = ['state', 'props', 'refs', 'context'];
138
+ }
139
+ function getHighlightDim() {
140
+ return align === 'vertical' ? highlight.current.offsetLeft : highlight.current.offsetTop;
141
+ }
142
+ (0, _useEffectCallOnlyAfterState["default"])(function () {
143
+ if (children) {
144
+ /**
145
+ * To recalculate the dimensions of tabs we are checking the children length.
146
+ * and also checking the tab id and their order.
147
+ */
148
+
149
+ var newTabKeys = [];
83
150
  _react["default"].Children.toArray(children).forEach(function (child) {
84
151
  if (child && child.props.id && child.type === childType) {
85
- if (restrictedKeys.includes(child.props.id)) {
86
- throw new Error('Restricted id name found in Tabs, Please avoid these names => ' + restrictedKeys.toString());
87
- } else {
88
- tabKeys.push(child.props.id);
89
- }
152
+ newTabKeys.push(child.props.id);
90
153
  }
91
154
  });
92
- this.setState({
93
- totalDimension: totalDimension,
94
- tabDimensions: tabDimensions,
95
- renderVirtualTabs: false,
96
- tabKeys: tabKeys
155
+ var isSameTabKeys = newTabKeys.every(function (current, index) {
156
+ return tabKeys[index] === current;
97
157
  });
98
- this.highlight && this.setState({
99
- highlightInitialDimension: this.getHighlightDim()
100
- }, function () {
101
- _this2.moveHighlight();
102
- });
103
- }
104
- }, {
105
- key: "componentWillUnmount",
106
- value: function componentWillUnmount() {
107
- var _this3 = this;
108
- if (this.tabsObserver) {
109
- this.tabsObserver.disconnect();
110
- this.tabsObserver = null;
111
- }
112
- if (this.tabObserver) {
113
- Object.keys(this.tabObserver).forEach(function (observer) {
114
- _this3.tabObserver[observer] && _this3.tabObserver[observer].disconnect();
158
+ if (newTabKeys.length !== tabKeys.length || !isSameTabKeys) {
159
+ setRenderVirtualTabs(true);
160
+ setTabKeys(newTabKeys);
161
+ setTimeout(function () {
162
+ setTabDimensions(getTabDimensions());
163
+ setTotalDimension(getTotalDimensionLocal());
164
+ setRenderVirtualTabs(false);
115
165
  });
116
- this.tabObserver = null;
117
166
  }
118
- }
119
- }, {
120
- key: "setMaxDim",
121
- value: function setMaxDim() {
122
- var totalDimension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
123
- var selectedTab = this.props.selectedTab;
124
- // let actual = Object.keys(tabDimensions).reduce(
125
- // (sum, tab) => sum + (tabDimensions[tab] || 0),
126
- // 0
127
- // );
128
- if (totalDimension && this[selectedTab]) {
129
- var align = this.props.align;
130
- var newDim = "".concat((0, _Common.remConvert)(totalDimension), "rem");
131
- align === 'vertical' ? this[selectedTab].style.maxWidth = newDim : this[selectedTab].style.maxHeight = newDim;
167
+ if (newTabKeys.length === 1) {
168
+ moveHighlight();
132
169
  }
133
170
  }
134
- }, {
135
- key: "getHighlightDim",
136
- value: function getHighlightDim() {
137
- var align = this.props.align;
138
- return align === 'vertical' ? this.highlight.offsetLeft : this.highlight.offsetTop;
171
+ });
172
+ (0, _useEffectCallOnlyAfterState["default"])(function () {
173
+ tabsObserver.current && tabsObserver.current.replaceResizeHandler(onResize);
174
+ if (children) {
175
+ moveHighlight();
139
176
  }
140
- }, {
141
- key: "componentDidUpdate",
142
- value: function componentDidUpdate(prevProps) {
143
- var _this4 = this;
144
- var _this$props2 = this.props,
145
- children = _this$props2.children,
146
- selectedTab = _this$props2.selectedTab,
147
- childType = _this$props2.childType;
148
- var _this$state = this.state,
149
- tabDimensions = _this$state.tabDimensions,
150
- totalDimension = _this$state.totalDimension,
151
- tabKeys = _this$state.tabKeys;
152
- if (prevProps.children && children) {
153
- /**
154
- * To recalculate the dimensions of tabs we are checking the children length.
155
- * and also checking the tab id and their order.
156
- */
157
-
158
- var newTabKeys = [];
159
- _react["default"].Children.toArray(children).forEach(function (child) {
160
- if (child && child.props.id && child.type === childType) {
161
- newTabKeys.push(child.props.id);
162
- }
163
- });
164
- var isSameTabKeys = newTabKeys.every(function (current, index) {
165
- return tabKeys[index] === current;
166
- });
167
- if (newTabKeys.length !== tabKeys.length || !isSameTabKeys) {
168
- this.setState({
169
- renderVirtualTabs: true,
170
- tabKeys: newTabKeys
171
- }, function () {
172
- totalDimension = _this4.getTotalDimension();
173
- tabDimensions = _this4.getTabDimensions();
174
- _this4.setState({
175
- tabDimensions: tabDimensions,
176
- totalDimension: totalDimension,
177
- renderVirtualTabs: false
178
- });
179
- });
180
- }
181
- if (prevProps.selectedTab !== selectedTab || newTabKeys.length === 1) {
182
- this.moveHighlight();
177
+ }, [selectedTab]);
178
+ function moveHighlight() {
179
+ var node = highlight.current;
180
+ if (isAnimate && needTabBorder && node) {
181
+ var tabActive = tabElement.current[selectedTab];
182
+ if (tabActive) {
183
+ var position, dimension;
184
+ if (align === 'vertical') {
185
+ position = tabActive.offsetLeft;
186
+ dimension = tabActive.offsetWidth;
187
+ node.style.transform = "translateX(".concat((0, _Common.remConvert)(position - highlightInitialDimension.current), "rem)");
188
+ node.style.width = "".concat((0, _Common.remConvert)(dimension), "rem");
189
+ } else if (align === 'horizontal') {
190
+ position = tabActive.offsetTop;
191
+ dimension = tabActive.offsetHeight;
192
+ node.style.transform = "translateY(".concat((0, _Common.remConvert)(position - highlightInitialDimension.current), "rem)");
193
+ node.style.height = "".concat((0, _Common.remConvert)(dimension), "rem");
183
194
  }
184
195
  }
185
196
  }
186
- }, {
187
- key: "moveHighlight",
188
- value: function moveHighlight() {
189
- var _this$props3 = this.props,
190
- isAnimate = _this$props3.isAnimate,
191
- needTabBorder = _this$props3.needTabBorder,
192
- selectedTab = _this$props3.selectedTab,
193
- align = _this$props3.align;
194
- var highlightInitialDimension = this.state.highlightInitialDimension;
195
- var node = this.highlight;
196
- if (isAnimate && needTabBorder && node) {
197
- var tabActive = this[selectedTab];
198
- if (tabActive) {
199
- var position, dimension;
200
- if (align === 'vertical') {
201
- position = tabActive.offsetLeft;
202
- dimension = tabActive.offsetWidth;
203
- node.style.transform = "translateX(".concat((0, _Common.remConvert)(position - highlightInitialDimension), "rem)");
204
- node.style.width = "".concat((0, _Common.remConvert)(dimension), "rem");
205
- } else if (align === 'horizontal') {
206
- position = tabActive.offsetTop;
207
- dimension = tabActive.offsetHeight;
208
- node.style.transform = "translateY(".concat((0, _Common.remConvert)(position - highlightInitialDimension), "rem)");
209
- node.style.height = "".concat((0, _Common.remConvert)(dimension), "rem");
210
- }
211
- }
212
- }
197
+ }
198
+ var getHighlightRef = (0, _react.useCallback)(function (ele) {
199
+ highlight.current = ele;
200
+ }, []);
201
+ var getTabsRef = (0, _react.useCallback)(function (ele) {
202
+ tabsEle.current = ele;
203
+ if (ele) {
204
+ tabsObserver.current.observe(ele);
205
+ } else {
206
+ tabsObserver.current && tabsObserver.current.disconnect();
213
207
  }
214
- }, {
215
- key: "getHighlightRef",
216
- value: function getHighlightRef(ele) {
217
- this.highlight = ele;
208
+ }, []);
209
+ function onSizeChange() {
210
+ var totalDimension = getTotalDimensionLocal();
211
+ setTotalDimension(totalDimension);
212
+ if (highlight.current) {
213
+ highlightInitialDimension.current = getHighlightDim();
214
+ moveHighlight();
218
215
  }
219
- }, {
220
- key: "getTabsRef",
221
- value: function getTabsRef(ele) {
222
- this.tabsEle = ele;
223
- if (ele) {
224
- this.tabsObserver.observe(ele);
216
+ }
217
+ function onResize(timer) {
218
+ if (tabsEle.current && isResponsive) {
219
+ if (!timer) {
220
+ onSizeChange();
225
221
  } else {
226
- this.tabsObserver && this.tabsObserver.disconnect();
222
+ setTimeout(function () {
223
+ onSizeChange();
224
+ }, timer);
227
225
  }
228
226
  }
229
- }, {
230
- key: "onSizeChange",
231
- value: function onSizeChange() {
232
- var _this5 = this;
233
- var totalDimension = this.getTotalDimension();
234
- this.setState({
235
- totalDimension: totalDimension
236
- });
237
- this.highlight && this.setState({
238
- highlightInitialDimension: this.getHighlightDim()
239
- }, function () {
240
- _this5.moveHighlight();
227
+ }
228
+ function getTotalDimensionLocal() {
229
+ var totalDimension = tabsEle.current && (0, _Common.getTotalDimension)(tabsEle.current, align);
230
+ return totalDimension;
231
+ }
232
+ function getTabDimensions() {
233
+ var tabDimensions = {};
234
+ _react["default"].Children.forEach(children, function (child) {
235
+ return /*#__PURE__*/_react["default"].isValidElement(child) && child.type === childType && tabElement.current[child.props.id] && Object.assign(tabDimensions, _defineProperty({}, child.props.id, tabElement.current[child.props.id] && (0, _Common.getTotalDimension)(tabElement.current[child.props.id], align)));
236
+ });
237
+ return tabDimensions;
238
+ }
239
+ function responsiveTab(totalDimension, tabDimensions) {
240
+ var mainTabs = [],
241
+ moreTabs = [],
242
+ otherTabs = [];
243
+ if (totalDimension && isResponsive) {
244
+ var selectedTabDimension = tabDimensions[selectedTab] || 0;
245
+ var remainingDimension = totalDimension - selectedTabDimension;
246
+ var maxTabsTobeVisible = maxTabsCount - 1;
247
+ var minTabsToBeVisible = 1;
248
+ _react["default"].Children.forEach(children, function (child) {
249
+ if (child && child.type === childType && child.props.id) {
250
+ var elemDimension = tabDimensions[child.props.id];
251
+ var isMaxCountExceeded = maxTabsTobeVisible <= 0 ? true : false;
252
+ var isMinCountNotExceeded = minTabsToBeVisible < minTabsCount ? true : false;
253
+ if (child.props.id === selectedTab) {
254
+ mainTabs.push(child);
255
+ } else if (isMinCountNotExceeded) {
256
+ mainTabs.push(child);
257
+ remainingDimension -= tabDimensions[child.props.id];
258
+ minTabsToBeVisible++;
259
+ maxTabsTobeVisible--;
260
+ } else if (remainingDimension - elemDimension >= 20 && !moreTabs.length && !isMaxCountExceeded) {
261
+ mainTabs.push(child);
262
+ remainingDimension -= tabDimensions[child.props.id];
263
+ maxTabsTobeVisible--;
264
+ } else {
265
+ moreTabs.push(child);
266
+ }
267
+ } else if ( /*#__PURE__*/_react["default"].isValidElement(child)) {
268
+ otherTabs.push(child);
269
+ }
241
270
  });
242
- }
243
- }, {
244
- key: "onResize",
245
- value: function onResize(timer) {
246
- var _this6 = this;
247
- var isResponsive = this.props.isResponsive;
248
- if (this.tabsEle && isResponsive) {
249
- if (!timer) {
250
- this.onSizeChange();
271
+ if (selectedTabDimension > totalDimension) {
272
+ /* let { align } = this.props;
273
+ let newDim = `${remConvert(totalDimension)}rem`;
274
+ let newTabs;
275
+ if (align === 'vertical') {
276
+ newTabs = mainTabs.map(tab => React.cloneElement(tab, { style: { maxWidth: newDim } }));
251
277
  } else {
252
- setTimeout(function () {
253
- _this6.onSizeChange();
254
- }, timer);
278
+ newTabs = mainTabs.map(tab => React.cloneElement(tab, { style: { maxHeight: newDim } }));
255
279
  }
280
+ mainTabs = newTabs; */
281
+ setMaxDim(totalDimension);
256
282
  }
257
- }
258
- }, {
259
- key: "getTotalDimension",
260
- value: function getTotalDimension() {
261
- var align = this.props.align;
262
- var totalDimension = this.tabsEle && (0, _Common.getTotalDimension)(this.tabsEle, align);
263
- return totalDimension;
264
- }
265
- }, {
266
- key: "getTabDimensions",
267
- value: function getTabDimensions() {
268
- var _this7 = this;
269
- var _this$props4 = this.props,
270
- children = _this$props4.children,
271
- align = _this$props4.align,
272
- childType = _this$props4.childType;
273
- var tabDimensions = {};
283
+ } else if (!isResponsive) {
274
284
  _react["default"].Children.forEach(children, function (child) {
275
- return /*#__PURE__*/_react["default"].isValidElement(child) && child.type === childType && _this7[child.props.id] && Object.assign(tabDimensions, _defineProperty({}, child.props.id, _this7[child.props.id] && (0, _Common.getTotalDimension)(_this7[child.props.id], align)));
276
- });
277
- return tabDimensions;
278
- }
279
- }, {
280
- key: "responsiveTab",
281
- value: function responsiveTab(totalDimension, tabDimensions) {
282
- var _this$props5 = this.props,
283
- children = _this$props5.children,
284
- maxTabsCount = _this$props5.maxTabsCount,
285
- minTabsCount = _this$props5.minTabsCount,
286
- isResponsive = _this$props5.isResponsive;
287
- var mainTabs = [],
288
- moreTabs = [],
289
- otherTabs = [];
290
- if (totalDimension && isResponsive) {
291
- var _this$props6 = this.props,
292
- childType = _this$props6.childType,
293
- selectedTab = _this$props6.selectedTab;
294
- var selectedTabDimension = tabDimensions[selectedTab] || 0;
295
- var remainingDimension = totalDimension - selectedTabDimension;
296
- var maxTabsTobeVisible = maxTabsCount - 1;
297
- var minTabsToBeVisible = 1;
298
- _react["default"].Children.forEach(children, function (child) {
299
- if (child && child.type === childType && child.props.id) {
300
- var elemDimension = tabDimensions[child.props.id];
301
- var isMaxCountExceeded = maxTabsTobeVisible <= 0 ? true : false;
302
- var isMinCountNotExceeded = minTabsToBeVisible < minTabsCount ? true : false;
303
- if (child.props.id === selectedTab) {
304
- mainTabs.push(child);
305
- } else if (isMinCountNotExceeded) {
306
- mainTabs.push(child);
307
- remainingDimension -= tabDimensions[child.props.id];
308
- minTabsToBeVisible++;
309
- maxTabsTobeVisible--;
310
- } else if (remainingDimension - elemDimension >= 20 && !moreTabs.length && !isMaxCountExceeded) {
311
- mainTabs.push(child);
312
- remainingDimension -= tabDimensions[child.props.id];
313
- maxTabsTobeVisible--;
314
- } else {
315
- moreTabs.push(child);
316
- }
317
- } else if ( /*#__PURE__*/_react["default"].isValidElement(child)) {
318
- otherTabs.push(child);
319
- }
320
- });
321
- if (selectedTabDimension > totalDimension) {
322
- /* let { align } = this.props;
323
- let newDim = `${remConvert(totalDimension)}rem`;
324
- let newTabs;
325
- if (align === 'vertical') {
326
- newTabs = mainTabs.map(tab => React.cloneElement(tab, { style: { maxWidth: newDim } }));
327
- } else {
328
- newTabs = mainTabs.map(tab => React.cloneElement(tab, { style: { maxHeight: newDim } }));
329
- }
330
- mainTabs = newTabs; */
331
- this.setMaxDim(totalDimension);
285
+ if (child && child.type === childType && child.props.id) {
286
+ mainTabs.push(child);
287
+ } else {
288
+ otherTabs.push(child);
332
289
  }
333
- } else if (!isResponsive) {
334
- var _childType = this.props.childType;
335
- _react["default"].Children.forEach(children, function (child) {
336
- if (child && child.type === _childType && child.props.id) {
337
- mainTabs.push(child);
338
- } else {
339
- otherTabs.push(child);
340
- }
341
- });
342
- } else {
343
- moreTabs = children;
344
- }
345
- return {
346
- mainTabs: mainTabs,
347
- moreTabs: moreTabs,
348
- otherTabs: otherTabs
349
- };
290
+ });
291
+ } else {
292
+ moreTabs = children;
350
293
  }
351
- }, {
352
- key: "getTabRef",
353
- value: function getTabRef(refName, ele, isVirtual) {
354
- this[refName] = ele;
355
- var key = isVirtual ? "virtual_".concat(refName) : refName;
356
- if (ele) {
357
- this.tabObserver[key] = new _ResizeObserver["default"](this.onTabResize);
358
- this.tabObserver[key].observe(ele);
359
- } else {
360
- if (this.tabObserver && this.tabObserver[key]) {
361
- this.tabObserver[key].disconnect();
362
- }
363
- }
294
+ return {
295
+ mainTabs: mainTabs,
296
+ moreTabs: moreTabs,
297
+ otherTabs: otherTabs
298
+ };
299
+ }
300
+ function getTabRef(refName, ele, isVirtual) {
301
+ if (ele) {
302
+ tabElement.current[refName] = ele;
364
303
  }
365
- }, {
366
- key: "moreTabSelect",
367
- value: function moreTabSelect(tab, value, index, e) {
368
- var onSelect = this.props.onSelect;
369
- if (e && e.target && e.target.parentElement.tagName === 'A' && (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)) {
370
- (0, _Common.cancelBubblingEffect)(e);
371
- return;
304
+ // tabElement.current[refName] = ele
305
+ var key = isVirtual ? "virtual_".concat(refName) : refName;
306
+ if (ele) {
307
+ tabObserver.current[key] = new _ResizeObserver["default"](onTabResize);
308
+ tabObserver.current[key].observe(ele);
309
+ } else {
310
+ if (tabObserver.current && tabObserver.current[key]) {
311
+ tabObserver.current[key].disconnect();
372
312
  }
373
- e.preventDefault();
374
- onSelect(tab);
375
- }
376
- }, {
377
- key: "onScroll",
378
- value: function onScroll(e) {
379
- e.persist();
380
- var onScroll = this.props.onScroll;
381
- onScroll && (0, _Common.throttle)(onScroll, 100, e);
382
313
  }
383
- }, {
384
- key: "togglePopup",
385
- value: function togglePopup(e) {
386
- var _this$props7 = this.props,
387
- boxPosition = _this$props7.boxPosition,
388
- togglePopup = _this$props7.togglePopup,
389
- align = _this$props7.align,
390
- removeClose = _this$props7.removeClose;
391
- removeClose && removeClose(e);
392
- var popupPosition = align === 'vertical' ? 'bottomLeft' : 'rightTop';
393
- boxPosition = boxPosition ? boxPosition : popupPosition;
394
- togglePopup(e, boxPosition);
395
- }
396
- }, {
397
- key: "responsiveFunc",
398
- value: function responsiveFunc(_ref) {
399
- var mediaQueryOR = _ref.mediaQueryOR;
400
- return {
401
- tabletMode: mediaQueryOR([{
402
- maxWidth: 700
403
- }])
404
- };
314
+ }
315
+ function moreTabSelect(tab, value, index, e) {
316
+ if (e && e.target && e.target.parentElement.tagName === 'A' && (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)) {
317
+ (0, _Common.cancelBubblingEffect)(e);
318
+ return;
405
319
  }
406
- }, {
407
- key: "renderTabs",
408
- value: function renderTabs(mainTabs, moreTabs, isVirtual) {
409
- var _this8 = this;
410
- var _this$props8 = this.props,
411
- selectedTab = _this$props8.selectedTab,
412
- moreButtonClass = _this$props8.moreButtonClass,
413
- moreButtonActiveClass = _this$props8.moreButtonActiveClass,
414
- moreBoxClass = _this$props8.moreBoxClass,
415
- menuItemClass = _this$props8.menuItemClass,
416
- itemClass = _this$props8.itemClass,
417
- itemActiveClass = _this$props8.itemActiveClass,
418
- iconName = _this$props8.iconName,
419
- isPopupReady = _this$props8.isPopupReady,
420
- isPopupOpen = _this$props8.isPopupOpen,
421
- getContainerRef = _this$props8.getContainerRef,
422
- showTitleInMoreOptions = _this$props8.showTitleInMoreOptions,
423
- onSelect = _this$props8.onSelect,
424
- moreContainerClass = _this$props8.moreContainerClass,
425
- align = _this$props8.align,
426
- type = _this$props8.type,
427
- isAnimate = _this$props8.isAnimate,
428
- needTabBorder = _this$props8.needTabBorder,
429
- needAppearance = _this$props8.needAppearance,
430
- iconSize = _this$props8.iconSize,
431
- getTargetRef = _this$props8.getTargetRef,
432
- position = _this$props8.position,
433
- customProps = _this$props8.customProps,
434
- getCustomDropBoxHeaderPlaceHolder = _this$props8.getCustomDropBoxHeaderPlaceHolder,
435
- dataSelectorId = _this$props8.dataSelectorId;
436
- var _customProps$DropBoxP = customProps.DropBoxProps,
437
- DropBoxProps = _customProps$DropBoxP === void 0 ? {} : _customProps$DropBoxP,
438
- _customProps$ListItem = customProps.ListItemProps,
439
- ListItemProps = _customProps$ListItem === void 0 ? {} : _customProps$ListItem,
440
- _customProps$MoreButt = customProps.MoreButtonProps,
441
- MoreButtonProps = _customProps$MoreButt === void 0 ? {} : _customProps$MoreButt;
442
- var popupClass = align === 'vertical' ? _TabsModule["default"][position] ? _TabsModule["default"][position] : '' : '';
443
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _react["default"].Children.map(mainTabs, function (child) {
320
+ e.preventDefault();
321
+ onSelect(tab);
322
+ }
323
+ function onScrollLocal(e) {
324
+ e.persist();
325
+ onScroll && (0, _Common.throttle)(onScroll, 100, e);
326
+ }
327
+ function togglePopupLocal(e) {
328
+ removeClose && removeClose(e);
329
+ var popupPosition = align === 'vertical' ? 'bottomLeft' : 'rightTop';
330
+ boxPosition = boxPosition ? boxPosition : popupPosition;
331
+ togglePopup(e, boxPosition);
332
+ }
333
+ function responsiveFunc(_ref) {
334
+ var mediaQueryOR = _ref.mediaQueryOR;
335
+ return {
336
+ tabletMode: mediaQueryOR([{
337
+ maxWidth: 700
338
+ }])
339
+ };
340
+ }
341
+ function renderTabs(mainTabs, moreTabs, isVirtual) {
342
+ var moreButtonClass = props.moreButtonClass,
343
+ moreButtonActiveClass = props.moreButtonActiveClass,
344
+ moreBoxClass = props.moreBoxClass,
345
+ menuItemClass = props.menuItemClass,
346
+ itemClass = props.itemClass,
347
+ itemActiveClass = props.itemActiveClass,
348
+ iconName = props.iconName,
349
+ isPopupReady = props.isPopupReady,
350
+ isPopupOpen = props.isPopupOpen,
351
+ getContainerRef = props.getContainerRef,
352
+ showTitleInMoreOptions = props.showTitleInMoreOptions,
353
+ moreContainerClass = props.moreContainerClass,
354
+ align = props.align,
355
+ type = props.type,
356
+ isAnimate = props.isAnimate,
357
+ needTabBorder = props.needTabBorder,
358
+ needAppearance = props.needAppearance,
359
+ iconSize = props.iconSize,
360
+ getTargetRef = props.getTargetRef,
361
+ position = props.position,
362
+ customProps = props.customProps,
363
+ getCustomDropBoxHeaderPlaceHolder = props.getCustomDropBoxHeaderPlaceHolder;
364
+ var _customProps$DropBoxP = customProps.DropBoxProps,
365
+ DropBoxProps = _customProps$DropBoxP === void 0 ? {} : _customProps$DropBoxP,
366
+ _customProps$ListItem = customProps.ListItemProps,
367
+ ListItemProps = _customProps$ListItem === void 0 ? {} : _customProps$ListItem,
368
+ _customProps$MoreButt = customProps.MoreButtonProps,
369
+ MoreButtonProps = _customProps$MoreButt === void 0 ? {} : _customProps$MoreButt;
370
+ var popupClass = align === 'vertical' ? _v1TabsModule["default"][position] ? _v1TabsModule["default"][position] : '' : '';
371
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _react["default"].Children.map(mainTabs, function (child) {
372
+ if (!child) {
373
+ return null;
374
+ }
375
+ var MainTab = child.type;
376
+ var classProps = {};
377
+ if (itemActiveClass) {
378
+ classProps.activeClass = itemActiveClass;
379
+ }
380
+ if (itemClass) {
381
+ classProps.className = itemClass;
382
+ }
383
+ return /*#__PURE__*/_react["default"].isValidElement(child) && /*#__PURE__*/_react["default"].createElement(MainTab, _extends({}, child.props, {
384
+ key: child.props.id,
385
+ getTabRef: getTabRef,
386
+ onSelect: onSelect
387
+ // recalculateDimension={tabElement.current[recalculateDimension]}
388
+ ,
389
+ isActive: child.props.id === selectedTab,
390
+ type: type,
391
+ isAnimate: isAnimate,
392
+ needBorder: needTabBorder,
393
+ needAppearance: needAppearance,
394
+ align: align,
395
+ isVirtual: isVirtual
396
+ }, classProps));
397
+ }), _react["default"].Children.count(moreTabs) ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
398
+ className: "".concat(_v1TabsModule["default"].menu, " "),
399
+ dataSelectorId: "".concat(dataSelectorId, "_moreIcon")
400
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, _extends({
401
+ className: "".concat(_semanticButtonModule["default"].buttonReset, " ").concat(moreButtonClass, " ").concat(isPopupOpen ? moreButtonActiveClass : ''),
402
+ align: "both",
403
+ onClick: togglePopupLocal,
404
+ dataId: "moreTabs",
405
+ eleRef: getTargetRef
406
+ }, MoreButtonProps, {
407
+ "aria-label": "MoreTabs",
408
+ role: "link",
409
+ tagName: "button"
410
+ }), /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
411
+ name: iconName,
412
+ size: iconSize
413
+ })), isPopupOpen && /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
414
+ query: responsiveFunc,
415
+ responsiveId: "Helmet"
416
+ }, function (_ref2) {
417
+ var tabletMode = _ref2.tabletMode;
418
+ return /*#__PURE__*/_react["default"].createElement(_ResponsiveDropBox["default"], _extends({
419
+ isActive: isPopupReady,
420
+ isAnimate: true,
421
+ size: "medium",
422
+ customClass: {
423
+ customDropBoxWrap: "".concat(moreContainerClass, " ").concat(popupClass)
424
+ },
425
+ boxPosition: position,
426
+ getRef: getContainerRef,
427
+ isBoxPaddingNeed: true,
428
+ isArrow: false
429
+ }, DropBoxProps, {
430
+ isResponsivePadding: true,
431
+ needFocusScope: true,
432
+ onClose: togglePopupLocal
433
+ }), getCustomDropBoxHeaderPlaceHolder && getCustomDropBoxHeaderPlaceHolder(props), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
434
+ flexible: true,
435
+ shrink: true,
436
+ scroll: "vertical",
437
+ className: "".concat(tabletMode ? '' : _v1TabsModule["default"].menuBox, " ").concat(moreBoxClass),
438
+ onScroll: onScrollLocal
439
+ }, _react["default"].Children.map(moreTabs, function (child) {
444
440
  if (!child) {
445
441
  return null;
446
442
  }
447
- var MainTab = child.type;
448
- var classProps = {};
449
- if (itemActiveClass) {
450
- classProps.activeClass = itemActiveClass;
451
- }
452
- if (itemClass) {
453
- classProps.className = itemClass;
454
- }
455
- return /*#__PURE__*/_react["default"].isValidElement(child) && /*#__PURE__*/_react["default"].createElement(MainTab, _extends({}, child.props, {
456
- key: child.props.id,
457
- getTabRef: _this8.getTabRef,
458
- onSelect: onSelect,
459
- recalculateDimension: _this8.recalculateDimension,
460
- isActive: child.props.id === selectedTab,
461
- type: type,
462
- isAnimate: isAnimate,
463
- needBorder: needTabBorder,
464
- needAppearance: needAppearance,
465
- align: align,
466
- isVirtual: isVirtual
467
- }, classProps));
468
- }), _react["default"].Children.count(moreTabs) ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
469
- className: "".concat(_TabsModule["default"].menu, " "),
470
- dataSelectorId: "".concat(dataSelectorId, "_moreIcon")
471
- }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, _extends({
472
- className: "".concat(_semanticButtonModule["default"].buttonReset, " ").concat(moreButtonClass, " ").concat(isPopupOpen ? moreButtonActiveClass : ''),
473
- align: "both",
474
- onClick: this.togglePopup,
475
- dataId: "moreTabs",
476
- eleRef: getTargetRef
477
- }, MoreButtonProps, {
478
- "aria-label": "MoreTabs",
479
- role: "link",
480
- tagName: "button"
481
- }), /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
482
- name: iconName,
483
- size: iconSize
484
- })), isPopupOpen && /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
485
- query: this.responsiveFunc,
486
- responsiveId: "Helmet"
487
- }, function (_ref2) {
488
- var tabletMode = _ref2.tabletMode;
489
- return /*#__PURE__*/_react["default"].createElement(_ResponsiveDropBox["default"], _extends({
490
- isActive: isPopupReady,
491
- isAnimate: true,
492
- size: "medium",
443
+ var _child$props = child.props,
444
+ text = _child$props.text,
445
+ id = _child$props.id,
446
+ title = _child$props.title,
447
+ isLink = _child$props.isLink,
448
+ href = _child$props.href,
449
+ children = _child$props.children,
450
+ dataId = _child$props.dataId;
451
+ var value = text ? text : showTitleInMoreOptions ? title : null;
452
+ return /*#__PURE__*/_react["default"].isValidElement(child) && /*#__PURE__*/_react["default"].createElement(_ListItem["default"], _extends({
453
+ key: id,
454
+ value: value,
455
+ onClick: moreTabSelect,
456
+ id: id,
457
+ title: title || text,
458
+ isLink: isLink,
459
+ href: href,
460
+ autoHover: true,
493
461
  customClass: {
494
- customDropBoxWrap: "".concat(moreContainerClass, " ").concat(popupClass)
462
+ customListItem: menuItemClass
495
463
  },
496
- boxPosition: position,
497
- getRef: getContainerRef,
498
- isBoxPaddingNeed: true,
499
- isArrow: false
500
- }, DropBoxProps, {
501
- isResponsivePadding: true,
502
- needFocusScope: true,
503
- onClose: _this8.togglePopup
504
- }), getCustomDropBoxHeaderPlaceHolder && getCustomDropBoxHeaderPlaceHolder(_this8.props), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
505
- flexible: true,
506
- shrink: true,
507
- scroll: "vertical",
508
- className: "".concat(tabletMode ? '' : _TabsModule["default"].menuBox, " ").concat(moreBoxClass),
509
- onScroll: _this8.onScroll
510
- }, _react["default"].Children.map(moreTabs, function (child) {
511
- if (!child) {
512
- return null;
513
- }
514
- var _child$props = child.props,
515
- text = _child$props.text,
516
- id = _child$props.id,
517
- title = _child$props.title,
518
- isLink = _child$props.isLink,
519
- href = _child$props.href,
520
- children = _child$props.children,
521
- dataId = _child$props.dataId;
522
- var value = text ? text : showTitleInMoreOptions ? title : null;
523
- return /*#__PURE__*/_react["default"].isValidElement(child) && /*#__PURE__*/_react["default"].createElement(_ListItem["default"], _extends({
524
- key: id,
525
- value: value,
526
- onClick: _this8.moreTabSelect,
527
- id: id,
528
- title: title || text,
529
- isLink: isLink,
530
- href: href,
531
- autoHover: true,
532
- customClass: {
533
- customListItem: menuItemClass
534
- },
535
- target: "self",
536
- dataId: "".concat(dataId, "_Tab")
537
- }, ListItemProps), !showTitleInMoreOptions ? children : null);
538
- })));
539
- })) : null);
540
- }
541
- }, {
542
- key: "render",
543
- value: function render() {
544
- var _this$props9 = this.props,
545
- style = _this$props9.style,
546
- className = _this$props9.className,
547
- dataId = _this$props9.dataId,
548
- highlightClass = _this$props9.highlightClass,
549
- type = _this$props9.type,
550
- isAnimate = _this$props9.isAnimate,
551
- needTabBorder = _this$props9.needTabBorder,
552
- needBorder = _this$props9.needBorder,
553
- needPadding = _this$props9.needPadding,
554
- align = _this$props9.align,
555
- needAppearance = _this$props9.needAppearance,
556
- children = _this$props9.children,
557
- containerClass = _this$props9.containerClass,
558
- dataSelectorId = _this$props9.dataSelectorId;
559
- var _this$state2 = this.state,
560
- totalDimension = _this$state2.totalDimension,
561
- tabDimensions = _this$state2.tabDimensions,
562
- renderVirtualTabs = _this$state2.renderVirtualTabs;
563
- var _this$responsiveTab = this.responsiveTab(totalDimension, tabDimensions),
564
- mainTabs = _this$responsiveTab.mainTabs,
565
- moreTabs = _this$responsiveTab.moreTabs,
566
- otherTabs = _this$responsiveTab.otherTabs;
567
- var appearanceClass = (0, _Common.cs)([_TabsModule["default"][type], needBorder && _TabsModule["default"]["".concat(type, "_border")], needPadding && _TabsModule["default"]["".concat(type, "_padding")]]);
568
- var tabsClass = (0, _Common.cs)([_TabsModule["default"].tab, className, needAppearance && appearanceClass]);
569
- var hlClass = (0, _Common.cs)([_TabsModule["default"].highlight, highlightClass, isAnimate && _TabsModule["default"].lineAnimate]);
570
- return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
571
- className: containerClass,
572
- dataSelectorId: dataSelectorId
573
- }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
574
- alignBox: align === 'vertical' ? 'row' : 'column',
575
- className: tabsClass,
576
- style: style
577
- }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
578
- eleRef: this.getTabsRef,
579
- flexible: true
580
- }, renderVirtualTabs && /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
581
- alignBox: align === 'vertical' ? 'row' : 'column',
582
- className: _TabsModule["default"].hidden
583
- }, this.renderTabs(children, [], true)), /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
584
- alignBox: align === 'vertical' ? 'row' : 'column'
585
- }, this.renderTabs(mainTabs, moreTabs, false))), otherTabs.length ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, null, otherTabs) : null, isAnimate && needTabBorder && needAppearance && /*#__PURE__*/_react["default"].createElement("div", {
586
- className: hlClass,
587
- ref: this.getHighlightRef,
588
- "data-id": dataId,
589
- "data-test-id": dataId
464
+ target: "self",
465
+ dataId: "".concat(dataId, "_Tab")
466
+ }, ListItemProps), !showTitleInMoreOptions ? children : null);
590
467
  })));
591
- }
592
- }]);
593
- return Tabs;
594
- }(_react["default"].Component);
468
+ })) : null);
469
+ }
470
+ var _responsiveTab = responsiveTab(totalDimension, tabDimensions),
471
+ mainTabs = _responsiveTab.mainTabs,
472
+ moreTabs = _responsiveTab.moreTabs,
473
+ otherTabs = _responsiveTab.otherTabs;
474
+ var appearanceClass = (0, _Common.cs)([_v1TabsModule["default"][type], needBorder && _v1TabsModule["default"]["".concat(type, "_border")], needPadding && _v1TabsModule["default"]["".concat(type, "_padding")]]);
475
+ var tabsClass = (0, _Common.cs)([_v1TabsModule["default"].tab, className, needAppearance && appearanceClass]);
476
+ var hlClass = (0, _Common.cs)([_v1TabsModule["default"].highlight, highlightClass, isAnimate && _v1TabsModule["default"].lineAnimate]);
477
+ return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
478
+ className: containerClass,
479
+ dataSelectorId: dataSelectorId
480
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
481
+ alignBox: align === 'vertical' ? 'row' : 'column',
482
+ className: tabsClass,
483
+ style: style
484
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
485
+ eleRef: getTabsRef,
486
+ flexible: true
487
+ }, renderVirtualTabs && /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
488
+ alignBox: align === 'vertical' ? 'row' : 'column',
489
+ className: _v1TabsModule["default"].hidden
490
+ }, renderTabs(children, [], true)), /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
491
+ alignBox: align === 'vertical' ? 'row' : 'column'
492
+ }, renderTabs(mainTabs, moreTabs, false))), otherTabs.length ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, null, otherTabs) : null, isAnimate && needTabBorder && needAppearance && /*#__PURE__*/_react["default"].createElement("div", {
493
+ className: hlClass,
494
+ ref: getHighlightRef,
495
+ "data-id": dataId,
496
+ "data-test-id": dataId
497
+ })));
498
+ };
595
499
  Tabs.propTypes = _propTypes.Tabs_propTypes;
596
500
  Tabs.defaultProps = _objectSpread(_objectSpread({}, _defaultProps.Tabs_defaultProps), {}, {
597
501
  childType: _Tab["default"]