@zohodesk/dot 1.4.13 → 1.4.15

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 (113) hide show
  1. package/.cli/propValidation_report.html +1 -1
  2. package/README.md +14 -0
  3. package/coverage/ExternalLink/ExternalLink.js.html +1 -1
  4. package/coverage/ExternalLink/ExternalLink.module.css.html +1 -1
  5. package/coverage/ExternalLink/index.html +1 -1
  6. package/coverage/ExternalLink/props/defaultProps.js.html +1 -1
  7. package/coverage/ExternalLink/props/index.html +1 -1
  8. package/coverage/ExternalLink/props/propTypes.js.html +1 -1
  9. package/coverage/IconButton/IconButton.js.html +1 -1
  10. package/coverage/IconButton/IconButton.module.css.html +2 -5
  11. package/coverage/IconButton/index.html +1 -1
  12. package/coverage/IconButton/props/defaultProps.js.html +1 -1
  13. package/coverage/IconButton/props/index.html +1 -1
  14. package/coverage/IconButton/props/propTypes.js.html +1 -1
  15. package/coverage/Image/Image.js.html +1 -1
  16. package/coverage/Image/Image.module.css.html +1 -1
  17. package/coverage/Image/index.html +1 -1
  18. package/coverage/Image/props/defaultProps.js.html +1 -1
  19. package/coverage/Image/props/index.html +1 -1
  20. package/coverage/Image/props/propTypes.js.html +1 -1
  21. package/coverage/avatar/AvatarWithTeam/AvatarWithTeam.js.html +1 -1
  22. package/coverage/avatar/AvatarWithTeam/AvatarWithTeam.module.css.html +1 -1
  23. package/coverage/avatar/AvatarWithTeam/index.html +1 -1
  24. package/coverage/avatar/AvatarWithTeam/props/defaultProps.js.html +1 -1
  25. package/coverage/avatar/AvatarWithTeam/props/index.html +1 -1
  26. package/coverage/avatar/AvatarWithTeam/props/propTypes.js.html +1 -1
  27. package/coverage/coverage-final.json +16 -16
  28. package/coverage/coverage-summary.json +16 -16
  29. package/coverage/index.html +1 -1
  30. package/es/ActionButton/ActionButton.module.css +51 -4
  31. package/es/AlphabeticList/AlphabeticList.module.css +0 -2
  32. package/es/AttachmentViewer/AttachmentViewer.module.css +0 -2
  33. package/es/ChannelIcon/ChannelIcon.module.css +9 -4
  34. package/es/FormAction/FormAction.module.css +18 -1
  35. package/es/IconButton/IconButton.module.css +0 -1
  36. package/es/TagWithIcon/TagWithIcon.module.css +0 -3
  37. package/es/avatar/AvatarIcon/AvatarIcon.module.css +0 -6
  38. package/es/emptystate/CommonEmptyState/CommonEmptyState.module.css +0 -4
  39. package/es/form/fields/ValidationMessage/ValidationMessage.module.css +0 -1
  40. package/es/layout/SubtabLayout/SubtabLayout.module.css +0 -2
  41. package/es/list/Comment/Comment.module.css +0 -1
  42. package/es/list/Dot/Dot.module.css +0 -1
  43. package/es/list/ListLayout/ListLayout.module.css +0 -6
  44. package/es/list/Subject/Subject.module.css +8 -1
  45. package/es/list/Thread/Thread.js +1 -2
  46. package/es/list/Thread/Thread.module.css +0 -1
  47. package/es/list/status/StatusDropdown/StatusDropdown.js +50 -179
  48. package/es/list/status/StatusDropdown/StatusDropdown.module.css +1 -10
  49. package/es/list/status/StatusDropdown/props/defaultProps.js +2 -1
  50. package/es/list/status/StatusDropdown/props/propTypes.js +1 -1
  51. package/es/list/status/StatusListItem/StatusListItem.js +5 -1
  52. package/es/lookup/Lookup/Lookup.js +3 -2
  53. package/es/lookup/Lookup/Lookup.module.css +4 -1
  54. package/es/lookup/Lookup/props/propTypes.js +3 -2
  55. package/es/lookup/header/TicketHeader/TicketHeader.js +88 -73
  56. package/es/lookup/header/TicketHeader/props/defaultProps.js +7 -1
  57. package/es/lookup/header/TicketHeader/props/propTypes.js +2 -1
  58. package/es/v1/list/Thread/Thread.js +1 -2
  59. package/es/v1/list/status/StatusDropdown/StatusDropdown.js +49 -134
  60. package/es/v1/list/status/StatusDropdown/props/defaultProps.js +2 -1
  61. package/es/v1/list/status/StatusDropdown/props/propTypes.js +1 -1
  62. package/es/v1/list/status/StatusListItem/StatusListItem.js +5 -1
  63. package/es/v1/lookup/Lookup/Lookup.js +3 -2
  64. package/es/v1/lookup/Lookup/props/propTypes.js +3 -2
  65. package/es/v1/lookup/header/TicketHeader/TicketHeader.js +30 -12
  66. package/es/v1/lookup/header/TicketHeader/props/defaultProps.js +7 -1
  67. package/es/v1/lookup/header/TicketHeader/props/propTypes.js +2 -1
  68. package/es/version2/GlobalNotification/GlobalNotification.module.css +0 -4
  69. package/es/version2/lookup/AlertHeader/css/AlertHeaderNew.module.css +0 -1
  70. package/es/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +0 -2
  71. package/lib/ActionButton/ActionButton.module.css +51 -4
  72. package/lib/AlphabeticList/AlphabeticList.module.css +0 -2
  73. package/lib/AttachmentViewer/AttachmentViewer.module.css +0 -2
  74. package/lib/ChannelIcon/ChannelIcon.module.css +9 -4
  75. package/lib/FormAction/FormAction.module.css +18 -1
  76. package/lib/IconButton/IconButton.module.css +0 -1
  77. package/lib/TagWithIcon/TagWithIcon.module.css +0 -3
  78. package/lib/avatar/AvatarIcon/AvatarIcon.module.css +0 -6
  79. package/lib/emptystate/CommonEmptyState/CommonEmptyState.module.css +0 -4
  80. package/lib/form/fields/ValidationMessage/ValidationMessage.module.css +0 -1
  81. package/lib/layout/SubtabLayout/SubtabLayout.module.css +0 -2
  82. package/lib/list/Comment/Comment.module.css +0 -1
  83. package/lib/list/Dot/Dot.module.css +0 -1
  84. package/lib/list/ListLayout/ListLayout.module.css +0 -6
  85. package/lib/list/Subject/Subject.module.css +8 -1
  86. package/lib/list/Thread/Thread.js +1 -2
  87. package/lib/list/Thread/Thread.module.css +0 -1
  88. package/lib/list/status/StatusDropdown/StatusDropdown.js +96 -231
  89. package/lib/list/status/StatusDropdown/StatusDropdown.module.css +1 -10
  90. package/lib/list/status/StatusDropdown/props/defaultProps.js +2 -1
  91. package/lib/list/status/StatusDropdown/props/propTypes.js +1 -1
  92. package/lib/list/status/StatusListItem/StatusListItem.js +6 -1
  93. package/lib/lookup/Lookup/Lookup.js +3 -2
  94. package/lib/lookup/Lookup/Lookup.module.css +4 -1
  95. package/lib/lookup/Lookup/props/propTypes.js +3 -2
  96. package/lib/lookup/header/TicketHeader/TicketHeader.js +93 -106
  97. package/lib/lookup/header/TicketHeader/props/defaultProps.js +7 -1
  98. package/lib/lookup/header/TicketHeader/props/propTypes.js +2 -1
  99. package/lib/v1/list/Thread/Thread.js +1 -2
  100. package/lib/v1/list/status/StatusDropdown/StatusDropdown.js +41 -132
  101. package/lib/v1/list/status/StatusDropdown/props/defaultProps.js +2 -1
  102. package/lib/v1/list/status/StatusDropdown/props/propTypes.js +1 -1
  103. package/lib/v1/list/status/StatusListItem/StatusListItem.js +6 -1
  104. package/lib/v1/lookup/Lookup/Lookup.js +3 -2
  105. package/lib/v1/lookup/Lookup/props/propTypes.js +3 -2
  106. package/lib/v1/lookup/header/TicketHeader/TicketHeader.js +37 -12
  107. package/lib/v1/lookup/header/TicketHeader/props/defaultProps.js +7 -1
  108. package/lib/v1/lookup/header/TicketHeader/props/propTypes.js +2 -1
  109. package/lib/version2/GlobalNotification/GlobalNotification.module.css +0 -4
  110. package/lib/version2/lookup/AlertHeader/css/AlertHeaderNew.module.css +0 -1
  111. package/lib/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +0 -2
  112. package/package.json +12 -12
  113. package/result.json +1 -1
