@adamosuiteservices/ui 2.18.2 → 2.18.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.
@@ -4,6 +4,7 @@ export type FileUploadLabels = {
4
4
  selectFile?: string;
5
5
  fileRequirements?: string;
6
6
  filesSelected?: (count: number) => string;
7
+ clearAll?: string;
7
8
  };
8
9
  export type FileUploadProps = ComponentProps<"div"> & Readonly<{
9
10
  selectedFile?: File | null;
@@ -4,6 +4,7 @@ export type FileUploadV2Labels = {
4
4
  selectFile?: string;
5
5
  fileRequirements?: string;
6
6
  filesSelected?: (count: number) => string;
7
+ clearAll?: string;
7
8
  statusUploading?: string;
8
9
  statusSuccess?: string;
9
10
  statusDeleting?: string;
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-BB_1_6y_.cjs"),M=require("./button-CFJs0esR.cjs"),G=require("./icon-B7joBr0A.cjs"),N=require("./typography-Bj8oEDuE.cjs"),D=require("./index-DoxiiusW.cjs"),k=require("react");function te({isDragging:c,isMultiple:o,invalid:a,disabled:t,accept:i,acceptedExtensions:m,maxSizeInMB:d,maxFiles:x,labels:p,input:h,onDragOver:u,onDragLeave:v,onDrop:g,onFileChange:j}){const l=h?.id||`file-upload-v2-${Math.random().toString(36).substring(2,11)}`;return r.jsxRuntimeExports.jsxs("div",{onDragOver:t?void 0:u,onDragLeave:t?void 0:v,onDrop:t?void 0:g,className:D.cn(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-BB_1_6y_.cjs"),M=require("./button-CFJs0esR.cjs"),G=require("./icon-B7joBr0A.cjs"),N=require("./typography-Bj8oEDuE.cjs"),D=require("./index-DoxiiusW.cjs"),k=require("react");function te({isDragging:c,isMultiple:o,invalid:a,disabled:t,accept:i,acceptedExtensions:m,maxSizeInMB:d,maxFiles:x,labels:p,input:h,onDragOver:l,onDragLeave:v,onDrop:g,onFileChange:j}){const u=h?.id||`file-upload-v2-${Math.random().toString(36).substring(2,11)}`;return r.jsxRuntimeExports.jsxs("div",{onDragOver:t?void 0:l,onDragLeave:t?void 0:v,onDrop:t?void 0:g,className:D.cn(`
2
2
  adm:flex adm:flex-col adm:items-center adm:gap-6 adm:rounded-2xl
3
3
  adm:border-2
4
- `,"adm:border-dashed adm:bg-background adm:p-6 adm:transition-colors",{"adm:border-primary":c&&!a&&!t,"adm:border-destructive":a&&!t,"adm:border-input":!c&&!a,"adm:cursor-not-allowed adm:opacity-50":t}),children:[r.jsxRuntimeExports.jsx("div",{className:D.cn("adm:flex adm:items-center adm:justify-center adm:rounded-xl adm:p-2.5",a&&!t?"adm:bg-destructive/10":"adm:bg-primary-50"),children:r.jsxRuntimeExports.jsx(G.Icon,{symbol:"text_snippet",className:a&&!t?"adm:text-destructive":"adm:text-primary"})}),r.jsxRuntimeExports.jsxs("div",{className:"adm:flex adm:flex-col adm:items-center adm:gap-2",children:[r.jsxRuntimeExports.jsx(N.Typography,{color:a&&!t?"destructive":void 0,children:p?.dragDrop||(o?"Drag and drop your files here or":"Drag and drop your file here or")}),r.jsxRuntimeExports.jsxs("label",{htmlFor:l,children:[r.jsxRuntimeExports.jsx("input",{...h,id:l,type:"file",accept:i,multiple:o,onChange:j,disabled:t,className:"adm:hidden"}),r.jsxRuntimeExports.jsx(M.Button,{asChild:!0,type:"button",variant:"link",className:D.cn("adm:cursor-pointer",t&&`
4
+ `,"adm:border-dashed adm:bg-background adm:p-6 adm:transition-colors",{"adm:border-primary":c&&!a&&!t,"adm:border-destructive":a&&!t,"adm:border-input":!c&&!a,"adm:cursor-not-allowed adm:opacity-50":t}),children:[r.jsxRuntimeExports.jsx("div",{className:D.cn("adm:flex adm:items-center adm:justify-center adm:rounded-xl adm:p-2.5",a&&!t?"adm:bg-destructive/10":"adm:bg-primary-50"),children:r.jsxRuntimeExports.jsx(G.Icon,{symbol:"text_snippet",className:a&&!t?"adm:text-destructive":"adm:text-primary"})}),r.jsxRuntimeExports.jsxs("div",{className:"adm:flex adm:flex-col adm:items-center adm:gap-2",children:[r.jsxRuntimeExports.jsx(N.Typography,{color:a&&!t?"destructive":void 0,children:p?.dragDrop||(o?"Drag and drop your files here or":"Drag and drop your file here or")}),r.jsxRuntimeExports.jsxs("label",{htmlFor:u,children:[r.jsxRuntimeExports.jsx("input",{...h,id:u,type:"file",accept:i,multiple:o,onChange:j,disabled:t,className:"adm:hidden"}),r.jsxRuntimeExports.jsx(M.Button,{asChild:!0,type:"button",variant:"link",className:D.cn("adm:cursor-pointer",t&&`
5
5
  adm:pointer-events-none
6
- `),disabled:t,children:r.jsxRuntimeExports.jsx("span",{children:p?.selectFile||(o?"Select files":"Select the file")})})]})]}),r.jsxRuntimeExports.jsx(N.Typography,{className:"adm:text-center",color:a&&!t?"destructive":"muted",children:p?.fileRequirements||(m&&m.length>0?`Allowed files: ${m.join(", ")}. Maximum size ${d} MB${o?`. Up to ${x} files`:""}.`:`Maximum size ${d} MB${o?`. Up to ${x} files`:""}.`)})]})}function re({fileWithMetadata:c,invalid:o,disabled:a,labels:t,onRemove:i}){const{file:m,status:d="idle",deletable:x=!0,disabled:p,error:h}=c,u=a||p,v=d==="uploading",g=d==="deleting",j=d==="error",l=d==="success",$=v||g,q=()=>v||g?"progress_activity":l?"check_circle":j?"error":"text_snippet",V=()=>j?"adm:text-destructive":l?"adm:text-success-600":o&&!u?"adm:text-destructive":"adm:text-primary",z=()=>j?"adm:bg-destructive/15":l?"adm:bg-success/15":v||g?"adm:bg-primary/15":o&&!u?"adm:bg-destructive/15":"adm:bg-primary/15";return r.jsxRuntimeExports.jsxs("div",{className:D.cn("adm:flex adm:items-center adm:gap-4 adm:rounded-2xl adm:border adm:p-6",j?"adm:border-destructive adm:bg-destructive/5":l?"adm:border-success-200 adm:bg-success-50":o&&!u?"adm:border-destructive adm:bg-destructive/5":"adm:border-input adm:bg-muted",u&&"adm:cursor-not-allowed adm:opacity-50"),children:[r.jsxRuntimeExports.jsx("div",{className:D.cn("adm:flex adm:items-center adm:justify-center adm:rounded-xl adm:p-2.5",z()),children:r.jsxRuntimeExports.jsx(G.Icon,{symbol:q(),className:D.cn(V(),$&&"adm:animate-spin")})}),r.jsxRuntimeExports.jsxs("div",{className:"adm:flex adm:min-w-0 adm:flex-1 adm:flex-col adm:gap-1",children:[r.jsxRuntimeExports.jsx(N.Typography,{className:D.cn("adm:min-w-0 adm:truncate adm:font-semibold"),children:m.name}),(h||v||g||l||j)&&r.jsxRuntimeExports.jsx(N.Typography,{className:"adm:text-xs",color:j?"destructive":l?"success":"muted",children:h||(v?t?.statusUploading||"Uploading...":g?t?.statusDeleting||"Deleting...":l?t?.statusSuccess||"Uploaded successfully":j?t?.statusError||"Upload failed":"")})]}),r.jsxRuntimeExports.jsxs(N.Typography,{className:"adm:shrink-0",color:"muted",children:[(m.size/1024/1024).toFixed(1)," MB"]}),x&&r.jsxRuntimeExports.jsx(M.Button,{variant:"destructive-medium",onClick:i,type:"button",disabled:u||$,children:r.jsxRuntimeExports.jsx(G.Icon,{symbol:"delete",className:"adm:text-destructive"})})]})}function A({files:c,isMultiple:o,invalid:a,disabled:t,labels:i,onRemoveFile:m,onClearAll:d}){return c.length===0?null:r.jsxRuntimeExports.jsxs("div",{className:"adm:flex adm:flex-col adm:gap-3",children:[o&&c.length>1&&r.jsxRuntimeExports.jsxs("div",{className:"adm:flex adm:items-center adm:justify-between",children:[r.jsxRuntimeExports.jsx(N.Typography,{className:"adm:text-sm adm:font-medium",color:a&&!t?"destructive":void 0,children:i?.filesSelected?.(c.length)||`${c.length} file${c.length!==1?"s":""} selected`}),r.jsxRuntimeExports.jsx(M.Button,{variant:"ghost",size:"sm",onClick:d,type:"button",disabled:t,children:"Clear all"})]}),c.map((x,p)=>r.jsxRuntimeExports.jsx(re,{fileWithMetadata:x,invalid:a,disabled:t,labels:i,onRemove:()=>m(p)},x.id))]})}function se({className:c,selectedFile:o,selectedFiles:a,onFileSelect:t,onFilesSelect:i,onFileAdd:m,onFileRemove:d,onFilesAdd:x,onFilesRemove:p,onInvalidFile:h,acceptedExtensions:u,maxSizeInMB:v=50,maxFiles:g=10,multiple:j=!1,filesPosition:l="below",invalid:$=!1,disabled:q=!1,"aria-invalid":V,generateId:z,labels:I,input:F,...H}){const[J,B]=k.useState(!1),[K,P]=k.useState(!1),w=k.useRef(null);k.useEffect(()=>{const e=()=>{if(w.current){const s=w.current.closest("fieldset");P(s?.disabled??!1)}};e();const n=new MutationObserver(e);if(w.current){const s=w.current.closest("fieldset");s&&n.observe(s,{attributes:!0,attributeFilter:["disabled"]})}return()=>n.disconnect()},[]);const Q=u?.join(",")||"",X=v*1024*1024,f=j||a!==void 0||i!==void 0,R=f?a||[]:o?[o]:[],T=$||V,y=q||K,Y=z||(e=>`${Date.now()}-${Math.random().toString(36).substring(2,11)}-${e.name}`),C=e=>({id:Y(e),file:e}),Z=e=>{y||(e.preventDefault(),B(!0))},W=e=>{y||(e.preventDefault(),B(!1))},S=e=>{if(!y)if(e.preventDefault(),B(!1),f){const s=Array.from(e.dataTransfer.files).filter(U);if(s.length>0){const b=s.map(C),_=[...a||[],...b].slice(0,g);i&&i(_),x&&x(b)}}else{const n=e.dataTransfer.files[0];if(n&&U(n)){const s=C(n);t&&t(s),m&&m(s)}}},ee=e=>{if(!y){if(f){const s=(e.target.files?Array.from(e.target.files):[]).filter(U);if(s.length>0){const b=s.map(C),_=[...a||[],...b].slice(0,g);i&&i(_),x&&x(b)}}else{const n=e.target.files?.[0];if(n&&U(n)){const s=C(n);t&&t(s),m&&m(s)}}e.target.value=""}},O=e=>{if(y)return;const n=R[e];if(f){const s=R.filter((b,E)=>E!==e);i&&i(s),p&&n&&p([n])}else t&&t(null),d&&n&&d(n)},U=e=>{const n=e.name.substring(e.name.lastIndexOf(".")),s=!u||u.length===0||u.includes(n.toLowerCase()),b=e.size<=X;if(!s||!b){const E=C(e);!s&&h?h(E,"extension"):!b&&h&&h(E,"size")}return s&&b},L=()=>{if(y)return;const e=[...R];f?(i&&i([]),p&&e.length>0&&p(e)):(t&&t(null),d&&e.length>0&&d(e[0]))};return r.jsxRuntimeExports.jsxs("div",{ref:w,className:D.cn("adm:flex adm:flex-col adm:gap-4",c),...H,children:[f&&l==="above"&&r.jsxRuntimeExports.jsx(A,{files:R,isMultiple:f,invalid:T,disabled:y,labels:I,onRemoveFile:O,onClearAll:L}),(f||R.length===0)&&r.jsxRuntimeExports.jsx(te,{isDragging:J,isMultiple:f,invalid:T,disabled:y,accept:Q,acceptedExtensions:u,maxSizeInMB:v,maxFiles:g,labels:I,input:F,onDragOver:Z,onDragLeave:W,onDrop:S,onFileChange:ee}),!f&&R.length>0&&r.jsxRuntimeExports.jsx(A,{files:R,isMultiple:f,invalid:T,disabled:y,labels:I,onRemoveFile:O,onClearAll:L}),f&&l==="below"&&r.jsxRuntimeExports.jsx(A,{files:R,isMultiple:f,invalid:T,disabled:y,labels:I,onRemoveFile:O,onClearAll:L})]})}exports.FileUploadV2=se;
6
+ `),disabled:t,children:r.jsxRuntimeExports.jsx("span",{children:p?.selectFile||(o?"Select files":"Select the file")})})]})]}),r.jsxRuntimeExports.jsx(N.Typography,{className:"adm:text-center",color:a&&!t?"destructive":"muted",children:p?.fileRequirements||(m&&m.length>0?`Allowed files: ${m.join(", ")}. Maximum size ${d} MB${o?`. Up to ${x} files`:""}.`:`Maximum size ${d} MB${o?`. Up to ${x} files`:""}.`)})]})}function re({fileWithMetadata:c,invalid:o,disabled:a,labels:t,onRemove:i}){const{file:m,status:d="idle",deletable:x=!0,disabled:p,error:h}=c,l=a||p,v=d==="uploading",g=d==="deleting",j=d==="error",u=d==="success",$=v||g,q=()=>v||g?"progress_activity":u?"check_circle":j?"error":"text_snippet",V=()=>j?"adm:text-destructive":u?"adm:text-success-600":o&&!l?"adm:text-destructive":"adm:text-primary",z=()=>j?"adm:bg-destructive/15":u?"adm:bg-success/15":v||g?"adm:bg-primary/15":o&&!l?"adm:bg-destructive/15":"adm:bg-primary/15";return r.jsxRuntimeExports.jsxs("div",{className:D.cn("adm:flex adm:items-center adm:gap-4 adm:rounded-2xl adm:border adm:p-6",j?"adm:border-destructive adm:bg-destructive/5":u?"adm:border-success-200 adm:bg-success-50":o&&!l?"adm:border-destructive adm:bg-destructive/5":"adm:border-input adm:bg-muted",l&&"adm:cursor-not-allowed adm:opacity-50"),children:[r.jsxRuntimeExports.jsx("div",{className:D.cn("adm:flex adm:items-center adm:justify-center adm:rounded-xl adm:p-2.5",z()),children:r.jsxRuntimeExports.jsx(G.Icon,{symbol:q(),className:D.cn(V(),$&&"adm:animate-spin")})}),r.jsxRuntimeExports.jsxs("div",{className:"adm:flex adm:min-w-0 adm:flex-1 adm:flex-col adm:gap-1",children:[r.jsxRuntimeExports.jsx(N.Typography,{className:D.cn("adm:min-w-0 adm:truncate adm:font-semibold"),children:m.name}),(h||v||g||u||j)&&r.jsxRuntimeExports.jsx(N.Typography,{className:"adm:text-xs",color:j?"destructive":u?"success":"muted",children:h||(v?t?.statusUploading||"Uploading...":g?t?.statusDeleting||"Deleting...":u?t?.statusSuccess||"Uploaded successfully":j?t?.statusError||"Upload failed":"")})]}),r.jsxRuntimeExports.jsxs(N.Typography,{className:"adm:shrink-0",color:"muted",children:[(m.size/1024/1024).toFixed(1)," MB"]}),x&&r.jsxRuntimeExports.jsx(M.Button,{variant:"destructive-medium",onClick:i,type:"button",disabled:l||$,children:r.jsxRuntimeExports.jsx(G.Icon,{symbol:"delete",className:"adm:text-destructive"})})]})}function _({files:c,isMultiple:o,invalid:a,disabled:t,labels:i,onRemoveFile:m,onClearAll:d}){return c.length===0?null:r.jsxRuntimeExports.jsxs("div",{className:"adm:flex adm:flex-col adm:gap-3",children:[o&&c.length>1&&r.jsxRuntimeExports.jsxs("div",{className:"adm:flex adm:items-center adm:justify-between",children:[r.jsxRuntimeExports.jsx(N.Typography,{className:"adm:text-sm adm:font-medium",color:a&&!t?"destructive":void 0,children:i?.filesSelected?.(c.length)||`${c.length} file${c.length!==1?"s":""} selected`}),r.jsxRuntimeExports.jsx(M.Button,{variant:"ghost",size:"sm",onClick:d,type:"button",disabled:t,children:i?.clearAll||"Clear all"})]}),c.map((x,p)=>r.jsxRuntimeExports.jsx(re,{fileWithMetadata:x,invalid:a,disabled:t,labels:i,onRemove:()=>m(p)},x.id))]})}function se({className:c,selectedFile:o,selectedFiles:a,onFileSelect:t,onFilesSelect:i,onFileAdd:m,onFileRemove:d,onFilesAdd:x,onFilesRemove:p,onInvalidFile:h,acceptedExtensions:l,maxSizeInMB:v=50,maxFiles:g=10,multiple:j=!1,filesPosition:u="below",invalid:$=!1,disabled:q=!1,"aria-invalid":V,generateId:z,labels:I,input:F,...H}){const[J,B]=k.useState(!1),[K,P]=k.useState(!1),w=k.useRef(null);k.useEffect(()=>{const e=()=>{if(w.current){const s=w.current.closest("fieldset");P(s?.disabled??!1)}};e();const n=new MutationObserver(e);if(w.current){const s=w.current.closest("fieldset");s&&n.observe(s,{attributes:!0,attributeFilter:["disabled"]})}return()=>n.disconnect()},[]);const Q=l?.join(",")||"",X=v*1024*1024,f=j||a!==void 0||i!==void 0,R=f?a||[]:o?[o]:[],T=$||V,y=q||K,Y=z||(e=>`${Date.now()}-${Math.random().toString(36).substring(2,11)}-${e.name}`),C=e=>({id:Y(e),file:e}),Z=e=>{y||(e.preventDefault(),B(!0))},W=e=>{y||(e.preventDefault(),B(!1))},S=e=>{if(!y)if(e.preventDefault(),B(!1),f){const s=Array.from(e.dataTransfer.files).filter(U);if(s.length>0){const b=s.map(C),L=[...a||[],...b].slice(0,g);i&&i(L),x&&x(b)}}else{const n=e.dataTransfer.files[0];if(n&&U(n)){const s=C(n);t&&t(s),m&&m(s)}}},ee=e=>{if(!y){if(f){const s=(e.target.files?Array.from(e.target.files):[]).filter(U);if(s.length>0){const b=s.map(C),L=[...a||[],...b].slice(0,g);i&&i(L),x&&x(b)}}else{const n=e.target.files?.[0];if(n&&U(n)){const s=C(n);t&&t(s),m&&m(s)}}e.target.value=""}},O=e=>{if(y)return;const n=R[e];if(f){const s=R.filter((b,E)=>E!==e);i&&i(s),p&&n&&p([n])}else t&&t(null),d&&n&&d(n)},U=e=>{const n=e.name.substring(e.name.lastIndexOf(".")),s=!l||l.length===0||l.includes(n.toLowerCase()),b=e.size<=X;if(!s||!b){const E=C(e);!s&&h?h(E,"extension"):!b&&h&&h(E,"size")}return s&&b},A=()=>{if(y)return;const e=[...R];f?(i&&i([]),p&&e.length>0&&p(e)):(t&&t(null),d&&e.length>0&&d(e[0]))};return r.jsxRuntimeExports.jsxs("div",{ref:w,className:D.cn("adm:flex adm:flex-col adm:gap-4",c),...H,children:[f&&u==="above"&&r.jsxRuntimeExports.jsx(_,{files:R,isMultiple:f,invalid:T,disabled:y,labels:I,onRemoveFile:O,onClearAll:A}),(f||R.length===0)&&r.jsxRuntimeExports.jsx(te,{isDragging:J,isMultiple:f,invalid:T,disabled:y,accept:Q,acceptedExtensions:l,maxSizeInMB:v,maxFiles:g,labels:I,input:F,onDragOver:Z,onDragLeave:W,onDrop:S,onFileChange:ee}),!f&&R.length>0&&r.jsxRuntimeExports.jsx(_,{files:R,isMultiple:f,invalid:T,disabled:y,labels:I,onRemoveFile:O,onClearAll:A}),f&&u==="below"&&r.jsxRuntimeExports.jsx(_,{files:R,isMultiple:f,invalid:T,disabled:y,labels:I,onRemoveFile:O,onClearAll:A})]})}exports.FileUploadV2=se;
@@ -94,7 +94,7 @@ function se({
94
94
  );
95
95
  }
96
96
  function ae({ fileWithMetadata: c, invalid: d, disabled: n, labels: t, onRemove: i }) {
97
- const { file: l, status: o = "idle", deletable: p = !0, disabled: g, error: v } = c, m = n || g, j = o === "uploading", x = o === "deleting", h = o === "error", u = o === "success", U = j || x, V = () => j || x ? "progress_activity" : u ? "check_circle" : h ? "error" : "text_snippet", B = () => h ? "adm:text-destructive" : u ? "adm:text-success-600" : d && !m ? "adm:text-destructive" : "adm:text-primary", L = () => h ? "adm:bg-destructive/15" : u ? "adm:bg-success/15" : j || x ? "adm:bg-primary/15" : d && !m ? "adm:bg-destructive/15" : "adm:bg-primary/15";
97
+ const { file: l, status: o = "idle", deletable: p = !0, disabled: g, error: v } = c, m = n || g, j = o === "uploading", x = o === "deleting", h = o === "error", u = o === "success", U = j || x, V = () => j || x ? "progress_activity" : u ? "check_circle" : h ? "error" : "text_snippet", A = () => h ? "adm:text-destructive" : u ? "adm:text-success-600" : d && !m ? "adm:text-destructive" : "adm:text-primary", B = () => h ? "adm:bg-destructive/15" : u ? "adm:bg-success/15" : j || x ? "adm:bg-primary/15" : d && !m ? "adm:bg-destructive/15" : "adm:bg-primary/15";
98
98
  return /* @__PURE__ */ r.jsxs(
99
99
  "div",
100
100
  {
@@ -109,14 +109,14 @@ function ae({ fileWithMetadata: c, invalid: d, disabled: n, labels: t, onRemove:
109
109
  {
110
110
  className: N(
111
111
  "adm:flex adm:items-center adm:justify-center adm:rounded-xl adm:p-2.5",
112
- L()
112
+ B()
113
113
  ),
114
114
  children: /* @__PURE__ */ r.jsx(
115
115
  M,
116
116
  {
117
117
  symbol: V(),
118
118
  className: N(
119
- B(),
119
+ A(),
120
120
  U && "adm:animate-spin"
121
121
  )
122
122
  }
@@ -172,7 +172,7 @@ function G({ files: c, isMultiple: d, invalid: n, disabled: t, labels: i, onRemo
172
172
  onClick: o,
173
173
  type: "button",
174
174
  disabled: t,
175
- children: "Clear all"
175
+ children: i?.clearAll || "Clear all"
176
176
  }
177
177
  )
178
178
  ] }),
@@ -207,13 +207,13 @@ function ue({
207
207
  filesPosition: u = "below",
208
208
  invalid: U = !1,
209
209
  disabled: V = !1,
210
- "aria-invalid": B,
211
- generateId: L,
210
+ "aria-invalid": A,
211
+ generateId: B,
212
212
  labels: k,
213
213
  input: F,
214
214
  ...H
215
215
  }) {
216
- const [J, O] = E(!1), [K, Q] = E(!1), $ = te(null);
216
+ const [J, L] = E(!1), [K, Q] = E(!1), $ = te(null);
217
217
  re(() => {
218
218
  const e = () => {
219
219
  if ($.current) {
@@ -229,20 +229,20 @@ function ue({
229
229
  }
230
230
  return () => a.disconnect();
231
231
  }, []);
232
- const X = m?.join(",") || "", Y = j * 1024 * 1024, f = h || n !== void 0 || i !== void 0, D = f ? n || [] : d ? [d] : [], z = U || B, b = V || K, Z = L || ((e) => `${Date.now()}-${Math.random().toString(36).substring(2, 11)}-${e.name}`), I = (e) => ({
232
+ const X = m?.join(",") || "", Y = j * 1024 * 1024, f = h || n !== void 0 || i !== void 0, D = f ? n || [] : d ? [d] : [], z = U || A, b = V || K, Z = B || ((e) => `${Date.now()}-${Math.random().toString(36).substring(2, 11)}-${e.name}`), I = (e) => ({
233
233
  id: Z(e),
234
234
  file: e
235
235
  }), P = (e) => {
236
- b || (e.preventDefault(), O(!0));
236
+ b || (e.preventDefault(), L(!0));
237
237
  }, W = (e) => {
238
- b || (e.preventDefault(), O(!1));
238
+ b || (e.preventDefault(), L(!1));
239
239
  }, S = (e) => {
240
240
  if (!b)
241
- if (e.preventDefault(), O(!1), f) {
241
+ if (e.preventDefault(), L(!1), f) {
242
242
  const s = Array.from(e.dataTransfer.files).filter(T);
243
243
  if (s.length > 0) {
244
- const y = s.map(I), A = [...n || [], ...y].slice(0, x);
245
- i && i(A), p && p(y);
244
+ const y = s.map(I), _ = [...n || [], ...y].slice(0, x);
245
+ i && i(_), p && p(y);
246
246
  }
247
247
  } else {
248
248
  const a = e.dataTransfer.files[0];
@@ -256,8 +256,8 @@ function ue({
256
256
  if (f) {
257
257
  const s = (e.target.files ? Array.from(e.target.files) : []).filter(T);
258
258
  if (s.length > 0) {
259
- const y = s.map(I), A = [...n || [], ...y].slice(0, x);
260
- i && i(A), p && p(y);
259
+ const y = s.map(I), _ = [...n || [], ...y].slice(0, x);
260
+ i && i(_), p && p(y);
261
261
  }
262
262
  } else {
263
263
  const a = e.target.files?.[0];
@@ -268,7 +268,7 @@ function ue({
268
268
  }
269
269
  e.target.value = "";
270
270
  }
271
- }, R = (e) => {
271
+ }, O = (e) => {
272
272
  if (b) return;
273
273
  const a = D[e];
274
274
  if (f) {
@@ -283,7 +283,7 @@ function ue({
283
283
  !s && v ? v(w, "extension") : !y && v && v(w, "size");
284
284
  }
285
285
  return s && y;
286
- }, _ = () => {
286
+ }, R = () => {
287
287
  if (b) return;
288
288
  const e = [...D];
289
289
  f ? (i && i([]), g && e.length > 0 && g(e)) : (t && t(null), o && e.length > 0 && o(e[0]));
@@ -297,8 +297,8 @@ function ue({
297
297
  invalid: z,
298
298
  disabled: b,
299
299
  labels: k,
300
- onRemoveFile: R,
301
- onClearAll: _
300
+ onRemoveFile: O,
301
+ onClearAll: R
302
302
  }
303
303
  ),
304
304
  (f || D.length === 0) && /* @__PURE__ */ r.jsx(
@@ -328,8 +328,8 @@ function ue({
328
328
  invalid: z,
329
329
  disabled: b,
330
330
  labels: k,
331
- onRemoveFile: R,
332
- onClearAll: _
331
+ onRemoveFile: O,
332
+ onClearAll: R
333
333
  }
334
334
  ),
335
335
  f && u === "below" && /* @__PURE__ */ r.jsx(
@@ -340,8 +340,8 @@ function ue({
340
340
  invalid: z,
341
341
  disabled: b,
342
342
  labels: k,
343
- onRemoveFile: R,
344
- onClearAll: _
343
+ onRemoveFile: O,
344
+ onClearAll: R
345
345
  }
346
346
  )
347
347
  ] });
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-BB_1_6y_.cjs"),L=require("./button-CFJs0esR.cjs"),B=require("./icon-B7joBr0A.cjs"),D=require("./typography-Bj8oEDuE.cjs"),g=require("./index-DoxiiusW.cjs"),T=require("react");function P({isDragging:i,isMultiple:o,invalid:s,disabled:t,accept:m,acceptedExtensions:l,maxSizeInMB:f,maxFiles:u,labels:c,input:j,onDragOver:h,onDragLeave:N,onDrop:v,onFileChange:q}){const y=j?.id||`file-upload-${Math.random().toString(36).substring(2,11)}`;return r.jsxRuntimeExports.jsxs("div",{onDragOver:t?void 0:h,onDragLeave:t?void 0:N,onDrop:t?void 0:v,className:g.cn(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-BB_1_6y_.cjs"),B=require("./button-CFJs0esR.cjs"),A=require("./icon-B7joBr0A.cjs"),D=require("./typography-Bj8oEDuE.cjs"),g=require("./index-DoxiiusW.cjs"),T=require("react");function P({isDragging:i,isMultiple:o,invalid:s,disabled:t,accept:m,acceptedExtensions:l,maxSizeInMB:f,maxFiles:u,labels:c,input:j,onDragOver:h,onDragLeave:N,onDrop:v,onFileChange:q}){const y=j?.id||`file-upload-${Math.random().toString(36).substring(2,11)}`;return r.jsxRuntimeExports.jsxs("div",{onDragOver:t?void 0:h,onDragLeave:t?void 0:N,onDrop:t?void 0:v,className:g.cn(`
2
2
  adm:flex adm:flex-col adm:items-center adm:gap-6 adm:rounded-2xl
3
3
  adm:border-2
4
- `,"adm:border-dashed adm:bg-background adm:p-6 adm:transition-colors",{"adm:border-primary":i&&!s&&!t,"adm:border-destructive":s&&!t,"adm:border-input":!i&&!s,"adm:cursor-not-allowed adm:opacity-50":t}),children:[r.jsxRuntimeExports.jsx("div",{className:g.cn("adm:flex adm:items-center adm:justify-center adm:rounded-xl adm:p-2.5",s&&!t?"adm:bg-destructive/10":"adm:bg-primary-50"),children:r.jsxRuntimeExports.jsx(B.Icon,{symbol:"text_snippet",className:s&&!t?"adm:text-destructive":"adm:text-primary"})}),r.jsxRuntimeExports.jsxs("div",{className:"adm:flex adm:flex-col adm:items-center adm:gap-2",children:[r.jsxRuntimeExports.jsx(D.Typography,{color:s&&!t?"destructive":void 0,children:c?.dragDrop||(o?"Drag and drop your files here or":"Drag and drop your file here or")}),r.jsxRuntimeExports.jsxs("label",{htmlFor:y,children:[r.jsxRuntimeExports.jsx("input",{...j,id:y,type:"file",accept:m,multiple:o,onChange:q,disabled:t,className:"adm:hidden"}),r.jsxRuntimeExports.jsx(L.Button,{asChild:!0,type:"button",variant:"link",className:g.cn("adm:cursor-pointer",t&&`
4
+ `,"adm:border-dashed adm:bg-background adm:p-6 adm:transition-colors",{"adm:border-primary":i&&!s&&!t,"adm:border-destructive":s&&!t,"adm:border-input":!i&&!s,"adm:cursor-not-allowed adm:opacity-50":t}),children:[r.jsxRuntimeExports.jsx("div",{className:g.cn("adm:flex adm:items-center adm:justify-center adm:rounded-xl adm:p-2.5",s&&!t?"adm:bg-destructive/10":"adm:bg-primary-50"),children:r.jsxRuntimeExports.jsx(A.Icon,{symbol:"text_snippet",className:s&&!t?"adm:text-destructive":"adm:text-primary"})}),r.jsxRuntimeExports.jsxs("div",{className:"adm:flex adm:flex-col adm:items-center adm:gap-2",children:[r.jsxRuntimeExports.jsx(D.Typography,{color:s&&!t?"destructive":void 0,children:c?.dragDrop||(o?"Drag and drop your files here or":"Drag and drop your file here or")}),r.jsxRuntimeExports.jsxs("label",{htmlFor:y,children:[r.jsxRuntimeExports.jsx("input",{...j,id:y,type:"file",accept:m,multiple:o,onChange:q,disabled:t,className:"adm:hidden"}),r.jsxRuntimeExports.jsx(B.Button,{asChild:!0,type:"button",variant:"link",className:g.cn("adm:cursor-pointer",t&&`
5
5
  adm:pointer-events-none
6
- `),disabled:t,children:r.jsxRuntimeExports.jsx("span",{children:c?.selectFile||(o?"Select files":"Select the file")})})]})]}),r.jsxRuntimeExports.jsx(D.Typography,{className:"adm:text-center",color:s&&!t?"destructive":"muted",children:c?.fileRequirements||(l&&l.length>0?`Allowed files: ${l.join(", ")}. Maximum size ${f} MB${o?`. Up to ${u} files`:""}.`:`Maximum size ${f} MB${o?`. Up to ${u} files`:""}.`)})]})}function F({file:i,invalid:o,disabled:s,onRemove:t}){return r.jsxRuntimeExports.jsxs("div",{className:g.cn("adm:flex adm:items-center adm:gap-4 adm:rounded-2xl adm:border adm:p-6",o&&!s?"adm:border-destructive adm:bg-destructive/5":"adm:border-input adm:bg-muted",s&&"adm:cursor-not-allowed adm:opacity-50"),children:[r.jsxRuntimeExports.jsx("div",{className:g.cn("adm:flex adm:items-center adm:justify-center adm:rounded-xl adm:p-2.5",o&&!s?"adm:bg-destructive/15":"adm:bg-primary/15"),children:r.jsxRuntimeExports.jsx(B.Icon,{symbol:"text_snippet",className:o&&!s?"adm:text-destructive":"adm:text-primary"})}),r.jsxRuntimeExports.jsx("div",{className:"adm:flex adm:min-w-0 adm:flex-1 adm:flex-col adm:gap-1",children:r.jsxRuntimeExports.jsx(D.Typography,{className:g.cn("adm:min-w-0 adm:truncate adm:font-semibold"),children:i.name})}),r.jsxRuntimeExports.jsxs(D.Typography,{className:"adm:shrink-0",color:"muted",children:[(i.size/1024/1024).toFixed(1)," MB"]}),r.jsxRuntimeExports.jsx(L.Button,{variant:"destructive-medium",onClick:t,type:"button",disabled:s,children:r.jsxRuntimeExports.jsx(B.Icon,{symbol:"delete",className:"adm:text-destructive"})})]})}function O({files:i,isMultiple:o,invalid:s,disabled:t,labels:m,onRemoveFile:l,onClearAll:f}){return i.length===0?null:r.jsxRuntimeExports.jsxs("div",{className:"adm:flex adm:flex-col adm:gap-3",children:[o&&i.length>1&&r.jsxRuntimeExports.jsxs("div",{className:"adm:flex adm:items-center adm:justify-between",children:[r.jsxRuntimeExports.jsx(D.Typography,{className:"adm:text-sm adm:font-medium",color:s&&!t?"destructive":void 0,children:m?.filesSelected?.(i.length)||`${i.length} file${i.length!==1?"s":""} selected`}),r.jsxRuntimeExports.jsx(L.Button,{variant:"ghost",size:"sm",onClick:f,type:"button",disabled:t,children:"Clear all"})]}),i.map((u,c)=>r.jsxRuntimeExports.jsx(F,{file:u,invalid:s,disabled:t,onRemove:()=>l(c)},`${u.name}-${c}`))]})}function S({className:i,selectedFile:o,selectedFiles:s,onFileSelect:t,onFilesSelect:m,onFileAdd:l,onFileRemove:f,onFilesAdd:u,onFilesRemove:c,onInvalidFile:j,acceptedExtensions:h,maxSizeInMB:N=50,maxFiles:v=10,multiple:q=!1,filesPosition:y="below",invalid:A=!1,disabled:U=!1,"aria-invalid":M,labels:$,input:V,..._}){const[G,k]=T.useState(!1),[H,J]=T.useState(!1),R=T.useRef(null);T.useEffect(()=>{const e=()=>{if(R.current){const n=R.current.closest("fieldset");J(n?.disabled??!1)}};e();const a=new MutationObserver(e);if(R.current){const n=R.current.closest("fieldset");n&&a.observe(n,{attributes:!0,attributeFilter:["disabled"]})}return()=>a.disconnect()},[]);const K=h?.join(",")||"",Q=N*1024*1024,d=q||s!==void 0||m!==void 0,p=d?s||[]:o?[o]:[],w=A||M,x=U||H,W=e=>{x||(e.preventDefault(),k(!0))},X=e=>{x||(e.preventDefault(),k(!1))},Y=e=>{if(!x)if(e.preventDefault(),k(!1),d){const n=Array.from(e.dataTransfer.files).filter(C);if(n.length>0){const E=[...s||[],...n].slice(0,v);m&&m(E),u&&u(n)}}else{const a=e.dataTransfer.files[0];a&&C(a)&&(t&&t(a),l&&l(a))}},Z=e=>{if(!x){if(d){const n=(e.target.files?Array.from(e.target.files):[]).filter(C);if(n.length>0){const E=[...s||[],...n].slice(0,v);m&&m(E),u&&u(n)}}else{const a=e.target.files?.[0];a&&C(a)&&(t&&t(a),l&&l(a))}e.target.value=""}},z=e=>{if(x)return;const a=p[e];if(d){const n=p.filter((b,E)=>E!==e);m&&m(n),c&&a&&c([a])}else t&&t(null),f&&a&&f(a)},C=e=>{const a=e.name.substring(e.name.lastIndexOf(".")),n=!h||h.length===0||h.includes(a.toLowerCase()),b=e.size<=Q;return!n&&j?j(e,"extension"):!b&&j&&j(e,"size"),n&&b},I=()=>{if(x)return;const e=[...p];d?(m&&m([]),c&&e.length>0&&c(e)):(t&&t(null),f&&e.length>0&&f(e[0]))};return r.jsxRuntimeExports.jsxs("div",{ref:R,className:g.cn("adm:flex adm:flex-col adm:gap-4",i),..._,children:[d&&y==="above"&&r.jsxRuntimeExports.jsx(O,{files:p,isMultiple:d,invalid:w,disabled:x,labels:$,onRemoveFile:z,onClearAll:I}),(d||p.length===0)&&r.jsxRuntimeExports.jsx(P,{isDragging:G,isMultiple:d,invalid:w,disabled:x,accept:K,acceptedExtensions:h,maxSizeInMB:N,maxFiles:v,labels:$,input:V,onDragOver:W,onDragLeave:X,onDrop:Y,onFileChange:Z}),!d&&p.length>0&&r.jsxRuntimeExports.jsx(O,{files:p,isMultiple:d,invalid:w,disabled:x,labels:$,onRemoveFile:z,onClearAll:I}),d&&y==="below"&&r.jsxRuntimeExports.jsx(O,{files:p,isMultiple:d,invalid:w,disabled:x,labels:$,onRemoveFile:z,onClearAll:I})]})}exports.FileUpload=S;
6
+ `),disabled:t,children:r.jsxRuntimeExports.jsx("span",{children:c?.selectFile||(o?"Select files":"Select the file")})})]})]}),r.jsxRuntimeExports.jsx(D.Typography,{className:"adm:text-center",color:s&&!t?"destructive":"muted",children:c?.fileRequirements||(l&&l.length>0?`Allowed files: ${l.join(", ")}. Maximum size ${f} MB${o?`. Up to ${u} files`:""}.`:`Maximum size ${f} MB${o?`. Up to ${u} files`:""}.`)})]})}function F({file:i,invalid:o,disabled:s,onRemove:t}){return r.jsxRuntimeExports.jsxs("div",{className:g.cn("adm:flex adm:items-center adm:gap-4 adm:rounded-2xl adm:border adm:p-6",o&&!s?"adm:border-destructive adm:bg-destructive/5":"adm:border-input adm:bg-muted",s&&"adm:cursor-not-allowed adm:opacity-50"),children:[r.jsxRuntimeExports.jsx("div",{className:g.cn("adm:flex adm:items-center adm:justify-center adm:rounded-xl adm:p-2.5",o&&!s?"adm:bg-destructive/15":"adm:bg-primary/15"),children:r.jsxRuntimeExports.jsx(A.Icon,{symbol:"text_snippet",className:o&&!s?"adm:text-destructive":"adm:text-primary"})}),r.jsxRuntimeExports.jsx("div",{className:"adm:flex adm:min-w-0 adm:flex-1 adm:flex-col adm:gap-1",children:r.jsxRuntimeExports.jsx(D.Typography,{className:g.cn("adm:min-w-0 adm:truncate adm:font-semibold"),children:i.name})}),r.jsxRuntimeExports.jsxs(D.Typography,{className:"adm:shrink-0",color:"muted",children:[(i.size/1024/1024).toFixed(1)," MB"]}),r.jsxRuntimeExports.jsx(B.Button,{variant:"destructive-medium",onClick:t,type:"button",disabled:s,children:r.jsxRuntimeExports.jsx(A.Icon,{symbol:"delete",className:"adm:text-destructive"})})]})}function O({files:i,isMultiple:o,invalid:s,disabled:t,labels:m,onRemoveFile:l,onClearAll:f}){return i.length===0?null:r.jsxRuntimeExports.jsxs("div",{className:"adm:flex adm:flex-col adm:gap-3",children:[o&&i.length>1&&r.jsxRuntimeExports.jsxs("div",{className:"adm:flex adm:items-center adm:justify-between",children:[r.jsxRuntimeExports.jsx(D.Typography,{className:"adm:text-sm adm:font-medium",color:s&&!t?"destructive":void 0,children:m?.filesSelected?.(i.length)||`${i.length} file${i.length!==1?"s":""} selected`}),r.jsxRuntimeExports.jsx(B.Button,{variant:"ghost",size:"sm",onClick:f,type:"button",disabled:t,children:m?.clearAll||"Clear all"})]}),i.map((u,c)=>r.jsxRuntimeExports.jsx(F,{file:u,invalid:s,disabled:t,onRemove:()=>l(c)},`${u.name}-${c}`))]})}function S({className:i,selectedFile:o,selectedFiles:s,onFileSelect:t,onFilesSelect:m,onFileAdd:l,onFileRemove:f,onFilesAdd:u,onFilesRemove:c,onInvalidFile:j,acceptedExtensions:h,maxSizeInMB:N=50,maxFiles:v=10,multiple:q=!1,filesPosition:y="below",invalid:L=!1,disabled:U=!1,"aria-invalid":M,labels:$,input:V,..._}){const[G,k]=T.useState(!1),[H,J]=T.useState(!1),R=T.useRef(null);T.useEffect(()=>{const e=()=>{if(R.current){const n=R.current.closest("fieldset");J(n?.disabled??!1)}};e();const a=new MutationObserver(e);if(R.current){const n=R.current.closest("fieldset");n&&a.observe(n,{attributes:!0,attributeFilter:["disabled"]})}return()=>a.disconnect()},[]);const K=h?.join(",")||"",Q=N*1024*1024,d=q||s!==void 0||m!==void 0,p=d?s||[]:o?[o]:[],w=L||M,x=U||H,W=e=>{x||(e.preventDefault(),k(!0))},X=e=>{x||(e.preventDefault(),k(!1))},Y=e=>{if(!x)if(e.preventDefault(),k(!1),d){const n=Array.from(e.dataTransfer.files).filter(C);if(n.length>0){const E=[...s||[],...n].slice(0,v);m&&m(E),u&&u(n)}}else{const a=e.dataTransfer.files[0];a&&C(a)&&(t&&t(a),l&&l(a))}},Z=e=>{if(!x){if(d){const n=(e.target.files?Array.from(e.target.files):[]).filter(C);if(n.length>0){const E=[...s||[],...n].slice(0,v);m&&m(E),u&&u(n)}}else{const a=e.target.files?.[0];a&&C(a)&&(t&&t(a),l&&l(a))}e.target.value=""}},z=e=>{if(x)return;const a=p[e];if(d){const n=p.filter((b,E)=>E!==e);m&&m(n),c&&a&&c([a])}else t&&t(null),f&&a&&f(a)},C=e=>{const a=e.name.substring(e.name.lastIndexOf(".")),n=!h||h.length===0||h.includes(a.toLowerCase()),b=e.size<=Q;return!n&&j?j(e,"extension"):!b&&j&&j(e,"size"),n&&b},I=()=>{if(x)return;const e=[...p];d?(m&&m([]),c&&e.length>0&&c(e)):(t&&t(null),f&&e.length>0&&f(e[0]))};return r.jsxRuntimeExports.jsxs("div",{ref:R,className:g.cn("adm:flex adm:flex-col adm:gap-4",i),..._,children:[d&&y==="above"&&r.jsxRuntimeExports.jsx(O,{files:p,isMultiple:d,invalid:w,disabled:x,labels:$,onRemoveFile:z,onClearAll:I}),(d||p.length===0)&&r.jsxRuntimeExports.jsx(P,{isDragging:G,isMultiple:d,invalid:w,disabled:x,accept:K,acceptedExtensions:h,maxSizeInMB:N,maxFiles:v,labels:$,input:V,onDragOver:W,onDragLeave:X,onDrop:Y,onFileChange:Z}),!d&&p.length>0&&r.jsxRuntimeExports.jsx(O,{files:p,isMultiple:d,invalid:w,disabled:x,labels:$,onRemoveFile:z,onClearAll:I}),d&&y==="below"&&r.jsxRuntimeExports.jsx(O,{files:p,isMultiple:d,invalid:w,disabled:x,labels:$,onRemoveFile:z,onClearAll:I})]})}exports.FileUpload=S;
@@ -1,6 +1,6 @@
1
1
  import { j as r } from "./jsx-runtime-BzflLqGi.js";
