@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.
Files changed (68) hide show
  1. package/dist/design-system.cjs +9 -5
  2. package/dist/design-system.js +14 -6
  3. package/dist/packages/components/Accordion/doc.md +342 -0
  4. package/dist/packages/components/Badge/doc.md +192 -0
  5. package/dist/packages/components/Breadcrumbs/doc.md +332 -0
  6. package/dist/packages/components/Button/doc.md +425 -0
  7. package/dist/packages/components/Calendar/doc.md +465 -0
  8. package/dist/packages/components/ChartLegend/doc.md +151 -0
  9. package/dist/packages/components/ChartTooltip/doc.md +124 -0
  10. package/dist/packages/components/Checkbox/doc.md +329 -0
  11. package/dist/packages/components/CheckboxGroup/doc.md +242 -0
  12. package/dist/packages/components/Chip/doc.md +99 -0
  13. package/dist/packages/components/Combobox/Combobox.d.ts +8 -0
  14. package/dist/packages/components/Combobox/doc.md +680 -0
  15. package/dist/packages/components/DataTable/doc.md +1124 -0
  16. package/dist/packages/components/DatePicker/doc.md +579 -0
  17. package/dist/packages/components/DateRangePicker/doc.md +638 -0
  18. package/dist/packages/components/Drawer/doc.md +338 -0
  19. package/dist/packages/components/Dropdown/Dropdown.d.ts +4 -0
  20. package/dist/packages/components/Dropdown/doc.md +205 -0
  21. package/dist/packages/components/EmptyState/doc.md +101 -0
  22. package/dist/packages/components/FileUpload/doc.md +449 -0
  23. package/dist/packages/components/Filter/doc.md +196 -0
  24. package/dist/packages/components/Header/doc.md +373 -0
  25. package/dist/packages/components/I18nProvider/doc.md +187 -0
  26. package/dist/packages/components/Icon/doc.md +63 -0
  27. package/dist/packages/components/Label/doc.md +60 -0
  28. package/dist/packages/components/LinearProgressBar/doc.md +148 -0
  29. package/dist/packages/components/Link/doc.md +206 -0
  30. package/dist/packages/components/List/doc.md +481 -0
  31. package/dist/packages/components/Loader/doc.md +53 -0
  32. package/dist/packages/components/Menu/Menu.d.ts +5 -1
  33. package/dist/packages/components/Menu/doc.md +231 -0
  34. package/dist/packages/components/Message/doc.md +166 -0
  35. package/dist/packages/components/Modal/doc.md +289 -0
  36. package/dist/packages/components/Navigation/doc.md +992 -0
  37. package/dist/packages/components/NavigationItem/doc.md +167 -0
  38. package/dist/packages/components/NotificationCard/doc.md +206 -0
  39. package/dist/packages/components/Notifications/doc.md +240 -0
  40. package/dist/packages/components/NumberField/doc.md +582 -0
  41. package/dist/packages/components/PageLayout/doc.md +651 -0
  42. package/dist/packages/components/Pagination/doc.md +227 -0
  43. package/dist/packages/components/Popover/doc.md +245 -0
  44. package/dist/packages/components/Radio/doc.md +370 -0
  45. package/dist/packages/components/RouterProvider/doc.md +64 -0
  46. package/dist/packages/components/SearchBar/doc.md +504 -0
  47. package/dist/packages/components/SegmentedControl/doc.md +398 -0
  48. package/dist/packages/components/Select/Select.d.ts +4 -0
  49. package/dist/packages/components/Select/doc.md +1133 -0
  50. package/dist/packages/components/Skeleton/doc.md +129 -0
  51. package/dist/packages/components/Slider/doc.md +362 -0
  52. package/dist/packages/components/Stepper/doc.md +104 -0
  53. package/dist/packages/components/Switch/doc.md +296 -0
  54. package/dist/packages/components/Tabs/doc.md +295 -0
  55. package/dist/packages/components/Tag/doc.md +81 -0
  56. package/dist/packages/components/TextInput/doc.md +490 -0
  57. package/dist/packages/components/TimeField/doc.md +353 -0
  58. package/dist/packages/components/Timeline/doc.md +1046 -0
  59. package/dist/packages/components/Toaster/doc.md +263 -0
  60. package/dist/packages/components/ToggleButton/doc.md +108 -0
  61. package/dist/packages/components/ToggleButtonGroup/doc.md +307 -0
  62. package/dist/packages/components/Tooltip/doc.md +206 -0
  63. package/dist/packages/components/YearMonthPicker/YearMonthPicker.d.ts +8 -0
  64. package/dist/packages/components/YearMonthPicker/doc.md +638 -0
  65. package/dist/public_docs/components.md +68 -0
  66. package/dist/public_docs/index.md +30 -0
  67. package/dist/public_docs/tokens.md +121 -0
  68. package/package.json +3 -2
