allaw-ui 3.3.6 → 3.3.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.
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ export type EntityCardProps = {
3
+ entityName: string;
4
+ numberOfMembers: number;
5
+ formatedAddress?: string;
6
+ immat?: string;
7
+ actionType: "QUIT" | "REQUEST" | "REMOVE_REQUEST" | "NONE";
8
+ onActionButtonClick?: () => void;
9
+ onCardClick?: () => void;
10
+ };
11
+ declare function EntityCard({ entityName, numberOfMembers, formatedAddress, immat, actionType, onActionButtonClick, onCardClick }: EntityCardProps): React.JSX.Element;
12
+ export default EntityCard;
@@ -0,0 +1,51 @@
1
+ import React from "react";
2
+ import styles from "./entityCard.module.css";
3
+ var ActionButton = function (_a) {
4
+ var type = _a.type, action = _a.action;
5
+ var elements = {
6
+ "QUIT": {
7
+ text: "Quitter l'organisation",
8
+ icon: "allaw-icon-close",
9
+ color: "#E15151",
10
+ },
11
+ "REQUEST": {
12
+ text: "Demander à rejoindre",
13
+ icon: "allaw-icon-arrow-right",
14
+ color: "#25BEEB",
15
+ },
16
+ "REMOVE_REQUEST": {
17
+ text: "Annuler la demande",
18
+ icon: "allaw-icon-close",
19
+ color: "#E15151",
20
+ },
21
+ "NONE": {
22
+ text: "",
23
+ icon: "",
24
+ color: "",
25
+ }
26
+ };
27
+ return React.createElement("button", { style: { color: elements[type].color }, className: styles.actionButton, onClick: function () { action && action(); } },
28
+ elements[type].text,
29
+ React.createElement("i", { className: elements[type].icon }));
30
+ };
31
+ function EntityCard(_a) {
32
+ var entityName = _a.entityName, numberOfMembers = _a.numberOfMembers, formatedAddress = _a.formatedAddress, immat = _a.immat, actionType = _a.actionType, onActionButtonClick = _a.onActionButtonClick, onCardClick = _a.onCardClick;
33
+ return React.createElement("div", { className: styles.card, style: { cursor: onCardClick ? "pointer" : "default" }, onClick: function () { return onCardClick && onCardClick(); } },
34
+ React.createElement("div", { className: styles.picturePlaceHolder },
35
+ React.createElement("i", { className: "allaw-icon-home" })),
36
+ React.createElement("div", { className: styles.dataInfo },
37
+ React.createElement("div", { className: styles.basicsInfo },
38
+ React.createElement("span", { className: styles.entityName }, entityName),
39
+ React.createElement("span", { className: styles.numberOfMembers }, formatedAddress)),
40
+ React.createElement("div", { className: styles.detailsInfo },
41
+ React.createElement("span", { className: styles.detail },
42
+ React.createElement("i", { className: "allaw-icon-users" }),
43
+ numberOfMembers,
44
+ " membre",
45
+ numberOfMembers > 1 ? "s" : ""),
46
+ React.createElement("span", { className: styles.detail },
47
+ React.createElement("i", { className: "allaw-icon-prestation" }),
48
+ immat))),
49
+ actionType != "NONE" && React.createElement(ActionButton, { type: actionType, action: onActionButtonClick && onActionButtonClick() }));
50
+ }
51
+ export default EntityCard;
@@ -0,0 +1,7 @@
1
+ declare namespace _default {
2
+ export let title: string;
3
+ export { EntityCard as component };
4
+ }
5
+ export default _default;
6
+ export const Default: any;
7
+ import EntityCard from "./EntityCard";
@@ -0,0 +1,30 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import React from "react";
13
+ import EntityCard from "./EntityCard";
14
+ import { action } from "@storybook/addon-actions";
15
+ export default {
16
+ title: "Components/Molecules/EntityCard",
17
+ component: EntityCard,
18
+ };
19
+ var Template = function (args) { return React.createElement(EntityCard, __assign({}, args)); };
20
+ export var Default = Template.bind({});
21
+ Default.args = {
22
+ pictureLink: "https://via.placeholder.com/100",
23
+ entityName: "Cabinet Martin & Associés",
24
+ numberOfMembers: 3,
25
+ formatedAddress: "12 rue du Droit, 75001 Paris",
26
+ immat: "RCS Paris 123 456 789",
27
+ actionType: "REQUEST",
28
+ onActionButtonClick: action("Action button clicked"),
29
+ onCardClick: action("Card clicked"),
30
+ };
@@ -0,0 +1,115 @@
1
+ .card {
2
+ display: flex;
3
+ min-height: 92px;
4
+ padding: 16px;
5
+ justify-content: start;
6
+ align-items: center;
7
+ gap: 1rem;
8
+ flex-wrap: wrap;
9
+ align-self: stretch;
10
+ border-radius: 16px;
11
+ border: 1.5px solid var(--Primary-Venom-grey, #E6EDF5);
12
+ }
13
+
14
+ .picturePlaceHolder {
15
+ display: flex;
16
+ width: 60px;
17
+ height: 60px;
18
+ padding: 8px;
19
+ justify-content: center;
20
+ align-items: center;
21
+ gap: 10px;
22
+ border-radius: 8px;
23
+ background: #F5F7FA;
24
+ }
25
+
26
+ .dataInfo {
27
+ display: flex;
28
+ flex-direction: row;
29
+ gap: 2rem;
30
+ flex-wrap: wrap;
31
+ }
32
+
33
+ .basicsInfo {
34
+ display: flex;
35
+ flex-direction: column;
36
+ gap: 0.25rem;
37
+ align-items: start;
38
+ }
39
+
40
+ .entityName {
41
+ color: #000;
42
+ leading-trim: both;
43
+ text-edge: cap;
44
+ font-family: Poppins;
45
+ font-size: 16px;
46
+ font-style: normal;
47
+ font-weight: 600;
48
+ line-height: 22px; /* 137.5% */
49
+ max-width: 300px;
50
+ overflow: hidden;
51
+ text-overflow: ellipsis;
52
+ white-space: nowrap;
53
+ }
54
+
55
+ .numberOfMembers {
56
+ color: #456073;
57
+ leading-trim: both;
58
+ text-edge: cap;
59
+ font-family: var(--font-open-sans);
60
+ font-size: 16px;
61
+ font-style: normal;
62
+ font-weight: 500;
63
+ line-height: normal;
64
+ max-width: 300px;
65
+ overflow: hidden;
66
+ text-overflow: ellipsis;
67
+ white-space: nowrap;
68
+ }
69
+
70
+ .detailsInfo {
71
+ display: flex;
72
+ flex-direction: row;
73
+ gap: 1rem;
74
+ align-items: center;
75
+ flex-wrap: wrap;
76
+ }
77
+
78
+ .detail {
79
+ display: flex;
80
+ padding: 2px 0px;
81
+ justify-content: center;
82
+ align-items: center;
83
+ gap: 8px;
84
+ color: var(--Primary-Dark-grey, #456073);
85
+ leading-trim: both;
86
+ text-edge: cap;
87
+ text-wrap: nowrap;
88
+ /* OS - 16px - Paragraphe/OS - SemiBold */
89
+ font-family: var(--font-open-sans);
90
+ font-size: 16px;
91
+ font-style: normal;
92
+ font-weight: 500;
93
+ line-height: normal;
94
+ }
95
+
96
+ .actionButton {
97
+ margin-left: auto;
98
+ display: flex;
99
+ padding: 12px 0px;
100
+ align-items: baseline;
101
+ gap: 8px;
102
+ cursor: pointer;
103
+
104
+ font-family: var(--font-open-sans);
105
+ font-size: 16px;
106
+ font-style: normal;
107
+ font-weight: 500;
108
+ line-height: normal;
109
+ background: transparent;
110
+ border: none;
111
+ }
112
+
113
+ .actionButton > i {
114
+ font-size: 12px;
115
+ }
@@ -0,0 +1,2 @@
1
+ export { default as EntityCard } from "./EntityCard";
2
+ export type { EntityCardProps } from "./EntityCard";
@@ -0,0 +1 @@
1
+ export { default as EntityCard } from "./EntityCard";
@@ -1,18 +1,32 @@
1
1
  import React from "react";
2
+ interface ImageConfig {
3
+ url: string;
4
+ alt?: string;
5
+ width?: number | string;
6
+ height?: number | string;
7
+ padding?: string;
8
+ className?: string;
9
+ style?: React.CSSProperties;
10
+ }
2
11
  export interface ModalProps {
3
12
  show: boolean;
4
13
  title: string;
5
14
  description: string;
6
15
  confirmLabel: string;
7
- cancelLabel: string;
16
+ cancelLabel?: string;
8
17
  onConfirm: () => void;
9
18
  onCancel: () => void;
10
19
  isDanger?: boolean;
11
20
  confirmIconName?: string;
21
+ imageConfig?: ImageConfig;
12
22
  verticalOffset?: {
13
23
  top?: number;
14
24
  bottom?: number;
15
25
  };
26
+ horizontalOffset?: {
27
+ left?: number;
28
+ right?: number;
29
+ };
16
30
  }
17
31
  declare const Modal: React.FC<ModalProps>;
18
32
  export default Modal;
@@ -1,3 +1,14 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  import React, { useEffect, useRef, useState } from "react";
2
13
  import ReactDOM from "react-dom";
3
14
  import style from "./Modal.module.css";
@@ -6,8 +17,9 @@ import SecondaryButton from "../../atoms/buttons/SecondaryButton";
6
17
  import Heading from "../../atoms/typography/Heading";
7
18
  import Paragraph from "../../atoms/typography/Paragraph";
8
19
  var Modal = function (_a) {
9
- var show = _a.show, title = _a.title, description = _a.description, confirmLabel = _a.confirmLabel, cancelLabel = _a.cancelLabel, onConfirm = _a.onConfirm, onCancel = _a.onCancel, _b = _a.isDanger, isDanger = _b === void 0 ? false : _b, _c = _a.confirmIconName, confirmIconName = _c === void 0 ? "allaw-icon-check" : _c, verticalOffset = _a.verticalOffset;
20
+ var show = _a.show, title = _a.title, description = _a.description, confirmLabel = _a.confirmLabel, cancelLabel = _a.cancelLabel, onConfirm = _a.onConfirm, onCancel = _a.onCancel, _b = _a.isDanger, isDanger = _b === void 0 ? false : _b, _c = _a.confirmIconName, confirmIconName = _c === void 0 ? "allaw-icon-check" : _c, imageConfig = _a.imageConfig, verticalOffset = _a.verticalOffset, horizontalOffset = _a.horizontalOffset;
10
21
  var _d = useState(false), isVisible = _d[0], setIsVisible = _d[1];
22
+ var _e = useState(false), imgError = _e[0], setImgError = _e[1];
11
23
  var portalContainerRef = useRef(null);
12
24
  var modalContentRef = useRef(null);
13
25
  var isMouseDownOutsideRef = useRef(false);
@@ -18,6 +30,7 @@ var Modal = function (_a) {
18
30
  portalContainerRef.current = container;
19
31
  document.body.style.overflow = "hidden";
20
32
  setIsVisible(true);
33
+ setImgError(false);
21
34
  }
22
35
  else {
23
36
  setIsVisible(false);
@@ -52,6 +65,9 @@ var Modal = function (_a) {
52
65
  onCancel();
53
66
  }
54
67
  };
68
+ var handleImageError = function () {
69
+ setImgError(true);
70
+ };
55
71
  if (!show || !isVisible || !portalContainerRef.current)
56
72
  return null;
57
73
  var modalContent = (React.createElement("div", { className: "".concat(style.modalOverlay, " ").concat(isVisible ? style.visible : "", " ").concat(show ? style.modal : ""), onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, style: {
@@ -59,14 +75,22 @@ var Modal = function (_a) {
59
75
  paddingBottom: (verticalOffset === null || verticalOffset === void 0 ? void 0 : verticalOffset.bottom)
60
76
  ? "".concat(verticalOffset.bottom, "px")
61
77
  : undefined,
78
+ paddingLeft: (horizontalOffset === null || horizontalOffset === void 0 ? void 0 : horizontalOffset.left)
79
+ ? "".concat(horizontalOffset.left, "px")
80
+ : undefined,
81
+ paddingRight: (horizontalOffset === null || horizontalOffset === void 0 ? void 0 : horizontalOffset.right)
82
+ ? "".concat(horizontalOffset.right, "px")
83
+ : undefined,
62
84
  } },
63
85
  React.createElement("div", { className: "".concat(style.modalContent, " ").concat(show ? style.modal : ""), ref: modalContentRef },
64
86
  React.createElement("div", { className: style.modalHeadingWrapper },
65
87
  React.createElement(Heading, { text: title, variant: "h4", color: "noir", align: "left" })),
66
88
  React.createElement("div", { className: style.modalParagraphWrapper },
67
89
  React.createElement(Paragraph, { text: description, variant: "medium", size: "default", className: style.modalParagraph })),
90
+ imageConfig && !imgError && (React.createElement("div", { className: "".concat(style.modalImageWrapper, " ").concat(imageConfig.className || ""), style: __assign({ padding: imageConfig.padding }, imageConfig.style) },
91
+ React.createElement("img", { src: imageConfig.url, alt: imageConfig.alt || "", width: imageConfig.width, height: imageConfig.height, onError: handleImageError, className: style.modalImage }))),
68
92
  React.createElement("div", { className: style.modalButtons },
69
- React.createElement(SecondaryButton, { label: cancelLabel, onClick: onCancel, startIconName: "allaw-icon-close", startIcon: true }),
93
+ cancelLabel && (React.createElement(SecondaryButton, { label: cancelLabel, onClick: onCancel, startIconName: "allaw-icon-close", startIcon: true })),
70
94
  React.createElement(PrimaryButton, { label: confirmLabel, variant: isDanger ? "warning" : "default", onClick: onConfirm, startIconName: confirmIconName, startIcon: true })))));
71
95
  return ReactDOM.createPortal(modalContent, portalContainerRef.current);
72
96
  };
@@ -275,6 +275,17 @@
275
275
  overflow-y: auto;
276
276
  }
277
277
 
278
+ .modalImageWrapper {
279
+ text-align: center;
280
+ margin: 0 0 2.5rem 0;
281
+ }
282
+
283
+ .modalImage {
284
+ max-width: 100%;
285
+ height: auto;
286
+ border-radius: 8px;
287
+ }
288
+
278
289
  .modalParagraph {
279
290
  text-align: left;
280
291
  }
@@ -290,6 +301,10 @@
290
301
  flex: 1;
291
302
  }
292
303
 
304
+ .modalButtons button:only-child {
305
+ width: 100%;
306
+ }
307
+
293
308
  @media (max-width: 1000px) {
294
309
  .modalContent {
295
310
  z-index: 5001;
@@ -9,44 +9,62 @@ declare namespace _default {
9
9
  }
10
10
  let description: string;
11
11
  }
12
- export namespace show {
13
- let control_1: string;
12
+ export namespace horizontalOffset {
13
+ export namespace control_1 {
14
+ let type_1: string;
15
+ export { type_1 as type };
16
+ }
14
17
  export { control_1 as control };
15
18
  let description_1: string;
16
19
  export { description_1 as description };
17
20
  }
18
- export namespace title_1 {
21
+ export namespace show {
19
22
  let control_2: string;
20
23
  export { control_2 as control };
21
24
  let description_2: string;
22
25
  export { description_2 as description };
23
26
  }
24
- export { title_1 as title };
25
- export namespace description_3 {
27
+ export namespace title_1 {
26
28
  let control_3: string;
27
29
  export { control_3 as control };
28
- let description_4: string;
29
- export { description_4 as description };
30
+ let description_3: string;
31
+ export { description_3 as description };
30
32
  }
31
- export { description_3 as description };
32
- export namespace confirmLabel {
33
+ export { title_1 as title };
34
+ export namespace description_4 {
33
35
  let control_4: string;
34
36
  export { control_4 as control };
35
37
  let description_5: string;
36
38
  export { description_5 as description };
37
39
  }
38
- export namespace cancelLabel {
40
+ export { description_4 as description };
41
+ export namespace confirmLabel {
39
42
  let control_5: string;
40
43
  export { control_5 as control };
41
44
  let description_6: string;
42
45
  export { description_6 as description };
43
46
  }
44
- export namespace isDanger {
47
+ export namespace cancelLabel {
45
48
  let control_6: string;
46
49
  export { control_6 as control };
47
50
  let description_7: string;
48
51
  export { description_7 as description };
49
52
  }
53
+ export namespace imageConfig {
54
+ export namespace control_7 {
55
+ let type_2: string;
56
+ export { type_2 as type };
57
+ }
58
+ export { control_7 as control };
59
+ let description_8: string;
60
+ export { description_8 as description };
61
+ }
62
+ export namespace isDanger {
63
+ let control_8: string;
64
+ export { control_8 as control };
65
+ let description_9: string;
66
+ export { description_9 as description };
67
+ }
50
68
  }
51
69
  export namespace parameters {
52
70
  namespace backgrounds {
@@ -63,4 +81,7 @@ export default _default;
63
81
  export const Default: any;
64
82
  export const DangerModal: any;
65
83
  export const WithLargeOffset: any;
84
+ export const WithImageConfig: any;
85
+ export const WithoutCancel: any;
86
+ export const OffsetBothWays: any;
66
87
  import Modal from "./Modal";
@@ -1,3 +1,4 @@
1
+ // src/components/molecules/modal/Modal.stories.jsx
1
2
  var __assign = (this && this.__assign) || function () {
2
3
  __assign = Object.assign || function(t) {
3
4
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -19,11 +20,13 @@ export default {
19
20
  tags: ["autodocs"],
20
21
  argTypes: {
21
22
  verticalOffset: {
22
- control: {
23
- type: "object",
24
- },
23
+ control: { type: "object" },
25
24
  description: "Décalage vertical du modal (en px) pour éviter les barres de navigation",
26
25
  },
26
+ horizontalOffset: {
27
+ control: { type: "object" },
28
+ description: "Décalage horizontal du modal (en px) pour éviter les éléments latéraux",
29
+ },
27
30
  show: {
28
31
  control: "boolean",
29
32
  description: "Affiche ou masque la modal",
@@ -42,7 +45,11 @@ export default {
42
45
  },
43
46
  cancelLabel: {
44
47
  control: "text",
45
- description: "Texte du bouton secondaire",
48
+ description: "Texte du bouton secondaire (optionnel)",
49
+ },
50
+ imageConfig: {
51
+ control: { type: "object" },
52
+ description: "Configuration de l'image à afficher (url, alt, dimensions, styles, padding, className)",
46
53
  },
47
54
  isDanger: {
48
55
  control: "boolean",
@@ -81,15 +88,39 @@ Default.args = {
81
88
  confirmLabel: "Confirmer",
82
89
  cancelLabel: "Annuler",
83
90
  isDanger: false,
84
- verticalOffset: {
85
- top: 64,
86
- bottom: 0,
91
+ verticalOffset: { top: 64, bottom: 0 },
92
+ horizontalOffset: { left: 0, right: 0 },
93
+ imageConfig: {
94
+ url: "https://cdn.iconscout.com/icon/free/png-512/free-checkmark-icon-download-in-svg-png-gif-file-formats--done-approved-check-tick-user-interface-pack-icons-1502470.png?f=webp&w=512",
95
+ alt: "Checkmark",
96
+ width: 64,
97
+ height: 64,
98
+ padding: "0px, 0px, 250px, 300px",
99
+ className: "",
100
+ style: {
101
+ backgroundColor: "#ffffff",
102
+ },
87
103
  },
88
104
  };
89
105
  export var DangerModal = Template.bind({});
90
106
  DangerModal.args = __assign(__assign({}, Default.args), { title: "Attention", description: "Cette action est irréversible. Voulez-vous continuer ?", confirmLabel: "Supprimer", isDanger: true });
91
107
  export var WithLargeOffset = Template.bind({});
92
- WithLargeOffset.args = __assign(__assign({}, Default.args), { verticalOffset: {
93
- top: 120,
94
- bottom: 80,
95
- } });
108
+ WithLargeOffset.args = __assign(__assign({}, Default.args), { verticalOffset: { top: 120, bottom: 80 } });
109
+ export var WithImageConfig = Template.bind({});
110
+ WithImageConfig.args = __assign(__assign({}, Default.args), { title: "Image personnalisée", description: "Cette modal affiche une image avec dimensions et styles personnalisés.", imageConfig: {
111
+ url: Default.args.imageConfig.url,
112
+ alt: "Custom checkmark",
113
+ width: 200,
114
+ height: 200,
115
+ padding: "24px",
116
+ className: "border-circle",
117
+ style: {
118
+ border: "4px dashed #007bff",
119
+ borderRadius: "50%",
120
+ backgroundColor: "#e9f5ff",
121
+ },
122
+ }, confirmLabel: "Valider", cancelLabel: "Annuler" });
123
+ export var WithoutCancel = Template.bind({});
124
+ WithoutCancel.args = __assign(__assign({}, Default.args), { title: "Information", description: "Cette action a été effectuée avec succès.", confirmLabel: "OK", cancelLabel: undefined });
125
+ export var OffsetBothWays = Template.bind({});
126
+ OffsetBothWays.args = __assign(__assign({}, Default.args), { title: "Modal avec décalages", description: "Décalages verticaux et horizontaux appliqués.", verticalOffset: { top: 100, bottom: 50 }, horizontalOffset: { left: 80, right: 80 } });
package/dist/index.d.ts CHANGED
@@ -81,6 +81,8 @@ export { default as FeatureCard } from "./components/atoms/featureCard/featureCa
81
81
  export type { FeatureType } from "./components/atoms/featureCard/featureCard";
82
82
  export { default as FeatureGrid } from "./components/molecules/featureGrid/FeatureGrid";
83
83
  export type { FeatureGridProps } from "./components/molecules/featureGrid/FeatureGrid";
84
+ export { default as EntityCard } from "./components/molecules/entityCard/EntityCard";
85
+ export type { EntityCardProps } from "./components/molecules/entityCard/EntityCard";
84
86
  export { default as HeroSection } from "./components/molecules/heroSection/HeroSection";
85
87
  export type { HeroSectionProps } from "./components/molecules/heroSection/HeroSection";
86
88
  export { default as FrameCTA } from "./components/molecules/frameCTA/FrameCTA";
package/dist/index.js CHANGED
@@ -91,6 +91,7 @@ export { default as VerificationCodeInput } from "./components/atoms/inputs/Veri
91
91
  export { default as Banner } from "./components/molecules/banner/Banner";
92
92
  export { default as FeatureCard } from "./components/atoms/featureCard/featureCard";
93
93
  export { default as FeatureGrid } from "./components/molecules/featureGrid/FeatureGrid";
94
+ export { default as EntityCard } from "./components/molecules/entityCard/EntityCard";
94
95
  export { default as HeroSection } from "./components/molecules/heroSection/HeroSection";
95
96
  export { default as FrameCTA } from "./components/molecules/frameCTA/FrameCTA";
96
97
  export { default as QuestionAnswer } from "./components/molecules/questionAnswer/QuestionAnswer";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "3.3.6",
3
+ "version": "3.3.8",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",