@cloudscape-design/components 3.0.1307 → 3.0.1309

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 (187) hide show
  1. package/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.d.ts.map +1 -1
  2. package/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.js +4 -2
  3. package/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.js.map +1 -1
  4. package/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.d.ts.map +1 -1
  5. package/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.js +4 -2
  6. package/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.js.map +1 -1
  7. package/app-layout/visual-refresh-toolbar/drawer/global-drawer.d.ts.map +1 -1
  8. package/app-layout/visual-refresh-toolbar/drawer/global-drawer.js +3 -2
  9. package/app-layout/visual-refresh-toolbar/drawer/global-drawer.js.map +1 -1
  10. package/app-layout/visual-refresh-toolbar/drawer/local-drawer.d.ts.map +1 -1
  11. package/app-layout/visual-refresh-toolbar/drawer/local-drawer.js +2 -2
  12. package/app-layout/visual-refresh-toolbar/drawer/local-drawer.js.map +1 -1
  13. package/app-layout/visual-refresh-toolbar/interfaces.d.ts +1 -0
  14. package/app-layout/visual-refresh-toolbar/interfaces.d.ts.map +1 -1
  15. package/app-layout/visual-refresh-toolbar/interfaces.js.map +1 -1
  16. package/app-layout/visual-refresh-toolbar/state/use-app-layout.d.ts.map +1 -1
  17. package/app-layout/visual-refresh-toolbar/state/use-app-layout.js +12 -1
  18. package/app-layout/visual-refresh-toolbar/state/use-app-layout.js.map +1 -1
  19. package/badge/styles.css.js +10 -10
  20. package/badge/styles.scoped.css +29 -16
  21. package/badge/styles.selectors.js +10 -10
  22. package/collection-preferences/content-display/content-display-option.js +1 -1
  23. package/collection-preferences/content-display/content-display-option.js.map +1 -1
  24. package/collection-preferences/content-display/index.d.ts +3 -7
  25. package/collection-preferences/content-display/index.d.ts.map +1 -1
  26. package/collection-preferences/content-display/index.js +63 -27
  27. package/collection-preferences/content-display/index.js.map +1 -1
  28. package/collection-preferences/content-display/utils.d.ts +41 -2
  29. package/collection-preferences/content-display/utils.d.ts.map +1 -1
  30. package/collection-preferences/content-display/utils.js +107 -13
  31. package/collection-preferences/content-display/utils.js.map +1 -1
  32. package/collection-preferences/index.d.ts.map +1 -1
  33. package/collection-preferences/index.js +2 -2
  34. package/collection-preferences/index.js.map +1 -1
  35. package/collection-preferences/interfaces.d.ts +30 -2
  36. package/collection-preferences/interfaces.d.ts.map +1 -1
  37. package/collection-preferences/interfaces.js.map +1 -1
  38. package/collection-preferences/styles.css.js +38 -36
  39. package/collection-preferences/styles.scoped.css +81 -37
  40. package/collection-preferences/styles.selectors.js +38 -36
  41. package/collection-preferences/utils.d.ts +1 -0
  42. package/collection-preferences/utils.d.ts.map +1 -1
  43. package/collection-preferences/utils.js +14 -0
  44. package/collection-preferences/utils.js.map +1 -1
  45. package/expandable-section/styles.css.js +35 -35
  46. package/expandable-section/styles.scoped.css +68 -68
  47. package/expandable-section/styles.selectors.js +35 -35
  48. package/i18n/messages/all.all.js +1 -1
  49. package/i18n/messages/all.all.json +1 -1
  50. package/i18n/messages/all.en.js +1 -1
  51. package/i18n/messages/all.en.json +1 -1
  52. package/i18n/messages-types.d.ts +4 -0
  53. package/i18n/messages-types.d.ts.map +1 -1
  54. package/i18n/messages-types.js.map +1 -1
  55. package/icon/interfaces.d.ts +1 -1
  56. package/icon/interfaces.d.ts.map +1 -1
  57. package/icon/interfaces.js.map +1 -1
  58. package/icon/internal.js +2 -2
  59. package/icon/internal.js.map +1 -1
  60. package/icon/styles.css.js +41 -39
  61. package/icon/styles.scoped.css +104 -85
  62. package/icon/styles.selectors.js +41 -39
  63. package/internal/base-component/styles.scoped.css +35 -3
  64. package/internal/environment.js +2 -2
  65. package/internal/environment.json +2 -2
  66. package/internal/generated/styles/tokens.d.ts +23 -1
  67. package/internal/generated/styles/tokens.js +23 -1
  68. package/internal/generated/theming/index.cjs +476 -4
  69. package/internal/generated/theming/index.cjs.d.ts +216 -0
  70. package/internal/generated/theming/index.d.ts +216 -0
  71. package/internal/generated/theming/index.js +476 -4
  72. package/internal/hooks/use-width-change/index.d.ts +12 -0
  73. package/internal/hooks/use-width-change/index.d.ts.map +1 -0
  74. package/internal/hooks/use-width-change/index.js +33 -0
  75. package/internal/hooks/use-width-change/index.js.map +1 -0
  76. package/internal/manifest.json +1 -1
  77. package/manifest.json +2 -2
  78. package/package.json +1 -1
  79. package/pagination/internal.d.ts.map +1 -1
  80. package/pagination/internal.js +4 -1
  81. package/pagination/internal.js.map +1 -1
  82. package/prompt-input/internal.d.ts.map +1 -1
  83. package/prompt-input/internal.js +9 -2
  84. package/prompt-input/internal.js.map +1 -1
  85. package/prompt-input/tokens/use-token-mode.d.ts.map +1 -1
  86. package/prompt-input/tokens/use-token-mode.js +0 -9
  87. package/prompt-input/tokens/use-token-mode.js.map +1 -1
  88. package/table/column-groups/col-group.d.ts +12 -0
  89. package/table/column-groups/col-group.d.ts.map +1 -0
  90. package/table/column-groups/col-group.js +24 -0
  91. package/table/column-groups/col-group.js.map +1 -0
  92. package/table/column-groups/split-utils.d.ts +31 -0
  93. package/table/column-groups/split-utils.d.ts.map +1 -0
  94. package/table/column-groups/split-utils.js +43 -0
  95. package/table/column-groups/split-utils.js.map +1 -0
  96. package/table/column-groups/use-column-groups.d.ts +7 -0
  97. package/table/column-groups/use-column-groups.d.ts.map +1 -0
  98. package/table/column-groups/use-column-groups.js +23 -0
  99. package/table/column-groups/use-column-groups.js.map +1 -0
  100. package/table/column-groups/utils.d.ts +54 -0
  101. package/table/column-groups/utils.d.ts.map +1 -0
  102. package/table/column-groups/utils.js +204 -0
  103. package/table/column-groups/utils.js.map +1 -0
  104. package/table/header-cell/common-props.d.ts +23 -0
  105. package/table/header-cell/common-props.d.ts.map +1 -0
  106. package/table/header-cell/common-props.js +4 -0
  107. package/table/header-cell/common-props.js.map +1 -0
  108. package/table/header-cell/group-header-cell.d.ts +45 -0
  109. package/table/header-cell/group-header-cell.d.ts.map +1 -0
  110. package/table/header-cell/group-header-cell.js +44 -0
  111. package/table/header-cell/group-header-cell.js.map +1 -0
  112. package/table/header-cell/index.d.ts +12 -22
  113. package/table/header-cell/index.d.ts.map +1 -1
  114. package/table/header-cell/index.js +3 -3
  115. package/table/header-cell/index.js.map +1 -1
  116. package/table/header-cell/styles.css.js +33 -30
  117. package/table/header-cell/styles.scoped.css +92 -68
  118. package/table/header-cell/styles.selectors.js +33 -30
  119. package/table/header-cell/th-element.d.ts +16 -0
  120. package/table/header-cell/th-element.d.ts.map +1 -1
  121. package/table/header-cell/th-element.js +6 -4
  122. package/table/header-cell/th-element.js.map +1 -1
  123. package/table/index.d.ts.map +1 -1
  124. package/table/index.js +5 -2
  125. package/table/index.js.map +1 -1
  126. package/table/interfaces.d.ts +37 -1
  127. package/table/interfaces.d.ts.map +1 -1
  128. package/table/interfaces.js.map +1 -1
  129. package/table/internal.d.ts.map +1 -1
  130. package/table/internal.js +17 -5
  131. package/table/internal.js.map +1 -1
  132. package/table/resizer/index.d.ts +9 -2
  133. package/table/resizer/index.d.ts.map +1 -1
  134. package/table/resizer/index.js +5 -5
  135. package/table/resizer/index.js.map +1 -1
  136. package/table/resizer/styles.css.js +16 -13
  137. package/table/resizer/styles.scoped.css +36 -26
  138. package/table/resizer/styles.selectors.js +16 -13
  139. package/table/sticky-header.d.ts +3 -0
  140. package/table/sticky-header.d.ts.map +1 -1
  141. package/table/sticky-header.js +7 -2
  142. package/table/sticky-header.js.map +1 -1
  143. package/table/sticky-scrolling.d.ts.map +1 -1
  144. package/table/sticky-scrolling.js +6 -1
  145. package/table/sticky-scrolling.js.map +1 -1
  146. package/table/styles.css.js +35 -34
  147. package/table/styles.scoped.css +47 -41
  148. package/table/styles.selectors.js +35 -34
  149. package/table/table-role/grid-navigation.d.ts.map +1 -1
  150. package/table/table-role/grid-navigation.js +5 -7
  151. package/table/table-role/grid-navigation.js.map +1 -1
  152. package/table/table-role/table-role-helper.d.ts +3 -0
  153. package/table/table-role/table-role-helper.d.ts.map +1 -1
  154. package/table/table-role/table-role-helper.js +9 -4
  155. package/table/table-role/table-role-helper.js.map +1 -1
  156. package/table/table-role/utils.d.ts +19 -0
  157. package/table/table-role/utils.d.ts.map +1 -1
  158. package/table/table-role/utils.js +86 -7
  159. package/table/table-role/utils.js.map +1 -1
  160. package/table/thead.d.ts +5 -0
  161. package/table/thead.d.ts.map +1 -1
  162. package/table/thead.js +145 -18
  163. package/table/thead.js.map +1 -1
  164. package/table/use-column-widths.d.ts +4 -0
  165. package/table/use-column-widths.d.ts.map +1 -1
  166. package/table/use-column-widths.js +68 -18
  167. package/table/use-column-widths.js.map +1 -1
  168. package/table/use-sticky-header.d.ts.map +1 -1
  169. package/table/use-sticky-header.js +4 -1
  170. package/table/use-sticky-header.js.map +1 -1
  171. package/table/utils.d.ts.map +1 -1
  172. package/table/utils.js +14 -4
  173. package/table/utils.js.map +1 -1
  174. package/test-utils/dom/collection-preferences/content-display-preference.d.ts +28 -2
  175. package/test-utils/dom/collection-preferences/content-display-preference.js +60 -2
  176. package/test-utils/dom/collection-preferences/content-display-preference.js.map +1 -1
  177. package/test-utils/dom/table/index.d.ts +18 -1
  178. package/test-utils/dom/table/index.js +22 -3
  179. package/test-utils/dom/table/index.js.map +1 -1
  180. package/test-utils/selectors/collection-preferences/content-display-preference.d.ts +28 -2
  181. package/test-utils/selectors/collection-preferences/content-display-preference.js +52 -2
  182. package/test-utils/selectors/collection-preferences/content-display-preference.js.map +1 -1
  183. package/test-utils/selectors/table/index.d.ts +18 -1
  184. package/test-utils/selectors/table/index.js +22 -3
  185. package/test-utils/selectors/table/index.js.map +1 -1
  186. package/wizard/wizard-step-list.js +4 -4
  187. package/wizard/wizard-step-list.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/index.tsx"],"names":[],"mapp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AC9F,yBAAyB,EAAE,IAAI,CAC7B,oDAAoD,EACpD,yBAAyB,CAC1B;aACF,GACD,CACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useMemo, useState } from 'react';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalBox from '../../box/internal';\nimport InternalButton from '../../button/internal';\nimport { useInternalI18n } from '../../i18n/context';\nimport {\n formatDndItemCommitted,\n formatDndItemReordered,\n formatDndStarted,\n} from '../../internal/components/sortable-area/use-live-announcements';\nimport InternalList from '../../list/internal';\nimport InternalSpaceBetween from '../../space-between/internal';\nimport InternalTextFilter from '../../text-filter/internal';\nimport { getAnalyticsInnerContextAttribute } from '../analytics-metadata/utils';\nimport { CollectionPreferencesProps } from '../interfaces';\nimport ContentDisplayOption from './content-display-option';\nimport { getFilteredOptions, getSortedOptions, OptionWithVisibility } from './utils';\n\nimport styles from '../styles.css.js';\n\nconst componentPrefix = 'content-display';\n\nconst getClassName = (suffix: string) => styles[`${componentPrefix}-${suffix}`];\n\ninterface ContentDisplayPreferenceProps extends CollectionPreferencesProps.ContentDisplayPreference {\n onChange: (value: ReadonlyArray<CollectionPreferencesProps.ContentDisplayItem>) => void;\n value?: ReadonlyArray<CollectionPreferencesProps.ContentDisplayItem>;\n}\n\nexport default function ContentDisplayPreference({\n title,\n description,\n options,\n value = options.map(({ id }) => ({\n id,\n visible: true,\n })),\n onChange,\n liveAnnouncementDndStarted,\n liveAnnouncementDndItemReordered,\n liveAnnouncementDndItemCommitted,\n liveAnnouncementDndDiscarded,\n dragHandleAriaDescription,\n dragHandleAriaLabel,\n enableColumnFiltering = false,\n i18nStrings,\n}: ContentDisplayPreferenceProps) {\n const idPrefix = useUniqueId(componentPrefix);\n const i18n = useInternalI18n('collection-preferences');\n const [columnFilteringText, setColumnFilteringText] = useState('');\n\n const titleId = `${idPrefix}-title`;\n const descriptionId = `${idPrefix}-description`;\n\n const [sortedOptions, sortedAndFilteredOptions] = useMemo(() => {\n const sorted = getSortedOptions({ options, contentDisplay: value });\n const filtered = getFilteredOptions(sorted, columnFilteringText);\n return [sorted, filtered];\n }, [columnFilteringText, options, value]);\n\n const onToggle = (option: OptionWithVisibility) => {\n // We use sortedOptions as base and not value because there might be options that\n // are not in the value yet, so they're added as non-visible after the known ones.\n onChange(sortedOptions.map(({ id, visible }) => ({ id, visible: id === option.id ? !option.visible : visible })));\n };\n\n return (\n <div\n role=\"group\"\n aria-labelledby={titleId}\n aria-describedby={descriptionId}\n className={styles[componentPrefix]}\n {...getAnalyticsInnerContextAttribute('contentDisplay')}\n >\n <h3 className={getClassName('title')} id={titleId}>\n {i18n('contentDisplayPreference.title', title)}\n </h3>\n <p className={getClassName('description')} id={descriptionId}>\n {i18n('contentDisplayPreference.description', description)}\n </p>\n\n {/* Filter input */}\n {enableColumnFiltering && (\n <div className={getClassName('text-filter')}>\n <InternalTextFilter\n filteringText={columnFilteringText}\n filteringPlaceholder={i18n(\n 'contentDisplayPreference.i18nStrings.columnFilteringPlaceholder',\n i18nStrings?.columnFilteringPlaceholder\n )}\n filteringAriaLabel={i18n(\n 'contentDisplayPreference.i18nStrings.columnFilteringAriaLabel',\n i18nStrings?.columnFilteringAriaLabel\n )}\n filteringClearAriaLabel={i18n(\n 'contentDisplayPreference.i18nStrings.columnFilteringClearFilterText',\n i18nStrings?.columnFilteringClearFilterText\n )}\n onChange={({ detail }) => setColumnFilteringText(detail.filteringText)}\n countText={i18n(\n 'contentDisplayPreference.i18nStrings.columnFilteringCountText',\n i18nStrings?.columnFilteringCountText\n ? i18nStrings?.columnFilteringCountText(sortedAndFilteredOptions.length)\n : undefined,\n format => format({ count: sortedAndFilteredOptions.length })\n )}\n />\n </div>\n )}\n\n {/* No match */}\n {sortedAndFilteredOptions.length === 0 && (\n <div className={getClassName('no-match')}>\n <InternalSpaceBetween size=\"s\" alignItems=\"center\">\n <InternalBox margin={{ top: 'm' }}>\n {i18n(\n 'contentDisplayPreference.i18nStrings.columnFilteringNoMatchText',\n i18nStrings?.columnFilteringNoMatchText\n )}\n </InternalBox>\n <InternalButton onClick={() => setColumnFilteringText('')}>\n {i18n(\n 'contentDisplayPreference.i18nStrings.columnFilteringClearFilterText',\n i18nStrings?.columnFilteringClearFilterText\n )}\n </InternalButton>\n </InternalSpaceBetween>\n </div>\n )}\n\n <InternalList\n items={sortedAndFilteredOptions}\n renderItem={item => ({\n id: item.id,\n content: <ContentDisplayOption option={item} onToggle={onToggle} />,\n announcementLabel: item.label,\n })}\n disableItemPaddings={true}\n sortable={true}\n sortDisabled={columnFilteringText.trim().length > 0}\n onSortingChange={({ detail: { items } }) => {\n onChange(items);\n }}\n ariaDescribedby={descriptionId}\n ariaLabelledby={titleId}\n i18nStrings={{\n liveAnnouncementDndStarted: i18n(\n 'contentDisplayPreference.liveAnnouncementDndStarted',\n liveAnnouncementDndStarted,\n formatDndStarted\n ),\n liveAnnouncementDndItemReordered: i18n(\n 'contentDisplayPreference.liveAnnouncementDndItemReordered',\n liveAnnouncementDndItemReordered,\n formatDndItemReordered\n ),\n liveAnnouncementDndItemCommitted: i18n(\n 'contentDisplayPreference.liveAnnouncementDndItemCommitted',\n liveAnnouncementDndItemCommitted,\n formatDndItemCommitted\n ),\n liveAnnouncementDndDiscarded: i18n(\n 'contentDisplayPreference.liveAnnouncementDndDiscarded',\n liveAnnouncementDndDiscarded\n ),\n dragHandleAriaLabel: i18n('contentDisplayPreference.dragHandleAriaLabel', dragHandleAriaLabel),\n dragHandleAriaDescription: i18n(\n 'contentDisplayPreference.dragHandleAriaDescription',\n dragHandleAriaDescription\n ),\n }}\n />\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EA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,OAAO,CAAC,CAAC,EACjE,cAAc,EAAE,OAAO,EACvB,eAAe,EAAE,aAAa,EAC9B,WAAW,EAAE,eAAe,EAC5B,YAAY,EAAE,WAAW,EACzB,mBAAmB,EAAE,mBAAmB,GACxC,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,YAAY,IACX,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,IAAI,EACd,YAAY,EAAE,WAAW,EACzB,mBAAmB,EAAE,IAAI,EACzB,cAAc,EAAE,OAAO,EACvB,eAAe,EAAE,aAAa,EAC9B,WAAW,EAAE,eAAe,EAC5B,eAAe,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EACvG,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;gBACnB,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,iBAAiB,EAAE,IAAI,CAAC,KAAK;gBAC7B,OAAO,EAAE,oBAAC,oBAAoB,IAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,GAAI;aACvF,CAAC,GACF,CACH,CACG,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useMemo, useState } from 'react';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalBox from '../../box/internal';\nimport InternalButton from '../../button/internal';\nimport { useInternalI18n } from '../../i18n/context';\nimport { SortableAreaProps } from '../../internal/components/sortable-area/interfaces';\nimport {\n formatDndItemCommitted,\n formatDndItemReordered,\n formatDndStarted,\n} from '../../internal/components/sortable-area/use-live-announcements';\nimport InternalList from '../../list/internal';\nimport InternalSpaceBetween from '../../space-between/internal';\nimport InternalTextFilter from '../../text-filter/internal';\nimport { getAnalyticsInnerContextAttribute } from '../analytics-metadata/utils';\nimport { CollectionPreferencesProps } from '../interfaces';\nimport ContentDisplayOption from './content-display-option';\nimport {\n buildOptionTree,\n getFilteredOptions,\n getFilteredTree,\n getSortedOptions,\n OptionGroupNode,\n OptionTreeNode,\n toContentDisplayItems,\n} from './utils';\n\nimport styles from '../styles.css.js';\n\nconst componentPrefix = 'content-display';\n\nconst getClassName = (suffix: string) => styles[`${componentPrefix}-${suffix}`];\n\ninterface ContentDisplayPreferenceProps extends CollectionPreferencesProps.ContentDisplayPreference {\n onChange: (value: ReadonlyArray<CollectionPreferencesProps.ContentDisplayItem>) => void;\n value?: ReadonlyArray<CollectionPreferencesProps.ContentDisplayItem>;\n}\nfunction getDndI18nStrings(\n i18n: ReturnType<typeof useInternalI18n<'collection-preferences'>>,\n props: Pick<\n ContentDisplayPreferenceProps,\n | 'liveAnnouncementDndStarted'\n | 'liveAnnouncementDndItemReordered'\n | 'liveAnnouncementDndItemCommitted'\n | 'liveAnnouncementDndDiscarded'\n | 'dragHandleAriaLabel'\n | 'dragHandleAriaDescription'\n >\n) {\n return {\n liveAnnouncementDndStarted: i18n(\n 'contentDisplayPreference.liveAnnouncementDndStarted',\n props.liveAnnouncementDndStarted,\n formatDndStarted\n ),\n liveAnnouncementDndItemReordered: i18n(\n 'contentDisplayPreference.liveAnnouncementDndItemReordered',\n props.liveAnnouncementDndItemReordered,\n formatDndItemReordered\n ),\n liveAnnouncementDndItemCommitted: i18n(\n 'contentDisplayPreference.liveAnnouncementDndItemCommitted',\n props.liveAnnouncementDndItemCommitted,\n formatDndItemCommitted\n ),\n liveAnnouncementDndDiscarded: i18n(\n 'contentDisplayPreference.liveAnnouncementDndDiscarded',\n props.liveAnnouncementDndDiscarded\n ),\n dragHandleAriaLabel: i18n('contentDisplayPreference.dragHandleAriaLabel', props.dragHandleAriaLabel),\n dragHandleAriaDescription: i18n(\n 'contentDisplayPreference.dragHandleAriaDescription',\n props.dragHandleAriaDescription\n ),\n };\n}\n\ninterface HierarchicalContentDisplayProps {\n tree: OptionTreeNode[];\n onToggle: (id: string) => void;\n onTreeChange: (newTree: OptionTreeNode[]) => void;\n ariaLabel?: string;\n ariaLabelledby?: string;\n ariaDescribedby?: string;\n i18nStrings: SortableAreaProps.DndAreaI18nStrings;\n sortDisabled: boolean;\n parentGroupLabel?: string;\n groupLabelFormatter: (label: string, count: number) => string;\n}\n\nfunction GroupItem({\n node,\n onToggle,\n onChildrenChange,\n i18nStrings,\n sortDisabled,\n groupLabelFormatter,\n}: {\n node: OptionGroupNode;\n onToggle: (id: string) => void;\n onChildrenChange: (children: OptionTreeNode[]) => void;\n i18nStrings: SortableAreaProps.DndAreaI18nStrings;\n sortDisabled: boolean;\n groupLabelFormatter: (label: string, count: number) => string;\n}) {\n return (\n <div data-item-type=\"group\">\n <InternalSpaceBetween size=\"xxs\">\n <div className={styles['content-display-group-header']}>\n <InternalBox fontWeight=\"bold\" display=\"inline\">\n {node.label}\n </InternalBox>\n </div>\n {node.children.length > 0 && (\n <div className={styles['content-display-group-children']}>\n <HierarchicalContentDisplay\n tree={node.children}\n onToggle={onToggle}\n onTreeChange={onChildrenChange}\n i18nStrings={i18nStrings}\n sortDisabled={sortDisabled}\n ariaLabel={node.label}\n parentGroupLabel={node.label}\n groupLabelFormatter={groupLabelFormatter}\n />\n </div>\n )}\n </InternalSpaceBetween>\n </div>\n );\n}\n\nfunction HierarchicalContentDisplay({\n tree,\n onToggle,\n onTreeChange,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n i18nStrings,\n sortDisabled,\n parentGroupLabel,\n groupLabelFormatter,\n}: HierarchicalContentDisplayProps) {\n return (\n <InternalList\n items={tree}\n sortDisabled={sortDisabled}\n sortable={true}\n disableItemPaddings={true}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n i18nStrings={i18nStrings}\n onSortingChange={({ detail: { items } }) => onTreeChange([...items])}\n renderItem={node => ({\n id: node.id,\n announcementLabel:\n node.type === 'group'\n ? groupLabelFormatter(node.label, node.children.length)\n : parentGroupLabel\n ? `${node.label}, ${parentGroupLabel}`\n : node.label,\n content:\n node.type === 'group' ? (\n <GroupItem\n node={node}\n onToggle={onToggle}\n onChildrenChange={newChildren =>\n onTreeChange(\n tree.map(n => (n.id === node.id && n.type === 'group' ? { ...n, children: newChildren } : n))\n )\n }\n i18nStrings={i18nStrings}\n sortDisabled={sortDisabled}\n groupLabelFormatter={groupLabelFormatter}\n />\n ) : (\n <ContentDisplayOption option={node} onToggle={() => onToggle(node.id)} />\n ),\n })}\n />\n );\n}\n\nexport default function ContentDisplayPreference({\n title,\n description,\n options,\n value = options.map(({ id }) => ({\n id,\n visible: true,\n })),\n groups,\n onChange,\n enableColumnFiltering = false,\n i18nStrings,\n ...dndProps\n}: ContentDisplayPreferenceProps) {\n const idPrefix = useUniqueId(componentPrefix);\n const i18n = useInternalI18n('collection-preferences');\n const [columnFilteringText, setColumnFilteringText] = useState('');\n\n const titleId = `${idPrefix}-title`;\n const descriptionId = `${idPrefix}-description`;\n\n const listI18nStrings = getDndI18nStrings(i18n, dndProps);\n const groupLabelFormatter = (label: string, count: number) =>\n i18n(\n 'contentDisplayPreference.liveAnnouncementDndGroupLabel',\n dndProps.liveAnnouncementDndGroupLabel?.(label, count) ?? `${label}, ${count} ${count === 1 ? 'item' : 'items'}`,\n format => format({ label, count })\n );\n const hasGroups = !!groups && groups.length > 0;\n const isFiltering = columnFilteringText.trim().length > 0;\n\n const sortedOptions = useMemo(() => getSortedOptions({ options, contentDisplay: value }), [options, value]);\n const filteredOptions = useMemo(\n () => getFilteredOptions(sortedOptions, columnFilteringText),\n [sortedOptions, columnFilteringText]\n );\n const optionTree = useMemo(\n () => (hasGroups ? buildOptionTree(options, groups, value) : null),\n [hasGroups, groups, options, value]\n );\n const filteredTree = useMemo(\n () => (optionTree ? getFilteredTree(optionTree, columnFilteringText) : null),\n [optionTree, columnFilteringText]\n );\n\n const handleToggle = (id: string) => {\n // For flat (non-grouped) mode, rebuild from sortedOptions to handle items not in value\n if (!hasGroups) {\n onChange(sortedOptions.map(opt => ({ id: opt.id, visible: opt.id === id ? !opt.visible : opt.visible })));\n return;\n }\n // For grouped mode, walk the tree and flip the matching item\n const toggle = (\n items: ReadonlyArray<CollectionPreferencesProps.ContentDisplayItem>\n ): CollectionPreferencesProps.ContentDisplayItem[] =>\n items.map(item => {\n if (item.type === 'group') {\n return { ...item, children: toggle(item.children) };\n }\n return item.id === id ? { ...item, visible: !item.visible } : item;\n });\n onChange(toggle(value));\n };\n const noResults = filteredTree ? filteredTree.length === 0 : filteredOptions.length === 0;\n return (\n <div\n role=\"group\"\n aria-labelledby={titleId}\n aria-describedby={descriptionId}\n className={styles[componentPrefix]}\n {...getAnalyticsInnerContextAttribute('contentDisplay')}\n >\n <h3 className={getClassName('title')} id={titleId}>\n {i18n('contentDisplayPreference.title', title)}\n </h3>\n <p className={getClassName('description')} id={descriptionId}>\n {i18n('contentDisplayPreference.description', description)}\n </p>\n\n {/* Filter input */}\n {enableColumnFiltering && (\n <div className={getClassName('text-filter')}>\n <InternalTextFilter\n filteringText={columnFilteringText}\n filteringPlaceholder={i18n(\n 'contentDisplayPreference.i18nStrings.columnFilteringPlaceholder',\n i18nStrings?.columnFilteringPlaceholder\n )}\n filteringAriaLabel={i18n(\n 'contentDisplayPreference.i18nStrings.columnFilteringAriaLabel',\n i18nStrings?.columnFilteringAriaLabel\n )}\n filteringClearAriaLabel={i18n(\n 'contentDisplayPreference.i18nStrings.columnFilteringClearFilterText',\n i18nStrings?.columnFilteringClearFilterText\n )}\n onChange={({ detail }) => setColumnFilteringText(detail.filteringText)}\n countText={i18n(\n 'contentDisplayPreference.i18nStrings.columnFilteringCountText',\n i18nStrings?.columnFilteringCountText?.(filteredOptions.length),\n format => format({ count: filteredOptions.length })\n )}\n />\n </div>\n )}\n\n {noResults && (\n <div className={getClassName('no-match')}>\n <InternalSpaceBetween size=\"s\" alignItems=\"center\">\n <InternalBox margin={{ top: 'm' }}>\n {i18n(\n 'contentDisplayPreference.i18nStrings.columnFilteringNoMatchText',\n i18nStrings?.columnFilteringNoMatchText\n )}\n </InternalBox>\n <InternalButton onClick={() => setColumnFilteringText('')}>\n {i18n(\n 'contentDisplayPreference.i18nStrings.columnFilteringClearFilterText',\n i18nStrings?.columnFilteringClearFilterText\n )}\n </InternalButton>\n </InternalSpaceBetween>\n </div>\n )}\n\n <div role=\"application\" aria-labelledby={titleId}>\n {optionTree && filteredTree ? (\n <HierarchicalContentDisplay\n tree={isFiltering ? filteredTree : optionTree}\n onToggle={handleToggle}\n onTreeChange={newTree => onChange(toContentDisplayItems(newTree))}\n ariaLabelledby={titleId}\n ariaDescribedby={descriptionId}\n i18nStrings={listI18nStrings}\n sortDisabled={isFiltering}\n groupLabelFormatter={groupLabelFormatter}\n />\n ) : (\n <InternalList\n items={filteredOptions}\n sortable={true}\n sortDisabled={isFiltering}\n disableItemPaddings={true}\n ariaLabelledby={titleId}\n ariaDescribedby={descriptionId}\n i18nStrings={listI18nStrings}\n onSortingChange={({ detail: { items } }) => onChange(items.map(({ id, visible }) => ({ id, visible })))}\n renderItem={item => ({\n id: item.id,\n announcementLabel: item.label,\n content: <ContentDisplayOption option={item} onToggle={() => handleToggle(item.id)} />,\n })}\n />\n )}\n </div>\n </div>\n );\n}\n"]}
@@ -1,7 +1,32 @@
1
1
  import { CollectionPreferencesProps } from '../interfaces';
2
- export interface OptionWithVisibility extends CollectionPreferencesProps.ContentDisplayOption {
2
+ type ContentDisplayItem = CollectionPreferencesProps.ContentDisplayItem;
3
+ type ContentDisplayOption = CollectionPreferencesProps.ContentDisplayOption;
4
+ type ContentDisplayOptionGroup = CollectionPreferencesProps.ContentDisplayOptionGroup;
5
+ export interface OptionWithVisibility extends ContentDisplayOption {
3
6
  visible: boolean;
4
7
  }
8
+ export interface OptionGroupNode {
9
+ type: 'group';
10
+ id: string;
11
+ label: string;
12
+ visible: boolean;
13
+ children: OptionTreeNode[];
14
+ }
15
+ export interface OptionLeafNode extends OptionWithVisibility {
16
+ type: 'leaf';
17
+ }
18
+ export type OptionTreeNode = OptionGroupNode | OptionLeafNode;
19
+ /**
20
+ * Extracts a flat ordered list of leaf items from the contentDisplay tree (depth-first).
21
+ */
22
+ export declare function walkLeaves(items: ReadonlyArray<ContentDisplayItem>): {
23
+ id: string;
24
+ visible: boolean;
25
+ }[];
26
+ /**
27
+ * Returns options ordered by contentDisplay, with visibility applied.
28
+ * Options not in contentDisplay are appended as non-visible.
29
+ */
5
30
  export declare function getSortedOptions({
6
31
  options,
7
32
  contentDisplay
@@ -9,4 +34,18 @@ export declare function getSortedOptions({
9
34
  options: ReadonlyArray<CollectionPreferencesProps.ContentDisplayOption>;
10
35
  contentDisplay: ReadonlyArray<CollectionPreferencesProps.ContentDisplayItem>;
11
36
  }): ReadonlyArray<OptionWithVisibility>;
12
- export declare function getFilteredOptions(options: ReadonlyArray<OptionWithVisibility>, filterText: string): readonly OptionWithVisibility[];
37
+ /**
38
+ * Converts contentDisplay tree into an internal OptionTreeNode tree,
39
+ * resolving labels from options/groups definitions.
40
+ */
41
+ export declare function buildOptionTree(options: ReadonlyArray<ContentDisplayOption>, groups: ReadonlyArray<ContentDisplayOptionGroup>, contentDisplay: ReadonlyArray<ContentDisplayItem>): OptionTreeNode[];
42
+ /**
43
+ * Converts OptionTreeNode[] back to ContentDisplayItem[].
44
+ */
45
+ export declare function toContentDisplayItems(tree: OptionTreeNode[]): ContentDisplayItem[];
46
+ /**
47
+ * Filters tree, keeping leaves matching filterText and groups with matching descendants.
48
+ */
49
+ export declare function getFilteredTree(tree: OptionTreeNode[], filterText: string): OptionTreeNode[];
50
+ export declare function getFilteredOptions(options: ReadonlyArray<OptionWithVisibility>, filterText: string): readonly OptionWithVisibility[];
51
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAE3D,MAAM,WAAW,oBAAqB,SAAQ,0BAA0B,CAAC,oBAAoB;IAC3F,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,cAAc,GACf,EAAE;IACD,OAAO,EAAE,aAAa,CAAC,0BAA0B,CAAC,oBAAoB,CAAC,CAAC;IACxE,cAAc,EAAE,aAAa,CAAC,0BAA0B,CAAC,kBAAkB,CAAC,CAAC;CAC9E,GAAG,aAAa,CAAC,oBAAoB,CAAC,CActC;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,EAAE,UAAU,EAAE,MAAM,mCAQlG"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAE3D,KAAK,kBAAkB,GAAG,0BAA0B,CAAC,kBAAkB,CAAC;AACxE,KAAK,oBAAoB,GAAG,0BAA0B,CAAC,oBAAoB,CAAC;AAC5E,KAAK,yBAAyB,GAAG,0BAA0B,CAAC,yBAAyB,CAAC;AAEtF,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IAChE,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,cAAe,SAAQ,oBAAoB;IAC1D,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,cAAc,GAAG,eAAe,GAAG,cAAc,CAAC;AAE9D;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,aAAa,CAAC,kBAAkB,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EAAE,CAUvG;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,cAAc,GACf,EAAE;IACD,OAAO,EAAE,aAAa,CAAC,0BAA0B,CAAC,oBAAoB,CAAC,CAAC;IACxE,cAAc,EAAE,aAAa,CAAC,0BAA0B,CAAC,kBAAkB,CAAC,CAAC;CAC9E,GAAG,aAAa,CAAC,oBAAoB,CAAC,CAkBtC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,EAC5C,MAAM,EAAE,aAAa,CAAC,yBAAyB,CAAC,EAChD,cAAc,EAAE,aAAa,CAAC,kBAAkB,CAAC,GAChD,cAAc,EAAE,CAgClB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,kBAAkB,EAAE,CAYlF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,cAAc,EAAE,CAkB5F;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,EAAE,UAAU,EAAE,MAAM,mCAMlG"}
@@ -1,23 +1,117 @@
1
+ /**
2
+ * Extracts a flat ordered list of leaf items from the contentDisplay tree (depth-first).
3
+ */
4
+ export function walkLeaves(items) {
5
+ const result = [];
6
+ for (const item of items) {
7
+ if (item.type === 'group') {
8
+ result.push(...walkLeaves(item.children));
9
+ }
10
+ else {
11
+ result.push({ id: item.id, visible: item.visible });
12
+ }
13
+ }
14
+ return result;
15
+ }
16
+ /**
17
+ * Returns options ordered by contentDisplay, with visibility applied.
18
+ * Options not in contentDisplay are appended as non-visible.
19
+ */
1
20
  export function getSortedOptions({ options, contentDisplay, }) {
2
- // By using a Map, we are guaranteed to preserve insertion order on future iteration.
3
- const optionsById = new Map();
4
- // We insert contentDisplay first so we respect the currently selected order
5
- for (const { id, visible } of contentDisplay) {
6
- // If an option is provided in contentDisplay and not options, we default the label to the id
7
- optionsById.set(id, { id, label: id, visible });
21
+ const optionMap = new Map(options.map(o => [o.id, o]));
22
+ const result = new Map();
23
+ for (const { id, visible } of walkLeaves(contentDisplay)) {
24
+ const option = optionMap.get(id);
25
+ if (option) {
26
+ result.set(id, { ...option, visible });
27
+ }
8
28
  }
9
- // We merge options data, and insert any that were not in contentDisplay as non-visible
10
29
  for (const option of options) {
11
- const existing = optionsById.get(option.id);
12
- optionsById.set(option.id, { ...option, visible: !!(existing === null || existing === void 0 ? void 0 : existing.visible) });
30
+ if (!result.has(option.id)) {
31
+ result.set(option.id, { ...option, visible: false });
32
+ }
33
+ }
34
+ return Array.from(result.values());
35
+ }
36
+ /**
37
+ * Converts contentDisplay tree into an internal OptionTreeNode tree,
38
+ * resolving labels from options/groups definitions.
39
+ */
40
+ export function buildOptionTree(options, groups, contentDisplay) {
41
+ if (!groups.length) {
42
+ const sorted = getSortedOptions({ options, contentDisplay });
43
+ return sorted.map(opt => ({ ...opt, type: 'leaf' }));
44
+ }
45
+ const optionMap = new Map(options.map(o => [o.id, o]));
46
+ const groupMap = new Map(groups.map(g => [g.id, g]));
47
+ const convert = (items) => {
48
+ var _a;
49
+ const result = [];
50
+ for (const item of items) {
51
+ if (item.type === 'group') {
52
+ const group = groupMap.get(item.id);
53
+ result.push({
54
+ type: 'group',
55
+ id: item.id,
56
+ label: (_a = group === null || group === void 0 ? void 0 : group.label) !== null && _a !== void 0 ? _a : item.id,
57
+ visible: item.visible,
58
+ children: convert(item.children),
59
+ });
60
+ }
61
+ else {
62
+ const option = optionMap.get(item.id);
63
+ if (option) {
64
+ result.push({ type: 'leaf', ...option, visible: item.visible });
65
+ }
66
+ }
67
+ }
68
+ return result;
69
+ };
70
+ return convert(contentDisplay);
71
+ }
72
+ /**
73
+ * Converts OptionTreeNode[] back to ContentDisplayItem[].
74
+ */
75
+ export function toContentDisplayItems(tree) {
76
+ return tree.map(node => {
77
+ if (node.type === 'group') {
78
+ return {
79
+ type: 'group',
80
+ id: node.id,
81
+ visible: node.visible,
82
+ children: toContentDisplayItems(node.children),
83
+ };
84
+ }
85
+ return { id: node.id, visible: node.visible };
86
+ });
87
+ }
88
+ /**
89
+ * Filters tree, keeping leaves matching filterText and groups with matching descendants.
90
+ */
91
+ export function getFilteredTree(tree, filterText) {
92
+ const text = filterText.trim().toLowerCase();
93
+ if (!text) {
94
+ return tree;
95
+ }
96
+ const result = [];
97
+ for (const node of tree) {
98
+ if (node.type === 'group') {
99
+ const children = getFilteredTree(node.children, text);
100
+ if (children.length > 0) {
101
+ result.push({ ...node, children });
102
+ }
103
+ }
104
+ else if (node.label.toLowerCase().includes(text)) {
105
+ result.push(node);
106
+ }
13
107
  }
14
- return Array.from(optionsById.values());
108
+ return result;
15
109
  }
16
110
  export function getFilteredOptions(options, filterText) {
17
- filterText = filterText.trim().toLowerCase();
18
- if (!filterText) {
111
+ const text = filterText.trim().toLowerCase();
112
+ if (!text) {
19
113
  return options;
20
114
  }
21
- return options.filter(option => option.label.toLowerCase().trim().includes(filterText));
115
+ return options.filter(option => option.label.toLowerCase().includes(text));
22
116
  }
23
117
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/utils.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,gBAAgB,CAAC,EAC/B,OAAO,EACP,cAAc,GAIf;IACC,qFAAqF;IACrF,MAAM,WAAW,GAAG,IAAI,GAAG,EAAgC,CAAC;IAC5D,4EAA4E;IAC5E,KAAK,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,cAAc,EAAE,CAAC;QAC7C,6FAA6F;QAC7F,WAAW,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAClD,CAAC;IACD,uFAAuF;IACvF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC5C,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAA,EAAE,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAA4C,EAAE,UAAkB;IACjG,UAAU,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAE7C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;AAC1F,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { CollectionPreferencesProps } from '../interfaces';\n\nexport interface OptionWithVisibility extends CollectionPreferencesProps.ContentDisplayOption {\n visible: boolean;\n}\n\nexport function getSortedOptions({\n options,\n contentDisplay,\n}: {\n options: ReadonlyArray<CollectionPreferencesProps.ContentDisplayOption>;\n contentDisplay: ReadonlyArray<CollectionPreferencesProps.ContentDisplayItem>;\n}): ReadonlyArray<OptionWithVisibility> {\n // By using a Map, we are guaranteed to preserve insertion order on future iteration.\n const optionsById = new Map<string, OptionWithVisibility>();\n // We insert contentDisplay first so we respect the currently selected order\n for (const { id, visible } of contentDisplay) {\n // If an option is provided in contentDisplay and not options, we default the label to the id\n optionsById.set(id, { id, label: id, visible });\n }\n // We merge options data, and insert any that were not in contentDisplay as non-visible\n for (const option of options) {\n const existing = optionsById.get(option.id);\n optionsById.set(option.id, { ...option, visible: !!existing?.visible });\n }\n return Array.from(optionsById.values());\n}\n\nexport function getFilteredOptions(options: ReadonlyArray<OptionWithVisibility>, filterText: string) {\n filterText = filterText.trim().toLowerCase();\n\n if (!filterText) {\n return options;\n }\n\n return options.filter(option => option.label.toLowerCase().trim().includes(filterText));\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/collection-preferences/content-display/utils.ts"],"names":[],"mappings":"AA0BA;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,KAAwC;IACjE,MAAM,MAAM,GAAuC,EAAE,CAAC;IACtD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC1B,MAAM,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,OAAO,EACP,cAAc,GAIf;IACC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,C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AC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC7C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { CollectionPreferencesProps } from '../interfaces';\n\ntype ContentDisplayItem = CollectionPreferencesProps.ContentDisplayItem;\ntype ContentDisplayOption = CollectionPreferencesProps.ContentDisplayOption;\ntype ContentDisplayOptionGroup = CollectionPreferencesProps.ContentDisplayOptionGroup;\n\nexport interface OptionWithVisibility extends ContentDisplayOption {\n visible: boolean;\n}\n\nexport interface OptionGroupNode {\n type: 'group';\n id: string;\n label: string;\n visible: boolean;\n children: OptionTreeNode[];\n}\n\nexport interface OptionLeafNode extends OptionWithVisibility {\n type: 'leaf';\n}\n\nexport type OptionTreeNode = OptionGroupNode | OptionLeafNode;\n\n/**\n * Extracts a flat ordered list of leaf items from the contentDisplay tree (depth-first).\n */\nexport function walkLeaves(items: ReadonlyArray<ContentDisplayItem>): { id: string; visible: boolean }[] {\n const result: { id: string; visible: boolean }[] = [];\n for (const item of items) {\n if (item.type === 'group') {\n result.push(...walkLeaves(item.children));\n } else {\n result.push({ id: item.id, visible: item.visible });\n }\n }\n return result;\n}\n\n/**\n * Returns options ordered by contentDisplay, with visibility applied.\n * Options not in contentDisplay are appended as non-visible.\n */\nexport function getSortedOptions({\n options,\n contentDisplay,\n}: {\n options: ReadonlyArray<CollectionPreferencesProps.ContentDisplayOption>;\n contentDisplay: ReadonlyArray<CollectionPreferencesProps.ContentDisplayItem>;\n}): ReadonlyArray<OptionWithVisibility> {\n const optionMap = new Map(options.map(o => [o.id, o]));\n const result = new Map<string, OptionWithVisibility>();\n\n for (const { id, visible } of walkLeaves(contentDisplay)) {\n const option = optionMap.get(id);\n if (option) {\n result.set(id, { ...option, visible });\n }\n }\n\n for (const option of options) {\n if (!result.has(option.id)) {\n result.set(option.id, { ...option, visible: false });\n }\n }\n\n return Array.from(result.values());\n}\n\n/**\n * Converts contentDisplay tree into an internal OptionTreeNode tree,\n * resolving labels from options/groups definitions.\n */\nexport function buildOptionTree(\n options: ReadonlyArray<ContentDisplayOption>,\n groups: ReadonlyArray<ContentDisplayOptionGroup>,\n contentDisplay: ReadonlyArray<ContentDisplayItem>\n): OptionTreeNode[] {\n if (!groups.length) {\n const sorted = getSortedOptions({ options, contentDisplay });\n return sorted.map(opt => ({ ...opt, type: 'leaf' as const }));\n }\n\n const optionMap = new Map(options.map(o => [o.id, o]));\n const groupMap = new Map(groups.map(g => [g.id, g]));\n\n const convert = (items: ReadonlyArray<ContentDisplayItem>): OptionTreeNode[] => {\n const result: OptionTreeNode[] = [];\n for (const item of items) {\n if (item.type === 'group') {\n const group = groupMap.get(item.id);\n result.push({\n type: 'group',\n id: item.id,\n label: group?.label ?? item.id,\n visible: item.visible,\n children: convert(item.children),\n });\n } else {\n const option = optionMap.get(item.id);\n if (option) {\n result.push({ type: 'leaf', ...option, visible: item.visible });\n }\n }\n }\n return result;\n };\n\n return convert(contentDisplay);\n}\n\n/**\n * Converts OptionTreeNode[] back to ContentDisplayItem[].\n */\nexport function toContentDisplayItems(tree: OptionTreeNode[]): ContentDisplayItem[] {\n return tree.map(node => {\n if (node.type === 'group') {\n return {\n type: 'group' as const,\n id: node.id,\n visible: node.visible,\n children: toContentDisplayItems(node.children),\n };\n }\n return { id: node.id, visible: node.visible };\n });\n}\n\n/**\n * Filters tree, keeping leaves matching filterText and groups with matching descendants.\n */\nexport function getFilteredTree(tree: OptionTreeNode[], filterText: string): OptionTreeNode[] {\n const text = filterText.trim().toLowerCase();\n if (!text) {\n return tree;\n }\n\n const result: OptionTreeNode[] = [];\n for (const node of tree) {\n if (node.type === 'group') {\n const children = getFilteredTree(node.children, text);\n if (children.length > 0) {\n result.push({ ...node, children });\n }\n } else if (node.label.toLowerCase().includes(text)) {\n result.push(node);\n }\n }\n return result;\n}\n\nexport function getFilteredOptions(options: ReadonlyArray<OptionWithVisibility>, filterText: string) {\n const text = filterText.trim().toLowerCase();\n if (!text) {\n return options;\n }\n return options.filter(option => option.label.toLowerCase().includes(text));\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collection-preferences/index.tsx"],"names":[],"mappings":"AAwBA,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,cAAc,EACd,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,aAAa,EACb,GAAG,IAAI,EACR,EAAE,0BAA0B,eAiO5B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collection-preferences/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAkB1D,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAItC,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,KAAK,EACL,YAAY,EACZ,WAAW,EACX,cAAc,EACd,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,aAAa,EACb,GAAG,IAAI,EACR,EAAE,0BAA0B,eAkO5B"}
@@ -19,7 +19,7 @@ import InternalModal from '../modal/internal';
19
19
  import InternalSpaceBetween from '../space-between/internal';
20
20
  import { getComponentAnalyticsMetadata } from './analytics-metadata/utils';
21
21
  import ContentDisplayPreference from './content-display';
22
- import { ContentDensityPreference, copyPreferences, CustomPreference, mergePreferences, ModalContentLayout, PageSizePreference, StickyColumnsPreference, StripedRowsPreference, WrapLinesPreference, } from './utils';
22
+ import { collectVisibleIds, ContentDensityPreference, copyPreferences, CustomPreference, mergePreferences, ModalContentLayout, PageSizePreference, StickyColumnsPreference, StripedRowsPreference, WrapLinesPreference, } from './utils';
23
23
  import VisibleContentPreference from './visible-content';
24
24
  import analyticsSelectors from './analytics-metadata/styles.css.js';
25
25
  import styles from './styles.css.js';
@@ -86,7 +86,7 @@ export default function CollectionPreferences({ title, confirmLabel, cancelLabel
86
86
  tableComponentContext.preferencesRef.current.pageSize = preferences === null || preferences === void 0 ? void 0 : preferences.pageSize;
87
87
  // When both are used contentDisplayPreference takes preference and so we always prefer to use this as our visible columns if available
88
88
  if (preferences === null || preferences === void 0 ? void 0 : preferences.contentDisplay) {
89
- tableComponentContext.preferencesRef.current.visibleColumns = preferences === null || preferences === void 0 ? void 0 : preferences.contentDisplay.filter(column => column.visible).map(column => column.id);
89
+ tableComponentContext.preferencesRef.current.visibleColumns = collectVisibleIds(preferences.contentDisplay, true);
90
90
  }
91
91
  else if (preferences === null || preferences === void 0 ? void 0 : preferences.visibleContent) {
92
92
  tableComponentContext.preferencesRef.current.visibleColumns = [...preferences.visibleContent];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/collection-preferences/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,YAAY,CAAC;AACb,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,C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,CACH;wBACA,wBAAwB,IAAI,CAC3B,oBAAC,wBAAwB,IACvB,KAAK,EAAE,oBAAoB,CAAC,cAAc,KACtC,wBAAwB,EAC5B,QAAQ,EAAE,cAAc,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC,GACxD,CACH;wBACA,uBAAuB,IAAI,CAC1B,oBAAC,uBAAuB,IACtB,KAAK,EAAE,oBAAoB,CAAC,aAAa,KACrC,uBAAuB,EAC3B,QAAQ,EAAE,aAAa,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC,GACtD,CACH;wBACA,gBAAgB,IAAI,CACnB,oBAAC,gBAAgB,IACf,KAAK,EAAE,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,OACnB,wBAAwB,EAC5B,KAAK,EAAE,oBAAoB,CAAC,cAAc,EAC1C,QAAQ,EAAE,cAAc,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC,GACxD,CACH,CAAC,CAAC,CAAC,CACF,wBAAwB,IAAI,CAC1B,oBAAC,wBAAwB,IACvB,KAAK,EAAE,oBAAoB,CAAC,cAAc,KACtC,wBAAwB,EAC5B,QAAQ,EAAE,YAAY,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,GACpE,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\n'use client';\nimport React, { useContext, useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId, 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 { useTableComponentsContext } from '../internal/context/table-component-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport useBaseComponent from '../internal/hooks/use-base-component';\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 closeAriaLabel,\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 contentBefore,\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 hasContentDisplayColumnFiltering: !!contentDisplayPreference?.enableColumnFiltering,\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 if (dialogPreviouslyOpen.current) {\n triggerRef.current?.focus();\n }\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 const tableComponentContext = useTableComponentsContext();\n\n useEffect(() => {\n if (tableComponentContext?.preferencesRef?.current) {\n tableComponentContext.preferencesRef.current.pageSize = preferences?.pageSize;\n\n // When both are used contentDisplayPreference takes preference and so we always prefer to use this as our visible columns if available\n if (preferences?.contentDisplay) {\n tableComponentContext.preferencesRef.current.visibleColumns = preferences?.contentDisplay\n .filter(column => column.visible)\n .map(column => column.id);\n } else if (preferences?.visibleContent) {\n tableComponentContext.preferencesRef.current.visibleColumns = [...preferences.visibleContent];\n }\n\n return () => {\n delete tableComponentContext.preferencesRef.current?.pageSize;\n delete tableComponentContext.preferencesRef.current?.visibleColumns;\n };\n }\n }, [\n tableComponentContext?.preferencesRef,\n preferences?.contentDisplay,\n preferences?.visibleContent,\n preferences?.pageSize,\n ]);\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={closeAriaLabel || cancelLabel}\n size={hasContentOnTheLeft && hasContentOnTheRight ? 'large' : 'medium'}\n onDismiss={onCancelListener}\n >\n {/* Content before */}\n <div className={styles['content-before']}>{contentBefore}</div>\n\n {/* Preferences content */}\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","sourceR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com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n'use client';\nimport React, { useContext, useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId, 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 { useTableComponentsContext } from '../internal/context/table-component-context';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport useBaseComponent from '../internal/hooks/use-base-component';\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 collectVisibleIds,\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 closeAriaLabel,\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 contentBefore,\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 hasContentDisplayColumnFiltering: !!contentDisplayPreference?.enableColumnFiltering,\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 if (dialogPreviouslyOpen.current) {\n triggerRef.current?.focus();\n }\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 const tableComponentContext = useTableComponentsContext();\n\n useEffect(() => {\n if (tableComponentContext?.preferencesRef?.current) {\n tableComponentContext.preferencesRef.current.pageSize = preferences?.pageSize;\n\n // When both are used contentDisplayPreference takes preference and so we always prefer to use this as our visible columns if available\n if (preferences?.contentDisplay) {\n tableComponentContext.preferencesRef.current.visibleColumns = collectVisibleIds(\n preferences.contentDisplay,\n true\n );\n } else if (preferences?.visibleContent) {\n tableComponentContext.preferencesRef.current.visibleColumns = [...preferences.visibleContent];\n }\n\n return () => {\n delete tableComponentContext.preferencesRef.current?.pageSize;\n delete tableComponentContext.preferencesRef.current?.visibleColumns;\n };\n }\n }, [\n tableComponentContext?.preferencesRef,\n preferences?.contentDisplay,\n preferences?.visibleContent,\n preferences?.pageSize,\n ]);\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={closeAriaLabel || cancelLabel}\n size={hasContentOnTheLeft && hasContentOnTheRight ? 'large' : 'medium'}\n onDismiss={onCancelListener}\n >\n {/* Content before */}\n <div className={styles['content-before']}>{contentBefore}</div>\n\n {/* Preferences content */}\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"]}
@@ -106,6 +106,9 @@ export interface CollectionPreferencesProps<CustomPreferenceType = any> extends
106
106
  * - `title` (string) - Specifies the text displayed at the top of the preference.
107
107
  * - `description` (string) - Specifies the description displayed below the title.
108
108
  * - `options` - Specifies an array of options for reordering and visible content selection.
109
+ * - `groups` - (Optional) Specifies an array of column group definitions for multi-level content display. Each group contains:
110
+ * - `id` (string) - A unique identifier for the group.
111
+ * - `label` (string) - The text displayed as the group label.
109
112
  * - `enableColumnFiltering` (boolean) - Adds a columns filter.
110
113
  * - `liveAnnouncementDndStarted` ((position: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when an option is picked.
111
114
  * - `liveAnnouncementDndDiscarded` (string) - (Optional) Adds a message to be announced by screen readers when a reordering action is canceled.
@@ -113,6 +116,7 @@ export interface CollectionPreferencesProps<CustomPreferenceType = any> extends
113
116
  * - `liveAnnouncementDndItemCommitted` ((initialPosition: number, finalPosition: number, total: number) => string) - (Optional) Adds a message to be announced by screen readers when a reordering action is committed.
114
117
  * - `dragHandleAriaDescription` (string) - (Optional) Adds an ARIA description for the drag handle.
115
118
  * - `dragHandleAriaLabel` (string) - (Optional) Adds an ARIA label for the drag handle.
119
+ * - `liveAnnouncementDndGroupLabel` ((label: string, count: number) => string) - (Optional) Adds a label for a group item to be announced by screen readers during drag and drop operations.
116
120
  *
117
121
  * Each option contains the following:
118
122
  * - `id` (string) - Corresponds to a table column `id`.
@@ -120,6 +124,16 @@ export interface CollectionPreferencesProps<CustomPreferenceType = any> extends
120
124
  * - `alwaysVisible` (boolean) - (Optional) Determines whether the visibility is always on and therefore cannot be toggled. This is set to `false` by default.
121
125
  *
122
126
  * You must provide an ordered list of the items to display in the `preferences.contentDisplay` property.
127
+ * Each content display item is one of the following:
128
+ * - `ContentDisplayColumn` - Represents a single column.
129
+ * - `type` ('column') - (Optional) Identifies the entry as a column. Defaults to `'column'` when omitted.
130
+ * - `id` (string) - The column identifier.
131
+ * - `visible` (boolean) - Whether the column is visible.
132
+ * - `ContentDisplayGroup` - Represents a column group.
133
+ * - `type` ('group') - Identifies the entry as a group.
134
+ * - `id` (string) - The group identifier.
135
+ * - `visible` (boolean) - Whether the group is visible.
136
+ * - `children` (ReadonlyArray<ContentDisplayItem>) - The columns or nested groups within this group.
123
137
  * @i18n
124
138
  */
125
139
  contentDisplayPreference?: CollectionPreferencesProps.ContentDisplayPreference;
@@ -221,17 +235,31 @@ export declare namespace CollectionPreferencesProps {
221
235
  title?: string;
222
236
  description?: string;
223
237
  options: ReadonlyArray<CollectionPreferencesProps.ContentDisplayOption>;
238
+ groups?: ReadonlyArray<CollectionPreferencesProps.ContentDisplayOptionGroup>;
224
239
  enableColumnFiltering?: boolean;
225
240
  i18nStrings?: ContentDisplayPreferenceI18nStrings;
241
+ liveAnnouncementDndGroupLabel?: (label: string, count: number) => string;
226
242
  }
243
+ export interface ContentDisplayColumn {
244
+ type?: 'column';
245
+ id: string;
246
+ visible: boolean;
247
+ }
248
+ export interface ContentDisplayGroup {
249
+ type: 'group';
250
+ id: string;
251
+ visible: boolean;
252
+ children: ReadonlyArray<ContentDisplayItem>;
253
+ }
254
+ export type ContentDisplayItem = ContentDisplayColumn | ContentDisplayGroup;
227
255
  export interface ContentDisplayOption {
228
256
  id: string;
229
257
  label: string;
230
258
  alwaysVisible?: boolean;
231
259
  }
232
- export interface ContentDisplayItem {
260
+ export interface ContentDisplayOptionGroup {
233
261
  id: string;
234
- visible: boolean;
262
+ label: string;
235
263
  }
236
264
  export interface VisibleContentPreference {
237
265
  title: string;
@@ -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,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAA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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,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,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;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;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;IACH,qBAAqB,CAAC,EAAE,0BAA0B,CAAC,qBAAqB,CAAC;IACzE;;;;;;;;;;;OAWG;IACH,wBA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AM,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 +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 { SortableAreaProps } from '../internal/components/sortable-area';\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 * Adds an aria-label to the close button, for accessibility.\n * @i18n\n */\n closeAriaLabel?: 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 * Content displayed before the preferences. Use it to display additional information relating to the preferences.\n */\n contentBefore?: React.ReactNode;\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 extends SortableAreaProps.DndAreaI18nStrings {\n title?: string;\n description?: string;\n options: ReadonlyArray<CollectionPreferencesProps.ContentDisplayOption>;\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 { SortableAreaProps } from '../internal/components/sortable-area';\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 * Adds an aria-label to the close button, for accessibility.\n * @i18n\n */\n closeAriaLabel?: 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 * - `groups` - (Optional) Specifies an array of column group definitions for multi-level content display. Each group contains:\n * - `id` (string) - A unique identifier for the group.\n * - `label` (string) - The text displayed as the group label.\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 * - `liveAnnouncementDndGroupLabel` ((label: string, count: number) => string) - (Optional) Adds a label for a group item to be announced by screen readers during drag and drop operations.\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 * Each content display item is one of the following:\n * - `ContentDisplayColumn` - Represents a single column.\n * - `type` ('column') - (Optional) Identifies the entry as a column. Defaults to `'column'` when omitted.\n * - `id` (string) - The column identifier.\n * - `visible` (boolean) - Whether the column is visible.\n * - `ContentDisplayGroup` - Represents a column group.\n * - `type` ('group') - Identifies the entry as a group.\n * - `id` (string) - The group identifier.\n * - `visible` (boolean) - Whether the group is visible.\n * - `children` (ReadonlyArray<ContentDisplayItem>) - The columns or nested groups within this group.\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 * Content displayed before the preferences. Use it to display additional information relating to the preferences.\n */\n contentBefore?: React.ReactNode;\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 extends SortableAreaProps.DndAreaI18nStrings {\n title?: string;\n description?: string;\n options: ReadonlyArray<CollectionPreferencesProps.ContentDisplayOption>;\n groups?: ReadonlyArray<CollectionPreferencesProps.ContentDisplayOptionGroup>;\n enableColumnFiltering?: boolean;\n i18nStrings?: ContentDisplayPreferenceI18nStrings;\n liveAnnouncementDndGroupLabel?: (label: string, count: number) => string;\n }\n\n export interface ContentDisplayColumn {\n type?: 'column';\n id: string;\n visible: boolean;\n }\n\n export interface ContentDisplayGroup {\n type: 'group';\n id: string;\n visible: boolean;\n children: ReadonlyArray<ContentDisplayItem>;\n }\n\n export type ContentDisplayItem = ContentDisplayColumn | ContentDisplayGroup;\n\n export interface ContentDisplayOption {\n id: string;\n label: string;\n alwaysVisible?: boolean;\n }\n\n export interface ContentDisplayOptionGroup {\n id: string;\n label: string;\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"]}