virtual-ui-library-uday 1.0.11 → 1.0.12

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 CHANGED
@@ -31,6 +31,7 @@ var index_exports = {};
31
31
  __export(index_exports, {
32
32
  Button: () => Button,
33
33
  Card: () => Card,
34
+ ProductCard: () => ProductCard,
34
35
  Profilecard: () => Profilecard
35
36
  });
36
37
  module.exports = __toCommonJS(index_exports);
@@ -421,9 +422,161 @@ var Button = ({
421
422
  label
422
423
  );
423
424
  };
425
+
426
+ // src/components/ProductCard/ProductCard.jsx
427
+ var import_react5 = __toESM(require("react"));
428
+ var alpha2 = (hex, op) => {
429
+ const r = parseInt(hex.slice(1, 3), 16), g = parseInt(hex.slice(3, 5), 16), b = parseInt(hex.slice(5, 7), 16);
430
+ return "rgba(" + r + "," + g + "," + b + "," + op + ")";
431
+ };
432
+ var ProductCard = ({
433
+ title = "Premium Headphones",
434
+ price = 199.99,
435
+ discount = 0,
436
+ rating = 4.5,
437
+ imageUrl = "https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=500",
438
+ accentColor = "#3b82f6"
439
+ }) => {
440
+ const [isHovered, setIsHovered] = (0, import_react5.useState)(false);
441
+ const [isLiked, setIsLiked] = (0, import_react5.useState)(false);
442
+ const formattedPrice = new Intl.NumberFormat("en-US", {
443
+ style: "currency",
444
+ currency: "USD"
445
+ }).format(price);
446
+ const discountPrice = discount > 0 ? new Intl.NumberFormat("en-US", {
447
+ style: "currency",
448
+ currency: "USD"
449
+ }).format(price * (1 - discount / 100)) : null;
450
+ return /* @__PURE__ */ import_react5.default.createElement(
451
+ "div",
452
+ {
453
+ style: {
454
+ width: "280px",
455
+ borderRadius: "12px",
456
+ overflow: "hidden",
457
+ boxShadow: "0 4px 6px " + alpha2("#000000", 0.1),
458
+ transition: "transform 0.3s ease, box-shadow 0.3s ease",
459
+ transform: isHovered ? "translateY(-4px)" : "translateY(0)",
460
+ boxShadow: isHovered ? "0 8px 15px " + alpha2("#000000", 0.15) : "0 4px 6px " + alpha2("#000000", 0.1),
461
+ backgroundColor: "#ffffff",
462
+ position: "relative"
463
+ },
464
+ onMouseEnter: () => setIsHovered(true),
465
+ onMouseLeave: () => setIsHovered(false)
466
+ },
467
+ /* @__PURE__ */ import_react5.default.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ import_react5.default.createElement(
468
+ "img",
469
+ {
470
+ src: imageUrl,
471
+ alt: title,
472
+ style: {
473
+ width: "100%",
474
+ height: "200px",
475
+ objectFit: "cover",
476
+ borderTopLeftRadius: "12px",
477
+ borderTopRightRadius: "12px"
478
+ }
479
+ }
480
+ ), /* @__PURE__ */ import_react5.default.createElement(
481
+ "button",
482
+ {
483
+ onClick: () => setIsLiked(!isLiked),
484
+ style: {
485
+ position: "absolute",
486
+ top: "12px",
487
+ right: "12px",
488
+ width: "36px",
489
+ height: "36px",
490
+ borderRadius: "50%",
491
+ backgroundColor: "#ffffff",
492
+ border: "none",
493
+ display: "flex",
494
+ alignItems: "center",
495
+ justifyContent: "center",
496
+ cursor: "pointer",
497
+ boxShadow: "0 2px 4px " + alpha2("#000000", 0.1)
498
+ }
499
+ },
500
+ /* @__PURE__ */ import_react5.default.createElement(
501
+ "svg",
502
+ {
503
+ width: "20",
504
+ height: "20",
505
+ viewBox: "0 0 24 24",
506
+ fill: isLiked ? accentColor : "none",
507
+ stroke: isLiked ? accentColor : "#6b7280",
508
+ strokeWidth: "2"
509
+ },
510
+ /* @__PURE__ */ import_react5.default.createElement("path", { d: "M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" })
511
+ )
512
+ ), discount > 0 && /* @__PURE__ */ import_react5.default.createElement("div", { style: {
513
+ position: "absolute",
514
+ top: "12px",
515
+ left: "12px",
516
+ backgroundColor: accentColor,
517
+ color: "white",
518
+ padding: "4px 8px",
519
+ borderRadius: "4px",
520
+ fontSize: "14px",
521
+ fontWeight: "bold"
522
+ } }, "-", discount, "%")),
523
+ /* @__PURE__ */ import_react5.default.createElement("div", { style: { padding: "16px" } }, /* @__PURE__ */ import_react5.default.createElement("h3", { style: {
524
+ margin: "0 0 8px 0",
525
+ fontSize: "18px",
526
+ fontWeight: "600",
527
+ color: "#1f2937",
528
+ whiteSpace: "nowrap",
529
+ overflow: "hidden",
530
+ textOverflow: "ellipsis"
531
+ } }, title), /* @__PURE__ */ import_react5.default.createElement("div", { style: { display: "flex", alignItems: "center", marginBottom: "12px" } }, [...Array(5)].map((_, i) => /* @__PURE__ */ import_react5.default.createElement(
532
+ "svg",
533
+ {
534
+ key: i,
535
+ width: "16",
536
+ height: "16",
537
+ viewBox: "0 0 24 24",
538
+ fill: i < Math.floor(rating) ? "#f59e0b" : i < rating ? "#f59e0b" : "#e5e7eb",
539
+ stroke: "#f59e0b",
540
+ strokeWidth: "1"
541
+ },
542
+ /* @__PURE__ */ import_react5.default.createElement("path", { d: "M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z" })
543
+ )), /* @__PURE__ */ import_react5.default.createElement("span", { style: {
544
+ marginLeft: "6px",
545
+ fontSize: "14px",
546
+ color: "#6b7280"
547
+ } }, rating.toFixed(1))), /* @__PURE__ */ import_react5.default.createElement("div", { style: { display: "flex", alignItems: "center", gap: "8px" } }, /* @__PURE__ */ import_react5.default.createElement("span", { style: {
548
+ fontSize: "20px",
549
+ fontWeight: "bold",
550
+ color: accentColor
551
+ } }, discountPrice || formattedPrice), discountPrice && /* @__PURE__ */ import_react5.default.createElement("span", { style: {
552
+ fontSize: "14px",
553
+ color: "#6b7280",
554
+ textDecoration: "line-through"
555
+ } }, formattedPrice)), /* @__PURE__ */ import_react5.default.createElement(
556
+ "button",
557
+ {
558
+ style: {
559
+ width: "100%",
560
+ marginTop: "16px",
561
+ padding: "10px 16px",
562
+ backgroundColor: isHovered ? alpha2(accentColor, 0.9) : accentColor,
563
+ color: "white",
564
+ border: "none",
565
+ borderRadius: "6px",
566
+ fontSize: "16px",
567
+ fontWeight: "600",
568
+ cursor: "pointer",
569
+ transition: "background-color 0.2s ease"
570
+ }
571
+ },
572
+ "Add to Cart"
573
+ ))
574
+ );
575
+ };
424
576
  // Annotate the CommonJS export names for ESM import in node:
