Skip to content
  • Tor Raswill's avatar
    feat: add file input component (#5036) · 724ea6f7
    Tor Raswill authored
    
    
    * #3047 add file input component
    
    A file input component that also supports the custom prop.
    
    Adds FormFile,  FormFileInput, FormFileLabel
    
    Adds types
    
    Updates docs
    
    * #3047 remove bs-custom-file-input script
    
    remove bs-custom-file-input script and import, remove useEffect since it is not used in FormFile for anything else.
    
    * #3047 rename buttontext
    
    rename buttontext to buttonText
    
    * #3047 update docs
    
    Update docs with how to customize the inner markup
    
    * #3047 fix missed case for buttonText
    
    * #3047 Update FileApi.js
    
    Update FileApi.js with more comprehensive example
    
    * #3047 add lang prop
    
    The lang prop allows translating the Browse button text via SCSS as per the bootstrap documentation.
    
    Add types and docs
    
    * Update FileApi.js
    
    fix conflicting Ids for elements
    
    * #3047 Update forms.js
    
    Update docs with
    * recommended script for managing visible output of FormFile custom
    * Better readability of FormFile docs when customizing the output
    
    * #3047 Create FormFileSpec.js
    
    Added test for FormFile
    
    * #3047 removed buttonText prop
    
    This commit removes the buttonText prop, the types for it and the test.
    
    Instead it forwards the data-browse attribute to the underlying components.
    
    Updates docs.
    
    This is to be more uniform with TWBS.
    
    * #3047 fix types
    
    Added simple type test and added File to Form.d.ts
    
    * Update simple.test.tsx
    
    Fix lint/prettier error after removing ignore line from docs
    
    * #3047 fix conflicting ID's
    
    * #3047 FormFile docs
    
    Updated to make sure that
    * The example in the API for the "customizing" version" docs prints Input before Label since custom is not set
    * Updates the description for the data-browse attribute
    * Adds queries for the API docs for FormFile, FormFileInput and FormFileLabel
    
    * Update FormFile.js
    
    Add error for data-browse if custom is not set
    
    * Add test for data-browse and typescript ref
    
    * Added test for data-browse attribute
    * Add FormFile to types export
    * Add FormFile ref test to simple.test.tsx
    
    * Clean up innerRefs
    
    Per comments from @bpas247
    
    * Update FormFile.js
    
    Update the description printed in the API section
    
    * Update FormFile.js
    
    * add inputAs with desc
    * rewrite as with new desc
    * add type def to data-browse
    * set form-file as default class instead of form-group when not setting custom
    * use as like in other components to create wrapping div
    
    * Rename FileButtonTextSCSS
    
    rename one to incorrect since MacOS does not carer about casing in filenames
    
    * Rename FileButtonTextScss
    
    Rename it to its correct name, update imports and references
    
    * Update FormFileSpec.js
    
    Update tests to
    * test changed class
    * test inputAs
    * test as with another element type
    
    Co-authored-by: default avatarTor Raswill <tor.raswill@dqc.se>
    724ea6f7