@streamlayer/react-ui 0.50.0 → 0.51.0

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.
@@ -14,7 +14,8 @@ import "react-window-infinite-loader";
14
14
  import "../../../gamification/leaderboard-item/index.js";
15
15
  import "../../../../utils/common.js";
16
16
  import "../../../gamification/leaderboard-item/styles.js";
17
- const q = ({ leaderboardList: o }) => {
17
+ import "../../../icons/index.js";
18
+ const w = ({ leaderboardList: o }) => {
18
19
  const { data: r } = d(o.$store), [t, i] = f(void 0), e = (p) => {
19
20
  const a = r.find((s) => s.userId === p);
20
21
  i(a);
@@ -25,5 +26,5 @@ const q = ({ leaderboardList: o }) => {
25
26
  ] });
26
27
  };
27
28
  export {
28
- q as Leaderboard
29
+ w as Leaderboard
29
30
  };
@@ -20,6 +20,7 @@ import "react-window-infinite-loader";
20
20
  import "../../../gamification/leaderboard-item/index.js";
21
21
  import "../../../../utils/common.js";
22
22
  import "../../../gamification/leaderboard-item/styles.js";
23
+ import "../../../icons/index.js";
23
24
  import "../../../gamification/question/list/index.js";
24
25
  import "../../../gamification/question/index.js";
25
26
  import "@streamlayer/sdk-web-types";
@@ -27,7 +28,6 @@ import "../../../button/index.js";
27
28
  import "../../../button/styles.js";
28
29
  import "../../../gamification/constants.js";
29
30
  import "../../../gamification/question/styles.js";
30
- import "../../../icons/index.js";
31
31
  import "../../../gamification/question/list/styles.js";
32
32
  import "../../../gamification/user-statistics/index.js";
33
33
  import "../../../gamification/user-statistics/components/rank/index.js";
@@ -14,7 +14,8 @@ import "react-window-infinite-loader";
14
14
  import "../../gamification/leaderboard-item/index.js";
15
15
  import "../../../utils/common.js";
16
16
  import "../../gamification/leaderboard-item/styles.js";
17
- const C = ({ store: p }) => {
17
+ import "../../icons/index.js";
18
+ const E = ({ store: p }) => {
18
19
  const { data: r } = u(p), [e, s] = b(void 0);
19
20
  if (!r)
20
21
  return /* @__PURE__ */ i("div", { children: "wait leader board..." });
@@ -38,5 +39,5 @@ const C = ({ store: p }) => {
38
39
  ] });
39
40
  };
40
41
  export {
41
- C as Leaderboard
42
+ E as Leaderboard
42
43
  };
@@ -2,6 +2,7 @@
2
2
  import type { LeaderboardItem as ILeaderboardItem } from '@streamlayer/sdk-web-types';
3
3
  export type LeaderboardItemProps = Partial<ILeaderboardItem> & {
4
4
  userId: string;
5
+ isCurrentUser: boolean;
5
6
  openItemDetail: () => void;
6
7
  style?: React.CSSProperties;
7
8
  };
@@ -1,25 +1,28 @@
1
1
  import { jsxs as e, jsx as r } from "react/jsx-runtime";
2
- import { abbreviate as l } from "../../../utils/common.js";
3
- import { Container as c, RankPosition as m, Avatar as h, AvatarPlaceholder as s, Content as p, NameWrap as b, Name as f, Rank as k, Units as v } from "./styles.js";
2
+ import { abbreviate as c, formatDecimals as l } from "../../../utils/common.js";
3
+ import { Container as s, Position as h, Content as p, Avatar as C, AvatarPlaceholder as b, NameContainer as f, Name as v, CurrentUserBadge as x } from "./styles.js";
4
4
  import "@linaria/react";
