@camunda/camunda-composite-components 0.22.2 → 0.22.3
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/package.json +12 -12
- package/lib/esm/package.json +0 -98
- package/lib/esm/src/api/api.d.ts +0 -29
- package/lib/esm/src/api/api.js +0 -92
- package/lib/esm/src/api/clusters.d.ts +0 -10
- package/lib/esm/src/api/clusters.js +0 -32
- package/lib/esm/src/api/endpoints.const.d.ts +0 -22
- package/lib/esm/src/api/endpoints.const.js +0 -70
- package/lib/esm/src/api/help-center.d.ts +0 -42
- package/lib/esm/src/api/help-center.js +0 -56
- package/lib/esm/src/api/jwt.utils.d.ts +0 -5
- package/lib/esm/src/api/jwt.utils.js +0 -26
- package/lib/esm/src/api/notifications.d.ts +0 -41
- package/lib/esm/src/api/notifications.js +0 -170
- package/lib/esm/src/api/organizations.d.ts +0 -15
- package/lib/esm/src/api/organizations.js +0 -16
- package/lib/esm/src/api/profile.d.ts +0 -20
- package/lib/esm/src/api/profile.js +0 -48
- package/lib/esm/src/api/status.d.ts +0 -7
- package/lib/esm/src/api/status.js +0 -46
- package/lib/esm/src/assets/c3-icons.d.ts +0 -5
- package/lib/esm/src/assets/c3-icons.js +0 -5
- package/lib/esm/src/assets/c3-icons.types.d.ts +0 -3
- package/lib/esm/src/assets/c3-icons.types.js +0 -6
- package/lib/esm/src/components/c3-app-teaser/app-teaser-cards-config.d.ts +0 -5
- package/lib/esm/src/components/c3-app-teaser/app-teaser-cards-config.js +0 -94
- package/lib/esm/src/components/c3-app-teaser/app-teaser-cards.d.ts +0 -17
- package/lib/esm/src/components/c3-app-teaser/app-teaser-cards.js +0 -31
- package/lib/esm/src/components/c3-app-teaser/app-teaster-card.d.ts +0 -14
- package/lib/esm/src/components/c3-app-teaser/app-teaster-card.js +0 -24
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser-page.d.ts +0 -9
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser-page.js +0 -48
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser-page.test.d.ts +0 -1
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser-page.test.js +0 -33
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser.d.ts +0 -14
- package/lib/esm/src/components/c3-app-teaser/c3-app-teaser.js +0 -53
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.d.ts +0 -6
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.js +0 -84
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.test.d.ts +0 -1
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.test.js +0 -13
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.types.d.ts +0 -26
- package/lib/esm/src/components/c3-cluster-tag/c3-cluster-tag.types.js +0 -11
- package/lib/esm/src/components/c3-data-table/c3-data-table.d.ts +0 -3
- package/lib/esm/src/components/c3-data-table/c3-data-table.js +0 -509
- package/lib/esm/src/components/c3-data-table/c3-data-table.types.d.ts +0 -122
- package/lib/esm/src/components/c3-data-table/c3-data-table.types.js +0 -6
- package/lib/esm/src/components/c3-data-table/link-button/link-button.d.ts +0 -3
- package/lib/esm/src/components/c3-data-table/link-button/link-button.js +0 -15
- package/lib/esm/src/components/c3-data-table/link-button/link-button.types.d.ts +0 -8
- package/lib/esm/src/components/c3-data-table/link-button/link-button.types.js +0 -6
- package/lib/esm/src/components/c3-empty-state/c3-empty-state.d.ts +0 -3
- package/lib/esm/src/components/c3-empty-state/c3-empty-state.js +0 -15
- package/lib/esm/src/components/c3-empty-state/c3-empty-state.test.d.ts +0 -1
- package/lib/esm/src/components/c3-empty-state/c3-empty-state.test.js +0 -25
- package/lib/esm/src/components/c3-empty-state/c3-empty-state.types.d.ts +0 -29
- package/lib/esm/src/components/c3-empty-state/c3-empty-state.types.js +0 -6
- package/lib/esm/src/components/c3-help-center/c3-help-center-provider.d.ts +0 -19
- package/lib/esm/src/components/c3-help-center/c3-help-center-provider.js +0 -58
- package/lib/esm/src/components/c3-help-center/c3-help-center.d.ts +0 -16
- package/lib/esm/src/components/c3-help-center/c3-help-center.js +0 -218
- package/lib/esm/src/components/c3-help-center/c3-help-center.types.d.ts +0 -43
- package/lib/esm/src/components/c3-help-center/c3-help-center.types.js +0 -6
- package/lib/esm/src/components/c3-help-center/defaultHelpCenterConfig.d.ts +0 -10
- package/lib/esm/src/components/c3-help-center/defaultHelpCenterConfig.js +0 -17
- package/lib/esm/src/components/c3-help-center/help-center-hint.d.ts +0 -4
- package/lib/esm/src/components/c3-help-center/help-center-hint.js +0 -15
- package/lib/esm/src/components/c3-help-center/help-center.d.ts +0 -18
- package/lib/esm/src/components/c3-help-center/help-center.js +0 -189
- package/lib/esm/src/components/c3-help-center/recommendations.d.ts +0 -4
- package/lib/esm/src/components/c3-help-center/recommendations.js +0 -55
- package/lib/esm/src/components/c3-help-center/styles.d.ts +0 -4
- package/lib/esm/src/components/c3-help-center/styles.js +0 -48
- package/lib/esm/src/components/c3-help-center/tabs/feedback.d.ts +0 -9
- package/lib/esm/src/components/c3-help-center/tabs/feedback.js +0 -141
- package/lib/esm/src/components/c3-help-center/tabs/tabContent.d.ts +0 -20
- package/lib/esm/src/components/c3-help-center/tabs/tabContent.js +0 -22
- package/lib/esm/src/components/c3-help-center/tabs/tabContentSkeleton.d.ts +0 -2
- package/lib/esm/src/components/c3-help-center/tabs/tabContentSkeleton.js +0 -26
- package/lib/esm/src/components/c3-help-center/tile.d.ts +0 -10
- package/lib/esm/src/components/c3-help-center/tile.js +0 -61
- package/lib/esm/src/components/c3-navigation/c3-info-button.d.ts +0 -4
- package/lib/esm/src/components/c3-navigation/c3-info-button.js +0 -9
- package/lib/esm/src/components/c3-navigation/c3-navigation-actions/c3-action-buttons.d.ts +0 -6
- package/lib/esm/src/components/c3-navigation/c3-navigation-actions/c3-action-buttons.js +0 -18
- package/lib/esm/src/components/c3-navigation/c3-navigation-actions/c3-action-buttons.types.d.ts +0 -10
- package/lib/esm/src/components/c3-navigation/c3-navigation-actions/c3-action-buttons.types.js +0 -6
- package/lib/esm/src/components/c3-navigation/c3-navigation-appbar/c3-navigation-appbar.d.ts +0 -4
- package/lib/esm/src/components/c3-navigation/c3-navigation-appbar/c3-navigation-appbar.js +0 -380
- package/lib/esm/src/components/c3-navigation/c3-navigation-appbar/components.d.ts +0 -2
- package/lib/esm/src/components/c3-navigation/c3-navigation-appbar/components.js +0 -21
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-info-sidebar.d.ts +0 -6
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-info-sidebar.js +0 -38
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar-element.d.ts +0 -12
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar-element.js +0 -68
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.d.ts +0 -10
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.js +0 -87
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.types.d.ts +0 -81
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.types.js +0 -6
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-notification-sidebar.d.ts +0 -5
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-notification-sidebar.js +0 -107
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-sidebar-state-provider.d.ts +0 -29
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-sidebar-state-provider.js +0 -54
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-user-sidebar.d.ts +0 -6
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/c3-user-sidebar.js +0 -57
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/components.d.ts +0 -2
- package/lib/esm/src/components/c3-navigation/c3-navigation-sidebar/components.js +0 -11
- package/lib/esm/src/components/c3-navigation/c3-navigation.d.ts +0 -7
- package/lib/esm/src/components/c3-navigation/c3-navigation.js +0 -262
- package/lib/esm/src/components/c3-navigation/c3-navigation.test.d.ts +0 -1
- package/lib/esm/src/components/c3-navigation/c3-navigation.test.js +0 -89
- package/lib/esm/src/components/c3-navigation/c3-navigation.types.d.ts +0 -97
- package/lib/esm/src/components/c3-navigation/c3-navigation.types.js +0 -6
- package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-container.d.ts +0 -13
- package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-container.js +0 -100
- package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-provider.d.ts +0 -19
- package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-provider.js +0 -110
- package/lib/esm/src/components/c3-navigation/c3-org-name.d.ts +0 -6
- package/lib/esm/src/components/c3-navigation/c3-org-name.js +0 -34
- package/lib/esm/src/components/c3-navigation/c3-org-sidebar/c3-org-sidebar.d.ts +0 -6
- package/lib/esm/src/components/c3-navigation/c3-org-sidebar/c3-org-sidebar.js +0 -188
- package/lib/esm/src/components/c3-navigation/c3-org-sidebar/components.d.ts +0 -29
- package/lib/esm/src/components/c3-navigation/c3-org-sidebar/components.js +0 -92
- package/lib/esm/src/components/c3-navigation/helpers.d.ts +0 -8
- package/lib/esm/src/components/c3-navigation/helpers.js +0 -58
- package/lib/esm/src/components/c3-navigation/index.d.ts +0 -2
- package/lib/esm/src/components/c3-navigation/index.js +0 -8
- package/lib/esm/src/components/c3-navigation/stories/story-helpers.d.ts +0 -35
- package/lib/esm/src/components/c3-navigation/stories/story-helpers.js +0 -264
- package/lib/esm/src/components/c3-navigation/stories/story-templates.d.ts +0 -9
- package/lib/esm/src/components/c3-navigation/stories/story-templates.js +0 -38
- package/lib/esm/src/components/c3-onboarding-survey/c3-onboarding-survey.d.ts +0 -14
- package/lib/esm/src/components/c3-onboarding-survey/c3-onboarding-survey.js +0 -94
- package/lib/esm/src/components/c3-onboarding-survey/defaultOnboardingConfig.d.ts +0 -16
- package/lib/esm/src/components/c3-onboarding-survey/defaultOnboardingConfig.js +0 -8
- package/lib/esm/src/components/c3-onboarding-survey/elements/dropdownSelect.d.ts +0 -15
- package/lib/esm/src/components/c3-onboarding-survey/elements/dropdownSelect.js +0 -58
- package/lib/esm/src/components/c3-onboarding-survey/elements/inlineNotification.d.ts +0 -3
- package/lib/esm/src/components/c3-onboarding-survey/elements/inlineNotification.js +0 -10
- package/lib/esm/src/components/c3-onboarding-survey/elements/radioGroupMulti.d.ts +0 -7
- package/lib/esm/src/components/c3-onboarding-survey/elements/radioGroupMulti.js +0 -53
- package/lib/esm/src/components/c3-onboarding-survey/elements/radioGroupSingle.d.ts +0 -7
- package/lib/esm/src/components/c3-onboarding-survey/elements/radioGroupSingle.js +0 -36
- package/lib/esm/src/components/c3-onboarding-survey/elements/textField.d.ts +0 -6
- package/lib/esm/src/components/c3-onboarding-survey/elements/textField.js +0 -14
- package/lib/esm/src/components/c3-onboarding-survey/helpers.d.ts +0 -1
- package/lib/esm/src/components/c3-onboarding-survey/helpers.js +0 -10
- package/lib/esm/src/components/c3-onboarding-survey/onboarding.types.d.ts +0 -30
- package/lib/esm/src/components/c3-onboarding-survey/onboarding.types.js +0 -13
- package/lib/esm/src/components/c3-onboarding-survey/onboardingModal.d.ts +0 -25
- package/lib/esm/src/components/c3-onboarding-survey/onboardingModal.js +0 -52
- package/lib/esm/src/components/c3-onboarding-survey/onboardingPage.d.ts +0 -21
- package/lib/esm/src/components/c3-onboarding-survey/onboardingPage.js +0 -35
- package/lib/esm/src/components/c3-onboarding-survey/onboardingSurvey.d.ts +0 -17
- package/lib/esm/src/components/c3-onboarding-survey/onboardingSurvey.js +0 -148
- package/lib/esm/src/components/c3-onboarding-survey/step.d.ts +0 -7
- package/lib/esm/src/components/c3-onboarding-survey/step.js +0 -44
- package/lib/esm/src/components/c3-page/c3-breadcrumb/c3-breadcrumb.d.ts +0 -3
- package/lib/esm/src/components/c3-page/c3-breadcrumb/c3-breadcrumb.js +0 -28
- package/lib/esm/src/components/c3-page/c3-breadcrumb/c3-breadcrumb.types.d.ts +0 -19
- package/lib/esm/src/components/c3-page/c3-breadcrumb/c3-breadcrumb.types.js +0 -6
- package/lib/esm/src/components/c3-page/c3-page.d.ts +0 -4
- package/lib/esm/src/components/c3-page/c3-page.js +0 -16
- package/lib/esm/src/components/c3-page/c3-page.test.d.ts +0 -1
- package/lib/esm/src/components/c3-page/c3-page.test.js +0 -25
- package/lib/esm/src/components/c3-page/c3-page.types.d.ts +0 -18
- package/lib/esm/src/components/c3-page/c3-page.types.js +0 -6
- package/lib/esm/src/components/c3-page/c3-tabs/c3-tabs.d.ts +0 -3
- package/lib/esm/src/components/c3-page/c3-tabs/c3-tabs.js +0 -37
- package/lib/esm/src/components/c3-page/c3-tabs/c3-tabs.types.d.ts +0 -14
- package/lib/esm/src/components/c3-page/c3-tabs/c3-tabs.types.js +0 -6
- package/lib/esm/src/components/c3-responsive-stack/c3-responsive-stack.d.ts +0 -2
- package/lib/esm/src/components/c3-responsive-stack/c3-responsive-stack.js +0 -18
- package/lib/esm/src/components/c3-user-configuration/authToken.d.ts +0 -30
- package/lib/esm/src/components/c3-user-configuration/authToken.js +0 -30
- package/lib/esm/src/components/c3-user-configuration/c3-profile-provider/c3-profile-provider.d.ts +0 -26
- package/lib/esm/src/components/c3-user-configuration/c3-profile-provider/c3-profile-provider.js +0 -117
- package/lib/esm/src/components/c3-user-configuration/c3-profile-provider/carbon-theme-provider.d.ts +0 -13
- package/lib/esm/src/components/c3-user-configuration/c3-profile-provider/carbon-theme-provider.js +0 -29
- package/lib/esm/src/components/c3-user-configuration/c3-user-configuration-provider.d.ts +0 -54
- package/lib/esm/src/components/c3-user-configuration/c3-user-configuration-provider.js +0 -43
- package/lib/esm/src/components/styles.d.ts +0 -13
- package/lib/esm/src/components/styles.js +0 -90
- package/lib/esm/src/components/test-utils.d.ts +0 -3
- package/lib/esm/src/components/test-utils.js +0 -32
- package/lib/esm/src/contexts/c3-cluster-update-manager.d.ts +0 -12
- package/lib/esm/src/contexts/c3-cluster-update-manager.js +0 -27
- package/lib/esm/src/hooks/useApi.d.ts +0 -20
- package/lib/esm/src/hooks/useApi.js +0 -54
- package/lib/esm/src/index.d.ts +0 -23
- package/lib/esm/src/index.js +0 -19
- package/lib/esm/src/utils/camunda.d.ts +0 -21
- package/lib/esm/src/utils/camunda.js +0 -59
- package/lib/esm/src/utils/camunda.types.d.ts +0 -63
- package/lib/esm/src/utils/camunda.types.js +0 -6
- package/lib/esm/src/utils/versionCheck.utils.d.ts +0 -15
- package/lib/esm/src/utils/versionCheck.utils.js +0 -79
package/lib/esm/src/components/c3-navigation/c3-notification-provider/c3-notification-provider.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
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 React, { useContext, useEffect, useRef, useState, } from 'react';
|
|
8
|
-
import { NotificationService, } from '../../../api/notifications.js';
|
|
9
|
-
import { C3UserConfigurationContext } from '../../c3-user-configuration/c3-user-configuration-provider.js';
|
|
10
|
-
export const C3NotificationContext = React.createContext({
|
|
11
|
-
enabled: false,
|
|
12
|
-
isFetching: true,
|
|
13
|
-
notifications: [],
|
|
14
|
-
markAsRead: () => undefined,
|
|
15
|
-
markAllAsRead: () => undefined,
|
|
16
|
-
dismiss: () => undefined,
|
|
17
|
-
dismissAll: () => undefined,
|
|
18
|
-
analytics: () => undefined,
|
|
19
|
-
});
|
|
20
|
-
const C3NotificationProvider = ({ children, }) => {
|
|
21
|
-
const [notifications, setNotifications] = useState([]);
|
|
22
|
-
const [isFetching, setIsFetching] = useState(true);
|
|
23
|
-
const isFetched = useRef(false);
|
|
24
|
-
const isEventStreamAvailable = useRef(false);
|
|
25
|
-
const activeOrganizationId = useRef('');
|
|
26
|
-
const config = useContext(C3UserConfigurationContext);
|
|
27
|
-
const enabled = !!config && !!config.activeOrganizationId && !!config.userToken;
|
|
28
|
-
// if the organization changes, we need to reset the state
|
|
29
|
-
if (enabled && config.activeOrganizationId !== activeOrganizationId.current) {
|
|
30
|
-
isFetched.current = false;
|
|
31
|
-
}
|
|
32
|
-
if (enabled && isFetched.current && !isEventStreamAvailable.current) {
|
|
33
|
-
isEventStreamAvailable.current = true;
|
|
34
|
-
NotificationService.notificationsStream(config, (notification) => {
|
|
35
|
-
if (notification.orgId === config.activeOrganizationId) {
|
|
36
|
-
setNotifications((currentNotifications) => NotificationService.updateNotifications(currentNotifications, notification));
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
const orgHasChanged = activeOrganizationId.current !== config.activeOrganizationId;
|
|
42
|
-
if (enabled && !isFetched.current && config.userToken && orgHasChanged) {
|
|
43
|
-
setIsFetching(true);
|
|
44
|
-
NotificationService.getNotifications(config)
|
|
45
|
-
.then(({ result }) => {
|
|
46
|
-
if (result)
|
|
47
|
-
setNotifications(result);
|
|
48
|
-
isFetched.current = true;
|
|
49
|
-
activeOrganizationId.current = config.activeOrganizationId;
|
|
50
|
-
})
|
|
51
|
-
.catch(() => {
|
|
52
|
-
// ignore
|
|
53
|
-
})
|
|
54
|
-
.finally(() => {
|
|
55
|
-
setIsFetching(false);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}, [config?.userToken, enabled, isFetched, config.activeOrganizationId]);
|
|
59
|
-
const changeState = (newState, { uuid, state }) => {
|
|
60
|
-
if (enabled && state !== newState) {
|
|
61
|
-
setNotifications((currentNotifications) => NotificationService.updateNotificationState(currentNotifications, uuid, newState));
|
|
62
|
-
NotificationService.changeState(config, uuid, newState);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
const changeManyStates = (newState, notifications) => {
|
|
66
|
-
if (enabled) {
|
|
67
|
-
const notificationIds = notifications
|
|
68
|
-
.filter((notification) => notification.state !== newState)
|
|
69
|
-
.map((notification) => notification.uuid);
|
|
70
|
-
if (notificationIds.length > 0) {
|
|
71
|
-
setNotifications((allNotifications) => NotificationService.updateNotificationStates(allNotifications, notificationIds, newState));
|
|
72
|
-
if (newState === 'dismiss') {
|
|
73
|
-
NotificationService.dismissAll(config, config.activeOrganizationId);
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
if (newState === 'read') {
|
|
77
|
-
NotificationService.markManyAsRead(config, notificationIds);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
const markAsRead = (notification) => changeState('read', notification);
|
|
83
|
-
const markAllAsRead = (notifications) => changeManyStates('read', notifications);
|
|
84
|
-
const dismiss = (notification) => changeState('dismiss', notification);
|
|
85
|
-
const dismissAll = (notifications) => changeManyStates('dismiss', notifications);
|
|
86
|
-
const analytics = (event, id) => {
|
|
87
|
-
if (enabled && config.userToken) {
|
|
88
|
-
NotificationService.sendAnalyticsEvent(config, {
|
|
89
|
-
event,
|
|
90
|
-
id,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
return (_jsx(C3NotificationContext.Provider, { value: {
|
|
95
|
-
enabled,
|
|
96
|
-
notifications,
|
|
97
|
-
markAsRead,
|
|
98
|
-
markAllAsRead,
|
|
99
|
-
dismiss,
|
|
100
|
-
dismissAll,
|
|
101
|
-
analytics,
|
|
102
|
-
isFetching,
|
|
103
|
-
}, children: children }));
|
|
104
|
-
};
|
|
105
|
-
export function withNotifications(Component) {
|
|
106
|
-
return function WithNamespace(props) {
|
|
107
|
-
return (_jsx(C3NotificationProvider, { children: _jsx(Component, { ...props }) }));
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
export default C3NotificationProvider;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { body01, label01 } from '../styles.js';
|
|
4
|
-
const OrgNameWrapper = styled.div `
|
|
5
|
-
display: flex;
|
|
6
|
-
padding-right: var(--12-px-075-rem-spacing-04, 12px);
|
|
7
|
-
align-items: center;
|
|
8
|
-
gap: var(--16-px-1-rem-spacing-05, 16px);
|
|
9
|
-
align-self: stretch;
|
|
10
|
-
`;
|
|
11
|
-
const SuperOrgWrapper = styled.div `
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
justify-content: center;
|
|
15
|
-
align-items: flex-start;
|
|
16
|
-
gap: var(--0-px-0-rem-spacing-00, 0px);
|
|
17
|
-
`;
|
|
18
|
-
const SuperOrgName = styled.div `
|
|
19
|
-
color: var(--cds-text-secondary, #c6c6c6);
|
|
20
|
-
${label01}
|
|
21
|
-
`;
|
|
22
|
-
const TeamName = styled.div `
|
|
23
|
-
color: var(--cds-text-primary, #f4f4f4);
|
|
24
|
-
text-align: right;
|
|
25
|
-
${body01}
|
|
26
|
-
`;
|
|
27
|
-
const SingleOrgName = styled.div `
|
|
28
|
-
font-size: 14px;
|
|
29
|
-
text-overflow: ellipsis;
|
|
30
|
-
white-space: nowrap;
|
|
31
|
-
overflow: hidden;
|
|
32
|
-
max-width: 150px;
|
|
33
|
-
`;
|
|
34
|
-
export const OrgName = ({ orgName, isSuperOrg, activeSuperOrg }) => (_jsx(OrgNameWrapper, { children: activeSuperOrg && !isSuperOrg ? (_jsxs(SuperOrgWrapper, { title: orgName, children: [_jsx(SuperOrgName, { children: activeSuperOrg }), _jsx(TeamName, { children: orgName })] })) : (_jsx(SingleOrgName, { className: 'bodyText', title: orgName, children: orgName })) }));
|
|
@@ -1,188 +0,0 @@
|
|
|
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, FormLabel, TreeNode, TreeView } from '@carbon/react';
|
|
8
|
-
import { Enterprise } from '@carbon/react/icons/index.esm.js';
|
|
9
|
-
import { useState } from 'react';
|
|
10
|
-
import { leaveOrganization } from '../../../api/organizations.js';
|
|
11
|
-
import { useC3Profile } from '../../c3-user-configuration/c3-profile-provider/c3-profile-provider.js';
|
|
12
|
-
import { useC3UserConfiguration } from '../../c3-user-configuration/c3-user-configuration-provider.js';
|
|
13
|
-
import C3NavigationSideBar from '../c3-navigation-sidebar/c3-navigation-sidebar.js';
|
|
14
|
-
import { useOrgSidebarState } from '../c3-navigation-sidebar/c3-sidebar-state-provider.js';
|
|
15
|
-
import { SwitcherDivider } from '../c3-navigation-sidebar/components.js';
|
|
16
|
-
import { ActiveOrgName, ActiveOrgNameWrapper, ActiveOrgWrapper, ActiveOrgWrapperCustom, ConfirmLeaveModal, ManageOrgOverflowMenu, OrgListWrapper, } from './components.js';
|
|
17
|
-
function renderTree({ nodes, expanded, withIcons = false }) {
|
|
18
|
-
if (!nodes) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
return nodes.map(({ children, renderIcon, isExpanded, isDisabled, ...nodeProps }) => (_jsx(TreeNode, { renderIcon: withIcons ? renderIcon : null, isExpanded: expanded ?? isExpanded, ...(isDisabled && {
|
|
22
|
-
style: { cursor: 'not-allowed' },
|
|
23
|
-
'aria-disabled': 'true',
|
|
24
|
-
}), ...nodeProps, children: renderTree({ nodes: children, expanded, withIcons }) }, nodeProps.id)));
|
|
25
|
-
}
|
|
26
|
-
const C3OrgSidebar = ({ sideBar }) => {
|
|
27
|
-
const { customElements, switchToOrg, manageOrg, manageSuperorg, manageTeam, ...sideBarProps } = sideBar;
|
|
28
|
-
const { isOpen, setIsOpen, scrollBarWidth } = useOrgSidebarState();
|
|
29
|
-
const { userToken, decodedAudience, domain, analyticsTrack, setActiveOrgId } = useC3UserConfiguration();
|
|
30
|
-
const { activeOrg, orgs, removeOrg } = useC3Profile();
|
|
31
|
-
const superOrgs = orgs?.filter((org) => org.isSuperOrg) || [];
|
|
32
|
-
const hasSuperOrgs = superOrgs?.length;
|
|
33
|
-
const isSuperOrgAdmin = activeOrg?.isSuperOrg
|
|
34
|
-
? activeOrg?.permissions?.org?.settings?.read
|
|
35
|
-
: false;
|
|
36
|
-
const teams = activeOrg?.childOrganizations?.filter(({ uuid }) => activeOrg?.isSuperOrg &&
|
|
37
|
-
orgs?.some((org) => org.uuid === uuid) &&
|
|
38
|
-
activeOrg?.uuid !== uuid);
|
|
39
|
-
const isCustomized = Boolean(customElements?.activeOrganization);
|
|
40
|
-
const [isConfirmLeaveModalOpen, setIsConfirmLeaveModalOpen] = useState(false);
|
|
41
|
-
const [orgToLeave, setOrgToLeave] = useState(null);
|
|
42
|
-
const [loadingStatus, setLoadingStatus] = useState('inactive');
|
|
43
|
-
const isLastOrg = orgs?.length === 1;
|
|
44
|
-
const isMemberOfTeam = (orgUuid) => orgs?.some(({ uuid }) => uuid === orgUuid) || false;
|
|
45
|
-
const canUserLeaveOrg = (org) => (((isSuperOrgAdmin && isMemberOfTeam(org.uuid)) || !isSuperOrgAdmin) &&
|
|
46
|
-
!org.permissions?.org?.users?.owner?.update &&
|
|
47
|
-
orgs?.length &&
|
|
48
|
-
orgs.length > 1) ||
|
|
49
|
-
false;
|
|
50
|
-
const canUserManageOrg = (org) => (isSuperOrgAdmin && !org.permissions) ||
|
|
51
|
-
org.permissions?.org?.settings?.read ||
|
|
52
|
-
false;
|
|
53
|
-
const onManageCustomOrg = () => {
|
|
54
|
-
if (sideBar.closeOnClick !== false)
|
|
55
|
-
setIsOpen(false);
|
|
56
|
-
};
|
|
57
|
-
const canSwitchToOrg = (orgId) => orgs?.some((org) => org.uuid === orgId);
|
|
58
|
-
const onManageOrg = ({ uuid, isSuperOrg }) => {
|
|
59
|
-
setIsOpen(false);
|
|
60
|
-
analyticsTrack?.('navBar:orgSettings:click', { orgId: activeOrg?.uuid });
|
|
61
|
-
const isTeam = teams?.some((team) => team.uuid === uuid);
|
|
62
|
-
if (isSuperOrg && manageSuperorg) {
|
|
63
|
-
manageSuperorg(uuid);
|
|
64
|
-
}
|
|
65
|
-
else if (isSuperOrgAdmin && isTeam && manageTeam && activeOrg) {
|
|
66
|
-
manageTeam(activeOrg?.uuid, uuid);
|
|
67
|
-
}
|
|
68
|
-
else if (manageOrg) {
|
|
69
|
-
manageOrg(uuid);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
window.location.href =
|
|
73
|
-
isSuperOrgAdmin &&
|
|
74
|
-
!isSuperOrg &&
|
|
75
|
-
teams?.some((team) => team.uuid === uuid)
|
|
76
|
-
? `https://console.${domain}/org/${activeOrg?.uuid}/team/${uuid}`
|
|
77
|
-
: `https://console.${domain}/org/${uuid}/${isSuperOrg ? 'team' : 'management'}`;
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
const activeOrganization = customElements?.activeOrganization || {
|
|
81
|
-
activeLabel: hasSuperOrgs ? 'Organization' : 'Active organization',
|
|
82
|
-
orgName: activeOrg?.name || '',
|
|
83
|
-
action: {
|
|
84
|
-
onClick: onManageCustomOrg,
|
|
85
|
-
label: 'Manage',
|
|
86
|
-
},
|
|
87
|
-
otherLabel: '',
|
|
88
|
-
teamsLabel: 'Teams',
|
|
89
|
-
};
|
|
90
|
-
const switchOrg = (orgId, track) => {
|
|
91
|
-
setActiveOrgId(orgId);
|
|
92
|
-
if (track)
|
|
93
|
-
analyticsTrack?.('navBar:orgSwitch:click', { orgId });
|
|
94
|
-
switchToOrg?.(orgId);
|
|
95
|
-
setIsOpen(false);
|
|
96
|
-
};
|
|
97
|
-
const confirmLeaveOrg = async () => {
|
|
98
|
-
if (orgToLeave && decodedAudience && userToken) {
|
|
99
|
-
setLoadingStatus('active');
|
|
100
|
-
const { success } = await leaveOrganization({
|
|
101
|
-
token: userToken,
|
|
102
|
-
audience: decodedAudience,
|
|
103
|
-
orgId: orgToLeave.uuid,
|
|
104
|
-
});
|
|
105
|
-
setLoadingStatus(success ? 'finished' : 'error');
|
|
106
|
-
if (success) {
|
|
107
|
-
setIsConfirmLeaveModalOpen(false);
|
|
108
|
-
removeOrg(orgToLeave.uuid);
|
|
109
|
-
}
|
|
110
|
-
if (orgToLeave.uuid === activeOrg?.uuid) {
|
|
111
|
-
const newActiveOrg = orgs?.[0]?.uuid;
|
|
112
|
-
if (newActiveOrg)
|
|
113
|
-
switchOrg(newActiveOrg);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
const itemTabIndex = isOpen ? undefined : -1;
|
|
118
|
-
const groupedBySuperOrg = orgs?.reduce((acc, curr) => {
|
|
119
|
-
const superOrgUuid = curr?.superOrganization?.uuid;
|
|
120
|
-
if (!superOrgUuid) {
|
|
121
|
-
acc[curr.uuid] = acc[curr.uuid] ?? {
|
|
122
|
-
...curr,
|
|
123
|
-
childOrganizations: {},
|
|
124
|
-
};
|
|
125
|
-
return acc;
|
|
126
|
-
}
|
|
127
|
-
acc[superOrgUuid] = acc[superOrgUuid] ?? {
|
|
128
|
-
...curr?.superOrganization,
|
|
129
|
-
childOrganizations: {},
|
|
130
|
-
};
|
|
131
|
-
acc[superOrgUuid].childOrganizations[curr.uuid] = {
|
|
132
|
-
...curr,
|
|
133
|
-
childOrganizations: {},
|
|
134
|
-
};
|
|
135
|
-
return acc;
|
|
136
|
-
}, {}) ?? {};
|
|
137
|
-
return (_jsx(C3NavigationSideBar, { sideBar: {
|
|
138
|
-
...sideBarProps,
|
|
139
|
-
ariaLabel: sideBarProps.ariaLabel || 'Organization Sidebars',
|
|
140
|
-
}, icon: _jsx(Enterprise, { size: 20 }), children: (customElements?.activeOrganization || activeOrg) && (_jsxs(_Fragment, { children: [isCustomized ? (_jsxs(ActiveOrgWrapperCustom, { children: [_jsxs("div", { style: {
|
|
141
|
-
overflow: 'hidden',
|
|
142
|
-
display: 'grid',
|
|
143
|
-
gap: '4px',
|
|
144
|
-
}, children: [_jsx(FormLabel, { children: activeOrganization.activeLabel }), _jsx(ActiveOrgName, { className: 'textPrimary', title: activeOrganization.orgName, "$isCustomized": true, children: activeOrganization.orgName })] }), _jsx(Button, { size: 'md', kind: 'ghost', onClick: () => {
|
|
145
|
-
activeOrganization.action.onClick();
|
|
146
|
-
onManageCustomOrg();
|
|
147
|
-
}, tabIndex: itemTabIndex, children: activeOrganization.action?.label })] })) : (_jsxs(ActiveOrgWrapper, { "$scrollBarWidth": scrollBarWidth, children: [_jsx(FormLabel, { children: activeOrganization.activeLabel }), _jsxs(ActiveOrgNameWrapper, { children: [_jsx(ActiveOrgName, { className: 'textPrimary', title: activeOrganization.orgName, children: activeOrganization.orgName }), activeOrg?.uuid && domain && (_jsx(ManageOrgOverflowMenu, { canManage: canUserManageOrg(activeOrg), canLeave: canUserLeaveOrg(activeOrg), isLastOrg: isLastOrg, isOrgMember: isMemberOfTeam(activeOrg.uuid), orgName: activeOrg.name, onManage: () => onManageOrg(activeOrg), onRequestToLeave: () => {
|
|
148
|
-
setOrgToLeave(activeOrg);
|
|
149
|
-
setIsConfirmLeaveModalOpen(true);
|
|
150
|
-
} }))] }), _jsx(ConfirmLeaveModal, { isOpen: isConfirmLeaveModalOpen, orgName: orgToLeave?.name || '', onConfirm: confirmLeaveOrg, onCancel: () => {
|
|
151
|
-
setIsConfirmLeaveModalOpen(false);
|
|
152
|
-
setOrgToLeave(null);
|
|
153
|
-
}, loadingStatus: loadingStatus })] })), _jsx(SwitcherDivider, {}), _jsx(OrgListWrapper, { children: _jsx(TreeView, { label: 'All organizations', ...(activeOrg?.uuid ? { selected: [activeOrg?.uuid] } : {}), children: renderTree({
|
|
154
|
-
nodes: Object.values(groupedBySuperOrg)?.map((element) => {
|
|
155
|
-
const userTeams = Object.values(element?.childOrganizations)?.filter((child) => isMemberOfTeam(child.uuid));
|
|
156
|
-
const defaultIsExpanded = (activeOrg?.uuid === element.uuid ||
|
|
157
|
-
!isMemberOfTeam(element.uuid) ||
|
|
158
|
-
userTeams?.some((team) => activeOrg?.uuid === team.uuid)) ??
|
|
159
|
-
false;
|
|
160
|
-
return {
|
|
161
|
-
children: userTeams?.length > 0
|
|
162
|
-
? userTeams.map((team) => {
|
|
163
|
-
return {
|
|
164
|
-
id: team.uuid,
|
|
165
|
-
label: team.name,
|
|
166
|
-
isExpanded: false,
|
|
167
|
-
value: team.uuid,
|
|
168
|
-
renderIcon: null,
|
|
169
|
-
onSelect: canSwitchToOrg(team.uuid)
|
|
170
|
-
? () => switchOrg(team.uuid, true)
|
|
171
|
-
: undefined,
|
|
172
|
-
};
|
|
173
|
-
})
|
|
174
|
-
: null,
|
|
175
|
-
id: element.uuid,
|
|
176
|
-
label: element.name,
|
|
177
|
-
value: element.uuid,
|
|
178
|
-
renderIcon: null,
|
|
179
|
-
isExpanded: defaultIsExpanded,
|
|
180
|
-
isDisabled: !isMemberOfTeam(element.uuid),
|
|
181
|
-
onSelect: canSwitchToOrg(element.uuid)
|
|
182
|
-
? () => switchOrg(element.uuid, true)
|
|
183
|
-
: undefined,
|
|
184
|
-
};
|
|
185
|
-
}),
|
|
186
|
-
}) }) })] })) }));
|
|
187
|
-
};
|
|
188
|
-
export default C3OrgSidebar;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { DropdownProps } from '@carbon/react/lib/components/Dropdown/Dropdown';
|
|
2
|
-
import type { FC } from 'react';
|
|
3
|
-
import type { Organization } from '../../../utils/camunda.types';
|
|
4
|
-
import type { LoadingStatus } from '../c3-navigation-appbar/c3-navigation-appbar';
|
|
5
|
-
export declare const ActiveOrgWrapperCustom: any;
|
|
6
|
-
export declare const ActiveOrgWrapper: any;
|
|
7
|
-
export declare const ActiveSuperorgWrapper: any;
|
|
8
|
-
export declare const ActiveOrgNameWrapper: any;
|
|
9
|
-
export declare const ActiveOrgName: any;
|
|
10
|
-
export declare const ConfirmLeaveModal: FC<{
|
|
11
|
-
isOpen: boolean;
|
|
12
|
-
orgName: string;
|
|
13
|
-
onConfirm: () => void;
|
|
14
|
-
onCancel: () => void;
|
|
15
|
-
loadingStatus: LoadingStatus;
|
|
16
|
-
}>;
|
|
17
|
-
export declare const ManageOrgOverflowMenu: FC<{
|
|
18
|
-
canManage: boolean;
|
|
19
|
-
canLeave: boolean;
|
|
20
|
-
isLastOrg?: boolean;
|
|
21
|
-
isOrgMember: boolean;
|
|
22
|
-
orgName: string;
|
|
23
|
-
onManage: () => void;
|
|
24
|
-
onRequestToLeave: () => void;
|
|
25
|
-
}>;
|
|
26
|
-
export declare const StyledDropdown: FC<DropdownProps<Organization> & {
|
|
27
|
-
$scrollBarWidth: number;
|
|
28
|
-
}>;
|
|
29
|
-
export declare const OrgListWrapper: any;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } 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 { Dropdown, Modal, OverflowMenu, OverflowMenuItem, Tooltip, } from '@carbon/react';
|
|
8
|
-
import styled from 'styled-components';
|
|
9
|
-
export const ActiveOrgWrapperCustom = styled.div `
|
|
10
|
-
padding: 1.5rem 1rem 15px;
|
|
11
|
-
display: grid;
|
|
12
|
-
grid-auto-flow: column;
|
|
13
|
-
gap: 0.25rem;
|
|
14
|
-
`;
|
|
15
|
-
export const ActiveOrgWrapper = styled.div `
|
|
16
|
-
padding: 15px 0 0.5rem 1rem;
|
|
17
|
-
width: ${({ $scrollBarWidth }) => `calc(16rem - ${$scrollBarWidth}px)`};
|
|
18
|
-
`;
|
|
19
|
-
export const ActiveSuperorgWrapper = styled.div `
|
|
20
|
-
padding: 24px 0 0.5rem 0;
|
|
21
|
-
width: ${({ $scrollBarWidth }) => `calc(16rem - ${$scrollBarWidth}px)`};
|
|
22
|
-
display: flex;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
|
|
25
|
-
label {
|
|
26
|
-
padding-left: 1rem;
|
|
27
|
-
}
|
|
28
|
-
`;
|
|
29
|
-
export const ActiveOrgNameWrapper = styled.div `
|
|
30
|
-
display: flex;
|
|
31
|
-
align-items: center;
|
|
32
|
-
justify-content: space-between;
|
|
33
|
-
`;
|
|
34
|
-
export const ActiveOrgName = styled.div `
|
|
35
|
-
height: 20px; // Set minimum height to allow decenders to be rendered
|
|
36
|
-
line-height: 20px;
|
|
37
|
-
font-size: 14px;
|
|
38
|
-
${({ $isCustomized }) => ($isCustomized ? '' : 'width: calc(-2px + 13rem)')};
|
|
39
|
-
text-overflow: ellipsis;
|
|
40
|
-
overflow: hidden;
|
|
41
|
-
white-space: nowrap;
|
|
42
|
-
`;
|
|
43
|
-
export const ConfirmLeaveModal = ({ isOpen, onConfirm, onCancel, orgName, loadingStatus }) => {
|
|
44
|
-
return (_jsxs(Modal, { danger: true, open: isOpen, modalHeading: 'Leave organization', primaryButtonText: 'Leave', secondaryButtonText: 'Cancel', closeButtonLabel: 'Cancel', loadingStatus: loadingStatus, onRequestClose: onCancel, onRequestSubmit: onConfirm, onSecondarySubmit: onCancel, loadingDescription: 'Leaving', children: [_jsxs("p", { children: ["Are you sure you want to leave ", _jsx("strong", { children: orgName }), "?"] }), _jsx("br", {}), _jsx("p", { children: "Leaving this organization will remove you from all associated teams and projects. To regain access you would need to reach out to the admin/owner of this organization." })] }));
|
|
45
|
-
};
|
|
46
|
-
const _Tooltip = styled(Tooltip) `
|
|
47
|
-
.cds--tooltip-content {
|
|
48
|
-
max-width: 200px;
|
|
49
|
-
}
|
|
50
|
-
`;
|
|
51
|
-
export const ManageOrgOverflowMenu = ({ canManage, canLeave, isLastOrg, isOrgMember, onManage, onRequestToLeave, orgName, }) => {
|
|
52
|
-
const tooltipLabel = !isOrgMember
|
|
53
|
-
? 'You are not a member of this team. You can only leave teams you are a member of.'
|
|
54
|
-
: isLastOrg
|
|
55
|
-
? 'You need to be a member of at least one organization. Join a different organization first if you wish to leave.'
|
|
56
|
-
: 'Owners cannot leave an organization directly. Assign another user as an owner if you wish to leave.';
|
|
57
|
-
return (_jsxs(OverflowMenu, { size: 'sm', flipped: true, "aria-label": 'Organization options menu', align: 'top-end', children: [canManage && (_jsx(OverflowMenuItem, { itemText: 'Manage organization', onClick: onManage, "aria-label": `Manage organization - ${orgName}` })), _jsx(OverflowMenuItem, { itemText: canLeave ? ('Leave organization') : (_jsx(_Tooltip, { label: tooltipLabel, align: 'bottom-end', children: _jsx("span", { children: "Leave organization" }) })), disabled: !canLeave, onClick: onRequestToLeave, "aria-label": `Leave organization - ${orgName}` })] }));
|
|
58
|
-
};
|
|
59
|
-
export const StyledDropdown = styled(Dropdown) `
|
|
60
|
-
grid-gap: 0;
|
|
61
|
-
|
|
62
|
-
div {
|
|
63
|
-
max-width: calc(173px - ${({ $scrollBarWidth }) => $scrollBarWidth || 0}px);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.cds--list-box__menu {
|
|
67
|
-
max-inline-size: none;
|
|
68
|
-
min-inline-size: unset;
|
|
69
|
-
}
|
|
70
|
-
`;
|
|
71
|
-
export const OrgListWrapper = styled.div `
|
|
72
|
-
padding: 1rem 1rem 15px;
|
|
73
|
-
|
|
74
|
-
.cds--tree-node__label__text {
|
|
75
|
-
white-space: normal !important;
|
|
76
|
-
word-wrap: break-word;
|
|
77
|
-
word-break: break-word;
|
|
78
|
-
max-width: 200px;
|
|
79
|
-
display: inline-block;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.cds--tree-node__label__text-button {
|
|
83
|
-
white-space: normal !important;
|
|
84
|
-
height: auto !important;
|
|
85
|
-
min-height: 2rem;
|
|
86
|
-
padding: 0.5rem 1rem;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.cds--tree-node {
|
|
90
|
-
min-height: auto;
|
|
91
|
-
}
|
|
92
|
-
`;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare function useOnClickOutside(handler: (e: Event) => void): {
|
|
2
|
-
panelRef: import("react").RefObject<HTMLElement | null>;
|
|
3
|
-
setPanelRef: (node: unknown) => void;
|
|
4
|
-
iconRef: import("react").RefObject<HTMLElement | null>;
|
|
5
|
-
setIconRef: (node: unknown) => void;
|
|
6
|
-
};
|
|
7
|
-
export declare function executeMediaQuery(mediaQuery: string): MediaQueryList;
|
|
8
|
-
export declare function useMediaQuery(mediaQuery: string): boolean;
|
|
@@ -1,58 +0,0 @@
|
|
|
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 { useCallback, useEffect, useRef, useState } from 'react';
|
|
7
|
-
export function useOnClickOutside(handler) {
|
|
8
|
-
const panelRef = useRef(null);
|
|
9
|
-
const iconRef = useRef(null);
|
|
10
|
-
const handlerRef = useRef(handler);
|
|
11
|
-
handlerRef.current = handler;
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
const listener = (event) => {
|
|
14
|
-
if (!panelRef.current ||
|
|
15
|
-
!iconRef.current ||
|
|
16
|
-
(event.target instanceof Node &&
|
|
17
|
-
(panelRef.current.contains(event.target) ||
|
|
18
|
-
iconRef.current.contains(event.target)))) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
handlerRef.current(event);
|
|
22
|
-
};
|
|
23
|
-
document.addEventListener('mousedown', listener);
|
|
24
|
-
document.addEventListener('touchstart', listener);
|
|
25
|
-
return () => {
|
|
26
|
-
document.removeEventListener('mousedown', listener);
|
|
27
|
-
document.removeEventListener('touchstart', listener);
|
|
28
|
-
};
|
|
29
|
-
}, [handlerRef]);
|
|
30
|
-
const setPanelRef = useCallback((node) => {
|
|
31
|
-
if (node && node instanceof HTMLElement) {
|
|
32
|
-
panelRef.current = node;
|
|
33
|
-
}
|
|
34
|
-
}, []);
|
|
35
|
-
const setIconRef = useCallback((node) => {
|
|
36
|
-
if (node && node instanceof HTMLElement) {
|
|
37
|
-
iconRef.current = node;
|
|
38
|
-
}
|
|
39
|
-
}, []);
|
|
40
|
-
return { panelRef, setPanelRef, iconRef, setIconRef };
|
|
41
|
-
}
|
|
42
|
-
export function executeMediaQuery(mediaQuery) {
|
|
43
|
-
return window.matchMedia(mediaQuery);
|
|
44
|
-
}
|
|
45
|
-
export function useMediaQuery(mediaQuery) {
|
|
46
|
-
const [isMatched, setIsMatched] = useState(executeMediaQuery(mediaQuery).matches);
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
const query = executeMediaQuery(mediaQuery);
|
|
49
|
-
const listener = (event) => {
|
|
50
|
-
setIsMatched(event.matches);
|
|
51
|
-
};
|
|
52
|
-
query.addEventListener('change', listener);
|
|
53
|
-
return () => {
|
|
54
|
-
query.removeEventListener('change', listener);
|
|
55
|
-
};
|
|
56
|
-
}, []);
|
|
57
|
-
return isMatched;
|
|
58
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
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 { C3Navigation } from './c3-navigation.js';
|
|
7
|
-
import { withNotifications } from './c3-notification-provider/c3-notification-provider.js';
|
|
8
|
-
export default withNotifications(C3Navigation);
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { JSX } from 'react';
|
|
2
|
-
import type { C3HelpCenterProps } from '../../c3-help-center/c3-help-center';
|
|
3
|
-
import type { C3NavigationAppProps, C3NavigationElementProps, C3NavigationNavBarProps, C3NavigationProps } from '../c3-navigation.types';
|
|
4
|
-
export declare function createAppProps(): C3NavigationAppProps;
|
|
5
|
-
export declare function createAppBarProps(options?: {
|
|
6
|
-
isOpen?: boolean;
|
|
7
|
-
elements?: Array<C3NavigationElementProps>;
|
|
8
|
-
useElementsFromConfig?: boolean;
|
|
9
|
-
}): C3NavigationProps['appBar'];
|
|
10
|
-
export declare function createNavBarBarProps({ orgName, elements, showLicenseTag, showProductionLicense, isCommercial, expiresAt, }?: {
|
|
11
|
-
elements?: C3NavigationNavBarProps['elements'];
|
|
12
|
-
orgName?: string;
|
|
13
|
-
showLicenseTag?: boolean;
|
|
14
|
-
showProductionLicense?: boolean;
|
|
15
|
-
isCommercial?: boolean;
|
|
16
|
-
expiresAt?: number | string;
|
|
17
|
-
}): C3NavigationNavBarProps;
|
|
18
|
-
export declare function createInfoSideBarProps(options: {
|
|
19
|
-
isOpen: boolean;
|
|
20
|
-
preceedingDividerOn2ndElement?: boolean;
|
|
21
|
-
}): C3NavigationProps['infoSideBar'];
|
|
22
|
-
export declare function createOrgSideBarProps(options: {
|
|
23
|
-
isOpen: boolean;
|
|
24
|
-
orgCount?: number;
|
|
25
|
-
useConfig?: boolean;
|
|
26
|
-
}): C3NavigationProps['orgSideBar'];
|
|
27
|
-
export declare function createUserSideBarProps(options: {
|
|
28
|
-
isOpen: boolean;
|
|
29
|
-
customSection?: JSX.Element;
|
|
30
|
-
hideThemeSelector?: boolean;
|
|
31
|
-
}): C3NavigationProps['userSideBar'];
|
|
32
|
-
export declare function createNotificationSideBarProps(options: {
|
|
33
|
-
isOpen: boolean;
|
|
34
|
-
}): C3NavigationProps['notificationSideBar'];
|
|
35
|
-
export declare const createHelpCenterProps: (options?: Partial<C3HelpCenterProps>) => C3NavigationProps["helpCenter"];
|