@camunda/camunda-composite-components 0.22.7 → 0.23.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.
Files changed (42) hide show
  1. package/lib/esm/package.json +23 -23
  2. package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.d.ts +1 -0
  3. package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.js +24 -3
  4. package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.types.d.ts +1 -0
  5. package/lib/esm/src/components/c3-license-tag/c3-license-tag.d.ts +17 -0
  6. package/lib/esm/src/components/c3-license-tag/c3-license-tag.js +79 -0
  7. package/lib/esm/src/components/c3-license-tag/index.d.ts +1 -0
  8. package/lib/esm/src/components/c3-license-tag/index.js +6 -0
  9. package/lib/esm/src/components/c3-navigation/c3-org-sidebar/components.d.ts +3 -4
  10. package/lib/esm/src/components/c3-navigation-v2/c3-breadcrumb-bar.d.ts +7 -0
  11. package/lib/esm/src/components/c3-navigation-v2/c3-breadcrumb-bar.js +371 -0
  12. package/lib/esm/src/components/c3-navigation-v2/c3-navigation-v2.d.ts +9 -0
  13. package/lib/esm/src/components/c3-navigation-v2/c3-navigation-v2.js +72 -0
  14. package/lib/esm/src/components/c3-navigation-v2/c3-navigation-v2.types.d.ts +180 -0
  15. package/lib/esm/src/components/c3-navigation-v2/c3-navigation-v2.types.js +6 -0
  16. package/lib/esm/src/components/c3-navigation-v2/c3-sidebar.d.ts +8 -0
  17. package/lib/esm/src/components/c3-navigation-v2/c3-sidebar.js +357 -0
  18. package/lib/esm/src/components/c3-navigation-v2/c3-tools-area.d.ts +16 -0
  19. package/lib/esm/src/components/c3-navigation-v2/c3-tools-area.js +99 -0
  20. package/lib/esm/src/components/c3-navigation-v2/index.d.ts +18 -0
  21. package/lib/esm/src/components/c3-navigation-v2/index.js +15 -0
  22. package/lib/esm/src/components/c3-navigation-v2/stories/story-helpers.d.ts +10 -0
  23. package/lib/esm/src/components/c3-navigation-v2/stories/story-helpers.js +231 -0
  24. package/lib/esm/src/components/c3-navigation-v2/stories/story-templates.d.ts +11 -0
  25. package/lib/esm/src/components/c3-navigation-v2/stories/story-templates.js +796 -0
  26. package/lib/esm/src/components/c3-navigation-v2/tools/c3-info-panel.d.ts +11 -0
  27. package/lib/esm/src/components/c3-navigation-v2/tools/c3-info-panel.js +33 -0
  28. package/lib/esm/src/components/c3-navigation-v2/tools/c3-notifications-panel.d.ts +6 -0
  29. package/lib/esm/src/components/c3-navigation-v2/tools/c3-notifications-panel.js +52 -0
  30. package/lib/esm/src/components/c3-navigation-v2/tools/c3-user-panel.d.ts +30 -0
  31. package/lib/esm/src/components/c3-navigation-v2/tools/c3-user-panel.js +125 -0
  32. package/lib/esm/src/components/c3-navigation-v2/tools/panel-primitives.d.ts +7 -0
  33. package/lib/esm/src/components/c3-navigation-v2/tools/panel-primitives.js +16 -0
  34. package/lib/esm/src/components/c3-navigation-v2/use-c3-navigation-v2.d.ts +115 -0
  35. package/lib/esm/src/components/c3-navigation-v2/use-c3-navigation-v2.js +216 -0
  36. package/lib/esm/src/components/c3-navigation-v2/use-camunda-tools.d.ts +49 -0
  37. package/lib/esm/src/components/c3-navigation-v2/use-camunda-tools.js +75 -0
  38. package/lib/esm/src/components/c3-navigation-v2/use-cluster-webapp-breadcrumbs.d.ts +33 -0
  39. package/lib/esm/src/components/c3-navigation-v2/use-cluster-webapp-breadcrumbs.js +126 -0
  40. package/lib/esm/src/index.d.ts +5 -0
  41. package/lib/esm/src/index.js +3 -0
  42. package/package.json +23 -23
