├── .babelrc ├── .eslintrc.json ├── .flowconfig ├── .gitignore ├── .npmignore ├── .travis.yml ├── LICENSE ├── README.md ├── bundle ├── 1.react-material-ui-form.min.js └── react-material-ui-form.min.js ├── dist ├── components │ ├── CheckableFieldClone.js │ ├── DeleteFieldRowButton.js │ ├── FieldClone.js │ ├── Form.js │ ├── FormControlClone.js │ └── FormControlLabelClone.js ├── index.js ├── propNames.js └── validation │ ├── constants.js │ ├── index.js │ ├── messageMap.js │ └── validators │ ├── index.js │ ├── isAlias.js │ ├── isDate.js │ ├── isNumber.js │ ├── isRequired.js │ ├── isSerial.js │ ├── isSize.js │ └── isTime.js ├── examples ├── Root.js ├── index.html ├── markdown.css ├── pages │ ├── CustomValidateFunction.js │ ├── CustomValidationMessages.js │ ├── CustomValidators.js │ ├── DynamicArrayFields.js │ ├── MiscProps.js │ ├── NestedFields.js │ └── Steppers.js ├── styles.css └── styles.js ├── package-lock.json ├── package.json ├── setupTests.js ├── src ├── components │ ├── CheckableFieldClone.js │ ├── DeleteFieldRowButton.js │ ├── FieldClone.js │ ├── Form.js │ ├── FormControlClone.js │ ├── FormControlLabelClone.js │ └── __tests__ │ │ ├── CheckableFieldClone.test.js │ │ ├── FieldClone.test.js │ │ ├── Form.test.js │ │ ├── FormControlClone.test.js │ │ ├── FormControlLabelClone.test.js │ │ └── __snapshots__ │ │ ├── CheckableFieldClone.test.js.snap │ │ ├── FieldClone.test.js.snap │ │ ├── Form.test.js.snap │ │ ├── FormControlClone.test.js.snap │ │ └── FormControlLabelClone.test.js.snap ├── index.js ├── propNames.js └── validation │ ├── __tests__ │ └── index.test.js │ ├── constants.js │ ├── index.js │ ├── messageMap.js │ └── validators │ ├── __tests__ │ ├── isAlias.test.js │ ├── isDate.test.js │ ├── isNumber.test.js │ ├── isRequired.test.js │ ├── isSerial.test.js │ ├── isSize.test.js │ └── isTime.test.js │ ├── index.js │ ├── isAlias.js │ ├── isDate.js │ ├── isNumber.js │ ├── isRequired.js │ ├── isSerial.js │ ├── isSize.js │ └── isTime.js ├── tools └── windows-safe-jest.js └── webpack.config.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["env", "flow", "react", "stage-0"], 3 | "plugins": ["transform-decorators-legacy"], 4 | "env": { 5 | "production": { 6 | "ignore": [ 7 | "**/__tests__" 8 | ] 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "extends": [ 4 | "airbnb", 5 | "plugin:import/errors", 6 | "plugin:import/warnings" 7 | ], 8 | "parser": "babel-eslint", 9 | "env": { 10 | "amd": true, 11 | "browser": true, 12 | "commonjs": true, 13 | "es6": true, 14 | "node": true 15 | }, 16 | "parserOptions": { 17 | "ecmaVersion": 6, 18 | "sourceType": "module", 19 | "codeFrame": true, 20 | "ecmaFeatures": { 21 | "jsx": true 22 | } 23 | }, 24 | "plugins": [ 25 | "react", 26 | "jsx-a11y", 27 | "import", 28 | "filenames" 29 | ], 30 | "rules": { 31 | "class-methods-use-this": 0, 32 | "comma-dangle": [2, "always-multiline"], 33 | "constructor-super": 1, 34 | "eol-last": [2, "always"], 35 | "filenames/match-exported": [2, [null]], 36 | "function-paren-newline": [2, "consistent"], 37 | "import/default": 2, 38 | "import/export": 2, 39 | "import/extensions": 0, 40 | "import/named": 2, 41 | "import/namespace": 2, 42 | "import/no-unresolved": 1, 43 | "import/prefer-default-export": 0, 44 | "import/unambiguous": 0, 45 | "indent": [2, 2], 46 | "jsx-a11y/anchor-is-valid": 0, 47 | "linebreak-style": [2, "unix"], 48 | "max-len": [1, { 49 | "code": 85, 50 | "ignoreComments": true, 51 | "tabWidth": 2, 52 | "ignoreRegExpLiterals": true 53 | }], 54 | "no-await-in-loop": 1, 55 | "no-const-assign": 1, 56 | "no-continue": 1, 57 | "no-multi-str": 0, 58 | "no-param-reassign": 0, 59 | "no-plusplus": [0, { "allowForLoopAfterthoughts": true }], 60 | "no-restricted-syntax": [2, "BinaryExpression[operator='of']"], 61 | "no-this-before-super": 1, 62 | "no-undef": 1, 63 | "no-underscore-dangle": 0, 64 | "no-unreachable": 1, 65 | "no-unused-expressions": 1, 66 | "no-unused-vars": [1, { "argsIgnorePattern": "^_" }], 67 | "object-curly-newline": [2, { "minProperties": 5, "consistent": true }], 68 | "prefer-template": 0, 69 | "quotes": [2, "single"], 70 | "react/forbid-prop-types": [2, { "forbid": ["any"] }], 71 | "react/forbid-prop-types": [2, { "forbid": ["any"]}], 72 | "react/jsx-filename-extension": 0, 73 | "react/jsx-indent": [2, 2], 74 | "react/jsx-indent-props": [2, 2], 75 | "react/jsx-no-bind": 0, 76 | "react/jsx-wrap-multilines": 1, 77 | "react/no-multi-comp": 0, 78 | "react/prefer-stateless-function": 1, 79 | "semi": 0, 80 | "space-in-parens": 0 81 | }, 82 | "globals": { 83 | "_": true, 84 | "describe": true, 85 | "expect": true, 86 | "it": true, 87 | "jest": true, 88 | "SyntheticInputEvent": true 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | .*/node_modules/webpack-cli/.* 3 | 4 | [include] 5 | 6 | [libs] 7 | 8 | [lints] 9 | 10 | [options] 11 | 12 | [strict] 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | *.sublime-project 3 | *.sublime-workspace 4 | *~ 5 | .DS_Store 6 | .vscode 7 | coverage 8 | logs 9 | node_modules 10 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .babelrc 2 | .travis.yml 3 | __tests__ 4 | __snapshots__ 5 | bundle 6 | eslintrc.json 7 | examples 8 | setupTests.js 9 | src 10 | webpack.config.js 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "stable" 4 | install: 5 | - npm install -g codecov 6 | - npm install 7 | after_success: 8 | - codecov 9 | notifications: 10 | email: false 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Swaroop 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### react-material-ui-form 2 | 3 | [](https://opensource.org/licenses/MIT) 4 | [](https://www.npmjs.com/package/react-material-ui-form) 5 | [](https://travis-ci.com/voletiswaroop/react-material-ui-form) 6 | [](https://www.npmjs.com/package/react-material-ui-form) 7 | [](https://libraries.io/npm/react-material-ui-form) 8 | 9 | 1. [About](#about) 10 | 2. [Setup](#setup) 11 | 3. [Props](#props) 12 | - [Form props](#form-props-optional) 13 | - [Field props](#field-props) 14 | - [Other props](#other-props) 15 | 4. [Examples](#examples) 16 | - [Nested fields](#nested-fields) 17 | - [Custom validation messages](#custom-validation-messages) 18 | - [Custom validators](#custom-validators) 19 | - [Custom validation logic](#custom-validation-logic) 20 | - [Server validations](#server-validations) 21 | - [Misc form settings](#form-autocomplete-and-on-error-submission) 22 | - [Getting values on field update](#getting-form-values-on-field-update) 23 | - [Stepper](#stepper) 24 | - [Dynamic array fields](#dynamic-array-fields-notice-the-deletefieldrow-prop-on-the-remove-row-button) 25 | - [Custom component handler](#custom-components-with-custom-handlers) 26 | 5. [Contributing](#contributing) 27 | 6. [License](#license) 28 | 29 | ## About 30 | 31 | _react-material-ui-form_ is a React wrapper for [Material-UI](https://material-ui.com/getting-started/usage/) form components. Simply replace the `