@blaze-cms/plugin-media-ui 0.146.0-rc-eagle.0 → 0.146.0-rc-eagle-3.0

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 (223) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/lib/components/CardMedia/CardMedia.js +96 -52
  3. package/lib/components/CardMedia/CardMedia.js.map +1 -1
  4. package/lib/components/EditMediaFile/EditMediaFile.js +24 -39
  5. package/lib/components/EditMediaFile/EditMediaFile.js.map +1 -1
  6. package/lib/components/EditMediaFile/EditMediaFilePage.js +16 -8
  7. package/lib/components/EditMediaFile/EditMediaFilePage.js.map +1 -1
  8. package/lib/components/FileList/useGetFiles/getFiles.js +6 -3
  9. package/lib/components/FileList/useGetFiles/getFiles.js.map +1 -1
  10. package/lib/components/FileList/useGetFiles/useGetFiles.js +7 -2
  11. package/lib/components/FileList/useGetFiles/useGetFiles.js.map +1 -1
  12. package/lib/components/FileList/useGetFilesList/useGetFilesList.js +4 -1
  13. package/lib/components/FileList/useGetFilesList/useGetFilesList.js.map +1 -1
  14. package/lib/components/FilePreview/Actions/index.js +2 -1
  15. package/lib/components/FilePreview/Actions/index.js.map +1 -1
  16. package/lib/components/FilePreview/Image/imageSchema.js +8 -4
  17. package/lib/components/FilePreview/Image/imageSchema.js.map +1 -1
  18. package/lib/components/FilePreview/PDF/schema.js +2 -1
  19. package/lib/components/FilePreview/PDF/schema.js.map +1 -1
  20. package/lib/components/FilePreview/index.js +47 -3
  21. package/lib/components/FilePreview/index.js.map +1 -1
  22. package/lib/components/FilePreview/previewDefault/previewDefaultSchema.js +2 -1
  23. package/lib/components/FilePreview/previewDefault/previewDefaultSchema.js.map +1 -1
  24. package/lib/components/FilePreviewReadOnly/FilePreviewReadOnly.js +2 -1
  25. package/lib/components/FilePreviewReadOnly/FilePreviewReadOnly.js.map +1 -1
  26. package/lib/components/FileUploadAdapter/FileList.js +2 -1
  27. package/lib/components/FileUploadAdapter/FileList.js.map +1 -1
  28. package/lib/components/FileUploadAdapter/FileUploadAdapter.js +35 -23
  29. package/lib/components/FileUploadAdapter/FileUploadAdapter.js.map +1 -1
  30. package/lib/components/FileUploadModal/FileUploadModal.js +82 -18
  31. package/lib/components/FileUploadModal/FileUploadModal.js.map +1 -1
  32. package/lib/components/FilterPanel/FilterPanel.js +43 -125
  33. package/lib/components/FilterPanel/FilterPanel.js.map +1 -1
  34. package/lib/components/FilterPanel/MediaSearchFilter.js +41 -0
  35. package/lib/components/FilterPanel/MediaSearchFilter.js.map +1 -0
  36. package/lib/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js +9 -5
  37. package/lib/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js.map +1 -1
  38. package/lib/components/ListingContainer/Listing/MediaListing/MediaListing.js +2 -1
  39. package/lib/components/ListingContainer/Listing/MediaListing/MediaListing.js.map +1 -1
  40. package/lib/components/ListingContainer/ListingContainer.js +6 -2
  41. package/lib/components/ListingContainer/ListingContainer.js.map +1 -1
  42. package/lib/components/MediaListing.js +2 -1
  43. package/lib/components/MediaListing.js.map +1 -1
  44. package/lib/constants.js +3 -2
  45. package/lib/constants.js.map +1 -1
  46. package/lib-es/components/CardMedia/CardMedia.js +276 -0
  47. package/lib-es/components/CardMedia/CardMedia.js.map +1 -0
  48. package/lib-es/components/CardMedia/index.js +3 -0
  49. package/lib-es/components/CardMedia/index.js.map +1 -0
  50. package/lib-es/components/EditMediaFile/EditMediaFile.js +171 -0
  51. package/lib-es/components/EditMediaFile/EditMediaFile.js.map +1 -0
  52. package/lib-es/components/EditMediaFile/EditMediaFilePage.js +116 -0
  53. package/lib-es/components/EditMediaFile/EditMediaFilePage.js.map +1 -0
  54. package/lib-es/components/EditMediaFile/index.js +3 -0
  55. package/lib-es/components/EditMediaFile/index.js.map +1 -0
  56. package/lib-es/components/EditorAdapter/EditorAdapter.js +59 -0
  57. package/lib-es/components/EditorAdapter/EditorAdapter.js.map +1 -0
  58. package/lib-es/components/EditorAdapter/index.js +3 -0
  59. package/lib-es/components/EditorAdapter/index.js.map +1 -0
  60. package/lib-es/components/FileList/FilesListContext/index.js +4 -0
  61. package/lib-es/components/FileList/FilesListContext/index.js.map +1 -0
  62. package/lib-es/components/FileList/FilesListProvider/index.js +36 -0
  63. package/lib-es/components/FileList/FilesListProvider/index.js.map +1 -0
  64. package/lib-es/components/FileList/useFileList/index.js +5 -0
  65. package/lib-es/components/FileList/useFileList/index.js.map +1 -0
  66. package/lib-es/components/FileList/useGetFiles/getFiles.js +182 -0
  67. package/lib-es/components/FileList/useGetFiles/getFiles.js.map +1 -0
  68. package/lib-es/components/FileList/useGetFiles/index.js +3 -0
  69. package/lib-es/components/FileList/useGetFiles/index.js.map +1 -0
  70. package/lib-es/components/FileList/useGetFiles/useGetFiles.js +119 -0
  71. package/lib-es/components/FileList/useGetFiles/useGetFiles.js.map +1 -0
  72. package/lib-es/components/FileList/useGetFilesList/getCounters.js +11 -0
  73. package/lib-es/components/FileList/useGetFilesList/getCounters.js.map +1 -0
  74. package/lib-es/components/FileList/useGetFilesList/index.js +3 -0
  75. package/lib-es/components/FileList/useGetFilesList/index.js.map +1 -0
  76. package/lib-es/components/FileList/useGetFilesList/useGetFilesList.js +175 -0
  77. package/lib-es/components/FileList/useGetFilesList/useGetFilesList.js.map +1 -0
  78. package/lib-es/components/FilePreview/Actions/index.js +38 -0
  79. package/lib-es/components/FilePreview/Actions/index.js.map +1 -0
  80. package/lib-es/components/FilePreview/Image/Image.js +40 -0
  81. package/lib-es/components/FilePreview/Image/Image.js.map +1 -0
  82. package/lib-es/components/FilePreview/Image/RawImage.js +31 -0
  83. package/lib-es/components/FilePreview/Image/RawImage.js.map +1 -0
  84. package/lib-es/components/FilePreview/Image/imageSchema.js +57 -0
  85. package/lib-es/components/FilePreview/Image/imageSchema.js.map +1 -0
  86. package/lib-es/components/FilePreview/Image/index.js +12 -0
  87. package/lib-es/components/FilePreview/Image/index.js.map +1 -0
  88. package/lib-es/components/FilePreview/ModalContext.js +3 -0
  89. package/lib-es/components/FilePreview/ModalContext.js.map +1 -0
  90. package/lib-es/components/FilePreview/PDF/PDF.js +49 -0
  91. package/lib-es/components/FilePreview/PDF/PDF.js.map +1 -0
  92. package/lib-es/components/FilePreview/PDF/RawPDF.js +33 -0
  93. package/lib-es/components/FilePreview/PDF/RawPDF.js.map +1 -0
  94. package/lib-es/components/FilePreview/PDF/index.js +12 -0
  95. package/lib-es/components/FilePreview/PDF/index.js.map +1 -0
  96. package/lib-es/components/FilePreview/PDF/schema.js +22 -0
  97. package/lib-es/components/FilePreview/PDF/schema.js.map +1 -0
  98. package/lib-es/components/FilePreview/get-preview.js +28 -0
  99. package/lib-es/components/FilePreview/get-preview.js.map +1 -0
  100. package/lib-es/components/FilePreview/index.js +148 -0
  101. package/lib-es/components/FilePreview/index.js.map +1 -0
  102. package/lib-es/components/FilePreview/previewDefault/PreviewDefault.js +41 -0
  103. package/lib-es/components/FilePreview/previewDefault/PreviewDefault.js.map +1 -0
  104. package/lib-es/components/FilePreview/previewDefault/RawPreviewDefault.js +39 -0
  105. package/lib-es/components/FilePreview/previewDefault/RawPreviewDefault.js.map +1 -0
  106. package/lib-es/components/FilePreview/previewDefault/icons/DefaultIcon.js +121 -0
  107. package/lib-es/components/FilePreview/previewDefault/icons/DefaultIcon.js.map +1 -0
  108. package/lib-es/components/FilePreview/previewDefault/icons/index.js +3 -0
  109. package/lib-es/components/FilePreview/previewDefault/icons/index.js.map +1 -0
  110. package/lib-es/components/FilePreview/previewDefault/index.js +12 -0
  111. package/lib-es/components/FilePreview/previewDefault/index.js.map +1 -0
  112. package/lib-es/components/FilePreview/previewDefault/previewDefaultSchema.js +26 -0
  113. package/lib-es/components/FilePreview/previewDefault/previewDefaultSchema.js.map +1 -0
  114. package/lib-es/components/FilePreviewReadOnly/FileList.js +18 -0
  115. package/lib-es/components/FilePreviewReadOnly/FileList.js.map +1 -0
  116. package/lib-es/components/FilePreviewReadOnly/FilePreviewList.js +22 -0
  117. package/lib-es/components/FilePreviewReadOnly/FilePreviewList.js.map +1 -0
  118. package/lib-es/components/FilePreviewReadOnly/FilePreviewReadOnly.js +68 -0
  119. package/lib-es/components/FilePreviewReadOnly/FilePreviewReadOnly.js.map +1 -0
  120. package/lib-es/components/FilePreviewReadOnly/index.js +3 -0
  121. package/lib-es/components/FilePreviewReadOnly/index.js.map +1 -0
  122. package/lib-es/components/FilePreviewReadOnly/mappers/format-initial-value.js +11 -0
  123. package/lib-es/components/FilePreviewReadOnly/mappers/format-initial-value.js.map +1 -0
  124. package/lib-es/components/FilePreviewReadOnly/mappers/index.js +3 -0
  125. package/lib-es/components/FilePreviewReadOnly/mappers/index.js.map +1 -0
  126. package/lib-es/components/FileUploadAdapter/FileList.js +52 -0
  127. package/lib-es/components/FileUploadAdapter/FileList.js.map +1 -0
  128. package/lib-es/components/FileUploadAdapter/FilePreviewList.js +22 -0
  129. package/lib-es/components/FileUploadAdapter/FilePreviewList.js.map +1 -0
  130. package/lib-es/components/FileUploadAdapter/FileReorderList.js +32 -0
  131. package/lib-es/components/FileUploadAdapter/FileReorderList.js.map +1 -0
  132. package/lib-es/components/FileUploadAdapter/FileReorderListItem.js +24 -0
  133. package/lib-es/components/FileUploadAdapter/FileReorderListItem.js.map +1 -0
  134. package/lib-es/components/FileUploadAdapter/FileUploadAdapter.js +402 -0
  135. package/lib-es/components/FileUploadAdapter/FileUploadAdapter.js.map +1 -0
  136. package/lib-es/components/FileUploadAdapter/index.js +3 -0
  137. package/lib-es/components/FileUploadAdapter/index.js.map +1 -0
  138. package/lib-es/components/FileUploadAdapter/mappers/format-initial-value.js +11 -0
  139. package/lib-es/components/FileUploadAdapter/mappers/format-initial-value.js.map +1 -0
  140. package/lib-es/components/FileUploadAdapter/mappers/get-button-text.js +11 -0
  141. package/lib-es/components/FileUploadAdapter/mappers/get-button-text.js.map +1 -0
  142. package/lib-es/components/FileUploadAdapter/mappers/get-format.js +12 -0
  143. package/lib-es/components/FileUploadAdapter/mappers/get-format.js.map +1 -0
  144. package/lib-es/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js +7 -0
  145. package/lib-es/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js.map +1 -0
  146. package/lib-es/components/FileUploadAdapter/mappers/index.js +8 -0
  147. package/lib-es/components/FileUploadAdapter/mappers/index.js.map +1 -0
  148. package/lib-es/components/FileUploadAdapter/mappers/is-unselecting.js +2 -0
  149. package/lib-es/components/FileUploadAdapter/mappers/is-unselecting.js.map +1 -0
  150. package/lib-es/components/FileUploadAdapter/mappers/transform-to-array.js +2 -0
  151. package/lib-es/components/FileUploadAdapter/mappers/transform-to-array.js.map +1 -0
  152. package/lib-es/components/FileUploadAdapter/useLimit.js +13 -0
  153. package/lib-es/components/FileUploadAdapter/useLimit.js.map +1 -0
  154. package/lib-es/components/FileUploadModal/FileUploadModal.js +241 -0
  155. package/lib-es/components/FileUploadModal/FileUploadModal.js.map +1 -0
  156. package/lib-es/components/FileUploadModal/index.js +3 -0
  157. package/lib-es/components/FileUploadModal/index.js.map +1 -0
  158. package/lib-es/components/FilterPanel/FilterPanel.js +55 -0
  159. package/lib-es/components/FilterPanel/FilterPanel.js.map +1 -0
  160. package/lib-es/components/FilterPanel/MediaSearchFilter.js +34 -0
  161. package/lib-es/components/FilterPanel/MediaSearchFilter.js.map +1 -0
  162. package/lib-es/components/FilterPanel/index.js +3 -0
  163. package/lib-es/components/FilterPanel/index.js.map +1 -0
  164. package/lib-es/components/ListingContainer/Listing/Listing.js +70 -0
  165. package/lib-es/components/ListingContainer/Listing/Listing.js.map +1 -0
  166. package/lib-es/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js +156 -0
  167. package/lib-es/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js.map +1 -0
  168. package/lib-es/components/ListingContainer/Listing/MediaListing/MediaFileList/index.js +3 -0
  169. package/lib-es/components/ListingContainer/Listing/MediaListing/MediaFileList/index.js.map +1 -0
  170. package/lib-es/components/ListingContainer/Listing/MediaListing/MediaListing.js +33 -0
  171. package/lib-es/components/ListingContainer/Listing/MediaListing/MediaListing.js.map +1 -0
  172. package/lib-es/components/ListingContainer/Listing/MediaListing/index.js +3 -0
  173. package/lib-es/components/ListingContainer/Listing/MediaListing/index.js.map +1 -0
  174. package/lib-es/components/ListingContainer/Listing/index.js +3 -0
  175. package/lib-es/components/ListingContainer/Listing/index.js.map +1 -0
  176. package/lib-es/components/ListingContainer/ListingContainer.js +118 -0
  177. package/lib-es/components/ListingContainer/ListingContainer.js.map +1 -0
  178. package/lib-es/components/ListingContainer/index.js +3 -0
  179. package/lib-es/components/ListingContainer/index.js.map +1 -0
  180. package/lib-es/components/ListingContainer/mappers/exist-previous.js +3 -0
  181. package/lib-es/components/ListingContainer/mappers/exist-previous.js.map +1 -0
  182. package/lib-es/components/ListingContainer/mappers/index.js +3 -0
  183. package/lib-es/components/ListingContainer/mappers/index.js.map +1 -0
  184. package/lib-es/components/MediaListing.js +29 -0
  185. package/lib-es/components/MediaListing.js.map +1 -0
  186. package/lib-es/constants.js +37 -0
  187. package/lib-es/constants.js.map +1 -0
  188. package/lib-es/icons/MediaLibraryIcon.js +70 -0
  189. package/lib-es/icons/MediaLibraryIcon.js.map +1 -0
  190. package/lib-es/icons/index.js +3 -0
  191. package/lib-es/icons/index.js.map +1 -0
  192. package/lib-es/index.js +77 -0
  193. package/lib-es/index.js.map +1 -0
  194. package/lib-es/utils/available-filters/available-filters.js +26 -0
  195. package/lib-es/utils/available-filters/available-filters.js.map +1 -0
  196. package/lib-es/utils/bustUrl.js +7 -0
  197. package/lib-es/utils/bustUrl.js.map +1 -0
  198. package/lib-es/utils/media-context/index.js +4 -0
  199. package/lib-es/utils/media-context/index.js.map +1 -0
  200. package/lib-es/utils/media-context/media-context.js +6 -0
  201. package/lib-es/utils/media-context/media-context.js.map +1 -0
  202. package/lib-es/utils/media-context/useMediaContext.js +4 -0
  203. package/lib-es/utils/media-context/useMediaContext.js.map +1 -0
  204. package/package.json +16 -9
  205. package/src/components/CardMedia/CardMedia.js +119 -89
  206. package/src/components/EditMediaFile/EditMediaFile.js +20 -21
  207. package/src/components/EditMediaFile/EditMediaFilePage.js +12 -7
  208. package/src/components/FileList/useGetFiles/getFiles.js +12 -4
  209. package/src/components/FileList/useGetFiles/useGetFiles.js +3 -4
  210. package/src/components/FileList/useGetFilesList/useGetFilesList.js +2 -1
  211. package/src/components/FilePreview/Image/imageSchema.js +8 -4
  212. package/src/components/FilePreview/PDF/schema.js +2 -1
  213. package/src/components/FilePreview/index.js +36 -2
  214. package/src/components/FilePreview/previewDefault/previewDefaultSchema.js +2 -1
  215. package/src/components/FileUploadAdapter/FileUploadAdapter.js +24 -14
  216. package/src/components/FileUploadModal/FileUploadModal.js +71 -6
  217. package/src/components/FilterPanel/FilterPanel.js +44 -129
  218. package/src/components/FilterPanel/MediaSearchFilter.js +32 -0
  219. package/src/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js +7 -2
  220. package/src/components/ListingContainer/ListingContainer.js +4 -1
  221. package/src/constants.js +16 -2
  222. package/babel.config.js +0 -3
  223. package/jest.config.js +0 -5
