@zohodesk/dot 1.0.0-temp-230.2 → 1.0.0-temp-232

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 (63) hide show
  1. package/README.md +2 -11
  2. package/es/ActionButton/__tests__/ActionButton.spec.js +4 -5
  3. package/es/AttachmentViewer/AttachmentImage.js +1 -3
  4. package/es/AttachmentViewer/AttachmentViewer.js +252 -358
  5. package/es/AttachmentViewer/AttachmentViewer.module.css +1 -1
  6. package/es/AttachmentViewer/props/defaultProps.js +1 -2
  7. package/es/AttachmentViewer/props/propTypes.js +1 -9
  8. package/es/AttachmentViewer/utils.js +6 -7
  9. package/es/AudioPlayer/utils/utils.js +2 -5
  10. package/es/DotProvider/hooks/useDotProvider.js +14 -15
  11. package/es/DotProvider/hooks/useDownloadAssetsAndSetAttr.js +21 -16
  12. package/es/DotProvider/utils/assetPromiseHandlers/themeAppearanceAssetPromise.js +3 -4
  13. package/es/DotProvider/utils/assetPromiseHandlers/themeColorAssetPromise.js +4 -5
  14. package/es/DotProvider/utils/errorValidation.js +5 -6
  15. package/es/DotProvider/utils/getAssetsImportPromises.js +4 -5
  16. package/es/Drawer/Drawer.js +6 -8
  17. package/es/FreezeLayer/css/cssJSLogic.js +4 -5
  18. package/es/Hooks/Dragger/useDragger.js +5 -6
  19. package/es/Hooks/Dragger/utils/DraggerUtil.js +7 -8
  20. package/es/Hooks/useFreezeLayer.js +4 -5
  21. package/es/Link/Link.js +3 -4
  22. package/es/Link/props/propTypes.js +0 -1
  23. package/es/Onboarding/CarouselDots/CarouselDots.js +29 -32
  24. package/es/Onboarding/Onboarding.js +23 -24
  25. package/es/Onboarding/hooks/useOnboarding.js +4 -5
  26. package/es/Onboarding/hooks/useOnboardingSlider.js +5 -6
  27. package/es/deprecated/SelectDropdown/SelectDropdown.js +43 -47
  28. package/es/dropdown/ToggleDropDown/ToggleDropDown.js +214 -225
  29. package/es/errorstate/Inconvenience/Inconvenience.js +32 -36
  30. package/es/errorstate/NoRequestFound/NoRequestFound.js +32 -36
  31. package/es/errorstate/PermissionPlay/PermissionPlay.js +31 -35
  32. package/es/errorstate/RequestUrlNotFound/RequestUrlNotFound.js +32 -36
  33. package/es/errorstate/UnableToProcess/UnableToProcess.js +32 -36
  34. package/es/errorstate/UnauthorizedLogin/UnauthorizedLogin.js +32 -36
  35. package/es/errorstate/WillBack/WillBack.js +30 -34
  36. package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +81 -85
  37. package/es/list/status/StatusDropdown/StatusDropdown.js +109 -113
  38. package/es/list/status/StatusDropdown/__tests__/StatusDropdown.spec.js +3 -4
  39. package/es/lookup/header/Search/Search.js +4 -5
  40. package/es/lookup/header/Search/__tests__/Search.spec.js +3 -4
  41. package/es/lookup/header/ViewDropDown/ViewDropDown.js +67 -75
  42. package/es/utils/General.js +2 -7
  43. package/es/utils/editorUtils.js +1 -5
  44. package/es/version2/lookup/AlertHeader/AlertHeader.js +5 -3
  45. package/es/version2/lookup/AlertHeader/__tests__/AlertHeader.spec.js +24 -0
  46. package/es/version2/lookup/AlertHeader/__tests__/__snapshots__/AlertHeader.spec.js.snap +34 -0
  47. package/es/version2/lookup/AlertHeader/css/cssJSLogic.js +4 -5
  48. package/es/version2/lookup/AlertHeader/props/propTypes.js +2 -1
  49. package/es/version2/notification/DesktopNotification/DesktopNotification.js +59 -63
  50. package/es/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.js +40 -44
  51. package/lib/AttachmentViewer/AttachmentImage.js +1 -3
  52. package/lib/AttachmentViewer/AttachmentViewer.js +80 -181
  53. package/lib/AttachmentViewer/AttachmentViewer.module.css +1 -1
  54. package/lib/AttachmentViewer/props/defaultProps.js +1 -2
  55. package/lib/AttachmentViewer/props/propTypes.js +1 -9
  56. package/lib/DotProvider/hooks/useDownloadAssetsAndSetAttr.js +9 -3
  57. package/lib/Link/Link.js +3 -4
  58. package/lib/Link/props/propTypes.js +0 -1
  59. package/lib/version2/lookup/AlertHeader/AlertHeader.js +5 -2
  60. package/lib/version2/lookup/AlertHeader/__tests__/AlertHeader.spec.js +26 -0
  61. package/lib/version2/lookup/AlertHeader/__tests__/__snapshots__/AlertHeader.spec.js.snap +34 -0
  62. package/lib/version2/lookup/AlertHeader/props/propTypes.js +2 -1
  63. package/package.json +7 -7