2
2
  import { B } from "./button-BnUlAtuD.js";
3
- import { I as A } from "./icon-BFQz1tQC.js";
3
+ import { I as R } from "./icon-BFQz1tQC.js";
4
4
  import { T as $ } from "./typography-MnY0LQoZ.js";
5
5
  import { c as v } from "./index-CRiPKpXj.js";
6
6
  import { useState as U, useRef as P, useEffect as F } from "react";
@@ -49,7 +49,7 @@ function S({
49
49
  a && !t ? "adm:bg-destructive/10" : "adm:bg-primary-50"
50
50
  ),
51
51
  children: /* @__PURE__ */ r.jsx(
52
- A,
52
+ R,
53
53
  {
54
54
  symbol: "text_snippet",
55
55
  className: a && !t ? "adm:text-destructive" : "adm:text-primary"
@@ -111,7 +111,7 @@ function ee({ file: i, invalid: d, disabled: a, onRemove: t }) {
111
111
  d && !a ? "adm:bg-destructive/15" : "adm:bg-primary/15"
112
112
  ),
113
113
  children: /* @__PURE__ */ r.jsx(
114
- A,
114
+ R,
115
115
  {
116
116
  symbol: "text_snippet",
117
117
  className: d && !a ? "adm:text-destructive" : "adm:text-primary"
@@ -139,14 +139,14 @@ function ee({ file: i, invalid: d, disabled: a, onRemove: t }) {
139
139
  onClick: t,
140
140
  type: "button",
141
141
  disabled: a,
142
- children: /* @__PURE__ */ r.jsx(A, { symbol: "delete", className: "adm:text-destructive" })
142
+ children: /* @__PURE__ */ r.jsx(R, { symbol: "delete", className: "adm:text-destructive" })
143
143
  }
144
144
  )
145
145
  ]
146
146
  }
147
147
  );
148
148
  }
