virtual-ui-lib 1.0.47 → 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 +84 -0
- package/dist/index.mjs +83 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ 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,
|
|
36
37
|
ResponsiveNavbar: () => ResponsiveNavbar,
|
|
@@ -530,10 +531,93 @@ var ResponsiveNavbar = ({
|
|
|
530
531
|
}
|
|
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))));
|
|
532
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
|
+
};
|
|
533
616
|
// Annotate the CommonJS export names for ESM import in node:
|
|
534
617
|
0 && (module.exports = {
|
|
535
618
|
CodeBlock,
|
|
536
619
|
CustomInputField,
|
|
620
|
+
FileUpload,
|
|
537
621
|
LoadingSpinner,
|
|
538
622
|
OtpInput,
|
|
539
623
|
ResponsiveNavbar,
|
package/dist/index.mjs
CHANGED
|
@@ -485,9 +485,92 @@ 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
|
+
};
|
|
488
570
|
export {
|
|
489
571
|
CodeBlock,
|
|
490
572
|
CustomInputField,
|
|
573
|
+
FileUpload,
|
|
491
574
|
LoadingSpinner,
|
|
492
575
|
OtpInput,
|
|
493
576
|
ResponsiveNavbar,
|