@zohodesk/dot 1.9.11 → 1.9.13

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 (68) hide show
  1. package/README.md +20 -0
  2. package/es/ActionButton/__tests__/ActionButton.spec.js +4 -5
  3. package/es/AttachmentViewer/AttachmentImage.js +3 -1
  4. package/es/AttachmentViewer/AttachmentViewer.js +340 -273
  5. package/es/AttachmentViewer/AttachmentViewer.module.css +8 -15
  6. package/es/AttachmentViewer/__tests__/AttachmentViewer.spec.js +104 -100
  7. package/es/AttachmentViewer/__tests__/__snapshots__/AttachmentViewer.spec.js.snap +778 -1
  8. package/es/AttachmentViewer/props/defaultProps.js +4 -2
  9. package/es/AttachmentViewer/props/propTypes.js +9 -2
  10. package/es/AttachmentViewer/utils.js +6 -7
  11. package/es/AudioPlayer/utils/utils.js +2 -5
  12. package/es/DotProvider/hooks/useDotProvider.js +14 -15
  13. package/es/DotProvider/hooks/useDownloadAssetsAndSetAttr.js +12 -13
  14. package/es/DotProvider/props/defaultProps.js +1 -1
  15. package/es/DotProvider/utils/assetPromiseHandlers/themeAppearanceAssetPromise.js +3 -4
  16. package/es/DotProvider/utils/assetPromiseHandlers/themeColorAssetPromise.js +4 -5
  17. package/es/DotProvider/utils/errorValidation.js +5 -6
  18. package/es/DotProvider/utils/getAssetsImportPromises.js +4 -5
  19. package/es/Drawer/Drawer.js +6 -8
  20. package/es/FreezeLayer/css/cssJSLogic.js +4 -5
  21. package/es/Hooks/Dragger/useDragger.js +5 -6
  22. package/es/Hooks/Dragger/utils/DraggerUtil.js +7 -8
  23. package/es/Hooks/useFreezeLayer.js +4 -5
  24. package/es/Link/Link.js +4 -3
  25. package/es/Link/props/propTypes.js +1 -0
  26. package/es/Onboarding/CarouselDots/CarouselDots.js +29 -32
  27. package/es/Onboarding/Onboarding.js +23 -24
  28. package/es/Onboarding/hooks/useOnboarding.js +4 -5
  29. package/es/Onboarding/hooks/useOnboardingSlider.js +5 -6
  30. package/es/deprecated/SelectDropdown/SelectDropdown.js +43 -47
  31. package/es/dropdown/ToggleDropDown/ToggleDropDown.js +214 -225
  32. package/es/errorstate/Inconvenience/Inconvenience.js +32 -36
  33. package/es/errorstate/NoRequestFound/NoRequestFound.js +32 -36
  34. package/es/errorstate/PermissionPlay/PermissionPlay.js +31 -35
  35. package/es/errorstate/RequestUrlNotFound/RequestUrlNotFound.js +32 -36
  36. package/es/errorstate/UnableToProcess/UnableToProcess.js +32 -36
  37. package/es/errorstate/UnauthorizedLogin/UnauthorizedLogin.js +32 -36
  38. package/es/errorstate/WillBack/WillBack.js +30 -34
  39. package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +81 -85
  40. package/es/list/status/StatusDropdown/StatusDropdown.js +109 -113
  41. package/es/list/status/StatusDropdown/__tests__/StatusDropdown.spec.js +3 -4
  42. package/es/lookup/header/Search/Search.js +4 -5
  43. package/es/lookup/header/Search/__tests__/Search.spec.js +3 -4
  44. package/es/lookup/header/ViewDropDown/ViewDropDown.js +67 -75
  45. package/es/utils/General.js +2 -7
  46. package/es/utils/editorUtils.js +1 -5
  47. package/es/version2/lookup/AlertHeader/AlertHeader.js +5 -3
  48. package/es/version2/lookup/AlertHeader/__tests__/AlertHeader.spec.js +24 -0
  49. package/es/version2/lookup/AlertHeader/__tests__/__snapshots__/AlertHeader.spec.js.snap +34 -0
  50. package/es/version2/lookup/AlertHeader/css/cssJSLogic.js +4 -5
  51. package/es/version2/lookup/AlertHeader/props/propTypes.js +2 -1
  52. package/es/version2/notification/DesktopNotification/DesktopNotification.js +59 -63
  53. package/es/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.js +40 -44
  54. package/lib/AttachmentViewer/AttachmentImage.js +3 -1
  55. package/lib/AttachmentViewer/AttachmentViewer.js +158 -82
  56. package/lib/AttachmentViewer/AttachmentViewer.module.css +8 -15
  57. package/lib/AttachmentViewer/__tests__/AttachmentViewer.spec.js +100 -100
  58. package/lib/AttachmentViewer/__tests__/__snapshots__/AttachmentViewer.spec.js.snap +778 -1
  59. package/lib/AttachmentViewer/props/defaultProps.js +6 -2
  60. package/lib/AttachmentViewer/props/propTypes.js +9 -2
  61. package/lib/DotProvider/props/defaultProps.js +2 -2
  62. package/lib/Link/Link.js +4 -3
  63. package/lib/Link/props/propTypes.js +1 -0
  64. package/lib/version2/lookup/AlertHeader/AlertHeader.js +5 -2
  65. package/lib/version2/lookup/AlertHeader/__tests__/AlertHeader.spec.js +26 -0
  66. package/lib/version2/lookup/AlertHeader/__tests__/__snapshots__/AlertHeader.spec.js.snap +34 -0
  67. package/lib/version2/lookup/AlertHeader/props/propTypes.js +2 -1
  68. package/package.json +26 -24
