omui-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 +180 -2
- package/dist/index.mjs +178 -1
- package/package.json +4 -2
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
|
|
|
@@ -304,8 +305,185 @@ var Card = ({
|
|
|
304
305
|
/* @__PURE__ */ import_react2.default.createElement("div", { style: contentStyles }, /* @__PURE__ */ import_react2.default.createElement("div", { style: titleStyles }, title), /* @__PURE__ */ import_react2.default.createElement("div", { style: textStyles }, description))
|
|
305
306
|
);
|
|
306
307
|
};
|
|
308
|
+
|
|
309
|
+
// src/components/ProfileCard/ProfileCard.jsx
|
|
310
|
+
var import_react3 = __toESM(require("react"));
|
|
311
|
+
var ProfileCard = ({
|
|
312
|
+
name = "John Doe",
|
|
313
|
+
role = "Frontend Developer",
|
|
314
|
+
bio = "Passionate developer who loves building clean UI components.",
|
|
315
|
+
avatar = "https://via.placeholder.com/150",
|
|
316
|
+
variant = "elevated",
|
|
317
|
+
// elevated | outlined | flat
|
|
318
|
+
size = "md",
|
|
319
|
+
// sm | md | lg
|
|
320
|
+
palette = "primary",
|
|
321
|
+
// primary | secondary | danger | success
|
|
322
|
+
clickable = false,
|
|
323
|
+
hoverable = true,
|
|
324
|
+
fullWidth = false,
|
|
325
|
+
onFollow = () => {
|
|
326
|
+
},
|
|
327
|
+
onMessage = () => {
|
|
328
|
+
}
|
|
329
|
+
}) => {
|
|
330
|
+
const [isHovered, setIsHovered] = (0, import_react3.useState)(false);
|
|
331
|
+
const [isFollowing, setIsFollowing] = (0, import_react3.useState)(false);
|
|
332
|
+
const palettes = {
|
|
333
|
+
primary: {
|
|
334
|
+
border: "#4CAF50",
|
|
335
|
+
accent: "#4CAF50",
|
|
336
|
+
text: "#333",
|
|
337
|
+
subText: "#666",
|
|
338
|
+
bg: "#ffffff"
|
|
339
|
+
},
|
|
340
|
+
secondary: {
|
|
341
|
+
border: "#2196F3",
|
|
342
|
+
accent: "#2196F3",
|
|
343
|
+
text: "#333",
|
|
344
|
+
subText: "#666",
|
|
345
|
+
bg: "#ffffff"
|
|
346
|
+
},
|
|
347
|
+
danger: {
|
|
348
|
+
border: "#f44336",
|
|
349
|
+
accent: "#f44336",
|
|
350
|
+
text: "#333",
|
|
351
|
+
subText: "#666",
|
|
352
|
+
bg: "#ffffff"
|
|
353
|
+
},
|
|
354
|
+
success: {
|
|
355
|
+
border: "#00897b",
|
|
356
|
+
accent: "#00897b",
|
|
357
|
+
text: "#333",
|
|
358
|
+
subText: "#666",
|
|
359
|
+
bg: "#ffffff"
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
const sizes = {
|
|
363
|
+
sm: {
|
|
364
|
+
padding: "12px",
|
|
365
|
+
name: "14px",
|
|
366
|
+
role: "12px",
|
|
367
|
+
bio: "12px",
|
|
368
|
+
avatar: "60px"
|
|
369
|
+
},
|
|
370
|
+
md: {
|
|
371
|
+
padding: "16px",
|
|
372
|
+
name: "18px",
|
|
373
|
+
role: "14px",
|
|
374
|
+
bio: "13px",
|
|
375
|
+
avatar: "80px"
|
|
376
|
+
},
|
|
377
|
+
lg: {
|
|
378
|
+
padding: "20px",
|
|
379
|
+
name: "22px",
|
|
380
|
+
role: "16px",
|
|
381
|
+
bio: "14px",
|
|
382
|
+
avatar: "100px"
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
const selectedPalette = palettes[palette] || palettes.primary;
|
|
386
|
+
const selectedSize = sizes[size] || sizes.md;
|
|
387
|
+
const getVariantStyles = () => {
|
|
388
|
+
switch (variant) {
|
|
389
|
+
case "outlined":
|
|
390
|
+
return {
|
|
391
|
+
border: `2px solid ${selectedPalette.border}`,
|
|
392
|
+
boxShadow: "none"
|
|
393
|
+
};
|
|
394
|
+
case "flat":
|
|
395
|
+
return {
|
|
396
|
+
border: "none",
|
|
397
|
+
boxShadow: "none"
|
|
398
|
+
};
|
|
399
|
+
default:
|
|
400
|
+
return {
|
|
401
|
+
border: "none",
|
|
402
|
+
boxShadow: "0 6px 16px rgba(0,0,0,0.15)"
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
const hoverStyles = hoverable && isHovered ? {
|
|
407
|
+
transform: "translateY(-6px)",
|
|
408
|
+
boxShadow: "0 10px 22px rgba(0,0,0,0.2)"
|
|
409
|
+
} : {};
|
|
410
|
+
const containerStyles = {
|
|
411
|
+
width: fullWidth ? "100%" : "300px",
|
|
412
|
+
backgroundColor: selectedPalette.bg,
|
|
413
|
+
borderRadius: "14px",
|
|
414
|
+
textAlign: "center",
|
|
415
|
+
padding: selectedSize.padding,
|
|
416
|
+
cursor: clickable ? "pointer" : "default",
|
|
417
|
+
transition: "all 0.3s ease",
|
|
418
|
+
...getVariantStyles(),
|
|
419
|
+
...hoverStyles
|
|
420
|
+
};
|
|
421
|
+
const avatarStyles = {
|
|
422
|
+
width: selectedSize.avatar,
|
|
423
|
+
height: selectedSize.avatar,
|
|
424
|
+
borderRadius: "50%",
|
|
425
|
+
objectFit: "cover",
|
|
426
|
+
marginBottom: "12px",
|
|
427
|
+
border: `3px solid ${selectedPalette.border}`
|
|
428
|
+
};
|
|
429
|
+
const nameStyles = {
|
|
430
|
+
fontSize: selectedSize.name,
|
|
431
|
+
fontWeight: "600",
|
|
432
|
+
color: selectedPalette.text
|
|
433
|
+
};
|
|
434
|
+
const roleStyles = {
|
|
435
|
+
fontSize: selectedSize.role,
|
|
436
|
+
color: selectedPalette.accent,
|
|
437
|
+
marginBottom: "8px"
|
|
438
|
+
};
|
|
439
|
+
const bioStyles = {
|
|
440
|
+
fontSize: selectedSize.bio,
|
|
441
|
+
color: selectedPalette.subText,
|
|
442
|
+
marginBottom: "12px",
|
|
443
|
+
lineHeight: "1.4"
|
|
444
|
+
};
|
|
445
|
+
const buttonBase = {
|
|
446
|
+
padding: "8px 14px",
|
|
447
|
+
margin: "4px",
|
|
448
|
+
borderRadius: "6px",
|
|
449
|
+
border: "none",
|
|
450
|
+
cursor: "pointer",
|
|
451
|
+
fontSize: "12px",
|
|
452
|
+
fontWeight: "500",
|
|
453
|
+
transition: "0.2s"
|
|
454
|
+
};
|
|
455
|
+
const followBtn = {
|
|
456
|
+
...buttonBase,
|
|
457
|
+
backgroundColor: isFollowing ? "#ccc" : selectedPalette.accent,
|
|
458
|
+
color: isFollowing ? "#333" : "#fff"
|
|
459
|
+
};
|
|
460
|
+
const messageBtn = {
|
|
461
|
+
...buttonBase,
|
|
462
|
+
backgroundColor: "transparent",
|
|
463
|
+
border: `1px solid ${selectedPalette.accent}`,
|
|
464
|
+
color: selectedPalette.accent
|
|
465
|
+
};
|
|
466
|
+
const handleFollow = () => {
|
|
467
|
+
setIsFollowing(!isFollowing);
|
|
468
|
+
onFollow();
|
|
469
|
+
};
|
|
470
|
+
return /* @__PURE__ */ import_react3.default.createElement(
|
|
471
|
+
"div",
|
|
472
|
+
{
|
|
473
|
+
style: containerStyles,
|
|
474
|
+
onMouseEnter: () => setIsHovered(true),
|
|
475
|
+
onMouseLeave: () => setIsHovered(false)
|
|
476
|
+
},
|
|
477
|
+
/* @__PURE__ */ import_react3.default.createElement("img", { src: avatar, alt: "avatar", style: avatarStyles }),
|
|
478
|
+
/* @__PURE__ */ import_react3.default.createElement("div", { style: nameStyles }, name),
|
|
479
|
+
/* @__PURE__ */ import_react3.default.createElement("div", { style: roleStyles }, role),
|
|
480
|
+
/* @__PURE__ */ import_react3.default.createElement("div", { style: bioStyles }, bio),
|
|
481
|
+
/* @__PURE__ */ import_react3.default.createElement("div", null, /* @__PURE__ */ import_react3.default.createElement("button", { style: followBtn, onClick: handleFollow }, isFollowing ? "Following" : "Follow"), /* @__PURE__ */ import_react3.default.createElement("button", { style: messageBtn, onClick: onMessage }, "Message"))
|
|
482
|
+
);
|
|
483
|
+
};
|
|
307
484
|
// Annotate the CommonJS export names for ESM import in node:
|
|
308
485
|
0 && (module.exports = {
|
|
309
486
|
Button,
|
|
310
|
-
Card
|
|
487
|
+
Card,
|
|
488
|
+
ProfileCard
|
|
311
489
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -268,7 +268,184 @@ var Card = ({
|
|
|
268
268
|
/* @__PURE__ */ React2.createElement("div", { style: contentStyles }, /* @__PURE__ */ React2.createElement("div", { style: titleStyles }, title), /* @__PURE__ */ React2.createElement("div", { style: textStyles }, description))
|
|
269
269
|
);
|
|
270
270
|
};
|
|
271
|
+
|
|
272
|
+
// src/components/ProfileCard/ProfileCard.jsx
|
|
273
|
+
import React3, { useState as useState3 } from "react";
|
|
274
|
+
var ProfileCard = ({
|
|
275
|
+
name = "John Doe",
|
|
276
|
+
role = "Frontend Developer",
|
|
277
|
+
bio = "Passionate developer who loves building clean UI components.",
|
|
278
|
+
avatar = "https://via.placeholder.com/150",
|
|
279
|
+
variant = "elevated",
|
|
280
|
+
// elevated | outlined | flat
|
|
281
|
+
size = "md",
|
|
282
|
+
// sm | md | lg
|
|
283
|
+
palette = "primary",
|
|
284
|
+
// primary | secondary | danger | success
|
|
285
|
+
clickable = false,
|
|
286
|
+
hoverable = true,
|
|
287
|
+
fullWidth = false,
|
|
288
|
+
onFollow = () => {
|
|
289
|
+
},
|
|
290
|
+
onMessage = () => {
|
|
291
|
+
}
|
|
292
|
+
}) => {
|
|
293
|
+
const [isHovered, setIsHovered] = useState3(false);
|
|
294
|
+
const [isFollowing, setIsFollowing] = useState3(false);
|
|
295
|
+
const palettes = {
|
|
296
|
+
primary: {
|
|
297
|
+
border: "#4CAF50",
|
|
298
|
+
accent: "#4CAF50",
|
|
299
|
+
text: "#333",
|
|
300
|
+
subText: "#666",
|
|
301
|
+
bg: "#ffffff"
|
|
302
|
+
},
|
|
303
|
+
secondary: {
|
|
304
|
+
border: "#2196F3",
|
|
305
|
+
accent: "#2196F3",
|
|
306
|
+
text: "#333",
|
|
307
|
+
subText: "#666",
|
|
308
|
+
bg: "#ffffff"
|
|
309
|
+
},
|
|
310
|
+
danger: {
|
|
311
|
+
border: "#f44336",
|
|
312
|
+
accent: "#f44336",
|
|
313
|
+
text: "#333",
|
|
314
|
+
subText: "#666",
|
|
315
|
+
bg: "#ffffff"
|
|
316
|
+
},
|
|
317
|
+
success: {
|
|
318
|
+
border: "#00897b",
|
|
319
|
+
accent: "#00897b",
|
|
320
|
+
text: "#333",
|
|
321
|
+
subText: "#666",
|
|
322
|
+
bg: "#ffffff"
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
const sizes = {
|
|
326
|
+
sm: {
|
|
327
|
+
padding: "12px",
|
|
328
|
+
name: "14px",
|
|
329
|
+
role: "12px",
|
|
330
|
+
bio: "12px",
|
|
331
|
+
avatar: "60px"
|
|
332
|
+
},
|
|
333
|
+
md: {
|
|
334
|
+
padding: "16px",
|
|
335
|
+
name: "18px",
|
|
336
|
+
role: "14px",
|
|
337
|
+
bio: "13px",
|
|
338
|
+
avatar: "80px"
|
|
339
|
+
},
|
|
340
|
+
lg: {
|
|
341
|
+
padding: "20px",
|
|
342
|
+
name: "22px",
|
|
343
|
+
role: "16px",
|
|
344
|
+
bio: "14px",
|
|
345
|
+
avatar: "100px"
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
const selectedPalette = palettes[palette] || palettes.primary;
|
|
349
|
+
const selectedSize = sizes[size] || sizes.md;
|
|
350
|
+
const getVariantStyles = () => {
|
|
351
|
+
switch (variant) {
|
|
352
|
+
case "outlined":
|
|
353
|
+
return {
|
|
354
|
+
border: `2px solid ${selectedPalette.border}`,
|
|
355
|
+
boxShadow: "none"
|
|
356
|
+
};
|
|
357
|
+
case "flat":
|
|
358
|
+
return {
|
|
359
|
+
border: "none",
|
|
360
|
+
boxShadow: "none"
|
|
361
|
+
};
|
|
362
|
+
default:
|
|
363
|
+
return {
|
|
364
|
+
border: "none",
|
|
365
|
+
boxShadow: "0 6px 16px rgba(0,0,0,0.15)"
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
const hoverStyles = hoverable && isHovered ? {
|
|
370
|
+
transform: "translateY(-6px)",
|
|
371
|
+
boxShadow: "0 10px 22px rgba(0,0,0,0.2)"
|
|
372
|
+
} : {};
|
|
373
|
+
const containerStyles = {
|
|
374
|
+
width: fullWidth ? "100%" : "300px",
|
|
375
|
+
backgroundColor: selectedPalette.bg,
|
|
376
|
+
borderRadius: "14px",
|
|
377
|
+
textAlign: "center",
|
|
378
|
+
padding: selectedSize.padding,
|
|
379
|
+
cursor: clickable ? "pointer" : "default",
|
|
380
|
+
transition: "all 0.3s ease",
|
|
381
|
+
...getVariantStyles(),
|
|
382
|
+
...hoverStyles
|
|
383
|
+
};
|
|
384
|
+
const avatarStyles = {
|
|
385
|
+
width: selectedSize.avatar,
|
|
386
|
+
height: selectedSize.avatar,
|
|
387
|
+
borderRadius: "50%",
|
|
388
|
+
objectFit: "cover",
|
|
389
|
+
marginBottom: "12px",
|
|
390
|
+
border: `3px solid ${selectedPalette.border}`
|
|
391
|
+
};
|
|
392
|
+
const nameStyles = {
|
|
393
|
+
fontSize: selectedSize.name,
|
|
394
|
+
fontWeight: "600",
|
|
395
|
+
color: selectedPalette.text
|
|
396
|
+
};
|
|
397
|
+
const roleStyles = {
|
|
398
|
+
fontSize: selectedSize.role,
|
|
399
|
+
color: selectedPalette.accent,
|
|
400
|
+
marginBottom: "8px"
|
|
401
|
+
};
|
|
402
|
+
const bioStyles = {
|
|
403
|
+
fontSize: selectedSize.bio,
|
|
404
|
+
color: selectedPalette.subText,
|
|
405
|
+
marginBottom: "12px",
|
|
406
|
+
lineHeight: "1.4"
|
|
407
|
+
};
|
|
408
|
+
const buttonBase = {
|
|
409
|
+
padding: "8px 14px",
|
|
410
|
+
margin: "4px",
|
|
411
|
+
borderRadius: "6px",
|
|
412
|
+
border: "none",
|
|
413
|
+
cursor: "pointer",
|
|
414
|
+
fontSize: "12px",
|
|
415
|
+
fontWeight: "500",
|
|
416
|
+
transition: "0.2s"
|
|
417
|
+
};
|
|
418
|
+
const followBtn = {
|
|
419
|
+
...buttonBase,
|
|
420
|
+
backgroundColor: isFollowing ? "#ccc" : selectedPalette.accent,
|
|
421
|
+
color: isFollowing ? "#333" : "#fff"
|
|
422
|
+
};
|
|
423
|
+
const messageBtn = {
|
|
424
|
+
...buttonBase,
|
|
425
|
+
backgroundColor: "transparent",
|
|
426
|
+
border: `1px solid ${selectedPalette.accent}`,
|
|
427
|
+
color: selectedPalette.accent
|
|
428
|
+
};
|
|
429
|
+
const handleFollow = () => {
|
|
430
|
+
setIsFollowing(!isFollowing);
|
|
431
|
+
onFollow();
|
|
432
|
+
};
|
|
433
|
+
return /* @__PURE__ */ React3.createElement(
|
|
434
|
+
"div",
|
|
435
|
+
{
|
|
436
|
+
style: containerStyles,
|
|
437
|
+
onMouseEnter: () => setIsHovered(true),
|
|
438
|
+
onMouseLeave: () => setIsHovered(false)
|
|
439
|
+
},
|
|
440
|
+
/* @__PURE__ */ React3.createElement("img", { src: avatar, alt: "avatar", style: avatarStyles }),
|
|
441
|
+
/* @__PURE__ */ React3.createElement("div", { style: nameStyles }, name),
|
|
442
|
+
/* @__PURE__ */ React3.createElement("div", { style: roleStyles }, role),
|
|
443
|
+
/* @__PURE__ */ React3.createElement("div", { style: bioStyles }, bio),
|
|
444
|
+
/* @__PURE__ */ React3.createElement("div", null, /* @__PURE__ */ React3.createElement("button", { style: followBtn, onClick: handleFollow }, isFollowing ? "Following" : "Follow"), /* @__PURE__ */ React3.createElement("button", { style: messageBtn, onClick: onMessage }, "Message"))
|
|
445
|
+
);
|
|
446
|
+
};
|
|
271
447
|
export {
|
|
272
448
|
Button,
|
|
273
|
-
Card
|
|
449
|
+
Card,
|
|
450
|
+
ProfileCard
|
|
274
451
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omui-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "omUI react component library",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "Om Mohanty",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.mjs",
|
|
9
|
-
"files": [
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
10
12
|
"scripts": {
|
|
11
13
|
"build": "tsup"
|
|
12
14
|
},
|