@@ -0,0 +1,75 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
4
+ * under one or more contributor license agreements. Licensed under a commercial license.
5
+ * You may not use this file except in compliance with the commercial license.
6
+ */
7
+ import { HeaderGlobalAction } from '@carbon/react';
8
+ import { Help as HelpIcon, Information, Notification as NotificationIcon, UserAvatar, } from '@carbon/react/icons/index.esm.js';
9
+ import { useContext, useMemo } from 'react';
10
+ import { C3NotificationsUnreadIcon } from '../../assets/c3-icons.js';
11
+ import { C3NotificationContext } from '../c3-navigation/c3-notification-provider/c3-notification-provider.js';
12
+ import { C3InfoPanel } from './tools/c3-info-panel.js';
13
+ import { C3NotificationsPanel } from './tools/c3-notifications-panel.js';
14
+ import { C3UserPanel } from './tools/c3-user-panel.js';
15
+ /**
16
+ * Single helper entry point for the standard Camunda tool set.
17
+ * Returns a ToolDescriptor[] ready to pass into C3NavigationV2's `tools` prop.
18
+ * Custom tools can be appended to the returned array.
19
+ *
20
+ * Must be called within a C3UserConfigurationProvider tree (SaaS).
21
+ */
22
+ export const useCamundaTools = (options) => {
23
+ const { notifications: notifCtx } = useContext(C3NotificationContext);
24
+ const hasUnread = notifCtx?.some((n) => n.state === 'new');
25
+ return useMemo(() => {
26
+ const tools = [];
27
+ if (options.notifications !== undefined) {
28
+ const notifOptions = options.notifications;
29
+ const label = notifOptions.ariaLabel ?? 'Notifications';
30
+ tools.push({
31
+ key: 'notifications',
32
+ label,
33
+ renderButton: ({ onClick, isActive }) => (_jsx(HeaderGlobalAction, { "aria-label": label, onClick: onClick, isActive: isActive, tooltipAlignment: 'center', ...{ leaveDelayMs: 100 }, children: hasUnread ? (_jsx(C3NotificationsUnreadIcon, { size: 20 })) : (_jsx(NotificationIcon, { size: 20 })) })),
34
+ panel: (_jsx(C3NotificationsPanel, { onLinkClick: notifOptions.onLinkClick })),
35
+ });
36
+ }
37
+ if (options.info !== undefined) {
38
+ const { elements, title, ariaLabel } = options.info;
39
+ const label = ariaLabel ?? 'Info';
40
+ tools.push({
41
+ key: 'info',
42
+ label,
43
+ renderButton: ({ onClick, isActive }) => (_jsx(HeaderGlobalAction, { "aria-label": label, onClick: onClick, isActive: isActive, tooltipAlignment: 'center', ...{ leaveDelayMs: 100 }, children: _jsx(Information, { size: 20 }) })),
44
+ panel: (_jsx(C3InfoPanel, { elements: elements, title: title })),
45
+ });
46
+ }
47
+ if (options.help !== undefined) {
48
+ const { onClick, ariaLabel } = options.help;
49
+ const label = ariaLabel ?? 'Help';
50
+ tools.push({
51
+ key: 'help',
52
+ label,
53
+ renderButton: ({ isActive: _isActive }) => (_jsx(HeaderGlobalAction, { "aria-label": label, onClick: onClick, tooltipAlignment: 'center', ...{ leaveDelayMs: 100 }, children: _jsx(HelpIcon, { size: 20 }) })),
54
+ // no panel, help is a plain button
55
+ });
56
+ }
57
+ if (options.user !== undefined) {
58
+ const { ariaLabel, ...panelProps } = options.user;
59
+ const label = ariaLabel ?? 'Account';
60
+ tools.push({
61
+ key: 'user',
62
+ label,
63
+ renderButton: ({ onClick, isActive }) => (_jsx(HeaderGlobalAction, { "aria-label": label, onClick: onClick, isActive: isActive, tooltipAlignment: 'end', ...{ leaveDelayMs: 100 }, children: _jsx(UserAvatar, { size: 20 }) })),
64
+ panel: (_jsx(C3UserPanel, { ...panelProps })),
65
+ });
66
+ }
67
+ return tools;
68
+ }, [
69
+ hasUnread,
70
+ options.notifications,
71
+ options.info,
72
+ options.help,
73
+ options.user,
74
+ ]);
75
+ };
@@ -0,0 +1,33 @@
1
+ import type { CamundaApp } from '../../utils/camunda.types';
2
+ import type { BreadcrumbDescriptor } from './use-c3-navigation-v2';
3
+ export interface UseClusterWebappBreadcrumbsOptions {
4
+ /** The app currently being viewed. */
5
+ currentApp: CamundaApp;
6
+ /**
7
+ * Optional resolver to convert an endpoint URL into linkProps.
8
+ * Defaults to `(url) => ({ href: url })`. Override to support
9
+ * client-side routing (e.g. returning `{ to: path }` for internal links).
10
+ */
11
+ resolveLinkProps?: (url: string, app: string) => {
12
+ href?: string;
13
+ to?: string;
14
+ [key: string]: unknown;
15
+ };
16
+ }
17
+ /**
18
+ * Builds the standard breadcrumb chain for a cluster-scoped Camunda webapp:
19
+ *
20
+ * [Org] > [Cluster] > [App ▾]
21
+ *
22
+ * - **Org crumb**: shown when org data is available (SaaS). Links back to
23
+ * web modeler at the org level.
24
+ * - **Cluster crumb**: shown when cluster data is available. Links back to
25
+ * web modeler / console at the cluster level.
26
+ * - **App crumb**: always shown. Includes a dropdown to switch between
27
+ * sibling apps on the same cluster (filtered to apps with endpoints).
28
+ *
29
+ * Crumbs are omitted when the underlying data is unavailable, so the same
30
+ * hook works for both SaaS (full chain) and Self-Managed (partial or single
31
+ * crumb) without any environment flag.
32
+ */
33
+ export declare function useClusterWebappBreadcrumbs(options: UseClusterWebappBreadcrumbsOptions): BreadcrumbDescriptor[];
@@ -0,0 +1,126 @@
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. Licensed under a commercial license.
4
+ * You may not use this file except in compliance with the commercial license.
5
+ */
6
+ import { Analytics, Application, Building, CloudApp, Diagram, Play, Settings, Task, } from '@carbon/react/icons/index.esm.js';
7
+ import { useMemo } from 'react';
8
+ import { useC3Profile } from '../c3-user-configuration/c3-profile-provider/c3-profile-provider.js';
9
+ import { useC3UserConfiguration } from '../c3-user-configuration/c3-user-configuration-provider.js';
10
+ const APP_ICONS = {
11
+ operate: Play,
12
+ tasklist: Task,
13
+ optimize: Analytics,
14
+ admin: Settings,
15
+ identity: Settings,
16
+ modeler: Diagram,
17
+ console: Application,
18
+ };
19
+ const APP_LABELS = {
20
+ operate: 'Operate',
21
+ tasklist: 'Tasklist',
22
+ optimize: 'Optimize',
23
+ admin: 'Admin',
24
+ identity: 'Admin',
25
+ modeler: 'Modeler',
26
+ console: 'Console',
27
+ };
28
+ /**
29
+ * Apps shown in the app-switcher dropdown. Order determines display order.
30
+ * `identity` is excluded: it was deprecated in favor of `admin` (8.9+).
31
+ * See `isAdminApp()` and `getEndpointForApp()` in `camunda.ts` for the
32
+ * aliasing/fallback logic that handles older clusters still using `identity`.
33
+ */
34
+ const SWITCHABLE_APPS = [
35
+ 'operate',
36
+ 'tasklist',
37
+ 'optimize',
38
+ 'admin',
39
+ ];
40
+ /**
41
+ * Builds the standard breadcrumb chain for a cluster-scoped Camunda webapp:
42
+ *
43
+ * [Org] > [Cluster] > [App ▾]
44
+ *
45
+ * - **Org crumb**: shown when org data is available (SaaS). Links back to
46
+ * web modeler at the org level.
47
+ * - **Cluster crumb**: shown when cluster data is available. Links back to
48
+ * web modeler / console at the cluster level.
49
+ * - **App crumb**: always shown. Includes a dropdown to switch between
50
+ * sibling apps on the same cluster (filtered to apps with endpoints).
51
+ *
52
+ * Crumbs are omitted when the underlying data is unavailable, so the same
53
+ * hook works for both SaaS (full chain) and Self-Managed (partial or single
54
+ * crumb) without any environment flag.
55
+ */
56
+ export function useClusterWebappBreadcrumbs(options) {
57
+ const { currentApp, resolveLinkProps = (url) => ({ href: url }) } = options;
58
+ const { clusters, activeOrg } = useC3Profile();
59
+ const config = useC3UserConfiguration();
60
+ const currentClusterUuid = config.currentClusterUuid;
61
+ const currentCluster = useMemo(() => clusters?.find((c) => c.uuid === currentClusterUuid) ?? null, [clusters, currentClusterUuid]);
62
+ return useMemo(() => {
63
+ const crumbs = [];
64
+ // ── Org crumb ──────────────────────────────────────────────────────────
65
+ if (activeOrg) {
66
+ const modelerUrl = currentCluster?.endpoints?.modeler;
67
+ crumbs.push({
68
+ key: 'org',
69
+ label: activeOrg.name,
70
+ icon: Building,
71
+ ...(modelerUrl
72
+ ? { linkProps: resolveLinkProps(modelerUrl, 'org') }
73
+ : {}),
74
+ });
75
+ }
76
+ // ── Cluster crumb ──────────────────────────────────────────────────────
77
+ if (currentCluster) {
78
+ const modelerUrl = currentCluster.endpoints?.modeler;
79
+ const clusterUrl = modelerUrl
80
+ ? `${modelerUrl}?fromCluster=${currentCluster.uuid}`
81
+ : undefined;
82
+ crumbs.push({
83
+ key: 'cluster',
84
+ label: currentCluster.name,
85
+ icon: CloudApp,
86
+ ...(clusterUrl
87
+ ? { linkProps: resolveLinkProps(clusterUrl, 'cluster') }
88
+ : {}),
89
+ });
90
+ }
91
+ // ── App crumb ──────────────────────────────────────────────────────────
92
+ const appLabel = APP_LABELS[currentApp] ?? currentApp;
93
+ const appIcon = APP_ICONS[currentApp] ?? Application;
94
+ const siblingApps = SWITCHABLE_APPS.filter((app) => app !== currentApp && currentCluster?.endpoints?.[app]);
95
+ const dropdownItems = siblingApps.length > 0
96
+ ? [
97
+ {
98
+ key: currentApp,
99
+ label: appLabel,
100
+ icon: APP_ICONS[currentApp] ?? Application,
101
+ isSelected: true,
102
+ },
103
+ ...siblingApps.map((app) => ({
104
+ key: app,
105
+ label: APP_LABELS[app] ?? app,
106
+ icon: APP_ICONS[app] ?? Application,
107
+ isSelected: false,
108
+ linkProps: resolveLinkProps(currentCluster?.endpoints[app] ?? '', app),
109
+ })),
110
+ ]
111
+ : undefined;
112
+ crumbs.push({
113
+ key: 'app',
114
+ label: appLabel,
115
+ icon: appIcon,
116
+ ...(dropdownItems
117
+ ? {
118
+ dropdownTitle: 'Switch application',
119
+ dropdownAriaLabel: 'Switch application',
120
+ dropdownItems,
121
+ }
122
+ : {}),
123
+ });
124
+ return crumbs;
125
+ }, [activeOrg, currentCluster, currentApp, resolveLinkProps]);
126
+ }
@@ -8,10 +8,15 @@ export { C3DataTable } from './components/c3-data-table/c3-data-table';
8
8
  export { C3DataTableActionProps, C3DataTableHeaderContentType, C3DataTableHeadersProps, C3DataTableProps, C3DataTableToolbarButtonItemProps, C3DataTableToolbarMenuButtonItemProps, C3DataTableToolbarMultiItemButtonProps, C3DataTableToolbarMultiSelectItemProps, C3DataTableToolbarProps, C3DataTableToolbarSearchItemProps, Filter, RowBaseProps, } from './components/c3-data-table/c3-data-table.types';
