@chayns-components/gallery 5.0.0-beta.98 → 5.0.0-beta.981
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.
- package/README.md +4 -15
- package/lib/cjs/components/Gallery.js +317 -0
- package/lib/cjs/components/Gallery.js.map +1 -0
- package/lib/cjs/components/Gallery.styles.js +92 -0
- package/lib/cjs/components/Gallery.styles.js.map +1 -0
- package/lib/cjs/components/add-file/AddFile.js +33 -0
- package/lib/cjs/components/add-file/AddFile.js.map +1 -0
- package/lib/cjs/components/add-file/AddFile.styles.js +23 -0
- package/lib/cjs/components/add-file/AddFile.styles.js.map +1 -0
- package/lib/cjs/components/gallery-item/GalleryItem.js +43 -0
- package/lib/cjs/components/gallery-item/GalleryItem.js.map +1 -0
- package/lib/cjs/components/gallery-item/GalleryItem.styles.js +51 -0
- package/lib/cjs/components/gallery-item/GalleryItem.styles.js.map +1 -0
- package/lib/cjs/components/gallery-item/media-item/MediaItem.js +52 -0
- package/lib/cjs/components/gallery-item/media-item/MediaItem.js.map +1 -0
- package/lib/cjs/components/gallery-item/media-item/MediaItem.styles.js +62 -0
- package/lib/cjs/components/gallery-item/media-item/MediaItem.styles.js.map +1 -0
- package/lib/cjs/components/gallery-item/preview-item/PreviewItem.js +45 -0
- package/lib/cjs/components/gallery-item/preview-item/PreviewItem.js.map +1 -0
- package/lib/cjs/components/gallery-item/preview-item/PreviewItem.styles.js +43 -0
- package/lib/cjs/components/gallery-item/preview-item/PreviewItem.styles.js.map +1 -0
- package/lib/cjs/index.js +21 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/types/gallery.js +12 -0
- package/lib/cjs/types/gallery.js.map +1 -0
- package/lib/cjs/utils/file.js +51 -0
- package/lib/cjs/utils/file.js.map +1 -0
- package/lib/esm/components/Gallery.js +307 -0
- package/lib/esm/components/Gallery.js.map +1 -0
- package/lib/esm/components/Gallery.styles.js +91 -0
- package/lib/esm/components/Gallery.styles.js.map +1 -0
- package/lib/esm/components/add-file/AddFile.js +26 -0
- package/lib/esm/components/add-file/AddFile.js.map +1 -0
- package/lib/esm/components/add-file/AddFile.styles.js +22 -0
- package/lib/esm/components/add-file/AddFile.styles.js.map +1 -0
- package/lib/esm/components/gallery-item/GalleryItem.js +37 -0
- package/lib/esm/components/gallery-item/GalleryItem.js.map +1 -0
- package/lib/esm/components/gallery-item/GalleryItem.styles.js +50 -0
- package/lib/esm/components/gallery-item/GalleryItem.styles.js.map +1 -0
- package/lib/esm/components/gallery-item/media-item/MediaItem.js +45 -0
- package/lib/esm/components/gallery-item/media-item/MediaItem.js.map +1 -0
- package/lib/esm/components/gallery-item/media-item/MediaItem.styles.js +73 -0
- package/lib/esm/components/gallery-item/media-item/MediaItem.styles.js.map +1 -0
- package/lib/esm/components/gallery-item/preview-item/PreviewItem.js +41 -0
- package/lib/esm/components/gallery-item/preview-item/PreviewItem.js.map +1 -0
- package/lib/esm/components/gallery-item/preview-item/PreviewItem.styles.js +45 -0
- package/lib/esm/components/gallery-item/preview-item/PreviewItem.styles.js.map +1 -0
- package/lib/esm/index.js +5 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/types/gallery.js +6 -0
- package/lib/esm/types/gallery.js.map +1 -0
- package/lib/esm/utils/file.js +47 -0
- package/lib/esm/utils/file.js.map +1 -0
- package/lib/types/components/Gallery.d.ts +47 -0
- package/lib/types/components/Gallery.styles.d.ts +10 -0
- package/lib/types/components/add-file/AddFile.d.ts +9 -0
- package/lib/types/components/add-file/AddFile.styles.d.ts +4 -0
- package/lib/types/components/gallery-item/GalleryItem.d.ts +30 -0
- package/lib/types/components/gallery-item/GalleryItem.styles.d.ts +5 -0
- package/lib/types/components/gallery-item/media-item/MediaItem.d.ts +22 -0
- package/lib/types/components/gallery-item/media-item/MediaItem.styles.d.ts +279 -0
- package/lib/types/components/gallery-item/preview-item/PreviewItem.d.ts +14 -0
- package/lib/types/components/gallery-item/preview-item/PreviewItem.styles.d.ts +273 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/types/gallery.d.ts +4 -0
- package/lib/types/utils/file.d.ts +17 -0
- package/package.json +47 -28
- package/lib/components/gallery/Gallery.d.ts +0 -4
- package/lib/components/gallery/Gallery.js +0 -14
- package/lib/components/gallery/Gallery.js.map +0 -1
- package/lib/components/gallery/Gallery.styles.d.ts +0 -1
- package/lib/components/gallery/Gallery.styles.js +0 -11
- package/lib/components/gallery/Gallery.styles.js.map +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -14
- package/lib/index.js.map +0 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Icon } from '@chayns-components/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { StyledMediaItemImage, StyledMediaItemImageWrapper, StyledMediaItemPlayIcon, StyledMediaItemVideo, StyledMediaItemVideoWrapper, StyledMotionMediaItem } from './MediaItem.styles';
|
|
4
|
+
const MediaItem = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
fileItem,
|
|
7
|
+
isEditMode,
|
|
8
|
+
openSelectedFile,
|
|
9
|
+
ratio
|
|
10
|
+
} = _ref;
|
|
11
|
+
return /*#__PURE__*/React.createElement(StyledMotionMediaItem, {
|
|
12
|
+
animate: {
|
|
13
|
+
opacity: 1
|
|
14
|
+
},
|
|
15
|
+
initial: {
|
|
16
|
+
opacity: 0
|
|
17
|
+
},
|
|
18
|
+
exit: {
|
|
19
|
+
opacity: 0
|
|
20
|
+
},
|
|
21
|
+
transition: {
|
|
22
|
+
duration: 3.2
|
|
23
|
+
}
|
|
24
|
+
}, fileItem.uploadedFile && 'thumbnailUrl' in fileItem.uploadedFile ? /*#__PURE__*/React.createElement(StyledMediaItemVideoWrapper, {
|
|
25
|
+
onClick: () => openSelectedFile(fileItem),
|
|
26
|
+
$ratio: ratio
|
|
27
|
+
}, /*#__PURE__*/React.createElement(StyledMediaItemPlayIcon, null, /*#__PURE__*/React.createElement(Icon, {
|
|
28
|
+
size: isEditMode ? 30 : 50,
|
|
29
|
+
icons: ['fa fa-play']
|
|
30
|
+
})), /*#__PURE__*/React.createElement(StyledMediaItemVideo, {
|
|
31
|
+
poster: fileItem.uploadedFile.thumbnailUrl
|
|
32
|
+
}, /*#__PURE__*/React.createElement("source", {
|
|
33
|
+
src: fileItem.uploadedFile.url,
|
|
34
|
+
type: "video/mp4"
|
|
35
|
+
}))) : /*#__PURE__*/React.createElement(StyledMediaItemImageWrapper, {
|
|
36
|
+
onClick: () => openSelectedFile(fileItem),
|
|
37
|
+
$ratio: ratio
|
|
38
|
+
}, /*#__PURE__*/React.createElement(StyledMediaItemImage, {
|
|
39
|
+
draggable: false,
|
|
40
|
+
src: fileItem.uploadedFile?.url
|
|
41
|
+
})));
|
|
42
|
+
};
|
|
43
|
+
MediaItem.displayName = 'MediaItem';
|
|
44
|
+
export default MediaItem;
|
|
45
|
+
//# sourceMappingURL=MediaItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MediaItem.js","names":["Icon","React","StyledMediaItemImage","StyledMediaItemImageWrapper","StyledMediaItemPlayIcon","StyledMediaItemVideo","StyledMediaItemVideoWrapper","StyledMotionMediaItem","MediaItem","_ref","fileItem","isEditMode","openSelectedFile","ratio","createElement","animate","opacity","initial","exit","transition","duration","uploadedFile","onClick","$ratio","size","icons","poster","thumbnailUrl","src","url","type","draggable","displayName"],"sources":["../../../../../src/components/gallery-item/media-item/MediaItem.tsx"],"sourcesContent":["import { Icon, type InternalFileItem } from '@chayns-components/core';\nimport React, { FC } from 'react';\nimport {\n StyledMediaItemImage,\n StyledMediaItemImageWrapper,\n StyledMediaItemPlayIcon,\n StyledMediaItemVideo,\n StyledMediaItemVideoWrapper,\n StyledMotionMediaItem,\n} from './MediaItem.styles';\n\nexport type MediaItemProps = {\n /**\n * Images and videos which should be displayed\n */\n fileItem: InternalFileItem;\n /**\n * Whether images and videos can be edited\n */\n isEditMode: boolean;\n /**\n * Function to be executed when a file is selected\n */\n openSelectedFile: (file: InternalFileItem) => void;\n /**\n * The ratio of the image\n */\n ratio: number;\n};\n\nconst MediaItem: FC<MediaItemProps> = ({ fileItem, isEditMode, openSelectedFile, ratio }) => (\n <StyledMotionMediaItem\n animate={{ opacity: 1 }}\n initial={{ opacity: 0 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 3.2 }}\n >\n {fileItem.uploadedFile && 'thumbnailUrl' in fileItem.uploadedFile ? (\n <StyledMediaItemVideoWrapper onClick={() => openSelectedFile(fileItem)} $ratio={ratio}>\n <StyledMediaItemPlayIcon>\n <Icon size={isEditMode ? 30 : 50} icons={['fa fa-play']} />\n </StyledMediaItemPlayIcon>\n <StyledMediaItemVideo poster={fileItem.uploadedFile.thumbnailUrl}>\n <source src={fileItem.uploadedFile.url} type=\"video/mp4\" />\n </StyledMediaItemVideo>\n </StyledMediaItemVideoWrapper>\n ) : (\n <StyledMediaItemImageWrapper onClick={() => openSelectedFile(fileItem)} $ratio={ratio}>\n <StyledMediaItemImage draggable={false} src={fileItem.uploadedFile?.url} />\n </StyledMediaItemImageWrapper>\n )}\n </StyledMotionMediaItem>\n);\n\nMediaItem.displayName = 'MediaItem';\n\nexport default MediaItem;\n"],"mappings":"AAAA,SAASA,IAAI,QAA+B,yBAAyB;AACrE,OAAOC,KAAK,MAAc,OAAO;AACjC,SACIC,oBAAoB,EACpBC,2BAA2B,EAC3BC,uBAAuB,EACvBC,oBAAoB,EACpBC,2BAA2B,EAC3BC,qBAAqB,QAClB,oBAAoB;AAqB3B,MAAMC,SAA6B,GAAGC,IAAA;EAAA,IAAC;IAAEC,QAAQ;IAAEC,UAAU;IAAEC,gBAAgB;IAAEC;EAAM,CAAC,GAAAJ,IAAA;EAAA,oBACpFR,KAAA,CAAAa,aAAA,CAACP,qBAAqB;IAClBQ,OAAO,EAAE;MAAEC,OAAO,EAAE;IAAE,CAAE;IACxBC,OAAO,EAAE;MAAED,OAAO,EAAE;IAAE,CAAE;IACxBE,IAAI,EAAE;MAAEF,OAAO,EAAE;IAAE,CAAE;IACrBG,UAAU,EAAE;MAAEC,QAAQ,EAAE;IAAI;EAAE,GAE7BV,QAAQ,CAACW,YAAY,IAAI,cAAc,IAAIX,QAAQ,CAACW,YAAY,gBAC7DpB,KAAA,CAAAa,aAAA,CAACR,2BAA2B;IAACgB,OAAO,EAAEA,CAAA,KAAMV,gBAAgB,CAACF,QAAQ,CAAE;IAACa,MAAM,EAAEV;EAAM,gBAClFZ,KAAA,CAAAa,aAAA,CAACV,uBAAuB,qBACpBH,KAAA,CAAAa,aAAA,CAACd,IAAI;IAACwB,IAAI,EAAEb,UAAU,GAAG,EAAE,GAAG,EAAG;IAACc,KAAK,EAAE,CAAC,YAAY;EAAE,CAAE,CACrC,CAAC,eAC1BxB,KAAA,CAAAa,aAAA,CAACT,oBAAoB;IAACqB,MAAM,EAAEhB,QAAQ,CAACW,YAAY,CAACM;EAAa,gBAC7D1B,KAAA,CAAAa,aAAA;IAAQc,GAAG,EAAElB,QAAQ,CAACW,YAAY,CAACQ,GAAI;IAACC,IAAI,EAAC;EAAW,CAAE,CACxC,CACG,CAAC,gBAE9B7B,KAAA,CAAAa,aAAA,CAACX,2BAA2B;IAACmB,OAAO,EAAEA,CAAA,KAAMV,gBAAgB,CAACF,QAAQ,CAAE;IAACa,MAAM,EAAEV;EAAM,gBAClFZ,KAAA,CAAAa,aAAA,CAACZ,oBAAoB;IAAC6B,SAAS,EAAE,KAAM;IAACH,GAAG,EAAElB,QAAQ,CAACW,YAAY,EAAEQ;EAAI,CAAE,CACjD,CAEd,CAAC;AAAA,CAC3B;AAEDrB,SAAS,CAACwB,WAAW,GAAG,WAAW;AAEnC,eAAexB,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { motion } from 'framer-motion';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
export const StyledMotionMediaItem = styled(motion.div)`
|
|
4
|
+
display: flex;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
`;
|
|
8
|
+
export const StyledMediaItemVideoWrapper = styled.div`
|
|
9
|
+
display: flex;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
aspect-ratio: ${_ref => {
|
|
13
|
+
let {
|
|
14
|
+
$ratio
|
|
15
|
+
} = _ref;
|
|
16
|
+
return $ratio;
|
|
17
|
+
}};
|
|
18
|
+
`;
|
|
19
|
+
export const StyledMediaItemImageWrapper = styled.div`
|
|
20
|
+
display: flex;
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
aspect-ratio: ${_ref2 => {
|
|
24
|
+
let {
|
|
25
|
+
$ratio
|
|
26
|
+
} = _ref2;
|
|
27
|
+
return $ratio;
|
|
28
|
+
}};
|
|
29
|
+
`;
|
|
30
|
+
export const StyledMediaItemImage = styled.img`
|
|
31
|
+
background-color: ${_ref3 => {
|
|
32
|
+
let {
|
|
33
|
+
theme
|
|
34
|
+
} = _ref3;
|
|
35
|
+
return theme['101'];
|
|
36
|
+
}};
|
|
37
|
+
box-shadow: 0 0 0 1px rgba(${_ref4 => {
|
|
38
|
+
let {
|
|
39
|
+
theme
|
|
40
|
+
} = _ref4;
|
|
41
|
+
return theme['009-rgb'];
|
|
42
|
+
}}, 0.08)
|
|
43
|
+
inset;
|
|
44
|
+
z-index: 1;
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 100%;
|
|
47
|
+
object-fit: cover;
|
|
48
|
+
`;
|
|
49
|
+
export const StyledMediaItemVideo = styled.video`
|
|
50
|
+
background-color: ${_ref5 => {
|
|
51
|
+
let {
|
|
52
|
+
theme
|
|
53
|
+
} = _ref5;
|
|
54
|
+
return theme['101'];
|
|
55
|
+
}};
|
|
56
|
+
box-shadow: 0 0 0 1px rgba(${_ref6 => {
|
|
57
|
+
let {
|
|
58
|
+
theme
|
|
59
|
+
} = _ref6;
|
|
60
|
+
return theme['009-rgb'];
|
|
61
|
+
}}, 0.08)
|
|
62
|
+
inset;
|
|
63
|
+
width: 100%;
|
|
64
|
+
object-fit: cover;
|
|
65
|
+
`;
|
|
66
|
+
export const StyledMediaItemPlayIcon = styled.div`
|
|
67
|
+
position: absolute;
|
|
68
|
+
z-index: 2;
|
|
69
|
+
top: 50%;
|
|
70
|
+
left: 50%;
|
|
71
|
+
transform: translate(-50%, -50%);
|
|
72
|
+
`;
|
|
73
|
+
//# sourceMappingURL=MediaItem.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MediaItem.styles.js","names":["motion","styled","StyledMotionMediaItem","div","StyledMediaItemVideoWrapper","_ref","$ratio","StyledMediaItemImageWrapper","_ref2","StyledMediaItemImage","img","_ref3","theme","_ref4","StyledMediaItemVideo","video","_ref5","_ref6","StyledMediaItemPlayIcon"],"sources":["../../../../../src/components/gallery-item/media-item/MediaItem.styles.ts"],"sourcesContent":["import type { FramerMotionBugFix, WithTheme } from '@chayns-components/core';\nimport { motion } from 'framer-motion';\nimport styled from 'styled-components';\n\nexport const StyledMotionMediaItem = styled(motion.div)<FramerMotionBugFix>`\n display: flex;\n width: 100%;\n height: 100%;\n`;\n\nexport const StyledMediaItemVideoWrapper = styled.div<{ $ratio: number }>`\n display: flex;\n width: 100%;\n height: 100%;\n aspect-ratio: ${({ $ratio }) => $ratio};\n`;\n\nexport const StyledMediaItemImageWrapper = styled.div<{ $ratio: number }>`\n display: flex;\n width: 100%;\n height: 100%;\n aspect-ratio: ${({ $ratio }) => $ratio};\n`;\n\ntype StyledMediaItemVideoProps = WithTheme<unknown>;\n\ntype StyledMediaItemImageProps = WithTheme<unknown>;\n\nexport const StyledMediaItemImage = styled.img<StyledMediaItemImageProps>`\n background-color: ${({ theme }: StyledMediaItemImageProps) => theme['101']};\n box-shadow: 0 0 0 1px rgba(${({ theme }: StyledMediaItemImageProps) => theme['009-rgb']}, 0.08)\n inset;\n z-index: 1;\n width: 100%;\n height: 100%;\n object-fit: cover;\n`;\n\nexport const StyledMediaItemVideo = styled.video<StyledMediaItemVideoProps>`\n background-color: ${({ theme }: StyledMediaItemVideoProps) => theme['101']};\n box-shadow: 0 0 0 1px rgba(${({ theme }: StyledMediaItemVideoProps) => theme['009-rgb']}, 0.08)\n inset;\n width: 100%;\n object-fit: cover;\n`;\n\nexport const StyledMediaItemPlayIcon = styled.div`\n position: absolute;\n z-index: 2;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n`;\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,eAAe;AACtC,OAAOC,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,qBAAqB,GAAGD,MAAM,CAACD,MAAM,CAACG,GAAG,CAAqB;AAC3E;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,2BAA2B,GAAGH,MAAM,CAACE,GAAuB;AACzE;AACA;AACA;AACA,oBAAoBE,IAAA;EAAA,IAAC;IAAEC;EAAO,CAAC,GAAAD,IAAA;EAAA,OAAKC,MAAM;AAAA;AAC1C,CAAC;AAED,OAAO,MAAMC,2BAA2B,GAAGN,MAAM,CAACE,GAAuB;AACzE;AACA;AACA;AACA,oBAAoBK,KAAA;EAAA,IAAC;IAAEF;EAAO,CAAC,GAAAE,KAAA;EAAA,OAAKF,MAAM;AAAA;AAC1C,CAAC;AAMD,OAAO,MAAMG,oBAAoB,GAAGR,MAAM,CAACS,GAA8B;AACzE,wBAAwBC,KAAA;EAAA,IAAC;IAAEC;EAAiC,CAAC,GAAAD,KAAA;EAAA,OAAKC,KAAK,CAAC,KAAK,CAAC;AAAA;AAC9E,iCAAiCC,KAAA;EAAA,IAAC;IAAED;EAAiC,CAAC,GAAAC,KAAA;EAAA,OAAKD,KAAK,CAAC,SAAS,CAAC;AAAA;AAC3F;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAME,oBAAoB,GAAGb,MAAM,CAACc,KAAgC;AAC3E,wBAAwBC,KAAA;EAAA,IAAC;IAAEJ;EAAiC,CAAC,GAAAI,KAAA;EAAA,OAAKJ,KAAK,CAAC,KAAK,CAAC;AAAA;AAC9E,iCAAiCK,KAAA;EAAA,IAAC;IAAEL;EAAiC,CAAC,GAAAK,KAAA;EAAA,OAAKL,KAAK,CAAC,SAAS,CAAC;AAAA;AAC3F;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMM,uBAAuB,GAAGjB,MAAM,CAACE,GAAG;AACjD;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { SmallWaitCursor } from '@chayns-components/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { StyledMotionPreviewItem, StyledPreviewItemImage, StyledPreviewItemImageWrapper, StyledPreviewItemLoadingIcon } from './PreviewItem.styles';
|
|
4
|
+
const PreviewItem = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
fileItem,
|
|
7
|
+
ratio
|
|
8
|
+
} = _ref;
|
|
9
|
+
return /*#__PURE__*/React.createElement(StyledMotionPreviewItem, {
|
|
10
|
+
animate: {
|
|
11
|
+
opacity: 1
|
|
12
|
+
},
|
|
13
|
+
initial: {
|
|
14
|
+
opacity: 0
|
|
15
|
+
},
|
|
16
|
+
exit: {
|
|
17
|
+
opacity: 0,
|
|
18
|
+
transition: {
|
|
19
|
+
duration: 3.2,
|
|
20
|
+
delay: 3.2
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
transition: {
|
|
24
|
+
duration: 3.2
|
|
25
|
+
},
|
|
26
|
+
style: {
|
|
27
|
+
position: 'absolute'
|
|
28
|
+
}
|
|
29
|
+
}, /*#__PURE__*/React.createElement(StyledPreviewItemImageWrapper, {
|
|
30
|
+
$ratio: ratio
|
|
31
|
+
}, /*#__PURE__*/React.createElement(StyledPreviewItemLoadingIcon, null, /*#__PURE__*/React.createElement(SmallWaitCursor, {
|
|
32
|
+
shouldHideWaitCursor: false,
|
|
33
|
+
shouldHideBackground: true
|
|
34
|
+
})), /*#__PURE__*/React.createElement(StyledPreviewItemImage, {
|
|
35
|
+
draggable: false,
|
|
36
|
+
src: fileItem.previewUrl
|
|
37
|
+
})));
|
|
38
|
+
};
|
|
39
|
+
PreviewItem.displayName = 'PreviewItem';
|
|
40
|
+
export default PreviewItem;
|
|
41
|
+
//# sourceMappingURL=PreviewItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviewItem.js","names":["SmallWaitCursor","React","StyledMotionPreviewItem","StyledPreviewItemImage","StyledPreviewItemImageWrapper","StyledPreviewItemLoadingIcon","PreviewItem","_ref","fileItem","ratio","createElement","animate","opacity","initial","exit","transition","duration","delay","style","position","$ratio","shouldHideWaitCursor","shouldHideBackground","draggable","src","previewUrl","displayName"],"sources":["../../../../../src/components/gallery-item/preview-item/PreviewItem.tsx"],"sourcesContent":["import { InternalFileItem, SmallWaitCursor } from '@chayns-components/core';\nimport React, { FC } from 'react';\nimport {\n StyledMotionPreviewItem,\n StyledPreviewItemImage,\n StyledPreviewItemImageWrapper,\n StyledPreviewItemLoadingIcon,\n} from './PreviewItem.styles';\n\nexport type PreviewItemProps = {\n /**\n * Images and videos which should be displayed\n */\n fileItem: InternalFileItem;\n /**\n * The ratio of the image\n */\n ratio: number;\n};\n\nconst PreviewItem: FC<PreviewItemProps> = ({ fileItem, ratio }) => (\n <StyledMotionPreviewItem\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 <StyledPreviewItemImageWrapper $ratio={ratio}>\n <StyledPreviewItemLoadingIcon>\n <SmallWaitCursor shouldHideWaitCursor={false} shouldHideBackground />\n </StyledPreviewItemLoadingIcon>\n <StyledPreviewItemImage draggable={false} src={fileItem.previewUrl} />\n </StyledPreviewItemImageWrapper>\n </StyledMotionPreviewItem>\n);\n\nPreviewItem.displayName = 'PreviewItem';\n\nexport default PreviewItem;\n"],"mappings":"AAAA,SAA2BA,eAAe,QAAQ,yBAAyB;AAC3E,OAAOC,KAAK,MAAc,OAAO;AACjC,SACIC,uBAAuB,EACvBC,sBAAsB,EACtBC,6BAA6B,EAC7BC,4BAA4B,QACzB,sBAAsB;AAa7B,MAAMC,WAAiC,GAAGC,IAAA;EAAA,IAAC;IAAEC,QAAQ;IAAEC;EAAM,CAAC,GAAAF,IAAA;EAAA,oBAC1DN,KAAA,CAAAS,aAAA,CAACR,uBAAuB;IACpBS,OAAO,EAAE;MAAEC,OAAO,EAAE;IAAE,CAAE;IACxBC,OAAO,EAAE;MAAED,OAAO,EAAE;IAAE,CAAE;IACxBE,IAAI,EAAE;MACFF,OAAO,EAAE,CAAC;MACVG,UAAU,EAAE;QAAEC,QAAQ,EAAE,GAAG;QAAEC,KAAK,EAAE;MAAI;IAC5C,CAAE;IACFF,UAAU,EAAE;MAAEC,QAAQ,EAAE;IAAI,CAAE;IAC9BE,KAAK,EAAE;MAAEC,QAAQ,EAAE;IAAW;EAAE,gBAEhClB,KAAA,CAAAS,aAAA,CAACN,6BAA6B;IAACgB,MAAM,EAAEX;EAAM,gBACzCR,KAAA,CAAAS,aAAA,CAACL,4BAA4B,qBACzBJ,KAAA,CAAAS,aAAA,CAACV,eAAe;IAACqB,oBAAoB,EAAE,KAAM;IAACC,oBAAoB;EAAA,CAAE,CAC1C,CAAC,eAC/BrB,KAAA,CAAAS,aAAA,CAACP,sBAAsB;IAACoB,SAAS,EAAE,KAAM;IAACC,GAAG,EAAEhB,QAAQ,CAACiB;EAAW,CAAE,CAC1C,CACV,CAAC;AAAA,CAC7B;AAEDnB,WAAW,CAACoB,WAAW,GAAG,aAAa;AAEvC,eAAepB,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { motion } from 'framer-motion';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
export const StyledMotionPreviewItem = styled(motion.div)`
|
|
4
|
+
display: flex;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
`;
|
|
8
|
+
export const StyledPreviewItemImageWrapper = styled.div`
|
|
9
|
+
display: flex;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
aspect-ratio: ${_ref => {
|
|
13
|
+
let {
|
|
14
|
+
$ratio
|
|
15
|
+
} = _ref;
|
|
16
|
+
return $ratio;
|
|
17
|
+
}};
|
|
18
|
+
`;
|
|
19
|
+
export const StyledPreviewItemImage = styled.img`
|
|
20
|
+
background-color: ${_ref2 => {
|
|
21
|
+
let {
|
|
22
|
+
theme
|
|
23
|
+
} = _ref2;
|
|
24
|
+
return theme['101'];
|
|
25
|
+
}};
|
|
26
|
+
box-shadow: 0 0 0 1px
|
|
27
|
+
rgba(${_ref3 => {
|
|
28
|
+
let {
|
|
29
|
+
theme
|
|
30
|
+
} = _ref3;
|
|
31
|
+
return theme['009-rgb'];
|
|
32
|
+
}}, 0.08) inset;
|
|
33
|
+
z-index: 1;
|
|
34
|
+
width: 100%;
|
|
35
|
+
height: 100%;
|
|
36
|
+
object-fit: cover;
|
|
37
|
+
`;
|
|
38
|
+
export const StyledPreviewItemLoadingIcon = styled.div`
|
|
39
|
+
position: absolute;
|
|
40
|
+
z-index: 2;
|
|
41
|
+
top: 50%;
|
|
42
|
+
left: 50%;
|
|
43
|
+
transform: translate(-50%, -50%);
|
|
44
|
+
`;
|
|
45
|
+
//# sourceMappingURL=PreviewItem.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviewItem.styles.js","names":["motion","styled","StyledMotionPreviewItem","div","StyledPreviewItemImageWrapper","_ref","$ratio","StyledPreviewItemImage","img","_ref2","theme","_ref3","StyledPreviewItemLoadingIcon"],"sources":["../../../../../src/components/gallery-item/preview-item/PreviewItem.styles.ts"],"sourcesContent":["import type { FramerMotionBugFix, WithTheme } from '@chayns-components/core';\nimport { motion } from 'framer-motion';\nimport styled from 'styled-components';\n\nexport const StyledMotionPreviewItem = styled(motion.div)<FramerMotionBugFix>`\n display: flex;\n width: 100%;\n height: 100%;\n`;\n\nexport const StyledPreviewItemImageWrapper = styled.div<{ $ratio: number }>`\n display: flex;\n width: 100%;\n height: 100%;\n aspect-ratio: ${({ $ratio }) => $ratio};\n`;\n\ntype StyledPreviewItemImageProps = WithTheme<unknown>;\n\nexport const StyledPreviewItemImage = styled.img<StyledPreviewItemImageProps>`\n background-color: ${({ theme }: StyledPreviewItemImageProps) => theme['101']};\n box-shadow: 0 0 0 1px\n rgba(${({ theme }: StyledPreviewItemImageProps) => theme['009-rgb']}, 0.08) inset;\n z-index: 1;\n width: 100%;\n height: 100%;\n object-fit: cover;\n`;\n\nexport const StyledPreviewItemLoadingIcon = styled.div`\n position: absolute;\n z-index: 2;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n`;\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,eAAe;AACtC,OAAOC,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,uBAAuB,GAAGD,MAAM,CAACD,MAAM,CAACG,GAAG,CAAqB;AAC7E;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,6BAA6B,GAAGH,MAAM,CAACE,GAAuB;AAC3E;AACA;AACA;AACA,oBAAoBE,IAAA;EAAA,IAAC;IAAEC;EAAO,CAAC,GAAAD,IAAA;EAAA,OAAKC,MAAM;AAAA;AAC1C,CAAC;AAID,OAAO,MAAMC,sBAAsB,GAAGN,MAAM,CAACO,GAAgC;AAC7E,wBAAwBC,KAAA;EAAA,IAAC;IAAEC;EAAmC,CAAC,GAAAD,KAAA;EAAA,OAAKC,KAAK,CAAC,KAAK,CAAC;AAAA;AAChF;AACA,eAAeC,KAAA;EAAA,IAAC;IAAED;EAAmC,CAAC,GAAAC,KAAA;EAAA,OAAKD,KAAK,CAAC,SAAS,CAAC;AAAA;AAC3E;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAME,4BAA4B,GAAGX,MAAM,CAACE,GAAG;AACtD;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","Gallery","GalleryViewMode"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\n\nexport { default as Gallery } from './components/Gallery';\nexport { GalleryViewMode } from './types/gallery';\n"],"mappings":"AAAA;;AAEA,SAASA,OAAO,IAAIC,OAAO,QAAQ,sBAAsB;AACzD,SAASC,eAAe,QAAQ,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gallery.js","names":["GalleryViewMode"],"sources":["../../../src/types/gallery.ts"],"sourcesContent":["export enum GalleryViewMode {\n SQUARE,\n GRID,\n}\n"],"mappings":"AAAA,WAAYA,eAAe,0BAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export const filterDuplicateFile = _ref => {
|
|
2
|
+
let {
|
|
3
|
+
newFile,
|
|
4
|
+
files
|
|
5
|
+
} = _ref;
|
|
6
|
+
const duplicates = files.filter(_ref2 => {
|
|
7
|
+
let {
|
|
8
|
+
file
|
|
9
|
+
} = _ref2;
|
|
10
|
+
return file && file.name === newFile.name && file.size === newFile.size;
|
|
11
|
+
});
|
|
12
|
+
return duplicates.length > 0;
|
|
13
|
+
};
|
|
14
|
+
export const generatePreviewUrl = _ref3 => {
|
|
15
|
+
let {
|
|
16
|
+
callback,
|
|
17
|
+
file
|
|
18
|
+
} = _ref3;
|
|
19
|
+
const reader = new FileReader();
|
|
20
|
+
reader.onload = event => {
|
|
21
|
+
const previewUrl = event.target?.result;
|
|
22
|
+
callback(previewUrl);
|
|
23
|
+
};
|
|
24
|
+
reader.readAsDataURL(file);
|
|
25
|
+
};
|
|
26
|
+
export const generateVideoThumbnail = _ref4 => {
|
|
27
|
+
let {
|
|
28
|
+
file,
|
|
29
|
+
callback
|
|
30
|
+
} = _ref4;
|
|
31
|
+
const canvas = document.createElement('canvas');
|
|
32
|
+
const video = document.createElement('video');
|
|
33
|
+
|
|
34
|
+
// this is important
|
|
35
|
+
video.autoplay = true;
|
|
36
|
+
video.muted = true;
|
|
37
|
+
video.src = URL.createObjectURL(file);
|
|
38
|
+
video.onloadeddata = () => {
|
|
39
|
+
const ctx = canvas.getContext('2d');
|
|
40
|
+
canvas.width = video.videoWidth;
|
|
41
|
+
canvas.height = video.videoHeight;
|
|
42
|
+
ctx?.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
|
|
43
|
+
video.pause();
|
|
44
|
+
callback(canvas.toDataURL('image/png'));
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.js","names":["filterDuplicateFile","_ref","newFile","files","duplicates","filter","_ref2","file","name","size","length","generatePreviewUrl","_ref3","callback","reader","FileReader","onload","event","previewUrl","target","result","readAsDataURL","generateVideoThumbnail","_ref4","canvas","document","createElement","video","autoplay","muted","src","URL","createObjectURL","onloadeddata","ctx","getContext","width","videoWidth","height","videoHeight","drawImage","pause","toDataURL"],"sources":["../../../src/utils/file.ts"],"sourcesContent":["import type { InternalFileItem } from '@chayns-components/core';\n\ninterface FilerDuplicateFileOptions {\n files: InternalFileItem[];\n newFile: File;\n}\n\nexport const filterDuplicateFile = ({ newFile, files }: FilerDuplicateFileOptions) => {\n const duplicates = files.filter(\n ({ file }) => file && file.name === newFile.name && file.size === newFile.size,\n );\n\n return duplicates.length > 0;\n};\n\ninterface GeneratePreviewUrlOptions {\n file: File;\n callback: (previewUrl: string) => void;\n}\n\nexport const generatePreviewUrl = ({ callback, file }: GeneratePreviewUrlOptions): void => {\n const reader = new FileReader();\n\n reader.onload = (event) => {\n const previewUrl = event.target?.result as string;\n\n callback(previewUrl);\n };\n\n reader.readAsDataURL(file);\n};\n\ninterface GenerateVideoThumbnailOptions {\n file: File;\n callback: (previewUrl: string) => void;\n}\n\nexport const generateVideoThumbnail = ({ file, callback }: GenerateVideoThumbnailOptions) => {\n const canvas = document.createElement('canvas');\n const video = document.createElement('video');\n\n // this is important\n video.autoplay = true;\n video.muted = true;\n video.src = URL.createObjectURL(file);\n\n video.onloadeddata = () => {\n const ctx = canvas.getContext('2d');\n\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n\n ctx?.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);\n video.pause();\n\n callback(canvas.toDataURL('image/png'));\n };\n};\n"],"mappings":"AAOA,OAAO,MAAMA,mBAAmB,GAAGC,IAAA,IAAmD;EAAA,IAAlD;IAAEC,OAAO;IAAEC;EAAiC,CAAC,GAAAF,IAAA;EAC7E,MAAMG,UAAU,GAAGD,KAAK,CAACE,MAAM,CAC3BC,KAAA;IAAA,IAAC;MAAEC;IAAK,CAAC,GAAAD,KAAA;IAAA,OAAKC,IAAI,IAAIA,IAAI,CAACC,IAAI,KAAKN,OAAO,CAACM,IAAI,IAAID,IAAI,CAACE,IAAI,KAAKP,OAAO,CAACO,IAAI;EAAA,CAClF,CAAC;EAED,OAAOL,UAAU,CAACM,MAAM,GAAG,CAAC;AAChC,CAAC;AAOD,OAAO,MAAMC,kBAAkB,GAAGC,KAAA,IAAyD;EAAA,IAAxD;IAAEC,QAAQ;IAAEN;EAAgC,CAAC,GAAAK,KAAA;EAC5E,MAAME,MAAM,GAAG,IAAIC,UAAU,CAAC,CAAC;EAE/BD,MAAM,CAACE,MAAM,GAAIC,KAAK,IAAK;IACvB,MAAMC,UAAU,GAAGD,KAAK,CAACE,MAAM,EAAEC,MAAgB;IAEjDP,QAAQ,CAACK,UAAU,CAAC;EACxB,CAAC;EAEDJ,MAAM,CAACO,aAAa,CAACd,IAAI,CAAC;AAC9B,CAAC;AAOD,OAAO,MAAMe,sBAAsB,GAAGC,KAAA,IAAuD;EAAA,IAAtD;IAAEhB,IAAI;IAAEM;EAAwC,CAAC,GAAAU,KAAA;EACpF,MAAMC,MAAM,GAAGC,QAAQ,CAACC,aAAa,CAAC,QAAQ,CAAC;EAC/C,MAAMC,KAAK,GAAGF,QAAQ,CAACC,aAAa,CAAC,OAAO,CAAC;;EAE7C;EACAC,KAAK,CAACC,QAAQ,GAAG,IAAI;EACrBD,KAAK,CAACE,KAAK,GAAG,IAAI;EAClBF,KAAK,CAACG,GAAG,GAAGC,GAAG,CAACC,eAAe,CAACzB,IAAI,CAAC;EAErCoB,KAAK,CAACM,YAAY,GAAG,MAAM;IACvB,MAAMC,GAAG,GAAGV,MAAM,CAACW,UAAU,CAAC,IAAI,CAAC;IAEnCX,MAAM,CAACY,KAAK,GAAGT,KAAK,CAACU,UAAU;IAC/Bb,MAAM,CAACc,MAAM,GAAGX,KAAK,CAACY,WAAW;IAEjCL,GAAG,EAAEM,SAAS,CAACb,KAAK,EAAE,CAAC,EAAE,CAAC,EAAEA,KAAK,CAACU,UAAU,EAAEV,KAAK,CAACY,WAAW,CAAC;IAChEZ,KAAK,CAACc,KAAK,CAAC,CAAC;IAEb5B,QAAQ,CAACW,MAAM,CAACkB,SAAS,CAAC,WAAW,CAAC,CAAC;EAC3C,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type FileItem } from '@chayns-components/core';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
import { GalleryViewMode } from '../types/gallery';
|
|
4
|
+
export type GalleryProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Whether drag and drop is allowed or not
|
|
7
|
+
*/
|
|
8
|
+
allowDragAndDrop?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* The message that should be displayed if a File is already given.
|
|
11
|
+
*/
|
|
12
|
+
doubleFileDialogMessage?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The minimum width of a file in the edit mode
|
|
15
|
+
*/
|
|
16
|
+
fileMinWidth?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Images and videos which should be displayed
|
|
19
|
+
*/
|
|
20
|
+
files?: FileItem[];
|
|
21
|
+
/**
|
|
22
|
+
* Whether images and videos can be edited
|
|
23
|
+
*/
|
|
24
|
+
isEditMode?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The maximum amount of images and videos that can be uploaded.
|
|
27
|
+
*/
|
|
28
|
+
maxFiles?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Function to be executed when files are added and uploaded
|
|
31
|
+
*/
|
|
32
|
+
onAdd?: (file: FileItem) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Function to be executed when the count of files are changed. Needed to check if all files are uploaded
|
|
35
|
+
*/
|
|
36
|
+
onFileCountChange?: (fileCount: number) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Function to be executed when a file is removed
|
|
39
|
+
*/
|
|
40
|
+
onRemove?: (file: FileItem) => void;
|
|
41
|
+
/**
|
|
42
|
+
* The mode how the images should be displayed.
|
|
43
|
+
*/
|
|
44
|
+
viewMode?: GalleryViewMode;
|
|
45
|
+
};
|
|
46
|
+
declare const Gallery: FC<GalleryProps>;
|
|
47
|
+
export default Gallery;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GalleryViewMode } from '../types/gallery';
|
|
2
|
+
export declare const StyledGallery: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
+
export declare const StyledGalleryItemWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
4
|
+
$uploadedFileLength: number;
|
|
5
|
+
$ratio: number;
|
|
6
|
+
$viewMode: GalleryViewMode;
|
|
7
|
+
}>> & string;
|
|
8
|
+
export declare const StyledGalleryEditModeWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
9
|
+
$fileMinWidth: number;
|
|
10
|
+
}>> & string;
|
|
@@ -0,0 +1,4 @@
|
|
|
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>, {
|
|
3
|
+
theme: import("@chayns-components/core/lib/types/components/color-scheme-provider/ColorSchemeProvider").Theme;
|
|
4
|
+
}>> & string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type InternalFileItem } from '@chayns-components/core';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
export type GalleryItemProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Images and videos which should be displayed
|
|
6
|
+
*/
|
|
7
|
+
fileItem: InternalFileItem;
|
|
8
|
+
/**
|
|
9
|
+
* Whether images and videos can be edited
|
|
10
|
+
*/
|
|
11
|
+
isEditMode: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Function to be executed when a file is deleted
|
|
14
|
+
*/
|
|
15
|
+
handleDeleteFile: (id?: string) => void;
|
|
16
|
+
/**
|
|
17
|
+
* The ratio of the image
|
|
18
|
+
*/
|
|
19
|
+
ratio?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Length of the uploaded files
|
|
22
|
+
*/
|
|
23
|
+
remainingItemsLength?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Function to be executed if a file should be opened
|
|
26
|
+
*/
|
|
27
|
+
onClick: (file: InternalFileItem) => void;
|
|
28
|
+
};
|
|
29
|
+
declare const GalleryItem: FC<GalleryItemProps>;
|
|
30
|
+
export default GalleryItem;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const StyledGalleryItem: 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 StyledGalleryItemDeleteButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
|
3
|
+
theme: import("@chayns-components/core/lib/types/components/color-scheme-provider/ColorSchemeProvider").Theme;
|
|
4
|
+
}>> & string;
|
|
5
|
+
export declare const StyledGalleryItemMoreItemsIndicator: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type InternalFileItem } from '@chayns-components/core';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
export type MediaItemProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Images and videos which should be displayed
|
|
6
|
+
*/
|
|
7
|
+
fileItem: InternalFileItem;
|
|
8
|
+
/**
|
|
9
|
+
* Whether images and videos can be edited
|
|
10
|
+
*/
|
|
11
|
+
isEditMode: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Function to be executed when a file is selected
|
|
14
|
+
*/
|
|
15
|
+
openSelectedFile: (file: InternalFileItem) => void;
|
|
16
|
+
/**
|
|
17
|
+
* The ratio of the image
|
|
18
|
+
*/
|
|
19
|
+
ratio: number;
|
|
20
|
+
};
|
|
21
|
+
declare const MediaItem: FC<MediaItemProps>;
|
|
22
|
+
export default MediaItem;
|