@sparkstudio/storage-ui 1.0.21 → 1.0.22

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
@@ -295,7 +295,7 @@ var UploadDropzone = ({
295
295
  children
296
296
  }) => {
297
297
  const baseClass = "rounded-3 d-flex flex-column align-items-center justify-content-center";
298
- const stateClass = isDragging ? "bg-body-secondary" : "";
298
+ const stateClass = isDragging ? "bg-body-secondary border-dashed border-2 border-secondary" : "bg-body-trasparent border-solid border-transparent border-2";
299
299
  const combinedClassName = `${baseClass} ${stateClass} ${className}`.trim();
300
300
  const handleDragOver = (e) => {
301
301
  e.preventDefault();
@@ -856,95 +856,97 @@ var UploadContainer = ({
856
856
  a.click();
857
857
  document.body.removeChild(a);
858
858
  };
859
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
860
- UploadDropzone,
861
- {
862
- isDragging,
863
- onDragOver: handleDragOver,
864
- onDragLeave: handleDragLeave,
865
- onDrop: handleDrop,
866
- className: "w-100",
867
- style: { minHeight: "260px", alignItems: "stretch" },
868
- children: [
869
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "w-100", children: [
859
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
860
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "w-100", children: [
861
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
862
+ "input",
863
+ {
864
+ id: "filePicker",
865
+ type: "file",
866
+ multiple: true,
867
+ className: "d-none",
868
+ onChange: (e) => {
869
+ if (!e.target.files) return;
870
+ onFilesSelected?.(e.target.files);
871
+ startUploadsIfNeeded(e.target.files);
872
+ }
873
+ }
874
+ ),
875
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "text-start", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
876
+ "button",
877
+ {
878
+ type: "button",
879
+ className: "btn btn-primary float-start",
880
+ onClick: () => document.getElementById("filePicker")?.click(),
881
+ children: "Browse files\u2026"
882
+ }
883
+ ) })
884
+ ] }),
885
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
886
+ UploadDropzone,
887
+ {
888
+ isDragging,
889
+ onDragOver: handleDragOver,
890
+ onDragLeave: handleDragLeave,
891
+ onDrop: handleDrop,
892
+ className: "w-100",
893
+ style: { minHeight: "100px", alignItems: "stretch" },
894
+ children: [
895
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "w-100 mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "d-flex flex-column flex-md-row align-items-start align-items-md-center justify-content-between gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex-grow-1 w-100", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(UploadProgressList, { uploads }) }) }) }),
870
896
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
871
- "input",
872
- {
873
- id: "filePicker",
874
- type: "file",
875
- multiple: true,
876
- className: "d-none",
877
- onChange: (e) => {
878
- if (!e.target.files) return;
879
- onFilesSelected?.(e.target.files);
880
- startUploadsIfNeeded(e.target.files);
881
- }
882
- }
883
- ),
884
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "text-start", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
885
- "button",
897
+ "div",
886
898
  {
887
- type: "button",
888
- className: "btn btn-primary float-start",
889
- onClick: () => document.getElementById("filePicker")?.click(),
890
- children: "Browse files\u2026"
891
- }
892
- ) })
893
- ] }),
894
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "w-100 mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "d-flex flex-column flex-md-row align-items-start align-items-md-center justify-content-between gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex-grow-1 w-100", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(UploadProgressList, { uploads }) }) }) }),
895
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
896
- "div",
897
- {
898
- className: "w-100 d-flex flex-wrap gap-4 align-content-start",
899
- style: { minHeight: "140px" },
900
- children: existingFilesLoading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "w-100 d-flex justify-content-center align-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "spinner-border text-secondary", role: "status" }) }) : existingFiles.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
901
- "div",
902
- {
903
- className: "w-100 d-flex flex-column align-items-center justify-content-center text-muted",
904
- style: {
905
- minHeight: "160px",
906
- padding: "20px",
907
- cursor: "pointer",
908
- transition: "background 0.12s, border-color 0.12s"
909
- },
910
- onClick: () => document.getElementById("filePicker")?.click(),
911
- onMouseEnter: (e) => e.currentTarget.style.borderColor = "#888",
912
- onMouseLeave: (e) => e.currentTarget.style.borderColor = "#ccc",
913
- children: [
914
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
915
- "input",
916
- {
917
- id: "filePicker",
918
- type: "file",
919
- multiple: true,
920
- hidden: true,
921
- onChange: (e) => {
922
- if (!e.target.files) return;
923
- onFilesSelected?.(e.target.files);
924
- startUploadsIfNeeded(e.target.files);
899
+ className: "w-100 d-flex flex-wrap gap-4 align-content-start",
900
+ style: { minHeight: "140px" },
901
+ children: existingFilesLoading ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "w-100 d-flex justify-content-center align-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "spinner-border text-secondary", role: "status" }) }) : existingFiles.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
902
+ "div",
903
+ {
904
+ className: "w-100 d-flex flex-column align-items-center justify-content-center text-muted",
905
+ style: {
906
+ minHeight: "160px",
907
+ padding: "20px",
908
+ cursor: "pointer",
909
+ transition: "background 0.12s, border-color 0.12s"
910
+ },
911
+ onClick: () => document.getElementById("filePicker")?.click(),
912
+ onMouseEnter: (e) => e.currentTarget.style.borderColor = "#888",
913
+ onMouseLeave: (e) => e.currentTarget.style.borderColor = "#ccc",
914
+ children: [
915
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
916
+ "input",
917
+ {
918
+ id: "filePicker",
919
+ type: "file",
920
+ multiple: true,
921
+ hidden: true,
922
+ onChange: (e) => {
923
+ if (!e.target.files) return;
924
+ onFilesSelected?.(e.target.files);
925
+ startUploadsIfNeeded(e.target.files);
926
+ }
925
927
  }
926
- }
927
- ),
928
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: "Drag & drop files here" }),
929
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("small", { className: "mt-1", children: "\u2026or click to browse" })
930
- ]
931
- }
932
- ) : existingFiles.map((file) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
933
- DesktopFileIcon,
934
- {
935
- name: file.Name,
936
- sizeBytes: file.FileSize,
937
- downloadUrl: file.PublicUrl,
938
- onOpen: () => handleExistingFileOpen(file),
939
- onDelete: () => onDeleteFile?.(file)
940
- },
941
- file.Id
942
- ))
943
- }
944
- )
945
- ]
946
- }
947
- );
928
+ ),
929
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: "Drag & drop files here" }),
930
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("small", { className: "mt-1", children: "\u2026or click to browse" })
931
+ ]
932
+ }
933
+ ) : existingFiles.map((file) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
934
+ DesktopFileIcon,
935
+ {
936
+ name: file.Name,
937
+ sizeBytes: file.FileSize,
938
+ downloadUrl: file.PublicUrl,
939
+ onOpen: () => handleExistingFileOpen(file),
940
+ onDelete: () => onDeleteFile?.(file)
941
+ },
942
+ file.Id
943
+ ))
944
+ }
945
+ )
946
+ ]
947
+ }
948
+ )
949
+ ] });
948
950
  };
