@moh-sso/microfrontend 1.5.0 → 1.6.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/dist/_types/packages/ui/src/accessibility/useFocusTrap.d.ts +2 -1
- package/dist/_types/packages/ui/src/overlays/header-panel/ReusableHeaderPanel.d.ts +2 -1
- package/dist/_types/packages/ui/src/overlays/header-panel/header-panel.context.d.ts +3 -1
- package/dist/index.js +75 -72
- package/package.json +4 -4
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type RefObject } from "react";
|
|
2
2
|
type FocusTrapOptions = {
|
|
3
3
|
active: boolean;
|
|
4
|
+
trapFocus?: boolean;
|
|
4
5
|
containerRef: RefObject<HTMLElement | null>;
|
|
5
6
|
restoreFocus?: boolean;
|
|
6
7
|
initialFocusRef?: RefObject<HTMLElement | HTMLButtonElement | null>;
|
|
7
8
|
initialFocusSelector?: string;
|
|
8
9
|
};
|
|
9
|
-
export declare function useFocusTrap({ active, containerRef, restoreFocus, initialFocusRef, initialFocusSelector, }: FocusTrapOptions): void;
|
|
10
|
+
export declare function useFocusTrap({ active, trapFocus, containerRef, restoreFocus, initialFocusRef, initialFocusSelector, }: FocusTrapOptions): void;
|
|
10
11
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PanelSize } from "./header-panel.context";
|
|
2
2
|
type Props = {
|
|
3
3
|
isOpen: boolean;
|
|
4
|
+
dockOnDesktop?: boolean;
|
|
4
5
|
title?: string;
|
|
5
6
|
content?: React.ReactNode;
|
|
6
7
|
onClose: () => void;
|
|
@@ -13,5 +14,5 @@ type Props = {
|
|
|
13
14
|
maximizable?: boolean;
|
|
14
15
|
defaultMaximized?: boolean;
|
|
15
16
|
};
|
|
16
|
-
export declare function ReusableHeaderPanel({ isOpen, title, content, onClose, size, primaryActionLabel, secondaryActionLabel, onPrimaryAction, onSecondaryAction, disablePrimaryAction, maximizable, defaultMaximized, }: Props): import("react").JSX.Element;
|
|
17
|
+
export declare function ReusableHeaderPanel({ isOpen, dockOnDesktop, title, content, onClose, size, primaryActionLabel, secondaryActionLabel, onPrimaryAction, onSecondaryAction, disablePrimaryAction, maximizable, defaultMaximized, }: Props): import("react").JSX.Element;
|
|
17
18
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
export type PanelSize = "sm" | "md" | "lg";
|
|
3
3
|
type OpenPanelOptions = {
|
|
4
|
+
dockOnDesktop?: boolean;
|
|
4
5
|
title?: string;
|
|
5
6
|
content: React.ReactNode;
|
|
6
7
|
size?: PanelSize;
|
|
@@ -16,8 +17,9 @@ type HeaderPanelContextType = {
|
|
|
16
17
|
openPanel: (opts: OpenPanelOptions) => void;
|
|
17
18
|
closePanel: () => void;
|
|
18
19
|
};
|
|
19
|
-
export declare function HeaderPanelProvider({ children }: {
|
|
20
|
+
export declare function HeaderPanelProvider({ children, dockOnDesktop, }: {
|
|
20
21
|
children: React.ReactNode;
|
|
22
|
+
dockOnDesktop?: boolean;
|
|
21
23
|
}): React.JSX.Element;
|
|
22
24
|
export declare function useHeaderPanel(): HeaderPanelContextType;
|
|
23
25
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,122 +1,125 @@
|
|
|
1
1
|
import { jsxs as y, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Provider as
|
|
5
|
-
import { loginSuccess as P, authLoaded as L, HealthContextProvider as
|
|
6
|
-
import { store as
|
|
7
|
-
import { MicrofrontendErrorBoundary as
|
|
8
|
-
function l(
|
|
9
|
-
return (
|
|
2
|
+
import w from "react";
|
|
3
|
+
import s from "react-dom/client";
|
|
4
|
+
import { Provider as p } from "react-redux";
|
|
5
|
+
import { loginSuccess as P, authLoaded as L, HealthContextProvider as g } from "@moh-sso/auth";
|
|
6
|
+
import { store as d } from "@moh-sso/state";
|
|
7
|
+
import { MicrofrontendErrorBoundary as v, MohThemeProvider as E, HeaderPanelProvider as M, ModalProvider as N, ToastProvider as x } from "@moh-sso/ui";
|
|
8
|
+
function l(e) {
|
|
9
|
+
return (e.startsWith("/") ? e : `/${e}`).replace(/\/+$/, "") || "/";
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
return (!o || o === "/") && (!n || n === "/" || n === "?" || n === "#");
|
|
11
|
+
function O(e, t) {
|
|
12
|
+
return e === t || e.startsWith(`${t}/`);
|
|
14
13
|
}
|
|
15
|
-
function
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
return `${
|
|
19
|
-
if (typeof window > "u")
|
|
20
|
-
return
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
function V(e, t) {
|
|
15
|
+
const r = l(e), n = t ? l(t) : "";
|
|
16
|
+
if (n && n !== "/")
|
|
17
|
+
return r === "/" ? n : O(r, n) ? r : `${n}${r}`;
|
|
18
|
+
if (typeof window > "u" || r === "/")
|
|
19
|
+
return r;
|
|
20
|
+
const o = l(window.location.pathname);
|
|
21
|
+
let u = o.indexOf(r);
|
|
22
|
+
for (; u !== -1; ) {
|
|
23
|
+
const i = u + r.length;
|
|
24
|
+
if (i === o.length || o[i] === "/")
|
|
25
|
+
return o.slice(0, i);
|
|
26
|
+
u = o.indexOf(r, u + 1);
|
|
27
|
+
}
|
|
28
|
+
return r;
|
|
26
29
|
}
|
|
27
|
-
const
|
|
30
|
+
const _ = {
|
|
28
31
|
withRedux: !0,
|
|
29
32
|
withModal: !0,
|
|
30
33
|
withToast: !0,
|
|
31
34
|
withHeaderPanel: !0
|
|
32
35
|
};
|
|
33
|
-
function f(
|
|
34
|
-
return
|
|
36
|
+
function f(e) {
|
|
37
|
+
return e.displayName || e.name || "microfrontend";
|
|
35
38
|
}
|
|
36
|
-
function
|
|
37
|
-
let
|
|
38
|
-
return t.withHeaderPanel && (
|
|
39
|
+
function R(e, t) {
|
|
40
|
+
let r = e;
|
|
41
|
+
return t.withHeaderPanel && (r = /* @__PURE__ */ a(M, { children: r })), t.withModal && (r = /* @__PURE__ */ a(N, { children: r })), t.withToast && (r = /* @__PURE__ */ a(x, { children: r })), t.withRedux && (r = /* @__PURE__ */ a(p, { store: d, children: /* @__PURE__ */ a(g, { children: r }) })), /* @__PURE__ */ a(E, { theme: "white", children: r });
|
|
39
42
|
}
|
|
40
|
-
function m(
|
|
41
|
-
const { domElement:
|
|
42
|
-
return
|
|
43
|
-
/* @__PURE__ */ a(
|
|
44
|
-
|
|
43
|
+
function m(e, t, r) {
|
|
44
|
+
const { domElement: n, ...o } = t;
|
|
45
|
+
return R(
|
|
46
|
+
/* @__PURE__ */ a(v, { appName: f(e), children: /* @__PURE__ */ a(e, { ...o }) }),
|
|
47
|
+
r
|
|
45
48
|
);
|
|
46
49
|
}
|
|
47
|
-
function
|
|
50
|
+
function T(e, t, r, n) {
|
|
48
51
|
return /* @__PURE__ */ y("div", { className: "moh-microfrontend-error-boundary", role: "alert", children: [
|
|
49
52
|
"Unable to load ",
|
|
50
|
-
f(
|
|
53
|
+
f(e),
|
|
51
54
|
". ",
|
|
52
55
|
t.message
|
|
53
56
|
] });
|
|
54
57
|
}
|
|
55
|
-
function
|
|
56
|
-
return !!(
|
|
58
|
+
function A(e) {
|
|
59
|
+
return !!(e && typeof e == "object" && "id" in e && "username" in e);
|
|
57
60
|
}
|
|
58
|
-
function h(
|
|
59
|
-
const t =
|
|
60
|
-
if (t?.isAuthenticated &&
|
|
61
|
-
|
|
61
|
+
function h(e) {
|
|
62
|
+
const t = e.auth ?? window.__MOH_SSO_AUTH__;
|
|
63
|
+
if (t?.isAuthenticated && A(t.user)) {
|
|
64
|
+
d.dispatch(P({ user: t.user }));
|
|
62
65
|
return;
|
|
63
66
|
}
|
|
64
|
-
|
|
67
|
+
d.dispatch(L());
|
|
65
68
|
}
|
|
66
|
-
function
|
|
67
|
-
let
|
|
69
|
+
function I(e, t) {
|
|
70
|
+
let r = null;
|
|
68
71
|
return {
|
|
69
72
|
async bootstrap() {
|
|
70
73
|
},
|
|
71
|
-
async mount(
|
|
72
|
-
h(
|
|
74
|
+
async mount(n) {
|
|
75
|
+
h(n), r = s.createRoot(n.domElement), r.render(m(e, n, t));
|
|
73
76
|
},
|
|
74
77
|
async unmount() {
|
|
75
|
-
|
|
78
|
+
r?.unmount(), r = null;
|
|
76
79
|
}
|
|
77
80
|
};
|
|
78
81
|
}
|
|
79
|
-
async function
|
|
82
|
+
async function S() {
|
|
80
83
|
try {
|
|
81
84
|
return (await new Function("specifier", "return import(specifier)")("single-spa-react")).default ?? null;
|
|
82
85
|
} catch {
|
|
83
86
|
return null;
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
|
-
function
|
|
87
|
-
const
|
|
88
|
-
let
|
|
89
|
+
function W(e, t = {}) {
|
|
90
|
+
const r = { ..._, ...t }, n = I(e, r);
|
|
91
|
+
let o = null;
|
|
89
92
|
async function u() {
|
|
90
|
-
if (
|
|
91
|
-
return
|
|
92
|
-
const
|
|
93
|
-
return
|
|
94
|
-
React:
|
|
95
|
-
ReactDOMClient:
|
|
96
|
-
rootComponent: (
|
|
97
|
-
domElementGetter: ({ domElement:
|
|
98
|
-
errorBoundary: (
|
|
99
|
-
}) :
|
|
93
|
+
if (o)
|
|
94
|
+
return o;
|
|
95
|
+
const i = await S();
|
|
96
|
+
return o = i ? i({
|
|
97
|
+
React: w,
|
|
98
|
+
ReactDOMClient: s,
|
|
99
|
+
rootComponent: (c) => (h(c), m(e, c, r)),
|
|
100
|
+
domElementGetter: ({ domElement: c }) => c,
|
|
101
|
+
errorBoundary: (c, b, $) => T(e, c)
|
|
102
|
+
}) : n, o;
|
|
100
103
|
}
|
|
101
104
|
return {
|
|
102
|
-
async bootstrap(
|
|
103
|
-
return (await u()).bootstrap(
|
|
105
|
+
async bootstrap(i) {
|
|
106
|
+
return (await u()).bootstrap(i);
|
|
104
107
|
},
|
|
105
|
-
async mount(
|
|
106
|
-
return (await u()).mount(
|
|
108
|
+
async mount(i) {
|
|
109
|
+
return (await u()).mount(i);
|
|
107
110
|
},
|
|
108
|
-
async unmount(
|
|
109
|
-
return (
|
|
111
|
+
async unmount(i) {
|
|
112
|
+
return (o ?? n).unmount(i);
|
|
110
113
|
}
|
|
111
114
|
};
|
|
112
115
|
}
|
|
113
|
-
const
|
|
116
|
+
const H = "moh-sso:navigation";
|
|
114
117
|
function k() {
|
|
115
|
-
window.dispatchEvent(new Event(
|
|
118
|
+
window.dispatchEvent(new Event(H));
|
|
116
119
|
}
|
|
117
120
|
export {
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
H as MICROFRONTEND_NAVIGATION_EVENT,
|
|
122
|
+
W as createReactMicrofrontendLifecycle,
|
|
120
123
|
k as notifyMicrofrontendNavigation,
|
|
121
|
-
|
|
124
|
+
V as resolveRuntimeBasename
|
|
122
125
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.6.0",
|
|
7
7
|
"license": "UNLICENSED",
|
|
8
8
|
"module": "./dist/index.js",
|
|
9
9
|
"files": [
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@moh-sso/state": "^1.
|
|
35
|
-
"@moh-sso/ui": "^1.
|
|
36
|
-
"@moh-sso/auth": "^1.
|
|
34
|
+
"@moh-sso/state": "^1.6.0",
|
|
35
|
+
"@moh-sso/ui": "^1.6.0",
|
|
36
|
+
"@moh-sso/auth": "^1.6.0"
|
|
37
37
|
},
|
|
38
38
|
"private": false,
|
|
39
39
|
"repository": {
|