@camunda/camunda-composite-components 0.2.10 → 0.2.11-rc.1
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 +10 -0
- package/lib/esm/components/c3-help-center/c3-help-center-provider.js +25 -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 -7
- package/lib/esm/components/c3-navigation/c3-navigation.types.d.ts +1 -1
- package/lib/esm/components/c3-navigation/index.js +2 -1
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/package.json +11 -11
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { ComponentType, 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 function withHelpCenter<P>(Component: ComponentType<P>): ComponentType<P>;
|
|
10
|
+
export declare const useC3HelpCenter: () => C3HelpCenterContextValue;
|
|
@@ -0,0 +1,25 @@
|
|
|
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 function withHelpCenter(Component) {
|
|
20
|
+
return function WithNamespace(props) {
|
|
21
|
+
return (React.createElement(C3HelpCenterProvider, null,
|
|
22
|
+
React.createElement(Component, { ...props })));
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
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,12 +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(false);
|
|
47
48
|
return (React.createElement(C3SidebarStateProvider, { isNotificationSidebarOpen: notificationSideBar?.isOpen, isOrgSidebarOpen: orgSideBar?.isOpen, isInfoSidebarOpen: infoSideBar?.isOpen, isUserSidebarOpen: userSideBar?.isOpen },
|
|
48
49
|
React.createElement(HeaderContainer, { render: () => {
|
|
49
50
|
return (React.createElement(Header, { "aria-label": app.ariaLabel },
|
|
@@ -108,14 +109,11 @@ export const C3Navigation = ({ app, appBar, forwardRef, navbar, orgSideBar, info
|
|
|
108
109
|
} })),
|
|
109
110
|
infoButton || helpCenter ? (React.createElement(InfoButton, { onClick: infoButton
|
|
110
111
|
? infoButton.onClick
|
|
111
|
-
: () => setIsHelpCenterOpen(
|
|
112
|
+
: () => setIsHelpCenterOpen(!isHelpCenterOpen) })) : (infoSideBar && (React.createElement(C3InfoSidebar, { sideBar: { ...infoSideBar, type: "info" } }))),
|
|
112
113
|
userSideBar && (React.createElement(C3UserSidebar, { sideBar: {
|
|
113
114
|
...userSideBar,
|
|
114
115
|
type: "user",
|
|
115
116
|
} })))));
|
|
116
117
|
} }),
|
|
117
|
-
helpCenter &&
|
|
118
|
-
setIsHelpCenterOpen(false);
|
|
119
|
-
helpCenter.onRequestClose;
|
|
120
|
-
}, autoStartSurvey: true }))));
|
|
118
|
+
helpCenter && React.createElement(C3HelpCenter, { ...helpCenter, autoStartSurvey: true })));
|
|
121
119
|
};
|
|
@@ -59,7 +59,7 @@ export interface C3NavigationProps {
|
|
|
59
59
|
infoButton?: {
|
|
60
60
|
onClick: () => void;
|
|
61
61
|
};
|
|
62
|
-
helpCenter?:
|
|
62
|
+
helpCenter?: C3HelpCenterProps;
|
|
63
63
|
actionButtons?: C3ActionButtonsProps;
|
|
64
64
|
userSideBar?: WithoutType<C3NavigationUserSideBarProps>;
|
|
65
65
|
notificationSideBar?: WithoutType<C3NavigationNotificationsSideBarProps>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { C3Navigation } from "./c3-navigation";
|
|
2
2
|
import { withNotifications } from "./c3-notification-provider/c3-notification-provider";
|
|
3
|
-
|
|
3
|
+
import { withHelpCenter } from "../c3-help-center/c3-help-center-provider";
|
|
4
|
+
export default withNotifications(withHelpCenter(C3Navigation));
|
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";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camunda/camunda-composite-components",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11-rc.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"clean": "rimraf lib/",
|
|
6
6
|
"build": "yarn clean && tsc",
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
"@carbon/react": "1.37.0",
|
|
34
34
|
"@mdx-js/react": "2.3.0",
|
|
35
35
|
"@playwright/test": "1.37.1",
|
|
36
|
-
"@storybook/addon-a11y": "7.4.
|
|
37
|
-
"@storybook/addon-actions": "7.4.
|
|
38
|
-
"@storybook/addon-docs": "7.4.
|
|
39
|
-
"@storybook/addon-essentials": "7.4.
|
|
40
|
-
"@storybook/addon-interactions": "7.4.
|
|
41
|
-
"@storybook/addon-links": "7.4.
|
|
42
|
-
"@storybook/blocks": "7.4.
|
|
36
|
+
"@storybook/addon-a11y": "7.4.5",
|
|
37
|
+
"@storybook/addon-actions": "7.4.5",
|
|
38
|
+
"@storybook/addon-docs": "7.4.5",
|
|
39
|
+
"@storybook/addon-essentials": "7.4.5",
|
|
40
|
+
"@storybook/addon-interactions": "7.4.5",
|
|
41
|
+
"@storybook/addon-links": "7.4.5",
|
|
42
|
+
"@storybook/blocks": "7.4.5",
|
|
43
43
|
"@storybook/preset-scss": "1.0.3",
|
|
44
|
-
"@storybook/react": "7.4.
|
|
45
|
-
"@storybook/react-webpack5": "7.4.
|
|
44
|
+
"@storybook/react": "7.4.5",
|
|
45
|
+
"@storybook/react-webpack5": "7.4.5",
|
|
46
46
|
"@storybook/test-runner": "0.13.0",
|
|
47
47
|
"@storybook/testing-library": "0.2.1",
|
|
48
48
|
"@types/carbon-components-react": "7.55.3",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"sass": "1.66.1",
|
|
77
77
|
"sass-loader": "13.3.2",
|
|
78
78
|
"serve": "14.2.1",
|
|
79
|
-
"storybook": "7.4.
|
|
79
|
+
"storybook": "7.4.5",
|
|
80
80
|
"style-loader": "3.3.3",
|
|
81
81
|
"styled-components": "6.0.7",
|
|
82
82
|
"typescript": "5.2.2",
|