@zohodesk/dot 1.9.12 → 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 (58) hide show
  1. package/README.md +14 -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/utils/assetPromiseHandlers/themeAppearanceAssetPromise.js +3 -4
  15. package/es/DotProvider/utils/assetPromiseHandlers/themeColorAssetPromise.js +4 -5
  16. package/es/DotProvider/utils/errorValidation.js +5 -6
  17. package/es/DotProvider/utils/getAssetsImportPromises.js +4 -5
  18. package/es/Drawer/Drawer.js +6 -8
  19. package/es/FreezeLayer/css/cssJSLogic.js +4 -5
  20. package/es/Hooks/Dragger/useDragger.js +5 -6
  21. package/es/Hooks/Dragger/utils/DraggerUtil.js +7 -8
  22. package/es/Hooks/useFreezeLayer.js +4 -5
  23. package/es/Link/Link.js +4 -3
  24. package/es/Link/props/propTypes.js +1 -0
  25. package/es/Onboarding/CarouselDots/CarouselDots.js +29 -32
  26. package/es/Onboarding/Onboarding.js +23 -24
  27. package/es/Onboarding/hooks/useOnboarding.js +4 -5
  28. package/es/Onboarding/hooks/useOnboardingSlider.js +5 -6
  29. package/es/deprecated/SelectDropdown/SelectDropdown.js +43 -47
  30. package/es/dropdown/ToggleDropDown/ToggleDropDown.js +214 -225
  31. package/es/errorstate/Inconvenience/Inconvenience.js +32 -36
  32. package/es/errorstate/NoRequestFound/NoRequestFound.js +32 -36
  33. package/es/errorstate/PermissionPlay/PermissionPlay.js +31 -35
  34. package/es/errorstate/RequestUrlNotFound/RequestUrlNotFound.js +32 -36
  35. package/es/errorstate/UnableToProcess/UnableToProcess.js +32 -36
  36. package/es/errorstate/UnauthorizedLogin/UnauthorizedLogin.js +32 -36
  37. package/es/errorstate/WillBack/WillBack.js +30 -34
  38. package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +81 -85
  39. package/es/list/status/StatusDropdown/StatusDropdown.js +109 -113
  40. package/es/list/status/StatusDropdown/__tests__/StatusDropdown.spec.js +3 -4
  41. package/es/lookup/header/Search/Search.js +4 -5
  42. package/es/lookup/header/Search/__tests__/Search.spec.js +3 -4
  43. package/es/lookup/header/ViewDropDown/ViewDropDown.js +67 -75
  44. package/es/utils/General.js +2 -7
  45. package/es/utils/editorUtils.js +1 -5
  46. package/es/version2/lookup/AlertHeader/css/cssJSLogic.js +4 -5
  47. package/es/version2/notification/DesktopNotification/DesktopNotification.js +59 -63
  48. package/es/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.js +40 -44
  49. package/lib/AttachmentViewer/AttachmentImage.js +3 -1
  50. package/lib/AttachmentViewer/AttachmentViewer.js +158 -82
  51. package/lib/AttachmentViewer/AttachmentViewer.module.css +8 -15
  52. package/lib/AttachmentViewer/__tests__/AttachmentViewer.spec.js +100 -100
  53. package/lib/AttachmentViewer/__tests__/__snapshots__/AttachmentViewer.spec.js.snap +778 -1
  54. package/lib/AttachmentViewer/props/defaultProps.js +6 -2
  55. package/lib/AttachmentViewer/props/propTypes.js +9 -2
  56. package/lib/Link/Link.js +4 -3
  57. package/lib/Link/props/propTypes.js +1 -0
  58. package/package.json +4 -4
@@ -14,6 +14,8 @@ import AttachmentImage from "./AttachmentImage";
14
14
  import Link from "../Link/Link";
15
15
  import IconButton from "../IconButton/IconButton";
16
16
  import FreezeLayer from "../FreezeLayer/FreezeLayer";
17
+ import { renderNode } from '@zohodesk/utils';
18
+ import { DUMMY_OBJECT } from "../utils/General";
17
19
  import { getExtensionFromFileName, getAttachmentIconDetails } from "./Attachment";
18
20
  import { shallowDiff } from "../utils/General";
19
21
  import { checkFileSourcesValidation, FILE_EXTENSIONS } from "./utils";
@@ -46,8 +48,11 @@ export default class AttachmentViewer extends Component {
46
48
  this.getUpdateDataList = this.getUpdateDataList.bind(this);
47
49
  this.zoomMaintain = this.zoomMaintain.bind(this);
48
50
  this.handleMenuValidation = this.handleMenuValidation.bind(this);
51
+ this.notifySelectedAttachmentChange = this.notifySelectedAttachmentChange.bind(this);
49
52
  this.getPreviewIconData = this.getPreviewIconData.bind(this);
50
53
  this.renderIframe = this.renderIframe.bind(this);
54
+ this.getRenderImageFrameCustomClass = this.getRenderImageFrameCustomClass.bind(this);
55
+ this.renderImageFrame = this.renderImageFrame.bind(this);
51
56
  }
