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 } from 'react';
import PropTypes from 'prop-types';
import Body from './Body';
import Footer from './Footer';
import Header from './Header';
import { IslandGroup } from '../island';
/**
 * @type {React.ComponentType<any> & {
 *    Header: React.ComponentType<any>;
 *    Body: React.ComponentType<any>;
 *    Footer: React.ComponentType<any>;
 * }}
 */

var Widget = /*#__PURE__*/forwardRef(function (_ref, ref) {
  var children = _ref.children,
      size = _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__*/React.cloneElement(child, _objectSpread(_objectSpread({}, child.props), {}, {
      size: size
    }));
  }));
});
Widget.displayName = 'Widget';
Widget.defaultProps = {
  size: 'medium'
};
Widget.Body = Body;
Widget.Footer = Footer;
Widget.Header = Header;
export default Widget;