@rubin-epo/epo-widget-lib 0.6.4 → 0.6.5
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/CameraFilter.cjs +1 -1
- package/dist/CameraFilter.js +10 -8
- package/dist/ColorTool.cjs +1 -1
- package/dist/ColorTool.js +1 -1
- package/dist/widgets/ColorTool/FilterControls/FilterControls.cjs +1 -1
- package/dist/widgets/ColorTool/FilterControls/FilterControls.js +10 -9
- package/dist/widgets/ColorTool/FilterControls/styles.d.ts +1 -1
- package/package.json +2 -2
package/dist/CameraFilter.cjs
CHANGED
|
@@ -1 +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"),
|
|
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"),i=require("./widgets/CameraFilter/data.cjs"),l=require("./widgets/CameraFilter/styles.cjs"),y=require("./widgets/CameraFilter/CondensedFilterRanges/CondensedFilterRanges.cjs"),L=require("./widgets/CameraFilter/SpectrumDisplay/SpectrumDisplay.cjs"),x=s=>s&&s.__esModule?s:{default:s},M=x(q),O=x(R),h=()=>{const{t:s}=S.useTranslation(),{ref:j,width:m=1}=O.default(),[c,p]=v.useState(""),{BREAK_TABLET:g}=C.tokens,r=m<parseInt(g),{[r?"condensed":"default"]:{min:o,max:_,range:n}}=i.rangeConfig,d=i.filters[0].range[0],u=i.filters[i.filters.length-1].range[1]-d,f=i.filters.filter(({band:e})=>e),b=[{value:"none",label:s("camera_filter.labels.option",{context:"none"})}].concat(f.map(({band:e})=>({value:e,label:s("camera_filter.labels.option",{band:e})}))),F=c?i.filters.find(({band:e})=>e===c):void 0;return t.jsxs(l.FilterContainer,{ref:j,children:[t.jsx("h1",{children:s("camera_filter.title")}),r&&t.jsx(y.default,{filters:f,min:o,spectrumRange:n}),t.jsxs(l.FilterTable,{"aria-hidden":r,range:u/n*100,offset:(d-o)/n*100,"data-testid":"expanded-filters",children:[t.jsx("colgroup",{children:i.filters.map(({range:e})=>t.jsx("col",{style:{width:`${(e[1]-e[0])/u*100}%`}},e.join("")))}),t.jsx(l.FilterNames,{children:t.jsx("tr",{children:i.filters.map(({band:e},a)=>t.jsx(l.FilterName,{id:`${e}-name`,band:e,scope:"col","aria-hidden":!e,$isCondensed:r,children:e},a))})}),!r&&t.jsx(l.FilterRanges,{children:t.jsx("tr",{children:i.filters.map(({band:e,range:a})=>t.jsx(l.FilterRange,{"aria-hidden":!e,children:e&&t.jsxs(t.Fragment,{children:[a.join("–"),t.jsx("br",{}),t.jsx(l.Wavelength,{children:"nm"})]})},a.join()))})})]}),t.jsx(L.default,{min:o,max:_,range:n,isCondensed:r,activeFilter:F}),t.jsxs(l.SelectContainer,{children:[t.jsx(l.SelectLabel,{id:"filterSelectLabel",children:s("camera_filter.labels.select")}),t.jsx(M.default,{options:b,value:c,onChangeCallback:e=>p(e),width:"100%",maxWidth:"100%",labelledById:"filterSelectLabel"})]})]})};h.displayName="Widgets.CameraFilter";exports.default=h;
|
package/dist/CameraFilter.js
CHANGED
|
@@ -9,8 +9,10 @@ import { FilterContainer as L, FilterTable as _, FilterNames as O, FilterName as
|
|
|
9
9
|
import $ from "./widgets/CameraFilter/CondensedFilterRanges/CondensedFilterRanges.js";
|
|
10
10
|
import k from "./widgets/CameraFilter/SpectrumDisplay/SpectrumDisplay.js";
|
|
11
11
|
const E = () => {
|
|
12
|
-
const { t: n } = j(), { ref: p, width: h = 1 } = y(), [
|
|
13
|
-
|
|
12
|
+
const { t: n } = j(), { ref: p, width: h = 1 } = y(), [s, g] = v(
|
|
13
|
+
""
|
|
14
|
+
), { BREAK_TABLET: F } = S, r = h < parseInt(F), {
|
|
15
|
+
[r ? "condensed" : "default"]: { min: c, max: u, range: l }
|
|
14
16
|
} = B, d = i[0].range[0], m = i[i.length - 1].range[1] - d, f = i.filter(({ band: e }) => e), x = [{
|
|
15
17
|
value: "none",
|
|
16
18
|
label: n("camera_filter.labels.option", { context: "none" })
|
|
@@ -19,14 +21,14 @@ const E = () => {
|
|
|
19
21
|
value: e,
|
|
20
22
|
label: n("camera_filter.labels.option", { band: e })
|
|
21
23
|
}))
|
|
22
|
-
), C = i.find(({ band: e }) => e ===
|
|
24
|
+
), C = s ? i.find(({ band: e }) => e === s) : void 0;
|
|
23
25
|
return /* @__PURE__ */ o(L, { ref: p, children: [
|
|
24
26
|
/* @__PURE__ */ t("h1", { children: n("camera_filter.title") }),
|
|
25
27
|
r && /* @__PURE__ */ t(
|
|
26
28
|
$,
|
|
27
29
|
{
|
|
28
30
|
filters: f,
|
|
29
|
-
min:
|
|
31
|
+
min: c,
|
|
30
32
|
spectrumRange: l
|
|
31
33
|
}
|
|
32
34
|
),
|
|
@@ -35,7 +37,7 @@ const E = () => {
|
|
|
35
37
|
{
|
|
36
38
|
"aria-hidden": r,
|
|
37
39
|
range: m / l * 100,
|
|
38
|
-
offset: (d -
|
|
40
|
+
offset: (d - c) / l * 100,
|
|
39
41
|
"data-testid": "expanded-filters",
|
|
40
42
|
children: [
|
|
41
43
|
/* @__PURE__ */ t("colgroup", { children: i.map(({ range: e }) => /* @__PURE__ */ t(
|
|
@@ -70,8 +72,8 @@ const E = () => {
|
|
|
70
72
|
/* @__PURE__ */ t(
|
|
71
73
|
k,
|
|
72
74
|
{
|
|
73
|
-
min:
|
|
74
|
-
max:
|
|
75
|
+
min: c,
|
|
76
|
+
max: u,
|
|
75
77
|
range: l,
|
|
76
78
|
isCondensed: r,
|
|
77
79
|
activeFilter: C
|
|
@@ -83,7 +85,7 @@ const E = () => {
|
|
|
83
85
|
R,
|
|
84
86
|
{
|
|
85
87
|
options: x,
|
|
86
|
-
value:
|
|
88
|
+
value: s,
|
|
87
89
|
onChangeCallback: (e) => g(e),
|
|
88
90
|
width: "100%",
|
|
89
91
|
maxWidth: "100%",
|
package/dist/ColorTool.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),y=require("react"),W=require("react-i18next"),H=require("./widgets/ColorTool/utilities.cjs"),l=require("./widgets/ColorTool/styles.cjs"),N=require("@rubin-epo/epo-react-lib/SelectListbox"),R=require("./widgets/ColorTool/Actions/index.cjs"),T=require("./widgets/ColorTool/ImageComposite/ImageComposite.cjs"),$=require("./widgets/ColorTool/FilterControls/FilterControls.cjs"),v=o=>o&&o.__esModule?o:{default:o},E=v(N),p=({data:o,objectOptions:L=[],selectedData:d,colorOptions:C=[],selectionCallback:i,isDisabled:u=!1,isDisplayOnly:S=!1,className:g,config:_={actions:["reset"],width:600,height:600,hideSubtitle:!1}})=>{var j;const q={actions:["reset"],width:600,height:600,hideSubtitle:!1},h=y.useRef(null),{t:n}=W.useTranslation(),{filters:a,name:c}=d,{actions:F,width:r,height:s,hideSubtitle:w}={...q,..._};if(S)return e.jsx(T.default,{ref:h,filters:a,width:r,height:s,selectedObjectName:c,className:g});const B=t=>{const{label:f}=t,{filters:b}=d,O=b.map(m=>m.label===f?t:m);return i&&i({...d,filters:O})},I=t=>{if(t
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),y=require("react"),W=require("react-i18next"),H=require("./widgets/ColorTool/utilities.cjs"),l=require("./widgets/ColorTool/styles.cjs"),N=require("@rubin-epo/epo-react-lib/SelectListbox"),R=require("./widgets/ColorTool/Actions/index.cjs"),T=require("./widgets/ColorTool/ImageComposite/ImageComposite.cjs"),$=require("./widgets/ColorTool/FilterControls/FilterControls.cjs"),v=o=>o&&o.__esModule?o:{default:o},E=v(N),p=({data:o,objectOptions:L=[],selectedData:d,colorOptions:C=[],selectionCallback:i,isDisabled:u=!1,isDisplayOnly:S=!1,className:g,config:_={actions:["reset"],width:600,height:600,hideSubtitle:!1}})=>{var j;const q={actions:["reset"],width:600,height:600,hideSubtitle:!1},h=y.useRef(null),{t:n}=W.useTranslation(),{filters:a,name:c}=d,{actions:F,width:r,height:s,hideSubtitle:w}={...q,..._};if(S)return e.jsx(T.default,{ref:h,filters:a,width:r,height:s,selectedObjectName:c,className:g});const B=t=>{const{label:f}=t,{filters:b}=d,O=b.map(m=>m.label===f?t:m);return i&&i({...d,filters:O})},I=t=>{if(t)return i&&i({name:t,filters:H.getDataFiltersByName(o,t)})},x=o.length>1,M=n("colorTool.actions.select_an_object");return e.jsx(l.WidgetContainer,{className:g,children:e.jsxs(l.WidgetLayout,{style:{"--image-width":typeof r=="number"?`${r}px`:r,"--image-height":typeof s=="number"?`${s}px`:s},children:[c&&x&&e.jsx(l.Title,{children:!w&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:n("colorTool.labels.object")}),e.jsx("dd",{children:c})]})}),e.jsxs(l.ControlsContainer,{children:[a&&e.jsxs(e.Fragment,{children:[e.jsx(l.ToolsHeader,{id:"filterLabel",children:n("colorTool.labels.filter")}),e.jsx(l.ToolsHeader,{id:"colorLabel",children:n("colorTool.labels.color")}),e.jsx(l.ToolsHeader,{id:"intensityLabel",children:n("colorTool.labels.color_intensity")})]}),a&&a.map(t=>{const{label:f,isDisabled:b}=t;return y.createElement($.default,{filter:t,colorOptions:C,key:`filter-${f}`,isDisabled:u||b,onChangeFilterCallback:B,buttonLabelledById:"filterLabel",selectLabelledById:"colorLabel",sliderLabelledById:"intensityLabel"})})]}),e.jsx(T.default,{ref:h,filters:a,width:r,height:s,selectedObjectName:c,children:x&&e.jsx(l.SelectionContainer,{children:e.jsx(E.default,{id:"astroObjectSelector",placeholder:M,options:L,onChangeCallback:I,value:c,isDisabled:u,width:"100%",maxWidth:"100%"})})}),e.jsx(R.default,{actions:F,images:(j=h.current)==null?void 0:j.getElementsByTagName("canvas"),selectedData:d,width:r,height:s,isDisabled:u,selectionCallback:i})]})})};p.displayName="Widgets.ColorTool";exports.default=p;
|
package/dist/ColorTool.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"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("../utilities.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:i,onChangeFilterCallback:t,buttonLabelledById:u,selectLabelledById:h,sliderLabelledById:x})=>{const{t:b}=T.useTranslation(),{label:r,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:i,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:r})]}),s.jsx(I.default,{placeholder:v,value:c,options:a,onChangeCallback:p,width:"100%",maxWidth:"100%",labelledById:h}),s.jsx(l.Slider,{min:1,max:100,onChangeCallback:y,isDisabled:!n||i,labelledbyId:x,value:g,label:r,color:c})]})};d.displayName="Widgets.ColorTool.FilterControls";const B=d;exports.default=B;
|
|
1
|
+
"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("../utilities.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:i,onChangeFilterCallback:t,buttonLabelledById:u,selectLabelledById:h,sliderLabelledById:x})=>{const{t:b}=T.useTranslation(),{label:r,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:i,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:r})]}),s.jsx(I.default,{placeholder:v,value:c,options:a,onChangeCallback:p,width:"100%",maxWidth:"100%",labelledById:h,isDisabled:!n||i}),s.jsx(l.Slider,{min:1,max:100,onChangeCallback:y,isDisabled:!n||i,labelledbyId:x,value:g,label:r,color:c})]})};d.displayName="Widgets.ColorTool.FilterControls";const B=d;exports.default=B;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as d, jsx as
|
|
1
|
+
import { jsxs as d, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import B from "@rubin-epo/epo-react-lib/SelectListbox";
|
|
3
3
|
import { getBrightnessValue as C } from "../utilities.js";
|
|
4
4
|
import { useTranslation as I } from "react-i18next";
|
|
@@ -12,25 +12,25 @@ const a = ({
|
|
|
12
12
|
selectLabelledById: h,
|
|
13
13
|
sliderLabelledById: p
|
|
14
14
|
}) => {
|
|
15
|
-
const { t: b } = I(), { label: i, color: n = "", value: x, active:
|
|
15
|
+
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
16
|
...t,
|
|
17
17
|
brightness: C(g, u, o),
|
|
18
18
|
value: o
|
|
19
19
|
}), T = b("colorTool.actions.select_filter");
|
|
20
20
|
return /* @__PURE__ */ d(j, { disabled: r, children: [
|
|
21
21
|
/* @__PURE__ */ d(L, { children: [
|
|
22
|
-
/* @__PURE__ */
|
|
22
|
+
/* @__PURE__ */ l(
|
|
23
23
|
S,
|
|
24
24
|
{
|
|
25
|
-
checked:
|
|
25
|
+
checked: s,
|
|
26
26
|
type: "checkbox",
|
|
27
27
|
onChange: y,
|
|
28
28
|
"aria-describedby": m
|
|
29
29
|
}
|
|
30
30
|
),
|
|
31
|
-
/* @__PURE__ */
|
|
31
|
+
/* @__PURE__ */ l(W, { as: "span", children: i })
|
|
32
32
|
] }),
|
|
33
|
-
/* @__PURE__ */
|
|
33
|
+
/* @__PURE__ */ l(
|
|
34
34
|
B,
|
|
35
35
|
{
|
|
36
36
|
placeholder: T,
|
|
@@ -39,16 +39,17 @@ const a = ({
|
|
|
39
39
|
onChangeCallback: f,
|
|
40
40
|
width: "100%",
|
|
41
41
|
maxWidth: "100%",
|
|
42
|
-
labelledById: h
|
|
42
|
+
labelledById: h,
|
|
43
|
+
isDisabled: !s || r
|
|
43
44
|
}
|
|
44
45
|
),
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ l(
|
|
46
47
|
w,
|
|
47
48
|
{
|
|
48
49
|
min: 1,
|
|
49
50
|
max: 100,
|
|
50
51
|
onChangeCallback: v,
|
|
51
|
-
isDisabled: !
|
|
52
|
+
isDisabled: !s || r,
|
|
52
53
|
labelledbyId: p,
|
|
53
54
|
value: x,
|
|
54
55
|
label: i,
|
|
@@ -856,7 +856,7 @@ export declare const FilterToggle: import("styled-components").IStyledComponent<
|
|
|
856
856
|
default?: boolean | undefined;
|
|
857
857
|
wrap?: string | undefined;
|
|
858
858
|
open?: boolean | undefined;
|
|
859
|
-
icon?: "Account" | "ArrowUpFromBracket" | "Backward" | "BackwardStep" | "Calendar" | "Cancel" | "CaretDown" | "CheckeredFlag" | "Checkmark" | "CheckmarkCircle" | "CircularLoader" | "Chevron" | "ChevronLeftElongated" | "ChevronRightElongated" | "ChevronThin" | "Close" | "CloseCircle" | "Cloud" | "Doc" | "Email" | "Expand" | "Eye" | "Facebook" | "FloppyDisk" | "Forward" | "ForwardStep" | "Globe" | "Google" | "Hamburger" | "Info" | "Instagram" | "Lightbulb" | "LinkedIn" | "LockClosed" | "LockOpen" | "LogOut" | "Mail" | "Minus" | "Page" | "Pause" | "Phone" | "Pin" | "Play" | "Plus" | "QuestionCircle" | "RotateLeft" | "RotateLeftWithCenter" | "Search" | "ShareCopyUrl" | "ShareEmail" | "ShareFacebook" | "ShareToggle" | "ShareTwitter" | "Team" | "Temp" | "Thumbtack" | "Time" | "Timer" | "Twitter" | "User" | "UserInverted" | "Video" | "YouTube" | "Pdf" | "Word" | undefined;
|
|
859
|
+
icon?: "Account" | "ArrowUpFromBracket" | "Backward" | "BackwardStep" | "Calendar" | "Cancel" | "CaretDown" | "CheckeredFlag" | "Checkmark" | "CheckmarkCircle" | "CircularLoader" | "Chevron" | "ChevronLeftElongated" | "ChevronRightElongated" | "ChevronThin" | "Close" | "CloseCircle" | "Cloud" | "Doc" | "Email" | "Expand" | "Eye" | "Facebook" | "FloppyDisk" | "Forward" | "ForwardStep" | "Globe" | "Google" | "Hamburger" | "Info" | "InfoCircle" | "Instagram" | "Lightbulb" | "LinkedIn" | "LockClosed" | "LockOpen" | "LogOut" | "Mail" | "Minus" | "Page" | "Pause" | "Phone" | "Pin" | "Play" | "Plus" | "QuestionCircle" | "RotateLeft" | "RotateLeftWithCenter" | "Search" | "ShareCopyUrl" | "ShareEmail" | "ShareFacebook" | "ShareToggle" | "ShareTwitter" | "Team" | "Temp" | "Thumbtack" | "Time" | "Timer" | "Twitter" | "User" | "UserInverted" | "Video" | "YouTube" | "Pdf" | "Word" | undefined;
|
|
860
860
|
multiple?: boolean | undefined;
|
|
861
861
|
disabled?: boolean | undefined;
|
|
862
862
|
height?: string | number | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rubin-epo/epo-widget-lib",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "Rubin Observatory Education & Public Outreach team React scientific and educational widgets.",
|
|
5
5
|
"author": "Rubin EPO",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"react-i18next": "^12.2.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@rubin-epo/epo-react-lib": "^2.0.
|
|
41
|
+
"@rubin-epo/epo-react-lib": "^2.0.11",
|
|
42
42
|
"lodash": "^4.17.21",
|
|
43
43
|
"styled-components": "^6.1.1",
|
|
44
44
|
"use-resize-observer": "^9.1.0"
|