@cloudscape-design/components 3.0.611 → 3.0.613

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.
Files changed (34) hide show
  1. package/container/internal.d.ts.map +1 -1
  2. package/container/internal.js +12 -10
  3. package/container/internal.js.map +1 -1
  4. package/header/internal.d.ts.map +1 -1
  5. package/header/internal.js +3 -1
  6. package/header/internal.js.map +1 -1
  7. package/internal/components/dropdown/styles.css.js +20 -20
  8. package/internal/components/dropdown/styles.scoped.css +46 -40
  9. package/internal/components/dropdown/styles.selectors.js +20 -20
  10. package/internal/context/container-header.d.ts +6 -0
  11. package/internal/context/container-header.d.ts.map +1 -0
  12. package/internal/context/container-header.js +12 -0
  13. package/internal/context/container-header.js.map +1 -0
  14. package/internal/environment.js +1 -1
  15. package/internal/environment.json +1 -1
  16. package/internal/manifest.json +1 -1
  17. package/mixed-line-bar-chart/data-series.d.ts.map +1 -1
  18. package/mixed-line-bar-chart/data-series.js +3 -0
  19. package/mixed-line-bar-chart/data-series.js.map +1 -1
  20. package/package.json +1 -1
  21. package/table/body-cell/td-element.js +1 -1
  22. package/table/body-cell/td-element.js.map +1 -1
  23. package/table/header-cell/index.d.ts +1 -2
  24. package/table/header-cell/index.d.ts.map +1 -1
  25. package/table/header-cell/index.js.map +1 -1
  26. package/table/header-cell/th-element.js +1 -1
  27. package/table/header-cell/th-element.js.map +1 -1
  28. package/table/table-role/grid-navigation.d.ts.map +1 -1
  29. package/table/table-role/grid-navigation.js +2 -3
  30. package/table/table-role/grid-navigation.js.map +1 -1
  31. package/table/table-role/utils.d.ts +1 -0
  32. package/table/table-role/utils.d.ts.map +1 -1
  33. package/table/table-role/utils.js +8 -0
  34. package/table/table-role/utils.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/container/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,c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AAS,EACT,KAAK,EACL,cAAc,EACd,oBAAoB,EACpB,cAAsB,EACtB,iBAAwB,EACxB,sBAA8B,EAC9B,uBAA+B,EAC/B,eAAuB,EACvB,WAAW,EACX,YAAoB,EACpB,qBAA4B,EAC5B,oBAAoB,EACpB,YAAY,EACZ,GAAG,SAAS,EACb,EAAE,sBAAsB,eAmIxB"}
