@rubin-epo/epo-widget-lib 0.2.0 → 0.4.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.
- package/README.MD +21 -15
- package/dist/CameraFilter.cjs +1 -0
- package/dist/CameraFilter.d.ts +3 -0
- package/dist/CameraFilter.js +99 -0
- package/dist/ColorTool.cjs +1 -0
- package/dist/ColorTool.d.ts +3 -0
- package/dist/ColorTool.js +116 -0
- package/dist/FilterTool.cjs +1 -0
- package/dist/FilterTool.d.ts +3 -0
- package/dist/FilterTool.js +253 -0
- package/dist/SourceSelector.cjs +1 -0
- package/dist/SourceSelector.d.ts +3 -0
- package/dist/SourceSelector.js +97 -0
- package/dist/atomic/Blinker/Blinker.cjs +1 -0
- package/dist/atomic/Blinker/Blinker.d.ts +2 -2
- package/dist/atomic/Blinker/Blinker.js +68 -0
- package/dist/atomic/Blinker/Controls/Controls.cjs +1 -0
- package/dist/atomic/Blinker/Controls/Controls.js +58 -0
- package/dist/atomic/Blinker/Controls/styles.cjs +13 -0
- package/dist/atomic/Blinker/Controls/styles.d.ts +2 -1
- package/dist/atomic/Blinker/Controls/styles.js +17 -0
- package/dist/atomic/Blinker/Image/Image.cjs +1 -0
- package/dist/atomic/Blinker/Image/Image.d.ts +2 -2
- package/dist/atomic/Blinker/Image/Image.js +23 -0
- package/dist/atomic/Blinker/Image/styles.cjs +22 -0
- package/dist/atomic/Blinker/Image/styles.d.ts +4 -3
- package/dist/atomic/Blinker/Image/styles.js +26 -0
- package/dist/atomic/Blinker/Images/Images.cjs +1 -0
- package/dist/atomic/Blinker/Images/Images.js +37 -0
- package/dist/atomic/Blinker/Images/styles.cjs +15 -0
- package/dist/atomic/Blinker/Images/styles.d.ts +5 -4
- package/dist/atomic/Blinker/Images/styles.js +20 -0
- package/dist/atomic/Blinker/_mocks/index.d.ts +2 -0
- package/dist/atomic/Blinker/styles.cjs +26 -0
- package/dist/atomic/Blinker/styles.d.ts +7 -9
- package/dist/atomic/Blinker/styles.js +34 -0
- package/dist/atomic/ElapsedTime/ElapsedTime.cjs +1 -0
- package/dist/atomic/ElapsedTime/ElapsedTime.js +34 -0
- package/dist/atomic/ElapsedTime/styles.cjs +40 -0
- package/dist/atomic/ElapsedTime/styles.d.ts +7 -6
- package/dist/atomic/ElapsedTime/styles.js +49 -0
- package/dist/atomic/PlaybackControl/PlaybackControl.cjs +1 -0
- package/dist/atomic/PlaybackControl/PlaybackControl.d.ts +1 -1
- package/dist/atomic/PlaybackControl/PlaybackControl.js +17 -0
- package/dist/atomic/PlaybackControl/styles.cjs +39 -0
- package/dist/atomic/PlaybackControl/styles.d.ts +3 -2
- package/dist/atomic/PlaybackControl/styles.js +44 -0
- package/dist/hooks/useInterval.cjs +1 -0
- package/dist/hooks/useInterval.js +18 -0
- package/dist/lib/utils.cjs +1 -0
- package/dist/lib/utils.js +18 -0
- package/dist/lib/utils.test.d.ts +1 -0
- package/dist/localeStrings/en/epo-widget-lib.json +77 -0
- package/dist/localeStrings/es/epo-widget-lib.json +33 -0
- package/dist/styles/svg.cjs +8 -0
- package/dist/styles/svg.d.ts +2 -1
- package/dist/styles/svg.js +12 -0
- package/dist/widgets/CameraFilter/CondensedFilterRanges/CondensedFilterRanges.cjs +1 -0
- package/dist/widgets/CameraFilter/CondensedFilterRanges/CondensedFilterRanges.js +61 -0
- package/dist/widgets/CameraFilter/SpectrumDisplay/ColorLabels/ColorLabels.cjs +1 -0
- package/dist/widgets/CameraFilter/SpectrumDisplay/ColorLabels/ColorLabels.js +95 -0
- package/dist/widgets/CameraFilter/SpectrumDisplay/SpectrumDisplay.cjs +1 -0
- package/dist/widgets/CameraFilter/SpectrumDisplay/SpectrumDisplay.js +98 -0
- package/dist/widgets/CameraFilter/SpectrumDisplay/SpectrumLabels/SpectrumLabels.cjs +1 -0
- package/dist/widgets/CameraFilter/SpectrumDisplay/SpectrumLabels/SpectrumLabels.js +58 -0
- package/dist/widgets/CameraFilter/data.cjs +1 -0
- package/dist/widgets/CameraFilter/data.js +85 -0
- package/dist/widgets/CameraFilter/styles.cjs +64 -0
- package/dist/widgets/CameraFilter/styles.d.ts +19 -18
- package/dist/widgets/CameraFilter/styles.js +82 -0
- package/dist/widgets/ColorTool/ColorTool.d.ts +1 -3
- package/dist/widgets/ColorTool/FilterControls/FilterControls.cjs +1 -0
- package/dist/widgets/ColorTool/FilterControls/FilterControls.d.ts +1 -1
- package/dist/widgets/ColorTool/FilterControls/FilterControls.js +63 -0
- package/dist/widgets/ColorTool/FilterImage/FilterImage.cjs +1 -0
- package/dist/widgets/ColorTool/FilterImage/FilterImage.js +41 -0
- package/dist/widgets/ColorTool/ImageComposite/ImageComposite.cjs +1 -0
- package/dist/widgets/ColorTool/ImageComposite/ImageComposite.js +33 -0
- package/dist/widgets/ColorTool/styles.cjs +129 -0
- package/dist/widgets/ColorTool/styles.d.ts +21 -21
- package/dist/widgets/ColorTool/styles.js +149 -0
- package/dist/widgets/ColorTool/utilities.cjs +1 -0
- package/dist/widgets/ColorTool/utilities.js +38 -0
- package/dist/widgets/FilterTool/FilterTool.d.ts +3 -1
- package/dist/widgets/FilterTool/styles.cjs +36 -0
- package/dist/widgets/FilterTool/styles.d.ts +10 -15
- package/dist/widgets/FilterTool/styles.js +49 -0
- package/dist/widgets/SourceSelector/Message/Message.cjs +1 -0
- package/dist/widgets/SourceSelector/Message/Message.js +21 -0
- package/dist/widgets/SourceSelector/Message/styles.cjs +23 -0
- package/dist/widgets/SourceSelector/Message/styles.d.ts +5 -0
- package/dist/widgets/SourceSelector/Message/styles.js +28 -0
- package/dist/widgets/SourceSelector/Point/Point.cjs +1 -0
- package/dist/widgets/SourceSelector/Point/Point.js +45 -0
- package/dist/widgets/SourceSelector/Point/styles.cjs +11 -0
- package/dist/widgets/SourceSelector/Point/styles.d.ts +4 -3
- package/dist/widgets/SourceSelector/Point/styles.js +15 -0
- package/dist/widgets/SourceSelector/Points/Points.cjs +1 -0
- package/dist/widgets/SourceSelector/Points/Points.js +35 -0
- package/dist/widgets/SourceSelector/SourceSelector.d.ts +2 -2
- package/dist/widgets/SourceSelector/mocks/index.d.ts +7 -0
- package/dist/widgets/SourceSelector/styles.cjs +20 -0
- package/dist/widgets/SourceSelector/styles.d.ts +9 -7
- package/dist/widgets/SourceSelector/styles.js +30 -0
- package/dist/widgets/SourceSelector/utilities.cjs +1 -0
- package/dist/widgets/SourceSelector/utilities.js +7 -0
- package/dist/widgets/SourceSelector/utilities.test.d.ts +1 -0
- package/package.json +10 -10
- package/dist/assets/locales/index.d.ts +0 -115
- package/dist/epo-widget-lib.es.js +0 -3434
- package/dist/epo-widget-lib.umd.js +0 -459
- package/dist/index.d.ts +0 -6
- package/dist/types/astro.d.ts +0 -35
- package/dist/vite-env.d.ts +0 -1
package/README.MD
CHANGED
|
@@ -18,17 +18,11 @@ EPO React Library has 5 peer dependencies required to pull it in to your applica
|
|
|
18
18
|
|
|
19
19
|
### Styles
|
|
20
20
|
|
|
21
|
-
After installing the package library, the global styles will need to be added to
|
|
21
|
+
After installing the package library, the global styles from `epo-react-lib` will need to be added to your application
|
|
22
22
|
|
|
23
23
|
```
|
|
24
|
-
import { GlobalStyles } from "@rubin-epo/epo-
|
|
24
|
+
import { GlobalStyles } from "@rubin-epo/epo-react-lib/styles";
|
|
25
25
|
|
|
26
|
-
const App = () => {
|
|
27
|
-
return <main><GlobalStyles></main>
|
|
28
|
-
}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
If you have already imported the global styles from `epo-react-lib` this step is unnecessary.
|
|
32
26
|
|
|
33
27
|
### Translations
|
|
34
28
|
|
|
@@ -43,10 +37,13 @@ This project uses Vite in library mode to package the contents of `/packages/epo
|
|
|
43
37
|
To build from source:
|
|
44
38
|
|
|
45
39
|
```
|
|
40
|
+
|
|
46
41
|
cd packages/epo-widget-lib
|
|
47
42
|
yarn
|
|
48
43
|
yarn build # production build
|
|
44
|
+
|
|
49
45
|
# yarn dev # development server
|
|
46
|
+
|
|
50
47
|
```
|
|
51
48
|
|
|
52
49
|
### Storybook
|
|
@@ -58,8 +55,10 @@ Stories from component folders following the `\*\*.stories.[t|j]sx will be inclu
|
|
|
58
55
|
To run Storybook:
|
|
59
56
|
|
|
60
57
|
```
|
|
58
|
+
|
|
61
59
|
yarn build
|
|
62
60
|
yarn storybook
|
|
61
|
+
|
|
63
62
|
```
|
|
64
63
|
|
|
65
64
|
## Test
|
|
@@ -67,20 +66,27 @@ yarn storybook
|
|
|
67
66
|
Each component in EPO Widget Library contains a Jest unit test. Tests should be co-located with component code and their stories and follow the `**.test.[t|j]sx` naming format.
|
|
68
67
|
|
|
69
68
|
```
|
|
69
|
+
|
|
70
70
|
yarn test
|
|
71
|
+
|
|
71
72
|
# yarn test:generate-output # will save to .jest-test-results.json for Storybook
|
|
73
|
+
|
|
72
74
|
```
|
|
73
75
|
|
|
74
76
|
To add a unit test to it's Storybook page add the filename of the unit test to the `parameters` property of the story
|
|
75
77
|
|
|
76
78
|
```
|
|
79
|
+
|
|
77
80
|
export const Primary: ComponentStoryObj<typeof DemoButton> = {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
args: {
|
|
82
|
+
disabled: false,
|
|
83
|
+
children: "Hello",
|
|
84
|
+
},
|
|
85
|
+
parameters: {
|
|
86
|
+
jest: "DemoButton.test.tsx",
|
|
87
|
+
},
|
|
85
88
|
};
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
|
|
86
92
|
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),v=require("react"),q=require("@rubin-epo/epo-react-lib/SelectListbox"),C=require("@rubin-epo/epo-react-lib/styles"),S=require("react-i18next"),R=require("use-resize-observer"),s=require("./widgets/CameraFilter/data.cjs"),r=require("./widgets/CameraFilter/styles.cjs"),y=require("./widgets/CameraFilter/CondensedFilterRanges/CondensedFilterRanges.cjs"),L=require("./widgets/CameraFilter/SpectrumDisplay/SpectrumDisplay.cjs"),x=l=>l&&l.__esModule?l:{default:l},M=x(q),O=x(R),h=()=>{const{t:l}=S.useTranslation(),{ref:j,width:m=1}=O.default(),[c,p]=v.useState(null),{BREAK_TABLET:g}=C.tokens,i=m<parseInt(g),{[i?"condensed":"default"]:{min:a,max:_,range:n}}=s.rangeConfig,o=s.filters[0].range[0],d=s.filters[s.filters.length-1].range[1]-o,u=s.filters.filter(({band:e})=>e),F=[{value:"none",label:l("camera_filter.labels.option",{context:"none"})}].concat(u.map(({band:e})=>({value:e,label:l("camera_filter.labels.option",{band:e})}))),b=s.filters.find(({band:e})=>e===c);return t.jsxs(r.FilterContainer,{ref:j,children:[t.jsx("h1",{children:l("camera_filter.title")}),i&&t.jsx(y.default,{filters:u,min:a,spectrumRange:n}),t.jsxs(r.FilterTable,{"aria-hidden":i,range:d/n*100,offset:(o-a)/n*100,"data-testid":"expanded-filters",children:[t.jsx("colgroup",{children:s.filters.map(({range:e})=>t.jsx("col",{style:{width:`${(e[1]-e[0])/d*100}%`}},e.join("")))}),t.jsx(r.FilterNames,{children:t.jsx("tr",{children:s.filters.map(({band:e})=>t.jsx(r.FilterName,{id:`${e}-name`,band:e,scope:"col","aria-hidden":!e,$isCondensed:i,children:e},e))})}),!i&&t.jsx(r.FilterRanges,{children:t.jsx("tr",{children:s.filters.map(({band:e,range:f})=>t.jsx(r.FilterRange,{"aria-hidden":!e,children:e&&t.jsxs(t.Fragment,{children:[f.join("–"),t.jsx("br",{}),t.jsx(r.Wavelength,{children:"nm"})]})},f.join()))})})]}),t.jsx(L.default,{min:a,max:_,range:n,isCondensed:i,activeFilter:b}),t.jsxs(r.SelectContainer,{children:[t.jsx(r.SelectLabel,{id:"filterSelectLabel",children:l("camera_filter.labels.select")}),t.jsx(M.default,{options:F,value:c,onChangeCallback:e=>p(e),width:"100%",maxWidth:"100%",labelledById:"filterSelectLabel"})]})]})};h.displayName="Widgets.CameraFilter";exports.default=h;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { jsxs as a, jsx as t, Fragment as b } from "react/jsx-runtime";
|
|
2
|
+
import { useState as v } from "react";
|
|
3
|
+
import R from "@rubin-epo/epo-react-lib/SelectListbox";
|
|
4
|
+
import { tokens as S } from "@rubin-epo/epo-react-lib/styles";
|
|
5
|
+
import { useTranslation as j } from "react-i18next";
|
|
6
|
+
import y from "use-resize-observer";
|
|
7
|
+
import { filters as i, rangeConfig as B } from "./widgets/CameraFilter/data.js";
|
|
8
|
+
import { FilterContainer as L, FilterTable as _, FilterNames as O, FilterName as T, FilterRanges as w, FilterRange as A, Wavelength as M, SelectContainer as N, SelectLabel as W } from "./widgets/CameraFilter/styles.js";
|
|
9
|
+
import $ from "./widgets/CameraFilter/CondensedFilterRanges/CondensedFilterRanges.js";
|
|
10
|
+
import k from "./widgets/CameraFilter/SpectrumDisplay/SpectrumDisplay.js";
|
|
11
|
+
const E = () => {
|
|
12
|
+
const { t: l } = j(), { ref: p, width: h = 1 } = y(), [s, g] = v(null), { BREAK_TABLET: u } = S, r = h < parseInt(u), {
|
|
13
|
+
[r ? "condensed" : "default"]: { min: o, max: F, range: n }
|
|
14
|
+
} = B, c = i[0].range[0], d = i[i.length - 1].range[1] - c, m = i.filter(({ band: e }) => e), x = [{
|
|
15
|
+
value: "none",
|
|
16
|
+
label: l("camera_filter.labels.option", { context: "none" })
|
|
17
|
+
}].concat(
|
|
18
|
+
m.map(({ band: e }) => ({
|
|
19
|
+
value: e,
|
|
20
|
+
label: l("camera_filter.labels.option", { band: e })
|
|
21
|
+
}))
|
|
22
|
+
), C = i.find(({ band: e }) => e === s);
|
|
23
|
+
return /* @__PURE__ */ a(L, { ref: p, children: [
|
|
24
|
+
/* @__PURE__ */ t("h1", { children: l("camera_filter.title") }),
|
|
25
|
+
r && /* @__PURE__ */ t(
|
|
26
|
+
$,
|
|
27
|
+
{
|
|
28
|
+
filters: m,
|
|
29
|
+
min: o,
|
|
30
|
+
spectrumRange: n
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ a(
|
|
34
|
+
_,
|
|
35
|
+
{
|
|
36
|
+
"aria-hidden": r,
|
|
37
|
+
range: d / n * 100,
|
|
38
|
+
offset: (c - o) / n * 100,
|
|
39
|
+
"data-testid": "expanded-filters",
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ t("colgroup", { children: i.map(({ range: e }) => /* @__PURE__ */ t(
|
|
42
|
+
"col",
|
|
43
|
+
{
|
|
44
|
+
style: {
|
|
45
|
+
width: `${(e[1] - e[0]) / d * 100}%`
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
e.join("")
|
|
49
|
+
)) }),
|
|
50
|
+
/* @__PURE__ */ t(O, { children: /* @__PURE__ */ t("tr", { children: i.map(({ band: e }) => /* @__PURE__ */ t(
|
|
51
|
+
T,
|
|
52
|
+
{
|
|
53
|
+
id: `${e}-name`,
|
|
54
|
+
band: e,
|
|
55
|
+
scope: "col",
|
|
56
|
+
"aria-hidden": !e,
|
|
57
|
+
$isCondensed: r,
|
|
58
|
+
children: e
|
|
59
|
+
},
|
|
60
|
+
e
|
|
61
|
+
)) }) }),
|
|
62
|
+
!r && /* @__PURE__ */ t(w, { children: /* @__PURE__ */ t("tr", { children: i.map(({ band: e, range: f }) => /* @__PURE__ */ t(A, { "aria-hidden": !e, children: e && /* @__PURE__ */ a(b, { children: [
|
|
63
|
+
f.join("–"),
|
|
64
|
+
/* @__PURE__ */ t("br", {}),
|
|
65
|
+
/* @__PURE__ */ t(M, { children: "nm" })
|
|
66
|
+
] }) }, f.join())) }) })
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ t(
|
|
71
|
+
k,
|
|
72
|
+
{
|
|
73
|
+
min: o,
|
|
74
|
+
max: F,
|
|
75
|
+
range: n,
|
|
76
|
+
isCondensed: r,
|
|
77
|
+
activeFilter: C
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ a(N, { children: [
|
|
81
|
+
/* @__PURE__ */ t(W, { id: "filterSelectLabel", children: l("camera_filter.labels.select") }),
|
|
82
|
+
/* @__PURE__ */ t(
|
|
83
|
+
R,
|
|
84
|
+
{
|
|
85
|
+
options: x,
|
|
86
|
+
value: s,
|
|
87
|
+
onChangeCallback: (e) => g(e),
|
|
88
|
+
width: "100%",
|
|
89
|
+
maxWidth: "100%",
|
|
90
|
+
labelledById: "filterSelectLabel"
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
] })
|
|
94
|
+
] });
|
|
95
|
+
};
|
|
96
|
+
E.displayName = "Widgets.CameraFilter";
|
|
97
|
+
export {
|
|
98
|
+
E as default
|
|
99
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),g=require("react"),N=require("use-resize-observer"),M=require("react-i18next"),c=require("./widgets/ColorTool/utilities.cjs"),t=require("./widgets/ColorTool/styles.cjs"),H=require("@rubin-epo/epo-react-lib"),W=require("./widgets/ColorTool/FilterControls/FilterControls.cjs"),$=require("./widgets/ColorTool/ImageComposite/ImageComposite.cjs"),z=l=>l&&l.__esModule?l:{default:l},O=z(N),m=({data:l,objectOptions:T=[],selectedData:p,colorOptions:L=[],selectionCallback:j,isDisabled:b=!1,isDisplayOnly:i=!1,hideImage:_=!1,hideSubtitle:q=!1})=>{const{ref:S,width:y=1}=O.default(),[s,h]=g.useState(c.prepareData(p));g.useEffect(()=>{j&&j(s)},[s]);const F=r=>{const{label:n}=r,{filters:f}=s,I=f.map(C=>C.label===n?r:C);return h({...s,filters:I})},R=r=>{const{value:n}=r.target;return h({name:n,filters:c.getDataFiltersByName(l,n)})},v=()=>h({...s,filters:c.resetFilters(s.filters)}),d=l.length>1,{t:o}=M.useTranslation(),B=o("colorTool.actions.select_an_object"),{filters:u,name:a,caption:x}=s,D=c.getCategoryName(l,a);return e.jsxs(t.WidgetContainer,{ref:S,$isCondensed:y<1e3,$hideControls:i,children:[a&&(i||d)&&e.jsxs(t.Subtitle,{children:[d&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:o("colorTool.labels.object_type")}),e.jsx("dd",{children:D})]}),!q&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:o("colorTool.labels.object",{context:d?"selected":!1})}),e.jsx("dd",{children:a})]})]}),!i&&e.jsxs(t.ControlsContainer,{children:[d&&e.jsx(t.SelectionContainer,{children:e.jsx(H.Select,{id:"astroObjectSelector",placeholder:B,options:T,onChange:R,value:a,disabled:b})}),u&&e.jsxs(e.Fragment,{children:[e.jsx(t.ToolsHeader,{id:"filterLabel",children:o("colorTool.labels.filter")}),e.jsx(t.ToolsHeader,{id:"colorLabel",children:o("colorTool.labels.color")}),e.jsx(t.ToolsHeader,{id:"intensityLabel",children:o("colorTool.labels.color_intensity")})]}),u&&u.map(r=>{const{label:n,isDisabled:f}=r;return e.jsx(W.default,{filter:r,isDisabled:b||f,colorOptions:L,onChangeFilterCallback:F,buttonLabelledById:"filterLabel",selectLabelledById:"colorLabel",sliderLabelledById:"intensityLabel"},`filter-${n}`)})]}),!_&&e.jsx($.default,{filters:u}),a&&!i&&e.jsx(t.ResetButton,{disabled:b||!c.isResetButtonActive(s),onClick:v,icon:"RotateLeftWithCenter",children:o("colorTool.actions.reset")}),x&&e.jsx(t.Caption,{children:x})]})};m.displayName="Widgets.ColorTool";exports.default=m;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { jsxs as s, Fragment as b, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as _, useEffect as W } from "react";
|
|
3
|
+
import $ from "use-resize-observer";
|
|
4
|
+
import { useTranslation as k } from "react-i18next";
|
|
5
|
+
import { prepareData as w, getCategoryName as z, isResetButtonActive as A, getDataFiltersByName as E, resetFilters as H } from "./widgets/ColorTool/utilities.js";
|
|
6
|
+
import { WidgetContainer as M, Subtitle as P, ControlsContainer as q, SelectionContainer as G, ToolsHeader as p, ResetButton as J, Caption as K } from "./widgets/ColorTool/styles.js";
|
|
7
|
+
import { Select as O } from "@rubin-epo/epo-react-lib";
|
|
8
|
+
import Q from "./widgets/ColorTool/FilterControls/FilterControls.js";
|
|
9
|
+
import U from "./widgets/ColorTool/ImageComposite/ImageComposite.js";
|
|
10
|
+
const V = ({
|
|
11
|
+
data: d,
|
|
12
|
+
objectOptions: T = [],
|
|
13
|
+
selectedData: L,
|
|
14
|
+
colorOptions: j = [],
|
|
15
|
+
selectionCallback: C,
|
|
16
|
+
isDisabled: f = !1,
|
|
17
|
+
isDisplayOnly: i = !1,
|
|
18
|
+
hideImage: S = !1,
|
|
19
|
+
hideSubtitle: y = !1
|
|
20
|
+
}) => {
|
|
21
|
+
const { ref: B, width: F = 1 } = $(), [t, h] = _(
|
|
22
|
+
w(L)
|
|
23
|
+
);
|
|
24
|
+
W(() => {
|
|
25
|
+
C && C(t);
|
|
26
|
+
}, [t]);
|
|
27
|
+
const N = (l) => {
|
|
28
|
+
const { label: r } = l, { filters: m } = t, I = m.map(
|
|
29
|
+
(g) => g.label === r ? l : g
|
|
30
|
+
);
|
|
31
|
+
return h({
|
|
32
|
+
...t,
|
|
33
|
+
filters: I
|
|
34
|
+
});
|
|
35
|
+
}, R = (l) => {
|
|
36
|
+
const { value: r } = l.target;
|
|
37
|
+
return h({
|
|
38
|
+
name: r,
|
|
39
|
+
filters: E(d, r)
|
|
40
|
+
});
|
|
41
|
+
}, v = () => h({
|
|
42
|
+
...t,
|
|
43
|
+
filters: H(t.filters)
|
|
44
|
+
}), a = d.length > 1, { t: o } = k(), x = o("colorTool.actions.select_an_object"), { filters: c, name: n, caption: u } = t, D = z(d, n);
|
|
45
|
+
return /* @__PURE__ */ s(
|
|
46
|
+
M,
|
|
47
|
+
{
|
|
48
|
+
ref: B,
|
|
49
|
+
$isCondensed: F < 1e3,
|
|
50
|
+
$hideControls: i,
|
|
51
|
+
children: [
|
|
52
|
+
n && (i || a) && /* @__PURE__ */ s(P, { children: [
|
|
53
|
+
a && /* @__PURE__ */ s(b, { children: [
|
|
54
|
+
/* @__PURE__ */ e("dt", { children: o("colorTool.labels.object_type") }),
|
|
55
|
+
/* @__PURE__ */ e("dd", { children: D })
|
|
56
|
+
] }),
|
|
57
|
+
!y && /* @__PURE__ */ s(b, { children: [
|
|
58
|
+
/* @__PURE__ */ e("dt", { children: o("colorTool.labels.object", {
|
|
59
|
+
context: a ? "selected" : !1
|
|
60
|
+
}) }),
|
|
61
|
+
/* @__PURE__ */ e("dd", { children: n })
|
|
62
|
+
] })
|
|
63
|
+
] }),
|
|
64
|
+
!i && /* @__PURE__ */ s(q, { children: [
|
|
65
|
+
a && /* @__PURE__ */ e(G, { children: /* @__PURE__ */ e(
|
|
66
|
+
O,
|
|
67
|
+
{
|
|
68
|
+
id: "astroObjectSelector",
|
|
69
|
+
placeholder: x,
|
|
70
|
+
options: T,
|
|
71
|
+
onChange: R,
|
|
72
|
+
value: n,
|
|
73
|
+
disabled: f
|
|
74
|
+
}
|
|
75
|
+
) }),
|
|
76
|
+
c && /* @__PURE__ */ s(b, { children: [
|
|
77
|
+
/* @__PURE__ */ e(p, { id: "filterLabel", children: o("colorTool.labels.filter") }),
|
|
78
|
+
/* @__PURE__ */ e(p, { id: "colorLabel", children: o("colorTool.labels.color") }),
|
|
79
|
+
/* @__PURE__ */ e(p, { id: "intensityLabel", children: o("colorTool.labels.color_intensity") })
|
|
80
|
+
] }),
|
|
81
|
+
c && c.map((l) => {
|
|
82
|
+
const { label: r, isDisabled: m } = l;
|
|
83
|
+
return /* @__PURE__ */ e(
|
|
84
|
+
Q,
|
|
85
|
+
{
|
|
86
|
+
filter: l,
|
|
87
|
+
isDisabled: f || m,
|
|
88
|
+
colorOptions: j,
|
|
89
|
+
onChangeFilterCallback: N,
|
|
90
|
+
buttonLabelledById: "filterLabel",
|
|
91
|
+
selectLabelledById: "colorLabel",
|
|
92
|
+
sliderLabelledById: "intensityLabel"
|
|
93
|
+
},
|
|
94
|
+
`filter-${r}`
|
|
95
|
+
);
|
|
96
|
+
})
|
|
97
|
+
] }),
|
|
98
|
+
!S && /* @__PURE__ */ e(U, { filters: c }),
|
|
99
|
+
n && !i && /* @__PURE__ */ e(
|
|
100
|
+
J,
|
|
101
|
+
{
|
|
102
|
+
disabled: f || !A(t),
|
|
103
|
+
onClick: v,
|
|
104
|
+
icon: "RotateLeftWithCenter",
|
|
105
|
+
children: o("colorTool.actions.reset")
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
u && /* @__PURE__ */ e(K, { children: u })
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
V.displayName = "Widgets.ColorTool";
|
|
114
|
+
export {
|
|
115
|
+
V as default
|
|
116
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),i=require("react-i18next"),_=require("@rubin-epo/epo-react-lib/SelectListbox"),m=require("@rubin-epo/epo-react-lib/ColorSwatch"),r=require("./widgets/FilterTool/styles.cjs"),c=e=>e&&e.__esModule?e:{default:e},C=c(_),T=c(m),j=({selectedColor:e="none",selectionCallback:f,isDisabled:h=!1,id:u,labelledById:g})=>{const{t:l}=i.useTranslation(),t={violet:"#861cff",blue:"#0019ff",green:"#6bd853",yellow:"#ffdd15",orange:"#f18922",red:"#ec1c24",none:"transparent"},p={violet:"M546.1,312.5l212.8,1.9h0.4l0.5,0.2L1396,522.8c6.9,2.3,10.7,9.7,8.5,16.7s-9.7,10.7-16.7,8.5l0,0l-0.4-0.1L757.8,320.4l0.9,0.2L546.1,312.5z",blue:"M546.1,312.4l206.5-4.4h0.4l0.4,0.1l641.1,164c7,1.8,11.2,8.9,9.4,15.9c-1.8,7-8.9,11.2-15.9,9.4l-0.4-0.1L751.8,313.8l0.8,0.1L546.1,312.4z",green:"M547.8,312l200.6-10.6h0.3l0.4,0.1l644.8,120.3c7,1.4,11.5,8.2,10.1,15.2c-1.4,6.9-8,11.4-14.9,10.2l-0.4-0.1L747.8,307.4l0.7,0.1L547.8,312z",yellow:"M546.1,312.5l205.8-17.3h0.3h0.4l640.4,75.3c7.1,0.8,12.2,7.2,11.3,14.3c-0.8,7.1-7.2,12.2-14.3,11.3l-0.4-0.1l-637.9-94.5h0.6L546.1,312.5z",orange:"M546.1,311l189.3-21.8h0.2h0.3l656.5,33.3c7,0.4,12.4,6.3,12,13.3s-6.3,12.4-13.3,12h-0.4l-655.2-52.9h0.5L546.1,311z",red:"M546.1,311L730,283.9h0.1h0.2l661.4-9.9c6.9-0.1,12.6,5.4,12.7,12.3s-5.4,12.6-12.3,12.7h-0.4l-661.4-9.8h0.4L546.1,311z"},n={violet:"1426.5,547.9 1353.2,550.6 1377.9,530.1 1372.3,498.5",blue:"1431.5,496.4 1358.6,504.1 1381.8,482 1374.1,450.9",green:"1437.9,443.4 1366.1,458.4 1387,434.1 1376.2,403.9",yellow:"1438.9,389.7 1368,408.2 1387.6,382.8 1375.4,353.3",orange:"1443.7,340.3 1373.9,362.8 1392.1,336.4 1378.2,307.5",red:"1441.9,290 1372.4,313.2 1390.3,286.6 1376.1,257.9"},y=Object.keys(t).map(s=>({value:s,label:l(`filterTool.colors.${s}`),icon:o.jsx(T.default,{color:s,size:"small"})})),x=s=>e!==s&&e!=="none",w=l("filterTool.selectLabel"),a=e==="none",b=n[e].split(" ").pop()||"",d=n[e]?(b||"").split(","):[];return o.jsxs(r.Wrapper,{children:[o.jsxs(r.PrismSVG,{version:"1.1",viewBox:"0 0 1551.6 736.7","aria-labelledby":g,children:[o.jsxs("defs",{children:[o.jsxs("linearGradient",{id:"no-arrow-red",children:[o.jsx("stop",{offset:"0%",stopColor:t.red}),o.jsx("stop",{offset:"81%",stopColor:t.red}),o.jsx("stop",{offset:"81%",stopColor:"transparent"}),o.jsx("stop",{offset:"100%",stopColor:"transparent"})]}),o.jsxs("linearGradient",{id:"no-arrow-orange",children:[o.jsx("stop",{offset:"0%",stopColor:t.orange}),o.jsx("stop",{offset:"80%",stopColor:t.orange}),o.jsx("stop",{offset:"80%",stopColor:"transparent"}),o.jsx("stop",{offset:"100%",stopColor:"transparent"})]}),o.jsxs("linearGradient",{id:"no-arrow-yellow",children:[o.jsx("stop",{offset:"0%",stopColor:t.yellow}),o.jsx("stop",{offset:"79%",stopColor:t.yellow}),o.jsx("stop",{offset:"79%",stopColor:"transparent"}),o.jsx("stop",{offset:"100%",stopColor:"transparent"})]}),o.jsxs("linearGradient",{id:"no-arrow-green",children:[o.jsx("stop",{offset:"0%",stopColor:t.green}),o.jsx("stop",{offset:"78%",stopColor:t.green}),o.jsx("stop",{offset:"78%",stopColor:"transparent"}),o.jsx("stop",{offset:"100%",stopColor:"transparent"})]}),o.jsxs("linearGradient",{id:"no-arrow-blue",children:[o.jsx("stop",{offset:"0%",stopColor:t.blue}),o.jsx("stop",{offset:"77%",stopColor:t.blue}),o.jsx("stop",{offset:"77%",stopColor:"transparent"}),o.jsx("stop",{offset:"100%",stopColor:"transparent"})]}),o.jsxs("linearGradient",{id:"no-arrow-violet",children:[o.jsx("stop",{offset:"0%",stopColor:t.violet}),o.jsx("stop",{offset:"77%",stopColor:t.violet}),o.jsx("stop",{offset:"77%",stopColor:"transparent"}),o.jsx("stop",{offset:"100%",stopColor:"transparent"})]})]}),o.jsxs("radialGradient",{id:"gradient_1_",cx:"718.4264",cy:"-294.6529",r:"417.8",fx:"638.9412",fy:"-303.5418",gradientTransform:"matrix(1 0 0 1 0 534)",gradientUnits:"userSpaceOnUse",children:[o.jsx("stop",{offset:"0.12",style:{stopColor:"#FFFFFF"}}),o.jsx("stop",{offset:"1",style:{stopColor:"#000000"}})]}),o.jsxs("g",{children:[o.jsx(r.WhiteLine,{id:"white_ray",x1:"108.2",y1:"463.3",x2:"546.1",y2:"312.5"}),o.jsx(r.WhiteLine,{id:"white_light_arrow_line",x1:"376.8",y1:"327.9",x2:"430",y2:"309.6"}),o.jsx("polygon",{id:"white_light_arrow",points:"420.7,325.4 428.1,310.3 413,302.9 422.5,299.7 437.6,307 430.2,322.1",fill:"#ffffff"}),o.jsx("text",{transform:"matrix(0.9446 -0.3282 0.3282 0.9446 152.0965 417.697)",fill:"#ffffff",children:o.jsx(i.Trans,{i18nKey:"filterTool.whiteLight"})})]}),o.jsxs("g",{children:[o.jsx("text",{transform:"matrix(1 0 0 1 598.2964 606.0872)",fill:"#ffffff",children:o.jsx(i.Trans,{i18nKey:"filterTool.prism"})}),o.jsx("polygon",{id:"gradient",points:"653.2,127 867.4,498 438.9,498",fill:"url(#gradient_1_)",style:{opacity:.3}})]}),o.jsx(r.PrismOutline,{id:"outline",points:"653.2,127 760.3,312.5 867.4,498 653.2,498 438.9,498 546.1,312.5 "}),o.jsx("g",{role:"list",id:"rays_out","aria-label":l("filterTool.light_out"),children:Object.keys(p).map(s=>o.jsx(r.Ray,{id:`${s}_ray`,style:{"--ray-fill":x(s)?`url(#no-arrow-${s})`:t[s]},d:p[s],role:"listitem","aria-label":l(`filterTool.colors.${s}`)},s))}),o.jsxs("g",{children:[o.jsx("text",{transform:"matrix(1 0 0 1 1206.5464 164.1372)",fill:"#ffffff",children:o.jsx(i.Trans,{i18nKey:"filterTool.filter"})}),o.jsx(r.Filter,{id:"filter",x1:"1255.6",y1:"235.7",x2:"1193.1",y2:"550.3",stroke:t[e],fill:"#ffffff","aria-label":l(`filterTool.colors.${e}`)})]}),o.jsxs("g",{role:"list",id:"rays_filtered","aria-label":l("filterTool.light_filtered"),children:[Object.keys(n).map(s=>o.jsx(r.Arrow,{id:`${s}_arrow`,style:{"--arrow-opacity":x(s)&&0,"--arrow-fill":t[s]},points:n[s],role:a?"listitem":"presentation","aria-label":a?l(`filterTool.colors.${s}`):void 0},s)),!a&&o.jsx("text",{role:"listitem",x:d[0],y:d[1],fill:"#ffffff",dy:"-25",children:o.jsx(i.Trans,{i18nKey:`filterTool.colors.${e}`})})]})]}),o.jsx(r.SelectContainer,{children:o.jsx(C.default,{options:y,isDisabled:h,value:e,onChangeCallback:s=>f&&f(s||"none"),placeholder:w,maxWidth:"100%",width:"200px",id:u})})]})};j.displayName="Widgets.FilterTool";exports.default=j;
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { jsx as o, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as C, Trans as n } from "react-i18next";
|
|
3
|
+
import u from "@rubin-epo/epo-react-lib/SelectListbox";
|
|
4
|
+
import L from "@rubin-epo/epo-react-lib/ColorSwatch";
|
|
5
|
+
import { Wrapper as T, PrismSVG as _, WhiteLine as h, PrismOutline as v, Ray as F, Filter as G, Arrow as $, SelectContainer as z } from "./widgets/FilterTool/styles.js";
|
|
6
|
+
const M = ({
|
|
7
|
+
selectedColor: e = "none",
|
|
8
|
+
selectionCallback: a,
|
|
9
|
+
isDisabled: m = !1,
|
|
10
|
+
id: g,
|
|
11
|
+
labelledById: y
|
|
12
|
+
}) => {
|
|
13
|
+
const { t: i } = C(), r = {
|
|
14
|
+
violet: "#861cff",
|
|
15
|
+
blue: "#0019ff",
|
|
16
|
+
green: "#6bd853",
|
|
17
|
+
yellow: "#ffdd15",
|
|
18
|
+
orange: "#f18922",
|
|
19
|
+
red: "#ec1c24",
|
|
20
|
+
none: "transparent"
|
|
21
|
+
}, p = {
|
|
22
|
+
violet: "M546.1,312.5l212.8,1.9h0.4l0.5,0.2L1396,522.8c6.9,2.3,10.7,9.7,8.5,16.7s-9.7,10.7-16.7,8.5l0,0l-0.4-0.1L757.8,320.4l0.9,0.2L546.1,312.5z",
|
|
23
|
+
blue: "M546.1,312.4l206.5-4.4h0.4l0.4,0.1l641.1,164c7,1.8,11.2,8.9,9.4,15.9c-1.8,7-8.9,11.2-15.9,9.4l-0.4-0.1L751.8,313.8l0.8,0.1L546.1,312.4z",
|
|
24
|
+
green: "M547.8,312l200.6-10.6h0.3l0.4,0.1l644.8,120.3c7,1.4,11.5,8.2,10.1,15.2c-1.4,6.9-8,11.4-14.9,10.2l-0.4-0.1L747.8,307.4l0.7,0.1L547.8,312z",
|
|
25
|
+
yellow: "M546.1,312.5l205.8-17.3h0.3h0.4l640.4,75.3c7.1,0.8,12.2,7.2,11.3,14.3c-0.8,7.1-7.2,12.2-14.3,11.3l-0.4-0.1l-637.9-94.5h0.6L546.1,312.5z",
|
|
26
|
+
orange: "M546.1,311l189.3-21.8h0.2h0.3l656.5,33.3c7,0.4,12.4,6.3,12,13.3s-6.3,12.4-13.3,12h-0.4l-655.2-52.9h0.5L546.1,311z",
|
|
27
|
+
red: "M546.1,311L730,283.9h0.1h0.2l661.4-9.9c6.9-0.1,12.6,5.4,12.7,12.3s-5.4,12.6-12.3,12.7h-0.4l-661.4-9.8h0.4L546.1,311z"
|
|
28
|
+
}, s = {
|
|
29
|
+
violet: "1426.5,547.9 1353.2,550.6 1377.9,530.1 1372.3,498.5",
|
|
30
|
+
blue: "1431.5,496.4 1358.6,504.1 1381.8,482 1374.1,450.9",
|
|
31
|
+
green: "1437.9,443.4 1366.1,458.4 1387,434.1 1376.2,403.9",
|
|
32
|
+
yellow: "1438.9,389.7 1368,408.2 1387.6,382.8 1375.4,353.3",
|
|
33
|
+
orange: "1443.7,340.3 1373.9,362.8 1392.1,336.4 1378.2,307.5",
|
|
34
|
+
red: "1441.9,290 1372.4,313.2 1390.3,286.6 1376.1,257.9"
|
|
35
|
+
}, w = Object.keys(r).map((t) => ({
|
|
36
|
+
value: t,
|
|
37
|
+
label: i(`filterTool.colors.${t}`),
|
|
38
|
+
icon: /* @__PURE__ */ o(L, { color: t, size: "small" })
|
|
39
|
+
})), d = (t) => e !== t && e !== "none", x = i("filterTool.selectLabel"), f = e === "none", b = s[e].split(" ").pop() || "", c = s[e] ? (b || "").split(",") : [];
|
|
40
|
+
return /* @__PURE__ */ l(T, { children: [
|
|
41
|
+
/* @__PURE__ */ l(
|
|
42
|
+
_,
|
|
43
|
+
{
|
|
44
|
+
version: "1.1",
|
|
45
|
+
viewBox: "0 0 1551.6 736.7",
|
|
46
|
+
"aria-labelledby": y,
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ l("defs", { children: [
|
|
49
|
+
/* @__PURE__ */ l("linearGradient", { id: "no-arrow-red", children: [
|
|
50
|
+
/* @__PURE__ */ o("stop", { offset: "0%", stopColor: r.red }),
|
|
51
|
+
/* @__PURE__ */ o("stop", { offset: "81%", stopColor: r.red }),
|
|
52
|
+
/* @__PURE__ */ o("stop", { offset: "81%", stopColor: "transparent" }),
|
|
53
|
+
/* @__PURE__ */ o("stop", { offset: "100%", stopColor: "transparent" })
|
|
54
|
+
] }),
|
|
55
|
+
/* @__PURE__ */ l("linearGradient", { id: "no-arrow-orange", children: [
|
|
56
|
+
/* @__PURE__ */ o("stop", { offset: "0%", stopColor: r.orange }),
|
|
57
|
+
/* @__PURE__ */ o("stop", { offset: "80%", stopColor: r.orange }),
|
|
58
|
+
/* @__PURE__ */ o("stop", { offset: "80%", stopColor: "transparent" }),
|
|
59
|
+
/* @__PURE__ */ o("stop", { offset: "100%", stopColor: "transparent" })
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ l("linearGradient", { id: "no-arrow-yellow", children: [
|
|
62
|
+
/* @__PURE__ */ o("stop", { offset: "0%", stopColor: r.yellow }),
|
|
63
|
+
/* @__PURE__ */ o("stop", { offset: "79%", stopColor: r.yellow }),
|
|
64
|
+
/* @__PURE__ */ o("stop", { offset: "79%", stopColor: "transparent" }),
|
|
65
|
+
/* @__PURE__ */ o("stop", { offset: "100%", stopColor: "transparent" })
|
|
66
|
+
] }),
|
|
67
|
+
/* @__PURE__ */ l("linearGradient", { id: "no-arrow-green", children: [
|
|
68
|
+
/* @__PURE__ */ o("stop", { offset: "0%", stopColor: r.green }),
|
|
69
|
+
/* @__PURE__ */ o("stop", { offset: "78%", stopColor: r.green }),
|
|
70
|
+
/* @__PURE__ */ o("stop", { offset: "78%", stopColor: "transparent" }),
|
|
71
|
+
/* @__PURE__ */ o("stop", { offset: "100%", stopColor: "transparent" })
|
|
72
|
+
] }),
|
|
73
|
+
/* @__PURE__ */ l("linearGradient", { id: "no-arrow-blue", children: [
|
|
74
|
+
/* @__PURE__ */ o("stop", { offset: "0%", stopColor: r.blue }),
|
|
75
|
+
/* @__PURE__ */ o("stop", { offset: "77%", stopColor: r.blue }),
|
|
76
|
+
/* @__PURE__ */ o("stop", { offset: "77%", stopColor: "transparent" }),
|
|
77
|
+
/* @__PURE__ */ o("stop", { offset: "100%", stopColor: "transparent" })
|
|
78
|
+
] }),
|
|
79
|
+
/* @__PURE__ */ l("linearGradient", { id: "no-arrow-violet", children: [
|
|
80
|
+
/* @__PURE__ */ o("stop", { offset: "0%", stopColor: r.violet }),
|
|
81
|
+
/* @__PURE__ */ o("stop", { offset: "77%", stopColor: r.violet }),
|
|
82
|
+
/* @__PURE__ */ o("stop", { offset: "77%", stopColor: "transparent" }),
|
|
83
|
+
/* @__PURE__ */ o("stop", { offset: "100%", stopColor: "transparent" })
|
|
84
|
+
] })
|
|
85
|
+
] }),
|
|
86
|
+
/* @__PURE__ */ l(
|
|
87
|
+
"radialGradient",
|
|
88
|
+
{
|
|
89
|
+
id: "gradient_1_",
|
|
90
|
+
cx: "718.4264",
|
|
91
|
+
cy: "-294.6529",
|
|
92
|
+
r: "417.8",
|
|
93
|
+
fx: "638.9412",
|
|
94
|
+
fy: "-303.5418",
|
|
95
|
+
gradientTransform: "matrix(1 0 0 1 0 534)",
|
|
96
|
+
gradientUnits: "userSpaceOnUse",
|
|
97
|
+
children: [
|
|
98
|
+
/* @__PURE__ */ o("stop", { offset: "0.12", style: { stopColor: "#FFFFFF" } }),
|
|
99
|
+
/* @__PURE__ */ o("stop", { offset: "1", style: { stopColor: "#000000" } })
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
/* @__PURE__ */ l("g", { children: [
|
|
104
|
+
/* @__PURE__ */ o(
|
|
105
|
+
h,
|
|
106
|
+
{
|
|
107
|
+
id: "white_ray",
|
|
108
|
+
x1: "108.2",
|
|
109
|
+
y1: "463.3",
|
|
110
|
+
x2: "546.1",
|
|
111
|
+
y2: "312.5"
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
/* @__PURE__ */ o(
|
|
115
|
+
h,
|
|
116
|
+
{
|
|
117
|
+
id: "white_light_arrow_line",
|
|
118
|
+
x1: "376.8",
|
|
119
|
+
y1: "327.9",
|
|
120
|
+
x2: "430",
|
|
121
|
+
y2: "309.6"
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
/* @__PURE__ */ o(
|
|
125
|
+
"polygon",
|
|
126
|
+
{
|
|
127
|
+
id: "white_light_arrow",
|
|
128
|
+
points: "420.7,325.4 428.1,310.3 413,302.9 422.5,299.7 437.6,307 430.2,322.1",
|
|
129
|
+
fill: "#ffffff"
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
/* @__PURE__ */ o(
|
|
133
|
+
"text",
|
|
134
|
+
{
|
|
135
|
+
transform: "matrix(0.9446 -0.3282 0.3282 0.9446 152.0965 417.697)",
|
|
136
|
+
fill: "#ffffff",
|
|
137
|
+
children: /* @__PURE__ */ o(n, { i18nKey: "filterTool.whiteLight" })
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
] }),
|
|
141
|
+
/* @__PURE__ */ l("g", { children: [
|
|
142
|
+
/* @__PURE__ */ o("text", { transform: "matrix(1 0 0 1 598.2964 606.0872)", fill: "#ffffff", children: /* @__PURE__ */ o(n, { i18nKey: "filterTool.prism" }) }),
|
|
143
|
+
/* @__PURE__ */ o(
|
|
144
|
+
"polygon",
|
|
145
|
+
{
|
|
146
|
+
id: "gradient",
|
|
147
|
+
points: "653.2,127 867.4,498 438.9,498",
|
|
148
|
+
fill: "url(#gradient_1_)",
|
|
149
|
+
style: { opacity: 0.3 }
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
] }),
|
|
153
|
+
/* @__PURE__ */ o(
|
|
154
|
+
v,
|
|
155
|
+
{
|
|
156
|
+
id: "outline",
|
|
157
|
+
points: "653.2,127 760.3,312.5 867.4,498 653.2,498 438.9,498 546.1,312.5 "
|
|
158
|
+
}
|
|
159
|
+
),
|
|
160
|
+
/* @__PURE__ */ o(
|
|
161
|
+
"g",
|
|
162
|
+
{
|
|
163
|
+
role: "list",
|
|
164
|
+
id: "rays_out",
|
|
165
|
+
"aria-label": i("filterTool.light_out"),
|
|
166
|
+
children: Object.keys(p).map((t) => /* @__PURE__ */ o(
|
|
167
|
+
F,
|
|
168
|
+
{
|
|
169
|
+
id: `${t}_ray`,
|
|
170
|
+
style: {
|
|
171
|
+
"--ray-fill": d(t) ? `url(#no-arrow-${t})` : r[t]
|
|
172
|
+
},
|
|
173
|
+
d: p[t],
|
|
174
|
+
role: "listitem",
|
|
175
|
+
"aria-label": i(`filterTool.colors.${t}`)
|
|
176
|
+
},
|
|
177
|
+
t
|
|
178
|
+
))
|
|
179
|
+
}
|
|
180
|
+
),
|
|
181
|
+
/* @__PURE__ */ l("g", { children: [
|
|
182
|
+
/* @__PURE__ */ o("text", { transform: "matrix(1 0 0 1 1206.5464 164.1372)", fill: "#ffffff", children: /* @__PURE__ */ o(n, { i18nKey: "filterTool.filter" }) }),
|
|
183
|
+
/* @__PURE__ */ o(
|
|
184
|
+
G,
|
|
185
|
+
{
|
|
186
|
+
id: "filter",
|
|
187
|
+
x1: "1255.6",
|
|
188
|
+
y1: "235.7",
|
|
189
|
+
x2: "1193.1",
|
|
190
|
+
y2: "550.3",
|
|
191
|
+
stroke: r[e],
|
|
192
|
+
fill: "#ffffff",
|
|
193
|
+
"aria-label": i(`filterTool.colors.${e}`)
|
|
194
|
+
}
|
|
195
|
+
)
|
|
196
|
+
] }),
|
|
197
|
+
/* @__PURE__ */ l(
|
|
198
|
+
"g",
|
|
199
|
+
{
|
|
200
|
+
role: "list",
|
|
201
|
+
id: "rays_filtered",
|
|
202
|
+
"aria-label": i("filterTool.light_filtered"),
|
|
203
|
+
children: [
|
|
204
|
+
Object.keys(s).map((t) => /* @__PURE__ */ o(
|
|
205
|
+
$,
|
|
206
|
+
{
|
|
207
|
+
id: `${t}_arrow`,
|
|
208
|
+
style: {
|
|
209
|
+
"--arrow-opacity": d(t) && 0,
|
|
210
|
+
"--arrow-fill": r[t]
|
|
211
|
+
},
|
|
212
|
+
points: s[t],
|
|
213
|
+
role: f ? "listitem" : "presentation",
|
|
214
|
+
"aria-label": f ? i(`filterTool.colors.${t}`) : void 0
|
|
215
|
+
},
|
|
216
|
+
t
|
|
217
|
+
)),
|
|
218
|
+
!f && /* @__PURE__ */ o(
|
|
219
|
+
"text",
|
|
220
|
+
{
|
|
221
|
+
role: "listitem",
|
|
222
|
+
x: c[0],
|
|
223
|
+
y: c[1],
|
|
224
|
+
fill: "#ffffff",
|
|
225
|
+
dy: "-25",
|
|
226
|
+
children: /* @__PURE__ */ o(n, { i18nKey: `filterTool.colors.${e}` })
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
)
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
),
|
|
235
|
+
/* @__PURE__ */ o(z, { children: /* @__PURE__ */ o(
|
|
236
|
+
u,
|
|
237
|
+
{
|
|
238
|
+
options: w,
|
|
239
|
+
isDisabled: m,
|
|
240
|
+
value: e,
|
|
241
|
+
onChangeCallback: (t) => a && a(t || "none"),
|
|
242
|
+
placeholder: x,
|
|
243
|
+
maxWidth: "100%",
|
|
244
|
+
width: "200px",
|
|
245
|
+
id: g
|
|
246
|
+
}
|
|
247
|
+
) })
|
|
248
|
+
] });
|
|
249
|
+
};
|
|
250
|
+
M.displayName = "Widgets.FilterTool";
|
|
251
|
+
export {
|
|
252
|
+
M as default
|
|
253
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),a=require("react"),R=require("react-i18next"),T=require("@rubin-epo/epo-react-lib/IconComposer"),u=require("./widgets/SourceSelector/styles.cjs"),k=require("./widgets/SourceSelector/utilities.cjs"),W=require("./widgets/SourceSelector/Message/Message.cjs"),F=require("./widgets/SourceSelector/Points/Points.cjs"),G=e=>e&&e.__esModule?e:{default:e},N=G(T),C=({width:e=600,height:r=600,selectedSource:_=[],sources:f,alerts:n,images:b,selectionCallback:g,blinkConfig:q,color:y,isDisplayOnly:d=!1})=>{const[l,h]=a.useState(_),[v,A]=a.useState(!1),[I,x]=a.useState(),[B,S]=a.useState(!1),[M,L]=a.useState(null),{t:p}=R.useTranslation(),m="sourceSelectorWidget";a.useEffect(()=>{g&&g(l)},[l]);const j=(o,i,t)=>o.filter(c=>c.id===i&&c.type===t),V=o=>{if(v&&!d){const{target:i}=o,{id:t,type:c}=i.dataset;if(t&&c){if(!(j(l,t,c).length>0)){const D=j(f,t,c);h(P=>P.concat(D)),x(s.jsxs(s.Fragment,{children:[s.jsx(N.default,{icon:"checkmark"}),p("source_selector.messages.success")]})),S(!0)}}else x(p("source_selector.messages.failure")),S(!0)}},E=()=>{S(!1)},$=o=>{if(n&&n.length>1){const t=n[o].date-n[0].date;L({day:Math.round(t),hour:Math.round(24/t%24)||0})}};return s.jsxs(u.SourceSelectorContainer,{width:e,height:r,children:[!d&&s.jsx(W.default,{onMessageChangeCallback:E,isVisible:B,forIds:[m],children:I}),s.jsx(u.BackgroundBlinker,{images:b,blinkCallback:$,loadedCallback:()=>A(!0),...q}),M&&s.jsx(u.ElapsedDisplay,{...M}),s.jsx(u.SVG,{preserveAspectRatio:"xMidYMid meet",viewBox:`0 0 ${e} ${r}`,onClick:V,id:m,$isDisplayOnly:d,children:s.jsx(F.default,{xScale:k.getLinearScale([0,e],[0,e]),yScale:k.getLinearScale([0,r],[r,0]),color:y,sources:f,selectedSource:l})})]})};C.displayName="Widgets.SourceSelector";exports.default=C;
|