@xsolla/xui-progress-line 0.148.0 → 0.148.2
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 +93 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Progress Line
|
|
2
|
+
|
|
3
|
+
A cross-platform React linear progress bar component for displaying completion status horizontally.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @xsolla/xui-progress-line
|
|
9
|
+
# or
|
|
10
|
+
yarn add @xsolla/xui-progress-line
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Demo
|
|
14
|
+
|
|
15
|
+
### Basic Progress Line
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import * as React from 'react';
|
|
19
|
+
import { ProgressLine } from '@xsolla/xui-progress-line';
|
|
20
|
+
|
|
21
|
+
export default function BasicProgressLine() {
|
|
22
|
+
return <ProgressLine percent={75} aria-label="Task progress" />;
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Progress Line Sizes
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import * as React from 'react';
|
|
30
|
+
import { ProgressLine } from '@xsolla/xui-progress-line';
|
|
31
|
+
|
|
32
|
+
export default function ProgressLineSizes() {
|
|
33
|
+
return (
|
|
34
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
|
|
35
|
+
<ProgressLine percent={60} size="sm" aria-label="Small progress" />
|
|
36
|
+
<ProgressLine percent={60} size="md" aria-label="Medium progress" />
|
|
37
|
+
<ProgressLine percent={60} size="lg" aria-label="Large progress" />
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### With Label
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import * as React from 'react';
|
|
47
|
+
import { ProgressLine } from '@xsolla/xui-progress-line';
|
|
48
|
+
|
|
49
|
+
export default function ProgressLineWithLabel() {
|
|
50
|
+
const [progress, setProgress] = React.useState(45);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<div>
|
|
54
|
+
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 8 }}>
|
|
55
|
+
<span id="upload-label">Uploading...</span>
|
|
56
|
+
<span>{progress}%</span>
|
|
57
|
+
</div>
|
|
58
|
+
<ProgressLine percent={progress} aria-labelledby="upload-label" />
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Accessibility
|
|
65
|
+
|
|
66
|
+
ProgressLine includes `role="progressbar"` and appropriate `aria-valuenow`, `aria-valuemin`, and `aria-valuemax` attributes.
|
|
67
|
+
|
|
68
|
+
**Important:** You MUST provide an `aria-label` or `aria-labelledby` attribute so screen readers can describe what is progressing.
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
<ProgressLine percent={50} aria-label="File upload progress" />
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## API Reference
|
|
75
|
+
|
|
76
|
+
### ProgressLine
|
|
77
|
+
|
|
78
|
+
**ProgressLine Props:**
|
|
79
|
+
|
|
80
|
+
| Prop | Type | Default | Description |
|
|
81
|
+
| :--- | :--- | :------ | :---------- |
|
|
82
|
+
| percent | `number` | `0` | Progress percentage (0-100). |
|
|
83
|
+
| size | `"sm" \| "md" \| "lg"` | `"md"` | Height of the progress line. |
|
|
84
|
+
| state | `"default" \| "error" \| "success"` | `"default"` | Color state of the progress line. |
|
|
85
|
+
|
|
86
|
+
## Theming
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
theme.colors.background.brand.primary // Default fill color
|
|
90
|
+
theme.colors.background.alert.primary // Error fill color
|
|
91
|
+
theme.colors.background.success.primary // Success fill color
|
|
92
|
+
theme.colors.control.faint.bg // Track color
|
|
93
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsolla/xui-progress-line",
|
|
3
|
-
"version": "0.148.
|
|
3
|
+
"version": "0.148.2",
|
|
4
4
|
"main": "./web/index.js",
|
|
5
5
|
"module": "./web/index.mjs",
|
|
6
6
|
"types": "./web/index.d.ts",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"build:native": "PLATFORM=native tsup"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xsolla/xui-core": "0.148.
|
|
14
|
-
"@xsolla/xui-primitives-core": "0.148.
|
|
13
|
+
"@xsolla/xui-core": "0.148.2",
|
|
14
|
+
"@xsolla/xui-primitives-core": "0.148.2"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"react": ">=16.8.0",
|