From 1a4fcc77364f10738ec1695d7993edaa4495556b Mon Sep 17 00:00:00 2001 From: Nicolas Saubi Date: Thu, 3 May 2018 19:11:26 +0200 Subject: [PATCH 1/3] added support for InputLabelProps, typos --- package.json | 2 +- src/MaterialChips/index.js | 26 ++++++++++++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index e32fed9..5e12686 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "material-input-chips", - "version": "1.5.0", + "version": "1.5.1", "description": "A chip input field using Material-UI@next.", "homepage": "https://rodrigonehring.github.io/material-input-chips/styleguide/", "main": "dist/material-input-chips.js", diff --git a/src/MaterialChips/index.js b/src/MaterialChips/index.js index 2246f84..371e7bf 100644 --- a/src/MaterialChips/index.js +++ b/src/MaterialChips/index.js @@ -45,8 +45,11 @@ class MaterialChips extends Component { /** disable input field */ inputDisabled: PropTypes.bool, - /** Props wich will be passed directly to component */ - inputProps: PropTypes.object, + /** Props wich will be passed directly to Input component */ + InputProps: PropTypes.object, + + /** Props which will be passed directly to InputLabel component */ + InputLabelProps: PropTypes.object, /** label for input */ label: PropTypes.string, @@ -91,7 +94,8 @@ class MaterialChips extends Component { submitKeyCodes: [13, 9, 191], clearAfterAdd: true, fields: { label: 'label', value: 'value' }, - inputProps: {}, + InputProps: {}, + InputLabelProps: {}, makeChip: chip => chip, chipComponent: Chip, selected: [], @@ -597,9 +601,13 @@ class MaterialChips extends Component { } render() { - const { classes, disabled, selected, label, inputDisabled, inputProps } = this.props + const { + classes, disabled, selected, label, + inputDisabled, InputProps, InputLabelProps, + } = this.props const { input, error, containerFocus, chipFocus, optionsOpen, inputFocus } = this.state - const labelShrinked = !!inputProps.placeholder || (selected.length > 0) || (input.length > 0) + + const labelShrinked = !!InputProps.placeholder || (selected.length > 0) || (input.length > 0) const labelFocused = containerFocus || chipFocus || inputFocus const formClasses = cx( @@ -611,6 +619,8 @@ class MaterialChips extends Component { classes.formControl ) + const mergedInputLabelProps = Object.assign({}, { shrink: labelShrinked }, InputLabelProps) + return (
0} fullWidth margin="dense"> - + {label} @@ -645,14 +655,14 @@ class MaterialChips extends Component { margin="dense" inputRef={this.registerRef('input')} value={input} - inputProps={Object.assign({}, { spellCheck: false }, inputProps)} + inputProps={Object.assign({}, { spellCheck: false }, InputProps)} />
- { error && + {error && {error} From 531af9240065e7240fa6207a66239fc800580b9e Mon Sep 17 00:00:00 2001 From: Nicolas Saubi Date: Thu, 3 May 2018 19:11:36 +0200 Subject: [PATCH 2/3] typo --- src/MaterialChips/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MaterialChips/index.js b/src/MaterialChips/index.js index 371e7bf..18bde65 100644 --- a/src/MaterialChips/index.js +++ b/src/MaterialChips/index.js @@ -45,7 +45,7 @@ class MaterialChips extends Component { /** disable input field */ inputDisabled: PropTypes.bool, - /** Props wich will be passed directly to Input component */ + /** Props which will be passed directly to Input component */ InputProps: PropTypes.object, /** Props which will be passed directly to InputLabel component */ From 70ac0857f54d690dc1758432cac8df52d8d37688 Mon Sep 17 00:00:00 2001 From: nicolas saubi <8709570+nsaubi@users.noreply.github.com> Date: Thu, 3 May 2018 19:22:34 +0200 Subject: [PATCH 3/3] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e32fed9..964a21b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "material-input-chips", - "version": "1.5.0", + "version": "1.5.2", "description": "A chip input field using Material-UI@next.", "homepage": "https://rodrigonehring.github.io/material-input-chips/styleguide/", "main": "dist/material-input-chips.js",