@temp-spotwork/ui 1.7.8 → 1.7.9
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/molecules/dataviz/progress-bar/ProgressBar.stories.d.ts +1 -0
- package/dist/components/molecules/dataviz/progress-bar/ProgressBar.stories.js +34 -20
- package/dist/components/molecules/dataviz/progress-bar/progress-bar.d.ts +5 -1
- package/dist/components/molecules/dataviz/progress-bar/progress-bar.js +19 -18
- package/package.json +1 -1
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t from "react";
|
|
2
|
+
import { ProgressBar as e } from "./progress-bar.js";
|
|
2
3
|
import "../../../styles/colors/colors.js";
|
|
3
|
-
import { glyphColorsKeys as
|
|
4
|
-
const
|
|
4
|
+
import { glyphColorsKeys as l } from "../../../styles/colors/colormap.js";
|
|
5
|
+
const n = {
|
|
5
6
|
title: "@spotwork-ui/ProgresBar",
|
|
6
|
-
component:
|
|
7
|
+
component: e,
|
|
8
|
+
decorators: [
|
|
9
|
+
(o) => t.createElement("div", { style: { width: 100 } }, t.createElement(o))
|
|
10
|
+
],
|
|
7
11
|
parameters: {
|
|
8
12
|
layout: "centered"
|
|
9
13
|
},
|
|
@@ -11,7 +15,7 @@ const s = {
|
|
|
11
15
|
argTypes: {
|
|
12
16
|
labelColor: {
|
|
13
17
|
control: "select",
|
|
14
|
-
options:
|
|
18
|
+
options: l,
|
|
15
19
|
description: 'Custom color for the label. Defaults to "subdued" if not provided.'
|
|
16
20
|
},
|
|
17
21
|
progress: {
|
|
@@ -27,47 +31,47 @@ const s = {
|
|
|
27
31
|
control: "text"
|
|
28
32
|
}
|
|
29
33
|
}
|
|
30
|
-
},
|
|
34
|
+
}, c = {
|
|
31
35
|
args: {
|
|
32
36
|
progress: 50,
|
|
33
37
|
total: 100,
|
|
34
38
|
text: "Filled"
|
|
35
39
|
}
|
|
36
|
-
},
|
|
40
|
+
}, g = {
|
|
37
41
|
args: {
|
|
38
42
|
progress: 75,
|
|
39
43
|
total: 100,
|
|
40
44
|
text: "Filled"
|
|
41
45
|
}
|
|
42
|
-
},
|
|
46
|
+
}, p = {
|
|
43
47
|
args: {
|
|
44
48
|
progress: 80,
|
|
45
49
|
total: 100,
|
|
46
50
|
text: "Filled",
|
|
47
51
|
labelColor: "success"
|
|
48
52
|
}
|
|
49
|
-
},
|
|
53
|
+
}, u = {
|
|
50
54
|
args: {
|
|
51
55
|
progress: 30,
|
|
52
56
|
total: 100,
|
|
53
57
|
text: "Filled",
|
|
54
58
|
labelColor: "alert"
|
|
55
59
|
}
|
|
56
|
-
},
|
|
60
|
+
}, C = {
|
|
57
61
|
args: {
|
|
58
62
|
progress: 60,
|
|
59
63
|
total: 100,
|
|
60
64
|
text: "Filled",
|
|
61
65
|
labelColor: "warning"
|
|
62
66
|
}
|
|
63
|
-
},
|
|
67
|
+
}, d = {
|
|
64
68
|
args: {
|
|
65
69
|
progress: 90,
|
|
66
70
|
total: 100,
|
|
67
71
|
text: "Filled",
|
|
68
72
|
labelColor: "active"
|
|
69
73
|
}
|
|
70
|
-
},
|
|
74
|
+
}, m = {
|
|
71
75
|
args: {
|
|
72
76
|
progress: 75,
|
|
73
77
|
total: 100,
|
|
@@ -75,14 +79,24 @@ const s = {
|
|
|
75
79
|
hasTotalCount: !0,
|
|
76
80
|
labelColor: "active"
|
|
77
81
|
}
|
|
82
|
+
}, b = {
|
|
83
|
+
args: {
|
|
84
|
+
progress: 75,
|
|
85
|
+
total: 100,
|
|
86
|
+
text: "",
|
|
87
|
+
hasTotalCount: !0,
|
|
88
|
+
labelColor: "active",
|
|
89
|
+
textClassName: "flex justify-center items-center"
|
|
90
|
+
}
|
|
78
91
|
};
|
|
79
92
|
export {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
93
|
+
c as Default,
|
|
94
|
+
d as WithLabelColorActive,
|
|
95
|
+
u as WithLabelColorAlert,
|
|
96
|
+
p as WithLabelColorSuccess,
|
|
97
|
+
C as WithLabelColorWarning,
|
|
98
|
+
b as WithTextClassName,
|
|
99
|
+
m as WithTotalCount,
|
|
100
|
+
g as WithoutLabelColor,
|
|
101
|
+
n as default
|
|
88
102
|
};
|
|
@@ -30,5 +30,9 @@ export type ProgressBarProps = {
|
|
|
30
30
|
* Custom class name for the component
|
|
31
31
|
*/
|
|
32
32
|
className?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Custom class name for the text label
|
|
35
|
+
*/
|
|
36
|
+
textClassName?: string;
|
|
33
37
|
};
|
|
34
|
-
export declare function ProgressBar({ progress, total, hasTotalCount, text, swStyle, labelColor, className, }: ProgressBarProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare function ProgressBar({ progress, total, hasTotalCount, text, swStyle, labelColor, className, textClassName, }: ProgressBarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,41 +1,42 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Typography as
|
|
1
|
+
import { jsx as d, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { Typography as b } from "../../../styles/typography/typography.js";
|
|
3
3
|
import "../../../styles/colors/colors.js";
|
|
4
|
-
import { surface as
|
|
4
|
+
import { surface as B, crusta as v, sun as y, apple as N } from "../../../styles/colors/colormap.js";
|
|
5
5
|
import { getStyles as $ } from "./styles.js";
|
|
6
6
|
import { t as o } from "../../../../bundle-mjs-BjFsLjkg.js";
|
|
7
|
-
function
|
|
7
|
+
function W({
|
|
8
8
|
progress: e,
|
|
9
9
|
total: r,
|
|
10
|
-
hasTotalCount:
|
|
11
|
-
text:
|
|
10
|
+
hasTotalCount: l = !1,
|
|
11
|
+
text: n = "Filled",
|
|
12
12
|
swStyle: m = 1,
|
|
13
13
|
labelColor: u,
|
|
14
|
-
className: p
|
|
14
|
+
className: p,
|
|
15
|
+
textClassName: f
|
|
15
16
|
}) {
|
|
16
|
-
const s = e && r > 0 ? e / r * 100 : 0, i = 100 - s,
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
/* @__PURE__ */
|
|
17
|
+
const s = e && r > 0 ? e / r * 100 : 0, i = 100 - s, g = s <= 33.99 ? B.badge : s <= 66.99 ? v[400] : s <= 99.99 ? y[400] : N[600], h = (l ? `${e > r ? r : e}/${r}` : `${e > r ? r : e}`) + " " + n, c = u ?? "subdued", a = $();
|
|
18
|
+
return /* @__PURE__ */ d("div", { children: /* @__PURE__ */ t("div", { className: o(a.container, p), children: [
|
|
19
|
+
/* @__PURE__ */ d(b, { swStyle: m, className: f, color: c, children: h }),
|
|
20
|
+
/* @__PURE__ */ t("div", { className: a.chartBox, children: [
|
|
21
|
+
/* @__PURE__ */ d(
|
|
21
22
|
"div",
|
|
22
23
|
{
|
|
23
24
|
"data-testid": "progress-bar",
|
|
24
|
-
style: { width: `${s}%`, background:
|
|
25
|
+
style: { width: `${s}%`, background: g },
|
|
25
26
|
className: o(
|
|
26
|
-
|
|
27
|
+
a.progressBar,
|
|
27
28
|
s >= 100 ? "rounded-r-[0.3rem] rounded-l-[0.3rem]" : "rounded-l-[0.3rem]"
|
|
28
29
|
)
|
|
29
30
|
}
|
|
30
31
|
),
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ d(
|
|
32
33
|
"div",
|
|
33
34
|
{
|
|
34
35
|
"data-testid": "unfilled-progress-bar",
|
|
35
36
|
style: { width: `${i}%` },
|
|
36
37
|
className: o(
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
a.progressBar,
|
|
39
|
+
c === "active" ? "bg-progressBar-trackActive" : "bg-progressBar-trackDefault",
|
|
39
40
|
i >= 100 ? "rounded-[0.3rem]" : "rounded-r-[0.3rem]"
|
|
40
41
|
)
|
|
41
42
|
}
|
|
@@ -44,5 +45,5 @@ function P({
|
|
|
44
45
|
] }) });
|
|
45
46
|
}
|
|
46
47
|
export {
|
|
47
|
-
|
|
48
|
+
W as ProgressBar
|
|
48
49
|
};
|