@zohodesk/dot 1.0.0-temp-230.4 → 1.0.0-temp-232.1

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