@cgi-learning-hub/ui 1.3.3-dev.1732627187 → 1.3.3-dev.1732633701
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
|
-
"use strict";const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),p=require("../../createSvgIcon-DQqazotA.cjs"),I=require("../../Delete-Bb_PhA6v.cjs"),o=require("@mui/material"),S=require("react"),v=require("../../index-CEgiY5tJ.cjs"),C=require("../../Stack-elRjtOGk.cjs"),i=require("../../Typography-DyMSnhvs.cjs"),d=p.createSvgIcon(e.jsx("path",{d:"M19 7v2.99s-1.99.01-2 0V7h-3s.01-1.99 0-2h3V2h2v3h3v2zm-3 4V8h-3V5H5c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-8zM5 19l3-4 2 3 3-4 4 5z"}),"AddPhotoAlternate"),F=p.createSvgIcon(e.jsx("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"Create"),w=()=>e.jsxs(i.Typography,{textAlign:"center",fontSize:"14px",color:"grey.darker",children:[e.jsx(o.Box,{component:"span",fontWeight:"bold",children:"Glissez-déposez"})," ou ",e.jsx(o.Box,{component:"span",fontWeight:"bold",children:"cliquez"})," pour choisir une image"]}),D=()=>e.jsxs(i.Typography,{textAlign:"center",fontSize:"14px",color:"grey.darker",children:[e.jsx(o.Box,{component:"span",fontWeight:"bold",children:"Glissez"})," une image"]}),A=({defaultLabel:h=e.jsx(w,{}),dragLabel:x=e.jsx(D,{}),information:n,onFileChange:c=t=>{},width:g="160px",height:m="160px",...u})=>{const[t,s]=S.useState(null),j=r=>{const a=r[0]||null;s(a),c(a)},y=r=>{r.stopPropagation(),s(null),c(null)},b=r=>{r.stopPropagation(),l()},{open:l,getRootProps:f,getInputProps:k,isDragActive:z}=v.useDropzone({...u,maxFiles:1,onDropAccepted:j,accept:{"image/*":[".png",".jpeg",".jpg",".gif"]},noClick:!0});return e.jsxs(C.Stack,{direction:"column",justifyContent:"center",alignItems:"center",width:g,minWidth:"150px",minHeight:"150px",height:m,borderRadius:1,sx:{cursor:"pointer",position:"relative",background:`${!t&&"linear-gradient(180deg, #F5F7F9 0%, #FFF 100%)"}`,border:`${!t&&"1px dashed"}`,borderColor:r=>!t&&r.palette.grey.main},...f({onClick:l}),children:[e.jsx("input",{...k()}),t?e.jsxs(e.Fragment,{children:[e.jsxs(o.Box,{sx:{position:"absolute",top:"0.5rem",right:"0.5rem",display:"flex",gap:"0.3rem"},children:[e.jsx(o.Box,{onClick:b,sx:{backgroundColor:"common.white",display:"flex",borderRadius:"3px",alignItems:"center",justifyContent:"center",boxShadow:1,width:"2rem",height:"2rem",cursor:"pointer","&:hover":{backgroundColor:"grey.darker","& .MuiSvgIcon-root":{fill:r=>r.palette.common.white}}},children:e.jsx(F,{fontSize:"small"})}),e.jsx(o.Box,{onClick:y,sx:{backgroundColor:"common.white",display:"flex",borderRadius:"3px",alignItems:"center",boxShadow:1,justifyContent:"center",width:"2rem",height:"2rem",cursor:"pointer","&:hover":{backgroundColor:"grey.darker","& .MuiSvgIcon-root":{fill:r=>r.palette.common.white}}},children:e.jsx(I.DeleteIcon,{fontSize:"small"})})]}),e.jsx("img",{src:URL.createObjectURL(t),alt:t.name,style:{width:"auto",height:"100%",maxWidth:"100%",objectFit:"cover",borderRadius:"5px"}})]}):e.jsx(e.Fragment,{children:z?e.jsxs(e.Fragment,{children:[e.jsx(d,{color:"primary",style:{width:"2.5rem",height:"2.5rem"}}),x,n&&e.jsx(i.Typography,{textAlign:"center",fontSize:"12px",color:"grey",children:n})]}):e.jsxs(o.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",padding:"0.5rem",gap:"0.3rem"},children:[e.jsx(d,{color:"primary",style:{width:"2.5rem",height:"2.5rem"}}),h,n&&e.jsx(i.Typography,{textAlign:"center",fontSize:"12px",color:"grey",children:n})]})})]})};module.exports=A;
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as o, Fragment as c } from "react/jsx-runtime";
|
|
2
2
|
import { c as h } from "../../createSvgIcon-BS0Qe85N.js";
|
|
3
|
-
import { D as
|
|
4
|
-
import { Box as
|
|
3
|
+
import { D as v } from "../../Delete-Dip-1l7n.js";
|
|
4
|
+
import { Box as n } from "@mui/material";
|
|
5
5
|
import { useState as w } from "react";
|
|
6
6
|
import { u as D } from "../../index-BtGBke8y.js";
|
|
7
7
|
import { S as F } from "../../Stack-DbWQHN5i.js";
|
|
8
8
|
import { T as l } from "../../Typography-CizHc1nM.js";
|
|
9
|
-
const
|
|
9
|
+
const m = h(/* @__PURE__ */ e("path", {
|
|
10
10
|
d: "M19 7v2.99s-1.99.01-2 0V7h-3s.01-1.99 0-2h3V2h2v3h3v2zm-3 4V8h-3V5H5c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-8zM5 19l3-4 2 3 3-4 4 5z"
|
|
11
11
|
}), "AddPhotoAlternate"), A = h(/* @__PURE__ */ e("path", {
|
|
12
12
|
d: "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"
|
|
13
|
-
}), "Create"), j = () => /* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */ e(
|
|
13
|
+
}), "Create"), j = () => /* @__PURE__ */ o(l, { textAlign: "center", fontSize: "14px", color: "grey.darker", children: [
|
|
14
|
+
/* @__PURE__ */ e(n, { component: "span", fontWeight: "bold", children: "Glissez-déposez" }),
|
|
15
15
|
" ou ",
|
|
16
|
-
/* @__PURE__ */ e(
|
|
16
|
+
/* @__PURE__ */ e(n, { component: "span", fontWeight: "bold", children: "cliquez" }),
|
|
17
17
|
" pour choisir une image"
|
|
18
|
-
] }), P = () => /* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */ e(
|
|
18
|
+
] }), P = () => /* @__PURE__ */ o(l, { textAlign: "center", fontSize: "14px", color: "grey.darker", children: [
|
|
19
|
+
/* @__PURE__ */ e(n, { component: "span", fontWeight: "bold", children: "Glissez" }),
|
|
20
20
|
" une image"
|
|
21
21
|
] }), U = ({
|
|
22
22
|
defaultLabel: g = /* @__PURE__ */ e(j, {}),
|
|
23
23
|
dragLabel: u = /* @__PURE__ */ e(P, {}),
|
|
24
24
|
information: i,
|
|
25
|
-
onFileChange: a = (
|
|
25
|
+
onFileChange: a = (t) => {
|
|
26
26
|
},
|
|
27
|
-
width: x = "
|
|
28
|
-
height: f = "
|
|
27
|
+
width: x = "160px",
|
|
28
|
+
height: f = "160px",
|
|
29
29
|
...b
|
|
30
30
|
}) => {
|
|
31
|
-
const [
|
|
32
|
-
const
|
|
33
|
-
s(
|
|
34
|
-
}, k = (
|
|
35
|
-
|
|
36
|
-
}, z = (
|
|
37
|
-
|
|
38
|
-
}, { open: d, getRootProps: C, getInputProps: I, isDragActive:
|
|
31
|
+
const [t, s] = w(null), y = (r) => {
|
|
32
|
+
const p = r[0] || null;
|
|
33
|
+
s(p), a(p);
|
|
34
|
+
}, k = (r) => {
|
|
35
|
+
r.stopPropagation(), s(null), a(null);
|
|
36
|
+
}, z = (r) => {
|
|
37
|
+
r.stopPropagation(), d();
|
|
38
|
+
}, { open: d, getRootProps: C, getInputProps: I, isDragActive: S } = D({
|
|
39
39
|
...b,
|
|
40
40
|
maxFiles: 1,
|
|
41
41
|
onDropAccepted: y,
|
|
@@ -44,45 +44,43 @@ const p = h(/* @__PURE__ */ e("path", {
|
|
|
44
44
|
},
|
|
45
45
|
noClick: !0
|
|
46
46
|
});
|
|
47
|
-
return /* @__PURE__ */
|
|
47
|
+
return /* @__PURE__ */ o(
|
|
48
48
|
F,
|
|
49
49
|
{
|
|
50
50
|
direction: "column",
|
|
51
51
|
justifyContent: "center",
|
|
52
52
|
alignItems: "center",
|
|
53
|
-
spacing: 1,
|
|
54
53
|
width: x,
|
|
55
|
-
minWidth: "
|
|
56
|
-
minHeight: "
|
|
54
|
+
minWidth: "150px",
|
|
55
|
+
minHeight: "150px",
|
|
57
56
|
height: f,
|
|
58
|
-
padding: 1,
|
|
59
|
-
border: "1px dashed",
|
|
60
|
-
borderColor: "grey.main",
|
|
61
57
|
borderRadius: 1,
|
|
62
58
|
sx: {
|
|
63
59
|
cursor: "pointer",
|
|
64
60
|
position: "relative",
|
|
65
|
-
background: `${!
|
|
61
|
+
background: `${!t && "linear-gradient(180deg, #F5F7F9 0%, #FFF 100%)"}`,
|
|
62
|
+
border: `${!t && "1px dashed"}`,
|
|
63
|
+
borderColor: (r) => !t && r.palette.grey.main
|
|
66
64
|
},
|
|
67
65
|
...C({
|
|
68
66
|
onClick: d
|
|
69
67
|
}),
|
|
70
68
|
children: [
|
|
71
69
|
/* @__PURE__ */ e("input", { ...I() }),
|
|
72
|
-
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
|
|
70
|
+
t ? /* @__PURE__ */ o(c, { children: [
|
|
71
|
+
/* @__PURE__ */ o(
|
|
72
|
+
n,
|
|
75
73
|
{
|
|
76
74
|
sx: {
|
|
77
75
|
position: "absolute",
|
|
78
76
|
top: "0.5rem",
|
|
79
77
|
right: "0.5rem",
|
|
80
78
|
display: "flex",
|
|
81
|
-
gap: "0.
|
|
79
|
+
gap: "0.3rem"
|
|
82
80
|
},
|
|
83
81
|
children: [
|
|
84
82
|
/* @__PURE__ */ e(
|
|
85
|
-
|
|
83
|
+
n,
|
|
86
84
|
{
|
|
87
85
|
onClick: z,
|
|
88
86
|
sx: {
|
|
@@ -96,9 +94,9 @@ const p = h(/* @__PURE__ */ e("path", {
|
|
|
96
94
|
height: "2rem",
|
|
97
95
|
cursor: "pointer",
|
|
98
96
|
"&:hover": {
|
|
99
|
-
backgroundColor: "
|
|
97
|
+
backgroundColor: "grey.darker",
|
|
100
98
|
"& .MuiSvgIcon-root": {
|
|
101
|
-
fill: (
|
|
99
|
+
fill: (r) => r.palette.common.white
|
|
102
100
|
}
|
|
103
101
|
}
|
|
104
102
|
},
|
|
@@ -106,7 +104,7 @@ const p = h(/* @__PURE__ */ e("path", {
|
|
|
106
104
|
}
|
|
107
105
|
),
|
|
108
106
|
/* @__PURE__ */ e(
|
|
109
|
-
|
|
107
|
+
n,
|
|
110
108
|
{
|
|
111
109
|
onClick: k,
|
|
112
110
|
sx: {
|
|
@@ -120,13 +118,13 @@ const p = h(/* @__PURE__ */ e("path", {
|
|
|
120
118
|
height: "2rem",
|
|
121
119
|
cursor: "pointer",
|
|
122
120
|
"&:hover": {
|
|
123
|
-
backgroundColor: "
|
|
121
|
+
backgroundColor: "grey.darker",
|
|
124
122
|
"& .MuiSvgIcon-root": {
|
|
125
|
-
fill: (
|
|
123
|
+
fill: (r) => r.palette.common.white
|
|
126
124
|
}
|
|
127
125
|
}
|
|
128
126
|
},
|
|
129
|
-
children: /* @__PURE__ */ e(
|
|
127
|
+
children: /* @__PURE__ */ e(v, { fontSize: "small" })
|
|
130
128
|
}
|
|
131
129
|
)
|
|
132
130
|
]
|
|
@@ -135,37 +133,37 @@ const p = h(/* @__PURE__ */ e("path", {
|
|
|
135
133
|
/* @__PURE__ */ e(
|
|
136
134
|
"img",
|
|
137
135
|
{
|
|
138
|
-
src: URL.createObjectURL(
|
|
139
|
-
alt:
|
|
136
|
+
src: URL.createObjectURL(t),
|
|
137
|
+
alt: t.name,
|
|
140
138
|
style: {
|
|
141
139
|
width: "auto",
|
|
142
140
|
height: "100%",
|
|
143
141
|
maxWidth: "100%",
|
|
144
142
|
objectFit: "cover",
|
|
145
|
-
borderRadius: "
|
|
143
|
+
borderRadius: "5px"
|
|
146
144
|
}
|
|
147
145
|
}
|
|
148
146
|
)
|
|
149
|
-
] }) : /* @__PURE__ */ e(c, { children:
|
|
150
|
-
/* @__PURE__ */ e(
|
|
151
|
-
width: "
|
|
152
|
-
height: "
|
|
147
|
+
] }) : /* @__PURE__ */ e(c, { children: S ? /* @__PURE__ */ o(c, { children: [
|
|
148
|
+
/* @__PURE__ */ e(m, { color: "primary", style: {
|
|
149
|
+
width: "2.5rem",
|
|
150
|
+
height: "2.5rem"
|
|
153
151
|
} }),
|
|
154
152
|
u,
|
|
155
|
-
i && /* @__PURE__ */ e(l, { textAlign: "center", fontSize: "
|
|
156
|
-
] }) : /* @__PURE__ */
|
|
153
|
+
i && /* @__PURE__ */ e(l, { textAlign: "center", fontSize: "12px", color: "grey", children: i })
|
|
154
|
+
] }) : /* @__PURE__ */ o(n, { sx: {
|
|
157
155
|
display: "flex",
|
|
158
156
|
flexDirection: "column",
|
|
159
157
|
alignItems: "center",
|
|
160
158
|
padding: "0.5rem",
|
|
161
|
-
gap: "0.
|
|
159
|
+
gap: "0.3rem"
|
|
162
160
|
}, children: [
|
|
163
|
-
/* @__PURE__ */ e(
|
|
164
|
-
width: "
|
|
165
|
-
height: "
|
|
161
|
+
/* @__PURE__ */ e(m, { color: "primary", style: {
|
|
162
|
+
width: "2.5rem",
|
|
163
|
+
height: "2.5rem"
|
|
166
164
|
} }),
|
|
167
165
|
g,
|
|
168
|
-
i && /* @__PURE__ */ e(l, { textAlign: "center", fontSize: "
|
|
166
|
+
i && /* @__PURE__ */ e(l, { textAlign: "center", fontSize: "12px", color: "grey", children: i })
|
|
169
167
|
] }) })
|
|
170
168
|
]
|
|
171
169
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../ImagePicker/ImagePicker.cjs.js"),a={title:"Components/ImagePicker",component:t,argTypes:{defaultLabel:{description:"Le contenu affiché comme label par défaut (ReactNode).",control:"text",table:{type:{summary:"ReactNode"},defaultValue:{summary:"<ImagePickerDefaultLabel />"}}},dragLabel:{description:"Texte affiché lorsque l'utilisateur fait glisser un fichier.",control:"text",table:{type:{summary:"ReactNode"},defaultValue:{summary:"<ImagePickerDefaultDragLabel />"}}},information:{description:"Informations supplémentaires affichées sous le label par défaut.",control:"text",table:{type:{summary:"string"}}},onFileChange:{description:"Callback déclenché lorsque l'utilisateur sélectionne ou supprime un fichier.",action:"file-changed",table:{type:{summary:"(file: File | null) => void"}}}}},l={args:{information:"SVG, PNG, JPG, GIF",onFileChange:e=>{console.log(e?"Image uplaodé":"Image supprimé")},width:"
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../ImagePicker/ImagePicker.cjs.js"),a={title:"Components/ImagePicker",component:t,argTypes:{defaultLabel:{description:"Le contenu affiché comme label par défaut (ReactNode).",control:"text",table:{type:{summary:"ReactNode"},defaultValue:{summary:"<ImagePickerDefaultLabel />"}}},dragLabel:{description:"Texte affiché lorsque l'utilisateur fait glisser un fichier.",control:"text",table:{type:{summary:"ReactNode"},defaultValue:{summary:"<ImagePickerDefaultDragLabel />"}}},information:{description:"Informations supplémentaires affichées sous le label par défaut.",control:"text",table:{type:{summary:"string"}}},onFileChange:{description:"Callback déclenché lorsque l'utilisateur sélectionne ou supprime un fichier.",action:"file-changed",table:{type:{summary:"(file: File | null) => void"}}}}},l={args:{information:"SVG, PNG, JPG, GIF",onFileChange:e=>{console.log(e?"Image uplaodé":"Image supprimé")},width:"160px",height:"160px"}};exports.Default=l;exports.default=a;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cgi-learning-hub/ui",
|
|
3
|
-
"version": "1.3.3-dev.
|
|
3
|
+
"version": "1.3.3-dev.1732633701",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "CGI Learning-hub Team",
|
|
6
6
|
"description": "@cgi-learning-hub/ui is an open-source React component library that implements UI for HUB's features",
|