import { makeStyles } from '@material-ui/core/styles';
import { defineMessage } from 'react-intl';
import _dummy from './_dummy';
import extendType from './_extendType';
import { jsx as _jsx } from "react/jsx-runtime";
var useStyles = makeStyles({
  root: {
    maxWidth: '100%',
    width: 'fit-content'
  }
});

function Image(props) {
  var _props$uiSchema$uiOp = props.uiSchema['ui:options'].element,
      url = _props$uiSchema$uiOp.url,
      altText = _props$uiSchema$uiOp.altText;
  var classes = useStyles();
  return /*#__PURE__*/_jsx("img", {
    src: url,
    alt: altText,
    className: classes.root
  });
}

export default extendType(_dummy, function (_ref) {
  var _ref$config = _ref.config,
      altText = _ref$config.altText,
      url = _ref$config.url,
      type = _ref$config.type;
  return function (props) {
    var _props$uiSchema;

    props.schema.additionalType = type;
    (_props$uiSchema = props.uiSchema) !== null && _props$uiSchema !== void 0 ? _props$uiSchema : props.uiSchema = {};
    props.uiSchema['ui:field'] = Image;
    props.uiSchema['ui:should-update'] = "".concat(url, "-").concat(altText);
  };
});
export var name = defineMessage({
  id: "TuztIS",
  defaultMessage: [{
    "type": 0,
    "value": "Kuva"
  }]
});
export var elementType = 'element';
//# sourceMappingURL=image.js.map