@zohodesk/dot 1.0.0-temp-200.7 → 1.0.0-temp-213

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 (148) hide show
  1. package/.cli/propValidation_report.html +1 -1
  2. package/README.md +9 -0
  3. package/assets/Appearance/dark/mode/Dot_DarkMode.module.css +1 -1
  4. package/assets/Appearance/light/mode/Dot_LightMode.module.css +1 -1
  5. package/assets/Appearance/pureDark/mode/Dot_PureDarkMode.module.css +1 -1
  6. package/es/ActionButton/ActionButton.module.css +2 -2
  7. package/es/AlphabeticList/AlphabeticList.module.css +2 -2
  8. package/es/Attachment/Attachment.module.css +4 -8
  9. package/es/AttachmentViewer/Attachment.js +0 -50
  10. package/es/AttachmentViewer/AttachmentViewer.js +26 -108
  11. package/es/AttachmentViewer/AttachmentViewer.module.css +18 -41
  12. package/es/AttachmentViewer/props/defaultProps.js +2 -10
  13. package/es/AttachmentViewer/props/propTypes.js +1 -9
  14. package/es/AttachmentViewer/utils.js +13 -80
  15. package/es/ChannelIcon/ChannelIcon.module.css +2 -2
  16. package/es/DotProvider/hooks/useDotProvider.js +2 -2
  17. package/es/Drawer/Drawer.module.css +1 -1
  18. package/es/FormAction/FormAction.module.css +1 -1
  19. package/es/IconButton/IconButton.module.css +2 -2
  20. package/es/Message/Message.js +1 -1
  21. package/es/Message/Message.module.css +1 -1
  22. package/es/MessageBanner/MessageBanner.module.css +1 -1
  23. package/es/Onboarding/CarouselDots/CarouselDot/css/CarouselDot.module.css +3 -3
  24. package/es/Onboarding/css/Onboarding.module.css +2 -2
  25. package/es/PlusIcon/PlusIcon.module.css +1 -1
  26. package/es/TagWithIcon/TagWithIcon.module.css +2 -2
  27. package/es/ToastMessage/ToastMessage.module.css +8 -8
  28. package/es/Upload/Upload.module.css +1 -1
  29. package/es/avatar/AvatarClose/AvatarClose.module.css +3 -3
  30. package/es/avatar/AvatarCollision/AvatarCollision.module.css +3 -3
  31. package/es/avatar/AvatarIcon/AvatarIcon.module.css +1 -1
  32. package/es/avatar/AvatarStatus/AvatarStatus.module.css +2 -2
  33. package/es/avatar/AvatarThread/AvatarThread.module.css +2 -2
  34. package/es/avatar/AvatarUser/AvatarUser.module.css +3 -3
  35. package/es/avatar/AvatarWithTeam/AvatarWithTeam.module.css +1 -1
  36. package/es/common/dot_common.module.css +4 -0
  37. package/es/deprecated/SelectDropdown/SelectDropdown.module.css +2 -2
  38. package/es/dropdown/ToggleDropDown/ToggleDropDown.js +30 -7
  39. package/es/dropdown/ToggleDropDown/ToggleDropDown.module.css +1 -1
  40. package/es/dropdown/ToggleDropDown/props/defaultProps.js +2 -1
  41. package/es/dropdown/ToggleDropDown/props/propTypes.js +2 -1
  42. package/es/errorstate/EmptyStates.module.css +1 -1
  43. package/es/errorstate/WillBack/WillBack.module.css +1 -1
  44. package/es/form/fields/Fields.module.css +9 -9
  45. package/es/form/fields/TagsMultiSelect/TagsMultiSelect.module.css +2 -2
  46. package/es/form/fields/TextEditorWrapper/TextEditorWrapper.js +1 -1
  47. package/es/form/layout/Section/ModuleFormSection.module.css +1 -1
  48. package/es/layout/SetupDetailLayout/SetupDetailLayout.module.css +4 -4
  49. package/es/layout/SubtabLayout/SubtabLayout.module.css +1 -1
  50. package/es/list/DotNew/DotNew.module.css +1 -1
  51. package/es/list/ListStencils/ListStencils.module.css +3 -3
  52. package/es/list/SecondaryText/SecondaryText.module.css +4 -4
  53. package/es/list/SecondryPanel/SecondryPanel.module.css +1 -1
  54. package/es/list/Subject/Subject.module.css +2 -2
  55. package/es/list/TagNew/TagNew.module.css +1 -1
  56. package/es/list/Thread/Thread.module.css +1 -1
  57. package/es/list/listCommon.module.css +3 -3
  58. package/es/list/status/StatusDropdown/StatusDropdown.js +2 -2
  59. package/es/list/status/StatusDropdown/StatusDropdown.module.css +1 -1
  60. package/es/list/status/StatusListItem/StatusListItem.module.css +2 -2
  61. package/es/lookup/EmptyPage/LookupEmptyPage.module.css +1 -1
  62. package/es/lookup/Section/LookupSection.module.css +1 -1
  63. package/es/lookup/header/Title/LookupTitle.module.css +1 -1
  64. package/es/lookup/header/ViewDropDown/ViewDropDown.module.css +4 -4
  65. package/es/lookup/header/lookupHeaderCommon.module.css +1 -1
  66. package/es/setup/header/Link/HeaderLink.module.css +2 -2
  67. package/es/setup/helptips/Title/HelpTipsTitle.module.css +1 -1
  68. package/es/setup/table/Text/TableText.module.css +4 -4
  69. package/es/utils/General.js +1 -23
  70. package/es/version2/GlobalNotification/GlobalNotification.module.css +2 -2
  71. package/es/version2/lookup/AlertHeader/css/AlertHeaderNew.module.css +1 -1
  72. package/es/version2/lookup/AlertLookup/AlertLookupNew.module.css +4 -4
  73. package/es/version2/lookup/alertLookupCommonNew.module.css +1 -1
  74. package/es/version2/notification/DesktopNotification/DesktopNotification.module.css +6 -6
  75. package/es/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +2 -2
  76. package/lib/ActionButton/ActionButton.module.css +2 -2
  77. package/lib/AlphabeticList/AlphabeticList.module.css +2 -2
  78. package/lib/Attachment/Attachment.module.css +4 -8
  79. package/lib/AttachmentViewer/Attachment.js +0 -60
  80. package/lib/AttachmentViewer/AttachmentViewer.js +23 -121
  81. package/lib/AttachmentViewer/AttachmentViewer.module.css +18 -41
  82. package/lib/AttachmentViewer/props/defaultProps.js +2 -10
  83. package/lib/AttachmentViewer/props/propTypes.js +1 -9
  84. package/lib/AttachmentViewer/utils.js +8 -85
  85. package/lib/ChannelIcon/ChannelIcon.module.css +2 -2
  86. package/lib/DotProvider/hooks/useDotProvider.js +2 -2
  87. package/lib/Drawer/Drawer.module.css +1 -1
  88. package/lib/FormAction/FormAction.module.css +1 -1
  89. package/lib/IconButton/IconButton.module.css +2 -2
  90. package/lib/Message/Message.js +2 -2
  91. package/lib/Message/Message.module.css +1 -1
  92. package/lib/MessageBanner/MessageBanner.module.css +1 -1
  93. package/lib/Onboarding/CarouselDots/CarouselDot/css/CarouselDot.module.css +3 -3
  94. package/lib/Onboarding/css/Onboarding.module.css +2 -2
  95. package/lib/PlusIcon/PlusIcon.module.css +1 -1
  96. package/lib/TagWithIcon/TagWithIcon.module.css +2 -2
  97. package/lib/ToastMessage/ToastMessage.module.css +8 -8
  98. package/lib/Upload/Upload.module.css +1 -1
  99. package/lib/avatar/AvatarClose/AvatarClose.module.css +3 -3
  100. package/lib/avatar/AvatarCollision/AvatarCollision.module.css +3 -3
  101. package/lib/avatar/AvatarIcon/AvatarIcon.module.css +1 -1
  102. package/lib/avatar/AvatarStatus/AvatarStatus.module.css +2 -2
  103. package/lib/avatar/AvatarThread/AvatarThread.module.css +2 -2
  104. package/lib/avatar/AvatarUser/AvatarUser.module.css +3 -3
  105. package/lib/avatar/AvatarWithTeam/AvatarWithTeam.module.css +1 -1
  106. package/lib/common/dot_common.module.css +4 -0
  107. package/lib/deprecated/SelectDropdown/SelectDropdown.module.css +2 -2
  108. package/lib/dropdown/ToggleDropDown/ToggleDropDown.js +34 -11
  109. package/lib/dropdown/ToggleDropDown/ToggleDropDown.module.css +1 -1
  110. package/lib/dropdown/ToggleDropDown/props/defaultProps.js +2 -1
  111. package/lib/dropdown/ToggleDropDown/props/propTypes.js +2 -1
  112. package/lib/errorstate/EmptyStates.module.css +1 -1
  113. package/lib/errorstate/WillBack/WillBack.module.css +1 -1
  114. package/lib/form/fields/Fields.module.css +9 -9
  115. package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.module.css +2 -2
  116. package/lib/form/fields/TextEditorWrapper/TextEditorWrapper.js +2 -2
  117. package/lib/form/layout/Section/ModuleFormSection.module.css +1 -1
  118. package/lib/layout/SetupDetailLayout/SetupDetailLayout.module.css +4 -4
  119. package/lib/layout/SubtabLayout/SubtabLayout.module.css +1 -1
  120. package/lib/list/DotNew/DotNew.module.css +1 -1
  121. package/lib/list/ListStencils/ListStencils.module.css +3 -3
  122. package/lib/list/SecondaryText/SecondaryText.module.css +4 -4
  123. package/lib/list/SecondryPanel/SecondryPanel.module.css +1 -1
  124. package/lib/list/Subject/Subject.module.css +2 -2
  125. package/lib/list/TagNew/TagNew.module.css +1 -1
  126. package/lib/list/Thread/Thread.module.css +1 -1
  127. package/lib/list/listCommon.module.css +3 -3
  128. package/lib/list/status/StatusDropdown/StatusDropdown.js +3 -3
  129. package/lib/list/status/StatusDropdown/StatusDropdown.module.css +1 -1
  130. package/lib/list/status/StatusListItem/StatusListItem.module.css +2 -2
  131. package/lib/lookup/EmptyPage/LookupEmptyPage.module.css +1 -1
  132. package/lib/lookup/Section/LookupSection.module.css +1 -1
  133. package/lib/lookup/header/Title/LookupTitle.module.css +1 -1
  134. package/lib/lookup/header/ViewDropDown/ViewDropDown.module.css +4 -4
  135. package/lib/lookup/header/lookupHeaderCommon.module.css +1 -1
  136. package/lib/setup/header/Link/HeaderLink.module.css +2 -2
  137. package/lib/setup/helptips/Title/HelpTipsTitle.module.css +1 -1
  138. package/lib/setup/table/Text/TableText.module.css +4 -4
  139. package/lib/utils/General.js +1 -25
  140. package/lib/version2/GlobalNotification/GlobalNotification.module.css +2 -2
  141. package/lib/version2/lookup/AlertHeader/css/AlertHeaderNew.module.css +1 -1
  142. package/lib/version2/lookup/AlertLookup/AlertLookupNew.module.css +4 -4
  143. package/lib/version2/lookup/alertLookupCommonNew.module.css +1 -1
  144. package/lib/version2/notification/DesktopNotification/DesktopNotification.module.css +6 -6
  145. package/lib/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +2 -2
  146. package/package.json +19 -15
  147. package/result.json +0 -1
  148. package/unittest/index.html +0 -45
