@cloudscape-design/components 3.0.922 → 3.0.924
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/anchor-navigation/anchor-item/index.d.ts +12 -0
- package/anchor-navigation/anchor-item/index.d.ts.map +1 -0
- package/anchor-navigation/anchor-item/index.js +23 -0
- package/anchor-navigation/anchor-item/index.js.map +1 -0
- package/anchor-navigation/internal.d.ts.map +1 -1
- package/anchor-navigation/internal.js +5 -17
- package/anchor-navigation/internal.js.map +1 -1
- package/anchor-navigation/utils.d.ts +9 -0
- package/anchor-navigation/utils.d.ts.map +1 -0
- package/anchor-navigation/utils.js +50 -0
- package/anchor-navigation/utils.js.map +1 -0
- package/breadcrumb-group/item/item.d.ts.map +1 -1
- package/breadcrumb-group/item/item.js +11 -3
- package/breadcrumb-group/item/item.js.map +1 -1
- package/button-dropdown/category-elements/category-element.d.ts.map +1 -1
- package/button-dropdown/category-elements/category-element.js +2 -2
- package/button-dropdown/category-elements/category-element.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +3 -3
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/side-navigation/parts.d.ts.map +1 -1
- package/side-navigation/parts.js +2 -1
- package/side-navigation/parts.js.map +1 -1
- package/side-navigation/test-classes/styles.css.js +6 -0
- package/side-navigation/test-classes/styles.scoped.css +7 -0
- package/side-navigation/test-classes/styles.selectors.js +7 -0
- package/table/index.d.ts.map +1 -1
- package/table/index.js +5 -2
- package/table/index.js.map +1 -1
- package/table/interfaces.d.ts +6 -0
- package/table/interfaces.d.ts.map +1 -1
- package/table/interfaces.js.map +1 -1
- package/table/internal.d.ts.map +1 -1
- package/table/internal.js +5 -5
- package/table/internal.js.map +1 -1
- package/table/selection/selection-cell.d.ts.map +1 -1
- package/table/selection/selection-cell.js +1 -1
- package/table/selection/selection-cell.js.map +1 -1
- package/table/selection/selection-control.d.ts +2 -1
- package/table/selection/selection-control.d.ts.map +1 -1
- package/table/selection/selection-control.js +5 -5
- package/table/selection/selection-control.js.map +1 -1
- package/table/selection/styles.css.js +4 -3
- package/table/selection/styles.scoped.css +8 -3
- package/table/selection/styles.selectors.js +4 -3
- package/test-utils/dom/side-navigation/index.d.ts +1 -0
- package/test-utils/dom/side-navigation/index.js +4 -0
- package/test-utils/dom/side-navigation/index.js.map +1 -1
- package/test-utils/selectors/side-navigation/index.d.ts +1 -0
- package/test-utils/selectors/side-navigation/index.js +4 -0
- package/test-utils/selectors/side-navigation/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/wizard/styles.css.js +30 -30
- package/wizard/styles.scoped.css +58 -59
- package/wizard/styles.selectors.js +30 -30
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AnchorNavigationProps } from '../interfaces';
|
|
3
|
+
interface AnchorItemProps {
|
|
4
|
+
anchor: AnchorNavigationProps.Anchor;
|
|
5
|
+
onFollow: (anchor: AnchorNavigationProps.Anchor, event: React.SyntheticEvent | Event) => void;
|
|
6
|
+
isActive: boolean;
|
|
7
|
+
index: number;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const AnchorItem: ({ anchor, onFollow, isActive, index, children }: AnchorItemProps) => JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/anchor-navigation/anchor-item/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAK3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAKtD,UAAU,eAAe;IACvB,MAAM,EAAE,qBAAqB,CAAC,MAAM,CAAC;IACrC,QAAQ,EAAE,CAAC,MAAM,EAAE,qBAAqB,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,cAAc,GAAG,KAAK,KAAK,IAAI,CAAC;IAC9F,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,UAAU,oDAAqD,eAAe,gBAuC1F,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import React, { useCallback } from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { isPlainLeftClick } from '../../internal/events';
|
|
6
|
+
import { checkSafeUrl } from '../../internal/utils/check-safe-url';
|
|
7
|
+
import styles from '../styles.css.js';
|
|
8
|
+
import testUtilsStyles from '../test-classes/styles.css.js';
|
|
9
|
+
export const AnchorItem = ({ anchor, onFollow, isActive, index, children }) => {
|
|
10
|
+
checkSafeUrl('AnchorNavigation', anchor.href);
|
|
11
|
+
const onClick = useCallback((event) => {
|
|
12
|
+
if (isPlainLeftClick(event)) {
|
|
13
|
+
onFollow(anchor, event);
|
|
14
|
+
}
|
|
15
|
+
}, [onFollow, anchor]);
|
|
16
|
+
const activeItemClasses = clsx(styles['anchor-item--active'], testUtilsStyles['anchor-item--active']);
|
|
17
|
+
return (React.createElement("li", { "data-itemid": `anchor-item-${index + 1}`, className: clsx(styles['anchor-item'], isActive && activeItemClasses) },
|
|
18
|
+
React.createElement("a", Object.assign({ onClick: onClick, className: clsx(styles['anchor-link'], testUtilsStyles['anchor-link'], isActive && styles['anchor-link--active']) }, (isActive ? { 'aria-current': true } : {}), { href: anchor.href }),
|
|
19
|
+
React.createElement("span", { className: clsx(styles['anchor-link-text'], testUtilsStyles['anchor-link-text']), style: { paddingInlineStart: `${anchor.level * 16 + 2}px` } }, anchor.text),
|
|
20
|
+
anchor.info && (React.createElement("span", { className: clsx(styles['anchor-link-info'], testUtilsStyles['anchor-link-info']) }, anchor.info))),
|
|
21
|
+
children));
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/anchor-navigation/anchor-item/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAGnE,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,eAAe,MAAM,+BAA+B,CAAC;AAU5D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAmB,EAAE,EAAE;IAC7F,YAAY,CAAC,kBAAkB,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAE9C,MAAM,OAAO,GAAG,WAAW,CACzB,CAAC,KAAuB,EAAE,EAAE;QAC1B,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;YAC3B,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;SACzB;IACH,CAAC,EACD,CAAC,QAAQ,EAAE,MAAM,CAAC,CACnB,CAAC;IAEF,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE,eAAe,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAEtG,OAAO,CACL,2CAAiB,eAAe,KAAK,GAAG,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,QAAQ,IAAI,iBAAiB,CAAC;QAChH,yCACE,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,aAAa,CAAC,EACrB,eAAe,CAAC,aAAa,CAAC,EAC9B,QAAQ,IAAI,MAAM,CAAC,qBAAqB,CAAC,CAC1C,IACG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,IAC9C,IAAI,EAAE,MAAM,CAAC,IAAI;YAEjB,8BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC,EAChF,KAAK,EAAE,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAAC,KAAK,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,IAE1D,MAAM,CAAC,IAAI,CACP;YACN,MAAM,CAAC,IAAI,IAAI,CACd,8BAAM,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC,IAAG,MAAM,CAAC,IAAI,CAAQ,CAC7G,CACC;QACH,QAAQ,CACN,CACN,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback } from 'react';\nimport clsx from 'clsx';\n\nimport { isPlainLeftClick } from '../../internal/events';\nimport { checkSafeUrl } from '../../internal/utils/check-safe-url';\nimport { AnchorNavigationProps } from '../interfaces';\n\nimport styles from '../styles.css.js';\nimport testUtilsStyles from '../test-classes/styles.css.js';\n\ninterface AnchorItemProps {\n anchor: AnchorNavigationProps.Anchor;\n onFollow: (anchor: AnchorNavigationProps.Anchor, event: React.SyntheticEvent | Event) => void;\n isActive: boolean;\n index: number;\n children: React.ReactNode;\n}\n\nexport const AnchorItem = ({ anchor, onFollow, isActive, index, children }: AnchorItemProps) => {\n checkSafeUrl('AnchorNavigation', anchor.href);\n\n const onClick = useCallback(\n (event: React.MouseEvent) => {\n if (isPlainLeftClick(event)) {\n onFollow(anchor, event);\n }\n },\n [onFollow, anchor]\n );\n\n const activeItemClasses = clsx(styles['anchor-item--active'], testUtilsStyles['anchor-item--active']);\n\n return (\n <li data-itemid={`anchor-item-${index + 1}`} className={clsx(styles['anchor-item'], isActive && activeItemClasses)}>\n <a\n onClick={onClick}\n className={clsx(\n styles['anchor-link'],\n testUtilsStyles['anchor-link'],\n isActive && styles['anchor-link--active']\n )}\n {...(isActive ? { 'aria-current': true } : {})}\n href={anchor.href}\n >\n <span\n className={clsx(styles['anchor-link-text'], testUtilsStyles['anchor-link-text'])}\n style={{ paddingInlineStart: `${anchor.level * 16 + 2}px` }}\n >\n {anchor.text}\n </span>\n {anchor.info && (\n <span className={clsx(styles['anchor-link-info'], testUtilsStyles['anchor-link-info'])}>{anchor.info}</span>\n )}\n </a>\n {children}\n </li>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/anchor-navigation/internal.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/anchor-navigation/internal.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAOrD,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAC/C,OAAO,EACP,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,UAAe,EACf,iBAAwB,EACxB,eAAmB,EACnB,GAAG,KAAK,EACT,EAAE,qBAAqB,GAAG,0BAA0B,eAwCpD"}
|
|
@@ -4,9 +4,9 @@ import { __rest } from "tslib";
|
|
|
4
4
|
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { getBaseProps } from '../internal/base-component/index.js';
|
|
7
|
-
import { fireCancelableEvent, fireNonCancelableEvent
|
|
8
|
-
import { checkSafeUrl } from '../internal/utils/check-safe-url';
|
|
7
|
+
import { fireCancelableEvent, fireNonCancelableEvent } from '../internal/events/index';
|
|
9
8
|
import useScrollSpy from './use-scroll-spy.js';
|
|
9
|
+
import { renderNestedAnchors } from './utils';
|
|
10
10
|
import styles from './styles.css.js';
|
|
11
11
|
import testUtilsStyles from './test-classes/styles.css.js';
|
|
12
12
|
export default function InternalAnchorNavigation(_a) {
|
|
@@ -28,21 +28,9 @@ export default function InternalAnchorNavigation(_a) {
|
|
|
28
28
|
}
|
|
29
29
|
}, [onActiveHrefChange, anchors, currentActiveHref]);
|
|
30
30
|
return (React.createElement("nav", Object.assign({}, baseProps, { ref: __internalRootRef, "aria-labelledby": ariaLabelledby, className: clsx(baseProps.className, styles.root, testUtilsStyles.root) }),
|
|
31
|
-
React.createElement("ol", { className: clsx(styles['anchor-list'], testUtilsStyles['anchor-list']) }, anchors
|
|
32
|
-
|
|
31
|
+
React.createElement("ol", { className: clsx(styles['anchor-list'], testUtilsStyles['anchor-list']) }, renderNestedAnchors(anchors, {
|
|
32
|
+
onFollowHandler,
|
|
33
|
+
currentActiveHref,
|
|
33
34
|
}))));
|
|
34
35
|
}
|
|
35
|
-
const Anchor = ({ anchor, onFollow, isActive, index }) => {
|
|
36
|
-
checkSafeUrl('AnchorNavigation', anchor.href);
|
|
37
|
-
const onClick = useCallback((event) => {
|
|
38
|
-
if (isPlainLeftClick(event)) {
|
|
39
|
-
onFollow(anchor, event);
|
|
40
|
-
}
|
|
41
|
-
}, [onFollow, anchor]);
|
|
42
|
-
const activeItemClasses = clsx(styles['anchor-item--active'], testUtilsStyles['anchor-item--active']);
|
|
43
|
-
return (React.createElement("li", { "data-itemid": `anchor-item-${index + 1}`, className: clsx(styles['anchor-item'], isActive && activeItemClasses) },
|
|
44
|
-
React.createElement("a", Object.assign({ onClick: onClick, className: clsx(styles['anchor-link'], testUtilsStyles['anchor-link'], isActive && styles['anchor-link--active']) }, (isActive ? { 'aria-current': true } : {}), { href: anchor.href }),
|
|
45
|
-
React.createElement("span", { className: clsx(styles['anchor-link-text'], testUtilsStyles['anchor-link-text']), style: { paddingInlineStart: `${anchor.level * 16 + 2}px` } }, anchor.text),
|
|
46
|
-
anchor.info && (React.createElement("span", { className: clsx(styles['anchor-link-info'], testUtilsStyles['anchor-link-info']) }, anchor.info)))));
|
|
47
|
-
};
|
|
48
36
|
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/anchor-navigation/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/anchor-navigation/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGvF,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAE3D,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EASI;QATJ,EA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mBAAmB,CAAC,OAAO,EAAE;YAC5B,eAAe;YACf,iBAAiB;SAClB,CAAC,CACC,CACD,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useMemo } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component/index.js';\nimport { fireCancelableEvent, fireNonCancelableEvent } from '../internal/events/index';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { AnchorNavigationProps } from './interfaces';\nimport useScrollSpy from './use-scroll-spy.js';\nimport { renderNestedAnchors } from './utils';\n\nimport styles from './styles.css.js';\nimport testUtilsStyles from './test-classes/styles.css.js';\n\nexport default function InternalAnchorNavigation({\n anchors,\n ariaLabelledby,\n onFollow,\n onActiveHrefChange,\n activeHref = '',\n __internalRootRef = null,\n scrollSpyOffset = 0,\n ...props\n}: AnchorNavigationProps & InternalBaseComponentProps) {\n const baseProps = getBaseProps(props);\n\n const hrefs = useMemo(() => anchors.map(anchor => anchor.href), [anchors]);\n\n const onFollowHandler = useCallback(\n (anchor: AnchorNavigationProps.Anchor, sourceEvent: React.SyntheticEvent | Event) => {\n fireCancelableEvent(onFollow, anchor, sourceEvent);\n },\n [onFollow]\n );\n\n const currentActiveHref = useScrollSpy({\n hrefs,\n scrollSpyOffset,\n activeHref,\n });\n\n useEffect(() => {\n if (currentActiveHref) {\n const newActiveAnchor = anchors.find(anchor => anchor.href === currentActiveHref);\n fireNonCancelableEvent(onActiveHrefChange, newActiveAnchor);\n }\n }, [onActiveHrefChange, anchors, currentActiveHref]);\n\n return (\n <nav\n {...baseProps}\n ref={__internalRootRef}\n aria-labelledby={ariaLabelledby}\n className={clsx(baseProps.className, styles.root, testUtilsStyles.root)}\n >\n <ol className={clsx(styles['anchor-list'], testUtilsStyles['anchor-list'])}>\n {renderNestedAnchors(anchors, {\n onFollowHandler,\n currentActiveHref,\n })}\n </ol>\n </nav>\n );\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AnchorNavigationProps } from './interfaces';
|
|
3
|
+
interface RenderContext {
|
|
4
|
+
onFollowHandler: (anchor: AnchorNavigationProps.Anchor, sourceEvent: React.SyntheticEvent | Event) => void;
|
|
5
|
+
currentActiveHref: string | undefined;
|
|
6
|
+
}
|
|
7
|
+
export declare const renderNestedAnchors: (items: AnchorNavigationProps.Anchor[], context: RenderContext) => React.ReactNode;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/anchor-navigation/utils.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AA2BrD,UAAU,aAAa;IACrB,eAAe,EAAE,CAAC,MAAM,EAAE,qBAAqB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,cAAc,GAAG,KAAK,KAAK,IAAI,CAAC;IAC3G,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AAoDD,eAAO,MAAM,mBAAmB,UAAW,sBAAsB,MAAM,EAAE,WAAW,aAAa,KAAG,MAAM,SAYzG,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { AnchorItem } from './anchor-item';
|
|
6
|
+
import styles from './styles.css.js';
|
|
7
|
+
import testUtilsStyles from './test-classes/styles.css.js';
|
|
8
|
+
const collectChildItems = (items, currentIndex, currentLevel) => {
|
|
9
|
+
const childItems = [];
|
|
10
|
+
let nextIndex = currentIndex + 1;
|
|
11
|
+
while (nextIndex < items.length && items[nextIndex].level > currentLevel) {
|
|
12
|
+
childItems.push(items[nextIndex]);
|
|
13
|
+
nextIndex++;
|
|
14
|
+
}
|
|
15
|
+
return childItems;
|
|
16
|
+
};
|
|
17
|
+
const createAnchorItem = (currentItem, index, childItems, renderQueue, context) => {
|
|
18
|
+
const childList = [];
|
|
19
|
+
const hasChildren = childItems.length > 0;
|
|
20
|
+
const olClassNAme = clsx(styles['anchor-list'], testUtilsStyles['anchor-list']);
|
|
21
|
+
if (hasChildren) {
|
|
22
|
+
renderQueue.push({
|
|
23
|
+
items: childItems,
|
|
24
|
+
parentList: childList,
|
|
25
|
+
startIndex: index + 1,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return (React.createElement(AnchorItem, { onFollow: context.onFollowHandler, isActive: currentItem.href === context.currentActiveHref, key: index, index: index, anchor: currentItem }, hasChildren && React.createElement("ol", { className: olClassNAme }, childList)));
|
|
29
|
+
};
|
|
30
|
+
const processQueueItem = (items, startIndex, parentList, renderQueue, context) => {
|
|
31
|
+
let currentIndex = 0;
|
|
32
|
+
while (currentIndex < items.length) {
|
|
33
|
+
const currentItem = items[currentIndex];
|
|
34
|
+
const childItems = collectChildItems(items, currentIndex, currentItem.level);
|
|
35
|
+
parentList.push(createAnchorItem(currentItem, startIndex + currentIndex, childItems, renderQueue, context));
|
|
36
|
+
currentIndex += childItems.length + 1;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
// Perform a queue-based breadth-first traversal that groups child items under their parents based on level hierarchy.
|
|
40
|
+
export const renderNestedAnchors = (items, context) => {
|
|
41
|
+
const rootList = [];
|
|
42
|
+
const renderQueue = [];
|
|
43
|
+
renderQueue.push({ items, parentList: rootList, startIndex: 0 });
|
|
44
|
+
while (renderQueue.length > 0) {
|
|
45
|
+
const currentItem = renderQueue.shift();
|
|
46
|
+
processQueueItem(currentItem.items, currentItem.startIndex, currentItem.parentList, renderQueue, context);
|
|
47
|
+
}
|
|
48
|
+
return rootList;
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/anchor-navigation/utils.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAQ3D,MAAM,iBAAiB,GAAG,CACxB,KAAqC,EACrC,YAAoB,EACpB,YAAoB,EACY,EAAE;IAClC,MAAM,UAAU,GAAmC,EAAE,CAAC;IACtD,IAAI,SAAS,GAAG,YAAY,GAAG,CAAC,CAAC;IAEjC,OAAO,SAAS,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK,GAAG,YAAY,EAAE;QACxE,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAClC,SAAS,EAAE,CAAC;KACb;IAED,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAOF,MAAM,gBAAgB,GAAG,CACvB,WAAyC,EACzC,KAAa,EACb,UAA0C,EAC1C,WAAoC,EACpC,OAAsB,EACtB,EAAE;IACF,MAAM,SAAS,GAAsB,EAAE,CAAC;IACxC,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1C,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC;IAEhF,IAAI,WAAW,EAAE;QACf,WAAW,CAAC,IAAI,CAAC;YACf,KAAK,EAAE,UAAU;YACjB,UAAU,EAAE,SAAS;YACrB,UAAU,E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W,GAAG,WAAW,CAAC,KAAK,EAAG,CAAC;QACzC,gBAAgB,CAAC,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC,UAAU,EAAE,WAAW,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;KAC3G;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { AnchorItem } from './anchor-item';\nimport { AnchorNavigationProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testUtilsStyles from './test-classes/styles.css.js';\n\ninterface AnchorRenderQueueItem {\n items: AnchorNavigationProps.Anchor[];\n parentList: React.ReactNode[];\n startIndex: number;\n}\n\nconst collectChildItems = (\n items: AnchorNavigationProps.Anchor[],\n currentIndex: number,\n currentLevel: number\n): AnchorNavigationProps.Anchor[] => {\n const childItems: AnchorNavigationProps.Anchor[] = [];\n let nextIndex = currentIndex + 1;\n\n while (nextIndex < items.length && items[nextIndex].level > currentLevel) {\n childItems.push(items[nextIndex]);\n nextIndex++;\n }\n\n return childItems;\n};\n\ninterface RenderContext {\n onFollowHandler: (anchor: AnchorNavigationProps.Anchor, sourceEvent: React.SyntheticEvent | Event) => void;\n currentActiveHref: string | undefined;\n}\n\nconst createAnchorItem = (\n currentItem: AnchorNavigationProps.Anchor,\n index: number,\n childItems: AnchorNavigationProps.Anchor[],\n renderQueue: AnchorRenderQueueItem[],\n context: RenderContext\n) => {\n const childList: React.ReactNode[] = [];\n const hasChildren = childItems.length > 0;\n const olClassNAme = clsx(styles['anchor-list'], testUtilsStyles['anchor-list']);\n\n if (hasChildren) {\n renderQueue.push({\n items: childItems,\n parentList: childList,\n startIndex: index + 1,\n });\n }\n\n return (\n <AnchorItem\n onFollow={context.onFollowHandler}\n isActive={currentItem.href === context.currentActiveHref}\n key={index}\n index={index}\n anchor={currentItem}\n >\n {hasChildren && <ol className={olClassNAme}>{childList}</ol>}\n </AnchorItem>\n );\n};\n\nconst processQueueItem = (\n items: AnchorNavigationProps.Anchor[],\n startIndex: number,\n parentList: React.ReactNode[],\n renderQueue: AnchorRenderQueueItem[],\n context: RenderContext\n) => {\n let currentIndex = 0;\n while (currentIndex < items.length) {\n const currentItem = items[currentIndex];\n const childItems = collectChildItems(items, currentIndex, currentItem.level);\n\n parentList.push(createAnchorItem(currentItem, startIndex + currentIndex, childItems, renderQueue, context));\n currentIndex += childItems.length + 1;\n }\n};\n\n// Perform a queue-based breadth-first traversal that groups child items under their parents based on level hierarchy.\nexport const renderNestedAnchors = (items: AnchorNavigationProps.Anchor[], context: RenderContext): React.ReactNode => {\n const rootList: React.ReactNode[] = [];\n const renderQueue: AnchorRenderQueueItem[] = [];\n\n renderQueue.push({ items, parentList: rootList, startIndex: 0 });\n\n while (renderQueue.length > 0) {\n const currentItem = renderQueue.shift()!;\n processQueueItem(currentItem.items, currentItem.startIndex, currentItem.parentList, renderQueue, context);\n }\n\n return rootList;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../../src/breadcrumb-group/item/item.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../../src/breadcrumb-group/item/item.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AA4E1E,wBAAgB,cAAc,CAAC,CAAC,SAAS,oBAAoB,CAAC,IAAI,EAAE,EAClE,IAAI,EACJ,SAAS,EACT,UAAU,EACV,OAAO,EACP,QAAQ,EACR,OAAe,EACf,WAAmB,GACpB,EAAE,mBAAmB,CAAC,CAAC,CAAC,eA6DxB"}
|
|
@@ -10,7 +10,7 @@ import { fireCancelableEvent, isPlainLeftClick } from '../../internal/events';
|
|
|
10
10
|
import { getEventDetail } from '../utils';
|
|
11
11
|
import { FunnelBreadcrumbItem } from './funnel';
|
|
12
12
|
import styles from './styles.css.js';
|
|
13
|
-
const BreadcrumbItemWithPopover = ({ item, isLast, anchorAttributes, children, }) => {
|
|
13
|
+
const BreadcrumbItemWithPopover = ({ item, isLast, anchorAttributes, itemAttributes, children, }) => {
|
|
14
14
|
const [showPopover, setShowPopover] = useState(false);
|
|
15
15
|
const textRef = useRef(null);
|
|
16
16
|
const popoverContent = (React.createElement(Tooltip, { trackRef: textRef, value: item.text, size: "medium", onDismiss: () => setShowPopover(false) }));
|
|
@@ -26,7 +26,7 @@ const BreadcrumbItemWithPopover = ({ item, isLast, anchorAttributes, children, }
|
|
|
26
26
|
setShowPopover(true);
|
|
27
27
|
}, onBlur: () => setShowPopover(false), onMouseEnter: () => {
|
|
28
28
|
setShowPopover(true);
|
|
29
|
-
}, onMouseLeave: () => setShowPopover(false), anchorAttributes: anchorAttributes },
|
|
29
|
+
}, onMouseLeave: () => setShowPopover(false), anchorAttributes: anchorAttributes }, itemAttributes), children),
|
|
30
30
|
showPopover && popoverContent));
|
|
31
31
|
};
|
|
32
32
|
const Item = React.forwardRef((_a, ref) => {
|
|
@@ -45,13 +45,21 @@ export function BreadcrumbItem({ item, itemIndex, totalCount, onClick, onFollow,
|
|
|
45
45
|
const anchorAttributes = {
|
|
46
46
|
href: item.href || '#',
|
|
47
47
|
onClick: isLast ? preventDefault : onClickHandler,
|
|
48
|
+
tabIndex: 0,
|
|
48
49
|
};
|
|
50
|
+
const itemAttributes = {};
|
|
49
51
|
if (isGhost) {
|
|
50
52
|
anchorAttributes.tabIndex = -1;
|
|
51
53
|
}
|
|
54
|
+
if (isLast && !isGhost) {
|
|
55
|
+
itemAttributes['aria-current'] = 'page';
|
|
56
|
+
itemAttributes['aria-disabled'] = true;
|
|
57
|
+
itemAttributes.tabIndex = 0;
|
|
58
|
+
itemAttributes.role = 'link';
|
|
59
|
+
}
|
|
52
60
|
const breadcrumbItem = (React.createElement(FunnelBreadcrumbItem, { className: styles.text, itemIndex: itemIndex, totalCount: totalCount, text: item.text, disableAnalytics: isGhost }));
|
|
53
61
|
return (React.createElement("div", { className: clsx(!isGhost && styles.breadcrumb, isGhost && styles['ghost-breadcrumb'], isLast && styles.last) },
|
|
54
|
-
isTruncated && !isGhost ? (React.createElement(BreadcrumbItemWithPopover, { item: item, isLast: isLast, anchorAttributes: anchorAttributes }, breadcrumbItem)) : (React.createElement(Item, { isLast: isLast, anchorAttributes: anchorAttributes }, breadcrumbItem)),
|
|
62
|
+
isTruncated && !isGhost ? (React.createElement(BreadcrumbItemWithPopover, { item: item, isLast: isLast, anchorAttributes: anchorAttributes, itemAttributes: itemAttributes }, breadcrumbItem)) : (React.createElement(Item, Object.assign({ isLast: isLast, anchorAttributes: anchorAttributes }, itemAttributes), breadcrumbItem)),
|
|
55
63
|
!isLast ? (React.createElement("span", { className: styles.icon },
|
|
56
64
|
React.createElement(InternalIcon, { name: "angle-right" }))) : null));
|
|
57
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.js","sourceRoot":"","sources":["../../../../src/breadcrumb-group/item/item.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,OAAO,MAAM,mCAAmC,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9E,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,M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AAI,CAAC;QAC9G,WAAW,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CACzB,oBAAC,yBAAyB,IACxB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,cAAc,IAE7B,cAAc,CACW,CAC7B,CAAC,CAAC,CAAC,CACF,oBAAC,IAAI,kBAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,IAAM,cAAc,GACzE,cAAc,CACV,CACR;QACA,CAAC,MAAM,CAAC,CAAC,CAAC,CACT,8BAAM,SAAS,EAAE,MAAM,CAAC,IAAI;YAC1B,oBAAC,YAAY,IAAC,IAAI,EAAC,aAAa,GAAG,CAC9B,CACR,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport InternalIcon from '../../icon/internal';\nimport Tooltip from '../../internal/components/tooltip';\nimport { registerTooltip } from '../../internal/components/tooltip/registry';\nimport { fireCancelableEvent, isPlainLeftClick } from '../../internal/events';\nimport { BreadcrumbGroupProps, BreadcrumbItemProps } from '../interfaces';\nimport { getEventDetail } from '../utils';\nimport { FunnelBreadcrumbItem } from './funnel';\n\nimport styles from './styles.css.js';\n\ninterface BreadcrumbItemWithPopoverProps<T extends BreadcrumbGroupProps.Item> {\n item: T;\n isLast: boolean;\n anchorAttributes: React.AnchorHTMLAttributes<HTMLAnchorElement>;\n children: React.ReactNode;\n itemAttributes: React.HTMLAttributes<HTMLElement>;\n}\n\nconst BreadcrumbItemWithPopover = <T extends BreadcrumbGroupProps.Item>({\n item,\n isLast,\n anchorAttributes,\n itemAttributes,\n children,\n}: BreadcrumbItemWithPopoverProps<T>) => {\n const [showPopover, setShowPopover] = useState(false);\n const textRef = useRef<HTMLElement>(null);\n const popoverContent = (\n <Tooltip trackRef={textRef} value={item.text} size=\"medium\" onDismiss={() => setShowPopover(false)} />\n );\n\n useEffect(() => {\n if (showPopover) {\n return registerTooltip(() => {\n setShowPopover(false);\n });\n }\n }, [showPopover]);\n\n return (\n <>\n <Item\n ref={textRef}\n isLast={isLast}\n onFocus={() => {\n setShowPopover(true);\n }}\n onBlur={() => setShowPopover(false)}\n onMouseEnter={() => {\n setShowPopover(true);\n }}\n onMouseLeave={() => setShowPopover(false)}\n anchorAttributes={anchorAttributes}\n {...itemAttributes}\n >\n {children}\n </Item>\n {showPopover && popoverContent}\n </>\n );\n};\n\ntype ItemProps = React.HTMLAttributes<HTMLElement> & {\n anchorAttributes: React.AnchorHTMLAttributes<HTMLAnchorElement>;\n isLast: boolean;\n};\nconst Item = React.forwardRef<HTMLElement, ItemProps>(\n ({ anchorAttributes, children, isLast, ...itemAttributes }, ref) => {\n return isLast ? (\n <span ref={ref} className={styles.anchor} {...itemAttributes}>\n {children}\n </span>\n ) : (\n <a ref={ref as React.Ref<HTMLAnchorElement>} className={styles.anchor} {...itemAttributes} {...anchorAttributes}>\n {children}\n </a>\n );\n }\n);\n\nexport function BreadcrumbItem<T extends BreadcrumbGroupProps.Item>({\n item,\n itemIndex,\n totalCount,\n onClick,\n onFollow,\n isGhost = false,\n isTruncated = false,\n}: BreadcrumbItemProps<T>) {\n const isLast = itemIndex === totalCount - 1;\n const preventDefault = (event: React.MouseEvent) => event.preventDefault();\n const onClickHandler = (event: React.MouseEvent) => {\n if (isPlainLeftClick(event)) {\n fireCancelableEvent(onFollow, getEventDetail(item), event);\n }\n fireCancelableEvent(onClick, getEventDetail(item), event);\n };\n\n const anchorAttributes: React.AnchorHTMLAttributes<HTMLAnchorElement> = {\n href: item.href || '#',\n onClick: isLast ? preventDefault : onClickHandler,\n tabIndex: 0,\n };\n\n const itemAttributes: React.AnchorHTMLAttributes<HTMLAnchorElement> = {};\n if (isGhost) {\n anchorAttributes.tabIndex = -1;\n }\n\n if (isLast && !isGhost) {\n itemAttributes['aria-current'] = 'page';\n itemAttributes['aria-disabled'] = true;\n itemAttributes.tabIndex = 0;\n itemAttributes.role = 'link';\n }\n\n const breadcrumbItem = (\n <FunnelBreadcrumbItem\n className={styles.text}\n itemIndex={itemIndex}\n totalCount={totalCount}\n text={item.text}\n disableAnalytics={isGhost}\n />\n );\n\n return (\n <div className={clsx(!isGhost && styles.breadcrumb, isGhost && styles['ghost-breadcrumb'], isLast && styles.last)}>\n {isTruncated && !isGhost ? (\n <BreadcrumbItemWithPopover\n item={item}\n isLast={isLast}\n anchorAttributes={anchorAttributes}\n itemAttributes={itemAttributes}\n >\n {breadcrumbItem}\n </BreadcrumbItemWithPopover>\n ) : (\n <Item isLast={isLast} anchorAttributes={anchorAttributes} {...itemAttributes}>\n {breadcrumbItem}\n </Item>\n )}\n {!isLast ? (\n <span className={styles.icon}>\n <InternalIcon name=\"angle-right\" />\n </span>\n ) : null}\n </div>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"category-element.d.ts","sourceRoot":"","sources":["../../../../src/button-dropdown/category-elements/category-element.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAK9C,QAAA,MAAM,eAAe,qKAalB,aAAa,
|
|
1
|
+
{"version":3,"file":"category-element.d.ts","sourceRoot":"","sources":["../../../../src/button-dropdown/category-elements/category-element.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAK9C,QAAA,MAAM,eAAe,qKAalB,aAAa,gBAkCf,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -7,9 +7,9 @@ import styles from './styles.css.js';
|
|
|
7
7
|
const CategoryElement = ({ item, onItemActivate, onGroupToggle, targetItem, isHighlighted, isKeyboardHighlight, isExpanded, lastInDropdown, highlightItem, disabled, variant, position, }) => {
|
|
8
8
|
// Hide the category title element from screen readers because it will be
|
|
9
9
|
// provided as an ARIA label.
|
|
10
|
-
return (React.createElement("li", { className: clsx(styles.category, styles[`variant-${variant}`], disabled && styles.disabled), role: "presentation"
|
|
10
|
+
return (React.createElement("li", { className: clsx(styles.category, styles[`variant-${variant}`], disabled && styles.disabled), role: "presentation" },
|
|
11
11
|
item.text && (React.createElement("p", { className: clsx(styles.header, { [styles.disabled]: disabled }), "aria-hidden": "true" }, item.text)),
|
|
12
|
-
React.createElement("ul", { className: styles['items-list-container'], role: "group", "aria-label": item.text }, item.items && (React.createElement(ItemsList, { items: item.items, onItemActivate: onItemActivate, onGroupToggle: onGroupToggle, targetItem: targetItem, isHighlighted: isHighlighted, isKeyboardHighlight: isKeyboardHighlight, isExpanded: isExpanded, lastInDropdown: lastInDropdown, highlightItem: highlightItem, categoryDisabled: disabled, hasCategoryHeader: !!item.text, variant: variant, position: position })))));
|
|
12
|
+
React.createElement("ul", { className: styles['items-list-container'], role: "group", "aria-label": item.text, "aria-disabled": disabled }, item.items && (React.createElement(ItemsList, { items: item.items, onItemActivate: onItemActivate, onGroupToggle: onGroupToggle, targetItem: targetItem, isHighlighted: isHighlighted, isKeyboardHighlight: isKeyboardHighlight, isExpanded: isExpanded, lastInDropdown: lastInDropdown, highlightItem: highlightItem, categoryDisabled: disabled, hasCategoryHeader: !!item.text, variant: variant, position: position })))));
|
|
13
13
|
};
|
|
14
14
|
export default CategoryElement;
|
|
15
15
|
//# sourceMappingURL=category-element.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"category-element.js","sourceRoot":"","sources":["../../../../src/button-dropdown/category-elements/category-element.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,SAAS,MAAM,eAAe,CAAC;AAEtC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,eAAe,GAAG,CAAC,EACvB,IAAI,EACJ,cAAc,EACd,aAAa,EACb,UAAU,EACV,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,aAAa,EACb,QAAQ,EACR,OAAO,EACP,QAAQ,GACM,EAAE,EAAE;IAClB,yEAAyE;IACzE,6BAA6B;IAC7B,OAAO,CACL,4BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,WAAW,OAAO,EAAE,CAAC,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,EAC3F,IAAI,EAAC,cAAc
|
|
1
|
+
{"version":3,"file":"category-element.js","sourceRoot":"","sources":["../../../../src/button-dropdown/category-elements/category-element.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,SAAS,MAAM,eAAe,CAAC;AAEtC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,eAAe,GAAG,CAAC,EACvB,IAAI,EACJ,cAAc,EACd,aAAa,EACb,UAAU,EACV,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,aAAa,EACb,QAAQ,EACR,OAAO,EACP,QAAQ,GACM,EAAE,EAAE;IAClB,yEAAyE;IACzE,6BAA6B;IAC7B,OAAO,CACL,4BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,WAAW,OAAO,EAAE,CAAC,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,EAC3F,IAAI,EAAC,cAAc;QAElB,IAAI,CAAC,IAAI,IAAI,CACZ,2BAAG,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC,iBAAc,MAAM,IACnF,IAAI,CAAC,IAAI,CACR,CACL;QACD,4BAAI,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC,EAAE,IAAI,EAAC,OAAO,gBAAa,IAAI,CAAC,IAAI,mBAAiB,QAAQ,IACvG,IAAI,CAAC,KAAK,IAAI,CACb,oBAAC,SAAS,IACR,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,EAC5B,mBAAmB,EAAE,mBAAmB,EACxC,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,QAAQ,EAC1B,iBAAiB,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAC9B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,GAClB,CACH,CACE,CACF,CACN,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { CategoryProps } from '../interfaces';\nimport ItemsList from '../items-list';\n\nimport styles from './styles.css.js';\n\nconst CategoryElement = ({\n item,\n onItemActivate,\n onGroupToggle,\n targetItem,\n isHighlighted,\n isKeyboardHighlight,\n isExpanded,\n lastInDropdown,\n highlightItem,\n disabled,\n variant,\n position,\n}: CategoryProps) => {\n // Hide the category title element from screen readers because it will be\n // provided as an ARIA label.\n return (\n <li\n className={clsx(styles.category, styles[`variant-${variant}`], disabled && styles.disabled)}\n role=\"presentation\"\n >\n {item.text && (\n <p className={clsx(styles.header, { [styles.disabled]: disabled })} aria-hidden=\"true\">\n {item.text}\n </p>\n )}\n <ul className={styles['items-list-container']} role=\"group\" aria-label={item.text} aria-disabled={disabled}>\n {item.items && (\n <ItemsList\n items={item.items}\n onItemActivate={onItemActivate}\n onGroupToggle={onGroupToggle}\n targetItem={targetItem}\n isHighlighted={isHighlighted}\n isKeyboardHighlight={isKeyboardHighlight}\n isExpanded={isExpanded}\n lastInDropdown={lastInDropdown}\n highlightItem={highlightItem}\n categoryDisabled={disabled}\n hasCategoryHeader={!!item.text}\n variant={variant}\n position={position}\n />\n )}\n </ul>\n </li>\n );\n};\n\nexport default CategoryElement;\n"]}
|
package/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parts.d.ts","sourceRoot":"","sources":["../../../src/side-navigation/parts.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA+D,MAAM,OAAO,CAAC;AAapF,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"parts.d.ts","sourceRoot":"","sources":["../../../src/side-navigation/parts.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA+D,MAAM,OAAO,CAAC;AAapF,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAOnD,UAAU,sBAAsB;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,OAAO,GAAG,mBAAmB,CAAC,mBAAmB,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACrH,UAAU,EAAE,CACV,IAAI,EACA,mBAAmB,CAAC,IAAI,GACxB,mBAAmB,CAAC,MAAM,GAC1B,mBAAmB,CAAC,SAAS,GAC7B,mBAAmB,CAAC,mBAAmB,EAC3C,KAAK,EAAE,KAAK,CAAC,cAAc,GAAG,KAAK,KAChC,IAAI,CAAC;IACV,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,WAAY,SAAQ,sBAAsB;IAClD,UAAU,EAAE,mBAAmB,CAAC,MAAM,CAAC;CACxC;AAED,wBAAgB,MAAM,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,WAAW,eA+CzE;AAED,UAAU,wBAAyB,SAAQ,sBAAsB;IAC/D,KAAK,EAAE,aAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC/C,OAAO,EAAE,SAAS,GAAG,eAAe,GAAG,YAAY,GAAG,uBAAuB,GAAG,MAAM,CAAC;CACxF;AAQD,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,OAAO,EACP,UAAU,EACV,UAAU,EACV,UAAU,EACV,QAAa,GACd,EAAE,wBAAwB,eA8I1B"}
|
package/side-navigation/parts.js
CHANGED
|
@@ -12,6 +12,7 @@ import { checkSafeUrl } from '../internal/utils/check-safe-url';
|
|
|
12
12
|
import { hasActiveLink } from './util';
|
|
13
13
|
import analyticsSelectors from './analytics-metadata/styles.css.js';
|
|
14
14
|
import styles from './styles.css.js';
|
|
15
|
+
import testUtilStyles from './test-classes/styles.css.js';
|
|
15
16
|
export function Header({ definition, activeHref, fireFollow }) {
|
|
16
17
|
checkSafeUrl('SideNavigation', definition.href);
|
|
17
18
|
const onClick = useCallback((event) => {
|
|
@@ -137,7 +138,7 @@ function Link({ definition, expanded, activeHref, fireFollow, position }) {
|
|
|
137
138
|
React.createElement("span", { className: analyticsSelectors['link-text'] }, definition.text),
|
|
138
139
|
definition.external && (React.createElement("span", { "aria-label": definition.externalIconAriaLabel, role: definition.externalIconAriaLabel ? 'img' : undefined },
|
|
139
140
|
React.createElement(InternalIcon, { name: "external", className: styles['external-icon'] })))),
|
|
140
|
-
definition.info && React.createElement("span", { className: styles.info }, definition.info)));
|
|
141
|
+
definition.info && React.createElement("span", { className: clsx(styles.info, testUtilStyles.info) }, definition.info)));
|
|
141
142
|
}
|
|
142
143
|
function Section({ definition, activeHref, fireFollow, fireChange, variant, position }) {
|
|
143
144
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parts.js","sourceRoot":"","sources":["../../../src/side-navigation/parts.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,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,YAAY,EACpB,QAAQ,EAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,QAAQ,EAClC,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EACR,oBAAC,IAAI,IACH,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,EAC1E,QAAQ,EAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,QAAQ,EAClC,UAAU,EAAE,cAAc,EAC1B,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,GAClB;QAGJ,oBAAC,mBAAmB,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, 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 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';\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 expanded?: boolean;\n}\n\nfunction Link({ definition, expanded, activeHref, fireFollow, position }: LinkProps) {\n checkSafeUrl('SideNavigation', definition.href);\n const isActive = definition.href === activeHref;\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 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-expanded={expanded}\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\n aria-label={definition.externalIconAriaLabel}\n role={definition.externalIconAriaLabel ? 'img' : undefined}\n >\n <InternalIcon name=\"external\" className={styles['external-icon']} />\n </span>\n )}\n </a>\n {definition.info && <span className={styles.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 expanded={userExpanded ?? expanded}\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,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,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;AAoB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,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, 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 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 expanded?: boolean;\n}\n\nfunction Link({ definition, expanded, activeHref, fireFollow, position }: LinkProps) {\n checkSafeUrl('SideNavigation', definition.href);\n const isActive = definition.href === activeHref;\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 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-expanded={expanded}\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\n aria-label={definition.externalIconAriaLabel}\n role={definition.externalIconAriaLabel ? 'img' : undefined}\n >\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 expanded={userExpanded ?? expanded}\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"]}
|
package/table/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/table/index.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/D,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,QAAA,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/table/index.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/D,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,QAAA,MAAM,KAAK,qBA6Ga,CAAC;AAGzB,eAAe,KAAK,CAAC"}
|