@cgi-learning-hub/ui
Version:
@cgi-learning-hub/ui is an open-source React component library that implements UI for HUB's features
56 lines (55 loc) • 1.93 kB
JavaScript
import { jsx as r, jsxs as i, Fragment as t } from "react/jsx-runtime";
import { c as a } from "../../createSvgIcon-B1E6Wo8z.js";
import { u as f } from "../../index-CX0sAlmK.js";
import { S as y } from "../../Stack-DSJ2DqNd.js";
import { T as o } from "../../Typography-Dy8r_tT2.js";
const v = a(/* @__PURE__ */ r("path", {
d: "M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"
}), "FileUpload"), z = a(/* @__PURE__ */ r("path", {
d: "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5zM8 15.01l1.41 1.41L11 14.84V19h2v-4.16l1.59 1.59L16 15.01 12.01 11z"
}), "UploadFile"), H = ({
defaultLabel: l = "Glisser et déposer des fichiers ici, ou cliquer pour sélectionner des fichiers",
dragLabel: d = "Déposer les fichiers ici",
information: c,
width: p,
height: h,
slotProps: e = {},
...s
}) => {
var n;
const { getRootProps: m, getInputProps: u, isDragActive: g } = f(s);
return /* @__PURE__ */ i(
y,
{
direction: "column",
justifyContent: "center",
alignItems: "center",
spacing: 1,
width: p ?? "18rem",
height: h ?? "auto",
padding: 1,
border: "1px dashed",
borderColor: "grey.main",
borderRadius: 1,
sx: {
cursor: "pointer",
...(n = e.root) == null ? void 0 : n.sx
},
...m(),
children: [
/* @__PURE__ */ r("input", { ...u(), ...e.input }),
g ? /* @__PURE__ */ i(t, { children: [
/* @__PURE__ */ r(v, { color: "primary", ...e.icon }),
/* @__PURE__ */ r(o, { ...e.label, children: d })
] }) : /* @__PURE__ */ i(t, { children: [
/* @__PURE__ */ r(z, { color: "primary", ...e.icon }),
/* @__PURE__ */ r(o, { ...e.label, children: l }),
c ? /* @__PURE__ */ r(o, { variant: "body2", color: "grey", ...e.information, children: c }) : null
] })
]
}
);
};
export {
H as default
};