import _extends from "@babel/runtime/helpers/extends";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["children", "size"];

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

import React, { forwardRef, isValidElement } from 'react';
import Body from './Body';
import Footer from './Footer';
import Header from './Header';
import { IslandGroup } from '../island';
export var Widget = /*#__PURE__*/forwardRef(function (_ref, ref) {
  var children = _ref.children,
      _ref$size = _ref.size,
      size = _ref$size === void 0 ? 'medium' : _ref$size,
      others = _objectWithoutProperties(_ref, _excluded);

  return /*#__PURE__*/React.createElement(IslandGroup, _extends({
    ref: ref,
    direction: "vertical"
  }, others), React.Children.map(children, function (child) {
    if (!child) {
      return child;
    }

    return /*#__PURE__*/isValidElement(child) && /*#__PURE__*/React.cloneElement(child, _objectSpread(_objectSpread({}, child.props), {}, {
      size: size
    }));
  }));
});
Widget.displayName = 'Widget'; // It has to be written like this, since `forwardRef` return component without sub-components and that doesn't match with our typing

var WidgetWithSubComponents = Widget;
WidgetWithSubComponents.Body = Body;
WidgetWithSubComponents.Footer = Footer;
WidgetWithSubComponents.Header = Header;
export default WidgetWithSubComponents;