@chayns-components/gallery 5.0.53 → 5.0.56

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 (184) hide show
  1. package/AGENTS.md +135 -72
  2. package/lib/cjs/components/Gallery.js +16 -329
  3. package/lib/cjs/components/Gallery.js.map +1 -1
  4. package/lib/cjs/components/Gallery.types.js +6 -0
  5. package/lib/cjs/components/Gallery.types.js.map +1 -0
  6. package/lib/cjs/components/gallery-editor/GalleryEditor.js +198 -0
  7. package/lib/cjs/components/gallery-editor/GalleryEditor.js.map +1 -0
  8. package/lib/cjs/components/gallery-editor/GalleryEditor.styles.js +20 -0
  9. package/lib/cjs/components/gallery-editor/GalleryEditor.styles.js.map +1 -0
  10. package/lib/cjs/components/gallery-editor/GalleryEditor.types.js +6 -0
  11. package/lib/cjs/components/gallery-editor/GalleryEditor.types.js.map +1 -0
  12. package/lib/cjs/components/gallery-editor/add-file/AddFile.js.map +1 -0
  13. package/lib/cjs/components/gallery-editor/add-file/AddFile.styles.js.map +1 -0
  14. package/lib/cjs/components/gallery-editor/add-file/AddFile.types.js +6 -0
  15. package/lib/cjs/components/gallery-editor/add-file/AddFile.types.js.map +1 -0
  16. package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js +41 -0
  17. package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js.map +1 -0
  18. package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.js +37 -0
  19. package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.js.map +1 -0
  20. package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.types.js +6 -0
  21. package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.types.js.map +1 -0
  22. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.js +36 -0
  23. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.js.map +1 -0
  24. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.styles.js +15 -0
  25. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.styles.js.map +1 -0
  26. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.types.js +6 -0
  27. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.types.js.map +1 -0
  28. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.js +45 -0
  29. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.js.map +1 -0
  30. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.styles.js +44 -0
  31. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.styles.js.map +1 -0
  32. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.types.js +6 -0
  33. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.types.js.map +1 -0
  34. package/lib/cjs/components/gallery-viewer/GalleryViewer.js +42 -0
  35. package/lib/cjs/components/gallery-viewer/GalleryViewer.js.map +1 -0
  36. package/lib/cjs/components/{Gallery.styles.js → gallery-viewer/GalleryViewer.styles.js} +13 -18
  37. package/lib/cjs/components/gallery-viewer/GalleryViewer.styles.js.map +1 -0
  38. package/lib/cjs/components/gallery-viewer/GalleryViewer.types.js +6 -0
  39. package/lib/cjs/components/gallery-viewer/GalleryViewer.types.js.map +1 -0
  40. package/lib/cjs/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.js +25 -0
  41. package/lib/cjs/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.js.map +1 -0
  42. package/lib/cjs/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.styles.js +30 -0
  43. package/lib/cjs/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.styles.js.map +1 -0
  44. package/lib/cjs/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.types.js +6 -0
  45. package/lib/cjs/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.types.js.map +1 -0
  46. package/lib/cjs/components/media-content/MediaContent.js +36 -0
  47. package/lib/cjs/components/media-content/MediaContent.js.map +1 -0
  48. package/lib/cjs/components/media-content/MediaContent.styles.js +56 -0
  49. package/lib/cjs/components/media-content/MediaContent.styles.js.map +1 -0
  50. package/lib/cjs/components/media-content/MediaContent.types.js +6 -0
  51. package/lib/cjs/components/media-content/MediaContent.types.js.map +1 -0
  52. package/lib/cjs/index.js +14 -0
  53. package/lib/cjs/index.js.map +1 -1
  54. package/lib/cjs/types/gallery.js +9 -0
  55. package/lib/cjs/types/gallery.js.map +1 -1
  56. package/lib/cjs/utils/gallery.js +152 -0
  57. package/lib/cjs/utils/gallery.js.map +1 -0
  58. package/lib/esm/components/Gallery.js +16 -319
  59. package/lib/esm/components/Gallery.js.map +1 -1
  60. package/lib/esm/components/Gallery.types.js +2 -0
  61. package/lib/esm/components/Gallery.types.js.map +1 -0
  62. package/lib/esm/components/gallery-editor/GalleryEditor.js +189 -0
  63. package/lib/esm/components/gallery-editor/GalleryEditor.js.map +1 -0
  64. package/lib/esm/components/gallery-editor/GalleryEditor.styles.js +13 -0
  65. package/lib/esm/components/gallery-editor/GalleryEditor.styles.js.map +1 -0
  66. package/lib/esm/components/gallery-editor/GalleryEditor.types.js +2 -0
  67. package/lib/esm/components/gallery-editor/GalleryEditor.types.js.map +1 -0
  68. package/lib/esm/components/gallery-editor/add-file/AddFile.js.map +1 -0
  69. package/lib/esm/components/gallery-editor/add-file/AddFile.styles.js.map +1 -0
  70. package/lib/esm/components/gallery-editor/add-file/AddFile.types.js +2 -0
  71. package/lib/esm/components/gallery-editor/add-file/AddFile.types.js.map +1 -0
  72. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js +34 -0
  73. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js.map +1 -0
  74. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.js +30 -0
  75. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.js.map +1 -0
  76. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.types.js +2 -0
  77. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.types.js.map +1 -0
  78. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.js +29 -0
  79. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.js.map +1 -0
  80. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.styles.js +8 -0
  81. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.styles.js.map +1 -0
  82. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.types.js +2 -0
  83. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.types.js.map +1 -0
  84. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.js +38 -0
  85. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.js.map +1 -0
  86. package/lib/esm/components/{gallery-item/preview-item/PreviewItem.styles.js → gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.styles.js} +7 -6
  87. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.styles.js.map +1 -0
  88. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.types.js +2 -0
  89. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.types.js.map +1 -0
  90. package/lib/esm/components/gallery-viewer/GalleryViewer.js +34 -0
  91. package/lib/esm/components/gallery-viewer/GalleryViewer.js.map +1 -0
  92. package/lib/esm/components/{Gallery.styles.js → gallery-viewer/GalleryViewer.styles.js} +12 -17
  93. package/lib/esm/components/gallery-viewer/GalleryViewer.styles.js.map +1 -0
  94. package/lib/esm/components/gallery-viewer/GalleryViewer.types.js +2 -0
  95. package/lib/esm/components/gallery-viewer/GalleryViewer.types.js.map +1 -0
  96. package/lib/esm/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.js +18 -0
  97. package/lib/esm/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.js.map +1 -0
  98. package/lib/esm/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.styles.js +23 -0
  99. package/lib/esm/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.styles.js.map +1 -0
  100. package/lib/esm/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.types.js +2 -0
  101. package/lib/esm/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.types.js.map +1 -0
  102. package/lib/esm/components/media-content/MediaContent.js +29 -0
  103. package/lib/esm/components/media-content/MediaContent.js.map +1 -0
  104. package/lib/esm/components/media-content/MediaContent.styles.js +49 -0
  105. package/lib/esm/components/media-content/MediaContent.styles.js.map +1 -0
  106. package/lib/esm/components/media-content/MediaContent.types.js +2 -0
  107. package/lib/esm/components/media-content/MediaContent.types.js.map +1 -0
  108. package/lib/esm/index.js +2 -0
  109. package/lib/esm/index.js.map +1 -1
  110. package/lib/esm/types/gallery.js +9 -0
  111. package/lib/esm/types/gallery.js.map +1 -1
  112. package/lib/esm/utils/gallery.js +132 -0
  113. package/lib/esm/utils/gallery.js.map +1 -0
  114. package/lib/types/components/Gallery.d.ts +1 -44
  115. package/lib/types/components/Gallery.types.d.ts +107 -0
  116. package/lib/types/components/gallery-editor/GalleryEditor.d.ts +4 -0
  117. package/lib/types/components/gallery-editor/GalleryEditor.styles.d.ts +4 -0
  118. package/lib/types/components/gallery-editor/GalleryEditor.types.d.ts +81 -0
  119. package/lib/types/components/gallery-editor/add-file/AddFile.d.ts +4 -0
  120. package/lib/types/components/gallery-editor/add-file/AddFile.types.d.ts +13 -0
  121. package/lib/types/components/gallery-editor/gallery-editor-item/GalleryEditorItem.d.ts +4 -0
  122. package/lib/types/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.d.ts +4 -0
  123. package/lib/types/components/gallery-editor/gallery-editor-item/GalleryEditorItem.types.d.ts +40 -0
  124. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.d.ts +4 -0
  125. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.styles.d.ts +3 -0
  126. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.types.d.ts +30 -0
  127. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.d.ts +4 -0
  128. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.styles.d.ts +10 -0
  129. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.types.d.ts +22 -0
  130. package/lib/types/components/gallery-viewer/GalleryViewer.d.ts +4 -0
  131. package/lib/types/components/gallery-viewer/GalleryViewer.styles.d.ts +7 -0
  132. package/lib/types/components/gallery-viewer/GalleryViewer.types.d.ts +26 -0
  133. package/lib/types/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.d.ts +4 -0
  134. package/lib/types/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.styles.d.ts +2 -0
  135. package/lib/types/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.types.d.ts +41 -0
  136. package/lib/types/components/media-content/MediaContent.d.ts +4 -0
  137. package/lib/types/components/media-content/MediaContent.styles.d.ts +13 -0
  138. package/lib/types/components/media-content/MediaContent.types.d.ts +40 -0
  139. package/lib/types/index.d.ts +5 -0
  140. package/lib/types/types/gallery.d.ts +9 -0
  141. package/lib/types/utils/gallery.d.ts +12 -0
  142. package/package.json +3 -3
  143. package/lib/cjs/components/Gallery.styles.js.map +0 -1
  144. package/lib/cjs/components/add-file/AddFile.js.map +0 -1
  145. package/lib/cjs/components/add-file/AddFile.styles.js.map +0 -1
  146. package/lib/cjs/components/gallery-item/GalleryItem.js +0 -44
  147. package/lib/cjs/components/gallery-item/GalleryItem.js.map +0 -1
  148. package/lib/cjs/components/gallery-item/GalleryItem.styles.js +0 -51
  149. package/lib/cjs/components/gallery-item/GalleryItem.styles.js.map +0 -1
  150. package/lib/cjs/components/gallery-item/media-item/MediaItem.js +0 -52
  151. package/lib/cjs/components/gallery-item/media-item/MediaItem.js.map +0 -1
  152. package/lib/cjs/components/gallery-item/media-item/MediaItem.styles.js +0 -62
  153. package/lib/cjs/components/gallery-item/media-item/MediaItem.styles.js.map +0 -1
  154. package/lib/cjs/components/gallery-item/preview-item/PreviewItem.js +0 -45
  155. package/lib/cjs/components/gallery-item/preview-item/PreviewItem.js.map +0 -1
  156. package/lib/cjs/components/gallery-item/preview-item/PreviewItem.styles.js +0 -43
  157. package/lib/cjs/components/gallery-item/preview-item/PreviewItem.styles.js.map +0 -1
  158. package/lib/esm/components/Gallery.styles.js.map +0 -1
  159. package/lib/esm/components/add-file/AddFile.js.map +0 -1
  160. package/lib/esm/components/add-file/AddFile.styles.js.map +0 -1
  161. package/lib/esm/components/gallery-item/GalleryItem.js +0 -36
  162. package/lib/esm/components/gallery-item/GalleryItem.js.map +0 -1
  163. package/lib/esm/components/gallery-item/GalleryItem.styles.js +0 -44
  164. package/lib/esm/components/gallery-item/GalleryItem.styles.js.map +0 -1
  165. package/lib/esm/components/gallery-item/media-item/MediaItem.js +0 -42
  166. package/lib/esm/components/gallery-item/media-item/MediaItem.js.map +0 -1
  167. package/lib/esm/components/gallery-item/media-item/MediaItem.styles.js +0 -55
  168. package/lib/esm/components/gallery-item/media-item/MediaItem.styles.js.map +0 -1
  169. package/lib/esm/components/gallery-item/preview-item/PreviewItem.js +0 -38
  170. package/lib/esm/components/gallery-item/preview-item/PreviewItem.js.map +0 -1
  171. package/lib/esm/components/gallery-item/preview-item/PreviewItem.styles.js.map +0 -1
  172. package/lib/types/components/Gallery.styles.d.ts +0 -10
  173. package/lib/types/components/add-file/AddFile.d.ts +0 -9
  174. package/lib/types/components/gallery-item/GalleryItem.d.ts +0 -30
  175. package/lib/types/components/gallery-item/GalleryItem.styles.d.ts +0 -5
  176. package/lib/types/components/gallery-item/media-item/MediaItem.d.ts +0 -22
  177. package/lib/types/components/gallery-item/media-item/MediaItem.styles.d.ts +0 -16
  178. package/lib/types/components/gallery-item/preview-item/PreviewItem.d.ts +0 -14
  179. package/lib/types/components/gallery-item/preview-item/PreviewItem.styles.d.ts +0 -10
  180. /package/lib/cjs/components/{add-file → gallery-editor/add-file}/AddFile.js +0 -0
  181. /package/lib/cjs/components/{add-file → gallery-editor/add-file}/AddFile.styles.js +0 -0
  182. /package/lib/esm/components/{add-file → gallery-editor/add-file}/AddFile.js +0 -0
  183. /package/lib/esm/components/{add-file → gallery-editor/add-file}/AddFile.styles.js +0 -0
  184. /package/lib/types/components/{add-file → gallery-editor/add-file}/AddFile.styles.d.ts +0 -0