@@ -120,37 +120,9 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
120
120
  _this.zoomMaintain = _this.zoomMaintain.bind(_assertThisInitialized(_this));
121
121
  _this.handleMenuValidation = _this.handleMenuValidation.bind(_assertThisInitialized(_this));
122
122
  _this.getPreviewIconData = _this.getPreviewIconData.bind(_assertThisInitialized(_this));
123
- _this.renderIframe = _this.renderIframe.bind(_assertThisInitialized(_this)); // this.updateItem = this.updateItem.bind(this);
124
-
123
+ _this.renderIframe = _this.renderIframe.bind(_assertThisInitialized(_this));
125
124
  return _this;
126
- } // updateItem(idOrIndex, changes) {
127
- // if (!changes || typeof changes !== 'object') {
128
- // return false;
129
- // }
130
- // const { data } = this.state;
131
- // const targetIdx = typeof idOrIndex === 'number'
132
- // ? idOrIndex
133
- // : data.findIndex((item) => item && item.id === idOrIndex);
134
- // if (targetIdx < 0 || targetIdx >= data.length) {
135
- // return false;
136
- // }
137
- // this.setState((prevState) => {
138
- // const nextData = prevState.data.slice();
139
- // nextData[targetIdx] = { ...nextData[targetIdx], ...changes };
140
- // let nextDataList = prevState.dataList;
141
- // if (targetIdx < prevState.dataList.length) {
142
- // nextDataList = prevState.dataList.slice();
143
- // nextDataList[targetIdx] = { ...nextDataList[targetIdx], ...changes };
144
- // }
145
- // return { data: nextData, dataList: nextDataList };
146
- // }, () => {
147
- // if (this.state.selectedIndex === targetIdx) {
148
- // this.handleMenuValidation();
149
- // }
150
- // });
151
- // return true;
152
- // }
153
-
125
+ }
154
126
 
155
127
  _createClass(AttachmentViewer, [{
156
128
  key: "isImageFileType",
@@ -187,14 +159,11 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
187
159
  }, {
188
160
  key: "componentDidUpdate",
189
161
  value: function componentDidUpdate(prevProps, prevState) {
190
- var _previewObj$previewDa, _prevState$data$;
191
-
192
162
  var previewObj = this.props.previewObj;
193
163
  var selectedIndex = this.state.selectedIndex;
194
164
  var indexChanged = previewObj.selectedIndex != prevProps.previewObj.selectedIndex;
195
- var attachmentPreviewUrlChanged = ((_previewObj$previewDa = previewObj.previewData[0]) === null || _previewObj$previewDa === void 0 ? void 0 : _previewObj$previewDa.viewUrl) !== ((_prevState$data$ = prevState.data[0]) === null || _prevState$data$ === void 0 ? void 0 : _prevState$data$.viewUrl); // Triggers an update if the previewed attachment is edited by the Attachment Annotator.
196
165
 
197
- if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged || attachmentPreviewUrlChanged) {
166
+ if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged) {
198
167
  var objChanged = previewObj.previewData.some(function (value, index) {
199
168
  return (0, _General.shallowDiff)(value, prevProps.previewObj[index]);
200
169
  });
@@ -213,7 +182,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
213
182
  }
214
183
  }
215
184
 
216
- if (prevState.selectedIndex != selectedIndex || attachmentPreviewUrlChanged) {
185
+ if (prevState.selectedIndex != selectedIndex) {
217
186
  this.handleMenuValidation();
218
187
  }
219
188
  }
@@ -428,96 +397,21 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
428
397
  }, this.props.customProps.iframeProps));
429
398
  }
