@agregio-solutions/design-system 1.91.0 → 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 (61) hide show
  1. package/dist/packages/components/Accordion/doc.md +342 -0
  2. package/dist/packages/components/Badge/doc.md +192 -0
  3. package/dist/packages/components/Breadcrumbs/doc.md +332 -0
  4. package/dist/packages/components/Button/doc.md +425 -0
  5. package/dist/packages/components/Calendar/doc.md +465 -0
  6. package/dist/packages/components/ChartLegend/doc.md +151 -0
  7. package/dist/packages/components/ChartTooltip/doc.md +124 -0
  8. package/dist/packages/components/Checkbox/doc.md +329 -0
  9. package/dist/packages/components/CheckboxGroup/doc.md +242 -0
  10. package/dist/packages/components/Chip/doc.md +99 -0
  11. package/dist/packages/components/Combobox/doc.md +680 -0
  12. package/dist/packages/components/DataTable/doc.md +1124 -0
  13. package/dist/packages/components/DatePicker/doc.md +579 -0
  14. package/dist/packages/components/DateRangePicker/doc.md +638 -0
  15. package/dist/packages/components/Drawer/doc.md +338 -0
  16. package/dist/packages/components/Dropdown/doc.md +205 -0
  17. package/dist/packages/components/EmptyState/doc.md +101 -0
  18. package/dist/packages/components/FileUpload/doc.md +449 -0
  19. package/dist/packages/components/Filter/doc.md +196 -0
  20. package/dist/packages/components/Header/doc.md +373 -0
  21. package/dist/packages/components/I18nProvider/doc.md +187 -0
  22. package/dist/packages/components/Icon/doc.md +63 -0
  23. package/dist/packages/components/Label/doc.md +60 -0
  24. package/dist/packages/components/LinearProgressBar/doc.md +148 -0
  25. package/dist/packages/components/Link/doc.md +206 -0
  26. package/dist/packages/components/List/doc.md +481 -0
  27. package/dist/packages/components/Loader/doc.md +53 -0
  28. package/dist/packages/components/Menu/doc.md +231 -0
  29. package/dist/packages/components/Message/doc.md +166 -0
  30. package/dist/packages/components/Modal/doc.md +289 -0
  31. package/dist/packages/components/Navigation/doc.md +992 -0
  32. package/dist/packages/components/NavigationItem/doc.md +167 -0
  33. package/dist/packages/components/NotificationCard/doc.md +206 -0
  34. package/dist/packages/components/Notifications/doc.md +240 -0
  35. package/dist/packages/components/NumberField/doc.md +582 -0
  36. package/dist/packages/components/PageLayout/doc.md +651 -0
  37. package/dist/packages/components/Pagination/doc.md +227 -0
  38. package/dist/packages/components/Popover/doc.md +245 -0
  39. package/dist/packages/components/Radio/doc.md +370 -0
  40. package/dist/packages/components/RouterProvider/doc.md +64 -0
  41. package/dist/packages/components/SearchBar/doc.md +504 -0
  42. package/dist/packages/components/SegmentedControl/doc.md +398 -0
  43. package/dist/packages/components/Select/doc.md +1133 -0
  44. package/dist/packages/components/Skeleton/doc.md +129 -0
  45. package/dist/packages/components/Slider/doc.md +362 -0
  46. package/dist/packages/components/Stepper/doc.md +104 -0
  47. package/dist/packages/components/Switch/doc.md +296 -0
  48. package/dist/packages/components/Tabs/doc.md +295 -0
  49. package/dist/packages/components/Tag/doc.md +81 -0
  50. package/dist/packages/components/TextInput/doc.md +490 -0
  51. package/dist/packages/components/TimeField/doc.md +353 -0
  52. package/dist/packages/components/Timeline/doc.md +1046 -0
  53. package/dist/packages/components/Toaster/doc.md +263 -0
  54. package/dist/packages/components/ToggleButton/doc.md +108 -0
  55. package/dist/packages/components/ToggleButtonGroup/doc.md +307 -0
  56. package/dist/packages/components/Tooltip/doc.md +206 -0
  57. package/dist/packages/components/YearMonthPicker/doc.md +638 -0
  58. package/dist/public_docs/components.md +68 -0
  59. package/dist/public_docs/index.md +30 -0
  60. package/dist/public_docs/tokens.md +121 -0
  61. package/package.json +3 -2
