"use strict";var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;exports.__esModule = true;exports.ResponsiveLayout = ResponsiveLayout;var _react = _interopRequireWildcard(require("react"));

var _utils = require("../../lib/utils");
var _CommonWrapper = require("../../internal/CommonWrapper");


var _useResponsiveLayout = require("./useResponsiveLayout");












/**
 * Компонент `ResponsiveLayout` для определения текущего лэйаута.
 */
function ResponsiveLayout(props) {var _props$children, _props$children2;
  var layoutFlags = (0, _useResponsiveLayout.useResponsiveLayout)({ customMediaQueries: props.customMediaQueries });

  (0, _react.useEffect)(function () {
    if (props.onLayoutChange) {
      props.onLayoutChange(layoutFlags);
    }
  }, [layoutFlags]);

  return /*#__PURE__*/(
    _react.default.createElement(_CommonWrapper.CommonWrapper, props,
    (0, _utils.isFunction)(props.children) ? (_props$children = props.children(layoutFlags)) != null ? _props$children : null : (_props$children2 = props.children) != null ? _props$children2 : null
    ));

}

ResponsiveLayout.__KONTUR_REACT_UI__ = 'ResponsiveLayout';
ResponsiveLayout.displayName = 'ResponsiveLayout';