@optiaxiom/proteus 0.1.17 → 0.1.18
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.
|
@@ -14,6 +14,7 @@ function ProteusDocumentShell({
|
|
|
14
14
|
defaultOpen = true,
|
|
15
15
|
element,
|
|
16
16
|
onDataChange,
|
|
17
|
+
onDownload,
|
|
17
18
|
onInteraction,
|
|
18
19
|
onMessage,
|
|
19
20
|
onOpenChange,
|
|
@@ -50,20 +51,24 @@ function ProteusDocumentShell({
|
|
|
50
51
|
} else if ("message" in event) {
|
|
51
52
|
await onMessage?.(event.message);
|
|
52
53
|
} else if (event.action === "download") {
|
|
54
|
+
const urls = [];
|
|
53
55
|
if (typeof event.url === "string") {
|
|
54
|
-
|
|
56
|
+
urls.push(event.url);
|
|
55
57
|
} else if (Array.isArray(event.url)) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
})
|
|
63
|
-
);
|
|
58
|
+
for (const u of event.url) {
|
|
59
|
+
if (typeof u !== "string") {
|
|
60
|
+
throw new Error("Invalid URL in download array");
|
|
61
|
+
}
|
|
62
|
+
urls.push(u);
|
|
63
|
+
}
|
|
64
64
|
} else {
|
|
65
65
|
throw new Error("Invalid URL for download action");
|
|
66
66
|
}
|
|
67
|
+
if (onDownload) {
|
|
68
|
+
await onDownload(urls);
|
|
69
|
+
} else {
|
|
70
|
+
await Promise.all(urls.map((u) => downloadFile(u)));
|
|
71
|
+
}
|
|
67
72
|
}
|
|
68
73
|
}),
|
|
69
74
|
readOnly,
|
package/dist/index.d.ts
CHANGED
|
@@ -223,6 +223,12 @@ type ProteusDocumentShellProps = Pick<ComponentPropsWithoutRef<typeof Disclosure
|
|
|
223
223
|
* Callback when form fields change
|
|
224
224
|
*/
|
|
225
225
|
onDataChange?: (data: Record<string, unknown>) => void;
|
|
226
|
+
/**
|
|
227
|
+
* Callback when user triggers a download action; receives the resolved URL(s).
|
|
228
|
+
* When provided, the host is responsible for the actual download/zip.
|
|
229
|
+
* Falls back to built-in window.open behaviour when absent.
|
|
230
|
+
*/
|
|
231
|
+
onDownload?: (urls: string[]) => Promise<void> | void;
|
|
226
232
|
/**
|
|
227
233
|
* Callback when user clicks a Action button with interaction handler
|
|
228
234
|
*/
|
|
@@ -250,7 +256,7 @@ type ProteusDocument$2 = {
|
|
|
250
256
|
title?: ReactNode;
|
|
251
257
|
titleIcon?: string;
|
|
252
258
|
};
|
|
253
|
-
declare function ProteusDocumentShell({ collapsible: collapsibleProp, data, defaultOpen, element, onDataChange, onInteraction, onMessage, onOpenChange, open: openProp, readOnly, strict, }: ProteusDocumentShellProps): react_jsx_runtime.JSX.Element;
|
|
259
|
+
declare function ProteusDocumentShell({ collapsible: collapsibleProp, data, defaultOpen, element, onDataChange, onDownload, onInteraction, onMessage, onOpenChange, open: openProp, readOnly, strict, }: ProteusDocumentShellProps): react_jsx_runtime.JSX.Element;
|
|
254
260
|
declare namespace ProteusDocumentShell {
|
|
255
261
|
var displayName: string;
|
|
256
262
|
}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"url": "git+https://github.com/optimizely-axiom/optiaxiom.git"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
|
-
"version": "0.1.
|
|
10
|
+
"version": "0.1.18",
|
|
11
11
|
"files": [
|
|
12
12
|
"dist/**",
|
|
13
13
|
"LICENSE"
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"embla-carousel-react": "^8.6.0",
|
|
37
37
|
"jsonpointer": "^5.0.1",
|
|
38
38
|
"recharts": "^3.7.0",
|
|
39
|
-
"@optiaxiom/
|
|
40
|
-
"@optiaxiom/
|
|
39
|
+
"@optiaxiom/react": "1.9.25",
|
|
40
|
+
"@optiaxiom/icons": "0.1.4"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@emotion/hash": "^0.9.2",
|