@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,227 @@
1
+ # Pagination
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/Pagination/Pagination.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 Pagination from "./Pagination";
18
+ import { within, expect, fn } from "storybook/test";
19
+ import { I18nProvider } from "react-aria-components";
20
+ import { STORYBOOK_VIEWPORTS } from "@internal/test-utils-storybook/test-utils-storybook";
21
+
22
+ const meta: Meta<typeof Pagination> = {
23
+ component: Pagination,
24
+ tags: ["autodocs"],
25
+ argTypes: {
26
+ itemsPerPageOptions: { control: false },
27
+ itemsPerPage: { control: false },
28
+ },
29
+ decorators: [
30
+ (Story) => (
31
+ <I18nProvider locale="en-US">
32
+ <Story />
33
+ </I18nProvider>
34
+ ),
35
+ ],
36
+ };
37
+ export default meta;
38
+
39
+ export const Playground: StoryObj<typeof Pagination> = {
40
+ args: {
41
+ count: 345,
42
+ pageIndex: 0,
43
+ onPageChange: fn(),
44
+ onItemsPerPageChange: fn(),
45
+ },
46
+ play: async ({ canvasElement }) => {
47
+ const canvas = within(canvasElement);
48
+ await canvas.findByText("Item per page");
49
+ await expect(
50
+ canvas.getByTestId("table-pagination-items-range"),
51
+ ).toHaveTextContent("1 - 10 of 345 items");
52
+ await expect(
53
+ canvas.getByTestId("table-pagination-pages-range"),
54
+ ).toHaveTextContent("Of 35 pages");
55
+ },
56
+ };
57
+
58
+ export const EmptyTable: StoryObj<typeof Pagination> = {
59
+ args: {
60
+ ...Playground.args,
61
+ count: 0,
62
+ },
63
+ play: async ({ canvasElement }) => {
64
+ const canvas = within(canvasElement);
65
+ await canvas.findByText("Item per page");
66
+ await expect(
67
+ canvas.getByTestId("table-pagination-items-range"),
68
+ ).toHaveTextContent("1 - 0 of 0 items");
69
+ await expect(canvas.getByLabelText("Go to first page")).toBeDisabled();
70
+ await expect(canvas.getByLabelText("Go to previous page")).toBeDisabled();
71
+ await expect(canvas.getByLabelText("Go to next page")).toBeDisabled();
72
+ await expect(canvas.getByLabelText("Go to last page")).toBeDisabled();
73
+ },
74
+ };
75
+
76
+ export const FrenchTranslation: StoryObj<typeof Pagination> = {
77
+ args: {
78
+ ...Playground.args,
79
+ },
80
+ decorators: [
81
+ (Story) => (
82
+ <I18nProvider locale="fr-FR">
83
+ <Story />
84
+ </I18nProvider>
85
+ ),
86
+ ],
87
+ };
88
+
89
+ export const Mobile: StoryObj<typeof Pagination> = {
90
+ parameters: {
91
+ ...STORYBOOK_VIEWPORTS,
92
+ layout: "none",
93
+ },
94
+ globals: {
95
+ viewport: { value: "iphone6", isRotated: false },
96
+ },
97
+ args: {
98
+ ...Playground.args,
99
+ },
100
+ };
101
+ ```
102
+
103
+ ## How to test this component
104
+
105
+ Here are some more advanced stories with more testing coverage and examples that you can read to understand how to test this component.
106
+
107
+ ```tsx
108
+ import { Meta, StoryObj } from "@storybook/react-vite";
109
+ import Pagination from "../Pagination";
110
+ import { userEvent, within, screen, expect } from "storybook/test";
111
+ import { expectPresent } from "@internal/test-utils-storybook/test-utils-storybook";
112
+ import * as PaginationStories from "../Pagination.stories";
113
+
114
+ const meta: Meta<typeof Pagination> = {
115
+ ...PaginationStories.default,
116
+ component: Pagination,
117
+ parameters: {
118
+ chromatic: { disableSnapshot: true },
119
+ },
120
+ };
121
+ export default meta;
122
+
123
+ export const TestAbove10Items: StoryObj<typeof Pagination> = {
124
+ args: {
125
+ ...PaginationStories.Playground.args,
126
+ count: 5,
127
+ },
128
+ play: async ({ canvasElement }) => {
129
+ const canvas = within(canvasElement);
130
+ await canvas.findByText("Item per page");
131
+ await expect(
132
+ canvas.getByTestId("table-pagination-items-range"),
133
+ ).toHaveTextContent("1 - 5 of 5 items");
134
+ },
135
+ };
136
+
137
+ export const TestShouldChangeTheNumberOfItemsPerPage: StoryObj<
138
+ typeof Pagination
139
+ > = {
140
+ args: {
141
+ ...PaginationStories.Playground.args,
142
+ },
143
+ play: async ({ canvasElement, args }) => {
144
+ const canvas = within(canvasElement);
145
+ const user = userEvent.setup({ delay: 50 });
146
+ await user.click(
147
+ canvas.getByLabelText("Select the number of items per page"),
148
+ );
149
+ await expectPresent(() => screen.getByText("20", { selector: "span" }));
150
+ await user.click(screen.getByText("20", { selector: "span" }));
151
+ await expect(args.onItemsPerPageChange).toHaveBeenCalledTimes(1);
152
+ await expect(args.onItemsPerPageChange).toHaveBeenCalledWith(20);
153
+ },
154
+ };
155
+
156
+ export const TestShouldChangeTheSelectedPage: StoryObj<typeof Pagination> = {
157
+ args: {
158
+ ...PaginationStories.Playground.args,
159
+ },
160
+ play: async ({ canvasElement, args }) => {
161
+ const canvas = within(canvasElement);
162
+ const user = userEvent.setup({ delay: 50 });
163
+ await user.click(canvas.getByLabelText("Select page to display"));
164
+ await expectPresent(() => screen.getByText("4", { selector: "span" }));
165
+ await user.click(screen.getByText("4", { selector: "span" }));
166
+ await expect(args.onPageChange).toHaveBeenCalledTimes(1);
167
+ await expect(args.onPageChange).toHaveBeenCalledWith(3);
168
+ },
169
+ };
170
+
171
+ export const TestShouldNavigateUsingTheArrows: StoryObj<typeof Pagination> = {
172
+ args: {
173
+ ...PaginationStories.Playground.args,
174
+ pageIndex: 3,
175
+ },
176
+ play: async ({ canvasElement, args }) => {
177
+ const canvas = within(canvasElement);
178
+ const user = userEvent.setup({ delay: 50 });
179
+ await user.click(canvas.getByLabelText("Go to first page"));
180
+ await expect(args.onPageChange).toHaveBeenLastCalledWith(0);
181
+ await user.click(canvas.getByLabelText("Go to previous page"));
182
+ await expect(args.onPageChange).toHaveBeenLastCalledWith(2);
183
+ await user.click(canvas.getByLabelText("Go to next page"));
184
+ await expect(args.onPageChange).toHaveBeenLastCalledWith(4);
185
+ await user.click(canvas.getByLabelText("Go to last page"));
186
+ await expect(args.onPageChange).toHaveBeenLastCalledWith(34);
187
+ },
188
+ };
189
+
190
+ export const TestShouldDisablePreviousButtonsOnFirstPage: StoryObj<
191
+ typeof Pagination
192
+ > = {
193
+ args: {
194
+ ...PaginationStories.Playground.args,
195
+ pageIndex: 0,
196
+ },
197
+ play: async ({ canvasElement, args }) => {
198
+ const canvas = within(canvasElement);
199
+ const user = userEvent.setup({ delay: 50 });
200
+ await expect(canvas.getByLabelText("Go to first page")).toBeDisabled();
201
+ await user.click(canvas.getByLabelText("Go to first page"));
202
+ await expect(args.onPageChange).toHaveBeenCalledTimes(0);
203
+ await expect(canvas.getByLabelText("Go to previous page")).toBeDisabled();
204
+ await user.click(canvas.getByLabelText("Go to previous page"));
205
+ await expect(args.onPageChange).toHaveBeenCalledTimes(0);
206
+ },
207
+ };
208
+
209
+ export const TestShouldDisableNextButtonsOnLastPage: StoryObj<
210
+ typeof Pagination
211
+ > = {
212
+ args: {
213
+ ...PaginationStories.Playground.args,
214
+ pageIndex: 34,
215
+ },
216
+ play: async ({ canvasElement, args }) => {
217
+ const canvas = within(canvasElement);
218
+ const user = userEvent.setup({ delay: 50 });
219
+ await expect(canvas.getByLabelText("Go to last page")).toBeDisabled();
220
+ await user.click(canvas.getByLabelText("Go to last page"));
221
+ await expect(args.onPageChange).toHaveBeenCalledTimes(0);
222
+ await expect(canvas.getByLabelText("Go to next page")).toBeDisabled();
223
+ await user.click(canvas.getByLabelText("Go to next page"));
224
+ await expect(args.onPageChange).toHaveBeenCalledTimes(0);
225
+ },
226
+ };
227
+ ```
@@ -0,0 +1,245 @@
1
+ # Popover
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/Popover/Popover.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 Popover, { PopoverTrigger, Props } from "./Popover";
18
+ import Button from "../Button/Button";
19
+ import { useState } from "react";
20
+ import { expect, within } from "storybook/test";
21
+ import Link from "../Link/Link";
22
+
23
+ const meta: Meta<typeof Popover> = {
24
+ component: Popover,
25
+ parameters: {
26
+ layout: "centered",
27
+ },
28
+ argTypes: {
29
+ trigger: { control: false },
30
+ children: { control: false },
31
+ },
32
+ };
33
+ export default meta;
34
+
35
+ type Story = StoryObj<typeof meta>;
36
+
37
+ export const Playground: Story = {
38
+ args: {
39
+ children: (
40
+ <div
41
+ style={{
42
+ display: "flex",
43
+ flexDirection: "column",
44
+ alignItems: "flex-start",
45
+ gap: "var(--spacing-sm)",
46
+ maxWidth: "248px",
47
+ }}
48
+ >
49
+ <div>
50
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. In mattis dui
51
+ a urna hendrerit efficitur.
52
+ </div>
53
+ <Link href="https://www.google.com" showLinkIcon>
54
+ Label link
55
+ </Link>
56
+ </div>
57
+ ),
58
+ title: "Insert title",
59
+ trigger: <Button iconLeft="add" mode="secondary" />,
60
+ },
61
+ };
62
+
63
+ export const Open: Story = {
64
+ args: {
65
+ ...Playground.args,
66
+ defaultOpen: true,
67
+ },
68
+ play: async ({ canvasElement }) => {
69
+ const canvas = within(canvasElement.ownerDocument.body);
70
+ await canvas.findByText("Insert title");
71
+ await canvas.findByText(
72
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In mattis dui a urna hendrerit efficitur.",
73
+ );
74
+ await canvas.findByText("Label link");
75
+ },
76
+ };
77
+
78
+ export const WithPopoverTrigger: Story = {
79
+ args: {
80
+ ...Open.args,
81
+ trigger: (
82
+ <PopoverTrigger
83
+ triggerButtonProps={{
84
+ "data-testid": "popover-trigger-button",
85
+ "data-example": "custom-value",
86
+ }}
87
+ >
88
+ Click me
89
+ </PopoverTrigger>
90
+ ),
91
+ },
92
+ play: async ({ canvasElement }) => {
93
+ const canvas = within(canvasElement.ownerDocument.body);
94
+ await canvas.findByText("Insert title");
95
+ await canvas.findByText(
96
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In mattis dui a urna hendrerit efficitur.",
97
+ );
98
+ await canvas.findByText("Label link");
99
+ const triggerButton = canvasElement.querySelector(
100
+ "[data-testid='popover-trigger-button']",
101
+ );
102
+ expect(triggerButton).toBeInTheDocument();
103
+ expect(triggerButton).toHaveAttribute(
104
+ "data-testid",
105
+ "popover-trigger-button",
106
+ );
107
+ expect(triggerButton).toHaveAttribute("data-example", "custom-value");
108
+ },
109
+ };
110
+
111
+ export const HideArrow: Story = {
112
+ args: {
113
+ ...Open.args,
114
+ hideArrow: true,
115
+ },
116
+ };
117
+
118
+ export const HideCloseButton: Story = {
119
+ args: {
120
+ ...Open.args,
121
+ hideCloseButton: true,
122
+ },
123
+ };
124
+
125
+ export const MinimalContent: Story = {
126
+ args: {
127
+ ...Open.args,
128
+ title: undefined,
129
+ hideCloseButton: true,
130
+ children: "Some informations",
131
+ },
132
+ };
133
+
134
+ export const AllPlacements: Story = {
135
+ render: () => {
136
+ return (
137
+ <div
138
+ style={{ display: "flex", gap: 180, flexWrap: "wrap", padding: 100 }}
139
+ >
140
+ {[
141
+ "top left",
142
+ "top center",
143
+ "top right",
144
+ "right top",
145
+ "right center",
146
+ "right bottom",
147
+ "bottom right",
148
+ "bottom center",
149
+ "bottom left",
150
+ "left top",
151
+ "left center",
152
+ "left bottom",
153
+ ].map((placement) => (
154
+ <Popover
155
+ key={placement}
156
+ isOpen
157
+ placement={placement as Props["placement"]}
158
+ trigger={<Button iconLeft="add" mode="secondary" />}
159
+ hideCloseButton
160
+ >
161
+ <div>{placement}</div>
162
+ </Popover>
163
+ ))}
164
+ </div>
165
+ );
166
+ },
167
+ };
168
+
169
+ export const Controlled: Story = {
170
+ parameters: {
171
+ chromatic: { disableSnapshot: true },
172
+ },
173
+ render: () => {
174
+ const ParentComponent = () => {
175
+ const [isOpen, setIsOpen] = useState(false);
176
+ return (
177
+ <Popover
178
+ isOpen={isOpen}
179
+ onOpenChange={setIsOpen}
180
+ trigger={<Button iconLeft="add" mode="secondary" />}
181
+ title="Controlled popover"
182
+ >
183
+ <div>Hello, I'm a controlled popover</div>
184
+ </Popover>
185
+ );
186
+ };
187
+ return <ParentComponent />;
188
+ },
189
+ };
190
+ ```
191
+
192
+ ## Developer notes
193
+
194
+ 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.
195
+
196
+ ```mdx
197
+ import {
198
+ Canvas,
199
+ Meta,
200
+ Stories,
201
+ Controls,
202
+ Source,
203
+ } from "@storybook/addon-docs/blocks";
204
+
205
+ import * as Popover from "./Popover.stories";
206
+
207
+ <Meta of={Popover} />
208
+
209
+ # Popover
210
+
211
+ <Canvas of={Popover.Playground} />
212
+
213
+ <Controls of={Popover.Playground} />
214
+
215
+ A popover is an overlay element positioned relative to a trigger.
216
+
217
+ There is no built in way to create popovers in HTML. Popover helps achieve accessible popovers that can be styled as needed.
218
+
219
+ - **Accessible** – The trigger and popover are automatically associated semantically via ARIA. Content outside the popover is hidden from assistive technologies while it is open. The popover closes when interacting outside, or pressing the Escape key.
220
+ - **Focus management** – Focus is moved into the popover on mount, and restored to the trigger element on unmount.
221
+ - **Positioning** – The popover is positioned relative to the trigger element, and automatically flips and adjusts to avoid overlapping with the edge of the browser window.
222
+
223
+ ## Usage with a Button
224
+
225
+ The most common use case is to use a Button as the trigger element.
226
+
227
+ <Canvas of={Popover.Playground} />
228
+
229
+ ## Usage with `PopoverTrigger`
230
+
231
+ In the case where you don't want to use a Button as the trigger element, you can use `PopoverTrigger` to wrap your component.
232
+
233
+ Please not that you cannot pass a Button (or other interactive component) as `children` of `PopoverTrigger`.
234
+ This is because the `PopoverTrigger` itself is an unstyled Button that serves as a trigger for the Popover to show.
235
+
236
+ <Canvas of={Popover.WithPopoverTrigger} />
237
+
238
+ ## Controlled / Uncontrolled mode
239
+
240
+ The open state of the Popover can be controlled via the `defaultOpen` (uncontrolled mode) and `isOpen` (controlled mode) props.
241
+
242
+ Below is an example of how to use the "controlled" mode.
243
+
244
+ <Canvas of={Popover.Controlled} />
245
+ ```