react-multi-email
Advanced tools
Comparing version 0.4.4 to 0.5.0
@@ -5,2 +5,3 @@ import * as React from 'react'; | ||
onChange?: (emails: string[]) => void; | ||
validateEmail?: (email: string) => boolean; | ||
style?: object; | ||
@@ -7,0 +8,0 @@ getLabel: (email: string, index: number, removeEmail: (index: number) => void) => void; |
@@ -25,5 +25,7 @@ "use strict"; | ||
_this.findEmailAddress = function (value, isEnter) { | ||
var validateEmail = _this.props.validateEmail; | ||
var validEmails = []; | ||
var inputValue = ''; | ||
var re = /[ ,;]/g; | ||
var isEmail = validateEmail || isEmail_1.default; | ||
var addEmails = function (email) { | ||
@@ -45,3 +47,3 @@ var emails = _this.state.emails; | ||
do { | ||
if (isEmail_1.default('' + arr[0])) { | ||
if (isEmail('' + arr[0])) { | ||
addEmails('' + arr.shift()); | ||
@@ -62,3 +64,3 @@ } | ||
if (isEnter) { | ||
if (isEmail_1.default(value)) { | ||
if (isEmail(value)) { | ||
addEmails(value); | ||
@@ -65,0 +67,0 @@ } |
@@ -5,2 +5,3 @@ import * as React from 'react'; | ||
onChange?: (emails: string[]) => void; | ||
validateEmail?: (email: string) => boolean; | ||
style?: object; | ||
@@ -7,0 +8,0 @@ getLabel: (email: string, index: number, removeEmail: (index: number) => void) => void; |
import * as React from 'react'; | ||
import isEmail from './isEmail'; | ||
import isEmailFn from './isEmail'; | ||
class ReactMultiEmail extends React.Component { | ||
@@ -12,5 +12,7 @@ constructor(props) { | ||
this.findEmailAddress = (value, isEnter) => { | ||
const { validateEmail } = this.props; | ||
let validEmails = []; | ||
let inputValue = ''; | ||
const re = /[ ,;]/g; | ||
const isEmail = validateEmail || isEmailFn; | ||
const addEmails = (email) => { | ||
@@ -17,0 +19,0 @@ const emails = this.state.emails; |
{ | ||
"name": "react-multi-email", | ||
"version": "0.4.4", | ||
"version": "0.5.0", | ||
"description": "React multi email input", | ||
@@ -5,0 +5,0 @@ "jsnext:main": "es6/index.js", |
@@ -27,3 +27,3 @@ [![npm version](https://badge.fury.io/js/react-multi-email.svg)](https://badge.fury.io/js/react-multi-email) | ||
import * as React from 'react'; | ||
import { ReactMultiEmail } from 'react-multi-email'; | ||
import { ReactMultiEmail, isEmail } from 'react-multi-email'; | ||
import 'react-multi-email/style.css'; | ||
@@ -52,2 +52,5 @@ | ||
}} | ||
validateEmail={email => { | ||
return isEmail(email); // return boolean | ||
}} | ||
getLabel={( | ||
@@ -54,0 +57,0 @@ email: string, |
28901
719
85