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 FileSelector component #1507

Closed
26 tasks
TahimiLeonBravo opened this issue Apr 28, 2020 · 0 comments · Fixed by #1516
Closed
26 tasks

feat: implement FileSelector component #1507

TahimiLeonBravo opened this issue Apr 28, 2020 · 0 comments · Fixed by #1516

Comments

@TahimiLeonBravo
Copy link
Collaborator

TahimiLeonBravo commented Apr 28, 2020

  • define API
  • Implement component
  • add unit and integration tests
Define API

https://docs.google.com/document/d/1U2uJ6BVtBmRVD-n3vQ9m6LjvkF_9ZmYgSI70fZ8Mbow/edit?usp=sharing

Design

https://zpl.io/brZAy4e

Requirements
  • It should accept the same attributes of the native input
  • It should be work with redux-form
  • It only should accept select or drag & drop files, not other elements.
  • It only should allow select files, it not is possible to initialize your state with selected elements.
Unit test specs
fileSelector
  • should render an input with type file
  • should set the same generated value to the label htmlFor and the input id
  • should set the tabIndex passed in the input element
  • should set disabled in the input element if it is passed
  • should set required in the input element if it is passed
  • should pass a generated id to the error element and set the same id to the aria-describedby for the input when a error is passed
  • should pass the right props to the Label component
  • should render HelpText when bottomHelpText is passed
  • should fire change event when a file is picked
  • should fire focus event
  • should fire blur event
getText
  • should return placeholder when files is not defined
  • should return placeholder when files is an empty array
  • should return the name of the file when files has only one item
  • should return a string with the length of files
containsFiles
  • should return false when there is types different than "Files"
  • should return false when types array is empty
  • should return false when types array is undefined
  • should return true when all types are "Files"
@TahimiLeonBravo TahimiLeonBravo created this issue from a note in React Rainbow Components (To do (defined)) Apr 28, 2020
@TahimiLeonBravo TahimiLeonBravo moved this from To do (defined) to In progress in React Rainbow Components Apr 30, 2020
HellWolf93 added a commit to HellWolf93/react-rainbow that referenced this issue May 2, 2020
React Rainbow Components automation moved this from In progress to QA May 11, 2020
LeandroTorresSicilia added a commit that referenced this issue May 11, 2020
* feat: implement FileSelector component

fix: #1507

* fix: import FocusEvent from react types definition

* fix: export useReduxForm from global hooks

* fix: move getIcon and getText to helpers

* fix: remove StyledInput and use HiddenElement instead

* fix: update FileSelector component to comply with comments

* fix: pass aria props to input

* fix: add edge case to containsFiles when array is empty or undefined

* test: add tests to FileSelector component

* fix: type declarations

* fix: change length for exists

* fix: change variant normal for multiline

* fix: use native file input

* fix: send FileList instead of array on cancel

* fix: update onChange parameter type to FileList

Co-authored-by: Jose Leandro Torres <jtorressicilia@gmail.com>
@TahimiLeonBravo TahimiLeonBravo moved this from QA to Done in React Rainbow Components May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

3 participants