processAction() {
    const { children: button, resetDelay } = this.props
    const content = this.preprocessContent()
    if (!button) return null

    const newHandler = event => {
      this.resetState()
      if (content.loading) {
        this.setTooltipContent(content.loading, { taskIsRunning: true })
      } else {
        this.setState({ taskIsRunning: true })
      }

      Promise.resolve(button.props.onClick(event))
        .then(result =>
          this.setTooltipContent(content.success || content.default, { taskIsRunning: false })
        )
        .catch(() =>
          this.setTooltipContent(content.error || 'Something did not work', {
            taskIsRunning: false
          })
        )
    }

    const onMouseLeave = ev => {
      if (button.props.onMouseLeave) {
        button.props.onMouseLeave(ev)
      }

      this.resetState()
    }

    return React.cloneElement(button, {
      onClick: newHandler,
      appearance: 'link',
      onMouseLeave
    })
  }
/**
   * Takes the `onClick` handler of the children and wraps it with the tooltip content
   * listener. Which sets the correct string on each step of the action run.
   * Also sets the child button appearance to link, since this is going to be used
   * from a text input / text area action.
   */
Takes the `onClick` handler of the children and wraps it with the tooltip content
listener. Which sets the correct string on each step of the action run.
Also sets the child button appearance to link, since this is going to be used
from a text input / text area action.
Takes the ` onClick ` handler of the children and wraps it with the tooltip content listener . Which sets the correct string on each step of the action run . Also sets the child button appearance to link since this is going to be used from a text input / text area action .
processAction() {
    const { children: button, resetDelay } = this.props
    const content = this.preprocessContent()
    if (!button) return null
    const newHandler = event => {
      this.resetState()
      if (content.loading) {
        this.setTooltipContent(content.loading, { taskIsRunning: true })
      } else {
        this.setState({ taskIsRunning: true })
      }
      Promise.resolve(button.props.onClick(event))
        .then(result =>
          this.setTooltipContent(content.success || content.default, { taskIsRunning: false })
        )
        .catch(() =>
          this.setTooltipContent(content.error || 'Something did not work', {
            taskIsRunning: false
          })
        )
    }
    const onMouseLeave = ev => {
      if (button.props.onMouseLeave) {
        button.props.onMouseLeave(ev)
      }
      this.resetState()
    }
    return React.cloneElement(button, {
      onClick: newHandler,
      appearance: 'link',
      onMouseLeave
    })
  }
processAction ( ) { const { children : button , resetDelay } = this . props const content = this . preprocessContent ( ) if ( ! button ) return null const newHandler = event => { this . resetState ( ) if ( content . loading ) { this . setTooltipContent ( content . loading , { taskIsRunning : true } ) } else { this . setState ( { taskIsRunning : true } ) } Promise . resolve ( button . props . onClick ( event ) ) . then ( result => this . setTooltipContent ( content . success || content . default , { taskIsRunning : false } ) ) . catch ( ( ) => this . setTooltipContent ( content . error || 'Something did not work' , { taskIsRunning : false } ) ) } const onMouseLeave = ev => { if ( button . props . onMouseLeave ) { button . props . onMouseLeave ( ev ) } this . resetState ( ) } return React . cloneElement ( button , { onClick : newHandler , appearance : 'link' , onMouseLeave } ) }
Takes the `onClick` handler of the children and wraps it with the tooltip content
 listener.
Takes the ` onClick ` handler of the children and wraps it with the tooltip content listener .