@streamlayer/react-ui 0.47.0 → 0.49.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 (42) hide show
  1. package/lib/index.js +34 -32
  2. package/lib/ui/app/Features/Gamification/Question.js +22 -56
  3. package/lib/ui/app/Features/Gamification/index.js +12 -9
  4. package/lib/ui/app/Features/index.js +11 -8
  5. package/lib/ui/app/masters.js +11 -8
  6. package/lib/ui/demo/Gamification.js +6 -4
  7. package/lib/ui/demo/Highlights.js +6 -4
  8. package/lib/ui/demo/components/Question.js +22 -20
  9. package/lib/ui/demo/components/index.js +18 -16
  10. package/lib/ui/demo/index.js +6 -4
  11. package/lib/ui/gamification/detail/sponsor/index.d.ts +4 -0
  12. package/lib/ui/gamification/detail/sponsor/index.js +14 -0
  13. package/lib/ui/gamification/points/styles.js +8 -8
  14. package/lib/ui/gamification/vote/feedback/index.d.ts +14 -0
  15. package/lib/ui/gamification/vote/feedback/index.js +33 -0
  16. package/lib/ui/gamification/vote/feedback/styles.d.ts +8 -0
  17. package/lib/ui/gamification/vote/feedback/styles.js +70 -0
  18. package/lib/ui/gamification/vote/index.d.ts +3 -8
  19. package/lib/ui/gamification/vote/index.js +62 -49
  20. package/lib/ui/gamification/vote/insight-details/index.d.ts +10 -0
  21. package/lib/ui/gamification/vote/insight-details/index.js +21 -0
  22. package/lib/ui/gamification/vote/insight-details/styles.d.ts +6 -0
  23. package/lib/ui/gamification/vote/insight-details/styles.js +43 -0
  24. package/lib/ui/gamification/vote/styles.d.ts +1 -5
  25. package/lib/ui/gamification/vote/styles.js +18 -53
  26. package/lib/ui/gamification/vote/vote-option/index.d.ts +9 -17
  27. package/lib/ui/gamification/vote/vote-option/index.js +53 -5
  28. package/lib/ui/gamification/vote/vote-option/styles.d.ts +12 -8
  29. package/lib/ui/gamification/vote/vote-option/styles.js +119 -66
  30. package/lib/ui/icons/index.d.ts +4 -0
  31. package/lib/ui/icons/index.js +30 -26
  32. package/lib/ui/video-player/index.d.ts +33 -0
  33. package/lib/ui/video-player/index.js +30 -0
  34. package/lib/ui/video-player/styles.d.ts +5 -0
  35. package/lib/ui/video-player/styles.js +29 -0
  36. package/package.json +10 -10
  37. package/lib/index-7f3361f2.js +0 -71
  38. package/lib/ui/gamification/vote/types.d.js +0 -1
  39. /package/lib/ui/gamification/{vote → detail}/header/index.d.ts +0 -0
  40. /package/lib/ui/gamification/{vote → detail}/header/index.js +0 -0
  41. /package/lib/ui/gamification/{vote → detail}/header/styles.d.ts +0 -0
  42. /package/lib/ui/gamification/{vote → detail}/header/styles.js +0 -0
