fina-react-ds 1.0.49 → 1.0.50

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.
@@ -1 +1 @@
1
- var F=Object.defineProperty;var n=(i,c)=>F(i,"name",{value:c,configurable:!0});import{jsxs as r,jsx as e,Fragment as f}from"react/jsx-runtime";import{useState as D,useImperativeHandle as C,useCallback as p}from"react";import{FileIcon as x,DownloadIcon as I,UploadIcon as S}from"lucide-react";import{useDropzone as w}from"react-dropzone";import{cn as o}from"../lib/utils.js";import{Button as b}from"./button.js";function O({onChange:i,"aria-invalid":c,fileTypes:h,ref:v}){const[d,a]=D([]);C(v,()=>({focus:n(()=>{t?.current&&t.current.focus()},"focus")}));const g=p(l=>{a(l),i?.(l.length>0?l[0]:null)},[i]),y=n(()=>{t?.current&&t.current.focus()},"handleFileDialogCancel"),{getRootProps:N,getInputProps:z,acceptedFiles:u,open:j,rootRef:t}=w({maxFiles:1,noClick:!0,onDrop:g,onFileDialogCancel:y}),k=p(l=>{let s=0,m="ko";return s=l.size/1e3,s>1e3&&(s/=1e3,m="mo"),s.toFixed(2)+" "+m},[]);return r("div",{className:"flex space-x-2 items-center h-50",children:[r("div",{className:"flex-1 flex-col h-full shrink-0 bg-accent rounded-md flex items-center justify-center",children:[e("div",{className:o("bg-primary text-primary-foreground flex items-center justify-center rounded-full size-10 mb-4"),children:e(x,{className:"size-4"})}),e("div",{className:"mb-4 text-center",children:"Mon super fichier"}),e(b,{type:"button",color:"info",size:"icon",variant:"ghost",onClick:n(()=>{a([]),i?.(null),t?.current?.focus()},"onClick"),children:e(I,{})})]}),r("div",{...N(),className:o("bg-input border border-input-border flex flex-col h-50 flex-2 rounded-md px-3 py-1 text-base shadow-xs items-center justify-center md:text-sm outline-none","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive"),"aria-invalid":c,children:[d.length>0&&r(f,{children:[e("div",{className:o("bg-primary text-primary-foreground flex items-center justify-center rounded-full size-10 mb-4"),children:e(x,{className:"size-4"})}),r("div",{className:"mb-4 text-center",children:[u[0].name,e("br",{}),k(u[0])]}),e(b,{type:"button",color:"destructive",variant:"ghost",onClick:n(()=>{a([]),i?.(null),t?.current?.focus()},"onClick"),children:"Supprimer"})]}),d.length===0&&r(f,{children:[e("div",{className:o("bg-primary text-primary-foreground flex items-center justify-center rounded-full size-10 mb-4"),children:e(S,{className:"size-4"})}),r("div",{className:"mb-4",children:["Glisser-déposer ou"," ",e("span",{className:"font-bold underline cursor-pointer",onClick:j,children:"Choisir un fichier"})," ","à uploader"]}),r("div",{className:"text-center text-sm md:text-xs",children:["Formats acceptés : ",Object.keys(h).join(", "),e("br",{}),"Taille max : 5Mo"]})]}),e("input",{...z()})]})]})}n(O,"FileUploader");export{O as FileUploader};
1
+ var z=Object.defineProperty;var o=(i,l)=>z(i,"name",{value:l,configurable:!0});import{jsxs as r,jsx as e,Fragment as f}from"react/jsx-runtime";import{useState as j,useCallback as p,useImperativeHandle as k}from"react";import{FileIcon as F,UploadIcon as C}from"lucide-react";import{useDropzone as D}from"react-dropzone";import{cn as c}from"../lib/utils.js";import{Button as I}from"./button.js";function H({onChange:i,"aria-invalid":l,fileTypes:x,ref:b}){const[a,d]=j([]),v=p(n=>{d(n),i?.(n.length>0?n[0]:null)},[i]),{getRootProps:g,getInputProps:h,acceptedFiles:u,open:y,rootRef:t}=D({maxFiles:1,noClick:!0,onDrop:v,onFileDialogCancel:o(()=>{t?.current&&t.current.focus()},"onFileDialogCancel")});k(b,()=>({focus:o(()=>{t?.current&&t.current.focus()},"focus")}));const N=p(n=>{let s=0,m="ko";return s=n.size/1e3,s>1e3&&(s/=1e3,m="mo"),s.toFixed(2)+" "+m},[]);return r("div",{...g(),className:c("bg-input border border-input-border flex flex-col h-50 flex-2 rounded-md px-3 py-1 text-base shadow-xs items-center justify-center md:text-sm outline-none","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive"),"aria-invalid":l,children:[a.length>0&&r(f,{children:[e("div",{className:c("bg-primary text-primary-foreground flex items-center justify-center rounded-full size-10 mb-4"),children:e(F,{className:"size-4"})}),r("div",{className:"mb-4 text-center",children:[u[0].name,e("br",{}),N(u[0])]}),e(I,{type:"button",color:"destructive",variant:"ghost",onClick:o(()=>{d([]),i?.(null),t?.current?.focus()},"onClick"),children:"Supprimer"})]}),a.length===0&&r(f,{children:[e("div",{className:c("bg-primary text-primary-foreground flex items-center justify-center rounded-full size-10 mb-4"),children:e(C,{className:"size-4"})}),r("div",{className:"mb-4",children:["Glisser-déposer ou"," ",e("span",{className:"font-bold underline cursor-pointer",onClick:y,children:"Choisir un fichier"})," ","à uploader"]}),r("div",{className:"text-center text-sm md:text-xs",children:["Formats acceptés : ",Object.keys(x).join(", "),e("br",{}),"Taille max : 5Mo"]})]}),e("input",{...h()})]})}o(H,"FileUploader");export{H as FileUploader};
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "https://github.com/F1na/fina-react-ds"
6
6
  },
7
7
  "private": false,
8
- "version": "1.0.49",
8
+ "version": "1.0.50",
9
9
  "type": "module",
10
10
  "files": [
11
11
  "dist"