@camunda/camunda-composite-components 0.0.41 → 0.0.42
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 +2 -1
- package/lib/esm/api/api.d.ts +19 -19
- package/lib/esm/api/api.js +65 -67
- package/lib/esm/api/endpoints.const.d.ts +12 -12
- package/lib/esm/api/endpoints.const.js +24 -25
- package/lib/esm/api/jwt.utils.d.ts +3 -3
- package/lib/esm/api/jwt.utils.js +23 -21
- package/lib/esm/api/notifications.d.ts +64 -35
- package/lib/esm/api/notifications.js +168 -159
- package/lib/esm/components/c3-empty-state/c3-empty-state.d.ts +8 -2
- package/lib/esm/components/c3-empty-state/c3-empty-state.js +58 -17
- 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 +13 -5
- 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 +21 -8
- package/lib/esm/components/c3-navigation/c3-navigation-actions/c3-action-buttons.types.d.ts +5 -5
- 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 +157 -68
- 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 +58 -37
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar-element.d.ts +9 -9
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar-element.js +56 -33
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.d.ts +8 -8
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.js +114 -54
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-navigation-sidebar.types.d.ts +70 -60
- 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 +142 -88
- 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 +105 -51
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-sidebar-state-provider.d.ts +26 -24
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/c3-sidebar-state-provider.js +38 -25
- 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 +125 -43
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/components.d.ts +6 -1
- package/lib/esm/components/c3-navigation/c3-navigation-sidebar/components.js +4 -4
- package/lib/esm/components/c3-navigation/c3-navigation.d.ts +13 -2
- package/lib/esm/components/c3-navigation/c3-navigation.js +210 -88
- package/lib/esm/components/c3-navigation/c3-navigation.types.d.ts +69 -63
- 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 +30 -13
- package/lib/esm/components/c3-navigation/c3-notification-provider/c3-notification-container.js +114 -70
- package/lib/esm/components/c3-navigation/c3-notification-provider/c3-notification-provider.d.ts +29 -27
- package/lib/esm/components/c3-navigation/c3-notification-provider/c3-notification-provider.js +118 -90
- package/lib/esm/components/c3-navigation/helpers.d.ts +5 -3
- package/lib/esm/components/c3-navigation/helpers.js +53 -49
- package/lib/esm/components/c3-navigation/index.d.ts +4 -2
- package/lib/esm/components/c3-navigation/index.js +3 -3
- package/lib/esm/components/c3-navigation/story-helpers.d.ts +23 -18
- package/lib/esm/components/c3-navigation/story-helpers.js +189 -186
- package/lib/esm/components/c3-navigation/story-templates.d.ts +8 -8
- package/lib/esm/components/c3-navigation/story-templates.js +66 -33
- package/lib/esm/components/c3-user-configuration/c3-user-configuration-provider.d.ts +20 -16
- package/lib/esm/components/c3-user-configuration/c3-user-configuration-provider.js +9 -4
- package/lib/esm/icons/c3-icons.d.ts +7 -5
- package/lib/esm/icons/c3-icons.js +82 -14
- 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 +14 -9
- package/lib/esm/index.js +4 -4
- package/package.json +2 -1
|
@@ -1,161 +1,170 @@
|
|
|
1
|
-
import { EventSourcePolyfill } from "event-source-polyfill"
|
|
2
|
-
import { request } from "./api"
|
|
3
|
-
import { getEndpointByOptions, NOTIFICATIONS } from "./endpoints.const"
|
|
1
|
+
import { EventSourcePolyfill } from "event-source-polyfill"
|
|
2
|
+
import { request } from "./api"
|
|
3
|
+
import { getEndpointByOptions, NOTIFICATIONS } from "./endpoints.const"
|
|
4
4
|
export class NotificationService {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
-
|
|
5
|
+
static async getNotifications(options) {
|
|
6
|
+
let notifications = []
|
|
7
|
+
try {
|
|
8
|
+
notifications = await request({
|
|
9
|
+
method: "get",
|
|
10
|
+
base: "notifications",
|
|
11
|
+
stage: options.stage,
|
|
12
|
+
endpoints: options.endpoints,
|
|
13
|
+
camundaAuth: {
|
|
14
|
+
token: options.userToken,
|
|
15
|
+
refreshTokenMethod: options.getNewUserToken,
|
|
16
|
+
},
|
|
17
|
+
url: `notifications/orgs/${options.activeOrganizationId}`,
|
|
18
|
+
})
|
|
19
|
+
return notifications
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.error(error)
|
|
22
|
+
}
|
|
23
|
+
return notifications
|
|
24
|
+
}
|
|
25
|
+
static sendAnalyticsEvent(options, eventOptions) {
|
|
26
|
+
request({
|
|
27
|
+
method: "post",
|
|
28
|
+
base: "notifications",
|
|
29
|
+
stage: options.stage,
|
|
30
|
+
endpoints: options.endpoints,
|
|
31
|
+
camundaAuth: {
|
|
32
|
+
token: options.userToken,
|
|
33
|
+
refreshTokenMethod: options.getNewUserToken,
|
|
34
|
+
},
|
|
35
|
+
url: `analytics/${options.activeOrganizationId}/${eventOptions.event}`,
|
|
36
|
+
body: {
|
|
37
|
+
id: eventOptions.id,
|
|
38
|
+
},
|
|
39
|
+
responseType: "text",
|
|
40
|
+
})
|
|
41
|
+
.then(() => {
|
|
42
|
+
// do nothing
|
|
43
|
+
})
|
|
44
|
+
.catch((error) => {
|
|
45
|
+
console.error(error)
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
static changeState(options, notificationId, operation) {
|
|
49
|
+
request({
|
|
50
|
+
method: "patch",
|
|
51
|
+
base: "notifications",
|
|
52
|
+
stage: options.stage,
|
|
53
|
+
endpoints: options.endpoints,
|
|
54
|
+
camundaAuth: {
|
|
55
|
+
token: options.userToken,
|
|
56
|
+
refreshTokenMethod: options.getNewUserToken,
|
|
57
|
+
},
|
|
58
|
+
url: `notifications/${notificationId}/${operation}`,
|
|
59
|
+
})
|
|
60
|
+
.then(() => {
|
|
61
|
+
// do nothing
|
|
62
|
+
})
|
|
63
|
+
.catch((error) => {
|
|
64
|
+
console.error(error)
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
static changeManyStates(options, notificationIds, operation) {
|
|
68
|
+
if (notificationIds.length === 0) {
|
|
69
|
+
return
|
|
70
|
+
}
|
|
71
|
+
request({
|
|
72
|
+
method: "patch",
|
|
73
|
+
base: "notifications",
|
|
74
|
+
stage: options.stage,
|
|
75
|
+
endpoints: options.endpoints,
|
|
76
|
+
camundaAuth: {
|
|
77
|
+
token: options.userToken,
|
|
78
|
+
refreshTokenMethod: options.getNewUserToken,
|
|
79
|
+
},
|
|
80
|
+
url: `notifications/batch/state/${operation}`,
|
|
81
|
+
body: {
|
|
82
|
+
uuids: notificationIds,
|
|
83
|
+
},
|
|
84
|
+
})
|
|
85
|
+
.then(() => {
|
|
86
|
+
// do nothing
|
|
87
|
+
})
|
|
88
|
+
.catch((error) => {
|
|
89
|
+
console.error(error)
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
static notificationsStream(options, handler) {
|
|
93
|
+
const baseUrl = getEndpointByOptions({
|
|
94
|
+
...options,
|
|
95
|
+
endpoint: NOTIFICATIONS,
|
|
96
|
+
})
|
|
97
|
+
const source = new EventSourcePolyfill(`${baseUrl}/notifications/events`, {
|
|
98
|
+
headers: {
|
|
99
|
+
authorization: `Bearer ${options.userToken}`,
|
|
100
|
+
},
|
|
101
|
+
heartbeatTimeout: 1000 * 60 * 60,
|
|
102
|
+
})
|
|
103
|
+
source.onmessage = function (event) {
|
|
104
|
+
try {
|
|
105
|
+
const notification = JSON.parse(event.data)
|
|
106
|
+
if (!notification.keepAlive) {
|
|
107
|
+
handler(notification)
|
|
108
|
+
}
|
|
109
|
+
} catch (error) {
|
|
110
|
+
console.error(`Failed to handle SSE event`, { error })
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// updates <allNotifications> with <newNotification>
|
|
115
|
+
// if <newNotification> is read or new, it will be added to <allNotifications>
|
|
116
|
+
// if <newNotification> is dismissed, it will be removed from <allNotifications>
|
|
117
|
+
static updateNotifications(allNotifications, newNotification) {
|
|
118
|
+
const updatedNotifications = allNotifications
|
|
119
|
+
.slice()
|
|
120
|
+
.filter(
|
|
121
|
+
(currentNotification) =>
|
|
122
|
+
currentNotification.uuid !== newNotification.uuid,
|
|
123
|
+
)
|
|
124
|
+
if (newNotification.state === "read" || newNotification.state === "new") {
|
|
125
|
+
updatedNotifications.push(newNotification)
|
|
126
|
+
}
|
|
127
|
+
updatedNotifications.sort((a, b) => b.timestamp - a.timestamp)
|
|
128
|
+
return updatedNotifications
|
|
129
|
+
}
|
|
130
|
+
static updateNotificationState(allNotifications, notificationId, newState) {
|
|
131
|
+
let updatedNotifications = allNotifications.slice()
|
|
132
|
+
let foundNotification
|
|
133
|
+
switch (newState) {
|
|
134
|
+
case "dismiss":
|
|
135
|
+
updatedNotifications = updatedNotifications.filter(
|
|
136
|
+
(notification) => notification.uuid !== notificationId,
|
|
137
|
+
)
|
|
138
|
+
break
|
|
139
|
+
case "read":
|
|
140
|
+
foundNotification = updatedNotifications.find(
|
|
141
|
+
(currentNotification) => currentNotification.uuid === notificationId,
|
|
142
|
+
)
|
|
143
|
+
if (foundNotification) {
|
|
144
|
+
foundNotification.state = newState
|
|
145
|
+
}
|
|
146
|
+
break
|
|
147
|
+
}
|
|
148
|
+
return updatedNotifications
|
|
149
|
+
}
|
|
150
|
+
static updateNotificationStates(allNotifications, notificationIds, newState) {
|
|
151
|
+
let updatedNotifications = allNotifications.slice()
|
|
152
|
+
let foundNotifications = []
|
|
153
|
+
switch (newState) {
|
|
154
|
+
case "dismiss":
|
|
155
|
+
updatedNotifications = updatedNotifications.filter(
|
|
156
|
+
(notification) => !notificationIds.includes(notification.uuid),
|
|
157
|
+
)
|
|
158
|
+
break
|
|
159
|
+
case "read":
|
|
160
|
+
foundNotifications = updatedNotifications.filter((notification) =>
|
|
161
|
+
notificationIds.includes(notification.uuid),
|
|
162
|
+
)
|
|
163
|
+
foundNotifications.forEach((foundNotification) => {
|
|
164
|
+
foundNotification.state = newState
|
|
165
|
+
})
|
|
166
|
+
break
|
|
167
|
+
}
|
|
168
|
+
return updatedNotifications
|
|
169
|
+
}
|
|
161
170
|
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { C3EmptyStateProps } from "./c3-empty-state.types"
|
|
3
|
-
export declare const C3EmptyState: ({
|
|
2
|
+
import { C3EmptyStateProps } from "./c3-empty-state.types"
|
|
3
|
+
export declare const C3EmptyState: ({
|
|
4
|
+
icon,
|
|
5
|
+
heading,
|
|
6
|
+
description,
|
|
7
|
+
button,
|
|
8
|
+
link,
|
|
9
|
+
}: C3EmptyStateProps) => JSX.Element
|
|
@@ -1,17 +1,58 @@
|
|
|
1
|
-
import { Stack, Tile, Button, Link } from "@carbon/react"
|
|
2
|
-
import React from "react"
|
|
3
|
-
export const C3EmptyState = ({ icon, heading, description, button, link
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { Stack, Tile, Button, Link } from "@carbon/react"
|
|
2
|
+
import React from "react"
|
|
3
|
+
export const C3EmptyState = ({ icon, heading, description, button, link }) =>
|
|
4
|
+
React.createElement(
|
|
5
|
+
Tile,
|
|
6
|
+
{
|
|
7
|
+
style: {
|
|
8
|
+
paddingLeft: "5rem",
|
|
9
|
+
paddingTop: "3rem",
|
|
10
|
+
paddingBottom: "3rem",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
React.createElement(
|
|
14
|
+
Stack,
|
|
15
|
+
{ orientation: "horizontal", gap: 6 },
|
|
16
|
+
icon && React.createElement("img", { src: icon.path, alt: icon.altText }),
|
|
17
|
+
React.createElement(
|
|
18
|
+
Stack,
|
|
19
|
+
{ gap: 3 },
|
|
20
|
+
React.createElement("h2", null, heading),
|
|
21
|
+
React.createElement(
|
|
22
|
+
Stack,
|
|
23
|
+
{ gap: 6 },
|
|
24
|
+
React.createElement(
|
|
25
|
+
"p",
|
|
26
|
+
{ style: { maxWidth: "400px" } },
|
|
27
|
+
description,
|
|
28
|
+
),
|
|
29
|
+
React.createElement(
|
|
30
|
+
Stack,
|
|
31
|
+
{ gap: 5 },
|
|
32
|
+
button &&
|
|
33
|
+
React.createElement(
|
|
34
|
+
Button,
|
|
35
|
+
{
|
|
36
|
+
id: button.id,
|
|
37
|
+
size: "md",
|
|
38
|
+
onClick: button.onClick,
|
|
39
|
+
renderIcon: button.icon,
|
|
40
|
+
disabled: button.disabled,
|
|
41
|
+
},
|
|
42
|
+
button.label,
|
|
43
|
+
),
|
|
44
|
+
link &&
|
|
45
|
+
React.createElement(
|
|
46
|
+
"div",
|
|
47
|
+
null,
|
|
48
|
+
React.createElement(
|
|
49
|
+
Link,
|
|
50
|
+
{ target: "_blank", href: link.href, onClick: link.onClick },
|
|
51
|
+
link.label,
|
|
52
|
+
),
|
|
53
|
+
),
|
|
54
|
+
),
|
|
55
|
+
),
|
|
56
|
+
),
|
|
57
|
+
),
|
|
58
|
+
)
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { ReactElement } from "react"
|
|
1
|
+
import { ReactElement } from "react"
|
|
2
2
|
export interface C3EmptyStateProps {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
3
|
+
heading: string
|
|
4
|
+
description: string | ReactElement
|
|
5
|
+
icon?: {
|
|
6
|
+
path: string
|
|
7
|
+
altText: string
|
|
8
|
+
}
|
|
9
|
+
button?: {
|
|
10
|
+
onClick: () => void
|
|
11
|
+
disabled?: boolean
|
|
12
|
+
label: string
|
|
13
|
+
icon?: any
|
|
14
|
+
id?: string
|
|
15
|
+
}
|
|
16
|
+
link?: {
|
|
17
|
+
href: string
|
|
18
|
+
label: string
|
|
19
|
+
onClick?: () => void
|
|
20
|
+
}
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC } from "react"
|
|
1
|
+
import { FC } from "react"
|
|
2
2
|
export declare const InfoButton: FC<{
|
|
3
|
-
|
|
4
|
-
}
|
|
3
|
+
onClick: () => void
|
|
4
|
+
}>
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { HeaderGlobalAction } from "@carbon/react"
|
|
3
|
-
import { Help } from "@carbon/react/icons"
|
|
4
|
-
export const InfoButton = ({ onClick }) =>
|
|
5
|
-
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { HeaderGlobalAction } from "@carbon/react"
|
|
3
|
+
import { Help } from "@carbon/react/icons"
|
|
4
|
+
export const InfoButton = ({ onClick }) =>
|
|
5
|
+
React.createElement(
|
|
6
|
+
HeaderGlobalAction,
|
|
7
|
+
{
|
|
8
|
+
"aria-label": "Open Help Center",
|
|
9
|
+
tooltipAlignment: "center",
|
|
10
|
+
onClick: onClick,
|
|
11
|
+
},
|
|
12
|
+
React.createElement(Help, { size: 20 }),
|
|
13
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FC } from "react"
|
|
2
|
-
import { C3ActionButtonsProps } from "./c3-action-buttons.types"
|
|
1
|
+
import { FC } from "react"
|
|
2
|
+
import { C3ActionButtonsProps } from "./c3-action-buttons.types"
|
|
3
3
|
declare const C3ActionButtons: FC<{
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export default C3ActionButtons
|
|
4
|
+
elements: C3ActionButtonsProps
|
|
5
|
+
}>
|
|
6
|
+
export default C3ActionButtons
|
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { HeaderGlobalAction } from "@carbon/react"
|
|
3
|
-
const C3ActionButtons = ({ elements
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { HeaderGlobalAction } from "@carbon/react"
|
|
3
|
+
const C3ActionButtons = ({ elements }) => {
|
|
4
|
+
return React.createElement(
|
|
5
|
+
React.Fragment,
|
|
6
|
+
null,
|
|
7
|
+
elements.map((actionButton) => {
|
|
8
|
+
return React.createElement(
|
|
9
|
+
HeaderGlobalAction,
|
|
10
|
+
{
|
|
11
|
+
"aria-label": `Open ${actionButton.label}`,
|
|
12
|
+
onClick: actionButton.action,
|
|
13
|
+
isActive: false,
|
|
14
|
+
key: `${actionButton.label}-key`,
|
|
15
|
+
},
|
|
16
|
+
actionButton.icon,
|
|
17
|
+
)
|
|
18
|
+
}),
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
export default C3ActionButtons
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ReactElement } from "react"
|
|
1
|
+
import { ReactElement } from "react"
|
|
2
2
|
export declare type C3ActionButtonsProps = Array<{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
3
|
+
label: string
|
|
4
|
+
icon: ReactElement
|
|
5
|
+
action: () => void
|
|
6
|
+
}>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export {}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { C3NavigationProps } from "./c3-navigation.types"
|
|
3
|
-
export declare const C3NavigationAppBar: React.FC<C3NavigationProps
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { C3NavigationProps } from "./c3-navigation.types"
|
|
3
|
+
export declare const C3NavigationAppBar: React.FC<C3NavigationProps>
|