@chayns-components/gallery 5.2.4 → 5.2.6

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 (120) 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 +9 -5
  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 +15 -9
  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 +11 -0
  37. package/lib/cjs/components/media-content/MediaContent.constants.js.map +1 -0
  38. package/lib/cjs/components/media-content/MediaContent.js +84 -21
  39. package/lib/cjs/components/media-content/MediaContent.js.map +1 -1
  40. package/lib/cjs/components/media-content/MediaContent.styles.js +37 -6
  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 +22 -0
  44. package/lib/cjs/components/media-content/MediaContent.utils.js.map +1 -0
  45. package/lib/cjs/utils/gallery.js +2 -2
  46. package/lib/cjs/utils/gallery.js.map +1 -1
  47. package/lib/esm/components/Gallery.js +4 -1
  48. package/lib/esm/components/Gallery.js.map +1 -1
  49. package/lib/esm/components/Gallery.types.js.map +1 -1
  50. package/lib/esm/components/gallery-editor/GalleryEditor.constants.js +6 -0
  51. package/lib/esm/components/gallery-editor/GalleryEditor.constants.js.map +1 -0
  52. package/lib/esm/components/gallery-editor/GalleryEditor.js +37 -174
  53. package/lib/esm/components/gallery-editor/GalleryEditor.js.map +1 -1
  54. package/lib/esm/components/gallery-editor/GalleryEditor.styles.js +3 -1
  55. package/lib/esm/components/gallery-editor/GalleryEditor.styles.js.map +1 -1
  56. package/lib/esm/components/gallery-editor/GalleryEditor.types.js.map +1 -1
  57. package/lib/esm/components/gallery-editor/GalleryEditor.utils.js +17 -0
  58. package/lib/esm/components/gallery-editor/GalleryEditor.utils.js.map +1 -0
  59. package/lib/esm/components/gallery-editor/add-file/AddFile.js +2 -2
  60. package/lib/esm/components/gallery-editor/add-file/AddFile.js.map +1 -1
  61. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js +47 -19
  62. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js.map +1 -1
  63. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.js +9 -2
  64. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.js.map +1 -1
  65. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.types.js.map +1 -1
  66. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.js +9 -4
  67. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.js.map +1 -1
  68. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.types.js.map +1 -1
  69. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.js +6 -9
  70. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.js.map +1 -1
  71. package/lib/esm/components/gallery-editor/useGalleryEditorState.js +150 -0
  72. package/lib/esm/components/gallery-editor/useGalleryEditorState.js.map +1 -0
  73. package/lib/esm/components/gallery-viewer/GalleryViewer.constants.js +2 -0
  74. package/lib/esm/components/gallery-viewer/GalleryViewer.constants.js.map +1 -0
  75. package/lib/esm/components/gallery-viewer/GalleryViewer.js +10 -6
  76. package/lib/esm/components/gallery-viewer/GalleryViewer.js.map +1 -1
  77. package/lib/esm/components/gallery-viewer/GalleryViewer.types.js.map +1 -1
  78. package/lib/esm/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.js +14 -9
  79. package/lib/esm/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.js.map +1 -1
  80. package/lib/esm/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.types.js.map +1 -1
  81. package/lib/esm/components/media-content/MediaContent.constants.js +5 -0
  82. package/lib/esm/components/media-content/MediaContent.constants.js.map +1 -0
  83. package/lib/esm/components/media-content/MediaContent.js +83 -21
  84. package/lib/esm/components/media-content/MediaContent.js.map +1 -1
  85. package/lib/esm/components/media-content/MediaContent.styles.js +36 -5
  86. package/lib/esm/components/media-content/MediaContent.styles.js.map +1 -1
  87. package/lib/esm/components/media-content/MediaContent.types.js.map +1 -1
  88. package/lib/esm/components/media-content/MediaContent.utils.js +12 -0
  89. package/lib/esm/components/media-content/MediaContent.utils.js.map +1 -0
  90. package/lib/esm/utils/gallery.js +2 -2
  91. package/lib/esm/utils/gallery.js.map +1 -1
  92. package/lib/types/components/Gallery.types.d.ts +12 -0
  93. package/lib/types/components/gallery-editor/GalleryEditor.constants.d.ts +5 -0
  94. package/lib/types/components/gallery-editor/GalleryEditor.styles.d.ts +7 -3
  95. package/lib/types/components/gallery-editor/GalleryEditor.types.d.ts +11 -0
  96. package/lib/types/components/gallery-editor/GalleryEditor.utils.d.ts +5 -0
  97. package/lib/types/components/gallery-editor/add-file/AddFile.d.ts +3 -3
  98. package/lib/types/components/gallery-editor/add-file/AddFile.styles.d.ts +5 -3
  99. package/lib/types/components/gallery-editor/gallery-editor-item/GalleryEditorItem.d.ts +3 -3
  100. package/lib/types/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.d.ts +13 -3
  101. package/lib/types/components/gallery-editor/gallery-editor-item/GalleryEditorItem.types.d.ts +8 -0
  102. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.d.ts +3 -3
  103. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.styles.d.ts +3 -1
  104. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.types.d.ts +15 -0
  105. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.d.ts +3 -3
  106. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.styles.d.ts +12 -6
  107. package/lib/types/components/gallery-editor/useGalleryEditorState.d.ts +21 -0
  108. package/lib/types/components/gallery-viewer/GalleryViewer.constants.d.ts +1 -0
  109. package/lib/types/components/gallery-viewer/GalleryViewer.d.ts +3 -3
  110. package/lib/types/components/gallery-viewer/GalleryViewer.styles.d.ts +7 -3
  111. package/lib/types/components/gallery-viewer/GalleryViewer.types.d.ts +11 -0
  112. package/lib/types/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.d.ts +3 -3
  113. package/lib/types/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.styles.d.ts +2 -2
  114. package/lib/types/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.types.d.ts +8 -0
  115. package/lib/types/components/media-content/MediaContent.constants.d.ts +4 -0
  116. package/lib/types/components/media-content/MediaContent.d.ts +3 -3
  117. package/lib/types/components/media-content/MediaContent.styles.d.ts +50 -9
  118. package/lib/types/components/media-content/MediaContent.types.d.ts +16 -0
  119. package/lib/types/components/media-content/MediaContent.utils.d.ts +5 -0
  120. package/package.json +4 -4
