@streamlayer/react-ui 0.40.0 → 0.42.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.
Files changed (35) hide show
  1. package/lib/index.d.ts +1 -1
  2. package/lib/index.js +4 -4
  3. package/lib/ui/app/Features/Gamification/Question.js +43 -71
  4. package/lib/ui/app/Features/Gamification/QuestionsList.js +5 -4
  5. package/lib/ui/app/Features/Gamification/Tabs.js +10 -9
  6. package/lib/ui/app/Features/Gamification/index.js +29 -28
  7. package/lib/ui/app/Features/index.js +12 -17
  8. package/lib/ui/app/masters.js +40 -32
  9. package/lib/ui/demo/Gamification.js +3 -3
  10. package/lib/ui/demo/Highlights.js +2 -2
  11. package/lib/ui/demo/components/Question.js +13 -14
  12. package/lib/ui/demo/components/QuestionsList.js +5 -4
  13. package/lib/ui/demo/components/index.js +3 -3
  14. package/lib/ui/demo/index.js +4 -4
  15. package/lib/ui/gamification/constants.d.ts +6 -0
  16. package/lib/ui/gamification/constants.js +13 -0
  17. package/lib/ui/gamification/question/index.js +28 -35
  18. package/lib/ui/gamification/{question-list → question/list}/index.js +8 -7
  19. package/lib/ui/gamification/vote/vote-header/index.d.ts +8 -0
  20. package/lib/ui/gamification/vote/vote-header/index.js +20 -0
  21. package/lib/ui/gamification/vote/vote-header/styles.d.ts +7 -0
  22. package/lib/ui/gamification/vote/vote-header/styles.js +59 -0
  23. package/lib/ui/icons/index.d.ts +0 -1
  24. package/lib/ui/icons/index.js +32 -33
  25. package/lib/ui/show-in/index.d.ts +6 -0
  26. package/lib/ui/show-in/index.js +36 -0
  27. package/lib/ui/theme/constants.js +4 -4
  28. package/lib/utils/decorators/container.js +5 -7
  29. package/package.json +7 -7
  30. package/lib/fedex-a8dcc7b2.js +0 -4
  31. package/lib/ui/theme/Typography.d.ts +0 -2
  32. package/lib/ui/theme/Typography.js +0 -53
  33. /package/lib/ui/gamification/{question-list → question/list}/index.d.ts +0 -0
  34. /package/lib/ui/gamification/{question-list → question/list}/styles.d.ts +0 -0
  35. /package/lib/ui/gamification/{question-list → question/list}/styles.js +0 -0
@@ -1,9 +1,8 @@
1
1
  import { jsx as o, jsxs as n } from "react/jsx-runtime";
2
2
  import { styled as y } from "@linaria/react";
3
- import { useState as d, useCallback as x, useMemo as c } from "react";
3
+ import { useState as d, useCallback as x, useMemo as s } from "react";
4
4
  import { Vote as g } from "../../gamification/vote/index.js";
5
5
  import { VotingHeader as h } from "../../gamification/vote/components/voting-header/index.js";
6
- import { i as b } from "../../../fedex-a8dcc7b2.js";
7
6
  import "@streamlayer/sdk-web-types";
8
7
  import "../../../index-7045fbb2.js";
9
8
  import "../../gamification/vote/components/voting-option/styles.js";
@@ -16,7 +15,7 @@ import "react-countdown-circle-timer";
16
15
  import "../../theme/constants.js";
17
16
  import "../../gamification/vote/components/voting-header/components/timer/styles.js";
18
17
  import "../../gamification/vote/components/voting-header/styles.js";
19
- const k = y.div`
18
+ const b = y.div`
20
19
  position: absolute;
21
20
  top: 0;
22
21
  background: var(--color-transparent-item);
