@temp-spotwork/ui 1.6.1 → 1.6.7
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/avatar/Avatar.stories.d.ts +2 -0
- package/dist/components/atoms/avatar/Avatar.stories.js +25 -8
- package/dist/components/atoms/avatar/avatar.js +40 -37
- package/dist/components/atoms/form/dateselect/helpers.d.ts +1 -1
- package/dist/components/atoms/form/dateselect/helpers.js +39 -39
- package/dist/components/molecules/navigation/header/header.d.ts +1 -1
- package/dist/components/molecules/navigation/header/header.js +16 -19
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { f as
|
|
2
|
-
import { Avatar as
|
|
3
|
-
const
|
|
1
|
+
import { f as a } from "../../../index-CktvVE7I.js";
|
|
2
|
+
import { Avatar as r } from "./avatar.js";
|
|
3
|
+
const o = {
|
|
4
4
|
title: "@spotwork-ui/Avatar",
|
|
5
|
-
component:
|
|
5
|
+
component: r,
|
|
6
6
|
parameters: {
|
|
7
7
|
layout: "centered"
|
|
8
8
|
},
|
|
@@ -10,13 +10,30 @@ const c = {
|
|
|
10
10
|
argTypes: {
|
|
11
11
|
backgroundColor: { control: "color" }
|
|
12
12
|
},
|
|
13
|
-
args: { onClick:
|
|
14
|
-
},
|
|
13
|
+
args: { onClick: a() }
|
|
14
|
+
}, i = {
|
|
15
15
|
args: {
|
|
16
|
+
id: "circular-avatar",
|
|
16
17
|
variant: "circular"
|
|
17
18
|
}
|
|
19
|
+
}, c = {
|
|
20
|
+
args: {
|
|
21
|
+
id: "full-name-avatar",
|
|
22
|
+
variant: "circular",
|
|
23
|
+
textView: "Steve Bob"
|
|
24
|
+
}
|
|
25
|
+
}, l = {
|
|
26
|
+
args: {
|
|
27
|
+
id: "large-full-name-avatar",
|
|
28
|
+
variant: "circular",
|
|
29
|
+
textView: "Steve Bob",
|
|
30
|
+
size: 9,
|
|
31
|
+
isActive: !0
|
|
32
|
+
}
|
|
18
33
|
};
|
|
19
34
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
35
|
+
i as Circular,
|
|
36
|
+
l as LargeWithFullName,
|
|
37
|
+
c as WithFullName,
|
|
38
|
+
o as default
|
|
22
39
|
};
|
|
@@ -1,76 +1,79 @@
|
|
|
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:
|
|
8
|
-
hasBorder:
|
|
9
|
-
variant:
|
|
10
|
-
image:
|
|
11
|
-
textView:
|
|
12
|
-
isActive:
|
|
1
|
+
import { jsx as r, Fragment as E, jsxs as I } from "react/jsx-runtime";
|
|
2
|
+
import { Typography as y } from "../../styles/typography/typography.js";
|
|
3
|
+
import { classesMap as D } from "./styles.js";
|
|
4
|
+
import F from "./statusIndicatorIcon.js";
|
|
5
|
+
import { t as l } from "../../../bundle-mjs-CAy1p0fn.js";
|
|
6
|
+
function w({
|
|
7
|
+
id: g,
|
|
8
|
+
hasBorder: i = !1,
|
|
9
|
+
variant: d,
|
|
10
|
+
image: m,
|
|
11
|
+
textView: u = "NN",
|
|
12
|
+
isActive: n,
|
|
13
13
|
isOnline: v = !1,
|
|
14
|
-
onClick:
|
|
14
|
+
onClick: s,
|
|
15
15
|
size: t
|
|
16
16
|
}) {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
const S = (() => {
|
|
18
|
+
const o = u.trim().split(/\s+/);
|
|
19
|
+
return o.length > 1 ? (o[0][0] + o[o.length - 1][0]).toUpperCase() : u;
|
|
20
|
+
})(), e = d === "circular", a = e ? 5 : 5.5, c = t ? t / a : 1, p = D[d](i), h = !e && i && n ? "border-bcolor-active" : "border-bcolor-divider", A = t && a > t ? 1 : 7, C = () => {
|
|
21
|
+
s && s(g);
|
|
22
|
+
}, U = m ? /* @__PURE__ */ r(E, { children: /* @__PURE__ */ r(
|
|
20
23
|
"img",
|
|
21
24
|
{
|
|
22
|
-
className:
|
|
23
|
-
src:
|
|
25
|
+
className: l(p.image, h),
|
|
26
|
+
src: m,
|
|
24
27
|
alt: "avatar-image"
|
|
25
28
|
}
|
|
26
|
-
) }) : /* @__PURE__ */ r(
|
|
29
|
+
) }) : /* @__PURE__ */ r(E, { children: /* @__PURE__ */ r(
|
|
27
30
|
"div",
|
|
28
31
|
{
|
|
29
32
|
"data-testid": "avatar-text-box",
|
|
30
|
-
className:
|
|
33
|
+
className: l(p.textBox, h),
|
|
31
34
|
children: /* @__PURE__ */ r(
|
|
32
|
-
|
|
35
|
+
y,
|
|
33
36
|
{
|
|
34
|
-
swStyle:
|
|
35
|
-
children:
|
|
37
|
+
swStyle: A,
|
|
38
|
+
children: S,
|
|
36
39
|
color: "visualPlaceholderDefault"
|
|
37
40
|
}
|
|
38
41
|
)
|
|
39
42
|
}
|
|
40
|
-
) }), f = 0.25,
|
|
43
|
+
) }), f = 0.25, x = e && v && !n && /* @__PURE__ */ r(
|
|
41
44
|
"div",
|
|
42
45
|
{
|
|
43
46
|
className: "absolute",
|
|
44
47
|
style: {
|
|
45
|
-
bottom: `${
|
|
46
|
-
right: `${
|
|
48
|
+
bottom: `${c * f}rem`,
|
|
49
|
+
right: `${c * f}rem`
|
|
47
50
|
},
|
|
48
51
|
"data-testid": "avatar-online-status",
|
|
49
|
-
children: /* @__PURE__ */ r(
|
|
52
|
+
children: /* @__PURE__ */ r(F, { scalingFactor: c })
|
|
50
53
|
}
|
|
51
|
-
),
|
|
52
|
-
return /* @__PURE__ */
|
|
53
|
-
|
|
54
|
+
), b = s ? "button" : "div", _ = () => e && n ? "border-bcolor-active" : "border-[transparent]";
|
|
55
|
+
return /* @__PURE__ */ I(
|
|
56
|
+
b,
|
|
54
57
|
{
|
|
55
58
|
"data-testid": "avatar-container",
|
|
56
|
-
onClick:
|
|
59
|
+
onClick: C,
|
|
57
60
|
style: {
|
|
58
61
|
width: `${t || a}rem`,
|
|
59
62
|
height: `${t || a}rem`
|
|
60
63
|
},
|
|
61
|
-
className:
|
|
64
|
+
className: l(
|
|
62
65
|
"flex items-center justify-center flex-shrink-0 flex-grow-0 relative",
|
|
63
|
-
|
|
66
|
+
_(),
|
|
64
67
|
"aspect-square"
|
|
65
68
|
),
|
|
66
|
-
...
|
|
69
|
+
...b === "button" ? { type: "button" } : {},
|
|
67
70
|
children: [
|
|
68
|
-
|
|
69
|
-
|
|
71
|
+
U,
|
|
72
|
+
x
|
|
70
73
|
]
|
|
71
74
|
}
|
|
72
75
|
);
|
|
73
76
|
}
|
|
74
77
|
export {
|
|
75
|
-
|
|
78
|
+
w as Avatar
|
|
76
79
|
};
|
|
@@ -32,5 +32,5 @@ export declare const eachYearOfInterval: (interval: {
|
|
|
32
32
|
end: Date;
|
|
33
33
|
}) => Date[];
|
|
34
34
|
export declare const isSameMonth: (shortDate: any, currentDay: any) => boolean;
|
|
35
|
-
export declare const isSameWeek: (dateLeft:
|
|
35
|
+
export declare const isSameWeek: (dateLeft: string | Date, dateRight: string | Date, weekStartsOn?: number) => boolean;
|
|
36
36
|
export declare const endOfMonth: (date: Date) => Date;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const m = (n) => {
|
|
2
2
|
const t = {
|
|
3
3
|
Jan: "January",
|
|
4
4
|
Feb: "February",
|
|
@@ -12,11 +12,11 @@ const g = (r) => {
|
|
|
12
12
|
Oct: "October",
|
|
13
13
|
Nov: "November",
|
|
14
14
|
Dec: "December"
|
|
15
|
-
}, [e,
|
|
16
|
-
if (!o || !
|
|
15
|
+
}, [e, r] = n.split("-"), o = t[e];
|
|
16
|
+
if (!o || !r)
|
|
17
17
|
throw new Error("Invalid date format");
|
|
18
|
-
return `${o} ${
|
|
19
|
-
},
|
|
18
|
+
return `${o} ${r}`;
|
|
19
|
+
}, p = (n) => {
|
|
20
20
|
const t = {
|
|
21
21
|
Jan: 0,
|
|
22
22
|
Feb: 1,
|
|
@@ -30,54 +30,54 @@ const g = (r) => {
|
|
|
30
30
|
Oct: 9,
|
|
31
31
|
Nov: 10,
|
|
32
32
|
Dec: 11
|
|
33
|
-
}, [e,
|
|
33
|
+
}, [e, r] = n.split("-"), o = parseInt(r, 10), a = t[e];
|
|
34
34
|
return isNaN(o) || a === void 0 ? /* @__PURE__ */ new Date(NaN) : new Date(o, a);
|
|
35
|
-
},
|
|
36
|
-
const t = { month: "short", year: "numeric" }, [e,
|
|
37
|
-
return `${e}-${
|
|
38
|
-
},
|
|
39
|
-
const { start: t, end: e } =
|
|
35
|
+
}, D = (n) => {
|
|
36
|
+
const t = { month: "short", year: "numeric" }, [e, r] = n.toLocaleDateString("en-US", t).split(" ");
|
|
37
|
+
return `${e}-${r}`;
|
|
38
|
+
}, y = (n) => {
|
|
39
|
+
const { start: t, end: e } = n;
|
|
40
40
|
if (t > e)
|
|
41
41
|
throw new Error("The start of the interval cannot be after the end");
|
|
42
|
-
const
|
|
43
|
-
for (let c =
|
|
44
|
-
const f = c ===
|
|
42
|
+
const r = t.getFullYear(), o = t.getMonth(), a = e.getFullYear(), s = e.getMonth(), h = [];
|
|
43
|
+
for (let c = r; c <= a; c++) {
|
|
44
|
+
const f = c === r ? o : 0, i = c === a ? s : 11;
|
|
45
45
|
for (let u = f; u <= i; u++) {
|
|
46
|
-
const M = String(u + 1).padStart(2, "0"),
|
|
47
|
-
h.push(
|
|
46
|
+
const M = String(u + 1).padStart(2, "0"), g = `${c}-${M}-01`;
|
|
47
|
+
h.push(g);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
return h;
|
|
51
|
-
},
|
|
52
|
-
const { start: t, end: e } =
|
|
51
|
+
}, d = (n) => {
|
|
52
|
+
const { start: t, end: e } = n;
|
|
53
53
|
if (!(t instanceof Date) || !(e instanceof Date))
|
|
54
54
|
throw new Error("Invalid start or end date");
|
|
55
55
|
if (t > e)
|
|
56
56
|
throw new Error("The start date must be before or equal to the end date");
|
|
57
|
-
const
|
|
57
|
+
const r = [], o = t.getFullYear(), a = e.getFullYear();
|
|
58
58
|
for (let s = o; s <= a; s++)
|
|
59
|
-
|
|
60
|
-
return
|
|
61
|
-
},
|
|
62
|
-
const [e,
|
|
59
|
+
r.push(new Date(s, 0, 1));
|
|
60
|
+
return r;
|
|
61
|
+
}, S = (n, t) => {
|
|
62
|
+
const [e, r] = m(n).split(" "), o = parseInt(r, 10), a = (/* @__PURE__ */ new Date(`${e} 1, ${o}`)).getMonth(), s = t.getMonth(), h = t.getFullYear();
|
|
63
63
|
return s === a && h === o;
|
|
64
|
-
}, l = (
|
|
65
|
-
const e = new Date(
|
|
66
|
-
return e.setDate(e.getDate() -
|
|
67
|
-
},
|
|
68
|
-
const n = l(r, e),
|
|
69
|
-
return
|
|
70
|
-
},
|
|
71
|
-
const t = new Date(
|
|
64
|
+
}, l = (n, t) => {
|
|
65
|
+
const e = new Date(n), r = (e.getDay() - t + 7) % 7;
|
|
66
|
+
return e.setDate(e.getDate() - r), e.setHours(0, 0, 0, 0), e;
|
|
67
|
+
}, w = (n, t, e = 0) => {
|
|
68
|
+
const r = typeof n == "string" ? new Date(n) : n, o = typeof t == "string" ? new Date(t) : t, a = l(r, e), s = l(o, e);
|
|
69
|
+
return a.getTime() === s.getTime();
|
|
70
|
+
}, Y = (n) => {
|
|
71
|
+
const t = new Date(n);
|
|
72
72
|
return t.setMonth(t.getMonth() + 1), t.setDate(0), t.setHours(23, 59, 59, 999), t;
|
|
73
73
|
};
|
|
74
74
|
export {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
75
|
+
y as eachMonthOfInterval,
|
|
76
|
+
d as eachYearOfInterval,
|
|
77
|
+
Y as endOfMonth,
|
|
78
|
+
D as formatDateToMonthYear,
|
|
79
|
+
m as formatShortMonthYear,
|
|
80
|
+
S as isSameMonth,
|
|
81
|
+
w as isSameWeek,
|
|
82
|
+
p as parseShortMonthYear
|
|
83
83
|
};
|
|
@@ -34,4 +34,4 @@ export type HeaderProps = {
|
|
|
34
34
|
*/
|
|
35
35
|
additionalRightBox?: React.ReactNode;
|
|
36
36
|
};
|
|
37
|
-
export declare function Header({ setShowSideBar, companyLogoUrl, account,
|
|
37
|
+
export declare function Header({ setShowSideBar, companyLogoUrl, account, showMenu, additionalRightBox, }: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Icons as
|
|
1
|
+
import { jsxs as s, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { Icons as n } from "../../../atoms/icons/icons.js";
|
|
3
3
|
import "../../../atoms/icons/iconsSVGs/Large/Profile.js";
|
|
4
4
|
import "../../../atoms/icons/iconsSVGs/Small/Profile.js";
|
|
5
|
-
import { styles as
|
|
6
|
-
function
|
|
5
|
+
import { styles as o } from "./styles.js";
|
|
6
|
+
function N({
|
|
7
7
|
setShowSideBar: i,
|
|
8
|
-
companyLogoUrl:
|
|
9
|
-
account:
|
|
10
|
-
|
|
11
|
-
setShowMessages: d,
|
|
12
|
-
showMenu: n = !0,
|
|
13
|
-
showNotifications: u = !0,
|
|
8
|
+
companyLogoUrl: m,
|
|
9
|
+
account: r,
|
|
10
|
+
showMenu: c = !0,
|
|
14
11
|
additionalRightBox: t
|
|
15
12
|
}) {
|
|
16
|
-
const e =
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
const e = o();
|
|
14
|
+
return /* @__PURE__ */ s("div", { className: e.container, "data-testid": "header", children: [
|
|
15
|
+
/* @__PURE__ */ s("div", { className: e.menuBox, children: [
|
|
16
|
+
c && /* @__PURE__ */ a(
|
|
17
|
+
n,
|
|
21
18
|
{
|
|
22
19
|
id: "HamburgerMenu",
|
|
23
20
|
icon: "HamburgerMenu",
|
|
@@ -25,14 +22,14 @@ function v({
|
|
|
25
22
|
button: !0
|
|
26
23
|
}
|
|
27
24
|
),
|
|
28
|
-
/* @__PURE__ */ a("img", { className: "h-[4rem] w-auto", src:
|
|
25
|
+
/* @__PURE__ */ a("img", { className: "h-[4rem] w-auto", src: m, alt: "Spotwork" })
|
|
29
26
|
] }),
|
|
30
|
-
(
|
|
27
|
+
(r || t) && /* @__PURE__ */ s("div", { className: e.accContainer, children: [
|
|
31
28
|
t,
|
|
32
|
-
|
|
29
|
+
r && /* @__PURE__ */ a("div", { className: e.account, children: r })
|
|
33
30
|
] })
|
|
34
31
|
] });
|
|
35
32
|
}
|
|
36
33
|
export {
|
|
37
|
-
|
|
34
|
+
N as Header
|
|
38
35
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temp-spotwork/ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"types": "dist/main.d.ts",
|
|
@@ -90,4 +90,4 @@
|
|
|
90
90
|
"react-spring": "^9.7.3",
|
|
91
91
|
"tailwindcss-animate": "^1.0.7"
|
|
92
92
|
}
|
|
93
|
-
}
|
|
93
|
+
}
|