UNPKG

@liveblocks/react-ui

Version:

A set of React pre-built components for the Liveblocks products. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.

153 lines (149 loc) 4.74 kB
"use client"; import { jsxs, Fragment, jsx } from 'react/jsx-runtime'; import { assertNever } from '@liveblocks/core'; import { createContext, useContext, useMemo } from 'react'; import { Emoji } from './components/internal/Emoji.js'; import { pluralize } from './utils/pluralize.js'; const defaultOverrides = { locale: "en", dir: "ltr", USER_SELF: "you", USER_UNKNOWN: "Anonymous", LIST_REMAINING: (count) => `${count} more`, LIST_REMAINING_USERS: (count) => `${count} ${pluralize(count, "other")}`, LIST_REMAINING_COMMENTS: (count) => `${count} more ${pluralize(count, "comment")}`, EMOJI_PICKER_SEARCH_PLACEHOLDER: "Search\u2026", EMOJI_PICKER_EMPTY: "No emoji found.", EMOJI_PICKER_ERROR: () => "There was an error while getting the list of emoji.", EMOJI_PICKER_CHANGE_SKIN_TONE: "Change skin tone", ATTACHMENT_TOO_LARGE: (maxSize) => maxSize ? `The file is larger than ${maxSize}` : "The file is too large", ATTACHMENT_ERROR: () => "The file couldn\u2019t be uploaded.", COMPOSER_INSERT_MENTION: "Mention someone", COMPOSER_INSERT_EMOJI: "Add emoji", COMPOSER_ATTACH_FILES: "Attach files", COMPOSER_REMOVE_ATTACHMENT: "Remove attachment", COMPOSER_PLACEHOLDER: "Write a comment\u2026", COMPOSER_SEND: "Send", COMPOSER_TOGGLE_MARK: (format) => { switch (format) { case "bold": return "Bold"; case "italic": return "Italic"; case "strikethrough": return "Strikethrough"; case "code": return "Inline code"; default: return assertNever(format, "Unexpected mark"); } }, COMMENT_EDITED: "(edited)", COMMENT_DELETED: "This comment has been deleted.", COMMENT_MORE: "More", COMMENT_EDIT: "Edit comment", COMMENT_EDIT_COMPOSER_PLACEHOLDER: "Edit comment\u2026", COMMENT_EDIT_COMPOSER_CANCEL: "Cancel", COMMENT_EDIT_COMPOSER_SAVE: "Save", COMMENT_DELETE: "Delete comment", COMMENT_DELETE_ATTACHMENT: "Delete attachment", COMMENT_ADD_REACTION: "Add reaction", COMMENT_REACTION_LIST: (list, emoji) => /* @__PURE__ */ jsxs(Fragment, { children: [ list, " reacted with ", /* @__PURE__ */ jsx(Emoji, { emoji }) ] }), COMMENT_REACTION_DESCRIPTION: (emoji, count) => `${count} ${pluralize(count, "reaction")}, react with ${emoji}`, THREAD_RESOLVE: "Resolve thread", THREAD_UNRESOLVE: "Re-open thread", THREAD_NEW_INDICATOR: "New", THREAD_NEW_INDICATOR_DESCRIPTION: "New comments", THREAD_COMPOSER_PLACEHOLDER: "Reply to thread\u2026", THREAD_COMPOSER_SEND: "Reply", INBOX_NOTIFICATION_MORE: "More", INBOX_NOTIFICATION_MARK_AS_READ: "Mark as read", INBOX_NOTIFICATION_DELETE: "Delete notification", INBOX_NOTIFICATION_THREAD_COMMENTS_LIST: (list, room) => /* @__PURE__ */ jsxs(Fragment, { children: [ list, " commented", room ? /* @__PURE__ */ jsxs(Fragment, { children: [ " in ", room ] }) : /* @__PURE__ */ jsx(Fragment, { children: " in a thread" }) ] }), INBOX_NOTIFICATION_THREAD_MENTION: (user, room) => /* @__PURE__ */ jsxs(Fragment, { children: [ user, " mentioned you", room ? /* @__PURE__ */ jsxs(Fragment, { children: [ " in ", room ] }) : null ] }), INBOX_NOTIFICATION_TEXT_MENTION: (user, room) => /* @__PURE__ */ jsxs(Fragment, { children: [ user, " mentioned you", room ? /* @__PURE__ */ jsxs(Fragment, { children: [ " in ", room ] }) : null ] }), HISTORY_VERSION_PREVIEW_AUTHORS_LIST: (list) => /* @__PURE__ */ jsxs(Fragment, { children: [ "Edits from ", list ] }), HISTORY_VERSION_PREVIEW_RESTORE: "Restore", HISTORY_VERSION_PREVIEW_EMPTY: "No content.", HISTORY_VERSION_PREVIEW_ERROR: () => "There was an error while getting this version." }; const OverridesContext = createContext(void 0); function useOverrides(overrides) { const contextOverrides = useContext(OverridesContext); return useMemo( () => ({ ...defaultOverrides, ...contextOverrides, ...overrides }), [contextOverrides, overrides] ); } function OverridesProvider({ children, overrides: providerOverrides }) { const contextOverrides = useContext(OverridesContext); const overrides = useMemo( () => ({ ...defaultOverrides, ...contextOverrides, ...providerOverrides }), [contextOverrides, providerOverrides] ); return /* @__PURE__ */ jsx(OverridesContext.Provider, { value: overrides, children }); } export { OverridesContext, OverridesProvider, defaultOverrides, useOverrides }; //# sourceMappingURL=overrides.js.map