@temp-spotwork/ui 1.6.0 → 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.
@@ -5,3 +5,5 @@ declare const meta: Meta<typeof Avatar>;
5
5
  export default meta;
6
6
  type Story = StoryObj<typeof meta>;
7
7
  export declare const Circular: Story;
8
+ export declare const WithFullName: Story;
9
+ export declare const LargeWithFullName: Story;
@@ -1,8 +1,8 @@
1
- import { f as r } from "../../../index-CktvVE7I.js";
2
- import { Avatar as o } from "./avatar.js";
3
- const c = {
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: o,
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: r() }
14
- }, e = {
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
- e as Circular,
21
- c as default
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 b, jsxs as U } from "react/jsx-runtime";
2
- import { Typography as _ } from "../../styles/typography/typography.js";
3
- import { classesMap as I } from "./styles.js";
4
- import y from "./statusIndicatorIcon.js";
5
- import { t as s } from "../../../bundle-mjs-CAy1p0fn.js";
6
- function Z({
7
- id: p,
8
- hasBorder: l = !1,
9
- variant: i,
10
- image: d,
11
- textView: E = "NN",
12
- isActive: o,
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: c,
14
+ onClick: s,
15
15
  size: t
16
16
  }) {
17
- const e = i === "circular", a = e ? 5 : 5.5, n = t ? t / a : 1, m = I[i](l), u = !e && l && o ? "border-bcolor-active" : "border-bcolor-divider", S = t && a > t ? 1 : 7, g = () => {
18
- c && c(p);
19
- }, x = d ? /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(
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: s(m.image, u),
23
- src: d,
25
+ className: l(p.image, h),
26
+ src: m,
24
27
  alt: "avatar-image"
25
28
  }
26
- ) }) : /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(
29
+ ) }) : /* @__PURE__ */ r(E, { children: /* @__PURE__ */ r(
27
30
  "div",
28
31
  {
29
32
  "data-testid": "avatar-text-box",
30
- className: s(m.textBox, u),
33
+ className: l(p.textBox, h),
31
34
  children: /* @__PURE__ */ r(
32
- _,
35
+ y,
33
36
  {
34
- swStyle: S,
35
- children: E,
37
+ swStyle: A,
38
+ children: S,
36
39
  color: "visualPlaceholderDefault"
37
40
  }
38
41
  )
39
42
  }
40
- ) }), f = 0.25, A = e && v && !o && /* @__PURE__ */ r(
43
+ ) }), f = 0.25, x = e && v && !n && /* @__PURE__ */ r(
41
44
  "div",
42
45
  {
43
46
  className: "absolute",
44
47
  style: {
45
- bottom: `${n * f}rem`,
46
- right: `${n * f}rem`
48
+ bottom: `${c * f}rem`,
49
+ right: `${c * f}rem`
47
50
  },
48
51
  "data-testid": "avatar-online-status",
49
- children: /* @__PURE__ */ r(y, { scalingFactor: n })
52
+ children: /* @__PURE__ */ r(F, { scalingFactor: c })
50
53
  }
51
- ), h = c ? "button" : "div", C = () => e && o ? "border-bcolor-active" : "border-[transparent]";
52
- return /* @__PURE__ */ U(
53
- h,
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: g,
59
+ onClick: C,
57
60
  style: {
58
61
  width: `${t || a}rem`,
59
62
  height: `${t || a}rem`
60
63
  },
61
- className: s(
64
+ className: l(
62
65
  "flex items-center justify-center flex-shrink-0 flex-grow-0 relative",
63
- C(),
66
+ _(),
64
67
  "aspect-square"
65
68
  ),
66
- ...h === "button" ? { type: "button" } : {},
69
+ ...b === "button" ? { type: "button" } : {},
67
70
  children: [
68
- x,
69
- A
71
+ U,
72
+ x
70
73
  ]
71
74
  }
72
75
  );
73
76
  }
74
77
  export {
75
- Z as Avatar
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: any, dateRight: any, weekStartsOn?: number) => boolean;
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 g = (r) => {
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, n] = r.split("-"), o = t[e];
16
- if (!o || !n)
15
+ }, [e, r] = n.split("-"), o = t[e];
16
+ if (!o || !r)
17
17
  throw new Error("Invalid date format");