949
951
 
950
952
  // src/hooks/UseContainers.ts
@@ -1058,7 +1060,7 @@ var ContainerUploadPanel = ({
1058
1060
  // src/components/SingleFileProcessUploader.tsx
1059
1061
  var import_react8 = require("react");
1060
1062
  var import_jsx_runtime6 = require("react/jsx-runtime");
1061
- var SingleFileProcessUploader = ({ getPresignedUrl, onUploadComplete, accept, label, disabled }) => {
1063
+ var SingleFileProcessUploader = ({ getPresignedUrl, onUploadComplete, accept, disabled }) => {
1062
1064
  const [selectedFile, setSelectedFile] = (0, import_react8.useState)(null);
1063
1065
  const [isDragging, setIsDragging] = (0, import_react8.useState)(false);
1064
1066
  const [progress, setProgress] = (0, import_react8.useState)(null);
@@ -1132,10 +1134,9 @@ var SingleFileProcessUploader = ({ getPresignedUrl, onUploadComplete, accept, la
1132
1134
  "text-center",
1133
1135
  "user-select-none",
1134
1136
  disabled ? "opacity-50" : "cursor-pointer",
1135
- isDragging ? "bg-info-subtle" : "bg-transparent"
1137
+ isDragging ? "bg-body-secondary border-dashed border-2 border-secondary" : "bg-body-trasparent border-transparent border-2"
1136
1138
  ].join(" ");
1137
1139
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "d-flex flex-column gap-2", children: [
1138
- label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { className: "form-label fw-semibold", children: label }),
1139
1140
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
1140
1141
  "div",
1141
1142
  {
@@ -1174,7 +1175,10 @@ var SingleFileProcessUploader = ({ getPresignedUrl, onUploadComplete, accept, la
1174
1175
  ),
1175
1176
  isUploading && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "small", children: [
1176
1177
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "d-flex justify-content-between mb-1", children: [
1177
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Uploading..." }),
1178
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
1179
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "spinner-border spinner-border-sm text-primary" }),
1180
+ " Uploading..."
1181
+ ] }),
1178
1182
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
1179
1183
  progress ?? 0,
1180
1184
  "%"
package/dist/index.js CHANGED
@@ -252,7 +252,7 @@ var UploadDropzone = ({
252
252
  children
253
253
  }) => {
254
254
  const baseClass = "rounded-3 d-flex flex-column align-items-center justify-content-center";
255
- const stateClass = isDragging ? "bg-body-secondary" : "";
255
+ const stateClass = isDragging ? "bg-body-secondary border-dashed border-2 border-secondary" : "bg-body-trasparent border-solid border-transparent border-2";
256
256
  const combinedClassName = `${baseClass} ${stateClass} ${className}`.trim();
257
257
  const handleDragOver = (e) => {
258
258
  e.preventDefault();
@@ -774,7 +774,7 @@ var DesktopFileIcon = ({
774
774
  };
775
775
 
776
776
  // src/components/UploadContainer.tsx
777
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
777
+ import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
778
778
  var UploadContainer = ({
779
779
  onFilesSelected,
780
780
  existingFiles = [],
@@ -823,95 +823,97 @@ var UploadContainer = ({
823
823
  a.click();
824
824
  document.body.removeChild(a);
825
825
  };
826
- return /* @__PURE__ */ jsxs3(
827
- UploadDropzone,
828
- {
829
- isDragging,
830
- onDragOver: handleDragOver,
831
- onDragLeave: handleDragLeave,
832
- onDrop: handleDrop,
833
- className: "w-100",
834
- style: { minHeight: "260px", alignItems: "stretch" },
835
- children: [
836
- /* @__PURE__ */ jsxs3("div", { className: "w-100", children: [
826
+ return /* @__PURE__ */ jsxs3(Fragment2, { children: [
827
+ /* @__PURE__ */ jsxs3("div", { className: "w-100", children: [
828
+ /* @__PURE__ */ jsx4(
829
+ "input",
830
+ {
831
+ id: "filePicker",
832
+ type: "file",
833
+ multiple: true,
834
+ className: "d-none",
835
+ onChange: (e) => {
836
+ if (!e.target.files) return;
837
+ onFilesSelected?.(e.target.files);
838
+ startUploadsIfNeeded(e.target.files);
839
+ }
840
+ }
841
+ ),
842
+ /* @__PURE__ */ jsx4("div", { className: "text-start", children: /* @__PURE__ */ jsx4(
843
+ "button",
844
+ {
845
+ type: "button",
846
+ className: "btn btn-primary float-start",
847
+ onClick: () => document.getElementById("filePicker")?.click(),
848
+ children: "Browse files\u2026"
849
+ }
850
+ ) })
851
+ ] }),
852
+ /* @__PURE__ */ jsxs3(
853
+ UploadDropzone,
854
+ {
855
+ isDragging,
856
+ onDragOver: handleDragOver,
857
+ onDragLeave: handleDragLeave,
858
+ onDrop: handleDrop,
859
+ className: "w-100",
860
+ style: { minHeight: "100px", alignItems: "stretch" },
861
+ children: [
862
+ /* @__PURE__ */ jsx4("div", { className: "w-100 mb-3", children: /* @__PURE__ */ jsx4("div", { className: "d-flex flex-column flex-md-row align-items-start align-items-md-center justify-content-between gap-3", children: /* @__PURE__ */ jsx4("div", { className: "flex-grow-1 w-100", children: /* @__PURE__ */ jsx4(UploadProgressList, { uploads }) }) }) }),
837
863
  /* @__PURE__ */ jsx4(
838
- "input",
839
- {
840
- id: "filePicker",
841
- type: "file",
842
- multiple: true,
843
- className: "d-none",
844
- onChange: (e) => {
845
- if (!e.target.files) return;
846
- onFilesSelected?.(e.target.files);
847
- startUploadsIfNeeded(e.target.files);
848
- }
849
- }
850
- ),
851
- /* @__PURE__ */ jsx4("div", { className: "text-start", children: /* @__PURE__ */ jsx4(
852
- "button",
864
+ "div",
853
865
  {
854
- type: "button",
855
- className: "btn btn-primary float-start",
856
- onClick: () => document.getElementById("filePicker")?.click(),
857
- children: "Browse files\u2026"
858
- }
859
- ) })
860
- ] }),
861
- /* @__PURE__ */ jsx4("div", { className: "w-100 mb-3", children: /* @__PURE__ */ jsx4("div", { className: "d-flex flex-column flex-md-row align-items-start align-items-md-center justify-content-between gap-3", children: /* @__PURE__ */ jsx4("div", { className: "flex-grow-1 w-100", children: /* @__PURE__ */ jsx4(UploadProgressList, { uploads }) }) }) }),
862
- /* @__PURE__ */ jsx4(
863
- "div",
864
- {
865
- className: "w-100 d-flex flex-wrap gap-4 align-content-start",
866
- style: { minHeight: "140px" },
867
- children: existingFilesLoading ? /* @__PURE__ */ jsx4("div", { className: "w-100 d-flex justify-content-center align-items-center", children: /* @__PURE__ */ jsx4("div", { className: "spinner-border text-secondary", role: "status" }) }) : existingFiles.length === 0 ? /* @__PURE__ */ jsxs3(
868
- "div",
869
- {
870
- className: "w-100 d-flex flex-column align-items-center justify-content-center text-muted",
871
- style: {
872
- minHeight: "160px",
873
- padding: "20px",
874
- cursor: "pointer",
875
- transition: "background 0.12s, border-color 0.12s"
876
- },
877
- onClick: () => document.getElementById("filePicker")?.click(),
878
- onMouseEnter: (e) => e.currentTarget.style.borderColor = "#888",
879
- onMouseLeave: (e) => e.currentTarget.style.borderColor = "#ccc",
880
- children: [
881
- /* @__PURE__ */ jsx4(
882
- "input",
883
- {
884
- id: "filePicker",
885
- type: "file",
886
- multiple: true,
887
- hidden: true,
888
- onChange: (e) => {
889
- if (!e.target.files) return;
890
- onFilesSelected?.(e.target.files);
891
- startUploadsIfNeeded(e.target.files);
866
+ className: "w-100 d-flex flex-wrap gap-4 align-content-start",
867
+ style: { minHeight: "140px" },
868
+ children: existingFilesLoading ? /* @__PURE__ */ jsx4("div", { className: "w-100 d-flex justify-content-center align-items-center", children: /* @__PURE__ */ jsx4("div", { className: "spinner-border text-secondary", role: "status" }) }) : existingFiles.length === 0 ? /* @__PURE__ */ jsxs3(
869
+ "div",
870
+ {
871
+ className: "w-100 d-flex flex-column align-items-center justify-content-center text-muted",
872
+ style: {
873
+ minHeight: "160px",
874
+ padding: "20px",
875
+ cursor: "pointer",
876
+ transition: "background 0.12s, border-color 0.12s"
877
+ },
878
+ onClick: () => document.getElementById("filePicker")?.click(),
879
+ onMouseEnter: (e) => e.currentTarget.style.borderColor = "#888",
880
+ onMouseLeave: (e) => e.currentTarget.style.borderColor = "#ccc",
881
+ children: [
882
+ /* @__PURE__ */ jsx4(
883
+ "input",
884
+ {
885
+ id: "filePicker",
886
+ type: "file",
887
+ multiple: true,
888
+ hidden: true,
889
+ onChange: (e) => {
890
+ if (!e.target.files) return;
891
+ onFilesSelected?.(e.target.files);
892
+ startUploadsIfNeeded(e.target.files);
893
+ }
892
894
  }
893
- }
894
- ),
895
- /* @__PURE__ */ jsx4("strong", { children: "Drag & drop files here" }),
896
- /* @__PURE__ */ jsx4("small", { className: "mt-1", children: "\u2026or click to browse" })
897
- ]
898
- }
899
- ) : existingFiles.map((file) => /* @__PURE__ */ jsx4(
900
- DesktopFileIcon,
901
- {
902
- name: file.Name,
903
- sizeBytes: file.FileSize,
904
- downloadUrl: file.PublicUrl,
905
- onOpen: () => handleExistingFileOpen(file),
906
- onDelete: () => onDeleteFile?.(file)
907
- },
908
- file.Id
909
- ))
910
- }
911
- )
912
- ]
913
- }
914
- );
895
+ ),
896
+ /* @__PURE__ */ jsx4("strong", { children: "Drag & drop files here" }),
897
+ /* @__PURE__ */ jsx4("small", { className: "mt-1", children: "\u2026or click to browse" })
898
+ ]
899
+ }
900
+ ) : existingFiles.map((file) => /* @__PURE__ */ jsx4(
901
+ DesktopFileIcon,
902
+ {
903
+ name: file.Name,
904
+ sizeBytes: file.FileSize,
905
+ downloadUrl: file.PublicUrl,
906
+ onOpen: () => handleExistingFileOpen(file),
907
+ onDelete: () => onDeleteFile?.(file)
908
+ },
909
+ file.Id
910
+ ))
911
+ }
912
+ )
913
+ ]
914
+ }
915
+ )
916
+ ] });
915
917
  };
916
918
 
917
919
  // src/hooks/UseContainers.ts
@@ -1025,7 +1027,7 @@ var ContainerUploadPanel = ({
1025
1027
  // src/components/SingleFileProcessUploader.tsx
1026
1028
  import { useCallback as useCallback2, useRef as useRef2, useState as useState5 } from "react";
1027
1029
  import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
1028
- var SingleFileProcessUploader = ({ getPresignedUrl, onUploadComplete, accept, label, disabled }) => {
1030
+ var SingleFileProcessUploader = ({ getPresignedUrl, onUploadComplete, accept, disabled }) => {
1029
1031
  const [selectedFile, setSelectedFile] = useState5(null);
1030
1032
  const [isDragging, setIsDragging] = useState5(false);
1031
1033
  const [progress, setProgress] = useState5(null);
@@ -1099,10 +1101,9 @@ var SingleFileProcessUploader = ({ getPresignedUrl, onUploadComplete, accept, la
1099
1101
  "text-center",
1100
1102
  "user-select-none",
1101
1103
  disabled ? "opacity-50" : "cursor-pointer",
1102
- isDragging ? "bg-info-subtle" : "bg-transparent"
1104
+ isDragging ? "bg-body-secondary border-dashed border-2 border-secondary" : "bg-body-trasparent border-transparent border-2"
1103
1105
  ].join(" ");
1104
1106
  return /* @__PURE__ */ jsxs4("div", { className: "d-flex flex-column gap-2", children: [
1105
- label && /* @__PURE__ */ jsx6("label", { className: "form-label fw-semibold", children: label }),
1106
1107
  /* @__PURE__ */ jsxs4(
1107
1108
  "div",
1108
1109
  {
@@ -1141,7 +1142,10 @@ var SingleFileProcessUploader = ({ getPresignedUrl, onUploadComplete, accept, la
1141
1142
  ),
1142
1143
  isUploading && /* @__PURE__ */ jsxs4("div", { className: "small", children: [
1143
1144
  /* @__PURE__ */ jsxs4("div", { className: "d-flex justify-content-between mb-1", children: [
1144
- /* @__PURE__ */ jsx6("span", { children: "Uploading..." }),
1145
+ /* @__PURE__ */ jsxs4("span", { children: [
1146
+ /* @__PURE__ */ jsx6("div", { className: "spinner-border spinner-border-sm text-primary" }),
1147
+ " Uploading..."
1148
+ ] }),
1145
1149
  /* @__PURE__ */ jsxs4("span", { children: [
1146
1150
  progress ?? 0,
1147
1151
  "%"
@@ -1184,7 +1188,7 @@ import {
1184
1188
  UserInfoCard,
1185
1189
  useUser
1186
1190
  } from "@sparkstudio/authentication-ui";
1187
- import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1191
+ import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1188
1192
  function HomeView() {
1189
1193
  return /* @__PURE__ */ jsx7(
1190
1194
  AuthenticatorProvider,
@@ -1207,9 +1211,9 @@ function HomeContent() {
1207
1211
  const result = await res.s3.GetTemporaryPreSignedUrl(new TemporaryFileDTO({ Name: file.name, ContentType: contentType }));
1208
1212
  return result;
1209
1213
  }
1210
- return /* @__PURE__ */ jsxs5(Fragment2, { children: [
1214
+ return /* @__PURE__ */ jsxs5(Fragment3, { children: [
1211
1215
  /* @__PURE__ */ jsx7(UserInfoCard, {}),
1212
- user && /* @__PURE__ */ jsxs5(Fragment2, { children: [
1216
+ user && /* @__PURE__ */ jsxs5(Fragment3, { children: [
1213
1217
  /* @__PURE__ */ jsx7(
1214
1218
  SingleFileProcessUploader,
1215
1219
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparkstudio/storage-ui",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -40,7 +40,7 @@
40
40
  "@fortawesome/free-solid-svg-icons": "^7.1.0",
41
41
  "@fortawesome/react-fontawesome": "^3.1.1",
42
42
  "@sparkstudio/authentication-ui": "^1.0.29",
43
- "@sparkstudio/common-ui": "^1.0.26",
43
+ "@sparkstudio/common-ui": "^1.0.29",
44
44
  "barrelsby": "^2.8.1"
45
45
  },
46
46
  "devDependencies": {
package/dist/index.css DELETED
@@ -1,3 +0,0 @@
1
- @import "/node_modules/@sparkstudio/common-ui/dist/index.css";
2
-
3
- /*# sourceMappingURL=index.css.map */
@@ -1 +0,0 @@
1
- {"version":3,"sourceRoot":"","sources":["../src/index.scss"],"names":[],"mappings":"AAAQ","file":"index.css"}
package/dist/index.d.cts DELETED
@@ -1,217 +0,0 @@
1
- import * as React from 'react';
2
- import React__default from 'react';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
-
5
- declare enum ContainerType {
6
- File = 0,
7
- Folder = 1,
8
- Root = 2
9
- }
10
-
11
- /**
12
- * Represents an Auto-generated model for ContainerDTO.
13
- */
14
- interface IContainerDTO {
15
- Id: string;
16
- ContainerType: ContainerType;
17
- Name?: string;
18
- ContentType?: string;
19
- PublicUrl?: string;
20
- CreatedDate: string;
21
- FileSize: number;
22
- UserId: string;
23
- ParentContainerId: string;
24
- }
25
- type ContainerDTOInit = Partial<IContainerDTO> & Pick<IContainerDTO, "Id" | "ContainerType" | "CreatedDate" | "FileSize" | "UserId" | "ParentContainerId">;
26
- declare class ContainerDTO implements IContainerDTO {
27
- Id: string;
28
- ContainerType: ContainerType;
29
- Name?: string;
30
- ContentType?: string;
31
- PublicUrl?: string;
32
- CreatedDate: string;
33
- FileSize: number;
34
- UserId: string;
35
- ParentContainerId: string;
36
- constructor(init: ContainerDTOInit);
37
- }
38
-
39
- /**
40
- * Auto-generated client for the Container controller.
41
- */
42
- declare class Container {
43
- private baseUrl;
44
- constructor(baseUrl: string);
45
- ReadChildrenByContainerId(parentId: string): Promise<ContainerDTO[]>;
46
- ReadRootContainers(): Promise<ContainerDTO[]>;
47
- Read(id: string): Promise<ContainerDTO>;
48
- Create(containerDTO: ContainerDTO): Promise<ContainerDTO>;
49
- Update(containerDTO: ContainerDTO): Promise<ContainerDTO>;
50
- DeleteContainer(id: string): Promise<ContainerDTO>;
51
- CreateFileContainer(fileName: string, size: number, contentType: string): Promise<ContainerDTO>;
52
- }
53
-
54
- /**
55
- * Auto-generated client for the Home controller.
56
- */
57
- declare class Home {
58
- private baseUrl;
59
- constructor(baseUrl: string);
60
- }
61
-
62
- /**
63
- * Represents an Auto-generated model for AWSPresignedUrlDTO.
64
- */
65
- interface IAWSPresignedUrlDTO {
66
- PresignedUrl?: string;
67
- PublicUrl?: string;
68
- Key?: string;
69
- }
70
- type AWSPresignedUrlDTOInit = Partial<IAWSPresignedUrlDTO>;
71
- declare class AWSPresignedUrlDTO implements IAWSPresignedUrlDTO {
72
- PresignedUrl?: string;
73
- PublicUrl?: string;
74
- Key?: string;
75
- constructor(init: AWSPresignedUrlDTOInit);
76
- }
77
-
78
- /**
79
- * Represents an Auto-generated model for TemporaryFileDTO.
80
- */
81
- interface ITemporaryFileDTO {
82
- Name?: string;
83
- ContentType?: string;
84
- }
85
- type TemporaryFileDTOInit = Partial<ITemporaryFileDTO>;
86
- declare class TemporaryFileDTO implements ITemporaryFileDTO {
87
- Name?: string;
88
- ContentType?: string;
89
- constructor(init: TemporaryFileDTOInit);
90
- }
91
-
92
- /**
93
- * Auto-generated client for the S3 controller.
94
- */
95
- declare class S3 {
96
- private baseUrl;
97
- constructor(baseUrl: string);
98
- DeleteS3(containerDTO: ContainerDTO): Promise<ContainerDTO>;
99
- GetPreSignedUrl(containerDTO: ContainerDTO): Promise<AWSPresignedUrlDTO>;
100
- GetTemporaryPreSignedUrl(temporaryFileDTO: TemporaryFileDTO): Promise<AWSPresignedUrlDTO>;
101
- }
102
-
103
- /**
104
- * Auto-generated API client.
105
- */
106
- declare class SparkStudioStorageSDK {
107
- container: Container;
108
- home: Home;
109
- s3: S3;
110
- constructor(baseUrl: string);
111
- }
112
-
113
- interface ContainerUploadPanelProps {
114
- /** Base URL for the Container API (the SDK you pasted). */
115
- containerApiBaseUrl: string;
116
- /** Base URL for your storage / presign endpoint (used by getPresignedUrl). */
117
- storageApiBaseUrl: string;
118
- /** Optional parent container – if set, we query children instead of roots. */
119
- parentContainerId?: string;
120
- }
121
- declare const ContainerUploadPanel: React__default.FC<ContainerUploadPanelProps>;
122
-
123
- interface DesktopFileIconProps {
124
- name?: string | null;
125
- sizeBytes?: number | null;
126
- downloadUrl?: string | null;
127
- /** Double-click / open action */
128
- onOpen?: () => void;
129
- /** Delete action (can be async) */
130
- onDelete?: () => Promise<void> | void;
131
- }
132
- declare const DesktopFileIcon: React__default.FC<DesktopFileIconProps>;
133
-
134
- interface SingleFileProcessUploaderProps {
135
- getPresignedUrl: (file: File) => Promise<AWSPresignedUrlDTO>;
136
- onUploadComplete?: (file: File, s3Url: AWSPresignedUrlDTO) => void;
137
- accept?: string;
138
- label?: string;
139
- disabled?: boolean;
140
- }
141
- declare const SingleFileProcessUploader: React__default.FC<SingleFileProcessUploaderProps>;
142
-
143
- interface UploadContainerProps {
144
- multiple?: boolean;
145
- accept?: string;
146
- onFilesSelected?: (files: FileList) => void;
147
- existingFiles?: ContainerDTO[];
148
- existingFilesLoading?: boolean;
149
- onExistingFileClick?: (file: ContainerDTO) => void;
150
- /** Called when user chooses "Delete file" from the context menu */
151
- onDeleteFile?: (file: ContainerDTO) => void;
152
- autoUpload?: boolean;
153
- getPresignedUrl?: (file: File) => Promise<AWSPresignedUrlDTO>;
154
- onUploadComplete?: (file: File, s3Url: string) => void;
155
- onUploadError?: (file: File, error: Error) => void;
156
- }
157
- declare const UploadContainer: React__default.FC<UploadContainerProps>;
158
-
159
- interface UploadDropzoneProps {
160
- isDragging: boolean;
161
- onDragOver?: (e: React__default.DragEvent<HTMLDivElement>) => void;
162
- onDragLeave?: (e: React__default.DragEvent<HTMLDivElement>) => void;
163
- onDrop?: (e: React__default.DragEvent<HTMLDivElement>) => void;
164
- className?: string;
165
- style?: React__default.CSSProperties;
166
- children?: React__default.ReactNode;
167
- }
168
- declare const UploadDropzone: React__default.FC<UploadDropzoneProps>;
169
-
170
- type UploadStatus = "pending" | "uploading" | "success" | "error";
171
- interface UploadState {
172
- id: string;
173
- file: File;
174
- progress: number;
175
- status: UploadStatus;
176
- error?: string;
177
- s3Url?: string;
178
- publicUrl?: string;
179
- }
180
-
181
- interface UploadProgressListProps {
182
- uploads: UploadState[];
183
- }
184
- declare const UploadProgressList: React__default.FC<UploadProgressListProps>;
185
-
186
- /**
187
- * Helper: upload a file to a pre-signed S3 URL with progress + retries.
188
- */
189
- declare function UploadFileToS3(file: File, presignedUrl: string, onProgress: (progress: number) => void, maxRetries?: number): Promise<void>;
190
-
191
- interface UseContainersOptions {
192
- apiBaseUrl: string;
193
- parentId?: string;
194
- }
195
- declare function UseContainers({ apiBaseUrl, parentId }: UseContainersOptions): {
196
- containers: ContainerDTO[];
197
- setContainers: React.Dispatch<React.SetStateAction<ContainerDTO[]>>;
198
- loading: boolean;
199
- error: Error | null;
200
- reload: () => Promise<void>;
201
- };
202
-
203
- interface UseUploadManagerOptions {
204
- autoUpload?: boolean;
205
- getPresignedUrl?: (file: File) => Promise<AWSPresignedUrlDTO>;
206
- onUploadComplete?: (file: File, s3Url: string) => void;
207
- onUploadError?: (file: File, error: Error) => void;
208
- }
209
- declare function UseUploadManager({ autoUpload, getPresignedUrl, onUploadComplete, onUploadError, }: UseUploadManagerOptions): {
210
- uploads: UploadState[];
211
- startUploadsIfNeeded: (files: FileList) => void;
212
- resetUploads: () => void;
213
- };
214
-
215
- declare function HomeView(): react_jsx_runtime.JSX.Element;
216
-
217
- export { AWSPresignedUrlDTO, Container, ContainerDTO, ContainerType, ContainerUploadPanel, DesktopFileIcon, type DesktopFileIconProps, Home, HomeView, type IAWSPresignedUrlDTO, type IContainerDTO, type ITemporaryFileDTO, S3, SingleFileProcessUploader, type SingleFileProcessUploaderProps, SparkStudioStorageSDK, TemporaryFileDTO, UploadContainer, type UploadContainerProps, UploadDropzone, UploadFileToS3, UploadProgressList, type UploadState, type UploadStatus, UseContainers, UseUploadManager };
package/dist/index.d.ts DELETED
@@ -1,217 +0,0 @@
1
- import * as React from 'react';
2
- import React__default from 'react';
3
- import * as react_jsx_runtime from 'react/jsx-runtime';
4
-
5
- declare enum ContainerType {
6
- File = 0,
7
- Folder = 1,
8
- Root = 2
9
- }
10
-
11
- /**
12
- * Represents an Auto-generated model for ContainerDTO.
13
- */
14
- interface IContainerDTO {
15
- Id: string;
16
- ContainerType: ContainerType;
17
- Name?: string;
18
- ContentType?: string;
19
- PublicUrl?: string;
20
- CreatedDate: string;
21
- FileSize: number;
22
- UserId: string;
23
- ParentContainerId: string;
24
- }
25
- type ContainerDTOInit = Partial<IContainerDTO> & Pick<IContainerDTO, "Id" | "ContainerType" | "CreatedDate" | "FileSize" | "UserId" | "ParentContainerId">;
26
- declare class ContainerDTO implements IContainerDTO {
27
- Id: string;
28
- ContainerType: ContainerType;
29
- Name?: string;
30
- ContentType?: string;
31
- PublicUrl?: string;
32
- CreatedDate: string;
33
- FileSize: number;
34
- UserId: string;
35
- ParentContainerId: string;
36
- constructor(init: ContainerDTOInit);
37
- }
38
-
39
- /**
40
- * Auto-generated client for the Container controller.
41
- */
42
- declare class Container {
43
- private baseUrl;
44
- constructor(baseUrl: string);
45
- ReadChildrenByContainerId(parentId: string): Promise<ContainerDTO[]>;
46
- ReadRootContainers(): Promise<ContainerDTO[]>;
47
- Read(id: string): Promise<ContainerDTO>;
48
- Create(containerDTO: ContainerDTO): Promise<ContainerDTO>;
49
- Update(containerDTO: ContainerDTO): Promise<ContainerDTO>;
50
- DeleteContainer(id: string): Promise<ContainerDTO>;
51
- CreateFileContainer(fileName: string, size: number, contentType: string): Promise<ContainerDTO>;
52
- }
53
-
54
- /**
55
- * Auto-generated client for the Home controller.
56
- */
57
- declare class Home {
58
- private baseUrl;
59
- constructor(baseUrl: string);
60
- }
61
-
62
- /**
63
- * Represents an Auto-generated model for AWSPresignedUrlDTO.
64
- */
65
- interface IAWSPresignedUrlDTO {
66
- PresignedUrl?: string;
67
- PublicUrl?: string;
68
- Key?: string;
69
- }
70
- type AWSPresignedUrlDTOInit = Partial<IAWSPresignedUrlDTO>;
71
- declare class AWSPresignedUrlDTO implements IAWSPresignedUrlDTO {
72
- PresignedUrl?: string;
73
- PublicUrl?: string;
74
- Key?: string;
75
- constructor(init: AWSPresignedUrlDTOInit);
76
- }
77
-
78
- /**
79
- * Represents an Auto-generated model for TemporaryFileDTO.
80
- */
81
- interface ITemporaryFileDTO {
82
- Name?: string;
83
- ContentType?: string;
84
- }
85
- type TemporaryFileDTOInit = Partial<ITemporaryFileDTO>;
86
- declare class TemporaryFileDTO implements ITemporaryFileDTO {
87
- Name?: string;
88
- ContentType?: string;
89
- constructor(init: TemporaryFileDTOInit);
90
- }
91
-
92
- /**
93
- * Auto-generated client for the S3 controller.
94
- */
95
- declare class S3 {
96
- private baseUrl;
97
- constructor(baseUrl: string);
98
- DeleteS3(containerDTO: ContainerDTO): Promise<ContainerDTO>;
99
- GetPreSignedUrl(containerDTO: ContainerDTO): Promise<AWSPresignedUrlDTO>;
100
- GetTemporaryPreSignedUrl(temporaryFileDTO: TemporaryFileDTO): Promise<AWSPresignedUrlDTO>;
101
- }
102
-
103
- /**
104
- * Auto-generated API client.
105
- */
106
- declare class SparkStudioStorageSDK {
107
- container: Container;
108
- home: Home;
109
- s3: S3;
110
- constructor(baseUrl: string);
111
- }
112
-
113
- interface ContainerUploadPanelProps {
114
- /** Base URL for the Container API (the SDK you pasted). */
115
- containerApiBaseUrl: string;
116
- /** Base URL for your storage / presign endpoint (used by getPresignedUrl). */
117
- storageApiBaseUrl: string;
118
- /** Optional parent container – if set, we query children instead of roots. */
119
- parentContainerId?: string;
120
- }
121
- declare const ContainerUploadPanel: React__default.FC<ContainerUploadPanelProps>;
122
-
123
- interface DesktopFileIconProps {
124
- name?: string | null;
125
- sizeBytes?: number | null;
126
- downloadUrl?: string | null;
127
- /** Double-click / open action */
128
- onOpen?: () => void;
129
- /** Delete action (can be async) */
130
- onDelete?: () => Promise<void> | void;
131
- }
132
- declare const DesktopFileIcon: React__default.FC<DesktopFileIconProps>;
133
-
134
- interface SingleFileProcessUploaderProps {
135
- getPresignedUrl: (file: File) => Promise<AWSPresignedUrlDTO>;
136
- onUploadComplete?: (file: File, s3Url: AWSPresignedUrlDTO) => void;
137
- accept?: string;
138
- label?: string;
139
- disabled?: boolean;
140
- }
141
- declare const SingleFileProcessUploader: React__default.FC<SingleFileProcessUploaderProps>;
142
-
143
- interface UploadContainerProps {
144
- multiple?: boolean;
145
- accept?: string;
146
- onFilesSelected?: (files: FileList) => void;
147
- existingFiles?: ContainerDTO[];
148
- existingFilesLoading?: boolean;
149
- onExistingFileClick?: (file: ContainerDTO) => void;
150
- /** Called when user chooses "Delete file" from the context menu */
151
- onDeleteFile?: (file: ContainerDTO) => void;
152
- autoUpload?: boolean;
153
- getPresignedUrl?: (file: File) => Promise<AWSPresignedUrlDTO>;
154
- onUploadComplete?: (file: File, s3Url: string) => void;
155
- onUploadError?: (file: File, error: Error) => void;
156
- }
157
- declare const UploadContainer: React__default.FC<UploadContainerProps>;
158
-
159
- interface UploadDropzoneProps {
160
- isDragging: boolean;
161
- onDragOver?: (e: React__default.DragEvent<HTMLDivElement>) => void;
162
- onDragLeave?: (e: React__default.DragEvent<HTMLDivElement>) => void;
163
- onDrop?: (e: React__default.DragEvent<HTMLDivElement>) => void;
164
- className?: string;
165
- style?: React__default.CSSProperties;
166
- children?: React__default.ReactNode;
167
- }
168
- declare const UploadDropzone: React__default.FC<UploadDropzoneProps>;
169
-
170
- type UploadStatus = "pending" | "uploading" | "success" | "error";
171
- interface UploadState {
172
- id: string;
173
- file: File;
174
- progress: number;
175
- status: UploadStatus;
176
- error?: string;
177
- s3Url?: string;
178
- publicUrl?: string;
179
- }
180
-
181
- interface UploadProgressListProps {
182
- uploads: UploadState[];
183
- }
184
- declare const UploadProgressList: React__default.FC<UploadProgressListProps>;
185
-
186
- /**
187
- * Helper: upload a file to a pre-signed S3 URL with progress + retries.
188
- */
189
- declare function UploadFileToS3(file: File, presignedUrl: string, onProgress: (progress: number) => void, maxRetries?: number): Promise<void>;
190
-
191
- interface UseContainersOptions {
192
- apiBaseUrl: string;
193
- parentId?: string;
194
- }
195
- declare function UseContainers({ apiBaseUrl, parentId }: UseContainersOptions): {
196
- containers: ContainerDTO[];
197
- setContainers: React.Dispatch<React.SetStateAction<ContainerDTO[]>>;
198
- loading: boolean;
199
- error: Error | null;
200
- reload: () => Promise<void>;
201
- };
202
-
203
- interface UseUploadManagerOptions {
204
- autoUpload?: boolean;
205
- getPresignedUrl?: (file: File) => Promise<AWSPresignedUrlDTO>;
206
- onUploadComplete?: (file: File, s3Url: string) => void;
207
- onUploadError?: (file: File, error: Error) => void;
208
- }
209
- declare function UseUploadManager({ autoUpload, getPresignedUrl, onUploadComplete, onUploadError, }: UseUploadManagerOptions): {
210
- uploads: UploadState[];
211
- startUploadsIfNeeded: (files: FileList) => void;
212
- resetUploads: () => void;
213
- };
214
-
215
- declare function HomeView(): react_jsx_runtime.JSX.Element;
216
-
217
- export { AWSPresignedUrlDTO, Container, ContainerDTO, ContainerType, ContainerUploadPanel, DesktopFileIcon, type DesktopFileIconProps, Home, HomeView, type IAWSPresignedUrlDTO, type IContainerDTO, type ITemporaryFileDTO, S3, SingleFileProcessUploader, type SingleFileProcessUploaderProps, SparkStudioStorageSDK, TemporaryFileDTO, UploadContainer, type UploadContainerProps, UploadDropzone, UploadFileToS3, UploadProgressList, type UploadState, type UploadStatus, UseContainers, UseUploadManager };