@rubin-epo/epo-widget-lib 0.7.0-rc.2 → 0.8.0

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.
Files changed (98) hide show
  1. package/dist/Atomic.cjs +1 -1
  2. package/dist/Atomic.js +6 -4
  3. package/dist/SupernovaThreeVector.cjs +1 -0
  4. package/dist/SupernovaThreeVector.d.ts +3 -0
  5. package/dist/SupernovaThreeVector.js +100 -0
  6. package/dist/atomic/Blinker/Blinker.cjs +1 -1
  7. package/dist/atomic/Blinker/Blinker.js +18 -18
  8. package/dist/atomic/Blinker/styles.cjs +1 -1
  9. package/dist/atomic/Blinker/styles.js +7 -7
  10. package/dist/atomic/Button/index.d.ts +1 -0
  11. package/dist/atomic/Button/patterns/Reset.cjs +1 -0
  12. package/dist/atomic/Button/patterns/Reset.d.ts +8 -0
  13. package/dist/atomic/Button/patterns/Reset.js +29 -0
  14. package/dist/atomic/ImageStack/index.cjs +1 -0
  15. package/dist/atomic/ImageStack/index.d.ts +16 -0
  16. package/dist/atomic/ImageStack/index.js +68 -0
  17. package/dist/atomic/ImageStack/styles.cjs +31 -0
  18. package/dist/atomic/ImageStack/styles.js +39 -0
  19. package/dist/atomic/index.d.ts +1 -0
  20. package/dist/charts/Bars/index.cjs +1 -1
  21. package/dist/charts/Bars/index.d.ts +2 -2
  22. package/dist/charts/Bars/index.js +31 -37
  23. package/dist/charts/Base/index.cjs +1 -1
  24. package/dist/charts/Base/index.d.ts +4 -0
  25. package/dist/charts/Base/index.js +33 -25
  26. package/dist/charts/Base/styles.cjs +22 -2
  27. package/dist/charts/Base/styles.d.ts +816 -0
  28. package/dist/charts/Base/styles.js +26 -3
  29. package/dist/charts/Guidelines/index.cjs +1 -1
  30. package/dist/charts/Guidelines/index.d.ts +2 -2
  31. package/dist/charts/Guidelines/index.js +19 -18
  32. package/dist/charts/Points/index.cjs +1 -1
  33. package/dist/charts/Points/index.js +15 -15
  34. package/dist/charts/Tooltip/index.cjs +1 -1
  35. package/dist/charts/Tooltip/index.d.ts +5 -4
  36. package/dist/charts/Tooltip/index.js +38 -40
  37. package/dist/charts/Tooltip/styles.cjs +19 -13
  38. package/dist/charts/Tooltip/styles.d.ts +417 -1801
  39. package/dist/charts/Tooltip/styles.js +21 -17
  40. package/dist/charts/XAxis/index.cjs +1 -1
  41. package/dist/charts/XAxis/index.js +31 -36
  42. package/dist/charts/YAxis/index.cjs +1 -1
  43. package/dist/charts/YAxis/index.d.ts +5 -0
  44. package/dist/charts/YAxis/index.js +28 -35
  45. package/dist/images/lunar_phase/first-quarter.webp +0 -0
  46. package/dist/images/lunar_phase/full.webp +0 -0
  47. package/dist/images/lunar_phase/new-moon.webp +0 -0
  48. package/dist/images/lunar_phase/third-quarter.webp +0 -0
  49. package/dist/images/lunar_phase/waning-crescent.webp +0 -0
  50. package/dist/images/lunar_phase/waning-gibbous.webp +0 -0
  51. package/dist/images/lunar_phase/waxing-crescent.webp +0 -0
  52. package/dist/images/lunar_phase/waxing-gibbous.webp +0 -0
  53. package/dist/images/supernovae_skymap/range0_500.png +0 -0
  54. package/dist/images/supernovae_skymap/range1000_2500.png +0 -0
  55. package/dist/images/supernovae_skymap/range500_1000.png +0 -0
  56. package/dist/localeStrings/en/epo-widget-lib.json +19 -0
  57. package/dist/widgets/ColorTool/Actions/index.cjs +1 -1
  58. package/dist/widgets/ColorTool/Actions/index.js +37 -27
  59. package/dist/widgets/ColorTool/FilterControls/FilterControls.cjs +1 -1
  60. package/dist/widgets/ColorTool/FilterControls/FilterControls.js +11 -11
  61. package/dist/widgets/SupernovaThreeVector/Histogram/index.cjs +1 -0
  62. package/dist/widgets/SupernovaThreeVector/Histogram/index.d.ts +19 -0
  63. package/dist/widgets/SupernovaThreeVector/Histogram/index.js +106 -0
  64. package/dist/widgets/SupernovaThreeVector/Histogram/styles.cjs +5 -0
  65. package/dist/widgets/SupernovaThreeVector/Histogram/styles.d.ts +482 -0
  66. package/dist/widgets/SupernovaThreeVector/Histogram/styles.js +10 -0
  67. package/dist/widgets/SupernovaThreeVector/LiveLabel/index.cjs +1 -0
  68. package/dist/widgets/SupernovaThreeVector/LiveLabel/index.d.ts +11 -0
  69. package/dist/widgets/SupernovaThreeVector/LiveLabel/index.js +36 -0
  70. package/dist/widgets/SupernovaThreeVector/LiveLabel/styles.cjs +10 -0
  71. package/dist/widgets/SupernovaThreeVector/LiveLabel/styles.d.ts +272 -0
  72. package/dist/widgets/SupernovaThreeVector/LiveLabel/styles.js +15 -0
  73. package/dist/widgets/SupernovaThreeVector/Skymap/index.cjs +1 -0
  74. package/dist/widgets/SupernovaThreeVector/Skymap/index.d.ts +18 -0
  75. package/dist/widgets/SupernovaThreeVector/Skymap/index.js +122 -0
  76. package/dist/widgets/SupernovaThreeVector/Skymap/styles.cjs +24 -0
  77. package/dist/widgets/SupernovaThreeVector/Skymap/styles.d.ts +3374 -0
  78. package/dist/widgets/SupernovaThreeVector/Skymap/styles.js +35 -0
  79. package/dist/widgets/SupernovaThreeVector/index.d.ts +12 -0
  80. package/dist/widgets/SupernovaThreeVector/styles.cjs +78 -0
  81. package/dist/widgets/SupernovaThreeVector/styles.js +94 -0
  82. package/package.json +5 -2
  83. package/dist/atomic/Blinker/Image/Image.cjs +0 -1
  84. package/dist/atomic/Blinker/Image/Image.d.ts +0 -9
  85. package/dist/atomic/Blinker/Image/Image.js +0 -23
  86. package/dist/atomic/Blinker/Image/styles.cjs +0 -17
  87. package/dist/atomic/Blinker/Image/styles.d.ts +0 -283
  88. package/dist/atomic/Blinker/Image/styles.js +0 -22
  89. package/dist/atomic/Blinker/Images/Images.cjs +0 -1
  90. package/dist/atomic/Blinker/Images/Images.d.ts +0 -8
  91. package/dist/atomic/Blinker/Images/Images.js +0 -45
  92. package/dist/atomic/Blinker/Images/styles.cjs +0 -10
  93. package/dist/atomic/Blinker/Images/styles.d.ts +0 -544
  94. package/dist/atomic/Blinker/Images/styles.js +0 -16
  95. package/dist/widgets/ColorTool/Actions/Reset/index.cjs +0 -1
  96. package/dist/widgets/ColorTool/Actions/Reset/index.d.ts +0 -9
  97. package/dist/widgets/ColorTool/Actions/Reset/index.js +0 -39
  98. package/dist/widgets/ColorTool/FilterControls/styles.d.ts +0 -1232
