@kenyani/react-emoji-reaction-bar 0.0.2

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 ADDED
@@ -0,0 +1,75 @@
1
+ # React + TypeScript + Vite
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
+ ```
package/dist/index.cjs ADDED
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ ReactionBar: () => ReactionBar
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+
27
+ // src/components/ReactionBar.tsx
28
+ var import_react = require("react");
29
+ var import_framer_motion = require("framer-motion");
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ function ReactionBar({
32
+ reactions = ["\u{1F44D}", "\u2764\uFE0F", "\u{1F602}", "\u{1F389}"],
33
+ onReact
34
+ }) {
35
+ const [selected, setSelected] = (0, import_react.useState)(null);
36
+ const [floating, setFloating] = (0, import_react.useState)([]);
37
+ const handleReact = (emoji) => {
38
+ setSelected(emoji);
39
+ onReact?.(emoji);
40
+ const id = Date.now();
41
+ setFloating((prev) => [...prev, { emoji, id }]);
42
+ setTimeout(() => {
43
+ setFloating((prev) => prev.filter((f) => f.id !== id));
44
+ }, 900);
45
+ };
46
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "container", children: [
47
+ reactions.map((emoji) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
48
+ import_framer_motion.motion.button,
49
+ {
50
+ className: "button",
51
+ whileHover: { scale: 1.3 },
52
+ whileTap: { scale: 0.9 },
53
+ animate: {
54
+ scale: selected === emoji ? 1.25 : 1
55
+ },
56
+ transition: {
57
+ type: "spring",
58
+ stiffness: 500,
59
+ damping: 20
60
+ },
61
+ onClick: () => handleReact(emoji),
62
+ children: emoji
63
+ },
64
+ emoji
65
+ )),
66
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "floatingLayer", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_framer_motion.AnimatePresence, { children: floating.map((f) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
67
+ import_framer_motion.motion.span,
68
+ {
69
+ className: "floatingEmoji",
70
+ initial: { y: 0, opacity: 1, scale: 1 },
71
+ animate: { y: -60, opacity: 0, scale: 1.6 },
72
+ exit: { opacity: 0 },
73
+ transition: {
74
+ type: "spring",
75
+ stiffness: 120,
76
+ damping: 10,
77
+ duration: 0.9
78
+ },
79
+ children: f.emoji
80
+ },
81
+ f.id
82
+ )) }) })
83
+ ] });
84
+ }
85
+ // Annotate the CommonJS export names for ESM import in node:
86
+ 0 && (module.exports = {
87
+ ReactionBar
88
+ });
package/dist/index.css ADDED
@@ -0,0 +1,26 @@
1
+ /* src/styles.css */
2
+ .container {
3
+ position: relative;
4
+ display: inline-flex;
5
+ gap: 10px;
6
+ padding: 10px 14px;
7
+ border-radius: 40px;
8
+ backdrop-filter: blur(10px);
9
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
10
+ }
11
+ .button {
12
+ font-size: 24px;
13
+ cursor: pointer;
14
+ border: none;
15
+ background: transparent;
16
+ }
17
+ .floatingLayer {
18
+ position: absolute;
19
+ left: 50%;
20
+ top: -10px;
21
+ pointer-events: none;
22
+ }
23
+ .floatingEmoji {
24
+ position: absolute;
25
+ font-size: 22px;
26
+ }
@@ -0,0 +1,10 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ interface ReactionBarProps {
4
+ reactions?: string[];
5
+ onReact?: (emoji: string) => void;
6
+ }
7
+
8
+ declare function ReactionBar({ reactions, onReact, }: ReactionBarProps): react_jsx_runtime.JSX.Element;
9
+
10
+ export { ReactionBar, type ReactionBarProps };
@@ -0,0 +1,10 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ interface ReactionBarProps {
4
+ reactions?: string[];
5
+ onReact?: (emoji: string) => void;
6
+ }
7
+
8
+ declare function ReactionBar({ reactions, onReact, }: ReactionBarProps): react_jsx_runtime.JSX.Element;
9
+
10
+ export { ReactionBar, type ReactionBarProps };
package/dist/index.js ADDED
@@ -0,0 +1,61 @@
1
+ // src/components/ReactionBar.tsx
2
+ import { useState } from "react";
3
+ import { motion, AnimatePresence } from "framer-motion";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ function ReactionBar({
6
+ reactions = ["\u{1F44D}", "\u2764\uFE0F", "\u{1F602}", "\u{1F389}"],
7
+ onReact
8
+ }) {
9
+ const [selected, setSelected] = useState(null);
10
+ const [floating, setFloating] = useState([]);
11
+ const handleReact = (emoji) => {
12
+ setSelected(emoji);
13
+ onReact?.(emoji);
14
+ const id = Date.now();
15
+ setFloating((prev) => [...prev, { emoji, id }]);
16
+ setTimeout(() => {
17
+ setFloating((prev) => prev.filter((f) => f.id !== id));
18
+ }, 900);
19
+ };
20
+ return /* @__PURE__ */ jsxs("div", { className: "container", children: [
21
+ reactions.map((emoji) => /* @__PURE__ */ jsx(
22
+ motion.button,
23
+ {
24
+ className: "button",
25
+ whileHover: { scale: 1.3 },
26
+ whileTap: { scale: 0.9 },
27
+ animate: {
28
+ scale: selected === emoji ? 1.25 : 1
29
+ },
30
+ transition: {
31
+ type: "spring",
32
+ stiffness: 500,
33
+ damping: 20
34
+ },
35
+ onClick: () => handleReact(emoji),
36
+ children: emoji
37
+ },
38
+ emoji
39
+ )),
40
+ /* @__PURE__ */ jsx("div", { className: "floatingLayer", children: /* @__PURE__ */ jsx(AnimatePresence, { children: floating.map((f) => /* @__PURE__ */ jsx(
41
+ motion.span,
42
+ {
43
+ className: "floatingEmoji",
44
+ initial: { y: 0, opacity: 1, scale: 1 },
45
+ animate: { y: -60, opacity: 0, scale: 1.6 },
46
+ exit: { opacity: 0 },
47
+ transition: {
48
+ type: "spring",
49
+ stiffness: 120,
50
+ damping: 10,
51
+ duration: 0.9
52
+ },
53
+ children: f.emoji
54
+ },
55
+ f.id
56
+ )) }) })
57
+ ] });
58
+ }
59
+ export {
60
+ ReactionBar
61
+ };
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@kenyani/react-emoji-reaction-bar",
3
+ "private": false,
4
+ "version": "0.0.2",
5
+ "type": "module",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "scripts": {
13
+ "dev": "vite",
14
+ "build": "tsc -b && vite build",
15
+ "lint": "eslint .",
16
+ "preview": "vite preview",
17
+ "bundle": "tsup src/index.ts"
18
+ },
19
+ "dependencies": {
20
+ "framer-motion": "^12.36.0",
21
+ "react": "^19.2.4",
22
+ "react-dom": "^19.2.4"
23
+ },
24
+ "devDependencies": {
25
+ "@babel/core": "^7.29.0",
26
+ "@eslint/js": "^9.39.4",
27
+ "@rolldown/plugin-babel": "^0.2.0",
28
+ "@types/babel__core": "^7.20.5",
29
+ "@types/node": "^24.12.0",
30
+ "@types/react": "^19.2.14",
31
+ "@types/react-dom": "^19.2.3",
32
+ "@vitejs/plugin-react": "^6.0.0",
33
+ "babel-plugin-react-compiler": "^1.0.0",
34
+ "eslint": "^9.39.4",
35
+ "eslint-plugin-react-hooks": "^7.0.1",
36
+ "eslint-plugin-react-refresh": "^0.5.2",
37
+ "globals": "^17.4.0",
38
+ "tsup": "^8.5.1",
39
+ "typescript": "~5.9.3",
40
+ "typescript-eslint": "^8.56.1",
41
+ "vite": "^8.0.0"
42
+ },
43
+ "author": "Kenyani",
44
+ "license": "MIT",
45
+ "keywords": [
46
+ "xxx",
47
+ "xxx"
48
+ ],
49
+ "homepage": "xxxx",
50
+ "github": {
51
+ "url": "https://github.com/Rachel-Kenyani"
52
+ }
53
+ }