import React__default from 'react';
import PropTypes from 'prop-types';
import SelectMenu from '../../select-menu/index.js';
import '../../extends-C4cduGrv.js';
import '../../objectWithoutProperties-TXwlfNxG.js';
import '../../select-menu-BvA3x4Nf.js';
import '../../slicedToArray-BB-AwwkK.js';
import '../../defineProperty-CEd-kZQW.js';
import '../../floating-ui.react-cWPyyUrN.js';
import '../../typeof-CgC7Bq6K.js';
import '../../toConsumableArray-dKQYsfpV.js';
import '../../index-qSfOyGhk.js';
import 'react-dom';
import 'classnames';
import '../../_commonjsHelpers-_1FafXWI.js';
import '../../label/index.js';
import '@reach/visually-hidden';
import '../../ck-icon/index.js';
import '../../ck-icon/assets/icon-map/index.js';
import '../../icon/index.js';
import '@fortawesome/react-fontawesome';
import '../../icon/icons.js';
import '../../icon/library.js';
import '@fortawesome/fontawesome-svg-core';
import '@fortawesome/pro-solid-svg-icons';
import '@fortawesome/pro-light-svg-icons';
import '@fortawesome/free-brands-svg-icons';
import '../../portal/index.js';
import '../../use-rerender-once/index.js';
import '../../use-force-update/index.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 };
