@talkjs/react-components 0.0.13 → 0.0.14
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/base.css +1 -1
- package/default.css +1 -1
- package/default.d.ts +32 -14
- package/default.js +165 -147
- package/package.json +3 -2
- package/theming.d.ts +75 -13
- package/theming.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@talkjs/react-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"bugs": {
|
|
5
5
|
"url": "https://talkjs.com/?chat"
|
|
6
6
|
},
|
|
@@ -24,9 +24,10 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@floating-ui/dom": "^1.6.5",
|
|
26
26
|
"@legendapp/state": "3.0.0-alpha.9",
|
|
27
|
-
"@
|
|
27
|
+
"@radix-ui/react-dropdown-menu": "^2.1.15",
|
|
28
28
|
"@talkjs/core": "~1.4.2",
|
|
29
29
|
"autolinker": "^4.0.0",
|
|
30
|
+
"emoji-picker-element": "1.8.2",
|
|
30
31
|
"htm": "^3.1.1",
|
|
31
32
|
"lodash.merge": "^4.6.2",
|
|
32
33
|
"onecolor": "^4.1.0",
|
package/theming.d.ts
CHANGED
|
@@ -145,8 +145,6 @@ export declare interface Chatbox {
|
|
|
145
145
|
custom?: Record<string, string>;
|
|
146
146
|
}): Promise<void>;
|
|
147
147
|
setReferencedMessage(messageId: string | null): void;
|
|
148
|
-
openMessageActionMenu(messageId: string): void;
|
|
149
|
-
closeMessageActionMenu(): void;
|
|
150
148
|
getMessageFieldText: () => string;
|
|
151
149
|
setMessageFieldText: (text: string) => void;
|
|
152
150
|
}
|
|
@@ -162,6 +160,7 @@ export declare interface ChatHeaderProps {
|
|
|
162
160
|
[userId: string]: boolean;
|
|
163
161
|
};
|
|
164
162
|
permissions: UserPermissions;
|
|
163
|
+
device: DeviceFeatures;
|
|
165
164
|
}
|
|
166
165
|
|
|
167
166
|
export declare interface ContentBlockProps {
|
|
@@ -184,12 +183,24 @@ export declare interface DeleteMessageEvent {
|
|
|
184
183
|
conversation: ConversationSnapshot;
|
|
185
184
|
}
|
|
186
185
|
|
|
186
|
+
export declare interface DeviceFeatures {
|
|
187
|
+
/**
|
|
188
|
+
* True if the browser supports IndexedDB, which the emoji picker depends on.
|
|
189
|
+
*/
|
|
190
|
+
supportsEmojiPicker: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* True if the user agents reports this device as mobile (incl tablets).
|
|
193
|
+
*/
|
|
194
|
+
isMobile: boolean;
|
|
195
|
+
}
|
|
196
|
+
|
|
187
197
|
export declare function Editor({ placeholder, disabled, className, characterLimit, spellcheck, }: EditorProps): JSX.Element;
|
|
188
198
|
|
|
189
199
|
export declare interface EditorController extends EditorState {
|
|
190
200
|
send(): void;
|
|
191
201
|
shareLocation(): void;
|
|
192
202
|
attachFile(): void;
|
|
203
|
+
toggleEmojiPicker(): void;
|
|
193
204
|
}
|
|
194
205
|
|
|
195
206
|
export declare interface EditorProps {
|
|
@@ -205,6 +216,13 @@ declare interface EditorState {
|
|
|
205
216
|
atTextLimit: boolean;
|
|
206
217
|
isEmpty: boolean;
|
|
207
218
|
characterCount: number;
|
|
219
|
+
showEmojiPicker: boolean;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export declare function EmojiPicker(props: EmojiPickerProps): JSX.Element;
|
|
223
|
+
|
|
224
|
+
declare interface EmojiPickerProps {
|
|
225
|
+
colorScheme: "light" | "dark";
|
|
208
226
|
}
|
|
209
227
|
|
|
210
228
|
export { FileBlock }
|
|
@@ -255,15 +273,43 @@ export declare interface LocationBlockProps extends ContentBlockProps {
|
|
|
255
273
|
block: LocationBlock;
|
|
256
274
|
}
|
|
257
275
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
276
|
+
/**
|
|
277
|
+
* MenuButton component that renders a dropdown menu triggered by a button.
|
|
278
|
+
*
|
|
279
|
+
* Usage:
|
|
280
|
+
* <MenuButton
|
|
281
|
+
* menuComponent={YourMenuComponent}
|
|
282
|
+
* menuProps={{ prop1: value1, prop2: value2 }}
|
|
283
|
+
* aria-label="Message actions"
|
|
284
|
+
* >
|
|
285
|
+
* <Icon type="horizontalDots" />
|
|
286
|
+
* </MenuButton>
|
|
287
|
+
*
|
|
288
|
+
* All props except for menuComponent and menuProps are passed to the button element.
|
|
289
|
+
*
|
|
290
|
+
* The menuComponent should be a component that renders the dropdown content.
|
|
291
|
+
* The menuProps are passed to the menuComponent.
|
|
292
|
+
*
|
|
293
|
+
* The menu component shouod render the MenuItem component for each menu item it wants to include.
|
|
294
|
+
*
|
|
295
|
+
* This is meant as a reuseable and accessible dropdown menu. We're using Radix for this, because they fulli implement
|
|
296
|
+
* the ARIA Menu Button pattern, but without adding any styles, so we can completely customise the look and feel.
|
|
297
|
+
*/
|
|
298
|
+
export declare function MenuButton<T extends object>(props: MenuButtonProps<T>): JSX.Element;
|
|
299
|
+
|
|
300
|
+
export declare type MenuButtonProps<T extends object> = {
|
|
301
|
+
menuComponent: React.ComponentType<T>;
|
|
302
|
+
menuProps: T;
|
|
303
|
+
children: React.ReactNode;
|
|
304
|
+
} & React.HTMLAttributes<HTMLButtonElement>;
|
|
305
|
+
|
|
306
|
+
export declare function MenuItem(props: MenuItemProps): JSX.Element;
|
|
307
|
+
|
|
308
|
+
export declare type MenuItemProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
309
|
+
onSelect?: () => void;
|
|
310
|
+
disabled?: boolean;
|
|
311
|
+
textValue?: string;
|
|
312
|
+
};
|
|
267
313
|
|
|
268
314
|
export declare function MessageContent(props: MessageContentProps): JSX.Element;
|
|
269
315
|
|
|
@@ -297,6 +343,7 @@ export declare interface MessageFieldProps {
|
|
|
297
343
|
chatbox: Chatbox;
|
|
298
344
|
editor?: EditorController;
|
|
299
345
|
themeCustom?: any;
|
|
346
|
+
device: DeviceFeatures;
|
|
300
347
|
}
|
|
301
348
|
|
|
302
349
|
export declare interface MessageListFooterProps {
|
|
@@ -324,8 +371,8 @@ export declare interface MessageProps {
|
|
|
324
371
|
permissions: MessagePermissions;
|
|
325
372
|
t: Translation;
|
|
326
373
|
chatbox: Chatbox;
|
|
327
|
-
messageActionMenuAnchorRef: React_2.RefObject<HTMLElement | undefined>;
|
|
328
374
|
themeCustom?: any;
|
|
375
|
+
device: DeviceFeatures;
|
|
329
376
|
}
|
|
330
377
|
|
|
331
378
|
export { MessageSnapshot }
|
|
@@ -391,7 +438,6 @@ export declare interface Theme {
|
|
|
391
438
|
ChatHeader: React_2.ComponentType<ChatHeaderProps>;
|
|
392
439
|
Message: React_2.ComponentType<MessageProps>;
|
|
393
440
|
MessageField: React_2.ComponentType<MessageFieldProps>;
|
|
394
|
-
MessageActionMenu: React_2.ComponentType<MessageActionMenuProps>;
|
|
395
441
|
Icon: React_2.ComponentType<IconProps>;
|
|
396
442
|
MessageDivider: React_2.ComponentType<MessageDividerProps>;
|
|
397
443
|
MessageListFooter: React_2.ComponentType<MessageListFooterProps>;
|
|
@@ -533,6 +579,22 @@ export declare interface VoiceBlockProps extends ContentBlockProps {
|
|
|
533
579
|
export { }
|
|
534
580
|
|
|
535
581
|
|
|
582
|
+
declare global {
|
|
583
|
+
namespace JSX {
|
|
584
|
+
interface IntrinsicElements {
|
|
585
|
+
"emoji-picker": {
|
|
586
|
+
class?: string;
|
|
587
|
+
ref: React.Ref<HTMLElement>;
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
interface HTMLElementEventMap {
|
|
592
|
+
"emoji-click": EmojiClickEvent;
|
|
593
|
+
"skin-tone-change": SkinToneChangeEvent;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
|
|
536
598
|
declare global {
|
|
537
599
|
interface HTMLElementTagNameMap {
|
|
538
600
|
"t-chatbox": ChatboxHTMLElement;
|