@olenbetong/synergi-react 4.2.4 → 4.2.6

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 (56) hide show
  1. package/package.json +5 -5
  2. package/src/chrome/AppShell/index.tsx +29 -29
  3. package/src/chrome/openReport.ts +34 -34
  4. package/src/colorScheme.ts +81 -81
  5. package/src/components/DateNavigator/index.tsx +186 -186
  6. package/src/components/FilePond.tsx +312 -312
  7. package/src/components/ImageEditor/ImageEditor.tsx +348 -348
  8. package/src/components/ImageEditor/index.ts +9 -9
  9. package/src/components/ImageEditor/plugins/cropPlugin/CropOverlay.tsx +165 -165
  10. package/src/components/ImageEditor/plugins/cropPlugin/CropToolbar.tsx +48 -48
  11. package/src/components/ImageEditor/plugins/cropPlugin/useCropTool.ts +405 -405
  12. package/src/components/ImageEditor/plugins/redactPlugin/RedactToolbar.tsx +47 -47
  13. package/src/components/ImageEditor/plugins/zoomPlugin/ZoomContext.tsx +23 -23
  14. package/src/components/ImageEditor/plugins/zoomPlugin/ZoomControls.tsx +40 -40
  15. package/src/components/ImageEditor/useActiveTool.ts +21 -21
  16. package/src/components/ImageEditor/useEdgeDetection.ts +319 -319
  17. package/src/components/ImageEditor/useImageHistory.ts +197 -197
  18. package/src/components/ImageEditor/useOpenCV.ts +184 -184
  19. package/src/components/LinkedCardList/index.scss +95 -95
  20. package/src/components/MergeProgressDialog/index.tsx +249 -249
  21. package/src/components/PageBanner/index.tsx +80 -80
  22. package/src/components/PdfViewer/PdfViewer.tsx +158 -158
  23. package/src/components/ProgressBar/index.scss +96 -96
  24. package/src/components/SplitContainer/index.tsx +333 -333
  25. package/src/components/Toolbar/index.tsx +232 -232
  26. package/src/designsystemet-web-types.d.ts +24 -24
  27. package/src/elements/ElementDamage/DamageFormButtons.tsx +35 -35
  28. package/src/elements/ElementDamage/DescriptionInput.tsx +120 -120
  29. package/src/elements/ElementDamage/DuplicateDamage/DesktopView.tsx +82 -82
  30. package/src/elements/ElementDamage/DuplicateDamage/DublicateElementDamageDialog.tsx +67 -67
  31. package/src/elements/ElementDamage/DuplicateDamage/PhoneView.tsx +45 -45
  32. package/src/elements/ElementDamage/ElementNumberTextField.tsx +41 -41
  33. package/src/elements/ElementDamage/RegisterFix.tsx +100 -100
  34. package/src/elements/ElementDamage/SubmitButtons.tsx +40 -40
  35. package/src/elements/ElementDamage/TransportElementSelect.tsx +52 -52
  36. package/src/elements/ElementLookup.tsx +123 -123
  37. package/src/elements/ElementLookupDialog/BarcodeScanner/decoder.ts +32 -32
  38. package/src/elements/ElementLookupDialog/BarcodeScanner/decoders/dbr.ts +118 -118
  39. package/src/elements/ElementLookupDialog/BarcodeScanner/decoders/native.ts +103 -103
  40. package/src/elements/ElementLookupDialog/BarcodeScanner/decoders/zxing.ts +95 -95
  41. package/src/elements/ElementLookupDialog/BarcodeScanner/decoders.test.ts +118 -118
  42. package/src/elements/ElementLookupDialog/BarcodeScanner/duplicateFilter.ts +21 -21
  43. package/src/elements/ElementLookupDialog/BarcodeScanner/index.tsx +90 -90
  44. package/src/elements/ElementLookupDialog/BarcodeScanner/useScanner.ts +280 -280
  45. package/src/elements/ElementLookupDialog/HIDScanner/index.tsx +67 -67
  46. package/src/elements/ElementLookupDialog/Manual/ManualForm.tsx +141 -141
  47. package/src/elements/ElementLookupDialog/index.tsx +226 -226
  48. package/src/elements/ElementLookupDialog/utils/Giai.ts +209 -209
  49. package/src/elements/ProjectSelect.tsx +130 -130
  50. package/src/elements/index.ts +15 -15
  51. package/src/filter/index.ts +34 -34
  52. package/src/i18n.ts +13 -13
  53. package/src/index.ts +77 -77
  54. package/src/mui/MuiThemeProvider.tsx +174 -174
  55. package/src/mui/index.ts +1 -1
  56. package/src/test/setup.ts +8 -8