9
9
  export { C3EmptyState } from './components/c3-empty-state/c3-empty-state';
10
10
  export { Button as C3EmptyStateButton, C3EmptyStateProps, MenuButton as C3EmptyStateMenuButton, } from './components/c3-empty-state/c3-empty-state.types';
11
+ export type { C3HelpCenterProps } from './components/c3-help-center/c3-help-center';
12
+ export { C3HelpCenter } from './components/c3-help-center/c3-help-center';
11
13
  export { useC3HelpCenter } from './components/c3-help-center/c3-help-center-provider';
14
+ export { C3LicenseTag, type C3LicenseTagProps, } from './components/c3-license-tag';
12
15
  export { default as C3Navigation } from './components/c3-navigation';
13
16
  export { C3NavigationAppProps, C3NavigationElementProps, C3NavigationNavBarElement, C3NavigationNavBarProps, C3NavigationNavBarSubElement, C3NavigationProps, } from './components/c3-navigation/c3-navigation.types';
14
17
  export { C3NavigationSideBarBaseProps } from './components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.types';
18
+ export type { AppProps as C3NavV2AppProps, BreadcrumbDescriptor, BreadcrumbDropdownItem, BreadcrumbSegment, C3NavigationV2Props, C3NotificationsPanelProps, C3UserPanelProps, GlobalActionButton, GroupDescriptor, GroupItemDescriptor, HelpToolOptions, ItemDescriptor, LinkComponent, LinkProps, NotificationsToolOptions, SectionDescriptor, SidebarGroup, SidebarGroupItem, SidebarItem, SidebarNode, SidebarNodeDescriptor, SidebarProps, SidebarSection, ToolDescriptor, UseC3NavigationV2Options, UseC3NavigationV2Return, UseCamundaToolsOptions, UserToolOptions, } from './components/c3-navigation-v2';
19
+ export { C3BreadcrumbBar as preview_C3BreadcrumbBar, C3NavigationV2 as preview_C3NavigationV2, C3NotificationsPanel as preview_C3NotificationsPanel, C3Sidebar as preview_C3Sidebar, C3ToolsArea as preview_C3ToolsArea, C3UserPanel as preview_C3UserPanel, useC3NavigationV2 as preview_useC3NavigationV2, useCamundaTools as preview_useCamundaTools, useClusterWebappBreadcrumbs as preview_useClusterWebappBreadcrumbs, } from './components/c3-navigation-v2';
15
20
  export { C3BreadcrumbProps } from './components/c3-page/c3-breadcrumb/c3-breadcrumb.types';
