@chayns-components/gallery 5.2.4-alpha.0 → 5.2.5

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 (124) hide show
  1. package/AGENTS.md +132 -13
  2. package/lib/cjs/components/Gallery.js +4 -1
  3. package/lib/cjs/components/Gallery.js.map +1 -1
  4. package/lib/cjs/components/Gallery.types.js.map +1 -1
  5. package/lib/cjs/components/gallery-editor/GalleryEditor.constants.js +12 -0
  6. package/lib/cjs/components/gallery-editor/GalleryEditor.constants.js.map +1 -0
  7. package/lib/cjs/components/gallery-editor/GalleryEditor.js +40 -178
  8. package/lib/cjs/components/gallery-editor/GalleryEditor.js.map +1 -1
  9. package/lib/cjs/components/gallery-editor/GalleryEditor.styles.js +3 -1
  10. package/lib/cjs/components/gallery-editor/GalleryEditor.styles.js.map +1 -1
  11. package/lib/cjs/components/gallery-editor/GalleryEditor.types.js.map +1 -1
  12. package/lib/cjs/components/gallery-editor/GalleryEditor.utils.js +27 -0
  13. package/lib/cjs/components/gallery-editor/GalleryEditor.utils.js.map +1 -0
  14. package/lib/cjs/components/gallery-editor/add-file/AddFile.js +1 -1
  15. package/lib/cjs/components/gallery-editor/add-file/AddFile.js.map +1 -1
  16. package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js +48 -19
  17. package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js.map +1 -1
  18. package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.js +10 -3
  19. package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.js.map +1 -1
  20. package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.types.js.map +1 -1
  21. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.js +10 -4
  22. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.js.map +1 -1
  23. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.types.js.map +1 -1
  24. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.js +7 -10
  25. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.js.map +1 -1
  26. package/lib/cjs/components/gallery-editor/useGalleryEditorState.js +161 -0
  27. package/lib/cjs/components/gallery-editor/useGalleryEditorState.js.map +1 -0
  28. package/lib/cjs/components/gallery-viewer/GalleryViewer.constants.js +8 -0
  29. package/lib/cjs/components/gallery-viewer/GalleryViewer.constants.js.map +1 -0
  30. package/lib/cjs/components/gallery-viewer/GalleryViewer.js +8 -4
  31. package/lib/cjs/components/gallery-viewer/GalleryViewer.js.map +1 -1
  32. package/lib/cjs/components/gallery-viewer/GalleryViewer.types.js.map +1 -1
  33. package/lib/cjs/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.js +6 -3
  34. package/lib/cjs/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.js.map +1 -1
  35. package/lib/cjs/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.types.js.map +1 -1
  36. package/lib/cjs/components/media-content/MediaContent.constants.js +12 -0
  37. package/lib/cjs/components/media-content/MediaContent.constants.js.map +1 -0
  38. package/lib/cjs/components/media-content/MediaContent.js +95 -20
  39. package/lib/cjs/components/media-content/MediaContent.js.map +1 -1
  40. package/lib/cjs/components/media-content/MediaContent.styles.js +35 -5
  41. package/lib/cjs/components/media-content/MediaContent.styles.js.map +1 -1
  42. package/lib/cjs/components/media-content/MediaContent.types.js.map +1 -1
  43. package/lib/cjs/components/media-content/MediaContent.utils.js +84 -0
  44. package/lib/cjs/components/media-content/MediaContent.utils.js.map +1 -0
  45. package/lib/cjs/components/media-content/useMediaContentSize.js +68 -0
  46. package/lib/cjs/components/media-content/useMediaContentSize.js.map +1 -0
  47. package/lib/cjs/utils/gallery.js +2 -2
  48. package/lib/cjs/utils/gallery.js.map +1 -1
  49. package/lib/esm/components/Gallery.js +4 -1
  50. package/lib/esm/components/Gallery.js.map +1 -1
  51. package/lib/esm/components/Gallery.types.js.map +1 -1
  52. package/lib/esm/components/gallery-editor/GalleryEditor.constants.js +6 -0
  53. package/lib/esm/components/gallery-editor/GalleryEditor.constants.js.map +1 -0
  54. package/lib/esm/components/gallery-editor/GalleryEditor.js +37 -174
  55. package/lib/esm/components/gallery-editor/GalleryEditor.js.map +1 -1
  56. package/lib/esm/components/gallery-editor/GalleryEditor.styles.js +3 -1
  57. package/lib/esm/components/gallery-editor/GalleryEditor.styles.js.map +1 -1
  58. package/lib/esm/components/gallery-editor/GalleryEditor.types.js.map +1 -1
  59. package/lib/esm/components/gallery-editor/GalleryEditor.utils.js +17 -0
  60. package/lib/esm/components/gallery-editor/GalleryEditor.utils.js.map +1 -0
  61. package/lib/esm/components/gallery-editor/add-file/AddFile.js +2 -2
  62. package/lib/esm/components/gallery-editor/add-file/AddFile.js.map +1 -1
  63. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js +47 -19
  64. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js.map +1 -1
  65. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.js +9 -2
  66. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.js.map +1 -1
  67. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.types.js.map +1 -1
  68. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.js +9 -4
  69. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.js.map +1 -1
  70. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.types.js.map +1 -1
  71. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.js +6 -9
  72. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.js.map +1 -1
  73. package/lib/esm/components/gallery-editor/useGalleryEditorState.js +150 -0
  74. package/lib/esm/components/gallery-editor/useGalleryEditorState.js.map +1 -0
  75. package/lib/esm/components/gallery-viewer/GalleryViewer.constants.js +2 -0
  76. package/lib/esm/components/gallery-viewer/GalleryViewer.constants.js.map +1 -0
  77. package/lib/esm/components/gallery-viewer/GalleryViewer.js +9 -5
  78. package/lib/esm/components/gallery-viewer/GalleryViewer.js.map +1 -1
  79. package/lib/esm/components/gallery-viewer/GalleryViewer.types.js.map +1 -1
  80. package/lib/esm/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.js +5 -3
  81. package/lib/esm/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.js.map +1 -1
  82. package/lib/esm/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.types.js.map +1 -1
  83. package/lib/esm/components/media-content/MediaContent.constants.js +6 -0
  84. package/lib/esm/components/media-content/MediaContent.constants.js.map +1 -0
  85. package/lib/esm/components/media-content/MediaContent.js +94 -21
  86. package/lib/esm/components/media-content/MediaContent.js.map +1 -1
  87. package/lib/esm/components/media-content/MediaContent.styles.js +34 -4
  88. package/lib/esm/components/media-content/MediaContent.styles.js.map +1 -1
  89. package/lib/esm/components/media-content/MediaContent.types.js.map +1 -1
  90. package/lib/esm/components/media-content/MediaContent.utils.js +71 -0
  91. package/lib/esm/components/media-content/MediaContent.utils.js.map +1 -0
  92. package/lib/esm/components/media-content/useMediaContentSize.js +62 -0
  93. package/lib/esm/components/media-content/useMediaContentSize.js.map +1 -0
  94. package/lib/esm/utils/gallery.js +2 -2
  95. package/lib/esm/utils/gallery.js.map +1 -1
  96. package/lib/types/components/Gallery.types.d.ts +12 -0
  97. package/lib/types/components/gallery-editor/GalleryEditor.constants.d.ts +5 -0
  98. package/lib/types/components/gallery-editor/GalleryEditor.styles.d.ts +7 -3
  99. package/lib/types/components/gallery-editor/GalleryEditor.types.d.ts +11 -0
  100. package/lib/types/components/gallery-editor/GalleryEditor.utils.d.ts +5 -0
  101. package/lib/types/components/gallery-editor/add-file/AddFile.d.ts +3 -3
  102. package/lib/types/components/gallery-editor/add-file/AddFile.styles.d.ts +5 -3
  103. package/lib/types/components/gallery-editor/gallery-editor-item/GalleryEditorItem.d.ts +3 -3
  104. package/lib/types/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.d.ts +13 -3
  105. package/lib/types/components/gallery-editor/gallery-editor-item/GalleryEditorItem.types.d.ts +8 -0
  106. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.d.ts +3 -3
  107. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.styles.d.ts +3 -1
  108. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.types.d.ts +15 -0
  109. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.d.ts +3 -3
  110. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.styles.d.ts +12 -6
  111. package/lib/types/components/gallery-editor/useGalleryEditorState.d.ts +21 -0
  112. package/lib/types/components/gallery-viewer/GalleryViewer.constants.d.ts +1 -0
  113. package/lib/types/components/gallery-viewer/GalleryViewer.styles.d.ts +7 -3
  114. package/lib/types/components/gallery-viewer/GalleryViewer.types.d.ts +11 -0
  115. package/lib/types/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.d.ts +3 -3
  116. package/lib/types/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.styles.d.ts +2 -2
  117. package/lib/types/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.types.d.ts +8 -0
  118. package/lib/types/components/media-content/MediaContent.constants.d.ts +5 -0
  119. package/lib/types/components/media-content/MediaContent.d.ts +3 -3
  120. package/lib/types/components/media-content/MediaContent.styles.d.ts +50 -9
  121. package/lib/types/components/media-content/MediaContent.types.d.ts +16 -0
  122. package/lib/types/components/media-content/MediaContent.utils.d.ts +12 -0
  123. package/lib/types/components/media-content/useMediaContentSize.d.ts +3 -0
  124. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"GalleryEditor.js","names":["_core","require","_chaynsApi","_react","_interopRequireWildcard","_uuid","_file","_gallery","_AddFile","_interopRequireDefault","_GalleryEditorItem","_GalleryEditor","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GalleryEditor","forwardRef","allowDragAndDrop","addFileIcon","doubleFileDialogMessage","fileMinWidth","files","maxFiles","onAdd","onFileCountChange","onRemove","ref","fileItems","setFileItems","useState","mapFilesToInternalItems","handleClear","useCallback","handlePreviewUrlCallback","previewUrl","file","prevState","map","prevFile","id","callDuplicateFileDialog","createDialog","type","DialogType","ALERT","text","handleUploadFileCallback","uploadedFile","updatedState","_prevFile$uploadedFil","url","undefined","prevElement","find","nextUploadedFile","state","filter","Boolean","handleAddFiles","filesToAdd","newFileItems","forEach","filterDuplicateFile","newFile","push","uuidv4","limitedFileItems","slice","Math","max","length","handleDeleteFile","fileToDelete","filteredFiles","handleDrop","event","preventDefault","Array","from","dataTransfer","handleOpenFiles","openFiles","useImperativeHandle","clear","useEffect","filesToGeneratePreview","filesToUpload","includes","generateVideoThumbnail","callback","generatePreviewUrl","uploadFile","fileToUpload","externalFileItems","updatedItems","prevItem","matchingItem","item","concat","newItem","some","galleryItems","useMemo","items","createElement","key","fileItem","onClick","StyledGalleryEditor","StyledGalleryEditorGrid","$fileMinWidth","onDragOver","onDrop","displayName","_default","exports"],"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, {\n DragEvent,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useState,\n} 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, GalleryEditorRef } from './GalleryEditor.types';\n\nconst GalleryEditor = forwardRef<GalleryEditorRef, GalleryEditorProps>(\n (\n {\n allowDragAndDrop = false,\n addFileIcon = 'fa fa-plus',\n doubleFileDialogMessage = 'Diese Datei ist bereits vorhanden',\n fileMinWidth = 100,\n files,\n maxFiles,\n onAdd,\n onFileCountChange,\n onRemove,\n },\n ref,\n ) => {\n const [fileItems, setFileItems] = useState<InternalFileItem[]>(() =>\n mapFilesToInternalItems(files),\n );\n\n const handleClear = useCallback(() => {\n setFileItems([]);\n }, []);\n\n const handlePreviewUrlCallback = useCallback(\n (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 );\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(\n 0,\n Math.max(maxFiles - fileItems.length, 0),\n );\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 useImperativeHandle(\n ref,\n () => ({\n clear: handleClear,\n }),\n [handleClear],\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 [\n ...items,\n <AddFile key=\"add_file\" addFileIcon={addFileIcon} onAdd={handleAddFiles} />,\n ];\n }, [addFileIcon, 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);\n\nGalleryEditor.displayName = 'GalleryEditor';\n\nexport default GalleryEditor;\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAOA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AASA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,cAAA,GAAAV,OAAA;AAAsF,SAAAQ,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAZ,uBAAA,YAAAA,CAAAQ,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,GAAAO,CAAA,CAAAM,GAAA,CAAAb,CAAA,EAAAS,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,OAAOiC,KAAK;IAChB;IAEA,OAAO,CACH,GAAGA,KAAK,eACRpH,MAAA,CAAAW,OAAA,CAAA0G,aAAA,CAAChH,QAAA,CAAAM,OAAO;MAAC2G,GAAG,EAAC,UAAU;MAACvF,WAAW,EAAEA,WAAY;MAACK,KAAK,EAAEmC;IAAe,CAAE,CAAC,CAC9E;EACL,CAAC,EAAE,CAACxC,WAAW,EAAES,SAAS,EAAE+B,cAAc,EAAEa,gBAAgB,EAAES,eAAe,EAAE1D,QAAQ,CAAC,CAAC;EAEzF,oBACInC,MAAA,CAAAW,OAAA,CAAA0G,aAAA,CAAC7G,cAAA,CAAAiH,mBAAmB,qBAChBzH,MAAA,CAAAW,OAAA,CAAA0G,aAAA,CAAC7G,cAAA,CAAAkH,uBAAuB;IACpBC,aAAa,EAAE1F,YAAa;IAC5B2F,UAAU,EAAGpC,KAAK,IAAKA,KAAK,CAACC,cAAc,CAAC,CAAE;IAC9CoC,MAAM,EAAGrC,KAAK,IAAK,KAAKD,UAAU,CAACC,KAAK;EAAE,GAEzC0B,YACoB,CACR,CAAC;AAE9B,CACJ,CAAC;AAEDtF,aAAa,CAACkG,WAAW,GAAG,eAAe;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAArH,OAAA,GAE7BiB,aAAa","ignoreList":[]}
