@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,39 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from "
|
|
14
|
-
import React from "react"
|
|
15
|
-
import C3InfoSidebar from "./c3-navigation-sidebar/c3-info-sidebar"
|
|
16
|
-
import { C3NotificationSidebar } from "./c3-navigation-sidebar/c3-notification-sidebar"
|
|
17
|
-
import C3OrgSidebar from "./c3-navigation-sidebar/c3-org-sidebar"
|
|
18
|
-
import C3UserSidebar from "./c3-navigation-sidebar/c3-user-sidebar"
|
|
19
|
-
import { useMediaQuery } from "./helpers"
|
|
20
|
-
import { C3NavigationAppBar } from "./c3-navigation-appbar"
|
|
21
|
-
import styled from "styled-components"
|
|
22
|
-
import C3ActionButtons from "./c3-navigation-actions/c3-action-buttons"
|
|
23
|
-
import { CamundaLogo } from "../../icons/c3-icons"
|
|
24
|
-
import { InfoButton } from "./c3-info-button"
|
|
25
|
-
import { C3SidebarStateProvider } from "./c3-navigation-sidebar/c3-sidebar-state-provider"
|
|
1
|
+
import { Header, HeaderContainer, HeaderGlobalBar, HeaderMenuItem, HeaderName as CarbonHeaderName, HeaderNavigation, SkipToContent, Tag, Toggletip, ToggletipButton, ToggletipContent, } from "@carbon/react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import C3InfoSidebar from "./c3-navigation-sidebar/c3-info-sidebar";
|
|
4
|
+
import { C3NotificationSidebar } from "./c3-navigation-sidebar/c3-notification-sidebar";
|
|
5
|
+
import C3OrgSidebar from "./c3-navigation-sidebar/c3-org-sidebar";
|
|
6
|
+
import C3UserSidebar from "./c3-navigation-sidebar/c3-user-sidebar";
|
|
7
|
+
import { useMediaQuery } from "./helpers";
|
|
8
|
+
import { C3NavigationAppBar } from "./c3-navigation-appbar";
|
|
9
|
+
import styled from "styled-components";
|
|
10
|
+
import C3ActionButtons from "./c3-navigation-actions/c3-action-buttons";
|
|
11
|
+
import { CamundaLogo } from "../../icons/c3-icons";
|
|
12
|
+
import { InfoButton } from "./c3-info-button";
|
|
13
|
+
import { C3SidebarStateProvider } from "./c3-navigation-sidebar/c3-sidebar-state-provider";
|
|
26
14
|
/**
|
|
27
15
|
* UI SHELL
|
|
28
16
|
* Docs: https://react.carbondesignsystem.com/?path=/story/components-ui-shell--fixed-side-nav
|
|
29
17
|
*/
|
|
30
|
-
const BREAKPOINT_LG_WIDTH = "66rem" // This is Carbon's breakpoint (lg) width https://github.com/carbon-design-system/carbon/blob/main/packages/layout/src/index.js#L56
|
|
31
|
-
const HeaderName = styled(CarbonHeaderName)`
|
|
18
|
+
const BREAKPOINT_LG_WIDTH = "66rem"; // This is Carbon's breakpoint (lg) width https://github.com/carbon-design-system/carbon/blob/main/packages/layout/src/index.js#L56
|
|
19
|
+
const HeaderName = styled(CarbonHeaderName) `
|
|
32
20
|
display: grid;
|
|
33
21
|
grid-auto-flow: column;
|
|
34
22
|
gap: 0.5rem;
|
|
35
|
-
|
|
36
|
-
const StyledToggletipContent = styled(ToggletipContent)`
|
|
23
|
+
`;
|
|
24
|
+
const StyledToggletipContent = styled(ToggletipContent) `
|
|
37
25
|
.cds--link:visited {
|
|
38
26
|
color: var(--cds-link-text-color);
|
|
39
27
|
}
|
|
@@ -41,188 +29,76 @@ const StyledToggletipContent = styled(ToggletipContent)`
|
|
|
41
29
|
.cds--link:visited:hover {
|
|
42
30
|
color: var(--cds-link-hover-text-color);
|
|
43
31
|
}
|
|
44
|
-
|
|
45
|
-
export const C3Navigation = ({
|
|
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
|
-
gap: ".5rem",
|
|
118
|
-
paddingRight: ".5rem",
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
navbar.tags &&
|
|
122
|
-
navbar.tags.length > 0 &&
|
|
123
|
-
navbar.tags.map((tag) => {
|
|
124
|
-
if (tag?.tooltip !== undefined) {
|
|
125
|
-
const { content, buttonLabel } = tag.tooltip
|
|
126
|
-
return React.createElement(
|
|
127
|
-
"div",
|
|
128
|
-
{
|
|
129
|
-
key: tag.key,
|
|
130
|
-
style: {
|
|
131
|
-
height: "1.5rem",
|
|
132
|
-
marginTop: "0.50rem",
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
React.createElement(
|
|
136
|
-
Toggletip,
|
|
137
|
-
null,
|
|
138
|
-
React.createElement(
|
|
139
|
-
ToggletipButton,
|
|
140
|
-
{ label: buttonLabel },
|
|
141
|
-
React.createElement(
|
|
142
|
-
Tag,
|
|
143
|
-
{
|
|
144
|
-
type: tag.color,
|
|
145
|
-
style: {
|
|
146
|
-
padding: "0 1rem",
|
|
147
|
-
marginRight: 0,
|
|
148
|
-
marginLeft: 0,
|
|
149
|
-
cursor: "pointer",
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
tag.label,
|
|
153
|
-
),
|
|
154
|
-
),
|
|
155
|
-
React.createElement(
|
|
156
|
-
StyledToggletipContent,
|
|
157
|
-
null,
|
|
158
|
-
content,
|
|
159
|
-
),
|
|
160
|
-
),
|
|
161
|
-
)
|
|
162
|
-
}
|
|
163
|
-
return React.createElement(
|
|
164
|
-
Tag,
|
|
165
|
-
{
|
|
166
|
-
key: tag.key,
|
|
167
|
-
style: {
|
|
168
|
-
height: "1.5rem",
|
|
169
|
-
marginTop: "0.75rem",
|
|
170
|
-
padding: "0 1rem",
|
|
171
|
-
},
|
|
172
|
-
type: tag.color,
|
|
173
|
-
},
|
|
174
|
-
tag.label,
|
|
175
|
-
)
|
|
176
|
-
}),
|
|
177
|
-
navbar.orgName &&
|
|
178
|
-
React.createElement(
|
|
179
|
-
"div",
|
|
180
|
-
{
|
|
181
|
-
className: "bodyText",
|
|
182
|
-
style: {
|
|
183
|
-
fontSize: "14px",
|
|
184
|
-
lineHeight: "3rem",
|
|
185
|
-
textOverflow: "ellipsis",
|
|
186
|
-
whiteSpace: "nowrap",
|
|
187
|
-
overflow: "hidden",
|
|
188
|
-
maxWidth: "150px",
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
navbar.orgName,
|
|
192
|
-
),
|
|
193
|
-
),
|
|
194
|
-
actionButtons &&
|
|
195
|
-
React.createElement(C3ActionButtons, { elements: actionButtons }),
|
|
196
|
-
notificationSideBar &&
|
|
197
|
-
React.createElement(C3NotificationSidebar, {
|
|
198
|
-
sideBar: {
|
|
199
|
-
...notificationSideBar,
|
|
200
|
-
type: "notifications",
|
|
201
|
-
},
|
|
202
|
-
}),
|
|
203
|
-
orgSideBar &&
|
|
204
|
-
React.createElement(C3OrgSidebar, {
|
|
205
|
-
sideBar: {
|
|
206
|
-
...orgSideBar,
|
|
207
|
-
type: "org",
|
|
208
|
-
},
|
|
209
|
-
}),
|
|
210
|
-
infoButton
|
|
211
|
-
? React.createElement(InfoButton, { onClick: infoButton.onClick })
|
|
212
|
-
: infoSideBar &&
|
|
213
|
-
React.createElement(C3InfoSidebar, {
|
|
214
|
-
sideBar: { ...infoSideBar, type: "info" },
|
|
215
|
-
}),
|
|
216
|
-
userSideBar &&
|
|
217
|
-
React.createElement(C3UserSidebar, {
|
|
218
|
-
sideBar: {
|
|
219
|
-
...userSideBar,
|
|
220
|
-
type: "user",
|
|
221
|
-
},
|
|
222
|
-
}),
|
|
223
|
-
),
|
|
224
|
-
)
|
|
225
|
-
},
|
|
226
|
-
}),
|
|
227
|
-
)
|
|
228
|
-
}
|
|
32
|
+
`;
|
|
33
|
+
export const C3Navigation = ({ app, appBar, forwardRef, navbar, orgSideBar, infoSideBar, infoButton, actionButtons, userSideBar, notificationSideBar, }) => {
|
|
34
|
+
const isLargeScreen = useMediaQuery(`(min-width: ${BREAKPOINT_LG_WIDTH}`);
|
|
35
|
+
const appBarElementsLength = appBar.elements?.length ?? 0;
|
|
36
|
+
const displayAppBar = appBarElementsLength > 0 || (!isLargeScreen && navbar.elements.length > 0);
|
|
37
|
+
if (app.prefix)
|
|
38
|
+
console.warn("The `prefix` prop is deprecated and will be removed in a future release. It has been replaced with a Camunda icon.");
|
|
39
|
+
return (React.createElement(C3SidebarStateProvider, { isNotificationSidebarOpen: notificationSideBar?.isOpen, isOrgSidebarOpen: orgSideBar?.isOpen, isInfoSidebarOpen: infoSideBar?.isOpen, isUserSidebarOpen: userSideBar?.isOpen },
|
|
40
|
+
React.createElement(HeaderContainer, { render: () => {
|
|
41
|
+
return (React.createElement(Header, { "aria-label": app.ariaLabel },
|
|
42
|
+
React.createElement(SkipToContent, null),
|
|
43
|
+
displayAppBar && (React.createElement(C3NavigationAppBar, { app: app, appBar: appBar, forwardRef: forwardRef, navbar: navbar })),
|
|
44
|
+
React.createElement(HeaderName, { element: forwardRef, prefix: "", ...app.routeProps },
|
|
45
|
+
React.createElement(CamundaLogo, { "aria-label": "Camunda" }),
|
|
46
|
+
React.createElement("span", null, app.name)),
|
|
47
|
+
React.createElement(HeaderNavigation, { "aria-label": app.ariaLabel }, navbar.elements.map((element) => (React.createElement(HeaderMenuItem, { key: element.key, element: element.routeProps && forwardRef, isActive: element.isCurrentPage, ...element.routeProps },
|
|
48
|
+
React.createElement("span", null, element.label))))),
|
|
49
|
+
React.createElement(HeaderGlobalBar, null,
|
|
50
|
+
React.createElement("div", { style: {
|
|
51
|
+
display: "grid",
|
|
52
|
+
gridAutoFlow: "column",
|
|
53
|
+
gap: ".5rem",
|
|
54
|
+
paddingRight: ".5rem",
|
|
55
|
+
} },
|
|
56
|
+
navbar.tags &&
|
|
57
|
+
navbar.tags.length > 0 &&
|
|
58
|
+
navbar.tags.map((tag) => {
|
|
59
|
+
if (tag?.tooltip !== undefined) {
|
|
60
|
+
const { content, buttonLabel } = tag.tooltip;
|
|
61
|
+
return (React.createElement("div", { key: tag.key, style: {
|
|
62
|
+
height: "1.5rem",
|
|
63
|
+
marginTop: "0.50rem",
|
|
64
|
+
} },
|
|
65
|
+
React.createElement(Toggletip, null,
|
|
66
|
+
React.createElement(ToggletipButton, { label: buttonLabel },
|
|
67
|
+
React.createElement(Tag, { type: tag.color, style: {
|
|
68
|
+
padding: "0 1rem",
|
|
69
|
+
marginRight: 0,
|
|
70
|
+
marginLeft: 0,
|
|
71
|
+
cursor: "pointer",
|
|
72
|
+
} }, tag.label)),
|
|
73
|
+
React.createElement(StyledToggletipContent, null, content))));
|
|
74
|
+
}
|
|
75
|
+
return (React.createElement(Tag, { key: tag.key, style: {
|
|
76
|
+
height: "1.5rem",
|
|
77
|
+
marginTop: "0.75rem",
|
|
78
|
+
padding: "0 1rem",
|
|
79
|
+
}, type: tag.color }, tag.label));
|
|
80
|
+
}),
|
|
81
|
+
navbar.orgName && (React.createElement("div", { className: "bodyText", style: {
|
|
82
|
+
fontSize: "14px",
|
|
83
|
+
lineHeight: "3rem",
|
|
84
|
+
textOverflow: "ellipsis",
|
|
85
|
+
whiteSpace: "nowrap",
|
|
86
|
+
overflow: "hidden",
|
|
87
|
+
maxWidth: "150px",
|
|
88
|
+
} }, navbar.orgName))),
|
|
89
|
+
actionButtons && React.createElement(C3ActionButtons, { elements: actionButtons }),
|
|
90
|
+
notificationSideBar && (React.createElement(C3NotificationSidebar, { sideBar: {
|
|
91
|
+
...notificationSideBar,
|
|
92
|
+
type: "notifications",
|
|
93
|
+
} })),
|
|
94
|
+
orgSideBar && (React.createElement(C3OrgSidebar, { sideBar: {
|
|
95
|
+
...orgSideBar,
|
|
96
|
+
type: "org",
|
|
97
|
+
} })),
|
|
98
|
+
infoButton ? (React.createElement(InfoButton, { onClick: infoButton.onClick })) : (infoSideBar && (React.createElement(C3InfoSidebar, { sideBar: { ...infoSideBar, type: "info" } }))),
|
|
99
|
+
userSideBar && (React.createElement(C3UserSidebar, { sideBar: {
|
|
100
|
+
...userSideBar,
|
|
101
|
+
type: "user",
|
|
102
|
+
} })))));
|
|
103
|
+
} })));
|
|
104
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { expect, test } from "@playwright/test";
|
|
2
|
+
import { getStory } from "../test-utils";
|
|
3
|
+
test.describe("Navigation", () => {
|
|
4
|
+
test("Basic", async ({ page }) => {
|
|
5
|
+
await getStory(page, "uishell-c3navigation--basic");
|
|
6
|
+
await expect(page).toHaveScreenshot();
|
|
7
|
+
});
|
|
8
|
+
test("App bar open", async ({ page }) => {
|
|
9
|
+
await getStory(page, "uishell-c3navigation--app-bar-opened");
|
|
10
|
+
await expect(page).toHaveScreenshot();
|
|
11
|
+
});
|
|
12
|
+
test("Org bar open", async ({ page }) => {
|
|
13
|
+
await getStory(page, "uishell-c3navigation--org-side-bar-opened");
|
|
14
|
+
await expect(page).toHaveScreenshot();
|
|
15
|
+
});
|
|
16
|
+
test("Info bar open", async ({ page }) => {
|
|
17
|
+
await getStory(page, "uishell-c3navigation--info-side-bar-opened");
|
|
18
|
+
await expect(page).toHaveScreenshot();
|
|
19
|
+
});
|
|
20
|
+
test("Info bar open - with divider", async ({ page }) => {
|
|
21
|
+
await getStory(page, "uishell-c3navigation--info-side-bar-opened-with-divider");
|
|
22
|
+
await expect(page).toHaveScreenshot();
|
|
23
|
+
});
|
|
24
|
+
test("Info button", async ({ page }) => {
|
|
25
|
+
await getStory(page, "uishell-c3navigation--info-button");
|
|
26
|
+
await expect(page).toHaveScreenshot();
|
|
27
|
+
});
|
|
28
|
+
test("User bar open", async ({ page }) => {
|
|
29
|
+
await getStory(page, "uishell-c3navigation--user-side-bar-opened");
|
|
30
|
+
await expect(page).toHaveScreenshot();
|
|
31
|
+
});
|
|
32
|
+
test("User bar open - with custom section", async ({ page }) => {
|
|
33
|
+
await getStory(page, "uishell-c3navigation--user-side-bar-opened-with-custom-section");
|
|
34
|
+
await expect(page).toHaveScreenshot();
|
|
35
|
+
});
|
|
36
|
+
test("User bar open - with custom section and state", async ({ page }) => {
|
|
37
|
+
await getStory(page, "uishell-c3navigation--user-side-bar-with-custom-section-and-state");
|
|
38
|
+
await expect(page).toHaveScreenshot();
|
|
39
|
+
});
|
|
40
|
+
test("App bar - without elements", async ({ page }) => {
|
|
41
|
+
await getStory(page, "uishell-c3navigation--app-bar-without-elements");
|
|
42
|
+
await expect(page).toHaveScreenshot();
|
|
43
|
+
});
|
|
44
|
+
test("App bar - without elements and nav elements", async ({ page }) => {
|
|
45
|
+
await getStory(page, "uishell-c3navigation--app-bar-without-elements-and-nav-elements");
|
|
46
|
+
await expect(page).toHaveScreenshot();
|
|
47
|
+
});
|
|
48
|
+
test("Notifications bar open", async ({ page }) => {
|
|
49
|
+
// Fake current time for consistent screenshots
|
|
50
|
+
const fakeNow = new Date("January 5 2023 13:37:11").valueOf();
|
|
51
|
+
await page.addInitScript(`{
|
|
52
|
+
Date = class extends Date {
|
|
53
|
+
constructor(...args) {
|
|
54
|
+
if (args.length === 0) {
|
|
55
|
+
super(${fakeNow});
|
|
56
|
+
} else {
|
|
57
|
+
super(...args);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const __DateNowOffset = ${fakeNow} - Date.now();
|
|
62
|
+
const __DateNow = Date.now;
|
|
63
|
+
Date.now = () => __DateNow() + __DateNowOffset;
|
|
64
|
+
}`);
|
|
65
|
+
await getStory(page, "uishell-c3navigation--notifications-side-bar-opened");
|
|
66
|
+
await expect(page).toHaveScreenshot();
|
|
67
|
+
});
|
|
68
|
+
test("Notifications bar open - no notifications", async ({ page }) => {
|
|
69
|
+
await getStory(page, "uishell-c3navigation--notifications-side-bar-opened-no-notifications");
|
|
70
|
+
await expect(page).toHaveScreenshot();
|
|
71
|
+
});
|
|
72
|
+
test("Action button", async ({ page }) => {
|
|
73
|
+
await getStory(page, "uishell-c3navigation--acion-button-instead-of-info-bar");
|
|
74
|
+
await expect(page).toHaveScreenshot();
|
|
75
|
+
});
|
|
76
|
+
test("Action button with custom element", async ({ page }) => {
|
|
77
|
+
await getStory(page, "uishell-c3navigation--acion-button-with-custom-element");
|
|
78
|
+
await expect(page).toHaveScreenshot();
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -1,81 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
C3NavigationAppBarProps,
|
|
6
|
-
C3NavigationInfoSideBarProps,
|
|
7
|
-
C3NavigationNotificationsSideBarProps,
|
|
8
|
-
C3NavigationOrgSideBarProps,
|
|
9
|
-
C3NavigationUserSideBarProps,
|
|
10
|
-
} from "./c3-navigation-sidebar/c3-navigation-sidebar.types"
|
|
11
|
-
import { C3ActionButtonsProps } from "./c3-navigation-actions/c3-action-buttons.types"
|
|
1
|
+
import { Tag } from "@carbon/react";
|
|
2
|
+
import { Endpoints, Stage } from "../../api/endpoints.const";
|
|
3
|
+
import { C3NavigationAppBarProps, C3NavigationInfoSideBarProps, C3NavigationNotificationsSideBarProps, C3NavigationOrgSideBarProps, C3NavigationUserSideBarProps } from "./c3-navigation-sidebar/c3-navigation-sidebar.types";
|
|
4
|
+
import { C3ActionButtonsProps } from "./c3-navigation-actions/c3-action-buttons.types";
|
|
12
5
|
export interface C3NavigationAppProps {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
prefix?: string;
|
|
7
|
+
name: string;
|
|
8
|
+
ariaLabel: string;
|
|
9
|
+
routeProps: any;
|
|
17
10
|
}
|
|
18
11
|
export interface C3NavigationElementProps {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
12
|
+
ariaLabel?: string;
|
|
13
|
+
key: string;
|
|
14
|
+
label: string;
|
|
15
|
+
kind?: "ghost" | "danger--ghost";
|
|
16
|
+
active?: boolean;
|
|
17
|
+
renderIcon?: any;
|
|
18
|
+
routeProps?: any;
|
|
19
|
+
href?: string;
|
|
20
|
+
target?: "_blank" | "_self" | "_parent" | "_top";
|
|
21
|
+
onClick?: () => void;
|
|
22
|
+
subElements?: C3NavigationElementProps[];
|
|
23
|
+
preceedingDivider?: boolean;
|
|
31
24
|
}
|
|
32
25
|
export interface C3NavigationNavBarProps {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
26
|
+
elements: Array<{
|
|
27
|
+
label: string;
|
|
28
|
+
key: string;
|
|
29
|
+
routeProps: any;
|
|
30
|
+
isCurrentPage: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
tags?: Array<{
|
|
33
|
+
label: string;
|
|
34
|
+
key: string;
|
|
35
|
+
color?: React.ComponentProps<typeof Tag>["type"];
|
|
36
|
+
tooltip?: {
|
|
37
|
+
content: React.ReactNode;
|
|
38
|
+
buttonLabel: string;
|
|
39
|
+
};
|
|
40
|
+
}>;
|
|
41
|
+
orgName?: string;
|
|
49
42
|
}
|
|
50
43
|
export interface C3NotificationsProps {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
44
|
+
stage?: Stage;
|
|
45
|
+
endpoints?: Endpoints;
|
|
46
|
+
activeOrganizationId: string;
|
|
47
|
+
userToken: string;
|
|
48
|
+
getNewUserToken: () => Promise<string>;
|
|
56
49
|
}
|
|
57
|
-
declare type WithoutType<P> = Omit<P, "type"
|
|
50
|
+
declare type WithoutType<P> = Omit<P, "type">;
|
|
58
51
|
export interface C3NavigationProps {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
52
|
+
app: C3NavigationAppProps;
|
|
53
|
+
appBar: WithoutType<C3NavigationAppBarProps>;
|
|
54
|
+
orgSideBar?: WithoutType<C3NavigationOrgSideBarProps>;
|
|
55
|
+
infoSideBar?: WithoutType<C3NavigationInfoSideBarProps>;
|
|
56
|
+
infoButton?: {
|
|
57
|
+
onClick: () => void;
|
|
58
|
+
};
|
|
59
|
+
actionButtons?: C3ActionButtonsProps;
|
|
60
|
+
userSideBar?: WithoutType<C3NavigationUserSideBarProps>;
|
|
61
|
+
notificationSideBar?: WithoutType<C3NavigationNotificationsSideBarProps>;
|
|
62
|
+
navbar: C3NavigationNavBarProps;
|
|
63
|
+
forwardRef?: React.ForwardRefExoticComponent<any>;
|
|
71
64
|
}
|
|
72
65
|
export declare type LinkProps = {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
export {}
|
|
66
|
+
element?: React.ElementType;
|
|
67
|
+
isSideNavExpanded?: boolean;
|
|
68
|
+
children: React.ReactNode;
|
|
69
|
+
className?: string;
|
|
70
|
+
isActive?: boolean;
|
|
71
|
+
large?: boolean;
|
|
72
|
+
renderIcon?: (() => React.ReactNode) | object;
|
|
73
|
+
};
|
|
74
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export {};
|
package/lib/esm/components/c3-navigation/c3-notification-provider/c3-notification-container.d.ts
CHANGED
|
@@ -1,30 +1,13 @@
|
|
|
1
|
-
import { FC } from "react"
|
|
2
|
-
import { Notification as NotificationProps } from "../../../api/notifications"
|
|
3
|
-
export declare const NotificationTitle: import("styled-components").StyledComponent<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
>
|
|
15
|
-
export declare const LinkContainer: import("styled-components").StyledComponent<
|
|
16
|
-
"div",
|
|
17
|
-
any,
|
|
18
|
-
{},
|
|
19
|
-
never
|
|
20
|
-
>
|
|
21
|
-
declare const C3NotificationContainer: FC<
|
|
22
|
-
NotificationProps & {
|
|
23
|
-
onRead: () => void
|
|
24
|
-
onDismiss: () => void
|
|
25
|
-
onLinkClick?: (meta: NotificationProps["meta"]) => void
|
|
26
|
-
originalOnLinkClick?: (meta: NotificationProps["meta"]) => void
|
|
27
|
-
unread?: boolean
|
|
28
|
-
}
|
|
29
|
-
>
|
|
30
|
-
export default C3NotificationContainer
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { Notification as NotificationProps } from "../../../api/notifications";
|
|
3
|
+
export declare const NotificationTitle: import("styled-components").StyledComponent<"p", any, {}, never>;
|
|
4
|
+
export declare const NotificationDescription: import("styled-components").StyledComponent<"p", any, {}, never>;
|
|
5
|
+
export declare const LinkContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
|
+
declare const C3NotificationContainer: FC<NotificationProps & {
|
|
7
|
+
onRead: () => void;
|
|
8
|
+
onDismiss: () => void;
|
|
9
|
+
onLinkClick?: (meta: NotificationProps["meta"]) => void;
|
|
10
|
+
originalOnLinkClick?: (meta: NotificationProps["meta"]) => void;
|
|
11
|
+
unread?: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
export default C3NotificationContainer;
|