@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
|
@@ -5408,39 +5408,14 @@ function SchemaField(props) {
|
|
|
5408
5408
|
] });
|
|
5409
5409
|
}
|
|
5410
5410
|
|
|
5411
|
-
// ../docs/dist/index.mjs
|
|
5412
|
-
import { File as File2, FileSpreadsheet as FileSpreadsheet2, FileText as FileText2 } from "lucide-react";
|
|
5413
|
-
import { jsx as jsx77 } from "react/jsx-runtime";
|
|
5414
|
-
var getFileIcon2 = (fileName) => {
|
|
5415
|
-
const extensionMatch = fileName.match(/\.([^.]+)$/);
|
|
5416
|
-
const extension = extensionMatch ? extensionMatch[1].toLowerCase() : null;
|
|
5417
|
-
if (!extension) return /* @__PURE__ */ jsx77(File2, { className: "w-8 h-8 text-gray-500" });
|
|
5418
|
-
switch (extension) {
|
|
5419
|
-
case "pdf":
|
|
5420
|
-
return /* @__PURE__ */ jsx77(File2, { className: "w-8 h-8 text-red-500" });
|
|
5421
|
-
case "doc":
|
|
5422
|
-
case "docx":
|
|
5423
|
-
return /* @__PURE__ */ jsx77(FileText2, { className: "w-8 h-8 text-blue-500" });
|
|
5424
|
-
case "xls":
|
|
5425
|
-
case "xlsx":
|
|
5426
|
-
return /* @__PURE__ */ jsx77(FileSpreadsheet2, { className: "w-8 h-8 text-green-500" });
|
|
5427
|
-
default:
|
|
5428
|
-
return /* @__PURE__ */ jsx77(File2, { className: "w-8 h-8 text-gray-500" });
|
|
5429
|
-
}
|
|
5430
|
-
};
|
|
5431
|
-
var getFileName2 = (url) => {
|
|
5432
|
-
const fileName = decodeURIComponent(url.split("/").pop() ?? "");
|
|
5433
|
-
const cleanFileName = fileName.replace(/%28(\d+)%29/g, "($1)").replace(/[^\w\s().-]/g, "").replace(/\s+/g, "_").replace(/-\d+(?=\.pdf)/g, "");
|
|
5434
|
-
return cleanFileName;
|
|
5435
|
-
};
|
|
5436
|
-
|
|
5437
5411
|
// components/upload/upload-widget-v2.tsx
|
|
5412
|
+
import { getFileIcon as getFileIcon2, getFileName as getFileName2 } from "@elqnt/docs";
|
|
5438
5413
|
import { Loader2 as Loader25, UploadCloud } from "lucide-react";
|
|
5439
5414
|
import { useState as useState11 } from "react";
|
|
5440
5415
|
import { useDropzone as useDropzone2 } from "react-dropzone";
|
|
5441
5416
|
import { toast as toast2 } from "sonner";
|
|
5442
5417
|
import { uploadFile, uploadToS3 } from "./upload/upload-actions";
|
|
5443
|
-
import { jsx as
|
|
5418
|
+
import { jsx as jsx77, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
5444
5419
|
function UploadWidgetV2({
|
|
5445
5420
|
accept,
|
|
5446
5421
|
maxSize,
|
|
@@ -5507,11 +5482,11 @@ function UploadWidgetV2({
|
|
|
5507
5482
|
className
|
|
5508
5483
|
),
|
|
5509
5484
|
children: [
|
|
5510
|
-
isUploading && /* @__PURE__ */
|
|
5511
|
-
/* @__PURE__ */
|
|
5512
|
-
isDragActive ? /* @__PURE__ */
|
|
5513
|
-
/* @__PURE__ */
|
|
5514
|
-
/* @__PURE__ */
|
|
5485
|
+
isUploading && /* @__PURE__ */ jsx77("div", { className: "absolute top-3 right-3", children: /* @__PURE__ */ jsx77(Loader25, { className: "animate-spin h-6 w-6 text-primary" }) }),
|
|
5486
|
+
/* @__PURE__ */ jsx77("input", { ...getInputProps() }),
|
|
5487
|
+
isDragActive ? /* @__PURE__ */ jsx77("p", { children: "Drop the files here ..." }) : /* @__PURE__ */ jsxs53("div", { children: [
|
|
5488
|
+
/* @__PURE__ */ jsx77(UploadCloud, { className: "mx-auto h-12 w-12 text-gray-400" }),
|
|
5489
|
+
/* @__PURE__ */ jsx77("p", { children: "Drag n drop some files here, or click to select files" }),
|
|
5515
5490
|
/* @__PURE__ */ jsxs53("p", { className: "text-sm text-gray-500", children: [
|
|
5516
5491
|
"Only ",
|
|
5517
5492
|
acceptedTypes,
|
|
@@ -5520,11 +5495,11 @@ function UploadWidgetV2({
|
|
|
5520
5495
|
"MB are accepted"
|
|
5521
5496
|
] })
|
|
5522
5497
|
] }),
|
|
5523
|
-
!hideUploadedFiles && fileUrls.length > 0 && /* @__PURE__ */
|
|
5498
|
+
!hideUploadedFiles && fileUrls.length > 0 && /* @__PURE__ */ jsx77("div", { className: "mt-4 border-t border-gray-300 pt-4", children: /* @__PURE__ */ jsx77("ul", { className: "flex flex-wrap gap-2", children: fileUrls.map((url, i) => {
|
|
5524
5499
|
const fileName = getFileName2(url);
|
|
5525
5500
|
return /* @__PURE__ */ jsxs53("li", { className: "flex items-center space-x-2 text-sm", children: [
|
|
5526
|
-
/* @__PURE__ */
|
|
5527
|
-
/* @__PURE__ */
|
|
5501
|
+
/* @__PURE__ */ jsx77("div", { children: getFileIcon2(fileName) }),
|
|
5502
|
+
/* @__PURE__ */ jsx77("span", { children: fileName })
|
|
5528
5503
|
] }, i);
|
|
5529
5504
|
}) }) })
|
|
5530
5505
|
]
|