import React__default from 'react';
import { u as uuidv4 } from '../uuid-a79b5ba8.js';

const componentClassName = 'sendbird-sort-by-row';
function SortByRow(_ref) {
  let {
    className = '',
    maxItemCount,
    itemWidth,
    itemHeight,
    children
  } = _ref;
  if (Array.isArray(children) && children.length > maxItemCount) {
    const result = [];
    for (let i = 0; i < children.length; i += maxItemCount) {
      result.push( /*#__PURE__*/React__default.createElement("div", {
        className: [...(Array.isArray(className) ? className : [className]), componentClassName].join(' '),
        key: uuidv4(),
        style: {
          width: itemWidth * maxItemCount,
          height: itemHeight
        }
      }, children.slice(i, i + maxItemCount)));
    }
    return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, result);
  }
  return /*#__PURE__*/React__default.createElement("div", {
    className: [...(Array.isArray(className) ? className : [className]), componentClassName].join(' '),
    style: {
      width: itemWidth * (Array.isArray(children) ? children.length : 1),
      height: itemHeight
    }
  }, children);
}

export { SortByRow as default };
//# sourceMappingURL=SortByRow.js.map
