add native select field, data text field and search bar model
[arvados.git] / src / components / text-field / text-field.tsx
index 076889eabb4b9af6acb630d243e9db9829a47950..1bf51973d429cfe034e059f234f50feefaca2f41 100644 (file)
@@ -16,7 +16,7 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     },
 });
 
-export const TextField = withStyles(styles)((props: WrappedFieldProps & WithStyles<CssRules> & { label?: string, autoFocus?: boolean }) =>
+export const TextField = withStyles(styles)((props: WrappedFieldProps & WithStyles<CssRules> & { label?: string, autoFocus?: boolean, required?: boolean }) =>
     <MaterialTextField
         helperText={props.meta.touched && props.meta.error}
         className={props.classes.textField}
@@ -26,6 +26,7 @@ export const TextField = withStyles(styles)((props: WrappedFieldProps & WithStyl
         autoComplete='off'
         autoFocus={props.autoFocus}
         fullWidth={true}
+        required={props.required}
         {...props.input}
     />);
 
@@ -54,4 +55,22 @@ export const RichEditorTextField = withStyles(styles)(
                 placeholder={this.props.label} />;
         }
     }
-);
\ No newline at end of file
+);
+
+type DataTextFieldProps = WrappedFieldProps & WithStyles<CssRules>;
+
+export const DataTextField = withStyles(styles)
+    ((props: DataTextFieldProps) => 
+        <MaterialTextField
+            disabled={props.meta.submitting}
+            error={props.meta.touched && !!props.meta.error}
+            type="date"
+            fullWidth={true}
+            name={props.input.name}
+            InputLabelProps={{
+                shrink: true
+            }}
+            onChange={props.input.onChange}
+            value={props.input.value}
+        />    
+    );
\ No newline at end of file