@utilitywarehouse/hearth-react 0.28.7 → 0.29.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/README.md +34 -20
- package/SKILL.md +355 -0
- package/dist/{chunk-TLCA3FQZ.js → chunk-ABES5BZY.js} +2 -2
- package/dist/{chunk-OHPQ5IRM.cjs → chunk-Y2CHQFKQ.cjs} +2 -2
- package/dist/{chunk-OHPQ5IRM.cjs.map → chunk-Y2CHQFKQ.cjs.map} +1 -1
- package/dist/components/CardAccordion/CardAccordion.context.d.ts.map +1 -1
- package/dist/components/ExpandableCard/ExpandableCard.cjs +1 -1
- package/dist/components/ExpandableCard/ExpandableCard.js +1 -1
- package/dist/components/ProgressBar/ProgressBar.cjs +1 -1
- package/dist/components/ProgressBar/ProgressBar.js +1 -1
- package/dist/helpers/get-classname-styles.d.ts.map +1 -1
- package/dist/helpers/logger.d.ts.map +1 -1
- package/dist/helpers/merge-ids.d.ts.map +1 -1
- package/dist/hooks/use-ids.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +14 -10
- package/public/llms/components/accordion.md +321 -0
- package/public/llms/components/alert.md +217 -0
- package/public/llms/components/avatar.md +112 -0
- package/public/llms/components/badge.md +158 -0
- package/public/llms/components/body-text.md +200 -0
- package/public/llms/components/box.md +148 -0
- package/public/llms/components/breadcrumbs.md +97 -0
- package/public/llms/components/button.md +595 -0
- package/public/llms/components/card-accordion.md +277 -0
- package/public/llms/components/card.md +985 -0
- package/public/llms/components/checkbox-group.md +193 -0
- package/public/llms/components/checkbox-tile.md +116 -0
- package/public/llms/components/checkbox.md +108 -0
- package/public/llms/components/combobox.md +360 -0
- package/public/llms/components/container.md +162 -0
- package/public/llms/components/currency-input.md +85 -0
- package/public/llms/components/date-input.md +90 -0
- package/public/llms/components/date-picker.md +159 -0
- package/public/llms/components/description-list.md +149 -0
- package/public/llms/components/detail-text.md +89 -0
- package/public/llms/components/divider.md +88 -0
- package/public/llms/components/em.md +43 -0
- package/public/llms/components/expandable-card.md +231 -0
- package/public/llms/components/flex.md +197 -0
- package/public/llms/components/grid.md +244 -0
- package/public/llms/components/heading.md +65 -0
- package/public/llms/components/helper-text.md +27 -0
- package/public/llms/components/highlight-banner.md +94 -0
- package/public/llms/components/icon-button.md +516 -0
- package/public/llms/components/icon-container.md +247 -0
- package/public/llms/components/inline-link.md +190 -0
- package/public/llms/components/label.md +28 -0
- package/public/llms/components/link.md +236 -0
- package/public/llms/components/list.md +715 -0
- package/public/llms/components/menu.md +270 -0
- package/public/llms/components/modal.md +328 -0
- package/public/llms/components/pagination.md +138 -0
- package/public/llms/components/password-input.md +93 -0
- package/public/llms/components/progress-bar.md +139 -0
- package/public/llms/components/progress-stepper.md +147 -0
- package/public/llms/components/radio-group.md +487 -0
- package/public/llms/components/search-input.md +132 -0
- package/public/llms/components/section-header.md +82 -0
- package/public/llms/components/select.md +148 -0
- package/public/llms/components/skeleton.md +282 -0
- package/public/llms/components/spinner.md +59 -0
- package/public/llms/components/strong.md +49 -0
- package/public/llms/components/switch.md +106 -0
- package/public/llms/components/table.md +230 -0
- package/public/llms/components/tabs.md +320 -0
- package/public/llms/components/text-area.md +141 -0
- package/public/llms/components/text-input.md +228 -0
- package/public/llms/components/toast.md +323 -0
- package/public/llms/components/toggle-button-card.md +513 -0
- package/public/llms/components/tooltip.md +188 -0
- package/public/llms/components/unstyled-icon-button.md +175 -0
- package/public/llms/components/validation-text.md +29 -0
- package/public/llms/components/verification-input.md +96 -0
- package/public/llms/docs/changelog.md +1430 -0
- package/public/llms/docs/common-props/align-self.md +90 -0
- package/public/llms/docs/common-props/border.md +308 -0
- package/public/llms/docs/common-props/colour.md +221 -0
- package/public/llms/docs/common-props/flex-items.md +91 -0
- package/public/llms/docs/common-props/gap.md +111 -0
- package/public/llms/docs/common-props/grid-items.md +96 -0
- package/public/llms/docs/common-props/margin.md +105 -0
- package/public/llms/docs/common-props/opacity.md +100 -0
- package/public/llms/docs/common-props/order.md +90 -0
- package/public/llms/docs/common-props/overflow.md +89 -0
- package/public/llms/docs/common-props/padding.md +102 -0
- package/public/llms/docs/common-props/position.md +92 -0
- package/public/llms/docs/common-props/size.md +93 -0
- package/public/llms/docs/common-props/spacing.md +97 -0
- package/public/llms/docs/common-props/text.md +35 -0
- package/public/llms/docs/common-props/z-index.md +88 -0
- package/public/llms/docs/design-tokens.md +72 -0
- package/public/llms/docs/getting-started.md +117 -0
- package/public/llms/docs/layout.md +135 -0
- package/public/llms/docs/migrating.md +302 -0
- package/public/llms/docs/responsive-design/breakpoints.md +119 -0
- package/public/llms/docs/responsive-design/media-queries.md +89 -0
- package/public/llms/docs/responsive-design/responsive-props.md +37 -0
- package/public/llms.txt +97 -0
- package/scripts/init-ai.js +142 -0
- package/styles.css +1 -1
- /package/dist/{chunk-TLCA3FQZ.js.map → chunk-ABES5BZY.js.map} +0 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Pagination
|
|
2
|
+
|
|
3
|
+
Use the `Pagination` component to help users navigate through multiple pages of content.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Usage Guidelines](#usage-guidelines)
|
|
8
|
+
- [Examples](#examples)
|
|
9
|
+
- [Condensed](#condensed)
|
|
10
|
+
- [Without Skip Buttons](#without-skip-buttons)
|
|
11
|
+
- [Few Pages](#few-pages)
|
|
12
|
+
- [Many Pages](#many-pages)
|
|
13
|
+
- [Edge Cases](#edge-cases)
|
|
14
|
+
- [API](#api)
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
<Pagination {...args} currentPage={currentPage} onPageChange={setCurrentPage} />
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage Guidelines
|
|
21
|
+
|
|
22
|
+
- Handle the `onPageChange` callback to update your data
|
|
23
|
+
- The component automatically shows a maximum of 7 items (including ellipses)
|
|
24
|
+
- When using `as="nav"`, you must provide an `id` prop for proper accessibility
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
The Pagination component provides flexible options for navigation through multiple pages of content.
|
|
29
|
+
|
|
30
|
+
### Basic Usage
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
const [currentPage, setCurrentPage] = useState(5);
|
|
34
|
+
|
|
35
|
+
const handlePageChange = (newPage: number) => {
|
|
36
|
+
// Tracking, loading new data...
|
|
37
|
+
setCurrentPage(newPage)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Pagination
|
|
42
|
+
currentPage={currentPage}
|
|
43
|
+
totalPages={100}
|
|
44
|
+
onPageChange={handlePageChange}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Condensed
|
|
50
|
+
|
|
51
|
+
Use the `condensed` prop to display a more compact pagination with just "Page X of Y" text and navigation arrows.
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
<Pagination currentPage={currentPage} totalPages={10} onPageChange={setCurrentPage} condensed />
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Without Skip Buttons
|
|
58
|
+
|
|
59
|
+
Set `hideSkipButtons` to hide the first/last page skip buttons.
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
<Pagination
|
|
63
|
+
currentPage={currentPage}
|
|
64
|
+
totalPages={10}
|
|
65
|
+
onPageChange={setCurrentPage}
|
|
66
|
+
hideSkipButtons
|
|
67
|
+
/>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Few Pages
|
|
71
|
+
|
|
72
|
+
When there are 7 or fewer pages, all page numbers are displayed.
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
<Pagination currentPage={currentPage} totalPages={7} onPageChange={setCurrentPage} />
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Many Pages
|
|
79
|
+
|
|
80
|
+
When there are many pages (more than 8), ellipsis (...) are shown to condense the pagination. The component shows:
|
|
81
|
+
|
|
82
|
+
- First and last pages always visible
|
|
83
|
+
- When near the start: first 5 pages, ellipsis, last page
|
|
84
|
+
- When in the middle: first page, ellipsis, current page with neighbours, ellipsis, last page
|
|
85
|
+
- When near the end: first page, ellipsis, last 5 pages
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
<Pagination currentPage={currentPage} totalPages={100} onPageChange={setCurrentPage} />
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Edge Cases
|
|
92
|
+
|
|
93
|
+
Examples showing different positions in a large page set:
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
<Flex direction="column" gap="400">
|
|
97
|
+
<Flex direction="column" gap="100">
|
|
98
|
+
<BodyText size="sm" color="secondary">
|
|
99
|
+
Near start (page 2 of 100):
|
|
100
|
+
</BodyText>
|
|
101
|
+
<Pagination currentPage={nearStartPage} totalPages={100} onPageChange={setNearStartPage} />
|
|
102
|
+
</Flex>
|
|
103
|
+
<Flex direction="column" gap="100">
|
|
104
|
+
<BodyText size="sm" color="secondary">
|
|
105
|
+
In middle (page 50 of 100):
|
|
106
|
+
</BodyText>
|
|
107
|
+
<Pagination currentPage={middlePage} totalPages={100} onPageChange={setMiddlePage} />
|
|
108
|
+
</Flex>
|
|
109
|
+
<Flex direction="column" gap="100">
|
|
110
|
+
<BodyText size="sm" color="secondary">
|
|
111
|
+
Near end (page 98 of 100):
|
|
112
|
+
</BodyText>
|
|
113
|
+
<Pagination currentPage={nearEndPage} totalPages={100} onPageChange={setNearEndPage} />
|
|
114
|
+
</Flex>
|
|
115
|
+
</Flex>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## API
|
|
119
|
+
|
|
120
|
+
This component is based on the `div` element by default and supports the following common props:
|
|
121
|
+
|
|
122
|
+
- Margin
|
|
123
|
+
|
|
124
|
+
| Prop | Type | Default | Description |
|
|
125
|
+
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------ |
|
|
126
|
+
| `as` | `"div" \| "nav"` | `div` | Shorthand for changing the default rendered element into a semantically appropriate alternative. |
|
|
127
|
+
| `currentPage` | `number` | — | The current active page number (1-indexed) |
|
|
128
|
+
| `totalPages` | `number` | — | The total number of pages |
|
|
129
|
+
| `onPageChange` | `(page: number) => void` | — | Callback when page changes |
|
|
130
|
+
| `condensed` | `boolean` | `false` | Whether to show condensed version with only "Page X of Y" text |
|
|
131
|
+
| `hideSkipButtons` | `boolean` | `false` | Whether to hide the skip to first/last page buttons |
|
|
132
|
+
| `margin` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
133
|
+
| `marginTop` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
134
|
+
| `marginRight` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
135
|
+
| `marginBottom` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
136
|
+
| `marginLeft` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
137
|
+
| `marginX` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
138
|
+
| `marginY` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# PasswordInput
|
|
2
|
+
|
|
3
|
+
`PasswordInput` is an interactive field that is used to securely collect users passwords.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<PasswordInput {...args} />
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Alternatives
|
|
10
|
+
|
|
11
|
+
- TextInput - For text
|
|
12
|
+
- SearchInput - For search
|
|
13
|
+
- CurrencyInput - For money
|
|
14
|
+
|
|
15
|
+
## Label
|
|
16
|
+
|
|
17
|
+
A label is required, this should be clear and descriptive to guide the user.
|
|
18
|
+
|
|
19
|
+
## Disabled and Read-only
|
|
20
|
+
|
|
21
|
+
Read-only inputs can not be edited, but remain focusable, and should only be
|
|
22
|
+
used readonly when presenting already submitted information. They differ from
|
|
23
|
+
disabled inputs, as there may be actions a user can take to activate a disabled
|
|
24
|
+
input, but read-only fields should stay undeditable in the same view.
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
<Flex direction="column" gap="400">
|
|
28
|
+
<PasswordInput {...args} label="Disabled" disabled helperText="Please enter you username first" />
|
|
29
|
+
<PasswordInput {...args} label="Read only" readOnly value="password123" />
|
|
30
|
+
</Flex>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Validation
|
|
34
|
+
|
|
35
|
+
The input `validationStatus` can be set to either `"valid"` or `"invalid"` to
|
|
36
|
+
indicate the status. This status must be accompanied by a validation text to
|
|
37
|
+
explain the reason for the status.
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
<Flex direction="column" gap="400">
|
|
41
|
+
<PasswordInput
|
|
42
|
+
{...args}
|
|
43
|
+
label="Password"
|
|
44
|
+
value="password123"
|
|
45
|
+
validationStatus="valid"
|
|
46
|
+
validationText="Strong password"
|
|
47
|
+
/>
|
|
48
|
+
<PasswordInput
|
|
49
|
+
{...args}
|
|
50
|
+
label="Password"
|
|
51
|
+
value="short"
|
|
52
|
+
validationStatus="invalid"
|
|
53
|
+
validationText="Please enter a password with at least 73 characters"
|
|
54
|
+
/>
|
|
55
|
+
</Flex>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Autocomplete
|
|
59
|
+
|
|
60
|
+
Use the `autocomplete` attribute on password inputs to help users complete forms
|
|
61
|
+
faster.
|
|
62
|
+
|
|
63
|
+
Autocomplete indicates to browsers and password managers what kind of password
|
|
64
|
+
is needed so it can be entered for the user.
|
|
65
|
+
|
|
66
|
+
Set the autocomplete attribute to `new-password` if the user is creating a
|
|
67
|
+
password. Otherwise, use `current-password`.
|
|
68
|
+
|
|
69
|
+
## API
|
|
70
|
+
|
|
71
|
+
This component is based on the `TextInput` component and supports the following common props:
|
|
72
|
+
|
|
73
|
+
- Margin
|
|
74
|
+
|
|
75
|
+
| Prop | Type | Default | Description |
|
|
76
|
+
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | --------------------------------------------------------------------------- |
|
|
77
|
+
| `label` | `string` | — | The label for the form field, describing its purpose. |
|
|
78
|
+
| `defaultValue` | `string \| number` | — | The initial value of the input when rendered. |
|
|
79
|
+
| `value` | `string \| number` | — | The controlled value of the input. Must be used with an `onChange` handler. |
|
|
80
|
+
| `labelId` | `string` | — | |
|
|
81
|
+
| `helperTextId` | `string` | — | |
|
|
82
|
+
| `validationTextId` | `string` | — | |
|
|
83
|
+
| `labelVariant` | `"body" \| "heading"` | — | Change the label variant |
|
|
84
|
+
| `helperText` | `string` | — | Optional helper text to provide additional context or instructions. |
|
|
85
|
+
| `validationText` | `string` | — | Text to display when the `validationStatus` is set. |
|
|
86
|
+
| `validationStatus` | `"valid" \| "invalid"` | — | Indicates the validation status. |
|
|
87
|
+
| `margin` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
88
|
+
| `marginTop` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
89
|
+
| `marginRight` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
90
|
+
| `marginBottom` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
91
|
+
| `marginLeft` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
92
|
+
| `marginX` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
93
|
+
| `marginY` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# ProgressBar
|
|
2
|
+
|
|
3
|
+
`ProgressBar` displays the progress of a task or process in a linear bar format, with support for different visual states.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<Flex direction="column" gap="400" width="600px">
|
|
7
|
+
<ProgressBar {...args} variant="linear" value={args.value || value} />
|
|
8
|
+
<Flex gap="400">
|
|
9
|
+
<ProgressBar {...args} variant="circular" value={args.value || value} size="md" />
|
|
10
|
+
<ProgressBar {...args} variant="circular" value={args.value || value} size="sm" />
|
|
11
|
+
</Flex>
|
|
12
|
+
</Flex>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Label
|
|
16
|
+
|
|
17
|
+
A label is required, this should be clear and descriptive to guide the user.
|
|
18
|
+
|
|
19
|
+
The `hideLabel` prop will visually hide the label but keep it available for screen readers.
|
|
20
|
+
|
|
21
|
+
## Variants
|
|
22
|
+
|
|
23
|
+
Use the `variant` prop to display either a `linear` or `circular` progress bar.
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
<Flex gap="800" backgroundColor="secondary" padding="300" alignItems="center">
|
|
27
|
+
<ProgressBar variant="linear" label="Linear progress bar" value={30} />
|
|
28
|
+
<ProgressBar variant="circular" label="circular" value={30} />
|
|
29
|
+
</Flex>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Color scheme
|
|
33
|
+
|
|
34
|
+
The `colorScheme` prop controls the visual appearance of the progress bar.
|
|
35
|
+
|
|
36
|
+
- `default` - Use to communicate general progress - This is the most common use case.
|
|
37
|
+
- `danger` - Use to alert the user of a negative status, like exceeding a data limit or running out of time.
|
|
38
|
+
- `success` - Use to indicate that a goal has been reached or a task is complete. This will also automatically set the value to the maximum.
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
<Flex direction="column" gap="400">
|
|
42
|
+
<ProgressBar variant="linear" label="Upload progress" value={90} />
|
|
43
|
+
<ProgressBar variant="linear" label="Completed tasks" colorScheme="success" value={100} />
|
|
44
|
+
<ProgressBar variant="linear" label="Storage usage" colorScheme="danger" value={10} />
|
|
45
|
+
<Flex gap="400">
|
|
46
|
+
<ProgressBar variant="circular" label="Upload" value={90} />
|
|
47
|
+
<ProgressBar variant="circular" label="Completed" colorScheme="success" value={100} />
|
|
48
|
+
<ProgressBar variant="circular" label="Storage" colorScheme="danger" value={10} />
|
|
49
|
+
</Flex>
|
|
50
|
+
</Flex>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Size
|
|
54
|
+
|
|
55
|
+
The `circular` variant offers a responsive size prop. The label will only be
|
|
56
|
+
displayed with the `md` size, with the `sm` size only displaying the value
|
|
57
|
+
text.
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
<Flex gap="400" alignItems="center" padding="300" backgroundColor="secondary">
|
|
61
|
+
<ProgressBar variant="circular" label="circular" value={30} />
|
|
62
|
+
<ProgressBar variant="circular" size="sm" label="circular" value={30} />
|
|
63
|
+
<ProgressBar
|
|
64
|
+
variant="circular"
|
|
65
|
+
size={{ mobile: 'sm', desktop: 'md' }}
|
|
66
|
+
label="responsive"
|
|
67
|
+
value={30}
|
|
68
|
+
/>
|
|
69
|
+
</Flex>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Value
|
|
73
|
+
|
|
74
|
+
The `value` prop accepts a number between the `min` (default is 0) and the
|
|
75
|
+
`max` (default is 100). Values outside this range will be automatically
|
|
76
|
+
clamped.
|
|
77
|
+
|
|
78
|
+
## Value text
|
|
79
|
+
|
|
80
|
+
The value will also be rendered in a user-friendly format, a percentage by
|
|
81
|
+
default. You can override this by passing a function to the `formatValueText`
|
|
82
|
+
prop.
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
<ProgressBar
|
|
86
|
+
label="Storage usage"
|
|
87
|
+
value={value}
|
|
88
|
+
max={max}
|
|
89
|
+
formatValueText={(value: number) => `${value / max}GB / ${max}GB`}
|
|
90
|
+
/>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
<Flex direction="column" gap="400">
|
|
95
|
+
<ProgressBar
|
|
96
|
+
variant="linear"
|
|
97
|
+
label="Storage usage"
|
|
98
|
+
value={87}
|
|
99
|
+
formatValueText={(value: number) => `${value / 10}GB / 10GB`}
|
|
100
|
+
/>
|
|
101
|
+
|
|
102
|
+
<ProgressBar
|
|
103
|
+
variant="circular"
|
|
104
|
+
label="files"
|
|
105
|
+
value={15}
|
|
106
|
+
max={50}
|
|
107
|
+
formatValueText={(value: number) => `${value}/50`}
|
|
108
|
+
/>
|
|
109
|
+
</Flex>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
For screenreaders, you can also use the `aria-valuetext` prop to provide a
|
|
113
|
+
user-friendly name for `aria-valuenow`, the current value of the meter.
|
|
114
|
+
|
|
115
|
+
## API
|
|
116
|
+
|
|
117
|
+
This component is based on the `div` element and supports the following common props:
|
|
118
|
+
|
|
119
|
+
- Margin
|
|
120
|
+
|
|
121
|
+
| Prop | Type | Default | Description |
|
|
122
|
+
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------- |
|
|
123
|
+
| `label` | `string` | — | The required text label. Can be visually hidden with the `hideLabel` prop. |
|
|
124
|
+
| `variant` | `"linear" \| "circular"` | — | |
|
|
125
|
+
| `colorScheme` | `"default" \| "success" \| "danger"` | `'default'` | Set the visual apearance. |
|
|
126
|
+
| `size` | `Responsive<"sm" \| "md">` | `md` | Sets the circular variant size. Does not affect the appearance of the linear variant. |
|
|
127
|
+
| `value` | `number` | — | The current progress value. |
|
|
128
|
+
| `min` | `number` | `0` | The minimum value. |
|
|
129
|
+
| `max` | `number` | `100` | The maximum value. |
|
|
130
|
+
| `hideLabel` | `boolean` | — | Visually hide the label. |
|
|
131
|
+
| `formatValueText` | `((value: number) => string)` | — | Override the default percentage value label formatting |
|
|
132
|
+
| `aria-valuetext` | `string` | — | A human-readable text alternative for the current value (`aria-valuenow`). |
|
|
133
|
+
| `margin` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
134
|
+
| `marginTop` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
135
|
+
| `marginRight` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
136
|
+
| `marginBottom` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
137
|
+
| `marginLeft` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
138
|
+
| `marginX` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
139
|
+
| `marginY` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# ProgressStepper
|
|
2
|
+
|
|
3
|
+
Use the `ProgressStepper` component to show users their progress through a multi-step process.
|
|
4
|
+
|
|
5
|
+
- [Usage](#usage)
|
|
6
|
+
- [Step states](#step-states)
|
|
7
|
+
- [Accessability](#accessability)
|
|
8
|
+
- [API](#api)
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
<Flex direction="column" gap="400">
|
|
12
|
+
<BodyText weight="bold">Step {currentStep + 1} Content</BodyText>
|
|
13
|
+
<ProgressStepper {...args}>
|
|
14
|
+
<ProgressStep status={getStatus(0)} label="Customer data" />
|
|
15
|
+
<ProgressStep status={getStatus(1)} label="Shipping data" />
|
|
16
|
+
<ProgressStep status={getStatus(2)} label="Payment data" />
|
|
17
|
+
<ProgressStep status={getStatus(3)} label="Summary" />
|
|
18
|
+
</ProgressStepper>
|
|
19
|
+
<Flex gap="200">
|
|
20
|
+
<Button
|
|
21
|
+
disabled={currentStep === 0}
|
|
22
|
+
onClick={() => {
|
|
23
|
+
if (currentStep > 0) setCurrentStep(s => s - 1);
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
Prev
|
|
27
|
+
</Button>
|
|
28
|
+
<Button
|
|
29
|
+
disabled={currentStep === 3}
|
|
30
|
+
onClick={() => {
|
|
31
|
+
if (currentStep < 3) setCurrentStep(s => s + 1);
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
Next
|
|
35
|
+
</Button>
|
|
36
|
+
</Flex>
|
|
37
|
+
</Flex>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
There are 3 step components for different scenarios. Do not mix these step
|
|
43
|
+
types, they should not be used together.
|
|
44
|
+
|
|
45
|
+
- `ProgressStep` is a static step
|
|
46
|
+
- `ProgressStepButton` is an interactive step for use when the step requires an action
|
|
47
|
+
- `ProgressStepLink` is an interactive step for use when the step requires navigation
|
|
48
|
+
|
|
49
|
+
Wrap the steps in a `ProgressStepper` components.
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
<ProgressStepper>
|
|
53
|
+
<ProgressStep status="complete" label="Customer data"/>
|
|
54
|
+
<ProgressStep status="complete" label="Shipping data"/>
|
|
55
|
+
<ProgressStep status="active" label="Payment data"/>
|
|
56
|
+
<ProgressStep status="incomplete" label="Summary"/>
|
|
57
|
+
</ProgressStepper>
|
|
58
|
+
|
|
59
|
+
[...]
|
|
60
|
+
|
|
61
|
+
<ProgressStepper>
|
|
62
|
+
<ProgressStepLink status="complete" href="#customer-data" label="Customer data" />
|
|
63
|
+
<ProgressStepLink status="complete" href="#shipping-data" label="Shipping data" />
|
|
64
|
+
<ProgressStepLink status="active" href="#payment-data" label="Payment data" />
|
|
65
|
+
<ProgressStepLink status="incomplete" label="Summary" />
|
|
66
|
+
</ProgressStepper>
|
|
67
|
+
|
|
68
|
+
[...]
|
|
69
|
+
|
|
70
|
+
<ProgressStepper >
|
|
71
|
+
<ProgressStepButton status="complete" label="Customer data" onClick={setStep('shipping')} />
|
|
72
|
+
<ProgressStepButton status="complete" label="Shipping data" onClick={setStep('payment')} />
|
|
73
|
+
<ProgressStepButton status="active" label="Payment data" onClick={setStep('summary')} />
|
|
74
|
+
<ProgressStepButton status="incomplete" label="Summary" />
|
|
75
|
+
</ProgressStepper>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Step states
|
|
79
|
+
|
|
80
|
+
Each step can have one of three states:
|
|
81
|
+
|
|
82
|
+
- `complete`
|
|
83
|
+
- `active`
|
|
84
|
+
- `incomplete`
|
|
85
|
+
|
|
86
|
+
The `ProgressStepButton` and `ProgressStepLink` components will render a static
|
|
87
|
+
step when they have an `active` status.
|
|
88
|
+
|
|
89
|
+
To prevent users interacting with a `ProgressStepButton` or `ProgressStepLink`
|
|
90
|
+
component, use the `disabled` prop. This will prevent click events and remove
|
|
91
|
+
the href attribute.
|
|
92
|
+
|
|
93
|
+
## Step Labels
|
|
94
|
+
|
|
95
|
+
Each step requires a label, this should be clear and descriptive to guide the user.
|
|
96
|
+
|
|
97
|
+
The `hideLabels` prop will visually hide the step labels but keep them available for screen readers.
|
|
98
|
+
|
|
99
|
+
## Accessability
|
|
100
|
+
|
|
101
|
+
- Use the `as` prop to render the stepper as `nav` when it represents site/app navigation; otherwise use the default `div`.
|
|
102
|
+
- Add `name` to `ProgressStepper` when using `nav` as element and having multiple navigations on the page.
|
|
103
|
+
- Any `aria-label` value passed to a progress step will be appended to the default `aria-label`.
|
|
104
|
+
|
|
105
|
+
## API
|
|
106
|
+
|
|
107
|
+
This component is based on the `div` element and supports the following common props:
|
|
108
|
+
|
|
109
|
+
- Margin
|
|
110
|
+
|
|
111
|
+
| Prop | Type | Default | Description |
|
|
112
|
+
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | --------------------------- |
|
|
113
|
+
| `hideLabels` | `boolean` | `false` | Whether to hide step labels |
|
|
114
|
+
| `margin` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
115
|
+
| `marginTop` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
116
|
+
| `marginRight` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
117
|
+
| `marginBottom` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
118
|
+
| `marginLeft` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
119
|
+
| `marginX` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
120
|
+
| `marginY` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
121
|
+
| `as` | `"div" \| "nav"` | — | |
|
|
122
|
+
|
|
123
|
+
### ProgressStep API
|
|
124
|
+
|
|
125
|
+
| Prop | Type | Default | Description |
|
|
126
|
+
| -------- | ---------------------------------------- | ------- | -------------------------------------- |
|
|
127
|
+
| `label` | `string` | — | The label text to display for the step |
|
|
128
|
+
| `status` | `"complete" \| "active" \| "incomplete"` | — | The current status of the step |
|
|
129
|
+
|
|
130
|
+
### ProgressStepLink API
|
|
131
|
+
|
|
132
|
+
This component is based on the `a` element.
|
|
133
|
+
|
|
134
|
+
| Prop | Type | Default | Description |
|
|
135
|
+
| --------- | ---------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------- |
|
|
136
|
+
| `label` | `string` | — | The label text to display for the step |
|
|
137
|
+
| `status` | `"complete" \| "active" \| "incomplete"` | — | The current status of the step |
|
|
138
|
+
| `asChild` | `boolean` | — | Change the default rendered element for the one passed as a child, merging their props and behavior. |
|
|
139
|
+
|
|
140
|
+
### ProgressStepButton API
|
|
141
|
+
|
|
142
|
+
This component is based on the `button` element.
|
|
143
|
+
|
|
144
|
+
| Prop | Type | Default | Description |
|
|
145
|
+
| -------- | ---------------------------------------- | ------- | -------------------------------------- |
|
|
146
|
+
| `label` | `string` | — | The label text to display for the step |
|
|
147
|
+
| `status` | `"complete" \| "active" \| "incomplete"` | — | The current status of the step |
|