@@ -9,8 +9,6 @@ import DropDownHeading from '@zohodesk/components/es/v1/DropDown/DropDownHeading
9
9
  import TextBoxIcon from '@zohodesk/components/es/v1/TextBoxIcon/TextBoxIcon';
10
10
  import Loader from '@zohodesk/svg/lib/Loader/Loader';
11
11
  import EmptySearch from '@zohodesk/svg/lib/emptystate/version3/EmptySearch';
12
- import { scrollTo } from '@zohodesk/components/es/utils/Common';
13
- import TextBox from '@zohodesk/components/es/v1/TextBox/TextBox';
14
12
  import CommonEmptyState from '../../../emptystate/CommonEmptyState/CommonEmptyState';
15
13
  import StatusListItem from '../StatusListItem/StatusListItem';
16
14
  import commonStyle from '@zohodesk/components/es/common/common.module.css';
@@ -68,18 +66,13 @@ function StatusDropdown(props) {
68
66
  onTogglePopup,
69
67
  onClick,
70
68
  onSelectLabel,
71
- isNextOptions,
69
+ isFetchingOptions,
72
70
  getNextOptions,
73
71
  options,
74
72
  a11y = {}
75
73
  } = props;
76
74
  const [optionsList, setOptionsList] = useState(options);
77
- const [selectedIndex, setSelectedIndex] = useState(0);
78
75
  const [searchString, setSearchString] = useState('');