@@ -113,10 +113,9 @@ export class StatusDropdown extends React.Component {
113
113
  }
114
114
  }
115
115
 
116
- responsiveFunc(_ref) {
117
- let {
118
- mediaQueryOR
119
- } = _ref;
116
+ responsiveFunc({
117
+ mediaQueryOR
118
+ }) {
120
119
  return {
121
120
  tabletMode: mediaQueryOR([{
122
121
  maxWidth: 700
@@ -234,118 +233,115 @@ export class StatusDropdown extends React.Component {
234
233
  }) : null), isPopupOpen && isEditable ? /*#__PURE__*/React.createElement(ResponsiveReceiver, {
235
234
  query: this.responsiveFunc,
236
235
  responsiveId: "Helmet"
237
- }, _ref2 => {
238
- let {
239
- tabletMode
240
- } = _ref2;
241
- return /*#__PURE__*/React.createElement(ResponsiveDropBox, {
242
- boxPosition: position,
243
- isActive: isPopupReady,
244
- onClick: removeClose,
245
- size: boxSize,
246
- right: right,
247
- left: left,
248
- top: top,
249
- bottom: bottom,
250
- isArrow: isArrow,
251
- isAnimate: true,
252
- getRef: getContainerRef,
253
- customClass: {
254
- customDropBoxWrap: style.dropBoxContainer,
255
- customDropBox: dropBoxClass
256
- },
257
- needResponsive: needResponsive,
258
- isResponsivePadding: true,
259
- needFocusScope: true,
260
- onClose: this.handleTogglePopup,
261
- dataId: `${dataId}_dropbox`,
262
- isAbsolutePositioningNeeded: isAbsolutePositioningNeeded,
263
- isRestrictScroll: isRestrictScroll,
264
- positionsOffset: positionsOffset,
265
- targetOffset: targetOffset,
266
- customProps: {
267
- focusScopeProps: {
268
- loadNextOptions: getNextOptions,
269
- searchValue: searchString,
270
- isFetchingOptions: isFetchingOptions
271
- }
236
+ }, ({
237
+ tabletMode
238
+ }) => /*#__PURE__*/React.createElement(ResponsiveDropBox, {
239
+ boxPosition: position,
240
+ isActive: isPopupReady,
241
+ onClick: removeClose,
242
+ size: boxSize,
243
+ right: right,
244
+ left: left,
245
+ top: top,
246
+ bottom: bottom,
247
+ isArrow: isArrow,
248
+ isAnimate: true,
249
+ getRef: getContainerRef,
250
+ customClass: {
251
+ customDropBoxWrap: style.dropBoxContainer,
252
+ customDropBox: dropBoxClass
253
+ },
254
+ needResponsive: needResponsive,
255
+ isResponsivePadding: true,
256
+ needFocusScope: true,
257
+ onClose: this.handleTogglePopup,
258
+ dataId: `${dataId}_dropbox`,
259
+ isAbsolutePositioningNeeded: isAbsolutePositioningNeeded,
260
+ isRestrictScroll: isRestrictScroll,
261
+ positionsOffset: positionsOffset,
262
+ targetOffset: targetOffset,
263
+ customProps: {
264
+ focusScopeProps: {
265
+ loadNextOptions: getNextOptions,
266
+ searchValue: searchString,
267
+ isFetchingOptions: isFetchingOptions
272
268
  }
273
- }, /*#__PURE__*/React.createElement(React.Fragment, null, isSearch ? /*#__PURE__*/React.createElement(Box, {
274
- className: style.search
275
- }, /*#__PURE__*/React.createElement(TextBoxIcon, {
276
- placeHolder: placeHolderText,
277
- onChange: this.handleChange,
278
- value: searchString,
279
- onClear: this.onSearchClear,
280
- size: searchBoxSize,
281
- customProps: {
282
- TextBoxProps: {
283
- 'data-a11y-autofocus': true
284
- }
285
- },
286
- a11y: {
287
- ariaHaspopup: isSearch ? 'listbox' : 'menu',
288
- ariaExpanded: isPopupReady,
289
- role: 'combobox',
290
- ariaActivedescendant: isPopupReady ? value : '',
291
- ariaOwns: ariaTitleId
292
- },
293
- dataId: `${dataId}_search`
294
- })) : null, title && options.length != 0 && /*#__PURE__*/React.createElement(Box, {
295
- className: style.title
296
- }, /*#__PURE__*/React.createElement(DropDownHeading, {
297
- htmlId: ariaTitleId,
298
- text: title,
269
+ }
270
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, isSearch ? /*#__PURE__*/React.createElement(Box, {
271
+ className: style.search
272
+ }, /*#__PURE__*/React.createElement(TextBoxIcon, {
273
+ placeHolder: placeHolderText,
274
+ onChange: this.handleChange,
275
+ value: searchString,
276
+ onClear: this.onSearchClear,
277
+ size: searchBoxSize,
278
+ customProps: {
279
+ TextBoxProps: {
280
+ 'data-a11y-autofocus': true
281
+ }
282
+ },
283
+ a11y: {
284
+ ariaHaspopup: isSearch ? 'listbox' : 'menu',
285
+ ariaExpanded: isPopupReady,
286
+ role: 'combobox',
287
+ ariaActivedescendant: isPopupReady ? value : '',
288
+ ariaOwns: ariaTitleId
289
+ },
290
+ dataId: `${dataId}_search`
291
+ })) : null, title && options.length != 0 && /*#__PURE__*/React.createElement(Box, {
292
+ className: style.title
293
+ }, /*#__PURE__*/React.createElement(DropDownHeading, {
294
+ htmlId: ariaTitleId,
295
+ text: title,
296
+ a11y: {
297
+ role: 'heading'
298
+ }
299
+ })), /*#__PURE__*/React.createElement(Box, {
300
+ scroll: "vertical",
301
+ flexible: true,
302
+ shrink: true,
303
+ dataId: `${dataId}_list`,
304
+ preventParentScroll: "vertical",
305
+ className: `${tabletMode ? style.responsivemaxHgt : style.maxHgt}`,
306
+ onScroll: this.handleScroll,
307
+ role: isSearch ? 'listbox' : 'menu',
308
+ tabindex: "-1",
309
+ isScrollAttribute: true
310
+ }, options.length != 0 && isDataLoaded ? /*#__PURE__*/React.createElement(React.Fragment, null, options.map((item, i) => {
311
+ const listItemText = item[keyName];
312
+ const isActive = value === listItemText;
313
+ return /*#__PURE__*/React.createElement(StatusListItem, {
314
+ key: i,
315
+ dataId: `dataid_${i}`,
316
+ value: listItemText,
317
+ id: item[idName],
318
+ active: isActive,
319
+ onClick: this.onSelect.bind(this, item),
320
+ index: i,
321
+ needTick: needTick,
322
+ needBorder: false,
323
+ bulletColor: item[statusColor],
324
+ title: listItemText,
325
+ needMultiLineText: needMultiLineText,
326
+ autoHover: true,
299
327
  a11y: {
300
- role: 'heading'
328
+ role: isSearch ? 'option' : 'menuitem',
329
+ ariaSelected: isActive,
330
+ ariaLabel: listItemText
301
331
  }
302
- })), /*#__PURE__*/React.createElement(Box, {
303
- scroll: "vertical",
304
- flexible: true,
305
- shrink: true,
306
- dataId: `${dataId}_list`,
307
- preventParentScroll: "vertical",
308
- className: `${tabletMode ? style.responsivemaxHgt : style.maxHgt}`,
309
- onScroll: this.handleScroll,
310
- role: isSearch ? 'listbox' : 'menu',
311
- tabindex: "-1",
312
- isScrollAttribute: true
313
- }, options.length != 0 && isDataLoaded ? /*#__PURE__*/React.createElement(React.Fragment, null, options.map((item, i) => {
314
- const listItemText = item[keyName];
315
- const isActive = value === listItemText;
316
- return /*#__PURE__*/React.createElement(StatusListItem, {
317
- key: i,
318
- dataId: `dataid_${i}`,
319
- value: listItemText,
320
- id: item[idName],
321
- active: isActive,
322
- onClick: this.onSelect.bind(this, item),
323
- index: i,
324
- needTick: needTick,
325
- needBorder: false,
326
- bulletColor: item[statusColor],
327
- title: listItemText,
328
- needMultiLineText: needMultiLineText,
329
- autoHover: true,
330
- a11y: {
331
- role: isSearch ? 'option' : 'menuitem',
332
- ariaSelected: isActive,
333
- ariaLabel: listItemText
334
- }
335
- });
336
- }), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
337
- isCover: false,
338
- align: "both"
339
- }, /*#__PURE__*/React.createElement(Loader, null))) : isDataLoaded ? /*#__PURE__*/React.createElement(CommonEmptyState, {
340
- className: style.svgWrapper,
341
- title: searchErrorText || 'No results',
342
- description: searchEmptyHint,
343
- size: "small",
344
- getEmptyState: this.emptySearchSVG
345
- }) : /*#__PURE__*/React.createElement("div", {
346
- className: style.loader
347
- }, /*#__PURE__*/React.createElement(Loader, null))), renderFooterElement ? renderFooterElement : null));
348
- }) : null);
332
+ });
333
+ }), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
334
+ isCover: false,
335
+ align: "both"
336
+ }, /*#__PURE__*/React.createElement(Loader, null))) : isDataLoaded ? /*#__PURE__*/React.createElement(CommonEmptyState, {
337
+ className: style.svgWrapper,
338
+ title: searchErrorText || 'No results',
339
+ description: searchEmptyHint,
340
+ size: "small",
341
+ getEmptyState: this.emptySearchSVG
342
+ }) : /*#__PURE__*/React.createElement("div", {
343
+ className: style.loader
344
+ }, /*#__PURE__*/React.createElement(Loader, null))), renderFooterElement ? renderFooterElement : null))) : null);
349
345
  }