52
57
 
53
58
  isImageFileType(fileName) {
@@ -68,8 +73,23 @@ export default class AttachmentViewer extends Component {
68
73
  return FILE_EXTENSIONS.audio.map(ext => ext.toLowerCase()).includes(extension);
69
74
  }
70
75
 
76
+ notifySelectedAttachmentChange() {
77
+ const {
78
+ onSelectedAttachmentChange
79
+ } = this.props;
80
+ const {
81
+ selectedIndex,
82
+ data
83
+ } = this.state;
84
+ onSelectedAttachmentChange && onSelectedAttachmentChange({
85
+ data: data[selectedIndex] || DUMMY_OBJECT,
86
+ index: selectedIndex
87
+ });
88
+ }
89
+
71
90
  componentDidMount() {
72
91
  this.handleMenuValidation();
92
+ this.notifySelectedAttachmentChange();
73
93
  }
74
94
 
75
95
  componentDidUpdate(prevProps, prevState) {
@@ -77,13 +97,15 @@ export default class AttachmentViewer extends Component {
77
97
  previewObj
78
98
  } = this.props;
79
99
  const {
80
- selectedIndex
100
+ selectedIndex,
101
+ data
81
102
  } = this.state;
82
103
  let indexChanged = previewObj.selectedIndex != prevProps.previewObj.selectedIndex;
104
+ const attachmentPreviewUrlChanged = previewObj.previewData.some((value, index) => value?.viewUrl !== prevState.data[index]?.viewUrl); // Triggers an update if any previewed attachment is edited by the Attachment Annotator.
83
105
 
84
- if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged) {
106
+ if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged || attachmentPreviewUrlChanged) {
85
107
  let objChanged = previewObj.previewData.some((value, index) => {
86
- return shallowDiff(value, prevProps.previewObj[index]);
108
+ return shallowDiff(value, prevProps.previewObj.previewData[index]);
87
109
  });
88
110
 
89
111
  if (objChanged || indexChanged) {
@@ -100,7 +122,8 @@ export default class AttachmentViewer extends Component {
100
122
  }
101
123
  }
102
124
 
103
- if (prevState.selectedIndex != selectedIndex) {
125
+ if (prevState.selectedIndex != selectedIndex || attachmentPreviewUrlChanged) {
126
+ this.notifySelectedAttachmentChange();
104
127
  this.handleMenuValidation();
105
128
  }
106
129
  }
@@ -113,7 +136,7 @@ export default class AttachmentViewer extends Component {
113
136
  const {
114
137
  allowedPreviewExtensionsData
115
138
  } = this.props;
116
- const selectedAttachment = data[selectedIndex] || {};
139
+ const selectedAttachment = data[selectedIndex] || DUMMY_OBJECT;
117
140
  const selectedAttachmentViewUrl = selectedAttachment.viewUrl; // const selectedAttachmentDownloadUrl = selectedAttachment.downloadUrl;
118
141
 
119
142
  const selectedAttachmentName = selectedAttachment.name;
@@ -154,8 +177,7 @@ export default class AttachmentViewer extends Component {
154
177
  // }
155
178
  }
156
179
 
157
- zoomIn(event, ele) {
158
- let moveToPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
180
+ zoomIn(event, ele, moveToPosition = false) {
159
181
  this.setState({
160
182
  isZoomed: true
161
183
  });
@@ -201,12 +223,11 @@ export default class AttachmentViewer extends Component {
201
223
  isZoomed ? this.zoomIn({}, selectedIndex) : this.zoomOut(selectedIndex);
202
224
  }
203
225
 
204
- getUpdateDataList(_ref) {
205
- let {
206
- index,
207
- data,
208
- dataList
209
- } = _ref;
226
+ getUpdateDataList({
227
+ index,
228
+ data,
229
+ dataList
230
+ }) {
210
231
  data = data || this.state.data;
211
232
  dataList = dataList || this.state.dataList;
212
233
  const finalDataList = [...dataList];
@@ -268,10 +289,9 @@ export default class AttachmentViewer extends Component {
268
289
  this.props.hideAttachmentViewer();
269
290
  }
270
291
 
271
- responsiveFunc(_ref2) {
272
- let {
273
- mediaQueryOR
274
- } = _ref2;
292
+ responsiveFunc({
293
+ mediaQueryOR
294
+ }) {
275
295
  return {
276
296
  uptoTablet: mediaQueryOR([{
277
297
  maxWidth: 768
@@ -308,18 +328,80 @@ export default class AttachmentViewer extends Component {
308
328
  }, this.props.customProps.iframeProps));
309
329
  }
310
330
 
311
- imgPreviewView(downloadUrl) {
312
- var _this = this;
313
-
331
+ getRenderImageFrameCustomClass() {
314
332
  const {
315
- dataList,
316
333
  selectedIndex,
317
334
  isZoomed,
318
335
  canZoom,
336
+ data
337
+ } = this.state;
338
+ const {
339
+ maintainZoom
340
+ } = this.props;
341
+ const selectedData = data[selectedIndex] || DUMMY_OBJECT;
342
+ const {
343
+ customClass = DUMMY_OBJECT
344
+ } = selectedData;
345
+ const {
346
+ customImageClass = '',
347
+ customChildrenClass = ''
348
+ } = customClass;
349
+ const retainZoom = canZoom && maintainZoom;
350
+ return {
351
+ customImageClass: `${style.img} ${style.altText} ${canZoom || retainZoom ? isZoomed ? `${style.zoomedImg} ${style.zoomOutCursor}` : `${style.normalImg} ${style.zoomInCursor}` : ''} ${customImageClass}`,
352
+ customChildrenClass
353
+ };
354
+ }
355
+
356
+ renderImageFrame() {
357
+ const {
358
+ selectedIndex,
359
+ isZoomed,
319
360
  isPreviewAttachmentValid
320
361
  } = this.state;
321
362
  const {
322
- maintainZoom,
363
+ renderCustomImagePreviewElement
364
+ } = this.props;
365
+ const data = this.state.data[selectedIndex] || DUMMY_OBJECT;
366
+ const {
367
+ viewUrl,
368
+ name,
369
+ children,
370
+ dataId = 'attachViewer',
371
+ customProps = DUMMY_OBJECT,
372
+ imageRef
373
+ } = data;
374
+ const {
375
+ imageProps = DUMMY_OBJECT
376
+ } = customProps;
377
+ const resolvedImageRef = imageRef;
378
+ const handleZoomOut = isPreviewAttachmentValid && isZoomed ? this.zoomOut.bind(this, selectedIndex) : undefined;
379
+ const handleZoomIn = isPreviewAttachmentValid && !isZoomed ? e => this.zoomIn(e, selectedIndex, true) : undefined;
380
+ const handleImageClick = isPreviewAttachmentValid ? isZoomed ? handleZoomOut : handleZoomIn : undefined;
381
+ const imageFrameCustomClass = this.getRenderImageFrameCustomClass();
382
+ const img = /*#__PURE__*/React.createElement(AttachmentImage, _extends({
383
+ customClass: imageFrameCustomClass,
384
+ src: viewUrl,
385
+ onClick: handleImageClick,
386
+ alt: name,
387
+ dataId: dataId,
388
+ id: `img${selectedIndex}`,
389
+ isCover: false,
390
+ imageRef: resolvedImageRef
391
+ }, imageProps), children);
392
+ return typeof renderCustomImagePreviewElement === 'function' ? renderCustomImagePreviewElement({
393
+ defaultView: img,
394
+ data,
395
+ index: selectedIndex
396
+ }) : img;
397
+ }
398
+
399
+ imgPreviewView(downloadUrl) {
400
+ const {
401
+ dataList,
402
+ selectedIndex
403
+ } = this.state;
404
+ const {
323
405
  dataId,
324
406
  i18nKeys,
325
407
  renderUnSupportedElement
@@ -350,29 +432,20 @@ export default class AttachmentViewer extends Component {
350
432
  };
351
433
  };
352
434
 
353
- return dataList.length && dataList.map(function () {
354
- let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
355
- let i = arguments.length > 1 ? arguments[1] : undefined;
435
+ return dataList.length && dataList.map((data = {}, i) => {
356
436
  const {
357
437
  viewUrl,
358
438
  name,
359
439
  children,
360
440
  dataId = 'attachViewer',
361
- customClass = {},
362
441
  customProps = {},
363
442
  previewurl,
364
443
  type
365
444
  } = data;
366
445
  const {
367
446
  audioProps = {},
368
- imageProps = {},
369
447
  videoProps = {}
370
448
  } = customProps;
371
- const {
372
- customImageClass = '',
373
- customChildrenClass = ''
374
- } = customClass;
375
- const retainZoom = canZoom && selectedIndex == i && maintainZoom;
376
449
  const extension = getExtensionFromFileName(name);
377
450
  const {
378
451
  previewUnsupportedText = "Preview not available for the selected file type.",
@@ -388,7 +461,7 @@ export default class AttachmentViewer extends Component {
388
461
  }, /*#__PURE__*/React.createElement(Box, {
389
462
  className: style.imgRef,
390
463
  id: `imgPreviewRef${i}`
391
- }, selectedIndex == i && /*#__PURE__*/React.createElement(React.Fragment, null, _this.isAudioFileType(name) ? /*#__PURE__*/React.createElement("audio", _extends({
464
+ }, selectedIndex == i && /*#__PURE__*/React.createElement(React.Fragment, null, this.isAudioFileType(name) ? /*#__PURE__*/React.createElement("audio", _extends({
392
465
  controls: true,
393
466
  className: style.zoomIn,
394
467
  "data-id": `${dataId}_audioPreview`,
@@ -396,7 +469,7 @@ export default class AttachmentViewer extends Component {
396
469
  }, audioProps), /*#__PURE__*/React.createElement("source", {
397
470
  src: previewurl || viewUrl,
398
471
  type: `audio/${extension}`
399
- })) : _this.isVideoFileType(name) ? /*#__PURE__*/React.createElement("video", _extends({
472
+ })) : this.isVideoFileType(name) ? /*#__PURE__*/React.createElement("video", _extends({
400
473
  controls: true,
401
474
  className: style.zoomIn,
402
475
  "data-id": `${dataId}_videoPreview`,
@@ -404,29 +477,19 @@ export default class AttachmentViewer extends Component {
404
477
  }, videoProps), /*#__PURE__*/React.createElement("source", {
405
478
  src: viewUrl,
406
479
  type: `video/${extension}`
407
- })) : _this.isImageFileType(name) || children ? /*#__PURE__*/React.createElement(AttachmentImage, _extends({
408
- customClass: {
409
- customImageClass: `${style.img} ${style.altText} ${canZoom || retainZoom ? isZoomed ? `${style.zoomedImg} ${style.zoomOutCursor}` : `${style.normalImg} ${style.zoomInCursor}` : ''} ${customImageClass}`,
410
- customChildrenClass
411
- },
412
- src: viewUrl,
413
- onClick: isPreviewAttachmentValid ? isZoomed ? _this.zoomOut.bind(_this, i) : e => _this.zoomIn(e, i, true) : undefined,
414
- alt: name,
415
- dataId: dataId,
416
- id: `img${i}`,
417
- isCover: false
418
- }, imageProps), children) : type === "document" && previewurl != null ? _this.renderIframe(previewurl) : typeof renderUnSupportedElement === 'function' ? renderUnSupportedElement(data) : /*#__PURE__*/React.createElement("div", {
480
+ })) : this.isImageFileType(name) || children ? this.renderImageFrame() : type === "document" && previewurl != null ? this.renderIframe(previewurl) : typeof renderUnSupportedElement === 'function' ? renderUnSupportedElement(data) : /*#__PURE__*/React.createElement("div", {
419
481
  className: style.previewNone
420
482
  }, /*#__PURE__*/React.createElement("div", {
421
483
  className: style.fileTypeImg
422
- }, _this.getPreviewIconData(name, '70')), /*#__PURE__*/React.createElement(Typography, {
484
+ }, this.getPreviewIconData(name, '70')), /*#__PURE__*/React.createElement(Typography, {
423
485
  $ui_size: "20",
424
486
  $ui_weight: "semibold"
425
487
  }, previewUnsupportedText), downloadUrl ? /*#__PURE__*/React.createElement(Link, {
426
488
  href: downloadUrl,
489
+ download: true,
490
+ downloadName: name,
427
491
  className: style.downloadLink,
428
- hasReload: true,
429
- download: true
492
+ hasReload: true
430
493
  }, /*#__PURE__*/React.createElement(Button, {
431
494
  palette: "primaryFilled",
432
495
  text: downloadText
@@ -449,7 +512,9 @@ export default class AttachmentViewer extends Component {
449
512
  i18nKeys,
450
513
  isActive,
451
514
  dataId,
452
- customProps
515
+ customProps,
516
+ hasCount,
517
+ renderCustomIcons
453
518
  } = this.props;
454
519
  const {
455
520
  avatarProps = {}
@@ -477,231 +542,233 @@ export default class AttachmentViewer extends Component {
477
542
  }, /*#__PURE__*/React.createElement(ResponsiveReceiver, {
478
543
  responsiveId: responsiveId,
479
544
  query: this.responsiveFunc
480
- }, _ref3 => {
545
+ }, ({
546
+ uptoTablet
547
+ }) => /*#__PURE__*/React.createElement(Container, {
548
+ scroll: "none",
549
+ "data-scroll-palette": "dark"
550
+ }, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Container, {
551
+ alignBox: "row",
552
+ className: style.header,
553
+ align: "between",
554
+ tabindex: "0"
555
+ }, /*#__PURE__*/React.createElement(Box, {
556
+ shrink: true,
557
+ className: style.title,
558
+ "data-title": selectedAttachment.name,
559
+ dataId: "attachName",
560
+ id: ariaId
561
+ }, selectedAttachment.name), hasCount && /*#__PURE__*/React.createElement(Box, {
562
+ flexible: true,
563
+ className: style.count,
564
+ dataId: "attachCountContainer"
565
+ }, selectedIndex + 1, "/", totalLen), /*#__PURE__*/React.createElement(Box, {
566
+ className: uptoTablet ? style.mbleMenuBar : style.menuBar
567
+ }, /*#__PURE__*/React.createElement(Container, {
568
+ isInline: true,
569
+ alignBox: uptoTablet ? 'column-reverse' : 'row',
570
+ align: uptoTablet ? 'bottom' : 'center',
571
+ wrap: "wrap",
572
+ isCover: false
573
+ }, renderNode(renderCustomIcons, {
574
+ selectedAttachment,
575
+ selectedIndex,
576
+ totalLen
577
+ }), canZoom ? isZoomed ? /*#__PURE__*/React.createElement("div", {
578
+ className: uptoTablet ? style.mobileMenu : style.menu,
579
+ onClick: this.zoomOut.bind(this, selectedIndex),
580
+ "data-id": "zoomOut",
581
+ "data-test-id": "zoomOut",
582
+ "data-title": i18nKeys.zoomOutText
583
+ }, /*#__PURE__*/React.createElement(IconButton, {
584
+ iconName: "ZD-GN-zoomOut",
585
+ className: style.menuIcon,
586
+ iconSize: "16",
587
+ hoverType: "border",
588
+ a11y: {
589
+ ariaLabel: i18nKeys.zoomOutText
590
+ }
591
+ })) : /*#__PURE__*/React.createElement("div", {
592
+ className: uptoTablet ? style.mobileMenu : style.menu,
593
+ onClick: e => this.zoomIn(e, selectedIndex),
594
+ "data-id": "zoomIn",
595
+ "data-test-id": "zoomIn",
596
+ "data-title": i18nKeys.zoomInText
597
+ }, /*#__PURE__*/React.createElement(IconButton, {
598
+ iconName: "ZD-GN-zoomIn",
599
+ className: style.menuIcon,
600
+ iconSize: "16",
601
+ hoverType: "border",
602
+ a11y: {
603
+ ariaLabel: i18nKeys.zoomInText
604
+ }
605
+ })) : null, canOpenInNewTab ? /*#__PURE__*/React.createElement("div", {
606
+ className: uptoTablet ? style.mobileMenu : style.menu
607
+ }, /*#__PURE__*/React.createElement(Link, {
608
+ href: selectedImgUrl,
609
+ target: "_blank",
610
+ dataId: "newTabAttach",
611
+ title: i18nKeys.newTabText
612
+ }, /*#__PURE__*/React.createElement(IconButton, {
613
+ iconName: "ZD-GN-newLink",
614
+ className: style.menuIcon,
615
+ iconSize: "16",
616
+ hoverType: "border",
617
+ needButtonTag: false,
618
+ a11y: {
619
+ ariaLabel: i18nKeys.newTabText
620
+ }
621
+ }))) : null, needDownload ? /*#__PURE__*/React.createElement("div", {
622
+ className: uptoTablet ? style.mobileMenu : style.menu
623
+ }, /*#__PURE__*/React.createElement(Link, {
624
+ href: downloadUrl,
625
+ downloadName: selectedAttachment.name,
626
+ target: "_parent",
627
+ hasReload: true,
628
+ download: true,
629
+ title: i18nKeys.downloadText,
630
+ dataId: `${dataId}_downloadAttach`
631
+ }, /*#__PURE__*/React.createElement(IconButton, {
632
+ iconName: "ZD-GN-download",
633
+ className: style.menuIcon,
634
+ iconSize: "16",
635
+ hoverType: "border",
636
+ needButtonTag: false,
637
+ a11y: {
638
+ ariaLabel: i18nKeys.downloadText
639
+ }
640
+ }))) : null, /*#__PURE__*/React.createElement("div", {
641
+ className: uptoTablet ? style.mobileMenu : style.menu,
642
+ onClick: this.closeAttachmentViewer,
643
+ "data-id": "closeAttach",
644
+ "data-test-id": "closeAttach",
645
+ "data-title": i18nKeys.closeText
646
+ }, /*#__PURE__*/React.createElement(IconButton, {
647
+ iconName: "ZD-cross",
648
+ iconSize: "15",
649
+ hoverType: "border",
650
+ className: style.menuIcon,
651
+ a11y: {
652
+ ariaLabel: i18nKeys.closeText
653
+ },
654
+ title: i18nKeys.closeText
655
+ })))))), /*#__PURE__*/React.createElement(Box, {
656
+ flexible: true,
657
+ role: "toolbar",
658
+ tabindex: "0"
659
+ }, /*#__PURE__*/React.createElement(Container, {
660
+ alignBox: "row"
661
+ }, /*#__PURE__*/React.createElement(Box, {
662
+ className: `${style.arrowBox} ${uptoTablet ? style.mbleArrowBox : style.nrmlArrowBox} ${selectedIndex === 0 ? style.hidden : ''}`,
663
+ onClick: this.changeSelectedIndex.bind(this, selectedIndex - 1),
664
+ "data-title": i18nKeys.previousText,
665
+ "data-title-position": "left"
666
+ }, /*#__PURE__*/React.createElement("button", {
667
+ className: style.btn,
668
+ "aria-label": i18nKeys.previousText
669
+ }, /*#__PURE__*/React.createElement(Icon, {
670
+ name: "ZD-arrowLeft3",
671
+ iconClass: style.arrow,
672
+ dataId: "leftAttachNav",
673
+ isBold: true
674
+ }))), /*#__PURE__*/React.createElement(Box, {
675
+ className: style.previewBox,
676
+ tabindex: "0",
677
+ "aria-describedby": ariaId,
678
+ isShrink: false,
679
+ eleRef: this.setImgBoxRef,
680
+ scroll: "both",
681
+ flexible: true
682
+ }, this.imgPreviewView(downloadUrl)), /*#__PURE__*/React.createElement(Box, {
683
+ className: `${style.arrowBox} ${uptoTablet ? style.mbleArrowBox : style.nrmlArrowBox} ${totalLen === selectedIndex + 1 ? style.hidden : ''}`,
684
+ onClick: this.changeSelectedIndex.bind(this, selectedIndex + 1),
685
+ "data-title": i18nKeys.nextText,
686
+ "data-title-position": "right"
687
+ }, /*#__PURE__*/React.createElement("button", {
688
+ className: style.btn,
689
+ "aria-label": i18nKeys.nextText
690
+ }, /*#__PURE__*/React.createElement(Icon, {
691
+ name: "ZD-arrowRight3",
692
+ iconClass: style.arrow,
693
+ dataId: "rightAttachNav",
694
+ isBold: true
695
+ }))))), /*#__PURE__*/React.createElement(Box, {
696
+ className: `${style.footer} ${isPViewListOpen && totalLen !== 1 ? style.footerHeight : style.footerHide} `,
697
+ dataId: `${dataId}_attachPreviewFooter`
698
+ }, /*#__PURE__*/React.createElement(Container, {
699
+ align: "vertical",
700
+ alignBox: "row",
701
+ className: style.footerHeight
702
+ }, author && /*#__PURE__*/React.createElement(Box, {
703
+ className: style.author,
704
+ dataId: `${dataId}_authorName`
705
+ }, /*#__PURE__*/React.createElement(Container, {
706
+ alignBox: "row",
707
+ align: "both"
708
+ }, /*#__PURE__*/React.createElement(Avatar, _extends({
709
+ name: authorName,
710
+ size: "xmedium",
711
+ src: authorHref,
712
+ palette: "info"
713
+ }, avatarProps)), /*#__PURE__*/React.createElement(Box, {
714
+ flexible: true,
715
+ className: style.authorName,
716
+ "data-title": authorName
717
+ }, authorName))), /*#__PURE__*/React.createElement(Box, {
718
+ flexible: true
719
+ }, /*#__PURE__*/React.createElement(Container, {
720
+ align: "vertical",
721
+ alignBox: "row",
722
+ scroll: "horizontal",
723
+ eleRef: el => this.imgListCont = el,
724
+ className: style.listContainer
725
+ }, data.map((item, index) => {
726
+ const {
727
+ name,
728
+ viewUrl,
729
+ children,
730
+ customClass = {},
731
+ dataId = 'AttachmentImage',
732
+ customProps = {}
733
+ } = item;
481
734
  let {
482
- uptoTablet
483
- } = _ref3;
484
- return /*#__PURE__*/React.createElement(Container, {
485
- scroll: "none",
486
- "data-scroll-palette": "dark"
487
- }, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Container, {
488
- alignBox: "row",
489
- className: style.header,
490
- align: "between",
491
- tabindex: "0"
492
- }, /*#__PURE__*/React.createElement(Box, {
493
- shrink: true,
494
- className: style.title,
495
- "data-title": selectedAttachment.name,
496
- dataId: "attachName",
497
- id: ariaId
498
- }, selectedAttachment.name), /*#__PURE__*/React.createElement(Box, {
499
- flexible: true,
500
- className: style.count,
501
- dataId: "attachCountContainer"
502
- }, selectedIndex + 1, "/", totalLen), /*#__PURE__*/React.createElement(Box, {
503
- className: uptoTablet ? style.mbleMenuBar : style.menuBar
504
- }, /*#__PURE__*/React.createElement(Container, {
505
- isInline: true,
506
- alignBox: uptoTablet ? 'column-reverse' : 'row',
507
- align: uptoTablet ? 'bottom' : 'center',
508
- wrap: "wrap",
509
- isCover: false
510
- }, canZoom ? isZoomed ? /*#__PURE__*/React.createElement("div", {
511
- className: uptoTablet ? style.mobileMenu : style.menu,
512
- onClick: this.zoomOut.bind(this, selectedIndex),
513
- "data-id": "zoomOut",
514
- "data-test-id": "zoomOut",
515
- "data-title": i18nKeys.zoomOutText
516
- }, /*#__PURE__*/React.createElement(IconButton, {
517
- iconName: "ZD-GN-zoomOut",
518
- className: style.menuIcon,
519
- iconSize: "16",
520
- hoverType: "border",
521
- a11y: {
522
- ariaLabel: i18nKeys.zoomOutText
523
- }
524
- })) : /*#__PURE__*/React.createElement("div", {
525
- className: uptoTablet ? style.mobileMenu : style.menu,
526
- onClick: e => this.zoomIn(e, selectedIndex),
527
- "data-id": "zoomIn",
528
- "data-test-id": "zoomIn",
529
- "data-title": i18nKeys.zoomInText
530
- }, /*#__PURE__*/React.createElement(IconButton, {
531
- iconName: "ZD-GN-zoomIn",
532
- className: style.menuIcon,
533
- iconSize: "16",
534
- hoverType: "border",
535
- a11y: {
536
- ariaLabel: i18nKeys.zoomInText
537
- }
538
- })) : null, canOpenInNewTab ? /*#__PURE__*/React.createElement("div", {
539
- className: uptoTablet ? style.mobileMenu : style.menu
540
- }, /*#__PURE__*/React.createElement(Link, {
541
- href: selectedImgUrl,
542
- target: "_blank",
543
- dataId: "newTabAttach",
544
- title: i18nKeys.newTabText
545
- }, /*#__PURE__*/React.createElement(IconButton, {
546
- iconName: "ZD-GN-newLink",
547
- className: style.menuIcon,
548
- iconSize: "16",
549
- hoverType: "border",
550
- needButtonTag: false,
551
- a11y: {
552
- ariaLabel: i18nKeys.newTabText
553
- }
554
- }))) : null, needDownload ? /*#__PURE__*/React.createElement("div", {
555
- className: uptoTablet ? style.mobileMenu : style.menu
556
- }, /*#__PURE__*/React.createElement(Link, {
557
- href: downloadUrl,
558
- target: "_parent",
559
- hasReload: true,
560
- download: true,
561
- title: i18nKeys.downloadText,
562
- dataId: `${dataId}_downloadAttach`
563
- }, /*#__PURE__*/React.createElement(IconButton, {
564
- iconName: "ZD-GN-download",
565
- className: style.menuIcon,
566
- iconSize: "16",
567
- hoverType: "border",
568
- needButtonTag: false,
569
- a11y: {
570
- ariaLabel: i18nKeys.downloadText
571
- }
572
- }))) : null, /*#__PURE__*/React.createElement("div", {
573
- className: uptoTablet ? style.mobileMenu : style.menu,
574
- onClick: this.closeAttachmentViewer,
575
- "data-id": "closeAttach",
576
- "data-test-id": "closeAttach",
577
- "data-title": i18nKeys.closeText
578
- }, /*#__PURE__*/React.createElement(IconButton, {
579
- iconName: "ZD-cross",
580
- iconSize: "15",
581
- hoverType: "border",
582
- className: style.menuIcon,
583
- a11y: {
584
- ariaLabel: i18nKeys.closeText
585
- },
586
- title: i18nKeys.closeText
587
- })))))), /*#__PURE__*/React.createElement(Box, {
588
- flexible: true,
589
- role: "toolbar",
590
- tabindex: "0"
591
- }, /*#__PURE__*/React.createElement(Container, {
592
- alignBox: "row"
593
- }, /*#__PURE__*/React.createElement(Box, {
594
- className: `${style.arrowBox} ${uptoTablet ? style.mbleArrowBox : style.nrmlArrowBox} ${selectedIndex === 0 ? style.hidden : ''}`,
595
- onClick: this.changeSelectedIndex.bind(this, selectedIndex - 1),
596
- "data-title": i18nKeys.previousText,
597
- "data-title-position": "left"
598
- }, /*#__PURE__*/React.createElement("button", {
599
- className: style.btn,
600
- "aria-label": i18nKeys.previousText
601
- }, /*#__PURE__*/React.createElement(Icon, {
602
- name: "ZD-arrowLeft3",
603
- iconClass: style.arrow,
604
- dataId: "leftAttachNav",
605
- isBold: true
606
- }))), /*#__PURE__*/React.createElement(Box, {
607
- className: style.previewBox,
608
- tabindex: "0",
609
- "aria-describedby": ariaId,
610
- isShrink: false,
611
- eleRef: this.setImgBoxRef,
612
- scroll: "both",
613
- flexible: true
614
- }, this.imgPreviewView(downloadUrl)), /*#__PURE__*/React.createElement(Box, {
615
- className: `${style.arrowBox} ${uptoTablet ? style.mbleArrowBox : style.nrmlArrowBox} ${totalLen === selectedIndex + 1 ? style.hidden : ''}`,
616
- onClick: this.changeSelectedIndex.bind(this, selectedIndex + 1),
617
- "data-title": i18nKeys.nextText,
618
- "data-title-position": "right"
619
- }, /*#__PURE__*/React.createElement("button", {
620
- className: style.btn,
621
- "aria-label": i18nKeys.nextText
622
- }, /*#__PURE__*/React.createElement(Icon, {
623
- name: "ZD-arrowRight3",
624
- iconClass: style.arrow,
625
- dataId: "rightAttachNav",
626
- isBold: true
627
- }))))), /*#__PURE__*/React.createElement(Box, {
628
- className: `${style.footer} ${isPViewListOpen && totalLen !== 1 ? style.footerHeight : style.footerHide} `,
629
- dataId: `${dataId}_attachPreviewFooter`
630
- }, /*#__PURE__*/React.createElement(Container, {
631
- align: "vertical",
632
- alignBox: "row",
633
- className: style.footerHeight
634
- }, author && /*#__PURE__*/React.createElement(Box, {
635
- className: style.author,
636
- dataId: `${dataId}_authorName`
637
- }, /*#__PURE__*/React.createElement(Container, {
638
- alignBox: "row",
639
- align: "both"
640
- }, /*#__PURE__*/React.createElement(Avatar, _extends({
641
- name: authorName,
642
- size: "xmedium",
643
- src: authorHref,
644
- palette: "info"
645
- }, avatarProps)), /*#__PURE__*/React.createElement(Box, {
646
- flexible: true,
647
- className: style.authorName,
648
- "data-title": authorName
649
- }, authorName))), /*#__PURE__*/React.createElement(Box, {
650
- flexible: true
651
- }, /*#__PURE__*/React.createElement(Container, {
652
- align: "vertical",
653
- alignBox: "row",
654
- scroll: "horizontal",
655
- eleRef: el => this.imgListCont = el,
656
- className: style.listContainer
657
- }, data.map((item, index) => {
658
- const {
659
- name,
660
- viewUrl,
661
- children,
662
- customClass = {},
663
- dataId = 'AttachmentImage',
664
- customProps = {}
665
- } = item;
666
- let {
667
- thumbnail
668
- } = item;
669
- const isImageFileType = this.isImageFileType(name) || thumbnail;
670
- const {
671
- customImageClass = '',
672
- customChildrenClass = ''
673
- } = customClass;
674
- return /*#__PURE__*/React.createElement(Box, {
675
- className: `${style.imgItem} ${index === selectedIndex ? style.selected : ''} ${isImageFileType ? '' : style.previewIconDiv}`,
676
- key: index,
677
- onClick: this.changeSelectedIndex.bind(this, index),
678
- eleRef: el => this[`img_${index}`] = el,
679
- dataId: "attachPreviewList",
680
- "data-title": name
681
- }, isImageFileType || children ? /*#__PURE__*/React.createElement(AttachmentImage, _extends({
682
- src: thumbnail || viewUrl,
683
- size: "small",
684
- alt: name,
685
- customClass: {
686
- customImageClass: `${style.image} ${style.altText} ${customImageClass}`,
687
- customChildrenClass: `${style.crsrPointer} ${customChildrenClass}`
688
- },
689
- dataId: dataId
690
- }, customProps), children) : this.getPreviewIconData(name, '40'));
691
- }))))), totalLen !== 1 && /*#__PURE__*/React.createElement(IconButton, {
692
- dataId: "attachToggle",
693
- onClick: this.togglePViewList,
694
- iconName: "ZD-GN-hideTab",
695
- iconSize: "14",
696
- hoverType: "border",
697
- iconClass: `${style.thumpIcon} ${isPViewListOpen ? style.thumpIconActive : ''}`,
698
- className: style.button,
699
- a11y: {
700
- ariaLabel: i18nKeys.hideText
735
+ thumbnail
736
+ } = item;
737
+ const isImageFileType = this.isImageFileType(name) || thumbnail;
738
+ const {
739
+ customImageClass = '',
740
+ customChildrenClass = ''
741
+ } = customClass;
742
+ return /*#__PURE__*/React.createElement(Box, {
743
+ className: `${style.imgItem} ${index === selectedIndex ? style.selected : ''} ${isImageFileType ? '' : style.previewIconDiv}`,
744
+ key: index,
745
+ onClick: this.changeSelectedIndex.bind(this, index),
746
+ eleRef: el => this[`img_${index}`] = el,
747
+ dataId: "attachPreviewList",
748
+ "data-title": name
749
+ }, isImageFileType || children ? /*#__PURE__*/React.createElement(AttachmentImage, _extends({
750
+ src: thumbnail || viewUrl,
751
+ size: "small",
752
+ alt: name,
753
+ customClass: {
754
+ customImageClass: `${style.image} ${style.altText} ${customImageClass}`,
755
+ customChildrenClass: `${style.crsrPointer} ${customChildrenClass}`
701
756
  },
702
- title: isPViewListOpen ? i18nKeys.hideText : i18nKeys.showText
703
- }));
704
- }));
757
+ dataId: dataId
758
+ }, customProps), children) : this.getPreviewIconData(name, '40'));
759
+ }))))), totalLen !== 1 && /*#__PURE__*/React.createElement(IconButton, {
760
+ dataId: "attachToggle",
761
+ onClick: this.togglePViewList,
762
+ iconName: "ZD-GN-hideTab",
763
+ iconSize: "14",
764
+ hoverType: "border",
765
+ iconClass: `${style.thumpIcon} ${isPViewListOpen ? style.thumpIconActive : ''}`,
766
+ className: style.button,
767
+ a11y: {
768
+ ariaLabel: i18nKeys.hideText
769
+ },
770
+ title: isPViewListOpen ? i18nKeys.hideText : i18nKeys.showText
771
+ }))));
705
772
  }
706
773
 
707
774
  }