430
399
  }, {
431
- key: "getRenderImageFrameCustomClass",
432
- value: function getRenderImageFrameCustomClass(_ref3) {
433
- var canZoom = _ref3.canZoom,
434
- retainZoom = _ref3.retainZoom,
435
- isZoomed = _ref3.isZoomed,
436
- customImageClass = _ref3.customImageClass,
437
- customChildrenClass = _ref3.customChildrenClass;
438
- return {
439
- customImageClass: "".concat(_AttachmentViewerModule["default"].img, " ").concat(_AttachmentViewerModule["default"].altText, " ").concat(canZoom || retainZoom ? isZoomed ? "".concat(_AttachmentViewerModule["default"].zoomedImg, " ").concat(_AttachmentViewerModule["default"].zoomOutCursor) : "".concat(_AttachmentViewerModule["default"].normalImg, " ").concat(_AttachmentViewerModule["default"].zoomInCursor) : '', " ").concat(customImageClass),
440
- customChildrenClass: customChildrenClass
441
- };
442
- }
443
- }, {
444
- key: "renderImageFrame",
445
- value: function renderImageFrame(data, i) {
400
+ key: "imgPreviewView",
401
+ value: function imgPreviewView(downloadUrl) {
446
402
  var _this5 = this;
447
403
 
448
404
  var _this$state3 = this.state,
405
+ dataList = _this$state3.dataList,
449
406
  selectedIndex = _this$state3.selectedIndex,
450
407
  isZoomed = _this$state3.isZoomed,
451
408
  canZoom = _this$state3.canZoom,
452
409
  isPreviewAttachmentValid = _this$state3.isPreviewAttachmentValid;
453
410
  var _this$props = this.props,
454
411
  maintainZoom = _this$props.maintainZoom,
455
- renderCustomImagePreviewElement = _this$props.renderCustomImagePreviewElement;
456
- var viewUrl = data.viewUrl,
457
- name = data.name,
458
- children = data.children,
459
- _data$dataId = data.dataId,
460
- dataId = _data$dataId === void 0 ? 'attachViewer' : _data$dataId,
461
- _data$customClass = data.customClass,
462
- customClass = _data$customClass === void 0 ? {} : _data$customClass,
463
- _data$customProps = data.customProps,
464
- customProps = _data$customProps === void 0 ? {} : _data$customProps,
465
- imageRef = data.imageRef;
466
- var _customProps$imagePro = customProps.imageProps,
467
- imageProps = _customProps$imagePro === void 0 ? {} : _customProps$imagePro;
468
- var _customClass$customIm = customClass.customImageClass,
469
- customImageClass = _customClass$customIm === void 0 ? '' : _customClass$customIm,
470
- _customClass$customCh = customClass.customChildrenClass,
471
- customChildrenClass = _customClass$customCh === void 0 ? '' : _customClass$customCh;
472
- var resolvedImageRef = imageRef;
473
- var retainZoom = canZoom && selectedIndex == i && maintainZoom;
474
- var handleZoomOut = isPreviewAttachmentValid && isZoomed ? this.zoomOut.bind(this, i) : undefined;
475
- var handleZoomIn = isPreviewAttachmentValid && !isZoomed ? function (e) {
476
- return _this5.zoomIn(e, i, true);
477
- } : undefined;
478
- var handleImageClick = isPreviewAttachmentValid ? isZoomed ? handleZoomOut : handleZoomIn : undefined;
479
- var imageFrameCustomClass = this.getRenderImageFrameCustomClass({
480
- canZoom: canZoom,
481
- retainZoom: retainZoom,
482
- isZoomed: isZoomed,
483
- customImageClass: customImageClass,
484
- customChildrenClass: customChildrenClass
485
- });
486
-
487
- var img = /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
488
- customClass: imageFrameCustomClass,
489
- src: viewUrl,
490
- onClick: handleImageClick,
491
- alt: name,
492
- dataId: dataId,
493
- id: "img".concat(i),
494
- isCover: false
495
- }, imageProps, {
496
- imageRef: resolvedImageRef
497
- }), children);
498
-
499
- return typeof renderCustomImagePreviewElement === 'function' ? renderCustomImagePreviewElement({
500
- defaultView: img,
501
- data: data,
502
- index: i
503
- }) : img;
504
- }
505
- }, {
506
- key: "imgPreviewView",
507
- value: function imgPreviewView(downloadUrl) {
508
- var _this6 = this;
509
-
510
- var _this$state4 = this.state,
511
- dataList = _this$state4.dataList,
512
- selectedIndex = _this$state4.selectedIndex,
513
- isZoomed = _this$state4.isZoomed,
514
- canZoom = _this$state4.canZoom,
515
- isPreviewAttachmentValid = _this$state4.isPreviewAttachmentValid;
516
- var _this$props2 = this.props,
517
- maintainZoom = _this$props2.maintainZoom,
518
- dataId = _this$props2.dataId,
519
- i18nKeys = _this$props2.i18nKeys,
520
- renderUnSupportedElement = _this$props2.renderUnSupportedElement;
412
+ dataId = _this$props.dataId,
413
+ i18nKeys = _this$props.i18nKeys,
414
+ renderUnSupportedElement = _this$props.renderUnSupportedElement;
521
415
 
522
416
  var getImgStyle = function getImgStyle(i) {
523
417
  var position;
@@ -550,24 +444,24 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
550
444
  var viewUrl = data.viewUrl,
551
445
  name = data.name,
552
446
  children = data.children,
553
- _data$dataId2 = data.dataId,
554
- dataId = _data$dataId2 === void 0 ? 'attachViewer' : _data$dataId2,
555
- _data$customClass2 = data.customClass,
556
- customClass = _data$customClass2 === void 0 ? {} : _data$customClass2,
557
- _data$customProps2 = data.customProps,
558
- customProps = _data$customProps2 === void 0 ? {} : _data$customProps2,
447
+ _data$dataId = data.dataId,
448
+ dataId = _data$dataId === void 0 ? 'attachViewer' : _data$dataId,
449
+ _data$customClass = data.customClass,
450
+ customClass = _data$customClass === void 0 ? {} : _data$customClass,
451
+ _data$customProps = data.customProps,
452
+ customProps = _data$customProps === void 0 ? {} : _data$customProps,
559
453
  previewurl = data.previewurl,
560
454
  type = data.type;
561
455
  var _customProps$audioPro = customProps.audioProps,
562
456
  audioProps = _customProps$audioPro === void 0 ? {} : _customProps$audioPro,
563
- _customProps$imagePro2 = customProps.imageProps,
564
- imageProps = _customProps$imagePro2 === void 0 ? {} : _customProps$imagePro2,
457
+ _customProps$imagePro = customProps.imageProps,
458
+ imageProps = _customProps$imagePro === void 0 ? {} : _customProps$imagePro,
565
459
  _customProps$videoPro = customProps.videoProps,
566
460
  videoProps = _customProps$videoPro === void 0 ? {} : _customProps$videoPro;
567
- var _customClass$customIm2 = customClass.customImageClass,
568
- customImageClass = _customClass$customIm2 === void 0 ? '' : _customClass$customIm2,
569
- _customClass$customCh2 = customClass.customChildrenClass,
570
- customChildrenClass = _customClass$customCh2 === void 0 ? '' : _customClass$customCh2;
461
+ var _customClass$customIm = customClass.customImageClass,
462
+ customImageClass = _customClass$customIm === void 0 ? '' : _customClass$customIm,
463
+ _customClass$customCh = customClass.customChildrenClass,
464
+ customChildrenClass = _customClass$customCh === void 0 ? '' : _customClass$customCh;
571
465
  var retainZoom = canZoom && selectedIndex == i && maintainZoom;
572
466
  var extension = (0, _Attachment.getExtensionFromFileName)(name);
573
467
  var _i18nKeys$previewUnsu = i18nKeys.previewUnsupportedText,
@@ -584,7 +478,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
584
478
  }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
585
479
  className: _AttachmentViewerModule["default"].imgRef,
586
480
  id: "imgPreviewRef".concat(i)
587
- }, selectedIndex == i && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _this6.isAudioFileType(name) ? /*#__PURE__*/_react["default"].createElement("audio", _extends({
481
+ }, selectedIndex == i && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _this5.isAudioFileType(name) ? /*#__PURE__*/_react["default"].createElement("audio", _extends({
588
482
  controls: true,
589
483
  className: _AttachmentViewerModule["default"].zoomIn,
590
484
  "data-id": "".concat(dataId, "_audioPreview"),
@@ -592,7 +486,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
592
486
  }, audioProps), /*#__PURE__*/_react["default"].createElement("source", {
593
487
  src: previewurl || viewUrl,
594
488
  type: "audio/".concat(extension)
595
- })) : _this6.isVideoFileType(name) ? /*#__PURE__*/_react["default"].createElement("video", _extends({
489
+ })) : _this5.isVideoFileType(name) ? /*#__PURE__*/_react["default"].createElement("video", _extends({
596
490
  controls: true,
597
491
  className: _AttachmentViewerModule["default"].zoomIn,
598
492
  "data-id": "".concat(dataId, "_videoPreview"),
@@ -600,19 +494,31 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
600
494
  }, videoProps), /*#__PURE__*/_react["default"].createElement("source", {
601
495
  src: viewUrl,
602
496
  type: "video/".concat(extension)
603
- })) : _this6.isImageFileType(name) || children ? _this6.renderImageFrame(data, i) : type === "document" && previewurl != null ? _this6.renderIframe(previewurl) : typeof renderUnSupportedElement === 'function' ? renderUnSupportedElement(data) : /*#__PURE__*/_react["default"].createElement("div", {
497
+ })) : _this5.isImageFileType(name) || children ? /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
498
+ customClass: {
499
+ customImageClass: "".concat(_AttachmentViewerModule["default"].img, " ").concat(_AttachmentViewerModule["default"].altText, " ").concat(canZoom || retainZoom ? isZoomed ? "".concat(_AttachmentViewerModule["default"].zoomedImg, " ").concat(_AttachmentViewerModule["default"].zoomOutCursor) : "".concat(_AttachmentViewerModule["default"].normalImg, " ").concat(_AttachmentViewerModule["default"].zoomInCursor) : '', " ").concat(customImageClass),
500
+ customChildrenClass: customChildrenClass
501
+ },
502
+ src: viewUrl,
503
+ onClick: isPreviewAttachmentValid ? isZoomed ? _this5.zoomOut.bind(_this5, i) : function (e) {
504
+ return _this5.zoomIn(e, i, true);
505
+ } : undefined,
506
+ alt: name,
507
+ dataId: dataId,
508
+ id: "img".concat(i),
509
+ isCover: false
510
+ }, imageProps), children) : type === "document" && previewurl != null ? _this5.renderIframe(previewurl) : typeof renderUnSupportedElement === 'function' ? renderUnSupportedElement(data) : /*#__PURE__*/_react["default"].createElement("div", {
604
511
  className: _AttachmentViewerModule["default"].previewNone
605
512
  }, /*#__PURE__*/_react["default"].createElement("div", {
606
513
  className: _AttachmentViewerModule["default"].fileTypeImg
607
- }, _this6.getPreviewIconData(name, '70')), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
514
+ }, _this5.getPreviewIconData(name, '70')), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
608
515
  $ui_size: "20",
