lion/packages/input-email/src/LionInputEmail.js
Thomas Allmer 396deb2e3b feat: finalize validation and adopt it everywhere
Co-authored-by: Alex Ghiu <alex.ghiu@ing.com>
Co-authored-by: Gerjan van Geest <Gerjan.van.Geest@ing.com>
Co-authored-by: Thijs Louisse <Thijs.Louisse@ing.com>
Co-authored-by: Joren Broekema <joren.broekema@ing.com>
Co-authored-by: Erik Kroes <erik.kroes@ing.com>
2019-11-18 15:30:08 +01:00

23 lines
845 B
JavaScript

import { LocalizeMixin } from '@lion/localize';
import { FieldCustomMixin } from '@lion/field';
import { LionInput } from '@lion/input';
import { IsEmail } from '@lion/validate';
/**
* LionInputEmail: extension of lion-input
*
* @customElement lion-input-email
* @extends {LionInput}
*/
export class LionInputEmail extends FieldCustomMixin(LocalizeMixin(LionInput)) {
constructor() {
super();
// local-part@domain where the local part may be up to 64 characters long
// and the domain may have a maximum of 255 characters
// @see https://www.wikiwand.com/en/Email_address
// however, the longest active email is even bigger
// @see https://laughingsquid.com/the-worlds-longest-active-email-address/
// we don't want to forbid Mr. Peter Craig email right?
this.defaultValidators.push(new IsEmail());
}
}