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