609
516
  $ui_weight: "semibold"
610
517
  }, previewUnsupportedText), downloadUrl ? /*#__PURE__*/_react["default"].createElement(_Link["default"], {
611
518
  href: downloadUrl,
612
- download: true,
613
- downloadName: name,
614
519
  className: _AttachmentViewerModule["default"].downloadLink,
615
- hasReload: true
520
+ hasReload: true,
521
+ download: true
616
522
  }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
617
523
  palette: "primaryFilled",
618
524
  text: downloadText
@@ -622,24 +528,22 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
622
528
  }, {
623
529
  key: "render",
624
530
  value: function render() {
625
- var _this7 = this;
626
-
627
- var _this$state5 = this.state,
628
- isPViewListOpen = _this$state5.isPViewListOpen,
629
- selectedIndex = _this$state5.selectedIndex,
630
- data = _this$state5.data,
631
- isZoomed = _this$state5.isZoomed,
632
- canZoom = _this$state5.canZoom,
633
- canOpenInNewTab = _this$state5.canOpenInNewTab;
634
- var _this$props3 = this.props,
635
- responsiveId = _this$props3.responsiveId,
636
- needDownload = _this$props3.needDownload,
637
- i18nKeys = _this$props3.i18nKeys,
638
- isActive = _this$props3.isActive,
639
- dataId = _this$props3.dataId,
640
- customProps = _this$props3.customProps,
641
- showCount = _this$props3.showCount,
642
- renderCustomIcons = _this$props3.renderCustomIcons;
531
+ var _this6 = this;
532
+
533
+ var _this$state4 = this.state,
534
+ isPViewListOpen = _this$state4.isPViewListOpen,
535
+ selectedIndex = _this$state4.selectedIndex,
536
+ data = _this$state4.data,
537
+ isZoomed = _this$state4.isZoomed,
538
+ canZoom = _this$state4.canZoom,
539
+ canOpenInNewTab = _this$state4.canOpenInNewTab;
540
+ var _this$props2 = this.props,
541
+ responsiveId = _this$props2.responsiveId,
542
+ needDownload = _this$props2.needDownload,
543
+ i18nKeys = _this$props2.i18nKeys,
544
+ isActive = _this$props2.isActive,
545
+ dataId = _this$props2.dataId,
546
+ customProps = _this$props2.customProps;
643
547
  var _customProps$avatarPr = customProps.avatarProps,
644
548
  avatarProps = _customProps$avatarPr === void 0 ? {} : _customProps$avatarPr;
645
549
  var totalLen = data.length;
@@ -649,8 +553,8 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
649
553
  var authorHref;
650
554
  var authorName;
651
555
 
652
- var _ref4 = data[selectedIndex] ? data[selectedIndex] : {},
653
- author = _ref4.author;
556
+ var _ref3 = data[selectedIndex] ? data[selectedIndex] : {},
557
+ author = _ref3.author;
654
558
 
655
559
  if (author) {
656
560
  authorHref = author.href;
@@ -665,8 +569,8 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
665
569
  }, /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
666
570
  responsiveId: responsiveId,
667
571
  query: this.responsiveFunc
668
- }, function (_ref5) {
669
- var uptoTablet = _ref5.uptoTablet;
572
+ }, function (_ref4) {
573
+ var uptoTablet = _ref4.uptoTablet;
670
574
  return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
671
575
  scroll: "none",
672
576
  "data-scroll-palette": "dark"
@@ -681,7 +585,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
681
585
  "data-title": selectedAttachment.name,
682
586
  dataId: "attachName",
683
587
  id: ariaId
684
- }, selectedAttachment.name), showCount && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
588
+ }, selectedAttachment.name), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
685
589
  flexible: true,
