@streamlayer/react-ui 0.96.2 → 0.97.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 (83) hide show
  1. package/lib/assets/style.css +1 -1
  2. package/lib/hooks/analytics.js +50 -0
  3. package/lib/index-z0QjLiEL.js +75 -0
  4. package/lib/ui/app/Features/FeatureProvider.d.ts +1 -0
  5. package/lib/ui/app/Features/FeatureProvider.js +34 -6
  6. package/lib/ui/app/Features/Gamification/Friends.d.ts +0 -2
  7. package/lib/ui/app/Features/Gamification/Friends.js +20 -23
  8. package/lib/ui/app/Features/Gamification/Leaderboard.js +31 -25
  9. package/lib/ui/app/Features/Gamification/Question.js +4 -2
  10. package/lib/ui/app/Features/Gamification/QuestionsList.js +11 -8
  11. package/lib/ui/app/Features/Gamification/Tabs.js +30 -25
  12. package/lib/ui/app/Features/Gamification/UserSummary.js +14 -12
  13. package/lib/ui/app/Features/Gamification/gamification-feature.js +6 -2
  14. package/lib/ui/app/Features/Gamification/index.d.ts +10 -0
  15. package/lib/ui/app/Features/Gamification/index.js +73 -68
  16. package/lib/ui/app/Features/index.d.ts +8 -0
  17. package/lib/ui/app/Features/index.js +112 -16
  18. package/lib/ui/app/Navigation/MastersNavigation/index.js +5 -4
  19. package/lib/ui/app/Navigation/index.js +7 -6
  20. package/lib/ui/app/Notifications/Onboarding/index.d.ts +2 -0
  21. package/lib/ui/app/Notifications/Onboarding/index.js +76 -78
  22. package/lib/ui/app/Notifications/index.js +98 -91
  23. package/lib/ui/app/Points/index.js +20 -17
  24. package/lib/ui/app/masters.js +167 -86
  25. package/lib/ui/app/useMastersApp.js +12 -11
  26. package/lib/ui/app/useSdkFeature.js +13 -16
  27. package/lib/ui/app/useSdkResponsive.js +1 -1
  28. package/lib/ui/app/useSdkScroll.d.ts +1 -1
  29. package/lib/ui/app/useSdkScroll.js +28 -25
  30. package/lib/ui/gamification/invite-link/index.js +26 -12
  31. package/lib/ui/gamification/onboarding/index.d.ts +0 -2
  32. package/lib/ui/gamification/onboarding/index.js +46 -46
  33. package/lib/ui/gamification/onboarding/slides/onboarding-instructions/index.d.ts +2 -2
  34. package/lib/ui/gamification/onboarding/slides/onboarding-instructions/index.js +21 -20
  35. package/lib/ui/gamification/onboarding/slides/onboarding-instructions/styles.d.ts +1 -0
  36. package/lib/ui/gamification/onboarding/slides/onboarding-instructions/styles.js +20 -15
  37. package/lib/ui/gamification/onboarding/slides/onboarding-invite-card/index.d.ts +0 -3
  38. package/lib/ui/gamification/onboarding/slides/onboarding-invite-card/index.js +34 -29
  39. package/lib/ui/gamification/onboarding/slides/onboarding-invite-card/styles.d.ts +0 -3
  40. package/lib/ui/gamification/onboarding/slides/onboarding-invite-card/styles.js +17 -32
  41. package/lib/ui/gamification/points/index.d.ts +1 -0
  42. package/lib/ui/gamification/points/index.js +9 -9
  43. package/lib/ui/gamification/question/index.d.ts +1 -0
  44. package/lib/ui/gamification/question/index.js +31 -24
  45. package/lib/ui/gamification/question/insight/index.js +11 -15
  46. package/lib/ui/gamification/question/list/index.d.ts +3 -1
  47. package/lib/ui/gamification/question/list/index.js +50 -34
  48. package/lib/ui/gamification/question/notification/index.js +23 -25
  49. package/lib/ui/gamification/question/notification/insight/index.js +10 -9
  50. package/lib/ui/gamification/question/notification/tweet/index.js +3 -2
  51. package/lib/ui/gamification/question/styles.d.ts +2 -0
  52. package/lib/ui/gamification/question/styles.js +39 -28
  53. package/lib/ui/gamification/question/twitter/index.js +14 -18
  54. package/lib/ui/gamification/user-statistics/index.d.ts +3 -2
  55. package/lib/ui/gamification/user-statistics/index.js +48 -45
  56. package/lib/ui/gamification/vote/feedback/index.d.ts +3 -2
  57. package/lib/ui/gamification/vote/feedback/index.js +74 -58
  58. package/lib/ui/gamification/vote/feedback/styles.d.ts +2 -0
  59. package/lib/ui/gamification/vote/feedback/styles.js +33 -21
  60. package/lib/ui/gamification/vote/index.js +94 -83
  61. package/lib/ui/gamification/vote/insight-details/index.js +7 -6
  62. package/lib/ui/gamification/vote/twitter-details/index.js +3 -2
  63. package/lib/ui/gamification/vote/vote-option/index.d.ts +2 -1
  64. package/lib/ui/gamification/vote/vote-option/index.js +47 -39
  65. package/lib/ui/icons/index.d.ts +1 -2
  66. package/lib/ui/icons/index.js +122 -49
  67. package/lib/ui/modal/index.js +27 -21
  68. package/lib/ui/navigation/button/Channels.js +6 -5
  69. package/lib/ui/navigation/button/FeaturedGroups.js +4 -3
  70. package/lib/ui/navigation/button/LeaderBoard.js +6 -5
  71. package/lib/ui/navigation/button/index.js +20 -7
  72. package/lib/ui/navigation/button/styles.d.ts +3 -0
  73. package/lib/ui/navigation/button/styles.js +9 -6
  74. package/lib/ui/questions/insight/index.js +16 -16
  75. package/lib/ui/questions/twitter/index.js +3 -2
  76. package/lib/ui/show-in/index.d.ts +2 -0
  77. package/lib/ui/show-in/index.js +24 -14
  78. package/lib/ui/timer/index.js +32 -28
  79. package/lib/ui/video-player/index.js +41 -39
  80. package/lib/ui/video-player/styles.d.ts +1 -0
  81. package/lib/ui/video-player/styles.js +10 -9
  82. package/package.json +22 -21
  83. package/lib/index-keh7OLCY.js +0 -67
