@kenyani/react-emoji-reaction-bar 0.0.2 → 0.0.3
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/LICENSE +21 -0
- package/README.md +2 -75
- package/dist/index.cjs +2 -1
- package/dist/index.js +3 -2
- package/package.json +15 -8
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rachel Kenyani
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,75 +1,2 @@
|
|
|
1
|
-
# React
|
|
2
|
-
|
|
3
|
-
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
-
|
|
5
|
-
Currently, two official plugins are available:
|
|
6
|
-
|
|
7
|
-
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
|
|
8
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
|
|
9
|
-
|
|
10
|
-
## React Compiler
|
|
11
|
-
|
|
12
|
-
The React Compiler is enabled on this template. See [this documentation](https://react.dev/learn/react-compiler) for more information.
|
|
13
|
-
|
|
14
|
-
Note: This will impact Vite dev & build performances.
|
|
15
|
-
|
|
16
|
-
## Expanding the ESLint configuration
|
|
17
|
-
|
|
18
|
-
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
19
|
-
|
|
20
|
-
```js
|
|
21
|
-
export default defineConfig([
|
|
22
|
-
globalIgnores(['dist']),
|
|
23
|
-
{
|
|
24
|
-
files: ['**/*.{ts,tsx}'],
|
|
25
|
-
extends: [
|
|
26
|
-
// Other configs...
|
|
27
|
-
|
|
28
|
-
// Remove tseslint.configs.recommended and replace with this
|
|
29
|
-
tseslint.configs.recommendedTypeChecked,
|
|
30
|
-
// Alternatively, use this for stricter rules
|
|
31
|
-
tseslint.configs.strictTypeChecked,
|
|
32
|
-
// Optionally, add this for stylistic rules
|
|
33
|
-
tseslint.configs.stylisticTypeChecked,
|
|
34
|
-
|
|
35
|
-
// Other configs...
|
|
36
|
-
],
|
|
37
|
-
languageOptions: {
|
|
38
|
-
parserOptions: {
|
|
39
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
40
|
-
tsconfigRootDir: import.meta.dirname,
|
|
41
|
-
},
|
|
42
|
-
// other options...
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
])
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
49
|
-
|
|
50
|
-
```js
|
|
51
|
-
// eslint.config.js
|
|
52
|
-
import reactX from 'eslint-plugin-react-x'
|
|
53
|
-
import reactDom from 'eslint-plugin-react-dom'
|
|
54
|
-
|
|
55
|
-
export default defineConfig([
|
|
56
|
-
globalIgnores(['dist']),
|
|
57
|
-
{
|
|
58
|
-
files: ['**/*.{ts,tsx}'],
|
|
59
|
-
extends: [
|
|
60
|
-
// Other configs...
|
|
61
|
-
// Enable lint rules for React
|
|
62
|
-
reactX.configs['recommended-typescript'],
|
|
63
|
-
// Enable lint rules for React DOM
|
|
64
|
-
reactDom.configs.recommended,
|
|
65
|
-
],
|
|
66
|
-
languageOptions: {
|
|
67
|
-
parserOptions: {
|
|
68
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
69
|
-
tsconfigRootDir: import.meta.dirname,
|
|
70
|
-
},
|
|
71
|
-
// other options...
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
])
|
|
75
|
-
```
|
|
1
|
+
# React-emoji-reaction-bar
|
|
2
|
+
`react-emoji-reaction-bar` is a simple and flexible React component that lets you add emoji reactions to your app. It supports multiple reaction types, easy customization, and works seamlessly with modern React (18+). Ideal for social apps, blogs, messaging platforms, or anywhere you want to add interactive emoji feedback.
|
package/dist/index.cjs
CHANGED
|
@@ -32,12 +32,13 @@ function ReactionBar({
|
|
|
32
32
|
reactions = ["\u{1F44D}", "\u2764\uFE0F", "\u{1F602}", "\u{1F389}"],
|
|
33
33
|
onReact
|
|
34
34
|
}) {
|
|
35
|
+
const nextIdRef = (0, import_react.useRef)(1);
|
|
35
36
|
const [selected, setSelected] = (0, import_react.useState)(null);
|
|
36
37
|
const [floating, setFloating] = (0, import_react.useState)([]);
|
|
37
38
|
const handleReact = (emoji) => {
|
|
38
39
|
setSelected(emoji);
|
|
39
40
|
onReact?.(emoji);
|
|
40
|
-
const id =
|
|
41
|
+
const id = nextIdRef.current++;
|
|
41
42
|
setFloating((prev) => [...prev, { emoji, id }]);
|
|
42
43
|
setTimeout(() => {
|
|
43
44
|
setFloating((prev) => prev.filter((f) => f.id !== id));
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
// src/components/ReactionBar.tsx
|
|
2
|
-
import { useState } from "react";
|
|
2
|
+
import { useRef, useState } from "react";
|
|
3
3
|
import { motion, AnimatePresence } from "framer-motion";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
function ReactionBar({
|
|
6
6
|
reactions = ["\u{1F44D}", "\u2764\uFE0F", "\u{1F602}", "\u{1F389}"],
|
|
7
7
|
onReact
|
|
8
8
|
}) {
|
|
9
|
+
const nextIdRef = useRef(1);
|
|
9
10
|
const [selected, setSelected] = useState(null);
|
|
10
11
|
const [floating, setFloating] = useState([]);
|
|
11
12
|
const handleReact = (emoji) => {
|
|
12
13
|
setSelected(emoji);
|
|
13
14
|
onReact?.(emoji);
|
|
14
|
-
const id =
|
|
15
|
+
const id = nextIdRef.current++;
|
|
15
16
|
setFloating((prev) => [...prev, { emoji, id }]);
|
|
16
17
|
setTimeout(() => {
|
|
17
18
|
setFloating((prev) => prev.filter((f) => f.id !== id));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kenyani/react-emoji-reaction-bar",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"dev": "vite",
|
|
14
|
-
"build": "
|
|
14
|
+
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
15
15
|
"lint": "eslint .",
|
|
16
16
|
"preview": "vite preview",
|
|
17
17
|
"bundle": "tsup src/index.ts"
|
|
@@ -40,14 +40,21 @@
|
|
|
40
40
|
"typescript-eslint": "^8.56.1",
|
|
41
41
|
"vite": "^8.0.0"
|
|
42
42
|
},
|
|
43
|
-
"author": "Kenyani",
|
|
43
|
+
"author": "Rachel Kenyani",
|
|
44
44
|
"license": "MIT",
|
|
45
45
|
"keywords": [
|
|
46
|
-
"
|
|
47
|
-
"
|
|
46
|
+
"react",
|
|
47
|
+
"component",
|
|
48
|
+
"emoji",
|
|
49
|
+
"reaction",
|
|
50
|
+
"ui"
|
|
48
51
|
],
|
|
49
|
-
"homepage": "
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
+
"homepage": "https://github.com/Rachel-Kenyani/React-emoji-reaction-bar",
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/Rachel-Kenyani/React-emoji-reaction-bar.git"
|
|
56
|
+
},
|
|
57
|
+
"bugs": {
|
|
58
|
+
"url": "https://github.com/Rachel-Kenyani/React-emoji-reaction-bar/issues"
|
|
52
59
|
}
|
|
53
60
|
}
|