@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
package/es/v1/Tab/Tabs.js CHANGED
@@ -1,63 +1,67 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- /* eslint-disable react/forbid-component-props */
3
- /* eslint css-modules/no-unused-class: [2, {
4
- markAsUsed: [
5
- 'hidden','alpha','gamma','beta','delta','special','text','maxWidth','widgetList','menuContainer','border','tabText','block','tabAlpha','alphaActive','gammaActive','betaActive','deltaActive','tabGamma','tabBeta','tabDelta','specialActive','tabSpecial',
6
- 'alpha_padding','alpha_border','gamma_padding','gamma_border','beta_padding','beta_border','delta_padding','delta_border','textContainer','disabled','alphaActive_border','gammaActive_border','betaActive_border','deltaActive_border'
7
- ]
8
- }]
9
- */
10
- import React from 'react';
2
+ import React, { useState, useRef, useEffect, useCallback } from 'react';
3
+ import useEffectCallOnlyAfterState from '@zohodesk/hooks/es/utils/useEffectCallOnlyAfterState';
11
4
  import Tab from './Tab';
12
5
  import { Tabs_defaultProps } from './props/defaultProps';
13
6
  import { Tabs_propTypes } from './props/propTypes';
14
- import { remConvert, getTotalDimension, cs, bind, throttle, cancelBubblingEffect } from '../../utils/Common';
7
+ import { remConvert, getTotalDimension, cs, throttle, cancelBubblingEffect } from '../../utils/Common';
15
8
  import { Box, Container } from '../Layout';
16
9
  import ResizeObserver from '../Responsive/ResizeObserver';
17
10
  import ListItem from '../ListItem/ListItem';
18
11
  import { Icon } from '@zohodesk/icons';
19
- import tabsStyle from '../../Tab/Tabs.module.css';
12
+ import tabsStyle from './v1Tabs.module.css';
20
13
  import Popup from '../Popup/Popup';
21
14
  import ResponsiveDropBox from '../ResponsiveDropBox/ResponsiveDropBox';
22
15
  import { ResponsiveReceiver } from '../Responsive/CustomResponsive';
23
16
  import btnstyle from '../../semantic/Button/semanticButton.module.css';