@@ -0,0 +1,189 @@
1
+ import { uploadFile } from '@chayns-components/core';
2
+ import { createDialog, DialogType } from 'chayns-api';
3
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
4
+ import { v4 as uuidv4 } from 'uuid';
5
+ import { filterDuplicateFile, generatePreviewUrl, generateVideoThumbnail } from '../../utils/file';
6
+ import { openFiles, mapFilesToInternalItems } from '../../utils/gallery';
7
+ import AddFile from './add-file/AddFile';
8
+ import GalleryEditorItem from './gallery-editor-item/GalleryEditorItem';
9
+ import { StyledGalleryEditor, StyledGalleryEditorGrid } from './GalleryEditor.styles';
10
+ const GalleryEditor = ({
11
+ allowDragAndDrop = false,
12
+ doubleFileDialogMessage = 'Diese Datei ist bereits vorhanden',
13
+ fileMinWidth = 100,
14
+ files,
15
+ maxFiles,
16
+ onAdd,
17
+ onFileCountChange,
18
+ onRemove
19
+ }) => {
20
+ const [fileItems, setFileItems] = useState(() => mapFilesToInternalItems(files));
21
+ const handlePreviewUrlCallback = useCallback((previewUrl, file) => {
22
+ setFileItems(prevState => prevState.map(prevFile => {
23
+ if (prevFile.id === file.id) {
24
+ return {
25
+ ...prevFile,
26
+ previewUrl
27
+ };
28
+ }
29
+ return prevFile;
30
+ }));
31
+ }, []);
32
+ const callDuplicateFileDialog = useCallback(() => {
33
+ createDialog({
34
+ type: DialogType.ALERT,
35
+ text: doubleFileDialogMessage
36
+ });
37
+ }, [doubleFileDialogMessage]);
38
+ const handleUploadFileCallback = useCallback((file, uploadedFile) => {
39
+ setFileItems(prevState => {
40
+ const updatedState = prevState.map(prevFile => {
41
+ if (prevFile.uploadedFile?.url === uploadedFile.url) {
42
+ callDuplicateFileDialog();
43
+ return undefined;
44
+ }
45
+ if (prevFile.id === file.id) {
46
+ if (typeof onAdd === 'function') {
47
+ const prevElement = prevState.find(({
48
+ uploadedFile: nextUploadedFile
49
+ }) => nextUploadedFile?.url === uploadedFile?.url);
50
+ if (!prevElement) {
51
+ onAdd({
52
+ file: uploadedFile,
53
+ id: file.id
54
+ });
55
+ }
56
+ }
57
+ return {
58
+ ...prevFile,
59
+ uploadedFile,
60
+ state: 'uploaded'
61
+ };
62
+ }
63
+ return prevFile;
64
+ });
65
+ return updatedState.filter(Boolean);
66
+ });
67
+ }, [callDuplicateFileDialog, onAdd]);
68
+ const handleAddFiles = useCallback(filesToAdd => {
69
+ const newFileItems = [];
70
+ filesToAdd.forEach(file => {
71
+ if (file && !filterDuplicateFile({
72
+ files: fileItems,
73
+ newFile: file
74
+ })) {
75
+ newFileItems.push({
76
+ id: uuidv4(),
77
+ file,
78
+ state: 'none'
79
+ });
80
+ }
81
+ });
82
+ let limitedFileItems = newFileItems;
83
+ if (maxFiles) {
84
+ limitedFileItems = newFileItems.slice(0, Math.max(maxFiles - fileItems.length, 0));
85
+ }
86
+ setFileItems(prevState => [...prevState, ...limitedFileItems]);
87
+ }, [fileItems, maxFiles]);
88
+ const handleDeleteFile = useCallback(id => {
89
+ let fileToDelete;
90
+ const filteredFiles = fileItems.filter(file => {
91
+ if (file.id === id && file.uploadedFile) {
92
+ fileToDelete = {
93
+ file: file.uploadedFile,
94
+ id
95
+ };
96
+ }
97
+ return file.id !== id;
98
+ });
99
+ setFileItems(filteredFiles);
100
+ if (!fileToDelete || typeof onRemove !== 'function') {
101
+ return;
102
+ }
103
+ onRemove(fileToDelete);
104
+ }, [fileItems, onRemove]);
105
+ const handleDrop = useCallback(event => {
106
+ if (!allowDragAndDrop) {
107
+ return;
108
+ }
109
+ event.preventDefault();
110
+ handleAddFiles(Array.from(event.dataTransfer.files));
111
+ }, [allowDragAndDrop, handleAddFiles]);
112
+ const handleOpenFiles = useCallback(file => {
113
+ openFiles(fileItems, file);
114
+ }, [fileItems]);
115
+ useEffect(() => {
116
+ if (typeof onFileCountChange === 'function') {
117
+ onFileCountChange(fileItems.length);
118
+ }
119
+ }, [fileItems.length, onFileCountChange]);
120
+ useEffect(() => {
121
+ const filesToGeneratePreview = fileItems.filter(file => file.file && !file.previewUrl && (file.state === 'none' || !file.state));
122
+ const filesToUpload = fileItems.filter(file => file.file && !file.uploadedFile && file.state !== 'uploading');
123
+ filesToGeneratePreview.forEach(file => {
124
+ if (!file.file) {
125
+ return;
126
+ }
127
+ if (file.file.type.includes('video/')) {
128
+ generateVideoThumbnail({
129
+ file: file.file,
130
+ callback: previewUrl => handlePreviewUrlCallback(previewUrl, file)
131
+ });
132
+ return;
133
+ }
134
+ generatePreviewUrl({
135
+ file: file.file,
136
+ callback: previewUrl => handlePreviewUrlCallback(previewUrl, file)
137
+ });
138
+ });
139
+ filesToUpload.forEach(file => {
140
+ setFileItems(prevState => prevState.map(prevFile => {
141
+ if (prevFile.id === file.id) {
142
+ return {
143
+ ...prevFile,
144
+ state: 'uploading'
145
+ };
146
+ }
147
+ return prevFile;
148
+ }));
149
+ void uploadFile({
150
+ fileToUpload: file,
151
+ callback: uploadedFile => handleUploadFileCallback(file, uploadedFile)
152
+ });
153
+ });
154
+ }, [fileItems, handlePreviewUrlCallback, handleUploadFileCallback]);
155
+ useEffect(() => {
156
+ const externalFileItems = mapFilesToInternalItems(files);
157
+ setFileItems(prevState => {
158
+ // Keep local-only items such as pending uploads while refreshing known external media.
159
+ const updatedItems = prevState.map(prevItem => {
160
+ const matchingItem = externalFileItems.find(item => item.uploadedFile && item.uploadedFile.url === (prevItem.uploadedFile && prevItem.uploadedFile.url));
161
+ return matchingItem || prevItem;
162
+ });
163
+ return updatedItems.concat(externalFileItems.filter(newItem => !prevState.some(prevItem => prevItem.uploadedFile && newItem.uploadedFile && prevItem.uploadedFile.url === newItem.uploadedFile.url)));
164
+ });
165
+ }, [files]);
166
+ const galleryItems = useMemo(() => {
167
+ const items = fileItems.map(file => /*#__PURE__*/React.createElement(GalleryEditorItem, {
168
+ key: file.id,
169
+ fileItem: file,
170
+ onClick: handleOpenFiles,
171
+ handleDeleteFile: handleDeleteFile
172
+ }));
173
+ if (maxFiles && maxFiles <= fileItems.length) {
174
+ return items;
175
+ }
176
+ return [...items, /*#__PURE__*/React.createElement(AddFile, {
177
+ key: "add_file",
178
+ onAdd: handleAddFiles
179
+ })];
180
+ }, [fileItems, handleAddFiles, handleDeleteFile, handleOpenFiles, maxFiles]);
181
+ return /*#__PURE__*/React.createElement(StyledGalleryEditor, null, /*#__PURE__*/React.createElement(StyledGalleryEditorGrid, {
182
+ $fileMinWidth: fileMinWidth,
183
+ onDragOver: event => event.preventDefault(),
184
+ onDrop: event => void handleDrop(event)
185
+ }, galleryItems));
186
+ };
187
+ GalleryEditor.displayName = 'GalleryEditor';
188
+ export default GalleryEditor;
189
+ //# sourceMappingURL=GalleryEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GalleryEditor.js","names":["uploadFile","createDialog","DialogType","React","useCallback","useEffect","useMemo","useState","v4","uuidv4","filterDuplicateFile","generatePreviewUrl","generateVideoThumbnail","openFiles","mapFilesToInternalItems","AddFile","GalleryEditorItem","StyledGalleryEditor","StyledGalleryEditorGrid","GalleryEditor","allowDragAndDrop","doubleFileDialogMessage","fileMinWidth","files","maxFiles","onAdd","onFileCountChange","onRemove","fileItems","setFileItems","handlePreviewUrlCallback","previewUrl","file","prevState","map","prevFile","id","callDuplicateFileDialog","type","ALERT","text","handleUploadFileCallback","uploadedFile","updatedState","url","undefined","prevElement","find","nextUploadedFile","state","filter","Boolean","handleAddFiles","filesToAdd","newFileItems","forEach","newFile","push","limitedFileItems","slice","Math","max","length","handleDeleteFile","fileToDelete","filteredFiles","handleDrop","event","preventDefault","Array","from","dataTransfer","handleOpenFiles","filesToGeneratePreview","filesToUpload","includes","callback","fileToUpload","externalFileItems","updatedItems","prevItem","matchingItem","item","concat","newItem","some","galleryItems","items","createElement","key","fileItem","onClick","$fileMinWidth","onDragOver","onDrop","displayName"],"sources":["../../../../src/components/gallery-editor/GalleryEditor.tsx"],"sourcesContent":["import {\n Image,\n uploadFile,\n Video,\n type FileItem,\n type InternalFileItem,\n} from '@chayns-components/core';\nimport { createDialog, DialogType } from 'chayns-api';\nimport React, { DragEvent, FC, useCallback, useEffect, useMemo, useState } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\nimport { filterDuplicateFile, generatePreviewUrl, generateVideoThumbnail } from '../../utils/file';\nimport { openFiles, mapFilesToInternalItems } from '../../utils/gallery';\nimport AddFile from './add-file/AddFile';\nimport GalleryEditorItem from './gallery-editor-item/GalleryEditorItem';\nimport { StyledGalleryEditor, StyledGalleryEditorGrid } from './GalleryEditor.styles';\nimport type { GalleryEditorProps } from './GalleryEditor.types';\n\nconst GalleryEditor: FC<GalleryEditorProps> = ({\n allowDragAndDrop = false,\n doubleFileDialogMessage = 'Diese Datei ist bereits vorhanden',\n fileMinWidth = 100,\n files,\n maxFiles,\n onAdd,\n onFileCountChange,\n onRemove,\n}) => {\n const [fileItems, setFileItems] = useState<InternalFileItem[]>(() =>\n mapFilesToInternalItems(files),\n );\n\n const handlePreviewUrlCallback = useCallback((previewUrl: string, file: InternalFileItem) => {\n setFileItems((prevState) =>\n prevState.map((prevFile) => {\n if (prevFile.id === file.id) {\n return { ...prevFile, previewUrl };\n }\n\n return prevFile;\n }),\n );\n }, []);\n\n const callDuplicateFileDialog = useCallback(() => {\n createDialog({ type: DialogType.ALERT, text: doubleFileDialogMessage });\n }, [doubleFileDialogMessage]);\n\n const handleUploadFileCallback = useCallback(\n (file: InternalFileItem, uploadedFile: Video | Image) => {\n setFileItems((prevState) => {\n const updatedState = prevState.map((prevFile) => {\n if (prevFile.uploadedFile?.url === uploadedFile.url) {\n callDuplicateFileDialog();\n\n return undefined;\n }\n\n if (prevFile.id === file.id) {\n if (typeof onAdd === 'function') {\n const prevElement = prevState.find(\n ({ uploadedFile: nextUploadedFile }) =>\n nextUploadedFile?.url === uploadedFile?.url,\n );\n\n if (!prevElement) {\n onAdd({\n file: uploadedFile,\n id: file.id,\n });\n }\n }\n\n return {\n ...prevFile,\n uploadedFile,\n state: 'uploaded',\n };\n }\n\n return prevFile;\n });\n\n return updatedState.filter(Boolean) as InternalFileItem[];\n });\n },\n [callDuplicateFileDialog, onAdd],\n );\n\n const handleAddFiles = useCallback(\n (filesToAdd: File[]) => {\n const newFileItems: InternalFileItem[] = [];\n\n filesToAdd.forEach((file) => {\n if (file && !filterDuplicateFile({ files: fileItems, newFile: file })) {\n newFileItems.push({\n id: uuidv4(),\n file,\n state: 'none',\n });\n }\n });\n\n let limitedFileItems = newFileItems;\n\n if (maxFiles) {\n limitedFileItems = newFileItems.slice(0, Math.max(maxFiles - fileItems.length, 0));\n }\n\n setFileItems((prevState) => [...prevState, ...limitedFileItems]);\n },\n [fileItems, maxFiles],\n );\n\n const handleDeleteFile = useCallback(\n (id?: string) => {\n let fileToDelete: FileItem | undefined;\n\n const filteredFiles = fileItems.filter((file) => {\n if (file.id === id && file.uploadedFile) {\n fileToDelete = { file: file.uploadedFile, id };\n }\n\n return file.id !== id;\n });\n\n setFileItems(filteredFiles);\n\n if (!fileToDelete || typeof onRemove !== 'function') {\n return;\n }\n\n onRemove(fileToDelete);\n },\n [fileItems, onRemove],\n );\n\n const handleDrop = useCallback(\n (event: DragEvent<HTMLDivElement>) => {\n if (!allowDragAndDrop) {\n return;\n }\n\n event.preventDefault();\n\n handleAddFiles(Array.from(event.dataTransfer.files));\n },\n [allowDragAndDrop, handleAddFiles],\n );\n\n const handleOpenFiles = useCallback(\n (file: InternalFileItem) => {\n openFiles(fileItems, file);\n },\n [fileItems],\n );\n\n useEffect(() => {\n if (typeof onFileCountChange === 'function') {\n onFileCountChange(fileItems.length);\n }\n }, [fileItems.length, onFileCountChange]);\n\n useEffect(() => {\n const filesToGeneratePreview = fileItems.filter(\n (file) => file.file && !file.previewUrl && (file.state === 'none' || !file.state),\n );\n\n const filesToUpload = fileItems.filter(\n (file) => file.file && !file.uploadedFile && file.state !== 'uploading',\n );\n\n filesToGeneratePreview.forEach((file) => {\n if (!file.file) {\n return;\n }\n\n if (file.file.type.includes('video/')) {\n generateVideoThumbnail({\n file: file.file,\n callback: (previewUrl) => handlePreviewUrlCallback(previewUrl, file),\n });\n\n return;\n }\n\n generatePreviewUrl({\n file: file.file,\n callback: (previewUrl) => handlePreviewUrlCallback(previewUrl, file),\n });\n });\n\n filesToUpload.forEach((file) => {\n setFileItems((prevState) =>\n prevState.map((prevFile) => {\n if (prevFile.id === file.id) {\n return { ...prevFile, state: 'uploading' };\n }\n\n return prevFile;\n }),\n );\n\n void uploadFile({\n fileToUpload: file,\n callback: (uploadedFile) => handleUploadFileCallback(file, uploadedFile),\n });\n });\n }, [fileItems, handlePreviewUrlCallback, handleUploadFileCallback]);\n\n useEffect(() => {\n const externalFileItems = mapFilesToInternalItems(files);\n\n setFileItems((prevState) => {\n // Keep local-only items such as pending uploads while refreshing known external media.\n const updatedItems = prevState.map((prevItem) => {\n const matchingItem = externalFileItems.find(\n (item) =>\n item.uploadedFile &&\n item.uploadedFile.url ===\n (prevItem.uploadedFile && prevItem.uploadedFile.url),\n );\n\n return matchingItem || prevItem;\n });\n\n return updatedItems.concat(\n externalFileItems.filter(\n (newItem) =>\n !prevState.some(\n (prevItem) =>\n prevItem.uploadedFile &&\n newItem.uploadedFile &&\n prevItem.uploadedFile.url === newItem.uploadedFile.url,\n ),\n ),\n );\n });\n }, [files]);\n\n const galleryItems = useMemo(() => {\n const items = fileItems.map((file) => (\n <GalleryEditorItem\n key={file.id}\n fileItem={file}\n onClick={handleOpenFiles}\n handleDeleteFile={handleDeleteFile}\n />\n ));\n\n if (maxFiles && maxFiles <= fileItems.length) {\n return items;\n }\n\n return [...items, <AddFile key=\"add_file\" onAdd={handleAddFiles} />];\n }, [fileItems, handleAddFiles, handleDeleteFile, handleOpenFiles, maxFiles]);\n\n return (\n <StyledGalleryEditor>\n <StyledGalleryEditorGrid\n $fileMinWidth={fileMinWidth}\n onDragOver={(event) => event.preventDefault()}\n onDrop={(event) => void handleDrop(event)}\n >\n {galleryItems}\n </StyledGalleryEditorGrid>\n </StyledGalleryEditor>\n );\n};\n\nGalleryEditor.displayName = 'GalleryEditor';\n\nexport default GalleryEditor;\n"],"mappings":"AAAA,SAEIA,UAAU,QAIP,yBAAyB;AAChC,SAASC,YAAY,EAAEC,UAAU,QAAQ,YAAY;AACrD,OAAOC,KAAK,IAAmBC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACvF,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AACnC,SAASC,mBAAmB,EAAEC,kBAAkB,EAAEC,sBAAsB,QAAQ,kBAAkB;AAClG,SAASC,SAAS,EAAEC,uBAAuB,QAA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F,OAAO,CAAC,MAAM;IAC/B,MAAMiF,KAAK,GAAG3D,SAAS,CAACM,GAAG,CAAEF,IAAI,iBAC7B7B,KAAA,CAAAqF,aAAA,CAACxE,iBAAiB;MACdyE,GAAG,EAAEzD,IAAI,CAACI,EAAG;MACbsD,QAAQ,EAAE1D,IAAK;MACf2D,OAAO,EAAEnB,eAAgB;MACzBT,gBAAgB,EAAEA;IAAiB,CACtC,CACJ,CAAC;IAEF,IAAIvC,QAAQ,IAAIA,QAAQ,IAAII,SAAS,CAACkC,MAAM,EAAE;MAC1C,OAAOyB,KAAK;IAChB;IAEA,OAAO,CAAC,GAAGA,KAAK,eAAEpF,KAAA,CAAAqF,aAAA,CAACzE,OAAO;MAAC0E,GAAG,EAAC,UAAU;MAAChE,KAAK,EAAE2B;IAAe,CAAE,CAAC,CAAC;EACxE,CAAC,EAAE,CAACxB,SAAS,EAAEwB,cAAc,EAAEW,gBAAgB,EAAES,eAAe,EAAEhD,QAAQ,CAAC,CAAC;EAE5E,oBACIrB,KAAA,CAAAqF,aAAA,CAACvE,mBAAmB,qBAChBd,KAAA,CAAAqF,aAAA,CAACtE,uBAAuB;IACpB0E,aAAa,EAAEtE,YAAa;IAC5BuE,UAAU,EAAG1B,KAAK,IAAKA,KAAK,CAACC,cAAc,CAAC,CAAE;IAC9C0B,MAAM,EAAG3B,KAAK,IAAK,KAAKD,UAAU,CAACC,KAAK;EAAE,GAEzCmB,YACoB,CACR,CAAC;AAE9B,CAAC;AAEDnE,aAAa,CAAC4E,WAAW,GAAG,eAAe;AAE3C,eAAe5E,aAAa","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ import styled from 'styled-components';
2
+ export const StyledGalleryEditor = styled.div`
3
+ width: 100%;
4
+ `;
5
+ export const StyledGalleryEditorGrid = styled.div`
6
+ display: grid;
7
+ grid-template-columns: ${({
8
+ $fileMinWidth
9
+ }) => `repeat(auto-fill, minmax(${$fileMinWidth}px, 1fr))`};
10
+ grid-auto-rows: 1fr;
11
+ gap: 6px;
12
+ `;
13
+ //# sourceMappingURL=GalleryEditor.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GalleryEditor.styles.js","names":["styled","StyledGalleryEditor","div","StyledGalleryEditorGrid","$fileMinWidth"],"sources":["../../../../src/components/gallery-editor/GalleryEditor.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledGalleryEditor = styled.div`\n width: 100%;\n`;\n\nexport const StyledGalleryEditorGrid = styled.div<{\n $fileMinWidth: number;\n}>`\n display: grid;\n grid-template-columns: ${({ $fileMinWidth }) =>\n `repeat(auto-fill, minmax(${$fileMinWidth}px, 1fr))`};\n grid-auto-rows: 1fr;\n gap: 6px;\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,mBAAmB,GAAGD,MAAM,CAACE,GAAG;AAC7C;AACA,CAAC;AAED,OAAO,MAAMC,uBAAuB,GAAGH,MAAM,CAACE,GAE5C;AACF;AACA,6BAA6B,CAAC;EAAEE;AAAc,CAAC,KACvC,4BAA4BA,aAAa,WAAW;AAC5D;AACA;AACA,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=GalleryEditor.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GalleryEditor.types.js","names":[],"sources":["../../../../src/components/gallery-editor/GalleryEditor.types.ts"],"sourcesContent":["import type { FileItem } from '@chayns-components/core';\n\n/**\n * Props for the editable gallery component.\n */\nexport interface GalleryEditorProps {\n /**\n * Enables drag and drop file selection inside the editor grid.\n * @description\n * When enabled, users can drop local image or video files onto the editor grid to start the upload flow.\n * @default false\n * @example\n * <GalleryEditor allowDragAndDrop files={files} />\n * @optional\n */\n allowDragAndDrop?: boolean;\n /**\n * Defines the dialog message that is shown when a duplicate upload is detected.\n * @description\n * The message is shown when a newly uploaded file resolves to a URL that already exists in the editor state.\n * @default 'Diese Datei ist bereits vorhanden'\n * @example\n * <GalleryEditor doubleFileDialogMessage=\"This file already exists.\" files={files} />\n * @optional\n */\n doubleFileDialogMessage?: string;\n /**\n * Defines the minimum width of one tile in the editor grid.\n * @description\n * The editor uses this value to size the responsive grid columns that hold uploaded items and the add-tile.\n * @default 100\n * @example\n * <GalleryEditor fileMinWidth={140} files={files} />\n * @optional\n */\n fileMinWidth?: number;\n /**\n * Provides already uploaded media items that should be merged into the editor state.\n * @description\n * These files represent the externally known uploaded baseline. The editor may additionally hold local pending uploads.\n * @example\n * <GalleryEditor files={files} />\n * @optional\n */\n files?: FileItem[];\n /**\n * Limits how many files can be managed by the editor.\n * @description\n * After the limit is reached, the add-tile is hidden and additional file selection is ignored.\n * @example\n * <GalleryEditor files={files} maxFiles={6} />\n * @optional\n */\n maxFiles?: number;\n /**\n * Is called after a file has been uploaded successfully.\n * @description\n * The callback receives the uploaded file representation so the consuming state can persist it externally.\n * @example\n * <GalleryEditor onAdd={(file) => setFiles((prev) => [...prev, file])} />\n * @optional\n */\n onAdd?: (file: FileItem) => void;\n /**\n * Is called whenever the internal item count changes, including local pending uploads.\n * @description\n * Use this callback when surrounding UI needs to react to the number of currently managed items.\n * @example\n * <GalleryEditor onFileCountChange={(count) => console.log(count)} />\n * @optional\n */\n onFileCountChange?: (fileCount: number) => void;\n /**\n * Is called after an uploaded file has been removed.\n * @description\n * The callback receives the removed uploaded file so the consuming state can remove it from its controlled `files` array.\n * @example\n * <GalleryEditor onRemove={(file) => removeFile(file.id)} />\n * @optional\n */\n onRemove?: (file: FileItem) => void;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AddFile.js","names":["Icon","selectFiles","React","useCallback","StyledAddFile","StyledAddFIleIconWrapper","AddFile","onAdd","openSelectDialog","files","multiple","type","createElement","key","onClick","size","icons","displayName"],"sources":["../../../../../src/components/gallery-editor/add-file/AddFile.tsx"],"sourcesContent":["import { Icon, selectFiles } from '@chayns-components/core';\nimport React, { FC, useCallback } from 'react';\nimport { StyledAddFile, StyledAddFIleIconWrapper } from './AddFile.styles';\nimport type { AddFileProps } from './AddFile.types';\n\nconst AddFile: FC<AddFileProps> = ({ onAdd }) => {\n const openSelectDialog = useCallback(async () => {\n const files = await selectFiles({\n multiple: true,\n type: 'image/*, video/*',\n });\n\n onAdd(files);\n }, [onAdd]);\n\n return (\n <StyledAddFile key=\"addButton\">\n <StyledAddFIleIconWrapper onClick={() => void openSelectDialog()}>\n <Icon size={40} icons={['fa fa-plus']} />\n </StyledAddFIleIconWrapper>\n </StyledAddFile>\n );\n};\n\nAddFile.displayName = 'AddFile';\n\nexport default AddFile;\n"],"mappings":"AAAA,SAASA,IAAI,EAAEC,WAAW,QAAQ,yBAAyB;AAC3D,OAAOC,KAAK,IAAQC,WAAW,QAAQ,OAAO;AAC9C,SAASC,aAAa,EAAEC,wBAAwB,QAAQ,kBAAkB;AAG1E,MAAMC,OAAyB,GAAGA,CAAC;EAAEC;AAAM,CAAC,KAAK;EAC7C,MAAMC,gBAAgB,GAAGL,WAAW,CAAC,YAAY;IAC7C,MAAMM,KAAK,GAAG,MAAMR,WAAW,CAAC;MAC5BS,QAAQ,EAAE,IAAI;MACdC,IAAI,EAAE;IACV,CAAC,CAAC;IAEFJ,KAAK,CAACE,KAAK,CAAC;EAChB,CAAC,EAAE,CAACF,KAAK,CAAC,CAAC;EAEX,oBACIL,KAAA,CAAAU,aAAA,CAACR,aAAa;IAACS,GAAG,EAAC;EAAW,gBAC1BX,KAAA,CAAAU,aAAA,CAACP,wBAAwB;IAACS,OAAO,EAAEA,CAAA,KAAM,KAAKN,gBAAgB,CAAC;EAAE,gBAC7DN,KAAA,CAAAU,aAAA,CAACZ,IAAI;IAACe,IAAI,EAAE,EAAG;IAACC,KAAK,EAAE,CAAC,YAAY;EAAE,CAAE,CAClB,CACf,CAAC;AAExB,CAAC;AAEDV,OAAO,CAACW,WAAW,GAAG,SAAS;AAE/B,eAAeX,OAAO","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AddFile.styles.js","names":["styled","StyledAddFile","div","StyledAddFIleIconWrapper","button","theme"],"sources":["../../../../../src/components/gallery-editor/add-file/AddFile.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled from 'styled-components';\n\nexport const StyledAddFile = styled.div`\n position: relative;\n`;\n\ntype StyledAddFIleIconWrapperProps = WithTheme<unknown>;\n\nexport const StyledAddFIleIconWrapper = styled.button<StyledAddFIleIconWrapperProps>`\n background-color: ${({ theme }: StyledAddFIleIconWrapperProps) => theme['101']};\n box-shadow: 0 0 0 1px\n rgba(${({ theme }: StyledAddFIleIconWrapperProps) => theme['009-rgb']}, 0.08) inset;\n width: 100%;\n aspect-ratio: 1 / 1;\n`;\n"],"mappings":"AACA,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,aAAa,GAAGD,MAAM,CAACE,GAAG;AACvC;AACA,CAAC;AAID,OAAO,MAAMC,wBAAwB,GAAGH,MAAM,CAACI,MAAqC;AACpF,wBAAwB,CAAC;EAAEC;AAAqC,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AAClF;AACA,eAAe,CAAC;EAAEA;AAAqC,CAAC,KAAKA,KAAK,CAAC,SAAS,CAAC;AAC7E;AACA;AACA,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AddFile.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AddFile.types.js","names":[],"sources":["../../../../../src/components/gallery-editor/add-file/AddFile.types.ts"],"sourcesContent":["/**\n * Props for the add-file tile inside the gallery editor.\n */\nexport interface AddFileProps {\n /**\n * Is called with the selected local files.\n * @description\n * The editor add-tile uses this callback after the file picker resolves with the selected local image or video files.\n * @example\n * <AddFile onAdd={(files) => console.log(files)} />\n */\n onAdd: (files: File[]) => void;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,34 @@
1
+ import { Icon } from '@chayns-components/core';
2
+ import { AnimatePresence } from 'motion/react';
3
+ import React from 'react';
4
+ import { StyledGalleryEditorItem, StyledGalleryEditorItemDeleteButton } from './GalleryEditorItem.styles';
5
+ import GalleryEditorMediaItem from './gallery-editor-media-item/GalleryEditorMediaItem';
6
+ import GalleryEditorPreviewItem from './gallery-editor-preview-item/GalleryEditorPreviewItem';
7
+ const GalleryEditorItem = ({
8
+ fileItem,
9
+ handleDeleteFile,
10
+ ratio = 1,
11
+ onClick
12
+ }) => {
13
+ const mediaContent = !fileItem.state || fileItem.state === 'none' || !fileItem.previewUrl && !fileItem.uploadedFile ? null : fileItem.state === 'uploading' ? /*#__PURE__*/React.createElement(GalleryEditorPreviewItem, {
14
+ ratio: ratio,
15
+ key: `uploading_${fileItem.id ?? ''}`,
16
+ fileItem: fileItem
17
+ }) : /*#__PURE__*/React.createElement(GalleryEditorMediaItem, {
18
+ key: `uploaded_${fileItem.id ?? ''}`,
19
+ fileItem: fileItem,
20
+ ratio: ratio,
21
+ openSelectedFile: onClick
22
+ });
23
+ return /*#__PURE__*/React.createElement(StyledGalleryEditorItem, null, /*#__PURE__*/React.createElement(StyledGalleryEditorItemDeleteButton, {
24
+ onClick: () => handleDeleteFile(fileItem.id)
25
+ }, /*#__PURE__*/React.createElement(Icon, {
26
+ size: 20,
27
+ icons: ['ts-wrong']
28
+ })), /*#__PURE__*/React.createElement(AnimatePresence, {
29
+ initial: false
30
+ }, mediaContent));
31
+ };
32
+ GalleryEditorItem.displayName = 'GalleryEditorItem';
33
+ export default GalleryEditorItem;
34
+ //# sourceMappingURL=GalleryEditorItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GalleryEditorItem.js","names":["Icon","AnimatePresence","React","StyledGalleryEditorItem","StyledGalleryEditorItemDeleteButton","GalleryEditorMediaItem","GalleryEditorPreviewItem","GalleryEditorItem","fileItem","handleDeleteFile","ratio","onClick","mediaContent","state","previewUrl","uploadedFile","createElement","key","id","openSelectedFile","size","icons","initial","displayName"],"sources":["../../../../../src/components/gallery-editor/gallery-editor-item/GalleryEditorItem.tsx"],"sourcesContent":["import { Icon } from '@chayns-components/core';\nimport { AnimatePresence } from 'motion/react';\nimport React, { FC } from 'react';\nimport {\n StyledGalleryEditorItem,\n StyledGalleryEditorItemDeleteButton,\n} from './GalleryEditorItem.styles';\nimport GalleryEditorMediaItem from './gallery-editor-media-item/GalleryEditorMediaItem';\nimport GalleryEditorPreviewItem from './gallery-editor-preview-item/GalleryEditorPreviewItem';\nimport type { GalleryEditorItemProps } from './GalleryEditorItem.types';\n\nconst GalleryEditorItem: FC<GalleryEditorItemProps> = ({\n fileItem,\n handleDeleteFile,\n ratio = 1,\n onClick,\n}) => {\n const mediaContent =\n !fileItem.state ||\n fileItem.state === 'none' ||\n (!fileItem.previewUrl && !fileItem.uploadedFile) ? null : fileItem.state === 'uploading' ? (\n <GalleryEditorPreviewItem\n ratio={ratio}\n key={`uploading_${fileItem.id ?? ''}`}\n fileItem={fileItem}\n />\n ) : (\n <GalleryEditorMediaItem\n key={`uploaded_${fileItem.id ?? ''}`}\n fileItem={fileItem}\n ratio={ratio}\n openSelectedFile={onClick}\n />\n );\n\n return (\n <StyledGalleryEditorItem>\n <StyledGalleryEditorItemDeleteButton onClick={() => handleDeleteFile(fileItem.id)}>\n <Icon size={20} icons={['ts-wrong']} />\n </StyledGalleryEditorItemDeleteButton>\n <AnimatePresence initial={false}>{mediaContent}</AnimatePresence>\n </StyledGalleryEditorItem>\n );\n};\n\nGalleryEditorItem.displayName = 'GalleryEditorItem';\n\nexport default GalleryEditorItem;\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,yBAAyB;AAC9C,SAASC,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,MAAc,OAAO;AACjC,SACIC,uBAAuB,EACvBC,mCAAmC,QAChC,4BAA4B;AACnC,OAAOC,sBAAsB,MAAM,oDAAoD;AACvF,OAAOC,wBAAwB,MAAM,wDAAwD;AAG7F,MAAMC,iBAA6C,GAAGA,CAAC;EACnDC,QAAQ;EACRC,gBAAgB;EAChBC,KAAK,GAAG,CAAC;EACTC;AACJ,CAAC,KAAK;EACF,MAAMC,YAAY,GACd,CAACJ,QAAQ,CAACK,KAAK,IACfL,QAAQ,CAACK,KAAK,KAAK,MAAM,IACxB,CAACL,QAAQ,CAACM,UAAU,IAAI,CAACN,QAAQ,CAACO,YAAa,GAAG,IAAI,GAAGP,QAAQ,CAACK,KAAK,KAAK,WAAW,gBACpFX,KAAA,CAAAc,aAAA,CAACV,wBAAwB;IACrBI,KAAK,EAAEA,KAAM;IACbO,GAAG,EAAE,aAAaT,QAAQ,CAACU,EAAE,IAAI,EAAE,EAAG;IACtCV,QAAQ,EAAEA;EAAS,CACtB,CAAC,gBAEFN,KAAA,CAAAc,aAAA,CAACX,sBAAsB;IACnBY,GAAG,EAAE,YAAYT,QAAQ,CAACU,EAAE,IAAI,EAAE,EAAG;IACrCV,QAAQ,EAAEA,QAAS;IACnBE,KAAK,EAAEA,KAAM;IACbS,gBAAgB,EAAER;EAAQ,CAC7B,CACJ;EAEL,oBACIT,KAAA,CAAAc,aAAA,CAACb,uBAAuB,qBACpBD,KAAA,CAAAc,aAAA,CAACZ,mCAAmC;IAACO,OAAO,EAAEA,CAAA,KAAMF,gBAAgB,CAACD,QAAQ,CAACU,EAAE;EAAE,gBAC9EhB,KAAA,CAAAc,aAAA,CAAChB,IAAI;IAACoB,IAAI,EAAE,EAAG;IAACC,KAAK,EAAE,CAAC,UAAU;EAAE,CAAE,CACL,CAAC,eACtCnB,KAAA,CAAAc,aAAA,CAACf,eAAe;IAACqB,OAAO,EAAE;EAAM,GAAEV,YAA8B,CAC3C,CAAC;AAElC,CAAC;AAEDL,iBAAiB,CAACgB,WAAW,GAAG,mBAAmB;AAEnD,eAAehB,iBAAiB","ignoreList":[]}
@@ -0,0 +1,30 @@
1
+ import styled from 'styled-components';
2
+ export const StyledGalleryEditorItem = styled.div`
3
+ display: flex;
4
+ position: relative;
5
+ height: 100%;
6
+ width: 100%;
7
+ `;
8
+ export const StyledGalleryEditorItemDeleteButton = styled.button`
9
+ background-color: rgba(
10
+ ${({
11
+ theme
12
+ }) => theme['000-rgb']},
13
+ 0.75
14
+ );
15
+ box-shadow: 0 0 0 1px
16
+ rgba(${({
17
+ theme
18
+ }) => theme['009-rgb']}, 0.08)
19
+ inset;
20
+ position: absolute;
21
+ top: 0;
22
+ right: 0;
23
+ z-index: 2;
24
+ height: 30px;
25
+ width: 30px;
26
+ display: flex;
27
+ justify-content: center;
28
+ align-items: center;
29
+ `;
30
+ //# sourceMappingURL=GalleryEditorItem.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GalleryEditorItem.styles.js","names":["styled","StyledGalleryEditorItem","div","StyledGalleryEditorItemDeleteButton","button","theme"],"sources":["../../../../../src/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled from 'styled-components';\n\nexport const StyledGalleryEditorItem = styled.div`\n display: flex;\n position: relative;\n height: 100%;\n width: 100%;\n`;\n\ntype StyledGalleryEditorItemDeleteButtonProps = WithTheme<unknown>;\n\nexport const StyledGalleryEditorItemDeleteButton = styled.button<StyledGalleryEditorItemDeleteButtonProps>`\n background-color: rgba(\n ${({ theme }: StyledGalleryEditorItemDeleteButtonProps) => theme['000-rgb']},\n 0.75\n );\n box-shadow: 0 0 0 1px\n rgba(${({ theme }: StyledGalleryEditorItemDeleteButtonProps) => theme['009-rgb']}, 0.08)\n inset;\n position: absolute;\n top: 0;\n right: 0;\n z-index: 2;\n height: 30px;\n width: 30px;\n display: flex;\n justify-content: center;\n align-items: center;\n`;\n"],"mappings":"AACA,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,uBAAuB,GAAGD,MAAM,CAACE,GAAG;AACjD;AACA;AACA;AACA;AACA,CAAC;AAID,OAAO,MAAMC,mCAAmC,GAAGH,MAAM,CAACI,MAAgD;AAC1G;AACA,UAAU,CAAC;EAAEC;AAAgD,CAAC,KAAKA,KAAK,CAAC,SAAS,CAAC;AACnF;AACA;AACA;AACA,eAAe,CAAC;EAAEA;AAAgD,CAAC,KAAKA,KAAK,CAAC,SAAS,CAAC;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=GalleryEditorItem.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GalleryEditorItem.types.js","names":[],"sources":["../../../../../src/components/gallery-editor/gallery-editor-item/GalleryEditorItem.types.ts"],"sourcesContent":["import type { InternalFileItem } from '@chayns-components/core';\n\n/**\n * Props for a single editable gallery tile.\n */\nexport interface GalleryEditorItemProps {\n /**\n * Provides the media item that should be rendered inside the tile.\n * @description\n * The item may represent a pending local upload or an already uploaded media file managed by the editor.\n * @example\n * <GalleryEditorItem fileItem={fileItem} handleDeleteFile={handleDeleteFile} onClick={handleOpen} />\n */\n fileItem: InternalFileItem;\n /**\n * Is called when the delete button is clicked in edit mode.\n * @description\n * The callback receives the internal item identifier so the editor can remove the item from its local state.\n * @example\n * <GalleryEditorItem handleDeleteFile={(id) => console.log(id)} fileItem={fileItem} onClick={handleOpen} />\n */\n handleDeleteFile: (id?: string) => void;\n /**\n * Defines the aspect ratio that should be reserved for the rendered media.\n * @description\n * Use this when the editor item should reserve a fixed tile ratio for uploaded previews.\n * @default 1\n * @example\n * <GalleryEditorItem fileItem={fileItem} handleDeleteFile={handleDeleteFile} onClick={handleOpen} ratio={1.5} />\n * @optional\n */\n ratio?: number;\n /**\n * Is called when the tile is clicked.\n * @description\n * The editor uses this callback to open the currently selected media within the slideshow flow.\n * @example\n * <GalleryEditorItem fileItem={fileItem} handleDeleteFile={handleDeleteFile} onClick={handleOpen} />\n */\n onClick: (file: InternalFileItem) => void;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import MediaContent from '../../../media-content/MediaContent';
3
+ import { StyledMotionGalleryEditorMediaItem } from './GalleryEditorMediaItem.styles';
4
+ const GalleryEditorMediaItem = ({
5
+ fileItem,
6
+ openSelectedFile,
7
+ ratio
8
+ }) => /*#__PURE__*/React.createElement(StyledMotionGalleryEditorMediaItem, {
9
+ animate: {
10
+ opacity: 1
11
+ },
12
+ initial: {
13
+ opacity: 0
14
+ },
15
+ exit: {
16
+ opacity: 0
17
+ },
18
+ transition: {
19
+ duration: 3.2
20
+ }
21
+ }, fileItem.uploadedFile && /*#__PURE__*/React.createElement(MediaContent, {
22
+ file: fileItem.uploadedFile,
23
+ onClick: () => openSelectedFile(fileItem),
24
+ playIconSize: 30,
25
+ ratio: ratio
26
+ }));
27
+ GalleryEditorMediaItem.displayName = 'GalleryEditorMediaItem';
28
+ export default GalleryEditorMediaItem;
29
+ //# sourceMappingURL=GalleryEditorMediaItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GalleryEditorMediaItem.js","names":["React","MediaContent","StyledMotionGalleryEditorMediaItem","GalleryEditorMediaItem","fileItem","openSelectedFile","ratio","createElement","animate","opacity","initial","exit","transition","duration","uploadedFile","file","onClick","playIconSize","displayName"],"sources":["../../../../../../src/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport MediaContent from '../../../media-content/MediaContent';\nimport { StyledMotionGalleryEditorMediaItem } from './GalleryEditorMediaItem.styles';\nimport type { GalleryEditorMediaItemProps } from './GalleryEditorMediaItem.types';\n\nconst GalleryEditorMediaItem: FC<GalleryEditorMediaItemProps> = ({\n fileItem,\n openSelectedFile,\n ratio,\n}) => (\n <StyledMotionGalleryEditorMediaItem\n animate={{ opacity: 1 }}\n initial={{ opacity: 0 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 3.2 }}\n >\n {fileItem.uploadedFile && (\n <MediaContent\n file={fileItem.uploadedFile}\n onClick={() => openSelectedFile(fileItem)}\n playIconSize={30}\n ratio={ratio}\n />\n )}\n </StyledMotionGalleryEditorMediaItem>\n);\n\nGalleryEditorMediaItem.displayName = 'GalleryEditorMediaItem';\n\nexport default GalleryEditorMediaItem;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAc,OAAO;AACjC,OAAOC,YAAY,MAAM,qCAAqC;AAC9D,SAASC,kCAAkC,QAAQ,iCAAiC;AAGpF,MAAMC,sBAAuD,GAAGA,CAAC;EAC7DC,QAAQ;EACRC,gBAAgB;EAChBC;AACJ,CAAC,kBACGN,KAAA,CAAAO,aAAA,CAACL,kCAAkC;EAC/BM,OAAO,EAAE;IAAEC,OAAO,EAAE;EAAE,CAAE;EACxBC,OAAO,EAAE;IAAED,OAAO,EAAE;EAAE,CAAE;EACxBE,IAAI,EAAE;IAAEF,OAAO,EAAE;EAAE,CAAE;EACrBG,UAAU,EAAE;IAAEC,QAAQ,EAAE;EAAI;AAAE,GAE7BT,QAAQ,CAACU,YAAY,iBAClBd,KAAA,CAAAO,aAAA,CAACN,YAAY;EACTc,IAAI,EAAEX,QAAQ,CAACU,YAAa;EAC5BE,OAAO,EAAEA,CAAA,KAAMX,gBAAgB,CAACD,QAAQ,CAAE;EAC1Ca,YAAY,EAAE,EAAG;EACjBX,KAAK,EAAEA;AAAM,CAChB,CAE2B,CACvC;AAEDH,sBAAsB,CAACe,WAAW,GAAG,wBAAwB;AAE7D,eAAef,sBAAsB","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ import { motion } from 'motion/react';
2
+ import styled from 'styled-components';
3
+ export const StyledMotionGalleryEditorMediaItem = styled(motion.div)`
4
+ display: flex;
5
+ width: 100%;
6
+ height: 100%;
7
+ `;
8
+ //# sourceMappingURL=GalleryEditorMediaItem.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GalleryEditorMediaItem.styles.js","names":["motion","styled","StyledMotionGalleryEditorMediaItem","div"],"sources":["../../../../../../src/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled from 'styled-components';\n\nexport const StyledMotionGalleryEditorMediaItem = styled(motion.div)`\n display: flex;\n width: 100%;\n height: 100%;\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,kCAAkC,GAAGD,MAAM,CAACD,MAAM,CAACG,GAAG,CAAC;AACpE;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=GalleryEditorMediaItem.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GalleryEditorMediaItem.types.js","names":[],"sources":["../../../../../../src/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.types.ts"],"sourcesContent":["import type { InternalFileItem } from '@chayns-components/core';\n\n/**\n * Props for a rendered uploaded media item.\n */\nexport interface GalleryEditorMediaItemProps {\n /**\n * Provides the uploaded media item that should be rendered.\n * @description\n * This item is expected to contain an `uploadedFile` because pending uploads are rendered by the preview component instead.\n * @example\n * <GalleryEditorMediaItem fileItem={fileItem} onClick={handleOpen} ratio={1} />\n */\n fileItem: InternalFileItem;\n /**\n * Is called when the media tile is selected.\n * @description\n * The editor uses this callback to open the uploaded media in the slideshow flow.\n * @example\n * <GalleryEditorMediaItem fileItem={fileItem} openSelectedFile={handleOpen} ratio={1} />\n */\n openSelectedFile: (file: InternalFileItem) => void;\n /**\n * Defines the aspect ratio that should be reserved for the media.\n * @description\n * The media tile keeps this ratio reserved so the editor grid remains visually stable.\n * @example\n * <GalleryEditorMediaItem fileItem={fileItem} openSelectedFile={handleOpen} ratio={1.5} />\n */\n ratio: number;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,38 @@
1
+ import { SmallWaitCursor } from '@chayns-components/core';
2
+ import React from 'react';
3
+ import { StyledGalleryEditorPreviewItemImage, StyledGalleryEditorPreviewItemImageWrapper, StyledGalleryEditorPreviewItemLoadingIcon, StyledMotionGalleryEditorPreviewItem } from './GalleryEditorPreviewItem.styles';
4
+ const GalleryEditorPreviewItem = ({
5
+ fileItem,
6
+ ratio
7
+ }) => /*#__PURE__*/React.createElement(StyledMotionGalleryEditorPreviewItem, {
8
+ animate: {
9
+ opacity: 1
10
+ },
11
+ initial: {
12
+ opacity: 0
13
+ },
14
+ exit: {
15
+ opacity: 0,
16
+ transition: {
17
+ duration: 3.2,
18
+ delay: 3.2
19
+ }
20
+ },
21
+ transition: {
22
+ duration: 3.2
23
+ },
24
+ style: {
25
+ position: 'absolute'
26
+ }
27
+ }, /*#__PURE__*/React.createElement(StyledGalleryEditorPreviewItemImageWrapper, {
28
+ $ratio: ratio
29
+ }, /*#__PURE__*/React.createElement(StyledGalleryEditorPreviewItemLoadingIcon, null, /*#__PURE__*/React.createElement(SmallWaitCursor, {
30
+ shouldHideWaitCursor: false,
31
+ shouldHideBackground: true
32
+ })), /*#__PURE__*/React.createElement(StyledGalleryEditorPreviewItemImage, {
33
+ draggable: false,
34
+ src: fileItem.previewUrl
35
+ })));
36
+ GalleryEditorPreviewItem.displayName = 'GalleryEditorPreviewItem';
37
+ export default GalleryEditorPreviewItem;
38
+ //# sourceMappingURL=GalleryEditorPreviewItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GalleryEditorPreviewItem.js","names":["SmallWaitCursor","React","StyledGalleryEditorPreviewItemImage","StyledGalleryEditorPreviewItemImageWrapper","StyledGalleryEditorPreviewItemLoadingIcon","StyledMotionGalleryEditorPreviewItem","GalleryEditorPreviewItem","fileItem","ratio","createElement","animate","opacity","initial","exit","transition","duration","delay","style","position","$ratio","shouldHideWaitCursor","shouldHideBackground","draggable","src","previewUrl","displayName"],"sources":["../../../../../../src/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.tsx"],"sourcesContent":["import { SmallWaitCursor } from '@chayns-components/core';\nimport React, { FC } from 'react';\nimport {\n StyledGalleryEditorPreviewItemImage,\n StyledGalleryEditorPreviewItemImageWrapper,\n StyledGalleryEditorPreviewItemLoadingIcon,\n StyledMotionGalleryEditorPreviewItem,\n} from './GalleryEditorPreviewItem.styles';\nimport type { GalleryEditorPreviewItemProps } from './GalleryEditorPreviewItem.types';\n\nconst GalleryEditorPreviewItem: FC<GalleryEditorPreviewItemProps> = ({ fileItem, ratio }) => (\n <StyledMotionGalleryEditorPreviewItem\n animate={{ opacity: 1 }}\n initial={{ opacity: 0 }}\n exit={{\n opacity: 0,\n transition: { duration: 3.2, delay: 3.2 },\n }}\n transition={{ duration: 3.2 }}\n style={{ position: 'absolute' }}\n >\n <StyledGalleryEditorPreviewItemImageWrapper $ratio={ratio}>\n <StyledGalleryEditorPreviewItemLoadingIcon>\n <SmallWaitCursor shouldHideWaitCursor={false} shouldHideBackground />\n </StyledGalleryEditorPreviewItemLoadingIcon>\n <StyledGalleryEditorPreviewItemImage draggable={false} src={fileItem.previewUrl} />\n </StyledGalleryEditorPreviewItemImageWrapper>\n </StyledMotionGalleryEditorPreviewItem>\n);\n\nGalleryEditorPreviewItem.displayName = 'GalleryEditorPreviewItem';\n\nexport default GalleryEditorPreviewItem;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,yBAAyB;AACzD,OAAOC,KAAK,MAAc,OAAO;AACjC,SACIC,mCAAmC,EACnCC,0CAA0C,EAC1CC,yCAAyC,EACzCC,oCAAoC,QACjC,mCAAmC;AAG1C,MAAMC,wBAA2D,GAAGA,CAAC;EAAEC,QAAQ;EAAEC;AAAM,CAAC,kBACpFP,KAAA,CAAAQ,aAAA,CAACJ,oCAAoC;EACjCK,OAAO,EAAE;IAAEC,OAAO,EAAE;EAAE,CAAE;EACxBC,OAAO,EAAE;IAAED,OAAO,EAAE;EAAE,CAAE;EACxBE,IAAI,EAAE;IACFF,OAAO,EAAE,CAAC;IACVG,UAAU,EAAE;MAAEC,QAAQ,EAAE,GAAG;MAAEC,KAAK,EAAE;IAAI;EAC5C,CAAE;EACFF,UAAU,EAAE;IAAEC,QAAQ,EAAE;EAAI,CAAE;EAC9BE,KAAK,EAAE;IAAEC,QAAQ,EAAE;EAAW;AAAE,gBAEhCjB,KAAA,CAAAQ,aAAA,CAACN,0CAA0C;EAACgB,MAAM,EAAEX;AAAM,gBACtDP,KAAA,CAAAQ,aAAA,CAACL,yCAAyC,qBACtCH,KAAA,CAAAQ,aAAA,CAACT,eAAe;EAACoB,oBAAoB,EAAE,KAAM;EAACC,oBAAoB;AAAA,CAAE,CAC7B,CAAC,eAC5CpB,KAAA,CAAAQ,aAAA,CAACP,mCAAmC;EAACoB,SAAS,EAAE,KAAM;EAACC,GAAG,EAAEhB,QAAQ,CAACiB;AAAW,CAAE,CAC1C,CACV,CACzC;AAEDlB,wBAAwB,CAACmB,WAAW,GAAG,0BAA0B;AAEjE,eAAenB,wBAAwB","ignoreList":[]}
@@ -1,11 +1,11 @@
1
1
  import { motion } from 'motion/react';