79
- const hiddenInput = useRef(null);
80
- const searchInput = useRef(null);
81
- const optionsContainer = useRef(null);
82
- const dropdown = useRef({});
83
76
  const getAriaId = useUniqueId();
84
77
  const {
85
78
  tabIndex = 0,
@@ -96,86 +89,18 @@ function StatusDropdown(props) {
96
89
  });
97
90
  }
98
91
 
99
- function handleInputRef(el) {
100
- hiddenInput.current = el;
101
- }
102
-
103
- function itemRef(ele, index, id) {
104
- dropdown.current[`suggestion_${id}`] = ele;
105
- }
106
-
107
- function searchInputRef(el) {
108
- searchInput.current = el;
109
- }
110
-
111
92
  function handleTogglePopup(e) {
112
93
  !isPopupOpen && onSelectLabel && onSelectLabel(e);
113
94
  onTogglePopup && onTogglePopup(isPopupOpen);
114
95
  togglePopup(e, boxPosition);
115
96
  }
116
97
 
117
- function scrollContentRef(el) {
118
- if (isPopupOpen) {
119
- optionsContainer.current = el;
120
- }
121
- }
122
-
123
98
  function onSelect(element, e) {
124
99
  onClick && onClick(e, element);
125
100
  onTogglePopup && onTogglePopup(isPopupOpen);
126
101
  togglePopup(e);
127
102
  }
