File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change 11import * as React from 'react' ;
2+ import classNames from 'classnames/dedupe' ;
23import { componentDefaultProps } from './component-common' ;
34import ErrorMessages from './error-messages' ;
45import Help from './help' ;
@@ -47,21 +48,26 @@ class Select extends React.Component<SelectProps, {}> {
4748
4849 public render ( ) : JSX . Element {
4950 const {
51+ className,
5052 errorMessages,
5153 help,
5254 id,
5355 layout,
5456 name,
57+ required,
5558 showErrors,
5659 ...inputProps
5760 } = this . props ;
5861 Object . keys ( componentDefaultProps ) . forEach ( ( key ) : void => {
5962 delete inputProps [ key ] ;
6063 } ) ;
6164
65+ const markAsInvalid = showErrors && ( errorMessages . length > 0 || required ) ;
66+
6267 const control = (
6368 < SelectControl
6469 { ...inputProps }
70+ className = { classNames ( markAsInvalid ? [ 'is-invalid' , className ] : className ) }
6571 elementRef = { this . props . elementRef }
6672 id = { id }
6773 name = { name }
You can’t perform that action at this time.
0 commit comments