@olenbetong/synergi-react 4.0.0 → 4.1.1

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 (85) hide show
  1. package/es/components/DateNavigator/index.js +1 -1
  2. package/es/components/FilePond.js +1 -1
  3. package/es/components/ImageEditor/ImageEditor.js +1 -1
  4. package/es/components/ImageEditor/plugins/cropPlugin/CropOverlay.js +1 -1
  5. package/es/components/ImageEditor/plugins/cropPlugin/CropToolbar.js +1 -1
  6. package/es/components/ImageEditor/plugins/redactPlugin/RedactToolbar.js +1 -1
  7. package/es/components/ImageEditor/plugins/zoomPlugin/ZoomControls.js +1 -1
  8. package/es/components/MergeProgressDialog/index.js +1 -1
  9. package/es/components/PdfViewer/PdfViewer.js +22 -3
  10. package/es/components/Toolbar/index.js +1 -1
  11. package/es/elements/ElementDamage/DamageFormButtons.js +1 -1
  12. package/es/elements/ElementDamage/DescriptionInput.js +1 -1
  13. package/es/elements/ElementDamage/DuplicateDamage/DesktopView.js +1 -1
  14. package/es/elements/ElementDamage/DuplicateDamage/DublicateElementDamageDialog.js +1 -1
  15. package/es/elements/ElementDamage/DuplicateDamage/PhoneView.js +1 -1
  16. package/es/elements/ElementDamage/ElementNumberTextField.js +1 -1
  17. package/es/elements/ElementDamage/RegisterFix.js +1 -1
  18. package/es/elements/ElementDamage/SubmitButtons.js +1 -1
  19. package/es/elements/ElementDamage/TransportElementSelect.js +1 -1
  20. package/es/elements/ElementLookup.js +1 -1
  21. package/es/elements/ElementLookupDialog/BarcodeScanner/decoders/native.js +1 -1
  22. package/es/elements/ElementLookupDialog/BarcodeScanner/index.js +1 -1
  23. package/es/elements/ElementLookupDialog/BarcodeScanner/useScanner.js +1 -1
  24. package/es/elements/ElementLookupDialog/HIDScanner/index.js +1 -1
  25. package/es/elements/ElementLookupDialog/Manual/ManualForm.js +1 -1
  26. package/es/elements/ElementLookupDialog/index.js +1 -1
  27. package/es/elements/ElementLookupDialog/utils/Giai.js +1 -1
  28. package/es/elements/ProjectSelect.js +1 -1
  29. package/es/i18n.d.ts +6 -0
  30. package/es/i18n.js +10 -0
  31. package/package.json +7 -7
  32. package/src/chrome/AppShell/index.tsx +29 -29
  33. package/src/chrome/openReport.ts +34 -34
  34. package/src/colorScheme.ts +81 -81
  35. package/src/components/DateNavigator/index.tsx +186 -186
  36. package/src/components/FilePond.tsx +312 -312
  37. package/src/components/ImageEditor/ImageEditor.tsx +343 -343
  38. package/src/components/ImageEditor/index.ts +9 -9
  39. package/src/components/ImageEditor/plugins/cropPlugin/CropOverlay.tsx +165 -165
  40. package/src/components/ImageEditor/plugins/cropPlugin/CropToolbar.tsx +48 -48
  41. package/src/components/ImageEditor/plugins/cropPlugin/useCropTool.ts +403 -403
  42. package/src/components/ImageEditor/plugins/redactPlugin/RedactToolbar.tsx +47 -47
  43. package/src/components/ImageEditor/plugins/zoomPlugin/ZoomContext.tsx +23 -23
  44. package/src/components/ImageEditor/plugins/zoomPlugin/ZoomControls.tsx +40 -40
  45. package/src/components/ImageEditor/useEdgeDetection.ts +127 -127
  46. package/src/components/ImageEditor/useImageHistory.ts +197 -197
  47. package/src/components/ImageEditor/useOpenCV.ts +184 -184
  48. package/src/components/LinkedCardList/index.scss +95 -95
  49. package/src/components/MergeProgressDialog/index.tsx +249 -249
  50. package/src/components/PageBanner/index.tsx +80 -80
  51. package/src/components/PdfViewer/PdfViewer.tsx +158 -139
  52. package/src/components/ProgressBar/index.scss +96 -96
  53. package/src/components/SplitContainer/index.tsx +333 -333
  54. package/src/components/Toolbar/index.tsx +212 -212
  55. package/src/designsystemet-web-types.d.ts +24 -24
  56. package/src/elements/ElementDamage/DamageFormButtons.tsx +35 -35
  57. package/src/elements/ElementDamage/DescriptionInput.tsx +120 -120
  58. package/src/elements/ElementDamage/DuplicateDamage/DesktopView.tsx +82 -82
  59. package/src/elements/ElementDamage/DuplicateDamage/DublicateElementDamageDialog.tsx +67 -67
  60. package/src/elements/ElementDamage/DuplicateDamage/PhoneView.tsx +45 -45
  61. package/src/elements/ElementDamage/ElementNumberTextField.tsx +41 -41
  62. package/src/elements/ElementDamage/RegisterFix.tsx +100 -100
  63. package/src/elements/ElementDamage/SubmitButtons.tsx +40 -40
  64. package/src/elements/ElementDamage/TransportElementSelect.tsx +52 -52
  65. package/src/elements/ElementLookup.tsx +123 -123
  66. package/src/elements/ElementLookupDialog/BarcodeScanner/decoder.ts +32 -32
  67. package/src/elements/ElementLookupDialog/BarcodeScanner/decoders/dbr.ts +118 -118
  68. package/src/elements/ElementLookupDialog/BarcodeScanner/decoders/native.ts +103 -103
  69. package/src/elements/ElementLookupDialog/BarcodeScanner/decoders/zxing.ts +95 -95
  70. package/src/elements/ElementLookupDialog/BarcodeScanner/decoders.test.ts +118 -118
  71. package/src/elements/ElementLookupDialog/BarcodeScanner/duplicateFilter.ts +21 -21
  72. package/src/elements/ElementLookupDialog/BarcodeScanner/index.tsx +90 -90
  73. package/src/elements/ElementLookupDialog/BarcodeScanner/useScanner.ts +280 -280
  74. package/src/elements/ElementLookupDialog/HIDScanner/index.tsx +67 -67
  75. package/src/elements/ElementLookupDialog/Manual/ManualForm.tsx +141 -141
  76. package/src/elements/ElementLookupDialog/index.tsx +226 -226
  77. package/src/elements/ElementLookupDialog/utils/Giai.ts +209 -209
  78. package/src/elements/ProjectSelect.tsx +130 -130
  79. package/src/elements/index.ts +15 -15
  80. package/src/filter/index.ts +34 -34
  81. package/src/i18n.ts +13 -0
  82. package/src/index.ts +77 -77
  83. package/src/mui/MuiThemeProvider.tsx +174 -174
  84. package/src/mui/index.ts +1 -1
  85. package/src/test/setup.ts +8 -8
