@zohodesk/components 1.2.10 → 1.2.12

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 (75) hide show
  1. package/.cli/PropLessFiles.html +1 -1
  2. package/.cli/PropValidationExcludeFilesArray.js +7 -10
  3. package/.cli/propValidation_report.html +1 -1
  4. package/README.md +10 -0
  5. package/coverage/Button/Button.js.html +1 -1
  6. package/coverage/Button/css/Button.module.css.html +1 -1
  7. package/coverage/Button/css/cssJSLogic.js.html +1 -1
  8. package/coverage/Button/css/index.html +1 -1
  9. package/coverage/Button/index.html +1 -1
  10. package/coverage/Button/props/defaultProps.js.html +1 -1
  11. package/coverage/Button/props/index.html +1 -1
  12. package/coverage/Button/props/propTypes.js.html +1 -1
  13. package/coverage/Buttongroup/Buttongroup.js.html +1 -1
  14. package/coverage/Buttongroup/Buttongroup.module.css.html +1 -1
  15. package/coverage/Buttongroup/index.html +1 -1
  16. package/coverage/Buttongroup/props/defaultProps.js.html +1 -1
  17. package/coverage/Buttongroup/props/index.html +1 -1
  18. package/coverage/Buttongroup/props/propTypes.js.html +1 -1
  19. package/coverage/coverage-final.json +10 -10
  20. package/coverage/coverage-summary.json +10 -10
  21. package/coverage/index.html +1 -1
  22. package/coverage/utils/dummyFunction.js.html +1 -1
  23. package/coverage/utils/index.html +1 -1
  24. package/es/MultiSelect/props/propTypes.js +140 -138
  25. package/es/Select/props/propTypes.js +3 -1
  26. package/es/v1/Accordion/Accordion.js +3 -2
  27. package/es/v1/AppContainer/AppContainer.js +75 -92
  28. package/es/v1/Avatar/Avatar.js +84 -134
  29. package/es/v1/Card/Card.js +143 -177
  30. package/es/v1/Card/index.js +4 -0
  31. package/es/v1/DropDown/DropDown.js +31 -52
  32. package/es/v1/DropDown/DropDownHeading.js +29 -37
  33. package/es/v1/DropDown/DropDownItem.js +38 -58
  34. package/es/v1/DropDown/DropDownSearch.js +41 -49
  35. package/es/v1/DropDown/DropDownSeparator.js +7 -10
  36. package/es/v1/MultiSelect/MultiSelect.js +1 -0
  37. package/es/v1/MultiSelect/MultiSelectWithAvatar.js +1 -0
  38. package/es/v1/PopOver/PopOver.js +125 -160
  39. package/es/v1/Popup/Popup.js +1 -1
  40. package/es/v1/Provider/AvatarSize.js +13 -0
  41. package/es/v1/Provider/Config.js +18 -0
  42. package/es/v1/Provider/CssProvider.js +16 -0
  43. package/es/v1/Provider/IdProvider.js +66 -0
  44. package/es/v1/Provider/LibraryContext.js +37 -0
  45. package/es/v1/Provider/LibraryContextInit.js +3 -0
  46. package/es/v1/Provider/NumberGenerator/NumberGenerator.js +136 -0
  47. package/es/v1/Provider/ZindexProvider.js +57 -0
  48. package/es/v1/Provider/index.js +4 -0
  49. package/lib/MultiSelect/props/propTypes.js +146 -141
  50. package/lib/Select/props/propTypes.js +12 -2
  51. package/lib/v1/Accordion/Accordion.js +3 -1
  52. package/lib/v1/AppContainer/AppContainer.js +87 -138
  53. package/lib/v1/Avatar/Avatar.js +130 -186
  54. package/lib/v1/Card/Card.js +190 -286
  55. package/lib/v1/Card/index.js +37 -0
  56. package/lib/v1/DropDown/DropDown.js +34 -130
  57. package/lib/v1/DropDown/DropDownHeading.js +29 -75
  58. package/lib/v1/DropDown/DropDownItem.js +50 -102
  59. package/lib/v1/DropDown/DropDownSearch.js +50 -89
  60. package/lib/v1/DropDown/DropDownSeparator.js +8 -48
  61. package/lib/v1/MultiSelect/MultiSelect.js +3 -1
  62. package/lib/v1/MultiSelect/MultiSelectWithAvatar.js +3 -1
  63. package/lib/v1/PopOver/PopOver.js +160 -256
  64. package/lib/v1/Popup/Popup.js +1 -1
  65. package/lib/v1/Provider/AvatarSize.js +24 -0
  66. package/lib/v1/Provider/Config.js +27 -0
  67. package/lib/v1/Provider/CssProvider.js +27 -0
  68. package/lib/v1/Provider/IdProvider.js +79 -0
  69. package/lib/v1/Provider/LibraryContext.js +76 -0
  70. package/lib/v1/Provider/LibraryContextInit.js +15 -0
  71. package/lib/v1/Provider/NumberGenerator/NumberGenerator.js +174 -0
  72. package/lib/v1/Provider/ZindexProvider.js +69 -0
  73. package/lib/v1/Provider/index.js +81 -0
  74. package/package.json +7 -7
  75. package/result.json +1 -1
