@linktr.ee/messaging-react 1.31.0 → 1.32.1-rc-1777007852
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/dist/Card-1CQEn-OT.js +171 -0
- package/dist/Card-1CQEn-OT.js.map +1 -0
- package/dist/Card-ClE_iExA.js +177 -0
- package/dist/Card-ClE_iExA.js.map +1 -0
- package/dist/{MediaPlayer-BCsdmsON.js → MediaPlayer-B9Ws2NeE.js} +115 -135
- package/dist/MediaPlayer-B9Ws2NeE.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +79 -63
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChannelView.stories.tsx +38 -7
- package/src/components/CustomMessageInput/CustomMessageInput.test.tsx +127 -0
- package/src/components/CustomMessageInput/index.tsx +25 -8
- package/src/components/LockedAttachment/LockedAttachment.stories.tsx +136 -93
- package/src/components/LockedAttachment/components/Creator/Card.tsx +106 -106
- package/src/components/LockedAttachment/components/Creator/CardThumbnail.tsx +114 -0
- package/src/components/LockedAttachment/components/MediaPlayer.tsx +80 -66
- package/src/components/LockedAttachment/components/Visitor/Card.tsx +53 -78
- package/src/components/LockedAttachment/components/Visitor/CardActions.tsx +3 -3
- package/src/components/LockedAttachment/components/Visitor/CardThumbnail.tsx +81 -0
- package/src/components/LockedAttachment/types.ts +2 -0
- package/dist/Card-C5t3dZ5q.js +0 -350
- package/dist/Card-C5t3dZ5q.js.map +0 -1
- package/dist/Card-Cn2va-Qr.js +0 -205
- package/dist/Card-Cn2va-Qr.js.map +0 -1
- package/dist/MediaPlayer-BCsdmsON.js.map +0 -1
- package/src/components/LockedAttachment/components/Creator/CardAudioPreview.tsx +0 -161
- package/src/components/LockedAttachment/components/Creator/CardCollapsedThumbnail.tsx +0 -58
- package/src/components/LockedAttachment/components/Creator/CardImagePreview.tsx +0 -56
- package/src/components/LockedAttachment/components/Creator/CardVideoPreview.tsx +0 -91
- package/src/components/LockedAttachment/components/Visitor/CardImagePreview.tsx +0 -39
- package/src/components/LockedAttachment/components/Visitor/CardMediaPreview.tsx +0 -36
- package/src/components/LockedAttachment/components/Visitor/CardThumbnailPreview.tsx +0 -45
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { EyeIcon, EyeSlashIcon } from '@phosphor-icons/react'
|
|
2
|
-
import classNames from 'classnames'
|
|
3
|
-
import React, { useState } from 'react'
|
|
4
|
-
|
|
5
|
-
import { renderTypeIcon } from '../../utils/icons'
|
|
6
|
-
import MediaPlayer from '../MediaPlayer'
|
|
7
|
-
|
|
8
|
-
import CollapsedThumbnail from './CardCollapsedThumbnail'
|
|
9
|
-
|
|
10
|
-
interface VideoPreviewProps {
|
|
11
|
-
sourceUrl?: string
|
|
12
|
-
thumbnailUrl?: string
|
|
13
|
-
mimeType: string
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const VideoPreview: React.FC<VideoPreviewProps> = (props) => {
|
|
17
|
-
const { sourceUrl, thumbnailUrl, mimeType } = props
|
|
18
|
-
const [expanded, setExpanded] = useState(false)
|
|
19
|
-
|
|
20
|
-
const collapse = () => {
|
|
21
|
-
setExpanded(false)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (!sourceUrl) {
|
|
25
|
-
return (
|
|
26
|
-
<CollapsedThumbnail thumbnailUrl={thumbnailUrl} mimeType={mimeType} />
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<div
|
|
32
|
-
className={classNames('relative overflow-hidden', {
|
|
33
|
-
'aspect-video': !expanded,
|
|
34
|
-
})}
|
|
35
|
-
>
|
|
36
|
-
<MediaPlayer
|
|
37
|
-
source={sourceUrl}
|
|
38
|
-
mimeType={mimeType}
|
|
39
|
-
poster={thumbnailUrl}
|
|
40
|
-
playing={expanded}
|
|
41
|
-
loop={true}
|
|
42
|
-
controls={false}
|
|
43
|
-
muted={true}
|
|
44
|
-
showProgress={true}
|
|
45
|
-
onContainerClick={collapse}
|
|
46
|
-
/>
|
|
47
|
-
{!expanded && (
|
|
48
|
-
<button
|
|
49
|
-
type="button"
|
|
50
|
-
className="absolute inset-0 block cursor-pointer border-0 p-0 text-left appearance-none"
|
|
51
|
-
onClick={() => setExpanded(true)}
|
|
52
|
-
aria-label="Expand video preview"
|
|
53
|
-
>
|
|
54
|
-
{thumbnailUrl ? (
|
|
55
|
-
<img
|
|
56
|
-
src={thumbnailUrl}
|
|
57
|
-
alt=""
|
|
58
|
-
className="absolute inset-0 h-full w-full object-cover"
|
|
59
|
-
/>
|
|
60
|
-
) : (
|
|
61
|
-
<div className="absolute inset-0 flex items-center justify-center">
|
|
62
|
-
{renderTypeIcon(mimeType, {
|
|
63
|
-
className: 'size-12 text-black/20',
|
|
64
|
-
weight: 'regular',
|
|
65
|
-
})}
|
|
66
|
-
</div>
|
|
67
|
-
)}
|
|
68
|
-
<div className="pointer-events-none absolute left-3 top-3 flex size-8 items-center justify-center rounded-full bg-black/60 text-white">
|
|
69
|
-
<EyeSlashIcon className="size-4" weight="fill" />
|
|
70
|
-
</div>
|
|
71
|
-
</button>
|
|
72
|
-
)}
|
|
73
|
-
{expanded && <CloseButton onClose={collapse} />}
|
|
74
|
-
</div>
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const CloseButton: React.FC<{ onClose: () => void }> = ({ onClose }) => {
|
|
79
|
-
return (
|
|
80
|
-
<button
|
|
81
|
-
type="button"
|
|
82
|
-
onClick={onClose}
|
|
83
|
-
className="absolute left-3 top-3 z-40 flex size-8 items-center justify-center rounded-full bg-black/60 text-white"
|
|
84
|
-
aria-label="Close preview"
|
|
85
|
-
>
|
|
86
|
-
<EyeIcon className="size-4" weight="fill" />
|
|
87
|
-
</button>
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export default VideoPreview
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
|
|
3
|
-
import ThumbnailPreview from './CardThumbnailPreview'
|
|
4
|
-
|
|
5
|
-
interface ImagePreviewProps {
|
|
6
|
-
sourceUrl?: string
|
|
7
|
-
thumbnailUrl?: string
|
|
8
|
-
mimeType: string
|
|
9
|
-
title?: string
|
|
10
|
-
LockIcon?: React.ElementType
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const ImagePreview: React.FC<ImagePreviewProps> = (props) => {
|
|
14
|
-
const { sourceUrl, thumbnailUrl, mimeType, title, LockIcon } = props
|
|
15
|
-
const [sourceReady, setSourceReady] = useState(false)
|
|
16
|
-
|
|
17
|
-
if (LockIcon != null) {
|
|
18
|
-
return (
|
|
19
|
-
<ThumbnailPreview
|
|
20
|
-
thumbnailUrl={thumbnailUrl}
|
|
21
|
-
mimeType={mimeType}
|
|
22
|
-
LockIcon={LockIcon}
|
|
23
|
-
/>
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<div className="relative overflow-hidden bg-black/5">
|
|
29
|
-
<img
|
|
30
|
-
src={sourceUrl}
|
|
31
|
-
alt={title}
|
|
32
|
-
className={`block w-full transition-opacity duration-300 ${sourceReady ? 'opacity-100' : 'opacity-0'}`}
|
|
33
|
-
onLoad={() => setSourceReady(true)}
|
|
34
|
-
/>
|
|
35
|
-
</div>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default ImagePreview
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
import MediaPlayer from '../MediaPlayer'
|
|
4
|
-
|
|
5
|
-
import ThumbnailPreview from './CardThumbnailPreview'
|
|
6
|
-
|
|
7
|
-
interface MediaPreviewProps {
|
|
8
|
-
sourceUrl?: string
|
|
9
|
-
thumbnailUrl?: string
|
|
10
|
-
mimeType: string
|
|
11
|
-
LockIcon?: React.ElementType
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const MediaPreview: React.FC<MediaPreviewProps> = (props) => {
|
|
15
|
-
const { sourceUrl, thumbnailUrl, mimeType, LockIcon } = props
|
|
16
|
-
|
|
17
|
-
if (LockIcon != null) {
|
|
18
|
-
return (
|
|
19
|
-
<ThumbnailPreview
|
|
20
|
-
thumbnailUrl={thumbnailUrl}
|
|
21
|
-
mimeType={mimeType}
|
|
22
|
-
LockIcon={LockIcon}
|
|
23
|
-
/>
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<MediaPlayer
|
|
29
|
-
source={sourceUrl ?? ''}
|
|
30
|
-
mimeType={mimeType}
|
|
31
|
-
poster={thumbnailUrl}
|
|
32
|
-
/>
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export default MediaPreview
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
import { renderTypeIcon } from '../../utils/icons'
|
|
4
|
-
|
|
5
|
-
interface ThumbnailPreviewProps {
|
|
6
|
-
thumbnailUrl?: string
|
|
7
|
-
mimeType: string
|
|
8
|
-
LockIcon?: React.ElementType
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const ThumbnailPreview: React.FC<ThumbnailPreviewProps> = (props) => {
|
|
12
|
-
const { thumbnailUrl, mimeType, LockIcon } = props
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<div className="relative aspect-video overflow-hidden bg-black/5">
|
|
16
|
-
{thumbnailUrl != null ? (
|
|
17
|
-
<img
|
|
18
|
-
src={thumbnailUrl}
|
|
19
|
-
alt=""
|
|
20
|
-
className="absolute inset-0 h-full w-full object-cover"
|
|
21
|
-
/>
|
|
22
|
-
) : (
|
|
23
|
-
<div className="absolute inset-0 flex items-center justify-center">
|
|
24
|
-
{renderTypeIcon(mimeType, {
|
|
25
|
-
className: 'size-12 text-black/20',
|
|
26
|
-
weight: 'regular',
|
|
27
|
-
})}
|
|
28
|
-
</div>
|
|
29
|
-
)}
|
|
30
|
-
{LockIcon != null ? <LockOverlay icon={LockIcon} /> : null}
|
|
31
|
-
</div>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const LockOverlay: React.FC<{ icon: React.ElementType }> = ({ icon: Icon }) => {
|
|
36
|
-
return (
|
|
37
|
-
<div className="absolute inset-0 bg-black/30">
|
|
38
|
-
<div className="absolute left-3 top-3 flex size-8 items-center justify-center rounded-full bg-black/60">
|
|
39
|
-
<Icon className="size-4 text-white" weight="fill" />
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export default ThumbnailPreview
|