@@ -0,0 +1,342 @@
1
+ # Accordion
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/Accordion/Accordion.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 { expect, fn, userEvent, within } from "storybook/test";
18
+ import Accordion from "./Accordion";
19
+ import { I18nProvider } from "react-aria-components";
20
+ import Icon from "../Icon/Icon";
21
+ import Checkbox from "../Checkbox/Checkbox";
22
+ import Tag from "../Tag/Tag";
23
+
24
+ const meta: Meta<typeof Accordion> = {
25
+ component: Accordion,
26
+ parameters: {
27
+ layout: "centered",
28
+ },
29
+ globals: {
30
+ backgrounds: { value: "light" },
31
+ },
32
+ args: {
33
+ onExpandedChange: fn(),
34
+ },
35
+ argTypes: {
36
+ description: { control: { type: "text" } },
37
+ children: { control: { type: "text" } },
38
+ },
39
+ decorators: [
40
+ (Story) => (
41
+ <div style={{ width: "410px" }}>
42
+ <I18nProvider locale="en">
43
+ <Story />
44
+ </I18nProvider>
45
+ </div>
46
+ ),
47
+ ],
48
+ };
49
+ export default meta;
50
+
51
+ type Story = StoryObj<typeof meta>;
52
+
53
+ export const Playground: Story = {
54
+ args: {
55
+ title: "[Insert title]",
56
+ description: "[Insert description]",
57
+ children: "Placeholder",
58
+ },
59
+ play: async ({ canvasElement, args }) => {
60
+ const canvas = within(canvasElement);
61
+ await canvas.findByText(args.title);
62
+ await canvas.findByText(args.description as string);
63
+ await expect(canvas.getByText("Placeholder")).not.toBeVisible();
64
+ },
65
+ };
66
+
67
+ export const Positive: Story = {
68
+ args: {
69
+ ...Playground.args,
70
+ defaultExpanded: true,
71
+ nature: "positive",
72
+ },
73
+ };
74
+
75
+ export const Negative: Story = {
76
+ args: {
77
+ ...Playground.args,
78
+ defaultExpanded: true,
79
+ nature: "negative",
80
+ },
81
+ };
82
+
83
+ export const Informative: Story = {
84
+ args: {
85
+ ...Playground.args,
86
+ defaultExpanded: true,
87
+ nature: "informative",
88
+ },
89
+ };
90
+
91
+ export const NoPadding: Story = {
92
+ args: {
93
+ ...Playground.args,
94
+ children: (
95
+ <div style={{ backgroundColor: "var(--color-content-neutral-tertiary)" }}>
96
+ Placeholder with background color
97
+ </div>
98
+ ),
99
+ defaultExpanded: true,
100
+ noPadding: true,
101
+ },
102
+ };
103
+
104
+ export const DefaultExpanded: Story = {
105
+ args: {
106
+ ...Playground.args,
107
+ defaultExpanded: true,
108
+ },
109
+ play: async ({ canvasElement, args }) => {
110
+ const canvas = within(canvasElement);
111
+ await canvas.findByText(args.title);
112
+ await canvas.findByText(args.description as string);
113
+ await expect(canvas.getByText("Placeholder")).toBeVisible();
114
+ },
115
+ };
116
+
117
+ export const Disabled: Story = {
118
+ args: {
119
+ ...Playground.args,
120
+ isDisabled: true,
121
+ },
122
+ play: async ({ canvasElement, args }) => {
123
+ const canvas = within(canvasElement);
124
+ const user = userEvent.setup();
125
+ await canvas.findByText(args.title);
126
+ await canvas.findByText(args.description as string);
127
+ await expect(canvas.getByText("Placeholder")).not.toBeVisible();
128
+ await user.click(canvas.getByText(args.title));
129
+ await expect(canvas.getByText("Placeholder")).not.toBeVisible();
130
+ },
131
+ };
132
+
133
+ export const Overflow: Story = {
134
+ args: {
135
+ ...Playground.args,
136
+ title:
137
+ "ThisIsAReallyLongTitleThatShouldOverflowBecauseItIsTooLongAndShouldBeBreaked",
138
+ description:
139
+ "ThisIsAReallyLongDescriptionThatShouldOverflowBecauseItIsTooLongAndShouldBeBreaked",
140
+ children:
141
+ "ThisIsAReallyLongChildrenThatShouldOverflowBecauseItIsTooLongAndShouldBeBreaked",
142
+ },
143
+ };
144
+
145
+ export const WithBottomCloseButton: Story = {
146
+ args: {
147
+ ...Playground.args,
148
+ withBottomCloseButton: true,
149
+ defaultExpanded: true,
150
+ },
151
+ };
152
+
153
+ export const WithTitleContentLeftAndRight: Story = {
154
+ args: {
155
+ ...Playground.args,
156
+ titleContentLeft: (
157
+ <>
158
+ <Icon name="help_outline" style={{ fontSize: "24px" }} />
159
+ <Checkbox label="Checkbox" hideLabel />
160
+ </>
161
+ ),
162
+ titleContentRight: <Tag iconLeft="help_outline">I'm a tag!</Tag>,
163
+ },
164
+ play: async ({ canvasElement, args }) => {
165
+ const canvas = within(canvasElement);
166
+ await canvas.findByText(args.title);
167
+ await canvas.findByLabelText("Checkbox");
168
+ await canvas.findByText("I'm a tag!");
169
+ },
170
+ };
171
+ ```
172
+
173
+ ## How to test this component
174
+
175
+ Here are some more advanced stories with more testing coverage and examples that you can read to understand how to test this component.
176
+
177
+ ```tsx
178
+ import { Meta, StoryObj } from "@storybook/react-vite";
179
+ import { expect, userEvent, within } from "storybook/test";
180
+ import Accordion from "../Accordion";
181
+ import * as AccordionStories from "../Accordion.stories";
182
+ import { useState } from "react";
183
+
184
+ const meta: Meta<typeof Accordion> = {
185
+ component: Accordion,
186
+ ...AccordionStories.default,
187
+ parameters: {
188
+ ...AccordionStories.default.parameters,
189
+ chromatic: { disableSnapshot: true },
190
+ },
191
+ };
192
+ export default meta;
193
+
194
+ type Story = StoryObj<typeof meta>;
195
+
196
+ export const UncontrolledExample: Story = {
197
+ render: () => {
198
+ return (
199
+ <Accordion
200
+ title="Accordion uncontrolled"
201
+ description="Accordion description"
202
+ defaultExpanded={false}
203
+ >
204
+ <div>Content</div>
205
+ </Accordion>
206
+ );
207
+ },
208
+ };
209
+
210
+ export const UnmountOnExit: Story = {
211
+ args: {
212
+ ...AccordionStories.Playground.args,
213
+ unmountOnExit: true,
214
+ },
215
+ play: async ({ canvasElement, args }) => {
216
+ const canvas = within(canvasElement);
217
+ const user = userEvent.setup();
218
+ await canvas.findByText(args.title);
219
+ await canvas.findByText(args.description as string);
220
+ await expect(canvas.queryByText("Placeholder")).not.toBeInTheDocument();
221
+ await user.click(canvas.getByText(args.title));
222
+ await expect(canvas.getByText("Placeholder")).toBeVisible();
223
+ await user.click(canvas.getByText(args.title));
224
+ await expect(canvas.queryByText("Placeholder")).not.toBeInTheDocument();
225
+ },
226
+ };
227
+
228
+ export const ShouldCloseWhenClickingOnCloseButton: Story = {
229
+ args: {
230
+ ...AccordionStories.Playground.args,
231
+ unmountOnExit: true,
232
+ withBottomCloseButton: true,
233
+ },
234
+ play: async ({ canvasElement, args }) => {
235
+ const canvas = within(canvasElement);
236
+ const user = userEvent.setup();
237
+ await canvas.findByText(args.title);
238
+ await expect(canvas.queryByText("Placeholder")).not.toBeInTheDocument();
239
+ await user.click(canvas.getByText(args.title));
240
+ await expect(canvas.getByText("Placeholder")).toBeVisible();
241
+ await user.click(canvas.getByText("Close"));
242
+ await expect(canvas.queryByText("Placeholder")).not.toBeInTheDocument();
243
+ await expect(canvas.queryByText("Close")).not.toBeInTheDocument();
244
+ },
245
+ };
246
+
247
+ export const ControlledExample: Story = {
248
+ render: () => {
249
+ const ParentComponent = () => {
250
+ const [isExpanded, setIsExpanded] = useState(false);
251
+
252
+ return (
253
+ <Accordion
254
+ title="Accordion controlled"
255
+ isExpanded={isExpanded}
256
+ onExpandedChange={setIsExpanded}
257
+ withBottomCloseButton
258
+ >
259
+ <div>Content</div>
260
+ </Accordion>
261
+ );
262
+ };
263
+ return <ParentComponent />;
264
+ },
265
+ };
266
+
267
+ export const ControlledExampleTests: Story = {
268
+ render: ControlledExample.render,
269
+ play: async ({ canvasElement }) => {
270
+ const canvas = within(canvasElement);
271
+ const user = userEvent.setup();
272
+ await canvas.findByText("Accordion controlled");
273
+ await expect(canvas.queryByText("Content")).not.toBeVisible();
274
+ await user.click(canvas.getByText("Accordion controlled"));
275
+ await expect(canvas.getByText("Content")).toBeVisible();
276
+ await user.click(canvas.getByText("Accordion controlled"));
277
+ await expect(canvas.queryByText("Content")).not.toBeVisible();
278
+ },
279
+ };
280
+
281
+ export const ControlledExampleShouldCloseWhenClickingOnCloseButton: Story = {
282
+ render: ControlledExample.render,
283
+ play: async ({ canvasElement }) => {
284
+ const canvas = within(canvasElement);
285
+ const user = userEvent.setup();
286
+ await canvas.findByText("Accordion controlled");
287
+ await expect(canvas.queryByText("Content")).not.toBeVisible();
288
+ await user.click(canvas.getByText("Accordion controlled"));
289
+ await expect(canvas.getByText("Content")).toBeVisible();
290
+ await user.click(canvas.getByText("Close"));
291
+ await expect(canvas.queryByText("Content")).not.toBeVisible();
292
+ await expect(canvas.queryByText("Close")).not.toBeInTheDocument();
293
+ },
294
+ };
295
+ ```
296
+
297
+ ## Developer notes
298
+
299
+ 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.
300
+
301
+ ```mdx
302
+ import {
303
+ Source,
304
+ Stories,
305
+ Meta,
306
+ Canvas,
307
+ Controls,
308
+ } from "@storybook/addon-docs/blocks";
309
+ import * as AccordionStoriesTests from "./tests/Accordion.stories";
310
+ import * as AccordionStories from "./Accordion.stories";
311
+
312
+ <Meta of={AccordionStories} />
313
+
314
+ # Accordion
315
+
316
+ <Canvas of={AccordionStories.Playground} />
317
+ <Controls of={AccordionStories.Playground} />
318
+
319
+ Accordions can be built with the `<details>` and `<summary>` HTML elements, but this can be difficult to style.
320
+ Accordion component helps achieve accessible Accordions implemented with the correct ARIA pattern while making custom styling easy and the Design System styles.
321
+
322
+ - **Flexible** - Structured such that it can be used standalone or combined with other Accordions to form a AccordionGroup.
323
+ - **Keyboard Interaction** - When focused, an Accordion's visibility can be toggled with either the Enter or Space key, and the appropriate ARIA attributes are automatically applied.
324
+ - **Accessible** - Uses hidden="until-found" in supported browsers, enabling find-in-page search support and improved search engine visibility for collapsed content
325
+
326
+ ## Example usage
327
+
328
+ There are two ways to use the Accordion component:
329
+
330
+ - **Uncontrolled** - The Accordion is expanded or collapsed based on the `defaultExpanded` prop and internally managed by the component on click.
331
+ - **Controlled** - The Accordion is expanded or collapsed based on the `isExpanded` prop and the `onExpandedChange` prop.
332
+
333
+ Here is an example of an **uncontrolled Accordion**:
334
+
335
+ <Source of={AccordionStoriesTests.UncontrolledExample} type="code" dark />
336
+
337
+ Here is an example of a **controlled Accordion**:
338
+
339
+ <Source of={AccordionStoriesTests.ControlledExample} type="code" dark />
340
+
341
+ <Stories />
342
+ ```
@@ -0,0 +1,192 @@
1
+ # Badge
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/Badge/Badge.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 Badge from "./Badge";
18
+ import { within, expect } from "storybook/test";
19
+
20
+ const meta: Meta<typeof Badge> = {
21
+ component: Badge,
22
+ tags: ["autodocs"],
23
+ parameters: {
24
+ layout: "centered",
25
+ },
26
+ };
27
+ export default meta;
28
+
29
+ export const Default: StoryObj<typeof Badge> = {
30
+ args: {
31
+ value: 9,
32
+ nature: "default",
33
+ max: undefined,
34
+ },
35
+ play: async ({ canvasElement, args }) => {
36
+ const canvas = within(canvasElement);
37
+ await canvas.findByText(String(args.value));
38
+ },
39
+ };
40
+
41
+ export const Informative: StoryObj<typeof Badge> = {
42
+ args: {
43
+ ...Default.args,
44
+ nature: "informative",
45
+ },
46
+ };
47
+
48
+ export const Negative: StoryObj<typeof Badge> = {
49
+ args: {
50
+ ...Default.args,
51
+ nature: "negative",
52
+ },
53
+ };
54
+
55
+ export const Positive: StoryObj<typeof Badge> = {
56
+ args: {
57
+ ...Default.args,
58
+ nature: "positive",
59
+ },
60
+ };
61
+
62
+ export const Warning: StoryObj<typeof Badge> = {
63
+ args: {
64
+ ...Default.args,
65
+ nature: "warning",
66
+ },
67
+ };
68
+
69
+ export const LargeNumber: StoryObj<typeof Badge> = {
70
+ args: {
71
+ ...Negative.args,
72
+ value: 999,
73
+ },
74
+ };
75
+
76
+ export const WithMax: StoryObj<typeof Badge> = {
77
+ args: {
78
+ ...Negative.args,
79
+ value: 100,
80
+ max: 99,
81
+ },
82
+ };
83
+
84
+ export const Dot: StoryObj<typeof Badge> = {
85
+ globals: {
86
+ backgrounds: { value: "dark" },
87
+ },
88
+ args: {
89
+ ...Negative.args,
90
+ variant: "dot",
91
+ },
92
+ play: async ({ canvasElement }) => {
93
+ await expect(canvasElement).not.toBeEmptyDOMElement();
94
+ await expect(canvasElement.firstElementChild).toHaveTextContent("");
95
+ await expect(canvasElement.firstElementChild).toHaveAttribute(
96
+ "data-variant",
97
+ "dot",
98
+ );
99
+ },
100
+ };
101
+
102
+ export const WithString: StoryObj<typeof Badge> = {
103
+ args: {
104
+ ...Default.args,
105
+ value: "+3",
106
+ },
107
+ };
108
+ ```
109
+
110
+ ## How to test this component
111
+
112
+ Here are some more advanced stories with more testing coverage and examples that you can read to understand how to test this component.
113
+
114
+ ```tsx
115
+ import { Meta, StoryObj } from "@storybook/react-vite";
116
+ import Badge from "../Badge";
117
+ import { expect } from "storybook/test";
118
+ import { Negative, Default } from "../Badge.stories";
119
+
120
+ const meta: Meta<typeof Badge> = {
121
+ component: Badge,
122
+ parameters: {
123
+ layout: "centered",
124
+ chromatic: { disableSnapshot: true },
125
+ },
126
+ };
127
+ export default meta;
128
+
129
+ export const TestNoValueNoValueShouldRenderNothing: StoryObj<typeof Badge> = {
130
+ args: {
131
+ ...Negative.args,
132
+ value: undefined,
133
+ },
134
+ play: async ({ canvasElement }) => {
135
+ await expect(canvasElement).toBeEmptyDOMElement();
136
+ },
137
+ };
138
+
139
+ export const TestZeroValueShouldRenderNothing: StoryObj<typeof Badge> = {
140
+ args: {
141
+ ...Default.args,
142
+ value: 0,
143
+ },
144
+ play: async ({ canvasElement }) => {
145
+ await expect(canvasElement).toBeEmptyDOMElement();
146
+ },
147
+ };
148
+
149
+ export const TestShowZero: StoryObj<typeof Badge> = {
150
+ args: {
151
+ ...Default.args,
152
+ value: 0,
153
+ showZero: true,
154
+ },
155
+ play: async ({ canvasElement }) => {
156
+ await expect(canvasElement).toHaveTextContent("0");
157
+ },
158
+ };
159
+
160
+ export const TestInvisible: StoryObj<typeof Badge> = {
161
+ args: {
162
+ ...Default.args,
163
+ invisible: true,
164
+ },
165
+ play: async ({ canvasElement }) => {
166
+ await expect(canvasElement).toHaveTextContent("9");
167
+ await expect(canvasElement.firstElementChild).not.toBeVisible();
168
+ },
169
+ };
170
+
171
+ export const TestMaxUnder: StoryObj<typeof Badge> = {
172
+ args: {
173
+ ...Default.args,
174
+ value: 98,
175
+ max: 99,
176
+ },
177
+ play: async ({ canvasElement }) => {
178
+ await expect(canvasElement).toHaveTextContent("98");
179
+ },
180
+ };
181
+
182
+ export const TestMaxAbove: StoryObj<typeof Badge> = {
183
+ args: {
184
+ ...Default.args,
185
+ value: 100,
186
+ max: 99,
187
+ },
188
+ play: async ({ canvasElement }) => {
189
+ await expect(canvasElement).toHaveTextContent("99");
190
+ },
191
+ };
192
+ ```