1
+ {"version":3,"file":"GalleryEditor.js","names":["_react","require","_react2","_interopRequireWildcard","_AddFile","_interopRequireDefault","_GalleryEditor","_GalleryEditorItem","_GalleryEditor2","_useGalleryEditorState","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GalleryEditor","forwardRef","allowDragAndDrop","addFileIcon","doubleFileDialogMessage","fileMinWidth","files","maxFiles","onAdd","onFileCountChange","onRemove","shouldLoadImages","ref","fileItems","handleAddFiles","handleClear","handleDeleteFile","handleDrop","handleOpenFiles","useGalleryEditorState","useImperativeHandle","clear","shouldShowAddFileTile","length","createElement","StyledGalleryEditor","StyledGalleryEditorGrid","$fileMinWidth","$gap","GALLERY_EDITOR_GRID_GAP_PX","onDragOver","event","preventDefault","onDrop","AnimatePresence","initial","map","file","key","id","fileItem","onClick","displayName","_default","exports"],"sources":["../../../../src/components/gallery-editor/GalleryEditor.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, { forwardRef, useImperativeHandle } from 'react';\nimport AddFile from './add-file/AddFile';\nimport { StyledGalleryEditor, StyledGalleryEditorGrid } from './GalleryEditor.styles';\nimport type { GalleryEditorProps, GalleryEditorRef } from './GalleryEditor.types';\nimport GalleryEditorItem from './gallery-editor-item/GalleryEditorItem';\nimport { GALLERY_EDITOR_GRID_GAP_PX } from './GalleryEditor.constants';\nimport useGalleryEditorState from './useGalleryEditorState';\n\nconst GalleryEditor = forwardRef<GalleryEditorRef, GalleryEditorProps>(\n (\n {\n allowDragAndDrop = false,\n addFileIcon = 'fa fa-plus',\n doubleFileDialogMessage = 'Diese Datei ist bereits vorhanden',\n fileMinWidth = 100,\n files,\n maxFiles,\n onAdd,\n onFileCountChange,\n onRemove,\n shouldLoadImages = true,\n },\n ref,\n ) => {\n const {\n fileItems,\n handleAddFiles,\n handleClear,\n handleDeleteFile,\n handleDrop,\n handleOpenFiles,\n } = useGalleryEditorState({\n allowDragAndDrop,\n doubleFileDialogMessage,\n files,\n maxFiles,\n onAdd,\n onFileCountChange,\n onRemove,\n });\n\n useImperativeHandle(\n ref,\n () => ({\n clear: handleClear,\n }),\n [handleClear],\n );\n\n const shouldShowAddFileTile = !maxFiles || maxFiles > fileItems.length;\n\n return (\n <StyledGalleryEditor>\n <StyledGalleryEditorGrid\n $fileMinWidth={fileMinWidth}\n $gap={GALLERY_EDITOR_GRID_GAP_PX}\n onDragOver={(event) => event.preventDefault()}\n onDrop={(event) => void handleDrop(event)}\n >\n <AnimatePresence initial={false}>\n {fileItems.map((file) => (\n <GalleryEditorItem\n key={file.id}\n fileItem={file}\n handleDeleteFile={handleDeleteFile}\n onClick={handleOpenFiles}\n shouldLoadImages={shouldLoadImages}\n />\n ))}\n </AnimatePresence>\n\n {shouldShowAddFileTile && (\n <AddFile addFileIcon={addFileIcon} onAdd={handleAddFiles} />\n )}\n </StyledGalleryEditorGrid>\n </StyledGalleryEditor>\n );\n },\n);\n\nGalleryEditor.displayName = 'GalleryEditor';\n\nexport default GalleryEditor;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AAEA,IAAAM,kBAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,sBAAA,GAAAJ,sBAAA,CAAAJ,OAAA;AAA4D,SAAAI,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,CAAAO,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,GAAAO,CAAA,CAAAM,GAAA,CAAAb,CAAA,EAAAS,CAAA,gBAAAN,CAAA,IAAAH,CAAA,gBAAAG,CAAA,OAAAW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,YAAa;IAC5BuB,IAAI,EAAEC,0CAA2B;IACjCC,UAAU,EAAGC,KAAK,IAAKA,KAAK,CAACC,cAAc,CAAC,CAAE;IAC9CC,MAAM,EAAGF,KAAK,IAAK,KAAKd,UAAU,CAACc,KAAK;EAAE,gBAE1C1D,OAAA,CAAAU,OAAA,CAAAyC,aAAA,CAACrD,MAAA,CAAA+D,eAAe;IAACC,OAAO,EAAE;EAAM,GAC3BtB,SAAS,CAACuB,GAAG,CAAEC,IAAI,iBAChBhE,OAAA,CAAAU,OAAA,CAAAyC,aAAA,CAAC9C,kBAAA,CAAAK,OAAiB;IACduD,GAAG,EAAED,IAAI,CAACE,EAAG;IACbC,QAAQ,EAAEH,IAAK;IACfrB,gBAAgB,EAAEA,gBAAiB;IACnCyB,OAAO,EAAEvB,eAAgB;IACzBP,gBAAgB,EAAEA;EAAiB,CACtC,CACJ,CACY,CAAC,EAEjBW,qBAAqB,iBAClBjD,OAAA,CAAAU,OAAA,CAAAyC,aAAA,CAACjD,QAAA,CAAAQ,OAAO;IAACoB,WAAW,EAAEA,WAAY;IAACK,KAAK,EAAEM;EAAe,CAAE,CAE1C,CACR,CAAC;AAE9B,CACJ,CAAC;AAEDd,aAAa,CAAC0C,WAAW,GAAG,eAAe;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA7D,OAAA,GAE7BiB,aAAa","ignoreList":[]}
@@ -15,6 +15,8 @@ const StyledGalleryEditorGrid = exports.StyledGalleryEditorGrid = _styledCompone
15
15
  $fileMinWidth
16
16
  }) => `repeat(auto-fill, minmax(${$fileMinWidth}px, 1fr))`};
