1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { WrappedFieldProps } from 'redux-form';
7 import { ArvadosTheme } from '~/common/custom-theme';
8 import { StyleRulesCallback, WithStyles, withStyles, FormControl, InputLabel, Select, MenuItem } from '@material-ui/core';
10 type CssRules = 'formControl' | 'selectWrapper' | 'select' | 'option';
12 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
17 backgroundColor: theme.palette.common.white,
19 borderBottomColor: 'rgba(0, 0, 0, 0.42)'
28 backgroundColor: 'rgba(0, 0, 0, 0.0)'
33 backgroundColor: theme.palette.common.white,
38 export const NativeSelectField = withStyles(styles)
39 ((props: WrappedFieldProps & WithStyles<CssRules> & { items: any[] }) =>
40 <FormControl className={props.classes.formControl}>
41 <Select className={props.classes.selectWrapper}
43 value={props.input.value}
44 onChange={props.input.onChange}
45 disabled={props.meta.submitting}
46 name={props.input.name}
48 id: `id-${props.input.name}`,
49 className: props.classes.select
51 {props.items.map(item => (
52 <option key={item.key} value={item.key} className={props.classes.option}>