@@ -1 +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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AoB,EAChBhB,SAAS,CAACS,MAAM,GAAG,CAAC,IAAIG,KAAK,KAAK,CAAC,GAAGZ,SAAS,CAACS,MAAM,GAAGQ;EAC5D,CACJ,CACJ,CAC2B,CACf,CAAC;AAE9B,CAAC;AAEDrB,aAAa,CAACsB,WAAW,GAAG,eAAe;AAE3C,eAAetB,aAAa","ignoreList":[]}
1
+ {"version":3,"file":"GalleryViewer.js","names":["React","memo","useCallback","GalleryViewerItem","StyledGalleryViewer","StyledGalleryViewerItemWrapper","getGalleryRatio","getGalleryViewerKey","getReadOnlyItemRatio","openKnownFiles","GalleryViewMode","GALLERY_VIEWER_MAX_VISIBLE_ITEMS","EMPTY_FILE_ITEMS","GalleryViewer","files","shouldLoadImages","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, memo, useCallback } 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';\nimport { GALLERY_VIEWER_MAX_VISIBLE_ITEMS } from './GalleryViewer.constants';\n\nconst EMPTY_FILE_ITEMS: FileItem[] = [];\n\nconst GalleryViewer: FC<GalleryViewerProps> = ({\n files,\n shouldLoadImages = true,\n viewMode = GalleryViewMode.GRID,\n}) => {\n const fileItems = files ?? EMPTY_FILE_ITEMS;\n const ratio = getGalleryRatio(fileItems);\n\n const handleOpenFiles = useCallback(\n (file: FileItem) => {\n openKnownFiles(fileItems, file);\n },\n [fileItems],\n );\n\n const visibleItems = fileItems.slice(0, GALLERY_VIEWER_MAX_VISIBLE_ITEMS);\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 shouldLoadImages={shouldLoadImages}\n remainingItemsLength={\n fileItems.length > GALLERY_VIEWER_MAX_VISIBLE_ITEMS && index === 3\n ? fileItems.length\n : undefined\n }\n />\n ))}\n </StyledGalleryViewerItemWrapper>\n </StyledGalleryViewer>\n );\n};\n\nGalleryViewer.displayName = 'GalleryViewer';\n\nexport default memo(GalleryViewer);\n"],"mappings":"AACA,OAAOA,KAAK,IAAQC,IAAI,EAAEC,WAAW,QAAQ,OAAO;AACpD,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;AACrD,SAASC,gCAAgC,QAAQ,2BAA2B;AAE5E,MAAMC,gBAA4B,GAAG,EAAE;AAEvC,MAAMC,aAAqC,GAAGA,CAAC;EAC3CC,KAAK;EACLC,gBAAgB,GAAG,IAAI;EACvBC,QAAQ,GAAGN,eAAe,CAACO;AAC/B,CAAC,KAAK;EACF,MAAMC,SAAS,GAAGJ,KAAK,IAAIF,gBAAgB;EAC3C,MAAMO,KAAK,GAAGb,eAAe,CAACY,SAAS,CAAC;EAExC,MAAME,eAAe,GAAGlB,WAAW,CAC9BmB,IAAc,IAAK;IAChBZ,cAAc,CAACS,SAAS,EAAEG,IAAI,CAAC;EACnC,CAAC,EACD,CAACH,SAAS,CACd,CAAC;EAED,MAAMI,YAAY,GAAGJ,SAAS,CAACK,KAAK,CAAC,CAAC,EAAEZ,gCAAgC,CAAC;EAEzE,oBACIX,KAAA,CAAAwB,aAAA,CAACpB,mBAAmB,qBAChBJ,KAAA,CAAAwB,aAAA,CAACnB,8BAA8B;IAC3BoB,MAAM,EAAEN,KAAM;IACdO,UAAU,EAAER,SAAS,CAACS,MAAO;IAC7BC,SAAS,EAAEZ;EAAS,GAEnBM,YAAY,CAACO,GAAG,CAAC,CAACR,IAAI,EAAES,KAAK,kBAC1B9B,KAAA,CAAAwB,aAAA,CAACrB,iBAAiB;IACd4B,GAAG,EAAExB,mBAAmB,CAACc,IAAI,EAAES,KAAK,CAAE;IACtCE,QAAQ,EAAEX,IAAK;IACfY,OAAO,EAAEb,eAAgB;IACzBD,KAAK,EAAEX,oBAAoB,CAAC;MAAEU,SAAS;MAAEY,KAAK;MAAEd;IAAS,CAAC,CAAE;IAC5DD,gBAAgB,EAAEA,gBAAiB;IACnCmB,oBAAoB,EAChBhB,SAAS,CAACS,MAAM,GAAGhB,gCAAgC,IAAImB,KAAK,KAAK,CAAC,GAC5DZ,SAAS,CAACS,MAAM,GAChBQ;EACT,CACJ,CACJ,CAC2B,CACf,CAAC;AAE9B,CAAC;AAEDtB,aAAa,CAACuB,WAAW,GAAG,eAAe;AAE3C,4BAAenC,IAAI,CAACY,aAAa,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"GalleryViewer.types.js","names":[],"sources":["../../../../src/components/gallery-viewer/GalleryViewer.types.ts"],"sourcesContent":["import type { FileItem } from '@chayns-components/core';\nimport type { GalleryViewMode } from '../../types/gallery';\n\n/**\n * Props for the prop-driven read-only gallery viewer.\n */\nexport interface GalleryViewerProps {\n /**\n * Provides the already known media items that should be rendered without local upload state.\n * @description\n * The viewer renders these files directly from props and does not mirror them into local component state.\n * @example\n * <GalleryViewer files={files} />\n * @optional\n */\n files?: FileItem[];\n /**\n * Defines how the media tiles are arranged in read-only mode.\n * @description\n * Use this prop to switch between the supported viewer layouts for known media.\n * @default GalleryViewMode.GRID\n * @example\n * <GalleryViewer files={files} viewMode={GalleryViewMode.SQUARE} />\n * @optional\n */\n viewMode?: GalleryViewMode;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"GalleryViewer.types.js","names":[],"sources":["../../../../src/components/gallery-viewer/GalleryViewer.types.ts"],"sourcesContent":["import type { FileItem } from '@chayns-components/core';\nimport type { GalleryViewMode } from '../../types/gallery';\n\n/**\n * Props for the prop-driven read-only gallery viewer.\n */\nexport interface GalleryViewerProps {\n /**\n * Provides the already known media items that should be rendered without local upload state.\n * @description\n * The viewer renders these files directly from props and does not mirror them into local component state.\n * @example\n * <GalleryViewer files={files} />\n * @optional\n */\n files?: FileItem[];\n /**\n * Controls whether the viewer may load the final media assets immediately.\n * @description\n * When set to `true`, the viewer renders and loads the actual images right away.\n * When set to `false`, the viewer keeps showing previews first and defers the final image load until this flag becomes `true`.\n * @default true\n * @example\n * <GalleryViewer files={files} shouldLoadImages={false} />\n * @optional\n */\n shouldLoadImages?: boolean;\n /**\n * Defines how the media tiles are arranged in read-only mode.\n * @description\n * Use this prop to switch between the supported viewer layouts for known media.\n * @default GalleryViewMode.GRID\n * @example\n * <GalleryViewer files={files} viewMode={GalleryViewMode.SQUARE} />\n * @optional\n */\n viewMode?: GalleryViewMode;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,18 +1,23 @@
1
- import React from 'react';
1
+ import React, { memo, useCallback } from 'react';
2
2
  import MediaContent from '../../media-content/MediaContent';
3
3
  import { StyledGalleryViewerItem, StyledGalleryViewerMoreItemsIndicator } from './GalleryViewerItem.styles';
4
4
  const GalleryViewerItem = ({
5
5
  fileItem,
6
+ shouldLoadImages = true,
6
7
  ratio = 1,
7
8
  remainingItemsLength,
8
9
  onClick
9
- }) => /*#__PURE__*/React.createElement(StyledGalleryViewerItem, null, /*#__PURE__*/React.createElement(MediaContent, {
10
- file: fileItem.file,
11
- onClick: () => onClick(fileItem),
12
- ratio: ratio
13
- }), remainingItemsLength && /*#__PURE__*/React.createElement(StyledGalleryViewerMoreItemsIndicator, {
14
- onClick: () => onClick(fileItem)
15
- }, /*#__PURE__*/React.createElement("p", null, `+ ${remainingItemsLength - 3}`)));
10
+ }) => {
11
+ const handleClick = useCallback(() => onClick(fileItem), [fileItem, onClick]);
12
+ return /*#__PURE__*/React.createElement(StyledGalleryViewerItem, null, /*#__PURE__*/React.createElement(MediaContent, {
13
+ file: fileItem.file,
14
+ onClick: handleClick,
15
+ ratio: ratio,
16
+ shouldLoadImages: shouldLoadImages
17
+ }), remainingItemsLength && /*#__PURE__*/React.createElement(StyledGalleryViewerMoreItemsIndicator, {
18
+ onClick: handleClick
19
+ }, /*#__PURE__*/React.createElement("p", null, `+ ${remainingItemsLength - 3}`)));
20
+ };
16
21
  GalleryViewerItem.displayName = 'GalleryViewerItem';
17
- export default GalleryViewerItem;
22
+ export default /*#__PURE__*/memo(GalleryViewerItem);
18
23
  //# sourceMappingURL=GalleryViewerItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GalleryViewerItem.js","names":["React","MediaContent","StyledGalleryViewerItem","StyledGalleryViewerMoreItemsIndicator","GalleryViewerItem","fileItem","ratio","remainingItemsLength","onClick","createElement","file","displayName"],"sources":["../../../../../src/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport MediaContent from '../../media-content/MediaContent';\nimport {\n StyledGalleryViewerItem,\n StyledGalleryViewerMoreItemsIndicator,\n} from './GalleryViewerItem.styles';\nimport type { GalleryViewerItemProps } from './GalleryViewerItem.types';\n\nconst GalleryViewerItem: FC<GalleryViewerItemProps> = ({\n fileItem,\n ratio = 1,\n remainingItemsLength,\n onClick,\n}) => (\n <StyledGalleryViewerItem>\n <MediaContent file={fileItem.file} onClick={() => onClick(fileItem)} ratio={ratio} />\n {remainingItemsLength && (\n <StyledGalleryViewerMoreItemsIndicator onClick={() => onClick(fileItem)}>\n <p>{`+ ${remainingItemsLength - 3}`}</p>\n </StyledGalleryViewerMoreItemsIndicator>\n )}\n </StyledGalleryViewerItem>\n);\n\nGalleryViewerItem.displayName = 'GalleryViewerItem';\n\nexport default GalleryViewerItem;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAc,OAAO;AACjC,OAAOC,YAAY,MAAM,kCAAkC;AAC3D,SACIC,uBAAuB,EACvBC,qCAAqC,QAClC,4BAA4B;AAGnC,MAAMC,iBAA6C,GAAGA,CAAC;EACnDC,QAAQ;EACRC,KAAK,GAAG,CAAC;EACTC,oBAAoB;EACpBC;AACJ,CAAC,kBACGR,KAAA,CAAAS,aAAA,CAACP,uBAAuB,qBACpBF,KAAA,CAAAS,aAAA,CAACR,YAAY;EAACS,IAAI,EAAEL,QAAQ,CAACK,IAAK;EAACF,OAAO,EAAEA,CAAA,KAAMA,OAAO,CAACH,QAAQ,CAAE;EAACC,KAAK,EAAEA;AAAM,CAAE,CAAC,EACpFC,oBAAoB,iBACjBP,KAAA,CAAAS,aAAA,CAACN,qCAAqC;EAACK,OAAO,EAAEA,CAAA,KAAMA,OAAO,CAACH,QAAQ;AAAE,gBACpEL,KAAA,CAAAS,aAAA,YAAI,KAAKF,oBAAoB,GAAG,CAAC,EAAM,CACJ,CAEtB,CAC5B;AAEDH,iBAAiB,CAACO,WAAW,GAAG,mBAAmB;AAEnD,eAAeP,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"GalleryViewerItem.js","names":["React","memo","useCallback","MediaContent","StyledGalleryViewerItem","StyledGalleryViewerMoreItemsIndicator","GalleryViewerItem","fileItem","shouldLoadImages","ratio","remainingItemsLength","onClick","handleClick","createElement","file","displayName"],"sources":["../../../../../src/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.tsx"],"sourcesContent":["import React, { FC, memo, useCallback } from 'react';\nimport MediaContent from '../../media-content/MediaContent';\nimport {\n StyledGalleryViewerItem,\n StyledGalleryViewerMoreItemsIndicator,\n} from './GalleryViewerItem.styles';\nimport type { GalleryViewerItemProps } from './GalleryViewerItem.types';\n\nconst GalleryViewerItem: FC<GalleryViewerItemProps> = ({\n fileItem,\n shouldLoadImages = true,\n ratio = 1,\n remainingItemsLength,\n onClick,\n}) => {\n const handleClick = useCallback(() => onClick(fileItem), [fileItem, onClick]);\n\n return (\n <StyledGalleryViewerItem>\n <MediaContent\n file={fileItem.file}\n onClick={handleClick}\n ratio={ratio}\n shouldLoadImages={shouldLoadImages}\n />\n {remainingItemsLength && (\n <StyledGalleryViewerMoreItemsIndicator onClick={handleClick}>\n <p>{`+ ${remainingItemsLength - 3}`}</p>\n </StyledGalleryViewerMoreItemsIndicator>\n )}\n </StyledGalleryViewerItem>\n );\n};\n\nGalleryViewerItem.displayName = 'GalleryViewerItem';\n\nexport default memo(GalleryViewerItem);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAQC,IAAI,EAAEC,WAAW,QAAQ,OAAO;AACpD,OAAOC,YAAY,MAAM,kCAAkC;AAC3D,SACIC,uBAAuB,EACvBC,qCAAqC,QAClC,4BAA4B;AAGnC,MAAMC,iBAA6C,GAAGA,CAAC;EACnDC,QAAQ;EACRC,gBAAgB,GAAG,IAAI;EACvBC,KAAK,GAAG,CAAC;EACTC,oBAAoB;EACpBC;AACJ,CAAC,KAAK;EACF,MAAMC,WAAW,GAAGV,WAAW,CAAC,MAAMS,OAAO,CAACJ,QAAQ,CAAC,EAAE,CAACA,QAAQ,EAAEI,OAAO,CAAC,CAAC;EAE7E,oBACIX,KAAA,CAAAa,aAAA,CAACT,uBAAuB,qBACpBJ,KAAA,CAAAa,aAAA,CAACV,YAAY;IACTW,IAAI,EAAEP,QAAQ,CAACO,IAAK;IACpBH,OAAO,EAAEC,WAAY;IACrBH,KAAK,EAAEA,KAAM;IACbD,gBAAgB,EAAEA;EAAiB,CACtC,CAAC,EACDE,oBAAoB,iBACjBV,KAAA,CAAAa,aAAA,CAACR,qCAAqC;IAACM,OAAO,EAAEC;EAAY,gBACxDZ,KAAA,CAAAa,aAAA,YAAI,KAAKH,oBAAoB,GAAG,CAAC,EAAM,CACJ,CAEtB,CAAC;AAElC,CAAC;AAEDJ,iBAAiB,CAACS,WAAW,GAAG,mBAAmB;AAEnD,4BAAed,IAAI,CAACK,iBAAiB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"GalleryViewerItem.types.js","names":[],"sources":["../../../../../src/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.types.ts"],"sourcesContent":["import type { FileItem } from '@chayns-components/core';\n\n/**\n * Props for a dedicated read-only gallery tile.\n */\nexport interface GalleryViewerItemProps {\n /**\n * Provides the uploaded media that should be rendered.\n * @description\n * The viewer item renders only already known media and never deals with upload-specific transient state.\n * @example\n * <GalleryViewerItem fileItem={file} onClick={handleOpen} />\n */\n fileItem: FileItem;\n /**\n * Defines the aspect ratio that should be reserved for the tile.\n * @description\n * Use this prop to reserve a deterministic tile height for stable read-only rendering.\n * @default 1\n * @example\n * <GalleryViewerItem fileItem={file} onClick={handleOpen} ratio={1.5} />\n * @optional\n */\n ratio?: number;\n /**\n * Provides the total item count when the last visible tile should show a remaining-items overlay.\n * @description\n * When this prop is set on the last visible viewer tile, the tile displays the `+n` overlay for hidden items.\n * @example\n * <GalleryViewerItem fileItem={file} onClick={handleOpen} remainingItemsLength={5} />\n * @optional\n */\n remainingItemsLength?: number;\n /**\n * Is called when the tile is selected.\n * @description\n * The viewer uses this callback to open the selected file inside the slideshow flow.\n * @example\n * <GalleryViewerItem fileItem={file} onClick={handleOpen} />\n */\n onClick: (file: FileItem) => void;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"GalleryViewerItem.types.js","names":[],"sources":["../../../../../src/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.types.ts"],"sourcesContent":["import type { FileItem } from '@chayns-components/core';\n\n/**\n * Props for a dedicated read-only gallery tile.\n */\nexport interface GalleryViewerItemProps {\n /**\n * Provides the uploaded media that should be rendered.\n * @description\n * The viewer item renders only already known media and never deals with upload-specific transient state.\n * @example\n * <GalleryViewerItem fileItem={file} onClick={handleOpen} />\n */\n fileItem: FileItem;\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 preview-first rendering can be controlled by the parent gallery.\n * @default true\n * @optional\n */\n shouldLoadImages?: boolean;\n /**\n * Defines the aspect ratio that should be reserved for the tile.\n * @description\n * Use this prop to reserve a deterministic tile height for stable read-only rendering.\n * @default 1\n * @example\n * <GalleryViewerItem fileItem={file} onClick={handleOpen} ratio={1.5} />\n * @optional\n */\n ratio?: number;\n /**\n * Provides the total item count when the last visible tile should show a remaining-items overlay.\n * @description\n * When this prop is set on the last visible viewer tile, the tile displays the `+n` overlay for hidden items.\n * @example\n * <GalleryViewerItem fileItem={file} onClick={handleOpen} remainingItemsLength={5} />\n * @optional\n */\n remainingItemsLength?: number;\n /**\n * Is called when the tile is selected.\n * @description\n * The viewer uses this callback to open the selected file inside the slideshow flow.\n * @example\n * <GalleryViewerItem fileItem={file} onClick={handleOpen} />\n */\n onClick: (file: FileItem) => void;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ export const MEDIA_CONTENT_IMAGE_FADE_DURATION_MS = 180;
2
+ export const MEDIA_CONTENT_PREVIEW_BLUR = 'blur(6px)';
3
+ export const MEDIA_CONTENT_PREVIEW_BLUR_REMOVE_DELAY_MS = 100;
4
+ export const MEDIA_CONTENT_PREVIEW_BLUR_REMOVE_DURATION_MS = 200;
5
+ //# sourceMappingURL=MediaContent.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaContent.constants.js","names":["MEDIA_CONTENT_IMAGE_FADE_DURATION_MS","MEDIA_CONTENT_PREVIEW_BLUR","MEDIA_CONTENT_PREVIEW_BLUR_REMOVE_DELAY_MS","MEDIA_CONTENT_PREVIEW_BLUR_REMOVE_DURATION_MS"],"sources":["../../../../src/components/media-content/MediaContent.constants.ts"],"sourcesContent":["export const MEDIA_CONTENT_IMAGE_FADE_DURATION_MS = 180;\nexport const MEDIA_CONTENT_PREVIEW_BLUR = 'blur(6px)';\nexport const MEDIA_CONTENT_PREVIEW_BLUR_REMOVE_DELAY_MS = 100;\nexport const MEDIA_CONTENT_PREVIEW_BLUR_REMOVE_DURATION_MS = 200;\n"],"mappings":"AAAA,OAAO,MAAMA,oCAAoC,GAAG,GAAG;AACvD,OAAO,MAAMC,0BAA0B,GAAG,WAAW;AACrD,OAAO,MAAMC,0CAA0C,GAAG,GAAG;AAC7D,OAAO,MAAMC,6CAA6C,GAAG,GAAG","ignoreList":[]}
@@ -1,29 +1,91 @@
1
1
  import { Icon } from '@chayns-components/core';
2
- import React from 'react';
3
- import { StyledMediaContentImage, StyledMediaContentImageWrapper, StyledMediaContentPlayIcon, StyledMediaContentVideo, StyledMediaContentVideoWrapper } from './MediaContent.styles';
2
+ import React, { memo, useLayoutEffect, useRef, useState } from 'react';
3
+ import { StyledMediaContentImage, StyledMediaContentImageWrapper, StyledMediaContentPlayIcon, StyledMediaContentPreviewImage, StyledMediaContentVideo, StyledMediaContentVideoWrapper } from './MediaContent.styles';
4
+ import { getMediaPreviewUrl, getMediaSourceUrl, isVideoFile } from './MediaContent.utils';
5
+ import { MEDIA_CONTENT_IMAGE_FADE_DURATION_MS } from './MediaContent.constants';
4
6
  const MediaContent = ({
5
7
  file,
8
+ previewUrl,
6
9
  ratio,
7
10
  onClick,
11
+ shouldLoadImages = true,
8
12
  playIconSize = 50
9
- }) => 'thumbnailUrl' in file ? /*#__PURE__*/React.createElement(StyledMediaContentVideoWrapper, {
10
- onClick: onClick,
11
- $ratio: ratio
12
- }, /*#__PURE__*/React.createElement(StyledMediaContentPlayIcon, null, /*#__PURE__*/React.createElement(Icon, {
13
- size: playIconSize,
14
- icons: ['fa fa-play']
15
- })), /*#__PURE__*/React.createElement(StyledMediaContentVideo, {
16
- poster: file.thumbnailUrl
17
- }, /*#__PURE__*/React.createElement("source", {
18
- src: file.url,
19
- type: "video/mp4"
20
- }))) : /*#__PURE__*/React.createElement(StyledMediaContentImageWrapper, {
21
- onClick: onClick,
22
- $ratio: ratio
23
- }, /*#__PURE__*/React.createElement(StyledMediaContentImage, {
24
- draggable: false,
25
- src: file.url
26
- }));
13
+ }) => {
14
+ const isVideo = isVideoFile(file);
15
+ const sourceKey = getMediaSourceUrl(file);
16
+ const previewSourceUrl = getMediaPreviewUrl(file, previewUrl);
17
+ const [hasLoadedFinalMedia, setHasLoadedFinalMedia] = useState(false);
18
+ const imageRef = useRef(null);
19
+ const videoRef = useRef(null);
20
+ const finalSourceUrl = sourceKey;
21
+ const displayPreviewUrl = previewSourceUrl;
22
+ const shouldHidePreview = shouldLoadImages && hasLoadedFinalMedia;
23
+ const previewLayerStyle = {
24
+ opacity: shouldHidePreview ? 0 : 1,
25
+ filter: shouldHidePreview ? 'blur(0px)' : undefined
26
+ };
27
+ const finalMediaStyle = {
28
+ opacity: hasLoadedFinalMedia || !displayPreviewUrl ? 1 : 0,
29
+ transition: `opacity ${MEDIA_CONTENT_IMAGE_FADE_DURATION_MS}ms ease`
30
+ };
31
+ useLayoutEffect(() => {
32
+ setHasLoadedFinalMedia(false);
33
+ }, [sourceKey]);
34
+ useLayoutEffect(() => {
35
+ if (!shouldLoadImages) {
36
+ return;
37
+ }
38
+ if (!isVideo && imageRef.current?.complete && imageRef.current.naturalWidth > 0) {
39
+ setHasLoadedFinalMedia(true);
40
+ }
41
+ if (isVideo && videoRef.current?.readyState && videoRef.current.readyState >= 2) {
42
+ setHasLoadedFinalMedia(true);
43
+ }
44
+ }, [finalSourceUrl, isVideo, shouldLoadImages]);
45
+ const shouldRenderFinalImage = shouldLoadImages && Boolean(finalSourceUrl);
46
+ const shouldShowPreview = Boolean(displayPreviewUrl);
47
+ if (isVideo) {
48
+ return /*#__PURE__*/React.createElement(StyledMediaContentVideoWrapper, {
49
+ onClick: onClick,
50
+ $ratio: ratio
51
+ }, displayPreviewUrl && /*#__PURE__*/React.createElement(StyledMediaContentPreviewImage, {
52
+ draggable: false,
53
+ src: displayPreviewUrl,
54
+ alt: "",
55
+ "aria-hidden": "true",
56
+ style: previewLayerStyle
57
+ }), /*#__PURE__*/React.createElement(StyledMediaContentPlayIcon, null, /*#__PURE__*/React.createElement(Icon, {
58
+ size: playIconSize,
59
+ icons: ['fa fa-play']
60
+ })), shouldRenderFinalImage && /*#__PURE__*/React.createElement(StyledMediaContentVideo, {
61
+ ref: videoRef,
62
+ poster: displayPreviewUrl,
63
+ preload: "metadata",
64
+ onLoadedData: () => setHasLoadedFinalMedia(true),
65
+ style: finalMediaStyle
66
+ }, /*#__PURE__*/React.createElement("source", {
67
+ src: finalSourceUrl,
68
+ type: "video/mp4"
69
+ })));
70
+ }
71
+ return /*#__PURE__*/React.createElement(StyledMediaContentImageWrapper, {
72
+ onClick: onClick,
73
+ $ratio: ratio
74
+ }, shouldShowPreview && /*#__PURE__*/React.createElement(StyledMediaContentPreviewImage, {
75
+ draggable: false,
76
+ src: displayPreviewUrl,
77
+ alt: "",
78
+ "aria-hidden": "true",
79
+ style: previewLayerStyle
80
+ }), shouldRenderFinalImage && /*#__PURE__*/React.createElement(StyledMediaContentImage, {
81
+ ref: imageRef,
82
+ draggable: false,
83
+ src: finalSourceUrl,
84
+ alt: "",
85
+ onLoad: () => setHasLoadedFinalMedia(true),
86
+ style: finalMediaStyle
87
+ }));
88
+ };
27
89
  MediaContent.displayName = 'MediaContent';