@@ -1,44 +1,50 @@
1
- import { jsxs as i, jsx as n } from "react/jsx-runtime";
2
- import { cx as a } from "@linaria/core";
3
- import { styled as d } from "@linaria/react";
1
+ import { jsxs as c, jsx as n } from "react/jsx-runtime";
2
+ import { cx as d } from "@linaria/core";
3
+ import { styled as a } from "@linaria/react";
4
4
  import { useState as m, useCallback as f, useEffect as l } from "react";
5
- import { r as c } from "../../index-jRXrW6ie.js";
5
+ import { r as i } from "../../index-jRXrW6ie.js";
6
6
  import "../../index-uEuzH3jr.js";
7
- const u = /* @__PURE__ */ d("div")({
7
+ const u = /* @__PURE__ */ a("div")({
8
8
  name: "StaticContainer",
9
9
  class: "svm502q",
10
10
  propsAsIs: !1
11
- }), p = "fd3gza8", v = `
11
+ }), p = "fd3gza8", y = `
12
12
  body {
13
13
  overflow: hidden !important;
14
14
  }
15
- `, x = `
15
+ `, v = `
16
16
  .sl-hide-on-modal {
17
17
  display: none !important;
18
18
  }
19
- `, y = (r) => {
20
- const [e, o] = m(r), t = f(() => o(!1), []);
21
- return l(() => (r && document.addEventListener("scroll", t), () => {
19
+ `, x = `
20
+ .sl-pill-button {
21
+ display: none;
22
+ }
23
+ `, h = (o) => {
24
+ const [e, r] = m(o), t = f(() => r(!1), []);
25
+ return l(() => (o && document.addEventListener("scroll", t), () => {
22
26
  document.removeEventListener("scroll", t);
23
- }), [r, t]), l(() => {
27
+ }), [o, t]), l(() => {
24
28
  e === !1 && document.removeEventListener("scroll", t);
25
29
  }, [e, t]), [e];
26
- }, V = ({
27
- children: r,
30
+ }, P = ({
31
+ children: o,
28
32
  container: e,
29
- fixedView: o,
33
+ fixedView: r,
30
34
  useContainer: t
31
35
  }) => {
32
- const [s] = y(o);
33
- return e.current ? t ? c.createPortal(/* @__PURE__ */ i(u, {
34
- className: a(s && p),
35
- children: [r, s && /* @__PURE__ */ n("style", {
36
- children: v
36
+ const [s] = h(r);
37
+ return e.current ? t ? i.createPortal(/* @__PURE__ */ c(u, {
38
+ className: d(s && p),
39
+ children: [o, s && /* @__PURE__ */ n("style", {
40
+ children: y
37
41
  }), !s && /* @__PURE__ */ n("style", {
42
+ children: v
43
+ }), /* @__PURE__ */ n("style", {
38
44
  children: x
39
45
  })]
40
- }), e.current, "modal-node") : c.createPortal(r, e.current, "modal-node") : null;
46
+ }), e.current, "modal-node") : i.createPortal(o, e.current, "modal-node") : null;
41
47
  };
42
48
  export {
43
- V as ModalPortal
49
+ P as ModalPortal
44
50
  };
@@ -3,24 +3,25 @@ import { styled as e } from "@linaria/react";
3
3
  import { SvgIcon as s } from "../../icons/index.js";
4
4
  import { Button as c } from "./index.js";
5
5
  import "react";
6
+ import "@linaria/core";
6
7
  import "./styles.js";
7
- const a = () => s, r = /* @__PURE__ */ e(a())({
8
+ const r = () => s, a = /* @__PURE__ */ e(r())({
8
9
  name: "ButtonIcon",
9
10
  class: "b1whzxvd",
10
11
  propsAsIs: !0
11
- }), u = "channels", B = (n) => {
12
+ }), B = "channels", I = (n) => {
12
13
  var t;
13
14
  return /* @__PURE__ */ o(c, {
14
15
  ...n,
15
16
  id: "channels",
16
17
  label: "Channels",
17
- icon: /* @__PURE__ */ o(r, {
18
+ icon: /* @__PURE__ */ o(a, {
18
19
  name: "icon-btn-channels",
19
20
  "data-selected": (t = n.active) == null ? void 0 : t.toString()
20
21
  })
21
22
  });
22
23
  };
23
24
  export {
24
- B as ChannelsButton,
25
- u as ChannelsButtonId
25
+ I as ChannelsButton,
26
+ B as ChannelsButtonId
26
27
  };
@@ -3,12 +3,13 @@ import { styled as r } from "@linaria/react";
3
3
  import { SvgIcon as u } from "../../icons/index.js";
4
4
  import { Button as n } from "./index.js";
5
5
  import "react";
6
+ import "@linaria/core";
6
7
  import "./styles.js";
7
8
  const s = () => u, a = /* @__PURE__ */ r(s())({
8
9
  name: "ButtonIcon",
9
10
  class: "b11des7c",
10
11
  propsAsIs: !0
11
- }), f = "featuredGroups", G = (t) => {
12
+ }), G = "featuredGroups", B = (t) => {
12
13
  var o;
13
14
  return /* @__PURE__ */ e(n, {
14
15
  ...t,
@@ -21,6 +22,6 @@ const s = () => u, a = /* @__PURE__ */ r(s())({
21
22
  });
22
23
  };
23
24
  export {
24
- G as FeaturedGroupsButton,
25
- f as FeaturedGroupsButtonId
25
+ B as FeaturedGroupsButton,
26
+ G as FeaturedGroupsButtonId
26
27
  };
@@ -3,24 +3,25 @@ import { styled as e } from "@linaria/react";
3
3
  import { SvgIcon as a } from "../../icons/index.js";
4
4
  import { Button as d } from "./index.js";
5
5
  import "react";
6
+ import "@linaria/core";
6
7
  import "./styles.js";
7
- const n = () => a, c = /* @__PURE__ */ e(n())({
8
+ const n = () => a, m = /* @__PURE__ */ e(n())({
8
9
  name: "ButtonIcon",
9
10
  class: "b180jd7l",
10
11
  propsAsIs: !0
11
- }), b = "leaderboard", u = (o) => {
12
+ }), u = "leaderboard", I = (o) => {
12
13
  var t;
13
14
  return /* @__PURE__ */ r(d, {
14
15
  ...o,
15
16
  label: "Leader Board",
16
17
  id: "leaderboard",
17
- icon: /* @__PURE__ */ r(c, {
18
+ icon: /* @__PURE__ */ r(m, {
18
19
  name: "icon-btn-leaderboard",
19
20
  "data-selected": (t = o.active) == null ? void 0 : t.toString()
20
21
  })
21
22
  });
22
23
  };
23
24
  export {
24
- u as LeaderBoardButton,
25
- b as LeaderBoardButtonId
25
+ I as LeaderBoardButton,
26
+ u as LeaderBoardButtonId
26
27
  };
@@ -1,10 +1,23 @@
1
- import { jsx as t, jsxs as d, Fragment as i } from "react/jsx-runtime";
2
- import { SButton as l, ButtonIcon as m, ButtonLabel as s } from "./styles.js";
1
+ import { jsx as e, jsxs as l, Fragment as m } from "react/jsx-runtime";
2
+ import { cx as d } from "@linaria/core";
3
+ import { SButton as s, SelectedButton as u, HoverIconState as p, HoverIconLeaderboardState as h, ButtonIcon as B, ButtonLabel as f } from "./styles.js";
3
4
  import "@linaria/react";
4
- const p = ({ disabled: e, active: n, onClick: o, label: c, icon: r }) => /* @__PURE__ */ t(l, { onClick: o, disabled: e, "data-selected": n, children: /* @__PURE__ */ d(i, { children: [
5
- r && /* @__PURE__ */ t(m, { children: r }),
6
- /* @__PURE__ */ t(s, { children: c })
7
- ] }) });
5
+ const I = ({ disabled: n, active: r, onClick: a, label: c, icon: o, id: t }) => /* @__PURE__ */ e(
6
+ s,
7
+ {
8
+ onClick: a,
9
+ disabled: n,
10
+ className: d(
11
+ r && u,
12
+ !r && (t === "channels" || t === "featuredGroups") && p,
13
+ !r && t === "leaderboard" && h
14
+ ),
15
+ children: /* @__PURE__ */ l(m, { children: [
16
+ o && /* @__PURE__ */ e(B, { children: o }),
17
+ /* @__PURE__ */ e(f, { children: c })
18
+ ] })
19
+ }
20
+ );
8
21
  export {
9
- p as Button
22
+ I as Button
10
23
  };
@@ -2,3 +2,6 @@
2
2
  export declare const SButton: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Record<never, unknown>>;
3
3
  export declare const ButtonIcon: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
4
4
  export declare const ButtonLabel: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & Record<never, unknown>>;
5
+ export declare const SelectedButton: import("@linaria/core").LinariaClassName;
6
+ export declare const HoverIconState: import("@linaria/core").LinariaClassName;
7
+ export declare const HoverIconLeaderboardState: import("@linaria/core").LinariaClassName;
@@ -1,19 +1,22 @@
1
- import { styled as s } from "@linaria/react";
2
- const o = /* @__PURE__ */ s("button")({
1
+ import { styled as t } from "@linaria/react";
2
+ const o = /* @__PURE__ */ t("button")({
3
3
  name: "SButton",
4
4
  class: "sxxa0c",
5
5
  propsAsIs: !1
6
- }), n = /* @__PURE__ */ s("span")({
6
+ }), n = /* @__PURE__ */ t("span")({
7
7
  name: "ButtonIcon",
8
8
  class: "b193dcyu",
9
9
  propsAsIs: !1
10
- }), a = /* @__PURE__ */ s("span")({
10
+ }), a = /* @__PURE__ */ t("span")({
11
11
  name: "ButtonLabel",
12
12
  class: "b40tuix",
13
13
  propsAsIs: !1
14
- });
14
+ }), e = "s14xk0af", c = "ha3mg7c", r = "h103yr45";
15
15
  export {
16
16
  n as ButtonIcon,
17
17
  a as ButtonLabel,
18
- o as SButton
18
+ r as HoverIconLeaderboardState,
19
+ c as HoverIconState,
20
+ o as SButton,
21
+ e as SelectedButton
19
22
  };
@@ -1,35 +1,35 @@
1
- import { jsxs as c, jsx as d } from "react/jsx-runtime";
2
- import { QuestionImages as v } from "@streamlayer/sdk-web-types";
3
- import { VideoPlayer as C } from "../../video-player/index.js";
4
- import { Container as b, ImageContainer as e, Image as x, Content as D, Title as T, Description as j } from "./styles.js";
1
+ import { jsxs as g, jsx as d } from "react/jsx-runtime";
2
+ import { QuestionImages as I } from "@streamlayer/sdk-web-types";
3
+ import { VideoPlayer as e } from "../../video-player/index.js";
4
+ import { Container as v, ImageContainer as C, Image as b, Content as x, Title as D, Description as T } from "./styles.js";
5
+ import "@linaria/core";
5
6
  import "react";
6
7
  import "../../icons/index.js";
7
8
  import "@linaria/react";
8
9
  import "../../video-player/styles.js";
9
- const k = ({
10
- imageMode: g,
10
+ const R = ({
11
11
  instantView: r,
12
12
  isDetail: m,
13
13
  notification: o,
14
- controlVideo: u
14
+ controlVideo: c
15
15
  }) => {
16
- const l = r == null ? void 0 : r.heading, p = r == null ? void 0 : r.body, h = l || p, y = o == null ? void 0 : o.title, I = o == null ? void 0 : o.body;
17
- return /* @__PURE__ */ c(b, { children: [
16
+ const l = r == null ? void 0 : r.heading, p = r == null ? void 0 : r.body, h = l || p, u = o == null ? void 0 : o.title, y = o == null ? void 0 : o.body;
17
+ return /* @__PURE__ */ g(v, { children: [
18
18
  (r == null ? void 0 : r.video) && /* @__PURE__ */ d(
19
- C,
19
+ e,
20
20
  {
21
21
  source: r.video.url,
22
22
  poster: r.video.thumbnailUrl,
23
- controlVideo: u
23
+ controlVideo: c
24
24
  }
25
25
  ),
26
- (r == null ? void 0 : r.image) && !(r != null && r.video) && /* @__PURE__ */ d(e, { "data-rounded": g === v.ROUNDED, children: /* @__PURE__ */ d(x, { src: r == null ? void 0 : r.image }) }),
27
- /* @__PURE__ */ c(D, { children: [
28
- /* @__PURE__ */ d(T, { children: m && h ? l : y }),
29
- /* @__PURE__ */ d(j, { children: m && h ? p : I })
26
+ (r == null ? void 0 : r.image) && !(r != null && r.video) && /* @__PURE__ */ d(C, { "data-rounded": r.imageMode === I.ROUNDED, children: /* @__PURE__ */ d(b, { src: r == null ? void 0 : r.image }) }),
27
+ /* @__PURE__ */ g(x, { children: [
28
+ /* @__PURE__ */ d(D, { children: m && h ? l : u }),
29
+ /* @__PURE__ */ d(T, { children: m && h ? p : y })
30
30
  ] })
31
31
  ] });
32
32
  };
33
33
  export {
34
- k as InsightContent
34
+ R as InsightContent
35
35
  };
@@ -2,13 +2,14 @@ import { jsxs as t, jsx as n, Fragment as j } from "react/jsx-runtime";
2
2
  import { VideoPlayer as k } from "../../video-player/index.js";
3
3
  import { Account as x } from "./account/index.js";
4
4
  import { Container as B, Details as E, Body as N, ImagesContainer as c, ImageFullSize as i, ImageHalfSize as e, ImagesBlock as m } from "./styles.js";
5
+ import "@linaria/core";
5
6
  import "react";
6
7
  import "../../icons/index.js";
7
8
  import "@linaria/react";
8
9
  import "../../video-player/styles.js";
9
10
  import "../../../utils/common.js";
10
11
  import "./account/styles.js";
11
- const R = new RegExp("\\s?https?://t.co[^\\s]+(\\s+)?$"), S = (o) => o == null ? void 0 : o.replace(R, ""), J = ({
12
+ const R = new RegExp("\\s?https?://t.co[^\\s]+(\\s+)?$"), S = (o) => o == null ? void 0 : o.replace(R, ""), K = ({
12
13
  image: o,
13
14
  body: C,
14
15
  account: z,
@@ -64,5 +65,5 @@ const R = new RegExp("\\s?https?://t.co[^\\s]+(\\s+)?$"), S = (o) => o == null ?
64
65
  ] });
65
66
  };
66
67
  export {
67
- J as TwitterContent
68
+ K as TwitterContent
68
69
  };
@@ -3,5 +3,7 @@ export declare const ShowIn: React.FC<{
3
3
  children: React.ReactNode | React.ReactNode[];
4
4
  style?: React.CSSProperties;
5
5
  className?: string;
6
+ enabled?: boolean;
7
+ replayKey?: unknown;
6
8
  hiding?: boolean;
7
9
  }>;
@@ -1,20 +1,30 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { cx as i } from "@linaria/core";
3
- import { styled as m } from "@linaria/react";
4
- const a = /* @__PURE__ */ m("div")({
1
+ import { jsx as f } from "react/jsx-runtime";
2
+ import { cx as u } from "@linaria/core";
3
+ import { styled as g } from "@linaria/react";
4
+ import { useState as p, useEffect as h } from "react";
5
+ const w = /* @__PURE__ */ g("div")({
5
6
  name: "Container",
6
7
  class: "c1pgyo67",
7
8
  propsAsIs: !1
8
- }), e = "hx17qu6", l = ({
9
- children: o,
9
+ }), S = "sx17qu6", d = "h1692c5m", v = ({
10
+ children: i,
10
11
  style: n,
11
- className: s,
12
- hiding: r
13
- }) => /* @__PURE__ */ t(a, {
14
- style: n,
15
- className: i(s, r && e),
16
- children: o
17
- });
12
+ className: r,
13
+ enabled: o = !0,
14
+ replayKey: t,
15
+ hiding: e
16
+ }) => {
17
+ const [m, s] = p(!0), c = o && m, a = o && e;
18
+ return h(() => {
19
+ t !== void 0 && (s(!1), requestAnimationFrame(() => {
20
+ s(!0);
21
+ }));
22
+ }, [t]), /* @__PURE__ */ f(w, {
23
+ style: n,
24
+ className: u(r, c && S, a && d),
25
+ children: i
26
+ });
27
+ };
18
28
  export {
19
- l as ShowIn
29
+ v as ShowIn
20
30
  };
@@ -1,41 +1,45 @@
1
1
  import { jsx as R } from "react/jsx-runtime";
2
- import { styled as E } from "@linaria/react";
3
- import { useState as S, useCallback as n } from "react";
4
- import { CountdownCircleTimer as A } from "react-countdown-circle-timer";
5
- import { COLORS as o } from "../theme/constants.js";
6
- const O = [o.PRIMARY_GREEN1, o.SECONDARY_RED1, o.SECONDARY_RED1, o.NEUTRALS_GRAY3], _ = [10, 10, 1, 0], N = /* @__PURE__ */ E("div")({
2
+ import { styled as _ } from "@linaria/react";
3
+ import { useState as c, useEffect as a, useCallback as n } from "react";
4
+ import { CountdownCircleTimer as N } from "react-countdown-circle-timer";
5
+ import { COLORS as t } from "../theme/constants.js";
6
+ const D = [t.PRIMARY_GREEN1, t.SECONDARY_RED1, t.SECONDARY_RED1, t.NEUTRALS_GRAY3], T = [10, 10, 1, 0], Y = /* @__PURE__ */ _("div")({
7
7
  name: "RemainingTime",
8
8
  class: "r165427",
9
9
  propsAsIs: !1
10
- }), f = o.SECONDARY_GREEN6, c = o.SECONDARY_RED3, D = o.NEUTRALS_GRAY3, d = ({
11
- isPlaying: l = !0,
12
- duration: e = 30,
13
- onTimerExpired: t
10
+ }), h = t.SECONDARY_GREEN6, l = t.SECONDARY_RED3, m = t.NEUTRALS_GRAY3, G = ({
11
+ isPlaying: i = !0,
12
+ duration: o = 30,
13
+ onTimerExpired: e
14
14
  }) => {
15
- const [i, s] = S(e > 10 ? f : c), m = ({
15
+ const [C, s] = c(o > 10 ? h : l), [E, S] = c(2);
16
+ a(() => {
17
+ o === 0 && (S(0), s(m));
18
+ }, [o]);
19
+ const f = ({
16
20
  remainingTime: r
17
- }) => /* @__PURE__ */ R(N, {
18
- children: r
19
- }), C = n(() => {
20
- t == null || t(), s(D);
21
- }, [t, s]), a = n((r) => {
22
- r === 10 && s(c);
21
+ }) => /* @__PURE__ */ R(Y, {
22
+ children: o === 0 ? 0 : r
23
+ }), A = n(() => {
24
+ e == null || e(), s(m);
25
+ }, [e, s]), O = n((r) => {
26
+ r === 10 && s(l);
23
27
  }, [s]);
24
- return /* @__PURE__ */ R(A, {
25
- isPlaying: l,
26
- duration: e,
27
- colors: O,
28
- colorsTime: _,
28
+ return /* @__PURE__ */ R(N, {
29
+ isPlaying: i,
30
+ duration: o,
31
+ colors: D,
32
+ colorsTime: T,
29
33
  size: 32,
30
- strokeWidth: 2,
34
+ strokeWidth: E,
31
35
  trailStrokeWidth: 2,
32
- trailColor: i,
33
- onComplete: C,
34
- onUpdate: a,
35
- children: m
36
+ trailColor: C,
37
+ onComplete: A,
38
+ onUpdate: O,
39
+ children: f
36
40
  });
37
41
  };
38
42
  export {
39
- N as RemainingTime,
40
- d as Timer
43
+ Y as RemainingTime,
44
+ G as Timer
41
45
  };
@@ -1,69 +1,71 @@
1
- import { jsxs as w, jsx as i } from "react/jsx-runtime";
2
- import { useRef as C, useState as v, useCallback as p, useEffect as d } from "react";
3
- import { SvgIcon as E } from "../icons/index.js";
4
- import { Container as I, Player as S, Poster as x, Control as L } from "./styles.js";
1
+ import { jsxs as w, jsx as n } from "react/jsx-runtime";
2
+ import { cx as x } from "@linaria/core";
3
+ import { useRef as C, useState as p, useCallback as g, useEffect as v } from "react";
4
+ import { SvgIcon as d } from "../icons/index.js";
5
+ import { Container as E, ToggleIconPause as S, Player as T, Poster as L, Control as j } from "./styles.js";
5
6
  import "@linaria/react";
6
- const T = (s, c) => {
7
+ const k = (s, o) => {
7
8
  for (const t of s)
8
- t.isIntersecting || t.target instanceof HTMLVideoElement && !t.target.paused && (c.unobserve(t.target), t.target.pause());
9
- }, g = new IntersectionObserver(T, { threshold: 0.5 }), f = /* @__PURE__ */ new Set(), j = (s) => {
10
- g.observe(s), f.add(s);
11
- }, n = (s) => {
12
- g.unobserve(s), f.delete(s);
13
- }, k = () => {
9
+ t.isIntersecting || t.target instanceof HTMLVideoElement && !t.target.paused && (o.unobserve(t.target), t.target.pause());
10
+ }, y = new IntersectionObserver(k, { threshold: 0.5 }), f = /* @__PURE__ */ new Set(), H = (s) => {
11
+ y.observe(s), f.add(s);
12
+ }, u = (s) => {
13
+ y.unobserve(s), f.delete(s);
14
+ }, M = () => {
14
15
  for (const s of f)
15
- s instanceof HTMLVideoElement && !s.paused && (s.pause(), n(s));
16
- }, z = ({ poster: s, source: c, controlVideo: t }) => {
17
- const e = C(null), [l, o] = v(!1), [b, m] = v(!0), y = p(() => {
16
+ s instanceof HTMLVideoElement && !s.paused && (s.pause(), u(s));
17
+ }, D = ({ poster: s, source: o, controlVideo: t }) => {
18
+ const e = C(null), [a, c] = p(!1), [m, b] = p(!0), P = g(() => {
18
19
  t == null || t({ muted: !0 });
19
- }, [t]), u = p(() => {
20
+ }, [t]), i = g(() => {
20
21
  t == null || t({ muted: !1 });
21
- }, [t]), P = () => {
22
+ }, [t]), h = () => {
22
23
  const r = e == null ? void 0 : e.current;
23
24
  if (r)
24
- if (l)
25
- r.pause(), e.current && n(e.current);
25
+ if (a)
26
+ r.pause(), e.current && u(e.current);
26
27
  else {
27
- const a = e == null ? void 0 : e.current;
28
- if (!a)
28
+ const l = e == null ? void 0 : e.current;
29
+ if (!l)
29
30
  return;
30
- k(), j(a), a.play().catch((O) => console.log(O)), m(!1);
31
+ M(), H(l), l.play().catch((O) => console.log(O)), b(!1);
31
32
  }
32
- }, h = () => {
33
+ }, I = () => {
33
34
  var r;
34
- e.current && n(e.current), (r = e == null ? void 0 : e.current) == null || r.load(), m(!0);
35
+ e.current && u(e.current), (r = e == null ? void 0 : e.current) == null || r.load(), b(!0);
35
36
  };
36
- return d(() => {
37
- e.current && n(e.current);
38
- }, []), d(() => {
37
+ return v(() => {
38
+ e.current && u(e.current);
39
+ }, []), v(() => {
39
40
  const r = e == null ? void 0 : e.current;
40
41
  return () => {
41
- r && (r.paused || u(), n(r));
42
+ r && (r.paused || i(), u(r));
42
43
  };
43
- }, [u]), /* @__PURE__ */ w(I, { onClick: P, children: [
44
- /* @__PURE__ */ i(
45
- S,
44
+ }, [i]), /* @__PURE__ */ w(E, { onClick: h, className: x(a && S), children: [
45
+ /* @__PURE__ */ n(
46
+ T,
46
47
  {
47
48
  ref: e,
48
- src: c,
49
+ src: o,
49
50
  onPlay: () => {
50
- y(), o(!0);
51
+ P(), c(!0);
51
52
  },
52
53
  onPause: () => {
53
- u(), o(!1);
54
+ i(), c(!1);
54
55
  },
55
56
  onEnded: () => {
56
- u(), o(!1), h();
57
+ i(), c(!1), I();
57
58
  },
58
- style: { visibility: b ? "hidden" : "visible" },
59
+ style: { visibility: m ? "hidden" : "visible" },
60
+ controls: !1,
59
61
  playsInline: !0
60
62
  }
61
63
  ),
62
- /* @__PURE__ */ i(x, { src: s, style: { visibility: b ? "visible" : "hidden" } }),
63
- /* @__PURE__ */ i(L, { children: !l && /* @__PURE__ */ i(E, { name: "icon-play" }) })
64
+ /* @__PURE__ */ n(L, { src: s, style: { visibility: m ? "visible" : "hidden" } }),
65
+ /* @__PURE__ */ n(j, { children: a ? /* @__PURE__ */ n(d, { name: "icon-pause" }) : /* @__PURE__ */ n(d, { name: "icon-play" }) })
64
66
  ] });
65
67
  };
66
68
  export {
67
- z as VideoPlayer,
68
- k as pauseAllVideos
69
+ D as VideoPlayer,
70
+ M as pauseAllVideos
69
71
  };
@@ -3,3 +3,4 @@ export declare const Container: import("@linaria/react").StyledComponent<import(
3
3
  export declare const Player: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLVideoElement> & import("react").VideoHTMLAttributes<HTMLVideoElement> & Record<never, unknown>>;
4
4
  export declare const Poster: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLImageElement> & import("react").ImgHTMLAttributes<HTMLImageElement> & Record<never, unknown>>;
5
5
  export declare const Control: import("@linaria/react").StyledComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
6
+ export declare const ToggleIconPause: import("@linaria/core").LinariaClassName;
@@ -1,24 +1,25 @@
1
1
  import { styled as s } from "@linaria/react";
2
- const a = /* @__PURE__ */ s("div")({
2
+ const e = /* @__PURE__ */ s("div")({
3
3
  name: "Container",
4
4
  class: "c1bgb86j",
5
5
  propsAsIs: !1
6
- }), e = /* @__PURE__ */ s("video")({
6
+ }), a = /* @__PURE__ */ s("video")({
7
7
  name: "Player",
8
8
  class: "p6703cq",
9
9
  propsAsIs: !1
10
- }), r = /* @__PURE__ */ s("img")({
10
+ }), l = /* @__PURE__ */ s("img")({
11
11
  name: "Poster",
12
12
  class: "p12ow7zo",
13
13
  propsAsIs: !1
14
- }), l = /* @__PURE__ */ s("div")({
14
+ }), n = /* @__PURE__ */ s("div")({
15
15
  name: "Control",
16
16
  class: "cdpal9o",
17
17
  propsAsIs: !1
18
- });
18
+ }), r = "t1xke4ml";
19
19
  export {
20
- a as Container,
21
- l as Control,
22
- e as Player,
23
- r as Poster
20
+ e as Container,
21
+ n as Control,
22
+ a as Player,
23
+ l as Poster,
24
+ r as ToggleIconPause
24
25
  };