"use strict";

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

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

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

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

var _text = _interopRequireDefault(require("./text"));

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

var _default = (0, _extendType["default"])(_text["default"], function (_ref) {
  var config = _ref.config;
  return function (props) {
    var _props$schema, _props$uiSchema;

    (_props$schema = props.schema) !== null && _props$schema !== void 0 ? _props$schema : props.schema = {};
    props.schema = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props.schema), {}, {
      pattern: config.required ? '[^\\s]+^$|^(.*@[a-zA-Z0-9]+[a-zA-Z0-9\\.-]*\\.[a-zA-Z0-9]{2,})$' : '^$|^(.*@[a-zA-Z0-9]+[a-zA-Z0-9\\.-]*\\.[a-zA-Z0-9]{2,})$'
    });
    (_props$uiSchema = props.uiSchema) !== null && _props$uiSchema !== void 0 ? _props$uiSchema : props.uiSchema = {};
    props.uiSchema['ui:widget'] = 'email';
  };
});

exports["default"] = _default;
var name = (0, _reactIntl.defineMessage)({
  id: "BCgKet",
  defaultMessage: [{
    "type": 0,
    "value": "Sähköpostiosoite"
  }]
});
exports.name = name;
var elementType = 'field';
exports.elementType = elementType;
//# sourceMappingURL=email.cjs.map