16
21
  export { C3Page } from './components/c3-page/c3-page';
17
22
  export { C3PageProps } from './components/c3-page/c3-page.types';
@@ -9,8 +9,11 @@ export { C3ClusterTag, C3ClusterTagWithClusterName as C3ClusterTagWithName, } fr
9
9
  export { StageClusterLabels, } from './components/c3-cluster-tag/c3-cluster-tag.types.js';
10
10
  export { C3DataTable } from './components/c3-data-table/c3-data-table.js';
11
11
  export { C3EmptyState } from './components/c3-empty-state/c3-empty-state.js';
12
+ export { C3HelpCenter } from './components/c3-help-center/c3-help-center.js';
12
13
  export { useC3HelpCenter } from './components/c3-help-center/c3-help-center-provider.js';
14
+ export { C3LicenseTag, } from './components/c3-license-tag/index.js';
13
15
  export { default as C3Navigation } from './components/c3-navigation/index.js';
16
+ export { C3BreadcrumbBar as preview_C3BreadcrumbBar, C3NavigationV2 as preview_C3NavigationV2, C3NotificationsPanel as preview_C3NotificationsPanel, C3Sidebar as preview_C3Sidebar, C3ToolsArea as preview_C3ToolsArea, C3UserPanel as preview_C3UserPanel, useC3NavigationV2 as preview_useC3NavigationV2, useCamundaTools as preview_useCamundaTools, useClusterWebappBreadcrumbs as preview_useClusterWebappBreadcrumbs, } from './components/c3-navigation-v2/index.js';
14
17
  export { C3Page } from './components/c3-page/c3-page.js';