@@ -0,0 +1,33 @@
1
+ import { jsxs as r, Fragment as m, jsx as e } from "react/jsx-runtime";
2
+ import { QuestionType as n } from "@streamlayer/sdk-web-types";
3
+ import { SvgIcon as b } from "../../../icons/index.js";
4
+ import { Container as h, IconPrediction as k, FeedbackDescription as l, FeedbackIconWrap as I, FeedbackHeader as T, FeedbackTitle as f } from "./styles.js";
5
+ import "@linaria/react";
6
+ import "react";
7
+ const R = ({
8
+ feedbackMessages: t,
9
+ questionVotedCorrectly: o,
10
+ questionVoted: F,
11
+ questionType: i,
12
+ hasCorrectAnswer: a
13
+ }) => {
14
+ if (!(F && (i === n.TRIVIA || i === n.PREDICTION)))
15
+ return null;
16
+ const p = i === n.PREDICTION && !a, d = o ? "correct" : "incorrect", c = o ? t.correctFeedback : t.incorrectFeedback;
17
+ return /* @__PURE__ */ r(h, { "data-isPrediction": p, children: [
18
+ p && /* @__PURE__ */ r(m, { children: [
19
+ /* @__PURE__ */ e(k, { name: "icon-prediction" }),
20
+ /* @__PURE__ */ e(l, { children: "Stay tuned to see if your prediction was correct." })
21
+ ] }),
22
+ a && /* @__PURE__ */ r(m, { children: [
23
+ /* @__PURE__ */ e(I, { "data-feedbackType": d, children: /* @__PURE__ */ e(b, { name: d }) }),
24
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ r(T, { children: [
25
+ /* @__PURE__ */ e(f, { "data-feedbackType": d, children: c == null ? void 0 : c.title }),
26
+ /* @__PURE__ */ e(l, { children: c == null ? void 0 : c.description })
27
+ ] }) })
28
+ ] })
29
+ ] });
30
+ };
31
+ export {
32
+ R as Feedback
33
+ };
@@ -0,0 +1,8 @@
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 IconPrediction: any;
4
+ export declare const FeedbackIconWrap: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
5
+ export declare const FeedbackHeader: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
6
+ export declare const FeedbackTitle: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
7
+ export declare const FeedbackDescription: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
8
+ export declare const FeedbackText: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
@@ -0,0 +1,70 @@
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 c = r.div`
6
+ width: 100%;
7
+ padding: 8px 0px;
8
+ display: flex;
9
+ align-items: center;
10
+ margin-bottom: 16px;
11
+ font-size: 14px;
12
+
13
+ &[data-isPrediction='true'] {
14
+ align-items: flex-start;
15
+ }
16
+ `, n = r(e)`
17
+ min-width: 24px;
18
+ width: 24px;
19
+ height: 24px;
20
+ margin-right: 14px;
21
+ margin-left: 12px;
22
+
23
+ g > path {
24
+ fill: var(--color-primary-green1);
25
+ fill-opacity: 1;
26
+ }
27
+ `, d = r.div`
28
+ min-width: 32px;
29
+ width: 32px;
30
+ height: 32px;
31
+ border-radius: 50%;
32
+ display: flex;
33
+ align-items: center;
34
+ justify-content: center;
35
+ margin-right: 16px;
36
+
37
+ &[data-feedbackType='correct'] {
38
+ background-color: var(--color-primary-green1);
39
+ }
40
+
41
+ &[data-feedbackType='incorrect'] {
42
+ background-color: var(--color-secondary-red1);
43
+ }
44
+ `, p = r.div`
45
+ font-weight: var(--font-weight-default);
46
+ `, l = r.span`
47
+ margin-right: 5px;
48
+
49
+ &[data-feedbackType='correct'] {
50
+ color: var(--color-primary-green1);
51
+ }
52
+
53
+ &[data-feedbackType='incorrect'] {
54
+ color: var(--color-secondary-red1);
55
+ }
56
+ `, g = r.span`
57
+ color: var(--color-neutrals-gray9);
58
+ `, s = r.div`
59
+ font-weight: 400;
60
+ margin-top: 10px;
61
+ `;
62
+ export {
63
+ c as Container,
64
+ g as FeedbackDescription,
65
+ p as FeedbackHeader,
66
+ d as FeedbackIconWrap,
67
+ s as FeedbackText,
68
+ l as FeedbackTitle,
69
+ n as IconPrediction
70
+ };
@@ -1,13 +1,8 @@
1
1
  /// <reference types="react" />