149
- function R({ files: i, isMultiple: d, invalid: a, disabled: t, labels: m, onRemoveFile: c, onClearAll: h }) {
149
+ function O({ files: i, isMultiple: d, invalid: a, disabled: t, labels: m, onRemoveFile: c, onClearAll: h }) {
150
150
  return i.length === 0 ? null : /* @__PURE__ */ r.jsxs("div", { className: "adm:flex adm:flex-col adm:gap-3", children: [
151
151
  d && i.length > 1 && /* @__PURE__ */ r.jsxs("div", { className: "adm:flex adm:items-center adm:justify-between", children: [
152
152
  /* @__PURE__ */ r.jsx($, { className: "adm:text-sm adm:font-medium", color: a && !t ? "destructive" : void 0, children: m?.filesSelected?.(i.length) || `${i.length} file${i.length !== 1 ? "s" : ""} selected` }),
@@ -158,7 +158,7 @@ function R({ files: i, isMultiple: d, invalid: a, disabled: t, labels: m, onRemo
158
158
  onClick: h,
159
159
  type: "button",
160
160
  disabled: t,
161
- children: "Clear all"
161
+ children: m?.clearAll || "Clear all"
162
162
  }
163
163
  )
164
164
  ] }),
@@ -197,29 +197,29 @@ function de({
197
197
  input: q,
198
198
  ...G
199
199
  }) {
200
- const [H, I] = U(!1), [J, K] = U(!1), b = P(null);
200
+ const [H, A] = U(!1), [J, K] = U(!1), D = P(null);
201
201
  F(() => {
202
202
  const e = () => {
203
- if (b.current) {
204
- const n = b.current.closest("fieldset");
203
+ if (D.current) {
204
+ const n = D.current.closest("fieldset");
205
205
  K(n?.disabled ?? !1);
206
206
  }
207
207
  };
208
208
  e();
209
209
  const s = new MutationObserver(e);
210
- if (b.current) {
211
- const n = b.current.closest("fieldset");
210
+ if (D.current) {
211
+ const n = D.current.closest("fieldset");
212
212
  n && s.observe(n, { attributes: !0, attributeFilter: ["disabled"] });
213
213
  }
214
214
  return () => s.disconnect();
215
215
  }, []);
216
216
  const Q = g?.join(",") || "", W = w * 1024 * 1024, o = T || a !== void 0 || m !== void 0, p = o ? a || [] : d ? [d] : [], k = V || M, u = _ || J, X = (e) => {
217
- u || (e.preventDefault(), I(!0));
217
+ u || (e.preventDefault(), A(!0));
218
218
  }, Y = (e) => {
219
- u || (e.preventDefault(), I(!1));
219
+ u || (e.preventDefault(), A(!1));
220
220
  }, Z = (e) => {
221
221
  if (!u)
222
- if (e.preventDefault(), I(!1), o) {
222
+ if (e.preventDefault(), A(!1), o) {
223
223
  const n = Array.from(e.dataTransfer.files).filter(z);
224
224
  if (n.length > 0) {
225
225
  const N = [...a || [], ...n].slice(0, j);
@@ -243,33 +243,33 @@ function de({
243
243
  }
244
244
  e.target.value = "";
245
245
  }
246
- }, L = (e) => {
246
+ }, I = (e) => {
247
247
  if (u) return;
248
248
  const s = p[e];
249
249
  if (o) {
250
- const n = p.filter((D, N) => N !== e);
250
+ const n = p.filter((b, N) => N !== e);
251
251
  m && m(n), l && s && l([s]);
252
252
  } else
253
253
  t && t(null), h && s && h(s);
254
254
  }, z = (e) => {
255
- const s = e.name.substring(e.name.lastIndexOf(".")), n = !g || g.length === 0 || g.includes(s.toLowerCase()), D = e.size <= W;
256
- return !n && x ? x(e, "extension") : !D && x && x(e, "size"), n && D;
257
- }, O = () => {
255
+ const s = e.name.substring(e.name.lastIndexOf(".")), n = !g || g.length === 0 || g.includes(s.toLowerCase()), b = e.size <= W;
256
+ return !n && x ? x(e, "extension") : !b && x && x(e, "size"), n && b;
257
+ }, L = () => {
258
258
  if (u) return;
259
259
  const e = [...p];
260
260
  o ? (m && m([]), l && e.length > 0 && l(e)) : (t && t(null), h && e.length > 0 && h(e[0]));
261
261
  };
262
- return /* @__PURE__ */ r.jsxs("div", { ref: b, className: v("adm:flex adm:flex-col adm:gap-4", i), ...G, children: [
262
+ return /* @__PURE__ */ r.jsxs("div", { ref: D, className: v("adm:flex adm:flex-col adm:gap-4", i), ...G, children: [
263
263
  o && y === "above" && /* @__PURE__ */ r.jsx(
264
- R,
264
+ O,
265
265
  {
266
266
  files: p,
267
267
  isMultiple: o,
268
268
  invalid: k,
269
269
  disabled: u,
270
270
  labels: C,
271
- onRemoveFile: L,
272
- onClearAll: O
271
+ onRemoveFile: I,
272
+ onClearAll: L
273
273
  }
274
274
  ),
275
275
  (o || p.length === 0) && /* @__PURE__ */ r.jsx(
@@ -292,27 +292,27 @@ function de({
292
292
  }
293
293
  ),
294
294
  !o && p.length > 0 && /* @__PURE__ */ r.jsx(
295
- R,
295
+ O,
296
296
  {
297
297
  files: p,
298
298
  isMultiple: o,
299
299
  invalid: k,
300
300
  disabled: u,
301
301
  labels: C,
302
- onRemoveFile: L,
303
- onClearAll: O
302
+ onRemoveFile: I,
303
+ onClearAll: L
304
304
  }
305
305
  ),
306
306
  o && y === "below" && /* @__PURE__ */ r.jsx(
307
- R,
307
+ O,
308
308
  {
309
309
  files: p,
310
310
  isMultiple: o,
311
311
  invalid: k,
312
312
  disabled: u,
313
313
  labels: C,
314
- onRemoveFile: L,
315
- onClearAll: O
314
+ onRemoveFile: I,
315
+ onClearAll: L
316
316
  }
317
317
  )
318
318
  ] });
@@ -647,6 +647,7 @@ type FileUploadV2Labels = {
647
647
  selectFile?: string
648
648
  fileRequirements?: string
649
649
  filesSelected?: (count: number) => string
650
+ clearAll?: string
650
651
  statusUploading?: string
651
652
  statusSuccess?: string
652
653
  statusDeleting?: string
@@ -675,6 +676,9 @@ Customizable labels for internationalization and status messages.
675
676
  labels={{
676
677
  dragDrop: "Arrastra tus archivos aquí",
677
678
  selectFile: "Seleccionar archivos",
679
+ filesSelected: (count) =>
680
+ `${count} archivo${count !== 1 ? "s" : ""} seleccionado${count !== 1 ? "s" : ""}`,
681
+ clearAll: "Limpiar todo",
678
682
  statusUploading: "Subiendo...",
679
683
  statusSuccess: "✓ Subido correctamente",
680
684
  statusDeleting: "Eliminando...",
@@ -1249,6 +1253,11 @@ export type FileUploadV2Labels = {
1249
1253
  selectFile?: string;
1250
1254
  fileRequirements?: string;
1251
1255
  filesSelected?: (count: number) => string;
1256
+ clearAll?: string;
1257
+ statusUploading?: string;
1258
+ statusSuccess?: string;
1259
+ statusDeleting?: string;
1260
+ statusError?: string;
1252
1261
  };
1253
1262
 
1254
1263
  export type FileUploadV2Props = ComponentProps<"div"> &
@@ -182,6 +182,7 @@ type FileUploadLabels = {
182
182
  selectFile?: string
183
183
  fileRequirements?: string
184
184
  filesSelected?: (count: number) => string
185
+ clearAll?: string
185
186
  }
186
187
  ```
187
188
 
@@ -197,6 +198,9 @@ Customizable labels for internationalization or specific texts.
197
198
  dragDrop: "Drag and drop your file here or",
198
199
  selectFile: "Select the file",
199
200
  fileRequirements: "Allowed files: .xls, .xlsx. Maximum size 50 MB.",
201
+ filesSelected: (count) =>
202
+ `${count} archivo${count !== 1 ? "s" : ""} seleccionado${count !== 1 ? "s" : ""}`,
203
+ clearAll: "Limpiar todo",
200
204
  }}
201
205
  />
202
206
  ```
@@ -971,6 +975,7 @@ export type FileUploadLabels = {
971
975
  selectFile?: string;
972
976
  fileRequirements?: string;
973
977
  filesSelected?: (count: number) => string;
978
+ clearAll?: string;
974
979
  };
975
980
 
976
981
  export type FileUploadProps = ComponentProps<"div"> &
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamosuiteservices/ui",
3
- "version": "2.18.2",
3
+ "version": "2.18.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",