feat: add standalone content display preference component#4805
Draft
ernst-dev wants to merge 1 commit into
Draft
feat: add standalone content display preference component#4805ernst-dev wants to merge 1 commit into
ernst-dev wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Exposes the content-display preference control (drag-and-drop column reordering + visibility toggles, optional column filtering and grouping) as a standalone
ContentDisplayPreferencecomponent, usable outside theCollectionPreferencesmodal.Unlike
CollectionPreferences, the standalone component is fully controlled and emits anonChangeevent immediately on every reorder/toggle (no confirm step). This lets consumers react to selection before submission — e.g. enforce a maximum number of visible columns, which is the motivating use case in the linked request.The implementation reuses the existing internal content-display renderer (
src/collection-preferences/content-display) rather than duplicating it.CollectionPreferencescontinues to render the same shared core unchanged, so its behavior and public API are unaffected.Changes:
src/content-display-preference/(index.tsx,internal.tsx,interfaces.ts,styles.scss).ContentDisplayPreferencePropsreuses the shared content-display item/option/i18n types fromCollectionPreferencesPropsto stay in sync.src/test-utils/dom/content-display-preference) extending the existing content-display wrapper.build-tools/utils/pluralize.js).pages/content-display-preference/simple.page.tsx) demonstrating the "max visible columns" reactive use case.Related links, issue #, if available: AWSUI-60078
How has this been tested?
npm run quick-build— green.eslint+stylelinton the new/changed files — green.onChangeon toggle & keyboard reorder,alwaysVisible, column filtering, groups, and base-component API) — all pass.collection-preferences/content-displayunit tests (56) — still pass (shared core untouched).Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md.CONTRIBUTING.md.Security
checkSafeUrlfunction.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.