@maxio-com/react-ui-components 9.16.0 → 9.17.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 +69 -0
- package/dist/skills/maxio-react/agents/openai.yaml +4 -0
- package/dist/skills/maxio-react/references/components-action-list.md +92 -0
- package/dist/skills/maxio-react/references/components-action-menu.md +162 -0
- package/dist/skills/maxio-react/references/components-avatar.md +66 -0
- package/dist/skills/maxio-react/references/components-breadcrumbs.md +86 -0
- package/dist/skills/maxio-react/references/components-buttons-button.md +170 -0
- package/dist/skills/maxio-react/references/components-buttons-iconbutton.md +102 -0
- package/dist/skills/maxio-react/references/components-card.md +175 -0
- package/dist/skills/maxio-react/references/components-chip.md +151 -0
- package/dist/skills/maxio-react/references/components-data-table.md +344 -0
- package/dist/skills/maxio-react/references/components-drawer.md +293 -0
- package/dist/skills/maxio-react/references/components-flex.md +185 -0
- package/dist/skills/maxio-react/references/components-forms-checkbox.md +257 -0
- package/dist/skills/maxio-react/references/components-forms-combobox.md +250 -0
- package/dist/skills/maxio-react/references/components-forms-radio-group.md +202 -0
- package/dist/skills/maxio-react/references/components-forms-select.md +295 -0
- package/dist/skills/maxio-react/references/components-forms-textarea.md +187 -0
- package/dist/skills/maxio-react/references/components-forms-textfield.md +254 -0
- package/dist/skills/maxio-react/references/components-grid.md +140 -0
- package/dist/skills/maxio-react/references/components-icon.md +169 -0
- package/dist/skills/maxio-react/references/components-link.md +180 -0
- package/dist/skills/maxio-react/references/components-listbox.md +205 -0
- package/dist/skills/maxio-react/references/components-loading-spinner.md +123 -0
- package/dist/skills/maxio-react/references/components-logo.md +91 -0
- package/dist/skills/maxio-react/references/components-notifications-alert.md +103 -0
- package/dist/skills/maxio-react/references/components-notifications-banner.md +173 -0
- package/dist/skills/maxio-react/references/components-notifications-toast.md +155 -0
- package/dist/skills/maxio-react/references/components-pagination.md +115 -0
- package/dist/skills/maxio-react/references/components-popover.md +176 -0
- package/dist/skills/maxio-react/references/components-progressbar.md +98 -0
- package/dist/skills/maxio-react/references/components-segmentedcontrol.md +292 -0
- package/dist/skills/maxio-react/references/components-tabs.md +193 -0
- package/dist/skills/maxio-react/references/components-tag.md +117 -0
- package/dist/skills/maxio-react/references/components-tile.md +114 -0
- package/dist/skills/maxio-react/references/components-toggle.md +218 -0
- package/dist/skills/maxio-react/references/components-tooltip.md +178 -0
- package/dist/skills/maxio-react/references/components-typography-body.md +101 -0
- package/dist/skills/maxio-react/references/components-typography-code.md +72 -0
- package/dist/skills/maxio-react/references/components-typography-display.md +91 -0
- package/dist/skills/maxio-react/references/components-typography-heading.md +88 -0
- package/dist/skills/maxio-react/references/components-typography-label.md +82 -0
- package/dist/skills/maxio-react/references/deprecated-textinput.md +250 -0
- package/dist/skills/maxio-react/references/foundations-dark-mode.md +85 -0
- package/dist/skills/maxio-react/references/foundations-design-tokens-about.md +108 -0
- package/dist/skills/maxio-react/references/foundations-design-tokens-colors-primitive-colors.md +33 -0
- package/dist/skills/maxio-react/references/foundations-design-tokens-colors-semantic-colors.md +11 -0
- package/dist/skills/maxio-react/references/foundations-start-here.md +128 -0
- package/dist/skills/maxio-react/references/patterns-auth-layout.md +318 -0
- package/dist/skills/maxio-react/references/patterns-side-nav.md +182 -0
- package/dist/skills/maxio-react/references/patterns-top-bar.md +214 -0
- package/package.json +2 -2
- package/typings/index.d.ts +15 -2
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# Link
|
|
2
|
+
|
|
3
|
+
## Usage Guidelines
|
|
4
|
+
|
|
5
|
+
### Overview
|
|
6
|
+
|
|
7
|
+
Link navigates users to another page, route, document, or external resource.
|
|
8
|
+
|
|
9
|
+
#### When to Use
|
|
10
|
+
|
|
11
|
+
- Use Link for navigation to another page, route, section, document, or external resource.
|
|
12
|
+
- Use Link inside body copy, tables, lists, and other text-heavy surfaces where the destination is part of the content.
|
|
13
|
+
- Use Link around a text component when the whole text element should navigate.
|
|
14
|
+
- Use an icon on a standalone link when it helps clarify destination behavior, such as an external link.
|
|
15
|
+
|
|
16
|
+
#### When Not to Use
|
|
17
|
+
|
|
18
|
+
- Do not use Link for actions that change data, open UI, submit a form, or run client-side behavior. Use Button instead.
|
|
19
|
+
- Do not use icon links inline with a sentence. Keep inline links text-only and underlined.
|
|
20
|
+
- Do not wrap multiple controls or large regions in a Link. Put the link on the specific text or destination label.
|
|
21
|
+
- Do not use vague link text such as "click here", "learn more", or a bare URL unless surrounding context supplies the accessible name.
|
|
22
|
+
|
|
23
|
+
### Variants
|
|
24
|
+
|
|
25
|
+
Choose the lowest emphasis that still makes the destination easy to find.
|
|
26
|
+
|
|
27
|
+
| Variants | Purpose | Usage notes |
|
|
28
|
+
| :-------------- | :----------------------------------------- | :--------------------------------------------------------------------------- |
|
|
29
|
+
| `primary` | Standard navigational emphasis. | Use for most standalone links and important destinations. |
|
|
30
|
+
| `secondary` | Reduced emphasis. | Use in dense interfaces, repeated rows, or when another action is primary. |
|
|
31
|
+
| `tertiary` | Lowest emphasis. | Use for supporting destinations that should remain visually quiet. |
|
|
32
|
+
| `high-contrast` | Stronger contrast on light neutral areas. | Use when the surrounding surface needs a more prominent text link. |
|
|
33
|
+
| `inverse` | Link styling for dark or branded surfaces. | Use only where inverse text is required for contrast against the background. |
|
|
34
|
+
|
|
35
|
+
### Behavior
|
|
36
|
+
|
|
37
|
+
- **Mouse and touch**: clicking or tapping follows the anchor `href`.
|
|
38
|
+
- **Keyboard**: native links with `href` receive focus in tab order and activate with Enter.
|
|
39
|
+
- **Focus management**: keep the visible focus ring intact and avoid moving focus before navigation starts.
|
|
40
|
+
- **External links**: use `external` for destinations that should open in a new tab, and make the destination clear from visible text.
|
|
41
|
+
- **Disabled styling**: disabled links are visually unavailable and have pointer events removed. Use this sparingly; if a destination is unavailable, consider hiding the link or explaining the requirement nearby.
|
|
42
|
+
|
|
43
|
+
### Accessibility
|
|
44
|
+
|
|
45
|
+
- Use native `a href` semantics for navigation so browser link behavior, context menus, and keyboard support are preserved.
|
|
46
|
+
- Give every link a clear accessible name that identifies the destination.
|
|
47
|
+
- Underline inline links so they are not communicated by color alone.
|
|
48
|
+
- Keep icons decorative unless they add meaning that is not already present in the visible text.
|
|
49
|
+
- Do not nest buttons, form controls, or other interactive elements inside a link.
|
|
50
|
+
- When composing disabled link states in HTML, pair visual styling with `aria-disabled="true"` and prevent activation in application logic.
|
|
51
|
+
|
|
52
|
+
### Content
|
|
53
|
+
|
|
54
|
+
- Write link text as a destination: "Customer profile", "Invoice settings", or "View revenue report".
|
|
55
|
+
- Keep link text concise while preserving enough context for screen reader link lists.
|
|
56
|
+
- Avoid repeating identical text for different destinations in the same view.
|
|
57
|
+
- For external links, include destination context in the label or adjacent copy.
|
|
58
|
+
|
|
59
|
+
### Related
|
|
60
|
+
|
|
61
|
+
- **[Button](components-buttons-button.md)**: use for actions that happen on the current page.
|
|
62
|
+
- **[IconButton](components-buttons-iconbutton.md)**: use for icon-only actions.
|
|
63
|
+
- **[Breadcrumbs](components-breadcrumbs.md)**: use for hierarchical page navigation.
|
|
64
|
+
|
|
65
|
+
## React
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
import { Link } from '@maxio-com/react-ui-components';
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Imports
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import { Body, Heading, Link } from "@maxio-com/react-ui-components";
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Prop Types
|
|
78
|
+
|
|
79
|
+
### Link
|
|
80
|
+
|
|
81
|
+
| Prop | Type | Required | Default | Description | Source |
|
|
82
|
+
| --- | --- | --- | --- | --- | --- |
|
|
83
|
+
| `children` | `ReactNode` | yes | - | The content of the link. | LinkProps |
|
|
84
|
+
| `className` | `string` | no | - | Additional CSS class names to apply | LinkProps |
|
|
85
|
+
| `disabled` | `boolean` | no | - | Defines whether the link is disabled. | LinkProps |
|
|
86
|
+
| `external` | `boolean` | no | - | Defines if the link is external. External links are opened in a new tab. | LinkProps |
|
|
87
|
+
| `icon` | `string` | no | - | Defines the icon variant. | LinkProps |
|
|
88
|
+
| `size` | `"sm" \| "md" \| "lg" \| "xs"` | no | `sm` | Defines the size of the link text. | LinkProps |
|
|
89
|
+
| `underline` | `boolean` | no | - | Applies underline style to the link | LinkProps |
|
|
90
|
+
| `variant` | `"primary" \| "secondary" \| "tertiary" \| "high-contrast" \| "inverse"` | no | - | Sets the link variant | LinkProps |
|
|
91
|
+
|
|
92
|
+
## Stories
|
|
93
|
+
|
|
94
|
+
### Default
|
|
95
|
+
|
|
96
|
+
Use the default Link for standalone navigation to another page, route, or resource. The visible text should name the destination instead of describing the gesture.
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
const Default = () => <Link underline={false} disabled={false} external={false} href="/customers">Customer profile</Link>;
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Component
|
|
103
|
+
|
|
104
|
+
Use Link around heading or text components when the whole text element is the navigation target. Avoid wrapping large interactive regions or nesting interactive controls inside the anchor.
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
const Component = () => <Link underline={false} disabled={false} external={false} href="#">
|
|
108
|
+
<Heading size="lg">Large heading</Heading>
|
|
109
|
+
</Link>;
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Icon
|
|
113
|
+
|
|
114
|
+
Use an icon only for standalone links where the icon reinforces destination behavior, such as opening an external resource. Do not use icon links inside sentences.
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
const Icon = () => <Link
|
|
118
|
+
underline
|
|
119
|
+
disabled={false}
|
|
120
|
+
external
|
|
121
|
+
href="https://www.maxio.com"
|
|
122
|
+
icon="arrow-up-right">Maxio</Link>;
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Inline
|
|
126
|
+
|
|
127
|
+
Use inline links inside body copy when the surrounding sentence supplies context. Underline inline links so they remain recognizable without relying on color alone.
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
const Inline = () => <Body size="md">Use an{' '}
|
|
131
|
+
<Link disabled={false} external={false} href="#" underline>underlined link
|
|
132
|
+
</Link>{' '}in sentences
|
|
133
|
+
</Body>;
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Variants
|
|
137
|
+
|
|
138
|
+
Use variants to tune link emphasis for the surrounding surface. Keep the meaning of the link in the label and choose the lowest emphasis that remains easy to find.
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
const Variants = () => <div style={{ display: 'flex', flexDirection: 'column', gap: '0.5rem' }}>
|
|
142
|
+
<Link
|
|
143
|
+
underline={false}
|
|
144
|
+
disabled={false}
|
|
145
|
+
external={false}
|
|
146
|
+
href="/reports/revenue"
|
|
147
|
+
variant="primary">Primary report link
|
|
148
|
+
</Link>
|
|
149
|
+
<Link
|
|
150
|
+
underline={false}
|
|
151
|
+
disabled={false}
|
|
152
|
+
external={false}
|
|
153
|
+
href="/reports/revenue"
|
|
154
|
+
variant="secondary">Secondary report link
|
|
155
|
+
</Link>
|
|
156
|
+
<Link
|
|
157
|
+
underline={false}
|
|
158
|
+
disabled={false}
|
|
159
|
+
external={false}
|
|
160
|
+
href="/reports/revenue"
|
|
161
|
+
variant="tertiary">Tertiary report link
|
|
162
|
+
</Link>
|
|
163
|
+
<Link
|
|
164
|
+
underline={false}
|
|
165
|
+
disabled={false}
|
|
166
|
+
external={false}
|
|
167
|
+
href="/reports/revenue"
|
|
168
|
+
variant="high-contrast">High-contrast report link
|
|
169
|
+
</Link>
|
|
170
|
+
<div style={{ background: '#111827', padding: '0.75rem' }}>
|
|
171
|
+
<Link
|
|
172
|
+
underline={false}
|
|
173
|
+
disabled={false}
|
|
174
|
+
external={false}
|
|
175
|
+
href="/reports/revenue"
|
|
176
|
+
variant="inverse">Inverse report link
|
|
177
|
+
</Link>
|
|
178
|
+
</div>
|
|
179
|
+
</div>;
|
|
180
|
+
```
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# ListBox
|
|
2
|
+
|
|
3
|
+
## Usage Guidelines
|
|
4
|
+
|
|
5
|
+
### Overview
|
|
6
|
+
|
|
7
|
+
#### When to Use
|
|
8
|
+
|
|
9
|
+
- Use ListBox for a compact set of related options where users choose one or more values.
|
|
10
|
+
- Use ListBox inside a Popover, Select-like picker, command surface, or custom filtering experience.
|
|
11
|
+
- Use sections when options need short group labels that help users scan the set.
|
|
12
|
+
|
|
13
|
+
#### When Not to Use
|
|
14
|
+
|
|
15
|
+
- Do not use ListBox for plain navigation. Use ActionList, SideNav, Tabs, or Link depending on the context.
|
|
16
|
+
- Do not use ListBox for native form dropdowns when a simple select is enough. Use Select instead.
|
|
17
|
+
- Do not use ListBox for standalone checklists where every option needs persistent visible controls. Use Checkbox instead.
|
|
18
|
+
|
|
19
|
+
### Behavior
|
|
20
|
+
|
|
21
|
+
- **Mouse and touch**: clicking or tapping an option moves selection to that option. Multi-select listboxes can keep several options selected.
|
|
22
|
+
- **Keyboard**: Tab moves focus into and out of the listbox. Arrow keys move between options, Enter or Space selects, Home and End move to the first or last option, and typeahead searches visible option text.
|
|
23
|
+
- **Focus management**: the focused option receives the visible focus ring. When ListBox is inside a Popover, return focus to the trigger when the popover closes.
|
|
24
|
+
- **Controlled state**: use `selectedKeys` and `onSelectionChange` when application state, form submission, or analytics need to know the current selection.
|
|
25
|
+
- **Empty state**: use `renderEmptyState` when filtering or loading leaves no available options.
|
|
26
|
+
|
|
27
|
+
### Accessibility
|
|
28
|
+
|
|
29
|
+
- Provide an accessible name with a visible label, `aria-label`, or `aria-labelledby`.
|
|
30
|
+
- Keep option labels concise and unique enough for typeahead and screen reader navigation.
|
|
31
|
+
- Use `selectionMode="multiple"` only when more than one selected option is meaningful, and keep selected state visually and programmatically clear.
|
|
32
|
+
- Do not rely on the checkmark alone to communicate selection; keep `aria-selected` synchronized through the React component.
|
|
33
|
+
- Use sections only when their headers help users understand the option set.
|
|
34
|
+
- Preserve the default keyboard navigation and focus indicators from React Aria.
|
|
35
|
+
|
|
36
|
+
### Content
|
|
37
|
+
|
|
38
|
+
- Use option labels that match the value users are choosing, such as plan names, statuses, or account types.
|
|
39
|
+
- Keep section headers short nouns or noun phrases: "Popular", "Archived", "Payment methods".
|
|
40
|
+
- Use empty-state copy that explains the current result, such as "No results found."
|
|
41
|
+
- Avoid long instructional text inside options; put guidance in the field label, helper text, or surrounding UI.
|
|
42
|
+
|
|
43
|
+
### Related
|
|
44
|
+
|
|
45
|
+
- **[Select](components-forms-select.md)**: use for native dropdown form controls.
|
|
46
|
+
- **[ActionList](components-action-list.md)**: use for compact action or destination lists.
|
|
47
|
+
- **[Popover](components-popover.md)**: use when the listbox appears in an overlay triggered by another control.
|
|
48
|
+
- **[Checkbox](components-forms-checkbox.md)**: use for visible standalone multi-selection.
|
|
49
|
+
|
|
50
|
+
## React
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import { ListBox } from '@maxio-com/react-ui-components';
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## State Management
|
|
57
|
+
|
|
58
|
+
Use `defaultSelectedKeys` when the initial selection can be owned by the
|
|
59
|
+
listbox. Use `selectedKeys` with `onSelectionChange` when product logic needs
|
|
60
|
+
to validate, submit, persist, or share the selected option.
|
|
61
|
+
|
|
62
|
+
### Controlled
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
const [selectedKeys, setSelectedKeys] = React.useState(() => new Set(['cat']));
|
|
66
|
+
|
|
67
|
+
<ListBox
|
|
68
|
+
aria-label="Favorite animal"
|
|
69
|
+
selectionMode="single"
|
|
70
|
+
selectedKeys={selectedKeys}
|
|
71
|
+
onSelectionChange={(keys) =>
|
|
72
|
+
setSelectedKeys(keys === 'all' ? new Set() : (keys as Set<string>))
|
|
73
|
+
}
|
|
74
|
+
>
|
|
75
|
+
<ListBox.Item id="aardvark">Aardvark</ListBox.Item>
|
|
76
|
+
<ListBox.Item id="cat">Cat</ListBox.Item>
|
|
77
|
+
<ListBox.Item id="dog">Dog</ListBox.Item>
|
|
78
|
+
</ListBox>;
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Uncontrolled
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
<ListBox
|
|
85
|
+
aria-label="Favorite animal"
|
|
86
|
+
selectionMode="single"
|
|
87
|
+
defaultSelectedKeys={['cat']}
|
|
88
|
+
>
|
|
89
|
+
<ListBox.Item id="aardvark">Aardvark</ListBox.Item>
|
|
90
|
+
<ListBox.Item id="cat">Cat</ListBox.Item>
|
|
91
|
+
<ListBox.Item id="dog">Dog</ListBox.Item>
|
|
92
|
+
</ListBox>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Imports
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
import { Button, DialogTrigger, ListBox, Popover } from "@maxio-com/react-ui-components";
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Stories
|
|
102
|
+
|
|
103
|
+
### Default
|
|
104
|
+
|
|
105
|
+
Use ListBox when users need to choose one option from a compact set. Provide a visible label near the control or an `aria-label` when the label is supplied by surrounding UI.
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
const Default = () => <ListBox
|
|
109
|
+
aria-label="Favorite animal"
|
|
110
|
+
selectionMode="single"
|
|
111
|
+
shouldFocusWrap={false}
|
|
112
|
+
disallowEmptySelection={false}>
|
|
113
|
+
<ListBox.Item id="aardvark">Aardvark</ListBox.Item>
|
|
114
|
+
<ListBox.Item id="cat">Cat</ListBox.Item>
|
|
115
|
+
<ListBox.Item id="dog">Dog</ListBox.Item>
|
|
116
|
+
</ListBox>;
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Multi Select
|
|
120
|
+
|
|
121
|
+
Use multiple selection when users can keep more than one option active at a time. Keep selected option state synchronized with `aria-selected`.
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
const MultiSelect = () => (
|
|
125
|
+
<ListBox aria-label="Pick toppings" selectionMode="multiple">
|
|
126
|
+
<ListBox.Item id="lettuce">Lettuce</ListBox.Item>
|
|
127
|
+
<ListBox.Item id="tomato">Tomato</ListBox.Item>
|
|
128
|
+
<ListBox.Item id="onion">Onion</ListBox.Item>
|
|
129
|
+
</ListBox>
|
|
130
|
+
);
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### With Sections
|
|
134
|
+
|
|
135
|
+
Use sections to group long option sets under short, scannable headers. Headers should describe the relationship between the options that follow.
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
const WithSections = () => (
|
|
139
|
+
<ListBox aria-label="Grouped options" selectionMode="single">
|
|
140
|
+
<ListBox.Section>
|
|
141
|
+
<ListBox.Header>Popular</ListBox.Header>
|
|
142
|
+
<ListBox.Item id="one">First</ListBox.Item>
|
|
143
|
+
<ListBox.Item id="two">Second</ListBox.Item>
|
|
144
|
+
</ListBox.Section>
|
|
145
|
+
<ListBox.Section>
|
|
146
|
+
<ListBox.Header>More</ListBox.Header>
|
|
147
|
+
<ListBox.Item id="three">Third</ListBox.Item>
|
|
148
|
+
</ListBox.Section>
|
|
149
|
+
</ListBox>
|
|
150
|
+
);
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### In Popover
|
|
154
|
+
|
|
155
|
+
Use ListBox inside Popover for picker or menu-like controls where the trigger opens a bounded option set. Return focus to the trigger when the popover closes.
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
const InPopover = () => {
|
|
159
|
+
const [selected, setSelected] = useState(() => new Set<string>());
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<DialogTrigger>
|
|
163
|
+
<Button variant="secondary" size="md">
|
|
164
|
+
Choose an option
|
|
165
|
+
</Button>
|
|
166
|
+
<Popover placement="bottom start" hideArrow>
|
|
167
|
+
<ListBox
|
|
168
|
+
aria-label="Grouped options"
|
|
169
|
+
selectionMode="single"
|
|
170
|
+
selectedKeys={selected}
|
|
171
|
+
onSelectionChange={(keys) =>
|
|
172
|
+
setSelected(keys === 'all' ? new Set() : (keys as Set<string>))
|
|
173
|
+
}
|
|
174
|
+
>
|
|
175
|
+
<ListBox.Section>
|
|
176
|
+
<ListBox.Header>Popular</ListBox.Header>
|
|
177
|
+
<ListBox.Item id="one">First</ListBox.Item>
|
|
178
|
+
<ListBox.Item id="two">Second</ListBox.Item>
|
|
179
|
+
</ListBox.Section>
|
|
180
|
+
<ListBox.Section>
|
|
181
|
+
<ListBox.Header>More</ListBox.Header>
|
|
182
|
+
<ListBox.Item id="three">Third</ListBox.Item>
|
|
183
|
+
</ListBox.Section>
|
|
184
|
+
</ListBox>
|
|
185
|
+
</Popover>
|
|
186
|
+
</DialogTrigger>
|
|
187
|
+
);
|
|
188
|
+
};
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Empty State
|
|
192
|
+
|
|
193
|
+
Use an empty state when filtering or async loading leaves no options to select. Keep the message brief and avoid rendering disabled placeholder options.
|
|
194
|
+
|
|
195
|
+
```tsx
|
|
196
|
+
const EmptyState = () => (
|
|
197
|
+
<ListBox
|
|
198
|
+
aria-label="Grouped options"
|
|
199
|
+
selectionMode="single"
|
|
200
|
+
renderEmptyState={() => 'No results found.'}
|
|
201
|
+
>
|
|
202
|
+
{[]}
|
|
203
|
+
</ListBox>
|
|
204
|
+
);
|
|
205
|
+
```
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# LoadingSpinner
|
|
2
|
+
|
|
3
|
+
## Usage Guidelines
|
|
4
|
+
|
|
5
|
+
### Overview
|
|
6
|
+
|
|
7
|
+
LoadingSpinner communicates indeterminate progress for short waits where the exact completion percentage is unknown.
|
|
8
|
+
|
|
9
|
+
#### When to Use
|
|
10
|
+
|
|
11
|
+
- Use LoadingSpinner for indeterminate work where the system is waiting but cannot report a percentage.
|
|
12
|
+
- Use LoadingSpinner near the content, control, or region that is temporarily unavailable.
|
|
13
|
+
- Use the white spinner when the indicator sits on a dark or brand-filled surface.
|
|
14
|
+
|
|
15
|
+
#### When Not to Use
|
|
16
|
+
|
|
17
|
+
- Do not use LoadingSpinner for known progress values. Use ProgressBar instead.
|
|
18
|
+
- Do not use a standalone spinner for a button action that is already represented by a loading Button.
|
|
19
|
+
- Do not use LoadingSpinner as a long-term empty state. Pair longer waits with visible status text or a more descriptive loading pattern.
|
|
20
|
+
|
|
21
|
+
### Variants
|
|
22
|
+
|
|
23
|
+
| Variant | Purpose | Usage notes |
|
|
24
|
+
| :------ | :------------------- | :---------------------------------------------------------------------- |
|
|
25
|
+
| `size` | Sets visual scale. | Use `sm` or `md` in compact UI, and `lg` or `xl` for larger containers. |
|
|
26
|
+
| `white` | Inverts the artwork. | Use only on dark or brand-filled backgrounds. |
|
|
27
|
+
|
|
28
|
+
### Behavior
|
|
29
|
+
|
|
30
|
+
- **Mouse and touch**: LoadingSpinner is not interactive and should not receive pointer handlers.
|
|
31
|
+
- **Keyboard**: LoadingSpinner is not focusable. Keep focus on the control or region that started the work.
|
|
32
|
+
- **Persistence**: show the spinner only while the related work is actively pending, then replace it with the loaded content or next state.
|
|
33
|
+
|
|
34
|
+
### Accessibility
|
|
35
|
+
|
|
36
|
+
- Keep `role="status"` and an accessible label when the spinner communicates loading state on its own.
|
|
37
|
+
- Add nearby visible status text when the wait is long, page-wide, or affects a large region.
|
|
38
|
+
- Do not rely on animation alone to explain what is happening.
|
|
39
|
+
- Use `aria-hidden="true"` only when another nearby status label or control already communicates the loading state.
|
|
40
|
+
|
|
41
|
+
### Content
|
|
42
|
+
|
|
43
|
+
- Keep loading labels short and specific, such as "Loading invoices" or "Saving changes".
|
|
44
|
+
- Match the status text to the thing that is pending.
|
|
45
|
+
- Avoid vague copy like "Please wait" when the product can say what is loading.
|
|
46
|
+
|
|
47
|
+
### Related
|
|
48
|
+
|
|
49
|
+
- **[ProgressBar](components-progressbar.md)**: use for determinate progress with a known value.
|
|
50
|
+
- **[Button](components-buttons-button.md)**: use the loading button state when progress is tied to a button action.
|
|
51
|
+
|
|
52
|
+
## React
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import { LoadingSpinner } from '@maxio-com/react-ui-components';
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Imports
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import { LoadingSpinner } from "@maxio-com/react-ui-components";
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Prop Types
|
|
65
|
+
|
|
66
|
+
### LoadingSpinner
|
|
67
|
+
|
|
68
|
+
| Prop | Type | Required | Default | Description | Source |
|
|
69
|
+
| --- | --- | --- | --- | --- | --- |
|
|
70
|
+
| `className` | `string` | no | - | Class name for the main container | TypeLiteral |
|
|
71
|
+
| `size` | `"sm" \| "md" \| "lg" \| "xl"` | no | `md` | The size of the loading spinner | TypeLiteral |
|
|
72
|
+
| `white` | `boolean` | no | `false` | Changes color of the spinner to white for use on dark backgrounds. | TypeLiteral |
|
|
73
|
+
|
|
74
|
+
## Stories
|
|
75
|
+
|
|
76
|
+
### Default
|
|
77
|
+
|
|
78
|
+
Use LoadingSpinner when a local region or control is waiting on background work and the completion percentage is unknown.
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
const Default = ({ white, ...props }) => (
|
|
82
|
+
<div
|
|
83
|
+
style={{
|
|
84
|
+
backgroundColor: white ? '#777' : 'white',
|
|
85
|
+
padding: '1rem',
|
|
86
|
+
}}
|
|
87
|
+
>
|
|
88
|
+
<LoadingSpinner {...props} white={white} />
|
|
89
|
+
</div>
|
|
90
|
+
);
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### On Dark Background
|
|
94
|
+
|
|
95
|
+
Use the white spinner on dark or brand-filled surfaces so the indicator keeps enough contrast with its container.
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
const OnDarkBackground = () => <div
|
|
99
|
+
style={{
|
|
100
|
+
backgroundColor: '#1f2937',
|
|
101
|
+
padding: '1rem',
|
|
102
|
+
}}>
|
|
103
|
+
<LoadingSpinner size="md" white />
|
|
104
|
+
</div>;
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Sizes
|
|
108
|
+
|
|
109
|
+
Choose the smallest spinner that remains visible in context. Use larger sizes for page or panel loading states, and smaller sizes inside compact controls.
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
const Sizes = () => <div
|
|
113
|
+
style={{
|
|
114
|
+
alignItems: 'center',
|
|
115
|
+
display: 'flex',
|
|
116
|
+
gap: '1rem',
|
|
117
|
+
}}>
|
|
118
|
+
<LoadingSpinner size="sm" white={white} />
|
|
119
|
+
<LoadingSpinner size="md" white={white} />
|
|
120
|
+
<LoadingSpinner size="lg" white={white} />
|
|
121
|
+
<LoadingSpinner size="xl" white={white} />
|
|
122
|
+
</div>;
|
|
123
|
+
```
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# LogoComponent
|
|
2
|
+
|
|
3
|
+
## Usage Guidelines
|
|
4
|
+
|
|
5
|
+
### Overview
|
|
6
|
+
|
|
7
|
+
Logo renders the Maxio brand lockup or mark.
|
|
8
|
+
|
|
9
|
+
#### When to Use
|
|
10
|
+
|
|
11
|
+
- Use Logo in persistent brand areas such as top bars, side navigation, and authentication layouts.
|
|
12
|
+
- Use Logo when the interface needs to identify the current product or confirm that the user is in a Maxio-owned experience.
|
|
13
|
+
- Use the mark when horizontal space is constrained or a full lockup is already visible nearby.
|
|
14
|
+
|
|
15
|
+
#### When Not to Use
|
|
16
|
+
|
|
17
|
+
- Do not use Logo as a decorative illustration or repeated background element.
|
|
18
|
+
- Do not use the mark when users need the full brand name and there is enough room for the lockup.
|
|
19
|
+
- Do not make the SVG itself interactive. Wrap it in a semantic link or button when it needs to navigate or trigger behavior.
|
|
20
|
+
|
|
21
|
+
### Variants
|
|
22
|
+
|
|
23
|
+
| Variant | Purpose | Usage notes |
|
|
24
|
+
| :------- | :----------------------- | :------------------------------------------------------------------------------------------ |
|
|
25
|
+
| `lockup` | Full Maxio brand lockup. | Use by default when there is enough horizontal space and the brand name should be readable. |
|
|
26
|
+
| `mark` | Square Maxio brand mark. | Use in compact navigation, favicons, avatars, or places where the lockup appears nearby. |
|
|
27
|
+
|
|
28
|
+
### Accessibility
|
|
29
|
+
|
|
30
|
+
- Logo renders as an inline SVG with `role="img"` and `aria-label`.
|
|
31
|
+
- Keep the `alt` value short and contextual. Use "Maxio" when the logo identifies the brand.
|
|
32
|
+
- When the logo links to home, wrap it in an `<a href="...">` and give the link an accessible name such as "Maxio home".
|
|
33
|
+
- Do not rely on the logo color alone to communicate state or status.
|
|
34
|
+
- Keep the logo visible against the selected theme background and preserve the dark mode theme attribute on the surrounding container.
|
|
35
|
+
|
|
36
|
+
## React
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { Logo } from '@maxio-com/react-ui-components';
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Imports
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
import { LogoComponent } from "@maxio-com/react-ui-components";
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Prop Types
|
|
49
|
+
|
|
50
|
+
### Logo
|
|
51
|
+
|
|
52
|
+
| Prop | Type | Required | Default | Description | Source |
|
|
53
|
+
| --- | --- | --- | --- | --- | --- |
|
|
54
|
+
| `alt` | `string` | no | - | The alt text of the logo | TypeLiteral |
|
|
55
|
+
| `className` | `string` | no | - | Class name for the svg element of the logo | TypeLiteral |
|
|
56
|
+
| `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
|
+
| `variant` | `"mark" \| "lockup"` | no | - | Variant of the logo, by default uses 'lockup' | TypeLiteral |
|
|
58
|
+
|
|
59
|
+
## Stories
|
|
60
|
+
|
|
61
|
+
### Default
|
|
62
|
+
|
|
63
|
+
Use the default lockup when there is enough horizontal space for the full Maxio identity, such as app headers, login screens, or branded empty states.
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
const Default = () => <LogoComponent alt="Maxio" />;
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Default (Dark)
|
|
70
|
+
|
|
71
|
+
Use the default lockup in dark mode without changing props. The logo fill is handled by the surrounding `data-maxio-mode="dark"` theme context.
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
const DefaultDark = () => <LogoComponent alt="Maxio" />;
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Logo as Mark
|
|
78
|
+
|
|
79
|
+
Use the mark where horizontal space is constrained or the brand lockup is already present nearby. Pair it with accessible text when it acts as a home link.
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
const LogoAsMark = () => <LogoComponent variant="mark" alt="Maxio" />;
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Custom Size
|
|
86
|
+
|
|
87
|
+
Use a custom numeric size only when a standard token size cannot align with the surrounding layout. Prefer `sm`, `md`, or `lg` for most product surfaces.
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
const CustomSize = () => <LogoComponent alt="Maxio" size={100} />;
|
|
91
|
+
```
|