2
- import { QuestionType } from '@streamlayer/sdk-web-types';
2
+ import { ExtendedQuestion } from '@streamlayer/sdk-web-types';
3
3
  interface VoteProps {
4
- title: string;
5
- questionId: string;
6
- options: any[];
7
- questionType: QuestionType;
8
- feedbackMessages: any;
9
- questionAnswered: boolean;
10
- questionAnsweredCorrectly?: boolean;
4
+ openedQuestion: ExtendedQuestion;
5
+ vote: (questionId: string, answerId: string) => void;
11
6
  }
12
7
  export declare const Vote: React.FC<VoteProps>;
13
8
  export {};
@@ -1,58 +1,71 @@
1
- import { jsxs as c, jsx as i } from "react/jsx-runtime";
2
- import { useState as p, useCallback as s, useEffect as b } from "react";
3
- import { QuestionType as N } from "@streamlayer/sdk-web-types";
4
- import { V as S, c as D } from "../../../index-7f3361f2.js";
5
- import { Container as j, Title as M, Options as h, Loader as u, Feedback as Z, FeedbackIcon as L, FeedbackTitle as T, FeedbackDescription as z } from "./styles.js";
6
- import { WinBar as G } from "./win-bar/index.js";
7
- import "./vote-option/styles.js";
1
+ import { jsx as s, jsxs as A } from "react/jsx-runtime";
2
+ import { useState as e, useCallback as C, useMemo as l } from "react";
3
+ import { Feedback as b } from "./feedback/index.js";
4
+ import { Container as E, Content as M, Title as j, Options as k } from "./styles.js";
5
+ import { VotingOption as O } from "./vote-option/index.js";
6
+ import { WinBar as I } from "./win-bar/index.js";
7
+ import "@streamlayer/sdk-web-types";
8
+ import "../../icons/index.js";
8
9
  import "@linaria/react";
10
+ import "./feedback/styles.js";
11
+ import "./vote-option/styles.js";
9
12
  import "../../timer/index.js";
10
13
  import "react-countdown-circle-timer";
11
14
  import "../../theme/constants.js";
12
15
  import "./win-bar/styles.js";
