<commit_before>import React, { PureComponent } from 'react';
import InputMask from 'react-input-mask';
import Icon from '../icon';
import SingleLineInputBase from './SingleLineInputBase';
import { IconTimerSmallOutline } from '@teamleader/ui-icons';

const isValidTime = input => RegExp('([0-1][0-9]|[2][0-3]):([0-5][0-9])').test(input);
class TimeInput extends PureComponent {
  beforeMaskedValueChange = ({ value: newValue, selection }, { value: oldValue }) => {
    if (!isValidTime(newValue)) {
      return { value: oldValue, selection };
    }
    return { value: newValue, selection };
  };

  render() {
    return (
      <InputMask {...this.props} mask="99:99" maskChar="0" beforeMaskedValueChange={this.beforeMaskedValueChange}>
        {inputProps => (
          <SingleLineInputBase
            {...inputProps}
            autoComplete="off"
            prefix={
              <Icon color="neutral" tint="darkest">
                <IconTimerSmallOutline />
              </Icon>
            }
          />
        )}
      </InputMask>
    );
  }
}

export default TimeInput;
<commit_msg>Add the disabled and readOnly props directly to the SingleLineInputBase<commit_after>import React, { PureComponent } from 'react';
import InputMask from 'react-input-mask';
import Icon from '../icon';
import SingleLineInputBase from './SingleLineInputBase';
import { IconTimerSmallOutline } from '@teamleader/ui-icons';

const isValidTime = input => RegExp('([0-1][0-9]|[2][0-3]):([0-5][0-9])').test(input);
class TimeInput extends PureComponent {
  beforeMaskedValueChange = ({ value: newValue, selection }, { value: oldValue }) => {
    if (!isValidTime(newValue)) {
      return { value: oldValue, selection };
    }
    return { value: newValue, selection };
  };

  render() {
    const { disabled, readOnly } = this.props;
    return (
      <InputMask {...this.props} mask="99:99" maskChar="0" beforeMaskedValueChange={this.beforeMaskedValueChange}>
        {inputProps => (
          <SingleLineInputBase
            {...inputProps}
            autoComplete="off"
            readOnly={readOnly}
            disabled={disabled}
            prefix={
              <Icon color="neutral" tint="darkest">
                <IconTimerSmallOutline />
              </Icon>
            }
          />
        )}
      </InputMask>
    );
  }
}

export default TimeInput;

{'fraction_non_alphanumeric': 0.1450864614086883, 'fraction_numerical': 0.013496415014761703, 'mean_word_length': 2.638036809815951, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, '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': '2994593', 'n_tokens_mistral': 700, 'n_tokens_neox': 681, 'n_words': 147}