allaw-ui 5.5.8 → 5.6.0

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.
@@ -182,26 +182,39 @@
182
182
  margin-bottom: 2px;
183
183
  }
184
184
 
185
+ .case-card-pro-identity {
186
+ display: flex;
187
+ align-items: center;
188
+ gap: 8px;
189
+ transition: all 0.3s ease;
190
+ }
191
+
192
+ .case-card-pro-name.tiny-info {
193
+ width: auto;
194
+ white-space: nowrap;
195
+ transition: opacity 0.2s ease;
196
+ }
197
+
185
198
  .case-card-document-badge {
186
199
  display: flex;
187
200
  align-items: center;
188
201
  justify-content: center;
189
- height: 32px;
190
- border-radius: 8px;
202
+ height: 24px;
203
+ border-radius: 6px;
191
204
  background-color: #eef5fc;
192
- padding: 0 14px;
193
- gap: 10px;
205
+ padding: 0 10px;
206
+ gap: 8px;
194
207
  }
195
208
 
196
209
  .case-card-document-badge i {
197
210
  color: #25beeb;
198
- font-size: 18px;
211
+ font-size: 14px;
199
212
  }
200
213
 
201
214
  .case-card-document-counter {
202
215
  color: #456073;
203
216
  font-family: "Open Sans", sans-serif;
204
- font-size: 14px;
217
+ font-size: 12px;
205
218
  font-weight: 600;
206
219
  line-height: 1;
207
220
  letter-spacing: 0.3px;
@@ -23,6 +23,8 @@ export interface CaseCardProps {
23
23
  avatarUrl?: string;
24
24
  receivedDocuments?: number;
25
25
  totalDocuments?: number;
26
+ proFirstName?: string;
27
+ proLastName?: string;
26
28
  }
27
29
  declare const CaseCard: React.FC<CaseCardProps>;
28
30
  export default CaseCard;
@@ -1,16 +1,58 @@
1
- import React from "react";
1
+ "use client";
2
+ import React, { useRef, useState, useEffect } from "react";
2
3
  import "./CaseCard.css";
3
4
  import OtherStatusTag from "../../atoms/tags/OtherStatusTag";
4
5
  import CardDate from "../../atoms/typography/CardDate";
5
6
  import ProgressBar from "../../atoms/progressBars/ProgressBar";
6
7
  import AvatarBubble from "../proSwitch/AvatarBubble";
8
+ import { TinyInfo } from "../../atoms/typography";
7
9
  var CaseCard = function (_a) {
8
- var clientName = _a.clientName, title = _a.title, _b = _a.notificationCount, notificationCount = _b === void 0 ? 0 : _b, nextAppointment = _a.nextAppointment, categories = _a.categories, variant = _a.variant, _c = _a.categoryLabelLimit, categoryLabelLimit = _c === void 0 ? 20 : _c, _d = _a.isDisabled, isDisabled = _d === void 0 ? false : _d, _e = _a.dateStyle, dateStyle = _e === void 0 ? "hybride" : _e, dateLabel = _a.dateLabel, _f = _a.barColor, barColor = _f === void 0 ? "blue" : _f, _g = _a.showYear, showYear = _g === void 0 ? true : _g, _h = _a.steps, steps = _h === void 0 ? 100 : _h, _j = _a.currentStep, currentStep = _j === void 0 ? 50 : _j, _k = _a.hideProgressBar, hideProgressBar = _k === void 0 ? false : _k, avatarUrl = _a.avatarUrl, receivedDocuments = _a.receivedDocuments, totalDocuments = _a.totalDocuments;
10
+ var clientName = _a.clientName, title = _a.title, _b = _a.notificationCount, notificationCount = _b === void 0 ? 0 : _b, nextAppointment = _a.nextAppointment, categories = _a.categories, variant = _a.variant, _c = _a.categoryLabelLimit, categoryLabelLimit = _c === void 0 ? 20 : _c, _d = _a.isDisabled, isDisabled = _d === void 0 ? false : _d, _e = _a.dateStyle, dateStyle = _e === void 0 ? "hybride" : _e, dateLabel = _a.dateLabel, _f = _a.barColor, barColor = _f === void 0 ? "blue" : _f, _g = _a.showYear, showYear = _g === void 0 ? true : _g, _h = _a.steps, steps = _h === void 0 ? 100 : _h, _j = _a.currentStep, currentStep = _j === void 0 ? 50 : _j, _k = _a.hideProgressBar, hideProgressBar = _k === void 0 ? false : _k, avatarUrl = _a.avatarUrl, receivedDocuments = _a.receivedDocuments, totalDocuments = _a.totalDocuments, proFirstName = _a.proFirstName, proLastName = _a.proLastName;
11
+ var cardRef = useRef(null);
12
+ var _l = useState(0), cardWidth = _l[0], setCardWidth = _l[1];
13
+ useEffect(function () {
14
+ var currentRef = cardRef.current;
15
+ if (!currentRef)
16
+ return;
17
+ var observer = new ResizeObserver(function (entries) {
18
+ for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
19
+ var entry = entries_1[_i];
20
+ setCardWidth(entry.contentRect.width);
21
+ }
22
+ });
23
+ observer.observe(currentRef);
24
+ return function () {
25
+ observer.disconnect();
26
+ };
27
+ }, []);
28
+ var getIdentityText = function () {
29
+ if (!proLastName)
30
+ return "";
31
+ // Niveau 1 (Espace suffisant) : Prénom entier et Nom (Largeur > 420px)
32
+ if (cardWidth > 420) {
33
+ return "".concat(proFirstName ? "".concat(proFirstName, " ") : "").concat(proLastName);
34
+ }
35
+ // Niveau 2 (Espace réduit) : Initiales du prénom et Nom (Largeur > 350px)
36
+ if (cardWidth > 350 && proFirstName) {
37
+ var initials = proFirstName
38
+ .split(/[\s-]+/)
39
+ .map(function (part) { return (part[0] ? "".concat(part[0].toUpperCase(), ".") : ""); })
40
+ .join("");
41
+ return "".concat(initials, " ").concat(proLastName);
42
+ }
43
+ // Niveau 3 (Espace très réduit) : Titre et Nom (Largeur > 280px)
44
+ if (cardWidth > 280) {
45
+ return "Me ".concat(proLastName);
46
+ }
47
+ // Niveau 4 (Manque de place critique) : Masquer totalement
48
+ return "";
49
+ };
50
+ var identityText = getIdentityText();
9
51
  var normalizedNotificationCount = Math.max(0, Math.floor(Number.isFinite(notificationCount) ? notificationCount : 0));
10
52
  var notificationLabel = normalizedNotificationCount > 99
11
53
  ? "99+"
12
54
  : String(normalizedNotificationCount);
13
- return (React.createElement("div", { className: "case-card-wrapper case-card-".concat(variant) },
55
+ return (React.createElement("div", { className: "case-card-wrapper case-card-".concat(variant), ref: cardRef },
14
56
  normalizedNotificationCount > 0 && (React.createElement("div", { className: "case-card-notification-badge", "aria-label": "".concat(notificationLabel, " notification").concat(normalizedNotificationCount > 1 ? "s" : ""), title: "".concat(notificationLabel, " notification").concat(normalizedNotificationCount > 1 ? "s" : "") }, notificationLabel)),
15
57
  React.createElement("div", { className: "case-card-content ".concat(hideProgressBar ? "case-card-content-no-progress" : "") },
16
58
  React.createElement("div", { className: "case-card-header" },
@@ -21,9 +63,13 @@ var CaseCard = function (_a) {
21
63
  React.createElement("div", { className: "case-card-footer" },
22
64
  React.createElement("div", { className: "case-card-categories" }, categories.map(function (category, index) { return (React.createElement(OtherStatusTag, { key: index, label: category, type: "readonly", labelLimit: categoryLabelLimit })); })),
23
65
  (avatarUrl ||
66
+ proFirstName ||
67
+ proLastName ||
24
68
  (receivedDocuments !== undefined &&
25
69
  totalDocuments !== undefined)) && (React.createElement("div", { className: "case-card-bottom-right" },
26
- avatarUrl && (React.createElement(AvatarBubble, { firstName: "", name: "", src: avatarUrl, size: 30, disableHoverAnimation: true, clickable: false })),
70
+ (avatarUrl || proFirstName || proLastName) && (React.createElement("div", { className: "case-card-pro-identity" },
71
+ React.createElement(AvatarBubble, { firstName: proFirstName || "", name: proLastName || "", src: avatarUrl, size: 24, disableHoverAnimation: true, clickable: false }),
72
+ identityText && (React.createElement(TinyInfo, { variant: "medium12", color: "dark-grey", text: identityText, className: "case-card-pro-name", align: "left" })))),
27
73
  receivedDocuments !== undefined &&
28
74
  totalDocuments !== undefined && (React.createElement("div", { className: "case-card-document-badge" },
29
75
  React.createElement("i", { className: "allaw-icon-document" }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "5.5.8",
3
+ "version": "5.6.0",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",