@rubin-epo/epo-widget-lib 0.9.5 → 0.9.7

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"),w=require("react"),G=require("react-i18next"),k=require("d3-array"),F=require("../../../charts/hooks/useAxis.cjs"),J=require("../../../charts/XAxis/index.cjs"),K=require("../../../charts/YAxis/index.cjs"),Q=require("../../../charts/Tooltip/index.cjs"),V=require("../../../charts/ClippingContainer/index.cjs"),X=require("../../../charts/Viewport/index.cjs"),s=require("../defaults.cjs"),Y=require("../Point/index.cjs"),p=require("./styles.cjs"),Z=(i,h,b)=>{const d={};return Object.keys(i).forEach(l=>{const a=l==="top"||l==="bottom"?b:h,c=`${l.charAt(0).toUpperCase()}${l.slice(1)}`;d[`padding${c}`]=`${i[l]/a*100}%`}),console.log({styles:d}),d},O=({data:i,activeAlertId:h,xMin:b,xMax:d,yMin:j=s.default.yMin,yMax:l=s.default.yMax,width:a=s.default.width,height:c=s.default.height,name:P,children:R,slider:q,className:W})=>{const{t:x,i18n:{language:C}}=G.useTranslation(),[L,S]=w.useState(),D=x("light_curve.plot.x_label"),M="xAxisLabel",T=x("light_curve.plot.y_label"),_="yAxisLabel",o=typeof L<"u"?i[L]:i.find(({id:n})=>n===h),f={top:10,right:10,bottom:25,left:40},y=[0+f.left,a-f.right],[A,z,r]=F.default({min:b||k.min(i,({x:n})=>n)||s.default.xMin,max:d||k.max(i,({x:n})=>n)||s.default.xMax,step:s.default.xStep,range:y}),m=r(A[0]),g=[0+f.top,c-f.bottom],[u,H,t]=F.default({min:j,max:l,step:s.default.yStep,range:g}),$=t(u[1]);return e.jsxs(p.PlotContainer,{className:W,children:[e.jsxs(p.Chart,{width:a,height:c,horizontalLabel:D,horizontalLabelId:M,verticalLabel:T,verticalLabelId:_,title:P,children:[e.jsx("rect",{x:r(0),y:t(u[0]),width:r(15)-r(0),height:$-t(u[0]),fill:"#F5F5F5"}),e.jsx(J.default,{ticks:z,y:$,labelledById:M,xDomain:A,xScale:r}),e.jsx(K.default,{ticks:H,x:m,labelledById:_,yDomain:u,yScale:t}),e.jsx(V.default,{x:m,y:t(u[0]),width:y[1]-y[0],height:g[1]-g[0],children:e.jsx("g",{role:"list","aria-label":x("light_curve.plot.plot_label")||void 0,children:i.map(({x:n,y:I,error:B,id:N},E)=>{const v=Math.round(n),U=v>0?"after":v===0?"peak":"before";return e.jsx(Y.default,{x:r(n),y:t(I),error:t(B)-t(0),onMouseOver:()=>S(E),onMouseOut:()=>S(void 0),description:x("light_curve.plot.point_label",{magnitude:I,count:Math.abs(v),context:U})||void 0},N)})})}),e.jsx(X.default,{x:m,y:t(u[0]),outerWidth:y[1]-y[0],outerHeight:g[1]-g[0],innerWidth:a,innerHeight:c,children:R}),e.jsx(Q.default,{x:o?r(o.x):void 0,y:o?t(o.y):void 0,visible:!!o,offset:6,children:x("light_curve.plot.tooltip",{magnitude:o==null?void 0:o.y.toLocaleString(C,{minimumFractionDigits:2,maximumFractionDigits:2})})})]}),q&&e.jsx(p.SliderOuterWrapper,{children:e.jsx(p.SliderInnerWrapper,{style:{...Z(f,a,c)},children:q})})]})};O.displayName="Widgets.LightCurve.ScatterPlot";const ee=O;exports.default=ee;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),w=require("react"),G=require("react-i18next"),k=require("d3-array"),F=require("../../../charts/hooks/useAxis.cjs"),J=require("../../../charts/XAxis/index.cjs"),K=require("../../../charts/YAxis/index.cjs"),Q=require("../../../charts/Tooltip/index.cjs"),V=require("../../../charts/ClippingContainer/index.cjs"),X=require("../../../charts/Viewport/index.cjs"),i=require("../defaults.cjs"),Y=require("../Point/index.cjs"),y=require("./styles.cjs"),Z=(o,b,g)=>{const h={};return Object.keys(o).forEach(n=>{const a=n==="top"||n==="bottom"?g:b,c=`${n.charAt(0).toUpperCase()}${n.slice(1)}`;h[`padding${c}`]=`${o[n]/a*100}%`}),h},O=({data:o,activeAlertId:b,xMin:g,xMax:h,yMin:m=i.default.yMin,yMax:n=i.default.yMax,width:a=i.default.width,height:c=i.default.height,name:P,children:R,slider:q,className:W})=>{const{t:d,i18n:{language:C}}=G.useTranslation(),[S,L]=w.useState(),D=d("light_curve.plot.x_label"),_="xAxisLabel",T=d("light_curve.plot.y_label"),M="yAxisLabel",s=typeof S<"u"?o[S]:o.find(({id:r})=>r===b),x={top:10,right:10,bottom:25,left:40},f=[0+x.left,a-x.right],[A,z,l]=F.default({min:g||k.min(o,({x:r})=>r)||i.default.xMin,max:h||k.max(o,({x:r})=>r)||i.default.xMax,step:i.default.xStep,range:f}),v=l(A[0]),p=[c-x.bottom,0+x.top],[u,H,t]=F.default({min:m,max:n,step:m<n?Math.abs(i.default.yStep):i.default.yStep,range:p}),$=t(u[0]);return e.jsxs(y.PlotContainer,{className:W,children:[e.jsxs(y.Chart,{width:a,height:c,horizontalLabel:D,horizontalLabelId:_,verticalLabel:T,verticalLabelId:M,title:P,children:[e.jsxs(V.default,{x:v,y:t(u[1]),width:f[1]-f[0],height:p[0]-p[1],children:[e.jsx("rect",{x:l(0),y:t(u[1]),width:l(15)-l(0),height:$-t(u[1]),fill:"#F5F5F5"}),e.jsx("g",{role:"list","aria-label":d("light_curve.plot.plot_label")||void 0,children:o.map(({x:r,y:I,error:B,id:N},E)=>{const j=Math.round(r),U=j>0?"after":j===0?"peak":"before";return e.jsx(Y.default,{x:l(r),y:t(I),error:t(B)-t(0),onMouseOver:()=>L(E),onMouseOut:()=>L(void 0),description:d("light_curve.plot.point_label",{magnitude:I,count:Math.abs(j),context:U})||void 0},N)})})]}),e.jsx(J.default,{ticks:z,y:$,labelledById:_,xDomain:A,xScale:l}),e.jsx(K.default,{ticks:H,x:v,labelledById:M,yDomain:u,yScale:t}),e.jsx(X.default,{x:v,y:t(u[0]),outerWidth:f[1]-f[0],outerHeight:p[1]-p[0],innerWidth:a,innerHeight:c,children:R}),e.jsx(Q.default,{x:s?l(s.x):void 0,y:s?t(s.y):void 0,visible:!!s,offset:6,children:d("light_curve.plot.tooltip",{magnitude:s==null?void 0:s.y.toLocaleString(C,{minimumFractionDigits:2,maximumFractionDigits:2})})})]}),q&&e.jsx(y.SliderOuterWrapper,{children:e.jsx(y.SliderInnerWrapper,{style:{...Z(x,a,c)},children:q})})]})};O.displayName="Widgets.LightCurve.ScatterPlot";const ee=O;exports.default=ee;
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsxs as F, jsx as o } from "react/jsx-runtime";
2
+ import { jsxs as L, jsx as o } from "react/jsx-runtime";
3
3
  import { useState as U } from "react";
