@salutejs/plasma-new-hope 0.194.0-canary.1565.11870784206.0 → 0.194.0-dev.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Switch/Switch.css +2 -2
- package/cjs/components/Switch/Switch.tokens.js +7 -1
- package/cjs/components/Switch/Switch.tokens.js.map +1 -1
- package/cjs/components/Switch/_toggleSize/base.js +1 -1
- package/cjs/components/Switch/_toggleSize/base.js.map +1 -1
- package/cjs/components/Switch/_toggleSize/base_1d0b3t4.css +1 -0
- package/cjs/components/Switch/_view/base.js +1 -1
- package/cjs/components/Switch/_view/base.js.map +1 -1
- package/cjs/components/Switch/_view/base_15atbyp.css +1 -0
- package/cjs/components/TextField/TextField.js +3 -27
- package/cjs/components/TextField/TextField.js.map +1 -1
- package/cjs/index.css +2 -2
- package/cjs/utils/constants.js +0 -4
- package/cjs/utils/constants.js.map +1 -1
- package/emotion/cjs/components/Switch/Switch.tokens.js +7 -1
- package/emotion/cjs/components/Switch/_toggleSize/base.js +1 -1
- package/emotion/cjs/components/Switch/_view/base.js +1 -1
- package/emotion/cjs/components/TextField/TextField.js +4 -27
- package/emotion/cjs/components/TextField/TextField.template-doc.mdx +0 -330
- package/emotion/cjs/components/TextField/hooks/index.js +1 -8
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.config.js +8 -8
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.js +5 -2
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.outline.config.js +37 -0
- package/emotion/cjs/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
- package/emotion/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx +1 -253
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.config.js +8 -8
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.js +5 -2
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.outline.config.js +37 -0
- package/emotion/cjs/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
- package/emotion/cjs/examples/plasma_web/components/TextField/TextField.stories.tsx +0 -252
- package/emotion/cjs/utils/constants.js +2 -4
- package/emotion/es/components/Switch/Switch.tokens.js +7 -1
- package/emotion/es/components/Switch/_toggleSize/base.js +1 -1
- package/emotion/es/components/Switch/_view/base.js +1 -1
- package/emotion/es/components/TextField/TextField.js +5 -28
- package/emotion/es/components/TextField/TextField.template-doc.mdx +0 -330
- package/emotion/es/components/TextField/hooks/index.js +1 -2
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.config.js +8 -8
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.js +4 -1
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.outline.config.js +31 -0
- package/emotion/es/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
- package/emotion/es/examples/plasma_b2c/components/TextField/TextField.stories.tsx +1 -253
- package/emotion/es/examples/plasma_web/components/Switch/Switch.config.js +8 -8
- package/emotion/es/examples/plasma_web/components/Switch/Switch.js +4 -1
- package/emotion/es/examples/plasma_web/components/Switch/Switch.outline.config.js +31 -0
- package/emotion/es/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
- package/emotion/es/examples/plasma_web/components/TextField/TextField.stories.tsx +0 -252
- package/emotion/es/utils/constants.js +1 -3
- package/es/components/Switch/Switch.css +2 -2
- package/es/components/Switch/Switch.tokens.js +7 -1
- package/es/components/Switch/Switch.tokens.js.map +1 -1
- package/es/components/Switch/_toggleSize/base.js +1 -1
- package/es/components/Switch/_toggleSize/base.js.map +1 -1
- package/es/components/Switch/_toggleSize/base_1d0b3t4.css +1 -0
- package/es/components/Switch/_view/base.js +1 -1
- package/es/components/Switch/_view/base.js.map +1 -1
- package/es/components/Switch/_view/base_15atbyp.css +1 -0
- package/es/components/TextField/TextField.js +3 -27
- package/es/components/TextField/TextField.js.map +1 -1
- package/es/index.css +2 -2
- package/es/utils/constants.js +1 -3
- package/es/utils/constants.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/components/Switch/Switch.tokens.js +7 -1
- package/styled-components/cjs/components/Switch/_toggleSize/base.js +1 -1
- package/styled-components/cjs/components/Switch/_view/base.js +1 -1
- package/styled-components/cjs/components/TextField/TextField.js +3 -26
- package/styled-components/cjs/components/TextField/TextField.template-doc.mdx +0 -330
- package/styled-components/cjs/components/TextField/hooks/index.js +1 -8
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.config.js +1 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.js +5 -2
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.outline.config.js +37 -0
- package/styled-components/cjs/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
- package/styled-components/cjs/examples/plasma_b2c/components/TextField/TextField.stories.tsx +1 -253
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.config.js +1 -1
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.js +5 -2
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.outline.config.js +37 -0
- package/styled-components/cjs/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
- package/styled-components/cjs/examples/plasma_web/components/TextField/TextField.stories.tsx +0 -252
- package/styled-components/cjs/utils/constants.js +2 -4
- package/styled-components/es/components/Switch/Switch.tokens.js +7 -1
- package/styled-components/es/components/Switch/_toggleSize/base.js +1 -1
- package/styled-components/es/components/Switch/_view/base.js +1 -1
- package/styled-components/es/components/TextField/TextField.js +4 -27
- package/styled-components/es/components/TextField/TextField.template-doc.mdx +0 -330
- package/styled-components/es/components/TextField/hooks/index.js +1 -2
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.config.js +1 -1
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.js +4 -1
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.outline.config.js +31 -0
- package/styled-components/es/examples/plasma_b2c/components/Switch/Switch.stories.tsx +33 -1
- package/styled-components/es/examples/plasma_b2c/components/TextField/TextField.stories.tsx +1 -253
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.config.js +1 -1
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.js +4 -1
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.outline.config.js +31 -0
- package/styled-components/es/examples/plasma_web/components/Switch/Switch.stories.tsx +33 -1
- package/styled-components/es/examples/plasma_web/components/TextField/TextField.stories.tsx +0 -252
- package/styled-components/es/utils/constants.js +1 -3
- package/types/components/Autocomplete/Autocomplete.types.d.ts +2 -2
- package/types/components/Autocomplete/Autocomplete.types.d.ts.map +1 -1
- package/types/components/Autocomplete/ui/TextField/TextField.styles.d.ts +92 -1676
- package/types/components/Autocomplete/ui/TextField/TextField.styles.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/ui/Target/Target.styles.d.ts +92 -1676
- package/types/components/Combobox/ComboboxNew/ui/Target/Target.styles.d.ts.map +1 -1
- package/types/components/DatePicker/SingleDate/SingleDate.styles.d.ts +92 -1676
- package/types/components/DatePicker/SingleDate/SingleDate.styles.d.ts.map +1 -1
- package/types/components/Range/Range.styles.d.ts +92 -1676
- package/types/components/Range/Range.styles.d.ts.map +1 -1
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts +92 -1676
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts.map +1 -1
- package/types/components/Slider/components/Double/Double.styles.d.ts +92 -1676
- package/types/components/Slider/components/Double/Double.styles.d.ts.map +1 -1
- package/types/components/Switch/Switch.tokens.d.ts +7 -1
- package/types/components/Switch/Switch.tokens.d.ts.map +1 -1
- package/types/components/Switch/_toggleSize/base.d.ts.map +1 -1
- package/types/components/Switch/_view/base.d.ts.map +1 -1
- package/types/components/TextField/TextField.d.ts.map +1 -1
- package/types/components/TextField/TextField.types.d.ts +1 -51
- package/types/components/TextField/TextField.types.d.ts.map +1 -1
- package/types/components/TextField/hooks/index.d.ts +0 -1
- package/types/components/TextField/hooks/index.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Autocomplete/Autocomplete.d.ts +2 -64
- package/types/examples/plasma_b2c/components/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Mask/Mask.d.ts +92 -2732
- package/types/examples/plasma_b2c/components/Mask/Mask.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Switch/Switch.config.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Switch/Switch.d.ts +20 -0
- package/types/examples/plasma_b2c/components/Switch/Switch.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Switch/Switch.outline.config.d.ts +30 -0
- package/types/examples/plasma_b2c/components/Switch/Switch.outline.config.d.ts.map +1 -0
- package/types/examples/plasma_b2c/components/TextField/TextField.d.ts +92 -1676
- package/types/examples/plasma_b2c/components/TextField/TextField.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Autocomplete/Autocomplete.d.ts +2 -64
- package/types/examples/plasma_web/components/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Mask/Mask.d.ts +92 -2732
- package/types/examples/plasma_web/components/Mask/Mask.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Switch/Switch.config.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Switch/Switch.d.ts +20 -0
- package/types/examples/plasma_web/components/Switch/Switch.d.ts.map +1 -1
- package/types/examples/plasma_web/components/Switch/Switch.outline.config.d.ts +30 -0
- package/types/examples/plasma_web/components/Switch/Switch.outline.config.d.ts.map +1 -0
- package/types/examples/plasma_web/components/TextField/TextField.d.ts +92 -1676
- package/types/examples/plasma_web/components/TextField/TextField.d.ts.map +1 -1
- package/types/utils/constants.d.ts +0 -2
- package/types/utils/constants.d.ts.map +1 -1
- package/cjs/components/Switch/_toggleSize/base_6i0904.css +0 -1
- package/cjs/components/Switch/_view/base_yxkf3s.css +0 -1
- package/cjs/components/TextField/hooks/useValidation.js +0 -273
- package/cjs/components/TextField/hooks/useValidation.js.map +0 -1
- package/emotion/cjs/components/TextField/hooks/useValidation.js +0 -276
- package/emotion/es/components/TextField/hooks/useValidation.js +0 -270
- package/es/components/Switch/_toggleSize/base_6i0904.css +0 -1
- package/es/components/Switch/_view/base_yxkf3s.css +0 -1
- package/es/components/TextField/hooks/useValidation.js +0 -269
- package/es/components/TextField/hooks/useValidation.js.map +0 -1
- package/styled-components/cjs/components/TextField/hooks/useValidation.js +0 -276
- package/styled-components/es/components/TextField/hooks/useValidation.js +0 -270
- package/types/components/TextField/hooks/useValidation.d.ts +0 -7
- package/types/components/TextField/hooks/useValidation.d.ts.map +0 -1
@@ -1,270 +0,0 @@
|
|
1
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
2
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
3
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
4
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
5
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
6
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
7
|
-
import { useEffect } from 'react';
|
8
|
-
import { constants } from '../../../utils';
|
9
|
-
var getUniqueKeys = function getUniqueKeys(lengthOptions) {
|
10
|
-
return lengthOptions.map(function (option) {
|
11
|
-
return option.replace(/min|max|Length/g, '');
|
12
|
-
});
|
13
|
-
};
|
14
|
-
var validateLenghtOptions = function validateLenghtOptions(options) {
|
15
|
-
var _options$minLength, _options$maxLength;
|
16
|
-
if (!options) {
|
17
|
-
return;
|
18
|
-
}
|
19
|
-
var minHash = Object.keys(options).filter(function (key) {
|
20
|
-
return key.startsWith('min');
|
21
|
-
});
|
22
|
-
var maxHash = Object.keys(options).filter(function (key) {
|
23
|
-
return key.startsWith('max');
|
24
|
-
});
|
25
|
-
var minMaxUniqueKeys = (minHash === null || minHash === void 0 ? void 0 : minHash.length) >= (maxHash === null || maxHash === void 0 ? void 0 : maxHash.length) ? getUniqueKeys(minHash) : getUniqueKeys(maxHash);
|
26
|
-
var globalMinValue = Number(options === null || options === void 0 || (_options$minLength = options.minLength) === null || _options$minLength === void 0 ? void 0 : _options$minLength.value);
|
27
|
-
var globalMaxValue = Number(options === null || options === void 0 || (_options$maxLength = options.maxLength) === null || _options$maxLength === void 0 ? void 0 : _options$maxLength.value);
|
28
|
-
if (globalMinValue <= 0) {
|
29
|
-
console.error('minLength must be more than 0');
|
30
|
-
}
|
31
|
-
if (globalMaxValue <= 0) {
|
32
|
-
console.error('maxLength must be more than 0');
|
33
|
-
}
|
34
|
-
if (globalMaxValue <= globalMinValue) {
|
35
|
-
console.error('maxLength must be more than minLength');
|
36
|
-
}
|
37
|
-
minMaxUniqueKeys.forEach(function (key) {
|
38
|
-
var _options$optionMinKey, _options$optionMaxKey;
|
39
|
-
var optionMinKey = "min".concat(key, "Length");
|
40
|
-
var optionMaxKey = "max".concat(key, "Length");
|
41
|
-
var minValue = Number(options === null || options === void 0 || (_options$optionMinKey = options[optionMinKey]) === null || _options$optionMinKey === void 0 ? void 0 : _options$optionMinKey.value);
|
42
|
-
var maxValue = Number(options === null || options === void 0 || (_options$optionMaxKey = options[optionMaxKey]) === null || _options$optionMaxKey === void 0 ? void 0 : _options$optionMaxKey.value);
|
43
|
-
if (!minValue || minValue <= 0) {
|
44
|
-
console.error("".concat(optionMinKey, " must be more than 0"));
|
45
|
-
}
|
46
|
-
if (!maxValue || maxValue <= 0) {
|
47
|
-
console.error("".concat(optionMaxKey, " must be more than 0"));
|
48
|
-
}
|
49
|
-
if (maxValue <= minValue) {
|
50
|
-
console.error("".concat(optionMaxKey, " must be more than ").concat(optionMinKey));
|
51
|
-
}
|
52
|
-
});
|
53
|
-
};
|
54
|
-
var validateWithLengthOptions = function validateWithLengthOptions(value, options, optionKey) {
|
55
|
-
var _options$optionMinKey2, _options$optionMaxKey2;
|
56
|
-
var optionMinKey = "min".concat(optionKey, "Length");
|
57
|
-
var optionMaxKey = "max".concat(optionKey, "Length");
|
58
|
-
var minValue = Number((_options$optionMinKey2 = options[optionMinKey]) === null || _options$optionMinKey2 === void 0 ? void 0 : _options$optionMinKey2.value);
|
59
|
-
var maxValue = Number((_options$optionMaxKey2 = options[optionMaxKey]) === null || _options$optionMaxKey2 === void 0 ? void 0 : _options$optionMaxKey2.value);
|
60
|
-
if (minValue && value.length < minValue) {
|
61
|
-
var _options$optionMinKey3;
|
62
|
-
return {
|
63
|
-
isValid: false,
|
64
|
-
errorMessage: ((_options$optionMinKey3 = options[optionMinKey]) === null || _options$optionMinKey3 === void 0 ? void 0 : _options$optionMinKey3.errorMessage) || "".concat(optionMinKey, " is too short")
|
65
|
-
};
|
66
|
-
}
|
67
|
-
if (maxValue && value.length > maxValue) {
|
68
|
-
var _options$optionMaxKey3;
|
69
|
-
return {
|
70
|
-
isValid: false,
|
71
|
-
errorMessage: ((_options$optionMaxKey3 = options[optionMaxKey]) === null || _options$optionMaxKey3 === void 0 ? void 0 : _options$optionMaxKey3.errorMessage) || "".concat(optionMaxKey, " is too long")
|
72
|
-
};
|
73
|
-
}
|
74
|
-
return {
|
75
|
-
isValid: true
|
76
|
-
};
|
77
|
-
};
|
78
|
-
var validateEmailDomainsLists = function validateEmailDomainsLists(blacklistDomains, whitelistDomains) {
|
79
|
-
if (!(blacklistDomains !== null && blacklistDomains !== void 0 && blacklistDomains.length) || !(whitelistDomains !== null && whitelistDomains !== void 0 && whitelistDomains.length)) {
|
80
|
-
return;
|
81
|
-
}
|
82
|
-
var uniqueDomains = new Set([].concat(_toConsumableArray(blacklistDomains), _toConsumableArray(whitelistDomains)));
|
83
|
-
if (uniqueDomains.size !== blacklistDomains.length + whitelistDomains.length) {
|
84
|
-
console.error('Blacklisted domains must not overlap whitelisted domains');
|
85
|
-
}
|
86
|
-
};
|
87
|
-
var validateWithDomainsLists = function validateWithDomainsLists(domainWithZone, options) {
|
88
|
-
var _options$whitelistDom, _options$blacklistDom, _options$blacklistDom2, _options$whitelistDom2;
|
89
|
-
if (!((_options$whitelistDom = options.whitelistDomains) !== null && _options$whitelistDom !== void 0 && (_options$whitelistDom = _options$whitelistDom.value) !== null && _options$whitelistDom !== void 0 && _options$whitelistDom.length) && !((_options$blacklistDom = options.blacklistDomains) !== null && _options$blacklistDom !== void 0 && (_options$blacklistDom = _options$blacklistDom.value) !== null && _options$blacklistDom !== void 0 && _options$blacklistDom.length)) {
|
90
|
-
return {
|
91
|
-
isValid: true
|
92
|
-
};
|
93
|
-
}
|
94
|
-
if (options !== null && options !== void 0 && (_options$blacklistDom2 = options.blacklistDomains) !== null && _options$blacklistDom2 !== void 0 && (_options$blacklistDom2 = _options$blacklistDom2.value) !== null && _options$blacklistDom2 !== void 0 && _options$blacklistDom2.includes(domainWithZone)) {
|
95
|
-
var _options$blacklistDom3;
|
96
|
-
return {
|
97
|
-
isValid: false,
|
98
|
-
errorMessage: ((_options$blacklistDom3 = options.blacklistDomains) === null || _options$blacklistDom3 === void 0 ? void 0 : _options$blacklistDom3.errorMessage) || 'Domain is blacklisted'
|
99
|
-
};
|
100
|
-
}
|
101
|
-
if (!(options !== null && options !== void 0 && (_options$whitelistDom2 = options.whitelistDomains) !== null && _options$whitelistDom2 !== void 0 && (_options$whitelistDom2 = _options$whitelistDom2.value) !== null && _options$whitelistDom2 !== void 0 && _options$whitelistDom2.includes(domainWithZone))) {
|
102
|
-
var _options$whitelistDom3;
|
103
|
-
return {
|
104
|
-
isValid: false,
|
105
|
-
errorMessage: ((_options$whitelistDom3 = options.whitelistDomains) === null || _options$whitelistDom3 === void 0 ? void 0 : _options$whitelistDom3.errorMessage) || 'Domain is not whitelisted'
|
106
|
-
};
|
107
|
-
}
|
108
|
-
return {
|
109
|
-
isValid: true
|
110
|
-
};
|
111
|
-
};
|
112
|
-
var validateEmail = function validateEmail(email, options) {
|
113
|
-
var _options$customEmailR, _options$minLength2, _options$maxLength2;
|
114
|
-
if (!email) {
|
115
|
-
return {
|
116
|
-
isValid: true
|
117
|
-
};
|
118
|
-
}
|
119
|
-
var emailRegex = (options === null || options === void 0 || (_options$customEmailR = options.customEmailRegex) === null || _options$customEmailR === void 0 ? void 0 : _options$customEmailR.value) || constants.emailPattern;
|
120
|
-
if (!emailRegex.test(email)) {
|
121
|
-
var _options$customEmailR2;
|
122
|
-
return {
|
123
|
-
isValid: false,
|
124
|
-
errorMessage: (options === null || options === void 0 || (_options$customEmailR2 = options.customEmailRegex) === null || _options$customEmailR2 === void 0 ? void 0 : _options$customEmailR2.errorMessage) || 'Invalid email'
|
125
|
-
};
|
126
|
-
}
|
127
|
-
if (!options) {
|
128
|
-
return {
|
129
|
-
isValid: true
|
130
|
-
};
|
131
|
-
}
|
132
|
-
if ((_options$minLength2 = options.minLength) !== null && _options$minLength2 !== void 0 && _options$minLength2.value && email.length < options.minLength.value) {
|
133
|
-
var _options$minLength3;
|
134
|
-
return {
|
135
|
-
isValid: false,
|
136
|
-
errorMessage: ((_options$minLength3 = options.minLength) === null || _options$minLength3 === void 0 ? void 0 : _options$minLength3.errorMessage) || 'Email is too short'
|
137
|
-
};
|
138
|
-
}
|
139
|
-
if ((_options$maxLength2 = options.maxLength) !== null && _options$maxLength2 !== void 0 && _options$maxLength2.value && email.length > options.maxLength.value) {
|
140
|
-
var _options$maxLength3;
|
141
|
-
return {
|
142
|
-
isValid: false,
|
143
|
-
errorMessage: ((_options$maxLength3 = options.maxLength) === null || _options$maxLength3 === void 0 ? void 0 : _options$maxLength3.errorMessage) || 'Email is too long'
|
144
|
-
};
|
145
|
-
}
|
146
|
-
var emailHost = email.split('@')[0];
|
147
|
-
var emailDomainWithZone = email.split('@')[1];
|
148
|
-
var emailZone = emailDomainWithZone.split('.').pop();
|
149
|
-
if (!(emailZone !== null && emailZone !== void 0 && emailZone.length)) {
|
150
|
-
var _options$customEmailR3;
|
151
|
-
return {
|
152
|
-
isValid: false,
|
153
|
-
errorMessage: ((_options$customEmailR3 = options.customEmailRegex) === null || _options$customEmailR3 === void 0 ? void 0 : _options$customEmailR3.errorMessage) || 'Invalid email'
|
154
|
-
};
|
155
|
-
}
|
156
|
-
var emailDomain = emailDomainWithZone.substring(0, emailDomainWithZone.length - (emailZone.length + 1));
|
157
|
-
var hostValidation = validateWithLengthOptions(emailHost, options, 'Host');
|
158
|
-
if (!hostValidation.isValid) {
|
159
|
-
return hostValidation;
|
160
|
-
}
|
161
|
-
var domainValidation = validateWithLengthOptions(emailDomain, options, 'Domain');
|
162
|
-
if (!domainValidation.isValid) {
|
163
|
-
return domainValidation;
|
164
|
-
}
|
165
|
-
var zoneValidation = validateWithLengthOptions(emailZone, options, 'Zone');
|
166
|
-
if (!zoneValidation.isValid) {
|
167
|
-
return zoneValidation;
|
168
|
-
}
|
169
|
-
var domainWithZoneValidation = validateWithDomainsLists(emailDomainWithZone, options);
|
170
|
-
if (!domainWithZoneValidation.isValid) {
|
171
|
-
return domainWithZoneValidation;
|
172
|
-
}
|
173
|
-
return {
|
174
|
-
isValid: true
|
175
|
-
};
|
176
|
-
};
|
177
|
-
var validatePassword = function validatePassword(password, options) {
|
178
|
-
var _options$minLength4, _options$maxLength4, _options$includeUpper, _options$includeLower, _options$includeDigit, _options$includeSpeci;
|
179
|
-
if (!password || !options) {
|
180
|
-
return {
|
181
|
-
isValid: true
|
182
|
-
};
|
183
|
-
}
|
184
|
-
if ((_options$minLength4 = options.minLength) !== null && _options$minLength4 !== void 0 && _options$minLength4.value && password.length < options.minLength.value) {
|
185
|
-
var _options$minLength5;
|
186
|
-
return {
|
187
|
-
isValid: false,
|
188
|
-
errorMessage: ((_options$minLength5 = options.minLength) === null || _options$minLength5 === void 0 ? void 0 : _options$minLength5.errorMessage) || 'Password is too short'
|
189
|
-
};
|
190
|
-
}
|
191
|
-
if ((_options$maxLength4 = options.maxLength) !== null && _options$maxLength4 !== void 0 && _options$maxLength4.value && password.length > options.maxLength.value) {
|
192
|
-
var _options$maxLength5;
|
193
|
-
return {
|
194
|
-
isValid: false,
|
195
|
-
errorMessage: ((_options$maxLength5 = options.maxLength) === null || _options$maxLength5 === void 0 ? void 0 : _options$maxLength5.errorMessage) || 'Password is too long'
|
196
|
-
};
|
197
|
-
}
|
198
|
-
var lowercasedPassword = password.toLowerCase();
|
199
|
-
var uppercasedPassword = password.toUpperCase();
|
200
|
-
if ((_options$includeUpper = options.includeUppercase) !== null && _options$includeUpper !== void 0 && _options$includeUpper.value && password === lowercasedPassword) {
|
201
|
-
var _options$includeUpper2;
|
202
|
-
return {
|
203
|
-
isValid: false,
|
204
|
-
errorMessage: ((_options$includeUpper2 = options.includeUppercase) === null || _options$includeUpper2 === void 0 ? void 0 : _options$includeUpper2.errorMessage) || 'Password must contain at least one uppercase letter'
|
205
|
-
};
|
206
|
-
}
|
207
|
-
if ((_options$includeLower = options.includeLowercase) !== null && _options$includeLower !== void 0 && _options$includeLower.value && password === uppercasedPassword) {
|
208
|
-
var _options$includeLower2;
|
209
|
-
return {
|
210
|
-
isValid: false,
|
211
|
-
errorMessage: ((_options$includeLower2 = options.includeLowercase) === null || _options$includeLower2 === void 0 ? void 0 : _options$includeLower2.errorMessage) || 'Password must contain at least one lowercase letter'
|
212
|
-
};
|
213
|
-
}
|
214
|
-
if ((_options$includeDigit = options.includeDigits) !== null && _options$includeDigit !== void 0 && _options$includeDigit.value && !/\d/.test(password)) {
|
215
|
-
var _options$includeDigit2;
|
216
|
-
return {
|
217
|
-
isValid: false,
|
218
|
-
errorMessage: ((_options$includeDigit2 = options.includeDigits) === null || _options$includeDigit2 === void 0 ? void 0 : _options$includeDigit2.errorMessage) || 'Password must contain digits'
|
219
|
-
};
|
220
|
-
}
|
221
|
-
if ((_options$includeSpeci = options.includeSpecialSymbols) !== null && _options$includeSpeci !== void 0 && _options$includeSpeci.value && !constants.specialCharacters.test(password)) {
|
222
|
-
var _options$includeSpeci2;
|
223
|
-
return {
|
224
|
-
isValid: false,
|
225
|
-
errorMessage: ((_options$includeSpeci2 = options.includeSpecialSymbols) === null || _options$includeSpeci2 === void 0 ? void 0 : _options$includeSpeci2.errorMessage) || 'Password must contain special characters'
|
226
|
-
};
|
227
|
-
}
|
228
|
-
return {
|
229
|
-
isValid: true
|
230
|
-
};
|
231
|
-
};
|
232
|
-
var validationVariants = {
|
233
|
-
email: validateEmail,
|
234
|
-
password: validatePassword
|
235
|
-
};
|
236
|
-
export var useValidation = function useValidation(_ref) {
|
237
|
-
var validationType = _ref.validationType,
|
238
|
-
options = _ref.options,
|
239
|
-
onValidate = _ref.onValidate;
|
240
|
-
var handleValidationBlur = function handleValidationBlur(event) {
|
241
|
-
if (!validationType) {
|
242
|
-
return;
|
243
|
-
}
|
244
|
-
var validationResult = validationVariants[validationType](event.target.value, options);
|
245
|
-
onValidate === null || onValidate === void 0 || onValidate(validationResult);
|
246
|
-
};
|
247
|
-
var handleValidationKeyDown = function handleValidationKeyDown(event) {
|
248
|
-
if (!validationType) {
|
249
|
-
return;
|
250
|
-
}
|
251
|
-
if (event.keyCode === constants.keyCodes.Enter) {
|
252
|
-
event.preventDefault();
|
253
|
-
var _ref2 = event.target,
|
254
|
-
value = _ref2.value;
|
255
|
-
var validationResult = validationVariants[validationType](value, options);
|
256
|
-
onValidate === null || onValidate === void 0 || onValidate(validationResult);
|
257
|
-
}
|
258
|
-
};
|
259
|
-
useEffect(function () {
|
260
|
-
validateLenghtOptions(options);
|
261
|
-
if (validationType === 'email') {
|
262
|
-
var _whitelistDomains, _blacklistDomains;
|
263
|
-
validateEmailDomainsLists(options === null || options === void 0 || (_whitelistDomains = options.whitelistDomains) === null || _whitelistDomains === void 0 ? void 0 : _whitelistDomains.value, (_blacklistDomains = options.blacklistDomains) === null || _blacklistDomains === void 0 ? void 0 : _blacklistDomains.value);
|
264
|
-
}
|
265
|
-
}, []);
|
266
|
-
return {
|
267
|
-
handleValidationBlur: handleValidationBlur,
|
268
|
-
handleValidationKeyDown: handleValidationKeyDown
|
269
|
-
};
|
270
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
.b1wld3h3 .s2cs3kf{-webkit-flex:0 0 var(--plasma-switch__track-width);-ms-flex:0 0 var(--plasma-switch__track-width);flex:0 0 var(--plasma-switch__track-width);width:var(--plasma-switch__track-width);height:var(--plasma-switch__track-height);border-radius:var(--plasma-switch__track-border-radius);}.b1wld3h3 .s2cs3kf::after{width:var(--plasma-switch__thumb-size);height:var(--plasma-switch__thumb-size);border-radius:var(--plasma-switch__thumb-border-radius);margin:auto var(--plasma-switch__thumb-offset);}.b1wld3h3:active:not([disabled]) .s2cs3kf::after{width:calc(var(--plasma-switch__thumb-size) * var(--plasma-switch__thumb-scale,1));}
|
@@ -1 +0,0 @@
|
|
1
|
-
.b1g0jmh3 .s2cs3kf{background-color:var(--plasma-switch__track_checked_false-bg-color);}.b1g0jmh3 .ssthlx1:not([disabled]) ~ .s2cs3kf:hover{background-color:var(--plasma-switch__track_checked_false_hovered_true-bg-color,var(--plasma-switch__track_checked_false-bg-color));}.b1g0jmh3 .ssthlx1:checked ~ .s2cs3kf{background-color:var(--plasma-switch__track_checked_true-bg-color);}.b1g0jmh3 .ssthlx1:checked:not([disabled]) ~ .s2cs3kf:hover{background-color:var(--plasma-switch__track_checked_true_hovered_true-bg-color,var(--plasma-switch__track_checked_true-bg-color));}.b1g0jmh3 .s2cs3kf::after{background-color:var(--plasma-switch__thumb-bg-color);box-shadow:var(--plasma-switch__thumb-box-shadow);}.b1g0jmh3 .ssthlx1:checked ~ .s2cs3kf::after{box-shadow:var(--plasma-switch__thumb-box-shadow_checked_true,var(--plasma-switch__thumb-box-shadow));}.b1g0jmh3 .s1ilr5eq{color:var(--plasma-switch__label-color);}.b1g0jmh3 .sdjnckq{color:var(--plasma-switch__description-color);}
|
@@ -1,269 +0,0 @@
|
|
1
|
-
import { toConsumableArray as _toConsumableArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
2
|
-
import { useEffect } from 'react';
|
3
|
-
import { keyCodes, specialCharacters, emailPattern } from '../../../utils/constants.js';
|
4
|
-
|
5
|
-
var getUniqueKeys = function getUniqueKeys(lengthOptions) {
|
6
|
-
return lengthOptions.map(function (option) {
|
7
|
-
return option.replace(/min|max|Length/g, '');
|
8
|
-
});
|
9
|
-
};
|
10
|
-
var validateLenghtOptions = function validateLenghtOptions(options) {
|
11
|
-
var _options$minLength, _options$maxLength;
|
12
|
-
if (!options) {
|
13
|
-
return;
|
14
|
-
}
|
15
|
-
var minHash = Object.keys(options).filter(function (key) {
|
16
|
-
return key.startsWith('min');
|
17
|
-
});
|
18
|
-
var maxHash = Object.keys(options).filter(function (key) {
|
19
|
-
return key.startsWith('max');
|
20
|
-
});
|
21
|
-
var minMaxUniqueKeys = (minHash === null || minHash === void 0 ? void 0 : minHash.length) >= (maxHash === null || maxHash === void 0 ? void 0 : maxHash.length) ? getUniqueKeys(minHash) : getUniqueKeys(maxHash);
|
22
|
-
var globalMinValue = Number(options === null || options === void 0 || (_options$minLength = options.minLength) === null || _options$minLength === void 0 ? void 0 : _options$minLength.value);
|
23
|
-
var globalMaxValue = Number(options === null || options === void 0 || (_options$maxLength = options.maxLength) === null || _options$maxLength === void 0 ? void 0 : _options$maxLength.value);
|
24
|
-
if (globalMinValue <= 0) {
|
25
|
-
console.error('minLength must be more than 0');
|
26
|
-
}
|
27
|
-
if (globalMaxValue <= 0) {
|
28
|
-
console.error('maxLength must be more than 0');
|
29
|
-
}
|
30
|
-
if (globalMaxValue <= globalMinValue) {
|
31
|
-
console.error('maxLength must be more than minLength');
|
32
|
-
}
|
33
|
-
minMaxUniqueKeys.forEach(function (key) {
|
34
|
-
var _options$optionMinKey, _options$optionMaxKey;
|
35
|
-
var optionMinKey = "min".concat(key, "Length");
|
36
|
-
var optionMaxKey = "max".concat(key, "Length");
|
37
|
-
var minValue = Number(options === null || options === void 0 || (_options$optionMinKey = options[optionMinKey]) === null || _options$optionMinKey === void 0 ? void 0 : _options$optionMinKey.value);
|
38
|
-
var maxValue = Number(options === null || options === void 0 || (_options$optionMaxKey = options[optionMaxKey]) === null || _options$optionMaxKey === void 0 ? void 0 : _options$optionMaxKey.value);
|
39
|
-
if (!minValue || minValue <= 0) {
|
40
|
-
console.error("".concat(optionMinKey, " must be more than 0"));
|
41
|
-
}
|
42
|
-
if (!maxValue || maxValue <= 0) {
|
43
|
-
console.error("".concat(optionMaxKey, " must be more than 0"));
|
44
|
-
}
|
45
|
-
if (maxValue <= minValue) {
|
46
|
-
console.error("".concat(optionMaxKey, " must be more than ").concat(optionMinKey));
|
47
|
-
}
|
48
|
-
});
|
49
|
-
};
|
50
|
-
var validateWithLengthOptions = function validateWithLengthOptions(value, options, optionKey) {
|
51
|
-
var _options$optionMinKey2, _options$optionMaxKey2;
|
52
|
-
var optionMinKey = "min".concat(optionKey, "Length");
|
53
|
-
var optionMaxKey = "max".concat(optionKey, "Length");
|
54
|
-
var minValue = Number((_options$optionMinKey2 = options[optionMinKey]) === null || _options$optionMinKey2 === void 0 ? void 0 : _options$optionMinKey2.value);
|
55
|
-
var maxValue = Number((_options$optionMaxKey2 = options[optionMaxKey]) === null || _options$optionMaxKey2 === void 0 ? void 0 : _options$optionMaxKey2.value);
|
56
|
-
if (minValue && value.length < minValue) {
|
57
|
-
var _options$optionMinKey3;
|
58
|
-
return {
|
59
|
-
isValid: false,
|
60
|
-
errorMessage: ((_options$optionMinKey3 = options[optionMinKey]) === null || _options$optionMinKey3 === void 0 ? void 0 : _options$optionMinKey3.errorMessage) || "".concat(optionMinKey, " is too short")
|
61
|
-
};
|
62
|
-
}
|
63
|
-
if (maxValue && value.length > maxValue) {
|
64
|
-
var _options$optionMaxKey3;
|
65
|
-
return {
|
66
|
-
isValid: false,
|
67
|
-
errorMessage: ((_options$optionMaxKey3 = options[optionMaxKey]) === null || _options$optionMaxKey3 === void 0 ? void 0 : _options$optionMaxKey3.errorMessage) || "".concat(optionMaxKey, " is too long")
|
68
|
-
};
|
69
|
-
}
|
70
|
-
return {
|
71
|
-
isValid: true
|
72
|
-
};
|
73
|
-
};
|
74
|
-
var validateEmailDomainsLists = function validateEmailDomainsLists(blacklistDomains, whitelistDomains) {
|
75
|
-
if (!(blacklistDomains !== null && blacklistDomains !== void 0 && blacklistDomains.length) || !(whitelistDomains !== null && whitelistDomains !== void 0 && whitelistDomains.length)) {
|
76
|
-
return;
|
77
|
-
}
|
78
|
-
var uniqueDomains = new Set([].concat(_toConsumableArray(blacklistDomains), _toConsumableArray(whitelistDomains)));
|
79
|
-
if (uniqueDomains.size !== blacklistDomains.length + whitelistDomains.length) {
|
80
|
-
console.error('Blacklisted domains must not overlap whitelisted domains');
|
81
|
-
}
|
82
|
-
};
|
83
|
-
var validateWithDomainsLists = function validateWithDomainsLists(domainWithZone, options) {
|
84
|
-
var _options$whitelistDom, _options$blacklistDom, _options$blacklistDom2, _options$whitelistDom2;
|
85
|
-
if (!((_options$whitelistDom = options.whitelistDomains) !== null && _options$whitelistDom !== void 0 && (_options$whitelistDom = _options$whitelistDom.value) !== null && _options$whitelistDom !== void 0 && _options$whitelistDom.length) && !((_options$blacklistDom = options.blacklistDomains) !== null && _options$blacklistDom !== void 0 && (_options$blacklistDom = _options$blacklistDom.value) !== null && _options$blacklistDom !== void 0 && _options$blacklistDom.length)) {
|
86
|
-
return {
|
87
|
-
isValid: true
|
88
|
-
};
|
89
|
-
}
|
90
|
-
if (options !== null && options !== void 0 && (_options$blacklistDom2 = options.blacklistDomains) !== null && _options$blacklistDom2 !== void 0 && (_options$blacklistDom2 = _options$blacklistDom2.value) !== null && _options$blacklistDom2 !== void 0 && _options$blacklistDom2.includes(domainWithZone)) {
|
91
|
-
var _options$blacklistDom3;
|
92
|
-
return {
|
93
|
-
isValid: false,
|
94
|
-
errorMessage: ((_options$blacklistDom3 = options.blacklistDomains) === null || _options$blacklistDom3 === void 0 ? void 0 : _options$blacklistDom3.errorMessage) || 'Domain is blacklisted'
|
95
|
-
};
|
96
|
-
}
|
97
|
-
if (!(options !== null && options !== void 0 && (_options$whitelistDom2 = options.whitelistDomains) !== null && _options$whitelistDom2 !== void 0 && (_options$whitelistDom2 = _options$whitelistDom2.value) !== null && _options$whitelistDom2 !== void 0 && _options$whitelistDom2.includes(domainWithZone))) {
|
98
|
-
var _options$whitelistDom3;
|
99
|
-
return {
|
100
|
-
isValid: false,
|
101
|
-
errorMessage: ((_options$whitelistDom3 = options.whitelistDomains) === null || _options$whitelistDom3 === void 0 ? void 0 : _options$whitelistDom3.errorMessage) || 'Domain is not whitelisted'
|
102
|
-
};
|
103
|
-
}
|
104
|
-
return {
|
105
|
-
isValid: true
|
106
|
-
};
|
107
|
-
};
|
108
|
-
var validateEmail = function validateEmail(email, options) {
|
109
|
-
var _options$customEmailR, _options$minLength2, _options$maxLength2;
|
110
|
-
if (!email) {
|
111
|
-
return {
|
112
|
-
isValid: true
|
113
|
-
};
|
114
|
-
}
|
115
|
-
var emailRegex = (options === null || options === void 0 || (_options$customEmailR = options.customEmailRegex) === null || _options$customEmailR === void 0 ? void 0 : _options$customEmailR.value) || emailPattern;
|
116
|
-
if (!emailRegex.test(email)) {
|
117
|
-
var _options$customEmailR2;
|
118
|
-
return {
|
119
|
-
isValid: false,
|
120
|
-
errorMessage: (options === null || options === void 0 || (_options$customEmailR2 = options.customEmailRegex) === null || _options$customEmailR2 === void 0 ? void 0 : _options$customEmailR2.errorMessage) || 'Invalid email'
|
121
|
-
};
|
122
|
-
}
|
123
|
-
if (!options) {
|
124
|
-
return {
|
125
|
-
isValid: true
|
126
|
-
};
|
127
|
-
}
|
128
|
-
if ((_options$minLength2 = options.minLength) !== null && _options$minLength2 !== void 0 && _options$minLength2.value && email.length < options.minLength.value) {
|
129
|
-
var _options$minLength3;
|
130
|
-
return {
|
131
|
-
isValid: false,
|
132
|
-
errorMessage: ((_options$minLength3 = options.minLength) === null || _options$minLength3 === void 0 ? void 0 : _options$minLength3.errorMessage) || 'Email is too short'
|
133
|
-
};
|
134
|
-
}
|
135
|
-
if ((_options$maxLength2 = options.maxLength) !== null && _options$maxLength2 !== void 0 && _options$maxLength2.value && email.length > options.maxLength.value) {
|
136
|
-
var _options$maxLength3;
|
137
|
-
return {
|
138
|
-
isValid: false,
|
139
|
-
errorMessage: ((_options$maxLength3 = options.maxLength) === null || _options$maxLength3 === void 0 ? void 0 : _options$maxLength3.errorMessage) || 'Email is too long'
|
140
|
-
};
|
141
|
-
}
|
142
|
-
var emailHost = email.split('@')[0];
|
143
|
-
var emailDomainWithZone = email.split('@')[1];
|
144
|
-
var emailZone = emailDomainWithZone.split('.').pop();
|
145
|
-
if (!(emailZone !== null && emailZone !== void 0 && emailZone.length)) {
|
146
|
-
var _options$customEmailR3;
|
147
|
-
return {
|
148
|
-
isValid: false,
|
149
|
-
errorMessage: ((_options$customEmailR3 = options.customEmailRegex) === null || _options$customEmailR3 === void 0 ? void 0 : _options$customEmailR3.errorMessage) || 'Invalid email'
|
150
|
-
};
|
151
|
-
}
|
152
|
-
var emailDomain = emailDomainWithZone.substring(0, emailDomainWithZone.length - (emailZone.length + 1));
|
153
|
-
var hostValidation = validateWithLengthOptions(emailHost, options, 'Host');
|
154
|
-
if (!hostValidation.isValid) {
|
155
|
-
return hostValidation;
|
156
|
-
}
|
157
|
-
var domainValidation = validateWithLengthOptions(emailDomain, options, 'Domain');
|
158
|
-
if (!domainValidation.isValid) {
|
159
|
-
return domainValidation;
|
160
|
-
}
|
161
|
-
var zoneValidation = validateWithLengthOptions(emailZone, options, 'Zone');
|
162
|
-
if (!zoneValidation.isValid) {
|
163
|
-
return zoneValidation;
|
164
|
-
}
|
165
|
-
var domainWithZoneValidation = validateWithDomainsLists(emailDomainWithZone, options);
|
166
|
-
if (!domainWithZoneValidation.isValid) {
|
167
|
-
return domainWithZoneValidation;
|
168
|
-
}
|
169
|
-
return {
|
170
|
-
isValid: true
|
171
|
-
};
|
172
|
-
};
|
173
|
-
var validatePassword = function validatePassword(password, options) {
|
174
|
-
var _options$minLength4, _options$maxLength4, _options$includeUpper, _options$includeLower, _options$includeDigit, _options$includeSpeci;
|
175
|
-
if (!password || !options) {
|
176
|
-
return {
|
177
|
-
isValid: true
|
178
|
-
};
|
179
|
-
}
|
180
|
-
if ((_options$minLength4 = options.minLength) !== null && _options$minLength4 !== void 0 && _options$minLength4.value && password.length < options.minLength.value) {
|
181
|
-
var _options$minLength5;
|
182
|
-
return {
|
183
|
-
isValid: false,
|
184
|
-
errorMessage: ((_options$minLength5 = options.minLength) === null || _options$minLength5 === void 0 ? void 0 : _options$minLength5.errorMessage) || 'Password is too short'
|
185
|
-
};
|
186
|
-
}
|
187
|
-
if ((_options$maxLength4 = options.maxLength) !== null && _options$maxLength4 !== void 0 && _options$maxLength4.value && password.length > options.maxLength.value) {
|
188
|
-
var _options$maxLength5;
|
189
|
-
return {
|
190
|
-
isValid: false,
|
191
|
-
errorMessage: ((_options$maxLength5 = options.maxLength) === null || _options$maxLength5 === void 0 ? void 0 : _options$maxLength5.errorMessage) || 'Password is too long'
|
192
|
-
};
|
193
|
-
}
|
194
|
-
var lowercasedPassword = password.toLowerCase();
|
195
|
-
var uppercasedPassword = password.toUpperCase();
|
196
|
-
if ((_options$includeUpper = options.includeUppercase) !== null && _options$includeUpper !== void 0 && _options$includeUpper.value && password === lowercasedPassword) {
|
197
|
-
var _options$includeUpper2;
|
198
|
-
return {
|
199
|
-
isValid: false,
|
200
|
-
errorMessage: ((_options$includeUpper2 = options.includeUppercase) === null || _options$includeUpper2 === void 0 ? void 0 : _options$includeUpper2.errorMessage) || 'Password must contain at least one uppercase letter'
|
201
|
-
};
|
202
|
-
}
|
203
|
-
if ((_options$includeLower = options.includeLowercase) !== null && _options$includeLower !== void 0 && _options$includeLower.value && password === uppercasedPassword) {
|
204
|
-
var _options$includeLower2;
|
205
|
-
return {
|
206
|
-
isValid: false,
|
207
|
-
errorMessage: ((_options$includeLower2 = options.includeLowercase) === null || _options$includeLower2 === void 0 ? void 0 : _options$includeLower2.errorMessage) || 'Password must contain at least one lowercase letter'
|
208
|
-
};
|
209
|
-
}
|
210
|
-
if ((_options$includeDigit = options.includeDigits) !== null && _options$includeDigit !== void 0 && _options$includeDigit.value && !/\d/.test(password)) {
|
211
|
-
var _options$includeDigit2;
|
212
|
-
return {
|
213
|
-
isValid: false,
|
214
|
-
errorMessage: ((_options$includeDigit2 = options.includeDigits) === null || _options$includeDigit2 === void 0 ? void 0 : _options$includeDigit2.errorMessage) || 'Password must contain digits'
|
215
|
-
};
|
216
|
-
}
|
217
|
-
if ((_options$includeSpeci = options.includeSpecialSymbols) !== null && _options$includeSpeci !== void 0 && _options$includeSpeci.value && !specialCharacters.test(password)) {
|
218
|
-
var _options$includeSpeci2;
|
219
|
-
return {
|
220
|
-
isValid: false,
|
221
|
-
errorMessage: ((_options$includeSpeci2 = options.includeSpecialSymbols) === null || _options$includeSpeci2 === void 0 ? void 0 : _options$includeSpeci2.errorMessage) || 'Password must contain special characters'
|
222
|
-
};
|
223
|
-
}
|
224
|
-
return {
|
225
|
-
isValid: true
|
226
|
-
};
|
227
|
-
};
|
228
|
-
var validationVariants = {
|
229
|
-
email: validateEmail,
|
230
|
-
password: validatePassword
|
231
|
-
};
|
232
|
-
var useValidation = function useValidation(_ref) {
|
233
|
-
var validationType = _ref.validationType,
|
234
|
-
options = _ref.options,
|
235
|
-
onValidate = _ref.onValidate;
|
236
|
-
var handleValidationBlur = function handleValidationBlur(event) {
|
237
|
-
if (!validationType) {
|
238
|
-
return;
|
239
|
-
}
|
240
|
-
var validationResult = validationVariants[validationType](event.target.value, options);
|
241
|
-
onValidate === null || onValidate === void 0 || onValidate(validationResult);
|
242
|
-
};
|
243
|
-
var handleValidationKeyDown = function handleValidationKeyDown(event) {
|
244
|
-
if (!validationType) {
|
245
|
-
return;
|
246
|
-
}
|
247
|
-
if (event.keyCode === keyCodes.Enter) {
|
248
|
-
event.preventDefault();
|
249
|
-
var _ref2 = event.target,
|
250
|
-
value = _ref2.value;
|
251
|
-
var validationResult = validationVariants[validationType](value, options);
|
252
|
-
onValidate === null || onValidate === void 0 || onValidate(validationResult);
|
253
|
-
}
|
254
|
-
};
|
255
|
-
useEffect(function () {
|
256
|
-
validateLenghtOptions(options);
|
257
|
-
if (validationType === 'email') {
|
258
|
-
var _whitelistDomains, _blacklistDomains;
|
259
|
-
validateEmailDomainsLists(options === null || options === void 0 || (_whitelistDomains = options.whitelistDomains) === null || _whitelistDomains === void 0 ? void 0 : _whitelistDomains.value, (_blacklistDomains = options.blacklistDomains) === null || _blacklistDomains === void 0 ? void 0 : _blacklistDomains.value);
|
260
|
-
}
|
261
|
-
}, []);
|
262
|
-
return {
|
263
|
-
handleValidationBlur: handleValidationBlur,
|
264
|
-
handleValidationKeyDown: handleValidationKeyDown
|
265
|
-
};
|
266
|
-
};
|
267
|
-
|
268
|
-
export { useValidation };
|
269
|
-
//# sourceMappingURL=useValidation.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useValidation.js","sources":["../../../../src/components/TextField/hooks/useValidation.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport type { FocusEvent, KeyboardEvent } from 'react';\n\nimport type { EmailValidationOptions, PasswordValidationOptions, UseValidationArgs } from '../TextField.types';\nimport { constants } from '../../../utils';\n\nconst getUniqueKeys = (lengthOptions: string[]) => {\n return lengthOptions.map((option) => option.replace(/min|max|Length/g, ''));\n};\n\nconst validateLenghtOptions = (options?: PasswordValidationOptions | EmailValidationOptions) => {\n if (!options) {\n return;\n }\n\n const minHash = Object.keys(options).filter((key) => {\n return key.startsWith('min');\n });\n const maxHash = Object.keys(options).filter((key) => {\n return key.startsWith('max');\n });\n\n const minMaxUniqueKeys = minHash?.length >= maxHash?.length ? getUniqueKeys(minHash) : getUniqueKeys(maxHash);\n\n const globalMinValue = Number(options?.minLength?.value);\n const globalMaxValue = Number(options?.maxLength?.value);\n\n if (globalMinValue <= 0) {\n console.error('minLength must be more than 0');\n }\n\n if (globalMaxValue <= 0) {\n console.error('maxLength must be more than 0');\n }\n\n if (globalMaxValue <= globalMinValue) {\n console.error('maxLength must be more than minLength');\n }\n\n minMaxUniqueKeys.forEach((key) => {\n const optionMinKey = `min${key}Length` as keyof typeof options;\n const optionMaxKey = `max${key}Length` as keyof typeof options;\n\n const minValue = Number(options?.[optionMinKey]?.value);\n const maxValue = Number(options?.[optionMaxKey]?.value);\n\n if (!minValue || minValue <= 0) {\n console.error(`${optionMinKey} must be more than 0`);\n }\n\n if (!maxValue || maxValue <= 0) {\n console.error(`${optionMaxKey} must be more than 0`);\n }\n\n if (maxValue <= minValue) {\n console.error(`${optionMaxKey} must be more than ${optionMinKey}`);\n }\n });\n};\n\nconst validateWithLengthOptions = (\n value: string,\n options: PasswordValidationOptions | EmailValidationOptions,\n optionKey: string,\n) => {\n const optionMinKey = `min${optionKey}Length` as keyof typeof options;\n const optionMaxKey = `max${optionKey}Length` as keyof typeof options;\n\n const minValue = Number(options[optionMinKey]?.value);\n const maxValue = Number(options[optionMaxKey]?.value);\n\n if (minValue && value.length < minValue) {\n return {\n isValid: false,\n errorMessage: options[optionMinKey]?.errorMessage || `${optionMinKey} is too short`,\n };\n }\n\n if (maxValue && value.length > maxValue) {\n return {\n isValid: false,\n errorMessage: options[optionMaxKey]?.errorMessage || `${optionMaxKey} is too long`,\n };\n }\n\n return { isValid: true };\n};\n\nconst validateEmailDomainsLists = (blacklistDomains?: string[], whitelistDomains?: string[]) => {\n if (!blacklistDomains?.length || !whitelistDomains?.length) {\n return;\n }\n\n const uniqueDomains = new Set([...blacklistDomains, ...whitelistDomains]);\n\n if (uniqueDomains.size !== blacklistDomains.length + whitelistDomains.length) {\n console.error('Blacklisted domains must not overlap whitelisted domains');\n }\n};\n\nconst validateWithDomainsLists = (domainWithZone: string, options: EmailValidationOptions) => {\n if (!options.whitelistDomains?.value?.length && !options.blacklistDomains?.value?.length) {\n return { isValid: true };\n }\n\n if (options?.blacklistDomains?.value?.includes(domainWithZone)) {\n return {\n isValid: false,\n errorMessage: options.blacklistDomains?.errorMessage || 'Domain is blacklisted',\n };\n }\n\n if (!options?.whitelistDomains?.value?.includes(domainWithZone)) {\n return {\n isValid: false,\n errorMessage: options.whitelistDomains?.errorMessage || 'Domain is not whitelisted',\n };\n }\n\n return { isValid: true };\n};\n\nconst validateEmail = (email: string, options?: EmailValidationOptions) => {\n if (!email) {\n return { isValid: true };\n }\n\n const emailRegex = options?.customEmailRegex?.value || constants.emailPattern;\n if (!emailRegex.test(email)) {\n return { isValid: false, errorMessage: options?.customEmailRegex?.errorMessage || 'Invalid email' };\n }\n\n if (!options) {\n return { isValid: true };\n }\n\n if (options.minLength?.value && email.length < options.minLength.value) {\n return { isValid: false, errorMessage: options.minLength?.errorMessage || 'Email is too short' };\n }\n\n if (options.maxLength?.value && email.length > options.maxLength.value) {\n return { isValid: false, errorMessage: options.maxLength?.errorMessage || 'Email is too long' };\n }\n\n const emailHost = email.split('@')[0];\n const emailDomainWithZone = email.split('@')[1];\n const emailZone = emailDomainWithZone.split('.').pop();\n\n if (!emailZone?.length) {\n return { isValid: false, errorMessage: options.customEmailRegex?.errorMessage || 'Invalid email' };\n }\n\n const emailDomain = emailDomainWithZone.substring(0, emailDomainWithZone.length - (emailZone.length + 1));\n\n const hostValidation = validateWithLengthOptions(emailHost, options, 'Host');\n if (!hostValidation.isValid) {\n return hostValidation;\n }\n\n const domainValidation = validateWithLengthOptions(emailDomain, options, 'Domain');\n if (!domainValidation.isValid) {\n return domainValidation;\n }\n\n const zoneValidation = validateWithLengthOptions(emailZone, options, 'Zone');\n if (!zoneValidation.isValid) {\n return zoneValidation;\n }\n\n const domainWithZoneValidation = validateWithDomainsLists(emailDomainWithZone, options);\n if (!domainWithZoneValidation.isValid) {\n return domainWithZoneValidation;\n }\n\n return { isValid: true };\n};\n\nconst validatePassword = (password: string, options?: PasswordValidationOptions) => {\n if (!password || !options) {\n return { isValid: true };\n }\n\n if (options.minLength?.value && password.length < options.minLength.value) {\n return { isValid: false, errorMessage: options.minLength?.errorMessage || 'Password is too short' };\n }\n\n if (options.maxLength?.value && password.length > options.maxLength.value) {\n return { isValid: false, errorMessage: options.maxLength?.errorMessage || 'Password is too long' };\n }\n\n const lowercasedPassword = password.toLowerCase();\n const uppercasedPassword = password.toUpperCase();\n\n if (options.includeUppercase?.value && password === lowercasedPassword) {\n return {\n isValid: false,\n errorMessage:\n options.includeUppercase?.errorMessage || 'Password must contain at least one uppercase letter',\n };\n }\n\n if (options.includeLowercase?.value && password === uppercasedPassword) {\n return {\n isValid: false,\n errorMessage:\n options.includeLowercase?.errorMessage || 'Password must contain at least one lowercase letter',\n };\n }\n\n if (options.includeDigits?.value && !/\\d/.test(password)) {\n return { isValid: false, errorMessage: options.includeDigits?.errorMessage || 'Password must contain digits' };\n }\n\n if (options.includeSpecialSymbols?.value && !constants.specialCharacters.test(password)) {\n return {\n isValid: false,\n errorMessage: options.includeSpecialSymbols?.errorMessage || 'Password must contain special characters',\n };\n }\n\n return { isValid: true };\n};\n\nconst validationVariants = {\n email: validateEmail,\n password: validatePassword,\n};\n\nexport const useValidation = ({ validationType, options, onValidate }: UseValidationArgs) => {\n const handleValidationBlur = (event: FocusEvent<HTMLInputElement>) => {\n if (!validationType) {\n return;\n }\n\n const validationResult = validationVariants[validationType](event.target.value, options);\n\n onValidate?.(validationResult);\n };\n\n const handleValidationKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (!validationType) {\n return;\n }\n\n if (event.keyCode === constants.keyCodes.Enter) {\n event.preventDefault();\n const { value } = event.target as HTMLInputElement;\n\n const validationResult = validationVariants[validationType](value, options);\n\n onValidate?.(validationResult);\n }\n };\n\n useEffect(() => {\n validateLenghtOptions(options);\n if (validationType === 'email') {\n validateEmailDomainsLists(\n (options as EmailValidationOptions)?.whitelistDomains?.value,\n (options as EmailValidationOptions).blacklistDomains?.value,\n );\n }\n }, []);\n\n return {\n handleValidationBlur,\n handleValidationKeyDown,\n };\n};\n"],"names":["getUniqueKeys","lengthOptions","map","option","replace","validateLenghtOptions","options","_options$minLength","_options$maxLength","minHash","Object","keys","filter","key","startsWith","maxHash","minMaxUniqueKeys","length","globalMinValue","Number","minLength","value","globalMaxValue","maxLength","console","error","forEach","_options$optionMinKey","_options$optionMaxKey","optionMinKey","concat","optionMaxKey","minValue","maxValue","validateWithLengthOptions","optionKey","_options$optionMinKey2","_options$optionMaxKey2","_options$optionMinKey3","isValid","errorMessage","_options$optionMaxKey3","validateEmailDomainsLists","blacklistDomains","whitelistDomains","uniqueDomains","Set","_toConsumableArray","size","validateWithDomainsLists","domainWithZone","_options$whitelistDom","_options$blacklistDom","_options$blacklistDom2","_options$whitelistDom2","includes","_options$blacklistDom3","_options$whitelistDom3","validateEmail","email","_options$customEmailR","_options$minLength2","_options$maxLength2","emailRegex","customEmailRegex","constants","test","_options$customEmailR2","_options$minLength3","_options$maxLength3","emailHost","split","emailDomainWithZone","emailZone","pop","_options$customEmailR3","emailDomain","substring","hostValidation","domainValidation","zoneValidation","domainWithZoneValidation","validatePassword","password","_options$minLength4","_options$maxLength4","_options$includeUpper","_options$includeLower","_options$includeDigit","_options$includeSpeci","_options$minLength5","_options$maxLength5","lowercasedPassword","toLowerCase","uppercasedPassword","toUpperCase","includeUppercase","_options$includeUpper2","includeLowercase","_options$includeLower2","includeDigits","_options$includeDigit2","includeSpecialSymbols","_options$includeSpeci2","validationVariants","useValidation","_ref","validationType","onValidate","handleValidationBlur","event","validationResult","target","handleValidationKeyDown","keyCode","Enter","preventDefault","_ref2","useEffect","_whitelistDomains","_blacklistDomains"],"mappings":";;;;AAMA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,aAAuB,EAAK;AAC/C,EAAA,OAAOA,aAAa,CAACC,GAAG,CAA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