@camunda/camunda-composite-components 0.2.11-rc.0 → 0.2.11-rc.2
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/lib/esm/components/c3-help-center/c3-help-center-provider.d.ts +9 -0
- package/lib/esm/components/c3-help-center/c3-help-center-provider.js +19 -0
- package/lib/esm/components/c3-help-center/c3-help-center.d.ts +0 -1
- package/lib/esm/components/c3-help-center/c3-help-center.js +4 -1
- package/lib/esm/components/c3-navigation/c3-navigation.js +5 -12
- package/lib/esm/components/c3-navigation/c3-navigation.types.d.ts +1 -3
- package/lib/esm/components/c3-user-configuration/c3-user-configuration-provider.js +3 -1
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { FC, PropsWithChildren } from "react";
|
|
2
|
+
export type C3HelpCenterContextValue = {
|
|
3
|
+
openHelpCenter: () => void;
|
|
4
|
+
setIsHelpCenterOpen: (isOpen: boolean) => void;
|
|
5
|
+
isHelpCenterOpen: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const C3HelpCenterContext: React.Context<C3HelpCenterContextValue>;
|
|
8
|
+
export declare const C3HelpCenterProvider: FC<PropsWithChildren>;
|
|
9
|
+
export declare const useC3HelpCenter: () => C3HelpCenterContextValue;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
export const C3HelpCenterContext = React.createContext({
|
|
3
|
+
openHelpCenter: () => undefined,
|
|
4
|
+
setIsHelpCenterOpen: () => undefined,
|
|
5
|
+
isHelpCenterOpen: false,
|
|
6
|
+
});
|
|
7
|
+
export const C3HelpCenterProvider = ({ children }) => {
|
|
8
|
+
const [isHelpCenterOpen, setIsHelpCenterOpen] = useState(false);
|
|
9
|
+
const openHelpCenter = () => {
|
|
10
|
+
if (!isHelpCenterOpen)
|
|
11
|
+
setIsHelpCenterOpen(true);
|
|
12
|
+
};
|
|
13
|
+
return (React.createElement(C3HelpCenterContext.Provider, { value: {
|
|
14
|
+
openHelpCenter,
|
|
15
|
+
setIsHelpCenterOpen,
|
|
16
|
+
isHelpCenterOpen,
|
|
17
|
+
} }, children));
|
|
18
|
+
};
|
|
19
|
+
export const useC3HelpCenter = () => React.useContext(C3HelpCenterContext);
|
|
@@ -3,7 +3,6 @@ import { Persona } from "./c3-help-center.types";
|
|
|
3
3
|
import { Dict } from "mixpanel-browser";
|
|
4
4
|
import { Theme } from "../c3-user-configuration/c3-profile-provider/c3-profile-provider";
|
|
5
5
|
export interface C3HelpCenterProps {
|
|
6
|
-
isOpen: boolean;
|
|
7
6
|
origin: "console" | "webmodeler" | "operate" | "tasklist" | "optimize";
|
|
8
7
|
theme?: Theme;
|
|
9
8
|
flags?: string[];
|
|
@@ -7,7 +7,9 @@ import { getClusters, getConfig, getOrg, updatePersona, } from "../../api/help-c
|
|
|
7
7
|
import { useC3UserConfiguration } from "../c3-user-configuration/c3-user-configuration-provider";
|
|
8
8
|
import { defaultTheme, useC3Profile, } from "../c3-user-configuration/c3-profile-provider/c3-profile-provider";
|
|
9
9
|
import { resolveTheme, } from "../c3-user-configuration/c3-profile-provider/carbon-theme-provider";
|
|
10
|
-
|
|
10
|
+
import { useC3HelpCenter } from "./c3-help-center-provider";
|
|
11
|
+
export const C3HelpCenter = ({ autoStartSurvey, origin, flags, onRequestClose, mixpanelTrack, onRequestOpen, theme, onPersonaChange, activeTab, }) => {
|
|
12
|
+
const { isHelpCenterOpen: isOpen, setIsHelpCenterOpen } = useC3HelpCenter();
|
|
11
13
|
const { userToken, decodedToken, activeOrganizationId, handleTheme } = useC3UserConfiguration() || {};
|
|
12
14
|
const { theme: themeConfig, isEnabled } = useC3Profile();
|
|
13
15
|
const themeHandlingEnabled = isEnabled && !!handleTheme && !!themeConfig;
|
|
@@ -160,6 +162,7 @@ export const C3HelpCenter = ({ autoStartSurvey, origin, flags, isOpen, onRequest
|
|
|
160
162
|
userId,
|
|
161
163
|
});
|
|
162
164
|
}
|
|
165
|
+
setIsHelpCenterOpen(false);
|
|
163
166
|
onRequestClose?.();
|
|
164
167
|
};
|
|
165
168
|
return (React.createElement(Layer, null,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Header, HeaderContainer, HeaderGlobalBar, HeaderMenuItem, HeaderName, HeaderNavigation, SkipToContent, Tag, Toggletip, ToggletipButton, ToggletipContent, Stack as CarbonStack, } from "@carbon/react";
|
|
2
|
-
import React
|
|
2
|
+
import React from "react";
|
|
3
3
|
import C3InfoSidebar from "./c3-navigation-sidebar/c3-info-sidebar";
|
|
4
4
|
import { C3NotificationSidebar } from "./c3-navigation-sidebar/c3-notification-sidebar";
|
|
5
5
|
import C3OrgSidebar from "./c3-navigation-sidebar/c3-org-sidebar";
|
|
@@ -13,6 +13,7 @@ import { InfoButton } from "./c3-info-button";
|
|
|
13
13
|
import { C3SidebarStateProvider } from "./c3-navigation-sidebar/c3-sidebar-state-provider";
|
|
14
14
|
import { C3HelpCenter } from "../c3-help-center/c3-help-center";
|
|
15
15
|
import { C3ClusterTag } from "../c3-cluster-tag/c3-cluster-tag";
|
|
16
|
+
import { useC3HelpCenter } from "../c3-help-center/c3-help-center-provider";
|
|
16
17
|
/**
|
|
17
18
|
* UI SHELL
|
|
18
19
|
* Docs: https://react.carbondesignsystem.com/?path=/story/components-ui-shell--fixed-side-nav
|
|
@@ -38,17 +39,12 @@ const ClusterTagWrapper = styled.div `
|
|
|
38
39
|
}
|
|
39
40
|
`;
|
|
40
41
|
export const C3Navigation = ({ app, appBar, forwardRef, navbar, orgSideBar, infoSideBar, infoButton, helpCenter, actionButtons, userSideBar, notificationSideBar, clusterUuid, options, }) => {
|
|
42
|
+
const { setIsHelpCenterOpen, isHelpCenterOpen } = useC3HelpCenter();
|
|
41
43
|
const isLargeScreen = useMediaQuery(`(min-width: ${BREAKPOINT_LG_WIDTH}`);
|
|
42
44
|
const appBarElementsLength = appBar.elements?.length ?? 0;
|
|
43
45
|
const displayAppBar = appBarElementsLength > 0 || (!isLargeScreen && navbar.elements.length > 0);
|
|
44
46
|
if (app.prefix)
|
|
45
47
|
console.warn("The `prefix` prop is deprecated and will be removed in a future release. It has been replaced with a Camunda icon.");
|
|
46
|
-
const [isHelpCenterOpen, setIsHelpCenterOpen] = useState(helpCenter?.isOpen ?? false);
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
if (helpCenter?.isOpen) {
|
|
49
|
-
setIsHelpCenterOpen(true);
|
|
50
|
-
}
|
|
51
|
-
}, [helpCenter?.isOpen]);
|
|
52
48
|
return (React.createElement(C3SidebarStateProvider, { isNotificationSidebarOpen: notificationSideBar?.isOpen, isOrgSidebarOpen: orgSideBar?.isOpen, isInfoSidebarOpen: infoSideBar?.isOpen, isUserSidebarOpen: userSideBar?.isOpen },
|
|
53
49
|
React.createElement(HeaderContainer, { render: () => {
|
|
54
50
|
return (React.createElement(Header, { "aria-label": app.ariaLabel },
|
|
@@ -113,14 +109,11 @@ export const C3Navigation = ({ app, appBar, forwardRef, navbar, orgSideBar, info
|
|
|
113
109
|
} })),
|
|
114
110
|
infoButton || helpCenter ? (React.createElement(InfoButton, { onClick: infoButton
|
|
115
111
|
? infoButton.onClick
|
|
116
|
-
: () => setIsHelpCenterOpen(
|
|
112
|
+
: () => setIsHelpCenterOpen(!isHelpCenterOpen) })) : (infoSideBar && (React.createElement(C3InfoSidebar, { sideBar: { ...infoSideBar, type: "info" } }))),
|
|
117
113
|
userSideBar && (React.createElement(C3UserSidebar, { sideBar: {
|
|
118
114
|
...userSideBar,
|
|
119
115
|
type: "user",
|
|
120
116
|
} })))));
|
|
121
117
|
} }),
|
|
122
|
-
helpCenter &&
|
|
123
|
-
setIsHelpCenterOpen(false);
|
|
124
|
-
helpCenter.onRequestClose;
|
|
125
|
-
}, autoStartSurvey: true }))));
|
|
118
|
+
helpCenter && React.createElement(C3HelpCenter, { ...helpCenter, autoStartSurvey: true })));
|
|
126
119
|
};
|
|
@@ -59,9 +59,7 @@ export interface C3NavigationProps {
|
|
|
59
59
|
infoButton?: {
|
|
60
60
|
onClick: () => void;
|
|
61
61
|
};
|
|
62
|
-
helpCenter?:
|
|
63
|
-
isOpen?: boolean;
|
|
64
|
-
};
|
|
62
|
+
helpCenter?: C3HelpCenterProps;
|
|
65
63
|
actionButtons?: C3ActionButtonsProps;
|
|
66
64
|
userSideBar?: WithoutType<C3NavigationUserSideBarProps>;
|
|
67
65
|
notificationSideBar?: WithoutType<C3NavigationNotificationsSideBarProps>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useState } from "react";
|
|
2
2
|
import { C3ProfileProvider } from "./c3-profile-provider/c3-profile-provider";
|
|
3
3
|
import { decodeJWT } from "./authToken";
|
|
4
|
+
import { C3HelpCenterProvider } from "../c3-help-center/c3-help-center-provider";
|
|
4
5
|
export const C3UserConfigurationContext = React.createContext({
|
|
5
6
|
stage: "dev",
|
|
6
7
|
activeOrganizationId: "",
|
|
@@ -15,7 +16,8 @@ const C3UserConfigurationProvider = ({ children, ...config }) => {
|
|
|
15
16
|
setDecodedToken(decodeJWT(config.userToken));
|
|
16
17
|
}, [config.userToken]);
|
|
17
18
|
return (React.createElement(C3UserConfigurationContext.Provider, { value: { ...config, decodedToken } },
|
|
18
|
-
React.createElement(C3ProfileProvider, null,
|
|
19
|
+
React.createElement(C3ProfileProvider, null,
|
|
20
|
+
React.createElement(C3HelpCenterProvider, null, children))));
|
|
19
21
|
};
|
|
20
22
|
export const useC3UserConfiguration = () => useContext(C3UserConfigurationContext);
|
|
21
23
|
export default C3UserConfigurationProvider;
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -9,3 +9,4 @@ export { useC3Profile } from "./components/c3-user-configuration/c3-profile-prov
|
|
|
9
9
|
export { C3UserConfiguration, default as C3UserConfigurationProvider, } from "./components/c3-user-configuration/c3-user-configuration-provider";
|
|
10
10
|
export { C3AppMenuIcon } from "./icons/c3-icons";
|
|
11
11
|
export { C3IconProps } from "./icons/c3-icons.types";
|
|
12
|
+
export { useC3HelpCenter } from "./components/c3-help-center/c3-help-center-provider";
|
package/lib/esm/index.js
CHANGED
|
@@ -5,3 +5,4 @@ export { default as C3Navigation } from "./components/c3-navigation";
|
|
|
5
5
|
export { useC3Profile } from "./components/c3-user-configuration/c3-profile-provider/c3-profile-provider";
|
|
6
6
|
export { default as C3UserConfigurationProvider, } from "./components/c3-user-configuration/c3-user-configuration-provider";
|
|
7
7
|
export { C3AppMenuIcon } from "./icons/c3-icons";
|
|
8
|
+
export { useC3HelpCenter } from "./components/c3-help-center/c3-help-center-provider";
|