virtual-ui-lib 1.0.46 → 1.0.48

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,8 +31,10 @@ var index_exports = {};
31
31
  __export(index_exports, {
32
32
  CodeBlock: () => CodeBlock,
33
33
  CustomInputField: () => CustomInputField,
34
+ FileUpload: () => FileUpload,
34
35
  LoadingSpinner: () => LoadingSpinner,
35
36
  OtpInput: () => OtpInput,
37
+ ResponsiveNavbar: () => ResponsiveNavbar,
36
38
  SearchBar: () => SearchBar,
37
39
  SkeletonLoader: () => SkeletonLoader,
38
40
  SmartButton: () => SmartButton,
@@ -494,12 +496,131 @@ var SkeletonLoader = ({ width = "100%", height = "20px", bg = "#1e293b", accent
494
496
  }
495
497
  }`));
496
498
  };
499
+
500
+ // src/components/ResponsiveNavbar/ResponsiveNavbar.jsx
501
+ var import_react11 = __toESM(require("react"));
502
+ var ResponsiveNavbar = ({
503
+ logo = "Logo",
504
+ navItems = [],
505
+ bg = "#1e293b",
506
+ textColor = "#f1f5f9",
507
+ accent = "#7c3aed",
508
+ padding = "10px 20px",
509
+ radius = "8px",
510
+ placeholder = "Search...",
511
+ onNavItemClick = () => {
512
+ },
513
+ onSearchChange = () => {
514
+ },
515
+ profileAvatar = "https://via.placeholder.com/40"
516
+ }) => {
517
+ const [menuActive, setMenuActive] = (0, import_react11.useState)(false);
518
+ const [searchValue, setSearchValue] = (0, import_react11.useState)("");
519
+ const handleSearchChange = (e) => {
520
+ setSearchValue(e.target.value);
521
+ onSearchChange(e.target.value);
522
+ };
523
+ return /* @__PURE__ */ import_react11.default.createElement("nav", { style: { background: bg, color: textColor, padding, borderRadius: radius, display: "flex", justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ import_react11.default.createElement("div", { style: { display: "flex", alignItems: "center" } }, /* @__PURE__ */ import_react11.default.createElement("div", { style: { fontSize: "24px", fontWeight: "bold" } }, logo), /* @__PURE__ */ import_react11.default.createElement("div", { style: { display: "flex", marginLeft: "20px" } }, navItems.map((item, index) => /* @__PURE__ */ import_react11.default.createElement("div", { key: index, onClick: () => onNavItemClick(item), style: { margin: "0 10px", cursor: "pointer", color: item.active ? accent : textColor } }, item.label)))), /* @__PURE__ */ import_react11.default.createElement("div", { style: { display: "flex", alignItems: "center" } }, /* @__PURE__ */ import_react11.default.createElement(
524
+ "input",
525
+ {
526
+ type: "text",
527
+ value: searchValue,
528
+ placeholder,
529
+ onChange: handleSearchChange,
530
+ style: { background: "#0f172a", color: textColor, border: "none", borderRadius: radius, padding: "8px", marginRight: "20px" }
531
+ }
532
+ ), /* @__PURE__ */ import_react11.default.createElement("img", { src: profileAvatar, alt: "Profile", style: { borderRadius: "50%", width: "40px", height: "40px" } }), /* @__PURE__ */ import_react11.default.createElement("div", { onClick: () => setMenuActive(!menuActive), style: { cursor: "pointer", marginLeft: "20px" } }, "\u2630")), menuActive && /* @__PURE__ */ import_react11.default.createElement("div", { style: { position: "absolute", top: "60px", right: "20px", background: bg, borderRadius: radius, boxShadow: "0 4px 8px rgba(0,0,0,0.3)", zIndex: 1 } }, navItems.map((item, index) => /* @__PURE__ */ import_react11.default.createElement("div", { key: index, onClick: () => onNavItemClick(item), style: { padding: "10px", color: item.active ? accent : textColor } }, item.label))));
533
+ };
534
+
535
+ // src/components/FileUpload/FileUpload.jsx
536
+ var import_react12 = __toESM(require("react"));
537
+ var FileUpload = ({ bg = "#1e293b", textColor = "#f1f5f9", accent = "#7c3aed", radius = "12px", padding = "20px", placeholder = "Drag and drop files here or click to upload", onChange = () => {
538
+ } }) => {
539
+ const [file, setFile] = (0, import_react12.useState)(null);
540
+ const [progress, setProgress] = (0, import_react12.useState)(0);
541
+ const handleDrop = (event) => {
542
+ event.preventDefault();
543
+ const droppedFile = event.dataTransfer.files[0];
544
+ if (droppedFile) {
545
+ uploadFile(droppedFile);
546
+ }
547
+ };
548
+ const handleClick = () => {
549
+ document.getElementById("fileInput").click();
550
+ };
551
+ const handleFileChange = (event) => {
552
+ const selectedFile = event.target.files[0];
553
+ if (selectedFile) {
554
+ uploadFile(selectedFile);
555
+ }
556
+ };
557
+ const uploadFile = (selectedFile) => {
558
+ setFile(selectedFile);
559
+ const uploadProgress = setInterval(() => {
560
+ setProgress((prev) => {
561
+ if (prev >= 100) {
562
+ clearInterval(uploadProgress);
563
+ return 100;
564
+ }
565
+ return prev + 10;
566
+ });
567
+ }, 100);
568
+ onChange(selectedFile);
569
+ };
570
+ const handleRemove = () => {
571
+ setFile(null);
572
+ setProgress(0);
573
+ };
574
+ return /* @__PURE__ */ import_react12.default.createElement(
575
+ "div",
576
+ {
577
+ onDrop: handleDrop,
578
+ onDragOver: (e) => e.preventDefault(),
579
+ onClick: handleClick,
580
+ style: {
581
+ background: bg,
582
+ color: textColor,
583
+ border: `2px dashed ${accent}`,
584
+ borderRadius: radius,
585
+ padding,
586
+ textAlign: "center",
587
+ cursor: "pointer"
588
+ }
589
+ },
590
+ /* @__PURE__ */ import_react12.default.createElement(
591
+ "input",
592
+ {
593
+ id: "fileInput",
594
+ type: "file",
595
+ style: { display: "none" },
596
+ onChange: handleFileChange
597
+ }
598
+ ),
599
+ file ? /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement("p", null, file.name), /* @__PURE__ */ import_react12.default.createElement(
600
+ "button",
601
+ {
602
+ onClick: handleRemove,
603
+ style: {
604
+ background: accent,
605
+ color: "#fff",
606
+ border: "none",
607
+ borderRadius: radius,
608
+ padding: "8px 16px",
609
+ cursor: "pointer"
610
+ }
611
+ },
612
+ "Remove"
613
+ ), /* @__PURE__ */ import_react12.default.createElement("div", { style: { background: "#e2e8f0", borderRadius: radius, overflow: "hidden", marginTop: "10px" } }, /* @__PURE__ */ import_react12.default.createElement("div", { style: { width: `${progress}%`, background: accent, height: "8px" } }))) : /* @__PURE__ */ import_react12.default.createElement("p", null, placeholder)
614
+ );
615
+ };
497
616
  // Annotate the CommonJS export names for ESM import in node:
498
617
  0 && (module.exports = {
499
618
  CodeBlock,
500
619
  CustomInputField,
620
+ FileUpload,
501
621
  LoadingSpinner,
502
622
  OtpInput,
623
+ ResponsiveNavbar,
503
624
  SearchBar,
504
625
  SkeletonLoader,
505
626
  SmartButton,
package/dist/index.mjs CHANGED
@@ -450,11 +450,130 @@ var SkeletonLoader = ({ width = "100%", height = "20px", bg = "#1e293b", accent
450
450
  }
451
451
  }`));
