added PropTypes

This commit is contained in:
Artem Tarasov 2020-07-17 15:16:14 +03:00
parent 121a00f330
commit aae292ca41
2 changed files with 22 additions and 5 deletions

View File

@ -25,14 +25,14 @@ import { FileInput } from "asc-web-components";
| Props | Type | Required | Values | Default | Description |
| ---------------- | :------------: | :------: | :--------------------------------------: | :-----: | ------------------------------------------------------------------------------------------------------ |
| `className` | `string` | - | - | - | Accepts class |
| `hasError` | `bool` | - | - | - | Indicates the input field has an error |
| `hasWarning` | `bool` | - | - | - | Indicates the input field has a warning |
| `hasError` | `bool` | - | - | `false` | Indicates the input field has an error |
| `hasWarning` | `bool` | - | - | `false` | Indicates the input field has a warning |
| `id` | `string` | - | - | - | Used as HTML `id` property |
| `isDisabled` | `bool` | - | - | `false` | Indicates that the field cannot be used (e.g not authorised, or changes not saved) |
| `name` | `string` | - | - | - | Used as HTML `name` property |
| `onInput` | `func` | - | - | - | Called when a file is selected |
| `placeholder` | `string` | - | - | - | Placeholder text for the input |
| `scale` | `bool` | - | - | - | Indicates the input field has scale |
| `scale` | `bool` | - | - | `false` | Indicates the input field has scale |
| `size` | `string` | - | `base`, `middle`, `big`, `huge`, `large` | `base` | Supported size of the input fields. |
| `style` | `obj`, `array` | - | - | - | Accepts css style |
| `accept` | `string` | - | - | - | Specifies files visible for upload |

View File

@ -192,8 +192,25 @@ class FileInput extends Component {
FileInput.propTypes = {
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
placeholder: PropTypes.string,
size: PropTypes.string,
scale: PropTypes.bool
size: PropTypes.oneOf(['base', 'middle', 'big', 'huge', 'large']),
scale: PropTypes.bool,
className: PropTypes.string,
hasError: PropTypes.bool,
hasWarning: PropTypes.bool,
id: PropTypes.string,
isDisabled: PropTypes.bool,
name: PropTypes.string,
onInput: PropTypes.func,
accept: PropTypes.string
};
FileInput.defaultProps = {
size: 'base',
scale: false,
hasWarning: false,
hasError: false,
isDisabled: false,
accept: ''
}
export default FileInput;