@cloudscape-design/components-themeable 3.0.1315 → 3.0.1317
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/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/scss/link/styles.scss +16 -0
- package/lib/internal/scss/side-navigation/styles.scss +221 -48
- package/lib/internal/scss/side-navigation/test-classes/styles.scss +4 -0
- package/lib/internal/scss/top-navigation/test-classes/styles.scss +8 -0
- package/lib/internal/template/file-token-group/file-token.d.ts.map +1 -1
- package/lib/internal/template/file-token-group/file-token.js +33 -27
- package/lib/internal/template/file-token-group/file-token.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +35 -17
- package/lib/internal/template/internal/breakpoints.d.ts +1 -1
- package/lib/internal/template/internal/breakpoints.d.ts.map +1 -1
- package/lib/internal/template/internal/breakpoints.js +25 -3
- package/lib/internal/template/internal/breakpoints.js.map +1 -1
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/internal/generated/styles/tokens.d.ts +6 -0
- package/lib/internal/template/internal/generated/styles/tokens.js +6 -0
- package/lib/internal/template/internal/generated/theming/index.cjs +153 -21
- package/lib/internal/template/internal/generated/theming/index.cjs.d.ts +45 -0
- package/lib/internal/template/internal/generated/theming/index.d.ts +45 -0
- package/lib/internal/template/internal/generated/theming/index.js +153 -21
- package/lib/internal/template/internal/hooks/container-queries/use-container-breakpoints.d.ts.map +1 -1
- package/lib/internal/template/internal/hooks/container-queries/use-container-breakpoints.js +2 -1
- package/lib/internal/template/internal/hooks/container-queries/use-container-breakpoints.js.map +1 -1
- package/lib/internal/template/link/internal.js +1 -1
- package/lib/internal/template/link/internal.js.map +1 -1
- package/lib/internal/template/link/styles.css.js +21 -21
- package/lib/internal/template/link/styles.scoped.css +118 -72
- package/lib/internal/template/link/styles.selectors.js +21 -21
- package/lib/internal/template/prompt-input/index.d.ts.map +1 -1
- package/lib/internal/template/prompt-input/index.js +3 -1
- package/lib/internal/template/prompt-input/index.js.map +1 -1
- package/lib/internal/template/side-navigation/implementation.d.ts +1 -1
- package/lib/internal/template/side-navigation/implementation.d.ts.map +1 -1
- package/lib/internal/template/side-navigation/implementation.js +4 -4
- package/lib/internal/template/side-navigation/implementation.js.map +1 -1
- package/lib/internal/template/side-navigation/index.d.ts +1 -1
- package/lib/internal/template/side-navigation/index.d.ts.map +1 -1
- package/lib/internal/template/side-navigation/index.js +5 -3
- package/lib/internal/template/side-navigation/index.js.map +1 -1
- package/lib/internal/template/side-navigation/interfaces.d.ts +20 -1
- package/lib/internal/template/side-navigation/interfaces.d.ts.map +1 -1
- package/lib/internal/template/side-navigation/interfaces.js.map +1 -1
- package/lib/internal/template/side-navigation/parts.d.ts +3 -2
- package/lib/internal/template/side-navigation/parts.d.ts.map +1 -1
- package/lib/internal/template/side-navigation/parts.js +147 -37
- package/lib/internal/template/side-navigation/parts.js.map +1 -1
- package/lib/internal/template/side-navigation/styles.css.js +46 -30
- package/lib/internal/template/side-navigation/styles.scoped.css +223 -74
- package/lib/internal/template/side-navigation/styles.selectors.js +46 -30
- package/lib/internal/template/side-navigation/test-classes/styles.css.js +2 -1
- package/lib/internal/template/side-navigation/test-classes/styles.scoped.css +5 -1
- package/lib/internal/template/side-navigation/test-classes/styles.selectors.js +2 -1
- package/lib/internal/template/test-utils/dom/top-navigation/index.d.ts +2 -1
- package/lib/internal/template/test-utils/dom/top-navigation/index.js +4 -0
- package/lib/internal/template/test-utils/dom/top-navigation/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/top-navigation/index.d.ts +1 -0
- package/lib/internal/template/test-utils/selectors/top-navigation/index.js +4 -0
- package/lib/internal/template/test-utils/selectors/top-navigation/index.js.map +1 -1
- package/lib/internal/template/token/internal.d.ts +18 -2
- package/lib/internal/template/token/internal.d.ts.map +1 -1
- package/lib/internal/template/token/internal.js +20 -9
- package/lib/internal/template/token/internal.js.map +1 -1
- package/lib/internal/template/top-navigation/index.d.ts +1 -1
- package/lib/internal/template/top-navigation/index.d.ts.map +1 -1
- package/lib/internal/template/top-navigation/index.js +2 -2
- package/lib/internal/template/top-navigation/index.js.map +1 -1
- package/lib/internal/template/top-navigation/interfaces.d.ts +14 -1
- package/lib/internal/template/top-navigation/interfaces.d.ts.map +1 -1
- package/lib/internal/template/top-navigation/interfaces.js.map +1 -1
- package/lib/internal/template/top-navigation/internal.d.ts +2 -2
- package/lib/internal/template/top-navigation/internal.d.ts.map +1 -1
- package/lib/internal/template/top-navigation/internal.js +42 -21
- package/lib/internal/template/top-navigation/internal.js.map +1 -1
- package/lib/internal/template/top-navigation/test-classes/styles.css.js +6 -0
- package/lib/internal/template/top-navigation/test-classes/styles.scoped.css +7 -0
- package/lib/internal/template/top-navigation/test-classes/styles.selectors.js +7 -0
- package/lib/internal/template/top-navigation/use-top-navigation.d.ts +5 -0
- package/lib/internal/template/top-navigation/use-top-navigation.d.ts.map +1 -1
- package/lib/internal/template/top-navigation/use-top-navigation.js +12 -5
- package/lib/internal/template/top-navigation/use-top-navigation.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';
|
|
6
6
|
import InternalBox from '../box/internal';
|
|
@@ -10,11 +10,12 @@ import InternalIcon from '../icon/internal';
|
|
|
10
10
|
import { isPlainLeftClick } from '../internal/events';
|
|
11
11
|
import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
12
12
|
import { checkSafeUrl } from '../internal/utils/check-safe-url';
|
|
13
|
+
import Tooltip from '../tooltip/internal';
|
|
13
14
|
import { hasActiveLink } from './util';
|
|
14
15
|
import analyticsSelectors from './analytics-metadata/styles.css.js';
|
|
15
16
|
import styles from './styles.css.js';
|
|
16
17
|
import testUtilStyles from './test-classes/styles.css.js';
|
|
17
|
-
export function Header({ definition, activeHref, fireFollow }) {
|
|
18
|
+
export function Header({ definition, activeHref, fireFollow, collapsed }) {
|
|
18
19
|
checkSafeUrl('SideNavigation', definition.href);
|
|
19
20
|
const onClick = useCallback((event) => {
|
|
20
21
|
if (isPlainLeftClick(event)) {
|
|
@@ -31,15 +32,18 @@ export function Header({ definition, activeHref, fireFollow }) {
|
|
|
31
32
|
},
|
|
32
33
|
};
|
|
33
34
|
return (React.createElement(React.Fragment, null,
|
|
34
|
-
React.createElement("h2", { className: styles.header },
|
|
35
|
-
React.createElement("a", { href: definition.href, className: clsx(styles['header-link'], { [styles['header-link--has-logo']]: !!definition.logo }), "aria-current": definition.href === activeHref ? 'page' : undefined, onClick: onClick, ...getAnalyticsMetadataAttribute(clickActionAnalyticsMetadata) },
|
|
36
|
-
definition.logo &&
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
React.createElement("h2", { className: clsx(styles.header, collapsed && styles['header--collapsed']) },
|
|
36
|
+
React.createElement("a", { href: definition.href, className: clsx(styles['header-link'], { [styles['header-link--has-logo']]: !!definition.logo }), "aria-current": definition.href === activeHref ? 'page' : undefined, "aria-label": collapsed ? definition.text : undefined, onClick: onClick, ...getAnalyticsMetadataAttribute(clickActionAnalyticsMetadata) },
|
|
37
|
+
definition.logo &&
|
|
38
|
+
(definition.logo.svg ? (React.createElement("span", { className: clsx(styles['header-logo'], {
|
|
39
|
+
[styles['header-logo--stretched']]: !definition.text || collapsed,
|
|
40
|
+
}) }, definition.logo.svg)) : (React.createElement("img", { className: clsx(styles['header-logo'], {
|
|
41
|
+
[styles['header-logo--stretched']]: !definition.text || collapsed,
|
|
42
|
+
}), src: definition.logo.src, alt: definition.logo.alt }))),
|
|
43
|
+
!collapsed && (React.createElement("span", { className: clsx(styles['header-link-text'], analyticsSelectors['header-link-text']) }, definition.text)))),
|
|
40
44
|
React.createElement(Divider, { isPresentational: true, variant: "header" })));
|
|
41
45
|
}
|
|
42
|
-
export function NavigationItemsList({ items, variant, activeHref, fireChange, fireFollow, position = '', }) {
|
|
46
|
+
export function NavigationItemsList({ items, variant, activeHref, fireChange, fireFollow, position = '', collapsed, }) {
|
|
43
47
|
const lists = [];
|
|
44
48
|
let currentListIndex = 0;
|
|
45
49
|
lists[currentListIndex] = {
|
|
@@ -50,12 +54,54 @@ export function NavigationItemsList({ items, variant, activeHref, fireChange, fi
|
|
|
50
54
|
var _a, _b, _c, _d, _e;
|
|
51
55
|
const itemid = index + 1;
|
|
52
56
|
const itemPosition = `${position ? `${position},` : ''}${itemid}`;
|
|
57
|
+
// Renders icon-bearing children of a container item as a collapsed group.
|
|
58
|
+
// The inner <ul> carries the group label so list semantics are preserved
|
|
59
|
+
// for screen readers even when the visual header is hidden.
|
|
60
|
+
function pushCollapsedGroup(children, label) {
|
|
61
|
+
var _a;
|
|
62
|
+
const iconChildren = children.filter(child => child.icon);
|
|
63
|
+
if (iconChildren.length === 0) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const groupElements = iconChildren.map((child, childIndex) => {
|
|
67
|
+
const childPosition = `${position ? `${position},` : ''}${itemid},${childIndex + 1}`;
|
|
68
|
+
return (React.createElement("li", { key: childPosition, className: clsx(styles['list-item'], styles['list-item--collapsed']) },
|
|
69
|
+
React.createElement(Link, { definition: child, activeHref: activeHref, fireFollow: fireFollow, fireChange: fireChange, position: childPosition, collapsed: collapsed })));
|
|
70
|
+
});
|
|
71
|
+
const prevItem = index > 0 ? items[index - 1] : null;
|
|
72
|
+
const nextItem = index < items.length - 1 ? items[index + 1] : null;
|
|
73
|
+
(_a = lists[currentListIndex].items) === null || _a === void 0 ? void 0 : _a.push({
|
|
74
|
+
element: (React.createElement("li", { key: `group-${itemid}`, className: clsx(styles['list-item--group'], (prevItem === null || prevItem === void 0 ? void 0 : prevItem.type) === 'divider' && styles['list-item--group-no-padding-start'], (nextItem === null || nextItem === void 0 ? void 0 : nextItem.type) === 'divider' && styles['list-item--group-no-padding-end']) },
|
|
75
|
+
React.createElement("ul", { className: styles['list--collapsed-group'], "aria-label": label }, groupElements))),
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
// In collapsed mode, flatten container items to show only icon-bearing children.
|
|
79
|
+
if (collapsed && (item.type === 'expandable-link-group' || item.type === 'link-group') && !item.icon) {
|
|
80
|
+
const group = item;
|
|
81
|
+
pushCollapsedGroup(group.items, group.text);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (collapsed && (item.type === 'section' || item.type === 'section-group')) {
|
|
85
|
+
const sectionLabel = item.type === 'section'
|
|
86
|
+
? item.text
|
|
87
|
+
: item.title;
|
|
88
|
+
// Section-groups may contain nested sections — flatten one level.
|
|
89
|
+
const childItems = item.type === 'section'
|
|
90
|
+
? item.items
|
|
91
|
+
: item.items.flatMap(child => child.type === 'section' ? child.items : [child]);
|
|
92
|
+
pushCollapsedGroup(childItems, sectionLabel);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (collapsed && item.type !== 'divider' && !item.icon) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
53
98
|
switch (item.type) {
|
|
54
99
|
case 'divider': {
|
|
55
100
|
const dividerIndex = lists.length;
|
|
56
101
|
lists[dividerIndex] = {
|
|
102
|
+
listVariant: variant,
|
|
57
103
|
element: (React.createElement("div", { "data-itemid": `item-${itemid}` },
|
|
58
|
-
React.createElement(Divider, { variant: "default" }))),
|
|
104
|
+
React.createElement(Divider, { variant: "default", collapsed: collapsed }))),
|
|
59
105
|
};
|
|
60
106
|
currentListIndex = lists.length;
|
|
61
107
|
lists[currentListIndex] = {
|
|
@@ -66,61 +112,103 @@ export function NavigationItemsList({ items, variant, activeHref, fireChange, fi
|
|
|
66
112
|
}
|
|
67
113
|
case 'link': {
|
|
68
114
|
(_a = lists[currentListIndex].items) === null || _a === void 0 ? void 0 : _a.push({
|
|
69
|
-
element: (React.createElement("li", { key: index, "data-itemid": `item-${itemid}`, className: styles['list-item'] },
|
|
70
|
-
React.createElement(Link, { definition: item, activeHref: activeHref, fireChange: fireChange, fireFollow: fireFollow, position: itemPosition }))),
|
|
115
|
+
element: (React.createElement("li", { key: index, "data-itemid": `item-${itemid}`, className: clsx(styles['list-item'], collapsed && styles['list-item--collapsed'], item.info && styles['list-item--info']) },
|
|
116
|
+
React.createElement(Link, { definition: item, activeHref: activeHref, fireChange: fireChange, fireFollow: fireFollow, position: itemPosition, collapsed: collapsed }))),
|
|
71
117
|
});
|
|
72
118
|
return;
|
|
73
119
|
}
|
|
74
120
|
case 'section': {
|
|
75
121
|
(_b = lists[currentListIndex].items) === null || _b === void 0 ? void 0 : _b.push({
|
|
76
|
-
element: (React.createElement("li", { key: index, "data-itemid": `item-${itemid}`, className: styles['list-item'] },
|
|
77
|
-
React.createElement(Section, { definition: item, activeHref: activeHref, variant: variant, fireChange: fireChange, fireFollow: fireFollow, position: itemPosition }))),
|
|
122
|
+
element: (React.createElement("li", { key: index, "data-itemid": `item-${itemid}`, className: clsx(styles['list-item'], collapsed && styles['list-item--collapsed']) },
|
|
123
|
+
React.createElement(Section, { definition: item, activeHref: activeHref, variant: variant, fireChange: fireChange, fireFollow: fireFollow, position: itemPosition, collapsed: collapsed }))),
|
|
78
124
|
});
|
|
79
125
|
return;
|
|
80
126
|
}
|
|
81
127
|
case 'section-group': {
|
|
82
128
|
(_c = lists[currentListIndex].items) === null || _c === void 0 ? void 0 : _c.push({
|
|
83
|
-
element: (React.createElement("li", { key: index, "data-itemid": `item-${itemid}`, className: styles['list-item'] },
|
|
84
|
-
React.createElement(SectionGroup, { definition: item, activeHref: activeHref, fireChange: fireChange, fireFollow: fireFollow, position: itemPosition }))),
|
|
129
|
+
element: (React.createElement("li", { key: index, "data-itemid": `item-${itemid}`, className: clsx(styles['list-item'], collapsed && styles['list-item--collapsed']) },
|
|
130
|
+
React.createElement(SectionGroup, { definition: item, activeHref: activeHref, fireChange: fireChange, fireFollow: fireFollow, position: itemPosition, collapsed: collapsed }))),
|
|
85
131
|
});
|
|
86
132
|
return;
|
|
87
133
|
}
|
|
88
134
|
case 'link-group': {
|
|
89
135
|
(_d = lists[currentListIndex].items) === null || _d === void 0 ? void 0 : _d.push({
|
|
90
|
-
element: (React.createElement("li", { key: index, "data-itemid": `item-${itemid}`, className: styles['list-item'] },
|
|
91
|
-
React.createElement(LinkGroup, { definition: item, activeHref: activeHref, fireChange: fireChange, fireFollow: fireFollow, position: itemPosition }))),
|
|
136
|
+
element: (React.createElement("li", { key: index, "data-itemid": `item-${itemid}`, className: clsx(styles['list-item'], collapsed && styles['list-item--collapsed'], item.info && styles['list-item--info']) },
|
|
137
|
+
React.createElement(LinkGroup, { definition: item, activeHref: activeHref, fireChange: fireChange, fireFollow: fireFollow, position: itemPosition, collapsed: collapsed }))),
|
|
92
138
|
});
|
|
93
139
|
return;
|
|
94
140
|
}
|
|
95
141
|
case 'expandable-link-group': {
|
|
96
142
|
(_e = lists[currentListIndex].items) === null || _e === void 0 ? void 0 : _e.push({
|
|
97
|
-
element: (React.createElement("li", { key: index, "data-itemid": `item-${itemid}`, className: styles['list-item'] },
|
|
98
|
-
React.createElement(ExpandableLinkGroup, { definition: item, activeHref: activeHref, fireChange: fireChange, fireFollow: fireFollow, variant: variant, position: itemPosition }))),
|
|
143
|
+
element: (React.createElement("li", { key: index, "data-itemid": `item-${itemid}`, className: clsx(styles['list-item'], collapsed && styles['list-item--collapsed']) },
|
|
144
|
+
React.createElement(ExpandableLinkGroup, { definition: item, activeHref: activeHref, fireChange: fireChange, fireFollow: fireFollow, variant: variant, position: itemPosition, collapsed: collapsed }))),
|
|
99
145
|
});
|
|
100
146
|
return;
|
|
101
147
|
}
|
|
102
148
|
}
|
|
103
149
|
});
|
|
104
|
-
|
|
150
|
+
// In collapsed mode, skip empty item segments and deduplicate consecutive dividers.
|
|
151
|
+
const filteredLists = collapsed
|
|
152
|
+
? lists.filter((list, index) => {
|
|
153
|
+
if (list.items) {
|
|
154
|
+
return list.items.length > 0;
|
|
155
|
+
}
|
|
156
|
+
// Divider — skip if preceded by another divider or empty segment, or followed by nothing.
|
|
157
|
+
const prevVisible = lists
|
|
158
|
+
.slice(0, index)
|
|
159
|
+
.reverse()
|
|
160
|
+
.find(l => !l.items || l.items.length > 0);
|
|
161
|
+
const nextVisible = lists.slice(index + 1).find(l => !l.items || l.items.length > 0);
|
|
162
|
+
return ((!prevVisible || (prevVisible.items !== undefined && prevVisible.items.length > 0)) &&
|
|
163
|
+
nextVisible !== undefined &&
|
|
164
|
+
(nextVisible.items === undefined || nextVisible.items.length > 0));
|
|
165
|
+
})
|
|
166
|
+
: lists;
|
|
167
|
+
return (React.createElement(React.Fragment, null, filteredLists.map((list, index) => {
|
|
105
168
|
if (!list.items || list.items.length === 0) {
|
|
106
169
|
return (React.createElement("div", { key: `hr-${index}`, className: clsx(styles.list, styles[`list-variant-${variant}`], {
|
|
107
170
|
[styles['list-variant-root--first']]: list.listVariant === 'root' && index === 0,
|
|
171
|
+
[styles['list-variant-root--collapsed']]: list.listVariant === 'root' && collapsed,
|
|
108
172
|
}) }, list.element));
|
|
109
173
|
}
|
|
110
174
|
else {
|
|
111
175
|
return (React.createElement("ul", { key: `list-${index}`, className: clsx(styles.list, styles[`list-variant-${list.listVariant}`], {
|
|
112
176
|
[styles['list-variant-root--first']]: list.listVariant === 'root' && index === 0,
|
|
177
|
+
[styles['list-variant-root--collapsed']]: list.listVariant === 'root' && collapsed,
|
|
113
178
|
}) }, list.items.map(item => item.element)));
|
|
114
179
|
}
|
|
115
180
|
})));
|
|
116
181
|
}
|
|
117
|
-
function Divider({ variant = 'default', isPresentational = false }) {
|
|
118
|
-
return (React.createElement("hr", { className: clsx(styles.divider, styles[`divider-${variant}`]), role: isPresentational ? 'presentation' : undefined }));
|
|
182
|
+
function Divider({ variant = 'default', isPresentational = false, collapsed }) {
|
|
183
|
+
return (React.createElement("hr", { className: clsx(styles.divider, styles[`divider-${variant}`], collapsed && styles['divider--collapsed']), role: isPresentational ? 'presentation' : undefined }));
|
|
184
|
+
}
|
|
185
|
+
const ItemIcon = React.forwardRef(function ItemIcon({ icon, collapsed, className, ...rest }, ref) {
|
|
186
|
+
if (!icon) {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
return (React.createElement("span", { ref: ref, className: clsx(styles['item-icon'], testUtilStyles['item-icon'], collapsed && styles['item-icon--collapsed'], className), ...rest }, icon));
|
|
190
|
+
});
|
|
191
|
+
// Manages a tooltip that shows the item's text label on focus or hover.
|
|
192
|
+
// Used in the collapsed state, where the visible labels are hidden, to give
|
|
193
|
+
// pointer and keyboard users a way to identify each item without relying on
|
|
194
|
+
// their browser's native title popup.
|
|
195
|
+
function useCollapsedTooltip(label) {
|
|
196
|
+
const [show, setShow] = useState(false);
|
|
197
|
+
const triggerRef = useRef(null);
|
|
198
|
+
const triggerProps = {
|
|
199
|
+
onFocus: () => setShow(true),
|
|
200
|
+
onBlur: () => setShow(false),
|
|
201
|
+
onMouseEnter: () => setShow(true),
|
|
202
|
+
onMouseLeave: () => setShow(false),
|
|
203
|
+
};
|
|
204
|
+
const tooltip = show ? (React.createElement(Tooltip, { getTrack: () => triggerRef.current, content: label, position: "right", onEscape: () => setShow(false) })) : null;
|
|
205
|
+
return { triggerRef, triggerProps, tooltip };
|
|
119
206
|
}
|
|
120
|
-
function Link({ definition, activeHref, fireFollow, position }) {
|
|
207
|
+
function Link({ definition, activeHref, fireFollow, position, collapsed }) {
|
|
121
208
|
checkSafeUrl('SideNavigation', definition.href);
|
|
122
209
|
const isActive = definition.href === activeHref;
|
|
123
210
|
const i18n = useInternalI18n('link');
|
|
211
|
+
const collapsedTooltip = useCollapsedTooltip(definition.text);
|
|
124
212
|
const onClick = useCallback((event) => {
|
|
125
213
|
if (isPlainLeftClick(event)) {
|
|
126
214
|
fireFollow(definition, event);
|
|
@@ -137,13 +225,19 @@ function Link({ definition, activeHref, fireFollow, position }) {
|
|
|
137
225
|
};
|
|
138
226
|
const renderedExternalIconAriaLabel = i18n('externalIconAriaLabel', definition.externalIconAriaLabel);
|
|
139
227
|
return (React.createElement(React.Fragment, null,
|
|
140
|
-
React.createElement("a", {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
228
|
+
React.createElement("a", { ref: collapsed ? collapsedTooltip.triggerRef : undefined, href: definition.href, className: clsx(styles.link, {
|
|
229
|
+
[styles['link-active']]: isActive,
|
|
230
|
+
[styles['link--collapsed']]: collapsed,
|
|
231
|
+
}), target: definition.external ? '_blank' : undefined, rel: definition.external ? 'noopener noreferrer' : undefined, "aria-current": definition.href === activeHref ? 'page' : undefined, "aria-label": collapsed ? definition.text : undefined, onClick: onClick, ...(collapsed ? collapsedTooltip.triggerProps : {}), ...getAnalyticsMetadataAttribute(clickActionAnalyticsMetadata) },
|
|
232
|
+
React.createElement(ItemIcon, { icon: definition.icon, collapsed: collapsed, "aria-hidden": collapsed ? true : undefined }),
|
|
233
|
+
!collapsed && (React.createElement("span", { className: styles['link-text-wrapper'] },
|
|
234
|
+
React.createElement("span", { className: analyticsSelectors['link-text'] }, definition.text),
|
|
235
|
+
definition.external && (React.createElement("span", { "aria-label": renderedExternalIconAriaLabel, role: renderedExternalIconAriaLabel ? 'img' : undefined },
|
|
236
|
+
React.createElement(InternalIcon, { name: "external", className: styles['external-icon'] }))))),
|
|
237
|
+
collapsed && collapsedTooltip.tooltip),
|
|
238
|
+
!collapsed && definition.info && (React.createElement("span", { className: clsx(styles.info, testUtilStyles.info) }, definition.info))));
|
|
145
239
|
}
|
|
146
|
-
function Section({ definition, activeHref, fireFollow, fireChange, variant, position }) {
|
|
240
|
+
function Section({ definition, activeHref, fireFollow, fireChange, variant, position, collapsed }) {
|
|
147
241
|
var _a;
|
|
148
242
|
const [expanded, setExpanded] = useState((_a = definition.defaultExpanded) !== null && _a !== void 0 ? _a : true);
|
|
149
243
|
const isVisualRefresh = useVisualRefresh();
|
|
@@ -155,21 +249,34 @@ function Section({ definition, activeHref, fireFollow, fireChange, variant, posi
|
|
|
155
249
|
var _a;
|
|
156
250
|
setExpanded((_a = definition.defaultExpanded) !== null && _a !== void 0 ? _a : true);
|
|
157
251
|
}, [definition]);
|
|
158
|
-
|
|
252
|
+
if (collapsed) {
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
const isInSectionGroup = variant === 'section-group';
|
|
256
|
+
return (React.createElement(InternalExpandableSection, { variant: "footer", expanded: expanded, onChange: onExpandedChange, className: clsx(styles.section, isInSectionGroup && styles['section--no-ident'], isVisualRefresh && styles.refresh), headerText: definition.text },
|
|
159
257
|
React.createElement(NavigationItemsList, { variant: "section", items: definition.items, fireFollow: fireFollow, fireChange: fireChange, activeHref: activeHref, position: position })));
|
|
160
258
|
}
|
|
161
|
-
function SectionGroup({ definition, activeHref, fireFollow, fireChange, position }) {
|
|
259
|
+
function SectionGroup({ definition, activeHref, fireFollow, fireChange, position, collapsed }) {
|
|
260
|
+
if (collapsed) {
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
162
263
|
return (React.createElement("div", { className: styles['section-group'] },
|
|
163
264
|
React.createElement(InternalBox, { className: styles['section-group-title'], variant: "h3" }, definition.title),
|
|
164
265
|
React.createElement(NavigationItemsList, { variant: "section-group", items: definition.items, fireFollow: fireFollow, fireChange: fireChange, activeHref: activeHref, position: position })));
|
|
165
266
|
}
|
|
166
|
-
function LinkGroup({ definition, activeHref, fireFollow, fireChange, position }) {
|
|
267
|
+
function LinkGroup({ definition, activeHref, fireFollow, fireChange, position, collapsed }) {
|
|
167
268
|
checkSafeUrl('SideNavigation', definition.href);
|
|
168
269
|
return (React.createElement(React.Fragment, null,
|
|
169
|
-
React.createElement(Link, { definition: {
|
|
170
|
-
|
|
270
|
+
React.createElement(Link, { definition: {
|
|
271
|
+
type: 'link',
|
|
272
|
+
href: definition.href,
|
|
273
|
+
text: definition.text,
|
|
274
|
+
info: definition.info,
|
|
275
|
+
icon: definition.icon,
|
|
276
|
+
}, fireFollow: (_, event) => fireFollow(definition, event), fireChange: fireChange, activeHref: activeHref, position: position, collapsed: collapsed }),
|
|
277
|
+
!collapsed && (React.createElement(NavigationItemsList, { variant: "link-group", items: definition.items, fireFollow: fireFollow, fireChange: fireChange, activeHref: activeHref, position: position }))));
|
|
171
278
|
}
|
|
172
|
-
function ExpandableLinkGroup({ definition, fireFollow, fireChange, activeHref, variant, position, }) {
|
|
279
|
+
function ExpandableLinkGroup({ definition, fireFollow, fireChange, activeHref, variant, position, collapsed, }) {
|
|
173
280
|
// Check whether the definition contains an active link and memoize it to avoid
|
|
174
281
|
// rechecking every time.
|
|
175
282
|
const containsActiveLink = useMemo(() => {
|
|
@@ -203,7 +310,10 @@ function ExpandableLinkGroup({ definition, fireFollow, fireChange, activeHref, v
|
|
|
203
310
|
fireChange(definition, true);
|
|
204
311
|
}
|
|
205
312
|
};
|
|
206
|
-
|
|
313
|
+
if (collapsed) {
|
|
314
|
+
return (React.createElement(Link, { definition: { type: 'link', href: definition.href, text: definition.text, icon: definition.icon }, fireFollow: onHeaderFollow, fireChange: fireChange, activeHref: activeHref, position: position, collapsed: collapsed }));
|
|
315
|
+
}
|
|
316
|
+
return (React.createElement(InternalExpandableSection, { className: clsx(styles['expandable-link-group'], variant === 'section-group' && styles['expandable-link-group--no-ident'], definition.href === activeHref && styles['expandable-link-group--active']), variant: "navigation", expanded: userExpanded !== null && userExpanded !== void 0 ? userExpanded : expanded, onChange: onExpandedChange, headerText: React.createElement(Link, { definition: { type: 'link', href: definition.href, text: definition.text, icon: definition.icon }, fireFollow: onHeaderFollow, fireChange: fireChange, activeHref: activeHref, position: position }) },
|
|
207
317
|
React.createElement(NavigationItemsList, { variant: "expandable-link-group", items: definition.items, fireFollow: fireFollow, fireChange: fireChange, activeHref: activeHref, position: position })));
|
|
208
318
|
}
|
|
209
319
|
//# sourceMappingURL=parts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parts.js","sourceRoot":"","sources":["../../../src/side-navigation/parts.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAa,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,yBAAyB,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAA4B,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAGhE,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,OAAO,kBAAkB,MAAM,oCAAoC,CAAC;AACpE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAoB1D,MAAM,UAAU,MAAM,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAe;IACxE,YAAY,CAAC,gBAAgB,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,WAAW,CACzB,CAAC,KAAuB,EAAE,EAAE;QAC1B,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC,EACD,CAAC,UAAU,EAAE,UAAU,C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ode, useCallback, useEffect, useMemo, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalBox from '../box/internal';\nimport { ExpandableSectionProps } from '../expandable-section/interfaces';\nimport InternalExpandableSection from '../expandable-section/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport InternalIcon from '../icon/internal';\nimport { isPlainLeftClick, NonCancelableCustomEvent } from '../internal/events';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\nimport { GeneratedAnalyticsMetadataSideNavigationClick } from './analytics-metadata/interfaces';\nimport { SideNavigationProps } from './interfaces';\nimport { hasActiveLink } from './util';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\ninterface BaseItemComponentProps {\n activeHref?: string;\n fireChange: (item: SideNavigationProps.Section | SideNavigationProps.ExpandableLinkGroup, expanded: boolean) => void;\n fireFollow: (\n item:\n | SideNavigationProps.Link\n | SideNavigationProps.Header\n | SideNavigationProps.LinkGroup\n | SideNavigationProps.ExpandableLinkGroup,\n event: React.SyntheticEvent | Event\n ) => void;\n position?: string;\n}\n\ninterface HeaderProps extends BaseItemComponentProps {\n definition: SideNavigationProps.Header;\n}\n\nexport function Header({ definition, activeHref, fireFollow }: HeaderProps) {\n checkSafeUrl('SideNavigation', definition.href);\n const onClick = useCallback(\n (event: React.MouseEvent) => {\n if (isPlainLeftClick(event)) {\n fireFollow(definition, event);\n }\n },\n [fireFollow, definition]\n );\n\n const clickActionAnalyticsMetadata: GeneratedAnalyticsMetadataSideNavigationClick = {\n action: 'click',\n detail: {\n label: `.${analyticsSelectors['header-link-text']}`,\n external: 'false',\n href: definition.href,\n position: 'header',\n },\n };\n\n return (\n <>\n <h2 className={styles.header}>\n <a\n href={definition.href}\n className={clsx(styles['header-link'], { [styles['header-link--has-logo']]: !!definition.logo })}\n aria-current={definition.href === activeHref ? 'page' : undefined}\n onClick={onClick}\n {...getAnalyticsMetadataAttribute(clickActionAnalyticsMetadata)}\n >\n {definition.logo && (\n <img\n className={clsx(styles['header-logo'], {\n [styles['header-logo--stretched']]: !definition.text,\n })}\n {...definition.logo}\n />\n )}\n <span className={clsx(styles['header-link-text'], analyticsSelectors['header-link-text'])}>\n {definition.text}\n </span>\n </a>\n </h2>\n <Divider isPresentational={true} variant=\"header\" />\n </>\n );\n}\n\ninterface NavigationItemsListProps extends BaseItemComponentProps {\n items: ReadonlyArray<SideNavigationProps.Item>;\n variant: 'section' | 'section-group' | 'link-group' | 'expandable-link-group' | 'root';\n}\n\ninterface Item {\n element?: ReactNode;\n listVariant?: 'section' | 'section-group' | 'link-group' | 'expandable-link-group' | 'root';\n items?: Array<Item>;\n}\n\nexport function NavigationItemsList({\n items,\n variant,\n activeHref,\n fireChange,\n fireFollow,\n position = '',\n}: NavigationItemsListProps) {\n const lists: Array<Item> = [];\n let currentListIndex = 0;\n lists[currentListIndex] = {\n listVariant: variant,\n items: [],\n };\n\n items.forEach((item, index) => {\n const itemid = index + 1;\n const itemPosition = `${position ? `${position},` : ''}${itemid}`;\n switch (item.type) {\n case 'divider': {\n const dividerIndex = lists.length;\n lists[dividerIndex] = {\n element: (\n <div data-itemid={`item-${itemid}`}>\n <Divider variant=\"default\" />\n </div>\n ),\n };\n currentListIndex = lists.length;\n lists[currentListIndex] = {\n listVariant: variant,\n items: [],\n };\n return;\n }\n case 'link': {\n lists[currentListIndex].items?.push({\n element: (\n <li key={index} data-itemid={`item-${itemid}`} className={styles['list-item']}>\n <Link\n definition={item}\n activeHref={activeHref}\n fireChange={fireChange}\n fireFollow={fireFollow}\n position={itemPosition}\n />\n </li>\n ),\n });\n return;\n }\n case 'section': {\n lists[currentListIndex].items?.push({\n element: (\n <li key={index} data-itemid={`item-${itemid}`} className={styles['list-item']}>\n <Section\n definition={item}\n activeHref={activeHref}\n variant={variant}\n fireChange={fireChange}\n fireFollow={fireFollow}\n position={itemPosition}\n />\n </li>\n ),\n });\n return;\n }\n case 'section-group': {\n lists[currentListIndex].items?.push({\n element: (\n <li key={index} data-itemid={`item-${itemid}`} className={styles['list-item']}>\n <SectionGroup\n definition={item}\n activeHref={activeHref}\n fireChange={fireChange}\n fireFollow={fireFollow}\n position={itemPosition}\n />\n </li>\n ),\n });\n return;\n }\n case 'link-group': {\n lists[currentListIndex].items?.push({\n element: (\n <li key={index} data-itemid={`item-${itemid}`} className={styles['list-item']}>\n <LinkGroup\n definition={item}\n activeHref={activeHref}\n fireChange={fireChange}\n fireFollow={fireFollow}\n position={itemPosition}\n />\n </li>\n ),\n });\n return;\n }\n case 'expandable-link-group': {\n lists[currentListIndex].items?.push({\n element: (\n <li key={index} data-itemid={`item-${itemid}`} className={styles['list-item']}>\n <ExpandableLinkGroup\n definition={item}\n activeHref={activeHref}\n fireChange={fireChange}\n fireFollow={fireFollow}\n variant={variant}\n position={itemPosition}\n />\n </li>\n ),\n });\n return;\n }\n }\n });\n\n return (\n <>\n {lists.map((list, index) => {\n if (!list.items || list.items.length === 0) {\n return (\n <div\n key={`hr-${index}`}\n className={clsx(styles.list, styles[`list-variant-${variant}`], {\n [styles['list-variant-root--first']]: list.listVariant === 'root' && index === 0,\n })}\n >\n {list.element}\n </div>\n );\n } else {\n return (\n <ul\n key={`list-${index}`}\n className={clsx(styles.list, styles[`list-variant-${list.listVariant}`], {\n [styles['list-variant-root--first']]: list.listVariant === 'root' && index === 0,\n })}\n >\n {list.items.map(item => item.element)}\n </ul>\n );\n }\n })}\n </>\n );\n}\n\ninterface DividerProps {\n variant: 'default' | 'header';\n isPresentational?: boolean;\n}\n\nfunction Divider({ variant = 'default', isPresentational = false }: DividerProps) {\n return (\n <hr\n className={clsx(styles.divider, styles[`divider-${variant}`])}\n role={isPresentational ? 'presentation' : undefined}\n />\n );\n}\n\ninterface LinkProps extends BaseItemComponentProps {\n definition: SideNavigationProps.Link;\n}\n\nfunction Link({ definition, activeHref, fireFollow, position }: LinkProps) {\n checkSafeUrl('SideNavigation', definition.href);\n const isActive = definition.href === activeHref;\n const i18n = useInternalI18n('link');\n\n const onClick = useCallback(\n (event: React.MouseEvent) => {\n if (isPlainLeftClick(event)) {\n fireFollow(definition, event);\n }\n },\n [fireFollow, definition]\n );\n\n const clickActionAnalyticsMetadata: GeneratedAnalyticsMetadataSideNavigationClick = {\n action: 'click',\n detail: {\n label: `.${analyticsSelectors['link-text']}`,\n external: `${!!definition.external}`,\n href: definition.href,\n position,\n },\n };\n\n const renderedExternalIconAriaLabel = i18n('externalIconAriaLabel', definition.externalIconAriaLabel);\n\n return (\n <>\n <a\n href={definition.href}\n className={clsx(styles.link, { [styles['link-active']]: isActive })}\n target={definition.external ? '_blank' : undefined}\n rel={definition.external ? 'noopener noreferrer' : undefined}\n aria-current={definition.href === activeHref ? 'page' : undefined}\n onClick={onClick}\n {...getAnalyticsMetadataAttribute(clickActionAnalyticsMetadata)}\n >\n <span className={analyticsSelectors['link-text']}>{definition.text}</span>\n {definition.external && (\n <span aria-label={renderedExternalIconAriaLabel} role={renderedExternalIconAriaLabel ? 'img' : undefined}>\n <InternalIcon name=\"external\" className={styles['external-icon']} />\n </span>\n )}\n </a>\n {definition.info && <span className={clsx(styles.info, testUtilStyles.info)}>{definition.info}</span>}\n </>\n );\n}\n\ninterface SectionProps extends BaseItemComponentProps {\n definition: SideNavigationProps.Section;\n variant: 'section' | 'section-group' | 'link-group' | 'expandable-link-group' | 'root';\n}\n\nfunction Section({ definition, activeHref, fireFollow, fireChange, variant, position }: SectionProps) {\n const [expanded, setExpanded] = useState<boolean>(definition.defaultExpanded ?? true);\n const isVisualRefresh = useVisualRefresh();\n\n const onExpandedChange = useCallback(\n (e: NonCancelableCustomEvent<ExpandableSectionProps.ChangeDetail>) => {\n fireChange(definition, e.detail.expanded);\n setExpanded(e.detail.expanded);\n },\n [definition, fireChange]\n );\n\n useEffect(() => {\n setExpanded(definition.defaultExpanded ?? true);\n }, [definition]);\n\n return (\n <InternalExpandableSection\n variant=\"footer\"\n expanded={expanded}\n onChange={onExpandedChange}\n className={clsx(\n styles.section,\n variant === 'section-group' && styles['section--no-ident'],\n isVisualRefresh && styles.refresh\n )}\n headerText={definition.text}\n >\n <NavigationItemsList\n variant=\"section\"\n items={definition.items}\n fireFollow={fireFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n position={position}\n />\n </InternalExpandableSection>\n );\n}\n\ninterface SectionGroupProps extends BaseItemComponentProps {\n definition: SideNavigationProps.SectionGroup;\n}\n\nfunction SectionGroup({ definition, activeHref, fireFollow, fireChange, position }: SectionGroupProps) {\n return (\n <div className={styles['section-group']}>\n <InternalBox className={styles['section-group-title']} variant=\"h3\">\n {definition.title}\n </InternalBox>\n <NavigationItemsList\n variant=\"section-group\"\n items={definition.items}\n fireFollow={fireFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n position={position}\n />\n </div>\n );\n}\n\ninterface LinkGroupProps extends BaseItemComponentProps {\n definition: SideNavigationProps.LinkGroup;\n}\n\nfunction LinkGroup({ definition, activeHref, fireFollow, fireChange, position }: LinkGroupProps) {\n checkSafeUrl('SideNavigation', definition.href);\n\n return (\n <>\n <Link\n definition={{ type: 'link', href: definition.href, text: definition.text, info: definition.info }}\n fireFollow={(_, event) => fireFollow(definition, event)}\n fireChange={fireChange}\n activeHref={activeHref}\n position={position}\n />\n <NavigationItemsList\n variant=\"link-group\"\n items={definition.items}\n fireFollow={fireFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n position={position}\n />\n </>\n );\n}\n\ninterface ExpandableLinkGroupProps extends BaseItemComponentProps {\n definition: SideNavigationProps.ExpandableLinkGroup;\n variant: 'section' | 'section-group' | 'link-group' | 'expandable-link-group' | 'root';\n}\n\nfunction ExpandableLinkGroup({\n definition,\n fireFollow,\n fireChange,\n activeHref,\n variant,\n position,\n}: ExpandableLinkGroupProps) {\n // Check whether the definition contains an active link and memoize it to avoid\n // rechecking every time.\n const containsActiveLink = useMemo(() => {\n return activeHref ? hasActiveLink(definition.items, activeHref) : false;\n }, [activeHref, definition.items]);\n\n const [expanded, setExpanded] = useState<boolean>(() => {\n return definition.defaultExpanded ?? (definition.href === activeHref || containsActiveLink);\n });\n\n const [userExpanded, setUserExpanded] = useState<boolean | undefined>();\n\n // Reset user expansion status when the items property is updated.\n useEffect(() => setUserExpanded(undefined), [definition]);\n\n // By default, the expandable section is open when there's an active link inside.\n useEffect(() => {\n setExpanded(definition.href === activeHref || containsActiveLink);\n }, [definition.href, containsActiveLink, activeHref]);\n\n // If the definition object itself is updated, reset the expansion state to default.\n useEffect(() => {\n if (definition.defaultExpanded !== undefined) {\n setExpanded(definition.defaultExpanded);\n }\n }, [definition]);\n\n const onExpandedChange = useCallback(\n (e: NonCancelableCustomEvent<ExpandableSectionProps.ChangeDetail>) => {\n fireChange(definition, e.detail.expanded);\n setUserExpanded(e.detail.expanded);\n },\n [definition, fireChange]\n );\n\n const onHeaderFollow: LinkProps['fireFollow'] = (_, event) => {\n fireFollow(definition, event);\n setUserExpanded(true);\n if (!expanded) {\n fireChange(definition, true);\n }\n };\n\n return (\n <InternalExpandableSection\n className={clsx(\n styles['expandable-link-group'],\n variant === 'section-group' && styles['expandable-link-group--no-ident']\n )}\n variant=\"navigation\"\n expanded={userExpanded ?? expanded}\n onChange={onExpandedChange}\n headerText={\n <Link\n definition={{ type: 'link', href: definition.href, text: definition.text }}\n fireFollow={onHeaderFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n position={position}\n />\n }\n >\n <NavigationItemsList\n variant=\"expandable-link-group\"\n items={definition.items}\n fireFollow={fireFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n position={position}\n />\n </InternalExpandableSection>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"parts.js","sourceRoot":"","sources":["../../../src/side-navigation/parts.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAa,WAAW,EAAE,SAAS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mB,IAClB,OAAO,EAAC,uBAAuB,EAC/B,KAAK,EAAE,UAAU,CAAC,KAAK,EACvB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,GAClB,CACwB,CAC7B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalBox from '../box/internal';\nimport { ExpandableSectionProps } from '../expandable-section/interfaces';\nimport InternalExpandableSection from '../expandable-section/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport InternalIcon from '../icon/internal';\nimport { isPlainLeftClick, NonCancelableCustomEvent } from '../internal/events';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\nimport Tooltip from '../tooltip/internal';\nimport { GeneratedAnalyticsMetadataSideNavigationClick } from './analytics-metadata/interfaces';\nimport { SideNavigationProps } from './interfaces';\nimport { hasActiveLink } from './util';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\ninterface BaseItemComponentProps {\n activeHref?: string;\n fireChange: (item: SideNavigationProps.Section | SideNavigationProps.ExpandableLinkGroup, expanded: boolean) => void;\n fireFollow: (\n item:\n | SideNavigationProps.Link\n | SideNavigationProps.Header\n | SideNavigationProps.LinkGroup\n | SideNavigationProps.ExpandableLinkGroup,\n event: React.SyntheticEvent | Event\n ) => void;\n position?: string;\n collapsed?: boolean;\n}\n\ninterface HeaderProps extends BaseItemComponentProps {\n definition: SideNavigationProps.Header;\n}\n\nexport function Header({ definition, activeHref, fireFollow, collapsed }: HeaderProps) {\n checkSafeUrl('SideNavigation', definition.href);\n const onClick = useCallback(\n (event: React.MouseEvent) => {\n if (isPlainLeftClick(event)) {\n fireFollow(definition, event);\n }\n },\n [fireFollow, definition]\n );\n\n const clickActionAnalyticsMetadata: GeneratedAnalyticsMetadataSideNavigationClick = {\n action: 'click',\n detail: {\n label: `.${analyticsSelectors['header-link-text']}`,\n external: 'false',\n href: definition.href,\n position: 'header',\n },\n };\n\n return (\n <>\n <h2 className={clsx(styles.header, collapsed && styles['header--collapsed'])}>\n <a\n href={definition.href}\n className={clsx(styles['header-link'], { [styles['header-link--has-logo']]: !!definition.logo })}\n aria-current={definition.href === activeHref ? 'page' : undefined}\n aria-label={collapsed ? definition.text : undefined}\n onClick={onClick}\n {...getAnalyticsMetadataAttribute(clickActionAnalyticsMetadata)}\n >\n {definition.logo &&\n (definition.logo.svg ? (\n <span\n className={clsx(styles['header-logo'], {\n [styles['header-logo--stretched']]: !definition.text || collapsed,\n })}\n >\n {definition.logo.svg}\n </span>\n ) : (\n <img\n className={clsx(styles['header-logo'], {\n [styles['header-logo--stretched']]: !definition.text || collapsed,\n })}\n src={definition.logo.src}\n alt={definition.logo.alt}\n />\n ))}\n {!collapsed && (\n <span className={clsx(styles['header-link-text'], analyticsSelectors['header-link-text'])}>\n {definition.text}\n </span>\n )}\n </a>\n </h2>\n <Divider isPresentational={true} variant=\"header\" />\n </>\n );\n}\n\ninterface NavigationItemsListProps extends BaseItemComponentProps {\n items: ReadonlyArray<SideNavigationProps.Item>;\n variant: 'section' | 'section-group' | 'link-group' | 'expandable-link-group' | 'root';\n}\n\ninterface Item {\n element?: ReactNode;\n listVariant?: 'section' | 'section-group' | 'link-group' | 'expandable-link-group' | 'root';\n items?: Array<Item>;\n}\n\nexport function NavigationItemsList({\n items,\n variant,\n activeHref,\n fireChange,\n fireFollow,\n position = '',\n collapsed,\n}: NavigationItemsListProps) {\n const lists: Array<Item> = [];\n let currentListIndex = 0;\n lists[currentListIndex] = {\n listVariant: variant,\n items: [],\n };\n\n items.forEach((item, index) => {\n const itemid = index + 1;\n const itemPosition = `${position ? `${position},` : ''}${itemid}`;\n\n // Renders icon-bearing children of a container item as a collapsed group.\n // The inner <ul> carries the group label so list semantics are preserved\n // for screen readers even when the visual header is hidden.\n function pushCollapsedGroup(children: ReadonlyArray<SideNavigationProps.Item>, label: string) {\n const iconChildren = children.filter(child => (child as SideNavigationProps.Link).icon);\n if (iconChildren.length === 0) {\n return;\n }\n const groupElements = iconChildren.map((child, childIndex) => {\n const childPosition = `${position ? `${position},` : ''}${itemid},${childIndex + 1}`;\n return (\n <li key={childPosition} className={clsx(styles['list-item'], styles['list-item--collapsed'])}>\n <Link\n definition={child as SideNavigationProps.Link}\n activeHref={activeHref}\n fireFollow={fireFollow}\n fireChange={fireChange}\n position={childPosition}\n collapsed={collapsed}\n />\n </li>\n );\n });\n const prevItem = index > 0 ? items[index - 1] : null;\n const nextItem = index < items.length - 1 ? items[index + 1] : null;\n lists[currentListIndex].items?.push({\n element: (\n <li\n key={`group-${itemid}`}\n className={clsx(\n styles['list-item--group'],\n prevItem?.type === 'divider' && styles['list-item--group-no-padding-start'],\n nextItem?.type === 'divider' && styles['list-item--group-no-padding-end']\n )}\n >\n <ul className={styles['list--collapsed-group']} aria-label={label}>\n {groupElements}\n </ul>\n </li>\n ),\n });\n }\n\n // In collapsed mode, flatten container items to show only icon-bearing children.\n if (collapsed && (item.type === 'expandable-link-group' || item.type === 'link-group') && !item.icon) {\n const group = item as SideNavigationProps.ExpandableLinkGroup | SideNavigationProps.LinkGroup;\n pushCollapsedGroup(group.items, group.text);\n return;\n }\n if (collapsed && (item.type === 'section' || item.type === 'section-group')) {\n const sectionLabel =\n item.type === 'section'\n ? (item as SideNavigationProps.Section).text\n : (item as SideNavigationProps.SectionGroup).title;\n // Section-groups may contain nested sections — flatten one level.\n const childItems =\n item.type === 'section'\n ? (item as SideNavigationProps.Section).items\n : (item as SideNavigationProps.SectionGroup).items.flatMap(child =>\n child.type === 'section' ? (child as SideNavigationProps.Section).items : [child]\n );\n pushCollapsedGroup(childItems, sectionLabel);\n return;\n }\n if (collapsed && item.type !== 'divider' && !(item as SideNavigationProps.Link).icon) {\n return;\n }\n switch (item.type) {\n case 'divider': {\n const dividerIndex = lists.length;\n lists[dividerIndex] = {\n listVariant: variant,\n element: (\n <div data-itemid={`item-${itemid}`}>\n <Divider variant=\"default\" collapsed={collapsed} />\n </div>\n ),\n };\n currentListIndex = lists.length;\n lists[currentListIndex] = {\n listVariant: variant,\n items: [],\n };\n return;\n }\n case 'link': {\n lists[currentListIndex].items?.push({\n element: (\n <li\n key={index}\n data-itemid={`item-${itemid}`}\n className={clsx(\n styles['list-item'],\n collapsed && styles['list-item--collapsed'],\n item.info && styles['list-item--info']\n )}\n >\n <Link\n definition={item}\n activeHref={activeHref}\n fireChange={fireChange}\n fireFollow={fireFollow}\n position={itemPosition}\n collapsed={collapsed}\n />\n </li>\n ),\n });\n return;\n }\n case 'section': {\n lists[currentListIndex].items?.push({\n element: (\n <li\n key={index}\n data-itemid={`item-${itemid}`}\n className={clsx(styles['list-item'], collapsed && styles['list-item--collapsed'])}\n >\n <Section\n definition={item}\n activeHref={activeHref}\n variant={variant}\n fireChange={fireChange}\n fireFollow={fireFollow}\n position={itemPosition}\n collapsed={collapsed}\n />\n </li>\n ),\n });\n return;\n }\n case 'section-group': {\n lists[currentListIndex].items?.push({\n element: (\n <li\n key={index}\n data-itemid={`item-${itemid}`}\n className={clsx(styles['list-item'], collapsed && styles['list-item--collapsed'])}\n >\n <SectionGroup\n definition={item}\n activeHref={activeHref}\n fireChange={fireChange}\n fireFollow={fireFollow}\n position={itemPosition}\n collapsed={collapsed}\n />\n </li>\n ),\n });\n return;\n }\n case 'link-group': {\n lists[currentListIndex].items?.push({\n element: (\n <li\n key={index}\n data-itemid={`item-${itemid}`}\n className={clsx(\n styles['list-item'],\n collapsed && styles['list-item--collapsed'],\n item.info && styles['list-item--info']\n )}\n >\n <LinkGroup\n definition={item}\n activeHref={activeHref}\n fireChange={fireChange}\n fireFollow={fireFollow}\n position={itemPosition}\n collapsed={collapsed}\n />\n </li>\n ),\n });\n return;\n }\n case 'expandable-link-group': {\n lists[currentListIndex].items?.push({\n element: (\n <li\n key={index}\n data-itemid={`item-${itemid}`}\n className={clsx(styles['list-item'], collapsed && styles['list-item--collapsed'])}\n >\n <ExpandableLinkGroup\n definition={item}\n activeHref={activeHref}\n fireChange={fireChange}\n fireFollow={fireFollow}\n variant={variant}\n position={itemPosition}\n collapsed={collapsed}\n />\n </li>\n ),\n });\n return;\n }\n }\n });\n\n // In collapsed mode, skip empty item segments and deduplicate consecutive dividers.\n const filteredLists = collapsed\n ? lists.filter((list, index) => {\n if (list.items) {\n return list.items.length > 0;\n }\n // Divider — skip if preceded by another divider or empty segment, or followed by nothing.\n const prevVisible = lists\n .slice(0, index)\n .reverse()\n .find(l => !l.items || l.items.length > 0);\n const nextVisible = lists.slice(index + 1).find(l => !l.items || l.items.length > 0);\n return (\n (!prevVisible || (prevVisible.items !== undefined && prevVisible.items.length > 0)) &&\n nextVisible !== undefined &&\n (nextVisible.items === undefined || nextVisible.items.length > 0)\n );\n })\n : lists;\n\n return (\n <>\n {filteredLists.map((list, index) => {\n if (!list.items || list.items.length === 0) {\n return (\n <div\n key={`hr-${index}`}\n className={clsx(styles.list, styles[`list-variant-${variant}`], {\n [styles['list-variant-root--first']]: list.listVariant === 'root' && index === 0,\n [styles['list-variant-root--collapsed']]: list.listVariant === 'root' && collapsed,\n })}\n >\n {list.element}\n </div>\n );\n } else {\n return (\n <ul\n key={`list-${index}`}\n className={clsx(styles.list, styles[`list-variant-${list.listVariant}`], {\n [styles['list-variant-root--first']]: list.listVariant === 'root' && index === 0,\n [styles['list-variant-root--collapsed']]: list.listVariant === 'root' && collapsed,\n })}\n >\n {list.items.map(item => item.element)}\n </ul>\n );\n }\n })}\n </>\n );\n}\n\ninterface DividerProps {\n variant: 'default' | 'header';\n isPresentational?: boolean;\n collapsed?: boolean;\n}\n\nfunction Divider({ variant = 'default', isPresentational = false, collapsed }: DividerProps) {\n return (\n <hr\n className={clsx(styles.divider, styles[`divider-${variant}`], collapsed && styles['divider--collapsed'])}\n role={isPresentational ? 'presentation' : undefined}\n />\n );\n}\n\ninterface LinkProps extends BaseItemComponentProps {\n definition: SideNavigationProps.Link;\n}\n\ninterface ItemIconProps extends React.HTMLAttributes<HTMLSpanElement> {\n icon: React.ReactNode;\n collapsed?: boolean;\n}\n\nconst ItemIcon = React.forwardRef<HTMLSpanElement, ItemIconProps>(function ItemIcon(\n { icon, collapsed, className, ...rest },\n ref\n) {\n if (!icon) {\n return null;\n }\n return (\n <span\n ref={ref}\n className={clsx(\n styles['item-icon'],\n testUtilStyles['item-icon'],\n collapsed && styles['item-icon--collapsed'],\n className\n )}\n {...rest}\n >\n {icon}\n </span>\n );\n});\n\n// Manages a tooltip that shows the item's text label on focus or hover.\n// Used in the collapsed state, where the visible labels are hidden, to give\n// pointer and keyboard users a way to identify each item without relying on\n// their browser's native title popup.\nfunction useCollapsedTooltip<T extends HTMLElement>(label: React.ReactNode) {\n const [show, setShow] = useState(false);\n const triggerRef = useRef<T | null>(null);\n\n const triggerProps = {\n onFocus: () => setShow(true),\n onBlur: () => setShow(false),\n onMouseEnter: () => setShow(true),\n onMouseLeave: () => setShow(false),\n };\n\n const tooltip = show ? (\n <Tooltip getTrack={() => triggerRef.current} content={label} position=\"right\" onEscape={() => setShow(false)} />\n ) : null;\n\n return { triggerRef, triggerProps, tooltip };\n}\n\nfunction Link({ definition, activeHref, fireFollow, position, collapsed }: LinkProps) {\n checkSafeUrl('SideNavigation', definition.href);\n const isActive = definition.href === activeHref;\n const i18n = useInternalI18n('link');\n const collapsedTooltip = useCollapsedTooltip<HTMLAnchorElement>(definition.text);\n\n const onClick = useCallback(\n (event: React.MouseEvent) => {\n if (isPlainLeftClick(event)) {\n fireFollow(definition, event);\n }\n },\n [fireFollow, definition]\n );\n\n const clickActionAnalyticsMetadata: GeneratedAnalyticsMetadataSideNavigationClick = {\n action: 'click',\n detail: {\n label: `.${analyticsSelectors['link-text']}`,\n external: `${!!definition.external}`,\n href: definition.href,\n position,\n },\n };\n\n const renderedExternalIconAriaLabel = i18n('externalIconAriaLabel', definition.externalIconAriaLabel);\n\n return (\n <>\n <a\n ref={collapsed ? collapsedTooltip.triggerRef : undefined}\n href={definition.href}\n className={clsx(styles.link, {\n [styles['link-active']]: isActive,\n [styles['link--collapsed']]: collapsed,\n })}\n target={definition.external ? '_blank' : undefined}\n rel={definition.external ? 'noopener noreferrer' : undefined}\n aria-current={definition.href === activeHref ? 'page' : undefined}\n aria-label={collapsed ? definition.text : undefined}\n onClick={onClick}\n {...(collapsed ? collapsedTooltip.triggerProps : {})}\n {...getAnalyticsMetadataAttribute(clickActionAnalyticsMetadata)}\n >\n <ItemIcon icon={definition.icon} collapsed={collapsed} aria-hidden={collapsed ? true : undefined} />\n {!collapsed && (\n <span className={styles['link-text-wrapper']}>\n <span className={analyticsSelectors['link-text']}>{definition.text}</span>\n {definition.external && (\n <span aria-label={renderedExternalIconAriaLabel} role={renderedExternalIconAriaLabel ? 'img' : undefined}>\n <InternalIcon name=\"external\" className={styles['external-icon']} />\n </span>\n )}\n </span>\n )}\n {collapsed && collapsedTooltip.tooltip}\n </a>\n {!collapsed && definition.info && (\n <span className={clsx(styles.info, testUtilStyles.info)}>{definition.info}</span>\n )}\n </>\n );\n}\n\ninterface SectionProps extends BaseItemComponentProps {\n definition: SideNavigationProps.Section;\n variant: 'section' | 'section-group' | 'link-group' | 'expandable-link-group' | 'root';\n}\n\nfunction Section({ definition, activeHref, fireFollow, fireChange, variant, position, collapsed }: SectionProps) {\n const [expanded, setExpanded] = useState<boolean>(definition.defaultExpanded ?? true);\n const isVisualRefresh = useVisualRefresh();\n\n const onExpandedChange = useCallback(\n (e: NonCancelableCustomEvent<ExpandableSectionProps.ChangeDetail>) => {\n fireChange(definition, e.detail.expanded);\n setExpanded(e.detail.expanded);\n },\n [definition, fireChange]\n );\n\n useEffect(() => {\n setExpanded(definition.defaultExpanded ?? true);\n }, [definition]);\n\n if (collapsed) {\n return null;\n }\n\n const isInSectionGroup = variant === 'section-group';\n\n return (\n <InternalExpandableSection\n variant=\"footer\"\n expanded={expanded}\n onChange={onExpandedChange}\n className={clsx(\n styles.section,\n isInSectionGroup && styles['section--no-ident'],\n isVisualRefresh && styles.refresh\n )}\n headerText={definition.text}\n >\n <NavigationItemsList\n variant=\"section\"\n items={definition.items}\n fireFollow={fireFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n position={position}\n />\n </InternalExpandableSection>\n );\n}\n\ninterface SectionGroupProps extends BaseItemComponentProps {\n definition: SideNavigationProps.SectionGroup;\n}\n\nfunction SectionGroup({ definition, activeHref, fireFollow, fireChange, position, collapsed }: SectionGroupProps) {\n if (collapsed) {\n return null;\n }\n return (\n <div className={styles['section-group']}>\n <InternalBox className={styles['section-group-title']} variant=\"h3\">\n {definition.title}\n </InternalBox>\n <NavigationItemsList\n variant=\"section-group\"\n items={definition.items}\n fireFollow={fireFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n position={position}\n />\n </div>\n );\n}\n\ninterface LinkGroupProps extends BaseItemComponentProps {\n definition: SideNavigationProps.LinkGroup;\n}\n\nfunction LinkGroup({ definition, activeHref, fireFollow, fireChange, position, collapsed }: LinkGroupProps) {\n checkSafeUrl('SideNavigation', definition.href);\n\n return (\n <>\n <Link\n definition={{\n type: 'link',\n href: definition.href,\n text: definition.text,\n info: definition.info,\n icon: definition.icon,\n }}\n fireFollow={(_, event) => fireFollow(definition, event)}\n fireChange={fireChange}\n activeHref={activeHref}\n position={position}\n collapsed={collapsed}\n />\n {!collapsed && (\n <NavigationItemsList\n variant=\"link-group\"\n items={definition.items}\n fireFollow={fireFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n position={position}\n />\n )}\n </>\n );\n}\n\ninterface ExpandableLinkGroupProps extends BaseItemComponentProps {\n definition: SideNavigationProps.ExpandableLinkGroup;\n variant: 'section' | 'section-group' | 'link-group' | 'expandable-link-group' | 'root';\n}\n\nfunction ExpandableLinkGroup({\n definition,\n fireFollow,\n fireChange,\n activeHref,\n variant,\n position,\n collapsed,\n}: ExpandableLinkGroupProps) {\n // Check whether the definition contains an active link and memoize it to avoid\n // rechecking every time.\n const containsActiveLink = useMemo(() => {\n return activeHref ? hasActiveLink(definition.items, activeHref) : false;\n }, [activeHref, definition.items]);\n\n const [expanded, setExpanded] = useState<boolean>(() => {\n return definition.defaultExpanded ?? (definition.href === activeHref || containsActiveLink);\n });\n\n const [userExpanded, setUserExpanded] = useState<boolean | undefined>();\n\n // Reset user expansion status when the items property is updated.\n useEffect(() => setUserExpanded(undefined), [definition]);\n\n // By default, the expandable section is open when there's an active link inside.\n useEffect(() => {\n setExpanded(definition.href === activeHref || containsActiveLink);\n }, [definition.href, containsActiveLink, activeHref]);\n\n // If the definition object itself is updated, reset the expansion state to default.\n useEffect(() => {\n if (definition.defaultExpanded !== undefined) {\n setExpanded(definition.defaultExpanded);\n }\n }, [definition]);\n\n const onExpandedChange = useCallback(\n (e: NonCancelableCustomEvent<ExpandableSectionProps.ChangeDetail>) => {\n fireChange(definition, e.detail.expanded);\n setUserExpanded(e.detail.expanded);\n },\n [definition, fireChange]\n );\n\n const onHeaderFollow: LinkProps['fireFollow'] = (_, event) => {\n fireFollow(definition, event);\n setUserExpanded(true);\n if (!expanded) {\n fireChange(definition, true);\n }\n };\n\n if (collapsed) {\n return (\n <Link\n definition={{ type: 'link', href: definition.href, text: definition.text, icon: definition.icon }}\n fireFollow={onHeaderFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n position={position}\n collapsed={collapsed}\n />\n );\n }\n\n return (\n <InternalExpandableSection\n className={clsx(\n styles['expandable-link-group'],\n variant === 'section-group' && styles['expandable-link-group--no-ident'],\n definition.href === activeHref && styles['expandable-link-group--active']\n )}\n variant=\"navigation\"\n expanded={userExpanded ?? expanded}\n onChange={onExpandedChange}\n headerText={\n <Link\n definition={{ type: 'link', href: definition.href, text: definition.text, icon: definition.icon }}\n fireFollow={onHeaderFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n position={position}\n />\n }\n >\n <NavigationItemsList\n variant=\"expandable-link-group\"\n items={definition.items}\n fireFollow={fireFollow}\n fireChange={fireChange}\n activeHref={activeHref}\n position={position}\n />\n </InternalExpandableSection>\n );\n}\n"]}
|
|
@@ -1,35 +1,51 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"root": "
|
|
5
|
-
"
|
|
6
|
-
"header
|
|
7
|
-
"header
|
|
8
|
-
"header-link
|
|
9
|
-
"header-logo": "awsui_header-
|
|
10
|
-
"header-
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"list
|
|
17
|
-
"list-variant-root
|
|
18
|
-
"list-variant-
|
|
19
|
-
"list-
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"list-
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
4
|
+
"root": "awsui_root_l0dv0_ckbh1_146",
|
|
5
|
+
"with-toolbar": "awsui_with-toolbar_l0dv0_ckbh1_180",
|
|
6
|
+
"header": "awsui_header_l0dv0_ckbh1_184",
|
|
7
|
+
"header--collapsed": "awsui_header--collapsed_l0dv0_ckbh1_197",
|
|
8
|
+
"header-link": "awsui_header-link_l0dv0_ckbh1_204",
|
|
9
|
+
"header-link--has-logo": "awsui_header-link--has-logo_l0dv0_ckbh1_215",
|
|
10
|
+
"header-link-text": "awsui_header-link-text_l0dv0_ckbh1_215",
|
|
11
|
+
"header-logo": "awsui_header-logo_l0dv0_ckbh1_220",
|
|
12
|
+
"header-logo--stretched": "awsui_header-logo--stretched_l0dv0_ckbh1_226",
|
|
13
|
+
"items-control": "awsui_items-control_l0dv0_ckbh1_231",
|
|
14
|
+
"list-container": "awsui_list-container_l0dv0_ckbh1_236",
|
|
15
|
+
"divider-header": "awsui_divider-header_l0dv0_ckbh1_244",
|
|
16
|
+
"list": "awsui_list_l0dv0_ckbh1_236",
|
|
17
|
+
"list-variant-root": "awsui_list-variant-root_l0dv0_ckbh1_257",
|
|
18
|
+
"list-variant-root--first": "awsui_list-variant-root--first_l0dv0_ckbh1_264",
|
|
19
|
+
"list-variant-root--collapsed": "awsui_list-variant-root--collapsed_l0dv0_ckbh1_267",
|
|
20
|
+
"list-variant-expandable-link-group": "awsui_list-variant-expandable-link-group_l0dv0_ckbh1_272",
|
|
21
|
+
"list-variant-section": "awsui_list-variant-section_l0dv0_ckbh1_276",
|
|
22
|
+
"list-variant-link-group": "awsui_list-variant-link-group_l0dv0_ckbh1_280",
|
|
23
|
+
"list-variant-section-group": "awsui_list-variant-section-group_l0dv0_ckbh1_284",
|
|
24
|
+
"list-item": "awsui_list-item_l0dv0_ckbh1_291",
|
|
25
|
+
"list-item--collapsed": "awsui_list-item--collapsed_l0dv0_ckbh1_312",
|
|
26
|
+
"list-item--group": "awsui_list-item--group_l0dv0_ckbh1_330",
|
|
27
|
+
"list-item--group-no-padding-start": "awsui_list-item--group-no-padding-start_l0dv0_ckbh1_335",
|
|
28
|
+
"list-item--group-no-padding-end": "awsui_list-item--group-no-padding-end_l0dv0_ckbh1_338",
|
|
29
|
+
"list-item--info": "awsui_list-item--info_l0dv0_ckbh1_341",
|
|
30
|
+
"list--collapsed-group": "awsui_list--collapsed-group_l0dv0_ckbh1_350",
|
|
31
|
+
"section": "awsui_section_l0dv0_ckbh1_358",
|
|
32
|
+
"expandable-link-group": "awsui_expandable-link-group_l0dv0_ckbh1_359",
|
|
33
|
+
"section--no-ident": "awsui_section--no-ident_l0dv0_ckbh1_375",
|
|
34
|
+
"expandable-link-group--no-ident": "awsui_expandable-link-group--no-ident_l0dv0_ckbh1_376",
|
|
35
|
+
"expandable-link-group--active": "awsui_expandable-link-group--active_l0dv0_ckbh1_391",
|
|
36
|
+
"refresh": "awsui_refresh_l0dv0_ckbh1_398",
|
|
37
|
+
"section-group": "awsui_section-group_l0dv0_ckbh1_405",
|
|
38
|
+
"section-group-title": "awsui_section-group-title_l0dv0_ckbh1_420",
|
|
39
|
+
"link": "awsui_link_l0dv0_ckbh1_426",
|
|
40
|
+
"link-active": "awsui_link-active_l0dv0_ckbh1_455",
|
|
41
|
+
"link--collapsed": "awsui_link--collapsed_l0dv0_ckbh1_462",
|
|
42
|
+
"link-text-wrapper": "awsui_link-text-wrapper_l0dv0_ckbh1_499",
|
|
43
|
+
"info": "awsui_info_l0dv0_ckbh1_503",
|
|
44
|
+
"item-icon": "awsui_item-icon_l0dv0_ckbh1_508",
|
|
45
|
+
"item-icon--collapsed": "awsui_item-icon--collapsed_l0dv0_ckbh1_512",
|
|
46
|
+
"external-icon": "awsui_external-icon_l0dv0_ckbh1_516",
|
|
47
|
+
"divider": "awsui_divider_l0dv0_ckbh1_244",
|
|
48
|
+
"divider-default": "awsui_divider-default_l0dv0_ckbh1_524",
|
|
49
|
+
"divider--collapsed": "awsui_divider--collapsed_l0dv0_ckbh1_528"
|
|
34
50
|
};
|
|
35
51
|
|