15
18
  export { C3ResponsiveStack } from './components/c3-responsive-stack/c3-responsive-stack.js';
16
19
  export { useC3Profile } from './components/c3-user-configuration/c3-profile-provider/c3-profile-provider.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/camunda-composite-components",
3
- "version": "0.22.7",
3
+ "version": "0.23.0",
4
4
  "description": "Camunda Composite Components",
5
5
  "bugs": {
6
6
  "url": "https://github.com/camunda/camunda-cloud-management-apps/issues"
@@ -29,37 +29,37 @@
29
29
  "semver": "7.7.4"
30
30
  },
31
31
  "devDependencies": {
32
- "@auth0/auth0-spa-js": "2.18.0",
32
+ "@auth0/auth0-spa-js": "2.19.0",
33
33
  "@carbon/react": "1.103.0",
34
34
  "@chromatic-com/storybook": "5.1.1",
35
35
  "@mdx-js/react": "3.1.1",
36
- "@playwright/test": "1.58.2",
37
- "@storybook/addon-a11y": "10.3.3",
38
- "@storybook/addon-docs": "10.3.3",
39
- "@storybook/addon-links": "10.3.3",
40
- "@storybook/addon-vitest": "10.3.3",
41
- "@storybook/react": "10.3.3",
42
- "@storybook/react-vite": "10.3.3",
43
- "@vitest/browser": "4.1.1",
44
- "@vitest/browser-playwright": "4.1.1",
45
- "vitest": "4.1.1",
46
- "conventional-changelog-conventionalcommits": "9.3.0",
36
+ "@playwright/test": "1.59.1",
37
+ "@storybook/addon-a11y": "10.3.5",
38
+ "@storybook/addon-docs": "10.3.5",
39
+ "@storybook/addon-links": "10.3.5",
40
+ "@storybook/addon-vitest": "10.3.5",
41
+ "@storybook/react": "10.3.5",
42
+ "@storybook/react-vite": "10.3.5",
43
+ "@vitest/browser": "4.1.4",
44
+ "@vitest/browser-playwright": "4.1.4",
45
+ "vitest": "4.1.4",
46
+ "conventional-changelog-conventionalcommits": "9.3.1",
47
47
  "eslint-import-resolver-typescript": "4.4.4",
48
48
  "eslint-plugin-react": "7.37.5",
49
49
  "eslint-plugin-react-hooks": "7.0.1",
50
- "eslint-plugin-storybook": "10.3.3",
50
+ "eslint-plugin-storybook": "10.3.5",
51
51
  "event-source-polyfill": "1.0.31",
52
- "mixpanel-browser": "2.77.0",
53
- "playwright": "1.58.2",
54
- "react": "19.2.4",
55
- "react-dom": "19.2.4",
56
- "react-is": "19.2.4",
52
+ "mixpanel-browser": "2.78.0",
53
+ "playwright": "1.59.1",
54
+ "react": "19.2.5",
55
+ "react-dom": "19.2.5",
56
+ "react-is": "19.2.5",
57
57
  "rimraf": "6.1.3",
58
58
  "serve": "14.2.6",
59
- "storybook": "10.3.3",
60
- "styled-components": "6.3.12",
61
- "typescript-eslint": "8.57.2",
62
- "wait-on": "9.0.4",
59
+ "storybook": "10.3.5",
60
+ "styled-components": "6.4.0",
61
+ "typescript-eslint": "8.58.1",
62
+ "wait-on": "9.0.5",
63
63
  "@camunda/ccma-shared-types": "0.0.4"
64
64
  },
65
65
  "peerDependencies": {