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 { getSecureRelForTarget } from '../../services';

import { EuiNotificationBadge } from '../badge/notification_badge';
import { COLORS, ICON_SIDES, EuiButtonEmpty } from '../button/button_empty';
import { ICON_TYPES } from '../icon';
export var EuiFilterButton = function EuiFilterButton(_ref) {
  var children = _ref.children,
      className = _ref.className,
      iconType = _ref.iconType,
      iconSide = _ref.iconSide,
      color = _ref.color,
      hasActiveFilters = _ref.hasActiveFilters,
      numFilters = _ref.numFilters,
      isDisabled = _ref.isDisabled,
      isSelected = _ref.isSelected,
      type = _ref.type,
      grow = _ref.grow,
      noDivider = _ref.noDivider,
      rest = _objectWithoutProperties(_ref, ["children", "className", "iconType", "iconSide", "color", "hasActiveFilters", "numFilters", "isDisabled", "isSelected", "type", "grow", "noDivider"]);

  var classes = classNames('euiFilterButton', {
    'euiFilterButton-isSelected': isSelected,
    'euiFilterButton-hasActiveFilters': hasActiveFilters,
    'euiFilterButton--grow': grow,
    'euiFilterButton--noDivider': noDivider
  }, className);
  var buttonContents = React.createElement("span", {
    className: "euiFilterButton__textShift",
    "data-text": children
  }, children, numFilters && React.createElement(EuiNotificationBadge, {
    className: "euiFilterButton__notification"
  }, numFilters));
  return React.createElement(EuiButtonEmpty, _extends({
    className: classes,
    color: color,
    isDisabled: isDisabled,
    iconSide: iconSide,
    iconType: iconType,
    type: type
  }, rest), buttonContents);
};
EuiFilterButton.propTypes = {
  children: PropTypes.node,
  className: PropTypes.string,
  onClick: PropTypes.func,

  /**
   * Use any one of our icons
   */
  iconType: PropTypes.oneOf(ICON_TYPES),
  iconSide: PropTypes.oneOf(ICON_SIDES),
  color: PropTypes.oneOf(COLORS),

  /**
   * Bolds the button if true
   */
  hasActiveFilters: PropTypes.bool,

  /**
   * Adds a notification with number
   */
  numFilters: PropTypes.number,

  /**
   * Applies a visual state to the button useful when using with a popover.
   */
  isSelected: PropTypes.bool,
  isDisabled: PropTypes.bool,

  /**
   * Defines html button input type
   */
  type: PropTypes.string,

  /**
   * Should the button grow to fill it's container, best used for dropdown buttons
   */
  grow: PropTypes.bool,

  /**
   * Remove border after button, good for opposite filters
   */
  noDivider: PropTypes.bool
};
EuiFilterButton.defaultProps = {
  type: 'button',
  iconSide: 'right',
  color: 'text',
  grow: false
};
EuiFilterButton.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "EuiFilterButton",
  "props": {
    "type": {
      "defaultValue": {
        "value": "'button'",
        "computed": false
      },
      "type": {
        "name": "string"
      },
      "required": false,
      "description": "Defines html button input type"
    },
    "iconSide": {
      "defaultValue": {
        "value": "'right'",
        "computed": false
      },
      "type": {
        "name": "enum",
        "computed": true,
        "value": "ICON_SIDES"
      },
      "required": false,
      "description": ""
    },
    "color": {
      "defaultValue": {
        "value": "'text'",
        "computed": false
      },
      "type": {
        "name": "enum",
        "computed": true,
        "value": "COLORS"
      },
      "required": false,
      "description": ""
    },
    "grow": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "type": {
        "name": "bool"
      },
      "required": false,
      "description": "Should the button grow to fill it's container, best used for dropdown buttons"
    },
    "children": {
      "type": {
        "name": "node"
      },
      "required": false,
      "description": ""
    },
    "className": {
      "type": {
        "name": "string"
      },
      "required": false,
      "description": ""
    },
    "onClick": {
      "type": {
        "name": "func"
      },
      "required": false,
      "description": ""
    },
    "iconType": {
      "type": {
        "name": "enum",
        "computed": true,
        "value": "ICON_TYPES"
      },
      "required": false,
      "description": "Use any one of our icons"
    },
    "hasActiveFilters": {
      "type": {
        "name": "bool"
      },
      "required": false,
      "description": "Bolds the button if true"
    },
    "numFilters": {
      "type": {
        "name": "number"
      },
      "required": false,
      "description": "Adds a notification with number"
    },
    "isSelected": {
      "type": {
        "name": "bool"
      },
      "required": false,
      "description": "Applies a visual state to the button useful when using with a popover."
    },
    "isDisabled": {
      "type": {
        "name": "bool"
      },
      "required": false,
      "description": ""
    },
    "noDivider": {
      "type": {
        "name": "bool"
      },
      "required": false,
      "description": "Remove border after button, good for opposite filters"
    }
  }
};