@zohodesk/dot 1.0.0-temp-72 → 1.0.0-temp-75

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 (37) hide show
  1. package/README.md +8 -0
  2. package/assets/Appearance/dark/mode/dotDarkMode.module.css +10 -0
  3. package/assets/Appearance/dark/themes/blue/blueDarkDotTheme.module.css +6 -0
  4. package/assets/Appearance/dark/themes/green/greenDarkDotTheme.module.css +6 -0
  5. package/assets/Appearance/dark/themes/orange/orangeDarkDotTheme.module.css +6 -0
  6. package/assets/Appearance/dark/themes/red/redDarkDotTheme.module.css +6 -0
  7. package/assets/Appearance/dark/themes/yellow/yellowDarkDotTheme.module.css +6 -0
  8. package/assets/Appearance/default/mode/dotDefaultMode.module.css +10 -0
  9. package/assets/Appearance/default/themes/blue/blueDefaultDotTheme.module.css +6 -0
  10. package/assets/Appearance/default/themes/green/greenDefaultDotTheme.module.css +6 -0
  11. package/assets/Appearance/default/themes/orange/orangeDefaultDotTheme.module.css +6 -0
  12. package/assets/Appearance/default/themes/red/redDefaultDotTheme.module.css +6 -0
  13. package/assets/Appearance/default/themes/yellow/yellowDefaultDotTheme.module.css +6 -0
  14. package/assets/Appearance/pureDark/mode/dotPureDarkMode.module.css +10 -0
  15. package/assets/Appearance/pureDark/themes/blue/bluePureDarkDotTheme.module.css +6 -0
  16. package/assets/Appearance/pureDark/themes/green/greenPureDarkDotTheme.module.css +6 -0
  17. package/assets/Appearance/pureDark/themes/orange/orangePureDarkDotTheme.module.css +6 -0
  18. package/assets/Appearance/pureDark/themes/red/redPureDarkDotTheme.module.css +6 -0
  19. package/assets/Appearance/pureDark/themes/yellow/yellowPureDarkDotTheme.module.css +6 -0
  20. package/es/AttachmentViewer/Attachment.js +17 -0
  21. package/es/AttachmentViewer/AttachmentImage.js +85 -0
  22. package/es/AttachmentViewer/AttachmentViewer.js +562 -0
  23. package/es/AttachmentViewer/AttachmentViewer.module.css +346 -0
  24. package/es/AttachmentViewer/utils.js +107 -0
  25. package/es/common/dot_animation.module.css +27 -0
  26. package/es/common/dot_common.module.css +4 -0
  27. package/es/form/fields/TextEditor/TextEditor.js +4 -1
  28. package/images/audio_thumbnail.png +0 -0
  29. package/lib/AttachmentViewer/Attachment.js +28 -0
  30. package/lib/AttachmentViewer/AttachmentImage.js +129 -0
  31. package/lib/AttachmentViewer/AttachmentViewer.js +645 -0
  32. package/lib/AttachmentViewer/AttachmentViewer.module.css +346 -0
  33. package/lib/AttachmentViewer/utils.js +134 -0
  34. package/lib/common/dot_animation.module.css +27 -0
  35. package/lib/common/dot_common.module.css +4 -0
  36. package/lib/form/fields/TextEditor/TextEditor.js +4 -1
  37. package/package.json +7 -7
