@liveblocks/react-ui 2.5.2 → 2.7.0-beta1
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/components/Comment.js +61 -3
- package/dist/components/Comment.js.map +1 -1
- package/dist/components/Comment.mjs +62 -5
- package/dist/components/Comment.mjs.map +1 -1
- package/dist/components/Composer.js +217 -101
- package/dist/components/Composer.js.map +1 -1
- package/dist/components/Composer.mjs +220 -104
- package/dist/components/Composer.mjs.map +1 -1
- package/dist/components/InboxNotification.js +17 -4
- package/dist/components/InboxNotification.js.map +1 -1
- package/dist/components/InboxNotification.mjs +17 -4
- package/dist/components/InboxNotification.mjs.map +1 -1
- package/dist/components/Thread.js +2 -0
- package/dist/components/Thread.js.map +1 -1
- package/dist/components/Thread.mjs +2 -0
- package/dist/components/Thread.mjs.map +1 -1
- package/dist/components/internal/Attachment.js +226 -0
- package/dist/components/internal/Attachment.js.map +1 -0
- package/dist/components/internal/Attachment.mjs +224 -0
- package/dist/components/internal/Attachment.mjs.map +1 -0
- package/dist/components/internal/InboxNotificationThread.js +10 -2
- package/dist/components/internal/InboxNotificationThread.js.map +1 -1
- package/dist/components/internal/InboxNotificationThread.mjs +11 -3
- package/dist/components/internal/InboxNotificationThread.mjs.map +1 -1
- package/dist/icons/Attachment.js +15 -0
- package/dist/icons/Attachment.js.map +1 -0
- package/dist/icons/Attachment.mjs +13 -0
- package/dist/icons/Attachment.mjs.map +1 -0
- package/dist/icons/Spinner.js +3 -9
- package/dist/icons/Spinner.js.map +1 -1
- package/dist/icons/Spinner.mjs +4 -10
- package/dist/icons/Spinner.mjs.map +1 -1
- package/dist/icons/{Missing.js → Warning.js} +3 -3
- package/dist/icons/{Missing.js.map → Warning.js.map} +1 -1
- package/dist/icons/{Missing.mjs → Warning.mjs} +3 -3
- package/dist/icons/{Missing.mjs.map → Warning.mjs.map} +1 -1
- package/dist/index.d.mts +70 -4
- package/dist/index.d.ts +70 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/overrides.js +5 -0
- package/dist/overrides.js.map +1 -1
- package/dist/overrides.mjs +5 -0
- package/dist/overrides.mjs.map +1 -1
- package/dist/primitives/Composer/contexts.js +17 -3
- package/dist/primitives/Composer/contexts.js.map +1 -1
- package/dist/primitives/Composer/contexts.mjs +15 -4
- package/dist/primitives/Composer/contexts.mjs.map +1 -1
- package/dist/primitives/Composer/index.js +185 -26
- package/dist/primitives/Composer/index.js.map +1 -1
- package/dist/primitives/Composer/index.mjs +188 -31
- package/dist/primitives/Composer/index.mjs.map +1 -1
- package/dist/primitives/Composer/utils.js +224 -0
- package/dist/primitives/Composer/utils.js.map +1 -1
- package/dist/primitives/Composer/utils.mjs +222 -1
- package/dist/primitives/Composer/utils.mjs.map +1 -1
- package/dist/primitives/EmojiPicker/utils.js +2 -2
- package/dist/primitives/EmojiPicker/utils.js.map +1 -1
- package/dist/primitives/EmojiPicker/utils.mjs +1 -1
- package/dist/primitives/EmojiPicker/utils.mjs.map +1 -1
- package/dist/primitives/FileSize.js +33 -0
- package/dist/primitives/FileSize.js.map +1 -0
- package/dist/primitives/FileSize.mjs +31 -0
- package/dist/primitives/FileSize.mjs.map +1 -0
- package/dist/primitives/index.d.mts +83 -3
- package/dist/primitives/index.d.ts +83 -3
- package/dist/primitives/index.js +4 -0
- package/dist/primitives/index.js.map +1 -1
- package/dist/primitives/index.mjs +2 -0
- package/dist/primitives/index.mjs.map +1 -1
- package/dist/utils/download.js +14 -0
- package/dist/utils/download.js.map +1 -0
- package/dist/utils/download.mjs +12 -0
- package/dist/utils/download.mjs.map +1 -0
- package/dist/utils/format-file-size.js +45 -0
- package/dist/utils/format-file-size.js.map +1 -0
- package/dist/utils/format-file-size.mjs +43 -0
- package/dist/utils/format-file-size.mjs.map +1 -0
- package/dist/utils/intl.js +6 -0
- package/dist/utils/intl.js.map +1 -1
- package/dist/utils/intl.mjs +6 -1
- package/dist/utils/intl.mjs.map +1 -1
- package/dist/utils/use-initial.js +2 -1
- package/dist/utils/use-initial.js.map +1 -1
- package/dist/utils/use-initial.mjs +3 -2
- package/dist/utils/use-initial.mjs.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/package.json +4 -4
- package/src/styles/dark/index.css +1 -0
- package/src/styles/index.css +296 -62
- package/src/styles/utils.css +44 -0
- package/styles/dark/attributes.css +1 -1
- package/styles/dark/attributes.css.map +1 -1
- package/styles/dark/media-query.css +1 -1
- package/styles/dark/media-query.css.map +1 -1
- package/styles.css +1 -1
- package/styles.css.map +1 -1
- package/dist/utils/chunk.js +0 -12
- package/dist/utils/chunk.js.map +0 -1
- package/dist/utils/chunk.mjs +0 -10
- package/dist/utils/chunk.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSize.mjs","sources":["../../src/primitives/FileSize.tsx"],"sourcesContent":["\"use client\";\n\nimport { Slot } from \"@radix-ui/react-slot\";\nimport type { ReactNode } from \"react\";\nimport React, { forwardRef, useMemo } from \"react\";\n\nimport type { ComponentPropsWithSlot } from \"../types\";\nimport { formatFileSize } from \"../utils/format-file-size\";\n\nconst FILE_SIZE_NAME = \"FileSize\";\n\nexport interface FileSizeProps\n extends Omit<ComponentPropsWithSlot<\"span\">, \"children\"> {\n /**\n * The file size to display.\n */\n size: number;\n\n /**\n * A function to format the displayed file size.\n */\n children?: (size: number, locale?: string) => ReactNode;\n\n /**\n * The locale used when formatting the file size.\n */\n locale?: string;\n}\n\n/**\n * Displays a formatted file size.\n *\n * @example\n * <FileSize size={100000} />\n */\nexport const FileSize = forwardRef<HTMLSpanElement, FileSizeProps>(\n (\n {\n size,\n locale,\n children: renderChildren = formatFileSize,\n asChild,\n ...props\n },\n forwardedRef\n ) => {\n const Component = asChild ? Slot : \"span\";\n const children = useMemo(\n () =>\n typeof renderChildren === \"function\"\n ? renderChildren(size, locale)\n : renderChildren,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [renderChildren, size]\n );\n\n return (\n <Component {...props} ref={forwardedRef}>\n {children}\n </Component>\n );\n }\n);\n\nif (process.env.NODE_ENV !== \"production\") {\n FileSize.displayName = FILE_SIZE_NAME;\n}\n"],"names":[],"mappings":";;;;;AASA;AA0BO;AAAiB;AAEpB;AACE;AACA;AAC2B;AAC3B;AACG;AAIL;AACA;AAAiB;AAIT;AAEe;AAGvB;AACG;AAAc;AAAY;AAE3B;AAGN;AAEA;AACE;AACF;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { ElementType, ComponentPropsWithoutRef, ReactNode, ComponentType, FormEvent, PropsWithChildren } from 'react';
|
|
3
|
-
import { CommentBody as CommentBody$1 } from '@liveblocks/core';
|
|
3
|
+
import { CommentBody as CommentBody$1, CommentAttachment, CommentMixedAttachment } from '@liveblocks/core';
|
|
4
4
|
|
|
5
5
|
declare type Direction = "ltr" | "rtl";
|
|
6
6
|
declare type SlotProp = {
|
|
@@ -173,13 +173,29 @@ interface ComposerFormProps extends ComponentPropsWithSlot<"form"> {
|
|
|
173
173
|
* The event handler called when the form is submitted.
|
|
174
174
|
*/
|
|
175
175
|
onComposerSubmit?: (comment: ComposerSubmitComment, event: FormEvent<HTMLFormElement>) => Promise<void> | void;
|
|
176
|
+
/**
|
|
177
|
+
* Whether the composer is disabled.
|
|
178
|
+
*/
|
|
179
|
+
disabled?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* The composer's initial attachments.
|
|
182
|
+
*/
|
|
183
|
+
defaultAttachments?: CommentAttachment[];
|
|
176
184
|
}
|
|
177
185
|
declare type ComposerSubmitProps = ComponentPropsWithSlot<"button">;
|
|
186
|
+
declare type ComposerAttachFilesProps = ComponentPropsWithSlot<"button">;
|
|
187
|
+
interface ComposerAttachmentsDropAreaProps extends ComponentPropsWithSlot<"div"> {
|
|
188
|
+
disabled?: boolean;
|
|
189
|
+
}
|
|
178
190
|
interface ComposerSubmitComment {
|
|
179
191
|
/**
|
|
180
192
|
* The submitted comment's body.
|
|
181
193
|
*/
|
|
182
194
|
body: CommentBody$1;
|
|
195
|
+
/**
|
|
196
|
+
* The submitted comment's uploaded attachments.
|
|
197
|
+
*/
|
|
198
|
+
attachments: CommentAttachment[];
|
|
183
199
|
}
|
|
184
200
|
|
|
185
201
|
/**
|
|
@@ -246,9 +262,27 @@ declare const ComposerForm: React__default.ForwardRefExoticComponent<ComposerFor
|
|
|
246
262
|
* <Composer.Submit>Send</Composer.Submit>
|
|
247
263
|
*/
|
|
248
264
|
declare const ComposerSubmit: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & SlotProp & React__default.RefAttributes<HTMLButtonElement>>;
|
|
265
|
+
/**
|
|
266
|
+
* A button which opens a file picker to create attachments.
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* <Composer.AttachFiles>Attach files</Composer.AttachFiles>
|
|
270
|
+
*/
|
|
271
|
+
declare const ComposerAttachFiles: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & SlotProp & React__default.RefAttributes<HTMLButtonElement>>;
|
|
272
|
+
/**
|
|
273
|
+
* A drop area which accepts files to create attachments.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* <Composer.AttachmentsDropArea>
|
|
277
|
+
* Drop files here
|
|
278
|
+
* </Composer.AttachmentsDropArea>
|
|
279
|
+
*/
|
|
280
|
+
declare const ComposerAttachmentsDropArea: React__default.ForwardRefExoticComponent<ComposerAttachmentsDropAreaProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
249
281
|
|
|
250
282
|
declare namespace index$1 {
|
|
251
283
|
export {
|
|
284
|
+
ComposerAttachFiles as AttachFiles,
|
|
285
|
+
ComposerAttachmentsDropArea as AttachmentsDropArea,
|
|
252
286
|
ComposerEditor as Editor,
|
|
253
287
|
ComposerForm as Form,
|
|
254
288
|
ComposerLink as Link,
|
|
@@ -261,6 +295,14 @@ declare namespace index$1 {
|
|
|
261
295
|
}
|
|
262
296
|
|
|
263
297
|
declare type ComposerContext = {
|
|
298
|
+
/**
|
|
299
|
+
* Whether the composer is currently disabled.
|
|
300
|
+
*/
|
|
301
|
+
isDisabled: boolean;
|
|
302
|
+
/**
|
|
303
|
+
* Whether the composer can currently be submitted.
|
|
304
|
+
*/
|
|
305
|
+
canSubmit: boolean;
|
|
264
306
|
/**
|
|
265
307
|
* Whether the editor is currently focused.
|
|
266
308
|
*/
|
|
@@ -274,7 +316,7 @@ declare type ComposerContext = {
|
|
|
274
316
|
*/
|
|
275
317
|
submit: () => void;
|
|
276
318
|
/**
|
|
277
|
-
* Clear the
|
|
319
|
+
* Clear the composer programmatically.
|
|
278
320
|
*/
|
|
279
321
|
clear: () => void;
|
|
280
322
|
/**
|
|
@@ -297,10 +339,26 @@ declare type ComposerContext = {
|
|
|
297
339
|
* Insert text at the current selection.
|
|
298
340
|
*/
|
|
299
341
|
insertText: (text: string) => void;
|
|
342
|
+
/**
|
|
343
|
+
* Open a file picker programmatically to create attachments.
|
|
344
|
+
*/
|
|
345
|
+
attachFiles: () => void;
|
|
346
|
+
/**
|
|
347
|
+
* The composer's current attachments.
|
|
348
|
+
*/
|
|
349
|
+
attachments: CommentMixedAttachment[];
|
|
350
|
+
/**
|
|
351
|
+
* Remove an attachment by its ID.
|
|
352
|
+
*/
|
|
353
|
+
removeAttachment: (attachmentId: string) => void;
|
|
300
354
|
};
|
|
301
355
|
declare const ComposerContext: React.Context<ComposerContext | null>;
|
|
302
356
|
declare function useComposer(): ComposerContext;
|
|
303
357
|
|
|
358
|
+
declare class AttachmentTooLargeError extends Error {
|
|
359
|
+
name: string;
|
|
360
|
+
}
|
|
361
|
+
|
|
304
362
|
declare type EmojiPickerContentLoadingProps = ComponentPropsWithoutRef<"div">;
|
|
305
363
|
declare type EmojiPickerContentEmptyProps = ComponentPropsWithoutRef<"div">;
|
|
306
364
|
declare type EmojiPickerContentGridProps = ComponentPropsWithoutRef<"div">;
|
|
@@ -461,6 +519,28 @@ declare namespace index {
|
|
|
461
519
|
};
|
|
462
520
|
}
|
|
463
521
|
|
|
522
|
+
interface FileSizeProps extends Omit<ComponentPropsWithSlot<"span">, "children"> {
|
|
523
|
+
/**
|
|
524
|
+
* The file size to display.
|
|
525
|
+
*/
|
|
526
|
+
size: number;
|
|
527
|
+
/**
|
|
528
|
+
* A function to format the displayed file size.
|
|
529
|
+
*/
|
|
530
|
+
children?: (size: number, locale?: string) => ReactNode;
|
|
531
|
+
/**
|
|
532
|
+
* The locale used when formatting the file size.
|
|
533
|
+
*/
|
|
534
|
+
locale?: string;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Displays a formatted file size.
|
|
538
|
+
*
|
|
539
|
+
* @example
|
|
540
|
+
* <FileSize size={100000} />
|
|
541
|
+
*/
|
|
542
|
+
declare const FileSize: React__default.ForwardRefExoticComponent<FileSizeProps & React__default.RefAttributes<HTMLSpanElement>>;
|
|
543
|
+
|
|
464
544
|
interface TimestampProps extends Omit<ComponentPropsWithSlot<"time">, "children" | "title"> {
|
|
465
545
|
/**
|
|
466
546
|
* The date to display.
|
|
@@ -499,4 +579,4 @@ interface TimestampProps extends Omit<ComponentPropsWithSlot<"time">, "children"
|
|
|
499
579
|
*/
|
|
500
580
|
declare const Timestamp: React__default.ForwardRefExoticComponent<TimestampProps & React__default.RefAttributes<HTMLTimeElement>>;
|
|
501
581
|
|
|
502
|
-
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 };
|
|
582
|
+
export { AttachmentTooLargeError, index$2 as Comment, CommentBodyComponents, CommentBodyLinkProps, CommentBodyMentionProps, CommentBodyProps, CommentLinkProps, CommentMentionProps, index$1 as Composer, ComposerAttachFilesProps, ComposerAttachmentsDropAreaProps, 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, FileSize, FileSizeProps, Timestamp, TimestampProps, useComposer };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { ElementType, ComponentPropsWithoutRef, ReactNode, ComponentType, FormEvent, PropsWithChildren } from 'react';
|
|
3
|
-
import { CommentBody as CommentBody$1 } from '@liveblocks/core';
|
|
3
|
+
import { CommentBody as CommentBody$1, CommentAttachment, CommentMixedAttachment } from '@liveblocks/core';
|
|
4
4
|
|
|
5
5
|
declare type Direction = "ltr" | "rtl";
|
|
6
6
|
declare type SlotProp = {
|
|
@@ -173,13 +173,29 @@ interface ComposerFormProps extends ComponentPropsWithSlot<"form"> {
|
|
|
173
173
|
* The event handler called when the form is submitted.
|
|
174
174
|
*/
|
|
175
175
|
onComposerSubmit?: (comment: ComposerSubmitComment, event: FormEvent<HTMLFormElement>) => Promise<void> | void;
|
|
176
|
+
/**
|
|
177
|
+
* Whether the composer is disabled.
|
|
178
|
+
*/
|
|
179
|
+
disabled?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* The composer's initial attachments.
|
|
182
|
+
*/
|
|
183
|
+
defaultAttachments?: CommentAttachment[];
|
|
176
184
|
}
|
|
177
185
|
declare type ComposerSubmitProps = ComponentPropsWithSlot<"button">;
|
|
186
|
+
declare type ComposerAttachFilesProps = ComponentPropsWithSlot<"button">;
|
|
187
|
+
interface ComposerAttachmentsDropAreaProps extends ComponentPropsWithSlot<"div"> {
|
|
188
|
+
disabled?: boolean;
|
|
189
|
+
}
|
|
178
190
|
interface ComposerSubmitComment {
|
|
179
191
|
/**
|
|
180
192
|
* The submitted comment's body.
|
|
181
193
|
*/
|
|
182
194
|
body: CommentBody$1;
|
|
195
|
+
/**
|
|
196
|
+
* The submitted comment's uploaded attachments.
|
|
197
|
+
*/
|
|
198
|
+
attachments: CommentAttachment[];
|
|
183
199
|
}
|
|
184
200
|
|
|
185
201
|
/**
|
|
@@ -246,9 +262,27 @@ declare const ComposerForm: React__default.ForwardRefExoticComponent<ComposerFor
|
|
|
246
262
|
* <Composer.Submit>Send</Composer.Submit>
|
|
247
263
|
*/
|
|
248
264
|
declare const ComposerSubmit: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & SlotProp & React__default.RefAttributes<HTMLButtonElement>>;
|
|
265
|
+
/**
|
|
266
|
+
* A button which opens a file picker to create attachments.
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* <Composer.AttachFiles>Attach files</Composer.AttachFiles>
|
|
270
|
+
*/
|
|
271
|
+
declare const ComposerAttachFiles: React__default.ForwardRefExoticComponent<Omit<React__default.DetailedHTMLProps<React__default.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & SlotProp & React__default.RefAttributes<HTMLButtonElement>>;
|
|
272
|
+
/**
|
|
273
|
+
* A drop area which accepts files to create attachments.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* <Composer.AttachmentsDropArea>
|
|
277
|
+
* Drop files here
|
|
278
|
+
* </Composer.AttachmentsDropArea>
|
|
279
|
+
*/
|
|
280
|
+
declare const ComposerAttachmentsDropArea: React__default.ForwardRefExoticComponent<ComposerAttachmentsDropAreaProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
249
281
|
|
|
250
282
|
declare namespace index$1 {
|
|
251
283
|
export {
|
|
284
|
+
ComposerAttachFiles as AttachFiles,
|
|
285
|
+
ComposerAttachmentsDropArea as AttachmentsDropArea,
|
|
252
286
|
ComposerEditor as Editor,
|
|
253
287
|
ComposerForm as Form,
|
|
254
288
|
ComposerLink as Link,
|
|
@@ -261,6 +295,14 @@ declare namespace index$1 {
|
|
|
261
295
|
}
|
|
262
296
|
|
|
263
297
|
declare type ComposerContext = {
|
|
298
|
+
/**
|
|
299
|
+
* Whether the composer is currently disabled.
|
|
300
|
+
*/
|
|
301
|
+
isDisabled: boolean;
|
|
302
|
+
/**
|
|
303
|
+
* Whether the composer can currently be submitted.
|
|
304
|
+
*/
|
|
305
|
+
canSubmit: boolean;
|
|
264
306
|
/**
|
|
265
307
|
* Whether the editor is currently focused.
|
|
266
308
|
*/
|
|
@@ -274,7 +316,7 @@ declare type ComposerContext = {
|
|
|
274
316
|
*/
|
|
275
317
|
submit: () => void;
|
|
276
318
|
/**
|
|
277
|
-
* Clear the
|
|
319
|
+
* Clear the composer programmatically.
|
|
278
320
|
*/
|
|
279
321
|
clear: () => void;
|
|
280
322
|
/**
|
|
@@ -297,10 +339,26 @@ declare type ComposerContext = {
|
|
|
297
339
|
* Insert text at the current selection.
|
|
298
340
|
*/
|
|
299
341
|
insertText: (text: string) => void;
|
|
342
|
+
/**
|
|
343
|
+
* Open a file picker programmatically to create attachments.
|
|
344
|
+
*/
|
|
345
|
+
attachFiles: () => void;
|
|
346
|
+
/**
|
|
347
|
+
* The composer's current attachments.
|
|
348
|
+
*/
|
|
349
|
+
attachments: CommentMixedAttachment[];
|
|
350
|
+
/**
|
|
351
|
+
* Remove an attachment by its ID.
|
|
352
|
+
*/
|
|
353
|
+
removeAttachment: (attachmentId: string) => void;
|
|
300
354
|
};
|
|
301
355
|
declare const ComposerContext: React.Context<ComposerContext | null>;
|
|
302
356
|
declare function useComposer(): ComposerContext;
|
|
303
357
|
|
|
358
|
+
declare class AttachmentTooLargeError extends Error {
|
|
359
|
+
name: string;
|
|
360
|
+
}
|
|
361
|
+
|
|
304
362
|
declare type EmojiPickerContentLoadingProps = ComponentPropsWithoutRef<"div">;
|
|
305
363
|
declare type EmojiPickerContentEmptyProps = ComponentPropsWithoutRef<"div">;
|
|
306
364
|
declare type EmojiPickerContentGridProps = ComponentPropsWithoutRef<"div">;
|
|
@@ -461,6 +519,28 @@ declare namespace index {
|
|
|
461
519
|
};
|
|
462
520
|
}
|
|
463
521
|
|
|
522
|
+
interface FileSizeProps extends Omit<ComponentPropsWithSlot<"span">, "children"> {
|
|
523
|
+
/**
|
|
524
|
+
* The file size to display.
|
|
525
|
+
*/
|
|
526
|
+
size: number;
|
|
527
|
+
/**
|
|
528
|
+
* A function to format the displayed file size.
|
|
529
|
+
*/
|
|
530
|
+
children?: (size: number, locale?: string) => ReactNode;
|
|
531
|
+
/**
|
|
532
|
+
* The locale used when formatting the file size.
|
|
533
|
+
*/
|
|
534
|
+
locale?: string;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Displays a formatted file size.
|
|
538
|
+
*
|
|
539
|
+
* @example
|
|
540
|
+
* <FileSize size={100000} />
|
|
541
|
+
*/
|
|
542
|
+
declare const FileSize: React__default.ForwardRefExoticComponent<FileSizeProps & React__default.RefAttributes<HTMLSpanElement>>;
|
|
543
|
+
|
|
464
544
|
interface TimestampProps extends Omit<ComponentPropsWithSlot<"time">, "children" | "title"> {
|
|
465
545
|
/**
|
|
466
546
|
* The date to display.
|
|
@@ -499,4 +579,4 @@ interface TimestampProps extends Omit<ComponentPropsWithSlot<"time">, "children"
|
|
|
499
579
|
*/
|
|
500
580
|
declare const Timestamp: React__default.ForwardRefExoticComponent<TimestampProps & React__default.RefAttributes<HTMLTimeElement>>;
|
|
501
581
|
|
|
502
|
-
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 };
|
|
582
|
+
export { AttachmentTooLargeError, index$2 as Comment, CommentBodyComponents, CommentBodyLinkProps, CommentBodyMentionProps, CommentBodyProps, CommentLinkProps, CommentMentionProps, index$1 as Composer, ComposerAttachFilesProps, ComposerAttachmentsDropAreaProps, 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, FileSize, FileSizeProps, Timestamp, TimestampProps, useComposer };
|
package/dist/primitives/index.js
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
var index = require('./Comment/index.js');
|
|
4
4
|
var index$1 = require('./Composer/index.js');
|
|
5
5
|
var contexts = require('./Composer/contexts.js');
|
|
6
|
+
var utils = require('./Composer/utils.js');
|
|
6
7
|
var index$2 = require('./EmojiPicker/index.js');
|
|
8
|
+
var FileSize = require('./FileSize.js');
|
|
7
9
|
var Timestamp = require('./Timestamp.js');
|
|
8
10
|
|
|
9
11
|
|
|
@@ -11,6 +13,8 @@ var Timestamp = require('./Timestamp.js');
|
|
|
11
13
|
exports.Comment = index;
|
|
12
14
|
exports.Composer = index$1;
|
|
13
15
|
exports.useComposer = contexts.useComposer;
|
|
16
|
+
exports.AttachmentTooLargeError = utils.AttachmentTooLargeError;
|
|
14
17
|
exports.EmojiPicker = index$2;
|
|
18
|
+
exports.FileSize = FileSize.FileSize;
|
|
15
19
|
exports.Timestamp = Timestamp.Timestamp;
|
|
16
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,7 +3,9 @@ export { index as Comment };
|
|
|
3
3
|
import * as index$1 from './Composer/index.mjs';
|
|
4
4
|
export { index$1 as Composer };
|
|
5
5
|
export { useComposer } from './Composer/contexts.mjs';
|
|
6
|
+
export { AttachmentTooLargeError } from './Composer/utils.mjs';
|
|
6
7
|
import * as index$2 from './EmojiPicker/index.mjs';
|
|
7
8
|
export { index$2 as EmojiPicker };
|
|
9
|
+
export { FileSize } from './FileSize.mjs';
|
|
8
10
|
export { Timestamp } from './Timestamp.mjs';
|
|
9
11
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function download(url, name) {
|
|
4
|
+
const a = document.createElement("a");
|
|
5
|
+
a.href = url;
|
|
6
|
+
a.download = name;
|
|
7
|
+
a.style.display = "none";
|
|
8
|
+
document.body.appendChild(a);
|
|
9
|
+
a.click();
|
|
10
|
+
document.body.removeChild(a);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.download = download;
|
|
14
|
+
//# sourceMappingURL=download.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download.js","sources":["../../src/utils/download.ts"],"sourcesContent":["export function download(url: string, name: string) {\n const a = document.createElement(\"a\");\n a.href = url;\n a.download = name;\n a.style.display = \"none\";\n\n document.body.appendChild(a);\n a.click();\n document.body.removeChild(a);\n}\n"],"names":[],"mappings":";;AAAgB,SAAA,QAAA,CAAS,KAAa,IAAc,EAAA;AAClD,EAAM,MAAA,CAAA,GAAI,QAAS,CAAA,aAAA,CAAc,GAAG,CAAA,CAAA;AACpC,EAAA,CAAA,CAAE,IAAO,GAAA,GAAA,CAAA;AACT,EAAA,CAAA,CAAE,QAAW,GAAA,IAAA,CAAA;AACb,EAAA,CAAA,CAAE,MAAM,OAAU,GAAA,MAAA,CAAA;AAElB,EAAS,QAAA,CAAA,IAAA,CAAK,YAAY,CAAC,CAAA,CAAA;AAC3B,EAAA,CAAA,CAAE,KAAM,EAAA,CAAA;AACR,EAAS,QAAA,CAAA,IAAA,CAAK,YAAY,CAAC,CAAA,CAAA;AAC7B;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function download(url, name) {
|
|
2
|
+
const a = document.createElement("a");
|
|
3
|
+
a.href = url;
|
|
4
|
+
a.download = name;
|
|
5
|
+
a.style.display = "none";
|
|
6
|
+
document.body.appendChild(a);
|
|
7
|
+
a.click();
|
|
8
|
+
document.body.removeChild(a);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { download };
|
|
12
|
+
//# sourceMappingURL=download.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download.mjs","sources":["../../src/utils/download.ts"],"sourcesContent":["export function download(url: string, name: string) {\n const a = document.createElement(\"a\");\n a.href = url;\n a.download = name;\n a.style.display = \"none\";\n\n document.body.appendChild(a);\n a.click();\n document.body.removeChild(a);\n}\n"],"names":[],"mappings":"AAAgB,SAAA,QAAA,CAAS,KAAa,IAAc,EAAA;AAClD,EAAM,MAAA,CAAA,GAAI,QAAS,CAAA,aAAA,CAAc,GAAG,CAAA,CAAA;AACpC,EAAA,CAAA,CAAE,IAAO,GAAA,GAAA,CAAA;AACT,EAAA,CAAA,CAAE,QAAW,GAAA,IAAA,CAAA;AACb,EAAA,CAAA,CAAE,MAAM,OAAU,GAAA,MAAA,CAAA;AAElB,EAAS,QAAA,CAAA,IAAA,CAAK,YAAY,CAAC,CAAA,CAAA;AAC3B,EAAA,CAAA,CAAE,KAAM,EAAA,CAAA;AACR,EAAS,QAAA,CAAA,IAAA,CAAK,YAAY,CAAC,CAAA,CAAA;AAC7B;;;;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var intl = require('./intl.js');
|
|
4
|
+
|
|
5
|
+
const BASE = 1e3;
|
|
6
|
+
const UNITS = ["B", "KB", "MB", "GB"];
|
|
7
|
+
function formatFileSize(bytes, locale) {
|
|
8
|
+
if (bytes === 0) {
|
|
9
|
+
return `0 ${UNITS[1]}`;
|
|
10
|
+
}
|
|
11
|
+
let unit;
|
|
12
|
+
if (bytes === 0) {
|
|
13
|
+
unit = 1;
|
|
14
|
+
} else {
|
|
15
|
+
unit = Math.max(
|
|
16
|
+
1,
|
|
17
|
+
Math.min(
|
|
18
|
+
Math.floor(Math.log(Math.abs(bytes)) / Math.log(BASE)),
|
|
19
|
+
UNITS.length - 1
|
|
20
|
+
)
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
let value = bytes / BASE ** unit;
|
|
24
|
+
let maximumDecimals = 1;
|
|
25
|
+
if (unit === 1) {
|
|
26
|
+
if (value >= 10) {
|
|
27
|
+
maximumDecimals = 0;
|
|
28
|
+
}
|
|
29
|
+
if (value < 0.1 && value > 0) {
|
|
30
|
+
maximumDecimals = 2;
|
|
31
|
+
}
|
|
32
|
+
if (value < 0.01) {
|
|
33
|
+
value = 0.01;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const formattedUnit = UNITS[unit];
|
|
37
|
+
const formattedValue = intl.numberFormat(locale, {
|
|
38
|
+
minimumFractionDigits: 0,
|
|
39
|
+
maximumFractionDigits: maximumDecimals
|
|
40
|
+
}).format(value);
|
|
41
|
+
return `${formattedValue} ${formattedUnit}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
exports.formatFileSize = formatFileSize;
|
|
45
|
+
//# sourceMappingURL=format-file-size.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-file-size.js","sources":["../../src/utils/format-file-size.ts"],"sourcesContent":["import { numberFormat } from \"./intl\";\n\nconst BASE = 1000;\nconst UNITS = [\"B\", \"KB\", \"MB\", \"GB\"] as const;\n\nexport function formatFileSize(bytes: number, locale?: string) {\n if (bytes === 0) {\n return `0 ${UNITS[1]}`;\n }\n\n let unit: number;\n\n if (bytes === 0) {\n unit = 1;\n } else {\n unit = Math.max(\n 1,\n Math.min(\n Math.floor(Math.log(Math.abs(bytes)) / Math.log(BASE)),\n UNITS.length - 1\n )\n );\n }\n\n let value = bytes / BASE ** unit;\n let maximumDecimals = 1;\n\n if (unit === 1) {\n // Hide decimals for KB values above 10\n if (value >= 10) {\n maximumDecimals = 0;\n }\n\n // Allow 2 decimals instead of 1 for KB values below 0.1\n if (value < 0.1 && value > 0) {\n maximumDecimals = 2;\n }\n\n // Display tiny KB values as 0.01 KB instead of 0 KB\n if (value < 0.01) {\n value = 0.01;\n }\n }\n\n const formattedUnit = UNITS[unit];\n const formattedValue = numberFormat(locale, {\n minimumFractionDigits: 0,\n maximumFractionDigits: maximumDecimals,\n }).format(value);\n\n return `${formattedValue} ${formattedUnit}`;\n}\n"],"names":["numberFormat"],"mappings":";;;;AAEA,MAAM,IAAO,GAAA,GAAA,CAAA;AACb,MAAM,KAAQ,GAAA,CAAC,GAAK,EAAA,IAAA,EAAM,MAAM,IAAI,CAAA,CAAA;AAEpB,SAAA,cAAA,CAAe,OAAe,MAAiB,EAAA;AAC7D,EAAA,IAAI,UAAU,CAAG,EAAA;AACf,IAAA,OAAO,KAAK,KAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,GACpB;AAEA,EAAI,IAAA,IAAA,CAAA;AAEJ,EAAA,IAAI,UAAU,CAAG,EAAA;AACf,IAAO,IAAA,GAAA,CAAA,CAAA;AAAA,GACF,MAAA;AACL,IAAA,IAAA,GAAO,IAAK,CAAA,GAAA;AAAA,MACV,CAAA;AAAA,MACA,IAAK,CAAA,GAAA;AAAA,QACH,IAAK,CAAA,KAAA,CAAM,IAAK,CAAA,GAAA,CAAI,IAAK,CAAA,GAAA,CAAI,KAAK,CAAC,CAAI,GAAA,IAAA,CAAK,GAAI,CAAA,IAAI,CAAC,CAAA;AAAA,QACrD,MAAM,MAAS,GAAA,CAAA;AAAA,OACjB;AAAA,KACF,CAAA;AAAA,GACF;AAEA,EAAI,IAAA,KAAA,GAAQ,QAAQ,IAAQ,IAAA,IAAA,CAAA;AAC5B,EAAA,IAAI,eAAkB,GAAA,CAAA,CAAA;AAEtB,EAAA,IAAI,SAAS,CAAG,EAAA;AAEd,IAAA,IAAI,SAAS,EAAI,EAAA;AACf,MAAkB,eAAA,GAAA,CAAA,CAAA;AAAA,KACpB;AAGA,IAAI,IAAA,KAAA,GAAQ,GAAO,IAAA,KAAA,GAAQ,CAAG,EAAA;AAC5B,MAAkB,eAAA,GAAA,CAAA,CAAA;AAAA,KACpB;AAGA,IAAA,IAAI,QAAQ,IAAM,EAAA;AAChB,MAAQ,KAAA,GAAA,IAAA,CAAA;AAAA,KACV;AAAA,GACF;AAEA,EAAA,MAAM,gBAAgB,KAAM,CAAA,IAAA,CAAA,CAAA;AAC5B,EAAM,MAAA,cAAA,GAAiBA,kBAAa,MAAQ,EAAA;AAAA,IAC1C,qBAAuB,EAAA,CAAA;AAAA,IACvB,qBAAuB,EAAA,eAAA;AAAA,GACxB,CAAE,CAAA,MAAA,CAAO,KAAK,CAAA,CAAA;AAEf,EAAA,OAAO,GAAG,cAAkB,CAAA,CAAA,EAAA,aAAA,CAAA,CAAA,CAAA;AAC9B;;;;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { numberFormat } from './intl.mjs';
|
|
2
|
+
|
|
3
|
+
const BASE = 1e3;
|
|
4
|
+
const UNITS = ["B", "KB", "MB", "GB"];
|
|
5
|
+
function formatFileSize(bytes, locale) {
|
|
6
|
+
if (bytes === 0) {
|
|
7
|
+
return `0 ${UNITS[1]}`;
|
|
8
|
+
}
|
|
9
|
+
let unit;
|
|
10
|
+
if (bytes === 0) {
|
|
11
|
+
unit = 1;
|
|
12
|
+
} else {
|
|
13
|
+
unit = Math.max(
|
|
14
|
+
1,
|
|
15
|
+
Math.min(
|
|
16
|
+
Math.floor(Math.log(Math.abs(bytes)) / Math.log(BASE)),
|
|
17
|
+
UNITS.length - 1
|
|
18
|
+
)
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
let value = bytes / BASE ** unit;
|
|
22
|
+
let maximumDecimals = 1;
|
|
23
|
+
if (unit === 1) {
|
|
24
|
+
if (value >= 10) {
|
|
25
|
+
maximumDecimals = 0;
|
|
26
|
+
}
|
|
27
|
+
if (value < 0.1 && value > 0) {
|
|
28
|
+
maximumDecimals = 2;
|
|
29
|
+
}
|
|
30
|
+
if (value < 0.01) {
|
|
31
|
+
value = 0.01;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const formattedUnit = UNITS[unit];
|
|
35
|
+
const formattedValue = numberFormat(locale, {
|
|
36
|
+
minimumFractionDigits: 0,
|
|
37
|
+
maximumFractionDigits: maximumDecimals
|
|
38
|
+
}).format(value);
|
|
39
|
+
return `${formattedValue} ${formattedUnit}`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { formatFileSize };
|
|
43
|
+
//# sourceMappingURL=format-file-size.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-file-size.mjs","sources":["../../src/utils/format-file-size.ts"],"sourcesContent":["import { numberFormat } from \"./intl\";\n\nconst BASE = 1000;\nconst UNITS = [\"B\", \"KB\", \"MB\", \"GB\"] as const;\n\nexport function formatFileSize(bytes: number, locale?: string) {\n if (bytes === 0) {\n return `0 ${UNITS[1]}`;\n }\n\n let unit: number;\n\n if (bytes === 0) {\n unit = 1;\n } else {\n unit = Math.max(\n 1,\n Math.min(\n Math.floor(Math.log(Math.abs(bytes)) / Math.log(BASE)),\n UNITS.length - 1\n )\n );\n }\n\n let value = bytes / BASE ** unit;\n let maximumDecimals = 1;\n\n if (unit === 1) {\n // Hide decimals for KB values above 10\n if (value >= 10) {\n maximumDecimals = 0;\n }\n\n // Allow 2 decimals instead of 1 for KB values below 0.1\n if (value < 0.1 && value > 0) {\n maximumDecimals = 2;\n }\n\n // Display tiny KB values as 0.01 KB instead of 0 KB\n if (value < 0.01) {\n value = 0.01;\n }\n }\n\n const formattedUnit = UNITS[unit];\n const formattedValue = numberFormat(locale, {\n minimumFractionDigits: 0,\n maximumFractionDigits: maximumDecimals,\n }).format(value);\n\n return `${formattedValue} ${formattedUnit}`;\n}\n"],"names":[],"mappings":";;AAEA,MAAM,IAAO,GAAA,GAAA,CAAA;AACb,MAAM,KAAQ,GAAA,CAAC,GAAK,EAAA,IAAA,EAAM,MAAM,IAAI,CAAA,CAAA;AAEpB,SAAA,cAAA,CAAe,OAAe,MAAiB,EAAA;AAC7D,EAAA,IAAI,UAAU,CAAG,EAAA;AACf,IAAA,OAAO,KAAK,KAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,GACpB;AAEA,EAAI,IAAA,IAAA,CAAA;AAEJ,EAAA,IAAI,UAAU,CAAG,EAAA;AACf,IAAO,IAAA,GAAA,CAAA,CAAA;AAAA,GACF,MAAA;AACL,IAAA,IAAA,GAAO,IAAK,CAAA,GAAA;AAAA,MACV,CAAA;AAAA,MACA,IAAK,CAAA,GAAA;AAAA,QACH,IAAK,CAAA,KAAA,CAAM,IAAK,CAAA,GAAA,CAAI,IAAK,CAAA,GAAA,CAAI,KAAK,CAAC,CAAI,GAAA,IAAA,CAAK,GAAI,CAAA,IAAI,CAAC,CAAA;AAAA,QACrD,MAAM,MAAS,GAAA,CAAA;AAAA,OACjB;AAAA,KACF,CAAA;AAAA,GACF;AAEA,EAAI,IAAA,KAAA,GAAQ,QAAQ,IAAQ,IAAA,IAAA,CAAA;AAC5B,EAAA,IAAI,eAAkB,GAAA,CAAA,CAAA;AAEtB,EAAA,IAAI,SAAS,CAAG,EAAA;AAEd,IAAA,IAAI,SAAS,EAAI,EAAA;AACf,MAAkB,eAAA,GAAA,CAAA,CAAA;AAAA,KACpB;AAGA,IAAI,IAAA,KAAA,GAAQ,GAAO,IAAA,KAAA,GAAQ,CAAG,EAAA;AAC5B,MAAkB,eAAA,GAAA,CAAA,CAAA;AAAA,KACpB;AAGA,IAAA,IAAI,QAAQ,IAAM,EAAA;AAChB,MAAQ,KAAA,GAAA,IAAA,CAAA;AAAA,KACV;AAAA,GACF;AAEA,EAAA,MAAM,gBAAgB,KAAM,CAAA,IAAA,CAAA,CAAA;AAC5B,EAAM,MAAA,cAAA,GAAiB,aAAa,MAAQ,EAAA;AAAA,IAC1C,qBAAuB,EAAA,CAAA;AAAA,IACvB,qBAAuB,EAAA,eAAA;AAAA,GACxB,CAAE,CAAA,MAAA,CAAO,KAAK,CAAA,CAAA;AAEf,EAAA,OAAO,GAAG,cAAkB,CAAA,CAAA,EAAA,aAAA,CAAA,CAAA,CAAA;AAC9B;;;;"}
|
package/dist/utils/intl.js
CHANGED
|
@@ -17,8 +17,14 @@ const listFormat = memoize.memoize(
|
|
|
17
17
|
return new Intl.ListFormat(...args);
|
|
18
18
|
}
|
|
19
19
|
);
|
|
20
|
+
const numberFormat = memoize.memoize(
|
|
21
|
+
(...args) => {
|
|
22
|
+
return new Intl.NumberFormat(...args);
|
|
23
|
+
}
|
|
24
|
+
);
|
|
20
25
|
|
|
21
26
|
exports.dateTimeFormat = dateTimeFormat;
|
|
22
27
|
exports.listFormat = listFormat;
|
|
28
|
+
exports.numberFormat = numberFormat;
|
|
23
29
|
exports.relativeTimeFormat = relativeTimeFormat;
|
|
24
30
|
//# sourceMappingURL=intl.js.map
|
package/dist/utils/intl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intl.js","sources":["../../src/utils/intl.ts"],"sourcesContent":["import { memoize } from \"./memoize\";\n\n// Avoid creating Intl formatters on every invocation.\n\nexport const dateTimeFormat = memoize(\n (...args: ConstructorParameters<(typeof Intl)[\"DateTimeFormat\"]>) => {\n return new Intl.DateTimeFormat(...args);\n }\n);\n\nexport const relativeTimeFormat = memoize(\n (...args: ConstructorParameters<(typeof Intl)[\"RelativeTimeFormat\"]>) => {\n return new Intl.RelativeTimeFormat(...args);\n }\n);\n\nexport const listFormat = memoize(\n (...args: ConstructorParameters<(typeof Intl)[\"ListFormat\"]>) => {\n return new Intl.ListFormat(...args);\n }\n);\n"],"names":["memoize"],"mappings":";;;;AAIO,MAAM,cAAiB,GAAAA,eAAA;AAAA,EAC5B,IAAI,IAAiE,KAAA;AACnE,IAAA,OAAO,IAAI,IAAA,CAAK,cAAe,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GACxC;AACF,EAAA;AAEO,MAAM,kBAAqB,GAAAA,eAAA;AAAA,EAChC,IAAI,IAAqE,KAAA;AACvE,IAAA,OAAO,IAAI,IAAA,CAAK,kBAAmB,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GAC5C;AACF,EAAA;AAEO,MAAM,UAAa,GAAAA,eAAA;AAAA,EACxB,IAAI,IAA6D,KAAA;AAC/D,IAAA,OAAO,IAAI,IAAA,CAAK,UAAW,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GACpC;AACF
|
|
1
|
+
{"version":3,"file":"intl.js","sources":["../../src/utils/intl.ts"],"sourcesContent":["import { memoize } from \"./memoize\";\n\n// Avoid creating Intl formatters on every invocation.\n\nexport const dateTimeFormat = memoize(\n (...args: ConstructorParameters<(typeof Intl)[\"DateTimeFormat\"]>) => {\n return new Intl.DateTimeFormat(...args);\n }\n);\n\nexport const relativeTimeFormat = memoize(\n (...args: ConstructorParameters<(typeof Intl)[\"RelativeTimeFormat\"]>) => {\n return new Intl.RelativeTimeFormat(...args);\n }\n);\n\nexport const listFormat = memoize(\n (...args: ConstructorParameters<(typeof Intl)[\"ListFormat\"]>) => {\n return new Intl.ListFormat(...args);\n }\n);\n\nexport const numberFormat = memoize(\n (...args: ConstructorParameters<(typeof Intl)[\"NumberFormat\"]>) => {\n return new Intl.NumberFormat(...args);\n }\n);\n"],"names":["memoize"],"mappings":";;;;AAIO,MAAM,cAAiB,GAAAA,eAAA;AAAA,EAC5B,IAAI,IAAiE,KAAA;AACnE,IAAA,OAAO,IAAI,IAAA,CAAK,cAAe,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GACxC;AACF,EAAA;AAEO,MAAM,kBAAqB,GAAAA,eAAA;AAAA,EAChC,IAAI,IAAqE,KAAA;AACvE,IAAA,OAAO,IAAI,IAAA,CAAK,kBAAmB,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GAC5C;AACF,EAAA;AAEO,MAAM,UAAa,GAAAA,eAAA;AAAA,EACxB,IAAI,IAA6D,KAAA;AAC/D,IAAA,OAAO,IAAI,IAAA,CAAK,UAAW,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GACpC;AACF,EAAA;AAEO,MAAM,YAAe,GAAAA,eAAA;AAAA,EAC1B,IAAI,IAA+D,KAAA;AACjE,IAAA,OAAO,IAAI,IAAA,CAAK,YAAa,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GACtC;AACF;;;;;;;"}
|
package/dist/utils/intl.mjs
CHANGED
|
@@ -15,6 +15,11 @@ const listFormat = memoize(
|
|
|
15
15
|
return new Intl.ListFormat(...args);
|
|
16
16
|
}
|
|
17
17
|
);
|
|
18
|
+
const numberFormat = memoize(
|
|
19
|
+
(...args) => {
|
|
20
|
+
return new Intl.NumberFormat(...args);
|
|
21
|
+
}
|
|
22
|
+
);
|
|
18
23
|
|
|
19
|
-
export { dateTimeFormat, listFormat, relativeTimeFormat };
|
|
24
|
+
export { dateTimeFormat, listFormat, numberFormat, relativeTimeFormat };
|
|
20
25
|
//# sourceMappingURL=intl.mjs.map
|
package/dist/utils/intl.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intl.mjs","sources":["../../src/utils/intl.ts"],"sourcesContent":["import { memoize } from \"./memoize\";\n\n// Avoid creating Intl formatters on every invocation.\n\nexport const dateTimeFormat = memoize(\n (...args: ConstructorParameters<(typeof Intl)[\"DateTimeFormat\"]>) => {\n return new Intl.DateTimeFormat(...args);\n }\n);\n\nexport const relativeTimeFormat = memoize(\n (...args: ConstructorParameters<(typeof Intl)[\"RelativeTimeFormat\"]>) => {\n return new Intl.RelativeTimeFormat(...args);\n }\n);\n\nexport const listFormat = memoize(\n (...args: ConstructorParameters<(typeof Intl)[\"ListFormat\"]>) => {\n return new Intl.ListFormat(...args);\n }\n);\n"],"names":[],"mappings":";;AAIO,MAAM,cAAiB,GAAA,OAAA;AAAA,EAC5B,IAAI,IAAiE,KAAA;AACnE,IAAA,OAAO,IAAI,IAAA,CAAK,cAAe,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GACxC;AACF,EAAA;AAEO,MAAM,kBAAqB,GAAA,OAAA;AAAA,EAChC,IAAI,IAAqE,KAAA;AACvE,IAAA,OAAO,IAAI,IAAA,CAAK,kBAAmB,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GAC5C;AACF,EAAA;AAEO,MAAM,UAAa,GAAA,OAAA;AAAA,EACxB,IAAI,IAA6D,KAAA;AAC/D,IAAA,OAAO,IAAI,IAAA,CAAK,UAAW,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GACpC;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"intl.mjs","sources":["../../src/utils/intl.ts"],"sourcesContent":["import { memoize } from \"./memoize\";\n\n// Avoid creating Intl formatters on every invocation.\n\nexport const dateTimeFormat = memoize(\n (...args: ConstructorParameters<(typeof Intl)[\"DateTimeFormat\"]>) => {\n return new Intl.DateTimeFormat(...args);\n }\n);\n\nexport const relativeTimeFormat = memoize(\n (...args: ConstructorParameters<(typeof Intl)[\"RelativeTimeFormat\"]>) => {\n return new Intl.RelativeTimeFormat(...args);\n }\n);\n\nexport const listFormat = memoize(\n (...args: ConstructorParameters<(typeof Intl)[\"ListFormat\"]>) => {\n return new Intl.ListFormat(...args);\n }\n);\n\nexport const numberFormat = memoize(\n (...args: ConstructorParameters<(typeof Intl)[\"NumberFormat\"]>) => {\n return new Intl.NumberFormat(...args);\n }\n);\n"],"names":[],"mappings":";;AAIO,MAAM,cAAiB,GAAA,OAAA;AAAA,EAC5B,IAAI,IAAiE,KAAA;AACnE,IAAA,OAAO,IAAI,IAAA,CAAK,cAAe,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GACxC;AACF,EAAA;AAEO,MAAM,kBAAqB,GAAA,OAAA;AAAA,EAChC,IAAI,IAAqE,KAAA;AACvE,IAAA,OAAO,IAAI,IAAA,CAAK,kBAAmB,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GAC5C;AACF,EAAA;AAEO,MAAM,UAAa,GAAA,OAAA;AAAA,EACxB,IAAI,IAA6D,KAAA;AAC/D,IAAA,OAAO,IAAI,IAAA,CAAK,UAAW,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GACpC;AACF,EAAA;AAEO,MAAM,YAAe,GAAA,OAAA;AAAA,EAC1B,IAAI,IAA+D,KAAA;AACjE,IAAA,OAAO,IAAI,IAAA,CAAK,YAAa,CAAA,GAAG,IAAI,CAAA,CAAA;AAAA,GACtC;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-initial.js","sources":["../../src/utils/use-initial.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"use-initial.js","sources":["../../src/utils/use-initial.ts"],"sourcesContent":["import { useState } from \"react\";\n\n/**\n * \"Freezes\" a given value, so that it will return the same value/instance on\n * each subsequent render. This can be used to freeze \"initial\" values for\n * custom hooks, much like how `useState(initialState)` or\n * `useRef(initialValue)` works.\n */\nexport function useInitial<T>(value: T | (() => T)): T {\n const [initialValue] = useState(value);\n\n return initialValue;\n}\n"],"names":["useState"],"mappings":";;;;AAQO,SAAS,WAAc,KAAyB,EAAA;AACrD,EAAA,MAAM,CAAC,YAAY,CAAI,GAAAA,cAAA,CAAS,KAAK,CAAA,CAAA;AAErC,EAAO,OAAA,YAAA,CAAA;AACT;;;;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useState } from 'react';
|
|
2
2
|
|
|
3
3
|
function useInitial(value) {
|
|
4
|
-
|
|
4
|
+
const [initialValue] = useState(value);
|
|
5
|
+
return initialValue;
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
export { useInitial };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-initial.mjs","sources":["../../src/utils/use-initial.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"use-initial.mjs","sources":["../../src/utils/use-initial.ts"],"sourcesContent":["import { useState } from \"react\";\n\n/**\n * \"Freezes\" a given value, so that it will return the same value/instance on\n * each subsequent render. This can be used to freeze \"initial\" values for\n * custom hooks, much like how `useState(initialState)` or\n * `useRef(initialValue)` works.\n */\nexport function useInitial<T>(value: T | (() => T)): T {\n const [initialValue] = useState(value);\n\n return initialValue;\n}\n"],"names":[],"mappings":";;AAQO,SAAS,WAAc,KAAyB,EAAA;AACrD,EAAA,MAAM,CAAC,YAAY,CAAI,GAAA,QAAA,CAAS,KAAK,CAAA,CAAA;AAErC,EAAO,OAAA,YAAA,CAAA;AACT;;;;"}
|
package/dist/version.js
CHANGED
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-ui\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":";;AAGO,MAAM,QAAW,GAAA,uBAAA;AACX,MAAA,WAAA,GAAiD,
|
|
1
|
+
{"version":3,"file":"version.js","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-ui\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":";;AAGO,MAAM,QAAW,GAAA,uBAAA;AACX,MAAA,WAAA,GAAiD,cAAA;AACjD,MAAA,UAAA,GAAkD;;;;;;"}
|
package/dist/version.mjs
CHANGED
package/dist/version.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-ui\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":"AAGO,MAAM,QAAW,GAAA,uBAAA;AACX,MAAA,WAAA,GAAiD,
|
|
1
|
+
{"version":3,"file":"version.mjs","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-ui\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":"AAGO,MAAM,QAAW,GAAA,uBAAA;AACX,MAAA,WAAA,GAAiD,cAAA;AACjD,MAAA,UAAA,GAAkD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liveblocks/react-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0-beta1",
|
|
4
4
|
"description": "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.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@floating-ui/react-dom": "^2.0.8",
|
|
66
|
-
"@liveblocks/client": "2.
|
|
67
|
-
"@liveblocks/core": "2.
|
|
68
|
-
"@liveblocks/react": "2.
|
|
66
|
+
"@liveblocks/client": "2.7.0-beta1",
|
|
67
|
+
"@liveblocks/core": "2.7.0-beta1",
|
|
68
|
+
"@liveblocks/react": "2.7.0-beta1",
|
|
69
69
|
"@radix-ui/react-dropdown-menu": "^2.0.6",
|
|
70
70
|
"@radix-ui/react-popover": "^1.0.7",
|
|
71
71
|
"@radix-ui/react-slot": "^1.0.2",
|