ksm-ai-ui-lib 1.0.0 → 1.0.1
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 +151 -2
- package/dist/index.mjs +149 -1
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -30,7 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var index_exports = {};
|
|
31
31
|
__export(index_exports, {
|
|
32
32
|
Button: () => Button,
|
|
33
|
-
Card: () => Card
|
|
33
|
+
Card: () => Card,
|
|
34
|
+
ProfileCard: () => ProfileCard
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(index_exports);
|
|
36
37
|
|
|
@@ -249,8 +250,156 @@ var Card = ({
|
|
|
249
250
|
footer && /* @__PURE__ */ import_react2.default.createElement("div", { style: styles.footer }, footer)
|
|
250
251
|
);
|
|
251
252
|
};
|
|
253
|
+
|
|
254
|
+
// src/components/ProfileCard/ProfileCard.jsx
|
|
255
|
+
var import_react3 = __toESM(require("react"));
|
|
256
|
+
var SIZES3 = {
|
|
257
|
+
sm: { width: 240, avatar: 64, name: 16, text: 13, padding: 16 },
|
|
258
|
+
md: { width: 300, avatar: 88, name: 20, text: 14, padding: 24 },
|
|
259
|
+
lg: { width: 380, avatar: 112, name: 24, text: 16, padding: 32 }
|
|
260
|
+
};
|
|
261
|
+
var ProfileCard = ({
|
|
262
|
+
name = "John Doe",
|
|
263
|
+
role = "Frontend Developer",
|
|
264
|
+
bio = "Building clean and fast user interfaces with React.",
|
|
265
|
+
avatar = "",
|
|
266
|
+
stats = [
|
|
267
|
+
{ label: "Posts", value: 128 },
|
|
268
|
+
{ label: "Followers", value: "2.4k" },
|
|
269
|
+
{ label: "Following", value: 180 }
|
|
270
|
+
],
|
|
271
|
+
followText = "Follow",
|
|
272
|
+
followingText = "Following",
|
|
273
|
+
size = "md",
|
|
274
|
+
bgColor = "#ffffff",
|
|
275
|
+
textColor = "#1f2937",
|
|
276
|
+
mutedColor = "#6b7280",
|
|
277
|
+
accentColor = "#2563eb",
|
|
278
|
+
borderColor = "#e5e7eb",
|
|
279
|
+
borderRadius = 16,
|
|
280
|
+
hoverLift = true,
|
|
281
|
+
defaultFollowing = false,
|
|
282
|
+
onFollowChange = () => {
|
|
283
|
+
}
|
|
284
|
+
}) => {
|
|
285
|
+
const [hovered, setHovered] = (0, import_react3.useState)(false);
|
|
286
|
+
const [btnHovered, setBtnHovered] = (0, import_react3.useState)(false);
|
|
287
|
+
const [following, setFollowing] = (0, import_react3.useState)(defaultFollowing);
|
|
288
|
+
const s = SIZES3[size] || SIZES3.md;
|
|
289
|
+
const initials = name.split(" ").map((w) => w[0]).join("").slice(0, 2).toUpperCase();
|
|
290
|
+
const styles = {
|
|
291
|
+
card: {
|
|
292
|
+
width: "100%",
|
|
293
|
+
maxWidth: s.width,
|
|
294
|
+
boxSizing: "border-box",
|
|
295
|
+
padding: s.padding,
|
|
296
|
+
textAlign: "center",
|
|
297
|
+
background: bgColor,
|
|
298
|
+
color: textColor,
|
|
299
|
+
border: `1px solid ${borderColor}`,
|
|
300
|
+
borderRadius,
|
|
301
|
+
fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
|
|
302
|
+
boxShadow: hovered ? "0 12px 28px rgba(0, 0, 0, 0.12)" : "0 1px 3px rgba(0, 0, 0, 0.08)",
|
|
303
|
+
transform: hovered && hoverLift ? "translateY(-4px)" : "translateY(0)",
|
|
304
|
+
transition: "transform 0.2s ease, box-shadow 0.2s ease"
|
|
305
|
+
},
|
|
306
|
+
avatar: {
|
|
307
|
+
width: s.avatar,
|
|
308
|
+
height: s.avatar,
|
|
309
|
+
margin: "0 auto",
|
|
310
|
+
display: "flex",
|
|
311
|
+
alignItems: "center",
|
|
312
|
+
justifyContent: "center",
|
|
313
|
+
fontSize: s.avatar / 2.8,
|
|
314
|
+
fontWeight: 600,
|
|
315
|
+
color: "#ffffff",
|
|
316
|
+
background: accentColor,
|
|
317
|
+
borderRadius: "50%",
|
|
318
|
+
objectFit: "cover",
|
|
319
|
+
border: `3px solid ${bgColor}`,
|
|
320
|
+
boxShadow: `0 0 0 2px ${accentColor}`
|
|
321
|
+
},
|
|
322
|
+
name: { margin: "14px 0 0", fontSize: s.name, fontWeight: 600 },
|
|
323
|
+
role: {
|
|
324
|
+
margin: "4px 0 0",
|
|
325
|
+
fontSize: s.text,
|
|
326
|
+
fontWeight: 500,
|
|
327
|
+
color: accentColor
|
|
328
|
+
},
|
|
329
|
+
bio: {
|
|
330
|
+
margin: "10px 0 0",
|
|
331
|
+
fontSize: s.text,
|
|
332
|
+
lineHeight: 1.6,
|
|
333
|
+
color: mutedColor
|
|
334
|
+
},
|
|
335
|
+
stats: {
|
|
336
|
+
display: "flex",
|
|
337
|
+
justifyContent: "space-around",
|
|
338
|
+
margin: "18px 0 0",
|
|
339
|
+
padding: "14px 0",
|
|
340
|
+
borderTop: `1px solid ${borderColor}`,
|
|
341
|
+
borderBottom: `1px solid ${borderColor}`
|
|
342
|
+
},
|
|
343
|
+
statValue: { display: "block", fontSize: s.name - 4, fontWeight: 600 },
|
|
344
|
+
statLabel: {
|
|
345
|
+
display: "block",
|
|
346
|
+
marginTop: 2,
|
|
347
|
+
fontSize: s.text - 2,
|
|
348
|
+
color: mutedColor
|
|
349
|
+
},
|
|
350
|
+
button: {
|
|
351
|
+
width: "100%",
|
|
352
|
+
marginTop: 18,
|
|
353
|
+
padding: "10px 16px",
|
|
354
|
+
fontSize: s.text,
|
|
355
|
+
fontWeight: 500,
|
|
356
|
+
color: following ? accentColor : "#ffffff",
|
|
357
|
+
background: following ? btnHovered ? `${accentColor}14` : "transparent" : accentColor,
|
|
358
|
+
border: `1px solid ${accentColor}`,
|
|
359
|
+
borderRadius: Math.max(borderRadius - 6, 6),
|
|
360
|
+
filter: !following && btnHovered ? "brightness(0.9)" : "none",
|
|
361
|
+
cursor: "pointer",
|
|
362
|
+
transition: "background 0.15s ease, filter 0.15s ease, color 0.15s ease"
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
return /* @__PURE__ */ import_react3.default.createElement(
|
|
366
|
+
"div",
|
|
367
|
+
{
|
|
368
|
+
style: styles.card,
|
|
369
|
+
onMouseEnter: () => setHovered(true),
|
|
370
|
+
onMouseLeave: () => setHovered(false)
|
|
371
|
+
},
|
|
372
|
+
avatar ? /* @__PURE__ */ import_react3.default.createElement(
|
|
373
|
+
"img",
|
|
374
|
+
{
|
|
375
|
+
src: avatar,
|
|
376
|
+
alt: name,
|
|
377
|
+
style: { ...styles.avatar, display: "block" }
|
|
378
|
+
}
|
|
379
|
+
) : /* @__PURE__ */ import_react3.default.createElement("div", { style: styles.avatar }, initials),
|
|
380
|
+
/* @__PURE__ */ import_react3.default.createElement("h3", { style: styles.name }, name),
|
|
381
|
+
/* @__PURE__ */ import_react3.default.createElement("p", { style: styles.role }, role),
|
|
382
|
+
bio && /* @__PURE__ */ import_react3.default.createElement("p", { style: styles.bio }, bio),
|
|
383
|
+
stats.length > 0 && /* @__PURE__ */ import_react3.default.createElement("div", { style: styles.stats }, stats.map((stat) => /* @__PURE__ */ import_react3.default.createElement("div", { key: stat.label }, /* @__PURE__ */ import_react3.default.createElement("span", { style: styles.statValue }, stat.value), /* @__PURE__ */ import_react3.default.createElement("span", { style: styles.statLabel }, stat.label)))),
|
|
384
|
+
/* @__PURE__ */ import_react3.default.createElement(
|
|
385
|
+
"button",
|
|
386
|
+
{
|
|
387
|
+
type: "button",
|
|
388
|
+
style: styles.button,
|
|
389
|
+
onMouseEnter: () => setBtnHovered(true),
|
|
390
|
+
onMouseLeave: () => setBtnHovered(false),
|
|
391
|
+
onClick: () => {
|
|
392
|
+
setFollowing(!following);
|
|
393
|
+
onFollowChange(!following);
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
following ? followingText : followText
|
|
397
|
+
)
|
|
398
|
+
);
|
|
399
|
+
};
|
|
252
400
|
// Annotate the CommonJS export names for ESM import in node:
|
|
253
401
|
0 && (module.exports = {
|
|
254
402
|
Button,
|
|
255
|
-
Card
|
|
403
|
+
Card,
|
|
404
|
+
ProfileCard
|
|
256
405
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -213,7 +213,155 @@ var Card = ({
|
|
|
213
213
|
footer && /* @__PURE__ */ React2.createElement("div", { style: styles.footer }, footer)
|
|
214
214
|
);
|
|
215
215
|
};
|
|
216
|
+
|
|
217
|
+
// src/components/ProfileCard/ProfileCard.jsx
|
|
218
|
+
import React3, { useState as useState3 } from "react";
|
|
219
|
+
var SIZES3 = {
|
|
220
|
+
sm: { width: 240, avatar: 64, name: 16, text: 13, padding: 16 },
|
|
221
|
+
md: { width: 300, avatar: 88, name: 20, text: 14, padding: 24 },
|
|
222
|
+
lg: { width: 380, avatar: 112, name: 24, text: 16, padding: 32 }
|
|
223
|
+
};
|
|
224
|
+
var ProfileCard = ({
|
|
225
|
+
name = "John Doe",
|
|
226
|
+
role = "Frontend Developer",
|
|
227
|
+
bio = "Building clean and fast user interfaces with React.",
|
|
228
|
+
avatar = "",
|
|
229
|
+
stats = [
|
|
230
|
+
{ label: "Posts", value: 128 },
|
|
231
|
+
{ label: "Followers", value: "2.4k" },
|
|
232
|
+
{ label: "Following", value: 180 }
|
|
233
|
+
],
|
|
234
|
+
followText = "Follow",
|
|
235
|
+
followingText = "Following",
|
|
236
|
+
size = "md",
|
|
237
|
+
bgColor = "#ffffff",
|
|
238
|
+
textColor = "#1f2937",
|
|
239
|
+
mutedColor = "#6b7280",
|
|
240
|
+
accentColor = "#2563eb",
|
|
241
|
+
borderColor = "#e5e7eb",
|
|
242
|
+
borderRadius = 16,
|
|
243
|
+
hoverLift = true,
|
|
244
|
+
defaultFollowing = false,
|
|
245
|
+
onFollowChange = () => {
|
|
246
|
+
}
|
|
247
|
+
}) => {
|
|
248
|
+
const [hovered, setHovered] = useState3(false);
|
|
249
|
+
const [btnHovered, setBtnHovered] = useState3(false);
|
|
250
|
+
const [following, setFollowing] = useState3(defaultFollowing);
|
|
251
|
+
const s = SIZES3[size] || SIZES3.md;
|
|
252
|
+
const initials = name.split(" ").map((w) => w[0]).join("").slice(0, 2).toUpperCase();
|
|
253
|
+
const styles = {
|
|
254
|
+
card: {
|
|
255
|
+
width: "100%",
|
|
256
|
+
maxWidth: s.width,
|
|
257
|
+
boxSizing: "border-box",
|
|
258
|
+
padding: s.padding,
|
|
259
|
+
textAlign: "center",
|
|
260
|
+
background: bgColor,
|
|
261
|
+
color: textColor,
|
|
262
|
+
border: `1px solid ${borderColor}`,
|
|
263
|
+
borderRadius,
|
|
264
|
+
fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif",
|
|
265
|
+
boxShadow: hovered ? "0 12px 28px rgba(0, 0, 0, 0.12)" : "0 1px 3px rgba(0, 0, 0, 0.08)",
|
|
266
|
+
transform: hovered && hoverLift ? "translateY(-4px)" : "translateY(0)",
|
|
267
|
+
transition: "transform 0.2s ease, box-shadow 0.2s ease"
|
|
268
|
+
},
|
|
269
|
+
avatar: {
|
|
270
|
+
width: s.avatar,
|
|
271
|
+
height: s.avatar,
|
|
272
|
+
margin: "0 auto",
|
|
273
|
+
display: "flex",
|
|
274
|
+
alignItems: "center",
|
|
275
|
+
justifyContent: "center",
|
|
276
|
+
fontSize: s.avatar / 2.8,
|
|
277
|
+
fontWeight: 600,
|
|
278
|
+
color: "#ffffff",
|
|
279
|
+
background: accentColor,
|
|
280
|
+
borderRadius: "50%",
|
|
281
|
+
objectFit: "cover",
|
|
282
|
+
border: `3px solid ${bgColor}`,
|
|
283
|
+
boxShadow: `0 0 0 2px ${accentColor}`
|
|
284
|
+
},
|
|
285
|
+
name: { margin: "14px 0 0", fontSize: s.name, fontWeight: 600 },
|
|
286
|
+
role: {
|
|
287
|
+
margin: "4px 0 0",
|
|
288
|
+
fontSize: s.text,
|
|
289
|
+
fontWeight: 500,
|
|
290
|
+
color: accentColor
|
|
291
|
+
},
|
|
292
|
+
bio: {
|
|
293
|
+
margin: "10px 0 0",
|
|
294
|
+
fontSize: s.text,
|
|
295
|
+
lineHeight: 1.6,
|
|
296
|
+
color: mutedColor
|
|
297
|
+
},
|
|
298
|
+
stats: {
|
|
299
|
+
display: "flex",
|
|
300
|
+
justifyContent: "space-around",
|
|
301
|
+
margin: "18px 0 0",
|
|
302
|
+
padding: "14px 0",
|
|
303
|
+
borderTop: `1px solid ${borderColor}`,
|
|
304
|
+
borderBottom: `1px solid ${borderColor}`
|
|
305
|
+
},
|
|
306
|
+
statValue: { display: "block", fontSize: s.name - 4, fontWeight: 600 },
|
|
307
|
+
statLabel: {
|
|
308
|
+
display: "block",
|
|
309
|
+
marginTop: 2,
|
|
310
|
+
fontSize: s.text - 2,
|
|
311
|
+
color: mutedColor
|
|
312
|
+
},
|
|
313
|
+
button: {
|
|
314
|
+
width: "100%",
|
|
315
|
+
marginTop: 18,
|
|
316
|
+
padding: "10px 16px",
|
|
317
|
+
fontSize: s.text,
|
|
318
|
+
fontWeight: 500,
|
|
319
|
+
color: following ? accentColor : "#ffffff",
|
|
320
|
+
background: following ? btnHovered ? `${accentColor}14` : "transparent" : accentColor,
|
|
321
|
+
border: `1px solid ${accentColor}`,
|
|
322
|
+
borderRadius: Math.max(borderRadius - 6, 6),
|
|
323
|
+
filter: !following && btnHovered ? "brightness(0.9)" : "none",
|
|
324
|
+
cursor: "pointer",
|
|
325
|
+
transition: "background 0.15s ease, filter 0.15s ease, color 0.15s ease"
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
return /* @__PURE__ */ React3.createElement(
|
|
329
|
+
"div",
|
|
330
|
+
{
|
|
331
|
+
style: styles.card,
|
|
332
|
+
onMouseEnter: () => setHovered(true),
|
|
333
|
+
onMouseLeave: () => setHovered(false)
|
|
334
|
+
},
|
|
335
|
+
avatar ? /* @__PURE__ */ React3.createElement(
|
|
336
|
+
"img",
|
|
337
|
+
{
|
|
338
|
+
src: avatar,
|
|
339
|
+
alt: name,
|
|
340
|
+
style: { ...styles.avatar, display: "block" }
|
|
341
|
+
}
|
|
342
|
+
) : /* @__PURE__ */ React3.createElement("div", { style: styles.avatar }, initials),
|
|
343
|
+
/* @__PURE__ */ React3.createElement("h3", { style: styles.name }, name),
|
|
344
|
+
/* @__PURE__ */ React3.createElement("p", { style: styles.role }, role),
|
|
345
|
+
bio && /* @__PURE__ */ React3.createElement("p", { style: styles.bio }, bio),
|
|
346
|
+
stats.length > 0 && /* @__PURE__ */ React3.createElement("div", { style: styles.stats }, stats.map((stat) => /* @__PURE__ */ React3.createElement("div", { key: stat.label }, /* @__PURE__ */ React3.createElement("span", { style: styles.statValue }, stat.value), /* @__PURE__ */ React3.createElement("span", { style: styles.statLabel }, stat.label)))),
|
|
347
|
+
/* @__PURE__ */ React3.createElement(
|
|
348
|
+
"button",
|
|
349
|
+
{
|
|
350
|
+
type: "button",
|
|
351
|
+
style: styles.button,
|
|
352
|
+
onMouseEnter: () => setBtnHovered(true),
|
|
353
|
+
onMouseLeave: () => setBtnHovered(false),
|
|
354
|
+
onClick: () => {
|
|
355
|
+
setFollowing(!following);
|
|
356
|
+
onFollowChange(!following);
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
following ? followingText : followText
|
|
360
|
+
)
|
|
361
|
+
);
|
|
362
|
+
};
|
|
216
363
|
export {
|
|
217
364
|
Button,
|
|
218
|
-
Card
|
|
365
|
+
Card,
|
|
366
|
+
ProfileCard
|
|
219
367
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ksm-ai-ui-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "KSM-AI UI React Component Library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -19,5 +19,8 @@
|
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"tsup": "^9.0.0",
|
|
21
21
|
"typescript": "^7.0.2"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"ksm-ai-ui-lib": "^1.0.0"
|
|
22
25
|
}
|
|
23
26
|
}
|