diff --git a/source/components/button-upload/button-upload-component.js b/source/components/button-upload/button-upload-component.js index 2888550de..5437e641a 100644 --- a/source/components/button-upload/button-upload-component.js +++ b/source/components/button-upload/button-upload-component.js @@ -2,6 +2,8 @@ import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import CSSModules from 'react-css-modules'; +import { omit } from 'helpers'; + import Button from '../button'; import Icon from '../icon'; @@ -57,10 +59,15 @@ class ButtonUpload extends PureComponent { fileValidation(file) { const { formatWhiteList, maxFileSize } = this.props; const extension = file.name.split('.').pop(); - return { - valid: formatWhiteList.includes(`.${extension}`) && file.size <= maxFileSize, + const validation = { validFormat: formatWhiteList.includes(`.${extension}`), validSize: file.size <= maxFileSize, + hasNoRepeat: !this.state.list.filter(currentFile => currentFile.name === file.name).length, + }; + + return { + ...validation, + valid: validation.validFormat && validation.validSize && validation.hasNoRepeat, }; } @@ -116,7 +123,7 @@ class ButtonUpload extends PureComponent { const hasMaxFiles = this.state.list.length === limit; return ( -
+
diff --git a/source/components/select/elements/select-option.js b/source/components/select/elements/select-option.js index d00f8f31e..046278e1c 100644 --- a/source/components/select/elements/select-option.js +++ b/source/components/select/elements/select-option.js @@ -29,6 +29,7 @@ SelectOption.propTypes = { onSelect: PropTypes.func, selected: PropTypes.bool, children: PropTypes.oneOfType([PropTypes.string, PropTypes.element]), + noCurrentValue: PropTypes.bool, }; export default SelectOption; diff --git a/source/components/select/select-component.js b/source/components/select/select-component.js index fc71f90e3..87262ea11 100644 --- a/source/components/select/select-component.js +++ b/source/components/select/select-component.js @@ -46,6 +46,7 @@ class Select extends Component { sortItems: PropTypes.bool, isMobile: PropTypes.bool, active: PropTypes.bool, + noCurrentValue: PropTypes.bool, }; static defaultProps = { @@ -277,7 +278,7 @@ class Select extends Component { selected={selectedValue === option.value} onSelect={this.onSelectItem} value={option.value} - noneValue={noCurrentValue && selectedValue === option.value} + noCurrentValue={noCurrentValue && selectedValue === option.value} > {option.name} diff --git a/source/components/select/select.stories.js b/source/components/select/select.stories.js index ba9866641..1c933951f 100644 --- a/source/components/select/select.stories.js +++ b/source/components/select/select.stories.js @@ -84,7 +84,7 @@ stories.add('Select disabled', () => { ); }); -stories.add('Select - None atual value', () => { +stories.add('Select - No Current Value', () => { return (