@@ -1,142 +1,4 @@
1
1
  import PropTypes from 'prop-types';
2
- export const AdvancedGroupMultiSelect_propTypes = {
3
- animationStyle: PropTypes.string,
4
- autoComplete: PropTypes.bool,
5
- borderColor: PropTypes.oneOf(['transparent', 'default']),
6
- customClass: PropTypes.string,
7
- dataId: PropTypes.string,
8
- defaultDropBoxPosition: PropTypes.oneOf(['bottom', 'top', 'left', 'right']),
9
- dropBoxSize: PropTypes.oneOf(['small', 'medium', 'large']),
10
- emptyMessage: PropTypes.string.isRequired,
11
- getContainerRef: PropTypes.func,
12
- getFooter: PropTypes.func,
13
- groupedOptions: PropTypes.array.isRequired,
14
- i18nKeys: PropTypes.shape({
15
- loadingText: PropTypes.string,
16
- emptyText: PropTypes.string,
17
- noMoreText: PropTypes.string,
18
- searchEmptyText: PropTypes.string
19
- }),
20
- a11y: PropTypes.shape({
21
- clearLabel: PropTypes.string
22
- }),
23
- isDataLoaded: PropTypes.bool,
24
- isDisabled: PropTypes.bool,
25
- isPadding: PropTypes.bool,
26
- isPopupOpen: PropTypes.bool,
27
- isPopupReady: PropTypes.bool,
28
- isReadOnly: PropTypes.bool,
29
- listItemSize: PropTypes.oneOf(['small', 'medium', 'large']),
30
- needBorder: PropTypes.bool,
31
- needResponsive: PropTypes.bool,
32
- needSelectAll: PropTypes.bool,
33
- notifyPopupToggle: PropTypes.func,
34
- onFocus: PropTypes.func,
35
- onKeyDown: PropTypes.func,
36
- onSearch: PropTypes.func,
37
- placeHolder: PropTypes.string,
38
- position: PropTypes.string,
39
- removeClose: PropTypes.func,
40
- searchDebounceTime: PropTypes.number,
41
- searchEmptyMessage: PropTypes.string,
42
- selectAllText: PropTypes.string,
43
- selectedGroupOptions: PropTypes.array.isRequired,
44
- selectedOptionDetails: PropTypes.object,
45
- size: PropTypes.oneOf(['medium', 'xmedium']),
46
- textBoxSize: PropTypes.oneOf(['small', 'medium', 'xmedium']),
47
- title: PropTypes.string,
48
- variant: PropTypes.string,
49
- htmlId: PropTypes.string,
50
- isSearchClearOnSelect: PropTypes.bool,
51
- palette: PropTypes.oneOf(['default', 'dark']),
52
- needEffect: true,
53
- dataSelectorId: PropTypes.string,
54
- valueField: PropTypes.string,
55
- textField: PropTypes.string,
56
- getTargetRef: PropTypes.func,
57
- togglePopup: PropTypes.func,
58
- needLocalSearch: PropTypes.bool,
59
- isNextOptions: PropTypes.bool,
60
- getNextOptions: PropTypes.func,
61
- isPopupOpenOnEnter: PropTypes.bool,
62
- onChange: PropTypes.func,
63
- needToCloseOnSelect: PropTypes.func,
64
- searchStr: PropTypes.string,
65
- children: PropTypes.node,
66
- dataSelectorId: PropTypes.string
67
- };
68
- export const AdvancedMultiSelect_propTypes = {
69
- id: PropTypes.string.isRequired,
70
- options: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])), PropTypes.arrayOf(PropTypes.shape({
71
- id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
72
- text: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
73
- photoURL: PropTypes.string
74
- }))]).isRequired,
75
- selectedOptions: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])).isRequired,
76
- selectedOptionsLimit: PropTypes.number,
77
- getSelectedOptionDetails: PropTypes.func,
78
- emptyMessage: PropTypes.string.isRequired,
79
- isDisabled: PropTypes.bool,
80
- isReadOnly: PropTypes.bool,
81
- needLocalSearch: PropTypes.bool,
82
- needSelectAll: PropTypes.bool,
83
- onChange: PropTypes.func.isRequired,
84
- searchEmptyMessage: PropTypes.string,
85
- placeHolder: PropTypes.string,
86
- selectAllText: PropTypes.string,
87
- textField: PropTypes.string,
88
- valueField: PropTypes.string,
89
- imageField: PropTypes.string,
90
- iconName: PropTypes.string,
91
- prefixText: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
92
- //For grouping multiSelect
93
- optionType: PropTypes.oneOf(['default', 'avatar', 'icon']),
94
- needEffect: PropTypes.bool,
95
- animationStyle: PropTypes.string,
96
- defaultDropBoxPosition: PropTypes.oneOf(['bottom', 'top', 'left', 'right']),
97
- dropBoxSize: PropTypes.oneOf(['small', 'medium', 'large']),
98
- isAnimate: PropTypes.bool,
99
- size: PropTypes.oneOf(['medium', 'xmedium']),
100
- textBoxSize: PropTypes.oneOf(['small', 'medium', 'xmedium']),
101
- title: PropTypes.string,
102
- variant: PropTypes.string,
103
- dataIdClearIcon: PropTypes.string,
104
- dataIdLoading: PropTypes.string,
105
- dataIdMultiSelectComp: PropTypes.string,
106
- dataIdSelectAllEle: PropTypes.string,
107
-
108
- /**** Popup Props ****/
109
- isPopupOpen: PropTypes.bool,
110
- isPopupReady: PropTypes.bool,
111
- togglePopup: PropTypes.func,
112
- getContainerRef: PropTypes.func,
113
- position: PropTypes.string,
114
- removeClose: PropTypes.func,
115
- listItemSize: PropTypes.oneOf(['small', 'medium', 'large']),
116
- needBorder: PropTypes.bool,
117
- htmlId: PropTypes.string,
118
- i18nKeys: PropTypes.shape({
119
- clearText: PropTypes.string,
120
- loadingText: PropTypes.string,
121
- emptyText: PropTypes.string,
122
- noMoreText: PropTypes.string,
123
- searchEmptyText: PropTypes.string
124
- }),
125
- a11y: PropTypes.shape({
126
- clearLabel: PropTypes.string
127
- }),
128
- borderColor: PropTypes.oneOf(['transparent', 'default', 'dark']),
129
- isBoxPaddingNeed: PropTypes.bool,
130
- isSearchClearOnSelect: PropTypes.bool,
131
- disabledOptions: PropTypes.arrayOf(PropTypes.string),
132
- getFooter: PropTypes.func,
133
- customProps: PropTypes.shape({
134
- SuggestionsProps: PropTypes.object,
135
- DropBoxProps: PropTypes.object
136
- }),
137
- isLoading: PropTypes.bool,
138
- dataSelectorId: PropTypes.string
139
- };
140
2
  export const EmptyState_propTypes = {
141
3
  dataId: PropTypes.string,
142
4
  emptyMessage: PropTypes.string,
@@ -307,4 +169,144 @@ export const Suggestions_propTypes = {
307
169
  optionType: PropTypes.string,
308
170
  listItemProps: PropTypes.object
309
171
  }))