686
590
  className: _AttachmentViewerModule["default"].count,
687
591
  dataId: "attachCountContainer"
@@ -693,13 +597,9 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
693
597
  align: uptoTablet ? 'bottom' : 'center',
694
598
  wrap: "wrap",
695
599
  isCover: false
696
- }, typeof renderCustomIcons === 'function' && renderCustomIcons({
697
- selectedAttachment: selectedAttachment,
698
- selectedIndex: selectedIndex,
699
- totalLen: totalLen
700
- }), canZoom ? isZoomed ? /*#__PURE__*/_react["default"].createElement("div", {
600
+ }, canZoom ? isZoomed ? /*#__PURE__*/_react["default"].createElement("div", {
701
601
  className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
702
- onClick: _this7.zoomOut.bind(_this7, selectedIndex),
602
+ onClick: _this6.zoomOut.bind(_this6, selectedIndex),
703
603
  "data-id": "zoomOut",
704
604
  "data-test-id": "zoomOut",
705
605
  "data-title": i18nKeys.zoomOutText
@@ -714,7 +614,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
714
614
  })) : /*#__PURE__*/_react["default"].createElement("div", {
715
615
  className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
716
616
  onClick: function onClick(e) {
717
- return _this7.zoomIn(e, selectedIndex);
617
+ return _this6.zoomIn(e, selectedIndex);
718
618
  },
719
619
  "data-id": "zoomIn",
720
620
  "data-test-id": "zoomIn",
@@ -747,7 +647,6 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
747
647
  className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu
748
648
  }, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
749
649
  href: downloadUrl,
750
- downloadName: selectedAttachment.name,
751
650
  target: "_parent",
752
651
  hasReload: true,
753
652
  download: true,
@@ -764,7 +663,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
764
663
  }
