allaw-ui 2.2.9 → 2.3.1
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/inputs/Input.css +3 -3
- package/dist/components/atoms/inputs/TextArea.css +1 -1
- package/dist/components/atoms/selects/ComboBox.css +1 -1
- package/dist/components/molecules/stepper/Stepper.css +41 -18
- package/dist/components/molecules/stepper/Stepper.d.ts +4 -0
- package/dist/components/molecules/stepper/Stepper.js +7 -2
- package/dist/components/molecules/stepper/Stepper.stories.d.ts +10 -0
- package/dist/components/molecules/stepper/Stepper.stories.js +90 -24
- package/package.json +1 -1
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
flex-direction: column;
|
|
53
53
|
align-items: flex-start;
|
|
54
54
|
border-radius: 8px;
|
|
55
|
-
border:
|
|
55
|
+
border: 2px solid var(--grey-venom, #e6edf5);
|
|
56
56
|
background: var(--Primary-Blanc, #fff);
|
|
57
57
|
padding: 10px;
|
|
58
58
|
}
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
flex-direction: column;
|
|
97
97
|
align-items: flex-start;
|
|
98
98
|
border-radius: 8px;
|
|
99
|
-
border:
|
|
99
|
+
border: 2px solid var(--grey-venom, #e6edf5);
|
|
100
100
|
background: var(--Primary-Blanc, #fff);
|
|
101
101
|
padding: 10px;
|
|
102
102
|
}
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
justify-content: space-between;
|
|
160
160
|
align-items: center;
|
|
161
161
|
border-radius: 8px;
|
|
162
|
-
border:
|
|
162
|
+
border: 2px solid var(--grey-venom, #e6edf5);
|
|
163
163
|
background: var(--Primary-Blanc, #fff);
|
|
164
164
|
padding: 10px;
|
|
165
165
|
}
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
flex-direction: column;
|
|
59
59
|
align-items: flex-start;
|
|
60
60
|
border-radius: 8px;
|
|
61
|
-
border:
|
|
61
|
+
border: 2px solid var(--grey-venom, #e6edf5);
|
|
62
62
|
background: var(--Primary-Blanc, #fff);
|
|
63
63
|
padding: 10px;
|
|
64
64
|
field-sizing: content;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
max-width: 768px;
|
|
5
5
|
padding: 2.5rem;
|
|
6
6
|
flex-direction: column;
|
|
7
|
-
justify-content:
|
|
7
|
+
justify-content: flex-start;
|
|
8
8
|
align-items: center;
|
|
9
9
|
gap: 16px;
|
|
10
10
|
border-radius: 16px;
|
|
@@ -12,11 +12,42 @@
|
|
|
12
12
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
13
13
|
position: relative;
|
|
14
14
|
z-index: 1001;
|
|
15
|
+
max-height: 90vh;
|
|
16
|
+
overflow: hidden;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
.stepper-content {
|
|
18
|
-
margin: 20px 0;
|
|
19
20
|
width: 100%;
|
|
21
|
+
flex: 1;
|
|
22
|
+
overflow-y: auto;
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
align-items: flex-start;
|
|
26
|
+
font-family: "Open Sans", sans-serif;
|
|
27
|
+
font-size: 16px;
|
|
28
|
+
font-weight: 400;
|
|
29
|
+
line-height: 24px;
|
|
30
|
+
letter-spacing: 0em;
|
|
31
|
+
padding-right: 16px;
|
|
32
|
+
margin: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.stepper-content::-webkit-scrollbar {
|
|
36
|
+
width: 8px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.stepper-content::-webkit-scrollbar-track {
|
|
40
|
+
background: #f1f1f1;
|
|
41
|
+
border-radius: 4px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.stepper-content::-webkit-scrollbar-thumb {
|
|
45
|
+
background: #888;
|
|
46
|
+
border-radius: 4px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.stepper-content::-webkit-scrollbar-thumb:hover {
|
|
50
|
+
background: #555;
|
|
20
51
|
}
|
|
21
52
|
|
|
22
53
|
.stepper-buttons {
|
|
@@ -70,6 +101,7 @@
|
|
|
70
101
|
opacity: 0;
|
|
71
102
|
visibility: hidden;
|
|
72
103
|
transition: opacity 0.3s ease, visibility 0.3s ease;
|
|
104
|
+
box-sizing: border-box;
|
|
73
105
|
}
|
|
74
106
|
|
|
75
107
|
.stepper-overlay.visible {
|
|
@@ -77,30 +109,21 @@
|
|
|
77
109
|
visibility: visible;
|
|
78
110
|
}
|
|
79
111
|
|
|
80
|
-
.stepper-content {
|
|
81
|
-
width: 100%;
|
|
82
|
-
max-height: 100%;
|
|
83
|
-
height: 90%;
|
|
84
|
-
overflow-y: auto;
|
|
85
|
-
display: flex;
|
|
86
|
-
justify-content: center;
|
|
87
|
-
align-items: flex-start;
|
|
88
|
-
font-family: "Open Sans", sans-serif;
|
|
89
|
-
font-size: 16px;
|
|
90
|
-
font-weight: 400;
|
|
91
|
-
line-height: 24px;
|
|
92
|
-
letter-spacing: 0em;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
112
|
@media (max-width: 800px) {
|
|
96
113
|
.stepper-container {
|
|
97
114
|
height: 99dvh;
|
|
98
115
|
position: fixed;
|
|
99
116
|
bottom: 0;
|
|
100
|
-
justify-content: start;
|
|
117
|
+
justify-content: flex-start;
|
|
101
118
|
padding: 2rem;
|
|
102
119
|
border-bottom-left-radius: 0;
|
|
103
120
|
border-bottom-right-radius: 0;
|
|
121
|
+
max-height: none;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.stepper-overlay {
|
|
125
|
+
padding-top: 0 !important;
|
|
126
|
+
padding-bottom: 0 !important;
|
|
104
127
|
}
|
|
105
128
|
}
|
|
106
129
|
|
|
@@ -46,7 +46,7 @@ import SecondaryButton from "../../atoms/buttons/SecondaryButton";
|
|
|
46
46
|
import ConfirmationModal from "./ConfirmationModal";
|
|
47
47
|
var Stepper = function (_a) {
|
|
48
48
|
var _b, _c, _d, _e, _f;
|
|
49
|
-
var steps = _a.steps, currentStep = _a.currentStep, _g = _a.startIcon, startIcon = _g === void 0 ? [] : _g, _h = _a.endIcon, endIcon = _h === void 0 ? true : _h, children = _a.children, _j = _a.secondaryButton, secondaryButton = _j === void 0 ? [] : _j, _k = _a.primaryButton, primaryButton = _k === void 0 ? [] : _k, _l = _a.showProgressBar, showProgressBar = _l === void 0 ? [] : _l, onClose = _a.onClose, validateStep = _a.validateStep, confirmationModal = _a.confirmationModal, onModalCancel = _a.onModalCancel, onModalConfirm = _a.onModalConfirm;
|
|
49
|
+
var steps = _a.steps, currentStep = _a.currentStep, _g = _a.startIcon, startIcon = _g === void 0 ? [] : _g, _h = _a.endIcon, endIcon = _h === void 0 ? true : _h, children = _a.children, _j = _a.secondaryButton, secondaryButton = _j === void 0 ? [] : _j, _k = _a.primaryButton, primaryButton = _k === void 0 ? [] : _k, _l = _a.showProgressBar, showProgressBar = _l === void 0 ? [] : _l, onClose = _a.onClose, validateStep = _a.validateStep, confirmationModal = _a.confirmationModal, onModalCancel = _a.onModalCancel, onModalConfirm = _a.onModalConfirm, verticalOffset = _a.verticalOffset;
|
|
50
50
|
var _m = useState(false), isVisible = _m[0], setIsVisible = _m[1];
|
|
51
51
|
var portalContainerRef = useRef(null);
|
|
52
52
|
var stepperContainerRef = useRef(null);
|
|
@@ -119,7 +119,12 @@ var Stepper = function (_a) {
|
|
|
119
119
|
handleClose();
|
|
120
120
|
}
|
|
121
121
|
}, [handleClose]);
|
|
122
|
-
var stepperContent = (React.createElement("div", { className: "stepper-overlay ".concat(isVisible ? "visible" : ""), onMouseDown: handleMouseDown
|
|
122
|
+
var stepperContent = (React.createElement("div", { className: "stepper-overlay ".concat(isVisible ? "visible" : ""), onMouseDown: handleMouseDown, style: {
|
|
123
|
+
paddingTop: (verticalOffset === null || verticalOffset === void 0 ? void 0 : verticalOffset.top) ? "".concat(verticalOffset.top, "px") : undefined,
|
|
124
|
+
paddingBottom: (verticalOffset === null || verticalOffset === void 0 ? void 0 : verticalOffset.bottom)
|
|
125
|
+
? "".concat(verticalOffset.bottom, "px")
|
|
126
|
+
: undefined,
|
|
127
|
+
} },
|
|
123
128
|
React.createElement("div", { className: "stepper-container ".concat((confirmationModal === null || confirmationModal === void 0 ? void 0 : confirmationModal.show) ? "modal-active" : ""), onClick: function (e) { return e.stopPropagation(); }, ref: stepperContainerRef },
|
|
124
129
|
React.createElement(ProgressBar, { steps: steps, currentStep: currentStep, startIcon: currentShowStartIcon, endIcon: endIcon, onStartIconClick: handlePrevious, onEndIconClick: handleClose, showProgressBar: currentShowProgressBar }),
|
|
125
130
|
React.createElement("div", { className: "stepper-content" }, children[currentStep - 1]),
|
|
@@ -25,6 +25,15 @@ declare namespace _default {
|
|
|
25
25
|
let description_1: string;
|
|
26
26
|
export { description_1 as description };
|
|
27
27
|
}
|
|
28
|
+
namespace verticalOffset {
|
|
29
|
+
export namespace control_3 {
|
|
30
|
+
let type_3: string;
|
|
31
|
+
export { type_3 as type };
|
|
32
|
+
}
|
|
33
|
+
export { control_3 as control };
|
|
34
|
+
let description_2: string;
|
|
35
|
+
export { description_2 as description };
|
|
36
|
+
}
|
|
28
37
|
}
|
|
29
38
|
export namespace parameters {
|
|
30
39
|
namespace backgrounds {
|
|
@@ -39,4 +48,5 @@ declare namespace _default {
|
|
|
39
48
|
}
|
|
40
49
|
export default _default;
|
|
41
50
|
export const Default: any;
|
|
51
|
+
export const WithLargeOffset: any;
|
|
42
52
|
import Stepper from "./Stepper";
|
|
@@ -9,7 +9,43 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
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);
|
|
23
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
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;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import React, { useState, useEffect } from "react";
|
|
13
49
|
import { action } from "@storybook/addon-actions";
|
|
14
50
|
import Stepper from "./Stepper";
|
|
15
51
|
import "../../../styles/global.css";
|
|
@@ -35,6 +71,12 @@ export default {
|
|
|
35
71
|
},
|
|
36
72
|
description: "Contrôle l'affichage de la barre de progression pour chaque étape",
|
|
37
73
|
},
|
|
74
|
+
verticalOffset: {
|
|
75
|
+
control: {
|
|
76
|
+
type: "object",
|
|
77
|
+
},
|
|
78
|
+
description: "Décalage vertical du stepper (en px) pour éviter les barres de navigation",
|
|
79
|
+
},
|
|
38
80
|
},
|
|
39
81
|
parameters: {
|
|
40
82
|
backgrounds: {
|
|
@@ -48,11 +90,36 @@ export default {
|
|
|
48
90
|
},
|
|
49
91
|
},
|
|
50
92
|
};
|
|
51
|
-
var Template = function (args) {
|
|
93
|
+
var Template = function (args) {
|
|
94
|
+
var _a = useState(args.currentStep), step = _a[0], setStep = _a[1];
|
|
95
|
+
useEffect(function () {
|
|
96
|
+
setStep(args.currentStep);
|
|
97
|
+
}, [args.currentStep]);
|
|
98
|
+
var updatedArgs = __assign(__assign({}, args), { currentStep: step, onClose: function () {
|
|
99
|
+
action("Stepper closed")();
|
|
100
|
+
if (args.onClose)
|
|
101
|
+
args.onClose();
|
|
102
|
+
}, primaryButton: args.primaryButton.map(function (button) { return (__assign(__assign({}, button), { onPrimaryButtonClick: function (currentStep) {
|
|
103
|
+
action("Primary button clicked on step ".concat(currentStep))();
|
|
104
|
+
if (currentStep < args.steps) {
|
|
105
|
+
setStep(currentStep + 1);
|
|
106
|
+
}
|
|
107
|
+
} })); }), secondaryButton: args.secondaryButton.map(function (button) { return (__assign(__assign({}, button), { onSecondaryButtonClick: function (currentStep) {
|
|
108
|
+
action("Secondary button clicked on step ".concat(currentStep))();
|
|
109
|
+
if (currentStep > 1) {
|
|
110
|
+
setStep(currentStep - 1);
|
|
111
|
+
}
|
|
112
|
+
} })); }) });
|
|
113
|
+
return React.createElement(Stepper, __assign({}, updatedArgs));
|
|
114
|
+
};
|
|
52
115
|
export var Default = Template.bind({});
|
|
53
116
|
Default.args = {
|
|
54
117
|
steps: 5,
|
|
55
118
|
currentStep: 1,
|
|
119
|
+
verticalOffset: {
|
|
120
|
+
top: 64,
|
|
121
|
+
bottom: 0,
|
|
122
|
+
},
|
|
56
123
|
startIcon: [true, true, true, true, true],
|
|
57
124
|
endIcon: true,
|
|
58
125
|
onClose: function () {
|
|
@@ -64,69 +131,68 @@ Default.args = {
|
|
|
64
131
|
show: true,
|
|
65
132
|
label: "Autre",
|
|
66
133
|
startIconName: "allaw-icon-add",
|
|
67
|
-
onSecondaryButtonClick: function (step) {
|
|
68
|
-
return action("Secondary button clicked on step ".concat(step))();
|
|
69
|
-
},
|
|
70
134
|
},
|
|
71
135
|
{ show: false },
|
|
72
136
|
{
|
|
73
137
|
show: true,
|
|
74
138
|
label: "Option",
|
|
75
139
|
startIconName: "allaw-icon-settings",
|
|
76
|
-
onSecondaryButtonClick: function (step) {
|
|
77
|
-
return action("Secondary button clicked on step ".concat(step))();
|
|
78
|
-
},
|
|
79
140
|
},
|
|
80
141
|
{ show: false },
|
|
81
142
|
],
|
|
143
|
+
validateStep: function (step) { return __awaiter(void 0, void 0, void 0, function () {
|
|
144
|
+
return __generator(this, function (_a) {
|
|
145
|
+
// Simuler une validation réussie
|
|
146
|
+
return [2 /*return*/, true];
|
|
147
|
+
});
|
|
148
|
+
}); },
|
|
82
149
|
primaryButton: [
|
|
83
150
|
{
|
|
84
151
|
show: true,
|
|
85
152
|
label: "Commencer",
|
|
86
153
|
startIconName: "allaw-icon-arrow-right",
|
|
87
|
-
onPrimaryButtonClick: function (step) {
|
|
88
|
-
return action("Primary button clicked on step ".concat(step))();
|
|
89
|
-
},
|
|
90
154
|
},
|
|
91
155
|
{
|
|
92
156
|
show: true,
|
|
93
157
|
label: "Continuer",
|
|
94
158
|
endIconName: "allaw-icon-arrow-right",
|
|
95
|
-
onPrimaryButtonClick: function (step) {
|
|
96
|
-
return action("Primary button clicked on step ".concat(step))();
|
|
97
|
-
},
|
|
98
159
|
},
|
|
99
160
|
{
|
|
100
161
|
show: true,
|
|
101
162
|
label: "Suivant",
|
|
102
163
|
endIconName: "allaw-icon-arrow-right",
|
|
103
|
-
onPrimaryButtonClick: function (step) {
|
|
104
|
-
return action("Primary button clicked on step ".concat(step))();
|
|
105
|
-
},
|
|
106
164
|
},
|
|
107
165
|
{
|
|
108
166
|
show: true,
|
|
109
167
|
label: "Presque fini",
|
|
110
168
|
endIconName: "allaw-icon-arrow-right",
|
|
111
|
-
onPrimaryButtonClick: function (step) {
|
|
112
|
-
return action("Primary button clicked on step ".concat(step))();
|
|
113
|
-
},
|
|
114
169
|
},
|
|
115
170
|
{
|
|
116
171
|
show: true,
|
|
117
172
|
label: "Terminer",
|
|
118
173
|
endIconName: "allaw-icon-check",
|
|
119
|
-
onPrimaryButtonClick: function (step) {
|
|
120
|
-
return action("Stepper completed on step ".concat(step))();
|
|
121
|
-
},
|
|
122
174
|
},
|
|
123
175
|
],
|
|
124
176
|
showProgressBar: [true, true, true, true, true],
|
|
125
177
|
children: [
|
|
126
|
-
React.createElement("div", { className: "stepper-content", key: "step1"
|
|
178
|
+
React.createElement("div", { className: "stepper-content", key: "step1", style: { display: "flex", flexDirection: "column", gap: "10px" } },
|
|
179
|
+
"Contenu de l'\u00E9tape 1",
|
|
180
|
+
Array(10)
|
|
181
|
+
.fill(null)
|
|
182
|
+
.map(function (_, index) { return (React.createElement("div", { key: index },
|
|
183
|
+
React.createElement("br", null),
|
|
184
|
+
"Ligne ",
|
|
185
|
+
index + 1)); }),
|
|
186
|
+
React.createElement("div", null, "Fin du composant")),
|
|
127
187
|
React.createElement("div", { className: "stepper-content", key: "step2" }, "Contenu de l'\u00E9tape 2"),
|
|
128
188
|
React.createElement("div", { className: "stepper-content", key: "step3" }, "Contenu de l'\u00E9tape 3"),
|
|
129
189
|
React.createElement("div", { className: "stepper-content", key: "step4" }, "Contenu de l'\u00E9tape 4"),
|
|
130
190
|
React.createElement("div", { className: "stepper-content", key: "step5" }, "Contenu de l'\u00E9tape 5"),
|
|
131
191
|
],
|
|
132
192
|
};
|
|
193
|
+
// Ajouter une story avec un offset différent
|
|
194
|
+
export var WithLargeOffset = Template.bind({});
|
|
195
|
+
WithLargeOffset.args = __assign(__assign({}, Default.args), { verticalOffset: {
|
|
196
|
+
top: 120,
|
|
197
|
+
bottom: 80,
|
|
198
|
+
} });
|