@abidibo/react-cam-roi 0.2.2 → 0.2.3
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/Components/BoolField/BoolField.module.css +60 -0
- package/dist/Components/BoolField/index.d.ts +5 -0
- package/dist/Components/BoolField/index.js +13 -0
- package/dist/Components/Button/Button.module.css +29 -0
- package/dist/Components/Button/index.d.ts +8 -0
- package/dist/Components/Button/index.js +15 -0
- package/dist/Components/EnumField/EnumField.module.css +61 -0
- package/dist/Components/EnumField/index.d.ts +10 -0
- package/dist/Components/EnumField/index.js +16 -0
- package/dist/Components/IconButton/IconButton.module.css +20 -0
- package/dist/Components/IconButton/index.d.ts +7 -0
- package/dist/Components/IconButton/index.js +10 -0
- package/dist/Components/Loader/Loader.module.css +25 -0
- package/dist/Components/Loader/index.d.ts +1 -0
- package/dist/Components/Loader/index.js +9 -0
- package/dist/Components/Modal/Modal.module.css +92 -0
- package/dist/Components/Modal/index.d.ts +10 -0
- package/dist/Components/Modal/index.js +16 -0
- package/dist/Components/NumberField/NumberField.module.css +60 -0
- package/dist/Components/NumberField/index.d.ts +3 -0
- package/dist/Components/NumberField/index.js +13 -0
- package/dist/Components/RoiEditor/Canvas.d.ts +14 -0
- package/dist/Components/RoiEditor/Canvas.js +30 -0
- package/dist/Components/RoiEditor/ColorPicker.d.ts +5 -0
- package/dist/Components/RoiEditor/ColorPicker.js +12 -0
- package/dist/Components/RoiEditor/ColorPicker.module.css +17 -0
- package/dist/Components/RoiEditor/Header.d.ts +2 -0
- package/dist/Components/RoiEditor/Header.js +14 -0
- package/dist/Components/RoiEditor/Header.module.css +26 -0
- package/dist/Components/RoiEditor/Hooks.d.ts +38 -0
- package/dist/Components/RoiEditor/Hooks.js +328 -0
- package/dist/Components/RoiEditor/ParameterField.d.ts +9 -0
- package/dist/Components/RoiEditor/ParameterField.js +27 -0
- package/dist/Components/RoiEditor/ParametersModalForm/ParametersModalForm.module.css +5 -0
- package/dist/Components/RoiEditor/ParametersModalForm/index.d.ts +17 -0
- package/dist/Components/RoiEditor/ParametersModalForm/index.js +42 -0
- package/dist/Components/RoiEditor/Polygon.d.ts +18 -0
- package/dist/Components/RoiEditor/Polygon.js +77 -0
- package/dist/Components/RoiEditor/Polyline.d.ts +28 -0
- package/dist/Components/RoiEditor/Polyline.js +75 -0
- package/dist/Components/RoiEditor/Rectangle.d.ts +21 -0
- package/dist/Components/RoiEditor/Rectangle.js +73 -0
- package/dist/Components/RoiEditor/RoiEditor.module.css +5 -0
- package/dist/Components/RoiEditor/RoisInfo.d.ts +2 -0
- package/dist/Components/RoiEditor/RoisInfo.js +43 -0
- package/dist/Components/RoiEditor/ShapesList.d.ts +2 -0
- package/dist/Components/RoiEditor/ShapesList.js +77 -0
- package/dist/Components/RoiEditor/ShapesList.module.css +71 -0
- package/dist/Components/RoiEditor/Toolbar.d.ts +2 -0
- package/dist/Components/RoiEditor/Toolbar.js +27 -0
- package/dist/Components/RoiEditor/Toolbar.module.css +41 -0
- package/dist/Components/RoiEditor/TopBar.d.ts +2 -0
- package/dist/Components/RoiEditor/TopBar.js +21 -0
- package/dist/Components/RoiEditor/TopBar.module.css +7 -0
- package/dist/Components/RoiEditor/Types.d.ts +128 -0
- package/dist/Components/RoiEditor/Types.js +23 -0
- package/dist/Components/RoiEditor/Utils.d.ts +25 -0
- package/dist/Components/RoiEditor/Utils.js +161 -0
- package/dist/Components/RoiEditor/index.d.ts +12 -0
- package/dist/Components/RoiEditor/index.js +99 -0
- package/dist/Components/RoleField.d.ts +7 -0
- package/dist/Components/RoleField.js +49 -0
- package/dist/Components/TextField/TextField.module.css +61 -0
- package/dist/Components/TextField/index.d.ts +6 -0
- package/dist/Components/TextField/index.js +13 -0
- package/dist/Components/Typography/index.d.ts +9 -0
- package/dist/Components/Typography/index.js +6 -0
- package/dist/Icons/AnnotateIcon.d.ts +6 -0
- package/dist/Icons/AnnotateIcon.js +5 -0
- package/dist/Icons/CloseIcon.d.ts +6 -0
- package/dist/Icons/CloseIcon.js +5 -0
- package/dist/Icons/CopyIcon.d.ts +6 -0
- package/dist/Icons/CopyIcon.js +5 -0
- package/dist/Icons/DeleteIcon.d.ts +6 -0
- package/dist/Icons/DeleteIcon.js +5 -0
- package/dist/Icons/EditIcon.d.ts +6 -0
- package/dist/Icons/EditIcon.js +5 -0
- package/dist/Icons/PointerIcon.d.ts +6 -0
- package/dist/Icons/PointerIcon.js +5 -0
- package/dist/Icons/PolygonIcon.d.ts +6 -0
- package/dist/Icons/PolygonIcon.js +5 -0
- package/dist/Icons/PolylineIcon.d.ts +6 -0
- package/dist/Icons/PolylineIcon.js +5 -0
- package/dist/Icons/RectangleIcon.d.ts +6 -0
- package/dist/Icons/RectangleIcon.js +5 -0
- package/dist/Icons/SaveIcon.d.ts +6 -0
- package/dist/Icons/SaveIcon.js +5 -0
- package/dist/Providers/EditorProvider.d.ts +26 -0
- package/dist/Providers/EditorProvider.js +29 -0
- package/dist/Providers/UiProvider.d.ts +82 -0
- package/dist/Providers/UiProvider.js +104 -0
- package/dist/Types.d.ts +10 -0
- package/dist/Types.js +1 -0
- package/dist/Utils/Dispatcher.d.ts +16 -0
- package/dist/Utils/Dispatcher.js +65 -0
- package/dist/Utils/index.d.ts +6 -0
- package/dist/Utils/index.js +16 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/package.json +1 -1
@@ -0,0 +1,60 @@
|
|
1
|
+
/*
|
2
|
+
.bool-field-wrapper {
|
3
|
+
margin-bottom: 2rem;
|
4
|
+
}
|
5
|
+
.bool-field-wrapper-light {
|
6
|
+
}
|
7
|
+
.bool-field-wrapper-dark {
|
8
|
+
}
|
9
|
+
*/
|
10
|
+
|
11
|
+
.bool-field {
|
12
|
+
border-radius: 0.25rem;
|
13
|
+
box-sizing: border-box;
|
14
|
+
padding: 0.5rem;
|
15
|
+
}
|
16
|
+
.bool-field:focus-visible {
|
17
|
+
outline: none;
|
18
|
+
border: 1px solid #1976d2;
|
19
|
+
}
|
20
|
+
.bool-field-light {
|
21
|
+
background-color: #fff;
|
22
|
+
color: #333;
|
23
|
+
border: 1px solid #ccc;
|
24
|
+
}
|
25
|
+
.bool-field-dark {
|
26
|
+
background-color: #333;
|
27
|
+
border: 1px solid #666;
|
28
|
+
color: #fff;
|
29
|
+
}
|
30
|
+
.bool-field-error {
|
31
|
+
border: 1px solid #d32f2f;
|
32
|
+
}
|
33
|
+
.bool-field-label {
|
34
|
+
font-weight: bold;
|
35
|
+
display: block;
|
36
|
+
margin: 0 0 1rem 0;
|
37
|
+
}
|
38
|
+
/*
|
39
|
+
.text-fiel-label-light {
|
40
|
+
}
|
41
|
+
.bool-field-label-dark {
|
42
|
+
}
|
43
|
+
*/
|
44
|
+
.bool-field-label-error {
|
45
|
+
color: #d32f2f;
|
46
|
+
}
|
47
|
+
.bool-field-helper-text {
|
48
|
+
font-style: italic;
|
49
|
+
font-size: 0.9rem;
|
50
|
+
margin-top: 0.5rem;
|
51
|
+
}
|
52
|
+
/*
|
53
|
+
.bool-field-helper-text-light {
|
54
|
+
}
|
55
|
+
.bool-field-helper-text-dark {
|
56
|
+
}
|
57
|
+
*/
|
58
|
+
.bool-field-helper-text-error {
|
59
|
+
color: #d32f2f;
|
60
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { useContext } from "react";
|
3
|
+
import { UiContext } from "../../Providers/UiProvider";
|
4
|
+
import { css } from "../../Utils";
|
5
|
+
import styles from './BoolField.module.css';
|
6
|
+
const BoolField = ({ onChange, value, label, helperText, error, readOnly = false, disabled = false, required = false, }) => {
|
7
|
+
const { themeMode, Typography } = useContext(UiContext);
|
8
|
+
const handleChange = (e) => {
|
9
|
+
onChange(e.target.checked);
|
10
|
+
};
|
11
|
+
return (_jsxs("div", { className: css('bool-field-wrapper', styles, themeMode), children: [_jsx("label", { className: `${css('bool-field-label', styles, themeMode)} ${error ? css('bool-field-label-error', styles, null) : ''}`, children: _jsxs(Typography, { children: [label, required && ' *'] }) }), _jsx("input", { type: 'checkbox', className: `${css('bool-field', styles, themeMode)} ${error ? css('bool-field-error', styles, null) : ''}`, onChange: handleChange, checked: value, readOnly: readOnly, disabled: disabled }), helperText && (_jsx(Typography, { component: 'div', className: `${css('bool-field-helper-text', styles, themeMode)} ${error ? css('bool-field-helper-text-error', styles, null) : ''}`, children: helperText }))] }));
|
12
|
+
};
|
13
|
+
export default BoolField;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
.button {
|
2
|
+
align-items: center;
|
3
|
+
border: none;
|
4
|
+
border-radius: 4px;
|
5
|
+
color: black;
|
6
|
+
padding: .5rem 1rem;
|
7
|
+
text-align: center;
|
8
|
+
text-decoration: none;
|
9
|
+
display: flex;
|
10
|
+
font-size: 16px;
|
11
|
+
gap: .5rem;
|
12
|
+
margin: 4px 2px;
|
13
|
+
cursor: pointer;
|
14
|
+
}
|
15
|
+
|
16
|
+
.button-light {
|
17
|
+
background-color: #c7c7c7;
|
18
|
+
color: black;
|
19
|
+
}
|
20
|
+
|
21
|
+
.button-dark {
|
22
|
+
background-color: #383838;
|
23
|
+
color: white;
|
24
|
+
}
|
25
|
+
|
26
|
+
.button-disabled {
|
27
|
+
cursor: not-allowed;
|
28
|
+
opacity: 0.5;
|
29
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
2
|
+
export type ButtonProps = {
|
3
|
+
onClick: (event: React.MouseEvent) => void;
|
4
|
+
primary?: boolean;
|
5
|
+
disabled?: boolean;
|
6
|
+
};
|
7
|
+
declare const Button: ({ onClick, primary, disabled, children }: PropsWithChildren<ButtonProps>) => import("react/jsx-runtime").JSX.Element;
|
8
|
+
export default Button;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { useContext } from 'react';
|
3
|
+
import { UiContext } from '../../Providers/UiProvider';
|
4
|
+
import { css } from '../../Utils';
|
5
|
+
import styles from './Button.module.css';
|
6
|
+
const Button = ({ onClick, primary, disabled, children }) => {
|
7
|
+
const { themeMode, primaryColor } = useContext(UiContext);
|
8
|
+
const style = {};
|
9
|
+
if (primary) {
|
10
|
+
style.backgroundColor = primaryColor;
|
11
|
+
style.color = 'white';
|
12
|
+
}
|
13
|
+
return (_jsx("button", { className: `${css('button', styles, themeMode)}${disabled ? ` ${css('button-disabled', styles, themeMode)}` : ''}`, style: style, onClick: onClick, disabled: disabled, children: children }));
|
14
|
+
};
|
15
|
+
export default Button;
|
@@ -0,0 +1,61 @@
|
|
1
|
+
/*
|
2
|
+
.enum-field-wrapper {
|
3
|
+
margin-bottom: 2rem;
|
4
|
+
}
|
5
|
+
.enum-field-wrapper-light {
|
6
|
+
}
|
7
|
+
.enum-field-wrapper-dark {
|
8
|
+
}
|
9
|
+
*/
|
10
|
+
|
11
|
+
.enum-field {
|
12
|
+
border-radius: 0.25rem;
|
13
|
+
box-sizing: border-box;
|
14
|
+
padding: 0.5rem;
|
15
|
+
width: 100%;
|
16
|
+
}
|
17
|
+
.enum-field:focus-visible {
|
18
|
+
outline: none;
|
19
|
+
border: 1px solid #1976d2;
|
20
|
+
}
|
21
|
+
.enum-field-light {
|
22
|
+
background-color: #fff;
|
23
|
+
color: #333;
|
24
|
+
border: 1px solid #ccc;
|
25
|
+
}
|
26
|
+
.enum-field-dark {
|
27
|
+
background-color: #333;
|
28
|
+
border: 1px solid #666;
|
29
|
+
color: #fff;
|
30
|
+
}
|
31
|
+
.enum-field-error {
|
32
|
+
border: 1px solid #d32f2f;
|
33
|
+
}
|
34
|
+
.enum-field-label {
|
35
|
+
font-weight: bold;
|
36
|
+
display: block;
|
37
|
+
margin: 0 0 1rem 0;
|
38
|
+
}
|
39
|
+
/*
|
40
|
+
.text-fiel-label-light {
|
41
|
+
}
|
42
|
+
.enum-field-label-dark {
|
43
|
+
}
|
44
|
+
*/
|
45
|
+
.enum-field-label-error {
|
46
|
+
color: #d32f2f;
|
47
|
+
}
|
48
|
+
.enum-field-helper-text {
|
49
|
+
font-style: italic;
|
50
|
+
font-size: 0.9rem;
|
51
|
+
margin-top: 0.5rem;
|
52
|
+
}
|
53
|
+
/*
|
54
|
+
.enum-field-helper-text-light {
|
55
|
+
}
|
56
|
+
.enum-field-helper-text-dark {
|
57
|
+
}
|
58
|
+
*/
|
59
|
+
.enum-field-helper-text-error {
|
60
|
+
color: #d32f2f;
|
61
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { FieldProps } from '../../Types';
|
2
|
+
export type EnumOption<T> = {
|
3
|
+
value: T;
|
4
|
+
label: string;
|
5
|
+
};
|
6
|
+
declare const EnumField: <T extends string | number>({ onChange, value, label, helperText, error, options, disabled, required, multiple }: Omit<FieldProps<T | T[]>, "readOnly"> & {
|
7
|
+
options: EnumOption<T>[];
|
8
|
+
multiple?: boolean;
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
10
|
+
export default EnumField;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { useContext } from 'react';
|
3
|
+
import { UiContext } from '../../Providers/UiProvider';
|
4
|
+
import { css } from '../../Utils';
|
5
|
+
import styles from './EnumField.module.css';
|
6
|
+
const EnumField = ({ onChange, value, label, helperText, error, options, disabled = false, required = false, multiple = false }) => {
|
7
|
+
const { themeMode, Typography } = useContext(UiContext);
|
8
|
+
const handleChange = (e) => {
|
9
|
+
const selectedValues = Array.from(e.target.selectedOptions, (option) => {
|
10
|
+
return isNaN(Number(option.value)) ? option.value : Number(option.value);
|
11
|
+
});
|
12
|
+
onChange(multiple ? selectedValues : selectedValues[0]);
|
13
|
+
};
|
14
|
+
return (_jsxs("div", { className: css('enum-field-wrapper', styles, themeMode), children: [_jsx("label", { className: `${css('enum-field-label', styles, themeMode)} ${error ? css('enum-field-label-error', styles, null) : ''}`, children: _jsxs(Typography, { children: [label, required && ' *'] }) }), _jsxs("select", { className: `${css('enum-field', styles, themeMode)} ${error ? css('enum-field-error', styles, null) : ''}`, onChange: handleChange, value: value, disabled: disabled, multiple: multiple, children: [!required && _jsx("option", { value: '' }), options.map((option) => (_jsx("option", { value: option.value, children: option.label }, option.value)))] }), helperText && (_jsx(Typography, { component: 'div', className: `${css('enum-field-helper-text', styles, themeMode)} ${error ? css('enum-field-helper-text-error', styles, null) : ''}`, children: helperText }))] }));
|
15
|
+
};
|
16
|
+
export default EnumField;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
.icon-button {
|
2
|
+
display: inline-block;
|
3
|
+
border-radius: 50%;
|
4
|
+
line-height: 0;
|
5
|
+
padding: 0.5rem;
|
6
|
+
cursor: pointer;
|
7
|
+
}
|
8
|
+
|
9
|
+
.icon-button-light:hover {
|
10
|
+
background-color: rgba(0, 0, 0, 0.1);
|
11
|
+
}
|
12
|
+
|
13
|
+
.icon-button-dark:hover {
|
14
|
+
background-color: rgba(255, 255, 255, 0.1);
|
15
|
+
}
|
16
|
+
|
17
|
+
.icon-button-disabled {
|
18
|
+
cursor: not-allowed;
|
19
|
+
opacity: 0.5;
|
20
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { useContext } from 'react';
|
3
|
+
import { UiContext } from '../../Providers/UiProvider';
|
4
|
+
import { css } from '../../Utils';
|
5
|
+
import styles from './IconButton.module.css';
|
6
|
+
const IconButton = ({ children, disabled, onClick }) => {
|
7
|
+
const { themeMode } = useContext(UiContext);
|
8
|
+
return (_jsx("div", { className: `${css('icon-button', styles, themeMode)} ${disabled ? css('icon-button-disabled', styles, themeMode) : ''}`, onClick: disabled ? undefined : onClick, children: children }));
|
9
|
+
};
|
10
|
+
export default IconButton;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
.loader {
|
2
|
+
border-radius: 50%;
|
3
|
+
width: 40px;
|
4
|
+
height: 40px;
|
5
|
+
animation: spin 1s linear infinite;
|
6
|
+
}
|
7
|
+
|
8
|
+
.loader-light {
|
9
|
+
border: 10px solid #f3f3f3;
|
10
|
+
border-top: 10px solid #3498db;
|
11
|
+
}
|
12
|
+
|
13
|
+
.loader-dark {
|
14
|
+
border: 10px solid #333;
|
15
|
+
border-top: 10px solid #3498db;
|
16
|
+
}
|
17
|
+
|
18
|
+
@keyframes spin {
|
19
|
+
0% {
|
20
|
+
transform: rotate(0deg);
|
21
|
+
}
|
22
|
+
100% {
|
23
|
+
transform: rotate(360deg);
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const Loader: React.FC;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { useContext } from 'react';
|
3
|
+
import { UiContext } from '../../Providers/UiProvider';
|
4
|
+
import styles from './Loader.module.css';
|
5
|
+
import { css } from '../../Utils';
|
6
|
+
export const Loader = () => {
|
7
|
+
const { themeMode } = useContext(UiContext);
|
8
|
+
return _jsx("div", { className: css('loader', styles, themeMode) });
|
9
|
+
};
|
@@ -0,0 +1,92 @@
|
|
1
|
+
.modal-overlay {
|
2
|
+
position: fixed;
|
3
|
+
top: 0;
|
4
|
+
left: 0;
|
5
|
+
width: 100%;
|
6
|
+
height: 100%;
|
7
|
+
display: flex;
|
8
|
+
justify-content: center;
|
9
|
+
align-items: center;
|
10
|
+
z-index: 9000;
|
11
|
+
}
|
12
|
+
|
13
|
+
.modal-overlay-light {
|
14
|
+
background-color: rgba(255, 255, 255, 0.7);
|
15
|
+
}
|
16
|
+
|
17
|
+
.modal-overlay-dark {
|
18
|
+
background-color: rgba(0, 0, 0, 0.7);
|
19
|
+
}
|
20
|
+
|
21
|
+
.modal {
|
22
|
+
max-width: 80%;
|
23
|
+
max-height: 80%;
|
24
|
+
overflow: auto;
|
25
|
+
padding: 20px;
|
26
|
+
border-radius: 5px;
|
27
|
+
}
|
28
|
+
|
29
|
+
.modal:focus-visible {
|
30
|
+
outline: none;
|
31
|
+
}
|
32
|
+
|
33
|
+
.modal-light {
|
34
|
+
background-color: #fff;
|
35
|
+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
|
36
|
+
color: #000;
|
37
|
+
}
|
38
|
+
|
39
|
+
.modal-dark {
|
40
|
+
background-color: #333;
|
41
|
+
box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
|
42
|
+
color: #fff;
|
43
|
+
}
|
44
|
+
|
45
|
+
.modal-xs {
|
46
|
+
width: 400px;
|
47
|
+
}
|
48
|
+
|
49
|
+
.modal-sm {
|
50
|
+
width: 600px;
|
51
|
+
}
|
52
|
+
|
53
|
+
.modal-md {
|
54
|
+
width: 800px;
|
55
|
+
}
|
56
|
+
|
57
|
+
.modal-lg {
|
58
|
+
width: 1000px;
|
59
|
+
}
|
60
|
+
|
61
|
+
.modal-xl {
|
62
|
+
width: 1200px;
|
63
|
+
}
|
64
|
+
|
65
|
+
.modal-header {
|
66
|
+
display: flex;
|
67
|
+
justify-content: space-between;
|
68
|
+
align-items: center;
|
69
|
+
margin-bottom: 1rem;
|
70
|
+
}
|
71
|
+
|
72
|
+
.modal-title {
|
73
|
+
font-size: 1.5rem;
|
74
|
+
font-weight: bold;
|
75
|
+
margin: 0;
|
76
|
+
}
|
77
|
+
|
78
|
+
.modal-title-light {
|
79
|
+
color: #000;
|
80
|
+
}
|
81
|
+
|
82
|
+
.modal-title-dark {
|
83
|
+
color: #fff;
|
84
|
+
}
|
85
|
+
|
86
|
+
.modal-footer {
|
87
|
+
display: flex;
|
88
|
+
justify-content: flex-end;
|
89
|
+
margin-top: 1rem;
|
90
|
+
gap: .5rem;
|
91
|
+
}
|
92
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
2
|
+
export type ModalProps = {
|
3
|
+
isOpen: boolean;
|
4
|
+
onClose: () => void;
|
5
|
+
title: string;
|
6
|
+
maxWidth: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
7
|
+
onSubmit?: () => void;
|
8
|
+
};
|
9
|
+
declare const Modal: React.FC<PropsWithChildren<ModalProps>>;
|
10
|
+
export default Modal;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { createPortal } from 'react-dom';
|
3
|
+
import { useContext } from 'react';
|
4
|
+
import CloseIcon from '../../Icons/CloseIcon';
|
5
|
+
import { UiContext } from '../../Providers/UiProvider';
|
6
|
+
import { css } from '../../Utils';
|
7
|
+
import styles from './Modal.module.css';
|
8
|
+
const Modal = ({ isOpen, onClose, children, title, maxWidth, onSubmit }) => {
|
9
|
+
const { themeMode, IconButton, Typography, Button, strings } = useContext(UiContext);
|
10
|
+
const iconColor = themeMode === 'light' ? 'black' : 'white';
|
11
|
+
if (!isOpen) {
|
12
|
+
return null;
|
13
|
+
}
|
14
|
+
return createPortal(_jsx("div", { className: css('modal-overlay', styles, themeMode), children: _jsxs("div", { className: `${css('modal', styles, themeMode)} ${css(`modal-${maxWidth}`, styles, themeMode)}`, children: [_jsxs("div", { className: css('modal-header', styles, themeMode), children: [_jsx(Typography, { component: 'h6', className: css('modal-title', styles, themeMode), children: title }), _jsx(IconButton, { onClick: onClose, children: _jsx(CloseIcon, { color: iconColor }) })] }), children, _jsxs("div", { className: css('modal-footer', styles, themeMode), children: [_jsx(Button, { onClick: onClose, children: strings.cancel }), onSubmit && _jsx(Button, { primary: true, onClick: onSubmit, children: strings.save })] })] }) }), document.body);
|
15
|
+
};
|
16
|
+
export default Modal;
|
@@ -0,0 +1,60 @@
|
|
1
|
+
/*
|
2
|
+
.number-field-wrapper {
|
3
|
+
}
|
4
|
+
.number-field-wrapper-light {
|
5
|
+
}
|
6
|
+
.number-field-wrapper-dark {
|
7
|
+
}
|
8
|
+
*/
|
9
|
+
|
10
|
+
.number-field {
|
11
|
+
border-radius: 0.25rem;
|
12
|
+
box-sizing: border-box;
|
13
|
+
padding: 0.5rem;
|
14
|
+
width: 100%;
|
15
|
+
}
|
16
|
+
.number-field:focus-visible {
|
17
|
+
outline: none;
|
18
|
+
border: 1px solid #1976d2;
|
19
|
+
}
|
20
|
+
.number-field-light {
|
21
|
+
background-color: #fff;
|
22
|
+
color: #333;
|
23
|
+
border: 1px solid #ccc;
|
24
|
+
}
|
25
|
+
.number-field-dark {
|
26
|
+
background-color: #333;
|
27
|
+
border: 1px solid #666;
|
28
|
+
color: #fff;
|
29
|
+
}
|
30
|
+
.number-field-error {
|
31
|
+
border: 1px solid #d32f2f;
|
32
|
+
}
|
33
|
+
.number-field-label {
|
34
|
+
font-weight: bold;
|
35
|
+
display: block;
|
36
|
+
margin: 0 0 1rem 0;
|
37
|
+
}
|
38
|
+
/*
|
39
|
+
.text-fiel-label-light {
|
40
|
+
}
|
41
|
+
.number-field-label-dark {
|
42
|
+
}
|
43
|
+
*/
|
44
|
+
.number-field-label-error {
|
45
|
+
color: #d32f2f;
|
46
|
+
}
|
47
|
+
.number-field-helper-text {
|
48
|
+
font-style: italic;
|
49
|
+
font-size: 0.9rem;
|
50
|
+
padding-top: 0.5rem;
|
51
|
+
}
|
52
|
+
/*
|
53
|
+
.number-field-helper-text-light {
|
54
|
+
}
|
55
|
+
.number-field-helper-text-dark {
|
56
|
+
}
|
57
|
+
*/
|
58
|
+
.number-field-helper-text-error {
|
59
|
+
color: #d32f2f;
|
60
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { useContext } from 'react';
|
3
|
+
import { UiContext } from '../../Providers/UiProvider';
|
4
|
+
import { css } from '../../Utils';
|
5
|
+
import styles from './NumberField.module.css';
|
6
|
+
const NumberField = ({ onChange, value, label, required, helperText, error }) => {
|
7
|
+
const { themeMode, Typography } = useContext(UiContext);
|
8
|
+
const handleChange = (e) => {
|
9
|
+
onChange(parseFloat(e.target.value));
|
10
|
+
};
|
11
|
+
return (_jsxs("div", { className: css('number-field-wrapper', styles, themeMode), children: [_jsx("label", { className: `${css('number-field-label', styles, themeMode)} ${error ? css('number-field-label-error', styles, null) : ''}`, children: _jsxs(Typography, { children: [label, required && ' *'] }) }), _jsx("input", { type: 'number', className: `${css('number-field', styles, themeMode)} ${error ? css('number-field-error', styles, null) : ''}`, onChange: handleChange, value: value !== null && value !== void 0 ? value : '' }), helperText && (_jsx(Typography, { component: 'div', className: `${css('number-field-helper-text', styles, themeMode)} ${error ? css('number-field-helper-text-error', styles, null) : ''}`, children: helperText }))] }));
|
12
|
+
};
|
13
|
+
export default NumberField;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { Output } from './Types';
|
2
|
+
type CanvasProps = {
|
3
|
+
canvasSize: {
|
4
|
+
width: number;
|
5
|
+
height: number;
|
6
|
+
};
|
7
|
+
imageSize: {
|
8
|
+
width: number;
|
9
|
+
height: number;
|
10
|
+
};
|
11
|
+
initialData?: Output;
|
12
|
+
};
|
13
|
+
declare const Canvas: React.FC<CanvasProps>;
|
14
|
+
export default Canvas;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import * as fabric from 'fabric';
|
3
|
+
import { useRef, useEffect, useState, useContext } from 'react';
|
4
|
+
import { useEditorContext } from '../../Providers/EditorProvider';
|
5
|
+
import { UiContext } from '../../Providers/UiProvider';
|
6
|
+
import { initCanvasData, useDispatcherEvents, useTool } from './Hooks';
|
7
|
+
const Canvas = ({ canvasSize, imageSize, initialData }) => {
|
8
|
+
const { metadata, setMetadata, addShapes, editorId } = useEditorContext();
|
9
|
+
const { enableLogs } = useContext(UiContext);
|
10
|
+
const [initialized, setInitialized] = useState(false);
|
11
|
+
console.log('before canvas ref');
|
12
|
+
const canvasRef = useRef(null);
|
13
|
+
console.log('after canvas ref');
|
14
|
+
useTool(canvasRef.current);
|
15
|
+
useDispatcherEvents(canvasRef.current);
|
16
|
+
useEffect(() => {
|
17
|
+
if (canvasSize.width !== 0 && canvasSize.height !== 0 && !initialized) {
|
18
|
+
canvasRef.current = new fabric.Canvas(`react-cam-roi-canvas-${editorId}`);
|
19
|
+
canvasRef.current.setDimensions({ width: canvasSize.width, height: canvasSize.height });
|
20
|
+
initCanvasData(canvasRef, imageSize, addShapes, metadata, setMetadata, initialData, enableLogs);
|
21
|
+
setInitialized(true);
|
22
|
+
}
|
23
|
+
return () => {
|
24
|
+
var _a;
|
25
|
+
(_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.dispose();
|
26
|
+
};
|
27
|
+
}, [canvasSize.width, canvasSize.height]); // eslint-disable-line
|
28
|
+
return (_jsx("canvas", { id: `react-cam-roi-canvas-${editorId}`, style: { width: `${canvasSize.width}px`, height: `${canvasSize.height}px` } }));
|
29
|
+
};
|
30
|
+
export default Canvas;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { useContext } from 'react';
|
3
|
+
import { useEditorContext } from '../../Providers/EditorProvider';
|
4
|
+
import { UiContext } from '../../Providers/UiProvider';
|
5
|
+
import { css } from '../../Utils';
|
6
|
+
import styles from './ColorPicker.module.css';
|
7
|
+
const ColorPicker = ({ style }) => {
|
8
|
+
const { pickerColors, themeMode } = useContext(UiContext);
|
9
|
+
const { activeColor, setActiveColor } = useEditorContext();
|
10
|
+
return (_jsx("div", { style: style, className: styles.colorpickerWrapper, children: pickerColors.map((color) => (_jsx("div", { onClick: () => setActiveColor(color), className: `${css('colorpicker-button', styles, themeMode)} ${activeColor === color ? css('colorpicker-button-active', styles, themeMode) : ''}`, style: { backgroundColor: color } }, color))) }));
|
11
|
+
};
|
12
|
+
export default ColorPicker;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
.colorpickerWrapper {
|
2
|
+
display: flex;
|
3
|
+
flex-wrap: nowrap;
|
4
|
+
gap: .2rem;
|
5
|
+
}
|
6
|
+
|
7
|
+
.colorpicker-button {
|
8
|
+
box-sizing: border-box;
|
9
|
+
width: 24px;
|
10
|
+
height: 24px;
|
11
|
+
border-radius: 50%;
|
12
|
+
cursor: pointer;
|
13
|
+
}
|
14
|
+
|
15
|
+
.colorpicker-button-active {
|
16
|
+
border: 2px solid red;
|
17
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useContext } from 'react';
|
3
|
+
import { useEditorContext } from '../../Providers/EditorProvider';
|
4
|
+
import { UiContext } from '../../Providers/UiProvider';
|
5
|
+
import { css } from '../../Utils';
|
6
|
+
import styles from './Header.module.css';
|
7
|
+
import RoisInfo from './RoisInfo';
|
8
|
+
const Header = () => {
|
9
|
+
var _a;
|
10
|
+
const { themeMode, Typography } = useContext(UiContext);
|
11
|
+
const { configuration } = useEditorContext();
|
12
|
+
return (_jsx("div", { className: css('header', styles, themeMode), children: _jsxs("div", { className: css('header-info', styles, themeMode), children: [((_a = configuration.options) === null || _a === void 0 ? void 0 : _a.description) && _jsx(Typography, { children: configuration.options.description }), _jsx(RoisInfo, {})] }) }));
|
13
|
+
};
|
14
|
+
export default Header;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
.header {
|
2
|
+
align-items: flex-start;
|
3
|
+
display: flex;
|
4
|
+
justify-content: space-between;
|
5
|
+
padding: .5rem;
|
6
|
+
}
|
7
|
+
|
8
|
+
.header-light {
|
9
|
+
background-color: #ddd;;
|
10
|
+
}
|
11
|
+
|
12
|
+
.header-dark {
|
13
|
+
background-color: #222;
|
14
|
+
}
|
15
|
+
|
16
|
+
.header-info {
|
17
|
+
padding: .5rem;
|
18
|
+
}
|
19
|
+
.header-info-light {
|
20
|
+
background-color: #ddd;;
|
21
|
+
color: #000;
|
22
|
+
}
|
23
|
+
.header-info-dark {
|
24
|
+
background-color: #222;
|
25
|
+
color: #fff;
|
26
|
+
}
|