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

feat: implement MultiSelect component #1606

Merged

Conversation

HellWolf93
Copy link
Collaborator

fix: #1562

Changes proposed in this PR:

@commit-lint
Copy link

commit-lint bot commented Jun 4, 2020

Features

  • implement MultiSelect component (3c095c4)

Bug Fixes

  • refactor MultiSelect according to comments (bd63ca3)
  • add more tests to MultiSelect component (8fac4b7)
  • add children prop to index.d.ts (10be946)
  • onChange callback param (7211d21)
  • improve MultiSelect docs (41a3bd3)
  • export MultiSelect from global index.d.ts (1e22381)
  • MultiSelect value type (a60cd4f)
  • split tests in 2 test cases (8d61bb6)
  • use functional programming only (58d015c)
  • improve pageObject selector specificity (415a988)
  • several issues with focus and key handling (60c3d2b)
  • remove unused useEffect (6d5e09d)
  • normalizeValue returning itemValue instead of value (7d9482b)
  • MultiSelect keeping focus when TAB key pressed (031a923)
  • lint error (3933f1d)

Contributors

@HellWolf93, @TahimiLeonBravo, @LeandroTorresSicilia

Commit-Lint commands

You can trigger Commit-Lint actions by commenting on this PR:

  • @Commit-Lint merge patch will merge dependabot PR on "patch" versions (X.X.Y - Y change)
  • @Commit-Lint merge minor will merge dependabot PR on "minor" versions (X.Y.Y - Y change)
  • @Commit-Lint merge major will merge dependabot PR on "major" versions (Y.Y.Y - Y change)
  • @Commit-Lint merge disable will desactivate merge dependabot PR
  • @Commit-Lint review will approve dependabot PR
  • @Commit-Lint stop review will stop approve dependabot PR

return (
<StyledContainer className={className} style={style}>
<Label label={label} hideLabel={hideLabel} required={required} inputId={inputId} />
<StyledInput
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remember we have to follow the accessibility standards and since this component will be used on forms it needs to be an inputable.
Also, It needs to work with redux-form.
We need to review the w3c accessibility standards here in order to use the right HTML elements and attributes.

Copy link
Contributor

Choose a reason for hiding this comment

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

@TahimiLeonBravo I have a question about the operation. This component will allow the input to be a filter and when the keyprees delete key the options are deleted

src/components/MultiSelect/readme.md Show resolved Hide resolved
src/components/MultiSelect/icons/plus.js Outdated Show resolved Hide resolved
src/components/MultiSelect/helpers/getChips.js Outdated Show resolved Hide resolved
src/components/MultiSelect/styled/index.js Outdated Show resolved Hide resolved
src/components/MultiSelect/readme.md Outdated Show resolved Hide resolved
Comment on lines +102 to +105
const [startListeningOutsideClick, stopListeningOutsideClick] = useOutsideClick(
dropdownRef,
handleOutsideClick,
);
Copy link
Contributor

Choose a reason for hiding this comment

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

@LeandroTorresSicilia @TahimiLeonBravo I think we should fix this hook with Rey's suggestion, before we continue using it.

return (
<StyledContainer className={className} style={style}>
<Label label={label} hideLabel={hideLabel} required={required} inputId={inputId} />
<StyledInput
Copy link
Contributor

Choose a reason for hiding this comment

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

@TahimiLeonBravo I have a question about the operation. This component will allow the input to be a filter and when the keyprees delete key the options are deleted

@@ -73,6 +73,7 @@ const InternalDropdown = forwardRef((props, reference) => {
}
return containerRef.current.focus();
},
contains: element => containerRef.current.contains(element),

Choose a reason for hiding this comment

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

Remember we need to be careful in what we expose here.
In this case why we need this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is needed in useOutsideClick hook, otherwise throws the error 'ref.current.contains' is not a function, it is used there to check if the target of the click event is a descendant of the element being rendered by the InternalOverlay component

@LeandroTorresSicilia
Copy link
Member

  • when selecting an option with the keyboard it does not close the menu.
  • the menu should close when pressing ESC and return focus to trigger element (like in the Picklist)

@LeandroTorresSicilia LeandroTorresSicilia merged commit 735cf39 into nexxtway:master Jun 21, 2020
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.

feat: implement MultiSelect component
4 participants