@capillarytech/blaze-ui 6.1.4 → 6.1.6-beta.1
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/CapDragReorder/Card.d.ts +2 -2
- package/CapDragReorder/Card.d.ts.map +1 -1
- package/CapDragReorder/Card.js +53 -51
- package/CapDragReorder/index.d.ts +2 -9
- package/CapDragReorder/index.d.ts.map +1 -1
- package/CapDragReorder/index.js +26 -15
- package/CapDragReorder/styles.css +12 -2
- package/CapDragReorder/styles.d.ts +2 -12
- package/CapDragReorder/styles.d.ts.map +1 -1
- package/CapDragReorder/styles.js +1 -1
- package/CapDragReorder/styles.module.scss.js +29 -0
- package/CapDragReorder/styles.scss +23 -10
- package/CapDragReorder/tests/CapDragReorder.mockData.d.ts +4 -0
- package/CapDragReorder/tests/CapDragReorder.mockData.d.ts.map +1 -0
- package/CapDragReorder/types.d.ts +32 -0
- package/CapDragReorder/types.d.ts.map +1 -0
- package/CapDragReorder/types.js +1 -0
- package/CapNavigationSPA/CapNavigationSPASidebar/index.d.ts +10 -0
- package/CapNavigationSPA/CapNavigationSPASidebar/index.d.ts.map +1 -0
- package/CapNavigationSPA/CapNavigationSPASidebar/index.js +373 -0
- package/CapNavigationSPA/CapNavigationSPASidebar/styles.css +318 -0
- package/CapNavigationSPA/CapNavigationSPASidebar/styles.module.scss.js +56 -0
- package/CapNavigationSPA/CapNavigationSPASidebar/styles.scss +385 -0
- package/CapNavigationSPA/CapNavigationSPASidebar/types.d.ts +31 -0
- package/CapNavigationSPA/CapNavigationSPASidebar/types.d.ts.map +1 -0
- package/CapNavigationSPA/CapNavigationSPASidebar/types.js +1 -0
- package/CapNavigationSPA/CapNavigationSPATopBar/index.d.ts +10 -0
- package/CapNavigationSPA/CapNavigationSPATopBar/index.d.ts.map +1 -0
- package/CapNavigationSPA/CapNavigationSPATopBar/index.js +119 -0
- package/CapNavigationSPA/CapNavigationSPATopBar/styles.css +141 -0
- package/CapNavigationSPA/CapNavigationSPATopBar/styles.module.scss.js +19 -0
- package/CapNavigationSPA/CapNavigationSPATopBar/styles.scss +163 -0
- package/CapNavigationSPA/CapNavigationSPATopBar/types.d.ts +28 -0
- package/CapNavigationSPA/CapNavigationSPATopBar/types.d.ts.map +1 -0
- package/CapNavigationSPA/CapNavigationSPATopBar/types.js +1 -0
- package/CapNavigationSPA/constants.d.ts +2 -0
- package/CapNavigationSPA/constants.d.ts.map +1 -0
- package/CapNavigationSPA/constants.js +4 -0
- package/CapNavigationSPA/index.d.ts +10 -0
- package/CapNavigationSPA/index.d.ts.map +1 -0
- package/CapNavigationSPA/index.js +436 -0
- package/CapNavigationSPA/messages.d.ts +13 -0
- package/CapNavigationSPA/messages.d.ts.map +1 -0
- package/CapNavigationSPA/messages.js +16 -0
- package/CapNavigationSPA/mockdata.d.ts +6 -0
- package/CapNavigationSPA/mockdata.d.ts.map +1 -0
- package/CapNavigationSPA/mockdata.js +4 -0
- package/CapNavigationSPA/styles.css +59 -0
- package/CapNavigationSPA/styles.module.scss.js +10 -0
- package/CapNavigationSPA/styles.scss +60 -0
- package/CapNavigationSPA/tests/CapNavigationSPA.mockData.d.ts +31 -0
- package/CapNavigationSPA/tests/CapNavigationSPA.mockData.d.ts.map +1 -0
- package/CapNavigationSPA/types.d.ts +39 -0
- package/CapNavigationSPA/types.d.ts.map +1 -0
- package/CapNavigationSPA/types.js +1 -0
- package/CapSelectFilter/index.js +2 -2
- package/CapTreeView/index.d.ts +6 -28
- package/CapTreeView/index.d.ts.map +1 -1
- package/CapTreeView/index.js +63 -78
- package/CapTreeView/styles.css +12 -22
- package/CapTreeView/styles.module.scss.js +16 -0
- package/CapTreeView/styles.scss +26 -39
- package/CapTreeView/tests/CapTreeView.mockData.d.ts +5 -0
- package/CapTreeView/tests/CapTreeView.mockData.d.ts.map +1 -0
- package/CapTreeView/types.d.ts +16 -0
- package/CapTreeView/types.d.ts.map +1 -0
- package/CapTreeView/types.js +1 -0
- package/assets/svgIcons/Icons/AiraNav.js +23 -0
- package/assets/svgIcons/Icons/CreativesNav.js +22 -0
- package/assets/svgIcons/Icons/DataManagement.js +22 -0
- package/assets/svgIcons/Icons/EngageNav.js +23 -0
- package/assets/svgIcons/Icons/InsightsNav.js +22 -0
- package/assets/svgIcons/Icons/LoyaltyTag.js +22 -0
- package/assets/svgIcons/Icons/Members.js +22 -0
- package/assets/svgIcons/Icons/RewardsOutline.js +4 -6
- package/assets/svgIcons/Icons/SidebarCollapse.js +17 -0
- package/assets/svgIcons/Icons/SidebarExpand.js +22 -0
- package/assets/svgIcons/Icons/ThreeStars.js +36 -18
- package/assets/svgIcons/component.js +27 -0
- package/assets/svgIcons/index.js +612 -594
- package/index.d.ts +6 -0
- package/index.d.ts.map +1 -1
- package/index.js +195 -189
- package/package.json +1 -1
- package/utils/getCapThemeConfig.d.ts.map +1 -1
- package/utils/getCapThemeConfig.js +11 -2
- package/.npmrc +0 -3
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { useRef, useState, useCallback } from "react";
|
|
4
|
+
import CapIcon from "../../CapIcon/index.js";
|
|
5
|
+
import styles from "./styles.module.scss.js";
|
|
6
|
+
const SIDEBAR_DIVIDER_BEFORE_KEY = "data-management";
|
|
7
|
+
const DEFAULT_ICON_MAP = {
|
|
8
|
+
loyalty: "loyalty-tag",
|
|
9
|
+
// Figma 583:6938 – heart inside tag
|
|
10
|
+
engage: "engage-nav",
|
|
11
|
+
// Figma 646-59790 – megaphone with settings
|
|
12
|
+
rewards: "rewards-outline",
|
|
13
|
+
insights: "insights-nav",
|
|
14
|
+
// Figma 646-59984 – bar chart in frame
|
|
15
|
+
aira: "aira-nav",
|
|
16
|
+
// Figma 646-59790 – three sparkles, stroke icon
|
|
17
|
+
members: "members",
|
|
18
|
+
audiences: "groups",
|
|
19
|
+
creatives: "creatives-nav",
|
|
20
|
+
// Figma 646-59984 – document with pen
|
|
21
|
+
"data-management": "data-management",
|
|
22
|
+
extensions: "code",
|
|
23
|
+
settings: "settings"
|
|
24
|
+
};
|
|
25
|
+
const CapNavigationSPASidebar = ({
|
|
26
|
+
items,
|
|
27
|
+
selectedKey = "",
|
|
28
|
+
onItemClick,
|
|
29
|
+
settingsLabel = "Settings",
|
|
30
|
+
logo,
|
|
31
|
+
className,
|
|
32
|
+
collapsed = false,
|
|
33
|
+
onCollapseExpand,
|
|
34
|
+
navigateToLink = true
|
|
35
|
+
}) => {
|
|
36
|
+
const wrapperRef = useRef(null);
|
|
37
|
+
const [hoverExpandedKey, setHoverExpandedKey] = useState(null);
|
|
38
|
+
const [clickExpandedKey, setClickExpandedKey] = useState(null);
|
|
39
|
+
const [hoverL1TooltipKey, setHoverL1TooltipKey] = useState(null);
|
|
40
|
+
const expandedParentKey = clickExpandedKey ?? hoverExpandedKey;
|
|
41
|
+
const closeFlyout = useCallback(() => {
|
|
42
|
+
setHoverExpandedKey(null);
|
|
43
|
+
setClickExpandedKey(null);
|
|
44
|
+
setHoverL1TooltipKey(null);
|
|
45
|
+
}, []);
|
|
46
|
+
const handleClick = useCallback(
|
|
47
|
+
(item) => {
|
|
48
|
+
if (navigateToLink && item.link && item.link !== window.location.pathname) {
|
|
49
|
+
window.location.pathname = item.link;
|
|
50
|
+
}
|
|
51
|
+
onItemClick == null ? void 0 : onItemClick(item);
|
|
52
|
+
},
|
|
53
|
+
[navigateToLink, onItemClick]
|
|
54
|
+
);
|
|
55
|
+
const toggleParentExpanded = useCallback(
|
|
56
|
+
(parentKey) => {
|
|
57
|
+
if (expandedParentKey === parentKey) {
|
|
58
|
+
closeFlyout();
|
|
59
|
+
} else {
|
|
60
|
+
setHoverExpandedKey(null);
|
|
61
|
+
setClickExpandedKey(parentKey);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
[expandedParentKey, closeFlyout]
|
|
65
|
+
);
|
|
66
|
+
const handleItemClick = useCallback(
|
|
67
|
+
(item) => {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
if (collapsed) {
|
|
70
|
+
if (onCollapseExpand) {
|
|
71
|
+
onCollapseExpand();
|
|
72
|
+
}
|
|
73
|
+
if ((_a = item.children) == null ? void 0 : _a.length) {
|
|
74
|
+
setHoverExpandedKey(null);
|
|
75
|
+
setClickExpandedKey(item.key);
|
|
76
|
+
} else {
|
|
77
|
+
closeFlyout();
|
|
78
|
+
handleClick(item);
|
|
79
|
+
}
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if ((_b = item.children) == null ? void 0 : _b.length) {
|
|
83
|
+
toggleParentExpanded(item.key);
|
|
84
|
+
} else {
|
|
85
|
+
closeFlyout();
|
|
86
|
+
handleClick(item);
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
[collapsed, onCollapseExpand, toggleParentExpanded, closeFlyout, handleClick]
|
|
90
|
+
);
|
|
91
|
+
const getIconType = (item) => item.iconType ?? DEFAULT_ICON_MAP[item.key] ?? void 0;
|
|
92
|
+
const handleWrapperMouseLeave = useCallback(() => {
|
|
93
|
+
setHoverExpandedKey(null);
|
|
94
|
+
setHoverL1TooltipKey(null);
|
|
95
|
+
}, []);
|
|
96
|
+
return /* @__PURE__ */ jsx(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
ref: wrapperRef,
|
|
100
|
+
className: styles["cap-navigation-spa-sidebar__wrapper"],
|
|
101
|
+
onMouseLeave: handleWrapperMouseLeave,
|
|
102
|
+
children: /* @__PURE__ */ jsxs(
|
|
103
|
+
"aside",
|
|
104
|
+
{
|
|
105
|
+
className: classNames(
|
|
106
|
+
styles["cap-navigation-spa-sidebar"],
|
|
107
|
+
collapsed && styles["cap-navigation-spa-sidebar--collapsed"],
|
|
108
|
+
className
|
|
109
|
+
),
|
|
110
|
+
"data-testid": "cap-navigation-spa-sidebar",
|
|
111
|
+
children: [
|
|
112
|
+
/* @__PURE__ */ jsx("div", { className: styles["cap-navigation-spa-sidebar__logo"], children: logo !== void 0 ? logo : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
113
|
+
/* @__PURE__ */ jsx(
|
|
114
|
+
CapIcon,
|
|
115
|
+
{
|
|
116
|
+
type: "capillary",
|
|
117
|
+
size: "s",
|
|
118
|
+
className: styles["cap-navigation-spa-sidebar__logo-icon"]
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
!collapsed && /* @__PURE__ */ jsx("span", { className: styles["cap-navigation-spa-sidebar__logo-text"], children: "capillary" })
|
|
122
|
+
] }) }),
|
|
123
|
+
/* @__PURE__ */ jsx("nav", { className: styles["cap-navigation-spa-sidebar__nav"], children: items.flatMap((item) => {
|
|
124
|
+
var _a, _b, _c, _d;
|
|
125
|
+
const isExpandedWithChildren = !collapsed && ((_a = item.children) == null ? void 0 : _a.length) && expandedParentKey === item.key;
|
|
126
|
+
const parentButton = /* @__PURE__ */ jsxs(
|
|
127
|
+
"button",
|
|
128
|
+
{
|
|
129
|
+
type: "button",
|
|
130
|
+
className: classNames(
|
|
131
|
+
styles["cap-navigation-spa-sidebar__item"],
|
|
132
|
+
expandedParentKey === item.key && styles["cap-navigation-spa-sidebar__item--expanded"],
|
|
133
|
+
expandedParentKey === item.key && item.key === "loyalty" && styles["cap-navigation-spa-sidebar__item--expanded-loyalty"],
|
|
134
|
+
expandedParentKey === item.key && item.key === "engage" && styles["cap-navigation-spa-sidebar__item--expanded-engage"],
|
|
135
|
+
expandedParentKey === item.key && item.key === "insights" && styles["cap-navigation-spa-sidebar__item--expanded-insights"],
|
|
136
|
+
expandedParentKey === item.key && item.key === "members" && styles["cap-navigation-spa-sidebar__item--expanded-members"],
|
|
137
|
+
expandedParentKey === item.key && item.key === "rewards" && styles["cap-navigation-spa-sidebar__item--expanded-rewards"],
|
|
138
|
+
expandedParentKey === item.key && item.key === "audiences" && styles["cap-navigation-spa-sidebar__item--expanded-audiences"],
|
|
139
|
+
expandedParentKey === item.key && item.key === "data-management" && styles["cap-navigation-spa-sidebar__item--expanded-data-management"],
|
|
140
|
+
expandedParentKey === item.key && item.key === "extensions" && styles["cap-navigation-spa-sidebar__item--expanded-extensions"],
|
|
141
|
+
expandedParentKey === item.key && item.key === "settings" && styles["cap-navigation-spa-sidebar__item--expanded-settings"]
|
|
142
|
+
),
|
|
143
|
+
onClick: () => handleItemClick(item),
|
|
144
|
+
onMouseEnter: () => {
|
|
145
|
+
var _a2;
|
|
146
|
+
if ((_a2 = item.children) == null ? void 0 : _a2.length) {
|
|
147
|
+
if (collapsed) {
|
|
148
|
+
setHoverExpandedKey(item.key);
|
|
149
|
+
}
|
|
150
|
+
setHoverL1TooltipKey(null);
|
|
151
|
+
} else if (collapsed) {
|
|
152
|
+
setHoverL1TooltipKey(item.key);
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"data-testid": `cap-navigation-spa-sidebar-item-${item.key}`,
|
|
156
|
+
children: [
|
|
157
|
+
/* @__PURE__ */ jsx("span", { className: styles["cap-navigation-spa-sidebar__item-icon"], children: getIconType(item) ? /* @__PURE__ */ jsx(CapIcon, { type: getIconType(item), size: "s" }) : /* @__PURE__ */ jsx("span", { className: styles["cap-navigation-spa-sidebar__item-dot"] }) }),
|
|
158
|
+
!collapsed && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
159
|
+
/* @__PURE__ */ jsx("span", { className: styles["cap-navigation-spa-sidebar__item-label"], children: item.title }),
|
|
160
|
+
((_b = item.children) == null ? void 0 : _b.length) ? /* @__PURE__ */ jsx(
|
|
161
|
+
CapIcon,
|
|
162
|
+
{
|
|
163
|
+
type: expandedParentKey === item.key ? "chevron-down" : "chevron-right",
|
|
164
|
+
size: "s",
|
|
165
|
+
className: styles["cap-navigation-spa-sidebar__item-chevron"]
|
|
166
|
+
}
|
|
167
|
+
) : null
|
|
168
|
+
] })
|
|
169
|
+
]
|
|
170
|
+
},
|
|
171
|
+
item.key
|
|
172
|
+
);
|
|
173
|
+
const showCollapsedFlyout = collapsed && ((_c = item.children) == null ? void 0 : _c.length) && expandedParentKey === item.key;
|
|
174
|
+
const showL1TooltipFlyout = collapsed && !((_d = item.children) == null ? void 0 : _d.length) && hoverL1TooltipKey === item.key;
|
|
175
|
+
const l2Inline = isExpandedWithChildren ? /* @__PURE__ */ jsxs(
|
|
176
|
+
"div",
|
|
177
|
+
{
|
|
178
|
+
className: styles["cap-navigation-spa-sidebar__l2-wrapper"],
|
|
179
|
+
children: [
|
|
180
|
+
/* @__PURE__ */ jsx("div", { className: styles["cap-navigation-spa-sidebar__l2-divider"], "aria-hidden": true }),
|
|
181
|
+
/* @__PURE__ */ jsx(
|
|
182
|
+
"div",
|
|
183
|
+
{
|
|
184
|
+
className: styles["cap-navigation-spa-sidebar__l2-inline"],
|
|
185
|
+
onMouseEnter: () => setHoverExpandedKey(item.key),
|
|
186
|
+
"data-testid": `cap-navigation-spa-sidebar-l2-${item.key}`,
|
|
187
|
+
children: item.children.map((child) => /* @__PURE__ */ jsx(
|
|
188
|
+
"button",
|
|
189
|
+
{
|
|
190
|
+
type: "button",
|
|
191
|
+
className: classNames(
|
|
192
|
+
styles["cap-navigation-spa-sidebar__l2-inline-item"],
|
|
193
|
+
selectedKey === child.key && styles["cap-navigation-spa-sidebar__l2-inline-item--selected"],
|
|
194
|
+
item.key === "loyalty" && selectedKey === child.key && styles["cap-navigation-spa-sidebar__l2-inline-item--selected-loyalty"],
|
|
195
|
+
item.key === "engage" && selectedKey === child.key && styles["cap-navigation-spa-sidebar__l2-inline-item--selected-engage"],
|
|
196
|
+
item.key === "insights" && selectedKey === child.key && styles["cap-navigation-spa-sidebar__l2-inline-item--selected-insights"],
|
|
197
|
+
item.key === "members" && selectedKey === child.key && styles["cap-navigation-spa-sidebar__l2-inline-item--selected-members"],
|
|
198
|
+
item.key === "rewards" && selectedKey === child.key && styles["cap-navigation-spa-sidebar__l2-inline-item--selected-rewards"],
|
|
199
|
+
item.key === "audiences" && selectedKey === child.key && styles["cap-navigation-spa-sidebar__l2-inline-item--selected-audiences"],
|
|
200
|
+
item.key === "data-management" && selectedKey === child.key && styles["cap-navigation-spa-sidebar__l2-inline-item--selected-data-management"],
|
|
201
|
+
item.key === "extensions" && selectedKey === child.key && styles["cap-navigation-spa-sidebar__l2-inline-item--selected-extensions"],
|
|
202
|
+
item.key === "settings" && selectedKey === child.key && styles["cap-navigation-spa-sidebar__l2-inline-item--selected-settings"]
|
|
203
|
+
),
|
|
204
|
+
onClick: () => {
|
|
205
|
+
handleClick(child);
|
|
206
|
+
},
|
|
207
|
+
"data-testid": `cap-navigation-spa-sidebar-l2-item-${child.key}`,
|
|
208
|
+
children: child.title
|
|
209
|
+
},
|
|
210
|
+
child.key
|
|
211
|
+
))
|
|
212
|
+
},
|
|
213
|
+
`${item.key}-l2`
|
|
214
|
+
)
|
|
215
|
+
]
|
|
216
|
+
},
|
|
217
|
+
`${item.key}-l2-wrapper`
|
|
218
|
+
) : null;
|
|
219
|
+
const collapsedFlyout = showCollapsedFlyout ? /* @__PURE__ */ jsxs(
|
|
220
|
+
"div",
|
|
221
|
+
{
|
|
222
|
+
className: styles["cap-navigation-spa-sidebar__l2-flyout"],
|
|
223
|
+
onMouseEnter: () => setHoverExpandedKey(item.key),
|
|
224
|
+
"data-testid": `cap-navigation-spa-sidebar-l2-flyout-${item.key}`,
|
|
225
|
+
role: "menu",
|
|
226
|
+
"aria-label": item.title,
|
|
227
|
+
children: [
|
|
228
|
+
/* @__PURE__ */ jsx(
|
|
229
|
+
"div",
|
|
230
|
+
{
|
|
231
|
+
className: styles["cap-navigation-spa-sidebar__l2-flyout-arrow"],
|
|
232
|
+
"aria-hidden": true
|
|
233
|
+
}
|
|
234
|
+
),
|
|
235
|
+
/* @__PURE__ */ jsxs("div", { className: styles["cap-navigation-spa-sidebar__l2-flyout-card"], children: [
|
|
236
|
+
/* @__PURE__ */ jsx("div", { className: styles["cap-navigation-spa-sidebar__l2-flyout-parent"], children: item.title }),
|
|
237
|
+
item.children.map((child) => /* @__PURE__ */ jsx(
|
|
238
|
+
"button",
|
|
239
|
+
{
|
|
240
|
+
type: "button",
|
|
241
|
+
className: classNames(
|
|
242
|
+
styles["cap-navigation-spa-sidebar__l2-flyout-item"],
|
|
243
|
+
selectedKey === child.key && styles["cap-navigation-spa-sidebar__l2-flyout-item--selected"]
|
|
244
|
+
),
|
|
245
|
+
onClick: () => {
|
|
246
|
+
setClickExpandedKey(item.key);
|
|
247
|
+
if (collapsed && onCollapseExpand) {
|
|
248
|
+
onCollapseExpand();
|
|
249
|
+
}
|
|
250
|
+
handleClick(child);
|
|
251
|
+
},
|
|
252
|
+
"data-testid": `cap-navigation-spa-sidebar-l2-flyout-item-${child.key}`,
|
|
253
|
+
role: "menuitem",
|
|
254
|
+
children: child.title
|
|
255
|
+
},
|
|
256
|
+
child.key
|
|
257
|
+
))
|
|
258
|
+
] })
|
|
259
|
+
]
|
|
260
|
+
},
|
|
261
|
+
`${item.key}-l2-flyout`
|
|
262
|
+
) : null;
|
|
263
|
+
const l1TooltipFlyout = showL1TooltipFlyout ? /* @__PURE__ */ jsxs(
|
|
264
|
+
"div",
|
|
265
|
+
{
|
|
266
|
+
className: styles["cap-navigation-spa-sidebar__l1-tooltip-flyout"],
|
|
267
|
+
onMouseEnter: () => setHoverL1TooltipKey(item.key),
|
|
268
|
+
"data-testid": `cap-navigation-spa-sidebar-l1-tooltip-${item.key}`,
|
|
269
|
+
role: "tooltip",
|
|
270
|
+
"aria-label": item.title,
|
|
271
|
+
children: [
|
|
272
|
+
/* @__PURE__ */ jsx(
|
|
273
|
+
"div",
|
|
274
|
+
{
|
|
275
|
+
className: styles["cap-navigation-spa-sidebar__l2-flyout-arrow"],
|
|
276
|
+
"aria-hidden": true
|
|
277
|
+
}
|
|
278
|
+
),
|
|
279
|
+
/* @__PURE__ */ jsx("div", { className: styles["cap-navigation-spa-sidebar__l1-tooltip-card"], children: /* @__PURE__ */ jsx("div", { className: styles["cap-navigation-spa-sidebar__l1-tooltip-label"], children: item.title }) })
|
|
280
|
+
]
|
|
281
|
+
},
|
|
282
|
+
`${item.key}-l1-tooltip`
|
|
283
|
+
) : null;
|
|
284
|
+
const wrapForCollapsedFlyout = collapsed;
|
|
285
|
+
const renderedButton = wrapForCollapsedFlyout ? /* @__PURE__ */ jsxs(
|
|
286
|
+
"div",
|
|
287
|
+
{
|
|
288
|
+
className: styles["cap-navigation-spa-sidebar__item-flyout-wrap"],
|
|
289
|
+
onMouseLeave: closeFlyout,
|
|
290
|
+
children: [
|
|
291
|
+
parentButton,
|
|
292
|
+
collapsedFlyout,
|
|
293
|
+
l1TooltipFlyout
|
|
294
|
+
]
|
|
295
|
+
},
|
|
296
|
+
`${item.key}-flyout-wrap`
|
|
297
|
+
) : parentButton;
|
|
298
|
+
if (item.key === SIDEBAR_DIVIDER_BEFORE_KEY) {
|
|
299
|
+
return [
|
|
300
|
+
/* @__PURE__ */ jsx(
|
|
301
|
+
"div",
|
|
302
|
+
{
|
|
303
|
+
className: styles["cap-navigation-spa-sidebar__divider"],
|
|
304
|
+
"aria-hidden": true
|
|
305
|
+
},
|
|
306
|
+
`divider-${item.key}`
|
|
307
|
+
),
|
|
308
|
+
renderedButton,
|
|
309
|
+
...l2Inline ? [l2Inline] : []
|
|
310
|
+
];
|
|
311
|
+
}
|
|
312
|
+
if (item.key === "settings") {
|
|
313
|
+
return [
|
|
314
|
+
/* @__PURE__ */ jsx(
|
|
315
|
+
"div",
|
|
316
|
+
{
|
|
317
|
+
className: styles["cap-navigation-spa-sidebar__divider"],
|
|
318
|
+
"aria-hidden": true
|
|
319
|
+
},
|
|
320
|
+
"divider-settings"
|
|
321
|
+
),
|
|
322
|
+
renderedButton,
|
|
323
|
+
...l2Inline ? [l2Inline] : []
|
|
324
|
+
];
|
|
325
|
+
}
|
|
326
|
+
return [renderedButton, ...l2Inline ? [l2Inline] : []];
|
|
327
|
+
}) }),
|
|
328
|
+
/* @__PURE__ */ jsxs("div", { className: styles["cap-navigation-spa-sidebar__footer"], children: [
|
|
329
|
+
!items.some((i) => i.key === "settings") && /* @__PURE__ */ jsxs(
|
|
330
|
+
"button",
|
|
331
|
+
{
|
|
332
|
+
type: "button",
|
|
333
|
+
className: styles["cap-navigation-spa-sidebar__item"],
|
|
334
|
+
onClick: () => {
|
|
335
|
+
closeFlyout();
|
|
336
|
+
const settingsItem = { key: "settings", title: settingsLabel, link: "/settings" };
|
|
337
|
+
handleClick(settingsItem);
|
|
338
|
+
},
|
|
339
|
+
"data-testid": "cap-navigation-spa-sidebar-settings",
|
|
340
|
+
children: [
|
|
341
|
+
/* @__PURE__ */ jsx("span", { className: styles["cap-navigation-spa-sidebar__item-icon"], children: /* @__PURE__ */ jsx(CapIcon, { type: "settings", size: "s" }) }),
|
|
342
|
+
!collapsed && /* @__PURE__ */ jsx("span", { className: styles["cap-navigation-spa-sidebar__item-label"], children: settingsLabel })
|
|
343
|
+
]
|
|
344
|
+
}
|
|
345
|
+
),
|
|
346
|
+
onCollapseExpand && /* @__PURE__ */ jsx("div", { className: styles["cap-navigation-spa-sidebar__collapse-wrap"], children: /* @__PURE__ */ jsx(
|
|
347
|
+
"button",
|
|
348
|
+
{
|
|
349
|
+
type: "button",
|
|
350
|
+
className: styles["cap-navigation-spa-sidebar__collapse-btn"],
|
|
351
|
+
onClick: onCollapseExpand,
|
|
352
|
+
"aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
353
|
+
"data-testid": "cap-navigation-spa-sidebar-collapse-toggle",
|
|
354
|
+
children: /* @__PURE__ */ jsx(
|
|
355
|
+
CapIcon,
|
|
356
|
+
{
|
|
357
|
+
type: collapsed ? "sidebar-expand" : "sidebar-collapse",
|
|
358
|
+
size: "s",
|
|
359
|
+
className: styles["cap-navigation-spa-sidebar__collapse-btn-icon"]
|
|
360
|
+
}
|
|
361
|
+
)
|
|
362
|
+
}
|
|
363
|
+
) })
|
|
364
|
+
] })
|
|
365
|
+
]
|
|
366
|
+
}
|
|
367
|
+
)
|
|
368
|
+
}
|
|
369
|
+
);
|
|
370
|
+
};
|
|
371
|
+
export {
|
|
372
|
+
CapNavigationSPASidebar as default
|
|
373
|
+
};
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
/* Color Palette */
|
|
2
|
+
/* Fonts */
|
|
3
|
+
/* Backward Compatibility Aliases */
|
|
4
|
+
/* Component Heights */
|
|
5
|
+
/* Border Radius */
|
|
6
|
+
/* Border Width */
|
|
7
|
+
/* Transition */
|
|
8
|
+
/* Timezones Footer */
|
|
9
|
+
.cap-navigation-spa-sidebar__wrapper {
|
|
10
|
+
position: relative;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-shrink: 0;
|
|
13
|
+
}
|
|
14
|
+
.cap-navigation-spa-sidebar {
|
|
15
|
+
width: 17.143rem;
|
|
16
|
+
min-width: 17.143rem;
|
|
17
|
+
height: 100%;
|
|
18
|
+
background-color: #fafbfc;
|
|
19
|
+
border-right: 1px solid #dfe2e7;
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
flex-shrink: 0;
|
|
23
|
+
transition: width 0.2s ease, min-width 0.2s ease;
|
|
24
|
+
}
|
|
25
|
+
.cap-navigation-spa-sidebar--collapsed {
|
|
26
|
+
width: 5.714rem;
|
|
27
|
+
min-width: 5.714rem;
|
|
28
|
+
background-color: #fafbfc;
|
|
29
|
+
}
|
|
30
|
+
.cap-navigation-spa-sidebar__logo {
|
|
31
|
+
height: 5rem;
|
|
32
|
+
padding: 1rem 0.857rem 1rem 1.429rem;
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
gap: 0.5rem;
|
|
36
|
+
flex-shrink: 0;
|
|
37
|
+
}
|
|
38
|
+
.cap-navigation-spa-sidebar--collapsed .cap-navigation-spa-sidebar__logo {
|
|
39
|
+
padding: 1rem 0.571rem;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
}
|
|
42
|
+
.cap-navigation-spa-sidebar__logo-icon {
|
|
43
|
+
flex-shrink: 0;
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
}
|
|
48
|
+
.cap-navigation-spa-sidebar__logo-text {
|
|
49
|
+
font-family: "Roboto", sans-serif;
|
|
50
|
+
font-size: 1.143rem;
|
|
51
|
+
font-weight: 500;
|
|
52
|
+
color: #091e42;
|
|
53
|
+
}
|
|
54
|
+
.cap-navigation-spa-sidebar__nav {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
flex: 1 1 auto;
|
|
58
|
+
min-height: 0;
|
|
59
|
+
padding: 0;
|
|
60
|
+
}
|
|
61
|
+
.cap-navigation-spa-sidebar__item {
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
height: 2.857rem;
|
|
65
|
+
padding: 0 1.429rem 0 1.429rem;
|
|
66
|
+
gap: 1rem;
|
|
67
|
+
width: 100%;
|
|
68
|
+
border: none;
|
|
69
|
+
background: transparent;
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
font-family: "Roboto", sans-serif;
|
|
72
|
+
font-size: 1rem;
|
|
73
|
+
font-weight: 400;
|
|
74
|
+
color: #091e42;
|
|
75
|
+
text-align: left;
|
|
76
|
+
transition: background-color 0.15s ease;
|
|
77
|
+
}
|
|
78
|
+
.cap-navigation-spa-sidebar__item:hover {
|
|
79
|
+
background-color: #ebecf0;
|
|
80
|
+
}
|
|
81
|
+
.cap-navigation-spa-sidebar--collapsed .cap-navigation-spa-sidebar__item {
|
|
82
|
+
padding: 0 0.571rem;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
}
|
|
85
|
+
.cap-navigation-spa-sidebar__item-icon {
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: center;
|
|
89
|
+
width: 1rem;
|
|
90
|
+
height: 1rem;
|
|
91
|
+
flex-shrink: 0;
|
|
92
|
+
color: #091e42;
|
|
93
|
+
}
|
|
94
|
+
.cap-navigation-spa-sidebar__item-dot {
|
|
95
|
+
width: 0.25rem;
|
|
96
|
+
height: 0.25rem;
|
|
97
|
+
border-radius: 50%;
|
|
98
|
+
background-color: currentColor;
|
|
99
|
+
}
|
|
100
|
+
.cap-navigation-spa-sidebar__item-label {
|
|
101
|
+
white-space: nowrap;
|
|
102
|
+
overflow: hidden;
|
|
103
|
+
text-overflow: ellipsis;
|
|
104
|
+
flex: 1 1 auto;
|
|
105
|
+
min-width: 0;
|
|
106
|
+
}
|
|
107
|
+
.cap-navigation-spa-sidebar__item--expanded {
|
|
108
|
+
background-color: #ebecf0;
|
|
109
|
+
}
|
|
110
|
+
.cap-navigation-spa-sidebar__item--expanded-loyalty,
|
|
111
|
+
.cap-navigation-spa-sidebar__item--expanded-engage,
|
|
112
|
+
.cap-navigation-spa-sidebar__item--expanded-insights,
|
|
113
|
+
.cap-navigation-spa-sidebar__item--expanded-members,
|
|
114
|
+
.cap-navigation-spa-sidebar__item--expanded-rewards,
|
|
115
|
+
.cap-navigation-spa-sidebar__item--expanded-audiences,
|
|
116
|
+
.cap-navigation-spa-sidebar__item--expanded-data-management,
|
|
117
|
+
.cap-navigation-spa-sidebar__item--expanded-extensions,
|
|
118
|
+
.cap-navigation-spa-sidebar__item--expanded-settings {
|
|
119
|
+
background-color: #e9f0fe;
|
|
120
|
+
}
|
|
121
|
+
.cap-navigation-spa-sidebar__item-chevron {
|
|
122
|
+
flex-shrink: 0;
|
|
123
|
+
margin-left: auto;
|
|
124
|
+
color: #091e42;
|
|
125
|
+
}
|
|
126
|
+
.cap-navigation-spa-sidebar__l2-wrapper {
|
|
127
|
+
display: flex;
|
|
128
|
+
flex-direction: column;
|
|
129
|
+
width: 100%;
|
|
130
|
+
}
|
|
131
|
+
.cap-navigation-spa-sidebar__l2-divider {
|
|
132
|
+
height: 1px;
|
|
133
|
+
background-color: #dfe2e7;
|
|
134
|
+
width: 100%;
|
|
135
|
+
flex-shrink: 0;
|
|
136
|
+
}
|
|
137
|
+
.cap-navigation-spa-sidebar__l2-inline {
|
|
138
|
+
display: flex;
|
|
139
|
+
flex-direction: column;
|
|
140
|
+
margin-left: 2.286rem;
|
|
141
|
+
padding: 0;
|
|
142
|
+
border-left: 2px solid #dfe2e7;
|
|
143
|
+
background-color: #fafbfc;
|
|
144
|
+
}
|
|
145
|
+
.cap-navigation-spa-sidebar__l2-inline-item {
|
|
146
|
+
display: flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
height: 2.857rem;
|
|
149
|
+
padding: 0 1.714rem 0 1.286rem;
|
|
150
|
+
width: 100%;
|
|
151
|
+
border: none;
|
|
152
|
+
background-color: #fafbfc;
|
|
153
|
+
cursor: pointer;
|
|
154
|
+
font-family: "Roboto", sans-serif;
|
|
155
|
+
font-size: 1rem;
|
|
156
|
+
font-weight: 400;
|
|
157
|
+
color: #091e42;
|
|
158
|
+
text-align: left;
|
|
159
|
+
transition: background-color 0.15s ease;
|
|
160
|
+
}
|
|
161
|
+
.cap-navigation-spa-sidebar__l2-inline-item:hover {
|
|
162
|
+
background-color: #ebecf0;
|
|
163
|
+
}
|
|
164
|
+
.cap-navigation-spa-sidebar__l2-inline-item--selected {
|
|
165
|
+
background-color: #e9f0fe;
|
|
166
|
+
}
|
|
167
|
+
.cap-navigation-spa-sidebar__l2-inline-item--selected-loyalty,
|
|
168
|
+
.cap-navigation-spa-sidebar__l2-inline-item--selected-engage,
|
|
169
|
+
.cap-navigation-spa-sidebar__l2-inline-item--selected-insights,
|
|
170
|
+
.cap-navigation-spa-sidebar__l2-inline-item--selected-members,
|
|
171
|
+
.cap-navigation-spa-sidebar__l2-inline-item--selected-rewards,
|
|
172
|
+
.cap-navigation-spa-sidebar__l2-inline-item--selected-audiences,
|
|
173
|
+
.cap-navigation-spa-sidebar__l2-inline-item--selected-data-management,
|
|
174
|
+
.cap-navigation-spa-sidebar__l2-inline-item--selected-extensions,
|
|
175
|
+
.cap-navigation-spa-sidebar__l2-inline-item--selected-settings {
|
|
176
|
+
margin-left: -2px;
|
|
177
|
+
background-color: #ebecf0;
|
|
178
|
+
box-shadow: inset 2px 0 0 #2466ea;
|
|
179
|
+
}
|
|
180
|
+
.cap-navigation-spa-sidebar__divider {
|
|
181
|
+
height: 1px;
|
|
182
|
+
background-color: #dfe2e7;
|
|
183
|
+
margin: 1rem 0.857rem;
|
|
184
|
+
flex-shrink: 0;
|
|
185
|
+
}
|
|
186
|
+
.cap-navigation-spa-sidebar__footer {
|
|
187
|
+
padding: 0.571rem 0 1rem;
|
|
188
|
+
flex-shrink: 0;
|
|
189
|
+
display: flex;
|
|
190
|
+
flex-direction: column;
|
|
191
|
+
gap: 1rem;
|
|
192
|
+
}
|
|
193
|
+
.cap-navigation-spa-sidebar--collapsed .cap-navigation-spa-sidebar__footer {
|
|
194
|
+
padding: 0.571rem 0.571rem 1rem;
|
|
195
|
+
}
|
|
196
|
+
.cap-navigation-spa-sidebar__collapse-btn {
|
|
197
|
+
display: flex;
|
|
198
|
+
align-items: center;
|
|
199
|
+
justify-content: center;
|
|
200
|
+
width: 5.714rem;
|
|
201
|
+
height: 2.857rem;
|
|
202
|
+
padding: 0;
|
|
203
|
+
margin-top: 0;
|
|
204
|
+
border: none;
|
|
205
|
+
background-color: transparent;
|
|
206
|
+
cursor: pointer;
|
|
207
|
+
color: #091e42;
|
|
208
|
+
border-radius: 0;
|
|
209
|
+
transition: background-color 0.15s ease;
|
|
210
|
+
flex-shrink: 0;
|
|
211
|
+
}
|
|
212
|
+
.cap-navigation-spa-sidebar__collapse-btn:hover {
|
|
213
|
+
background-color: #ebecf0;
|
|
214
|
+
}
|
|
215
|
+
.cap-navigation-spa-sidebar__collapse-btn-icon {
|
|
216
|
+
font-size: 16px;
|
|
217
|
+
}
|
|
218
|
+
.cap-navigation-spa-sidebar__collapse-wrap {
|
|
219
|
+
width: 100%;
|
|
220
|
+
display: flex;
|
|
221
|
+
justify-content: flex-end;
|
|
222
|
+
}
|
|
223
|
+
.cap-navigation-spa-sidebar--collapsed .cap-navigation-spa-sidebar__collapse-wrap {
|
|
224
|
+
justify-content: center;
|
|
225
|
+
}
|
|
226
|
+
.cap-navigation-spa-sidebar__item-flyout-wrap {
|
|
227
|
+
position: relative;
|
|
228
|
+
}
|
|
229
|
+
.cap-navigation-spa-sidebar__l2-flyout {
|
|
230
|
+
position: absolute;
|
|
231
|
+
left: 100%;
|
|
232
|
+
top: 50%;
|
|
233
|
+
transform: translateY(-50%);
|
|
234
|
+
display: flex;
|
|
235
|
+
align-items: center;
|
|
236
|
+
padding-left: 4px;
|
|
237
|
+
z-index: 10;
|
|
238
|
+
pointer-events: auto;
|
|
239
|
+
}
|
|
240
|
+
.cap-navigation-spa-sidebar__l2-flyout-arrow {
|
|
241
|
+
width: 0;
|
|
242
|
+
height: 0;
|
|
243
|
+
border-top: 5px solid transparent;
|
|
244
|
+
border-bottom: 5px solid transparent;
|
|
245
|
+
border-right: 5px solid #ffffff;
|
|
246
|
+
align-self: center;
|
|
247
|
+
margin-left: -3px;
|
|
248
|
+
filter: drop-shadow(0 0 1px rgba(9, 30, 66, 0.15));
|
|
249
|
+
}
|
|
250
|
+
.cap-navigation-spa-sidebar__l2-flyout-card {
|
|
251
|
+
background-color: #ffffff;
|
|
252
|
+
border: 1px solid #dfe2e7;
|
|
253
|
+
border-radius: 6px;
|
|
254
|
+
box-shadow: 0 4px 4px rgba(9, 30, 66, 0.15), 0 0 1px rgba(9, 30, 66, 0.15);
|
|
255
|
+
min-width: 200px;
|
|
256
|
+
overflow: hidden;
|
|
257
|
+
display: flex;
|
|
258
|
+
flex-direction: column;
|
|
259
|
+
}
|
|
260
|
+
.cap-navigation-spa-sidebar__l2-flyout-parent {
|
|
261
|
+
padding: 8px 16px 10px;
|
|
262
|
+
font-family: "Roboto", sans-serif;
|
|
263
|
+
font-size: 1rem;
|
|
264
|
+
font-weight: 500;
|
|
265
|
+
color: #091e42;
|
|
266
|
+
border-bottom: 1px solid #dfe2e7;
|
|
267
|
+
flex-shrink: 0;
|
|
268
|
+
}
|
|
269
|
+
.cap-navigation-spa-sidebar__l2-flyout-item {
|
|
270
|
+
display: flex;
|
|
271
|
+
align-items: center;
|
|
272
|
+
height: 2.857rem;
|
|
273
|
+
padding: 0 1rem;
|
|
274
|
+
width: 100%;
|
|
275
|
+
border: none;
|
|
276
|
+
background-color: #fafbfc;
|
|
277
|
+
cursor: pointer;
|
|
278
|
+
font-family: "Roboto", sans-serif;
|
|
279
|
+
font-size: 1rem;
|
|
280
|
+
font-weight: 400;
|
|
281
|
+
color: #091e42;
|
|
282
|
+
text-align: left;
|
|
283
|
+
transition: background-color 0.15s ease;
|
|
284
|
+
}
|
|
285
|
+
.cap-navigation-spa-sidebar__l2-flyout-item:hover {
|
|
286
|
+
background-color: #ebecf0;
|
|
287
|
+
}
|
|
288
|
+
.cap-navigation-spa-sidebar__l2-flyout-item--selected {
|
|
289
|
+
background-color: #e9f0fe;
|
|
290
|
+
}
|
|
291
|
+
.cap-navigation-spa-sidebar__l1-tooltip-flyout {
|
|
292
|
+
position: absolute;
|
|
293
|
+
left: 100%;
|
|
294
|
+
top: 50%;
|
|
295
|
+
transform: translateY(-50%);
|
|
296
|
+
display: flex;
|
|
297
|
+
align-items: center;
|
|
298
|
+
padding-left: 4px;
|
|
299
|
+
z-index: 10;
|
|
300
|
+
pointer-events: auto;
|
|
301
|
+
}
|
|
302
|
+
.cap-navigation-spa-sidebar__l1-tooltip-card {
|
|
303
|
+
background-color: #ffffff;
|
|
304
|
+
border: 1px solid #dfe2e7;
|
|
305
|
+
border-radius: 6px;
|
|
306
|
+
box-shadow: 0 4px 4px rgba(9, 30, 66, 0.15), 0 0 1px rgba(9, 30, 66, 0.15);
|
|
307
|
+
overflow: hidden;
|
|
308
|
+
display: flex;
|
|
309
|
+
flex-direction: column;
|
|
310
|
+
}
|
|
311
|
+
.cap-navigation-spa-sidebar__l1-tooltip-label {
|
|
312
|
+
padding: 8px 16px 10px;
|
|
313
|
+
font-family: "Roboto", sans-serif;
|
|
314
|
+
font-size: 1rem;
|
|
315
|
+
font-weight: 400;
|
|
316
|
+
color: #091e42;
|
|
317
|
+
white-space: nowrap;
|
|
318
|
+
}
|