<commit_before>import React, {Component, PropTypes} from 'react';
import ReactDOM from 'react-dom';
import transitions from '../styles/transitions';

class ExpandTransitionChild extends Component {
  static propTypes = {
    children: PropTypes.node,
    enterDelay: PropTypes.number,
    style: PropTypes.object,
    transitionDelay: PropTypes.number,
    transitionDuration: PropTypes.number,
  };

  static defaultProps = {
    enterDelay: 0,
    transitionDelay: 0,
    transitionDuration: 450,
  };

  static contextTypes = {
    muiTheme: PropTypes.object.isRequired,
  };

  componentDidUpdate() {
    this.open();
  }

  componentWillUnmount() {
    clearTimeout(this.enterTimer);
    clearTimeout(this.enteredTimer);
    clearTimeout(this.leaveTimer);
  }

  componentWillAppear(callback) {
    this.open();
    callback();
  }

  componentDidAppear() {
    this.setAutoHeight();
  }

  componentWillEnter(callback) {
    const {enterDelay, transitionDelay, transitionDuration} = this.props;
    const {style} = ReactDOM.findDOMNode(this);
    style.height = 0;
    this.enterTimer = setTimeout(() => this.open(), enterDelay);
    this.enteredTimer = setTimeout(() => callback(), enterDelay + transitionDelay + transitionDuration);
  }

  componentDidEnter() {
    this.setAutoHeight();
  }

  componentWillLeave(callback) {
    const {transitionDelay, transitionDuration} = this.props;
    const {style} = ReactDOM.findDOMNode(this);
    // Set fixed height first for animated property value
    style.height = `${this.refs.wrapper.clientHeight}px`;
    style.height = 0;
    this.leaveTimer = setTimeout(() => callback(), transitionDelay + transitionDuration);
  }

  setAutoHeight() {
    const {style} = ReactDOM.findDOMNode(this);
    style.height = 'auto';
  }

  open() {
    const {style} = ReactDOM.findDOMNode(this);
    style.height = `${this.refs.wrapper.clientHeight}px`;
  }

  render() {<commit_msg>[Stepper] Fix transition bug in safari, resolves #4578<commit_after>import React, {Component, PropTypes} from 'react';
import ReactDOM from 'react-dom';
import transitions from '../styles/transitions';

const reflow = (elem) => elem.offsetHeight;

class ExpandTransitionChild extends Component {
  static propTypes = {
    children: PropTypes.node,
    enterDelay: PropTypes.number,
    style: PropTypes.object,
    transitionDelay: PropTypes.number,
    transitionDuration: PropTypes.number,
  };

  static defaultProps = {
    enterDelay: 0,
    transitionDelay: 0,
    transitionDuration: 450,
  };

  static contextTypes = {
    muiTheme: PropTypes.object.isRequired,
  };

  componentWillUnmount() {
    clearTimeout(this.enterTimer);
    clearTimeout(this.enteredTimer);
    clearTimeout(this.leaveTimer);
  }

  componentWillAppear(callback) {
    this.open();
    callback();
  }

  componentDidAppear() {
    this.setAutoHeight();
  }

  componentWillEnter(callback) {
    const {enterDelay, transitionDelay, transitionDuration} = this.props;
    const element = ReactDOM.findDOMNode(this);
    element.style.height = 0;
    this.enterTimer = setTimeout(() => this.open(), enterDelay);
    this.enteredTimer = setTimeout(
      () => callback(),
      enterDelay + transitionDelay + transitionDuration
    );
  }

  componentDidEnter() {
    this.setAutoHeight();
  }

  componentWillLeave(callback) {
    const {transitionDelay, transitionDuration} = this.props;
    const element = ReactDOM.findDOMNode(this);
    // Set fixed height first for animated property value
    element.style.height = `${this.refs.wrapper.clientHeight}px`;
    reflow(element);
    element.style.transitionDuration = `${transitionDuration}ms`;
    element.style.height = 0;
    this.leaveTimer = setTimeout(() => callback(), transitionDelay + transitionDuration);
  }

  setAutoHeight() {
    const {style} = ReactDOM.findDOMNode(this);
    style.transitionDuration = 0;
    style.height = 'auto';
  }

  open() {
    const element = ReactDOM.findDOMNode(this);
    element.style.height = `${this.refs.wrapper.clientHeight}px`;
  }

  render() {
{'fraction_non_alphanumeric': 0.1247534516765286, 'fraction_numerical': 0.004684418145956607, 'mean_word_length': 3.841288782816229, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '509536', 'n_tokens_mistral': 1200, 'n_tokens_neox': 1175, 'n_words': 242}