@cloudscape-design/components 3.0.837 → 3.0.838

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 (53) hide show
  1. package/cards/index.d.ts.map +1 -1
  2. package/cards/index.js +1 -0
  3. package/cards/index.js.map +1 -1
  4. package/collection-preferences/index.d.ts.map +1 -1
  5. package/collection-preferences/index.js +2 -1
  6. package/collection-preferences/index.js.map +1 -1
  7. package/collection-preferences/interfaces.d.ts +15 -8
  8. package/collection-preferences/interfaces.d.ts.map +1 -1
  9. package/collection-preferences/interfaces.js.map +1 -1
  10. package/internal/environment.js +1 -1
  11. package/internal/environment.json +1 -1
  12. package/internal/manifest.json +1 -1
  13. package/package.json +1 -1
  14. package/table/body-cell/disabled-inline-editor.d.ts +1 -1
  15. package/table/body-cell/disabled-inline-editor.d.ts.map +1 -1
  16. package/table/body-cell/disabled-inline-editor.js +2 -2
  17. package/table/body-cell/disabled-inline-editor.js.map +1 -1
  18. package/table/body-cell/index.d.ts +1 -5
  19. package/table/body-cell/index.d.ts.map +1 -1
  20. package/table/body-cell/index.js +11 -13
  21. package/table/body-cell/index.js.map +1 -1
  22. package/table/body-cell/td-element.d.ts +6 -2
  23. package/table/body-cell/td-element.d.ts.map +1 -1
  24. package/table/body-cell/td-element.js +5 -2
  25. package/table/body-cell/td-element.js.map +1 -1
  26. package/table/header-cell/index.d.ts +5 -2
  27. package/table/header-cell/index.d.ts.map +1 -1
  28. package/table/header-cell/index.js +2 -2
  29. package/table/header-cell/index.js.map +1 -1
  30. package/table/header-cell/th-element.d.ts +8 -4
  31. package/table/header-cell/th-element.d.ts.map +1 -1
  32. package/table/header-cell/th-element.js +5 -2
  33. package/table/header-cell/th-element.js.map +1 -1
  34. package/table/index.d.ts.map +1 -1
  35. package/table/index.js +2 -0
  36. package/table/index.js.map +1 -1
  37. package/table/internal.d.ts.map +1 -1
  38. package/table/internal.js +6 -8
  39. package/table/internal.js.map +1 -1
  40. package/table/progressive-loading/items-loader.d.ts +1 -2
  41. package/table/progressive-loading/items-loader.d.ts.map +1 -1
  42. package/table/progressive-loading/items-loader.js.map +1 -1
  43. package/table/progressive-loading/loader-cell.d.ts +7 -0
  44. package/table/progressive-loading/loader-cell.d.ts.map +1 -0
  45. package/table/progressive-loading/loader-cell.js +11 -0
  46. package/table/progressive-loading/loader-cell.js.map +1 -0
  47. package/table/selection/selection-cell.d.ts +18 -0
  48. package/table/selection/selection-cell.d.ts.map +1 -0
  49. package/table/selection/selection-cell.js +23 -0
  50. package/table/selection/selection-cell.js.map +1 -0
  51. package/table/thead.d.ts.map +1 -1
  52. package/table/thead.js +16 -18
  53. package/table/thead.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cards/index.tsx"],"names":[],"mappings":"AAgCA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI/D,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,qBA0Kc,CAAC;AAE1B,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cards/index.tsx"],"names":[],"mappings":"AAgCA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI/D,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,qBA2Kc,CAAC;AAE1B,eAAe,KAAK,CAAC"}
