Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FCT 1187 - enable filter selection in filters #2971

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

ByronDWall
Copy link
Contributor

@ByronDWall ByronDWall commented Oct 18, 2024

This PR implements the Filters component and accompanying documentation and tests. These changes collectively improve the flexibility, functionality, and maintainability of the filters component package.

  • Updates the filters component so that it displays all active filters and allows for adding and removing filters.
  • Adds a defaultOpen prop to filters so that the filters list can mount on the first render.
  • Ensures that a filter with no selected values is removed from the filters list.
  • Updates the filterMenu component so that the menu opens when a new filter is added to the menu.
  • Updates the filterMenu component to insure that all menus have a max height of constraint10.
  • Updates the filterMenu body to scroll if the component rendered in the menu body exceeds the available height.
  • Updates the add filters select menu options container so that the text input will be fixed, and the options menu will scroll if the options exceed the available height.
  • Adds fixtures files to declare inputs and constants for use throughout documentation, storybook, and tests.
  • Implements additional unit tests for filters and filterMenu
  • Implements test helpers for filters
  • Implements visual regression tests for various open/closed states of the filters menu
  • Implements the storybook for filters in such a way that it provides a comprehensive example of the component's functionality, by allowing the user to control a specific filter menu with custom controls.
  • Updates the filters jsdoc props to be more concise and informative.
  • Updates docs/description.md to add a brief description of filters and the purpose of its core props.
  • Updates docs/usage-example.js to have a thoroughly commented example of how to implement the component.
  • Updates the README to be more thorough in documenting usage and props.

@ByronDWall ByronDWall self-assigned this Oct 18, 2024
Copy link

changeset-bot bot commented Oct 18, 2024

🦋 Changeset detected

Latest commit: 0e4e544

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 98 packages
Name Type
@commercetools-uikit/filters Minor
@commercetools-frontend/ui-kit Minor
@commercetools-uikit/design-system Minor
@commercetools-uikit/calendar-time-utils Minor
@commercetools-uikit/calendar-utils Minor
@commercetools-uikit/hooks Minor
@commercetools-uikit/i18n Minor
@commercetools-uikit/localized-utils Minor
@commercetools-uikit/utils Minor
@commercetools-uikit/accessible-hidden Minor
@commercetools-uikit/avatar Minor
@commercetools-uikit/card Minor
@commercetools-uikit/collapsible-motion Minor
@commercetools-uikit/collapsible-panel Minor
@commercetools-uikit/collapsible Minor
@commercetools-uikit/constraints Minor
@commercetools-uikit/data-table-manager Minor
@commercetools-uikit/data-table Minor
@commercetools-uikit/field-errors Minor
@commercetools-uikit/field-label Minor
@commercetools-uikit/field-warnings Minor
@commercetools-uikit/grid Minor
@commercetools-uikit/icons Minor
@commercetools-uikit/label Minor
@commercetools-uikit/link Minor
@commercetools-uikit/loading-spinner Minor
@commercetools-uikit/messages Minor
@commercetools-uikit/notifications Minor
@commercetools-uikit/pagination Minor
@commercetools-uikit/primary-action-dropdown Minor
@commercetools-uikit/progress-bar Minor
@commercetools-uikit/quick-filters Minor
@commercetools-uikit/stamp Minor
@commercetools-uikit/tag Minor
@commercetools-uikit/text Minor
@commercetools-uikit/tooltip Minor
@commercetools-uikit/view-switcher Minor
@commercetools-uikit/accessible-button Minor
@commercetools-uikit/flat-button Minor
@commercetools-uikit/icon-button Minor
@commercetools-uikit/link-button Minor
@commercetools-uikit/primary-button Minor
@commercetools-uikit/secondary-button Minor
@commercetools-uikit/secondary-icon-button Minor
@commercetools-uikit/dropdown-menu Minor
@commercetools-uikit/async-creatable-select-field Minor
@commercetools-uikit/async-select-field Minor
@commercetools-uikit/creatable-select-field Minor
@commercetools-uikit/date-field Minor
@commercetools-uikit/date-range-field Minor
@commercetools-uikit/date-time-field Minor
@commercetools-uikit/localized-multiline-text-field Minor
@commercetools-uikit/localized-text-field Minor
@commercetools-uikit/money-field Minor
@commercetools-uikit/multiline-text-field Minor
@commercetools-uikit/number-field Minor
@commercetools-uikit/password-field Minor
@commercetools-uikit/radio-field Minor
@commercetools-uikit/search-select-field Minor
@commercetools-uikit/select-field Minor
@commercetools-uikit/text-field Minor
@commercetools-uikit/time-field Minor
@commercetools-uikit/async-creatable-select-input Minor
@commercetools-uikit/async-select-input Minor
@commercetools-uikit/checkbox-input Minor
@commercetools-uikit/creatable-select-input Minor
@commercetools-uikit/date-input Minor
@commercetools-uikit/date-range-input Minor
@commercetools-uikit/date-time-input Minor
@commercetools-uikit/input-utils Minor
@commercetools-uikit/localized-money-input Minor
@commercetools-uikit/localized-multiline-text-input Minor
@commercetools-uikit/localized-rich-text-input Minor
@commercetools-uikit/localized-text-input Minor
@commercetools-uikit/money-input Minor
@commercetools-uikit/multiline-text-input Minor
@commercetools-uikit/number-input Minor
@commercetools-uikit/password-input Minor
@commercetools-uikit/radio-input Minor
@commercetools-uikit/rich-text-input Minor
@commercetools-uikit/rich-text-utils Minor
@commercetools-uikit/search-select-input Minor
@commercetools-uikit/search-text-input Minor
@commercetools-uikit/select-input Minor
@commercetools-uikit/select-utils Minor
@commercetools-uikit/selectable-search-input Minor
@commercetools-uikit/text-input Minor
@commercetools-uikit/time-input Minor
@commercetools-uikit/toggle-input Minor
@commercetools-uikit/spacings-inline Minor
@commercetools-uikit/spacings-inset-squish Minor
@commercetools-uikit/spacings-inset Minor
@commercetools-uikit/spacings-stack Minor
@commercetools-uikit/buttons Minor
@commercetools-uikit/fields Minor
@commercetools-uikit/inputs Minor
@commercetools-uikit/spacings Minor
visual-testing-app Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Oct 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ui-kit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2024 2:43pm