17
17
  grid-auto-rows: 1fr;
18
- gap: 6px;
18
+ gap: ${({
19
+ $gap
20
+ }) => `${$gap}px`};
19
21
  `;
20
22
  //# sourceMappingURL=GalleryEditor.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GalleryEditor.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledGalleryEditor","exports","styled","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,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhC,MAAMG,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAGE,yBAAM,CAACC,GAAG;AAC7C;AACA,CAAC;AAEM,MAAMC,uBAAuB,GAAAH,OAAA,CAAAG,uBAAA,GAAGF,yBAAM,CAACC,GAE5C;AACF;AACA,6BAA6B,CAAC;EAAEE;AAAc,CAAC,KACvC,4BAA4BA,aAAa,WAAW;AAC5D;AACA;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"GalleryEditor.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledGalleryEditor","exports","styled","div","StyledGalleryEditorGrid","$fileMinWidth","$gap"],"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 $gap: number;\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: ${({ $gap }) => `${$gap}px`};\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhC,MAAMG,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAGE,yBAAM,CAACC,GAAG;AAC7C;AACA,CAAC;AAEM,MAAMC,uBAAuB,GAAAH,OAAA,CAAAG,uBAAA,GAAGF,yBAAM,CAACC,GAG5C;AACF;AACA,6BAA6B,CAAC;EAAEE;AAAc,CAAC,KACvC,4BAA4BA,aAAa,WAAW;AAC5D;AACA,WAAW,CAAC;EAAEC;AAAK,CAAC,KAAK,GAAGA,IAAI,IAAI;AACpC,CAAC","ignoreList":[]}
@@ -1 +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';\nimport type { GalleryRef } from '../Gallery.types';\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 * Defines the icon that is shown in the add-file tile.\n * @description\n * The editor renders this icon inside the tile that opens the file picker for adding more items.\n * @default 'fa fa-plus'\n * @example\n * <GalleryEditor addFileIcon=\"fa fa-image-circle-plus\" files={files} />\n * @optional\n */\n addFileIcon?: string;\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\nexport type GalleryEditorRef = GalleryRef;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"GalleryEditor.types.js","names":[],"sources":["../../../../src/components/gallery-editor/GalleryEditor.types.ts"],"sourcesContent":["import type { FileItem } from '@chayns-components/core';\nimport type { GalleryRef } from '../Gallery.types';\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 * Defines the icon that is shown in the add-file tile.\n * @description\n * The editor renders this icon inside the tile that opens the file picker for adding more items.\n * @default 'fa fa-plus'\n * @example\n * <GalleryEditor addFileIcon=\"fa fa-image-circle-plus\" files={files} />\n * @optional\n */\n addFileIcon?: string;\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 * Controls whether the editor may load the final media assets immediately.\n * @description\n * When set to `true`, the editor behaves like the current implementation and loads the final media immediately.\n * When set to `false`, uploaded media keeps rendering previews first and delays the final image load until this flag becomes `true`.\n * @default true\n * @example\n * <GalleryEditor files={files} shouldLoadImages={false} />\n * @optional\n */\n shouldLoadImages?: boolean;\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\nexport type GalleryEditorRef = GalleryRef;\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.mergeExternalFilesWithInternalState = exports.mapExternalFilesIntoInternalItems = exports.getPendingUploadFileItems = exports.getPendingPreviewFileItems = void 0;
7
+ const mapExternalFilesIntoInternalItems = files => (files ?? []).map((file, index) => ({
8
+ id: file.id ?? file.file.id ?? file.file.url ?? `gallery-item-${index}`,
9
+ uploadedFile: file.file,
10
+ file: undefined,
11
+ state: 'uploaded',
12
+ previewUrl: undefined
13
+ }));
14
+ exports.mapExternalFilesIntoInternalItems = mapExternalFilesIntoInternalItems;
15
+ const mergeExternalFilesWithInternalState = (internalItems, externalItems) => {
16
+ const mergedItems = internalItems.map(prevItem => {
17
+ const matchingItem = externalItems.find(item => item.uploadedFile && prevItem.uploadedFile && item.uploadedFile.url === prevItem.uploadedFile.url);
18
+ return matchingItem || prevItem;
19
+ });
20
+ return mergedItems.concat(externalItems.filter(newItem => !internalItems.some(prevItem => prevItem.uploadedFile && newItem.uploadedFile && prevItem.uploadedFile.url === newItem.uploadedFile.url)));
21
+ };
22
+ exports.mergeExternalFilesWithInternalState = mergeExternalFilesWithInternalState;
23
+ const getPendingPreviewFileItems = fileItems => fileItems.filter(file => file.file && !file.previewUrl && (file.state === 'none' || !file.state));
24
+ exports.getPendingPreviewFileItems = getPendingPreviewFileItems;
25
+ const getPendingUploadFileItems = fileItems => fileItems.filter(file => file.file && !file.uploadedFile && file.state !== 'uploading');
26
+ exports.getPendingUploadFileItems = getPendingUploadFileItems;
27
+ //# sourceMappingURL=GalleryEditor.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GalleryEditor.utils.js","names":["mapExternalFilesIntoInternalItems","files","map","file","index","id","url","uploadedFile","undefined","state","previewUrl","exports","mergeExternalFilesWithInternalState","internalItems","externalItems","mergedItems","prevItem","matchingItem","find","item","concat","filter","newItem","some","getPendingPreviewFileItems","fileItems","getPendingUploadFileItems"],"sources":["../../../../src/components/gallery-editor/GalleryEditor.utils.ts"],"sourcesContent":["import type { FileItem, InternalFileItem } from '@chayns-components/core';\n\nexport const mapExternalFilesIntoInternalItems = (files?: FileItem[]): InternalFileItem[] =>\n (files ?? []).map((file, index) => ({\n id: file.id ?? file.file.id ?? file.file.url ?? `gallery-item-${index}`,\n uploadedFile: file.file,\n file: undefined,\n state: 'uploaded',\n previewUrl: undefined,\n }));\n\nexport const mergeExternalFilesWithInternalState = (\n internalItems: InternalFileItem[],\n externalItems: InternalFileItem[],\n): InternalFileItem[] => {\n const mergedItems = internalItems.map((prevItem) => {\n const matchingItem = externalItems.find(\n (item) =>\n item.uploadedFile &&\n prevItem.uploadedFile &&\n item.uploadedFile.url === prevItem.uploadedFile.url,\n );\n\n return matchingItem || prevItem;\n });\n\n return mergedItems.concat(\n externalItems.filter(\n (newItem) =>\n !internalItems.some(\n (prevItem) =>\n prevItem.uploadedFile &&\n newItem.uploadedFile &&\n prevItem.uploadedFile.url === newItem.uploadedFile.url,\n ),\n ),\n );\n};\n\nexport const getPendingPreviewFileItems = (fileItems: InternalFileItem[]) =>\n fileItems.filter(\n (file) => file.file && !file.previewUrl && (file.state === 'none' || !file.state),\n );\n\nexport const getPendingUploadFileItems = (fileItems: InternalFileItem[]) =>\n fileItems.filter((file) => file.file && !file.uploadedFile && file.state !== 'uploading');\n"],"mappings":";;;;;;AAEO,MAAMA,iCAAiC,GAAIC,KAAkB,IAChE,CAACA,KAAK,IAAI,EAAE,EAAEC,GAAG,CAAC,CAACC,IAAI,EAAEC,KAAK,MAAM;EAChCC,EAAE,EA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AAEC,MAAME,yBAAyB,GAAID,SAA6B,IACnEA,SAAS,CAACJ,MAAM,CAAElB,IAAI,IAAKA,IAAI,CAACA,IAAI,IAAI,CAACA,IAAI,CAACI,YAAY,IAAIJ,IAAI,CAACM,KAAK,KAAK,WAAW,CAAC;AAACE,OAAA,CAAAe,yBAAA,GAAAA,yBAAA","ignoreList":[]}
@@ -29,5 +29,5 @@ const AddFile = ({
29
29
  })));
30
30
  };
31
31
  AddFile.displayName = 'AddFile';
32
- var _default = exports.default = AddFile;
32
+ var _default = exports.default = /*#__PURE__*/(0, _react.memo)(AddFile);
33
33
  //# sourceMappingURL=AddFile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AddFile.js","names":["_core","require","_react","_interopRequireWildcard","_AddFile","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","AddFile","addFileIcon","onAdd","openSelectDialog","useCallback","files","selectFiles","multiple","type","createElement","StyledAddFile","key","StyledAddFIleIconWrapper","onClick","Icon","size","icons","displayName","_default","exports"],"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> = ({ addFileIcon = 'fa fa-plus', 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={[addFileIcon]} />\n </StyledAddFIleIconWrapper>\n </StyledAddFile>\n );\n};\n\nAddFile.displayName = 'AddFile';\n\nexport default AddFile;\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,O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BC,QAAQ,EAAE,IAAI;MACdC,IAAI,EAAE;IACV,CAAC,CAAC;IAEFN,KAAK,CAACG,KAAK,CAAC;EAChB,CAAC,EAAE,CAACH,KAAK,CAAC,CAAC;EAEX,oBACIxB,MAAA,CAAAa,OAAA,CAAAkB,aAAA,CAAC7B,QAAA,CAAA8B,aAAa;IAACC,GAAG,EAAC;EAAW,gBAC1BjC,MAAA,CAAAa,OAAA,CAAAkB,aAAA,CAAC7B,QAAA,CAAAgC,wBAAwB;IAACC,OAAO,EAAEA,CAAA,KAAM,KAAKV,gBAAgB,CAAC;EAAE,gBAC7DzB,MAAA,CAAAa,OAAA,CAAAkB,aAAA,CAACjC,KAAA,CAAAsC,IAAI;IAACC,IAAI,EAAE,EAAG;IAACC,KAAK,EAAE,CAACf,WAAW;EAAE,CAAE,CACjB,CACf,CAAC;AAExB,CAAC;AAEDD,OAAO,CAACiB,WAAW,GAAG,SAAS;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA5B,OAAA,GAEjBS,OAAO","ignoreList":[]}
1
+ {"version":3,"file":"AddFile.js","names":["_core","require","_react","_interopRequireWildcard","_AddFile","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","AddFile","addFileIcon","onAdd","openSelectDialog","useCallback","files","selectFiles","multiple","type","createElement","StyledAddFile","key","StyledAddFIleIconWrapper","onClick","Icon","size","icons","displayName","_default","exports","memo"],"sources":["../../../../../src/components/gallery-editor/add-file/AddFile.tsx"],"sourcesContent":["import { Icon, selectFiles } from '@chayns-components/core';\nimport React, { FC, memo, useCallback } from 'react';\nimport { StyledAddFile, StyledAddFIleIconWrapper } from './AddFile.styles';\nimport type { AddFileProps } from './AddFile.types';\n\nconst AddFile: FC<AddFileProps> = ({ addFileIcon = 'fa fa-plus', 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={[addFileIcon]} />\n </StyledAddFIleIconWrapper>\n </StyledAddFile>\n );\n};\n\nAddFile.displayName = 'AddFile';\n\nexport default memo(AddFile);\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAA2E,SAAAE,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAG3E,MAAMkB,OAAyB,GAAGA,CAAC;EAAEC,WAAW,GAAG,YAAY;EAAEC;AAAM,CAAC,KAAK;EACzE,MAAMC,gBAAgB,GAAG,IAAAC,kBAAW,EAAC,YAAY;IAC7C,MAAMC,KAAK,GAAG,MAAM,IAAAC,iBAAW,EAAC;MAC5BC,QAAQ,EAAE,IAAI;MACdC,IAAI,EAAE;IACV,CAAC,CAAC;IAEFN,KAAK,CAACG,KAAK,CAAC;EAChB,CAAC,EAAE,CAACH,KAAK,CAAC,CAAC;EAEX,oBACIxB,MAAA,CAAAa,OAAA,CAAAkB,aAAA,CAAC7B,QAAA,CAAA8B,aAAa;IAACC,GAAG,EAAC;EAAW,gBAC1BjC,MAAA,CAAAa,OAAA,CAAAkB,aAAA,CAAC7B,QAAA,CAAAgC,wBAAwB;IAACC,OAAO,EAAEA,CAAA,KAAM,KAAKV,gBAAgB,CAAC;EAAE,gBAC7DzB,MAAA,CAAAa,OAAA,CAAAkB,aAAA,CAACjC,KAAA,CAAAsC,IAAI;IAACC,IAAI,EAAE,EAAG;IAACC,KAAK,EAAE,CAACf,WAAW;EAAE,CAAE,CACjB,CACf,CAAC;AAExB,CAAC;AAEDD,OAAO,CAACiB,WAAW,GAAG,SAAS;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA5B,OAAA,gBAEjB,IAAA6B,WAAI,EAACpB,OAAO,CAAC","ignoreList":[]}
@@ -5,37 +5,66 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _core = require("@chayns-components/core");
8
- var _react = require("motion/react");
9
- var _react2 = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
10
9
  var _GalleryEditorItem = require("./GalleryEditorItem.styles");
11
10
  var _GalleryEditorMediaItem = _interopRequireDefault(require("./gallery-editor-media-item/GalleryEditorMediaItem"));
12
11
  var _GalleryEditorPreviewItem = _interopRequireDefault(require("./gallery-editor-preview-item/GalleryEditorPreviewItem"));
12
+ var _GalleryEditor = require("../GalleryEditor.constants");
13
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
15
  const GalleryEditorItem = ({
15
16
  fileItem,
16
17
  handleDeleteFile,
18
+ shouldLoadImages = true,
17
19
  ratio = 1,
18
20
  onClick
19
21
  }) => {
20
- const mediaContent = !fileItem.state || fileItem.state === 'none' || !fileItem.previewUrl && !fileItem.uploadedFile ? null : fileItem.state === 'uploading' ? /*#__PURE__*/_react2.default.createElement(_GalleryEditorPreviewItem.default, {
21
- ratio: ratio,
22
- key: `uploading_${fileItem.id ?? ''}`,
23
- fileItem: fileItem
24
- }) : /*#__PURE__*/_react2.default.createElement(_GalleryEditorMediaItem.default, {
25
- key: `uploaded_${fileItem.id ?? ''}`,
26
- fileItem: fileItem,
27
- ratio: ratio,
28
- openSelectedFile: onClick
29
- });
30
- return /*#__PURE__*/_react2.default.createElement(_GalleryEditorItem.StyledGalleryEditorItem, null, /*#__PURE__*/_react2.default.createElement(_GalleryEditorItem.StyledGalleryEditorItemDeleteButton, {
31
- onClick: () => handleDeleteFile(fileItem.id)
32
- }, /*#__PURE__*/_react2.default.createElement(_core.Icon, {
22
+ const shouldRenderPreview = fileItem.state === 'uploading';
23
+ const shouldRenderMedia = fileItem.state !== 'none' && (Boolean(fileItem.previewUrl) || Boolean(fileItem.uploadedFile));
24
+ let mediaContent = null;
25
+ if (shouldRenderPreview) {
26
+ mediaContent = /*#__PURE__*/_react.default.createElement(_GalleryEditorPreviewItem.default, {
27
+ ratio: ratio,
28
+ fileItem: fileItem
29
+ });
30
+ } else if (shouldRenderMedia) {
31
+ mediaContent = /*#__PURE__*/_react.default.createElement(_GalleryEditorMediaItem.default, {
32
+ fileItem: fileItem,
33
+ ratio: ratio,
34
+ openSelectedFile: onClick,
35
+ previewUrl: fileItem.previewUrl,
36
+ shouldLoadImages: shouldLoadImages
37
+ });
38
+ }
39
+ return /*#__PURE__*/_react.default.createElement(_GalleryEditorItem.StyledMotionGalleryEditorItem, {
40
+ initial: {
41
+ opacity: 0,
42
+ scale: 0.98
43
+ },
44
+ animate: {
45
+ opacity: 1,
46
+ scale: 1
47
+ },
48
+ exit: {
49
+ opacity: 0,
50
+ scale: 0.98
51
+ },
52
+ transition: {
53
+ duration: _GalleryEditor.GALLERY_EDITOR_ITEM_FADE_DURATION_S
54
+ }
55
+ }, mediaContent, /*#__PURE__*/_react.default.createElement(_GalleryEditorItem.StyledGalleryEditorItemDeleteButton, {
56
+ type: "button",
57
+ onClick: event => {
58
+ event.stopPropagation();
59
+ handleDeleteFile(fileItem.id);
60
+ },
61
+ $zIndex: _GalleryEditor.GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX,
62
+ "aria-label": "Bild entfernen"
63
+ }, /*#__PURE__*/_react.default.createElement(_core.Icon, {
33
64
  size: 20,
34
65
  icons: ['ts-wrong']
35
- })), /*#__PURE__*/_react2.default.createElement(_react.AnimatePresence, {
36
- initial: false
37
- }, mediaContent));
66
+ })));
38
67
  };
39
68
  GalleryEditorItem.displayName = 'GalleryEditorItem';
40
- var _default = exports.default = GalleryEditorItem;
69
+ var _default = exports.default = /*#__PURE__*/(0, _react.memo)(GalleryEditorItem);
41
70
  //# sourceMappingURL=GalleryEditorItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GalleryEditorItem.js","names":["_core","require","_react","_react2","_interopRequireDefault","_GalleryEditorItem","_GalleryEditorMediaItem","_GalleryEditorPreviewItem","e","__esModule","default","GalleryEditorItem","fileItem","handleDeleteFile","ratio","onClick","mediaContent","state","previewUrl","uploadedFile","createElement","key","id","openSelectedFile","StyledGalleryEditorItem","StyledGalleryEditorItemDeleteButton","Icon","size","icons","AnimatePresence","initial","displayName","_default","exports"],"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,IAAAA,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,EAAEA,CAAA,KAAMF,gBAAgB,CAACD,QAAQ,CAACU,EAAE;EAAE,gBAC9EnB,OAAA,CAAAO,OAAA,CAAAU,aAAA,CAACpB,KAAA,CAAA0B,IAAI;IAACC,IAAI,EAAE,EAAG;IAACC,KAAK,EAAE,CAAC,UAAU;EAAE,CAAE,CACL,CAAC,eACtCzB,OAAA,CAAAO,OAAA,CAAAU,aAAA,CAAClB,MAAA,CAAA2B,eAAe;IAACC,OAAO,EAAE;EAAM,GAAEd,YAA8B,CAC3C,CAAC;AAElC,CAAC;AAEDL,iBAAiB,CAACoB,WAAW,GAAG,mBAAmB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAvB,OAAA,GAErCC,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"GalleryEditorItem.js","names":["_core","require","_react","_interopRequireWildcard","_GalleryEditorItem","_GalleryEditorMediaItem","_interopRequireDefault","_GalleryEditorPreviewItem","_GalleryEditor","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GalleryEditorItem","fileItem","handleDeleteFile","shouldLoadImages","ratio","onClick","shouldRenderPreview","state","shouldRenderMedia","Boolean","previewUrl","uploadedFile","mediaContent","createElement","openSelectedFile","StyledMotionGalleryEditorItem","initial","opacity","scale","animate","exit","transition","duration","GALLERY_EDITOR_ITEM_FADE_DURATION_S","StyledGalleryEditorItemDeleteButton","type","event","stopPropagation","id","$zIndex","GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX","Icon","size","icons","displayName","_default","exports","memo"],"sources":["../../../../../src/components/gallery-editor/gallery-editor-item/GalleryEditorItem.tsx"],"sourcesContent":["import { Icon } from '@chayns-components/core';\nimport React, { FC, ReactNode, memo } from 'react';\nimport {\n StyledMotionGalleryEditorItem,\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';\nimport {\n GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX,\n GALLERY_EDITOR_ITEM_FADE_DURATION_S,\n} from '../GalleryEditor.constants';\n\nconst GalleryEditorItem: FC<GalleryEditorItemProps> = ({\n fileItem,\n handleDeleteFile,\n shouldLoadImages = true,\n ratio = 1,\n onClick,\n}) => {\n const shouldRenderPreview = fileItem.state === 'uploading';\n const shouldRenderMedia =\n fileItem.state !== 'none' &&\n (Boolean(fileItem.previewUrl) || Boolean(fileItem.uploadedFile));\n\n let mediaContent: ReactNode = null;\n\n if (shouldRenderPreview) {\n mediaContent = <GalleryEditorPreviewItem ratio={ratio} fileItem={fileItem} />;\n } else if (shouldRenderMedia) {\n mediaContent = (\n <GalleryEditorMediaItem\n fileItem={fileItem}\n ratio={ratio}\n openSelectedFile={onClick}\n previewUrl={fileItem.previewUrl}\n shouldLoadImages={shouldLoadImages}\n />\n );\n }\n\n return (\n <StyledMotionGalleryEditorItem\n initial={{ opacity: 0, scale: 0.98 }}\n animate={{ opacity: 1, scale: 1 }}\n exit={{ opacity: 0, scale: 0.98 }}\n transition={{ duration: GALLERY_EDITOR_ITEM_FADE_DURATION_S }}\n >\n {mediaContent}\n <StyledGalleryEditorItemDeleteButton\n type=\"button\"\n onClick={(event) => {\n event.stopPropagation();\n handleDeleteFile(fileItem.id);\n }}\n $zIndex={GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX}\n aria-label=\"Bild entfernen\"\n >\n <Icon size={20} icons={['ts-wrong']} />\n </StyledGalleryEditorItemDeleteButton>\n </StyledMotionGalleryEditorItem>\n );\n};\n\nGalleryEditorItem.displayName = 'GalleryEditorItem';\n\nexport default memo(GalleryEditorItem);\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG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AS,OAAA,CAAA8B,aAAA,CAACrC,kBAAA,CAAAgD,mCAAmC;IAChCC,IAAI,EAAC,QAAQ;IACbpB,OAAO,EAAGqB,KAAK,IAAK;MAChBA,KAAK,CAACC,eAAe,CAAC,CAAC;MACvBzB,gBAAgB,CAACD,QAAQ,CAAC2B,EAAE,CAAC;IACjC,CAAE;IACFC,OAAO,EAAEC,mDAAqC;IAC9C,cAAW;EAAgB,gBAE3BxD,MAAA,CAAAS,OAAA,CAAA8B,aAAA,CAACzC,KAAA,CAAA2D,IAAI;IAACC,IAAI,EAAE,EAAG;IAACC,KAAK,EAAE,CAAC,UAAU;EAAE,CAAE,CACL,CACV,CAAC;AAExC,CAAC;AAEDjC,iBAAiB,CAACkC,WAAW,GAAG,mBAAmB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAArD,OAAA,gBAErC,IAAAsD,WAAI,EAACrC,iBAAiB,CAAC","ignoreList":[]}
@@ -3,14 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.StyledGalleryEditorItemDeleteButton = exports.StyledGalleryEditorItem = void 0;
6
+ exports.StyledMotionGalleryEditorItem = exports.StyledGalleryEditorItemDeleteButton = void 0;
7
+ var _react = require("motion/react");
7
8
  var _styledComponents = _interopRequireDefault(require("styled-components"));
8
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- const StyledGalleryEditorItem = exports.StyledGalleryEditorItem = _styledComponents.default.div`
10
+ const StyledMotionGalleryEditorItem = exports.StyledMotionGalleryEditorItem = (0, _styledComponents.default)(_react.motion.div)`
10
11
  display: flex;
11
12
  position: relative;
12
13
  height: 100%;
13
14
  width: 100%;
15
+ overflow: hidden;
14
16
  `;
