@elqnt/react 2.0.5 → 2.0.7
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/components/index.js +15 -40
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +10 -35
- package/dist/components/index.mjs.map +1 -1
- package/dist/index.js +15 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -35
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -5478,39 +5478,14 @@ function SchemaField(props) {
|
|
|
5478
5478
|
] });
|
|
5479
5479
|
}
|
|
5480
5480
|
|
|
5481
|
-
// ../docs/dist/index.mjs
|
|
5482
|
-
var import_lucide_react14 = require("lucide-react");
|
|
5483
|
-
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
5484
|
-
var getFileIcon2 = (fileName) => {
|
|
5485
|
-
const extensionMatch = fileName.match(/\.([^.]+)$/);
|
|
5486
|
-
const extension = extensionMatch ? extensionMatch[1].toLowerCase() : null;
|
|
5487
|
-
if (!extension) return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react14.File, { className: "w-8 h-8 text-gray-500" });
|
|
5488
|
-
switch (extension) {
|
|
5489
|
-
case "pdf":
|
|
5490
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react14.File, { className: "w-8 h-8 text-red-500" });
|
|
5491
|
-
case "doc":
|
|
5492
|
-
case "docx":
|
|
5493
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react14.FileText, { className: "w-8 h-8 text-blue-500" });
|
|
5494
|
-
case "xls":
|
|
5495
|
-
case "xlsx":
|
|
5496
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react14.FileSpreadsheet, { className: "w-8 h-8 text-green-500" });
|
|
5497
|
-
default:
|
|
5498
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react14.File, { className: "w-8 h-8 text-gray-500" });
|
|
5499
|
-
}
|
|
5500
|
-
};
|
|
5501
|
-
var getFileName2 = (url) => {
|
|
5502
|
-
const fileName = decodeURIComponent(url.split("/").pop() ?? "");
|
|
5503
|
-
const cleanFileName = fileName.replace(/%28(\d+)%29/g, "($1)").replace(/[^\w\s().-]/g, "").replace(/\s+/g, "_").replace(/-\d+(?=\.pdf)/g, "");
|
|
5504
|
-
return cleanFileName;
|
|
5505
|
-
};
|
|
5506
|
-
|
|
5507
5481
|
// components/upload/upload-widget-v2.tsx
|
|
5508
|
-
var
|
|
5482
|
+
var import_docs = require("@elqnt/docs");
|
|
5483
|
+
var import_lucide_react14 = require("lucide-react");
|
|
5509
5484
|
var import_react14 = require("react");
|
|
5510
5485
|
var import_react_dropzone2 = require("react-dropzone");
|
|
5511
5486
|
var import_sonner2 = require("sonner");
|
|
5512
5487
|
var import_upload_actions = require("./upload/upload-actions");
|
|
5513
|
-
var
|
|
5488
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
5514
5489
|
function UploadWidgetV2({
|
|
5515
5490
|
accept,
|
|
5516
5491
|
maxSize,
|
|
@@ -5568,7 +5543,7 @@ function UploadWidgetV2({
|
|
|
5568
5543
|
maxSize,
|
|
5569
5544
|
maxFiles
|
|
5570
5545
|
});
|
|
5571
|
-
return /* @__PURE__ */ (0,
|
|
5546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
5572
5547
|
"div",
|
|
5573
5548
|
{
|
|
5574
5549
|
...getRootProps(),
|
|
@@ -5577,12 +5552,12 @@ function UploadWidgetV2({
|
|
|
5577
5552
|
className
|
|
5578
5553
|
),
|
|
5579
5554
|
children: [
|
|
5580
|
-
isUploading && /* @__PURE__ */ (0,
|
|
5581
|
-
/* @__PURE__ */ (0,
|
|
5582
|
-
isDragActive ? /* @__PURE__ */ (0,
|
|
5583
|
-
/* @__PURE__ */ (0,
|
|
5584
|
-
/* @__PURE__ */ (0,
|
|
5585
|
-
/* @__PURE__ */ (0,
|
|
5555
|
+
isUploading && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "absolute top-3 right-3", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react14.Loader2, { className: "animate-spin h-6 w-6 text-primary" }) }),
|
|
5556
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("input", { ...getInputProps() }),
|
|
5557
|
+
isDragActive ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("p", { children: "Drop the files here ..." }) : /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { children: [
|
|
5558
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react14.UploadCloud, { className: "mx-auto h-12 w-12 text-gray-400" }),
|
|
5559
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("p", { children: "Drag n drop some files here, or click to select files" }),
|
|
5560
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("p", { className: "text-sm text-gray-500", children: [
|
|
5586
5561
|
"Only ",
|
|
5587
5562
|
acceptedTypes,
|
|
5588
5563
|
" files up to ",
|
|
@@ -5590,11 +5565,11 @@ function UploadWidgetV2({
|
|
|
5590
5565
|
"MB are accepted"
|
|
5591
5566
|
] })
|
|
5592
5567
|
] }),
|
|
5593
|
-
!hideUploadedFiles && fileUrls.length > 0 && /* @__PURE__ */ (0,
|
|
5594
|
-
const fileName =
|
|
5595
|
-
return /* @__PURE__ */ (0,
|
|
5596
|
-
/* @__PURE__ */ (0,
|
|
5597
|
-
/* @__PURE__ */ (0,
|
|
5568
|
+
!hideUploadedFiles && fileUrls.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "mt-4 border-t border-gray-300 pt-4", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("ul", { className: "flex flex-wrap gap-2", children: fileUrls.map((url, i) => {
|
|
5569
|
+
const fileName = (0, import_docs.getFileName)(url);
|
|
5570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("li", { className: "flex items-center space-x-2 text-sm", children: [
|
|
5571
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { children: (0, import_docs.getFileIcon)(fileName) }),
|
|
5572
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { children: fileName })
|
|
5598
5573
|
] }, i);
|
|
5599
5574
|
}) }) })
|
|
5600
5575
|
]
|