@trackunit/react-form-components 0.0.273 → 0.0.276
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/index.cjs.js +6 -5
- package/index.esm.js +6 -6
- package/package.json +1 -1
- package/src/utilities/emailUtils.d.ts +1 -0
package/index.cjs.js
CHANGED
|
@@ -662,6 +662,9 @@ const DropZone = (_a) => {
|
|
|
662
662
|
} }, rest, { children: [jsxRuntime.jsx("input", { title: "Hidden File Input", type: "file", id: "input-file-upload", onChange: handleChange, className: "hidden" }), jsxRuntime.jsxs("label", { className: cvaDropZoneLabel(), htmlFor: "input-file-upload", "data-testid": dataTestId && `${dataTestId}-label`, children: [jsxRuntime.jsx(reactComponents.Icon, { type: "solid", name: "ArrowUpCircle", color: isInvalid ? "danger" : "neutral", style: !isInvalid ? { color: "rgb(156 163 175)" } : {} }), jsxRuntime.jsx("span", { children: label })] })] })));
|
|
663
663
|
};
|
|
664
664
|
|
|
665
|
+
// Doing the same check as we do on the backend
|
|
666
|
+
// Using OWASP pattern from: https://owasp.org/www-community/OWASP_Validation_Regex_Repository
|
|
667
|
+
const EMAIL_REGEX = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
|
|
665
668
|
/**
|
|
666
669
|
* @description Validate given email id.
|
|
667
670
|
* @param email The address to validate.
|
|
@@ -672,10 +675,7 @@ const validateEmailAddress = (email) => {
|
|
|
672
675
|
if (!email) {
|
|
673
676
|
return false;
|
|
674
677
|
}
|
|
675
|
-
|
|
676
|
-
// Using OWASP pattern from: https://owasp.org/www-community/OWASP_Validation_Regex_Repository
|
|
677
|
-
const emailValidationPattern = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
|
|
678
|
-
return emailValidationPattern.test(email);
|
|
678
|
+
return EMAIL_REGEX.test(email);
|
|
679
679
|
};
|
|
680
680
|
|
|
681
681
|
/**
|
|
@@ -1526,7 +1526,7 @@ const PhoneInput = React.forwardRef((_a, ref) => {
|
|
|
1526
1526
|
// the event's type is inferred as Event, which doesn't have a target property, whereas ChangeEvent does.
|
|
1527
1527
|
onChange && onChange(event);
|
|
1528
1528
|
}, [phoneNumber, onChange]);
|
|
1529
|
-
return (jsxRuntime.jsxs("div", { className: "grid-cols-min-fr grid gap-2", "data-testid": dataTestId && `${dataTestId}-container`, children: [jsxRuntime.jsx("input", { hidden: true, id: "phone-input", "data-testid": dataTestId, value: phoneNumber, ref: hiddenInputRef, onChange: onChange, "aria-invalid": isInvalid }), jsxRuntime.jsx(CountryCodeSelect, { dataTestId: dataTestId && `${dataTestId}-countryCodeSelect`, countryCode: code, onBlur: e => {
|
|
1529
|
+
return (jsxRuntime.jsxs("div", { className: "grid-cols-min-fr grid gap-2", "data-testid": dataTestId && `${dataTestId}-container`, children: [jsxRuntime.jsx("input", { hidden: true, id: "phone-input", "data-testid": dataTestId, value: phoneNumber, ref: hiddenInputRef, onChange: onChange, "aria-invalid": isInvalid, readOnly: readOnly }), jsxRuntime.jsx(CountryCodeSelect, { dataTestId: dataTestId && `${dataTestId}-countryCodeSelect`, countryCode: code, onBlur: e => {
|
|
1530
1530
|
onBlurHandler();
|
|
1531
1531
|
}, onChange: e => {
|
|
1532
1532
|
var _a;
|
|
@@ -2247,6 +2247,7 @@ exports.CreatableSelect = CreatableSelect;
|
|
|
2247
2247
|
exports.DateField = DateField;
|
|
2248
2248
|
exports.DateInput = DateInput;
|
|
2249
2249
|
exports.DropZone = DropZone;
|
|
2250
|
+
exports.EMAIL_REGEX = EMAIL_REGEX;
|
|
2250
2251
|
exports.EmailField = EmailField;
|
|
2251
2252
|
exports.EmailInput = EmailInput;
|
|
2252
2253
|
exports.FormGroup = FormGroup;
|
package/index.esm.js
CHANGED
|
@@ -632,6 +632,9 @@ const DropZone = (_a) => {
|
|
|
632
632
|
} }, rest, { children: [jsx("input", { title: "Hidden File Input", type: "file", id: "input-file-upload", onChange: handleChange, className: "hidden" }), jsxs("label", { className: cvaDropZoneLabel(), htmlFor: "input-file-upload", "data-testid": dataTestId && `${dataTestId}-label`, children: [jsx(Icon, { type: "solid", name: "ArrowUpCircle", color: isInvalid ? "danger" : "neutral", style: !isInvalid ? { color: "rgb(156 163 175)" } : {} }), jsx("span", { children: label })] })] })));
|
|
633
633
|
};
|
|
634
634
|
|
|
635
|
+
// Doing the same check as we do on the backend
|
|
636
|
+
// Using OWASP pattern from: https://owasp.org/www-community/OWASP_Validation_Regex_Repository
|
|
637
|
+
const EMAIL_REGEX = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
|
|
635
638
|
/**
|
|
636
639
|
* @description Validate given email id.
|
|
637
640
|
* @param email The address to validate.
|
|
@@ -642,10 +645,7 @@ const validateEmailAddress = (email) => {
|
|
|
642
645
|
if (!email) {
|
|
643
646
|
return false;
|
|
644
647
|
}
|
|
645
|
-
|
|
646
|
-
// Using OWASP pattern from: https://owasp.org/www-community/OWASP_Validation_Regex_Repository
|
|
647
|
-
const emailValidationPattern = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
|
|
648
|
-
return emailValidationPattern.test(email);
|
|
648
|
+
return EMAIL_REGEX.test(email);
|
|
649
649
|
};
|
|
650
650
|
|
|
651
651
|
/**
|
|
@@ -1496,7 +1496,7 @@ const PhoneInput = forwardRef((_a, ref) => {
|
|
|
1496
1496
|
// the event's type is inferred as Event, which doesn't have a target property, whereas ChangeEvent does.
|
|
1497
1497
|
onChange && onChange(event);
|
|
1498
1498
|
}, [phoneNumber, onChange]);
|
|
1499
|
-
return (jsxs("div", { className: "grid-cols-min-fr grid gap-2", "data-testid": dataTestId && `${dataTestId}-container`, children: [jsx("input", { hidden: true, id: "phone-input", "data-testid": dataTestId, value: phoneNumber, ref: hiddenInputRef, onChange: onChange, "aria-invalid": isInvalid }), jsx(CountryCodeSelect, { dataTestId: dataTestId && `${dataTestId}-countryCodeSelect`, countryCode: code, onBlur: e => {
|
|
1499
|
+
return (jsxs("div", { className: "grid-cols-min-fr grid gap-2", "data-testid": dataTestId && `${dataTestId}-container`, children: [jsx("input", { hidden: true, id: "phone-input", "data-testid": dataTestId, value: phoneNumber, ref: hiddenInputRef, onChange: onChange, "aria-invalid": isInvalid, readOnly: readOnly }), jsx(CountryCodeSelect, { dataTestId: dataTestId && `${dataTestId}-countryCodeSelect`, countryCode: code, onBlur: e => {
|
|
1500
1500
|
onBlurHandler();
|
|
1501
1501
|
}, onChange: e => {
|
|
1502
1502
|
var _a;
|
|
@@ -2206,4 +2206,4 @@ const UrlField = forwardRef((_a, ref) => {
|
|
|
2206
2206
|
*/
|
|
2207
2207
|
setupLibraryTranslations();
|
|
2208
2208
|
|
|
2209
|
-
export { ActionButton, BaseInput, Checkbox, CreatableSelect, DateField, DateInput, DropZone, EmailField, EmailInput, FormGroup, Label, MultiSelectMenuItem, NumberField, NumberInput, OptionCard, PasswordField, PasswordInput, PhoneField, PhoneInput, RadioGroup, RadioItem, Schedule, ScheduleVariant, Search, Select, SingleSelectMenuItem, TextArea, TextAreaField, TextField, TextInput, TimeRange, TimeRangeField, Toggle, UploadField, UploadInput, UrlField, UrlInput, checkIfPhoneNumberHasPlus, countryCodeToFlagEmoji, cvaInput, cvaInputAddon, cvaInputAddonAfter, cvaInputAddonBefore, cvaInputBase, cvaInputBaseDisabled, cvaInputBaseInvalid, cvaInputField, cvaInputPrefix, cvaInputSuffix, cvaSelect, cvaSelectCounter, cvaSelectDynamicTagContainer, cvaSelectIcon, cvaSelectMenu, cvaSelectMenuList, cvaSelectPrefix, cvaSelectXIcon, getCountryAbbreviation, getOrderedOptions, getPhoneNumberWithPlus, isInvalidCountryCode, isInvalidPhoneNumber, isMultiValue, parseSchedule, serializeSchedule, useCustomComponents, usePhoneInput, validateEmailAddress, validatePhoneNumber, weekDay };
|
|
2209
|
+
export { ActionButton, BaseInput, Checkbox, CreatableSelect, DateField, DateInput, DropZone, EMAIL_REGEX, EmailField, EmailInput, FormGroup, Label, MultiSelectMenuItem, NumberField, NumberInput, OptionCard, PasswordField, PasswordInput, PhoneField, PhoneInput, RadioGroup, RadioItem, Schedule, ScheduleVariant, Search, Select, SingleSelectMenuItem, TextArea, TextAreaField, TextField, TextInput, TimeRange, TimeRangeField, Toggle, UploadField, UploadInput, UrlField, UrlInput, checkIfPhoneNumberHasPlus, countryCodeToFlagEmoji, cvaInput, cvaInputAddon, cvaInputAddonAfter, cvaInputAddonBefore, cvaInputBase, cvaInputBaseDisabled, cvaInputBaseInvalid, cvaInputField, cvaInputPrefix, cvaInputSuffix, cvaSelect, cvaSelectCounter, cvaSelectDynamicTagContainer, cvaSelectIcon, cvaSelectMenu, cvaSelectMenuList, cvaSelectPrefix, cvaSelectXIcon, getCountryAbbreviation, getOrderedOptions, getPhoneNumberWithPlus, isInvalidCountryCode, isInvalidPhoneNumber, isMultiValue, parseSchedule, serializeSchedule, useCustomComponents, usePhoneInput, validateEmailAddress, validatePhoneNumber, weekDay };
|
package/package.json
CHANGED