128
103
 
129
- function handleKeyDown(e) {
130
- let {
131
- keyCode
132
- } = e;
133
- let totalIndex = optionsList.length;
134
-
135
- if (isPopupReady && (keyCode === 38 || keyCode === 40) && e.preventDefault) {
136
- e.preventDefault(); //prevent body scroll
137
- }
138
-
139
- if (isPopupReady) {
140
- switch (keyCode) {
141
- case 40:
142
- if (selectedIndex === totalIndex - 1) {
143
- setSelectedIndex(0);
144
- } else {
145
- if (selectedIndex === totalIndex - 3) {
146
- isNextOptions && getNextOptions && getNextOptions();
147
- }
148
-
149
- setSelectedIndex(selectedIndex + 1);
150
- }
151
-
152
- break;
153
-
154
- case 38:
155
- if (selectedIndex === 0) {
156
- setSelectedIndex(totalIndex - 1);
157
- } else {
158
- setSelectedIndex(selectedIndex - 1);
159
- }
160
-
161
- break;
162
-
163
- case 13:
164
- onClick && onClick(optionsList[selectedIndex].name, e);
165
- onTogglePopup && onTogglePopup(isPopupOpen);
166
- togglePopup(e, boxPosition);
167
- break;
168
-
169
- default:
170
- break;
171
- }
172
- } else {
173
- if (keyCode === 13 || keyCode === 40) {
174
- togglePopup(e, boxPosition);
175
- }
176
- }
177
- }
178
-
179
104
  function searchList(value) {
180
105
  let foptions = options.filter(dept => dept[keyName].toLowerCase().indexOf(value.toLowerCase()) != -1);
181
106
  return foptions;
@@ -184,7 +109,6 @@ function StatusDropdown(props) {
184
109
  function handleChange(value, e) {
185
110
  let foptions = searchList(value);
186
111
  setSearchString(value);
187
- setSelectedIndex(-1);
188
112
  setOptionsList(foptions);
189
113
  }
190
114
 
@@ -194,13 +118,9 @@ function StatusDropdown(props) {
194
118
  setOptionsList(foptions);
195
119
  }
196
120
 
197
- function handleMouseEnter(id, value, index, e) {
198
- setSelectedIndex(index);
199
- }
200
-
201
121
  function handleScroll(e) {
202
122
  if (e.target.scrollTop + e.target.offsetHeight > e.target.scrollHeight - 1) {
203
- isNextOptions && getNextOptions && getNextOptions(e);
123
+ getNextOptions && getNextOptions(e);
204
124
  }
205
125
  }
206
126
 
@@ -219,18 +139,7 @@ function StatusDropdown(props) {
219
139
  setOptionsList(options);
220
140
  }, [options.length]);
221
141
  useEffectCallOnlyAfterState(() => {
222
- setTimeout(() => {
223
- isPopupOpen && isSearch ? searchInput.current && searchInput.current.focus() : hiddenInput.current && hiddenInput.current.focus();
224
- }, 10);
225
- let mergeOptions = optionsList;
226
- let option = mergeOptions[selectedIndex];
227
- let id = option && option[idName] || {};
228
- let selSuggestion = dropdown.current[`suggestion_${id}`];
229
-
230
- if (isPopupOpen) {
231
- optionsContainer.current && scrollTo(optionsContainer.current, selSuggestion);
232
- onSearchClear();
233
- }
142
+ isPopupOpen && onSearchClear();
234
143
  }, [isPopupOpen]);
235
144
  return /*#__PURE__*/React.createElement("div", {
236
145
  className: style.posRel,
@@ -240,12 +149,11 @@ function StatusDropdown(props) {
240
149
  tagName: "button",
241
150
  alignBox: "row",
242
151
  className: `${style.container} ${containerClass} ${btnStyle.buttonReset}`,
243
- onMouseDown: !showOnHover && !isDisabled && !isReadOnly && isEditable ? handleTogglePopup : null,
152
+ onClick: !showOnHover && !isDisabled && !isReadOnly && isEditable ? handleTogglePopup : null,
244
153
  eleRef: getTargetRef,
245
154
  align: targetAlign,
246
155
  isCover: false,
247
156
  dataId: dataId,
248
- onClick: removeClose,
249
157
  disabled: isDisabled || isReadOnly ? true : false,
250
158
  "aria-haspopup": isSearch ? 'listbox' : 'menu',
251
159
  "aria-expanded": isPopupReady && isEditable ? true : false,
@@ -253,15 +161,7 @@ function StatusDropdown(props) {
253
161
  "aria-labelledby": ariaLabelledby,
254
162
  "aria-label": ariaLabel,
255
163
  "aria-disabled": isDisabled || isReadOnly
256
- }, isEditable ? /*#__PURE__*/React.createElement("div", {
257
- className: style.hiddenInput
258
- }, /*#__PURE__*/React.createElement(TextBox, {
259
- type: "text",
260
- inputRef: handleInputRef,
261
- onKeyDown: handleKeyDown,
262
- needAppearance: false,
263
- placeHolder: placeHolderText
264
- })) : null, children ? children : /*#__PURE__*/React.createElement(Box, {
164
+ }, children ? children : /*#__PURE__*/React.createElement(Box, {
265
165
  className: `${style.value} toggleDropText`,
266
166
  shrink: true,
267
167
  tagName: "span",
@@ -295,7 +195,16 @@ function StatusDropdown(props) {
295
195
  customDropBoxWrap: style.dropBoxContainer
296
196
  },
297
197
  needResponsive: needResponsive,
298
- isResponsivePadding: true
198
+ isResponsivePadding: true,
199
+ needFocusScope: true,
200
+ onClose: handleTogglePopup,
201
+ customProps: {
202
+ focusScopeProps: {
203
+ searchValue: searchString,
204
+ loadNextOptions: getNextOptions,
205
+ isFetchingOptions: isFetchingOptions
206
+ }
207
+ }
299
208
  }, /*#__PURE__*/React.createElement(React.Fragment, null, isSearch ? /*#__PURE__*/React.createElement(Box, {
300
209
  className: style.search
301
210
  }, /*#__PURE__*/React.createElement(TextBoxIcon, {
@@ -304,8 +213,11 @@ function StatusDropdown(props) {
304
213
  value: searchString,
305
214
  onClear: onSearchClear,
306
215
  size: searchBoxSize,
307
- inputRef: searchInputRef,
308
- onKeyDown: handleKeyDown,
216
+ customProps: {
217
+ TextBoxProps: {
218
+ 'data-a11y-autofocus': true
219
+ }
220
+ },
309
221
  a11y: {
310
222
  ariaHaspopup: isSearch ? 'listbox' : 'menu',
311
223
  ariaExpanded: isPopupReady,
@@ -328,34 +240,37 @@ function StatusDropdown(props) {
328
240
  dataId: `${dataId}_list`,
329
241
  preventParentScroll: "vertical",
330
242
  className: `${tabletMode ? style.responsivemaxHgt : style.maxHgt}`,
331
- eleRef: scrollContentRef,
332
243
  onScroll: handleScroll,
333
244
  role: isSearch ? 'listbox' : 'menu',
334
- "aria-labelledby": ariaTitleId,
335
- tabindex: "-1"
336
- }, optionsList.length != 0 && isDataLoaded ? /*#__PURE__*/React.createElement(React.Fragment, null, optionsList.map((item, i) => /*#__PURE__*/React.createElement(React.Fragment, {
337
- key: i
338
- }, /*#__PURE__*/React.createElement(StatusListItem, {
339
- dataId: `dataid_${i}`,
340
- value: item[keyName],
341
- id: item[idName],
342
- active: value === item[keyName],
343
- onClick: e => onSelect(item, e),
344
- index: i,
345
- highlight: selectedIndex === i,
346
- needTick: needTick,
347
- needBorder: false,
348
- onMouseEnter: handleMouseEnter,
349
- getRef: itemRef,
350
- bulletColor: item[statusColor],
351
- title: item[keyName],
352
- needMultiLineText: needMultiLineText,
353
- a11y: {
354
- role: isSearch ? 'option' : 'menuitem',
355
- ariaSelected: value === item[keyName],
356
- 'data-a11y-list-active': selectedIndex === i
357
- }
358
- })))) : isDataLoaded ? /*#__PURE__*/React.createElement(CommonEmptyState, {
245
+ tabindex: "-1",
246
+ isScrollAttribute: true
247
+ }, optionsList.length != 0 && isDataLoaded ? /*#__PURE__*/React.createElement(React.Fragment, null, optionsList.map((item, i) => {
248
+ const listItemText = item[keyName];
249
+ const isActive = value === listItemText;
250
+ return /*#__PURE__*/React.createElement(StatusListItem, {
251
+ key: i,
252
+ dataId: `dataid_${i}`,
253
+ value: listItemText,
254
+ id: item[idName],
255
+ active: isActive,
256
+ onClick: e => onSelect(item, e),
257
+ index: i,
258
+ needTick: needTick,
259
+ needBorder: false,
260
+ bulletColor: item[statusColor],
261
+ title: listItemText,
262
+ needMultiLineText: needMultiLineText,
263
+ autoHover: true,
264
+ a11y: {
265
+ role: isSearch ? 'option' : 'menuitem',
266
+ ariaSelected: isActive,
267
+ ariaLabel: listItemText
268
+ }
269
+ });
270
+ }), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
271
+ isCover: false,
272
+ align: "both"
273
+ }, /*#__PURE__*/React.createElement(Loader, null))) : isDataLoaded ? /*#__PURE__*/React.createElement(CommonEmptyState, {
359
274
  className: style.svgWrapper,
360
275
  title: searchErrorText || 'No results',
361
276
  description: searchEmptyHint,
@@ -15,5 +15,6 @@ export const defaultProps = {
15
15
  boxSize: 'medium',
16
16
  needExternalPopupState: false,
17
17
  statusColor: 'statusColor',
18
- needMultiLineText: false
18
+ needMultiLineText: false,
19
+ isFetchingOptions: false
19
20
  };
@@ -19,7 +19,7 @@ export const propTypes = {
19
19
  isDataLoaded: PropTypes.bool,
20
20
  isDisabled: PropTypes.bool,
21
21
  isEditable: PropTypes.bool,
22
- isNextOptions: PropTypes.bool,
22
+ isFetchingOptions: PropTypes.bool,
23
23
  isPopupActive: PropTypes.bool,
24
24
  isPopupOpen: PropTypes.bool,
25
25
  isPopupReady: PropTypes.bool,
@@ -43,7 +43,9 @@ export default function StatusListItem(props) {
43
43
  let {
44
44
  role,
45
45
  ariaSelected,
46
- ariaHidden = true
46
+ ariaHidden = true,
47
+ ariaLabel,
48
+ insetFocus = true
47
49
  } = a11y;
48
50
 
49
51
  if (isLink) {
@@ -69,6 +71,8 @@ export default function StatusListItem(props) {
69
71
  return /*#__PURE__*/React.createElement(Container, _extends({
70
72
  role: role,
71
73
  "aria-selected": ariaSelected,
74
+ "aria-label": ariaLabel,
75
+ "data-a11y-inset-focus": insetFocus,
72
76
  isCover: false,
73
77
  align: "baseline",
74
78
  alignBox: "row",
@@ -31,7 +31,8 @@ export default function Lookup(props) {
31
31
  needFocusScope,
32
32
  customProps,
33
33
  onKeyDown,
34
- isMinHeight
34
+ isMinHeight,
35
+ lookupClass
35
36
  } = props;
36
37
  const {
37
38
  role = 'dialog',
@@ -77,7 +78,7 @@ export default function Lookup(props) {
77
78
  "aria-label": ariaLabel,
78
79
  "aria-modal": ariaModal,
79
80
  id: htmlId,
80
- className: `${style.box} ${style[`${size}Size`]}`,
81
+ className: `${style.box} ${style[`${size}Size`]} ${lookupClass ? lookupClass : ''}`,
81
82
  "data-id": dataId,
82
83
  "data-test-id": dataId
83
84
  }, a11yAttributes), /*#__PURE__*/React.createElement(Container, {
@@ -4,7 +4,7 @@ export const propTypes = {
4
4
  customClass: PropTypes.string,
5
5
  dataId: PropTypes.string,
6
6
  isActive: PropTypes.bool,
7
- size: PropTypes.oneOf(['small', 'xmedium', 'medium', 'large', 'full']),
7
+ size: PropTypes.oneOf(['small', 'xmedium', 'medium', 'large', 'xlarge', 'full']),
8
8
  htmlId: PropTypes.string,
9
9
  a11y: PropTypes.shape({
10
10
  role: PropTypes.string,
@@ -19,5 +19,6 @@ export const propTypes = {
19
19
  forwardRef: PropTypes.object,
20
20
  onClick: PropTypes.func,
21
21
  onClose: PropTypes.func,
22
- isMinHeight: PropTypes.bool
22
+ isMinHeight: PropTypes.bool,
23
+ lookupClass: PropTypes.string
23
24
  };
@@ -1,5 +1,5 @@
1
1
  /*** Libraries ***/
2
- import React from 'react';
2
+ import React, { memo, useRef } from 'react';
3
3
  import { defaultProps } from './props/defaultProps';
4
4
  import { propTypes } from './props/propTypes';
5
5
  /*** Components ***/
@@ -9,6 +9,7 @@ import Close from '../Close/Close';
9
9
  import Search from '../Search/Search';
10
10
  import ViewDropDown from '../../../../lookup/header/ViewDropDown/ViewDropDown';
11
11
  import { Container, Box } from '@zohodesk/components/es/v1/Layout';
12
+ import useDragger from '../../../../Hooks/Dragger/useDragger';
12
13
  /*** CSS ***/
13
14
 
14
15
  import commonStyle from '../../../../lookup/header/lookupHeaderCommon.module.css';
@@ -16,7 +17,7 @@ import commonResponsive from '../../../../lookup/header/lookupHeaderCommonRespon
16
17
  import style from '../../../../lookup/header/TicketHeader/TicketHeader.module.css';
17
18
  /* eslint-disable react/forbid-component-props */
18
19
 
19
- export default function TicketHeader(props) {
20
+ function TicketHeader(props) {
20
21
  let {
21
22
  needSearch,
22
23
  onLookupClose,
@@ -32,23 +33,29 @@ export default function TicketHeader(props) {
32
33
  getSearchBoxRef,
33
34
  needViewsList,
34
35
  i18nKeys,
35
- palette
36
+ palette,
37
+ dragBoundaryLimit
36
38
  } = props;
37
39
  let {
38
40
  menuEmptyMessage = 'No matches found'
39
41
  } = i18nKeys;
42
+ const dragRef = useRef(null); //dragRef
43
+
44
+ useDragger({
45
+ isActive: true,
46
+ ChildRef: dragRef,
47
+ boundaryLimit: dragBoundaryLimit
48
+ }); //custom Hook
49
+
40
50
  return /*#__PURE__*/React.createElement(Container, {
41
51
  align: "vertical",
42
52
  alignBox: "row",
43
53
  className: `${commonStyle.container} ${commonStyle[`${palette}`]} ${commonResponsive.container} ${style.container}`,
44
54
  isCover: false,
45
- wrap: "wrap"
46
- }, /*#__PURE__*/React.createElement("div", {
47
- className: commonStyle.closeContainer
48
- }, /*#__PURE__*/React.createElement(Close, {
49
- onClose: onLookupClose,
50
- dataId: "close"
51
- })), /*#__PURE__*/React.createElement(Box, {
55
+ wrap: "wrap",
56
+ ref: dragRef,
57
+ "data-drag-hook": "true"
58
+ }, /*#__PURE__*/React.createElement(Box, {
52
59
  flexible: true
53
60
  }, /*#__PURE__*/React.createElement(Container, {
54
61
  alignBox: "column",
@@ -84,7 +91,18 @@ export default function TicketHeader(props) {
84
91
  dataId: "search",
85
92
  needOnTypeSearch: needOnTypeSearch,
86
93
  getRef: getSearchBoxRef
87
- })) : null);
94
+ })) : null, /*#__PURE__*/React.createElement("div", {
95
+ className: commonStyle.closeContainer
96
+ }, /*#__PURE__*/React.createElement(Close, {
97
+ onClose: onLookupClose,
98
+ dataId: "close"
99
+ })));
88
100
  }
101
+
89
102
  TicketHeader.propTypes = propTypes;
90
- TicketHeader.defaultProps = defaultProps;
103
+ TicketHeader.defaultProps = defaultProps;
104
+ const MemoizedTicketHeader = /*#__PURE__*/memo(TicketHeader);
105
+ MemoizedTicketHeader.propTypes = propTypes;
106
+ MemoizedTicketHeader.defaultProps = defaultProps;
107
+ MemoizedTicketHeader.displayName = 'TicketHeader';
108
+ export default MemoizedTicketHeader;
@@ -1,4 +1,10 @@
1
1
  export const defaultProps = {
2
2
  i18nKeys: {},
3
- palette: 'default'
3
+ palette: 'default',
4
+ dragBoundaryLimit: {
5
+ top: 0,
6
+ left: 50,
7
+ right: 50,
8
+ bottom: 50
9
+ }
4
10
  };
@@ -16,5 +16,6 @@ export const propTypes = {
16
16
  i18nKeys: PropTypes.shape({
17
17
  menuEmptyMessage: PropTypes.string
18
18
  }),
19
- palette: PropTypes.oneOf(['default', 'white'])
19
+ palette: PropTypes.oneOf(['default', 'white']),
20
+ dragBoundaryLimit: PropTypes.object
20
21
  };
@@ -29,7 +29,6 @@
29
29
  .stackShadowTwo::before {
30
30
  content: '';
31
31
  position: absolute;
32
- /* css:theme-validation:ignore */
33
32
  height: var(--zd_size20) ;
34
33
  }
35
34
 
@@ -78,9 +77,6 @@
78
77
  .container {
79
78
  position: relative;
80
79
  pointer-events: initial;
81
- /* css:theme-validation:ignore */
82
- /* css:theme-validation:ignore */
83
- /* css:theme-validation:ignore */
84
80
  color: var(--globalnotification_text_color);
85
81
  z-index: 1;
86
82
  composes: wbreak from '~@zohodesk/components/lib/common/common.module.css';
@@ -4,7 +4,6 @@
4
4
  .container {
5
5
  composes: varClass;
6
6
  position: relative;
7
- /* css:theme-validation:ignore */
8
7
  background-color: var(--zdt_alertlookup_bg);
9
8
  border-style: solid;
10
9
  border-color: var(--commonalert_border_color);
@@ -5,8 +5,6 @@
5
5
  composes: varClass;
6
6
  min-height: var(--zd_size54) ;
7
7
  position: relative;
8
- /* css:theme-validation:ignore */
9
- /* css:theme-validation:ignore */
10
8
  color: var(--zdt_desktopnotification_text);
11
9
  background-color: var(--alert_lookup_bg_color);
12
10
  border-style: solid;