172
+ };
173
+ export const AdvancedGroupMultiSelect_propTypes = {
174
+ animationStyle: PropTypes.string,
175
+ autoComplete: PropTypes.bool,
176
+ borderColor: PropTypes.oneOf(['transparent', 'default']),
177
+ customClass: PropTypes.string,
178
+ dataId: PropTypes.string,
179
+ defaultDropBoxPosition: PropTypes.oneOf(['bottom', 'top', 'left', 'right']),
180
+ dropBoxSize: PropTypes.oneOf(['small', 'medium', 'large']),
181
+ emptyMessage: PropTypes.string.isRequired,
182
+ getContainerRef: PropTypes.func,
183
+ getFooter: PropTypes.func,
184
+ groupedOptions: PropTypes.array.isRequired,
185
+ i18nKeys: PropTypes.shape({
186
+ loadingText: PropTypes.string,
187
+ emptyText: PropTypes.string,
188
+ noMoreText: PropTypes.string,
189
+ searchEmptyText: PropTypes.string
190
+ }),
191
+ a11y: PropTypes.shape({
192
+ clearLabel: PropTypes.string
193
+ }),
194
+ isDataLoaded: PropTypes.bool,
195
+ isDisabled: PropTypes.bool,
196
+ isPadding: PropTypes.bool,
197
+ isPopupOpen: PropTypes.bool,
198
+ isPopupReady: PropTypes.bool,
199
+ isReadOnly: PropTypes.bool,
200
+ listItemSize: PropTypes.oneOf(['small', 'medium', 'large']),
201
+ needBorder: PropTypes.bool,
202
+ needResponsive: PropTypes.bool,
203
+ needSelectAll: PropTypes.bool,
204
+ notifyPopupToggle: PropTypes.func,
205
+ onFocus: PropTypes.func,
206
+ onKeyDown: PropTypes.func,
207
+ onSearch: PropTypes.func,
208
+ placeHolder: PropTypes.string,
209
+ position: PropTypes.string,
210
+ removeClose: PropTypes.func,
211
+ searchDebounceTime: PropTypes.number,
212
+ searchEmptyMessage: PropTypes.string,
213
+ selectAllText: PropTypes.string,
214
+ selectedGroupOptions: PropTypes.array.isRequired,
215
+ selectedOptionDetails: PropTypes.object,
216
+ size: PropTypes.oneOf(['medium', 'xmedium']),
217
+ textBoxSize: PropTypes.oneOf(['small', 'medium', 'xmedium']),
218
+ title: PropTypes.string,
219
+ variant: PropTypes.string,
220
+ htmlId: PropTypes.string,
221
+ isSearchClearOnSelect: PropTypes.bool,
222
+ palette: PropTypes.oneOf(['default', 'dark']),
223
+ needEffect: true,
224
+ dataSelectorId: PropTypes.string,
225
+ valueField: PropTypes.string,
226
+ textField: PropTypes.string,
227
+ getTargetRef: PropTypes.func,
228
+ togglePopup: PropTypes.func,
229
+ needLocalSearch: PropTypes.bool,
230
+ isNextOptions: PropTypes.bool,
231
+ getNextOptions: PropTypes.func,
232
+ isPopupOpenOnEnter: PropTypes.bool,
233
+ onChange: PropTypes.func,
234
+ needToCloseOnSelect: PropTypes.func,
235
+ searchStr: PropTypes.string,
236
+ children: PropTypes.node,
237
+ dataSelectorId: PropTypes.string
238
+ };
239
+ export const AdvancedMultiSelect_propTypes = { ...MultiSelect_propTypes,
240
+ selectedOptionDetails: PropTypes.string,
241
+ iconSize: PropTypes.string,
242
+ id: PropTypes.string.isRequired,
243
+ options: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])), PropTypes.arrayOf(PropTypes.shape({
244
+ id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
245
+ text: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
246
+ photoURL: PropTypes.string
247
+ }))]).isRequired,
248
+ selectedOptions: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])).isRequired,
249
+ selectedOptionsLimit: PropTypes.number,
250
+ getSelectedOptionDetails: PropTypes.func,
251
+ emptyMessage: PropTypes.string.isRequired,
252
+ isDisabled: PropTypes.bool,
253
+ isReadOnly: PropTypes.bool,
254
+ needLocalSearch: PropTypes.bool,
255
+ needSelectAll: PropTypes.bool,
256
+ onChange: PropTypes.func.isRequired,
257
+ searchEmptyMessage: PropTypes.string,
258
+ placeHolder: PropTypes.string,
259
+ selectAllText: PropTypes.string,
260
+ textField: PropTypes.string,
261
+ valueField: PropTypes.string,
262
+ imageField: PropTypes.string,
263
+ iconName: PropTypes.string,
264
+ prefixText: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
265
+ //For grouping multiSelect
266
+ optionType: PropTypes.oneOf(['default', 'avatar', 'icon']),
267
+ needEffect: PropTypes.bool,
268
+ animationStyle: PropTypes.string,
269
+ defaultDropBoxPosition: PropTypes.oneOf(['bottom', 'top', 'left', 'right']),
270
+ dropBoxSize: PropTypes.oneOf(['small', 'medium', 'large']),
271
+ isAnimate: PropTypes.bool,
272
+ size: PropTypes.oneOf(['medium', 'xmedium']),
273
+ textBoxSize: PropTypes.oneOf(['small', 'medium', 'xmedium']),
274
+ title: PropTypes.string,
275
+ variant: PropTypes.string,
276
+ dataIdClearIcon: PropTypes.string,
277
+ dataIdLoading: PropTypes.string,
278
+ dataIdMultiSelectComp: PropTypes.string,
279
+ dataIdSelectAllEle: PropTypes.string,
280
+
281
+ /**** Popup Props ****/
282
+ isPopupOpen: PropTypes.bool,
283
+ isPopupReady: PropTypes.bool,
284
+ togglePopup: PropTypes.func,
285
+ getContainerRef: PropTypes.func,
286
+ position: PropTypes.string,
287
+ removeClose: PropTypes.func,
288
+ listItemSize: PropTypes.oneOf(['small', 'medium', 'large']),
289
+ needBorder: PropTypes.bool,
290
+ htmlId: PropTypes.string,
291
+ i18nKeys: PropTypes.shape({
292
+ clearText: PropTypes.string,
293
+ loadingText: PropTypes.string,
294
+ emptyText: PropTypes.string,
295
+ noMoreText: PropTypes.string,
296
+ searchEmptyText: PropTypes.string
297
+ }),
298
+ a11y: PropTypes.shape({
299
+ clearLabel: PropTypes.string
300
+ }),
301
+ borderColor: PropTypes.oneOf(['transparent', 'default', 'dark']),
302
+ isBoxPaddingNeed: PropTypes.bool,
303
+ isSearchClearOnSelect: PropTypes.bool,
304
+ disabledOptions: PropTypes.arrayOf(PropTypes.string),
305
+ getFooter: PropTypes.func,
306
+ customProps: PropTypes.shape({
307
+ SuggestionsProps: PropTypes.object,
308
+ DropBoxProps: PropTypes.object
309
+ }),
310
+ isLoading: PropTypes.bool,
311
+ dataSelectorId: PropTypes.string
310
312
  };
