@olenbetong/synergi-react 4.3.0 → 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 -113
  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 -136
  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,184 +1,184 @@
1
- import { useEffect, useState } from "react";
2
-
3
- declare global {
4
- interface Window {
5
- // oxlint-disable-next-line typescript/no-explicit-any -- OpenCV.js has no bundled types
6
- cv: any;
7
- }
8
- }
9
-
10
- /**
11
- * OpenCV.js builds to try, in order. Both are single-file builds with the WASM embedded,
12
- * so no companion `.wasm` request is needed.
13
- *
14
- * Note: opencv.org only publishes rolling branch builds — pinned version paths such as
15
- * `/4.10.0/opencv.js` were removed upstream and now return 404. `5.x` is the current
16
- * development line and `4.x` the stable line; the 4.x entry is a fallback for the case
17
- * where the 5.x build is temporarily broken or unavailable.
18
- */
19
- export const DEFAULT_OPENCV_URLS = ["https://docs.opencv.org/5.x/opencv.js", "https://docs.opencv.org/4.x/opencv.js"];
20
-
21
- /** Milliseconds to wait for the WASM runtime to initialise before giving up on a build. */
22
- const INIT_TIMEOUT_MS = 60_000;
23
-
24
- let scriptUrls = [...DEFAULT_OPENCV_URLS];
25
- let loadPromise: Promise<void> | null = null;
26
-
27
- /**
28
- * Overrides which OpenCV.js build(s) to load — e.g. to self-host instead of using the CDN.
29
- * Must be called before anything triggers a load; ignored once loading has started.
30
- */
31
- export function configureOpenCV(urls: string | string[]) {
32
- if (loadPromise) {
33
- console.warn("[OpenCV] configureOpenCV() ignored — OpenCV is already loading or loaded");
34
- return;
35
- }
36
- scriptUrls = Array.isArray(urls) ? [...urls] : [urls];
37
- }
38
-
39
- function isReady() {
40
- return typeof window.cv?.Mat !== "undefined";
41
- }
42
-
43
- /** Polls for cv.Mat, which signals that the WASM runtime has fully initialised. */
44
- function waitForCvMat(timeoutMs: number): Promise<void> {
45
- return new Promise((resolve, reject) => {
46
- let elapsed = 0;
47
- let interval = setInterval(() => {
48
- if (isReady()) {
49
- clearInterval(interval);
50
- resolve();
51
- return;
52
- }
53
- elapsed += 100;
54
- if (elapsed >= timeoutMs) {
55
- clearInterval(interval);
56
- reject(new Error("OpenCV.js initialisation timed out"));
57
- }
58
- }, 100);
59
- });
60
- }
61
-
62
- /** Loads a single OpenCV.js build, handling both the promise-based and polling Emscripten builds. */
63
- function loadScript(url: string): Promise<void> {
64
- return new Promise<void>((resolve, reject) => {
65
- // A previous failed attempt may have left a half-initialised global behind.
66
- if (!isReady()) window.cv = undefined;
67
-
68
- let script = document.createElement("script");
69
- script.src = url;
70
- script.async = true;
71
-
72
- let settle = (err?: Error) => {
73
- if (err) {
74
- script.remove();
75
- reject(err);
76
- } else {
77
- resolve();
78
- }
79
- };
80
-
81
- script.onload = () => {
82
- if (typeof window.cv?.then === "function") {
83
- // Emscripten promise-based build: cv itself is the promise.
84
- // IMPORTANT: never resolve *with* the instance — if the resolved value is
85
- // itself thenable, the promise chain follows it forever and never settles.
86
- // Instead mutate window.cv and signal readiness with undefined.
87
- (window.cv as Promise<unknown>).then(
88
- (instance) => {
89
- window.cv = instance;
90
- settle();
91
- },
92
- (err: Error) => settle(err instanceof Error ? err : new Error(String(err))),
93
- );
94
- } else if (isReady()) {
95
- settle();
96
- } else {
97
- // Polling build: the WASM initialises asynchronously after the script loads.
98
- waitForCvMat(INIT_TIMEOUT_MS).then(() => settle(), settle);
99
- }
100
- };
101
-
102
- script.onerror = () => settle(new Error(`Failed to load OpenCV.js from ${url}`));
103
-
104
- document.head.appendChild(script);
105
- });
106
- }
107
-
108
- /**
109
- * Lazily loads OpenCV.js, trying each configured build in order.
110
- * Rejects only when every candidate fails. Callers read `window.cv`.
111
- *
112
- * IMPORTANT: this promise must never resolve *with* the OpenCV module. Emscripten's
113
- * module object has its own `.then` method, so it is thenable — resolving a promise
114
- * with it makes the promise machinery try to adopt it and call `.then` forever, which
115
- * wedges the whole tab in an infinite microtask loop. Always resolve with `undefined`
116
- * and let callers read `window.cv`.
117
- */
118
- export function loadOpenCV(): Promise<void> {
119
- if (loadPromise) return loadPromise;
120
-
121
- // Already initialised (e.g. hot-reload, or loaded by the host page)
122
- if (isReady()) {
123
- loadPromise = Promise.resolve();
124
- return loadPromise;
125
- }
126
-
127
- loadPromise = (async () => {
128
- let errors: Error[] = [];
129
- for (let url of scriptUrls) {
130
- try {
131
- await loadScript(url);
132
- if (!isReady()) throw new Error(`OpenCV.js loaded from ${url} but exposes no cv.Mat`);
133
- return; // never `return window.cv` — see the note above
134
- } catch (err) {
135
- let error = err instanceof Error ? err : new Error(String(err));
136
- errors.push(error);
137
- console.warn(`[OpenCV] Could not load ${url}:`, error.message);
138
- }
139
- }
140
- // Allow a later retry (e.g. after the network comes back) rather than caching the failure.
141
- loadPromise = null;
142
- throw new Error(`Failed to load OpenCV.js from: ${scriptUrls.join(", ")}`, { cause: errors });
143
- })();
144
-
145
- return loadPromise;
146
- }
147
-
148
- interface UseOpenCVResult {
149
- // oxlint-disable-next-line typescript/no-explicit-any -- OpenCV.js has no bundled types
150
- cv: any | null;
151
- ready: boolean;
152
- error: Error | null;
153
- }
154
-
155
- /** Lazily loads OpenCV.js from CDN. Starts loading only when `enabled` is true. */
156
- export function useOpenCV(enabled = true): UseOpenCVResult {
157
- // oxlint-disable-next-line typescript/no-explicit-any -- OpenCV.js has no bundled types
158
- let [cv, setCv] = useState<any | null>(null);
159
- let [ready, setReady] = useState(false);
160
- let [error, setError] = useState<Error | null>(null);
161
-
162
- useEffect(() => {
163
- if (!enabled) return;
164
- let cancelled = false;
165
- loadOpenCV()
166
- .then(() => {
167
- if (cancelled) return;
168
- setCv(window.cv);
169
- setReady(true);
170
- })
171
- .catch((err: Error) => {
172
- if (cancelled) return;
173
- // OpenCV only powers optional features (border suggestion, perspective warp),
174
- // so a load failure must never break the tools that depend on it.
175
- console.warn("[useOpenCV] OpenCV failed to load — continuing without it:", err.message);
176
- setError(err);
177
- });
178
- return () => {
179
- cancelled = true;
180
- };
181
- }, [enabled]);
182
-
183
- return { cv, ready, error };
184
- }
1
+ import { useEffect, useState } from "react";
2
+
3
+ declare global {
4
+ interface Window {
5
+ // oxlint-disable-next-line typescript/no-explicit-any -- OpenCV.js has no bundled types
6
+ cv: any;
7
+ }
8
+ }
9
+
10
+ /**
11
+ * OpenCV.js builds to try, in order. Both are single-file builds with the WASM embedded,
12
+ * so no companion `.wasm` request is needed.
13
+ *
14
+ * Note: opencv.org only publishes rolling branch builds — pinned version paths such as
15
+ * `/4.10.0/opencv.js` were removed upstream and now return 404. `5.x` is the current
16
+ * development line and `4.x` the stable line; the 4.x entry is a fallback for the case
17
+ * where the 5.x build is temporarily broken or unavailable.
18
+ */
19
+ export const DEFAULT_OPENCV_URLS = ["https://docs.opencv.org/5.x/opencv.js", "https://docs.opencv.org/4.x/opencv.js"];
20
+
21
+ /** Milliseconds to wait for the WASM runtime to initialise before giving up on a build. */
22
+ const INIT_TIMEOUT_MS = 60_000;
23
+
24
+ let scriptUrls = [...DEFAULT_OPENCV_URLS];
25
+ let loadPromise: Promise<void> | null = null;
26
+
27
+ /**
28
+ * Overrides which OpenCV.js build(s) to load — e.g. to self-host instead of using the CDN.
29
+ * Must be called before anything triggers a load; ignored once loading has started.
30
+ */
31
+ export function configureOpenCV(urls: string | string[]) {
32
+ if (loadPromise) {
33
+ console.warn("[OpenCV] configureOpenCV() ignored — OpenCV is already loading or loaded");
34
+ return;
35
+ }
36
+ scriptUrls = Array.isArray(urls) ? [...urls] : [urls];
37
+ }
38
+
39
+ function isReady() {
40
+ return typeof window.cv?.Mat !== "undefined";
41
+ }
42
+
43
+ /** Polls for cv.Mat, which signals that the WASM runtime has fully initialised. */
44
+ function waitForCvMat(timeoutMs: number): Promise<void> {
45
+ return new Promise((resolve, reject) => {
46
+ let elapsed = 0;
47
+ let interval = setInterval(() => {
48
+ if (isReady()) {
49
+ clearInterval(interval);
50
+ resolve();
51
+ return;
52
+ }
53
+ elapsed += 100;
54
+ if (elapsed >= timeoutMs) {
55
+ clearInterval(interval);
56
+ reject(new Error("OpenCV.js initialisation timed out"));
57
+ }
58
+ }, 100);
59
+ });
60
+ }
61
+
62
+ /** Loads a single OpenCV.js build, handling both the promise-based and polling Emscripten builds. */
63
+ function loadScript(url: string): Promise<void> {
64
+ return new Promise<void>((resolve, reject) => {
65
+ // A previous failed attempt may have left a half-initialised global behind.
66
+ if (!isReady()) window.cv = undefined;
67
+
68
+ let script = document.createElement("script");
69
+ script.src = url;
70
+ script.async = true;
71
+
72
+ let settle = (err?: Error) => {
73
+ if (err) {
74
+ script.remove();
75
+ reject(err);
76
+ } else {
77
+ resolve();
78
+ }
79
+ };
80
+
81
+ script.onload = () => {
82
+ if (typeof window.cv?.then === "function") {
83
+ // Emscripten promise-based build: cv itself is the promise.
84
+ // IMPORTANT: never resolve *with* the instance — if the resolved value is
85
+ // itself thenable, the promise chain follows it forever and never settles.
86
+ // Instead mutate window.cv and signal readiness with undefined.
87
+ (window.cv as Promise<unknown>).then(
88
+ (instance) => {
89
+ window.cv = instance;
90
+ settle();
91
+ },
92
+ (err: Error) => settle(err instanceof Error ? err : new Error(String(err))),
93
+ );
94
+ } else if (isReady()) {
95
+ settle();
96
+ } else {
97
+ // Polling build: the WASM initialises asynchronously after the script loads.
98
+ waitForCvMat(INIT_TIMEOUT_MS).then(() => settle(), settle);
99
+ }
100
+ };
101
+
102
+ script.onerror = () => settle(new Error(`Failed to load OpenCV.js from ${url}`));
103
+
104
+ document.head.appendChild(script);
105
+ });
106
+ }
107
+
108
+ /**
109
+ * Lazily loads OpenCV.js, trying each configured build in order.
110
+ * Rejects only when every candidate fails. Callers read `window.cv`.
111
+ *
112
+ * IMPORTANT: this promise must never resolve *with* the OpenCV module. Emscripten's
113
+ * module object has its own `.then` method, so it is thenable — resolving a promise
114
+ * with it makes the promise machinery try to adopt it and call `.then` forever, which
115
+ * wedges the whole tab in an infinite microtask loop. Always resolve with `undefined`
116
+ * and let callers read `window.cv`.
117
+ */
118
+ export function loadOpenCV(): Promise<void> {
119
+ if (loadPromise) return loadPromise;
120
+
121
+ // Already initialised (e.g. hot-reload, or loaded by the host page)
122
+ if (isReady()) {
123
+ loadPromise = Promise.resolve();
124
+ return loadPromise;
125
+ }
126
+
127
+ loadPromise = (async () => {
128
+ let errors: Error[] = [];
129
+ for (let url of scriptUrls) {
130
+ try {
131
+ await loadScript(url);
132
+ if (!isReady()) throw new Error(`OpenCV.js loaded from ${url} but exposes no cv.Mat`);
133
+ return; // never `return window.cv` — see the note above
134
+ } catch (err) {
135
+ let error = err instanceof Error ? err : new Error(String(err));
136
+ errors.push(error);
137
+ console.warn(`[OpenCV] Could not load ${url}:`, error.message);
138
+ }
139
+ }
140
+ // Allow a later retry (e.g. after the network comes back) rather than caching the failure.
141
+ loadPromise = null;
142
+ throw new Error(`Failed to load OpenCV.js from: ${scriptUrls.join(", ")}`, { cause: errors });
143
+ })();
144
+
145
+ return loadPromise;
146
+ }
147
+
148
+ interface UseOpenCVResult {
149
+ // oxlint-disable-next-line typescript/no-explicit-any -- OpenCV.js has no bundled types
150
+ cv: any | null;
151
+ ready: boolean;
152
+ error: Error | null;
153
+ }
154
+
155
+ /** Lazily loads OpenCV.js from CDN. Starts loading only when `enabled` is true. */
156
+ export function useOpenCV(enabled = true): UseOpenCVResult {
157
+ // oxlint-disable-next-line typescript/no-explicit-any -- OpenCV.js has no bundled types
158
+ let [cv, setCv] = useState<any | null>(null);
159
+ let [ready, setReady] = useState(false);
160
+ let [error, setError] = useState<Error | null>(null);
161
+
162
+ useEffect(() => {
163
+ if (!enabled) return;
164
+ let cancelled = false;
165
+ loadOpenCV()
166
+ .then(() => {
167
+ if (cancelled) return;
168
+ setCv(window.cv);
169
+ setReady(true);
170
+ })
171
+ .catch((err: Error) => {
172
+ if (cancelled) return;
173
+ // OpenCV only powers optional features (border suggestion, perspective warp),
174
+ // so a load failure must never break the tools that depend on it.
175
+ console.warn("[useOpenCV] OpenCV failed to load — continuing without it:", err.message);
176
+ setError(err);
177
+ });
178
+ return () => {
179
+ cancelled = true;
180
+ };
181
+ }, [enabled]);
182
+
183
+ return { cv, ready, error };
184
+ }
@@ -1,95 +1,95 @@
1
- @use "../../styles/variables";
2
-
3
- $bullet-size: 0.7em;
4
- $line-width: 0.2em;
5
-
6
- :root {
7
- --ob-linked-list-bullet-size: 0.7em;
8
- --ob-linked-list-line-width: 0.2em;
9
- }
10
-
11
- .ObLinkedList-root {
12
- list-style-type: none;
13
- margin-left: 0;
14
- padding-left: 0;
15
- }
16
-
17
- .ObLinkedList-item {
18
- display: flex;
19
- align-items: center;
20
- flex-direction: row;
21
- }
22
-
23
- .ObLinkedList-leftColumn {
24
- flex: 1 1 4em;
25
- font-size: 0.75em;
26
- padding: 0 1em;
27
- text-align: center;
28
- }
29
-
30
- .ObLinkedList-rightColumn {
31
- flex: 1 1 100%;
32
- padding: 1em 1em 1em 1.5em;
33
- }
34
-
35
- .ObLinkedList-line {
36
- display: flex;
37
- align-self: stretch;
38
- flex: 0 0 $line-width;
39
- background: white;
40
- position: relative;
41
- }
42
-
43
- .ObLinkedList-bullet {
44
- background: white;
45
-
46
- border: 1px solid rgba(50, 50, 50, 0.25);
47
- border-radius: 0.55em;
48
- height: $bullet-size;
49
- width: $bullet-size;
50
-
51
- position: absolute;
52
- left: 0;
53
- top: 50%;
54
-
55
- transform: translate(
56
- calc(-1 * (var(--ob-linked-list-bullet-size) / 2) + (var(--ob-linked-list-line-width) / 2)),
57
- -50%
58
- );
59
- }
60
-
61
- .ObLinkedList-card {
62
- display: block;
63
- background: white;
64
- border: 1px solid;
65
- border-color: variables.$color-border-top variables.$color-border-side variables.$color-border-bottom;
66
- border-radius: 0.1875em;
67
- color: inherit;
68
- cursor: pointer;
69
- flex: 100% 1 1;
70
- position: relative;
71
- }
72
-
73
- .ObLinkedList-card::before {
74
- border-bottom: 0.5em solid transparent;
75
- border-right: 1em solid white;
76
- border-top: 0.5em solid transparent;
77
- content: " ";
78
- filter: drop-shadow(-1px 0px 1px rgba(50, 50, 50, 0.2));
79
- height: 1em;
80
- left: -1em;
81
- margin-top: -0.5em;
82
- position: absolute;
83
- top: 50%;
84
- width: 1em;
85
- }
86
-
87
- .ObLinkedList-card:hover {
88
- background-color: variables.$block-color-bg-hover !important;
89
- color: inherit;
90
- text-decoration: inherit;
91
- }
92
-
93
- .ObLinkedList-card:hover::before {
94
- border-right-color: variables.$block-color-bg-hover !important;
95
- }
1
+ @use "../../styles/variables";
2
+
3
+ $bullet-size: 0.7em;
4
+ $line-width: 0.2em;
5
+
6
+ :root {
7
+ --ob-linked-list-bullet-size: 0.7em;
8
+ --ob-linked-list-line-width: 0.2em;
9
+ }
10
+
11
+ .ObLinkedList-root {
12
+ list-style-type: none;
13
+ margin-left: 0;
14
+ padding-left: 0;
15
+ }
16
+
17
+ .ObLinkedList-item {
18
+ display: flex;
19
+ align-items: center;
20
+ flex-direction: row;
21
+ }
22
+
23
+ .ObLinkedList-leftColumn {
24
+ flex: 1 1 4em;
25
+ font-size: 0.75em;
26
+ padding: 0 1em;
27
+ text-align: center;
28
+ }
29
+
30
+ .ObLinkedList-rightColumn {
31
+ flex: 1 1 100%;
32
+ padding: 1em 1em 1em 1.5em;
33
+ }
34
+
35
+ .ObLinkedList-line {
36
+ display: flex;
37
+ align-self: stretch;
38
+ flex: 0 0 $line-width;
39
+ background: white;
40
+ position: relative;
41
+ }
42
+
43
+ .ObLinkedList-bullet {
44
+ background: white;
45
+
46
+ border: 1px solid rgba(50, 50, 50, 0.25);
47
+ border-radius: 0.55em;
48
+ height: $bullet-size;
49
+ width: $bullet-size;
50
+
51
+ position: absolute;
52
+ left: 0;
53
+ top: 50%;
54
+
55
+ transform: translate(
56
+ calc(-1 * (var(--ob-linked-list-bullet-size) / 2) + (var(--ob-linked-list-line-width) / 2)),
57
+ -50%
58
+ );
59
+ }
60
+
61
+ .ObLinkedList-card {
62
+ display: block;
63
+ background: white;
64
+ border: 1px solid;
65
+ border-color: variables.$color-border-top variables.$color-border-side variables.$color-border-bottom;
66
+ border-radius: 0.1875em;
67
+ color: inherit;
68
+ cursor: pointer;
69
+ flex: 100% 1 1;
70
+ position: relative;
71
+ }
72
+
73
+ .ObLinkedList-card::before {
74
+ border-bottom: 0.5em solid transparent;
75
+ border-right: 1em solid white;
76
+ border-top: 0.5em solid transparent;
77
+ content: " ";
78
+ filter: drop-shadow(-1px 0px 1px rgba(50, 50, 50, 0.2));
79
+ height: 1em;
80
+ left: -1em;
81
+ margin-top: -0.5em;
82
+ position: absolute;
83
+ top: 50%;
84
+ width: 1em;
85
+ }
86
+
87
+ .ObLinkedList-card:hover {
88
+ background-color: variables.$block-color-bg-hover !important;
89
+ color: inherit;
90
+ text-decoration: inherit;
91
+ }
92
+
93
+ .ObLinkedList-card:hover::before {
94
+ border-right-color: variables.$block-color-bg-hover !important;
95
+ }
@@ -0,0 +1,91 @@
1
+ import { Button, Dialog, Link, Paragraph } from "@digdir/designsystemet-react";
2
+ import { LinearProgress, ResponsiveDialog } from "@olenbetong/appframe-ds";
3
+ import { getLocalizedString } from "../../i18n.js";
4
+ import { type MergeJobOptions, useMergeJob } from "./useMergeJob.js";
5
+
6
+ export type MergeProgressDialogDsProps = MergeJobOptions;
7
+
8
+ const subtle = { color: "var(--ds-color-neutral-text-subtle)" };
9
+
10
+ /**
11
+ * Designsystemet version of `MergeProgressDialog`, for apps off MUI: the same merge job and
12
+ * props. The dialog cannot be dismissed while the job runs.
13
+ */
14
+ export function MergeProgressDialogDs(props: MergeProgressDialogDsProps) {
15
+ let { phase, pct, remaining, title, canClose, handleClose } = useMergeJob(props);
16
+
17
+ return (
18
+ <ResponsiveDialog
19
+ open={props.open}
20
+ onClose={handleClose}
21
+ closedby={canClose ? "any" : "none"}
22
+ title={title}
23
+ maxWidth="sm"
24
+ >
25
+ <Dialog.Block>
26
+ {(phase.kind === "preparing" || phase.kind === "processing") && (
27
+ <LinearProgress
28
+ value={phase.kind === "processing" && phase.total > 0 ? pct : undefined}
29
+ style={{ marginBottom: "0.75rem" }}
30
+ />
31
+ )}
32
+
33
+ {phase.kind === "preparing" && (
34
+ <Paragraph data-size="sm" style={subtle}>
35
+ {getLocalizedString("Starting merge job…")}
36
+ </Paragraph>
37
+ )}
38
+
39
+ {phase.kind === "processing" && (
40
+ <>
41
+ <Paragraph data-size="sm">
42
+ {phase.completed} / {phase.total} {getLocalizedString("files")}
43
+ {remaining && <span style={subtle}> — {remaining}</span>}
44
+ </Paragraph>
45
+ {phase.currentFile && (
46
+ <Paragraph
47
+ data-size="sm"
48
+ title={phase.currentFile}
49
+ style={{
50
+ ...subtle,
51
+ marginTop: "0.25rem",
52
+ overflow: "hidden",
53
+ textOverflow: "ellipsis",
54
+ whiteSpace: "nowrap",
55
+ }}
56
+ >
57
+ {phase.currentFile}
58
+ </Paragraph>
59
+ )}
60
+ </>
61
+ )}
62
+
63
+ {phase.kind === "completed" && (
64
+ <>
65
+ <Paragraph data-size="sm" style={{ color: "var(--ds-color-success-text-default)" }}>
66
+ {getLocalizedString("Download started. You can close this dialog.")}
67
+ </Paragraph>
68
+ <Paragraph data-size="sm" style={{ ...subtle, marginTop: "0.5rem" }}>
69
+ {getLocalizedString("If the file did not open automatically, ")}{" "}
70
+ <Link href={`/api/ob/merger/download/${phase.jobId}`} target="_blank" rel="noopener noreferrer">
71
+ {getLocalizedString("click here to open it")}
72
+ </Link>
73
+ .
74
+ </Paragraph>
75
+ </>
76
+ )}
77
+
78
+ {phase.kind === "failed" && (
79
+ <Paragraph data-size="sm" style={{ color: "var(--ds-color-danger-text-default)" }}>
80
+ {phase.error}
81
+ </Paragraph>
82
+ )}
83
+ </Dialog.Block>
84
+ <Dialog.Block style={{ display: "flex", justifyContent: "flex-end" }}>
85
+ <Button variant="tertiary" onClick={handleClose} disabled={!canClose}>
86
+ {getLocalizedString("Close")}
87
+ </Button>
88
+ </Dialog.Block>
89
+ </ResponsiveDialog>
90
+ );
91
+ }