2
2
  import styled from 'styled-components';
3
- export const StyledMotionPreviewItem = styled(motion.div)`
3
+ export const StyledMotionGalleryEditorPreviewItem = styled(motion.div)`
4
4
  display: flex;
5
5
  width: 100%;
6
6
  height: 100%;
7
7
  `;
8
- export const StyledPreviewItemImageWrapper = styled.div`
8
+ export const StyledGalleryEditorPreviewItemImageWrapper = styled.div`
9
9
  display: flex;
10
10
  width: 100%;
11
11
  height: 100%;
@@ -13,24 +13,25 @@ export const StyledPreviewItemImageWrapper = styled.div`
13
13
  $ratio
14
14
  }) => $ratio};
15
15
  `;
16
- export const StyledPreviewItemImage = styled.img`
16
+ export const StyledGalleryEditorPreviewItemImage = styled.img`
17
17
  background-color: ${({
18
18
  theme
19
19
  }) => theme['101']};
20
20
  box-shadow: 0 0 0 1px
21
21
  rgba(${({
22
22
  theme
23
- }) => theme['009-rgb']}, 0.08) inset;
23
+ }) => theme['009-rgb']}, 0.08)
24
+ inset;
24
25
  z-index: 1;
25
26
  width: 100%;
26
27
  height: 100%;
27
28
  object-fit: cover;
28
29
  `;