@@ -1,47 +1,47 @@
1
- import { Button, Spinner } from "@digdir/designsystemet-react";
2
- import { CheckmarkIcon, EraserIcon, XMarkIcon } from "@navikt/aksel-icons";
3
- import { useState } from "react";
4
-
5
- import { useRedactContext } from "./RedactContext.js";
6
- import { getLocalizedString } from "../../../../i18n.js";
7
-
8
- /** Toolbar shown while the redact tool is active. Reads state from RedactContext. */
9
- export function RedactToolbar() {
10
- let { rects, clearAll, applyRedact, onApply, onCancel } = useRedactContext();
11
- let [applying, setApplying] = useState(false);
12
-
13
- async function handleApply() {
14
- if (rects.length === 0) {
15
- onCancel();
16
- return;
17
- }
18
- setApplying(true);
19
- try {
20
- let result = await applyRedact();
21
- if (result) onApply(result.blob, result.actions);
22
- } finally {
23
- setApplying(false);
24
- }
25
- }
26
-
27
- return (
28
- <>
29
- <div className="image-editor__toolbar-group">
30
- <Button variant="tertiary" data-size="sm" onClick={onCancel} disabled={applying}>
31
- <XMarkIcon aria-hidden />
32
- {getLocalizedString("Cancel")}
33
- </Button>
34
- <Button variant="tertiary" data-size="sm" onClick={clearAll} disabled={applying || rects.length === 0}>
35
- <EraserIcon aria-hidden />
36
- {getLocalizedString("Clear all")}
37
- </Button>
38
- </div>
39
- <div className="image-editor__toolbar-group">
40
- <Button variant="primary" data-size="sm" onClick={handleApply} disabled={applying}>
41
- {applying ? <Spinner aria-hidden data-size="xs" /> : <CheckmarkIcon aria-hidden />}
42
- {rects.length === 0 ? getLocalizedString("Done") : getLocalizedString("Apply redact")}
43
- </Button>
44
- </div>
45
- </>
46
- );
47
- }
1
+ import { Button, Spinner } from "@digdir/designsystemet-react";
2
+ import { CheckmarkIcon, EraserIcon, XMarkIcon } from "@navikt/aksel-icons";
3
+ import { useState } from "react";
4
+
5
+ import { useRedactContext } from "./RedactContext.js";
6
+ import { getLocalizedString } from "../../../../i18n.js";
7
+
8
+ /** Toolbar shown while the redact tool is active. Reads state from RedactContext. */
9
+ export function RedactToolbar() {
10
+ let { rects, clearAll, applyRedact, onApply, onCancel } = useRedactContext();
11
+ let [applying, setApplying] = useState(false);
12
+
13
+ async function handleApply() {
14
+ if (rects.length === 0) {
15
+ onCancel();
16
+ return;
17
+ }
18
+ setApplying(true);
19
+ try {
20
+ let result = await applyRedact();
21
+ if (result) onApply(result.blob, result.actions);
22
+ } finally {
23
+ setApplying(false);
24
+ }
25
+ }
26
+
27
+ return (
28
+ <>
29
+ <div className="image-editor__toolbar-group">
30
+ <Button variant="tertiary" data-size="sm" onClick={onCancel} disabled={applying}>
31
+ <XMarkIcon aria-hidden />
32
+ {getLocalizedString("Cancel")}
33
+ </Button>
34
+ <Button variant="tertiary" data-size="sm" onClick={clearAll} disabled={applying || rects.length === 0}>
35
+ <EraserIcon aria-hidden />
36
+ {getLocalizedString("Clear all")}
37
+ </Button>
38
+ </div>
39
+ <div className="image-editor__toolbar-group">
40
+ <Button variant="primary" data-size="sm" onClick={handleApply} disabled={applying}>
41
+ {applying ? <Spinner aria-hidden data-size="xs" /> : <CheckmarkIcon aria-hidden />}
42
+ {rects.length === 0 ? getLocalizedString("Done") : getLocalizedString("Apply redact")}
43
+ </Button>
44
+ </div>
45
+ </>
46
+ );
47
+ }
@@ -1,23 +1,23 @@
1
- import { createContext, type ReactNode, use } from "react";
2
- import { useZoomPan, type ZoomPanResult } from "./useZoomPan.js";
3
-
4
- let ZoomContext = createContext<ZoomPanResult | null>(null);
5
-
6
- export function useZoom(): ZoomPanResult {
7
- let ctx = use(ZoomContext);
8
- if (!ctx) throw new Error("useZoom must be used within ZoomProvider");
9
- return ctx;
10
- }
11
-
12
- /**
13
- * Current zoom factor, or 1 when no ZoomProvider is present.
14
- * Lets tools convert screen-space coordinates to CSS pixels without requiring the zoom plugin.
15
- */
16
- export function useZoomLevel(): number {
17
- return use(ZoomContext)?.zoom ?? 1;
18
- }
19
-
20
- export function ZoomProvider({ children }: { children: ReactNode }) {
21
- let state = useZoomPan();
22
- return <ZoomContext value={state}>{children}</ZoomContext>;
23
- }
1
+ import { createContext, type ReactNode, use } from "react";
2
+ import { useZoomPan, type ZoomPanResult } from "./useZoomPan.js";
3
+
4
+ let ZoomContext = createContext<ZoomPanResult | null>(null);
5
+
6
+ export function useZoom(): ZoomPanResult {
7
+ let ctx = use(ZoomContext);
8
+ if (!ctx) throw new Error("useZoom must be used within ZoomProvider");
9
+ return ctx;
10
+ }
11
+
12
+ /**
13
+ * Current zoom factor, or 1 when no ZoomProvider is present.
14
+ * Lets tools convert screen-space coordinates to CSS pixels without requiring the zoom plugin.
15
+ */
16
+ export function useZoomLevel(): number {
17
+ return use(ZoomContext)?.zoom ?? 1;
18
+ }
19
+
20
+ export function ZoomProvider({ children }: { children: ReactNode }) {
21
+ let state = useZoomPan();
22
+ return <ZoomContext value={state}>{children}</ZoomContext>;
23
+ }
@@ -1,40 +1,40 @@
1
- import { ShrinkIcon, ZoomMinusIcon, ZoomPlusIcon } from "@navikt/aksel-icons";
2
- import { ResponsiveButton } from "../../ResponsiveButton.js";
3
- import { useZoom } from "./ZoomContext.js";
4
- import { getLocalizedString } from "../../../../i18n.js";
5
-
6
- interface Props {
7
- disabled?: boolean;
8
- isSmall?: boolean;
9
- }
10
-
11
- export function ZoomControls({ disabled, isSmall = false }: Props) {
12
- let { zoom, zoomIn, zoomOut, resetZoom, canZoomIn, canZoomOut, isZoomed } = useZoom();
13
-
14
- return (
15
- <>
16
- <ResponsiveButton
17
- icon={<ZoomMinusIcon aria-hidden />}
18
- label={getLocalizedString("Zoom out")}
19
- onClick={zoomOut}
20
- disabled={disabled || !canZoomOut}
21
- isSmall={isSmall}
22
- />
23
- <span className="image-editor__zoom-level">{Math.round(zoom * 100)}%</span>
24
- <ResponsiveButton
25
- icon={<ZoomPlusIcon aria-hidden />}
26
- label={getLocalizedString("Zoom in")}
27
- onClick={zoomIn}
28
- disabled={disabled || !canZoomIn}
29
- isSmall={isSmall}
30
- />
31
- <ResponsiveButton
32
- disabled={!isZoomed}
33
- icon={<ShrinkIcon aria-hidden />}
34
- label={getLocalizedString("Reset zoom")}
35
- onClick={resetZoom}
36
- isSmall={isSmall}
37
- />
38
- </>
39
- );
40
- }
1
+ import { ShrinkIcon, ZoomMinusIcon, ZoomPlusIcon } from "@navikt/aksel-icons";
2
+ import { ResponsiveButton } from "../../ResponsiveButton.js";
3
+ import { useZoom } from "./ZoomContext.js";
4
+ import { getLocalizedString } from "../../../../i18n.js";
5
+
6
+ interface Props {
7
+ disabled?: boolean;
8
+ isSmall?: boolean;
9
+ }
10
+
11
+ export function ZoomControls({ disabled, isSmall = false }: Props) {
12
+ let { zoom, zoomIn, zoomOut, resetZoom, canZoomIn, canZoomOut, isZoomed } = useZoom();
13
+
14
+ return (
15
+ <>
16
+ <ResponsiveButton
17
+ icon={<ZoomMinusIcon aria-hidden />}
18
+ label={getLocalizedString("Zoom out")}
19
+ onClick={zoomOut}
20
+ disabled={disabled || !canZoomOut}
21
+ isSmall={isSmall}
22
+ />
23
+ <span className="image-editor__zoom-level">{Math.round(zoom * 100)}%</span>
24
+ <ResponsiveButton
25
+ icon={<ZoomPlusIcon aria-hidden />}
26
+ label={getLocalizedString("Zoom in")}
27
+ onClick={zoomIn}
28
+ disabled={disabled || !canZoomIn}
29
+ isSmall={isSmall}
30
+ />
31
+ <ResponsiveButton
32
+ disabled={!isZoomed}
33
+ icon={<ShrinkIcon aria-hidden />}
34
+ label={getLocalizedString("Reset zoom")}
35
+ onClick={resetZoom}
36
+ isSmall={isSmall}
37
+ />
38
+ </>
39
+ );
40
+ }
@@ -1,21 +1,21 @@
1
- import { useState } from "react";
2
-
3
- import type { Plugin, ToolPlugin } from "./types.js";
4
-
5
- interface UseActiveToolResult {
6
- activePlugin: ToolPlugin | null;
7
- activateTool: (id: string) => void;
8
- deactivateTool: () => void;
9
- }
10
-
11
- /** Manages which tool plugin is currently active. `initialTool` names the tool to start in. */
12
- export function useActiveTool(plugins: Plugin[], initialTool: string | null = null): UseActiveToolResult {
13
- let [activeId, setActiveId] = useState<string | null>(initialTool);
14
- let activePlugin = (plugins.find((p) => p.type === "tool" && p.id === activeId) ?? null) as ToolPlugin | null;
15
-
16
- return {
17
- activePlugin,
18
- activateTool: setActiveId,
19
- deactivateTool: () => setActiveId(null),
20
- };
21
- }
1
+ import { useState } from "react";
2
+
3
+ import type { Plugin, ToolPlugin } from "./types.js";
4
+
5
+ interface UseActiveToolResult {
6
+ activePlugin: ToolPlugin | null;
7
+ activateTool: (id: string) => void;
8
+ deactivateTool: () => void;
9
+ }
10
+
11
+ /** Manages which tool plugin is currently active. `initialTool` names the tool to start in. */
12
+ export function useActiveTool(plugins: Plugin[], initialTool: string | null = null): UseActiveToolResult {
13
+ let [activeId, setActiveId] = useState<string | null>(initialTool);
14
+ let activePlugin = (plugins.find((p) => p.type === "tool" && p.id === activeId) ?? null) as ToolPlugin | null;
15
+
16
+ return {
17
+ activePlugin,
18
+ activateTool: setActiveId,
19
+ deactivateTool: () => setActiveId(null),
20
+ };
21
+ }