import _extends from "@babel/runtime/helpers/esm/extends";
import React from 'react';
import { Checkbox } from "../../../components/Checkbox";
export var getComponentsFromPropsList = function getComponentsFromPropsList(component, propsList) {
  return propsList.reduce(function (result, props, index) {
    // NOTE: все это ради чекбокса с фокусом, т.к. нет ни focused, ни autofocus; а ref+focus() снаружи нестабилен
    var isCheckbox = component.type === Checkbox;
    if (isCheckbox) {
      var checkboxProps = props;
      if (checkboxProps.focused) {
        checkboxProps.ref = function (el) {
          if (el) {
            el.setState({
              focusedByTab: true
            });
          }
        };
        delete checkboxProps.focused;
      }
    }
    var elementWithProps = /*#__PURE__*/React.cloneElement(component, _extends({}, props, {
      key: index
    }));
    return [].concat(result, [elementWithProps]);
  }, []);
};