@streamlayer/react-ui 0.69.3 → 0.70.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.
@@ -1,15 +1,15 @@
1
- import { jsx as r, jsxs as l } from "react/jsx-runtime";
2
- import { QuestionImages as a, QuestionStatus as h, QuestionType as c } from "@streamlayer/sdk-web-types";
1
+ import { jsx as r, jsxs as u } from "react/jsx-runtime";
2
+ import { QuestionImages as a, QuestionStatus as N, QuestionType as c } from "@streamlayer/sdk-web-types";
3
3
  import { AnimatedCounter as T } from "../../../animated-counter/index.js";
4
- import { IconDefault as O, IconContainer as P, IconWrap as A, IconCircle as x, ButtonContainer as L, ButtonPct as B, ButtonBody as k, Title as Q, Indicators as b, CheckIcon as j, Percentage as U } from "./styles.js";
4
+ import { IconDefault as O, IconContainer as P, IconWrap as A, IconCircle as k, ButtonContainer as x, ButtonPct as L, ButtonBody as B, Title as Q, Indicators as b, CheckIcon as j, Percentage as U } from "./styles.js";
5
5
  import "react-countup";
6
6
  import "@linaria/react";
7
7
  import "../../../icons/index.js";
8
8
  import "react";
9
- const u = {
9
+ const d = {
10
10
  [a.CENTERED]: (t) => /* @__PURE__ */ r(O, { alt: "option-icon", src: t }),
11
11
  [a.TRANSPARENT]: (t) => /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(A, { style: { backgroundImage: `url(${t})` } }) }),
12
- [a.ROUNDED]: (t) => /* @__PURE__ */ r(x, { alt: "option-icon", src: t }),
12
+ [a.ROUNDED]: (t) => /* @__PURE__ */ r(k, { alt: "option-icon", src: t }),
13
13
  [a.NONE]: () => null,
14
14
  [a.UNSET]: () => null
