@rubin-epo/epo-widget-lib 0.2.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 (62) hide show
  1. package/README.MD +86 -0
  2. package/dist/assets/locales/index.d.ts +115 -0
  3. package/dist/atomic/Blinker/Blinker.d.ts +14 -0
  4. package/dist/atomic/Blinker/Controls/Controls.d.ts +11 -0
  5. package/dist/atomic/Blinker/Controls/styles.d.ts +1 -0
  6. package/dist/atomic/Blinker/Image/Image.d.ts +9 -0
  7. package/dist/atomic/Blinker/Image/styles.d.ts +3 -0
  8. package/dist/atomic/Blinker/Images/Images.d.ts +8 -0
  9. package/dist/atomic/Blinker/Images/styles.d.ts +4 -0
  10. package/dist/atomic/Blinker/index.d.ts +1 -0
  11. package/dist/atomic/Blinker/styles.d.ts +10 -0
  12. package/dist/atomic/ElapsedTime/ElapsedTime.d.ts +10 -0
  13. package/dist/atomic/ElapsedTime/index.d.ts +1 -0
  14. package/dist/atomic/ElapsedTime/styles.d.ts +6 -0
  15. package/dist/atomic/PlaybackControl/PlaybackControl.d.ts +9 -0
  16. package/dist/atomic/PlaybackControl/index.d.ts +1 -0
  17. package/dist/atomic/PlaybackControl/styles.d.ts +2 -0
  18. package/dist/epo-widget-lib.es.js +3434 -0
  19. package/dist/epo-widget-lib.umd.js +459 -0
  20. package/dist/hooks/useInterval.d.ts +1 -0
  21. package/dist/index.d.ts +6 -0
  22. package/dist/lib/utils.d.ts +13 -0
  23. package/dist/styles/svg.d.ts +1 -0
  24. package/dist/types/astro.d.ts +35 -0
  25. package/dist/vite-env.d.ts +1 -0
  26. package/dist/widgets/CameraFilter/CameraFilter.d.ts +3 -0
  27. package/dist/widgets/CameraFilter/CondensedFilterRanges/CondensedFilterRanges.d.ts +9 -0
  28. package/dist/widgets/CameraFilter/CondensedFilterRanges/index.d.ts +1 -0
  29. package/dist/widgets/CameraFilter/SpectrumDisplay/ColorLabels/ColorLabels.d.ts +10 -0
  30. package/dist/widgets/CameraFilter/SpectrumDisplay/ColorLabels/index.d.ts +1 -0
  31. package/dist/widgets/CameraFilter/SpectrumDisplay/SpectrumDisplay.d.ts +11 -0
  32. package/dist/widgets/CameraFilter/SpectrumDisplay/SpectrumLabels/SpectrumLabels.d.ts +14 -0
  33. package/dist/widgets/CameraFilter/SpectrumDisplay/SpectrumLabels/index.d.ts +1 -0
  34. package/dist/widgets/CameraFilter/SpectrumDisplay/index.d.ts +1 -0
  35. package/dist/widgets/CameraFilter/data.d.ts +39 -0
  36. package/dist/widgets/CameraFilter/index.d.ts +1 -0
  37. package/dist/widgets/CameraFilter/styles.d.ts +22 -0
  38. package/dist/widgets/ColorTool/ColorTool.d.ts +39 -0
  39. package/dist/widgets/ColorTool/FilterControls/FilterControls.d.ts +14 -0
  40. package/dist/widgets/ColorTool/FilterControls/index.d.ts +1 -0
  41. package/dist/widgets/ColorTool/FilterImage/FilterImage.d.ts +11 -0
  42. package/dist/widgets/ColorTool/FilterImage/index.d.ts +1 -0
  43. package/dist/widgets/ColorTool/ImageComposite/ImageComposite.d.ts +7 -0
  44. package/dist/widgets/ColorTool/ImageComposite/index.d.ts +1 -0
  45. package/dist/widgets/ColorTool/index.d.ts +1 -0
  46. package/dist/widgets/ColorTool/styles.d.ts +23 -0
  47. package/dist/widgets/ColorTool/utilities.d.ts +21 -0
  48. package/dist/widgets/FilterTool/FilterTool.d.ts +9 -0
  49. package/dist/widgets/FilterTool/index.d.ts +1 -0
  50. package/dist/widgets/FilterTool/styles.d.ts +15 -0
  51. package/dist/widgets/SourceSelector/Message/Message.d.ts +10 -0
  52. package/dist/widgets/SourceSelector/Message/index.d.ts +1 -0
  53. package/dist/widgets/SourceSelector/Point/Point.d.ts +15 -0
  54. package/dist/widgets/SourceSelector/Point/index.d.ts +1 -0
  55. package/dist/widgets/SourceSelector/Point/styles.d.ts +3 -0
  56. package/dist/widgets/SourceSelector/Points/Points.d.ts +13 -0
  57. package/dist/widgets/SourceSelector/Points/index.d.ts +1 -0
  58. package/dist/widgets/SourceSelector/SourceSelector.d.ts +22 -0
  59. package/dist/widgets/SourceSelector/index.d.ts +1 -0
  60. package/dist/widgets/SourceSelector/styles.d.ts +10 -0
  61. package/dist/widgets/SourceSelector/utilities.d.ts +1 -0
  62. package/package.json +45 -0