765
664
  }))) : null, /*#__PURE__*/_react["default"].createElement("div", {
766
665
  className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
767
- onClick: _this7.closeAttachmentViewer,
666
+ onClick: _this6.closeAttachmentViewer,
768
667
  "data-id": "closeAttach",
769
668
  "data-test-id": "closeAttach",
770
669
  "data-title": i18nKeys.closeText
@@ -785,7 +684,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
785
684
  alignBox: "row"
786
685
  }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
787
686
  className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(selectedIndex === 0 ? _AttachmentViewerModule["default"].hidden : ''),
788
- onClick: _this7.changeSelectedIndex.bind(_this7, selectedIndex - 1),
687
+ onClick: _this6.changeSelectedIndex.bind(_this6, selectedIndex - 1),
789
688
  "data-title": i18nKeys.previousText,
790
689
  "data-title-position": "left"
791
690
  }, /*#__PURE__*/_react["default"].createElement("button", {
@@ -801,12 +700,12 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
801
700
  tabindex: "0",
802
701
  "aria-describedby": ariaId,
803
702
  isShrink: false,
804
- eleRef: _this7.setImgBoxRef,
703
+ eleRef: _this6.setImgBoxRef,
805
704
  scroll: "both",
806
705
  flexible: true
807
- }, _this7.imgPreviewView(downloadUrl)), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
706
+ }, _this6.imgPreviewView(downloadUrl)), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
808
707
  className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(totalLen === selectedIndex + 1 ? _AttachmentViewerModule["default"].hidden : ''),
809
- onClick: _this7.changeSelectedIndex.bind(_this7, selectedIndex + 1),
708
+ onClick: _this6.changeSelectedIndex.bind(_this6, selectedIndex + 1),
810
709
  "data-title": i18nKeys.nextText,
811
710
  "data-title-position": "right"
812
711
  }, /*#__PURE__*/_react["default"].createElement("button", {
@@ -846,7 +745,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
846
745
  alignBox: "row",
847
746
  scroll: "horizontal",
848
747
  eleRef: function eleRef(el) {
849
- return _this7.imgListCont = el;
748
+ return _this6.imgListCont = el;
850
749
  },
851
750
  className: _AttachmentViewerModule["default"].listContainer
852
751
  }, data.map(function (item, index) {
@@ -860,17 +759,17 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
860
759
  _item$customProps = item.customProps,
861
760
  customProps = _item$customProps === void 0 ? {} : _item$customProps;
862
761
  var thumbnail = item.thumbnail;
863
- var isImageFileType = _this7.isImageFileType(name) || thumbnail;
864
- var _customClass$customIm3 = customClass.customImageClass,
865
- customImageClass = _customClass$customIm3 === void 0 ? '' : _customClass$customIm3,
866
- _customClass$customCh3 = customClass.customChildrenClass,
867
- customChildrenClass = _customClass$customCh3 === void 0 ? '' : _customClass$customCh3;
762
+ var isImageFileType = _this6.isImageFileType(name) || thumbnail;
763
+ var _customClass$customIm2 = customClass.customImageClass,
764
+ customImageClass = _customClass$customIm2 === void 0 ? '' : _customClass$customIm2,
765
+ _customClass$customCh2 = customClass.customChildrenClass,
766
+ customChildrenClass = _customClass$customCh2 === void 0 ? '' : _customClass$customCh2;
868
767
  return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
869
768
  className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : '', " ").concat(isImageFileType ? '' : _AttachmentViewerModule["default"].previewIconDiv),
870
769
  key: index,
871
- onClick: _this7.changeSelectedIndex.bind(_this7, index),
770
+ onClick: _this6.changeSelectedIndex.bind(_this6, index),
872
771
  eleRef: function eleRef(el) {
873
- return _this7["img_".concat(index)] = el;
772
+ return _this6["img_".concat(index)] = el;
874
773
  },
875
774
  dataId: "attachPreviewList",
876
775
  "data-title": name
@@ -883,10 +782,10 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
883
782
  customChildrenClass: "".concat(_AttachmentViewerModule["default"].crsrPointer, " ").concat(customChildrenClass)
884
783
  },
885
784
  dataId: dataId
886
- }, customProps), children) : _this7.getPreviewIconData(name, '40'));
785
+ }, customProps), children) : _this6.getPreviewIconData(name, '40'));
887
786
  }))))), totalLen !== 1 && /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
