@orioro/react-reactions 0.0.1
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/README.md +1 -0
- package/dist/AnimatedCounter/index.d.ts +6 -0
- package/dist/EmojiPicker/index.d.ts +16 -0
- package/dist/ReactionCard/index.d.ts +10 -0
- package/dist/ReactionGroupTabs/index.d.ts +10 -0
- package/dist/ReactionsBar/index.d.ts +11 -0
- package/dist/ReactionsContext/ReactionsContext.d.ts +27 -0
- package/dist/ReactionsContext/index.d.ts +1 -0
- package/dist/ReactionsControl/index.d.ts +19 -0
- package/dist/ReactionsDisplay/index.d.ts +12 -0
- package/dist/constants.d.ts +1 -0
- package/dist/emoji-data-pt.json +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.mjs +961 -0
- package/dist/styles.css +74 -0
- package/dist/types.d.ts +23 -0
- package/dist/util/areReactionSetsEqual.d.ts +3 -0
- package/dist/util/arrayGroupBy.d.ts +3 -0
- package/dist/util/index.d.ts +2 -0
- package/package.json +45 -0
package/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Template react lib
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import type { Emoji } from '../types';
|
3
|
+
export type EmojiPickerProps = {
|
4
|
+
i18n?: {
|
5
|
+
[key: string]: any;
|
6
|
+
};
|
7
|
+
data?: {
|
8
|
+
[key: string]: any;
|
9
|
+
};
|
10
|
+
open: boolean;
|
11
|
+
onSetOpen: (open: boolean) => any;
|
12
|
+
onEmojiSelect: (emoji: Emoji) => any;
|
13
|
+
trigger?: React.ReactElement;
|
14
|
+
size?: number;
|
15
|
+
};
|
16
|
+
export declare function EmojiPicker({ i18n, data, open, onSetOpen, onEmojiSelect, trigger, size, }: EmojiPickerProps): React.JSX.Element;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { Reaction } from '../types';
|
3
|
+
type ReactionCardProps = {
|
4
|
+
reaction: Reaction;
|
5
|
+
onViewReaction?: ((reactionId: Reaction['id']) => any) | null;
|
6
|
+
onRemoveReaction?: ((reactionId: Reaction['id']) => any) | null;
|
7
|
+
authedUserId?: string | number | null;
|
8
|
+
};
|
9
|
+
export declare function ReactionCard({ reaction, onRemoveReaction, onViewReaction, authedUserId, }: ReactionCardProps): React.JSX.Element;
|
10
|
+
export {};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { Reaction, User } from '../types';
|
3
|
+
type ReactionGroupTabsProps = {
|
4
|
+
reactions: Reaction[];
|
5
|
+
authedUserId?: User['id'] | null;
|
6
|
+
onViewReaction?: ((reactionId: Reaction['id']) => any) | null;
|
7
|
+
onRemoveReaction?: ((reactionId: Reaction['id']) => any) | null;
|
8
|
+
};
|
9
|
+
export declare function ReactionGroupTabs({ reactions, authedUserId, onViewReaction, onRemoveReaction, }: ReactionGroupTabsProps): React.JSX.Element;
|
10
|
+
export {};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import './animations.css';
|
3
|
+
import { Reaction, User } from '../types';
|
4
|
+
export type ReactionsBarProps = {
|
5
|
+
reactions: Reaction[];
|
6
|
+
authedUserId?: User['id'] | null;
|
7
|
+
maxLength?: number;
|
8
|
+
counter?: boolean;
|
9
|
+
size?: number;
|
10
|
+
};
|
11
|
+
export declare function ReactionsBar({ reactions, authedUserId, maxLength, counter, size, }: ReactionsBarProps): React.JSX.Element;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { Reaction, User } from '../types';
|
3
|
+
export type ReactionsContextValue = {
|
4
|
+
authedUser: User | null;
|
5
|
+
reactions: Reaction[];
|
6
|
+
setReaction: (props: {
|
7
|
+
targetId: string | number;
|
8
|
+
emoji: Reaction['emoji'];
|
9
|
+
}) => Promise<any>;
|
10
|
+
removeReaction: (reactionId: Reaction['id']) => Promise<any>;
|
11
|
+
};
|
12
|
+
export declare const ReactionsContext: React.Context<ReactionsContextValue>;
|
13
|
+
export type ReactionsProviderProps = {
|
14
|
+
children: React.ReactNode;
|
15
|
+
authedUser: ReactionsContextValue['authedUser'];
|
16
|
+
reactions: ReactionsContextValue['reactions'];
|
17
|
+
onSetReaction: (props: {
|
18
|
+
userId: string | number;
|
19
|
+
targetId: string | number;
|
20
|
+
emoji: Reaction['emoji'];
|
21
|
+
}) => Promise<Reaction>;
|
22
|
+
onRemoveReaction: (reactionId: Reaction['id']) => Promise<any>;
|
23
|
+
};
|
24
|
+
export declare function ReactionsProvider({ authedUser, reactions, children, onSetReaction, onRemoveReaction, }: ReactionsProviderProps): React.JSX.Element;
|
25
|
+
export declare function useReactions({ targetId, }: {
|
26
|
+
targetId?: string | number;
|
27
|
+
}): ReactionsContextValue;
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './ReactionsContext';
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { Emoji, Reaction, User } from '../types';
|
3
|
+
export type ReactionsControlProps = {
|
4
|
+
reactions: Reaction[];
|
5
|
+
authedUser: User | null;
|
6
|
+
onAuthenticate?: () => Promise<User>;
|
7
|
+
onViewReaction?: (reactionId: Reaction['id']) => any;
|
8
|
+
onRemoveReaction?: (reactionId: Reaction['id']) => Promise<any>;
|
9
|
+
onSetReaction?: (emoji: Emoji) => Promise<Reaction>;
|
10
|
+
counter?: boolean;
|
11
|
+
maxLength?: number;
|
12
|
+
picker?: boolean;
|
13
|
+
alwaysShowPicker?: boolean;
|
14
|
+
style?: React.CSSProperties;
|
15
|
+
size?: number;
|
16
|
+
};
|
17
|
+
export declare const ReactionsControl: React.ForwardRefExoticComponent<ReactionsControlProps & React.RefAttributes<{
|
18
|
+
setReaction: ((emoji: Emoji) => Promise<void>) | null;
|
19
|
+
}>>;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { Reaction, User } from '../types';
|
3
|
+
export type ReactionsDisplayProps = {
|
4
|
+
reactions: Reaction[];
|
5
|
+
authedUserId?: User['id'] | null;
|
6
|
+
onViewReaction?: ((reactionId: Reaction['id']) => any) | null;
|
7
|
+
onRemoveReaction?: ((reactionId: Reaction['id']) => any) | null;
|
8
|
+
size?: number;
|
9
|
+
maxLength?: number;
|
10
|
+
counter?: boolean;
|
11
|
+
};
|
12
|
+
export declare function ReactionsDisplay({ reactions, authedUserId, onViewReaction, onRemoveReaction, size, maxLength, counter, }: ReactionsDisplayProps): React.JSX.Element;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const DEFAULT_SIZE = 18;
|