From aae292ca419291cd76a4d7f6a57c7b204a465658 Mon Sep 17 00:00:00 2001 From: Artem Tarasov Date: Fri, 17 Jul 2020 15:16:14 +0300 Subject: [PATCH] added PropTypes --- .../src/components/file-input/README.md | 6 +++--- .../src/components/file-input/index.js | 21 +++++++++++++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/web/ASC.Web.Components/src/components/file-input/README.md b/web/ASC.Web.Components/src/components/file-input/README.md index 7a45eb086f..04b0eefc8b 100644 --- a/web/ASC.Web.Components/src/components/file-input/README.md +++ b/web/ASC.Web.Components/src/components/file-input/README.md @@ -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 | diff --git a/web/ASC.Web.Components/src/components/file-input/index.js b/web/ASC.Web.Components/src/components/file-input/index.js index cefa81f702..11b9894304 100644 --- a/web/ASC.Web.Components/src/components/file-input/index.js +++ b/web/ASC.Web.Components/src/components/file-input/index.js @@ -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; \ No newline at end of file