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