@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"),B=require("react-i18next"),L=require("@rubin-epo/epo-react-lib/IconComposer"),u=require("./styles.cjs"),T=require("./PointSelector/index.cjs"),W=require("./Message/Message.cjs"),y=s=>s&&s.__esModule?s:{default:s},E=y(L),M=({width:s=600,height:i=600,selectedSource:r=[],sources:h,alerts:t=[],activeAlertIndex:a=0,alertChangeCallback:b,selectionCallback:d,blinkConfig:j,isDisplayOnly:c=!1,className:k})=>{const[x,C]=l.useState(!1),[_,g]=l.useState(),[q,n]=l.useState(!1),{t:f}=B.useTranslation(),S="sourceSelectorWidget",p=o=>{x&&!c&&(o?r.includes(o)||(d&&d(r.concat(o)),g(e.jsxs(e.Fragment,{children:[e.jsx(E.default,{icon:"checkmark"}),f("source_selector.messages.success")]})),n(!0)):(g(f("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,A=c?[t[a].image]:t.map(({image:o})=>o);return e.jsxs(u.SourceSelectorContainer,{width:s,height:i,className:k,children:[!c&&e.jsx(W.default,{onMessageChangeCallback:I,isVisible:q,forIds:[S],children:_}),e.jsxs(u.BackgroundBlinker,{images:A,activeIndex:a,blinkCallback:b,loadedCallback:()=>C(!0),...j,children:[t.length>0&&!c&&e.jsx(u.ElapsedDisplay,{day:V,hour:v}),e.jsx(T.default,{id:S,onSelectCallback:p,width:s,height:i,sources:h,selectedSource:r})]})]})};M.displayName="Widgets.SourceSelector";const F=M;exports.default=F;
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 r, Fragment as _ } from "react/jsx-runtime";
3
- import { useState as l } from "react";
4
- import { useTranslation as E } from "react-i18next";
5
- import F from "@rubin-epo/epo-react-lib/IconComposer";
6
- import { SourceSelectorContainer as N, BackgroundBlinker as P, ElapsedDisplay as T } from "./styles.js";
7
- import $ from "./PointSelector/index.js";
8
- import q from "./Message/Message.js";
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: i = 600,
11
+ width: l = 600,
11
12
  height: d = 600,
12
- selectedSource: t = [],
13
- sources: p,
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] = l(!1), [j, u] = l(), [x, a] = l(!1), { t: f } = E(), g = "sourceSelectorWidget", A = (s) => {
23
- b && !o && (s ? t.includes(s) || (m && m(t.concat(s)), u(
24
- /* @__PURE__ */ n(_, { children: [
25
- /* @__PURE__ */ r(F, { icon: "checkmark" }),
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
- }, B = () => {
30
+ }, A = () => {
30
31
  a(!1);
31
- }, S = e[c].date - e[0].date, I = Math.round(S), L = Math.round(24 / S % 24) || 0, W = o ? [e[c].image] : e.map(({ image: s }) => s);
32
- return /* @__PURE__ */ n(N, { width: i, height: d, className: M, children: [
33
- !o && /* @__PURE__ */ r(
34
- q,
35
- {
36
- onMessageChangeCallback: B,
37
- isVisible: x,
38
- forIds: [g],
39
- children: j
40
- }
41
- ),
42
- /* @__PURE__ */ n(
43
- P,
44
- {
45
- images: W,
46
- activeIndex: c,
47
- blinkCallback: k,
48
- loadedCallback: () => V(!0),
49
- ...C,
50
- children: [
51
- e.length > 0 && !o && /* @__PURE__ */ r(T, { day: I, hour: L }),
52
- /* @__PURE__ */ r(
53
- $,
54
- {
55
- id: g,
56
- onSelectCallback: A,
57
- width: i,
58
- height: d,
59
- sources: p,
60
- selectedSource: t
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 s=require("styled-components"),r=require("../../styles/svg.cjs"),a=require("../../atomic/Blinker/Blinker.cjs"),l=require("../../atomic/ElapsedTime/ElapsedTime.cjs"),i=e=>e&&e.__esModule?e:{default:e},t=i(s),n=t.default(r.Container)`
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
- `,c=t.default(a.default)`
6
+ `,r=e.default(l.default)`
13
7
  position: absolute;
14
8
  width: 100%;
15
9
  height: 100%;
16
- `,d=t.default(l.default)`
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=c;exports.ElapsedDisplay=d;exports.SVG=u;exports.SourceSelectorContainer=n;
14
+ `;exports.BackgroundBlinker=r;exports.ElapsedDisplay=u;exports.SVG=a;
@@ -1,31 +1,23 @@
1
1
  "use client";
2
- import o, { css as i } from "styled-components";
3
- import { Container as e } from "../../styles/svg.js";
4
- import s from "../../atomic/Blinker/Blinker.js";
5
- import p from "../../atomic/ElapsedTime/ElapsedTime.js";
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
- `, x = o(s)`
10
+ `, l = o(t)`
18
11
  position: absolute;
19
12
  width: 100%;
20
13
  height: 100%;
21
- `, d = o(p)`
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
- x as BackgroundBlinker,
28
- d as ElapsedDisplay,
29
- u as SVG,
30
- c as SourceSelectorContainer
20
+ l as BackgroundBlinker,
21
+ n as ElapsedDisplay,
22
+ p as SVG
31
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubin-epo/epo-widget-lib",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Rubin Observatory Education & Public Outreach team React scientific and educational widgets.",
5
5
  "author": "Rubin EPO",
6
6
  "license": "MIT",