"use strict";

exports.__esModule = true;
exports.default = void 0;

require("core-js/modules/es6.object.assign");

require("core-js/modules/web.dom.iterable");

require("core-js/modules/es6.array.iterator");

require("core-js/modules/es6.object.keys");

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _ = require("./..");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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 _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; }

function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }

/**
 * @category controls
 * @component call-control
 * @variations collab-ui-react
 */
var CallControl =
/*#__PURE__*/
function (_React$PureComponent) {
  _inheritsLoose(CallControl, _React$PureComponent);

  function CallControl() {
    return _React$PureComponent.apply(this, arguments) || this;
  }

  var _proto = CallControl.prototype;

  _proto.render = function render() {
    var _this$props = this.props,
        active = _this$props.active,
        ariaLabel = _this$props.ariaLabel,
        className = _this$props.className,
        disabled = _this$props.disabled,
        iconSize = _this$props.iconSize,
        onClick = _this$props.onClick,
        type = _this$props.type,
        otherHTMLProps = _objectWithoutPropertiesLoose(_this$props, ["active", "ariaLabel", "className", "disabled", "iconSize", "onClick", "type"]);

    return _react.default.createElement(_.Button, _extends({
      ariaLabel: ariaLabel || type,
      circle: true,
      className: 'cui-call-control' + ("" + (type === 'cancel' && " cui-call-control--cancel" || '')) + ("" + (active && " cui-call-control--active" || '')) + ("" + (className && " " + className || '')),
      disabled: disabled,
      onClick: onClick
    }, otherHTMLProps), _react.default.createElement(_.Icon, {
      name: type + "_" + iconSize
    }));
  };

  return CallControl;
}(_react.default.PureComponent);

CallControl.displayName = 'CallControl';
CallControl.propTypes = {
  /**
   * Sets the active state for the button
   */
  active: _propTypes.default.bool,

  /**
   * Text to display for blindness accessibility features
   */
  ariaLabel: _propTypes.default.string,

  /**
   * optional css class string
   */
  className: _propTypes.default.string,

  /**
   * Sets the attribute disabled to the button
   */
  disabled: _propTypes.default.bool,

  /**
   * Optional icon size prop
   */
  iconSize: _propTypes.default.number,

  /**
   * Handler to be called when the user taps the button
   */
  onClick: _propTypes.default.func,

  /**
   * Optional size prop for circular button
   */
  size: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),

  /**
   * optional call control prop type
   */
  type: _propTypes.default.oneOf(['microphone-muted', 'cancel', 'camera-muted', 'share-screen', 'speaker'])
};
CallControl.defaultProps = {
  active: false,
  ariaLabel: '',
  className: '',
  disabled: false,
  iconSize: 24,
  onClick: null,
  size: 56,
  type: ''
};
var _default = CallControl;
/**
* @name Default Call-Control
* @description Default Call-Control.
*
* @category controls
* @component call-control
* @section default
*
* @js

export default function CallControlDefault() {
  return(
    <div className='row'>

      <div className="docs-example docs-example--spacing">
        <h3> 
          <p><code className="small">type=(microphone-muted)</code></p>
          <p><code className="small">size=(20)</code></p>
          <p><code className="small">iconSize=(10)</code></p>
        </h3>
        <CallControl
          type='microphone-muted'
          ariaLabel='For the Win'
          size={20}
          iconSize={10}
        />
      </div>

      <div className="docs-example docs-example--spacing">
        <h3> 
          <p><code className="small">type=(microphone-muted)</code></p>
          <p><code className="small">size=(40)</code></p>
          <p><code className="small">iconSize=(16)</code></p>
        </h3>
        <CallControl
          type='microphone-muted'
          ariaLabel='For the Win'
          size={40}
          iconSize={16}
        />
      </div>

      <div className="docs-example docs-example--spacing">
        <h3> 
          <p><code className="small">type=(microphone-muted)</code></p>
        </h3>
        <CallControl
          type='microphone-muted'
          ariaLabel='For the Win'
        />
      </div>
      
    </div>
  );
}

**/

/**
* @name Call-Control with active
* @description Call control with active class.
*
* @category controls
* @component call-control
* @section active
*
* @js

export default function CallControlActive() {
  return(
    <div className='row'>

      <div className="docs-example docs-example--spacing">
        <h3> 
          <p><code className="small">active=(true)</code></p>
        </h3>
        <CallControl
          type='microphone-muted'
          active
          onClick={() => {}}
          ariaLabel='For the Win'
        />
      </div>

    </div>
  );
}

**/

/**
* @name Call-Control with disable
* @description Call-Control with disabled class.
*
* @category controls
* @component call-control
* @section disable
*
* @js

export default function CallControlDisabled() {
  return(
     <div className='row'>

      <div className="docs-example docs-example--spacing">
        <h3> 
          <p><code className="small">disabled=(true)</code></p>
        </h3>
        <CallControl
          type='microphone-muted'
          disabled
          onClick={() => {}}
          ariaLabel='For the Win'
        />
      </div>

    </div>
  );
}

**/

/**
* @name Call-Control cancel
* @description Call-Control with cancel class.
*
* @category controls
* @component call-control
* @section cancel
*
* @js

export default function CallControlCancel() {
  return(
      <div className='row'>

      <div className="docs-example docs-example--spacing">
        <h3> 
          <p><code className="small">type=(cancel)</code></p>
        </h3>
        <CallControl
          type='cancel'
          active
          onClick={() => {}}
          ariaLabel='For the Win'
        />
      </div>

    </div>
  );
}

**/

exports.default = _default;