4
4
  import { useTranslation as V } from "react-i18next";
5
5
  import { min as X, max as Y } from "d3-array";
@@ -9,50 +9,50 @@ import G from "../../../charts/YAxis/index.js";
9
9
  import J from "../../../charts/Tooltip/index.js";
10
10
  import K from "../../../charts/ClippingContainer/index.js";
11
11
  import Q from "../../../charts/Viewport/index.js";
12
- import n from "../defaults.js";
12
+ import e from "../defaults.js";
13
13
  import Z from "../Point/index.js";
14
14
  import { PlotContainer as tt, Chart as ot, SliderOuterWrapper as et, SliderInnerWrapper as it } from "./styles.js";
15
- const rt = (e, h, f) => {
16
- const p = {};
17
- return Object.keys(e).forEach((l) => {
18
- const a = l === "top" || l === "bottom" ? f : h, c = `${l.charAt(0).toUpperCase()}${l.slice(1)}`;
19
- p[`padding${c}`] = `${e[l] / a * 100}%`;
20
- }), console.log({ styles: p }), p;
15
+ const rt = (i, f, g) => {
16
+ const h = {};
17
+ return Object.keys(i).forEach((r) => {
18
+ const a = r === "top" || r === "bottom" ? g : f, c = `${r.charAt(0).toUpperCase()}${r.slice(1)}`;
19
+ h[`padding${c}`] = `${i[r] / a * 100}%`;
20
+ }), h;
21
21
  }, W = ({
22
- data: e,
23
- activeAlertId: h,
24
- xMin: f,
25
- xMax: p,
26
- yMin: v = n.yMin,
27
- yMax: l = n.yMax,
28
- width: a = n.width,
29
- height: c = n.height,
22
+ data: i,
23
+ activeAlertId: f,
24
+ xMin: g,
25
+ xMax: h,
26
+ yMin: b = e.yMin,
27
+ yMax: r = e.yMax,
28
+ width: a = e.width,
29
+ height: c = e.height,
30
30
  name: D,
31
31
  children: O,
32
- slider: L,
32
+ slider: S,
33
33
  className: R
34
34
  }) => {
35
35
  const {
36
- t: d,
36
+ t: p,
37
37
  i18n: { language: T }
38
- } = V(), [A, S] = U(), $ = d("light_curve.plot.x_label"), M = "xAxisLabel", j = d("light_curve.plot.y_label"), _ = "yAxisLabel", i = typeof A < "u" ? e[A] : e.find(({ id: r }) => r === h), x = {
38
+ } = V(), [A, _] = U(), $ = p("light_curve.plot.x_label"), M = "xAxisLabel", j = p("light_curve.plot.y_label"), I = "yAxisLabel", n = typeof A < "u" ? i[A] : i.find(({ id: l }) => l === f), d = {
39
39
  top: 10,
40
40
  right: 10,
41
41
  bottom: 25,
42
42
  left: 40
43
- }, u = [0 + x.left, a - x.right], [I, z, s] = P({
44
- min: f || X(e, ({ x: r }) => r) || n.xMin,
45
- max: p || Y(e, ({ x: r }) => r) || n.xMax,
46
- step: n.xStep,
43
+ }, x = [0 + d.left, a - d.right], [C, z, s] = P({
44
+ min: g || X(i, ({ x: l }) => l) || e.xMin,
45
+ max: h || Y(i, ({ x: l }) => l) || e.xMax,
46
+ step: e.xStep,
47
+ range: x
48
+ }), y = s(C[0]), u = [c - d.bottom, 0 + d.top], [m, H, t] = P({
49
+ min: b,
50
+ max: r,
51
+ step: b < r ? Math.abs(e.yStep) : e.yStep,
47
52
  range: u
48
- }), y = s(I[0]), g = [0 + x.top, c - x.bottom], [m, H, t] = P({
49
- min: v,
50
- max: l,
51
- step: n.yStep,
52
- range: g
53
- }), C = t(m[1]);
54
- return /* @__PURE__ */ F(tt, { className: R, children: [
55
- /* @__PURE__ */ F(
53
+ }), k = t(m[0]);
54
+ return /* @__PURE__ */ L(tt, { className: R, children: [
55
+ /* @__PURE__ */ L(
56
56
  ot,
57
57
  {
58
58
  width: a,
@@ -60,26 +60,63 @@ const rt = (e, h, f) => {
60
60
  horizontalLabel: $,
61
61
  horizontalLabelId: M,
62
62
  verticalLabel: j,
63
- verticalLabelId: _,
63
+ verticalLabelId: I,
64
64
  title: D,
65
65
  children: [
66
- /* @__PURE__ */ o(
67
- "rect",
66
+ /* @__PURE__ */ L(
67
+ K,
68
68
  {
69
- x: s(0),
70
- y: t(m[0]),
71
- width: s(15) - s(0),
72
- height: C - t(m[0]),
73
- fill: "#F5F5F5"
69
+ x: y,
70
+ y: t(m[1]),
71
+ width: x[1] - x[0],
72
+ height: u[0] - u[1],
73
+ children: [
74
+ /* @__PURE__ */ o(
75
+ "rect",
76
+ {
77
+ x: s(0),
78
+ y: t(m[1]),
79
+ width: s(15) - s(0),
80
+ height: k - t(m[1]),
81
+ fill: "#F5F5F5"
82
+ }
83
+ ),
84
+ /* @__PURE__ */ o(
85
+ "g",
86
+ {
87
+ role: "list",
88
+ "aria-label": p("light_curve.plot.plot_label") || void 0,
89
+ children: i.map(({ x: l, y: F, error: B, id: N }, w) => {
90
+ const v = Math.round(l), E = v > 0 ? "after" : v === 0 ? "peak" : "before";
91
+ return /* @__PURE__ */ o(
92
+ Z,
93
+ {
94
+ x: s(l),
95
+ y: t(F),
96
+ error: t(B) - t(0),
97
+ onMouseOver: () => _(w),
98
+ onMouseOut: () => _(void 0),
99
+ description: p("light_curve.plot.point_label", {
100
+ magnitude: F,
101
+ count: Math.abs(v),
102
+ context: E
103
+ }) || void 0
104
+ },
105
+ N
106
+ );
107
+ })
108
+ }
109
+ )
110
+ ]
74
111
  }
75
112
  ),
76
113
  /* @__PURE__ */ o(
77
114
  q,
78
115
  {
79
116
  ticks: z,
80
- y: C,
117
+ y: k,
81
118
  labelledById: M,
82
- xDomain: I,
119
+ xDomain: C,
83
120
  xScale: s
84
121
  }
85
122
  ),
@@ -88,53 +125,18 @@ const rt = (e, h, f) => {
88
125
  {
89
126
  ticks: H,
90
127
  x: y,
91
- labelledById: _,
128
+ labelledById: I,
92
129
  yDomain: m,
93
130
  yScale: t
94
131
  }
95
132
  ),
96
- /* @__PURE__ */ o(
97
- K,
98
- {
99
- x: y,
100
- y: t(m[0]),
101
- width: u[1] - u[0],
102
- height: g[1] - g[0],
103
- children: /* @__PURE__ */ o(
104
- "g",
105
- {
106
- role: "list",
107
- "aria-label": d("light_curve.plot.plot_label") || void 0,
108
- children: e.map(({ x: r, y: k, error: B, id: N }, w) => {
109
- const b = Math.round(r), E = b > 0 ? "after" : b === 0 ? "peak" : "before";
110
- return /* @__PURE__ */ o(
111
- Z,
112
- {
113
- x: s(r),
114
- y: t(k),
115
- error: t(B) - t(0),
116
- onMouseOver: () => S(w),
117
- onMouseOut: () => S(void 0),
118
- description: d("light_curve.plot.point_label", {
119
- magnitude: k,
120
- count: Math.abs(b),
121
- context: E
122
- }) || void 0
123
- },
124
- N
125
- );
126
- })
127
- }
128
- )
129
- }
130
- ),
131
133
  /* @__PURE__ */ o(
132
134
  Q,
133
135
  {
134
136
  x: y,
135
137
  y: t(m[0]),
136
- outerWidth: u[1] - u[0],
137
- outerHeight: g[1] - g[0],
138
+ outerWidth: x[1] - x[0],
139
+ outerHeight: u[1] - u[0],
138
140
  innerWidth: a,
139
141
  innerHeight: c,
140
142
  children: O
@@ -143,12 +145,12 @@ const rt = (e, h, f) => {
143
145
  /* @__PURE__ */ o(
144
146
  J,
145
147
  {
146
- x: i ? s(i.x) : void 0,
147
- y: i ? t(i.y) : void 0,
148
- visible: !!i,
148
+ x: n ? s(n.x) : void 0,
149
+ y: n ? t(n.y) : void 0,
150
+ visible: !!n,
149
151
  offset: 6,
150
- children: d("light_curve.plot.tooltip", {
151
- magnitude: i == null ? void 0 : i.y.toLocaleString(T, {
152
+ children: p("light_curve.plot.tooltip", {
153
+ magnitude: n == null ? void 0 : n.y.toLocaleString(T, {
152
154
  minimumFractionDigits: 2,
153
155
  maximumFractionDigits: 2
154
156
  })
@@ -158,17 +160,17 @@ const rt = (e, h, f) => {
158
160
  ]
159
161
  }
160
162
  ),
161
- L && /* @__PURE__ */ o(et, { children: /* @__PURE__ */ o(
163
+ S && /* @__PURE__ */ o(et, { children: /* @__PURE__ */ o(
162
164
  it,
163
165
  {
164
- style: { ...rt(x, a, c) },
165
- children: L
166
+ style: { ...rt(d, a, c) },
167
+ children: S
166
168
  }
167
169
  ) })
168
170
  ] });
169
171
  };
170
172
  W.displayName = "Widgets.LightCurve.ScatterPlot";
171
- const yt = W;
173
+ const bt = W;
172
174
  export {
173
- yt as default
175
+ bt as default
174
176
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={xMin:-10,xMax:50,xStep:10,yStep:.5,yMin:14,yMax:20,width:600,height:600,gaussianMin:-4,gaussianMax:4,gaussianStep:.01,gaussianWidth:-2,yOffsetMin:-50,yOffsetMax:50,yOffsetStep:.1,yOffset:-2},t=e;exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={xMin:-10,xMax:50,xStep:10,yStep:-.5,yMin:20,yMax:14,width:600,height:600,gaussianMin:-4,gaussianMax:4,gaussianStep:.01,gaussianWidth:-2,yOffsetMin:-50,yOffsetMax:50,yOffsetStep:.1,yOffset:-2},t=e;exports.default=t;
@@ -2,9 +2,9 @@ const s = {
2
2
  xMin: -10,
3
3
  xMax: 50,
4
4
  xStep: 10,
5
- yStep: 0.5,
6
- yMin: 14,
7
- yMax: 20,
5
+ yStep: -0.5,
6
+ yMin: 20,
7
+ yMax: 14,
8
8
  width: 600,
9
9
  height: 600,
10
10
  gaussianMin: -4,
@@ -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.7",
4
4
  "description": "Rubin Observatory Education & Public Outreach team React scientific and educational widgets.",
5
5
  "author": "Rubin EPO",
6
6
  "license": "MIT",