allaw-ui 3.1.4 → 3.1.6
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/atoms/checkboxes/Checkbox.js +4 -3
- package/dist/components/molecules/checkboxForm/CheckboxForm.js +9 -6
- package/dist/components/molecules/modal/Modal.d.ts +17 -0
- package/dist/components/molecules/modal/Modal.js +62 -0
- package/dist/components/molecules/modal/Modal.module.css +338 -0
- package/dist/components/molecules/modal/Modal.stories.d.ts +66 -0
- package/dist/components/molecules/modal/Modal.stories.js +95 -0
- package/dist/components/molecules/modal/index.d.ts +2 -0
- package/dist/components/molecules/modal/index.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +1 -1
|
@@ -2,8 +2,8 @@ import React, { useState } from "react";
|
|
|
2
2
|
import "./Checkbox.css";
|
|
3
3
|
import "../../../styles/global.css";
|
|
4
4
|
var Checkbox = function (_a) {
|
|
5
|
-
var id = _a.id, _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange,
|
|
6
|
-
var
|
|
5
|
+
var id = _a.id, _b = _a.checked, checked = _b === void 0 ? false : _b, onChange = _a.onChange, color = _a.color, _c = _a.size, size = _c === void 0 ? "default" : _c, _d = _a.style, style = _d === void 0 ? "default" : _d, _e = _a.markType, markType = _e === void 0 ? "cross" : _e;
|
|
6
|
+
var _f = useState(checked), isChecked = _f[0], setIsChecked = _f[1];
|
|
7
7
|
var handleClick = function (e) {
|
|
8
8
|
e.preventDefault();
|
|
9
9
|
e.stopPropagation();
|
|
@@ -14,6 +14,7 @@ var Checkbox = function (_a) {
|
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
var checkboxColor = style === "light" ? "light" : color;
|
|
17
|
-
|
|
17
|
+
var colorClass = checkboxColor ? "checkbox-".concat(checkboxColor) : "";
|
|
18
|
+
return (React.createElement("button", { id: id, className: "checkbox ".concat(isChecked ? "checkbox-pressed" : "checkbox-default", " ").concat(colorClass, " ").concat(size === "small" ? "checkbox-small" : "", " ").concat(style === "light" ? "checkbox-light" : "", " ").concat(style === "form" ? "checkbox-style-form" : ""), onClick: handleClick, "data-cy": "checkbox-".concat(id) }, isChecked && (React.createElement("span", { className: "checkbox-icon ".concat(markType === "cross" ? "allaw-icon-close" : "allaw-icon-check", " ").concat(colorClass, " ").concat(style === "light" ? "checkbox-icon-light" : "") }))));
|
|
18
19
|
};
|
|
19
20
|
export default Checkbox;
|
|
@@ -10,14 +10,17 @@ var CheckboxForm = function (_a) {
|
|
|
10
10
|
onChange(checked);
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
//
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
// Déterminer la couleur à utiliser
|
|
14
|
+
var checkboxColor = style === "light"
|
|
15
|
+
? "light"
|
|
16
|
+
: style === "form"
|
|
17
|
+
? undefined
|
|
18
|
+
: color || "noir";
|
|
19
|
+
var colorClass = checkboxColor ? "checkbox-form-".concat(checkboxColor) : "";
|
|
20
|
+
return (React.createElement("div", { className: "checkbox-form ".concat(colorClass, " ").concat(size === "small" ? "checkbox-form-small" : "") },
|
|
18
21
|
React.createElement(Checkbox, { id: checkboxId, checked: checked, onChange: handleCheckboxChange, color: checkboxColor, size: size, style: style, markType: markType }),
|
|
19
22
|
label && (React.createElement("label", { htmlFor: checkboxId, className: "checkbox-form-label-container" },
|
|
20
|
-
React.createElement(Paragraph, { variant: style === "form" ? "medium" : "semiBold", color: color ||
|
|
23
|
+
React.createElement(Paragraph, { variant: style === "form" ? "medium" : "semiBold", color: color || (style === "form" ? undefined : "noir"), text: React.createElement(React.Fragment, null,
|
|
21
24
|
React.createElement("span", null, label),
|
|
22
25
|
linkText && linkUrl && (React.createElement("a", { href: linkUrl, target: "_blank", rel: "noopener noreferrer", className: "checkbox-form-link", onClick: onLinkClick }, linkText))), size: size }),
|
|
23
26
|
isRequired && (React.createElement("span", { className: "checkbox-form-required" },
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface ModalProps {
|
|
3
|
+
show: boolean;
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
confirmLabel: string;
|
|
7
|
+
cancelLabel: string;
|
|
8
|
+
onConfirm: () => void;
|
|
9
|
+
onCancel: () => void;
|
|
10
|
+
isDanger?: boolean;
|
|
11
|
+
verticalOffset?: {
|
|
12
|
+
top?: number;
|
|
13
|
+
bottom?: number;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
declare const Modal: React.FC<ModalProps>;
|
|
17
|
+
export default Modal;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
+
import ReactDOM from "react-dom";
|
|
3
|
+
import style from "./Modal.module.css";
|
|
4
|
+
import PrimaryButton from "../../atoms/buttons/PrimaryButton";
|
|
5
|
+
import SecondaryButton from "../../atoms/buttons/SecondaryButton";
|
|
6
|
+
import Heading from "../../atoms/typography/Heading";
|
|
7
|
+
import Paragraph from "../../atoms/typography/Paragraph";
|
|
8
|
+
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, verticalOffset = _a.verticalOffset;
|
|
10
|
+
var _c = useState(false), isVisible = _c[0], setIsVisible = _c[1];
|
|
11
|
+
var portalContainerRef = useRef(null);
|
|
12
|
+
var modalContentRef = useRef(null);
|
|
13
|
+
useEffect(function () {
|
|
14
|
+
if (show) {
|
|
15
|
+
var container = document.createElement("div");
|
|
16
|
+
document.body.appendChild(container);
|
|
17
|
+
portalContainerRef.current = container;
|
|
18
|
+
document.body.classList.add("modal-open");
|
|
19
|
+
setIsVisible(true);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
setIsVisible(false);
|
|
23
|
+
if (portalContainerRef.current &&
|
|
24
|
+
document.body.contains(portalContainerRef.current)) {
|
|
25
|
+
document.body.removeChild(portalContainerRef.current);
|
|
26
|
+
document.body.classList.remove("modal-open");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return function () {
|
|
30
|
+
setIsVisible(false);
|
|
31
|
+
if (portalContainerRef.current &&
|
|
32
|
+
document.body.contains(portalContainerRef.current)) {
|
|
33
|
+
document.body.removeChild(portalContainerRef.current);
|
|
34
|
+
document.body.classList.remove("modal-open");
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}, [show]);
|
|
38
|
+
var handleOutsideClick = function (e) {
|
|
39
|
+
if (modalContentRef.current &&
|
|
40
|
+
!modalContentRef.current.contains(e.target)) {
|
|
41
|
+
onCancel();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
if (!show || !isVisible || !portalContainerRef.current)
|
|
45
|
+
return null;
|
|
46
|
+
var modalContent = (React.createElement("div", { className: "".concat(style.modalOverlay, " ").concat(isVisible ? style.visible : ""), onClick: handleOutsideClick, style: {
|
|
47
|
+
paddingTop: (verticalOffset === null || verticalOffset === void 0 ? void 0 : verticalOffset.top) ? "".concat(verticalOffset.top, "px") : undefined,
|
|
48
|
+
paddingBottom: (verticalOffset === null || verticalOffset === void 0 ? void 0 : verticalOffset.bottom)
|
|
49
|
+
? "".concat(verticalOffset.bottom, "px")
|
|
50
|
+
: undefined,
|
|
51
|
+
} },
|
|
52
|
+
React.createElement("div", { className: style.modalContent, ref: modalContentRef },
|
|
53
|
+
React.createElement("div", { className: style.modalHeadingWrapper },
|
|
54
|
+
React.createElement(Heading, { text: title, variant: "h4", color: "noir", align: "left" })),
|
|
55
|
+
React.createElement("div", { className: style.modalParagraphWrapper },
|
|
56
|
+
React.createElement(Paragraph, { text: description, variant: "medium", size: "default", className: style.modalParagraph })),
|
|
57
|
+
React.createElement("div", { className: style.modalButtons },
|
|
58
|
+
React.createElement(SecondaryButton, { label: cancelLabel, onClick: onCancel, startIconName: "allaw-icon-close", startIcon: true }),
|
|
59
|
+
React.createElement(PrimaryButton, { label: confirmLabel, variant: isDanger ? "warning" : "default", onClick: onConfirm, endIconName: "allaw-icon-check", endIcon: true })))));
|
|
60
|
+
return ReactDOM.createPortal(modalContent, portalContainerRef.current);
|
|
61
|
+
};
|
|
62
|
+
export default Modal;
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
.stepper-container {
|
|
2
|
+
display: flex;
|
|
3
|
+
width: 100vw;
|
|
4
|
+
max-width: 768px;
|
|
5
|
+
padding: 2.5rem;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: 16px;
|
|
10
|
+
border-radius: 16px;
|
|
11
|
+
background: #fff;
|
|
12
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
13
|
+
position: relative;
|
|
14
|
+
z-index: 1001;
|
|
15
|
+
max-height: 90vh;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.stepper-content {
|
|
20
|
+
width: 100%;
|
|
21
|
+
flex: 1;
|
|
22
|
+
margin: 20px 0;
|
|
23
|
+
overflow-y: auto;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
align-items: center;
|
|
27
|
+
font-family: "Open Sans", sans-serif;
|
|
28
|
+
font-size: 16px;
|
|
29
|
+
font-weight: 400;
|
|
30
|
+
line-height: 24px;
|
|
31
|
+
letter-spacing: 0em;
|
|
32
|
+
/* padding-right: 16px; */
|
|
33
|
+
margin: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.stepper-content::-webkit-scrollbar {
|
|
37
|
+
width: 8px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.stepper-content::-webkit-scrollbar-track {
|
|
41
|
+
background: #f1f1f1;
|
|
42
|
+
border-radius: 4px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.stepper-content::-webkit-scrollbar-thumb {
|
|
46
|
+
background: #888;
|
|
47
|
+
border-radius: 4px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.stepper-content::-webkit-scrollbar-thumb:hover {
|
|
51
|
+
background: #555;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.stepper-buttons {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: row;
|
|
57
|
+
justify-content: space-between;
|
|
58
|
+
align-items: center;
|
|
59
|
+
width: 100%;
|
|
60
|
+
gap: 16px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.stepper-buttons.no-buttons {
|
|
64
|
+
display: none;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.stepper-button-container {
|
|
68
|
+
display: flex;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
align-items: center;
|
|
71
|
+
width: 100%;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.secondary-button-container {
|
|
75
|
+
width: 38.2%;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.secondary-button-container.hidden,
|
|
79
|
+
.primary-button-container.hidden {
|
|
80
|
+
display: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.primary-button-container {
|
|
84
|
+
width: 61.8%;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.stepper-buttons .primary-button-container:only-child {
|
|
88
|
+
width: 100%;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.stepper-overlay {
|
|
92
|
+
position: fixed;
|
|
93
|
+
top: 0;
|
|
94
|
+
left: 0;
|
|
95
|
+
width: 100%;
|
|
96
|
+
height: 100%;
|
|
97
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
98
|
+
display: flex;
|
|
99
|
+
justify-content: center;
|
|
100
|
+
align-items: center;
|
|
101
|
+
z-index: 3000;
|
|
102
|
+
opacity: 0;
|
|
103
|
+
visibility: hidden;
|
|
104
|
+
transition: opacity 0.3s ease, visibility 0.3s ease;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.stepper-overlay.visible {
|
|
108
|
+
opacity: 1;
|
|
109
|
+
visibility: visible;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Classe pour bloquer le scroll du body */
|
|
113
|
+
body.stepper-open {
|
|
114
|
+
overflow: hidden;
|
|
115
|
+
position: fixed;
|
|
116
|
+
width: 100%;
|
|
117
|
+
height: 100%;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@media (max-width: 1000px) {
|
|
121
|
+
.stepper-container {
|
|
122
|
+
z-index: 5001;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@media (max-width: 800px) {
|
|
127
|
+
.stepper-container {
|
|
128
|
+
height: 96dvh;
|
|
129
|
+
position: fixed;
|
|
130
|
+
bottom: 0;
|
|
131
|
+
justify-content: flex-start;
|
|
132
|
+
padding: 2rem;
|
|
133
|
+
border-bottom-left-radius: 0;
|
|
134
|
+
border-bottom-right-radius: 0;
|
|
135
|
+
max-height: none;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.stepper-overlay {
|
|
139
|
+
padding-top: 0 !important;
|
|
140
|
+
padding-bottom: 0 !important;
|
|
141
|
+
z-index: 5001;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.stepper-container.modal-active {
|
|
146
|
+
position: relative;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.stepper-container.modal-active::before {
|
|
150
|
+
content: "";
|
|
151
|
+
position: absolute;
|
|
152
|
+
top: 0;
|
|
153
|
+
left: 0;
|
|
154
|
+
width: 100%;
|
|
155
|
+
height: 100%;
|
|
156
|
+
background: rgba(0, 0, 0, 0.3);
|
|
157
|
+
filter: brightness(50%);
|
|
158
|
+
z-index: 1000;
|
|
159
|
+
pointer-events: none;
|
|
160
|
+
border-radius: 16px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.confirmation-modal {
|
|
164
|
+
position: absolute;
|
|
165
|
+
inset: 0;
|
|
166
|
+
display: flex;
|
|
167
|
+
justify-content: center;
|
|
168
|
+
align-items: center;
|
|
169
|
+
z-index: 1100;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.confirmation-modal-content {
|
|
173
|
+
background: #fff;
|
|
174
|
+
border-radius: 16px;
|
|
175
|
+
padding: 2rem;
|
|
176
|
+
max-width: 400px;
|
|
177
|
+
width: 90%;
|
|
178
|
+
text-align: center;
|
|
179
|
+
animation: fadeIn 0.2s ease-out;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.confirmation-modal-heading-wrapper {
|
|
183
|
+
margin-bottom: 1.5rem;
|
|
184
|
+
display: flex;
|
|
185
|
+
justify-content: start;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.confirmation-modal-paragraph-wrapper {
|
|
189
|
+
margin-bottom: 2.5rem;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.confirmation-modal-paragraph {
|
|
193
|
+
text-align: left;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.confirmation-modal-buttons {
|
|
197
|
+
display: flex;
|
|
198
|
+
justify-content: space-between;
|
|
199
|
+
gap: 16px;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.confirmation-modal-buttons button {
|
|
203
|
+
flex: 1;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
@keyframes fadeIn {
|
|
207
|
+
from {
|
|
208
|
+
opacity: 0;
|
|
209
|
+
transform: scale(0.9);
|
|
210
|
+
}
|
|
211
|
+
to {
|
|
212
|
+
opacity: 1;
|
|
213
|
+
transform: scale(1);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.stepper-button-container.auto-width {
|
|
218
|
+
width: auto;
|
|
219
|
+
margin: 0 auto;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.stepper-button-container.auto-width button {
|
|
223
|
+
width: auto;
|
|
224
|
+
min-width: 150px;
|
|
225
|
+
padding-left: 24px;
|
|
226
|
+
padding-right: 24px;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.stepper-buttons .primary-button-container.auto-width:only-child {
|
|
230
|
+
width: auto;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.modalOverlay {
|
|
234
|
+
position: fixed;
|
|
235
|
+
top: 0;
|
|
236
|
+
left: 0;
|
|
237
|
+
width: 100%;
|
|
238
|
+
height: 100%;
|
|
239
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
240
|
+
display: flex;
|
|
241
|
+
justify-content: center;
|
|
242
|
+
align-items: center;
|
|
243
|
+
z-index: 3000;
|
|
244
|
+
opacity: 0;
|
|
245
|
+
visibility: hidden;
|
|
246
|
+
transition: opacity 0.3s ease, visibility 0.3s ease;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.modalOverlay.visible {
|
|
250
|
+
opacity: 1;
|
|
251
|
+
visibility: visible;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.modalContent {
|
|
255
|
+
background: #fff;
|
|
256
|
+
border-radius: 16px;
|
|
257
|
+
padding: 2rem;
|
|
258
|
+
max-width: 500px;
|
|
259
|
+
width: 90%;
|
|
260
|
+
animation: fadeIn 0.2s ease-out;
|
|
261
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
262
|
+
max-height: 90vh;
|
|
263
|
+
display: flex;
|
|
264
|
+
flex-direction: column;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.modalHeadingWrapper {
|
|
268
|
+
margin-bottom: 1.5rem;
|
|
269
|
+
display: flex;
|
|
270
|
+
justify-content: start;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.modalParagraphWrapper {
|
|
274
|
+
margin-bottom: 2.5rem;
|
|
275
|
+
overflow-y: auto;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.modalParagraph {
|
|
279
|
+
text-align: left;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.modalButtons {
|
|
283
|
+
display: flex;
|
|
284
|
+
justify-content: space-between;
|
|
285
|
+
gap: 16px;
|
|
286
|
+
margin-top: auto;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.modalButtons button {
|
|
290
|
+
flex: 1;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/* Classe pour bloquer le scroll du body */
|
|
294
|
+
:global(body.modal-open) {
|
|
295
|
+
overflow: hidden;
|
|
296
|
+
position: fixed;
|
|
297
|
+
width: 100%;
|
|
298
|
+
height: 100%;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
@keyframes fadeIn {
|
|
302
|
+
from {
|
|
303
|
+
opacity: 0;
|
|
304
|
+
transform: scale(0.9);
|
|
305
|
+
}
|
|
306
|
+
to {
|
|
307
|
+
opacity: 1;
|
|
308
|
+
transform: scale(1);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
@media (max-width: 1000px) {
|
|
313
|
+
.modalContent {
|
|
314
|
+
z-index: 5001;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
@media (max-width: 800px) {
|
|
319
|
+
.modalContent {
|
|
320
|
+
height: 96dvh;
|
|
321
|
+
position: fixed;
|
|
322
|
+
bottom: 0;
|
|
323
|
+
justify-content: flex-start;
|
|
324
|
+
padding: 2rem;
|
|
325
|
+
border-bottom-left-radius: 0;
|
|
326
|
+
border-bottom-right-radius: 0;
|
|
327
|
+
max-height: none;
|
|
328
|
+
width: 100%;
|
|
329
|
+
max-width: 100%;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.modalOverlay {
|
|
333
|
+
padding-top: 0 !important;
|
|
334
|
+
padding-bottom: 0 !important;
|
|
335
|
+
z-index: 5001;
|
|
336
|
+
align-items: flex-end;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export let title: string;
|
|
3
|
+
export { Modal as component };
|
|
4
|
+
export let tags: string[];
|
|
5
|
+
export namespace argTypes {
|
|
6
|
+
export namespace verticalOffset {
|
|
7
|
+
namespace control {
|
|
8
|
+
let type: string;
|
|
9
|
+
}
|
|
10
|
+
let description: string;
|
|
11
|
+
}
|
|
12
|
+
export namespace show {
|
|
13
|
+
let control_1: string;
|
|
14
|
+
export { control_1 as control };
|
|
15
|
+
let description_1: string;
|
|
16
|
+
export { description_1 as description };
|
|
17
|
+
}
|
|
18
|
+
export namespace title_1 {
|
|
19
|
+
let control_2: string;
|
|
20
|
+
export { control_2 as control };
|
|
21
|
+
let description_2: string;
|
|
22
|
+
export { description_2 as description };
|
|
23
|
+
}
|
|
24
|
+
export { title_1 as title };
|
|
25
|
+
export namespace description_3 {
|
|
26
|
+
let control_3: string;
|
|
27
|
+
export { control_3 as control };
|
|
28
|
+
let description_4: string;
|
|
29
|
+
export { description_4 as description };
|
|
30
|
+
}
|
|
31
|
+
export { description_3 as description };
|
|
32
|
+
export namespace confirmLabel {
|
|
33
|
+
let control_4: string;
|
|
34
|
+
export { control_4 as control };
|
|
35
|
+
let description_5: string;
|
|
36
|
+
export { description_5 as description };
|
|
37
|
+
}
|
|
38
|
+
export namespace cancelLabel {
|
|
39
|
+
let control_5: string;
|
|
40
|
+
export { control_5 as control };
|
|
41
|
+
let description_6: string;
|
|
42
|
+
export { description_6 as description };
|
|
43
|
+
}
|
|
44
|
+
export namespace isDanger {
|
|
45
|
+
let control_6: string;
|
|
46
|
+
export { control_6 as control };
|
|
47
|
+
let description_7: string;
|
|
48
|
+
export { description_7 as description };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export namespace parameters {
|
|
52
|
+
namespace backgrounds {
|
|
53
|
+
let _default: string;
|
|
54
|
+
export { _default as default };
|
|
55
|
+
export let values: {
|
|
56
|
+
name: string;
|
|
57
|
+
value: string;
|
|
58
|
+
}[];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export default _default;
|
|
63
|
+
export const Default: any;
|
|
64
|
+
export const DangerModal: any;
|
|
65
|
+
export const WithLargeOffset: any;
|
|
66
|
+
import Modal from "./Modal";
|
|
@@ -0,0 +1,95 @@
|
|
|
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, { useState } from "react";
|
|
13
|
+
import { action } from "@storybook/addon-actions";
|
|
14
|
+
import Modal from "./Modal";
|
|
15
|
+
import "../../../styles/global.css";
|
|
16
|
+
export default {
|
|
17
|
+
title: "Components/Molecules/Modal",
|
|
18
|
+
component: Modal,
|
|
19
|
+
tags: ["autodocs"],
|
|
20
|
+
argTypes: {
|
|
21
|
+
verticalOffset: {
|
|
22
|
+
control: {
|
|
23
|
+
type: "object",
|
|
24
|
+
},
|
|
25
|
+
description: "Décalage vertical du modal (en px) pour éviter les barres de navigation",
|
|
26
|
+
},
|
|
27
|
+
show: {
|
|
28
|
+
control: "boolean",
|
|
29
|
+
description: "Affiche ou masque la modal",
|
|
30
|
+
},
|
|
31
|
+
title: {
|
|
32
|
+
control: "text",
|
|
33
|
+
description: "Titre de la modal",
|
|
34
|
+
},
|
|
35
|
+
description: {
|
|
36
|
+
control: "text",
|
|
37
|
+
description: "Description de la modal",
|
|
38
|
+
},
|
|
39
|
+
confirmLabel: {
|
|
40
|
+
control: "text",
|
|
41
|
+
description: "Texte du bouton principal",
|
|
42
|
+
},
|
|
43
|
+
cancelLabel: {
|
|
44
|
+
control: "text",
|
|
45
|
+
description: "Texte du bouton secondaire",
|
|
46
|
+
},
|
|
47
|
+
isDanger: {
|
|
48
|
+
control: "boolean",
|
|
49
|
+
description: "Applique le style d'alerte au bouton principal",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
parameters: {
|
|
53
|
+
backgrounds: {
|
|
54
|
+
default: "light",
|
|
55
|
+
values: [
|
|
56
|
+
{ name: "light", value: "#ffffff" },
|
|
57
|
+
{ name: "grey", value: "#728ea7" },
|
|
58
|
+
{ name: "figma", value: "#404040" },
|
|
59
|
+
{ name: "dark", value: "#171e25" },
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
var Template = function (args) {
|
|
65
|
+
var _a = useState(args.show), isVisible = _a[0], setIsVisible = _a[1];
|
|
66
|
+
return (React.createElement("div", null,
|
|
67
|
+
React.createElement("button", { onClick: function () { return setIsVisible(true); } }, "Ouvrir la modal"),
|
|
68
|
+
React.createElement(Modal, __assign({}, args, { show: isVisible, onConfirm: function () {
|
|
69
|
+
action("Confirm clicked")();
|
|
70
|
+
setIsVisible(false);
|
|
71
|
+
}, onCancel: function () {
|
|
72
|
+
action("Cancel clicked")();
|
|
73
|
+
setIsVisible(false);
|
|
74
|
+
} }))));
|
|
75
|
+
};
|
|
76
|
+
export var Default = Template.bind({});
|
|
77
|
+
Default.args = {
|
|
78
|
+
show: false,
|
|
79
|
+
title: "Confirmation",
|
|
80
|
+
description: "Êtes-vous sûr de vouloir effectuer cette action ?",
|
|
81
|
+
confirmLabel: "Confirmer",
|
|
82
|
+
cancelLabel: "Annuler",
|
|
83
|
+
isDanger: false,
|
|
84
|
+
verticalOffset: {
|
|
85
|
+
top: 64,
|
|
86
|
+
bottom: 0,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
export var DangerModal = Template.bind({});
|
|
90
|
+
DangerModal.args = __assign(__assign({}, Default.args), { title: "Attention", description: "Cette action est irréversible. Voulez-vous continuer ?", confirmLabel: "Supprimer", isDanger: true });
|
|
91
|
+
export var WithLargeOffset = Template.bind({});
|
|
92
|
+
WithLargeOffset.args = __assign(__assign({}, Default.args), { verticalOffset: {
|
|
93
|
+
top: 120,
|
|
94
|
+
bottom: 80,
|
|
95
|
+
} });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Modal } from "./Modal";
|
package/dist/index.d.ts
CHANGED
|
@@ -61,6 +61,8 @@ export type { DocumentCardProps } from "./components/molecules/documentCard/Docu
|
|
|
61
61
|
export { default as EmployeeCard } from "./components/molecules/employeeCard/EmployeeCard";
|
|
62
62
|
export { default as Stepper } from "./components/molecules/stepper/Stepper";
|
|
63
63
|
export type { StepperProps } from "./components/molecules/stepper/Stepper";
|
|
64
|
+
export { default as Modal } from "./components/molecules/modal/Modal";
|
|
65
|
+
export type { ModalProps } from "./components/molecules/modal/Modal";
|
|
64
66
|
export { default as CheckboxForm } from "./components/molecules/checkboxForm/CheckboxForm";
|
|
65
67
|
export type { CheckboxFormProps } from "./components/molecules/checkboxForm/CheckboxForm";
|
|
66
68
|
export { default as ColoredCheckbox } from "./components/molecules/checkboxForm/ColoredCheckbox";
|
package/dist/index.js
CHANGED
|
@@ -70,6 +70,8 @@ export { default as DocumentCard } from "./components/molecules/documentCard/Doc
|
|
|
70
70
|
export { default as EmployeeCard } from "./components/molecules/employeeCard/EmployeeCard";
|
|
71
71
|
// Stepper
|
|
72
72
|
export { default as Stepper } from "./components/molecules/stepper/Stepper";
|
|
73
|
+
// Modal
|
|
74
|
+
export { default as Modal } from "./components/molecules/modal/Modal";
|
|
73
75
|
// CheckboxForm
|
|
74
76
|
export { default as CheckboxForm } from "./components/molecules/checkboxForm/CheckboxForm";
|
|
75
77
|
export { default as ColoredCheckbox } from "./components/molecules/checkboxForm/ColoredCheckbox";
|