@temp-spotwork/ui 1.7.7 → 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/atoms/form/dropdown-item/dropdown-item.d.ts +40 -0
- package/dist/components/atoms/form/dropdown-item/dropdown-item.js +49 -0
- package/dist/components/atoms/form/dropdown-item/dropdown-item.stories.d.ts +11 -0
- package/dist/components/atoms/form/dropdown-item/dropdown-item.stories.js +109 -0
- package/dist/components/atoms/form/dropdown-item/index.d.ts +2 -0
- package/dist/components/atoms/form/dropdown-item/index.js +5 -0
- package/dist/components/atoms/form/dropdown-item/styles.d.ts +6 -0
- package/dist/components/atoms/form/dropdown-item/styles.js +9 -0
- package/dist/components/atoms/form/dropdown-search/dropdown-search.stories.d.ts +1 -0
- package/dist/components/atoms/form/dropdown-search/dropdown-search.stories.js +80 -53
- package/dist/components/atoms/form/typeahead/typeahead.d.ts +5 -1
- package/dist/components/atoms/form/typeahead/typeahead.js +60 -59
- 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/dist/main.d.ts +2 -0
- package/dist/main.js +144 -141
- package/package.json +1 -1
|
@@ -1,69 +1,70 @@
|
|
|
1
1
|
import { jsxs as b, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import A, { useState as L, useEffect as
|
|
3
|
-
import { t as
|
|
4
|
-
import { Textfield as
|
|
5
|
-
import { Icons as
|
|
2
|
+
import A, { useState as L, useEffect as C } from "react";
|
|
3
|
+
import { t as F } from "../../../../bundle-mjs-BjFsLjkg.js";
|
|
4
|
+
import { Textfield as k } from "../textfield/textfield.js";
|
|
5
|
+
import { Icons as I } from "../../icons/icons.js";
|
|
6
6
|
import "../../icons/iconsSVGs/Large/Profile.js";
|
|
7
7
|
import "../../icons/iconsSVGs/Small/Profile.js";
|
|
8
8
|
import { Typography as N } from "../../../styles/typography/typography.js";
|
|
9
|
-
import { getStyles as
|
|
10
|
-
function
|
|
11
|
-
error:
|
|
12
|
-
warning:
|
|
13
|
-
helperText:
|
|
9
|
+
import { getStyles as V } from "./styles.js";
|
|
10
|
+
function fe({
|
|
11
|
+
error: M = !1,
|
|
12
|
+
warning: _ = !1,
|
|
13
|
+
helperText: G,
|
|
14
14
|
label: O,
|
|
15
|
-
placeholder:
|
|
16
|
-
disabled:
|
|
15
|
+
placeholder: $ = "",
|
|
16
|
+
disabled: q = !1,
|
|
17
17
|
options: r,
|
|
18
18
|
value: s,
|
|
19
19
|
selectValue: m,
|
|
20
|
-
onChange:
|
|
21
|
-
endIconClick:
|
|
22
|
-
addValue:
|
|
20
|
+
onChange: c,
|
|
21
|
+
endIconClick: d,
|
|
22
|
+
addValue: E,
|
|
23
23
|
inputRef: n,
|
|
24
24
|
onBlur: l,
|
|
25
|
-
loadingIcon:
|
|
26
|
-
autoFocus:
|
|
27
|
-
expandOnFocus:
|
|
28
|
-
notFoundText:
|
|
29
|
-
disableOptionsFiltering:
|
|
25
|
+
loadingIcon: z,
|
|
26
|
+
autoFocus: H,
|
|
27
|
+
expandOnFocus: j,
|
|
28
|
+
notFoundText: J = "No results found",
|
|
29
|
+
disableOptionsFiltering: K = !1,
|
|
30
|
+
renderOption: T
|
|
30
31
|
}) {
|
|
31
|
-
const
|
|
32
|
+
const p = A.useRef(null), y = A.useRef(null), [g, h] = L(!1), [P, w] = L(!1), [D, u] = L(""), f = Array.isArray(r) && typeof r[0] == "object" && r[0] !== null && "label" in r[0] && "value" in r[0];
|
|
32
33
|
A.useEffect(() => {
|
|
33
34
|
const e = (t) => {
|
|
34
|
-
const
|
|
35
|
-
|
|
35
|
+
const i = p.current;
|
|
36
|
+
i && t.target !== i && !i.contains(t.target) && g && (h(!1), w(!1), l == null || l());
|
|
36
37
|
};
|
|
37
38
|
return document.addEventListener("mousedown", e), () => {
|
|
38
39
|
document.removeEventListener("mousedown", e);
|
|
39
40
|
};
|
|
40
|
-
}, [g]),
|
|
41
|
-
if (
|
|
41
|
+
}, [g]), C(() => {
|
|
42
|
+
if (f && r && s) {
|
|
42
43
|
const e = r.find(
|
|
43
44
|
(t) => t.value === s
|
|
44
45
|
);
|
|
45
46
|
u(e.label);
|
|
46
47
|
}
|
|
47
48
|
}, [r]);
|
|
48
|
-
const x = (e) => typeof e == "string" ? e : e.value, v = (e) => typeof e == "string" ? e : e.label,
|
|
49
|
-
const t = (
|
|
49
|
+
const x = (e) => typeof e == "string" ? e : e.value, v = (e) => typeof e == "string" ? e : e.label, Q = (e) => x(e) === s, o = V(), U = s !== "" && s !== void 0 ? "Cross" : "MagnifyingGlass", W = (e) => {
|
|
50
|
+
const t = (f ? D : s) ?? "";
|
|
50
51
|
return e.toLowerCase().includes(t.toLowerCase());
|
|
51
|
-
},
|
|
52
|
+
}, X = () => {
|
|
52
53
|
var e, t;
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
if (m == null || m(e),
|
|
54
|
+
f && u(""), d == null || d(), h(!0), (e = n == null ? void 0 : n.current) == null || e.focus(), (t = y == null ? void 0 : y.current) == null || t.focus();
|
|
55
|
+
}, Y = (e) => {
|
|
56
|
+
if (m == null || m(e), f) {
|
|
56
57
|
const t = r.find(
|
|
57
|
-
(
|
|
58
|
+
(i) => typeof i != "string" && i.value === e
|
|
58
59
|
);
|
|
59
60
|
t && u(t.label);
|
|
60
61
|
}
|
|
61
62
|
h(!1), w(!1), l == null || l();
|
|
62
|
-
}, Y = (e) => {
|
|
63
|
-
d == null || d(e), w(!!e);
|
|
64
63
|
}, Z = (e) => {
|
|
65
|
-
|
|
66
|
-
},
|
|
64
|
+
c == null || c(e), w(!!e);
|
|
65
|
+
}, R = (e) => {
|
|
66
|
+
u(e), c == null || c(e);
|
|
67
|
+
}, S = r == null ? void 0 : r.filter((e) => K ? !0 : W(v(e))).sort(
|
|
67
68
|
(e, t) => v(e).toLowerCase().localeCompare(v(t).toLowerCase())
|
|
68
69
|
);
|
|
69
70
|
return /* @__PURE__ */ b(
|
|
@@ -71,37 +72,37 @@ function le({
|
|
|
71
72
|
{
|
|
72
73
|
className: "flex flex-col w-full relative",
|
|
73
74
|
onFocus: () => {
|
|
74
|
-
|
|
75
|
+
j && w(!0), h(!0);
|
|
75
76
|
},
|
|
76
|
-
ref:
|
|
77
|
+
ref: p,
|
|
77
78
|
children: [
|
|
78
79
|
/* @__PURE__ */ a("div", { className: o.outDiv, children: /* @__PURE__ */ a(
|
|
79
|
-
|
|
80
|
+
k,
|
|
80
81
|
{
|
|
81
82
|
ref: n ?? y,
|
|
82
|
-
autoFocus:
|
|
83
|
+
autoFocus: H,
|
|
83
84
|
fieldType: "text",
|
|
84
|
-
placeholder:
|
|
85
|
-
value:
|
|
85
|
+
placeholder: $,
|
|
86
|
+
value: f ? D : s,
|
|
86
87
|
endIcon: {
|
|
87
|
-
icon:
|
|
88
|
-
handleClick:
|
|
88
|
+
icon: U,
|
|
89
|
+
handleClick: X
|
|
89
90
|
},
|
|
90
|
-
onChange: (e) =>
|
|
91
|
+
onChange: (e) => f ? R(e) : Z(e),
|
|
91
92
|
label: O,
|
|
92
|
-
helperText:
|
|
93
|
-
error:
|
|
94
|
-
warning:
|
|
95
|
-
disabled:
|
|
93
|
+
helperText: G,
|
|
94
|
+
error: M,
|
|
95
|
+
warning: _,
|
|
96
|
+
disabled: q,
|
|
96
97
|
externalActive: g,
|
|
97
|
-
loadingIcon:
|
|
98
|
+
loadingIcon: z
|
|
98
99
|
}
|
|
99
100
|
) }),
|
|
100
|
-
|
|
101
|
+
P && (s || j) && m && /* @__PURE__ */ b(
|
|
101
102
|
"div",
|
|
102
103
|
{
|
|
103
104
|
"data-testid": "typeahead-dropdown",
|
|
104
|
-
className:
|
|
105
|
+
className: F(
|
|
105
106
|
o.dropdown,
|
|
106
107
|
O ? "top-[6.8rem]" : "top-[4.5rem]"
|
|
107
108
|
// if label doesn't define the height of textfield is different
|
|
@@ -111,12 +112,12 @@ function le({
|
|
|
111
112
|
"div",
|
|
112
113
|
{
|
|
113
114
|
"data-testid": `typeahead-${e}`,
|
|
114
|
-
onClick: () =>
|
|
115
|
-
className:
|
|
115
|
+
onClick: () => Y(x(e)),
|
|
116
|
+
className: F(
|
|
116
117
|
o.itemContainer,
|
|
117
|
-
|
|
118
|
+
Q(e) ? "bg-surface-active" : "bg-white"
|
|
118
119
|
),
|
|
119
|
-
children: /* @__PURE__ */ a(
|
|
120
|
+
children: T ? T(e) : /* @__PURE__ */ a(
|
|
120
121
|
N,
|
|
121
122
|
{
|
|
122
123
|
swStyle: 5,
|
|
@@ -127,11 +128,11 @@ function le({
|
|
|
127
128
|
},
|
|
128
129
|
x(e)
|
|
129
130
|
)) : /* @__PURE__ */ b("div", { className: o.itemContainer, children: [
|
|
130
|
-
/* @__PURE__ */ a(N, { swStyle: 5, color: "default", children:
|
|
131
|
+
/* @__PURE__ */ a(N, { swStyle: 5, color: "default", children: J }),
|
|
131
132
|
" "
|
|
132
133
|
] }),
|
|
133
|
-
|
|
134
|
-
/* @__PURE__ */ a(
|
|
134
|
+
E && s && /* @__PURE__ */ b("div", { className: o.addValue, onClick: () => E(s), children: [
|
|
135
|
+
/* @__PURE__ */ a(I, { disabled: !0, id: "addvalue", color: "active", icon: "Add" }),
|
|
135
136
|
/* @__PURE__ */ a(N, { children: "Add value", swStyle: 5, color: "active" })
|
|
136
137
|
] })
|
|
137
138
|
]
|
|
@@ -142,5 +143,5 @@ function le({
|
|
|
142
143
|
);
|
|
143
144
|
}
|
|
144
145
|
export {
|
|
145
|
-
|
|
146
|
+
fe as Typeahead
|
|
146
147
|
};
|
|
@@ -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
|
};
|
package/dist/main.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export type { DropdownProps } from './components/atoms/form/dropdown';
|
|
|
23
23
|
export { DropdownFilter } from './components/molecules/filter/dropdown-selector';
|
|
24
24
|
export { DropdownSearch } from './components/atoms/form/dropdown-search';
|
|
25
25
|
export type { DropdownSearchProps, ExtendedDropdownSearchOption, BaseDropdownSearchOption, } from './components/atoms/form/dropdown-search';
|
|
26
|
+
export { DropdownItem, renderSpotterDropdownOption } from './components/atoms/form/dropdown-item';
|
|
27
|
+
export type { DropdownItemProps, SpotterDropdownOption } from './components/atoms/form/dropdown-item';
|
|
26
28
|
export { Calendar } from './components/atoms/form/calendar';
|
|
27
29
|
export type { CalendarProps, CalendarDate } from './components/atoms/form/calendar';
|
|
28
30
|
export type { DropdownFilterProps, DropdownFilterOption } from './components/molecules/filter/dropdown-selector';
|