<commit_before>import * as React from 'react'
import propConnect from '../PropProvider/propConnect'
import getValidProps from '@helpscout/react-utils/dist/getValidProps'
import Step from './Stepper.Step'
import { classNames } from '../../utilities/classNames'
import { getComponentKey } from '../../utilities/component'
import { isDefined } from '../../utilities/is'
import { noop } from '../../utilities/other'
import { StepperUI, StepWrapperUI } from './Stepper.css'
import { COMPONENT_KEY } from './Stepper.utils'
import { StepperStep } from './Stepper.types'

export interface Props {
  className?: string
  currentIndex?: any
  innerRef: (node: HTMLElement) => void
  isClickable: boolean
  onChange: (Step: any) => void
  onComplete: () => void
  onStepClick: (Step: any, event: any) => void
  steps: Array<StepperStep>
}

export class Stepper extends React.PureComponent<Props> {
  static className = 'c-Stepper'
  static defaultProps = {
    currentIndex: 0,
    innerRef: noop,
    isClickable: false,
    onChange: noop,
    onComplete: noop,
    onStepClick: noop,
    steps: [],
  }

  static Step = Step

  componentDidUpdate(prevProps) {
    if (prevProps.currentIndex !== this.props.currentIndex) {
      this.handleChangeCallback()
    }
  }

  handleChangeCallback() {
    const { onChange, onComplete, steps } = this.props
    const currentIndex = this.getMatchIndex()
    const step = this.getCurrentStep()

    if (step) {
      onChange(step)
    }
    if (currentIndex === steps.length - 1) {
      onComplete()
    }
  }

  handleOnStepClick = (event, index) => {
    const step = this.props.steps[index]

    this.props.onStepClick(step, event)
  }

  getClassName() {
    const { className } = this.props
    return classNames(Stepper.className, className)
  }

  getProgress(): number {
    const matchIndex = this.getMatchIndex()
    const progress = matchIndex >= 0 ? matchIndex : 0

    return progress + 1
  }

  getMatchIndex(): number {
    const { currentIndex } = this.props
    const matchIndex = isDefined(currentIndex) ? currentIndex : -1

    console.log('matchIndex', isDefined(currentIndex), matchIndex, currentIndex)

    return matchIndex
  }

  getCurrentTitle(): string {
    const step = this.getCurrentStep()

    return step ? step.title : ''
  }
<commit_msg>Remove stray console log in Stepper [skip ci]<commit_after>import * as React from 'react'
import propConnect from '../PropProvider/propConnect'
import getValidProps from '@helpscout/react-utils/dist/getValidProps'
import Step from './Stepper.Step'
import { classNames } from '../../utilities/classNames'
import { getComponentKey } from '../../utilities/component'
import { isDefined } from '../../utilities/is'
import { noop } from '../../utilities/other'
import { StepperUI, StepWrapperUI } from './Stepper.css'
import { COMPONENT_KEY } from './Stepper.utils'
import { StepperStep } from './Stepper.types'

export interface Props {
  className?: string
  currentIndex?: any
  innerRef: (node: HTMLElement) => void
  isClickable: boolean
  onChange: (Step: any) => void
  onComplete: () => void
  onStepClick: (Step: any, event: any) => void
  steps: Array<StepperStep>
}

export class Stepper extends React.PureComponent<Props> {
  static className = 'c-Stepper'
  static defaultProps = {
    currentIndex: 0,
    innerRef: noop,
    isClickable: false,
    onChange: noop,
    onComplete: noop,
    onStepClick: noop,
    steps: [],
  }

  static Step = Step

  componentDidUpdate(prevProps) {
    if (prevProps.currentIndex !== this.props.currentIndex) {
      this.handleChangeCallback()
    }
  }

  handleChangeCallback() {
    const { onChange, onComplete, steps } = this.props
    const currentIndex = this.getMatchIndex()
    const step = this.getCurrentStep()

    if (step) {
      onChange(step)
    }
    if (currentIndex === steps.length - 1) {
      onComplete()
    }
  }

  handleOnStepClick = (event, index) => {
    const step = this.props.steps[index]

    this.props.onStepClick(step, event)
  }

  getClassName() {
    const { className } = this.props
    return classNames(Stepper.className, className)
  }

  getProgress(): number {
    const matchIndex = this.getMatchIndex()
    const progress = matchIndex >= 0 ? matchIndex : 0

    return progress + 1
  }

  getMatchIndex(): number {
    const { currentIndex } = this.props
    const matchIndex = isDefined(currentIndex) ? currentIndex : -1

    return matchIndex
  }

  getCurrentTitle(): string {
    const step = this.getCurrentStep()

    return step ? step.title : ''
  }

{'fraction_non_alphanumeric': 0.12494519947391496, 'fraction_numerical': 0.00263042525208242, 'mean_word_length': 3.321022727272727, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, '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': '5197406', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1387, 'n_words': 357}