@@ -5,7 +5,7 @@
5
5
  }
6
6
  .container {
7
7
  composes: varClass;
8
- composes: h100 from '~@zohodesk/components/lib/common/common.module.css';
8
+ composes: h100 from '~@zohodesk/components/es/common/common.module.css';
9
9
  list-style: none;
10
10
  pointer-events: initial;
11
11
  margin: 0 ;
@@ -27,7 +27,7 @@
27
27
  padding: var(--zd_size3) 0 ;
28
28
  }
29
29
  .heading {
30
- composes: dotted from '~@zohodesk/components/lib/common/common.module.css';
30
+ composes: dotted from '~@zohodesk/components/es/common/common.module.css';
31
31
  max-width: 100% ;
32
32
  }
33
33
  .list {
@@ -14,15 +14,15 @@
14
14
  height: 100% ;
15
15
  width: 100% ;
16
16
  position: absolute;
17
- top: 0
17
+ top:0
18
18
  }
19
19
 
20
20
  [dir=ltr] .disableLayer {
21
- left: 0
21
+ left:0
22
22
  }
23
23
 
24
24
  [dir=rtl] .disableLayer {
25
- right: 0
25
+ right:0
26
26
  }
27
27
 
28
28
  .attachmentHover {
@@ -66,10 +66,6 @@
66
66
  height: var(--zd_size40) ;
67
67
  }
