@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.
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),y=require("react"),Q=require("react-i18next"),U=require("use-resize-observer"),X=require("lodash/round"),F=require("@rubin-epo/epo-react-lib/styles"),Y=require("./layout/Controls/index.cjs"),Z=require("./charts/ScatterPlot/index.cjs"),ee=require("./atomic/Button/patterns/Reset.cjs");require("./atomic/PlotWrapper/index.cjs");const te=require("./charts/Readout/index.cjs"),se=require("./charts/PathFromPoints/index.cjs"),u=require("./lib/utils.cjs"),ie=require("./lib/helpers.cjs"),re=require("./widgets/IsochronePlot/Controls/index.cjs"),i=require("./widgets/IsochronePlot/defaults.cjs"),ne=require("./widgets/IsochronePlot/A11Y/CurveFit.cjs"),oe=require("./atomic/PlotWrapper/styles.cjs"),W=e=>e&&e.__esModule?e:{default:e},ae=W(U),le=W(X),ue=e=>e?e<parseFloat(F.token("BREAK_PHABLET_MIN"))?i.default.pointRadius.md:e<parseFloat(F.token("BREAK_LARGE_TABLET"))?i.default.pointRadius.sm:i.default.pointRadius.lg:i.default.pointRadius.lg,ce=({data:e,value:D,ageLibrary:I,isDisplayOnly:M=!1,isLoading:P,xAxis:k,yAxis:T,name:$,onChangeCallback:c})=>{const{ref:B,width:E}=ae.default(),{t:d,i18n:{language:x}}=Q.useTranslation(),[K,O]=y.useState(!0),h=y.useId(),n=!P&&!K,w={top:0,right:0,bottom:20,left:20},{width:f,height:g}=i.default,{ages:q={}}=I,s=Object.keys(q).sort((r,l)=>parseFloat(r)-parseFloat(l)).map(parseFloat),z=u.mergeWithDefaults(k,{...i.default.xAxis,label:d("isochrone_plot.plot.x_label")}),_=u.mergeWithDefaults(T,{...i.default.yAxis,label:d("isochrone_plot.plot.y_label")}),o={age:{min:s.length>0?Math.min(...s):0,max:s.length>0?Math.max(...s):0,step:le.default(s[1]-s[0],1)||.5,marks:s},distance:{min:0,max:_.min+1,step:.05}},b={age:s.length>0?u.middle(s):0,distance:(o.distance.max-o.distance.min)/2+o.distance.min},{age:a,distance:p}=u.mergeWithDefaults(D,b),H=ue(E),R={age:a.toLocaleString(x,{minimumFractionDigits:1}),distance:ie.parsecsToLightyears(Math.pow(10,p/5+1)).toLocaleString(x,{maximumFractionDigits:0})},S=t.jsx(oe.PlotWrapper,{ref:B,children:t.jsx(Z.default,{renderer:"canvas",title:$,onLoadedCallback:()=>O(!1),data:{label:"Star Cluster",points:e.map(r=>({...r,radius:H,stroke:"rgba(18,114,108,0.5)",fill:"rgba(18,114,108,0.25)"}))},plotChildren:({Data:r,xScale:l,yScale:m,yStart:V,yEnd:j,xStart:v,xEnd:C,yDomain:G})=>{const A=(q[a.toFixed(1)]||[]).map(({x:N,y:J})=>({x:l(N),y:m(J)}))||[],L=m(p+G[1]);return t.jsxs(t.Fragment,{children:[r,a&&t.jsx(se.default,{points:A,svgProps:{strokeWidth:2,transform:`translate(0,${L})`}}),n&&t.jsx(te.default,{viewport:{x:v,y:j,outerHeight:V-j,outerWidth:C-v,innerWidth:f,innerHeight:g},position:"center right",forIds:h,forScreenreaders:t.jsx(ne.default,{points:e,value:R,isochrone:A,offset:L,xScale:l,yScale:m,width:f,height:g}),children:d("isochrone_plot.output",{...R})})]})},width:f,height:g,xAxis:z,yAxis:_,margins:w})});return t.jsx(Y.default,{ratio:{portrait:2/3,landscape:3/2},widget:S,controls:t.jsx(re.default,{isDisabled:!n,value:{age:a,distance:p},configs:o,onChangeCallback:c}),actions:t.jsx(ee.default,{isDisabled:!n,onResetCallback:()=>{c&&c(b)}}),isLoading:!n,isDisplayOnly:M,controlsId:h})};exports.default=ce;
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;
@@ -1,161 +1,163 @@
1
1
  "use client";
