X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/c2c920158f714754e3066460bc013cdf492b60dc..78ed213aa29f8af76d973b295c159a0b4764a4a1:/src/components/chips-input/chips-input.tsx diff --git a/src/components/chips-input/chips-input.tsx b/src/components/chips-input/chips-input.tsx index cbb1fb12..7b9ff4a6 100644 --- a/src/components/chips-input/chips-input.tsx +++ b/src/components/chips-input/chips-input.tsx @@ -12,6 +12,7 @@ interface ChipsInputProps { values: Value[]; getLabel?: (value: Value) => string; onChange: (value: Value[]) => void; + onPartialInput?: (value: boolean) => void; handleFocus?: (e: any) => void; handleBlur?: (e: any) => void; chipsClassName?: string; @@ -54,6 +55,9 @@ export const ChipsInput = withStyles(styles)( setText = (event: React.ChangeEvent) => { this.setState({ text: event.target.value }, () => { + // Update partial input status + this.props.onPartialInput && this.props.onPartialInput(this.state.text !== ''); + // If pattern is provided, check for delimiter if (this.props.pattern) { const matches = this.state.text.match(this.props.pattern); @@ -92,6 +96,7 @@ export const ChipsInput = withStyles(styles)( this.setState({ text: '' }); this.props.onChange([...this.props.values, newValue]); } + this.props.onPartialInput && this.props.onPartialInput(false); } }