componentui-lib 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.js +271 -0
- package/dist/index.mjs +234 -0
- package/package.json +23 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/index.js
|
|
30
|
+
var index_exports = {};
|
|
31
|
+
__export(index_exports, {
|
|
32
|
+
Button: () => Button,
|
|
33
|
+
Card: () => Card
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(index_exports);
|
|
36
|
+
|
|
37
|
+
// src/components/Button/button.jsx
|
|
38
|
+
var import_react = __toESM(require("react"));
|
|
39
|
+
var Button = ({
|
|
40
|
+
text = "Click Me",
|
|
41
|
+
color = "#ffffff",
|
|
42
|
+
bgColor = "#6C63FF",
|
|
43
|
+
hoverBgColor = "#5A52D5",
|
|
44
|
+
size = "md",
|
|
45
|
+
borderRadius = "12px",
|
|
46
|
+
fontWeight = "600",
|
|
47
|
+
shadow = true,
|
|
48
|
+
onClick = () => {
|
|
49
|
+
},
|
|
50
|
+
disabled = false,
|
|
51
|
+
icon = null,
|
|
52
|
+
fullWidth = false,
|
|
53
|
+
...rest
|
|
54
|
+
}) => {
|
|
55
|
+
const [isHovered, setIsHovered] = (0, import_react.useState)(false);
|
|
56
|
+
const [isPressed, setIsPressed] = (0, import_react.useState)(false);
|
|
57
|
+
const [ripples, setRipples] = (0, import_react.useState)([]);
|
|
58
|
+
const sizeMap = {
|
|
59
|
+
sm: { padding: "8px 18px", fontSize: "13px" },
|
|
60
|
+
md: { padding: "12px 28px", fontSize: "15px" },
|
|
61
|
+
lg: { padding: "16px 38px", fontSize: "17px" }
|
|
62
|
+
};
|
|
63
|
+
const { padding, fontSize } = sizeMap[size] || sizeMap.md;
|
|
64
|
+
const handleRipple = (e) => {
|
|
65
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
66
|
+
const x = e.clientX - rect.left;
|
|
67
|
+
const y = e.clientY - rect.top;
|
|
68
|
+
const id = Date.now();
|
|
69
|
+
setRipples((prev) => [...prev, { x, y, id }]);
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
72
|
+
}, 600);
|
|
73
|
+
};
|
|
74
|
+
const baseStyle = {
|
|
75
|
+
position: "relative",
|
|
76
|
+
overflow: "hidden",
|
|
77
|
+
display: "inline-flex",
|
|
78
|
+
alignItems: "center",
|
|
79
|
+
justifyContent: "center",
|
|
80
|
+
gap: "8px",
|
|
81
|
+
padding,
|
|
82
|
+
fontSize,
|
|
83
|
+
fontWeight,
|
|
84
|
+
fontFamily: "'Inter', 'Segoe UI', sans-serif",
|
|
85
|
+
color,
|
|
86
|
+
backgroundColor: disabled ? "#A0A0B0" : isPressed ? hoverBgColor : isHovered ? hoverBgColor : bgColor,
|
|
87
|
+
border: "none",
|
|
88
|
+
borderRadius,
|
|
89
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
90
|
+
opacity: disabled ? 0.6 : 1,
|
|
91
|
+
width: fullWidth ? "100%" : "auto",
|
|
92
|
+
transform: isPressed ? "scale(0.96)" : isHovered ? "translateY(-2px)" : "translateY(0)",
|
|
93
|
+
boxShadow: shadow ? isHovered && !disabled ? `0 8px 24px ${bgColor}66` : `0 4px 14px ${bgColor}33` : "none",
|
|
94
|
+
transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
95
|
+
letterSpacing: "0.3px",
|
|
96
|
+
outline: "none",
|
|
97
|
+
userSelect: "none",
|
|
98
|
+
WebkitTapHighlightColor: "transparent"
|
|
99
|
+
};
|
|
100
|
+
const rippleStyle = (ripple) => ({
|
|
101
|
+
position: "absolute",
|
|
102
|
+
left: ripple.x - 50,
|
|
103
|
+
top: ripple.y - 50,
|
|
104
|
+
width: 100,
|
|
105
|
+
height: 100,
|
|
106
|
+
borderRadius: "50%",
|
|
107
|
+
background: "rgba(255,255,255,0.35)",
|
|
108
|
+
transform: "scale(0)",
|
|
109
|
+
animation: "btn-ripple 0.6s ease-out forwards",
|
|
110
|
+
pointerEvents: "none"
|
|
111
|
+
});
|
|
112
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("style", null, `
|
|
113
|
+
@keyframes btn-ripple {
|
|
114
|
+
to { transform: scale(4); opacity: 0; }
|
|
115
|
+
}
|
|
116
|
+
`), /* @__PURE__ */ import_react.default.createElement(
|
|
117
|
+
"button",
|
|
118
|
+
{
|
|
119
|
+
style: baseStyle,
|
|
120
|
+
onMouseEnter: () => setIsHovered(true),
|
|
121
|
+
onMouseLeave: () => {
|
|
122
|
+
setIsHovered(false);
|
|
123
|
+
setIsPressed(false);
|
|
124
|
+
},
|
|
125
|
+
onMouseDown: () => setIsPressed(true),
|
|
126
|
+
onMouseUp: () => setIsPressed(false),
|
|
127
|
+
onClick: (e) => {
|
|
128
|
+
if (!disabled) {
|
|
129
|
+
handleRipple(e);
|
|
130
|
+
onClick(e);
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
disabled,
|
|
134
|
+
...rest
|
|
135
|
+
},
|
|
136
|
+
icon && /* @__PURE__ */ import_react.default.createElement("span", { style: { display: "flex", alignItems: "center" } }, icon),
|
|
137
|
+
text,
|
|
138
|
+
ripples.map((ripple) => /* @__PURE__ */ import_react.default.createElement("span", { key: ripple.id, style: rippleStyle(ripple) }))
|
|
139
|
+
));
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// src/components/Card/card.jsx
|
|
143
|
+
var import_react2 = __toESM(require("react"));
|
|
144
|
+
var Card = ({
|
|
145
|
+
title = "Card Title",
|
|
146
|
+
description = "This is a beautifully crafted 3D card component.",
|
|
147
|
+
image = null,
|
|
148
|
+
bgColor = "#1E1E2E",
|
|
149
|
+
textColor = "#E0E0F0",
|
|
150
|
+
accentColor = "#6C63FF",
|
|
151
|
+
width = "320px",
|
|
152
|
+
height = "auto",
|
|
153
|
+
borderRadius = "20px",
|
|
154
|
+
shadow = true,
|
|
155
|
+
children = null,
|
|
156
|
+
onClick = null,
|
|
157
|
+
glare = true,
|
|
158
|
+
...rest
|
|
159
|
+
}) => {
|
|
160
|
+
const [tilt, setTilt] = (0, import_react2.useState)({ x: 0, y: 0 });
|
|
161
|
+
const [isHovered, setIsHovered] = (0, import_react2.useState)(false);
|
|
162
|
+
const cardRef = (0, import_react2.useRef)(null);
|
|
163
|
+
const handleMouseMove = (e) => {
|
|
164
|
+
if (!cardRef.current) return;
|
|
165
|
+
const rect = cardRef.current.getBoundingClientRect();
|
|
166
|
+
const x = e.clientX - rect.left;
|
|
167
|
+
const y = e.clientY - rect.top;
|
|
168
|
+
const centerX = rect.width / 2;
|
|
169
|
+
const centerY = rect.height / 2;
|
|
170
|
+
const rotateX = (y - centerY) / centerY * -12;
|
|
171
|
+
const rotateY = (x - centerX) / centerX * 12;
|
|
172
|
+
setTilt({ x: rotateX, y: rotateY, px: x / rect.width * 100, py: y / rect.height * 100 });
|
|
173
|
+
};
|
|
174
|
+
const handleMouseLeave = () => {
|
|
175
|
+
setTilt({ x: 0, y: 0, px: 50, py: 50 });
|
|
176
|
+
setIsHovered(false);
|
|
177
|
+
};
|
|
178
|
+
const containerStyle = {
|
|
179
|
+
perspective: "1000px",
|
|
180
|
+
width,
|
|
181
|
+
display: "inline-block"
|
|
182
|
+
};
|
|
183
|
+
const cardStyle = {
|
|
184
|
+
position: "relative",
|
|
185
|
+
width: "100%",
|
|
186
|
+
height,
|
|
187
|
+
backgroundColor: bgColor,
|
|
188
|
+
borderRadius,
|
|
189
|
+
padding: "0",
|
|
190
|
+
overflow: "hidden",
|
|
191
|
+
cursor: onClick ? "pointer" : "default",
|
|
192
|
+
transform: isHovered ? `rotateX(${tilt.x}deg) rotateY(${tilt.y}deg) scale3d(1.04, 1.04, 1.04)` : "rotateX(0) rotateY(0) scale3d(1, 1, 1)",
|
|
193
|
+
transition: isHovered ? "transform 0.1s ease-out, box-shadow 0.3s ease" : "transform 0.5s ease-out, box-shadow 0.5s ease",
|
|
194
|
+
boxShadow: shadow ? isHovered ? `0 20px 60px rgba(0,0,0,0.4), 0 0 30px ${accentColor}22` : "0 8px 30px rgba(0,0,0,0.25)" : "none",
|
|
195
|
+
transformStyle: "preserve-3d",
|
|
196
|
+
willChange: "transform"
|
|
197
|
+
};
|
|
198
|
+
const glareStyle = {
|
|
199
|
+
position: "absolute",
|
|
200
|
+
top: 0,
|
|
201
|
+
left: 0,
|
|
202
|
+
right: 0,
|
|
203
|
+
bottom: 0,
|
|
204
|
+
borderRadius,
|
|
205
|
+
background: isHovered ? `radial-gradient(circle at ${tilt.px || 50}% ${tilt.py || 50}%, rgba(255,255,255,0.15) 0%, transparent 60%)` : "none",
|
|
206
|
+
pointerEvents: "none",
|
|
207
|
+
zIndex: 3,
|
|
208
|
+
transition: isHovered ? "none" : "background 0.5s ease"
|
|
209
|
+
};
|
|
210
|
+
const imageStyle = {
|
|
211
|
+
width: "100%",
|
|
212
|
+
height: "180px",
|
|
213
|
+
objectFit: "cover",
|
|
214
|
+
display: "block",
|
|
215
|
+
borderRadius: `${borderRadius} ${borderRadius} 0 0`
|
|
216
|
+
};
|
|
217
|
+
const contentStyle = {
|
|
218
|
+
padding: "22px 24px 26px",
|
|
219
|
+
position: "relative",
|
|
220
|
+
zIndex: 1
|
|
221
|
+
};
|
|
222
|
+
const titleStyle = {
|
|
223
|
+
margin: "0 0 10px 0",
|
|
224
|
+
fontSize: "20px",
|
|
225
|
+
fontWeight: "700",
|
|
226
|
+
fontFamily: "'Inter', 'Segoe UI', sans-serif",
|
|
227
|
+
color: textColor,
|
|
228
|
+
letterSpacing: "0.2px",
|
|
229
|
+
lineHeight: "1.3"
|
|
230
|
+
};
|
|
231
|
+
const descStyle = {
|
|
232
|
+
margin: 0,
|
|
233
|
+
fontSize: "14px",
|
|
234
|
+
fontFamily: "'Inter', 'Segoe UI', sans-serif",
|
|
235
|
+
color: `${textColor}99`,
|
|
236
|
+
lineHeight: "1.6",
|
|
237
|
+
fontWeight: "400"
|
|
238
|
+
};
|
|
239
|
+
const accentBarStyle = {
|
|
240
|
+
position: "absolute",
|
|
241
|
+
bottom: 0,
|
|
242
|
+
left: 0,
|
|
243
|
+
right: 0,
|
|
244
|
+
height: "3px",
|
|
245
|
+
background: `linear-gradient(90deg, ${accentColor}, ${accentColor}88, transparent)`,
|
|
246
|
+
opacity: isHovered ? 1 : 0,
|
|
247
|
+
transition: "opacity 0.4s ease",
|
|
248
|
+
zIndex: 2
|
|
249
|
+
};
|
|
250
|
+
return /* @__PURE__ */ import_react2.default.createElement("div", { style: containerStyle }, /* @__PURE__ */ import_react2.default.createElement(
|
|
251
|
+
"div",
|
|
252
|
+
{
|
|
253
|
+
ref: cardRef,
|
|
254
|
+
style: cardStyle,
|
|
255
|
+
onMouseMove: handleMouseMove,
|
|
256
|
+
onMouseEnter: () => setIsHovered(true),
|
|
257
|
+
onMouseLeave: handleMouseLeave,
|
|
258
|
+
onClick,
|
|
259
|
+
...rest
|
|
260
|
+
},
|
|
261
|
+
image && /* @__PURE__ */ import_react2.default.createElement("img", { src: image, alt: title, style: imageStyle }),
|
|
262
|
+
/* @__PURE__ */ import_react2.default.createElement("div", { style: contentStyle }, /* @__PURE__ */ import_react2.default.createElement("h3", { style: titleStyle }, title), /* @__PURE__ */ import_react2.default.createElement("p", { style: descStyle }, description), children),
|
|
263
|
+
glare && /* @__PURE__ */ import_react2.default.createElement("div", { style: glareStyle }),
|
|
264
|
+
/* @__PURE__ */ import_react2.default.createElement("div", { style: accentBarStyle })
|
|
265
|
+
));
|
|
266
|
+
};
|
|
267
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
268
|
+
0 && (module.exports = {
|
|
269
|
+
Button,
|
|
270
|
+
Card
|
|
271
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
// src/components/Button/button.jsx
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
var Button = ({
|
|
4
|
+
text = "Click Me",
|
|
5
|
+
color = "#ffffff",
|
|
6
|
+
bgColor = "#6C63FF",
|
|
7
|
+
hoverBgColor = "#5A52D5",
|
|
8
|
+
size = "md",
|
|
9
|
+
borderRadius = "12px",
|
|
10
|
+
fontWeight = "600",
|
|
11
|
+
shadow = true,
|
|
12
|
+
onClick = () => {
|
|
13
|
+
},
|
|
14
|
+
disabled = false,
|
|
15
|
+
icon = null,
|
|
16
|
+
fullWidth = false,
|
|
17
|
+
...rest
|
|
18
|
+
}) => {
|
|
19
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
20
|
+
const [isPressed, setIsPressed] = useState(false);
|
|
21
|
+
const [ripples, setRipples] = useState([]);
|
|
22
|
+
const sizeMap = {
|
|
23
|
+
sm: { padding: "8px 18px", fontSize: "13px" },
|
|
24
|
+
md: { padding: "12px 28px", fontSize: "15px" },
|
|
25
|
+
lg: { padding: "16px 38px", fontSize: "17px" }
|
|
26
|
+
};
|
|
27
|
+
const { padding, fontSize } = sizeMap[size] || sizeMap.md;
|
|
28
|
+
const handleRipple = (e) => {
|
|
29
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
30
|
+
const x = e.clientX - rect.left;
|
|
31
|
+
const y = e.clientY - rect.top;
|
|
32
|
+
const id = Date.now();
|
|
33
|
+
setRipples((prev) => [...prev, { x, y, id }]);
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
setRipples((prev) => prev.filter((r) => r.id !== id));
|
|
36
|
+
}, 600);
|
|
37
|
+
};
|
|
38
|
+
const baseStyle = {
|
|
39
|
+
position: "relative",
|
|
40
|
+
overflow: "hidden",
|
|
41
|
+
display: "inline-flex",
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
justifyContent: "center",
|
|
44
|
+
gap: "8px",
|
|
45
|
+
padding,
|
|
46
|
+
fontSize,
|
|
47
|
+
fontWeight,
|
|
48
|
+
fontFamily: "'Inter', 'Segoe UI', sans-serif",
|
|
49
|
+
color,
|
|
50
|
+
backgroundColor: disabled ? "#A0A0B0" : isPressed ? hoverBgColor : isHovered ? hoverBgColor : bgColor,
|
|
51
|
+
border: "none",
|
|
52
|
+
borderRadius,
|
|
53
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
54
|
+
opacity: disabled ? 0.6 : 1,
|
|
55
|
+
width: fullWidth ? "100%" : "auto",
|
|
56
|
+
transform: isPressed ? "scale(0.96)" : isHovered ? "translateY(-2px)" : "translateY(0)",
|
|
57
|
+
boxShadow: shadow ? isHovered && !disabled ? `0 8px 24px ${bgColor}66` : `0 4px 14px ${bgColor}33` : "none",
|
|
58
|
+
transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
59
|
+
letterSpacing: "0.3px",
|
|
60
|
+
outline: "none",
|
|
61
|
+
userSelect: "none",
|
|
62
|
+
WebkitTapHighlightColor: "transparent"
|
|
63
|
+
};
|
|
64
|
+
const rippleStyle = (ripple) => ({
|
|
65
|
+
position: "absolute",
|
|
66
|
+
left: ripple.x - 50,
|
|
67
|
+
top: ripple.y - 50,
|
|
68
|
+
width: 100,
|
|
69
|
+
height: 100,
|
|
70
|
+
borderRadius: "50%",
|
|
71
|
+
background: "rgba(255,255,255,0.35)",
|
|
72
|
+
transform: "scale(0)",
|
|
73
|
+
animation: "btn-ripple 0.6s ease-out forwards",
|
|
74
|
+
pointerEvents: "none"
|
|
75
|
+
});
|
|
76
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("style", null, `
|
|
77
|
+
@keyframes btn-ripple {
|
|
78
|
+
to { transform: scale(4); opacity: 0; }
|
|
79
|
+
}
|
|
80
|
+
`), /* @__PURE__ */ React.createElement(
|
|
81
|
+
"button",
|
|
82
|
+
{
|
|
83
|
+
style: baseStyle,
|
|
84
|
+
onMouseEnter: () => setIsHovered(true),
|
|
85
|
+
onMouseLeave: () => {
|
|
86
|
+
setIsHovered(false);
|
|
87
|
+
setIsPressed(false);
|
|
88
|
+
},
|
|
89
|
+
onMouseDown: () => setIsPressed(true),
|
|
90
|
+
onMouseUp: () => setIsPressed(false),
|
|
91
|
+
onClick: (e) => {
|
|
92
|
+
if (!disabled) {
|
|
93
|
+
handleRipple(e);
|
|
94
|
+
onClick(e);
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
disabled,
|
|
98
|
+
...rest
|
|
99
|
+
},
|
|
100
|
+
icon && /* @__PURE__ */ React.createElement("span", { style: { display: "flex", alignItems: "center" } }, icon),
|
|
101
|
+
text,
|
|
102
|
+
ripples.map((ripple) => /* @__PURE__ */ React.createElement("span", { key: ripple.id, style: rippleStyle(ripple) }))
|
|
103
|
+
));
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// src/components/Card/card.jsx
|
|
107
|
+
import React2, { useState as useState2, useRef } from "react";
|
|
108
|
+
var Card = ({
|
|
109
|
+
title = "Card Title",
|
|
110
|
+
description = "This is a beautifully crafted 3D card component.",
|
|
111
|
+
image = null,
|
|
112
|
+
bgColor = "#1E1E2E",
|
|
113
|
+
textColor = "#E0E0F0",
|
|
114
|
+
accentColor = "#6C63FF",
|
|
115
|
+
width = "320px",
|
|
116
|
+
height = "auto",
|
|
117
|
+
borderRadius = "20px",
|
|
118
|
+
shadow = true,
|
|
119
|
+
children = null,
|
|
120
|
+
onClick = null,
|
|
121
|
+
glare = true,
|
|
122
|
+
...rest
|
|
123
|
+
}) => {
|
|
124
|
+
const [tilt, setTilt] = useState2({ x: 0, y: 0 });
|
|
125
|
+
const [isHovered, setIsHovered] = useState2(false);
|
|
126
|
+
const cardRef = useRef(null);
|
|
127
|
+
const handleMouseMove = (e) => {
|
|
128
|
+
if (!cardRef.current) return;
|
|
129
|
+
const rect = cardRef.current.getBoundingClientRect();
|
|
130
|
+
const x = e.clientX - rect.left;
|
|
131
|
+
const y = e.clientY - rect.top;
|
|
132
|
+
const centerX = rect.width / 2;
|
|
133
|
+
const centerY = rect.height / 2;
|
|
134
|
+
const rotateX = (y - centerY) / centerY * -12;
|
|
135
|
+
const rotateY = (x - centerX) / centerX * 12;
|
|
136
|
+
setTilt({ x: rotateX, y: rotateY, px: x / rect.width * 100, py: y / rect.height * 100 });
|
|
137
|
+
};
|
|
138
|
+
const handleMouseLeave = () => {
|
|
139
|
+
setTilt({ x: 0, y: 0, px: 50, py: 50 });
|
|
140
|
+
setIsHovered(false);
|
|
141
|
+
};
|
|
142
|
+
const containerStyle = {
|
|
143
|
+
perspective: "1000px",
|
|
144
|
+
width,
|
|
145
|
+
display: "inline-block"
|
|
146
|
+
};
|
|
147
|
+
const cardStyle = {
|
|
148
|
+
position: "relative",
|
|
149
|
+
width: "100%",
|
|
150
|
+
height,
|
|
151
|
+
backgroundColor: bgColor,
|
|
152
|
+
borderRadius,
|
|
153
|
+
padding: "0",
|
|
154
|
+
overflow: "hidden",
|
|
155
|
+
cursor: onClick ? "pointer" : "default",
|
|
156
|
+
transform: isHovered ? `rotateX(${tilt.x}deg) rotateY(${tilt.y}deg) scale3d(1.04, 1.04, 1.04)` : "rotateX(0) rotateY(0) scale3d(1, 1, 1)",
|
|
157
|
+
transition: isHovered ? "transform 0.1s ease-out, box-shadow 0.3s ease" : "transform 0.5s ease-out, box-shadow 0.5s ease",
|
|
158
|
+
boxShadow: shadow ? isHovered ? `0 20px 60px rgba(0,0,0,0.4), 0 0 30px ${accentColor}22` : "0 8px 30px rgba(0,0,0,0.25)" : "none",
|
|
159
|
+
transformStyle: "preserve-3d",
|
|
160
|
+
willChange: "transform"
|
|
161
|
+
};
|
|
162
|
+
const glareStyle = {
|
|
163
|
+
position: "absolute",
|
|
164
|
+
top: 0,
|
|
165
|
+
left: 0,
|
|
166
|
+
right: 0,
|
|
167
|
+
bottom: 0,
|
|
168
|
+
borderRadius,
|
|
169
|
+
background: isHovered ? `radial-gradient(circle at ${tilt.px || 50}% ${tilt.py || 50}%, rgba(255,255,255,0.15) 0%, transparent 60%)` : "none",
|
|
170
|
+
pointerEvents: "none",
|
|
171
|
+
zIndex: 3,
|
|
172
|
+
transition: isHovered ? "none" : "background 0.5s ease"
|
|
173
|
+
};
|
|
174
|
+
const imageStyle = {
|
|
175
|
+
width: "100%",
|
|
176
|
+
height: "180px",
|
|
177
|
+
objectFit: "cover",
|
|
178
|
+
display: "block",
|
|
179
|
+
borderRadius: `${borderRadius} ${borderRadius} 0 0`
|
|
180
|
+
};
|
|
181
|
+
const contentStyle = {
|
|
182
|
+
padding: "22px 24px 26px",
|
|
183
|
+
position: "relative",
|
|
184
|
+
zIndex: 1
|
|
185
|
+
};
|
|
186
|
+
const titleStyle = {
|
|
187
|
+
margin: "0 0 10px 0",
|
|
188
|
+
fontSize: "20px",
|
|
189
|
+
fontWeight: "700",
|
|
190
|
+
fontFamily: "'Inter', 'Segoe UI', sans-serif",
|
|
191
|
+
color: textColor,
|
|
192
|
+
letterSpacing: "0.2px",
|
|
193
|
+
lineHeight: "1.3"
|
|
194
|
+
};
|
|
195
|
+
const descStyle = {
|
|
196
|
+
margin: 0,
|
|
197
|
+
fontSize: "14px",
|
|
198
|
+
fontFamily: "'Inter', 'Segoe UI', sans-serif",
|
|
199
|
+
color: `${textColor}99`,
|
|
200
|
+
lineHeight: "1.6",
|
|
201
|
+
fontWeight: "400"
|
|
202
|
+
};
|
|
203
|
+
const accentBarStyle = {
|
|
204
|
+
position: "absolute",
|
|
205
|
+
bottom: 0,
|
|
206
|
+
left: 0,
|
|
207
|
+
right: 0,
|
|
208
|
+
height: "3px",
|
|
209
|
+
background: `linear-gradient(90deg, ${accentColor}, ${accentColor}88, transparent)`,
|
|
210
|
+
opacity: isHovered ? 1 : 0,
|
|
211
|
+
transition: "opacity 0.4s ease",
|
|
212
|
+
zIndex: 2
|
|
213
|
+
};
|
|
214
|
+
return /* @__PURE__ */ React2.createElement("div", { style: containerStyle }, /* @__PURE__ */ React2.createElement(
|
|
215
|
+
"div",
|
|
216
|
+
{
|
|
217
|
+
ref: cardRef,
|
|
218
|
+
style: cardStyle,
|
|
219
|
+
onMouseMove: handleMouseMove,
|
|
220
|
+
onMouseEnter: () => setIsHovered(true),
|
|
221
|
+
onMouseLeave: handleMouseLeave,
|
|
222
|
+
onClick,
|
|
223
|
+
...rest
|
|
224
|
+
},
|
|
225
|
+
image && /* @__PURE__ */ React2.createElement("img", { src: image, alt: title, style: imageStyle }),
|
|
226
|
+
/* @__PURE__ */ React2.createElement("div", { style: contentStyle }, /* @__PURE__ */ React2.createElement("h3", { style: titleStyle }, title), /* @__PURE__ */ React2.createElement("p", { style: descStyle }, description), children),
|
|
227
|
+
glare && /* @__PURE__ */ React2.createElement("div", { style: glareStyle }),
|
|
228
|
+
/* @__PURE__ */ React2.createElement("div", { style: accentBarStyle })
|
|
229
|
+
));
|
|
230
|
+
};
|
|
231
|
+
export {
|
|
232
|
+
Button,
|
|
233
|
+
Card
|
|
234
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "componentui-lib",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "ComponentUI is a modern, animated UI component library designed to help developers build beautiful landing pages and interfaces faster.",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"author": "SADIA",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/index.mjs",
|
|
9
|
+
"files": ["dist"],
|
|
10
|
+
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsup"
|
|
13
|
+
},
|
|
14
|
+
"peerDependencies": {
|
|
15
|
+
"react": ">=18",
|
|
16
|
+
"react-dom": ">=18"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"tsup": "^8.5.1",
|
|
20
|
+
"typescript": "^6.0.3"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|