15
15
  }, V = ({ questionType: t, hasCorrectAnswer: o, correct: e, youVoted: n, questionVoted: i }) => {
@@ -17,19 +17,19 @@ const u = {
17
17
  return "correct";
18
18
  if (t === c.PREDICTION) {
19
19
  if (o && i)
20
- return n ? e ? "correct" : "incorrect" : e ? "correct" : "unset";
20
+ return n ? e ? "correct" : "incorrect" : "unset";
21
21
  if (n)
22
22
  return "correct";
23
23
  }
24
- return t === c.TRIVIA && i ? n ? e ? "correct" : "incorrect" : e ? "correct" : "unset" : "unset";
24
+ return t === c.TRIVIA && i && n ? e ? "correct" : "incorrect" : "unset";
25
25
  }, $ = ({
26
26
  questionType: t,
27
27
  questionVoted: o,
28
28
  correct: e,
29
29
  hasCorrectAnswer: n,
30
30
  questionStatus: i
31
- }) => t === c.TRIVIA ? o && e : t === c.PREDICTION ? o && e && n || i === h.RESOLVED && e : !1, J = (t) => {
32
- var S;
31
+ }) => t === c.TRIVIA ? o && e : t === c.PREDICTION ? o && e && n || i === N.RESOLVED && e : !1, K = (t) => {
32
+ var E;
33
33
  const {
34
34
  // option props
35
35
  id: o,
@@ -37,33 +37,34 @@ const u = {
37
37
  text: n,
38
38
  percentageDecimal: i,
39
39
  // extra props
40
- onVote: p,
41
- youSelected: C,
40
+ onVote: S,
41
+ youSelected: f,
42
42
  questionVoted: s,
43
43
  // ToDo: Figure out why imageMode is not in the response, and delete default value
44
- imageMode: d,
45
- answerTimeExpired: R,
46
- questionStatus: f,
47
- isLoading: g,
48
- questionType: m,
49
- correct: w,
50
- hasCorrectAnswer: D
51
- } = t, I = V(t), N = $({ questionType: m, questionVoted: s, correct: w, hasCorrectAnswer: D, questionStatus: f }), E = s || f === h.RESOLVED && m === c.PREDICTION;
52
- return /* @__PURE__ */ l(
53
- L,
44
+ imageMode: m,
45
+ answerTimeExpired: p,
46
+ questionStatus: I,
47
+ isLoading: R,
48
+ questionType: h,
49
+ correct: g,
50
+ hasCorrectAnswer: w
51
+ } = t, l = V(t), D = $({ questionType: h, questionVoted: s, correct: g, hasCorrectAnswer: w, questionStatus: I }), C = s || I === N.RESOLVED && h === c.PREDICTION;
52
+ return /* @__PURE__ */ u(
53
+ x,
54
54
  {
55
55
  value: o,
56
- "data-selected": C,
57
- "data-answerState": I,
58
- disabled: s || g || R,
59
- onClick: p,
56
+ "data-selected": f,
57
+ "data-answerState": l,
58
+ disabled: s || R || p,
59
+ "data-isNotChecked": s && !f && l !== "incorrect",
60
+ onClick: S,
60
61
  children: [
61
- E && /* @__PURE__ */ r(B, { "data-answerState": I, style: { width: `${i}%` } }),
62
- /* @__PURE__ */ l(k, { children: [
63
- e && d && ((S = u[d]) == null ? void 0 : S.call(u, e)),
62
+ /* @__PURE__ */ r(L, { "data-answerState": l, style: { width: `${C ? i : 0}%` } }),
63
+ /* @__PURE__ */ u(B, { children: [
64
+ e && m && ((E = d[m]) == null ? void 0 : E.call(d, e)),
64
65
  /* @__PURE__ */ r(Q, { children: n }),
65
- E && /* @__PURE__ */ l(b, { children: [
66
- N && /* @__PURE__ */ r(j, { name: "selected" }),
66
+ C && /* @__PURE__ */ u(b, { children: [
67
+ D && /* @__PURE__ */ r(j, { name: "selected" }),
67
68
  /* @__PURE__ */ r(U, { children: /* @__PURE__ */ r(T, { value: i, suffix: "%" }) })
68
69
  ] })
69
70
  ] })
@@ -72,5 +73,5 @@ const u = {
72
73
  );
73
74
  };
74
75
  export {
75
- J as VotingOption
76
+ K as VotingOption
76
77
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamlayer/react-ui",
3
- "version": "0.69.3",
3
+ "version": "0.70.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./lib/index.d.ts",
@@ -40,8 +40,8 @@
40
40
  "react-virtualized-auto-sizer": "^1.0.20",
41
41
  "react-window": "^1.8.9",
42
42
  "react-window-infinite-loader": "^1.0.9",
43
- "@streamlayer/feature-gamification": "^0.26.7",
44
43
  "@streamlayer/sdk-web": "^0.28.29",
44
+ "@streamlayer/feature-gamification": "^0.26.7",
45
45
  "@streamlayer/sdk-web-anonymous-auth": "^0.11.24",
46
46
  "@streamlayer/sdk-web-api": "^0.0.1",
47
47
  "@streamlayer/sdk-web-core": "^0.0.4",
@@ -49,8 +49,8 @@
49
49
  "@streamlayer/sdk-web-interfaces": "^0.0.1",
50
50
  "@streamlayer/sdk-web-notifications": "^0.13.4",
51
51
  "@streamlayer/sdk-web-storage": "^0.0.4",
52
- "@streamlayer/sdk-web-types": "^0.0.1",
53
- "@streamlayer/sdk-web-logger": "^0.0.1"
52
+ "@streamlayer/sdk-web-logger": "^0.0.1",
53
+ "@streamlayer/sdk-web-types": "^0.0.1"
54
54
  },
55
55
  "nx": {
56
56
  "implicitDependencies": [
@@ -90,6 +90,6 @@
90
90
  "vite-plugin-svgr": "^4.1.0",
91
91
  "vite-svg-loader": "^4.0.0",
92
92
  "vite-tsconfig-paths": "^4.2.1",
93
- "@streamlayer/react": "^0.31.7"
93
+ "@streamlayer/react": "^0.31.8"
94
94
  }
95
95
  }