@ceed/cds 1.28.0 → 1.29.0-next.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/components/CurrencyInput/CurrencyInput.d.ts +1 -1
- package/dist/components/CurrencyInput/hooks/use-currency-setting.d.ts +2 -2
- package/dist/components/DataTable/hooks.d.ts +2 -1
- package/dist/components/DataTable/utils.d.ts +1 -0
- package/dist/components/SearchBar/SearchBar.d.ts +21 -0
- package/dist/components/SearchBar/index.d.ts +3 -0
- package/dist/components/data-display/DataTable.md +1 -1
- package/dist/components/data-display/InfoSign.md +91 -74
- package/dist/components/data-display/Typography.md +94 -411
- package/dist/components/feedback/Dialog.md +62 -76
- package/dist/components/feedback/Modal.md +138 -430
- package/dist/components/feedback/llms.txt +0 -2
- package/dist/components/index.d.ts +2 -1
- package/dist/components/inputs/Autocomplete.md +107 -356
- package/dist/components/inputs/ButtonGroup.md +104 -115
- package/dist/components/inputs/CurrencyInput.md +5 -183
- package/dist/components/inputs/DatePicker.md +431 -108
- package/dist/components/inputs/DateRangePicker.md +492 -131
- package/dist/components/inputs/FilterableCheckboxGroup.md +19 -145
- package/dist/components/inputs/IconButton.md +88 -137
- package/dist/components/inputs/Input.md +73 -204
- package/dist/components/inputs/MonthPicker.md +422 -95
- package/dist/components/inputs/MonthRangePicker.md +466 -89
- package/dist/components/inputs/PercentageInput.md +16 -185
- package/dist/components/inputs/RadioButton.md +35 -163
- package/dist/components/inputs/SearchBar.md +44 -0
- package/dist/components/inputs/Select.md +326 -222
- package/dist/components/inputs/Switch.md +376 -143
- package/dist/components/inputs/Textarea.md +10 -213
- package/dist/components/inputs/Uploader/Uploader.md +66 -145
- package/dist/components/inputs/llms.txt +1 -4
- package/dist/components/navigation/Breadcrumbs.md +308 -57
- package/dist/components/navigation/Drawer.md +0 -180
- package/dist/components/navigation/Dropdown.md +215 -98
- package/dist/components/navigation/IconMenuButton.md +502 -40
- package/dist/components/navigation/InsetDrawer.md +650 -281
- package/dist/components/navigation/Link.md +348 -31
- package/dist/components/navigation/Menu.md +285 -92
- package/dist/components/navigation/MenuButton.md +448 -55
- package/dist/components/navigation/Pagination.md +338 -47
- package/dist/components/navigation/Stepper.md +28 -160
- package/dist/components/navigation/Tabs.md +316 -57
- package/dist/components/surfaces/Accordions.md +804 -49
- package/dist/components/surfaces/Card.md +157 -97
- package/dist/components/surfaces/Divider.md +234 -83
- package/dist/components/surfaces/Sheet.md +328 -153
- package/dist/index.cjs +435 -577
- package/dist/index.d.ts +1 -1
- package/dist/index.js +424 -510
- package/dist/llms.txt +1 -9
- package/framer/index.js +1 -1
- package/package.json +17 -22
- package/dist/chunks/rehype-accent-FZRUD7VI.js +0 -39
- package/dist/components/RadioTileGroup/RadioTileGroup.d.ts +0 -56
- package/dist/components/RadioTileGroup/index.d.ts +0 -3
- package/dist/components/feedback/CircularProgress.md +0 -257
- package/dist/components/feedback/Skeleton.md +0 -280
- package/dist/components/inputs/FormControl.md +0 -361
- package/dist/components/inputs/RadioList.md +0 -241
- package/dist/components/inputs/RadioTileGroup.md +0 -507
- package/dist/components/inputs/Slider.md +0 -334
- package/dist/guides/ThemeProvider.md +0 -89
- package/dist/guides/llms.txt +0 -9
- package/dist/index.browser.js +0 -224
- package/dist/index.browser.js.map +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ceed/cds",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.0-next.1",
|
|
4
4
|
"main": "dist/index.cjs",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,12 +11,9 @@
|
|
|
11
11
|
"storybook": "storybook dev -p 6006",
|
|
12
12
|
"test-storybook": "vitest --project=storybook",
|
|
13
13
|
"build-storybook": "storybook build --webpack-stats-json",
|
|
14
|
-
"build": "yarn build-for-framer && rm -rf ./dist && tsc --emitDeclarationOnly -p tsconfig.build.json && yarn build:esm && yarn build:cjs && yarn
|
|
15
|
-
"
|
|
16
|
-
"build:
|
|
17
|
-
"build:cjs": "node esbuild.cjs.mjs",
|
|
18
|
-
"build:browser": "node esbuild.browser.mjs",
|
|
19
|
-
"build:browser:prod": "NODE_ENV=production node esbuild.browser.mjs",
|
|
14
|
+
"build": "yarn build-for-framer && rm -rf ./dist && tsc --emitDeclarationOnly -p tsconfig.build.json && yarn build:esm && yarn build:cjs && yarn generate:dist-llms",
|
|
15
|
+
"build:esm": "yarn esbuild src/index.ts --bundle --outfile='dist/index.js' --format=esm '--packages=external' --tsconfig=tsconfig.build.json",
|
|
16
|
+
"build:cjs": "yarn esbuild src/index.ts --bundle --outfile='dist/index.cjs' --format=cjs '--packages=external' --tsconfig=tsconfig.build.json",
|
|
20
17
|
"build-for-framer": "yarn esbuild src/framer-entrypoint.ts --bundle --outfile='framer/index.js' --format=esm '--external:react' '--external:react/jsx-runtime' '--external:react-dom' '--external:framer' '--external:framer-motion' --main-fields=module,main --target=chrome58 --minify",
|
|
21
18
|
"prepack": "yarn build",
|
|
22
19
|
"lint": "oxlint && eslint \"./src/**/*.{ts,tsx}\"",
|
|
@@ -29,12 +26,8 @@
|
|
|
29
26
|
],
|
|
30
27
|
"exports": {
|
|
31
28
|
".": {
|
|
32
|
-
"browser": "./dist/index.browser.js",
|
|
33
29
|
"import": "./dist/index.js",
|
|
34
30
|
"require": "./dist/index.cjs"
|
|
35
|
-
},
|
|
36
|
-
"./browser": {
|
|
37
|
-
"import": "./dist/index.browser.js"
|
|
38
31
|
}
|
|
39
32
|
},
|
|
40
33
|
"author": "Ecube Labs",
|
|
@@ -61,27 +54,28 @@
|
|
|
61
54
|
"unist-util-visit": "^5.0.0"
|
|
62
55
|
},
|
|
63
56
|
"devDependencies": {
|
|
64
|
-
"@chromatic-com/storybook": "^
|
|
57
|
+
"@chromatic-com/storybook": "^4.0.1",
|
|
65
58
|
"@ecubelabs/prettier-config": "^0.0.8",
|
|
66
59
|
"@ecubelabs/tsconfig": "^1.0.0",
|
|
67
60
|
"@mui/material": "^5.15.10",
|
|
68
61
|
"@prettier/plugin-oxc": "^0.0.4",
|
|
69
|
-
"@storybook/addon-a11y": "^
|
|
70
|
-
"@storybook/addon-docs": "^
|
|
71
|
-
"@storybook/addon-links": "^
|
|
72
|
-
"@storybook/addon-vitest": "^
|
|
73
|
-
"@storybook/
|
|
62
|
+
"@storybook/addon-a11y": "^9.0.18",
|
|
63
|
+
"@storybook/addon-docs": "^9.0.18",
|
|
64
|
+
"@storybook/addon-links": "^9.0.18",
|
|
65
|
+
"@storybook/addon-vitest": "^9.0.18",
|
|
66
|
+
"@storybook/builder-vite": "^9.0.18",
|
|
67
|
+
"@storybook/react-vite": "^9.0.18",
|
|
74
68
|
"@types/unist": "^3.0.2",
|
|
75
69
|
"@vitest/browser": "^3.2.4",
|
|
76
70
|
"@vitest/coverage-v8": "^3.2.4",
|
|
77
|
-
"esbuild": "^0.
|
|
71
|
+
"esbuild": "^0.25.0",
|
|
78
72
|
"eslint": "^8.46.0",
|
|
79
73
|
"eslint-config-prettier": "^10.1.5",
|
|
80
74
|
"eslint-plugin-oxlint": "^1.9.0",
|
|
81
75
|
"eslint-plugin-prettier": "^5.5.1",
|
|
82
76
|
"eslint-plugin-react": "^7.34.1",
|
|
83
77
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
84
|
-
"eslint-plugin-storybook": "
|
|
78
|
+
"eslint-plugin-storybook": "9.0.18",
|
|
85
79
|
"framer": "^2.4.1",
|
|
86
80
|
"oxlint": "^1.9.0",
|
|
87
81
|
"playwright": "^1.55.1",
|
|
@@ -90,15 +84,16 @@
|
|
|
90
84
|
"react-dom": "^18.2.0",
|
|
91
85
|
"semantic-release": "^24.2.1",
|
|
92
86
|
"semantic-release-yarn": "^3.0.2",
|
|
93
|
-
"storybook": "^
|
|
87
|
+
"storybook": "^9.0.18",
|
|
94
88
|
"turbo": "^2.5.6",
|
|
95
89
|
"typescript": "^5.3.3",
|
|
96
|
-
"vite": "^7.
|
|
90
|
+
"vite": "^7.1.11",
|
|
97
91
|
"vitest": "^3.2.4"
|
|
98
92
|
},
|
|
99
93
|
"repository": {
|
|
100
94
|
"type": "git",
|
|
101
95
|
"url": "git+ssh://git@github.com/Ecube-Labs/hds.git"
|
|
102
96
|
},
|
|
103
|
-
"packageManager": "yarn@4.1.0"
|
|
97
|
+
"packageManager": "yarn@4.1.0",
|
|
98
|
+
"stableVersion": "1.0.0"
|
|
104
99
|
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// src/libs/rehype-accent/index.ts
|
|
2
|
-
import { visit } from "unist-util-visit";
|
|
3
|
-
function rehypeAccent(options) {
|
|
4
|
-
const { accentColor } = options;
|
|
5
|
-
return (tree) => {
|
|
6
|
-
visit(tree, "text", (node, index, parent) => {
|
|
7
|
-
const value = node.value;
|
|
8
|
-
const regex = /\|\|.*?\|\|/g;
|
|
9
|
-
let match;
|
|
10
|
-
let lastIndex = 0;
|
|
11
|
-
const newNodes = [];
|
|
12
|
-
while ((match = regex.exec(value)) !== null) {
|
|
13
|
-
if (match.index > lastIndex) {
|
|
14
|
-
newNodes.push({
|
|
15
|
-
type: "text",
|
|
16
|
-
value: value.slice(lastIndex, match.index)
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
const innerText = match[0].split("||")[1];
|
|
20
|
-
newNodes.push({
|
|
21
|
-
type: "element",
|
|
22
|
-
tagName: "span",
|
|
23
|
-
properties: { textColor: accentColor },
|
|
24
|
-
children: [{ type: "text", value: innerText }]
|
|
25
|
-
});
|
|
26
|
-
lastIndex = match.index + match[0].length;
|
|
27
|
-
}
|
|
28
|
-
if (lastIndex < value.length) {
|
|
29
|
-
newNodes.push({ type: "text", value: value.slice(lastIndex) });
|
|
30
|
-
}
|
|
31
|
-
if (newNodes.length) {
|
|
32
|
-
parent.children.splice(index, 1, ...newNodes);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export {
|
|
38
|
-
rehypeAccent
|
|
39
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import type { SxProps } from '@mui/joy/styles/types';
|
|
3
|
-
export interface RadioTileOption<T = string> {
|
|
4
|
-
value: T;
|
|
5
|
-
label: ReactNode;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
startDecorator?: ReactNode;
|
|
8
|
-
}
|
|
9
|
-
export interface RadioTileGroupProps<T = string> {
|
|
10
|
-
/**
|
|
11
|
-
* @default 'sm'
|
|
12
|
-
*/
|
|
13
|
-
size?: 'sm' | 'md' | 'lg';
|
|
14
|
-
options: RadioTileOption<T>[];
|
|
15
|
-
value?: T;
|
|
16
|
-
defaultValue?: T;
|
|
17
|
-
name?: string;
|
|
18
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
19
|
-
sx?: SxProps;
|
|
20
|
-
disabled?: boolean;
|
|
21
|
-
className?: string;
|
|
22
|
-
useIndicator?: boolean;
|
|
23
|
-
flex?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* 지정하지 않으면 한 row에 모든 옵션이 렌더링된다.
|
|
26
|
-
* - 특정 rows 이내로 렌더링 하고 싶으면 `columns: Math.ceil(options.length / 원하는 rows)`로 설정할 수 있다.
|
|
27
|
-
* - 수직으로 렌더링 하고 싶으면 `columns: 1`로 설정할 수 있다.
|
|
28
|
-
* - `flex` 옵션과 함께 사용할수 있다.
|
|
29
|
-
*/
|
|
30
|
-
columns?: number;
|
|
31
|
-
/**
|
|
32
|
-
* @default 'center'
|
|
33
|
-
*/
|
|
34
|
-
textAlign?: 'start' | 'center';
|
|
35
|
-
/**
|
|
36
|
-
* Label for the RadioTileGroup
|
|
37
|
-
*/
|
|
38
|
-
label?: React.ReactNode;
|
|
39
|
-
/**
|
|
40
|
-
* Helper text for the RadioTileGroup
|
|
41
|
-
*/
|
|
42
|
-
helperText?: React.ReactNode;
|
|
43
|
-
/**
|
|
44
|
-
* Whether the RadioTileGroup has an error
|
|
45
|
-
*/
|
|
46
|
-
error?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Whether the RadioTileGroup is required
|
|
49
|
-
*/
|
|
50
|
-
required?: boolean;
|
|
51
|
-
}
|
|
52
|
-
declare function RadioTileGroup<T extends string | number = string>(props: RadioTileGroupProps<T>): React.JSX.Element;
|
|
53
|
-
declare namespace RadioTileGroup {
|
|
54
|
-
var displayName: string;
|
|
55
|
-
}
|
|
56
|
-
export { RadioTileGroup };
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
# CircularProgress
|
|
2
|
-
|
|
3
|
-
## Introduction
|
|
4
|
-
|
|
5
|
-
The CircularProgress component displays a circular loading indicator. It is based on Joy UI's CircularProgress and supports both indeterminate (spinning) and determinate (progress percentage) modes. Use it to provide visual feedback during asynchronous operations like data fetching, file uploads, or form submissions.
|
|
6
|
-
|
|
7
|
-
```tsx
|
|
8
|
-
<CircularProgress />
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
| Field | Description | Default |
|
|
12
|
-
| ----------- | ----------- | ------- |
|
|
13
|
-
| size | — | — |
|
|
14
|
-
| color | — | — |
|
|
15
|
-
| variant | — | — |
|
|
16
|
-
| value | — | — |
|
|
17
|
-
| determinate | — | — |
|
|
18
|
-
| thickness | — | — |
|
|
19
|
-
|
|
20
|
-
## Usage
|
|
21
|
-
|
|
22
|
-
```tsx
|
|
23
|
-
import { CircularProgress } from '@ceed/cds';
|
|
24
|
-
|
|
25
|
-
function MyComponent() {
|
|
26
|
-
return <CircularProgress />;
|
|
27
|
-
}
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Sizes
|
|
31
|
-
|
|
32
|
-
CircularProgress supports three sizes: `sm`, `md` (default), and `lg`.
|
|
33
|
-
|
|
34
|
-
```tsx
|
|
35
|
-
<>
|
|
36
|
-
<CircularProgress size="sm" />
|
|
37
|
-
<CircularProgress size="md" />
|
|
38
|
-
<CircularProgress size="lg" />
|
|
39
|
-
</>
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
```tsx
|
|
43
|
-
<CircularProgress size="sm" />
|
|
44
|
-
<CircularProgress size="md" />
|
|
45
|
-
<CircularProgress size="lg" />
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Colors
|
|
49
|
-
|
|
50
|
-
Five semantic colors are available via the `color` prop. The default is `primary`.
|
|
51
|
-
|
|
52
|
-
```tsx
|
|
53
|
-
<>
|
|
54
|
-
<CircularProgress color="primary" />
|
|
55
|
-
<CircularProgress color="neutral" />
|
|
56
|
-
<CircularProgress color="danger" />
|
|
57
|
-
<CircularProgress color="success" />
|
|
58
|
-
<CircularProgress color="warning" />
|
|
59
|
-
</>
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
```tsx
|
|
63
|
-
<CircularProgress color="primary" />
|
|
64
|
-
<CircularProgress color="neutral" />
|
|
65
|
-
<CircularProgress color="danger" />
|
|
66
|
-
<CircularProgress color="success" />
|
|
67
|
-
<CircularProgress color="warning" />
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Variants
|
|
71
|
-
|
|
72
|
-
Four visual variants are supported: `solid`, `soft` (default), `outlined`, and `plain`.
|
|
73
|
-
|
|
74
|
-
```tsx
|
|
75
|
-
<>
|
|
76
|
-
<CircularProgress variant="solid" />
|
|
77
|
-
<CircularProgress variant="soft" />
|
|
78
|
-
<CircularProgress variant="outlined" />
|
|
79
|
-
<CircularProgress variant="plain" />
|
|
80
|
-
</>
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
```tsx
|
|
84
|
-
<CircularProgress variant="solid" />
|
|
85
|
-
<CircularProgress variant="soft" />
|
|
86
|
-
<CircularProgress variant="outlined" />
|
|
87
|
-
<CircularProgress variant="plain" />
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Determinate Mode
|
|
91
|
-
|
|
92
|
-
Set `determinate` to `true` and provide a `value` (0–100) to display specific progress.
|
|
93
|
-
|
|
94
|
-
```tsx
|
|
95
|
-
<>
|
|
96
|
-
<CircularProgress determinate value={25} />
|
|
97
|
-
<CircularProgress determinate value={50} />
|
|
98
|
-
<CircularProgress determinate value={75} />
|
|
99
|
-
<CircularProgress determinate value={100} />
|
|
100
|
-
</>
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
```tsx
|
|
104
|
-
<CircularProgress determinate value={25} />
|
|
105
|
-
<CircularProgress determinate value={50} />
|
|
106
|
-
<CircularProgress determinate value={75} />
|
|
107
|
-
<CircularProgress determinate value={100} />
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
## With Label
|
|
111
|
-
|
|
112
|
-
Pass children to display a label inside the progress ring. This is useful for showing the current percentage.
|
|
113
|
-
|
|
114
|
-
```tsx
|
|
115
|
-
<CircularProgress determinate value={66}>
|
|
116
|
-
<Typography level="body-xs">66%</Typography>
|
|
117
|
-
</CircularProgress>
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
```tsx
|
|
121
|
-
<CircularProgress determinate value={66}>
|
|
122
|
-
<Typography level="body-xs">66%</Typography>
|
|
123
|
-
</CircularProgress>
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
## In Button
|
|
127
|
-
|
|
128
|
-
Use CircularProgress inside a Button to indicate a loading state.
|
|
129
|
-
|
|
130
|
-
```tsx
|
|
131
|
-
<>
|
|
132
|
-
<Button startDecorator={<CircularProgress variant="solid" size="sm" />}>
|
|
133
|
-
Loading…
|
|
134
|
-
</Button>
|
|
135
|
-
<Button disabled>
|
|
136
|
-
<CircularProgress variant="soft" size="sm" />
|
|
137
|
-
</Button>
|
|
138
|
-
</>
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
```tsx
|
|
142
|
-
<Button startDecorator={<CircularProgress variant="solid" size="sm" />}>
|
|
143
|
-
Loading…
|
|
144
|
-
</Button>
|
|
145
|
-
|
|
146
|
-
<Button disabled>
|
|
147
|
-
<CircularProgress variant="soft" size="sm" />
|
|
148
|
-
</Button>
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
## Thickness
|
|
152
|
-
|
|
153
|
-
Control the stroke thickness of the progress ring with the `thickness` prop.
|
|
154
|
-
|
|
155
|
-
```tsx
|
|
156
|
-
<>
|
|
157
|
-
<CircularProgress thickness={2} />
|
|
158
|
-
<CircularProgress thickness={4} />
|
|
159
|
-
<CircularProgress thickness={8} />
|
|
160
|
-
</>
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
```tsx
|
|
164
|
-
<CircularProgress thickness={2} />
|
|
165
|
-
<CircularProgress thickness={4} />
|
|
166
|
-
<CircularProgress thickness={8} />
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
## Common Use Cases
|
|
170
|
-
|
|
171
|
-
### Data Fetching Indicator
|
|
172
|
-
|
|
173
|
-
```tsx
|
|
174
|
-
function DataLoader() {
|
|
175
|
-
const [loading, setLoading] = React.useState(true);
|
|
176
|
-
const [data, setData] = React.useState(null);
|
|
177
|
-
|
|
178
|
-
React.useEffect(() => {
|
|
179
|
-
fetchData().then((result) => {
|
|
180
|
-
setData(result);
|
|
181
|
-
setLoading(false);
|
|
182
|
-
});
|
|
183
|
-
}, []);
|
|
184
|
-
|
|
185
|
-
if (loading) {
|
|
186
|
-
return (
|
|
187
|
-
<Box sx={{ display: 'flex', justifyContent: 'center', py: 4 }}>
|
|
188
|
-
<CircularProgress />
|
|
189
|
-
</Box>
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
return <DataView data={data} />;
|
|
194
|
-
}
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
### File Upload Progress
|
|
198
|
-
|
|
199
|
-
```tsx
|
|
200
|
-
function FileUpload({ progress }: { progress: number }) {
|
|
201
|
-
return (
|
|
202
|
-
<Stack direction="row" alignItems="center" spacing={2}>
|
|
203
|
-
<CircularProgress determinate value={progress} size="lg">
|
|
204
|
-
<Typography level="body-xs">{progress}%</Typography>
|
|
205
|
-
</CircularProgress>
|
|
206
|
-
<Typography level="body-md">Uploading file…</Typography>
|
|
207
|
-
</Stack>
|
|
208
|
-
);
|
|
209
|
-
}
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
### Inline Loading Button
|
|
213
|
-
|
|
214
|
-
```tsx
|
|
215
|
-
function SubmitButton({ isSubmitting }: { isSubmitting: boolean }) {
|
|
216
|
-
return (
|
|
217
|
-
<Button
|
|
218
|
-
disabled={isSubmitting}
|
|
219
|
-
startDecorator={
|
|
220
|
-
isSubmitting ? <CircularProgress variant="solid" size="sm" /> : null
|
|
221
|
-
}
|
|
222
|
-
>
|
|
223
|
-
{isSubmitting ? 'Submitting…' : 'Submit'}
|
|
224
|
-
</Button>
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
## Best Practices
|
|
230
|
-
|
|
231
|
-
1. **Use indeterminate for unknown durations**: When you cannot estimate progress, use the default spinning mode. Switch to determinate only when you can track actual progress.
|
|
232
|
-
|
|
233
|
-
```tsx
|
|
234
|
-
// ✅ Unknown duration — indeterminate
|
|
235
|
-
<CircularProgress />
|
|
236
|
-
|
|
237
|
-
// ✅ Known progress — determinate
|
|
238
|
-
<CircularProgress determinate value={uploadProgress} />
|
|
239
|
-
|
|
240
|
-
// ❌ Don't use determinate with a static value for loading
|
|
241
|
-
<CircularProgress determinate value={50} />
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
2. **Size appropriately**: Use `sm` for inline contexts (buttons, table cells), `md` for general use, and `lg` for prominent page-level loading states.
|
|
245
|
-
|
|
246
|
-
3. **Match variant with context**: Use `solid` variant inside solid buttons, and `soft` (default) for standalone usage to maintain visual consistency.
|
|
247
|
-
|
|
248
|
-
4. **Add descriptive text**: Always pair the indicator with text or an `aria-label` so users understand what is loading.
|
|
249
|
-
|
|
250
|
-
5. **Avoid multiple spinners**: Show one loading indicator per distinct loading region. Multiple spinners on a page create visual clutter.
|
|
251
|
-
|
|
252
|
-
## Accessibility
|
|
253
|
-
|
|
254
|
-
- CircularProgress has `role="progressbar"` by default.
|
|
255
|
-
- In determinate mode, `aria-valuenow`, `aria-valuemin`, and `aria-valuemax` are set automatically.
|
|
256
|
-
- Add `aria-label` or nearby descriptive text to explain what is loading (e.g., `aria-label="Loading user data"`).
|
|
257
|
-
- Ensure sufficient color contrast between the progress ring and its background, especially with the `plain` variant.
|