@idealyst/mcp-server 1.0.87 → 1.0.88
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/ARCHITECTURE.md +313 -0
- package/README.md +292 -104
- package/TYPE-SYSTEM.md +397 -0
- package/dist/index.js +170 -1
- package/examples/components/Accordion.examples.tsx +147 -0
- package/examples/components/ActivityIndicator.examples.tsx +350 -0
- package/examples/components/Alert.examples.tsx +335 -0
- package/examples/components/Avatar.examples.tsx +188 -0
- package/examples/components/Badge.examples.tsx +242 -0
- package/examples/components/Breadcrumb.examples.tsx +303 -0
- package/examples/components/Button.examples.tsx +113 -0
- package/examples/components/Card.examples.tsx +131 -0
- package/examples/components/Checkbox.examples.tsx +195 -0
- package/examples/components/Chip.examples.tsx +87 -0
- package/examples/components/Dialog.examples.tsx +344 -0
- package/examples/components/Divider.examples.tsx +258 -0
- package/examples/components/Icon.examples.tsx +202 -0
- package/examples/components/Input.examples.tsx +205 -0
- package/examples/components/Menu.examples.tsx +321 -0
- package/examples/components/Popover.examples.tsx +439 -0
- package/examples/components/Progress.examples.tsx +340 -0
- package/examples/components/RadioButton.examples.tsx +443 -0
- package/examples/components/Screen.examples.tsx +347 -0
- package/examples/components/Select.examples.tsx +279 -0
- package/examples/components/Skeleton.examples.tsx +278 -0
- package/examples/components/Slider.examples.tsx +249 -0
- package/examples/components/Switch.examples.tsx +94 -0
- package/examples/components/TabBar.examples.tsx +356 -0
- package/examples/components/Text.examples.tsx +177 -0
- package/examples/components/TextArea.examples.tsx +203 -0
- package/examples/components/Tooltip.examples.tsx +318 -0
- package/examples/components/View.examples.tsx +307 -0
- package/package.json +15 -2
- package/scripts/extract-types.ts +71 -0
- package/scripts/type-extractor.ts +286 -0
- package/scripts/validate-examples.ts +142 -0
- package/src/data/components/Icon.ts +1 -1
- package/src/data/components/index.ts +2 -0
- package/src/index.ts +181 -1
- package/src/tools/get-types.ts +169 -0
- package/tsconfig.examples.json +14 -0
- package/dist/data/cli-commands.d.ts +0 -2
- package/dist/data/cli-commands.d.ts.map +0 -1
- package/dist/data/cli-commands.js +0 -100
- package/dist/data/cli-commands.js.map +0 -1
- package/dist/data/components/Accordion.d.ts +0 -15
- package/dist/data/components/Accordion.d.ts.map +0 -1
- package/dist/data/components/Accordion.js +0 -112
- package/dist/data/components/Accordion.js.map +0 -1
- package/dist/data/components/ActivityIndicator.d.ts +0 -15
- package/dist/data/components/ActivityIndicator.d.ts.map +0 -1
- package/dist/data/components/ActivityIndicator.js +0 -82
- package/dist/data/components/ActivityIndicator.js.map +0 -1
- package/dist/data/components/Alert.d.ts +0 -15
- package/dist/data/components/Alert.d.ts.map +0 -1
- package/dist/data/components/Alert.js +0 -132
- package/dist/data/components/Alert.js.map +0 -1
- package/dist/data/components/Avatar.d.ts +0 -15
- package/dist/data/components/Avatar.d.ts.map +0 -1
- package/dist/data/components/Avatar.js +0 -93
- package/dist/data/components/Avatar.js.map +0 -1
- package/dist/data/components/Badge.d.ts +0 -15
- package/dist/data/components/Badge.d.ts.map +0 -1
- package/dist/data/components/Badge.js +0 -64
- package/dist/data/components/Badge.js.map +0 -1
- package/dist/data/components/Breadcrumb.d.ts +0 -15
- package/dist/data/components/Breadcrumb.d.ts.map +0 -1
- package/dist/data/components/Breadcrumb.js +0 -96
- package/dist/data/components/Breadcrumb.js.map +0 -1
- package/dist/data/components/Button.d.ts +0 -15
- package/dist/data/components/Button.d.ts.map +0 -1
- package/dist/data/components/Button.js +0 -87
- package/dist/data/components/Button.js.map +0 -1
- package/dist/data/components/Card.d.ts +0 -15
- package/dist/data/components/Card.d.ts.map +0 -1
- package/dist/data/components/Card.js +0 -67
- package/dist/data/components/Card.js.map +0 -1
- package/dist/data/components/Checkbox.d.ts +0 -15
- package/dist/data/components/Checkbox.d.ts.map +0 -1
- package/dist/data/components/Checkbox.js +0 -118
- package/dist/data/components/Checkbox.js.map +0 -1
- package/dist/data/components/Chip.d.ts +0 -15
- package/dist/data/components/Chip.d.ts.map +0 -1
- package/dist/data/components/Chip.js +0 -76
- package/dist/data/components/Chip.js.map +0 -1
- package/dist/data/components/Dialog.d.ts +0 -15
- package/dist/data/components/Dialog.d.ts.map +0 -1
- package/dist/data/components/Dialog.js +0 -137
- package/dist/data/components/Dialog.js.map +0 -1
- package/dist/data/components/Divider.d.ts +0 -15
- package/dist/data/components/Divider.d.ts.map +0 -1
- package/dist/data/components/Divider.js +0 -71
- package/dist/data/components/Divider.js.map +0 -1
- package/dist/data/components/Icon.d.ts +0 -15
- package/dist/data/components/Icon.d.ts.map +0 -1
- package/dist/data/components/Icon.js +0 -70
- package/dist/data/components/Icon.js.map +0 -1
- package/dist/data/components/Image.d.ts +0 -15
- package/dist/data/components/Image.d.ts.map +0 -1
- package/dist/data/components/Image.js +0 -122
- package/dist/data/components/Image.js.map +0 -1
- package/dist/data/components/Input.d.ts +0 -15
- package/dist/data/components/Input.d.ts.map +0 -1
- package/dist/data/components/Input.js +0 -109
- package/dist/data/components/Input.js.map +0 -1
- package/dist/data/components/List.d.ts +0 -15
- package/dist/data/components/List.d.ts.map +0 -1
- package/dist/data/components/List.js +0 -113
- package/dist/data/components/List.js.map +0 -1
- package/dist/data/components/Menu.d.ts +0 -15
- package/dist/data/components/Menu.d.ts.map +0 -1
- package/dist/data/components/Menu.js +0 -132
- package/dist/data/components/Menu.js.map +0 -1
- package/dist/data/components/Popover.d.ts +0 -15
- package/dist/data/components/Popover.d.ts.map +0 -1
- package/dist/data/components/Popover.js +0 -159
- package/dist/data/components/Popover.js.map +0 -1
- package/dist/data/components/Pressable.d.ts +0 -15
- package/dist/data/components/Pressable.d.ts.map +0 -1
- package/dist/data/components/Pressable.js +0 -125
- package/dist/data/components/Pressable.js.map +0 -1
- package/dist/data/components/Progress.d.ts +0 -15
- package/dist/data/components/Progress.d.ts.map +0 -1
- package/dist/data/components/Progress.js +0 -95
- package/dist/data/components/Progress.js.map +0 -1
- package/dist/data/components/RadioButton.d.ts +0 -15
- package/dist/data/components/RadioButton.d.ts.map +0 -1
- package/dist/data/components/RadioButton.js +0 -140
- package/dist/data/components/RadioButton.js.map +0 -1
- package/dist/data/components/SVGImage.d.ts +0 -15
- package/dist/data/components/SVGImage.d.ts.map +0 -1
- package/dist/data/components/SVGImage.js +0 -112
- package/dist/data/components/SVGImage.js.map +0 -1
- package/dist/data/components/Screen.d.ts +0 -15
- package/dist/data/components/Screen.d.ts.map +0 -1
- package/dist/data/components/Screen.js +0 -99
- package/dist/data/components/Screen.js.map +0 -1
- package/dist/data/components/Select.d.ts +0 -15
- package/dist/data/components/Select.d.ts.map +0 -1
- package/dist/data/components/Select.js +0 -146
- package/dist/data/components/Select.js.map +0 -1
- package/dist/data/components/Skeleton.d.ts +0 -15
- package/dist/data/components/Skeleton.d.ts.map +0 -1
- package/dist/data/components/Skeleton.js +0 -110
- package/dist/data/components/Skeleton.js.map +0 -1
- package/dist/data/components/Slider.d.ts +0 -15
- package/dist/data/components/Slider.d.ts.map +0 -1
- package/dist/data/components/Slider.js +0 -129
- package/dist/data/components/Slider.js.map +0 -1
- package/dist/data/components/Switch.d.ts +0 -15
- package/dist/data/components/Switch.d.ts.map +0 -1
- package/dist/data/components/Switch.js +0 -127
- package/dist/data/components/Switch.js.map +0 -1
- package/dist/data/components/TabBar.d.ts +0 -15
- package/dist/data/components/TabBar.d.ts.map +0 -1
- package/dist/data/components/TabBar.js +0 -145
- package/dist/data/components/TabBar.js.map +0 -1
- package/dist/data/components/Table.d.ts +0 -15
- package/dist/data/components/Table.d.ts.map +0 -1
- package/dist/data/components/Table.js +0 -151
- package/dist/data/components/Table.js.map +0 -1
- package/dist/data/components/Tabs.d.ts +0 -15
- package/dist/data/components/Tabs.d.ts.map +0 -1
- package/dist/data/components/Tabs.js +0 -150
- package/dist/data/components/Tabs.js.map +0 -1
- package/dist/data/components/Text.d.ts +0 -15
- package/dist/data/components/Text.d.ts.map +0 -1
- package/dist/data/components/Text.js +0 -85
- package/dist/data/components/Text.js.map +0 -1
- package/dist/data/components/TextArea.d.ts +0 -15
- package/dist/data/components/TextArea.d.ts.map +0 -1
- package/dist/data/components/TextArea.js +0 -155
- package/dist/data/components/TextArea.js.map +0 -1
- package/dist/data/components/Tooltip.d.ts +0 -15
- package/dist/data/components/Tooltip.d.ts.map +0 -1
- package/dist/data/components/Tooltip.js +0 -105
- package/dist/data/components/Tooltip.js.map +0 -1
- package/dist/data/components/Video.d.ts +0 -15
- package/dist/data/components/Video.d.ts.map +0 -1
- package/dist/data/components/Video.js +0 -168
- package/dist/data/components/Video.js.map +0 -1
- package/dist/data/components/View.d.ts +0 -15
- package/dist/data/components/View.d.ts.map +0 -1
- package/dist/data/components/View.js +0 -126
- package/dist/data/components/View.js.map +0 -1
- package/dist/data/components/index.d.ts +0 -37
- package/dist/data/components/index.d.ts.map +0 -1
- package/dist/data/components/index.js +0 -110
- package/dist/data/components/index.js.map +0 -1
- package/dist/data/framework-guides.d.ts +0 -2
- package/dist/data/framework-guides.d.ts.map +0 -1
- package/dist/data/framework-guides.js +0 -589
- package/dist/data/framework-guides.js.map +0 -1
- package/dist/data/icon-guide.d.ts +0 -2
- package/dist/data/icon-guide.d.ts.map +0 -1
- package/dist/data/icon-guide.js +0 -285
- package/dist/data/icon-guide.js.map +0 -1
- package/dist/data/icons.json +0 -7452
- package/dist/data/navigation-guides.d.ts +0 -2
- package/dist/data/navigation-guides.d.ts.map +0 -1
- package/dist/data/navigation-guides.js +0 -1196
- package/dist/data/navigation-guides.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progress Component Examples
|
|
3
|
+
*
|
|
4
|
+
* These examples are type-checked against the actual ProgressProps interface
|
|
5
|
+
* to ensure accuracy and correctness.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Progress, View, Text, Button } from '@idealyst/components';
|
|
10
|
+
|
|
11
|
+
// Example 1: Basic Linear Progress
|
|
12
|
+
export function BasicLinearProgress() {
|
|
13
|
+
return (
|
|
14
|
+
<View spacing="md">
|
|
15
|
+
<Progress value={50} max={100} variant="linear" />
|
|
16
|
+
<Text size="sm" >
|
|
17
|
+
50% complete
|
|
18
|
+
</Text>
|
|
19
|
+
</View>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Example 2: Basic Circular Progress
|
|
24
|
+
export function BasicCircularProgress() {
|
|
25
|
+
return (
|
|
26
|
+
<View spacing="md">
|
|
27
|
+
<Progress value={75} max={100} variant="circular" />
|
|
28
|
+
<Text size="sm" >
|
|
29
|
+
75% complete
|
|
30
|
+
</Text>
|
|
31
|
+
</View>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Example 3: Progress Sizes
|
|
36
|
+
export function ProgressSizes() {
|
|
37
|
+
return (
|
|
38
|
+
<View spacing="lg">
|
|
39
|
+
<View spacing="sm">
|
|
40
|
+
<Text weight="semibold">Linear Sizes</Text>
|
|
41
|
+
<Progress value={60} variant="linear" size="xs" />
|
|
42
|
+
<Progress value={60} variant="linear" size="sm" />
|
|
43
|
+
<Progress value={60} variant="linear" size="md" />
|
|
44
|
+
<Progress value={60} variant="linear" size="lg" />
|
|
45
|
+
<Progress value={60} variant="linear" size="xl" />
|
|
46
|
+
</View>
|
|
47
|
+
<View spacing="sm">
|
|
48
|
+
<Text weight="semibold">Circular Sizes</Text>
|
|
49
|
+
<View spacing="sm">
|
|
50
|
+
<Progress value={60} variant="circular" size="xs" />
|
|
51
|
+
<Progress value={60} variant="circular" size="sm" />
|
|
52
|
+
<Progress value={60} variant="circular" size="md" />
|
|
53
|
+
<Progress value={60} variant="circular" size="lg" />
|
|
54
|
+
<Progress value={60} variant="circular" size="xl" />
|
|
55
|
+
</View>
|
|
56
|
+
</View>
|
|
57
|
+
</View>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Example 4: Progress with Intent Colors
|
|
62
|
+
export function ProgressWithIntent() {
|
|
63
|
+
return (
|
|
64
|
+
<View spacing="md">
|
|
65
|
+
<View spacing="sm">
|
|
66
|
+
<Text size="sm">Primary</Text>
|
|
67
|
+
<Progress value={70} intent="primary" variant="linear" />
|
|
68
|
+
</View>
|
|
69
|
+
<View spacing="sm">
|
|
70
|
+
<Text size="sm">Success</Text>
|
|
71
|
+
<Progress value={70} intent="success" variant="linear" />
|
|
72
|
+
</View>
|
|
73
|
+
<View spacing="sm">
|
|
74
|
+
<Text size="sm">Error</Text>
|
|
75
|
+
<Progress value={70} intent="error" variant="linear" />
|
|
76
|
+
</View>
|
|
77
|
+
<View spacing="sm">
|
|
78
|
+
<Text size="sm">Warning</Text>
|
|
79
|
+
<Progress value={70} intent="warning" variant="linear" />
|
|
80
|
+
</View>
|
|
81
|
+
<View spacing="sm">
|
|
82
|
+
<Text size="sm">Info</Text>
|
|
83
|
+
<Progress value={70} intent="info" variant="linear" />
|
|
84
|
+
</View>
|
|
85
|
+
</View>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Example 5: Progress with Labels
|
|
90
|
+
export function ProgressWithLabels() {
|
|
91
|
+
return (
|
|
92
|
+
<View spacing="md">
|
|
93
|
+
<Progress value={45} showLabel variant="linear" />
|
|
94
|
+
<Progress value={80} showLabel label="Installing..." variant="linear" intent="info" />
|
|
95
|
+
<Progress value={100} showLabel label="Complete!" variant="linear" intent="success" />
|
|
96
|
+
</View>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Example 6: Indeterminate Progress
|
|
101
|
+
export function IndeterminateProgress() {
|
|
102
|
+
return (
|
|
103
|
+
<View spacing="md">
|
|
104
|
+
<View spacing="sm">
|
|
105
|
+
<Text weight="semibold">Linear Indeterminate</Text>
|
|
106
|
+
<Progress indeterminate variant="linear" intent="primary" />
|
|
107
|
+
</View>
|
|
108
|
+
<View spacing="sm">
|
|
109
|
+
<Text weight="semibold">Circular Indeterminate</Text>
|
|
110
|
+
<Progress indeterminate variant="circular" intent="primary" />
|
|
111
|
+
</View>
|
|
112
|
+
</View>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Example 7: Rounded Progress
|
|
117
|
+
export function RoundedProgress() {
|
|
118
|
+
return (
|
|
119
|
+
<View spacing="md">
|
|
120
|
+
<View spacing="sm">
|
|
121
|
+
<Text>Standard corners</Text>
|
|
122
|
+
<Progress value={65} variant="linear" rounded={false} />
|
|
123
|
+
</View>
|
|
124
|
+
<View spacing="sm">
|
|
125
|
+
<Text>Rounded corners</Text>
|
|
126
|
+
<Progress value={65} variant="linear" rounded />
|
|
127
|
+
</View>
|
|
128
|
+
</View>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Example 8: Animated Progress
|
|
133
|
+
export function AnimatedProgress() {
|
|
134
|
+
const [progress, setProgress] = React.useState(0);
|
|
135
|
+
|
|
136
|
+
React.useEffect(() => {
|
|
137
|
+
const interval = setInterval(() => {
|
|
138
|
+
setProgress((prev) => {
|
|
139
|
+
if (prev >= 100) return 0;
|
|
140
|
+
return prev + 1;
|
|
141
|
+
});
|
|
142
|
+
}, 100);
|
|
143
|
+
|
|
144
|
+
return () => clearInterval(interval);
|
|
145
|
+
}, []);
|
|
146
|
+
|
|
147
|
+
return (
|
|
148
|
+
<View spacing="md">
|
|
149
|
+
<Progress value={progress} showLabel variant="linear" intent="success" />
|
|
150
|
+
<Progress value={progress} showLabel variant="circular" intent="success" />
|
|
151
|
+
</View>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Example 9: File Upload Progress
|
|
156
|
+
export function FileUploadProgress() {
|
|
157
|
+
const [uploading, setUploading] = React.useState(false);
|
|
158
|
+
const [progress, setProgress] = React.useState(0);
|
|
159
|
+
|
|
160
|
+
const startUpload = () => {
|
|
161
|
+
setUploading(true);
|
|
162
|
+
setProgress(0);
|
|
163
|
+
|
|
164
|
+
const interval = setInterval(() => {
|
|
165
|
+
setProgress((prev) => {
|
|
166
|
+
if (prev >= 100) {
|
|
167
|
+
clearInterval(interval);
|
|
168
|
+
setUploading(false);
|
|
169
|
+
return 100;
|
|
170
|
+
}
|
|
171
|
+
return prev + 10;
|
|
172
|
+
});
|
|
173
|
+
}, 500);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
<View spacing="lg">
|
|
178
|
+
<Button onPress={startUpload} disabled={uploading}>
|
|
179
|
+
{uploading ? 'Uploading...' : 'Upload File'}
|
|
180
|
+
</Button>
|
|
181
|
+
{uploading && (
|
|
182
|
+
<View spacing="md">
|
|
183
|
+
<Progress
|
|
184
|
+
value={progress}
|
|
185
|
+
showLabel
|
|
186
|
+
label="Uploading file..."
|
|
187
|
+
variant="linear"
|
|
188
|
+
intent="info"
|
|
189
|
+
/>
|
|
190
|
+
</View>
|
|
191
|
+
)}
|
|
192
|
+
{progress === 100 && !uploading && (
|
|
193
|
+
<Text size="sm" >
|
|
194
|
+
Upload complete!
|
|
195
|
+
</Text>
|
|
196
|
+
)}
|
|
197
|
+
</View>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Example 10: Multi-step Progress
|
|
202
|
+
export function MultiStepProgress() {
|
|
203
|
+
const [currentStep, setCurrentStep] = React.useState(1);
|
|
204
|
+
const totalSteps = 4;
|
|
205
|
+
const progress = (currentStep / totalSteps) * 100;
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
<View spacing="lg">
|
|
209
|
+
<View spacing="md">
|
|
210
|
+
<Text weight="semibold">
|
|
211
|
+
Step {currentStep} of {totalSteps}
|
|
212
|
+
</Text>
|
|
213
|
+
<Progress value={progress} showLabel variant="linear" intent="primary" />
|
|
214
|
+
</View>
|
|
215
|
+
<View spacing="sm">
|
|
216
|
+
<Button
|
|
217
|
+
onPress={() => setCurrentStep((prev) => Math.min(prev + 1, totalSteps))}
|
|
218
|
+
disabled={currentStep === totalSteps}
|
|
219
|
+
>
|
|
220
|
+
Next Step
|
|
221
|
+
</Button>
|
|
222
|
+
<Button
|
|
223
|
+
type="outlined"
|
|
224
|
+
onPress={() => setCurrentStep((prev) => Math.max(prev - 1, 1))}
|
|
225
|
+
disabled={currentStep === 1}
|
|
226
|
+
>
|
|
227
|
+
Previous Step
|
|
228
|
+
</Button>
|
|
229
|
+
<Button type="outlined" onPress={() => setCurrentStep(1)}>
|
|
230
|
+
Reset
|
|
231
|
+
</Button>
|
|
232
|
+
</View>
|
|
233
|
+
</View>
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Example 11: Download Progress
|
|
238
|
+
export function DownloadProgress() {
|
|
239
|
+
const [downloading, setDownloading] = React.useState(false);
|
|
240
|
+
const [progress, setProgress] = React.useState(0);
|
|
241
|
+
|
|
242
|
+
const startDownload = () => {
|
|
243
|
+
setDownloading(true);
|
|
244
|
+
setProgress(0);
|
|
245
|
+
|
|
246
|
+
const interval = setInterval(() => {
|
|
247
|
+
setProgress((prev) => {
|
|
248
|
+
if (prev >= 100) {
|
|
249
|
+
clearInterval(interval);
|
|
250
|
+
setDownloading(false);
|
|
251
|
+
return 100;
|
|
252
|
+
}
|
|
253
|
+
return prev + 5;
|
|
254
|
+
});
|
|
255
|
+
}, 200);
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
return (
|
|
259
|
+
<View spacing="lg">
|
|
260
|
+
<Button onPress={startDownload} disabled={downloading} intent="success">
|
|
261
|
+
{downloading ? 'Downloading...' : 'Download'}
|
|
262
|
+
</Button>
|
|
263
|
+
{downloading && (
|
|
264
|
+
<View spacing="md">
|
|
265
|
+
<Progress value={progress} variant="linear" intent="success" />
|
|
266
|
+
<Text size="sm" >
|
|
267
|
+
{progress}% downloaded
|
|
268
|
+
</Text>
|
|
269
|
+
</View>
|
|
270
|
+
)}
|
|
271
|
+
</View>
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// Example 12: Storage Usage Progress
|
|
276
|
+
export function StorageUsageProgress() {
|
|
277
|
+
const usedStorage = 45; // GB
|
|
278
|
+
const totalStorage = 100; // GB
|
|
279
|
+
const percentage = (usedStorage / totalStorage) * 100;
|
|
280
|
+
|
|
281
|
+
const getIntent = () => {
|
|
282
|
+
if (percentage < 50) return 'success';
|
|
283
|
+
if (percentage < 80) return 'warning';
|
|
284
|
+
return 'error';
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
return (
|
|
288
|
+
<View spacing="md">
|
|
289
|
+
<View spacing="xs">
|
|
290
|
+
<Text weight="semibold">Storage Usage</Text>
|
|
291
|
+
<Text size="sm" >
|
|
292
|
+
{usedStorage} GB of {totalStorage} GB used
|
|
293
|
+
</Text>
|
|
294
|
+
</View>
|
|
295
|
+
<Progress
|
|
296
|
+
value={percentage}
|
|
297
|
+
showLabel
|
|
298
|
+
variant="linear"
|
|
299
|
+
intent={getIntent()}
|
|
300
|
+
rounded
|
|
301
|
+
/>
|
|
302
|
+
</View>
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Example 13: Battery Level Progress
|
|
307
|
+
export function BatteryLevelProgress() {
|
|
308
|
+
const [batteryLevel, setBatteryLevel] = React.useState(75);
|
|
309
|
+
|
|
310
|
+
const getIntent = () => {
|
|
311
|
+
if (batteryLevel > 50) return 'success';
|
|
312
|
+
if (batteryLevel > 20) return 'warning';
|
|
313
|
+
return 'error';
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
return (
|
|
317
|
+
<View spacing="md">
|
|
318
|
+
<View spacing="xs">
|
|
319
|
+
<Text weight="semibold">Battery Level</Text>
|
|
320
|
+
<Text size="sm" >
|
|
321
|
+
{batteryLevel}% remaining
|
|
322
|
+
</Text>
|
|
323
|
+
</View>
|
|
324
|
+
<Progress
|
|
325
|
+
value={batteryLevel}
|
|
326
|
+
variant="circular"
|
|
327
|
+
showLabel
|
|
328
|
+
intent={getIntent()}
|
|
329
|
+
/>
|
|
330
|
+
<View spacing="sm">
|
|
331
|
+
<Button size="sm" onPress={() => setBatteryLevel(Math.min(100, batteryLevel + 10))}>
|
|
332
|
+
Charge +10%
|
|
333
|
+
</Button>
|
|
334
|
+
<Button size="sm" onPress={() => setBatteryLevel(Math.max(0, batteryLevel - 10))}>
|
|
335
|
+
Drain -10%
|
|
336
|
+
</Button>
|
|
337
|
+
</View>
|
|
338
|
+
</View>
|
|
339
|
+
);
|
|
340
|
+
}
|