@@ -0,0 +1,156 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ import React, { useState, useEffect } from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import { CardPrompt } from '@blaze-cms/admin';
7
+ import Button from '@blaze-react/button';
8
+ import VirtualList from 'react-tiny-virtual-list';
9
+ import { useMediaContext, MediaContext } from '../../../../../utils/media-context';
10
+ import CardMedia from '../../../../CardMedia';
11
+ import { existPrevious } from '../../../mappers';
12
+ import useFileList from '../../../../FileList/useFileList';
13
+ import { MEDIA_LIST_ITEM_SIZE, MEDIA_OVER_SCAN_COUNT, AVAILABLE_FILTER_TYPES } from '../../../../../constants';
14
+ const MediaFileList = ({
15
+ displayCardPrompt,
16
+ setDisplayCardPrompt,
17
+ displayLayout,
18
+ wrapperRef,
19
+ modalTargetRef,
20
+ openEditInModal
21
+ }) => {
22
+ const [currentListIndex, setCurrentListIndex] = useState(1);
23
+ const [verifiedRanges, setVerifiedRanges] = useState([]);
24
+ const [listHeight, setListHeight] = useState(null);
25
+ const {
26
+ queryParams,
27
+ data,
28
+ loading,
29
+ setQueryParams,
30
+ clearList,
31
+ removeFile,
32
+ updateFile
33
+ } = useFileList();
34
+ const {
35
+ onClickPrompt,
36
+ getSelectedFiles,
37
+ selectedFiles,
38
+ selectedFilter
39
+ } = useMediaContext(MediaContext);
40
+ const hasFiles = !!data.files && !!data.files.length;
41
+ useEffect(() => {
42
+ if (!loading && !hasFiles) setDisplayCardPrompt(true);
43
+ if (!loading) setDisplayCardPrompt(false);
44
+ if (hasFiles) setDisplayCardPrompt(false);
45
+ }, [loading, hasFiles, setDisplayCardPrompt]);
46
+ useEffect(() => {
47
+ setVerifiedRanges([]);
48
+ setCurrentListIndex(0);
49
+ setQueryParams(_objectSpread(_objectSpread({}, selectedFilter), {}, {
50
+ where: _objectSpread(_objectSpread({}, AVAILABLE_FILTER_TYPES[selectedFilter.filter]), {}, {
51
+ storeKey: selectedFilter.storeKey
52
+ }),
53
+ isSearch: selectedFilter.isSearch,
54
+ searchTerm: selectedFilter.searchTerm
55
+ }));
56
+ },
57
+ // eslint-disable-next-line react-hooks/exhaustive-deps
58
+ [selectedFilter.filter, selectedFilter.storeKey, selectedFilter.isSearch, selectedFilter.searchTerm, selectedFilter.esFilters]);
59
+ const handleRenderedItems = ({
60
+ startIndex
61
+ }) => {
62
+ const rowsLength = data.files.length;
63
+ const loadIndex = Math.floor(rowsLength / 3) - MEDIA_OVER_SCAN_COUNT;
64
+ if (loadIndex > 0 && loadIndex < startIndex && !verifiedRanges.includes(loadIndex)) {
65
+ setQueryParams({
66
+ offset: data.files.length,
67
+ where: _objectSpread(_objectSpread({}, AVAILABLE_FILTER_TYPES[selectedFilter.filter]), {}, {
68
+ storeKey: selectedFilter.storeKey
69
+ }),
70
+ isSearch: selectedFilter.isSearch,
71
+ searchTerm: selectedFilter.searchTerm,
72
+ esFilters: selectedFilter.esFilters
73
+ });
74
+ setVerifiedRanges([...verifiedRanges, loadIndex]);
75
+ setCurrentListIndex(startIndex + MEDIA_OVER_SCAN_COUNT);
76
+ }
77
+ };
78
+ useEffect(() => {
79
+ const handleListHeight = () => {
80
+ setListHeight(wrapperRef.current.clientHeight - 40);
81
+ };
82
+ if (wrapperRef.current) {
83
+ handleListHeight();
84
+ window.addEventListener('resize', handleListHeight);
85
+ }
86
+ return () => {
87
+ window.removeEventListener('resize', handleListHeight);
88
+ };
89
+ }, [listHeight, wrapperRef]);
90
+ const searchedTerm = queryParams.searchTerm && `${queryParams.searchTerm} -`;
91
+ return /*#__PURE__*/React.createElement(React.Fragment, null, hasFiles && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", {
92
+ className: "media__fileList-counter"
93
+ }, searchedTerm, " ", data[selectedFilter.filter], " items"), /*#__PURE__*/React.createElement(VirtualList, {
94
+ width: "100%",
95
+ height: listHeight,
96
+ itemCount: data.files.length,
97
+ itemSize: MEDIA_LIST_ITEM_SIZE,
98
+ overscanCount: MEDIA_OVER_SCAN_COUNT,
99
+ scrollToIndex: currentListIndex,
100
+ onItemsRendered: handleRenderedItems,
101
+ renderItem: ({
102
+ index,
103
+ style
104
+ }) => {
105
+ const {
106
+ name,
107
+ url,
108
+ mimetype,
109
+ id,
110
+ data: fileData,
111
+ updated
112
+ } = data.files[index];
113
+ const isSelected = existPrevious(selectedFiles, id);
114
+ return /*#__PURE__*/React.createElement("div", {
115
+ key: index,
116
+ style: style,
117
+ className: "list__item--resultWrapper"
118
+ }, /*#__PURE__*/React.createElement(CardMedia, {
119
+ updateFile: updateFile,
120
+ clearList: clearList,
121
+ latestQueryToRefetchParams: queryParams,
122
+ modalTargetRef: modalTargetRef,
123
+ onSelected: getSelectedFiles,
124
+ key: id,
125
+ displayLayout: displayLayout,
126
+ selected: !!isSelected,
127
+ name: name,
128
+ url: url,
129
+ mimetype: mimetype,
130
+ id: id,
131
+ index: index,
132
+ removeFile: removeFile,
133
+ openEditInModal: openEditInModal,
134
+ data: fileData,
135
+ updated: updated
136
+ }));
137
+ }
138
+ })), displayCardPrompt && /*#__PURE__*/React.createElement(CardPrompt, null, /*#__PURE__*/React.createElement(Button, {
139
+ onClick: onClickPrompt,
140
+ className: "button button--rounded button--cta"
141
+ }, "Upload")));
142
+ };
143
+ MediaFileList.propTypes = {
144
+ setDisplayCardPrompt: PropTypes.func.isRequired,
145
+ displayCardPrompt: PropTypes.bool,
146
+ displayLayout: PropTypes.string.isRequired,
147
+ wrapperRef: PropTypes.object.isRequired,
148
+ modalTargetRef: PropTypes.object.isRequired,
149
+ openEditInModal: PropTypes.bool
150
+ };
151
+ MediaFileList.defaultProps = {
152
+ displayCardPrompt: true,
153
+ openEditInModal: false
154
+ };
155
+ export default MediaFileList;
156
+ //# sourceMappingURL=MediaFileList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaFileList.js","names":["React","useState","useEffect","PropTypes","CardPrompt","Button","VirtualList","useMediaContext","MediaContext","CardMedia","existPrevious","useFileList","MEDIA_LIST_ITEM_SIZE","MEDIA_OVER_SCAN_COUNT","AVAILABLE_FILTER_TYPES","MediaFileList","displayCardPrompt","setDisplayCardPrompt","displayLayout","wrapperRef","modalTargetRef","openEditInModal","currentListIndex","setCurrentListIndex","verifiedRanges","setVerifiedRanges","listHeight","setListHeight","queryParams","data","loading","setQueryParams","clearList","removeFile","updateFile","onClickPrompt","getSelectedFiles","selectedFiles","selectedFilter","hasFiles","files","length","_objectSpread","where","filter","storeKey","isSearch","searchTerm","esFilters","handleRenderedItems","startIndex","rowsLength","loadIndex","Math","floor","includes","offset","handleListHeight","current","clientHeight","window","addEventListener","removeEventListener","searchedTerm","createElement","Fragment","className","width","height","itemCount","itemSize","overscanCount","scrollToIndex","onItemsRendered","renderItem","index","style","name","url","mimetype","id","fileData","updated","isSelected","key","latestQueryToRefetchParams","onSelected","selected","onClick","propTypes","func","isRequired","bool","string","object","defaultProps"],"sources":["../../../../../../src/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { CardPrompt } from '@blaze-cms/admin';\nimport Button from '@blaze-react/button';\nimport VirtualList from 'react-tiny-virtual-list';\nimport { useMediaContext, MediaContext } from '../../../../../utils/media-context';\nimport CardMedia from '../../../../CardMedia';\nimport { existPrevious } from '../../../mappers';\nimport useFileList from '../../../../FileList/useFileList';\nimport {\n MEDIA_LIST_ITEM_SIZE,\n MEDIA_OVER_SCAN_COUNT,\n AVAILABLE_FILTER_TYPES\n} from '../../../../../constants';\n\nconst MediaFileList = ({\n displayCardPrompt,\n setDisplayCardPrompt,\n displayLayout,\n wrapperRef,\n modalTargetRef,\n openEditInModal\n}) => {\n const [currentListIndex, setCurrentListIndex] = useState(1);\n const [verifiedRanges, setVerifiedRanges] = useState([]);\n const [listHeight, setListHeight] = useState(null);\n const { queryParams, data, loading, setQueryParams, clearList, removeFile, updateFile } =\n useFileList();\n\n const { onClickPrompt, getSelectedFiles, selectedFiles, selectedFilter } =\n useMediaContext(MediaContext);\n\n const hasFiles = !!data.files && !!data.files.length;\n\n useEffect(() => {\n if (!loading && !hasFiles) setDisplayCardPrompt(true);\n if (!loading) setDisplayCardPrompt(false);\n if (hasFiles) setDisplayCardPrompt(false);\n }, [loading, hasFiles, setDisplayCardPrompt]);\n\n useEffect(\n () => {\n setVerifiedRanges([]);\n setCurrentListIndex(0);\n setQueryParams({\n ...selectedFilter,\n where: {\n ...AVAILABLE_FILTER_TYPES[selectedFilter.filter],\n storeKey: selectedFilter.storeKey\n },\n isSearch: selectedFilter.isSearch,\n searchTerm: selectedFilter.searchTerm\n });\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n selectedFilter.filter,\n selectedFilter.storeKey,\n selectedFilter.isSearch,\n selectedFilter.searchTerm,\n selectedFilter.esFilters\n ]\n );\n\n const handleRenderedItems = ({ startIndex }) => {\n const rowsLength = data.files.length;\n const loadIndex = Math.floor(rowsLength / 3) - MEDIA_OVER_SCAN_COUNT;\n\n if (loadIndex > 0 && loadIndex < startIndex && !verifiedRanges.includes(loadIndex)) {\n setQueryParams({\n offset: data.files.length,\n where: {\n ...AVAILABLE_FILTER_TYPES[selectedFilter.filter],\n storeKey: selectedFilter.storeKey\n },\n isSearch: selectedFilter.isSearch,\n searchTerm: selectedFilter.searchTerm,\n esFilters: selectedFilter.esFilters\n });\n setVerifiedRanges([...verifiedRanges, loadIndex]);\n setCurrentListIndex(startIndex + MEDIA_OVER_SCAN_COUNT);\n }\n };\n\n useEffect(() => {\n const handleListHeight = () => {\n setListHeight(wrapperRef.current.clientHeight - 40);\n };\n\n if (wrapperRef.current) {\n handleListHeight();\n window.addEventListener('resize', handleListHeight);\n }\n return () => {\n window.removeEventListener('resize', handleListHeight);\n };\n }, [listHeight, wrapperRef]);\n\n const searchedTerm = queryParams.searchTerm && `${queryParams.searchTerm} -`;\n\n return (\n <>\n {hasFiles && (\n <>\n <p className=\"media__fileList-counter\">\n {searchedTerm} {data[selectedFilter.filter]} items\n </p>\n <VirtualList\n width=\"100%\"\n height={listHeight}\n itemCount={data.files.length}\n itemSize={MEDIA_LIST_ITEM_SIZE}\n overscanCount={MEDIA_OVER_SCAN_COUNT}\n scrollToIndex={currentListIndex}\n onItemsRendered={handleRenderedItems}\n renderItem={({ index, style }) => {\n const { name, url, mimetype, id, data: fileData, updated } = data.files[index];\n const isSelected = existPrevious(selectedFiles, id);\n return (\n <div key={index} style={style} className=\"list__item--resultWrapper\">\n <CardMedia\n updateFile={updateFile}\n clearList={clearList}\n latestQueryToRefetchParams={queryParams}\n modalTargetRef={modalTargetRef}\n onSelected={getSelectedFiles}\n key={id}\n displayLayout={displayLayout}\n selected={!!isSelected}\n name={name}\n url={url}\n mimetype={mimetype}\n id={id}\n index={index}\n removeFile={removeFile}\n openEditInModal={openEditInModal}\n data={fileData}\n updated={updated}\n />\n </div>\n );\n }}\n />\n </>\n )}\n {displayCardPrompt && (\n <CardPrompt>\n <Button onClick={onClickPrompt} className=\"button button--rounded button--cta\">\n Upload\n </Button>\n </CardPrompt>\n )}\n </>\n );\n};\n\nMediaFileList.propTypes = {\n setDisplayCardPrompt: PropTypes.func.isRequired,\n displayCardPrompt: PropTypes.bool,\n displayLayout: PropTypes.string.isRequired,\n wrapperRef: PropTypes.object.isRequired,\n modalTargetRef: PropTypes.object.isRequired,\n openEditInModal: PropTypes.bool\n};\n\nMediaFileList.defaultProps = {\n displayCardPrompt: true,\n openEditInModal: false\n};\n\nexport default MediaFileList;\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAClD,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,OAAOC,MAAM,MAAM,qBAAqB;AACxC,OAAOC,WAAW,MAAM,yBAAyB;AACjD,SAASC,eAAe,EAAEC,YAAY,QAAQ,oCAAoC;AAClF,OAAOC,SAAS,MAAM,uBAAuB;AAC7C,SAASC,aAAa,QAAQ,kBAAkB;AAChD,OAAOC,WAAW,MAAM,kCAAkC;AAC1D,SACEC,oBAAoB,EACpBC,qBAAqB,EACrBC,sBAAsB,QACjB,0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AElB,SAAS,CAACyF;AAC7B,CAAC;AAED7E,aAAa,CAACgF,YAAY,GAAG;EAC3B/E,iBAAiB,EAAE,IAAI;EACvBK,eAAe,EAAE;AACnB,CAAC;AAED,eAAeN,aAAa","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import MediaFileList from './MediaFileList';
2
+ export default MediaFileList;
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["MediaFileList"],"sources":["../../../../../../src/components/ListingContainer/Listing/MediaListing/MediaFileList/index.js"],"sourcesContent":["import MediaFileList from './MediaFileList';\n\nexport default MediaFileList;\n"],"mappings":"AAAA,OAAOA,aAAa,MAAM,iBAAiB;AAE3C,eAAeA,aAAa","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ import PropTypes from 'prop-types';
2
+ import React, { useState, useRef } from 'react';
3
+ import MediaFileList from './MediaFileList';
4
+ const MediaListing = ({
5
+ openEditInModal
6
+ }) => {
7
+ const [displayCardPrompt, setDisplayCardPrompt] = useState(false);
8
+ const mediaFileListWrapperRef = useRef();
9
+ const modalTargetRef = useRef();
10
+ return /*#__PURE__*/React.createElement("div", {
11
+ className: "listing listing--media"
12
+ }, /*#__PURE__*/React.createElement("div", {
13
+ className: "media",
14
+ ref: mediaFileListWrapperRef
15
+ }, /*#__PURE__*/React.createElement(MediaFileList, {
16
+ modalTargetRef: modalTargetRef,
17
+ wrapperRef: mediaFileListWrapperRef,
18
+ displayCardPrompt: displayCardPrompt,
19
+ setDisplayCardPrompt: setDisplayCardPrompt,
20
+ displayLayout: "list",
21
+ openEditInModal: openEditInModal
22
+ })), /*#__PURE__*/React.createElement("div", {
23
+ ref: modalTargetRef
24
+ }));
25
+ };
26
+ MediaListing.propTypes = {
27
+ openEditInModal: PropTypes.bool
28
+ };
29
+ MediaListing.defaultProps = {
30
+ openEditInModal: false
31
+ };
32
+ export default MediaListing;
33
+ //# sourceMappingURL=MediaListing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaListing.js","names":["PropTypes","React","useState","useRef","MediaFileList","MediaListing","openEditInModal","displayCardPrompt","setDisplayCardPrompt","mediaFileListWrapperRef","modalTargetRef","createElement","className","ref","wrapperRef","displayLayout","propTypes","bool","defaultProps"],"sources":["../../../../../src/components/ListingContainer/Listing/MediaListing/MediaListing.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useState, useRef } from 'react';\nimport MediaFileList from './MediaFileList';\n\nconst MediaListing = ({ openEditInModal }) => {\n const [displayCardPrompt, setDisplayCardPrompt] = useState(false);\n const mediaFileListWrapperRef = useRef();\n const modalTargetRef = useRef();\n\n return (\n <div className=\"listing listing--media\">\n <div className=\"media\" ref={mediaFileListWrapperRef}>\n <MediaFileList\n modalTargetRef={modalTargetRef}\n wrapperRef={mediaFileListWrapperRef}\n displayCardPrompt={displayCardPrompt}\n setDisplayCardPrompt={setDisplayCardPrompt}\n displayLayout=\"list\"\n openEditInModal={openEditInModal}\n />\n </div>\n {/* render edit card modal outside of the virtual list */}\n <div ref={modalTargetRef} />\n </div>\n );\n};\n\nMediaListing.propTypes = {\n openEditInModal: PropTypes.bool\n};\n\nMediaListing.defaultProps = {\n openEditInModal: false\n};\n\nexport default MediaListing;\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,IAAIC,QAAQ,EAAEC,MAAM,QAAQ,OAAO;AAC/C,OAAOC,aAAa,MAAM,iBAAiB;AAE3C,MAAMC,YAAY,GAAGA,CAAC;EAAEC;AAAgB,CAAC,KAAK;EAC5C,MAAM,CAACC,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGN,QAAQ,CAAC,KAAK,CAAC;EACjE,MAAMO,uBAAuB,GAAGN,MAAM,CAAC,CAAC;EACxC,MAAMO,cAAc,GAAGP,MAAM,CAAC,CAAC;EAE/B,oBACEF,KAAA,CAAAU,aAAA;IAAKC,SAAS,EAAC;EAAwB,gBACrCX,KAAA,CAAAU,aAAA;IAAKC,SAAS,EAAC,OAAO;IAACC,GAAG,EAAEJ;EAAwB,gBAClDR,KAAA,CAAAU,aAAA,CAACP,aAAa;IACZM,cAAc,EAAEA,cAAe;IAC/BI,UAAU,EAAEL,uBAAwB;IACpCF,iBAAiB,EAAEA,iBAAkB;IACrCC,oBAAoB,EAAEA,oBAAqB;IAC3CO,aAAa,EAAC,MAAM;IACpBT,eAAe,EAAEA;EAAgB,CAClC,CACE,CAAC,eAENL,KAAA,CAAAU,aAAA;IAAKE,GAAG,EAAEH;EAAe,CAAE,CACxB,CAAC;AAEV,CAAC;AAEDL,YAAY,CAACW,SAAS,GAAG;EACvBV,eAAe,EAAEN,SAAS,CAACiB;AAC7B,CAAC;AAEDZ,YAAY,CAACa,YAAY,GAAG;EAC1BZ,eAAe,EAAE;AACnB,CAAC;AAED,eAAeD,YAAY","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import MediaListing from './MediaListing';
2
+ export default MediaListing;
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["MediaListing"],"sources":["../../../../../src/components/ListingContainer/Listing/MediaListing/index.js"],"sourcesContent":["import MediaListing from './MediaListing';\n\nexport default MediaListing;\n"],"mappings":"AAAA,OAAOA,YAAY,MAAM,gBAAgB;AAEzC,eAAeA,YAAY","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import Listing from './Listing';
2
+ export default Listing;
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["Listing"],"sources":["../../../../src/components/ListingContainer/Listing/index.js"],"sourcesContent":["import Listing from './Listing';\n\nexport default Listing;\n"],"mappings":"AAAA,OAAOA,OAAO,MAAM,WAAW;AAE/B,eAAeA,OAAO","ignoreList":[]}
@@ -0,0 +1,118 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ import React, { useState } from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import { useQuery } from '@apollo/client';
7
+ import { getQuery } from '@blaze-cms/admin-ui-utils';
8
+ import { ToastProvider } from '@blaze-react/toaster';
9
+ import Listing from './Listing';
10
+ import { availableFilters } from '../../utils/available-filters/available-filters';
11
+ import { MediaContextProvider } from '../../utils/media-context';
12
+ import FilesListProvider from '../FileList/FilesListProvider';
13
+ import { existPrevious } from './mappers';
14
+ const ListingContainer = ({
15
+ handleSelectedFiles,
16
+ maxItems,
17
+ filesSelected,
18
+ displayFileUploadModal,
19
+ setDisplayFileUploadModal,
20
+ closeModalAndSetValue,
21
+ simpleLayout,
22
+ openEditInModal,
23
+ storeKey
24
+ }) => {
25
+ const [selectedFiles, setSelectedFiles] = useState(filesSelected || []);
26
+ const [selectedFilter, setSelectedFilter] = useState({
27
+ filter: 'all',
28
+ isSearch: false,
29
+ searchTerm: null,
30
+ storeKey
31
+ });
32
+ const fileStoresType = getQuery('GET_FILE_STORES');
33
+ const {
34
+ loading,
35
+ data: {
36
+ getFileStores: fileStores = []
37
+ } = {}
38
+ } = useQuery(fileStoresType, {
39
+ variables: {
40
+ visibleInAdmin: true
41
+ }
42
+ });
43
+ if (loading) return null;
44
+ const getSelectedFiles = (file, files) => {
45
+ if (simpleLayout) {
46
+ handleSelectedFiles(files, false);
47
+ setSelectedFiles(files);
48
+ return;
49
+ }
50
+ const {
51
+ id
52
+ } = file;
53
+ const existPreviousFile = existPrevious(selectedFiles, id);
54
+ if (maxItems === selectedFiles.length && !existPreviousFile) {
55
+ handleSelectedFiles([id], false);
56
+ setSelectedFiles([id]);
57
+ } else {
58
+ const allSelectedFiles = existPreviousFile ? selectedFiles.filter(fileId => fileId !== existPreviousFile) : [...selectedFiles, id];
59
+ handleSelectedFiles(allSelectedFiles, false);
60
+ setSelectedFiles(allSelectedFiles);
61
+ }
62
+ };
63
+ const handleDisplayFileUploadModal = param => setDisplayFileUploadModal(param);
64
+ const defaultFileStore = (fileStores.find(({
65
+ isDefault
66
+ }) => isDefault) || {}).key;
67
+ return /*#__PURE__*/React.createElement(ToastProvider, null, /*#__PURE__*/React.createElement(MediaContextProvider, {
68
+ value: {
69
+ fileStores,
70
+ defaultFileStore,
71
+ changeSelectedFilter: value => setSelectedFilter(value),
72
+ selectedFilter: _objectSpread(_objectSpread({}, selectedFilter), {}, {
73
+ storeKey: selectedFilter.storeKey || defaultFileStore,
74
+ defaultFilters: {
75
+ storeKey: selectedFilter.storeKey || defaultFileStore
76
+ }
77
+ }),
78
+ selectedFiles,
79
+ getSelectedFiles,
80
+ filters: availableFilters,
81
+ onClickPrompt: () => handleDisplayFileUploadModal(true)
82
+ }
83
+ }, /*#__PURE__*/React.createElement(FilesListProvider, null, /*#__PURE__*/React.createElement(Listing, {
84
+ closeModalAndSetValue: closeModalAndSetValue,
85
+ simpleLayout: simpleLayout,
86
+ getSelectedFiles: getSelectedFiles,
87
+ setDisplayFileUploadModal: setDisplayFileUploadModal,
88
+ displayFileUploadModal: displayFileUploadModal,
89
+ handleDisplayFileUploadModal: handleDisplayFileUploadModal,
90
+ setSelectedFiles: setSelectedFiles,
91
+ handleSelectedFiles: handleSelectedFiles,
92
+ openEditInModal: openEditInModal,
93
+ selectedStoreKey: selectedFilter.storeKey || defaultFileStore,
94
+ storeKey: storeKey
95
+ }))));
96
+ };
97
+ ListingContainer.propTypes = {
98
+ handleSelectedFiles: PropTypes.func,
99
+ maxItems: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),
100
+ filesSelected: PropTypes.arrayOf(PropTypes.string),
101
+ simpleLayout: PropTypes.bool,
102
+ setDisplayFileUploadModal: PropTypes.func.isRequired,
103
+ displayFileUploadModal: PropTypes.bool.isRequired,
104
+ closeModalAndSetValue: PropTypes.func,
105
+ openEditInModal: PropTypes.bool,
106
+ storeKey: PropTypes.string
107
+ };
108
+ ListingContainer.defaultProps = {
109
+ closeModalAndSetValue: () => {},
110
+ handleSelectedFiles: () => {},
111
+ maxItems: false,
112
+ filesSelected: [],
113
+ simpleLayout: false,
114
+ openEditInModal: false,
115
+ storeKey: 'default'
116
+ };
117
+ export default ListingContainer;
118
+ //# sourceMappingURL=ListingContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListingContainer.js","names":["React","useState","PropTypes","useQuery","getQuery","ToastProvider","Listing","availableFilters","MediaContextProvider","FilesListProvider","existPrevious","ListingContainer","handleSelectedFiles","maxItems","filesSelected","displayFileUploadModal","setDisplayFileUploadModal","closeModalAndSetValue","simpleLayout","openEditInModal","storeKey","selectedFiles","setSelectedFiles","selectedFilter","setSelectedFilter","filter","isSearch","searchTerm","fileStoresType","loading","data","getFileStores","fileStores","variables","visibleInAdmin","getSelectedFiles","file","files","id","existPreviousFile","length","allSelectedFiles","fileId","handleDisplayFileUploadModal","param","defaultFileStore","find","isDefault","key","createElement","value","changeSelectedFilter","_objectSpread","defaultFilters","filters","onClickPrompt","selectedStoreKey","propTypes","func","oneOfType","number","bool","arrayOf","string","isRequired","defaultProps"],"sources":["../../../src/components/ListingContainer/ListingContainer.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { getQuery } from '@blaze-cms/admin-ui-utils';\nimport { ToastProvider } from '@blaze-react/toaster';\nimport Listing from './Listing';\nimport { availableFilters } from '../../utils/available-filters/available-filters';\nimport { MediaContextProvider } from '../../utils/media-context';\nimport FilesListProvider from '../FileList/FilesListProvider';\nimport { existPrevious } from './mappers';\n\nconst ListingContainer = ({\n handleSelectedFiles,\n maxItems,\n filesSelected,\n displayFileUploadModal,\n setDisplayFileUploadModal,\n closeModalAndSetValue,\n simpleLayout,\n openEditInModal,\n storeKey\n}) => {\n const [selectedFiles, setSelectedFiles] = useState(filesSelected || []);\n const [selectedFilter, setSelectedFilter] = useState({\n filter: 'all',\n isSearch: false,\n searchTerm: null,\n storeKey\n });\n\n const fileStoresType = getQuery('GET_FILE_STORES');\n const { loading, data: { getFileStores: fileStores = [] } = {} } = useQuery(fileStoresType, {\n variables: { visibleInAdmin: true }\n });\n if (loading) return null;\n\n const getSelectedFiles = (file, files) => {\n if (simpleLayout) {\n handleSelectedFiles(files, false);\n setSelectedFiles(files);\n return;\n }\n const { id } = file;\n const existPreviousFile = existPrevious(selectedFiles, id);\n if (maxItems === selectedFiles.length && !existPreviousFile) {\n handleSelectedFiles([id], false);\n setSelectedFiles([id]);\n } else {\n const allSelectedFiles = existPreviousFile\n ? selectedFiles.filter(fileId => fileId !== existPreviousFile)\n : [...selectedFiles, id];\n\n handleSelectedFiles(allSelectedFiles, false);\n setSelectedFiles(allSelectedFiles);\n }\n };\n\n const handleDisplayFileUploadModal = param => setDisplayFileUploadModal(param);\n const defaultFileStore = (fileStores.find(({ isDefault }) => isDefault) || {}).key;\n\n return (\n <ToastProvider>\n <MediaContextProvider\n value={{\n fileStores,\n defaultFileStore,\n changeSelectedFilter: value => setSelectedFilter(value),\n selectedFilter: {\n ...selectedFilter,\n storeKey: selectedFilter.storeKey || defaultFileStore,\n defaultFilters: {\n storeKey: selectedFilter.storeKey || defaultFileStore\n }\n },\n selectedFiles,\n getSelectedFiles,\n filters: availableFilters,\n onClickPrompt: () => handleDisplayFileUploadModal(true)\n }}>\n <FilesListProvider>\n <Listing\n closeModalAndSetValue={closeModalAndSetValue}\n simpleLayout={simpleLayout}\n getSelectedFiles={getSelectedFiles}\n setDisplayFileUploadModal={setDisplayFileUploadModal}\n displayFileUploadModal={displayFileUploadModal}\n handleDisplayFileUploadModal={handleDisplayFileUploadModal}\n setSelectedFiles={setSelectedFiles}\n handleSelectedFiles={handleSelectedFiles}\n openEditInModal={openEditInModal}\n selectedStoreKey={selectedFilter.storeKey || defaultFileStore}\n storeKey={storeKey}\n />\n </FilesListProvider>\n </MediaContextProvider>\n </ToastProvider>\n );\n};\n\nListingContainer.propTypes = {\n handleSelectedFiles: PropTypes.func,\n maxItems: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),\n filesSelected: PropTypes.arrayOf(PropTypes.string),\n simpleLayout: PropTypes.bool,\n setDisplayFileUploadModal: PropTypes.func.isRequired,\n displayFileUploadModal: PropTypes.bool.isRequired,\n closeModalAndSetValue: PropTypes.func,\n openEditInModal: PropTypes.bool,\n storeKey: PropTypes.string\n};\n\nListingContainer.defaultProps = {\n closeModalAndSetValue: () => {},\n handleSelectedFiles: () => {},\n maxItems: false,\n filesSelected: [],\n simpleLayout: false,\n openEditInModal: false,\n storeKey: 'default'\n};\n\nexport default ListingContainer;\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,QAAQ,QAAQ,2BAA2B;AACpD,SAASC,aAAa,QAAQ,sBAAsB;AACpD,OAAOC,OAAO,MAAM,WAAW;AAC/B,SAASC,gBAAgB,QAAQ,iDAAiD;AAClF,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,OAAOC,iBAAiB,MAAM,+BAA+B;AAC7D,SAASC,aAAa,QAAQ,WAAW;AAEzC,MAAMC,gBAAgB,GAAGA,CAAC;EACxBC,mBAAmB;EACnBC,QAAQ;EACRC,aAAa;EACbC,sBAAsB;EACtBC,yBAAyB;EACzBC,qBAAqB;EACrBC,YAAY;EACZC,eAAe;EACfC;AACF,CAAC,KAAK;EACJ,MAAM,CAACC,aAAa,EAAEC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AC9DzB,QAAQ,EAAEA;EAAS,CACpB,CACgB,CACC,CACT,CAAC;AAEpB,CAAC;AAEDT,gBAAgB,CAAC8C,SAAS,GAAG;EAC3B7C,mBAAmB,EAAEV,SAAS,CAACwD,IAAI;EACnC7C,QAAQ,EAAEX,SAAS,CAACyD,SAAS,CAAC,CAACzD,SAAS,CAAC0D,MAAM,EAAE1D,SAAS,CAAC2D,IAAI,CAAC,CAAC;EACjE/C,aAAa,EAAEZ,SAAS,CAAC4D,OAAO,CAAC5D,SAAS,CAAC6D,MAAM,CAAC;EAClD7C,YAAY,EAAEhB,SAAS,CAAC2D,IAAI;EAC5B7C,yBAAyB,EAAEd,SAAS,CAACwD,IAAI,CAACM,UAAU;EACpDjD,sBAAsB,EAAEb,SAAS,CAAC2D,IAAI,CAACG,UAAU;EACjD/C,qBAAqB,EAAEf,SAAS,CAACwD,IAAI;EACrCvC,eAAe,EAAEjB,SAAS,CAAC2D,IAAI;EAC/BzC,QAAQ,EAAElB,SAAS,CAAC6D;AACtB,CAAC;AAEDpD,gBAAgB,CAACsD,YAAY,GAAG;EAC9BhD,qBAAqB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAC/BL,mBAAmB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAC7BC,QAAQ,EAAE,KAAK;EACfC,aAAa,EAAE,EAAE;EACjBI,YAAY,EAAE,KAAK;EACnBC,eAAe,EAAE,KAAK;EACtBC,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeT,gBAAgB","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import ListingContainer from './ListingContainer';
2
+ export default ListingContainer;
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["ListingContainer"],"sources":["../../../src/components/ListingContainer/index.js"],"sourcesContent":["import ListingContainer from './ListingContainer';\n\nexport default ListingContainer;\n"],"mappings":"AAAA,OAAOA,gBAAgB,MAAM,oBAAoB;AAEjD,eAAeA,gBAAgB","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ const existPrevious = (selectedFiles, id) => selectedFiles.find(fileId => fileId === id);
2
+ export default existPrevious;
3
+ //# sourceMappingURL=exist-previous.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exist-previous.js","names":["existPrevious","selectedFiles","id","find","fileId"],"sources":["../../../../src/components/ListingContainer/mappers/exist-previous.js"],"sourcesContent":["const existPrevious = (selectedFiles, id) => selectedFiles.find(fileId => fileId === id);\n\nexport default existPrevious;\n"],"mappings":"AAAA,MAAMA,aAAa,GAAGA,CAACC,aAAa,EAAEC,EAAE,KAAKD,aAAa,CAACE,IAAI,CAACC,MAAM,IAAIA,MAAM,KAAKF,EAAE,CAAC;AAExF,eAAeF,aAAa","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import existPrevious from './exist-previous';
2
+ export { existPrevious };
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["existPrevious"],"sources":["../../../../src/components/ListingContainer/mappers/index.js"],"sourcesContent":["import existPrevious from './exist-previous';\n\nexport { existPrevious };\n"],"mappings":"AAAA,OAAOA,aAAa,MAAM,kBAAkB;AAE5C,SAASA,aAAa","ignoreList":[]}
@@ -0,0 +1,29 @@
1
+ import React, { useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import ListingContainer from './ListingContainer';
4
+ const MediaListing = ({
5
+ handleSelectedFiles,
6
+ maxItems,
7
+ filesSelected
8
+ }) => {
9
+ const [displayFileUploadModal, setDisplayFileUploadModal] = useState(false);
10
+ return /*#__PURE__*/React.createElement(ListingContainer, {
11
+ setDisplayFileUploadModal: setDisplayFileUploadModal,
12
+ displayFileUploadModal: displayFileUploadModal,
13
+ handleSelectedFiles: handleSelectedFiles,
14
+ filesSelected: filesSelected,
15
+ maxItems: maxItems
16
+ });
17
+ };
18
+ MediaListing.propTypes = {
19
+ handleSelectedFiles: PropTypes.func,
20
+ maxItems: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),
21
+ filesSelected: PropTypes.arrayOf(PropTypes.string)
22
+ };
23
+ MediaListing.defaultProps = {
24
+ handleSelectedFiles: () => {},
25
+ maxItems: false,
26
+ filesSelected: []
27
+ };
28
+ export default MediaListing;
29
+ //# sourceMappingURL=MediaListing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaListing.js","names":["React","useState","PropTypes","ListingContainer","MediaListing","handleSelectedFiles","maxItems","filesSelected","displayFileUploadModal","setDisplayFileUploadModal","createElement","propTypes","func","oneOfType","number","bool","arrayOf","string","defaultProps"],"sources":["../../src/components/MediaListing.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport ListingContainer from './ListingContainer';\n\nconst MediaListing = ({ handleSelectedFiles, maxItems, filesSelected }) => {\n const [displayFileUploadModal, setDisplayFileUploadModal] = useState(false);\n\n return (\n <ListingContainer\n setDisplayFileUploadModal={setDisplayFileUploadModal}\n displayFileUploadModal={displayFileUploadModal}\n handleSelectedFiles={handleSelectedFiles}\n filesSelected={filesSelected}\n maxItems={maxItems}\n />\n );\n};\n\nMediaListing.propTypes = {\n handleSelectedFiles: PropTypes.func,\n maxItems: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),\n filesSelected: PropTypes.arrayOf(PropTypes.string)\n};\n\nMediaListing.defaultProps = {\n handleSelectedFiles: () => {},\n maxItems: false,\n filesSelected: []\n};\n\nexport default MediaListing;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,gBAAgB,MAAM,oBAAoB;AAEjD,MAAMC,YAAY,GAAGA,CAAC;EAAEC,mBAAmB;EAAEC,QAAQ;EAAEC;AAAc,CAAC,KAAK;EACzE,MAAM,CAACC,sBAAsB,EAAEC,yBAAyB,CAAC,GAAGR,QAAQ,CAAC,KAAK,CAAC;EAE3E,oBACED,KAAA,CAAAU,aAAA,CAACP,gBAAgB;IACfM,yBAAyB,EAAEA,yBAA0B;IACrDD,sBAAsB,EAAEA,sBAAuB;IAC/CH,mBAAmB,EAAEA,mBAAoB;IACzCE,aAAa,EAAEA,aAAc;IAC7BD,QAAQ,EAAEA;EAAS,CACpB,CAAC;AAEN,CAAC;AAEDF,YAAY,CAACO,SAAS,GAAG;EACvBN,mBAAmB,EAAEH,SAAS,CAACU,IAAI;EACnCN,QAAQ,EAAEJ,SAAS,CAACW,SAAS,CAAC,CAACX,SAAS,CAACY,MAAM,EAAEZ,SAAS,CAACa,IAAI,CAAC,CAAC;EACjER,aAAa,EAAEL,SAAS,CAACc,OAAO,CAACd,SAAS,CAACe,MAAM;AACnD,CAAC;AAEDb,YAAY,CAACc,YAAY,GAAG;EAC1Bb,mBAAmB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAC7BC,QAAQ,EAAE,KAAK;EACfC,aAAa,EAAE;AACjB,CAAC;AAED,eAAeH,YAAY","ignoreList":[]}
@@ -0,0 +1,37 @@
1
+ const PLUGIN_NAME = 'media-ui';
2
+ const ONE_FILE_AS_LIMIT = 1;
3
+ const AVAILABLE_FILTER_TYPES = {
4
+ all: {
5
+ type: 'all'
6
+ },
7
+ images: {
8
+ type: 'image'
9
+ },
10
+ videos: {
11
+ type: 'video'
12
+ },
13
+ documents: {
14
+ type: 'text'
15
+ }
16
+ };
17
+ const MEDIA_LIST_ITEM_SIZE = 97;
18
+ const MEDIA_OVER_SCAN_COUNT = 3;
19
+ const ICON_SIZE = {
20
+ WIDTH: '25px',
21
+ HEIGHT: '25px'
22
+ };
23
+ const ICON_COLOR = {
24
+ STROKE: '#63779C',
25
+ FILL: '#63779C'
26
+ };
27
+ const STORE_KEY = 'storeKey';
28
+ const NAME = 'name';
29
+ const ALL = 'all';
30
+ const INVALID_STORE_KEY_VALUES = [null, '', 'Please Choose...', 'Any'];
31
+ const PREVIEW = 'Preview';
32
+ const REORDER = 'Reorder';
33
+ const IMAGES = 'Images';
34
+ const MORE = 'more ...';
35
+ const FILE_DEFAULT_PROPS = ['id', 'location', 'mimetype', 'url', 'data', 'name', 'storeKey', 'filename', 'type', 'updated'];
36
+ export { ALL, AVAILABLE_FILTER_TYPES, IMAGES, INVALID_STORE_KEY_VALUES, MEDIA_LIST_ITEM_SIZE, MEDIA_OVER_SCAN_COUNT, MORE, NAME, ONE_FILE_AS_LIMIT, PLUGIN_NAME, PREVIEW, REORDER, STORE_KEY, ICON_SIZE, ICON_COLOR, FILE_DEFAULT_PROPS };
37
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","names":["PLUGIN_NAME","ONE_FILE_AS_LIMIT","AVAILABLE_FILTER_TYPES","all","type","images","videos","documents","MEDIA_LIST_ITEM_SIZE","MEDIA_OVER_SCAN_COUNT","ICON_SIZE","WIDTH","HEIGHT","ICON_COLOR","STROKE","FILL","STORE_KEY","NAME","ALL","INVALID_STORE_KEY_VALUES","PREVIEW","REORDER","IMAGES","MORE","FILE_DEFAULT_PROPS"],"sources":["../src/constants.js"],"sourcesContent":["const PLUGIN_NAME = 'media-ui';\nconst ONE_FILE_AS_LIMIT = 1;\nconst AVAILABLE_FILTER_TYPES = {\n all: {\n type: 'all'\n },\n images: {\n type: 'image'\n },\n videos: {\n type: 'video'\n },\n documents: {\n type: 'text'\n }\n};\n\nconst MEDIA_LIST_ITEM_SIZE = 97;\nconst MEDIA_OVER_SCAN_COUNT = 3;\n\nconst ICON_SIZE = {\n WIDTH: '25px',\n HEIGHT: '25px'\n};\n\nconst ICON_COLOR = {\n STROKE: '#63779C',\n FILL: '#63779C'\n};\n\nconst STORE_KEY = 'storeKey';\nconst NAME = 'name';\n\nconst ALL = 'all';\nconst INVALID_STORE_KEY_VALUES = [null, '', 'Please Choose...', 'Any'];\nconst PREVIEW = 'Preview';\nconst REORDER = 'Reorder';\nconst IMAGES = 'Images';\nconst MORE = 'more ...';\n\nconst FILE_DEFAULT_PROPS = [\n 'id',\n 'location',\n 'mimetype',\n 'url',\n 'data',\n 'name',\n 'storeKey',\n 'filename',\n 'type',\n 'updated'\n];\n\nexport {\n ALL,\n AVAILABLE_FILTER_TYPES,\n IMAGES,\n INVALID_STORE_KEY_VALUES,\n MEDIA_LIST_ITEM_SIZE,\n MEDIA_OVER_SCAN_COUNT,\n MORE,\n NAME,\n ONE_FILE_AS_LIMIT,\n PLUGIN_NAME,\n PREVIEW,\n REORDER,\n STORE_KEY,\n ICON_SIZE,\n ICON_COLOR,\n FILE_DEFAULT_PROPS\n};\n"],"mappings":"AAAA,MAAMA,WAAW,GAAG,UAAU;AAC9B,MAAMC,iBAAiB,GAAG,CAAC;AAC3B,MAAMC,sBAAsB,GAAG;EAC7BC,GAAG,EAAE;IACHC,IAAI,EAAE;EACR,CAAC;EACDC,MAAM,EAAE;IACND,IAAI,EAAE;EACR,CAAC;EACDE,MAAM,EAAE;IACNF,IAAI,EAAE;EACR,CAAC;EACDG,SAAS,EAAE;IACTH,IAAI,EAAE;EACR;AACF,CAAC;AAED,MAAMI,oBAAoB,GAAG,EAAE;AAC/B,MAAMC,qBAAqB,GAAG,CAAC;AAE/B,MAAMC,SAAS,GAAG;EAChBC,KAAK,EAAE,MAAM;EACbC,MAAM,EAAE;AACV,CAAC;AAED,MAAMC,UAAU,GAAG;EACjBC,MAAM,EAAE,SAAS;EACjBC,IAAI,EAAE;AACR,CAAC;AAED,MAAMC,SAAS,GAAG,UAAU;AAC5B,MAAMC,IAAI,GAAG,MAAM;AAEnB,MAAMC,GAAG,GAAG,KAAK;AACjB,MAAMC,wBAAwB,GAAG,CAAC,IAAI,EAAE,EAAE,EAAE,kBAAkB,EAAE,KAAK,CAAC;AACtE,MAAMC,OAAO,GAAG,SAAS;AACzB,MAAMC,OAAO,GAAG,SAAS;AACzB,MAAMC,MAAM,GAAG,QAAQ;AACvB,MAAMC,IAAI,GAAG,UAAU;AAEvB,MAAMC,kBAAkB,GAAG,CACzB,IAAI,EACJ,UAAU,EACV,UAAU,EACV,KAAK,EACL,MAAM,EACN,MAAM,EACN,UAAU,EACV,UAAU,EACV,MAAM,EACN,SAAS,CACV;AAED,SACEN,GAAG,EACHhB,sBAAsB,EACtBoB,MAAM,EACNH,wBAAwB,EACxBX,oBAAoB,EACpBC,qBAAqB,EACrBc,IAAI,EACJN,IAAI,EACJhB,iBAAiB,EACjBD,WAAW,EACXoB,OAAO,EACPC,OAAO,EACPL,SAAS,EACTN,SAAS,EACTG,UAAU,EACVW,kBAAkB","ignoreList":[]}
@@ -0,0 +1,70 @@
1
+ import React from 'react';
2
+ import { ICON_SIZE, ICON_COLOR } from '../constants';
3
+ function MediaLibraryIcon({
4
+ width = ICON_SIZE.WIDTH,
5
+ height = ICON_SIZE.HEIGHT,
6
+ stroke = ICON_COLOR.STROKE
7
+ }) {
8
+ return /*#__PURE__*/React.createElement("svg", {
9
+ width: width,
10
+ height: height,
11
+ viewBox: "0 0 23 22",
12
+ version: "1.1",
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ xmlnsXlink: "http://www.w3.org/1999/xlink"
15
+ }, /*#__PURE__*/React.createElement("title", null, "media-library"), /*#__PURE__*/React.createElement("g", {
16
+ id: "Page-1",
17
+ stroke: "none",
18
+ strokeWidth: "1",
19
+ fill: "none",
20
+ fillRule: "evenodd"
21
+ }, /*#__PURE__*/React.createElement("g", {
22
+ id: "media-library",
23
+ transform: "translate(1, 1.5)"
24
+ }, /*#__PURE__*/React.createElement("g", {
25
+ id: "Group",
26
+ transform: "translate(11.2707, 9.5) rotate(10) translate(-11.2707, -9.5)translate(2.7864, 1.3495)"
27
+ }, /*#__PURE__*/React.createElement("path", {
28
+ d: "M6.97432089e-17,12.2258144 L4.86362131,7.55351567 C5.69190017,6.75805948 7.03454026,6.75805948 7.86281911,7.55351567 L12.7264404,12.2258144 M10.6053671,10.1881787 L12.2873782,8.57233353 C13.1156571,7.77687734 14.4582972,7.77687734 15.286576,8.57233353 L16.9685872,10.1881787 M2.1210734,16.3010859 L14.8475139,16.3010859 C16.0189503,16.3010859 16.9685872,15.3888053 16.9685872,14.2634501 L16.9685872,2.03763573 C16.9685872,0.912280592 16.0189503,0 14.8475139,0 L2.1210734,0 C0.949636909,0 6.97432089e-17,0.912280592 6.97432089e-17,2.03763573 L6.97432089e-17,14.2634501 C6.97432089e-17,15.3888053 0.949636909,16.3010859 2.1210734,16.3010859 Z",
29
+ id: "Shape",
30
+ stroke: stroke,
31
+ strokeLinecap: "round",
32
+ strokeLinejoin: "round"
33
+ }), /*#__PURE__*/React.createElement("ellipse", {
34
+ id: "Oval",
35
+ fill: "#899BBC",
36
+ fillRule: "nonzero",
37
+ cx: "10.6975876",
38
+ cy: "4.41487742",
39
+ rx: "1.106647",
40
+ ry: "1.01881787"
41
+ })), /*#__PURE__*/React.createElement("rect", {
42
+ id: "Rectangle",
43
+ fill: "#FFFFFF",
44
+ fillRule: "nonzero",
45
+ x: "0",
46
+ y: "2.52861778",
47
+ width: "16.9685872",
48
+ height: "16.3010859",
49
+ rx: "3"
50
+ }), /*#__PURE__*/React.createElement("g", {
51
+ id: "Group",
52
+ transform: "translate(0, 2.5286)"
53
+ }, /*#__PURE__*/React.createElement("path", {
54
+ d: "M0,12.2258144 L4.86362131,7.55351567 C5.69190017,6.75805948 7.03454026,6.75805948 7.86281911,7.55351567 L12.7264404,12.2258144 M10.6053671,10.1881787 L12.2873782,8.57233353 C13.1156571,7.77687734 14.4582972,7.77687734 15.286576,8.57233353 L16.9685872,10.1881787 M2.1210734,16.3010859 L14.8475139,16.3010859 C16.0189503,16.3010859 16.9685872,15.3888053 16.9685872,14.2634501 L16.9685872,2.03763573 C16.9685872,0.912280592 16.0189503,0 14.8475139,0 L2.1210734,0 C0.949636909,0 0,0.912280592 0,2.03763573 L0,14.2634501 C0,15.3888053 0.949636909,16.3010859 2.1210734,16.3010859 Z",
55
+ id: "Shape",
56
+ stroke: "#63779C",
57
+ strokeLinecap: "round",
58
+ strokeLinejoin: "round"
59
+ }), /*#__PURE__*/React.createElement("ellipse", {
60
+ id: "Oval",
61
+ fill: "#63779C",
62
+ fillRule: "nonzero",
63
+ cx: "10.6975876",
64
+ cy: "4.41487742",
65
+ rx: "1.106647",
66
+ ry: "1.01881787"
67
+ })))));
68
+ }
69
+ export default MediaLibraryIcon;
70
+ //# sourceMappingURL=MediaLibraryIcon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaLibraryIcon.js","names":["React","ICON_SIZE","ICON_COLOR","MediaLibraryIcon","width","WIDTH","height","HEIGHT","stroke","STROKE","createElement","viewBox","version","xmlns","xmlnsXlink","id","strokeWidth","fill","fillRule","transform","d","strokeLinecap","strokeLinejoin","cx","cy","rx","ry","x","y"],"sources":["../../src/icons/MediaLibraryIcon.js"],"sourcesContent":["import React from 'react';\nimport { ICON_SIZE, ICON_COLOR } from '../constants';\n\nfunction MediaLibraryIcon({\n width = ICON_SIZE.WIDTH,\n height = ICON_SIZE.HEIGHT,\n stroke = ICON_COLOR.STROKE\n}) {\n return (\n <svg\n width={width}\n height={height}\n viewBox=\"0 0 23 22\"\n version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlnsXlink=\"http://www.w3.org/1999/xlink\">\n <title>media-library</title>\n <g id=\"Page-1\" stroke=\"none\" strokeWidth=\"1\" fill=\"none\" fillRule=\"evenodd\">\n <g id=\"media-library\" transform=\"translate(1, 1.5)\">\n <g\n id=\"Group\"\n transform=\"translate(11.2707, 9.5) rotate(10) translate(-11.2707, -9.5)translate(2.7864, 1.3495)\">\n <path\n d=\"M6.97432089e-17,12.2258144 L4.86362131,7.55351567 C5.69190017,6.75805948 7.03454026,6.75805948 7.86281911,7.55351567 L12.7264404,12.2258144 M10.6053671,10.1881787 L12.2873782,8.57233353 C13.1156571,7.77687734 14.4582972,7.77687734 15.286576,8.57233353 L16.9685872,10.1881787 M2.1210734,16.3010859 L14.8475139,16.3010859 C16.0189503,16.3010859 16.9685872,15.3888053 16.9685872,14.2634501 L16.9685872,2.03763573 C16.9685872,0.912280592 16.0189503,0 14.8475139,0 L2.1210734,0 C0.949636909,0 6.97432089e-17,0.912280592 6.97432089e-17,2.03763573 L6.97432089e-17,14.2634501 C6.97432089e-17,15.3888053 0.949636909,16.3010859 2.1210734,16.3010859 Z\"\n id=\"Shape\"\n stroke={stroke}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <ellipse\n id=\"Oval\"\n fill=\"#899BBC\"\n fillRule=\"nonzero\"\n cx=\"10.6975876\"\n cy=\"4.41487742\"\n rx=\"1.106647\"\n ry=\"1.01881787\"\n />\n </g>\n <rect\n id=\"Rectangle\"\n fill=\"#FFFFFF\"\n fillRule=\"nonzero\"\n x=\"0\"\n y=\"2.52861778\"\n width=\"16.9685872\"\n height=\"16.3010859\"\n rx=\"3\"\n />\n <g id=\"Group\" transform=\"translate(0, 2.5286)\">\n <path\n d=\"M0,12.2258144 L4.86362131,7.55351567 C5.69190017,6.75805948 7.03454026,6.75805948 7.86281911,7.55351567 L12.7264404,12.2258144 M10.6053671,10.1881787 L12.2873782,8.57233353 C13.1156571,7.77687734 14.4582972,7.77687734 15.286576,8.57233353 L16.9685872,10.1881787 M2.1210734,16.3010859 L14.8475139,16.3010859 C16.0189503,16.3010859 16.9685872,15.3888053 16.9685872,14.2634501 L16.9685872,2.03763573 C16.9685872,0.912280592 16.0189503,0 14.8475139,0 L2.1210734,0 C0.949636909,0 0,0.912280592 0,2.03763573 L0,14.2634501 C0,15.3888053 0.949636909,16.3010859 2.1210734,16.3010859 Z\"\n id=\"Shape\"\n stroke=\"#63779C\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <ellipse\n id=\"Oval\"\n fill=\"#63779C\"\n fillRule=\"nonzero\"\n cx=\"10.6975876\"\n cy=\"4.41487742\"\n rx=\"1.106647\"\n ry=\"1.01881787\"\n />\n </g>\n </g>\n </g>\n </svg>\n );\n}\n\nexport default MediaLibraryIcon;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,UAAU,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EAAC,YAAY;IACdxB,KAAK,EAAC,YAAY;IAClBE,MAAM,EAAC,YAAY;IACnBmB,EAAE,EAAC;EAAG,CACP,CAAC,eACFzB,KAAA,CAAAU,aAAA;IAAGK,EAAE,EAAC,OAAO;IAACI,SAAS,EAAC;EAAsB,gBAC5CnB,KAAA,CAAAU,aAAA;IACEU,CAAC,EAAC,ikBAAikB;IACnkBL,EAAE,EAAC,OAAO;IACVP,MAAM,EAAC,SAAS;IAChBa,aAAa,EAAC,OAAO;IACrBC,cAAc,EAAC;EAAO,CACvB,CAAC,eACFtB,KAAA,CAAAU,aAAA;IACEK,EAAE,EAAC,MAAM;IACTE,IAAI,EAAC,SAAS;IACdC,QAAQ,EAAC,SAAS;IAClBK,EAAE,EAAC,YAAY;IACfC,EAAE,EAAC,YAAY;IACfC,EAAE,EAAC,UAAU;IACbC,EAAE,EAAC;EAAY,CAChB,CACA,CACF,CACF,CACA,CAAC;AAEV;AAEA,eAAevB,gBAAgB","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import MediaLibraryIcon from './MediaLibraryIcon';
2
+ export { MediaLibraryIcon };
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["MediaLibraryIcon"],"sources":["../../src/icons/index.js"],"sourcesContent":["import MediaLibraryIcon from './MediaLibraryIcon';\n\nexport { MediaLibraryIcon };\n"],"mappings":"AAAA,OAAOA,gBAAgB,MAAM,oBAAoB;AAEjD,SAASA,gBAAgB","ignoreList":[]}