@bigbinary/neeto-molecules 3.15.38 → 3.15.40
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/Engagements.js +292 -0
- package/dist/Engagements.js.map +1 -0
- package/dist/IpRestriction.js +5 -1
- package/dist/IpRestriction.js.map +1 -1
- package/dist/cjs/Engagements.js +294 -0
- package/dist/cjs/Engagements.js.map +1 -0
- package/dist/cjs/IpRestriction.js +5 -1
- package/dist/cjs/IpRestriction.js.map +1 -1
- package/package.json +1 -1
- package/src/translations/en.json +1 -0
- package/types/Engagements.d.ts +131 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-molecules",
|
|
3
|
-
"version": "3.15.
|
|
3
|
+
"version": "3.15.40",
|
|
4
4
|
"description": "A package of reusable molecular components for neeto products.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-molecules.git",
|
|
6
6
|
"author": "Amaljith K <amaljith.k@bigbinary.com>",
|
package/src/translations/en.json
CHANGED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { ENGAGEMENT_TYPES } from 'components/Engagements/constants';
|
|
2
|
+
|
|
3
|
+
type Emoji = {
|
|
4
|
+
native: string;
|
|
5
|
+
unified: string;
|
|
6
|
+
};
|
|
7
|
+
type MenuItems = {
|
|
8
|
+
label: string;
|
|
9
|
+
onClick: () => void;
|
|
10
|
+
key: string;
|
|
11
|
+
isVisible?: boolean;
|
|
12
|
+
hasSubItems?: boolean;
|
|
13
|
+
dropdownProps?: DropdownProps;
|
|
14
|
+
menuItems?: MenuItems[];
|
|
15
|
+
};
|
|
16
|
+
type UserData = {
|
|
17
|
+
name: string;
|
|
18
|
+
profileImageUrl?: string;
|
|
19
|
+
};
|
|
20
|
+
type CommentData = {
|
|
21
|
+
id: string;
|
|
22
|
+
createdAt?: string;
|
|
23
|
+
commenter?: UserData;
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
};
|
|
26
|
+
type ActivityData = {
|
|
27
|
+
id: string;
|
|
28
|
+
creator?: UserData;
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
};
|
|
31
|
+
type EngagementType = typeof ENGAGEMENT_TYPES[number];
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* The Engagements component renders the general layout for comments and
|
|
35
|
+
*
|
|
36
|
+
* activities to show user engagement timeline.
|
|
37
|
+
*
|
|
38
|
+
* The main container component for the Engagements components that wraps the
|
|
39
|
+
*
|
|
40
|
+
* items.
|
|
41
|
+
*
|
|
42
|
+
* A wrapper component to be used within the Engagements to render individual
|
|
43
|
+
*
|
|
44
|
+
* comment.
|
|
45
|
+
*
|
|
46
|
+
* A wrapper component to be used within the Engagements to render individual
|
|
47
|
+
*
|
|
48
|
+
* activity.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
*
|
|
52
|
+
* import { useState } from "react";
|
|
53
|
+
* import { User } from "neetoicons";
|
|
54
|
+
* import { Typography } from "neetoui";
|
|
55
|
+
*
|
|
56
|
+
* import Engagements from "neetomolecules/Engagements";
|
|
57
|
+
*
|
|
58
|
+
* const Timeline = () => {
|
|
59
|
+
* const [data] = useState([
|
|
60
|
+
* {
|
|
61
|
+
* id: "comment-1",
|
|
62
|
+
* content: "Hi world!",
|
|
63
|
+
* commenter: { name: "Oliver Smith" },
|
|
64
|
+
* createdAt: Date().toString(),
|
|
65
|
+
* },
|
|
66
|
+
* {
|
|
67
|
+
* id: "comment-2",
|
|
68
|
+
* content: "Hi Oliver!",
|
|
69
|
+
* commenter: { name: "Lily James" },
|
|
70
|
+
* createdAt: Date().toString(),
|
|
71
|
+
* },
|
|
72
|
+
* {
|
|
73
|
+
* id: "activity-1",
|
|
74
|
+
* type: "USER_EXIT",
|
|
75
|
+
* creator: { name: "Oliver Smith" },
|
|
76
|
+
* createdAt: Date().toString(),
|
|
77
|
+
* },
|
|
78
|
+
* ]);
|
|
79
|
+
*
|
|
80
|
+
* return (
|
|
81
|
+
* <Engagements
|
|
82
|
+
* {...{ data }}
|
|
83
|
+
* isActivitiesEnabled
|
|
84
|
+
* renderActivity={engagement => (
|
|
85
|
+
* <Engagements.Activity icon={<User />} user={engagement.creator}>
|
|
86
|
+
* <Typography style="body2">
|
|
87
|
+
* {engagement.type === "USER_EXIT" &&
|
|
88
|
+
* `${engagement.creator.name} left this conversation`}
|
|
89
|
+
* </Typography>
|
|
90
|
+
* </Engagements.Activity>
|
|
91
|
+
* )}
|
|
92
|
+
* renderComment={engagement => (
|
|
93
|
+
* <Engagements.Comment
|
|
94
|
+
* comment={engagement}
|
|
95
|
+
* info="messaged"
|
|
96
|
+
* user={engagement.commenter}
|
|
97
|
+
* >
|
|
98
|
+
* <Typography style="body2">{engagement.content}</Typography>
|
|
99
|
+
* </Engagements.Comment>
|
|
100
|
+
* )}
|
|
101
|
+
* />
|
|
102
|
+
* );
|
|
103
|
+
* };
|
|
104
|
+
* @endexample
|
|
105
|
+
*/
|
|
106
|
+
declare const Engagements: React.FC<{
|
|
107
|
+
data: Array<CommentData | ActivityData>;
|
|
108
|
+
isActivitiesEnabled?: boolean;
|
|
109
|
+
matchType?: (engagement: CommentData | ActivityData) => EngagementType;
|
|
110
|
+
renderComment: (engagement: CommentData, index: number) => React.ReactNode;
|
|
111
|
+
renderActivity: (engagement: ActivityData, index: number) => React.ReactNode;
|
|
112
|
+
}> & {
|
|
113
|
+
Comment: React.FC<{
|
|
114
|
+
user: UserData;
|
|
115
|
+
comment: CommentData;
|
|
116
|
+
reactions?: boolean | Emoji[];
|
|
117
|
+
info?: string;
|
|
118
|
+
actions?: MenuItems[];
|
|
119
|
+
className?: string;
|
|
120
|
+
onAddReaction: (emoji: Emoji) => void;
|
|
121
|
+
onRemoveReaction: (emoji: Emoji) => void;
|
|
122
|
+
}>;
|
|
123
|
+
Activity: React.FC<{
|
|
124
|
+
user: UserData;
|
|
125
|
+
icon: React.ReactNode;
|
|
126
|
+
unread?: boolean;
|
|
127
|
+
className?: string;
|
|
128
|
+
}>;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export { Engagements as default };
|