@umbra.ui/core 0.1.18 → 0.1.20
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/controls/Button/Button.vue +417 -0
- package/dist/components/controls/Button/README.md +348 -0
- package/dist/components/controls/Button/theme.css +200 -0
- package/dist/components/controls/Checkbox/Checkbox.vue +164 -0
- package/dist/components/controls/Checkbox/README.md +441 -0
- package/dist/components/controls/Checkbox/theme.css +36 -0
- package/dist/components/controls/Dropdown/Dropdown.vue +476 -0
- package/dist/components/controls/Dropdown/README.md +370 -0
- package/dist/components/controls/Dropdown/theme.css +50 -0
- package/dist/components/controls/Dropdown/types.ts +6 -0
- package/dist/components/controls/IconButton/IconButton.vue +267 -0
- package/dist/components/controls/IconButton/README.md +502 -0
- package/dist/components/controls/IconButton/theme.css +89 -0
- package/dist/components/controls/Radio/README.md +591 -0
- package/dist/components/controls/Radio/Radio.vue +89 -0
- package/dist/components/controls/Radio/theme.css +14 -0
- package/dist/components/controls/RangeSlider/README.md +608 -0
- package/dist/components/controls/RangeSlider/RangeSlider.vue +535 -0
- package/dist/components/controls/RangeSlider/theme.css +80 -0
- package/dist/components/controls/SegmentedControl/README.md +587 -0
- package/dist/components/controls/SegmentedControl/SegmentedControl.vue +284 -0
- package/dist/components/controls/SegmentedControl/theme.css +60 -0
- package/dist/components/controls/SegmentedControl/types.ts +5 -0
- package/dist/components/controls/Slider/README.md +627 -0
- package/dist/components/controls/Slider/Slider.vue +260 -0
- package/dist/components/controls/Slider/theme.css +74 -0
- package/dist/components/controls/Stepper/README.md +601 -0
- package/dist/components/controls/Stepper/Stepper.vue +103 -0
- package/dist/components/controls/Stepper/theme.css +53 -0
- package/dist/components/controls/Switch/README.md +667 -0
- package/dist/components/controls/Switch/Switch.vue +127 -0
- package/dist/components/controls/Switch/theme.css +42 -0
- package/dist/components/dialogs/Alert/Alert.vue +218 -0
- package/dist/components/dialogs/Alert/README.md +450 -0
- package/dist/components/dialogs/Alert/theme.css +44 -0
- package/dist/components/dialogs/Alert/types.ts +11 -0
- package/dist/components/dialogs/Toast/README.md +522 -0
- package/dist/components/dialogs/Toast/Toast.vue +296 -0
- package/dist/components/dialogs/Toast/ToastContainer.vue +330 -0
- package/dist/components/dialogs/Toast/theme.css +44 -0
- package/dist/components/dialogs/Toast/types.ts +46 -0
- package/dist/components/dialogs/Toast/useToast.ts +127 -0
- package/dist/components/indicators/ProgressBar/ProgressBar.vue +98 -0
- package/dist/components/indicators/ProgressBar/README.md +744 -0
- package/dist/components/indicators/ProgressBar/theme.css +36 -0
- package/dist/components/indicators/Tooltip/README.md +723 -0
- package/dist/components/indicators/Tooltip/TooltipProvider.vue +142 -0
- package/dist/components/indicators/Tooltip/theme.css +18 -0
- package/dist/components/indicators/Tooltip/tooltip.ts +48 -0
- package/dist/components/indicators/Tooltip/types.ts +15 -0
- package/dist/components/indicators/Tooltip/useTooltip.ts +71 -0
- package/dist/components/inputs/AutogrowTextView/AutogrowTextView.vue +110 -0
- package/dist/components/inputs/AutogrowTextView/README.md +643 -0
- package/dist/components/inputs/AutogrowTextView/theme.css +28 -0
- package/dist/components/inputs/InputCard/InputCard.vue +600 -0
- package/dist/components/inputs/InputCard/README.md +636 -0
- package/dist/components/inputs/InputEmail/InputEmail.vue +698 -0
- package/dist/components/inputs/InputEmail/README.md +764 -0
- package/dist/components/inputs/InputNumber/InputNumber.vue +300 -0
- package/dist/components/inputs/InputNumber/README.md +749 -0
- package/dist/components/inputs/InputPhone/InputPhone.vue +645 -0
- package/dist/components/inputs/InputPhone/README.md +636 -0
- package/dist/components/inputs/InputSecure/InputSecure.vue +646 -0
- package/dist/components/inputs/InputSecure/README.md +771 -0
- package/dist/components/inputs/InputText/InputText.vue +225 -0
- package/dist/components/inputs/InputText/README.md +844 -0
- package/dist/components/inputs/OTP/OTP.vue +349 -0
- package/dist/components/inputs/OTP/README.md +736 -0
- package/dist/components/inputs/OTP/theme.css +50 -0
- package/dist/components/inputs/StringCapture/README.md +718 -0
- package/dist/components/inputs/StringCapture/StringCapture.vue +315 -0
- package/dist/components/inputs/StringCapture/theme.css +86 -0
- package/dist/components/inputs/Tags/README.md +897 -0
- package/dist/components/inputs/Tags/TagBar.vue +793 -0
- package/dist/components/inputs/Tags/TagCreation.vue +219 -0
- package/dist/components/inputs/Tags/TagPicker.vue +380 -0
- package/dist/components/inputs/Tags/tag-bar-styles.ts +354 -0
- package/dist/components/inputs/Tags/theme.css +121 -0
- package/dist/components/inputs/Tags/types.ts +346 -0
- package/dist/components/inputs/search/README.md +759 -0
- package/dist/components/inputs/search/SearchBar.vue +394 -0
- package/dist/components/inputs/search/SearchResults.vue +310 -0
- package/dist/components/inputs/search/theme.css +187 -0
- package/dist/components/inputs/search/types.ts +8 -0
- package/dist/components/inputs/theme.css +102 -0
- package/dist/components/menus/ActionMenu/ActionMenu.vue +383 -0
- package/dist/components/menus/ActionMenu/README.md +825 -0
- package/dist/components/menus/ActionMenu/theme.css +93 -0
- package/dist/components/models/Popover/Popover.vue +551 -0
- package/dist/components/models/Popover/README.md +885 -0
- package/dist/components/models/Popover/theme.css +52 -0
- package/dist/components/models/Sheet/README.md +1159 -0
- package/dist/components/models/Sheet/Sheet.vue +465 -0
- package/dist/components/models/Sheet/theme.css +72 -0
- package/dist/components/models/Sidebar/README.md +1228 -0
- package/dist/components/models/Sidebar/Sidebar.vue +480 -0
- package/dist/components/models/Sidebar/theme.css +90 -0
- package/dist/components/navigation/adaptive/AdaptiveLayout.vue +779 -0
- package/dist/components/navigation/adaptive/AdaptiveLayoutBreadcrumbs.vue +192 -0
- package/dist/components/navigation/adaptive/AdaptiveLayoutMenuButton.vue +149 -0
- package/dist/components/navigation/adaptive/README.md +768 -0
- package/dist/components/navigation/adaptive/types.ts +19 -0
- package/dist/components/navigation/adaptive/useAdaptiveLayout.ts +89 -0
- package/dist/components/navigation/adaptive/useBreakpoints.ts +41 -0
- package/dist/components/navigation/adaptive/useContainerMonitor.ts +214 -0
- package/dist/components/navigation/adaptive/useViewAnimation.ts +721 -0
- package/dist/components/navigation/adaptive/useViewResize.ts +211 -0
- package/dist/components/navigation/navstack/NavigationStack.vue +180 -0
- package/dist/components/navigation/navstack/README.md +994 -0
- package/dist/components/navigation/navstack/useNavigationStack.ts +164 -0
- package/dist/components/navigation/slideover/README.md +1275 -0
- package/dist/components/navigation/slideover/SlideoverController.vue +287 -0
- package/dist/components/navigation/slideover/useSlideoverController.ts +320 -0
- package/dist/components/navigation/splitview/README.md +1115 -0
- package/dist/components/navigation/splitview/SplitViewController.vue +176 -0
- package/dist/components/navigation/splitview/useSplitViewController.ts +388 -0
- package/dist/components/navigation/tabcontroller/README.md +919 -0
- package/dist/components/navigation/tabcontroller/TabController.vue +307 -0
- package/dist/components/navigation/tabcontroller/TabItem.vue +57 -0
- package/dist/components/navigation/tabcontroller/types.ts +24 -0
- package/dist/components/navigation/tabcontroller/useTabController.ts +18 -0
- package/dist/components/navigation/theme.css +91 -0
- package/dist/components/navigation/types.ts +7 -0
- package/dist/components/pickers/CollectionPicker/CollectionPicker.vue +398 -0
- package/dist/components/pickers/CollectionPicker/README.md +1115 -0
- package/dist/components/pickers/CollectionPicker/theme.css +14 -0
- package/dist/components/pickers/CollectionPicker/types.ts +11 -0
- package/dist/components/pickers/ColorPicker/ColorPicker.vue +376 -0
- package/dist/components/pickers/ColorPicker/README.md +1439 -0
- package/dist/components/pickers/ColorPicker/colors.ts +299 -0
- package/dist/components/pickers/ColorPicker/theme.css +32 -0
- package/dist/components/pickers/DatePicker/DatePicker.vue +660 -0
- package/dist/components/pickers/DatePicker/README.md +1195 -0
- package/dist/components/pickers/DatePicker/theme.css +22 -0
- package/dist/components/pickers/FilePicker/FilePicker.vue +534 -0
- package/dist/components/pickers/FilePicker/README.md +1542 -0
- package/dist/components/pickers/FilePicker/theme.css +48 -0
- package/dist/components/pickers/FilePicker/types.ts +10 -0
- package/dist/components/pickers/IconPicker/IconPicker.vue +327 -0
- package/dist/components/pickers/IconPicker/README.md +1161 -0
- package/dist/components/pickers/IconPicker/theme.css +28 -0
- package/dist/components/pickers/theme.css +82 -0
- package/dist/components/views/MarkdownViewer/MarkdownViewer.vue +442 -0
- package/dist/components/views/MarkdownViewer/README.md +833 -0
- package/dist/components/views/MarkdownViewer/theme.css +130 -0
- package/dist/css/umbra-ui.css +42 -0
- package/package.json +6 -3
|
@@ -0,0 +1,744 @@
|
|
|
1
|
+
# ProgressBar
|
|
2
|
+
|
|
3
|
+
A flexible progress bar component built with Vue 3 Composition API and TypeScript. The ProgressBar component provides visual feedback for loading states, completion percentages, and progress tracking with customizable styles, colors, and dimensions.
|
|
4
|
+
|
|
5
|
+
## Installation/Import
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { ProgressBar } from "@umbra-ui/core";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Dependencies:**
|
|
12
|
+
|
|
13
|
+
- Vue 3.x
|
|
14
|
+
|
|
15
|
+
## Basic Usage
|
|
16
|
+
|
|
17
|
+
```vue
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
import { ref } from "vue";
|
|
20
|
+
import { ProgressBar } from "@umbra-ui/core";
|
|
21
|
+
|
|
22
|
+
const progress = ref(45);
|
|
23
|
+
|
|
24
|
+
const updateProgress = (newProgress: number) => {
|
|
25
|
+
progress.value = newProgress;
|
|
26
|
+
};
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<div>
|
|
31
|
+
<ProgressBar :progress="progress" @update:progress="updateProgress" />
|
|
32
|
+
|
|
33
|
+
<button @click="updateProgress(75)">Set to 75%</button>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Props
|
|
39
|
+
|
|
40
|
+
| Prop Name | Type | Required | Default | Description |
|
|
41
|
+
| --------------- | ------------------------------------- | -------- | ----------------------------------------------- | ------------------------------------------------- |
|
|
42
|
+
| `progress` | `number` | No | `0` | Progress percentage (0-100) |
|
|
43
|
+
| `barType` | `"default" \| "capsule" \| "capline"` | No | `"default"` | Visual style variant of the progress bar |
|
|
44
|
+
| `trackColor` | `string` | No | `"var(--progressbar-track-default)"` | Background color of the progress track |
|
|
45
|
+
| `progressColor` | `string` | No | `"var(--progressbar-progress-default)"` | Color of the progress fill |
|
|
46
|
+
| `height` | `string` | No | `"6px"` (default) or `"12px"` (capsule/capline) | Height of the progress bar in pixels or CSS units |
|
|
47
|
+
|
|
48
|
+
## Events
|
|
49
|
+
|
|
50
|
+
| Event Name | Payload Type | Description |
|
|
51
|
+
| ----------------- | ------------ | -------------------------------------------------------------- |
|
|
52
|
+
| `update:progress` | `number` | Emitted when the progress value changes, returns the new value |
|
|
53
|
+
|
|
54
|
+
## Slots
|
|
55
|
+
|
|
56
|
+
This component does not use slots.
|
|
57
|
+
|
|
58
|
+
## Exposed Methods/Refs
|
|
59
|
+
|
|
60
|
+
This component does not expose any methods or refs.
|
|
61
|
+
|
|
62
|
+
## CSS Customization
|
|
63
|
+
|
|
64
|
+
The ProgressBar component uses CSS custom properties for easy theming and customization:
|
|
65
|
+
|
|
66
|
+
```css
|
|
67
|
+
/* ProgressBar track colors */
|
|
68
|
+
--progressbar-track-default: #f0f2f4;
|
|
69
|
+
--progressbar-track-capline: transparent;
|
|
70
|
+
|
|
71
|
+
/* ProgressBar progress colors */
|
|
72
|
+
--progressbar-progress-default: #0090ff;
|
|
73
|
+
|
|
74
|
+
/* ProgressBar border colors */
|
|
75
|
+
--progressbar-border-capline: #0090ff;
|
|
76
|
+
--progressbar-border-progress: white;
|
|
77
|
+
|
|
78
|
+
/* ProgressBar text colors */
|
|
79
|
+
--progressbar-text-default: #1a1d23;
|
|
80
|
+
--progressbar-text-capline: #1a1d23;
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Examples
|
|
84
|
+
|
|
85
|
+
### Different Bar Types
|
|
86
|
+
|
|
87
|
+
```vue
|
|
88
|
+
<script setup lang="ts">
|
|
89
|
+
import { ref } from "vue";
|
|
90
|
+
import { ProgressBar } from "@umbra-ui/core";
|
|
91
|
+
|
|
92
|
+
const progress = ref(60);
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<template>
|
|
96
|
+
<div class="progress-examples">
|
|
97
|
+
<div class="progress-group">
|
|
98
|
+
<label>Default Style</label>
|
|
99
|
+
<ProgressBar barType="default" :progress="progress" />
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
<div class="progress-group">
|
|
103
|
+
<label>Capsule Style</label>
|
|
104
|
+
<ProgressBar barType="capsule" :progress="progress" />
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<div class="progress-group">
|
|
108
|
+
<label>Capline Style</label>
|
|
109
|
+
<ProgressBar barType="capline" :progress="progress" />
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
</template>
|
|
113
|
+
|
|
114
|
+
<style module>
|
|
115
|
+
.progress-examples {
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: column;
|
|
118
|
+
gap: 1rem;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.progress-group {
|
|
122
|
+
display: flex;
|
|
123
|
+
flex-direction: column;
|
|
124
|
+
gap: 0.5rem;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
label {
|
|
128
|
+
font-weight: 500;
|
|
129
|
+
color: #333;
|
|
130
|
+
}
|
|
131
|
+
</style>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Custom Colors
|
|
135
|
+
|
|
136
|
+
```vue
|
|
137
|
+
<script setup lang="ts">
|
|
138
|
+
import { ref } from "vue";
|
|
139
|
+
import { ProgressBar } from "@umbra-ui/core";
|
|
140
|
+
|
|
141
|
+
const progress = ref(75);
|
|
142
|
+
</script>
|
|
143
|
+
|
|
144
|
+
<template>
|
|
145
|
+
<div class="color-examples">
|
|
146
|
+
<div class="progress-group">
|
|
147
|
+
<label>Red Progress</label>
|
|
148
|
+
<ProgressBar
|
|
149
|
+
:progress="progress"
|
|
150
|
+
progressColor="#ff4444"
|
|
151
|
+
trackColor="#ffe6e6"
|
|
152
|
+
/>
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
<div class="progress-group">
|
|
156
|
+
<label>Green Progress</label>
|
|
157
|
+
<ProgressBar
|
|
158
|
+
:progress="progress"
|
|
159
|
+
progressColor="#44ff44"
|
|
160
|
+
trackColor="#e6ffe6"
|
|
161
|
+
/>
|
|
162
|
+
</div>
|
|
163
|
+
|
|
164
|
+
<div class="progress-group">
|
|
165
|
+
<label>Purple Progress</label>
|
|
166
|
+
<ProgressBar
|
|
167
|
+
:progress="progress"
|
|
168
|
+
progressColor="#8844ff"
|
|
169
|
+
trackColor="#f0e6ff"
|
|
170
|
+
/>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
</template>
|
|
174
|
+
|
|
175
|
+
<style module>
|
|
176
|
+
.color-examples {
|
|
177
|
+
display: flex;
|
|
178
|
+
flex-direction: column;
|
|
179
|
+
gap: 1rem;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.progress-group {
|
|
183
|
+
display: flex;
|
|
184
|
+
flex-direction: column;
|
|
185
|
+
gap: 0.5rem;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
label {
|
|
189
|
+
font-weight: 500;
|
|
190
|
+
color: #333;
|
|
191
|
+
}
|
|
192
|
+
</style>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Different Heights
|
|
196
|
+
|
|
197
|
+
```vue
|
|
198
|
+
<script setup lang="ts">
|
|
199
|
+
import { ref } from "vue";
|
|
200
|
+
import { ProgressBar } from "@umbra-ui/core";
|
|
201
|
+
|
|
202
|
+
const progress = ref(50);
|
|
203
|
+
</script>
|
|
204
|
+
|
|
205
|
+
<template>
|
|
206
|
+
<div class="height-examples">
|
|
207
|
+
<div class="progress-group">
|
|
208
|
+
<label>Thin (4px)</label>
|
|
209
|
+
<ProgressBar :progress="progress" height="4px" />
|
|
210
|
+
</div>
|
|
211
|
+
|
|
212
|
+
<div class="progress-group">
|
|
213
|
+
<label>Default (6px)</label>
|
|
214
|
+
<ProgressBar :progress="progress" height="6px" />
|
|
215
|
+
</div>
|
|
216
|
+
|
|
217
|
+
<div class="progress-group">
|
|
218
|
+
<label>Medium (12px)</label>
|
|
219
|
+
<ProgressBar :progress="progress" height="12px" />
|
|
220
|
+
</div>
|
|
221
|
+
|
|
222
|
+
<div class="progress-group">
|
|
223
|
+
<label>Large (20px)</label>
|
|
224
|
+
<ProgressBar :progress="progress" height="20px" />
|
|
225
|
+
</div>
|
|
226
|
+
</div>
|
|
227
|
+
</template>
|
|
228
|
+
|
|
229
|
+
<style module>
|
|
230
|
+
.height-examples {
|
|
231
|
+
display: flex;
|
|
232
|
+
flex-direction: column;
|
|
233
|
+
gap: 1rem;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.progress-group {
|
|
237
|
+
display: flex;
|
|
238
|
+
flex-direction: column;
|
|
239
|
+
gap: 0.5rem;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
label {
|
|
243
|
+
font-weight: 500;
|
|
244
|
+
color: #333;
|
|
245
|
+
}
|
|
246
|
+
</style>
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### File Upload Progress
|
|
250
|
+
|
|
251
|
+
```vue
|
|
252
|
+
<script setup lang="ts">
|
|
253
|
+
import { ref } from "vue";
|
|
254
|
+
import { ProgressBar } from "@umbra-ui/core";
|
|
255
|
+
|
|
256
|
+
const uploadProgress = ref(0);
|
|
257
|
+
const isUploading = ref(false);
|
|
258
|
+
|
|
259
|
+
const simulateUpload = async () => {
|
|
260
|
+
isUploading.value = true;
|
|
261
|
+
uploadProgress.value = 0;
|
|
262
|
+
|
|
263
|
+
for (let i = 0; i <= 100; i += 10) {
|
|
264
|
+
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
265
|
+
uploadProgress.value = i;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
isUploading.value = false;
|
|
269
|
+
};
|
|
270
|
+
</script>
|
|
271
|
+
|
|
272
|
+
<template>
|
|
273
|
+
<div class="upload-example">
|
|
274
|
+
<h3>File Upload</h3>
|
|
275
|
+
|
|
276
|
+
<div class="upload-area">
|
|
277
|
+
<p>Click to upload a file</p>
|
|
278
|
+
<button @click="simulateUpload" :disabled="isUploading">
|
|
279
|
+
{{ isUploading ? "Uploading..." : "Upload File" }}
|
|
280
|
+
</button>
|
|
281
|
+
</div>
|
|
282
|
+
|
|
283
|
+
<div v-if="isUploading || uploadProgress > 0" class="progress-section">
|
|
284
|
+
<div class="progress-info">
|
|
285
|
+
<span>Upload Progress</span>
|
|
286
|
+
<span>{{ uploadProgress }}%</span>
|
|
287
|
+
</div>
|
|
288
|
+
<ProgressBar
|
|
289
|
+
:progress="uploadProgress"
|
|
290
|
+
barType="capsule"
|
|
291
|
+
progressColor="#30a46c"
|
|
292
|
+
trackColor="#e6f7e6"
|
|
293
|
+
height="8px"
|
|
294
|
+
/>
|
|
295
|
+
</div>
|
|
296
|
+
</div>
|
|
297
|
+
</template>
|
|
298
|
+
|
|
299
|
+
<style module>
|
|
300
|
+
.upload-example {
|
|
301
|
+
max-width: 400px;
|
|
302
|
+
padding: 1.5rem;
|
|
303
|
+
border: 1px solid #e0e0e0;
|
|
304
|
+
border-radius: 8px;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.upload-area {
|
|
308
|
+
text-align: center;
|
|
309
|
+
padding: 2rem;
|
|
310
|
+
border: 2px dashed #ccc;
|
|
311
|
+
border-radius: 8px;
|
|
312
|
+
margin-bottom: 1rem;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.progress-section {
|
|
316
|
+
margin-top: 1rem;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.progress-info {
|
|
320
|
+
display: flex;
|
|
321
|
+
justify-content: space-between;
|
|
322
|
+
margin-bottom: 0.5rem;
|
|
323
|
+
font-size: 0.9rem;
|
|
324
|
+
color: #666;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
button {
|
|
328
|
+
padding: 0.5rem 1rem;
|
|
329
|
+
background-color: #007bff;
|
|
330
|
+
color: white;
|
|
331
|
+
border: none;
|
|
332
|
+
border-radius: 4px;
|
|
333
|
+
cursor: pointer;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
button:disabled {
|
|
337
|
+
background-color: #ccc;
|
|
338
|
+
cursor: not-allowed;
|
|
339
|
+
}
|
|
340
|
+
</style>
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### Loading States
|
|
344
|
+
|
|
345
|
+
```vue
|
|
346
|
+
<script setup lang="ts">
|
|
347
|
+
import { ref } from "vue";
|
|
348
|
+
import { ProgressBar } from "@umbra-ui/core";
|
|
349
|
+
|
|
350
|
+
const loadingProgress = ref(0);
|
|
351
|
+
const isLoading = ref(false);
|
|
352
|
+
|
|
353
|
+
const startLoading = () => {
|
|
354
|
+
isLoading.value = true;
|
|
355
|
+
loadingProgress.value = 0;
|
|
356
|
+
|
|
357
|
+
const interval = setInterval(() => {
|
|
358
|
+
if (loadingProgress.value < 90) {
|
|
359
|
+
loadingProgress.value += Math.random() * 10;
|
|
360
|
+
}
|
|
361
|
+
}, 200);
|
|
362
|
+
|
|
363
|
+
// Simulate completion
|
|
364
|
+
setTimeout(() => {
|
|
365
|
+
clearInterval(interval);
|
|
366
|
+
loadingProgress.value = 100;
|
|
367
|
+
setTimeout(() => {
|
|
368
|
+
isLoading.value = false;
|
|
369
|
+
loadingProgress.value = 0;
|
|
370
|
+
}, 500);
|
|
371
|
+
}, 3000);
|
|
372
|
+
};
|
|
373
|
+
</script>
|
|
374
|
+
|
|
375
|
+
<template>
|
|
376
|
+
<div class="loading-example">
|
|
377
|
+
<h3>Loading States</h3>
|
|
378
|
+
|
|
379
|
+
<button @click="startLoading" :disabled="isLoading">
|
|
380
|
+
{{ isLoading ? "Loading..." : "Start Loading" }}
|
|
381
|
+
</button>
|
|
382
|
+
|
|
383
|
+
<div v-if="isLoading" class="loading-section">
|
|
384
|
+
<div class="loading-info">
|
|
385
|
+
<span>Loading data...</span>
|
|
386
|
+
<span>{{ Math.round(loadingProgress) }}%</span>
|
|
387
|
+
</div>
|
|
388
|
+
<ProgressBar
|
|
389
|
+
:progress="loadingProgress"
|
|
390
|
+
barType="default"
|
|
391
|
+
progressColor="#5b5bd6"
|
|
392
|
+
trackColor="#f0f0ff"
|
|
393
|
+
height="6px"
|
|
394
|
+
/>
|
|
395
|
+
</div>
|
|
396
|
+
</div>
|
|
397
|
+
</template>
|
|
398
|
+
|
|
399
|
+
<style module>
|
|
400
|
+
.loading-example {
|
|
401
|
+
max-width: 400px;
|
|
402
|
+
padding: 1.5rem;
|
|
403
|
+
border: 1px solid #e0e0e0;
|
|
404
|
+
border-radius: 8px;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.loading-section {
|
|
408
|
+
margin-top: 1rem;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.loading-info {
|
|
412
|
+
display: flex;
|
|
413
|
+
justify-content: space-between;
|
|
414
|
+
margin-bottom: 0.5rem;
|
|
415
|
+
font-size: 0.9rem;
|
|
416
|
+
color: #666;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
button {
|
|
420
|
+
padding: 0.5rem 1rem;
|
|
421
|
+
background-color: #5b5bd6;
|
|
422
|
+
color: white;
|
|
423
|
+
border: none;
|
|
424
|
+
border-radius: 4px;
|
|
425
|
+
cursor: pointer;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
button:disabled {
|
|
429
|
+
background-color: #ccc;
|
|
430
|
+
cursor: not-allowed;
|
|
431
|
+
}
|
|
432
|
+
</style>
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
### Form Completion
|
|
436
|
+
|
|
437
|
+
```vue
|
|
438
|
+
<script setup lang="ts">
|
|
439
|
+
import { ref, computed } from "vue";
|
|
440
|
+
import { ProgressBar } from "@umbra-ui/core";
|
|
441
|
+
|
|
442
|
+
const formData = ref({
|
|
443
|
+
name: "",
|
|
444
|
+
email: "",
|
|
445
|
+
phone: "",
|
|
446
|
+
address: "",
|
|
447
|
+
preferences: "",
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
const completionPercentage = computed(() => {
|
|
451
|
+
const fields = Object.keys(formData.value);
|
|
452
|
+
const completedFields = fields.filter(
|
|
453
|
+
(field) =>
|
|
454
|
+
formData.value[field as keyof typeof formData.value].trim() !== ""
|
|
455
|
+
);
|
|
456
|
+
return Math.round((completedFields.length / fields.length) * 100);
|
|
457
|
+
});
|
|
458
|
+
</script>
|
|
459
|
+
|
|
460
|
+
<template>
|
|
461
|
+
<div class="form-example">
|
|
462
|
+
<h3>Form Completion</h3>
|
|
463
|
+
|
|
464
|
+
<div class="completion-section">
|
|
465
|
+
<div class="completion-info">
|
|
466
|
+
<span>Form Progress</span>
|
|
467
|
+
<span>{{ completionPercentage }}%</span>
|
|
468
|
+
</div>
|
|
469
|
+
<ProgressBar
|
|
470
|
+
:progress="completionPercentage"
|
|
471
|
+
barType="capsule"
|
|
472
|
+
progressColor="#30a46c"
|
|
473
|
+
trackColor="#e6f7e6"
|
|
474
|
+
height="8px"
|
|
475
|
+
/>
|
|
476
|
+
</div>
|
|
477
|
+
|
|
478
|
+
<form class="form">
|
|
479
|
+
<div class="form-group">
|
|
480
|
+
<label>Name</label>
|
|
481
|
+
<input
|
|
482
|
+
v-model="formData.name"
|
|
483
|
+
type="text"
|
|
484
|
+
placeholder="Enter your name"
|
|
485
|
+
/>
|
|
486
|
+
</div>
|
|
487
|
+
|
|
488
|
+
<div class="form-group">
|
|
489
|
+
<label>Email</label>
|
|
490
|
+
<input
|
|
491
|
+
v-model="formData.email"
|
|
492
|
+
type="email"
|
|
493
|
+
placeholder="Enter your email"
|
|
494
|
+
/>
|
|
495
|
+
</div>
|
|
496
|
+
|
|
497
|
+
<div class="form-group">
|
|
498
|
+
<label>Phone</label>
|
|
499
|
+
<input
|
|
500
|
+
v-model="formData.phone"
|
|
501
|
+
type="tel"
|
|
502
|
+
placeholder="Enter your phone"
|
|
503
|
+
/>
|
|
504
|
+
</div>
|
|
505
|
+
|
|
506
|
+
<div class="form-group">
|
|
507
|
+
<label>Address</label>
|
|
508
|
+
<input
|
|
509
|
+
v-model="formData.address"
|
|
510
|
+
type="text"
|
|
511
|
+
placeholder="Enter your address"
|
|
512
|
+
/>
|
|
513
|
+
</div>
|
|
514
|
+
|
|
515
|
+
<div class="form-group">
|
|
516
|
+
<label>Preferences</label>
|
|
517
|
+
<textarea
|
|
518
|
+
v-model="formData.preferences"
|
|
519
|
+
placeholder="Enter your preferences"
|
|
520
|
+
></textarea>
|
|
521
|
+
</div>
|
|
522
|
+
</form>
|
|
523
|
+
</div>
|
|
524
|
+
</template>
|
|
525
|
+
|
|
526
|
+
<style module>
|
|
527
|
+
.form-example {
|
|
528
|
+
max-width: 500px;
|
|
529
|
+
padding: 1.5rem;
|
|
530
|
+
border: 1px solid #e0e0e0;
|
|
531
|
+
border-radius: 8px;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.completion-section {
|
|
535
|
+
margin-bottom: 1.5rem;
|
|
536
|
+
padding: 1rem;
|
|
537
|
+
background-color: #f8f9fa;
|
|
538
|
+
border-radius: 6px;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
.completion-info {
|
|
542
|
+
display: flex;
|
|
543
|
+
justify-content: space-between;
|
|
544
|
+
margin-bottom: 0.5rem;
|
|
545
|
+
font-weight: 500;
|
|
546
|
+
color: #333;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.form {
|
|
550
|
+
display: flex;
|
|
551
|
+
flex-direction: column;
|
|
552
|
+
gap: 1rem;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.form-group {
|
|
556
|
+
display: flex;
|
|
557
|
+
flex-direction: column;
|
|
558
|
+
gap: 0.5rem;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
label {
|
|
562
|
+
font-weight: 500;
|
|
563
|
+
color: #333;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
input,
|
|
567
|
+
textarea {
|
|
568
|
+
padding: 0.5rem;
|
|
569
|
+
border: 1px solid #ddd;
|
|
570
|
+
border-radius: 4px;
|
|
571
|
+
font-size: 1rem;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
textarea {
|
|
575
|
+
min-height: 80px;
|
|
576
|
+
resize: vertical;
|
|
577
|
+
}
|
|
578
|
+
</style>
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
### Multi-Step Progress
|
|
582
|
+
|
|
583
|
+
```vue
|
|
584
|
+
<script setup lang="ts">
|
|
585
|
+
import { ref, computed } from "vue";
|
|
586
|
+
import { ProgressBar } from "@umbra-ui/core";
|
|
587
|
+
|
|
588
|
+
const currentStep = ref(1);
|
|
589
|
+
const totalSteps = 5;
|
|
590
|
+
|
|
591
|
+
const stepProgress = computed(() => {
|
|
592
|
+
return (currentStep.value / totalSteps) * 100;
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
const nextStep = () => {
|
|
596
|
+
if (currentStep.value < totalSteps) {
|
|
597
|
+
currentStep.value++;
|
|
598
|
+
}
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
const prevStep = () => {
|
|
602
|
+
if (currentStep.value > 1) {
|
|
603
|
+
currentStep.value--;
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
const resetSteps = () => {
|
|
608
|
+
currentStep.value = 1;
|
|
609
|
+
};
|
|
610
|
+
</script>
|
|
611
|
+
|
|
612
|
+
<template>
|
|
613
|
+
<div class="multistep-example">
|
|
614
|
+
<h3>Multi-Step Process</h3>
|
|
615
|
+
|
|
616
|
+
<div class="step-progress">
|
|
617
|
+
<div class="step-info">
|
|
618
|
+
<span>Step {{ currentStep }} of {{ totalSteps }}</span>
|
|
619
|
+
<span>{{ Math.round(stepProgress) }}%</span>
|
|
620
|
+
</div>
|
|
621
|
+
<ProgressBar
|
|
622
|
+
:progress="stepProgress"
|
|
623
|
+
barType="capline"
|
|
624
|
+
progressColor="#0090ff"
|
|
625
|
+
trackColor="transparent"
|
|
626
|
+
height="12px"
|
|
627
|
+
/>
|
|
628
|
+
</div>
|
|
629
|
+
|
|
630
|
+
<div class="step-content">
|
|
631
|
+
<h4>Step {{ currentStep }}: {{ getStepTitle(currentStep) }}</h4>
|
|
632
|
+
<p>{{ getStepDescription(currentStep) }}</p>
|
|
633
|
+
</div>
|
|
634
|
+
|
|
635
|
+
<div class="step-controls">
|
|
636
|
+
<button @click="prevStep" :disabled="currentStep === 1">Previous</button>
|
|
637
|
+
<button @click="nextStep" :disabled="currentStep === totalSteps">
|
|
638
|
+
Next
|
|
639
|
+
</button>
|
|
640
|
+
<button @click="resetSteps">Reset</button>
|
|
641
|
+
</div>
|
|
642
|
+
</div>
|
|
643
|
+
</template>
|
|
644
|
+
|
|
645
|
+
<script setup lang="ts">
|
|
646
|
+
const getStepTitle = (step: number) => {
|
|
647
|
+
const titles = [
|
|
648
|
+
"Welcome",
|
|
649
|
+
"Personal Information",
|
|
650
|
+
"Preferences",
|
|
651
|
+
"Review",
|
|
652
|
+
"Complete",
|
|
653
|
+
];
|
|
654
|
+
return titles[step - 1] || "Unknown Step";
|
|
655
|
+
};
|
|
656
|
+
|
|
657
|
+
const getStepDescription = (step: number) => {
|
|
658
|
+
const descriptions = [
|
|
659
|
+
"Welcome to our setup process. Let's get started!",
|
|
660
|
+
"Please provide your personal information.",
|
|
661
|
+
"Configure your preferences and settings.",
|
|
662
|
+
"Review all the information you've provided.",
|
|
663
|
+
"Congratulations! You've completed the setup.",
|
|
664
|
+
];
|
|
665
|
+
return descriptions[step - 1] || "No description available.";
|
|
666
|
+
};
|
|
667
|
+
</script>
|
|
668
|
+
|
|
669
|
+
<style module>
|
|
670
|
+
.multistep-example {
|
|
671
|
+
max-width: 500px;
|
|
672
|
+
padding: 1.5rem;
|
|
673
|
+
border: 1px solid #e0e0e0;
|
|
674
|
+
border-radius: 8px;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
.step-progress {
|
|
678
|
+
margin-bottom: 1.5rem;
|
|
679
|
+
padding: 1rem;
|
|
680
|
+
background-color: #f8f9fa;
|
|
681
|
+
border-radius: 6px;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
.step-info {
|
|
685
|
+
display: flex;
|
|
686
|
+
justify-content: space-between;
|
|
687
|
+
margin-bottom: 0.5rem;
|
|
688
|
+
font-weight: 500;
|
|
689
|
+
color: #333;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
.step-content {
|
|
693
|
+
margin-bottom: 1.5rem;
|
|
694
|
+
padding: 1rem;
|
|
695
|
+
background-color: #f8f9fa;
|
|
696
|
+
border-radius: 6px;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
.step-content h4 {
|
|
700
|
+
margin: 0 0 0.5rem 0;
|
|
701
|
+
color: #333;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
.step-content p {
|
|
705
|
+
margin: 0;
|
|
706
|
+
color: #666;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
.step-controls {
|
|
710
|
+
display: flex;
|
|
711
|
+
gap: 0.5rem;
|
|
712
|
+
justify-content: center;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
button {
|
|
716
|
+
padding: 0.5rem 1rem;
|
|
717
|
+
background-color: #007bff;
|
|
718
|
+
color: white;
|
|
719
|
+
border: none;
|
|
720
|
+
border-radius: 4px;
|
|
721
|
+
cursor: pointer;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
button:disabled {
|
|
725
|
+
background-color: #ccc;
|
|
726
|
+
cursor: not-allowed;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
button:not(:disabled):hover {
|
|
730
|
+
background-color: #0056b3;
|
|
731
|
+
}
|
|
732
|
+
</style>
|
|
733
|
+
```
|
|
734
|
+
|
|
735
|
+
## Notes
|
|
736
|
+
|
|
737
|
+
- The component automatically clamps progress values between 0 and 100
|
|
738
|
+
- Progress text is only displayed when the height is 20px or greater
|
|
739
|
+
- The component includes smooth transitions for progress changes
|
|
740
|
+
- Different bar types have different default heights and styling
|
|
741
|
+
- The component supports both light and dark themes through CSS custom properties
|
|
742
|
+
- The progress bar is fully accessible and supports screen readers
|
|
743
|
+
- Custom colors can be applied to both the track and progress fill
|
|
744
|
+
- The component uses CSS custom properties for easy theming and customization
|