import * as React from 'react'; import React__default, { ElementType, ComponentPropsWithoutRef, ReactNode, ComponentType, FormEvent, PropsWithChildren } from 'react'; import { CommentBody as CommentBody$1 } from '@liveblocks/core'; declare type Direction = "ltr" | "rtl"; declare type SlotProp = { /** * Replace the rendered element by the one passed as a child. */ asChild?: boolean; }; declare type ComponentPropsWithSlot> = ComponentPropsWithoutRef & SlotProp; declare type CommentMentionProps = ComponentPropsWithSlot<"span">; declare type CommentBodyMentionProps = { /** * The mention's user ID. */ userId: string; }; declare type CommentLinkProps = ComponentPropsWithSlot<"a">; interface CommentBodyLinkProps { /** * The link's absolute URL. * * @example "https://example.com" */ href: string; /** * The link's content. * * @example "www.example.com", "a link", etc. */ children: ReactNode; } interface CommentBodyComponents { /** * The component used to display mentions. */ Mention: ComponentType; /** * The component used to display links. */ Link: ComponentType; } interface CommentBodyProps extends Omit, "children"> { /** * The comment body to display. * If not defined, the component will render `null`. */ body?: CommentBody$1; /** * The components displayed within the comment body. */ components?: Partial; } /** * Displays mentions within `Comment.Body`. * * @example * @{userId} */ declare const CommentMention: React__default.ForwardRefExoticComponent, HTMLSpanElement>, "ref"> & SlotProp & React__default.RefAttributes>; /** * Displays links within `Comment.Body`. * * @example * {children} */ declare const CommentLink: React__default.ForwardRefExoticComponent, HTMLAnchorElement>, "ref"> & SlotProp & React__default.RefAttributes>; /** * Displays a comment body. * * @example * */ declare const CommentBody: React__default.ForwardRefExoticComponent>; declare namespace index$2 { export { CommentBody as Body, CommentLink as Link, CommentMention as Mention, }; } interface ComposerEditorMentionProps { /** * Whether the mention is selected. */ isSelected: boolean; /** * The mention's user ID. */ userId: string; } interface ComposerEditorLinkProps { /** * The link's absolute URL. * * @example "https://example.com" */ href: string; /** * The link's content. * * @example "www.example.com", "a link", etc. */ children: ReactNode; } declare type ComposerEditorMentionSuggestionsProps = { /** * The list of suggested user IDs. */ userIds: string[]; /** * The currently selected user ID. */ selectedUserId?: string; }; declare type ComposerMentionProps = ComponentPropsWithSlot<"span">; declare type ComposerLinkProps = ComponentPropsWithSlot<"a">; declare type ComposerSuggestionsListProps = ComponentPropsWithSlot<"ul">; interface ComposerSuggestionsListItemProps extends ComponentPropsWithSlot<"li"> { /** * The suggestion's value. */ value: string; } interface ComposerEditorComponents { /** * The component used to display mentions. */ Mention: ComponentType; /** * The component used to display mention suggestions. */ MentionSuggestions: ComponentType; /** * The component used to display links. */ Link: ComponentType; } interface ComposerEditorProps extends Omit, "defaultValue"> { /** * The reading direction of the editor and related elements. */ dir?: Direction; /** * The editor's initial value. */ defaultValue?: CommentBody$1; /** * The text to display when the editor is empty. */ placeholder?: string; /** * Whether the editor is disabled. */ disabled?: boolean; /** * Whether to focus the editor on mount. */ autoFocus?: boolean; /** * The components displayed within the editor. */ components?: Partial; } interface ComposerFormProps extends ComponentPropsWithSlot<"form"> { /** * The event handler called when the form is submitted. */ onComposerSubmit?: (comment: ComposerSubmitComment, event: FormEvent) => Promise | void; } declare type ComposerSubmitProps = ComponentPropsWithSlot<"button">; interface ComposerSubmitComment { /** * The submitted comment's body. */ body: CommentBody$1; } /** * Displays mentions within `Composer.Editor`. * * @example * @{userId} */ declare const ComposerMention: React__default.ForwardRefExoticComponent, HTMLSpanElement>, "ref"> & SlotProp & React__default.RefAttributes>; /** * Displays links within `Composer.Editor`. * * @example * {children} */ declare const ComposerLink: React__default.ForwardRefExoticComponent, HTMLAnchorElement>, "ref"> & SlotProp & React__default.RefAttributes>; /** * Contains suggestions within `Composer.Editor`. */ declare const ComposerSuggestions: React__default.ForwardRefExoticComponent, HTMLDivElement>, "ref"> & SlotProp & React__default.RefAttributes>; /** * Displays a list of suggestions within `Composer.Editor`. * * @example * * {userIds.map((userId) => ( * * @{userId} * * ))} * */ declare const ComposerSuggestionsList: React__default.ForwardRefExoticComponent, HTMLUListElement>, "ref"> & SlotProp & React__default.RefAttributes>; /** * Displays a suggestion within `Composer.SuggestionsList`. * * @example * * @{userId} * */ declare const ComposerSuggestionsListItem: React__default.ForwardRefExoticComponent>; /** * Displays the composer's editor. * * @example * */ declare const ComposerEditor: React__default.ForwardRefExoticComponent>; /** * Surrounds the composer's content and handles submissions. * * @example * {}}> * * * */ declare const ComposerForm: React__default.ForwardRefExoticComponent>; /** * A button to submit the composer. * * @example * Send */ declare const ComposerSubmit: React__default.ForwardRefExoticComponent, HTMLButtonElement>, "ref"> & SlotProp & React__default.RefAttributes>; declare namespace index$1 { export { ComposerEditor as Editor, ComposerForm as Form, ComposerLink as Link, ComposerMention as Mention, ComposerSubmit as Submit, ComposerSuggestions as Suggestions, ComposerSuggestionsList as SuggestionsList, ComposerSuggestionsListItem as SuggestionsListItem, }; } declare type ComposerContext = { /** * Whether the editor is currently focused. */ isFocused: boolean; /** * Whether the editor is currently empty. */ isEmpty: boolean; /** * Submit the composer programmatically. */ submit: () => void; /** * Clear the editor programmatically. */ clear: () => void; /** * Select the editor programmatically. */ select: () => void; /** * Focus the editor programmatically. */ focus: () => void; /** * Blur the editor programmatically. */ blur: () => void; /** * Start creating a mention at the current selection. */ createMention: () => void; /** * Insert text at the current selection. */ insertText: (text: string) => void; }; declare const ComposerContext: React.Context; declare function useComposer(): ComposerContext; declare type EmojiPickerContentLoadingProps = ComponentPropsWithoutRef<"div">; declare type EmojiPickerContentEmptyProps = ComponentPropsWithoutRef<"div">; declare type EmojiPickerContentGridProps = ComponentPropsWithoutRef<"div">; interface EmojiPickerContentErrorProps extends ComponentPropsWithoutRef<"div"> { /** * The error. */ error: Error; } interface EmojiPickerContentCategoryHeaderProps extends ComponentPropsWithoutRef<"div"> { /** * The category's name. */ category: string; } declare type EmojiPickerContentEmojiRowAttributes = { /** * The current row's index. */ rowIndex: number; /** * The current row's index within the current category. */ categoryRowIndex: number; /** * The number of rows within the current category. */ categoryRowsCount: number; }; interface EmojiPickerContentRowProps extends ComponentPropsWithoutRef<"div"> { /** * Attributes related to the current row. */ attributes: EmojiPickerContentEmojiRowAttributes; } interface EmojiPickerContentEmojiProps extends ComponentPropsWithoutRef<"button"> { /** * The emoji to be displayed. */ emoji: string; } interface EmojiPickerRootProps extends PropsWithChildren { /** * The number of emojis per row. */ columns?: number; /** * The event handler called when an emoji is selected. */ onEmojiSelect?: (emoji: string) => void; /** * The locale used when getting emoji data. */ locale?: string; } interface EmojiPickerContentComponents { /** * The component displayed when the emoji data is loading. */ Loading: ComponentType; /** * The component displayed when there are no results. */ Empty: ComponentType; /** * The component displayed when there was an error while getting the emoji data. */ Error: ComponentType; /** * The component used to display category headers. */ CategoryHeader: ComponentType; /** * The component displayed when there are emojis to display. */ Grid: ComponentType; /** * The component used to display rows of emojis. */ Row: ComponentType; /** * The component used to display emojis. */ Emoji: ComponentType; } interface EmojiPickerContentProps extends ComponentPropsWithSlot<"div"> { /** * The components displayed within the content. */ components?: Partial; } declare type EmojiPickerSearchProps = ComponentPropsWithSlot<"input">; /** * @private * The EmojiPicker primitive is undocumented for now and subject to change, * use at your own risk. If you have any feedback on it, please let us know! * See how we use it in the default components to learn how to use it: * https://github.com/liveblocks/liveblocks/blob/main/packages/liveblocks-react-comments/src/components/internal/EmojiPicker.tsx. * * Surrounds the emoji picker, it handles emoji data and coordinates * `EmojiPicker.Search` and `EmojiPicker.Content`. * * @example * * * * */ declare function EmojiPickerRoot({ columns, locale, onEmojiSelect, children, }: EmojiPickerRootProps): React__default.JSX.Element; declare namespace EmojiPickerRoot { var displayName: string; } /** * @private * The EmojiPicker primitive is undocumented for now and subject to change, * use at your own risk. If you have any feedback on it, please let us know! * See how we use it in the default components to learn how to use it: * https://github.com/liveblocks/liveblocks/blob/main/packages/liveblocks-react-comments/src/components/internal/EmojiPicker.tsx. * * The search input of the emoji picker. It also affects the focus and selection * within `EmojiPicker.Content`. * * @example * */ declare const EmojiPickerSearch: React__default.ForwardRefExoticComponent, HTMLInputElement>, "ref"> & SlotProp & React__default.RefAttributes>; /** * @private * The EmojiPicker primitive is undocumented for now and subject to change, * use at your own risk. If you have any feedback on it, please let us know! * See how we use it in the default components to learn how to use it: * https://github.com/liveblocks/liveblocks/blob/main/packages/liveblocks-react-comments/src/components/internal/EmojiPicker.tsx. * * The main content of the emoji picker, either displaying the emoji grid or various * alternative states (loading, empty, and error). * * @example * */ declare const EmojiPickerContent: React__default.ForwardRefExoticComponent>; declare namespace index { export { EmojiPickerContent as Content, EmojiPickerRoot as Root, EmojiPickerSearch as Search, }; } interface TimestampProps extends Omit, "children" | "title"> { /** * The date to display. */ date: Date | string | number; /** * A function to format the displayed date. */ children?: (date: Date, locale?: string) => ReactNode; /** * The `title` attribute's value or a function to format it. */ title?: string | ((date: Date, locale?: string) => string); /** * The interval in milliseconds at which the component will re-render. * Can be set to `false` to disable re-rendering. */ interval?: number | false; /** * The locale used when formatting the date. */ locale?: string; } /** * Displays a formatted date, and automatically re-renders to support relative * formatting. Defaults to relative formatting for recent dates and a short * absolute formatting for older ones. * * @example * * * @example * date.toISOString()} interval={false}> * {(date) => date.toLocaleDateString()} * */ declare const Timestamp: React__default.ForwardRefExoticComponent>; export { index$2 as Comment, CommentBodyComponents, CommentBodyLinkProps, CommentBodyMentionProps, CommentBodyProps, CommentLinkProps, CommentMentionProps, index$1 as Composer, ComposerContext, ComposerEditorComponents, ComposerEditorLinkProps, ComposerEditorMentionProps, ComposerEditorMentionSuggestionsProps, ComposerEditorProps, ComposerFormProps, ComposerLinkProps, ComposerMentionProps, ComposerSubmitComment, ComposerSubmitProps, ComposerSuggestionsListItemProps, ComposerSuggestionsListProps, index as EmojiPicker, EmojiPickerContentCategoryHeaderProps, EmojiPickerContentComponents, EmojiPickerContentEmojiProps, EmojiPickerContentEmptyProps, EmojiPickerContentErrorProps, EmojiPickerContentGridProps, EmojiPickerContentLoadingProps, EmojiPickerContentProps, EmojiPickerContentRowProps, EmojiPickerRootProps, EmojiPickerSearchProps, Timestamp, TimestampProps, useComposer };