@olenbetong/synergi-react 2.5.7 → 2.7.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/es/components/AppMenu/AppMenu.css +455 -92
- package/es/components/AppMenu/AppMenu.d.ts +47 -0
- package/es/components/AppMenu/AppMenu.js +223 -0
- package/es/components/AppMenu/AppMenuToggle.d.ts +15 -0
- package/es/components/AppMenu/AppMenuToggle.js +14 -0
- package/es/components/AppMenu/AppMenuUserMenu.d.ts +32 -0
- package/es/components/AppMenu/AppMenuUserMenu.js +110 -0
- package/es/components/AppMenu/developerCategories.d.ts +24 -0
- package/es/components/AppMenu/developerCategories.js +116 -0
- package/es/components/AppMenu/index.d.ts +6 -12
- package/es/components/AppMenu/index.js +5 -85
- package/es/components/AppMenu/types.d.ts +33 -0
- package/es/components/AppMenu/types.js +1 -0
- package/es/components/AppMenu/useRovingTabIndex.d.ts +24 -0
- package/es/components/AppMenu/useRovingTabIndex.js +103 -0
- package/es/components/AppMenu/useServiceWorkerUpdate.d.ts +16 -0
- package/es/components/AppMenu/useServiceWorkerUpdate.js +62 -0
- package/es/components/AppShell/index.js +107 -13
- package/es/components/ImageEditor/ImageEditor.css +22 -11
- package/es/components/ImageEditor/ImageEditor.js +12 -12
- package/es/components/ImageEditor/ResponsiveButton.d.ts +1 -1
- package/es/components/ImageEditor/ResponsiveButton.js +5 -5
- package/es/components/ImageEditor/plugins/cropPlugin/CropOverlay.js +2 -2
- package/es/components/ImageEditor/plugins/cropPlugin/CropToolbar.js +3 -4
- package/es/components/ImageEditor/plugins/cropPlugin/index.js +2 -2
- package/es/components/ImageEditor/plugins/redactPlugin/RedactToolbar.js +3 -5
- package/es/components/ImageEditor/plugins/redactPlugin/index.js +2 -2
- package/es/components/ImageEditor/plugins/rotatePlugin.js +1 -2
- package/es/components/ImageEditor/plugins/zoomPlugin/ZoomControls.js +2 -4
- package/es/components/ImageEditor/useIsSmall.d.ts +5 -0
- package/es/components/ImageEditor/useIsSmall.js +21 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/package.json +5 -1
- package/src/colorScheme.ts +81 -0
- package/src/components/AppMenu/AppMenu.css +648 -158
- package/src/components/AppMenu/AppMenu.tsx +285 -0
- package/src/components/AppMenu/AppMenuColorScheme.tsx +41 -0
- package/src/components/AppMenu/AppMenuFavoriteButton.tsx +47 -0
- package/src/components/AppMenu/AppMenuHeader.tsx +79 -0
- package/src/components/AppMenu/AppMenuList.tsx +89 -0
- package/src/components/AppMenu/AppMenuRail.tsx +117 -0
- package/src/components/AppMenu/AppMenuToggle.tsx +51 -0
- package/src/components/AppMenu/AppMenuUserMenu.tsx +190 -0
- package/src/components/AppMenu/developerCategories.ts +142 -0
- package/src/components/AppMenu/icons.tsx +76 -0
- package/src/components/AppMenu/index.ts +17 -0
- package/src/components/AppMenu/menuEntries.ts +128 -0
- package/src/components/AppMenu/types.ts +45 -0
- package/src/components/AppMenu/useFavorites.ts +40 -0
- package/src/components/AppMenu/useRovingTabIndex.ts +130 -0
- package/src/components/AppMenu/useServiceWorkerUpdate.ts +68 -0
- package/src/components/AppShell/index.tsx +287 -133
- package/src/components/ImageEditor/ImageEditor.css +22 -11
- package/src/components/ImageEditor/ImageEditor.tsx +38 -40
- package/src/components/ImageEditor/ResponsiveButton.tsx +8 -10
- package/src/components/ImageEditor/plugins/cropPlugin/CropOverlay.tsx +6 -6
- package/src/components/ImageEditor/plugins/cropPlugin/CropToolbar.tsx +6 -10
- package/src/components/ImageEditor/plugins/cropPlugin/index.ts +2 -2
- package/src/components/ImageEditor/plugins/redactPlugin/RedactToolbar.tsx +8 -17
- package/src/components/ImageEditor/plugins/redactPlugin/index.ts +2 -2
- package/src/components/ImageEditor/plugins/rotatePlugin.ts +1 -2
- package/src/components/ImageEditor/plugins/zoomPlugin/ZoomControls.tsx +4 -6
- package/src/components/ImageEditor/useIsSmall.ts +27 -0
- package/src/components/LinkedCardList/index.scss +93 -93
- package/src/components/ProgressBar/index.scss +94 -94
- package/src/index.ts +61 -37
- package/src/components/AppMenu/index.tsx +0 -179
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
height: 100%;
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/* The root carries data-color-scheme="dark": the editor chrome is always dark
|
|
6
|
+
so the image stays the focus, and Designsystemet components inside pick up
|
|
7
|
+
matching dark tokens. */
|
|
8
|
+
background: var(--ds-color-neutral-background-default, #111);
|
|
9
|
+
color: var(--ds-color-neutral-text-default, white);
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
.image-editor__topbar {
|
|
@@ -12,8 +15,8 @@
|
|
|
12
15
|
justify-content: space-between;
|
|
13
16
|
gap: 1rem;
|
|
14
17
|
padding: 0.5rem 1rem;
|
|
15
|
-
background: rgba(0, 0, 0, 0.4);
|
|
16
|
-
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
|
18
|
+
background: var(--ds-color-neutral-background-tinted, rgba(0, 0, 0, 0.4));
|
|
19
|
+
border-bottom: 1px solid var(--ds-color-neutral-border-subtle, rgba(255, 255, 255, 0.08));
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
.image-editor__canvas {
|
|
@@ -32,11 +35,19 @@
|
|
|
32
35
|
align-items: center;
|
|
33
36
|
justify-content: center;
|
|
34
37
|
background: rgba(0, 0, 0, 0.4);
|
|
35
|
-
color: white;
|
|
38
|
+
color: var(--ds-color-neutral-text-default, white);
|
|
36
39
|
z-index: 10;
|
|
37
40
|
border-radius: 4px;
|
|
38
41
|
}
|
|
39
42
|
|
|
43
|
+
.image-editor__done {
|
|
44
|
+
position: absolute;
|
|
45
|
+
bottom: 1rem;
|
|
46
|
+
right: 1rem;
|
|
47
|
+
z-index: 5;
|
|
48
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
|
|
49
|
+
}
|
|
50
|
+
|
|
40
51
|
.image-editor__img {
|
|
41
52
|
max-width: 100%;
|
|
42
53
|
max-height: calc(100dvh - 160px); /* fallback when not inside zoom-canvas */
|
|
@@ -52,8 +63,8 @@
|
|
|
52
63
|
align-items: center;
|
|
53
64
|
justify-content: space-between;
|
|
54
65
|
padding: 0.75rem 1rem;
|
|
55
|
-
background: #1a1a1a;
|
|
56
|
-
border-top: 1px solid rgba(255, 255, 255, 0.08);
|
|
66
|
+
background: var(--ds-color-neutral-background-tinted, #1a1a1a);
|
|
67
|
+
border-top: 1px solid var(--ds-color-neutral-border-subtle, rgba(255, 255, 255, 0.08));
|
|
57
68
|
}
|
|
58
69
|
|
|
59
70
|
.image-editor__toolbar-group {
|
|
@@ -66,13 +77,13 @@
|
|
|
66
77
|
.image-editor__topbar-divider {
|
|
67
78
|
width: 1px;
|
|
68
79
|
height: 1.5rem;
|
|
69
|
-
background: rgba(255, 255, 255, 0.15);
|
|
80
|
+
background: var(--ds-color-neutral-border-subtle, rgba(255, 255, 255, 0.15));
|
|
70
81
|
flex-shrink: 0;
|
|
71
82
|
}
|
|
72
83
|
|
|
73
84
|
.image-editor__zoom-level {
|
|
74
85
|
font-size: 0.8125rem;
|
|
75
|
-
color: rgba(255, 255, 255, 0.6);
|
|
86
|
+
color: var(--ds-color-neutral-text-subtle, rgba(255, 255, 255, 0.6));
|
|
76
87
|
min-width: 3.25ch;
|
|
77
88
|
text-align: center;
|
|
78
89
|
font-variant-numeric: tabular-nums;
|
|
@@ -146,7 +157,7 @@
|
|
|
146
157
|
so they're never clipped at the edges. */
|
|
147
158
|
padding: 16px;
|
|
148
159
|
box-sizing: border-box;
|
|
149
|
-
background: #111;
|
|
160
|
+
background: var(--ds-color-neutral-background-default, #111);
|
|
150
161
|
touch-action: none;
|
|
151
162
|
}
|
|
152
163
|
|
|
@@ -207,7 +218,7 @@
|
|
|
207
218
|
justify-content: center;
|
|
208
219
|
gap: 0.75rem;
|
|
209
220
|
padding: 0.75rem 1rem;
|
|
210
|
-
color: rgba(255, 255, 255, 0.7);
|
|
221
|
+
color: var(--ds-color-neutral-text-subtle, rgba(255, 255, 255, 0.7));
|
|
211
222
|
position: absolute;
|
|
212
223
|
inset: auto 0 0 0;
|
|
213
224
|
background: linear-gradient(0deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import RedoIcon from "@mui/icons-material/Redo";
|
|
4
|
-
import RestartAltIcon from "@mui/icons-material/RestartAlt";
|
|
5
|
-
import UndoIcon from "@mui/icons-material/Undo";
|
|
6
|
-
import { Button, CircularProgress, Fab, IconButton, Tooltip, useMediaQuery } from "@mui/material";
|
|
1
|
+
import { Button, Spinner, Tooltip } from "@digdir/designsystemet-react";
|
|
2
|
+
import { ArrowCirclepathIcon, ArrowLeftIcon, ArrowRedoIcon, ArrowUndoIcon, CheckmarkIcon } from "@navikt/aksel-icons";
|
|
7
3
|
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
8
4
|
import { forwardRef, useImperativeHandle, useMemo, useState } from "react";
|
|
9
5
|
|
|
@@ -12,6 +8,7 @@ import { ResponsiveButton } from "./ResponsiveButton.js";
|
|
|
12
8
|
import type { ActionPlugin, ActionRegistry, EditAction, Plugin, ToolPlugin, ViewPlugin } from "./types.js";
|
|
13
9
|
import { useActiveTool } from "./useActiveTool.js";
|
|
14
10
|
import { useImageHistory } from "./useImageHistory.js";
|
|
11
|
+
import { useIsSmall } from "./useIsSmall.js";
|
|
15
12
|
|
|
16
13
|
export type ImageEditorRef = {
|
|
17
14
|
/** Returns the current edited blob, or null if no edits have been applied since the last source image. */
|
|
@@ -44,7 +41,7 @@ export const ImageEditor = forwardRef<ImageEditorRef, Props>(function ImageEdito
|
|
|
44
41
|
let { activePlugin, activateTool, deactivateTool } = useActiveTool(plugins);
|
|
45
42
|
let [busy, setBusy] = useState(false);
|
|
46
43
|
let disabled = busy || history.replaying;
|
|
47
|
-
let isSmall =
|
|
44
|
+
let isSmall = useIsSmall();
|
|
48
45
|
|
|
49
46
|
useImperativeHandle(ref, () => ({
|
|
50
47
|
getCurrentBlob: () => history.currentBlob,
|
|
@@ -81,14 +78,14 @@ export const ImageEditor = forwardRef<ImageEditorRef, Props>(function ImageEdito
|
|
|
81
78
|
let TopBarControls = viewPlugin?.TopBarControls;
|
|
82
79
|
|
|
83
80
|
let inner = (
|
|
84
|
-
<div className="image-editor">
|
|
81
|
+
<div className="image-editor" data-color-scheme="dark">
|
|
85
82
|
{/* Top toolbar — always visible; undo/redo/reset disabled while a tool is active */}
|
|
86
83
|
<div className="image-editor__topbar">
|
|
87
84
|
<div className="image-editor__toolbar-group">
|
|
88
85
|
{onCancel && (
|
|
89
86
|
<>
|
|
90
87
|
<ResponsiveButton
|
|
91
|
-
icon={<
|
|
88
|
+
icon={<ArrowLeftIcon aria-hidden />}
|
|
92
89
|
label={getLocalizedString("Back")}
|
|
93
90
|
onClick={onCancel}
|
|
94
91
|
isSmall={isSmall}
|
|
@@ -97,21 +94,21 @@ export const ImageEditor = forwardRef<ImageEditorRef, Props>(function ImageEdito
|
|
|
97
94
|
</>
|
|
98
95
|
)}
|
|
99
96
|
<ResponsiveButton
|
|
100
|
-
icon={<
|
|
97
|
+
icon={<ArrowUndoIcon aria-hidden />}
|
|
101
98
|
label={getLocalizedString("Undo")}
|
|
102
99
|
onClick={history.undo}
|
|
103
100
|
disabled={disabled || !history.canUndo || !!activePlugin}
|
|
104
101
|
isSmall={isSmall}
|
|
105
102
|
/>
|
|
106
103
|
<ResponsiveButton
|
|
107
|
-
icon={<
|
|
104
|
+
icon={<ArrowRedoIcon aria-hidden />}
|
|
108
105
|
label={getLocalizedString("Redo")}
|
|
109
106
|
onClick={history.redo}
|
|
110
107
|
disabled={disabled || !history.canRedo || !!activePlugin}
|
|
111
108
|
isSmall={isSmall}
|
|
112
109
|
/>
|
|
113
110
|
<ResponsiveButton
|
|
114
|
-
icon={<
|
|
111
|
+
icon={<ArrowCirclepathIcon aria-hidden />}
|
|
115
112
|
label={getLocalizedString("Reset")}
|
|
116
113
|
onClick={history.reset}
|
|
117
114
|
disabled={disabled || !history.canUndo || !!activePlugin}
|
|
@@ -148,22 +145,23 @@ export const ImageEditor = forwardRef<ImageEditorRef, Props>(function ImageEdito
|
|
|
148
145
|
|
|
149
146
|
{/* Done button floats over the canvas, bottom-right — hidden when a tool is active or no onConfirm */}
|
|
150
147
|
{!activePlugin && onConfirm && (
|
|
151
|
-
<
|
|
152
|
-
|
|
153
|
-
variant=
|
|
148
|
+
<Button
|
|
149
|
+
className="image-editor__done"
|
|
150
|
+
variant="primary"
|
|
151
|
+
icon={isSmall}
|
|
152
|
+
aria-label={isSmall ? getLocalizedString("Done") : undefined}
|
|
154
153
|
onClick={confirm}
|
|
155
154
|
disabled={disabled}
|
|
156
|
-
sx={{ position: "absolute", bottom: "1rem", right: "1rem", zIndex: 5 }}
|
|
157
155
|
>
|
|
158
|
-
<
|
|
156
|
+
<CheckmarkIcon aria-hidden />
|
|
159
157
|
{!isSmall && getLocalizedString("Done")}
|
|
160
|
-
</
|
|
158
|
+
</Button>
|
|
161
159
|
)}
|
|
162
160
|
|
|
163
161
|
{/* Replay overlay covers the canvas and sits above the Done button */}
|
|
164
162
|
{history.replaying && (
|
|
165
163
|
<div className="image-editor__replay-overlay">
|
|
166
|
-
<
|
|
164
|
+
<Spinner aria-label={getLocalizedString("Loading")} />
|
|
167
165
|
</div>
|
|
168
166
|
)}
|
|
169
167
|
</div>
|
|
@@ -230,20 +228,22 @@ function ToolButton({
|
|
|
230
228
|
isSmall: boolean;
|
|
231
229
|
}) {
|
|
232
230
|
let Icon = plugin.Icon;
|
|
231
|
+
let label = getLocalizedString(plugin.label);
|
|
232
|
+
|
|
233
233
|
if (isSmall) {
|
|
234
234
|
return (
|
|
235
|
-
<Tooltip
|
|
236
|
-
<
|
|
237
|
-
<
|
|
238
|
-
|
|
239
|
-
</IconButton>
|
|
240
|
-
</span>
|
|
235
|
+
<Tooltip content={label}>
|
|
236
|
+
<Button icon variant="tertiary" data-size="sm" aria-label={label} onClick={onActivate} disabled={busy}>
|
|
237
|
+
<Icon />
|
|
238
|
+
</Button>
|
|
241
239
|
</Tooltip>
|
|
242
240
|
);
|
|
243
241
|
}
|
|
242
|
+
|
|
244
243
|
return (
|
|
245
|
-
<Button
|
|
246
|
-
|
|
244
|
+
<Button variant="secondary" data-size="sm" onClick={onActivate} disabled={busy}>
|
|
245
|
+
<Icon />
|
|
246
|
+
{label}
|
|
247
247
|
</Button>
|
|
248
248
|
);
|
|
249
249
|
}
|
|
@@ -260,25 +260,23 @@ function ActionButton({
|
|
|
260
260
|
isSmall: boolean;
|
|
261
261
|
}) {
|
|
262
262
|
let Icon = plugin.Icon;
|
|
263
|
+
let label = getLocalizedString(plugin.label);
|
|
264
|
+
let icon = busy ? <Spinner aria-hidden data-size="xs" /> : <Icon />;
|
|
265
|
+
|
|
263
266
|
if (isSmall) {
|
|
264
267
|
return (
|
|
265
|
-
<Tooltip
|
|
266
|
-
<
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
</IconButton>
|
|
270
|
-
</span>
|
|
268
|
+
<Tooltip content={label}>
|
|
269
|
+
<Button icon variant="tertiary" data-size="sm" aria-label={label} onClick={onExecute} disabled={busy}>
|
|
270
|
+
{icon}
|
|
271
|
+
</Button>
|
|
271
272
|
</Tooltip>
|
|
272
273
|
);
|
|
273
274
|
}
|
|
275
|
+
|
|
274
276
|
return (
|
|
275
|
-
<Button
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
disabled={busy}
|
|
279
|
-
color="inherit"
|
|
280
|
-
>
|
|
281
|
-
{getLocalizedString(plugin.label)}
|
|
277
|
+
<Button variant="tertiary" data-size="sm" onClick={onExecute} disabled={busy}>
|
|
278
|
+
{icon}
|
|
279
|
+
{label}
|
|
282
280
|
</Button>
|
|
283
281
|
);
|
|
284
282
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button,
|
|
1
|
+
import { Button, Tooltip } from "@digdir/designsystemet-react";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
@@ -9,23 +9,21 @@ interface Props {
|
|
|
9
9
|
isSmall: boolean;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
/** Renders a labelled
|
|
12
|
+
/** Renders a labelled button on large screens and a tooltipped icon button on small ones. */
|
|
13
13
|
export function ResponsiveButton({ icon, label, onClick, disabled, isSmall }: Props) {
|
|
14
14
|
if (isSmall) {
|
|
15
15
|
return (
|
|
16
|
-
<Tooltip
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
{icon}
|
|
21
|
-
</IconButton>
|
|
22
|
-
</span>
|
|
16
|
+
<Tooltip content={label}>
|
|
17
|
+
<Button icon variant="tertiary" data-size="sm" aria-label={label} onClick={onClick} disabled={disabled}>
|
|
18
|
+
{icon}
|
|
19
|
+
</Button>
|
|
23
20
|
</Tooltip>
|
|
24
21
|
);
|
|
25
22
|
}
|
|
26
23
|
|
|
27
24
|
return (
|
|
28
|
-
<Button
|
|
25
|
+
<Button variant="tertiary" data-size="sm" onClick={onClick} disabled={disabled}>
|
|
26
|
+
{icon}
|
|
29
27
|
{label}
|
|
30
28
|
</Button>
|
|
31
29
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Alert,
|
|
1
|
+
import { Alert, Paragraph, Spinner } from "@digdir/designsystemet-react";
|
|
2
2
|
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
3
3
|
|
|
4
4
|
import { CropCanvas } from "../../CropCanvas.js";
|
|
@@ -92,13 +92,13 @@ export function CropOverlay() {
|
|
|
92
92
|
|
|
93
93
|
{!cvReady && !cvError && (
|
|
94
94
|
<div className="crop-loading">
|
|
95
|
-
<
|
|
96
|
-
<
|
|
95
|
+
<Spinner aria-hidden data-size="xs" />
|
|
96
|
+
<Paragraph data-size="sm">{getLocalizedString("Loading OpenCV…")}</Paragraph>
|
|
97
97
|
</div>
|
|
98
98
|
)}
|
|
99
99
|
{cvError && (
|
|
100
100
|
<div className="crop-loading">
|
|
101
|
-
<Alert
|
|
101
|
+
<Alert data-color="danger" data-size="sm">
|
|
102
102
|
{getLocalizedString("Crop tool failed to load")}
|
|
103
103
|
</Alert>
|
|
104
104
|
</div>
|
|
@@ -106,9 +106,9 @@ export function CropOverlay() {
|
|
|
106
106
|
{(error || cropping) && (
|
|
107
107
|
<div className="crop-loading">
|
|
108
108
|
{cropping ? (
|
|
109
|
-
<
|
|
109
|
+
<Spinner aria-hidden data-size="xs" />
|
|
110
110
|
) : (
|
|
111
|
-
<Alert
|
|
111
|
+
<Alert data-color="danger" data-size="sm">
|
|
112
112
|
{error}
|
|
113
113
|
</Alert>
|
|
114
114
|
)}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { Button, CircularProgress } from "@mui/material";
|
|
1
|
+
import { Button, Spinner } from "@digdir/designsystemet-react";
|
|
2
|
+
import { CheckmarkIcon, XMarkIcon } from "@navikt/aksel-icons";
|
|
4
3
|
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
5
4
|
|
|
6
5
|
import { useCropContext } from "./CropContext.js";
|
|
@@ -17,17 +16,14 @@ export function CropToolbar() {
|
|
|
17
16
|
return (
|
|
18
17
|
<>
|
|
19
18
|
<div className="image-editor__toolbar-group">
|
|
20
|
-
<Button
|
|
19
|
+
<Button variant="tertiary" data-size="sm" onClick={onCancel} disabled={cropping}>
|
|
20
|
+
<XMarkIcon aria-hidden />
|
|
21
21
|
{getLocalizedString("Cancel")}
|
|
22
22
|
</Button>
|
|
23
23
|
</div>
|
|
24
24
|
<div className="image-editor__toolbar-group">
|
|
25
|
-
<Button
|
|
26
|
-
|
|
27
|
-
startIcon={cropping ? <CircularProgress size={18} color="inherit" /> : <CheckIcon />}
|
|
28
|
-
onClick={handleApply}
|
|
29
|
-
disabled={cropping || !cvReady || !!cvError}
|
|
30
|
-
>
|
|
25
|
+
<Button variant="primary" data-size="sm" onClick={handleApply} disabled={cropping || !cvReady || !!cvError}>
|
|
26
|
+
{cropping ? <Spinner aria-hidden data-size="xs" /> : <CheckmarkIcon aria-hidden />}
|
|
31
27
|
{getLocalizedString("Apply crop")}
|
|
32
28
|
</Button>
|
|
33
29
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ExpandIcon } from "@navikt/aksel-icons";
|
|
2
2
|
|
|
3
3
|
import type { ToolPlugin } from "../../types.js";
|
|
4
4
|
import { CropProvider } from "./CropContext.js";
|
|
@@ -12,7 +12,7 @@ export const cropPlugin: ToolPlugin = {
|
|
|
12
12
|
type: "tool",
|
|
13
13
|
id: "crop",
|
|
14
14
|
label: "Crop",
|
|
15
|
-
Icon:
|
|
15
|
+
Icon: ExpandIcon,
|
|
16
16
|
Provider: CropProvider,
|
|
17
17
|
Overlay: CropOverlay,
|
|
18
18
|
Toolbar: CropToolbar,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import DeleteSweepIcon from "@mui/icons-material/DeleteSweep";
|
|
4
|
-
import { Button, CircularProgress } from "@mui/material";
|
|
1
|
+
import { Button, Spinner } from "@digdir/designsystemet-react";
|
|
2
|
+
import { CheckmarkIcon, EraserIcon, XMarkIcon } from "@navikt/aksel-icons";
|
|
5
3
|
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
6
4
|
import { useState } from "react";
|
|
7
5
|
|
|
@@ -29,25 +27,18 @@ export function RedactToolbar() {
|
|
|
29
27
|
return (
|
|
30
28
|
<>
|
|
31
29
|
<div className="image-editor__toolbar-group">
|
|
32
|
-
<Button
|
|
30
|
+
<Button variant="tertiary" data-size="sm" onClick={onCancel} disabled={applying}>
|
|
31
|
+
<XMarkIcon aria-hidden />
|
|
33
32
|
{getLocalizedString("Cancel")}
|
|
34
33
|
</Button>
|
|
35
|
-
<Button
|
|
36
|
-
|
|
37
|
-
onClick={clearAll}
|
|
38
|
-
color="inherit"
|
|
39
|
-
disabled={applying || rects.length === 0}
|
|
40
|
-
>
|
|
34
|
+
<Button variant="tertiary" data-size="sm" onClick={clearAll} disabled={applying || rects.length === 0}>
|
|
35
|
+
<EraserIcon aria-hidden />
|
|
41
36
|
{getLocalizedString("Clear all")}
|
|
42
37
|
</Button>
|
|
43
38
|
</div>
|
|
44
39
|
<div className="image-editor__toolbar-group">
|
|
45
|
-
<Button
|
|
46
|
-
|
|
47
|
-
startIcon={applying ? <CircularProgress size={18} color="inherit" /> : <CheckIcon />}
|
|
48
|
-
onClick={handleApply}
|
|
49
|
-
disabled={applying}
|
|
50
|
-
>
|
|
40
|
+
<Button variant="primary" data-size="sm" onClick={handleApply} disabled={applying}>
|
|
41
|
+
{applying ? <Spinner aria-hidden data-size="xs" /> : <CheckmarkIcon aria-hidden />}
|
|
51
42
|
{rects.length === 0 ? getLocalizedString("Done") : getLocalizedString("Apply redact")}
|
|
52
43
|
</Button>
|
|
53
44
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { EyeObfuscatedIcon } from "@navikt/aksel-icons";
|
|
2
2
|
|
|
3
3
|
import type { ToolPlugin } from "../../types.js";
|
|
4
4
|
import { RedactProvider } from "./RedactContext.js";
|
|
@@ -12,7 +12,7 @@ export const redactPlugin: ToolPlugin = {
|
|
|
12
12
|
type: "tool",
|
|
13
13
|
id: "redact",
|
|
14
14
|
label: "Redact",
|
|
15
|
-
Icon:
|
|
15
|
+
Icon: EyeObfuscatedIcon,
|
|
16
16
|
Provider: RedactProvider,
|
|
17
17
|
Overlay: RedactOverlay,
|
|
18
18
|
Toolbar: RedactToolbar,
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import ZoomInMapIcon from "@mui/icons-material/ZoomInMap";
|
|
3
|
-
import ZoomOutIcon from "@mui/icons-material/ZoomOut";
|
|
1
|
+
import { ShrinkIcon, ZoomMinusIcon, ZoomPlusIcon } from "@navikt/aksel-icons";
|
|
4
2
|
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
5
3
|
import { ResponsiveButton } from "../../ResponsiveButton.js";
|
|
6
4
|
import { useZoom } from "./ZoomContext.js";
|
|
@@ -16,7 +14,7 @@ export function ZoomControls({ disabled, isSmall = false }: Props) {
|
|
|
16
14
|
return (
|
|
17
15
|
<>
|
|
18
16
|
<ResponsiveButton
|
|
19
|
-
icon={<
|
|
17
|
+
icon={<ZoomMinusIcon aria-hidden />}
|
|
20
18
|
label={getLocalizedString("Zoom out")}
|
|
21
19
|
onClick={zoomOut}
|
|
22
20
|
disabled={disabled || !canZoomOut}
|
|
@@ -24,7 +22,7 @@ export function ZoomControls({ disabled, isSmall = false }: Props) {
|
|
|
24
22
|
/>
|
|
25
23
|
<span className="image-editor__zoom-level">{Math.round(zoom * 100)}%</span>
|
|
26
24
|
<ResponsiveButton
|
|
27
|
-
icon={<
|
|
25
|
+
icon={<ZoomPlusIcon aria-hidden />}
|
|
28
26
|
label={getLocalizedString("Zoom in")}
|
|
29
27
|
onClick={zoomIn}
|
|
30
28
|
disabled={disabled || !canZoomIn}
|
|
@@ -32,7 +30,7 @@ export function ZoomControls({ disabled, isSmall = false }: Props) {
|
|
|
32
30
|
/>
|
|
33
31
|
{isZoomed && (
|
|
34
32
|
<ResponsiveButton
|
|
35
|
-
icon={<
|
|
33
|
+
icon={<ShrinkIcon aria-hidden />}
|
|
36
34
|
label={getLocalizedString("Reset zoom")}
|
|
37
35
|
onClick={resetZoom}
|
|
38
36
|
isSmall={isSmall}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
const SMALL_SCREEN_QUERY = "(max-width: 600px)";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Matches the breakpoint where the image editor collapses button labels into
|
|
7
|
+
* icon-only buttons.
|
|
8
|
+
*/
|
|
9
|
+
export function useIsSmall() {
|
|
10
|
+
let [isSmall, setIsSmall] = useState(() => globalThis.matchMedia?.(SMALL_SCREEN_QUERY).matches ?? false);
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
let media = globalThis.matchMedia?.(SMALL_SCREEN_QUERY);
|
|
14
|
+
if (!media) return;
|
|
15
|
+
|
|
16
|
+
function update() {
|
|
17
|
+
setIsSmall(media?.matches ?? false);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
update();
|
|
21
|
+
media.addEventListener("change", update);
|
|
22
|
+
|
|
23
|
+
return () => media.removeEventListener("change", update);
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
26
|
+
return isSmall;
|
|
27
|
+
}
|