fina-react-ds 2.0.3 → 2.0.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/components/file-uploader.js +1 -1
- package/package.json +12 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
var z=Object.defineProperty;var o=(i,l)=>z(i,"name",{value:l,configurable:!0});import{jsxs as r,Fragment as f,jsx as e}from"react/jsx-runtime";import{useState as j,useCallback as
|
|
1
|
+
var z=Object.defineProperty;var o=(i,l)=>z(i,"name",{value:l,configurable:!0});import{jsxs as r,Fragment as f,jsx as e}from"react/jsx-runtime";import{useState as j,useCallback as x,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:a,ref:b}){const[d,u]=j([]),v=x(n=>{u(n),i?.(n.length>0?n[0]:null)},[i]),{getRootProps:g,getInputProps:h,acceptedFiles:m,open:y,rootRef:t}=D({maxFiles:1,noClick:!0,onDrop:v,accept:a,onFileDialogCancel:o(()=>{t?.current&&t.current.focus()},"onFileDialogCancel")});k(b,()=>({focus:o(()=>{t?.current&&t.current.focus()},"focus")}));const N=x(n=>{let s=0,p="ko";return s=n.size/1e3,s>1e3&&(s/=1e3,p="mo"),s.toFixed(2)+" "+p},[]);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:[d.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:[m[0].name,e("br",{}),N(m[0])]}),e(I,{type:"button",color:"destructive",variant:"ghost",onClick:o(()=>{u([]),i?.(null),t?.current?.focus()},"onClick"),children:"Supprimer"})]}),d.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(a).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": "2.0.
|
|
8
|
+
"version": "2.0.4",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"files": [
|
|
11
11
|
"dist"
|
|
@@ -52,16 +52,6 @@
|
|
|
52
52
|
]
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
|
-
"scripts": {
|
|
56
|
-
"dev": "vite",
|
|
57
|
-
"build": "rimraf dist && pnpm build:types && pnpm build:components && pnpm build:clean",
|
|
58
|
-
"build:types": "tsc -p tsconfig.build.json && tsc-alias",
|
|
59
|
-
"build:themes": "pnpm dlx @tailwindcss/cli -i ./src/themes/base.css -o ./dist/themes/base.css",
|
|
60
|
-
"build:components": "vite build",
|
|
61
|
-
"build:clean": "rimraf dist/vite.config.d.ts dist/vite.config.d.ts.map",
|
|
62
|
-
"lint": "eslint .",
|
|
63
|
-
"preview": "vite preview"
|
|
64
|
-
},
|
|
65
55
|
"dependencies": {
|
|
66
56
|
"@base-ui/react": "^1.1.0",
|
|
67
57
|
"@ckeditor/ckeditor5-react": "^11.0.1",
|
|
@@ -121,14 +111,17 @@
|
|
|
121
111
|
"sideEffects": [
|
|
122
112
|
"**/*.css"
|
|
123
113
|
],
|
|
124
|
-
"pnpm": {
|
|
125
|
-
"onlyBuiltDependencies": [
|
|
126
|
-
"@parcel/watcher",
|
|
127
|
-
"@swc/core",
|
|
128
|
-
"esbuild"
|
|
129
|
-
]
|
|
130
|
-
},
|
|
131
114
|
"eslintConfig": {
|
|
132
115
|
"extends": []
|
|
116
|
+
},
|
|
117
|
+
"scripts": {
|
|
118
|
+
"dev": "vite",
|
|
119
|
+
"build": "rimraf dist && pnpm build:types && pnpm build:components && pnpm build:clean",
|
|
120
|
+
"build:types": "tsc -p tsconfig.build.json && tsc-alias",
|
|
121
|
+
"build:themes": "pnpm dlx @tailwindcss/cli -i ./src/themes/base.css -o ./dist/themes/base.css",
|
|
122
|
+
"build:components": "vite build",
|
|
123
|
+
"build:clean": "rimraf dist/vite.config.d.ts dist/vite.config.d.ts.map",
|
|
124
|
+
"lint": "eslint .",
|
|
125
|
+
"preview": "vite preview"
|
|
133
126
|
}
|
|
134
|
-
}
|
|
127
|
+
}
|