import React__default from 'react';
import PropTypes from 'prop-types';
import SelectMenu from '../../select-menu/index.js';
import '../../extends-e61fd370.js';
import '../../objectWithoutProperties-72d23964.js';
import '../../select-74202a5d.js';
import '../../defineProperty-18999f8e.js';
import '../../slicedToArray-5b664d46.js';
import '../../index-99927619.js';
import '../../typeof-6c6d8d7a.js';
import '../../toConsumableArray-f2f53597.js';
import '../../index-81a9bdac.js';
import 'react-dom';
import 'classnames';
import '../../icon/assets/icon-map/index.js';
import '../../social-icon/index.js';
import '@fortawesome/react-fontawesome';
import '../../social-icon/icons.js';
import '../../social-icon/library.js';
import '@fortawesome/fontawesome-svg-core';
import '@fortawesome/free-solid-svg-icons';
import '@fortawesome/free-brands-svg-icons';
import '../../tooltip/index.js';
import '../../auto-id.esm-2b54f757.js';
import '../../utils.esm-514fad91.js';
import '../../warning-ed2bf294.js';
import '../../portal.esm-613949dc.js';
import '@reach/visually-hidden';
import '../../portal/index.js';
import '../../use-rerender-once/index.js';
import '../../use-force-update/index.js';
import '../../button/button-group.js';
import '../../inject-css-ccd0a386.js';
import '../../_commonjsHelpers-57e89916.js';
import '../../label/index.js';
import '../../select-menu/util.js';
import '../../select-menu/autocomplete.js';

function PerPageSelect(_ref) {
  var value = _ref.value,
      onSelect = _ref.onSelect,
      _ref$options = _ref.options,
      perPageOptions = _ref$options === void 0 ? [10, 25, 50] : _ref$options;
  var options = perPageOptions.includes(value) ? perPageOptions : perPageOptions.concat(value).toSorted(function (a, b) {
    return a - b;
  });
  return /*#__PURE__*/React__default.createElement(SelectMenu, {
    "aria-label": "Results per page",
    value: value,
    onChange: function onChange(event) {
      return onSelect(event.target.value);
    },
    options: options.map(function (option) {
      return {
        value: option,
        label: "".concat(option, " per page")
      };
    })
  });
}
PerPageSelect.propTypes = {
  value: PropTypes.number.isRequired,
  onSelect: PropTypes.func.isRequired,
  options: PropTypes.arrayOf(PropTypes.number)
};

export { PerPageSelect as default };
