allaw-ui 5.2.2 → 5.2.4
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/entityCard/EntityCard.d.ts +2 -1
- package/dist/components/molecules/entityCard/EntityCard.js +10 -4
- package/dist/components/molecules/proSwitch/ProSwitchModal.js +21 -5
- package/dist/components/molecules/proSwitch/proSwitchModal.module.css +26 -6
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ export type EntityCardProps = {
|
|
|
8
8
|
onActionButtonClick?: () => void;
|
|
9
9
|
onCardClick?: () => void;
|
|
10
10
|
role?: "member" | "admin" | "pending";
|
|
11
|
+
logoUrl?: string;
|
|
11
12
|
};
|
|
12
|
-
declare function EntityCard({ entityName, numberOfMembers, formatedAddress, immat, actionType, onActionButtonClick, onCardClick, role, }: EntityCardProps): React.JSX.Element;
|
|
13
|
+
declare function EntityCard({ entityName, numberOfMembers, formatedAddress, immat, actionType, onActionButtonClick, onCardClick, role, logoUrl, }: EntityCardProps): React.JSX.Element;
|
|
13
14
|
export default EntityCard;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import Image from "next/image";
|
|
2
3
|
import styles from "./entityCard.module.css";
|
|
3
4
|
import TertiaryButton from "../../atoms/buttons/TertiaryButton";
|
|
4
5
|
import TinyInfo from "../../atoms/typography/TinyInfo";
|
|
@@ -59,10 +60,15 @@ var RoleTag = function (_a) {
|
|
|
59
60
|
return (React.createElement(InlineTag, { style: config.style, size: config.size, text: config.text, backgroundColor: config.backgroundColor }));
|
|
60
61
|
};
|
|
61
62
|
function EntityCard(_a) {
|
|
62
|
-
var entityName = _a.entityName, numberOfMembers = _a.numberOfMembers, formatedAddress = _a.formatedAddress, immat = _a.immat, actionType = _a.actionType, onActionButtonClick = _a.onActionButtonClick, onCardClick = _a.onCardClick, role = _a.role;
|
|
63
|
+
var entityName = _a.entityName, numberOfMembers = _a.numberOfMembers, formatedAddress = _a.formatedAddress, immat = _a.immat, actionType = _a.actionType, onActionButtonClick = _a.onActionButtonClick, onCardClick = _a.onCardClick, role = _a.role, logoUrl = _a.logoUrl;
|
|
64
|
+
var _b = useState(false), imgError = _b[0], setImgError = _b[1];
|
|
63
65
|
return (React.createElement("div", { className: styles.card, style: { cursor: onCardClick ? "pointer" : "default" }, onClick: function () { return onCardClick && onCardClick(); } },
|
|
64
|
-
React.createElement("div", { className: styles.picturePlaceHolder },
|
|
65
|
-
|
|
66
|
+
React.createElement("div", { className: styles.picturePlaceHolder }, logoUrl && !imgError ? (React.createElement(Image, { src: logoUrl, alt: "Logo ".concat(entityName), width: 64, height: 64, quality: 100, onError: function () { return setImgError(true); }, style: {
|
|
67
|
+
objectFit: "cover",
|
|
68
|
+
width: "100%",
|
|
69
|
+
height: "100%",
|
|
70
|
+
borderRadius: "8px",
|
|
71
|
+
} })) : (React.createElement("i", { className: "allaw-icon-home" }))),
|
|
66
72
|
React.createElement("div", { className: styles.dataInfo },
|
|
67
73
|
React.createElement("div", { className: styles.basicsInfo },
|
|
68
74
|
React.createElement("div", { className: styles.entityNameWrapper },
|
|
@@ -193,6 +193,13 @@ var ProSwitchModal = function (_a) {
|
|
|
193
193
|
var newSelected;
|
|
194
194
|
if (mode === "single") {
|
|
195
195
|
newSelected = [pro.proUserId];
|
|
196
|
+
var selectedPros_1 = pros.filter(function (p) {
|
|
197
|
+
return newSelected.includes(p.proUserId);
|
|
198
|
+
});
|
|
199
|
+
onSelect(selectedPros_1);
|
|
200
|
+
// Fermer la modal automatiquement en mode single
|
|
201
|
+
onClosePortal();
|
|
202
|
+
return;
|
|
196
203
|
}
|
|
197
204
|
else {
|
|
198
205
|
if (selected.includes(pro.proUserId)) {
|
|
@@ -210,6 +217,10 @@ var ProSwitchModal = function (_a) {
|
|
|
210
217
|
var selectedPros = pros.filter(function (p) { return newSelected.includes(p.proUserId); });
|
|
211
218
|
onSelect(selectedPros);
|
|
212
219
|
};
|
|
220
|
+
// Validation en mode multiple
|
|
221
|
+
var handleValidateSelection = function () {
|
|
222
|
+
onClosePortal();
|
|
223
|
+
};
|
|
213
224
|
// Détermination dynamique du max-width selon le nombre de profils
|
|
214
225
|
var modalMaxWidth = 580;
|
|
215
226
|
if (pros.length <= 2)
|
|
@@ -282,10 +293,15 @@ var ProSwitchModal = function (_a) {
|
|
|
282
293
|
activeDragPro.firstName,
|
|
283
294
|
" ",
|
|
284
295
|
activeDragPro.name)) : ("".concat(activeDragPro.firstName, " ").concat(activeDragPro.name))))) : null)),
|
|
285
|
-
isReorder ? (React.createElement(TinyInfo, { variant: "medium14", text: "D\u00E9placez les profils pour modifier leur ordre", startIcon: "allaw-icon-info", color: "mid-grey", className: styles.reorderInfo })) : (React.createElement("div", { className: styles.
|
|
286
|
-
"
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
296
|
+
isReorder ? (React.createElement(TinyInfo, { variant: "medium14", text: "D\u00E9placez les profils pour modifier leur ordre", startIcon: "allaw-icon-info", color: "mid-grey", className: styles.reorderInfo })) : (React.createElement("div", { className: styles.selectionFooter },
|
|
297
|
+
React.createElement("div", { className: styles.selectionInfo },
|
|
298
|
+
React.createElement("div", { className: styles.selectionMode }, mode === "single"
|
|
299
|
+
? "Sélection unique"
|
|
300
|
+
: "Sélection multiple"),
|
|
301
|
+
React.createElement("div", { className: styles.selectionCount },
|
|
302
|
+
pros.length,
|
|
303
|
+
" \u00E9l\u00E9ment",
|
|
304
|
+
pros.length > 1 ? "s" : "")),
|
|
305
|
+
mode === "multiple" && (React.createElement("button", { className: styles.validateBtn, onClick: handleValidateSelection, type: "button" }, "Valider"))))))), document.body);
|
|
290
306
|
};
|
|
291
307
|
export default ProSwitchModal;
|
|
@@ -290,17 +290,37 @@
|
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
+
.selectionFooter {
|
|
294
|
+
display: flex;
|
|
295
|
+
flex-direction: row;
|
|
296
|
+
align-items: center;
|
|
297
|
+
justify-content: space-between;
|
|
298
|
+
padding: 28px 24px 29px 16px;
|
|
299
|
+
position: sticky;
|
|
300
|
+
bottom: 0;
|
|
301
|
+
background: #f8fafc;
|
|
302
|
+
z-index: 1;
|
|
303
|
+
}
|
|
304
|
+
|
|
293
305
|
.selectionInfo {
|
|
306
|
+
display: flex;
|
|
307
|
+
flex-direction: column;
|
|
308
|
+
gap: 4px;
|
|
294
309
|
text-align: left;
|
|
295
310
|
color: #728ea7;
|
|
296
|
-
font-size: 15px;
|
|
297
|
-
padding: 28px 0 29px 16px;
|
|
298
311
|
font-family: var(--font-open-sans, "Open Sans");
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.selectionMode {
|
|
315
|
+
font-size: 15px;
|
|
316
|
+
font-weight: 600;
|
|
317
|
+
color: #171e25;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.selectionCount {
|
|
321
|
+
font-size: 14px;
|
|
299
322
|
font-weight: 500;
|
|
300
|
-
|
|
301
|
-
bottom: 0;
|
|
302
|
-
background: #f8fafc;
|
|
303
|
-
z-index: 1;
|
|
323
|
+
color: #728ea7;
|
|
304
324
|
}
|
|
305
325
|
|
|
306
326
|
.reorderInfo {
|