24
- class Tabs extends React.Component {
25
- constructor(props) {
26
- super(props);
27
- this.state = {
28
- totalDimension: null,
29
- tabDimensions: {},
30
- highlightInitialDimension: null,
31
- renderVirtualTabs: true,
32
- tabKeys: []
33
- };
34
- bind.apply(this, ['moreTabSelect', 'onResize', 'onTabResize', 'getHighlightRef', 'getTabsRef', 'getTabRef', 'getHighlightDim', 'onSizeChange', 'onScroll', 'togglePopup', 'setMaxDim']);
35
- this.tabsObserver = new ResizeObserver(this.onResize);
36
- this.tabObserver = {};
37
- }
38
- onTabResize(size, target) {
39
- let {
40
- align
41
- } = this.props;
42
- let {
43
- tabDimensions
44
- } = this.state;
17
+ const Tabs = props => {
18
+ const [totalDimension, setTotalDimension] = useState(null);
19
+ const [tabDimensions, setTabDimensions] = useState({});
20
+ const highlightInitialDimension = useRef(null);
21
+ const [renderVirtualTabs, setRenderVirtualTabs] = useState(true);
22
+ const [tabKeys, setTabKeys] = useState([]);
23
+ const tabsObserver = useRef(new ResizeObserver(onResize));
24
+ const tabObserver = useRef({});
25
+ const highlight = useRef(null);
26
+ const tabsEle = useRef(null);
27
+ const tabElement = useRef({});
28
+ let {
29
+ style,
30
+ className,
31
+ dataId,
32
+ highlightClass,
33
+ type,
34
+ isAnimate,
35
+ needTabBorder,
36
+ needBorder,
37
+ needPadding,
38
+ align,
39
+ boxPosition,
40
+ removeClose,
41
+ togglePopup,
42
+ needAppearance,
43
+ children,
44
+ onSelect,
45
+ onScroll,
46
+ isResponsive,
47
+ maxTabsCount,
48
+ minTabsCount,
49
+ childType,
50
+ containerClass,
51
+ dataSelectorId,
52
+ selectedTab
53
+ } = props;
54
+ function onTabResize(size, target) {
45
55
  let newDim = Object.assign({}, tabDimensions);
46
56
  let elemDim = getTotalDimension(target, align);
47
57
  if (elemDim !== 0) {
48
58
  newDim[target.dataset.key] = elemDim;
49
59
  }
50
- this.setState({
51
- tabDimensions: newDim
52
- });
60
+ setTabDimensions(newDim);
53
61
  }
54
- componentDidMount() {
55
- let {
56
- children,
57
- childType
58
- } = this.props;
59
- let totalDimension = this.getTotalDimension();
60
- let tabDimensions = this.getTabDimensions();
62
+ useEffect(() => {
63
+ let totalDimension = getTotalDimensionLocal();
64
+ let tabDimensions = getTabDimensions();
61
65
  let tabKeys = [];
62
66
  let restrictedKeys = ['state', 'props', 'refs', 'context'];
63
67
  React.Children.toArray(children).forEach(child => {
@@ -69,65 +73,43 @@ class Tabs extends React.Component {
69
73
  }
70
74
  }
71
75
  });
72
- this.setState({
73
- totalDimension,
74
- tabDimensions,
75
- renderVirtualTabs: false,
76
- tabKeys
77
- });
78
- this.highlight && this.setState({
79
- highlightInitialDimension: this.getHighlightDim()
80
- }, () => {
81
- this.moveHighlight();
82
- });
83
- }
84
- componentWillUnmount() {
85
- if (this.tabsObserver) {
86
- this.tabsObserver.disconnect();
87
- this.tabsObserver = null;
88
- }
89
- if (this.tabObserver) {
90
- Object.keys(this.tabObserver).forEach(observer => {
91
- this.tabObserver[observer] && this.tabObserver[observer].disconnect();
92
- });
93
- this.tabObserver = null;
76
+ setTotalDimension(totalDimension);
77
+ setTabDimensions(tabDimensions);
78
+ setRenderVirtualTabs(false);
79
+ setTabKeys(tabKeys);
80
+ if (highlight.current) {
81
+ highlightInitialDimension.current = getHighlightDim();
82
+ moveHighlight();
94
83
  }
95
- }
96
- setMaxDim() {
84
+ return () => {
85
+ if (tabsObserver.current) {
86
+ tabsObserver.current.disconnect();
87
+ tabsObserver.current = null;
88
+ }
89
+ if (tabObserver.current) {
90
+ Object.keys(tabObserver.current).forEach(observer => {
91
+ tabObserver.current[observer] && tabObserver.current[observer].disconnect();
92
+ });
93
+ tabObserver.current = null;
94
+ }
95
+ };
96
+ }, []);
97
+ function setMaxDim() {
97
98
  let totalDimension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
98
- let {
99
- selectedTab
100
- } = this.props;
101
99
  // let actual = Object.keys(tabDimensions).reduce(
102
100
  // (sum, tab) => sum + (tabDimensions[tab] || 0),
103
101
  // 0
104
102
  // );
105
- if (totalDimension && this[selectedTab]) {
106
- let {
107
- align
108
- } = this.props;
103
+ if (totalDimension && tabElement.current[selectedTab]) {
109
104
  let newDim = `${remConvert(totalDimension)}rem`;
110
- align === 'vertical' ? this[selectedTab].style.maxWidth = newDim : this[selectedTab].style.maxHeight = newDim;
105
+ align === 'vertical' ? tabElement.current[selectedTab].style.maxWidth = newDim : tabElement.current[selectedTab].style.maxHeight = newDim;
111
106
  }
112
107
  }
113
- getHighlightDim() {
114
- let {
115
- align
116
- } = this.props;
117
- return align === 'vertical' ? this.highlight.offsetLeft : this.highlight.offsetTop;
108
+ function getHighlightDim() {
109
+ return align === 'vertical' ? highlight.current.offsetLeft : highlight.current.offsetTop;
118
110
  }
119
- componentDidUpdate(prevProps) {
120
- let {
121
- children,
122
- selectedTab,
123
- childType
124
- } = this.props;
125
- let {
126
- tabDimensions,
127
- totalDimension,
128
- tabKeys
129
- } = this.state;
130
- if (prevProps.children && children) {
111
+ useEffectCallOnlyAfterState(() => {
112
+ if (children) {
131
113
  /**
132
114
  * To recalculate the dimensions of tabs we are checking the children length.
133
115
  * and also checking the tab id and their order.
@@ -141,123 +123,91 @@ class Tabs extends React.Component {
141
123
  });
142
124
  let isSameTabKeys = newTabKeys.every((current, index) => tabKeys[index] === current);
143
125
  if (newTabKeys.length !== tabKeys.length || !isSameTabKeys) {
144
- this.setState({
145
- renderVirtualTabs: true,
146
- tabKeys: newTabKeys
147
- }, () => {
148
- totalDimension = this.getTotalDimension();
149
- tabDimensions = this.getTabDimensions();
150
- this.setState({
151
- tabDimensions,
152
- totalDimension,
153
- renderVirtualTabs: false
154
- });
126
+ setRenderVirtualTabs(true);
127
+ setTabKeys(newTabKeys);
128
+ setTimeout(() => {
129
+ setTabDimensions(getTabDimensions());
130
+ setTotalDimension(getTotalDimensionLocal());
131
+ setRenderVirtualTabs(false);
155
132
  });
156
133
  }
157
- if (prevProps.selectedTab !== selectedTab || newTabKeys.length === 1) {
158
- this.moveHighlight();
134
+ if (newTabKeys.length === 1) {
135
+ moveHighlight();
159
136
  }
160
137
  }
161
- }
162
- moveHighlight() {
163
- let {
164
- isAnimate,
165
- needTabBorder,
166
- selectedTab,
167
- align
168
- } = this.props;
169
- let {
170
- highlightInitialDimension
171
- } = this.state;
172
- let node = this.highlight;
138
+ });
139
+ useEffectCallOnlyAfterState(() => {
140
+ tabsObserver.current && tabsObserver.current.replaceResizeHandler(onResize);
141
+ if (children) {
142
+ moveHighlight();
143
+ }
144
+ }, [selectedTab]);
145
+ function moveHighlight() {
146
+ let node = highlight.current;
173
147
  if (isAnimate && needTabBorder && node) {
174
- let tabActive = this[selectedTab];
148
+ let tabActive = tabElement.current[selectedTab];
175
149
  if (tabActive) {
176
150
  let position, dimension;
177
151
  if (align === 'vertical') {
178
152
  position = tabActive.offsetLeft;
179
153
  dimension = tabActive.offsetWidth;
180
- node.style.transform = `translateX(${remConvert(position - highlightInitialDimension)}rem)`;
154
+ node.style.transform = `translateX(${remConvert(position - highlightInitialDimension.current)}rem)`;
181
155
  node.style.width = `${remConvert(dimension)}rem`;
182
156
  } else if (align === 'horizontal') {
183
157
  position = tabActive.offsetTop;
184
158
  dimension = tabActive.offsetHeight;
185
- node.style.transform = `translateY(${remConvert(position - highlightInitialDimension)}rem)`;
159
+ node.style.transform = `translateY(${remConvert(position - highlightInitialDimension.current)}rem)`;
186
160
  node.style.height = `${remConvert(dimension)}rem`;
187
161
  }
188
162
  }
189
163
  }
190
164
  }
191
- getHighlightRef(ele) {
192
- this.highlight = ele;
193
- }
194
- getTabsRef(ele) {
195
- this.tabsEle = ele;
165
+ const getHighlightRef = useCallback(ele => {
166
+ highlight.current = ele;
167
+ }, []);
168
+ const getTabsRef = useCallback(ele => {
169
+ tabsEle.current = ele;
196
170
  if (ele) {
197
- this.tabsObserver.observe(ele);
171
+ tabsObserver.current.observe(ele);
198
172
  } else {
199
- this.tabsObserver && this.tabsObserver.disconnect();
173
+ tabsObserver.current && tabsObserver.current.disconnect();
174
+ }
175
+ }, []);
176
+ function onSizeChange() {
177
+ let totalDimension = getTotalDimensionLocal();
178
+ setTotalDimension(totalDimension);
179
+ if (highlight.current) {
180
+ highlightInitialDimension.current = getHighlightDim();
181
+ moveHighlight();
200
182
  }
201
183
  }
202
- onSizeChange() {
203
- let totalDimension = this.getTotalDimension();
204
- this.setState({
205
- totalDimension
206
- });
207
- this.highlight && this.setState({
208
- highlightInitialDimension: this.getHighlightDim()
209
- }, () => {
210
- this.moveHighlight();
211
- });
212
- }
213
- onResize(timer) {
214
- let {
215
- isResponsive
216
- } = this.props;
217
- if (this.tabsEle && isResponsive) {
184
+ function onResize(timer) {
185
+ if (tabsEle.current && isResponsive) {
218
186
  if (!timer) {
219
- this.onSizeChange();
187
+ onSizeChange();
220
188
  } else {
221
189
  setTimeout(() => {
222
- this.onSizeChange();
190
+ onSizeChange();
223
191
  }, timer);
224
192
  }
225
193
  }
226
194
  }
227
- getTotalDimension() {
228
- let {
229
- align
230
- } = this.props;
231
- let totalDimension = this.tabsEle && getTotalDimension(this.tabsEle, align);
195
+ function getTotalDimensionLocal() {
196
+ let totalDimension = tabsEle.current && getTotalDimension(tabsEle.current, align);
232
197
  return totalDimension;
233
198
  }
234
- getTabDimensions() {
235
- let {
236
- children,
237
- align,
238
- childType
239
- } = this.props;
199
+ function getTabDimensions() {
240
200
  let tabDimensions = {};
241
- React.Children.forEach(children, child => /*#__PURE__*/React.isValidElement(child) && child.type === childType && this[child.props.id] && Object.assign(tabDimensions, {
242
- [child.props.id]: this[child.props.id] && getTotalDimension(this[child.props.id], align)
201
+ React.Children.forEach(children, child => /*#__PURE__*/React.isValidElement(child) && child.type === childType && tabElement.current[child.props.id] && Object.assign(tabDimensions, {
202
+ [child.props.id]: tabElement.current[child.props.id] && getTotalDimension(tabElement.current[child.props.id], align)
243
203
  }));
244
204
  return tabDimensions;
245
205
  }
246
- responsiveTab(totalDimension, tabDimensions) {
247
- let {
248
- children,
249
- maxTabsCount,
250
- minTabsCount,
251
- isResponsive
252
- } = this.props;
206
+ function responsiveTab(totalDimension, tabDimensions) {
253
207
  let mainTabs = [],
254
208
  moreTabs = [],
255
209
  otherTabs = [];
256
210
  if (totalDimension && isResponsive) {
257
- let {
258
- childType,
259
- selectedTab
260
- } = this.props;
261
211
  let selectedTabDimension = tabDimensions[selectedTab] || 0;
262
212
  let remainingDimension = totalDimension - selectedTabDimension;
263
213
  let maxTabsTobeVisible = maxTabsCount - 1;
@@ -295,12 +245,9 @@ class Tabs extends React.Component {
295
245
  newTabs = mainTabs.map(tab => React.cloneElement(tab, { style: { maxHeight: newDim } }));
296
246
  }
297
247
  mainTabs = newTabs; */
298
- this.setMaxDim(totalDimension);
248
+ setMaxDim(totalDimension);
299
249
  }
300
250
  } else if (!isResponsive) {
301
- let {
302
- childType
303
- } = this.props;
304
251
  React.Children.forEach(children, child => {
305
252
  if (child && child.type === childType && child.props.id) {
306
253
  mainTabs.push(child);
@@ -317,22 +264,22 @@ class Tabs extends React.Component {
317
264
  otherTabs
318
265
  };
319
266
  }
320
- getTabRef(refName, ele, isVirtual) {
321
- this[refName] = ele;
267
+ function getTabRef(refName, ele, isVirtual) {
268
+ if (ele) {
269
+ tabElement.current[refName] = ele;
270
+ }
271
+ // tabElement.current[refName] = ele
322
272
  let key = isVirtual ? `virtual_${refName}` : refName;
323
273
  if (ele) {
324
- this.tabObserver[key] = new ResizeObserver(this.onTabResize);
325
- this.tabObserver[key].observe(ele);
274
+ tabObserver.current[key] = new ResizeObserver(onTabResize);
275
+ tabObserver.current[key].observe(ele);
326
276
  } else {
327
- if (this.tabObserver && this.tabObserver[key]) {
328
- this.tabObserver[key].disconnect();
277
+ if (tabObserver.current && tabObserver.current[key]) {
278
+ tabObserver.current[key].disconnect();
329
279
  }
330
280
  }
331
281
  }
332
- moreTabSelect(tab, value, index, e) {
333
- let {
334
- onSelect
335
- } = this.props;
282
+ function moreTabSelect(tab, value, index, e) {
336
283
  if (e && e.target && e.target.parentElement.tagName === 'A' && (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)) {
337
284
  cancelBubblingEffect(e);
338
285
  return;
@@ -340,26 +287,17 @@ class Tabs extends React.Component {
340
287
  e.preventDefault();
341
288
  onSelect(tab);
342
289
  }
343
- onScroll(e) {
290
+ function onScrollLocal(e) {
344
291
  e.persist();
345
- let {
346
- onScroll
347
- } = this.props;
348
292
  onScroll && throttle(onScroll, 100, e);
349
293
  }
350
- togglePopup(e) {
351
- let {
352
- boxPosition,
353
- togglePopup,
354
- align,
355
- removeClose
356
- } = this.props;
294
+ function togglePopupLocal(e) {
357
295
  removeClose && removeClose(e);
358
296
  let popupPosition = align === 'vertical' ? 'bottomLeft' : 'rightTop';
359
297
  boxPosition = boxPosition ? boxPosition : popupPosition;
360
298
  togglePopup(e, boxPosition);
361
299
  }
362
- responsiveFunc(_ref) {
300
+ function responsiveFunc(_ref) {
363
301
  let {
364
302
  mediaQueryOR
365
303
  } = _ref;
@@ -369,9 +307,8 @@ class Tabs extends React.Component {
369
307
  }])
370
308
  };
371
309
  }
372
- renderTabs(mainTabs, moreTabs, isVirtual) {
310
+ function renderTabs(mainTabs, moreTabs, isVirtual) {
373
311
  let {
374
- selectedTab,
375
312
  moreButtonClass,
376
313
  moreButtonActiveClass,
377
314
  moreBoxClass,
@@ -383,7 +320,6 @@ class Tabs extends React.Component {
383
320
  isPopupOpen,
384
321
  getContainerRef,
385
322
  showTitleInMoreOptions,
386
- onSelect,
387
323
  moreContainerClass,
388
324
  align,
389
325
  type,
@@ -394,9 +330,8 @@ class Tabs extends React.Component {
394
330
  getTargetRef,
395
331
  position,
396
332
  customProps,
397
- getCustomDropBoxHeaderPlaceHolder,
398
- dataSelectorId
399
- } = this.props;
333
+ getCustomDropBoxHeaderPlaceHolder
334
+ } = props;
400
335
  let {
401
336
  DropBoxProps = {},
402
337
  ListItemProps = {},
@@ -417,9 +352,10 @@ class Tabs extends React.Component {
417
352
  }
418
353
  return /*#__PURE__*/React.isValidElement(child) && /*#__PURE__*/React.createElement(MainTab, _extends({}, child.props, {
419
354
  key: child.props.id,
420
- getTabRef: this.getTabRef,
421
- onSelect: onSelect,
422
- recalculateDimension: this.recalculateDimension,
355
+ getTabRef: getTabRef,
356
+ onSelect: onSelect
357
+ // recalculateDimension={tabElement.current[recalculateDimension]}
358
+ ,
423
359
  isActive: child.props.id === selectedTab,
424
360
  type: type,
425
361
  isAnimate: isAnimate,
@@ -434,7 +370,7 @@ class Tabs extends React.Component {
434
370
  }, /*#__PURE__*/React.createElement(Container, _extends({
435
371
  className: `${btnstyle.buttonReset} ${moreButtonClass} ${isPopupOpen ? moreButtonActiveClass : ''}`,
436
372
  align: "both",
437
- onClick: this.togglePopup,
373
+ onClick: togglePopupLocal,
438
374
  dataId: "moreTabs",
439
375
  eleRef: getTargetRef
440
376
  }, MoreButtonProps, {
@@ -445,7 +381,7 @@ class Tabs extends React.Component {
445
381
  name: iconName,
446
382
  size: iconSize
447
383
  })), isPopupOpen && /*#__PURE__*/React.createElement(ResponsiveReceiver, {
448
- query: this.responsiveFunc,
384
+ query: responsiveFunc,
449
385
  responsiveId: "Helmet"
450
386
  }, _ref2 => {
451
387
  let {
@@ -465,13 +401,13 @@ class Tabs extends React.Component {
465
401
  }, DropBoxProps, {
466
402
  isResponsivePadding: true,
467
403
  needFocusScope: true,
468
- onClose: this.togglePopup
469
- }), getCustomDropBoxHeaderPlaceHolder && getCustomDropBoxHeaderPlaceHolder(this.props), /*#__PURE__*/React.createElement(Box, {
404
+ onClose: togglePopupLocal
405
+ }), getCustomDropBoxHeaderPlaceHolder && getCustomDropBoxHeaderPlaceHolder(props), /*#__PURE__*/React.createElement(Box, {
470
406
  flexible: true,
471
407
  shrink: true,
472
408
  scroll: "vertical",
473
409
  className: `${tabletMode ? '' : tabsStyle.menuBox} ${moreBoxClass}`,
474
- onScroll: this.onScroll
410
+ onScroll: onScrollLocal
475
411
  }, React.Children.map(moreTabs, child => {
476
412
  if (!child) {
477
413
  return null;
@@ -489,7 +425,7 @@ class Tabs extends React.Component {
489
425
  return /*#__PURE__*/React.isValidElement(child) && /*#__PURE__*/React.createElement(ListItem, _extends({
490
426
  key: id,
491
427
  value: value,
492
- onClick: this.moreTabSelect,
428
+ onClick: moreTabSelect,
493
429
  id: id,
494
430
  title: title || text,
495
431
  isLink: isLink,
@@ -504,59 +440,36 @@ class Tabs extends React.Component {
504
440
  })));
505
441
  })) : null);
506
442
  }
507
- render() {
508
- let {
509
- style,
510
- className,
511
- dataId,
512
- highlightClass,
513
- type,
514
- isAnimate,
515
- needTabBorder,
516
- needBorder,
517
- needPadding,
518
- align,
519
- needAppearance,
520
- children,
521
- containerClass,
522
- dataSelectorId
523
- } = this.props;
524
- let {
525
- totalDimension,
526
- tabDimensions,
527
- renderVirtualTabs
528
- } = this.state;
529
- let {
530
- mainTabs,
531
- moreTabs,
532
- otherTabs
533
- } = this.responsiveTab(totalDimension, tabDimensions);
534
- let appearanceClass = cs([tabsStyle[type], needBorder && tabsStyle[`${type}_border`], needPadding && tabsStyle[`${type}_padding`]]);
535
- let tabsClass = cs([tabsStyle.tab, className, needAppearance && appearanceClass]);
536
- let hlClass = cs([tabsStyle.highlight, highlightClass, isAnimate && tabsStyle.lineAnimate]);
537
- return /*#__PURE__*/React.createElement(Box, {
538
- className: containerClass,
539
- dataSelectorId: dataSelectorId
540
- }, /*#__PURE__*/React.createElement(Container, {
541
- alignBox: align === 'vertical' ? 'row' : 'column',
542
- className: tabsClass,
543
- style: style
544
- }, /*#__PURE__*/React.createElement(Box, {
545
- eleRef: this.getTabsRef,
546
- flexible: true
547
- }, renderVirtualTabs && /*#__PURE__*/React.createElement(Container, {
548
- alignBox: align === 'vertical' ? 'row' : 'column',
549
- className: tabsStyle.hidden
550
- }, this.renderTabs(children, [], true)), /*#__PURE__*/React.createElement(Container, {
551
- alignBox: align === 'vertical' ? 'row' : 'column'
552
- }, this.renderTabs(mainTabs, moreTabs, false))), otherTabs.length ? /*#__PURE__*/React.createElement(Box, null, otherTabs) : null, isAnimate && needTabBorder && needAppearance && /*#__PURE__*/React.createElement("div", {
553
- className: hlClass,
554
- ref: this.getHighlightRef,
555
- "data-id": dataId,
556
- "data-test-id": dataId
557
- })));
558
- }
559
- }
443
+ let {
444
+ mainTabs,
445
+ moreTabs,
446
+ otherTabs
447
+ } = responsiveTab(totalDimension, tabDimensions);
448
+ let appearanceClass = cs([tabsStyle[type], needBorder && tabsStyle[`${type}_border`], needPadding && tabsStyle[`${type}_padding`]]);
449
+ let tabsClass = cs([tabsStyle.tab, className, needAppearance && appearanceClass]);
450
+ let hlClass = cs([tabsStyle.highlight, highlightClass, isAnimate && tabsStyle.lineAnimate]);
451
+ return /*#__PURE__*/React.createElement(Box, {
452
+ className: containerClass,
453
+ dataSelectorId: dataSelectorId
454
+ }, /*#__PURE__*/React.createElement(Container, {
455
+ alignBox: align === 'vertical' ? 'row' : 'column',
456
+ className: tabsClass,
457
+ style: style
458
+ }, /*#__PURE__*/React.createElement(Box, {
459
+ eleRef: getTabsRef,
460
+ flexible: true
461
+ }, renderVirtualTabs && /*#__PURE__*/React.createElement(Container, {
462
+ alignBox: align === 'vertical' ? 'row' : 'column',
463
+ className: tabsStyle.hidden
464
+ }, renderTabs(children, [], true)), /*#__PURE__*/React.createElement(Container, {
465
+ alignBox: align === 'vertical' ? 'row' : 'column'
466
+ }, renderTabs(mainTabs, moreTabs, false))), otherTabs.length ? /*#__PURE__*/React.createElement(Box, null, otherTabs) : null, isAnimate && needTabBorder && needAppearance && /*#__PURE__*/React.createElement("div", {
467
+ className: hlClass,
468
+ ref: getHighlightRef,
469
+ "data-id": dataId,
470
+ "data-test-id": dataId
471
+ })));
472
+ };
560
473
  Tabs.propTypes = Tabs_propTypes;
561
474
  Tabs.defaultProps = {
562
475
  ...Tabs_defaultProps,