@rubin-epo/epo-widget-lib 0.10.3 → 1.0.0-beta.1
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/SupernovaThreeVector.cjs +1 -1
- package/dist/SupernovaThreeVector.js +66 -66
- package/dist/atomic/Blinker/Blinker.cjs +1 -1
- package/dist/atomic/Blinker/Blinker.d.ts +2 -1
- package/dist/atomic/Blinker/Blinker.js +43 -41
- package/dist/charts/Base/styles.cjs +5 -3
- package/dist/charts/Base/styles.js +12 -10
- package/dist/charts/ScatterPlot/index.cjs +1 -1
- package/dist/charts/ScatterPlot/index.js +34 -33
- package/dist/charts/ScatterPlot/styles.cjs +3 -4
- package/dist/charts/ScatterPlot/styles.js +5 -6
- package/dist/charts/hooks/useAxis.cjs +1 -1
- package/dist/charts/hooks/useAxis.d.ts +1 -1
- package/dist/charts/hooks/useAxis.js +18 -14
- package/dist/charts/hooks/useAxis.test.d.ts +1 -0
- package/dist/localeStrings/en/epo-widget-lib.json +7 -7
- package/dist/widgets/LightCurvePlot/Plot/index.cjs +1 -1
- package/dist/widgets/LightCurvePlot/Plot/index.js +46 -62
- package/dist/widgets/LightCurvePlot/PlotWithCurve/MagnitudeSlider/index.cjs +1 -1
- package/dist/widgets/LightCurvePlot/PlotWithCurve/MagnitudeSlider/index.js +1 -1
- package/dist/widgets/LightCurvePlot/PlotWithCurve/index.cjs +1 -1
- package/dist/widgets/LightCurvePlot/PlotWithCurve/index.js +94 -80
- package/dist/widgets/LightCurvePlot/PlotWithoutCurve/index.d.ts +2 -2
- package/dist/widgets/LightCurvePlot/defaults.cjs +1 -1
- package/dist/widgets/LightCurvePlot/defaults.d.ts +1 -1
- package/dist/widgets/LightCurvePlot/defaults.js +1 -1
- package/dist/widgets/LightCurvePlot/helpers.d.ts +2 -2
- package/dist/widgets/SourceSelector/SourceSelector.cjs +1 -1
- package/dist/widgets/SourceSelector/SourceSelector.js +53 -55
- package/dist/widgets/SourceSelector/styles.cjs +2 -6
- package/dist/widgets/SourceSelector/styles.d.ts +0 -12
- package/dist/widgets/SourceSelector/styles.js +2 -8
- package/dist/widgets/SupernovaThreeVector/Histogram/index.cjs +1 -1
- package/dist/widgets/SupernovaThreeVector/Histogram/index.js +43 -43
- package/dist/widgets/SupernovaThreeVector/styles.cjs +6 -7
- package/dist/widgets/SupernovaThreeVector/styles.js +11 -12
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),q=require("react"),D=require("react-i18next"),l=require("d3-array"),E=require("@rubin-epo/epo-react-lib/HorizontalSlider"),d=require("./lib/utils.cjs"),N=require("./widgets/SupernovaThreeVector/LiveLabel/index.cjs"),r=require("./widgets/SupernovaThreeVector/styles.cjs"),P=n=>n&&n.__esModule?n:{default:n},U=P(E),R=({histogramData:n,userData:k,binnedImages:I,step:u=100})=>{const{t:x}=D.useTranslation(),h=q.useId(),i={top:30,bottom:30,left:50,right:0},o=600,y=o/1.6,L=[i.left,o-i.right],V=[y-i.bottom,i.top],g=6,p=7,v=n.map(({value:e})=>e),b=0,$=l.max(v)||Math.max(...v),m=n.map(({bin:e})=>e),c=l.min(m)||0,a=l.max(m)||Math.max(...m),j=l.nice(c,a,g),S=l.nice(b,$||b,p),f=d.getLinearScale(j,L),A=d.getLinearScale(S,V),[s,M]=q.useState([c,a]),_=15,H=`calc(${i.left/o*100}% - ${_}px)`,w=`calc(${(1-f(a)/o)*100}% - ${_}px)`,C=n.map(({bin:e})=>d.between(e,s[0],s[1])),T=k.filter(({distance:e})=>d.between(e,s[0],s[1]+u)),B=n.reduce((e,{value:O},z)=>C[z]?e+O:e,0);return t.jsxs(r.ThreeVectorContainer,{ratio:"landscape",smallScreenRatio:"portrait",children:[t.jsxs(r.ThreeVectorLayout,{children:[t.jsxs(r.HistogramContainer,{children:[t.jsx(r.ChartTitle,{children:x("supernova_three_vector.histogram.title")}),t.jsx(r.Histogram,{data:n,activeRange:s,xDomain:j,yDomain:S,xScale:f,yScale:A,yTicks:p,xTicks:g,step:u,margin:i,width:o,height:y})]}),t.jsx(r.SliderContainer,{style:{paddingInlineStart:H,paddingInlineEnd:w},children:t.jsx(U.default,{min:c,max:a,step:u,value:s,ariaValuetext:({valueNow:e})=>x("supernova_three_vector.slider.valueLabel",{value:e}),color:"var(--turquoise85,#12726D)",minLabel:`${c} Mlyr`,maxLabel:`${a} Mlyr`,onChangeCallback:e=>Array.isArray(e)&&M(e)})}),t.jsxs(r.SkymapContainer,{children:[t.jsx(r.ChartTitle,{children:x("supernova_three_vector.skymap.title")}),t.jsx(r.Skymap,{objects:T,images:I,describedById:h,visibleImages:C})]}),t.jsx(r.ResetButton,{onResetCallback:()=>M([c,a])})]}),t.jsx(N.default,{id:h,objects:T,min:s[0],max:s[1]+u,supernovaCount:B})]})};R.displayName="Widgets.SupernovaThreeVector";exports.default=R;
|
|
@@ -1,105 +1,105 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as l, jsx as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import { max as
|
|
6
|
-
import
|
|
7
|
-
import { getLinearScale as
|
|
8
|
-
import
|
|
9
|
-
import { ThreeVectorContainer as
|
|
10
|
-
const
|
|
11
|
-
histogramData:
|
|
2
|
+
import { jsxs as l, jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { useId as N, useState as U } from "react";
|
|
4
|
+
import { useTranslation as W } from "react-i18next";
|
|
5
|
+
import { max as R, min as D, nice as T } from "d3-array";
|
|
6
|
+
import F from "@rubin-epo/epo-react-lib/HorizontalSlider";
|
|
7
|
+
import { getLinearScale as k, between as V } from "./lib/utils.js";
|
|
8
|
+
import G from "./widgets/SupernovaThreeVector/LiveLabel/index.js";
|
|
9
|
+
import { ThreeVectorContainer as J, ThreeVectorLayout as K, HistogramContainer as P, ChartTitle as I, Histogram as Q, SliderContainer as X, SkymapContainer as Y, Skymap as Z, ResetButton as ee } from "./widgets/SupernovaThreeVector/styles.js";
|
|
10
|
+
const te = ({
|
|
11
|
+
histogramData: i,
|
|
12
12
|
userData: _,
|
|
13
13
|
binnedImages: $,
|
|
14
|
-
step:
|
|
14
|
+
step: c = 100
|
|
15
15
|
}) => {
|
|
16
|
-
const { t: m } =
|
|
16
|
+
const { t: m } = W(), p = N(), r = {
|
|
17
17
|
top: 30,
|
|
18
18
|
bottom: 30,
|
|
19
19
|
left: 50,
|
|
20
20
|
right: 0
|
|
21
|
-
},
|
|
22
|
-
({ bin: e }) =>
|
|
23
|
-
),
|
|
24
|
-
({ distance: e }) =>
|
|
25
|
-
),
|
|
26
|
-
return /* @__PURE__ */ l(
|
|
27
|
-
/* @__PURE__ */ l(
|
|
28
|
-
/* @__PURE__ */ l(
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
|
|
21
|
+
}, a = 600, u = a / 1.6, j = [r.left, a - r.right], A = [u - r.bottom, r.top], h = 6, x = 7, y = i.map(({ value: e }) => e), f = 0, B = R(y) || Math.max(...y), d = i.map(({ bin: e }) => e), s = D(d) || 0, o = R(d) || Math.max(...d), g = T(s, o, h), v = T(f, B || f, x), b = k(g, j), H = k(v, A), [t, S] = U([s, o]), M = 15, w = `calc(${r.left / a * 100}% - ${M}px)`, O = `calc(${(1 - b(o) / a) * 100}% - ${M}px)`, C = i.map(
|
|
22
|
+
({ bin: e }) => V(e, t[0], t[1])
|
|
23
|
+
), L = _.filter(
|
|
24
|
+
({ distance: e }) => V(e, t[0], t[1] + c)
|
|
25
|
+
), q = i.reduce((e, { value: z }, E) => C[E] ? e + z : e, 0);
|
|
26
|
+
return /* @__PURE__ */ l(J, { ratio: "landscape", smallScreenRatio: "portrait", children: [
|
|
27
|
+
/* @__PURE__ */ l(K, { children: [
|
|
28
|
+
/* @__PURE__ */ l(P, { children: [
|
|
29
|
+
/* @__PURE__ */ n(I, { children: m("supernova_three_vector.histogram.title") }),
|
|
30
|
+
/* @__PURE__ */ n(
|
|
31
|
+
Q,
|
|
32
32
|
{
|
|
33
|
-
data:
|
|
34
|
-
activeRange:
|
|
35
|
-
xDomain:
|
|
36
|
-
yDomain:
|
|
37
|
-
xScale:
|
|
38
|
-
yScale:
|
|
33
|
+
data: i,
|
|
34
|
+
activeRange: t,
|
|
35
|
+
xDomain: g,
|
|
36
|
+
yDomain: v,
|
|
37
|
+
xScale: b,
|
|
38
|
+
yScale: H,
|
|
39
39
|
yTicks: x,
|
|
40
|
-
xTicks:
|
|
41
|
-
step:
|
|
42
|
-
margin:
|
|
43
|
-
width:
|
|
44
|
-
height:
|
|
40
|
+
xTicks: h,
|
|
41
|
+
step: c,
|
|
42
|
+
margin: r,
|
|
43
|
+
width: a,
|
|
44
|
+
height: u
|
|
45
45
|
}
|
|
46
46
|
)
|
|
47
47
|
] }),
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
|
|
48
|
+
/* @__PURE__ */ n(
|
|
49
|
+
X,
|
|
50
50
|
{
|
|
51
51
|
style: {
|
|
52
|
-
paddingInlineStart:
|
|
53
|
-
paddingInlineEnd:
|
|
52
|
+
paddingInlineStart: w,
|
|
53
|
+
paddingInlineEnd: O
|
|
54
54
|
},
|
|
55
|
-
children: /* @__PURE__ */
|
|
56
|
-
|
|
55
|
+
children: /* @__PURE__ */ n(
|
|
56
|
+
F,
|
|
57
57
|
{
|
|
58
|
-
min:
|
|
59
|
-
max:
|
|
60
|
-
step:
|
|
61
|
-
value:
|
|
58
|
+
min: s,
|
|
59
|
+
max: o,
|
|
60
|
+
step: c,
|
|
61
|
+
value: t,
|
|
62
62
|
ariaValuetext: ({ valueNow: e }) => m("supernova_three_vector.slider.valueLabel", { value: e }),
|
|
63
63
|
color: "var(--turquoise85,#12726D)",
|
|
64
|
-
minLabel: `${
|
|
65
|
-
maxLabel: `${
|
|
66
|
-
onChangeCallback: (e) => Array.isArray(e) &&
|
|
64
|
+
minLabel: `${s} Mlyr`,
|
|
65
|
+
maxLabel: `${o} Mlyr`,
|
|
66
|
+
onChangeCallback: (e) => Array.isArray(e) && S(e)
|
|
67
67
|
}
|
|
68
68
|
)
|
|
69
69
|
}
|
|
70
70
|
),
|
|
71
|
-
/* @__PURE__ */ l(
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
|
|
71
|
+
/* @__PURE__ */ l(Y, { children: [
|
|
72
|
+
/* @__PURE__ */ n(I, { children: m("supernova_three_vector.skymap.title") }),
|
|
73
|
+
/* @__PURE__ */ n(
|
|
74
|
+
Z,
|
|
75
75
|
{
|
|
76
|
-
objects:
|
|
76
|
+
objects: L,
|
|
77
77
|
images: $,
|
|
78
|
-
describedById:
|
|
79
|
-
visibleImages:
|
|
78
|
+
describedById: p,
|
|
79
|
+
visibleImages: C
|
|
80
80
|
}
|
|
81
81
|
)
|
|
82
82
|
] }),
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
|
|
83
|
+
/* @__PURE__ */ n(
|
|
84
|
+
ee,
|
|
85
85
|
{
|
|
86
|
-
onResetCallback: () =>
|
|
86
|
+
onResetCallback: () => S([s, o])
|
|
87
87
|
}
|
|
88
88
|
)
|
|
89
89
|
] }),
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
|
|
90
|
+
/* @__PURE__ */ n(
|
|
91
|
+
G,
|
|
92
92
|
{
|
|
93
|
-
id:
|
|
94
|
-
objects:
|
|
95
|
-
min:
|
|
96
|
-
max:
|
|
97
|
-
supernovaCount:
|
|
93
|
+
id: p,
|
|
94
|
+
objects: L,
|
|
95
|
+
min: t[0],
|
|
96
|
+
max: t[1] + c,
|
|
97
|
+
supernovaCount: q
|
|
98
98
|
}
|
|
99
99
|
)
|
|
100
100
|
] });
|
|
101
101
|
};
|
|
102
|
-
|
|
102
|
+
te.displayName = "Widgets.SupernovaThreeVector";
|
|
103
103
|
export {
|
|
104
|
-
|
|
104
|
+
te as default
|
|
105
105
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),h=require("react"),C=require("../../lib/utils.cjs"),M=require("../../hooks/useInterval.cjs"),N=require("../ImageStack/index.cjs"),o=require("./styles.cjs"),B=({images:n=[],activeIndex:i=0,autoplay:g=!0,loop:j=!0,interval:p=200,blinkCallback:s,loadedCallback:u,className:q,showControls:y=!0,children:S,extraControls:v})=>{const[c,a]=h.useState(g),[d,k]=h.useState(!1),r=n.length>1,x=(e=0)=>{const A=n.length-1;return C.getClampedArrayIndex(i+e,A)},f=()=>{if(r){const e=x(1);j===!1&&e===n.length-1&&l(),s&&s(e)}},l=()=>{a(!1)},m=()=>{a(e=>!e)},I=()=>{l(),f()},P=()=>{l(),s&&s(x(-1))};return M.default(f,r&&d&&c?p:null),t.jsxs(o.BlinkerContainer,{className:q,children:[t.jsx(N.default,{loadCallback:()=>{k(!0),u&&u()},visible:i,images:n}),S,t.jsx(o.ControlsContainer,{children:r&&y&&t.jsxs(t.Fragment,{children:[t.jsx(o.BlinkerControls,{isDisabled:!d,playing:c,handleStartStop:m,handleNext:I,handlePrevious:P}),v]})})]})};B.displayName="Atomic.Blinker";const _=B;exports.default=_;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FunctionComponent, PropsWithChildren } from 'react';
|
|
1
|
+
import { FunctionComponent, PropsWithChildren, ReactNode } from 'react';
|
|
2
2
|
import { ImageShape } from '@rubin-epo/epo-react-lib/Image';
|
|
3
3
|
|
|
4
4
|
export interface BlinkerProps {
|
|
@@ -11,6 +11,7 @@ export interface BlinkerProps {
|
|
|
11
11
|
loadedCallback?: () => void;
|
|
12
12
|
className?: string;
|
|
13
13
|
showControls?: boolean;
|
|
14
|
+
extraControls?: ReactNode;
|
|
14
15
|
}
|
|
15
16
|
declare const Blinker: FunctionComponent<PropsWithChildren<BlinkerProps>>;
|
|
16
17
|
export default Blinker;
|
|
@@ -1,67 +1,69 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as p, jsx as s, Fragment as P } from "react/jsx-runtime";
|
|
3
3
|
import { useState as u } from "react";
|
|
4
|
-
import { getClampedArrayIndex as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { BlinkerContainer as
|
|
8
|
-
const
|
|
4
|
+
import { getClampedArrayIndex as D } from "../../lib/utils.js";
|
|
5
|
+
import F from "../../hooks/useInterval.js";
|
|
6
|
+
import L from "../ImageStack/index.js";
|
|
7
|
+
import { BlinkerContainer as $, ControlsContainer as q, BlinkerControls as w } from "./styles.js";
|
|
8
|
+
const h = ({
|
|
9
9
|
images: n = [],
|
|
10
|
-
activeIndex:
|
|
11
|
-
autoplay:
|
|
10
|
+
activeIndex: l = 0,
|
|
11
|
+
autoplay: B = !0,
|
|
12
12
|
loop: x = !0,
|
|
13
13
|
interval: g = 200,
|
|
14
14
|
blinkCallback: e,
|
|
15
|
-
loadedCallback:
|
|
15
|
+
loadedCallback: i,
|
|
16
16
|
className: k,
|
|
17
17
|
showControls: y = !0,
|
|
18
|
-
children: I
|
|
18
|
+
children: I,
|
|
19
|
+
extraControls: S
|
|
19
20
|
}) => {
|
|
20
|
-
const [
|
|
21
|
-
const
|
|
22
|
-
return
|
|
23
|
-
},
|
|
24
|
-
if (
|
|
25
|
-
const t =
|
|
26
|
-
x === !1 && t === n.length - 1 &&
|
|
21
|
+
const [a, c] = u(B), [d, j] = u(!1), r = n.length > 1, m = (t = 0) => {
|
|
22
|
+
const N = n.length - 1;
|
|
23
|
+
return D(l + t, N);
|
|
24
|
+
}, f = () => {
|
|
25
|
+
if (r) {
|
|
26
|
+
const t = m(1);
|
|
27
|
+
x === !1 && t === n.length - 1 && o(), e && e(t);
|
|
27
28
|
}
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
}, j = () => {
|
|
31
|
-
a((t) => !t);
|
|
29
|
+
}, o = () => {
|
|
30
|
+
c(!1);
|
|
32
31
|
}, v = () => {
|
|
33
|
-
|
|
32
|
+
c((t) => !t);
|
|
34
33
|
}, A = () => {
|
|
35
|
-
|
|
34
|
+
o(), f();
|
|
35
|
+
}, C = () => {
|
|
36
|
+
o(), e && e(m(-1));
|
|
36
37
|
};
|
|
37
|
-
return
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
|
|
38
|
+
return F(f, r && d && a ? g : null), /* @__PURE__ */ p($, { className: k, children: [
|
|
39
|
+
/* @__PURE__ */ s(
|
|
40
|
+
L,
|
|
40
41
|
{
|
|
41
42
|
loadCallback: () => {
|
|
42
|
-
|
|
43
|
+
j(!0), i && i();
|
|
43
44
|
},
|
|
44
|
-
visible:
|
|
45
|
+
visible: l,
|
|
45
46
|
images: n
|
|
46
47
|
}
|
|
47
48
|
),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
I,
|
|
50
|
+
/* @__PURE__ */ s(q, { children: r && y && /* @__PURE__ */ p(P, { children: [
|
|
51
|
+
/* @__PURE__ */ s(
|
|
52
|
+
w,
|
|
51
53
|
{
|
|
52
|
-
isDisabled: !
|
|
53
|
-
playing:
|
|
54
|
-
handleStartStop:
|
|
55
|
-
handleNext:
|
|
56
|
-
handlePrevious:
|
|
54
|
+
isDisabled: !d,
|
|
55
|
+
playing: a,
|
|
56
|
+
handleStartStop: v,
|
|
57
|
+
handleNext: A,
|
|
58
|
+
handlePrevious: C
|
|
57
59
|
}
|
|
58
60
|
),
|
|
59
|
-
|
|
60
|
-
] })
|
|
61
|
+
S
|
|
62
|
+
] }) })
|
|
61
63
|
] });
|
|
62
64
|
};
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
+
h.displayName = "Atomic.Blinker";
|
|
66
|
+
const M = h;
|
|
65
67
|
export {
|
|
66
|
-
|
|
68
|
+
M as default
|
|
67
69
|
};
|
|
@@ -28,18 +28,20 @@
|
|
|
28
28
|
grid-area: filler;
|
|
29
29
|
width: var(--label-height);
|
|
30
30
|
`,d=e.default.svg`
|
|
31
|
+
font-size: 1em;
|
|
31
32
|
grid-area: chart;
|
|
32
33
|
max-width: 100%;
|
|
33
34
|
max-height: 100%;
|
|
34
35
|
aspect-ratio: var(--aspect-ratio);
|
|
36
|
+
overflow: visible;
|
|
35
37
|
z-index: 1;
|
|
36
|
-
`,
|
|
38
|
+
`,o=e.default.div`
|
|
37
39
|
display: flex;
|
|
38
40
|
align-items: center;
|
|
39
41
|
grid-area: title;
|
|
40
42
|
height: var(--label-height);
|
|
41
43
|
padding-inline: var(--label-gutter);
|
|
42
|
-
`,
|
|
44
|
+
`,c=e.default.h3`
|
|
43
45
|
margin: 0;
|
|
44
46
|
`,s=e.default.div`
|
|
45
47
|
width: var(--label-height);
|
|
@@ -56,4 +58,4 @@
|
|
|
56
58
|
height: 100%;
|
|
57
59
|
width: 100%;
|
|
58
60
|
font-size: 80%;
|
|
59
|
-
`;exports.ChartContainer=r;exports.Filler=n;exports.HorizontalLabelWrapper=g;exports.Label=h;exports.SVG=d;exports.Title=
|
|
61
|
+
`;exports.ChartContainer=r;exports.Filler=n;exports.HorizontalLabelWrapper=g;exports.Label=h;exports.SVG=d;exports.Title=c;exports.TitleWrapper=o;exports.VerticalLabelWrapper=s;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import e from "styled-components";
|
|
3
3
|
import { token as t } from "@rubin-epo/epo-react-lib/styles";
|
|
4
|
-
const
|
|
4
|
+
const a = e.div`
|
|
5
5
|
--label-height: 2em;
|
|
6
6
|
--label-gutter: calc(var(--label-height) / 2);
|
|
7
7
|
|
|
@@ -34,28 +34,30 @@ const r = e.div`
|
|
|
34
34
|
grid-area: filler;
|
|
35
35
|
width: var(--label-height);
|
|
36
36
|
`, n = e.svg`
|
|
37
|
+
font-size: 1em;
|
|
37
38
|
grid-area: chart;
|
|
38
39
|
max-width: 100%;
|
|
39
40
|
max-height: 100%;
|
|
40
41
|
aspect-ratio: var(--aspect-ratio);
|
|
42
|
+
overflow: visible;
|
|
41
43
|
z-index: 1;
|
|
42
|
-
`,
|
|
44
|
+
`, o = e.div`
|
|
43
45
|
display: flex;
|
|
44
46
|
align-items: center;
|
|
45
47
|
grid-area: title;
|
|
46
48
|
height: var(--label-height);
|
|
47
49
|
padding-inline: var(--label-gutter);
|
|
48
|
-
`,
|
|
50
|
+
`, c = e.h3`
|
|
49
51
|
margin: 0;
|
|
50
52
|
`, h = e.div`
|
|
51
53
|
width: var(--label-height);
|
|
52
54
|
writing-mode: vertical-rl;
|
|
53
55
|
transform: rotate(180deg);
|
|
54
56
|
grid-area: vertical-label;
|
|
55
|
-
`,
|
|
57
|
+
`, s = e.div`
|
|
56
58
|
height: var(--label-height);
|
|
57
59
|
grid-area: horizontal-label;
|
|
58
|
-
`,
|
|
60
|
+
`, g = e.span`
|
|
59
61
|
display: flex;
|
|
60
62
|
align-items: center;
|
|
61
63
|
justify-content: center;
|
|
@@ -64,12 +66,12 @@ const r = e.div`
|
|
|
64
66
|
font-size: 80%;
|
|
65
67
|
`;
|
|
66
68
|
export {
|
|
67
|
-
|
|
69
|
+
a as ChartContainer,
|
|
68
70
|
r as Filler,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
s as HorizontalLabelWrapper,
|
|
72
|
+
g as Label,
|
|
71
73
|
n as SVG,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
c as Title,
|
|
75
|
+
o as TitleWrapper,
|
|
74
76
|
h as VerticalLabelWrapper
|
|
75
77
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),J=require("react"),K=require("../XAxis/index.cjs"),Q=require("../YAxis/index.cjs"),$=require("../Guidelines/index.cjs"),U=require("../Points/index.cjs"),V=require("../Tooltip/index.cjs"),X=require("../ClippingContainer/index.cjs"),R=require("../hooks/useAxis.cjs"),Y=require("./styles.cjs"),H=require("../defaults.cjs"),Z=require("../canvas/Points/index.cjs"),w={svg:U.default,canvas:Z.default},M=({data:B,className:C,xAxis:c,yAxis:l,width:d,height:u,title:D,activePointId:T,margins:p,tooltip:a,onLoadedCallback:z,renderer:E="svg",plotChildren:y})=>{const[q,h]=J.useState(),{label:O,points:x}=B,o={...H.default.margins,...p},e=typeof q<"u"?x[q]:x.find(({id:v})=>v===T),f=[0+o.left,d-o.right],b=[u-o.bottom,0+o.top],[r,
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),J=require("react"),K=require("../XAxis/index.cjs"),Q=require("../YAxis/index.cjs"),$=require("../Guidelines/index.cjs"),U=require("../Points/index.cjs"),V=require("../Tooltip/index.cjs"),X=require("../ClippingContainer/index.cjs"),R=require("../hooks/useAxis.cjs"),Y=require("./styles.cjs"),H=require("../defaults.cjs"),Z=require("../canvas/Points/index.cjs"),w=require("../../lib/utils.cjs"),A={svg:U.default,canvas:Z.default},M=({data:B,className:C,xAxis:c,yAxis:l,width:d,height:u,title:D,activePointId:T,margins:p,tooltip:a,onLoadedCallback:z,renderer:E="svg",plotChildren:y})=>{const[q,h]=J.useState(),{label:O,points:x}=B,o={...H.default.margins,...p},e=typeof q<"u"?x[q]:x.find(({id:v})=>v===T),f=[0+o.left,d-o.right],b=[u-o.bottom,0+o.top],[r,S,t]=R.default({...c,range:f}),[i,j,s]=R.default({...l,range:b}),m=s(i[0]),g=t(r[0]),I=s(i[1]),_=t(r[1]),P="x-axis-label",k="y-axis-label",N=Math.abs(f[1]-f[0]),W=Math.abs(b[1]-b[0]),F=A[E],L=n.jsx(F,{data:x,onHoverCallback:a?v=>h(v):void 0,onHoverOutCallback:a?()=>h(void 0):void 0,width:d,height:u,xScale:t,yScale:s,label:O,onLoadedCallback:z}),G={Data:L,xScale:t,yScale:s,yStart:m,yEnd:I,xStart:g,xEnd:_,yDomain:i,xDomain:r};return n.jsxs(Y.Chart,{verticalLabel:l.label,verticalLabelId:k,horizontalLabel:c.label,horizontalLabelId:P,className:C,width:d,height:u,title:D,children:[n.jsx(Q.default,{ticks:j,x:g,labelledById:k,yDomain:i,yScale:s}),n.jsxs(X.default,{x:g,y:I,width:N,height:W,children:[c.guidelines&&n.jsx($.default,{guides:S.length,direction:"vertical",xDomain:r,yDomain:i,xScale:t,yScale:s}),l.guidelines&&n.jsx($.default,{guides:j.length,xDomain:r,yDomain:i,xScale:t,yScale:s}),y?y(G):L]}),n.jsx(K.default,{ticks:S,y:m,labelledById:P,xDomain:r,xScale:t}),a&&!w.isSafari()&&n.jsxs(V.default,{x:e?t(e.x):void 0,y:e?s(e.y):void 0,visible:!!e,offset:H.default.pointRadius,children:[e&&typeof a=="function"&&a(e),e&&typeof a=="string"&&a]})]})};M.displayName="Charts.ScatterPlot";const ee=M;exports.default=ee;
|
|
@@ -11,7 +11,8 @@ import B from "../hooks/useAxis.js";
|
|
|
11
11
|
import { Chart as _ } from "./styles.js";
|
|
12
12
|
import D from "../defaults.js";
|
|
13
13
|
import $ from "../canvas/Points/index.js";
|
|
14
|
-
|
|
14
|
+
import { isSafari as w } from "../../lib/utils.js";
|
|
15
|
+
const tt = {
|
|
15
16
|
svg: U,
|
|
16
17
|
canvas: $
|
|
17
18
|
}, T = ({
|
|
@@ -29,29 +30,29 @@ const w = {
|
|
|
29
30
|
renderer: N = "svg",
|
|
30
31
|
plotChildren: x
|
|
31
32
|
}) => {
|
|
32
|
-
const [y, h] = J(), { label: O, points: f } = j, r = { ...D.margins, ...A }, t = typeof y < "u" ? f[y] : f.find(({ id:
|
|
33
|
+
const [y, h] = J(), { label: O, points: f } = j, r = { ...D.margins, ...A }, t = typeof y < "u" ? f[y] : f.find(({ id: v }) => v === M), b = [0 + r.left, d - r.right], g = [m - r.bottom, 0 + r.top], [a, S, o] = B({ ...c, range: b }), [s, P, e] = B({ ...l, range: g }), I = e(s[0]), p = o(a[0]), k = e(s[1]), W = o(a[1]), C = "x-axis-label", L = "y-axis-label", X = Math.abs(b[1] - b[0]), Y = Math.abs(g[1] - g[0]), q = tt[N], H = /* @__PURE__ */ i(
|
|
33
34
|
q,
|
|
34
35
|
{
|
|
35
36
|
data: f,
|
|
36
|
-
onHoverCallback: n ? (
|
|
37
|
+
onHoverCallback: n ? (v) => h(v) : void 0,
|
|
37
38
|
onHoverOutCallback: n ? () => h(void 0) : void 0,
|
|
38
39
|
width: d,
|
|
39
40
|
height: m,
|
|
40
|
-
xScale:
|
|
41
|
-
yScale:
|
|
41
|
+
xScale: o,
|
|
42
|
+
yScale: e,
|
|
42
43
|
label: O,
|
|
43
44
|
onLoadedCallback: G
|
|
44
45
|
}
|
|
45
46
|
), F = {
|
|
46
47
|
Data: H,
|
|
47
|
-
xScale:
|
|
48
|
-
yScale:
|
|
48
|
+
xScale: o,
|
|
49
|
+
yScale: e,
|
|
49
50
|
yStart: I,
|
|
50
51
|
yEnd: k,
|
|
51
|
-
xStart:
|
|
52
|
+
xStart: p,
|
|
52
53
|
xEnd: W,
|
|
53
|
-
yDomain:
|
|
54
|
-
xDomain:
|
|
54
|
+
yDomain: s,
|
|
55
|
+
xDomain: a
|
|
55
56
|
};
|
|
56
57
|
return /* @__PURE__ */ u(
|
|
57
58
|
_,
|
|
@@ -68,17 +69,17 @@ const w = {
|
|
|
68
69
|
/* @__PURE__ */ i(
|
|
69
70
|
Q,
|
|
70
71
|
{
|
|
71
|
-
ticks:
|
|
72
|
-
x:
|
|
72
|
+
ticks: P,
|
|
73
|
+
x: p,
|
|
73
74
|
labelledById: L,
|
|
74
|
-
yDomain:
|
|
75
|
-
yScale:
|
|
75
|
+
yDomain: s,
|
|
76
|
+
yScale: e
|
|
76
77
|
}
|
|
77
78
|
),
|
|
78
79
|
/* @__PURE__ */ u(
|
|
79
80
|
Z,
|
|
80
81
|
{
|
|
81
|
-
x:
|
|
82
|
+
x: p,
|
|
82
83
|
y: k,
|
|
83
84
|
width: X,
|
|
84
85
|
height: Y,
|
|
@@ -86,22 +87,22 @@ const w = {
|
|
|
86
87
|
c.guidelines && /* @__PURE__ */ i(
|
|
87
88
|
R,
|
|
88
89
|
{
|
|
89
|
-
guides:
|
|
90
|
+
guides: S.length,
|
|
90
91
|
direction: "vertical",
|
|
91
|
-
xDomain:
|
|
92
|
-
yDomain:
|
|
93
|
-
xScale:
|
|
94
|
-
yScale:
|
|
92
|
+
xDomain: a,
|
|
93
|
+
yDomain: s,
|
|
94
|
+
xScale: o,
|
|
95
|
+
yScale: e
|
|
95
96
|
}
|
|
96
97
|
),
|
|
97
98
|
l.guidelines && /* @__PURE__ */ i(
|
|
98
99
|
R,
|
|
99
100
|
{
|
|
100
|
-
guides:
|
|
101
|
-
xDomain:
|
|
102
|
-
yDomain:
|
|
103
|
-
xScale:
|
|
104
|
-
yScale:
|
|
101
|
+
guides: P.length,
|
|
102
|
+
xDomain: a,
|
|
103
|
+
yDomain: s,
|
|
104
|
+
xScale: o,
|
|
105
|
+
yScale: e
|
|
105
106
|
}
|
|
106
107
|
),
|
|
107
108
|
x ? x(F) : H
|
|
@@ -111,18 +112,18 @@ const w = {
|
|
|
111
112
|
/* @__PURE__ */ i(
|
|
112
113
|
K,
|
|
113
114
|
{
|
|
114
|
-
ticks:
|
|
115
|
+
ticks: S,
|
|
115
116
|
y: I,
|
|
116
117
|
labelledById: C,
|
|
117
|
-
xDomain:
|
|
118
|
-
xScale:
|
|
118
|
+
xDomain: a,
|
|
119
|
+
xScale: o
|
|
119
120
|
}
|
|
120
121
|
),
|
|
121
|
-
n && /* @__PURE__ */ u(
|
|
122
|
+
n && !w() && /* @__PURE__ */ u(
|
|
122
123
|
V,
|
|
123
124
|
{
|
|
124
|
-
x: t ?
|
|
125
|
-
y: t ?
|
|
125
|
+
x: t ? o(t.x) : void 0,
|
|
126
|
+
y: t ? e(t.y) : void 0,
|
|
126
127
|
visible: !!t,
|
|
127
128
|
offset: D.pointRadius,
|
|
128
129
|
children: [
|
|
@@ -136,7 +137,7 @@ const w = {
|
|
|
136
137
|
);
|
|
137
138
|
};
|
|
138
139
|
T.displayName = "Charts.ScatterPlot";
|
|
139
|
-
const
|
|
140
|
+
const gt = T;
|
|
140
141
|
export {
|
|
141
|
-
|
|
142
|
+
gt as default
|
|
142
143
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("styled-components"),
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("styled-components"),n=require("@rubin-epo/epo-react-lib/styles"),o=require("../Base/index.cjs"),s=e=>e&&e.__esModule?e:{default:e},i=s(t),r=i.default(o.default)`
|
|
2
2
|
font-size: 1.5em;
|
|
3
|
-
overflow: visible;
|
|
4
3
|
|
|
5
4
|
@container (
|
|
6
|
-
min-width: ${
|
|
5
|
+
min-width: ${n.token("BREAK_PHABLET_MIN")}
|
|
7
6
|
) {
|
|
8
7
|
font-size: 1em;
|
|
9
8
|
}
|
|
10
|
-
`;exports.Chart=
|
|
9
|
+
`;exports.Chart=r;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import { token as
|
|
4
|
-
import
|
|
5
|
-
const n =
|
|
2
|
+
import t from "styled-components";
|
|
3
|
+
import { token as o } from "@rubin-epo/epo-react-lib/styles";
|
|
4
|
+
import e from "../Base/index.js";
|
|
5
|
+
const n = t(e)`
|
|
6
6
|
font-size: 1.5em;
|
|
7
|
-
overflow: visible;
|
|
8
7
|
|
|
9
8
|
@container (
|
|
10
|
-
min-width: ${
|
|
9
|
+
min-width: ${o("BREAK_PHABLET_MIN")}
|
|
11
10
|
) {
|
|
12
11
|
font-size: 1em;
|
|
13
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("../../lib/utils.cjs"),a=require("d3-array"),b={linear:m.getLinearScale},d=(n,e,t)=>n>e?-Math.abs(t):Math.abs(t),M=(n,e)=>n.map((t,r)=>r===0?t-e:t+e),h=({min:n,max:e,step:t,ticks:r=5,range:o,scale:u="linear",scaleOptions:i})=>{const c=(typeof t=="number"?Math.floor(Math.abs((e-n)/t)):void 0)||r,l=(typeof t=="number"?d(n,e,t):a.tickStep(n,e,r))/2,s=M([n,e],l);return[s,a.ticks(n,e,c),b[u](s,o,i)]};exports.default=h;
|
|
@@ -14,5 +14,5 @@ type Axis = [Domain, Array<number>, ScaleFunction];
|
|
|
14
14
|
* Creates an axis with ticks defined by a min, max, and desired step or number of ticks.
|
|
15
15
|
* @returns [domain, ticks, scale]
|
|
16
16
|
*/
|
|
17
|
-
declare const useAxis: ({ min: start, max: stop, step: configStep, ticks: configTicks, range
|
|
17
|
+
declare const useAxis: ({ min: start, max: stop, step: configStep, ticks: configTicks, range, scale, scaleOptions, }: UseAxisProps) => Axis;
|
|
18
18
|
export default useAxis;
|