"use strict";

exports.__esModule = true;
exports.emailCellType = void 0;
var _types = require("../../types");
var _View = require("./View");
exports.EmailView = _View.EmailView;
var _Edit = require("./Edit");
exports.EmailEdit = _Edit.EmailEdit;
var _validations = require("@wix/patterns-fields/validations");
const emailCellType = exports.emailCellType = (0, _types.defineCellType)({
  type: 'email',
  ViewComponent: _View.EmailView,
  EditComponent: _Edit.EmailEdit,
  serialize: value => value ?? '',
  deserialize: raw => raw,
  validate: value => {
    if (value && !_validations.emailValidation.isValid(value)) {
      return 'Invalid email format';
    }
    return null;
  },
  editable: true,
  clearable: true,
  onTypeToEdit: ({
    key
  }) => ({
    value: key
  })
});
//# sourceMappingURL=index.js.map