iconflow 1.0.0
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/dist/index.css +84 -0
- package/dist/index.js +114 -0
- package/dist/index.mjs +122 -0
- package/dist/styles.css/styles.css +64 -0
- package/package.json +42 -0
package/dist/index.css
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/* src/styles.css */
|
|
2
|
+
.iconflow-shake.iconflow-active {
|
|
3
|
+
animation: iconflow-shake calc(0.5s / var(--iconflow-speed)) ease-in-out;
|
|
4
|
+
}
|
|
5
|
+
.iconflow-spin.iconflow-active {
|
|
6
|
+
animation: iconflow-spin calc(1s / var(--iconflow-speed)) linear infinite;
|
|
7
|
+
}
|
|
8
|
+
.iconflow-bounce.iconflow-active {
|
|
9
|
+
animation: iconflow-bounce calc(0.6s / var(--iconflow-speed)) ease infinite;
|
|
10
|
+
}
|
|
11
|
+
.iconflow-swing.iconflow-active {
|
|
12
|
+
animation: iconflow-swing calc(0.8s / var(--iconflow-speed)) ease-in-out infinite;
|
|
13
|
+
}
|
|
14
|
+
.iconflow-pulse.iconflow-active {
|
|
15
|
+
animation: iconflow-pulse calc(1s / var(--iconflow-speed)) ease-in-out infinite;
|
|
16
|
+
}
|
|
17
|
+
.iconflow-heartbeat.iconflow-active {
|
|
18
|
+
animation: iconflow-heartbeat calc(0.8s / var(--iconflow-speed)) ease-in-out infinite;
|
|
19
|
+
}
|
|
20
|
+
@keyframes iconflow-shake {
|
|
21
|
+
0%, 100% {
|
|
22
|
+
transform: rotate(0deg);
|
|
23
|
+
}
|
|
24
|
+
25% {
|
|
25
|
+
transform: rotate(-15deg);
|
|
26
|
+
}
|
|
27
|
+
75% {
|
|
28
|
+
transform: rotate(15deg);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
@keyframes iconflow-spin {
|
|
32
|
+
from {
|
|
33
|
+
transform: rotate(0deg);
|
|
34
|
+
}
|
|
35
|
+
to {
|
|
36
|
+
transform: rotate(360deg);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
@keyframes iconflow-bounce {
|
|
40
|
+
0%, 100% {
|
|
41
|
+
transform: translateY(0);
|
|
42
|
+
}
|
|
43
|
+
50% {
|
|
44
|
+
transform: translateY(-6px);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
@keyframes iconflow-swing {
|
|
48
|
+
0%, 100% {
|
|
49
|
+
transform: rotate(0deg);
|
|
50
|
+
transform-origin: top center;
|
|
51
|
+
}
|
|
52
|
+
25% {
|
|
53
|
+
transform: rotate(15deg);
|
|
54
|
+
transform-origin: top center;
|
|
55
|
+
}
|
|
56
|
+
75% {
|
|
57
|
+
transform: rotate(-15deg);
|
|
58
|
+
transform-origin: top center;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
@keyframes iconflow-pulse {
|
|
62
|
+
0%, 100% {
|
|
63
|
+
opacity: 1;
|
|
64
|
+
transform: scale(1);
|
|
65
|
+
}
|
|
66
|
+
50% {
|
|
67
|
+
opacity: 0.6;
|
|
68
|
+
transform: scale(0.9);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
@keyframes iconflow-heartbeat {
|
|
72
|
+
0%, 100% {
|
|
73
|
+
transform: scale(1);
|
|
74
|
+
}
|
|
75
|
+
25% {
|
|
76
|
+
transform: scale(1.3);
|
|
77
|
+
}
|
|
78
|
+
50% {
|
|
79
|
+
transform: scale(1);
|
|
80
|
+
}
|
|
81
|
+
75% {
|
|
82
|
+
transform: scale(1.2);
|
|
83
|
+
}
|
|
84
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __esm = (fn, res) => function __init() {
|
|
6
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
7
|
+
};
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/styles.css
|
|
23
|
+
var init_styles = __esm({
|
|
24
|
+
"src/styles.css"() {
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// src/AnimatedIcon.jsx
|
|
29
|
+
var AnimatedIcon_exports = {};
|
|
30
|
+
__export(AnimatedIcon_exports, {
|
|
31
|
+
default: () => AnimatedIcon_default
|
|
32
|
+
});
|
|
33
|
+
var import_react, ANIMATION_TYPES, TRIGGERS, AnimatedIcon, AnimatedIcon_default;
|
|
34
|
+
var init_AnimatedIcon = __esm({
|
|
35
|
+
"src/AnimatedIcon.jsx"() {
|
|
36
|
+
import_react = require("react");
|
|
37
|
+
init_styles();
|
|
38
|
+
ANIMATION_TYPES = [
|
|
39
|
+
"shake",
|
|
40
|
+
"spin",
|
|
41
|
+
"bounce",
|
|
42
|
+
"swing",
|
|
43
|
+
"pulse",
|
|
44
|
+
"heartbeat"
|
|
45
|
+
];
|
|
46
|
+
TRIGGERS = ["hover", "click", "mount", "loop"];
|
|
47
|
+
AnimatedIcon = ({
|
|
48
|
+
icon: Icon,
|
|
49
|
+
animation,
|
|
50
|
+
trigger,
|
|
51
|
+
size = 24,
|
|
52
|
+
color = "currentColor",
|
|
53
|
+
speed = 1,
|
|
54
|
+
strokeWidth = 2,
|
|
55
|
+
className = ""
|
|
56
|
+
}) => {
|
|
57
|
+
const animationType = ANIMATION_TYPES.includes(animation) ? animation : "shake";
|
|
58
|
+
const triggerType = TRIGGERS.includes(trigger) ? trigger : "hover";
|
|
59
|
+
const [isTriggered, setIsTriggered] = (0, import_react.useState)(
|
|
60
|
+
triggerType === "mount" || triggerType === "loop"
|
|
61
|
+
);
|
|
62
|
+
(0, import_react.useEffect)(() => {
|
|
63
|
+
if (triggerType === "mount") {
|
|
64
|
+
setIsTriggered(true);
|
|
65
|
+
}
|
|
66
|
+
}, [triggerType]);
|
|
67
|
+
const handlers = {
|
|
68
|
+
hover: {
|
|
69
|
+
onMouseEnter: () => setIsTriggered(true),
|
|
70
|
+
onMouseLeave: () => setIsTriggered(false)
|
|
71
|
+
},
|
|
72
|
+
click: { onClick: () => setIsTriggered((prev) => !prev) },
|
|
73
|
+
mount: {}
|
|
74
|
+
};
|
|
75
|
+
return /* @__PURE__ */ React.createElement(
|
|
76
|
+
"span",
|
|
77
|
+
{
|
|
78
|
+
className: `iconflow-${animationType} ${isTriggered ? "iconflow-active" : ""} ${className}`.trim(),
|
|
79
|
+
style: { "--iconflow-speed": `${speed}s` },
|
|
80
|
+
...handlers[triggerType]
|
|
81
|
+
},
|
|
82
|
+
/* @__PURE__ */ React.createElement(Icon, { size, color, strokeWidth })
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
AnimatedIcon_default = AnimatedIcon;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// src/index.js
|
|
90
|
+
var AnimatedIcon2 = (init_AnimatedIcon(), __toCommonJS(AnimatedIcon_exports));
|
|
91
|
+
var IconFlow = class {
|
|
92
|
+
constructor(options = {}) {
|
|
93
|
+
this.defaultSize = options.size ?? 24;
|
|
94
|
+
this.defaultColor = options.color ?? "currentColor";
|
|
95
|
+
this.defaultSpeed = options.speed ?? 1;
|
|
96
|
+
this.defaultStrokeWidth = options.strokeWidth ?? 2;
|
|
97
|
+
this.defaultAnimation = options.animation ?? "shake";
|
|
98
|
+
this.defaultTrigger = options.trigger ?? "hover";
|
|
99
|
+
}
|
|
100
|
+
getDefaults(overrides = {}) {
|
|
101
|
+
return {
|
|
102
|
+
size: this.defaultSize,
|
|
103
|
+
color: this.defaultColor,
|
|
104
|
+
speed: this.defaultSpeed,
|
|
105
|
+
strokeWidth: this.defaultStrokeWidth,
|
|
106
|
+
animation: this.defaultAnimation,
|
|
107
|
+
trigger: this.defaultTrigger,
|
|
108
|
+
...overrides
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
module.exports = IconFlow;
|
|
113
|
+
module.exports.AnimatedIcon = AnimatedIcon2;
|
|
114
|
+
module.exports.default = IconFlow;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __esm = (fn, res) => function __init() {
|
|
6
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
7
|
+
};
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
|
|
25
|
+
// src/styles.css
|
|
26
|
+
var init_styles = __esm({
|
|
27
|
+
"src/styles.css"() {
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// src/AnimatedIcon.jsx
|
|
32
|
+
var AnimatedIcon_exports = {};
|
|
33
|
+
__export(AnimatedIcon_exports, {
|
|
34
|
+
default: () => AnimatedIcon_default
|
|
35
|
+
});
|
|
36
|
+
import { useEffect, useState } from "react";
|
|
37
|
+
var ANIMATION_TYPES, TRIGGERS, AnimatedIcon, AnimatedIcon_default;
|
|
38
|
+
var init_AnimatedIcon = __esm({
|
|
39
|
+
"src/AnimatedIcon.jsx"() {
|
|
40
|
+
init_styles();
|
|
41
|
+
ANIMATION_TYPES = [
|
|
42
|
+
"shake",
|
|
43
|
+
"spin",
|
|
44
|
+
"bounce",
|
|
45
|
+
"swing",
|
|
46
|
+
"pulse",
|
|
47
|
+
"heartbeat"
|
|
48
|
+
];
|
|
49
|
+
TRIGGERS = ["hover", "click", "mount", "loop"];
|
|
50
|
+
AnimatedIcon = ({
|
|
51
|
+
icon: Icon,
|
|
52
|
+
animation,
|
|
53
|
+
trigger,
|
|
54
|
+
size = 24,
|
|
55
|
+
color = "currentColor",
|
|
56
|
+
speed = 1,
|
|
57
|
+
strokeWidth = 2,
|
|
58
|
+
className = ""
|
|
59
|
+
}) => {
|
|
60
|
+
const animationType = ANIMATION_TYPES.includes(animation) ? animation : "shake";
|
|
61
|
+
const triggerType = TRIGGERS.includes(trigger) ? trigger : "hover";
|
|
62
|
+
const [isTriggered, setIsTriggered] = useState(
|
|
63
|
+
triggerType === "mount" || triggerType === "loop"
|
|
64
|
+
);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (triggerType === "mount") {
|
|
67
|
+
setIsTriggered(true);
|
|
68
|
+
}
|
|
69
|
+
}, [triggerType]);
|
|
70
|
+
const handlers = {
|
|
71
|
+
hover: {
|
|
72
|
+
onMouseEnter: () => setIsTriggered(true),
|
|
73
|
+
onMouseLeave: () => setIsTriggered(false)
|
|
74
|
+
},
|
|
75
|
+
click: { onClick: () => setIsTriggered((prev) => !prev) },
|
|
76
|
+
mount: {}
|
|
77
|
+
};
|
|
78
|
+
return /* @__PURE__ */ React.createElement(
|
|
79
|
+
"span",
|
|
80
|
+
{
|
|
81
|
+
className: `iconflow-${animationType} ${isTriggered ? "iconflow-active" : ""} ${className}`.trim(),
|
|
82
|
+
style: { "--iconflow-speed": `${speed}s` },
|
|
83
|
+
...handlers[triggerType]
|
|
84
|
+
},
|
|
85
|
+
/* @__PURE__ */ React.createElement(Icon, { size, color, strokeWidth })
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
AnimatedIcon_default = AnimatedIcon;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// src/index.js
|
|
93
|
+
var require_index = __commonJS({
|
|
94
|
+
"src/index.js"(exports, module) {
|
|
95
|
+
var AnimatedIcon2 = (init_AnimatedIcon(), __toCommonJS(AnimatedIcon_exports));
|
|
96
|
+
var IconFlow = class {
|
|
97
|
+
constructor(options = {}) {
|
|
98
|
+
this.defaultSize = options.size ?? 24;
|
|
99
|
+
this.defaultColor = options.color ?? "currentColor";
|
|
100
|
+
this.defaultSpeed = options.speed ?? 1;
|
|
101
|
+
this.defaultStrokeWidth = options.strokeWidth ?? 2;
|
|
102
|
+
this.defaultAnimation = options.animation ?? "shake";
|
|
103
|
+
this.defaultTrigger = options.trigger ?? "hover";
|
|
104
|
+
}
|
|
105
|
+
getDefaults(overrides = {}) {
|
|
106
|
+
return {
|
|
107
|
+
size: this.defaultSize,
|
|
108
|
+
color: this.defaultColor,
|
|
109
|
+
speed: this.defaultSpeed,
|
|
110
|
+
strokeWidth: this.defaultStrokeWidth,
|
|
111
|
+
animation: this.defaultAnimation,
|
|
112
|
+
trigger: this.defaultTrigger,
|
|
113
|
+
...overrides
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
module.exports = IconFlow;
|
|
118
|
+
module.exports.AnimatedIcon = AnimatedIcon2;
|
|
119
|
+
module.exports.default = IconFlow;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
export default require_index();
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* SHAKE */
|
|
2
|
+
.iconflow-shake.iconflow-active {
|
|
3
|
+
animation: iconflow-shake calc(0.5s / var(--iconflow-speed)) ease-in-out;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/* SPIN */
|
|
7
|
+
.iconflow-spin.iconflow-active {
|
|
8
|
+
animation: iconflow-spin calc(1s / var(--iconflow-speed)) linear infinite;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* BOUNCE */
|
|
12
|
+
.iconflow-bounce.iconflow-active {
|
|
13
|
+
animation: iconflow-bounce calc(0.6s / var(--iconflow-speed)) ease infinite;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* SWING */
|
|
17
|
+
.iconflow-swing.iconflow-active {
|
|
18
|
+
animation: iconflow-swing calc(0.8s / var(--iconflow-speed)) ease-in-out infinite;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* PULSE */
|
|
22
|
+
.iconflow-pulse.iconflow-active {
|
|
23
|
+
animation: iconflow-pulse calc(1s / var(--iconflow-speed)) ease-in-out infinite;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* HEARTBEAT */
|
|
27
|
+
.iconflow-heartbeat.iconflow-active {
|
|
28
|
+
animation: iconflow-heartbeat calc(0.8s / var(--iconflow-speed)) ease-in-out infinite;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* KEYFRAMES */
|
|
32
|
+
@keyframes iconflow-shake {
|
|
33
|
+
0%, 100% { transform: rotate(0deg); }
|
|
34
|
+
25% { transform: rotate(-15deg); }
|
|
35
|
+
75% { transform: rotate(15deg); }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@keyframes iconflow-spin {
|
|
39
|
+
from { transform: rotate(0deg); }
|
|
40
|
+
to { transform: rotate(360deg); }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@keyframes iconflow-bounce {
|
|
44
|
+
0%, 100% { transform: translateY(0); }
|
|
45
|
+
50% { transform: translateY(-6px); }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@keyframes iconflow-swing {
|
|
49
|
+
0%, 100% { transform: rotate(0deg); transform-origin: top center; }
|
|
50
|
+
25% { transform: rotate(15deg); transform-origin: top center; }
|
|
51
|
+
75% { transform: rotate(-15deg); transform-origin: top center; }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@keyframes iconflow-pulse {
|
|
55
|
+
0%, 100% { opacity: 1; transform: scale(1); }
|
|
56
|
+
50% { opacity: 0.6; transform: scale(0.9); }
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@keyframes iconflow-heartbeat {
|
|
60
|
+
0%, 100% { transform: scale(1); }
|
|
61
|
+
25% { transform: scale(1.3); }
|
|
62
|
+
50% { transform: scale(1); }
|
|
63
|
+
75% { transform: scale(1.2); }
|
|
64
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "iconflow",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Animated icon wrapper for Lucide React icons",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.mjs",
|
|
10
|
+
"require": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./styles": "./dist/styles.css"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build:js": "tsup",
|
|
19
|
+
"build:css": "cpx src/styles.css dist/styles.css",
|
|
20
|
+
"build": "npm run build:js && npm run build:css",
|
|
21
|
+
"prepublishOnly": "npm run build"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"lucide-react": ">=0.300.0",
|
|
25
|
+
"react": ">=17.0.0",
|
|
26
|
+
"react-dom": ">=17.0.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"cpx": "^1.5.0",
|
|
30
|
+
"tsup": "^8.5.1",
|
|
31
|
+
"typescript": "^6.0.3"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"icons",
|
|
35
|
+
"animation",
|
|
36
|
+
"lucide",
|
|
37
|
+
"react",
|
|
38
|
+
"iconflow"
|
|
39
|
+
],
|
|
40
|
+
"author": "Taksh Patel",
|
|
41
|
+
"license": "MIT"
|
|
42
|
+
}
|