react-mention-input 1.1.6 → 1.1.8

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.
@@ -1,107 +1,125 @@
1
- .mention-container {
2
- position: relative;
3
- display: flex;
4
- align-items: center;
5
- }
6
-
7
- .mention-input-container{
8
- border: 1px solid #ccc;
9
- border-radius: 8px;
10
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
11
- transition: border 0.2s, box-shadow 0.2s;
12
- width: 100%;
13
- padding: 12px 16px;
14
- position: relative;
15
- display: flex;
16
- align-items: center;
17
-
18
- }
19
- .mention-input {
20
- border: none;
21
- outline: none;
22
- font-size: 16px;
23
- flex: 1;
24
-
25
- }
26
- .mention-input:focus {
27
- border: none;
28
- outline: none;
29
- }
30
-
31
- .send-button {
32
- padding: 4px 10x;
33
- border: 1px solid #ccc;
34
- border-radius: 8px;
35
- background-color: #007BFF;
36
- color: #fff;
37
-
38
- cursor: pointer;
39
- font-size: 18px;
40
- display: flex;
41
- align-items: center;
42
- justify-content: center;
43
- }
44
-
45
- /* .suggestion-list {
46
- position: absolute;
47
- top: 100%;
48
- left: 0;
49
- right: 0;
50
- background-color: #fff;
51
- border: 1px solid #ddd;
52
- border-radius: 4px;
53
- list-style: none;
54
- margin: 4px 0;
55
- padding: 0;
56
- max-height: 150px;
57
- overflow-y: auto;
58
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
59
- z-index: 1;
60
- } */
61
-
62
- .suggestion-list {
63
- max-height: 150px;
64
- overflow-y: auto;
65
- background: #fff;
66
- border: 1px solid #ddd;
67
- border-radius: 4px;
68
- z-index: 1000;
69
- width: auto;
70
- white-space: nowrap;
71
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
72
- }
73
-
74
-
75
- .suggestion-item {
76
- padding: 8px 12px;
77
- cursor: pointer;
78
- border-bottom: 1px solid #ddd;
79
- transition: background-color 0.2s;
80
- }
81
-
82
- .suggestion-item:hover {
83
- background-color: #f5f5f5;
84
- }
85
-
86
-
87
- .mention-highlight {
88
- background-color: #e0f7fa;
89
- color: #007bff;
90
- padding: 2px 4px;
91
- border-radius: 4px;
92
- }
93
-
94
- .mention-input .placeholder {
95
- color: #aaa;
96
- pointer-events: none;
97
- position: absolute;
98
- }
99
-
100
- .link-highlight {
101
- color: #007bff;
102
- text-decoration: underline;
103
- cursor: pointer;
104
- }
105
- .link-highlight:hover {
106
- color: #0056b3;
1
+ .mention-container {
2
+ position: relative;
3
+ display: flex;
4
+ align-items: center;
5
+ }
6
+
7
+ .mention-input-container{
8
+ border: 1px solid #ccc;
9
+ border-radius: 8px;
10
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
11
+ transition: border 0.2s, box-shadow 0.2s;
12
+ width: 100%;
13
+ padding: 12px 16px;
14
+ position: relative;
15
+ display: flex;
16
+ align-items: center;
17
+
18
+ }
19
+ .mention-input {
20
+ border: none;
21
+ outline: none;
22
+ font-size: 16px;
23
+ flex: 1;
24
+
25
+ }
26
+ .mention-input:focus {
27
+ border: none;
28
+ outline: none;
29
+ }
30
+
31
+ .send-button {
32
+ padding: 4px 10x;
33
+ border: 1px solid #ccc;
34
+ border-radius: 8px;
35
+ background-color: #007BFF;
36
+ color: #fff;
37
+
38
+ cursor: pointer;
39
+ font-size: 18px;
40
+ display: flex;
41
+ align-items: center;
42
+ justify-content: center;
43
+ }
44
+
45
+ /* .suggestion-list {
46
+ position: absolute;
47
+ top: 100%;
48
+ left: 0;
49
+ right: 0;
50
+ background-color: #fff;
51
+ border: 1px solid #ddd;
52
+ border-radius: 4px;
53
+ list-style: none;
54
+ margin: 4px 0;
55
+ padding: 0;
56
+ max-height: 150px;
57
+ overflow-y: auto;
58
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
59
+ z-index: 1;
60
+ } */
61
+
62
+ .suggestion-list {
63
+ max-height: 150px;
64
+ overflow-y: auto;
65
+ background: #fff;
66
+ border: 1px solid #ddd;
67
+ border-radius: 4px;
68
+ z-index: 1000;
69
+ width: auto;
70
+ white-space: nowrap;
71
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
72
+ }
73
+
74
+
75
+ .user-icon {
76
+ width: 25px;
77
+ height: 25px;
78
+ border-radius: 50%;
79
+ display: flex;
80
+ align-items: center;
81
+ justify-content: center;
82
+ font-size: 12px;
83
+ font-weight: bold;
84
+ color: #fff;
85
+ background-color: #007bff;
86
+ text-transform: uppercase;
87
+ margin-right: 4px;
88
+ }
89
+
90
+
91
+ .suggestion-item {
92
+ display: flex;
93
+ align-items: center;
94
+ padding: 8px 12px;
95
+ cursor: pointer;
96
+ border-bottom: 1px solid #ddd;
97
+ transition: background-color 0.2s;
98
+ }
99
+
100
+ .suggestion-item:hover {
101
+ background-color: #f5f5f5;
102
+ }
103
+
104
+
105
+ .mention-highlight {
106
+ background-color: #e0f7fa;
107
+ color: #007bff;
108
+ padding: 2px 4px;
109
+ border-radius: 4px;
110
+ }
111
+
112
+ .mention-input .placeholder {
113
+ color: #aaa;
114
+ pointer-events: none;
115
+ position: absolute;
116
+ }
117
+
118
+ .link-highlight {
119
+ color: #007bff;
120
+ text-decoration: underline;
121
+ cursor: pointer;
122
+ }
123
+ .link-highlight:hover {
124
+ color: #0056b3;
107
125
  }
@@ -97,6 +97,14 @@ var MentionInput = function (_a) {
97
97
  position: 'absolute',
98
98
  zIndex: 1000,
99
99
  };
100
+ var getInitials = function (name) {
101
+ var nameParts = name.split(" ");
102
+ var initials = nameParts
103
+ .map(function (part) { var _a; return ((_a = part[0]) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || ""; }) // Take the first letter of each part
104
+ .slice(0, 2) // Limit to 2 letters
105
+ .join("");
106
+ return initials;
107
+ };
100
108
  // Use suggestionPosition prop to adjust tooltip position
101
109
  switch (suggestionPosition) {
102
110
  case 'top':
@@ -118,7 +126,9 @@ var MentionInput = function (_a) {
118
126
  default:
119
127
  break;
120
128
  }
121
- return ReactDOM.createPortal(React.createElement("ul", { className: "suggestion-list ".concat(suggestionListClassName || ''), ref: suggestionListRef, style: styles }, suggestions.map(function (user) { return (React.createElement("li", { key: user.id, onClick: function () { return handleSuggestionClick(user); }, className: "suggestion-item ".concat(suggestionItemClassName || ''), role: "option", tabIndex: 0, "aria-selected": "false" }, user.name)); })), window.document.body // Render in portal
129
+ return ReactDOM.createPortal(React.createElement("ul", { className: "suggestion-list ".concat(suggestionListClassName || ''), ref: suggestionListRef, style: styles }, suggestions.map(function (user) { return (React.createElement("li", { key: user.id, onClick: function () { return handleSuggestionClick(user); }, className: "suggestion-item ".concat(suggestionItemClassName || ''), role: "option", tabIndex: 0, "aria-selected": "false" },
130
+ React.createElement("div", { className: "user-icon" }, getInitials(user === null || user === void 0 ? void 0 : user.name)),
131
+ user.name)); })), window.document.body // Render in portal
122
132
  );
123
133
  };
124
134
  var handleSuggestionClick = function (user) {
@@ -1,75 +1,75 @@
1
- .message-card-container {
2
- display: flex;
3
- flex-direction: column;
4
- gap: 16px; /* Space between cards */
5
- }
6
-
7
- .message-card {
8
- display: flex;
9
- flex-direction: column;
10
- border: 1px solid #ccc;
11
- border-radius: 8px;
12
- padding: 16px;
13
- background-color: #fff;
14
- transition: box-shadow 0.2s;
15
- }
16
-
17
- .message-card:hover {
18
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
19
- }
20
-
21
- .message-card-header {
22
- display: flex;
23
- align-items: center;
24
- margin-bottom: 8px; /* Space between header and body */
25
- }
26
-
27
- .message-card-img,
28
- .message-card-initials {
29
- width: 48px;
30
- height: 48px;
31
- border-radius: 50%;
32
- display: flex;
33
- align-items: center;
34
- justify-content: center;
35
- font-size: 16px;
36
- font-weight: bold;
37
- color: #fff;
38
- background-color: #007bff;
39
- text-transform: uppercase;
40
- margin-right: 16px;
41
- }
42
- .message-card-info {
43
- display: flex;
44
- flex-direction: column;
45
- }
46
-
47
- .message-card-name {
48
- margin: 0;
49
- font-size: 18px;
50
- font-weight: bold;
51
- line-height: 1.2; /* Adjust line height for better spacing */
52
- }
53
-
54
- .message-card-date {
55
- margin: 0;
56
- font-size: 14px;
57
- color: #888;
58
- line-height: 1.2; /* Adjust line height for better spacing */
59
- }
60
-
61
- .message-card-body {
62
- margin-top: 8px; /* Space between header and comment */
63
- }
64
-
65
- .message-card-comment {
66
- margin: 0;
67
- font-size: 16px;
68
- line-height: 1.5; /* Optimal line height for readability */
69
- }
70
- .mention-highlight {
71
- background-color: #e0f7fa;
72
- color: #007bff;
73
- padding: 2px 4px;
74
- border-radius: 4px;
1
+ .message-card-container {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 16px; /* Space between cards */
5
+ }
6
+
7
+ .message-card {
8
+ display: flex;
9
+ flex-direction: column;
10
+ border: 1px solid #ccc;
11
+ border-radius: 8px;
12
+ padding: 16px;
13
+ background-color: #fff;
14
+ transition: box-shadow 0.2s;
15
+ }
16
+
17
+ .message-card:hover {
18
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
19
+ }
20
+
21
+ .message-card-header {
22
+ display: flex;
23
+ align-items: center;
24
+ margin-bottom: 8px; /* Space between header and body */
25
+ }
26
+
27
+ .message-card-img,
28
+ .message-card-initials {
29
+ width: 48px;
30
+ height: 48px;
31
+ border-radius: 50%;
32
+ display: flex;
33
+ align-items: center;
34
+ justify-content: center;
35
+ font-size: 16px;
36
+ font-weight: bold;
37
+ color: #fff;
38
+ background-color: #007bff;
39
+ text-transform: uppercase;
40
+ margin-right: 16px;
41
+ }
42
+ .message-card-info {
43
+ display: flex;
44
+ flex-direction: column;
45
+ }
46
+
47
+ .message-card-name {
48
+ margin: 0;
49
+ font-size: 18px;
50
+ font-weight: bold;
51
+ line-height: 1.2; /* Adjust line height for better spacing */
52
+ }
53
+
54
+ .message-card-date {
55
+ margin: 0;
56
+ font-size: 14px;
57
+ color: #888;
58
+ line-height: 1.2; /* Adjust line height for better spacing */
59
+ }
60
+
61
+ .message-card-body {
62
+ margin-top: 8px; /* Space between header and comment */
63
+ }
64
+
65
+ .message-card-comment {
66
+ margin: 0;
67
+ font-size: 16px;
68
+ line-height: 1.5; /* Optimal line height for readability */
69
+ }
70
+ .mention-highlight {
71
+ background-color: #e0f7fa;
72
+ color: #007bff;
73
+ padding: 2px 4px;
74
+ border-radius: 4px;
75
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-mention-input",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -1,107 +1,125 @@
1
- .mention-container {
2
- position: relative;
3
- display: flex;
4
- align-items: center;
5
- }
6
-
7
- .mention-input-container{
8
- border: 1px solid #ccc;
9
- border-radius: 8px;
10
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
11
- transition: border 0.2s, box-shadow 0.2s;
12
- width: 100%;
13
- padding: 12px 16px;
14
- position: relative;
15
- display: flex;
16
- align-items: center;
17
-
18
- }
19
- .mention-input {
20
- border: none;
21
- outline: none;
22
- font-size: 16px;
23
- flex: 1;
24
-
25
- }
26
- .mention-input:focus {
27
- border: none;
28
- outline: none;
29
- }
30
-
31
- .send-button {
32
- padding: 4px 10x;
33
- border: 1px solid #ccc;
34
- border-radius: 8px;
35
- background-color: #007BFF;
36
- color: #fff;
37
-
38
- cursor: pointer;
39
- font-size: 18px;
40
- display: flex;
41
- align-items: center;
42
- justify-content: center;
43
- }
44
-
45
- /* .suggestion-list {
46
- position: absolute;
47
- top: 100%;
48
- left: 0;
49
- right: 0;
50
- background-color: #fff;
51
- border: 1px solid #ddd;
52
- border-radius: 4px;
53
- list-style: none;
54
- margin: 4px 0;
55
- padding: 0;
56
- max-height: 150px;
57
- overflow-y: auto;
58
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
59
- z-index: 1;
60
- } */
61
-
62
- .suggestion-list {
63
- max-height: 150px;
64
- overflow-y: auto;
65
- background: #fff;
66
- border: 1px solid #ddd;
67
- border-radius: 4px;
68
- z-index: 1000;
69
- width: auto;
70
- white-space: nowrap;
71
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
72
- }
73
-
74
-
75
- .suggestion-item {
76
- padding: 8px 12px;
77
- cursor: pointer;
78
- border-bottom: 1px solid #ddd;
79
- transition: background-color 0.2s;
80
- }
81
-
82
- .suggestion-item:hover {
83
- background-color: #f5f5f5;
84
- }
85
-
86
-
87
- .mention-highlight {
88
- background-color: #e0f7fa;
89
- color: #007bff;
90
- padding: 2px 4px;
91
- border-radius: 4px;
92
- }
93
-
94
- .mention-input .placeholder {
95
- color: #aaa;
96
- pointer-events: none;
97
- position: absolute;
98
- }
99
-
100
- .link-highlight {
101
- color: #007bff;
102
- text-decoration: underline;
103
- cursor: pointer;
104
- }
105
- .link-highlight:hover {
106
- color: #0056b3;
1
+ .mention-container {
2
+ position: relative;
3
+ display: flex;
4
+ align-items: center;
5
+ }
6
+
7
+ .mention-input-container{
8
+ border: 1px solid #ccc;
9
+ border-radius: 8px;
10
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
11
+ transition: border 0.2s, box-shadow 0.2s;
12
+ width: 100%;
13
+ padding: 12px 16px;
14
+ position: relative;
15
+ display: flex;
16
+ align-items: center;
17
+
18
+ }
19
+ .mention-input {
20
+ border: none;
21
+ outline: none;
22
+ font-size: 16px;
23
+ flex: 1;
24
+
25
+ }
26
+ .mention-input:focus {
27
+ border: none;
28
+ outline: none;
29
+ }
30
+
31
+ .send-button {
32
+ padding: 4px 10x;
33
+ border: 1px solid #ccc;
34
+ border-radius: 8px;
35
+ background-color: #007BFF;
36
+ color: #fff;
37
+
38
+ cursor: pointer;
39
+ font-size: 18px;
40
+ display: flex;
41
+ align-items: center;
42
+ justify-content: center;
43
+ }
44
+
45
+ /* .suggestion-list {
46
+ position: absolute;
47
+ top: 100%;
48
+ left: 0;
49
+ right: 0;
50
+ background-color: #fff;
51
+ border: 1px solid #ddd;
52
+ border-radius: 4px;
53
+ list-style: none;
54
+ margin: 4px 0;
55
+ padding: 0;
56
+ max-height: 150px;
57
+ overflow-y: auto;
58
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
59
+ z-index: 1;
60
+ } */
61
+
62
+ .suggestion-list {
63
+ max-height: 150px;
64
+ overflow-y: auto;
65
+ background: #fff;
66
+ border: 1px solid #ddd;
67
+ border-radius: 4px;
68
+ z-index: 1000;
69
+ width: auto;
70
+ white-space: nowrap;
71
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
72
+ }
73
+
74
+
75
+ .user-icon {
76
+ width: 25px;
77
+ height: 25px;
78
+ border-radius: 50%;
79
+ display: flex;
80
+ align-items: center;
81
+ justify-content: center;
82
+ font-size: 12px;
83
+ font-weight: bold;
84
+ color: #fff;
85
+ background-color: #007bff;
86
+ text-transform: uppercase;
87
+ margin-right: 4px;
88
+ }
89
+
90
+
91
+ .suggestion-item {
92
+ display: flex;
93
+ align-items: center;
94
+ padding: 8px 12px;
95
+ cursor: pointer;
96
+ border-bottom: 1px solid #ddd;
97
+ transition: background-color 0.2s;
98
+ }
99
+
100
+ .suggestion-item:hover {
101
+ background-color: #f5f5f5;
102
+ }
103
+
104
+
105
+ .mention-highlight {
106
+ background-color: #e0f7fa;
107
+ color: #007bff;
108
+ padding: 2px 4px;
109
+ border-radius: 4px;
110
+ }
111
+
112
+ .mention-input .placeholder {
113
+ color: #aaa;
114
+ pointer-events: none;
115
+ position: absolute;
116
+ }
117
+
118
+ .link-highlight {
119
+ color: #007bff;
120
+ text-decoration: underline;
121
+ cursor: pointer;
122
+ }
123
+ .link-highlight:hover {
124
+ color: #0056b3;
107
125
  }