@@ -1,9 +1,9 @@
1
- export { defaultPlugins, defaultViewPlugin } from "./defaultPlugins.js";
2
- export type { ImageEditorRef } from "./ImageEditor.js";
3
- export { ImageEditor } from "./ImageEditor.js";
4
- export { cropPlugin } from "./plugins/cropPlugin/index.js";
5
- export { redactPlugin } from "./plugins/redactPlugin/index.js";
6
- export { zoomPlugin } from "./plugins/zoomPlugin/index.js";
7
- export { rotateCcwPlugin, rotateCwPlugin } from "./plugins/rotatePlugin.js";
8
- export type { ActionPlugin, EditAction, Plugin, ToolPlugin, ViewPlugin } from "./types.js";
9
- export { configureOpenCV, DEFAULT_OPENCV_URLS, loadOpenCV } from "./useOpenCV.js";
1
+ export { defaultPlugins, defaultViewPlugin } from "./defaultPlugins.js";
2
+ export type { ImageEditorRef } from "./ImageEditor.js";
3
+ export { ImageEditor } from "./ImageEditor.js";
4
+ export { cropPlugin } from "./plugins/cropPlugin/index.js";
5
+ export { redactPlugin } from "./plugins/redactPlugin/index.js";
6
+ export { zoomPlugin } from "./plugins/zoomPlugin/index.js";
7
+ export { rotateCcwPlugin, rotateCwPlugin } from "./plugins/rotatePlugin.js";
8
+ export type { ActionPlugin, EditAction, Plugin, ToolPlugin, ViewPlugin } from "./types.js";
9
+ export { configureOpenCV, DEFAULT_OPENCV_URLS, loadOpenCV } from "./useOpenCV.js";
@@ -1,165 +1,165 @@
1
- import { Paragraph, Spinner } from "@digdir/designsystemet-react";
2
- import { getLocalizedString } from "@olenbetong/appframe-core";
3
-
4
- import { CropCanvas } from "../../CropCanvas.js";
5
- import { DragHandle } from "../../DragHandle.js";
6
- import { EdgeHandle } from "../../EdgeHandle.js";
7
- import { useZoomLevel } from "../zoomPlugin/ZoomContext.js";
8
- import { useCropContext } from "./CropContext.js";
9
-
10
- /** Canvas-area overlay for the crop tool. Reads all state from CropContext. */
11
- export function CropOverlay() {
12
- let {
13
- imageUrl,
14
- activeCorners,
15
- mode,
16
- hasSelection,
17
- scale,
18
- displaySize,
19
- canvasRef,
20
- cvReady,
21
- cvError,
22
- cropping,
23
- error,
24
- handleCanvasReady,
25
- updateCorner,
26
- startRectDraw,
27
- updateRectDraw,
28
- finishRectDraw,
29
- } = useCropContext();
30
-
31
- let zoom = useZoomLevel();
32
- let showHandles = mode === "corners" && displaySize.width > 0;
33
-
34
- function pointerPosition(e: React.PointerEvent<HTMLDivElement>) {
35
- // getBoundingClientRect() is screen-space (affected by the zoom transform),
36
- // so divide by zoom to get back to the CSS-pixel space the tool expects.
37
- let rect = e.currentTarget.getBoundingClientRect();
38
- return { x: (e.clientX - rect.left) / zoom, y: (e.clientY - rect.top) / zoom };
39
- }
40
-
41
- function onPointerDown(e: React.PointerEvent<HTMLDivElement>) {
42
- e.currentTarget.setPointerCapture(e.pointerId);
43
- let { x, y } = pointerPosition(e);
44
- startRectDraw(x, y);
45
- }
46
-
47
- function onPointerMove(e: React.PointerEvent<HTMLDivElement>) {
48
- if (!(e.buttons & 1)) return;
49
- let { x, y } = pointerPosition(e);
50
- updateRectDraw(x, y);
51
- }
52
-
53
- return (
54
- <div className="crop-root">
55
- <div className="crop-inner">
56
- <CropCanvas ref={canvasRef} imageUrl={imageUrl} corners={activeCorners} onReady={handleCanvasReady} />
57
-
58
- {mode === "rect" && displaySize.width > 0 && (
59
- <div
60
- role="application"
61
- aria-label={getLocalizedString("Drag to draw a rectangle to crop to")}
62
- className="crop-draw-surface"
63
- onPointerDown={onPointerDown}
64
- onPointerMove={onPointerMove}
65
- onPointerUp={finishRectDraw}
66
- onPointerCancel={finishRectDraw}
67
- />
68
- )}
69
-
70
- {showHandles &&
71
- activeCorners.map((corner, i) => (
72
- <DragHandle
73
- key={i}
74
- x={corner.x * scale}
75
- y={corner.y * scale}
76
- onChange={(x, y) => updateCorner(i, x, y)}
77
- containerWidth={displaySize.width}
78
- containerHeight={displaySize.height}
79
- />
80
- ))}
81
-
82
- {showHandles &&
83
- (() => {
84
- let [tl, tr, br, bl] = activeCorners;
85
- let s = scale;
86
- return (
87
- <>
88
- {/* Top edge — moves TL (0) and TR (1) */}
89
- <EdgeHandle
90
- x={((tl.x + tr.x) / 2) * s}
91
- y={((tl.y + tr.y) / 2) * s}
92
- axis="y"
93
- onChange={(dx, dy) => {
94
- updateCorner(0, tl.x * s + dx, tl.y * s + dy);
95
- updateCorner(1, tr.x * s + dx, tr.y * s + dy);
96
- }}
97
- />
98
- {/* Right edge — moves TR (1) and BR (2) */}
99
- <EdgeHandle
100
- x={((tr.x + br.x) / 2) * s}
101
- y={((tr.y + br.y) / 2) * s}
102
- axis="x"
103
- onChange={(dx, dy) => {
104
- updateCorner(1, tr.x * s + dx, tr.y * s + dy);
105
- updateCorner(2, br.x * s + dx, br.y * s + dy);
106
- }}
107
- />
108
- {/* Bottom edge — moves BR (2) and BL (3) */}
109
- <EdgeHandle
110
- x={((br.x + bl.x) / 2) * s}
111
- y={((br.y + bl.y) / 2) * s}
112
- axis="y"
113
- onChange={(dx, dy) => {
114
- updateCorner(2, br.x * s + dx, br.y * s + dy);
115
- updateCorner(3, bl.x * s + dx, bl.y * s + dy);
116
- }}
117
- />
118
- {/* Left edge — moves BL (3) and TL (0) */}
119
- <EdgeHandle
120
- x={((bl.x + tl.x) / 2) * s}
121
- y={((bl.y + tl.y) / 2) * s}
122
- axis="x"
123
- onChange={(dx, dy) => {
124
- updateCorner(3, bl.x * s + dx, bl.y * s + dy);
125
- updateCorner(0, tl.x * s + dx, tl.y * s + dy);
126
- }}
127
- />
128
- </>
129
- );
130
- })()}
131
- </div>
132
-
133
- {/* Status line. OpenCV only powers the border suggestion, so a load failure is
134
- informational — cropping stays available either way. */}
135
- {cropping ? (
136
- <div className="crop-loading">
137
- <Spinner aria-hidden data-size="xs" />
138
- </div>
139
- ) : error ? (
140
- <div className="crop-loading">
141
- <Paragraph data-size="sm">{error}</Paragraph>
142
- </div>
143
- ) : mode === "rect" ? (
144
- <div className="crop-loading">
145
- <Paragraph data-size="sm">
146
- {hasSelection
147
- ? getLocalizedString("Release to use this rectangle")
148
- : getLocalizedString("Drag to draw a rectangle to crop to")}
149
- </Paragraph>
150
- </div>
151
- ) : !cvReady && !cvError ? (
152
- <div className="crop-loading">
153
- <Spinner aria-hidden data-size="xs" />
154
- <Paragraph data-size="sm">{getLocalizedString("Detecting borders…")}</Paragraph>
155
- </div>
156
- ) : cvError ? (
157
- <div className="crop-loading">
158
- <Paragraph data-size="sm">
159
- {getLocalizedString("Automatic border detection is unavailable. Adjust the selection manually.")}
160
- </Paragraph>
161
- </div>
162
- ) : null}
163
- </div>
164
- );
165
- }
1
+ import { Paragraph, Spinner } from "@digdir/designsystemet-react";
2
+
3
+ import { CropCanvas } from "../../CropCanvas.js";
4
+ import { DragHandle } from "../../DragHandle.js";
5
+ import { EdgeHandle } from "../../EdgeHandle.js";
6
+ import { useZoomLevel } from "../zoomPlugin/ZoomContext.js";
7
+ import { useCropContext } from "./CropContext.js";
8
+ import { getLocalizedString } from "../../../../i18n.js";
9
+
10
+ /** Canvas-area overlay for the crop tool. Reads all state from CropContext. */
11
+ export function CropOverlay() {
12
+ let {
13
+ imageUrl,
14
+ activeCorners,
15
+ mode,
16
+ hasSelection,
17
+ scale,
18
+ displaySize,
19
+ canvasRef,
20
+ cvReady,
21
+ cvError,
22
+ cropping,
23
+ error,
24
+ handleCanvasReady,
25
+ updateCorner,
26
+ startRectDraw,
27
+ updateRectDraw,
28
+ finishRectDraw,
29
+ } = useCropContext();
30
+
31
+ let zoom = useZoomLevel();
32
+ let showHandles = mode === "corners" && displaySize.width > 0;
33
+
34
+ function pointerPosition(e: React.PointerEvent<HTMLDivElement>) {
35
+ // getBoundingClientRect() is screen-space (affected by the zoom transform),
36
+ // so divide by zoom to get back to the CSS-pixel space the tool expects.
37
+ let rect = e.currentTarget.getBoundingClientRect();
38
+ return { x: (e.clientX - rect.left) / zoom, y: (e.clientY - rect.top) / zoom };
39
+ }
40
+
41
+ function onPointerDown(e: React.PointerEvent<HTMLDivElement>) {
42
+ e.currentTarget.setPointerCapture(e.pointerId);
43
+ let { x, y } = pointerPosition(e);
44
+ startRectDraw(x, y);
45
+ }
46
+
47
+ function onPointerMove(e: React.PointerEvent<HTMLDivElement>) {
48
+ if (!(e.buttons & 1)) return;
49
+ let { x, y } = pointerPosition(e);
50
+ updateRectDraw(x, y);
51
+ }
52
+
53
+ return (
54
+ <div className="crop-root">
55
+ <div className="crop-inner">
56
+ <CropCanvas ref={canvasRef} imageUrl={imageUrl} corners={activeCorners} onReady={handleCanvasReady} />
57
+
58
+ {mode === "rect" && displaySize.width > 0 && (
59
+ <div
60
+ role="application"
61
+ aria-label={getLocalizedString("Drag to draw a rectangle to crop to")}
62
+ className="crop-draw-surface"
63
+ onPointerDown={onPointerDown}
64
+ onPointerMove={onPointerMove}
65
+ onPointerUp={finishRectDraw}
66
+ onPointerCancel={finishRectDraw}
67
+ />
68
+ )}
69
+
70
+ {showHandles &&
71
+ activeCorners.map((corner, i) => (
72
+ <DragHandle
73
+ key={i}
74
+ x={corner.x * scale}
75
+ y={corner.y * scale}
76
+ onChange={(x, y) => updateCorner(i, x, y)}
77
+ containerWidth={displaySize.width}
78
+ containerHeight={displaySize.height}
79
+ />
80
+ ))}
81
+
82
+ {showHandles &&
83
+ (() => {
84
+ let [tl, tr, br, bl] = activeCorners;
85
+ let s = scale;
86
+ return (
87
+ <>
88
+ {/* Top edge — moves TL (0) and TR (1) */}
89
+ <EdgeHandle
90
+ x={((tl.x + tr.x) / 2) * s}
91
+ y={((tl.y + tr.y) / 2) * s}
92
+ axis="y"
93
+ onChange={(dx, dy) => {
94
+ updateCorner(0, tl.x * s + dx, tl.y * s + dy);
95
+ updateCorner(1, tr.x * s + dx, tr.y * s + dy);
96
+ }}
97
+ />
98
+ {/* Right edge — moves TR (1) and BR (2) */}
99
+ <EdgeHandle
100
+ x={((tr.x + br.x) / 2) * s}
101
+ y={((tr.y + br.y) / 2) * s}
102
+ axis="x"
103
+ onChange={(dx, dy) => {
104
+ updateCorner(1, tr.x * s + dx, tr.y * s + dy);
105
+ updateCorner(2, br.x * s + dx, br.y * s + dy);
106
+ }}
107
+ />
108
+ {/* Bottom edge — moves BR (2) and BL (3) */}
109
+ <EdgeHandle
110
+ x={((br.x + bl.x) / 2) * s}
111
+ y={((br.y + bl.y) / 2) * s}
112
+ axis="y"
113
+ onChange={(dx, dy) => {
114
+ updateCorner(2, br.x * s + dx, br.y * s + dy);
115
+ updateCorner(3, bl.x * s + dx, bl.y * s + dy);
116
+ }}
117
+ />
118
+ {/* Left edge — moves BL (3) and TL (0) */}
119
+ <EdgeHandle
120
+ x={((bl.x + tl.x) / 2) * s}
121
+ y={((bl.y + tl.y) / 2) * s}
122
+ axis="x"
123
+ onChange={(dx, dy) => {
124
+ updateCorner(3, bl.x * s + dx, bl.y * s + dy);
125
+ updateCorner(0, tl.x * s + dx, tl.y * s + dy);
126
+ }}
127
+ />
128
+ </>
129
+ );
130
+ })()}
131
+ </div>
132
+
133
+ {/* Status line. OpenCV only powers the border suggestion, so a load failure is
134
+ informational — cropping stays available either way. */}
135
+ {cropping ? (
136
+ <div className="crop-loading">
137
+ <Spinner aria-hidden data-size="xs" />
138
+ </div>
139
+ ) : error ? (
140
+ <div className="crop-loading">
141
+ <Paragraph data-size="sm">{error}</Paragraph>
142
+ </div>
143
+ ) : mode === "rect" ? (
144
+ <div className="crop-loading">
145
+ <Paragraph data-size="sm">
146
+ {hasSelection
147
+ ? getLocalizedString("Release to use this rectangle")
148
+ : getLocalizedString("Drag to draw a rectangle to crop to")}
149
+ </Paragraph>
150
+ </div>
151
+ ) : !cvReady && !cvError ? (
152
+ <div className="crop-loading">
153
+ <Spinner aria-hidden data-size="xs" />
154
+ <Paragraph data-size="sm">{getLocalizedString("Detecting borders…")}</Paragraph>
155
+ </div>
156
+ ) : cvError ? (
157
+ <div className="crop-loading">
158
+ <Paragraph data-size="sm">
159
+ {getLocalizedString("Automatic border detection is unavailable. Adjust the selection manually.")}
160
+ </Paragraph>
161
+ </div>
162
+ ) : null}
163
+ </div>
164
+ );
165
+ }
@@ -1,48 +1,48 @@
1
- import { Button, Spinner } from "@digdir/designsystemet-react";
2
- import { CheckmarkIcon, ExpandIcon, SquareIcon, XMarkIcon } from "@navikt/aksel-icons";
3
- import { getLocalizedString } from "@olenbetong/appframe-core";
4
-
5
- import { useCropContext } from "./CropContext.js";
6
-
7
- /** Toolbar shown while the crop tool is active. Reads state from CropContext. */
8
- export function CropToolbar() {
9
- let { applyCrop, cropping, mode, hasSelection, startRectMode, cancelRectMode, onApply, onCancel } = useCropContext();
10
- let inRectMode = mode === "rect";
11
-
12
- async function handleApply() {
13
- let result = await applyCrop();
14
- if (result) onApply(result.blob, result.actions);
15
- }
16
-
17
- return (
18
- <>
19
- <div className="image-editor__toolbar-group">
20
- <Button variant="tertiary" data-size="sm" onClick={onCancel} disabled={cropping}>
21
- <XMarkIcon aria-hidden />
22
- {getLocalizedString("Cancel")}
23
- </Button>
24
- </div>
25
- <div className="image-editor__toolbar-group">
26
- <Button
27
- variant="tertiary"
28
- data-size="sm"
29
- aria-pressed={inRectMode}
30
- onClick={inRectMode ? cancelRectMode : startRectMode}
31
- disabled={cropping}
32
- >
33
- {inRectMode ? <ExpandIcon aria-hidden /> : <SquareIcon aria-hidden />}
34
- {inRectMode ? getLocalizedString("Adjust corners") : getLocalizedString("Draw rectangle")}
35
- </Button>
36
- <Button
37
- variant="primary"
38
- data-size="sm"
39
- onClick={handleApply}
40
- disabled={cropping || inRectMode || !hasSelection}
41
- >
42
- {cropping ? <Spinner aria-hidden data-size="xs" /> : <CheckmarkIcon aria-hidden />}
43
- {getLocalizedString("Apply crop")}
44
- </Button>
45
- </div>
46
- </>
47
- );
48
- }
1
+ import { Button, Spinner } from "@digdir/designsystemet-react";
2
+ import { CheckmarkIcon, ExpandIcon, SquareIcon, XMarkIcon } from "@navikt/aksel-icons";
3
+
4
+ import { useCropContext } from "./CropContext.js";
5
+ import { getLocalizedString } from "../../../../i18n.js";
6
+
7
+ /** Toolbar shown while the crop tool is active. Reads state from CropContext. */
8
+ export function CropToolbar() {
9
+ let { applyCrop, cropping, mode, hasSelection, startRectMode, cancelRectMode, onApply, onCancel } = useCropContext();
10
+ let inRectMode = mode === "rect";
11
+
12
+ async function handleApply() {
13
+ let result = await applyCrop();
14
+ if (result) onApply(result.blob, result.actions);
15
+ }
16
+
17
+ return (
18
+ <>
19
+ <div className="image-editor__toolbar-group">
20
+ <Button variant="tertiary" data-size="sm" onClick={onCancel} disabled={cropping}>
21
+ <XMarkIcon aria-hidden />
22
+ {getLocalizedString("Cancel")}
23
+ </Button>
24
+ </div>
25
+ <div className="image-editor__toolbar-group">
26
+ <Button
27
+ variant="tertiary"
28
+ data-size="sm"
29
+ aria-pressed={inRectMode}
30
+ onClick={inRectMode ? cancelRectMode : startRectMode}
31
+ disabled={cropping}
32
+ >
33
+ {inRectMode ? <ExpandIcon aria-hidden /> : <SquareIcon aria-hidden />}
34
+ {inRectMode ? getLocalizedString("Adjust corners") : getLocalizedString("Draw rectangle")}
35
+ </Button>
36
+ <Button
37
+ variant="primary"
38
+ data-size="sm"
39
+ onClick={handleApply}
40
+ disabled={cropping || inRectMode || !hasSelection}
41
+ >
42
+ {cropping ? <Spinner aria-hidden data-size="xs" /> : <CheckmarkIcon aria-hidden />}
43
+ {getLocalizedString("Apply crop")}
44
+ </Button>
45
+ </div>
46
+ </>
47
+ );
48
+ }