@camunda/camunda-composite-components 0.22.5 → 0.22.7

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/camunda-composite-components",
3
- "version": "0.22.5",
3
+ "version": "0.22.7",
4
4
  "description": "Camunda Composite Components",
5
5
  "bugs": {
6
6
  "url": "https://github.com/camunda/camunda-cloud-management-apps/issues"
@@ -58,34 +58,34 @@
58
58
  "@auth0/auth0-spa-js": "2.18.0",
59
59
  "@camunda/ccma-shared-types": "workspace:*",
60
60
  "@carbon/react": "1.103.0",
61
- "@chromatic-com/storybook": "5.0.2",
61
+ "@chromatic-com/storybook": "5.1.1",
62
62
  "@mdx-js/react": "3.1.1",
63
63
  "@playwright/test": "1.58.2",
64
- "@storybook/addon-a11y": "10.3.1",
65
- "@storybook/addon-docs": "10.3.1",
66
- "@storybook/addon-links": "10.3.1",
67
- "@storybook/addon-vitest": "10.3.1",
68
- "@storybook/react": "10.3.1",
69
- "@storybook/react-vite": "10.3.1",
70
- "@vitest/browser": "4.1.0",
71
- "@vitest/browser-playwright": "4.1.0",
72
- "vitest": "4.1.0",
64
+ "@storybook/addon-a11y": "10.3.3",
65
+ "@storybook/addon-docs": "10.3.3",
66
+ "@storybook/addon-links": "10.3.3",
67
+ "@storybook/addon-vitest": "10.3.3",
68
+ "@storybook/react": "10.3.3",
69
+ "@storybook/react-vite": "10.3.3",
70
+ "@vitest/browser": "4.1.1",
71
+ "@vitest/browser-playwright": "4.1.1",
72
+ "vitest": "4.1.1",
73
73
  "conventional-changelog-conventionalcommits": "9.3.0",
74
74
  "eslint-import-resolver-typescript": "4.4.4",
75
75
  "eslint-plugin-react": "7.37.5",
76
76
  "eslint-plugin-react-hooks": "7.0.1",
77
- "eslint-plugin-storybook": "10.3.1",
77
+ "eslint-plugin-storybook": "10.3.3",
78
78
  "event-source-polyfill": "1.0.31",
79
- "mixpanel-browser": "2.76.0",
79
+ "mixpanel-browser": "2.77.0",
80
80
  "playwright": "1.58.2",
81
81
  "react": "19.2.4",
82
82
  "react-dom": "19.2.4",
83
83
  "react-is": "19.2.4",
84
84
  "rimraf": "6.1.3",
85
85
  "serve": "14.2.6",
86
- "storybook": "10.3.1",
86
+ "storybook": "10.3.3",
87
87
  "styled-components": "6.3.12",
88
- "typescript-eslint": "8.57.1",
88
+ "typescript-eslint": "8.57.2",
89
89
  "wait-on": "9.0.4"
90
90
  },