68
68
 
69
- .attachleft {
70
- padding: var(--zd_size3) ;
71
- }
72
-
73
69
  [dir=ltr] .attachleft {
74
70
  border-right: 1px solid var(--zdt_attachment_default_border);
75
71
  }
@@ -119,7 +115,7 @@
119
115
 
120
116
  .atatchName,
121
117
  .attachSize {
122
- composes: dotted from '~@zohodesk/components/lib/common/common.module.css';
118
+ composes: dotted from '~@zohodesk/components/es/common/common.module.css';
123
119
  }
124
120
 
125
121
  .medium .attachSize {
@@ -3,13 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getAttachmentIconDetails = getAttachmentIconDetails;
7
6
  exports.getExtensionFromFileName = getExtensionFromFileName;
8
7
  exports.isAudioFile = isAudioFile;
9
8
  exports.isBrowserSupportedFile = isBrowserSupportedFile;
10
-
11
- var _General = require("../utils/General");
12
-
13
9
  var UNASSIGNED = 'Unassigned';
14
10
  var BROWSER_SUPPORTED_FILES = ['pdf', 'text', 'txt', 'css', 'jpg', 'jpeg', 'gif', 'png', 'bmp', 'ico', 'sh', 'mp3', 'wav', 'ogg'];
15
11
 
@@ -29,60 +25,4 @@ function getExtensionFromFileName(fileName) {
29
25
  function isBrowserSupportedFile(fileName) {
30
26
  var extension = getExtensionFromFileName(fileName);
31
27
  return BROWSER_SUPPORTED_FILES.indexOf(extension) !== -1;
32
- }
33
-
34
- function getAttachmentIconDetails(fileName) {
35
- var _getExtensionFromFile;
36
-
37
- var extension = (_getExtensionFromFile = getExtensionFromFileName(fileName)) === null || _getExtensionFromFile === void 0 ? void 0 : _getExtensionFromFile.toLowerCase();
38
- if (!extension) return 'ZD-GN-fileUnknown';
39
- var imageExtensions = new Set(['jpeg', 'jpg', 'png', 'apng', 'gif', 'bmp', 'tiff', 'tif', 'ico', 'svg', 'heic', 'webp']);
40
- var docExtensions = new Set(['txt']);
41
- var pdfExtensions = new Set(['pdf']);
42
- var htmlExtensions = new Set(['html', 'htm', 'xhtml']);
43
- var pptExtensions = new Set(['ppt', 'pps', 'odp', 'sxi', 'pptx', 'ppsx', 'pot', 'potx', 'key']);
44
- var zipExtensions = new Set(['rar', 'jar', 'zip']);
45
- var wordExtensions = new Set(['doc', 'docx', 'sxw', 'odt', 'docm', 'dot', 'dotm', 'dotx', 'rtf', 'pages']);
46
- var xmlExtensions = new Set(['xml']);
47
- var sheetExtensions = new Set(['xls', 'xlsx', 'xlsm', 'xlsb', 'sxc', 'ods', 'csv', 'tsv', 'numbers']);
48
- var audioExtensions = new Set(['mp3', 'wav', 'wma', 'aac', 'm4r', 'ogg', 'opus']);
49
- var videoExtensions = new Set(['mp4', 'mkv', 'mov', 'mpeg', 'flv', 'wmv', 'avi', 'webm', 'ogv']);
50
- var mailExtensions = new Set(['eml', 'msg']);
51
- var linuxExtensions = new Set(['sh', 'bin']);
52
- var cssExtensions = new Set(['css']);
53
- var exeExtensions = new Set(['exe']);
54
- var eventExtensions = new Set(['ics']);
55
- if (imageExtensions.has(extension)) return 'ZD-EF-fileImage';
56
- if (docExtensions.has(extension)) return 'ZD-GN-fileDoc';
57
- if (pdfExtensions.has(extension)) return 'ZD-EF-filePdf';
58
- if (pptExtensions.has(extension)) return 'ZD-GN-filePpt';
59
- if (zipExtensions.has(extension)) return 'ZD-EF-fileZip';
60
-
61
- if (wordExtensions.has(extension)) {
62
- var _navigator$platform;
63
-
64
- var OSName = ((_navigator$platform = navigator.platform) === null || _navigator$platform === void 0 ? void 0 : _navigator$platform.toLowerCase()) || '';
65
- return OSName.includes('mac') || OSName.includes('linux') ? 'ZD-EF-fileOffice' : 'ZD-EF-fileWord';
66
- }
67
-
68
- if (xmlExtensions.has(extension)) return 'ZD-EF-fileXml';
69
- if (sheetExtensions.has(extension)) return 'ZD-GN-fileSheet';
70
- if (audioExtensions.has(extension)) return 'ZD-EF-fileMp3';
71
- if (videoExtensions.has(extension)) return 'ZD-EF-fileMp4';
72
- if (mailExtensions.has(extension)) return 'ZD-GN-fileMail';
73
- if (linuxExtensions.has(extension)) return 'ZD-EF-linux';
74
- if (cssExtensions.has(extension)) return 'ZD-EF-clrCss';
75
- if (exeExtensions.has(extension)) return 'ZD-EF-exe';
76
- if (eventExtensions.has(extension)) return 'ZD-TK-event';
77
-
78
- if (htmlExtensions.has(extension)) {
79
- var _getBrowserWithVersio;
80
-
81
- var browser = ((_getBrowserWithVersio = (0, _General.getBrowserWithVersion)()) === null || _getBrowserWithVersio === void 0 ? void 0 : _getBrowserWithVersio.toLowerCase()) || '';
82
- if (browser.includes('chrome') || browser.includes('safari')) return 'ZD-EF-fileXml';
83
- if (browser.includes('ie') || browser.includes('edge')) return 'ZD-EF-explorer';
84
- return 'ZD-EF-firebox';
85
- }
86
-
87
- return 'ZD-GN-fileUnknown';
88
28
  }
@@ -21,12 +21,8 @@ var _Avatar = _interopRequireDefault(require("@zohodesk/components/lib/Avatar/Av
21
21
 
22
22
  var _CustomResponsive = require("@zohodesk/components/lib/Responsive/CustomResponsive");
23
23
 
24
- var _Typography = _interopRequireDefault(require("@zohodesk/components/lib/Typography/Typography"));
25
-
26
24
  var _IdProvider = require("@zohodesk/components/lib/Provider/IdProvider");
27
25
 
28
- var _Button = _interopRequireDefault(require("@zohodesk/components/es/Button/Button"));
29
-
30
26
  var _AttachmentImage = _interopRequireDefault(require("./AttachmentImage"));
31
27
 
32
28
  var _Link = _interopRequireDefault(require("../Link/Link"));
@@ -39,9 +35,11 @@ var _Attachment = require("./Attachment");
39
35
 
40
36
  var _General = require("../utils/General");
41
37
 
38
+ var _AttachmentViewerModule = _interopRequireDefault(require("./AttachmentViewer.module.css"));
39
+
42
40
  var _utils = require("./utils");
43
41
 
44
- var _AttachmentViewerModule = _interopRequireDefault(require("./AttachmentViewer.module.css"));
42
+ var _audio_thumbnail = _interopRequireDefault(require("../../images/audio_thumbnail.png"));
45
43
 
46
44
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
47
45
 
@@ -119,45 +117,10 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
119
117
  _this.getUpdateDataList = _this.getUpdateDataList.bind(_assertThisInitialized(_this));
120
118
  _this.zoomMaintain = _this.zoomMaintain.bind(_assertThisInitialized(_this));
121
119
  _this.handleMenuValidation = _this.handleMenuValidation.bind(_assertThisInitialized(_this));
122
- _this.getPreviewIconData = _this.getPreviewIconData.bind(_assertThisInitialized(_this));
123
- _this.renderIframe = _this.renderIframe.bind(_assertThisInitialized(_this));
124
120
  return _this;
125
121
  }
126
122
 
127
123
  _createClass(AttachmentViewer, [{
128
- key: "isImageFileType",
129
- value: function isImageFileType(fileName) {
130
- var _getExtensionFromFile;
131
-
132
- var extension = (_getExtensionFromFile = (0, _Attachment.getExtensionFromFileName)(fileName)) === null || _getExtensionFromFile === void 0 ? void 0 : _getExtensionFromFile.toLowerCase();
133
- if (!extension) return false;
134
- return _utils.FILE_EXTENSIONS.image.map(function (ext) {
135
- return ext.toLowerCase();
136
- }).includes(extension);
137
- }
138
- }, {
139
- key: "isVideoFileType",
140
- value: function isVideoFileType(fileName) {
141
- var _getExtensionFromFile2;
142
-
143
- var extension = (_getExtensionFromFile2 = (0, _Attachment.getExtensionFromFileName)(fileName)) === null || _getExtensionFromFile2 === void 0 ? void 0 : _getExtensionFromFile2.toLowerCase();
144
- if (!extension) return false;
145
- return _utils.FILE_EXTENSIONS.video.map(function (ext) {
146
- return ext.toLowerCase();
147
- }).includes(extension);
148
- }
149
- }, {
150
- key: "isAudioFileType",
151
- value: function isAudioFileType(fileName) {
152
- var _getExtensionFromFile3;
153
-
154
- var extension = (_getExtensionFromFile3 = (0, _Attachment.getExtensionFromFileName)(fileName)) === null || _getExtensionFromFile3 === void 0 ? void 0 : _getExtensionFromFile3.toLowerCase();
155
- if (!extension) return false;
156
- return _utils.FILE_EXTENSIONS.audio.map(function (ext) {
157
- return ext.toLowerCase();
158
- }).includes(extension);
159
- }
160
- }, {
161
124
  key: "componentDidMount",
162
125
  value: function componentDidMount() {
163
126
  this.handleMenuValidation();
@@ -200,17 +163,13 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
200
163
  var _this$state = this.state,
201
164
  data = _this$state.data,
202
165
  selectedIndex = _this$state.selectedIndex;
203
- var allowedPreviewExtensionsData = this.props.allowedPreviewExtensionsData;
204
166
  var selectedAttachment = data[selectedIndex] || {};
205
167
  var selectedAttachmentViewUrl = selectedAttachment.viewUrl;
206
168
  var selectedAttachmentDownloadUrl = selectedAttachment.downloadUrl;
207
169
  var selectedAttachmentName = selectedAttachment.name;
208
- var selectedAttachmentPreviewUrl = selectedAttachment.previewurl;
209
170
  (0, _utils.checkFileSourcesValidation)({
210
171
  fileName: selectedAttachmentName,
211
- viewURL: selectedAttachmentViewUrl,
212
- previewUrl: selectedAttachmentPreviewUrl,
213
- allowedPreviewExtensionsData: allowedPreviewExtensionsData
172
+ viewURL: selectedAttachmentViewUrl
214
173
  }).then(function (fileSourceValidation) {
215
174
  var isViewURLValid = fileSourceValidation.isViewURLValid,
216
175
  canZoom = fileSourceValidation.canZoom;
@@ -373,38 +332,9 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
373
332
  }])
374
333
  };
375
334
  }
376
- }, {
377
- key: "getPreviewIconData",
378
- value: function getPreviewIconData(name, size, dataId) {
379
- var fileUnknown = {
380
- iconName: 'ZD-GN-fileUnknown',
381
- iconSize: '40'
382
- };
383
- var fileIconName = (0, _Attachment.getAttachmentIconDetails)(name);
384
- var fileDetails = name ? {
385
- iconName: fileIconName,
386
- iconSize: size
387
- } : fileUnknown;
388
- var iconName = fileDetails.iconName,
389
- iconSize = fileDetails.iconSize;
390
- return /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
391
- iconClass: _AttachmentViewerModule["default"].prevFooterIcon,
392
- name: iconName,
393
- size: iconSize,
394
- "data-id": dataId
395
- });
396
- }
397
- }, {
398
- key: "renderIframe",
399
- value: function renderIframe(previewurl) {
400
- return /*#__PURE__*/_react["default"].createElement("iframe", _extends({
401
- src: previewurl,
402
- className: _AttachmentViewerModule["default"].previewFrame
403
- }, this.props.customProps.iframeProps));
404
- }
405
335
  }, {
406
336
  key: "imgPreviewView",
407
- value: function imgPreviewView(downloadUrl) {
337
+ value: function imgPreviewView() {
408
338
  var _this5 = this;
409
339
 
410
340
  var _this$state3 = this.state,
@@ -415,9 +345,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
415
345
  isPreviewAttachmentValid = _this$state3.isPreviewAttachmentValid;
416
346
  var _this$props = this.props,
417
347
  maintainZoom = _this$props.maintainZoom,
418
- dataId = _this$props.dataId,
419
- i18nKeys = _this$props.i18nKeys,
420
- renderUnSupportedElement = _this$props.renderUnSupportedElement;
348
+ dataId = _this$props.dataId;
421
349
 
422
350
  var getImgStyle = function getImgStyle(i) {
423
351
  var position;
@@ -455,21 +383,16 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
455
383
  _data$customClass = data.customClass,
456
384
  customClass = _data$customClass === void 0 ? {} : _data$customClass,
457
385
  _data$customProps = data.customProps,
458
- customProps = _data$customProps === void 0 ? {} : _data$customProps,
459
- previewurl = data.previewurl,
460
- type = data.type;
386
+ customProps = _data$customProps === void 0 ? {} : _data$customProps;
461
387
  var _customProps$audioPro = customProps.audioProps,
462
388
  audioProps = _customProps$audioPro === void 0 ? {} : _customProps$audioPro,
463
389
  _customProps$imagePro = customProps.imageProps,
464
- imageProps = _customProps$imagePro === void 0 ? {} : _customProps$imagePro,
465
- _customProps$videoPro = customProps.videoProps,
466
- videoProps = _customProps$videoPro === void 0 ? {} : _customProps$videoPro;
390
+ imageProps = _customProps$imagePro === void 0 ? {} : _customProps$imagePro;
467
391
  var _customClass$customIm = customClass.customImageClass,
468
392
  customImageClass = _customClass$customIm === void 0 ? '' : _customClass$customIm,
469
393
  _customClass$customCh = customClass.customChildrenClass,
470
394
  customChildrenClass = _customClass$customCh === void 0 ? '' : _customClass$customCh;
471
395
  var retainZoom = canZoom && selectedIndex == i && maintainZoom;
472
- var extension = (0, _Attachment.getExtensionFromFileName)(name);
473
396
  return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
474
397
  className: _AttachmentViewerModule["default"].imgBox,
475
398
  id: "imgBox".concat(i),
@@ -480,51 +403,29 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
480
403
  }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
481
404
  className: _AttachmentViewerModule["default"].imgRef,
482
405
  id: "imgPreviewRef".concat(i)
483
- }, selectedIndex == i && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _this5.isAudioFileType(name) ? /*#__PURE__*/_react["default"].createElement("audio", _extends({
484
- controls: true,
485
- className: _AttachmentViewerModule["default"].zoomIn,
486
- "data-id": "".concat(dataId, "_audioPreview"),
487
- "data-test-id": "".concat(dataId, "_audioPreview")
488
- }, audioProps), /*#__PURE__*/_react["default"].createElement("source", {
489
- src: previewurl,
490
- type: "audio/".concat(extension)
491
- })) : _this5.isVideoFileType(name) ? /*#__PURE__*/_react["default"].createElement("video", _extends({
406
+ }, (0, _Attachment.isAudioFile)(name) ? selectedIndex == i ? /*#__PURE__*/_react["default"].createElement("video", _extends({
407
+ autoPlay: true,
492
408
  controls: true,
493
409
  className: _AttachmentViewerModule["default"].zoomIn,
494
410
  "data-id": "".concat(dataId, "_videoPreview"),
495
411
  "data-test-id": "".concat(dataId, "_videoPreview")
496
- }, videoProps), /*#__PURE__*/_react["default"].createElement("source", {
412
+ }, audioProps), /*#__PURE__*/_react["default"].createElement("source", {
497
413
  src: viewUrl,
498
- type: "video/".concat(extension)
499
- })) : _this5.isImageFileType(name) || children ? /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
414
+ type: "audio/".concat((0, _Attachment.getExtensionFromFileName)(name))
415
+ })) : null : /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
500
416
  customClass: {
501
- 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),
417
+ customImageClass: "".concat(_AttachmentViewerModule["default"].img, " ").concat(_AttachmentViewerModule["default"].altText, "\n ").concat(canZoom || retainZoom ? isZoomed ? "".concat(_AttachmentViewerModule["default"].zoomedImg, " ").concat(_AttachmentViewerModule["default"].zoomOutCursor) : "".concat(_AttachmentViewerModule["default"].normalImg, " ").concat(_AttachmentViewerModule["default"].zoomInCursor) : '', " ").concat(customImageClass),
502
418
  customChildrenClass: customChildrenClass
503
419
  },
504
420
  src: viewUrl,
505
421
  onClick: isPreviewAttachmentValid ? isZoomed ? _this5.zoomOut.bind(_this5, i) : function (e) {
506
- return _this5.zoomIn(e, i, true);
422
+ _this5.zoomIn(e, i, true);
507
423
  } : undefined,
508
424
  alt: name,
509
425
  dataId: dataId,
510
426
  id: "img".concat(i),
511
427
  isCover: false
512
- }, imageProps), children) : type === "document" && previewurl != null ? _this5.renderIframe(previewurl) : typeof renderUnSupportedElement === 'function' ? renderUnSupportedElement(data) : /*#__PURE__*/_react["default"].createElement("div", {
513
- className: _AttachmentViewerModule["default"].previewNone
514
- }, /*#__PURE__*/_react["default"].createElement("div", {
515
- className: _AttachmentViewerModule["default"].fileTypeImg
516
- }, _this5.getPreviewIconData(name, '70')), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
517
- $ui_size: "20",
518
- $ui_weight: "semibold"
519
- }, i18nKeys.previewUnsupportedText), /*#__PURE__*/_react["default"].createElement(_Link["default"], {
520
- href: downloadUrl,
521
- className: _AttachmentViewerModule["default"].downloadLink,
522
- hasReload: true,
523
- download: true
524
- }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
525
- palette: "primaryFilled",
526
- text: i18nKeys.downloadText
527
- }))))));
428
+ }, imageProps), children)));
528
429
  });