@ByronDWall ByronDWall marked this pull request as ready for review November 4, 2024 18:59
@ByronDWall ByronDWall requested a review from a team as a code owner November 4, 2024 18:59
@ByronDWall ByronDWall requested review from stephsprinkle, jaikamat, ddouglasz, tylermorrisford, misama-ct and FilPob and removed request for a team November 4, 2024 18:59
<Popover.Root defaultOpen={props.isDisabled ? false : props.defaultOpen}>
<Popover.Root
defaultOpen={props.isDisabled ? false : props.defaultOpen}
onOpenChange={(open) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This removes the filter from being visible in the filters list if the menu is closed and no values have been selected

control: false,
},
onClearAllRequest: {
control: false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no point in showing a control to type in a function, since the text gets escaped by storybook, so the function wouldnt work.

ByronDWall and others added 17 commits November 5, 2024 10:54
…s are handled by the 'add filters' select input
…o find them in tests, add aria-label to ul containing filter chips in TriggerButton for a11y/easier test targeting, add more complete tests for Footer, TriggerButton, and FilterMenu
…dix dialog to find filter inputs instead of looking for combobox in filters.spec.tsx
…ok controls to allow user to play around with controlling a filter menu, change type for renderSearchComponent prop to ReactNode in filters.tsx
…rappers when parent of custom select menu to allow the select input's options menu to scroll, add max-height to filter-menu dropdowns, update usage example to be more readable and add comments, update story to open filters by default so user doesn't have to click on the filters button to see the list, add filters-with-state fixture for use in VRT, add defaultOpen prop to filters so that the filters list can mount on first render, add VRTs for various open/closed states
* feat(filters): implement filters selection tests, add test helpers

* feat(vrt): only defaultOpen a filterMenu if it isnt persisted and there are more locally visible filters than there are visible filters from props

---------

Co-authored-by: Byron Wall <byron.wall@commercetools.com>
Copy link
Contributor

@ddouglasz ddouglasz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All came together nicely 👏
Thank you for all the work put in on the filters 🙌🏽

Comment on lines +125 to +126
aria-label={`${filterKey} selected values`}
aria-live="polite"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Copy link
Contributor

@misama-ct misama-ct left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful result, can't wait to see it in action. Thanks to everyone who worked on it 🙇 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants