import { defineCellType } from '../../types';
import { EmailView } from './View';
import { EmailEdit } from './Edit';
import { emailValidation } from '@wix/patterns-fields/validations';
export { EmailView, EmailEdit };
export const emailCellType = defineCellType({
    type: 'email',
    ViewComponent: EmailView,
    EditComponent: EmailEdit,
    serialize: (value) => value ?? '',
    deserialize: (raw) => raw,
    validate: (value) => {
        if (value && !emailValidation.isValid(value)) {
            return 'Invalid email format';
        }
        return null;
    },
    editable: true,
    clearable: true,
    onTypeToEdit: ({ key }) => ({ value: key }),
});
//# sourceMappingURL=index.js.map