5
- const A = ({
6
- rank: t,
5
+ import "../../icons/index.js";
6
+ import "react";
7
+ const k = ({
8
+ rank: o,
7
9
  avatar: i,
8
- name: n,
10
+ name: t,
9
11
  points: a,
10
- openItemDetail: o,
12
+ isCurrentUser: n,
13
+ openItemDetail: m,
11
14
  style: d
12
- }) => /* @__PURE__ */ e(c, { onClick: o, style: d, children: [
13
- /* @__PURE__ */ r(m, { children: t || 0 }),
14
- i ? /* @__PURE__ */ r(h, { alt: "leaderboard-item-avatar", src: i }) : /* @__PURE__ */ r(s, { children: l(n || "") }),
15
+ }) => /* @__PURE__ */ e(s, { onClick: m, style: d, children: [
16
+ /* @__PURE__ */ r(h, { children: o || 0 }),
15
17
  /* @__PURE__ */ e(p, { children: [
16
- /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(f, { children: n || "" }) }),
17
- /* @__PURE__ */ e(k, { children: [
18
- /* @__PURE__ */ r(v, { children: "PTS" }),
19
- a || 0
18
+ i ? /* @__PURE__ */ r(C, { alt: "leaderboard-item-avatar", src: i }) : /* @__PURE__ */ r(b, { children: c(t || "") }),
19
+ /* @__PURE__ */ e(f, { children: [
20
+ /* @__PURE__ */ r(v, { children: t || "" }),
21
+ n && /* @__PURE__ */ r(x, { name: "icon-star" })
20
22
  ] })
21
- ] })
23
+ ] }),
24
+ /* @__PURE__ */ r("div", { children: l(a) })
22
25
  ] });
23
26
  export {
24
- A as LeaderboardItem
27
+ k as LeaderboardItem
25
28
  };
@@ -1,10 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  export declare const Container: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
3
- export declare const RankPosition: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
3
+ export declare const Position: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
4
4
  export declare const Avatar: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLImageElement> & import("react").ImgHTMLAttributes<HTMLImageElement> & Record<never, unknown>>;
5
5
  export declare const AvatarPlaceholder: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
6
6
  export declare const Content: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
7
- export declare const NameWrap: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
7
+ export declare const NameContainer: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
8
8
  export declare const Name: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
9
- export declare const Rank: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
10
- export declare const Units: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
9
+ export declare const CurrentUserBadge: any;
@@ -1,78 +1,69 @@
1
- import { styled as e } from "@linaria/react";
2
- const t = e.div`
3
- box-sizing: border-box;
1
+ import { styled as r } from "@linaria/react";
2
+ import { SvgIcon as e } from "../../icons/index.js";
3
+ import "react/jsx-runtime";
4
+ import "react";
5
+ const a = r.div`
4
6
  display: flex;
5
- padding: 8px;
6
7
  align-items: center;
8
+ column-gap: 4px;
9
+ padding: 8px 16px 8px 8px;
10
+ color: var(--color-neutrals-gray9);
11
+ font-size: 12px;
12
+ font-weight: var(--font-weight-default);
13
+ line-height: 16px;
14
+ border: 1px solid var(--color-neutrals-gray3);
7
15
  border-radius: 8px;
8
- width: 100%;
9
- min-height: 50px;
10
- max-height: 50px;
11
- background-color: #fff;
12
- color: #000;
13
- font-size: 14px;
14
- font-weight: 600;
15
- overflow: hidden;
16
+ background-color: var(--color-neutrals-white);
16
17
  cursor: pointer;
17
- `, n = e.div`
18
- width: 28px;
19
- max-width: 28px;
18
+
19
+ &:hover {
20
+ color: var(--color-primary-green1);
21
+ border-color: var(--color-neutrals-gray5);
22
+ }
23
+ `, l = r.div`
24
+ min-width: 28px;
25
+ text-align: center;
26
+ `, p = r.img`
27
+ width: 32px;
28
+ height: 32px;
29
+ border-radius: 50%;
30
+ `, s = r.div`
20
31
  display: flex;
32
+ flex-shrink: 0;
21
33
  align-items: center;
22
34
  justify-content: center;
23
- margin-right: 4px;
24
- overflow: hidden;
25
- `, r = e.img`
26
35
  width: 32px;
27
36
  height: 32px;
37
+ color: var(--color-neutrals-gray9);
38
+ font-size: 12px;
28
39
  border-radius: 50%;
29
- `, o = e.div`
30
40
  background: var(--color-grey-primary-onboarding-inapp);
31
- border-radius: 50%;
32
- width: 32px;
33
- height: 32px;
34
41
  text-align: center;
35
42
  text-transform: uppercase;
43
+ `, c = r.div`
36
44
  display: flex;
45
+ flex-grow: 1;
37
46
  align-items: center;
38
- justify-content: center;
39
- font-size: 12px;
40
- flex-shrink: 0;
41
- `, a = e.div`
42
- flex: 1;
43
- display: flex;
44
- justify-content: space-between;
47
+ column-gap: 8px;
48
+ `, d = r.div`
49
+ display: grid;
45
50
  align-items: center;
46
- padding: 4px 4px 4px 0px;
47
- margin-right: 4px;
48
- margin-left: 8px;
49
- overflow: hidden;
50
- `, p = e.div`
51
- display: flex;
52
- align-items: center;
53
- flex: 1;
54
- overflow: hidden;
55
- `, d = e.span`
56
- overflow: hidden;
57
- white-space: nowrap;
51
+ column-gap: 4px;
52
+ grid-template-columns: 1fr auto;
53
+ `, g = r.span`
58
54
  text-overflow: ellipsis;
59
- margin-right: 4px;
60
- `, s = e.div`
61
- display: flex;
62
- align-items: center;
63
- max-width: 75px;
64
- `, x = e.span`
65
- font-size: 10px;
66
- margin-right: 4px;
55
+ white-space: nowrap;
56
+ overflow: hidden;
57
+ `, x = r(e)`
58
+ flex-shrink: 0;
67
59
  `;
68
60
  export {
69
- r as Avatar,
70
- o as AvatarPlaceholder,
71
- t as Container,
72
- a as Content,
73
- d as Name,
74
- p as NameWrap,
75
- s as Rank,
76
- n as RankPosition,
77
- x as Units
61
+ p as Avatar,
62
+ s as AvatarPlaceholder,
63
+ a as Container,
64
+ c as Content,
65
+ x as CurrentUserBadge,
66
+ g as Name,
67
+ d as NameContainer,
68
+ l as Position
78
69
  };
@@ -1,4 +1,4 @@
1
- import { jsx as e } from "react/jsx-runtime";
1
+ import { jsx as o } from "react/jsx-runtime";
2
2
  import l from "react-virtualized-auto-sizer";
3
3
  import { FixedSizeList as u } from "react-window";
4
4
  import I from "react-window-infinite-loader";
@@ -6,34 +6,36 @@ import { LeaderboardItem as f } from "../leaderboard-item/index.js";
6
6
  import "../../../utils/common.js";
7
7
  import "../leaderboard-item/styles.js";
8
8
  import "@linaria/react";
9
- const C = ({ items: r, openItemDetail: i, fetchMore: m }) => /* @__PURE__ */ e(l, { children: ({ width: d, height: n }) => /* @__PURE__ */ e(
9
+ import "../../icons/index.js";
10
+ import "react";
11
+ const x = ({ items: r, openItemDetail: i, fetchMore: m }) => /* @__PURE__ */ o(l, { children: ({ width: d, height: n }) => /* @__PURE__ */ o(
10
12
  I,
11
13
  {
12
- isItemLoaded: (o) => o < r.length,
14
+ isItemLoaded: (t) => t < r.length,
13
15
  itemCount: r.length + 1,
14
16
  loadMoreItems: m,
15
- children: ({ onItemsRendered: o, ref: p }) => /* @__PURE__ */ e(
17
+ children: ({ onItemsRendered: t, ref: p }) => /* @__PURE__ */ o(
16
18
  u,
17
19
  {
18
20
  itemSize: 58,
19
- onItemsRendered: o,
21
+ onItemsRendered: t,
20
22
  ref: p,
21
23
  itemCount: r.length,
22
24
  width: d,
23
25
  height: n,
24
- children: ({ index: t, style: a }) => /* @__PURE__ */ e(
26
+ children: ({ index: e, style: a }) => /* @__PURE__ */ o(
25
27
  f,
26
28
  {
27
29
  style: a,
28
- ...r[t],
29
- openItemDetail: () => i(r[t].userId)
30
+ ...r[e],
31
+ openItemDetail: () => i(r[e].userId)
30
32
  },
31
- r[t].userId
33
+ r[e].userId
32
34
  )
33
35
  }
34
36
  )
35
37
  }
36
38
  ) });
37
39
  export {
38
- C as LeaderboardList
40
+ x as LeaderboardList
39
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamlayer/react-ui",
3
- "version": "0.50.0",
3
+ "version": "0.51.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./lib/index.d.ts",
@@ -31,8 +31,8 @@
31
31
  "react-window": "^1.8.9",
32
32
  "react-window-infinite-loader": "^1.0.9",
33
33
  "@streamlayer/feature-gamification": "^0.19.2",
34
- "@streamlayer/sdk-web-anonymous-auth": "^0.11.4",
35
34
  "@streamlayer/sdk-web": "^0.28.9",
35
+ "@streamlayer/sdk-web-anonymous-auth": "^0.11.4",
36
36
  "@streamlayer/sdk-web-api": "^0.1.0",
37
37
  "@streamlayer/sdk-web-core": "^0.17.0",
38
38
  "@streamlayer/sdk-web-features": "^0.10.12",
@@ -78,6 +78,6 @@
78
78
  "vite-plugin-svgr": "^4.1.0",
79
79
  "vite-svg-loader": "^4.0.0",
80
80
  "vite-tsconfig-paths": "^4.2.1",
81
- "@streamlayer/react": "^0.25.0"
81
+ "@streamlayer/react": "^0.25.1"
82
82
  }
83
83
  }