@ulu/frontend-vue 0.3.0 → 0.3.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/dist/components/collapsible/UluModal.vue.d.ts +4 -2
- package/dist/components/collapsible/UluModal.vue.d.ts.map +1 -1
- package/dist/components/collapsible/UluModal.vue.js +10 -5
- package/dist/components/visualizations/UluProgressBar.vue.d.ts +4 -0
- package/dist/components/visualizations/UluProgressBar.vue.d.ts.map +1 -1
- package/dist/components/visualizations/UluProgressBar.vue.js +90 -76
- package/lib/components/collapsible/UluModal.vue +9 -4
- package/lib/components/visualizations/UluProgressBar.vue +122 -106
- package/package.json +1 -1
|
@@ -14,10 +14,11 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
|
14
14
|
nonModal: boolean;
|
|
15
15
|
allowResize: boolean;
|
|
16
16
|
position: string;
|
|
17
|
+
fullscreen: boolean;
|
|
18
|
+
fullscreenMobile: boolean;
|
|
17
19
|
bodyFills: boolean;
|
|
18
20
|
noBackdrop: boolean;
|
|
19
21
|
noMinHeight: boolean;
|
|
20
|
-
fullscreenMobile: boolean;
|
|
21
22
|
labelledby?: string | undefined;
|
|
22
23
|
describedby?: string | undefined;
|
|
23
24
|
title?: string | undefined;
|
|
@@ -35,10 +36,11 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
|
35
36
|
readonly nonModal?: boolean | undefined;
|
|
36
37
|
readonly allowResize?: boolean | undefined;
|
|
37
38
|
readonly position?: string | undefined;
|
|
39
|
+
readonly fullscreen?: boolean | undefined;
|
|
40
|
+
readonly fullscreenMobile?: boolean | undefined;
|
|
38
41
|
readonly bodyFills?: boolean | undefined;
|
|
39
42
|
readonly noBackdrop?: boolean | undefined;
|
|
40
43
|
readonly noMinHeight?: boolean | undefined;
|
|
41
|
-
readonly fullscreenMobile?: boolean | undefined;
|
|
42
44
|
readonly labelledby?: string | undefined;
|
|
43
45
|
readonly describedby?: string | undefined;
|
|
44
46
|
readonly title?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UluModal.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/collapsible/UluModal.vue"],"names":[],"mappings":"AAoEA;
|
|
1
|
+
{"version":3,"file":"UluModal.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/collapsible/UluModal.vue"],"names":[],"mappings":"AAoEA;wBA+1BqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAbjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4OAUG"}
|
|
@@ -58,6 +58,14 @@ const ne = ["aria-labelledby", "aria-describedby"], ie = ["id"], re = { class: "
|
|
|
58
58
|
type: String,
|
|
59
59
|
default: "center"
|
|
60
60
|
},
|
|
61
|
+
/**
|
|
62
|
+
* Use fullscreen layout
|
|
63
|
+
*/
|
|
64
|
+
fullscreen: Boolean,
|
|
65
|
+
/**
|
|
66
|
+
* If true, modal is forced to fullscreen on mobile viewports
|
|
67
|
+
*/
|
|
68
|
+
fullscreenMobile: Boolean,
|
|
61
69
|
/**
|
|
62
70
|
* If `true`, the modal body will fill the available space.
|
|
63
71
|
*/
|
|
@@ -109,11 +117,7 @@ const ne = ["aria-labelledby", "aria-describedby"], ie = ["id"], re = { class: "
|
|
|
109
117
|
/**
|
|
110
118
|
* Modifiers (to add any modifier classes based on base class [ie. 'tertiary'])
|
|
111
119
|
*/
|
|
112
|
-
modifiers: [String, Array]
|
|
113
|
-
/**
|
|
114
|
-
* If true, modal is forced to fullscreen on mobile viewports
|
|
115
|
-
*/
|
|
116
|
-
fullscreenMobile: Boolean
|
|
120
|
+
modifiers: [String, Array]
|
|
117
121
|
},
|
|
118
122
|
emits: ["update:modelValue", "close", "open"],
|
|
119
123
|
setup(t, { emit: H }) {
|
|
@@ -132,6 +136,7 @@ const ne = ["aria-labelledby", "aria-describedby"], ie = ["id"], re = { class: "
|
|
|
132
136
|
"no-min-height": e.noMinHeight,
|
|
133
137
|
"non-modal": e.nonModal,
|
|
134
138
|
"resizer-active": f.value,
|
|
139
|
+
fullscreen: e.fullscreen,
|
|
135
140
|
"fullscreen-mobile": e.fullscreenMobile
|
|
136
141
|
})), { resolvedModifiers: F } = x({
|
|
137
142
|
props: e,
|
|
@@ -14,9 +14,11 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
|
14
14
|
positive: boolean;
|
|
15
15
|
negative: boolean;
|
|
16
16
|
loader: boolean;
|
|
17
|
+
rounded: boolean;
|
|
17
18
|
indeterminate: boolean;
|
|
18
19
|
noValues: boolean;
|
|
19
20
|
amountInHeader: boolean;
|
|
21
|
+
modifiers?: string | unknown[] | undefined;
|
|
20
22
|
label?: string | undefined;
|
|
21
23
|
formatValue?: Function | undefined;
|
|
22
24
|
$props: {
|
|
@@ -30,9 +32,11 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
|
30
32
|
readonly positive?: boolean | undefined;
|
|
31
33
|
readonly negative?: boolean | undefined;
|
|
32
34
|
readonly loader?: boolean | undefined;
|
|
35
|
+
readonly rounded?: boolean | undefined;
|
|
33
36
|
readonly indeterminate?: boolean | undefined;
|
|
34
37
|
readonly noValues?: boolean | undefined;
|
|
35
38
|
readonly amountInHeader?: boolean | undefined;
|
|
39
|
+
readonly modifiers?: string | unknown[] | undefined;
|
|
36
40
|
readonly label?: string | undefined;
|
|
37
41
|
readonly formatValue?: Function | undefined;
|
|
38
42
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UluProgressBar.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/visualizations/UluProgressBar.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UluProgressBar.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/visualizations/UluProgressBar.vue"],"names":[],"mappings":"AA4DA;wBA4cqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAXjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sPAQG"}
|
|
@@ -1,172 +1,186 @@
|
|
|
1
|
-
import { computed as m, createElementBlock as
|
|
2
|
-
|
|
1
|
+
import { computed as m, createElementBlock as n, openBlock as s, normalizeClass as v, unref as B, createCommentVNode as r, createElementVNode as o, createBlock as h, resolveDynamicComponent as k, withCtx as V, renderSlot as i, createTextVNode as d, toDisplayString as u, normalizeStyle as b } from "vue";
|
|
2
|
+
import { useModifiers as $ } from "../../composables/useModifiers.js";
|
|
3
|
+
const C = {
|
|
3
4
|
key: 0,
|
|
4
5
|
class: "progress-bar__header"
|
|
5
|
-
},
|
|
6
|
+
}, H = {
|
|
6
7
|
key: 1,
|
|
7
8
|
class: "progress-bar__value progress-bar__value--amount"
|
|
8
|
-
},
|
|
9
|
+
}, N = {
|
|
9
10
|
key: 2,
|
|
10
11
|
class: "progress-bar__icon"
|
|
11
|
-
},
|
|
12
|
+
}, S = { class: "progress-bar__track" }, A = {
|
|
12
13
|
key: 1,
|
|
13
14
|
class: "progress-bar__values"
|
|
14
|
-
},
|
|
15
|
+
}, D = { class: "progress-bar__value progress-bar__value--amount" }, E = {
|
|
15
16
|
key: 0,
|
|
16
17
|
class: "progress-bar__value progress-bar__value--deficit"
|
|
17
|
-
},
|
|
18
|
+
}, I = { class: "progress-bar__value progress-bar__value--total" }, M = {
|
|
18
19
|
__name: "UluProgressBar",
|
|
19
20
|
props: {
|
|
20
21
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
* The label to display above the progress bar. (or use label slot)
|
|
23
|
+
*/
|
|
23
24
|
label: String,
|
|
24
25
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
* Hides the label visually, but keeps it for screen readers.
|
|
27
|
+
*/
|
|
27
28
|
labelHidden: Boolean,
|
|
28
29
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
* Optional classes object (currently only allowing { label } class)
|
|
31
|
+
*/
|
|
31
32
|
classes: {
|
|
32
33
|
type: Object,
|
|
33
34
|
default: () => ({})
|
|
34
35
|
},
|
|
35
36
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
* Element to use for label
|
|
38
|
+
*/
|
|
38
39
|
labelElement: {
|
|
39
40
|
type: String,
|
|
40
41
|
default: "strong"
|
|
41
42
|
},
|
|
42
43
|
/**
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
* The current amount of progress.
|
|
45
|
+
*/
|
|
45
46
|
amount: {
|
|
46
47
|
type: Number,
|
|
47
48
|
default: 0
|
|
48
49
|
},
|
|
49
50
|
/**
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
* The total amount that represents 100% progress.
|
|
52
|
+
*/
|
|
52
53
|
total: {
|
|
53
54
|
type: Number,
|
|
54
55
|
default: 100
|
|
55
56
|
},
|
|
56
57
|
/**
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
* The amount of deficit to display on the bar.
|
|
59
|
+
*/
|
|
59
60
|
deficit: {
|
|
60
61
|
type: Number,
|
|
61
62
|
default: 0
|
|
62
63
|
},
|
|
63
64
|
/**
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
* Renders a smaller version of the progress bar.
|
|
66
|
+
*/
|
|
66
67
|
small: Boolean,
|
|
67
68
|
/**
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
* Applies the 'positive' style (e.g., green).
|
|
70
|
+
*/
|
|
70
71
|
positive: Boolean,
|
|
71
72
|
/**
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
* Applies the 'negative' style (e.g., red).
|
|
74
|
+
*/
|
|
74
75
|
negative: Boolean,
|
|
75
76
|
/**
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
* Applies styles for use as a thin loader.
|
|
78
|
+
*/
|
|
78
79
|
loader: Boolean,
|
|
79
80
|
/**
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
* Applies styles for use as a thin loader.
|
|
82
|
+
*/
|
|
83
|
+
rounded: Boolean,
|
|
84
|
+
/**
|
|
85
|
+
* Applies an indeterminate animation for unknown progress.
|
|
86
|
+
*/
|
|
82
87
|
indeterminate: Boolean,
|
|
83
88
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
* Omit values from output (the numbers below the progress bar)
|
|
90
|
+
*/
|
|
86
91
|
noValues: Boolean,
|
|
87
92
|
/**
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
93
|
+
* A function to format the numerical values (amount, deficit, total).
|
|
94
|
+
* Takes the value and type ('amount', 'deficit', 'total') as input and should return a string.
|
|
95
|
+
*/
|
|
91
96
|
formatValue: {
|
|
92
97
|
type: Function,
|
|
93
98
|
default: (e, a) => e
|
|
94
99
|
},
|
|
95
100
|
/**
|
|
96
|
-
|
|
101
|
+
* Will put the amount only in header (there is a headerValue slot it you want to format)
|
|
102
|
+
*/
|
|
103
|
+
amountInHeader: Boolean,
|
|
104
|
+
/**
|
|
105
|
+
* Modifiers (to add any modifier classes based on base class [ie. 'tertiary'])
|
|
97
106
|
*/
|
|
98
|
-
|
|
107
|
+
modifiers: [String, Array]
|
|
99
108
|
},
|
|
100
109
|
setup(e) {
|
|
101
|
-
const a = e, c = (t, l) => `${l === 0 ? 0 : t / l * 100}%`,
|
|
102
|
-
|
|
103
|
-
"progress-bar
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
const a = e, c = (t, l) => `${l === 0 ? 0 : t / l * 100}%`, f = m(() => a.indeterminate ? null : c(a.amount, a.total)), g = m(() => c(a.deficit, a.total)), { resolvedModifiers: y } = $({
|
|
111
|
+
props: a,
|
|
112
|
+
baseClass: "progress-bar",
|
|
113
|
+
internal: m(() => ({
|
|
114
|
+
small: a.small,
|
|
115
|
+
positive: a.positive,
|
|
116
|
+
negative: a.negative,
|
|
117
|
+
loader: a.loader,
|
|
118
|
+
rounded: a.rounded,
|
|
119
|
+
indeterminate: a.indeterminate
|
|
120
|
+
}))
|
|
121
|
+
});
|
|
122
|
+
return (t, l) => (s(), n("div", {
|
|
123
|
+
class: v(["progress-bar", [
|
|
124
|
+
B(y),
|
|
125
|
+
{ "type-small": e.small }
|
|
126
|
+
]])
|
|
113
127
|
}, [
|
|
114
|
-
e.label || t.$slots.label || t.$slots.icon || e.amountInHeader ? (s(),
|
|
115
|
-
e.label ? (s(),
|
|
128
|
+
e.label || t.$slots.label || t.$slots.icon || e.amountInHeader ? (s(), n("div", C, [
|
|
129
|
+
e.label ? (s(), h(k(e.labelElement), {
|
|
116
130
|
key: 0,
|
|
117
131
|
class: v(["progress-bar__label", [e.classes.label, { "hidden-visually": e.labelHidden }]])
|
|
118
132
|
}, {
|
|
119
|
-
default:
|
|
133
|
+
default: V(() => [
|
|
120
134
|
i(t.$slots, "label", {}, () => [
|
|
121
|
-
u(
|
|
135
|
+
d(u(e.label), 1)
|
|
122
136
|
])
|
|
123
137
|
]),
|
|
124
138
|
_: 3
|
|
125
|
-
}, 8, ["class"])) :
|
|
126
|
-
e.amountInHeader ? (s(),
|
|
139
|
+
}, 8, ["class"])) : r("", !0),
|
|
140
|
+
e.amountInHeader ? (s(), n("div", H, [
|
|
127
141
|
l[0] || (l[0] = o("strong", { class: "hidden-visually" }, "Amount:", -1)),
|
|
128
142
|
i(t.$slots, "valueAmount", { value: e.amount }, () => [
|
|
129
|
-
u(
|
|
143
|
+
d(u(e.formatValue(e.amount, "amount")), 1)
|
|
130
144
|
])
|
|
131
|
-
])) :
|
|
132
|
-
t.$slots.icon ? (s(),
|
|
145
|
+
])) : r("", !0),
|
|
146
|
+
t.$slots.icon ? (s(), n("div", N, [
|
|
133
147
|
i(t.$slots, "icon")
|
|
134
|
-
])) :
|
|
135
|
-
])) :
|
|
136
|
-
o("div",
|
|
148
|
+
])) : r("", !0)
|
|
149
|
+
])) : r("", !0),
|
|
150
|
+
o("div", S, [
|
|
137
151
|
o("div", {
|
|
138
152
|
class: "progress-bar__bar",
|
|
139
|
-
style: b({ width:
|
|
153
|
+
style: b({ width: f.value })
|
|
140
154
|
}, null, 4),
|
|
141
|
-
e.deficit > 0 ? (s(),
|
|
155
|
+
e.deficit > 0 ? (s(), n("div", {
|
|
142
156
|
key: 0,
|
|
143
157
|
class: "progress-bar__bar--deficit",
|
|
144
|
-
style: b({ width:
|
|
145
|
-
}, null, 4)) :
|
|
158
|
+
style: b({ width: g.value })
|
|
159
|
+
}, null, 4)) : r("", !0)
|
|
146
160
|
]),
|
|
147
|
-
!e.noValues && !e.amountInHeader && !e.loader && !e.indeterminate ? (s(),
|
|
148
|
-
o("div",
|
|
161
|
+
!e.noValues && !e.amountInHeader && !e.loader && !e.indeterminate ? (s(), n("div", A, [
|
|
162
|
+
o("div", D, [
|
|
149
163
|
l[1] || (l[1] = o("strong", { class: "hidden-visually" }, "Amount:", -1)),
|
|
150
164
|
i(t.$slots, "valueAmount", { value: e.amount }, () => [
|
|
151
|
-
u(
|
|
165
|
+
d(u(e.formatValue(e.amount, "amount")), 1)
|
|
152
166
|
])
|
|
153
167
|
]),
|
|
154
|
-
e.deficit > 0 ? (s(),
|
|
168
|
+
e.deficit > 0 ? (s(), n("div", E, [
|
|
155
169
|
l[2] || (l[2] = o("strong", { class: "hidden-visually" }, "Deficit: ", -1)),
|
|
156
170
|
i(t.$slots, "valueDeficit", { value: e.deficit }, () => [
|
|
157
|
-
|
|
171
|
+
d("-" + u(e.formatValue(e.deficit, "deficit")), 1)
|
|
158
172
|
])
|
|
159
|
-
])) :
|
|
160
|
-
o("div",
|
|
173
|
+
])) : r("", !0),
|
|
174
|
+
o("div", I, [
|
|
161
175
|
l[3] || (l[3] = o("strong", { class: "hidden-visually" }, "Total:", -1)),
|
|
162
176
|
i(t.$slots, "valueTotal", { value: e.total }, () => [
|
|
163
|
-
u(
|
|
177
|
+
d(u(e.formatValue(e.total, "total")), 1)
|
|
164
178
|
])
|
|
165
179
|
])
|
|
166
|
-
])) :
|
|
180
|
+
])) : r("", !0)
|
|
167
181
|
], 2));
|
|
168
182
|
}
|
|
169
183
|
};
|
|
170
184
|
export {
|
|
171
|
-
|
|
185
|
+
M as default
|
|
172
186
|
};
|
|
@@ -128,6 +128,14 @@
|
|
|
128
128
|
type: String,
|
|
129
129
|
default: "center"
|
|
130
130
|
},
|
|
131
|
+
/**
|
|
132
|
+
* Use fullscreen layout
|
|
133
|
+
*/
|
|
134
|
+
fullscreen: Boolean,
|
|
135
|
+
/**
|
|
136
|
+
* If true, modal is forced to fullscreen on mobile viewports
|
|
137
|
+
*/
|
|
138
|
+
fullscreenMobile: Boolean,
|
|
131
139
|
/**
|
|
132
140
|
* If `true`, the modal body will fill the available space.
|
|
133
141
|
*/
|
|
@@ -180,10 +188,6 @@
|
|
|
180
188
|
* Modifiers (to add any modifier classes based on base class [ie. 'tertiary'])
|
|
181
189
|
*/
|
|
182
190
|
modifiers: [String, Array],
|
|
183
|
-
/**
|
|
184
|
-
* If true, modal is forced to fullscreen on mobile viewports
|
|
185
|
-
*/
|
|
186
|
-
fullscreenMobile: Boolean
|
|
187
191
|
});
|
|
188
192
|
|
|
189
193
|
const slots = useSlots();
|
|
@@ -224,6 +228,7 @@
|
|
|
224
228
|
"no-min-height": props.noMinHeight,
|
|
225
229
|
"non-modal": props.nonModal,
|
|
226
230
|
"resizer-active": resizerEnabled.value,
|
|
231
|
+
"fullscreen": props.fullscreen,
|
|
227
232
|
"fullscreen-mobile": props.fullscreenMobile,
|
|
228
233
|
}));
|
|
229
234
|
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="progress-bar"
|
|
4
|
+
:class="[
|
|
5
|
+
resolvedModifiers,
|
|
6
|
+
{ 'type-small': small }
|
|
7
|
+
]"
|
|
8
|
+
>
|
|
3
9
|
<div
|
|
4
10
|
v-if="label || $slots.label || $slots.icon || amountInHeader"
|
|
5
11
|
class="progress-bar__header"
|
|
@@ -54,115 +60,125 @@
|
|
|
54
60
|
</template>
|
|
55
61
|
|
|
56
62
|
<script setup>
|
|
57
|
-
import { computed } from "vue";
|
|
63
|
+
import { computed } from "vue";
|
|
64
|
+
import { useModifiers } from "../../composables/useModifiers.js";
|
|
58
65
|
|
|
59
|
-
/**
|
|
60
|
-
* A linear progress bar to display progress, with support for various styles and a deficit indicator.
|
|
61
|
-
* @slot icon - A slot for placing an icon in the header, typically to indicate status.
|
|
62
|
-
*/
|
|
63
|
-
const props = defineProps({
|
|
64
66
|
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
67
|
+
* A linear progress bar to display progress, with support for various styles and a deficit indicator.
|
|
68
|
+
* @slot icon - A slot for placing an icon in the header, typically to indicate status.
|
|
69
|
+
*/
|
|
70
|
+
const props = defineProps({
|
|
71
|
+
/**
|
|
72
|
+
* The label to display above the progress bar. (or use label slot)
|
|
73
|
+
*/
|
|
74
|
+
label: String,
|
|
75
|
+
/**
|
|
76
|
+
* Hides the label visually, but keeps it for screen readers.
|
|
77
|
+
*/
|
|
78
|
+
labelHidden: Boolean,
|
|
79
|
+
/**
|
|
80
|
+
* Optional classes object (currently only allowing { label } class)
|
|
81
|
+
*/
|
|
82
|
+
classes: {
|
|
83
|
+
type: Object,
|
|
84
|
+
default: () => ({})
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* Element to use for label
|
|
88
|
+
*/
|
|
89
|
+
labelElement: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: "strong"
|
|
92
|
+
},
|
|
93
|
+
/**
|
|
94
|
+
* The current amount of progress.
|
|
95
|
+
*/
|
|
96
|
+
amount: {
|
|
97
|
+
type: Number,
|
|
98
|
+
default: 0,
|
|
99
|
+
},
|
|
100
|
+
/**
|
|
101
|
+
* The total amount that represents 100% progress.
|
|
102
|
+
*/
|
|
103
|
+
total: {
|
|
104
|
+
type: Number,
|
|
105
|
+
default: 100,
|
|
106
|
+
},
|
|
107
|
+
/**
|
|
108
|
+
* The amount of deficit to display on the bar.
|
|
109
|
+
*/
|
|
110
|
+
deficit: {
|
|
111
|
+
type: Number,
|
|
112
|
+
default: 0,
|
|
113
|
+
},
|
|
114
|
+
/**
|
|
115
|
+
* Renders a smaller version of the progress bar.
|
|
116
|
+
*/
|
|
117
|
+
small: Boolean,
|
|
118
|
+
/**
|
|
119
|
+
* Applies the 'positive' style (e.g., green).
|
|
120
|
+
*/
|
|
121
|
+
positive: Boolean,
|
|
122
|
+
/**
|
|
123
|
+
* Applies the 'negative' style (e.g., red).
|
|
124
|
+
*/
|
|
125
|
+
negative: Boolean,
|
|
126
|
+
/**
|
|
127
|
+
* Applies styles for use as a thin loader.
|
|
128
|
+
*/
|
|
129
|
+
loader: Boolean,
|
|
130
|
+
/**
|
|
131
|
+
* Applies styles for use as a thin loader.
|
|
132
|
+
*/
|
|
133
|
+
rounded: Boolean,
|
|
134
|
+
/**
|
|
135
|
+
* Applies an indeterminate animation for unknown progress.
|
|
136
|
+
*/
|
|
137
|
+
indeterminate: Boolean,
|
|
138
|
+
/**
|
|
139
|
+
* Omit values from output (the numbers below the progress bar)
|
|
140
|
+
*/
|
|
141
|
+
noValues: Boolean,
|
|
142
|
+
/**
|
|
143
|
+
* A function to format the numerical values (amount, deficit, total).
|
|
144
|
+
* Takes the value and type ('amount', 'deficit', 'total') as input and should return a string.
|
|
145
|
+
*/
|
|
146
|
+
formatValue: {
|
|
147
|
+
type: Function,
|
|
148
|
+
default: (value, type) => value,
|
|
149
|
+
},
|
|
150
|
+
/**
|
|
151
|
+
* Will put the amount only in header (there is a headerValue slot it you want to format)
|
|
152
|
+
*/
|
|
153
|
+
amountInHeader: Boolean,
|
|
154
|
+
/**
|
|
155
|
+
* Modifiers (to add any modifier classes based on base class [ie. 'tertiary'])
|
|
156
|
+
*/
|
|
157
|
+
modifiers: [String, Array]
|
|
158
|
+
});
|
|
144
159
|
|
|
145
|
-
const getCssPercentage = (amount, total) => {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
};
|
|
160
|
+
const getCssPercentage = (amount, total) => {
|
|
161
|
+
const percent = total === 0 ? 0 : (amount / total) * 100;
|
|
162
|
+
return `${ percent }%`;
|
|
163
|
+
};
|
|
149
164
|
|
|
150
|
-
const barWidth = computed(() => {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
});
|
|
165
|
+
const barWidth = computed(() => {
|
|
166
|
+
if (props.indeterminate) return null; // No value for width
|
|
167
|
+
return getCssPercentage(props.amount, props.total);
|
|
168
|
+
});
|
|
154
169
|
|
|
155
|
-
const deficitBarWidth = computed(() => getCssPercentage(props.deficit, props.total));
|
|
170
|
+
const deficitBarWidth = computed(() => getCssPercentage(props.deficit, props.total));
|
|
156
171
|
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
})
|
|
172
|
+
const { resolvedModifiers } = useModifiers({
|
|
173
|
+
props,
|
|
174
|
+
baseClass: "progress-bar",
|
|
175
|
+
internal: computed(() => ({
|
|
176
|
+
'small': props.small,
|
|
177
|
+
'positive': props.positive,
|
|
178
|
+
'negative': props.negative,
|
|
179
|
+
'loader': props.loader,
|
|
180
|
+
'rounded': props.rounded,
|
|
181
|
+
'indeterminate': props.indeterminate,
|
|
182
|
+
}))
|
|
183
|
+
});
|
|
168
184
|
</script>
|
package/package.json
CHANGED