import "core-js/modules/es6.object.assign";
import "core-js/modules/web.dom.iterable";
import "core-js/modules/es6.array.iterator";
import "core-js/modules/es6.object.keys";

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { EuiScreenReaderOnly, EuiKeyboardAccessible } from '../accessibility';
import { STATUS, EuiStepNumber } from './step_number';
export var EuiStepHorizontal = function EuiStepHorizontal(_ref) {
  var className = _ref.className,
      step = _ref.step,
      title = _ref.title,
      isSelected = _ref.isSelected,
      isComplete = _ref.isComplete,
      onClick = _ref.onClick,
      disabled = _ref.disabled,
      status = _ref.status,
      rest = _objectWithoutProperties(_ref, ["className", "step", "title", "isSelected", "isComplete", "onClick", "disabled", "status"]);

  var classes = classNames('euiStepHorizontal', className, {
    'euiStepHorizontal-isSelected': isSelected,
    'euiStepHorizontal-isComplete': isComplete,
    'euiStepHorizontal-isIncomplete': !isSelected && !isComplete,
    'euiStepHorizontal-isDisabled': disabled
  });
  var titleAppendix = '';

  if (disabled) {
    status = 'disabled';
    titleAppendix = ' is disabled';
  } else if (isComplete) {
    status = 'complete';
    titleAppendix = ' is complete';
  } else if (isSelected) {
    status = status;
  } else if (!isComplete && !status) {
    status = 'incomplete';
  }

  var onStepClick = function onStepClick(e) {
    if (disabled) {
      return;
    }

    onClick(e);
  };

  var buttonTitle = "Step ".concat(step, ": ").concat(title).concat(titleAppendix);
  return React.createElement(EuiKeyboardAccessible, null, React.createElement("div", _extends({
    role: "tab",
    "aria-selected": !!isSelected,
    "aria-disabled": !!disabled,
    className: classes,
    onClick: onStepClick,
    tabIndex: disabled ? '-1' : '0',
    title: buttonTitle
  }, rest), React.createElement(EuiScreenReaderOnly, null, React.createElement("div", null, "Step")), React.createElement(EuiStepNumber, {
    className: "euiStepHorizontal__number",
    status: status,
    number: step
  }), React.createElement("div", {
    className: "euiStepHorizontal__title"
  }, title)));
};
EuiStepHorizontal.propTypes = {
  isSelected: PropTypes.bool,
  isComplete: PropTypes.bool,
  onClick: PropTypes.func.isRequired,
  step: PropTypes.number.isRequired,
  title: PropTypes.node,
  className: PropTypes.string,
  disabled: PropTypes.bool,

  /**
   * Will replace the number provided in props.step with alternate styling.
   * Options: `complete`, `incomplete`, `warning`, `danger`, `disabled`.
   * The `isSelected`, `isComplete`, and `disabled` props will override these.
   */
  status: PropTypes.oneOf(STATUS)
};
EuiStepHorizontal.defaultProps = {
  isSelected: false,
  isComplete: false,
  disabled: false
};
EuiStepHorizontal.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "EuiStepHorizontal",
  "props": {
    "isSelected": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "type": {
        "name": "bool"
      },
      "required": false,
      "description": ""
    },
    "isComplete": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "type": {
        "name": "bool"
      },
      "required": false,
      "description": ""
    },
    "disabled": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "type": {
        "name": "bool"
      },
      "required": false,
      "description": ""
    },
    "onClick": {
      "type": {
        "name": "func"
      },
      "required": true,
      "description": ""
    },
    "step": {
      "type": {
        "name": "number"
      },
      "required": true,
      "description": ""
    },
    "title": {
      "type": {
        "name": "node"
      },
      "required": false,
      "description": ""
    },
    "className": {
      "type": {
        "name": "string"
      },
      "required": false,
      "description": ""
    },
    "status": {
      "type": {
        "name": "enum",
        "computed": true,
        "value": "STATUS"
      },
      "required": false,
      "description": "Will replace the number provided in props.step with alternate styling.\nOptions: `complete`, `incomplete`, `warning`, `danger`, `disabled`.\nThe `isSelected`, `isComplete`, and `disabled` props will override these."
    }
  }
};