@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,332 @@
1
+ # Breadcrumbs
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/Breadcrumbs/Breadcrumbs.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, expect } from "storybook/test";
18
+ import { I18nProvider } from "react-aria-components";
19
+
20
+ import Component from "./Breadcrumbs";
21
+
22
+ const meta: Meta<typeof Component> = {
23
+ component: Component,
24
+ parameters: {
25
+ layout: "centered",
26
+ },
27
+ decorators: [
28
+ (story) => <I18nProvider locale="en-EN">{story()}</I18nProvider>,
29
+ ],
30
+ };
31
+ export default meta;
32
+
33
+ const generateLinks = (howMany: number) =>
34
+ Array.from({ length: howMany }, (_, i) => ({
35
+ href: `/${i + 1}`,
36
+ text: i === 0 ? "Home" : `Page ${i + 1}`,
37
+ }));
38
+
39
+ export const OneItem: StoryObj<typeof Component> = {
40
+ args: {
41
+ links: generateLinks(1),
42
+ },
43
+ play: async ({ canvasElement }) => {
44
+ await expect(canvasElement).toBeEmptyDOMElement();
45
+ },
46
+ };
47
+
48
+ export const TwoItems: StoryObj<typeof Component> = {
49
+ args: {
50
+ links: [
51
+ { href: "/", text: "Home" },
52
+ { href: "", text: "Page 2" }, // Simulate case when devs don't provide an href
53
+ ],
54
+ },
55
+ play: async ({ canvasElement }) => {
56
+ const canvas = within(canvasElement);
57
+ await canvas.findByText("Home");
58
+ await expect(canvas.getByText("Home")).toHaveAttribute("href", "/");
59
+ await expect(canvas.getByText("Home")).not.toHaveAttribute(
60
+ "aria-current",
61
+ "page",
62
+ );
63
+ await expect(canvas.getByText("Page 2")).not.toHaveAttribute("href");
64
+ await expect(canvas.getByText("Page 2")).toHaveAttribute(
65
+ "aria-current",
66
+ "page",
67
+ );
68
+ },
69
+ };
70
+
71
+ export const ThreeItems: StoryObj<typeof Component> = {
72
+ args: {
73
+ links: generateLinks(3),
74
+ },
75
+ play: async ({ canvasElement }) => {
76
+ const canvas = within(canvasElement);
77
+ await canvas.findByText("Home");
78
+ await expect(canvas.getByText("Home")).toHaveAttribute("href", "/1");
79
+ await expect(canvas.getByText("Home")).not.toHaveAttribute(
80
+ "aria-current",
81
+ "page",
82
+ );
83
+ await expect(canvas.getByText("Page 2")).toHaveAttribute("href", "/2");
84
+ await expect(canvas.getByText("Page 2")).not.toHaveAttribute(
85
+ "aria-current",
86
+ "page",
87
+ );
88
+ await expect(canvas.getByText("Page 3")).toHaveAttribute("href", "/3");
89
+ await expect(canvas.getByText("Page 3")).toHaveAttribute(
90
+ "aria-current",
91
+ "page",
92
+ );
93
+ },
94
+ };
95
+
96
+ export const FourItems: StoryObj<typeof Component> = {
97
+ args: {
98
+ links: generateLinks(4),
99
+ },
100
+ play: async ({ canvasElement }) => {
101
+ const canvas = within(canvasElement);
102
+ await canvas.findByText("Home");
103
+ await expect(canvas.getByText("Home")).toHaveAttribute("href", "/1");
104
+ await expect(canvas.getByText("Home")).not.toHaveAttribute(
105
+ "aria-current",
106
+ "page",
107
+ );
108
+ await expect(canvas.getByText("Page 2")).toHaveAttribute("href", "/2");
109
+ await expect(canvas.getByText("Page 2")).not.toHaveAttribute(
110
+ "aria-current",
111
+ "page",
112
+ );
113
+ await expect(canvas.getByText("Page 3")).toHaveAttribute("href", "/3");
114
+ await expect(canvas.getByText("Page 3")).not.toHaveAttribute(
115
+ "aria-current",
116
+ "page",
117
+ );
118
+ await expect(canvas.getByText("Page 4")).toHaveAttribute("href", "/4");
119
+ await expect(canvas.getByText("Page 4")).toHaveAttribute(
120
+ "aria-current",
121
+ "page",
122
+ );
123
+ },
124
+ };
125
+
126
+ export const FiveItems: StoryObj<typeof Component> = {
127
+ args: {
128
+ links: generateLinks(5),
129
+ },
130
+ };
131
+ ```
132
+
133
+ ## How to test this component
134
+
135
+ Here are some more advanced stories with more testing coverage and examples that you can read to understand how to test this component.
136
+
137
+ ```tsx
138
+ import { Meta, StoryObj } from "@storybook/react-vite";
139
+ import { userEvent, within, expect, screen } from "storybook/test";
140
+ import { Route, Routes } from "react-router-dom";
141
+ import { I18nProvider } from "react-aria";
142
+
143
+ import { expectNotPresent } from "@internal/test-utils-storybook/test-utils-storybook";
144
+ import { FiveItems } from "../Breadcrumbs.stories";
145
+ import Breadcrumbs from "../Breadcrumbs";
146
+
147
+ const meta: Meta<typeof Breadcrumbs> = {
148
+ component: Breadcrumbs,
149
+ parameters: {
150
+ layout: "centered",
151
+ chromatic: { disableSnapshot: true },
152
+ },
153
+ decorators: [
154
+ (story) => <I18nProvider locale="en-EN">{story()}</I18nProvider>,
155
+ ],
156
+ };
157
+ export default meta;
158
+
159
+ export const ShouldOpenTheItems: StoryObj<typeof Breadcrumbs> = {
160
+ args: {
161
+ ...FiveItems.args,
162
+ },
163
+ play: async ({ canvasElement }) => {
164
+ const canvas = within(canvasElement);
165
+ const user = userEvent.setup({ delay: 50 });
166
+
167
+ const dropdownLinkIsNotPresent = async (text: string) =>
168
+ expectNotPresent(() => canvas.queryByText(text, { selector: "span" }));
169
+
170
+ const getDropdownLink = (text: string) =>
171
+ screen.getByText(text, { selector: "span" }).closest("a");
172
+
173
+ // Test closed state
174
+ await canvas.findByText("Home");
175
+ await expect(canvas.getByText("Home")).toHaveAttribute("href", "/1");
176
+ await expect(canvas.getByText("Home")).not.toHaveAttribute(
177
+ "aria-current",
178
+ "page",
179
+ );
180
+ await expect(canvas.getByText("Page 5")).toHaveAttribute("href", "/5");
181
+ await expect(canvas.getByText("Page 5")).toHaveAttribute(
182
+ "aria-current",
183
+ "page",
184
+ );
185
+ await dropdownLinkIsNotPresent("Page 2");
186
+ await dropdownLinkIsNotPresent("Page 3");
187
+ await dropdownLinkIsNotPresent("Page 4");
188
+
189
+ // Test open state
190
+ await user.click(canvas.getByLabelText("Show more"));
191
+ await canvas.findByText("Page 2");
192
+ await expect(getDropdownLink("Page 2")).toHaveAttribute("href", "/2");
193
+ await expect(getDropdownLink("Page 3")).toHaveAttribute("href", "/3");
194
+ await expect(getDropdownLink("Page 4")).toHaveAttribute("href", "/4");
195
+ },
196
+ };
197
+
198
+ export const ShouldWorkWithReactRouter: StoryObj<typeof Breadcrumbs> = {
199
+ render: () => {
200
+ const Demo = () => {
201
+ return (
202
+ <>
203
+ <Breadcrumbs
204
+ links={[
205
+ { href: "/page-1", text: "Home" },
206
+ { href: "/page-2", text: "Page 2" },
207
+ { href: "/page-3", text: "Page 3" },
208
+ ]}
209
+ />
210
+
211
+ <Routes>
212
+ <Route path="/page-1" element={<div>Content page 1</div>} />
213
+ <Route path="/page-2" element={<div>Content page 2</div>} />
214
+ <Route path="/page-3" element={<div>Content page 3</div>} />
215
+ </Routes>
216
+ </>
217
+ );
218
+ };
219
+
220
+ const Pages = () => <Demo />;
221
+
222
+ return <Pages />;
223
+ },
224
+ play: async ({ canvasElement }) => {
225
+ const canvas = within(canvasElement);
226
+ const user = userEvent.setup({ delay: 50 });
227
+ await canvas.findByText("Home");
228
+ await expect(canvas.getByText("Home")).toHaveAttribute("href", "/page-1");
229
+ await expect(canvas.getByText("Page 2")).toHaveAttribute("href", "/page-2");
230
+ await expect(canvas.getByText("Page 3")).toHaveAttribute("href", "/page-3");
231
+ await expectNotPresent(() => canvas.queryByText("Content page 1"));
232
+ await expectNotPresent(() => canvas.queryByText("Content page 2"));
233
+ await expectNotPresent(() => canvas.queryByText("Content page 3"));
234
+
235
+ await user.click(canvas.getByText("Home"));
236
+ await expect(canvas.getByText("Content page 1")).toBeInTheDocument();
237
+ await expectNotPresent(() => canvas.queryByText("Content page 2"));
238
+ await expectNotPresent(() => canvas.queryByText("Content page 3"));
239
+
240
+ await user.click(canvas.getByText("Page 2"));
241
+ await expect(canvas.getByText("Content page 2")).toBeInTheDocument();
242
+ await expectNotPresent(() => canvas.queryByText("Content page 1"));
243
+ await expectNotPresent(() => canvas.queryByText("Content page 3"));
244
+ },
245
+ };
246
+
247
+ export const ShouldFallbackToHomeForTheFirstLink: StoryObj<typeof Breadcrumbs> =
248
+ {
249
+ args: {
250
+ ...FiveItems.args,
251
+ links: [
252
+ { href: "/page-1", text: "" },
253
+ { href: "/page-2", text: "Page 2" },
254
+ { href: "/page-3", text: "Page 3" },
255
+ ],
256
+ },
257
+ play: async ({ canvasElement }) => {
258
+ const canvas = within(canvasElement);
259
+ await canvas.findByText("Home");
260
+ await expect(canvas.getByText("Home")).toHaveAttribute("href", "/page-1");
261
+ await expect(canvas.getByText("Page 2")).toHaveAttribute(
262
+ "href",
263
+ "/page-2",
264
+ );
265
+ await expect(canvas.getByText("Page 3")).toHaveAttribute(
266
+ "href",
267
+ "/page-3",
268
+ );
269
+ },
270
+ };
271
+
272
+ export const ExampleWithRouterOptions: StoryObj<typeof Breadcrumbs> = {
273
+ render: () => {
274
+ return (
275
+ <Breadcrumbs
276
+ links={[
277
+ { href: "/page-1", text: "Home", routerOptions: { replace: true } },
278
+ { href: "/page-2", text: "Page 2", routerOptions: { replace: true } },
279
+ ]}
280
+ />
281
+ );
282
+ },
283
+ };
284
+ ```
285
+
286
+ ## Developer notes
287
+
288
+ 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.
289
+
290
+ ```mdx
291
+ import {
292
+ Canvas,
293
+ Meta,
294
+ Stories,
295
+ Controls,
296
+ Source,
297
+ } from "@storybook/addon-docs/blocks";
298
+
299
+ import * as Breadcrumbs from "./Breadcrumbs.stories";
300
+ import * as BreadcrumbsTests from "./tests/Breadcrumbs.stories";
301
+
302
+ <Meta of={Breadcrumbs} />
303
+
304
+ # Breadcrumbs
305
+
306
+ <Canvas of={Breadcrumbs.FourItems} />
307
+
308
+ ## Breadcrumbs props
309
+
310
+ <Controls of={Breadcrumbs.FourItems} />
311
+
312
+ ## `links` prop
313
+
314
+ Its an array of objects that represents the props passed directly to the underlying Link component from React Aria.
315
+
316
+ Most of the time, you'll just need to pass an `href` and a `children` for the text (like in the example above).
317
+
318
+ But if you need more control over the rendered links, [here are the actual props available in the React Aria docs](https://react-spectrum.adobe.com/react-aria/Link.html#props).
319
+
320
+ ## Integration with framework routers
321
+
322
+ It is possible to make this `Breadcrumbs` component work seamlessly with your router (like `react-router-dom`) and thus benefit from client-side routing.
323
+
324
+ The first requirement is to have the [RouterProvider](?path=/docs/components-routerprovider--docs) configured in your project.
325
+
326
+ And that's it! With this provider, any link in the `Breadcrumbs` component will behave like your framework-specific link.
327
+ You can even pass router-specific props with the `routerOptions` prop, like:
328
+
329
+ <Source of={BreadcrumbsTests.ExampleWithRouterOptions} type="code" dark />
330
+
331
+ <Stories />
332
+ ```