888
787
  dataId: "attachToggle",
889
- onClick: _this7.togglePViewList,
788
+ onClick: _this6.togglePViewList,
890
789
  iconName: "ZD-GN-hideTab",
891
790
  iconSize: "14",
892
791
  hoverType: "border",
@@ -1,5 +1,5 @@
1
1
  .header {
2
- height: var(--zd_size48) ;
2
+ height: var(--zd_size40) ;
3
3
  position: relative;
4
4
  z-index: 1;
5
5
  padding-block:0 ;
@@ -19,7 +19,6 @@ var AttachmentViewer_defaultProps = {
19
19
  isActive: false,
20
20
  dataId: 'AttachmentViewer',
21
21
  i18nKeys: {},
22
- customProps: {},
23
- showCount: true
22
+ customProps: {}
24
23
  };
25
24
  exports.AttachmentViewer_defaultProps = AttachmentViewer_defaultProps;
@@ -13,9 +13,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
13
13
 
14
14
  var AttachmentImage_propTypes = {
15
15
  alt: _propTypes["default"].string,
16
- imageRef: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].shape({
17
- current: _propTypes["default"].any
18
- })]),
19
16
  customClass: _propTypes["default"].shape({
20
17
  customImageClass: _propTypes["default"].string,
21
18
  customChildrenClass: _propTypes["default"].string
@@ -32,9 +29,6 @@ var AttachmentImage_propTypes = {
32
29
  exports.AttachmentImage_propTypes = AttachmentImage_propTypes;
33
30
  var AttachmentViewer_propTypes = {
34
31
  hideAttachmentViewer: _propTypes["default"].func,
35
- imageRef: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].shape({
36
- current: _propTypes["default"].any
37
- })]),
38
32
  i18nKeys: _propTypes["default"].shape({
39
33
  nextText: _propTypes["default"].string,
40
34
  previousText: _propTypes["default"].string,
@@ -62,8 +56,6 @@ var AttachmentViewer_propTypes = {
62
56
  renderUnSupportedElement: _propTypes["default"].func,
63
57
  customProps: _propTypes["default"].shape({
64
58
  avatarProps: _propTypes["default"].exact(_propTypes2.propTypes)
65
- }),
66
- showCount: _propTypes["default"].bool,
67
- renderCustomIcons: _propTypes["default"].func
59
+ })
68
60
  };
69
61
  exports.AttachmentViewer_propTypes = AttachmentViewer_propTypes;
@@ -106,7 +106,10 @@ function useDownloadAssetsAndSetAttr(_ref) {
106
106
  }
107
107
 
108
108
  function setZoomSizeAttribute() {
109
- if (!needZoom) {
109
+ var zoomLower = String(baseZoomUnit).toLowerCase();
110
+ var varLower = String(zoomUnitVariable).toLowerCase();
111
+
112
+ if (!needZoom || zoomLower === 'none' || zoomLower === 'unset' || varLower === 'none' || varLower === 'unset') {
110
113
  return;
111
114
  }
112
115
 
@@ -122,7 +125,10 @@ function useDownloadAssetsAndSetAttr(_ref) {
122
125
  }
123
126
 
124
127
  function setFontSizeAttribute() {
125
- if (!needFont) {
128
+ var fontLower = String(baseFontUnit).toLowerCase();
129
+ var varLower = String(fontUnitVariable).toLowerCase();
130
+
131
+ if (!needFont || fontLower === 'none' || fontLower === 'unset' || varLower === 'none' || varLower === 'unset') {
126
132
  return;
127
133
  }
128
134
 
@@ -142,7 +148,7 @@ function useDownloadAssetsAndSetAttr(_ref) {
142
148
  }, [themeAppearanceAttr, themeColorAttr, themeAppearance, themeColor, getProviderElement, needTheme]);
143
149
  (0, _react.useLayoutEffect)(function () {
144
150
  setZoomSizeAttribute();
145
- }, [zoomUnitVariable, modifiedZoomUnitWithSuffix, zoomSizePromise, getProviderElement, needZoom]);
151
+ }, [zoomUnitVariable, modifiedZoomUnitWithSuffix, zoomSizePromise, getProviderElement, needZoom, baseZoomUnit]);
146
152
  (0, _react.useLayoutEffect)(function () {
147
153
  setFontSizeAttribute();
148
154
  }, [fontUnitVariable, baseFontUnit, fontSizePromise, getProviderElement, needFont]);
package/lib/Link/Link.js CHANGED
@@ -110,8 +110,7 @@ var Link = /*#__PURE__*/function (_React$Component) {
110
110
  rel = _this$props2.rel,
111
111
  dataId = _this$props2.dataId,
112
112
  customProps = _this$props2.customProps,
113
- ariaLabel = _this$props2.ariaLabel,
114
- downloadName = _this$props2.downloadName;
113
+ ariaLabel = _this$props2.ariaLabel;
115
114
  var _this$context$options = this.context.options,
116
115
  isLink = _this$context$options.isLink,
117
116
  constructURL = _this$context$options.constructURL;
@@ -119,10 +118,10 @@ var Link = /*#__PURE__*/function (_React$Component) {
119
118
  var option = {};
120
119
 
121
120
  if (download) {
122
- option.download = downloadName || true;
121
+ option.download = true;
123
122
  }
124
123
 
125
- var ignoreKeys = ['children', 'href', 'target', 'urlData', 'urlName', 'className', 'title', 'download', 'downloadName', 'rel', 'dataId', 'hasReload', 'customProps', 'option', 'ariaLabel'];
124
+ var ignoreKeys = ['children', 'href', 'target', 'urlData', 'urlName', 'className', 'title', 'download', 'rel', 'dataId', 'hasReload', 'customProps', 'option', 'ariaLabel'];
126
125
  var others = Object.keys(this.props).filter(function (key) {
127
126
  return ignoreKeys.indexOf(key) == -1;
128
127
  }).reduce(function (res, key) {
@@ -23,7 +23,6 @@ var propTypes = {
23
23
  customProps: _propTypes["default"].object,
24
24
  onClick: _propTypes["default"].func,
25
25
  download: _propTypes["default"].bool,
26
- downloadName: _propTypes["default"].string,
27
26
  ariaLabel: _propTypes["default"].string,
28
27
  key: _propTypes["default"].string
29
28
  };
@@ -15,6 +15,8 @@ var _AlertClose = _interopRequireDefault(require("../../AlertClose/AlertClose"))
15
15
 
16
16
  var _AlertIcons = _interopRequireDefault(require("../../alertIcons/AlertIcons"));
17
17
 
18
+ var _renderNode = _interopRequireDefault(require("@zohodesk/utils/es/renderNode"));
19
+
18
20
  var _AlertHeaderNewModule = _interopRequireDefault(require("./css/AlertHeaderNew.module.css"));
19
21
 
20
22
  var _cssJSLogic2 = _interopRequireDefault(require("./css/cssJSLogic"));
@@ -48,7 +50,8 @@ function AlertHeader(props) {
48
50
  type = props.type,
49
51
  htmlId = props.htmlId,
50
52
  customStyle = props.customStyle,
51
- dragBoundaryLimit = props.dragBoundaryLimit;
53
+ dragBoundaryLimit = props.dragBoundaryLimit,
54
+ renderAlertIcon = props.renderAlertIcon;
52
55
  var finalStyle = (0, _utils.mergeStyle)(_AlertHeaderNewModule["default"], customStyle);
53
56
 
54
57
  var _cssJSLogic = (0, _cssJSLogic2["default"])({
@@ -75,7 +78,7 @@ function AlertHeader(props) {
75
78
  eleRef: dragRef
76
79
  }, needIcon && /*#__PURE__*/_react["default"].createElement("div", {
77
80
  className: finalStyle.iconContainer
78
- }, /*#__PURE__*/_react["default"].createElement(_AlertIcons["default"], {
81
+ }, (0, _renderNode["default"])(renderAlertIcon) || /*#__PURE__*/_react["default"].createElement(_AlertIcons["default"], {
79
82
  type: type
80
83
  })), (title || children) && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
81
84
  flexible: true
@@ -15,4 +15,30 @@ describe('AlertHeader', function () {
15
15
 
16
16
  expect(asFragment()).toMatchSnapshot();
17
17
  });
18
+ test('renders custom renderAlertIcon when needIcon is true', function () {
19
+ var customIcon = /*#__PURE__*/_react["default"].createElement("span", {
20
+ "data-test-id": "custom-icon"
21
+ }, "icon");
22
+
23
+ var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_AlertHeader["default"], {
24
+ needIcon: true,
25
+ renderAlertIcon: customIcon
26
+ })),
27
+ asFragment = _render2.asFragment;
28
+
29
+ expect(asFragment()).toMatchSnapshot();
30
+ });
31
+ test('does not render custom renderAlertIcon when needIcon is false', function () {
32
+ var customIcon = /*#__PURE__*/_react["default"].createElement("span", {
33
+ "data-test-id": "custom-icon"
34
+ }, "icon");
35
+
36
+ var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_AlertHeader["default"], {
37
+ needIcon: false,
38
+ renderAlertIcon: customIcon
39
+ })),
40
+ asFragment = _render3.asFragment;
41
+
42
+ expect(asFragment()).toMatchSnapshot();
43
+ });
18
44
  });