18
- return `${o} ${n}`;
19
- }, d = (r) => {
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, n] = r.split("-"), o = parseInt(n, 10), a = t[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
- }, p = (r) => {
36
- const t = { month: "short", year: "numeric" }, [e, n] = r.toLocaleDateString("en-US", t).split(" ");
37
- return `${e}-${n}`;
38
- }, D = (r) => {
39
- const { start: t, end: e } = r;
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 n = t.getFullYear(), o = t.getMonth(), a = e.getFullYear(), s = e.getMonth(), h = [];
43
- for (let c = n; c <= a; c++) {
44
- const f = c === n ? o : 0, i = c === a ? s : 11;
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"), m = `${c}-${M}-01`;
47
- h.push(m);
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
- }, S = (r) => {
52
- const { start: t, end: e } = r;
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 n = [], o = t.getFullYear(), a = e.getFullYear();
57
+ const r = [], o = t.getFullYear(), a = e.getFullYear();
58
58
  for (let s = o; s <= a; s++)
59
- n.push(new Date(s, 0, 1));
60
- return n;
61
- }, y = (r, t) => {
62
- const [e, n] = g(r).split(" "), o = parseInt(n, 10), a = (/* @__PURE__ */ new Date(`${e} 1, ${o}`)).getMonth(), s = t.getMonth(), h = t.getFullYear();
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 = (r, t) => {
65
- const e = new Date(r), n = (e.getDay() - t + 7) % 7;
66
- return e.setDate(e.getDate() - n), e.setHours(0, 0, 0, 0), e;
67
- }, Y = (r, t, e = 0) => {
68
- const n = l(r, e), o = l(t, e);
69
- return n.getTime() === o.getTime();
70
- }, w = (r) => {
71
- const t = new Date(r);
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
- D as eachMonthOfInterval,
76
- S as eachYearOfInterval,
77
- w as endOfMonth,
78
- p as formatDateToMonthYear,
79
- g as formatShortMonthYear,
80
- y as isSameMonth,
81
- Y as isSameWeek,
82
- d as parseShortMonthYear
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
  };
@@ -1,17 +1,29 @@
1
- import { jsxs as i } from "react/jsx-runtime";
2
- import { rowContainer as m } from "./styles.js";
3
- import { t as n } from "../../../../bundle-mjs-CAy1p0fn.js";
4
- function l({ cells: t, rowHeader: o, minWidth: r, id: e, className: a }) {
5
- return /* @__PURE__ */ i(
1
+ import { jsxs as a, jsx as m } from "react/jsx-runtime";
2
+ import o from "react";
3
+ import { rowContainer as s } from "./styles.js";
4
+ import { t as p } from "../../../../bundle-mjs-CAy1p0fn.js";
5
+ function f(t) {
6
+ return Array.isArray(t) ? t.map((r, e) => {
7
+ if (o.isValidElement(r)) {
8
+ const n = r.props;
9
+ return o.cloneElement(r, {
10
+ key: r.key ?? n.id ?? `cell-${e}`
11
+ });
12
+ }
13
+ return /* @__PURE__ */ m(o.Fragment, { children: r }, `cell-${e}`);
14
+ }) : t;
15
+ }
16
+ function l({ cells: t, rowHeader: r, minWidth: e, id: n, className: i }) {
17
+ return /* @__PURE__ */ a(
6
18
  "tr",
7
19
  {
8
- id: e,
9
- className: n(m, a),
10
- style: { minWidth: r ? `${r}rem` : "0" },
20
+ id: n,
21
+ className: p(s, i),
22
+ style: { minWidth: e ? `${e}rem` : "0" },
11
23
  "data-testid": "table-row-container",
12
24
  children: [
13
- o,
14
- t
25
+ r,
26
+ f(t)
15
27
  ]
16
28
  }
17
29
  );
@@ -34,4 +34,4 @@ export type HeaderProps = {
34
34
  */
35
35
  additionalRightBox?: React.ReactNode;
36
36
  };
37
- export declare function Header({ setShowSideBar, companyLogoUrl, account, hasUnreadMessages, setShowMessages, showMenu, showNotifications, additionalRightBox, }: HeaderProps): import("react/jsx-runtime").JSX.Element;
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 r, jsx as a } from "react/jsx-runtime";
2
- import { Icons as c } from "../../../atoms/icons/icons.js";
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 m } from "./styles.js";
6
- function v({
5
+ import { styles as o } from "./styles.js";
6
+ function N({
7
7
  setShowSideBar: i,
8
- companyLogoUrl: o,
9
- account: s,
10
- hasUnreadMessages: l = !1,
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 = m();
17
- return /* @__PURE__ */ r("div", { className: e.container, "data-testid": "header", children: [
18
- /* @__PURE__ */ r("div", { className: e.menuBox, children: [
19
- n && /* @__PURE__ */ a(
20
- c,
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: o, alt: "Spotwork" })
25
+ /* @__PURE__ */ a("img", { className: "h-[4rem] w-auto", src: m, alt: "Spotwork" })
29
26
  ] }),
30
- (s || t) && /* @__PURE__ */ r("div", { className: e.accContainer, children: [
27
+ (r || t) && /* @__PURE__ */ s("div", { className: e.accContainer, children: [
31
28
  t,
32
- s && /* @__PURE__ */ a("div", { className: e.account, children: s })
29
+ r && /* @__PURE__ */ a("div", { className: e.account, children: r })
33
30
  ] })
34
31
  ] });
35
32
  }
36
33
  export {
37
- v as Header
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.0",
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
+ }