@abidibo/react-cam-roi 0.11.0 → 0.12.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/dist/index.esm.js CHANGED
@@ -485,6 +485,11 @@ var TextField = function (_a) {
485
485
  return (jsxs("div", { className: css('text-field-wrapper', styles$8, themeMode), style: { width: fullWidth ? '100%' : 'auto' }, children: [label && (jsx("label", { className: "".concat(css('text-field-label', styles$8, themeMode), " ").concat(error ? css('text-field-label-error', styles$8, null) : ''), children: jsxs(Typography, { children: [label, required && ' *'] }) })), jsx("input", { type: type, className: "".concat(css('text-field', styles$8, themeMode), " ").concat(error ? css('text-field-error', styles$8, null) : ''), onChange: handleChange, value: value, readOnly: readOnly, disabled: disabled }), helperText && (jsx(Typography, { component: 'div', className: "".concat(css('text-field-helper-text', styles$8, themeMode), " ").concat(error ? css('text-field-helper-text-error', styles$8, null) : ''), children: helperText }))] }));
486
486
  };
487
487
 
488
+ var Tooltip = function (_a) {
489
+ var title = _a.title, children = _a.children;
490
+ return jsx("div", { title: title, children: children });
491
+ };
492
+
488
493
  var Typography = function (_a) {
489
494
  var children = _a.children, _b = _a.style, style = _b === void 0 ? {} : _b, _c = _a.className, className = _c === void 0 ? '' : _c, _d = _a.component, component = _d === void 0 ? 'span' : _d;
490
495
  var Tag = component;
@@ -523,6 +528,7 @@ var DefaultUiContext = {
523
528
  primaryColor: '#1976d2',
524
529
  primaryFgColor: '#fff',
525
530
  Typography: Typography,
531
+ Tooltip: Tooltip,
526
532
  IconButton: IconButton,
527
533
  Modal: Modal,
528
534
  DeleteIcon: DeleteIcon,
@@ -544,6 +550,7 @@ var DefaultUiContext = {
544
550
  cannotDrawMorePolygons: 'You cannot draw more polygons',
545
551
  cannotDrawMorePolylines: 'You cannot draw more polylines',
546
552
  cannotDrawMoreRectangles: 'You cannot draw more rectangles',
553
+ fullImage: 'Full image',
547
554
  id: 'ID',
548
555
  invalidSubmission: 'Invalid submission',
549
556
  mainParametersMetadata: 'Main parameters',
@@ -559,10 +566,10 @@ var DefaultUiContext = {
559
566
  polylineHelpText: 'click to draw all the polyline points, double click on the last point to stop drawing',
560
567
  presetDescription: 'Preset description',
561
568
  presetName: 'Image preset',
562
- rect: 'Rectangle',
563
- rectHelpText: 'click and drag to draw the rectangle',
564
569
  pointer: 'Selection',
565
570
  pointerHelpText: 'click a shape to select it',
571
+ rect: 'Rectangle',
572
+ rectHelpText: 'click and drag to draw the rectangle',
566
573
  requiredField: 'This field is required',
567
574
  roiMultiplicityEqRule: 'a number of "{role}" ({type}) equal to {threshold}',
568
575
  roiMultiplicityGtRule: 'a number of "{role}" ({type}) greater than {threshold}',
@@ -573,6 +580,7 @@ var DefaultUiContext = {
573
580
  roisToBeDrawn: 'ROIs to be drawn',
574
581
  role: 'Role',
575
582
  save: 'Save',
583
+ selection: 'Selection',
576
584
  shapeParametersMetadata: 'Shape parameters',
577
585
  shapesOfRoleShouldBeEqualToThreshold: 'Shapes of role {role} should be equal to {threshold}',
578
586
  shapesOfRoleShouldBeGreaterThanThreshold: 'Shapes of role {role} should be greater than {threshold}',
@@ -584,10 +592,11 @@ var DefaultUiContext = {
584
592
  };
585
593
  var UiContext = createContext(DefaultUiContext); // eslint-disable-line
586
594
  var UiProvider = function (_a) {
587
- var children = _a.children, enableLogs = _a.enableLogs, themeMode = _a.themeMode, primaryColor = _a.primaryColor, primaryFgColor = _a.primaryFgColor, Typography = _a.Typography, Modal = _a.Modal, IconButton = _a.IconButton, DeleteIcon = _a.DeleteIcon, EditIcon = _a.EditIcon, CopyIcon = _a.CopyIcon, AnnotateIcon = _a.AnnotateIcon, SaveIcon = _a.SaveIcon, CloseIcon = _a.CloseIcon, TextField = _a.TextField, NumberField = _a.NumberField, BoolField = _a.BoolField, EnumField = _a.EnumField, Button = _a.Button, pickerColors = _a.pickerColors, notify = _a.notify, strings = _a.strings;
595
+ var children = _a.children, enableLogs = _a.enableLogs, themeMode = _a.themeMode, primaryColor = _a.primaryColor, primaryFgColor = _a.primaryFgColor, Typography = _a.Typography, Tooltip = _a.Tooltip, Modal = _a.Modal, IconButton = _a.IconButton, DeleteIcon = _a.DeleteIcon, EditIcon = _a.EditIcon, CopyIcon = _a.CopyIcon, AnnotateIcon = _a.AnnotateIcon, SaveIcon = _a.SaveIcon, CloseIcon = _a.CloseIcon, TextField = _a.TextField, NumberField = _a.NumberField, BoolField = _a.BoolField, EnumField = _a.EnumField, Button = _a.Button, pickerColors = _a.pickerColors, notify = _a.notify, strings = _a.strings;
588
596
  var ctx = {
589
597
  enableLogs: enableLogs !== null && enableLogs !== void 0 ? enableLogs : DefaultUiContext.enableLogs,
590
598
  Typography: Typography !== null && Typography !== void 0 ? Typography : DefaultUiContext.Typography,
599
+ Tooltip: Tooltip !== null && Tooltip !== void 0 ? Tooltip : DefaultUiContext.Tooltip,
591
600
  Modal: Modal !== null && Modal !== void 0 ? Modal : DefaultUiContext.Modal,
592
601
  IconButton: IconButton !== null && IconButton !== void 0 ? IconButton : DefaultUiContext.IconButton,
593
602
  DeleteIcon: DeleteIcon !== null && DeleteIcon !== void 0 ? DeleteIcon : DefaultUiContext.DeleteIcon,
@@ -1700,7 +1709,7 @@ var styles$1 = {"toolbar":"Toolbar-module_toolbar__ywNcv","toolbar-light":"Toolb
1700
1709
  var Toolbar = function (_a) {
1701
1710
  var _b;
1702
1711
  var canvasRef = _a.canvasRef, imageSize = _a.imageSize;
1703
- var _c = useContext(UiContext), IconButton = _c.IconButton, themeMode = _c.themeMode, primaryColor = _c.primaryColor, Typography = _c.Typography, strings = _c.strings;
1712
+ var _c = useContext(UiContext), IconButton = _c.IconButton, themeMode = _c.themeMode, primaryColor = _c.primaryColor, Typography = _c.Typography, strings = _c.strings, Tooltip = _c.Tooltip;
1704
1713
  var _d = useEditorContext(), activeTool = _d.activeTool, setActiveTool = _d.setActiveTool, configuration = _d.configuration, shapes = _d.shapes, editorId = _d.editorId, activeColor = _d.activeColor;
1705
1714
  var iconColor = function (tool) { return (tool === activeTool ? primaryColor : themeMode === 'light' ? 'black' : 'white'); };
1706
1715
  var setTool = function (tool) { return function () { return setActiveTool(tool); }; };
@@ -1714,7 +1723,7 @@ var Toolbar = function (_a) {
1714
1723
  var handleRenderFullImagePolygon = function () {
1715
1724
  renderFullImagePolygon(editorId, canvasRef.current, activeColor, imageSize);
1716
1725
  };
1717
- return (jsxs(Fragment, { children: [jsx("div", { className: css('toolbar', styles$1, themeMode), children: enableRois(configuration) && (jsxs(Fragment, { children: [jsx(IconButton, { onClick: setTool("pointer" /* ToolEnum.Pointer */), children: jsx(PointerIcon, { color: iconColor("pointer" /* ToolEnum.Pointer */) }) }), (!hideForbiddenTools || pointEnabled) && (jsx(IconButton, { onClick: setTool("point" /* ToolEnum.Point */), disabled: !pointEnabled, children: jsx(PointIcon, { color: iconColor("point" /* ToolEnum.Point */) }) })), (!hideForbiddenTools || polylineEnabled) && (jsx(IconButton, { onClick: setTool("polyline" /* ToolEnum.Polyline */), disabled: !polylineEnabled, children: jsx(PolylineIcon, { color: iconColor("polyline" /* ToolEnum.Polyline */) }) })), (!hideForbiddenTools || polygonEnabled) && (jsxs(Fragment, { children: [jsx(IconButton, { onClick: setTool("polygon" /* ToolEnum.Polygon */), disabled: !polygonEnabled, children: jsx(PolygonIcon, { color: iconColor("polygon" /* ToolEnum.Polygon */) }) }), jsx(IconButton, { onClick: handleRenderFullImagePolygon, disabled: !polygonEnabled, children: jsx(FullRoiIcon, { color: iconColor("polygon" /* ToolEnum.Polygon */) }) })] })), (!hideForbiddenTools || rectangleEnabled) && (jsx(IconButton, { onClick: setTool("rect" /* ToolEnum.Rectangle */), disabled: !rectangleEnabled, children: jsx(RectangleIcon, { color: iconColor("rect" /* ToolEnum.Rectangle */) }) })), jsx(ColorPicker, { style: { marginLeft: 'auto', marginRight: '.5rem' } })] })) }), enableRois(configuration) && (jsx("div", { className: css('toolbar-helper', styles$1, themeMode), children: jsxs(Typography, { children: [strings[activeTool], ": ", strings["".concat(activeTool, "HelpText")]] }) }))] }));
1726
+ return (jsxs(Fragment, { children: [jsx("div", { className: css('toolbar', styles$1, themeMode), children: enableRois(configuration) && (jsxs(Fragment, { children: [jsx(Tooltip, { title: strings.selection, children: jsx(IconButton, { onClick: setTool("pointer" /* ToolEnum.Pointer */), children: jsx(PointerIcon, { color: iconColor("pointer" /* ToolEnum.Pointer */) }) }) }), (!hideForbiddenTools || pointEnabled) && (jsx(Tooltip, { title: strings.point, children: jsx(IconButton, { onClick: setTool("point" /* ToolEnum.Point */), disabled: !pointEnabled, children: jsx(PointIcon, { color: iconColor("point" /* ToolEnum.Point */) }) }) })), (!hideForbiddenTools || polylineEnabled) && (jsx(Tooltip, { title: strings.polyline, children: jsx(IconButton, { onClick: setTool("polyline" /* ToolEnum.Polyline */), disabled: !polylineEnabled, children: jsx(PolylineIcon, { color: iconColor("polyline" /* ToolEnum.Polyline */) }) }) })), (!hideForbiddenTools || polygonEnabled) && (jsxs(Fragment, { children: [jsx(Tooltip, { title: strings.polygon, children: jsx(IconButton, { onClick: setTool("polygon" /* ToolEnum.Polygon */), disabled: !polygonEnabled, children: jsx(PolygonIcon, { color: iconColor("polygon" /* ToolEnum.Polygon */) }) }) }), jsx(Tooltip, { title: strings.fullImage, children: jsx(IconButton, { onClick: handleRenderFullImagePolygon, disabled: !polygonEnabled, children: jsx(FullRoiIcon, { color: iconColor("polygon" /* ToolEnum.Polygon */) }) }) })] })), (!hideForbiddenTools || rectangleEnabled) && (jsx(Tooltip, { title: strings.rect, children: jsx(IconButton, { onClick: setTool("rect" /* ToolEnum.Rectangle */), disabled: !rectangleEnabled, children: jsx(RectangleIcon, { color: iconColor("rect" /* ToolEnum.Rectangle */) }) }) })), jsx(ColorPicker, { style: { marginLeft: 'auto', marginRight: '.5rem' } })] })) }), enableRois(configuration) && (jsx("div", { className: css('toolbar-helper', styles$1, themeMode), children: jsxs(Typography, { children: [strings[activeTool], ": ", strings["".concat(activeTool, "HelpText")]] }) }))] }));
1718
1727
  };
1719
1728
 
1720
1729
  var styles = {"top-bar":"TopBar-module_top-bar__9oCUR","main-parameters-view":"TopBar-module_main-parameters-view__f-0SX","main-parameters-view-light":"TopBar-module_main-parameters-view-light__o-dbi","main-parameters-view-dark":"TopBar-module_main-parameters-view-dark__FnEnj","main-parameters-button":"TopBar-module_main-parameters-button__9JX--"};