<commit_before>import { memo } from 'react';
import PropTypes from 'prop-types';
import {
  FormControl,
  InputLabel,
  FormHelperText,
  Select,
  MenuItem,
} from '@mui/material';
import { formatErrorMessage } from 'lib/components/form/fields/utils/mapError';
import propsAreEqual from './utils/propsAreEqual';

const styles = {
  selectFieldStyle: {
    margin: '8px 10px 8px 0px',
  },
  errorText: { margin: 0 },
};

const FormSelectField = (props) => {
  const {
    field,
    fieldState,
    disabled,
    label,
    options,
    renderIf,
    noneSelected,
    sx,
    onChangeCustom,
    margin,
    shrink,
    displayEmpty,
    className,
    variant = 'standard',
    ...custom
  } = props;
  const isError = !!fieldState.error;
  if (!renderIf) {
    return null;
  }
  if (sx) {
    styles.selectFieldStyle = {
      ...styles.selectFieldStyle,
      ...sx,
    };
  }

  return (
    <FormControl
      disabled={disabled}
      error={isError}
      fullWidth
      style={{ margin: margin ?? styles.selectFieldStyle.margin }}
      variant={variant}
    >
      <InputLabel shrink={shrink}>{label}</InputLabel>
      <Select
        id="select"
        {...field}
        onChange={(event) =>
          onChangeCustom
            ? onChangeCustom(event.target.value)
            : field.onChange(event)
        }
        {...custom}
        variant={variant}
        displayEmpty={displayEmpty}
        className={className}
        MenuProps={{
          style: { maxHeight: '50vh' },
        }}
      >
        {noneSelected && (
          <MenuItem value="" key={noneSelected}>
            {noneSelected}
          </MenuItem>
        )}
        {options &&
          options.map((option) => (
            <MenuItem
              key={option.value}
              id={`select-${option.value}`}
              value={option.value}
            ><commit_msg>fix(selectfield): unoverridable margin<commit_after>import { memo } from 'react';
import PropTypes from 'prop-types';
import {
  FormControl,
  InputLabel,
  FormHelperText,
  Select,
  MenuItem,
} from '@mui/material';
import { formatErrorMessage } from 'lib/components/form/fields/utils/mapError';
import propsAreEqual from './utils/propsAreEqual';

const styles = {
  selectFieldStyle: {
    margin: '8px 10px 8px 0px',
  },
  errorText: { margin: 0 },
};

const FormSelectField = (props) => {
  const {
    field,
    fieldState,
    disabled,
    label,
    options,
    renderIf,
    noneSelected,
    sx,
    onChangeCustom,
    margin,
    shrink,
    displayEmpty,
    className,
    variant = 'standard',
    ...custom
  } = props;
  const isError = !!fieldState.error;
  if (!renderIf) {
    return null;
  }
  if (sx) {
    styles.selectFieldStyle = {
      ...styles.selectFieldStyle,
      ...sx,
    };
  }

  return (
    <FormControl
      disabled={disabled}
      error={isError}
      fullWidth
      sx={{ margin: margin ?? styles.selectFieldStyle.margin }}
      variant={variant}
    >
      <InputLabel shrink={shrink}>{label}</InputLabel>
      <Select
        id="select"
        {...field}
        onChange={(event) =>
          onChangeCustom
            ? onChangeCustom(event.target.value)
            : field.onChange(event)
        }
        {...custom}
        variant={variant}
        displayEmpty={displayEmpty}
        className={className}
        MenuProps={{
          style: { maxHeight: '50vh' },
        }}
      >
        {noneSelected && (
          <MenuItem value="" key={noneSelected}>
            {noneSelected}
          </MenuItem>
        )}
        {options &&
          options.map((option) => (
            <MenuItem
              key={option.value}
              id={`select-${option.value}`}
              value={option.value}
            >
{'fraction_non_alphanumeric': 0.13282078472958642, 'fraction_numerical': 0.0042417815482502655, 'mean_word_length': 1.9968228752978554, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2976138', 'n_tokens_mistral': 1133, 'n_tokens_neox': 1116, 'n_words': 216}