<commit_before>var React = require("react/addons");
var Util = require("../../helpers/Util");

var ModalComponent = require("../ModalComponent");

var PromptModalComponent = React.createClass({
  displayName: "PromptModalComponent",

  propTypes: {
    defaultValue: React.PropTypes.string,
    message: React.PropTypes.string,
    onConfirm: React.PropTypes.func,
    onDestroy: React.PropTypes.func
  },

  getDefaultProps: function () {
    return {
      defaultValue: "",
      message: "",
      onConfirm: Util.noop,
      onDestroy: Util.noop
    };
  },

  componentDidMount: function () {
    this.refs.textinput.getDOMNode().focus();
    this.refs.textinput.getDOMNode().select();
  },

  handleDestroy: function () {
    this.refs.modalComponent.destroy();
  },

  handleConfirm: function () {
    this.props.onConfirm(this.refs.textinput.getDOMNode().value);
  },

  onKeyUp: function (event) {
    if (event.keyCode === 13) {
      this.handleConfirm();
    }
  },

  render: function () {
    return (
      <ModalComponent
          centered={true}
          dismissOnClickOutside={true}
          ref="modalComponent"
          size="sm"
          onDestroy={this.props.onDestroy}>
        <div className="modal-body reduced-padding">
          {this.props.message}
          <input className="form-control"
            type="text"
            ref="textinput"
            onKeyUp={this.onKeyUp}<commit_msg>Use label element for prompt message<commit_after>var React = require("react/addons");
var Util = require("../../helpers/Util");

var ModalComponent = require("../ModalComponent");

var PromptModalComponent = React.createClass({
  displayName: "PromptModalComponent",

  propTypes: {
    defaultValue: React.PropTypes.string,
    message: React.PropTypes.string,
    onConfirm: React.PropTypes.func,
    onDestroy: React.PropTypes.func
  },

  getDefaultProps: function () {
    return {
      defaultValue: "",
      message: "",
      onConfirm: Util.noop,
      onDestroy: Util.noop
    };
  },

  componentDidMount: function () {
    this.refs.textinput.getDOMNode().focus();
    this.refs.textinput.getDOMNode().select();
  },

  handleDestroy: function () {
    this.refs.modalComponent.destroy();
  },

  handleConfirm: function () {
    this.props.onConfirm(this.refs.textinput.getDOMNode().value);
  },

  onKeyUp: function (event) {
    if (event.keyCode === 13) {
      this.handleConfirm();
    }
  },

  render: function () {
    return (
      <ModalComponent
          centered={true}
          dismissOnClickOutside={true}
          ref="modalComponent"
          size="sm"
          onDestroy={this.props.onDestroy}>
        <div className="modal-body reduced-padding">
          <label>{this.props.message}</label>
          <input className="form-control"
            type="text"
            ref="textinput"
            onKeyUp={this.onKeyUp}
{'fraction_non_alphanumeric': 0.14181692094313453, 'fraction_numerical': 0.0013869625520110957, 'mean_word_length': 2.7225806451612904, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '3011890', 'n_tokens_mistral': 870, 'n_tokens_neox': 838, 'n_words': 138}