aidos-ui 4.0.4 → 4.0.6
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/LICENSE +1 -1
- package/README.md +23 -3
- package/dist/index.d.ts +801 -68
- package/dist/index.js +3934 -68
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.d.ts +6 -2
- package/dist/jsx-dev-runtime.js +87 -42
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.d.ts +1 -1
- package/dist/jsx-runtime.js +2 -2
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/vite-plugin-jss-debug.d.ts +3 -1
- package/dist/vite-plugin-jss-debug.js +57 -74
- package/dist/vite-plugin-jss-debug.js.map +1 -1
- package/package.json +61 -27
- package/.prettierrc +0 -4
- package/CLAUDE.md +0 -72
- package/dist/Badge.d.ts +0 -6
- package/dist/Badge.js +0 -22
- package/dist/Badge.js.map +0 -1
- package/dist/BaseButton.d.ts +0 -14
- package/dist/BaseButton.js +0 -23
- package/dist/BaseButton.js.map +0 -1
- package/dist/BaseInput.d.ts +0 -14
- package/dist/BaseInput.js +0 -15
- package/dist/BaseInput.js.map +0 -1
- package/dist/BaseLink.d.ts +0 -18
- package/dist/BaseLink.js +0 -29
- package/dist/BaseLink.js.map +0 -1
- package/dist/BaseList.d.ts +0 -6
- package/dist/BaseList.js +0 -14
- package/dist/BaseList.js.map +0 -1
- package/dist/BaseListAddOn.d.ts +0 -5
- package/dist/BaseListAddOn.js +0 -7
- package/dist/BaseListAddOn.js.map +0 -1
- package/dist/BaseListItem.d.ts +0 -26
- package/dist/BaseListItem.js +0 -29
- package/dist/BaseListItem.js.map +0 -1
- package/dist/BaseView.d.ts +0 -12
- package/dist/BaseView.js +0 -26
- package/dist/BaseView.js.map +0 -1
- package/dist/Box.d.ts +0 -4
- package/dist/Box.js +0 -6
- package/dist/Box.js.map +0 -1
- package/dist/Button.d.ts +0 -20
- package/dist/Button.js +0 -19
- package/dist/Button.js.map +0 -1
- package/dist/Calendar.d.ts +0 -18
- package/dist/Calendar.js +0 -57
- package/dist/Calendar.js.map +0 -1
- package/dist/Card.d.ts +0 -4
- package/dist/Card.js +0 -14
- package/dist/Card.js.map +0 -1
- package/dist/Checkbox.d.ts +0 -11
- package/dist/Checkbox.js +0 -32
- package/dist/Checkbox.js.map +0 -1
- package/dist/Circle.d.ts +0 -5
- package/dist/Circle.js +0 -12
- package/dist/Circle.js.map +0 -1
- package/dist/Column.d.ts +0 -6
- package/dist/Column.js +0 -7
- package/dist/Column.js.map +0 -1
- package/dist/DarkMode.d.ts +0 -13
- package/dist/DarkMode.js +0 -62
- package/dist/DarkMode.js.map +0 -1
- package/dist/DateInput.d.ts +0 -13
- package/dist/DateInput.js +0 -29
- package/dist/DateInput.js.map +0 -1
- package/dist/DatePicker.d.ts +0 -11
- package/dist/DatePicker.js +0 -34
- package/dist/DatePicker.js.map +0 -1
- package/dist/DatetimeInput.d.ts +0 -13
- package/dist/DatetimeInput.js +0 -31
- package/dist/DatetimeInput.js.map +0 -1
- package/dist/DesignBook.d.ts +0 -1
- package/dist/DesignBook.js +0 -55
- package/dist/DesignBook.js.map +0 -1
- package/dist/Dialog.d.ts +0 -17
- package/dist/Dialog.js +0 -92
- package/dist/Dialog.js.map +0 -1
- package/dist/Dropdown.d.ts +0 -14
- package/dist/Dropdown.js +0 -65
- package/dist/Dropdown.js.map +0 -1
- package/dist/Emitter.d.ts +0 -6
- package/dist/Emitter.js +0 -19
- package/dist/Emitter.js.map +0 -1
- package/dist/FlexLayout.d.ts +0 -11
- package/dist/FlexLayout.js +0 -18
- package/dist/FlexLayout.js.map +0 -1
- package/dist/Icon.d.ts +0 -12
- package/dist/Icon.js +0 -60
- package/dist/Icon.js.map +0 -1
- package/dist/IconButton.d.ts +0 -11
- package/dist/IconButton.js +0 -34
- package/dist/IconButton.js.map +0 -1
- package/dist/IconLink.d.ts +0 -9
- package/dist/IconLink.js +0 -32
- package/dist/IconLink.js.map +0 -1
- package/dist/IconType.d.ts +0 -1
- package/dist/IconType.js +0 -2
- package/dist/IconType.js.map +0 -1
- package/dist/Interactable.d.ts +0 -50
- package/dist/Interactable.js +0 -169
- package/dist/Interactable.js.map +0 -1
- package/dist/JSSComment.d.ts +0 -10
- package/dist/JSSComment.js +0 -52
- package/dist/JSSComment.js.map +0 -1
- package/dist/Link.d.ts +0 -22
- package/dist/Link.js +0 -29
- package/dist/Link.js.map +0 -1
- package/dist/List.d.ts +0 -15
- package/dist/List.js +0 -29
- package/dist/List.js.map +0 -1
- package/dist/ListButtonItem.d.ts +0 -14
- package/dist/ListButtonItem.js +0 -11
- package/dist/ListButtonItem.js.map +0 -1
- package/dist/ListDivider.d.ts +0 -1
- package/dist/ListDivider.js +0 -12
- package/dist/ListDivider.js.map +0 -1
- package/dist/ListHeaderItem.d.ts +0 -10
- package/dist/ListHeaderItem.js +0 -15
- package/dist/ListHeaderItem.js.map +0 -1
- package/dist/ListItem.d.ts +0 -9
- package/dist/ListItem.js +0 -9
- package/dist/ListItem.js.map +0 -1
- package/dist/ListLinkItem.d.ts +0 -16
- package/dist/ListLinkItem.js +0 -11
- package/dist/ListLinkItem.js.map +0 -1
- package/dist/ListSpacer.d.ts +0 -1
- package/dist/ListSpacer.js +0 -13
- package/dist/ListSpacer.js.map +0 -1
- package/dist/MenuIcon.d.ts +0 -5
- package/dist/MenuIcon.js +0 -31
- package/dist/MenuIcon.js.map +0 -1
- package/dist/NextJSRouter.d.ts +0 -1
- package/dist/NextJSRouter.js +0 -37
- package/dist/NextJSRouter.js.map +0 -1
- package/dist/NextJSRouterState.d.ts +0 -38
- package/dist/NextJSRouterState.js +0 -111
- package/dist/NextJSRouterState.js.map +0 -1
- package/dist/OnVisible.d.ts +0 -5
- package/dist/OnVisible.js +0 -28
- package/dist/OnVisible.js.map +0 -1
- package/dist/Popover.d.ts +0 -22
- package/dist/Popover.js +0 -90
- package/dist/Popover.js.map +0 -1
- package/dist/ProgressBar.d.ts +0 -7
- package/dist/ProgressBar.js +0 -42
- package/dist/ProgressBar.js.map +0 -1
- package/dist/ProgressCircle.d.ts +0 -5
- package/dist/ProgressCircle.js +0 -12
- package/dist/ProgressCircle.js.map +0 -1
- package/dist/Providers.d.ts +0 -9
- package/dist/Providers.js +0 -16
- package/dist/Providers.js.map +0 -1
- package/dist/RangeInput.d.ts +0 -14
- package/dist/RangeInput.js +0 -32
- package/dist/RangeInput.js.map +0 -1
- package/dist/ResultOrError.d.ts +0 -13
- package/dist/ResultOrError.js +0 -7
- package/dist/ResultOrError.js.map +0 -1
- package/dist/RootView.d.ts +0 -5
- package/dist/RootView.js +0 -35
- package/dist/RootView.js.map +0 -1
- package/dist/Row.d.ts +0 -6
- package/dist/Row.js +0 -7
- package/dist/Row.js.map +0 -1
- package/dist/Select.d.ts +0 -9
- package/dist/Select.js +0 -17
- package/dist/Select.js.map +0 -1
- package/dist/StackContext.d.ts +0 -8
- package/dist/StackContext.js +0 -25
- package/dist/StackContext.js.map +0 -1
- package/dist/StaticCheckbox.d.ts +0 -16
- package/dist/StaticCheckbox.js +0 -48
- package/dist/StaticCheckbox.js.map +0 -1
- package/dist/Storage.d.ts +0 -13
- package/dist/Storage.js +0 -146
- package/dist/Storage.js.map +0 -1
- package/dist/Stream.d.ts +0 -9
- package/dist/Stream.js +0 -36
- package/dist/Stream.js.map +0 -1
- package/dist/Sublist.d.ts +0 -12
- package/dist/Sublist.js +0 -18
- package/dist/Sublist.js.map +0 -1
- package/dist/SubmitIconInput.d.ts +0 -8
- package/dist/SubmitIconInput.js +0 -25
- package/dist/SubmitIconInput.js.map +0 -1
- package/dist/Tabs.d.ts +0 -23
- package/dist/Tabs.js +0 -39
- package/dist/Tabs.js.map +0 -1
- package/dist/Text.d.ts +0 -25
- package/dist/Text.js +0 -52
- package/dist/Text.js.map +0 -1
- package/dist/TextArea.d.ts +0 -11
- package/dist/TextArea.js +0 -27
- package/dist/TextArea.js.map +0 -1
- package/dist/TextInput.d.ts +0 -15
- package/dist/TextInput.js +0 -61
- package/dist/TextInput.js.map +0 -1
- package/dist/TextInputWithState.d.ts +0 -8
- package/dist/TextInputWithState.js +0 -14
- package/dist/TextInputWithState.js.map +0 -1
- package/dist/TextPairing.d.ts +0 -21
- package/dist/TextPairing.js +0 -26
- package/dist/TextPairing.js.map +0 -1
- package/dist/TimeInput.d.ts +0 -15
- package/dist/TimeInput.js +0 -58
- package/dist/TimeInput.js.map +0 -1
- package/dist/Tooltip.d.ts +0 -11
- package/dist/Tooltip.js +0 -73
- package/dist/Tooltip.js.map +0 -1
- package/dist/aria.d.ts +0 -8
- package/dist/aria.js +0 -42
- package/dist/aria.js.map +0 -1
- package/dist/guid.d.ts +0 -1
- package/dist/guid.js +0 -7
- package/dist/guid.js.map +0 -1
- package/dist/hash.d.ts +0 -1
- package/dist/hash.js +0 -20
- package/dist/hash.js.map +0 -1
- package/dist/isServer.d.ts +0 -1
- package/dist/isServer.js +0 -4
- package/dist/isServer.js.map +0 -1
- package/dist/jss.d.ts +0 -122
- package/dist/jss.js +0 -515
- package/dist/jss.js.map +0 -1
- package/dist/numberToBase.d.ts +0 -1
- package/dist/numberToBase.js +0 -44
- package/dist/numberToBase.js.map +0 -1
- package/dist/stateMachineContextFactory.d.ts +0 -36
- package/dist/stateMachineContextFactory.js +0 -48
- package/dist/stateMachineContextFactory.js.map +0 -1
- package/dist/useCookie.d.ts +0 -9
- package/dist/useCookie.js +0 -67
- package/dist/useCookie.js.map +0 -1
- package/dist/useKeyboard.d.ts +0 -8
- package/dist/useKeyboard.js +0 -26
- package/dist/useKeyboard.js.map +0 -1
- package/dist/useNavigation.d.ts +0 -5
- package/dist/useNavigation.js +0 -79
- package/dist/useNavigation.js.map +0 -1
- package/dist/usePromise.d.ts +0 -1
- package/dist/usePromise.js +0 -12
- package/dist/usePromise.js.map +0 -1
- package/dist/useRefEffect.d.ts +0 -1
- package/dist/useRefEffect.js +0 -15
- package/dist/useRefEffect.js.map +0 -1
- package/jss-debug-loader.mjs +0 -44
- package/next-env.d.ts +0 -6
- package/next.config.js +0 -33
- package/scripts/embeddings.js +0 -93
- package/scripts/openai_embeddings.js +0 -100
- package/scripts/publish.js +0 -28
- package/scripts/test_embeddings.js +0 -47
- package/src/Badge.tsx +0 -36
- package/src/BaseButton.tsx +0 -62
- package/src/BaseInput.tsx +0 -63
- package/src/BaseLink.tsx +0 -80
- package/src/BaseList.tsx +0 -26
- package/src/BaseListAddOn.tsx +0 -10
- package/src/BaseListItem.tsx +0 -119
- package/src/BaseView.tsx +0 -57
- package/src/Box.tsx +0 -20
- package/src/Button.tsx +0 -90
- package/src/Calendar.tsx +0 -123
- package/src/Card.tsx +0 -30
- package/src/Checkbox.tsx +0 -63
- package/src/Circle.tsx +0 -24
- package/src/Column.tsx +0 -12
- package/src/DarkMode.tsx +0 -100
- package/src/DateInput.tsx +0 -63
- package/src/DatePicker.tsx +0 -67
- package/src/DatetimeInput.tsx +0 -64
- package/src/DesignBook.tsx +0 -677
- package/src/Dialog.tsx +0 -150
- package/src/Dropdown.tsx +0 -146
- package/src/Emitter.ts +0 -26
- package/src/FlexLayout.tsx +0 -53
- package/src/Icon.tsx +0 -80
- package/src/IconButton.tsx +0 -81
- package/src/IconLink.tsx +0 -59
- package/src/IconType.ts +0 -787
- package/src/Interactable.tsx +0 -210
- package/src/JSSComment.tsx +0 -56
- package/src/Link.tsx +0 -110
- package/src/List.tsx +0 -58
- package/src/ListButtonItem.tsx +0 -69
- package/src/ListDivider.tsx +0 -13
- package/src/ListHeaderItem.tsx +0 -45
- package/src/ListItem.tsx +0 -24
- package/src/ListLinkItem.tsx +0 -76
- package/src/ListSpacer.tsx +0 -14
- package/src/MenuIcon.tsx +0 -50
- package/src/NextJSRouter.tsx +0 -60
- package/src/NextJSRouterState.tsx +0 -154
- package/src/OnVisible.tsx +0 -42
- package/src/Popover.tsx +0 -145
- package/src/ProgressBar.tsx +0 -63
- package/src/ProgressCircle.tsx +0 -38
- package/src/Providers.tsx +0 -33
- package/src/RangeInput.tsx +0 -82
- package/src/ResultOrError.ts +0 -15
- package/src/RootView.tsx +0 -55
- package/src/Row.tsx +0 -12
- package/src/Select.tsx +0 -39
- package/src/StackContext.tsx +0 -52
- package/src/StaticCheckbox.tsx +0 -72
- package/src/Storage.tsx +0 -198
- package/src/Stream.tsx +0 -50
- package/src/Sublist.tsx +0 -61
- package/src/SubmitIconInput.tsx +0 -45
- package/src/Tabs.tsx +0 -110
- package/src/Text.tsx +0 -111
- package/src/TextArea.tsx +0 -58
- package/src/TextInput.tsx +0 -123
- package/src/TextInputWithState.tsx +0 -32
- package/src/TextPairing.tsx +0 -115
- package/src/TimeInput.tsx +0 -109
- package/src/Tooltip.tsx +0 -109
- package/src/aria.ts +0 -72
- package/src/docs/mdx.tsx +0 -137
- package/src/docs/pages.ts +0 -115
- package/src/docs/searchIndex.ts +0 -1
- package/src/examples/ExampleDialog.tsx +0 -28
- package/src/guid.ts +0 -7
- package/src/hash.ts +0 -21
- package/src/index.ts +0 -68
- package/src/isServer.ts +0 -3
- package/src/jss.tsx +0 -712
- package/src/jsx-dev-runtime.ts +0 -74
- package/src/jsx-runtime.ts +0 -2
- package/src/numberToBase.ts +0 -52
- package/src/pages/Badge.mdx +0 -152
- package/src/pages/Button.mdx +0 -163
- package/src/pages/Calendar.mdx +0 -254
- package/src/pages/Card.mdx +0 -147
- package/src/pages/Checkbox.mdx +0 -131
- package/src/pages/Dialog.mdx +0 -197
- package/src/pages/FlexLayout.mdx +0 -211
- package/src/pages/Hashing.mdx +0 -211
- package/src/pages/Icon.mdx +0 -171
- package/src/pages/IconButton.mdx +0 -155
- package/src/pages/Link.mdx +0 -160
- package/src/pages/List.mdx +0 -262
- package/src/pages/ListHeader.mdx +0 -220
- package/src/pages/Popover.mdx +0 -223
- package/src/pages/ProgressBar.mdx +0 -200
- package/src/pages/ProgressCircle.mdx +0 -218
- package/src/pages/RangeInput.mdx +0 -237
- package/src/pages/Tabs.mdx +0 -281
- package/src/pages/Text.mdx +0 -154
- package/src/pages/TextInput.mdx +0 -235
- package/src/pages/TextPairing.mdx +0 -204
- package/src/pages/TimeInput.mdx +0 -178
- package/src/pages/Tooltip.mdx +0 -115
- package/src/pages/_app.tsx +0 -466
- package/src/pages/_document.tsx +0 -30
- package/src/pages/css-in-js.mdx +0 -240
- package/src/pages/index.mdx +0 -58
- package/src/pages/navigation.mdx +0 -158
- package/src/pages/prism.css +0 -3
- package/src/pages/useCookie.mdx +0 -176
- package/src/pages/useKeyboard.mdx +0 -257
- package/src/pages/useNavigation.mdx +0 -258
- package/src/pages/usePromise.mdx +0 -280
- package/src/pages/useRefEffect.mdx +0 -251
- package/src/stateMachineContextFactory.tsx +0 -111
- package/src/useCookie.tsx +0 -95
- package/src/useKeyboard.tsx +0 -43
- package/src/useNavigation.tsx +0 -89
- package/src/usePromise.tsx +0 -18
- package/src/useRefEffect.tsx +0 -18
- package/src/vite-plugin-jss-debug.ts +0 -77
- package/tsconfig.build.json +0 -23
- package/tsconfig.json +0 -38
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { ProgressBar } from "../ProgressBar";
|
|
2
|
-
import { Column } from "../Column";
|
|
3
|
-
import { Row } from "../Row";
|
|
4
|
-
import { Span } from "../Text";
|
|
5
|
-
import { cssVar } from "../jss";
|
|
6
|
-
|
|
7
|
-
# ProgressBar
|
|
8
|
-
|
|
9
|
-
A linear progress indicator for displaying completion percentage. Supports multiple colors and sizes.
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## Props
|
|
14
|
-
|
|
15
|
-
| Prop | Type | Default | Description |
|
|
16
|
-
|------|------|---------|-------------|
|
|
17
|
-
| `progress` | `number` | Required | Progress value from 0 to 1 (values > 1 are capped at 1) |
|
|
18
|
-
| `color` | `Color` | Required | Bar fill color: `"highlight"`, `"negative"`, `"warning"`, etc. |
|
|
19
|
-
| `size` | `Size` | Required | Bar height: `"xsmall"` (4px), `"small"` (8px), `"medium"` (12px), `"large"` (16px), `"xlarge"` (20px) |
|
|
20
|
-
| `jss` | `JSS` | - | Custom styles for the container |
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## Basic usage
|
|
25
|
-
|
|
26
|
-
<Column gap="medium">
|
|
27
|
-
<ProgressBar color="highlight" progress={0.66} size="medium" />
|
|
28
|
-
</Column>
|
|
29
|
-
|
|
30
|
-
```js
|
|
31
|
-
<ProgressBar color="highlight" progress={0.66} size="medium" />
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## Sizes
|
|
37
|
-
|
|
38
|
-
<Column gap="medium">
|
|
39
|
-
<Row gap="medium" align="center">
|
|
40
|
-
<Span size="small" color="secondary" jss={{ width: 60 }}>xsmall</Span>
|
|
41
|
-
<ProgressBar color="highlight" progress={0.5} size="xsmall" jss={{ flexGrow: 1 }} />
|
|
42
|
-
</Row>
|
|
43
|
-
<Row gap="medium" align="center">
|
|
44
|
-
<Span size="small" color="secondary" jss={{ width: 60 }}>small</Span>
|
|
45
|
-
<ProgressBar color="highlight" progress={0.5} size="small" jss={{ flexGrow: 1 }} />
|
|
46
|
-
</Row>
|
|
47
|
-
<Row gap="medium" align="center">
|
|
48
|
-
<Span size="small" color="secondary" jss={{ width: 60 }}>medium</Span>
|
|
49
|
-
<ProgressBar color="highlight" progress={0.5} size="medium" jss={{ flexGrow: 1 }} />
|
|
50
|
-
</Row>
|
|
51
|
-
<Row gap="medium" align="center">
|
|
52
|
-
<Span size="small" color="secondary" jss={{ width: 60 }}>large</Span>
|
|
53
|
-
<ProgressBar color="highlight" progress={0.5} size="large" jss={{ flexGrow: 1 }} />
|
|
54
|
-
</Row>
|
|
55
|
-
<Row gap="medium" align="center">
|
|
56
|
-
<Span size="small" color="secondary" jss={{ width: 60 }}>xlarge</Span>
|
|
57
|
-
<ProgressBar color="highlight" progress={0.5} size="xlarge" jss={{ flexGrow: 1 }} />
|
|
58
|
-
</Row>
|
|
59
|
-
</Column>
|
|
60
|
-
|
|
61
|
-
```js
|
|
62
|
-
<ProgressBar color="highlight" progress={0.5} size="xsmall" /> // 4px
|
|
63
|
-
<ProgressBar color="highlight" progress={0.5} size="small" /> // 8px
|
|
64
|
-
<ProgressBar color="highlight" progress={0.5} size="medium" /> // 12px
|
|
65
|
-
<ProgressBar color="highlight" progress={0.5} size="large" /> // 16px
|
|
66
|
-
<ProgressBar color="highlight" progress={0.5} size="xlarge" /> // 20px
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## Colors
|
|
72
|
-
|
|
73
|
-
<Column gap="medium">
|
|
74
|
-
<ProgressBar color="highlight" progress={0.66} size="large" />
|
|
75
|
-
<ProgressBar color="negative" progress={0.66} size="large" />
|
|
76
|
-
<ProgressBar color="warning" progress={0.66} size="large" />
|
|
77
|
-
<ProgressBar color="positive" progress={0.66} size="large" />
|
|
78
|
-
</Column>
|
|
79
|
-
|
|
80
|
-
```js
|
|
81
|
-
<ProgressBar color="highlight" progress={0.66} size="large" /> // Accent color
|
|
82
|
-
<ProgressBar color="negative" progress={0.66} size="large" /> // Error/danger
|
|
83
|
-
<ProgressBar color="warning" progress={0.66} size="large" /> // Warning
|
|
84
|
-
<ProgressBar color="positive" progress={0.66} size="large" /> // Success
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## Progress states
|
|
90
|
-
|
|
91
|
-
<Column gap="medium">
|
|
92
|
-
<Row gap="medium" align="center">
|
|
93
|
-
<ProgressBar color="highlight" progress={0} size="medium" jss={{ flexGrow: 1 }} />
|
|
94
|
-
<Span size="small" color="secondary">0%</Span>
|
|
95
|
-
</Row>
|
|
96
|
-
<Row gap="medium" align="center">
|
|
97
|
-
<ProgressBar color="highlight" progress={0.25} size="medium" jss={{ flexGrow: 1 }} />
|
|
98
|
-
<Span size="small" color="secondary">25%</Span>
|
|
99
|
-
</Row>
|
|
100
|
-
<Row gap="medium" align="center">
|
|
101
|
-
<ProgressBar color="highlight" progress={0.5} size="medium" jss={{ flexGrow: 1 }} />
|
|
102
|
-
<Span size="small" color="secondary">50%</Span>
|
|
103
|
-
</Row>
|
|
104
|
-
<Row gap="medium" align="center">
|
|
105
|
-
<ProgressBar color="highlight" progress={0.75} size="medium" jss={{ flexGrow: 1 }} />
|
|
106
|
-
<Span size="small" color="secondary">75%</Span>
|
|
107
|
-
</Row>
|
|
108
|
-
<Row gap="medium" align="center">
|
|
109
|
-
<ProgressBar color="positive" progress={1} size="medium" jss={{ flexGrow: 1 }} />
|
|
110
|
-
<Span size="small" color="secondary">100%</Span>
|
|
111
|
-
</Row>
|
|
112
|
-
</Column>
|
|
113
|
-
|
|
114
|
-
```js
|
|
115
|
-
<ProgressBar color="highlight" progress={0} size="medium" /> // Empty
|
|
116
|
-
<ProgressBar color="highlight" progress={0.5} size="medium" /> // Half
|
|
117
|
-
<ProgressBar color="positive" progress={1} size="medium" /> // Complete
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
## With percentage label
|
|
123
|
-
|
|
124
|
-
```js
|
|
125
|
-
function UploadProgress({ progress }) {
|
|
126
|
-
const percentage = Math.round(progress * 100);
|
|
127
|
-
|
|
128
|
-
return (
|
|
129
|
-
<Column gap="small">
|
|
130
|
-
<Row justify="space-between">
|
|
131
|
-
<Span>Uploading...</Span>
|
|
132
|
-
<Span color="secondary">{percentage}%</Span>
|
|
133
|
-
</Row>
|
|
134
|
-
<ProgressBar
|
|
135
|
-
color={progress === 1 ? "positive" : "highlight"}
|
|
136
|
-
progress={progress}
|
|
137
|
-
size="medium"
|
|
138
|
-
/>
|
|
139
|
-
</Column>
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
## Dynamic color based on value
|
|
147
|
-
|
|
148
|
-
```js
|
|
149
|
-
function StorageIndicator({ used, total }) {
|
|
150
|
-
const progress = used / total;
|
|
151
|
-
|
|
152
|
-
// Change color based on usage
|
|
153
|
-
const color = progress > 0.9
|
|
154
|
-
? "negative"
|
|
155
|
-
: progress > 0.7
|
|
156
|
-
? "warning"
|
|
157
|
-
: "highlight";
|
|
158
|
-
|
|
159
|
-
return (
|
|
160
|
-
<Column gap="small">
|
|
161
|
-
<Row justify="space-between">
|
|
162
|
-
<Span>Storage</Span>
|
|
163
|
-
<Span color="secondary">{Math.round(progress * 100)}% used</Span>
|
|
164
|
-
</Row>
|
|
165
|
-
<ProgressBar color={color} progress={progress} size="small" />
|
|
166
|
-
</Column>
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
---
|
|
172
|
-
|
|
173
|
-
## Animated progress
|
|
174
|
-
|
|
175
|
-
The progress bar uses CSS transform for smooth animations:
|
|
176
|
-
|
|
177
|
-
```js
|
|
178
|
-
function AnimatedProgress() {
|
|
179
|
-
const [progress, setProgress] = useState(0);
|
|
180
|
-
|
|
181
|
-
useEffect(() => {
|
|
182
|
-
const interval = setInterval(() => {
|
|
183
|
-
setProgress((p) => (p >= 1 ? 0 : p + 0.1));
|
|
184
|
-
}, 500);
|
|
185
|
-
return () => clearInterval(interval);
|
|
186
|
-
}, []);
|
|
187
|
-
|
|
188
|
-
return <ProgressBar color="highlight" progress={progress} size="medium" />;
|
|
189
|
-
}
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
---
|
|
193
|
-
|
|
194
|
-
## Use cases
|
|
195
|
-
|
|
196
|
-
- **File uploads**: Show upload completion
|
|
197
|
-
- **Storage usage**: Display disk/quota usage
|
|
198
|
-
- **Form completion**: Indicate steps completed
|
|
199
|
-
- **Loading states**: Show determinate loading progress
|
|
200
|
-
- **Skill levels**: Display proficiency ratings
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import { ProgressCircle } from "../ProgressCircle";
|
|
2
|
-
import { Row } from "../Row";
|
|
3
|
-
import { Column } from "../Column";
|
|
4
|
-
import { Span } from "../Text";
|
|
5
|
-
import { cssVar } from "../jss";
|
|
6
|
-
|
|
7
|
-
# ProgressCircle
|
|
8
|
-
|
|
9
|
-
A circular progress indicator for displaying completion percentage. Uses SVG for crisp rendering at any size.
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## Props
|
|
14
|
-
|
|
15
|
-
| Prop | Type | Default | Description |
|
|
16
|
-
|------|------|---------|-------------|
|
|
17
|
-
| `progress` | `number` | Required | Progress value from 0 to 1 |
|
|
18
|
-
| `outerRadius` | `number` | Required | Radius of the circle in pixels |
|
|
19
|
-
| `stroke` | `number` | `4` | Width of the progress stroke |
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## Basic usage
|
|
24
|
-
|
|
25
|
-
<Row gap="medium" align="center" padding="medium">
|
|
26
|
-
<ProgressCircle progress={0.75} outerRadius={24} />
|
|
27
|
-
</Row>
|
|
28
|
-
|
|
29
|
-
```js
|
|
30
|
-
<ProgressCircle progress={0.75} outerRadius={24} />
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Progress states
|
|
36
|
-
|
|
37
|
-
<Row gap="medium" align="center" padding="medium">
|
|
38
|
-
<ProgressCircle progress={0.1} outerRadius={12} />
|
|
39
|
-
<ProgressCircle progress={0.2} outerRadius={12} />
|
|
40
|
-
<ProgressCircle progress={0.3} outerRadius={12} />
|
|
41
|
-
<ProgressCircle progress={0.4} outerRadius={12} />
|
|
42
|
-
<ProgressCircle progress={0.5} outerRadius={12} />
|
|
43
|
-
<ProgressCircle progress={0.6} outerRadius={12} />
|
|
44
|
-
<ProgressCircle progress={0.7} outerRadius={12} />
|
|
45
|
-
<ProgressCircle progress={0.8} outerRadius={12} />
|
|
46
|
-
<ProgressCircle progress={0.9} outerRadius={12} />
|
|
47
|
-
<ProgressCircle progress={1} outerRadius={12} />
|
|
48
|
-
</Row>
|
|
49
|
-
|
|
50
|
-
```js
|
|
51
|
-
<ProgressCircle progress={0.1} outerRadius={12} />
|
|
52
|
-
<ProgressCircle progress={0.2} outerRadius={12} />
|
|
53
|
-
<ProgressCircle progress={0.3} outerRadius={12} />
|
|
54
|
-
// ... and so on
|
|
55
|
-
<ProgressCircle progress={1} outerRadius={12} />
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## Sizes
|
|
61
|
-
|
|
62
|
-
Adjust the `outerRadius` to change the circle size:
|
|
63
|
-
|
|
64
|
-
<Row gap="large" align="center" padding="medium">
|
|
65
|
-
<Column align="center" gap="small">
|
|
66
|
-
<ProgressCircle progress={0.66} outerRadius={8} />
|
|
67
|
-
<Span size="small" color="secondary">8px</Span>
|
|
68
|
-
</Column>
|
|
69
|
-
<Column align="center" gap="small">
|
|
70
|
-
<ProgressCircle progress={0.66} outerRadius={12} />
|
|
71
|
-
<Span size="small" color="secondary">12px</Span>
|
|
72
|
-
</Column>
|
|
73
|
-
<Column align="center" gap="small">
|
|
74
|
-
<ProgressCircle progress={0.66} outerRadius={20} />
|
|
75
|
-
<Span size="small" color="secondary">20px</Span>
|
|
76
|
-
</Column>
|
|
77
|
-
<Column align="center" gap="small">
|
|
78
|
-
<ProgressCircle progress={0.66} outerRadius={32} />
|
|
79
|
-
<Span size="small" color="secondary">32px</Span>
|
|
80
|
-
</Column>
|
|
81
|
-
<Column align="center" gap="small">
|
|
82
|
-
<ProgressCircle progress={0.66} outerRadius={48} />
|
|
83
|
-
<Span size="small" color="secondary">48px</Span>
|
|
84
|
-
</Column>
|
|
85
|
-
</Row>
|
|
86
|
-
|
|
87
|
-
```js
|
|
88
|
-
<ProgressCircle progress={0.66} outerRadius={8} /> // Small
|
|
89
|
-
<ProgressCircle progress={0.66} outerRadius={12} /> // Default
|
|
90
|
-
<ProgressCircle progress={0.66} outerRadius={20} /> // Medium
|
|
91
|
-
<ProgressCircle progress={0.66} outerRadius={32} /> // Large
|
|
92
|
-
<ProgressCircle progress={0.66} outerRadius={48} /> // Extra large
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
## Stroke width
|
|
98
|
-
|
|
99
|
-
Adjust the `stroke` prop to change the line thickness:
|
|
100
|
-
|
|
101
|
-
<Row gap="large" align="center" padding="medium">
|
|
102
|
-
<Column align="center" gap="small">
|
|
103
|
-
<ProgressCircle progress={0.66} outerRadius={24} stroke={2} />
|
|
104
|
-
<Span size="small" color="secondary">2px stroke</Span>
|
|
105
|
-
</Column>
|
|
106
|
-
<Column align="center" gap="small">
|
|
107
|
-
<ProgressCircle progress={0.66} outerRadius={24} stroke={4} />
|
|
108
|
-
<Span size="small" color="secondary">4px stroke</Span>
|
|
109
|
-
</Column>
|
|
110
|
-
<Column align="center" gap="small">
|
|
111
|
-
<ProgressCircle progress={0.66} outerRadius={24} stroke={6} />
|
|
112
|
-
<Span size="small" color="secondary">6px stroke</Span>
|
|
113
|
-
</Column>
|
|
114
|
-
<Column align="center" gap="small">
|
|
115
|
-
<ProgressCircle progress={0.66} outerRadius={24} stroke={8} />
|
|
116
|
-
<Span size="small" color="secondary">8px stroke</Span>
|
|
117
|
-
</Column>
|
|
118
|
-
</Row>
|
|
119
|
-
|
|
120
|
-
```js
|
|
121
|
-
<ProgressCircle progress={0.66} outerRadius={24} stroke={2} />
|
|
122
|
-
<ProgressCircle progress={0.66} outerRadius={24} stroke={4} /> // Default
|
|
123
|
-
<ProgressCircle progress={0.66} outerRadius={24} stroke={6} />
|
|
124
|
-
<ProgressCircle progress={0.66} outerRadius={24} stroke={8} />
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
---
|
|
128
|
-
|
|
129
|
-
## With label
|
|
130
|
-
|
|
131
|
-
Combine with text to show the percentage:
|
|
132
|
-
|
|
133
|
-
```js
|
|
134
|
-
function CircularProgress({ value }) {
|
|
135
|
-
return (
|
|
136
|
-
<Row align="center" gap="small">
|
|
137
|
-
<ProgressCircle progress={value} outerRadius={16} />
|
|
138
|
-
<Span>{Math.round(value * 100)}%</Span>
|
|
139
|
-
</Row>
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
## Inline with text
|
|
147
|
-
|
|
148
|
-
Use small circles inline with text:
|
|
149
|
-
|
|
150
|
-
```js
|
|
151
|
-
<Row align="center" gap="small">
|
|
152
|
-
<Span>Task completion:</Span>
|
|
153
|
-
<ProgressCircle progress={0.8} outerRadius={8} stroke={2} />
|
|
154
|
-
<Span color="secondary">80%</Span>
|
|
155
|
-
</Row>
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## Skill indicator
|
|
161
|
-
|
|
162
|
-
```js
|
|
163
|
-
function SkillBadge({ name, level }) {
|
|
164
|
-
return (
|
|
165
|
-
<Row align="center" gap="medium" padding="small">
|
|
166
|
-
<ProgressCircle progress={level / 100} outerRadius={16} />
|
|
167
|
-
<Column gap="none">
|
|
168
|
-
<Span bold>{name}</Span>
|
|
169
|
-
<Span size="small" color="secondary">{level}%</Span>
|
|
170
|
-
</Column>
|
|
171
|
-
</Row>
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Usage
|
|
176
|
-
<SkillBadge name="React" level={90} />
|
|
177
|
-
<SkillBadge name="TypeScript" level={85} />
|
|
178
|
-
<SkillBadge name="Node.js" level={70} />
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
---
|
|
182
|
-
|
|
183
|
-
## Animated loading
|
|
184
|
-
|
|
185
|
-
```js
|
|
186
|
-
function LoadingCircle() {
|
|
187
|
-
const [progress, setProgress] = useState(0);
|
|
188
|
-
|
|
189
|
-
useEffect(() => {
|
|
190
|
-
const interval = setInterval(() => {
|
|
191
|
-
setProgress((p) => (p >= 1 ? 0 : p + 0.05));
|
|
192
|
-
}, 100);
|
|
193
|
-
return () => clearInterval(interval);
|
|
194
|
-
}, []);
|
|
195
|
-
|
|
196
|
-
return <ProgressCircle progress={progress} outerRadius={20} />;
|
|
197
|
-
}
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
---
|
|
201
|
-
|
|
202
|
-
## Styling
|
|
203
|
-
|
|
204
|
-
The ProgressCircle uses these CSS variables:
|
|
205
|
-
- `--secondary-background`: Circle background color
|
|
206
|
-
- `--highlight`: Progress stroke color
|
|
207
|
-
|
|
208
|
-
The SVG is rotated -90 degrees so progress starts from the top.
|
|
209
|
-
|
|
210
|
-
---
|
|
211
|
-
|
|
212
|
-
## Use cases
|
|
213
|
-
|
|
214
|
-
- **Compact progress indicators**: Where horizontal space is limited
|
|
215
|
-
- **Skill/proficiency displays**: Show expertise levels
|
|
216
|
-
- **Loading states**: Determinate circular spinners
|
|
217
|
-
- **Dashboard metrics**: Compact data visualization
|
|
218
|
-
- **Achievement badges**: Show completion status
|
package/src/pages/RangeInput.mdx
DELETED
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
import { RangeInput } from "../RangeInput";
|
|
2
|
-
import { Column } from "../Column";
|
|
3
|
-
import { Row } from "../Row";
|
|
4
|
-
import { Icon } from "../Icon";
|
|
5
|
-
import { Span } from "../Text";
|
|
6
|
-
|
|
7
|
-
# RangeInput
|
|
8
|
-
|
|
9
|
-
A styled wrapper around the HTML `<input type="range">` element with support for labels, icons, and customization options.
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## Props
|
|
14
|
-
|
|
15
|
-
| Prop | Type | Default | Description |
|
|
16
|
-
|------|------|---------|-------------|
|
|
17
|
-
| `value` | `number` | Required | Current slider value |
|
|
18
|
-
| `onValueChange` | `(value: number) => void` | Required | Called when the value changes |
|
|
19
|
-
| `min` | `number` | `0` | Minimum value |
|
|
20
|
-
| `max` | `number` | `100` | Maximum value |
|
|
21
|
-
| `step` | `number` | `1` | Step increment |
|
|
22
|
-
| `label` | `ReactNode` | - | Label text displayed alongside the slider |
|
|
23
|
-
| `labelPosition` | `"start" \| "end"` | `"end"` | Position of the label |
|
|
24
|
-
| `labelSize` | `Size` | - | Label text size |
|
|
25
|
-
| `labelColor` | `TextColor` | - | Label text color |
|
|
26
|
-
| `labelBold` | `boolean` | - | Whether the label is bold |
|
|
27
|
-
| `addOn` | `JSX.Element` | - | Icon or element to display |
|
|
28
|
-
| `addOnPosition` | `"start" \| "end"` | `"start"` | Position of the add-on |
|
|
29
|
-
| `gap` | `Gap` | `"medium"` | Space between elements |
|
|
30
|
-
| `padding` | `Padding` | `"none"` | Container padding |
|
|
31
|
-
| `disabled` | `boolean` | - | Disables the input |
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Basic usage
|
|
36
|
-
|
|
37
|
-
<Column gap="medium">
|
|
38
|
-
<RangeInput value={50} onValueChange={() => {}} />
|
|
39
|
-
</Column>
|
|
40
|
-
|
|
41
|
-
```js
|
|
42
|
-
const [value, setValue] = useState(50);
|
|
43
|
-
|
|
44
|
-
<RangeInput value={value} onValueChange={setValue} />
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## With label
|
|
50
|
-
|
|
51
|
-
Labels can be positioned at the start or end of the slider:
|
|
52
|
-
|
|
53
|
-
<Column gap="medium">
|
|
54
|
-
<RangeInput value={75} onValueChange={() => {}} label="75%" />
|
|
55
|
-
<RangeInput value={25} onValueChange={() => {}} label="25%" labelPosition="start" />
|
|
56
|
-
</Column>
|
|
57
|
-
|
|
58
|
-
```js
|
|
59
|
-
// Label at end (default)
|
|
60
|
-
<RangeInput value={value} onValueChange={setValue} label={`${value}%`} />
|
|
61
|
-
|
|
62
|
-
// Label at start
|
|
63
|
-
<RangeInput
|
|
64
|
-
value={value}
|
|
65
|
-
onValueChange={setValue}
|
|
66
|
-
label={`${value}%`}
|
|
67
|
-
labelPosition="start"
|
|
68
|
-
/>
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
## With icon add-on
|
|
74
|
-
|
|
75
|
-
Add icons to provide context for what the slider controls:
|
|
76
|
-
|
|
77
|
-
<Column gap="medium">
|
|
78
|
-
<RangeInput
|
|
79
|
-
addOn={<Icon icon="fa-volume-up" color="primary" size="medium" />}
|
|
80
|
-
value={50}
|
|
81
|
-
onValueChange={() => {}}
|
|
82
|
-
label="50%"
|
|
83
|
-
/>
|
|
84
|
-
<RangeInput
|
|
85
|
-
addOn={<Icon icon="fa-sun" color="warning" size="medium" />}
|
|
86
|
-
addOnPosition="end"
|
|
87
|
-
value={80}
|
|
88
|
-
onValueChange={() => {}}
|
|
89
|
-
label="Brightness"
|
|
90
|
-
labelPosition="start"
|
|
91
|
-
/>
|
|
92
|
-
</Column>
|
|
93
|
-
|
|
94
|
-
```js
|
|
95
|
-
// Icon at start (default)
|
|
96
|
-
<RangeInput
|
|
97
|
-
addOn={<Icon icon="fa-volume-up" color="primary" size="medium" />}
|
|
98
|
-
value={volume}
|
|
99
|
-
onValueChange={setVolume}
|
|
100
|
-
label={`${volume}%`}
|
|
101
|
-
/>
|
|
102
|
-
|
|
103
|
-
// Icon at end
|
|
104
|
-
<RangeInput
|
|
105
|
-
addOn={<Icon icon="fa-sun" color="warning" size="medium" />}
|
|
106
|
-
addOnPosition="end"
|
|
107
|
-
value={brightness}
|
|
108
|
-
onValueChange={setBrightness}
|
|
109
|
-
label="Brightness"
|
|
110
|
-
labelPosition="start"
|
|
111
|
-
/>
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
---
|
|
115
|
-
|
|
116
|
-
## Label styling
|
|
117
|
-
|
|
118
|
-
Customize the label appearance:
|
|
119
|
-
|
|
120
|
-
<Column gap="medium">
|
|
121
|
-
<RangeInput
|
|
122
|
-
addOn={<Icon icon="fa-volume-up" color="primary" size="medium" />}
|
|
123
|
-
value={75}
|
|
124
|
-
onValueChange={() => {}}
|
|
125
|
-
label="75%"
|
|
126
|
-
labelSize="large"
|
|
127
|
-
/>
|
|
128
|
-
<RangeInput
|
|
129
|
-
addOn={<Icon icon="fa-volume-up" color="primary" size="medium" />}
|
|
130
|
-
value={90}
|
|
131
|
-
onValueChange={() => {}}
|
|
132
|
-
label="90%"
|
|
133
|
-
labelSize="large"
|
|
134
|
-
labelColor="highlight"
|
|
135
|
-
/>
|
|
136
|
-
<RangeInput
|
|
137
|
-
addOn={<Icon icon="fa-volume-up" color="primary" size="medium" />}
|
|
138
|
-
value={100}
|
|
139
|
-
onValueChange={() => {}}
|
|
140
|
-
label="MAX"
|
|
141
|
-
labelSize="large"
|
|
142
|
-
labelColor="highlight"
|
|
143
|
-
labelBold
|
|
144
|
-
/>
|
|
145
|
-
</Column>
|
|
146
|
-
|
|
147
|
-
```js
|
|
148
|
-
<RangeInput
|
|
149
|
-
value={value}
|
|
150
|
-
onValueChange={setValue}
|
|
151
|
-
label={`${value}%`}
|
|
152
|
-
labelSize="large"
|
|
153
|
-
labelColor="highlight"
|
|
154
|
-
labelBold
|
|
155
|
-
/>
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## Custom range
|
|
161
|
-
|
|
162
|
-
Set min, max, and step values:
|
|
163
|
-
|
|
164
|
-
```js
|
|
165
|
-
// Temperature slider (0-100 in steps of 5)
|
|
166
|
-
<RangeInput
|
|
167
|
-
value={temperature}
|
|
168
|
-
onValueChange={setTemperature}
|
|
169
|
-
min={0}
|
|
170
|
-
max={100}
|
|
171
|
-
step={5}
|
|
172
|
-
label={`${temperature}°C`}
|
|
173
|
-
/>
|
|
174
|
-
|
|
175
|
-
// Decimal values (0-1 in steps of 0.1)
|
|
176
|
-
<RangeInput
|
|
177
|
-
value={opacity}
|
|
178
|
-
onValueChange={setOpacity}
|
|
179
|
-
min={0}
|
|
180
|
-
max={1}
|
|
181
|
-
step={0.1}
|
|
182
|
-
label={opacity.toFixed(1)}
|
|
183
|
-
/>
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
## Volume control example
|
|
189
|
-
|
|
190
|
-
<Row gap="medium" align="center" padding="medium">
|
|
191
|
-
<RangeInput
|
|
192
|
-
addOn={<Icon icon="fa-volume-up" color="primary" size="medium" />}
|
|
193
|
-
value={65}
|
|
194
|
-
onValueChange={() => {}}
|
|
195
|
-
label="65%"
|
|
196
|
-
labelBold
|
|
197
|
-
/>
|
|
198
|
-
</Row>
|
|
199
|
-
|
|
200
|
-
```js
|
|
201
|
-
function VolumeControl() {
|
|
202
|
-
const [volume, setVolume] = useState(50);
|
|
203
|
-
|
|
204
|
-
const icon = volume === 0
|
|
205
|
-
? "fa-volume-off"
|
|
206
|
-
: volume < 50
|
|
207
|
-
? "fa-volume-down"
|
|
208
|
-
: "fa-volume-up";
|
|
209
|
-
|
|
210
|
-
return (
|
|
211
|
-
<RangeInput
|
|
212
|
-
addOn={<Icon icon={icon} color="primary" size="medium" />}
|
|
213
|
-
value={volume}
|
|
214
|
-
onValueChange={setVolume}
|
|
215
|
-
label={`${volume}%`}
|
|
216
|
-
labelBold
|
|
217
|
-
/>
|
|
218
|
-
);
|
|
219
|
-
}
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
---
|
|
223
|
-
|
|
224
|
-
## Accessibility
|
|
225
|
-
|
|
226
|
-
- The underlying `<input type="range">` is fully accessible
|
|
227
|
-
- Labels are properly associated with the input via `htmlFor`
|
|
228
|
-
- Focus states are visually indicated
|
|
229
|
-
- Use `aria-label` or visible labels to describe the slider's purpose
|
|
230
|
-
|
|
231
|
-
```js
|
|
232
|
-
<RangeInput
|
|
233
|
-
aria-label="Volume"
|
|
234
|
-
value={volume}
|
|
235
|
-
onValueChange={setVolume}
|
|
236
|
-
/>
|
|
237
|
-
```
|