@@ -171,7 +171,9 @@ export const GroupSelect_propTypes = {
171
171
  dataSelectorId: PropTypes.string,
172
172
  isDefaultSelectValue: PropTypes.bool
173
173
  };
174
- export const SelectWithAvatar_propTypes = {
174
+ export const SelectWithAvatar_propTypes = { ...Select_propTypes,
175
+ textBoxClass: PropTypes.string,
176
+ imageField: PropTypes.string,
175
177
  animationStyle: PropTypes.string,
176
178
  avatarPalette: PropTypes.string,
177
179
  borderColor: PropTypes.oneOf(['transparent', 'default']),
@@ -1,4 +1,5 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import React, { useState } from 'react';
2
+ import { useEffectCallOnlyAfterState } from '@zohodesk/hooks';
2
3
  import { Accordion_defaultProps } from '../../Accordion/props/defaultProps';
3
4
  import { Accordion_propTypes } from '../../Accordion/props/propTypes';
4
5
  export default function Accordion(props) {
@@ -29,7 +30,7 @@ export default function Accordion(props) {
29
30
  !disableInternalState && setSelectedItem(selectedItem);
30
31
  }
31
32
 
32
- useEffect(() => {
33
+ useEffectCallOnlyAfterState(() => {
33
34
  if (!disableInternalState) {
34
35
  setSelectedItem(propSelectedItem);
35
36
  }
@@ -1,6 +1,6 @@
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
2
 
3
- import React from 'react';
3
+ import React, { useEffect, useRef, useLayoutEffect } from 'react';
4
4
  import { defaultProps } from '../../AppContainer/props/defaultProps';
5
5
  import { propTypes } from '../../AppContainer/props/propTypes';
6
6
  import { Container, Box } from '../Layout';
@@ -17,116 +17,99 @@ import '../../common/a11y.module.css';
17
17
  import '../../common/boxShadow.module.css';
18
18
  import style from '../../AppContainer/AppContainer.module.css';
19
19
  import { getLibraryConfig, setLibraryConfig } from '../../Provider/Config';
20
- export default class AppContainer extends React.Component {
21
- constructor(props) {
22
- super(props);
23
- this.setTooltipRef = this.setTooltipRef.bind(this);
24
- this.handleOver = this.handleOver.bind(this);
25
- this.mouseOverDispatch = this.mouseOverDispatch.bind(this);
26
- this.removeTimeout = this.removeTimeout.bind(this);
27
- this.getContainerRef = this.getContainerRef.bind(this);
28
- this.timer = null;
29
- this.tooltipDebounce = getLibraryConfig('tooltipDebounce');
20
+ export default function AppContainer(props) {
21
+ let {
22
+ className,
23
+ children,
24
+ tagName,
25
+ dataId,
26
+ dataSelectorId,
27
+ tooltipClass,
28
+ tooltipParentClass,
29
+ needTooltip,
30
+ customProps,
31
+ eleRef
32
+ } = props;
33
+ let {
34
+ ContainerProps = {},
35
+ TooltipProps = {},
36
+ ExtraProps = {}
37
+ } = customProps;
38
+ const tooltipRef = useRef(null);
39
+ const containerElement = useRef(null);
40
+ const timer = useRef(null);
41
+ const tooltipDebounce = useRef(getLibraryConfig('tooltipDebounce'));
42
+ useLayoutEffect(() => {
30
43
  setLibraryConfig({
31
- getTooltipContainer: () => this.containerElement
44
+ getTooltipContainer: () => containerElement.current
32
45
  });
33
- }
46
+ }, []);
34
47
 
35
- mouseOverDispatch(e) {
36
- if (this.tooltipRef) {
37
- this.tooltipRef.handleOver(e, this.containerElement);
48
+ function mouseOverDispatch(e) {
49
+ if (tooltipRef.current) {
50
+ tooltipRef.current.handleOver(e, containerElement.current);
38
51
  }
39
52
  }
40
53
 
41
- removeTimeout() {
42
- if (this.timer) {
43
- this.timer = clearTimeout(this.timer);
54
+ function removeTimeout() {
55
+ if (timer.current) {
56
+ timer.current = clearTimeout(timer.current);
44
57
  }
45
58
  }
46
59
 
47
- handleOver(e) {
48
- if (this.timer) {
49
- this.timer = clearTimeout(this.timer);
60
+ function handleOver(e) {
61
+ if (timer.current) {
62
+ timer.current = clearTimeout(timer.current);
50
63
  }
51
64
 
52
- this.timer = setTimeout(() => this.mouseOverDispatch(e), this.tooltipDebounce);
65
+ timer.current = setTimeout(() => mouseOverDispatch(e), tooltipDebounce.current);
53
66
  }
54
67
 
55
- getContainerRef(ref) {
56
- let {
57
- eleRef
58
- } = this.props;
59
- this.containerElement = ref;
68
+ function getContainerRef(ref) {
69
+ containerElement.current = ref;
60
70
  eleRef && eleRef(ref);
61
71
  }
62
72
 
63
- setTooltipRef(ref) {
64
- this.tooltipRef = ref;
65
- }
66
-
67
- componentDidMount() {
68
- let {
69
- needTooltip
70
- } = this.props;
71
-
72
- if (this.containerElement && needTooltip) {
73
- this.containerElement.addEventListener('mouseover', this.handleOver, false);
74
- this.containerElement.addEventListener('mouseout', this.removeTimeout, false);
75
- this.tooltipRef.observeElement();
76
- }
73
+ function setTooltipRef(ref) {
74
+ tooltipRef.current = ref;
77
75
  }
78
76
 
79
- componentWillUnmount() {
80
- let {
81
- needTooltip
82
- } = this.props;
83
-
84
- if (this.containerElement && needTooltip) {
85
- this.containerElement.removeEventListener('mouseover', this.handleOver, false);
86
- this.containerElement.addEventListener('mouseout', this.removeTimeout, false);
87
- this.tooltipRef.unObserveElement();
88
- setLibraryConfig({
89
- getTooltipContainer: () => null
90
- });
77
+ useEffect(() => {
78
+ if (containerElement.current && needTooltip) {
79
+ containerElement.current.addEventListener('mouseover', handleOver, false);
80
+ containerElement.current.addEventListener('mouseout', removeTimeout, false);
81
+ tooltipRef.current.observeElement();
91
82
  }
92
- }
93
-
94
- render() {
95
- let {
96
- className,
97
- children,
98
- tagName,
99
- dataId,
100
- dataSelectorId,
101
- tooltipClass,
102
- tooltipParentClass,
103
- needTooltip,
104
- customProps
105
- } = this.props;
106
- let {
107
- ContainerProps = {},
108
- TooltipProps = {},
109
- ExtraProps = {}
110
- } = customProps;
111
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Container, _extends({
112
- className: `${style.container} ${className}`,
113
- dataId: dataId,
114
- dataSelectorId: dataSelectorId,
115
- tagName: tagName,
116
- eleRef: this.getContainerRef
117
- }, ContainerProps, ExtraProps), /*#__PURE__*/React.createElement(Box, {
118
- flexible: true
119
- }, children)), needTooltip ? /*#__PURE__*/React.createElement("div", _extends({}, ExtraProps, {
120
- className: `${style.container} ${style.tooltip} ${tooltipParentClass}`,
121
- "data-id": `${dataId}_tooltip`,
122
- "data-test-id": `${dataId}_tooltip`,
123
- "data-selector-id": `${dataSelectorId}_tooltip`
124
- }), /*#__PURE__*/React.createElement(Tooltip, _extends({
125
- ref: this.setTooltipRef,
126
- customClass: tooltipClass
127
- }, TooltipProps))) : null);
128
- }
129
-
83
+ }, []);
84
+ useEffect(() => {
85
+ return () => {
86
+ if (containerElement.current && needTooltip) {
87
+ containerElement.current.removeEventListener('mouseover', handleOver, false);
88
+ containerElement.current.addEventListener('mouseout', removeTimeout, false);
89
+ tooltipRef.current.unObserveElement();
90
+ setLibraryConfig({
91
+ getTooltipContainer: () => null
92
+ });
93
+ }
94
+ };
95
+ }, []);
96
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Container, _extends({
97
+ className: `${style.container} ${className}`,
98
+ dataId: dataId,
99
+ dataSelectorId: dataSelectorId,
100
+ tagName: tagName,
101
+ eleRef: getContainerRef
102
+ }, ContainerProps, ExtraProps), /*#__PURE__*/React.createElement(Box, {
103
+ flexible: true
104
+ }, children)), needTooltip ? /*#__PURE__*/React.createElement("div", _extends({}, ExtraProps, {
105
+ className: `${style.container} ${style.tooltip} ${tooltipParentClass}`,
106
+ "data-id": `${dataId}_tooltip`,
107
+ "data-test-id": `${dataId}_tooltip`,
108
+ "data-selector-id": `${dataSelectorId}_tooltip`
109
+ }), /*#__PURE__*/React.createElement(Tooltip, _extends({
110
+ ref: setTooltipRef,
111
+ customClass: tooltipClass
112
+ }, TooltipProps))) : null);
130
113
  }
131
114
  AppContainer.propTypes = propTypes;
132
115
  AppContainer.defaultProps = defaultProps; // if (__DOCS__) {