529
430
  }
530
431
  }, {
@@ -550,7 +451,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
550
451
  avatarProps = _customProps$avatarPr === void 0 ? {} : _customProps$avatarPr;
551
452
  var totalLen = data.length;
552
453
  var selectedAttachment = data[selectedIndex] || {};
553
- var selectedImgUrl = selectedAttachment.previewurl || selectedAttachment.viewUrl;
454
+ var selectedImgUrl = selectedAttachment.viewUrl;
554
455
  var downloadUrl = selectedAttachment.downloadUrl;
555
456
  var authorHref;
556
457
  var authorName;
@@ -705,7 +606,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
705
606
  eleRef: _this6.setImgBoxRef,
706
607
  scroll: "both",
707
608
  flexible: true
708
- }, _this6.imgPreviewView(downloadUrl)), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
609
+ }, _this6.imgPreviewView()), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
709
610
  className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(totalLen === selectedIndex + 1 ? _AttachmentViewerModule["default"].hidden : ''),
710
611
  onClick: _this6.changeSelectedIndex.bind(_this6, selectedIndex + 1),
711
612
  "data-title": i18nKeys.nextText,
@@ -761,13 +662,14 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
761
662
  _item$customProps = item.customProps,
762
663
  customProps = _item$customProps === void 0 ? {} : _item$customProps;
