@maxio-com/react-ui-components 9.32.0 → 9.33.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-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-drawer.md +7 -1
- package/dist/skills/maxio-react/references/components-flex.md +4 -4
- 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-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/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 +2 -1
- 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 +47 -36
|
@@ -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
|
|
@@ -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 |
|
|
@@ -40,6 +40,11 @@
|
|
|
40
40
|
- Put primary and secondary actions in `footer` rather than at the end of the scrollable body.
|
|
41
41
|
- Keep body content scannable; long-form content should still fit the drawer's fixed width or height.
|
|
42
42
|
|
|
43
|
+
### Testing
|
|
44
|
+
|
|
45
|
+
- Pass `data-testid` to set it on the drawer panel. The close button derives `<id>.close`.
|
|
46
|
+
- See [Testing](foundations-testing.md) for when to use test IDs and how to name them.
|
|
47
|
+
|
|
43
48
|
### Related
|
|
44
49
|
|
|
45
50
|
- **[Popover](components-popover.md)**: use for lighter-weight, anchored content that doesn't need to block the page.
|
|
@@ -65,11 +70,12 @@ import { Body, Button, DialogTrigger, Drawer } from "@maxio-com/react-ui-compone
|
|
|
65
70
|
| --- | --- | --- | --- | --- | --- |
|
|
66
71
|
| `backdrop` | `"none" \| "dim"` | no | `dim` | - | DrawerProps |
|
|
67
72
|
| `className` | `string` | no | - | - | DrawerProps |
|
|
73
|
+
| `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 |
|
|
68
74
|
| `description` | `string` | no | - | - | DrawerProps |
|
|
69
75
|
| `footer` | `ReactNode` | no | - | - | DrawerProps |
|
|
70
76
|
| `onOpenChange` | `((open: boolean) => void)` | no | - | - | DrawerProps |
|
|
71
77
|
| `open` | `boolean` | no | - | - | DrawerProps |
|
|
72
|
-
| `placement` | `"
|
|
78
|
+
| `placement` | `"left" \| "right" \| "top" \| "bottom"` | no | `right` | - | DrawerProps |
|
|
73
79
|
| `size` | `"sm" \| "md" \| "lg" \| "xl" \| "full"` | no | `md` | - | DrawerProps |
|
|
74
80
|
| `title` | `string` | yes | - | - | DrawerProps |
|
|
75
81
|
|
|
@@ -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 |
|
|
@@ -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.
|
|
@@ -35,6 +35,11 @@ many rows or records are shown at once.
|
|
|
35
35
|
- Keep the displayed item range, total item count, and total page count accurate after every dataset update.
|
|
36
36
|
- Do not rely on the chevron icons alone; preserve accessible button names for previous and next navigation.
|
|
37
37
|
|
|
38
|
+
### Testing
|
|
39
|
+
|
|
40
|
+
- Pass `data-testid` to set it on the pagination container. The previous and next buttons derive `<id>.prev` and `<id>.next`.
|
|
41
|
+
- See [Testing](foundations-testing.md) for when to use test IDs and how to name them.
|
|
42
|
+
|
|
38
43
|
### Related
|
|
39
44
|
|
|
40
45
|
- **[DataTable](components-data-table.md)**: use with Pagination when tabular data needs paging, sorting, or selection.
|
|
@@ -80,6 +85,7 @@ import { Pagination } from "@maxio-com/react-ui-components";
|
|
|
80
85
|
| Prop | Type | Required | Default | Description | Source |
|
|
81
86
|
| --- | --- | --- | --- | --- | --- |
|
|
82
87
|
| `currentPage` | `number` | no | `1` | Current page index | TypeLiteral |
|
|
88
|
+
| `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 |
|
|
83
89
|
| `itemsPerPage` | `number` | no | `30` | Number of items shown per page | TypeLiteral |
|
|
84
90
|
| `manualPageInput` | `boolean` | no | `false` | Use manual page input instead of dropdown for extremely large datasets | TypeLiteral |
|
|
85
91
|
| `onChange` | `((pageInfo: PageInfo) => void)` | no | - | Export of currentPage and itemsPerPage data as an object | TypeLiteral |
|
|
@@ -75,13 +75,14 @@ import { ProgressBar } from "@maxio-com/react-ui-components";
|
|
|
75
75
|
|
|
76
76
|
| Prop | Type | Required | Default | Description | Source |
|
|
77
77
|
| --- | --- | --- | --- | --- | --- |
|
|
78
|
+
| `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 |
|
|
78
79
|
| `helperText` | `string` | no | - | Helper text for the progress bar | ProgressBarProps |
|
|
79
80
|
| `label` | `string` | yes | - | Label for the progress bar | ProgressBarProps |
|
|
80
81
|
| `maxValue` | `number` | no | `100` | Defines the maximum value of the progress bar | ProgressBarProps |
|
|
81
82
|
| `size` | `"md" \| "lg"` | no | `md` | Defines the size of the progress bar | ProgressBarProps |
|
|
82
83
|
| `status` | `"error" \| "success"` | no | - | Defines the status of the progress bar | ProgressBarProps |
|
|
83
84
|
| `value` | `number` | no | - | Defines the current value of the progress bar. If `undefined` the progress bar will be indeterminate. | ProgressBarProps |
|
|
84
|
-
| `variant` | `"
|
|
85
|
+
| `variant` | `"default" \| "inline" \| "indent"` | no | `default` | Defines the position applied to the label and helper text | ProgressBarProps |
|
|
85
86
|
|
|
86
87
|
## Stories
|
|
87
88
|
|
|
@@ -53,6 +53,12 @@ Choose the visual treatment that fits the surrounding surface.
|
|
|
53
53
|
- Avoid long tab labels that wrap or make the active section hard to scan.
|
|
54
54
|
- Use icons as supporting context; do not rely on icons alone unless the meaning is unmistakable.
|
|
55
55
|
|
|
56
|
+
### Testing
|
|
57
|
+
|
|
58
|
+
- Pass `data-testid` to `Tabs` to set it on the tabs container.
|
|
59
|
+
- Tabs and panels don't derive IDs, because they are only identified by position. Pass `data-testid` to each `Tab` or `TabPanel` that a test needs to reach.
|
|
60
|
+
- See [Testing](foundations-testing.md) for when to use test IDs and how to name them.
|
|
61
|
+
|
|
56
62
|
### Related
|
|
57
63
|
|
|
58
64
|
- **[SideNav](patterns-side-nav.md)**: use for primary navigation across app areas.
|
|
@@ -154,6 +160,7 @@ import { Body, Card, Icon, Tab, TabList, TabPanel, TabPanels, Tabs } from "@maxi
|
|
|
154
160
|
|
|
155
161
|
| Prop | Type | Required | Default | Description | Source |
|
|
156
162
|
| --- | --- | --- | --- | --- | --- |
|
|
163
|
+
| `data-testid` | `string` | no | - | Test ID set on the root element. | TypeLiteral |
|
|
157
164
|
| `defaultIndex` | `number` | no | `0` | Indicates which tab should be active by default | TypeLiteral |
|
|
158
165
|
| `index` | `number` | no | - | Indicates which tab should be active in controlled mode. | TypeLiteral |
|
|
159
166
|
| `onChange` | `TabsOnChange` | no | - | Callback function that is fired when the tab is changed | TypeLiteral |
|
|
@@ -76,6 +76,7 @@ import { Tag } from "@maxio-com/react-ui-components";
|
|
|
76
76
|
| Prop | Type | Required | Default | Description | Source |
|
|
77
77
|
| --- | --- | --- | --- | --- | --- |
|
|
78
78
|
| `children` | `ReactNode` | yes | - | React children nodes | TypeLiteral |
|
|
79
|
+
| `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 |
|
|
79
80
|
| `kind` | `"primary" \| "secondary" \| "tertiary"` | no | `primary` | Modifier for the tag Kind | TypeLiteral |
|
|
80
81
|
| `leadingIcon` | `string` | no | - | Element allowing leading icon selection | TypeLiteral |
|
|
81
82
|
| `sentiment` | `"danger" \| "info" \| "success" \| "warning" \| "highlight"` | no | - | Modifier for the tag Sentiment | TypeLiteral |
|
|
@@ -66,6 +66,7 @@ import { Tile } from "@maxio-com/react-ui-components";
|
|
|
66
66
|
|
|
67
67
|
| Prop | Type | Required | Default | Description | Source |
|
|
68
68
|
| --- | --- | --- | --- | --- | --- |
|
|
69
|
+
| `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 |
|
|
69
70
|
| `disabled` | `boolean` | no | - | - | TypeLiteral |
|
|
70
71
|
| `href` | `string` | no | - | - | TypeLiteral |
|
|
71
72
|
| `onClick` | `((() => void) & MouseEventHandler<HTMLDivElement>)` | no | - | - | TypeLiteral, DOMAttributes |
|
|
@@ -40,6 +40,11 @@ Toggle lets users turn a setting on or off.
|
|
|
40
40
|
- Keep labels short and specific enough to scan in dense settings pages.
|
|
41
41
|
- Place explanatory or eligibility copy near the toggle when a disabled state needs context.
|
|
42
42
|
|
|
43
|
+
### Testing
|
|
44
|
+
|
|
45
|
+
- Pass `data-testid` to set it on the toggle container. Without it, the container keeps the default `toggle-container`.
|
|
46
|
+
- See [Testing](foundations-testing.md) for when to use test IDs and how to name them.
|
|
47
|
+
|
|
43
48
|
### Related
|
|
44
49
|
|
|
45
50
|
- **[Checkbox](components-forms-checkbox.md)**: use for independent selections in a form or list.
|
|
@@ -93,13 +98,14 @@ import { ToggleComponent } from "@maxio-com/react-ui-components";
|
|
|
93
98
|
| `aria-label` | `string` | no | - | Aria label for the toggle - should be provided if no valueDescription is provided | TypeLiteral |
|
|
94
99
|
| `checked` | `boolean` | no | - | The state of the toggle | TypeLiteral |
|
|
95
100
|
| `className` | `string` | no | - | Class name for the main container | TypeLiteral |
|
|
101
|
+
| `data-testid` | `string` | no | `toggle-container` | Test ID set on the root element | TypeLiteral |
|
|
96
102
|
| `defaultChecked` | `boolean` | no | - | The state for uncontrolled toggle. | TypeLiteral |
|
|
97
103
|
| `disabled` | `boolean` | no | - | Is the toggle disabled | TypeLiteral |
|
|
98
104
|
| `id` | `string` | no | - | Toggle id - if id not provided then it will be generated automatically | TypeLiteral |
|
|
99
105
|
| `name` | `string` | no | - | Toggle name | TypeLiteral |
|
|
100
106
|
| `onChange` | `((value: boolean, event?: ChangeEvent<HTMLInputElement, Element> \| KeyboardEvent<HTMLInputElement>) => void)` | no | - | The onChange function | TypeLiteral |
|
|
101
107
|
| `valueDescription` | `string` | no | - | Toggle label | TypeLiteral |
|
|
102
|
-
| `valueDescriptionPosition` | `"
|
|
108
|
+
| `valueDescriptionPosition` | `"left" \| "right"` | no | - | Toggle label position | TypeLiteral |
|
|
103
109
|
|
|
104
110
|
## Stories
|
|
105
111
|
|
|
@@ -41,6 +41,12 @@ TooltipTrigger displays brief contextual help next to a trigger while preserving
|
|
|
41
41
|
- Prefer concrete product language, such as "Invoices renew monthly", over generic help text.
|
|
42
42
|
- Move long guidance, error recovery, or policy details into persistent page content.
|
|
43
43
|
|
|
44
|
+
### Testing
|
|
45
|
+
|
|
46
|
+
- Pass `data-testid` to set it on the trigger wrapper. The tooltip derives `<id>.tooltip`.
|
|
47
|
+
- Without it, the wrapper keeps the default `overlay-trigger` and the tooltip keeps `tooltip`.
|
|
48
|
+
- See [Testing](foundations-testing.md) for when to use test IDs and how to name them.
|
|
49
|
+
|
|
44
50
|
### Related
|
|
45
51
|
|
|
46
52
|
- **[IconButton](components-buttons-iconbutton.md)**: use for icon-only actions that need their own accessible name.
|
|
@@ -68,12 +74,13 @@ import { TooltipTrigger } from "@maxio-com/react-ui-components";
|
|
|
68
74
|
| `autoHideMs` | `number` | no | - | Milliseconds after the overlay is automatically deactivated | TypeLiteral |
|
|
69
75
|
| `children` | `ReactNode` | yes | - | React children nodes | TypeLiteral |
|
|
70
76
|
| `className` | `string` | no | - | Class name for the main container | TypeLiteral |
|
|
77
|
+
| `data-testid` | `string` | no | `'overlay-trigger'` | Test ID set on the main container | TypeLiteral |
|
|
71
78
|
| `floatingElementOffset` | `number` | no | `5` | Floating element offset | TypeLiteral |
|
|
72
79
|
| `interactions` | `Interactions[]` | no | `['hover']` | Definition of interactions that manages displaying of overlay element | TypeLiteral |
|
|
73
80
|
| `isVisible` | `boolean` | no | - | Tooltip visibility state - use with useExternalState property | TypeLiteral |
|
|
74
81
|
| `maxWidth` | `number \| "none"` | no | `160` | Maximum tooltip container width in pixels | TypeLiteral |
|
|
75
82
|
| `onVisibilityUpdate` | `((isVisible: boolean) => void)` | no | - | Tooltip visibility state | TypeLiteral |
|
|
76
|
-
| `placement` | `"
|
|
83
|
+
| `placement` | `"left" \| "right" \| "top" \| "bottom" \| "left-start" \| "left-end" \| "right-start" \| "right-end" \| "top-start" \| "top-end" \| "bottom-start" \| "bottom-end"` | no | `right` | Overlay element placement | TypeLiteral |
|
|
77
84
|
| `renderContent` | `() => ReactNode` | yes | - | Tooltip content renderer | TypeLiteral |
|
|
78
85
|
| `size` | `"small" \| "regular"` | no | `regular` | Tooltip component size variant | TypeLiteral |
|
|
79
86
|
| `usePortal` | `boolean` | no | - | Render floating element in portal container | TypeLiteral |
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# Testing
|
|
2
|
+
|
|
3
|
+
Every component accepts a `data-testid` prop and sets it on its root element. Some components also derive IDs for their internal parts (rows, buttons) from it, so a test can reach them without knowing the component's markup.
|
|
4
|
+
|
|
5
|
+
## Who sets the IDs
|
|
6
|
+
|
|
7
|
+
The screen that uses the component sets the IDs. The design system never invents IDs for a screen: it only forwards the one you pass and derives the IDs of its own internal parts.
|
|
8
|
+
|
|
9
|
+
`data-testid` is optional. When you don't pass it, nothing is rendered (except the legacy defaults listed below).
|
|
10
|
+
|
|
11
|
+
## When to use a test ID
|
|
12
|
+
|
|
13
|
+
Prefer queries by role and accessible name (`getByRole('button', { name: 'Save' })`). They test what the user sees and fail when accessibility breaks.
|
|
14
|
+
|
|
15
|
+
Use `data-testid` when role and name are not enough:
|
|
16
|
+
|
|
17
|
+
- **Repeated elements**: several "Edit" buttons, one per row or card.
|
|
18
|
+
- **Icon-only buttons**: their accessible name is generic ("Close", "More").
|
|
19
|
+
- **Tables, tabs and pagination**: tests need a specific row, cell, tab or page control.
|
|
20
|
+
- **Copy that changes**: labels that product or translations change often.
|
|
21
|
+
|
|
22
|
+
Layout components (`Flex`, `Grid`, headings and body text) usually don't need a test ID.
|
|
23
|
+
|
|
24
|
+
## Naming
|
|
25
|
+
|
|
26
|
+
Use `<screen>.<element>[.<action>]`:
|
|
27
|
+
|
|
28
|
+
- Segments are kebab-case and joined with dots: `customer-details.invoices-table`, `customer-details.save`.
|
|
29
|
+
- IDs are unique on the page.
|
|
30
|
+
- Don't put generated values, positions or copy in the ID. Use the record's own ID instead: `invoices.table.row.inv_123`, not `invoices.table.row.3`.
|
|
31
|
+
|
|
32
|
+
## Derived IDs
|
|
33
|
+
|
|
34
|
+
When you pass `data-testid="<id>"`, these components also set IDs on their internal parts:
|
|
35
|
+
|
|
36
|
+
| Component | Root | Derived IDs |
|
|
37
|
+
| -------------- | ---------------------- | ---------------------------------------------------------------------------- |
|
|
38
|
+
| DataTable | Table wrapper | `<id>.header.<columnId>`, `<id>.row.<rowId>`, `<id>.cell.<rowId>.<columnId>` |
|
|
39
|
+
| Pagination | Pagination container | `<id>.prev`, `<id>.next` |
|
|
40
|
+
| Drawer | Drawer panel | `<id>.close` |
|
|
41
|
+
| Alert, Banner | Notification container | `<id>.dismiss` |
|
|
42
|
+
| Toast | Toast | `<testId>.dismiss` |
|
|
43
|
+
| ActionMenu | `Menu` | `<id>.trigger` (`MenuButton`), `<id>.list` (`MenuList`) |
|
|
44
|
+
| TooltipTrigger | Trigger wrapper | `<id>.tooltip` |
|
|
45
|
+
|
|
46
|
+
Notes:
|
|
47
|
+
|
|
48
|
+
- **DataTable**: `<rowId>` comes from `getRowId`. Without it, TanStack uses the row index, so pass `getRowId` to get stable IDs.
|
|
49
|
+
- **Tabs**: tabs and panels don't derive IDs, because they are only identified by position. Pass `data-testid` to each `Tab` or `TabPanel` a test needs to reach.
|
|
50
|
+
- **ActionMenu**: a `data-testid` on `MenuButton` or `MenuList` overrides the derived ID.
|
|
51
|
+
- **Toast and SideNav**: their content is passed as data, so they take a `testId` field instead of a `data-testid` prop.
|
|
52
|
+
|
|
53
|
+
## Examples
|
|
54
|
+
|
|
55
|
+
### Simple control
|
|
56
|
+
|
|
57
|
+
Set the ID on the control. Prefer `getByRole('textbox', { name: 'Email' })` when the label is stable.
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
screen.getByTestId('customer-form.email');
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Icon-only button
|
|
64
|
+
|
|
65
|
+
Its accessible name is generic, so a test ID tells it apart from other "Edit" buttons on the page.
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
screen.getByTestId('invoice-detail.edit');
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Table with rows
|
|
72
|
+
|
|
73
|
+
Pass `getRowId` so rows and cells use the record's ID.
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
screen.getByTestId('invoices.table.row.inv_123');
|
|
77
|
+
screen.getByTestId('invoices.table.cell.inv_123.amount');
|
|
78
|
+
screen.getByTestId('invoices.table.header.amount');
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Tabs
|
|
82
|
+
|
|
83
|
+
Set an ID on the container and on each tab or panel the test needs.
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
screen.getByTestId('customer-details.tabs.invoices');
|
|
87
|
+
screen.getByTestId('customer-details.tabs.invoices-panel');
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Pagination
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
screen.getByTestId('invoices.pagination.next');
|
|
94
|
+
screen.getByTestId('invoices.pagination.prev');
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Default IDs
|
|
98
|
+
|
|
99
|
+
Some components had hardcoded test IDs. They stay as defaults so existing tests keep working, and a passed ID overrides them:
|
|
100
|
+
|
|
101
|
+
| Component | Default ID | Override |
|
|
102
|
+
| ---------------- | ----------------------- | ------------------------------ |
|
|
103
|
+
| Toggle | `toggle-container` | `data-testid` |
|
|
104
|
+
| Tooltip | `tooltip` | `data-testid` |
|
|
105
|
+
| OverlayTrigger | `overlay-trigger` | `data-testid` |
|
|
106
|
+
| SideNav section | `maxio-sidebar-section` | `testId` on the section object |
|
|
107
|
+
| SideNav sub-item | `maxio-section-item` | `testId` on the item object |
|
|
108
|
+
|
|
109
|
+
## Imports
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
import {
|
|
113
|
+
DataTable,
|
|
114
|
+
Icon,
|
|
115
|
+
IconButton,
|
|
116
|
+
Pagination,
|
|
117
|
+
Tab,
|
|
118
|
+
TabList,
|
|
119
|
+
TabPanel,
|
|
120
|
+
TabPanels,
|
|
121
|
+
Tabs,
|
|
122
|
+
TextField,
|
|
123
|
+
} from "@maxio-com/react-ui-components";
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Stories
|
|
127
|
+
|
|
128
|
+
### Simple Control
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
const SimpleControl = () => <TextField label="Email" data-testid="customer-form.email" />;
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Icon Only Button
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
const IconOnlyButton = () => (
|
|
138
|
+
<IconButton
|
|
139
|
+
aria-label="Edit"
|
|
140
|
+
icon={<Icon variant="pen" />}
|
|
141
|
+
data-testid="invoice-detail.edit"
|
|
142
|
+
/>
|
|
143
|
+
);
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Table With Rows
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
const TableWithRows = () => (
|
|
150
|
+
<DataTable
|
|
151
|
+
data-testid="invoices.table"
|
|
152
|
+
columns={invoiceColumns}
|
|
153
|
+
data={invoices}
|
|
154
|
+
getRowId={(invoice) => invoice.id}
|
|
155
|
+
/>
|
|
156
|
+
);
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Tabs
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
const TabsWithIds = () => (
|
|
163
|
+
<Tabs data-testid="customer-details.tabs">
|
|
164
|
+
<TabList ariaLabel="Customer sections">
|
|
165
|
+
<Tab data-testid="customer-details.tabs.overview">Overview</Tab>
|
|
166
|
+
<Tab data-testid="customer-details.tabs.invoices">Invoices</Tab>
|
|
167
|
+
</TabList>
|
|
168
|
+
<TabPanels>
|
|
169
|
+
<TabPanel data-testid="customer-details.tabs.overview-panel">
|
|
170
|
+
Overview content
|
|
171
|
+
</TabPanel>
|
|
172
|
+
<TabPanel data-testid="customer-details.tabs.invoices-panel">
|
|
173
|
+
Invoices content
|
|
174
|
+
</TabPanel>
|
|
175
|
+
</TabPanels>
|
|
176
|
+
</Tabs>
|
|
177
|
+
);
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Pagination
|
|
181
|
+
|
|
182
|
+
```tsx
|
|
183
|
+
const PaginationWithIds = () => (
|
|
184
|
+
<Pagination
|
|
185
|
+
data-testid="invoices.pagination"
|
|
186
|
+
totalItems={125}
|
|
187
|
+
itemsPerPage={10}
|
|
188
|
+
pageSizeOptions={[10, 25, 50]}
|
|
189
|
+
/>
|
|
190
|
+
);
|
|
191
|
+
```
|
|
@@ -41,6 +41,12 @@ SideNav provides persistent application navigation for Maxio products.
|
|
|
41
41
|
- Use one active item at a time. If a child route is current, keep its parent section expanded or visually associated with the active child.
|
|
42
42
|
- Avoid using icons as the only way to identify a destination; labels should remain meaningful when icons are hidden.
|
|
43
43
|
|
|
44
|
+
### Testing
|
|
45
|
+
|
|
46
|
+
- Items are passed as data, so set the test ID with the `testId` field of each section or sub-item in `sections`.
|
|
47
|
+
- Without it, sections keep the default `maxio-sidebar-section` and sub-items keep `maxio-section-item`.
|
|
48
|
+
- See [Testing](foundations-testing.md) for when to use test IDs and how to name them.
|
|
49
|
+
|
|
44
50
|
### Related
|
|
45
51
|
|
|
46
52
|
- **[TopBar](patterns-top-bar.md)**: use for global utilities such as search, help, notifications, and profile actions.
|
|
@@ -79,6 +79,7 @@ import {
|
|
|
79
79
|
| --- | --- | --- | --- | --- | --- |
|
|
80
80
|
| `actions` | `ReactNode` | yes | - | Actions displayed on the right side of the top bar | TypeLiteral |
|
|
81
81
|
| `children` | `ReactNode` | no | - | Additional actions displayed in the middle of the top bar | TypeLiteral |
|
|
82
|
+
| `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
83
|
| `openSideNav` | `(() => void)` | no | - | Callback function to open the side navigation | TypeLiteral |
|
|
83
84
|
| `sideNavIsClosed` | `boolean` | no | - | Show/hide side navigation button | TypeLiteral |
|
|
84
85
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
import type { TestIdProps } from '../../../../utils/testId';
|
|
3
|
+
interface MenuProps extends TestIdProps {
|
|
3
4
|
children: ReactNode | (({ isOpen, onClose, }: {
|
|
4
5
|
isOpen: boolean;
|
|
5
6
|
onClose: () => void;
|
|
6
7
|
}) => ReactNode);
|
|
7
8
|
}
|
|
8
9
|
export declare const MenuWrapper: ({ children }: MenuProps) => React.JSX.Element;
|
|
9
|
-
declare const Menu: ({ children }: MenuProps) => React.JSX.Element;
|
|
10
|
+
declare const Menu: ({ children, "data-testid": testId }: MenuProps) => React.JSX.Element;
|
|
10
11
|
export default Menu;
|
|
11
12
|
//# sourceMappingURL=Menu.d.ts.map
|