"use strict";

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

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

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

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

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

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

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

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

var _excluded = ["content", "type"];

var TitleField = function TitleField(_ref) {
  var _uiSchema$uiOptions, _uiSchema$uiOptions$e, _idSchema$$id;

  var idSchema = _ref.idSchema,
      uiSchema = _ref.uiSchema;
  var content = uiSchema === null || uiSchema === void 0 ? void 0 : (_uiSchema$uiOptions = uiSchema['ui:options']) === null || _uiSchema$uiOptions === void 0 ? void 0 : (_uiSchema$uiOptions$e = _uiSchema$uiOptions.element) === null || _uiSchema$uiOptions$e === void 0 ? void 0 : _uiSchema$uiOptions$e.content;
  var headerNumber = (idSchema === null || idSchema === void 0 ? void 0 : (_idSchema$$id = idSchema.$id) === null || _idSchema$$id === void 0 ? void 0 : _idSchema$$id.split('_').length) + 1;
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_core.Typography, {
    component: headerNumber < 5 ? "h".concat(headerNumber) : 'h6',
    variant: "h5",
    children: content
  });
};

exports.TitleField = TitleField;

var _default = (0, _extendType["default"])(_dummy2["default"], function (_ref2) {
  var _ref2$config = _ref2.config,
      content = _ref2$config.content,
      type = _ref2$config.type,
      other = (0, _objectWithoutProperties2["default"])(_ref2$config, _excluded);
  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'] = TitleField;
    props.uiSchema['ui:should-update'] = content;
  };
});

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