allaw-ui 3.0.3 → 3.0.5
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/molecules/fileUploader/FileUploader.d.ts +1 -1
- package/dist/components/molecules/fileUploader/FileUploader.js +4 -2
- package/dist/components/molecules/fileUploader/FileUploader.module.css +11 -0
- package/dist/components/molecules/fileUploader/ImageCropperModal.d.ts +2 -2
- package/dist/components/molecules/fileUploader/ImageCropperModal.module.css +6 -0
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ export interface FileUploaderProps {
|
|
|
5
5
|
maxFileSizeMB: number;
|
|
6
6
|
enableDragAndDrop?: boolean;
|
|
7
7
|
enableCropping?: boolean;
|
|
8
|
-
cropShape?: "circle" | "square";
|
|
8
|
+
cropShape?: "circle" | "square" | "banner";
|
|
9
9
|
iconUrl?: string;
|
|
10
10
|
descriptionParts?: {
|
|
11
11
|
beforeLink: string;
|
|
@@ -39,7 +39,7 @@ import Image from "next/image";
|
|
|
39
39
|
import styles from "./FileUploader.module.css";
|
|
40
40
|
import ImageCropperModal from "./ImageCropperModal";
|
|
41
41
|
import IconButton from "../../atoms/buttons/IconButton";
|
|
42
|
-
import
|
|
42
|
+
import TertiaryButton from "../../atoms/buttons/TertiaryButton";
|
|
43
43
|
var FileUploader = function (_a) {
|
|
44
44
|
var acceptedExtensions = _a.acceptedExtensions, maxFileSizeMB = _a.maxFileSizeMB, _b = _a.enableDragAndDrop, enableDragAndDrop = _b === void 0 ? true : _b, _c = _a.enableCropping, enableCropping = _c === void 0 ? false : _c, _d = _a.cropShape, cropShape = _d === void 0 ? "square" : _d, iconUrl = _a.iconUrl, descriptionParts = _a.descriptionParts, onFileRead = _a.onFileRead, onFileRemove = _a.onFileRemove, _e = _a.uploadProgress, uploadProgress = _e === void 0 ? 0 : _e, _f = _a.isLoading, isLoading = _f === void 0 ? false : _f, _g = _a.errorMessage, errorMessage = _g === void 0 ? null : _g, _h = _a.buttonLabel, buttonLabel = _h === void 0 ? "Choisir un fichier" : _h, _j = _a.acceptedLabel, acceptedLabel = _j === void 0 ? "Format accepté :" : _j, _k = _a.maxSizeLabel, maxSizeLabel = _k === void 0 ? "Taille maximale :" : _k, fileName = _a.fileName, fileSize = _a.fileSize, _l = _a.filePresentationLabel, filePresentationLabel = _l === void 0 ? "Voici votre fichier." : _l;
|
|
45
45
|
var _m = useState(null), selectedFile = _m[0], setSelectedFile = _m[1];
|
|
@@ -202,7 +202,9 @@ var FileUploader = function (_a) {
|
|
|
202
202
|
var isSelectedImage = selectedFile && isImageFile(selectedFile);
|
|
203
203
|
return (React.createElement("div", { className: styles.upload_main_container },
|
|
204
204
|
enableDragAndDrop ? (React.createElement("div", { className: "".concat(styles.upload_container, " ").concat(isHovering ? styles.drag_over : "", " ").concat(previewUrl ? styles.upload_container_with_preview : ""), onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, onClick: function () { var _a; return !previewUrl && ((_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click()); } },
|
|
205
|
-
previewUrl ? (React.createElement("div", { className: styles.preview_container,
|
|
205
|
+
previewUrl ? (React.createElement("div", { className: "".concat(styles.preview_container, " ").concat((cropMetadata === null || cropMetadata === void 0 ? void 0 : cropMetadata.shape) === "banner" || cropShape === "banner"
|
|
206
|
+
? styles.preview_container_banner
|
|
207
|
+
: ""), onClick: function (e) {
|
|
206
208
|
var _a;
|
|
207
209
|
// Ne pas déclencher si on clique sur le conteneur d'image
|
|
208
210
|
if (!e.target.closest(".".concat(styles.preview_image_container))) {
|
|
@@ -323,6 +323,11 @@
|
|
|
323
323
|
cursor: pointer;
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
+
/* Ajuste la hauteur du conteneur pour la bannière */
|
|
327
|
+
.preview_container.preview_container_banner {
|
|
328
|
+
height: 120px;
|
|
329
|
+
}
|
|
330
|
+
|
|
326
331
|
.preview_image_container {
|
|
327
332
|
position: relative;
|
|
328
333
|
width: 280px;
|
|
@@ -341,6 +346,12 @@
|
|
|
341
346
|
border-radius: 8px;
|
|
342
347
|
}
|
|
343
348
|
|
|
349
|
+
.preview_image_banner {
|
|
350
|
+
width: 320px;
|
|
351
|
+
height: 60px;
|
|
352
|
+
border-radius: 4px;
|
|
353
|
+
}
|
|
354
|
+
|
|
344
355
|
.preview_image_wrapper {
|
|
345
356
|
position: absolute;
|
|
346
357
|
width: auto;
|
|
@@ -3,11 +3,11 @@ export interface CropMetadata {
|
|
|
3
3
|
zoom: number;
|
|
4
4
|
offsetX: number;
|
|
5
5
|
offsetY: number;
|
|
6
|
-
shape: "circle" | "square";
|
|
6
|
+
shape: "circle" | "square" | "banner";
|
|
7
7
|
}
|
|
8
8
|
interface ImageCropperModalProps {
|
|
9
9
|
file: File;
|
|
10
|
-
shape: "circle" | "square";
|
|
10
|
+
shape: "circle" | "square" | "banner";
|
|
11
11
|
onCancel: () => void;
|
|
12
12
|
onConfirm: (cropMetadata: CropMetadata) => void;
|
|
13
13
|
}
|