@maxio-com/react-ui-components 9.15.0 → 9.16.1
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 +68 -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-textfield.md +253 -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 +24 -4
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
> Deprecated: use this reference only when maintaining existing legacy UI or intentionally matching legacy behavior.
|
|
2
|
+
|
|
3
|
+
# TextInput
|
|
4
|
+
|
|
5
|
+
## Usage Guidelines
|
|
6
|
+
|
|
7
|
+
### Overview
|
|
8
|
+
|
|
9
|
+
TextInput lets users enter or edit a short, single-line text value in a form.
|
|
10
|
+
|
|
11
|
+
#### When to Use
|
|
12
|
+
|
|
13
|
+
- Use only when maintaining existing TextInput implementations that cannot be migrated immediately.
|
|
14
|
+
- Use when users need to enter a short, single-line value in a legacy form.
|
|
15
|
+
- Use helper text when users need a format hint, example, or constraint before they type.
|
|
16
|
+
- Use leading or trailing content for simple visual context, units, prefixes, suffixes, or a small field-level action.
|
|
17
|
+
|
|
18
|
+
#### When Not to Use
|
|
19
|
+
|
|
20
|
+
- Do not use for new React implementation. Use [TextField](components-forms-textfield.md) instead.
|
|
21
|
+
- Do not use for long-form or multi-line writing. Use a textarea pattern instead.
|
|
22
|
+
- Do not use when users must choose from a known list. Use Select for short lists or ComboBox when filtering helps.
|
|
23
|
+
- Do not use placeholder text as the only label. Provide a visible `label` whenever possible.
|
|
24
|
+
- Do not use for actions or navigation. Use Button, IconButton, or Link instead.
|
|
25
|
+
|
|
26
|
+
### Variants
|
|
27
|
+
|
|
28
|
+
| Variants | Purpose | Usage notes |
|
|
29
|
+
| :------- | :------------------------------------ | :--------------------------------------------------------- |
|
|
30
|
+
| `sm` | Compact field for dense interfaces. | Use where form density is high and labels remain readable. |
|
|
31
|
+
| `md` | Default field size. | Use for most legacy TextInput forms. |
|
|
32
|
+
| `lg` | Larger field for prominent form rows. | Use sparingly when the field needs more visual emphasis. |
|
|
33
|
+
| `xl` | Field with contained label treatment. | Use when matching an existing legacy form layout. |
|
|
34
|
+
|
|
35
|
+
### Behavior
|
|
36
|
+
|
|
37
|
+
- **Mouse and touch**: Users can place the cursor in the field, select text, and activate any nested trailing or leading action independently.
|
|
38
|
+
- **Keyboard**: Users tab to the input, type or edit the value, and use native text editing shortcuts.
|
|
39
|
+
- **Focus management**: Focus lands on the native input. Leading or trailing actions that are interactive should have their own accessible name and keyboard behavior.
|
|
40
|
+
- **Controlled state**: Use `value` and `onChange` when product state owns the value. Use `defaultValue` for simple uncontrolled form fields.
|
|
41
|
+
- **Validation**: Show validation after users submit, blur the field, or otherwise finish interacting. Avoid showing errors before users have a chance to enter a value.
|
|
42
|
+
|
|
43
|
+
### Accessibility
|
|
44
|
+
|
|
45
|
+
- Provide a visible `label` whenever possible. Use `aria-label` or `aria-labelledby` only when a visible label is not available.
|
|
46
|
+
- Use `helperText` for guidance and `errorMessage` with `invalid` for validation feedback.
|
|
47
|
+
- Pair invalid values with `invalid` and an actionable `errorMessage`.
|
|
48
|
+
- Use native text-like `type` values so browsers can expose the right keyboard, autocomplete, and validation behavior.
|
|
49
|
+
- Keep disabled fields out of the editing flow only when users cannot act on them. Use read-only fields when the value should remain focusable or copyable.
|
|
50
|
+
- Do not rely on color alone to communicate validation, disabled, or read-only state.
|
|
51
|
+
|
|
52
|
+
### Content
|
|
53
|
+
|
|
54
|
+
- Write labels as short nouns, such as "Customer name", "Email address", or "Invoice prefix".
|
|
55
|
+
- Use placeholder text for examples, not instructions that replace the label.
|
|
56
|
+
- Use helper text for constraints that prevent errors, such as expected format, length, or source of the value.
|
|
57
|
+
- Write error messages that name the problem and recovery step, such as "Enter a valid email address."
|
|
58
|
+
- Mark optional fields only when the form otherwise implies fields are required.
|
|
59
|
+
|
|
60
|
+
### Related
|
|
61
|
+
|
|
62
|
+
- **[TextField](components-forms-textfield.md)**: preferred replacement for TextInput in new React usage.
|
|
63
|
+
- **[Select](components-forms-select.md)**: use when users choose from a shorter closed list.
|
|
64
|
+
- **[ComboBox](components-forms-combobox.md)**: use when users choose from a list and typing should filter options.
|
|
65
|
+
- **[IconButton](components-buttons-iconbutton.md)**: use for compact actions inside trailing or leading content.
|
|
66
|
+
|
|
67
|
+
## React
|
|
68
|
+
|
|
69
|
+
TextInput is deprecated. Use TextField for new React usage.
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { TextInput } from '@maxio-com/react-ui-components';
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
TextInput accepts text input props and renders a single native input. Use
|
|
76
|
+
`leadingElement` or `trailingElement` for compact field-level context or
|
|
77
|
+
actions, and give interactive elements their own accessible names.
|
|
78
|
+
|
|
79
|
+
## State Management
|
|
80
|
+
|
|
81
|
+
Use controlled state when product logic needs to validate, transform, save, or share the current value. TextInput's `onChange` callback receives the next string value.
|
|
82
|
+
|
|
83
|
+
### Controlled
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
const [value, setValue] = React.useState('');
|
|
87
|
+
|
|
88
|
+
<TextInput label="Customer name" value={value} onChange={setValue} />;
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Uncontrolled
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
<TextInput
|
|
95
|
+
label="Customer name"
|
|
96
|
+
defaultValue="Acme Co."
|
|
97
|
+
onChange={(value) => console.log(value)}
|
|
98
|
+
/>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Imports
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
import { Body, Icon, IconButton, TextInput } from "@maxio-com/react-ui-components";
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Prop Types
|
|
108
|
+
|
|
109
|
+
### TextInput
|
|
110
|
+
|
|
111
|
+
| Prop | Type | Required | Default | Description | Source |
|
|
112
|
+
| --- | --- | --- | --- | --- | --- |
|
|
113
|
+
| `disabled` | `boolean` | no | `false` | Disable the text input | TextInputProps |
|
|
114
|
+
| `errorMessage` | `string` | no | - | Error message for the text input | TextInputProps |
|
|
115
|
+
| `fullWidth` | `boolean` | no | - | Ensures the input spans the full width of its parent | TextInputProps |
|
|
116
|
+
| `helperText` | `string` | no | - | Helper text for the text input. It will not be visible if there is an error message. | TextInputProps |
|
|
117
|
+
| `invalid` | `boolean` | no | `false` | Invalid state of the text input | TextInputProps |
|
|
118
|
+
| `label` | `string` | no | - | Label for the text input | TextInputProps |
|
|
119
|
+
| `leadingElement` | `ReactNode` | no | `null` | Leading element for the text input | TextInputProps |
|
|
120
|
+
| `onChange` | `(value: string) => void` | yes | - | Callback function for the text input change | TextInputProps |
|
|
121
|
+
| `readOnly` | `boolean` | no | `false` | - | TextInputProps |
|
|
122
|
+
| `showErrorMessage` | `boolean` | no | `true` | Show error message | TextInputProps |
|
|
123
|
+
| `size` | `"sm" \| "md" \| "lg" \| "xl"` | no | `md` | Size of the text input | TextInputProps |
|
|
124
|
+
| `trailingElement` | `ReactNode` | no | `null` | Trailing element for the text input | TextInputProps |
|
|
125
|
+
|
|
126
|
+
## Stories
|
|
127
|
+
|
|
128
|
+
### Default
|
|
129
|
+
|
|
130
|
+
TextInput is deprecated; use TextField for new React usage. Keep existing TextInput usage labeled, and use placeholder text only as an example of the expected value.
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
const Default = () => <TextInput
|
|
134
|
+
label="Customer name"
|
|
135
|
+
placeholder="Acme Co."
|
|
136
|
+
onChange={action('onChange')} />;
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### With Helper Text
|
|
140
|
+
|
|
141
|
+
Use helper text for format hints, examples, or constraints that help users enter a valid value before validation runs.
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
const WithHelperText = () => <TextInput
|
|
145
|
+
label="Invoice prefix"
|
|
146
|
+
placeholder="INV"
|
|
147
|
+
helperText="Use 2-5 letters that identify this invoice series."
|
|
148
|
+
onChange={action('onChange')} />;
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### With Icon
|
|
152
|
+
|
|
153
|
+
Use an icon when existing TextInput usage benefits from compact visual context. Keep the icon decorative unless it is exposed through an interactive element.
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
const WithIcon = () => <TextInput
|
|
157
|
+
label="Signature"
|
|
158
|
+
placeholder="John Hancock"
|
|
159
|
+
onChange={action('onChange')}
|
|
160
|
+
leadingElement={<Icon variant="signature" />} />;
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### With Text
|
|
164
|
+
|
|
165
|
+
Use leading or trailing text for compact units, prefixes, suffixes, or other field-level context in existing TextInput forms.
|
|
166
|
+
|
|
167
|
+
```tsx
|
|
168
|
+
const WithText = () => <TextInput
|
|
169
|
+
label="Price"
|
|
170
|
+
placeholder="1.00"
|
|
171
|
+
onChange={action('onChange')}
|
|
172
|
+
leadingElement={<Body size="sm">€</Body>}
|
|
173
|
+
trailingElement={<Body size="sm">EUR</Body>} />;
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Validation
|
|
177
|
+
|
|
178
|
+
Use invalid with errorMessage so assistive technology receives invalid state and users get actionable validation feedback.
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
const Validation = () => <TextInput
|
|
182
|
+
label="Email address"
|
|
183
|
+
placeholder="billing@example.com"
|
|
184
|
+
type="email"
|
|
185
|
+
invalid
|
|
186
|
+
errorMessage="Enter a valid email address."
|
|
187
|
+
onChange={action('onChange')} />;
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Disabled
|
|
191
|
+
|
|
192
|
+
Use disabled fields when the value is unavailable and users cannot act on it in the current context.
|
|
193
|
+
|
|
194
|
+
```tsx
|
|
195
|
+
const Disabled = () => <TextInput
|
|
196
|
+
label="Billing contact"
|
|
197
|
+
placeholder="Select an account first"
|
|
198
|
+
disabled
|
|
199
|
+
onChange={action('onChange')} />;
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Read Only
|
|
203
|
+
|
|
204
|
+
Use read-only fields when the value should remain selectable and readable but cannot be edited.
|
|
205
|
+
|
|
206
|
+
```tsx
|
|
207
|
+
const ReadOnly = () => <TextInput
|
|
208
|
+
label="Account ID"
|
|
209
|
+
value="acct_12345"
|
|
210
|
+
readOnly
|
|
211
|
+
onChange={action('onChange')} />;
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### With Leading Element
|
|
215
|
+
|
|
216
|
+
Use an interactive leading element when legacy TextInput usage needs a compact action inside the input. Match the IconButton size to the input size.
|
|
217
|
+
|
|
218
|
+
```tsx
|
|
219
|
+
const WithLeadingElement = () => <TextInput
|
|
220
|
+
label="Date"
|
|
221
|
+
placeholder="mm/dd/yyyy"
|
|
222
|
+
onChange={action('onChange')}
|
|
223
|
+
leadingElement={
|
|
224
|
+
<IconButton
|
|
225
|
+
icon={<Icon variant="calendar" />}
|
|
226
|
+
variant="ghost"
|
|
227
|
+
size="sm"
|
|
228
|
+
aria-label="Select a date"
|
|
229
|
+
/>
|
|
230
|
+
} />;
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### With Trailing Element
|
|
234
|
+
|
|
235
|
+
Use an interactive trailing element when the field needs a compact action inside the input. Give the action its own accessible name.
|
|
236
|
+
|
|
237
|
+
```tsx
|
|
238
|
+
const WithTrailingElement = () => <TextInput
|
|
239
|
+
label="Password"
|
|
240
|
+
type="password"
|
|
241
|
+
onChange={action('onChange')}
|
|
242
|
+
trailingElement={
|
|
243
|
+
<IconButton
|
|
244
|
+
icon={<Icon variant="eye" />}
|
|
245
|
+
variant="ghost"
|
|
246
|
+
size="sm"
|
|
247
|
+
aria-label="Password shown"
|
|
248
|
+
/>
|
|
249
|
+
} />;
|
|
250
|
+
```
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Dark Mode
|
|
2
|
+
|
|
3
|
+
The dark mode is a feature that allows you to switch between a light and dark theme in a per-component basis. The consistency of the dark mode is important for the user experience—that's why we rely on the semantic design tokens.
|
|
4
|
+
|
|
5
|
+
To learn more about how the design tokens are implemented to achieve this, please refer to the [Design Tokens Repository](https://github.com/maxio-com/front-end-platform/blob/main/packages/design-tokens/README.md#dark-mode) documentation.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
To enable the dark mode, you need to add the `data-maxio-mode="dark"` attribute to the root element of your component.
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<div data-maxio-mode="dark">
|
|
13
|
+
<!-- Your component here -->
|
|
14
|
+
</div>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
OR
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<button class="maxio-button maxio-button--primary" data-maxio-mode="dark">
|
|
21
|
+
Click me
|
|
22
|
+
</button>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
To enforce light mode, you can use the `data-maxio-mode="light"` attribute.
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<button class="maxio-button maxio-button--primary" data-maxio-mode="light">
|
|
29
|
+
Click me
|
|
30
|
+
</button>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Dark Mode in Storybook
|
|
34
|
+
|
|
35
|
+
You can control the mode in Storybook via theme addon on the top left corner of the preview window. Try it now.
|
|
36
|
+
|
|
37
|
+
**Example:**
|
|
38
|
+
|
|
39
|
+
## Nesting Components
|
|
40
|
+
|
|
41
|
+
When you have a component that contains other components, you can nest the dark mode attribute to the root element of the child component.
|
|
42
|
+
In regular conditions, all your child components will inherit the dark mode from the parent component. However, you can force a child component to use a different mode by adding the `data-maxio-mode` attribute to the root element of the child component.
|
|
43
|
+
|
|
44
|
+
## Imports
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import { Button } from "@maxio-com/react-ui-components";
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Stories
|
|
51
|
+
|
|
52
|
+
### Example
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
const Example = () => <Button>Button</Button>;
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Nested Components
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
const NestedComponents = () => (
|
|
62
|
+
<div className="maxio-flex maxio-flex-col maxio-gap-4 maxio-items-start">
|
|
63
|
+
<Button variant="primary">Default button</Button>
|
|
64
|
+
<div>
|
|
65
|
+
<p className="maxio-heading-md" style={{ marginBottom: '.25rem' }}>
|
|
66
|
+
Nested in a dark mode parent
|
|
67
|
+
</p>
|
|
68
|
+
<div
|
|
69
|
+
data-maxio-mode="dark"
|
|
70
|
+
className="maxio-flex maxio-flex-col maxio-gap-4"
|
|
71
|
+
style={{
|
|
72
|
+
backgroundColor: 'var(--maxio-color-bg-secondary)',
|
|
73
|
+
padding: '1rem',
|
|
74
|
+
borderRadius: '0.25rem',
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
<Button variant="primary">Dark mode button</Button>
|
|
78
|
+
<Button variant="primary" data-maxio-mode="light">
|
|
79
|
+
Forced light mode
|
|
80
|
+
</Button>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
```
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Design Tokens
|
|
2
|
+
|
|
3
|
+
Design tokens are a crucial aspect of design systems. They are atomic units of design that represent visual properties such as colors, typography, spacing, and more. These tokens serve as the foundation for maintaining consistency and scalability across various digital products and platforms.
|
|
4
|
+
|
|
5
|
+
You can learn more about design tokens in our [Maxio Design System Hub](https://www.notion.so/maxioevolution/Design-tokens-7e2081d708d6485396e3237cbb8028c7).
|
|
6
|
+
|
|
7
|
+
## Benefits of Design Tokens
|
|
8
|
+
|
|
9
|
+
- **Consistency:** By using design tokens, designers and developers ensure that visual elements remain consistent across all products and platforms.
|
|
10
|
+
- **Scalability:** Design tokens make it easier to scale design systems. As products evolve and grow, updating visual properties becomes more manageable through token adjustments.
|
|
11
|
+
- **Flexibility:** Tokens allow for quick iterations and experimentation. Changing a token value can automatically update all instances throughout the system.
|
|
12
|
+
|
|
13
|
+
## Types of Design Tokens
|
|
14
|
+
|
|
15
|
+
1. **Color Tokens:** Representing a palette of colors used throughout the design system.
|
|
16
|
+
2. **Typography Tokens:** Including font families, sizes, weights, and line heights.
|
|
17
|
+
3. **Spacing Tokens:** Defining space between elements such as margins, padding, and grid gutters.
|
|
18
|
+
4. **Border Tokens:** Specifying border widths, styles, and colors.
|
|
19
|
+
5. **Shadow Tokens:** Describing shadow effects used in UI components.
|
|
20
|
+
6. **Icon Tokens:** Identifying icon sizes and styles.
|
|
21
|
+
|
|
22
|
+
## Light and Dark Mode Support
|
|
23
|
+
|
|
24
|
+
Our design tokens accommodates both light and dark modes to ensure a seamless user experience across different environments. By defining design tokens for colors, typography, and other visual properties that adapt to light and dark themes, designers can ensure consistency and readability in various contexts.
|
|
25
|
+
|
|
26
|
+
## Naming Conventions
|
|
27
|
+
|
|
28
|
+
Our naming convention is ordered from the most generic categories to more specific. This is an intentional way of ordering each category to build upon one another, resulting in tokens that have natural, human-friendly names.
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
$namespace-category-element-status-emphasis-state
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
#### Example
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
--maxio-color-border-success-primary-hover
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## How to Use the Design Tokens Package
|
|
41
|
+
|
|
42
|
+
<br />
|
|
43
|
+
|
|
44
|
+
### Install with CSS
|
|
45
|
+
|
|
46
|
+
Replace `$VERSION` with the release version that you would like to use.
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<link rel="stylesheet" href="https://ui.maxio.com/$VERSION/variables.css" />
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Install with Your Favorite Package Manager
|
|
53
|
+
|
|
54
|
+
Make sure you use compatible styles version (available in the [package readme](https://www.npmjs.com/package/@maxio-com/react-ui-components)).
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
pnpm install @maxio-com/design-tokens
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
yarn add @maxio-com/design-tokens
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
npm install @maxio-com/design-tokens
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Then import it in your project:
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
import { tailwindTheme } from '@maxio-com/design-tokens';
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Using Color Tokens in a Project
|
|
75
|
+
|
|
76
|
+
In Maxio Theme (TailwindCSS), color tokens are applied with the following syntax:
|
|
77
|
+
|
|
78
|
+
**Semantic tokens**
|
|
79
|
+
|
|
80
|
+
```html
|
|
81
|
+
<div class="bg-secondary border-info">...<//div>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Primitive tokens**
|
|
85
|
+
|
|
86
|
+
```html
|
|
87
|
+
<div class="border-blue-80 bg-gray-05">...</div>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
In any other situation:
|
|
91
|
+
|
|
92
|
+
**Semantic tokens**
|
|
93
|
+
|
|
94
|
+
```css
|
|
95
|
+
.my-component {
|
|
96
|
+
background-color: var(--maxio-color-bg-secondary);
|
|
97
|
+
border-color: var(--maxio-color-border-info);
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Primitive tokens**
|
|
102
|
+
|
|
103
|
+
```css
|
|
104
|
+
.my-component {
|
|
105
|
+
background-color: var(--maxio-color-gray-40);
|
|
106
|
+
border-color: var(--maxio-color-blue-100);
|
|
107
|
+
}
|
|
108
|
+
```
|
package/dist/skills/maxio-react/references/foundations-design-tokens-colors-primitive-colors.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Primitive Colors
|
|
2
|
+
|
|
3
|
+
These are the core colors used throughout the design system. They form the foundation for the full color palette, semantic tokens, and component styles.
|
|
4
|
+
|
|
5
|
+
Whenever possible, **default to using [Semantic Colors](foundations-design-tokens-colors-semantic-colors.md).** Before reaching for a primitive color, check if a semantic token meets your needs.
|
|
6
|
+
|
|
7
|
+
## Colors
|
|
8
|
+
|
|
9
|
+
<br />
|
|
10
|
+
|
|
11
|
+
<style>
|
|
12
|
+
{`
|
|
13
|
+
.wrapper .docblock-colorpalette > div > div {
|
|
14
|
+
flex-basis: 15%;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.wrapper .docblock-colorpalette span {
|
|
18
|
+
display: none;
|
|
19
|
+
}
|
|
20
|
+
`}
|
|
21
|
+
</style>
|
|
22
|
+
|
|
23
|
+
<div className="wrapper">
|
|
24
|
+
<ColorPalette>
|
|
25
|
+
{Object.entries(tailwindTheme.colors).map(([name, colors]) => {
|
|
26
|
+
const sorted =
|
|
27
|
+
typeof colors === 'string'
|
|
28
|
+
? { [name]: colors }
|
|
29
|
+
: returnOrderedColors(colors);
|
|
30
|
+
return <ColorItem key={name} title={name} colors={sorted} />;
|
|
31
|
+
})}
|
|
32
|
+
</ColorPalette>
|
|
33
|
+
</div>
|
package/dist/skills/maxio-react/references/foundations-design-tokens-colors-semantic-colors.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Semantic Colors
|
|
2
|
+
|
|
3
|
+
Semantic colors help align Maxio's UI with user intent and accessibility needs. These tokens adapt automatically to light and dark modes, ensuring consistency across themes. **Use semantic color tokens whenever possible** to promote clarity, cohesion, and future flexibility.
|
|
4
|
+
|
|
5
|
+
If a suitable semantic color isn't available, you may use [Primitive Colors](foundations-design-tokens-colors-primitive-colors.md) as a fallback.
|
|
6
|
+
|
|
7
|
+
## Colors
|
|
8
|
+
|
|
9
|
+
<br />
|
|
10
|
+
|
|
11
|
+
<ColorsCollection />
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Maxio Design System
|
|
2
|
+
|
|
3
|
+
The goal of this project is to create a consistent user experience across all Maxio products. The current version of the library supports both **React** and plain **HTML/CSS**. It’s designed to improve developer experience and boost productivity by handling the foundational UI work, so you can focus on building great features instead of reinventing the basics.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/prettier/prettier)
|
|
6
|
+
[](https://facebook.github.io/jest/)
|
|
7
|
+
[](http://commitizen.github.io/cz-cli/)
|
|
8
|
+
[](https://pnpm.io/)
|
|
9
|
+
|
|
10
|
+
<br />
|
|
11
|
+
|
|
12
|
+
## Getting Started with HTML/CSS
|
|
13
|
+
|
|
14
|
+
<br />
|
|
15
|
+
|
|
16
|
+
### Install the Stylesheet
|
|
17
|
+
|
|
18
|
+
Include the snippet with stylesheet CSS file on your page:
|
|
19
|
+
|
|
20
|
+
You can also replace the version above with any specific release of the `@maxio-com/ui-components` package. All available versions are listed [here](https://github.com/maxio-com/front-end-platform/releases).
|
|
21
|
+
|
|
22
|
+
### Install Fonts
|
|
23
|
+
|
|
24
|
+
The [Inter](https://fonts.google.com/specimen/Inter) font is not a part of a Design System and will be not loaded automatically.
|
|
25
|
+
We recommend using the Google Fonts service to load the font from a CDN.
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
29
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
30
|
+
<link
|
|
31
|
+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap"
|
|
32
|
+
rel="stylesheet"
|
|
33
|
+
/>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Install Font Awesome Icons
|
|
37
|
+
|
|
38
|
+
We host our library of custom icons on Font Awesome. To use any of these icons, you must include the CSS for our kit in your project.
|
|
39
|
+
|
|
40
|
+
```html
|
|
41
|
+
<link
|
|
42
|
+
rel="stylesheet"
|
|
43
|
+
href="https://kit.fontawesome.com/6743334a5d.css"
|
|
44
|
+
crossorigin="anonymous"
|
|
45
|
+
/>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Example HTML/CSS Install
|
|
49
|
+
|
|
50
|
+
The code snippet presented below shows an `HTML` page with the design system installed and an example of rendering a simple `icon` component.
|
|
51
|
+
`$VERSION` should be replaced with the specific release version you'd like to use. (<code>{getLatestRelease()}</code> is the latest.)
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<!DOCTYPE html>
|
|
55
|
+
<html lang="en">
|
|
56
|
+
<head>
|
|
57
|
+
<meta charset="utf-8" />
|
|
58
|
+
<link rel="stylesheet" href="https://ui.maxio.com/$VERSION/styles.css" />
|
|
59
|
+
</head>
|
|
60
|
+
<body>
|
|
61
|
+
<i class="fa-kit fa-bank"></i>
|
|
62
|
+
</body>
|
|
63
|
+
</html>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Design Tokens
|
|
67
|
+
|
|
68
|
+
If you're using the HTML/CSS version of the Maxio Design System, you'll also need to install the `@maxio-com/design-tokens` package. This includes the CSS variables for colors, fonts, spacing, and other foundational styles used across our components.
|
|
69
|
+
|
|
70
|
+
For setup instructions, refer to our [Design Tokens documentation](foundations-design-tokens-about.md).
|
|
71
|
+
|
|
72
|
+
<br />
|
|
73
|
+
|
|
74
|
+
## Getting Started with React
|
|
75
|
+
|
|
76
|
+
If your project uses React, install the Maxio component library using your preferred package manager:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
npm install --save @maxio-com/react-ui-components
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
yarn add @maxio-com/react-ui-components
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
pnpm add @maxio-com/react-ui-components
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Then, import components individually:
|
|
91
|
+
|
|
92
|
+
```jsx
|
|
93
|
+
import { Button } from '@maxio-com/react-ui-components';
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
You can find the correct import path for each component in its Storybook example.
|
|
97
|
+
|
|
98
|
+
## How to Use Storybook
|
|
99
|
+
|
|
100
|
+
This Storybook serves as the source of truth for the Maxio Design System. It includes all available components, along with usage guidelines, examples, and instructions for using them in your projects.
|
|
101
|
+
|
|
102
|
+
We've provided tools to enable you to easily compose React components right in Storybook.
|
|
103
|
+
|
|
104
|
+
Each component's main documentation includes a **Playground** section, which lists the customizable props associated with that component. Simply configure these props and click "Show Code" to view the JSX for your configured component, ready to copy and paste.
|
|
105
|
+
|
|
106
|
+
You can also configure components from within each Story. Select the Story and open the **Controls** tab in the Addons panel to toggle props as needed.
|
|
107
|
+
|
|
108
|
+
Note that most documented props are custom to our design system. Standard attributes (like `href` or `target` on a Link component) are not always listed, since they’re part of the underlying HTML element and not specific to our components.
|
|
109
|
+
|
|
110
|
+
To learn more about how to properly use a component, visit its main documentation page.
|
|
111
|
+
|
|
112
|
+
### Using HTML/CSS?
|
|
113
|
+
|
|
114
|
+
If you're working with HTML/CSS, composing a component works much the same way.
|
|
115
|
+
|
|
116
|
+
Select the Story, adjust the props in the **Controls** tab of the Addons panel, then open the **HTML** tab to view and copy the generated markup directly into your project.
|
|
117
|
+
|
|
118
|
+
Note: When composing with HTML/CSS, it’s important to ensure your components meet ARIA accessibility requirements. While the React library includes these features by default, using the HTML/CSS library means you’ll need to add appropriate roles and attributes yourself, following Maxio’s accessibility guidelines. For help, refer to the [WAI-ARIA Authoring Best Practices Guide](https://www.w3.org/WAI/ARIA/apg).
|
|
119
|
+
|
|
120
|
+
## More Resources
|
|
121
|
+
|
|
122
|
+
Want to learn even more? Check out the [Maxio Design System Hub](https://www.notion.so/maxioevolution/1802f1e19a89453089a67c8aadcbd10a?v=b111ca816dc744ae8be3a982bdac33b2&source=copy_link) in Notion. This resource provides guidelines, principles, and patterns for designing and building UI at Maxio.
|
|
123
|
+
|
|
124
|
+
## Questions and Feedback
|
|
125
|
+
|
|
126
|
+
The Maxio Design System is a work in progress. Our team is working hard to continue expanding and improving what this library offers.
|
|
127
|
+
|
|
128
|
+
If you have requests, feedback, or questions about the system, components, or how to use them, please reach out to us on our public Slack channel, **#maxio-design-system**.
|