@cloudscape-design/components 3.0.591 → 3.0.592
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.
|
@@ -33,7 +33,7 @@ export default function InternalAnchorNavigation(_a) {
|
|
|
33
33
|
}))));
|
|
34
34
|
}
|
|
35
35
|
const Anchor = ({ anchor, onFollow, isActive, index }) => {
|
|
36
|
-
checkSafeUrl('
|
|
36
|
+
checkSafeUrl('AnchorNavigation', anchor.href);
|
|
37
37
|
const onClick = useCallback((event) => {
|
|
38
38
|
if (isPlainLeftClick(event)) {
|
|
39
39
|
onFollow(anchor, event);
|
|
@@ -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;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEzG,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EASI;QATJ,EAC/C,OAAO,EACP,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,UAAU,GAAG,EAAE,EACf,iBAAiB,GAAG,IAAI,EACxB,eAAe,GAAG,CAAC,OAEgC,EADhD,KAAK,cARuC,qHAShD,CADS;IAER,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAEtC,MAA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,CAAC,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';\nimport styles from './styles.css.js';\nimport testUtilsStyles from './test-classes/styles.css.js';\nimport { AnchorNavigationProps } from './interfaces';\nimport { checkSafeUrl } from '../internal/utils/check-safe-url';\nimport useScrollSpy from './use-scroll-spy.js';\nimport { fireCancelableEvent, fireNonCancelableEvent, isPlainLeftClick } from '../internal/events/index';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { getBaseProps } from '../internal/base-component/index.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 {anchors.map((anchor, index) => {\n return (\n <Anchor\n onFollow={onFollowHandler}\n isActive={anchor.href === currentActiveHref}\n key={index}\n index={index}\n anchor={anchor}\n />\n );\n })}\n </ol>\n </nav>\n );\n}\n\ninterface AnchorProps {\n anchor: AnchorNavigationProps.Anchor;\n onFollow: (anchor: AnchorNavigationProps.Anchor, event: React.SyntheticEvent | Event) => void;\n isActive: boolean;\n index: number;\n}\n\nconst Anchor = ({ anchor, onFollow, isActive, index }: AnchorProps) => {\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 </li>\n );\n};\n"]}
|
package/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED
package/package.json
CHANGED