28
- export default MediaContent;
90
+ export default /*#__PURE__*/memo(MediaContent);
29
91
  //# sourceMappingURL=MediaContent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MediaContent.js","names":["Icon","React","StyledMediaContentImage","StyledMediaContentImageWrapper","StyledMediaContentPlayIcon","StyledMediaContentVideo","StyledMediaContentVideoWrapper","MediaContent","file","ratio","onClick","playIconSize","createElement","$ratio","size","icons","poster","thumbnailUrl","src","url","type","draggable","displayName"],"sources":["../../../../src/components/media-content/MediaContent.tsx"],"sourcesContent":["import { Icon } from '@chayns-components/core';\nimport React, { FC } from 'react';\nimport {\n StyledMediaContentImage,\n StyledMediaContentImageWrapper,\n StyledMediaContentPlayIcon,\n StyledMediaContentVideo,\n StyledMediaContentVideoWrapper,\n} from './MediaContent.styles';\nimport type { MediaContentProps } from './MediaContent.types';\n\nconst MediaContent: FC<MediaContentProps> = ({ file, ratio, onClick, playIconSize = 50 }) =>\n 'thumbnailUrl' in file ? (\n <StyledMediaContentVideoWrapper onClick={onClick} $ratio={ratio}>\n <StyledMediaContentPlayIcon>\n <Icon size={playIconSize} icons={['fa fa-play']} />\n </StyledMediaContentPlayIcon>\n <StyledMediaContentVideo poster={file.thumbnailUrl}>\n <source src={file.url} type=\"video/mp4\" />\n </StyledMediaContentVideo>\n </StyledMediaContentVideoWrapper>\n ) : (\n <StyledMediaContentImageWrapper onClick={onClick} $ratio={ratio}>\n <StyledMediaContentImage draggable={false} src={file.url} />\n </StyledMediaContentImageWrapper>\n );\n\nMediaContent.displayName = 'MediaContent';\n\nexport default MediaContent;\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,yBAAyB;AAC9C,OAAOC,KAAK,MAAc,OAAO;AACjC,SACIC,uBAAuB,EACvBC,8BAA8B,EAC9BC,0BAA0B,EAC1BC,uBAAuB,EACvBC,8BAA8B,QAC3B,uBAAuB;AAG9B,MAAMC,YAAmC,GAAGA,CAAC;EAAEC,IAAI;EAAEC,KAAK;EAAEC,OAAO;EAAEC,YAAY,GAAG;AAAG,CAAC,KACpF,cAAc,IAAIH,IAAI,gBAClBP,KAAA,CAAAW,aAAA,CAACN,8BAA8B;EAACI,OAAO,EAAEA,OAAQ;EAACG,MAAM,EAAEJ;AAAM,gBAC5DR,KAAA,CAAAW,aAAA,CAACR,0BAA0B,qBACvBH,KAAA,CAAAW,aAAA,CAACZ,IAAI;EAACc,IAAI,EAAEH,YAAa;EAACI,KAAK,EAAE,CAAC,YAAY;AAAE,CAAE,CAC1B,CAAC,eAC7Bd,KAAA,CAAAW,aAAA,CAACP,uBAAuB;EAACW,MAAM,EAAER,IAAI,CAACS;AAAa,gBAC/ChB,KAAA,CAAAW,aAAA;EAAQM,GAAG,EAAEV,IAAI,CAACW,GAAI;EAACC,IAAI,EAAC;AAAW,CAAE,CACpB,CACG,CAAC,gBAEjCnB,KAAA,CAAAW,aAAA,CAACT,8BAA8B;EAACO,OAAO,EAAEA,OAAQ;EAACG,MAAM,EAAEJ;AAAM,gBAC5DR,KAAA,CAAAW,aAAA,CAACV,uBAAuB;EAACmB,SAAS,EAAE,KAAM;EAACH,GAAG,EAAEV,IAAI,CAACW;AAAI,CAAE,CAC/B,CACnC;AAELZ,YAAY,CAACe,WAAW,GAAG,cAAc;AAEzC,eAAef,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"MediaContent.js","names":["Icon","React","memo","useLayoutEffect","useRef","useState","StyledMediaContentImage","StyledMediaContentImageWrapper","StyledMediaContentPlayIcon","StyledMediaContentPreviewImage","StyledMediaContentVideo","StyledMediaContentVideoWrapper","getMediaPreviewUrl","getMediaSourceUrl","isVideoFile","MEDIA_CONTENT_IMAGE_FADE_DURATION_MS","MediaContent","file","previewUrl","ratio","onClick","shouldLoadImages","playIconSize","isVideo","sourceKey","previewSourceUrl","hasLoadedFinalMedia","setHasLoadedFinalMedia","imageRef","videoRef","finalSourceUrl","displayPreviewUrl","shouldHidePreview","previewLayerStyle","opacity","filter","undefined","finalMediaStyle","transition","current","complete","naturalWidth","readyState","shouldRenderFinalImage","Boolean","shouldShowPreview","createElement","$ratio","draggable","src","alt","style","size","icons","ref","poster","preload","onLoadedData","type","onLoad","displayName"],"sources":["../../../../src/components/media-content/MediaContent.tsx"],"sourcesContent":["import { Icon } from '@chayns-components/core';\nimport React, { FC, memo, useLayoutEffect, useRef, useState } from 'react';\nimport {\n StyledMediaContentImage,\n StyledMediaContentImageWrapper,\n StyledMediaContentPlayIcon,\n StyledMediaContentPreviewImage,\n StyledMediaContentVideo,\n StyledMediaContentVideoWrapper,\n} from './MediaContent.styles';\nimport type { MediaContentProps } from './MediaContent.types';\nimport { getMediaPreviewUrl, getMediaSourceUrl, isVideoFile } from './MediaContent.utils';\nimport { MEDIA_CONTENT_IMAGE_FADE_DURATION_MS } from './MediaContent.constants';\n\nconst MediaContent: FC<MediaContentProps> = ({\n file,\n previewUrl,\n ratio,\n onClick,\n shouldLoadImages = true,\n playIconSize = 50,\n}) => {\n const isVideo = isVideoFile(file);\n const sourceKey = getMediaSourceUrl(file);\n const previewSourceUrl = getMediaPreviewUrl(file, previewUrl);\n const [hasLoadedFinalMedia, setHasLoadedFinalMedia] = useState(false);\n const imageRef = useRef<HTMLImageElement>(null);\n const videoRef = useRef<HTMLVideoElement>(null);\n const finalSourceUrl = sourceKey;\n const displayPreviewUrl = previewSourceUrl;\n const shouldHidePreview = shouldLoadImages && hasLoadedFinalMedia;\n const previewLayerStyle = {\n opacity: shouldHidePreview ? 0 : 1,\n filter: shouldHidePreview ? 'blur(0px)' : undefined,\n };\n const finalMediaStyle = {\n opacity: hasLoadedFinalMedia || !displayPreviewUrl ? 1 : 0,\n transition: `opacity ${MEDIA_CONTENT_IMAGE_FADE_DURATION_MS}ms ease`,\n };\n\n useLayoutEffect(() => {\n setHasLoadedFinalMedia(false);\n }, [sourceKey]);\n\n useLayoutEffect(() => {\n if (!shouldLoadImages) {\n return;\n }\n\n if (!isVideo && imageRef.current?.complete && imageRef.current.naturalWidth > 0) {\n setHasLoadedFinalMedia(true);\n }\n\n if (isVideo && videoRef.current?.readyState && videoRef.current.readyState >= 2) {\n setHasLoadedFinalMedia(true);\n }\n }, [finalSourceUrl, isVideo, shouldLoadImages]);\n\n const shouldRenderFinalImage = shouldLoadImages && Boolean(finalSourceUrl);\n const shouldShowPreview = Boolean(displayPreviewUrl);\n\n if (isVideo) {\n return (\n <StyledMediaContentVideoWrapper onClick={onClick} $ratio={ratio}>\n {displayPreviewUrl && (\n <StyledMediaContentPreviewImage\n draggable={false}\n src={displayPreviewUrl}\n alt=\"\"\n aria-hidden=\"true\"\n style={previewLayerStyle}\n />\n )}\n <StyledMediaContentPlayIcon>\n <Icon size={playIconSize} icons={['fa fa-play']} />\n </StyledMediaContentPlayIcon>\n {shouldRenderFinalImage && (\n <StyledMediaContentVideo\n ref={videoRef}\n poster={displayPreviewUrl}\n preload=\"metadata\"\n onLoadedData={() => setHasLoadedFinalMedia(true)}\n style={finalMediaStyle}\n >\n <source src={finalSourceUrl} type=\"video/mp4\" />\n </StyledMediaContentVideo>\n )}\n </StyledMediaContentVideoWrapper>\n );\n }\n\n return (\n <StyledMediaContentImageWrapper onClick={onClick} $ratio={ratio}>\n {shouldShowPreview && (\n <StyledMediaContentPreviewImage\n draggable={false}\n src={displayPreviewUrl}\n alt=\"\"\n aria-hidden=\"true\"\n style={previewLayerStyle}\n />\n )}\n {shouldRenderFinalImage && (\n <StyledMediaContentImage\n ref={imageRef}\n draggable={false}\n src={finalSourceUrl}\n alt=\"\"\n onLoad={() => setHasLoadedFinalMedia(true)}\n style={finalMediaStyle}\n />\n )}\n </StyledMediaContentImageWrapper>\n );\n};\n\nMediaContent.displayName = 'MediaContent';\n\nexport default memo(MediaContent);\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,yBAAyB;AAC9C,OAAOC,KAAK,IAAQC,IAAI,EAAEC,eAAe,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC1E,SACIC,uBAAuB,EACvBC,8BAA8B,EAC9BC,0BAA0B,EAC1BC,8BAA8B,EAC9BC,uBAAuB,EACvBC,8BAA8B,QAC3B,uBAAuB;AAE9B,SAASC,kBAAkB,EAAEC,iBAAiB,EAAEC,WAAW,QAAQ,sBAAsB;AACzF,SAASC,oCAAoC,QAAQ,0BAA0B;AAE/E,MAAMC,YAAmC,GAAGA,CAAC;EACzCC,IAAI;EACJC,UAAU;EACVC,KAAK;EACLC,OAAO;EACPC,gBAAgB,GAAG,IAAI;EACvBC,YAAY,GAAG;AACnB,CAAC,KAAK;EACF,MAAMC,OAAO,GAAGT,WAAW,CAACG,IAAI,CAAC;EACjC,MAAMO,SAA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E,KAAM;IACjBC,GAAG,EAAElB,iBAAkB;IACvBmB,GAAG,EAAC,EAAE;IACN,eAAY,MAAM;IAClBC,KAAK,EAAElB;EAAkB,CAC5B,CACJ,EACAU,sBAAsB,iBACnB1C,KAAA,CAAA6C,aAAA,CAACxC,uBAAuB;IACpBgD,GAAG,EAAE1B,QAAS;IACdoB,SAAS,EAAE,KAAM;IACjBC,GAAG,EAAEnB,cAAe;IACpBoB,GAAG,EAAC,EAAE;IACNS,MAAM,EAAEA,CAAA,KAAMhC,sBAAsB,CAAC,IAAI,CAAE;IAC3CwB,KAAK,EAAEd;EAAgB,CAC1B,CAEuB,CAAC;AAEzC,CAAC;AAEDrB,YAAY,CAAC4C,WAAW,GAAG,cAAc;AAEzC,4BAAe1D,IAAI,CAACc,YAAY,CAAC","ignoreList":[]}