763
664
  var thumbnail = item.thumbnail;
764
- var isImageFileType = _this6.isImageFileType(name) || thumbnail;
765
665
  var _customClass$customIm2 = customClass.customImageClass,
766
666
  customImageClass = _customClass$customIm2 === void 0 ? '' : _customClass$customIm2,
767
667
  _customClass$customCh2 = customClass.customChildrenClass,
768
668
  customChildrenClass = _customClass$customCh2 === void 0 ? '' : _customClass$customCh2;
669
+ thumbnail = (0, _Attachment.isAudioFile)(name) ? thumbnail || _audio_thumbnail["default"] : thumbnail; //fallback thumbnail for audio
670
+
769
671
  return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
770
- className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : '', " ").concat(isImageFileType ? '' : _AttachmentViewerModule["default"].previewIconDiv),
672
+ className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : ''),
771
673
  key: index,
772
674
  onClick: _this6.changeSelectedIndex.bind(_this6, index),
773
675
  eleRef: function eleRef(el) {
@@ -775,7 +677,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
775
677
  },
776
678
  dataId: "attachPreviewList",
777
679
  "data-title": name
778
- }, isImageFileType || children ? /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
680
+ }, /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
779
681
  src: thumbnail || viewUrl,
780
682
  size: "small",
781
683
  alt: name,