2
- import { jsx as o, jsxs as q, Fragment as J } from "react/jsx-runtime";
3
- import { useState as Q, useId as U } from "react";
4
- import { useTranslation as X } from "react-i18next";
5
- import Y from "use-resize-observer";
6
- import Z from "lodash/round";
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 tt from "./layout/Controls/index.js";
9
- import ot from "./charts/ScatterPlot/index.js";
10
- import et from "./atomic/Button/patterns/Reset.js";
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 it from "./charts/PathFromPoints/index.js";
14
- import { mergeWithDefaults as f, middle as st } from "./lib/utils.js";
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 e from "./widgets/IsochronePlot/defaults.js";
16
+ import i from "./widgets/IsochronePlot/defaults.js";
18
17
  import mt from "./widgets/IsochronePlot/A11Y/CurveFit.js";
19
- import { PlotWrapper as lt } from "./atomic/PlotWrapper/styles.js";
20
- const pt = (r) => r ? r < parseFloat(W("BREAK_PHABLET_MIN")) ? e.pointRadius.md : r < parseFloat(W("BREAK_LARGE_TABLET")) ? e.pointRadius.sm : e.pointRadius.lg : e.pointRadius.lg, kt = ({
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: y,
23
- ageLibrary: B,
22
+ value: B,
23
+ ageLibrary: D,
24
24
  isDisplayOnly: I = !1,
25
- isLoading: k,
26
- xAxis: D,
27
- yAxis: T,
28
- name: E,
25
+ isLoading: T,
26
+ xAxis: k,
27
+ yAxis: E,
28
+ name: K,
29
29
  onChangeCallback: l
30
30
  }) => {
31
- const { ref: K, width: M } = Y(), {
32
- t: p,
33
- i18n: { language: h }
34
- } = X(), [j, w] = Q(!0), x = U(), s = !k && !j, C = { top: 0, right: 0, bottom: 20, left: 20 }, { width: c, height: d } = e, { ages: b = {} } = B, t = Object.keys(b).sort(
35
- (i, m) => parseFloat(i) - parseFloat(m)
36
- ).map(parseFloat), H = f(D, {
37
- ...e.xAxis,
38
- label: p("isochrone_plot.plot.x_label")
39
- }), R = f(T, {
40
- ...e.yAxis,
41
- label: p("isochrone_plot.plot.y_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: t.length > 0 ? Math.min(...t) : 0,
45
- max: t.length > 0 ? Math.max(...t) : 0,
46
- step: Z(t[1] - t[0], 1) || 0.5,
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: t.length > 0 ? st(t) : 0,
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 } = f(
54
- y,
52
+ }, { age: a, distance: u } = h(
53
+ B,
55
54
  A
56
- ), V = pt(M), F = {
57
- age: a.toLocaleString(h, {
58
- minimumFractionDigits: 1
55
+ ), w = dt(z), g = {
56
+ age: (t) => lt(t).toLocaleString(x, {
57
+ minimumFractionDigits: 3,
58
+ maximumFractionDigits: 3
59
59
  }),
60
- distance: nt(
61
- Math.pow(10, u / 5 + 1)
62
- ).toLocaleString(h, {
60
+ distance: (t) => ct(t).toLocaleString(x, {
63
61
  maximumFractionDigits: 0
64
62
  })
65
- }, z = /* @__PURE__ */ o(lt, { ref: K, children: /* @__PURE__ */ o(
66
- ot,
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: E,
70
- onLoadedCallback: () => w(!1),
70
+ title: K,
71
+ onLoadedCallback: () => H(!1),
71
72
  data: {
72
73
  label: "Star Cluster",
73
- points: r.map((i) => ({
74
- ...i,
75
- radius: V,
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: i,
82
+ Data: t,
82
83
  xScale: m,
83
- yScale: g,
84
+ yScale: f,
84
85
  yStart: O,
85
- yEnd: L,
86
- xStart: P,
86
+ yEnd: P,
87
+ xStart: _,
87
88
  xEnd: S,
88
- yDomain: G
89
+ yDomain: N
89
90
  }) => {
90
- const _ = (b[a.toFixed(1)] || []).map(({ x: N, y: $ }) => ({ x: m(N), y: g($) })) || [], v = g(u + G[1]);
91
- return /* @__PURE__ */ q(J, { children: [
92
- i,
93
- a && /* @__PURE__ */ o(
94
- it,
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,${v})`
100
+ transform: `translate(0,${y})`
100
101
  }
101
102
  }
102
103
  ),
103
- s && /* @__PURE__ */ o(
104
+ s && /* @__PURE__ */ e(
104
105
  rt,
105
106
  {
106
107
  viewport: {
107
- x: P,
108
- y: L,
109
- outerHeight: O - L,
110
- outerWidth: S - P,
111
- innerWidth: c,
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: x,
116
- forScreenreaders: /* @__PURE__ */ o(
116
+ forIds: b,
117
+ forScreenreaders: /* @__PURE__ */ e(
117
118
  mt,
118
119
  {
119
120
  points: r,
120
- value: F,
121
- isochrone: _,
122
- offset: v,
121
+ value: L,
122
+ isochrone: v,
123
+ offset: y,
123
124
  xScale: m,
124
- yScale: g,
125
- width: c,
125
+ yScale: f,
126
+ width: p,
126
127
  height: d
127
128
  }
128
129
  ),
129
- children: p("isochrone_plot.output", {
130
- ...F
130
+ children: c("isochrone_plot.output", {
131
+ ...L
131
132
  })
132
133
  }
133
134
  )
134
135
  ] });
135
136
  },
136
- width: c,
137
+ width: p,
137
138
  height: d,
138
- xAxis: H,
139
+ xAxis: V,
139
140
  yAxis: R,
140
- margins: C
141
+ margins: M
141
142
  }
142
143
  ) });
143
- return /* @__PURE__ */ o(
144
- tt,
144
+ return /* @__PURE__ */ e(
145
+ ot,
145
146
  {
146
147
  ratio: { portrait: 2 / 3, landscape: 3 / 2 },
147
- widget: z,
148
- controls: /* @__PURE__ */ o(
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__ */ o(
158
- et,
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: x
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"),P=require("react"),E=require("./ErrorBar.cjs"),$=require("../defaults.cjs"),l=({data:r,label:a,xScale:t,yScale:s,onHoverCallback:i,onHoverOutCallback:n,onLoadedCallback:o,className:c})=>(P.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:g,y:x,description:h,error:u,id:q,props:M}={...$.default.point,...d};return e.jsxs("g",{role:"listitem","aria-label":h,transform:`translate(${t(g)},${s(x)})`,onMouseEnter:()=>i&&i(f),onMouseLeave:()=>n&&n(),children:[u&&e.jsx(E.default,{error:u,xScale:t,yScale:s}),e.jsx("circle",{cursor:"pointer",r:m,stroke:p,fill:j,...M})]},q)})}));l.displayName="Charts.Points";const y=l;exports.default=y;
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 j } from "react/jsx-runtime";
3
- import { useEffect as M } from "react";
4
- import y from "./ErrorBar.js";
5
- import B from "../defaults.js";
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: s,
10
- yScale: e,
11
- onHoverCallback: i,
9
+ xScale: e,
10
+ yScale: i,
11
+ onHoverCallback: s,
12
12
  onHoverOutCallback: o,
13
13
  onLoadedCallback: n,
14
14
  className: f
15
- }) => (M(() => {
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 { stroke: c, fill: d, radius: h, x: g, y: x, description: E, error: l, id: P, props: $ } = {
19
- ...B.point,
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__ */ j(
33
+ return /* @__PURE__ */ M(
23
34
  "g",
24
35
  {
25
36
  role: "listitem",
26
37
  "aria-label": E,
27
- transform: `translate(${s(g)},${e(x)})`,
28
- onMouseEnter: () => i && i(a),
38
+ transform: `translate(${e(x)},${i(g)})`,
39
+ onMouseEnter: () => s && s(a),
29
40
  onMouseLeave: () => o && o(),
30
41
  children: [
31
- l && /* @__PURE__ */ r(y, { error: l, xScale: s, yScale: e }),
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 A = m;
59
+ const D = m;
49
60
  export {
50
- A as default
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"),b=require("../../../atomic/ControlLabel/index.cjs"),p=require("react-i18next"),x=t=>t&&t.__esModule?t:{default:t},f=x(_),a=({value:t,onChangeCallback:r,configs:s,isDisabled:u=!1})=>{const{t:n}=p.useTranslation(),i=(e,l)=>{r&&r({...t,[e]:l})},c={isDisabled:u,color:"var(--turquoise85, #12726D)"};return o.jsx(o.Fragment,{children:Object.keys(s).map(e=>o.jsx(b.default,{label:n(`isochrone_plot.controls.${e}.label`),input:l=>o.jsx(f.default,{labelledbyId:l,value:t[e],ariaValuetext:n(`isochrone_plot.controls.${e}.textValue`,{value:t[e]})||void 0,onChangeCallback:d=>i(e,d),...c,...s[e]}),labelBy:!0},e))})};a.displayName="Widgets.IsochronePlot.Controls";const h=a;exports.default=h;
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 l, Fragment as u } from "react/jsx-runtime";
3
- import d from "@rubin-epo/epo-react-lib/HorizontalSlider";
4
- import b from "../../../atomic/ControlLabel/index.js";
5
- import { useTranslation as h } from "react-i18next";
6
- const a = ({
7
- value: t,
8
- onChangeCallback: e,
9
- configs: n,
10
- isDisabled: i = !1
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 } = h(), c = (o, r) => {
13
- e && e({ ...t, [o]: r });
14
- }, m = {
15
- isDisabled: i,
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__ */ l(u, { children: Object.keys(n).map((o) => /* @__PURE__ */ l(
19
- b,
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: (r) => /* @__PURE__ */ l(
23
- d,
23
+ input: (t) => /* @__PURE__ */ e(
24
+ b,
24
25
  {
25
- labelledbyId: r,
26
- value: t[o],
26
+ labelledbyId: t,
27
+ value: r[o],
27
28
  ariaValuetext: s(`isochrone_plot.controls.${o}.textValue`, {
28
- value: t[o]
29
+ value: r[o]
29
30
  }) || void 0,
30
- onChangeCallback: (p) => c(o, p),
31
- ...m,
32
- ...n[o]
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
- a.displayName = "Widgets.IsochronePlot.Controls";
41
- const g = a;
42
+ i.displayName = "Widgets.IsochronePlot.Controls";
43
+ const j = i;
42
44
  export {
43
- g as default
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;
@@ -0,0 +1,2 @@
1
+ export declare const ageToGyrs: (age: number) => number;
2
+ export declare const distanceToLyrs: (distance: number) => number;
@@ -0,0 +1,6 @@
1
+ import { parsecsToLightyears as s } from "../../lib/helpers.js";
2
+ const r = (o) => Math.pow(10, o - 9), a = (o) => s(Math.pow(10, o / 5 + 1));
3
+ export {
4
+ r as ageToGyrs,
5
+ a as distanceToLyrs
6
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubin-epo/epo-widget-lib",
3
- "version": "1.0.4",
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": "^2.0.32",
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",