carbon-ui-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 +321 -0
- package/dist/index.mjs +282 -0
- package/package.json +22 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,321 @@
|
|
|
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
|
+
ECommerceCard: () => ECommerceCard,
|
|
35
|
+
Profilecard: () => Profilecard
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(index_exports);
|
|
38
|
+
|
|
39
|
+
// src/components/Button/Button.jsx
|
|
40
|
+
var import_react = __toESM(require("react"));
|
|
41
|
+
var Button = ({
|
|
42
|
+
text = "Click Me",
|
|
43
|
+
bgColor = "#4CAF50",
|
|
44
|
+
hoverColor = "#45a049",
|
|
45
|
+
textColor = "#ffffff",
|
|
46
|
+
size = "medium",
|
|
47
|
+
onClick = () => {
|
|
48
|
+
}
|
|
49
|
+
}) => {
|
|
50
|
+
const [isHovered, setIsHovered] = (0, import_react.useState)(false);
|
|
51
|
+
const [clickCount, setClickCount] = (0, import_react.useState)(0);
|
|
52
|
+
const sizeStyles = {
|
|
53
|
+
small: { padding: "6px 12px", fontSize: "12px" },
|
|
54
|
+
medium: { padding: "10px 20px", fontSize: "16px" },
|
|
55
|
+
large: { padding: "14px 28px", fontSize: "20px" }
|
|
56
|
+
};
|
|
57
|
+
const handleClick = () => {
|
|
58
|
+
setClickCount((prev) => prev + 1);
|
|
59
|
+
onClick(clickCount + 1);
|
|
60
|
+
};
|
|
61
|
+
const buttonStyle = {
|
|
62
|
+
backgroundColor: isHovered ? hoverColor : bgColor,
|
|
63
|
+
color: textColor,
|
|
64
|
+
border: "none",
|
|
65
|
+
borderRadius: "6px",
|
|
66
|
+
cursor: "pointer",
|
|
67
|
+
fontWeight: "600",
|
|
68
|
+
transition: "background-color 0.3s ease, transform 0.2s ease",
|
|
69
|
+
transform: isHovered ? "scale(1.05)" : "scale(1)",
|
|
70
|
+
...sizeStyles[size]
|
|
71
|
+
};
|
|
72
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
73
|
+
"button",
|
|
74
|
+
{
|
|
75
|
+
style: buttonStyle,
|
|
76
|
+
onMouseEnter: () => setIsHovered(true),
|
|
77
|
+
onMouseLeave: () => setIsHovered(false),
|
|
78
|
+
onClick: handleClick
|
|
79
|
+
},
|
|
80
|
+
text,
|
|
81
|
+
" ",
|
|
82
|
+
clickCount > 0 ? `(${clickCount})` : ""
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// src/components/Card/Card.jsx
|
|
87
|
+
var import_react2 = __toESM(require("react"));
|
|
88
|
+
var Card = ({
|
|
89
|
+
title = "Card Title",
|
|
90
|
+
description = "This is a simple reusable card component description.",
|
|
91
|
+
imageUrl = "https://via.placeholder.com/300x180",
|
|
92
|
+
bgColor = "#ffffff",
|
|
93
|
+
hoverBgColor = "#f9f9f9",
|
|
94
|
+
textColor = "#222222",
|
|
95
|
+
accentColor = "#4CAF50",
|
|
96
|
+
size = "medium"
|
|
97
|
+
}) => {
|
|
98
|
+
const [isHovered, setIsHovered] = (0, import_react2.useState)(false);
|
|
99
|
+
const [expanded, setExpanded] = (0, import_react2.useState)(false);
|
|
100
|
+
const sizeStyles = {
|
|
101
|
+
small: { width: "220px", fontSize: "12px" },
|
|
102
|
+
medium: { width: "300px", fontSize: "14px" },
|
|
103
|
+
large: { width: "380px", fontSize: "16px" }
|
|
104
|
+
};
|
|
105
|
+
const cardStyle = {
|
|
106
|
+
width: sizeStyles[size].width,
|
|
107
|
+
backgroundColor: isHovered ? hoverBgColor : bgColor,
|
|
108
|
+
color: textColor,
|
|
109
|
+
borderRadius: "12px",
|
|
110
|
+
boxShadow: isHovered ? "0 8px 20px rgba(0,0,0,0.15)" : "0 4px 10px rgba(0,0,0,0.08)",
|
|
111
|
+
transform: isHovered ? "translateY(-5px)" : "translateY(0)",
|
|
112
|
+
transition: "all 0.3s ease",
|
|
113
|
+
overflow: "hidden",
|
|
114
|
+
fontFamily: "Arial, sans-serif",
|
|
115
|
+
cursor: "pointer"
|
|
116
|
+
};
|
|
117
|
+
const imageStyle = {
|
|
118
|
+
width: "100%",
|
|
119
|
+
height: "180px",
|
|
120
|
+
objectFit: "cover",
|
|
121
|
+
display: "block"
|
|
122
|
+
};
|
|
123
|
+
const contentStyle = {
|
|
124
|
+
padding: "16px"
|
|
125
|
+
};
|
|
126
|
+
const titleStyle = {
|
|
127
|
+
margin: "0 0 8px 0",
|
|
128
|
+
fontSize: "1.3em",
|
|
129
|
+
fontWeight: "700"
|
|
130
|
+
};
|
|
131
|
+
const descStyle = {
|
|
132
|
+
margin: "0 0 12px 0",
|
|
133
|
+
fontSize: sizeStyles[size].fontSize,
|
|
134
|
+
lineHeight: "1.4",
|
|
135
|
+
opacity: 0.85,
|
|
136
|
+
display: "-webkit-box",
|
|
137
|
+
WebkitLineClamp: expanded ? "unset" : 2,
|
|
138
|
+
WebkitBoxOrient: "vertical",
|
|
139
|
+
overflow: "hidden"
|
|
140
|
+
};
|
|
141
|
+
const buttonStyle = {
|
|
142
|
+
backgroundColor: accentColor,
|
|
143
|
+
color: "#fff",
|
|
144
|
+
border: "none",
|
|
145
|
+
borderRadius: "6px",
|
|
146
|
+
padding: "6px 14px",
|
|
147
|
+
fontSize: "13px",
|
|
148
|
+
cursor: "pointer"
|
|
149
|
+
};
|
|
150
|
+
return /* @__PURE__ */ import_react2.default.createElement(
|
|
151
|
+
"div",
|
|
152
|
+
{
|
|
153
|
+
style: cardStyle,
|
|
154
|
+
onMouseEnter: () => setIsHovered(true),
|
|
155
|
+
onMouseLeave: () => setIsHovered(false)
|
|
156
|
+
},
|
|
157
|
+
/* @__PURE__ */ import_react2.default.createElement("img", { src: imageUrl, alt: title, style: imageStyle }),
|
|
158
|
+
/* @__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), /* @__PURE__ */ import_react2.default.createElement(
|
|
159
|
+
"button",
|
|
160
|
+
{
|
|
161
|
+
style: buttonStyle,
|
|
162
|
+
onClick: () => setExpanded((prev) => !prev)
|
|
163
|
+
},
|
|
164
|
+
expanded ? "Show Less" : "Read More"
|
|
165
|
+
))
|
|
166
|
+
);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
// src/components/Profilecard/Profilecard.jsx
|
|
170
|
+
var import_react3 = __toESM(require("react"));
|
|
171
|
+
var Profilecard = ({
|
|
172
|
+
name = "John Doe",
|
|
173
|
+
role = "Software Engineer",
|
|
174
|
+
bio = "Passionate about building clean and efficient web applications.",
|
|
175
|
+
avatarUrl = "https://via.placeholder.com/120",
|
|
176
|
+
bgColor = "#ffffff",
|
|
177
|
+
hoverBgColor = "#f9f9f9",
|
|
178
|
+
textColor = "#222222",
|
|
179
|
+
accentColor = "#4CAF50",
|
|
180
|
+
size = "medium"
|
|
181
|
+
}) => {
|
|
182
|
+
const [isHovered, setIsHovered] = (0, import_react3.useState)(false);
|
|
183
|
+
const [isFollowing, setIsFollowing] = (0, import_react3.useState)(false);
|
|
184
|
+
const sizeStyles = {
|
|
185
|
+
small: { width: "220px", avatar: "80px", fontSize: "12px" },
|
|
186
|
+
medium: { width: "280px", avatar: "110px", fontSize: "14px" },
|
|
187
|
+
large: { width: "340px", avatar: "140px", fontSize: "16px" }
|
|
188
|
+
};
|
|
189
|
+
const cardStyle = {
|
|
190
|
+
width: sizeStyles[size].width,
|
|
191
|
+
backgroundColor: isHovered ? hoverBgColor : bgColor,
|
|
192
|
+
color: textColor,
|
|
193
|
+
borderRadius: "16px",
|
|
194
|
+
boxShadow: isHovered ? "0 10px 24px rgba(0,0,0,0.15)" : "0 4px 12px rgba(0,0,0,0.08)",
|
|
195
|
+
transform: isHovered ? "translateY(-6px)" : "translateY(0)",
|
|
196
|
+
transition: "all 0.3s ease",
|
|
197
|
+
textAlign: "center",
|
|
198
|
+
padding: "24px 20px",
|
|
199
|
+
fontFamily: "Arial, sans-serif"
|
|
200
|
+
};
|
|
201
|
+
const avatarStyle = {
|
|
202
|
+
width: sizeStyles[size].avatar,
|
|
203
|
+
height: sizeStyles[size].avatar,
|
|
204
|
+
borderRadius: "50%",
|
|
205
|
+
objectFit: "cover",
|
|
206
|
+
border: `3px solid ${accentColor}`,
|
|
207
|
+
marginBottom: "12px"
|
|
208
|
+
};
|
|
209
|
+
const nameStyle = {
|
|
210
|
+
margin: "0 0 4px 0",
|
|
211
|
+
fontSize: "1.3em",
|
|
212
|
+
fontWeight: "700"
|
|
213
|
+
};
|
|
214
|
+
const roleStyle = {
|
|
215
|
+
margin: "0 0 10px 0",
|
|
216
|
+
fontSize: sizeStyles[size].fontSize,
|
|
217
|
+
color: accentColor,
|
|
218
|
+
fontWeight: "600"
|
|
219
|
+
};
|
|
220
|
+
const bioStyle = {
|
|
221
|
+
margin: "0 0 16px 0",
|
|
222
|
+
fontSize: sizeStyles[size].fontSize,
|
|
223
|
+
lineHeight: "1.4",
|
|
224
|
+
opacity: 0.8
|
|
225
|
+
};
|
|
226
|
+
const buttonStyle = {
|
|
227
|
+
backgroundColor: isFollowing ? "#ccc" : accentColor,
|
|
228
|
+
color: isFollowing ? "#333" : "#fff",
|
|
229
|
+
border: "none",
|
|
230
|
+
borderRadius: "20px",
|
|
231
|
+
padding: "8px 20px",
|
|
232
|
+
fontSize: "14px",
|
|
233
|
+
fontWeight: "600",
|
|
234
|
+
cursor: "pointer",
|
|
235
|
+
transition: "background-color 0.3s ease"
|
|
236
|
+
};
|
|
237
|
+
return /* @__PURE__ */ import_react3.default.createElement(
|
|
238
|
+
"div",
|
|
239
|
+
{
|
|
240
|
+
style: cardStyle,
|
|
241
|
+
onMouseEnter: () => setIsHovered(true),
|
|
242
|
+
onMouseLeave: () => setIsHovered(false)
|
|
243
|
+
},
|
|
244
|
+
/* @__PURE__ */ import_react3.default.createElement("img", { src: avatarUrl, alt: name, style: avatarStyle }),
|
|
245
|
+
/* @__PURE__ */ import_react3.default.createElement("h3", { style: nameStyle }, name),
|
|
246
|
+
/* @__PURE__ */ import_react3.default.createElement("p", { style: roleStyle }, role),
|
|
247
|
+
/* @__PURE__ */ import_react3.default.createElement("p", { style: bioStyle }, bio),
|
|
248
|
+
/* @__PURE__ */ import_react3.default.createElement(
|
|
249
|
+
"button",
|
|
250
|
+
{
|
|
251
|
+
style: buttonStyle,
|
|
252
|
+
onClick: () => setIsFollowing((prev) => !prev)
|
|
253
|
+
},
|
|
254
|
+
isFollowing ? "Following" : "Follow"
|
|
255
|
+
)
|
|
256
|
+
);
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
// src/components/ECommerceCard/ECommerceCard.jsx
|
|
260
|
+
var import_react4 = __toESM(require("react"));
|
|
261
|
+
var ECommerceCard = ({
|
|
262
|
+
image = "https://images.unsplash.com/photo-1523381294911-8d3cead13475?w=600&q=80",
|
|
263
|
+
title = "Modern Leather Chair",
|
|
264
|
+
description = "Elegant and comfortable leather chair for your living space.",
|
|
265
|
+
price = 299,
|
|
266
|
+
currency = "$",
|
|
267
|
+
rating = 4.5,
|
|
268
|
+
accent = "#6366f1",
|
|
269
|
+
bg = "#0f172a",
|
|
270
|
+
onAddToCart = () => {
|
|
271
|
+
},
|
|
272
|
+
onViewDetails = () => {
|
|
273
|
+
}
|
|
274
|
+
}) => {
|
|
275
|
+
const [hovered, setHovered] = (0, import_react4.useState)(false);
|
|
276
|
+
const alpha = (hex, op) => {
|
|
277
|
+
const r = parseInt(hex.slice(1, 3), 16), g = parseInt(hex.slice(3, 5), 16), b = parseInt(hex.slice(5, 7), 16);
|
|
278
|
+
return "rgba(" + r + "," + g + "," + b + "," + op + ")";
|
|
279
|
+
};
|
|
280
|
+
return /* @__PURE__ */ import_react4.default.createElement(
|
|
281
|
+
"div",
|
|
282
|
+
{
|
|
283
|
+
onMouseEnter: () => setHovered(true),
|
|
284
|
+
onMouseLeave: () => setHovered(false),
|
|
285
|
+
style: {
|
|
286
|
+
background: bg,
|
|
287
|
+
borderRadius: "20px",
|
|
288
|
+
overflow: "hidden",
|
|
289
|
+
width: "280px",
|
|
290
|
+
border: "1px solid " + (hovered ? alpha(accent, 0.3) : "rgba(255,255,255,0.07)"),
|
|
291
|
+
fontFamily: "system-ui,sans-serif",
|
|
292
|
+
transition: "transform 0.25s, box-shadow 0.25s",
|
|
293
|
+
transform: hovered ? "translateY(-4px)" : "translateY(0px)",
|
|
294
|
+
boxShadow: hovered ? "0 16px 40px rgba(0,0,0,0.5)" : "0 4px 20px rgba(0,0,0,0.3)"
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
/* @__PURE__ */ import_react4.default.createElement("div", { style: { position: "relative", width: "100%", height: "200px", overflow: "hidden" } }, /* @__PURE__ */ import_react4.default.createElement("img", { src: image, alt: title, style: { width: "100%", height: "100%", objectFit: "cover", transform: hovered ? "scale(1.05)" : "scale(1)", transition: "transform 0.4s ease" } }), /* @__PURE__ */ import_react4.default.createElement("div", { style: { position: "absolute", inset: 0, background: "linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 60%)" } }), /* @__PURE__ */ import_react4.default.createElement("div", { style: { position: "absolute", bottom: "12px", left: "12px", padding: "4px 10px", borderRadius: "20px", background: alpha(accent, 0.85), fontSize: "10px", fontWeight: "700", color: "#fff", textTransform: "uppercase", letterSpacing: "0.5px" } }, rating, " \u2605")),
|
|
298
|
+
/* @__PURE__ */ import_react4.default.createElement("div", { style: { padding: "18px" } }, /* @__PURE__ */ import_react4.default.createElement("h3", { style: { fontSize: "15px", fontWeight: "700", color: "#fff", margin: "0 0 8px", lineHeight: 1.4 } }, title), /* @__PURE__ */ import_react4.default.createElement("p", { style: { fontSize: "13px", color: "rgba(255,255,255,0.45)", lineHeight: 1.65, margin: "0 0 18px" } }, description), /* @__PURE__ */ import_react4.default.createElement("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: "18px" } }, /* @__PURE__ */ import_react4.default.createElement("span", { style: { fontSize: "18px", fontWeight: "800", color: "#fff" } }, currency, price), /* @__PURE__ */ import_react4.default.createElement(
|
|
299
|
+
"button",
|
|
300
|
+
{
|
|
301
|
+
onClick: onAddToCart,
|
|
302
|
+
style: { padding: "8px 16px", borderRadius: "10px", border: "none", background: "linear-gradient(135deg, " + accent + ", " + alpha(accent, 0.7) + ")", color: "#fff", fontSize: "13px", fontWeight: "700", cursor: "pointer", fontFamily: "inherit" }
|
|
303
|
+
},
|
|
304
|
+
"Add to Cart"
|
|
305
|
+
)), /* @__PURE__ */ import_react4.default.createElement(
|
|
306
|
+
"button",
|
|
307
|
+
{
|
|
308
|
+
onClick: onViewDetails,
|
|
309
|
+
style: { width: "100%", padding: "11px", borderRadius: "12px", border: "none", background: "transparent", color: accent, fontSize: "13px", fontWeight: "700", cursor: "pointer", fontFamily: "inherit" }
|
|
310
|
+
},
|
|
311
|
+
"View Details"
|
|
312
|
+
))
|
|
313
|
+
);
|
|
314
|
+
};
|
|
315
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
316
|
+
0 && (module.exports = {
|
|
317
|
+
Button,
|
|
318
|
+
Card,
|
|
319
|
+
ECommerceCard,
|
|
320
|
+
Profilecard
|
|
321
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
// src/components/Button/Button.jsx
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
var Button = ({
|
|
4
|
+
text = "Click Me",
|
|
5
|
+
bgColor = "#4CAF50",
|
|
6
|
+
hoverColor = "#45a049",
|
|
7
|
+
textColor = "#ffffff",
|
|
8
|
+
size = "medium",
|
|
9
|
+
onClick = () => {
|
|
10
|
+
}
|
|
11
|
+
}) => {
|
|
12
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
13
|
+
const [clickCount, setClickCount] = useState(0);
|
|
14
|
+
const sizeStyles = {
|
|
15
|
+
small: { padding: "6px 12px", fontSize: "12px" },
|
|
16
|
+
medium: { padding: "10px 20px", fontSize: "16px" },
|
|
17
|
+
large: { padding: "14px 28px", fontSize: "20px" }
|
|
18
|
+
};
|
|
19
|
+
const handleClick = () => {
|
|
20
|
+
setClickCount((prev) => prev + 1);
|
|
21
|
+
onClick(clickCount + 1);
|
|
22
|
+
};
|
|
23
|
+
const buttonStyle = {
|
|
24
|
+
backgroundColor: isHovered ? hoverColor : bgColor,
|
|
25
|
+
color: textColor,
|
|
26
|
+
border: "none",
|
|
27
|
+
borderRadius: "6px",
|
|
28
|
+
cursor: "pointer",
|
|
29
|
+
fontWeight: "600",
|
|
30
|
+
transition: "background-color 0.3s ease, transform 0.2s ease",
|
|
31
|
+
transform: isHovered ? "scale(1.05)" : "scale(1)",
|
|
32
|
+
...sizeStyles[size]
|
|
33
|
+
};
|
|
34
|
+
return /* @__PURE__ */ React.createElement(
|
|
35
|
+
"button",
|
|
36
|
+
{
|
|
37
|
+
style: buttonStyle,
|
|
38
|
+
onMouseEnter: () => setIsHovered(true),
|
|
39
|
+
onMouseLeave: () => setIsHovered(false),
|
|
40
|
+
onClick: handleClick
|
|
41
|
+
},
|
|
42
|
+
text,
|
|
43
|
+
" ",
|
|
44
|
+
clickCount > 0 ? `(${clickCount})` : ""
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// src/components/Card/Card.jsx
|
|
49
|
+
import React2, { useState as useState2 } from "react";
|
|
50
|
+
var Card = ({
|
|
51
|
+
title = "Card Title",
|
|
52
|
+
description = "This is a simple reusable card component description.",
|
|
53
|
+
imageUrl = "https://via.placeholder.com/300x180",
|
|
54
|
+
bgColor = "#ffffff",
|
|
55
|
+
hoverBgColor = "#f9f9f9",
|
|
56
|
+
textColor = "#222222",
|
|
57
|
+
accentColor = "#4CAF50",
|
|
58
|
+
size = "medium"
|
|
59
|
+
}) => {
|
|
60
|
+
const [isHovered, setIsHovered] = useState2(false);
|
|
61
|
+
const [expanded, setExpanded] = useState2(false);
|
|
62
|
+
const sizeStyles = {
|
|
63
|
+
small: { width: "220px", fontSize: "12px" },
|
|
64
|
+
medium: { width: "300px", fontSize: "14px" },
|
|
65
|
+
large: { width: "380px", fontSize: "16px" }
|
|
66
|
+
};
|
|
67
|
+
const cardStyle = {
|
|
68
|
+
width: sizeStyles[size].width,
|
|
69
|
+
backgroundColor: isHovered ? hoverBgColor : bgColor,
|
|
70
|
+
color: textColor,
|
|
71
|
+
borderRadius: "12px",
|
|
72
|
+
boxShadow: isHovered ? "0 8px 20px rgba(0,0,0,0.15)" : "0 4px 10px rgba(0,0,0,0.08)",
|
|
73
|
+
transform: isHovered ? "translateY(-5px)" : "translateY(0)",
|
|
74
|
+
transition: "all 0.3s ease",
|
|
75
|
+
overflow: "hidden",
|
|
76
|
+
fontFamily: "Arial, sans-serif",
|
|
77
|
+
cursor: "pointer"
|
|
78
|
+
};
|
|
79
|
+
const imageStyle = {
|
|
80
|
+
width: "100%",
|
|
81
|
+
height: "180px",
|
|
82
|
+
objectFit: "cover",
|
|
83
|
+
display: "block"
|
|
84
|
+
};
|
|
85
|
+
const contentStyle = {
|
|
86
|
+
padding: "16px"
|
|
87
|
+
};
|
|
88
|
+
const titleStyle = {
|
|
89
|
+
margin: "0 0 8px 0",
|
|
90
|
+
fontSize: "1.3em",
|
|
91
|
+
fontWeight: "700"
|
|
92
|
+
};
|
|
93
|
+
const descStyle = {
|
|
94
|
+
margin: "0 0 12px 0",
|
|
95
|
+
fontSize: sizeStyles[size].fontSize,
|
|
96
|
+
lineHeight: "1.4",
|
|
97
|
+
opacity: 0.85,
|
|
98
|
+
display: "-webkit-box",
|
|
99
|
+
WebkitLineClamp: expanded ? "unset" : 2,
|
|
100
|
+
WebkitBoxOrient: "vertical",
|
|
101
|
+
overflow: "hidden"
|
|
102
|
+
};
|
|
103
|
+
const buttonStyle = {
|
|
104
|
+
backgroundColor: accentColor,
|
|
105
|
+
color: "#fff",
|
|
106
|
+
border: "none",
|
|
107
|
+
borderRadius: "6px",
|
|
108
|
+
padding: "6px 14px",
|
|
109
|
+
fontSize: "13px",
|
|
110
|
+
cursor: "pointer"
|
|
111
|
+
};
|
|
112
|
+
return /* @__PURE__ */ React2.createElement(
|
|
113
|
+
"div",
|
|
114
|
+
{
|
|
115
|
+
style: cardStyle,
|
|
116
|
+
onMouseEnter: () => setIsHovered(true),
|
|
117
|
+
onMouseLeave: () => setIsHovered(false)
|
|
118
|
+
},
|
|
119
|
+
/* @__PURE__ */ React2.createElement("img", { src: imageUrl, alt: title, style: imageStyle }),
|
|
120
|
+
/* @__PURE__ */ React2.createElement("div", { style: contentStyle }, /* @__PURE__ */ React2.createElement("h3", { style: titleStyle }, title), /* @__PURE__ */ React2.createElement("p", { style: descStyle }, description), /* @__PURE__ */ React2.createElement(
|
|
121
|
+
"button",
|
|
122
|
+
{
|
|
123
|
+
style: buttonStyle,
|
|
124
|
+
onClick: () => setExpanded((prev) => !prev)
|
|
125
|
+
},
|
|
126
|
+
expanded ? "Show Less" : "Read More"
|
|
127
|
+
))
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// src/components/Profilecard/Profilecard.jsx
|
|
132
|
+
import React3, { useState as useState3 } from "react";
|
|
133
|
+
var Profilecard = ({
|
|
134
|
+
name = "John Doe",
|
|
135
|
+
role = "Software Engineer",
|
|
136
|
+
bio = "Passionate about building clean and efficient web applications.",
|
|
137
|
+
avatarUrl = "https://via.placeholder.com/120",
|
|
138
|
+
bgColor = "#ffffff",
|
|
139
|
+
hoverBgColor = "#f9f9f9",
|
|
140
|
+
textColor = "#222222",
|
|
141
|
+
accentColor = "#4CAF50",
|
|
142
|
+
size = "medium"
|
|
143
|
+
}) => {
|
|
144
|
+
const [isHovered, setIsHovered] = useState3(false);
|
|
145
|
+
const [isFollowing, setIsFollowing] = useState3(false);
|
|
146
|
+
const sizeStyles = {
|
|
147
|
+
small: { width: "220px", avatar: "80px", fontSize: "12px" },
|
|
148
|
+
medium: { width: "280px", avatar: "110px", fontSize: "14px" },
|
|
149
|
+
large: { width: "340px", avatar: "140px", fontSize: "16px" }
|
|
150
|
+
};
|
|
151
|
+
const cardStyle = {
|
|
152
|
+
width: sizeStyles[size].width,
|
|
153
|
+
backgroundColor: isHovered ? hoverBgColor : bgColor,
|
|
154
|
+
color: textColor,
|
|
155
|
+
borderRadius: "16px",
|
|
156
|
+
boxShadow: isHovered ? "0 10px 24px rgba(0,0,0,0.15)" : "0 4px 12px rgba(0,0,0,0.08)",
|
|
157
|
+
transform: isHovered ? "translateY(-6px)" : "translateY(0)",
|
|
158
|
+
transition: "all 0.3s ease",
|
|
159
|
+
textAlign: "center",
|
|
160
|
+
padding: "24px 20px",
|
|
161
|
+
fontFamily: "Arial, sans-serif"
|
|
162
|
+
};
|
|
163
|
+
const avatarStyle = {
|
|
164
|
+
width: sizeStyles[size].avatar,
|
|
165
|
+
height: sizeStyles[size].avatar,
|
|
166
|
+
borderRadius: "50%",
|
|
167
|
+
objectFit: "cover",
|
|
168
|
+
border: `3px solid ${accentColor}`,
|
|
169
|
+
marginBottom: "12px"
|
|
170
|
+
};
|
|
171
|
+
const nameStyle = {
|
|
172
|
+
margin: "0 0 4px 0",
|
|
173
|
+
fontSize: "1.3em",
|
|
174
|
+
fontWeight: "700"
|
|
175
|
+
};
|
|
176
|
+
const roleStyle = {
|
|
177
|
+
margin: "0 0 10px 0",
|
|
178
|
+
fontSize: sizeStyles[size].fontSize,
|
|
179
|
+
color: accentColor,
|
|
180
|
+
fontWeight: "600"
|
|
181
|
+
};
|
|
182
|
+
const bioStyle = {
|
|
183
|
+
margin: "0 0 16px 0",
|
|
184
|
+
fontSize: sizeStyles[size].fontSize,
|
|
185
|
+
lineHeight: "1.4",
|
|
186
|
+
opacity: 0.8
|
|
187
|
+
};
|
|
188
|
+
const buttonStyle = {
|
|
189
|
+
backgroundColor: isFollowing ? "#ccc" : accentColor,
|
|
190
|
+
color: isFollowing ? "#333" : "#fff",
|
|
191
|
+
border: "none",
|
|
192
|
+
borderRadius: "20px",
|
|
193
|
+
padding: "8px 20px",
|
|
194
|
+
fontSize: "14px",
|
|
195
|
+
fontWeight: "600",
|
|
196
|
+
cursor: "pointer",
|
|
197
|
+
transition: "background-color 0.3s ease"
|
|
198
|
+
};
|
|
199
|
+
return /* @__PURE__ */ React3.createElement(
|
|
200
|
+
"div",
|
|
201
|
+
{
|
|
202
|
+
style: cardStyle,
|
|
203
|
+
onMouseEnter: () => setIsHovered(true),
|
|
204
|
+
onMouseLeave: () => setIsHovered(false)
|
|
205
|
+
},
|
|
206
|
+
/* @__PURE__ */ React3.createElement("img", { src: avatarUrl, alt: name, style: avatarStyle }),
|
|
207
|
+
/* @__PURE__ */ React3.createElement("h3", { style: nameStyle }, name),
|
|
208
|
+
/* @__PURE__ */ React3.createElement("p", { style: roleStyle }, role),
|
|
209
|
+
/* @__PURE__ */ React3.createElement("p", { style: bioStyle }, bio),
|
|
210
|
+
/* @__PURE__ */ React3.createElement(
|
|
211
|
+
"button",
|
|
212
|
+
{
|
|
213
|
+
style: buttonStyle,
|
|
214
|
+
onClick: () => setIsFollowing((prev) => !prev)
|
|
215
|
+
},
|
|
216
|
+
isFollowing ? "Following" : "Follow"
|
|
217
|
+
)
|
|
218
|
+
);
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
// src/components/ECommerceCard/ECommerceCard.jsx
|
|
222
|
+
import React4, { useState as useState4 } from "react";
|
|
223
|
+
var ECommerceCard = ({
|
|
224
|
+
image = "https://images.unsplash.com/photo-1523381294911-8d3cead13475?w=600&q=80",
|
|
225
|
+
title = "Modern Leather Chair",
|
|
226
|
+
description = "Elegant and comfortable leather chair for your living space.",
|
|
227
|
+
price = 299,
|
|
228
|
+
currency = "$",
|
|
229
|
+
rating = 4.5,
|
|
230
|
+
accent = "#6366f1",
|
|
231
|
+
bg = "#0f172a",
|
|
232
|
+
onAddToCart = () => {
|
|
233
|
+
},
|
|
234
|
+
onViewDetails = () => {
|
|
235
|
+
}
|
|
236
|
+
}) => {
|
|
237
|
+
const [hovered, setHovered] = useState4(false);
|
|
238
|
+
const alpha = (hex, op) => {
|
|
239
|
+
const r = parseInt(hex.slice(1, 3), 16), g = parseInt(hex.slice(3, 5), 16), b = parseInt(hex.slice(5, 7), 16);
|
|
240
|
+
return "rgba(" + r + "," + g + "," + b + "," + op + ")";
|
|
241
|
+
};
|
|
242
|
+
return /* @__PURE__ */ React4.createElement(
|
|
243
|
+
"div",
|
|
244
|
+
{
|
|
245
|
+
onMouseEnter: () => setHovered(true),
|
|
246
|
+
onMouseLeave: () => setHovered(false),
|
|
247
|
+
style: {
|
|
248
|
+
background: bg,
|
|
249
|
+
borderRadius: "20px",
|
|
250
|
+
overflow: "hidden",
|
|
251
|
+
width: "280px",
|
|
252
|
+
border: "1px solid " + (hovered ? alpha(accent, 0.3) : "rgba(255,255,255,0.07)"),
|
|
253
|
+
fontFamily: "system-ui,sans-serif",
|
|
254
|
+
transition: "transform 0.25s, box-shadow 0.25s",
|
|
255
|
+
transform: hovered ? "translateY(-4px)" : "translateY(0px)",
|
|
256
|
+
boxShadow: hovered ? "0 16px 40px rgba(0,0,0,0.5)" : "0 4px 20px rgba(0,0,0,0.3)"
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
/* @__PURE__ */ React4.createElement("div", { style: { position: "relative", width: "100%", height: "200px", overflow: "hidden" } }, /* @__PURE__ */ React4.createElement("img", { src: image, alt: title, style: { width: "100%", height: "100%", objectFit: "cover", transform: hovered ? "scale(1.05)" : "scale(1)", transition: "transform 0.4s ease" } }), /* @__PURE__ */ React4.createElement("div", { style: { position: "absolute", inset: 0, background: "linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 60%)" } }), /* @__PURE__ */ React4.createElement("div", { style: { position: "absolute", bottom: "12px", left: "12px", padding: "4px 10px", borderRadius: "20px", background: alpha(accent, 0.85), fontSize: "10px", fontWeight: "700", color: "#fff", textTransform: "uppercase", letterSpacing: "0.5px" } }, rating, " \u2605")),
|
|
260
|
+
/* @__PURE__ */ React4.createElement("div", { style: { padding: "18px" } }, /* @__PURE__ */ React4.createElement("h3", { style: { fontSize: "15px", fontWeight: "700", color: "#fff", margin: "0 0 8px", lineHeight: 1.4 } }, title), /* @__PURE__ */ React4.createElement("p", { style: { fontSize: "13px", color: "rgba(255,255,255,0.45)", lineHeight: 1.65, margin: "0 0 18px" } }, description), /* @__PURE__ */ React4.createElement("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: "18px" } }, /* @__PURE__ */ React4.createElement("span", { style: { fontSize: "18px", fontWeight: "800", color: "#fff" } }, currency, price), /* @__PURE__ */ React4.createElement(
|
|
261
|
+
"button",
|
|
262
|
+
{
|
|
263
|
+
onClick: onAddToCart,
|
|
264
|
+
style: { padding: "8px 16px", borderRadius: "10px", border: "none", background: "linear-gradient(135deg, " + accent + ", " + alpha(accent, 0.7) + ")", color: "#fff", fontSize: "13px", fontWeight: "700", cursor: "pointer", fontFamily: "inherit" }
|
|
265
|
+
},
|
|
266
|
+
"Add to Cart"
|
|
267
|
+
)), /* @__PURE__ */ React4.createElement(
|
|
268
|
+
"button",
|
|
269
|
+
{
|
|
270
|
+
onClick: onViewDetails,
|
|
271
|
+
style: { width: "100%", padding: "11px", borderRadius: "12px", border: "none", background: "transparent", color: accent, fontSize: "13px", fontWeight: "700", cursor: "pointer", fontFamily: "inherit" }
|
|
272
|
+
},
|
|
273
|
+
"View Details"
|
|
274
|
+
))
|
|
275
|
+
);
|
|
276
|
+
};
|
|
277
|
+
export {
|
|
278
|
+
Button,
|
|
279
|
+
Card,
|
|
280
|
+
ECommerceCard,
|
|
281
|
+
Profilecard
|
|
282
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "carbon-ui-lib",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Carbon UI React Component Library",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"author": "Harsh",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/index.mjs",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsup"
|
|
14
|
+
},
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"react": ">=18"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"tsup": "^8.5.1",
|
|
20
|
+
"typescript": "^6.0.3"
|
|
21
|
+
}
|
|
22
|
+
}
|