@@ -784,7 +686,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
784
686
  customChildrenClass: "".concat(_AttachmentViewerModule["default"].crsrPointer, " ").concat(customChildrenClass)
785
687
  },
786
688
  dataId: dataId
787
- }, customProps), children) : _this6.getPreviewIconData(name, '40'));
689
+ }, customProps), children));
788
690
  }))))), totalLen !== 1 && /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
789
691
  dataId: "attachToggle",
790
692
  onClick: _this6.togglePViewList,
@@ -2,7 +2,7 @@
2
2
  height: var(--zd_size40) ;
3
3
  position: relative;
4
4
  z-index: 1;
5
- composes: alignVertical from '~@zohodesk/components/lib/common/common.module.css';
5
+ composes: alignVertical from '~@zohodesk/components/es/common/common.module.css';
6
6
  background-color: var(--zdt_attachmentviewer_header_bg);
7
7
  padding: 0 var(--zd_size15) ;
8
8
  border-bottom: 1px solid var(--zdt_attachmentviewer_header_border);
@@ -10,7 +10,7 @@
10
10
 
11
11
  .title {
12
12
  max-width: 50% ;
13
- composes: dotted from '~@zohodesk/components/lib/common/common.module.css';
13
+ composes: dotted from '~@zohodesk/components/es/common/common.module.css';
14
14
  }