package/cards/index.js CHANGED
@@ -28,6 +28,7 @@ const Cards = React.forwardRef(function (_a, ref) {
28
28
  var { items = [], cardDefinition, cardsPerRow = [], header, filter, pagination, preferences, empty, loading, loadingText, trackBy, selectedItems, selectionType, isItemDisabled, onSelectionChange, ariaLabels, visibleSections, stickyHeader, stickyHeaderVerticalOffset, variant = 'container', renderAriaLive, firstIndex = 1, totalItemsCount, entireCardClickable } = _a, rest = __rest(_a, ["items", "cardDefinition", "cardsPerRow", "header", "filter", "pagination", "preferences", "empty", "loading", "loadingText", "trackBy", "selectedItems", "selectionType", "isItemDisabled", "onSelectionChange", "ariaLabels", "visibleSections", "stickyHeader", "stickyHeaderVerticalOffset", "variant", "renderAriaLive", "firstIndex", "totalItemsCount", "entireCardClickable"]);
29
29
  const { __internalRootRef } = useBaseComponent('Cards', {
30
30
  props: { entireCardClickable, selectionType, stickyHeader, variant },
31
+ metadata: { usesVisibleSections: !!visibleSections },
31
32
  });
32
33
  const baseProps = getBaseProps(rest);
33
34
  const isRefresh = useVisualRefresh();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cards/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAqB,WAAW,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC3F,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAEzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAC7F,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,kBAAkB,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC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affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { FocusEventHandler, useCallback, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\n\nimport { InternalContainerAsSubstep } from '../container/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { AnalyticsFunnelSubStep } from '../internal/analytics/components/analytics-funnel';\nimport { getBaseProps } from '../internal/base-component';\nimport { CollectionLabelContext } from '../internal/context/collection-label-context';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport useMouseDownTarget from '../internal/hooks/use-mouse-down-target';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport InternalLiveRegion from '../live-region/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport {\n focusMarkers,\n SelectionControl,\n SelectionControlProps,\n useSelection,\n useSelectionFocusMove,\n} from '../table/selection';\nimport stickyScrolling from '../table/sticky-scrolling';\nimport ToolsHeader from '../table/tools-header';\nimport { getItemKey } from '../table/utils';\nimport { getCardsPerRow } from './cards-layout-helper';\nimport { CardsForwardRefType, CardsProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\nexport { CardsProps };\n\nconst Cards = React.forwardRef(function <T = any>(\n {\n items = [],\n cardDefinition,\n cardsPerRow = [],\n header,\n filter,\n pagination,\n preferences,\n empty,\n loading,\n loadingText,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels,\n visibleSections,\n stickyHeader,\n stickyHeaderVerticalOffset,\n variant = 'container',\n renderAriaLive,\n firstIndex = 1,\n totalItemsCount,\n entireCardClickable,\n ...rest\n }: CardsProps<T>,\n ref: React.Ref<CardsProps.Ref>\n) {\n const { __internalRootRef } = useBaseComponent('Cards', {\n props: { entireCardClickable, selectionType, stickyHeader, variant },\n });\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n const isMobile = useMobile();\n\n const computedVariant = isRefresh ? variant : 'container';\n\n const headerIdRef = useRef<string | undefined>(undefined);\n const setHeaderRef = useCallback((id: string) => {\n headerIdRef.current = id;\n }, []);\n const isLabelledByHeader = !ariaLabels?.cardsLabel && !!header;\n\n const [columns, measureRef] = useContainerQuery<number>(\n ({ contentBoxWidth }) => getCardsPerRow(contentBoxWidth, cardsPerRow),\n [cardsPerRow]\n );\n const refObject = useRef(null);\n const mergedRef = useMergeRefs(measureRef, refObject, __internalRootRef);\n const getMouseDownTarget = useMouseDownTarget();\n\n const i18n = useInternalI18n('cards');\n const { isItemSelected, getItemSelectionProps } = useSelection({\n items,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels: {\n itemSelectionLabel: ariaLabels?.itemSelectionLabel,\n selectionGroupLabel: i18n('ariaLabels.selectionGroupLabel', ariaLabels?.selectionGroupLabel),\n },\n });\n const hasToolsHeader = header || filter || pagination || preferences;\n const hasFooterPagination = isMobile && variant === 'full-page' && !!pagination;\n const headerRef = useRef<HTMLDivElement>(null);\n\n const { scrollToTop, scrollToItem } = stickyScrolling(refObject, headerRef);\n stickyHeader = !isMobile && stickyHeader;\n const onCardFocus: FocusEventHandler<HTMLElement> = event => {\n // When an element inside card receives focus we want to adjust the scroll.\n // However, that behavior is unwanted when the focus is received as result of a click\n // as it causes the click to never reach the target element.\n if (stickyHeader && !event.currentTarget.contains(getMouseDownTarget())) {\n scrollToItem(event.currentTarget);\n }\n };\n useImperativeHandle(\n ref,\n () => ({\n scrollToTop: () => {\n if (stickyHeader) {\n scrollToTop();\n }\n },\n }),\n [stickyHeader, scrollToTop]\n );\n let status;\n if (loading) {\n status = (\n <div className={styles.loading}>\n <InternalStatusIndicator type=\"loading\">\n <InternalLiveRegion tagName=\"span\">{loadingText}</InternalLiveRegion>\n </InternalStatusIndicator>\n </div>\n );\n } else if (empty && !items.length) {\n status = <div className={styles.empty}>{empty}</div>;\n }\n\n return (\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <AnalyticsFunnelSubStep>\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRef}>\n <InternalContainerAsSubstep\n header={\n hasToolsHeader && (\n <div\n className={clsx(\n styles.header,\n isRefresh && styles['header-refresh'],\n styles[`header-variant-${computedVariant}`]\n )}\n >\n <CollectionLabelContext.Provider value={{ assignId: setHeaderRef }}>\n <ToolsHeader header={header} filter={filter} pagination={pagination} preferences={preferences} />\n </CollectionLabelContext.Provider>\n </div>\n )\n }\n footer={hasFooterPagination && <div className={styles['footer-pagination']}>{pagination}</div>}\n disableContentPaddings={true}\n disableHeaderPaddings={computedVariant === 'full-page'}\n variant={computedVariant === 'container' ? 'cards' : computedVariant}\n __stickyHeader={stickyHeader}\n __stickyOffset={stickyHeaderVerticalOffset}\n __headerRef={headerRef}\n __fullPage={computedVariant === 'full-page'}\n __disableFooterDivider={true}\n >\n <div\n className={clsx(\n hasToolsHeader && styles['has-header'],\n isRefresh && styles.refresh,\n styles[`header-variant-${computedVariant}`]\n )}\n >\n {!!renderAriaLive && !!firstIndex && (\n <InternalLiveRegion hidden={true} tagName=\"span\">\n <span>\n {renderAriaLive({ totalItemsCount, firstIndex, lastIndex: firstIndex + items.length - 1 })}\n </span>\n </InternalLiveRegion>\n )}\n {status ?? (\n <CardsList\n items={items}\n cardDefinition={cardDefinition}\n trackBy={trackBy}\n selectionType={selectionType}\n columns={columns}\n isItemSelected={isItemSelected}\n getItemSelectionProps={getItemSelectionProps}\n visibleSections={visibleSections}\n onFocus={onCardFocus}\n ariaLabel={ariaLabels?.cardsLabel}\n ariaLabelledby={isLabelledByHeader && headerIdRef.current ? headerIdRef.current : undefined}\n entireCardClickable={entireCardClickable}\n />\n )}\n </div>\n </InternalContainerAsSubstep>\n </div>\n </AnalyticsFunnelSubStep>\n </LinkDefaultVariantContext.Provider>\n );\n}) as CardsForwardRefType;\n\nexport default Cards;\n\nconst CardsList = <T,>({\n items,\n cardDefinition,\n trackBy,\n selectionType,\n columns,\n isItemSelected,\n getItemSelectionProps,\n visibleSections,\n onFocus,\n ariaLabelledby,\n ariaLabel,\n entireCardClickable,\n}: Pick<\n CardsProps<T>,\n 'items' | 'cardDefinition' | 'trackBy' | 'selectionType' | 'visibleSections' | 'entireCardClickable'\n> & {\n columns: number | null;\n isItemSelected: (item: T) => boolean;\n getItemSelectionProps?: (item: T) => SelectionControlProps;\n onFocus: FocusEventHandler<HTMLElement>;\n ariaLabel?: string;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n}) => {\n const selectable = !!selectionType;\n const canClickEntireCard = selectable && entireCardClickable;\n const isRefresh = useVisualRefresh();\n\n const { moveFocusDown, moveFocusUp } = useSelectionFocusMove(selectionType, items.length);\n\n let visibleSectionsDefinition = cardDefinition.sections || [];\n visibleSectionsDefinition = visibleSections\n ? visibleSectionsDefinition.filter(\n (section: CardsProps.SectionDefinition<T>) => section.id && visibleSections.indexOf(section.id) !== -1\n )\n : visibleSectionsDefinition;\n\n let listRole: 'group' | undefined = undefined;\n let listItemRole: 'presentation' | undefined = undefined;\n\n if (selectable) {\n listRole = 'group';\n listItemRole = 'presentation';\n }\n\n return (\n <ol\n className={clsx(styles.list, styles[`list-grid-${columns || 1}`])}\n role={listRole}\n aria-labelledby={ariaLabelledby}\n aria-label={ariaLabel}\n {...(focusMarkers && focusMarkers.root)}\n >\n {items.map((item, index) => (\n <li\n className={clsx(styles.card, {\n [styles['card-selectable']]: selectable,\n [styles['card-selected']]: selectable && isItemSelected(item),\n })}\n key={getItemKey(trackBy, item, index)}\n onFocus={onFocus}\n {...(focusMarkers && focusMarkers.item)}\n role={listItemRole}\n >\n <div\n className={clsx(styles['card-inner'], isRefresh && styles.refresh)}\n onClick={\n canClickEntireCard\n ? event => {\n getItemSelectionProps?.(item).onChange();\n // Manually move focus to the native input (checkbox or radio button)\n event.currentTarget.querySelector('input')?.focus();\n }\n : undefined\n }\n >\n <div className={styles['card-header']}>\n <div className={styles['card-header-inner']}>\n {cardDefinition.header ? cardDefinition.header(item) : ''}\n </div>\n {getItemSelectionProps && (\n <div className={styles['selection-control']}>\n <SelectionControl\n onFocusDown={moveFocusDown}\n onFocusUp={moveFocusUp}\n {...getItemSelectionProps(item)}\n />\n </div>\n )}\n </div>\n {visibleSectionsDefinition.map(({ width = 100, header, content, id }, index) => (\n <div key={id || index} className={styles.section} style={{ width: `${width}%` }}>\n {header ? <div className={styles['section-header']}>{header}</div> : ''}\n {content ? <div className={styles['section-content']}>{content(item)}</div> : ''}\n </div>\n ))}\n </div>\n </li>\n ))}\n </ol>\n );\n};\n\napplyDisplayName(Cards, 'Cards');\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cards/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAqB,WAAW,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC3F,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAEzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AAC7F,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,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iB,CAAC,IAAG,OAAO,CAAC,IAAI,CAAC,CAAO,CAAC,CAAC,CAAC,EAAE,CAC5E,CACP,CAAC,CACE,CACH,CACN,CAAC,CACC,CACN,CAAC;AACJ,CAAC,CAAC;AAEF,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { FocusEventHandler, useCallback, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\n\nimport { InternalContainerAsSubstep } from '../container/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { AnalyticsFunnelSubStep } from '../internal/analytics/components/analytics-funnel';\nimport { getBaseProps } from '../internal/base-component';\nimport { CollectionLabelContext } from '../internal/context/collection-label-context';\nimport { LinkDefaultVariantContext } from '../internal/context/link-default-variant-context';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport useMouseDownTarget from '../internal/hooks/use-mouse-down-target';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport InternalLiveRegion from '../live-region/internal';\nimport InternalStatusIndicator from '../status-indicator/internal';\nimport {\n focusMarkers,\n SelectionControl,\n SelectionControlProps,\n useSelection,\n useSelectionFocusMove,\n} from '../table/selection';\nimport stickyScrolling from '../table/sticky-scrolling';\nimport ToolsHeader from '../table/tools-header';\nimport { getItemKey } from '../table/utils';\nimport { getCardsPerRow } from './cards-layout-helper';\nimport { CardsForwardRefType, CardsProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\nexport { CardsProps };\n\nconst Cards = React.forwardRef(function <T = any>(\n {\n items = [],\n cardDefinition,\n cardsPerRow = [],\n header,\n filter,\n pagination,\n preferences,\n empty,\n loading,\n loadingText,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels,\n visibleSections,\n stickyHeader,\n stickyHeaderVerticalOffset,\n variant = 'container',\n renderAriaLive,\n firstIndex = 1,\n totalItemsCount,\n entireCardClickable,\n ...rest\n }: CardsProps<T>,\n ref: React.Ref<CardsProps.Ref>\n) {\n const { __internalRootRef } = useBaseComponent('Cards', {\n props: { entireCardClickable, selectionType, stickyHeader, variant },\n metadata: { usesVisibleSections: !!visibleSections },\n });\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n const isMobile = useMobile();\n\n const computedVariant = isRefresh ? variant : 'container';\n\n const headerIdRef = useRef<string | undefined>(undefined);\n const setHeaderRef = useCallback((id: string) => {\n headerIdRef.current = id;\n }, []);\n const isLabelledByHeader = !ariaLabels?.cardsLabel && !!header;\n\n const [columns, measureRef] = useContainerQuery<number>(\n ({ contentBoxWidth }) => getCardsPerRow(contentBoxWidth, cardsPerRow),\n [cardsPerRow]\n );\n const refObject = useRef(null);\n const mergedRef = useMergeRefs(measureRef, refObject, __internalRootRef);\n const getMouseDownTarget = useMouseDownTarget();\n\n const i18n = useInternalI18n('cards');\n const { isItemSelected, getItemSelectionProps } = useSelection({\n items,\n trackBy,\n selectedItems,\n selectionType,\n isItemDisabled,\n onSelectionChange,\n ariaLabels: {\n itemSelectionLabel: ariaLabels?.itemSelectionLabel,\n selectionGroupLabel: i18n('ariaLabels.selectionGroupLabel', ariaLabels?.selectionGroupLabel),\n },\n });\n const hasToolsHeader = header || filter || pagination || preferences;\n const hasFooterPagination = isMobile && variant === 'full-page' && !!pagination;\n const headerRef = useRef<HTMLDivElement>(null);\n\n const { scrollToTop, scrollToItem } = stickyScrolling(refObject, headerRef);\n stickyHeader = !isMobile && stickyHeader;\n const onCardFocus: FocusEventHandler<HTMLElement> = event => {\n // When an element inside card receives focus we want to adjust the scroll.\n // However, that behavior is unwanted when the focus is received as result of a click\n // as it causes the click to never reach the target element.\n if (stickyHeader && !event.currentTarget.contains(getMouseDownTarget())) {\n scrollToItem(event.currentTarget);\n }\n };\n useImperativeHandle(\n ref,\n () => ({\n scrollToTop: () => {\n if (stickyHeader) {\n scrollToTop();\n }\n },\n }),\n [stickyHeader, scrollToTop]\n );\n let status;\n if (loading) {\n status = (\n <div className={styles.loading}>\n <InternalStatusIndicator type=\"loading\">\n <InternalLiveRegion tagName=\"span\">{loadingText}</InternalLiveRegion>\n </InternalStatusIndicator>\n </div>\n );\n } else if (empty && !items.length) {\n status = <div className={styles.empty}>{empty}</div>;\n }\n\n return (\n <LinkDefaultVariantContext.Provider value={{ defaultVariant: 'primary' }}>\n <AnalyticsFunnelSubStep>\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={mergedRef}>\n <InternalContainerAsSubstep\n header={\n hasToolsHeader && (\n <div\n className={clsx(\n styles.header,\n isRefresh && styles['header-refresh'],\n styles[`header-variant-${computedVariant}`]\n )}\n >\n <CollectionLabelContext.Provider value={{ assignId: setHeaderRef }}>\n <ToolsHeader header={header} filter={filter} pagination={pagination} preferences={preferences} />\n </CollectionLabelContext.Provider>\n </div>\n )\n }\n footer={hasFooterPagination && <div className={styles['footer-pagination']}>{pagination}</div>}\n disableContentPaddings={true}\n disableHeaderPaddings={computedVariant === 'full-page'}\n variant={computedVariant === 'container' ? 'cards' : computedVariant}\n __stickyHeader={stickyHeader}\n __stickyOffset={stickyHeaderVerticalOffset}\n __headerRef={headerRef}\n __fullPage={computedVariant === 'full-page'}\n __disableFooterDivider={true}\n >\n <div\n className={clsx(\n hasToolsHeader && styles['has-header'],\n isRefresh && styles.refresh,\n styles[`header-variant-${computedVariant}`]\n )}\n >\n {!!renderAriaLive && !!firstIndex && (\n <InternalLiveRegion hidden={true} tagName=\"span\">\n <span>\n {renderAriaLive({ totalItemsCount, firstIndex, lastIndex: firstIndex + items.length - 1 })}\n </span>\n </InternalLiveRegion>\n )}\n {status ?? (\n <CardsList\n items={items}\n cardDefinition={cardDefinition}\n trackBy={trackBy}\n selectionType={selectionType}\n columns={columns}\n isItemSelected={isItemSelected}\n getItemSelectionProps={getItemSelectionProps}\n visibleSections={visibleSections}\n onFocus={onCardFocus}\n ariaLabel={ariaLabels?.cardsLabel}\n ariaLabelledby={isLabelledByHeader && headerIdRef.current ? headerIdRef.current : undefined}\n entireCardClickable={entireCardClickable}\n />\n )}\n </div>\n </InternalContainerAsSubstep>\n </div>\n </AnalyticsFunnelSubStep>\n </LinkDefaultVariantContext.Provider>\n );\n}) as CardsForwardRefType;\n\nexport default Cards;\n\nconst CardsList = <T,>({\n items,\n cardDefinition,\n trackBy,\n selectionType,\n columns,\n isItemSelected,\n getItemSelectionProps,\n visibleSections,\n onFocus,\n ariaLabelledby,\n ariaLabel,\n entireCardClickable,\n}: Pick<\n CardsProps<T>,\n 'items' | 'cardDefinition' | 'trackBy' | 'selectionType' | 'visibleSections' | 'entireCardClickable'\n> & {\n columns: number | null;\n isItemSelected: (item: T) => boolean;\n getItemSelectionProps?: (item: T) => SelectionControlProps;\n onFocus: FocusEventHandler<HTMLElement>;\n ariaLabel?: string;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n}) => {\n const selectable = !!selectionType;\n const canClickEntireCard = selectable && entireCardClickable;\n const isRefresh = useVisualRefresh();\n\n const { moveFocusDown, moveFocusUp } = useSelectionFocusMove(selectionType, items.length);\n\n let visibleSectionsDefinition = cardDefinition.sections || [];\n visibleSectionsDefinition = visibleSections\n ? visibleSectionsDefinition.filter(\n (section: CardsProps.SectionDefinition<T>) => section.id && visibleSections.indexOf(section.id) !== -1\n )\n : visibleSectionsDefinition;\n\n let listRole: 'group' | undefined = undefined;\n let listItemRole: 'presentation' | undefined = undefined;\n\n if (selectable) {\n listRole = 'group';\n listItemRole = 'presentation';\n }\n\n return (\n <ol\n className={clsx(styles.list, styles[`list-grid-${columns || 1}`])}\n role={listRole}\n aria-labelledby={ariaLabelledby}\n aria-label={ariaLabel}\n {...(focusMarkers && focusMarkers.root)}\n >\n {items.map((item, index) => (\n <li\n className={clsx(styles.card, {\n [styles['card-selectable']]: selectable,\n [styles['card-selected']]: selectable && isItemSelected(item),\n })}\n key={getItemKey(trackBy, item, index)}\n onFocus={onFocus}\n {...(focusMarkers && focusMarkers.item)}\n role={listItemRole}\n >\n <div\n className={clsx(styles['card-inner'], isRefresh && styles.refresh)}\n onClick={\n canClickEntireCard\n ? event => {\n getItemSelectionProps?.(item).onChange();\n // Manually move focus to the native input (checkbox or radio button)\n event.currentTarget.querySelector('input')?.focus();\n }\n : undefined\n }\n >\n <div className={styles['card-header']}>\n <div className={styles['card-header-inner']}>\n {cardDefinition.header ? cardDefinition.header(item) : ''}\n </div>\n {getItemSelectionProps && (\n <div className={styles['selection-control']}>\n <SelectionControl\n onFocusDown={moveFocusDown}\n onFocusUp={moveFocusUp}\n {...getItemSelectionProps(item)}\n />\n </div>\n )}\n </div>\n {visibleSectionsDefinition.map(({ width = 100, header, content, id }, index) => (\n <div key={id || index} className={styles.section} style={{ width: `${width}%` }}>\n {header ? <div className={styles['section-header']}>{header}</div> : ''}\n {content ? <div className={styles['section-content']}>{content(item)}</div> : ''}\n </div>\n ))}\n </div>\n </li>\n ))}\n </ol>\n );\n};\n\napplyDisplayName(Cards, 'Cards');\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collection-preferences/index.tsx"],"names":[],"mappings":";AAuBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAiB1D,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAItC,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,KAAK,EACL,YAAY,EACZ,WAAW,EACX,QAAgB,EAChB,SAAS,EACT,QAAQ,EACR,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EAEvB,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,GAAG,IAAI,EACR,EAAE,0BAA0B,eA+L5B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collection-preferences/index.tsx"],"names":[],"mappings":";AAuBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAiB1D,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAItC,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,KAAK,EACL,YAAY,EACZ,WAAW,EACX,QAAgB,EAChB,SAAS,EACT,QAAQ,EACR,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,GAAG,IAAI,EACR,EAAE,0BAA0B,eAgM5B"}
@@ -25,11 +25,12 @@ import analyticsSelectors from './analytics-metadata/styles.css.js';
25
25
  import styles from './styles.css.js';
26
26
  const componentName = 'CollectionPreferences';
27
27
  export default function CollectionPreferences(_a) {
28
+ var _b;
28
29
  var { title, confirmLabel, cancelLabel, disabled = false, onConfirm, onCancel, visibleContentPreference, contentDisplayPreference, pageSizePreference, wrapLinesPreference, stripedRowsPreference, contentDensityPreference, stickyColumnsPreference, preferences, customPreference, getModalRoot, removeModalRoot } = _a, rest = __rest(_a, ["title", "confirmLabel", "cancelLabel", "disabled", "onConfirm", "onCancel", "visibleContentPreference", "contentDisplayPreference", "pageSizePreference", "wrapLinesPreference", "stripedRowsPreference", "contentDensityPreference", "stickyColumnsPreference", "preferences", "customPreference", "getModalRoot", "removeModalRoot"]);
29
30
  const parentMetadata = useContext(CollectionPreferencesMetadata);
30
31
  const { __internalRootRef } = useBaseComponent('CollectionPreferences', {
31
32
  props: {},
32
- metadata: Object.assign(Object.assign({}, parentMetadata), { hasStripedRowsPreference: !!stripedRowsPreference, hasVisibleContentPreference: !!visibleContentPreference, hasContentDisplayPreference: !!contentDisplayPreference, hasContentDensityPreference: !!contentDensityPreference, hasStickyColumnsPreference: !!stickyColumnsPreference }),
33
+ metadata: Object.assign(Object.assign({}, parentMetadata), { hasStripedRowsPreference: !!stripedRowsPreference, hasVisibleContentPreference: !!visibleContentPreference, hasContentDisplayPreference: !!contentDisplayPreference, hasContentDensityPreference: !!contentDensityPreference, hasStickyColumnsPreference: !!stickyColumnsPreference, visibleContentOptionsCount: (_b = visibleContentPreference === null || visibleContentPreference === void 0 ? void 0 : visibleContentPreference.options) === null || _b === void 0 ? void 0 : _b.length }),
33
34
  });
34
35
  checkControlled('CollectionPreferences', 'preferences', preferences, 'onConfirm', onConfirm);
35
36
  const i18n = useInternalI18n('collection-preferences');
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/collection-preferences/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,6DAA6D,CAAC;AAC5G,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,eAAe,MAAM,oCAAoC,CAAC;AACjE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM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,EAAE,YAAY,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,IACpE,CACH,CACF,GAEH,CACY,CACjB,CACG,CACF,CACP,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,qBAAqB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { CollectionPreferencesMetadata } from '../internal/context/collection-preferences-metadata-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport InternalModal from '../modal/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { getComponentAnalyticsMetadata } from './analytics-metadata/utils';\nimport ContentDisplayPreference from './content-display';\nimport { CollectionPreferencesProps } from './interfaces';\nimport {\n ContentDensityPreference,\n copyPreferences,\n CustomPreference,\n mergePreferences,\n ModalContentLayout,\n PageSizePreference,\n StickyColumnsPreference,\n StripedRowsPreference,\n WrapLinesPreference,\n} from './utils';\nimport VisibleContentPreference from './visible-content';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nexport { CollectionPreferencesProps };\n\nconst componentName = 'CollectionPreferences';\n\nexport default function CollectionPreferences({\n title,\n confirmLabel,\n cancelLabel,\n disabled = false,\n onConfirm,\n onCancel,\n visibleContentPreference,\n contentDisplayPreference,\n pageSizePreference,\n wrapLinesPreference,\n stripedRowsPreference,\n contentDensityPreference,\n stickyColumnsPreference,\n\n preferences,\n customPreference,\n getModalRoot,\n removeModalRoot,\n ...rest\n}: CollectionPreferencesProps) {\n const parentMetadata = useContext(CollectionPreferencesMetadata);\n const { __internalRootRef } = useBaseComponent('CollectionPreferences', {\n props: {},\n metadata: {\n ...parentMetadata,\n hasStripedRowsPreference: !!stripedRowsPreference,\n hasVisibleContentPreference: !!visibleContentPreference,\n hasContentDisplayPreference: !!contentDisplayPreference,\n hasContentDensityPreference: !!contentDensityPreference,\n hasStickyColumnsPreference: !!stickyColumnsPreference,\n },\n });\n checkControlled('CollectionPreferences', 'preferences', preferences, 'onConfirm', onConfirm);\n\n const i18n = useInternalI18n('collection-preferences');\n const baseProps = getBaseProps(rest);\n const [modalVisible, setModalVisible] = useState(false);\n const [temporaryPreferences, setTemporaryPreferences] = useState(copyPreferences(preferences || {}));\n const triggerRef = useRef<ButtonProps.Ref>(null);\n const dialogPreviouslyOpen = useRef(false);\n\n useEffect(() => {\n if (!modalVisible) {\n dialogPreviouslyOpen.current && triggerRef.current && triggerRef.current.focus();\n } else {\n dialogPreviouslyOpen.current = true;\n }\n }, [modalVisible]);\n\n const onConfirmListener = () => {\n setModalVisible(false);\n fireNonCancelableEvent(onConfirm, temporaryPreferences);\n };\n\n const onCancelListener = () => {\n fireNonCancelableEvent(onCancel, {});\n setModalVisible(false);\n setTemporaryPreferences(copyPreferences(preferences || {}));\n };\n\n const hasContentOnTheLeft = !!(\n pageSizePreference ||\n wrapLinesPreference ||\n stripedRowsPreference ||\n contentDensityPreference ||\n stickyColumnsPreference ||\n customPreference\n );\n const hasContentOnTheRight = !!(visibleContentPreference || contentDisplayPreference);\n\n const onChange = (changedPreferences: CollectionPreferencesProps.Preferences) =>\n setTemporaryPreferences(mergePreferences(changedPreferences, temporaryPreferences));\n\n if (visibleContentPreference && contentDisplayPreference) {\n warnOnce(\n componentName,\n 'You provided both `visibleContentPreference` and `contentDisplayPreference` props. `visibleContentPreference` will be ignored and only `contentDisplayPreference` will be rendered.'\n );\n }\n\n const referrerId = useUniqueId();\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <div\n id={referrerId}\n {...getAnalyticsMetadataAttribute({ component: getComponentAnalyticsMetadata(disabled, preferences) })}\n >\n <InternalButton\n ref={triggerRef}\n className={clsx(styles['trigger-button'], analyticsSelectors['trigger-button'])}\n disabled={disabled}\n ariaLabel={i18n('title', title)}\n onClick={() => {\n setTemporaryPreferences(copyPreferences(preferences || {}));\n setModalVisible(true);\n }}\n variant=\"icon\"\n iconName=\"settings\"\n formAction=\"none\"\n analyticsAction=\"open\"\n />\n {!disabled && modalVisible && (\n <InternalModal\n className={styles['modal-root']}\n visible={true}\n getModalRoot={getModalRoot}\n removeModalRoot={removeModalRoot}\n header={i18n('title', title)}\n referrerId={referrerId}\n footer={\n <InternalBox float=\"right\">\n <InternalSpaceBetween direction=\"horizontal\" size=\"xs\">\n <InternalButton\n className={styles['cancel-button']}\n variant=\"link\"\n formAction=\"none\"\n onClick={onCancelListener}\n analyticsAction=\"cancel\"\n >\n {i18n('cancelLabel', cancelLabel)}\n </InternalButton>\n <InternalButton\n className={styles['confirm-button']}\n variant=\"primary\"\n formAction=\"none\"\n onClick={onConfirmListener}\n analyticsAction=\"confirm\"\n >\n {i18n('confirmLabel', confirmLabel)}\n </InternalButton>\n </InternalSpaceBetween>\n </InternalBox>\n }\n closeAriaLabel={cancelLabel}\n size={hasContentOnTheLeft && hasContentOnTheRight ? 'large' : 'medium'}\n onDismiss={onCancelListener}\n >\n <ModalContentLayout\n left={\n hasContentOnTheLeft && (\n <InternalSpaceBetween size=\"l\">\n {pageSizePreference && (\n <PageSizePreference\n value={temporaryPreferences.pageSize}\n {...pageSizePreference}\n onChange={pageSize => onChange({ pageSize })}\n />\n )}\n {wrapLinesPreference && (\n <WrapLinesPreference\n value={temporaryPreferences.wrapLines}\n {...wrapLinesPreference}\n onChange={wrapLines => onChange({ wrapLines })}\n />\n )}\n {stripedRowsPreference && (\n <StripedRowsPreference\n value={temporaryPreferences.stripedRows}\n {...stripedRowsPreference}\n onChange={stripedRows => onChange({ stripedRows })}\n />\n )}\n {contentDensityPreference && (\n <ContentDensityPreference\n value={temporaryPreferences.contentDensity}\n {...contentDensityPreference}\n onChange={contentDensity => onChange({ contentDensity })}\n />\n )}\n {stickyColumnsPreference && (\n <StickyColumnsPreference\n value={temporaryPreferences.stickyColumns}\n {...stickyColumnsPreference}\n onChange={stickyColumns => onChange({ stickyColumns })}\n />\n )}\n {customPreference && (\n <CustomPreference\n value={temporaryPreferences.custom}\n customPreference={customPreference}\n onChange={custom => onChange({ custom })}\n />\n )}\n </InternalSpaceBetween>\n )\n }\n right={\n contentDisplayPreference ? (\n <ContentDisplayPreference\n {...contentDisplayPreference}\n value={temporaryPreferences.contentDisplay}\n onChange={contentDisplay => onChange({ contentDisplay })}\n />\n ) : (\n visibleContentPreference && (\n <VisibleContentPreference\n value={temporaryPreferences.visibleContent}\n {...visibleContentPreference}\n onChange={visibleItems => onChange({ visibleContent: visibleItems })}\n />\n )\n )\n }\n />\n </InternalModal>\n )}\n </div>\n </div>\n );\n}\n\napplyDisplayName(CollectionPreferences, componentName);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/collection-preferences/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,kEAAkE,CAAC;AAEjH,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,cAAc,E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AAE,oBAAoB,CAAC,MAAM,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC,GACxC,CACH,CACoB,CACxB,EAEH,KAAK,EACH,wBAAwB,CAAC,CAAC,CAAC,CACzB,oBAAC,wBAAwB,oBACnB,wBAAwB,IAC5B,KAAK,EAAE,oBAAoB,CAAC,cAAc,EAC1C,QAAQ,EAAE,cAAc,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC,IACxD,CACH,CAAC,CAAC,CAAC,CACF,wBAAwB,IAAI,CAC1B,oBAAC,wBAAwB,kBACvB,KAAK,EAAE,oBAAoB,CAAC,cAAc,IACtC,wBAAwB,IAC5B,QAAQ,EAAE,YAAY,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,IACpE,CACH,CACF,GAEH,CACY,CACjB,CACG,CACF,CACP,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,qBAAqB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { CollectionPreferencesMetadata } from '../internal/context/collection-preferences-metadata-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport InternalModal from '../modal/internal';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { getComponentAnalyticsMetadata } from './analytics-metadata/utils';\nimport ContentDisplayPreference from './content-display';\nimport { CollectionPreferencesProps } from './interfaces';\nimport {\n ContentDensityPreference,\n copyPreferences,\n CustomPreference,\n mergePreferences,\n ModalContentLayout,\n PageSizePreference,\n StickyColumnsPreference,\n StripedRowsPreference,\n WrapLinesPreference,\n} from './utils';\nimport VisibleContentPreference from './visible-content';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nexport { CollectionPreferencesProps };\n\nconst componentName = 'CollectionPreferences';\n\nexport default function CollectionPreferences({\n title,\n confirmLabel,\n cancelLabel,\n disabled = false,\n onConfirm,\n onCancel,\n visibleContentPreference,\n contentDisplayPreference,\n pageSizePreference,\n wrapLinesPreference,\n stripedRowsPreference,\n contentDensityPreference,\n stickyColumnsPreference,\n preferences,\n customPreference,\n getModalRoot,\n removeModalRoot,\n ...rest\n}: CollectionPreferencesProps) {\n const parentMetadata = useContext(CollectionPreferencesMetadata);\n const { __internalRootRef } = useBaseComponent('CollectionPreferences', {\n props: {},\n metadata: {\n ...parentMetadata,\n hasStripedRowsPreference: !!stripedRowsPreference,\n hasVisibleContentPreference: !!visibleContentPreference,\n hasContentDisplayPreference: !!contentDisplayPreference,\n hasContentDensityPreference: !!contentDensityPreference,\n hasStickyColumnsPreference: !!stickyColumnsPreference,\n visibleContentOptionsCount: visibleContentPreference?.options?.length,\n },\n });\n checkControlled('CollectionPreferences', 'preferences', preferences, 'onConfirm', onConfirm);\n\n const i18n = useInternalI18n('collection-preferences');\n const baseProps = getBaseProps(rest);\n const [modalVisible, setModalVisible] = useState(false);\n const [temporaryPreferences, setTemporaryPreferences] = useState(copyPreferences(preferences || {}));\n const triggerRef = useRef<ButtonProps.Ref>(null);\n const dialogPreviouslyOpen = useRef(false);\n\n useEffect(() => {\n if (!modalVisible) {\n dialogPreviouslyOpen.current && triggerRef.current && triggerRef.current.focus();\n } else {\n dialogPreviouslyOpen.current = true;\n }\n }, [modalVisible]);\n\n const onConfirmListener = () => {\n setModalVisible(false);\n fireNonCancelableEvent(onConfirm, temporaryPreferences);\n };\n\n const onCancelListener = () => {\n fireNonCancelableEvent(onCancel, {});\n setModalVisible(false);\n setTemporaryPreferences(copyPreferences(preferences || {}));\n };\n\n const hasContentOnTheLeft = !!(\n pageSizePreference ||\n wrapLinesPreference ||\n stripedRowsPreference ||\n contentDensityPreference ||\n stickyColumnsPreference ||\n customPreference\n );\n const hasContentOnTheRight = !!(visibleContentPreference || contentDisplayPreference);\n\n const onChange = (changedPreferences: CollectionPreferencesProps.Preferences) =>\n setTemporaryPreferences(mergePreferences(changedPreferences, temporaryPreferences));\n\n if (visibleContentPreference && contentDisplayPreference) {\n warnOnce(\n componentName,\n 'You provided both `visibleContentPreference` and `contentDisplayPreference` props. `visibleContentPreference` will be ignored and only `contentDisplayPreference` will be rendered.'\n );\n }\n\n const referrerId = useUniqueId();\n\n return (\n <div {...baseProps} className={clsx(baseProps.className, styles.root)} ref={__internalRootRef}>\n <div\n id={referrerId}\n {...getAnalyticsMetadataAttribute({ component: getComponentAnalyticsMetadata(disabled, preferences) })}\n >\n <InternalButton\n ref={triggerRef}\n className={clsx(styles['trigger-button'], analyticsSelectors['trigger-button'])}\n disabled={disabled}\n ariaLabel={i18n('title', title)}\n onClick={() => {\n setTemporaryPreferences(copyPreferences(preferences || {}));\n setModalVisible(true);\n }}\n variant=\"icon\"\n iconName=\"settings\"\n formAction=\"none\"\n analyticsAction=\"open\"\n />\n {!disabled && modalVisible && (\n <InternalModal\n className={styles['modal-root']}\n visible={true}\n getModalRoot={getModalRoot}\n removeModalRoot={removeModalRoot}\n header={i18n('title', title)}\n referrerId={referrerId}\n footer={\n <InternalBox float=\"right\">\n <InternalSpaceBetween direction=\"horizontal\" size=\"xs\">\n <InternalButton\n className={styles['cancel-button']}\n variant=\"link\"\n formAction=\"none\"\n onClick={onCancelListener}\n analyticsAction=\"cancel\"\n >\n {i18n('cancelLabel', cancelLabel)}\n </InternalButton>\n <InternalButton\n className={styles['confirm-button']}\n variant=\"primary\"\n formAction=\"none\"\n onClick={onConfirmListener}\n analyticsAction=\"confirm\"\n >\n {i18n('confirmLabel', confirmLabel)}\n </InternalButton>\n </InternalSpaceBetween>\n </InternalBox>\n }\n closeAriaLabel={cancelLabel}\n size={hasContentOnTheLeft && hasContentOnTheRight ? 'large' : 'medium'}\n onDismiss={onCancelListener}\n >\n <ModalContentLayout\n left={\n hasContentOnTheLeft && (\n <InternalSpaceBetween size=\"l\">\n {pageSizePreference && (\n <PageSizePreference\n value={temporaryPreferences.pageSize}\n {...pageSizePreference}\n onChange={pageSize => onChange({ pageSize })}\n />\n )}\n {wrapLinesPreference && (\n <WrapLinesPreference\n value={temporaryPreferences.wrapLines}\n {...wrapLinesPreference}\n onChange={wrapLines => onChange({ wrapLines })}\n />\n )}\n {stripedRowsPreference && (\n <StripedRowsPreference\n value={temporaryPreferences.stripedRows}\n {...stripedRowsPreference}\n onChange={stripedRows => onChange({ stripedRows })}\n />\n )}\n {contentDensityPreference && (\n <ContentDensityPreference\n value={temporaryPreferences.contentDensity}\n {...contentDensityPreference}\n onChange={contentDensity => onChange({ contentDensity })}\n />\n )}\n {stickyColumnsPreference && (\n <StickyColumnsPreference\n value={temporaryPreferences.stickyColumns}\n {...stickyColumnsPreference}\n onChange={stickyColumns => onChange({ stickyColumns })}\n />\n )}\n {customPreference && (\n <CustomPreference\n value={temporaryPreferences.custom}\n customPreference={customPreference}\n onChange={custom => onChange({ custom })}\n />\n )}\n </InternalSpaceBetween>\n )\n }\n right={\n contentDisplayPreference ? (\n <ContentDisplayPreference\n {...contentDisplayPreference}\n value={temporaryPreferences.contentDisplay}\n onChange={contentDisplay => onChange({ contentDisplay })}\n />\n ) : (\n visibleContentPreference && (\n <VisibleContentPreference\n value={temporaryPreferences.visibleContent}\n {...visibleContentPreference}\n onChange={visibleItems => onChange({ visibleContent: visibleItems })}\n />\n )\n )\n }\n />\n </InternalModal>\n )}\n </div>\n </div>\n );\n}\n\napplyDisplayName(CollectionPreferences, componentName);\n"]}
@@ -77,9 +77,9 @@ export interface CollectionPreferencesProps<CustomPreferenceType = any> extends
77
77
  */
78
78
  contentDensityPreference?: CollectionPreferencesProps.ContentDensityPreference;
79
79
  /**
80
- * Configures the sticky columns preference.
80
+ * Configures the sticky columns preference that can be set for both left and right columns.
81
81
  *
82
- * You can set it for both left and right columns.
82
+ * If you set it, the component displays this preference in the modal.
83
83
  *
84
84
  * It contains the following:
85
85
  * - `label` (string) - Specifies the label for each radio group.
@@ -89,21 +89,25 @@ export interface CollectionPreferencesProps<CustomPreferenceType = any> extends
89
89
  */
90
90
  stickyColumnsPreference?: CollectionPreferencesProps.StickyColumnsPreference;
91
91
  /**
92
- * Configures the built-in content display preference for order and visibility of columns in a table.
92
+ * Configures the built-in content display preference for order and visibility of the table columns.
93
+ *
94
+ * Recommended for table and not applicable for cards.
93
95
  *
94
- * Once set, the component displays this preference in the modal.
95
96
  * Cannot be used together with `visibleContentPreference`.
96
97
  *
98
+ * If you set it, the component displays this preference in the modal.
99
+ *
97
100
  * It contains the following:
98
101
  * - `title` (string) - Specifies the text displayed at the top of the preference.
99
102
  * - `description` (string) - Specifies the description displayed below the title.
103
+ * - `options` - Specifies an array of options for reordering and visible content selection.
104
+ * - `enableColumnFiltering` (boolean) - Adds a columns filter.
100
105
  * - `liveAnnouncementDndStarted` ((position: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when an option is picked.
101
106
  * - `liveAnnouncementDndDiscarded` (string) - (Optional) Adds a message to be announced by screen readers when a reordering action is canceled.
102
107
  * - `liveAnnouncementDndItemReordered` ((initialPosition: number, currentPosition: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when an item is being moved.
103
108
  * - `liveAnnouncementDndItemCommitted` ((initialPosition: number, finalPosition: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when a reordering action is committed.
104
109
  * - `dragHandleAriaDescription` (string) - (Optional) Adds an ARIA description for the drag handle.
105
110
  * - `dragHandleAriaLabel` (string) - (Optional) Adds an ARIA label for the drag handle.
106
- * - `options` - Specifies an array of options for reordering and visible content selection.
107
111
  *
108
112
  * Each option contains the following:
109
113
  * - `id` (string) - Corresponds to a table column `id`.
@@ -115,18 +119,21 @@ export interface CollectionPreferencesProps<CustomPreferenceType = any> extends
115
119
  */
116
120
  contentDisplayPreference?: CollectionPreferencesProps.ContentDisplayPreference;
117
121
  /**
118
- * Configures the built-in "visible content selection" preference (for example, visible sections in cards).
122
+ * Configures the built-in visible sections preference for cards or visible columns for table.
123
+ *
124
+ * Recommended for cards. For table use `contentDisplayPreference` instead.
119
125
  *
120
- * If you set it, the component displays this preference in the modal.
121
126
  * Cannot be used together with `contentDisplayPreference`.
122
127
  *
128
+ * If you set it, the component displays this preference in the modal.
129
+ *
123
130
  * It contains the following:
124
131
  * - `title` (string) - Specifies the text displayed at the top of the preference.
125
132
  * - `options` - Specifies an array of groups of options for visible content selection.
126
133
  *
127
134
  * Each group of options contains the following:
128
135
  * - `label` (string) - The text to display as a title for the options group.
129
- * - `options` - Specifies an aray of options in the group. Each option contains the following:
136
+ * - `options` - Specifies an array of options in the group. Each option contains the following:
130
137
  * - `id` (string) - Corresponds to a column `id` for tables or to a section `id` for cards.
131
138
  * - `label` (string) - Specifies a short description of the content.
132
139
  * - `editable` (boolean) - (Optional) Determines whether the user is able to toggle its visibility. This is `true` by default.
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/collection-preferences/interfaces.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,WAAW,0BAA0B,CAAC,oBAAoB,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AAC;YACrB,KAAK,EAAE,MAAM,CAAC;YACd,KAAK,EAAE,MAAM,CAAC;SACf,CAAC,CAAC;KACJ;IACD,MAAM,WAAW,uBAAuB;QACtC,YAAY,CAAC,EAAE,sBAAsB,CAAC;QACtC,WAAW,CAAC,EAAE,sBAAsB,CAAC;KACtC;IAED,MAAM,WAAW,mCAAmC;QAClD;;;WAGG;QACH,0BAA0B,CAAC,EAAE,MAAM,CAAC;QAEpC;;;WAGG;QACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;QAElC;;;WAGG;QACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;QAErD;;;WAGG;QACH,0BAA0B,CAAC,EAAE,MAAM,CAAC;QAEpC;;;WAGG;QACH,8BAA8B,CAAC,EAAE,MAAM,CAAC;KACzC;;CACF"}
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/collection-preferences/interfaces.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,WAAW,0BAA0B,CAAC,oBAAoB,GAAG,GAAG,CAAE,SAAQ,kBAAkB,EAAE,cAAc;IAChH;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;;;;;;;OAaG;IACH,kBAAkB,CAAC,EAAE,0BAA0B,CAAC,kBAAkB,CAAC;IACnE;;;;;;;;;;;OAWG;IACH,mBAAmB,CAAC,EAAE,0BAA0B,CAAC,mBAAmB,CAAC;IACrE;;;;;;;;;;;OAWG;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AGG;QACH,0BAA0B,CAAC,EAAE,MAAM,CAAC;QAEpC;;;WAGG;QACH,8BAA8B,CAAC,EAAE,MAAM,CAAC;KACzC;;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/collection-preferences/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { BaseModalProps } from '../modal/interfaces';\n\nexport interface CollectionPreferencesProps<CustomPreferenceType = any> extends BaseComponentProps, BaseModalProps {\n /**\n * Specifies the title of the preferences modal dialog. It is also used as an `aria-label` for the trigger button.\n * @i18n\n */\n title?: string;\n /**\n * Label of the confirm button in the modal footer.\n * @i18n\n */\n confirmLabel?: string;\n /**\n * Label of the cancel button in the modal footer.\n * @i18n\n */\n cancelLabel?: string;\n /**\n * Determines whether the preferences trigger button is disabled.\n */\n disabled?: boolean;\n /**\n * Configures the built-in \"page size selection\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `options` - Specifies an array of options for page size selection. Each entry contains:\n * - `value` (number) - The value for the radio button (that is, the number of items per page).\n * - `label` (string) - A label for the radio button (for example, \"10 resources\").\n *\n * You must set the current value in the `preferences.pageSize` property.\n * @i18n\n */\n pageSizePreference?: CollectionPreferencesProps.PageSizePreference;\n /**\n * Configures the built-in \"wrap lines\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.wrapLines` property.\n * @i18n\n */\n wrapLinesPreference?: CollectionPreferencesProps.WrapLinesPreference;\n /**\n * Configures the built-in \"striped rows\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.stripedRows` property.\n * @i18n\n */\n stripedRowsPreference?: CollectionPreferencesProps.StripedRowsPreference;\n /**\n * Configures the content density preference (Comfortable / Compact).\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.contentDensity` property.\n * @i18n\n */\n contentDensityPreference?: CollectionPreferencesProps.ContentDensityPreference;\n /**\n * Configures the sticky columns preference.\n *\n * You can set it for both left and right columns.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for each radio group.\n * - `description` (string) - Specifies the text displayed below each radio group label.\n *\n * You must set the current value in the `preferences.stickyColumns` property.\n */\n stickyColumnsPreference?: CollectionPreferencesProps.StickyColumnsPreference;\n /**\n * Configures the built-in content display preference for order and visibility of columns in a table.\n *\n * Once set, the component displays this preference in the modal.\n * Cannot be used together with `visibleContentPreference`.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `description` (string) - Specifies the description displayed below the title.\n * - `liveAnnouncementDndStarted` ((position: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when an option is picked.\n * - `liveAnnouncementDndDiscarded` (string) - (Optional) Adds a message to be announced by screen readers when a reordering action is canceled.\n * - `liveAnnouncementDndItemReordered` ((initialPosition: number, currentPosition: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when an item is being moved.\n * - `liveAnnouncementDndItemCommitted` ((initialPosition: number, finalPosition: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when a reordering action is committed.\n * - `dragHandleAriaDescription` (string) - (Optional) Adds an ARIA description for the drag handle.\n * - `dragHandleAriaLabel` (string) - (Optional) Adds an ARIA label for the drag handle.\n * - `options` - Specifies an array of options for reordering and visible content selection.\n *\n * Each option contains the following:\n * - `id` (string) - Corresponds to a table column `id`.\n * - `label` (string) - Specifies a short description of the content.\n * - `alwaysVisible` (boolean) - (Optional) Determines whether the visibility is always on and therefore cannot be toggled. This is set to `false` by default.\n *\n * You must provide an ordered list of the items to display in the `preferences.contentDisplay` property.\n * @i18n\n */\n contentDisplayPreference?: CollectionPreferencesProps.ContentDisplayPreference;\n /**\n * Configures the built-in \"visible content selection\" preference (for example, visible sections in cards).\n *\n * If you set it, the component displays this preference in the modal.\n * Cannot be used together with `contentDisplayPreference`.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `options` - Specifies an array of groups of options for visible content selection.\n *\n * Each group of options contains the following:\n * - `label` (string) - The text to display as a title for the options group.\n * - `options` - Specifies an aray of options in the group. Each option contains the following:\n * - `id` (string) - Corresponds to a column `id` for tables or to a section `id` for cards.\n * - `label` (string) - Specifies a short description of the content.\n * - `editable` (boolean) - (Optional) Determines whether the user is able to toggle its visibility. This is `true` by default.\n *\n * You must set the current list of visible content `id`s in the `preferences.visibleContent` property.\n *\n * **Deprecated** in table, replaced by `contentDisplayPreference`.\n */\n visibleContentPreference?: CollectionPreferencesProps.VisibleContentPreference;\n /**\n * Specifies the current preference values. This includes both built-in and custom preferences.\n *\n * It contains the following:\n * - `pageSize` (number) - (Optional)\n * - `wrapLines` (boolean) - (Optional)\n * - `contentDisplay` (ReadonlyArray<ContentDisplayItem>) - (Optional) Specifies the list of content and their visibility. The order of the elements influences the display.\n * - `visibleContent` (ReadonlyArray<string>) - Specifies the list of visible content `id`s. The order of the `id`s does not influence the display. If the `contentDisplay` property is set, this property is ignored.\n * - `custom` (CustomPreferenceType) - Specifies the value for your custom preference.\n */\n preferences?: CollectionPreferencesProps.Preferences<CustomPreferenceType>;\n /**\n * Configures custom preferences. The function receives two parameters:\n *\n * - `customValue` (CustomPreferenceType) - Current value for your custom preference. It is initialized using the value you provide in `preferences.custom`.\n * - `setCustomValue` - A function that is called to notify a state update.\n *\n * It should return the content of your custom preference, for example:\n * ```\n * (customValue, setCustomValue) => (\n * <Checkbox checked={customValue} onChange={({ detail }) => setCustomValue(detail.checked)} />\n * )\n * ```\n *\n * When the user confirms the changes, the new value is passed in the `detail.custom` property of the `onConfirm` listener.\n * When the user cancels the changes, the `customValue` is reset to the one present in `preferences.custom` property.\n *\n * **Display**\n * - If any of the built-in preferences (`pageSizePreference`, `wrapLinesPreference`, or `visibleContentPreference`) are displayed,\n * the custom content is displayed at the bottom of the left column within the modal.\n * - If no built-in preference is displayed, the custom content occupies the whole modal.\n */\n customPreference?: (\n customValue: CustomPreferenceType,\n setCustomValue: React.Dispatch<CustomPreferenceType>\n ) => React.ReactNode;\n /**\n * Called when the user cancels a preference change using the cancel button in the modal footer or by dismissing the modal.\n */\n onCancel?: NonCancelableEventHandler;\n /**\n * Called when the user confirms a preference change using the confirm button in the modal footer.\n *\n * The event `detail` contains the following:\n * - `contentDensity` (boolean) - (Optional) The current content density preference value. Available only if you specify the `contentDensityPreference` property.\n * - `contentDisplay` (ReadonlyArray<ContentDisplayItem>) - (Optional) The ordered list of table columns and their visibility. Available only if you specify the `contentDisplayPreference` property.\n * - `custom` (CustomPreferenceType) - (Optional) The selected value for your custom preference.\n * - `pageSize` (number) - (Optional) The selected page size value. Available only if you specify the `pageSizePreference` property.\n * - `stickyColumns` (CollectionPreferencesProps.StickyColumns) - (Optional) The current sticky columns preference value. Available only if you specify the `stickyColumnsPreference` property.\n * - `stripedRows` (boolean) - (Optional) The current striped rows preference value. Available only if you specify the `stripedRowsPreference` property.\n * - `visibleContent` (ReadonlyArray<string>) - (Optional) The list of selected content `id`s. Available only if you specify the `visibleContentPreference` property.\n * - `wrapLines` (boolean) - (Optional) The current line wrapping preference value. Available only if you specify the `wrapLinesPreference` property.\n *\n * The values for all configured preferences are present even if the user didn't change their values.\n */\n onConfirm?: NonCancelableEventHandler<CollectionPreferencesProps.Preferences<CustomPreferenceType>>;\n}\n\nexport namespace CollectionPreferencesProps {\n export interface Preferences<CustomPreferenceType = any> {\n pageSize?: number;\n wrapLines?: boolean;\n stripedRows?: boolean;\n contentDensity?: 'comfortable' | 'compact';\n visibleContent?: ReadonlyArray<string>;\n stickyColumns?: StickyColumns;\n contentDisplay?: ReadonlyArray<ContentDisplayItem>;\n custom?: CustomPreferenceType;\n }\n\n export interface ContentDisplayPreference {\n title?: string;\n description?: string;\n options: ReadonlyArray<CollectionPreferencesProps.ContentDisplayOption>;\n liveAnnouncementDndStarted?: (position: number, total: number) => string;\n liveAnnouncementDndItemReordered?: (initialPosition: number, currentPosition: number, total: number) => string;\n liveAnnouncementDndItemCommitted?: (initialPosition: number, finalPosition: number, total: number) => string;\n liveAnnouncementDndDiscarded?: string;\n dragHandleAriaLabel?: string;\n dragHandleAriaDescription?: string;\n enableColumnFiltering?: boolean;\n i18nStrings?: ContentDisplayPreferenceI18nStrings;\n }\n\n export interface ContentDisplayOption {\n id: string;\n label: string;\n alwaysVisible?: boolean;\n }\n\n export interface ContentDisplayItem {\n id: string;\n visible: boolean;\n }\n\n export interface VisibleContentPreference {\n title: string;\n options: ReadonlyArray<CollectionPreferencesProps.VisibleContentOptionsGroup>;\n }\n\n export interface VisibleContentOptionsGroup {\n label: string;\n options: ReadonlyArray<CollectionPreferencesProps.VisibleContentOption>;\n }\n\n export interface VisibleContentOption {\n id: string;\n label: string;\n editable?: boolean;\n }\n\n export interface PageSizePreference {\n title?: string;\n options: ReadonlyArray<PageSizeOption>;\n }\n\n export interface PageSizeOption {\n value: number;\n label?: string;\n }\n\n export interface WrapLinesPreference {\n label?: string;\n description?: string;\n }\n\n export interface StripedRowsPreference {\n label?: string;\n description?: string;\n }\n\n export interface ContentDensityPreference {\n label?: string;\n description?: string;\n }\n\n interface StickyColumns {\n first?: number;\n last?: number;\n }\n\n interface StickyColumnPreference {\n title: string;\n description: string;\n options: ReadonlyArray<{\n label: string;\n value: number;\n }>;\n }\n export interface StickyColumnsPreference {\n firstColumns?: StickyColumnPreference;\n lastColumns?: StickyColumnPreference;\n }\n\n export interface ContentDisplayPreferenceI18nStrings {\n /**\n * Specifies a `placeholder` for the filtering input.\n * @i18n\n */\n columnFilteringPlaceholder?: string;\n\n /**\n * Specifies an `aria-label` for the filtering input.\n * @i18n\n */\n columnFilteringAriaLabel?: string;\n\n /**\n * Specifies the `count text` for the filtering input to reflect matches found.\n * @i18n\n */\n columnFilteringCountText?: (count: number) => string;\n\n /**\n * Specifies the `no match` text for when there are no matching options in the filtering.\n * @i18n\n */\n columnFilteringNoMatchText?: string;\n\n /**\n * Specifies both an `aria-label` for the clear filtering input action and the `clear filter button` text for the no match button.\n * @i18n\n */\n columnFilteringClearFilterText?: string;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/collection-preferences/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\nimport { BaseModalProps } from '../modal/interfaces';\n\nexport interface CollectionPreferencesProps<CustomPreferenceType = any> extends BaseComponentProps, BaseModalProps {\n /**\n * Specifies the title of the preferences modal dialog. It is also used as an `aria-label` for the trigger button.\n * @i18n\n */\n title?: string;\n /**\n * Label of the confirm button in the modal footer.\n * @i18n\n */\n confirmLabel?: string;\n /**\n * Label of the cancel button in the modal footer.\n * @i18n\n */\n cancelLabel?: string;\n /**\n * Determines whether the preferences trigger button is disabled.\n */\n disabled?: boolean;\n /**\n * Configures the built-in \"page size selection\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `options` - Specifies an array of options for page size selection. Each entry contains:\n * - `value` (number) - The value for the radio button (that is, the number of items per page).\n * - `label` (string) - A label for the radio button (for example, \"10 resources\").\n *\n * You must set the current value in the `preferences.pageSize` property.\n * @i18n\n */\n pageSizePreference?: CollectionPreferencesProps.PageSizePreference;\n /**\n * Configures the built-in \"wrap lines\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.wrapLines` property.\n * @i18n\n */\n wrapLinesPreference?: CollectionPreferencesProps.WrapLinesPreference;\n /**\n * Configures the built-in \"striped rows\" preference.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.stripedRows` property.\n * @i18n\n */\n stripedRowsPreference?: CollectionPreferencesProps.StripedRowsPreference;\n /**\n * Configures the content density preference (Comfortable / Compact).\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for the option checkbox.\n * - `description` (string) - Specifies the text displayed below the checkbox label.\n *\n * You must set the current value in the `preferences.contentDensity` property.\n * @i18n\n */\n contentDensityPreference?: CollectionPreferencesProps.ContentDensityPreference;\n /**\n * Configures the sticky columns preference that can be set for both left and right columns.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `label` (string) - Specifies the label for each radio group.\n * - `description` (string) - Specifies the text displayed below each radio group label.\n *\n * You must set the current value in the `preferences.stickyColumns` property.\n */\n stickyColumnsPreference?: CollectionPreferencesProps.StickyColumnsPreference;\n /**\n * Configures the built-in content display preference for order and visibility of the table columns.\n *\n * Recommended for table and not applicable for cards.\n *\n * Cannot be used together with `visibleContentPreference`.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `description` (string) - Specifies the description displayed below the title.\n * - `options` - Specifies an array of options for reordering and visible content selection.\n * - `enableColumnFiltering` (boolean) - Adds a columns filter.\n * - `liveAnnouncementDndStarted` ((position: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when an option is picked.\n * - `liveAnnouncementDndDiscarded` (string) - (Optional) Adds a message to be announced by screen readers when a reordering action is canceled.\n * - `liveAnnouncementDndItemReordered` ((initialPosition: number, currentPosition: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when an item is being moved.\n * - `liveAnnouncementDndItemCommitted` ((initialPosition: number, finalPosition: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when a reordering action is committed.\n * - `dragHandleAriaDescription` (string) - (Optional) Adds an ARIA description for the drag handle.\n * - `dragHandleAriaLabel` (string) - (Optional) Adds an ARIA label for the drag handle.\n *\n * Each option contains the following:\n * - `id` (string) - Corresponds to a table column `id`.\n * - `label` (string) - Specifies a short description of the content.\n * - `alwaysVisible` (boolean) - (Optional) Determines whether the visibility is always on and therefore cannot be toggled. This is set to `false` by default.\n *\n * You must provide an ordered list of the items to display in the `preferences.contentDisplay` property.\n * @i18n\n */\n contentDisplayPreference?: CollectionPreferencesProps.ContentDisplayPreference;\n /**\n * Configures the built-in visible sections preference for cards or visible columns for table.\n *\n * Recommended for cards. For table use `contentDisplayPreference` instead.\n *\n * Cannot be used together with `contentDisplayPreference`.\n *\n * If you set it, the component displays this preference in the modal.\n *\n * It contains the following:\n * - `title` (string) - Specifies the text displayed at the top of the preference.\n * - `options` - Specifies an array of groups of options for visible content selection.\n *\n * Each group of options contains the following:\n * - `label` (string) - The text to display as a title for the options group.\n * - `options` - Specifies an array of options in the group. Each option contains the following:\n * - `id` (string) - Corresponds to a column `id` for tables or to a section `id` for cards.\n * - `label` (string) - Specifies a short description of the content.\n * - `editable` (boolean) - (Optional) Determines whether the user is able to toggle its visibility. This is `true` by default.\n *\n * You must set the current list of visible content `id`s in the `preferences.visibleContent` property.\n *\n * **Deprecated** in table, replaced by `contentDisplayPreference`.\n */\n visibleContentPreference?: CollectionPreferencesProps.VisibleContentPreference;\n /**\n * Specifies the current preference values. This includes both built-in and custom preferences.\n *\n * It contains the following:\n * - `pageSize` (number) - (Optional)\n * - `wrapLines` (boolean) - (Optional)\n * - `contentDisplay` (ReadonlyArray<ContentDisplayItem>) - (Optional) Specifies the list of content and their visibility. The order of the elements influences the display.\n * - `visibleContent` (ReadonlyArray<string>) - Specifies the list of visible content `id`s. The order of the `id`s does not influence the display. If the `contentDisplay` property is set, this property is ignored.\n * - `custom` (CustomPreferenceType) - Specifies the value for your custom preference.\n */\n preferences?: CollectionPreferencesProps.Preferences<CustomPreferenceType>;\n /**\n * Configures custom preferences. The function receives two parameters:\n *\n * - `customValue` (CustomPreferenceType) - Current value for your custom preference. It is initialized using the value you provide in `preferences.custom`.\n * - `setCustomValue` - A function that is called to notify a state update.\n *\n * It should return the content of your custom preference, for example:\n * ```\n * (customValue, setCustomValue) => (\n * <Checkbox checked={customValue} onChange={({ detail }) => setCustomValue(detail.checked)} />\n * )\n * ```\n *\n * When the user confirms the changes, the new value is passed in the `detail.custom` property of the `onConfirm` listener.\n * When the user cancels the changes, the `customValue` is reset to the one present in `preferences.custom` property.\n *\n * **Display**\n * - If any of the built-in preferences (`pageSizePreference`, `wrapLinesPreference`, or `visibleContentPreference`) are displayed,\n * the custom content is displayed at the bottom of the left column within the modal.\n * - If no built-in preference is displayed, the custom content occupies the whole modal.\n */\n customPreference?: (\n customValue: CustomPreferenceType,\n setCustomValue: React.Dispatch<CustomPreferenceType>\n ) => React.ReactNode;\n /**\n * Called when the user cancels a preference change using the cancel button in the modal footer or by dismissing the modal.\n */\n onCancel?: NonCancelableEventHandler;\n /**\n * Called when the user confirms a preference change using the confirm button in the modal footer.\n *\n * The event `detail` contains the following:\n * - `contentDensity` (boolean) - (Optional) The current content density preference value. Available only if you specify the `contentDensityPreference` property.\n * - `contentDisplay` (ReadonlyArray<ContentDisplayItem>) - (Optional) The ordered list of table columns and their visibility. Available only if you specify the `contentDisplayPreference` property.\n * - `custom` (CustomPreferenceType) - (Optional) The selected value for your custom preference.\n * - `pageSize` (number) - (Optional) The selected page size value. Available only if you specify the `pageSizePreference` property.\n * - `stickyColumns` (CollectionPreferencesProps.StickyColumns) - (Optional) The current sticky columns preference value. Available only if you specify the `stickyColumnsPreference` property.\n * - `stripedRows` (boolean) - (Optional) The current striped rows preference value. Available only if you specify the `stripedRowsPreference` property.\n * - `visibleContent` (ReadonlyArray<string>) - (Optional) The list of selected content `id`s. Available only if you specify the `visibleContentPreference` property.\n * - `wrapLines` (boolean) - (Optional) The current line wrapping preference value. Available only if you specify the `wrapLinesPreference` property.\n *\n * The values for all configured preferences are present even if the user didn't change their values.\n */\n onConfirm?: NonCancelableEventHandler<CollectionPreferencesProps.Preferences<CustomPreferenceType>>;\n}\n\nexport namespace CollectionPreferencesProps {\n export interface Preferences<CustomPreferenceType = any> {\n pageSize?: number;\n wrapLines?: boolean;\n stripedRows?: boolean;\n contentDensity?: 'comfortable' | 'compact';\n visibleContent?: ReadonlyArray<string>;\n stickyColumns?: StickyColumns;\n contentDisplay?: ReadonlyArray<ContentDisplayItem>;\n custom?: CustomPreferenceType;\n }\n\n export interface ContentDisplayPreference {\n title?: string;\n description?: string;\n options: ReadonlyArray<CollectionPreferencesProps.ContentDisplayOption>;\n liveAnnouncementDndStarted?: (position: number, total: number) => string;\n liveAnnouncementDndItemReordered?: (initialPosition: number, currentPosition: number, total: number) => string;\n liveAnnouncementDndItemCommitted?: (initialPosition: number, finalPosition: number, total: number) => string;\n liveAnnouncementDndDiscarded?: string;\n dragHandleAriaLabel?: string;\n dragHandleAriaDescription?: string;\n enableColumnFiltering?: boolean;\n i18nStrings?: ContentDisplayPreferenceI18nStrings;\n }\n\n export interface ContentDisplayOption {\n id: string;\n label: string;\n alwaysVisible?: boolean;\n }\n\n export interface ContentDisplayItem {\n id: string;\n visible: boolean;\n }\n\n export interface VisibleContentPreference {\n title: string;\n options: ReadonlyArray<CollectionPreferencesProps.VisibleContentOptionsGroup>;\n }\n\n export interface VisibleContentOptionsGroup {\n label: string;\n options: ReadonlyArray<CollectionPreferencesProps.VisibleContentOption>;\n }\n\n export interface VisibleContentOption {\n id: string;\n label: string;\n editable?: boolean;\n }\n\n export interface PageSizePreference {\n title?: string;\n options: ReadonlyArray<PageSizeOption>;\n }\n\n export interface PageSizeOption {\n value: number;\n label?: string;\n }\n\n export interface WrapLinesPreference {\n label?: string;\n description?: string;\n }\n\n export interface StripedRowsPreference {\n label?: string;\n description?: string;\n }\n\n export interface ContentDensityPreference {\n label?: string;\n description?: string;\n }\n\n interface StickyColumns {\n first?: number;\n last?: number;\n }\n\n interface StickyColumnPreference {\n title: string;\n description: string;\n options: ReadonlyArray<{\n label: string;\n value: number;\n }>;\n }\n export interface StickyColumnsPreference {\n firstColumns?: StickyColumnPreference;\n lastColumns?: StickyColumnPreference;\n }\n\n export interface ContentDisplayPreferenceI18nStrings {\n /**\n * Specifies a `placeholder` for the filtering input.\n * @i18n\n */\n columnFilteringPlaceholder?: string;\n\n /**\n * Specifies an `aria-label` for the filtering input.\n * @i18n\n */\n columnFilteringAriaLabel?: string;\n\n /**\n * Specifies the `count text` for the filtering input to reflect matches found.\n * @i18n\n */\n columnFilteringCountText?: (count: number) => string;\n\n /**\n * Specifies the `no match` text for when there are no matching options in the filtering.\n * @i18n\n */\n columnFilteringNoMatchText?: string;\n\n /**\n * Specifies both an `aria-label` for the clear filtering input action and the `clear filter button` text for the no match button.\n * @i18n\n */\n columnFilteringClearFilterText?: string;\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (22af933b)";
2
+ export var PACKAGE_VERSION = "3.0.0 (66976ad0)";
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 (22af933b)",
3
+ "PACKAGE_VERSION": "3.0.0 (66976ad0)",
4
4
  "THEME": "default",
5
5
  "ALWAYS_VISUAL_REFRESH": false
6
6
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "22af933bede3e80228b4c49946fb4763acb4a5bc"
2
+ "commit": "66976ad0d5e364baf83a20eb7017de2dc08488fb"
3
3
  }
package/package.json CHANGED
@@ -131,7 +131,7 @@
131
131
  "./internal/base-component/index.js",
132
132
  "./internal/base-component/styles.css.js"
133
133
  ],
134
- "version": "3.0.837",
134
+ "version": "3.0.838",
135
135
  "repository": {
136
136
  "type": "git",
137
137
  "url": "https://github.com/cloudscape-design/components.git"
@@ -3,6 +3,6 @@ import { TableBodyCellProps } from './index';
3
3
  interface DisabledInlineEditorProps<ItemType> extends TableBodyCellProps<ItemType> {
4
4
  editDisabledReason: string;
5
5
  }
6
- export declare function DisabledInlineEditor<ItemType>({ className, item, column, ariaLabels, isEditing, onEditStart, onEditEnd, editDisabledReason, isVisualRefresh, resizableColumns, ...rest }: DisabledInlineEditorProps<ItemType>): JSX.Element;
6
+ export declare function DisabledInlineEditor<ItemType>({ item, column, ariaLabels, isEditing, onEditStart, onEditEnd, editDisabledReason, ...rest }: DisabledInlineEditorProps<ItemType>): JSX.Element;
7
7
  export {};
8
8
  //# sourceMappingURL=disabled-inline-editor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"disabled-inline-editor.d.ts","sourceRoot":"","sources":["../../../../src/table/body-cell/disabled-inline-editor.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAK7C,UAAU,yBAAyB,CAAC,QAAQ,CAAE,SAAQ,kBAAkB,CAAC,QAAQ,CAAC;IAChF,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,EAC7C,SAAS,EACT,IAAI,EACJ,MAAM,EACN,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,gBAAwB,EACxB,GAAG,IAAI,EACR,EAAE,yBAAyB,CAAC,QAAQ,CAAC,eAmGrC"}
1
+ {"version":3,"file":"disabled-inline-editor.d.ts","sourceRoot":"","sources":["../../../../src/table/body-cell/disabled-inline-editor.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAK7C,UAAU,yBAAyB,CAAC,QAAQ,CAAE,SAAQ,kBAAkB,CAAC,QAAQ,CAAC;IAChF,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,EAC7C,IAAI,EACJ,MAAM,EACN,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,GAAG,IAAI,EACR,EAAE,yBAAyB,CAAC,QAAQ,CAAC,eA8FrC"}
@@ -17,7 +17,7 @@ import { TableTdElement } from './td-element';
17
17
  import styles from './styles.css.js';
18
18
  export function DisabledInlineEditor(_a) {
19
19
  var _b;
20
- var { className, item, column, ariaLabels, isEditing, onEditStart, onEditEnd, editDisabledReason, isVisualRefresh, resizableColumns = false } = _a, rest = __rest(_a, ["className", "item", "column", "ariaLabels", "isEditing", "onEditStart", "onEditEnd", "editDisabledReason", "isVisualRefresh", "resizableColumns"]);
20
+ var { item, column, ariaLabels, isEditing, onEditStart, onEditEnd, editDisabledReason } = _a, rest = __rest(_a, ["item", "column", "ariaLabels", "isEditing", "onEditStart", "onEditEnd", "editDisabledReason"]);
21
21
  const clickAwayRef = useClickAway(() => {
22
22
  if (isEditing) {
23
23
  onEditEnd(true);
@@ -43,7 +43,7 @@ export function DisabledInlineEditor(_a) {
43
43
  const { targetProps, descriptionEl } = useHiddenDescription(editDisabledReason);
44
44
  const portalClasses = usePortalModeClasses(portalRef);
45
45
  const { tabIndex } = useSingleTabStopNavigation(buttonRef);
46
- return (React.createElement(TableTdElement, Object.assign({}, rest, { nativeAttributes: { 'data-inline-editing-active': isEditing.toString() }, className: clsx(className, styles['body-cell-editable'], resizableColumns && styles['resizable-columns'], isEditing && styles['body-cell-edit-disabled-popover'], isVisualRefresh && styles['is-visual-refresh']), onClick: !isEditing ? onClick : undefined, onMouseEnter: () => setHasHover(true), onMouseLeave: () => setHasHover(false), ref: clickAwayRef }),
46
+ return (React.createElement(TableTdElement, Object.assign({}, rest, { nativeAttributes: { 'data-inline-editing-active': isEditing.toString() }, isEditing: isEditing, isEditingDisabled: true, onClick: !isEditing ? onClick : undefined, onMouseEnter: () => setHasHover(true), onMouseLeave: () => setHasHover(false), ref: clickAwayRef }),
47
47
  column.cell(item),
48
48
  React.createElement("div", { className: styles['body-cell-editor-wrapper'] },
49
49
  React.createElement("button", Object.assign({ ref: buttonRef, tabIndex: tabIndex, className: clsx(styles['body-cell-editor'], styles['body-cell-editor-disabled']), "aria-label": (_b = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.activateEditLabel) === null || _b === void 0 ? void 0 : _b.call(ariaLabels, column, item), "aria-haspopup": "dialog", "aria-disabled": "true", onFocus: () => setHasFocus(true), onBlur: () => setHasFocus(false), onKeyDown: handleEscape }, targetProps),
@@ -1 +1 @@
1
- {"version":3,"file":"disabled-inline-editor.js","sourceRoot":"","sources":["../../../../src/table/body-cell/disabled-inline-editor.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,IAAI,MAAM,qBAAqB,CAAC;AACvC,OAAO,MAAM,MAAM,kCAAkC,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2DAA2D,CAAC;AACvG,OAAO,oBAAoB,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAA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,IAAI,EAAC,cAAc,EAAC,OAAO,EAAC,QAAQ,EAAC,iBAAiB,EAAE,OAAO,GAAI;gBACrF,aAAa,CACP,CACL;QAEL,SAAS,IAAI,CACZ,8BAAM,GAAG,EAAE,SAAS;YAClB,oBAAC,MAAM;gBACL,8BAAM,SAAS,EAAE,aAAa;oBAC5B,oBAAC,gBAAgB,IACf,IAAI,EAAC,QAAQ,EACb,UAAU,EAAE,KAAK,EACjB,QAAQ,EAAC,KAAK,EACd,QAAQ,EAAE,OAAO,EACjB,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC,oBAAC,KAAK,IAAC,QAAQ,EAAE,QAAQ,GAAI,EAChD,gBAAgB,EAAE,IAAI,EACtB,MAAM,EAAE,IAAI;wBAEZ,oBAAC,WAAW,IACV,aAAa,EAAE,KAAK,EACpB,gBAAgB,EAAE,SAAS,EAC3B,MAAM,EAAE,IAAI,EACZ,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC,EACnB,eAAe,EAAC,MAAM;4BAEtB,oBAAC,kBAAkB,IAAC,OAAO,EAAC,MAAM,IAAE,kBAAkB,CAAsB,CAChE,CACG,CACd,CACA,CACJ,CACR,CACc,CAClB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport Icon from '../../icon/internal';\nimport Portal from '../../internal/components/portal';\nimport { useSingleTabStopNavigation } from '../../internal/context/single-tab-stop-navigation-context';\nimport useHiddenDescription from '../../internal/hooks/use-hidden-description';\nimport { usePortalModeClasses } from '../../internal/hooks/use-portal-mode-classes';\nimport InternalLiveRegion from '../../live-region/internal';\nimport Arrow from '../../popover/arrow';\nimport PopoverBody from '../../popover/body';\nimport PopoverContainer from '../../popover/container';\nimport { useClickAway } from './click-away';\nimport { TableBodyCellProps } from './index';\nimport { TableTdElement, TableTdElementProps } from './td-element';\n\nimport styles from './styles.css.js';\n\ninterface DisabledInlineEditorProps<ItemType> extends TableBodyCellProps<ItemType> {\n editDisabledReason: string;\n}\n\nexport function DisabledInlineEditor<ItemType>({\n className,\n item,\n column,\n ariaLabels,\n isEditing,\n onEditStart,\n onEditEnd,\n editDisabledReason,\n isVisualRefresh,\n resizableColumns = false,\n ...rest\n}: DisabledInlineEditorProps<ItemType>) {\n const clickAwayRef = useClickAway(() => {\n if (isEditing) {\n onEditEnd(true);\n }\n });\n\n const [hasHover, setHasHover] = useState(false);\n const [hasFocus, setHasFocus] = useState(false);\n // When a cell is both expandable and editable the icon is always shown.\n const showIcon = hasHover || hasFocus || isEditing;\n\n const iconRef = useRef(null);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const portalRef = useRef<HTMLSpanElement>(null);\n\n function handleEscape(event: React.KeyboardEvent): void {\n if (event.key === 'Escape') {\n onEditEnd(true);\n }\n }\n\n const onClick = () => {\n onEditStart();\n buttonRef.current?.focus();\n };\n\n const { targetProps, descriptionEl } = useHiddenDescription(editDisabledReason);\n const portalClasses = usePortalModeClasses(portalRef);\n\n const { tabIndex } = useSingleTabStopNavigation(buttonRef);\n\n return (\n <TableTdElement\n {...rest}\n nativeAttributes={\n { 'data-inline-editing-active': isEditing.toString() } as TableTdElementProps['nativeAttributes']\n }\n className={clsx(\n className,\n styles['body-cell-editable'],\n resizableColumns && styles['resizable-columns'],\n isEditing && styles['body-cell-edit-disabled-popover'],\n isVisualRefresh && styles['is-visual-refresh']\n )}\n onClick={!isEditing ? onClick : undefined}\n onMouseEnter={() => setHasHover(true)}\n onMouseLeave={() => setHasHover(false)}\n ref={clickAwayRef}\n >\n {column.cell(item)}\n\n <div className={styles['body-cell-editor-wrapper']}>\n <button\n ref={buttonRef}\n tabIndex={tabIndex}\n className={clsx(styles['body-cell-editor'], styles['body-cell-editor-disabled'])}\n aria-label={ariaLabels?.activateEditLabel?.(column, item)}\n aria-haspopup=\"dialog\"\n aria-disabled=\"true\"\n onFocus={() => setHasFocus(true)}\n onBlur={() => setHasFocus(false)}\n onKeyDown={handleEscape}\n {...targetProps}\n >\n {showIcon && <Icon name=\"lock-private\" variant=\"normal\" __internalRootRef={iconRef} />}\n {descriptionEl}\n </button>\n </div>\n\n {isEditing && (\n <span ref={portalRef}>\n <Portal>\n <span className={portalClasses}>\n <PopoverContainer\n size=\"medium\"\n fixedWidth={false}\n position=\"top\"\n trackRef={iconRef}\n arrow={position => <Arrow position={position} />}\n renderWithPortal={true}\n zIndex={2000}\n >\n <PopoverBody\n dismissButton={false}\n dismissAriaLabel={undefined}\n header={null}\n onDismiss={() => {}}\n overflowVisible=\"both\"\n >\n <InternalLiveRegion tagName=\"span\">{editDisabledReason}</InternalLiveRegion>\n </PopoverBody>\n </PopoverContainer>\n </span>\n </Portal>\n </span>\n )}\n </TableTdElement>\n );\n}\n"]}
1
+ {"version":3,"file":"disabled-inline-editor.js","sourceRoot":"","sources":["../../../../src/table/body-cell/disabled-inline-editor.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,IAAI,MAAM,qBAAqB,CAAC;AACvC,OAAO,MAAM,MAAM,kCAAkC,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2DAA2D,CAAC;AACvG,OAAO,oBAAoB,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAuB,MAAM,cAAc,CAA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AAC,KAAK,EACd,QAAQ,EAAE,OAAO,EACjB,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC,oBAAC,KAAK,IAAC,QAAQ,EAAE,QAAQ,GAAI,EAChD,gBAAgB,EAAE,IAAI,EACtB,MAAM,EAAE,IAAI;wBAEZ,oBAAC,WAAW,IACV,aAAa,EAAE,KAAK,EACpB,gBAAgB,EAAE,SAAS,EAC3B,MAAM,EAAE,IAAI,EACZ,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC,EACnB,eAAe,EAAC,MAAM;4BAEtB,oBAAC,kBAAkB,IAAC,OAAO,EAAC,MAAM,IAAE,kBAAkB,CAAsB,CAChE,CACG,CACd,CACA,CACJ,CACR,CACc,CAClB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport Icon from '../../icon/internal';\nimport Portal from '../../internal/components/portal';\nimport { useSingleTabStopNavigation } from '../../internal/context/single-tab-stop-navigation-context';\nimport useHiddenDescription from '../../internal/hooks/use-hidden-description';\nimport { usePortalModeClasses } from '../../internal/hooks/use-portal-mode-classes';\nimport InternalLiveRegion from '../../live-region/internal';\nimport Arrow from '../../popover/arrow';\nimport PopoverBody from '../../popover/body';\nimport PopoverContainer from '../../popover/container';\nimport { useClickAway } from './click-away';\nimport { TableBodyCellProps } from './index';\nimport { TableTdElement, TableTdElementProps } from './td-element';\n\nimport styles from './styles.css.js';\n\ninterface DisabledInlineEditorProps<ItemType> extends TableBodyCellProps<ItemType> {\n editDisabledReason: string;\n}\n\nexport function DisabledInlineEditor<ItemType>({\n item,\n column,\n ariaLabels,\n isEditing,\n onEditStart,\n onEditEnd,\n editDisabledReason,\n ...rest\n}: DisabledInlineEditorProps<ItemType>) {\n const clickAwayRef = useClickAway(() => {\n if (isEditing) {\n onEditEnd(true);\n }\n });\n\n const [hasHover, setHasHover] = useState(false);\n const [hasFocus, setHasFocus] = useState(false);\n // When a cell is both expandable and editable the icon is always shown.\n const showIcon = hasHover || hasFocus || isEditing;\n\n const iconRef = useRef(null);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const portalRef = useRef<HTMLSpanElement>(null);\n\n function handleEscape(event: React.KeyboardEvent): void {\n if (event.key === 'Escape') {\n onEditEnd(true);\n }\n }\n\n const onClick = () => {\n onEditStart();\n buttonRef.current?.focus();\n };\n\n const { targetProps, descriptionEl } = useHiddenDescription(editDisabledReason);\n const portalClasses = usePortalModeClasses(portalRef);\n\n const { tabIndex } = useSingleTabStopNavigation(buttonRef);\n\n return (\n <TableTdElement\n {...rest}\n nativeAttributes={\n { 'data-inline-editing-active': isEditing.toString() } as TableTdElementProps['nativeAttributes']\n }\n isEditing={isEditing}\n isEditingDisabled={true}\n onClick={!isEditing ? onClick : undefined}\n onMouseEnter={() => setHasHover(true)}\n onMouseLeave={() => setHasHover(false)}\n ref={clickAwayRef}\n >\n {column.cell(item)}\n\n <div className={styles['body-cell-editor-wrapper']}>\n <button\n ref={buttonRef}\n tabIndex={tabIndex}\n className={clsx(styles['body-cell-editor'], styles['body-cell-editor-disabled'])}\n aria-label={ariaLabels?.activateEditLabel?.(column, item)}\n aria-haspopup=\"dialog\"\n aria-disabled=\"true\"\n onFocus={() => setHasFocus(true)}\n onBlur={() => setHasFocus(false)}\n onKeyDown={handleEscape}\n {...targetProps}\n >\n {showIcon && <Icon name=\"lock-private\" variant=\"normal\" __internalRootRef={iconRef} />}\n {descriptionEl}\n </button>\n </div>\n\n {isEditing && (\n <span ref={portalRef}>\n <Portal>\n <span className={portalClasses}>\n <PopoverContainer\n size=\"medium\"\n fixedWidth={false}\n position=\"top\"\n trackRef={iconRef}\n arrow={position => <Arrow position={position} />}\n renderWithPortal={true}\n zIndex={2000}\n >\n <PopoverBody\n dismissButton={false}\n dismissAriaLabel={undefined}\n header={null}\n onDismiss={() => {}}\n overflowVisible=\"both\"\n >\n <InternalLiveRegion tagName=\"span\">{editDisabledReason}</InternalLiveRegion>\n </PopoverBody>\n </PopoverContainer>\n </span>\n </Portal>\n </span>\n )}\n </TableTdElement>\n );\n}\n"]}
@@ -4,15 +4,11 @@ import { TableTdElementProps } from './td-element';
4
4
  export interface TableBodyCellProps<ItemType> extends TableTdElementProps {
5
5
  column: TableProps.ColumnDefinition<ItemType>;
6
6
  item: ItemType;
7
- isEditing: boolean;
8
- resizableColumns?: boolean;
9
7
  successfulEdit?: boolean;
10
8
  onEditStart: () => void;
11
9
  onEditEnd: (cancelled: boolean) => void;
12
10
  submitEdit?: TableProps.SubmitEditFunction<ItemType>;
13
11
  ariaLabels: TableProps['ariaLabels'];
14
12
  }
15
- export declare function TableBodyCell<ItemType>({ isEditable, ...rest }: TableBodyCellProps<ItemType> & {
16
- isEditable: boolean;
17
- }): JSX.Element;
13
+ export declare function TableBodyCell<ItemType>(props: TableBodyCellProps<ItemType>): JSX.Element;
18
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/table/body-cell/index.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAkB,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAQnE,MAAM,WAAW,kBAAkB,CAAC,QAAQ,CAAE,SAAQ,mBAAmB;IACvE,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC9C,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,SAAS,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,UAAU,CAAC,EAAE,UAAU,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACrD,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;CACtC;AA0HD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,EACtC,UAAU,EACV,GAAG,IAAI,EACR,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG;IAAE,UAAU,EAAE,OAAO,CAAA;CAAE,eAexD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/table/body-cell/index.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAkB,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAQnE,MAAM,WAAW,kBAAkB,CAAC,QAAQ,CAAE,SAAQ,mBAAmB;IACvE,MAAM,EAAE,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC9C,IAAI,EAAE,QAAQ,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,SAAS,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,UAAU,CAAC,EAAE,UAAU,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACrD,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;CACtC;AAiHD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,kBAAkB,CAAC,QAAQ,CAAC,eAmB1E"}
@@ -2,7 +2,6 @@ import { __rest } from "tslib";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  import React, { useEffect, useRef, useState } from 'react';
5
- import clsx from 'clsx';
6
5
  import { useInternalI18n } from '../../i18n/context';
7
6
  import Icon from '../../icon/internal';
8
7
  import { useSingleTabStopNavigation } from '../../internal/context/single-tab-stop-navigation-context.js';
@@ -17,7 +16,7 @@ const submitHandlerFallback = () => {
17
16
  };
18
17
  function TableCellEditable(_a) {
19
18
  var _b, _c, _d;
20
- var { className, item, column, isEditing, onEditStart, onEditEnd, submitEdit, ariaLabels, isVisualRefresh, resizableColumns = false, successfulEdit = false } = _a, rest = __rest(_a, ["className", "item", "column", "isEditing", "onEditStart", "onEditEnd", "submitEdit", "ariaLabels", "isVisualRefresh", "resizableColumns", "successfulEdit"]);
19
+ var { item, column, isEditing, onEditStart, onEditEnd, submitEdit, ariaLabels, successfulEdit = false } = _a, rest = __rest(_a, ["item", "column", "isEditing", "onEditStart", "onEditEnd", "submitEdit", "ariaLabels", "successfulEdit"]);
21
20
  const i18n = useInternalI18n('table');
22
21
  const editActivateRef = useRef(null);
23
22
  const tdNativeAttributes = {
@@ -49,7 +48,7 @@ function TableCellEditable(_a) {
49
48
  }
50
49
  }, [hasFocus, successfulEdit, prevHasFocus, prevSuccessfulEdit]);
51
50
  const { tabIndex: editActivateTabIndex } = useSingleTabStopNavigation(editActivateRef);
52
- return (React.createElement(TableTdElement, Object.assign({}, rest, { nativeAttributes: tdNativeAttributes, className: clsx(className, styles['body-cell-editable'], resizableColumns && styles['resizable-columns'], isEditing && styles['body-cell-edit-active'], showSuccessIcon && showIcon && styles['body-cell-has-success'], isVisualRefresh && styles['is-visual-refresh']), onClick: !isEditing ? onEditStart : undefined, onMouseEnter: () => setHasHover(true), onMouseLeave: () => setHasHover(false) }), isEditing ? (React.createElement(InlineEditor, { ariaLabels: ariaLabels, column: column, item: item, onEditEnd: options => {
51
+ return (React.createElement(TableTdElement, Object.assign({}, rest, { nativeAttributes: tdNativeAttributes, isEditing: isEditing, hasSuccessIcon: showSuccessIcon && showIcon, onClick: !isEditing ? onEditStart : undefined, onMouseEnter: () => setHasHover(true), onMouseLeave: () => setHasHover(false) }), isEditing ? (React.createElement(InlineEditor, { ariaLabels: ariaLabels, column: column, item: item, onEditEnd: options => {
53
52
  setShowSuccessIcon(false);
54
53
  isFocusMoveNeededRef.current = options.refocusCell;
55
54
  onEditEnd(options.cancelled);
@@ -66,20 +65,19 @@ function TableCellEditable(_a) {
66
65
  React.createElement("div", { className: styles['body-cell-editor-wrapper'] },
67
66
  React.createElement("button", { className: styles['body-cell-editor'], "aria-label": (_d = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.activateEditLabel) === null || _d === void 0 ? void 0 : _d.call(ariaLabels, column, item), ref: editActivateRef, onFocus: () => setHasFocus(true), onBlur: () => setHasFocus(false), tabIndex: editActivateTabIndex }, showIcon && React.createElement(Icon, { name: "edit" })))))));
68
67
  }
69
- export function TableBodyCell(_a) {
70
- var _b, _c;
71
- var { isEditable } = _a, rest = __rest(_a, ["isEditable"]);
72
- const isExpandableColumnCell = rest.level !== undefined;
73
- const editDisabledReason = (_c = (_b = rest.column.editConfig) === null || _b === void 0 ? void 0 : _b.disabledReason) === null || _c === void 0 ? void 0 : _c.call(_b, rest.item);
68
+ export function TableBodyCell(props) {
69
+ var _a, _b;
70
+ const isExpandableColumnCell = props.level !== undefined;
71
+ const editDisabledReason = (_b = (_a = props.column.editConfig) === null || _a === void 0 ? void 0 : _a.disabledReason) === null || _b === void 0 ? void 0 : _b.call(_a, props.item);
74
72
  // Inline editing is deactivated for expandable column because editable cells are interactive
75
73
  // and cannot include interactive content such as expand toggles.
76
74
  if (editDisabledReason && !isExpandableColumnCell) {
77
- return React.createElement(DisabledInlineEditor, Object.assign({ editDisabledReason: editDisabledReason }, rest));
75
+ return React.createElement(DisabledInlineEditor, Object.assign({ editDisabledReason: editDisabledReason }, props));
78
76
  }
79
- if ((isEditable || rest.isEditing) && !isExpandableColumnCell) {
80
- return React.createElement(TableCellEditable, Object.assign({}, rest));
77
+ if ((props.isEditable || props.isEditing) && !isExpandableColumnCell) {
78
+ return React.createElement(TableCellEditable, Object.assign({}, props));
81
79
  }
82
- const { column, item } = rest;
83
- return React.createElement(TableTdElement, Object.assign({}, rest), column.cell(item));
80
+ const { column, item } = props;
81
+ return (React.createElement(TableTdElement, Object.assign({}, props, { isEditable: false }), column.cell(item)));
84
82
  }
85
83
  //# sourceMappingURL=index.js.map