@codacy/ui-components 0.66.39 → 0.66.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Input/hooks.js +3 -1
- package/package.json +1 -1
package/lib/Input/hooks.js
CHANGED
|
@@ -201,7 +201,9 @@ function generateRegexInputValidator(regex, errorMessage, inputType) {
|
|
|
201
201
|
errorMessage: errorMessage
|
|
202
202
|
}], inputType);
|
|
203
203
|
}
|
|
204
|
-
export const useEmailInput = generateRegexInputValidator(
|
|
204
|
+
export const useEmailInput = generateRegexInputValidator(
|
|
205
|
+
// Domains are limited to 2-64 characters according to https://emailregex.com
|
|
206
|
+
/^([a-zA-Z0-9_\-.]+)@([a-zA-Z0-9_\-.]+)\.([a-zA-Z]{2,64})$/, 'Insert a valid email address', 'email');
|
|
205
207
|
export const useUrlInput = generateRegexInputValidator(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www\.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w\-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[.!/\\\w]*))?)/, 'Insert a valid URL', 'url');
|
|
206
208
|
export const useRegexInput = (regex, errorMessage, inputType) => {
|
|
207
209
|
return generateRegexInputValidator(regex, errorMessage, inputType);
|