@connectycube/react-ui-kit 0.0.19 → 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 +6 -0
- package/configs/imports.json +2 -0
- package/dist/index.cjs +1 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -35
- package/dist/index.js.map +1 -1
- package/dist/types/components/attachment.d.ts +3 -3
- package/dist/types/components/attachment.d.ts.map +1 -1
- package/dist/types/components/avatar.d.ts +1 -0
- package/dist/types/components/avatar.d.ts.map +1 -1
- package/dist/types/components/badge.d.ts +1 -1
- package/dist/types/components/button.d.ts +2 -2
- 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.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/switch.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/gen/components/attachment.jsx +21 -19
- 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 +4 -1
- package/gen/components/linkify-text.jsx +41 -2
- package/gen/components/switch.jsx +0 -2
- package/gen/index.js +4 -0
- package/package.json +11 -10
- package/src/components/attachment.tsx +25 -26
- package/src/components/avatar.tsx +3 -1
- 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 +4 -1
- package/src/components/linkify-text.tsx +44 -3
- package/src/components/switch.tsx +0 -2
- package/src/index.ts +6 -0
|
@@ -4,7 +4,7 @@ interface AttachmentProps {
|
|
|
4
4
|
uid?: string;
|
|
5
5
|
url?: string;
|
|
6
6
|
mimeType?: string;
|
|
7
|
-
|
|
7
|
+
pending?: boolean;
|
|
8
8
|
onReady?: (skipOnce?: boolean) => void;
|
|
9
9
|
linkProps?: AttachmentLinkProps;
|
|
10
10
|
containerProps?: React.ComponentProps<'div'>;
|
|
@@ -31,11 +31,11 @@ declare const AttachmentLink: React.ForwardRefExoticComponent<Omit<AttachmentLin
|
|
|
31
31
|
declare const AttachmentAudio: React.ForwardRefExoticComponent<Omit<AttachmentAudioProps, "ref"> & React.RefAttributes<HTMLAudioElement>>;
|
|
32
32
|
declare const AttachmentVideo: React.ForwardRefExoticComponent<Omit<AttachmentVideoProps, "ref"> & React.RefAttributes<HTMLVideoElement>>;
|
|
33
33
|
declare const AttachmentImage: React.ForwardRefExoticComponent<Omit<AttachmentImageProps, "ref"> & React.RefAttributes<HTMLImageElement>>;
|
|
34
|
-
declare function AttachmentFile({ url, name,
|
|
34
|
+
declare function AttachmentFile({ url, name, pending, iconElement, linkProps, ...props }: AttachmentFileProps): import("react/jsx-runtime").JSX.Element;
|
|
35
35
|
declare namespace AttachmentFile {
|
|
36
36
|
var displayName: string;
|
|
37
37
|
}
|
|
38
|
-
declare function AttachmentFailed({ name,
|
|
38
|
+
declare function AttachmentFailed({ name, pending, iconElement, containerProps, ...props }: AttachmentFailedProps): import("react/jsx-runtime").JSX.Element;
|
|
39
39
|
declare namespace AttachmentFailed {
|
|
40
40
|
var displayName: string;
|
|
41
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../../../src/components/attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAInE,UAAU,eAAe;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAA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Props } from './presence';
|
|
|
4
4
|
interface AvatarProps extends AvatarPrimitive.AvatarProps {
|
|
5
5
|
src?: string | undefined;
|
|
6
6
|
name?: string | undefined;
|
|
7
|
+
fallbackIconElement?: React.ReactNode | undefined;
|
|
7
8
|
online?: boolean | undefined;
|
|
8
9
|
presence?: PresenceStatus;
|
|
9
10
|
onlineProps?: React.ComponentProps<'div'>;
|
|
@@ -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,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;
|
|
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"}
|
|
@@ -4,7 +4,7 @@ interface BadgeProps extends React.HTMLAttributes<HTMLElement>, VariantProps<typ
|
|
|
4
4
|
asChild?: boolean;
|
|
5
5
|
}
|
|
6
6
|
declare const badgeVariants: (props?: ({
|
|
7
|
-
variant?: "default" | "
|
|
7
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
|
|
8
8
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
9
9
|
declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLElement>>;
|
|
10
10
|
export { Badge, type BadgeProps };
|
|
@@ -4,8 +4,8 @@ interface ButtonProps extends React.ComponentProps<'button'>, VariantProps<typeo
|
|
|
4
4
|
asChild?: boolean;
|
|
5
5
|
}
|
|
6
6
|
declare const buttonVariants: (props?: ({
|
|
7
|
-
variant?: "
|
|
8
|
-
size?: "default" | "
|
|
7
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
8
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
9
9
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
10
10
|
declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
11
11
|
export { Button, type ButtonProps };
|
|
@@ -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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|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { Opts } from 'linkifyjs';
|
|
3
3
|
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":"switch.d.ts","sourceRoot":"","sources":["../../../src/components/switch.tsx"],"names":[],"mappings":"
|
|
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"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
export { AlertDialog, type AlertDialogProps } from './components/alert-dialog';
|
|
1
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';
|
|
2
3
|
export { Avatar, type AvatarProps } from './components/avatar';
|
|
3
4
|
export { Badge, type BadgeProps } from './components/badge';
|
|
4
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';
|
|
5
8
|
export { DialogItem, type DialogItemProps } from './components/dialog-item';
|
|
6
9
|
export { DismissLayer, type DismissLayerProps } from './components/dismiss-layer';
|
|
7
10
|
export { FilePickerInput, FilePickerDropzone, type FilePickerInputProps, type FilePickerDropzoneProps, } from './components/file-picker';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,GAC3B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAElF,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,GAC7B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAErF,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE/E,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE/E,OAAO,EAAE,eAAe,EAAE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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"}
|
|
@@ -3,7 +3,7 @@ import { File, FileXCorner } from 'lucide-react';
|
|
|
3
3
|
import { Spinner } from './spinner';
|
|
4
4
|
import { cn, getRandomString } from './utils';
|
|
5
5
|
|
|
6
|
-
function AttachmentLinkBase({ url,
|
|
6
|
+
function AttachmentLinkBase({ url, pending = false, children, ...props }, ref) {
|
|
7
7
|
return (
|
|
8
8
|
<a
|
|
9
9
|
ref={ref}
|
|
@@ -12,12 +12,12 @@ function AttachmentLinkBase({ url, uploading = false, children, ...props }, ref)
|
|
|
12
12
|
{...props}
|
|
13
13
|
href={url}
|
|
14
14
|
className={cn(
|
|
15
|
-
'group relative min-h-
|
|
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
16
|
props?.className
|
|
17
17
|
)}
|
|
18
18
|
>
|
|
19
19
|
{children}
|
|
20
|
-
<Spinner loading={
|
|
20
|
+
<Spinner loading={pending} layout="overlay" />
|
|
21
21
|
</a>
|
|
22
22
|
);
|
|
23
23
|
}
|
|
@@ -26,16 +26,16 @@ const AttachmentLink = forwardRef(AttachmentLinkBase);
|
|
|
26
26
|
|
|
27
27
|
AttachmentLink.displayName = 'AttachmentLink';
|
|
28
28
|
|
|
29
|
-
function AttachmentAudioBase({ uid, url,
|
|
29
|
+
function AttachmentAudioBase({ uid, url, pending = false, containerProps, ...props }, ref) {
|
|
30
30
|
const audioId = `attachment_audio_${uid || getRandomString()}`;
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
33
|
<div
|
|
34
34
|
{...containerProps}
|
|
35
|
-
className={cn('relative min-h-
|
|
35
|
+
className={cn('relative min-h-8 min-w-8 w-full rounded-md overflow-hidden', containerProps?.className)}
|
|
36
36
|
>
|
|
37
37
|
<audio ref={ref} src={url} id={audioId} controls {...props} />
|
|
38
|
-
<Spinner loading={
|
|
38
|
+
<Spinner loading={pending} layout="overlay" />
|
|
39
39
|
</div>
|
|
40
40
|
);
|
|
41
41
|
}
|
|
@@ -43,7 +43,7 @@ function AttachmentAudioBase({ uid, url, uploading = false, containerProps, ...p
|
|
|
43
43
|
const AttachmentAudio = forwardRef(AttachmentAudioBase);
|
|
44
44
|
|
|
45
45
|
function AttachmentVideoBase(
|
|
46
|
-
{ uid, url, maxSize = 360,
|
|
46
|
+
{ uid, url, maxSize = 360, pending = false, onReady = () => {}, containerProps, ...props },
|
|
47
47
|
ref
|
|
48
48
|
) {
|
|
49
49
|
const videoId = `attachment_video_${uid || getRandomString()}`;
|
|
@@ -91,7 +91,7 @@ function AttachmentVideoBase(
|
|
|
91
91
|
onCanPlay={handleCanPlay}
|
|
92
92
|
className={cn('size-full', props?.className)}
|
|
93
93
|
/>
|
|
94
|
-
<Spinner loading={
|
|
94
|
+
<Spinner loading={pending} layout="overlay" />
|
|
95
95
|
</div>
|
|
96
96
|
);
|
|
97
97
|
}
|
|
@@ -100,7 +100,7 @@ const AttachmentVideo = forwardRef(AttachmentVideoBase);
|
|
|
100
100
|
|
|
101
101
|
AttachmentVideo.displayName = 'AttachmentVideo';
|
|
102
102
|
|
|
103
|
-
function AttachmentImageBase({ uid, url,
|
|
103
|
+
function AttachmentImageBase({ uid, url, pending = false, onReady = () => {}, linkProps, ...props }, ref) {
|
|
104
104
|
const imageId = `attachment_image_${uid || getRandomString()}`;
|
|
105
105
|
const handleLoad = (event) => {
|
|
106
106
|
props.onLoad?.(event);
|
|
@@ -108,7 +108,7 @@ function AttachmentImageBase({ uid, url, uploading = false, onReady = () => {},
|
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
return (
|
|
111
|
-
<AttachmentLink href={url}
|
|
111
|
+
<AttachmentLink href={url} pending={pending} {...linkProps}>
|
|
112
112
|
<img
|
|
113
113
|
ref={ref}
|
|
114
114
|
src={url}
|
|
@@ -116,7 +116,7 @@ function AttachmentImageBase({ uid, url, uploading = false, onReady = () => {},
|
|
|
116
116
|
alt="attachment"
|
|
117
117
|
{...props}
|
|
118
118
|
className={cn(
|
|
119
|
-
'rounded-md object-cover min-h-
|
|
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
120
|
props?.className
|
|
121
121
|
)}
|
|
122
122
|
onLoad={handleLoad}
|
|
@@ -129,28 +129,28 @@ const AttachmentImage = forwardRef(AttachmentImageBase);
|
|
|
129
129
|
|
|
130
130
|
AttachmentImage.displayName = 'AttachmentImage';
|
|
131
131
|
|
|
132
|
-
function AttachmentFile({ url, name,
|
|
132
|
+
function AttachmentFile({ url, name, pending = false, iconElement, linkProps, ...props }) {
|
|
133
133
|
const fileId = `attachment_file_${props.id || getRandomString()}`;
|
|
134
134
|
|
|
135
135
|
return (
|
|
136
136
|
<AttachmentLink
|
|
137
137
|
href={url}
|
|
138
|
-
|
|
138
|
+
pending={pending}
|
|
139
139
|
{...linkProps}
|
|
140
|
-
className={cn('flex-row gap-
|
|
140
|
+
className={cn('flex-row gap-1.5 p-2 hover:shadow', linkProps?.className)}
|
|
141
141
|
>
|
|
142
142
|
{iconElement || (
|
|
143
143
|
<File
|
|
144
144
|
id={fileId}
|
|
145
145
|
{...props}
|
|
146
146
|
className={cn(
|
|
147
|
-
'size-
|
|
147
|
+
'size-5 shrink-0 text-foreground/80 group-hover:text-foreground duration-300 ease-out',
|
|
148
148
|
props?.className
|
|
149
149
|
)}
|
|
150
150
|
/>
|
|
151
151
|
)}
|
|
152
152
|
{name && (
|
|
153
|
-
<span className="font-medium line-clamp-1 break-all text-foreground/
|
|
153
|
+
<span className="font-medium line-clamp-1 break-all text-foreground/80 group-hover:text-foreground duration-300 ease-out">
|
|
154
154
|
{name}
|
|
155
155
|
</span>
|
|
156
156
|
)}
|
|
@@ -160,14 +160,14 @@ function AttachmentFile({ url, name, uploading = false, iconElement, linkProps,
|
|
|
160
160
|
|
|
161
161
|
AttachmentFile.displayName = 'AttachmentFile';
|
|
162
162
|
|
|
163
|
-
function AttachmentFailed({ name = 'Unknown file',
|
|
163
|
+
function AttachmentFailed({ name = 'Unknown file', pending = false, iconElement, containerProps, ...props }) {
|
|
164
164
|
const failedId = `attachment_failed_${props.id || getRandomString()}`;
|
|
165
165
|
|
|
166
166
|
return (
|
|
167
167
|
<div
|
|
168
168
|
{...containerProps}
|
|
169
169
|
className={cn(
|
|
170
|
-
'relative min-h-
|
|
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
171
|
containerProps?.className
|
|
172
172
|
)}
|
|
173
173
|
>
|
|
@@ -175,7 +175,7 @@ function AttachmentFailed({ name = 'Unknown file', uploading = false, iconElemen
|
|
|
175
175
|
<FileXCorner id={failedId} {...props} className={cn('size-6 shrink-0 text-red-600', props?.className)} />
|
|
176
176
|
)}
|
|
177
177
|
<span className="font-medium line-clamp-1 break-all text-red-600">{name}</span>
|
|
178
|
-
<Spinner loading={
|
|
178
|
+
<Spinner loading={pending} layout="overlay" />
|
|
179
179
|
</div>
|
|
180
180
|
);
|
|
181
181
|
}
|
|
@@ -203,6 +203,8 @@ function AttachmentBase({ mimeType, ...props }) {
|
|
|
203
203
|
|
|
204
204
|
const Attachment = memo(AttachmentBase);
|
|
205
205
|
|
|
206
|
+
Attachment.displayName = 'Attachment';
|
|
207
|
+
|
|
206
208
|
export {
|
|
207
209
|
Attachment,
|
|
208
210
|
AttachmentLink,
|
|
@@ -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 };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useRef } from 'react';
|
|
2
|
+
import { useInView } from 'react-intersection-observer';
|
|
3
|
+
import { Attachment } from './attachment';
|
|
4
|
+
import { Avatar } from './avatar';
|
|
5
|
+
import { FormattedDate } from './formatted-date';
|
|
6
|
+
import { LinkifyText } from './linkify-text';
|
|
7
|
+
import { LinkPreview } from './link-preview';
|
|
8
|
+
import { StatusSent } from './status-sent';
|
|
9
|
+
import { cn } from './utils';
|
|
10
|
+
|
|
11
|
+
function ChatMessageBase(
|
|
12
|
+
{
|
|
13
|
+
isLast,
|
|
14
|
+
fromMe,
|
|
15
|
+
sameSenderAbove,
|
|
16
|
+
title,
|
|
17
|
+
senderName,
|
|
18
|
+
senderAvatar,
|
|
19
|
+
attachmentElement,
|
|
20
|
+
linkifyTextElement,
|
|
21
|
+
linkPreviewElement,
|
|
22
|
+
onView = () => {},
|
|
23
|
+
avatarProps,
|
|
24
|
+
bubbleProps,
|
|
25
|
+
titleProps,
|
|
26
|
+
formattedDateProps,
|
|
27
|
+
statusSentProps,
|
|
28
|
+
attachmentProps,
|
|
29
|
+
linkifyTextProps,
|
|
30
|
+
linkPreviewProps,
|
|
31
|
+
children,
|
|
32
|
+
...props
|
|
33
|
+
},
|
|
34
|
+
ref
|
|
35
|
+
) {
|
|
36
|
+
const [setRef, inView] = useInView();
|
|
37
|
+
const messageRef = useRef(null);
|
|
38
|
+
const setRefs = useCallback(
|
|
39
|
+
(node) => {
|
|
40
|
+
messageRef.current = node;
|
|
41
|
+
setRef(node);
|
|
42
|
+
},
|
|
43
|
+
[setRef]
|
|
44
|
+
);
|
|
45
|
+
const hasAvatar = Boolean((avatarProps || senderAvatar) && !sameSenderAbove);
|
|
46
|
+
const hasAvatarMargin = Boolean((avatarProps || senderAvatar) && sameSenderAbove);
|
|
47
|
+
const hasThinMarginTop = hasAvatarMargin || Boolean(fromMe && sameSenderAbove);
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (inView) {
|
|
51
|
+
onView();
|
|
52
|
+
}
|
|
53
|
+
}, [inView, onView]);
|
|
54
|
+
|
|
55
|
+
useImperativeHandle(ref, () => messageRef.current, []);
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<div
|
|
59
|
+
ref={setRefs}
|
|
60
|
+
{...props}
|
|
61
|
+
className={cn(
|
|
62
|
+
`flex relative text-left whitespace-pre-wrap`,
|
|
63
|
+
fromMe ? 'self-end flex-row-reverse ml-12' : `self-start mr-12`,
|
|
64
|
+
isLast && 'mb-2',
|
|
65
|
+
hasThinMarginTop ? 'mt-1' : 'mt-2',
|
|
66
|
+
inView && 'view',
|
|
67
|
+
props?.className
|
|
68
|
+
)}
|
|
69
|
+
>
|
|
70
|
+
{hasAvatar && (
|
|
71
|
+
<Avatar
|
|
72
|
+
name={senderName}
|
|
73
|
+
src={senderAvatar}
|
|
74
|
+
imageProps={{
|
|
75
|
+
className: 'bg-ring/30',
|
|
76
|
+
}}
|
|
77
|
+
fallbackProps={{
|
|
78
|
+
className: 'bg-ring/30',
|
|
79
|
+
}}
|
|
80
|
+
{...avatarProps}
|
|
81
|
+
className={cn('mt-1 mr-1', avatarProps?.className)}
|
|
82
|
+
/>
|
|
83
|
+
)}
|
|
84
|
+
|
|
85
|
+
<div
|
|
86
|
+
className={cn(
|
|
87
|
+
'relative flex flex-col min-w-42 max-w-120 rounded-xl px-2 pt-2 pb-6',
|
|
88
|
+
fromMe ? 'bg-blue-200' : 'bg-gray-200',
|
|
89
|
+
hasAvatarMargin && 'ml-9',
|
|
90
|
+
bubbleProps?.className
|
|
91
|
+
)}
|
|
92
|
+
>
|
|
93
|
+
{(title || senderName) && (
|
|
94
|
+
<span
|
|
95
|
+
{...titleProps}
|
|
96
|
+
className={cn(
|
|
97
|
+
'font-semibold',
|
|
98
|
+
title && 'mb-1 py-1.5 text-xs text-muted-foreground italic border-b',
|
|
99
|
+
titleProps?.className
|
|
100
|
+
)}
|
|
101
|
+
>
|
|
102
|
+
{title || senderName}
|
|
103
|
+
</span>
|
|
104
|
+
)}
|
|
105
|
+
{children}
|
|
106
|
+
{attachmentElement || (attachmentProps ? <Attachment {...attachmentProps} /> : null)}
|
|
107
|
+
{linkifyTextElement || (linkifyTextProps ? <LinkifyText {...linkifyTextProps} /> : null)}
|
|
108
|
+
{linkPreviewElement || (linkPreviewProps ? <LinkPreview {...linkPreviewProps} /> : null)}
|
|
109
|
+
<div className="absolute bottom-1 right-2 flex items-center gap-1 italic">
|
|
110
|
+
<FormattedDate distanceToNow {...formattedDateProps} />
|
|
111
|
+
<StatusSent {...statusSentProps} />
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const ChatMessage = memo(forwardRef(ChatMessageBase));
|
|
119
|
+
|
|
120
|
+
export { ChatMessage };
|
|
@@ -98,7 +98,10 @@ function DialogItemBase(
|
|
|
98
98
|
<div {...footerProps} className={cn('flex items-start justify-between gap-1', footerProps?.className)}>
|
|
99
99
|
<span
|
|
100
100
|
{...lastMessageProps}
|
|
101
|
-
className={cn(
|
|
101
|
+
className={cn(
|
|
102
|
+
'text-sm text-left text-muted-foreground break-all line-clamp-2',
|
|
103
|
+
lastMessageProps?.className
|
|
104
|
+
)}
|
|
102
105
|
>
|
|
103
106
|
{typingStatusText ||
|
|
104
107
|
(draft ? (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { forwardRef, memo, useMemo } from 'react';
|
|
1
|
+
import { forwardRef, memo, useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import Linkify from 'linkify-react';
|
|
3
3
|
import { cn } from './utils';
|
|
4
4
|
|
|
@@ -6,8 +6,22 @@ const DEFAULT_LINKIFY_OPTIONS = {
|
|
|
6
6
|
target: '_blank',
|
|
7
7
|
rel: 'noopener noreferrer',
|
|
8
8
|
};
|
|
9
|
+
const DEFAULT_SKELETON_LINES_CLASS_NAMES = ['w-full', 'w-3/4', 'w-1/2'];
|
|
9
10
|
|
|
10
|
-
function LinkifyTextBase(
|
|
11
|
+
function LinkifyTextBase(
|
|
12
|
+
{
|
|
13
|
+
text,
|
|
14
|
+
pending = false,
|
|
15
|
+
onReady = () => {},
|
|
16
|
+
linkifyProps,
|
|
17
|
+
skeletonContainerProps,
|
|
18
|
+
skeletonLineProps,
|
|
19
|
+
skeletonLinesClassNames = DEFAULT_SKELETON_LINES_CLASS_NAMES,
|
|
20
|
+
...props
|
|
21
|
+
},
|
|
22
|
+
ref
|
|
23
|
+
) {
|
|
24
|
+
const pendingRef = useRef(pending);
|
|
11
25
|
const options = useMemo(
|
|
12
26
|
() => ({
|
|
13
27
|
...DEFAULT_LINKIFY_OPTIONS,
|
|
@@ -17,6 +31,31 @@ function LinkifyTextBase({ text, linkifyProps, ...props }, ref) {
|
|
|
17
31
|
[linkifyProps]
|
|
18
32
|
);
|
|
19
33
|
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (pendingRef.current && !pending) {
|
|
36
|
+
onReady();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
pendingRef.current = pending;
|
|
40
|
+
}, [pending, onReady]);
|
|
41
|
+
|
|
42
|
+
if (pending) {
|
|
43
|
+
return (
|
|
44
|
+
<div
|
|
45
|
+
{...skeletonContainerProps}
|
|
46
|
+
className={cn('flex items-start flex-col size-full', skeletonContainerProps?.className)}
|
|
47
|
+
>
|
|
48
|
+
{skeletonLinesClassNames.map((width, index) => (
|
|
49
|
+
<span
|
|
50
|
+
{...skeletonLineProps}
|
|
51
|
+
key={`${width}_${index}`}
|
|
52
|
+
className={cn('bg-muted-foreground animate-pulse rounded-md my-1 h-4', skeletonLineProps?.className, width)}
|
|
53
|
+
></span>
|
|
54
|
+
))}
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
20
59
|
return (
|
|
21
60
|
<p ref={ref} {...props} className={cn('wrap-break-word text-base', props?.className)}>
|
|
22
61
|
<Linkify options={options}>{text}</Linkify>
|