@agregio-solutions/design-system 1.90.1 → 1.92.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.
- package/dist/design-system.cjs +9 -5
- package/dist/design-system.js +14 -6
- package/dist/packages/components/Accordion/doc.md +342 -0
- package/dist/packages/components/Badge/doc.md +192 -0
- package/dist/packages/components/Breadcrumbs/doc.md +332 -0
- package/dist/packages/components/Button/doc.md +425 -0
- package/dist/packages/components/Calendar/doc.md +465 -0
- package/dist/packages/components/ChartLegend/doc.md +151 -0
- package/dist/packages/components/ChartTooltip/doc.md +124 -0
- package/dist/packages/components/Checkbox/doc.md +329 -0
- package/dist/packages/components/CheckboxGroup/doc.md +242 -0
- package/dist/packages/components/Chip/doc.md +99 -0
- package/dist/packages/components/Combobox/Combobox.d.ts +8 -0
- package/dist/packages/components/Combobox/doc.md +680 -0
- package/dist/packages/components/DataTable/doc.md +1124 -0
- package/dist/packages/components/DatePicker/doc.md +579 -0
- package/dist/packages/components/DateRangePicker/doc.md +638 -0
- package/dist/packages/components/Drawer/doc.md +338 -0
- package/dist/packages/components/Dropdown/Dropdown.d.ts +4 -0
- package/dist/packages/components/Dropdown/doc.md +205 -0
- package/dist/packages/components/EmptyState/doc.md +101 -0
- package/dist/packages/components/FileUpload/doc.md +449 -0
- package/dist/packages/components/Filter/doc.md +196 -0
- package/dist/packages/components/Header/doc.md +373 -0
- package/dist/packages/components/I18nProvider/doc.md +187 -0
- package/dist/packages/components/Icon/doc.md +63 -0
- package/dist/packages/components/Label/doc.md +60 -0
- package/dist/packages/components/LinearProgressBar/doc.md +148 -0
- package/dist/packages/components/Link/doc.md +206 -0
- package/dist/packages/components/List/doc.md +481 -0
- package/dist/packages/components/Loader/doc.md +53 -0
- package/dist/packages/components/Menu/Menu.d.ts +5 -1
- package/dist/packages/components/Menu/doc.md +231 -0
- package/dist/packages/components/Message/doc.md +166 -0
- package/dist/packages/components/Modal/doc.md +289 -0
- package/dist/packages/components/Navigation/doc.md +992 -0
- package/dist/packages/components/NavigationItem/doc.md +167 -0
- package/dist/packages/components/NotificationCard/doc.md +206 -0
- package/dist/packages/components/Notifications/doc.md +240 -0
- package/dist/packages/components/NumberField/doc.md +582 -0
- package/dist/packages/components/PageLayout/doc.md +651 -0
- package/dist/packages/components/Pagination/doc.md +227 -0
- package/dist/packages/components/Popover/doc.md +245 -0
- package/dist/packages/components/Radio/doc.md +370 -0
- package/dist/packages/components/RouterProvider/doc.md +64 -0
- package/dist/packages/components/SearchBar/doc.md +504 -0
- package/dist/packages/components/SegmentedControl/doc.md +398 -0
- package/dist/packages/components/Select/Select.d.ts +4 -0
- package/dist/packages/components/Select/doc.md +1133 -0
- package/dist/packages/components/Skeleton/doc.md +129 -0
- package/dist/packages/components/Slider/doc.md +362 -0
- package/dist/packages/components/Stepper/doc.md +104 -0
- package/dist/packages/components/Switch/doc.md +296 -0
- package/dist/packages/components/Tabs/doc.md +295 -0
- package/dist/packages/components/Tag/doc.md +81 -0
- package/dist/packages/components/TextInput/doc.md +490 -0
- package/dist/packages/components/TimeField/doc.md +353 -0
- package/dist/packages/components/Timeline/doc.md +1046 -0
- package/dist/packages/components/Toaster/doc.md +263 -0
- package/dist/packages/components/ToggleButton/doc.md +108 -0
- package/dist/packages/components/ToggleButtonGroup/doc.md +307 -0
- package/dist/packages/components/Tooltip/doc.md +206 -0
- package/dist/packages/components/YearMonthPicker/YearMonthPicker.d.ts +8 -0
- package/dist/packages/components/YearMonthPicker/doc.md +638 -0
- package/dist/public_docs/components.md +68 -0
- package/dist/public_docs/index.md +30 -0
- package/dist/public_docs/tokens.md +121 -0
- package/package.json +3 -2
|
@@ -0,0 +1,1046 @@
|
|
|
1
|
+
# Timeline
|
|
2
|
+
|
|
3
|
+
## Props
|
|
4
|
+
|
|
5
|
+
The complete Props documentation with JS doc for this component is available at this path:
|
|
6
|
+
|
|
7
|
+
node_modules/@agregio-solutions/design-system/dist/packages/components/Timeline/Timeline.d.ts
|
|
8
|
+
|
|
9
|
+
## Example usage
|
|
10
|
+
|
|
11
|
+
Here are the Storybook Stories.
|
|
12
|
+
|
|
13
|
+
Base stories:
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Meta, StoryObj } from "@storybook/react-vite";
|
|
17
|
+
import Timeline from "./Timeline";
|
|
18
|
+
import { within, userEvent, fn } from "storybook/test";
|
|
19
|
+
import MockDate from "mockdate";
|
|
20
|
+
import {
|
|
21
|
+
expectNotPresent,
|
|
22
|
+
STORYBOOK_VIEWPORTS,
|
|
23
|
+
} from "@internal/test-utils-storybook/test-utils-storybook";
|
|
24
|
+
import { I18nProvider } from "react-aria-components";
|
|
25
|
+
import ChartTooltip from "@components/ChartTooltip/ChartTooltip";
|
|
26
|
+
|
|
27
|
+
const meta: Meta<typeof Timeline> = {
|
|
28
|
+
parameters: {
|
|
29
|
+
docs: {
|
|
30
|
+
story: {
|
|
31
|
+
autoplay: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
component: Timeline,
|
|
36
|
+
decorators: [
|
|
37
|
+
(Story) => (
|
|
38
|
+
<I18nProvider locale="fr">
|
|
39
|
+
<Story />
|
|
40
|
+
</I18nProvider>
|
|
41
|
+
),
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
export default meta;
|
|
45
|
+
|
|
46
|
+
type Story = StoryObj<typeof Timeline>;
|
|
47
|
+
|
|
48
|
+
export const Playground: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
51
|
+
endDate: new Date("2024-01-15T00:00:00.000Z"),
|
|
52
|
+
emptyPlaceholder: "No data",
|
|
53
|
+
lines: [
|
|
54
|
+
{
|
|
55
|
+
name: "Installation 1",
|
|
56
|
+
blocks: [
|
|
57
|
+
{
|
|
58
|
+
id: "block-1",
|
|
59
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
60
|
+
endDate: new Date("2024-01-02T00:00:00.000Z"),
|
|
61
|
+
color: "var(--color-content-dataviz-positive-3)",
|
|
62
|
+
hoverText: "One day",
|
|
63
|
+
onClick: fn(),
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "block-2",
|
|
67
|
+
startDate: new Date("2024-01-03T00:00:00.000Z"),
|
|
68
|
+
endDate: new Date("2024-01-05T00:00:00.000Z"),
|
|
69
|
+
color: "var(--color-content-dataviz-purple-3)",
|
|
70
|
+
hoverText: "Two days",
|
|
71
|
+
onClick: fn(),
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: "block-3",
|
|
75
|
+
startDate: new Date("2024-01-06T00:00:00.000Z"),
|
|
76
|
+
endDate: new Date("2024-01-09T00:00:00.000Z"),
|
|
77
|
+
color: "var(--color-content-dataviz-orange-3)",
|
|
78
|
+
hoverText: "Three days",
|
|
79
|
+
onClick: fn(),
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: "block-3",
|
|
83
|
+
startDate: new Date("2024-01-13T00:00:00.000Z"),
|
|
84
|
+
endDate: new Date("2024-01-20T00:00:00.000Z"),
|
|
85
|
+
color: "var(--color-content-dataviz-orange-3)",
|
|
86
|
+
hoverText: "Overflow after",
|
|
87
|
+
onClick: fn(),
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: "Installation avec un nom long",
|
|
93
|
+
blocks: [
|
|
94
|
+
{
|
|
95
|
+
id: "block-1",
|
|
96
|
+
startDate: new Date("2024-01-02T00:00:00.000Z"),
|
|
97
|
+
endDate: new Date("2024-01-03T00:00:00.000Z"),
|
|
98
|
+
color: "var(--color-content-dataviz-neutral-3)",
|
|
99
|
+
hoverText: "1 day",
|
|
100
|
+
onClick: fn(),
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: "block-2",
|
|
104
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
105
|
+
endDate: new Date("2024-01-05T00:00:00.000Z"),
|
|
106
|
+
color: "var(--color-content-dataviz-pink-3)",
|
|
107
|
+
hoverText: "4 days",
|
|
108
|
+
onClick: fn(),
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: "block-3",
|
|
112
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
113
|
+
endDate: new Date("2024-01-03T00:00:00.000Z"),
|
|
114
|
+
color: "var(--color-content-dataviz-azure-3)",
|
|
115
|
+
hoverText: "2 days",
|
|
116
|
+
onClick: fn(),
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: "block-4",
|
|
120
|
+
startDate: new Date("2024-01-04T00:00:00.000Z"),
|
|
121
|
+
endDate: new Date("2024-01-06T00:00:00.000Z"),
|
|
122
|
+
color: "var(--color-content-dataviz-azure-3)",
|
|
123
|
+
hoverText: "2 days again",
|
|
124
|
+
onClick: fn(),
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: "block-5",
|
|
128
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
129
|
+
endDate: new Date("2024-01-11T00:00:00.000Z"),
|
|
130
|
+
color: "var(--color-content-dataviz-orange-3)",
|
|
131
|
+
hoverText: "full line block",
|
|
132
|
+
onClick: fn(),
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "Installation avec un nom super super super long",
|
|
138
|
+
blocks: [
|
|
139
|
+
{
|
|
140
|
+
id: "block-1",
|
|
141
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
142
|
+
endDate: new Date("2024-01-02T00:00:00.000Z"),
|
|
143
|
+
color: "var(--color-content-dataviz-neutral-3)",
|
|
144
|
+
hoverText: "Group 1 - 1 day",
|
|
145
|
+
onClick: fn(),
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: "block-2",
|
|
149
|
+
startDate: new Date("2024-01-02T06:00:00.000Z"),
|
|
150
|
+
endDate: new Date("2024-01-03T00:00:00.000Z"),
|
|
151
|
+
color: "var(--color-content-dataviz-pink-3)",
|
|
152
|
+
hoverText: "Group 2 - 1 day",
|
|
153
|
+
onClick: fn(),
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
id: "block-3",
|
|
157
|
+
startDate: new Date("2024-01-02T06:00:00.000Z"),
|
|
158
|
+
endDate: new Date("2024-01-04T00:00:00.000Z"),
|
|
159
|
+
color: "var(--color-content-dataviz-azure-3)",
|
|
160
|
+
hoverText: "Group 2 - 2 days",
|
|
161
|
+
onClick: fn(),
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
id: "block-4",
|
|
165
|
+
startDate: new Date("2024-01-05T00:00:00.000Z"),
|
|
166
|
+
endDate: new Date("2024-01-08T00:00:00.000Z"),
|
|
167
|
+
color: "var(--color-content-dataviz-azure-3)",
|
|
168
|
+
hoverText: "Group 3 - 3 days",
|
|
169
|
+
onClick: fn(),
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
id: "block-5",
|
|
173
|
+
startDate: new Date("2024-01-06T00:00:00.000Z"),
|
|
174
|
+
endDate: new Date("2024-01-08T00:00:00.000Z"),
|
|
175
|
+
color: "var(--color-content-dataviz-orange-3)",
|
|
176
|
+
hoverText: "Group 3 - 2 days",
|
|
177
|
+
onClick: fn(),
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
id: "block-6",
|
|
181
|
+
startDate: new Date("2024-01-07T00:00:00.000Z"),
|
|
182
|
+
endDate: new Date("2024-01-08T00:00:00.000Z"),
|
|
183
|
+
color: "var(--color-content-dataviz-orange-3)",
|
|
184
|
+
hoverText: "Group 3 - 1 day",
|
|
185
|
+
onClick: fn(),
|
|
186
|
+
},
|
|
187
|
+
...new Array(8).fill(null).map((_, index) => ({
|
|
188
|
+
id: `block-${index + 7}`,
|
|
189
|
+
startDate: new Date("2024-01-09T00:00:00.000Z"),
|
|
190
|
+
endDate: new Date("2024-01-10T00:00:00.000Z"),
|
|
191
|
+
color: "var(--color-content-dataviz-ocean-3)",
|
|
192
|
+
hoverText: `Group 4 - block ${index}`,
|
|
193
|
+
onClick: fn(),
|
|
194
|
+
})),
|
|
195
|
+
],
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
},
|
|
199
|
+
play: async ({ canvasElement, mount }) => {
|
|
200
|
+
MockDate.set("2024-01-05T12:00:00.000Z");
|
|
201
|
+
await mount();
|
|
202
|
+
const canvas = within(canvasElement);
|
|
203
|
+
await canvas.findByText("Installation 1");
|
|
204
|
+
await canvas.findByText("Installation avec un nom long");
|
|
205
|
+
await canvas.findByText("Installation avec un nom super super super long");
|
|
206
|
+
|
|
207
|
+
// Check first line
|
|
208
|
+
const firstLine = within(
|
|
209
|
+
canvas.getByTestId("block-chart-line-Installation 1-0"),
|
|
210
|
+
);
|
|
211
|
+
await firstLine.findByTestId("One day");
|
|
212
|
+
await firstLine.findByTestId("Two days");
|
|
213
|
+
await firstLine.findByTestId("Three days");
|
|
214
|
+
|
|
215
|
+
// Check second line
|
|
216
|
+
const secondLine = within(
|
|
217
|
+
canvas.getByTestId("block-chart-line-Installation avec un nom long-1"),
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
await secondLine.findByTestId("1 day");
|
|
221
|
+
await secondLine.findByTestId("4 days");
|
|
222
|
+
await secondLine.findByTestId("2 days");
|
|
223
|
+
await secondLine.findByTestId("2 days again");
|
|
224
|
+
await secondLine.findByTestId("full line block");
|
|
225
|
+
|
|
226
|
+
// Check third line
|
|
227
|
+
const thirdLine = within(
|
|
228
|
+
canvas.getByTestId(
|
|
229
|
+
"block-chart-line-Installation avec un nom super super super long-2",
|
|
230
|
+
),
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
await thirdLine.findByTestId("Group 1 - 1 day");
|
|
234
|
+
await thirdLine.findByTestId("Group 2 - 1 day");
|
|
235
|
+
await thirdLine.findByTestId("Group 2 - 2 days");
|
|
236
|
+
await thirdLine.findByTestId("Group 3 - 3 days");
|
|
237
|
+
await thirdLine.findByTestId("Group 3 - 2 days");
|
|
238
|
+
await thirdLine.findByTestId("Group 3 - 1 day");
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
export const NoData: Story = {
|
|
243
|
+
args: {
|
|
244
|
+
...Playground.args,
|
|
245
|
+
lines: [],
|
|
246
|
+
},
|
|
247
|
+
play: async ({ canvasElement }) => {
|
|
248
|
+
const canvas = within(canvasElement);
|
|
249
|
+
await canvas.findByText("No data");
|
|
250
|
+
await expectNotPresent(() => canvas.queryByTestId("timeline"));
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
export const HoursUnit: Story = {
|
|
255
|
+
args: {
|
|
256
|
+
...Playground.args,
|
|
257
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
258
|
+
endDate: new Date("2024-01-02T00:00:00.000Z"),
|
|
259
|
+
lines: [
|
|
260
|
+
{
|
|
261
|
+
name: "Installation 1",
|
|
262
|
+
blocks: [
|
|
263
|
+
{
|
|
264
|
+
id: "block-1",
|
|
265
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
266
|
+
endDate: new Date("2024-01-01T10:00:00.000Z"),
|
|
267
|
+
color: "var(--color-content-dataviz-positive-3)",
|
|
268
|
+
hoverText: "block-1",
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
id: "block-2",
|
|
272
|
+
startDate: new Date("2024-01-01T11:00:00.000Z"),
|
|
273
|
+
endDate: new Date("2024-01-01T13:00:00.000Z"),
|
|
274
|
+
color: "var(--color-content-dataviz-orange-2)",
|
|
275
|
+
hoverText: "block-2",
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
id: "block-3",
|
|
279
|
+
startDate: new Date("2024-01-01T02:00:00.000Z"),
|
|
280
|
+
endDate: new Date("2024-01-01T03:00:00.000Z"),
|
|
281
|
+
color: "var(--color-content-dataviz-ocean-3)",
|
|
282
|
+
hoverText: "block-3",
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
id: "block-4",
|
|
286
|
+
startDate: new Date("2024-01-01T03:00:00.000Z"),
|
|
287
|
+
endDate: new Date("2024-01-01T04:00:00.000Z"),
|
|
288
|
+
color: "var(--color-content-dataviz-positive-3)",
|
|
289
|
+
hoverText: "block-4",
|
|
290
|
+
},
|
|
291
|
+
],
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: "Installation 2",
|
|
295
|
+
blocks: [
|
|
296
|
+
{
|
|
297
|
+
id: "block-1",
|
|
298
|
+
startDate: new Date("2024-01-01T01:00:00.000Z"),
|
|
299
|
+
endDate: new Date("2024-01-01T10:00:00.000Z"),
|
|
300
|
+
color: "var(--color-content-dataviz-pink-2)",
|
|
301
|
+
hoverText: "block-1",
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
id: "block-2",
|
|
305
|
+
startDate: new Date("2024-01-01T11:00:00.000Z"),
|
|
306
|
+
endDate: new Date("2024-01-01T13:00:00.000Z"),
|
|
307
|
+
color: "var(--color-content-dataviz-orange-2)",
|
|
308
|
+
hoverText: "block-2",
|
|
309
|
+
},
|
|
310
|
+
],
|
|
311
|
+
},
|
|
312
|
+
],
|
|
313
|
+
},
|
|
314
|
+
play: async ({ mount }) => {
|
|
315
|
+
MockDate.set("2024-01-01T08:00:00.000Z");
|
|
316
|
+
await mount();
|
|
317
|
+
},
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
export const Week: Story = {
|
|
321
|
+
args: {
|
|
322
|
+
...Playground.args,
|
|
323
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
324
|
+
endDate: new Date("2024-01-08T00:00:00.000Z"),
|
|
325
|
+
lines: [
|
|
326
|
+
{
|
|
327
|
+
name: "Installation 1",
|
|
328
|
+
blocks: [
|
|
329
|
+
{
|
|
330
|
+
id: "block-1",
|
|
331
|
+
startDate: new Date("2024-01-01T12:00:00.000Z"),
|
|
332
|
+
endDate: new Date("2024-01-08T00:00:00.000Z"),
|
|
333
|
+
color: "var(--color-content-dataviz-positive-3)",
|
|
334
|
+
hoverText: "block-1",
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
id: "block-2",
|
|
338
|
+
startDate: new Date("2024-01-02T00:00:00.000Z"),
|
|
339
|
+
endDate: new Date("2024-01-04T00:00:00.000Z"),
|
|
340
|
+
color: "var(--color-content-dataviz-orange-2)",
|
|
341
|
+
hoverText: "block-2",
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
id: "block-3",
|
|
345
|
+
startDate: new Date("2024-01-06T00:00:00.000Z"),
|
|
346
|
+
endDate: new Date("2024-01-08T00:00:00.000Z"),
|
|
347
|
+
color: "var(--color-content-dataviz-ocean-3)",
|
|
348
|
+
hoverText: "block-3",
|
|
349
|
+
},
|
|
350
|
+
],
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
name: "Installation 2",
|
|
354
|
+
blocks: [
|
|
355
|
+
{
|
|
356
|
+
id: "block-1",
|
|
357
|
+
startDate: new Date("2024-01-01T01:00:00.000Z"),
|
|
358
|
+
endDate: new Date("2024-01-01T10:00:00.000Z"),
|
|
359
|
+
color: "var(--color-content-dataviz-pink-2)",
|
|
360
|
+
hoverText: "block-1",
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
id: "block-2",
|
|
364
|
+
startDate: new Date("2024-01-01T11:00:00.000Z"),
|
|
365
|
+
endDate: new Date("2024-01-01T13:00:00.000Z"),
|
|
366
|
+
color: "var(--color-content-dataviz-orange-2)",
|
|
367
|
+
hoverText: "block-2",
|
|
368
|
+
},
|
|
369
|
+
],
|
|
370
|
+
},
|
|
371
|
+
],
|
|
372
|
+
},
|
|
373
|
+
play: async ({ mount }) => {
|
|
374
|
+
MockDate.set("2024-01-01T12:00:00.000Z");
|
|
375
|
+
await mount();
|
|
376
|
+
},
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
export const Month: Story = {
|
|
380
|
+
args: {
|
|
381
|
+
...Playground.args,
|
|
382
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
383
|
+
endDate: new Date("2024-02-01T00:00:00.000Z"),
|
|
384
|
+
lines: [
|
|
385
|
+
{
|
|
386
|
+
name: "Installation 1",
|
|
387
|
+
blocks: [
|
|
388
|
+
{
|
|
389
|
+
id: "block-1",
|
|
390
|
+
startDate: new Date("2024-01-01T12:00:00.000Z"),
|
|
391
|
+
endDate: new Date("2024-01-31T00:00:00.000Z"),
|
|
392
|
+
color: "var(--color-content-dataviz-positive-3)",
|
|
393
|
+
hoverText: "block-1",
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
id: "block-2",
|
|
397
|
+
startDate: new Date("2024-01-10T00:00:00.000Z"),
|
|
398
|
+
endDate: new Date("2024-01-12T00:00:00.000Z"),
|
|
399
|
+
color: "var(--color-content-dataviz-orange-2)",
|
|
400
|
+
hoverText: "block-2",
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
id: "block-3",
|
|
404
|
+
startDate: new Date("2024-01-13T00:00:00.000Z"),
|
|
405
|
+
endDate: new Date("2024-01-15T00:00:00.000Z"),
|
|
406
|
+
color: "var(--color-content-dataviz-ocean-3)",
|
|
407
|
+
hoverText: "block-3",
|
|
408
|
+
},
|
|
409
|
+
],
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
name: "Installation 2",
|
|
413
|
+
blocks: [
|
|
414
|
+
{
|
|
415
|
+
id: "block-1",
|
|
416
|
+
startDate: new Date("2024-01-10T01:00:00.000Z"),
|
|
417
|
+
endDate: new Date("2024-01-20T10:00:00.000Z"),
|
|
418
|
+
color: "var(--color-content-dataviz-pink-2)",
|
|
419
|
+
hoverText: "block-1",
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
id: "block-2",
|
|
423
|
+
startDate: new Date("2024-01-01T11:00:00.000Z"),
|
|
424
|
+
endDate: new Date("2024-01-01T13:00:00.000Z"),
|
|
425
|
+
color: "var(--color-content-dataviz-orange-2)",
|
|
426
|
+
hoverText: "block-2",
|
|
427
|
+
},
|
|
428
|
+
],
|
|
429
|
+
},
|
|
430
|
+
],
|
|
431
|
+
},
|
|
432
|
+
play: async ({ mount }) => {
|
|
433
|
+
MockDate.set("2024-01-11T12:00:00.000Z");
|
|
434
|
+
await mount();
|
|
435
|
+
},
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
export const Mobile: Story = {
|
|
439
|
+
parameters: {
|
|
440
|
+
...STORYBOOK_VIEWPORTS,
|
|
441
|
+
},
|
|
442
|
+
globals: {
|
|
443
|
+
viewport: { value: "iphone6", isRotated: false },
|
|
444
|
+
},
|
|
445
|
+
args: {
|
|
446
|
+
...Playground.args,
|
|
447
|
+
},
|
|
448
|
+
decorators: [
|
|
449
|
+
(Story) => (
|
|
450
|
+
<div>
|
|
451
|
+
<div style={{ paddingBlock: "var(--spacing-lg)" }}>
|
|
452
|
+
Content that should not scroll-x
|
|
453
|
+
</div>
|
|
454
|
+
<Story />
|
|
455
|
+
<div style={{ paddingBlock: "var(--spacing-lg)" }}>
|
|
456
|
+
Content that should not scroll-x
|
|
457
|
+
</div>
|
|
458
|
+
</div>
|
|
459
|
+
),
|
|
460
|
+
],
|
|
461
|
+
play: async ({ mount }) => {
|
|
462
|
+
MockDate.set("2024-01-01T12:00:00.000Z");
|
|
463
|
+
await mount();
|
|
464
|
+
},
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
export const GroupSimple: Story = {
|
|
468
|
+
args: {
|
|
469
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
470
|
+
endDate: new Date("2024-01-08T00:00:00.000Z"),
|
|
471
|
+
lines: [
|
|
472
|
+
{
|
|
473
|
+
type: "group",
|
|
474
|
+
name: "Installation 1",
|
|
475
|
+
subLines: [
|
|
476
|
+
{
|
|
477
|
+
name: "Installation 1 PRM_1",
|
|
478
|
+
blocks: [
|
|
479
|
+
{
|
|
480
|
+
id: "unavailability-1",
|
|
481
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
482
|
+
endDate: new Date("2024-01-02T00:00:00.000Z"),
|
|
483
|
+
color: "var(--color-content-dataviz-pink-3)",
|
|
484
|
+
hoverText: "Installation 1 PRM_1 - Indisponibilité 1",
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
id: "activation-1",
|
|
488
|
+
startDate: new Date("2024-01-07T00:00:00.000Z"),
|
|
489
|
+
endDate: new Date("2024-01-10T00:00:00.000Z"),
|
|
490
|
+
color: "var(--color-content-dataviz-azure-3)",
|
|
491
|
+
hoverText: "Installation 1 PRM_1 - Activation 1",
|
|
492
|
+
},
|
|
493
|
+
],
|
|
494
|
+
},
|
|
495
|
+
],
|
|
496
|
+
},
|
|
497
|
+
],
|
|
498
|
+
},
|
|
499
|
+
play: async ({ canvasElement, mount }) => {
|
|
500
|
+
MockDate.set("2024-01-05T12:00:00.000Z");
|
|
501
|
+
await mount();
|
|
502
|
+
const canvas = within(canvasElement);
|
|
503
|
+
const user = userEvent.setup();
|
|
504
|
+
await user.click(canvas.getByText("Installation 1"));
|
|
505
|
+
await canvas.findByText("Installation 1 PRM_1");
|
|
506
|
+
await canvas.findByTestId("Installation 1 PRM_1 - Indisponibilité 1");
|
|
507
|
+
await canvas.findByTestId("Installation 1 PRM_1 - Activation 1");
|
|
508
|
+
},
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
export const GroupMultiple: Story = {
|
|
512
|
+
args: {
|
|
513
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
514
|
+
endDate: new Date("2024-01-08T00:00:00.000Z"),
|
|
515
|
+
lines: [
|
|
516
|
+
{
|
|
517
|
+
type: "group",
|
|
518
|
+
name: "Installation 3",
|
|
519
|
+
subLines: [
|
|
520
|
+
{
|
|
521
|
+
name: "Installation 3 PRM_1",
|
|
522
|
+
blocks: [
|
|
523
|
+
{
|
|
524
|
+
id: "unavailability-1",
|
|
525
|
+
startDate: new Date("2024-01-03T00:00:00.000Z"),
|
|
526
|
+
endDate: new Date("2024-01-04T00:00:00.000Z"),
|
|
527
|
+
color: "var(--color-content-dataviz-pink-3)",
|
|
528
|
+
hoverText: "Installation 3 PRM_1 - Indisponibilité 1",
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
id: "activation-1",
|
|
532
|
+
startDate: new Date("2024-01-06T00:00:00.000Z"),
|
|
533
|
+
endDate: new Date("2024-01-07T12:00:00.000Z"),
|
|
534
|
+
color: "var(--color-content-dataviz-azure-3)",
|
|
535
|
+
hoverText: "Installation 3 PRM_1 - Activation 1",
|
|
536
|
+
},
|
|
537
|
+
],
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
name: "Installation 3 PRM_2",
|
|
541
|
+
blocks: [
|
|
542
|
+
{
|
|
543
|
+
id: "unavailability-1",
|
|
544
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
545
|
+
endDate: new Date("2024-01-02T00:00:00.000Z"),
|
|
546
|
+
color: "var(--color-content-dataviz-pink-3)",
|
|
547
|
+
hoverText: "Installation 3 PRM_2 - Indisponibilité 1",
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
id: "unavailability-2",
|
|
551
|
+
startDate: new Date("2024-01-02T00:00:00.000Z"),
|
|
552
|
+
endDate: new Date("2024-01-03T12:00:00.000Z"),
|
|
553
|
+
color: "var(--color-content-dataviz-pink-3)",
|
|
554
|
+
hoverText: "Installation 3 PRM_2 - Indisponibilité 2",
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
id: "unavailability-3",
|
|
558
|
+
startDate: new Date("2024-01-05T00:00:00.000Z"),
|
|
559
|
+
endDate: new Date("2024-01-07T00:00:00.000Z"),
|
|
560
|
+
color: "var(--color-content-dataviz-pink-3)",
|
|
561
|
+
hoverText: "Installation 3 PRM_2 - Indisponibilité 3",
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
id: "activation-1",
|
|
565
|
+
startDate: new Date("2024-01-05T00:00:00.000Z"),
|
|
566
|
+
endDate: new Date("2024-01-07T00:00:00.000Z"),
|
|
567
|
+
color: "var(--color-content-dataviz-azure-3)",
|
|
568
|
+
hoverText: "Installation 3 PRM_2 - Activation 1",
|
|
569
|
+
},
|
|
570
|
+
],
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
name: "Installation 3 PRM_3",
|
|
574
|
+
blocks: [
|
|
575
|
+
{
|
|
576
|
+
id: "unavailability-1",
|
|
577
|
+
startDate: new Date("2024-01-03T14:00:00.000Z"),
|
|
578
|
+
endDate: new Date("2024-01-04T12:00:00.000Z"),
|
|
579
|
+
color: "var(--color-content-dataviz-pink-3)",
|
|
580
|
+
hoverText: "Installation 3 PRM_3 - Indisponibilité 1",
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
id: "activation-1",
|
|
584
|
+
startDate: new Date("2024-01-07T02:00:00.000Z"),
|
|
585
|
+
endDate: new Date("2024-01-10T00:00:00.000Z"),
|
|
586
|
+
color: "var(--color-content-dataviz-azure-3)",
|
|
587
|
+
hoverText: "Installation 3 PRM_3 - Activation 1",
|
|
588
|
+
},
|
|
589
|
+
],
|
|
590
|
+
},
|
|
591
|
+
],
|
|
592
|
+
},
|
|
593
|
+
],
|
|
594
|
+
},
|
|
595
|
+
play: async ({ canvasElement, mount }) => {
|
|
596
|
+
MockDate.set("2024-01-05T12:00:00.000Z");
|
|
597
|
+
await mount();
|
|
598
|
+
const canvas = within(canvasElement);
|
|
599
|
+
const user = userEvent.setup();
|
|
600
|
+
await user.click(canvas.getByText("Installation 3"));
|
|
601
|
+
await canvas.findByText("Installation 3 PRM_1");
|
|
602
|
+
await canvas.findByText("Installation 3 PRM_2");
|
|
603
|
+
},
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
export const GroupWithEmptySubLine: Story = {
|
|
607
|
+
args: {
|
|
608
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
609
|
+
endDate: new Date("2024-01-08T00:00:00.000Z"),
|
|
610
|
+
lines: [
|
|
611
|
+
{
|
|
612
|
+
type: "group",
|
|
613
|
+
name: "Groupe vide",
|
|
614
|
+
subLines: [
|
|
615
|
+
{
|
|
616
|
+
name: "Sous-ligne sans blocs",
|
|
617
|
+
blocks: [],
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
name: "Sous-ligne avec bloc",
|
|
621
|
+
blocks: [
|
|
622
|
+
{
|
|
623
|
+
id: "b1",
|
|
624
|
+
startDate: new Date("2024-01-03T00:00:00.000Z"),
|
|
625
|
+
endDate: new Date("2024-01-05T00:00:00.000Z"),
|
|
626
|
+
color: "var(--color-content-dataviz-positive-3)",
|
|
627
|
+
hoverText: "Bloc existant",
|
|
628
|
+
},
|
|
629
|
+
],
|
|
630
|
+
},
|
|
631
|
+
],
|
|
632
|
+
},
|
|
633
|
+
],
|
|
634
|
+
},
|
|
635
|
+
play: async ({ canvasElement, mount }) => {
|
|
636
|
+
MockDate.set("2024-01-05T12:00:00.000Z");
|
|
637
|
+
await mount();
|
|
638
|
+
const canvas = within(canvasElement);
|
|
639
|
+
const user = userEvent.setup();
|
|
640
|
+
await user.click(canvas.getByText("Groupe vide"));
|
|
641
|
+
await canvas.findByText("Sous-ligne sans blocs");
|
|
642
|
+
await canvas.findByText("Sous-ligne avec bloc");
|
|
643
|
+
},
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
export const GroupWithOverflow: Story = {
|
|
647
|
+
args: {
|
|
648
|
+
startDate: new Date("2024-01-03T00:00:00.000Z"),
|
|
649
|
+
endDate: new Date("2024-01-06T00:00:00.000Z"),
|
|
650
|
+
lines: [
|
|
651
|
+
{
|
|
652
|
+
type: "group",
|
|
653
|
+
name: "Groupe avec overflow",
|
|
654
|
+
subLines: [
|
|
655
|
+
{
|
|
656
|
+
name: "Sous-ligne overflow gauche",
|
|
657
|
+
blocks: [
|
|
658
|
+
{
|
|
659
|
+
id: "overflow-left",
|
|
660
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
661
|
+
endDate: new Date("2024-01-04T00:00:00.000Z"),
|
|
662
|
+
color: "var(--color-content-dataviz-pink-3)",
|
|
663
|
+
hoverText: "Déborde à gauche",
|
|
664
|
+
},
|
|
665
|
+
],
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
name: "Sous-ligne overflow droite",
|
|
669
|
+
blocks: [
|
|
670
|
+
{
|
|
671
|
+
id: "overflow-right",
|
|
672
|
+
startDate: new Date("2024-01-05T00:00:00.000Z"),
|
|
673
|
+
endDate: new Date("2024-01-08T00:00:00.000Z"),
|
|
674
|
+
color: "var(--color-content-dataviz-azure-3)",
|
|
675
|
+
hoverText: "Déborde à droite",
|
|
676
|
+
},
|
|
677
|
+
],
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
name: "Sous-ligne overflow les deux",
|
|
681
|
+
blocks: [
|
|
682
|
+
{
|
|
683
|
+
id: "overflow-both",
|
|
684
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
685
|
+
endDate: new Date("2024-01-10T00:00:00.000Z"),
|
|
686
|
+
color: "var(--color-content-dataviz-orange-3)",
|
|
687
|
+
hoverText: "Déborde des deux côtés",
|
|
688
|
+
},
|
|
689
|
+
],
|
|
690
|
+
},
|
|
691
|
+
],
|
|
692
|
+
},
|
|
693
|
+
],
|
|
694
|
+
},
|
|
695
|
+
play: async ({ canvasElement, mount }) => {
|
|
696
|
+
MockDate.set("2024-01-04T12:00:00.000Z");
|
|
697
|
+
await mount();
|
|
698
|
+
const canvas = within(canvasElement);
|
|
699
|
+
const user = userEvent.setup();
|
|
700
|
+
await user.click(canvas.getByText("Groupe avec overflow"));
|
|
701
|
+
await canvas.findByText("Sous-ligne overflow gauche");
|
|
702
|
+
await canvas.findByText("Sous-ligne overflow droite");
|
|
703
|
+
await canvas.findByText("Sous-ligne overflow les deux");
|
|
704
|
+
},
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
export const MixedSimpleAndGroup: Story = {
|
|
708
|
+
args: {
|
|
709
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
710
|
+
endDate: new Date("2024-01-08T00:00:00.000Z"),
|
|
711
|
+
lines: [
|
|
712
|
+
{
|
|
713
|
+
name: "Ligne simple avant",
|
|
714
|
+
blocks: [
|
|
715
|
+
{
|
|
716
|
+
id: "simple-1",
|
|
717
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
718
|
+
endDate: new Date("2024-01-03T00:00:00.000Z"),
|
|
719
|
+
color: "var(--color-content-dataviz-pink-3)",
|
|
720
|
+
hoverText: "Bloc simple avant",
|
|
721
|
+
onClick: fn(),
|
|
722
|
+
},
|
|
723
|
+
],
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
type: "group",
|
|
727
|
+
name: "Groupe au milieu",
|
|
728
|
+
subLines: [
|
|
729
|
+
{
|
|
730
|
+
name: "Sous-ligne groupe",
|
|
731
|
+
blocks: [
|
|
732
|
+
{
|
|
733
|
+
id: "group-1",
|
|
734
|
+
startDate: new Date("2024-01-03T00:00:00.000Z"),
|
|
735
|
+
endDate: new Date("2024-01-06T00:00:00.000Z"),
|
|
736
|
+
color: "var(--color-content-dataviz-pink-3)",
|
|
737
|
+
hoverText: "Bloc groupe",
|
|
738
|
+
onClick: fn(),
|
|
739
|
+
},
|
|
740
|
+
],
|
|
741
|
+
},
|
|
742
|
+
],
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
name: "Ligne simple après",
|
|
746
|
+
blocks: [
|
|
747
|
+
{
|
|
748
|
+
id: "simple-2",
|
|
749
|
+
startDate: new Date("2024-01-05T00:00:00.000Z"),
|
|
750
|
+
endDate: new Date("2024-01-07T00:00:00.000Z"),
|
|
751
|
+
color: "var(--color-content-dataviz-pink-3)",
|
|
752
|
+
hoverText: "Bloc simple après",
|
|
753
|
+
onClick: fn(),
|
|
754
|
+
},
|
|
755
|
+
],
|
|
756
|
+
},
|
|
757
|
+
],
|
|
758
|
+
},
|
|
759
|
+
play: async ({ canvasElement, mount }) => {
|
|
760
|
+
MockDate.set("2024-01-04T12:00:00.000Z");
|
|
761
|
+
await mount();
|
|
762
|
+
const canvas = within(canvasElement);
|
|
763
|
+
await canvas.findByText("Ligne simple avant");
|
|
764
|
+
await canvas.findByText("Groupe au milieu");
|
|
765
|
+
await canvas.findByText("Ligne simple après");
|
|
766
|
+
},
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
export const CustomHoverContent: Story = {
|
|
770
|
+
args: {
|
|
771
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
772
|
+
endDate: new Date("2024-01-15T00:00:00.000Z"),
|
|
773
|
+
lines: [
|
|
774
|
+
{
|
|
775
|
+
name: "Installation 1",
|
|
776
|
+
blocks: [
|
|
777
|
+
{
|
|
778
|
+
id: "custom-2",
|
|
779
|
+
startDate: new Date("2024-01-05T00:00:00.000Z"),
|
|
780
|
+
endDate: new Date("2024-01-08T00:00:00.000Z"),
|
|
781
|
+
color: "var(--color-content-dataviz-orange-3)",
|
|
782
|
+
hoverText: "Maintenance B",
|
|
783
|
+
hoverContent: (
|
|
784
|
+
<ChartTooltip
|
|
785
|
+
items={[]}
|
|
786
|
+
bodyTitle={`05/01/2024 - 00:00 \n 08/01/2024 - 00:00`}
|
|
787
|
+
bodyContent={
|
|
788
|
+
<div>
|
|
789
|
+
<div>Puissance indisponible : 8,50 MW</div>
|
|
790
|
+
<div>Cause : Maintenance préventive</div>
|
|
791
|
+
</div>
|
|
792
|
+
}
|
|
793
|
+
footerSlot={
|
|
794
|
+
<div>
|
|
795
|
+
<hr
|
|
796
|
+
style={{
|
|
797
|
+
border: "none",
|
|
798
|
+
margin: "0",
|
|
799
|
+
padding: "0",
|
|
800
|
+
borderTop:
|
|
801
|
+
"1px solid var(--color-content-neutral-stroke)",
|
|
802
|
+
}}
|
|
803
|
+
/>
|
|
804
|
+
<em style={{ fontStyle: "italic" }}>
|
|
805
|
+
Cliquez pour accéder au détail.
|
|
806
|
+
</em>
|
|
807
|
+
</div>
|
|
808
|
+
}
|
|
809
|
+
/>
|
|
810
|
+
),
|
|
811
|
+
onClick: fn(),
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
id: "custom-3",
|
|
815
|
+
startDate: new Date("2024-01-09T00:00:00.000Z"),
|
|
816
|
+
endDate: new Date("2024-01-12T00:00:00.000Z"),
|
|
817
|
+
color: "var(--color-content-dataviz-negative-3)",
|
|
818
|
+
hoverText: "Default tooltip block",
|
|
819
|
+
onClick: fn(),
|
|
820
|
+
},
|
|
821
|
+
],
|
|
822
|
+
},
|
|
823
|
+
],
|
|
824
|
+
},
|
|
825
|
+
play: async ({ canvasElement, mount }) => {
|
|
826
|
+
MockDate.set("2024-01-05T12:00:00.000Z");
|
|
827
|
+
await mount();
|
|
828
|
+
const canvas = within(canvasElement);
|
|
829
|
+
await canvas.findByTestId("Maintenance B");
|
|
830
|
+
await canvas.findByTestId("Default tooltip block");
|
|
831
|
+
},
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
export const GroupFullOverlap: Story = {
|
|
835
|
+
args: {
|
|
836
|
+
startDate: new Date("2024-01-01T00:00:00.000Z"),
|
|
837
|
+
endDate: new Date("2024-01-08T00:00:00.000Z"),
|
|
838
|
+
lines: [
|
|
839
|
+
{
|
|
840
|
+
type: "group",
|
|
841
|
+
name: "Maison Dieu - PRM[50014414454079]",
|
|
842
|
+
subLines: [
|
|
843
|
+
{
|
|
844
|
+
name: "Sous-ligne 1",
|
|
845
|
+
blocks: [
|
|
846
|
+
{
|
|
847
|
+
id: "negative-1",
|
|
848
|
+
startDate: new Date("2024-01-02T00:00:00.000Z"),
|
|
849
|
+
endDate: new Date("2024-01-06T00:00:00.000Z"),
|
|
850
|
+
color: "var(--color-content-dataviz-negative-3)",
|
|
851
|
+
hoverText: "Sous-ligne 1 - bloc",
|
|
852
|
+
},
|
|
853
|
+
],
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
name: "Sous-ligne 2",
|
|
857
|
+
blocks: [
|
|
858
|
+
{
|
|
859
|
+
id: "orange-1",
|
|
860
|
+
startDate: new Date("2024-01-03T00:00:00.000Z"),
|
|
861
|
+
endDate: new Date("2024-01-07T00:00:00.000Z"),
|
|
862
|
+
color: "var(--color-content-dataviz-orange-3)",
|
|
863
|
+
hoverText: "Sous-ligne 2 - bloc",
|
|
864
|
+
},
|
|
865
|
+
],
|
|
866
|
+
},
|
|
867
|
+
{
|
|
868
|
+
name: "Sous-ligne 3",
|
|
869
|
+
blocks: [
|
|
870
|
+
...new Array(10).fill(null).map((_, index) => ({
|
|
871
|
+
id: `positive-multiple-blocks-${index}`,
|
|
872
|
+
startDate: new Date("2024-01-02T12:00:00.000Z"),
|
|
873
|
+
endDate: new Date("2024-01-05T00:00:00.000Z"),
|
|
874
|
+
color: "var(--color-content-dataviz-positive-3)",
|
|
875
|
+
hoverText: `Sous-ligne 3 - bloc ${index + 1}`,
|
|
876
|
+
})),
|
|
877
|
+
],
|
|
878
|
+
},
|
|
879
|
+
{
|
|
880
|
+
name: "Sous-ligne 4",
|
|
881
|
+
blocks: [
|
|
882
|
+
{
|
|
883
|
+
id: "neutral-1",
|
|
884
|
+
startDate: new Date("2024-01-02T00:00:00.000Z"),
|
|
885
|
+
endDate: new Date("2024-01-06T00:00:00.000Z"),
|
|
886
|
+
color: "var(--color-content-dataviz-neutral-3)",
|
|
887
|
+
hoverText: "Sous-ligne 1 - bloc",
|
|
888
|
+
},
|
|
889
|
+
],
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
name: "Sous-ligne 5",
|
|
893
|
+
blocks: [
|
|
894
|
+
{
|
|
895
|
+
id: "azure-1",
|
|
896
|
+
startDate: new Date("2024-01-02T00:00:00.000Z"),
|
|
897
|
+
endDate: new Date("2024-01-06T00:00:00.000Z"),
|
|
898
|
+
color: "var(--color-content-dataviz-azure-3)",
|
|
899
|
+
hoverText: "Sous-ligne 5 - bloc",
|
|
900
|
+
},
|
|
901
|
+
],
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
name: "Sous-ligne 6",
|
|
905
|
+
blocks: [
|
|
906
|
+
{
|
|
907
|
+
id: "pink-1",
|
|
908
|
+
startDate: new Date("2024-01-02T00:00:00.000Z"),
|
|
909
|
+
endDate: new Date("2024-01-06T00:00:00.000Z"),
|
|
910
|
+
color: "var(--color-content-dataviz-pink-3)",
|
|
911
|
+
hoverText: "Sous-ligne 6 - bloc",
|
|
912
|
+
},
|
|
913
|
+
],
|
|
914
|
+
},
|
|
915
|
+
],
|
|
916
|
+
},
|
|
917
|
+
],
|
|
918
|
+
},
|
|
919
|
+
play: async ({ canvasElement, mount }) => {
|
|
920
|
+
MockDate.set("2024-01-03T12:00:00.000Z");
|
|
921
|
+
await mount();
|
|
922
|
+
const canvas = within(canvasElement);
|
|
923
|
+
const user = userEvent.setup();
|
|
924
|
+
await user.click(canvas.getByText("Maison Dieu - PRM[50014414454079]"));
|
|
925
|
+
},
|
|
926
|
+
};
|
|
927
|
+
```
|
|
928
|
+
|
|
929
|
+
## Developer notes
|
|
930
|
+
|
|
931
|
+
Here are the notes available for the developer on the built Storybook, you can read them to understand the component and how to use it.
|
|
932
|
+
|
|
933
|
+
````mdx
|
|
934
|
+
import { Meta, Controls, Source, Canvas } from "@storybook/addon-docs/blocks";
|
|
935
|
+
|
|
936
|
+
import * as Timeline from "./Timeline.stories";
|
|
937
|
+
|
|
938
|
+
<Meta of={Timeline} />
|
|
939
|
+
|
|
940
|
+
# Timeline
|
|
941
|
+
|
|
942
|
+
This component allows you to display temporal informations in a compact way.
|
|
943
|
+
It consists of a series of lines that can all have different "blocks" that each have a starting and ending date.
|
|
944
|
+
|
|
945
|
+
Here are some of the features that comes built-in:
|
|
946
|
+
|
|
947
|
+
- **date-based**: give a start date and an end date for the timeline, the timeline range units will be computed accordingly
|
|
948
|
+
- **overflow-control**: you don't have to filter blocks that start before/after the timeline range, they will be hidden automatically
|
|
949
|
+
- **automatic stacking**: of blocks that overlap in the same line, no limit in the number of blocks that can be stacked
|
|
950
|
+
- **hover-text**: each block can have a hover text that will be displayed when hovering over the block
|
|
951
|
+
- **empty placeholder**: display a message when there are no blocks to display
|
|
952
|
+
|
|
953
|
+
There are a few restrictions though:
|
|
954
|
+
|
|
955
|
+
- please **do not exceed 1 month (31 days) in range**, it might not render properly (ask us if you need to display more!)
|
|
956
|
+
- please also give **at least a few hours** in range
|
|
957
|
+
- it is highly recommended to provide all dates (Timeline range _and_ blocks) in **ISO 8601 format with UTC timezone** (so the user can see the vertical bar indicating "now" at the proper place)
|
|
958
|
+
|
|
959
|
+
<Canvas of={Timeline.Playground} />
|
|
960
|
+
<Controls of={Timeline.Playground} />
|
|
961
|
+
|
|
962
|
+
## Timeline modes
|
|
963
|
+
|
|
964
|
+
You will see a small variation of the display of the timeline range (hours or dates).
|
|
965
|
+
|
|
966
|
+
We can see this as "modes", but please note that those modes are computed automatically based on the dates provided.
|
|
967
|
+
|
|
968
|
+
### Example usage : "hour" mode
|
|
969
|
+
|
|
970
|
+
To display hours in the timeline range, you must provide a start and end date that are exactly 1 day or less apart.
|
|
971
|
+
|
|
972
|
+
Here is an example (click on "Show code").
|
|
973
|
+
|
|
974
|
+
<Canvas of={Timeline.HoursUnit} />
|
|
975
|
+
|
|
976
|
+
### Example usage : "week" mode (weekdays)
|
|
977
|
+
|
|
978
|
+
This display will appear if the timeline range between more than 1 day to 2 weeks.
|
|
979
|
+
|
|
980
|
+
Here is an example (click on "Show code").
|
|
981
|
+
|
|
982
|
+
<Canvas of={Timeline.Week} />
|
|
983
|
+
|
|
984
|
+
### Example usage : "month" mode
|
|
985
|
+
|
|
986
|
+
This display will appear if the timeline range is more than 2 weeks.
|
|
987
|
+
|
|
988
|
+
Please note that for now, we recommend to provide a range of 1 month (31 days) maximum.
|
|
989
|
+
|
|
990
|
+
Here is an example (click on "Show code").
|
|
991
|
+
|
|
992
|
+
<Canvas of={Timeline.Month} />
|
|
993
|
+
|
|
994
|
+
## Grouped lines
|
|
995
|
+
|
|
996
|
+
A **group line** aggregates multiple sub-lines under a single collapsible row.
|
|
997
|
+
|
|
998
|
+
Use `type: "group"` with a `subLines` array instead of a `blocks` array.
|
|
999
|
+
|
|
1000
|
+
```ts
|
|
1001
|
+
{
|
|
1002
|
+
type: "group",
|
|
1003
|
+
name: "Installation 3",
|
|
1004
|
+
subLines: [
|
|
1005
|
+
{
|
|
1006
|
+
name: "Installation 3 PRM_1",
|
|
1007
|
+
blocks: [ /* ... */ ],
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
name: "Installation 3 PRM_2",
|
|
1011
|
+
blocks: [ /* ... */ ],
|
|
1012
|
+
},
|
|
1013
|
+
],
|
|
1014
|
+
}
|
|
1015
|
+
```
|
|
1016
|
+
|
|
1017
|
+
### Collapsed state (default)
|
|
1018
|
+
|
|
1019
|
+
When collapsed, the group displays a **merged view** of all sub-lines' blocks. Blocks sharing the same color are merged into a single block spanning their combined range. This gives a quick overview of activity across all sub-lines.
|
|
1020
|
+
|
|
1021
|
+
### Expanded state
|
|
1022
|
+
|
|
1023
|
+
Clicking the group name **expands** it, revealing each sub-line on its own indented row. Clicking again collapses it back.
|
|
1024
|
+
|
|
1025
|
+
### Simple group (one sub-line)
|
|
1026
|
+
|
|
1027
|
+
<Canvas of={Timeline.GroupSimple} />
|
|
1028
|
+
|
|
1029
|
+
### Group with multiple sub-lines
|
|
1030
|
+
|
|
1031
|
+
<Canvas of={Timeline.GroupMultiple} />
|
|
1032
|
+
|
|
1033
|
+
### Mixed simple and group lines
|
|
1034
|
+
|
|
1035
|
+
Simple lines and group lines can coexist in the same `lines` array.
|
|
1036
|
+
|
|
1037
|
+
<Canvas of={Timeline.MixedSimpleAndGroup} />
|
|
1038
|
+
|
|
1039
|
+
## How to test the Timeline component
|
|
1040
|
+
|
|
1041
|
+
- Lines' names can be targeted through their label prop (`getByText`) (even if truncated)
|
|
1042
|
+
- Individual lines can be targeted through `getByTestId` with id of `block-chart-line-${lineLabel}-${lineIndex}`
|
|
1043
|
+
- Individual time blocks can be targeted through `getByTestId` with id of their hover text
|
|
1044
|
+
|
|
1045
|
+
Feel free to inspect the DOM to find the right selectors.
|
|
1046
|
+
````
|