import _extends from "@babel/runtime/helpers/extends";
import React, { useEffect } from 'react';
import { ElementName } from '../../../../../constants';
import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
import { BaseAvatarGroupElement, toAvatarGroupProps } from '../common';
const OwnedByGroupElement = props => {
  const context = useFlexibleUiContext();
  const data = context ? toAvatarGroupProps(context.ownedByGroup, false) : null;
  const {
    onRender,
    ...restProps
  } = props || {};
  useEffect(() => {
    onRender === null || onRender === void 0 ? void 0 : onRender(!!data);
  }, [data, onRender]);
  return data ? /*#__PURE__*/React.createElement(BaseAvatarGroupElement, _extends({}, data, restProps, {
    name: ElementName.OwnedByGroup
  })) : null;
};
export default OwnedByGroupElement;