@@ -1,6 +1,9 @@
1
1
  import styled from 'styled-components';
2
+ import { MEDIA_CONTENT_IMAGE_FADE_DURATION_MS, MEDIA_CONTENT_PREVIEW_BLUR, MEDIA_CONTENT_PREVIEW_BLUR_REMOVE_DELAY_MS, MEDIA_CONTENT_PREVIEW_BLUR_REMOVE_DURATION_MS } from './MediaContent.constants';
2
3
  export const StyledMediaContentVideoWrapper = styled.div`
3
4
  display: flex;
5
+ position: relative;
6
+ overflow: hidden;
4
7
  width: 100%;
5
8
  height: 100%;
6
9
  aspect-ratio: ${({
@@ -9,13 +12,38 @@ export const StyledMediaContentVideoWrapper = styled.div`
9
12
  `;
10
13
  export const StyledMediaContentImageWrapper = styled.div`
11
14
  display: flex;
15
+ position: relative;
16
+ overflow: hidden;
12
17
  width: 100%;
13
18
  height: 100%;
14
19
  aspect-ratio: ${({
15
20
  $ratio
16
21
  }) => $ratio};
17
22
  `;
18
- export const StyledMediaContentImage = styled.img`
23
+ const StyledMediaContentLayer = styled.img`
24
+ position: absolute;
25
+ inset: 0;
26
+ width: 100%;
27
+ height: 100%;
28
+ object-fit: cover;
29
+ pointer-events: none;
30
+ `;
31
+ export const StyledMediaContentPreviewImage = styled(StyledMediaContentLayer)`
32
+ background-color: ${({
33
+ theme
34
+ }) => theme['101']};
35
+ box-shadow: 0 0 0 1px
36
+ rgba(${({
37
+ theme
38
+ }) => theme['009-rgb']}, 0.08) inset;
39
+ z-index: 2;
40
+ filter: ${MEDIA_CONTENT_PREVIEW_BLUR};
41
+ transition:
42
+ opacity ${MEDIA_CONTENT_IMAGE_FADE_DURATION_MS}ms ease,
43
+ filter ${MEDIA_CONTENT_PREVIEW_BLUR_REMOVE_DURATION_MS}ms ease
44
+ ${MEDIA_CONTENT_PREVIEW_BLUR_REMOVE_DELAY_MS}ms;
45
+ `;
46
+ export const StyledMediaContentImage = styled(StyledMediaContentLayer)`
19
47
  background-color: ${({
20
48
  theme
21
49
  }) => theme['101']};
@@ -24,9 +52,7 @@ export const StyledMediaContentImage = styled.img`
24
52
  theme