29
- export const StyledPreviewItemLoadingIcon = styled.div`
30
+ export const StyledGalleryEditorPreviewItemLoadingIcon = styled.div`
30
31
  position: absolute;
31
32
  z-index: 2;
32
33
  top: 50%;
33
34
  left: 50%;
34
35
  transform: translate(-50%, -50%);
35
36
  `;
36
- //# sourceMappingURL=PreviewItem.styles.js.map
37
+ //# sourceMappingURL=GalleryEditorPreviewItem.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GalleryEditorPreviewItem.styles.js","names":["motion","styled","StyledMotionGalleryEditorPreviewItem","div","StyledGalleryEditorPreviewItemImageWrapper","$ratio","StyledGalleryEditorPreviewItemImage","img","theme","StyledGalleryEditorPreviewItemLoadingIcon"],"sources":["../../../../../../src/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport { motion } from 'motion/react';\nimport styled from 'styled-components';\n\nexport const StyledMotionGalleryEditorPreviewItem = styled(motion.div)`\n display: flex;\n width: 100%;\n height: 100%;\n`;\n\nexport const StyledGalleryEditorPreviewItemImageWrapper = styled.div<{ $ratio: number }>`\n display: flex;\n width: 100%;\n height: 100%;\n aspect-ratio: ${({ $ratio }) => $ratio};\n`;\n\ntype StyledGalleryEditorPreviewItemImageProps = WithTheme<unknown>;\n\nexport const StyledGalleryEditorPreviewItemImage = styled.img<StyledGalleryEditorPreviewItemImageProps>`\n background-color: ${({ theme }: StyledGalleryEditorPreviewItemImageProps) => theme['101']};\n box-shadow: 0 0 0 1px\n rgba(${({ theme }: StyledGalleryEditorPreviewItemImageProps) => theme['009-rgb']}, 0.08)\n inset;\n z-index: 1;\n width: 100%;\n height: 100%;\n object-fit: cover;\n`;\n\nexport const StyledGalleryEditorPreviewItemLoadingIcon = styled.div`\n position: absolute;\n z-index: 2;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n`;\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,oCAAoC,GAAGD,MAAM,CAACD,MAAM,CAACG,GAAG,CAAC;AACtE;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,0CAA0C,GAAGH,MAAM,CAACE,GAAuB;AACxF;AACA;AACA;AACA,oBAAoB,CAAC;EAAEE;AAAO,CAAC,KAAKA,MAAM;AAC1C,CAAC;AAID,OAAO,MAAMC,mCAAmC,GAAGL,MAAM,CAACM,GAA6C;AACvG,wBAAwB,CAAC;EAAEC;AAAgD,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AAC7F;AACA,eAAe,CAAC;EAAEA;AAAgD,CAAC,KAAKA,KAAK,CAAC,SAAS,CAAC;AACxF;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,yCAAyC,GAAGR,MAAM,CAACE,GAAG;AACnE;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=GalleryEditorPreviewItem.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GalleryEditorPreviewItem.types.js","names":[],"sources":["../../../../../../src/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.types.ts"],"sourcesContent":["import type { InternalFileItem } from '@chayns-components/core';\n\n/**\n * Props for a preview tile while a file is uploading.\n */\nexport interface GalleryEditorPreviewItemProps {\n /**\n * Provides the internal file item that contains the preview URL.\n * @description\n * This item is expected to describe a local upload that already has a generated preview image.\n * @example\n * <GalleryEditorPreviewItem fileItem={fileItem} ratio={1} />\n */\n fileItem: InternalFileItem;\n /**\n * Defines the aspect ratio that should be reserved for the preview.\n * @description\n * The preview keeps this ratio reserved while the upload is still in progress.\n * @example\n * <GalleryEditorPreviewItem fileItem={fileItem} ratio={1.5} />\n */\n ratio: number;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,34 @@
1
+ import React, { useCallback, useMemo } from 'react';
2
+ import GalleryViewerItem from './gallery-viewer-item/GalleryViewerItem';
3
+ import { StyledGalleryViewer, StyledGalleryViewerItemWrapper } from './GalleryViewer.styles';
4
+ import { getGalleryRatio, getGalleryViewerKey, getReadOnlyItemRatio, openKnownFiles } from '../../utils/gallery';
5
+ import { GalleryViewMode } from '../../types/gallery';
6
+ const GalleryViewer = ({
7
+ files,
8
+ viewMode = GalleryViewMode.GRID
9
+ }) => {
10
+ const fileItems = files ?? [];
11
+ const ratio = useMemo(() => getGalleryRatio(fileItems), [fileItems]);
12
+ const handleOpenFiles = useCallback(file => {
13
+ openKnownFiles(fileItems, file);
14
+ }, [fileItems]);
15
+ const visibleItems = fileItems.slice(0, 4);
16
+ return /*#__PURE__*/React.createElement(StyledGalleryViewer, null, /*#__PURE__*/React.createElement(StyledGalleryViewerItemWrapper, {
17
+ $ratio: ratio,
18
+ $itemCount: fileItems.length,
19
+ $viewMode: viewMode
20
+ }, visibleItems.map((file, index) => /*#__PURE__*/React.createElement(GalleryViewerItem, {
21
+ key: getGalleryViewerKey(file, index),
22
+ fileItem: file,
23
+ onClick: handleOpenFiles,
24
+ ratio: getReadOnlyItemRatio({
25
+ fileItems,
26
+ index,
27
+ viewMode
28
+ }),
29
+ remainingItemsLength: fileItems.length > 4 && index === 3 ? fileItems.length : undefined
30
+ }))));
31
+ };
32
+ GalleryViewer.displayName = 'GalleryViewer';
33
+ export default GalleryViewer;
34
+ //# sourceMappingURL=GalleryViewer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GalleryViewer.js","names":["React","useCallback","useMemo","GalleryViewerItem","StyledGalleryViewer","StyledGalleryViewerItemWrapper","getGalleryRatio","getGalleryViewerKey","getReadOnlyItemRatio","openKnownFiles","GalleryViewMode","GalleryViewer","files","viewMode","GRID","fileItems","ratio","handleOpenFiles","file","visibleItems","slice","createElement","$ratio","$itemCount","length","$viewMode","map","index","key","fileItem","onClick","remainingItemsLength","undefined","displayName"],"sources":["../../../../src/components/gallery-viewer/GalleryViewer.tsx"],"sourcesContent":["import type { FileItem } from '@chayns-components/core';\nimport React, { FC, useCallback, useMemo } from 'react';\nimport GalleryViewerItem from './gallery-viewer-item/GalleryViewerItem';\nimport { StyledGalleryViewer, StyledGalleryViewerItemWrapper } from './GalleryViewer.styles';\nimport type { GalleryViewerProps } from './GalleryViewer.types';\nimport {\n getGalleryRatio,\n getGalleryViewerKey,\n getReadOnlyItemRatio,\n openKnownFiles,\n} from '../../utils/gallery';\nimport { GalleryViewMode } from '../../types/gallery';\n\nconst GalleryViewer: FC<GalleryViewerProps> = ({ files, viewMode = GalleryViewMode.GRID }) => {\n const fileItems = files ?? [];\n\n const ratio = useMemo(() => getGalleryRatio(fileItems), [fileItems]);\n\n const handleOpenFiles = useCallback(\n (file: FileItem) => {\n openKnownFiles(fileItems, file);\n },\n [fileItems],\n );\n\n const visibleItems = fileItems.slice(0, 4);\n\n return (\n <StyledGalleryViewer>\n <StyledGalleryViewerItemWrapper\n $ratio={ratio}\n $itemCount={fileItems.length}\n $viewMode={viewMode}\n >\n {visibleItems.map((file, index) => (\n <GalleryViewerItem\n key={getGalleryViewerKey(file, index)}\n fileItem={file}\n onClick={handleOpenFiles}\n ratio={getReadOnlyItemRatio({ fileItems, index, viewMode })}\n remainingItemsLength={\n fileItems.length > 4 && index === 3 ? fileItems.length : undefined\n }\n />\n ))}\n </StyledGalleryViewerItemWrapper>\n </StyledGalleryViewer>\n );\n};\n\nGalleryViewer.displayName = 'GalleryViewer';\n\nexport default GalleryViewer;\n"],"mappings":"AACA,OAAOA,KAAK,IAAQC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACvD,OAAOC,iBAAiB,MAAM,yCAAyC;AACvE,SAASC,mBAAmB,EAAEC,8BAA8B,QAAQ,wBAAwB;AAE5F,SACIC,eAAe,EACfC,mBAAmB,EACnBC,oBAAoB,EACpBC,cAAc,QACX,qBAAqB;AAC5B,SAASC,eAAe,QAAQ,qBAAqB;AAErD,MAAMC,aAAqC,GAAGA,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