@rubin-epo/epo-widget-lib 1.0.4 → 1.0.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.
- package/dist/IsochronePlot.cjs +1 -1
- package/dist/IsochronePlot.js +90 -88
- package/dist/charts/Points/index.cjs +1 -1
- package/dist/charts/Points/index.js +29 -18
- package/dist/widgets/ColorTool/FilterControls/styles.d.ts +5 -0
- package/dist/widgets/IsochronePlot/Controls/index.cjs +1 -1
- package/dist/widgets/IsochronePlot/Controls/index.d.ts +1 -0
- package/dist/widgets/IsochronePlot/Controls/index.js +28 -26
- package/dist/widgets/IsochronePlot/helpers.cjs +1 -0
- package/dist/widgets/IsochronePlot/helpers.d.ts +2 -0
- package/dist/widgets/IsochronePlot/helpers.js +6 -0
- package/package.json +2 -2
package/dist/IsochronePlot.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),L=require("react"),X=require("react-i18next"),Y=require("use-resize-observer"),Z=require("lodash/round"),D=require("@rubin-epo/epo-react-lib/styles"),ee=require("./layout/Controls/index.cjs"),te=require("./charts/ScatterPlot/index.cjs"),se=require("./atomic/Button/patterns/Reset.cjs");require("./atomic/PlotWrapper/index.cjs");const ie=require("./charts/Readout/index.cjs"),re=require("./charts/PathFromPoints/index.cjs"),u=require("./lib/utils.cjs"),ne=require("./widgets/IsochronePlot/Controls/index.cjs"),r=require("./widgets/IsochronePlot/defaults.cjs"),oe=require("./widgets/IsochronePlot/A11Y/CurveFit.cjs"),W=require("./widgets/IsochronePlot/helpers.cjs"),ae=require("./atomic/PlotWrapper/styles.cjs"),I=e=>e&&e.__esModule?e:{default:e},le=I(Y),ue=I(Z),ce=e=>e?e<parseFloat(D.token("BREAK_PHABLET_MIN"))?r.default.pointRadius.md:e<parseFloat(D.token("BREAK_LARGE_TABLET"))?r.default.pointRadius.sm:r.default.pointRadius.lg:r.default.pointRadius.lg,de=({data:e,value:P,ageLibrary:T,isDisplayOnly:M=!1,isLoading:$,xAxis:k,yAxis:z,name:B,onChangeCallback:c})=>{const{ref:E,width:K}=le.default(),{t:d,i18n:{language:h}}=X.useTranslation(),[O,H]=L.useState(!0),q=L.useId(),n=!$&&!O,S={top:0,right:0,bottom:20,left:20},{width:g,height:f}=r.default,{ages:_={}}=T,i=Object.keys(_).sort((s,l)=>parseFloat(s)-parseFloat(l)).map(parseFloat),V=u.mergeWithDefaults(k,{...r.default.xAxis,label:d("isochrone_plot.plot.x_label")}),b=u.mergeWithDefaults(z,{...r.default.yAxis,label:d("isochrone_plot.plot.y_label")}),o={age:{min:i.length>0?Math.min(...i):0,max:i.length>0?Math.max(...i):0,step:ue.default(i[1]-i[0],1)||.5},distance:{min:0,max:b.min+1,step:.05}},R={age:i.length>0?u.middle(i):0,distance:(o.distance.max-o.distance.min)/2+o.distance.min},{age:a,distance:p}=u.mergeWithDefaults(P,R),w=ce(K),m={age:s=>W.ageToGyrs(s).toLocaleString(h,{minimumFractionDigits:3,maximumFractionDigits:3}),distance:s=>W.distanceToLyrs(s).toLocaleString(h,{maximumFractionDigits:0})},j={age:m.age(a),distance:m.distance(p)},G=t.jsx(ae.PlotWrapper,{ref:E,children:t.jsx(te.default,{renderer:"canvas",title:B,onLoadedCallback:()=>H(!1),data:{label:"Star Cluster",points:e.map(s=>({...s,radius:w,stroke:"rgba(18,114,108,0.5)",fill:"rgba(18,114,108,0.25)"}))},plotChildren:({Data:s,xScale:l,yScale:x,yStart:C,yEnd:v,xStart:y,xEnd:N,yDomain:J})=>{const A=(_[a.toFixed(1)]||[]).map(({x:Q,y:U})=>({x:l(Q),y:x(U)}))||[],F=x(p+J[1]);return t.jsxs(t.Fragment,{children:[s,a&&t.jsx(re.default,{points:A,svgProps:{strokeWidth:2,transform:`translate(0,${F})`}}),n&&t.jsx(ie.default,{viewport:{x:y,y:v,outerHeight:C-v,outerWidth:N-y,innerWidth:g,innerHeight:f},position:"center right",forIds:q,forScreenreaders:t.jsx(oe.default,{points:e,value:j,isochrone:A,offset:F,xScale:l,yScale:x,width:g,height:f}),children:d("isochrone_plot.output",{...j})})]})},width:g,height:f,xAxis:V,yAxis:b,margins:S})});return t.jsx(ee.default,{ratio:{portrait:2/3,landscape:3/2},widget:G,controls:t.jsx(ne.default,{isDisabled:!n,value:{age:a,distance:p},localizers:m,configs:o,onChangeCallback:c}),actions:t.jsx(se.default,{isDisabled:!n,onResetCallback:()=>{c&&c(R)}}),isLoading:!n,isDisplayOnly:M,controlsId:q})};exports.default=de;
|
package/dist/IsochronePlot.js
CHANGED
|
@@ -1,161 +1,163 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
2
|
+
import { jsx as e, jsxs as J, Fragment as Q } from "react/jsx-runtime";
|
|
3
|
+
import { useState as U, useId as X } from "react";
|
|
4
|
+
import { useTranslation as Y } from "react-i18next";
|
|
5
|
+
import Z from "use-resize-observer";
|
|
6
|
+
import tt from "lodash/round";
|
|
7
7
|
import { token as W } from "@rubin-epo/epo-react-lib/styles";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
8
|
+
import ot from "./layout/Controls/index.js";
|
|
9
|
+
import et from "./charts/ScatterPlot/index.js";
|
|
10
|
+
import it from "./atomic/Button/patterns/Reset.js";
|
|
11
11
|
import "./atomic/PlotWrapper/index.js";
|
|
12
12
|
import rt from "./charts/Readout/index.js";
|
|
13
|
-
import
|
|
14
|
-
import { mergeWithDefaults as
|
|
15
|
-
import { parsecsToLightyears as nt } from "./lib/helpers.js";
|
|
13
|
+
import st from "./charts/PathFromPoints/index.js";
|
|
14
|
+
import { mergeWithDefaults as h, middle as nt } from "./lib/utils.js";
|
|
16
15
|
import at from "./widgets/IsochronePlot/Controls/index.js";
|
|
17
|
-
import
|
|
16
|
+
import i from "./widgets/IsochronePlot/defaults.js";
|
|
18
17
|
import mt from "./widgets/IsochronePlot/A11Y/CurveFit.js";
|
|
19
|
-
import {
|
|
20
|
-
|
|
18
|
+
import { ageToGyrs as lt, distanceToLyrs as ct } from "./widgets/IsochronePlot/helpers.js";
|
|
19
|
+
import { PlotWrapper as pt } from "./atomic/PlotWrapper/styles.js";
|
|
20
|
+
const dt = (r) => r ? r < parseFloat(W("BREAK_PHABLET_MIN")) ? i.pointRadius.md : r < parseFloat(W("BREAK_LARGE_TABLET")) ? i.pointRadius.sm : i.pointRadius.lg : i.pointRadius.lg, kt = ({
|
|
21
21
|
data: r,
|
|
22
|
-
value:
|
|
23
|
-
ageLibrary:
|
|
22
|
+
value: B,
|
|
23
|
+
ageLibrary: D,
|
|
24
24
|
isDisplayOnly: I = !1,
|
|
25
|
-
isLoading:
|
|
26
|
-
xAxis:
|
|
27
|
-
yAxis:
|
|
28
|
-
name:
|
|
25
|
+
isLoading: T,
|
|
26
|
+
xAxis: k,
|
|
27
|
+
yAxis: E,
|
|
28
|
+
name: K,
|
|
29
29
|
onChangeCallback: l
|
|
30
30
|
}) => {
|
|
31
|
-
const { ref:
|
|
32
|
-
t:
|
|
33
|
-
i18n: { language:
|
|
34
|
-
} =
|
|
35
|
-
(
|
|
36
|
-
).map(parseFloat),
|
|
37
|
-
...
|
|
38
|
-
label:
|
|
39
|
-
}), R =
|
|
40
|
-
...
|
|
41
|
-
label:
|
|
31
|
+
const { ref: j, width: z } = Z(), {
|
|
32
|
+
t: c,
|
|
33
|
+
i18n: { language: x }
|
|
34
|
+
} = Y(), [C, H] = U(!0), b = X(), s = !T && !C, M = { top: 0, right: 0, bottom: 20, left: 20 }, { width: p, height: d } = i, { ages: F = {} } = D, o = Object.keys(F).sort(
|
|
35
|
+
(t, m) => parseFloat(t) - parseFloat(m)
|
|
36
|
+
).map(parseFloat), V = h(k, {
|
|
37
|
+
...i.xAxis,
|
|
38
|
+
label: c("isochrone_plot.plot.x_label")
|
|
39
|
+
}), R = h(E, {
|
|
40
|
+
...i.yAxis,
|
|
41
|
+
label: c("isochrone_plot.plot.y_label")
|
|
42
42
|
}), n = {
|
|
43
43
|
age: {
|
|
44
|
-
min:
|
|
45
|
-
max:
|
|
46
|
-
step:
|
|
47
|
-
marks: t
|
|
44
|
+
min: o.length > 0 ? Math.min(...o) : 0,
|
|
45
|
+
max: o.length > 0 ? Math.max(...o) : 0,
|
|
46
|
+
step: tt(o[1] - o[0], 1) || 0.5
|
|
48
47
|
},
|
|
49
48
|
distance: { min: 0, max: R.min + 1, step: 0.05 }
|
|
50
49
|
}, A = {
|
|
51
|
-
age:
|
|
50
|
+
age: o.length > 0 ? nt(o) : 0,
|
|
52
51
|
distance: (n.distance.max - n.distance.min) / 2 + n.distance.min
|
|
53
|
-
}, { age: a, distance: u } =
|
|
54
|
-
|
|
52
|
+
}, { age: a, distance: u } = h(
|
|
53
|
+
B,
|
|
55
54
|
A
|
|
56
|
-
),
|
|
57
|
-
age:
|
|
58
|
-
minimumFractionDigits:
|
|
55
|
+
), w = dt(z), g = {
|
|
56
|
+
age: (t) => lt(t).toLocaleString(x, {
|
|
57
|
+
minimumFractionDigits: 3,
|
|
58
|
+
maximumFractionDigits: 3
|
|
59
59
|
}),
|
|
60
|
-
distance:
|
|
61
|
-
Math.pow(10, u / 5 + 1)
|
|
62
|
-
).toLocaleString(h, {
|
|
60
|
+
distance: (t) => ct(t).toLocaleString(x, {
|
|
63
61
|
maximumFractionDigits: 0
|
|
64
62
|
})
|
|
65
|
-
},
|
|
66
|
-
|
|
63
|
+
}, L = {
|
|
64
|
+
age: g.age(a),
|
|
65
|
+
distance: g.distance(u)
|
|
66
|
+
}, G = /* @__PURE__ */ e(pt, { ref: j, children: /* @__PURE__ */ e(
|
|
67
|
+
et,
|
|
67
68
|
{
|
|
68
69
|
renderer: "canvas",
|
|
69
|
-
title:
|
|
70
|
-
onLoadedCallback: () =>
|
|
70
|
+
title: K,
|
|
71
|
+
onLoadedCallback: () => H(!1),
|
|
71
72
|
data: {
|
|
72
73
|
label: "Star Cluster",
|
|
73
|
-
points: r.map((
|
|
74
|
-
...
|
|
75
|
-
radius:
|
|
74
|
+
points: r.map((t) => ({
|
|
75
|
+
...t,
|
|
76
|
+
radius: w,
|
|
76
77
|
stroke: "rgba(18,114,108,0.5)",
|
|
77
78
|
fill: "rgba(18,114,108,0.25)"
|
|
78
79
|
}))
|
|
79
80
|
},
|
|
80
81
|
plotChildren: ({
|
|
81
|
-
Data:
|
|
82
|
+
Data: t,
|
|
82
83
|
xScale: m,
|
|
83
|
-
yScale:
|
|
84
|
+
yScale: f,
|
|
84
85
|
yStart: O,
|
|
85
|
-
yEnd:
|
|
86
|
-
xStart:
|
|
86
|
+
yEnd: P,
|
|
87
|
+
xStart: _,
|
|
87
88
|
xEnd: S,
|
|
88
|
-
yDomain:
|
|
89
|
+
yDomain: N
|
|
89
90
|
}) => {
|
|
90
|
-
const
|
|
91
|
-
return /* @__PURE__ */
|
|
92
|
-
|
|
93
|
-
a && /* @__PURE__ */
|
|
94
|
-
|
|
91
|
+
const v = (F[a.toFixed(1)] || []).map(({ x: $, y: q }) => ({ x: m($), y: f(q) })) || [], y = f(u + N[1]);
|
|
92
|
+
return /* @__PURE__ */ J(Q, { children: [
|
|
93
|
+
t,
|
|
94
|
+
a && /* @__PURE__ */ e(
|
|
95
|
+
st,
|
|
95
96
|
{
|
|
96
|
-
points:
|
|
97
|
+
points: v,
|
|
97
98
|
svgProps: {
|
|
98
99
|
strokeWidth: 2,
|
|
99
|
-
transform: `translate(0,${
|
|
100
|
+
transform: `translate(0,${y})`
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
),
|
|
103
|
-
s && /* @__PURE__ */
|
|
104
|
+
s && /* @__PURE__ */ e(
|
|
104
105
|
rt,
|
|
105
106
|
{
|
|
106
107
|
viewport: {
|
|
107
|
-
x:
|
|
108
|
-
y:
|
|
109
|
-
outerHeight: O -
|
|
110
|
-
outerWidth: S -
|
|
111
|
-
innerWidth:
|
|
108
|
+
x: _,
|
|
109
|
+
y: P,
|
|
110
|
+
outerHeight: O - P,
|
|
111
|
+
outerWidth: S - _,
|
|
112
|
+
innerWidth: p,
|
|
112
113
|
innerHeight: d
|
|
113
114
|
},
|
|
114
115
|
position: "center right",
|
|
115
|
-
forIds:
|
|
116
|
-
forScreenreaders: /* @__PURE__ */
|
|
116
|
+
forIds: b,
|
|
117
|
+
forScreenreaders: /* @__PURE__ */ e(
|
|
117
118
|
mt,
|
|
118
119
|
{
|
|
119
120
|
points: r,
|
|
120
|
-
value:
|
|
121
|
-
isochrone:
|
|
122
|
-
offset:
|
|
121
|
+
value: L,
|
|
122
|
+
isochrone: v,
|
|
123
|
+
offset: y,
|
|
123
124
|
xScale: m,
|
|
124
|
-
yScale:
|
|
125
|
-
width:
|
|
125
|
+
yScale: f,
|
|
126
|
+
width: p,
|
|
126
127
|
height: d
|
|
127
128
|
}
|
|
128
129
|
),
|
|
129
|
-
children:
|
|
130
|
-
...
|
|
130
|
+
children: c("isochrone_plot.output", {
|
|
131
|
+
...L
|
|
131
132
|
})
|
|
132
133
|
}
|
|
133
134
|
)
|
|
134
135
|
] });
|
|
135
136
|
},
|
|
136
|
-
width:
|
|
137
|
+
width: p,
|
|
137
138
|
height: d,
|
|
138
|
-
xAxis:
|
|
139
|
+
xAxis: V,
|
|
139
140
|
yAxis: R,
|
|
140
|
-
margins:
|
|
141
|
+
margins: M
|
|
141
142
|
}
|
|
142
143
|
) });
|
|
143
|
-
return /* @__PURE__ */
|
|
144
|
-
|
|
144
|
+
return /* @__PURE__ */ e(
|
|
145
|
+
ot,
|
|
145
146
|
{
|
|
146
147
|
ratio: { portrait: 2 / 3, landscape: 3 / 2 },
|
|
147
|
-
widget:
|
|
148
|
-
controls: /* @__PURE__ */
|
|
148
|
+
widget: G,
|
|
149
|
+
controls: /* @__PURE__ */ e(
|
|
149
150
|
at,
|
|
150
151
|
{
|
|
151
152
|
isDisabled: !s,
|
|
152
153
|
value: { age: a, distance: u },
|
|
154
|
+
localizers: g,
|
|
153
155
|
configs: n,
|
|
154
156
|
onChangeCallback: l
|
|
155
157
|
}
|
|
156
158
|
),
|
|
157
|
-
actions: /* @__PURE__ */
|
|
158
|
-
|
|
159
|
+
actions: /* @__PURE__ */ e(
|
|
160
|
+
it,
|
|
159
161
|
{
|
|
160
162
|
isDisabled: !s,
|
|
161
163
|
onResetCallback: () => {
|
|
@@ -165,7 +167,7 @@ const pt = (r) => r ? r < parseFloat(W("BREAK_PHABLET_MIN")) ? e.pointRadius.md
|
|
|
165
167
|
),
|
|
166
168
|
isLoading: !s,
|
|
167
169
|
isDisplayOnly: I,
|
|
168
|
-
controlsId:
|
|
170
|
+
controlsId: b
|
|
169
171
|
}
|
|
170
172
|
);
|
|
171
173
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),E=require("react"),$=require("./ErrorBar.cjs"),y=require("../defaults.cjs"),l=({data:r,label:a,xScale:t,yScale:s,onHoverCallback:i,onHoverOutCallback:n,onLoadedCallback:o,className:c})=>(E.useEffect(()=>{o&&o()},[]),r.length===0?null:e.jsx("g",{role:"list","aria-label":a,className:c,children:r.map((d,f)=>{const{stroke:p,fill:j,radius:m,x,y:g,description:h,error:u,id:q,index:M,props:P}={...y.default.point,...d};return e.jsxs("g",{role:"listitem","aria-label":h,transform:`translate(${t(x)},${s(g)})`,onMouseEnter:()=>i&&i(f),onMouseLeave:()=>n&&n(),children:[u&&e.jsx($.default,{error:u,xScale:t,yScale:s}),e.jsx("circle",{cursor:"pointer",r:m,stroke:p,fill:j,...P})]},q||M)})}));l.displayName="Charts.Points";const _=l;exports.default=_;
|
|
@@ -1,34 +1,45 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as r, jsxs as
|
|
3
|
-
import { useEffect as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import { jsx as r, jsxs as M } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect as y } from "react";
|
|
4
|
+
import B from "./ErrorBar.js";
|
|
5
|
+
import N from "../defaults.js";
|
|
6
6
|
const m = ({
|
|
7
7
|
data: t,
|
|
8
8
|
label: p,
|
|
9
|
-
xScale:
|
|
10
|
-
yScale:
|
|
11
|
-
onHoverCallback:
|
|
9
|
+
xScale: e,
|
|
10
|
+
yScale: i,
|
|
11
|
+
onHoverCallback: s,
|
|
12
12
|
onHoverOutCallback: o,
|
|
13
13
|
onLoadedCallback: n,
|
|
14
14
|
className: f
|
|
15
|
-
}) => (
|
|
15
|
+
}) => (y(() => {
|
|
16
16
|
n && n();
|
|
17
17
|
}, []), t.length === 0 ? null : /* @__PURE__ */ r("g", { role: "list", "aria-label": p, className: f, children: t.map((u, a) => {
|
|
18
|
-
const {
|
|
19
|
-
|
|
18
|
+
const {
|
|
19
|
+
stroke: c,
|
|
20
|
+
fill: d,
|
|
21
|
+
radius: h,
|
|
22
|
+
x,
|
|
23
|
+
y: g,
|
|
24
|
+
description: E,
|
|
25
|
+
error: l,
|
|
26
|
+
id: P,
|
|
27
|
+
index: $,
|
|
28
|
+
props: j
|
|
29
|
+
} = {
|
|
30
|
+
...N.point,
|
|
20
31
|
...u
|
|
21
32
|
};
|
|
22
|
-
return /* @__PURE__ */
|
|
33
|
+
return /* @__PURE__ */ M(
|
|
23
34
|
"g",
|
|
24
35
|
{
|
|
25
36
|
role: "listitem",
|
|
26
37
|
"aria-label": E,
|
|
27
|
-
transform: `translate(${
|
|
28
|
-
onMouseEnter: () =>
|
|
38
|
+
transform: `translate(${e(x)},${i(g)})`,
|
|
39
|
+
onMouseEnter: () => s && s(a),
|
|
29
40
|
onMouseLeave: () => o && o(),
|
|
30
41
|
children: [
|
|
31
|
-
l && /* @__PURE__ */ r(
|
|
42
|
+
l && /* @__PURE__ */ r(B, { error: l, xScale: e, yScale: i }),
|
|
32
43
|
/* @__PURE__ */ r(
|
|
33
44
|
"circle",
|
|
34
45
|
{
|
|
@@ -36,16 +47,16 @@ const m = ({
|
|
|
36
47
|
r: h,
|
|
37
48
|
stroke: c,
|
|
38
49
|
fill: d,
|
|
39
|
-
|
|
50
|
+
...j
|
|
40
51
|
}
|
|
41
52
|
)
|
|
42
53
|
]
|
|
43
54
|
},
|
|
44
|
-
P
|
|
55
|
+
P || $
|
|
45
56
|
);
|
|
46
57
|
}) }));
|
|
47
58
|
m.displayName = "Charts.Points";
|
|
48
|
-
const
|
|
59
|
+
const D = m;
|
|
49
60
|
export {
|
|
50
|
-
|
|
61
|
+
D as default
|
|
51
62
|
};
|
|
@@ -1238,6 +1238,11 @@ export declare const Slider: import('styled-components').IStyledComponent<"web",
|
|
|
1238
1238
|
color?: string | undefined;
|
|
1239
1239
|
darkMode?: boolean | undefined;
|
|
1240
1240
|
isDisabled?: boolean | undefined;
|
|
1241
|
+
renderLabel?: ((state: {
|
|
1242
|
+
index: number;
|
|
1243
|
+
value: number | readonly number[];
|
|
1244
|
+
valueNow: number;
|
|
1245
|
+
}) => import('react').ReactNode) | undefined;
|
|
1241
1246
|
className?: string | undefined;
|
|
1242
1247
|
defaultValue?: number | readonly number[] | undefined;
|
|
1243
1248
|
value?: number | readonly number[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),_=require("@rubin-epo/epo-react-lib/HorizontalSlider"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),_=require("@rubin-epo/epo-react-lib/HorizontalSlider"),p=require("../../../atomic/ControlLabel/index.cjs"),x=require("react-i18next"),f=t=>t&&t.__esModule?t:{default:t},h=f(_),u=({value:t,onChangeCallback:n,configs:s,localizers:i,isDisabled:c=!1})=>{const{t:a}=x.useTranslation(),d=(e,l)=>{n&&n({...t,[e]:l})},b={isDisabled:c,color:"var(--turquoise85, #12726D)"};return o.jsx(o.Fragment,{children:Object.keys(s).map(e=>o.jsx(p.default,{label:a(`isochrone_plot.controls.${e}.label`),input:l=>o.jsx(h.default,{labelledbyId:l,value:t[e],ariaValuetext:a(`isochrone_plot.controls.${e}.textValue`,{value:t[e]})||void 0,renderLabel:({valueNow:r})=>i[e](r),onChangeCallback:r=>d(e,r),...b,...s[e]}),labelBy:!0},e))})};u.displayName="Widgets.IsochronePlot.Controls";const j=u;exports.default=j;
|
|
@@ -10,6 +10,7 @@ interface Config {
|
|
|
10
10
|
type Props = {
|
|
11
11
|
value: Required<IsochroneValue>;
|
|
12
12
|
configs: Record<keyof IsochroneValue, Config>;
|
|
13
|
+
localizers: Record<keyof IsochroneValue, (value: number) => string>;
|
|
13
14
|
onChangeCallback?: (value: IsochroneValue) => void;
|
|
14
15
|
isDisabled?: boolean;
|
|
15
16
|
};
|
|
@@ -1,35 +1,37 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { useTranslation as
|
|
6
|
-
const
|
|
7
|
-
value:
|
|
8
|
-
onChangeCallback:
|
|
9
|
-
configs:
|
|
10
|
-
|
|
2
|
+
import { jsx as e, Fragment as u } from "react/jsx-runtime";
|
|
3
|
+
import b from "@rubin-epo/epo-react-lib/HorizontalSlider";
|
|
4
|
+
import h from "../../../atomic/ControlLabel/index.js";
|
|
5
|
+
import { useTranslation as f } from "react-i18next";
|
|
6
|
+
const i = ({
|
|
7
|
+
value: r,
|
|
8
|
+
onChangeCallback: n,
|
|
9
|
+
configs: a,
|
|
10
|
+
localizers: c,
|
|
11
|
+
isDisabled: d = !1
|
|
11
12
|
}) => {
|
|
12
|
-
const { t: s } =
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
isDisabled:
|
|
13
|
+
const { t: s } = f(), m = (o, t) => {
|
|
14
|
+
n && n({ ...r, [o]: t });
|
|
15
|
+
}, p = {
|
|
16
|
+
isDisabled: d,
|
|
16
17
|
color: "var(--turquoise85, #12726D)"
|
|
17
18
|
};
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
|
|
19
|
+
return /* @__PURE__ */ e(u, { children: Object.keys(a).map((o) => /* @__PURE__ */ e(
|
|
20
|
+
h,
|
|
20
21
|
{
|
|
21
22
|
label: s(`isochrone_plot.controls.${o}.label`),
|
|
22
|
-
input: (
|
|
23
|
-
|
|
23
|
+
input: (t) => /* @__PURE__ */ e(
|
|
24
|
+
b,
|
|
24
25
|
{
|
|
25
|
-
labelledbyId:
|
|
26
|
-
value:
|
|
26
|
+
labelledbyId: t,
|
|
27
|
+
value: r[o],
|
|
27
28
|
ariaValuetext: s(`isochrone_plot.controls.${o}.textValue`, {
|
|
28
|
-
value:
|
|
29
|
+
value: r[o]
|
|
29
30
|
}) || void 0,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
...
|
|
31
|
+
renderLabel: ({ valueNow: l }) => c[o](l),
|
|
32
|
+
onChangeCallback: (l) => m(o, l),
|
|
33
|
+
...p,
|
|
34
|
+
...a[o]
|
|
33
35
|
}
|
|
34
36
|
),
|
|
35
37
|
labelBy: !0
|
|
@@ -37,8 +39,8 @@ const a = ({
|
|
|
37
39
|
o
|
|
38
40
|
)) });
|
|
39
41
|
};
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
+
i.displayName = "Widgets.IsochronePlot.Controls";
|
|
43
|
+
const j = i;
|
|
42
44
|
export {
|
|
43
|
-
|
|
45
|
+
j as default
|
|
44
46
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../lib/helpers.cjs"),o=e=>Math.pow(10,e-9),t=e=>s.parsecsToLightyears(Math.pow(10,e/5+1));exports.ageToGyrs=o;exports.distanceToLyrs=t;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rubin-epo/epo-widget-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Rubin Observatory Education & Public Outreach team React scientific and educational widgets.",
|
|
5
5
|
"author": "Rubin EPO",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"react-i18next": "^12.0.0 || ^13.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@rubin-epo/epo-react-lib": "
|
|
41
|
+
"@rubin-epo/epo-react-lib": "2.1.0",
|
|
42
42
|
"context-filter-polyfill": "^0.3.6",
|
|
43
43
|
"d3-array": "^3.2.4",
|
|
44
44
|
"d3-geo": "^3.1.0",
|