virtual-ui-lib 1.0.47 → 1.0.49
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 +92 -0
- package/dist/index.mjs +90 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,6 +31,8 @@ var index_exports = {};
|
|
|
31
31
|
__export(index_exports, {
|
|
32
32
|
CodeBlock: () => CodeBlock,
|
|
33
33
|
CustomInputField: () => CustomInputField,
|
|
34
|
+
FileUpload: () => FileUpload,
|
|
35
|
+
Loader: () => Loader,
|
|
34
36
|
LoadingSpinner: () => LoadingSpinner,
|
|
35
37
|
OtpInput: () => OtpInput,
|
|
36
38
|
ResponsiveNavbar: () => ResponsiveNavbar,
|
|
@@ -530,10 +532,100 @@ var ResponsiveNavbar = ({
|
|
|
530
532
|
}
|
|
531
533
|
), /* @__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))));
|
|
532
534
|
};
|
|
535
|
+
|
|
536
|
+
// src/components/FileUpload/FileUpload.jsx
|
|
537
|
+
var import_react12 = __toESM(require("react"));
|
|
538
|
+
var FileUpload = ({ bg = "#1e293b", textColor = "#f1f5f9", accent = "#7c3aed", radius = "12px", padding = "20px", placeholder = "Drag and drop files here or click to upload", onChange = () => {
|
|
539
|
+
} }) => {
|
|
540
|
+
const [file, setFile] = (0, import_react12.useState)(null);
|
|
541
|
+
const [progress, setProgress] = (0, import_react12.useState)(0);
|
|
542
|
+
const handleDrop = (event) => {
|
|
543
|
+
event.preventDefault();
|
|
544
|
+
const droppedFile = event.dataTransfer.files[0];
|
|
545
|
+
if (droppedFile) {
|
|
546
|
+
uploadFile(droppedFile);
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
const handleClick = () => {
|
|
550
|
+
document.getElementById("fileInput").click();
|
|
551
|
+
};
|
|
552
|
+
const handleFileChange = (event) => {
|
|
553
|
+
const selectedFile = event.target.files[0];
|
|
554
|
+
if (selectedFile) {
|
|
555
|
+
uploadFile(selectedFile);
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
const uploadFile = (selectedFile) => {
|
|
559
|
+
setFile(selectedFile);
|
|
560
|
+
const uploadProgress = setInterval(() => {
|
|
561
|
+
setProgress((prev) => {
|
|
562
|
+
if (prev >= 100) {
|
|
563
|
+
clearInterval(uploadProgress);
|
|
564
|
+
return 100;
|
|
565
|
+
}
|
|
566
|
+
return prev + 10;
|
|
567
|
+
});
|
|
568
|
+
}, 100);
|
|
569
|
+
onChange(selectedFile);
|
|
570
|
+
};
|
|
571
|
+
const handleRemove = () => {
|
|
572
|
+
setFile(null);
|
|
573
|
+
setProgress(0);
|
|
574
|
+
};
|
|
575
|
+
return /* @__PURE__ */ import_react12.default.createElement(
|
|
576
|
+
"div",
|
|
577
|
+
{
|
|
578
|
+
onDrop: handleDrop,
|
|
579
|
+
onDragOver: (e) => e.preventDefault(),
|
|
580
|
+
onClick: handleClick,
|
|
581
|
+
style: {
|
|
582
|
+
background: bg,
|
|
583
|
+
color: textColor,
|
|
584
|
+
border: `2px dashed ${accent}`,
|
|
585
|
+
borderRadius: radius,
|
|
586
|
+
padding,
|
|
587
|
+
textAlign: "center",
|
|
588
|
+
cursor: "pointer"
|
|
589
|
+
}
|
|
590
|
+
},
|
|
591
|
+
/* @__PURE__ */ import_react12.default.createElement(
|
|
592
|
+
"input",
|
|
593
|
+
{
|
|
594
|
+
id: "fileInput",
|
|
595
|
+
type: "file",
|
|
596
|
+
style: { display: "none" },
|
|
597
|
+
onChange: handleFileChange
|
|
598
|
+
}
|
|
599
|
+
),
|
|
600
|
+
file ? /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement("p", null, file.name), /* @__PURE__ */ import_react12.default.createElement(
|
|
601
|
+
"button",
|
|
602
|
+
{
|
|
603
|
+
onClick: handleRemove,
|
|
604
|
+
style: {
|
|
605
|
+
background: accent,
|
|
606
|
+
color: "#fff",
|
|
607
|
+
border: "none",
|
|
608
|
+
borderRadius: radius,
|
|
609
|
+
padding: "8px 16px",
|
|
610
|
+
cursor: "pointer"
|
|
611
|
+
}
|
|
612
|
+
},
|
|
613
|
+
"Remove"
|
|
614
|
+
), /* @__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)
|
|
615
|
+
);
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
// src/components/Loader/Loader.jsx
|
|
619
|
+
var import_react13 = __toESM(require("react"));
|
|
620
|
+
var Loader = ({ bg = "#0f172a", accent = "#7c3aed", size = "40px", borderRadius = "8px" }) => {
|
|
621
|
+
return /* @__PURE__ */ import_react13.default.createElement("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", background: bg, height: size, width: size, borderRadius } }, /* @__PURE__ */ import_react13.default.createElement("div", { style: { border: `4px solid ${bg}`, borderTop: `4px solid ${accent}`, borderRadius: "50%", width: "100%", height: "100%", animation: "spin 1s linear infinite" } }));
|
|
622
|
+
};
|
|
533
623
|
// Annotate the CommonJS export names for ESM import in node:
|
|
534
624
|
0 && (module.exports = {
|
|
535
625
|
CodeBlock,
|
|
536
626
|
CustomInputField,
|
|
627
|
+
FileUpload,
|
|
628
|
+
Loader,
|
|
537
629
|
LoadingSpinner,
|
|
538
630
|
OtpInput,
|
|
539
631
|
ResponsiveNavbar,
|
package/dist/index.mjs
CHANGED
|
@@ -485,9 +485,99 @@ var ResponsiveNavbar = ({
|
|
|
485
485
|
}
|
|
486
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
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
|
+
};
|
|
570
|
+
|
|
571
|
+
// src/components/Loader/Loader.jsx
|
|
572
|
+
import React13 from "react";
|
|
573
|
+
var Loader = ({ bg = "#0f172a", accent = "#7c3aed", size = "40px", borderRadius = "8px" }) => {
|
|
574
|
+
return /* @__PURE__ */ React13.createElement("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", background: bg, height: size, width: size, borderRadius } }, /* @__PURE__ */ React13.createElement("div", { style: { border: `4px solid ${bg}`, borderTop: `4px solid ${accent}`, borderRadius: "50%", width: "100%", height: "100%", animation: "spin 1s linear infinite" } }));
|
|
575
|
+
};
|
|
488
576
|
export {
|
|
489
577
|
CodeBlock,
|
|
490
578
|
CustomInputField,
|
|
579
|
+
FileUpload,
|
|
580
|
+
Loader,
|
|
491
581
|
LoadingSpinner,
|
|
492
582
|
OtpInput,
|
|
493
583
|
ResponsiveNavbar,
|