@abidibo/react-cam-roi 0.2.3 → 0.2.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/README.md +14 -3
- package/dist/index.cjs.css +2 -0
- package/dist/index.cjs.css.map +1 -0
- package/dist/index.cjs.js +1665 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.esm.css +2 -0
- package/dist/index.esm.css.map +1 -0
- package/dist/index.esm.js +1659 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/{Components → types/Components}/RoiEditor/Canvas.d.ts +2 -0
- package/dist/{Components → types/Components}/RoiEditor/Types.d.ts +34 -0
- package/dist/{Components → types/Components}/RoiEditor/Utils.d.ts +24 -0
- package/dist/{Providers → types/Providers}/EditorProvider.d.ts +2 -1
- package/package.json +17 -6
- package/dist/Components/BoolField/index.js +0 -13
- package/dist/Components/Button/index.js +0 -15
- package/dist/Components/EnumField/index.js +0 -16
- package/dist/Components/IconButton/index.js +0 -10
- package/dist/Components/Loader/index.js +0 -9
- package/dist/Components/Modal/index.js +0 -16
- package/dist/Components/NumberField/index.js +0 -13
- package/dist/Components/RoiEditor/Canvas.js +0 -30
- package/dist/Components/RoiEditor/ColorPicker.js +0 -12
- package/dist/Components/RoiEditor/Header.js +0 -14
- package/dist/Components/RoiEditor/Hooks.js +0 -328
- package/dist/Components/RoiEditor/ParameterField.js +0 -27
- package/dist/Components/RoiEditor/ParametersModalForm/index.js +0 -42
- package/dist/Components/RoiEditor/Polygon.js +0 -77
- package/dist/Components/RoiEditor/Polyline.js +0 -75
- package/dist/Components/RoiEditor/Rectangle.js +0 -73
- package/dist/Components/RoiEditor/RoisInfo.js +0 -43
- package/dist/Components/RoiEditor/ShapesList.js +0 -77
- package/dist/Components/RoiEditor/Toolbar.js +0 -27
- package/dist/Components/RoiEditor/TopBar.js +0 -21
- package/dist/Components/RoiEditor/Types.js +0 -23
- package/dist/Components/RoiEditor/Utils.js +0 -161
- package/dist/Components/RoiEditor/index.js +0 -99
- package/dist/Components/RoleField.js +0 -49
- package/dist/Components/TextField/index.js +0 -13
- package/dist/Components/Typography/index.js +0 -6
- package/dist/Icons/AnnotateIcon.js +0 -5
- package/dist/Icons/CloseIcon.js +0 -5
- package/dist/Icons/CopyIcon.js +0 -5
- package/dist/Icons/DeleteIcon.js +0 -5
- package/dist/Icons/EditIcon.js +0 -5
- package/dist/Icons/PointerIcon.js +0 -5
- package/dist/Icons/PolygonIcon.js +0 -5
- package/dist/Icons/PolylineIcon.js +0 -5
- package/dist/Icons/RectangleIcon.js +0 -5
- package/dist/Icons/SaveIcon.js +0 -5
- package/dist/Providers/EditorProvider.js +0 -29
- package/dist/Providers/UiProvider.js +0 -104
- package/dist/Types.js +0 -1
- package/dist/Utils/Dispatcher.js +0 -65
- package/dist/Utils/index.js +0 -16
- package/dist/index.js +0 -4
- /package/dist/{Components → types/Components}/BoolField/index.d.ts +0 -0
- /package/dist/{Components → types/Components}/Button/index.d.ts +0 -0
- /package/dist/{Components → types/Components}/EnumField/index.d.ts +0 -0
- /package/dist/{Components → types/Components}/IconButton/index.d.ts +0 -0
- /package/dist/{Components → types/Components}/Loader/index.d.ts +0 -0
- /package/dist/{Components → types/Components}/Modal/index.d.ts +0 -0
- /package/dist/{Components → types/Components}/NumberField/index.d.ts +0 -0
- /package/dist/{Components → types/Components}/RoiEditor/ColorPicker.d.ts +0 -0
- /package/dist/{Components → types/Components}/RoiEditor/Header.d.ts +0 -0
- /package/dist/{Components → types/Components}/RoiEditor/Hooks.d.ts +0 -0
- /package/dist/{Components → types/Components}/RoiEditor/ParameterField.d.ts +0 -0
- /package/dist/{Components → types/Components}/RoiEditor/ParametersModalForm/index.d.ts +0 -0
- /package/dist/{Components → types/Components}/RoiEditor/Polygon.d.ts +0 -0
- /package/dist/{Components → types/Components}/RoiEditor/Polyline.d.ts +0 -0
- /package/dist/{Components → types/Components}/RoiEditor/Rectangle.d.ts +0 -0
- /package/dist/{Components → types/Components}/RoiEditor/RoisInfo.d.ts +0 -0
- /package/dist/{Components → types/Components}/RoiEditor/ShapesList.d.ts +0 -0
- /package/dist/{Components → types/Components}/RoiEditor/Toolbar.d.ts +0 -0
- /package/dist/{Components → types/Components}/RoiEditor/TopBar.d.ts +0 -0
- /package/dist/{Components → types/Components}/RoiEditor/index.d.ts +0 -0
- /package/dist/{Components → types/Components}/RoleField.d.ts +0 -0
- /package/dist/{Components → types/Components}/TextField/index.d.ts +0 -0
- /package/dist/{Components → types/Components}/Typography/index.d.ts +0 -0
- /package/dist/{Icons → types/Icons}/AnnotateIcon.d.ts +0 -0
- /package/dist/{Icons → types/Icons}/CloseIcon.d.ts +0 -0
- /package/dist/{Icons → types/Icons}/CopyIcon.d.ts +0 -0
- /package/dist/{Icons → types/Icons}/DeleteIcon.d.ts +0 -0
- /package/dist/{Icons → types/Icons}/EditIcon.d.ts +0 -0
- /package/dist/{Icons → types/Icons}/PointerIcon.d.ts +0 -0
- /package/dist/{Icons → types/Icons}/PolygonIcon.d.ts +0 -0
- /package/dist/{Icons → types/Icons}/PolylineIcon.d.ts +0 -0
- /package/dist/{Icons → types/Icons}/RectangleIcon.d.ts +0 -0
- /package/dist/{Icons → types/Icons}/SaveIcon.d.ts +0 -0
- /package/dist/{Providers → types/Providers}/UiProvider.d.ts +0 -0
- /package/dist/{Types.d.ts → types/Types.d.ts} +0 -0
- /package/dist/{Utils → types/Utils}/Dispatcher.d.ts +0 -0
- /package/dist/{Utils → types/Utils}/index.d.ts +0 -0
- /package/dist/{index.d.ts → types/index.d.ts} +0 -0
@@ -1,3 +1,4 @@
|
|
1
|
+
import * as fabric from 'fabric';
|
1
2
|
import { Output } from './Types';
|
2
3
|
type CanvasProps = {
|
3
4
|
canvasSize: {
|
@@ -9,6 +10,7 @@ type CanvasProps = {
|
|
9
10
|
height: number;
|
10
11
|
};
|
11
12
|
initialData?: Output;
|
13
|
+
canvasRef: React.MutableRefObject<fabric.Canvas | null>;
|
12
14
|
};
|
13
15
|
declare const Canvas: React.FC<CanvasProps>;
|
14
16
|
export default Canvas;
|
@@ -79,6 +79,11 @@ export type Metadata = {
|
|
79
79
|
}[];
|
80
80
|
};
|
81
81
|
export type OutputShapeRect = {
|
82
|
+
angle: number;
|
83
|
+
scaleX: number;
|
84
|
+
scaleY: number;
|
85
|
+
skewX: number;
|
86
|
+
skewY: number;
|
82
87
|
top: number;
|
83
88
|
left: number;
|
84
89
|
width: number;
|
@@ -86,6 +91,11 @@ export type OutputShapeRect = {
|
|
86
91
|
color: string;
|
87
92
|
};
|
88
93
|
export type OutputShapePolyline = {
|
94
|
+
angle: number;
|
95
|
+
scaleX: number;
|
96
|
+
scaleY: number;
|
97
|
+
skewX: number;
|
98
|
+
skewY: number;
|
89
99
|
points: {
|
90
100
|
x: number;
|
91
101
|
y: number;
|
@@ -95,6 +105,11 @@ export type OutputShapePolyline = {
|
|
95
105
|
color: string;
|
96
106
|
};
|
97
107
|
export type OutputShapePolygon = {
|
108
|
+
angle: number;
|
109
|
+
scaleX: number;
|
110
|
+
scaleY: number;
|
111
|
+
skewX: number;
|
112
|
+
skewY: number;
|
98
113
|
points: {
|
99
114
|
x: number;
|
100
115
|
y: number;
|
@@ -103,6 +118,24 @@ export type OutputShapePolygon = {
|
|
103
118
|
left: number;
|
104
119
|
color: string;
|
105
120
|
};
|
121
|
+
export type OutputRectCoords = {
|
122
|
+
points: {
|
123
|
+
x: number;
|
124
|
+
y: number;
|
125
|
+
}[];
|
126
|
+
};
|
127
|
+
export type OutputPolylineCoords = {
|
128
|
+
points: {
|
129
|
+
x: number;
|
130
|
+
y: number;
|
131
|
+
}[];
|
132
|
+
};
|
133
|
+
export type OutputPolygonCoords = {
|
134
|
+
points: {
|
135
|
+
x: number;
|
136
|
+
y: number;
|
137
|
+
}[];
|
138
|
+
};
|
106
139
|
export interface OutputParameter {
|
107
140
|
codename: string;
|
108
141
|
value: number | string | boolean | string[] | number[] | null;
|
@@ -114,6 +147,7 @@ export interface OutputRoi {
|
|
114
147
|
role: string;
|
115
148
|
id: string;
|
116
149
|
shape: OutputShapeRect | OutputShapePolyline | OutputShapePolygon;
|
150
|
+
coords: OutputRectCoords | OutputPolylineCoords | OutputPolygonCoords;
|
117
151
|
}
|
118
152
|
export interface Output {
|
119
153
|
parameters: OutputParameter[];
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import * as fabric from 'fabric';
|
1
2
|
import { Configuration, ConfigurationParameter, INotify, Metadata, Shape, Shapes, ShapeType, ToolEnum } from './Types';
|
2
3
|
export declare const notify: INotify;
|
3
4
|
export declare const enableRois: (configuration: Configuration) => boolean;
|
@@ -9,6 +10,11 @@ export declare const fabricShapeToOutputShape: (shape: Shape, type: ShapeType, i
|
|
9
10
|
width: number;
|
10
11
|
height: number;
|
11
12
|
}) => {
|
13
|
+
angle: fabric.TDegree;
|
14
|
+
scaleX: number;
|
15
|
+
scaleY: number;
|
16
|
+
skewX: number;
|
17
|
+
skewY: number;
|
12
18
|
top: number;
|
13
19
|
left: number;
|
14
20
|
width: number;
|
@@ -20,6 +26,24 @@ export declare const fabricShapeToOutputShape: (shape: Shape, type: ShapeType, i
|
|
20
26
|
top: number;
|
21
27
|
left: number;
|
22
28
|
color: string;
|
29
|
+
angle: fabric.TDegree;
|
30
|
+
scaleX: number;
|
31
|
+
scaleY: number;
|
32
|
+
skewX: number;
|
33
|
+
skewY: number;
|
23
34
|
width?: undefined;
|
24
35
|
height?: undefined;
|
25
36
|
};
|
37
|
+
export declare function getAbsoluteRectData(rect: fabric.Rect): {
|
38
|
+
x: number;
|
39
|
+
y: number;
|
40
|
+
}[];
|
41
|
+
export declare const fabricShapeToOutputCoords: (shape: Shape, type: ShapeType, imageSize: {
|
42
|
+
width: number;
|
43
|
+
height: number;
|
44
|
+
}) => {
|
45
|
+
points: {
|
46
|
+
x: number;
|
47
|
+
y: number;
|
48
|
+
}[];
|
49
|
+
};
|
@@ -7,6 +7,7 @@ type EditorContextType = {
|
|
7
7
|
activeColor: string;
|
8
8
|
setActiveColor: (color: string) => void;
|
9
9
|
shapes: Shapes;
|
10
|
+
setShapes: (shapes: Shapes) => void;
|
10
11
|
addShape: (id: string, type: ShapeType, shape: Shape) => void;
|
11
12
|
addShapes: (shapes: {
|
12
13
|
id: string;
|
@@ -22,5 +23,5 @@ type EditorContextType = {
|
|
22
23
|
};
|
23
24
|
export declare const EditorContext: import("react").Context<EditorContextType | undefined>;
|
24
25
|
export declare function useEditorContext(): EditorContextType;
|
25
|
-
declare const EditorProvider: ({ children, editorId, hideForbiddenTools, activeTool, setActiveTool, activeColor, setActiveColor, shapes, addShape, addShapes, removeShape, configuration, metadata, setMetadata, onSubmit, }: PropsWithChildren<EditorContextType>) => import("react/jsx-runtime").JSX.Element;
|
26
|
+
declare const EditorProvider: ({ children, editorId, hideForbiddenTools, activeTool, setActiveTool, activeColor, setActiveColor, shapes, setShapes, addShape, addShapes, removeShape, configuration, metadata, setMetadata, onSubmit, }: PropsWithChildren<EditorContextType>) => import("react/jsx-runtime").JSX.Element;
|
26
27
|
export default EditorProvider;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@abidibo/react-cam-roi",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.5",
|
4
4
|
"description": "A react component for drawing ROI over images and managing metadata",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -9,7 +9,9 @@
|
|
9
9
|
"bugs": {
|
10
10
|
"url": "https://github.com/abidibo/react-cam-roi/issues"
|
11
11
|
},
|
12
|
-
"main": "dist/index.js",
|
12
|
+
"main": "dist/index.cjs.js",
|
13
|
+
"module": "dist/index.esm.js",
|
14
|
+
"types": "dist/types/index.d.ts",
|
13
15
|
"type": "module",
|
14
16
|
"files": [
|
15
17
|
"dist"
|
@@ -19,14 +21,17 @@
|
|
19
21
|
},
|
20
22
|
"exports": {
|
21
23
|
".": {
|
22
|
-
"
|
23
|
-
"
|
24
|
-
|
24
|
+
"import": "./dist/index.esm.js",
|
25
|
+
"require": "./dist/index.cjs.js",
|
26
|
+
"types": "./dist/types/index.d.ts",
|
27
|
+
"style": "./dist/index.esm.css"
|
28
|
+
},
|
29
|
+
"./dist/index.esm.css": "./dist/index.esm.css"
|
25
30
|
},
|
26
31
|
"scripts": {
|
27
32
|
"clean": "rimraf dist",
|
28
33
|
"prebuild": "npm run clean",
|
29
|
-
"build": "
|
34
|
+
"build": "rollup -c",
|
30
35
|
"postbuild": "npm run copy-files",
|
31
36
|
"copy-files": "copyfiles -u 1 src/**/*.module.css dist/",
|
32
37
|
"test": "echo \"Error: no test specified\" && exit 1",
|
@@ -66,6 +71,9 @@
|
|
66
71
|
"@eslint/js": "^9.18.0",
|
67
72
|
"@fontsource/roboto": "^5.1.1",
|
68
73
|
"@mui/material": "^6.4.3",
|
74
|
+
"@rollup/plugin-commonjs": "^28.0.3",
|
75
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
76
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
69
77
|
"@semantic-release/changelog": "^6.0.3",
|
70
78
|
"@semantic-release/git": "^10.0.1",
|
71
79
|
"@storybook/addon-essentials": "^8.4.7",
|
@@ -86,6 +94,9 @@
|
|
86
94
|
"globals": "^15.14.0",
|
87
95
|
"prettier": "^3.4.2",
|
88
96
|
"rimraf": "^6.0.1",
|
97
|
+
"rollup": "^4.40.0",
|
98
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
99
|
+
"rollup-plugin-postcss": "^4.0.2",
|
89
100
|
"semantic-release": "^24.2.2",
|
90
101
|
"storybook": "^8.4.7",
|
91
102
|
"typescript": "^5.7.3",
|
@@ -1,13 +0,0 @@
|
|
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;
|
@@ -1,15 +0,0 @@
|
|
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;
|
@@ -1,16 +0,0 @@
|
|
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;
|
@@ -1,10 +0,0 @@
|
|
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;
|
@@ -1,9 +0,0 @@
|
|
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
|
-
};
|
@@ -1,16 +0,0 @@
|
|
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;
|
@@ -1,13 +0,0 @@
|
|
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;
|
@@ -1,30 +0,0 @@
|
|
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;
|
@@ -1,12 +0,0 @@
|
|
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;
|
@@ -1,14 +0,0 @@
|
|
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;
|