@juv/codego-react-ui 3.4.2 → 3.4.4

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.cjs CHANGED
@@ -6648,7 +6648,7 @@ function FieldRenderer({ field, value, onChange }) {
6648
6648
  case "rich-text":
6649
6649
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(RichTextEditor, { value: value ?? "", onChange: (v) => onChange(v) });
6650
6650
  case "file-upload":
6651
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FileUpload, { onChange: (files) => onChange(files) });
6651
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FileUpload, { onFilesChange: (files) => onChange(files), multiple: true });
6652
6652
  case "repeater": {
6653
6653
  const items = Array.isArray(value) ? value : [];
6654
6654
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
@@ -6747,7 +6747,27 @@ function EditModal({
6747
6747
  try {
6748
6748
  const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute("content");
6749
6749
  if (!csrfToken) throw new Error("[Table] CSRF token not found.");
6750
- await import_axios3.default.put(`${baseUrl}/${itemId}/update`, { ...form, csrfToken }, { headers: { "X-CSRF-Token": csrfToken } });
6750
+ const hasFiles = Object.values(form).some(
6751
+ (v) => Array.isArray(v) && v.length > 0 && v[0] instanceof File || v instanceof File
6752
+ );
6753
+ let body;
6754
+ if (hasFiles) {
6755
+ const fd = new FormData();
6756
+ fd.append("_method", "PUT");
6757
+ Object.entries(form).forEach(([k, v]) => {
6758
+ if (Array.isArray(v) && v[0] instanceof File) {
6759
+ v.forEach((f) => fd.append(k, f));
6760
+ } else if (v instanceof File) {
6761
+ fd.append(k, v);
6762
+ } else if (v !== null && v !== void 0) {
6763
+ fd.append(k, String(v));
6764
+ }
6765
+ });
6766
+ body = fd;
6767
+ } else {
6768
+ body = form;
6769
+ }
6770
+ await import_axios3.default.put(`${baseUrl}/${itemId}/update`, body, { headers: { "X-CSRF-Token": csrfToken } });
6751
6771
  const updated = { ...item, ...form };
6752
6772
  if (notif && (notif.type ?? "toast") === "notification") {
6753
6773
  setBanner(true);
@@ -63192,7 +63192,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
63192
63192
  ["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
63193
63193
  ["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }]
63194
63194
  ];
63195
- var File = createLucideIcon("file", __iconNode30);
63195
+ var File2 = createLucideIcon("file", __iconNode30);
63196
63196
 
63197
63197
  // node_modules/lucide-react/dist/esm/icons/flip-horizontal.js
63198
63198
  var __iconNode31 = [
@@ -69794,7 +69794,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
69794
69794
  case "rich-text":
69795
69795
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(RichTextEditor, { value: value ?? "", onChange: (v) => onChange(v) });
69796
69796
  case "file-upload":
69797
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FileUpload, { onChange: (files) => onChange(files) });
69797
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FileUpload, { onFilesChange: (files) => onChange(files), multiple: true });
69798
69798
  case "repeater": {
69799
69799
  const items = Array.isArray(value) ? value : [];
69800
69800
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
@@ -69893,7 +69893,27 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
69893
69893
  try {
69894
69894
  const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute("content");
69895
69895
  if (!csrfToken) throw new Error("[Table] CSRF token not found.");
69896
- await axios_default.put(`${baseUrl}/${itemId}/update`, { ...form, csrfToken }, { headers: { "X-CSRF-Token": csrfToken } });
69896
+ const hasFiles = Object.values(form).some(
69897
+ (v) => Array.isArray(v) && v.length > 0 && v[0] instanceof File || v instanceof File
69898
+ );
69899
+ let body;
69900
+ if (hasFiles) {
69901
+ const fd = new FormData();
69902
+ fd.append("_method", "PUT");
69903
+ Object.entries(form).forEach(([k, v]) => {
69904
+ if (Array.isArray(v) && v[0] instanceof File) {
69905
+ v.forEach((f) => fd.append(k, f));
69906
+ } else if (v instanceof File) {
69907
+ fd.append(k, v);
69908
+ } else if (v !== null && v !== void 0) {
69909
+ fd.append(k, String(v));
69910
+ }
69911
+ });
69912
+ body = fd;
69913
+ } else {
69914
+ body = form;
69915
+ }
69916
+ await axios_default.put(`${baseUrl}/${itemId}/update`, body, { headers: { "X-CSRF-Token": csrfToken } });
69897
69917
  const updated = { ...item, ...form };
69898
69918
  if (notif && (notif.type ?? "toast") === "notification") {
69899
69919
  setBanner(true);
@@ -75724,7 +75744,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
75724
75744
  const hasChildren = !!node.children?.length;
75725
75745
  const isExpanded = expanded.includes(node.id);
75726
75746
  const isSelected = selected.includes(node.id);
75727
- const defaultIcon = hasChildren ? isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(FolderOpen, { className: "h-4 w-4 text-warning" }) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Folder, { className: "h-4 w-4 text-warning" }) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(File, { className: "h-4 w-4 text-muted-foreground" });
75747
+ const defaultIcon = hasChildren ? isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(FolderOpen, { className: "h-4 w-4 text-warning" }) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Folder, { className: "h-4 w-4 text-warning" }) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(File2, { className: "h-4 w-4 text-muted-foreground" });
75728
75748
  return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { children: [
75729
75749
  /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
75730
75750
  "div",
package/dist/index.js CHANGED
@@ -6527,7 +6527,7 @@ function FieldRenderer({ field, value, onChange }) {
6527
6527
  case "rich-text":
6528
6528
  return /* @__PURE__ */ jsx32(RichTextEditor, { value: value ?? "", onChange: (v) => onChange(v) });
6529
6529
  case "file-upload":
6530
- return /* @__PURE__ */ jsx32(FileUpload, { onChange: (files) => onChange(files) });
6530
+ return /* @__PURE__ */ jsx32(FileUpload, { onFilesChange: (files) => onChange(files), multiple: true });
6531
6531
  case "repeater": {
6532
6532
  const items = Array.isArray(value) ? value : [];
6533
6533
  return /* @__PURE__ */ jsx32(
@@ -6626,7 +6626,27 @@ function EditModal({
6626
6626
  try {
6627
6627
  const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute("content");
6628
6628
  if (!csrfToken) throw new Error("[Table] CSRF token not found.");
6629
- await axios3.put(`${baseUrl}/${itemId}/update`, { ...form, csrfToken }, { headers: { "X-CSRF-Token": csrfToken } });
6629
+ const hasFiles = Object.values(form).some(
6630
+ (v) => Array.isArray(v) && v.length > 0 && v[0] instanceof File || v instanceof File
6631
+ );
6632
+ let body;
6633
+ if (hasFiles) {
6634
+ const fd = new FormData();
6635
+ fd.append("_method", "PUT");
6636
+ Object.entries(form).forEach(([k, v]) => {
6637
+ if (Array.isArray(v) && v[0] instanceof File) {
6638
+ v.forEach((f) => fd.append(k, f));
6639
+ } else if (v instanceof File) {
6640
+ fd.append(k, v);
6641
+ } else if (v !== null && v !== void 0) {
6642
+ fd.append(k, String(v));
6643
+ }
6644
+ });
6645
+ body = fd;
6646
+ } else {
6647
+ body = form;
6648
+ }
6649
+ await axios3.put(`${baseUrl}/${itemId}/update`, body, { headers: { "X-CSRF-Token": csrfToken } });
6630
6650
  const updated = { ...item, ...form };
6631
6651
  if (notif && (notif.type ?? "toast") === "notification") {
6632
6652
  setBanner(true);
@@ -12039,13 +12059,13 @@ function Timeline({ items, align = "left", className }) {
12039
12059
 
12040
12060
  // src/components/ui/tree-view.tsx
12041
12061
  import * as React48 from "react";
12042
- import { ChevronRight as ChevronRight11, Folder, FolderOpen, File } from "lucide-react";
12062
+ import { ChevronRight as ChevronRight11, Folder, FolderOpen, File as File2 } from "lucide-react";
12043
12063
  import { jsx as jsx60, jsxs as jsxs53 } from "react/jsx-runtime";
12044
12064
  function TreeNodeItem({ node, depth, selected, expanded, onToggleExpand, onSelect, multiple }) {
12045
12065
  const hasChildren = !!node.children?.length;
12046
12066
  const isExpanded = expanded.includes(node.id);
12047
12067
  const isSelected = selected.includes(node.id);
12048
- const defaultIcon = hasChildren ? isExpanded ? /* @__PURE__ */ jsx60(FolderOpen, { className: "h-4 w-4 text-warning" }) : /* @__PURE__ */ jsx60(Folder, { className: "h-4 w-4 text-warning" }) : /* @__PURE__ */ jsx60(File, { className: "h-4 w-4 text-muted-foreground" });
12068
+ const defaultIcon = hasChildren ? isExpanded ? /* @__PURE__ */ jsx60(FolderOpen, { className: "h-4 w-4 text-warning" }) : /* @__PURE__ */ jsx60(Folder, { className: "h-4 w-4 text-warning" }) : /* @__PURE__ */ jsx60(File2, { className: "h-4 w-4 text-muted-foreground" });
12049
12069
  return /* @__PURE__ */ jsxs53("div", { children: [
12050
12070
  /* @__PURE__ */ jsxs53(
12051
12071
  "div",
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "registry": "https://registry.npmjs.org/",
5
5
  "access": "public"
6
6
  },
7
- "version": "3.4.2",
7
+ "version": "3.4.4",
8
8
  "description": "Reusable React UI components",
9
9
  "license": "MIT",
10
10
  "main": "dist/index.js",