15
17
  const StyledGalleryEditorItemDeleteButton = exports.StyledGalleryEditorItemDeleteButton = _styledComponents.default.button`
16
18
  background-color: rgba(
@@ -27,9 +29,14 @@ const StyledGalleryEditorItemDeleteButton = exports.StyledGalleryEditorItemDelet
27
29
  position: absolute;
28
30
  top: 0;
29
31
  right: 0;
30
- z-index: 2;
32
+ z-index: ${({
33
+ $zIndex
34
+ }) => $zIndex};
31
35
  height: 30px;
32
36
  width: 30px;
37
+ border: 0;
38
+ padding: 0;
39
+ cursor: pointer;
33
40
  display: flex;
34
41
  justify-content: center;
35
42
  align-items: center;
@@ -1 +1 @@
1
- {"version":3,"file":"GalleryEditorItem.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledGalleryEditorItem","exports","styled","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,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhC,MAAMG,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAGE,yBAAM,CAACC,GAAG;AACjD;AACA;AACA;AACA;AACA,CAAC;AAIM,MAAMC,mCAAmC,GAAAH,OAAA,CAAAG,mCAAA,GAAGF,yBAAM,CAACG,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":[]}
1
+ {"version":3,"file":"GalleryEditorItem.styles.js","names":["_react","require","_styledComponents","_interopRequireDefault","e","__esModule","default","StyledMotionGalleryEditorItem","exports","styled","motion","div","StyledGalleryEditorItemDeleteButton","button","theme","$zIndex"],"sources":["../../../../../src/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport { motion } from 'motion/react';\nimport styled from 'styled-components';\n\nexport const StyledMotionGalleryEditorItem = styled(motion.div)`\n display: flex;\n position: relative;\n height: 100%;\n width: 100%;\n overflow: hidden;\n`;\n\ntype StyledGalleryEditorItemDeleteButtonProps = WithTheme<unknown>;\n\nexport const StyledGalleryEditorItemDeleteButton = styled.button<\n StyledGalleryEditorItemDeleteButtonProps & {\n $zIndex: number;\n }\n>`\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: ${({ $zIndex }) => $zIndex};\n height: 30px;\n width: 30px;\n border: 0;\n padding: 0;\n cursor: pointer;\n display: flex;\n justify-content: center;\n align-items: center;\n`;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAuC,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhC,MAAMG,6BAA6B,GAAAC,OAAA,CAAAD,6BAAA,GAAG,IAAAE,yBAAM,EAACC,aAAM,CAACC,GAAG,CAAC;AAC/D;AACA;AACA;AACA;AACA;AACA,CAAC;AAIM,MAAMC,mCAAmC,GAAAJ,OAAA,CAAAI,mCAAA,GAAGH,yBAAM,CAACI,MAIzD;AACD;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,eAAe,CAAC;EAAEC;AAAQ,CAAC,KAAKA,OAAO;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -1 +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":[]}
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 * Controls whether the item may load the final media source immediately.\n * @description\n * The item forwards this flag to the shared media renderer so uploaded media can stay on the preview until loading is allowed.\n * @default true\n * @optional\n */\n shouldLoadImages?: boolean;\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":[]}
@@ -4,13 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
7
+ var _react = _interopRequireWildcard(require("react"));
8
8
  var _MediaContent = _interopRequireDefault(require("../../../media-content/MediaContent"));
9
9
  var _GalleryEditorMediaItem = require("./GalleryEditorMediaItem.styles");
10
+ var _GalleryEditor = require("../../GalleryEditor.constants");
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
13
  const GalleryEditorMediaItem = ({
12
14
  fileItem,
13
15
  openSelectedFile,
16
+ previewUrl,
17
+ shouldLoadImages = true,
14
18
  ratio
15
19
  }) => /*#__PURE__*/_react.default.createElement(_GalleryEditorMediaItem.StyledMotionGalleryEditorMediaItem, {
16
20
  animate: {
@@ -23,14 +27,16 @@ const GalleryEditorMediaItem = ({
23
27
  opacity: 0
24
28
  },
25
29
  transition: {
26
- duration: 3.2
30
+ duration: _GalleryEditor.GALLERY_EDITOR_MEDIA_FADE_DURATION_S
27
31
  }
28
32
  }, fileItem.uploadedFile && /*#__PURE__*/_react.default.createElement(_MediaContent.default, {
29
33
  file: fileItem.uploadedFile,
30
34
  onClick: () => openSelectedFile(fileItem),
31
35
  playIconSize: 30,
32
- ratio: ratio
36
+ previewUrl: previewUrl,
37
+ ratio: ratio,
38
+ shouldLoadImages: shouldLoadImages
33
39
  }));
34
40
  GalleryEditorMediaItem.displayName = 'GalleryEditorMediaItem';
35
- var _default = exports.default = GalleryEditorMediaItem;
41
+ var _default = exports.default = /*#__PURE__*/(0, _react.memo)(GalleryEditorMediaItem);
36
42
  //# sourceMappingURL=GalleryEditorMediaItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GalleryEditorMediaItem.js","names":["_react","_interopRequireDefault","require","_MediaContent","_GalleryEditorMediaItem","e","__esModule","default","GalleryEditorMediaItem","fileItem","openSelectedFile","ratio","createElement","StyledMotionGalleryEditorMediaItem","animate","opacity","initial","exit","transition","duration","uploadedFile","file","onClick","playIconSize","displayName","_default","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,uBAAA,GAAAF,OAAA;AAAqF,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGrF,MAAMG,sBAAuD,GAAGA,CAAC;EAC7DC,QAAQ;EACRC,gBAAgB;EAChBC;AACJ,CAAC,kBACGX,MAAA,CAAAO,OAAA,CAAAK,aAAA,CAACR,uBAAA,CAAAS,kCAAkC;EAC/BC,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,GAE7BV,QAAQ,CAACW,YAAY,iBAClBpB,MAAA,CAAAO,OAAA,CAAAK,aAAA,CAACT,aAAA,CAAAI,OAAY;EACTc,IAAI,EAAEZ,QAAQ,CAACW,YAAa;EAC5BE,OAAO,EAAEA,CAAA,KAAMZ,gBAAgB,CAACD,QAAQ,CAAE;EAC1Cc,YAAY,EAAE,EAAG;EACjBZ,KAAK,EAAEA;AAAM,CAChB,CAE2B,CACvC;AAEDH,sBAAsB,CAACgB,WAAW,GAAG,wBAAwB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAnB,OAAA,GAE/CC,sBAAsB","ignoreList":[]}
1
+ {"version":3,"file":"GalleryEditorMediaItem.js","names":["_react","_interopRequireWildcard","require","_MediaContent","_interopRequireDefault","_GalleryEditorMediaItem","_GalleryEditor","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GalleryEditorMediaItem","fileItem","openSelectedFile","previewUrl","shouldLoadImages","ratio","createElement","StyledMotionGalleryEditorMediaItem","animate","opacity","initial","exit","transition","duration","GALLERY_EDITOR_MEDIA_FADE_DURATION_S","uploadedFile","file","onClick","playIconSize","displayName","_default","exports","memo"],"sources":["../../../../../../src/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.tsx"],"sourcesContent":["import React, { FC, memo } from 'react';\nimport MediaContent from '../../../media-content/MediaContent';\nimport { StyledMotionGalleryEditorMediaItem } from './GalleryEditorMediaItem.styles';\nimport type { GalleryEditorMediaItemProps } from './GalleryEditorMediaItem.types';\nimport { GALLERY_EDITOR_MEDIA_FADE_DURATION_S } from '../../GalleryEditor.constants';\n\nconst GalleryEditorMediaItem: FC<GalleryEditorMediaItemProps> = ({\n fileItem,\n openSelectedFile,\n previewUrl,\n shouldLoadImages = true,\n ratio,\n}) => (\n <StyledMotionGalleryEditorMediaItem\n animate={{ opacity: 1 }}\n initial={{ opacity: 0 }}\n exit={{ opacity: 0 }}\n transition={{ duration: GALLERY_EDITOR_MEDIA_FADE_DURATION_S }}\n >\n {fileItem.uploadedFile && (\n <MediaContent\n file={fileItem.uploadedFile}\n onClick={() => openSelectedFile(fileItem)}\n playIconSize={30}\n previewUrl={previewUrl}\n ratio={ratio}\n shouldLoadImages={shouldLoadImages}\n />\n )}\n </StyledMotionGalleryEditorMediaItem>\n);\n\nGalleryEditorMediaItem.displayName = 'GalleryEditorMediaItem';\n\nexport default memo(GalleryEditorMediaItem);\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,uBAAA,GAAAH,OAAA;AAEA,IAAAI,cAAA,GAAAJ,OAAA;AAAqF,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAM,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,K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C5BE,OAAO,EAAEA,CAAA,KAAMf,gBAAgB,CAACD,QAAQ,CAAE;EAC1CiB,YAAY,EAAE,EAAG;EACjBf,UAAU,EAAEA,UAAW;EACvBE,KAAK,EAAEA,KAAM;EACbD,gBAAgB,EAAEA;AAAiB,CACtC,CAE2B,CACvC;AAEDJ,sBAAsB,CAACmB,WAAW,GAAG,wBAAwB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAtC,OAAA,gBAE/C,IAAAuC,WAAI,EAACtB,sBAAsB,CAAC","ignoreList":[]}
@@ -1 +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":[]}
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 * Controls whether the media renderer may load the final uploaded source immediately.\n * @description\n * When disabled, the shared media renderer keeps showing the preview until the parent gallery allows the final load.\n * @default true\n * @optional\n */\n shouldLoadImages?: boolean;\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 * Provides an optional preview source that can be shown before the final uploaded media loads.\n * @description\n * This is typically the local base64 preview generated while the file is still being uploaded.\n * @optional\n */\n previewUrl?: string;\n}\n"],"mappings":"","ignoreList":[]}
@@ -5,9 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _core = require("@chayns-components/core");
8
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
9
  var _GalleryEditorPreviewItem = require("./GalleryEditorPreviewItem.styles");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ var _GalleryEditor = require("../../GalleryEditor.constants");
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
12
  const GalleryEditorPreviewItem = ({
12
13
  fileItem,
13
14
  ratio
@@ -19,14 +20,10 @@ const GalleryEditorPreviewItem = ({
19
20
  opacity: 0
20
21
  },
21
22
  exit: {
22
- opacity: 0,
23
- transition: {
24
- duration: 3.2,
25
- delay: 3.2
26
- }
23
+ opacity: 0
27
24
  },
28
25
  transition: {
29
- duration: 3.2
26
+ duration: _GalleryEditor.GALLERY_EDITOR_PREVIEW_FADE_DURATION_S
30
27
  },
31
28
  style: {
32
29
  position: 'absolute'
@@ -36,10 +33,10 @@ const GalleryEditorPreviewItem = ({
36
33
  }, /*#__PURE__*/_react.default.createElement(_GalleryEditorPreviewItem.StyledGalleryEditorPreviewItemLoadingIcon, null, /*#__PURE__*/_react.default.createElement(_core.SmallWaitCursor, {
37
34
  shouldHideWaitCursor: false,
38
35
  shouldHideBackground: true
39
- })), /*#__PURE__*/_react.default.createElement(_GalleryEditorPreviewItem.StyledGalleryEditorPreviewItemImage, {
36
+ })), fileItem.previewUrl && /*#__PURE__*/_react.default.createElement(_GalleryEditorPreviewItem.StyledGalleryEditorPreviewItemImage, {
40
37
  draggable: false,
41
38
  src: fileItem.previewUrl
42
39
  })));
43
40
  GalleryEditorPreviewItem.displayName = 'GalleryEditorPreviewItem';
44
- var _default = exports.default = GalleryEditorPreviewItem;
41
+ var _default = exports.default = /*#__PURE__*/(0, _react.memo)(GalleryEditorPreviewItem);
45
42
  //# sourceMappingURL=GalleryEditorPreviewItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GalleryEditorPreviewItem.js","names":["_core","require","_react","_interopRequireDefault","_GalleryEditorPreviewItem","e","__esModule","default","GalleryEditorPreviewItem","fileItem","ratio","createElement","StyledMotionGalleryEditorPreviewItem","animate","opacity","initial","exit","transition","duration","delay","style","position","StyledGalleryEditorPreviewItemImageWrapper","$ratio","StyledGalleryEditorPreviewItemLoadingIcon","SmallWaitCursor","shouldHideWaitCursor","shouldHideBackground","StyledGalleryEditorPreviewItemImage","draggable","src","previewUrl","displayName","_default","exports"],"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,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,yBAAA,GAAAH,OAAA;AAK2C,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAG3C,MAAMG,wBAA2D,GAAGA,CAAC;EAAEC,QAAQ;EAAEC;AAAM,CAAC,kBACpFR,MAAA,CAAAK,OAAA,CAAAI,aAAA,CAACP,yBAAA,CAAAQ,oCAAoC;EACjCC,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,gBAEhCnB,MAAA,CAAAK,OAAA,CAAAI,aAAA,CAACP,yBAAA,CAAAkB,0CAA0C;EAACC,MAAM,EAAEb;AAAM,gBACtDR,MAAA,CAAAK,OAAA,CAAAI,aAAA,CAACP,yBAAA,CAAAoB,yCAAyC,qBACtCtB,MAAA,CAAAK,OAAA,CAAAI,aAAA,CAACX,KAAA,CAAAyB,eAAe;EAACC,oBAAoB,EAAE,KAAM;EAACC,oBAAoB;AAAA,CAAE,CAC7B,CAAC,eAC5CzB,MAAA,CAAAK,OAAA,CAAAI,aAAA,CAACP,yBAAA,CAAAwB,mCAAmC;EAACC,SAAS,EAAE,KAAM;EAACC,GAAG,EAAErB,QAAQ,CAACsB;AAAW,CAAE,CAC1C,CACV,CACzC;AAEDvB,wBAAwB,CAACwB,WAAW,GAAG,0BAA0B;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA3B,OAAA,GAEnDC,wBAAwB","ignoreList":[]}
1
+ {"version":3,"file":"GalleryEditorPreviewItem.js","names":["_core","require","_react","_interopRequireWildcard","_GalleryEditorPreviewItem","_GalleryEditor","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GalleryEditorPreviewItem","fileItem","ratio","createElement","StyledMotionGalleryEditorPreviewItem","animate","opacity","initial","exit","transition","duration","GALLERY_EDITOR_PREVIEW_FADE_DURATION_S","style","position","StyledGalleryEditorPreviewItemImageWrapper","$ratio","StyledGalleryEditorPreviewItemLoadingIcon","SmallWaitCursor","shouldHideWaitCursor","shouldHideBackground","previewUrl","StyledGalleryEditorPreviewItemImage","draggable","src","displayName","_default","exports","memo"],"sources":["../../../../../../src/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.tsx"],"sourcesContent":["import { SmallWaitCursor } from '@chayns-components/core';\nimport React, { FC, memo } from 'react';\nimport {\n StyledGalleryEditorPreviewItemImage,\n StyledGalleryEditorPreviewItemImageWrapper,\n StyledGalleryEditorPreviewItemLoadingIcon,\n StyledMotionGalleryEditorPreviewItem,\n} from './GalleryEditorPreviewItem.styles';\nimport type { GalleryEditorPreviewItemProps } from './GalleryEditorPreviewItem.types';\nimport { GALLERY_EDITOR_PREVIEW_FADE_DURATION_S } from '../../GalleryEditor.constants';\n\nconst GalleryEditorPreviewItem: FC<GalleryEditorPreviewItemProps> = ({ fileItem, ratio }) => (\n <StyledMotionGalleryEditorPreviewItem\n animate={{ opacity: 1 }}\n initial={{ opacity: 0 }}\n exit={{ opacity: 0 }}\n transition={{ duration: GALLERY_EDITOR_PREVIEW_FADE_DURATION_S }}\n style={{ position: 'absolute' }}\n >\n <StyledGalleryEditorPreviewItemImageWrapper $ratio={ratio}>\n <StyledGalleryEditorPreviewItemLoadingIcon>\n <SmallWaitCursor shouldHideWaitCursor={false} shouldHideBackground />\n </StyledGalleryEditorPreviewItemLoadingIcon>\n {fileItem.previewUrl && (\n <StyledGalleryEditorPreviewItemImage draggable={false} src={fileItem.previewUrl} />\n )}\n </StyledGalleryEditorPreviewItemImageWrapper>\n </StyledMotionGalleryEditorP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