350
346
 
351
347
  } // if (__DOCS__) {
@@ -8,10 +8,9 @@ describe('StatusDropdown', () => {
8
8
  } = render( /*#__PURE__*/React.createElement(StatusDropdown, null));
9
9
  expect(asFragment()).toMatchSnapshot();
10
10
  }), test('rendering target element', () => {
11
- const renderTargetElement = _ref => {
12
- let {
13
- isPopupOpen
14
- } = _ref;
11
+ const renderTargetElement = ({
12
+ isPopupOpen
13
+ }) => {
15
14
  return /*#__PURE__*/React.createElement("div", {
16
15
  className: isPopupOpen ? 'popupOpened' : 'popupClosed'
17
16
  }, "Target Element");
@@ -60,11 +60,10 @@ export default class Search extends Component {
60
60
  getRef && getRef(el);
61
61
  }
62
62
 
63
- handleRenderChildren(_ref) {
64
- let {
65
- isActive,
66
- isFocus
67
- } = _ref;
63
+ handleRenderChildren({
64
+ isActive,
65
+ isFocus
66
+ }) {
68
67
  const {
69
68
  value,
70
69
  selectedId,
@@ -48,10 +48,9 @@ describe('Search', () => {
48
48
  id: '5'
49
49
  }];
50
50
 
51
- function renderChildren(_ref) {
52
- let {
53
- value
54
- } = _ref;
51
+ function renderChildren({
52
+ value
53
+ }) {
55
54
  return /*#__PURE__*/React.createElement("div", null, value);
56
55
  }
57
56
 
@@ -39,10 +39,9 @@ class DropDown extends SelectComponent {
39
39
  }
40
40
  }
41
41
 
42
- responsiveFunc(_ref) {
43
- let {
44
- mediaQueryOR
45
- } = _ref;
42
+ responsiveFunc({
43
+ mediaQueryOR
44
+ }) {
46
45
  return {
47
46
  tabletMode: mediaQueryOR([{
48
47
  maxWidth: 700
@@ -51,8 +50,6 @@ class DropDown extends SelectComponent {
51
50
  }
52
51
 
53
52
  render() {
54
- var _this = this;
55
-
56
53
  const {
57
54
  needSearch,
58
55
  dropBoxSize,
@@ -106,75 +103,70 @@ class DropDown extends SelectComponent {
106
103
  }))), isPopupOpen ? /*#__PURE__*/React.createElement(ResponsiveReceiver, {
107
104
  query: this.responsiveFunc,
108
105
  responsiveId: "Helmet"
109
- }, _ref2 => {
110
- let {
111
- tabletMode
112
- } = _ref2;
113
- return /*#__PURE__*/React.createElement(ResponsiveDropBox, {
114
- isAnimate: true,
115
- isArrow: false,
116
- isActive: isPopupReady,
117
- boxPosition: position || `${defaultDropBoxPosition}Center`,
118
- getRef: getContainerRef,
119
- onClick: removeClose,
120
- animationStyle: animationStyle,
121
- size: "large",
122
- alignBox: "row",
123
- isResponsivePadding: true,
124
- dataId: `${dataId}_dropbox`,
125
- isAbsolutePositioningNeeded: isAbsolutePositioningNeeded,
126
- isRestrictScroll: isRestrictScroll,
127
- positionsOffset: positionsOffset,
128
- targetOffset: targetOffset
129
- }, /*#__PURE__*/React.createElement(Box, {
130
- flexible: true
131
- }, /*#__PURE__*/React.createElement(Card, null, needSearch ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(DropDownSearch, {
132
- value: searchStr,
133
- onChange: this.handleSearch,
134
- onKeyDown: this.onSearchKeyDown,
135
- getRef: this.searchInputRef,
136
- size: searchBoxSize,
137
- variant: searchBoxVariant,
138
- placeHolder: searchBoxPlaceHolder,
139
- maxLength: maxLength,
140
- dataId: `${dataId}_search`
141
- })) : null, /*#__PURE__*/React.createElement(CardContent, {
142
- shrink: true,
143
- eleRef: this.suggestionContainerRef,
144
- customClass: !tabletMode && dropBoxSize ? style[dropBoxSize] : ''
145
- }, suggestions.length ? /*#__PURE__*/React.createElement("div", {
146
- className: style.listItemContainer,
147
- "data-id": `${dataId}_Options`
148
- }, suggestions.map(function () {
149
- let option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
150
- let index = arguments.length > 1 ? arguments[1] : undefined;
151
- const {
152
- id,
153
- value
154
- } = option;
155
- return /*#__PURE__*/React.createElement(ListItem, {
156
- active: id === selectedId,
157
- getRef: _this.suggestionItemRef,
158
- highlight: hoverIndex === index ? true : false,
159
- id: id,
160
- key: `${id}dropDown`,
161
- onClick: _this.handleChange,
162
- onMouseEnter: _this.handleMouseEnter,
163
- size: "medium",
164
- value: value,
165
- index: index,
166
- needTick: true,
167
- needBorder: false
168
- });
169
- })) : isFetchingOptions ? /*#__PURE__*/React.createElement(Container, {
170
- align: "both",
171
- className: style.loader
172
- }, /*#__PURE__*/React.createElement(Loader, null)) : searchStr ? /*#__PURE__*/React.createElement("div", {
173
- className: style.emptyState
174
- }, searchEmptyMessage || emptyMessage) : /*#__PURE__*/React.createElement("div", {
175
- className: style.emptyState
176
- }, emptyMessage)))));
177
- }) : null);
106
+ }, ({
107
+ tabletMode
108
+ }) => /*#__PURE__*/React.createElement(ResponsiveDropBox, {
109
+ isAnimate: true,
110
+ isArrow: false,
111
+ isActive: isPopupReady,
112
+ boxPosition: position || `${defaultDropBoxPosition}Center`,
113
+ getRef: getContainerRef,
114
+ onClick: removeClose,
115
+ animationStyle: animationStyle,
116
+ size: "large",
117
+ alignBox: "row",
118
+ isResponsivePadding: true,
119
+ dataId: `${dataId}_dropbox`,
120
+ isAbsolutePositioningNeeded: isAbsolutePositioningNeeded,
121
+ isRestrictScroll: isRestrictScroll,
122
+ positionsOffset: positionsOffset,
123
+ targetOffset: targetOffset
124
+ }, /*#__PURE__*/React.createElement(Box, {
125
+ flexible: true
126
+ }, /*#__PURE__*/React.createElement(Card, null, needSearch ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(DropDownSearch, {
127
+ value: searchStr,
128
+ onChange: this.handleSearch,
129
+ onKeyDown: this.onSearchKeyDown,
130
+ getRef: this.searchInputRef,
131
+ size: searchBoxSize,
132
+ variant: searchBoxVariant,
133
+ placeHolder: searchBoxPlaceHolder,
134
+ maxLength: maxLength,
135
+ dataId: `${dataId}_search`
136
+ })) : null, /*#__PURE__*/React.createElement(CardContent, {
137
+ shrink: true,
138
+ eleRef: this.suggestionContainerRef,
139
+ customClass: !tabletMode && dropBoxSize ? style[dropBoxSize] : ''
140
+ }, suggestions.length ? /*#__PURE__*/React.createElement("div", {
141
+ className: style.listItemContainer,
142
+ "data-id": `${dataId}_Options`
143
+ }, suggestions.map((option = {}, index) => {
144
+ const {
145
+ id,
146
+ value
147
+ } = option;
148
+ return /*#__PURE__*/React.createElement(ListItem, {
149
+ active: id === selectedId,
150
+ getRef: this.suggestionItemRef,
151
+ highlight: hoverIndex === index ? true : false,
152
+ id: id,
153
+ key: `${id}dropDown`,
154
+ onClick: this.handleChange,
155
+ onMouseEnter: this.handleMouseEnter,
156
+ size: "medium",
157
+ value: value,
158
+ index: index,
159
+ needTick: true,
160
+ needBorder: false
161
+ });
162
+ })) : isFetchingOptions ? /*#__PURE__*/React.createElement(Container, {
163
+ align: "both",
164
+ className: style.loader
165
+ }, /*#__PURE__*/React.createElement(Loader, null)) : searchStr ? /*#__PURE__*/React.createElement("div", {
166
+ className: style.emptyState
167
+ }, searchEmptyMessage || emptyMessage) : /*#__PURE__*/React.createElement("div", {
168
+ className: style.emptyState
169
+ }, emptyMessage)))))) : null);
178
170
  }
179
171
 
180
172
  }
@@ -3,9 +3,7 @@ export function stopBubbling(event) {
3
3
  event.stopPropagation && event.stopPropagation();
4
4
  event.nativeEvent && event.nativeEvent.stopImmediatePropagation && event.nativeEvent.stopImmediatePropagation();
5
5
  }
6
- export function getFullName() {
7
- let firstName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
8
- let lastName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
6
+ export function getFullName(firstName = '', lastName = '') {
9
7
  let fullName = '';
10
8
 
11
9
  if (firstName !== null && firstName !== '') {
@@ -18,10 +16,7 @@ export function getFullName() {
18
16
 
19
17
  return fullName;
20
18
  }
21
- export function shallowDiff() {
22
- let a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
23
- let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24
-
19
+ export function shallowDiff(a = {}, b = {}) {
25
20
  for (let i in a) {
26
21
  if (!(i in b)) {
27
22
  return true;
@@ -176,11 +176,7 @@ export function loadResource(url, type, id, callback) {
176
176
  });
177
177
  } // bind
178
178
 
179
- export function bind() {
180
- for (var _len = arguments.length, handlers = new Array(_len), _key = 0; _key < _len; _key++) {
181
- handlers[_key] = arguments[_key];
182
- }
183
-
179
+ export function bind(...handlers) {
184
180
  handlers.forEach(handler => {
185
181
  if (__DEVELOPMENT__) {
186
182
  if (!this[handler]) {
@@ -2,7 +2,8 @@ import React, { useRef } from 'react'; //AlertDependencies
2
2
 
3
3
  import { Container, Box } from '@zohodesk/components/es/Layout';
4
4
  import AlertClose from "../../AlertClose/AlertClose";
5
- import AlertIcons from "../../alertIcons/AlertIcons"; //CSS
5
+ import AlertIcons from "../../alertIcons/AlertIcons";
6
+ import renderNode from '@zohodesk/utils/es/renderNode'; //CSS
6
7
 
7
8
  import style from "./css/AlertHeaderNew.module.css";
8
9
  import cssJSLogic from "./css/cssJSLogic";
@@ -24,7 +25,8 @@ export default function AlertHeader(props) {
24
25
  type,
25
26
  htmlId,
26
27
  customStyle,
27
- dragBoundaryLimit
28
+ dragBoundaryLimit,
29
+ renderAlertIcon
28
30
  } = props;
29
31
  const finalStyle = mergeStyle(style, customStyle);
30
32
  const {
@@ -51,7 +53,7 @@ export default function AlertHeader(props) {
51
53
  eleRef: dragRef
52
54
  }, needIcon && /*#__PURE__*/React.createElement("div", {
53
55
  className: finalStyle.iconContainer
54
- }, /*#__PURE__*/React.createElement(AlertIcons, {
56
+ }, renderNode(renderAlertIcon) || /*#__PURE__*/React.createElement(AlertIcons, {
55
57
  type: type
56
58
  })), (title || children) && /*#__PURE__*/React.createElement(Box, {
57
59
  flexible: true
@@ -8,4 +8,28 @@ describe('AlertHeader', () => {
8
8
  } = render( /*#__PURE__*/React.createElement(AlertHeader, null));
9
9
  expect(asFragment()).toMatchSnapshot();
10
10
  });
11
+ test('renders custom renderAlertIcon when needIcon is true', () => {
12
+ const customIcon = /*#__PURE__*/React.createElement("span", {
13
+ "data-test-id": "custom-icon"
14
+ }, "icon");
15
+ const {
16
+ asFragment
17
+ } = render( /*#__PURE__*/React.createElement(AlertHeader, {
18
+ needIcon: true,
19
+ renderAlertIcon: customIcon
20
+ }));
21
+ expect(asFragment()).toMatchSnapshot();
22
+ });
23
+ test('does not render custom renderAlertIcon when needIcon is false', () => {
24
+ const customIcon = /*#__PURE__*/React.createElement("span", {
25
+ "data-test-id": "custom-icon"
26
+ }, "icon");
27
+ const {
28
+ asFragment
29
+ } = render( /*#__PURE__*/React.createElement(AlertHeader, {
30
+ needIcon: false,
31
+ renderAlertIcon: customIcon
32
+ }));
33
+ expect(asFragment()).toMatchSnapshot();
34
+ });
11
35
  });
@@ -1,5 +1,17 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`AlertHeader does not render custom renderAlertIcon when needIcon is false 1`] = `
4
+ <DocumentFragment>
5
+ <div
6
+ class="container danger flex rowdir wrap vCenter"
7
+ data-drag-hook="true"
8
+ data-id="containerComponent"
9
+ data-selector-id="container"
10
+ data-test-id="containerComponent"
11
+ />
12
+ </DocumentFragment>
13
+ `;
14
+
3
15
  exports[`AlertHeader rendering the defult props 1`] = `
4
16
  <DocumentFragment>
5
17
  <div
@@ -86,3 +98,25 @@ exports[`AlertHeader rendering the defult props 1`] = `
86
98
  </div>
87
99
  </DocumentFragment>
88
100
  `;
101
+
102
+ exports[`AlertHeader renders custom renderAlertIcon when needIcon is true 1`] = `
103
+ <DocumentFragment>
104
+ <div
105
+ class="container danger flex rowdir wrap vCenter"
106
+ data-drag-hook="true"
107
+ data-id="containerComponent"
108
+ data-selector-id="container"
109
+ data-test-id="containerComponent"
110
+ >
111
+ <div
112
+ class="iconContainer"
113
+ >
114
+ <span
115
+ data-test-id="custom-icon"
116
+ >
117
+ icon
118
+ </span>
119
+ </div>
120
+ </div>
121
+ </DocumentFragment>
122
+ `;
@@ -1,9 +1,8 @@
1
1
  import { compileClassNames } from '@zohodesk/utils';
2
- export default function cssJSLogic(_ref) {
3
- let {
4
- props,
5
- style
6
- } = _ref;
2
+ export default function cssJSLogic({
3
+ props,
4
+ style
5
+ }) {
7
6
  let {
8
7
  children,
9
8
  type,
@@ -15,5 +15,6 @@ export default {
15
15
  left: PropTypes.number,
16
16
  right: PropTypes.number,
17
17
  bottom: PropTypes.number
18
- })
18
+ }),
19
+ renderAlertIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.node])
19
20
  };