allaw-ui 3.0.0 → 3.0.2
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/assets/allaw-icon-pdf.svg +5 -0
- package/dist/components/molecules/fileUploader/FileUploader.d.ts +28 -0
- package/dist/components/molecules/fileUploader/FileUploader.js +217 -0
- package/dist/components/molecules/fileUploader/FileUploader.module.css +299 -0
- package/dist/components/molecules/fileUploader/FileUploader.stories.d.ts +106 -0
- package/dist/components/molecules/fileUploader/FileUploader.stories.js +226 -0
- package/dist/components/molecules/fileUploader/ImageCropperModal.d.ts +15 -0
- package/dist/components/molecules/fileUploader/ImageCropperModal.js +211 -0
- package/dist/components/molecules/fileUploader/ImageCropperModal.module.css +232 -0
- package/dist/components/molecules/fileUploader/index.d.ts +2 -0
- package/dist/components/molecules/fileUploader/index.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M14 2H6C4.9 2 4 2.9 4 4V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V8L14 2Z" fill="#E30000" />
|
|
3
|
+
<path d="M14 2V8H20L14 2Z" fill="#FF6666" />
|
|
4
|
+
<path d="M10.08 16.58C9.63 16.58 9.2 16.5 8.8 16.34V14.54C9.16 14.74 9.56 14.84 10 14.84C10.28 14.84 10.5 14.78 10.66 14.66C10.82 14.54 10.9 14.36 10.9 14.12C10.9 13.9 10.84 13.72 10.72 13.58C10.6 13.44 10.36 13.24 10 12.98C9.62 12.7 9.36 12.44 9.22 12.2C9.08 11.96 9 11.66 9 11.3C9 10.78 9.18 10.38 9.54 10.08C9.9 9.78 10.36 9.64 10.92 9.64C11.32 9.64 11.68 9.68 12 9.76V11.44C11.7 11.3 11.4 11.24 11.1 11.24C10.9 11.24 10.74 11.28 10.62 11.36C10.5 11.44 10.44 11.56 10.44 11.72C10.44 11.86 10.5 11.98 10.62 12.1C10.74 12.22 10.94 12.38 11.22 12.58C11.62 12.86 11.9 13.14 12.06 13.42C12.22 13.7 12.3 14.04 12.3 14.44C12.3 14.98 12.1 15.4 11.7 15.7C11.3 16 10.76 16.16 10.08 16.58Z" fill="white" />
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CropMetadata } from "./ImageCropperModal";
|
|
3
|
+
export interface FileUploaderProps {
|
|
4
|
+
acceptedExtensions: string[];
|
|
5
|
+
maxFileSizeMB: number;
|
|
6
|
+
enableDragAndDrop?: boolean;
|
|
7
|
+
enableCropping?: boolean;
|
|
8
|
+
cropShape?: "circle" | "square";
|
|
9
|
+
iconUrl?: string;
|
|
10
|
+
descriptionParts?: {
|
|
11
|
+
beforeLink: string;
|
|
12
|
+
linkLabel: string;
|
|
13
|
+
linkUrl: string;
|
|
14
|
+
afterLink: string;
|
|
15
|
+
};
|
|
16
|
+
onFileRead?: (file: File, fileContent: ArrayBuffer, cropMetadata?: CropMetadata) => void;
|
|
17
|
+
onFileRemove?: () => void;
|
|
18
|
+
uploadProgress?: number;
|
|
19
|
+
isLoading?: boolean;
|
|
20
|
+
errorMessage?: string | null;
|
|
21
|
+
buttonLabel?: string;
|
|
22
|
+
acceptedLabel?: string;
|
|
23
|
+
maxSizeLabel?: string;
|
|
24
|
+
fileName?: string;
|
|
25
|
+
fileSize?: number;
|
|
26
|
+
}
|
|
27
|
+
declare const FileUploader: React.FC<FileUploaderProps>;
|
|
28
|
+
export default FileUploader;
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import React, { useState, useRef } from "react";
|
|
38
|
+
import Image from "next/image";
|
|
39
|
+
import styles from "./FileUploader.module.css";
|
|
40
|
+
import ImageCropperModal from "./ImageCropperModal";
|
|
41
|
+
var FileUploader = function (_a) {
|
|
42
|
+
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;
|
|
43
|
+
var _l = useState(null), selectedFile = _l[0], setSelectedFile = _l[1];
|
|
44
|
+
var _m = useState(null), fileContent = _m[0], setFileContent = _m[1];
|
|
45
|
+
var _o = useState(false), isHovering = _o[0], setIsHovering = _o[1];
|
|
46
|
+
var _p = useState(false), showCropper = _p[0], setShowCropper = _p[1];
|
|
47
|
+
var fileInputRef = useRef(null);
|
|
48
|
+
var resetFileInput = function () {
|
|
49
|
+
if (fileInputRef.current) {
|
|
50
|
+
fileInputRef.current.value = "";
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var validateFile = function (file) {
|
|
54
|
+
var _a;
|
|
55
|
+
// Vérifier l'extension
|
|
56
|
+
var fileExtension = ".".concat((_a = file.name.split(".").pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase());
|
|
57
|
+
var isValidExtension = acceptedExtensions.includes(fileExtension);
|
|
58
|
+
// Vérifier la taille
|
|
59
|
+
var isValidSize = file.size <= maxFileSizeMB * 1024 * 1024;
|
|
60
|
+
return isValidExtension && isValidSize;
|
|
61
|
+
};
|
|
62
|
+
var isImageFile = function (file) {
|
|
63
|
+
var _a;
|
|
64
|
+
var fileExtension = ".".concat((_a = file.name.split(".").pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase());
|
|
65
|
+
var imageExtensions = [".jpg", ".jpeg", ".png", ".gif", ".webp", ".bmp"];
|
|
66
|
+
return imageExtensions.includes(fileExtension);
|
|
67
|
+
};
|
|
68
|
+
var handleFileSelect = function (event) { return __awaiter(void 0, void 0, void 0, function () {
|
|
69
|
+
var file;
|
|
70
|
+
return __generator(this, function (_a) {
|
|
71
|
+
if (event.target.files && event.target.files.length > 0) {
|
|
72
|
+
file = event.target.files[0];
|
|
73
|
+
processFile(file);
|
|
74
|
+
}
|
|
75
|
+
return [2 /*return*/];
|
|
76
|
+
});
|
|
77
|
+
}); };
|
|
78
|
+
var handleDragOver = function (event) {
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
setIsHovering(true);
|
|
81
|
+
};
|
|
82
|
+
var handleDragLeave = function () {
|
|
83
|
+
setIsHovering(false);
|
|
84
|
+
};
|
|
85
|
+
var handleDrop = function (event) { return __awaiter(void 0, void 0, void 0, function () {
|
|
86
|
+
var file;
|
|
87
|
+
return __generator(this, function (_a) {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
setIsHovering(false);
|
|
90
|
+
if (event.dataTransfer.files && event.dataTransfer.files.length > 0) {
|
|
91
|
+
file = event.dataTransfer.files[0];
|
|
92
|
+
processFile(file);
|
|
93
|
+
}
|
|
94
|
+
return [2 /*return*/];
|
|
95
|
+
});
|
|
96
|
+
}); };
|
|
97
|
+
var processFile = function (file) { return __awaiter(void 0, void 0, void 0, function () {
|
|
98
|
+
var content, error_1;
|
|
99
|
+
return __generator(this, function (_a) {
|
|
100
|
+
switch (_a.label) {
|
|
101
|
+
case 0:
|
|
102
|
+
if (!validateFile(file)) {
|
|
103
|
+
setSelectedFile(null);
|
|
104
|
+
return [2 /*return*/];
|
|
105
|
+
}
|
|
106
|
+
_a.label = 1;
|
|
107
|
+
case 1:
|
|
108
|
+
_a.trys.push([1, 3, , 4]);
|
|
109
|
+
return [4 /*yield*/, file.arrayBuffer()];
|
|
110
|
+
case 2:
|
|
111
|
+
content = _a.sent();
|
|
112
|
+
setFileContent(content);
|
|
113
|
+
// Si c'est une image et que le cadrage est activé, afficher le composant de cadrage
|
|
114
|
+
if (enableCropping && isImageFile(file)) {
|
|
115
|
+
setSelectedFile(file);
|
|
116
|
+
setShowCropper(true);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
// Sinon, traiter normalement
|
|
120
|
+
setSelectedFile(file);
|
|
121
|
+
onFileRead === null || onFileRead === void 0 ? void 0 : onFileRead(file, content);
|
|
122
|
+
}
|
|
123
|
+
return [3 /*break*/, 4];
|
|
124
|
+
case 3:
|
|
125
|
+
error_1 = _a.sent();
|
|
126
|
+
console.error("Error reading file:", error_1);
|
|
127
|
+
setSelectedFile(null);
|
|
128
|
+
return [3 /*break*/, 4];
|
|
129
|
+
case 4: return [2 /*return*/];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}); };
|
|
133
|
+
var handleCropCancel = function () {
|
|
134
|
+
setShowCropper(false);
|
|
135
|
+
setSelectedFile(null);
|
|
136
|
+
resetFileInput();
|
|
137
|
+
};
|
|
138
|
+
var handleCropConfirm = function (cropMetadata) {
|
|
139
|
+
setShowCropper(false);
|
|
140
|
+
if (selectedFile && fileContent) {
|
|
141
|
+
onFileRead === null || onFileRead === void 0 ? void 0 : onFileRead(selectedFile, fileContent, cropMetadata);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
var handleFileDelete = function () {
|
|
145
|
+
setSelectedFile(null);
|
|
146
|
+
setFileContent(null);
|
|
147
|
+
resetFileInput();
|
|
148
|
+
onFileRemove === null || onFileRemove === void 0 ? void 0 : onFileRemove();
|
|
149
|
+
};
|
|
150
|
+
var formatFileSize = function (size) {
|
|
151
|
+
if (size < 1024) {
|
|
152
|
+
return "".concat(size, " octets");
|
|
153
|
+
}
|
|
154
|
+
else if (size < 1024 * 1024) {
|
|
155
|
+
return "".concat((size / 1024).toFixed(2), " Ko");
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
return "".concat((size / (1024 * 1024)).toFixed(2), " Mo");
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
var displayFileSize = fileSize !== undefined ? fileSize : selectedFile ? selectedFile.size : 0;
|
|
162
|
+
var displayFileName = fileName || (selectedFile ? selectedFile.name : "");
|
|
163
|
+
return (React.createElement("div", { className: styles.upload_main_container },
|
|
164
|
+
enableDragAndDrop ? (React.createElement("div", { className: "".concat(styles.upload_container, " ").concat(isHovering ? styles.drag_over : ""), onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, onClick: function () { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); } },
|
|
165
|
+
React.createElement("div", { className: styles.upload_content },
|
|
166
|
+
React.createElement("div", { className: styles.upload_icons },
|
|
167
|
+
React.createElement("div", { className: styles.upload_file_icon },
|
|
168
|
+
React.createElement("i", { className: "allaw-icon-file" })),
|
|
169
|
+
React.createElement("div", { className: styles.upload_icon_container },
|
|
170
|
+
React.createElement("div", { className: styles.upload_icon },
|
|
171
|
+
React.createElement("i", { className: "allaw-icon-export" })))),
|
|
172
|
+
React.createElement("div", { className: styles.upload_description },
|
|
173
|
+
React.createElement("span", null,
|
|
174
|
+
"Glissez-d\u00E9posez votre fichier, ou",
|
|
175
|
+
" ",
|
|
176
|
+
React.createElement("span", { className: styles.btn_tertiary }, buttonLabel),
|
|
177
|
+
React.createElement("input", { id: "file-upload", ref: fileInputRef, type: "file", accept: acceptedExtensions.join(","), style: { display: "none" }, onChange: handleFileSelect })))))) : (React.createElement("div", { className: styles.manual_upload_container },
|
|
178
|
+
React.createElement("button", { className: styles.file_upload_button, onClick: function () { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); } },
|
|
179
|
+
React.createElement("span", { className: styles.btn_tertiary }, buttonLabel),
|
|
180
|
+
React.createElement("input", { id: "file-upload", ref: fileInputRef, type: "file", accept: acceptedExtensions.join(","), style: { display: "none" }, onChange: handleFileSelect })))),
|
|
181
|
+
React.createElement("div", { className: styles.limits },
|
|
182
|
+
React.createElement("div", { className: styles.format },
|
|
183
|
+
React.createElement("span", { className: styles.limit_text },
|
|
184
|
+
acceptedLabel,
|
|
185
|
+
" ",
|
|
186
|
+
acceptedExtensions.join(", "))),
|
|
187
|
+
React.createElement("div", { className: styles.size },
|
|
188
|
+
React.createElement("span", { className: styles.limit_text },
|
|
189
|
+
maxSizeLabel,
|
|
190
|
+
" ",
|
|
191
|
+
maxFileSizeMB,
|
|
192
|
+
" Mo"))),
|
|
193
|
+
descriptionParts && (React.createElement("p", { className: styles.description },
|
|
194
|
+
descriptionParts.beforeLink,
|
|
195
|
+
" ",
|
|
196
|
+
React.createElement("a", { href: descriptionParts.linkUrl, target: "_blank", rel: "noopener noreferrer", className: styles.description_link }, descriptionParts.linkLabel),
|
|
197
|
+
" ",
|
|
198
|
+
descriptionParts.afterLink)),
|
|
199
|
+
errorMessage && (React.createElement("div", { className: styles.uploaded_file_container },
|
|
200
|
+
React.createElement("div", { className: styles.uploaded_file_error },
|
|
201
|
+
React.createElement("span", { className: styles.error_message }, errorMessage)))),
|
|
202
|
+
(isLoading || selectedFile || fileName) && (React.createElement("div", { className: styles.uploaded_file_container },
|
|
203
|
+
React.createElement("div", { className: styles.uploaded_file_content },
|
|
204
|
+
React.createElement("div", { className: styles.uploaded_file_icon }, iconUrl ? (React.createElement(Image, { src: iconUrl, alt: "File icon", className: styles.file_icon, width: 20, height: 20 })) : (React.createElement("i", { className: "allaw-icon-file" }))),
|
|
205
|
+
React.createElement("div", { className: styles.uploaded_file_name_size },
|
|
206
|
+
React.createElement("div", { className: styles.uploaded_file_name },
|
|
207
|
+
React.createElement("span", { className: styles.file_name }, displayFileName || "Analyse en cours...")),
|
|
208
|
+
React.createElement("div", { className: styles.uploaded_file_size },
|
|
209
|
+
React.createElement("span", { className: styles.file_size }, displayFileSize > 0 ? formatFileSize(displayFileSize) : ""))),
|
|
210
|
+
selectedFile && (React.createElement("div", { className: styles.uploaded_file_delete_container },
|
|
211
|
+
React.createElement("div", { className: styles.uploaded_file_delete, onClick: handleFileDelete },
|
|
212
|
+
React.createElement("i", { className: "allaw-icon-close" }))))),
|
|
213
|
+
React.createElement("div", { className: styles.uploaded_file_progress_bar }, uploadProgress > 0 && (React.createElement("div", { className: styles.progress_bar_container },
|
|
214
|
+
React.createElement("div", { className: styles.progress_bar_fill, style: { width: "".concat((uploadProgress / 10) * 100, "%") } })))))),
|
|
215
|
+
showCropper && selectedFile && (React.createElement(ImageCropperModal, { file: selectedFile, shape: cropShape, onCancel: handleCropCancel, onConfirm: handleCropConfirm }))));
|
|
216
|
+
};
|
|
217
|
+
export default FileUploader;
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
.upload_main_container {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
width: 100%;
|
|
6
|
+
gap: 0.5rem;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.upload_container {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: row;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
border: 2px dashed var(--venom-grey-dark, #d1dce8);
|
|
15
|
+
border-radius: 16px;
|
|
16
|
+
padding: 4rem 2rem;
|
|
17
|
+
min-height: 150px;
|
|
18
|
+
margin-top: 1rem;
|
|
19
|
+
background-color: #ffffff;
|
|
20
|
+
width: 100%;
|
|
21
|
+
transition: all 0.2s ease-in-out;
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.manual_upload_container {
|
|
26
|
+
display: flex;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
margin-top: 1rem;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.upload_container:hover {
|
|
32
|
+
background-color: #f6fcfe;
|
|
33
|
+
border: 2px dashed var(--bleu-allaw, #25beeb);
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.upload_container:hover .upload_icon {
|
|
38
|
+
background-color: #171e25;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.upload_content {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
align-items: center;
|
|
45
|
+
gap: 1rem;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.upload_icons {
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
position: relative;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.upload_file_icon {
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
font-size: 3rem;
|
|
59
|
+
color: var(--lightSteelBlue, #a2b5c8);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.upload_icon_container {
|
|
63
|
+
position: absolute;
|
|
64
|
+
bottom: -10px;
|
|
65
|
+
right: -10px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.upload_icon {
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
justify-content: center;
|
|
72
|
+
background-color: #25beeb;
|
|
73
|
+
color: white;
|
|
74
|
+
border-radius: 50%;
|
|
75
|
+
width: 32px;
|
|
76
|
+
height: 32px;
|
|
77
|
+
font-size: 1rem;
|
|
78
|
+
transition: all 0.2s ease-in-out;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.upload_description {
|
|
82
|
+
text-align: center;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.upload_description span {
|
|
86
|
+
font-family: var(--font-open-sans, sans-serif);
|
|
87
|
+
font-size: 14px;
|
|
88
|
+
font-style: normal;
|
|
89
|
+
font-weight: 400;
|
|
90
|
+
line-height: normal;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.file_upload_label {
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.btn_tertiary {
|
|
98
|
+
color: #25beeb;
|
|
99
|
+
font-weight: 600;
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.btn_tertiary:hover {
|
|
104
|
+
text-decoration: underline;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.limits {
|
|
108
|
+
display: flex;
|
|
109
|
+
flex-direction: row;
|
|
110
|
+
justify-content: space-between;
|
|
111
|
+
align-items: center;
|
|
112
|
+
gap: 1rem;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.limit_text {
|
|
116
|
+
color: var(--mid-grey, #728ea7);
|
|
117
|
+
font-size: 14px;
|
|
118
|
+
font-family: var(--font-open-sans, sans-serif);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.description {
|
|
122
|
+
color: var(--primary-dark-grey, #456073);
|
|
123
|
+
font-family: var(--font-open-sans, sans-serif);
|
|
124
|
+
font-size: 14px;
|
|
125
|
+
font-style: normal;
|
|
126
|
+
font-weight: 400;
|
|
127
|
+
line-height: normal;
|
|
128
|
+
padding-top: 0.5rem;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.description_link {
|
|
132
|
+
color: #25beeb;
|
|
133
|
+
text-decoration: underline;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.uploaded_file_container {
|
|
137
|
+
display: flex;
|
|
138
|
+
flex-direction: column;
|
|
139
|
+
align-items: center;
|
|
140
|
+
justify-content: center;
|
|
141
|
+
width: 100%;
|
|
142
|
+
border-radius: 16px;
|
|
143
|
+
border: 1px solid var(--grey-venom, #e6edf5);
|
|
144
|
+
background: var(--primary-blanc, #fff);
|
|
145
|
+
padding: 1rem 1rem 0.5rem 1rem;
|
|
146
|
+
gap: 0.5rem;
|
|
147
|
+
margin-top: 1rem;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.uploaded_file_content {
|
|
151
|
+
width: 100%;
|
|
152
|
+
display: flex;
|
|
153
|
+
flex-direction: row;
|
|
154
|
+
align-items: center;
|
|
155
|
+
justify-content: space-between;
|
|
156
|
+
min-height: 40px;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.uploaded_file_name_size {
|
|
160
|
+
display: flex;
|
|
161
|
+
flex-direction: column;
|
|
162
|
+
align-items: flex-start;
|
|
163
|
+
justify-content: center;
|
|
164
|
+
width: 100%;
|
|
165
|
+
padding-left: 1rem;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.file_name {
|
|
169
|
+
font-family: var(--font-open-sans, sans-serif);
|
|
170
|
+
font-weight: 600;
|
|
171
|
+
color: var(--noir, #171e25);
|
|
172
|
+
font-size: 14px;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.file_size {
|
|
176
|
+
font-family: var(--font-open-sans, sans-serif);
|
|
177
|
+
color: var(--mid-grey, #728ea7);
|
|
178
|
+
font-size: 12px;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.uploaded_file_delete_container {
|
|
182
|
+
display: flex;
|
|
183
|
+
flex-direction: row;
|
|
184
|
+
align-items: center;
|
|
185
|
+
justify-content: center;
|
|
186
|
+
height: 100%;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.uploaded_file_delete {
|
|
190
|
+
display: flex;
|
|
191
|
+
flex-direction: row;
|
|
192
|
+
align-items: center;
|
|
193
|
+
justify-content: center;
|
|
194
|
+
height: 30px;
|
|
195
|
+
width: 30px;
|
|
196
|
+
color: var(--mid-grey, #728ea7);
|
|
197
|
+
font-size: 0.8rem;
|
|
198
|
+
cursor: pointer;
|
|
199
|
+
transition: color 0.2s ease-in-out;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.uploaded_file_delete:hover {
|
|
203
|
+
color: var(--noir, #171e25);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.uploaded_file_icon {
|
|
207
|
+
display: flex;
|
|
208
|
+
flex-direction: row;
|
|
209
|
+
align-items: center;
|
|
210
|
+
justify-content: center;
|
|
211
|
+
border: 1px solid var(--grey-venom, #e6edf5);
|
|
212
|
+
border-radius: 8px;
|
|
213
|
+
padding: 0.75rem;
|
|
214
|
+
position: relative;
|
|
215
|
+
min-width: 40px;
|
|
216
|
+
min-height: 40px;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.file_icon {
|
|
220
|
+
width: 20px;
|
|
221
|
+
height: 20px;
|
|
222
|
+
object-fit: contain;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.uploaded_file_progress_bar {
|
|
226
|
+
display: flex;
|
|
227
|
+
flex-direction: row;
|
|
228
|
+
align-items: center;
|
|
229
|
+
justify-content: center;
|
|
230
|
+
width: 100%;
|
|
231
|
+
height: 40px;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.progress_bar_container {
|
|
235
|
+
width: 100%;
|
|
236
|
+
height: 4px;
|
|
237
|
+
background-color: #e6edf5;
|
|
238
|
+
border-radius: 2px;
|
|
239
|
+
overflow: hidden;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.progress_bar_fill {
|
|
243
|
+
height: 100%;
|
|
244
|
+
background-color: #25beeb;
|
|
245
|
+
transition: width 0.3s ease-in-out;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.drag_over {
|
|
249
|
+
background-color: #f6fcfe;
|
|
250
|
+
border: 2px dashed var(--bleu-allaw, #25beeb);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.drag_over .upload_icon {
|
|
254
|
+
background-color: #171e25;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.uploaded_file_error {
|
|
258
|
+
padding-bottom: 0.5rem;
|
|
259
|
+
width: 100%;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.error_message {
|
|
263
|
+
color: var(--actions-error, #eb4a4a);
|
|
264
|
+
font-family: var(--font-open-sans, sans-serif);
|
|
265
|
+
font-size: 14px;
|
|
266
|
+
font-weight: 600;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.file_upload_button {
|
|
270
|
+
background: none;
|
|
271
|
+
border: none;
|
|
272
|
+
padding: 0;
|
|
273
|
+
margin: 0;
|
|
274
|
+
cursor: pointer;
|
|
275
|
+
font-family: inherit;
|
|
276
|
+
font-size: inherit;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
@media (max-width: 768px) {
|
|
280
|
+
.upload_container {
|
|
281
|
+
padding: 2rem 1rem;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.upload_file_icon {
|
|
285
|
+
font-size: 2.5rem;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.upload_icon {
|
|
289
|
+
width: 28px;
|
|
290
|
+
height: 28px;
|
|
291
|
+
font-size: 0.8rem;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.limits {
|
|
295
|
+
flex-direction: column;
|
|
296
|
+
align-items: flex-start;
|
|
297
|
+
gap: 0.25rem;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export let title: string;
|
|
3
|
+
export { FileUploader as component };
|
|
4
|
+
export let tags: string[];
|
|
5
|
+
export namespace parameters {
|
|
6
|
+
namespace backgrounds {
|
|
7
|
+
let _default: string;
|
|
8
|
+
export { _default as default };
|
|
9
|
+
export let values: {
|
|
10
|
+
name: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}[];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export namespace argTypes {
|
|
16
|
+
namespace acceptedExtensions {
|
|
17
|
+
let control: string;
|
|
18
|
+
let description: string;
|
|
19
|
+
}
|
|
20
|
+
namespace maxFileSizeMB {
|
|
21
|
+
let control_1: string;
|
|
22
|
+
export { control_1 as control };
|
|
23
|
+
let description_1: string;
|
|
24
|
+
export { description_1 as description };
|
|
25
|
+
}
|
|
26
|
+
namespace enableDragAndDrop {
|
|
27
|
+
let control_2: string;
|
|
28
|
+
export { control_2 as control };
|
|
29
|
+
let description_2: string;
|
|
30
|
+
export { description_2 as description };
|
|
31
|
+
}
|
|
32
|
+
namespace enableCropping {
|
|
33
|
+
let control_3: string;
|
|
34
|
+
export { control_3 as control };
|
|
35
|
+
let description_3: string;
|
|
36
|
+
export { description_3 as description };
|
|
37
|
+
}
|
|
38
|
+
namespace cropShape {
|
|
39
|
+
export namespace control_4 {
|
|
40
|
+
let type: string;
|
|
41
|
+
let options: string[];
|
|
42
|
+
}
|
|
43
|
+
export { control_4 as control };
|
|
44
|
+
let description_4: string;
|
|
45
|
+
export { description_4 as description };
|
|
46
|
+
}
|
|
47
|
+
namespace iconUrl {
|
|
48
|
+
let control_5: string;
|
|
49
|
+
export { control_5 as control };
|
|
50
|
+
let description_5: string;
|
|
51
|
+
export { description_5 as description };
|
|
52
|
+
}
|
|
53
|
+
namespace buttonLabel {
|
|
54
|
+
let control_6: string;
|
|
55
|
+
export { control_6 as control };
|
|
56
|
+
let description_6: string;
|
|
57
|
+
export { description_6 as description };
|
|
58
|
+
}
|
|
59
|
+
namespace acceptedLabel {
|
|
60
|
+
let control_7: string;
|
|
61
|
+
export { control_7 as control };
|
|
62
|
+
let description_7: string;
|
|
63
|
+
export { description_7 as description };
|
|
64
|
+
}
|
|
65
|
+
namespace maxSizeLabel {
|
|
66
|
+
let control_8: string;
|
|
67
|
+
export { control_8 as control };
|
|
68
|
+
let description_8: string;
|
|
69
|
+
export { description_8 as description };
|
|
70
|
+
}
|
|
71
|
+
namespace uploadProgress {
|
|
72
|
+
export namespace control_9 {
|
|
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
|
+
}
|
|
79
|
+
export { control_9 as control };
|
|
80
|
+
let description_9: string;
|
|
81
|
+
export { description_9 as description };
|
|
82
|
+
}
|
|
83
|
+
namespace isLoading {
|
|
84
|
+
let control_10: string;
|
|
85
|
+
export { control_10 as control };
|
|
86
|
+
let description_10: string;
|
|
87
|
+
export { description_10 as description };
|
|
88
|
+
}
|
|
89
|
+
namespace errorMessage {
|
|
90
|
+
let control_11: string;
|
|
91
|
+
export { control_11 as control };
|
|
92
|
+
let description_11: string;
|
|
93
|
+
export { description_11 as description };
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export default _default;
|
|
98
|
+
export const Default: any;
|
|
99
|
+
export const WithDescription: any;
|
|
100
|
+
export const WithoutDragAndDrop: any;
|
|
101
|
+
export const WithError: any;
|
|
102
|
+
export const WithProgress: any;
|
|
103
|
+
export const MultipleExtensions: any;
|
|
104
|
+
export const WithSquareCropping: any;
|
|
105
|
+
export const WithCircleCropping: any;
|
|
106
|
+
import FileUploader from "./FileUploader";
|