@temp-spotwork/ui 1.7.5 → 1.7.6
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.
|
@@ -7,3 +7,9 @@ type Story = StoryObj<typeof meta>;
|
|
|
7
7
|
export declare const Circular: Story;
|
|
8
8
|
export declare const WithFullName: Story;
|
|
9
9
|
export declare const LargeWithFullName: Story;
|
|
10
|
+
export declare const SingleName: Story;
|
|
11
|
+
export declare const WhitespaceName: Story;
|
|
12
|
+
export declare const EmptyName: Story;
|
|
13
|
+
export declare const NoTextView: Story;
|
|
14
|
+
export declare const NullName: Story;
|
|
15
|
+
export declare const EdgeCasesShowcase: Story;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { jsx as a, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { f as s } from "../../../index-Dpx0xQmQ.js";
|
|
3
|
+
import { Avatar as t } from "./avatar.js";
|
|
4
|
+
const v = {
|
|
4
5
|
title: "@spotwork-ui/Avatar",
|
|
5
|
-
component:
|
|
6
|
+
component: t,
|
|
6
7
|
parameters: {
|
|
7
8
|
layout: "centered"
|
|
8
9
|
},
|
|
@@ -10,19 +11,19 @@ const o = {
|
|
|
10
11
|
argTypes: {
|
|
11
12
|
backgroundColor: { control: "color" }
|
|
12
13
|
},
|
|
13
|
-
args: { onClick:
|
|
14
|
-
},
|
|
14
|
+
args: { onClick: s() }
|
|
15
|
+
}, u = {
|
|
15
16
|
args: {
|
|
16
17
|
id: "circular-avatar",
|
|
17
18
|
variant: "circular"
|
|
18
19
|
}
|
|
19
|
-
},
|
|
20
|
+
}, d = {
|
|
20
21
|
args: {
|
|
21
22
|
id: "full-name-avatar",
|
|
22
23
|
variant: "circular",
|
|
23
24
|
textView: "Steve Bob"
|
|
24
25
|
}
|
|
25
|
-
},
|
|
26
|
+
}, x = {
|
|
26
27
|
args: {
|
|
27
28
|
id: "large-full-name-avatar",
|
|
28
29
|
variant: "circular",
|
|
@@ -30,10 +31,67 @@ const o = {
|
|
|
30
31
|
size: 9,
|
|
31
32
|
isActive: !0
|
|
32
33
|
}
|
|
34
|
+
}, g = {
|
|
35
|
+
args: {
|
|
36
|
+
id: "single-name-avatar",
|
|
37
|
+
variant: "circular",
|
|
38
|
+
textView: "Steve"
|
|
39
|
+
}
|
|
40
|
+
}, p = {
|
|
41
|
+
args: {
|
|
42
|
+
id: "whitespace-name-avatar",
|
|
43
|
+
variant: "circular",
|
|
44
|
+
textView: " "
|
|
45
|
+
}
|
|
46
|
+
}, w = {
|
|
47
|
+
args: {
|
|
48
|
+
id: "empty-name-avatar",
|
|
49
|
+
variant: "circular",
|
|
50
|
+
textView: ""
|
|
51
|
+
}
|
|
52
|
+
}, f = {
|
|
53
|
+
args: {
|
|
54
|
+
id: "no-text-view-avatar",
|
|
55
|
+
variant: "circular"
|
|
56
|
+
}
|
|
57
|
+
}, V = {
|
|
58
|
+
args: {
|
|
59
|
+
id: "null-name-avatar",
|
|
60
|
+
variant: "circular",
|
|
61
|
+
textView: null
|
|
62
|
+
}
|
|
63
|
+
}, c = [
|
|
64
|
+
{ label: "Full name", textView: "Steve Bob" },
|
|
65
|
+
{ label: "Single name", textView: "Steve" },
|
|
66
|
+
{ label: 'Whitespace " "', textView: " " },
|
|
67
|
+
{ label: 'Empty ""', textView: "" },
|
|
68
|
+
{ label: "Undefined", textView: void 0 },
|
|
69
|
+
{ label: "Null", textView: null }
|
|
70
|
+
], N = {
|
|
71
|
+
render: () => /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-6", children: c.map(({ label: r, textView: i }, e) => /* @__PURE__ */ l("div", { className: "flex flex-col items-center gap-2", children: [
|
|
72
|
+
/* @__PURE__ */ a(
|
|
73
|
+
t,
|
|
74
|
+
{
|
|
75
|
+
id: `showcase-${e}`,
|
|
76
|
+
variant: "circular",
|
|
77
|
+
textView: i
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ a("span", { className: "text-xs text-gray-600", children: r })
|
|
81
|
+
] }, e)) }),
|
|
82
|
+
parameters: {
|
|
83
|
+
layout: "padded"
|
|
84
|
+
}
|
|
33
85
|
};
|
|
34
86
|
export {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
87
|
+
u as Circular,
|
|
88
|
+
N as EdgeCasesShowcase,
|
|
89
|
+
w as EmptyName,
|
|
90
|
+
x as LargeWithFullName,
|
|
91
|
+
f as NoTextView,
|
|
92
|
+
V as NullName,
|
|
93
|
+
g as SingleName,
|
|
94
|
+
p as WhitespaceName,
|
|
95
|
+
d as WithFullName,
|
|
96
|
+
v as default
|
|
39
97
|
};
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { jsx as r, Fragment as
|
|
2
|
-
import { Typography as
|
|
3
|
-
import { classesMap as
|
|
4
|
-
import
|
|
5
|
-
import { t as
|
|
6
|
-
function
|
|
7
|
-
id:
|
|
1
|
+
import { jsx as r, Fragment as b, jsxs as _ } from "react/jsx-runtime";
|
|
2
|
+
import { Typography as I } from "../../styles/typography/typography.js";
|
|
3
|
+
import { classesMap as y } from "./styles.js";
|
|
4
|
+
import D from "./statusIndicatorIcon.js";
|
|
5
|
+
import { t as c } from "../../../bundle-mjs-BjFsLjkg.js";
|
|
6
|
+
function j({
|
|
7
|
+
id: g,
|
|
8
8
|
hasBorder: i = !1,
|
|
9
9
|
variant: d,
|
|
10
10
|
image: m,
|
|
11
|
-
textView:
|
|
11
|
+
textView: E = "NN",
|
|
12
12
|
isActive: n,
|
|
13
13
|
isOnline: v = !1,
|
|
14
14
|
onClick: s,
|
|
15
15
|
size: t
|
|
16
16
|
}) {
|
|
17
17
|
const C = (() => {
|
|
18
|
-
const e =
|
|
19
|
-
return e.length
|
|
20
|
-
})(), a = d === "circular", o = a ? 5 : 5.5,
|
|
21
|
-
s && s(
|
|
22
|
-
},
|
|
18
|
+
const e = (E ?? "").trim().split(/\s+/).filter(Boolean);
|
|
19
|
+
return e.length === 0 ? "NN" : e.length === 1 ? e[0][0].toUpperCase() : (e[0][0] + e[e.length - 1][0]).toUpperCase();
|
|
20
|
+
})(), a = d === "circular", o = a ? 5 : 5.5, l = t ? t / o : 1, u = y[d](i), p = !a && i && n ? "border-bcolor-active" : "border-bcolor-divider", S = t && o > t ? 1 : 7, U = () => {
|
|
21
|
+
s && s(g);
|
|
22
|
+
}, x = m ? /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(
|
|
23
23
|
"img",
|
|
24
24
|
{
|
|
25
|
-
className:
|
|
25
|
+
className: c(u.image, p),
|
|
26
26
|
src: m,
|
|
27
27
|
alt: "avatar-image"
|
|
28
28
|
}
|
|
29
|
-
) }) : /* @__PURE__ */ r(
|
|
29
|
+
) }) : /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(
|
|
30
30
|
"div",
|
|
31
31
|
{
|
|
32
32
|
"data-testid": "avatar-text-box",
|
|
33
|
-
className:
|
|
33
|
+
className: c(u.textBox, p),
|
|
34
34
|
children: /* @__PURE__ */ r(
|
|
35
|
-
|
|
35
|
+
I,
|
|
36
36
|
{
|
|
37
37
|
swStyle: S,
|
|
38
38
|
children: C,
|
|
@@ -40,20 +40,20 @@ function w({
|
|
|
40
40
|
}
|
|
41
41
|
)
|
|
42
42
|
}
|
|
43
|
-
) }), f = 0.25,
|
|
43
|
+
) }), f = 0.25, A = a && v && !n && /* @__PURE__ */ r(
|
|
44
44
|
"div",
|
|
45
45
|
{
|
|
46
46
|
className: "absolute",
|
|
47
47
|
style: {
|
|
48
|
-
bottom: `${
|
|
49
|
-
right: `${
|
|
48
|
+
bottom: `${l * f}rem`,
|
|
49
|
+
right: `${l * f}rem`
|
|
50
50
|
},
|
|
51
51
|
"data-testid": "avatar-online-status",
|
|
52
|
-
children: /* @__PURE__ */ r(
|
|
52
|
+
children: /* @__PURE__ */ r(D, { scalingFactor: l })
|
|
53
53
|
}
|
|
54
|
-
),
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
-
|
|
54
|
+
), h = s ? "button" : "div", N = () => a && n ? "border-bcolor-active" : "border-[transparent]";
|
|
55
|
+
return /* @__PURE__ */ _(
|
|
56
|
+
h,
|
|
57
57
|
{
|
|
58
58
|
"data-testid": "avatar-container",
|
|
59
59
|
onClick: U,
|
|
@@ -61,19 +61,19 @@ function w({
|
|
|
61
61
|
width: `${t || o}rem`,
|
|
62
62
|
height: `${t || o}rem`
|
|
63
63
|
},
|
|
64
|
-
className:
|
|
64
|
+
className: c(
|
|
65
65
|
"flex items-center justify-center flex-shrink-0 flex-grow-0 relative",
|
|
66
|
-
|
|
66
|
+
N(),
|
|
67
67
|
"aspect-square"
|
|
68
68
|
),
|
|
69
|
-
...
|
|
69
|
+
...h === "button" ? { type: "button" } : {},
|
|
70
70
|
children: [
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
x,
|
|
72
|
+
A
|
|
73
73
|
]
|
|
74
74
|
}
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
77
|
export {
|
|
78
|
-
|
|
78
|
+
j as Avatar
|
|
79
79
|
};
|