"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.elementType = exports.name = exports["default"] = void 0;

var _styles = require("@material-ui/core/styles");

var _reactIntl = require("react-intl");

var _dummy2 = _interopRequireDefault(require("./_dummy"));

var _extendType = _interopRequireDefault(require("./_extendType"));

var _jsxRuntime = require("react/jsx-runtime");

var useStyles = (0, _styles.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__*/(0, _jsxRuntime.jsx)("img", {
    src: url,
    alt: altText,
    className: classes.root
  });
}

var _default = (0, _extendType["default"])(_dummy2["default"], 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);
  };
});

exports["default"] = _default;
var name = (0, _reactIntl.defineMessage)({
  id: "TuztIS",
  defaultMessage: [{
    "type": 0,
    "value": "Kuva"
  }]
});
exports.name = name;
var elementType = 'element';
exports.elementType = elementType;
//# sourceMappingURL=image.cjs.map