allaw-ui 5.1.6 → 5.1.8
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.js +7 -7
- package/dist/components/molecules/fileUploader/FileUploader.module.css +18 -3
- package/dist/components/molecules/fileUploader/FileUploader.stories.d.ts +28 -15
- package/dist/components/molecules/fileUploader/FileUploader.stories.js +39 -2
- package/dist/components/molecules/fileUploader/ImageCropperModal.module.css +2 -2
- package/package.json +1 -1
|
@@ -289,8 +289,8 @@ var FileUploader = function (_a) {
|
|
|
289
289
|
var cropAreaWidth = 280; // Dimensions réelles du cadre de crop pour square/circle
|
|
290
290
|
var cropAreaHeight = 280;
|
|
291
291
|
if (cropMetadata.shape === "banner") {
|
|
292
|
-
cropAreaWidth =
|
|
293
|
-
cropAreaHeight =
|
|
292
|
+
cropAreaWidth = 360;
|
|
293
|
+
cropAreaHeight = 120;
|
|
294
294
|
}
|
|
295
295
|
// Le zoom dans cropMetadata est le zoom total (baseZoom * zoom relatif)
|
|
296
296
|
// baseZoom est calculé dans le modal comme Math.max(cropWidth / imgWidth, cropHeight / imgHeight)
|
|
@@ -528,11 +528,11 @@ var FileUploader = function (_a) {
|
|
|
528
528
|
}
|
|
529
529
|
} },
|
|
530
530
|
React.createElement("div", { className: "".concat(styles.preview_image_container, " ").concat(styles["preview_image_".concat((cropMetadata === null || cropMetadata === void 0 ? void 0 : cropMetadata.shape) || cropShape)]), onClick: function () { return enableCropping && openCropModal(); } },
|
|
531
|
-
React.createElement("div", { className: styles.preview_image_wrapper, style:
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
531
|
+
React.createElement("div", { className: styles.preview_image_wrapper, style: cropMetadata
|
|
532
|
+
? {
|
|
533
|
+
transform: "translate(".concat(cropMetadata.offsetX, "px, ").concat(cropMetadata.offsetY, "px) scale(").concat(cropMetadata.zoom, ")"),
|
|
534
|
+
}
|
|
535
|
+
: undefined },
|
|
536
536
|
React.createElement("img", { src: previewUrl, alt: displayFileName, className: styles.preview_image, draggable: false }))),
|
|
537
537
|
enableCropping && (React.createElement("div", { className: styles.edit_button_container, onClick: function (e) {
|
|
538
538
|
e.stopPropagation();
|
|
@@ -328,7 +328,7 @@
|
|
|
328
328
|
|
|
329
329
|
/* Ajuste la hauteur du conteneur pour la bannière */
|
|
330
330
|
.preview_container.preview_container_banner {
|
|
331
|
-
height:
|
|
331
|
+
height: 200px;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
.preview_image_container {
|
|
@@ -350,8 +350,10 @@
|
|
|
350
350
|
}
|
|
351
351
|
|
|
352
352
|
.preview_image_banner {
|
|
353
|
-
width:
|
|
354
|
-
|
|
353
|
+
width: 90%;
|
|
354
|
+
max-width: 600px;
|
|
355
|
+
height: auto;
|
|
356
|
+
aspect-ratio: 3 / 1;
|
|
355
357
|
border-radius: 4px;
|
|
356
358
|
}
|
|
357
359
|
|
|
@@ -380,6 +382,19 @@
|
|
|
380
382
|
-webkit-user-drag: none;
|
|
381
383
|
}
|
|
382
384
|
|
|
385
|
+
/* Pour les bannières avec clientSideCrop, l'image est déjà croppée */
|
|
386
|
+
.preview_image_banner > .preview_image_wrapper {
|
|
387
|
+
position: relative;
|
|
388
|
+
width: 100%;
|
|
389
|
+
height: 100%;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.preview_image_banner > .preview_image_wrapper > .preview_image {
|
|
393
|
+
width: 100%;
|
|
394
|
+
height: 100%;
|
|
395
|
+
object-fit: cover;
|
|
396
|
+
}
|
|
397
|
+
|
|
383
398
|
.edit_button_container {
|
|
384
399
|
position: absolute;
|
|
385
400
|
bottom: 12px;
|
|
@@ -44,54 +44,66 @@ declare namespace _default {
|
|
|
44
44
|
let description_4: string;
|
|
45
45
|
export { description_4 as description };
|
|
46
46
|
}
|
|
47
|
-
namespace
|
|
47
|
+
namespace clientSideCrop {
|
|
48
48
|
let control_5: string;
|
|
49
49
|
export { control_5 as control };
|
|
50
50
|
let description_5: string;
|
|
51
51
|
export { description_5 as description };
|
|
52
52
|
}
|
|
53
|
-
namespace
|
|
53
|
+
namespace cropOutputDimensions {
|
|
54
54
|
let control_6: string;
|
|
55
55
|
export { control_6 as control };
|
|
56
56
|
let description_6: string;
|
|
57
57
|
export { description_6 as description };
|
|
58
58
|
}
|
|
59
|
-
namespace
|
|
59
|
+
namespace iconUrl {
|
|
60
60
|
let control_7: string;
|
|
61
61
|
export { control_7 as control };
|
|
62
62
|
let description_7: string;
|
|
63
63
|
export { description_7 as description };
|
|
64
64
|
}
|
|
65
|
-
namespace
|
|
65
|
+
namespace buttonLabel {
|
|
66
66
|
let control_8: string;
|
|
67
67
|
export { control_8 as control };
|
|
68
68
|
let description_8: string;
|
|
69
69
|
export { description_8 as description };
|
|
70
70
|
}
|
|
71
|
-
namespace
|
|
72
|
-
|
|
73
|
-
let type_1: string;
|
|
74
|
-
export { type_1 as type };
|
|
75
|
-
export let min: number;
|
|
76
|
-
export let max: number;
|
|
77
|
-
export let step: number;
|
|
78
|
-
}
|
|
71
|
+
namespace acceptedLabel {
|
|
72
|
+
let control_9: string;
|
|
79
73
|
export { control_9 as control };
|
|
80
74
|
let description_9: string;
|
|
81
75
|
export { description_9 as description };
|
|
82
76
|
}
|
|
83
|
-
namespace
|
|
77
|
+
namespace maxSizeLabel {
|
|
84
78
|
let control_10: string;
|
|
85
79
|
export { control_10 as control };
|
|
86
80
|
let description_10: string;
|
|
87
81
|
export { description_10 as description };
|
|
88
82
|
}
|
|
89
|
-
namespace
|
|
90
|
-
|
|
83
|
+
namespace uploadProgress {
|
|
84
|
+
export namespace control_11 {
|
|
85
|
+
let type_1: string;
|
|
86
|
+
export { type_1 as type };
|
|
87
|
+
export let min: number;
|
|
88
|
+
export let max: number;
|
|
89
|
+
export let step: number;
|
|
90
|
+
}
|
|
91
91
|
export { control_11 as control };
|
|
92
92
|
let description_11: string;
|
|
93
93
|
export { description_11 as description };
|
|
94
94
|
}
|
|
95
|
+
namespace isLoading {
|
|
96
|
+
let control_12: string;
|
|
97
|
+
export { control_12 as control };
|
|
98
|
+
let description_12: string;
|
|
99
|
+
export { description_12 as description };
|
|
100
|
+
}
|
|
101
|
+
namespace errorMessage {
|
|
102
|
+
let control_13: string;
|
|
103
|
+
export { control_13 as control };
|
|
104
|
+
let description_13: string;
|
|
105
|
+
export { description_13 as description };
|
|
106
|
+
}
|
|
95
107
|
}
|
|
96
108
|
}
|
|
97
109
|
export default _default;
|
|
@@ -104,4 +116,5 @@ export const MultipleExtensions: any;
|
|
|
104
116
|
export const WithSquareCropping: any;
|
|
105
117
|
export const WithCircleCropping: any;
|
|
106
118
|
export const WithPreloadedImage: any;
|
|
119
|
+
export const WithBannerCropping: any;
|
|
107
120
|
import FileUploader from "./FileUploader";
|
|
@@ -82,8 +82,16 @@ export default {
|
|
|
82
82
|
description: "Active/désactive le cadrage pour les images",
|
|
83
83
|
},
|
|
84
84
|
cropShape: {
|
|
85
|
-
control: { type: "select", options: ["circle", "square"] },
|
|
86
|
-
description: "Forme du masque de cadrage (cercle ou
|
|
85
|
+
control: { type: "select", options: ["circle", "square", "banner"] },
|
|
86
|
+
description: "Forme du masque de cadrage (cercle, carré ou bannière)",
|
|
87
|
+
},
|
|
88
|
+
clientSideCrop: {
|
|
89
|
+
control: "boolean",
|
|
90
|
+
description: "Active le crop côté client (l'image est croppée avant d'être envoyée)",
|
|
91
|
+
},
|
|
92
|
+
cropOutputDimensions: {
|
|
93
|
+
control: "object",
|
|
94
|
+
description: "Dimensions de sortie pour chaque forme (ex: { banner: { width: 1200, height: 400 } })",
|
|
87
95
|
},
|
|
88
96
|
iconUrl: {
|
|
89
97
|
control: "text",
|
|
@@ -230,3 +238,32 @@ export var WithPreloadedImage = Template.bind({});
|
|
|
230
238
|
WithPreloadedImage.args = __assign(__assign({}, Default.args), {
|
|
231
239
|
// On simule un fichier déjà chargé pour la story
|
|
232
240
|
fileName: "logo-entreprise.png", fileSize: 1.2 * 1024 * 1024, filePresentationLabel: "Voici votre logo." });
|
|
241
|
+
// Exemple avec le cadrage d'image en bannière (format 3:1)
|
|
242
|
+
export var WithBannerCropping = Template.bind({});
|
|
243
|
+
WithBannerCropping.args = {
|
|
244
|
+
acceptedExtensions: [
|
|
245
|
+
".jpg",
|
|
246
|
+
".jpeg",
|
|
247
|
+
".png",
|
|
248
|
+
".webp",
|
|
249
|
+
".gif",
|
|
250
|
+
".ico",
|
|
251
|
+
".bmp",
|
|
252
|
+
".tiff",
|
|
253
|
+
".heic",
|
|
254
|
+
".heif",
|
|
255
|
+
".hevc",
|
|
256
|
+
],
|
|
257
|
+
maxFileSizeMB: 3,
|
|
258
|
+
enableDragAndDrop: true,
|
|
259
|
+
enableCropping: true,
|
|
260
|
+
cropShape: "banner",
|
|
261
|
+
clientSideCrop: true,
|
|
262
|
+
cropOutputDimensions: {
|
|
263
|
+
banner: { width: 1200, height: 400 },
|
|
264
|
+
},
|
|
265
|
+
buttonLabel: "Choisir une image",
|
|
266
|
+
acceptedLabel: "Formats acceptés :",
|
|
267
|
+
maxSizeLabel: "Taille maximale :",
|
|
268
|
+
filePresentationLabel: "Voici votre bannière.",
|
|
269
|
+
};
|