@maxio-com/react-ui-components 9.32.0 → 9.34.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/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/skills/maxio-react/SKILL.md +1 -0
- package/dist/skills/maxio-react/references/components-action-menu.md +9 -1
- package/dist/skills/maxio-react/references/components-avatar.md +1 -0
- package/dist/skills/maxio-react/references/components-calendar.md +2 -1
- package/dist/skills/maxio-react/references/components-copy-to-clipboard.md +1 -1
- package/dist/skills/maxio-react/references/components-data-table.md +9 -2
- package/dist/skills/maxio-react/references/components-dialog.md +1 -0
- package/dist/skills/maxio-react/references/components-drawer.md +146 -67
- package/dist/skills/maxio-react/references/components-flex.md +4 -4
- package/dist/skills/maxio-react/references/components-forms-datefield.md +2 -1
- package/dist/skills/maxio-react/references/components-forms-datepicker.md +2 -1
- package/dist/skills/maxio-react/references/components-forms-daterangepicker.md +2 -1
- package/dist/skills/maxio-react/references/components-grid.md +11 -11
- package/dist/skills/maxio-react/references/components-icon.md +1 -0
- package/dist/skills/maxio-react/references/components-loading-spinner.md +1 -0
- package/dist/skills/maxio-react/references/components-logo.md +1 -0
- package/dist/skills/maxio-react/references/components-notifications-alert.md +6 -0
- package/dist/skills/maxio-react/references/components-notifications-banner.md +6 -0
- package/dist/skills/maxio-react/references/components-notifications-toast.md +6 -0
- package/dist/skills/maxio-react/references/components-pagination.md +6 -0
- package/dist/skills/maxio-react/references/components-progressbar.md +2 -1
- package/dist/skills/maxio-react/references/components-rangecalendar.md +2 -1
- package/dist/skills/maxio-react/references/components-tabs.md +7 -0
- package/dist/skills/maxio-react/references/components-tag.md +1 -0
- package/dist/skills/maxio-react/references/components-tile.md +1 -0
- package/dist/skills/maxio-react/references/components-toggle.md +7 -1
- package/dist/skills/maxio-react/references/components-tooltip.md +8 -1
- package/dist/skills/maxio-react/references/foundations-testing.md +191 -0
- package/dist/skills/maxio-react/references/patterns-side-nav.md +6 -0
- package/dist/skills/maxio-react/references/patterns-top-bar.md +1 -0
- package/dist/temporary-typings/src/components/ActionMenu/components/Menu/Menu.d.ts +3 -2
- package/dist/temporary-typings/src/components/ActionMenu/components/Menu/Menu.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/ActionMenu/components/MenuButton/MenuButton.d.ts +1 -1
- package/dist/temporary-typings/src/components/ActionMenu/components/MenuButton/MenuButton.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/ActionMenu/components/MenuButton/types.d.ts +2 -1
- package/dist/temporary-typings/src/components/ActionMenu/components/MenuButton/types.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/ActionMenu/components/MenuList/MenuList.d.ts +3 -2
- package/dist/temporary-typings/src/components/ActionMenu/components/MenuList/MenuList.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/ActionMenu/contexts/MenuContext.d.ts +3 -1
- package/dist/temporary-typings/src/components/ActionMenu/contexts/MenuContext.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Avatar/Avatar.d.ts +1 -1
- package/dist/temporary-typings/src/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Avatar/Avatar.types.d.ts +2 -1
- package/dist/temporary-typings/src/components/Avatar/Avatar.types.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/DataTable/DataTable.d.ts +1 -1
- package/dist/temporary-typings/src/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/DataTable/DataTable.types.d.ts +2 -1
- package/dist/temporary-typings/src/components/DataTable/DataTable.types.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/DataTable/components/RowRenderer/RowRenderer.d.ts +2 -1
- package/dist/temporary-typings/src/components/DataTable/components/RowRenderer/RowRenderer.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/DataTable/components/Table/Table.d.ts +1 -1
- package/dist/temporary-typings/src/components/DataTable/components/Table/Table.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/DataTable/components/Table/Table.types.d.ts +1 -0
- package/dist/temporary-typings/src/components/DataTable/components/Table/Table.types.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Dialog/Dialog.d.ts +1 -1
- package/dist/temporary-typings/src/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Dialog/closeTestIdContext.d.ts +2 -0
- package/dist/temporary-typings/src/components/Dialog/closeTestIdContext.d.ts.map +1 -0
- package/dist/temporary-typings/src/components/Dialog/types.d.ts +2 -1
- package/dist/temporary-typings/src/components/Dialog/types.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Drawer/Drawer.d.ts +1 -1
- package/dist/temporary-typings/src/components/Drawer/Drawer.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Drawer/types.d.ts +10 -8
- package/dist/temporary-typings/src/components/Drawer/types.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Icon/Icon.d.ts +1 -1
- package/dist/temporary-typings/src/components/Icon/Icon.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Icon/Icon.types.d.ts +2 -1
- package/dist/temporary-typings/src/components/Icon/Icon.types.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/LoadingSpinner/LoadingSpinner.d.ts +1 -1
- package/dist/temporary-typings/src/components/LoadingSpinner/LoadingSpinner.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/LoadingSpinner/types.d.ts +2 -1
- package/dist/temporary-typings/src/components/LoadingSpinner/types.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Logo/Logo.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Logo/Logo.types.d.ts +2 -1
- package/dist/temporary-typings/src/components/Logo/Logo.types.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Notifications/Alert/Alert.d.ts +1 -1
- package/dist/temporary-typings/src/components/Notifications/Alert/Alert.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Notifications/Alert/Alert.types.d.ts +2 -1
- package/dist/temporary-typings/src/components/Notifications/Alert/Alert.types.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Notifications/Banner/Banner.d.ts +1 -1
- package/dist/temporary-typings/src/components/Notifications/Banner/Banner.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Notifications/Banner/Banner.types.d.ts +2 -1
- package/dist/temporary-typings/src/components/Notifications/Banner/Banner.types.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Notifications/Toast/Toast/Toast.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Notifications/Toast/Toast/Toast.types.d.ts +1 -0
- package/dist/temporary-typings/src/components/Notifications/Toast/Toast/Toast.types.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/OverlayTrigger/OverlayTrigger.d.ts +1 -0
- package/dist/temporary-typings/src/components/OverlayTrigger/OverlayTrigger.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Pagination/Pagination.d.ts +1 -1
- package/dist/temporary-typings/src/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Pagination/Pagination.types.d.ts +2 -1
- package/dist/temporary-typings/src/components/Pagination/Pagination.types.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/ProgressBar/ProgressBar.d.ts +3 -2
- package/dist/temporary-typings/src/components/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/SideNav/contexts/types.d.ts +1 -0
- package/dist/temporary-typings/src/components/SideNav/contexts/types.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Tabs/Tab/types.d.ts +2 -1
- package/dist/temporary-typings/src/components/Tabs/Tab/types.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Tabs/TabPanel/TabPanel.d.ts +2 -1
- package/dist/temporary-typings/src/components/Tabs/TabPanel/TabPanel.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Tabs/Tabs/Tabs.d.ts +1 -1
- package/dist/temporary-typings/src/components/Tabs/Tabs/Tabs.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Tabs/contexts/types.d.ts +1 -0
- package/dist/temporary-typings/src/components/Tabs/contexts/types.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Tag/Tag.d.ts +1 -1
- package/dist/temporary-typings/src/components/Tag/Tag.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Tag/Tag.types.d.ts +2 -1
- package/dist/temporary-typings/src/components/Tag/Tag.types.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Tile/Tile.d.ts +3 -2
- package/dist/temporary-typings/src/components/Tile/Tile.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Toggle/Toggle.d.ts +2 -1
- package/dist/temporary-typings/src/components/Toggle/Toggle.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/Tooltip/Tooltip.d.ts +1 -0
- package/dist/temporary-typings/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/TooltipTrigger/TooltipTrigger.d.ts +1 -1
- package/dist/temporary-typings/src/components/TooltipTrigger/TooltipTrigger.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/TopBar/TopBar.d.ts +1 -1
- package/dist/temporary-typings/src/components/TopBar/TopBar.d.ts.map +1 -1
- package/dist/temporary-typings/src/components/TopBar/types.d.ts +2 -1
- package/dist/temporary-typings/src/components/TopBar/types.d.ts.map +1 -1
- package/dist/temporary-typings/src/utils/index.d.ts +2 -0
- package/dist/temporary-typings/src/utils/index.d.ts.map +1 -1
- package/dist/temporary-typings/src/utils/testId.d.ts +5 -0
- package/dist/temporary-typings/src/utils/testId.d.ts.map +1 -0
- package/package.json +2 -2
- package/typings/index.d.ts +56 -45
|
@@ -23,6 +23,7 @@ Use this skill to build React components using `@maxio-com/react-ui-components`.
|
|
|
23
23
|
- [Foundations / Design Tokens / About](references/foundations-design-tokens-about.md)
|
|
24
24
|
- [Foundations / Design Tokens / Colors / Primitive Colors](references/foundations-design-tokens-colors-primitive-colors.md)
|
|
25
25
|
- [Foundations / Design Tokens / Colors / Semantic Colors](references/foundations-design-tokens-colors-semantic-colors.md)
|
|
26
|
+
- [Foundations / Testing](references/foundations-testing.md)
|
|
26
27
|
- [Components / Action List](references/components-action-list.md)
|
|
27
28
|
- [Components / Action Menu](references/components-action-menu.md)
|
|
28
29
|
- [Components / Avatar](references/components-avatar.md)
|
|
@@ -44,6 +44,12 @@ occupying persistent space.
|
|
|
44
44
|
- Keep item labels action-oriented and specific, such as "Edit invoice" or "Cancel subscription".
|
|
45
45
|
- Use icon-only triggers only where repeated layout context makes the menu purpose obvious.
|
|
46
46
|
|
|
47
|
+
### Testing
|
|
48
|
+
|
|
49
|
+
- Pass `data-testid` to `Menu` to set it on the menu. `MenuButton` derives `<id>.trigger` and `MenuList` derives `<id>.list`.
|
|
50
|
+
- A `data-testid` passed to `MenuButton` or `MenuList` overrides the derived ID.
|
|
51
|
+
- See [Testing](foundations-testing.md) for when to use test IDs and how to name them.
|
|
52
|
+
|
|
47
53
|
### Related
|
|
48
54
|
|
|
49
55
|
- **[ActionList](components-action-list.md)**: use for the menu item list inside ActionMenu or for standalone action lists.
|
|
@@ -86,7 +92,9 @@ import { Menu, MenuButton, MenuList } from "@maxio-com/react-ui-components";
|
|
|
86
92
|
|
|
87
93
|
### Menu
|
|
88
94
|
|
|
89
|
-
|
|
95
|
+
| Prop | Type | Required | Default | Description | Source |
|
|
96
|
+
| --- | --- | --- | --- | --- | --- |
|
|
97
|
+
| `data-testid` | `string` | no | - | Test ID set on the component's root element. Components with internal parts derive their IDs from it (e.g. `<id>.row.<rowId>`). | TypeLiteral |
|
|
90
98
|
|
|
91
99
|
## Stories
|
|
92
100
|
|
|
@@ -53,6 +53,7 @@ import { AvatarComponent } from "@maxio-com/react-ui-components";
|
|
|
53
53
|
| --- | --- | --- | --- | --- | --- |
|
|
54
54
|
| `alt` | `string` | no | `avatar` | The alt text of the avatar | TypeLiteral |
|
|
55
55
|
| `className` | `string` | no | - | Class name for the main container | TypeLiteral |
|
|
56
|
+
| `data-testid` | `string` | no | - | Test ID set on the component's root element. Components with internal parts derive their IDs from it (e.g. `<id>.row.<rowId>`). | TypeLiteral |
|
|
56
57
|
| `src` | `string` | yes | - | The image source of the avatar | TypeLiteral |
|
|
57
58
|
|
|
58
59
|
## Stories
|
|
@@ -131,7 +131,8 @@ import { parseDate } from '@internationalized/date';
|
|
|
131
131
|
## Imports
|
|
132
132
|
|
|
133
133
|
```tsx
|
|
134
|
-
import { Calendar
|
|
134
|
+
import { Calendar } from "@maxio-com/react-ui-components";
|
|
135
|
+
import { I18nProvider } from "react-aria-components/I18nProvider";
|
|
135
136
|
```
|
|
136
137
|
|
|
137
138
|
## Prop Types
|
|
@@ -156,7 +156,7 @@ import { Body, CopyToClipboard, Flex } from "@maxio-com/react-ui-components";
|
|
|
156
156
|
| `onCopyError` | `((error: unknown) => void)` | no | - | Called when the clipboard write fails, such as in an insecure context or when permission is denied. The copied state is not entered. | TypeLiteral |
|
|
157
157
|
| `resetAfterMs` | `number` | no | `2000` | How long the copied state lasts before reverting, in milliseconds. | TypeLiteral |
|
|
158
158
|
| `size` | `"sm" \| "md" \| "lg" \| "xs"` | no | `md` | Changes the size of the button. | TypeLiteral |
|
|
159
|
-
| `tooltipPlacement` | `"
|
|
159
|
+
| `tooltipPlacement` | `"left" \| "right" \| "top" \| "bottom" \| "left-start" \| "left-end" \| "right-start" \| "right-end" \| "top-start" \| "top-end" \| "bottom-start" \| "bottom-end"` | no | `top` | Where the tooltip is positioned relative to the button. | TypeLiteral |
|
|
160
160
|
| `value` | `string` | yes | - | Text written to the clipboard when the button is pressed. | TypeLiteral |
|
|
161
161
|
| `variant` | `"primary" \| "secondary" \| "tertiary" \| "ghost" \| "subtle"` | no | `ghost` | Button variant. | TypeLiteral |
|
|
162
162
|
|
|
@@ -69,6 +69,12 @@ table state.
|
|
|
69
69
|
- Keep row action labels specific to the command or provide a descriptive `aria-label` for icon-only actions.
|
|
70
70
|
- Prefer scannable cell values over long prose. Use expandable custom rows for secondary detail.
|
|
71
71
|
|
|
72
|
+
### Testing
|
|
73
|
+
|
|
74
|
+
- Pass `data-testid` to set it on the table wrapper. The table derives `<id>.header.<columnId>`, `<id>.row.<rowId>` and `<id>.cell.<rowId>.<columnId>`.
|
|
75
|
+
- `<rowId>` comes from `getRowId`. Pass it so row IDs use the record's ID instead of its position.
|
|
76
|
+
- See [Testing](foundations-testing.md) for when to use test IDs and how to name them.
|
|
77
|
+
|
|
72
78
|
### Related
|
|
73
79
|
|
|
74
80
|
- **[Link](components-link.md)**: use for plain text navigation inside table cells.
|
|
@@ -245,7 +251,8 @@ import {
|
|
|
245
251
|
| `actions` | `((row: Row<TData>, table: Table<TData>) => ReactNode)` | no | - | render custom actions cell content | TypeLiteral |
|
|
246
252
|
| `actionsColumnSize` | `number` | no | - | width (in px) of the actions column; defaults to 40 | TypeLiteral |
|
|
247
253
|
| `aggregationFns` | `Record<string, AggregationFn<any>>` | no | - | - | TypeLiteral |
|
|
248
|
-
| `align` | `"
|
|
254
|
+
| `align` | `"left" \| "right"` | no | - | - | TypeLiteral |
|
|
255
|
+
| `data-testid` | `string` | no | - | Test ID set on the component's root element. Components with internal parts derive their IDs from it (e.g. `<id>.row.<rowId>`). | TypeLiteral |
|
|
249
256
|
| `enableExpanding` | `boolean \| "rowsOnly"` | no | - | Enable nested row expansion. Include `'rowsOnly'` for row-level toggles without group expand/collapse header control. | TypeLiteral |
|
|
250
257
|
| `enableRowReordering` | `boolean` | no | `false` | Enable controlled row reordering for small, non-paginated tables. Intended for approximately 100 total rows or fewer, including nested and collapsed rows. Nested row data must use the `subRows` property; custom `getSubRows` accessors are unsupported. | TypeLiteral |
|
|
251
258
|
| `enableSorting` | `boolean` | no | `false` | - | TypeLiteral |
|
|
@@ -259,7 +266,7 @@ import {
|
|
|
259
266
|
| `onSelect` | `((selected: RowSelectionState) => void)` | no | - | function to peek into selection state changes | TypeLiteral |
|
|
260
267
|
| `onSort` | `((selected: SortingState) => void)` | no | - | function to peek into sorting state changes | TypeLiteral |
|
|
261
268
|
| `pattern` | `boolean` | no | - | - | TypeLiteral |
|
|
262
|
-
| `rowReorderMode` | `"
|
|
269
|
+
| `rowReorderMode` | `"siblings" \| "same-level" \| "all"` | no | `siblings` | - | TypeLiteral |
|
|
263
270
|
| `size` | `"sm" \| "md" \| "lg"` | no | `md` | - | TypeLiteral |
|
|
264
271
|
| `sortingFns` | `Record<string, SortingFn<any>>` | no | - | - | TypeLiteral |
|
|
265
272
|
| `SubRowComponent` | `((row: Row<TData>) => ReactNode)` | no | - | - | TypeLiteral |
|
|
@@ -14,6 +14,7 @@ import { Body, Button, Dialog, DialogTrigger, Popover } from "@maxio-com/react-u
|
|
|
14
14
|
| --- | --- | --- | --- | --- | --- |
|
|
15
15
|
| `children` | `ReactNode \| ((opts: { close: () => void; }) => ReactNode)` | yes | - | Body content. A function receives `close` to dismiss the dialog. | DialogProps |
|
|
16
16
|
| `className` | `string` | no | - | - | DialogProps |
|
|
17
|
+
| `data-testid` | `string` | no | - | Test ID set on the component's root element. Components with internal parts derive their IDs from it (e.g. `<id>.row.<rowId>`). | TypeLiteral |
|
|
17
18
|
| `description` | `ReactNode` | no | - | Optional supporting text below the title. | DialogProps |
|
|
18
19
|
| `footer` | `ReactNode \| ((opts: { close: () => void; }) => ReactNode)` | no | - | Footer content, such as primary and secondary actions. A function receives `close`, so actions can dismiss an uncontrolled dialog. | DialogProps |
|
|
19
20
|
| `showCloseButton` | `boolean` | no | `role !== 'alertdialog'` | Shows the close button in the header. Defaults to `true`, or `false` when `role="alertdialog"`. | DialogProps |
|
|
@@ -4,11 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
### Overview
|
|
6
6
|
|
|
7
|
+
Drawer is a panel that slides in from an edge of the page and blocks the
|
|
8
|
+
rest of it until dismissed. It works like Modal: put a `Dialog` inside it
|
|
9
|
+
for the title, body and footer.
|
|
10
|
+
|
|
11
|
+
Drawer works like [Modal](components-modal.md): the `Drawer` is the overlay and the panel, and a [Dialog](components-dialog.md) inside it provides the title, description, body and footer.
|
|
12
|
+
|
|
7
13
|
#### When to Use
|
|
8
14
|
|
|
9
15
|
- Use Drawer for focused tasks that need more space than a Popover, such as forms, settings, or detail views.
|
|
10
16
|
- Use Drawer when the task should temporarily block interaction with the rest of the page.
|
|
11
|
-
- Use with DialogTrigger for uncontrolled usage, or pair `
|
|
17
|
+
- Use with DialogTrigger for uncontrolled usage, or pair `isOpen`/`onOpenChange` with your own state for controlled usage.
|
|
12
18
|
|
|
13
19
|
#### When Not to Use
|
|
14
20
|
|
|
@@ -27,8 +33,8 @@
|
|
|
27
33
|
|
|
28
34
|
### Accessibility
|
|
29
35
|
|
|
30
|
-
- The drawer renders with `role="dialog"
|
|
31
|
-
- Always provide a `title`; it is the drawer's accessible name and its visible heading.
|
|
36
|
+
- The `Dialog` inside the drawer renders with `role="dialog"`, labeled by its `title` and described by its `description`.
|
|
37
|
+
- Always provide a `title` on the `Dialog`; it is the drawer's accessible name and its visible heading.
|
|
32
38
|
- Use `description` for supporting context below the title rather than cramming it into `title`.
|
|
33
39
|
- The close button has a built-in "Close" accessible name; do not remove it as the only dismissal path when `backdrop="none"`.
|
|
34
40
|
- Keep focus indicators visible on interactive elements inside the drawer.
|
|
@@ -37,24 +43,53 @@
|
|
|
37
43
|
|
|
38
44
|
- Keep `title` short and specific to the task, such as "Configure Custom Pricing" rather than "Settings".
|
|
39
45
|
- Use `description` for a single line of secondary context, such as a category or breadcrumb-style label.
|
|
40
|
-
- Put primary and secondary actions in `footer` rather than at the end of the scrollable body.
|
|
46
|
+
- Put primary and secondary actions in the Dialog `footer` rather than at the end of the scrollable body.
|
|
41
47
|
- Keep body content scannable; long-form content should still fit the drawer's fixed width or height.
|
|
42
48
|
|
|
49
|
+
### Migrating from the deprecated props
|
|
50
|
+
|
|
51
|
+
`title`, `description`, `footer` and `open` on `Drawer` still work but log a deprecation warning, and they are removed in the next major. Move the first three to a `Dialog` passed as children, and rename `open` to `isOpen`:
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
// Before
|
|
55
|
+
<Drawer open={open} onOpenChange={setOpen} title="Settings" footer={actions}>
|
|
56
|
+
{content}
|
|
57
|
+
</Drawer>
|
|
58
|
+
|
|
59
|
+
// After
|
|
60
|
+
<Drawer isOpen={open} onOpenChange={setOpen}>
|
|
61
|
+
<Dialog title="Settings" footer={actions}>
|
|
62
|
+
{content}
|
|
63
|
+
</Dialog>
|
|
64
|
+
</Drawer>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The header, body and footer now use the `maxio-dialog__*` classes. Styles that targeted `.maxio-drawer__body` (or another `maxio-drawer__*` part) should target `.maxio-drawer .maxio-dialog__body` instead.
|
|
68
|
+
|
|
69
|
+
### Testing
|
|
70
|
+
|
|
71
|
+
- Pass `data-testid` to `Drawer` to set it on the drawer panel.
|
|
72
|
+
- Pass `data-testid` to the `Dialog` inside to set it on the dialog; its close button derives `<id>.close`.
|
|
73
|
+
- With the deprecated `title` prop, the close button derives `<id>.close` from the `Drawer`'s `data-testid`.
|
|
74
|
+
- See [Testing](foundations-testing.md) for when to use test IDs and how to name them.
|
|
75
|
+
|
|
43
76
|
### Related
|
|
44
77
|
|
|
78
|
+
- **[Modal](components-modal.md)**: use for a centered task or decision instead of a panel pinned to an edge.
|
|
79
|
+
- **[Dialog](components-dialog.md)**: the content that goes inside the drawer.
|
|
45
80
|
- **[Popover](components-popover.md)**: use for lighter-weight, anchored content that doesn't need to block the page.
|
|
46
81
|
- **[Button](components-buttons-button.md)**: use for the trigger that opens the drawer and for footer actions.
|
|
47
82
|
|
|
48
83
|
## React
|
|
49
84
|
|
|
50
85
|
```tsx
|
|
51
|
-
import { Drawer, DialogTrigger } from '@maxio-com/react-ui-components';
|
|
86
|
+
import { Drawer, Dialog, DialogTrigger } from '@maxio-com/react-ui-components';
|
|
52
87
|
```
|
|
53
88
|
|
|
54
89
|
## Imports
|
|
55
90
|
|
|
56
91
|
```tsx
|
|
57
|
-
import { Body, Button, DialogTrigger, Drawer } from "@maxio-com/react-ui-components";
|
|
92
|
+
import { Body, Button, Dialog, DialogTrigger, Drawer } from "@maxio-com/react-ui-components";
|
|
58
93
|
```
|
|
59
94
|
|
|
60
95
|
## Prop Types
|
|
@@ -63,48 +98,58 @@ import { Body, Button, DialogTrigger, Drawer } from "@maxio-com/react-ui-compone
|
|
|
63
98
|
|
|
64
99
|
| Prop | Type | Required | Default | Description | Source |
|
|
65
100
|
| --- | --- | --- | --- | --- | --- |
|
|
66
|
-
| `backdrop` | `"none" \| "dim"` | no | `dim` |
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
101
|
+
| `backdrop` | `"none" \| "dim"` | no | `dim` | Whether the page behind is dimmed. | DrawerProps |
|
|
102
|
+
| `children` | `ReactNode` | yes | - | The drawer content, usually a `Dialog`. | DrawerProps |
|
|
103
|
+
| `className` | `string` | no | - | Applied to the panel. | DrawerProps |
|
|
104
|
+
| `data-testid` | `string` | no | - | Test ID set on the component's root element. Components with internal parts derive their IDs from it (e.g. `<id>.row.<rowId>`). | TypeLiteral |
|
|
105
|
+
| `description` | `string` | no | - | @deprecated Pass a `Dialog` with a `description` as children instead. | DrawerProps |
|
|
106
|
+
| `footer` | `ReactNode` | no | - | @deprecated Pass a `Dialog` with a `footer` as children instead. | DrawerProps |
|
|
107
|
+
| `open` | `boolean` | no | - | @deprecated Use `isOpen` instead. | DrawerProps |
|
|
108
|
+
| `placement` | `"left" \| "right" \| "top" \| "bottom"` | no | `right` | Edge the drawer slides in from. | DrawerProps |
|
|
109
|
+
| `size` | `"sm" \| "md" \| "lg" \| "xl" \| "full"` | no | `md` | Width (left/right) or height (top/bottom) of the drawer. | DrawerProps |
|
|
110
|
+
| `style` | `CSSProperties` | no | - | Applied to the panel. | DrawerProps |
|
|
111
|
+
| `title` | `string` | no | - | @deprecated Pass a `Dialog` with a `title` as children instead. | DrawerProps |
|
|
75
112
|
|
|
76
113
|
## Stories
|
|
77
114
|
|
|
78
115
|
### Default
|
|
79
116
|
|
|
117
|
+
Use DialogTrigger for the simplest, uncontrolled setup: the trigger opens the
|
|
118
|
+
drawer and the dialog's close button, Escape or a backdrop click close it.
|
|
119
|
+
|
|
80
120
|
```tsx
|
|
81
121
|
const Default = () => <DialogTrigger>
|
|
82
122
|
<Button variant="secondary" size="md">Open Drawer
|
|
83
123
|
</Button>
|
|
84
|
-
<Drawer placement="right" size="md" backdrop="dim"
|
|
85
|
-
<
|
|
124
|
+
<Drawer placement="right" size="md" backdrop="dim">
|
|
125
|
+
<Dialog title="Drawer title">
|
|
126
|
+
<Body size="sm">{LOREM}</Body>
|
|
127
|
+
</Dialog>
|
|
86
128
|
</Drawer>
|
|
87
129
|
</DialogTrigger>;
|
|
88
130
|
```
|
|
89
131
|
|
|
90
132
|
### Controlled (external state)
|
|
91
133
|
|
|
134
|
+
Use `isOpen` and `onOpenChange` when the open state lives elsewhere.
|
|
135
|
+
|
|
92
136
|
```tsx
|
|
93
137
|
const Controlled = () => {
|
|
94
|
-
const [
|
|
138
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
95
139
|
|
|
96
140
|
return (
|
|
97
141
|
<>
|
|
98
|
-
<Button variant="secondary" size="md" onClick={() =>
|
|
142
|
+
<Button variant="secondary" size="md" onClick={() => setIsOpen(true)}>Open Drawer
|
|
99
143
|
</Button>
|
|
100
144
|
<Drawer
|
|
101
145
|
placement="right"
|
|
102
146
|
size="md"
|
|
103
147
|
backdrop="dim"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
148
|
+
isOpen={isOpen}
|
|
149
|
+
onOpenChange={setIsOpen}>
|
|
150
|
+
<Dialog title="Drawer title">
|
|
151
|
+
<Body size="sm">{LOREM}</Body>
|
|
152
|
+
</Dialog>
|
|
108
153
|
</Drawer>
|
|
109
154
|
</>
|
|
110
155
|
);
|
|
@@ -113,46 +158,43 @@ const Controlled = () => {
|
|
|
113
158
|
|
|
114
159
|
### With footer
|
|
115
160
|
|
|
161
|
+
Put actions in the Dialog footer. Long content scrolls in the body while the
|
|
162
|
+
header and footer stay visible.
|
|
163
|
+
|
|
116
164
|
```tsx
|
|
117
165
|
const WithFooter = () => {
|
|
118
|
-
const [
|
|
166
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
119
167
|
|
|
120
168
|
return (
|
|
121
169
|
<>
|
|
122
|
-
<Button variant="secondary" size="md" onClick={() =>
|
|
170
|
+
<Button variant="secondary" size="md" onClick={() => setIsOpen(true)}>Open Drawer
|
|
123
171
|
</Button>
|
|
124
172
|
<Drawer
|
|
125
173
|
placement="right"
|
|
126
174
|
size="md"
|
|
127
175
|
backdrop="dim"
|
|
128
|
-
|
|
129
|
-
onOpenChange={
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
{PARAGRAPHS.map((p, i) => (
|
|
151
|
-
<Body key={i} size="sm">
|
|
152
|
-
{p}
|
|
153
|
-
</Body>
|
|
154
|
-
))}
|
|
155
|
-
</div>
|
|
176
|
+
isOpen={isOpen}
|
|
177
|
+
onOpenChange={setIsOpen}>
|
|
178
|
+
<Dialog
|
|
179
|
+
title="Settings"
|
|
180
|
+
footer={({ close }) => (
|
|
181
|
+
<>
|
|
182
|
+
<Button variant="primary" size="md" onClick={close}>
|
|
183
|
+
Save
|
|
184
|
+
</Button>
|
|
185
|
+
<Button variant="secondary" size="md" onClick={close}>
|
|
186
|
+
Cancel
|
|
187
|
+
</Button>
|
|
188
|
+
</>
|
|
189
|
+
)}>
|
|
190
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
|
|
191
|
+
{PARAGRAPHS.map((p, i) => (
|
|
192
|
+
<Body key={i} size="sm">
|
|
193
|
+
{p}
|
|
194
|
+
</Body>
|
|
195
|
+
))}
|
|
196
|
+
</div>
|
|
197
|
+
</Dialog>
|
|
156
198
|
</Drawer>
|
|
157
199
|
</>
|
|
158
200
|
);
|
|
@@ -182,13 +224,14 @@ const Sides = () => {
|
|
|
182
224
|
{placements.map((placement) => (
|
|
183
225
|
<Drawer
|
|
184
226
|
key={placement}
|
|
185
|
-
|
|
186
|
-
onOpenChange={(
|
|
227
|
+
isOpen={openPlacement === placement}
|
|
228
|
+
onOpenChange={(isOpen) => !isOpen && setOpenPlacement(null)}
|
|
187
229
|
placement={placement}
|
|
188
230
|
size="md"
|
|
189
|
-
title={`${placement} drawer`}
|
|
190
231
|
>
|
|
191
|
-
<
|
|
232
|
+
<Dialog title={`${placement} drawer`}>
|
|
233
|
+
<Body size="sm">Slides in from the {placement}.</Body>
|
|
234
|
+
</Dialog>
|
|
192
235
|
</Drawer>
|
|
193
236
|
))}
|
|
194
237
|
</div>
|
|
@@ -219,12 +262,13 @@ const BackdropVariants = () => {
|
|
|
219
262
|
{backdrops.map((b) => (
|
|
220
263
|
<Drawer
|
|
221
264
|
key={b}
|
|
222
|
-
|
|
223
|
-
onOpenChange={(
|
|
265
|
+
isOpen={openBackdrop === b}
|
|
266
|
+
onOpenChange={(isOpen) => !isOpen && setOpenBackdrop(null)}
|
|
224
267
|
backdrop={b}
|
|
225
|
-
title={`backdrop="${b}"`}
|
|
226
268
|
>
|
|
227
|
-
<
|
|
269
|
+
<Dialog title={`backdrop="${b}"`}>
|
|
270
|
+
<Body size="sm">Backdrop style: {b}</Body>
|
|
271
|
+
</Dialog>
|
|
228
272
|
</Drawer>
|
|
229
273
|
))}
|
|
230
274
|
</div>
|
|
@@ -254,12 +298,13 @@ const Sizes = () => {
|
|
|
254
298
|
{sizes.map((s) => (
|
|
255
299
|
<Drawer
|
|
256
300
|
key={s}
|
|
257
|
-
|
|
258
|
-
onOpenChange={(
|
|
301
|
+
isOpen={openSize === s}
|
|
302
|
+
onOpenChange={(isOpen) => !isOpen && setOpenSize(null)}
|
|
259
303
|
size={s}
|
|
260
|
-
title={`size="${s}"`}
|
|
261
304
|
>
|
|
262
|
-
<
|
|
305
|
+
<Dialog title={`size="${s}"`}>
|
|
306
|
+
<Body size="sm">Width: {s}</Body>
|
|
307
|
+
</Dialog>
|
|
263
308
|
</Drawer>
|
|
264
309
|
))}
|
|
265
310
|
</div>
|
|
@@ -271,6 +316,35 @@ const Sizes = () => {
|
|
|
271
316
|
|
|
272
317
|
```tsx
|
|
273
318
|
const WithDescription = () => {
|
|
319
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
320
|
+
|
|
321
|
+
return (
|
|
322
|
+
<>
|
|
323
|
+
<Button variant="secondary" size="md" onClick={() => setIsOpen(true)}>Open Drawer
|
|
324
|
+
</Button>
|
|
325
|
+
<Drawer
|
|
326
|
+
placement="right"
|
|
327
|
+
size="md"
|
|
328
|
+
backdrop="dim"
|
|
329
|
+
isOpen={isOpen}
|
|
330
|
+
onOpenChange={setIsOpen}>
|
|
331
|
+
<Dialog title="Configure Custom Pricing" description="API Credits · Product">
|
|
332
|
+
<Body size="sm">{LOREM}</Body>
|
|
333
|
+
</Dialog>
|
|
334
|
+
</Drawer>
|
|
335
|
+
</>
|
|
336
|
+
);
|
|
337
|
+
};
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Legacy props (deprecated)
|
|
341
|
+
|
|
342
|
+
Deprecated: passing `title`, `description`, `footer` and `open` to Drawer
|
|
343
|
+
still works and renders a Dialog internally, but logs a warning. Pass a
|
|
344
|
+
`Dialog` as children instead. These props are removed in the next major.
|
|
345
|
+
|
|
346
|
+
```tsx
|
|
347
|
+
const LegacyProps = () => {
|
|
274
348
|
const [open, setOpen] = React.useState(false);
|
|
275
349
|
|
|
276
350
|
return (
|
|
@@ -283,8 +357,13 @@ const WithDescription = () => {
|
|
|
283
357
|
backdrop="dim"
|
|
284
358
|
open={open}
|
|
285
359
|
onOpenChange={setOpen}
|
|
286
|
-
title="
|
|
287
|
-
description="
|
|
360
|
+
title="Settings"
|
|
361
|
+
description="Account preferences"
|
|
362
|
+
footer={
|
|
363
|
+
<Button variant="primary" size="md" onClick={() => setOpen(false)}>
|
|
364
|
+
Save
|
|
365
|
+
</Button>
|
|
366
|
+
}>
|
|
288
367
|
<Body size="sm">{LOREM}</Body>
|
|
289
368
|
</Drawer>
|
|
290
369
|
</>
|
|
@@ -65,11 +65,11 @@ import { Flex } from "@maxio-com/react-ui-components";
|
|
|
65
65
|
| `basis` | `"auto" \| "1/2" \| "1/3" \| "2/3" \| "1/4" \| "2/4" \| "3/4" \| "1/5" \| "2/5" \| "3/5" \| "4/5" \| "1/6" \| "2/6" \| "3/6" \| "4/6" \| "5/6" \| "1/12" \| "2/12" \| "3/12" \| "4/12" \| "5/12" \| "6/12" \| "7/12" \| "8/12" \| "9/12" \| "10/12" \| "11/12" \| "full"` | no | - | Defines the initial size of flex items. | TypeLiteral |
|
|
66
66
|
| `children` | `ReactNode` | no | - | The content of the flex container. Can be any valid `ReactNode`. | TypeLiteral, DOMAttributes |
|
|
67
67
|
| `className` | `string` | no | - | Additional class names for custom styling. | TypeLiteral, HTMLAttributes |
|
|
68
|
-
| `flex` | `"
|
|
68
|
+
| `flex` | `"auto" \| 1 \| "none" \| "initial"` | no | - | Controls how flex items both grow and shrink. | TypeLiteral |
|
|
69
69
|
| `flexDirection` | `"row" \| "col" \| "row-reverse" \| "col-reverse"` | no | - | Defines the flex direction. Default orientation is `row`. | TypeLiteral |
|
|
70
|
-
| `gap` | `0 \| 1 \| "px" \| 0.5 \| 1.5 \| 2
|
|
71
|
-
| `gapX` | `0 \| 1 \| "px" \| 0.5 \| 1.5 \| 2
|
|
72
|
-
| `gapY` | `0 \| 1 \| "px" \| 0.5 \| 1.5 \| 2
|
|
70
|
+
| `gap` | `0 \| 2 \| 1 \| 12 \| 24 \| "px" \| 0.5 \| 1.5 \| 2.5 \| 3 \| 3.5 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 14 \| 16 \| 20 \| 28 \| 32 \| 36 \| 40 \| 44 \| 48 \| 52 \| 56 \| 60 \| 64 \| 72 \| 80 \| 96` | no | - | Controls the vertical and horizontal space between flex items. | TypeLiteral |
|
|
71
|
+
| `gapX` | `0 \| 2 \| 1 \| 12 \| 24 \| "px" \| 0.5 \| 1.5 \| 2.5 \| 3 \| 3.5 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 14 \| 16 \| 20 \| 28 \| 32 \| 36 \| 40 \| 44 \| 48 \| 52 \| 56 \| 60 \| 64 \| 72 \| 80 \| 96` | no | - | Controls the horizontal space between flex items. | TypeLiteral |
|
|
72
|
+
| `gapY` | `0 \| 2 \| 1 \| 12 \| 24 \| "px" \| 0.5 \| 1.5 \| 2.5 \| 3 \| 3.5 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 14 \| 16 \| 20 \| 28 \| 32 \| 36 \| 40 \| 44 \| 48 \| 52 \| 56 \| 60 \| 64 \| 72 \| 80 \| 96` | no | - | Controls the vertical space between flex items. | TypeLiteral |
|
|
73
73
|
| `grow` | `boolean` | no | - | Allows or restricts growing. | TypeLiteral |
|
|
74
74
|
| `justifyContent` | `"start" \| "center" \| "end" \| "stretch" \| "normal" \| "between" \| "around" \| "evenly"` | no | - | Controls how flex items are positioned along the main axis (defined by `FlexDirection`). | TypeLiteral |
|
|
75
75
|
| `shrink` | `boolean` | no | - | Allows or restricts shrinking. | TypeLiteral |
|
|
@@ -90,7 +90,8 @@ order and reading direction. Date-time values support `granularity` and time zon
|
|
|
90
90
|
## Imports
|
|
91
91
|
|
|
92
92
|
```tsx
|
|
93
|
-
import { DateField
|
|
93
|
+
import { DateField } from "@maxio-com/react-ui-components";
|
|
94
|
+
import { I18nProvider } from "react-aria-components";
|
|
94
95
|
```
|
|
95
96
|
|
|
96
97
|
## Prop Types
|
|
@@ -114,7 +114,8 @@ Preset labels do not become submitted date values or satisfy required validation
|
|
|
114
114
|
## Imports
|
|
115
115
|
|
|
116
116
|
```tsx
|
|
117
|
-
import { DatePicker
|
|
117
|
+
import { DatePicker } from "@maxio-com/react-ui-components";
|
|
118
|
+
import { I18nProvider } from "react-aria-components";
|
|
118
119
|
```
|
|
119
120
|
|
|
120
121
|
## Prop Types
|
|
@@ -120,7 +120,8 @@ ranges or null, not partial ranges.
|
|
|
120
120
|
## Imports
|
|
121
121
|
|
|
122
122
|
```tsx
|
|
123
|
-
import { DateRangePicker
|
|
123
|
+
import { DateRangePicker } from "@maxio-com/react-ui-components";
|
|
124
|
+
import { I18nProvider } from "react-aria-components";
|
|
124
125
|
```
|
|
125
126
|
|
|
126
127
|
## Prop Types
|
|
@@ -67,19 +67,19 @@ import { Grid } from "@maxio-com/react-ui-components";
|
|
|
67
67
|
| `alignItems` | `"start" \| "center" \| "end" \| "baseline" \| "stretch"` | no | - | Apply to child Grid components. Controls how item is positioned vertically. | TypeLiteral |
|
|
68
68
|
| `autoColumns` | `"auto" \| "max" \| "min" \| "fr"` | no | - | Sets the size of columns that do not have a specified size. | TypeLiteral |
|
|
69
69
|
| `autoRows` | `"auto" \| "max" \| "min" \| "fr"` | no | - | Sets the size of rows that do not have a specified size. | TypeLiteral |
|
|
70
|
-
| `column` | `
|
|
71
|
-
| `columnEnd` | `"auto" \| 1 \|
|
|
72
|
-
| `columnStart` | `"auto" \| 1 \|
|
|
73
|
-
| `gap` | `0 \| 1 \| "px" \| 0.5 \| 1.5 \| 2
|
|
74
|
-
| `gapX` | `0 \| 1 \| "px" \| 0.5 \| 1.5 \| 2
|
|
75
|
-
| `gapY` | `0 \| 1 \| "px" \| 0.5 \| 1.5 \| 2
|
|
70
|
+
| `column` | `2 \| "auto" \| 1 \| 12 \| "full" \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 13` | no | - | Apply to child Grid components. Sets the number of columns the item spans. Values can be overridden by `columnStart` and `columnEnd`. | TypeLiteral |
|
|
71
|
+
| `columnEnd` | `2 \| "auto" \| 1 \| 12 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 13` | no | - | Apply to child Grid components. Sets the item's ending column. Needs `columnStart` to span multiple columns. | TypeLiteral |
|
|
72
|
+
| `columnStart` | `2 \| "auto" \| 1 \| 12 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 13` | no | - | Apply to child Grid components. Sets the item's starting column. | TypeLiteral |
|
|
73
|
+
| `gap` | `0 \| 2 \| 1 \| 12 \| 24 \| "px" \| 0.5 \| 1.5 \| 2.5 \| 3 \| 3.5 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 14 \| 16 \| 20 \| 28 \| 32 \| 36 \| 40 \| 44 \| 48 \| 52 \| 56 \| 60 \| 64 \| 72 \| 80 \| 96` | no | - | Controls the vertical and horizontal space between grid items. Can be overridden by `gapX` and `gapY`. | TypeLiteral |
|
|
74
|
+
| `gapX` | `0 \| 2 \| 1 \| 12 \| 24 \| "px" \| 0.5 \| 1.5 \| 2.5 \| 3 \| 3.5 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 14 \| 16 \| 20 \| 28 \| 32 \| 36 \| 40 \| 44 \| 48 \| 52 \| 56 \| 60 \| 64 \| 72 \| 80 \| 96` | no | - | Controls the horizontal space between grid items. | TypeLiteral |
|
|
75
|
+
| `gapY` | `0 \| 2 \| 1 \| 12 \| 24 \| "px" \| 0.5 \| 1.5 \| 2.5 \| 3 \| 3.5 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 14 \| 16 \| 20 \| 28 \| 32 \| 36 \| 40 \| 44 \| 48 \| 52 \| 56 \| 60 \| 64 \| 72 \| 80 \| 96` | no | - | Controls the vertical space between grid items. | TypeLiteral |
|
|
76
76
|
| `inline` | `boolean` | no | - | Changes grid from block element to inline element. | TypeLiteral |
|
|
77
77
|
| `justifyContent` | `"start" \| "center" \| "end" \| "stretch" \| "normal" \| "between" \| "around" \| "evenly"` | no | - | Apply to child Grid components. Controls how grid item is positioned horizontally. | TypeLiteral |
|
|
78
|
-
| `row` | `
|
|
79
|
-
| `rowEnd` | `"auto" \| 1 \|
|
|
80
|
-
| `rowStart` | `"auto" \| 1 \|
|
|
81
|
-
| `templateColumns` | `
|
|
82
|
-
| `templateRows` | `
|
|
78
|
+
| `row` | `2 \| "auto" \| 1 \| 12 \| "full" \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 13` | no | - | Apply to child Grid components. Sets the number of rows the item spans. Values can be overridden by `rowStart` and `rowEnd`. | TypeLiteral |
|
|
79
|
+
| `rowEnd` | `2 \| "auto" \| 1 \| 12 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 13` | no | - | Apply to child Grid components. Sets the item's ending row. Needs `rowStart` to span multiple columns. | TypeLiteral |
|
|
80
|
+
| `rowStart` | `2 \| "auto" \| 1 \| 12 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 13` | no | - | Apply to child Grid components. Sets the item's starting row. | TypeLiteral |
|
|
81
|
+
| `templateColumns` | `2 \| 1 \| "none" \| 12 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| "subgrid"` | no | - | Sets number of columns in the grid. | TypeLiteral |
|
|
82
|
+
| `templateRows` | `2 \| 1 \| "none" \| 12 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| "subgrid"` | no | - | Sets number of rows in the grid. | TypeLiteral |
|
|
83
83
|
|
|
84
84
|
## Stories
|
|
85
85
|
|
|
@@ -111,6 +111,7 @@ import { Icon } from "@maxio-com/react-ui-components";
|
|
|
111
111
|
| --- | --- | --- | --- | --- | --- |
|
|
112
112
|
| `className` | `string` | no | - | Class name for the main container | TypeLiteral |
|
|
113
113
|
| `color` | `string` | no | - | The icon color | TypeLiteral |
|
|
114
|
+
| `data-testid` | `string` | no | - | Test ID set on the component's root element. Components with internal parts derive their IDs from it (e.g. `<id>.row.<rowId>`). | TypeLiteral |
|
|
114
115
|
| `size` | `"md" \| "lg" \| "xs"` | no | - | The icon size | TypeLiteral |
|
|
115
116
|
| `variant` | `string` | yes | - | The icon variant | TypeLiteral |
|
|
116
117
|
|
|
@@ -68,6 +68,7 @@ import { LoadingSpinner } from "@maxio-com/react-ui-components";
|
|
|
68
68
|
| Prop | Type | Required | Default | Description | Source |
|
|
69
69
|
| --- | --- | --- | --- | --- | --- |
|
|
70
70
|
| `className` | `string` | no | - | Class name for the main container | TypeLiteral |
|
|
71
|
+
| `data-testid` | `string` | no | - | Test ID set on the component's root element. Components with internal parts derive their IDs from it (e.g. `<id>.row.<rowId>`). | TypeLiteral |
|
|
71
72
|
| `size` | `"sm" \| "md" \| "lg" \| "xl"` | no | `md` | The size of the loading spinner | TypeLiteral |
|
|
72
73
|
| `white` | `boolean` | no | `false` | Changes color of the spinner to white for use on dark backgrounds. | TypeLiteral |
|
|
73
74
|
|
|
@@ -53,6 +53,7 @@ import { LogoComponent } from "@maxio-com/react-ui-components";
|
|
|
53
53
|
| --- | --- | --- | --- | --- | --- |
|
|
54
54
|
| `alt` | `string` | no | - | The alt text of the logo | TypeLiteral |
|
|
55
55
|
| `className` | `string` | no | - | Class name for the svg element of the logo | TypeLiteral |
|
|
56
|
+
| `data-testid` | `string` | no | - | Test ID set on the component's root element. Components with internal parts derive their IDs from it (e.g. `<id>.row.<rowId>`). | TypeLiteral |
|
|
56
57
|
| `size` | `number \| "sm" \| "md" \| "lg"` | no | - | Size of the logo, by default uses 'sm'. Pass a number for a custom pixel height (e.g. 20 → '20px'). | TypeLiteral |
|
|
57
58
|
| `variant` | `"mark" \| "lockup"` | no | - | Variant of the logo, by default uses 'lockup' | TypeLiteral |
|
|
58
59
|
|
|
@@ -54,6 +54,11 @@ Choose the sentiment that matches the message tone and user urgency. The default
|
|
|
54
54
|
- Use link text for a concrete next step, such as "View verification status" or "Update payment method".
|
|
55
55
|
- Avoid repeating the sentiment in copy when the title can describe the outcome directly.
|
|
56
56
|
|
|
57
|
+
### Testing
|
|
58
|
+
|
|
59
|
+
- Pass `data-testid` to set it on the alert. The dismiss button derives `<id>.dismiss`.
|
|
60
|
+
- See [Testing](foundations-testing.md) for when to use test IDs and how to name them.
|
|
61
|
+
|
|
57
62
|
### Related
|
|
58
63
|
|
|
59
64
|
- **[Banner](components-notifications-banner.md)**: use for page-level, account-level, or system-wide announcements.
|
|
@@ -79,6 +84,7 @@ import { Alert } from "@maxio-com/react-ui-components";
|
|
|
79
84
|
| --- | --- | --- | --- | --- | --- |
|
|
80
85
|
| `children` | `string` | no | - | Displays alert message | TypeLiteral |
|
|
81
86
|
| `className` | `string` | no | - | Additional CSS class name to be applied to the alert | TypeLiteral |
|
|
87
|
+
| `data-testid` | `string` | no | - | Test ID set on the component's root element. Components with internal parts derive their IDs from it (e.g. `<id>.row.<rowId>`). | TypeLiteral |
|
|
82
88
|
| `display` | `"inline" \| "block"` | no | `inline` | Changes the display of the alert. Defaults to `inline` | TypeLiteral |
|
|
83
89
|
| `href` | `string` | no | - | Sets the link target - `href` must be present to include a link | TypeLiteral |
|
|
84
90
|
| `linkExternal` | `boolean` | no | - | Sets the link target to '_blank' | TypeLiteral |
|
|
@@ -52,6 +52,11 @@ Choose the sentiment that matches the urgency and consequence of the message.
|
|
|
52
52
|
- Avoid vague titles such as "Notice" or "Update".
|
|
53
53
|
- Use dismissible banners for guidance users can safely hide, not for required account or error states.
|
|
54
54
|
|
|
55
|
+
### Testing
|
|
56
|
+
|
|
57
|
+
- Pass `data-testid` to set it on the banner. The dismiss button derives `<id>.dismiss`.
|
|
58
|
+
- See [Testing](foundations-testing.md) for when to use test IDs and how to name them.
|
|
59
|
+
|
|
55
60
|
### Related
|
|
56
61
|
|
|
57
62
|
- **[Toast](components-notifications-toast.md)**: use for transient success, warning, or error feedback that can disappear automatically.
|
|
@@ -78,6 +83,7 @@ import { Banner } from "@maxio-com/react-ui-components";
|
|
|
78
83
|
| --- | --- | --- | --- | --- | --- |
|
|
79
84
|
| `children` | `string` | yes | - | Displays banner message | TypeLiteral |
|
|
80
85
|
| `className` | `string` | no | - | Additional CSS class name to be applied to the banner | TypeLiteral |
|
|
86
|
+
| `data-testid` | `string` | no | - | Test ID set on the component's root element. Components with internal parts derive their IDs from it (e.g. `<id>.row.<rowId>`). | TypeLiteral |
|
|
81
87
|
| `display` | `"inline" \| "block"` | no | `inline` | Changes the display of the banner. Defaults to `inline` | TypeLiteral |
|
|
82
88
|
| `href` | `string` | no | - | Sets the link target - `href` must be present to include a link | TypeLiteral |
|
|
83
89
|
| `linkExternal` | `boolean` | no | - | Sets the link target to '_blank' | TypeLiteral |
|
|
@@ -52,6 +52,12 @@ Use sentiment to match the tone of the message. The sentiment changes the icon c
|
|
|
52
52
|
- Use links only for a direct follow-up action, such as viewing the created object.
|
|
53
53
|
- Avoid stacking multiple toasts for the same event. Update the existing flow or use page-level feedback instead.
|
|
54
54
|
|
|
55
|
+
### Testing
|
|
56
|
+
|
|
57
|
+
- Toasts are created as data, so set the test ID with the `testId` field when adding the toast: `addToast({ title: 'Saved', testId: 'invoice.saved-toast' })`.
|
|
58
|
+
- The dismiss button derives `<testId>.dismiss`.
|
|
59
|
+
- See [Testing](foundations-testing.md) for when to use test IDs and how to name them.
|
|
60
|
+
|
|
55
61
|
### Related
|
|
56
62
|
|
|
57
63
|
- **[Alert](components-notifications-alert.md)**: use for contextual page feedback that should stay near related content.
|