15
15
 
16
16
  [dir=ltr] .title {
@@ -23,7 +23,7 @@
23
23
 
24
24
  .count {
25
25
  position: absolute;
26
- composes: xMiddle from '~@zohodesk/components/lib/common/common.module.css';
26
+ composes: xMiddle from '~@zohodesk/components/es/common/common.module.css';
27
27
  padding: 0 var(--zd_size10) ;
28
28
  }
29
29
 
@@ -79,13 +79,13 @@
79
79
  font-size: var(--zd_font_size22) ;
80
80
  height: var(--zd_size38) ;
81
81
  width: var(--zd_size38) ;
82
- line-height: 1.6;
82
+ line-height: 1.6364;
83
83
  border-radius: 50%;
84
84
  cursor: pointer;
85
85
  }
86
86
 
87
87
  .preview {
88
- composes: posrel from '~@zohodesk/components/lib/common/common.module.css';
88
+ composes: posrel from '~@zohodesk/components/es/common/common.module.css';
89
89
  text-align: center;
90
90
  margin: var(--zd_size20) 0 ;
91
91
  }
@@ -94,7 +94,7 @@
94
94
  max-height: 100% ;
95
95
  max-width: 90% ;
96
96
  position: absolute;
97
- composes: middleBoth from '~@zohodesk/components/lib/common/common.module.css';
97
+ composes: middleBoth from '~@zohodesk/components/es/common/common.module.css';
98
98
  }
99
99
 
100
100
  .zoomOut {
@@ -230,10 +230,14 @@
230
230
  transform: rotateX(0deg);
231
231
  }
232
232
 
