pop-emojis 0.0.0 → 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 +87 -60
- package/dist/pop-emojis.umd.cjs +2 -2
- package/package.json +11 -9
package/README.md
CHANGED
|
@@ -1,73 +1,100 @@
|
|
|
1
|
-
#
|
|
1
|
+
# pop-emojis 🎉
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A tiny, opinionated React component that creates smooth emoji pop animations on click — built on top of Framer Motion.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Perfect for reactions, likes, feedback buttons, and fun micro-interactions with **zero animation setup**.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
7
|
+
---
|
|
9
8
|
|
|
10
|
-
##
|
|
9
|
+
## ✨ Features
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
- **One-line usage** — Add emoji pops in seconds
|
|
12
|
+
- **Built on Framer Motion** — Smooth, physics-based animations
|
|
13
|
+
- **Sensible defaults** — Works great out of the box
|
|
14
|
+
- 📦 **Zero boilerplate** — No animation code required
|
|
15
|
+
- 🔒 **Fully typed** — Complete TypeScript support
|
|
16
|
+
- ⚛️ **React 17+** — Compatible with modern React
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
---
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
## 📦 Installation
|
|
17
21
|
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
```bash
|
|
23
|
+
npm install pop-emojis framer-motion
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
> **Note:** `framer-motion` is a peer dependency and must be installed separately.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 🚀 Usage
|
|
31
|
+
|
|
32
|
+
### Basic Example
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { EmojiPop } from "pop-emojis"
|
|
36
|
+
|
|
37
|
+
export default function App() {
|
|
38
|
+
return (
|
|
39
|
+
<div style={{ display: "flex", justifyContent: "center", marginTop: 100 }}>
|
|
40
|
+
<EmojiPop emoji="🫡" />
|
|
41
|
+
</div>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**What happens?**
|
|
25
47
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
tseslint.configs.strictTypeChecked,
|
|
30
|
-
// Optionally, add this for stylistic rules
|
|
31
|
-
tseslint.configs.stylisticTypeChecked,
|
|
48
|
+
1. You see 🫡
|
|
49
|
+
2. You click 🫡
|
|
50
|
+
3. Multiple 🫡 emojis pop out with smooth animations
|
|
32
51
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
38
|
-
tsconfigRootDir: import.meta.dirname,
|
|
39
|
-
},
|
|
40
|
-
// other options...
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
])
|
|
52
|
+
### Custom Count
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
<EmojiPop emoji="❤️" count={10} />
|
|
44
56
|
```
|
|
45
57
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
{
|
|
56
|
-
files: ['**/*.{ts,tsx}'],
|
|
57
|
-
extends: [
|
|
58
|
-
// Other configs...
|
|
59
|
-
// Enable lint rules for React
|
|
60
|
-
reactX.configs['recommended-typescript'],
|
|
61
|
-
// Enable lint rules for React DOM
|
|
62
|
-
reactDom.configs.recommended,
|
|
63
|
-
],
|
|
64
|
-
languageOptions: {
|
|
65
|
-
parserOptions: {
|
|
66
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
67
|
-
tsconfigRootDir: import.meta.dirname,
|
|
68
|
-
},
|
|
69
|
-
// other options...
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
])
|
|
58
|
+
### Different Emojis
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
<div style={{ display: "flex", gap: "1rem" }}>
|
|
62
|
+
<EmojiPop emoji="🎉" />
|
|
63
|
+
<EmojiPop emoji="👍" />
|
|
64
|
+
<EmojiPop emoji="🔥" />
|
|
65
|
+
<EmojiPop emoji="⭐" />
|
|
66
|
+
</div>
|
|
73
67
|
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## ⚙️ Props
|
|
72
|
+
|
|
73
|
+
| Prop | Type | Default | Description |
|
|
74
|
+
|---------|----------|---------|----------------------------------------|
|
|
75
|
+
| `emoji` | `string` | `"🫡"` | Emoji used for both button & animation |
|
|
76
|
+
| `count` | `number` | `6` | Number of emojis per click |
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 🤔 Why This Library?
|
|
81
|
+
|
|
82
|
+
Yes, you can use Framer Motion directly.
|
|
83
|
+
|
|
84
|
+
This library exists to:
|
|
85
|
+
|
|
86
|
+
✅ **Remove repetitive animation code** — Don't write the same pop logic over and over
|
|
87
|
+
|
|
88
|
+
✅ **Provide a ready-made reaction interaction** — Common UX pattern, pre-built
|
|
89
|
+
|
|
90
|
+
✅ **Keep animation logic out of your app** — Focus on features, not micro-interactions
|
|
91
|
+
|
|
92
|
+
Think of it as a **pre-built micro-interaction**, not an animation engine.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## 🤝 Contributing
|
|
99
|
+
|
|
100
|
+
Issues and pull requests are welcome! Feel free to open an issue if you find a bug or have a feature request.
|
package/dist/pop-emojis.umd.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(u,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react"),require("framer-motion")):typeof define=="function"&&define.amd?define(["exports","react","framer-motion"],m):(u=typeof globalThis<"u"?globalThis:u||self,m(u.PopEmojis={},u.React,u.FramerMotion))})(this,(function(u,m,S){"use strict";var R={exports:{}},_={};var w;function q(){if(w)return _;w=1;var i=Symbol.for("react.transitional.element"),p=Symbol.for("react.fragment");function d(c,s,o){var l=null;if(o!==void 0&&(l=""+o),s.key!==void 0&&(l=""+s.key),"key"in s){o={};for(var f in s)f!=="key"&&(o[f]=s[f])}else o=s;return s=o.ref,{$$typeof:i,type:c,key:l,ref:s!==void 0?s:null,props:o}}return _.Fragment=p,_.jsx=d,_.jsxs=d,_}var b={};var g;function J(){return g||(g=1,process.env.NODE_ENV!=="production"&&(function(){function i(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ae?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case y:return"Fragment";case H:return"Profiler";case B:return"StrictMode";case ee:return"Suspense";case re:return"SuspenseList";case ne:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case X:return"Portal";case Q:return e.displayName||"Context";case Z:return(e._context.displayName||"Context")+".Consumer";case K:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case te:return r=e.displayName||null,r!==null?r:i(e.type)||"Memo";case O:r=e._payload,e=e._init;try{return i(e(r))}catch{}}return null}function p(e){return""+e}function d(e){try{p(e);var r=!1}catch{r=!0}if(r){r=console;var t=r.error,n=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",n),p(e)}}function c(e){if(e===y)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===O)return"<...>";try{var r=i(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function s(){var e=h.A;return e===null?null:e.getOwner()}function o(){return Error("react-stack-top-frame")}function l(e){if(D.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function f(e,r){function t(){M||(M=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}function x(){var e=i(this.type);return $[e]||($[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function G(e,r,t,n,k,P){var a=t.ref;return e={$$typeof:F,type:e,key:r,props:t,_owner:n},(a!==void 0?a:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:x}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:k}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:P}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function C(e,r,t,n,k,P){var a=r.children;if(a!==void 0)if(n)if(oe(a)){for(n=0;n<a.length;n++)Y(a[n]);Object.freeze&&Object.freeze(a)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Y(a);if(D.call(r,"key")){a=i(e);var E=Object.keys(r).filter(function(se){return se!=="key"});n=0<E.length?"{key: someKey, "+E.join(": ..., ")+": ...}":"{key: someKey}",U[a+n]||(E=0<E.length?"{"+E.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,n,a,E,a),U[a+n]=!0)}if(a=null,t!==void 0&&(d(t),a=""+t),
|
|
6
|
+
<%s key={someKey} {...props} />`,n,a,E,a),U[a+n]=!0)}if(a=null,t!==void 0&&(d(t),a=""+t),l(r)&&(d(r.key),a=""+r.key),"key"in r){t={};for(var A in r)A!=="key"&&(t[A]=r[A])}else t=r;return a&&f(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),G(e,a,t,s(),k,P)}function Y(e){I(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===O&&(e._payload.status==="fulfilled"?I(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function I(e){return typeof e=="object"&&e!==null&&e.$$typeof===F}var T=m,F=Symbol.for("react.transitional.element"),X=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),H=Symbol.for("react.profiler"),Z=Symbol.for("react.consumer"),Q=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),te=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),ne=Symbol.for("react.activity"),ae=Symbol.for("react.client.reference"),h=T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,D=Object.prototype.hasOwnProperty,oe=Array.isArray,j=console.createTask?console.createTask:function(){return null};T={react_stack_bottom_frame:function(e){return e()}};var M,$={},L=T.react_stack_bottom_frame.bind(T,o)(),W=j(c(o)),U={};b.Fragment=y,b.jsx=function(e,r,t){var n=1e4>h.recentlyCreatedOwnerStacks++;return C(e,r,t,!1,n?Error("react-stack-top-frame"):L,n?j(c(e)):W)},b.jsxs=function(e,r,t){var n=1e4>h.recentlyCreatedOwnerStacks++;return C(e,r,t,!0,n?Error("react-stack-top-frame"):L,n?j(c(e)):W)}})()),b}var N;function V(){return N||(N=1,process.env.NODE_ENV==="production"?R.exports=q():R.exports=J()),R.exports}var v=V();function z({emoji:i="🔥",count:p=6}){const[d,c]=m.useState([]),s=()=>{const o=Date.now(),l=Array.from({length:p},(f,x)=>({id:o+x,x:Math.random()*180-80,y:Math.random()*-100}));c(l),setTimeout(()=>c([]),600)};return v.jsxs("div",{className:"relative inline-block",children:[v.jsx("button",{onClick:s,className:"rounded px-4 py-2 text-white",children:"🫡"}),v.jsx(S.AnimatePresence,{children:d.map(({id:o,x:l,y:f})=>v.jsx(S.motion.span,{initial:{scale:.5,opacity:1,x:0,y:0},animate:{scale:1,opacity:0,x:l,y:f},exit:{opacity:0},transition:{duration:.8,ease:"easeOut"},className:"pointer-events-none absolute left-1/2 top-1/3 text-xl",children:i},o))})]})}u.EmojiPop=z,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pop-emojis",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "MahindraGamni",
|
|
7
7
|
"description": "A React component for animated emoji pop effects",
|
|
8
|
-
"main": "./dist/
|
|
9
|
-
"module": "./dist/
|
|
10
|
-
"types": "./dist/
|
|
8
|
+
"main": "./dist/pop-emojis.umd.cjs",
|
|
9
|
+
"module": "./dist/pop-emojis.js",
|
|
10
|
+
"types": "./dist/pop-emojis.d.ts",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
-
"
|
|
14
|
-
"
|
|
13
|
+
"types": "./dist/pop-emojis.d.ts",
|
|
14
|
+
"import": "./dist/pop-emojis.js",
|
|
15
|
+
"require": "./dist/pop-emojis.umd.cjs"
|
|
15
16
|
}
|
|
16
17
|
},
|
|
17
18
|
"files": [
|
|
@@ -36,9 +37,6 @@
|
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@eslint/js": "^9.39.1",
|
|
38
39
|
"@tailwindcss/postcss": "^4.1.18",
|
|
39
|
-
"motion": "^12.23.26",
|
|
40
|
-
"react": "^19.2.0",
|
|
41
|
-
"react-dom": "^19.2.0",
|
|
42
40
|
"@testing-library/jest-dom": "^6.9.1",
|
|
43
41
|
"@testing-library/react": "^16.3.1",
|
|
44
42
|
"@testing-library/user-event": "^14.6.1",
|
|
@@ -52,11 +50,15 @@
|
|
|
52
50
|
"eslint-plugin-react-refresh": "^0.4.24",
|
|
53
51
|
"globals": "^16.5.0",
|
|
54
52
|
"jsdom": "^27.4.0",
|
|
53
|
+
"motion": "^12.23.26",
|
|
55
54
|
"postcss": "^8.5.6",
|
|
55
|
+
"react": "^19.2.0",
|
|
56
|
+
"react-dom": "^19.2.0",
|
|
56
57
|
"tailwindcss": "^4.1.18",
|
|
57
58
|
"typescript": "~5.9.3",
|
|
58
59
|
"typescript-eslint": "^8.46.4",
|
|
59
60
|
"vite": "^7.2.4",
|
|
61
|
+
"vite-plugin-dts": "^4.5.4",
|
|
60
62
|
"vitest": "^4.0.16"
|
|
61
63
|
}
|
|
62
64
|
}
|