"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.Spinner = void 0;

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

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

var _classnames = _interopRequireDefault(require("classnames"));

var _i18n = require("../i18n");

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

var Spinner = function Spinner(props) {
  var _props$ariaValuetext;

  var className = (0, _classnames.default)('ds-c-spinner', props.size && "ds-c-spinner--".concat(props.size), props.inversed && 'ds-c-spinner--inverse', props.filled && 'ds-c-spinner--filled', props.className);
  return /*#__PURE__*/_react.default.createElement("span", {
    className: className,
    role: props.role
  }, /*#__PURE__*/_react.default.createElement("span", {
    className: "ds-u-visibility--screen-reader"
  }, (_props$ariaValuetext = props['aria-valuetext']) !== null && _props$ariaValuetext !== void 0 ? _props$ariaValuetext : (0, _i18n.t)('spinner.ariaText')));
};

exports.Spinner = Spinner;
Spinner.propTypes = {
  /**
     * The text announced to screen readers
     */
  'aria-valuetext': _propTypes.default.string,

  /**
     * Additional classes to be added to the spinner element.
     * Useful for adding utility classes.
     */
  className: _propTypes.default.string,

  /**
     * Applies the inverse theme styling
     */
  inversed: _propTypes.default.bool,

  /**
     * Adds a background behind the spinner for extra contrast
     */
  filled: _propTypes.default.bool,

  /**
     * Landmark role so the spinner can receive keyboard focus
     */
  role: _propTypes.default.string,

  /**
     * Smaller or larger variant
     */
  size: _propTypes.default.oneOf(['small', 'big'])
};
Spinner.defaultProps = {
  role: 'status'
};
var _default = Spinner;
exports.default = _default;