@camunda/camunda-composite-components 0.0.31-rc2 → 0.0.32-np-rc1

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.
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { C3NavigationElementProps } from "../c3-navigation.types";
2
3
  import { Notification } from "../../../api/notifications";
3
4
  export declare type C3NavigationSideBarBaseProps = {
@@ -29,6 +30,7 @@ export declare type C3NavigationInfoSideBarProps = C3NavigationSideBarBaseProps
29
30
  export declare type C3NavigationUserSideBarProps = C3NavigationSideBarBaseProps & {
30
31
  type: "user";
31
32
  customElements?: {
33
+ customSection?: JSX.Element;
32
34
  profile?: {
33
35
  label: string;
34
36
  user: {
@@ -96,7 +96,7 @@ export const C3NotificationSidebar = ({ sideBar }) => {
96
96
  if (notification.state === "new") {
97
97
  markAsRead(notification);
98
98
  }
99
- }, onDismiss: () => dismiss(notification), onLinkClick: () => {
99
+ }, onDismiss: () => dismiss(notification), originalOnLinkClick: onLinkClick, onLinkClick: () => {
100
100
  if (enabled && analytics) {
101
101
  analytics("notification-clicked-cta", notification.meta?.identifier);
102
102
  }
@@ -7,6 +7,7 @@ const C3UserSidebar = ({ sideBar }) => {
7
7
  const profile = sideBar.customElements?.profile;
8
8
  const themeSelector = sideBar.customElements?.themeSelector;
9
9
  const stageToggle = sideBar.customElements?.stageToggle;
10
+ const customSection = sideBar.customElements?.customSection;
10
11
  const [isSidebarOpen, setIsSidebarOpen] = useState(isOpen);
11
12
  const itemTabIndex = isSidebarOpen ? undefined : -1;
12
13
  return (React.createElement(C3NavigationSideBar, { sideBar: {
@@ -14,7 +15,7 @@ const C3UserSidebar = ({ sideBar }) => {
14
15
  ariaLabel: sideBarProps.ariaLabel || "User Sidebar",
15
16
  isOpen: isSidebarOpen,
16
17
  setIsOpen: setIsSidebarOpen,
17
- }, icon: React.createElement(UserAvatar, { size: 20 }) },
18
+ }, icon: React.createElement(UserAvatar, { size: 20 }), bottomChildren: customSection },
18
19
  profile && (React.createElement("div", { style: {
19
20
  padding: "1rem",
20
21
  paddingTop: "1.5rem",
@@ -35,54 +35,39 @@ const C3NavigationAppBar = ({ appBar, forwardRef, navbar, }) => {
35
35
  appBar.elements.map((element) => {
36
36
  if (element.subElements && element.subElements.length > 0) {
37
37
  return (React.createElement(SideNavMenu, { large: true, title: element.label, key: element.key }, element.subElements.map((subElement) => (React.createElement(SideNavMenuItem, { key: subElement.key, href: subElement.href, target: subElement.href ? subElement.target : undefined, onClick: () => {
38
- let handlerAvailable = false;
39
38
  if (subElement.onClick) {
40
- handlerAvailable = true;
41
39
  subElement.onClick();
42
40
  }
43
41
  if (appBar.closeOnClick !== false) {
44
- handlerAvailable = true;
45
42
  setAppBarOpen(false);
46
43
  }
47
44
  if (appBar.elementClicked) {
48
- handlerAvailable = true;
49
45
  appBar.elementClicked(subElement.key);
50
46
  }
51
- return handlerAvailable;
52
47
  } },
53
48
  React.createElement(C3NavigationExternalLink, { label: subElement.label }))))));
54
49
  }
55
50
  else {
56
51
  return element.routeProps ? (React.createElement(SideNavLink, { element: forwardRef, key: element.key, large: true, isActive: element.active, ...element.routeProps, onClick: () => {
57
- let handlerAvailable = false;
58
52
  if (element.onClick) {
59
- handlerAvailable = true;
60
53
  element.onClick();
61
54
  }
62
55
  if (appBar.closeOnClick !== false) {
63
- handlerAvailable = true;
64
56
  setAppBarOpen(false);
65
57
  }
66
58
  if (appBar.elementClicked) {
67
- handlerAvailable = true;
68
59
  appBar.elementClicked(element.key);
69
60
  }
70
- return handlerAvailable;
71
61
  } }, element.label)) : (React.createElement(SideNavLink, { key: element.key, large: true, onClick: () => {
72
- let handlerAvailable = false;
73
62
  if (element.onClick) {
74
- handlerAvailable = true;
75
63
  element.onClick();
76
64
  }
77
65
  if (appBar.closeOnClick !== false) {
78
- handlerAvailable = true;
79
66
  setAppBarOpen(false);
80
67
  }
81
68
  if (appBar.elementClicked) {
82
- handlerAvailable = true;
83
69
  appBar.elementClicked(element.key);
84
70
  }
85
- return handlerAvailable;
86
71
  }, href: element.href, target: element.href ? element.target : undefined }, element.label));
87
72
  }
88
73
  })))));
@@ -7,6 +7,7 @@ declare const C3NotificationContainer: FC<NotificationProps & {
7
7
  onRead: () => void;
8
8
  onDismiss: () => void;
9
9
  onLinkClick?: (meta: NotificationProps["meta"]) => void;
10
+ originalOnLinkClick?: (meta: NotificationProps["meta"]) => void;
10
11
  unread?: boolean;
11
12
  }>;
12
13
  export default C3NotificationContainer;
@@ -73,14 +73,15 @@ const getReadableTimestamp = (timestamp) => {
73
73
  }
74
74
  return date.toDateString();
75
75
  };
76
- const C3NotificationContainer = ({ description, state, timestamp, title, onDismiss, meta, onLinkClick, unread = false, }) => {
76
+ const C3NotificationContainer = ({ description, state, timestamp, title, onDismiss, meta, onLinkClick, originalOnLinkClick, unread = false, }) => {
77
77
  const [isHovering, setIsHovering] = useState(false);
78
78
  const dismissNotification = (e) => {
79
79
  e.stopPropagation();
80
80
  onDismiss();
81
81
  };
82
- const handleLinkClick = () => {
83
- if (onLinkClick) {
82
+ const handleLinkClick = (event) => {
83
+ if (originalOnLinkClick && onLinkClick) {
84
+ event.preventDefault();
84
85
  onLinkClick(meta);
85
86
  return false;
86
87
  }
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { C3NavigationAppProps, C3NavigationElementProps, C3NavigationNavBarProps, C3NavigationProps } from "./c3-navigation.types";
2
3
  export declare function createAppProps(): C3NavigationAppProps;
3
4
  export declare function createAppBarProps(options?: {
@@ -17,6 +18,7 @@ export declare function createOrgSideBarProps(options: {
17
18
  }): C3NavigationProps["orgSideBar"];
18
19
  export declare function createUserSideBarProps(options: {
19
20
  isOpen: boolean;
21
+ customSection?: JSX.Element;
20
22
  }): C3NavigationProps["userSideBar"];
21
23
  export declare function createNotificationSideBarProps(options: {
22
24
  isOpen: boolean;
@@ -131,6 +131,7 @@ export function createUserSideBarProps(options) {
131
131
  return {
132
132
  isOpen: options.isOpen,
133
133
  customElements: {
134
+ customSection: options.customSection,
134
135
  profile: {
135
136
  label: "Profile",
136
137
  user: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/camunda-composite-components",
3
- "version": "0.0.31-rc2",
3
+ "version": "0.0.32-np-rc1",
4
4
  "scripts": {
5
5
  "clean": "rimraf lib/",
6
6
  "copy-css-files": "copyfiles -u 1 src/components/**/*.css lib/esm",