@olenbetong/synergi-react 4.3.1 → 5.0.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.
Files changed (81) hide show
  1. package/dist/styles/styles.css +1 -1
  2. package/dist/styles/styles.css.map +1 -1
  3. package/es/components/CodeEditor/CodeEditor.css +6 -6
  4. package/es/components/MergeProgressDialog/MergeProgressDialogDs.d.ts +7 -0
  5. package/es/components/MergeProgressDialog/MergeProgressDialogDs.js +20 -0
  6. package/es/components/MergeProgressDialog/index.d.ts +3 -8
  7. package/es/components/MergeProgressDialog/index.js +4 -133
  8. package/es/components/MergeProgressDialog/useMergeJob.d.ts +36 -0
  9. package/es/components/MergeProgressDialog/useMergeJob.js +141 -0
  10. package/es/components/ProgressBar/index.css +1 -1
  11. package/es/components/Toolbar/Toolbar.css +137 -137
  12. package/es/elements/ElementLookupDialog/BarcodeScanner/BarcodeScanner.css +81 -0
  13. package/es/elements/ElementLookupDialog/BarcodeScanner/DeadIcon.d.ts +2 -2
  14. package/es/elements/ElementLookupDialog/BarcodeScanner/DeadIcon.js +1 -2
  15. package/es/elements/ElementLookupDialog/BarcodeScanner/Error.js +3 -29
  16. package/es/elements/ElementLookupDialog/BarcodeScanner/index.d.ts +1 -0
  17. package/es/elements/ElementLookupDialog/BarcodeScanner/index.js +3 -28
  18. package/es/index.css +1 -1
  19. package/es/index.d.ts +2 -1
  20. package/es/index.js +2 -1
  21. package/es/mui/index.d.ts +1 -0
  22. package/es/mui/index.js +1 -0
  23. package/es/test/setup.d.ts +5 -0
  24. package/package.json +21 -14
  25. package/src/chrome/AppShell/index.tsx +29 -29
  26. package/src/chrome/openReport.ts +34 -34
  27. package/src/colorScheme.ts +125 -125
  28. package/src/components/CodeEditor/CodeEditor.css +6 -6
  29. package/src/components/CodeEditor/CodeEditor.tsx +173 -173
  30. package/src/components/CodeEditor/index.ts +1 -1
  31. package/src/components/DateNavigator/index.tsx +186 -186
  32. package/src/components/FilePond.tsx +312 -312
  33. package/src/components/ImageEditor/ImageEditor.tsx +348 -348
  34. package/src/components/ImageEditor/index.ts +9 -9
  35. package/src/components/ImageEditor/plugins/cropPlugin/CropOverlay.tsx +165 -165
  36. package/src/components/ImageEditor/plugins/cropPlugin/CropToolbar.tsx +48 -48
  37. package/src/components/ImageEditor/plugins/cropPlugin/useCropTool.ts +405 -405
  38. package/src/components/ImageEditor/plugins/redactPlugin/RedactToolbar.tsx +47 -47
  39. package/src/components/ImageEditor/plugins/zoomPlugin/ZoomContext.tsx +23 -23
  40. package/src/components/ImageEditor/plugins/zoomPlugin/ZoomControls.tsx +40 -40
  41. package/src/components/ImageEditor/useActiveTool.ts +21 -21
  42. package/src/components/ImageEditor/useEdgeDetection.ts +319 -319
  43. package/src/components/ImageEditor/useImageHistory.ts +197 -197
  44. package/src/components/ImageEditor/useOpenCV.ts +184 -184
  45. package/src/components/LinkedCardList/index.scss +95 -95
  46. package/src/components/MergeProgressDialog/MergeProgressDialogDs.tsx +91 -0
  47. package/src/components/MergeProgressDialog/index.tsx +5 -158
  48. package/src/components/MergeProgressDialog/useMergeJob.ts +169 -0
  49. package/src/components/PageBanner/index.tsx +80 -80
  50. package/src/components/PdfViewer/PdfViewer.tsx +158 -158
  51. package/src/components/ProgressBar/index.scss +23 -54
  52. package/src/components/SplitContainer/index.tsx +333 -333
  53. package/src/components/Toolbar/Toolbar.css +137 -137
  54. package/src/components/Toolbar/index.tsx +265 -265
  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/BarcodeScanner.css +81 -0
  67. package/src/elements/ElementLookupDialog/BarcodeScanner/DeadIcon.tsx +4 -4
  68. package/src/elements/ElementLookupDialog/BarcodeScanner/Error.tsx +7 -36
  69. package/src/elements/ElementLookupDialog/BarcodeScanner/index.tsx +20 -49
  70. package/src/elements/ElementLookupDialog/HIDScanner/index.tsx +67 -67
  71. package/src/elements/ElementLookupDialog/Manual/ManualForm.tsx +141 -141
  72. package/src/elements/ElementLookupDialog/index.tsx +226 -226
  73. package/src/elements/ElementLookupDialog/utils/Giai.ts +209 -209
  74. package/src/elements/ProjectSelect.tsx +130 -130
  75. package/src/elements/index.ts +15 -15
  76. package/src/filter/index.ts +34 -34
  77. package/src/i18n.ts +13 -13
  78. package/src/index.ts +5 -1
  79. package/src/mui/MuiThemeProvider.tsx +135 -135
  80. package/src/mui/index.ts +1 -0
  81. package/src/test/setup.ts +23 -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
+ }