package/README.MD ADDED
@@ -0,0 +1,86 @@
1
+ # epo-widget-lib
2
+
3
+ React widgets for Rubin Observatory Education & Public Outreach projects
4
+
5
+ ## Use
6
+
7
+ ### Install
8
+
9
+ Install from npm.
10
+
11
+ `yarn add @rubin-epo/epo-widget-lib`
12
+
13
+ ### Dependencies
14
+
15
+ EPO React Library has 5 peer dependencies required to pull it in to your application.
16
+
17
+ `yarn add react react-dom styled-components i18next react-i18next`
18
+
19
+ ### Styles
20
+
21
+ After installing the package library, the global styles will need to be added to the top level of your application.
22
+
23
+ ```
24
+ import { GlobalStyles } from "@rubin-epo/epo-widget-lib";
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
+
33
+ ### Translations
34
+
35
+ Import `localeStrings` from `@rubin-epo/epo-widget-lib`, it contains individual locales that can be added to your project's i18next setup.
36
+
37
+ ## Build
38
+
39
+ ### Vite
40
+
41
+ This project uses Vite in library mode to package the contents of `/packages/epo-widget-lib/src` into modules located in `/packages/epo-widget-lib/dist/epo-widget-lib.[es|umd].js` and TypeScript typings in `/packages/epo-widget-lib/dist/index.d.ts`
42
+
43
+ To build from source:
44
+
45
+ ```
46
+ cd packages/epo-widget-lib
47
+ yarn
48
+ yarn build # production build
49
+ # yarn dev # development server
50
+ ```
51
+
52
+ ### Storybook
53
+
54
+ Storybook is used to create an interactive display of the components in the EPO React Library.
55
+
56
+ Stories from component folders following the `\*\*.stories.[t|j]sx will be included in the Storybook bundle.
57
+
58
+ To run Storybook:
59
+
60
+ ```
61
+ yarn build
62
+ yarn storybook
63
+ ```
64
+
65
+ ## Test
66
+
67
+ 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
+
69
+ ```
70
+ yarn test
71
+ # yarn test:generate-output # will save to .jest-test-results.json for Storybook
72
+ ```
73
+
74
+ 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
+
76
+ ```
77
+ export const Primary: ComponentStoryObj<typeof DemoButton> = {
78
+ args: {
79
+ disabled: false,
80
+ children: "Hello",
81
+ },
82
+ parameters: {
83
+ jest: "DemoButton.test.tsx",
84
+ },
85
+ };
86
+ ```
@@ -0,0 +1,115 @@
1
+ declare const _default: {
2
+ en: {
3
+ translation: {
4
+ blinker: {
5
+ controls: {
6
+ rewind: string;
7
+ forward: string;
8
+ play: string;
9
+ pause: string;
10
+ };
11
+ };
12
+ elapsed_time: {
13
+ title: string;
14
+ step: {
15
+ day_one: string;
16
+ day_other: string;
17
+ hour_one: string;
18
+ hour_other: string;
19
+ minute_one: string;
20
+ minute_other: string;
21
+ second_one: string;
22
+ second_other: string;
23
+ year_one: string;
24
+ year_other: string;
25
+ };
26
+ };
27
+ filterTool: {
28
+ title: string;
29
+ filter: string;
30
+ whiteLight: string;
31
+ prism: string;
32
+ selectLabel: string;
33
+ colors: {
34
+ violet: string;
35
+ blue: string;
36
+ green: string;
37
+ yellow: string;
38
+ orange: string;
39
+ red: string;
40
+ none: string;
41
+ };
42
+ };
43
+ colorTool: {
44
+ labels: {
45
+ object_type: string;
46
+ object: string;
47
+ object_selected: string;
48
+ filter: string;
49
+ color: string;
50
+ color_intensity: string;
51
+ };
52
+ actions: {
53
+ select_an_object: string;
54
+ select_filter: string;
55
+ reset: string;
56
+ };
57
+ };
58
+ source_selector: {
59
+ messages: {
60
+ success: string;
61
+ failure: string;
62
+ };
63
+ };
64
+ camera_filter: {
65
+ title: string;
66
+ labels: {
67
+ select: string;
68
+ option: string;
69
+ option_none: string;
70
+ captured_range: string;
71
+ captured_range_no_filter: string;
72
+ ultraviolet: string;
73
+ visible: string;
74
+ infrared: string;
75
+ };
76
+ };
77
+ };
78
+ };
79
+ es: {
80
+ translation: {
81
+ elapsed_time: {
82
+ title: string;
83
+ step: {
84
+ day_one: string;
85
+ day_other: string;
86
+ hour_one: string;
87
+ hour_other: string;
88
+ minute_one: string;
89
+ minute_other: string;
90
+ second_one: string;
91
+ second_other: string;
92
+ year_one: string;
93
+ year_other: string;
94
+ };
95
+ };
96
+ filterTool: {
97
+ title: string;
98
+ filter: string;
99
+ whiteLight: string;
100
+ prism: string;
101
+ selectLabel: string;
102
+ colors: {
103
+ violet: string;
104
+ blue: string;
105
+ green: string;
106
+ yellow: string;
107
+ orange: string;
108
+ red: string;
109
+ none: string;
110
+ };
111
+ };
112
+ };
113
+ };
114
+ };
115
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import { FunctionComponent } from "react";
2
+ import { Image } from "@rubin-epo/epo-react-lib/dist/types/image";
3
+ export interface BlinkerProps {
4
+ images: Image[];
5
+ activeIndex?: number;
6
+ autoplay?: boolean;
7
+ loop?: boolean;
8
+ interval?: number;
9
+ blinkCallback?: (activeIndex: number) => void;
10
+ loadedCallback?: () => void;
11
+ className?: string;
12
+ }
13
+ declare const Blinker: FunctionComponent<BlinkerProps>;
14
+ export default Blinker;
@@ -0,0 +1,11 @@
1
+ import { FunctionComponent, MouseEventHandler } from "react";
2
+ export interface ControlsProps {
3
+ playing: boolean;
4
+ handleStartStop: MouseEventHandler<HTMLButtonElement>;
5
+ handleNext: MouseEventHandler<HTMLButtonElement>;
6
+ handlePrevious: MouseEventHandler<HTMLButtonElement>;
7
+ className?: string;
8
+ isDisabled?: boolean;
9
+ }
10
+ declare const Controls: FunctionComponent<ControlsProps>;
11
+ export default Controls;
@@ -0,0 +1 @@
1
+ export declare const ControlsContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,9 @@
1
+ import { Image } from "@rubin-epo/epo-react-lib/dist/types/image";
2
+ import { FunctionComponent } from "react";
3
+ interface ImageProps {
4
+ image: Image;
5
+ active: boolean;
6
+ loadCallback: () => void;
7
+ }
8
+ declare const BlinkerImage: FunctionComponent<ImageProps>;
9
+ export default BlinkerImage;
@@ -0,0 +1,3 @@
1
+ export declare const BlinkerImage: import("styled-components").StyledComponent<"img", any, {
2
+ active: boolean;
3
+ }, never>;
@@ -0,0 +1,8 @@
1
+ import { FunctionComponent } from "react";
2
+ import { BlinkerProps } from "../Blinker";
3
+ export interface ImagesProps extends Pick<BlinkerProps, "images" | "activeIndex"> {
4
+ loadedCallback?: () => void;
5
+ className?: string;
6
+ }
7
+ declare const Images: FunctionComponent<ImagesProps>;
8
+ export default Images;
@@ -0,0 +1,4 @@
1
+ export declare const BlinkContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export declare const LoadingContainer: import("styled-components").StyledComponent<"div", any, {
3
+ isLoading: boolean;
4
+ }, never>;
@@ -0,0 +1 @@
1
+ export { default } from "./Blinker";
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ export declare const BlinkerContainer: import("styled-components").StyledComponent<"div", any, {
3
+ isCondensed: boolean;
4
+ }, never>;
5
+ export declare const BlinkerControls: import("styled-components").StyledComponent<import("react").FunctionComponent<import("./Controls/Controls").ControlsProps>, any, {
6
+ isCondensed: boolean;
7
+ }, never>;
8
+ export declare const BlinkerImages: import("styled-components").StyledComponent<import("react").FunctionComponent<import("./Images/Images").ImagesProps>, any, {
9
+ isCondensed: boolean;
10
+ }, never>;
@@ -0,0 +1,10 @@
1
+ import { FunctionComponent } from "react";
2
+ type TimeInterval = "year" | "day" | "hour" | "minute" | "second";
3
+ type TimeSteps = {
4
+ [key in TimeInterval]?: number;
5
+ };
6
+ export interface TimeStepProps extends TimeSteps {
7
+ className?: string;
8
+ }
9
+ declare const ElapsedTime: FunctionComponent<TimeStepProps>;
10
+ export default ElapsedTime;
@@ -0,0 +1 @@
1
+ export { default } from "./ElapsedTime";
@@ -0,0 +1,6 @@
1
+ export declare const ElapsedTimeContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export declare const Header: import("styled-components").StyledComponent<"h2", any, {}, never>;
3
+ export declare const Time: import("styled-components").StyledComponent<"time", any, {}, never>;
4
+ export declare const Interval: import("styled-components").StyledComponent<"div", any, {}, never>;
5
+ export declare const Number: import("styled-components").StyledComponent<"span", any, {}, never>;
6
+ export declare const Step: import("styled-components").StyledComponent<"span", any, {}, never>;
@@ -0,0 +1,9 @@
1
+ import { FunctionComponent, HTMLProps, MouseEventHandler } from "react";
2
+ import { IconKey } from "@rubin-epo/epo-react-lib/dist/svg/icons";
3
+ interface PlaybackControlProps extends HTMLProps<HTMLButtonElement> {
4
+ icon: IconKey;
5
+ label: string;
6
+ handleClick: MouseEventHandler<HTMLButtonElement>;
7
+ }
8
+ declare const PlaybackControl: FunctionComponent<PlaybackControlProps>;
9
+ export default PlaybackControl;
@@ -0,0 +1 @@
1
+ export { default } from "./PlaybackControl";
@@ -0,0 +1,2 @@
1
+ export declare const IconContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export declare const PlaybackButton: import("styled-components").StyledComponent<"button", any, {}, never>;