25
53
  }) => theme['009-rgb']}, 0.08) inset;
26
54
  z-index: 1;
27
- width: 100%;
28
- height: 100%;
29
- object-fit: cover;
55
+ transition: opacity ${MEDIA_CONTENT_IMAGE_FADE_DURATION_MS}ms ease;
30
56
  `;
31
57
  export const StyledMediaContentVideo = styled.video`
32
58
  background-color: ${({
@@ -36,12 +62,17 @@ export const StyledMediaContentVideo = styled.video`
36
62
  rgba(${({
37
63
  theme
38
64
  }) => theme['009-rgb']}, 0.08) inset;
65
+ position: absolute;
66
+ inset: 0;
39
67
  width: 100%;
68
+ height: 100%;
40
69
  object-fit: cover;
70
+ pointer-events: none;
71
+ z-index: 1;
41
72
  `;
42
73
  export const StyledMediaContentPlayIcon = styled.div`
43
74
  position: absolute;
44
- z-index: 2;
75
+ z-index: 3;
45
76
  top: 50%;
46
77
  left: 50%;
47
78
  transform: translate(-50%, -50%);
@@ -1 +1 @@
1
- {"version":3,"file":"MediaContent.styles.js","names":["styled","StyledMediaContentVideoWrapper","div","$ratio","StyledMediaContentImageWrapper","StyledMediaContentImage","img","theme","StyledMediaContentVideo","video","StyledMediaContentPlayIcon"],"sources":["../../../../src/components/media-content/MediaContent.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled from 'styled-components';\n\nexport const StyledMediaContentVideoWrapper = styled.div<{ $ratio: number }>`\n display: flex;\n width: 100%;\n height: 100%;\n aspect-ratio: ${({ $ratio }) => $ratio};\n`;\n\nexport const StyledMediaContentImageWrapper = styled.div<{ $ratio: number }>`\n display: flex;\n width: 100%;\n height: 100%;\n aspect-ratio: ${({ $ratio }) => $ratio};\n`;\n\ntype StyledMediaContentVideoProps = WithTheme<unknown>;\n\ntype StyledMediaContentImageProps = WithTheme<unknown>;\n\nexport const StyledMediaContentImage = styled.img<StyledMediaContentImageProps>`\n background-color: ${({ theme }: StyledMediaContentImageProps) => theme['101']};\n box-shadow: 0 0 0 1px\n rgba(${({ theme }: StyledMediaContentImageProps) => theme['009-rgb']}, 0.08) inset;\n z-index: 1;\n width: 100%;\n height: 100%;\n object-fit: cover;\n`;\n\nexport const StyledMediaContentVideo = styled.video<StyledMediaContentVideoProps>`\n background-color: ${({ theme }: StyledMediaContentVideoProps) => theme['101']};\n box-shadow: 0 0 0 1px\n rgba(${({ theme }: StyledMediaContentVideoProps) => theme['009-rgb']}, 0.08) inset;\n width: 100%;\n object-fit: cover;\n`;\n\nexport const StyledMediaContentPlayIcon = styled.div`\n position: absolute;\n z-index: 2;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n`;\n"],"mappings":"AACA,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,8BAA8B,GAAGD,MAAM,CAACE,GAAuB;AAC5E;AACA;AACA;AACA,oBAAoB,CAAC;EAAEC;AAAO,CAAC,KAAKA,MAAM;AAC1C,CAAC;AAED,OAAO,MAAMC,8BAA8B,GAAGJ,MAAM,CAACE,GAAuB;AAC5E;AACA;AACA;AACA,oBAAoB,CAAC;EAAEC;AAAO,CAAC,KAAKA,MAAM;AAC1C,CAAC;AAMD,OAAO,MAAME,uBAAuB,GAAGL,MAAM,CAACM,GAAiC;AAC/E,wBAAwB,CAAC;EAAEC;AAAoC,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AACjF;AACA,eAAe,CAAC;EAAEA;AAAoC,CAAC,KAAKA,KAAK,CAAC,SAAS,CAAC;AAC5E;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,uBAAuB,GAAGR,MAAM,CAACS,KAAmC;AACjF,wBAAwB,CAAC;EAAEF;AAAoC,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AACjF;AACA,eAAe,CAAC;EAAEA;AAAoC,CAAC,KAAKA,KAAK,CAAC,SAAS,CAAC;AAC5E;AACA;AACA,CAAC;AAED,OAAO,MAAMG,0BAA0B,GAAGV,MAAM,CAACE,GAAG;AACpD;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"MediaContent.styles.js","names":["styled","MEDIA_CONTENT_IMAGE_FADE_DURATION_MS","MEDIA_CONTENT_PREVIEW_BLUR","MEDIA_CONTENT_PREVIEW_BLUR_REMOVE_DELAY_MS","MEDIA_CONTENT_PREVIEW_BLUR_REMOVE_DURATION_MS","StyledMediaContentVideoWrapper","div","$ratio","StyledMediaContentImageWrapper","StyledMediaContentLayer","img","StyledMediaContentPreviewImage","theme","StyledMediaContentImage","StyledMediaContentVideo","video","StyledMediaContentPlayIcon"],"sources":["../../../../src/components/media-content/MediaContent.styles.ts"],"sourcesContent":["import type { WithTheme } from '@chayns-components/core';\nimport styled from 'styled-components';\nimport {\n MEDIA_CONTENT_IMAGE_FADE_DURATION_MS,\n MEDIA_CONTENT_PREVIEW_BLUR,\n MEDIA_CONTENT_PREVIEW_BLUR_REMOVE_DELAY_MS,\n MEDIA_CONTENT_PREVIEW_BLUR_REMOVE_DURATION_MS,\n} from './MediaContent.constants';\n\nexport const StyledMediaContentVideoWrapper = styled.div<{ $ratio: number }>`\n display: flex;\n position: relative;\n overflow: hidden;\n width: 100%;\n height: 100%;\n aspect-ratio: ${({ $ratio }) => $ratio};\n`;\n\nexport const StyledMediaContentImageWrapper = styled.div<{ $ratio: number }>`\n display: flex;\n position: relative;\n overflow: hidden;\n width: 100%;\n height: 100%;\n aspect-ratio: ${({ $ratio }) => $ratio};\n`;\n\ntype StyledMediaContentVideoProps = WithTheme<unknown>;\n\ntype StyledMediaContentImageProps = WithTheme<unknown>;\n\nconst StyledMediaContentLayer = styled.img<StyledMediaContentImageProps>`\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n pointer-events: none;\n`;\n\nexport const StyledMediaContentPreviewImage = styled(StyledMediaContentLayer)`\n background-color: ${({ theme }: StyledMediaContentImageProps) => theme['101']};\n box-shadow: 0 0 0 1px\n rgba(${({ theme }: StyledMediaContentImageProps) => theme['009-rgb']}, 0.08) inset;\n z-index: 2;\n filter: ${MEDIA_CONTENT_PREVIEW_BLUR};\n transition:\n opacity ${MEDIA_CONTENT_IMAGE_FADE_DURATION_MS}ms ease,\n filter ${MEDIA_CONTENT_PREVIEW_BLUR_REMOVE_DURATION_MS}ms ease\n ${MEDIA_CONTENT_PREVIEW_BLUR_REMOVE_DELAY_MS}ms;\n`;\n\nexport const StyledMediaContentImage = styled(StyledMediaContentLayer)`\n background-color: ${({ theme }: StyledMediaContentImageProps) => theme['101']};\n box-shadow: 0 0 0 1px\n rgba(${({ theme }: StyledMediaContentImageProps) => theme['009-rgb']}, 0.08) inset;\n z-index: 1;\n transition: opacity ${MEDIA_CONTENT_IMAGE_FADE_DURATION_MS}ms ease;\n`;\n\nexport const StyledMediaContentVideo = styled.video<StyledMediaContentVideoProps>`\n background-color: ${({ theme }: StyledMediaContentVideoProps) => theme['101']};\n box-shadow: 0 0 0 1px\n rgba(${({ theme }: StyledMediaContentVideoProps) => theme['009-rgb']}, 0.08) inset;\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n pointer-events: none;\n z-index: 1;\n`;\n\nexport const StyledMediaContentPlayIcon = styled.div`\n position: absolute;\n z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A,KAAK,CAAC,KAAK,CAAC;AACjF;AACA,eAAe,CAAC;EAAEA;AAAoC,CAAC,KAAKA,KAAK,CAAC,SAAS,CAAC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMI,0BAA0B,GAAGhB,MAAM,CAACM,GAAG;AACpD;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"MediaContent.types.js","names":[],"sources":["../../../../src/components/media-content/MediaContent.types.ts"],"sourcesContent":["import type { FileItem } from '@chayns-components/core';\n\n/**\n * Props for the low-level uploaded media renderer shared by viewer and editor.\n */\nexport interface MediaContentProps {\n /**\n * Provides the uploaded media item that should be rendered.\n * @description\n * This low-level renderer accepts already known image or video data and does not handle upload-specific state.\n * @example\n * <MediaContent file={file.file} onClick={handleOpen} ratio={1} />\n */\n file: FileItem['file'];\n /**\n * Defines the aspect ratio that should be reserved for the media.\n * @description\n * The surrounding tile uses this value to reserve a deterministic media height before the asset finishes loading.\n * @example\n * <MediaContent file={file.file} onClick={handleOpen} ratio={1.5} />\n */\n ratio: number;\n /**\n * Is called when the media tile is selected.\n * @description\n * Use this callback to react to clicks on the rendered image or video tile.\n * @example\n * <MediaContent file={file.file} onClick={() => console.log('open')} ratio={1} />\n */\n onClick: () => void;\n /**\n * Defines the size of the video play icon.\n * @description\n * This prop only affects rendered videos. Image tiles ignore it.\n * @default 50\n * @example\n * <MediaContent file={file.file} onClick={handleOpen} playIconSize={30} ratio={1} />\n * @optional\n */\n playIconSize?: number;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"MediaContent.types.js","names":[],"sources":["../../../../src/components/media-content/MediaContent.types.ts"],"sourcesContent":["import type { FileItem } from '@chayns-components/core';\n\n/**\n * Props for the low-level uploaded media renderer shared by viewer and editor.\n */\nexport interface MediaContentProps {\n /**\n * Provides the uploaded media item that should be rendered.\n * @description\n * This low-level renderer accepts already known image or video data and does not handle upload-specific state.\n * @example\n * <MediaContent file={file.file} onClick={handleOpen} ratio={1} />\n */\n file: FileItem['file'];\n /**\n * Provides an optional preview source that can be displayed while the final media is still loading.\n * @description\n * This preview can be a base64 data URL or any low-resolution fallback image.\n * When provided, the component shows the preview first and swaps to the final image once it has finished loading.\n * @optional\n */\n previewUrl?: string;\n /**\n * Defines the aspect ratio that should be reserved for the media.\n * @description\n * The surrounding tile uses this value to reserve a deterministic media height before the asset finishes loading.\n * @example\n * <MediaContent file={file.file} onClick={handleOpen} ratio={1.5} />\n */\n ratio: number;\n /**\n * Controls whether the final media source may be loaded immediately.\n * @description\n * When set to `false`, only the preview source is rendered until this flag becomes `true`.\n * @default true\n * @optional\n */\n shouldLoadImages?: boolean;\n /**\n * Is called when the media tile is selected.\n * @description\n * Use this callback to react to clicks on the rendered image or video tile.\n * @example\n * <MediaContent file={file.file} onClick={() => console.log('open')} ratio={1} />\n */\n onClick: () => void;\n /**\n * Defines the size of the video play icon.\n * @description\n * This prop only affects rendered videos. Image tiles ignore it.\n * @default 50\n * @example\n * <MediaContent file={file.file} onClick={handleOpen} playIconSize={30} ratio={1} />\n * @optional\n */\n playIconSize?: number;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ export const isVideoFile = file => 'thumbnailUrl' in file;
2
+ export const getMediaSourceUrl = file => file.url.replace('_0.mp4', '.mp4');
3
+ export const getMediaPreviewUrl = (file, previewUrl) => {
4
+ if (previewUrl) {
5
+ return previewUrl;
6
+ }
7
+ if (isVideoFile(file)) {
8
+ return file.thumbnailUrl;
9
+ }
10
+ return file.meta?.preview;
11
+ };
12
+ //# sourceMappingURL=MediaContent.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaContent.utils.js","names":["isVideoFile","file","getMediaSourceUrl","url","replace","getMediaPreviewUrl","previewUrl","thumbnailUrl","meta","preview"],"sources":["../../../../src/components/media-content/MediaContent.utils.ts"],"sourcesContent":["import type { FileItem, Video } from '@chayns-components/core';\n\nexport type GalleryMediaFile = FileItem['file'];\n\nexport const isVideoFile = (file: GalleryMediaFile): file is Video => 'thumbnailUrl' in file;\n\nexport const getMediaSourceUrl = (file: GalleryMediaFile): string =>\n file.url.replace('_0.mp4', '.mp4');\n\nexport const getMediaPreviewUrl = (\n file: GalleryMediaFile,\n previewUrl?: string,\n): string | undefined => {\n if (previewUrl) {\n return previewUrl;\n }\n\n if (isVideoFile(file)) {\n return file.thumbnailUrl;\n }\n\n return file.meta?.preview;\n};\n"],"mappings":"AAIA,OAAO,MAAMA,WAAW,GAAIC,IAAsB,IAAoB,cAAc,IAAIA,IAAI;AAE5F,OAAO,MAAMC,iBAAiB,GAAID,IAAsB,IACpDA,IAAI,CAACE,GAAG,CAACC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC;AAEtC,OAAO,MAAMC,kBAAkB,GAAGA,CAC9BJ,IAAsB,EACtBK,UAAmB,KACE;EACrB,IAAIA,UAAU,EAAE;IACZ,OAAOA,UAAU;EACrB;EAEA,IAAIN,WAAW,CAACC,IAAI,CAAC,EAAE;IACnB,OAAOA,IAAI,CAACM,YAAY;EAC5B;EAEA,OAAON,IAAI,CAACO,IAAI,EAAEC,OAAO;AAC7B,CAAC","ignoreList":[]}
@@ -49,7 +49,7 @@ export const openFiles = (fileItems, file) => {
49
49
  try {
50
50
  startIndex = fileItems.findIndex(item => item.id === file.id);
51
51
  const items = fileItems.map(item => ({
52
- url: item.uploadedFile?.url.replace('_0.mp4', '.mp4') ?? '',
52
+ url: item.uploadedFile?.url ?? '',
53
53
  mediaType: item.uploadedFile && 'thumbnailUrl' in item.uploadedFile ? MediaType.VIDEO : MediaType.IMAGE
54
54
  }));
55
55
 
@@ -93,7 +93,7 @@ export const openKnownFiles = (fileItems, file) => {
93
93
  try {
94
94
  startIndex = fileItems.findIndex((item, index) => getGalleryViewerKey(item, index) === activeFileKey);
95
95
  const items = fileItems.map(item => ({
96
- url: item.file.url.replace('_0.mp4', '.mp4'),
96
+ url: item.file.url,
97
97
  mediaType: 'thumbnailUrl' in item.file ? MediaType.VIDEO : MediaType.IMAGE
98
98
  }));
99
99
 
@@ -1 +1 @@
1
- {"version":3,"file":"gallery.js","names":["MediaType","openImage","openMedia","openVideo","GalleryViewMode","DEFAULT_MEDIA_RATIO","mapFilesToInternalItems","files","map","file","index","id","getGalleryViewerKey","uploadedFile","undefined","state","previewUrl","fileItem","url","getGalleryRatio","fileItems","length","Math","max","ratio","getReadOnlyItemRatio","viewMode","itemCount","GRID","openFiles","startIndex","findIndex","item","items","replace","mediaType","VIDEO","IMAGE","_","imageFiles","forEach","push","startFile","shift","openKnownFiles","activeFileKey","indexOf"],"sources":["../../../src/utils/gallery.ts"],"sourcesContent":["import type { FileItem, InternalFileItem } from '@chayns-components/core';\nimport {\n MediaType,\n openImage,\n openMedia,\n type OpenImageItem,\n type OpenMediaItem,\n openVideo,\n} from 'chayns-api';\nimport { GalleryViewMode } from '../types/gallery';\n\nconst DEFAULT_MEDIA_RATIO = 1;\n\nexport const mapFilesToInternalItems = (files?: FileItem[]): InternalFileItem[] =>\n (files ?? []).map((file, index) => ({\n id: getGalleryViewerKey(file, index),\n uploadedFile: file.file,\n file: undefined,\n state: 'uploaded',\n previewUrl: undefined,\n }));\n\nexport const getGalleryViewerKey = (fileItem: FileItem, index: number): string =>\n fileItem.id ?? fileItem.file.id ?? fileItem.file.url ?? `gallery-item-${index}`;\n\nexport const getGalleryRatio = (fileItems: FileItem[]): number => {\n switch (fileItems.length) {\n case 0:\n return DEFAULT_MEDIA_RATIO;\n case 1:\n return Math.max(fileItems[0]?.file.ratio ?? DEFAULT_MEDIA_RATIO, 1);\n case 2:\n return 2;\n case 3:\n return 3;\n default:\n return DEFAULT_MEDIA_RATIO;\n }\n};\n\nexport const getReadOnlyItemRatio = ({\n fileItems,\n index,\n viewMode,\n}: {\n fileItems: FileItem[];\n index: number;\n viewMode: GalleryViewMode;\n}): number => {\n const itemCount = fileItems.length;\n\n if (viewMode !== GalleryViewMode.GRID) {\n return DEFAULT_MEDIA_RATIO;\n }\n\n if (itemCount === 1) {\n // A square fallback keeps virtualization stable when upstream data does not provide a ratio.\n return Math.max(fileItems[0]?.file.ratio ?? DEFAULT_MEDIA_RATIO, DEFAULT_MEDIA_RATIO);\n }\n\n if (itemCount === 2 && (index === 0 || index === 1)) {\n return 0.5;\n }\n\n if ((index === 0 && itemCount > 2) || (itemCount === 3 && (index === 1 || index === 2))) {\n return 1.5;\n }\n\n return DEFAULT_MEDIA_RATIO;\n};\n\nexport const openFiles = (fileItems: InternalFileItem[], file: InternalFileItem) => {\n let startIndex = 0;\n\n try {\n startIndex = fileItems.findIndex((item) => item.id === file.id);\n\n const items: OpenMediaItem[] = fileItems.map((item) => ({\n url: item.uploadedFile?.url.replace('_0.mp4', '.mp4') ?? '',\n mediaType:\n item.uploadedFile && 'thumbnailUrl' in item.uploadedFile\n ? MediaType.VIDEO\n : MediaType.IMAGE,\n }));\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n void openMedia({ items, startIndex });\n } catch (_) {\n if (file.uploadedFile && 'thumbnailUrl' in file.uploadedFile) {\n void openVideo({ url: file.uploadedFile.url });\n\n return;\n }\n\n const imageFiles: OpenImageItem[] = [];\n\n fileItems.forEach(({ uploadedFile }) => {\n if (uploadedFile && !('thumbnailUrl' in uploadedFile)) {\n imageFiles.push({ url: uploadedFile.url });\n }\n });\n\n startIndex = imageFiles.findIndex((item) => item.url === file.uploadedFile?.url);\n\n const startFile = imageFiles.shift();\n\n if (!startFile) {\n return;\n }\n\n void openImage({ items: [startFile, ...imageFiles], startIndex });\n }\n};\n\nexport const openKnownFiles = (fileItems: FileItem[], file: FileItem) => {\n const activeFileKey = getGalleryViewerKey(file, fileItems.indexOf(file));\n let startIndex = 0;\n\n try {\n startIndex = fileItems.findIndex(\n (item, index) => getGalleryViewerKey(item, index) === activeFileKey,\n );\n\n const items: OpenMediaItem[] = fileItems.map((item) => ({\n url: item.file.url.replace('_0.mp4', '.mp4'),\n mediaType: 'thumbnailUrl' in item.file ? MediaType.VIDEO : MediaType.IMAGE,\n }));\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n void openMedia({ items, startIndex });\n } catch (_) {\n if ('thumbnailUrl' in file.file) {\n void openVideo({ url: file.file.url });\n\n return;\n }\n\n const imageFiles: OpenImageItem[] = [];\n\n fileItems.forEach((item) => {\n if (!('thumbnailUrl' in item.file)) {\n imageFiles.push({ url: item.file.url });\n }\n });\n\n startIndex = imageFiles.findIndex((item) => item.url === file.file.url);\n\n const startFile = imageFiles.shift();\n\n if (!startFile) {\n return;\n }\n\n void openImage({ items: [startFile, ...imageFiles], startIndex });\n }\n};\n"],"mappings":"AACA,SACIA,SAAS,EACTC,SAAS,EACTC,SAAS,EAGTC,SAAS,QACN,YAAY;AACnB,SAASC,eAAe,QAAQ,kBAAkB;AAElD,MAAMC,mBAAmB,GAAG,CAAC;AAE7B,OAAO,MAAMC,uBAAuB,GAAIC,KAAkB,IACtD,CAACA,KAAK,IAAI,EAAE,EAAEC,GAAG,CAAC,CAACC,IAAI,EAAEC,KAAK,MAAM;EAChCC,EAAE,EAAEC,mBAAmB,CAACH,IAAI,EAAEC,KAAK,CAAC;EACpCG,YAAY,EAAEJ,IAAI,CAACA,IAAI;EACvBA,IAAI,EAAEK,SAAS;EACfC,KAAK,EAAE,UAAU;EACjBC,UAAU,EAAEF;AAChB,CAAC,CAAC,CAAC;AAEP,OAAO,MAAMF,mBAAmB,GAAGA,CAACK,QAAkB,EAAEP,KAAa,KACjEO,QAAQ,CAACN,EAAE,IAAIM,QAAQ,CAACR,IAAI,CAACE,EAAE,IAAIM,QAAQ,CAACR,IAAI,CAACS,GAAG,IAAI,gBAAgBR,KAAK,EAAE;AAEnF,OAAO,MAAMS,eAAe,GAAIC,SAAqB,IAAa;EAC9D,QAAQA,SAAS,CAACC,MAAM;IACpB,KAAK,CAAC;MACF,OAAOhB,mBAAmB;IAC9B,KAAK,CAAC;MACF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AG,CAAC;IAEvE,MAAMwB,SAAS,GAAGH,UAAU,CAACI,KAAK,CAAC,CAAC;IAEpC,IAAI,CAACD,SAAS,EAAE;MACZ;IACJ;IAEA,KAAKzC,SAAS,CAAC;MAAEgC,KAAK,EAAE,CAACS,SAAS,EAAE,GAAGH,UAAU,CAAC;MAAET;IAAW,CAAC,CAAC;EACrE;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"gallery.js","names":["MediaType","openImage","openMedia","openVideo","GalleryViewMode","DEFAULT_MEDIA_RATIO","mapFilesToInternalItems","files","map","file","index","id","getGalleryViewerKey","uploadedFile","undefined","state","previewUrl","fileItem","url","getGalleryRatio","fileItems","length","Math","max","ratio","getReadOnlyItemRatio","viewMode","itemCount","GRID","openFiles","startIndex","findIndex","item","items","mediaType","VIDEO","IMAGE","_","imageFiles","forEach","push","startFile","shift","openKnownFiles","activeFileKey","indexOf"],"sources":["../../../src/utils/gallery.ts"],"sourcesContent":["import type { FileItem, InternalFileItem } from '@chayns-components/core';\nimport {\n MediaType,\n openImage,\n openMedia,\n type OpenImageItem,\n type OpenMediaItem,\n openVideo,\n} from 'chayns-api';\nimport { GalleryViewMode } from '../types/gallery';\n\nconst DEFAULT_MEDIA_RATIO = 1;\n\nexport const mapFilesToInternalItems = (files?: FileItem[]): InternalFileItem[] =>\n (files ?? []).map((file, index) => ({\n id: getGalleryViewerKey(file, index),\n uploadedFile: file.file,\n file: undefined,\n state: 'uploaded',\n previewUrl: undefined,\n }));\n\nexport const getGalleryViewerKey = (fileItem: FileItem, index: number): string =>\n fileItem.id ?? fileItem.file.id ?? fileItem.file.url ?? `gallery-item-${index}`;\n\nexport const getGalleryRatio = (fileItems: FileItem[]): number => {\n switch (fileItems.length) {\n case 0:\n return DEFAULT_MEDIA_RATIO;\n case 1:\n return Math.max(fileItems[0]?.file.ratio ?? DEFAULT_MEDIA_RATIO, 1);\n case 2:\n return 2;\n case 3:\n return 3;\n default:\n return DEFAULT_MEDIA_RATIO;\n }\n};\n\nexport const getReadOnlyItemRatio = ({\n fileItems,\n index,\n viewMode,\n}: {\n fileItems: FileItem[];\n index: number;\n viewMode: GalleryViewMode;\n}): number => {\n const itemCount = fileItems.length;\n\n if (viewMode !== GalleryViewMode.GRID) {\n return DEFAULT_MEDIA_RATIO;\n }\n\n if (itemCount === 1) {\n // A square fallback keeps virtualization stable when upstream data does not provide a ratio.\n return Math.max(fileItems[0]?.file.ratio ?? DEFAULT_MEDIA_RATIO, DEFAULT_MEDIA_RATIO);\n }\n\n if (itemCount === 2 && (index === 0 || index === 1)) {\n return 0.5;\n }\n\n if ((index === 0 && itemCount > 2) || (itemCount === 3 && (index === 1 || index === 2))) {\n return 1.5;\n }\n\n return DEFAULT_MEDIA_RATIO;\n};\n\nexport const openFiles = (fileItems: InternalFileItem[], file: InternalFileItem) => {\n let startIndex = 0;\n\n try {\n startIndex = fileItems.findIndex((item) => item.id === file.id);\n\n const items: OpenMediaItem[] = fileItems.map((item) => ({\n url: item.uploadedFile?.url ?? '',\n mediaType:\n item.uploadedFile && 'thumbnailUrl' in item.uploadedFile\n ? MediaType.VIDEO\n : MediaType.IMAGE,\n }));\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n void openMedia({ items, startIndex });\n } catch (_) {\n if (file.uploadedFile && 'thumbnailUrl' in file.uploadedFile) {\n void openVideo({ url: file.uploadedFile.url });\n\n return;\n }\n\n const imageFiles: OpenImageItem[] = [];\n\n fileItems.forEach(({ uploadedFile }) => {\n if (uploadedFile && !('thumbnailUrl' in uploadedFile)) {\n imageFiles.push({ url: uploadedFile.url });\n }\n });\n\n startIndex = imageFiles.findIndex((item) => item.url === file.uploadedFile?.url);\n\n const startFile = imageFiles.shift();\n\n if (!startFile) {\n return;\n }\n\n void openImage({ items: [startFile, ...imageFiles], startIndex });\n }\n};\n\nexport const openKnownFiles = (fileItems: FileItem[], file: FileItem) => {\n const activeFileKey = getGalleryViewerKey(file, fileItems.indexOf(file));\n let startIndex = 0;\n\n try {\n startIndex = fileItems.findIndex(\n (item, index) => getGalleryViewerKey(item, index) === activeFileKey,\n );\n\n const items: OpenMediaItem[] = fileItems.map((item) => ({\n url: item.file.url,\n mediaType: 'thumbnailUrl' in item.file ? MediaType.VIDEO : MediaType.IMAGE,\n }));\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n void openMedia({ items, startIndex });\n } catch (_) {\n if ('thumbnailUrl' in file.file) {\n void openVideo({ url: file.file.url });\n\n return;\n }\n\n const imageFiles: OpenImageItem[] = [];\n\n fileItems.forEach((item) => {\n if (!('thumbnailUrl' in item.file)) {\n imageFiles.push({ url: item.file.url });\n }\n });\n\n startIndex = imageFiles.findIndex((item) => item.url === file.file.url);\n\n const startFile = imageFiles.shift();\n\n if (!startFile) {\n return;\n }\n\n void openImage({ items: [startFile, ...imageFiles], startIndex });\n }\n};\n"],"mappings":"AACA,SACIA,SAAS,EACTC,SAAS,EACTC,SAAS,EAGTC,SAAS,QACN,YAAY;AACnB,SAASC,eAAe,QAAQ,kBAAkB;AAElD,MAAMC,mBAAmB,GAAG,CAAC;AAE7B,OAAO,MAAMC,uBAAuB,GAAIC,KAAkB,IACtD,CAACA,KAAK,IAAI,EAAE,EAAEC,GAAG,CAAC,CAACC,IAAI,EAAEC,KAAK,MAAM;EAChCC,EAAE,EAAEC,mBAAmB,CAACH,IAAI,EAAEC,KAAK,CAAC;EACpCG,YAAY,EAAEJ,IAAI,CAACA,IAAI;EACvBA,IAAI,EAAEK,SAAS;EACfC,KAAK,EAAE,UAAU;EACjBC,UAAU,EAAEF;AAChB,CAAC,CAAC,CAAC;AAEP,OAAO,MAAMF,mBAAmB,GAAGA,CAACK,QAAkB,EAAEP,KAAa,KACjEO,QAAQ,CAACN,EAAE,IAAIM,QAAQ,CAACR,IAAI,CAACE,EAAE,IAAIM,QAAQ,CAACR,IAAI,CAACS,GAAG,IAAI,gBAAgBR,KAAK,EAAE;AAEnF,OAAO,MAAMS,eAAe,GA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,CAACA,IAAI,CAACS,GAAG,CAAC;IAEvE,MAAMuB,SAAS,GAAGH,UAAU,CAACI,KAAK,CAAC,CAAC;IAEpC,IAAI,CAACD,SAAS,EAAE;MACZ;IACJ;IAEA,KAAKxC,SAAS,CAAC;MAAEgC,KAAK,EAAE,CAACQ,SAAS,EAAE,GAAGH,UAAU,CAAC;MAAER;IAAW,CAAC,CAAC;EACrE;AACJ,CAAC","ignoreList":[]}
@@ -82,6 +82,18 @@ export interface GalleryProps {
82
82
  * @optional
83
83
  */
84
84
  maxFiles?: number;
85
+ /**
86
+ * Controls when the gallery is allowed to load the final media assets.
87
+ * @description
88
+ * When set to `true`, the gallery loads the actual images immediately as before.
89
+ * When set to `false`, the gallery keeps rendering previews first and delays the final media load until this flag becomes `true`.
90
+ * This setting applies to the whole gallery wrapper and is intended for external loading control such as virtualized message lists.
91
+ * @default true
92
+ * @example
93
+ * <Gallery files={files} shouldLoadImages={false} />
94
+ * @optional
95
+ */
96
+ shouldLoadImages?: boolean;
85
97
  /**
86
98
  * Is called after a file has been uploaded successfully in edit mode.
87
99
  * @description
@@ -0,0 +1,5 @@
1
+ export declare const GALLERY_EDITOR_GRID_GAP_PX = 6;
2
+ export declare const GALLERY_EDITOR_ITEM_FADE_DURATION_S = 0.18;
3
+ export declare const GALLERY_EDITOR_PREVIEW_FADE_DURATION_S = 0.16;
4
+ export declare const GALLERY_EDITOR_MEDIA_FADE_DURATION_S = 0.2;
5
+ export declare const GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX = 3;
@@ -1,4 +1,8 @@
1
- export declare const StyledGalleryEditor: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
- export declare const StyledGalleryEditorGrid: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
1
+ export declare const StyledGalleryEditor: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
2
+ export declare const StyledGalleryEditorGrid: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$gap" | "$fileMinWidth"> & {
3
+ $gap: number;
3
4
  $fileMinWidth: number;
4
- }>> & string;
5
+ }, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$gap" | "$fileMinWidth"> & {
6
+ $gap: number;
7
+ $fileMinWidth: number;
8
+ }, never>>> & string;
@@ -53,6 +53,17 @@ export interface GalleryEditorProps {
53
53
  * @optional
54
54
  */
55
55
  files?: FileItem[];
56
+ /**
57
+ * Controls whether the editor may load the final media assets immediately.
58
+ * @description
59
+ * When set to `true`, the editor behaves like the current implementation and loads the final media immediately.
60
+ * When set to `false`, uploaded media keeps rendering previews first and delays the final image load until this flag becomes `true`.
61
+ * @default true
62
+ * @example
63
+ * <GalleryEditor files={files} shouldLoadImages={false} />
64
+ * @optional
65
+ */
66
+ shouldLoadImages?: boolean;
56
67
  /**
57
68
  * Limits how many files can be managed by the editor.
58
69
  * @description
@@ -0,0 +1,5 @@
1
+ import type { FileItem, InternalFileItem } from '@chayns-components/core';
2
+ export declare const mapExternalFilesIntoInternalItems: (files?: FileItem[]) => InternalFileItem[];
3
+ export declare const mergeExternalFilesWithInternalState: (internalItems: InternalFileItem[], externalItems: InternalFileItem[]) => InternalFileItem[];
4
+ export declare const getPendingPreviewFileItems: (fileItems: InternalFileItem[]) => InternalFileItem[];
5
+ export declare const getPendingUploadFileItems: (fileItems: InternalFileItem[]) => InternalFileItem[];
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import React from 'react';
2
2
  import type { AddFileProps } from './AddFile.types';
3
- declare const AddFile: FC<AddFileProps>;
4
- export default AddFile;
3
+ declare const _default: React.NamedExoticComponent<AddFileProps>;
4
+ export default _default;
@@ -1,4 +1,6 @@
1
- export declare const StyledAddFile: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
- export declare const StyledAddFIleIconWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
1
+ export declare const StyledAddFile: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
2
+ export declare const StyledAddFIleIconWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "theme"> & {
3
3
  theme: import("@chayns-components/core").Theme;
4
- }>> & string;
4
+ }, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "theme"> & {
5
+ theme: import("@chayns-components/core").Theme;
6
+ }, never>>> & string;
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import React from 'react';
2
2
  import type { GalleryEditorItemProps } from './GalleryEditorItem.types';
3
- declare const GalleryEditorItem: FC<GalleryEditorItemProps>;
4
- export default GalleryEditorItem;
3
+ declare const _default: React.NamedExoticComponent<GalleryEditorItemProps>;
4
+ export default _default;
@@ -1,4 +1,14 @@
1
- export declare const StyledGalleryEditorItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
- export declare const StyledGalleryEditorItemDeleteButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
1
+ export declare const StyledMotionGalleryEditorItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("motion/react").HTMLMotionProps<"div">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
2
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
3
+ }, never> & Partial<Pick<Omit<Omit<import("motion/react").HTMLMotionProps<"div">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
4
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
5
+ }, never>>> & string & Omit<import("motion/react").ForwardRefComponent<HTMLDivElement, import("motion/react").HTMLMotionProps<"div">>, keyof import("react").Component<any, {}, any>>;
6
+ export declare const StyledGalleryEditorItemDeleteButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "theme" | "$zIndex"> & {
3
7
  theme: import("@chayns-components/core").Theme;
4
- }>> & string;
8
+ } & {
9
+ $zIndex: number;
10
+ }, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "theme" | "$zIndex"> & {
11
+ theme: import("@chayns-components/core").Theme;
12
+ } & {
13
+ $zIndex: number;
14
+ }, never>>> & string;