@connectycube/react-ui-kit 0.0.18 → 0.0.20
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/configs/dependencies.json +12 -0
- package/configs/imports.json +5 -1
- package/dist/index.cjs +1 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -27
- package/dist/index.js.map +1 -1
- package/dist/types/components/attachment.d.ts +45 -0
- package/dist/types/components/attachment.d.ts.map +1 -0
- package/dist/types/components/avatar.d.ts +2 -1
- package/dist/types/components/avatar.d.ts.map +1 -1
- package/dist/types/components/call-message.d.ts +17 -0
- package/dist/types/components/call-message.d.ts.map +1 -0
- package/dist/types/components/chat-message.d.ts +30 -0
- package/dist/types/components/chat-message.d.ts.map +1 -0
- package/dist/types/components/dialog-item.d.ts +4 -4
- package/dist/types/components/dialog-item.d.ts.map +1 -1
- package/dist/types/components/linkify-text.d.ts +6 -1
- package/dist/types/components/linkify-text.d.ts.map +1 -1
- package/dist/types/components/stream-view.d.ts.map +1 -1
- package/dist/types/components/switch.d.ts +6 -0
- package/dist/types/components/switch.d.ts.map +1 -0
- package/dist/types/components/utils.d.ts +1 -0
- package/dist/types/components/utils.d.ts.map +1 -1
- package/dist/types/index.d.ts +24 -4
- package/dist/types/index.d.ts.map +1 -1
- package/gen/components/attachment.jsx +216 -0
- package/gen/components/avatar.jsx +14 -2
- package/gen/components/call-message.jsx +62 -0
- package/gen/components/chat-message.jsx +120 -0
- package/gen/components/dialog-item.jsx +11 -8
- package/gen/components/dismiss-layer.jsx +1 -1
- package/gen/components/file-picker.jsx +2 -2
- package/gen/components/linkify-text.jsx +41 -2
- package/gen/components/stream-view.jsx +1 -5
- package/gen/components/switch.jsx +23 -0
- package/gen/components/utils.js +4 -0
- package/gen/index.js +50 -0
- package/package.json +12 -10
- package/src/components/attachment.tsx +269 -0
- package/src/components/avatar.tsx +4 -2
- package/src/components/call-message.tsx +75 -0
- package/src/components/chat-message.tsx +138 -0
- package/src/components/connectycube-ui/attachment.tsx +269 -0
- package/src/components/connectycube-ui/chat-message.tsx +138 -0
- package/src/components/connectycube-ui/link-preview.tsx +149 -0
- package/src/components/dialog-item.tsx +13 -10
- package/src/components/dismiss-layer.tsx +1 -1
- package/src/components/file-picker.tsx +2 -2
- package/src/components/linkify-text.tsx +44 -3
- package/src/components/stream-view.tsx +1 -5
- package/src/components/switch.tsx +25 -0
- package/src/components/utils.ts +4 -0
- package/src/index.ts +78 -4
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { type LucideProps } from 'lucide-react';
|
|
3
|
+
interface AttachmentProps {
|
|
4
|
+
uid?: string;
|
|
5
|
+
url?: string;
|
|
6
|
+
mimeType?: string;
|
|
7
|
+
pending?: boolean;
|
|
8
|
+
onReady?: (skipOnce?: boolean) => void;
|
|
9
|
+
linkProps?: AttachmentLinkProps;
|
|
10
|
+
containerProps?: React.ComponentProps<'div'>;
|
|
11
|
+
}
|
|
12
|
+
interface AttachmentLinkProps extends React.ComponentProps<'a'>, Omit<AttachmentProps, 'containerProps' & 'mimeType' & 'onReady'> {
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
interface AttachmentImageProps extends React.ComponentProps<'img'>, Omit<AttachmentProps, 'containerProps' & 'mimeType'> {
|
|
16
|
+
}
|
|
17
|
+
interface AttachmentAudioProps extends React.ComponentProps<'audio'>, Omit<AttachmentProps, 'linkProps' & 'mimeType' & 'onReady'> {
|
|
18
|
+
}
|
|
19
|
+
interface AttachmentVideoProps extends React.ComponentProps<'video'>, Omit<AttachmentProps, 'linkProps' & 'mimeType'> {
|
|
20
|
+
maxSize?: number;
|
|
21
|
+
}
|
|
22
|
+
interface AttachmentFileProps extends LucideProps, Omit<AttachmentProps, 'containerProps' & 'mimeType'> {
|
|
23
|
+
name?: string | undefined;
|
|
24
|
+
iconElement?: React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
interface AttachmentFailedProps extends LucideProps, Omit<AttachmentProps, 'linkProps' & 'mimeType'> {
|
|
27
|
+
name?: string | undefined;
|
|
28
|
+
iconElement?: React.ReactNode;
|
|
29
|
+
}
|
|
30
|
+
declare const AttachmentLink: React.ForwardRefExoticComponent<Omit<AttachmentLinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
31
|
+
declare const AttachmentAudio: React.ForwardRefExoticComponent<Omit<AttachmentAudioProps, "ref"> & React.RefAttributes<HTMLAudioElement>>;
|
|
32
|
+
declare const AttachmentVideo: React.ForwardRefExoticComponent<Omit<AttachmentVideoProps, "ref"> & React.RefAttributes<HTMLVideoElement>>;
|
|
33
|
+
declare const AttachmentImage: React.ForwardRefExoticComponent<Omit<AttachmentImageProps, "ref"> & React.RefAttributes<HTMLImageElement>>;
|
|
34
|
+
declare function AttachmentFile({ url, name, pending, iconElement, linkProps, ...props }: AttachmentFileProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
declare namespace AttachmentFile {
|
|
36
|
+
var displayName: string;
|
|
37
|
+
}
|
|
38
|
+
declare function AttachmentFailed({ name, pending, iconElement, containerProps, ...props }: AttachmentFailedProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
declare namespace AttachmentFailed {
|
|
40
|
+
var displayName: string;
|
|
41
|
+
}
|
|
42
|
+
declare function AttachmentBase({ mimeType, ...props }: AttachmentProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
declare const Attachment: React.MemoExoticComponent<typeof AttachmentBase>;
|
|
44
|
+
export { Attachment, AttachmentLink, AttachmentImage, AttachmentAudio, AttachmentVideo, AttachmentFile, AttachmentFailed, type AttachmentLinkProps, type AttachmentImageProps, type AttachmentAudioProps, type AttachmentVideoProps, type AttachmentFileProps, type AttachmentFailedProps, type AttachmentProps, };
|
|
45
|
+
//# sourceMappingURL=attachment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../../../src/components/attachment.tsx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,CAAC,SAAS,CAAC;CAC/B;AAED,UAAU,qBAAsB,SAAQ,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,WAAW,GAAG,UAAU,CAAC;IAClG,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC/B;AAwBD,QAAA,MAAM,cAAc,4GAAyE,CAAC;AAqB9F,QAAA,MAAM,eAAe,4GAA0E,CAAC;AAmDhG,QAAA,MAAM,eAAe,4GAA0E,CAAC;AAgChG,QAAA,MAAM,eAAe,4GAA0E,CAAC;AAIhG,iBAAS,cAAc,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,OAAe,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,mBAAmB,2CA2B5G;kBA3BQ,cAAc;;;AA+BvB,iBAAS,gBAAgB,CAAC,EACxB,IAAqB,EACrB,OAAe,EACf,WAAW,EACX,cAAc,EACd,GAAG,KAAK,EACT,EAAE,qBAAqB,2CAkBvB;kBAxBQ,gBAAgB;;;AA4BzB,iBAAS,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAiB9D;AAED,QAAA,MAAM,UAAU,kDAAuB,CAAC;AAIxC,OAAO,EACL,UAAU,EACV,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,GACrB,CAAC"}
|
|
@@ -4,7 +4,8 @@ import { type PresenceStatus, type PresenceBadgeProps } from './presence';
|
|
|
4
4
|
interface AvatarProps extends AvatarPrimitive.AvatarProps {
|
|
5
5
|
src?: string | undefined;
|
|
6
6
|
name?: string | undefined;
|
|
7
|
-
|
|
7
|
+
fallbackIconElement?: React.ReactNode | undefined;
|
|
8
|
+
online?: boolean | undefined;
|
|
8
9
|
presence?: PresenceStatus;
|
|
9
10
|
onlineProps?: React.ComponentProps<'div'>;
|
|
10
11
|
presenceProps?: PresenceBadgeProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../../src/components/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGzF,UAAU,WAAY,SAAQ,eAAe,CAAC,WAAW;IACvD,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../../src/components/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGzF,UAAU,WAAY,SAAQ,eAAe,CAAC,WAAW;IACvD,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;IAClD,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC1C,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,UAAU,CAAC,EAAE,eAAe,CAAC,gBAAgB,CAAC;IAC9C,aAAa,CAAC,EAAE,eAAe,CAAC,mBAAmB,CAAC;CACrD;AA0DD,QAAA,MAAM,MAAM,+EAA4D,CAAC;AAIzE,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { type LucideProps } from 'lucide-react';
|
|
3
|
+
import { type FormattedDateProps } from './formatted-date';
|
|
4
|
+
interface CallMessageProps extends React.ComponentProps<'div'> {
|
|
5
|
+
signal?: 'reject' | 'notAnswer' | 'hungUp' | 'cancel' | undefined;
|
|
6
|
+
info?: string | undefined;
|
|
7
|
+
duration?: number | undefined;
|
|
8
|
+
fromMe: boolean;
|
|
9
|
+
isLast: boolean;
|
|
10
|
+
iconElement?: React.ReactNode;
|
|
11
|
+
iconProps?: LucideProps;
|
|
12
|
+
infoProps?: React.ComponentProps<'span'>;
|
|
13
|
+
formattedDateProps?: FormattedDateProps;
|
|
14
|
+
}
|
|
15
|
+
declare const CallMessage: React.NamedExoticComponent<Omit<CallMessageProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export { CallMessage, type CallMessageProps };
|
|
17
|
+
//# sourceMappingURL=call-message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-message.d.ts","sourceRoot":"","sources":["../../../src/components/call-message.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAoD,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAClG,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG1E,UAAU,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC5D,MAAM,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IAClE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,SAAS,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACzC,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAsDD,QAAA,MAAM,WAAW,iGAAsE,CAAC;AAIxF,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { type AttachmentProps } from './attachment';
|
|
3
|
+
import { type AvatarProps } from './avatar';
|
|
4
|
+
import { type FormattedDateProps } from './formatted-date';
|
|
5
|
+
import { type LinkifyTextProps } from './linkify-text';
|
|
6
|
+
import { type LinkPreviewProps } from './link-preview';
|
|
7
|
+
import { type StatusSentProps } from './status-sent';
|
|
8
|
+
interface ChatMessageProps extends React.ComponentProps<'div'> {
|
|
9
|
+
isLast: boolean;
|
|
10
|
+
fromMe: boolean;
|
|
11
|
+
sameSenderAbove: boolean;
|
|
12
|
+
title?: string;
|
|
13
|
+
senderName?: string;
|
|
14
|
+
senderAvatar?: string;
|
|
15
|
+
attachmentElement?: React.ReactNode;
|
|
16
|
+
linkifyTextElement?: React.ReactNode;
|
|
17
|
+
linkPreviewElement?: React.ReactNode;
|
|
18
|
+
onView?: () => void;
|
|
19
|
+
avatarProps?: AvatarProps;
|
|
20
|
+
bubbleProps?: React.ComponentProps<'div'>;
|
|
21
|
+
titleProps?: React.ComponentProps<'span'>;
|
|
22
|
+
formattedDateProps?: FormattedDateProps;
|
|
23
|
+
statusSentProps?: StatusSentProps;
|
|
24
|
+
attachmentProps?: AttachmentProps;
|
|
25
|
+
linkifyTextProps?: LinkifyTextProps;
|
|
26
|
+
linkPreviewProps?: LinkPreviewProps;
|
|
27
|
+
}
|
|
28
|
+
declare const ChatMessage: React.NamedExoticComponent<Omit<ChatMessageProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
29
|
+
export { ChatMessage, type ChatMessageProps };
|
|
30
|
+
//# sourceMappingURL=chat-message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-message.d.ts","sourceRoot":"","sources":["../../../src/components/chat-message.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAGjE,UAAU,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC5D,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACpC,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACrC,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAC1C,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAyGD,QAAA,MAAM,WAAW,iGAAsE,CAAC;AAExF,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import { type LucideProps } from 'lucide-react';
|
|
3
2
|
import { type AvatarProps } from './avatar';
|
|
4
|
-
import { type
|
|
5
|
-
import { type StatusSentProps } from './status-sent';
|
|
3
|
+
import { type LucideProps } from 'lucide-react';
|
|
6
4
|
import { type FormattedDateProps } from './formatted-date';
|
|
5
|
+
import { type StatusSentProps } from './status-sent';
|
|
6
|
+
import { type PresenceStatus } from './presence';
|
|
7
7
|
import { type BadgeProps } from './badge';
|
|
8
8
|
interface DialogItemProps extends React.ComponentProps<'div'> {
|
|
9
9
|
index?: number;
|
|
@@ -42,5 +42,5 @@ interface DialogItemProps extends React.ComponentProps<'div'> {
|
|
|
42
42
|
dividerProps?: React.ComponentProps<'div'>;
|
|
43
43
|
}
|
|
44
44
|
declare const DialogItem: React.NamedExoticComponent<Omit<DialogItemProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
45
|
-
export { DialogItem };
|
|
45
|
+
export { DialogItem, type DialogItemProps };
|
|
46
46
|
//# sourceMappingURL=dialog-item.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-item.d.ts","sourceRoot":"","sources":["../../../src/components/dialog-item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"dialog-item.d.ts","sourceRoot":"","sources":["../../../src/components/dialog-item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAS,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAEjD,UAAU,eAAgB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC3C,YAAY,CAAC,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAA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interface LinkifyTextProps extends React.ComponentProps<'p'> {
|
|
4
|
-
text
|
|
4
|
+
text?: string;
|
|
5
|
+
pending?: boolean;
|
|
6
|
+
onReady?: () => void;
|
|
5
7
|
linkifyProps?: Opts;
|
|
8
|
+
skeletonContainerProps?: React.ComponentProps<'div'>;
|
|
9
|
+
skeletonLineProps?: React.ComponentProps<'span'>;
|
|
10
|
+
skeletonLinesClassNames?: string[];
|
|
6
11
|
}
|
|
7
12
|
declare const LinkifyText: React.NamedExoticComponent<Omit<LinkifyTextProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
8
13
|
export { LinkifyText, type LinkifyTextProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linkify-text.d.ts","sourceRoot":"","sources":["../../../src/components/linkify-text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"linkify-text.d.ts","sourceRoot":"","sources":["../../../src/components/linkify-text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAWtC,UAAU,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,sBAAsB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACrD,iBAAiB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACjD,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;CACpC;AAyDD,QAAA,MAAM,WAAW,uGAA4E,CAAC;AAI9F,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-view.d.ts","sourceRoot":"","sources":["../../../src/components/stream-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAyC,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAGvF,UAAU,eAAgB,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC;IAC7D,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"stream-view.d.ts","sourceRoot":"","sources":["../../../src/components/stream-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAyC,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAGvF,UAAU,eAAgB,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC;IAC7D,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AA+CD,QAAA,MAAM,UAAU,uGAAgE,CAAC;AAWjF,QAAA,MAAM,eAAe,uGAAqE,CAAC;AAW3F,QAAA,MAAM,gBAAgB,uGAAsE,CAAC;AAI7F,UAAU,yBAA0B,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACrE,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IAC7C,UAAU,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IACjD,UAAU,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IAC7C,eAAe,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IACrC,eAAe,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IACrC,cAAc,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC7C,qBAAqB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IACvD,yBAAyB,CAAC,EAAE,WAAW,CAAC;IACxC,QAAQ,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACvC,cAAc,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAChD,kBAAkB,CAAC,EAAE,WAAW,CAAC;CAClC;AAED,UAAU,uBAAwB,SAAQ,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC;IACjE,YAAY,EAAE,OAAO,CAAC;IACtB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,gBAAgB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,sBAAsB,EAAE,MAAM,IAAI,CAAC;CACpC;AAwHD,QAAA,MAAM,oBAAoB,wHAA2F,CAAC;AAItH,OAAO,EACL,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,GAC7B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
3
|
+
type SwitchProps = React.ComponentProps<typeof SwitchPrimitive.Root>;
|
|
4
|
+
declare function Switch(props: SwitchProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export { Switch, type SwitchProps };
|
|
6
|
+
//# sourceMappingURL=switch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/components/switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAG1D,KAAK,WAAW,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;AAErE,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,2CAgBjC;AAED,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAG7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,wBAAgB,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAG7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,wBAAgB,eAAe,CAAC,MAAM,SAAI,GAAG,MAAM,CAElD;AAED,wBAAgB,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
1
|
+
export { AlertDialog, type AlertDialogProps } from './components/alert-dialog';
|
|
2
|
+
export { Attachment, AttachmentLink, AttachmentImage, AttachmentAudio, AttachmentVideo, AttachmentFile, AttachmentFailed, type AttachmentProps, type AttachmentLinkProps, type AttachmentImageProps, type AttachmentAudioProps, type AttachmentVideoProps, type AttachmentFileProps, type AttachmentFailedProps, } from './components/attachment';
|
|
3
|
+
export { Avatar, type AvatarProps } from './components/avatar';
|
|
4
|
+
export { Badge, type BadgeProps } from './components/badge';
|
|
5
|
+
export { Button, type ButtonProps } from './components/button';
|
|
6
|
+
export { CallMessage, type CallMessageProps } from './components/call-message';
|
|
7
|
+
export { ChatMessage, type ChatMessageProps } from './components/chat-message';
|
|
8
|
+
export { DialogItem, type DialogItemProps } from './components/dialog-item';
|
|
9
|
+
export { DismissLayer, type DismissLayerProps } from './components/dismiss-layer';
|
|
10
|
+
export { FilePickerInput, FilePickerDropzone, type FilePickerInputProps, type FilePickerDropzoneProps, } from './components/file-picker';
|
|
11
|
+
export { FormattedDate, type FormattedDateProps } from './components/formatted-date';
|
|
12
|
+
export { Input, type InputProps } from './components/input';
|
|
13
|
+
export { Label, type LabelProps } from './components/label';
|
|
14
|
+
export { LinkPreview, type LinkPreviewProps } from './components/link-preview';
|
|
15
|
+
export { LinkifyText, type LinkifyTextProps } from './components/linkify-text';
|
|
16
|
+
export { PlaceholderText, type PlaceholderTextProps } from './components/placeholder-text';
|
|
17
|
+
export { Presence, PresenceBadge, type PresenceStatus, type PresenceProps, type PresenceBadgeProps, } from './components/presence';
|
|
18
|
+
export { Search, type SearchProps } from './components/search';
|
|
19
|
+
export { Spinner, type SpinnerProps } from './components/spinner';
|
|
20
|
+
export { StatusIndicator, type StatusName, type StatusIndicatorProps } from './components/status-indicator';
|
|
21
|
+
export { StatusSent, type StatusSentProps } from './components/status-sent';
|
|
22
|
+
export { StreamView, LocalStreamView, RemoteStreamView, FullscreenStreamView, type StreamViewProps, type FullscreenStreamViewProps, type FullscreenStreamViewRef, } from './components/stream-view';
|
|
23
|
+
export { Switch, type SwitchProps } from './components/switch';
|
|
24
|
+
export * from './components/utils';
|
|
5
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[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O,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE/E,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAE3F,OAAO,EACL,QAAQ,EACR,aAAa,EACb,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,kBAAkB,GACxB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,eAAe,EAAE,KAAK,UAAU,EAAE,KAAK,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAE5G,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EACL,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,GAC7B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE/D,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { forwardRef, memo, useImperativeHandle, useRef, useState } from 'react';
|
|
2
|
+
import { File, FileXCorner } from 'lucide-react';
|
|
3
|
+
import { Spinner } from './spinner';
|
|
4
|
+
import { cn, getRandomString } from './utils';
|
|
5
|
+
|
|
6
|
+
function AttachmentLinkBase({ url, pending = false, children, ...props }, ref) {
|
|
7
|
+
return (
|
|
8
|
+
<a
|
|
9
|
+
ref={ref}
|
|
10
|
+
target="_blank"
|
|
11
|
+
rel="noopener noreferrer"
|
|
12
|
+
{...props}
|
|
13
|
+
href={url}
|
|
14
|
+
className={cn(
|
|
15
|
+
'group relative min-h-8 min-w-8 w-full flex items-center justify-center rounded-md overflow-hidden bg-ring/10 hover:bg-ring/20 transition-color duration-300 ease-out cursor-pointer',
|
|
16
|
+
props?.className
|
|
17
|
+
)}
|
|
18
|
+
>
|
|
19
|
+
{children}
|
|
20
|
+
<Spinner loading={pending} layout="overlay" />
|
|
21
|
+
</a>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const AttachmentLink = forwardRef(AttachmentLinkBase);
|
|
26
|
+
|
|
27
|
+
AttachmentLink.displayName = 'AttachmentLink';
|
|
28
|
+
|
|
29
|
+
function AttachmentAudioBase({ uid, url, pending = false, containerProps, ...props }, ref) {
|
|
30
|
+
const audioId = `attachment_audio_${uid || getRandomString()}`;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div
|
|
34
|
+
{...containerProps}
|
|
35
|
+
className={cn('relative min-h-8 min-w-8 w-full rounded-md overflow-hidden', containerProps?.className)}
|
|
36
|
+
>
|
|
37
|
+
<audio ref={ref} src={url} id={audioId} controls {...props} />
|
|
38
|
+
<Spinner loading={pending} layout="overlay" />
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const AttachmentAudio = forwardRef(AttachmentAudioBase);
|
|
44
|
+
|
|
45
|
+
function AttachmentVideoBase(
|
|
46
|
+
{ uid, url, maxSize = 360, pending = false, onReady = () => {}, containerProps, ...props },
|
|
47
|
+
ref
|
|
48
|
+
) {
|
|
49
|
+
const videoId = `attachment_video_${uid || getRandomString()}`;
|
|
50
|
+
const videoMaxSize = `${maxSize}px`;
|
|
51
|
+
const playerRef = useRef(null);
|
|
52
|
+
const [style, setStyle] = useState({
|
|
53
|
+
maxHeight: videoMaxSize,
|
|
54
|
+
maxWidth: videoMaxSize,
|
|
55
|
+
});
|
|
56
|
+
const handleCanPlay = (event) => {
|
|
57
|
+
const player = playerRef.current;
|
|
58
|
+
|
|
59
|
+
if (player) {
|
|
60
|
+
const { videoWidth, videoHeight } = player;
|
|
61
|
+
const ratio = videoWidth / videoHeight || 1;
|
|
62
|
+
const height = ratio < 1 ? videoMaxSize : `${Math.round(maxSize / ratio)}px`;
|
|
63
|
+
const width = ratio < 1 ? `${Math.round(maxSize * ratio)}px` : videoMaxSize;
|
|
64
|
+
|
|
65
|
+
setStyle({
|
|
66
|
+
height,
|
|
67
|
+
width,
|
|
68
|
+
maxHeight: height,
|
|
69
|
+
maxWidth: width,
|
|
70
|
+
});
|
|
71
|
+
props.onCanPlay?.(event);
|
|
72
|
+
onReady();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
useImperativeHandle(ref, () => playerRef.current, []);
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<div
|
|
80
|
+
{...containerProps}
|
|
81
|
+
className={cn('relative min-h-20 w-full rounded-md overflow-hidden', containerProps?.className)}
|
|
82
|
+
>
|
|
83
|
+
<video
|
|
84
|
+
id={videoId}
|
|
85
|
+
ref={playerRef}
|
|
86
|
+
src={url}
|
|
87
|
+
controls
|
|
88
|
+
preload="metadata"
|
|
89
|
+
style={style}
|
|
90
|
+
{...props}
|
|
91
|
+
onCanPlay={handleCanPlay}
|
|
92
|
+
className={cn('size-full', props?.className)}
|
|
93
|
+
/>
|
|
94
|
+
<Spinner loading={pending} layout="overlay" />
|
|
95
|
+
</div>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const AttachmentVideo = forwardRef(AttachmentVideoBase);
|
|
100
|
+
|
|
101
|
+
AttachmentVideo.displayName = 'AttachmentVideo';
|
|
102
|
+
|
|
103
|
+
function AttachmentImageBase({ uid, url, pending = false, onReady = () => {}, linkProps, ...props }, ref) {
|
|
104
|
+
const imageId = `attachment_image_${uid || getRandomString()}`;
|
|
105
|
+
const handleLoad = (event) => {
|
|
106
|
+
props.onLoad?.(event);
|
|
107
|
+
onReady();
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<AttachmentLink href={url} pending={pending} {...linkProps}>
|
|
112
|
+
<img
|
|
113
|
+
ref={ref}
|
|
114
|
+
src={url}
|
|
115
|
+
id={imageId}
|
|
116
|
+
alt="attachment"
|
|
117
|
+
{...props}
|
|
118
|
+
className={cn(
|
|
119
|
+
'rounded-md object-cover min-h-8 min-w-8 max-h-[360px] group-hover:scale-102 transition-transform duration-300 ease-out',
|
|
120
|
+
props?.className
|
|
121
|
+
)}
|
|
122
|
+
onLoad={handleLoad}
|
|
123
|
+
/>
|
|
124
|
+
</AttachmentLink>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const AttachmentImage = forwardRef(AttachmentImageBase);
|
|
129
|
+
|
|
130
|
+
AttachmentImage.displayName = 'AttachmentImage';
|
|
131
|
+
|
|
132
|
+
function AttachmentFile({ url, name, pending = false, iconElement, linkProps, ...props }) {
|
|
133
|
+
const fileId = `attachment_file_${props.id || getRandomString()}`;
|
|
134
|
+
|
|
135
|
+
return (
|
|
136
|
+
<AttachmentLink
|
|
137
|
+
href={url}
|
|
138
|
+
pending={pending}
|
|
139
|
+
{...linkProps}
|
|
140
|
+
className={cn('flex-row gap-1.5 p-2 hover:shadow', linkProps?.className)}
|
|
141
|
+
>
|
|
142
|
+
{iconElement || (
|
|
143
|
+
<File
|
|
144
|
+
id={fileId}
|
|
145
|
+
{...props}
|
|
146
|
+
className={cn(
|
|
147
|
+
'size-5 shrink-0 text-foreground/80 group-hover:text-foreground duration-300 ease-out',
|
|
148
|
+
props?.className
|
|
149
|
+
)}
|
|
150
|
+
/>
|
|
151
|
+
)}
|
|
152
|
+
{name && (
|
|
153
|
+
<span className="font-medium line-clamp-1 break-all text-foreground/80 group-hover:text-foreground duration-300 ease-out">
|
|
154
|
+
{name}
|
|
155
|
+
</span>
|
|
156
|
+
)}
|
|
157
|
+
</AttachmentLink>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
AttachmentFile.displayName = 'AttachmentFile';
|
|
162
|
+
|
|
163
|
+
function AttachmentFailed({ name = 'Unknown file', pending = false, iconElement, containerProps, ...props }) {
|
|
164
|
+
const failedId = `attachment_failed_${props.id || getRandomString()}`;
|
|
165
|
+
|
|
166
|
+
return (
|
|
167
|
+
<div
|
|
168
|
+
{...containerProps}
|
|
169
|
+
className={cn(
|
|
170
|
+
'relative min-h-8 min-w-8 w-full flex flex-row items-center justify-center gap-2 px-2 bg-red-600/10 rounded-md overflow-hidden',
|
|
171
|
+
containerProps?.className
|
|
172
|
+
)}
|
|
173
|
+
>
|
|
174
|
+
{iconElement || (
|
|
175
|
+
<FileXCorner id={failedId} {...props} className={cn('size-6 shrink-0 text-red-600', props?.className)} />
|
|
176
|
+
)}
|
|
177
|
+
<span className="font-medium line-clamp-1 break-all text-red-600">{name}</span>
|
|
178
|
+
<Spinner loading={pending} layout="overlay" />
|
|
179
|
+
</div>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
AttachmentFailed.displayName = 'AttachmentFailed';
|
|
184
|
+
|
|
185
|
+
function AttachmentBase({ mimeType, ...props }) {
|
|
186
|
+
const [type = ''] = mimeType?.split('/') || [];
|
|
187
|
+
|
|
188
|
+
if (!props.url) {
|
|
189
|
+
return <AttachmentFailed {...props} />;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
switch (type) {
|
|
193
|
+
case 'image':
|
|
194
|
+
return <AttachmentImage {...props} />;
|
|
195
|
+
case 'video':
|
|
196
|
+
return <AttachmentVideo {...props} />;
|
|
197
|
+
case 'audio':
|
|
198
|
+
return <AttachmentAudio {...props} />;
|
|
199
|
+
default:
|
|
200
|
+
return <AttachmentFile name={mimeType} {...props} />;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const Attachment = memo(AttachmentBase);
|
|
205
|
+
|
|
206
|
+
Attachment.displayName = 'Attachment';
|
|
207
|
+
|
|
208
|
+
export {
|
|
209
|
+
Attachment,
|
|
210
|
+
AttachmentLink,
|
|
211
|
+
AttachmentImage,
|
|
212
|
+
AttachmentAudio,
|
|
213
|
+
AttachmentVideo,
|
|
214
|
+
AttachmentFile,
|
|
215
|
+
AttachmentFailed,
|
|
216
|
+
};
|
|
@@ -11,7 +11,19 @@ function getInitialsFromName(name) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
function AvatarBase(
|
|
14
|
-
{
|
|
14
|
+
{
|
|
15
|
+
src,
|
|
16
|
+
name = 'NA',
|
|
17
|
+
fallbackIconElement,
|
|
18
|
+
online,
|
|
19
|
+
presence,
|
|
20
|
+
className,
|
|
21
|
+
onlineProps,
|
|
22
|
+
presenceProps,
|
|
23
|
+
imageProps,
|
|
24
|
+
fallbackProps,
|
|
25
|
+
...props
|
|
26
|
+
},
|
|
15
27
|
ref
|
|
16
28
|
) {
|
|
17
29
|
const initials = getInitialsFromName(name);
|
|
@@ -27,7 +39,7 @@ function AvatarBase(
|
|
|
27
39
|
{...fallbackProps}
|
|
28
40
|
className={cn('bg-muted size-full rounded-full flex items-center justify-center', fallbackProps?.className)}
|
|
29
41
|
>
|
|
30
|
-
{initials}
|
|
42
|
+
{fallbackIconElement || initials}
|
|
31
43
|
</AvatarPrimitive.Fallback>
|
|
32
44
|
{online && (
|
|
33
45
|
<div
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { forwardRef, memo } from 'react';
|
|
2
|
+
import { Phone, PhoneIncoming, PhoneMissed, PhoneOutgoing } from 'lucide-react';
|
|
3
|
+
import { FormattedDate } from './formatted-date';
|
|
4
|
+
import { cn } from './utils';
|
|
5
|
+
|
|
6
|
+
function formatDuration(seconds) {
|
|
7
|
+
const h = Math.floor(seconds / 3600);
|
|
8
|
+
const m = Math.floor((seconds % 3600) / 60);
|
|
9
|
+
const s = seconds % 60;
|
|
10
|
+
const pad = (num) => String(num).padStart(2, '0');
|
|
11
|
+
|
|
12
|
+
return h > 0 ? `${h}:${pad(m)}:${pad(s)}` : `${pad(m)}:${pad(s)}`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function CallMessageBase(
|
|
16
|
+
{
|
|
17
|
+
signal,
|
|
18
|
+
info,
|
|
19
|
+
duration = 0,
|
|
20
|
+
fromMe = false,
|
|
21
|
+
isLast = false,
|
|
22
|
+
iconElement,
|
|
23
|
+
iconProps,
|
|
24
|
+
infoProps,
|
|
25
|
+
formattedDateProps,
|
|
26
|
+
...props
|
|
27
|
+
},
|
|
28
|
+
ref
|
|
29
|
+
) {
|
|
30
|
+
const CallIcon =
|
|
31
|
+
signal === 'hungUp' ? Phone : fromMe ? (signal === 'reject' ? PhoneIncoming : PhoneOutgoing) : PhoneMissed;
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div
|
|
35
|
+
ref={ref}
|
|
36
|
+
{...props}
|
|
37
|
+
className={cn(
|
|
38
|
+
'flex items-center justify-center gap-2 rounded-full w-fit bg-ring/20 mx-auto px-3 py-1.5',
|
|
39
|
+
isLast ? 'my-2' : 'mt-2',
|
|
40
|
+
props?.className
|
|
41
|
+
)}
|
|
42
|
+
>
|
|
43
|
+
{iconElement || (
|
|
44
|
+
<CallIcon
|
|
45
|
+
{...iconProps}
|
|
46
|
+
className={cn('size-4', signal === 'hungUp' ? 'text-green-500' : 'text-red-500', iconProps?.className)}
|
|
47
|
+
/>
|
|
48
|
+
)}
|
|
49
|
+
<span
|
|
50
|
+
{...infoProps}
|
|
51
|
+
className={cn('text-sm mb-px', infoProps?.className)}
|
|
52
|
+
>{`${info}${duration ? ` - ${formatDuration(duration)}` : ''}`}</span>
|
|
53
|
+
<FormattedDate distanceToNow {...formattedDateProps} />
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const CallMessage = memo(forwardRef(CallMessageBase));
|
|
59
|
+
|
|
60
|
+
CallMessage.displayName = 'CallMessage';
|
|
61
|
+
|
|
62
|
+
export { CallMessage };
|