@@ -1,21 +1,25 @@
1
1
  "use client";
2
- import o from "styled-components";
3
- const l = o.g`
4
- cursor: default;
5
- `, e = o.rect`
6
- fill: #dce0e3;
7
- `, c = o.text`
8
- font-size: 12px;
9
- color: var(--black, #000);
10
- dominant-baseline: central;
11
- text-anchor: middle;
12
- fill: var(--black, #000);
13
- `, r = o.polygon`
14
- fill: #dce0e3;
2
+ import r from "styled-components";
3
+ const t = r.div`
4
+ background-color: #dce0e3;
5
+ border-radius: 4px;
6
+ font-size: 0.5em;
7
+ line-height: 1;
8
+ padding: 2px 4px;
9
+ text-align: center;
10
+ position: absolute;
11
+ `, e = r.div`
12
+ width: 0;
13
+ height: 0;
14
+ border-left: var(--arrow-width, 6px) solid transparent;
15
+ border-right: var(--arrow-width, 6px) solid transparent;
16
+
17
+ border-top: var(--arrow-width, 6px) solid #dce0e3;
18
+
19
+ position: absolute;
20
+ left: 0;
15
21
  `;
16
22
  export {
17
- l as Tooltip,
18
- r as TooltipArrow,
19
- e as TooltipBackground,
20
- c as TooltipText
23
+ e as Arrow,
24
+ t as Tooltip
21
25
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),u=require("../styles.cjs"),j=({xDomain:e=[0,1],xScale:t=l=>l,y:s=0,ticks:n=0,labelFormatter:x=l=>l,labelledById:y,padding:a=0,tickHeight:c=5,showBaseline:b=!0,className:h})=>{if(e.length<2)return console.error("Failed to render: invalid domain",e),null;const l=(e[1]-e[0])/n;return r.jsxs(r.Fragment,{children:[b&&r.jsx(u.BaseLine,{x1:t(e[0])-a,x2:t(e[1])+a,y1:s,y2:s}),n>0&&r.jsx("g",{role:"list","aria-labelledby":y,className:h,children:Array.from(Array(n+1)).map((f,i)=>{const d=e[0]+l*i,o=t(d),v=x(d,i);return r.jsxs("g",{role:"listitem",children:[r.jsx(u.Tick,{x1:o,x2:o,y1:s,y2:s+c}),r.jsx(u.XLabel,{x:o,y:s+c,children:v})]},i)})})]})};j.displayName="Charts.XAxis";const A=j;exports.default=A;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),M=require("d3-array"),o=require("../styles.cjs"),j=({xDomain:e=[0,1],xScale:n=a=>a,y:t=0,ticks:u=0,labelRender:c,labelledById:b,margin:h,tickHeight:d=5,showBaseline:x=!0,className:y})=>{if(e.length<2)return console.error("Failed to render: invalid domain",e),null;const g={...{top:0,right:0,bottom:0,left:0},...h},A=M.ticks(e[0],e[1],u);return r.jsxs(r.Fragment,{children:[x&&r.jsx(o.BaseLine,{x1:n(e[0])-g.left,x2:n(e[1])+g.right,y1:t,y2:t}),u>0&&r.jsx("g",{role:"list","aria-labelledby":b,className:y,children:A.map((s,f)=>{if(s>=e[1])return null;const i=t+d,l=n(s);return r.jsxs("g",{role:"listitem",children:[d>0&&r.jsx(o.Tick,{x1:l,x2:l,y1:t,y2:i}),c?c(s,l,i,f):r.jsx(o.XLabel,{x:l,y:i,children:s})]},f)})})]})};j.displayName="Charts.XAxis";const X=j;exports.default=X;
@@ -1,49 +1,44 @@
1
- import { jsxs as u, Fragment as m, jsx as t } from "react/jsx-runtime";
2
- import { BaseLine as X, Tick as v, XLabel as x } from "../styles.js";
3
- const f = ({
1
+ import { jsxs as h, Fragment as A, jsx as s } from "react/jsx-runtime";
2
+ import { ticks as x } from "d3-array";
3
+ import { BaseLine as M, Tick as j, XLabel as k } from "../styles.js";
4
+ const p = ({
4
5
  xDomain: r = [0, 1],
5
- xScale: s = (l) => l,
6
- y: e = 0,
7
- ticks: n = 0,
8
- labelFormatter: h = (l) => l,
9
- labelledById: p,
10
- padding: a = 0,
6
+ xScale: i = (a) => a,
7
+ y: t = 0,
8
+ ticks: o = 0,
9
+ labelRender: c,
10
+ labelledById: u,
11
+ margin: m,
11
12
  tickHeight: d = 5,
12
- showBaseline: y = !0,
13
- className: A
13
+ showBaseline: b = !0,
14
+ className: X
14
15
  }) => {
15
16
  if (r.length < 2)
16
17
  return console.error("Failed to render: invalid domain", r), null;
17
- const l = (r[1] - r[0]) / n;
18
- return /* @__PURE__ */ u(m, { children: [
19
- y && /* @__PURE__ */ t(
20
- X,
18
+ const f = { ...{ top: 0, right: 0, bottom: 0, left: 0 }, ...m }, y = x(r[0], r[1], o);
19
+ return /* @__PURE__ */ h(A, { children: [
20
+ b && /* @__PURE__ */ s(
21
+ M,
21
22
  {
22
- x1: s(r[0]) - a,
23
- x2: s(r[1]) + a,
24
- y1: e,
25
- y2: e
23
+ x1: i(r[0]) - f.left,
24
+ x2: i(r[1]) + f.right,
25
+ y1: t,
26
+ y2: t
26
27
  }
27
28
  ),
28
- n > 0 && /* @__PURE__ */ t("g", { role: "list", "aria-labelledby": p, className: A, children: Array.from(Array(n + 1)).map((g, o) => {
29
- const c = r[0] + l * o, i = s(c), b = h(c, o);
30
- return /* @__PURE__ */ u("g", { role: "listitem", children: [
31
- /* @__PURE__ */ t(
32
- v,
33
- {
34
- x1: i,
35
- x2: i,
36
- y1: e,
37
- y2: e + d
38
- }
39
- ),
40
- /* @__PURE__ */ t(x, { x: i, y: e + d, children: b })
41
- ] }, o);
29
+ o > 0 && /* @__PURE__ */ s("g", { role: "list", "aria-labelledby": u, className: X, children: y.map((e, g) => {
30
+ if (e >= r[1])
31
+ return null;
32
+ const n = t + d, l = i(e);
33
+ return /* @__PURE__ */ h("g", { role: "listitem", children: [
34
+ d > 0 && /* @__PURE__ */ s(j, { x1: l, x2: l, y1: t, y2: n }),
35
+ c ? c(e, l, n, g) : /* @__PURE__ */ s(k, { x: l, y: n, children: e })
36
+ ] }, g);
42
37
  }) })
43
38
  ] });
44
39
  };
45
- f.displayName = "Charts.XAxis";
46
- const L = f;
40
+ p.displayName = "Charts.XAxis";
41
+ const C = p;
47
42
  export {
48
- L as default
43
+ C as default
49
44
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),u=require("../styles.cjs"),j=({yDomain:e=[0,1],yScale:t=l=>l,x:s=0,padding:c=0,ticks:n=0,labelFormatter:d=l=>l,labelledById:b,showBaseline:h=!0,tickLength:a=5,className:v})=>{if(e.length<2)return console.error("Failed to render: invalid domain",e),null;const l=(e[1]-e[0])/n;return r.jsxs(r.Fragment,{children:[h&&r.jsx(u.BaseLine,{x1:s,x2:s,y1:t(e[0])-c,y2:t(e[1])+c}),n>0&&r.jsx("g",{role:"list","aria-labelledby":b,className:v,children:Array.from(Array(n+1)).map((g,x)=>{const i=e[0]+l*x,A=d?d(i):i,o=t(i);return r.jsxs("g",{role:"listitem",children:[r.jsx(u.Tick,{x1:s-a,x2:s,y1:o,y2:o}),r.jsx(u.YLabel,{x:s-a-2,y:o,children:A})]},x)})})]})};j.displayName="Charts.YAxis";const f=j;exports.default=f;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),M=require("d3-array"),o=require("../styles.cjs"),b=({yDomain:t=[0,1],yScale:l=u=>u,x:r=0,margin:j,ticks:a=0,labelRender:c,labelledById:f,showBaseline:h=!0,tickLength:d=5,className:p})=>{if(t.length<2)return console.error("Failed to render: invalid domain",t),null;const x={...{top:0,right:0,bottom:0,left:0},...j},A=M.ticks(t[0],t[1],a);return e.jsxs(e.Fragment,{children:[h&&e.jsx(o.BaseLine,{x1:r,x2:r,y1:l(t[0])+x.top,y2:l(t[1])-x.bottom}),a>0&&e.jsx("g",{role:"list","aria-labelledby":f,className:p,children:A.map((i,g)=>{const s=l(i),n=r-d;return e.jsxs("g",{role:"listitem",children:[d>0&&e.jsx(o.Tick,{x1:n,x2:r,y1:s,y2:s}),c?c(i,n,s,g):e.jsx(o.YLabel,{x:n,y:s,children:i})]},g)})})]})};b.displayName="Charts.YAxis";const Y=b;exports.default=Y;
@@ -6,5 +6,10 @@ export interface YAxisProps extends BaseAxisProps {
6
6
  x?: number;
7
7
  tickLength?: number;
8
8
  }
9
+ /**
10
+ * YAxis creates an axis with ticks. It needs a yDomain (your input data) and a yScale method to place
11
+ * the ticks and data. Remember that SVG starts from the upper left corner, so the yScale will need an inverted
12
+ * range for most purposes.
13
+ */
9
14
  declare const YAxis: FunctionComponent<YAxisProps>;
10
15
  export default YAxis;
@@ -1,49 +1,42 @@
1
- import { jsxs as x, Fragment as b, jsx as s } from "react/jsx-runtime";
2
- import { BaseLine as m, Tick as v, YLabel as g } from "../styles.js";
3
- const f = ({
1
+ import { jsxs as p, Fragment as A, jsx as e } from "react/jsx-runtime";
2
+ import { ticks as M } from "d3-array";
3
+ import { BaseLine as j, Tick as k, YLabel as F } from "../styles.js";
4
+ const x = ({
4
5
  yDomain: r = [0, 1],
5
- yScale: t = (l) => l,
6
- x: e = 0,
7
- padding: a = 0,
6
+ yScale: i = (d) => d,
7
+ x: t = 0,
8
+ margin: g,
8
9
  ticks: n = 0,
9
- labelFormatter: d = (l) => l,
10
- labelledById: h,
11
- showBaseline: p = !0,
10
+ labelRender: a,
11
+ labelledById: b,
12
+ showBaseline: h = !0,
12
13
  tickLength: c = 5,
13
- className: A
14
+ className: u
14
15
  }) => {
15
16
  if (r.length < 2)
16
17
  return console.error("Failed to render: invalid domain", r), null;
17
- const l = (r[1] - r[0]) / n;
18
- return /* @__PURE__ */ x(b, { children: [
19
- p && /* @__PURE__ */ s(
20
- m,
18
+ const f = { ...{ top: 0, right: 0, bottom: 0, left: 0 }, ...g }, Y = M(r[0], r[1], n);
19
+ return /* @__PURE__ */ p(A, { children: [
20
+ h && /* @__PURE__ */ e(
21
+ j,
21
22
  {
22
- x1: e,
23
- x2: e,
24
- y1: t(r[0]) - a,
25
- y2: t(r[1]) + a
23
+ x1: t,
24
+ x2: t,
25
+ y1: i(r[0]) + f.top,
26
+ y2: i(r[1]) - f.bottom
26
27
  }
27
28
  ),
28
- n > 0 && /* @__PURE__ */ s("g", { role: "list", "aria-labelledby": h, className: A, children: Array.from(Array(n + 1)).map((j, u) => {
29
- const i = r[0] + l * u, Y = d ? d(i) : i, o = t(i);
30
- return /* @__PURE__ */ x("g", { role: "listitem", children: [
31
- /* @__PURE__ */ s(
32
- v,
33
- {
34
- x1: e - c,
35
- x2: e,
36
- y1: o,
37
- y2: o
38
- }
39
- ),
40
- /* @__PURE__ */ s(g, { x: e - c - 2, y: o, children: Y })
41
- ] }, u);
29
+ n > 0 && /* @__PURE__ */ e("g", { role: "list", "aria-labelledby": b, className: u, children: Y.map((l, m) => {
30
+ const s = i(l), o = t - c;
31
+ return /* @__PURE__ */ p("g", { role: "listitem", children: [
32
+ c > 0 && /* @__PURE__ */ e(k, { x1: o, x2: t, y1: s, y2: s }),
33
+ a ? a(l, o, s, m) : /* @__PURE__ */ e(F, { x: o, y: s, children: l })
34
+ ] }, m);
42
35
  }) })
43
36
  ] });
44
37
  };
45
- f.displayName = "Charts.YAxis";
46
- const C = f;
38
+ x.displayName = "Charts.YAxis";
39
+ const N = x;
47
40
  export {
48
- C as default
41
+ N as default
49
42
  };
@@ -79,5 +79,24 @@
79
79
  "visible": "Visible Light",
80
80
  "infrared": "Infrared"
81
81
  }
82
+ },
83
+ "supernova_three_vector": {
84
+ "histogram": {
85
+ "x_label": "Distance [kpc]",
86
+ "bar_label_one": "{{binMin}} to {{binMax}} kiloparsecs: {{count}} supernova",
87
+ "bar_label_other": "{{binMin}} to {{binMax}} kiloparsecs: {{count}} supernovae"
88
+ },
89
+ "slider": {
90
+ "label": "Select visible range",
91
+ "valueLabel": "{{value}} kiloparsecs"
92
+ },
93
+ "skymap": {
94
+ "description": "$t(supernova_three_vector.skymap.supernova_count, {\"count\": {{supernovaCount}}, \"min\": {{min}}, \"max\": {{max}}}) $t(supernova_three_vector.skymap.user_supernova_count, {\"count\": {{userObjectCount}}})",
95
+ "supernova_count_one": "Sky map projection showing {{count}} supernova between the distances of {{min}} and {{max}} kiloparsecs.",
96
+ "supernova_count_other": "Sky map projection showing {{count}} supernovae between the distances of {{min}} and {{max}} kiloparsecs.",
97
+ "user_supernova_count_zero": "None of your supernovae are visible.",
98
+ "user_supernova_count_one": "{{count}} of your supernovae is visible near {{coords}}.",
99
+ "user_supernova_count_other": "{{count}} of your supernovae are visible near {{coords}}."
100
+ }
82
101
  }
83
102
  }
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),f=require("./Reset/index.cjs"),m=require("./Export/index.cjs"),q=require("./styles.cjs"),A=require("react-i18next"),b=require("../lib/utils.cjs"),i=({actions:c,isDisabled:l,selectedData:e,selectionCallback:s,canvas:u})=>{const{t:n}=A.useTranslation(),{name:a}=e,r=l||!b.areActionsActive(e);return t.jsx(q.Actions,{children:c.map((d,o)=>{switch(d){case"reset":return t.jsx(f.default,{isDisabled:r,selectedData:e,onResetCallback:x=>s&&s(x),children:n("colorTool.actions.reset")},o);case"export":return t.jsx(m.default,{isDisabled:r,canvas:u,filename:a,children:n("colorTool.actions.export")},o);case"save":return null;default:return null}})})};i.displayName="Widgets.ColorTool.Actions";const j=i;exports.default=j;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),m=require("react-i18next"),x=require("../../../atomic/Button/patterns/Reset.cjs"),b=require("./Export/index.cjs"),g=require("./styles.cjs"),c=require("../lib/utils.cjs"),p=n=>n.map(s=>{const{defaultValue:e,min:t,max:i}=s,r=e||1;return{...s,active:!1,color:"",brightness:c.getBrightnessValue(t,i,r),value:r}}),a=({actions:n,isDisabled:s,selectedData:e,selectionCallback:t,canvas:i})=>{const{t:r}=m.useTranslation(),{name:d,filters:f}=e,u=s||!c.areActionsActive(e);return l.jsx(g.Actions,{children:n.map(o=>{switch(o){case"reset":return l.jsx(x.default,{isDisabled:u,onResetCallback:()=>t&&t({...e,filters:p(f)})},o);case"export":return l.jsx(b.default,{isDisabled:u,canvas:i,filename:d,children:r("colorTool.actions.export")},o);case"save":return null;default:return null}})})};a.displayName="Widgets.ColorTool.Actions";const q=a;exports.default=q;
@@ -1,41 +1,51 @@
1
1
  "use client";
2
- import { jsx as r } from "react/jsx-runtime";
3
- import f from "./Reset/index.js";
2
+ import { jsx as l } from "react/jsx-runtime";
3
+ import { useTranslation as p } from "react-i18next";
4
+ import f from "../../../atomic/Button/patterns/Reset.js";
4
5
  import d from "./Export/index.js";
5
6
  import { Actions as A } from "./styles.js";
6
- import { useTranslation as x } from "react-i18next";
7
- import { areActionsActive as h } from "../lib/utils.js";
8
- const i = ({
9
- actions: c,
10
- isDisabled: l,
11
- selectedData: o,
12
- selectionCallback: t,
13
- canvas: a
7
+ import { areActionsActive as x, getBrightnessValue as h } from "../lib/utils.js";
8
+ const b = (r) => r.map((s) => {
9
+ const { defaultValue: t, min: o, max: n } = s, e = t || 1;
10
+ return {
11
+ ...s,
12
+ active: !1,
13
+ color: "",
14
+ brightness: h(o, n, e),
15
+ value: e
16
+ };
17
+ }), c = ({
18
+ actions: r,
19
+ isDisabled: s,
20
+ selectedData: t,
21
+ selectionCallback: o,
22
+ canvas: n
14
23
  }) => {
15
- const { t: s } = x(), { name: m } = o, e = l || !h(o);
16
- return /* @__PURE__ */ r(A, { children: c.map((p, n) => {
17
- switch (p) {
24
+ const { t: e } = p(), { name: m, filters: u } = t, a = s || !x(t);
25
+ return /* @__PURE__ */ l(A, { children: r.map((i) => {
26
+ switch (i) {
18
27
  case "reset":
19
- return /* @__PURE__ */ r(
28
+ return /* @__PURE__ */ l(
20
29
  f,
21
30
  {
22
- isDisabled: e,
23
- selectedData: o,
24
- onResetCallback: (u) => t && t(u),
25
- children: s("colorTool.actions.reset")
31
+ isDisabled: a,
32
+ onResetCallback: () => o && o({
33
+ ...t,
34
+ filters: b(u)
35
+ })
26
36
  },
27
- n
37
+ i
28
38
  );
29
39
  case "export":
30
- return /* @__PURE__ */ r(
40
+ return /* @__PURE__ */ l(
31
41
  d,
32
42
  {
33
- isDisabled: e,
34
- canvas: a,
43
+ isDisabled: a,
44
+ canvas: n,
35
45
  filename: m,
36
- children: s("colorTool.actions.export")
46
+ children: e("colorTool.actions.export")
37
47
  },
38
- n
48
+ i
39
49
  );
40
50
  case "save":
41
51
  return null;
@@ -44,8 +54,8 @@ const i = ({
44
54
  }
45
55
  }) });
46
56
  };
47
- i.displayName = "Widgets.ColorTool.Actions";
48
- const j = i;
57
+ c.displayName = "Widgets.ColorTool.Actions";
58
+ const $ = c;
49
59
  export {
50
- j as default
60
+ $ as default
51
61
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),q=require("@rubin-epo/epo-react-lib/SelectListbox"),S=require("../lib/utils.cjs"),T=require("react-i18next"),l=require("./styles.cjs"),f=e=>e&&e.__esModule?e:{default:e},I=f(q),d=({filter:e,colorOptions:a,isDisabled:r,onChangeFilterCallback:t,buttonLabelledById:u,selectLabelledById:h,sliderLabelledById:x})=>{const{t:b}=T.useTranslation(),{label:i,color:c="",value:g,active:n,min:m,max:j}=e,_=()=>t&&t({...e,active:!n}),p=o=>o&&t&&t({...e,color:o}),y=o=>t&&t({...e,brightness:S.getBrightnessValue(m,j,o),value:o}),v=b("colorTool.actions.select_filter");return s.jsxs(l.FilterContainer,{disabled:r,children:[s.jsxs(l.FilterLabel,{children:[s.jsx(l.HiddenCheckbox,{checked:n,type:"checkbox",onChange:_,"aria-describedby":u}),s.jsx(l.FilterToggle,{as:"span",children:i})]}),s.jsx(I.default,{placeholder:v,value:c,options:a,onChangeCallback:p,width:"100%",maxWidth:"100%",labelledById:h,isDisabled:!n||r}),s.jsx(l.Slider,{min:1,max:100,onChangeCallback:y,isDisabled:!n||r,labelledbyId:x,value:g,label:i,color:c})]})};d.displayName="Widgets.ColorTool.FilterControls";const B=d;exports.default=B;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),q=require("@rubin-epo/epo-react-lib/SelectListbox"),v=require("../lib/utils.cjs"),S=require("react-i18next"),l=require("./styles.cjs"),T=e=>e&&e.__esModule?e:{default:e},I=T(q),d=({filter:e,colorOptions:a,isDisabled:r,onChangeFilterCallback:s,buttonLabelledById:u,selectLabelledById:h,sliderLabelledById:x})=>{const{t:b}=S.useTranslation(),{label:i,color:c="",value:m,active:n,min:g,max:j}=e,p=()=>s&&s({...e,active:!n}),y=t=>t&&s&&s({...e,color:t}),_=t=>s&&s({...e,brightness:v.getBrightnessValue(g,j,t),value:t}),f=b("colorTool.actions.select_filter");return o.jsxs(l.FilterContainer,{disabled:r,children:[o.jsxs(l.FilterLabel,{children:[o.jsx(l.HiddenCheckbox,{checked:n,type:"checkbox",onChange:p,"aria-describedby":u}),o.jsx(l.FilterToggle,{as:"span",children:i})]}),o.jsx(I.default,{placeholder:f,value:c,options:a,onChangeCallback:y,width:"100%",maxWidth:"100%",labelledById:h,isDisabled:!n||r}),o.jsx(l.Slider,{min:1,max:100,onChangeCallback:t=>typeof t=="number"&&_(t),isDisabled:!n||r,labelledbyId:x,value:m,label:i,color:c})]})};d.displayName="Widgets.ColorTool.FilterControls";const B=d;exports.default=B;
@@ -8,16 +8,16 @@ const d = ({
8
8
  filter: t,
9
9
  colorOptions: a,
10
10
  isDisabled: r,
11
- onChangeFilterCallback: e,
11
+ onChangeFilterCallback: o,
12
12
  buttonLabelledById: m,
13
13
  selectLabelledById: h,
14
14
  sliderLabelledById: p
15
15
  }) => {
16
- const { t: b } = I(), { label: i, color: n = "", value: x, active: s, min: g, max: u } = t, y = () => e && e({ ...t, active: !s }), f = (o) => o && e && e({ ...t, color: o }), v = (o) => e && e({
16
+ const { t: b } = I(), { label: n, color: i = "", value: x, active: s, min: g, max: u } = t, y = () => o && o({ ...t, active: !s }), f = (e) => e && o && o({ ...t, color: e }), T = (e) => o && o({
17
17
  ...t,
18
- brightness: C(g, u, o),
19
- value: o
20
- }), T = b("colorTool.actions.select_filter");
18
+ brightness: C(g, u, e),
19
+ value: e
20
+ }), v = b("colorTool.actions.select_filter");
21
21
  return /* @__PURE__ */ c(j, { disabled: r, children: [
22
22
  /* @__PURE__ */ c(L, { children: [
23
23
  /* @__PURE__ */ l(
@@ -29,13 +29,13 @@ const d = ({
29
29
  "aria-describedby": m
30
30
  }
31
31
  ),
32
- /* @__PURE__ */ l(W, { as: "span", children: i })
32
+ /* @__PURE__ */ l(W, { as: "span", children: n })
33
33
  ] }),
34
34
  /* @__PURE__ */ l(
35
35
  B,
36
36
  {
37
- placeholder: T,
38
- value: n,
37
+ placeholder: v,
38
+ value: i,
39
39
  options: a,
40
40
  onChangeCallback: f,
41
41
  width: "100%",
@@ -49,12 +49,12 @@ const d = ({
49
49
  {
50
50
  min: 1,
51
51
  max: 100,
52
- onChangeCallback: v,
52
+ onChangeCallback: (e) => typeof e == "number" && T(e),
53
53
  isDisabled: !s || r,
54
54
  labelledbyId: p,
55
55
  value: x,
56
- label: i,
57
- color: n
56
+ label: n,
57
+ color: i
58
58
  }
59
59
  )
60
60
  ] });
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),I=require("react"),M=require("react-i18next"),w=require("../../../charts/Base/index.cjs"),H=require("../../../charts/XAxis/index.cjs"),O=require("../../../charts/Guidelines/index.cjs"),R=require("../../../charts/YAxis/index.cjs"),k=require("../../../charts/Bars/index.cjs"),z=require("../../../charts/Tooltip/index.cjs"),A=require("../../../charts/styles.cjs"),B=require("../../../lib/utils.cjs"),E=require("./styles.cjs"),T=({data:c,margin:b,activeRange:x,xDomain:r,yDomain:n,xScale:o,yScale:i,yTicks:h,xTicks:j,step:p,width:_,height:L,className:$})=>{const{t:v}=M.useTranslation(),[u,q]=I.useState(),g=i(n[0]),f="xAxisLabel",d=typeof u=="number",a=c.map(({value:s,bin:e},l)=>({x:e,value:s,width:12,fill:B.between(e,x[0],x[1])?void 0:"#30E0E3",props:{"aria-label":v("supernova_three_vector.histogram.bar_label",{count:s,binMin:e,binMax:e+p}),onMouseOver:()=>q(l),onMouseOut:()=>q(void 0)}}));return t.jsxs(w.default,{minX:r[0],minY:n[0],width:_,height:L,className:$,horizontalLabel:v("supernova_three_vector.histogram.x_label")||void 0,horizontalLabelId:f,children:[t.jsx(R.default,{showBaseline:!1,x:o(r[0])-10,ticks:h,tickLength:0,labelRender:(s,e,l)=>t.jsx(E.YLabel,{x:e,y:l,children:s}),yDomain:n,yScale:i}),t.jsx(O.default,{guides:h,xDomain:r,xScale:o,yDomain:n,yScale:i,margin:b}),t.jsx(k.default,{data:a,xDomain:r,yDomain:n,xScale:o,yScale:i}),t.jsx(H.default,{ticks:j,y:g,labelledById:f,labelRender:(s,e,l)=>t.jsx(A.XLabel,{x:e,y:l+5,children:s}),xDomain:r,xScale:o,margin:b}),t.jsx(z.default,{x:d?o(c[u].bin):0,y:d?i(a[u].value):0,visible:d,children:d?a[u].value:null})]})},X=T;exports.default=X;
@@ -0,0 +1,19 @@
1
+ import { FunctionComponent } from "react";
2
+ import { ChartMargin, Domain, HistogramData, ScaleFunction } from '../../../charts/types';
3
+ interface DistanceHistogramProps {
4
+ data: HistogramData;
5
+ activeRange: Array<number>;
6
+ margin: ChartMargin;
7
+ xDomain: Domain;
8
+ yDomain: Domain;
9
+ xScale: ScaleFunction;
10
+ yScale: ScaleFunction;
11
+ yTicks: number;
12
+ xTicks: number;
13
+ step: number;
14
+ width: number;
15
+ height: number;
16
+ className?: string;
17
+ }
18
+ declare const DistanceHistogram: FunctionComponent<DistanceHistogramProps>;
19
+ export default DistanceHistogram;
@@ -0,0 +1,106 @@
1
+ "use client";
2
+ import { jsxs as B, jsx as r } from "react/jsx-runtime";
3
+ import { useState as M } from "react";
4
+ import { useTranslation as w } from "react-i18next";
5
+ import H from "../../../charts/Base/index.js";
6
+ import X from "../../../charts/XAxis/index.js";
7
+ import Y from "../../../charts/Guidelines/index.js";
8
+ import j from "../../../charts/YAxis/index.js";
9
+ import k from "../../../charts/Bars/index.js";
10
+ import z from "../../../charts/Tooltip/index.js";
11
+ import { XLabel as E } from "../../../charts/styles.js";
12
+ import { between as O } from "../../../lib/utils.js";
13
+ import { YLabel as R } from "./styles.js";
14
+ const T = ({
15
+ data: a,
16
+ margin: b,
17
+ activeRange: u,
18
+ xDomain: t,
19
+ yDomain: s,
20
+ xScale: i,
21
+ yScale: l,
22
+ yTicks: f,
23
+ xTicks: x,
24
+ step: L,
25
+ width: _,
26
+ height: I,
27
+ className: g
28
+ }) => {
29
+ const { t: h } = w(), [m, c] = M(), A = l(s[0]), v = "xAxisLabel", d = typeof m == "number", p = a.map(({ value: e, bin: o }, n) => ({
30
+ x: o,
31
+ value: e,
32
+ width: 12,
33
+ fill: O(o, u[0], u[1]) ? void 0 : "#30E0E3",
34
+ props: {
35
+ "aria-label": h("supernova_three_vector.histogram.bar_label", {
36
+ count: e,
37
+ binMin: o,
38
+ binMax: o + L
39
+ }),
40
+ onMouseOver: () => c(n),
41
+ onMouseOut: () => c(void 0)
42
+ }
43
+ }));
44
+ return /* @__PURE__ */ B(
45
+ H,
46
+ {
47
+ minX: t[0],
48
+ minY: s[0],
49
+ width: _,
50
+ height: I,
51
+ className: g,
52
+ horizontalLabel: h("supernova_three_vector.histogram.x_label") || void 0,
53
+ horizontalLabelId: v,
54
+ children: [
55
+ /* @__PURE__ */ r(
56
+ j,
57
+ {
58
+ showBaseline: !1,
59
+ x: i(t[0]) - 10,
60
+ ticks: f,
61
+ tickLength: 0,
62
+ labelRender: (e, o, n) => /* @__PURE__ */ r(R, { x: o, y: n, children: e }),
63
+ yDomain: s,
64
+ yScale: l
65
+ }
66
+ ),
67
+ /* @__PURE__ */ r(
68
+ Y,
69
+ {
70
+ guides: f,
71
+ xDomain: t,
72
+ xScale: i,
73
+ yDomain: s,
74
+ yScale: l,
75
+ margin: b
76
+ }
77
+ ),
78
+ /* @__PURE__ */ r(k, { data: p, xDomain: t, yDomain: s, xScale: i, yScale: l }),
79
+ /* @__PURE__ */ r(
80
+ X,
81
+ {
82
+ ticks: x,
83
+ y: A,
84
+ labelledById: v,
85
+ labelRender: (e, o, n) => /* @__PURE__ */ r(E, { x: o, y: n + 5, children: e }),
86
+ xDomain: t,
87
+ xScale: i,
88
+ margin: b
89
+ }
90
+ ),
91
+ /* @__PURE__ */ r(
92
+ z,
93
+ {
94
+ x: d ? i(a[m].bin) : 0,
95
+ y: d ? l(p[m].value) : 0,
96
+ visible: d,
97
+ children: d ? p[m].value : null
98
+ }
99
+ )
100
+ ]
101
+ }
102
+ );
103
+ }, W = T;
104
+ export {
105
+ W as default
106
+ };
@@ -0,0 +1,5 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("styled-components"),l=e=>e&&e.__esModule?e:{default:e},n=l(t),o=n.default.text`
2
+ dominant-baseline: text-before-edge;
3
+ font-size: 0.4em;
4
+ text-anchor: end;
5
+ `;exports.YLabel=o;