@@ -43,28 +42,28 @@ const k = y.div`
43
42
  transform: translateX(0);
44
43
  }
45
44
  }
46
- `, F = ({ openedQuestion: t, closeQuestion: a, vote: e }) => {
47
- var s;
48
- const [l, m] = d(!1), p = x(
45
+ `, B = ({ openedQuestion: t, closeQuestion: a, vote: e }) => {
46
+ var m;
47
+ const [l, c] = d(!1), p = x(
49
48
  (i) => {
50
- m(i);
49
+ c(i);
51
50
  },
52
- [m]
53
- ), r = c(
51
+ [c]
52
+ ), r = s(
54
53
  () => t == null ? void 0 : t.answers.find((i) => i.youVoted === !0),
55
54
  [t]
56
- ), f = c(
55
+ ), f = s(
57
56
  () => !!(t != null && t.answers.find((i) => i.correct === !0)),
58
57
  [t]
59
58
  );
60
- return t ? /* @__PURE__ */ o(k, { children: /* @__PURE__ */ n("div", { children: [
59
+ return t ? /* @__PURE__ */ o(b, { children: /* @__PURE__ */ n("div", { children: [
61
60
  /* @__PURE__ */ o(
62
61
  h,
63
62
  {
64
63
  points: (r == null ? void 0 : r.points) || 0,
65
64
  questionAnswered: !!r,
66
65
  questionAnsweredCorrectly: r == null ? void 0 : r.correct,
67
- logo: b,
66
+ logo: "",
68
67
  closeQuestion: a,
69
68
  setTimeToExpire: p,
70
69
  questionType: t.type
@@ -74,7 +73,7 @@ const k = y.div`
74
73
  g,
75
74
  {
76
75
  title: t.subject,
77
- feedbackMessages: (s = t.options) == null ? void 0 : s.options.value,
76
+ feedbackMessages: (m = t.options) == null ? void 0 : m.options.value,
78
77
  questionType: t.type,
79
78
  questionId: t.id,
80
79
  questionAnswered: !!r,
@@ -98,5 +97,5 @@ const k = y.div`
98
97
  ] }) }) : null;
99
98
  };
100
99
  export {
101
- F as Question
100
+ B as Question
102
101
  };
@@ -1,19 +1,20 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import { useStore as m } from "@nanostores/react";
3
- import { QuestionList as p } from "../../gamification/question-list/index.js";
3
+ import { QuestionList as p } from "../../gamification/question/list/index.js";
4
4
  import "../../gamification/question/index.js";
5
5
  import "@streamlayer/sdk-web-types";
6
6
  import "../../button/index.js";
7
7
  import "../../button/styles.js";
8
8
  import "@linaria/react";
9
+ import "../../gamification/constants.js";
9
10
  import "../../gamification/question/styles.js";
10
11
  import "../../icons/index.js";
11
12
  import "react";
12
- import "../../gamification/question-list/styles.js";
13
- const j = ({ store: r, openQuestion: i }) => {
13
+ import "../../gamification/question/list/styles.js";
14
+ const l = ({ store: r, openQuestion: i }) => {
14
15
  const t = m(r);
15
16
  return t != null && t.data ? /* @__PURE__ */ o(p, { openQuestion: i, questions: t.data }) : /* @__PURE__ */ o("div", { children: "wait questions..." });
16
17
  };
17
18
  export {
18
- j as QuestionsList
19
+ l as QuestionsList
19
20
  };
@@ -15,15 +15,16 @@ import "@linaria/react";
15
15
  import "../../gamification/user-statistics/components/statistic/index.js";
16
16
  import "../../gamification/user-statistics/components/statistic/styles.js";
17
17
  import "../../gamification/user-statistics/styles.js";
18
- import "../../gamification/question-list/index.js";
18
+ import "../../gamification/question/list/index.js";
19
19
  import "../../gamification/question/index.js";
20
20
  import "@streamlayer/sdk-web-types";
21
21
  import "../../button/index.js";
22
22
  import "../../button/styles.js";
23
+ import "../../gamification/constants.js";
23
24
  import "../../gamification/question/styles.js";
24
25
  import "../../icons/index.js";
25
26
  import "react";
26
- import "../../gamification/question-list/styles.js";
27
+ import "../../gamification/question/list/styles.js";
27
28
  import "../../gamification/vote/index.js";
28
29
  import "../../../index-7045fbb2.js";
29
30
  import "../../gamification/vote/components/voting-option/styles.js";
@@ -37,7 +38,6 @@ import "react-countdown-circle-timer";
37
38
  import "../../theme/constants.js";
38
39
  import "../../gamification/vote/components/voting-header/components/timer/styles.js";
39
40
  import "../../gamification/vote/components/voting-header/styles.js";
40
- import "../../../fedex-a8dcc7b2.js";
41
41
  import "../../gamification/onboarding/components/onboarding-slides/onboarding-instructions/index.js";
42
42
  import "../../gamification/onboarding/components/onboarding-slides/onboarding-instructions/styles.js";
43
43
  import "../../gamification/onboarding/components/onboarding-slides/onboarding-invite-card/index.js";
@@ -3,8 +3,8 @@ import { FeatureStatus as l } from "@streamlayer/sdk-web-interfaces";
3
3
  import { FeatureType as g } from "@streamlayer/sdk-web-types";
4
4
  import { AvailableFeatures as S } from "@streamlayer/sdk-web-features";
5
5
  import { useState as b, useMemo as h, useEffect as C } from "react";
6
- import "@streamlayer/sdk-web-storage";
7
6
  import "@streamlayer/sdk-web-api";
7
+ import "@streamlayer/sdk-web-storage";
8
8
  import { useStore as c } from "@nanostores/react";
9
9
  import { Notifications as F } from "../notifications/index.js";
10
10
  import { GamificationComponent as w } from "./Gamification.js";
@@ -32,13 +32,14 @@ import "../gamification/user-statistics/components/statistic/index.js";
32
32
  import "../gamification/user-statistics/components/statistic/styles.js";
33
33
  import "../gamification/user-statistics/styles.js";
34
34
  import "./components/QuestionsList.js";
35
- import "../gamification/question-list/index.js";
35
+ import "../gamification/question/list/index.js";
36
36
  import "../gamification/question/index.js";
37
37
  import "../button/index.js";
38
38
  import "../button/styles.js";
39
+ import "../gamification/constants.js";
39
40
  import "../gamification/question/styles.js";
40
41
  import "../icons/index.js";
41
- import "../gamification/question-list/styles.js";
42
+ import "../gamification/question/list/styles.js";
42
43
  import "./components/Question.js";
43
44
  import "../gamification/vote/index.js";
44
45
  import "../../index-7045fbb2.js";
@@ -52,7 +53,6 @@ import "react-countdown-circle-timer";
52
53
  import "../theme/constants.js";
53
54
  import "../gamification/vote/components/voting-header/components/timer/styles.js";
54
55
  import "../gamification/vote/components/voting-header/styles.js";
55
- import "../../fedex-a8dcc7b2.js";
56
56
  import "../gamification/onboarding/index.js";
57
57
  import "../gamification/onboarding/components/onboarding-slides/onboarding-instructions/index.js";
58
58
  import "../gamification/onboarding/components/onboarding-slides/onboarding-instructions/styles.js";
@@ -0,0 +1,6 @@
1
+ import { QuestionType } from '@streamlayer/sdk-web-types';
2
+ import { icons } from '../icons';
3
+ export declare const QuestionTypeData: Record<QuestionType, {
4
+ label: string;
5
+ iconName: keyof typeof icons;
6
+ } | undefined>;
@@ -0,0 +1,13 @@
1
+ import { QuestionType as i } from "@streamlayer/sdk-web-types";
2
+ const o = {
3
+ [i.TWEET]: { label: "Insight", iconName: "icon-insight" },
4
+ [i.PROMOTION]: { label: "Insight", iconName: "icon-insight" },
5
+ [i.UNSET]: void 0,
6
+ [i.FACTOID]: { label: "Insight", iconName: "icon-insight" },
7
+ [i.POLL]: { label: "Poll", iconName: "icon-poll" },
8
+ [i.TRIVIA]: { label: "Trivia", iconName: "icon-trivia" },
9
+ [i.PREDICTION]: { label: "Prediction", iconName: "icon-prediction" }
10
+ };
11
+ export {
12
+ o as QuestionTypeData
13
+ };
@@ -1,48 +1,41 @@
1
- import { jsx as n, jsxs as t } from "react/jsx-runtime";
2
- import { QuestionType as i, PickHistoryStatus as c, QuestionStatus as p } from "@streamlayer/sdk-web-types";
3
- import { Button as O } from "../../button/index.js";
4
- import { QuestionTypeIcon as o, QuestionActionIcon as r, QuestionItem as Q, QuestionContent as b, QuestionCaption as E, QuestionTypeLabel as P, QuestionBody as A, QuestionAction as g } from "./styles.js";
1
+ import { jsx as o, jsxs as t } from "react/jsx-runtime";
2
+ import { PickHistoryStatus as n, QuestionType as d, QuestionStatus as Q } from "@streamlayer/sdk-web-types";
3
+ import { Button as h } from "../../button/index.js";
4
+ import { QuestionTypeData as y } from "../constants.js";
5
+ import { QuestionActionIcon as r, QuestionItem as I, QuestionContent as T, QuestionCaption as f, QuestionTypeIcon as A, QuestionTypeLabel as S, QuestionBody as x, QuestionAction as D } from "./styles.js";
5
6
  import "../../button/styles.js";
6
7
  import "@linaria/react";
7
8
  import "../../icons/index.js";
8
9
  import "react";
9
- const y = {
10
- [i.TWEET]: { label: "Insight", Icon: () => /* @__PURE__ */ n(o, { name: "icon-insight" }) },
11
- [i.PROMOTION]: { label: "Insight", Icon: () => /* @__PURE__ */ n(o, { name: "icon-insight" }) },
12
- [i.UNSET]: void 0,
13
- [i.FACTOID]: { label: "Insight", Icon: () => /* @__PURE__ */ n(o, { name: "icon-insight" }) },
14
- [i.POLL]: { label: "Poll", Icon: () => /* @__PURE__ */ n(o, { name: "icon-poll" }) },
15
- [i.TRIVIA]: { label: "Trivia", Icon: () => /* @__PURE__ */ n(o, { name: "icon-trivia" }) },
16
- [i.PREDICTION]: { label: "Prediction", Icon: () => /* @__PURE__ */ n(o, { name: "icon-prediction" }) }
17
- }, N = {
18
- [c.LOST]: /* @__PURE__ */ n(r, { name: "icon-cross" }),
19
- [c.WON]: /* @__PURE__ */ n(r, { name: "icon-check" }),
20
- [c.UNSET]: void 0,
21
- [c.DNP]: /* @__PURE__ */ n(r, { name: "icon-arrow" })
22
- }, k = ({
23
- questionId: I,
24
- questionType: l,
10
+ const E = {
11
+ [n.LOST]: /* @__PURE__ */ o(r, { name: "icon-cross" }),
12
+ [n.WON]: /* @__PURE__ */ o(r, { name: "icon-check" }),
13
+ [n.UNSET]: void 0,
14
+ [n.DNP]: /* @__PURE__ */ o(r, { name: "icon-arrow" })
15
+ }, R = ({
16
+ questionId: s,
17
+ questionType: c,
25
18
  questionStatus: m,
26
19
  subject: u,
27
- openForVoting: h,
28
- openQuestion: e,
29
- status: T
20
+ openForVoting: a,
21
+ openQuestion: i,
22
+ status: l
30
23
  }) => {
31
- const { Icon: s, label: a } = y[l] || {}, d = N[T];
32
- return !a || !s ? null : /* @__PURE__ */ t(Q, { onClick: () => e == null ? void 0 : e(I), children: [
33
- /* @__PURE__ */ t(b, { children: [
34
- /* @__PURE__ */ t(E, { children: [
35
- /* @__PURE__ */ n(s, {}),
36
- /* @__PURE__ */ t(P, { children: [
37
- a,
38
- l === i.TRIVIA && m === p.RESOLVED && " • Expired"
24
+ const e = y[c], p = E[l];
25
+ return e ? /* @__PURE__ */ t(I, { onClick: () => i == null ? void 0 : i(s), children: [
26
+ /* @__PURE__ */ t(T, { children: [
27
+ /* @__PURE__ */ t(f, { children: [
28
+ /* @__PURE__ */ o(A, { name: e.iconName }),
29
+ /* @__PURE__ */ t(S, { children: [
30
+ e.label,
31
+ c === d.TRIVIA && m === Q.RESOLVED && " • Expired"
39
32
  ] })
40
33
  ] }),
41
- /* @__PURE__ */ n(A, { children: u || "" })
34
+ /* @__PURE__ */ o(x, { children: u || "" })
42
35
  ] }),
43
- /* @__PURE__ */ n(g, { children: d || (h ? /* @__PURE__ */ n(O, { children: "Play" }) : null) })
44
- ] });
36
+ /* @__PURE__ */ o(D, { children: p || (a ? /* @__PURE__ */ o(h, { children: "Play" }) : null) })
37
+ ] }) : null;
45
38
  };
46
39
  export {
47
- k as Question
40
+ R as Question
48
41
  };
@@ -1,14 +1,15 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import { Question as i } from "../question/index.js";
2
+ import { Question as i } from "../index.js";
3
3
  import { QuestionsContainer as p } from "./styles.js";
4
4
  import "@streamlayer/sdk-web-types";
5
- import "../../button/index.js";
6
- import "../../button/styles.js";
5
+ import "../../../button/index.js";
6
+ import "../../../button/styles.js";
7
7
  import "@linaria/react";
8
- import "../question/styles.js";
9
- import "../../icons/index.js";
8
+ import "../../constants.js";
9
+ import "../styles.js";
10
+ import "../../../icons/index.js";
10
11
  import "react";
11
- const l = ({ questions: r, openQuestion: m }) => /* @__PURE__ */ t(p, { children: r == null ? void 0 : r.map((o) => /* @__PURE__ */ t(i, { openQuestion: m, ...o }, o.questionId)) });
12
+ const u = ({ questions: r, openQuestion: m }) => /* @__PURE__ */ t(p, { children: r == null ? void 0 : r.map((o) => /* @__PURE__ */ t(i, { openQuestion: m, ...o }, o.questionId)) });
12
13
  export {
13
- l as QuestionList
14
+ u as QuestionList
14
15
  };
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { QuestionType } from '@streamlayer/sdk-web-types';
3
+ interface VoteHeaderProps {
4
+ type: QuestionType;
5
+ close: () => void;
6
+ }
7
+ export declare const VoteHeader: React.FC<VoteHeaderProps>;
8
+ export {};
@@ -0,0 +1,20 @@
1
+ import { jsxs as n, jsx as o } from "react/jsx-runtime";
2
+ import { QuestionTypeData as i } from "../../constants.js";
3
+ import { Container as p, QuestionTypeWrap as s, QuestionTypeIcon as m, QuestionTypeTitle as c, CloseButton as l, CloseIcon as a } from "./styles.js";
4
+ import "@streamlayer/sdk-web-types";
5
+ import "@linaria/react";
6
+ import "../../../icons/index.js";
7
+ import "react";
8
+ const Q = ({ type: t, close: r }) => {
9
+ const e = i[t];
10
+ return e ? /* @__PURE__ */ n(p, { children: [
11
+ /* @__PURE__ */ n(s, { children: [
12
+ /* @__PURE__ */ o(m, { name: e.iconName }),
13
+ /* @__PURE__ */ o(c, { children: e.label })
14
+ ] }),
15
+ /* @__PURE__ */ o(l, { onClick: r, children: /* @__PURE__ */ o(a, { name: "icon-cross" }) })
16
+ ] }) : null;
17
+ };
18
+ export {
19
+ Q as VoteHeader
20
+ };
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare const Container: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
3
+ export declare const QuestionTypeWrap: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
4
+ export declare const QuestionTypeIcon: any;
5
+ export declare const QuestionTypeTitle: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
6
+ export declare const CloseButton: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Record<never, unknown>>;
7
+ export declare const CloseIcon: any;
@@ -0,0 +1,59 @@
1
+ import { styled as o } from "@linaria/react";
2
+ import { SvgIcon as t } from "../../../icons/index.js";
3
+ import "react/jsx-runtime";
4
+ import "react";
5
+ const a = o.div`
6
+ font-weight: var(--font-weight-default);
7
+ color: var(--color-neutrals-gray7);
8
+ border-bottom: 1px solid var(--color-neutrals-gray3);
9
+ background: var(--color-neutrals-white);
10
+ box-sizing: border-box;
11
+ width: 100%;
12
+ font-size: 12px;
13
+ display: flex;
14
+ justify-content: space-between;
15
+ align-items: center;
16
+ padding: 12px 12px 12px 16px;
17
+ `, l = o.div`
18
+ display: flex;
19
+ align-items: center;
20
+ `, p = o(t)`
21
+ width: 16px;
22
+ height: 16px;
23
+
24
+ path {
25
+ fill: var(--color-primary-green1);
26
+ fill-opacity: 1;
27
+ }
28
+ `, s = o.span`
29
+ font-family: var(--font-regular);
30
+ margin-left: 8px;
31
+ `, c = o.button`
32
+ width: 24px;
33
+ height: 24px;
34
+ border: none;
35
+ outline: none;
36
+ background-color: transparent;
37
+ display: flex;
38
+ justify-content: center;
39
+ align-items: center;
40
+ cursor: pointer;
41
+ `, g = o(t)`
42
+ path {
43
+ stroke: var(--color-neutrals-gray7);
44
+ }
45
+
46
+ &:hover {
47
+ path {
48
+ stroke: var(--color-primary-green2);
49
+ }
50
+ }
51
+ `;
52
+ export {
53
+ c as CloseButton,
54
+ g as CloseIcon,
55
+ a as Container,
56
+ p as QuestionTypeIcon,
57
+ s as QuestionTypeTitle,
58
+ l as QuestionTypeWrap
59
+ };
@@ -31,7 +31,6 @@ export declare const icons: {
31
31
  'icon-btn-leaderboard': any;
32
32
  'icon-check': any;
33
33
  'icon-arrow': any;
34
- fedex: any;
35
34
  };
36
35
  export declare const Icon: React.FC<{
37
36
  name: keyof typeof icons;