import React, { useEffect } from 'react';
import { isFunction } from "../../../lib/utils";
import { CommonWrapper } from "../../../internal/CommonWrapper";
import { useResponsiveLayout } from "../useResponsiveLayout";

/**
 * Компонент `ResponsiveLayout` для определения текущего лэйаута.
 */
export function ResponsiveLayout(props) {
  var _props$children, _props$children2;
  var layoutFlags = useResponsiveLayout({
    customMediaQueries: props.customMediaQueries
  });
  useEffect(function () {
    if (props.onLayoutChange) {
      props.onLayoutChange(layoutFlags);
    }
  }, [layoutFlags]);
  return /*#__PURE__*/(
    React.createElement(CommonWrapper, props, 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';