91
91
  "peerDependencies": {
@@ -6,7 +6,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
6
6
  */
7
7
  import { FormLabel, HeaderGlobalAction, HeaderMenuItem, HeaderSideNavItems, Modal, SideNavItems, SideNavLink, SideNavMenu, SideNavMenuItem, } from '@carbon/react';
8
8
  import { Close } from '@carbon/react/icons/index.esm.js';
9
- import { useCallback, useEffect, useState } from 'react';
9
+ import { Fragment, useCallback, useEffect, useState } from 'react';
10
10
  import { styled } from 'styled-components';
11
11
  import { C3AppMenuIcon } from '../../../assets/c3-icons.js';
12
12
  import { useClusterUpdate } from '../../../contexts/c3-cluster-update-manager.js';
@@ -107,6 +107,14 @@ const SubElementWrapper = styled.ul `
107
107
  visibility: inherit;
108
108
  }
109
109
  `;
110
+ const AppBarDivider = styled.li.attrs({
111
+ role: 'separator',
112
+ 'aria-hidden': 'true',
113
+ }) `
114
+ border-top: 1px solid var(--cds-border-subtle);
115
+ margin: 0.5rem 1rem;
116
+ list-style: none;
117
+ `;
110
118
  export const C3NavigationAppBar = ({ app: appProps, appBar, forwardRef, navbar, toggleAppbar, }) => {
111
119
  const { currentApp, domain, analyticsTrack, currentClusterUuid } = useC3UserConfiguration();
112
120
  const { orgs, clusters, setClusters, activeOrg, isEnabled, loadClustersById, } = useC3Profile();
@@ -326,7 +334,14 @@ export const C3NavigationAppBar = ({ app: appProps, appBar, forwardRef, navbar,
326
334
  }
327
335
  setAppElements(defaultElements);
328
336
  }, [clusters, currentApp, domain, handleSuperOrg]);
329
- const appBarElements = appBar.elements || (clusters || clustersByOrgId ? appElements : null);
337
+ const hasExtraAppBarElements = (appBar.extraElements?.length ?? 0) > 0;
338
+ const appBarElements = appBar.elements
339
+ ? appBar.elements
340
+ : clusters || clustersByOrgId
341
+ ? [...appElements, ...(appBar.extraElements ?? [])]
342
+ : hasExtraAppBarElements
343
+ ? appBar.extraElements
344
+ : null;
330
345
  const [isOrgPickerModalOpen, setIsOrgPickerModalOpen] = useState(false);
331
346
  const orgName = activeOrg?.name || navbar.orgName;
332
347
  return (_jsxs(_Fragment, { children: [_jsx(HeaderGlobalAction, { ref: iconRef, "aria-label": 'Camunda components', isActive: appBar.isOpen, onClick: () => {
@@ -342,39 +357,38 @@ export const C3NavigationAppBar = ({ app: appProps, appBar, forwardRef, navbar,
342
357
  if (appBar.closeOnClick !== false) {
343
358
  toggleAppbar(false);
344
359
  }
345
- }, children: element.label }, element.key))) })) }), _jsx("li", { children: _jsx(SubElementWrapper, { "$expanded": appBar.isOpen, children: appBarElements &&
346
- appBarElements.map((element) => {
347
- if (element.subElements && element.subElements.length > 0) {
348
- return (_jsx(SideNavMenu, { large: true, title: element.label, children: element.subElements.map((subElement) => (_jsx(SideNavMenuItem, { as: subElement.routeProps && forwardRef, href: subElement.href, target: subElement.href ? subElement.target : undefined, isActive: subElement.isActive || subElement.active, ...subElement.routeProps, onClick: () => {
349
- if (subElement.onClick) {
350
- subElement.onClick();
360
+ }, children: element.label }, element.key))) })) }), _jsx("li", { children: _jsx(SubElementWrapper, { "$expanded": appBar.isOpen, children: appBarElements?.map((element) => {
361
+ if (element.subElements && element.subElements.length > 0) {
362
+ return (_jsxs(Fragment, { children: [element.preceedingDivider && _jsx(AppBarDivider, {}), _jsx(SideNavMenu, { large: true, title: element.label, children: element.subElements.map((subElement) => (_jsx(SideNavMenuItem, { as: subElement.routeProps && forwardRef, href: subElement.href, target: subElement.href ? subElement.target : undefined, isActive: subElement.isActive || subElement.active, ...subElement.routeProps, onClick: () => {
363
+ if (subElement.onClick) {
364
+ subElement.onClick();
365
+ }
366
+ if (subElement.routeProps?.onClick) {
367
+ subElement.routeProps.onClick();
368
+ }
369
+ if (appBar.closeOnClick !== false) {
370
+ toggleAppbar(false);
371
+ }
372
+ if (appBar.elementClicked) {
373
+ appBar.elementClicked(subElement.key);
374
+ }
375
+ }, children: subElement.label }, subElement.key))) })] }, element.key));
376
+ }
377
+ else {
378
+ return (_jsxs(Fragment, { children: [element.preceedingDivider && _jsx(AppBarDivider, {}), _jsx(SideNavLink, { as: element.routeProps && forwardRef, large: true, isActive: element.active, ...element.routeProps, onClick: () => {
379
+ if (element.onClick) {
380
+ element.onClick();
351
381
  }
352
- if (subElement.routeProps?.onClick) {
353
- subElement.routeProps.onClick();
382
+ if (element.routeProps?.onClick) {
383
+ element.routeProps.onClick();
354
384
  }
355
385
  if (appBar.closeOnClick !== false) {
356
386
  toggleAppbar(false);
357
387
  }
358
388
  if (appBar.elementClicked) {
359
- appBar.elementClicked(subElement.key);
389
+ appBar.elementClicked(element.key);
360
390
  }
361
- }, children: subElement.label }, subElement.key))) }, element.key));
362
- }
363
- else {
364
- return (_jsx(SideNavLink, { as: element.routeProps && forwardRef, large: true, isActive: element.active, ...element.routeProps, onClick: () => {
365
- if (element.onClick) {
366
- element.onClick();
367
- }
368
- if (element.routeProps?.onClick) {
369
- element.routeProps.onClick();
370
- }
371
- if (appBar.closeOnClick !== false) {
372
- toggleAppbar(false);
373
- }
374
- if (appBar.elementClicked) {
375
- appBar.elementClicked(element.key);
376
- }
377
- }, href: element.href, target: element.href ? element.target : undefined, children: element.label }, element.key));
378
- }
379
- }) }) })] }) }) })] }));
391
+ }, href: element.href, target: element.href ? element.target : undefined, children: element.label })] }, element.key));
392
+ }
393
+ }) }) })] }) }) })] }));
380
394
  };