425
577
  0 && (module.exports = {
426
578
  Button,
427
579
  Card,
580
+ ProductCard,
428
581
  Profilecard
429
582
  });
package/dist/index.mjs CHANGED
@@ -384,8 +384,160 @@ var Button = ({
384
384
  label
385
385
  );
386
386
  };
387
+
388
+ // src/components/ProductCard/ProductCard.jsx
389
+ import React4, { useState as useState3 } from "react";
390
+ var alpha2 = (hex, op) => {
391
+ const r = parseInt(hex.slice(1, 3), 16), g = parseInt(hex.slice(3, 5), 16), b = parseInt(hex.slice(5, 7), 16);
392
+ return "rgba(" + r + "," + g + "," + b + "," + op + ")";
393
+ };
394
+ var ProductCard = ({
395
+ title = "Premium Headphones",
396
+ price = 199.99,
397
+ discount = 0,
398
+ rating = 4.5,
399
+ imageUrl = "https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=500",
400
+ accentColor = "#3b82f6"
401
+ }) => {
402
+ const [isHovered, setIsHovered] = useState3(false);
403
+ const [isLiked, setIsLiked] = useState3(false);
404
+ const formattedPrice = new Intl.NumberFormat("en-US", {
405
+ style: "currency",
406
+ currency: "USD"
407
+ }).format(price);
408
+ const discountPrice = discount > 0 ? new Intl.NumberFormat("en-US", {
409
+ style: "currency",
410
+ currency: "USD"
411
+ }).format(price * (1 - discount / 100)) : null;
412
+ return /* @__PURE__ */ React4.createElement(
413
+ "div",
414
+ {
415
+ style: {
416
+ width: "280px",
417
+ borderRadius: "12px",
418
+ overflow: "hidden",
419
+ boxShadow: "0 4px 6px " + alpha2("#000000", 0.1),
420
+ transition: "transform 0.3s ease, box-shadow 0.3s ease",
421
+ transform: isHovered ? "translateY(-4px)" : "translateY(0)",
422
+ boxShadow: isHovered ? "0 8px 15px " + alpha2("#000000", 0.15) : "0 4px 6px " + alpha2("#000000", 0.1),
423
+ backgroundColor: "#ffffff",
424
+ position: "relative"
425
+ },
426
+ onMouseEnter: () => setIsHovered(true),
427
+ onMouseLeave: () => setIsHovered(false)
428
+ },
429
+ /* @__PURE__ */ React4.createElement("div", { style: { position: "relative" } }, /* @__PURE__ */ React4.createElement(
430
+ "img",
431
+ {
432
+ src: imageUrl,
433
+ alt: title,
434
+ style: {
435
+ width: "100%",
436
+ height: "200px",
437
+ objectFit: "cover",
438
+ borderTopLeftRadius: "12px",
439
+ borderTopRightRadius: "12px"
440
+ }
441
+ }
442
+ ), /* @__PURE__ */ React4.createElement(
443
+ "button",
444
+ {
445
+ onClick: () => setIsLiked(!isLiked),
446
+ style: {
447
+ position: "absolute",
448
+ top: "12px",
449
+ right: "12px",
450
+ width: "36px",
451
+ height: "36px",
452
+ borderRadius: "50%",
453
+ backgroundColor: "#ffffff",
454
+ border: "none",
455
+ display: "flex",
456
+ alignItems: "center",
457
+ justifyContent: "center",
458
+ cursor: "pointer",
459
+ boxShadow: "0 2px 4px " + alpha2("#000000", 0.1)
460
+ }
461
+ },
462
+ /* @__PURE__ */ React4.createElement(
463
+ "svg",
464
+ {
465
+ width: "20",
466
+ height: "20",
467
+ viewBox: "0 0 24 24",
468
+ fill: isLiked ? accentColor : "none",
469
+ stroke: isLiked ? accentColor : "#6b7280",
470
+ strokeWidth: "2"
471
+ },
472
+ /* @__PURE__ */ React4.createElement("path", { d: "M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" })
473
+ )
474
+ ), discount > 0 && /* @__PURE__ */ React4.createElement("div", { style: {
475
+ position: "absolute",
476
+ top: "12px",
477
+ left: "12px",
478
+ backgroundColor: accentColor,
479
+ color: "white",
480
+ padding: "4px 8px",
481
+ borderRadius: "4px",
482
+ fontSize: "14px",
483
+ fontWeight: "bold"
484
+ } }, "-", discount, "%")),
485
+ /* @__PURE__ */ React4.createElement("div", { style: { padding: "16px" } }, /* @__PURE__ */ React4.createElement("h3", { style: {
486
+ margin: "0 0 8px 0",
487
+ fontSize: "18px",
488
+ fontWeight: "600",
489
+ color: "#1f2937",
490
+ whiteSpace: "nowrap",
491
+ overflow: "hidden",
492
+ textOverflow: "ellipsis"
493
+ } }, title), /* @__PURE__ */ React4.createElement("div", { style: { display: "flex", alignItems: "center", marginBottom: "12px" } }, [...Array(5)].map((_, i) => /* @__PURE__ */ React4.createElement(
494
+ "svg",
495
+ {
496
+ key: i,
497
+ width: "16",
498
+ height: "16",
499
+ viewBox: "0 0 24 24",
500
+ fill: i < Math.floor(rating) ? "#f59e0b" : i < rating ? "#f59e0b" : "#e5e7eb",
501
+ stroke: "#f59e0b",
502
+ strokeWidth: "1"
503
+ },
504
+ /* @__PURE__ */ React4.createElement("path", { d: "M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z" })
505
+ )), /* @__PURE__ */ React4.createElement("span", { style: {
506
+ marginLeft: "6px",
507
+ fontSize: "14px",
508
+ color: "#6b7280"
509
+ } }, rating.toFixed(1))), /* @__PURE__ */ React4.createElement("div", { style: { display: "flex", alignItems: "center", gap: "8px" } }, /* @__PURE__ */ React4.createElement("span", { style: {
510
+ fontSize: "20px",
511
+ fontWeight: "bold",
512
+ color: accentColor
513
+ } }, discountPrice || formattedPrice), discountPrice && /* @__PURE__ */ React4.createElement("span", { style: {
514
+ fontSize: "14px",
515
+ color: "#6b7280",
516
+ textDecoration: "line-through"
517
+ } }, formattedPrice)), /* @__PURE__ */ React4.createElement(
518
+ "button",
519
+ {
520
+ style: {
521
+ width: "100%",
522
+ marginTop: "16px",
523
+ padding: "10px 16px",
524
+ backgroundColor: isHovered ? alpha2(accentColor, 0.9) : accentColor,
525
+ color: "white",
526
+ border: "none",
527
+ borderRadius: "6px",
528
+ fontSize: "16px",
529
+ fontWeight: "600",
530
+ cursor: "pointer",
531
+ transition: "background-color 0.2s ease"
532
+ }
533
+ },
534
+ "Add to Cart"
535
+ ))
536
+ );
537
+ };
387
538
  export {
388
539
  Button,
389
540
  Card,
541
+ ProductCard,
390
542
  Profilecard
391
543
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virtual-ui-library-uday",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "virtual ui react library",
5
5
  "license": "ISC",
6
6
  "author": "Uday",