@@ -0,0 +1,129 @@
1
+ # Skeleton
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/Skeleton/Skeleton.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 Skeleton from "./Skeleton";
18
+
19
+ const meta: Meta<typeof Skeleton> = {
20
+ component: Skeleton,
21
+ tags: ["autodocs"],
22
+ parameters: {
23
+ layout: "centered",
24
+ },
25
+ };
26
+ export default meta;
27
+
28
+ type Story = StoryObj<typeof meta>;
29
+
30
+ export const Playground: Story = {
31
+ parameters: {
32
+ chromatic: { disableSnapshot: true },
33
+ },
34
+ args: {
35
+ variant: "text",
36
+ color: "neutral",
37
+ width: "100px",
38
+ },
39
+ };
40
+
41
+ export const MultilineText: Story = {
42
+ parameters: {
43
+ chromatic: { disableSnapshot: true },
44
+ },
45
+ render: () => {
46
+ return (
47
+ <div style={{ width: "100px" }}>
48
+ <Skeleton variant="text" />
49
+ <Skeleton variant="text" />
50
+ <Skeleton variant="text" />
51
+ </div>
52
+ );
53
+ },
54
+ };
55
+
56
+ export const Circular: Story = {
57
+ parameters: {
58
+ chromatic: { disableSnapshot: true },
59
+ },
60
+ args: {
61
+ ...Playground.args,
62
+ variant: "circular",
63
+ width: 100,
64
+ height: 100,
65
+ },
66
+ };
67
+
68
+ export const Rounded: Story = {
69
+ parameters: {
70
+ chromatic: { disableSnapshot: true },
71
+ },
72
+ args: {
73
+ ...Playground.args,
74
+ variant: "rounded",
75
+ width: "100px",
76
+ height: "100px",
77
+ },
78
+ };
79
+
80
+ export const Rectangular: Story = {
81
+ parameters: {
82
+ chromatic: { disableSnapshot: true },
83
+ },
84
+ args: {
85
+ ...Playground.args,
86
+ variant: "rectangular",
87
+ width: "100px",
88
+ height: "100px",
89
+ },
90
+ };
91
+
92
+ export const AllVariants: Story = {
93
+ render: () => {
94
+ return (
95
+ <div
96
+ style={{
97
+ display: "flex",
98
+ flexDirection: "column",
99
+ gap: "var(--spacing-sm)",
100
+ }}
101
+ >
102
+ <div>
103
+ <h2 style={{ fontSize: "var(--text-font-size-xl)", margin: 0 }}>
104
+ <Skeleton variant="text" width={"100%"} />
105
+ </h2>
106
+ </div>
107
+ <div>
108
+ <Skeleton variant="text" width={"100%"} />
109
+ <Skeleton variant="text" width={"80%"} />
110
+ <Skeleton variant="text" width={"90%"} />
111
+ </div>
112
+ <Skeleton variant="rectangular" width={200} height={50} />
113
+ <Skeleton variant="circular" width={150} height={150} />
114
+ <Skeleton variant="rounded" width={200} height={50} />
115
+ </div>
116
+ );
117
+ },
118
+ };
119
+
120
+ export const White: Story = {
121
+ args: {
122
+ ...Circular.args,
123
+ color: "white",
124
+ },
125
+ globals: {
126
+ backgrounds: { value: "dark" },
127
+ },
128
+ };
129
+ ```
@@ -0,0 +1,362 @@
1
+ # Slider
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/Slider/Slider.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 Slider from "./Slider";
18
+ import { I18nProvider } from "react-aria-components";
19
+ import { expect, within } from "storybook/test";
20
+ import { useState } from "react";
21
+
22
+ const meta: Meta<typeof Slider> = {
23
+ component: Slider,
24
+ argTypes: {
25
+ label: { control: "text" },
26
+ value: { control: "text" },
27
+ description: { control: "text" },
28
+ helperText: { control: "text" },
29
+ errorHelperText: { control: "text" },
30
+ successHelperText: { control: "text" },
31
+ },
32
+ parameters: {
33
+ layout: "centered",
34
+ },
35
+ decorators: [
36
+ (Story, context) => (
37
+ <I18nProvider locale={context.parameters.locale || "en-EN"}>
38
+ <Story />
39
+ </I18nProvider>
40
+ ),
41
+ ],
42
+ render: (args) => {
43
+ const ParentComponent = () => {
44
+ const [value, setValue] = useState<Array<number>>([30]);
45
+
46
+ return (
47
+ <>
48
+ <Slider {...args} onChange={setValue} value={value} />
49
+ <p>Debug state value: {JSON.stringify(value)}</p>
50
+ </>
51
+ );
52
+ };
53
+ return <ParentComponent />;
54
+ },
55
+ };
56
+ export default meta;
57
+
58
+ type Story = StoryObj<typeof meta>;
59
+
60
+ export const Playground: Story = {
61
+ args: {
62
+ label: "Participants",
63
+ thumbLabels: ["Number of participants"],
64
+ minValue: 0,
65
+ maxValue: 100,
66
+ step: 1,
67
+ isDisabled: false,
68
+ labelIconRight: "help_outline",
69
+ labelIconRightTooltip: "Additional information",
70
+ description: "Select the number of participants",
71
+ helperText: "This is a helper text",
72
+ helperTextIcon: "help_outline",
73
+ errorHelperTextIcon: "error_outline",
74
+ style: {
75
+ minWidth: 441,
76
+ },
77
+ },
78
+ play: async ({ canvasElement }) => {
79
+ const canvas = within(canvasElement);
80
+ await canvas.findByText("Participants");
81
+ await canvas.findByLabelText("Number of participants");
82
+ await canvas.findByText("This is a helper text");
83
+ await canvas.findByText("Select the number of participants");
84
+ await expect(
85
+ canvas.getByLabelText("Value for Number of participants"),
86
+ ).toHaveValue("30");
87
+ await canvas.findByText("Debug state value: [30]");
88
+ },
89
+ };
90
+
91
+ export const Disabled: StoryObj<typeof Slider> = {
92
+ args: {
93
+ ...Playground.args,
94
+ isDisabled: true,
95
+ },
96
+ };
97
+
98
+ export const WithInvalid: StoryObj<typeof Slider> = {
99
+ args: {
100
+ ...Playground.args,
101
+ helperText: undefined,
102
+ },
103
+ render: () => {
104
+ const ParentComponent = () => {
105
+ const [value, setValue] = useState<Array<number>>([30]);
106
+ const isInvalid = (value: Array<number>) => value[0] < 50;
107
+
108
+ return (
109
+ <>
110
+ <Slider
111
+ label="Participants"
112
+ thumbLabels={["Number of participants"]}
113
+ onChange={setValue}
114
+ value={value}
115
+ isInvalid={isInvalid}
116
+ errorHelperText={
117
+ isInvalid(value)
118
+ ? "Less than 50 participants may cause the event to be cancelled"
119
+ : undefined
120
+ }
121
+ errorHelperTextIcon="error_outline"
122
+ style={{ minWidth: 441 }}
123
+ />
124
+ <p>Debug state value: {JSON.stringify(value)}</p>
125
+ </>
126
+ );
127
+ };
128
+ return <ParentComponent />;
129
+ },
130
+ };
131
+
132
+ export const WithTrackDots: StoryObj<typeof Slider> = {
133
+ args: {
134
+ ...Playground.args,
135
+ withTrackDots: true,
136
+ step: 10,
137
+ },
138
+ };
139
+ ```
140
+
141
+ ## How to test this component
142
+
143
+ Here are some more advanced stories with more testing coverage and examples that you can read to understand how to test this component.
144
+
145
+ ```tsx
146
+ import { Meta, StoryObj } from "@storybook/react-vite";
147
+ import Slider from "../Slider";
148
+ import { expect, userEvent, within } from "storybook/test";
149
+ import { useState } from "react";
150
+ import * as SliderStories from "../Slider.stories";
151
+
152
+ const meta: Meta<typeof Slider> = {
153
+ ...SliderStories.default,
154
+ component: Slider,
155
+ render: undefined,
156
+ parameters: {
157
+ layout: "padded",
158
+ chromatic: { disableSnapshot: true },
159
+ },
160
+ };
161
+ export default meta;
162
+
163
+ type Story = StoryObj<typeof meta>;
164
+
165
+ export const ControlledExample: Story = {
166
+ render: () => {
167
+ const ParentComponent = () => {
168
+ const [value, setValue] = useState([30]);
169
+
170
+ return (
171
+ <>
172
+ <Slider
173
+ label="Participants"
174
+ onChange={setValue}
175
+ value={value}
176
+ thumbLabels={["Number of participants"]}
177
+ />
178
+ <p>Debug state value: {JSON.stringify(value)}</p>
179
+ </>
180
+ );
181
+ };
182
+ return <ParentComponent />;
183
+ },
184
+ };
185
+
186
+ export const ControlledExampleTests: Story = {
187
+ render: ControlledExample.render,
188
+ play: async ({ canvasElement }) => {
189
+ const canvas = within(canvasElement);
190
+ const user = userEvent.setup();
191
+ const input = await canvas.findByLabelText(
192
+ "Value for Number of participants",
193
+ );
194
+ await expect(input).toHaveValue("30");
195
+ await canvas.findByText("Debug state value: [30]");
196
+ await user.clear(input);
197
+ await user.type(input, "40");
198
+ await expect(input).toHaveValue("40");
199
+ await canvas.findByText("Debug state value: [40]");
200
+ },
201
+ };
202
+
203
+ export const ControlledRangeExample: Story = {
204
+ render: () => {
205
+ const ParentComponent = () => {
206
+ const [value, setValue] = useState([9, 17]);
207
+
208
+ return (
209
+ <>
210
+ <Slider
211
+ label="Opening hours"
212
+ onChange={setValue}
213
+ value={value}
214
+ thumbLabels={["From", "To"]}
215
+ minValue={0}
216
+ maxValue={24}
217
+ step={1}
218
+ />
219
+ <p>Debug state value: {JSON.stringify(value)}</p>
220
+ </>
221
+ );
222
+ };
223
+ return <ParentComponent />;
224
+ },
225
+ };
226
+
227
+ export const ExampleWithTrackDots: Story = {
228
+ render: () => {
229
+ const ParentComponent = () => {
230
+ const [value, setValue] = useState([9, 17]);
231
+
232
+ return (
233
+ <>
234
+ <Slider
235
+ label="Opening hours"
236
+ value={value}
237
+ onChange={setValue}
238
+ thumbLabels={["From", "To"]}
239
+ minValue={0}
240
+ maxValue={24}
241
+ step={1}
242
+ withTrackDots
243
+ />
244
+ </>
245
+ );
246
+ };
247
+ return <ParentComponent />;
248
+ },
249
+ };
250
+
251
+ export const ExampleWithUpdateStepOnChangeEnd: Story = {
252
+ render: () => {
253
+ const ParentComponent = () => {
254
+ const [value, setValue] = useState([9, 17]);
255
+
256
+ return (
257
+ <>
258
+ <Slider
259
+ label="Opening hours"
260
+ value={value}
261
+ onChangeEnd={setValue} // Update the step only when the user stops dragging the slider
262
+ thumbLabels={["From", "To"]}
263
+ minValue={0}
264
+ maxValue={24}
265
+ step={1}
266
+ />
267
+ <p>Debug state value: {JSON.stringify(value)}</p>
268
+ </>
269
+ );
270
+ };
271
+ return <ParentComponent />;
272
+ },
273
+ };
274
+ ```
275
+
276
+ ## Developer notes
277
+
278
+ 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.
279
+
280
+ ```mdx
281
+ import {
282
+ Canvas,
283
+ Meta,
284
+ Stories,
285
+ Controls,
286
+ Source,
287
+ } from "@storybook/addon-docs/blocks";
288
+
289
+ import * as Slider from "./Slider.stories";
290
+ import * as SliderTests from "./tests/Slider.stories";
291
+
292
+ <Meta of={Slider} />
293
+
294
+ # Slider
295
+
296
+ <Canvas of={Slider.Playground} />
297
+
298
+ <Controls of={Slider.Playground} />
299
+
300
+ The `<input type="range">` HTML element can be used to build a slider, however it is very difficult to style cross browser.
301
+
302
+ Slider helps achieve accessible sliders that can be styled as needed.
303
+
304
+ - **Customizable** – Support for one or multiple thumbs. The whole slider, or individual thumbs can be disabled. Custom minimum, maximum, and step values are supported as well.
305
+ - **High quality interactions** – Mouse, touch, and keyboard input is supported. Pressing the track moves the nearest thumb to that position. Text selection and touch scrolling are prevented while dragging.
306
+ - **Touch friendly** – Multiple thumbs or sliders can be dragged at once on multi-touch screens.
307
+ - **Accessible** – Slider thumbs use visually hidden `<input>` elements for mobile screen reader support, and HTML form integration. `<label>` and `<output>` elements are automatically associated to provide context for assistive technologies.
308
+
309
+ ## Usage
310
+
311
+ The Slider component must be used as a controlled component. So you need to handle the `onChange` event and update the `value` prop accordingly.
312
+
313
+ The value is an array of numbers. If you need a single thumb slider, you can pass a single number in the array.
314
+ Pass two numbers in the array to get a range slider.
315
+
316
+ Here is an example of a **single-thumb slider** :
317
+
318
+ <Canvas of={SliderTests.ControlledExample} sourceState="shown" />
319
+
320
+ And here is an example of a **range slider** :
321
+
322
+ <Canvas of={SliderTests.ControlledRangeExample} sourceState="shown" />
323
+
324
+ ## Invalid feedback
325
+
326
+ In case where you have some values that are selectionable via the Slider but may cause issues,
327
+ you can give a feedback to the user by making the slider red.
328
+
329
+ Here is an example of a range slider with invalid feedback :
330
+
331
+ <Canvas of={Slider.WithInvalid} sourceState="shown" />
332
+
333
+ ## With track dots
334
+
335
+ You can display dots on the track to help the user know the steps of the slider.
336
+ It is recommended to use it only if you don't have a lot of possible steps.
337
+
338
+ <Canvas of={SliderTests.ExampleWithTrackDots} sourceState="shown" />
339
+
340
+ ## Update state only when the user stops dragging
341
+
342
+ You can update the state only when the user stops dragging the slider by using the `onChangeEnd` prop.
343
+
344
+ This is usefull if you want to avoid the many re-renderings of the parent component while the user is dragging the Slider.
345
+ Or even more important if the slider value is used for an API call for example (to avoid sending too many requests).
346
+
347
+ <Canvas of={SliderTests.ExampleWithUpdateStepOnChangeEnd} sourceState="shown" />
348
+
349
+ ## How to test the slider
350
+
351
+ The best way to test the slider is to use the input(s) directly.
352
+
353
+ They can be targeted by their label text (passed by the thumbLabels prop).
354
+
355
+ For example, take the ControlledExample story :
356
+
357
+ <Source of={SliderTests.ControlledExample} type="code" dark />
358
+
359
+ You can target the input with the label "Number of participants" and change its value like this :
360
+
361
+ <Source of={SliderTests.ControlledExampleTests} type="code" dark />
362
+ ```
@@ -0,0 +1,104 @@
1
+ # Stepper
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/Stepper/Stepper.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 { within } from "storybook/test";
18
+ import Stepper from "./Stepper";
19
+ import Step from "./Step/Step";
20
+ import { StorybookSwapComponent } from "./Step/Step.styled";
21
+
22
+ const meta: Meta<typeof Stepper> = {
23
+ component: Stepper,
24
+ argTypes: {
25
+ children: { control: false },
26
+ },
27
+ tags: ["autodocs"],
28
+ };
29
+ export default meta;
30
+
31
+ type Story = StoryObj<typeof meta>;
32
+
33
+ export const Playground: Story = {
34
+ args: {
35
+ orientation: "horizontal",
36
+ children: (
37
+ <>
38
+ <Step title="Step 1" isCompleted href="/step-1" />
39
+ <Step
40
+ title="Step 2"
41
+ description="Step 2 description"
42
+ isActive
43
+ href="/step-2"
44
+ nature="warning"
45
+ />
46
+ <Step
47
+ title="Step 3"
48
+ description="Step 3 description"
49
+ href="/step-3"
50
+ nature="negative"
51
+ >
52
+ <StorybookSwapComponent>Step 3 content</StorybookSwapComponent>
53
+ </Step>
54
+ <Step
55
+ title="Step 4"
56
+ description="Disabled step"
57
+ isDisabled
58
+ href="/step-4"
59
+ />
60
+ </>
61
+ ),
62
+ },
63
+ play: async ({ canvasElement }) => {
64
+ const canvas = within(canvasElement);
65
+ await canvas.findByText("Step 1");
66
+ await canvas.findByText("Step 2");
67
+ await canvas.findByText("Step 2 description");
68
+ await canvas.findByText("Step 3");
69
+ await canvas.findByText("Step 3 description");
70
+ await canvas.findByText("Step 3 content");
71
+ },
72
+ };
73
+
74
+ export const Vertical: Story = {
75
+ args: {
76
+ ...Playground.args,
77
+ orientation: "vertical",
78
+ },
79
+ };
80
+
81
+ export const Numbered: Story = {
82
+ args: {
83
+ ...Playground.args,
84
+ children: (
85
+ <>
86
+ <Step title="Step 1" isCompleted indicator={1} />
87
+ <Step
88
+ title="Step 2"
89
+ description="Step 2 description"
90
+ isActive
91
+ indicator={2}
92
+ />
93
+ <Step title="Step 3" description="Step 3 description" indicator={3} />
94
+ <Step
95
+ title="Step 4"
96
+ description="Disabled step"
97
+ isDisabled
98
+ indicator={4}
99
+ />
100
+ </>
101
+ ),
102
+ },
103
+ };
104
+ ```