@@ -64,6 +64,7 @@ export type C3NavigationNotificationsSideBarProps = C3NavigationSideBarBaseProps
64
64
  type AppTeaserRouteProps = any;
65
65
  export type C3NavigationAppBarProps = Omit<C3NavigationSideBarBaseProps, 'tooltip'> & {
66
66
  type: 'app';
67
+ extraElements?: C3NavigationElementProps[];
67
68
  appTeaserRouteProps?: {
68
69
  operate?: AppTeaserRouteProps;
69
70
  tasklist?: AppTeaserRouteProps;
@@ -70,10 +70,13 @@ const LICENSE_EXPIRY = DAY * 30;
70
70
  export const C3Navigation = ({ app, appBar, forwardRef, navbar, orgSideBar, infoSideBar, infoButton, helpCenter, actionButtons, userSideBar, notificationSideBar, clusterUuid, options, }) => {
71
71
  const { openHelpCenter } = useC3HelpCenter();
72
72
  const { currentClusterUuid, decodedAudience } = useC3UserConfiguration();
73
- const { activeOrg } = useC3Profile();
73
+ const { activeOrg, isEnabled } = useC3Profile();
74
74
  const isLargeScreen = useMediaQuery(`(min-width: ${BREAKPOINT_LG_WIDTH}`);
75
75
  const appBarElementsLength = appBar.elements?.length ?? 0;
76
+ const appBarExtraElementsLength = appBar.extraElements?.length ?? 0;
76
77
  const displayAppBar = !!(appBarElementsLength > 0 ||
78
+ appBarExtraElementsLength > 0 ||
79
+ isEnabled ||
77
80
  appBar.appTeaserRouteProps ||
78
81
  (!isLargeScreen && navbar.elements.length > 0));
79
82
  const [appBarOpen, setAppBarOpen] = useState(appBar.isOpen || false);
@@ -14,6 +14,10 @@ test.describe('Navigation', () => {
14
14
  await getStory(page, 'uishell-c3navigation--app-bar-opened');
15
15
  await expect(page).toHaveScreenshot();
16
16
  });
17
+ test('App bar opened with extra elements', async ({ page }) => {
18
+ await getStory(page, 'uishell-c3navigation--app-bar-opened-with-extra-elements');
19
+ await expect(page).toHaveScreenshot();
20
+ });
17
21
  test('Org bar open', async ({ page }) => {
18
22
  await getStory(page, 'uishell-c3navigation--org-side-bar-opened');
19
23
  await expect(page).toHaveScreenshot();
@@ -5,6 +5,7 @@ export declare function createAppProps(): C3NavigationAppProps;
5
5
  export declare function createAppBarProps(options?: {
6
6
  isOpen?: boolean;
7
7
  elements?: Array<C3NavigationElementProps>;
8
+ extraElements?: Array<C3NavigationElementProps>;
8
9
  useElementsFromConfig?: boolean;
9
10
  }): C3NavigationProps['appBar'];
10
11
  export declare function createNavBarBarProps({ orgName, elements, showLicenseTag, showProductionLicense, isCommercial, expiresAt, }?: {
@@ -95,6 +95,7 @@ export function createAppBarProps(options = {}) {
95
95
  ],
96
96
  },
97
97
  ]),
98
+ extraElements: options.extraElements,
98
99
  elementClicked: (element) => console.log(`event coming from the appBarProps: ${element} has been clicked`),
99
100
  };
100
101
  }
@@ -15,7 +15,27 @@ export var VersionCheckOperator;
15
15
  VersionCheckOperator[VersionCheckOperator["SameMinor"] = 5] = "SameMinor";
16
16
  })(VersionCheckOperator || (VersionCheckOperator = {}));