13
- import "../../icons/index.js";
14
- const A = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3QgeT0iMC4wMDE5NTMxMiIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiByeD0iMTIiIGZpbGw9IiNGODAwMjIiLz4KPHJlY3QgeD0iOC4yNSIgeT0iNy4wMDE5NSIgd2lkdGg9IjEyLjM3NDQiIGhlaWdodD0iMS43Njc3NyIgcng9IjAuODgzODg0IiB0cmFuc2Zvcm09InJvdGF0ZSg0NSA4LjI1IDcuMDAxOTUpIiBmaWxsPSJ3aGl0ZSIvPgo8cmVjdCB4PSI3IiB5PSIxNS43NTIiIHdpZHRoPSIxMi4zNzQ0IiBoZWlnaHQ9IjEuNzY3NzciIHJ4PSIwLjg4Mzg4NCIgdHJhbnNmb3JtPSJyb3RhdGUoLTQ1IDcgMTUuNzUyKSIgZmlsbD0id2hpdGUiLz4KPC9zdmc+Cg==", W = ({
15
- title: m,
16
- questionId: a,
17
- options: r,
18
- questionAnswered: l,
19
- feedbackMessages: I,
20
- questionAnsweredCorrectly: t,
21
- questionType: d
22
- }) => {
23
- const [g, n] = p(!1), e = s(
24
- (o) => {
25
- n(o);
16
+ const X = ({ openedQuestion: r, vote: f }) => {
17
+ var V;
18
+ const d = r.subject, q = r.type, a = (V = r.options) == null ? void 0 : V.options, [n, v] = e(!1), [w, T] = e(!1), [y, g] = e(""), m = r == null ? void 0 : r.id, p = C(
19
+ async (t) => {
20
+ if (m) {
21
+ const c = t.currentTarget.value;
22
+ g(c), T(!0), await f(m, c), T(!1);
23
+ }
26
24
  },
27
- [n]
28
- );
29
- return b(() => {
30
- e(!1);
31
- }, [r, e]), /* @__PURE__ */ c(j, { children: [
32
- /* @__PURE__ */ i(G, { title: "To win", points: 100, isTimer: !0 }),
33
- /* @__PURE__ */ i(M, { children: m }),
34
- /* @__PURE__ */ c(h, { children: [
35
- g && /* @__PURE__ */ i(u, { children: "Loading..." }),
36
- r.map((o) => /* @__PURE__ */ i(
37
- S,
38
- {
39
- toggleIsLoadingSubmitAnswer: e,
40
- questionId: a,
41
- questionType: d,
42
- ...o
43
- },
44
- o.id
45
- ))
46
- ] }),
47
- l && d === N.TRIVIA && /* @__PURE__ */ c(Z, { children: [
48
- /* @__PURE__ */ i(L, { alt: "reaction-to-answer", src: t ? D : A }),
49
- /* @__PURE__ */ c("div", { children: [
50
- /* @__PURE__ */ i(T, { children: t ? I.correctFeedback.title : I.incorrectFeedback.title }),
51
- /* @__PURE__ */ i(z, { children: t ? I.correctFeedback.description : I.incorrectFeedback.description })
52
- ] })
53
- ] })
54
- ] });
25
+ [m, g, f]
26
+ ), i = l(
27
+ () => r == null ? void 0 : r.answers.find((t) => t.youVoted === !0),
28
+ [r]
29
+ ), o = l(
30
+ () => !!(r != null && r.answers.find((t) => t.correct === !0)),
31
+ [r]
32
+ ), h = l(() => r ? r.answers.map((t) => {
33
+ var c;
34
+ return {
35
+ ...t,
36
+ questionVoted: !!i,
37
+ youSelected: y === t.id,
38
+ isLoading: w,
39
+ hasCorrectAnswer: o,
40
+ questionType: r.type,
41
+ imageMode: (c = r.notification) == null ? void 0 : c.imageMode,
42
+ onVote: p
43
+ };
44
+ }) : [], [o, w, r, i, p, y]), x = a && (a.case === "trivia" || a.case === "prediction") ? a.value : void 0;
45
+ return /* @__PURE__ */ s(E, { children: /* @__PURE__ */ A(M, { children: [
46
+ x && /* @__PURE__ */ s(
47
+ b,
48
+ {
49
+ feedbackMessages: x,
50
+ questionVoted: !!i,
51
+ questionVotedCorrectly: i == null ? void 0 : i.correct,
52
+ questionType: q,
53
+ hasCorrectAnswer: o
54
+ }
55
+ ),
56
+ /* @__PURE__ */ s(
57
+ I,
58
+ {
59
+ title: n ? "Expired" : "To win",
60
+ points: n ? void 0 : 100,
61
+ onTimerExpired: () => v(!0),
62
+ isTimer: !0
63
+ }
64
+ ),
65
+ /* @__PURE__ */ s(j, { children: d }),
66
+ /* @__PURE__ */ s(k, { children: h.map((t) => /* @__PURE__ */ s(O, { ...t }, t.id)) })
67
+ ] }) });
55
68
  };
56
69
  export {
57
- W as Vote
70
+ X as Vote
58
71
  };
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { VideoPlayerProps } from '../../../video-player';
3
+ export type InsightDetailsProps = {
4
+ poster?: string;
5
+ video?: VideoPlayerProps;
6
+ title: string;
7
+ description: string;
8
+ webLink?: string;
9
+ };
10
+ export declare const InsightDetails: React.FC<InsightDetailsProps>;
@@ -0,0 +1,21 @@
1
+ import { jsxs as e, jsx as r } from "react/jsx-runtime";
2
+ import { SvgIcon as m } from "../../../icons/index.js";
3
+ import { VideoPlayer as l } from "../../../video-player/index.js";
4
+ import { Container as p, Content as s, Title as c, Description as a, WebLinkBtn as h } from "./styles.js";
5
+ import "@linaria/react";
6
+ import "react";
7
+ import "../../../video-player/styles.js";
8
+ const y = ({ video: t, title: i, description: n, webLink: o }) => /* @__PURE__ */ e(p, { children: [
9
+ t && /* @__PURE__ */ r(l, { ...t }),
10
+ /* @__PURE__ */ e(s, { children: [
11
+ /* @__PURE__ */ r(c, { children: i }),
12
+ /* @__PURE__ */ r(a, { children: n }),
13
+ o && /* @__PURE__ */ e(h, { href: "webLink", target: "_blank", children: [
14
+ "Explore more of the Masters History",
15
+ /* @__PURE__ */ r(m, { name: "icon-external-link" })
16
+ ] })
17
+ ] })
18
+ ] });
19
+ export {
20
+ y as InsightDetails
21
+ };
@@ -0,0 +1,6 @@
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 Content: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
4
+ export declare const Title: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLHeadingElement> & import("react").HTMLAttributes<HTMLHeadingElement> & Record<never, unknown>>;
5
+ export declare const Description: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
6
+ export declare const WebLinkBtn: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLAnchorElement> & import("react").AnchorHTMLAttributes<HTMLAnchorElement> & Record<never, unknown>>;
@@ -0,0 +1,43 @@
1
+ import { styled as o } from "@linaria/react";
2
+ const t = o.div`
3
+ display: flex;
4
+ flex-direction: column;
5
+ row-gap: 16px;
6
+ padding: var(--container-padding);
7
+ background-color: var(--color-neutrals-white);
8
+ `, r = o.div`
9
+ display: flex;
10
+ flex-direction: column;
11
+ row-gap: 12px;
12
+ `, n = o.h3`
13
+ color: var(--color-primary-green1);
14
+ font-size: 16px;
15
+ line-height: 26px;
16
+ font-family: var(--font-serif);
17
+ font-weight: var(--font-weight-default);
18
+ `, i = o.div`
19
+ color: var(--color-neutrals-gray9);
20
+ font-size: 14px;
21
+ line-height: 24px;
22
+ font-weight: var(--font-weight-default);
23
+ `, a = o.a`
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: center;
27
+ column-gap: 10px;
28
+ padding: 11px 16px;
29
+ color: var(--color-primary-green1);
30
+ font-size: 14px;
31
+ font-weight: var(--font-weight-default);
32
+ line-height: 20px;
33
+ border-radius: 40px;
34
+ border: 1px solid var(--color-primary-green1);
35
+ text-decoration: none;
36
+ `;
37
+ export {
38
+ t as Container,
39
+ r as Content,
40
+ i as Description,
41
+ n as Title,
42
+ a as WebLinkBtn
43
+ };
@@ -1,9 +1,5 @@
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 Content: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
3
4
  export declare const Title: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
4
5
  export declare const Options: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
5
- export declare const Loader: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
6
- export declare const Feedback: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
7
- export declare const FeedbackIcon: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLImageElement> & import("react").ImgHTMLAttributes<HTMLImageElement> & Record<never, unknown>>;
8
- export declare const FeedbackTitle: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
9
- export declare const FeedbackDescription: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
@@ -1,65 +1,30 @@
1
1
  import { styled as t } from "@linaria/react";
2
- const e = t.div`
3
- padding: 16px;
4
- color: #fff;
2
+ const o = t.div`
5
3
  width: 100%;
6
- font-weight: 700;
7
- font-size: 14px;
4
+ height: 100%;
8
5
 
9
6
  & > div:not(:last-child) {
10
7
  margin-bottom: 16px;
11
8
  }
12
- `, o = t.div`
13
- font-size: 16px;
14
9
  `, n = t.div`
15
- overflow-y: auto;
16
- max-height: 220px;
17
- position: relative;
18
-
19
- & > div:not(:last-child) {
20
- margin-bottom: 12px;
21
- }
22
- `, d = t.div`
23
- position: absolute;
24
- left: 0px;
25
- background-color: var(--color-transparent-vote-container);
26
10
  width: 100%;
27
- height: 100%;
28
- z-index: 1;
29
- display: flex;
30
- justify-content: center;
31
- align-items: center;
32
- `, a = t.div`
33
- padding: 14px 12px 14px 16px;
11
+ padding: 0px 16px;
12
+ `, r = t.div`
13
+ font-family: var(--font-serif);
14
+ font-size: 16px;
15
+ color: var(--color-primary-green2);
16
+ font-weight: 400;
17
+ margin: 16px 0px;
18
+ margin-bottom: 16px;
19
+ `, e = t.div`
20
+ position: relative;
21
+ gap: 8px;
34
22
  display: flex;
35
- align-items: center;
36
- `, l = t.img`
37
- width: 24px;
38
- height: 24px;
39
- margin-right: 12px;
40
- `, p = t.div`
41
- overflow: hidden;
42
- text-overflow: ellipsis;
43
- white-space: nowrap;
44
- font-size: 16;
45
- font-weight: 700;
46
- margin-bottom: 10px;
47
- `, s = t.div`
48
- display: -webkit-box;
49
- -webkit-box-orient: vertical;
50
- -webkit-line-clamp: 4;
51
- overflow: hidden;
52
- text-overflow: ellipsis;
53
- font-size: 14;
54
- font-weight: 500;
23
+ flex-direction: column;
55
24
  `;
56
25
  export {
57
- e as Container,
58
- a as Feedback,
59
- s as FeedbackDescription,
60
- l as FeedbackIcon,
61
- p as FeedbackTitle,
62
- d as Loader,
63
- n as Options,
64
- o as Title
26
+ o as Container,
27
+ n as Content,
28
+ e as Options,
29
+ r as Title
65
30
  };
@@ -1,20 +1,12 @@
1
1
  /// <reference types="react" />
2
- import { QuestionType } from '@streamlayer/sdk-web-types';
3
- interface VotingOptionProps {
4
- icon: string;
5
- title: string;
6
- id: string;
7
- questionId: string;
8
- percentage: number;
9
- disabled: boolean;
10
- correct: boolean;
11
- questionAnswered: boolean;
12
- hasCorrectAnswer: boolean;
13
- answered: boolean;
14
- points: number;
2
+ import { QuestionType, QuestionImages, ExtendedQuestionAnswer } from '@streamlayer/sdk-web-types';
3
+ export type VotingOptionProps = ExtendedQuestionAnswer & {
4
+ questionVoted: boolean;
5
+ youSelected: boolean;
6
+ isLoading: boolean;
7
+ hasCorrectAnswer?: boolean;
15
8
  questionType: QuestionType;
16
- onVote: (questionId: string, answerId: string) => void;
17
- toggleIsLoadingSubmitAnswer: (flag: boolean) => void;
18
- }
9
+ imageMode?: QuestionImages;
10
+ onVote: (e: React.MouseEvent<HTMLButtonElement>) => void;
11
+ };
19
12
  export declare const VotingOption: React.FC<VotingOptionProps>;
20
- export {};
@@ -1,8 +1,56 @@
1
- import "react/jsx-runtime";
2
- import "@streamlayer/sdk-web-types";
3
- import { V as n } from "../../../../index-7f3361f2.js";
4
- import "./styles.js";
1
+ import { jsx as n, jsxs as s } from "react/jsx-runtime";
2
+ import { QuestionImages as c, QuestionType as o } from "@streamlayer/sdk-web-types";
3
+ import { IconDefault as T, IconContainer as C, IconWrap as R, IconCircle as S, ButtonContainer as w, ButtonPct as D, ButtonBody as O, Title as P, Indicators as A, CheckIcon as x, Percentage as B } from "./styles.js";
5
4
  import "@linaria/react";
5
+ import "../../../icons/index.js";
6
+ import "react";
7
+ const d = {
8
+ [c.CENTERED]: (t) => /* @__PURE__ */ n(T, { alt: "option-icon", src: t }),
9
+ [c.TRANSPARENT]: (t) => /* @__PURE__ */ n(C, { children: /* @__PURE__ */ n(R, { style: { backgroundImage: `url(${t})` } }) }),
10
+ [c.ROUNDED]: (t) => /* @__PURE__ */ n(S, { alt: "option-icon", src: t }),
11
+ [c.NONE]: () => null,
12
+ [c.UNSET]: () => null
13
+ }, k = ({ questionType: t, hasCorrectAnswer: l, correct: e, youVoted: r, questionVoted: i }) => t === o.POLL ? r ? "correct" : "unset" : t === o.PREDICTION ? l ? r ? e ? "correct" : "incorrect" : e ? "correct" : "unset" : "correct" : t === o.TRIVIA && i ? r ? e ? "correct" : "incorrect" : e ? "correct" : "unset" : "unset", U = (t) => {
14
+ var p;
15
+ const {
16
+ // option props
17
+ id: l,
18
+ icon: e,
19
+ text: r,
20
+ percentageDecimal: i,
21
+ // extra props
22
+ onVote: g,
23
+ youSelected: h,
24
+ questionVoted: u,
25
+ imageMode: I,
26
+ isLoading: E,
27
+ questionType: m
28
+ } = t, a = k(t), N = m === o.TRIVIA || m === o.PREDICTION, f = a === "correct" ? "correct" : a === "incorrect" ? "incorrect" : "";
29
+ return /* @__PURE__ */ s(
30
+ w,
31
+ {
32
+ value: l,
33
+ "data-selected": h,
34
+ "data-answerState": a,
35
+ disabled: u || E,
36
+ onClick: g,
37
+ children: [
38
+ u && /* @__PURE__ */ n(D, { "data-answerState": a, style: { width: `${i}%` } }),
39
+ /* @__PURE__ */ s(O, { children: [
40
+ e && I && ((p = d[I]) == null ? void 0 : p.call(d, e)),
41
+ /* @__PURE__ */ n(P, { children: r }),
42
+ u && /* @__PURE__ */ s(A, { children: [
43
+ N && f && /* @__PURE__ */ n(x, { name: f }),
44
+ /* @__PURE__ */ s(B, { children: [
45
+ i,
46
+ "%"
47
+ ] })
48
+ ] })
49
+ ] })
50
+ ]
51
+ }
52
+ );
53
+ };
6
54
  export {
7
- n as VotingOption
55
+ U as VotingOption
8
56
  };
@@ -1,13 +1,17 @@
1
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 AnsweredContainer: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
4
- as?: import("react").ElementType<any> | undefined;
5
- }>;
2
+ export declare const ButtonContainer: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Record<never, unknown>>;
6
3
  export declare const ButtonPct: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
7
- export declare const Button: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Record<never, unknown>>;
4
+ export declare const ButtonBody: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
5
+ export declare const IconContainer: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
6
+ export declare const IconWrap: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
8
7
  export declare const Icon: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLImageElement> & import("react").ImgHTMLAttributes<HTMLImageElement> & Record<never, unknown>>;
8
+ export declare const IconDefault: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLImageElement> & import("react").ImgHTMLAttributes<HTMLImageElement> & Record<never, unknown> & {
9
+ as?: import("react").ElementType<any> | undefined;
10
+ }>;
11
+ export declare const IconCircle: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLImageElement> & import("react").ImgHTMLAttributes<HTMLImageElement> & Record<never, unknown> & {
12
+ as?: import("react").ElementType<any> | undefined;
13
+ }>;
9
14
  export declare const Title: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
10
15
  export declare const Indicators: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
11
- export declare const CheckIconWrap: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
12
- export declare const Percentage: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
13
- export declare const CheckIcon: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLImageElement> & import("react").ImgHTMLAttributes<HTMLImageElement> & Record<never, unknown>>;
16
+ export declare const Percentage: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
17
+ export declare const CheckIcon: any;