@@ -0,0 +1,645 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _propTypes = _interopRequireDefault(require("prop-types"));
13
+
14
+ var _Layout = require("@zohodesk/components/lib/Layout");
15
+
16
+ var _Icon = _interopRequireDefault(require("@zohodesk/icons/lib/Icon"));
17
+
18
+ var _Avatar = _interopRequireDefault(require("@zohodesk/components/lib/Avatar/Avatar"));
19
+
20
+ var _CustomResponsive = require("@zohodesk/components/lib/Responsive/CustomResponsive");
21
+
22
+ var _IdProvider = require("@zohodesk/components/lib/Provider/IdProvider");
23
+
24
+ var _AttachmentImage = _interopRequireDefault(require("./AttachmentImage"));
25
+
26
+ var _Link = _interopRequireDefault(require("../Link/Link"));
27
+
28
+ var _IconButton = _interopRequireDefault(require("../IconButton/IconButton"));
29
+
30
+ var _FreezeLayer = _interopRequireDefault(require("../FreezeLayer/FreezeLayer"));
31
+
32
+ var _Attachment = require("./Attachment");
33
+
34
+ var _General = require("../utils/General");
35
+
36
+ var _AttachmentViewerModule = _interopRequireDefault(require("./AttachmentViewer.module.css"));
37
+
38
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
39
+
40
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
41
+
42
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
43
+
44
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
45
+
46
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
47
+
48
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
49
+
50
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
51
+
52
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
53
+
54
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
55
+
56
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
57
+
58
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
59
+
60
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
61
+
62
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
63
+
64
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
65
+
66
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
67
+
68
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
69
+
70
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
71
+
72
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
73
+
74
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
75
+
76
+ var AttachmentViewer = /*#__PURE__*/function (_Component) {
77
+ _inherits(AttachmentViewer, _Component);
78
+
79
+ var _super = _createSuper(AttachmentViewer);
80
+
81
+ function AttachmentViewer(props) {
82
+ var _this;
83
+
84
+ _classCallCheck(this, AttachmentViewer);
85
+
86
+ _this = _super.call(this, props);
87
+ _this.state = {
88
+ isPViewListOpen: !!(_this.props.previewObj && _this.props.previewObj.previewData),
89
+ selectedIndex: _this.props.previewObj.selectedIndex,
90
+ isZoomed: false,
91
+ data: _this.props.previewObj ? _this.props.previewObj.previewData : [],
92
+ dataList: _this.getUpdateDataList({
93
+ index: _this.props.previewObj.selectedIndex,
94
+ data: _this.props.previewObj ? _this.props.previewObj.previewData : [],
95
+ dataList: []
96
+ })
97
+ };
98
+ _this.togglePViewList = _this.togglePViewList.bind(_assertThisInitialized(_this));
99
+ _this.changeSelectedIndex = _this.changeSelectedIndex.bind(_assertThisInitialized(_this));
100
+ _this.closeAttachmentViewer = _this.closeAttachmentViewer.bind(_assertThisInitialized(_this));
101
+ _this.responsiveFunc = _this.responsiveFunc.bind(_assertThisInitialized(_this));
102
+ _this.zoomIn = _this.zoomIn.bind(_assertThisInitialized(_this));
103
+ _this.zoomOut = _this.zoomOut.bind(_assertThisInitialized(_this));
104
+ _this.imgPreviewView = _this.imgPreviewView.bind(_assertThisInitialized(_this));
105
+ _this.getNextId = (0, _IdProvider.getUniqueId)(_assertThisInitialized(_this));
106
+ _this.getUpdateDataList = _this.getUpdateDataList.bind(_assertThisInitialized(_this));
107
+ _this.zoomMaintain = _this.zoomMaintain.bind(_assertThisInitialized(_this));
108
+ return _this;
109
+ }
110
+
111
+ _createClass(AttachmentViewer, [{
112
+ key: "componentDidUpdate",
113
+ value: function componentDidUpdate(prevProps) {
114
+ var previewObj = this.props.previewObj;
115
+ var indexChanged = previewObj.selectedIndex != prevProps.previewObj.selectedIndex;
116
+
117
+ if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged) {
118
+ var objChanged = previewObj.previewData.some(function (value, index) {
119
+ return (0, _General.shallowDiff)(value, prevProps.previewObj[index]);
120
+ });
121
+
122
+ if (objChanged || indexChanged) {
123
+ this.setState({
124
+ selectedIndex: previewObj.selectedIndex,
125
+ data: previewObj ? previewObj.previewData : [],
126
+ dataList: this.getUpdateDataList({
127
+ index: previewObj.selectedIndex,
128
+ data: previewObj ? previewObj.previewData : [],
129
+ dataList: []
130
+ }),
131
+ isPViewListOpen: !!(this.props.previewObj && this.props.previewObj.previewData)
132
+ });
133
+ }
134
+ }
135
+ }
136
+ }, {
137
+ key: "togglePViewList",
138
+ value: function togglePViewList() {
139
+ var _this2 = this;
140
+
141
+ this.setState(function (prevState) {
142
+ return {
143
+ isPViewListOpen: !prevState.isPViewListOpen
144
+ };
145
+ }, function () {
146
+ _this2.focusSelectedImg(_this2.state.selectedIndex);
147
+ });
148
+ }
149
+ }, {
150
+ key: "zoomOut",
151
+ value: function zoomOut(ele) {
152
+ this.setState({
153
+ isZoomed: false
154
+ });
155
+ var img = document.getElementById("img".concat(ele));
156
+
157
+ if (img) {
158
+ img.classList.remove(_AttachmentViewerModule["default"].zoomedImg);
159
+ img.classList.add(_AttachmentViewerModule["default"].normalImg);
160
+ }
161
+ }
162
+ }, {
163
+ key: "zoomIn",
164
+ value: function zoomIn(event, ele) {
165
+ var moveToPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
166
+ this.setState({
167
+ isZoomed: true
168
+ });
169
+ var img = document.getElementById("img".concat(ele));
170
+ var ratio = 95;
171
+ var imgContainer, imgUnits, imgSize, imgRatio, imgContainerUnits, imgContainerPosition;
172
+
173
+ if (moveToPosition) {
174
+ imgContainer = document.getElementById("imgBox".concat(ele));
175
+ imgUnits = img.getBoundingClientRect();
176
+ imgSize = {
177
+ height: img.naturalHeight,
178
+ width: img.naturalWidth
179
+ };
180
+ imgRatio = {
181
+ height: Math.floor(imgSize.height / imgUnits.height / 100 * ratio),
182
+ width: Math.floor(imgSize.width / imgUnits.width / 100 * ratio)
183
+ };
184
+ imgContainerUnits = imgContainer.getBoundingClientRect();
185
+ imgContainerPosition = imgContainer ? {
186
+ top: imgContainerUnits.top,
187
+ left: imgContainerUnits.left
188
+ } : {
189
+ top: 0,
190
+ left: 0
191
+ };
192
+ }
193
+
194
+ if (img) {
195
+ img.classList.remove(_AttachmentViewerModule["default"].normalImg);
196
+ img.classList.add(_AttachmentViewerModule["default"].zoomedImg);
197
+ }
198
+
199
+ if (moveToPosition) {
200
+ imgContainer.scrollLeft = (event.pageX - imgContainerPosition.left - imgUnits.left) * imgRatio.width;
201
+ imgContainer.scrollTop = (event.pageY - imgContainerPosition.top - imgUnits.top) * imgRatio.height;
202
+ }
203
+ }
204
+ }, {
205
+ key: "zoomMaintain",
206
+ value: function zoomMaintain(selectedIndex) {
207
+ var isZoomed = this.state.isZoomed;
208
+ isZoomed ? this.zoomIn({}, selectedIndex) : this.zoomOut(selectedIndex);
209
+ }
210
+ }, {
211
+ key: "getUpdateDataList",
212
+ value: function getUpdateDataList(_ref) {
213
+ var index = _ref.index,
214
+ data = _ref.data,
215
+ dataList = _ref.dataList;
216
+ data = data || this.state.data;
217
+ dataList = dataList || this.state.dataList;
218
+
219
+ var finalDataList = _toConsumableArray(dataList);
220
+
221
+ if (index >= finalDataList.length) {
222
+ for (var i = dataList.length; i <= index; i++) {
223
+ finalDataList.push(data.slice(i)[0]);
224
+ }
225
+ } else if (index + 1 === finalDataList.length && index + 1 < data.length) {
226
+ finalDataList.push(data.slice(index + 1)[0]);
227
+ }
228
+
229
+ return finalDataList;
230
+ }
231
+ }, {
232
+ key: "updateDataList",
233
+ value: function updateDataList(index) {
234
+ this.setState({
235
+ dataList: this.getUpdateDataList({
236
+ index: index
237
+ })
238
+ });
239
+ }
240
+ }, {
241
+ key: "changeSelectedIndex",
242
+ value: function changeSelectedIndex(index) {
243
+ var _this3 = this;
244
+
245
+ var _this$state = this.state,
246
+ data = _this$state.data,
247
+ selectedIndex = _this$state.selectedIndex;
248
+ var maintainZoom = this.props.maintainZoom;
249
+ maintainZoom ? this.zoomMaintain(index) : this.zoomOut(selectedIndex);
250
+
251
+ if (index <= data.length - 1) {
252
+ this.updateDataList(index);
253
+ }
254
+
255
+ this.setState({
256
+ selectedIndex: index
257
+ }, function () {
258
+ _this3.focusSelectedImg(index);
259
+ });
260
+ }
261
+ }, {
262
+ key: "focusSelectedImg",
263
+ value: function focusSelectedImg(index) {
264
+ var ele = this["img_".concat(index)];
265
+
266
+ if (ele) {
267
+ var cont = this.imgListCont;
268
+ cont.scrollLeft = ele.offsetLeft;
269
+ }
270
+ }
271
+ }, {
272
+ key: "closeAttachmentViewer",
273
+ value: function closeAttachmentViewer() {
274
+ this.setState({
275
+ isPViewListOpen: false,
276
+ isZoomed: false
277
+ });
278
+ this.props.hideAttachmentViewer();
279
+ }
280
+ }, {
281
+ key: "responsiveFunc",
282
+ value: function responsiveFunc(_ref2) {
283
+ var mediaQueryOR = _ref2.mediaQueryOR;
284
+ return {
285
+ uptoTablet: mediaQueryOR([{
286
+ maxWidth: 768
287
+ }])
288
+ };
289
+ }
290
+ }, {
291
+ key: "imgPreviewView",
292
+ value: function imgPreviewView() {
293
+ var _this4 = this;
294
+
295
+ var _this$state2 = this.state,
296
+ dataList = _this$state2.dataList,
297
+ selectedIndex = _this$state2.selectedIndex,
298
+ isZoomed = _this$state2.isZoomed;
299
+ var maintainZoom = this.props.maintainZoom;
300
+
301
+ var getImgStyle = function getImgStyle(i) {
302
+ var position;
303
+
304
+ if (selectedIndex < i) {
305
+ position = (i - selectedIndex) * 100;
306
+ return {
307
+ transform: "translateX(".concat(parseInt(position), "%)"),
308
+ opacity: "0"
309
+ };
310
+ }
311
+
312
+ if (i === selectedIndex) {
313
+ return {
314
+ transform: "translateX(0%)",
315
+ opacity: "1"
316
+ };
317
+ }
318
+
319
+ position = (selectedIndex - i) * 100 * -1;
320
+ return {
321
+ transform: "translateX(".concat(parseInt(position), "%)"),
322
+ opacity: "0"
323
+ };
324
+ };
325
+
326
+ return dataList.length && dataList.map(function () {
327
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
328
+ var i = arguments.length > 1 ? arguments[1] : undefined;
329
+ var selectedImgUrl = data.viewUrl;
330
+ return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
331
+ className: _AttachmentViewerModule["default"].imgBox,
332
+ id: "imgBox".concat(i),
333
+ key: i,
334
+ alignBox: "row",
335
+ align: "both",
336
+ style: getImgStyle(i)
337
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
338
+ className: _AttachmentViewerModule["default"].imgRef,
339
+ id: "imgPreviewRef".concat(i)
340
+ }, (0, _Attachment.isAudioFile)(data.name) ? selectedIndex == i ? /*#__PURE__*/_react["default"].createElement("video", {
341
+ autoPlay: true,
342
+ controls: true,
343
+ className: _AttachmentViewerModule["default"].zoomIn
344
+ }, /*#__PURE__*/_react["default"].createElement("source", {
345
+ src: data.viewUrl,
346
+ type: "audio/".concat((0, _Attachment.getExtensionFromFileName)(data.name))
347
+ })) : null : /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], {
348
+ className: "".concat(_AttachmentViewerModule["default"].img, " ").concat(selectedIndex == i && maintainZoom ? isZoomed ? _AttachmentViewerModule["default"].zoomedImg : _AttachmentViewerModule["default"].normalImg : ""),
349
+ src: selectedImgUrl,
350
+ onClick: isZoomed ? _this4.zoomOut.bind(_this4, i) : function (e) {
351
+ _this4.zoomIn(e, i, true);
352
+ },
353
+ alt: "Preview",
354
+ dataId: "attachViewed",
355
+ id: "img".concat(i),
356
+ isImage: true,
357
+ isCover: false
358
+ })));
359
+ });
360
+ }
361
+ }, {
362
+ key: "render",
363
+ value: function render() {
364
+ var _this5 = this;
365
+
366
+ var _this$state3 = this.state,
367
+ isPViewListOpen = _this$state3.isPViewListOpen,
368
+ selectedIndex = _this$state3.selectedIndex,
369
+ data = _this$state3.data,
370
+ isZoomed = _this$state3.isZoomed;
371
+ var _this$props = this.props,
372
+ responsiveId = _this$props.responsiveId,
373
+ needDownload = _this$props.needDownload,
374
+ i18nKeys = _this$props.i18nKeys,
375
+ isActive = _this$props.isActive;
376
+ var totalLen = data.length;
377
+ var selectedAttachment = data[selectedIndex] || {};
378
+ var selectedImgUrl = selectedAttachment.viewUrl;
379
+ var downloadUrl = selectedAttachment.downloadUrl;
380
+ var authorHref;
381
+ var authorName;
382
+
383
+ var _ref3 = data[selectedIndex] ? data[selectedIndex] : {},
384
+ author = _ref3.author;
385
+
386
+ if (author) {
387
+ authorHref = author.href;
388
+ authorName = author.name;
389
+ }
390
+
391
+ var ariaId = this.getNextId();
392
+ return /*#__PURE__*/_react["default"].createElement(_FreezeLayer["default"], {
393
+ isActive: isActive && totalLen >= 1,
394
+ palette: "dark",
395
+ animationName: "expand"
396
+ }, /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
397
+ responsiveId: responsiveId,
398
+ query: this.responsiveFunc
399
+ }, function (_ref4) {
400
+ var uptoTablet = _ref4.uptoTablet;
401
+ return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
402
+ scroll: "none",
403
+ "data-scroll-palette": "dark"
404
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, null, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
405
+ alignBox: "row",
406
+ className: _AttachmentViewerModule["default"].header,
407
+ align: "between",
408
+ tabindex: "0"
409
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
410
+ shrink: true,
411
+ className: _AttachmentViewerModule["default"].title,
412
+ "data-title": selectedAttachment.name,
413
+ dataId: "attachName",
414
+ id: ariaId
415
+ }, selectedAttachment.name), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
416
+ flexible: true,
417
+ className: _AttachmentViewerModule["default"].count,
418
+ dataId: "attachCountContainer"
419
+ }, selectedIndex + 1, "/", totalLen), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
420
+ className: uptoTablet ? _AttachmentViewerModule["default"].mbleMenuBar : _AttachmentViewerModule["default"].menuBar
421
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
422
+ isInline: true,
423
+ alignBox: uptoTablet ? "column-reverse" : "row",
424
+ align: uptoTablet ? "bottom" : "center",
425
+ wrap: "wrap",
426
+ isCover: false
427
+ }, isZoomed ? /*#__PURE__*/_react["default"].createElement("div", {
428
+ className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
429
+ onClick: _this5.zoomOut.bind(_this5, selectedIndex),
430
+ "data-id": "zoomOut",
431
+ "data-title": i18nKeys.zoomOutText
432
+ }, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
433
+ iconName: "ZD-GN-zoomOut",
434
+ className: _AttachmentViewerModule["default"].menuIcon,
435
+ iconSize: "16",
436
+ hoverType: "border",
437
+ a11y: {
438
+ ariaLabel: i18nKeys.zoomOutText
439
+ }
440
+ })) : /*#__PURE__*/_react["default"].createElement("div", {
441
+ className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
442
+ onClick: function onClick(e) {
443
+ return _this5.zoomIn(e, selectedIndex);
444
+ },
445
+ "data-id": "zoomIn",
446
+ "data-title": i18nKeys.zoomInText
447
+ }, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
448
+ iconName: "ZD-GN-zoomIn",
449
+ className: _AttachmentViewerModule["default"].menuIcon,
450
+ iconSize: "16",
451
+ hoverType: "border",
452
+ a11y: {
453
+ ariaLabel: i18nKeys.zoomInText
454
+ }
455
+ })), /*#__PURE__*/_react["default"].createElement("div", {
456
+ className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu
457
+ }, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
458
+ href: selectedImgUrl,
459
+ target: "_blank",
460
+ dataId: "newTabAttach",
461
+ title: i18nKeys.newTabText
462
+ }, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
463
+ iconName: "ZD-GN-newLink",
464
+ className: _AttachmentViewerModule["default"].menuIcon,
465
+ iconSize: "16",
466
+ hoverType: "border",
467
+ needButtonTag: false,
468
+ a11y: {
469
+ ariaLabel: i18nKeys.newTabText
470
+ }
471
+ }))), needDownload ? /*#__PURE__*/_react["default"].createElement("div", {
472
+ className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu
473
+ }, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
474
+ href: downloadUrl,
475
+ target: "_parent",
476
+ hasReload: true,
477
+ download: true,
478
+ title: i18nKeys.downloadText
479
+ }, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
480
+ iconName: "ZD-GN-download",
481
+ className: _AttachmentViewerModule["default"].menuIcon,
482
+ iconSize: "16",
483
+ hoverType: "border",
484
+ needButtonTag: false,
485
+ a11y: {
486
+ ariaLabel: i18nKeys.downloadText
487
+ }
488
+ }))) : null, /*#__PURE__*/_react["default"].createElement("div", {
489
+ className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
490
+ onClick: _this5.closeAttachmentViewer,
491
+ "data-id": "closeAttach",
492
+ "data-title": i18nKeys.closeText
493
+ }, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
494
+ iconName: "ZD-cross",
495
+ iconSize: "15",
496
+ hoverType: "border",
497
+ className: _AttachmentViewerModule["default"].menuIcon,
498
+ a11y: {
499
+ ariaLabel: i18nKeys.closeText
500
+ },
501
+ title: i18nKeys.closeText
502
+ })))))), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
503
+ flexible: true,
504
+ role: "toolbar",
505
+ tabindex: "0"
506
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
507
+ alignBox: "row"
508
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
509
+ className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(selectedIndex === 0 ? _AttachmentViewerModule["default"].hidden : ""),
510
+ onClick: _this5.changeSelectedIndex.bind(_this5, selectedIndex - 1),
511
+ "data-title": i18nKeys.previousText,
512
+ "data-title-position": "left"
513
+ }, /*#__PURE__*/_react["default"].createElement("button", {
514
+ className: _AttachmentViewerModule["default"].btn,
515
+ "aria-label": i18nKeys.previousText
516
+ }, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
517
+ name: "ZD-arrowLeft3",
518
+ iconClass: _AttachmentViewerModule["default"].arrow,
519
+ dataId: "leftAttachNav",
520
+ isBold: true
521
+ }))), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
522
+ className: _AttachmentViewerModule["default"].previewBox,
523
+ role: "option",
524
+ tabindex: "0",
525
+ "aria-describedby": ariaId,
526
+ isShrink: false,
527
+ eleRef: _this5.setImgBoxRef,
528
+ scroll: "both",
529
+ flexible: true
530
+ }, _this5.imgPreviewView()), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
531
+ className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(totalLen === selectedIndex + 1 ? _AttachmentViewerModule["default"].hidden : ""),
532
+ onClick: _this5.changeSelectedIndex.bind(_this5, selectedIndex + 1),
533
+ "data-title": i18nKeys.nextText,
534
+ "data-title-position": "right"
535
+ }, /*#__PURE__*/_react["default"].createElement("button", {
536
+ className: _AttachmentViewerModule["default"].btn,
537
+ "aria-label": i18nKeys.nextText
538
+ }, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
539
+ name: "ZD-arrowRight3",
540
+ iconClass: _AttachmentViewerModule["default"].arrow,
541
+ dataId: "rightAttachNav",
542
+ isBold: true
543
+ }))))), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
544
+ className: "".concat(_AttachmentViewerModule["default"].footer, " ").concat(isPViewListOpen && totalLen !== 1 ? _AttachmentViewerModule["default"].footerHeight : _AttachmentViewerModule["default"].footerHide, " ")
545
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
546
+ align: "vertical",
547
+ alignBox: "row",
548
+ className: _AttachmentViewerModule["default"].footerHeight
549
+ }, author && /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
550
+ className: _AttachmentViewerModule["default"].author
551
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
552
+ alignBox: "row",
553
+ align: "both"
554
+ }, /*#__PURE__*/_react["default"].createElement(_Avatar["default"], {
555
+ name: authorName,
556
+ size: "xmedium",
557
+ src: authorHref,
558
+ palette: "info"
559
+ }), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
560
+ flexible: true,
561
+ className: _AttachmentViewerModule["default"].authorName,
562
+ "data-title": authorName
563
+ }, authorName))), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
564
+ flexible: true
565
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
566
+ align: "vertical",
567
+ alignBox: "row",
568
+ scroll: "horizontal",
569
+ eleRef: function eleRef(el) {
570
+ return _this5.imgListCont = el;
571
+ },
572
+ className: _AttachmentViewerModule["default"].listContainer
573
+ }, data.map(function (item, index) {
574
+ var name = item.name,
575
+ viewUrl = item.viewUrl;
576
+ var isAudio = (0, _Attachment.isAudioFile)(name);
577
+ return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
578
+ className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : "", " ").concat(isAudio ? _AttachmentViewerModule["default"].isAudio : ""),
579
+ key: index,
580
+ onClick: _this5.changeSelectedIndex.bind(_this5, index),
581
+ eleRef: function eleRef(el) {
582
+ return _this5["img_".concat(index)] = el;
583
+ },
584
+ dataId: "attachPreviewList",
585
+ "data-title": name
586
+ }, /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], {
587
+ src: viewUrl,
588
+ size: "small",
589
+ alt: name,
590
+ className: _AttachmentViewerModule["default"].image,
591
+ isImage: !isAudio
592
+ }));
593
+ }))))), totalLen !== 1 && /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
594
+ dataId: "attachToggle",
595
+ onClick: _this5.togglePViewList,
596
+ iconName: "ZD-GN-hideTab",
597
+ iconSize: "14",
598
+ hoverType: "border",
599
+ iconClass: "".concat(_AttachmentViewerModule["default"].thumpIcon, " ").concat(isPViewListOpen ? _AttachmentViewerModule["default"].thumpIconActive : ""),
600
+ className: _AttachmentViewerModule["default"].button,
601
+ a11y: {
602
+ ariaLabel: i18nKeys.hideText
603
+ },
604
+ title: isPViewListOpen ? i18nKeys.hideText : i18nKeys.showText
605
+ }));
606
+ }));
607
+ }
608
+ }]);
609
+
610
+ return AttachmentViewer;
611
+ }(_react.Component);
612
+
613
+ exports["default"] = AttachmentViewer;
614
+ AttachmentViewer.propTypes = {
615
+ hideAttachmentViewer: _propTypes["default"].func,
616
+ i18nKeys: _propTypes["default"].shape({
617
+ nextText: _propTypes["default"].string,
618
+ previousText: _propTypes["default"].string,
619
+ zoomOutText: _propTypes["default"].string,
620
+ zoomInText: _propTypes["default"].string,
621
+ newTabText: _propTypes["default"].string,
622
+ downloadText: _propTypes["default"].string,
623
+ closeText: _propTypes["default"].string,
624
+ hideText: _propTypes["default"].string,
625
+ showText: _propTypes["default"].string
626
+ }),
627
+ needDownload: _propTypes["default"].string,
628
+ previewObj: _propTypes["default"].object,
629
+ responsiveId: _propTypes["default"].string,
630
+ maintainZoom: _propTypes["default"].bool,
631
+ isActive: _propTypes["default"].bool
632
+ };
633
+ AttachmentViewer.defaultProps = {
634
+ responsiveId: "Helmet",
635
+ needDownload: true,
636
+ i18nKeys: {},
637
+ maintainZoom: false,
638
+ isActive: false
639
+ };
640
+
641
+ if (false) {
642
+ AttachmentViewer.docs = {
643
+ componentGroup: "Molecule"
644
+ };
645
+ }