@rubin-epo/epo-widget-lib 0.9.5 → 0.9.6
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 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),l=require("react"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),l=require("react"),y=require("react-i18next"),A=require("@rubin-epo/epo-react-lib/IconComposer"),B=require("../../styles/svg.cjs"),S=require("./styles.cjs"),L=require("./PointSelector/index.cjs"),R=require("./Message/Message.cjs"),T=s=>s&&s.__esModule?s:{default:s},W=T(A),M=({width:s=600,height:u=600,selectedSource:r=[],sources:h,alerts:t=[],activeAlertIndex:a=0,alertChangeCallback:b,selectionCallback:i,blinkConfig:j,isDisplayOnly:c=!1,className:k})=>{const[x,C]=l.useState(!1),[_,d]=l.useState(),[q,n]=l.useState(!1),{t:g}=y.useTranslation(),f="sourceSelectorWidget",p=o=>{x&&!c&&(o?r.includes(o)||(i&&i(r.concat(o)),d(e.jsxs(e.Fragment,{children:[e.jsx(W.default,{icon:"checkmark"}),g("source_selector.messages.success")]})),n(!0)):(d(g("source_selector.messages.failure")),n(!0)))},I=()=>{n(!1)},m=t[a].date-t[0].date,v=Math.round(m),V=Math.round(24/m%24)||0,$=c?[t[a].image]:t.map(({image:o})=>o);return e.jsxs(B.Container,{style:{aspectRatio:`${s} / ${u}`},className:k,children:[!c&&e.jsx(R.default,{onMessageChangeCallback:I,isVisible:q,forIds:[f],children:_}),e.jsxs(S.BackgroundBlinker,{images:$,activeIndex:a,blinkCallback:b,loadedCallback:()=>C(!0),...j,children:[t.length>0&&!c&&e.jsx(S.ElapsedDisplay,{day:v,hour:V}),e.jsx(L.default,{id:f,onSelectCallback:p,width:s,height:u,sources:h,selectedSource:r})]})]})};M.displayName="Widgets.SourceSelector";const E=M;exports.default=E;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as n, jsx as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
2
|
+
import { jsxs as n, jsx as t, Fragment as W } from "react/jsx-runtime";
|
|
3
|
+
import { useState as i } from "react";
|
|
4
|
+
import { useTranslation as _ } from "react-i18next";
|
|
5
|
+
import E from "@rubin-epo/epo-react-lib/IconComposer";
|
|
6
|
+
import { Container as F } from "../../styles/svg.js";
|
|
7
|
+
import { BackgroundBlinker as N, ElapsedDisplay as P } from "./styles.js";
|
|
8
|
+
import R from "./PointSelector/index.js";
|
|
9
|
+
import T from "./Message/Message.js";
|
|
9
10
|
const h = ({
|
|
10
|
-
width:
|
|
11
|
+
width: l = 600,
|
|
11
12
|
height: d = 600,
|
|
12
|
-
selectedSource:
|
|
13
|
-
sources:
|
|
13
|
+
selectedSource: r = [],
|
|
14
|
+
sources: S,
|
|
14
15
|
alerts: e = [],
|
|
15
16
|
activeAlertIndex: c = 0,
|
|
16
17
|
alertChangeCallback: k,
|
|
@@ -19,51 +20,58 @@ const h = ({
|
|
|
19
20
|
isDisplayOnly: o = !1,
|
|
20
21
|
className: M
|
|
21
22
|
}) => {
|
|
22
|
-
const [b, V] =
|
|
23
|
-
b && !o && (s ?
|
|
24
|
-
/* @__PURE__ */ n(
|
|
25
|
-
/* @__PURE__ */
|
|
23
|
+
const [b, V] = i(!1), [$, u] = i(), [j, a] = i(!1), { t: f } = _(), g = "sourceSelectorWidget", x = (s) => {
|
|
24
|
+
b && !o && (s ? r.includes(s) || (m && m(r.concat(s)), u(
|
|
25
|
+
/* @__PURE__ */ n(W, { children: [
|
|
26
|
+
/* @__PURE__ */ t(E, { icon: "checkmark" }),
|
|
26
27
|
f("source_selector.messages.success")
|
|
27
28
|
] })
|
|
28
29
|
), a(!0)) : (u(f("source_selector.messages.failure")), a(!0)));
|
|
29
|
-
},
|
|
30
|
+
}, A = () => {
|
|
30
31
|
a(!1);
|
|
31
|
-
},
|
|
32
|
-
return /* @__PURE__ */ n(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
32
|
+
}, p = e[c].date - e[0].date, B = Math.round(p), I = Math.round(24 / p % 24) || 0, L = o ? [e[c].image] : e.map(({ image: s }) => s);
|
|
33
|
+
return /* @__PURE__ */ n(
|
|
34
|
+
F,
|
|
35
|
+
{
|
|
36
|
+
style: { aspectRatio: `${l} / ${d}` },
|
|
37
|
+
className: M,
|
|
38
|
+
children: [
|
|
39
|
+
!o && /* @__PURE__ */ t(
|
|
40
|
+
T,
|
|
41
|
+
{
|
|
42
|
+
onMessageChangeCallback: A,
|
|
43
|
+
isVisible: j,
|
|
44
|
+
forIds: [g],
|
|
45
|
+
children: $
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
/* @__PURE__ */ n(
|
|
49
|
+
N,
|
|
50
|
+
{
|
|
51
|
+
images: L,
|
|
52
|
+
activeIndex: c,
|
|
53
|
+
blinkCallback: k,
|
|
54
|
+
loadedCallback: () => V(!0),
|
|
55
|
+
...C,
|
|
56
|
+
children: [
|
|
57
|
+
e.length > 0 && !o && /* @__PURE__ */ t(P, { day: B, hour: I }),
|
|
58
|
+
/* @__PURE__ */ t(
|
|
59
|
+
R,
|
|
60
|
+
{
|
|
61
|
+
id: g,
|
|
62
|
+
onSelectCallback: x,
|
|
63
|
+
width: l,
|
|
64
|
+
height: d,
|
|
65
|
+
sources: S,
|
|
66
|
+
selectedSource: r
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
);
|
|
67
75
|
};
|
|
68
76
|
h.displayName = "Widgets.SourceSelector";
|
|
69
77
|
const X = h;
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
${({width:e,height:o})=>s.css`
|
|
3
|
-
aspect-ratio: ${e} / ${o};
|
|
4
|
-
max-width: ${e}px;
|
|
5
|
-
max-height: ${o}px;
|
|
6
|
-
`}
|
|
7
|
-
`,u=t.default.svg`
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("styled-components"),l=require("../../atomic/Blinker/Blinker.cjs"),s=require("../../atomic/ElapsedTime/ElapsedTime.cjs"),i=t=>t&&t.__esModule?t:{default:t},e=i(o),a=e.default.svg`
|
|
8
2
|
position: absolute;
|
|
9
3
|
top: 0;
|
|
10
4
|
left: 0;
|
|
11
5
|
cursor: pointer;
|
|
12
|
-
`,
|
|
6
|
+
`,r=e.default(l.default)`
|
|
13
7
|
position: absolute;
|
|
14
8
|
width: 100%;
|
|
15
9
|
height: 100%;
|
|
16
|
-
`,
|
|
10
|
+
`,u=e.default(s.default)`
|
|
17
11
|
position: absolute;
|
|
18
12
|
right: var(--PADDING_SMALL, 20px);
|
|
19
13
|
bottom: var(--PADDING_SMALL, 20px);
|
|
20
|
-
`;exports.BackgroundBlinker=
|
|
14
|
+
`;exports.BackgroundBlinker=r;exports.ElapsedDisplay=u;exports.SVG=a;
|
|
@@ -1,31 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import o
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
const c = o(e)`
|
|
7
|
-
${({ width: t, height: r }) => i`
|
|
8
|
-
aspect-ratio: ${t} / ${r};
|
|
9
|
-
max-width: ${t}px;
|
|
10
|
-
max-height: ${r}px;
|
|
11
|
-
`}
|
|
12
|
-
`, u = o.svg`
|
|
2
|
+
import o from "styled-components";
|
|
3
|
+
import t from "../../atomic/Blinker/Blinker.js";
|
|
4
|
+
import i from "../../atomic/ElapsedTime/ElapsedTime.js";
|
|
5
|
+
const p = o.svg`
|
|
13
6
|
position: absolute;
|
|
14
7
|
top: 0;
|
|
15
8
|
left: 0;
|
|
16
9
|
cursor: pointer;
|
|
17
|
-
`,
|
|
10
|
+
`, l = o(t)`
|
|
18
11
|
position: absolute;
|
|
19
12
|
width: 100%;
|
|
20
13
|
height: 100%;
|
|
21
|
-
`,
|
|
14
|
+
`, n = o(i)`
|
|
22
15
|
position: absolute;
|
|
23
16
|
right: var(--PADDING_SMALL, 20px);
|
|
24
17
|
bottom: var(--PADDING_SMALL, 20px);
|
|
25
18
|
`;
|
|
26
19
|
export {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
c as SourceSelectorContainer
|
|
20
|
+
l as BackgroundBlinker,
|
|
21
|
+
n as ElapsedDisplay,
|
|
22
|
+
p as SVG
|
|
31
23
|
};
|
package/package.json
CHANGED