17
17
  export const checkVersion = (params) => {
18
- if (!semver.valid(params.versionToCompareTo)) {
18
+ // quick exit: if the versionToCompareTo is
19
+ // - `SNAPSHOT` there is not a lot we can compare here to, so we return false directly
20
+ // - ends with `-SNAPSHOT` we ignore the `-SNAPSHOT` part for the comparison, guess a good matching semver compliant version and try to move on with the generated one in the code
21
+ if (params.versionToCompareTo === 'SNAPSHOT') {
22
+ return false;
23
+ }
24
+ let versionToCompareTo = params.versionToCompareTo;
25
+ if (versionToCompareTo.endsWith('-SNAPSHOT')) {
26
+ versionToCompareTo = versionToCompareTo.replace('-SNAPSHOT', '');
27
+ const parts = versionToCompareTo.split('.');
28
+ if (parts.length === 1) {
29
+ versionToCompareTo = `${parts[0]}.0.0`;
30
+ }
31
+ else if (parts.length === 2) {
32
+ versionToCompareTo = `${parts[0]}.${parts[1]}.0`;
33
+ }
34
+ else if (parts.length === 3) {
35
+ versionToCompareTo = `${parts[0]}.${parts[1]}.${parts[2]}`;
36
+ }
37
+ }
38
+ if (!semver.valid(versionToCompareTo)) {
19
39
  throw new Error('Invalid version to compare to');
20
40
  }
21
41
  let version = '';
@@ -44,11 +64,11 @@ export const checkVersion = (params) => {
44
64
  }
45
65
  }
46
66
  let parsedVersionToCompareTo = '';
47
- if (semver.valid(params.versionToCompareTo ?? '')) {
48
- parsedVersionToCompareTo = params.versionToCompareTo ?? '';
67
+ if (semver.valid(versionToCompareTo ?? '')) {
68
+ parsedVersionToCompareTo = versionToCompareTo ?? '';
49
69
  }
50
70
  else {
51
- const versionSplit = params.versionToCompareTo?.split(':') ?? [];
71
+ const versionSplit = versionToCompareTo?.split(':') ?? [];
52
72
  if (versionSplit.length > 1) {
53
73
  parsedVersionToCompareTo = versionSplit[1];
54
74
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/camunda-composite-components",
3
- "version": "0.22.5",
3
+ "version": "0.22.7",
4
4
  "description": "Camunda Composite Components",
5
5
  "bugs": {
6
6
  "url": "https://github.com/camunda/camunda-cloud-management-apps/issues"
@@ -31,36 +31,36 @@
31
31
  "devDependencies": {
32
32
  "@auth0/auth0-spa-js": "2.18.0",
33
33
  "@carbon/react": "1.103.0",
34
- "@chromatic-com/storybook": "5.0.2",
34
+ "@chromatic-com/storybook": "5.1.1",
35
35
  "@mdx-js/react": "3.1.1",
36
36
  "@playwright/test": "1.58.2",
37
- "@storybook/addon-a11y": "10.3.1",
38
- "@storybook/addon-docs": "10.3.1",
39
- "@storybook/addon-links": "10.3.1",
40
- "@storybook/addon-vitest": "10.3.1",
41
- "@storybook/react": "10.3.1",
42
- "@storybook/react-vite": "10.3.1",
43
- "@vitest/browser": "4.1.0",
44
- "@vitest/browser-playwright": "4.1.0",
45
- "vitest": "4.1.0",
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
46
  "conventional-changelog-conventionalcommits": "9.3.0",
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.1",
50
+ "eslint-plugin-storybook": "10.3.3",
51
51
  "event-source-polyfill": "1.0.31",
52
- "mixpanel-browser": "2.76.0",
52
+ "mixpanel-browser": "2.77.0",
53
53
  "playwright": "1.58.2",
54
54
  "react": "19.2.4",
55
55
  "react-dom": "19.2.4",
56
56
  "react-is": "19.2.4",
57
57
  "rimraf": "6.1.3",
58
58
  "serve": "14.2.6",
59
- "storybook": "10.3.1",
59
+ "storybook": "10.3.3",
60
60
  "styled-components": "6.3.12",
61
- "typescript-eslint": "8.57.1",
61
+ "typescript-eslint": "8.57.2",
62
62
  "wait-on": "9.0.4",
63
- "@camunda/ccma-shared-types": "0.0.3"
63
+ "@camunda/ccma-shared-types": "0.0.4"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "@carbon/react": "1.x",