@camunda/camunda-composite-components 0.22.3 → 0.22.5
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/package.json +98 -0
- package/lib/esm/src/api/api.d.ts +29 -0
- package/lib/esm/src/api/api.js +92 -0
- package/lib/esm/src/api/clusters.d.ts +10 -0
- package/lib/esm/src/api/clusters.js +32 -0
- package/lib/esm/src/api/endpoints.const.d.ts +22 -0
- package/lib/esm/src/api/endpoints.const.js +70 -0
- package/lib/esm/src/api/help-center.d.ts +42 -0
- package/lib/esm/src/api/help-center.js +56 -0
- package/lib/esm/src/api/jwt.utils.d.ts +5 -0
- package/lib/esm/src/api/jwt.utils.js +26 -0
- package/lib/esm/src/api/notifications.d.ts +41 -0
- package/lib/esm/src/api/notifications.js +170 -0
- package/lib/esm/src/api/organizations.d.ts +15 -0
- package/lib/esm/src/api/organizations.js +16 -0
- package/lib/esm/src/api/profile.d.ts +20 -0
- package/lib/esm/src/api/profile.js +48 -0
- package/lib/esm/src/api/status.d.ts +7 -0
- package/lib/esm/src/api/status.js +46 -0
- package/lib/esm/src/assets/c3-icons.d.ts +5 -0
- package/lib/esm/src/assets/c3-icons.js +5 -0
- package/lib/esm/src/assets/c3-icons.types.d.ts +3 -0
- package/lib/esm/src/assets/c3-icons.types.js +6 -0
- package/lib/esm/src/components/c3-app-teaser/app-teaser-cards-config.d.ts +5 -0
- package/lib/esm/src/components/c3-app-teaser/app-teaser-cards-config.js +94 -0
- package/lib/esm/src/components/c3-app-teaser/app-teaser-cards.d.ts +17 -0
- package/lib/esm/src/components/c3-app-teaser/app-teaser-cards.js +31 -0
- package/lib/esm/src/components/c3-app-teaser/app-teaster-card.d.ts +14 -0
- package/lib/esm/src/components/c3-app-teaser/app-teaster-card.js +24 -0
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser-page.d.ts +9 -0
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser-page.js +48 -0
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser-page.test.d.ts +1 -0
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser-page.test.js +33 -0
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser.d.ts +14 -0
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser.js +53 -0
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.d.ts +6 -0
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.js +84 -0
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.test.d.ts +1 -0
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.test.js +13 -0
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.types.d.ts +26 -0
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.types.js +11 -0
- package/lib/esm/src/components/c3-data-table/c3-data-table.d.ts +3 -0
- package/lib/esm/src/components/c3-data-table/c3-data-table.js +509 -0
- package/lib/esm/src/components/c3-data-table/c3-data-table.types.d.ts +122 -0
- package/lib/esm/src/components/c3-data-table/c3-data-table.types.js +6 -0
- package/lib/esm/src/components/c3-data-table/link-button/link-button.d.ts +3 -0
- package/lib/esm/src/components/c3-data-table/link-button/link-button.js +15 -0
- package/lib/esm/src/components/c3-data-table/link-button/link-button.types.d.ts +8 -0
- package/lib/esm/src/components/c3-data-table/link-button/link-button.types.js +6 -0
- package/lib/esm/src/components/c3-empty-state/c3-empty-state.d.ts +3 -0
- package/lib/esm/src/components/c3-empty-state/c3-empty-state.js +15 -0
- package/lib/esm/src/components/c3-empty-state/c3-empty-state.test.d.ts +1 -0
- package/lib/esm/src/components/c3-empty-state/c3-empty-state.test.js +25 -0
- package/lib/esm/src/components/c3-empty-state/c3-empty-state.types.d.ts +29 -0
- package/lib/esm/src/components/c3-empty-state/c3-empty-state.types.js +6 -0
- package/lib/esm/src/components/c3-help-center/c3-help-center-provider.d.ts +19 -0
- package/lib/esm/src/components/c3-help-center/c3-help-center-provider.js +58 -0
- package/lib/esm/src/components/c3-help-center/c3-help-center.d.ts +16 -0
- package/lib/esm/src/components/c3-help-center/c3-help-center.js +218 -0
- package/lib/esm/src/components/c3-help-center/c3-help-center.types.d.ts +43 -0
- package/lib/esm/src/components/c3-help-center/c3-help-center.types.js +6 -0
- package/lib/esm/src/components/c3-help-center/defaultHelpCenterConfig.d.ts +10 -0
- package/lib/esm/src/components/c3-help-center/defaultHelpCenterConfig.js +17 -0
- package/lib/esm/src/components/c3-help-center/help-center-hint.d.ts +4 -0
- package/lib/esm/src/components/c3-help-center/help-center-hint.js +15 -0
- package/lib/esm/src/components/c3-help-center/help-center.d.ts +18 -0
- package/lib/esm/src/components/c3-help-center/help-center.js +189 -0
- package/lib/esm/src/components/c3-help-center/recommendations.d.ts +4 -0
- package/lib/esm/src/components/c3-help-center/recommendations.js +55 -0
- package/lib/esm/src/components/c3-help-center/styles.d.ts +4 -0
- package/lib/esm/src/components/c3-help-center/styles.js +48 -0
- package/lib/esm/src/components/c3-help-center/tabs/feedback.d.ts +9 -0
- package/lib/esm/src/components/c3-help-center/tabs/feedback.js +141 -0
- package/lib/esm/src/components/c3-help-center/tabs/tabContent.d.ts +20 -0
- package/lib/esm/src/components/c3-help-center/tabs/tabContent.js +22 -0
- package/lib/esm/src/components/c3-help-center/tabs/tabContentSkeleton.d.ts +2 -0
- package/lib/esm/src/components/c3-help-center/tabs/tabContentSkeleton.js +26 -0
- package/lib/esm/src/components/c3-help-center/tile.d.ts +10 -0
- package/lib/esm/src/components/c3-help-center/tile.js +61 -0
- package/lib/esm/src/components/c3-navigation/c3-info-button.d.ts +4 -0
- package/lib/esm/src/components/c3-navigation/c3-info-button.js +9 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-actions/c3-action-buttons.d.ts +6 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-actions/c3-action-buttons.js +18 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-actions/c3-action-buttons.types.d.ts +10 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-actions/c3-action-buttons.types.js +6 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-appbar/c3-navigation-appbar.d.ts +4 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-appbar/c3-navigation-appbar.js +380 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-appbar/components.d.ts +2 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-appbar/components.js +21 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-info-sidebar.d.ts +6 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-info-sidebar.js +38 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar-element.d.ts +12 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar-element.js +68 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.d.ts +10 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.js +87 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.types.d.ts +81 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.types.js +6 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-notification-sidebar.d.ts +5 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-notification-sidebar.js +107 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-sidebar-state-provider.d.ts +29 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-sidebar-state-provider.js +54 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-user-sidebar.d.ts +6 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-user-sidebar.js +57 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/components.d.ts +2 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/components.js +11 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation.d.ts +7 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation.js +262 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation.test.d.ts +1 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation.test.js +89 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation.types.d.ts +97 -0
- package/lib/esm/src/components/c3-navigation/c3-navigation.types.js +6 -0
- package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-container.d.ts +13 -0
- package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-container.js +100 -0
- package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-provider.d.ts +19 -0
- package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-provider.js +110 -0
- package/lib/esm/src/components/c3-navigation/c3-org-name.d.ts +6 -0
- package/lib/esm/src/components/c3-navigation/c3-org-name.js +34 -0
- package/lib/esm/src/components/c3-navigation/c3-org-sidebar/c3-org-sidebar.d.ts +6 -0
- package/lib/esm/src/components/c3-navigation/c3-org-sidebar/c3-org-sidebar.js +188 -0
- package/lib/esm/src/components/c3-navigation/c3-org-sidebar/components.d.ts +29 -0
- package/lib/esm/src/components/c3-navigation/c3-org-sidebar/components.js +92 -0
- package/lib/esm/src/components/c3-navigation/helpers.d.ts +8 -0
- package/lib/esm/src/components/c3-navigation/helpers.js +58 -0
- package/lib/esm/src/components/c3-navigation/index.d.ts +2 -0
- package/lib/esm/src/components/c3-navigation/index.js +8 -0
- package/lib/esm/src/components/c3-navigation/stories/story-helpers.d.ts +35 -0
- package/lib/esm/src/components/c3-navigation/stories/story-helpers.js +264 -0
- package/lib/esm/src/components/c3-navigation/stories/story-templates.d.ts +9 -0
- package/lib/esm/src/components/c3-navigation/stories/story-templates.js +38 -0
- package/lib/esm/src/components/c3-onboarding-survey/c3-onboarding-survey.d.ts +14 -0
- package/lib/esm/src/components/c3-onboarding-survey/c3-onboarding-survey.js +94 -0
- package/lib/esm/src/components/c3-onboarding-survey/defaultOnboardingConfig.d.ts +16 -0
- package/lib/esm/src/components/c3-onboarding-survey/defaultOnboardingConfig.js +8 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/dropdownSelect.d.ts +15 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/dropdownSelect.js +58 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/inlineNotification.d.ts +3 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/inlineNotification.js +10 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/radioGroupMulti.d.ts +7 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/radioGroupMulti.js +53 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/radioGroupSingle.d.ts +7 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/radioGroupSingle.js +36 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/textField.d.ts +6 -0
- package/lib/esm/src/components/c3-onboarding-survey/elements/textField.js +14 -0
- package/lib/esm/src/components/c3-onboarding-survey/helpers.d.ts +1 -0
- package/lib/esm/src/components/c3-onboarding-survey/helpers.js +10 -0
- package/lib/esm/src/components/c3-onboarding-survey/onboarding.types.d.ts +30 -0
- package/lib/esm/src/components/c3-onboarding-survey/onboarding.types.js +13 -0
- package/lib/esm/src/components/c3-onboarding-survey/onboardingModal.d.ts +25 -0
- package/lib/esm/src/components/c3-onboarding-survey/onboardingModal.js +52 -0
- package/lib/esm/src/components/c3-onboarding-survey/onboardingPage.d.ts +21 -0
- package/lib/esm/src/components/c3-onboarding-survey/onboardingPage.js +35 -0
- package/lib/esm/src/components/c3-onboarding-survey/onboardingSurvey.d.ts +17 -0
- package/lib/esm/src/components/c3-onboarding-survey/onboardingSurvey.js +148 -0
- package/lib/esm/src/components/c3-onboarding-survey/step.d.ts +7 -0
- package/lib/esm/src/components/c3-onboarding-survey/step.js +44 -0
- package/lib/esm/src/components/c3-page/c3-breadcrumb/c3-breadcrumb.d.ts +3 -0
- package/lib/esm/src/components/c3-page/c3-breadcrumb/c3-breadcrumb.js +28 -0
- package/lib/esm/src/components/c3-page/c3-breadcrumb/c3-breadcrumb.types.d.ts +19 -0
- package/lib/esm/src/components/c3-page/c3-breadcrumb/c3-breadcrumb.types.js +6 -0
- package/lib/esm/src/components/c3-page/c3-page.d.ts +4 -0
- package/lib/esm/src/components/c3-page/c3-page.js +16 -0
- package/lib/esm/src/components/c3-page/c3-page.test.d.ts +1 -0
- package/lib/esm/src/components/c3-page/c3-page.test.js +25 -0
- package/lib/esm/src/components/c3-page/c3-page.types.d.ts +18 -0
- package/lib/esm/src/components/c3-page/c3-page.types.js +6 -0
- package/lib/esm/src/components/c3-page/c3-tabs/c3-tabs.d.ts +3 -0
- package/lib/esm/src/components/c3-page/c3-tabs/c3-tabs.js +37 -0
- package/lib/esm/src/components/c3-page/c3-tabs/c3-tabs.types.d.ts +14 -0
- package/lib/esm/src/components/c3-page/c3-tabs/c3-tabs.types.js +6 -0
- package/lib/esm/src/components/c3-responsive-stack/c3-responsive-stack.d.ts +2 -0
- package/lib/esm/src/components/c3-responsive-stack/c3-responsive-stack.js +18 -0
- package/lib/esm/src/components/c3-user-configuration/authToken.d.ts +30 -0
- package/lib/esm/src/components/c3-user-configuration/authToken.js +30 -0
- package/lib/esm/src/components/c3-user-configuration/c3-profile-provider/c3-profile-provider.d.ts +26 -0
- package/lib/esm/src/components/c3-user-configuration/c3-profile-provider/c3-profile-provider.js +117 -0
- package/lib/esm/src/components/c3-user-configuration/c3-profile-provider/carbon-theme-provider.d.ts +13 -0
- package/lib/esm/src/components/c3-user-configuration/c3-profile-provider/carbon-theme-provider.js +29 -0
- package/lib/esm/src/components/c3-user-configuration/c3-user-configuration-provider.d.ts +54 -0
- package/lib/esm/src/components/c3-user-configuration/c3-user-configuration-provider.js +43 -0
- package/lib/esm/src/components/styles.d.ts +13 -0
- package/lib/esm/src/components/styles.js +90 -0
- package/lib/esm/src/components/test-utils.d.ts +3 -0
- package/lib/esm/src/components/test-utils.js +32 -0
- package/lib/esm/src/contexts/c3-cluster-update-manager.d.ts +12 -0
- package/lib/esm/src/contexts/c3-cluster-update-manager.js +27 -0
- package/lib/esm/src/hooks/useApi.d.ts +20 -0
- package/lib/esm/src/hooks/useApi.js +54 -0
- package/lib/esm/src/index.d.ts +23 -0
- package/lib/esm/src/index.js +19 -0
- package/lib/esm/src/utils/camunda.d.ts +21 -0
- package/lib/esm/src/utils/camunda.js +59 -0
- package/lib/esm/src/utils/camunda.types.d.ts +63 -0
- package/lib/esm/src/utils/camunda.types.js +6 -0
- package/lib/esm/src/utils/versionCheck.utils.d.ts +15 -0
- package/lib/esm/src/utils/versionCheck.utils.js +79 -0
- package/package.json +18 -18
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } 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
|
+
const C3ActionButtons = ({ elements, }) => {
|
|
9
|
+
return (_jsx(_Fragment, { children: elements.map((actionButton) => {
|
|
10
|
+
if ('element' in actionButton) {
|
|
11
|
+
return actionButton.element;
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
return (_jsx(HeaderGlobalAction, { "aria-label": `Open ${actionButton.label}`, onClick: actionButton.action, isActive: false, children: actionButton.icon }, `${actionButton.label}-key`));
|
|
15
|
+
}
|
|
16
|
+
}) }));
|
|
17
|
+
};
|
|
18
|
+
export default C3ActionButtons;
|
package/lib/esm/src/components/c3-navigation/c3-navigation-actions/c3-action-buttons.types.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { JSX, ReactElement } from 'react';
|
|
2
|
+
export interface C3ActionButtonElement {
|
|
3
|
+
element: JSX.Element;
|
|
4
|
+
}
|
|
5
|
+
export interface C3ActionButtonSimple {
|
|
6
|
+
label: string;
|
|
7
|
+
icon: ReactElement;
|
|
8
|
+
action: () => void;
|
|
9
|
+
}
|
|
10
|
+
export type C3ActionButtonsProps = Array<C3ActionButtonElement | C3ActionButtonSimple>;
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } 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 { FormLabel, HeaderGlobalAction, HeaderMenuItem, HeaderSideNavItems, Modal, SideNavItems, SideNavLink, SideNavMenu, SideNavMenuItem, } from '@carbon/react';
|
|
8
|
+
import { Close } from '@carbon/react/icons/index.esm.js';
|
|
9
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
10
|
+
import { styled } from 'styled-components';
|
|
11
|
+
import { C3AppMenuIcon } from '../../../assets/c3-icons.js';
|
|
12
|
+
import { useClusterUpdate } from '../../../contexts/c3-cluster-update-manager.js';
|
|
13
|
+
import { APPS, getEndpointForApp, getReadableAppName, hasReadPermissionForApp, isAdminApp, } from '../../../utils/camunda.js';
|
|
14
|
+
import { checkVersion, VersionCheckOperator, } from '../../../utils/versionCheck.utils.js';
|
|
15
|
+
import { useC3Profile } from '../../c3-user-configuration/c3-profile-provider/c3-profile-provider.js';
|
|
16
|
+
import { useC3UserConfiguration } from '../../c3-user-configuration/c3-user-configuration-provider.js';
|
|
17
|
+
import { ActiveOrgName } from '../c3-org-sidebar/components.js';
|
|
18
|
+
import { useOnClickOutside } from '../helpers.js';
|
|
19
|
+
import { NavWrapper, SideNav } from './components.js';
|
|
20
|
+
const getOrgLink = (app, orgId, domain) => {
|
|
21
|
+
switch (app) {
|
|
22
|
+
case 'console': {
|
|
23
|
+
return `https://console.${domain}/org/${orgId}`;
|
|
24
|
+
}
|
|
25
|
+
case 'modeler': {
|
|
26
|
+
return `https://modeler.${domain}/login?returnUrl=/org/${orgId}`;
|
|
27
|
+
}
|
|
28
|
+
default: {
|
|
29
|
+
return '#';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const getClustersToRender = (clusters, activeOrg, appToNavigateTo) => {
|
|
34
|
+
return clusters?.filter(({ status, endpoints, generation }) => status[isAdminApp(appToNavigateTo) ? 'zeebe' : appToNavigateTo] ===
|
|
35
|
+
'Healthy' &&
|
|
36
|
+
getEndpointForApp(appToNavigateTo, endpoints) &&
|
|
37
|
+
// either the user has appreadpermissions on this app
|
|
38
|
+
(hasReadPermissionForApp(appToNavigateTo, activeOrg?.permissions) ||
|
|
39
|
+
// OR this is a 8.8+ cluster - in this case we also allow rendering this item
|
|
40
|
+
checkVersion({
|
|
41
|
+
possiblyVersionOrDockerPath: generation.versions?.zeebe,
|
|
42
|
+
trueForSnapshot: true,
|
|
43
|
+
operator: VersionCheckOperator.GreaterThanOrEqual,
|
|
44
|
+
versionToCompareTo: '8.8.0',
|
|
45
|
+
trueOnInvalidVersion: false,
|
|
46
|
+
})));
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Returns the display label for admin/identity clusters in the app bar.
|
|
50
|
+
* Shows "Admin" only if at least one cluster is on version 8.9.0-alpha5 or newer;
|
|
51
|
+
* otherwise falls back to "Identity" for older cluster versions.
|
|
52
|
+
*/
|
|
53
|
+
const getAdminLabelForClusters = (clusters) => {
|
|
54
|
+
const hasAdminVersionCluster = clusters.some((cluster) => checkVersion({
|
|
55
|
+
possiblyVersionOrDockerPath: cluster.generation.versions?.zeebe,
|
|
56
|
+
trueForSnapshot: true,
|
|
57
|
+
operator: VersionCheckOperator.GreaterThanOrEqual,
|
|
58
|
+
versionToCompareTo: '8.9.0-alpha5',
|
|
59
|
+
trueOnInvalidVersion: false,
|
|
60
|
+
}));
|
|
61
|
+
return hasAdminVersionCluster ? 'Admin' : 'Identity';
|
|
62
|
+
};
|
|
63
|
+
const OrgNameWrapper = styled.div `
|
|
64
|
+
margin-bottom: 1rem;
|
|
65
|
+
padding: 0px 16px;
|
|
66
|
+
@media (min-width: 768px) {
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
70
|
+
const OrgPickerModal = ({ isOpen, onCancel, orgs, activeOrg, loadingStatus, appToNavigateTo, domain, }) => {
|
|
71
|
+
const hasNoTeams = Object.values(orgs ?? {})?.every(({ org }) => {
|
|
72
|
+
return !org?.name;
|
|
73
|
+
});
|
|
74
|
+
const hasNoTeamsWithClusters = Object.values(orgs ?? {})?.every(({ clusters }) => {
|
|
75
|
+
const isConsoleOrModeler = [APPS[0], APPS[1]].includes(appToNavigateTo);
|
|
76
|
+
return (!isConsoleOrModeler &&
|
|
77
|
+
getClustersToRender(clusters, activeOrg, appToNavigateTo).length === 0);
|
|
78
|
+
});
|
|
79
|
+
return (_jsx(Modal, { danger: true, open: isOpen, modalHeading: 'Select a team', onRequestClose: onCancel, passiveModal: true, loadingStatus: loadingStatus, size: 'sm', children: _jsxs("div", { style: { marginLeft: '-1rem' }, children: [_jsx(FormLabel, { style: {
|
|
80
|
+
paddingTop: '15px',
|
|
81
|
+
paddingLeft: '1rem',
|
|
82
|
+
}, children: hasNoTeams
|
|
83
|
+
? 'No teams found'
|
|
84
|
+
: hasNoTeamsWithClusters
|
|
85
|
+
? 'No teams with clusters found'
|
|
86
|
+
: 'Teams' }), _jsx("div", { style: {
|
|
87
|
+
marginTop: '-1rem',
|
|
88
|
+
}, children: _jsx(SideNavItems, { children: Object.values(orgs ?? {})?.map(({ org, clusters }) => {
|
|
89
|
+
const isConsoleOrModeler = [APPS[0], APPS[1]].includes(appToNavigateTo);
|
|
90
|
+
const toOrg = getOrgLink(appToNavigateTo, org.uuid, domain ?? '');
|
|
91
|
+
if (isConsoleOrModeler) {
|
|
92
|
+
return (_jsx(SideNavLink, { href: toOrg, children: org?.name }, org?.uuid));
|
|
93
|
+
}
|
|
94
|
+
const clustersToRender = getClustersToRender(clusters, activeOrg, appToNavigateTo);
|
|
95
|
+
if (clustersToRender.length === 0) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
return (_jsx(SideNavMenu, { title: org?.name, children: clustersToRender?.map((cluster) => {
|
|
99
|
+
return (_jsx(SideNavMenuItem, { href: cluster.endpoints[appToNavigateTo], children: cluster.name }, cluster.uuid));
|
|
100
|
+
}) }, org?.uuid));
|
|
101
|
+
}) }) })] }) }));
|
|
102
|
+
};
|
|
103
|
+
const SubElementWrapper = styled.ul `
|
|
104
|
+
.cds--side-nav__submenu[aria-expanded='true'] + .cds--side-nav__menu {
|
|
105
|
+
max-block-size: 456px;
|
|
106
|
+
overflow-y: auto;
|
|
107
|
+
visibility: inherit;
|
|
108
|
+
}
|
|
109
|
+
`;
|
|
110
|
+
export const C3NavigationAppBar = ({ app: appProps, appBar, forwardRef, navbar, toggleAppbar, }) => {
|
|
111
|
+
const { currentApp, domain, analyticsTrack, currentClusterUuid } = useC3UserConfiguration();
|
|
112
|
+
const { orgs, clusters, setClusters, activeOrg, isEnabled, loadClustersById, } = useC3Profile();
|
|
113
|
+
const { setPanelRef: panelRef, setIconRef: iconRef } = useOnClickOutside(() => toggleAppbar(false));
|
|
114
|
+
const [appElements, setAppElements] = useState([]);
|
|
115
|
+
const [loadingStatus, setLoadingStatus] = useState('inactive');
|
|
116
|
+
const [clustersByOrgId, setClustersByOrgId] = useState(null);
|
|
117
|
+
const [appToNavigateTo, setAppToNavigateTo] = useState(APPS[0]);
|
|
118
|
+
useClusterUpdate({
|
|
119
|
+
onUpdate: (data) => {
|
|
120
|
+
if (data && data.org && data.org === activeOrg?.uuid) {
|
|
121
|
+
switch (data.entity) {
|
|
122
|
+
case 'cluster': {
|
|
123
|
+
if (data.payload.uuid) {
|
|
124
|
+
const clusterDto = data.payload;
|
|
125
|
+
const status = clusterDto.status;
|
|
126
|
+
const endpoints = {
|
|
127
|
+
tasklist: status?.tasklistUrl,
|
|
128
|
+
operate: status?.operateUrl,
|
|
129
|
+
optimize: status?.optimizeUrl,
|
|
130
|
+
console: '',
|
|
131
|
+
modeler: '',
|
|
132
|
+
identity: '',
|
|
133
|
+
admin: '',
|
|
134
|
+
};
|
|
135
|
+
const expectedStatus = {
|
|
136
|
+
tasklist: status?.tasklistStatus,
|
|
137
|
+
operate: status?.operateStatus,
|
|
138
|
+
optimize: status?.optimizeStatus,
|
|
139
|
+
console: '',
|
|
140
|
+
modeler: '',
|
|
141
|
+
identity: '',
|
|
142
|
+
admin: '',
|
|
143
|
+
zeebe: '',
|
|
144
|
+
};
|
|
145
|
+
const affectedCluster = {
|
|
146
|
+
uuid: clusterDto.uuid,
|
|
147
|
+
name: clusterDto.name,
|
|
148
|
+
status: expectedStatus,
|
|
149
|
+
generation: clusterDto.generation,
|
|
150
|
+
endpoints,
|
|
151
|
+
};
|
|
152
|
+
switch (data.type) {
|
|
153
|
+
case 'deleted': {
|
|
154
|
+
setClusters((clusters) => clusters?.filter((cluster) => cluster.uuid !== affectedCluster.uuid) ?? []);
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
case 'updated': {
|
|
158
|
+
setClusters((clusters) => {
|
|
159
|
+
if (!clusters) {
|
|
160
|
+
return [];
|
|
161
|
+
}
|
|
162
|
+
const clustersClone = [...clusters];
|
|
163
|
+
const clusterToUpdateIndex = clustersClone?.findIndex((cluster) => cluster.uuid === affectedCluster.uuid);
|
|
164
|
+
if (clusterToUpdateIndex > -1) {
|
|
165
|
+
clustersClone[clusterToUpdateIndex] = affectedCluster;
|
|
166
|
+
return clustersClone;
|
|
167
|
+
}
|
|
168
|
+
return clusters;
|
|
169
|
+
});
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
case 'created': {
|
|
173
|
+
setClusters((clusters) => {
|
|
174
|
+
if (!clusters) {
|
|
175
|
+
return [];
|
|
176
|
+
}
|
|
177
|
+
const clustersClone = [...clusters];
|
|
178
|
+
const clusterToUpdateIndex = clustersClone?.findIndex((cluster) => cluster.uuid === affectedCluster.uuid);
|
|
179
|
+
if (clusterToUpdateIndex > -1) {
|
|
180
|
+
clustersClone[clusterToUpdateIndex] = affectedCluster;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
clustersClone.push(affectedCluster);
|
|
184
|
+
}
|
|
185
|
+
return clustersClone;
|
|
186
|
+
});
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
default:
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
default: {
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
});
|
|
202
|
+
if (!appBar.elements && !isEnabled)
|
|
203
|
+
console.warn('No app elements and user config provided. Please provide at least one of them.');
|
|
204
|
+
const isMemberOfTeam = useCallback((orgUuid) => orgs?.some(({ uuid }) => uuid === orgUuid) || false, [orgs]);
|
|
205
|
+
const getClustersForSuperOrg = useCallback(async () => {
|
|
206
|
+
const updatedClusterByOrgId = {};
|
|
207
|
+
await Promise.all(activeOrg?.childOrganizations
|
|
208
|
+
?.filter((team) => isMemberOfTeam(team.uuid))
|
|
209
|
+
.map((org) => loadClustersById(org.uuid)?.then(({ result }) => {
|
|
210
|
+
updatedClusterByOrgId[org.uuid] = {
|
|
211
|
+
org,
|
|
212
|
+
clusters: result ?? [],
|
|
213
|
+
};
|
|
214
|
+
})) ?? []);
|
|
215
|
+
setClustersByOrgId(updatedClusterByOrgId);
|
|
216
|
+
}, [activeOrg, isMemberOfTeam]);
|
|
217
|
+
const handleSuperOrg = useCallback(() => {
|
|
218
|
+
if (!activeOrg?.uuid) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
setIsOrgPickerModalOpen(true);
|
|
222
|
+
if (clustersByOrgId) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
setLoadingStatus('active');
|
|
226
|
+
getClustersForSuperOrg()
|
|
227
|
+
.catch((error) => console.error(error))
|
|
228
|
+
.finally(() => {
|
|
229
|
+
setLoadingStatus('finished');
|
|
230
|
+
});
|
|
231
|
+
}, [clustersByOrgId, activeOrg, getClustersForSuperOrg]);
|
|
232
|
+
useEffect(() => {
|
|
233
|
+
if (activeOrg?.isSuperOrg) {
|
|
234
|
+
getClustersForSuperOrg()
|
|
235
|
+
.catch((error) => console.error(error))
|
|
236
|
+
.finally(() => {
|
|
237
|
+
setLoadingStatus('finished');
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}, [activeOrg, getClustersForSuperOrg]);
|
|
241
|
+
useEffect(() => {
|
|
242
|
+
if (appBar.elements)
|
|
243
|
+
return;
|
|
244
|
+
const defaultElements = [];
|
|
245
|
+
const enforceDropDown = !APPS.filter((app) => app !== 'console' && app !== 'modeler').every((app) => getClustersToRender(clusters ?? [], activeOrg, app).length < 2);
|
|
246
|
+
for (const app of APPS) {
|
|
247
|
+
if (!domain || !currentApp || !activeOrg?.uuid)
|
|
248
|
+
return;
|
|
249
|
+
const element = {
|
|
250
|
+
key: app,
|
|
251
|
+
label: getReadableAppName(app),
|
|
252
|
+
active: isAdminApp(app) ? isAdminApp(currentApp) : currentApp === app,
|
|
253
|
+
href: currentApp === app || (isAdminApp(app) && isAdminApp(currentApp))
|
|
254
|
+
? '#'
|
|
255
|
+
: undefined,
|
|
256
|
+
onClick: currentApp === app || (isAdminApp(app) && isAdminApp(currentApp))
|
|
257
|
+
? () => false
|
|
258
|
+
: undefined,
|
|
259
|
+
};
|
|
260
|
+
if (app === currentApp &&
|
|
261
|
+
['console', 'modeler'].includes(app) &&
|
|
262
|
+
appProps.routeProps) {
|
|
263
|
+
element.routeProps = appProps.routeProps;
|
|
264
|
+
}
|
|
265
|
+
else if (app === 'console') {
|
|
266
|
+
element.href = `https://console.${domain}/org/${activeOrg?.uuid}`;
|
|
267
|
+
}
|
|
268
|
+
else if (app === 'modeler') {
|
|
269
|
+
const hasPermission = activeOrg?.permissions?.org?.webide?.read;
|
|
270
|
+
if (hasPermission) {
|
|
271
|
+
element.href = `https://modeler.${domain}/login?returnUrl=/org/${activeOrg?.uuid}`;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
const appHasReadPermission = hasReadPermissionForApp(app, activeOrg?.permissions);
|
|
276
|
+
const clustersToRender = getClustersToRender(clusters ?? [], activeOrg, app);
|
|
277
|
+
if (isAdminApp(app)) {
|
|
278
|
+
element.label = getAdminLabelForClusters(clustersToRender);
|
|
279
|
+
}
|
|
280
|
+
if (clustersToRender?.length === 1 && !enforceDropDown) {
|
|
281
|
+
element.href = getEndpointForApp(app, clustersToRender[0].endpoints);
|
|
282
|
+
}
|
|
283
|
+
else if (clustersToRender?.length > 1 ||
|
|
284
|
+
(enforceDropDown && clustersToRender?.length > 0)) {
|
|
285
|
+
element.onClick = undefined;
|
|
286
|
+
element.subElements = clustersToRender.map((cluster, index) => ({
|
|
287
|
+
key: `${app}-${cluster.uuid}-${index}`,
|
|
288
|
+
label: cluster.name,
|
|
289
|
+
href: getEndpointForApp(app, cluster.endpoints),
|
|
290
|
+
onClick: () => {
|
|
291
|
+
toggleAppbar(false);
|
|
292
|
+
analyticsTrack?.(`${app}:open`, { currentApp: app });
|
|
293
|
+
},
|
|
294
|
+
isActive: (currentApp === app && currentClusterUuid === cluster.uuid) ||
|
|
295
|
+
(isAdminApp(app) &&
|
|
296
|
+
isAdminApp(currentApp) &&
|
|
297
|
+
currentClusterUuid === cluster.uuid),
|
|
298
|
+
}));
|
|
299
|
+
}
|
|
300
|
+
else if (isAdminApp(app)) {
|
|
301
|
+
// no app-teaser for admin/identity for now
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
else if (appHasReadPermission) {
|
|
305
|
+
if (appBar.appTeaserRouteProps?.[app]) {
|
|
306
|
+
element.routeProps = appBar.appTeaserRouteProps?.[app];
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
element.href = `https://${currentApp}.${domain}/org/${activeOrg?.uuid}/appTeaser/${app}`;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
if (element.href || element.routeProps || element.subElements) {
|
|
314
|
+
if (activeOrg.isSuperOrg) {
|
|
315
|
+
element.href = '#';
|
|
316
|
+
element.routeProps = null;
|
|
317
|
+
element.onClick = () => {
|
|
318
|
+
setAppToNavigateTo(app);
|
|
319
|
+
handleSuperOrg();
|
|
320
|
+
// probs want to track?
|
|
321
|
+
// analyticsTrack?.(`${app}:open`, { currentApp: app })
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
defaultElements.push(element);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
setAppElements(defaultElements);
|
|
328
|
+
}, [clusters, currentApp, domain, handleSuperOrg]);
|
|
329
|
+
const appBarElements = appBar.elements || (clusters || clustersByOrgId ? appElements : null);
|
|
330
|
+
const [isOrgPickerModalOpen, setIsOrgPickerModalOpen] = useState(false);
|
|
331
|
+
const orgName = activeOrg?.name || navbar.orgName;
|
|
332
|
+
return (_jsxs(_Fragment, { children: [_jsx(HeaderGlobalAction, { ref: iconRef, "aria-label": 'Camunda components', isActive: appBar.isOpen, onClick: () => {
|
|
333
|
+
toggleAppbar(!appBar.isOpen);
|
|
334
|
+
}, tooltipAlignment: 'start',
|
|
335
|
+
// @ts-expect-error
|
|
336
|
+
leaveDelayMs: 100, children: appBar.isOpen ? _jsx(Close, { size: 20 }) : _jsx(C3AppMenuIcon, { size: 20 }) }), _jsx(OrgPickerModal, { activeOrg: activeOrg, appToNavigateTo: appToNavigateTo, isOpen: isOrgPickerModalOpen, orgs: clustersByOrgId, onCancel: () => {
|
|
337
|
+
setIsOrgPickerModalOpen(false);
|
|
338
|
+
}, loadingStatus: loadingStatus, domain: domain }), _jsx(NavWrapper, { children: _jsx(SideNav, { ref: panelRef, "aria-label": appBar.ariaLabel || 'Side Navigation', expanded: appBar.isOpen, isPersistent: false, children: _jsxs(SideNavItems, { children: [orgName && (_jsx("li", { children: _jsxs(OrgNameWrapper, { children: [_jsx(FormLabel, { children: "Organization" }), _jsx(ActiveOrgName, { className: 'textPrimary', title: orgName, children: orgName })] }) })), _jsx("li", { children: navbar.elements.length > 0 && (_jsx(HeaderSideNavItems, { hasDivider: true, children: navbar.elements.map((element) => (_jsx(HeaderMenuItem, { as: element.routeProps && forwardRef, isActive: element.isCurrentPage, ...element.routeProps, onClick: () => {
|
|
339
|
+
if (element.routeProps.onClick) {
|
|
340
|
+
element.routeProps.onClick();
|
|
341
|
+
}
|
|
342
|
+
if (appBar.closeOnClick !== false) {
|
|
343
|
+
toggleAppbar(false);
|
|
344
|
+
}
|
|
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();
|
|
351
|
+
}
|
|
352
|
+
if (subElement.routeProps?.onClick) {
|
|
353
|
+
subElement.routeProps.onClick();
|
|
354
|
+
}
|
|
355
|
+
if (appBar.closeOnClick !== false) {
|
|
356
|
+
toggleAppbar(false);
|
|
357
|
+
}
|
|
358
|
+
if (appBar.elementClicked) {
|
|
359
|
+
appBar.elementClicked(subElement.key);
|
|
360
|
+
}
|
|
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
|
+
}) }) })] }) }) })] }));
|
|
380
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
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 { SideNav as CarbonSideNav } from '@carbon/react';
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
export const NavWrapper = styled.div `
|
|
9
|
+
.cds--side-nav__overlay {
|
|
10
|
+
display: none;
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
// Use a minimal prop typing to wrap Carbon's SideNav without relying on legacy carbon-components-react types
|
|
14
|
+
export const SideNav = styled(CarbonSideNav) `
|
|
15
|
+
visibility: ${({ expanded }) => (expanded ? 'visible' : 'hidden')};
|
|
16
|
+
display: grid;
|
|
17
|
+
grid-auto-flow: row;
|
|
18
|
+
grid-auto-rows: max-content 1fr;
|
|
19
|
+
border-right: ${({ expanded }) => expanded ? '1px solid var(--cds-border-subtle)' : undefined};
|
|
20
|
+
overflow-y: auto;
|
|
21
|
+
`;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } 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 { Help } from '@carbon/react/icons/index.esm.js';
|
|
8
|
+
import { useC3UserConfiguration } from '../../c3-user-configuration/c3-user-configuration-provider.js';
|
|
9
|
+
import C3NavigationSideBar from './c3-navigation-sidebar.js';
|
|
10
|
+
import { SwitcherDivider } from './components.js';
|
|
11
|
+
const C3InfoSidebar = ({ sideBar, }) => {
|
|
12
|
+
const { version, ...sideBarProps } = sideBar;
|
|
13
|
+
const { enableLogs } = useC3UserConfiguration();
|
|
14
|
+
if (version && enableLogs)
|
|
15
|
+
console.warn('The `version` prop in the info sidebar is deprecated and will be removed in a future release. Please set `version` in the `userSideBar` prop instead.');
|
|
16
|
+
return (_jsx(C3NavigationSideBar, { sideBar: {
|
|
17
|
+
...sideBarProps,
|
|
18
|
+
ariaLabel: sideBarProps.ariaLabel || 'Info Sidebar',
|
|
19
|
+
}, icon: _jsx(Help, { size: 20 }), bottomChildren: version !== undefined && (_jsxs(_Fragment, { children: [_jsx(SwitcherDivider, {}), _jsxs("span", { className: 'cds--switcher__item', style: {
|
|
20
|
+
padding: 'var(--cds-spacing-05)',
|
|
21
|
+
paddingTop: 'var(--cds-spacing-03)',
|
|
22
|
+
paddingBottom: 0,
|
|
23
|
+
color: 'var(--cds-text-primary)',
|
|
24
|
+
fontSize: 'var(--cds-body-01-font-size)',
|
|
25
|
+
fontWeight: 'var(--cds-body-01-font-weight)',
|
|
26
|
+
lineHeight: 'var(--cds-body-01-line-height)',
|
|
27
|
+
letterSpacing: 'var(--cds-body-01-letter-spacing)',
|
|
28
|
+
}, children: ["Version ", version] }), _jsxs("span", { className: 'cds--switcher__item', style: {
|
|
29
|
+
paddingRight: 'var(--cds-spacing-05)',
|
|
30
|
+
paddingLeft: 'var(--cds-spacing-05)',
|
|
31
|
+
color: 'var(--cds-text-secondary)',
|
|
32
|
+
fontSize: 'var(--cds-label-01-font-size)',
|
|
33
|
+
fontWeight: 'var(--cds-label-01-font-weight)',
|
|
34
|
+
lineHeight: 'var(--cds-label-01-line-height)',
|
|
35
|
+
letterSpacing: 'var(--cds-label-01-letter-spacing)',
|
|
36
|
+
}, children: [`© Camunda Services GmbH ${new Date().getFullYear()}`, _jsx("br", {}), " All rights reserved."] })] })) }));
|
|
37
|
+
};
|
|
38
|
+
export default C3InfoSidebar;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type JSX } from 'react';
|
|
2
|
+
import type { C3NavigationElementProps } from '../c3-navigation.types';
|
|
3
|
+
import type { C3NavigationSideBarProps } from './c3-navigation-sidebar.types';
|
|
4
|
+
declare const C3NavigationSidebarElement: (props: {
|
|
5
|
+
element: C3NavigationElementProps;
|
|
6
|
+
index: number;
|
|
7
|
+
itemTabIndex?: number;
|
|
8
|
+
sideBar: C3NavigationSideBarProps;
|
|
9
|
+
setSideBarOpen: (open: boolean) => void;
|
|
10
|
+
scrollBarWidth: number;
|
|
11
|
+
}) => JSX.Element;
|
|
12
|
+
export default C3NavigationSidebarElement;
|
package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar-element.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } 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 { Button, SideNavLink } from '@carbon/react';
|
|
8
|
+
import { useEffect, useRef, useState } from 'react';
|
|
9
|
+
import styled from 'styled-components';
|
|
10
|
+
import { SwitcherDivider } from './components.js';
|
|
11
|
+
const Row = styled.div `
|
|
12
|
+
display: flex;
|
|
13
|
+
justify-content: start;
|
|
14
|
+
align-items: center;
|
|
15
|
+
|
|
16
|
+
li {
|
|
17
|
+
list-style-type: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.cds--switcher__item:nth-child(1) {
|
|
21
|
+
margin-block-start: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&:nth-child(1) {
|
|
25
|
+
margin-block-start: 1rem;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.cds--overflow-menu-options {
|
|
29
|
+
z-index: 9000 !important;
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
const C3NavigationSidebarElement = (props) => {
|
|
33
|
+
const sideBarElementRef = useRef(null);
|
|
34
|
+
const [isOverflown, setIsOverflown] = useState(false);
|
|
35
|
+
const { overflowMenu, isActive, isNavLink } = props.element;
|
|
36
|
+
const Element = isNavLink ? SideNavLink : Button;
|
|
37
|
+
const handleSetIsOverflown = () => {
|
|
38
|
+
const element = sideBarElementRef.current;
|
|
39
|
+
setIsOverflown(element ? element.offsetWidth < element.scrollWidth : false);
|
|
40
|
+
};
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
window.addEventListener('resize', handleSetIsOverflown);
|
|
43
|
+
handleSetIsOverflown();
|
|
44
|
+
return () => window.removeEventListener('resize', handleSetIsOverflown);
|
|
45
|
+
}, []);
|
|
46
|
+
return (_jsxs(_Fragment, { children: [props.element.preceedingDivider && _jsx(SwitcherDivider, {}), _jsxs(Row, { children: [_jsx(Element, { style: {
|
|
47
|
+
width: overflowMenu
|
|
48
|
+
? `calc(14rem - ${props.scrollBarWidth}px)`
|
|
49
|
+
: `calc(16rem - ${props.scrollBarWidth}px)`,
|
|
50
|
+
...(props.index === 0 &&
|
|
51
|
+
(!('elements' in props.sideBar) || !props.sideBar.elements)
|
|
52
|
+
? { marginTop: '1.5rem' }
|
|
53
|
+
: {}),
|
|
54
|
+
}, size: 'sm', kind: props.element.kind ?? 'ghost', className: `cds--switcher__item ${isActive ? 'cds--side-nav__item--active' : ''}`, onClick: () => {
|
|
55
|
+
if (props.element.onClick) {
|
|
56
|
+
props.element.onClick();
|
|
57
|
+
}
|
|
58
|
+
if (props.sideBar.closeOnClick !== false) {
|
|
59
|
+
props.setSideBarOpen(false);
|
|
60
|
+
}
|
|
61
|
+
}, tabIndex: props.itemTabIndex, renderIcon: props.element.renderIcon, ...(isNavLink ? { isActive } : {}), children: _jsx("span", { ref: sideBarElementRef, title: isOverflown ? props.element.label : '', style: {
|
|
62
|
+
overflow: 'hidden',
|
|
63
|
+
textOverflow: 'ellipsis',
|
|
64
|
+
whiteSpace: 'nowrap',
|
|
65
|
+
width: '100%',
|
|
66
|
+
}, children: props.element.label }) }), overflowMenu] })] }));
|
|
67
|
+
};
|
|
68
|
+
export default C3NavigationSidebarElement;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type JSX, type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import type { C3NavigationSideBarProps } from './c3-navigation-sidebar.types';
|
|
3
|
+
declare const C3NavigationSideBar: (props: {
|
|
4
|
+
sideBar: C3NavigationSideBarProps;
|
|
5
|
+
icon: ReactElement;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
version?: ReactNode;
|
|
8
|
+
bottomChildren?: ReactNode;
|
|
9
|
+
}) => JSX.Element;
|
|
10
|
+
export default C3NavigationSideBar;
|