233
- .previewFrame {
234
- height: 100% ;
235
- width: 100% ;
236
- border: 0;
233
+ .isAudio {
234
+ composes: audioImage from '../common/dot_common.module.css';
235
+ width: var(--zd_size100) ;
236
+ background-size: 100% 100%;
237
+ }
238
+
239
+ .isAudio .image {
240
+ opacity: 0;
237
241
  }
238
242
 
239
243
  .video {
@@ -269,7 +273,7 @@
269
273
  height: 100% ;
270
274
  max-width: 100% ;
271
275
  max-height: 100% ;
272
- composes: dflex from '~@zohodesk/components/lib/common/common.module.css';
276
+ composes: dflex from '~@zohodesk/components/es/common/common.module.css';
273
277
  }
274
278
 
275
279
  .img {
@@ -302,7 +306,7 @@
302
306
 
303
307
  .spinLoad {
304
308
  position: absolute;
305
- composes: middleBoth from '~@zohodesk/components/lib/common/common.module.css';
309
+ composes: middleBoth from '~@zohodesk/components/es/common/common.module.css';
306
310
  height: var(--zd_size18) ;
307
311
  width: var(--zd_size18) ;
308
312
  cursor: progress
@@ -312,7 +316,7 @@
312
316
  height: 100% ;
313
317
  width: 100% ;
314
318
  composes: rotate from '../common/dot_animation.module.css';
315
- composes: infinite from '~@zohodesk/components/lib/common/animation.module.css';
319
+ composes: infinite from '~@zohodesk/components/es/common/animation.module.css';
316
320
  border: 2px solid var(--zdt_attachmentviewer_loader_border);
317
321
  border-top-color: var(--zdt_attachmentviewer_loader_border_top);
318
322
  border-radius: 50%;
@@ -348,7 +352,7 @@
348
352
  .authorName {
349
353
  font-size: var(--zd_font_size15) ;
350
354
  color: var(--zdt_attachmentviewer_title_text);
351
- composes: dotted from '~@zohodesk/components/lib/common/common.module.css';
355
+ composes: dotted from '~@zohodesk/components/es/common/common.module.css';
352
356
  margin: 0 var(--zd_size10) ;
353
357
  }
354
358
 
@@ -358,31 +362,4 @@
358
362
  background-color: var(--dot_mirror);
359
363
  border: 0;
360
364
  cursor: pointer;
361
- }
362
-
363
- .fileTypeImg {
364
- margin-bottom: var(--zd_size30) ;
365
- }
366
-
367
- .previewNone {
368
- color: var(--zdt_attachmentviewer_title_text);
369
- max-width: 70% ;
370
- text-align: center;
371
- margin: auto ;
372
- }
373
-
374
- .downloadLink {
375
- display: inline-block;
376
- padding-top: var(--zd_size15) ;
377
- }
378
-
379
- .previewIconDiv {
380
- width: var(--zd_size60) ;
381
- composes: dflex from '~@zohodesk/components/lib/common/common.module.css';
382
- }
383
-
384
- .prevFooterIcon {
385
- color: var(--zdt_attachmentviewer_title_text);
386
- padding: var(--zd_size2) ;
387
- margin: auto ;
388
365
  }
@@ -15,18 +15,10 @@ exports.AttachmentImage_defaultProps = AttachmentImage_defaultProps;
15
15
  var AttachmentViewer_defaultProps = {
16
16
  responsiveId: "Helmet",
17
17
  needDownload: true,
18
- i18nKeys: {
19
- previewUnsupportedText: 'Preview not available for the selected file type.'
20
- },
18
+ i18nKeys: {},
21
19
  maintainZoom: false,
22
20
  isActive: false,
23
21
  dataId: 'AttachmentViewer',
24
- customProps: {},
25
- allowedPreviewExtensionsData: {
26
- audio: [],
27
- video: [],
28
- image: [],
29
- document: []
30
- }
22
+ customProps: {}
31
23
  };
32
24
  exports.AttachmentViewer_defaultProps = AttachmentViewer_defaultProps;
@@ -38,8 +38,7 @@ var AttachmentViewer_propTypes = {
38
38
  downloadText: _propTypes["default"].string,
39
39
  closeText: _propTypes["default"].string,
40
40
  hideText: _propTypes["default"].string,
41
- showText: _propTypes["default"].string,
42
- previewUnsupportedText: _propTypes["default"].string
41
+ showText: _propTypes["default"].string
43
42
  }),
44
43
  needDownload: _propTypes["default"].string,
45
44
  previewObj: _propTypes["default"].object,
@@ -47,13 +46,6 @@ var AttachmentViewer_propTypes = {
47
46
  maintainZoom: _propTypes["default"].bool,
48
47
  isActive: _propTypes["default"].bool,
49
48
  dataId: _propTypes["default"].string,
50
- allowedPreviewExtensionsData: _propTypes["default"].shape({
51
- audio: _propTypes["default"].arrayOf(_propTypes["default"].string),
52
- video: _propTypes["default"].arrayOf(_propTypes["default"].string),
53
- image: _propTypes["default"].arrayOf(_propTypes["default"].string),
54
- document: _propTypes["default"].arrayOf(_propTypes["default"].string)
55
- }),
56
- renderUnSupportedElement: _propTypes["default"].func,
57
49
  customProps: _propTypes["default"].shape({
58
50
  avatarProps: _propTypes["default"].exact(_propTypes2.propTypes)
59
51
  })