@omer-x/tailwind-ui-kit 1.0.0-alpha.2 → 1.0.0-alpha.4
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.
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import styles from "../styles/ripple.module.css";
|
|
4
|
+
import { cn } from "../utils/cn.js";
|
|
5
|
+
function useRipples() {
|
|
6
|
+
const [ripples, setRipples] = useState([]);
|
|
7
|
+
const handleClick = (e) => {
|
|
8
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
9
|
+
const size = Math.max(rect.width, rect.height);
|
|
10
|
+
const x = e.clientX - rect.left - size / 2;
|
|
11
|
+
const y = e.clientY - rect.top - size / 2;
|
|
12
|
+
const newRipple = { x, y, size, id: Date.now() };
|
|
13
|
+
setRipples((prev) => [...prev, newRipple]);
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
setRipples((prev) => prev.filter((r) => r.id !== newRipple.id));
|
|
16
|
+
}, 600);
|
|
17
|
+
};
|
|
18
|
+
const ripplesNode = /* @__PURE__ */ jsx("div", { className: "absolute inset-0 pointer-events-none overflow-hidden rounded-md", children: ripples.map((ripple) => /* @__PURE__ */ jsx(
|
|
19
|
+
"span",
|
|
20
|
+
{
|
|
21
|
+
className: cn(styles.animation, "absolute rounded-full bg-current opacity-10"),
|
|
22
|
+
style: {
|
|
23
|
+
left: ripple.x,
|
|
24
|
+
top: ripple.y,
|
|
25
|
+
width: ripple.size,
|
|
26
|
+
height: ripple.size
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
ripple.id
|
|
30
|
+
)) });
|
|
31
|
+
return [handleClick, ripplesNode];
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
useRipples
|
|
35
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omer-x/tailwind-ui-kit",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.4",
|
|
4
4
|
"description": "Tailwind CSS-based React component library for building user interfaces",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tailwind",
|
|
@@ -64,6 +64,8 @@
|
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@base-ui/react": "^1",
|
|
67
|
+
"@fortawesome/free-brands-svg-icons": "^7",
|
|
68
|
+
"@fortawesome/free-solid-svg-icons": "^7",
|
|
67
69
|
"@fortawesome/react-fontawesome": "^3",
|
|
68
70
|
"clsx": "^2",
|
|
69
71
|
"react": "^19",
|
|
@@ -72,8 +74,6 @@
|
|
|
72
74
|
"tailwindcss": "^4"
|
|
73
75
|
},
|
|
74
76
|
"devDependencies": {
|
|
75
|
-
"@fortawesome/free-brands-svg-icons": "^7.2.0",
|
|
76
|
-
"@fortawesome/free-solid-svg-icons": "^7.2.0",
|
|
77
77
|
"@omer-x/eslint-config": "^2.3.2",
|
|
78
78
|
"@tailwindcss/vite": "^4.3.0",
|
|
79
79
|
"@types/node": "^25.7.0",
|