@camunda/camunda-composite-components 0.1.1 → 0.1.2
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/README.md +60 -0
- package/lib/esm/api/api.d.ts +19 -19
- package/lib/esm/api/api.js +67 -65
- package/lib/esm/api/endpoints.const.d.ts +12 -12
- package/lib/esm/api/endpoints.const.js +25 -24
- package/lib/esm/api/jwt.utils.d.ts +3 -3
- package/lib/esm/api/jwt.utils.js +21 -23
- package/lib/esm/api/notifications.d.ts +35 -64
- package/lib/esm/api/notifications.js +159 -168
- package/lib/esm/components/c3-empty-state/c3-empty-state.d.ts +2 -9
- package/lib/esm/components/c3-empty-state/c3-empty-state.js +17 -58
- package/lib/esm/components/c3-empty-state/c3-empty-state.test.d.ts +1 -0
- package/lib/esm/components/c3-empty-state/c3-empty-state.test.js +12 -0
- package/lib/esm/components/c3-empty-state/c3-empty-state.types.d.ts +19 -19
- package/lib/esm/components/c3-empty-state/c3-empty-state.types.js +1 -1
- package/lib/esm/components/c3-navigation/c3-info-button.d.ts +3 -3
- package/lib/esm/components/c3-navigation/c3-info-button.js +5 -13
- package/lib/esm/components/c3-navigation/c3-navigation-actions/c3-action-buttons.d.ts +5 -5
- package/lib/esm/components/c3-navigation/c3-navigation-actions/c3-action-buttons.js +13 -21
- package/lib/esm/components/c3-navigation/c3-navigation-actions/c3-action-buttons.types.d.ts +10 -6
- package/lib/esm/components/c3-navigation/c3-navigation-actions/c3-action-buttons.types.js +1 -1
- package/lib/esm/components/c3-navigation/c3-navigation-appbar.d.ts +3 -3
- package/lib/esm/components/c3-navigation/c3-navigation-appbar.js +68 -157
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-info-sidebar.d.ts +5 -5
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-info-sidebar.js +39 -62
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar-element.d.ts +9 -10
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar-element.js +33 -56
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.d.ts +9 -9
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.js +57 -110
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.types.d.ts +61 -72
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.types.js +1 -1
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-notification-sidebar.d.ts +4 -4
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-notification-sidebar.js +88 -142
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-org-sidebar.d.ts +5 -5
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-org-sidebar.js +51 -105
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-sidebar-state-provider.d.ts +24 -26
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-sidebar-state-provider.js +25 -38
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-user-sidebar.d.ts +5 -5
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-user-sidebar.js +57 -146
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/components.d.ts +2 -8
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/components.js +4 -4
- package/lib/esm/components/c3-navigation/c3-navigation.d.ts +2 -14
- package/lib/esm/components/c3-navigation/c3-navigation.js +90 -214
- package/lib/esm/components/c3-navigation/c3-navigation.test.d.ts +1 -0
- package/lib/esm/components/c3-navigation/c3-navigation.test.js +80 -0
- package/lib/esm/components/c3-navigation/c3-navigation.types.d.ts +63 -70
- package/lib/esm/components/c3-navigation/c3-navigation.types.js +1 -1
- package/lib/esm/components/c3-navigation/c3-notification-provider/c3-notification-container.d.ts +13 -30
- package/lib/esm/components/c3-navigation/c3-notification-provider/c3-notification-container.js +70 -114
- package/lib/esm/components/c3-navigation/c3-notification-provider/c3-notification-provider.d.ts +27 -29
- package/lib/esm/components/c3-navigation/c3-notification-provider/c3-notification-provider.js +90 -118
- package/lib/esm/components/c3-navigation/helpers.d.ts +3 -5
- package/lib/esm/components/c3-navigation/helpers.js +49 -53
- package/lib/esm/components/c3-navigation/index.d.ts +2 -4
- package/lib/esm/components/c3-navigation/index.js +3 -3
- package/lib/esm/components/c3-navigation/story-helpers.d.ts +18 -24
- package/lib/esm/components/c3-navigation/story-helpers.js +197 -200
- package/lib/esm/components/c3-navigation/story-templates.d.ts +8 -8
- package/lib/esm/components/c3-navigation/story-templates.js +33 -66
- package/lib/esm/components/c3-user-configuration/c3-user-configuration-provider.d.ts +16 -20
- package/lib/esm/components/c3-user-configuration/c3-user-configuration-provider.js +4 -9
- package/lib/esm/components/test-utils.d.ts +3 -0
- package/lib/esm/components/test-utils.js +22 -0
- package/lib/esm/icons/c3-icons.d.ts +5 -8
- package/lib/esm/icons/c3-icons.js +14 -82
- package/lib/esm/icons/c3-icons.types.d.ts +1 -1
- package/lib/esm/icons/c3-icons.types.js +1 -1
- package/lib/esm/index.d.ts +9 -14
- package/lib/esm/index.js +4 -4
- package/package.json +30 -20
|
@@ -1,30 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
C3NavigationAppProps,
|
|
4
|
-
C3NavigationElementProps,
|
|
5
|
-
C3NavigationNavBarProps,
|
|
6
|
-
C3NavigationProps,
|
|
7
|
-
} from "./c3-navigation.types"
|
|
8
|
-
export declare function createAppProps(): C3NavigationAppProps
|
|
1
|
+
import { C3NavigationAppProps, C3NavigationElementProps, C3NavigationNavBarProps, C3NavigationProps } from "./c3-navigation.types";
|
|
2
|
+
export declare function createAppProps(): C3NavigationAppProps;
|
|
9
3
|
export declare function createAppBarProps(options?: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}): C3NavigationProps["appBar"]
|
|
4
|
+
isOpen?: boolean;
|
|
5
|
+
elements?: Array<C3NavigationElementProps>;
|
|
6
|
+
}): C3NavigationProps["appBar"];
|
|
13
7
|
export declare function createNavBarBarProps(options?: {
|
|
14
|
-
|
|
15
|
-
}): C3NavigationNavBarProps
|
|
8
|
+
elements?: C3NavigationNavBarProps["elements"];
|
|
9
|
+
}): C3NavigationNavBarProps;
|
|
16
10
|
export declare function createInfoSideBarProps(options: {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}): C3NavigationProps["infoSideBar"]
|
|
11
|
+
isOpen: boolean;
|
|
12
|
+
preceedingDividerOn2ndElement?: boolean;
|
|
13
|
+
}): C3NavigationProps["infoSideBar"];
|
|
20
14
|
export declare function createOrgSideBarProps(options: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}): C3NavigationProps["orgSideBar"]
|
|
15
|
+
isOpen: boolean;
|
|
16
|
+
orgCount: number;
|
|
17
|
+
}): C3NavigationProps["orgSideBar"];
|
|
24
18
|
export declare function createUserSideBarProps(options: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}): C3NavigationProps["userSideBar"]
|
|
19
|
+
isOpen: boolean;
|
|
20
|
+
customSection?: JSX.Element;
|
|
21
|
+
}): C3NavigationProps["userSideBar"];
|
|
28
22
|
export declare function createNotificationSideBarProps(options: {
|
|
29
|
-
|
|
30
|
-
}): C3NavigationProps["notificationSideBar"]
|
|
23
|
+
isOpen: boolean;
|
|
24
|
+
}): C3NavigationProps["notificationSideBar"];
|
|
@@ -1,214 +1,211 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { Link } from "@carbon/react"
|
|
3
|
-
import { ArrowRight, TrashCan, Add } from "@carbon/react/icons"
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Link } from "@carbon/react";
|
|
3
|
+
import { ArrowRight, TrashCan, Add } from "@carbon/react/icons";
|
|
4
4
|
export function createAppProps() {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
return {
|
|
6
|
+
name: "Console",
|
|
7
|
+
ariaLabel: "Camunda Console",
|
|
8
|
+
routeProps: {
|
|
9
|
+
href: "https://www.camunda.com",
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
12
|
}
|
|
13
13
|
export function createAppBarProps(options = {}) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
14
|
+
return {
|
|
15
|
+
isOpen: Boolean(options?.isOpen),
|
|
16
|
+
elements: options?.elements ?? [
|
|
17
|
+
{
|
|
18
|
+
key: "console",
|
|
19
|
+
label: "Console",
|
|
20
|
+
active: true,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
key: "modeler",
|
|
24
|
+
label: "Modeler",
|
|
25
|
+
active: false,
|
|
26
|
+
routeProps: { onClick: () => console.log("Redirecting to Modeler...") },
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
key: "operate",
|
|
30
|
+
label: "Operate",
|
|
31
|
+
active: false,
|
|
32
|
+
target: "_blank",
|
|
33
|
+
href: "https://camunda.com/",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
key: "tasklist",
|
|
37
|
+
label: "Task List",
|
|
38
|
+
active: false,
|
|
39
|
+
subElements: [
|
|
40
|
+
{
|
|
41
|
+
key: "cluster-a",
|
|
42
|
+
label: "Cluster A",
|
|
43
|
+
href: "https://camunda.com/",
|
|
44
|
+
target: "_blank",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
key: "cluster-b",
|
|
48
|
+
label: "Cluster B",
|
|
49
|
+
onClick: () => console.log("Redirecting to Tasklist..."),
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: "cluster-c",
|
|
53
|
+
label: "Cluster C",
|
|
54
|
+
routeProps: {
|
|
55
|
+
onClick: () => console.log("Redirecting to Tasklist..."),
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
62
|
}
|
|
63
63
|
export function createNavBarBarProps(options = {}) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
}
|
|
64
|
+
return {
|
|
65
|
+
elements: options?.elements ?? [
|
|
66
|
+
{
|
|
67
|
+
key: "dashboard",
|
|
68
|
+
label: "Dashboard",
|
|
69
|
+
isCurrentPage: true,
|
|
70
|
+
routeProps: {},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
key: "clusters",
|
|
74
|
+
label: "Clusters",
|
|
75
|
+
isCurrentPage: false,
|
|
76
|
+
routeProps: {
|
|
77
|
+
onClick: () => console.log("Redirecting to clusters..."),
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
orgName: "Camunda",
|
|
82
|
+
tags: [
|
|
83
|
+
{
|
|
84
|
+
key: "stage",
|
|
85
|
+
label: "Production",
|
|
86
|
+
color: "red",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
key: "githash",
|
|
90
|
+
label: "abcdefg",
|
|
91
|
+
color: "teal",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
key: "fooTooltip",
|
|
95
|
+
label: "I am a tooltip pill",
|
|
96
|
+
color: "cool-gray",
|
|
97
|
+
tooltip: {
|
|
98
|
+
content: (React.createElement("p", null,
|
|
99
|
+
"tooltip popover with a",
|
|
100
|
+
" ",
|
|
101
|
+
React.createElement(Link, { href: "http://camunda.com/" }, "link"))),
|
|
102
|
+
buttonLabel: "open the tooltip",
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
};
|
|
110
107
|
}
|
|
111
108
|
export function createInfoSideBarProps(options) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
109
|
+
return {
|
|
110
|
+
isOpen: options.isOpen,
|
|
111
|
+
onOpen: () => console.log("Opened info sidebar"),
|
|
112
|
+
elements: [
|
|
113
|
+
{
|
|
114
|
+
key: "info1",
|
|
115
|
+
label: "Info 1",
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
key: "info2",
|
|
119
|
+
label: "Info 2",
|
|
120
|
+
preceedingDivider: options.preceedingDividerOn2ndElement,
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
};
|
|
127
124
|
}
|
|
128
125
|
export function createOrgSideBarProps(options) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
126
|
+
const elements = [];
|
|
127
|
+
for (let i = 0; i < options.orgCount; i++) {
|
|
128
|
+
elements.push({
|
|
129
|
+
key: `org-${i}`,
|
|
130
|
+
label: `Organization ${i}`,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
isOpen: options.isOpen,
|
|
135
|
+
customElements: {
|
|
136
|
+
activeOrganization: {
|
|
137
|
+
activeLabel: "Active Organization",
|
|
138
|
+
otherLabel: "Other Organization",
|
|
139
|
+
orgName: "Camunda",
|
|
140
|
+
action: {
|
|
141
|
+
label: "Manage",
|
|
142
|
+
onClick: () => console.log("Manage organization"),
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
elements,
|
|
147
|
+
bottomElements: [
|
|
148
|
+
{
|
|
149
|
+
key: "createTrial",
|
|
150
|
+
label: "Create new Trial Org",
|
|
151
|
+
renderIcon: Add,
|
|
152
|
+
onClick: () => {
|
|
153
|
+
console.log("clicked");
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
};
|
|
161
158
|
}
|
|
162
159
|
export function createUserSideBarProps(options) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
160
|
+
return {
|
|
161
|
+
isOpen: options.isOpen,
|
|
162
|
+
version: "8.3.0-alpha4",
|
|
163
|
+
customElements: {
|
|
164
|
+
customSection: options.customSection,
|
|
165
|
+
profile: {
|
|
166
|
+
label: "Profile",
|
|
167
|
+
user: {
|
|
168
|
+
email: "teamcloud@camunda.com",
|
|
169
|
+
name: "Team Cloud",
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
themeSelector: {
|
|
173
|
+
currentTheme: "dark",
|
|
174
|
+
onChange: () => console.log("Selected dark theme"),
|
|
175
|
+
},
|
|
176
|
+
stageToggle: {
|
|
177
|
+
prodFeaturesEnabled: true,
|
|
178
|
+
toggle: () => console.log("Toggle stage"),
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
elements: [
|
|
182
|
+
{
|
|
183
|
+
key: "cookie",
|
|
184
|
+
label: "Cookie Preferences",
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
key: "terms",
|
|
188
|
+
label: "Terms of use",
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
key: "logout",
|
|
192
|
+
label: "Log out",
|
|
193
|
+
kind: "ghost",
|
|
194
|
+
renderIcon: ArrowRight,
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
bottomElements: [
|
|
198
|
+
{
|
|
199
|
+
key: "delete",
|
|
200
|
+
label: "Delete account",
|
|
201
|
+
kind: "danger--ghost",
|
|
202
|
+
renderIcon: TrashCan,
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
};
|
|
209
206
|
}
|
|
210
207
|
export function createNotificationSideBarProps(options) {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
208
|
+
return {
|
|
209
|
+
isOpen: options.isOpen,
|
|
210
|
+
};
|
|
214
211
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { FC } from "react"
|
|
2
|
-
import { C3Navigation } from "./c3-navigation"
|
|
3
|
-
import { ComponentStory } from "@storybook/react"
|
|
4
|
-
export declare const DefaultTemplate: ComponentStory<typeof C3Navigation
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { C3Navigation } from "./c3-navigation";
|
|
3
|
+
import { ComponentStory } from "@storybook/react";
|
|
4
|
+
export declare const DefaultTemplate: ComponentStory<typeof C3Navigation>;
|
|
5
5
|
export declare const SuperUserToggle: FC<{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
export declare const NavbarWithCustomSection: FC
|
|
6
|
+
isActive?: boolean;
|
|
7
|
+
onChange?: (newValue: boolean) => void;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const NavbarWithCustomSection: FC;
|
|
@@ -1,68 +1,35 @@
|
|
|
1
|
-
import React, { useState } from "react"
|
|
2
|
-
import { C3Navigation } from "./c3-navigation"
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "./story-helpers"
|
|
9
|
-
import { SwitcherDivider, Toggle } from "@carbon/react"
|
|
10
|
-
export const DefaultTemplate = (args) =>
|
|
11
|
-
React.createElement(
|
|
12
|
-
React.Fragment,
|
|
13
|
-
null,
|
|
14
|
-
React.createElement(C3Navigation, { ...args }),
|
|
15
|
-
React.createElement("div", { id: "main-content" }),
|
|
16
|
-
)
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { C3Navigation } from "./c3-navigation";
|
|
3
|
+
import { createAppBarProps, createAppProps, createNavBarBarProps, createUserSideBarProps, } from "./story-helpers";
|
|
4
|
+
import { SwitcherDivider, Toggle } from "@carbon/react";
|
|
5
|
+
export const DefaultTemplate = (args) => (React.createElement(React.Fragment, null,
|
|
6
|
+
React.createElement(C3Navigation, { ...args }),
|
|
7
|
+
React.createElement("div", { id: "main-content" })));
|
|
17
8
|
export const SuperUserToggle = ({ isActive, onChange }) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"div",
|
|
24
|
-
{ style: { padding: ".5rem 1rem" } },
|
|
25
|
-
React.createElement(Toggle, {
|
|
26
|
-
size: "sm",
|
|
27
|
-
id: "toggle-super-admin-mode",
|
|
28
|
-
defaultToggled: isActive,
|
|
29
|
-
onToggle: (superAdminModeActive) => onChange?.(superAdminModeActive),
|
|
30
|
-
labelText: "Enter super-admin mode",
|
|
31
|
-
"aria-label": "Enter super-admin mode",
|
|
32
|
-
}),
|
|
33
|
-
),
|
|
34
|
-
)
|
|
35
|
-
}
|
|
9
|
+
return (React.createElement(React.Fragment, null,
|
|
10
|
+
React.createElement(SwitcherDivider, null),
|
|
11
|
+
React.createElement("div", { style: { padding: ".5rem 1rem" } },
|
|
12
|
+
React.createElement(Toggle, { size: "sm", id: "toggle-super-admin-mode", defaultToggled: isActive, onToggle: (superAdminModeActive) => onChange?.(superAdminModeActive), labelText: "Enter super-admin mode", "aria-label": "Enter super-admin mode" }))));
|
|
13
|
+
};
|
|
36
14
|
export const NavbarWithCustomSection = () => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
customElements: {
|
|
59
|
-
customSection: React.createElement(SuperUserToggle, {
|
|
60
|
-
isActive: isSuperAdminModeActive,
|
|
61
|
-
onChange: setIsSuperAdminModeActive,
|
|
62
|
-
}),
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
}),
|
|
66
|
-
React.createElement("div", { id: "main-content" }),
|
|
67
|
-
)
|
|
68
|
-
}
|
|
15
|
+
const [isSuperAdminModeActive, setIsSuperAdminModeActive] = useState(true);
|
|
16
|
+
return (React.createElement(React.Fragment, null,
|
|
17
|
+
React.createElement(C3Navigation, { app: createAppProps(), appBar: createAppBarProps(), navbar: {
|
|
18
|
+
...createNavBarBarProps(),
|
|
19
|
+
tags: isSuperAdminModeActive
|
|
20
|
+
? [
|
|
21
|
+
{
|
|
22
|
+
key: "superUserMode",
|
|
23
|
+
label: "Super-user mode",
|
|
24
|
+
color: "high-contrast",
|
|
25
|
+
},
|
|
26
|
+
]
|
|
27
|
+
: undefined,
|
|
28
|
+
}, userSideBar: {
|
|
29
|
+
...createUserSideBarProps({ isOpen: false }),
|
|
30
|
+
customElements: {
|
|
31
|
+
customSection: (React.createElement(SuperUserToggle, { isActive: isSuperAdminModeActive, onChange: setIsSuperAdminModeActive })),
|
|
32
|
+
},
|
|
33
|
+
} }),
|
|
34
|
+
React.createElement("div", { id: "main-content" })));
|
|
35
|
+
};
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import React, { FC, ReactNode } from "react"
|
|
2
|
-
import { Endpoints, Stage } from "../../api/endpoints.const"
|
|
1
|
+
import React, { FC, ReactNode } from "react";
|
|
2
|
+
import { Endpoints, Stage } from "../../api/endpoints.const";
|
|
3
3
|
declare type C3UserConfigurationBase = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
4
|
+
activeOrganizationId: string;
|
|
5
|
+
userToken: string;
|
|
6
|
+
getNewUserToken: () => Promise<string>;
|
|
7
|
+
};
|
|
8
8
|
declare type C3UserConfigurationWithEndpoints = C3UserConfigurationBase & {
|
|
9
|
-
|
|
10
|
-
}
|
|
9
|
+
endpoints: Endpoints;
|
|
10
|
+
};
|
|
11
11
|
declare type C3UserConfigurationWithStage = C3UserConfigurationBase & {
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
export declare type C3UserConfiguration =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
children?: ReactNode
|
|
21
|
-
}
|
|
22
|
-
>
|
|
23
|
-
export default C3UserConfigurationProvider
|
|
12
|
+
stage: Stage;
|
|
13
|
+
};
|
|
14
|
+
export declare type C3UserConfiguration = C3UserConfigurationWithEndpoints | C3UserConfigurationWithStage;
|
|
15
|
+
export declare const C3UserConfigurationContext: React.Context<C3UserConfiguration | null>;
|
|
16
|
+
declare const C3UserConfigurationProvider: FC<C3UserConfiguration & {
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
}>;
|
|
19
|
+
export default C3UserConfigurationProvider;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
export const C3UserConfigurationContext = React.createContext(null)
|
|
3
|
-
const C3UserConfigurationProvider = ({ children, ...config }) =>
|
|
4
|
-
|
|
5
|
-
C3UserConfigurationContext.Provider,
|
|
6
|
-
{ value: config },
|
|
7
|
-
children,
|
|
8
|
-
)
|
|
9
|
-
export default C3UserConfigurationProvider
|
|
1
|
+
import React from "react";
|
|
2
|
+
export const C3UserConfigurationContext = React.createContext(null);
|
|
3
|
+
const C3UserConfigurationProvider = ({ children, ...config }) => (React.createElement(C3UserConfigurationContext.Provider, { value: config }, children));
|
|
4
|
+
export default C3UserConfigurationProvider;
|