@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
|
|
2
|
-
import { QuestionImages as a, QuestionStatus as
|
|
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
|
|
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
|
|
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(
|
|
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" :
|
|
20
|
+
return n ? e ? "correct" : "incorrect" : "unset";
|
|
21
21
|
if (n)
|
|
22
22
|
return "correct";
|
|
23
23
|
}
|
|
24
|
-
return t === c.TRIVIA && i
|
|
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 ===
|
|
32
|
-
var
|
|
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:
|
|
41
|
-
youSelected:
|
|
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:
|
|
45
|
-
answerTimeExpired:
|
|
46
|
-
questionStatus:
|
|
47
|
-
isLoading:
|
|
48
|
-
questionType:
|
|
49
|
-
correct:
|
|
50
|
-
hasCorrectAnswer:
|
|
51
|
-
} = t,
|
|
52
|
-
return /* @__PURE__ */
|
|
53
|
-
|
|
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":
|
|
57
|
-
"data-answerState":
|
|
58
|
-
disabled: s ||
|
|
59
|
-
|
|
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
|
-
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
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
|
-
|
|
66
|
-
|
|
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
|
-
|
|
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.
|
|
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-
|
|
53
|
-
"@streamlayer/sdk-web-
|
|
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.
|
|
93
|
+
"@streamlayer/react": "^0.31.8"
|
|
94
94
|
}
|
|
95
95
|
}
|