452
452
  };
453
+
454
+ // src/components/ResponsiveNavbar/ResponsiveNavbar.jsx
455
+ import React11, { useState as useState8 } from "react";
456
+ var ResponsiveNavbar = ({
457
+ logo = "Logo",
458
+ navItems = [],
459
+ bg = "#1e293b",
460
+ textColor = "#f1f5f9",
461
+ accent = "#7c3aed",
462
+ padding = "10px 20px",
463
+ radius = "8px",
464
+ placeholder = "Search...",
465
+ onNavItemClick = () => {
466
+ },
467
+ onSearchChange = () => {
468
+ },
469
+ profileAvatar = "https://via.placeholder.com/40"
470
+ }) => {
471
+ const [menuActive, setMenuActive] = useState8(false);
472
+ const [searchValue, setSearchValue] = useState8("");
473
+ const handleSearchChange = (e) => {
474
+ setSearchValue(e.target.value);
475
+ onSearchChange(e.target.value);
476
+ };
477
+ return /* @__PURE__ */ React11.createElement("nav", { style: { background: bg, color: textColor, padding, borderRadius: radius, display: "flex", justifyContent: "space-between", alignItems: "center" } }, /* @__PURE__ */ React11.createElement("div", { style: { display: "flex", alignItems: "center" } }, /* @__PURE__ */ React11.createElement("div", { style: { fontSize: "24px", fontWeight: "bold" } }, logo), /* @__PURE__ */ React11.createElement("div", { style: { display: "flex", marginLeft: "20px" } }, navItems.map((item, index) => /* @__PURE__ */ React11.createElement("div", { key: index, onClick: () => onNavItemClick(item), style: { margin: "0 10px", cursor: "pointer", color: item.active ? accent : textColor } }, item.label)))), /* @__PURE__ */ React11.createElement("div", { style: { display: "flex", alignItems: "center" } }, /* @__PURE__ */ React11.createElement(
478
+ "input",
479
+ {
480
+ type: "text",
481
+ value: searchValue,
482
+ placeholder,
483
+ onChange: handleSearchChange,
484
+ style: { background: "#0f172a", color: textColor, border: "none", borderRadius: radius, padding: "8px", marginRight: "20px" }
485
+ }
486
+ ), /* @__PURE__ */ React11.createElement("img", { src: profileAvatar, alt: "Profile", style: { borderRadius: "50%", width: "40px", height: "40px" } }), /* @__PURE__ */ React11.createElement("div", { onClick: () => setMenuActive(!menuActive), style: { cursor: "pointer", marginLeft: "20px" } }, "\u2630")), menuActive && /* @__PURE__ */ React11.createElement("div", { style: { position: "absolute", top: "60px", right: "20px", background: bg, borderRadius: radius, boxShadow: "0 4px 8px rgba(0,0,0,0.3)", zIndex: 1 } }, navItems.map((item, index) => /* @__PURE__ */ React11.createElement("div", { key: index, onClick: () => onNavItemClick(item), style: { padding: "10px", color: item.active ? accent : textColor } }, item.label))));
487
+ };
488
+
489
+ // src/components/FileUpload/FileUpload.jsx
490
+ import React12, { useState as useState9 } from "react";
491
+ var FileUpload = ({ bg = "#1e293b", textColor = "#f1f5f9", accent = "#7c3aed", radius = "12px", padding = "20px", placeholder = "Drag and drop files here or click to upload", onChange = () => {
492
+ } }) => {
493
+ const [file, setFile] = useState9(null);
494
+ const [progress, setProgress] = useState9(0);
495
+ const handleDrop = (event) => {
496
+ event.preventDefault();
497
+ const droppedFile = event.dataTransfer.files[0];
498
+ if (droppedFile) {
499
+ uploadFile(droppedFile);
500
+ }
501
+ };
502
+ const handleClick = () => {
503
+ document.getElementById("fileInput").click();
504
+ };
505
+ const handleFileChange = (event) => {
506
+ const selectedFile = event.target.files[0];
507
+ if (selectedFile) {
508
+ uploadFile(selectedFile);
509
+ }
510
+ };
511
+ const uploadFile = (selectedFile) => {
512
+ setFile(selectedFile);
513
+ const uploadProgress = setInterval(() => {
514
+ setProgress((prev) => {
515
+ if (prev >= 100) {
516
+ clearInterval(uploadProgress);
517
+ return 100;
518
+ }
519
+ return prev + 10;
520
+ });
521
+ }, 100);
522
+ onChange(selectedFile);
523
+ };
524
+ const handleRemove = () => {
525
+ setFile(null);
526
+ setProgress(0);
527
+ };
528
+ return /* @__PURE__ */ React12.createElement(
529
+ "div",
530
+ {
531
+ onDrop: handleDrop,
532
+ onDragOver: (e) => e.preventDefault(),
533
+ onClick: handleClick,
534
+ style: {
535
+ background: bg,
536
+ color: textColor,
537
+ border: `2px dashed ${accent}`,
538
+ borderRadius: radius,
539
+ padding,
540
+ textAlign: "center",
541
+ cursor: "pointer"
542
+ }
543
+ },
544
+ /* @__PURE__ */ React12.createElement(
545
+ "input",
546
+ {
547
+ id: "fileInput",
548
+ type: "file",
549
+ style: { display: "none" },
550
+ onChange: handleFileChange
551
+ }
552
+ ),
553
+ file ? /* @__PURE__ */ React12.createElement("div", null, /* @__PURE__ */ React12.createElement("p", null, file.name), /* @__PURE__ */ React12.createElement(
554
+ "button",
555
+ {
556
+ onClick: handleRemove,
557
+ style: {
558
+ background: accent,
559
+ color: "#fff",
560
+ border: "none",
561
+ borderRadius: radius,
562
+ padding: "8px 16px",
563
+ cursor: "pointer"
564
+ }
565
+ },
566
+ "Remove"
567
+ ), /* @__PURE__ */ React12.createElement("div", { style: { background: "#e2e8f0", borderRadius: radius, overflow: "hidden", marginTop: "10px" } }, /* @__PURE__ */ React12.createElement("div", { style: { width: `${progress}%`, background: accent, height: "8px" } }))) : /* @__PURE__ */ React12.createElement("p", null, placeholder)
568
+ );
569
+ };
453
570
  export {
454
571
  CodeBlock,
455
572
  CustomInputField,
573
+ FileUpload,
456
574
  LoadingSpinner,
457
575
  OtpInput,
576
+ ResponsiveNavbar,
458
577
  SearchBar,
459
578
  SkeletonLoader,
460
579
  SmartButton,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virtual-ui-lib",
3
- "version": "1.0.46",
3
+ "version": "1.0.48",
4
4
  "description": "Virtual UI React Component Library",
5
5
  "author": "Ankush",
6
6
  "license": "ISC",