@@ -16,6 +16,7 @@ import { useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';
16
16
  import { useModalContext } from '../internal/context/modal-context';
17
17
  import { useUniqueId } from '../internal/hooks/use-unique-id';
18
18
  import { shouldRemoveHighContrastHeader } from '../internal/utils/content-header-utils';
19
+ import { ContainerHeaderContextProvider } from '../internal/context/container-header';
19
20
  export function InternalContainerAsSubstep(props) {
20
21
  const { subStepRef, funnelSubStepProps } = useFunnelSubStep();
21
22
  const modalContext = useModalContext();
@@ -60,16 +61,17 @@ export default function InternalContainer(_a) {
60
61
  return (React.createElement("div", Object.assign({}, baseProps, __funnelSubStepProps, { className: clsx(baseProps.className, styles.root, styles[`variant-${variant}`], fitHeight && styles['fit-height'], hasMedia && (mediaPosition === 'side' ? styles['with-side-media'] : styles['with-top-media']), shouldHaveStickyStyles && [styles['sticky-enabled']], isRefresh && styles.refresh), ref: mergedRef }),
61
62
  hasMedia && (React.createElement("div", { className: clsx(styles[`media-${mediaPosition === 'side' ? 'side' : 'top'}`], styles.media), style: mediaPosition === 'top' ? { height: (media === null || media === void 0 ? void 0 : media.height) || '' } : { width: (media === null || media === void 0 ? void 0 : media.width) || '' } }, media.content)),
62
63
  React.createElement("div", { id: contentId, ref: __subStepRef, className: clsx(styles['content-wrapper'], fitHeight && styles['content-wrapper-fit-height']) },
63
- header && (React.createElement(StickyHeaderContext.Provider, { value: { isStuck } },
64
- React.createElement("div", Object.assign({ className: clsx(isRefresh && styles.refresh, styles.header, styles[`header-variant-${variant}`], shouldRemoveHighContrastHeader() && styles['remove-high-contrast-header'], {
65
- [styles['header-sticky-disabled']]: __stickyHeader && !isSticky,
66
- [styles['header-sticky-enabled']]: isSticky,
67
- [styles['header-dynamic-height']]: hasDynamicHeight,
68
- [styles['header-stuck']]: isStuck,
69
- [styles['with-paddings']]: !disableHeaderPaddings,
70
- [styles['with-hidden-content']]: !children || __hiddenContent,
71
- [styles['header-with-media']]: hasMedia,
72
- }) }, stickyStyles, { ref: headerMergedRef }), __darkHeader ? (React.createElement("div", { className: clsx(styles['dark-header'], getContentHeaderClassName()) }, header)) : (header)))),
64
+ header && (React.createElement(ContainerHeaderContextProvider, null,
65
+ React.createElement(StickyHeaderContext.Provider, { value: { isStuck } },
66
+ React.createElement("div", Object.assign({ className: clsx(isRefresh && styles.refresh, styles.header, styles[`header-variant-${variant}`], shouldRemoveHighContrastHeader() && styles['remove-high-contrast-header'], {
67
+ [styles['header-sticky-disabled']]: __stickyHeader && !isSticky,
68
+ [styles['header-sticky-enabled']]: isSticky,
69
+ [styles['header-dynamic-height']]: hasDynamicHeight,
70
+ [styles['header-stuck']]: isStuck,
71
+ [styles['with-paddings']]: !disableHeaderPaddings,
72
+ [styles['with-hidden-content']]: !children || __hiddenContent,
73
+ [styles['header-with-media']]: hasMedia,
74
+ }) }, stickyStyles, { ref: headerMergedRef }), __darkHeader ? (React.createElement("div", { className: clsx(styles['dark-header'], getContentHeaderClassName()) }, header)) : (header))))),
73
75
  React.createElement("div", { className: clsx(styles.content, fitHeight && styles['content-fit-height'], shouldRemoveHighContrastHeader() && styles['remove-high-contrast-header'], {
74
76
  [styles['with-paddings']]: !disableContentPaddings,
75
77
  }) }, children),
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/container/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAA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ACxC,CACF,IACG,YAAY,IAChB,GAAG,EAAE,eAAe,KAEnB,YAAY,CAAC,CAAC,CAAC,CACd,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,yBAAyB,EAAE,CAAC,IAAG,MAAM,CAAO,CACzF,CAAC,CAAC,CAAC,CACF,MAAM,CACP,CACG,CACuB,CAChC;YACD,6BACE,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,OAAO,EACd,SAAS,IAAI,MAAM,CAAC,oBAAoB,CAAC,EACzC,8BAA8B,EAAE,IAAI,MAAM,CAAC,6BAA6B,CAAC,EACzE;oBACE,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,sBAAsB;iBACnD,CACF,IAEA,QAAQ,CACL;YACL,MAAM,IAAI,CACT,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;oBAC7B,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,sBAAsB;oBACjD,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,uBAAuB;iBACpD,CAAC,IAED,MAAM,CACH,CACP,CACG,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useEffect, useRef } from 'react';\nimport { ContainerProps } from './interfaces';\nimport { getBaseProps } from '../internal/base-component';\nimport { useAppLayoutContext } from '../internal/context/app-layout-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { getContentHeaderClassName } from '../internal/utils/content-header-utils';\nimport { StickyHeaderContext, useStickyHeader } from './use-sticky-header';\nimport { useDynamicOverlap } from '../internal/hooks/use-dynamic-overlap';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport styles from './styles.css.js';\nimport { useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport { useModalContext } from '../internal/context/modal-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { shouldRemoveHighContrastHeader } from '../internal/utils/content-header-utils';\n\nexport interface InternalContainerProps extends Omit<ContainerProps, 'variant'>, InternalBaseComponentProps {\n __stickyHeader?: boolean;\n __stickyOffset?: number;\n __mobileStickyOffset?: number;\n __disableFooterDivider?: boolean;\n __disableFooterPaddings?: boolean;\n __hiddenContent?: boolean;\n __headerRef?: React.RefObject<HTMLDivElement>;\n __darkHeader?: boolean;\n __disableStickyMobile?: boolean;\n /**\n * Additional internal variant:\n * * `embedded` - Use this variant within a parent container (such as a modal,\n * expandable section, container or split panel).\n * * `full-page` – Only for internal use in table, cards and other components\n */\n variant?: ContainerProps['variant'] | 'embedded' | 'full-page' | 'cards';\n\n __funnelSubStepProps?: ReturnType<typeof useFunnelSubStep>['funnelSubStepProps'];\n __subStepRef?: ReturnType<typeof useFunnelSubStep>['subStepRef'];\n}\n\nexport function InternalContainerAsSubstep(props: InternalContainerProps) {\n const { subStepRef, funnelSubStepProps } = useFunnelSubStep();\n const modalContext = useModalContext();\n\n return (\n <InternalContainer\n {...props}\n __subStepRef={modalContext?.isInModal ? { current: null } : subStepRef}\n __funnelSubStepProps={modalContext?.isInModal ? {} : funnelSubStepProps}\n />\n );\n}\n\nexport default function InternalContainer({\n header,\n footer,\n children,\n variant = 'default',\n disableHeaderPaddings = false,\n disableContentPaddings = false,\n fitHeight,\n media,\n __stickyOffset,\n __mobileStickyOffset,\n __stickyHeader = false,\n __internalRootRef = null,\n __disableFooterDivider = false,\n __disableFooterPaddings = false,\n __hiddenContent = false,\n __headerRef,\n __darkHeader = false,\n __disableStickyMobile = true,\n __funnelSubStepProps,\n __subStepRef,\n ...restProps\n}: InternalContainerProps) {\n const isMobile = useMobile();\n const baseProps = getBaseProps(restProps);\n const rootRef = useRef<HTMLDivElement>(null);\n const headerRef = useRef<HTMLDivElement>(null);\n const { isSticky, isStuck, stickyStyles } = useStickyHeader(\n rootRef,\n headerRef,\n __stickyHeader,\n __stickyOffset,\n __mobileStickyOffset,\n __disableStickyMobile\n );\n const contentId = useUniqueId();\n const { setHasStickyBackground } = useAppLayoutContext();\n const isRefresh = useVisualRefresh();\n\n const hasDynamicHeight = isRefresh && variant === 'full-page';\n const overlapElement = useDynamicOverlap({ disabled: !hasDynamicHeight || !__darkHeader });\n\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n const headerMergedRef = useMergeRefs(headerRef, overlapElement, __headerRef);\n\n /**\n * The visual refresh AppLayout component needs to know if a child component\n * has a high contrast sticky header. This is to make sure the background element\n * stays in the same vertical position as the header content.\n */\n useEffect(() => {\n const shouldUpdateStickyBackground = isSticky && variant === 'full-page' && setHasStickyBackground;\n if (shouldUpdateStickyBackground) {\n setHasStickyBackground(true);\n }\n\n return () => {\n if (shouldUpdateStickyBackground) {\n setHasStickyBackground(false);\n }\n };\n }, [isSticky, setHasStickyBackground, variant]);\n\n // The container is only sticky on mobile if it is the header for the table.\n // In this case we don't want the container to have sticky styles, as only the table header row will show as stuck on scroll.\n const shouldHaveStickyStyles = isSticky && !isMobile;\n\n const hasMedia = !!media?.content;\n const mediaPosition = media?.position ?? 'top';\n return (\n <div\n {...baseProps}\n {...__funnelSubStepProps}\n className={clsx(\n baseProps.className,\n styles.root,\n styles[`variant-${variant}`],\n fitHeight && styles['fit-height'],\n hasMedia && (mediaPosition === 'side' ? styles['with-side-media'] : styles['with-top-media']),\n shouldHaveStickyStyles && [styles['sticky-enabled']],\n isRefresh && styles.refresh\n )}\n ref={mergedRef}\n >\n {hasMedia && (\n <div\n className={clsx(styles[`media-${mediaPosition === 'side' ? 'side' : 'top'}`], styles.media)}\n style={mediaPosition === 'top' ? { height: media?.height || '' } : { width: media?.width || '' }}\n >\n {media.content}\n </div>\n )}\n <div\n id={contentId}\n ref={__subStepRef}\n className={clsx(styles['content-wrapper'], fitHeight && styles['content-wrapper-fit-height'])}\n >\n {header && (\n <StickyHeaderContext.Provider value={{ isStuck }}>\n <div\n className={clsx(\n isRefresh && styles.refresh,\n styles.header,\n styles[`header-variant-${variant}`],\n shouldRemoveHighContrastHeader() && styles['remove-high-contrast-header'],\n {\n [styles['header-sticky-disabled']]: __stickyHeader && !isSticky,\n [styles['header-sticky-enabled']]: isSticky,\n [styles['header-dynamic-height']]: hasDynamicHeight,\n [styles['header-stuck']]: isStuck,\n [styles['with-paddings']]: !disableHeaderPaddings,\n [styles['with-hidden-content']]: !children || __hiddenContent,\n [styles['header-with-media']]: hasMedia,\n }\n )}\n {...stickyStyles}\n ref={headerMergedRef}\n >\n {__darkHeader ? (\n <div className={clsx(styles['dark-header'], getContentHeaderClassName())}>{header}</div>\n ) : (\n header\n )}\n </div>\n </StickyHeaderContext.Provider>\n )}\n <div\n className={clsx(\n styles.content,\n fitHeight && styles['content-fit-height'],\n shouldRemoveHighContrastHeader() && styles['remove-high-contrast-header'],\n {\n [styles['with-paddings']]: !disableContentPaddings,\n }\n )}\n >\n {children}\n </div>\n {footer && (\n <div\n className={clsx(styles.footer, {\n [styles['with-divider']]: !__disableFooterDivider,\n [styles['with-paddings']]: !__disableFooterPaddings,\n })}\n >\n {footer}\n </div>\n )}\n </div>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/container/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAE7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,q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K,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,yBAAyB,EAAE,CAAC,IAAG,MAAM,CAAO,CACzF,CAAC,CAAC,CAAC,CACF,MAAM,CACP,CACG,CACuB,CACA,CAClC;YACD,6BACE,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,OAAO,EACd,SAAS,IAAI,MAAM,CAAC,oBAAoB,CAAC,EACzC,8BAA8B,EAAE,IAAI,MAAM,CAAC,6BAA6B,CAAC,EACzE;oBACE,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,sBAAsB;iBACnD,CACF,IAEA,QAAQ,CACL;YACL,MAAM,IAAI,CACT,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;oBAC7B,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,sBAAsB;oBACjD,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,uBAAuB;iBACpD,CAAC,IAED,MAAM,CACH,CACP,CACG,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useEffect, useRef } from 'react';\nimport { ContainerProps } from './interfaces';\nimport { getBaseProps } from '../internal/base-component';\nimport { useAppLayoutContext } from '../internal/context/app-layout-context';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { getContentHeaderClassName } from '../internal/utils/content-header-utils';\nimport { StickyHeaderContext, useStickyHeader } from './use-sticky-header';\nimport { useDynamicOverlap } from '../internal/hooks/use-dynamic-overlap';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport styles from './styles.css.js';\nimport { useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport { useModalContext } from '../internal/context/modal-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { shouldRemoveHighContrastHeader } from '../internal/utils/content-header-utils';\nimport { ContainerHeaderContextProvider } from '../internal/context/container-header';\n\nexport interface InternalContainerProps extends Omit<ContainerProps, 'variant'>, InternalBaseComponentProps {\n __stickyHeader?: boolean;\n __stickyOffset?: number;\n __mobileStickyOffset?: number;\n __disableFooterDivider?: boolean;\n __disableFooterPaddings?: boolean;\n __hiddenContent?: boolean;\n __headerRef?: React.RefObject<HTMLDivElement>;\n __darkHeader?: boolean;\n __disableStickyMobile?: boolean;\n /**\n * Additional internal variant:\n * * `embedded` - Use this variant within a parent container (such as a modal,\n * expandable section, container or split panel).\n * * `full-page` – Only for internal use in table, cards and other components\n */\n variant?: ContainerProps['variant'] | 'embedded' | 'full-page' | 'cards';\n\n __funnelSubStepProps?: ReturnType<typeof useFunnelSubStep>['funnelSubStepProps'];\n __subStepRef?: ReturnType<typeof useFunnelSubStep>['subStepRef'];\n}\n\nexport function InternalContainerAsSubstep(props: InternalContainerProps) {\n const { subStepRef, funnelSubStepProps } = useFunnelSubStep();\n const modalContext = useModalContext();\n\n return (\n <InternalContainer\n {...props}\n __subStepRef={modalContext?.isInModal ? { current: null } : subStepRef}\n __funnelSubStepProps={modalContext?.isInModal ? {} : funnelSubStepProps}\n />\n );\n}\n\nexport default function InternalContainer({\n header,\n footer,\n children,\n variant = 'default',\n disableHeaderPaddings = false,\n disableContentPaddings = false,\n fitHeight,\n media,\n __stickyOffset,\n __mobileStickyOffset,\n __stickyHeader = false,\n __internalRootRef = null,\n __disableFooterDivider = false,\n __disableFooterPaddings = false,\n __hiddenContent = false,\n __headerRef,\n __darkHeader = false,\n __disableStickyMobile = true,\n __funnelSubStepProps,\n __subStepRef,\n ...restProps\n}: InternalContainerProps) {\n const isMobile = useMobile();\n const baseProps = getBaseProps(restProps);\n const rootRef = useRef<HTMLDivElement>(null);\n const headerRef = useRef<HTMLDivElement>(null);\n const { isSticky, isStuck, stickyStyles } = useStickyHeader(\n rootRef,\n headerRef,\n __stickyHeader,\n __stickyOffset,\n __mobileStickyOffset,\n __disableStickyMobile\n );\n const contentId = useUniqueId();\n const { setHasStickyBackground } = useAppLayoutContext();\n const isRefresh = useVisualRefresh();\n\n const hasDynamicHeight = isRefresh && variant === 'full-page';\n const overlapElement = useDynamicOverlap({ disabled: !hasDynamicHeight || !__darkHeader });\n\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n const headerMergedRef = useMergeRefs(headerRef, overlapElement, __headerRef);\n\n /**\n * The visual refresh AppLayout component needs to know if a child component\n * has a high contrast sticky header. This is to make sure the background element\n * stays in the same vertical position as the header content.\n */\n useEffect(() => {\n const shouldUpdateStickyBackground = isSticky && variant === 'full-page' && setHasStickyBackground;\n if (shouldUpdateStickyBackground) {\n setHasStickyBackground(true);\n }\n\n return () => {\n if (shouldUpdateStickyBackground) {\n setHasStickyBackground(false);\n }\n };\n }, [isSticky, setHasStickyBackground, variant]);\n\n // The container is only sticky on mobile if it is the header for the table.\n // In this case we don't want the container to have sticky styles, as only the table header row will show as stuck on scroll.\n const shouldHaveStickyStyles = isSticky && !isMobile;\n\n const hasMedia = !!media?.content;\n const mediaPosition = media?.position ?? 'top';\n return (\n <div\n {...baseProps}\n {...__funnelSubStepProps}\n className={clsx(\n baseProps.className,\n styles.root,\n styles[`variant-${variant}`],\n fitHeight && styles['fit-height'],\n hasMedia && (mediaPosition === 'side' ? styles['with-side-media'] : styles['with-top-media']),\n shouldHaveStickyStyles && [styles['sticky-enabled']],\n isRefresh && styles.refresh\n )}\n ref={mergedRef}\n >\n {hasMedia && (\n <div\n className={clsx(styles[`media-${mediaPosition === 'side' ? 'side' : 'top'}`], styles.media)}\n style={mediaPosition === 'top' ? { height: media?.height || '' } : { width: media?.width || '' }}\n >\n {media.content}\n </div>\n )}\n <div\n id={contentId}\n ref={__subStepRef}\n className={clsx(styles['content-wrapper'], fitHeight && styles['content-wrapper-fit-height'])}\n >\n {header && (\n <ContainerHeaderContextProvider>\n <StickyHeaderContext.Provider value={{ isStuck }}>\n <div\n className={clsx(\n isRefresh && styles.refresh,\n styles.header,\n styles[`header-variant-${variant}`],\n shouldRemoveHighContrastHeader() && styles['remove-high-contrast-header'],\n {\n [styles['header-sticky-disabled']]: __stickyHeader && !isSticky,\n [styles['header-sticky-enabled']]: isSticky,\n [styles['header-dynamic-height']]: hasDynamicHeight,\n [styles['header-stuck']]: isStuck,\n [styles['with-paddings']]: !disableHeaderPaddings,\n [styles['with-hidden-content']]: !children || __hiddenContent,\n [styles['header-with-media']]: hasMedia,\n }\n )}\n {...stickyStyles}\n ref={headerMergedRef}\n >\n {__darkHeader ? (\n <div className={clsx(styles['dark-header'], getContentHeaderClassName())}>{header}</div>\n ) : (\n header\n )}\n </div>\n </StickyHeaderContext.Provider>\n </ContainerHeaderContextProvider>\n )}\n <div\n className={clsx(\n styles.content,\n fitHeight && styles['content-fit-height'],\n shouldRemoveHighContrastHeader() && styles['remove-high-contrast-header'],\n {\n [styles['with-paddings']]: !disableContentPaddings,\n }\n )}\n >\n {children}\n </div>\n {footer && (\n <div\n className={clsx(styles.footer, {\n [styles['with-divider']]: !__disableFooterDivider,\n [styles['with-paddings']]: !__disableFooterPaddings,\n })}\n >\n {footer}\n </div>\n )}\n </div>\n </div>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/header/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOjD,UAAU,mBAAoB,SAAQ,YAAY,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,0BAA0B;IACpG,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,WAAW,EACX,IAAI,EACJ,iBAAwB,EACxB,wBAAwB,EACxB,GAAG,SAAS,EACb,EAAE,mBAAmB,eAuErB;AAED,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,sBAgBhH"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/header/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAQjD,UAAU,mBAAoB,SAAQ,YAAY,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,0BAA0B;IACpG,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,WAAW,EACX,IAAI,EACJ,iBAAwB,EACxB,wBAAwB,EACxB,GAAG,SAAS,EACb,EAAE,mBAAmB,eAwErB;AAED,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,sBAgBhH"}
@@ -12,6 +12,7 @@ import { InfoLinkLabelContext } from '../internal/context/info-link-label-contex
12
12
  import { CollectionLabelContext } from '../internal/context/collection-label-context';
13
13
  import { useUniqueId } from '../internal/hooks/use-unique-id';
14
14
  import { DATA_ATTR_FUNNEL_KEY, FUNNEL_KEY_SUBSTEP_NAME } from '../internal/analytics/selectors';
15
+ import { useContainerHeader } from '../internal/context/container-header';
15
16
  export default function InternalHeader(_a) {
16
17
  var { variant, headingTagOverride, children, actions, counter, description, info, __internalRootRef = null, __disableActionsWrapping } = _a, restProps = __rest(_a, ["variant", "headingTagOverride", "children", "actions", "counter", "description", "info", "__internalRootRef", "__disableActionsWrapping"]);
17
18
  const isMobile = useMobile();
@@ -20,6 +21,7 @@ export default function InternalHeader(_a) {
20
21
  const baseProps = getBaseProps(restProps);
21
22
  const isRefresh = useVisualRefresh();
22
23
  const assignHeaderId = useContext(CollectionLabelContext).assignId;
24
+ const isInContainer = useContainerHeader();
23
25
  const headingId = useUniqueId('heading');
24
26
  if (assignHeaderId !== undefined) {
25
27
  assignHeaderId(headingId);
@@ -31,7 +33,7 @@ export default function InternalHeader(_a) {
31
33
  React.createElement("div", { className: clsx(styles.main, styles[`main-variant-${variantOverride}`], isRefresh && styles.refresh, __disableActionsWrapping && [styles['no-wrap']]) },
32
34
  React.createElement("div", { className: clsx(styles.title, styles[`title-variant-${variantOverride}`], isRefresh && styles.refresh) },
33
35
  React.createElement(HeadingTag, { className: clsx(styles.heading, styles[`heading-variant-${variantOverride}`]) },
34
- React.createElement("span", Object.assign({}, (HeadingTag === 'h2' ? { [DATA_ATTR_FUNNEL_KEY]: FUNNEL_KEY_SUBSTEP_NAME } : {}), { className: clsx(styles['heading-text'], styles[`heading-text-variant-${variantOverride}`]), id: headingId }), children),
36
+ React.createElement("span", Object.assign({}, (isInContainer ? { [DATA_ATTR_FUNNEL_KEY]: FUNNEL_KEY_SUBSTEP_NAME } : {}), { className: clsx(styles['heading-text'], styles[`heading-text-variant-${variantOverride}`]), id: headingId }), children),
35
37
  counter !== undefined && React.createElement("span", { className: styles.counter },
36
38
  " ",
37
39
  counter)),
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/header/internal.tsx"],"names":[],"mappings":";AAAA,qE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ACF,IAAI,CACL,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useContext } from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport { StickyHeaderContext } from '../container/use-sticky-header';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { HeaderProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { SomeRequired } from '../internal/types';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { InfoLinkLabelContext } from '../internal/context/info-link-label-context';\nimport { CollectionLabelContext } from '../internal/context/collection-label-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { DATA_ATTR_FUNNEL_KEY, FUNNEL_KEY_SUBSTEP_NAME } from '../internal/analytics/selectors';\n\ninterface InternalHeaderProps extends SomeRequired<HeaderProps, 'variant'>, InternalBaseComponentProps {\n __disableActionsWrapping?: boolean;\n}\n\nexport default function InternalHeader({\n variant,\n headingTagOverride,\n children,\n actions,\n counter,\n description,\n info,\n __internalRootRef = null,\n __disableActionsWrapping,\n ...restProps\n}: InternalHeaderProps) {\n const isMobile = useMobile();\n const HeadingTag = headingTagOverride ?? (variant === 'awsui-h1-sticky' ? 'h1' : variant);\n const { isStuck } = useContext(StickyHeaderContext);\n const baseProps = getBaseProps(restProps);\n const isRefresh = useVisualRefresh();\n const assignHeaderId = useContext(CollectionLabelContext).assignId;\n const headingId = useUniqueId('heading');\n if (assignHeaderId !== undefined) {\n assignHeaderId(headingId);\n }\n // If is mobile there is no need to have the dynamic variant because it's scrolled out of view\n const dynamicVariant = !isMobile && isStuck ? 'h2' : 'h1';\n const variantOverride = variant === 'awsui-h1-sticky' ? (isRefresh ? dynamicVariant : 'h2') : variant;\n\n return (\n <div\n {...baseProps}\n className={clsx(\n styles.root,\n baseProps.className,\n styles[`root-variant-${variantOverride}`],\n isRefresh && styles.refresh,\n !actions && [styles[`root-no-actions`]],\n description && [styles[`root-has-description`]]\n )}\n ref={__internalRootRef}\n >\n <div\n className={clsx(\n styles.main,\n styles[`main-variant-${variantOverride}`],\n isRefresh && styles.refresh,\n __disableActionsWrapping && [styles['no-wrap']]\n )}\n >\n <div className={clsx(styles.title, styles[`title-variant-${variantOverride}`], isRefresh && styles.refresh)}>\n <HeadingTag className={clsx(styles.heading, styles[`heading-variant-${variantOverride}`])}>\n <span\n {...(HeadingTag === 'h2' ? { [DATA_ATTR_FUNNEL_KEY]: FUNNEL_KEY_SUBSTEP_NAME } : {})}\n className={clsx(styles['heading-text'], styles[`heading-text-variant-${variantOverride}`])}\n id={headingId}\n >\n {children}\n </span>\n {counter !== undefined && <span className={styles.counter}> {counter}</span>}\n </HeadingTag>\n {info && (\n <InfoLinkLabelContext.Provider value={headingId}>\n {/* Exists to create a space between heading text and info so that a double-click selection on the last word of the heading doesn't also include info */}\n <span className={styles['virtual-space']}> &nbsp;</span>\n <span className={styles.info}>{info}</span>\n </InfoLinkLabelContext.Provider>\n )}\n </div>\n {actions && (\n <div\n className={clsx(\n styles.actions,\n styles[`actions-variant-${variantOverride}`],\n isRefresh && styles.refresh,\n !__disableActionsWrapping && [styles['actions-centered']]\n )}\n >\n {actions}\n </div>\n )}\n </div>\n <Description variantOverride={variantOverride}>{description}</Description>\n </div>\n );\n}\n\nexport function Description({ children, variantOverride }: { children: React.ReactNode; variantOverride: string }) {\n const isRefresh = useVisualRefresh();\n return (\n (children && (\n <p\n className={clsx(\n styles.description,\n styles[`description-variant-${variantOverride}`],\n isRefresh && styles.refresh\n )}\n >\n {children}\n </p>\n )) ||\n null\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/header/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MA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,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useContext } from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport { StickyHeaderContext } from '../container/use-sticky-header';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { HeaderProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { SomeRequired } from '../internal/types';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { InfoLinkLabelContext } from '../internal/context/info-link-label-context';\nimport { CollectionLabelContext } from '../internal/context/collection-label-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { DATA_ATTR_FUNNEL_KEY, FUNNEL_KEY_SUBSTEP_NAME } from '../internal/analytics/selectors';\nimport { useContainerHeader } from '../internal/context/container-header';\n\ninterface InternalHeaderProps extends SomeRequired<HeaderProps, 'variant'>, InternalBaseComponentProps {\n __disableActionsWrapping?: boolean;\n}\n\nexport default function InternalHeader({\n variant,\n headingTagOverride,\n children,\n actions,\n counter,\n description,\n info,\n __internalRootRef = null,\n __disableActionsWrapping,\n ...restProps\n}: InternalHeaderProps) {\n const isMobile = useMobile();\n const HeadingTag = headingTagOverride ?? (variant === 'awsui-h1-sticky' ? 'h1' : variant);\n const { isStuck } = useContext(StickyHeaderContext);\n const baseProps = getBaseProps(restProps);\n const isRefresh = useVisualRefresh();\n const assignHeaderId = useContext(CollectionLabelContext).assignId;\n const isInContainer = useContainerHeader();\n const headingId = useUniqueId('heading');\n if (assignHeaderId !== undefined) {\n assignHeaderId(headingId);\n }\n // If is mobile there is no need to have the dynamic variant because it's scrolled out of view\n const dynamicVariant = !isMobile && isStuck ? 'h2' : 'h1';\n const variantOverride = variant === 'awsui-h1-sticky' ? (isRefresh ? dynamicVariant : 'h2') : variant;\n\n return (\n <div\n {...baseProps}\n className={clsx(\n styles.root,\n baseProps.className,\n styles[`root-variant-${variantOverride}`],\n isRefresh && styles.refresh,\n !actions && [styles[`root-no-actions`]],\n description && [styles[`root-has-description`]]\n )}\n ref={__internalRootRef}\n >\n <div\n className={clsx(\n styles.main,\n styles[`main-variant-${variantOverride}`],\n isRefresh && styles.refresh,\n __disableActionsWrapping && [styles['no-wrap']]\n )}\n >\n <div className={clsx(styles.title, styles[`title-variant-${variantOverride}`], isRefresh && styles.refresh)}>\n <HeadingTag className={clsx(styles.heading, styles[`heading-variant-${variantOverride}`])}>\n <span\n {...(isInContainer ? { [DATA_ATTR_FUNNEL_KEY]: FUNNEL_KEY_SUBSTEP_NAME } : {})}\n className={clsx(styles['heading-text'], styles[`heading-text-variant-${variantOverride}`])}\n id={headingId}\n >\n {children}\n </span>\n {counter !== undefined && <span className={styles.counter}> {counter}</span>}\n </HeadingTag>\n {info && (\n <InfoLinkLabelContext.Provider value={headingId}>\n {/* Exists to create a space between heading text and info so that a double-click selection on the last word of the heading doesn't also include info */}\n <span className={styles['virtual-space']}> &nbsp;</span>\n <span className={styles.info}>{info}</span>\n </InfoLinkLabelContext.Provider>\n )}\n </div>\n {actions && (\n <div\n className={clsx(\n styles.actions,\n styles[`actions-variant-${variantOverride}`],\n isRefresh && styles.refresh,\n !__disableActionsWrapping && [styles['actions-centered']]\n )}\n >\n {actions}\n </div>\n )}\n </div>\n <Description variantOverride={variantOverride}>{description}</Description>\n </div>\n );\n}\n\nexport function Description({ children, variantOverride }: { children: React.ReactNode; variantOverride: string }) {\n const isRefresh = useVisualRefresh();\n return (\n (children && (\n <p\n className={clsx(\n styles.description,\n styles[`description-variant-${variantOverride}`],\n isRefresh && styles.refresh\n )}\n >\n {children}\n </p>\n )) ||\n null\n );\n}\n"]}
@@ -1,25 +1,25 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "dropdown-content-wrapper": "awsui_dropdown-content-wrapper_qwoo0_3gt2b_99",
5
- "awsui-motion-fade-in-dropdown": "awsui_awsui-motion-fade-in-dropdown_qwoo0_3gt2b_1",
6
- "refresh": "awsui_refresh_qwoo0_3gt2b_120",
7
- "awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_qwoo0_3gt2b_1",
8
- "root": "awsui_root_qwoo0_3gt2b_149",
9
- "interior": "awsui_interior_qwoo0_3gt2b_185",
10
- "dropdown": "awsui_dropdown_qwoo0_3gt2b_99",
11
- "use-portal": "awsui_use-portal_qwoo0_3gt2b_196",
12
- "is-empty": "awsui_is-empty_qwoo0_3gt2b_248",
13
- "dropdown-drop-up": "awsui_dropdown-drop-up_qwoo0_3gt2b_255",
14
- "with-limited-width": "awsui_with-limited-width_qwoo0_3gt2b_259",
15
- "dropdown-drop-left": "awsui_dropdown-drop-left_qwoo0_3gt2b_262",
16
- "dropdown-drop-right": "awsui_dropdown-drop-right_qwoo0_3gt2b_268",
17
- "occupy-entire-width": "awsui_occupy-entire-width_qwoo0_3gt2b_274",
18
- "stretch-beyond-trigger-width": "awsui_stretch-beyond-trigger-width_qwoo0_3gt2b_277",
19
- "hide-block-border": "awsui_hide-block-border_qwoo0_3gt2b_281",
20
- "open": "awsui_open_qwoo0_3gt2b_287",
21
- "nowrap": "awsui_nowrap_qwoo0_3gt2b_296",
22
- "dropdown-content": "awsui_dropdown-content_qwoo0_3gt2b_99",
23
- "stretch-trigger-height": "awsui_stretch-trigger-height_qwoo0_3gt2b_307"
4
+ "dropdown-content-wrapper": "awsui_dropdown-content-wrapper_qwoo0_1a4vh_99",
5
+ "awsui-motion-fade-in-dropdown": "awsui_awsui-motion-fade-in-dropdown_qwoo0_1a4vh_1",
6
+ "refresh": "awsui_refresh_qwoo0_1a4vh_120",
7
+ "awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_qwoo0_1a4vh_1",
8
+ "root": "awsui_root_qwoo0_1a4vh_149",
9
+ "interior": "awsui_interior_qwoo0_1a4vh_185",
10
+ "dropdown": "awsui_dropdown_qwoo0_1a4vh_99",
11
+ "use-portal": "awsui_use-portal_qwoo0_1a4vh_196",
12
+ "is-empty": "awsui_is-empty_qwoo0_1a4vh_248",
13
+ "dropdown-drop-up": "awsui_dropdown-drop-up_qwoo0_1a4vh_255",
14
+ "with-limited-width": "awsui_with-limited-width_qwoo0_1a4vh_259",
15
+ "dropdown-drop-left": "awsui_dropdown-drop-left_qwoo0_1a4vh_262",
16
+ "dropdown-drop-right": "awsui_dropdown-drop-right_qwoo0_1a4vh_268",
17
+ "occupy-entire-width": "awsui_occupy-entire-width_qwoo0_1a4vh_274",
18
+ "stretch-beyond-trigger-width": "awsui_stretch-beyond-trigger-width_qwoo0_1a4vh_277",
19
+ "hide-block-border": "awsui_hide-block-border_qwoo0_1a4vh_284",
20
+ "open": "awsui_open_qwoo0_1a4vh_293",
21
+ "nowrap": "awsui_nowrap_qwoo0_1a4vh_302",
22
+ "dropdown-content": "awsui_dropdown-content_qwoo0_1a4vh_99",
23
+ "stretch-trigger-height": "awsui_stretch-trigger-height_qwoo0_1a4vh_313"
24
24
  };
25
25
 
@@ -96,10 +96,10 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
96
96
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
97
97
  SPDX-License-Identifier: Apache-2.0
98
98
  */
99
- .awsui_dropdown-content-wrapper_qwoo0_3gt2b_99:not(#\9) {
100
- animation: awsui_awsui-motion-fade-in-dropdown_qwoo0_3gt2b_1 var(--motion-duration-show-quick-aq3ump, 135ms) var(--motion-easing-show-quick-vc5zgd, ease-out);
99
+ .awsui_dropdown-content-wrapper_qwoo0_1a4vh_99:not(#\9) {
100
+ animation: awsui_awsui-motion-fade-in-dropdown_qwoo0_1a4vh_1 var(--motion-duration-show-quick-aq3ump, 135ms) var(--motion-easing-show-quick-vc5zgd, ease-out);
101
101
  }
102
- @keyframes awsui_awsui-motion-fade-in-dropdown_qwoo0_3gt2b_1 {
102
+ @keyframes awsui_awsui-motion-fade-in-dropdown_qwoo0_1a4vh_1 {
103
103
  from {
104
104
  opacity: 0.4;
105
105
  }
@@ -108,22 +108,22 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
108
108
  }
109
109
  }
110
110
  @media (prefers-reduced-motion: reduce) {
111
- .awsui_dropdown-content-wrapper_qwoo0_3gt2b_99:not(#\9) {
111
+ .awsui_dropdown-content-wrapper_qwoo0_1a4vh_99:not(#\9) {
112
112
  animation: none;
113
113
  transition: none;
114
114
  }
115
115
  }
116
- .awsui-motion-disabled .awsui_dropdown-content-wrapper_qwoo0_3gt2b_99:not(#\9), .awsui-mode-entering .awsui_dropdown-content-wrapper_qwoo0_3gt2b_99:not(#\9) {
116
+ .awsui-motion-disabled .awsui_dropdown-content-wrapper_qwoo0_1a4vh_99:not(#\9), .awsui-mode-entering .awsui_dropdown-content-wrapper_qwoo0_1a4vh_99:not(#\9) {
117
117
  animation: none;
118
118
  transition: none;
119
119
  }
120
- .awsui_dropdown-content-wrapper_qwoo0_3gt2b_99.awsui_refresh_qwoo0_3gt2b_120:not(#\9) {
120
+ .awsui_dropdown-content-wrapper_qwoo0_1a4vh_99.awsui_refresh_qwoo0_1a4vh_120:not(#\9) {
121
121
  transform-origin: top;
122
- animation-name: awsui_awsui-motion-fade-in-0_qwoo0_3gt2b_1;
122
+ animation-name: awsui_awsui-motion-fade-in-0_qwoo0_1a4vh_1;
123
123
  animation-duration: var(--motion-duration-show-quick-aq3ump, 135ms);
124
124
  animation-timing-function: var(--motion-easing-show-quick-vc5zgd, ease-out);
125
125
  }
126
- @keyframes awsui_awsui-motion-fade-in-0_qwoo0_3gt2b_1 {
126
+ @keyframes awsui_awsui-motion-fade-in-0_qwoo0_1a4vh_1 {
127
127
  from {
128
128
  opacity: 0;
129
129
  }
@@ -132,12 +132,12 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
132
132
  }
133
133
  }
134
134
  @media (prefers-reduced-motion: reduce) {
135
- .awsui_dropdown-content-wrapper_qwoo0_3gt2b_99.awsui_refresh_qwoo0_3gt2b_120:not(#\9) {
135
+ .awsui_dropdown-content-wrapper_qwoo0_1a4vh_99.awsui_refresh_qwoo0_1a4vh_120:not(#\9) {
136
136
  animation: none;
137
137
  transition: none;
138
138
  }
139
139
  }
140
- .awsui-motion-disabled .awsui_dropdown-content-wrapper_qwoo0_3gt2b_99.awsui_refresh_qwoo0_3gt2b_120:not(#\9), .awsui-mode-entering .awsui_dropdown-content-wrapper_qwoo0_3gt2b_99.awsui_refresh_qwoo0_3gt2b_120:not(#\9) {
140
+ .awsui-motion-disabled .awsui_dropdown-content-wrapper_qwoo0_1a4vh_99.awsui_refresh_qwoo0_1a4vh_120:not(#\9), .awsui-mode-entering .awsui_dropdown-content-wrapper_qwoo0_1a4vh_99.awsui_refresh_qwoo0_1a4vh_120:not(#\9) {
141
141
  animation: none;
142
142
  transition: none;
143
143
  }
@@ -146,7 +146,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
146
146
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
147
147
  SPDX-License-Identifier: Apache-2.0
148
148
  */
149
- .awsui_root_qwoo0_3gt2b_149:not(#\9) {
149
+ .awsui_root_qwoo0_1a4vh_149:not(#\9) {
150
150
  border-collapse: separate;
151
151
  border-spacing: 0;
152
152
  box-sizing: border-box;
@@ -183,11 +183,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
183
183
  position: relative;
184
184
  white-space: inherit;
185
185
  }
186
- .awsui_root_qwoo0_3gt2b_149.awsui_interior_qwoo0_3gt2b_185:not(#\9) {
186
+ .awsui_root_qwoo0_1a4vh_149.awsui_interior_qwoo0_1a4vh_185:not(#\9) {
187
187
  position: static;
188
188
  }
189
189
 
190
- .awsui_dropdown_qwoo0_3gt2b_99:not(#\9) {
190
+ .awsui_dropdown_qwoo0_1a4vh_99:not(#\9) {
191
191
  position: absolute;
192
192
  display: none;
193
193
  z-index: 2000;
@@ -195,24 +195,24 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
195
195
  user-select: none;
196
196
  transform-origin: top;
197
197
  }
198
- .awsui_dropdown_qwoo0_3gt2b_99.awsui_use-portal_qwoo0_3gt2b_196:not(#\9) {
198
+ .awsui_dropdown_qwoo0_1a4vh_99.awsui_use-portal_qwoo0_1a4vh_196:not(#\9) {
199
199
  z-index: 7000;
200
200
  }
201
- .awsui_dropdown_qwoo0_3gt2b_99:not(#\9):not(.awsui_interior_qwoo0_3gt2b_185) {
201
+ .awsui_dropdown_qwoo0_1a4vh_99:not(#\9):not(.awsui_interior_qwoo0_1a4vh_185) {
202
202
  transform: translateY(0px);
203
203
  transition: transform var(--motion-duration-show-quick-aq3ump, 135ms);
204
204
  }
205
205
  @media (prefers-reduced-motion: reduce) {
206
- .awsui_dropdown_qwoo0_3gt2b_99:not(#\9):not(.awsui_interior_qwoo0_3gt2b_185) {
206
+ .awsui_dropdown_qwoo0_1a4vh_99:not(#\9):not(.awsui_interior_qwoo0_1a4vh_185) {
207
207
  animation: none;
208
208
  transition: none;
209
209
  }
210
210
  }
211
- .awsui-motion-disabled .awsui_dropdown_qwoo0_3gt2b_99:not(#\9):not(.awsui_interior_qwoo0_3gt2b_185), .awsui-mode-entering .awsui_dropdown_qwoo0_3gt2b_99:not(#\9):not(.awsui_interior_qwoo0_3gt2b_185) {
211
+ .awsui-motion-disabled .awsui_dropdown_qwoo0_1a4vh_99:not(#\9):not(.awsui_interior_qwoo0_1a4vh_185), .awsui-mode-entering .awsui_dropdown_qwoo0_1a4vh_99:not(#\9):not(.awsui_interior_qwoo0_1a4vh_185) {
212
212
  animation: none;
213
213
  transition: none;
214
214
  }
215
- .awsui_dropdown-content-wrapper_qwoo0_3gt2b_99:not(#\9) {
215
+ .awsui_dropdown-content-wrapper_qwoo0_1a4vh_99:not(#\9) {
216
216
  position: relative;
217
217
  background-color: var(--color-background-dropdown-item-default-be16w5, #ffffff);
218
218
  outline: none;
@@ -224,7 +224,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
224
224
  border-block: var(--border-divider-list-width-27y3k5, 1px) solid var(--color-border-container-top-736buh, transparent);
225
225
  box-sizing: border-box;
226
226
  }
227
- .awsui_dropdown-content-wrapper_qwoo0_3gt2b_99:not(#\9)::after {
227
+ .awsui_dropdown-content-wrapper_qwoo0_1a4vh_99:not(#\9)::after {
228
228
  content: "";
229
229
  position: absolute;
230
230
  z-index: 1;
@@ -242,70 +242,76 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
242
242
  pointer-events: none;
243
243
  }
244
244
  @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
245
- .awsui_dropdown-content-wrapper_qwoo0_3gt2b_99:not(#\9) {
245
+ .awsui_dropdown-content-wrapper_qwoo0_1a4vh_99:not(#\9) {
246
246
  border-block: var(--border-field-width-09w7vk, 2px) solid var(--color-border-container-top-736buh, transparent);
247
247
  border-inline: var(--border-field-width-09w7vk, 2px) solid var(--color-border-container-top-736buh, transparent);
248
248
  }
249
249
  }
250
- .awsui_dropdown-content-wrapper_qwoo0_3gt2b_99.awsui_is-empty_qwoo0_3gt2b_248:not(#\9)::after {
250
+ .awsui_dropdown-content-wrapper_qwoo0_1a4vh_99.awsui_is-empty_qwoo0_1a4vh_248:not(#\9)::after {
251
251
  display: none;
252
252
  }
253
- .awsui_dropdown_qwoo0_3gt2b_99 > .awsui_dropdown-content-wrapper_qwoo0_3gt2b_99:not(#\9) {
253
+ .awsui_dropdown_qwoo0_1a4vh_99 > .awsui_dropdown-content-wrapper_qwoo0_1a4vh_99:not(#\9) {
254
254
  border-block-start: var(--border-divider-list-width-27y3k5, 1px) solid var(--color-border-container-top-736buh, transparent);
255
255
  border-block-end: var(--border-divider-list-width-27y3k5, 1px) solid var(--color-border-dropdown-group-yakmix, #b6bec9);
256
256
  }
257
- .awsui_dropdown-drop-up_qwoo0_3gt2b_255 > .awsui_dropdown-content-wrapper_qwoo0_3gt2b_99:not(#\9) {
257
+ .awsui_dropdown-drop-up_qwoo0_1a4vh_255 > .awsui_dropdown-content-wrapper_qwoo0_1a4vh_99:not(#\9) {
258
258
  transform-origin: bottom;
259
259
  box-shadow: var(--shadow-dropup-xqkiza, 0px 4px 20px 1px rgba(0, 7, 22, 0.1));
260
260
  }
261
- .awsui_dropdown-drop-up_qwoo0_3gt2b_255.awsui_with-limited-width_qwoo0_3gt2b_259 > .awsui_dropdown-content-wrapper_qwoo0_3gt2b_99:not(#\9) {
261
+ .awsui_dropdown-drop-up_qwoo0_1a4vh_255.awsui_with-limited-width_qwoo0_1a4vh_259 > .awsui_dropdown-content-wrapper_qwoo0_1a4vh_99:not(#\9) {
262
262
  border-block-start: none;
263
263
  }
264
- .awsui_dropdown-drop-left_qwoo0_3gt2b_262:not(#\9) {
264
+ .awsui_dropdown-drop-left_qwoo0_1a4vh_262:not(#\9) {
265
265
  inset-inline-end: 0;
266
266
  }
267
- .awsui_dropdown-drop-left_qwoo0_3gt2b_262:not(#\9):dir(rtl) {
267
+ .awsui_dropdown-drop-left_qwoo0_1a4vh_262:not(#\9):dir(rtl) {
268
268
  inset-inline-end: unset;
269
269
  }
270
- .awsui_dropdown-drop-right_qwoo0_3gt2b_268:not(#\9) {
270
+ .awsui_dropdown-drop-right_qwoo0_1a4vh_268:not(#\9) {
271
271
  inset-inline-start: 0;
272
272
  }
273
- .awsui_dropdown-drop-right_qwoo0_3gt2b_268:not(#\9):dir(rtl) {
273
+ .awsui_dropdown-drop-right_qwoo0_1a4vh_268:not(#\9):dir(rtl) {
274
274
  inset-inline-start: unset;
275
275
  }
276
- .awsui_dropdown_qwoo0_3gt2b_99.awsui_occupy-entire-width_qwoo0_3gt2b_274:not(#\9) {
276
+ .awsui_dropdown_qwoo0_1a4vh_99.awsui_occupy-entire-width_qwoo0_1a4vh_274:not(#\9) {
277
277
  min-inline-size: 100%;
278
278
  }
279
- .awsui_dropdown_qwoo0_3gt2b_99.awsui_stretch-beyond-trigger-width_qwoo0_3gt2b_277:not(#\9) {
279
+ .awsui_dropdown_qwoo0_1a4vh_99.awsui_stretch-beyond-trigger-width_qwoo0_1a4vh_277:not(#\9) {
280
280
  inline-size: max-content;
281
281
  max-inline-size: var(--awsui-dropdown-default-max-width-lgosor, 100%);
282
282
  }
283
- .awsui_dropdown_qwoo0_3gt2b_99.awsui_hide-block-border_qwoo0_3gt2b_281 > .awsui_dropdown-content-wrapper_qwoo0_3gt2b_99:not(#\9) {
284
- border-block: none;
285
- }
286
- .awsui_dropdown_qwoo0_3gt2b_99.awsui_interior_qwoo0_3gt2b_185 > .awsui_dropdown-content-wrapper_qwoo0_3gt2b_99:not(#\9) {
283
+ .awsui_dropdown_qwoo0_1a4vh_99.awsui_interior_qwoo0_1a4vh_185 > .awsui_dropdown-content-wrapper_qwoo0_1a4vh_99:not(#\9) {
287
284
  margin-block-start: -1px;
288
285
  }
289
- .awsui_dropdown_qwoo0_3gt2b_99.awsui_open_qwoo0_3gt2b_287:not(#\9) {
286
+ .awsui_dropdown_qwoo0_1a4vh_99.awsui_hide-block-border_qwoo0_1a4vh_284 > .awsui_dropdown-content-wrapper_qwoo0_1a4vh_99:not(#\9) {
287
+ border-block-start: none;
288
+ }
289
+ .awsui_dropdown_qwoo0_1a4vh_99.awsui_hide-block-border_qwoo0_1a4vh_284:not(#\9):not(.awsui_dropdown-drop-up_qwoo0_1a4vh_255) > .awsui_dropdown-content-wrapper_qwoo0_1a4vh_99 {
290
+ border-block-end: none;
291
+ }
292
+ .awsui_dropdown_qwoo0_1a4vh_99.awsui_hide-block-border_qwoo0_1a4vh_284.awsui_refresh_qwoo0_1a4vh_120 > .awsui_dropdown-content-wrapper_qwoo0_1a4vh_99:not(#\9) {
293
+ border-block-end: none;
294
+ }
295
+ .awsui_dropdown_qwoo0_1a4vh_99.awsui_open_qwoo0_1a4vh_293:not(#\9) {
290
296
  display: block;
291
297
  }
292
- .awsui_dropdown_qwoo0_3gt2b_99.awsui_open_qwoo0_3gt2b_287:not(#\9):not(.awsui_interior_qwoo0_3gt2b_185).awsui_refresh_qwoo0_3gt2b_120[data-animating=true] {
298
+ .awsui_dropdown_qwoo0_1a4vh_99.awsui_open_qwoo0_1a4vh_293:not(#\9):not(.awsui_interior_qwoo0_1a4vh_185).awsui_refresh_qwoo0_1a4vh_120[data-animating=true] {
293
299
  transform: translateY(4px);
294
300
  }
295
- .awsui_dropdown_qwoo0_3gt2b_99.awsui_open_qwoo0_3gt2b_287:not(#\9):not(.awsui_interior_qwoo0_3gt2b_185).awsui_refresh_qwoo0_3gt2b_120[data-animating=true].awsui_dropdown-drop-up_qwoo0_3gt2b_255 {
301
+ .awsui_dropdown_qwoo0_1a4vh_99.awsui_open_qwoo0_1a4vh_293:not(#\9):not(.awsui_interior_qwoo0_1a4vh_185).awsui_refresh_qwoo0_1a4vh_120[data-animating=true].awsui_dropdown-drop-up_qwoo0_1a4vh_255 {
296
302
  transform: translateY(-4px);
297
303
  }
298
- .awsui_dropdown_qwoo0_3gt2b_99.awsui_open_qwoo0_3gt2b_287.awsui_nowrap_qwoo0_3gt2b_296:not(#\9) {
304
+ .awsui_dropdown_qwoo0_1a4vh_99.awsui_open_qwoo0_1a4vh_293.awsui_nowrap_qwoo0_1a4vh_302:not(#\9) {
299
305
  white-space: nowrap;
300
306
  overflow: scroll;
301
307
  }
302
308
 
303
- .awsui_dropdown-content_qwoo0_3gt2b_99:not(#\9) {
309
+ .awsui_dropdown-content_qwoo0_1a4vh_99:not(#\9) {
304
310
  display: flex;
305
311
  flex-direction: column;
306
312
  inline-size: 100%;
307
313
  }
308
314
 
309
- .awsui_stretch-trigger-height_qwoo0_3gt2b_307:not(#\9) {
315
+ .awsui_stretch-trigger-height_qwoo0_1a4vh_313:not(#\9) {
310
316
  block-size: 100%;
311
317
  }
@@ -2,25 +2,25 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "dropdown-content-wrapper": "awsui_dropdown-content-wrapper_qwoo0_3gt2b_99",
6
- "awsui-motion-fade-in-dropdown": "awsui_awsui-motion-fade-in-dropdown_qwoo0_3gt2b_1",
7
- "refresh": "awsui_refresh_qwoo0_3gt2b_120",
8
- "awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_qwoo0_3gt2b_1",
9
- "root": "awsui_root_qwoo0_3gt2b_149",
10
- "interior": "awsui_interior_qwoo0_3gt2b_185",
11
- "dropdown": "awsui_dropdown_qwoo0_3gt2b_99",
12
- "use-portal": "awsui_use-portal_qwoo0_3gt2b_196",
13
- "is-empty": "awsui_is-empty_qwoo0_3gt2b_248",
14
- "dropdown-drop-up": "awsui_dropdown-drop-up_qwoo0_3gt2b_255",
15
- "with-limited-width": "awsui_with-limited-width_qwoo0_3gt2b_259",
16
- "dropdown-drop-left": "awsui_dropdown-drop-left_qwoo0_3gt2b_262",
17
- "dropdown-drop-right": "awsui_dropdown-drop-right_qwoo0_3gt2b_268",
18
- "occupy-entire-width": "awsui_occupy-entire-width_qwoo0_3gt2b_274",
19
- "stretch-beyond-trigger-width": "awsui_stretch-beyond-trigger-width_qwoo0_3gt2b_277",
20
- "hide-block-border": "awsui_hide-block-border_qwoo0_3gt2b_281",
21
- "open": "awsui_open_qwoo0_3gt2b_287",
22
- "nowrap": "awsui_nowrap_qwoo0_3gt2b_296",
23
- "dropdown-content": "awsui_dropdown-content_qwoo0_3gt2b_99",
24
- "stretch-trigger-height": "awsui_stretch-trigger-height_qwoo0_3gt2b_307"
5
+ "dropdown-content-wrapper": "awsui_dropdown-content-wrapper_qwoo0_1a4vh_99",
6
+ "awsui-motion-fade-in-dropdown": "awsui_awsui-motion-fade-in-dropdown_qwoo0_1a4vh_1",
7
+ "refresh": "awsui_refresh_qwoo0_1a4vh_120",
8
+ "awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_qwoo0_1a4vh_1",
9
+ "root": "awsui_root_qwoo0_1a4vh_149",
10
+ "interior": "awsui_interior_qwoo0_1a4vh_185",
11
+ "dropdown": "awsui_dropdown_qwoo0_1a4vh_99",
12
+ "use-portal": "awsui_use-portal_qwoo0_1a4vh_196",
13
+ "is-empty": "awsui_is-empty_qwoo0_1a4vh_248",
14
+ "dropdown-drop-up": "awsui_dropdown-drop-up_qwoo0_1a4vh_255",
15
+ "with-limited-width": "awsui_with-limited-width_qwoo0_1a4vh_259",
16
+ "dropdown-drop-left": "awsui_dropdown-drop-left_qwoo0_1a4vh_262",
17
+ "dropdown-drop-right": "awsui_dropdown-drop-right_qwoo0_1a4vh_268",
18
+ "occupy-entire-width": "awsui_occupy-entire-width_qwoo0_1a4vh_274",
19
+ "stretch-beyond-trigger-width": "awsui_stretch-beyond-trigger-width_qwoo0_1a4vh_277",
20
+ "hide-block-border": "awsui_hide-block-border_qwoo0_1a4vh_284",
21
+ "open": "awsui_open_qwoo0_1a4vh_293",
22
+ "nowrap": "awsui_nowrap_qwoo0_1a4vh_302",
23
+ "dropdown-content": "awsui_dropdown-content_qwoo0_1a4vh_99",
24
+ "stretch-trigger-height": "awsui_stretch-trigger-height_qwoo0_1a4vh_313"
25
25
  };
26
26
 
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export declare const ContainerHeaderContextProvider: ({ children }: {
3
+ children?: React.ReactNode;
4
+ }) => JSX.Element;
5
+ export declare const useContainerHeader: () => boolean;
6
+ //# sourceMappingURL=container-header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container-header.d.ts","sourceRoot":"","sources":["../../../../src/internal/context/container-header.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAOzD,eAAO,MAAM,8BAA8B;eAA+B,MAAM,SAAS;iBAExF,CAAC;AACF,eAAO,MAAM,kBAAkB,eAG9B,CAAC"}
@@ -0,0 +1,12 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import React, { createContext, useContext } from 'react';
4
+ const ContainerHeaderContext = createContext({ isInContainer: false });
5
+ export const ContainerHeaderContextProvider = ({ children }) => {
6
+ return React.createElement(ContainerHeaderContext.Provider, { value: { isInContainer: true } }, children);
7
+ };
8
+ export const useContainerHeader = () => {
9
+ const { isInContainer } = useContext(ContainerHeaderContext);
10
+ return isInContainer;
11
+ };
12
+ //# sourceMappingURL=container-header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container-header.js","sourceRoot":"","sources":["../../../../src/internal/context/container-header.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAMzD,MAAM,sBAAsB,GAAG,aAAa,CAA8B,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC;AACpG,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,EAAE,QAAQ,EAAkC,EAAE,EAAE;IAC7F,OAAO,oBAAC,sBAAsB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,IAAG,QAAQ,CAAmC,CAAC;AACvH,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAC;IAC7D,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { createContext, useContext } from 'react';\n\ninterface ContainerHeaderContextProps {\n isInContainer: boolean;\n}\n\nconst ContainerHeaderContext = createContext<ContainerHeaderContextProps>({ isInContainer: false });\nexport const ContainerHeaderContextProvider = ({ children }: { children?: React.ReactNode }) => {\n return <ContainerHeaderContext.Provider value={{ isInContainer: true }}>{children}</ContainerHeaderContext.Provider>;\n};\nexport const useContainerHeader = () => {\n const { isInContainer } = useContext(ContainerHeaderContext);\n return isInContainer;\n};\n"]}
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (171737fc)";
2
+ export var PACKAGE_VERSION = "3.0.0 (383a3c62)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (171737fc)",
3
+ "PACKAGE_VERSION": "3.0.0 (383a3c62)",
4
4
  "THEME": "default",
5
5
  "ALWAYS_VISUAL_REFRESH": false
6
6
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "171737fcd311f46b4887528dba9e9748f166e52d"
2
+ "commit": "383a3c62e6498fa24ab5d45b2a4230fdc5aa5a8b"
3
3
  }
@@ -1 +1 @@
1
- {"version":3,"file":"data-series.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/data-series.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAG9F,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAQ3F,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,IAAI,EAAE,GAAG,GAAG,GAAG,CAAC;IAEhB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAElB,iBAAiB,EAAE,sBAAsB,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAChE,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IAErC,WAAW,EAAE,OAAO,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAE3B,aAAa,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,CAAC,SAAS,cAAc,EAAE,EAC3D,IAAI,EACJ,UAAU,EACV,SAAS,EACT,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,MAAM,EACN,MAAM,GACP,EAAE,eAAe,CAAC,CAAC,CAAC,eAoFpB"}
1
+ {"version":3,"file":"data-series.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/data-series.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAG9F,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAQ3F,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,IAAI,EAAE,GAAG,GAAG,GAAG,CAAC;IAEhB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAElB,iBAAiB,EAAE,sBAAsB,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAChE,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IAErC,WAAW,EAAE,OAAO,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAE3B,aAAa,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,CAAC,SAAS,cAAc,EAAE,EAC3D,IAAI,EACJ,UAAU,EACV,SAAS,EACT,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,MAAM,EACN,MAAM,GACP,EAAE,eAAe,CAAC,CAAC,CAAC,eAsFpB"}
@@ -22,6 +22,9 @@ export default function DataSeries({ axis, plotHeight, plotWidth, highlightedGro
22
22
  if (series.type === 'bar') {
23
23
  barData.push(series.data);
24
24
  }
25
+ else {
26
+ barData.push([]);
27
+ }
25
28
  });
26
29
  return calculateOffsetMaps(barData);
27
30
  }, [visibleSeries, stackedBars]);
@@ -1 +1 @@
1
- {"version":3,"file":"data-series.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/data-series.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,SAAS,MAAM,cAAc,CAAC;AAGrC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAkB,MAAM,SAAS,CAAC;AAE9D,qEAAqE;AACrE,MAAM,YAAY,GAAG,CAAC,CAAC;AAmBvB,MAAM,CAAC,OAAO,UAAU,UAAU,CAA2B,EAC3D,IAAI,EACJ,UAAU,EACV,SAAS,EACT,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,MAAM,EACN,MAAM,GACa;IACnB,MAAM,iBAAiB,GAAG,WAAW,CAAC,yCAAyC,CAAC,CAAC;IAEjF,yHAAyH;IACzH,MAAM,gBAAgB,GAAG,WAAW,CAAC,+BAA+B,CAAC,CAAC;IAEtE,MAAM,oBAAoB,GAAqB,OAAO,CAAC,GAAG,EAAE;QAC1D,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO,EAAE,CAAC;SACX;QAED,MAAM,OAAO,GAAmE,EAAE,CAAC;QACnF,aAAa,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;YACnC,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK,EAAE;gBAC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CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,EAAE,QAAQ;yBACrC,CAAC;wBAEF,oBAAC,UAAU,IACT,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,gBAAgB,GACnC,CACA,CACL,CAAC;iBACH;gBAED,KAAK,KAAK;oBACR,OAAO,CACL,oBAAC,SAAS,IACR,GAAG,EAAE,KAAK,EACV,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,MAAM,EAC3E,WAAW,EAAE,KAAK,EAClB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAC/C,WAAW,EAAE,aAAa,EAC1B,MAAM,EAAE,QAAQ,EAChB,iBAAiB,EAAE,iBAAiB,EACpC,iBAAiB,EAAE,oBAAoB,CAAC,KAAK,CAAC,EAC9C,qBAAqB,EAAE,qBAAqB,GAC5C,CACH,CAAC;aACL;QACH,CAAC,CAAC,CACA,CACH,CACJ,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useMemo } from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { ChartScale, NumericChartScale } from '../internal/components/cartesian-chart/scales';\nimport LineSeries from './line-series';\nimport BarSeries from './bar-series';\nimport { ChartDataTypes, InternalChartSeries, MixedLineBarChartProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport { calculateOffsetMaps, StackedOffsets } from './utils';\n\n// Should have the same value as the `border-line-chart-width` token.\nconst STROKE_WIDTH = 2;\n\nexport interface DataSeriesProps<T> {\n axis: 'x' | 'y';\n\n plotHeight: number;\n plotWidth: number;\n\n highlightedSeries: MixedLineBarChartProps.ChartSeries<T> | null;\n highlightedGroupIndex: number | null;\n\n stackedBars: boolean;\n isGroupNavigation: boolean;\n\n visibleSeries: ReadonlyArray<InternalChartSeries<T>>;\n xScale: ChartScale;\n yScale: NumericChartScale;\n}\n\nexport default function DataSeries<T extends ChartDataTypes>({\n axis,\n plotHeight,\n plotWidth,\n highlightedGroupIndex,\n highlightedSeries,\n stackedBars,\n isGroupNavigation,\n visibleSeries,\n xScale,\n yScale,\n}: DataSeriesProps<T>) {\n const chartAreaClipPath = useUniqueId('awsui-mixed-line-bar-chart__chart-area-');\n\n // Lines get a small extra space at the top and bottom to account for the strokes when they are at the edge of the graph.\n const lineAreaClipPath = useUniqueId('awsui-line-chart__chart-area-');\n\n const stackedBarOffsetMaps: StackedOffsets[] = useMemo(() => {\n if (!stackedBars) {\n return [];\n }\n\n const barData: Array<readonly MixedLineBarChartProps.Datum<ChartDataTypes>[]> = [];\n visibleSeries.forEach(({ series }) => {\n if (series.type === 'bar') {\n barData.push(series.data);\n }\n });\n return calculateOffsetMaps(barData);\n }, [visibleSeries, stackedBars]);\n\n return (\n <>\n <defs aria-hidden=\"true\">\n <clipPath id={chartAreaClipPath}>\n <rect x={0} y={0} width={plotWidth} height={plotHeight} />\n </clipPath>\n <clipPath id={lineAreaClipPath}>\n <rect x={0} y={-STROKE_WIDTH / 2} width={plotWidth} height={plotHeight + STROKE_WIDTH} />\n </clipPath>\n </defs>\n <g aria-hidden={isGroupNavigation ? true : undefined} role=\"group\">\n {visibleSeries.map(({ series, color }, index) => {\n const isHighlighted = series === highlightedSeries;\n const isDimmed = !!highlightedSeries && !isHighlighted;\n\n switch (series.type) {\n case 'line':\n case 'threshold': {\n return (\n <g\n key={index}\n role=\"group\"\n aria-label={series.title}\n className={clsx(styles.series, styles[`series--${series.type}`], {\n [styles['series--highlighted']]: isHighlighted,\n [styles['series--dimmed']]: isDimmed,\n })}\n >\n <LineSeries\n axis={axis}\n series={series}\n color={color}\n xScale={xScale}\n yScale={yScale}\n chartAreaClipPath={lineAreaClipPath}\n />\n </g>\n );\n }\n\n case 'bar':\n return (\n <BarSeries\n key={index}\n axis={axis}\n series={series}\n color={color}\n totalSeriesCount={visibleSeries.filter(s => s.series.type === 'bar').length}\n seriesIndex={index}\n xScale={xScale}\n yScale={yScale}\n plotSize={axis === 'y' ? plotWidth : plotHeight}\n highlighted={isHighlighted}\n dimmed={isDimmed}\n chartAreaClipPath={chartAreaClipPath}\n stackedBarOffsets={stackedBarOffsetMaps[index]}\n highlightedGroupIndex={highlightedGroupIndex}\n />\n );\n }\n })}\n </g>\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"data-series.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/data-series.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,SAAS,MAAM,cAAc,CAAC;AAGrC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAkB,MAAM,SAAS,CAAC;AAE9D,qEAAqE;AACrE,MAAM,YAAY,GAAG,CAAC,CAAC;AAmBvB,MAAM,CAAC,OAAO,UAAU,UAAU,CAA2B,EAC3D,IAAI,EACJ,UAAU,EACV,SAAS,EACT,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,MAAM,EACN,MAAM,GACa;IACnB,MAAM,iBAAiB,GAAG,WAAW,CAAC,yCAAyC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qBAAqB,EAAE,qBAAqB,GAC5C,CACH,CAAC;aACL;QACH,CAAC,CAAC,CACA,CACH,CACJ,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useMemo } from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { ChartScale, NumericChartScale } from '../internal/components/cartesian-chart/scales';\nimport LineSeries from './line-series';\nimport BarSeries from './bar-series';\nimport { ChartDataTypes, InternalChartSeries, MixedLineBarChartProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport { calculateOffsetMaps, StackedOffsets } from './utils';\n\n// Should have the same value as the `border-line-chart-width` token.\nconst STROKE_WIDTH = 2;\n\nexport interface DataSeriesProps<T> {\n axis: 'x' | 'y';\n\n plotHeight: number;\n plotWidth: number;\n\n highlightedSeries: MixedLineBarChartProps.ChartSeries<T> | null;\n highlightedGroupIndex: number | null;\n\n stackedBars: boolean;\n isGroupNavigation: boolean;\n\n visibleSeries: ReadonlyArray<InternalChartSeries<T>>;\n xScale: ChartScale;\n yScale: NumericChartScale;\n}\n\nexport default function DataSeries<T extends ChartDataTypes>({\n axis,\n plotHeight,\n plotWidth,\n highlightedGroupIndex,\n highlightedSeries,\n stackedBars,\n isGroupNavigation,\n visibleSeries,\n xScale,\n yScale,\n}: DataSeriesProps<T>) {\n const chartAreaClipPath = useUniqueId('awsui-mixed-line-bar-chart__chart-area-');\n\n // Lines get a small extra space at the top and bottom to account for the strokes when they are at the edge of the graph.\n const lineAreaClipPath = useUniqueId('awsui-line-chart__chart-area-');\n\n const stackedBarOffsetMaps: StackedOffsets[] = useMemo(() => {\n if (!stackedBars) {\n return [];\n }\n\n const barData: Array<readonly MixedLineBarChartProps.Datum<ChartDataTypes>[]> = [];\n visibleSeries.forEach(({ series }) => {\n if (series.type === 'bar') {\n barData.push(series.data);\n } else {\n barData.push([]);\n }\n });\n return calculateOffsetMaps(barData);\n }, [visibleSeries, stackedBars]);\n\n return (\n <>\n <defs aria-hidden=\"true\">\n <clipPath id={chartAreaClipPath}>\n <rect x={0} y={0} width={plotWidth} height={plotHeight} />\n </clipPath>\n <clipPath id={lineAreaClipPath}>\n <rect x={0} y={-STROKE_WIDTH / 2} width={plotWidth} height={plotHeight + STROKE_WIDTH} />\n </clipPath>\n </defs>\n <g aria-hidden={isGroupNavigation ? true : undefined} role=\"group\">\n {visibleSeries.map(({ series, color }, index) => {\n const isHighlighted = series === highlightedSeries;\n const isDimmed = !!highlightedSeries && !isHighlighted;\n\n switch (series.type) {\n case 'line':\n case 'threshold': {\n return (\n <g\n key={index}\n role=\"group\"\n aria-label={series.title}\n className={clsx(styles.series, styles[`series--${series.type}`], {\n [styles['series--highlighted']]: isHighlighted,\n [styles['series--dimmed']]: isDimmed,\n })}\n >\n <LineSeries\n axis={axis}\n series={series}\n color={color}\n xScale={xScale}\n yScale={yScale}\n chartAreaClipPath={lineAreaClipPath}\n />\n </g>\n );\n }\n\n case 'bar':\n return (\n <BarSeries\n key={index}\n axis={axis}\n series={series}\n color={color}\n totalSeriesCount={visibleSeries.filter(s => s.series.type === 'bar').length}\n seriesIndex={index}\n xScale={xScale}\n yScale={yScale}\n plotSize={axis === 'y' ? plotWidth : plotHeight}\n highlighted={isHighlighted}\n dimmed={isDimmed}\n chartAreaClipPath={chartAreaClipPath}\n stackedBarOffsets={stackedBarOffsetMaps[index]}\n highlightedGroupIndex={highlightedGroupIndex}\n />\n );\n }\n })}\n </g>\n </>\n );\n}\n"]}
package/package.json CHANGED
@@ -116,7 +116,7 @@
116
116
  "./internal/base-component/index.js",
117
117
  "./internal/base-component/styles.css.js"
118
118
  ],
119
- "version": "3.0.611",
119
+ "version": "3.0.613",
120
120
  "repository": {
121
121
  "type": "git",
122
122
  "url": "https://github.com/cloudscape-design/components.git"
@@ -20,7 +20,7 @@ export const TableTdElement = React.forwardRef(({ className, style, children, wr
20
20
  const cellRefObject = useRef(null);
21
21
  const mergedRef = useMergeRefs(stickyStyles.ref, ref, cellRefObject);
22
22
  const { tabIndex: cellTabIndex } = useSingleTabStopNavigation(cellRefObject);
23
- return (React.createElement(Element, Object.assign({ style: Object.assign(Object.assign({}, style), stickyStyles.style), className: clsx(className, styles['body-cell'], wrapLines && styles['body-cell-wrap'], isFirstRow && styles['body-cell-first-row'], isLastRow && styles['body-cell-last-row'], isSelected && styles['body-cell-selected'], isNextSelected && styles['body-cell-next-selected'], isPrevSelected && styles['body-cell-prev-selected'], !isEvenRow && stripedRows && styles['body-cell-shaded'], stripedRows && styles['has-striped-rows'], isVisualRefresh && styles['is-visual-refresh'], hasSelection && styles['has-selection'], hasFooter && styles['has-footer'], level !== undefined && styles['body-cell-expandable'], level !== undefined && styles[`body-cell-expandable-level-${getLevelClassSuffix(level)}`], stickyStyles.className), onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, ref: mergedRef }, nativeAttributes, { tabIndex: cellTabIndex }),
23
+ return (React.createElement(Element, Object.assign({ style: Object.assign(Object.assign({}, style), stickyStyles.style), className: clsx(className, styles['body-cell'], wrapLines && styles['body-cell-wrap'], isFirstRow && styles['body-cell-first-row'], isLastRow && styles['body-cell-last-row'], isSelected && styles['body-cell-selected'], isNextSelected && styles['body-cell-next-selected'], isPrevSelected && styles['body-cell-prev-selected'], !isEvenRow && stripedRows && styles['body-cell-shaded'], stripedRows && styles['has-striped-rows'], isVisualRefresh && styles['is-visual-refresh'], hasSelection && styles['has-selection'], hasFooter && styles['has-footer'], level !== undefined && styles['body-cell-expandable'], level !== undefined && styles[`body-cell-expandable-level-${getLevelClassSuffix(level)}`], stickyStyles.className), onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, ref: mergedRef }, nativeAttributes, { tabIndex: cellTabIndex === -1 ? undefined : cellTabIndex }),
24
24
  level !== undefined && isExpandable && (React.createElement("div", { className: styles['expandable-toggle-wrapper'] },
25
25
  React.createElement(ExpandToggleButton, { isExpanded: isExpanded, onExpandableItemToggle: onExpandableItemToggle, expandButtonLabel: expandButtonLabel, collapseButtonLabel: collapseButtonLabel }))),
26
26
  React.createElement("span", { className: styles['body-cell-content'] }, children)));
@@ -1 +1 @@
1
- {"version":3,"file":"td-element.js","sourceRoot":"","sources":["../../../../src/table/body-cell/td-element.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAsB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAa,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2DAA2D,CAAC;AACvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAqC7E,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAC5C,CACE,EACE,SAAS,EACT,KAAK,EACL,QAAQ,EACR,SAAS,EACT,WAAW,EACX,UAAU,EACV,SAAS,EACT,UAAU,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,WAAW,EACX,eAAe,EACf,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,SAAS,EACT,KAAK,EACL,YAAY,EACZ,UAAU,EACV,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,GACpB,EACD,GAAG,EACH,EAAE;IACF,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAE1C,gBAAgB,mC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IAAI,MAAM,CAAC,8BAA8B,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC,EACzF,YAAY,CAAC,SAAS,CACvB,EACD,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,SAAS,IACV,gBAAgB,IACpB,QAAQ,EAAE,YAAY;QAErB,KAAK,KAAK,SAAS,IAAI,YAAY,IAAI,CACtC,6BAAK,SAAS,EAAE,MAAM,CAAC,2BAA2B,CAAC;YACjD,oBAAC,kBAAkB,IACjB,UAAU,EAAE,UAAU,EACtB,sBAAsB,EAAE,sBAAsB,EAC9C,iBAAiB,EAAE,iBAAiB,EACpC,mBAAmB,EAAE,mBAAmB,GACxC,CACE,CACP;QACD,8BAAM,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC,IAAG,QAAQ,CAAQ,CACvD,CACX,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,SAAS,mBAAmB,CAAC,KAAa;IACxC,OAAO,CAAC,IAAI,KAAK,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;AACnD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef } from 'react';\nimport styles from './styles.css.js';\nimport { getStickyClassNames } from '../utils';\nimport { StickyColumnsModel, useStickyCellStyles } from '../sticky-columns';\nimport { TableRole, getTableCellRoleProps } from '../table-role';\nimport { useMergeRefs } from '../../internal/hooks/use-merge-refs';\nimport { useSingleTabStopNavigation } from '../../internal/context/single-tab-stop-navigation-context';\nimport { ExpandToggleButton } from '../expandable-rows/expand-toggle-button';\n\nexport interface TableTdElementProps {\n className?: string;\n style?: React.CSSProperties;\n wrapLines: boolean | undefined;\n isRowHeader?: boolean;\n isFirstRow: boolean;\n isLastRow: boolean;\n isSelected: boolean;\n isNextSelected: boolean;\n isPrevSelected: boolean;\n nativeAttributes?: Omit<\n React.TdHTMLAttributes<HTMLTableCellElement> | React.ThHTMLAttributes<HTMLTableCellElement>,\n 'style' | 'className' | 'onClick'\n >;\n onClick?: () => void;\n onMouseEnter?: () => void;\n onMouseLeave?: () => void;\n children?: React.ReactNode;\n isEvenRow?: boolean;\n stripedRows?: boolean;\n hasSelection?: boolean;\n hasFooter?: boolean;\n columnId: PropertyKey;\n colIndex: number;\n stickyState: StickyColumnsModel;\n isVisualRefresh?: boolean;\n tableRole: TableRole;\n level?: number;\n isExpandable?: boolean;\n isExpanded?: boolean;\n onExpandableItemToggle?: () => void;\n expandButtonLabel?: string;\n collapseButtonLabel?: string;\n}\n\nexport const TableTdElement = React.forwardRef<HTMLTableCellElement, TableTdElementProps>(\n (\n {\n className,\n style,\n children,\n wrapLines,\n isRowHeader,\n isFirstRow,\n isLastRow,\n isSelected,\n isNextSelected,\n isPrevSelected,\n nativeAttributes,\n onClick,\n onMouseEnter,\n onMouseLeave,\n isEvenRow,\n stripedRows,\n isVisualRefresh,\n hasSelection,\n hasFooter,\n columnId,\n colIndex,\n stickyState,\n tableRole,\n level,\n isExpandable,\n isExpanded,\n onExpandableItemToggle,\n expandButtonLabel,\n collapseButtonLabel,\n },\n ref\n ) => {\n const Element = isRowHeader ? 'th' : 'td';\n\n nativeAttributes = { ...nativeAttributes, ...getTableCellRoleProps({ tableRole, isRowHeader, colIndex }) };\n\n const stickyStyles = useStickyCellStyles({\n stickyColumns: stickyState,\n columnId,\n getClassName: props => getStickyClassNames(styles, props),\n });\n\n const cellRefObject = useRef<HTMLTableCellElement>(null);\n const mergedRef = useMergeRefs(stickyStyles.ref, ref, cellRefObject);\n const { tabIndex: cellTabIndex } = useSingleTabStopNavigation(cellRefObject);\n\n return (\n <Element\n style={{ ...style, ...stickyStyles.style }}\n className={clsx(\n className,\n styles['body-cell'],\n wrapLines && styles['body-cell-wrap'],\n isFirstRow && styles['body-cell-first-row'],\n isLastRow && styles['body-cell-last-row'],\n isSelected && styles['body-cell-selected'],\n isNextSelected && styles['body-cell-next-selected'],\n isPrevSelected && styles['body-cell-prev-selected'],\n !isEvenRow && stripedRows && styles['body-cell-shaded'],\n stripedRows && styles['has-striped-rows'],\n isVisualRefresh && styles['is-visual-refresh'],\n hasSelection && styles['has-selection'],\n hasFooter && styles['has-footer'],\n level !== undefined && styles['body-cell-expandable'],\n level !== undefined && styles[`body-cell-expandable-level-${getLevelClassSuffix(level)}`],\n stickyStyles.className\n )}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n ref={mergedRef}\n {...nativeAttributes}\n tabIndex={cellTabIndex}\n >\n {level !== undefined && isExpandable && (\n <div className={styles['expandable-toggle-wrapper']}>\n <ExpandToggleButton\n isExpanded={isExpanded}\n onExpandableItemToggle={onExpandableItemToggle}\n expandButtonLabel={expandButtonLabel}\n collapseButtonLabel={collapseButtonLabel}\n />\n </div>\n )}\n <span className={styles['body-cell-content']}>{children}</span>\n </Element>\n );\n }\n);\n\nfunction getLevelClassSuffix(level: number) {\n return 1 <= level && level <= 9 ? level : 'next';\n}\n"]}
1
+ {"version":3,"file":"td-element.js","sourceRoot":"","sources":["../../../../src/table/body-cell/td-element.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAsB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAa,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2DAA2D,CAAC;AACvG,OAAO,EAAE,kB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AAmB,CAAC,KAAa;IACxC,OAAO,CAAC,IAAI,KAAK,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;AACnD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef } from 'react';\nimport styles from './styles.css.js';\nimport { getStickyClassNames } from '../utils';\nimport { StickyColumnsModel, useStickyCellStyles } from '../sticky-columns';\nimport { TableRole, getTableCellRoleProps } from '../table-role';\nimport { useMergeRefs } from '../../internal/hooks/use-merge-refs';\nimport { useSingleTabStopNavigation } from '../../internal/context/single-tab-stop-navigation-context';\nimport { ExpandToggleButton } from '../expandable-rows/expand-toggle-button';\n\nexport interface TableTdElementProps {\n className?: string;\n style?: React.CSSProperties;\n wrapLines: boolean | undefined;\n isRowHeader?: boolean;\n isFirstRow: boolean;\n isLastRow: boolean;\n isSelected: boolean;\n isNextSelected: boolean;\n isPrevSelected: boolean;\n nativeAttributes?: Omit<\n React.TdHTMLAttributes<HTMLTableCellElement> | React.ThHTMLAttributes<HTMLTableCellElement>,\n 'style' | 'className' | 'onClick'\n >;\n onClick?: () => void;\n onMouseEnter?: () => void;\n onMouseLeave?: () => void;\n children?: React.ReactNode;\n isEvenRow?: boolean;\n stripedRows?: boolean;\n hasSelection?: boolean;\n hasFooter?: boolean;\n columnId: PropertyKey;\n colIndex: number;\n stickyState: StickyColumnsModel;\n isVisualRefresh?: boolean;\n tableRole: TableRole;\n level?: number;\n isExpandable?: boolean;\n isExpanded?: boolean;\n onExpandableItemToggle?: () => void;\n expandButtonLabel?: string;\n collapseButtonLabel?: string;\n}\n\nexport const TableTdElement = React.forwardRef<HTMLTableCellElement, TableTdElementProps>(\n (\n {\n className,\n style,\n children,\n wrapLines,\n isRowHeader,\n isFirstRow,\n isLastRow,\n isSelected,\n isNextSelected,\n isPrevSelected,\n nativeAttributes,\n onClick,\n onMouseEnter,\n onMouseLeave,\n isEvenRow,\n stripedRows,\n isVisualRefresh,\n hasSelection,\n hasFooter,\n columnId,\n colIndex,\n stickyState,\n tableRole,\n level,\n isExpandable,\n isExpanded,\n onExpandableItemToggle,\n expandButtonLabel,\n collapseButtonLabel,\n },\n ref\n ) => {\n const Element = isRowHeader ? 'th' : 'td';\n\n nativeAttributes = { ...nativeAttributes, ...getTableCellRoleProps({ tableRole, isRowHeader, colIndex }) };\n\n const stickyStyles = useStickyCellStyles({\n stickyColumns: stickyState,\n columnId,\n getClassName: props => getStickyClassNames(styles, props),\n });\n\n const cellRefObject = useRef<HTMLTableCellElement>(null);\n const mergedRef = useMergeRefs(stickyStyles.ref, ref, cellRefObject);\n const { tabIndex: cellTabIndex } = useSingleTabStopNavigation(cellRefObject);\n\n return (\n <Element\n style={{ ...style, ...stickyStyles.style }}\n className={clsx(\n className,\n styles['body-cell'],\n wrapLines && styles['body-cell-wrap'],\n isFirstRow && styles['body-cell-first-row'],\n isLastRow && styles['body-cell-last-row'],\n isSelected && styles['body-cell-selected'],\n isNextSelected && styles['body-cell-next-selected'],\n isPrevSelected && styles['body-cell-prev-selected'],\n !isEvenRow && stripedRows && styles['body-cell-shaded'],\n stripedRows && styles['has-striped-rows'],\n isVisualRefresh && styles['is-visual-refresh'],\n hasSelection && styles['has-selection'],\n hasFooter && styles['has-footer'],\n level !== undefined && styles['body-cell-expandable'],\n level !== undefined && styles[`body-cell-expandable-level-${getLevelClassSuffix(level)}`],\n stickyStyles.className\n )}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n ref={mergedRef}\n {...nativeAttributes}\n tabIndex={cellTabIndex === -1 ? undefined : cellTabIndex}\n >\n {level !== undefined && isExpandable && (\n <div className={styles['expandable-toggle-wrapper']}>\n <ExpandToggleButton\n isExpanded={isExpanded}\n onExpandableItemToggle={onExpandableItemToggle}\n expandButtonLabel={expandButtonLabel}\n collapseButtonLabel={collapseButtonLabel}\n />\n </div>\n )}\n <span className={styles['body-cell-content']}>{children}</span>\n </Element>\n );\n }\n);\n\nfunction getLevelClassSuffix(level: number) {\n return 1 <= level && level <= 9 ? level : 'next';\n}\n"]}
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { TableProps } from '../interfaces';
3
3
  import { StickyColumnsModel } from '../sticky-columns';
4
4
  import { TableRole } from '../table-role';
5
- interface TableHeaderCellProps<ItemType> {
5
+ export interface TableHeaderCellProps<ItemType> {
6
6
  className?: string;
7
7
  style?: React.CSSProperties;
8
8
  tabIndex: number;
@@ -27,5 +27,4 @@ interface TableHeaderCellProps<ItemType> {
27
27
  isExpandable?: boolean;
28
28
  }
29
29
  export declare function TableHeaderCell<ItemType>({ className, style, tabIndex, column, activeSortingColumn, sortingDescending, sortingDisabled, wrapLines, focusedComponent, hidden, onClick, colIndex, updateColumn, resizableColumns, onResizeFinish, isEditable, columnId, stickyState, cellRef, tableRole, resizerRoleDescription, isExpandable, }: TableHeaderCellProps<ItemType>): JSX.Element;
30
- export {};
31
30
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/table/header-cell/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAGtC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAM3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI1C,UAAU,oBAAoB,CAAC,QAAQ;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC9C,mBAAmB,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAC,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S,EACT,KAAK,EACL,QAAQ,EACR,MAAM,EACN,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,MAAM,EACN,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,QAAQ,EACR,WAAW,EACX,OAAO,EACP,SAAS,EACT,sBAAsB,EACtB,YAAY,GACb,EAAE,oBAAoB,CAAC,QAAQ,CAAC,eAoGhC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/table/header-cell/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,2DAA2D,CAAC;AA2BvG,MAAM,UAAU,eAAe,CAAW,EACxC,SAAS,EACT,KAAK,EACL,QAAQ,EACR,MAAM,EACN,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,MAAM,EACN,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,QAAQ,EACR,W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B,IAAI,EAAC,KAAK,gBACE,IAAI,CAAC,gDAAgD,EAAE,MAAA,MAAM,CAAC,UAAU,0CAAE,iBAAiB,CAAC;oBAExG,oBAAC,YAAY,IAAC,IAAI,EAAC,MAAM,GAAG,CACvB,CACR,CAAC,CAAC,CAAC,IAAI,CACJ;YACL,aAAa,IAAI,CAChB,8BAAM,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC;gBACrC,oBAAC,YAAY,IAAC,IAAI,EAAE,kBAAkB,CAAC,aAAa,CAAC,GAAI,CACpD,CACR,CACG;QACL,gBAAgB,CAAC,CAAC,CAAC,CAClB,oBAAC,OAAO,IACN,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,kBAAkB,MAAM,CAAC,QAAQ,CAAC,EAAE,EAC7C,aAAa,EAAE,gBAAgB,KAAK,kBAAkB,MAAM,CAAC,QAAQ,CAAC,EAAE,EACxE,aAAa,EAAE,QAAQ,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAC3D,mBAAmB,EAAE,cAAc,EACnC,cAAc,EAAE,QAAQ,EACxB,QAAQ,EAAE,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,EAC3F,eAAe,EAAE,IAAI,CAAC,mCAAmC,EAAE,sBAAsB,CAAC,GAClF,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,OAAO,IAAC,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,GAAI,CACjD,CACc,CAClB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef } from 'react';\nimport InternalIcon from '../../icon/internal';\nimport { KeyCode } from '../../internal/keycode';\nimport { TableProps } from '../interfaces';\nimport { getSortingIconName, getSortingStatus, isSorted } from './utils';\nimport styles from './styles.css.js';\nimport { Divider, Resizer } from '../resizer';\nimport { useUniqueId } from '../../internal/hooks/use-unique-id';\nimport { useInternalI18n } from '../../i18n/context';\nimport { StickyColumnsModel } from '../sticky-columns';\nimport { TableRole } from '../table-role';\nimport { TableThElement } from './th-element';\nimport { useSingleTabStopNavigation } from '../../internal/context/single-tab-stop-navigation-context';\n\ninterface TableHeaderCellProps<ItemType> {\n className?: string;\n style?: React.CSSProperties;\n tabIndex: number;\n column: TableProps.ColumnDefinition<ItemType>;\n activeSortingColumn?: TableProps.SortingColumn<ItemType>;\n sortingDescending?: boolean;\n sortingDisabled?: boolean;\n wrapLines?: boolean;\n hidden?: boolean;\n onClick(detail: TableProps.SortingState<any>): void;\n onResizeFinish: () => void;\n colIndex: number;\n updateColumn: (columnId: PropertyKey, newWidth: number) => void;\n resizableColumns?: boolean;\n isEditable?: boolean;\n columnId: PropertyKey;\n stickyState: StickyColumnsModel;\n cellRef: React.RefCallback<HTMLElement>;\n focusedComponent?: null | string;\n tableRole: TableRole;\n resizerRoleDescription?: string;\n isExpandable?: boolean;\n}\n\nexport function TableHeaderCell<ItemType>({\n className,\n style,\n tabIndex,\n column,\n activeSortingColumn,\n sortingDescending,\n sortingDisabled,\n wrapLines,\n focusedComponent,\n hidden,\n onClick,\n colIndex,\n updateColumn,\n resizableColumns,\n onResizeFinish,\n isEditable,\n columnId,\n stickyState,\n cellRef,\n tableRole,\n resizerRoleDescription,\n isExpandable,\n}: TableHeaderCellProps<ItemType>) {\n const i18n = useInternalI18n('table');\n const sortable = !!column.sortingComparator || !!column.sortingField;\n const sorted = !!activeSortingColumn && isSorted(column, activeSortingColumn);\n const sortingStatus = getSortingStatus(sortable, sorted, !!sortingDescending, !!sortingDisabled);\n const handleClick = () =>\n onClick({\n sortingColumn: column,\n isDescending: sorted ? !sortingDescending : false,\n });\n\n // Elements with role=\"button\" do not have the default behavior of <button>, where pressing\n // Enter or Space will trigger a click event. Therefore we need to add this ourselves.\n // The native <button> element cannot be used due to a misaligned implementation in Firefox:\n // https://bugzilla.mozilla.org/show_bug.cgi?id=843003\n const handleKeyPress = ({ nativeEvent: e }: React.KeyboardEvent) => {\n if (e.keyCode === KeyCode.enter || e.keyCode === KeyCode.space) {\n e.preventDefault();\n handleClick();\n }\n };\n\n const headerId = useUniqueId('table-header-');\n\n const clickableHeaderRef = useRef<HTMLDivElement>(null);\n const { tabIndex: clickableHeaderTabIndex } = useSingleTabStopNavigation(clickableHeaderRef, { tabIndex });\n\n return (\n <TableThElement\n className={className}\n style={style}\n cellRef={cellRef}\n sortingStatus={sortingStatus}\n sortingDisabled={sortingDisabled}\n focusedComponent={focusedComponent}\n hidden={hidden}\n colIndex={colIndex}\n columnId={columnId}\n stickyState={stickyState}\n tableRole={tableRole}\n >\n <div\n ref={clickableHeaderRef}\n data-focus-id={`sorting-control-${String(columnId)}`}\n className={clsx(styles['header-cell-content'], {\n [styles['header-cell-fake-focus']]: focusedComponent === `sorting-control-${String(columnId)}`,\n [styles['header-cell-content-expandable']]: isExpandable,\n })}\n aria-label={\n column.ariaLabel\n ? column.ariaLabel({\n sorted: sorted,\n descending: sorted && !!sortingDescending,\n disabled: !!sortingDisabled,\n })\n : undefined\n }\n {...(sortingStatus && !sortingDisabled\n ? {\n onKeyPress: handleKeyPress,\n tabIndex: clickableHeaderTabIndex,\n role: 'button',\n onClick: handleClick,\n }\n : {})}\n >\n <div className={clsx(styles['header-cell-text'], wrapLines && styles['header-cell-text-wrap'])} id={headerId}>\n {column.header}\n {isEditable && !isExpandable ? (\n <span\n className={styles['edit-icon']}\n role=\"img\"\n aria-label={i18n('columnDefinitions.editConfig.editIconAriaLabel', column.editConfig?.editIconAriaLabel)}\n >\n <InternalIcon name=\"edit\" />\n </span>\n ) : null}\n </div>\n {sortingStatus && (\n <span className={styles['sorting-icon']}>\n <InternalIcon name={getSortingIconName(sortingStatus)} />\n </span>\n )}\n </div>\n {resizableColumns ? (\n <Resizer\n tabIndex={tabIndex}\n focusId={`resize-control-${String(columnId)}`}\n showFocusRing={focusedComponent === `resize-control-${String(columnId)}`}\n onWidthUpdate={newWidth => updateColumn(columnId, newWidth)}\n onWidthUpdateCommit={onResizeFinish}\n ariaLabelledby={headerId}\n minWidth={typeof column.minWidth === 'string' ? parseInt(column.minWidth) : column.minWidth}\n roleDescription={i18n('ariaLabels.resizerRoleDescription', resizerRoleDescription)}\n />\n ) : (\n <Divider className={styles['resize-divider']} />\n )}\n </TableThElement>\n );\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/table/header-cell/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,2DAA2D,CAAC;AA2BvG,MAAM,UAAU,eAAe,CAAW,EACxC,SAAS,EACT,KAAK,EACL,QAAQ,EACR,MAAM,EACN,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,MAAM,EACN,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,QAAQ,EACR,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9B,IAAI,EAAC,KAAK,gBACE,IAAI,CAAC,gDAAgD,EAAE,MAAA,MAAM,CAAC,UAAU,0CAAE,iBAAiB,CAAC;oBAExG,oBAAC,YAAY,IAAC,IAAI,EAAC,MAAM,GAAG,CACvB,CACR,CAAC,CAAC,CAAC,IAAI,CACJ;YACL,aAAa,IAAI,CAChB,8BAAM,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC;gBACrC,oBAAC,YAAY,IAAC,IAAI,EAAE,kBAAkB,CAAC,aAAa,CAAC,GAAI,CACpD,CACR,CACG;QACL,gBAAgB,CAAC,CAAC,CAAC,CAClB,oBAAC,OAAO,IACN,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,kBAAkB,MAAM,CAAC,QAAQ,CAAC,EAAE,EAC7C,aAAa,EAAE,gBAAgB,KAAK,kBAAkB,MAAM,CAAC,QAAQ,CAAC,EAAE,EACxE,aAAa,EAAE,QAAQ,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAC3D,mBAAmB,EAAE,cAAc,EACnC,cAAc,EAAE,QAAQ,EACxB,QAAQ,EAAE,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,EAC3F,eAAe,EAAE,IAAI,CAAC,mCAAmC,EAAE,sBAAsB,CAAC,GAClF,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,OAAO,IAAC,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,GAAI,CACjD,CACc,CAClB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef } from 'react';\nimport InternalIcon from '../../icon/internal';\nimport { KeyCode } from '../../internal/keycode';\nimport { TableProps } from '../interfaces';\nimport { getSortingIconName, getSortingStatus, isSorted } from './utils';\nimport styles from './styles.css.js';\nimport { Divider, Resizer } from '../resizer';\nimport { useUniqueId } from '../../internal/hooks/use-unique-id';\nimport { useInternalI18n } from '../../i18n/context';\nimport { StickyColumnsModel } from '../sticky-columns';\nimport { TableRole } from '../table-role';\nimport { TableThElement } from './th-element';\nimport { useSingleTabStopNavigation } from '../../internal/context/single-tab-stop-navigation-context';\n\nexport interface TableHeaderCellProps<ItemType> {\n className?: string;\n style?: React.CSSProperties;\n tabIndex: number;\n column: TableProps.ColumnDefinition<ItemType>;\n activeSortingColumn?: TableProps.SortingColumn<ItemType>;\n sortingDescending?: boolean;\n sortingDisabled?: boolean;\n wrapLines?: boolean;\n hidden?: boolean;\n onClick(detail: TableProps.SortingState<any>): void;\n onResizeFinish: () => void;\n colIndex: number;\n updateColumn: (columnId: PropertyKey, newWidth: number) => void;\n resizableColumns?: boolean;\n isEditable?: boolean;\n columnId: PropertyKey;\n stickyState: StickyColumnsModel;\n cellRef: React.RefCallback<HTMLElement>;\n focusedComponent?: null | string;\n tableRole: TableRole;\n resizerRoleDescription?: string;\n isExpandable?: boolean;\n}\n\nexport function TableHeaderCell<ItemType>({\n className,\n style,\n tabIndex,\n column,\n activeSortingColumn,\n sortingDescending,\n sortingDisabled,\n wrapLines,\n focusedComponent,\n hidden,\n onClick,\n colIndex,\n updateColumn,\n resizableColumns,\n onResizeFinish,\n isEditable,\n columnId,\n stickyState,\n cellRef,\n tableRole,\n resizerRoleDescription,\n isExpandable,\n}: TableHeaderCellProps<ItemType>) {\n const i18n = useInternalI18n('table');\n const sortable = !!column.sortingComparator || !!column.sortingField;\n const sorted = !!activeSortingColumn && isSorted(column, activeSortingColumn);\n const sortingStatus = getSortingStatus(sortable, sorted, !!sortingDescending, !!sortingDisabled);\n const handleClick = () =>\n onClick({\n sortingColumn: column,\n isDescending: sorted ? !sortingDescending : false,\n });\n\n // Elements with role=\"button\" do not have the default behavior of <button>, where pressing\n // Enter or Space will trigger a click event. Therefore we need to add this ourselves.\n // The native <button> element cannot be used due to a misaligned implementation in Firefox:\n // https://bugzilla.mozilla.org/show_bug.cgi?id=843003\n const handleKeyPress = ({ nativeEvent: e }: React.KeyboardEvent) => {\n if (e.keyCode === KeyCode.enter || e.keyCode === KeyCode.space) {\n e.preventDefault();\n handleClick();\n }\n };\n\n const headerId = useUniqueId('table-header-');\n\n const clickableHeaderRef = useRef<HTMLDivElement>(null);\n const { tabIndex: clickableHeaderTabIndex } = useSingleTabStopNavigation(clickableHeaderRef, { tabIndex });\n\n return (\n <TableThElement\n className={className}\n style={style}\n cellRef={cellRef}\n sortingStatus={sortingStatus}\n sortingDisabled={sortingDisabled}\n focusedComponent={focusedComponent}\n hidden={hidden}\n colIndex={colIndex}\n columnId={columnId}\n stickyState={stickyState}\n tableRole={tableRole}\n >\n <div\n ref={clickableHeaderRef}\n data-focus-id={`sorting-control-${String(columnId)}`}\n className={clsx(styles['header-cell-content'], {\n [styles['header-cell-fake-focus']]: focusedComponent === `sorting-control-${String(columnId)}`,\n [styles['header-cell-content-expandable']]: isExpandable,\n })}\n aria-label={\n column.ariaLabel\n ? column.ariaLabel({\n sorted: sorted,\n descending: sorted && !!sortingDescending,\n disabled: !!sortingDisabled,\n })\n : undefined\n }\n {...(sortingStatus && !sortingDisabled\n ? {\n onKeyPress: handleKeyPress,\n tabIndex: clickableHeaderTabIndex,\n role: 'button',\n onClick: handleClick,\n }\n : {})}\n >\n <div className={clsx(styles['header-cell-text'], wrapLines && styles['header-cell-text-wrap'])} id={headerId}>\n {column.header}\n {isEditable && !isExpandable ? (\n <span\n className={styles['edit-icon']}\n role=\"img\"\n aria-label={i18n('columnDefinitions.editConfig.editIconAriaLabel', column.editConfig?.editIconAriaLabel)}\n >\n <InternalIcon name=\"edit\" />\n </span>\n ) : null}\n </div>\n {sortingStatus && (\n <span className={styles['sorting-icon']}>\n <InternalIcon name={getSortingIconName(sortingStatus)} />\n </span>\n )}\n </div>\n {resizableColumns ? (\n <Resizer\n tabIndex={tabIndex}\n focusId={`resize-control-${String(columnId)}`}\n showFocusRing={focusedComponent === `resize-control-${String(columnId)}`}\n onWidthUpdate={newWidth => updateColumn(columnId, newWidth)}\n onWidthUpdateCommit={onResizeFinish}\n ariaLabelledby={headerId}\n minWidth={typeof column.minWidth === 'string' ? parseInt(column.minWidth) : column.minWidth}\n roleDescription={i18n('ariaLabels.resizerRoleDescription', resizerRoleDescription)}\n />\n ) : (\n <Divider className={styles['resize-divider']} />\n )}\n </TableThElement>\n );\n}\n"]}
@@ -25,6 +25,6 @@ export function TableThElement({ className, style, sortingStatus, sortingDisable
25
25
  [styles['header-cell-ascending']]: sortingStatus === 'ascending',
26
26
  [styles['header-cell-descending']]: sortingStatus === 'descending',
27
27
  [styles['header-cell-hidden']]: hidden,
28
- }, stickyStyles.className), style: Object.assign(Object.assign({}, style), stickyStyles.style), ref: mergedRef }, getTableColHeaderRoleProps({ tableRole, sortingStatus, colIndex }), { tabIndex: cellTabIndex }), children));
28
+ }, stickyStyles.className), style: Object.assign(Object.assign({}, style), stickyStyles.style), ref: mergedRef }, getTableColHeaderRoleProps({ tableRole, sortingStatus, colIndex }), { tabIndex: cellTabIndex === -1 ? undefined : cellTabIndex }), children));
29
29
  }
30
30
  //# sourceMappingURL=th-element.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"th-element.js","sourceRoot":"","sources":["../../../../src/table/header-cell/th-element.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAsB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAa,0BAA0B,EAA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oB,CAAC,CAAC,EAAE,MAAM;SACvC,EACD,YAAY,CAAC,SAAS,CACvB,EACD,KAAK,kCAAO,KAAK,GAAK,YAAY,CAAC,KAAK,GACxC,GAAG,EAAE,SAAS,IACV,0BAA0B,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,IACtE,QAAQ,EAAE,YAAY,KAErB,QAAQ,CACN,CACN,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef } from 'react';\nimport { SortingStatus } from './utils';\nimport styles from './styles.css.js';\nimport { getStickyClassNames } from '../utils';\nimport { StickyColumnsModel, useStickyCellStyles } from '../sticky-columns';\nimport { useMergeRefs } from '../../internal/hooks/use-merge-refs';\nimport { TableRole, getTableColHeaderRoleProps } from '../table-role';\nimport { useSingleTabStopNavigation } from '../../internal/context/single-tab-stop-navigation-context';\n\ninterface TableThElementProps {\n className?: string;\n style?: React.CSSProperties;\n sortingStatus?: SortingStatus;\n sortingDisabled?: boolean;\n focusedComponent?: null | string;\n hidden?: boolean;\n colIndex: number;\n columnId: PropertyKey;\n stickyState: StickyColumnsModel;\n cellRef?: React.RefCallback<HTMLElement>;\n tableRole: TableRole;\n children: React.ReactNode;\n}\n\nexport function TableThElement({\n className,\n style,\n sortingStatus,\n sortingDisabled,\n focusedComponent,\n hidden,\n colIndex,\n columnId,\n stickyState,\n cellRef,\n tableRole,\n children,\n}: TableThElementProps) {\n const stickyStyles = useStickyCellStyles({\n stickyColumns: stickyState,\n columnId,\n getClassName: props => getStickyClassNames(styles, props),\n });\n\n const cellRefObject = useRef<HTMLTableCellElement>(null);\n const mergedRef = useMergeRefs(stickyStyles.ref, cellRef, cellRefObject);\n const { tabIndex: cellTabIndex } = useSingleTabStopNavigation(cellRefObject);\n\n return (\n <th\n data-focus-id={`header-${String(columnId)}`}\n className={clsx(\n className,\n {\n [styles['header-cell-fake-focus']]: focusedComponent === `header-${String(columnId)}`,\n [styles['header-cell-sortable']]: sortingStatus,\n [styles['header-cell-sorted']]: sortingStatus === 'ascending' || sortingStatus === 'descending',\n [styles['header-cell-disabled']]: sortingDisabled,\n [styles['header-cell-ascending']]: sortingStatus === 'ascending',\n [styles['header-cell-descending']]: sortingStatus === 'descending',\n [styles['header-cell-hidden']]: hidden,\n },\n stickyStyles.className\n )}\n style={{ ...style, ...stickyStyles.style }}\n ref={mergedRef}\n {...getTableColHeaderRoleProps({ tableRole, sortingStatus, colIndex })}\n tabIndex={cellTabIndex}\n >\n {children}\n </th>\n );\n}\n"]}
1
+ {"version":3,"file":"th-element.js","sourceRoot":"","sources":["../../../../src/table/header-cell/th-element.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAsB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAa,0BAA0B,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2DAA2D,CAAC;AAiBvG,MAAM,UAAU,cAAc,CAAC,EAC7B,SAAS,EACT,KAAK,EACL,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,OAAO,EACP,SAAS,EACT,QAAQ,GACY;IACpB,MAAM,YAAY,GAAG,mBAAmB,CAAC;QACvC,aAAa,EAAE,WAAW;QAC1B,QAAQ;QACR,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,C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: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useRef } from 'react';\nimport { SortingStatus } from './utils';\nimport styles from './styles.css.js';\nimport { getStickyClassNames } from '../utils';\nimport { StickyColumnsModel, useStickyCellStyles } from '../sticky-columns';\nimport { useMergeRefs } from '../../internal/hooks/use-merge-refs';\nimport { TableRole, getTableColHeaderRoleProps } from '../table-role';\nimport { useSingleTabStopNavigation } from '../../internal/context/single-tab-stop-navigation-context';\n\ninterface TableThElementProps {\n className?: string;\n style?: React.CSSProperties;\n sortingStatus?: SortingStatus;\n sortingDisabled?: boolean;\n focusedComponent?: null | string;\n hidden?: boolean;\n colIndex: number;\n columnId: PropertyKey;\n stickyState: StickyColumnsModel;\n cellRef?: React.RefCallback<HTMLElement>;\n tableRole: TableRole;\n children: React.ReactNode;\n}\n\nexport function TableThElement({\n className,\n style,\n sortingStatus,\n sortingDisabled,\n focusedComponent,\n hidden,\n colIndex,\n columnId,\n stickyState,\n cellRef,\n tableRole,\n children,\n}: TableThElementProps) {\n const stickyStyles = useStickyCellStyles({\n stickyColumns: stickyState,\n columnId,\n getClassName: props => getStickyClassNames(styles, props),\n });\n\n const cellRefObject = useRef<HTMLTableCellElement>(null);\n const mergedRef = useMergeRefs(stickyStyles.ref, cellRef, cellRefObject);\n const { tabIndex: cellTabIndex } = useSingleTabStopNavigation(cellRefObject);\n\n return (\n <th\n data-focus-id={`header-${String(columnId)}`}\n className={clsx(\n className,\n {\n [styles['header-cell-fake-focus']]: focusedComponent === `header-${String(columnId)}`,\n [styles['header-cell-sortable']]: sortingStatus,\n [styles['header-cell-sorted']]: sortingStatus === 'ascending' || sortingStatus === 'descending',\n [styles['header-cell-disabled']]: sortingDisabled,\n [styles['header-cell-ascending']]: sortingStatus === 'ascending',\n [styles['header-cell-descending']]: sortingStatus === 'descending',\n [styles['header-cell-hidden']]: hidden,\n },\n stickyStyles.className\n )}\n style={{ ...style, ...stickyStyles.style }}\n ref={mergedRef}\n {...getTableColHeaderRoleProps({ tableRole, sortingStatus, colIndex })}\n tabIndex={cellTabIndex === -1 ? undefined : cellTabIndex}\n >\n {children}\n </th>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"grid-navigation.d.ts","sourceRoot":"","sources":["../../../../src/table/table-role/grid-navigation.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAe,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAUhE;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,mBAAmB,eAoC/G"}
1
+ {"version":3,"file":"grid-navigation.d.ts","sourceRoot":"","sources":["../../../../src/table/table-role/grid-navigation.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAe,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAUhE;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,mBAAmB,eAoC/G"}
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import React from 'react';
4
4
  import { useEffect, useMemo } from 'react';
5
- import { defaultIsSuppressed, findTableRowByAriaRowIndex, findTableRowCellByAriaColIndex, getClosestCell, isElementDisabled, isTableCell, } from './utils';
5
+ import { defaultIsSuppressed, findTableRowByAriaRowIndex, findTableRowCellByAriaColIndex, focusNextElement, getClosestCell, isElementDisabled, isTableCell, } from './utils';
6
6
  import { KeyCode } from '../../internal/keycode';
7
7
  import { useStableCallback } from '@cloudscape-design/component-toolkit/internal';
8
8
  import { nodeBelongs } from '../../internal/utils/node-belongs';
@@ -204,13 +204,12 @@ class GridNavigationProcessor {
204
204
  return this._table;
205
205
  }
206
206
  moveFocusBy(cell, delta) {
207
- var _a;
208
207
  // For vertical moves preserve column- and element indices set by user.
209
208
  // It allows keeping indices while moving over disabled actions or cells with colspan > 1.
210
209
  if (delta.y !== 0 && delta.x === 0) {
211
210
  this.keepUserIndex = true;
212
211
  }
213
- (_a = this.getNextFocusable(cell, delta)) === null || _a === void 0 ? void 0 : _a.focus();
212
+ focusNextElement(this.getNextFocusable(cell, delta));
214
213
  }
215
214
  updateFocusTarget() {
216
215
  var _a;
@@ -1 +1 @@
1
- {"version":3,"file":"grid-navigation.js","sourceRoot":"","sources":["../../../../src/table/table-role/grid-navigation.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,8BAA8B,EAC9B,cAAc,EACd,iBAAiB,EACjB,WAAW,GACZ,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EACL,8BAA8B,GAE/B,MAAM,2DAA2D,CAAC;AAEnE;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAuB;IAC9G,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,uBAAuB,EAAE,EAAE,EAAE,CAAC,CAAC;IAExE,MAAM,cAAc,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAEnD,wGAAwG;IACxG,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,kBAAkB,EAAE;YACtB,MAAM,KAAK,GAAG,cAAc,EAAE,CAAC;YAC/B,KAAK,IAAI,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACrC;QACD,OAAO,GAAG,EAAE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,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;SAC3D;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;IAEO,iBAAiB,CAAC,MAAmB;QAC3C,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC;IAClG,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\nimport { useEffect, useMemo } from 'react';\nimport {\n defaultIsSuppressed,\n findTableRowByAriaRowIndex,\n findTableRowCellByAriaColIndex,\n getClosestCell,\n isElementDisabled,\n isTableCell,\n} from './utils';\nimport { FocusedCell, GridNavigationProps } from './interfaces';\nimport { KeyCode } from '../../internal/keycode';\nimport { useStableCallback } from '@cloudscape-design/component-toolkit/internal';\nimport { nodeBelongs } from '../../internal/utils/node-belongs';\nimport { getAllFocusables } from '../../internal/components/focus-lock/utils';\nimport {\n SingleTabStopNavigationContext,\n FocusableChangeHandler,\n} from '../../internal/context/single-tab-stop-navigation-context';\n\n/**\n * Makes table navigable with keyboard commands.\n * See grid-navigation.md\n */\nexport function GridNavigationProvider({ keyboardNavigation, pageSize, getTable, children }: GridNavigationProps) {\n const gridNavigation = useMemo(() => new GridNavigationProcessor(), []);\n\n const getTableStable = useStableCallback(getTable);\n\n // Initialize the processor with the table container assuming it is mounted synchronously and only once.\n useEffect(() => {\n if (keyboardNavigation) {\n const table = getTableStable();\n table && gridNavigation.init(table);\n }\n return () => gridNavigation.cleanup();\n }, [keyboardNavigation, gridNavigation, getTableStable]);\n\n // Notify the processor of the props change.\n useEffect(() => {\n gridNavigation.update({ pageSize });\n }, [gridNavigation, pageSize]);\n\n // Notify the processor of the new render.\n useEffect(() => {\n if (keyboardNavigation) {\n gridNavigation.refresh();\n }\n });\n\n return (\n <SingleTabStopNavigationContext.Provider\n value={{\n navigationActive: keyboardNavigation,\n registerFocusable: gridNavigation.registerFocusable,\n }}\n >\n {children}\n </SingleTabStopNavigationContext.Provider>\n );\n}\n\n/**\n * This helper encapsulates the grid navigation behaviors which are:\n * 1. Responding to keyboard commands and moving the focus accordingly;\n * 2. Muting table interactive elements for only one to be user-focusable at a time;\n * 3. Suppressing the above behaviors when focusing an element inside a dialog or when instructed explicitly.\n */\nclass GridNavigationProcessor {\n // Props\n private _pageSize = 0;\n private _table: null | HTMLTableElement = null;\n\n // State\n private focusedCell: null | FocusedCell = null;\n private keepUserIndex = false;\n private focusables = new Set<Element>();\n private focusHandlers = new Map<Element, FocusableChangeHandler>();\n private focusablesState = new WeakMap<Element, boolean>();\n private focusTarget: null | Element = null;\n\n public init(table: HTMLTableElement) {\n this._table = table;\n\n this.table.addEventListener('focusin', this.onFocusin);\n this.table.addEventListener('focusout', this.onFocusout);\n this.table.addEventListener('keydown', this.onKeydown);\n\n this.updateFocusTarget();\n\n this.cleanup = () => {\n this.table.removeEventListener('focusin', this.onFocusin);\n this.table.removeEventListener('focusout', this.onFocusout);\n this.table.removeEventListener('keydown', this.onKeydown);\n this.focusables.forEach(this.unregisterFocusable);\n };\n }\n\n public cleanup() {\n // Do nothing before initialized.\n }\n\n public update({ pageSize }: { pageSize: number }) {\n this._pageSize = pageSize;\n }\n\n public refresh() {\n // Timeout ensures the newly rendered content elements are registered.\n setTimeout(() => {\n if (this._table) {\n // Update focused cell indices in case table rows, columns, or firstIndex change.\n this.updateFocusedCell(this.focusedCell?.element);\n this.updateFocusTarget();\n }\n }, 0);\n }\n\n public registerFocusable = (focusableElement: HTMLElement, changeHandler: FocusableChangeHandler) => {\n this.focusables.add(focusableElement);\n this.focusHandlers.set(focusableElement, changeHandler);\n const isFocusable = this.focusablesState.get(focusableElement) ?? false;\n const newIsFocusable = this.focusTarget === focusableElement || this.isSuppressed(focusableElement);\n if (newIsFocusable !== isFocusable) {\n this.focusablesState.set(focusableElement, newIsFocusable);\n changeHandler(newIsFocusable);\n }\n // When newly registered element belongs to the focused cell the focus must transition to it.\n const focusedElement = this.focusedCell?.element;\n if (focusedElement && isTableCell(focusedElement) && focusedElement.contains(focusableElement)) {\n // Scroll is unnecessary when moving focus from a cell to element within the cell.\n focusableElement.focus({ preventScroll: true });\n }\n return () => this.unregisterFocusable(focusableElement);\n };\n\n public unregisterFocusable = (focusable: Element) => {\n this.focusables.delete(focusable);\n this.focusHandlers.delete(focusable);\n };\n\n private get pageSize() {\n return this._pageSize;\n }\n\n private get table(): HTMLTableElement {\n if (!this._table) {\n throw new Error('Invariant violation: GridNavigationProcessor is used before initialization.');\n }\n return this._table;\n }\n\n private onFocusin = (event: FocusEvent) => {\n if (!(event.target instanceof HTMLElement)) {\n return;\n }\n\n this.updateFocusedCell(event.target);\n if (!this.focusedCell) {\n return;\n }\n\n this.updateFocusTarget();\n\n // Focusing on cell is not eligible when it contains focusable elements in the content.\n // If content focusables are available - move the focus to the first one.\n const focusedElement = this.focusedCell.element;\n const nextTarget = isTableCell(focusedElement) ? this.getFocusablesFrom(focusedElement)[0] : null;\n if (nextTarget) {\n // Scroll is unnecessary when moving focus from a cell to element within the cell.\n nextTarget.focus({ preventScroll: true });\n } else {\n this.keepUserIndex = false;\n }\n };\n\n private onFocusout = () => {\n // When focus leaves the cell and the cell no longer belong to the table it indicates the focused element has been unmounted.\n // In that case the focus needs to be restored on the same coordinates.\n setTimeout(() => {\n if (this.focusedCell && !nodeBelongs(this.table, this.focusedCell.element)) {\n this.moveFocusBy(this.focusedCell, { x: 0, y: 0 });\n }\n }, 0);\n };\n\n private onKeydown = (event: KeyboardEvent) => {\n if (!this.focusedCell) {\n return;\n }\n\n const ctrlKey = event.ctrlKey ? 1 : 0;\n const altKey = event.altKey ? 1 : 0;\n const shiftKey = event.shiftKey ? 1 : 0;\n const metaKey = event.metaKey ? 1 : 0;\n const numModifiersPressed = ctrlKey + altKey + shiftKey + metaKey;\n\n let key = event.keyCode;\n if (numModifiersPressed === 1 && event.ctrlKey) {\n key = -key;\n } else if (numModifiersPressed) {\n return;\n }\n\n const from = this.focusedCell;\n\n if (this.isSuppressed(document.activeElement) || !this.isRegistered(document.activeElement)) {\n return;\n }\n\n switch (key) {\n case KeyCode.up:\n event.preventDefault();\n return this.moveFocusBy(from, { y: -1, x: 0 });\n\n case KeyCode.down:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 1, x: 0 });\n\n case KeyCode.left:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 0, x: -1 });\n\n case KeyCode.right:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 0, x: 1 });\n\n case KeyCode.pageUp:\n event.preventDefault();\n return this.moveFocusBy(from, { y: -this.pageSize, x: 0 });\n\n case KeyCode.pageDown:\n event.preventDefault();\n return this.moveFocusBy(from, { y: this.pageSize, x: 0 });\n\n case KeyCode.home:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 0, x: -Infinity });\n\n case KeyCode.end:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 0, x: Infinity });\n\n case -KeyCode.home:\n event.preventDefault();\n return this.moveFocusBy(from, { y: -Infinity, x: -Infinity });\n\n case -KeyCode.end:\n event.preventDefault();\n return this.moveFocusBy(from, { y: Infinity, x: Infinity });\n\n default:\n return;\n }\n };\n\n private moveFocusBy(cell: FocusedCell, delta: { x: number; y: number }) {\n // For vertical moves preserve column- and element indices set by user.\n // It allows keeping indices while moving over disabled actions or cells with colspan > 1.\n if (delta.y !== 0 && delta.x === 0) {\n this.keepUserIndex = true;\n }\n this.getNextFocusable(cell, delta)?.focus();\n }\n\n private updateFocusTarget() {\n this.focusTarget = this.getSingleFocusable();\n for (const focusableElement of this.focusables) {\n const isFocusable = this.focusablesState.get(focusableElement) ?? false;\n const newIsFocusable = this.focusTarget === focusableElement || this.isSuppressed(focusableElement);\n if (newIsFocusable !== isFocusable) {\n this.focusablesState.set(focusableElement, newIsFocusable);\n this.focusHandlers.get(focusableElement)!(newIsFocusable);\n }\n }\n }\n\n private isSuppressed(element: null | Element) {\n // Omit calculation as irrelevant until the table receives focus.\n if (!this.focusedCell) {\n return false;\n }\n return !element || defaultIsSuppressed(element);\n }\n\n private isRegistered(element: null | Element) {\n return !element || this.focusables.has(element);\n }\n\n private updateFocusedCell(focusedElement?: HTMLElement): void {\n if (!focusedElement) {\n return;\n }\n\n const cellElement = getClosestCell(focusedElement);\n const rowElement = cellElement?.closest('tr');\n if (!cellElement || !rowElement) {\n return;\n }\n\n const colIndex = parseInt(cellElement.getAttribute('aria-colindex') ?? '');\n const rowIndex = parseInt(rowElement.getAttribute('aria-rowindex') ?? '');\n if (isNaN(colIndex) || isNaN(rowIndex)) {\n return;\n }\n\n const cellFocusables = this.getFocusablesFrom(cellElement);\n const elementIndex = cellFocusables.indexOf(focusedElement);\n\n const prevColIndex = this.focusedCell?.colIndex ?? -1;\n const prevElementIndex = this.focusedCell?.elementIndex ?? -1;\n this.focusedCell = {\n rowIndex,\n colIndex: this.keepUserIndex && prevColIndex !== -1 ? prevColIndex : colIndex,\n elementIndex: this.keepUserIndex && prevElementIndex !== -1 ? prevElementIndex : elementIndex,\n element: focusedElement,\n };\n }\n\n private getNextFocusable(from: FocusedCell, delta: { y: number; x: number }) {\n // Find next row to move focus into (can be null if the top/bottom is reached).\n const targetAriaRowIndex = from.rowIndex + delta.y;\n const targetRow = findTableRowByAriaRowIndex(this.table, targetAriaRowIndex, delta.y);\n if (!targetRow) {\n return null;\n }\n\n // Return next interactive cell content element if available.\n const cellElement = getClosestCell(from.element);\n const cellFocusables = cellElement ? this.getFocusablesFrom(cellElement) : [];\n const nextElementIndex = from.elementIndex + delta.x;\n const isValidDirection = !!delta.x;\n const isValidIndex = from.elementIndex !== -1 && 0 <= nextElementIndex && nextElementIndex < cellFocusables.length;\n const isTargetDifferent = from.element !== cellFocusables[nextElementIndex];\n if (isValidDirection && isValidIndex && isTargetDifferent) {\n return cellFocusables[nextElementIndex];\n }\n\n // Find next cell to focus or move focus into (can be null if the left/right edge is reached).\n const targetAriaColIndex = from.colIndex + delta.x;\n const targetCell = findTableRowCellByAriaColIndex(targetRow, targetAriaColIndex, delta.x);\n if (!targetCell) {\n return null;\n }\n\n // When target cell matches the current cell it means we reached the left or right boundary.\n if (targetCell === cellElement && delta.x !== 0) {\n return null;\n }\n\n const targetCellFocusables = this.getFocusablesFrom(targetCell);\n\n // When delta.x = 0 keep element index if possible.\n let focusIndex = from.elementIndex;\n // Use first element index when moving to the right or to extreme left.\n if ((isFinite(delta.x) && delta.x > 0) || delta.x === -Infinity) {\n focusIndex = 0;\n }\n // Use last element index when moving to the left or to extreme right.\n if ((isFinite(delta.x) && delta.x < 0) || delta.x === Infinity) {\n focusIndex = targetCellFocusables.length - 1;\n }\n\n return targetCellFocusables[focusIndex] ?? targetCell;\n }\n\n private getSingleFocusable() {\n const cell = this.focusedCell;\n const firstTableCell = this.table.querySelector('td,th') as null | HTMLTableCellElement;\n\n // A single element of the table is made user-focusable.\n // It defaults to the first interactive element of the first cell or the first cell itself otherwise.\n let focusTarget: null | HTMLElement =\n (firstTableCell && this.getFocusablesFrom(firstTableCell)[0]) ?? firstTableCell;\n\n // When a navigation-focused element is present in the table it is used for user-navigation instead.\n if (cell) {\n focusTarget = this.getNextFocusable(cell, { x: 0, y: 0 });\n }\n\n return focusTarget;\n }\n\n private getFocusablesFrom(target: HTMLElement) {\n return getAllFocusables(target).filter(el => this.focusables.has(el) && !isElementDisabled(el));\n }\n}\n"]}
1
+ {"version":3,"file":"grid-navigation.js","sourceRoot":"","sources":["../../../../src/table/table-role/grid-navigation.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EACL,mBAAmB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liates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\nimport { useEffect, useMemo } from 'react';\nimport {\n defaultIsSuppressed,\n findTableRowByAriaRowIndex,\n findTableRowCellByAriaColIndex,\n focusNextElement,\n getClosestCell,\n isElementDisabled,\n isTableCell,\n} from './utils';\nimport { FocusedCell, GridNavigationProps } from './interfaces';\nimport { KeyCode } from '../../internal/keycode';\nimport { useStableCallback } from '@cloudscape-design/component-toolkit/internal';\nimport { nodeBelongs } from '../../internal/utils/node-belongs';\nimport { getAllFocusables } from '../../internal/components/focus-lock/utils';\nimport {\n SingleTabStopNavigationContext,\n FocusableChangeHandler,\n} from '../../internal/context/single-tab-stop-navigation-context';\n\n/**\n * Makes table navigable with keyboard commands.\n * See grid-navigation.md\n */\nexport function GridNavigationProvider({ keyboardNavigation, pageSize, getTable, children }: GridNavigationProps) {\n const gridNavigation = useMemo(() => new GridNavigationProcessor(), []);\n\n const getTableStable = useStableCallback(getTable);\n\n // Initialize the processor with the table container assuming it is mounted synchronously and only once.\n useEffect(() => {\n if (keyboardNavigation) {\n const table = getTableStable();\n table && gridNavigation.init(table);\n }\n return () => gridNavigation.cleanup();\n }, [keyboardNavigation, gridNavigation, getTableStable]);\n\n // Notify the processor of the props change.\n useEffect(() => {\n gridNavigation.update({ pageSize });\n }, [gridNavigation, pageSize]);\n\n // Notify the processor of the new render.\n useEffect(() => {\n if (keyboardNavigation) {\n gridNavigation.refresh();\n }\n });\n\n return (\n <SingleTabStopNavigationContext.Provider\n value={{\n navigationActive: keyboardNavigation,\n registerFocusable: gridNavigation.registerFocusable,\n }}\n >\n {children}\n </SingleTabStopNavigationContext.Provider>\n );\n}\n\n/**\n * This helper encapsulates the grid navigation behaviors which are:\n * 1. Responding to keyboard commands and moving the focus accordingly;\n * 2. Muting table interactive elements for only one to be user-focusable at a time;\n * 3. Suppressing the above behaviors when focusing an element inside a dialog or when instructed explicitly.\n */\nclass GridNavigationProcessor {\n // Props\n private _pageSize = 0;\n private _table: null | HTMLTableElement = null;\n\n // State\n private focusedCell: null | FocusedCell = null;\n private keepUserIndex = false;\n private focusables = new Set<Element>();\n private focusHandlers = new Map<Element, FocusableChangeHandler>();\n private focusablesState = new WeakMap<Element, boolean>();\n private focusTarget: null | Element = null;\n\n public init(table: HTMLTableElement) {\n this._table = table;\n\n this.table.addEventListener('focusin', this.onFocusin);\n this.table.addEventListener('focusout', this.onFocusout);\n this.table.addEventListener('keydown', this.onKeydown);\n\n this.updateFocusTarget();\n\n this.cleanup = () => {\n this.table.removeEventListener('focusin', this.onFocusin);\n this.table.removeEventListener('focusout', this.onFocusout);\n this.table.removeEventListener('keydown', this.onKeydown);\n this.focusables.forEach(this.unregisterFocusable);\n };\n }\n\n public cleanup() {\n // Do nothing before initialized.\n }\n\n public update({ pageSize }: { pageSize: number }) {\n this._pageSize = pageSize;\n }\n\n public refresh() {\n // Timeout ensures the newly rendered content elements are registered.\n setTimeout(() => {\n if (this._table) {\n // Update focused cell indices in case table rows, columns, or firstIndex change.\n this.updateFocusedCell(this.focusedCell?.element);\n this.updateFocusTarget();\n }\n }, 0);\n }\n\n public registerFocusable = (focusableElement: HTMLElement, changeHandler: FocusableChangeHandler) => {\n this.focusables.add(focusableElement);\n this.focusHandlers.set(focusableElement, changeHandler);\n const isFocusable = this.focusablesState.get(focusableElement) ?? false;\n const newIsFocusable = this.focusTarget === focusableElement || this.isSuppressed(focusableElement);\n if (newIsFocusable !== isFocusable) {\n this.focusablesState.set(focusableElement, newIsFocusable);\n changeHandler(newIsFocusable);\n }\n // When newly registered element belongs to the focused cell the focus must transition to it.\n const focusedElement = this.focusedCell?.element;\n if (focusedElement && isTableCell(focusedElement) && focusedElement.contains(focusableElement)) {\n // Scroll is unnecessary when moving focus from a cell to element within the cell.\n focusableElement.focus({ preventScroll: true });\n }\n return () => this.unregisterFocusable(focusableElement);\n };\n\n public unregisterFocusable = (focusable: Element) => {\n this.focusables.delete(focusable);\n this.focusHandlers.delete(focusable);\n };\n\n private get pageSize() {\n return this._pageSize;\n }\n\n private get table(): HTMLTableElement {\n if (!this._table) {\n throw new Error('Invariant violation: GridNavigationProcessor is used before initialization.');\n }\n return this._table;\n }\n\n private onFocusin = (event: FocusEvent) => {\n if (!(event.target instanceof HTMLElement)) {\n return;\n }\n\n this.updateFocusedCell(event.target);\n if (!this.focusedCell) {\n return;\n }\n\n this.updateFocusTarget();\n\n // Focusing on cell is not eligible when it contains focusable elements in the content.\n // If content focusables are available - move the focus to the first one.\n const focusedElement = this.focusedCell.element;\n const nextTarget = isTableCell(focusedElement) ? this.getFocusablesFrom(focusedElement)[0] : null;\n if (nextTarget) {\n // Scroll is unnecessary when moving focus from a cell to element within the cell.\n nextTarget.focus({ preventScroll: true });\n } else {\n this.keepUserIndex = false;\n }\n };\n\n private onFocusout = () => {\n // When focus leaves the cell and the cell no longer belong to the table it indicates the focused element has been unmounted.\n // In that case the focus needs to be restored on the same coordinates.\n setTimeout(() => {\n if (this.focusedCell && !nodeBelongs(this.table, this.focusedCell.element)) {\n this.moveFocusBy(this.focusedCell, { x: 0, y: 0 });\n }\n }, 0);\n };\n\n private onKeydown = (event: KeyboardEvent) => {\n if (!this.focusedCell) {\n return;\n }\n\n const ctrlKey = event.ctrlKey ? 1 : 0;\n const altKey = event.altKey ? 1 : 0;\n const shiftKey = event.shiftKey ? 1 : 0;\n const metaKey = event.metaKey ? 1 : 0;\n const numModifiersPressed = ctrlKey + altKey + shiftKey + metaKey;\n\n let key = event.keyCode;\n if (numModifiersPressed === 1 && event.ctrlKey) {\n key = -key;\n } else if (numModifiersPressed) {\n return;\n }\n\n const from = this.focusedCell;\n\n if (this.isSuppressed(document.activeElement) || !this.isRegistered(document.activeElement)) {\n return;\n }\n\n switch (key) {\n case KeyCode.up:\n event.preventDefault();\n return this.moveFocusBy(from, { y: -1, x: 0 });\n\n case KeyCode.down:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 1, x: 0 });\n\n case KeyCode.left:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 0, x: -1 });\n\n case KeyCode.right:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 0, x: 1 });\n\n case KeyCode.pageUp:\n event.preventDefault();\n return this.moveFocusBy(from, { y: -this.pageSize, x: 0 });\n\n case KeyCode.pageDown:\n event.preventDefault();\n return this.moveFocusBy(from, { y: this.pageSize, x: 0 });\n\n case KeyCode.home:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 0, x: -Infinity });\n\n case KeyCode.end:\n event.preventDefault();\n return this.moveFocusBy(from, { y: 0, x: Infinity });\n\n case -KeyCode.home:\n event.preventDefault();\n return this.moveFocusBy(from, { y: -Infinity, x: -Infinity });\n\n case -KeyCode.end:\n event.preventDefault();\n return this.moveFocusBy(from, { y: Infinity, x: Infinity });\n\n default:\n return;\n }\n };\n\n private moveFocusBy(cell: FocusedCell, delta: { x: number; y: number }) {\n // For vertical moves preserve column- and element indices set by user.\n // It allows keeping indices while moving over disabled actions or cells with colspan > 1.\n if (delta.y !== 0 && delta.x === 0) {\n this.keepUserIndex = true;\n }\n focusNextElement(this.getNextFocusable(cell, delta));\n }\n\n private updateFocusTarget() {\n this.focusTarget = this.getSingleFocusable();\n for (const focusableElement of this.focusables) {\n const isFocusable = this.focusablesState.get(focusableElement) ?? false;\n const newIsFocusable = this.focusTarget === focusableElement || this.isSuppressed(focusableElement);\n if (newIsFocusable !== isFocusable) {\n this.focusablesState.set(focusableElement, newIsFocusable);\n this.focusHandlers.get(focusableElement)!(newIsFocusable);\n }\n }\n }\n\n private isSuppressed(element: null | Element) {\n // Omit calculation as irrelevant until the table receives focus.\n if (!this.focusedCell) {\n return false;\n }\n return !element || defaultIsSuppressed(element);\n }\n\n private isRegistered(element: null | Element) {\n return !element || this.focusables.has(element);\n }\n\n private updateFocusedCell(focusedElement?: HTMLElement): void {\n if (!focusedElement) {\n return;\n }\n\n const cellElement = getClosestCell(focusedElement);\n const rowElement = cellElement?.closest('tr');\n if (!cellElement || !rowElement) {\n return;\n }\n\n const colIndex = parseInt(cellElement.getAttribute('aria-colindex') ?? '');\n const rowIndex = parseInt(rowElement.getAttribute('aria-rowindex') ?? '');\n if (isNaN(colIndex) || isNaN(rowIndex)) {\n return;\n }\n\n const cellFocusables = this.getFocusablesFrom(cellElement);\n const elementIndex = cellFocusables.indexOf(focusedElement);\n\n const prevColIndex = this.focusedCell?.colIndex ?? -1;\n const prevElementIndex = this.focusedCell?.elementIndex ?? -1;\n this.focusedCell = {\n rowIndex,\n colIndex: this.keepUserIndex && prevColIndex !== -1 ? prevColIndex : colIndex,\n elementIndex: this.keepUserIndex && prevElementIndex !== -1 ? prevElementIndex : elementIndex,\n element: focusedElement,\n };\n }\n\n private getNextFocusable(from: FocusedCell, delta: { y: number; x: number }) {\n // Find next row to move focus into (can be null if the top/bottom is reached).\n const targetAriaRowIndex = from.rowIndex + delta.y;\n const targetRow = findTableRowByAriaRowIndex(this.table, targetAriaRowIndex, delta.y);\n if (!targetRow) {\n return null;\n }\n\n // Return next interactive cell content element if available.\n const cellElement = getClosestCell(from.element);\n const cellFocusables = cellElement ? this.getFocusablesFrom(cellElement) : [];\n const nextElementIndex = from.elementIndex + delta.x;\n const isValidDirection = !!delta.x;\n const isValidIndex = from.elementIndex !== -1 && 0 <= nextElementIndex && nextElementIndex < cellFocusables.length;\n const isTargetDifferent = from.element !== cellFocusables[nextElementIndex];\n if (isValidDirection && isValidIndex && isTargetDifferent) {\n return cellFocusables[nextElementIndex];\n }\n\n // Find next cell to focus or move focus into (can be null if the left/right edge is reached).\n const targetAriaColIndex = from.colIndex + delta.x;\n const targetCell = findTableRowCellByAriaColIndex(targetRow, targetAriaColIndex, delta.x);\n if (!targetCell) {\n return null;\n }\n\n // When target cell matches the current cell it means we reached the left or right boundary.\n if (targetCell === cellElement && delta.x !== 0) {\n return null;\n }\n\n const targetCellFocusables = this.getFocusablesFrom(targetCell);\n\n // When delta.x = 0 keep element index if possible.\n let focusIndex = from.elementIndex;\n // Use first element index when moving to the right or to extreme left.\n if ((isFinite(delta.x) && delta.x > 0) || delta.x === -Infinity) {\n focusIndex = 0;\n }\n // Use last element index when moving to the left or to extreme right.\n if ((isFinite(delta.x) && delta.x < 0) || delta.x === Infinity) {\n focusIndex = targetCellFocusables.length - 1;\n }\n\n return targetCellFocusables[focusIndex] ?? targetCell;\n }\n\n private getSingleFocusable() {\n const cell = this.focusedCell;\n const firstTableCell = this.table.querySelector('td,th') as null | HTMLTableCellElement;\n\n // A single element of the table is made user-focusable.\n // It defaults to the first interactive element of the first cell or the first cell itself otherwise.\n let focusTarget: null | HTMLElement =\n (firstTableCell && this.getFocusablesFrom(firstTableCell)[0]) ?? firstTableCell;\n\n // When a navigation-focused element is present in the table it is used for user-navigation instead.\n if (cell) {\n focusTarget = this.getNextFocusable(cell, { x: 0, y: 0 });\n }\n\n return focusTarget;\n }\n\n private getFocusablesFrom(target: HTMLElement) {\n return getAllFocusables(target).filter(el => this.focusables.has(el) && !isElementDisabled(el));\n }\n}\n"]}
@@ -14,4 +14,5 @@ export declare function findTableRowByAriaRowIndex(table: HTMLTableElement, targ
14
14
  */
15
15
  export declare function findTableRowCellByAriaColIndex(tableRow: HTMLTableRowElement, targetAriaColIndex: number, delta: number): HTMLTableCellElement | null;
16
16
  export declare function isTableCell(element: Element): boolean;
17
+ export declare function focusNextElement(element: null | HTMLElement): void;
17
18
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/table/table-role/utils.ts"],"names":[],"mappings":"AAGA,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,+BAE9C;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,WAKrD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,WAgBlD;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,8BAqB5G;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,mBAAmB,EAC7B,kBAAkB,EAAE,MAAM,EAC1B,KAAK,EAAE,MAAM,+BAsBd;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,WAE3C"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/table/table-role/utils.ts"],"names":[],"mappings":"AAGA,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,+BAE9C;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,WAKrD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,WAgBlD;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,8BAqB5G;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,mBAAmB,EAC7B,kBAAkB,EAAE,MAAM,EAC1B,KAAK,EAAE,MAAM,+BAsBd;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,WAE3C;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,IAAI,GAAG,WAAW,QAO3D"}
@@ -81,4 +81,12 @@ export function findTableRowCellByAriaColIndex(tableRow, targetAriaColIndex, del
81
81
  export function isTableCell(element) {
82
82
  return element.tagName === 'TD' || element.tagName === 'TH';
83
83
  }
84
+ export function focusNextElement(element) {
85
+ if (element) {
86
+ if (isTableCell(element)) {
87
+ element.tabIndex = 0;
88
+ }
89
+ element.focus();
90
+ }
91
+ }
84
92
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/table/table-role/utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,OAAO,OAA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,GAAG,kBAAkB,EAAE;YAC/C,MAAM;SACP;QACD,IAAI,KAAK,GAAG,CAAC,IAAI,QAAQ,GAAG,kBAAkB,EAAE;YAC9C,MAAM;SACP;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,8BAA8B,CAC5C,QAA6B,EAC7B,kBAA0B,EAC1B,KAAa;;IAEb,IAAI,UAAU,GAAgC,IAAI,CAAC;IACnD,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,qCAAqC,CAAC,CAAC,CAAC;IAClG,IAAI,KAAK,GAAG,CAAC,EAAE;QACb,YAAY,CAAC,OAAO,EAAE,CAAC;KACxB;IACD,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE;QAClC,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAA,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,mCAAI,EAAE,CAAC,CAAC;QAC1E,UAAU,GAAG,OAA+B,CAAC;QAE7C,IAAI,WAAW,KAAK,kBAAkB,EAAE;YACtC,MAAM;SACP;QACD,IAAI,KAAK,IAAI,CAAC,IAAI,WAAW,GAAG,kBAAkB,EAAE;YAClD,MAAM;SACP;QACD,IAAI,KAAK,GAAG,CAAC,IAAI,WAAW,GAAG,kBAAkB,EAAE;YACjD,MAAM;SACP;KACF;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,OAAO,OAAO,CAAC,OAAO,KAAK,IAAI,IAAI,OAAO,CAAC,OAAO,KAAK,IAAI,CAAC;AAC9D,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function getClosestCell(element: Element) {\n return element.closest('td,th') as null | HTMLTableCellElement;\n}\n\nexport function isElementDisabled(element: HTMLElement) {\n if (element instanceof HTMLInputElement || element instanceof HTMLButtonElement) {\n return element.disabled;\n }\n return false;\n}\n\n/**\n * Returns true if the target element or one of its parents is a dialog or is marked with data-awsui-table-suppress-navigation attribute.\n * This is used to suppress navigation for interactive content without a need to use a custom suppression check.\n */\nexport function defaultIsSuppressed(target: Element) {\n let current: null | Element = target;\n while (current) {\n // Stop checking for parents upon reaching the cell element as the function only aims at the cell content.\n if (isTableCell(current)) {\n return false;\n }\n if (\n current.getAttribute('role') === 'dialog' ||\n current.getAttribute('data-awsui-table-suppress-navigation') === 'true'\n ) {\n return true;\n }\n current = current.parentElement;\n }\n return false;\n}\n\n/**\n * Finds the closest row to the targetAriaRowIndex+delta in the direction of delta.\n */\nexport function findTableRowByAriaRowIndex(table: HTMLTableElement, targetAriaRowIndex: number, delta: number) {\n let targetRow: null | HTMLTableRowElement = null;\n const rowElements = Array.from(table.querySelectorAll('tr[aria-rowindex]'));\n if (delta < 0) {\n rowElements.reverse();\n }\n for (const element of rowElements) {\n const rowIndex = parseInt(element.getAttribute('aria-rowindex') ?? '');\n targetRow = element as HTMLTableRowElement;\n\n if (rowIndex === targetAriaRowIndex) {\n break;\n }\n if (delta >= 0 && rowIndex > targetAriaRowIndex) {\n break;\n }\n if (delta < 0 && rowIndex < targetAriaRowIndex) {\n break;\n }\n }\n return targetRow;\n}\n\n/**\n * Finds the closest column to the targetAriaColIndex+delta in the direction of delta.\n */\nexport function findTableRowCellByAriaColIndex(\n tableRow: HTMLTableRowElement,\n targetAriaColIndex: number,\n delta: number\n) {\n let targetCell: null | HTMLTableCellElement = null;\n const cellElements = Array.from(tableRow.querySelectorAll('td[aria-colindex],th[aria-colindex]'));\n if (delta < 0) {\n cellElements.reverse();\n }\n for (const element of cellElements) {\n const columnIndex = parseInt(element.getAttribute('aria-colindex') ?? '');\n targetCell = element as HTMLTableCellElement;\n\n if (columnIndex === targetAriaColIndex) {\n break;\n }\n if (delta >= 0 && columnIndex > targetAriaColIndex) {\n break;\n }\n if (delta < 0 && columnIndex < targetAriaColIndex) {\n break;\n }\n }\n return targetCell;\n}\n\nexport function isTableCell(element: Element) {\n return element.tagName === 'TD' || element.tagName === 'TH';\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/table/table-role/utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAgC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAoB;IACpD,IAAI,OAAO,YAAY,gBAAgB,IAAI,OAAO,YAAY,iBAAiB,EAAE;QAC/E,OAAO,OAAO,CAAC,QAAQ,CAAC;KACzB;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAe;IACjD,IAAI,OAAO,GAAmB,MAAM,CAAC;IACrC,OAAO,OAAO,EAAE;QACd,0GAA0G;QAC1G,IAAI,WAAW,CAAC,OAAO,CAAC,EAAE;YACxB,OAAO,KAAK,CAAC;SACd;QACD,IACE,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,QAAQ;YACzC,OAAO,CAAC,YAAY,CAAC,sCAAsC,CAAC,KAAK,MAAM,EACvE;YACA,OAAO,IAAI,CAAC;SACb;QACD,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;KACjC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,0BAA0B,CAAC,KAAuB,EAAE,kBAA0B,EAAE,KAAa;;IAC3G,IAAI,SAAS,GAA+B,IAAI,CAAC;IACjD,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC5E,IAAI,KAAK,GAAG,CAAC,EAAE;QACb,WAAW,CAAC,OAAO,EAAE,CAAC;KACvB;IACD,KAAK,MAAM,OAAO,IAAI,WAAW,EAAE;Q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,IAAI,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAA2B;IAC1D,IAAI,OAAO,EAAE;QACX,IAAI,WAAW,CAAC,OAAO,CAAC,EAAE;YACxB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;SACtB;QACD,OAAO,CAAC,KAAK,EAAE,CAAC;KACjB;AACH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function getClosestCell(element: Element) {\n return element.closest('td,th') as null | HTMLTableCellElement;\n}\n\nexport function isElementDisabled(element: HTMLElement) {\n if (element instanceof HTMLInputElement || element instanceof HTMLButtonElement) {\n return element.disabled;\n }\n return false;\n}\n\n/**\n * Returns true if the target element or one of its parents is a dialog or is marked with data-awsui-table-suppress-navigation attribute.\n * This is used to suppress navigation for interactive content without a need to use a custom suppression check.\n */\nexport function defaultIsSuppressed(target: Element) {\n let current: null | Element = target;\n while (current) {\n // Stop checking for parents upon reaching the cell element as the function only aims at the cell content.\n if (isTableCell(current)) {\n return false;\n }\n if (\n current.getAttribute('role') === 'dialog' ||\n current.getAttribute('data-awsui-table-suppress-navigation') === 'true'\n ) {\n return true;\n }\n current = current.parentElement;\n }\n return false;\n}\n\n/**\n * Finds the closest row to the targetAriaRowIndex+delta in the direction of delta.\n */\nexport function findTableRowByAriaRowIndex(table: HTMLTableElement, targetAriaRowIndex: number, delta: number) {\n let targetRow: null | HTMLTableRowElement = null;\n const rowElements = Array.from(table.querySelectorAll('tr[aria-rowindex]'));\n if (delta < 0) {\n rowElements.reverse();\n }\n for (const element of rowElements) {\n const rowIndex = parseInt(element.getAttribute('aria-rowindex') ?? '');\n targetRow = element as HTMLTableRowElement;\n\n if (rowIndex === targetAriaRowIndex) {\n break;\n }\n if (delta >= 0 && rowIndex > targetAriaRowIndex) {\n break;\n }\n if (delta < 0 && rowIndex < targetAriaRowIndex) {\n break;\n }\n }\n return targetRow;\n}\n\n/**\n * Finds the closest column to the targetAriaColIndex+delta in the direction of delta.\n */\nexport function findTableRowCellByAriaColIndex(\n tableRow: HTMLTableRowElement,\n targetAriaColIndex: number,\n delta: number\n) {\n let targetCell: null | HTMLTableCellElement = null;\n const cellElements = Array.from(tableRow.querySelectorAll('td[aria-colindex],th[aria-colindex]'));\n if (delta < 0) {\n cellElements.reverse();\n }\n for (const element of cellElements) {\n const columnIndex = parseInt(element.getAttribute('aria-colindex') ?? '');\n targetCell = element as HTMLTableCellElement;\n\n if (columnIndex === targetAriaColIndex) {\n break;\n }\n if (delta >= 0 && columnIndex > targetAriaColIndex) {\n break;\n }\n if (delta < 0 && columnIndex < targetAriaColIndex) {\n break;\n }\n }\n return targetCell;\n}\n\nexport function isTableCell(element: Element) {\n return element.tagName === 'TD' || element.tagName === 'TH';\n}\n\nexport function focusNextElement(element: null | HTMLElement) {\n if (element) {\n if (isTableCell(element)) {\n element.tabIndex = 0;\n }\n element.focus();\n }\n}\n"]}