@cloudscape-design/components-themeable 3.0.1403 → 3.0.1404
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/header/styles.scss +2 -2
- package/lib/internal/scss/internal/components/selectable-item/styles.scss +6 -0
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/scss/option-list/styles.scss +11 -0
- package/lib/internal/scss/option-list/test-classes/styles.scss +9 -0
- package/lib/internal/scss/table-root/styles.scss +29 -0
- package/lib/internal/template/expandable-section/expandable-section-header.js +1 -1
- package/lib/internal/template/expandable-section/expandable-section-header.js.map +1 -1
- package/lib/internal/template/header/interfaces.d.ts +4 -0
- package/lib/internal/template/header/interfaces.d.ts.map +1 -1
- package/lib/internal/template/header/interfaces.js.map +1 -1
- package/lib/internal/template/header/internal.d.ts +1 -6
- package/lib/internal/template/header/internal.d.ts.map +1 -1
- package/lib/internal/template/header/internal.js +2 -2
- package/lib/internal/template/header/internal.js.map +1 -1
- package/lib/internal/template/header/styles.css.js +36 -36
- package/lib/internal/template/header/styles.scoped.css +55 -55
- package/lib/internal/template/header/styles.selectors.js +36 -36
- package/lib/internal/template/i18n/messages/all.all.js +1 -1
- package/lib/internal/template/i18n/messages/all.all.json +1 -1
- package/lib/internal/template/i18n/messages/all.de.js +1 -1
- package/lib/internal/template/i18n/messages/all.de.json +1 -1
- package/lib/internal/template/i18n/messages/all.en-GB.js +1 -1
- package/lib/internal/template/i18n/messages/all.en-GB.json +1 -1
- package/lib/internal/template/i18n/messages/all.en.js +1 -1
- package/lib/internal/template/i18n/messages/all.en.json +1 -1
- package/lib/internal/template/i18n/messages/all.es.js +1 -1
- package/lib/internal/template/i18n/messages/all.es.json +1 -1
- package/lib/internal/template/i18n/messages/all.fr.js +1 -1
- package/lib/internal/template/i18n/messages/all.fr.json +1 -1
- package/lib/internal/template/i18n/messages/all.id.js +1 -1
- package/lib/internal/template/i18n/messages/all.id.json +1 -1
- package/lib/internal/template/i18n/messages/all.it.js +1 -1
- package/lib/internal/template/i18n/messages/all.it.json +1 -1
- package/lib/internal/template/i18n/messages/all.ja.js +1 -1
- package/lib/internal/template/i18n/messages/all.ja.json +1 -1
- package/lib/internal/template/i18n/messages/all.ko.js +1 -1
- package/lib/internal/template/i18n/messages/all.ko.json +1 -1
- package/lib/internal/template/i18n/messages/all.pt-BR.js +1 -1
- package/lib/internal/template/i18n/messages/all.pt-BR.json +1 -1
- package/lib/internal/template/i18n/messages/all.tr.js +1 -1
- package/lib/internal/template/i18n/messages/all.tr.json +1 -1
- package/lib/internal/template/i18n/messages/all.zh-CN.js +1 -1
- package/lib/internal/template/i18n/messages/all.zh-CN.json +1 -1
- package/lib/internal/template/i18n/messages/all.zh-TW.js +1 -1
- package/lib/internal/template/i18n/messages/all.zh-TW.json +1 -1
- package/lib/internal/template/i18n/messages-types.d.ts +3 -0
- package/lib/internal/template/i18n/messages-types.d.ts.map +1 -1
- package/lib/internal/template/i18n/messages-types.js.map +1 -1
- package/lib/internal/template/index.d.ts +1 -0
- package/lib/internal/template/index.d.ts.map +1 -1
- package/lib/internal/template/index.js +1 -0
- package/lib/internal/template/index.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/components/focus-lock/utils.d.ts +2 -0
- package/lib/internal/template/internal/components/focus-lock/utils.d.ts.map +1 -1
- package/lib/internal/template/internal/components/focus-lock/utils.js +5 -1
- package/lib/internal/template/internal/components/focus-lock/utils.js.map +1 -1
- package/lib/internal/template/internal/components/listbox/parts/item.d.ts +2 -0
- package/lib/internal/template/internal/components/listbox/parts/item.d.ts.map +1 -1
- package/lib/internal/template/internal/components/listbox/parts/item.js +3 -3
- package/lib/internal/template/internal/components/listbox/parts/item.js.map +1 -1
- package/lib/internal/template/internal/components/listbox/parts/plain-list.d.ts +6 -0
- package/lib/internal/template/internal/components/listbox/parts/plain-list.d.ts.map +1 -1
- package/lib/internal/template/internal/components/listbox/parts/plain-list.js +5 -4
- package/lib/internal/template/internal/components/listbox/parts/plain-list.js.map +1 -1
- package/lib/internal/template/internal/components/listbox/parts/scroll-to-index.d.ts +8 -0
- package/lib/internal/template/internal/components/listbox/parts/scroll-to-index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/listbox/parts/scroll-to-index.js +16 -0
- package/lib/internal/template/internal/components/listbox/parts/scroll-to-index.js.map +1 -1
- package/lib/internal/template/internal/components/listbox/use-listbox.d.ts +2 -2
- package/lib/internal/template/internal/components/listbox/use-listbox.d.ts.map +1 -1
- package/lib/internal/template/internal/components/listbox/use-listbox.js.map +1 -1
- package/lib/internal/template/internal/components/options-list/index.d.ts +4 -1
- package/lib/internal/template/internal/components/options-list/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/options-list/index.js +1 -1
- package/lib/internal/template/internal/components/options-list/index.js.map +1 -1
- package/lib/internal/template/internal/components/options-list/utils/use-keyboard.d.ts +2 -1
- package/lib/internal/template/internal/components/options-list/utils/use-keyboard.d.ts.map +1 -1
- package/lib/internal/template/internal/components/options-list/utils/use-keyboard.js +4 -2
- package/lib/internal/template/internal/components/options-list/utils/use-keyboard.js.map +1 -1
- package/lib/internal/template/internal/components/selectable-item/index.d.ts +1 -0
- package/lib/internal/template/internal/components/selectable-item/index.d.ts.map +1 -1
- package/lib/internal/template/internal/components/selectable-item/index.js +2 -1
- package/lib/internal/template/internal/components/selectable-item/index.js.map +1 -1
- package/lib/internal/template/internal/components/selectable-item/interfaces.d.ts +1 -0
- package/lib/internal/template/internal/components/selectable-item/interfaces.d.ts.map +1 -1
- package/lib/internal/template/internal/components/selectable-item/interfaces.js.map +1 -1
- package/lib/internal/template/internal/components/selectable-item/styles.css.js +23 -22
- package/lib/internal/template/internal/components/selectable-item/styles.scoped.css +52 -49
- package/lib/internal/template/internal/components/selectable-item/styles.selectors.js +23 -22
- package/lib/internal/template/internal/components/sticky-header/use-untabbable-descendants.d.ts +3 -0
- package/lib/internal/template/internal/components/sticky-header/use-untabbable-descendants.d.ts.map +1 -0
- package/lib/internal/template/internal/components/sticky-header/use-untabbable-descendants.js +16 -0
- package/lib/internal/template/internal/components/sticky-header/use-untabbable-descendants.js.map +1 -0
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/lib/internal/template/multiselect/use-multiselect.d.ts +1 -1
- package/lib/internal/template/option-list/index.d.ts +6 -0
- package/lib/internal/template/option-list/index.d.ts.map +1 -0
- package/lib/internal/template/option-list/index.js +21 -0
- package/lib/internal/template/option-list/index.js.map +1 -0
- package/lib/internal/template/option-list/interfaces.d.ts +132 -0
- package/lib/internal/template/option-list/interfaces.d.ts.map +1 -0
- package/lib/internal/template/option-list/interfaces.js +2 -0
- package/lib/internal/template/option-list/interfaces.js.map +1 -0
- package/lib/internal/template/option-list/internal.d.ts +6 -0
- package/lib/internal/template/option-list/internal.d.ts.map +1 -0
- package/lib/internal/template/option-list/internal.js +138 -0
- package/lib/internal/template/option-list/internal.js.map +1 -0
- package/lib/internal/template/option-list/styles.css.js +6 -0
- package/lib/internal/template/option-list/styles.scoped.css +40 -0
- package/lib/internal/template/option-list/styles.selectors.js +7 -0
- package/lib/internal/template/option-list/test-classes/styles.css.js +8 -0
- package/lib/internal/template/option-list/test-classes/styles.scoped.css +9 -0
- package/lib/internal/template/option-list/test-classes/styles.selectors.js +9 -0
- package/lib/internal/template/option-list/use-option-list.d.ts +30 -0
- package/lib/internal/template/option-list/use-option-list.d.ts.map +1 -0
- package/lib/internal/template/option-list/use-option-list.js +69 -0
- package/lib/internal/template/option-list/use-option-list.js.map +1 -0
- package/lib/internal/template/package.json +3 -0
- package/lib/internal/template/table-root/index.js +1 -1
- package/lib/internal/template/table-root/index.js.map +1 -1
- package/lib/internal/template/table-root/interfaces.d.ts +15 -1
- package/lib/internal/template/table-root/interfaces.d.ts.map +1 -1
- package/lib/internal/template/table-root/interfaces.js.map +1 -1
- package/lib/internal/template/table-root/internal.d.ts +1 -1
- package/lib/internal/template/table-root/internal.d.ts.map +1 -1
- package/lib/internal/template/table-root/internal.js +23 -11
- package/lib/internal/template/table-root/internal.js.map +1 -1
- package/lib/internal/template/table-root/sticky-header-slot.d.ts +15 -0
- package/lib/internal/template/table-root/sticky-header-slot.d.ts.map +1 -0
- package/lib/internal/template/table-root/sticky-header-slot.js +13 -0
- package/lib/internal/template/table-root/sticky-header-slot.js.map +1 -0
- package/lib/internal/template/table-root/styles.css.js +10 -5
- package/lib/internal/template/table-root/styles.scoped.css +52 -7
- package/lib/internal/template/table-root/styles.selectors.js +10 -5
- package/lib/internal/template/table-root/use-sticky-header.d.ts +28 -0
- package/lib/internal/template/table-root/use-sticky-header.d.ts.map +1 -0
- package/lib/internal/template/table-root/use-sticky-header.js +141 -0
- package/lib/internal/template/table-root/use-sticky-header.js.map +1 -0
- package/lib/internal/template/test-utils/dom/header/index.d.ts +1 -0
- package/lib/internal/template/test-utils/dom/header/index.js +3 -0
- package/lib/internal/template/test-utils/dom/header/index.js.map +1 -1
- package/lib/internal/template/test-utils/dom/index.d.ts +28 -0
- package/lib/internal/template/test-utils/dom/index.js +21 -2
- package/lib/internal/template/test-utils/dom/index.js.map +1 -1
- package/lib/internal/template/test-utils/dom/option-list/index.d.ts +69 -0
- package/lib/internal/template/test-utils/dom/option-list/index.js +132 -0
- package/lib/internal/template/test-utils/dom/option-list/index.js.map +1 -0
- package/lib/internal/template/test-utils/selectors/header/index.d.ts +1 -0
- package/lib/internal/template/test-utils/selectors/header/index.js +3 -0
- package/lib/internal/template/test-utils/selectors/header/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/index.d.ts +18 -0
- package/lib/internal/template/test-utils/selectors/index.js +16 -2
- package/lib/internal/template/test-utils/selectors/index.js.map +1 -1
- package/lib/internal/template/test-utils/selectors/option-list/index.d.ts +66 -0
- package/lib/internal/template/test-utils/selectors/option-list/index.js +108 -0
- package/lib/internal/template/test-utils/selectors/option-list/index.js.map +1 -0
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useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useResizeObserver } from '@cloudscape-design/component-toolkit/internal';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { StickyScrollbar } from '../internal/components/sticky-scrollbar';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useScrollSync } from '../internal/hooks/use-scroll-sync';\nimport { TableContextProvider } from './context';\nimport { computeGridTemplateColumns } from './grid-template-columns';\nimport { TableRootProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\nexport interface InternalTableRootProps extends TableRootProps, InternalBaseComponentProps {}\n\n// In grid layout the rows overflow the table element, so the scroller, not the table, measures the\n// scrollable width. scrollWidth is rounded to a whole pixel, so content that fits a fractional-width\n// scroller reports the scroller's own width instead, using the same tolerance as measureScrollable.\nfunction getScrollerContentInlineSize(_table: HTMLElement, scroller: HTMLElement) {\n return scroller.scrollWidth - scroller.clientWidth > 1\n ? scroller.scrollWidth\n : scroller.getBoundingClientRect().width;\n}\n\nexport default function InternalTableRoot({\n columnLayout = { type: 'auto' },\n ariaRowcount,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n children,\n __internalRootRef,\n ...rest\n}: InternalTableRootProps) {\n const isGrid = columnLayout.type === 'grid';\n const gridTemplateColumns = computeGridTemplateColumns(columnLayout);\n // Memoized because it is the TableContext value; a fresh object re-renders every cell. Both fields are\n // primitives compared by value, so it stays stable even when the caller passes a fresh columnLayout.\n const tableContext = useMemo(() => ({ isGrid, gridTemplateColumns }), [isGrid, gridTemplateColumns]);\n const baseProps = getBaseProps(rest);\n\n // A wide table's horizontal scroller isn't keyboard-reachable on its own, so a read-only table with no\n // focusable cell content can't be scrolled by keyboard. When the content overflows, expose the scroller\n // as a focusable region so keyboard users can scroll it horizontally, matching the existing Table's\n // getTableWrapperRoleProps.\n const scrollerRef = useRef<HTMLDivElement>(null);\n const [isScrollable, setIsScrollable] = useState(false);\n const measureScrollable = useCallback(() => {\n const node = scrollerRef.current;\n if (node) {\n setIsScrollable(node.scrollWidth - node.clientWidth > 1);\n }\n }, []);\n // Observe the scroller and the table it wraps: a viewport resize changes the scroller box, and\n // auto-layout content growth changes the table box — either can start or stop the horizontal overflow.\n useResizeObserver(scrollerRef, measureScrollable);\n useResizeObserver(() => scrollerRef.current?.firstElementChild ?? null, measureScrollable);\n // Grid column templates change the tracks' overflow without resizing either observed box, so no observer\n // fires — re-measure when the template changes.\n useEffect(() => {\n if (isGrid) {\n measureScrollable();\n }\n }, [isGrid, gridTemplateColumns, measureScrollable]);\n\n const tableRef = useRef<HTMLTableElement>(null);\n const scrollbarRef = useRef<HTMLDivElement>(null);\n const handleScroll = useScrollSync([scrollerRef, scrollbarRef]);\n\n // Set role=\"region\" whenever scrollable (label passes through even if undefined), matching the\n // existing Table's getTableWrapperRoleProps rather than gating the role on a label.\n const scrollRegionProps = isScrollable\n ? {\n role: 'region' as const,\n tabIndex: 0,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n }\n : {};\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n {/* TableContext supplies this table's column layout to every part. */}\n <TableContextProvider value={tableContext}>\n {/* The page owns vertical scroll; this wrapper reintroduces an inline scroll viewport so a wide table scrolls horizontally instead of spilling out. */}\n <div className={styles['body-scroller']} ref={scrollerRef} onScroll={handleScroll} {...scrollRegionProps}>\n <table\n ref={tableRef}\n // Grid mode only: display:grid drops the table's implicit role. Auto mode keeps the\n // native role (an explicit role=\"table\" there is redundant and flagged by a11y validators).\n role={isGrid ? 'table' : undefined}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n aria-rowcount={ariaRowcount}\n className={clsx(styles.table, isGrid ? styles['table-grid'] : styles['table-auto'])}\n >\n {children}\n </table>\n </div>\n <StickyScrollbar\n ref={scrollbarRef}\n wrapperRef={scrollerRef}\n tableRef={tableRef}\n onScroll={handleScroll}\n getContentInlineSize={getScrollerContentInlineSize}\n contentKey={gridTemplateColumns}\n />\n </TableContextProvider>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/table-root/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAEhG,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAIrC,mGAAmG;AACnG,qGAAqG;AACrG,oGAAoG;AACpG,SAAS,4BAA4B,CAAC,MAAmB,EAAE,QAAqB;IAC9E,OAAO,QAAQ,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,GAAG,CAAC;QACpD,CAAC,CAAC,QAAQ,CAAC,WAAW;QACtB,CAAC,CAAC,QAAQ,CAAC,qBAAqB,EAAE,CAAC,KAAK,CAAC;AAC7C,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,YAAY,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAC/B,YAAY,EACZ,SAAS,EACT,cAAc,EACd,eAAe,EACf,YAAY,EACZ,0BAA0B,EAC1B,Q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6BACE,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,EAClC,GAAG,EAAE,WAAW,EAChB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,MAAM,CAAC,eAAe,EAC/B,MAAM,EAAE,MAAM,CAAC,cAAc,KACzB,iBAAiB;gBAErB,+BACE,GAAG,EAAE,MAAM,CAAC,YAAY;oBACxB,6FAA6F;oBAC7F,IAAI,EAAC,OAAO,gBACA,SAAS,qBACJ,cAAc,sBACb,eAAe,mBAClB,YAAY,EAC3B,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;oBAElF,YAAY;oBACZ,QAAQ,CACH,CACJ;YACN,oBAAC,eAAe,IACd,GAAG,EAAE,YAAY,EACjB,UAAU,EAAE,WAAW,EACvB,QAAQ,EAAE,MAAM,CAAC,YAAY,EAC7B,QAAQ,EAAE,YAAY,EACtB,oBAAoB,EAAE,4BAA4B,EAClD,UAAU,EAAE,mBAAmB,GAC/B,CACmB,CACnB,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs, useResizeObserver } from '@cloudscape-design/component-toolkit/internal';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { StickyScrollbar } from '../internal/components/sticky-scrollbar';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useScrollSync } from '../internal/hooks/use-scroll-sync';\nimport { TableContextProvider } from './context';\nimport { computeGridTemplateColumns } from './grid-template-columns';\nimport { TableRootProps } from './interfaces';\nimport StickyHeaderSlot from './sticky-header-slot';\nimport { useTableRootStickyHeader } from './use-sticky-header';\n\nimport styles from './styles.css.js';\n\nexport interface InternalTableRootProps extends TableRootProps, InternalBaseComponentProps {}\n\n// In grid layout the rows overflow the table element, so the scroller, not the table, measures the\n// scrollable width. scrollWidth is rounded to a whole pixel, so content that fits a fractional-width\n// scroller reports the scroller's own width instead, using the same tolerance as measureScrollable.\nfunction getScrollerContentInlineSize(_table: HTMLElement, scroller: HTMLElement) {\n return scroller.scrollWidth - scroller.clientWidth > 1\n ? scroller.scrollWidth\n : scroller.getBoundingClientRect().width;\n}\n\nexport default function InternalTableRoot({\n columnLayout = { type: 'auto' },\n ariaRowcount,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n stickyHeader,\n stickyHeaderVerticalOffset,\n children,\n __internalRootRef,\n ...rest\n}: InternalTableRootProps) {\n const isGrid = columnLayout.type === 'grid';\n const gridTemplateColumns = computeGridTemplateColumns(columnLayout);\n // Memoized because it is the TableContext value; a fresh object re-renders every cell. Both fields are\n // primitives compared by value, so it stays stable even when the caller passes a fresh columnLayout.\n const tableContext = useMemo(() => ({ isGrid, gridTemplateColumns }), [isGrid, gridTemplateColumns]);\n const baseProps = getBaseProps(rest);\n\n // A wide table's horizontal scroller isn't keyboard-reachable on its own, so a read-only table with no\n // focusable cell content can't be scrolled by keyboard. When the content overflows, expose the scroller\n // as a focusable region so keyboard users can scroll it horizontally, matching the existing Table's\n // getTableWrapperRoleProps.\n const scrollerRef = useRef<HTMLDivElement>(null);\n const [isScrollable, setIsScrollable] = useState(false);\n const measureScrollable = useCallback(() => {\n const node = scrollerRef.current;\n if (node) {\n setIsScrollable(node.scrollWidth - node.clientWidth > 1);\n }\n }, []);\n // Observe the scroller and the table it wraps: a viewport resize changes the scroller box, and\n // auto-layout content growth changes the table box — either can start or stop the horizontal overflow.\n useResizeObserver(scrollerRef, measureScrollable);\n useResizeObserver(() => scrollerRef.current?.firstElementChild ?? null, measureScrollable);\n // Grid column templates change the tracks' overflow without resizing either observed box, so no observer\n // fires — re-measure when the template changes.\n useEffect(() => {\n if (isGrid) {\n measureScrollable();\n }\n }, [isGrid, gridTemplateColumns, measureScrollable]);\n\n const rootRef = useRef<HTMLDivElement>(null);\n const mergedRootRef = useMergeRefs(rootRef, __internalRootRef);\n const sticky = useTableRootStickyHeader({\n enabled: !!stickyHeader,\n verticalOffset: stickyHeaderVerticalOffset,\n isGrid,\n rootRef,\n scrollerRef,\n });\n const scrollbarRef = useRef<HTMLDivElement>(null);\n const handleScroll = useScrollSync([scrollerRef, scrollbarRef, sticky.copyScrollerRef]);\n\n // Set role=\"region\" whenever scrollable (label passes through even if undefined), matching the\n // existing Table's getTableWrapperRoleProps rather than gating the role on a label.\n const scrollRegionProps = isScrollable\n ? {\n role: 'region' as const,\n tabIndex: 0,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n }\n : {};\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRootRef}>\n {/* TableContext supplies this table's column layout to every part. */}\n <TableContextProvider value={tableContext}>\n {sticky.isSticky && (\n <StickyHeaderSlot\n slotRef={sticky.slotRef}\n copyScrollerRef={sticky.copyScrollerRef}\n copyTableRef={sticky.copyTableRef}\n onScroll={handleScroll}\n onFocus={sticky.onCopyFocus}\n isStuck={sticky.isStuck}\n isGrid={isGrid}\n style={sticky.stickyStyles.style}\n >\n {stickyHeader}\n </StickyHeaderSlot>\n )}\n {/* The page owns vertical scroll; this wrapper reintroduces an inline scroll viewport so a wide table scrolls horizontally instead of spilling out. */}\n <div\n className={styles['body-scroller']}\n ref={scrollerRef}\n onScroll={handleScroll}\n onFocus={sticky.onScrollerFocus}\n onBlur={sticky.onScrollerBlur}\n {...scrollRegionProps}\n >\n <table\n ref={sticky.realTableRef}\n // Without an explicit role, browsers guess whether a table holds data or is only for layout.\n role=\"table\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n aria-rowcount={ariaRowcount}\n className={clsx(styles.table, isGrid ? styles['table-grid'] : styles['table-auto'])}\n >\n {stickyHeader}\n {children}\n </table>\n </div>\n <StickyScrollbar\n ref={scrollbarRef}\n wrapperRef={scrollerRef}\n tableRef={sticky.realTableRef}\n onScroll={handleScroll}\n getContentInlineSize={getScrollerContentInlineSize}\n contentKey={gridTemplateColumns}\n />\n </TableContextProvider>\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface StickyHeaderSlotProps {
|
|
3
|
+
slotRef: React.Ref<HTMLDivElement>;
|
|
4
|
+
copyScrollerRef: React.Ref<HTMLDivElement>;
|
|
5
|
+
copyTableRef: React.Ref<HTMLTableElement>;
|
|
6
|
+
onScroll: React.UIEventHandler<HTMLDivElement>;
|
|
7
|
+
onFocus: React.FocusEventHandler<HTMLDivElement>;
|
|
8
|
+
isStuck: boolean;
|
|
9
|
+
isGrid: boolean;
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export default function StickyHeaderSlot({ slotRef, copyScrollerRef, copyTableRef, onScroll, onFocus, isStuck, isGrid, style, children, }: StickyHeaderSlotProps): JSX.Element;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=sticky-header-slot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sticky-header-slot.d.ts","sourceRoot":"","sources":["../../../src/table-root/sticky-header-slot.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,UAAU,qBAAqB;IAC7B,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACnC,eAAe,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC3C,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC1C,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;IAC/C,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACjD,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAID,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,OAAO,EACP,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,OAAO,EACP,MAAM,EACN,KAAK,EACL,QAAQ,GACT,EAAE,qBAAqB,eAoBvB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import styles from './styles.css.js';
|
|
6
|
+
// Hidden from assistive technology and the tab order, but clickable: it covers the real header. Focus that
|
|
7
|
+
// lands in it is moved to the real header.
|
|
8
|
+
export default function StickyHeaderSlot({ slotRef, copyScrollerRef, copyTableRef, onScroll, onFocus, isStuck, isGrid, style, children, }) {
|
|
9
|
+
return (React.createElement("div", { ref: slotRef, "aria-hidden": true, className: clsx(styles['sticky-slot'], isStuck && styles['sticky-slot-stuck']), style: style, onFocus: onFocus },
|
|
10
|
+
React.createElement("div", { className: styles['sticky-copy-scroller'], ref: copyScrollerRef, onScroll: onScroll, tabIndex: -1 },
|
|
11
|
+
React.createElement("table", { ref: copyTableRef, role: "table", className: clsx(styles.table, isGrid ? styles['table-grid'] : styles['table-copy-fixed']) }, children))));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=sticky-header-slot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sticky-header-slot.js","sourceRoot":"","sources":["../../../src/table-root/sticky-header-slot.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAcrC,2GAA2G;AAC3G,2CAA2C;AAC3C,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,OAAO,EACP,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,OAAO,EACP,MAAM,EACN,KAAK,EACL,QAAQ,GACc;IACtB,OAAO,CACL,6BACE,GAAG,EAAE,OAAO,iBACC,IAAI,EACjB,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,OAAO,IAAI,MAAM,CAAC,mBAAmB,CAAC,CAAC,EAC9E,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO;QAEhB,6BAAK,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC,EAAE,GAAG,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;YACpG,+BACE,GAAG,EAAE,YAAY,EACjB,IAAI,EAAC,OAAO,EACZ,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAExF,QAAQ,CACH,CACJ,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport styles from './styles.css.js';\n\ninterface StickyHeaderSlotProps {\n slotRef: React.Ref<HTMLDivElement>;\n copyScrollerRef: React.Ref<HTMLDivElement>;\n copyTableRef: React.Ref<HTMLTableElement>;\n onScroll: React.UIEventHandler<HTMLDivElement>;\n onFocus: React.FocusEventHandler<HTMLDivElement>;\n isStuck: boolean;\n isGrid: boolean;\n style?: React.CSSProperties;\n children: React.ReactNode;\n}\n\n// Hidden from assistive technology and the tab order, but clickable: it covers the real header. Focus that\n// lands in it is moved to the real header.\nexport default function StickyHeaderSlot({\n slotRef,\n copyScrollerRef,\n copyTableRef,\n onScroll,\n onFocus,\n isStuck,\n isGrid,\n style,\n children,\n}: StickyHeaderSlotProps) {\n return (\n <div\n ref={slotRef}\n aria-hidden={true}\n className={clsx(styles['sticky-slot'], isStuck && styles['sticky-slot-stuck'])}\n style={style}\n onFocus={onFocus}\n >\n <div className={styles['sticky-copy-scroller']} ref={copyScrollerRef} onScroll={onScroll} tabIndex={-1}>\n <table\n ref={copyTableRef}\n role=\"table\"\n className={clsx(styles.table, isGrid ? styles['table-grid'] : styles['table-copy-fixed'])}\n >\n {children}\n </table>\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"root": "
|
|
5
|
-
"body-scroller": "awsui_body-
|
|
6
|
-
"table": "
|
|
7
|
-
"table-auto": "awsui_table-
|
|
8
|
-
"table-grid": "awsui_table-
|
|
4
|
+
"root": "awsui_root_1pkvc_poq3f_9",
|
|
5
|
+
"body-scroller": "awsui_body-scroller_1pkvc_poq3f_46",
|
|
6
|
+
"table": "awsui_table_1pkvc_poq3f_63",
|
|
7
|
+
"table-auto": "awsui_table-auto_1pkvc_poq3f_69",
|
|
8
|
+
"table-grid": "awsui_table-grid_1pkvc_poq3f_73",
|
|
9
|
+
"table-copy-fixed": "awsui_table-copy-fixed_1pkvc_poq3f_77",
|
|
10
|
+
"sticky-slot": "awsui_sticky-slot_1pkvc_poq3f_81",
|
|
11
|
+
"sticky-slot-stuck": "awsui_sticky-slot-stuck_1pkvc_poq3f_88",
|
|
12
|
+
"sticky-copy-scroller": "awsui_sticky-copy-scroller_1pkvc_poq3f_92",
|
|
13
|
+
"sticky-copy-focus": "awsui_sticky-copy-focus_1pkvc_poq3f_100"
|
|
9
14
|
};
|
|
10
15
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/* stylelint-enable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
|
|
7
7
|
/* Style used for links in slots/components that are text heavy, to help links stand out among
|
|
8
8
|
surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
|
|
9
|
-
.
|
|
9
|
+
.awsui_root_1pkvc_poq3f_9:not(#\9) {
|
|
10
10
|
border-collapse: separate;
|
|
11
11
|
border-spacing: 0;
|
|
12
12
|
box-sizing: border-box;
|
|
@@ -43,14 +43,14 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
43
43
|
background: var(--color-background-container-content-mjfil9, #ffffff);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
.awsui_body-
|
|
46
|
+
.awsui_body-scroller_1pkvc_poq3f_46:not(#\9) {
|
|
47
47
|
overflow-x: auto;
|
|
48
48
|
scrollbar-width: none; /* Firefox */
|
|
49
49
|
}
|
|
50
|
-
.awsui_body-
|
|
50
|
+
.awsui_body-scroller_1pkvc_poq3f_46:not(#\9)::-webkit-scrollbar {
|
|
51
51
|
display: none; /* Safari and Chrome */
|
|
52
52
|
}
|
|
53
|
-
body[data-awsui-focus-visible=true] .awsui_body-
|
|
53
|
+
body[data-awsui-focus-visible=true] .awsui_body-scroller_1pkvc_poq3f_46:not(#\9):focus {
|
|
54
54
|
outline: 2px dotted transparent;
|
|
55
55
|
outline-offset: 2px;
|
|
56
56
|
border-start-start-radius: var(--border-radius-container-33hhdh, 0px);
|
|
@@ -60,16 +60,61 @@ body[data-awsui-focus-visible=true] .awsui_body-scroller_1pkvc_1gzz9_46:not(#\9)
|
|
|
60
60
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-sewkzn, #0073bb);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
.
|
|
63
|
+
.awsui_table_1pkvc_poq3f_63:not(#\9) {
|
|
64
64
|
inline-size: 100%;
|
|
65
65
|
border-collapse: separate;
|
|
66
66
|
border-spacing: 0;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
.awsui_table-
|
|
69
|
+
.awsui_table-auto_1pkvc_poq3f_69:not(#\9) {
|
|
70
70
|
table-layout: auto;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
.awsui_table-
|
|
73
|
+
.awsui_table-grid_1pkvc_poq3f_73:not(#\9) {
|
|
74
74
|
display: block;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.awsui_table-copy-fixed_1pkvc_poq3f_77:not(#\9) {
|
|
78
|
+
table-layout: fixed;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.awsui_sticky-slot_1pkvc_poq3f_81:not(#\9) {
|
|
82
|
+
position: sticky;
|
|
83
|
+
inset-block-start: 0;
|
|
84
|
+
z-index: 800;
|
|
85
|
+
background: var(--color-background-table-header-pgyagt, #fafafa);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.awsui_sticky-slot-stuck_1pkvc_poq3f_88:not(#\9) {
|
|
89
|
+
box-shadow: var(--shadow-sticky-embedded-5m1s1m, 0px 1px 4px -2px rgba(0, 28, 36, 0.5));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.awsui_sticky-copy-scroller_1pkvc_poq3f_92:not(#\9) {
|
|
93
|
+
overflow: auto;
|
|
94
|
+
scrollbar-width: none; /* Firefox */
|
|
95
|
+
}
|
|
96
|
+
.awsui_sticky-copy-scroller_1pkvc_poq3f_92:not(#\9)::-webkit-scrollbar {
|
|
97
|
+
display: none; /* Safari and Chrome */
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
body[data-awsui-focus-visible=true] .awsui_sticky-copy-focus_1pkvc_poq3f_100:not(#\9) {
|
|
101
|
+
position: relative;
|
|
102
|
+
}
|
|
103
|
+
body[data-awsui-focus-visible=true] .awsui_sticky-copy-focus_1pkvc_poq3f_100:not(#\9) {
|
|
104
|
+
outline: 2px dotted transparent;
|
|
105
|
+
outline-offset: calc(var(--space-none-8budoy, 0px) - 1px);
|
|
106
|
+
}
|
|
107
|
+
body[data-awsui-focus-visible=true] .awsui_sticky-copy-focus_1pkvc_poq3f_100:not(#\9)::before {
|
|
108
|
+
content: " ";
|
|
109
|
+
display: block;
|
|
110
|
+
position: absolute;
|
|
111
|
+
inset-inline-start: calc(-1 * var(--space-none-8budoy, 0px));
|
|
112
|
+
inset-block-start: calc(-1 * var(--space-none-8budoy, 0px));
|
|
113
|
+
inline-size: calc(100% + var(--space-none-8budoy, 0px) + var(--space-none-8budoy, 0px));
|
|
114
|
+
block-size: calc(100% + var(--space-none-8budoy, 0px) + var(--space-none-8budoy, 0px));
|
|
115
|
+
border-start-start-radius: var(--border-radius-control-default-focus-ring-akwhsf, 2px);
|
|
116
|
+
border-start-end-radius: var(--border-radius-control-default-focus-ring-akwhsf, 2px);
|
|
117
|
+
border-end-start-radius: var(--border-radius-control-default-focus-ring-akwhsf, 2px);
|
|
118
|
+
border-end-end-radius: var(--border-radius-control-default-focus-ring-akwhsf, 2px);
|
|
119
|
+
box-shadow: 0 0 0 2px var(--color-border-item-focused-sewkzn, #0073bb);
|
|
75
120
|
}
|
|
@@ -2,10 +2,15 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"root": "
|
|
6
|
-
"body-scroller": "awsui_body-
|
|
7
|
-
"table": "
|
|
8
|
-
"table-auto": "awsui_table-
|
|
9
|
-
"table-grid": "awsui_table-
|
|
5
|
+
"root": "awsui_root_1pkvc_poq3f_9",
|
|
6
|
+
"body-scroller": "awsui_body-scroller_1pkvc_poq3f_46",
|
|
7
|
+
"table": "awsui_table_1pkvc_poq3f_63",
|
|
8
|
+
"table-auto": "awsui_table-auto_1pkvc_poq3f_69",
|
|
9
|
+
"table-grid": "awsui_table-grid_1pkvc_poq3f_73",
|
|
10
|
+
"table-copy-fixed": "awsui_table-copy-fixed_1pkvc_poq3f_77",
|
|
11
|
+
"sticky-slot": "awsui_sticky-slot_1pkvc_poq3f_81",
|
|
12
|
+
"sticky-slot-stuck": "awsui_sticky-slot-stuck_1pkvc_poq3f_88",
|
|
13
|
+
"sticky-copy-scroller": "awsui_sticky-copy-scroller_1pkvc_poq3f_92",
|
|
14
|
+
"sticky-copy-focus": "awsui_sticky-copy-focus_1pkvc_poq3f_100"
|
|
10
15
|
};
|
|
11
16
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { RefObject } from 'react';
|
|
2
|
+
interface UseTableRootStickyHeaderProps {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
verticalOffset?: number;
|
|
5
|
+
isGrid: boolean;
|
|
6
|
+
rootRef: RefObject<HTMLElement>;
|
|
7
|
+
scrollerRef: RefObject<HTMLElement>;
|
|
8
|
+
}
|
|
9
|
+
export declare function useTableRootStickyHeader({ enabled, verticalOffset, isGrid, rootRef, scrollerRef, }: UseTableRootStickyHeaderProps): {
|
|
10
|
+
isSticky: boolean;
|
|
11
|
+
isStuck: boolean;
|
|
12
|
+
stickyStyles: {
|
|
13
|
+
style: {
|
|
14
|
+
top: string;
|
|
15
|
+
};
|
|
16
|
+
} | {
|
|
17
|
+
style?: undefined;
|
|
18
|
+
};
|
|
19
|
+
slotRef: React.RefObject<HTMLDivElement>;
|
|
20
|
+
copyScrollerRef: React.RefObject<HTMLDivElement>;
|
|
21
|
+
realTableRef: React.RefObject<HTMLTableElement>;
|
|
22
|
+
copyTableRef: React.RefObject<HTMLTableElement>;
|
|
23
|
+
onCopyFocus: (event: React.FocusEvent) => void;
|
|
24
|
+
onScrollerFocus: (event: React.FocusEvent) => void;
|
|
25
|
+
onScrollerBlur: () => void;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=use-sticky-header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-sticky-header.d.ts","sourceRoot":"","sources":["../../../src/table-root/use-sticky-header.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAkD,MAAM,OAAO,CAAC;AAYzF,UAAU,6BAA6B;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAChC,WAAW,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;CACrC;AAkBD,wBAAgB,wBAAwB,CAAC,EACvC,OAAO,EACP,cAAc,EACd,MAAM,EACN,OAAO,EACP,WAAW,GACZ,EAAE,6BAA6B;;;;;;;;;;;;;;yBAiEF,KAAK,CAAC,UAAU;6BA8BZ,KAAK,CAAC,UAAU;;EA+BjD"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { useCallback, useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
+
import { useCellsResizeObserver } from '../internal/components/sticky-header/use-cells-resize-observer';
|
|
5
|
+
import { useStickyHeaderCopy } from '../internal/components/sticky-header/use-sticky-header-copy';
|
|
6
|
+
import { useStickyPosition } from '../internal/components/sticky-header/use-sticky-position';
|
|
7
|
+
import { useUntabbableDescendants } from '../internal/components/sticky-header/use-untabbable-descendants';
|
|
8
|
+
import useMouseDownTarget from '../internal/hooks/use-mouse-down-target';
|
|
9
|
+
import { setElementWidths } from '../table/column-widths-utils';
|
|
10
|
+
import abstractSwitchStyles from '../internal/components/abstract-switch/styles.css.js';
|
|
11
|
+
import styles from './styles.css.js';
|
|
12
|
+
const getHeaderCells = (head) => head ? Array.from(head.rows).flatMap(row => Array.from(row.cells)) : [];
|
|
13
|
+
// The copy renders the same header, so an element's child-index path finds its counterpart in the copy.
|
|
14
|
+
function pathFrom(root, element) {
|
|
15
|
+
const path = [];
|
|
16
|
+
for (let current = element; current !== root && current.parentElement; current = current.parentElement) {
|
|
17
|
+
path.unshift(Array.prototype.indexOf.call(current.parentElement.children, current));
|
|
18
|
+
}
|
|
19
|
+
return path;
|
|
20
|
+
}
|
|
21
|
+
function elementAtPath(root, path) {
|
|
22
|
+
var _a;
|
|
23
|
+
return (_a = path.reduce((element, index) => element === null || element === void 0 ? void 0 : element.children[index], root)) !== null && _a !== void 0 ? _a : null;
|
|
24
|
+
}
|
|
25
|
+
export function useTableRootStickyHeader({ enabled, verticalOffset, isGrid, rootRef, scrollerRef, }) {
|
|
26
|
+
const slotRef = useRef(null);
|
|
27
|
+
const copyScrollerRef = useRef(null);
|
|
28
|
+
const realTableRef = useRef(null);
|
|
29
|
+
const copyTableRef = useRef(null);
|
|
30
|
+
const realHeaderRef = useRef(null);
|
|
31
|
+
const copyHeaderRef = useRef(null);
|
|
32
|
+
useLayoutEffect(() => {
|
|
33
|
+
var _a, _b, _c, _d;
|
|
34
|
+
realHeaderRef.current = (_b = (_a = realTableRef.current) === null || _a === void 0 ? void 0 : _a.tHead) !== null && _b !== void 0 ? _b : null;
|
|
35
|
+
copyHeaderRef.current = (_d = (_c = copyTableRef.current) === null || _c === void 0 ? void 0 : _c.tHead) !== null && _d !== void 0 ? _d : null;
|
|
36
|
+
});
|
|
37
|
+
const { isSticky, isStuck, stickyStyles } = useStickyPosition(rootRef, slotRef, {
|
|
38
|
+
sticky: enabled,
|
|
39
|
+
offset: verticalOffset,
|
|
40
|
+
});
|
|
41
|
+
const { scrollToRow } = useStickyHeaderCopy({
|
|
42
|
+
tableRef: realTableRef,
|
|
43
|
+
theadRef: realHeaderRef,
|
|
44
|
+
secondaryTheadRef: copyHeaderRef,
|
|
45
|
+
secondaryTableRef: copyTableRef,
|
|
46
|
+
tableWrapperRef: scrollerRef,
|
|
47
|
+
});
|
|
48
|
+
// useStickyHeaderCopy pulls the scroller up to hide the real header under the copy, but doesn't undo it.
|
|
49
|
+
useLayoutEffect(() => {
|
|
50
|
+
if (!isSticky && scrollerRef.current) {
|
|
51
|
+
scrollerRef.current.style.marginBlockStart = '';
|
|
52
|
+
}
|
|
53
|
+
}, [isSticky, scrollerRef]);
|
|
54
|
+
// In grid layout the copy shares the column template; in auto layout it copies the real cells' widths.
|
|
55
|
+
// The layout is read from a ref so the callback never changes, as the resize observer can call an older one.
|
|
56
|
+
const isGridRef = useRef(isGrid);
|
|
57
|
+
useLayoutEffect(() => {
|
|
58
|
+
isGridRef.current = isGrid;
|
|
59
|
+
});
|
|
60
|
+
const syncColumnWidths = useCallback(() => {
|
|
61
|
+
if (!copyHeaderRef.current) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const copyCells = getHeaderCells(copyHeaderRef.current);
|
|
65
|
+
const widths = isGridRef.current
|
|
66
|
+
? []
|
|
67
|
+
: getHeaderCells(realHeaderRef.current).map(cell => cell.getBoundingClientRect().width);
|
|
68
|
+
copyCells.forEach((cell, index) => setElementWidths(cell, { width: widths[index] }));
|
|
69
|
+
}, []);
|
|
70
|
+
useLayoutEffect(() => {
|
|
71
|
+
syncColumnWidths();
|
|
72
|
+
});
|
|
73
|
+
useCellsResizeObserver(() => (isSticky && !isGrid ? getHeaderCells(realHeaderRef.current) : []), syncColumnWidths);
|
|
74
|
+
// The scroll sync only reacts to scroll events, so a copy that mounts after the body has scrolled starts aligned.
|
|
75
|
+
useLayoutEffect(() => {
|
|
76
|
+
if (isSticky && copyScrollerRef.current && scrollerRef.current) {
|
|
77
|
+
copyScrollerRef.current.scrollLeft = scrollerRef.current.scrollLeft;
|
|
78
|
+
}
|
|
79
|
+
}, [isSticky, scrollerRef]);
|
|
80
|
+
useUntabbableDescendants(slotRef);
|
|
81
|
+
// The copy is hidden from assistive technology, so focus that lands in it (from a click) moves to the
|
|
82
|
+
// matching control in the real header. The click itself still reaches the copy.
|
|
83
|
+
const onCopyFocus = (event) => {
|
|
84
|
+
const target = event.target;
|
|
85
|
+
const copyHeader = copyHeaderRef.current;
|
|
86
|
+
const realHeader = realHeaderRef.current;
|
|
87
|
+
if (copyHeader && realHeader && copyHeader.contains(target)) {
|
|
88
|
+
const realElement = elementAtPath(realHeader, pathFrom(copyHeader, target));
|
|
89
|
+
realElement === null || realElement === void 0 ? void 0 : realElement.focus({ preventScroll: true });
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
// The real header is covered by the copy, so the copy shows its focus ring. A checkbox or radio draws its
|
|
93
|
+
// ring on the outline next to its hidden input, which is shown only for keyboard focus, like other rings.
|
|
94
|
+
const [focusedHeaderPath, setFocusedHeaderPath] = useState(null);
|
|
95
|
+
useLayoutEffect(() => {
|
|
96
|
+
var _a;
|
|
97
|
+
const copyElement = focusedHeaderPath && copyHeaderRef.current ? elementAtPath(copyHeaderRef.current, focusedHeaderPath) : null;
|
|
98
|
+
const isKeyboardFocus = document.body.hasAttribute('data-awsui-focus-visible');
|
|
99
|
+
const switchOutline = isKeyboardFocus && ((_a = copyElement === null || copyElement === void 0 ? void 0 : copyElement.nextElementSibling) === null || _a === void 0 ? void 0 : _a.classList.contains(abstractSwitchStyles.outline))
|
|
100
|
+
? copyElement.nextElementSibling
|
|
101
|
+
: null;
|
|
102
|
+
copyElement === null || copyElement === void 0 ? void 0 : copyElement.classList.add(styles['sticky-copy-focus']);
|
|
103
|
+
switchOutline === null || switchOutline === void 0 ? void 0 : switchOutline.classList.add(abstractSwitchStyles['show-outline']);
|
|
104
|
+
return () => {
|
|
105
|
+
copyElement === null || copyElement === void 0 ? void 0 : copyElement.classList.remove(styles['sticky-copy-focus']);
|
|
106
|
+
switchOutline === null || switchOutline === void 0 ? void 0 : switchOutline.classList.remove(abstractSwitchStyles['show-outline']);
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
const getMouseDownTarget = useMouseDownTarget();
|
|
110
|
+
const onScrollerFocus = (event) => {
|
|
111
|
+
const target = event.target;
|
|
112
|
+
const realHeader = realHeaderRef.current;
|
|
113
|
+
if (!isSticky) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (realHeader === null || realHeader === void 0 ? void 0 : realHeader.contains(target)) {
|
|
117
|
+
setFocusedHeaderPath(pathFrom(realHeader, target));
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
// Keeps a focused body row from scrolling under the copy. Skipped for clicks: moving the row
|
|
121
|
+
// between mouse down and mouse up would stop the click reaching its target.
|
|
122
|
+
const row = target.closest('tr');
|
|
123
|
+
if (row && !row.contains(getMouseDownTarget())) {
|
|
124
|
+
scrollToRow(row);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const onScrollerBlur = () => setFocusedHeaderPath(null);
|
|
128
|
+
return {
|
|
129
|
+
isSticky,
|
|
130
|
+
isStuck,
|
|
131
|
+
stickyStyles,
|
|
132
|
+
slotRef,
|
|
133
|
+
copyScrollerRef,
|
|
134
|
+
realTableRef,
|
|
135
|
+
copyTableRef,
|
|
136
|
+
onCopyFocus,
|
|
137
|
+
onScrollerFocus,
|
|
138
|
+
onScrollerBlur,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=use-sticky-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-sticky-header.js","sourceRoot":"","sources":["../../../src/table-root/use-sticky-header.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAa,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gEAAgE,CAAC;AACxG,OAAO,EAAE,mBAAmB,EAAE,MAAM,6DAA6D,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,0DAA0D,CAAC;AAC7F,OAAO,EAAE,wBAAwB,EAAE,MAAM,iEAAiE,CAAC;AAC3G,OAAO,kBAAkB,MA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,eAAe;QACf,YAAY;QACZ,YAAY;QACZ,WAAW;QACX,eAAe;QACf,cAAc;KACf,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { RefObject, useCallback, useLayoutEffect, useRef, useState } from 'react';\n\nimport { useCellsResizeObserver } from '../internal/components/sticky-header/use-cells-resize-observer';\nimport { useStickyHeaderCopy } from '../internal/components/sticky-header/use-sticky-header-copy';\nimport { useStickyPosition } from '../internal/components/sticky-header/use-sticky-position';\nimport { useUntabbableDescendants } from '../internal/components/sticky-header/use-untabbable-descendants';\nimport useMouseDownTarget from '../internal/hooks/use-mouse-down-target';\nimport { setElementWidths } from '../table/column-widths-utils';\n\nimport abstractSwitchStyles from '../internal/components/abstract-switch/styles.css.js';\nimport styles from './styles.css.js';\n\ninterface UseTableRootStickyHeaderProps {\n enabled: boolean;\n verticalOffset?: number;\n isGrid: boolean;\n rootRef: RefObject<HTMLElement>;\n scrollerRef: RefObject<HTMLElement>;\n}\n\nconst getHeaderCells = (head: HTMLTableSectionElement | null) =>\n head ? Array.from(head.rows).flatMap(row => Array.from(row.cells)) : [];\n\n// The copy renders the same header, so an element's child-index path finds its counterpart in the copy.\nfunction pathFrom(root: Element, element: Element) {\n const path: number[] = [];\n for (let current = element; current !== root && current.parentElement; current = current.parentElement) {\n path.unshift(Array.prototype.indexOf.call(current.parentElement.children, current));\n }\n return path;\n}\n\nfunction elementAtPath(root: Element, path: number[]) {\n return path.reduce<Element | undefined>((element, index) => element?.children[index], root) ?? null;\n}\n\nexport function useTableRootStickyHeader({\n enabled,\n verticalOffset,\n isGrid,\n rootRef,\n scrollerRef,\n}: UseTableRootStickyHeaderProps) {\n const slotRef = useRef<HTMLDivElement>(null);\n const copyScrollerRef = useRef<HTMLDivElement>(null);\n const realTableRef = useRef<HTMLTableElement>(null);\n const copyTableRef = useRef<HTMLTableElement>(null);\n const realHeaderRef = useRef<HTMLTableSectionElement | null>(null);\n const copyHeaderRef = useRef<HTMLTableSectionElement | null>(null);\n\n useLayoutEffect(() => {\n realHeaderRef.current = realTableRef.current?.tHead ?? null;\n copyHeaderRef.current = copyTableRef.current?.tHead ?? null;\n });\n\n const { isSticky, isStuck, stickyStyles } = useStickyPosition(rootRef, slotRef, {\n sticky: enabled,\n offset: verticalOffset,\n });\n\n const { scrollToRow } = useStickyHeaderCopy({\n tableRef: realTableRef,\n theadRef: realHeaderRef,\n secondaryTheadRef: copyHeaderRef,\n secondaryTableRef: copyTableRef,\n tableWrapperRef: scrollerRef,\n });\n\n // useStickyHeaderCopy pulls the scroller up to hide the real header under the copy, but doesn't undo it.\n useLayoutEffect(() => {\n if (!isSticky && scrollerRef.current) {\n scrollerRef.current.style.marginBlockStart = '';\n }\n }, [isSticky, scrollerRef]);\n\n // In grid layout the copy shares the column template; in auto layout it copies the real cells' widths.\n // The layout is read from a ref so the callback never changes, as the resize observer can call an older one.\n const isGridRef = useRef(isGrid);\n useLayoutEffect(() => {\n isGridRef.current = isGrid;\n });\n const syncColumnWidths = useCallback(() => {\n if (!copyHeaderRef.current) {\n return;\n }\n const copyCells = getHeaderCells(copyHeaderRef.current);\n const widths = isGridRef.current\n ? []\n : getHeaderCells(realHeaderRef.current).map(cell => cell.getBoundingClientRect().width);\n copyCells.forEach((cell, index) => setElementWidths(cell, { width: widths[index] }));\n }, []);\n useLayoutEffect(() => {\n syncColumnWidths();\n });\n useCellsResizeObserver(() => (isSticky && !isGrid ? getHeaderCells(realHeaderRef.current) : []), syncColumnWidths);\n\n // The scroll sync only reacts to scroll events, so a copy that mounts after the body has scrolled starts aligned.\n useLayoutEffect(() => {\n if (isSticky && copyScrollerRef.current && scrollerRef.current) {\n copyScrollerRef.current.scrollLeft = scrollerRef.current.scrollLeft;\n }\n }, [isSticky, scrollerRef]);\n\n useUntabbableDescendants(slotRef);\n\n // The copy is hidden from assistive technology, so focus that lands in it (from a click) moves to the\n // matching control in the real header. The click itself still reaches the copy.\n const onCopyFocus = (event: React.FocusEvent) => {\n const target = event.target as HTMLElement;\n const copyHeader = copyHeaderRef.current;\n const realHeader = realHeaderRef.current;\n if (copyHeader && realHeader && copyHeader.contains(target)) {\n const realElement = elementAtPath(realHeader, pathFrom(copyHeader, target)) as HTMLElement | null;\n realElement?.focus({ preventScroll: true });\n }\n };\n\n // The real header is covered by the copy, so the copy shows its focus ring. A checkbox or radio draws its\n // ring on the outline next to its hidden input, which is shown only for keyboard focus, like other rings.\n const [focusedHeaderPath, setFocusedHeaderPath] = useState<number[] | null>(null);\n useLayoutEffect(() => {\n const copyElement =\n focusedHeaderPath && copyHeaderRef.current ? elementAtPath(copyHeaderRef.current, focusedHeaderPath) : null;\n const isKeyboardFocus = document.body.hasAttribute('data-awsui-focus-visible');\n const switchOutline =\n isKeyboardFocus && copyElement?.nextElementSibling?.classList.contains(abstractSwitchStyles.outline)\n ? copyElement.nextElementSibling\n : null;\n copyElement?.classList.add(styles['sticky-copy-focus']);\n switchOutline?.classList.add(abstractSwitchStyles['show-outline']);\n return () => {\n copyElement?.classList.remove(styles['sticky-copy-focus']);\n switchOutline?.classList.remove(abstractSwitchStyles['show-outline']);\n };\n });\n\n const getMouseDownTarget = useMouseDownTarget();\n const onScrollerFocus = (event: React.FocusEvent) => {\n const target = event.target as HTMLElement;\n const realHeader = realHeaderRef.current;\n if (!isSticky) {\n return;\n }\n if (realHeader?.contains(target)) {\n setFocusedHeaderPath(pathFrom(realHeader, target));\n return;\n }\n // Keeps a focused body row from scrolling under the copy. Skipped for clicks: moving the row\n // between mouse down and mouse up would stop the click reaching its target.\n const row = target.closest('tr');\n if (row && !row.contains(getMouseDownTarget())) {\n scrollToRow(row);\n }\n };\n const onScrollerBlur = () => setFocusedHeaderPath(null);\n\n return {\n isSticky,\n isStuck,\n stickyStyles,\n slotRef,\n copyScrollerRef,\n realTableRef,\n copyTableRef,\n onCopyFocus,\n onScrollerFocus,\n onScrollerBlur,\n };\n}\n"]}
|
|
@@ -20,6 +20,9 @@ class HeaderWrapper extends dom_1.ComponentWrapper {
|
|
|
20
20
|
findActions() {
|
|
21
21
|
return this.findByClassName(styles_selectors_js_1.default.actions);
|
|
22
22
|
}
|
|
23
|
+
findSecondaryContent() {
|
|
24
|
+
return this.findByClassName(styles_selectors_js_1.default['secondary-content']);
|
|
25
|
+
}
|
|
23
26
|
}
|
|
24
27
|
HeaderWrapper.rootSelector = styles_selectors_js_1.default.root;
|
|
25
28
|
exports.default = HeaderWrapper;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/dom/header/index.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,gEAA0F;AAE1F,6EAAyD;AAEzD,MAAqB,aAAc,SAAQ,sBAAgB;IAGzD,eAAe;QACb,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAM,CAAC,cAAc,CAAC,CAAE,CAAC;IACvD,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAM,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,eAAe;QACb,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAM,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAM,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAM,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/dom/header/index.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,gEAA0F;AAE1F,6EAAyD;AAEzD,MAAqB,aAAc,SAAQ,sBAAgB;IAGzD,eAAe;QACb,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAM,CAAC,cAAc,CAAC,CAAE,CAAC;IACvD,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAM,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,eAAe;QACb,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAM,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAM,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAM,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,oBAAoB;QAClB,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC3D,CAAC;;AAxBM,0BAAY,GAAW,6BAAM,CAAC,IAAI,CAAC;kBADvB,aAAa"}
|
|
@@ -58,6 +58,7 @@ import MixedLineBarChartWrapper from './mixed-line-bar-chart';
|
|
|
58
58
|
import ModalWrapper from './modal';
|
|
59
59
|
import MultiselectWrapper from './multiselect';
|
|
60
60
|
import NavigableGroupWrapper from './navigable-group';
|
|
61
|
+
import OptionListWrapper from './option-list';
|
|
61
62
|
import PaginationWrapper from './pagination';
|
|
62
63
|
import PanelLayoutWrapper from './panel-layout';
|
|
63
64
|
import PieChartWrapper from './pie-chart';
|
|
@@ -160,6 +161,7 @@ export { MixedLineBarChartWrapper };
|
|
|
160
161
|
export { ModalWrapper };
|
|
161
162
|
export { MultiselectWrapper };
|
|
162
163
|
export { NavigableGroupWrapper };
|
|
164
|
+
export { OptionListWrapper };
|
|
163
165
|
export { PaginationWrapper };
|
|
164
166
|
export { PanelLayoutWrapper };
|
|
165
167
|
export { PieChartWrapper };
|
|
@@ -1714,6 +1716,32 @@ declare module '@cloudscape-design/test-utils-core/dist/dom' {
|
|
|
1714
1716
|
* @returns {NavigableGroupWrapper | null}
|
|
1715
1717
|
*/
|
|
1716
1718
|
findClosestNavigableGroup(): NavigableGroupWrapper | null;
|
|
1719
|
+
/**
|
|
1720
|
+
* Returns the wrapper of the first OptionList that matches the specified CSS selector.
|
|
1721
|
+
* If no CSS selector is specified, returns the wrapper of the first OptionList.
|
|
1722
|
+
* If no matching OptionList is found, returns `null`.
|
|
1723
|
+
*
|
|
1724
|
+
* @param {string} [selector] CSS Selector
|
|
1725
|
+
* @returns {OptionListWrapper | null}
|
|
1726
|
+
*/
|
|
1727
|
+
findOptionList(selector?: string): OptionListWrapper | null;
|
|
1728
|
+
/**
|
|
1729
|
+
* Returns an array of OptionList wrapper that matches the specified CSS selector.
|
|
1730
|
+
* If no CSS selector is specified, returns all of the OptionLists inside the current wrapper.
|
|
1731
|
+
* If no matching OptionList is found, returns an empty array.
|
|
1732
|
+
*
|
|
1733
|
+
* @param {string} [selector] CSS Selector
|
|
1734
|
+
* @returns {Array<OptionListWrapper>}
|
|
1735
|
+
*/
|
|
1736
|
+
findAllOptionLists(selector?: string): Array<OptionListWrapper>;
|
|
1737
|
+
/**
|
|
1738
|
+
* Returns the wrapper of the closest parent OptionList for the current element,
|
|
1739
|
+
* or the element itself if it is an instance of OptionList.
|
|
1740
|
+
* If no OptionList is found, returns `null`.
|
|
1741
|
+
*
|
|
1742
|
+
* @returns {OptionListWrapper | null}
|
|
1743
|
+
*/
|
|
1744
|
+
findClosestOptionList(): OptionListWrapper | null;
|
|
1717
1745
|
/**
|
|
1718
1746
|
* Returns the wrapper of the first Pagination that matches the specified CSS selector.
|
|
1719
1747
|
* If no CSS selector is specified, returns the wrapper of the first Pagination.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ItemCardWrapper = exports.InputWrapper = exports.IconWrapper = exports.HotspotWrapper = exports.HelpPanelWrapper = exports.HeaderWrapper = exports.GridWrapper = exports.FormFieldWrapper = exports.FormWrapper = exports.FlashbarWrapper = exports.FileUploadWrapper = exports.FileTokenGroupWrapper = exports.FileInputWrapper = exports.FileDropzoneWrapper = exports.ExpandableSectionWrapper = exports.ErrorBoundaryWrapper = exports.DropdownWrapper = exports.DrawerWrapper = exports.DividerWrapper = exports.DialogWrapper = exports.DateRangePickerWrapper = exports.DatePickerWrapper = exports.DateInputWrapper = exports.CopyToClipboardWrapper = exports.ControlGroupWrapper = exports.ContentLayoutWrapper = exports.ContainerWrapper = exports.ColumnLayoutWrapper = exports.CollectionPreferencesWrapper = exports.CodeEditorWrapper = exports.CheckboxWrapper = exports.CardsWrapper = exports.CalendarWrapper = exports.ButtonGroupWrapper = exports.ButtonDropdownWrapper = exports.ButtonWrapper = exports.BreadcrumbGroupWrapper = exports.BoxWrapper = exports.BarChartWrapper = exports.BadgeWrapper = exports.AutosuggestWrapper = exports.AttributeEditorWrapper = exports.AreaChartWrapper = exports.AppLayoutToolbarWrapper = exports.AppLayoutWrapper = exports.AnnotationWrapper = exports.AnchorNavigationWrapper = exports.AlertWrapper = exports.ActionCardWrapper = exports.ElementWrapper = void 0;
|
|
4
|
-
exports.
|
|
5
|
-
exports.WizardWrapper = exports.TutorialPanelWrapper = exports.TruncatedTextWrapper = void 0;
|
|
4
|
+
exports.TopNavigationWrapper = exports.TooltipWrapper = exports.TokenGroupWrapper = exports.TokenWrapper = exports.ToggleButtonWrapper = exports.ToggleWrapper = exports.TimeInputWrapper = exports.TilesWrapper = exports.TextareaWrapper = exports.TextFilterWrapper = exports.TextContentWrapper = exports.TagEditorWrapper = exports.TabsWrapper = exports.TableRowWrapper = exports.TableRootWrapper = exports.TableHeaderCellWrapper = exports.TableHeadWrapper = exports.TableBodyCellWrapper = exports.TableBodyWrapper = exports.TableWrapper = exports.StepsWrapper = exports.StatusIndicatorWrapper = exports.SplitPanelWrapper = exports.SpinnerWrapper = exports.SpaceBetweenWrapper = exports.SliderWrapper = exports.SkeletonWrapper = exports.SideNavigationWrapper = exports.SelectWrapper = exports.SegmentedControlWrapper = exports.S3ResourceSelectorWrapper = exports.RadioGroupWrapper = exports.RadioButtonWrapper = exports.PropertyFilterWrapper = exports.PromptInputWrapper = exports.ProgressBarWrapper = exports.PopoverWrapper = exports.PieChartWrapper = exports.PanelLayoutWrapper = exports.PaginationWrapper = exports.OptionListWrapper = exports.NavigableGroupWrapper = exports.MultiselectWrapper = exports.ModalWrapper = exports.MixedLineBarChartWrapper = exports.LiveRegionWrapper = exports.ListWrapper = exports.LinkWrapper = exports.LineChartWrapper = exports.KeyValuePairsWrapper = void 0;
|
|
5
|
+
exports.WizardWrapper = exports.TutorialPanelWrapper = exports.TruncatedTextWrapper = exports.TreeViewWrapper = void 0;
|
|
6
6
|
exports.default = wrapper;
|
|
7
7
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
8
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -125,6 +125,8 @@ const multiselect_1 = require("./multiselect");
|
|
|
125
125
|
exports.MultiselectWrapper = multiselect_1.default;
|
|
126
126
|
const navigable_group_1 = require("./navigable-group");
|
|
127
127
|
exports.NavigableGroupWrapper = navigable_group_1.default;
|
|
128
|
+
const option_list_1 = require("./option-list");
|
|
129
|
+
exports.OptionListWrapper = option_list_1.default;
|
|
128
130
|
const pagination_1 = require("./pagination");
|
|
129
131
|
exports.PaginationWrapper = pagination_1.default;
|
|
130
132
|
const panel_layout_1 = require("./panel-layout");
|
|
@@ -909,6 +911,18 @@ dom_1.ElementWrapper.prototype.findNavigableGroup = function (selector) {
|
|
|
909
911
|
dom_1.ElementWrapper.prototype.findAllNavigableGroups = function (selector) {
|
|
910
912
|
return this.findAllComponents(navigable_group_1.default, selector);
|
|
911
913
|
};
|
|
914
|
+
dom_1.ElementWrapper.prototype.findOptionList = function (selector) {
|
|
915
|
+
let rootSelector = `.${option_list_1.default.rootSelector}`;
|
|
916
|
+
if ("legacyRootSelector" in option_list_1.default && option_list_1.default.legacyRootSelector) {
|
|
917
|
+
rootSelector = `:is(.${option_list_1.default.rootSelector}, .${option_list_1.default.legacyRootSelector})`;
|
|
918
|
+
}
|
|
919
|
+
// casting to 'any' is needed to avoid this issue with generics
|
|
920
|
+
// https://github.com/microsoft/TypeScript/issues/29132
|
|
921
|
+
return this.findComponent(selector ? (0, utils_1.appendSelector)(selector, rootSelector) : rootSelector, option_list_1.default);
|
|
922
|
+
};
|
|
923
|
+
dom_1.ElementWrapper.prototype.findAllOptionLists = function (selector) {
|
|
924
|
+
return this.findAllComponents(option_list_1.default, selector);
|
|
925
|
+
};
|
|
912
926
|
dom_1.ElementWrapper.prototype.findPagination = function (selector) {
|
|
913
927
|
let rootSelector = `.${pagination_1.default.rootSelector}`;
|
|
914
928
|
if ("legacyRootSelector" in pagination_1.default && pagination_1.default.legacyRootSelector) {
|
|
@@ -1727,6 +1741,11 @@ dom_1.ElementWrapper.prototype.findClosestNavigableGroup = function () {
|
|
|
1727
1741
|
// https://github.com/microsoft/TypeScript/issues/29132
|
|
1728
1742
|
return this.findClosestComponent(navigable_group_1.default);
|
|
1729
1743
|
};
|
|
1744
|
+
dom_1.ElementWrapper.prototype.findClosestOptionList = function () {
|
|
1745
|
+
// casting to 'any' is needed to avoid this issue with generics
|
|
1746
|
+
// https://github.com/microsoft/TypeScript/issues/29132
|
|
1747
|
+
return this.findClosestComponent(option_list_1.default);
|
|
1748
|
+
};
|
|
1730
1749
|
dom_1.ElementWrapper.prototype.findClosestPagination = function () {
|
|
1731
1750
|
// casting to 'any' is needed to avoid this issue with generics
|
|
1732
1751
|
// https://github.com/microsoft/TypeScript/issues/29132
|