@coorpacademy/components 11.13.7-alpha.8 → 11.14.0
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/es/molecule/discipline-header/index.d.ts +1 -0
- package/es/molecule/discipline-header/index.d.ts.map +1 -1
- package/es/molecule/discipline-header/index.js +24 -9
- package/es/molecule/discipline-header/index.js.map +1 -1
- package/es/molecule/discipline-header/style.css +33 -7
- package/es/template/common/discipline/index.d.ts.map +1 -1
- package/es/template/common/discipline/index.js +4 -2
- package/es/template/common/discipline/index.js.map +1 -1
- package/lib/molecule/discipline-header/index.d.ts +1 -0
- package/lib/molecule/discipline-header/index.d.ts.map +1 -1
- package/lib/molecule/discipline-header/index.js +25 -9
- package/lib/molecule/discipline-header/index.js.map +1 -1
- package/lib/molecule/discipline-header/style.css +33 -7
- package/lib/template/common/discipline/index.d.ts.map +1 -1
- package/lib/template/common/discipline/index.js +4 -2
- package/lib/template/common/discipline/index.js.map +1 -1
- package/package.json +3 -3
- package/es/atom/form-text-input/index.d.ts +0 -26
- package/es/atom/form-text-input/index.d.ts.map +0 -1
- package/es/atom/form-text-input/index.js +0 -103
- package/es/atom/form-text-input/index.js.map +0 -1
- package/es/atom/form-text-input/prop-types.d.ts +0 -54
- package/es/atom/form-text-input/prop-types.d.ts.map +0 -1
- package/es/atom/form-text-input/prop-types.js +0 -34
- package/es/atom/form-text-input/prop-types.js.map +0 -1
- package/es/atom/form-text-input/style.css +0 -53
- package/lib/atom/form-text-input/index.d.ts +0 -26
- package/lib/atom/form-text-input/index.d.ts.map +0 -1
- package/lib/atom/form-text-input/index.js +0 -121
- package/lib/atom/form-text-input/index.js.map +0 -1
- package/lib/atom/form-text-input/prop-types.d.ts +0 -54
- package/lib/atom/form-text-input/prop-types.d.ts.map +0 -1
- package/lib/atom/form-text-input/prop-types.js +0 -45
- package/lib/atom/form-text-input/prop-types.js.map +0 -1
- package/lib/atom/form-text-input/style.css +0 -53
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coorpacademy/components",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.14.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"Soualmi Djamel <djamel.soualmi@coorpacademy.com>"
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@coorpacademy/nova-icons": "4.
|
|
59
|
+
"@coorpacademy/nova-icons": "4.2.0",
|
|
60
60
|
"@coorpacademy/react-native-animation": "1.0.3",
|
|
61
61
|
"@jwplayer/jwplayer-react": "^1.1.0",
|
|
62
62
|
"@types/react": "^17.0.50",
|
|
@@ -166,5 +166,5 @@
|
|
|
166
166
|
"last 2 versions",
|
|
167
167
|
"IE 11"
|
|
168
168
|
],
|
|
169
|
-
"gitHead": "
|
|
169
|
+
"gitHead": "11d1123f09a33a4142bdacd50a41edd782394c0f"
|
|
170
170
|
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { FormTextInputProps } from './prop-types';
|
|
3
|
-
declare const FormTextInput: {
|
|
4
|
-
({ "aria-label": ariaLabel, autocomplete, "data-testid": dataTestid, disabled, hint, inputClassName, isRequired, label, maxlength, name, onChange, passwordValidator, placeholder, type, value, equals, wrapperClassName }: FormTextInputProps): JSX.Element;
|
|
5
|
-
propTypes: {
|
|
6
|
-
'aria-label': import("prop-types").Requireable<string>;
|
|
7
|
-
autocomplete: import("prop-types").Requireable<string>;
|
|
8
|
-
'data-testid': import("prop-types").Requireable<string>;
|
|
9
|
-
disabled: import("prop-types").Requireable<boolean>;
|
|
10
|
-
equals: import("prop-types").Requireable<NonNullable<string | number | null | undefined>>;
|
|
11
|
-
hint: import("prop-types").Requireable<string>;
|
|
12
|
-
inputClassName: import("prop-types").Requireable<string>;
|
|
13
|
-
isRequired: import("prop-types").Requireable<boolean>;
|
|
14
|
-
label: import("prop-types").Requireable<string>;
|
|
15
|
-
maxlength: import("prop-types").Requireable<number>;
|
|
16
|
-
name: import("prop-types").Requireable<string>;
|
|
17
|
-
onChange: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
18
|
-
passwordValidator: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
19
|
-
placeholder: import("prop-types").Requireable<string>;
|
|
20
|
-
type: import("prop-types").Requireable<string>;
|
|
21
|
-
value: import("prop-types").Requireable<NonNullable<string | number | null | undefined>>;
|
|
22
|
-
wrapperClassName: import("prop-types").Requireable<string>;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export default FormTextInput;
|
|
26
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/form-text-input/index.tsx"],"names":[],"mappings":";AAKA,OAAkB,EAAa,kBAAkB,EAAY,MAAM,cAAc,CAAC;AAkBlF,QAAA,MAAM,aAAa;gOAkBhB,kBAAkB;;;;;;;;;;;;;;;;;;;;CAuEpB,CAAC;AAIF,eAAe,aAAa,CAAC"}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
|
-
import React, { useCallback, useMemo, useState, useEffect } from 'react';
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
import isEmpty from 'lodash/fp/isEmpty';
|
|
6
|
-
import isEqual from 'lodash/fp/isEqual';
|
|
7
|
-
import noop from 'lodash/fp/noop';
|
|
8
|
-
import propTypes, { TextInput } from './prop-types';
|
|
9
|
-
import style from './style.css';
|
|
10
|
-
|
|
11
|
-
const validate = (fieldValue, fieldEqualsValue) => {
|
|
12
|
-
return isEqual(fieldValue, fieldEqualsValue);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const VALID_EMAIL_PATTERN = /[a-z0-9!#$%&'*+=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/;
|
|
16
|
-
|
|
17
|
-
const validatePattern = (fieldValue, pattern) => {
|
|
18
|
-
return pattern.test(fieldValue);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const DEFAULT_MAX_LENGTH = 150;
|
|
22
|
-
|
|
23
|
-
const isEqualsDefined = equals => !isEmpty(equals);
|
|
24
|
-
|
|
25
|
-
const FormTextInput = ({
|
|
26
|
-
'aria-label': ariaLabel,
|
|
27
|
-
autocomplete,
|
|
28
|
-
'data-testid': dataTestid = 'form-text-input',
|
|
29
|
-
disabled,
|
|
30
|
-
hint,
|
|
31
|
-
inputClassName,
|
|
32
|
-
isRequired,
|
|
33
|
-
label,
|
|
34
|
-
maxlength = DEFAULT_MAX_LENGTH,
|
|
35
|
-
name,
|
|
36
|
-
onChange = noop,
|
|
37
|
-
passwordValidator = () => false,
|
|
38
|
-
placeholder,
|
|
39
|
-
type = 'default',
|
|
40
|
-
value,
|
|
41
|
-
equals,
|
|
42
|
-
wrapperClassName
|
|
43
|
-
}) => {
|
|
44
|
-
const [newValue, setNewValue] = useState(value);
|
|
45
|
-
const [isValid, setIsValid] = useState(true);
|
|
46
|
-
const isDefaultType = useMemo(() => !type || type === TextInput.default, [type]);
|
|
47
|
-
const isPasswordInput = useMemo(() => type === TextInput.password || type === TextInput.passwordConfirmation, [type]);
|
|
48
|
-
const isEmailInput = useMemo(() => type === TextInput.email, [type]);
|
|
49
|
-
const handleInputChange = useCallback(event => {
|
|
50
|
-
const newInput = event.target.value;
|
|
51
|
-
setNewValue(() => {
|
|
52
|
-
const isNewValueValid = !isEqualsDefined(equals) || validate(newInput, equals);
|
|
53
|
-
const validPattern = !isEmailInput || validatePattern(newInput, VALID_EMAIL_PATTERN);
|
|
54
|
-
const isPasswordCompliant = !isPasswordInput || passwordValidator(newInput);
|
|
55
|
-
setIsValid(isPasswordCompliant && isNewValueValid && validPattern);
|
|
56
|
-
return newInput;
|
|
57
|
-
});
|
|
58
|
-
}, [equals, isEmailInput, isPasswordInput, passwordValidator]);
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
onChange(newValue, isValid);
|
|
61
|
-
return;
|
|
62
|
-
}, [isValid, newValue, onChange]);
|
|
63
|
-
const fieldLabel = useMemo(() => `${label} ${isRequired ? '*' : ''}`, [isRequired, label]);
|
|
64
|
-
const errorStyle = useMemo(() => isValid ? undefined : {
|
|
65
|
-
border: '2px solid rgb(247, 63, 82)'
|
|
66
|
-
}, [isValid]);
|
|
67
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
68
|
-
className: classnames(style.wrapper, wrapperClassName)
|
|
69
|
-
}, /*#__PURE__*/React.createElement("label", {
|
|
70
|
-
className: style.formLabel,
|
|
71
|
-
htmlFor: name
|
|
72
|
-
}, fieldLabel), /*#__PURE__*/React.createElement("input", _extends({}, !isPasswordInput && !isEmailInput && {
|
|
73
|
-
maxLength: maxlength
|
|
74
|
-
}, isEmailInput && {
|
|
75
|
-
autoCapitalize: 'none'
|
|
76
|
-
}, isRequired && {
|
|
77
|
-
required: true
|
|
78
|
-
}, !isValid && {
|
|
79
|
-
'aria-invalid': true
|
|
80
|
-
}, {
|
|
81
|
-
type: isDefaultType ? 'text' : type,
|
|
82
|
-
"aria-label": ariaLabel,
|
|
83
|
-
autoComplete: isDefaultType ? 'on' : autocomplete,
|
|
84
|
-
autoCorrect: 'off',
|
|
85
|
-
className: classnames(style.textInput, inputClassName),
|
|
86
|
-
"data-testid": dataTestid,
|
|
87
|
-
disabled: disabled,
|
|
88
|
-
id: name,
|
|
89
|
-
name: name,
|
|
90
|
-
onInput: handleInputChange,
|
|
91
|
-
placeholder: placeholder,
|
|
92
|
-
value: value,
|
|
93
|
-
style: errorStyle
|
|
94
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
95
|
-
className: style.hintWrapper
|
|
96
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
97
|
-
className: style.hint
|
|
98
|
-
}, hint)));
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
FormTextInput.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
|
102
|
-
export default FormTextInput;
|
|
103
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","useMemo","useState","useEffect","classnames","isEmpty","isEqual","noop","propTypes","TextInput","style","validate","fieldValue","fieldEqualsValue","VALID_EMAIL_PATTERN","validatePattern","pattern","test","DEFAULT_MAX_LENGTH","isEqualsDefined","equals","FormTextInput","ariaLabel","autocomplete","dataTestid","disabled","hint","inputClassName","isRequired","label","maxlength","name","onChange","passwordValidator","placeholder","type","value","wrapperClassName","newValue","setNewValue","isValid","setIsValid","isDefaultType","default","isPasswordInput","password","passwordConfirmation","isEmailInput","email","handleInputChange","event","newInput","target","isNewValueValid","validPattern","isPasswordCompliant","fieldLabel","errorStyle","undefined","border","wrapper","formLabel","maxLength","autoCapitalize","required","textInput","hintWrapper"],"sources":["../../../src/atom/form-text-input/index.tsx"],"sourcesContent":["import React, {useCallback, useMemo, useState, useEffect, FormEvent} from 'react';\nimport classnames from 'classnames';\nimport isEmpty from 'lodash/fp/isEmpty';\nimport isEqual from 'lodash/fp/isEqual';\nimport noop from 'lodash/fp/noop';\nimport propTypes, {FieldValue, FormTextInputProps, TextInput} from './prop-types';\nimport style from './style.css';\n\nconst validate = (fieldValue: FieldValue, fieldEqualsValue: FieldValue) => {\n return isEqual(fieldValue, fieldEqualsValue);\n};\n\nconst VALID_EMAIL_PATTERN =\n /[a-z0-9!#$%&'*+=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/;\n\nconst validatePattern = (fieldValue: string, pattern: RegExp) => {\n return pattern.test(fieldValue);\n};\n\nconst DEFAULT_MAX_LENGTH = 150;\n\nconst isEqualsDefined = (equals: FieldValue | undefined): equals is FieldValue => !isEmpty(equals);\n\nconst FormTextInput = ({\n 'aria-label': ariaLabel,\n autocomplete,\n 'data-testid': dataTestid = 'form-text-input',\n disabled,\n hint,\n inputClassName,\n isRequired,\n label,\n maxlength = DEFAULT_MAX_LENGTH,\n name,\n onChange = noop,\n passwordValidator = () => false,\n placeholder,\n type = 'default',\n value,\n equals,\n wrapperClassName\n}: FormTextInputProps) => {\n const [newValue, setNewValue] = useState<FieldValue>(value);\n\n const [isValid, setIsValid] = useState<boolean>(true);\n\n const isDefaultType = useMemo(() => !type || type === TextInput.default, [type]);\n\n const isPasswordInput = useMemo(\n () => type === TextInput.password || type === TextInput.passwordConfirmation,\n [type]\n );\n\n const isEmailInput = useMemo(() => type === TextInput.email, [type]);\n\n const handleInputChange = useCallback(\n (event: FormEvent<HTMLInputElement>) => {\n const newInput: FieldValue = (event.target as HTMLInputElement).value;\n setNewValue(() => {\n const isNewValueValid = !isEqualsDefined(equals) || validate(newInput, equals);\n const validPattern = !isEmailInput || validatePattern(newInput, VALID_EMAIL_PATTERN);\n const isPasswordCompliant = !isPasswordInput || passwordValidator(newInput);\n\n setIsValid(isPasswordCompliant && isNewValueValid && validPattern);\n\n return newInput;\n });\n },\n [equals, isEmailInput, isPasswordInput, passwordValidator]\n );\n\n useEffect(() => {\n onChange(newValue, isValid);\n return;\n }, [isValid, newValue, onChange]);\n\n const fieldLabel = useMemo(() => `${label} ${isRequired ? '*' : ''}`, [isRequired, label]);\n\n const errorStyle = useMemo(\n () => (isValid ? undefined : {border: '2px solid rgb(247, 63, 82)'}),\n [isValid]\n );\n\n return (\n <div className={classnames(style.wrapper, wrapperClassName)}>\n <label className={style.formLabel} htmlFor={name}>\n {fieldLabel}\n </label>\n <input\n {...(!isPasswordInput && !isEmailInput && {maxLength: maxlength})}\n {...(isEmailInput && {autoCapitalize: 'none'})}\n {...(isRequired && {required: true})}\n {...(!isValid && {'aria-invalid': true})}\n type={isDefaultType ? 'text' : type}\n aria-label={ariaLabel}\n autoComplete={isDefaultType ? 'on' : autocomplete}\n autoCorrect={'off'}\n className={classnames(style.textInput, inputClassName)}\n data-testid={dataTestid}\n disabled={disabled}\n id={name}\n name={name}\n onInput={handleInputChange}\n placeholder={placeholder}\n value={value}\n style={errorStyle}\n />\n <div className={style.hintWrapper}>\n <span className={style.hint}>{hint}</span>\n </div>\n </div>\n );\n};\n\nFormTextInput.propTypes = propTypes;\n\nexport default FormTextInput;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAeC,WAAf,EAA4BC,OAA5B,EAAqCC,QAArC,EAA+CC,SAA/C,QAA0E,OAA1E;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,OAAP,MAAoB,mBAApB;AACA,OAAOC,OAAP,MAAoB,mBAApB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,OAAOC,SAAP,IAAmDC,SAAnD,QAAmE,cAAnE;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,QAAQ,GAAG,CAACC,UAAD,EAAyBC,gBAAzB,KAA0D;EACzE,OAAOP,OAAO,CAACM,UAAD,EAAaC,gBAAb,CAAd;AACD,CAFD;;AAIA,MAAMC,mBAAmB,GACvB,mIADF;;AAGA,MAAMC,eAAe,GAAG,CAACH,UAAD,EAAqBI,OAArB,KAAyC;EAC/D,OAAOA,OAAO,CAACC,IAAR,CAAaL,UAAb,CAAP;AACD,CAFD;;AAIA,MAAMM,kBAAkB,GAAG,GAA3B;;AAEA,MAAMC,eAAe,GAAIC,MAAD,IAA0D,CAACf,OAAO,CAACe,MAAD,CAA1F;;AAEA,MAAMC,a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AME,cAAYb,SANd;IAOE,YAAY,EAAEoB,aAAa,GAAG,IAAH,GAAUnB,YAPvC;IAQE,WAAW,EAAE,KARf;IASE,SAAS,EAAEnB,UAAU,CAACM,KAAK,CAACuD,SAAP,EAAkBtC,cAAlB,CATvB;IAUE,eAAaH,UAVf;IAWE,QAAQ,EAAEC,QAXZ;IAYE,EAAE,EAAEM,IAZN;IAaE,IAAI,EAAEA,IAbR;IAcE,OAAO,EAAEkB,iBAdX;IAeE,WAAW,EAAEf,WAff;IAgBE,KAAK,EAAEE,KAhBT;IAiBE,KAAK,EAAEqB;EAjBT,GAJF,eAuBE;IAAK,SAAS,EAAE/C,KAAK,CAACwD;EAAtB,gBACE;IAAM,SAAS,EAAExD,KAAK,CAACgB;EAAvB,GAA8BA,IAA9B,CADF,CAvBF,CADF;AA6BD,CAzFD;;AA2FAL,aAAa,CAACb,SAAd,2CAA0BA,SAA1B;AAEA,eAAea,aAAf"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
export declare const TextInput: {
|
|
3
|
-
readonly country: "country";
|
|
4
|
-
readonly email: "email";
|
|
5
|
-
readonly firstName: "firstName";
|
|
6
|
-
readonly lastName: "lastName";
|
|
7
|
-
readonly language: "language";
|
|
8
|
-
readonly login: "login";
|
|
9
|
-
readonly password: "password";
|
|
10
|
-
readonly passwordConfirmation: "passwordConfirmation";
|
|
11
|
-
readonly default: "default";
|
|
12
|
-
};
|
|
13
|
-
declare const propTypes: {
|
|
14
|
-
'aria-label': PropTypes.Requireable<string>;
|
|
15
|
-
autocomplete: PropTypes.Requireable<string>;
|
|
16
|
-
'data-testid': PropTypes.Requireable<string>;
|
|
17
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
18
|
-
equals: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
19
|
-
hint: PropTypes.Requireable<string>;
|
|
20
|
-
inputClassName: PropTypes.Requireable<string>;
|
|
21
|
-
isRequired: PropTypes.Requireable<boolean>;
|
|
22
|
-
label: PropTypes.Requireable<string>;
|
|
23
|
-
maxlength: PropTypes.Requireable<number>;
|
|
24
|
-
name: PropTypes.Requireable<string>;
|
|
25
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
26
|
-
passwordValidator: PropTypes.Requireable<(...args: any[]) => any>;
|
|
27
|
-
placeholder: PropTypes.Requireable<string>;
|
|
28
|
-
type: PropTypes.Requireable<string>;
|
|
29
|
-
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
30
|
-
wrapperClassName: PropTypes.Requireable<string>;
|
|
31
|
-
};
|
|
32
|
-
declare type TextInputType = keyof typeof TextInput;
|
|
33
|
-
export declare type FieldValue = string | number;
|
|
34
|
-
export declare type FormTextInputProps = {
|
|
35
|
-
'aria-label'?: string;
|
|
36
|
-
autocomplete?: string;
|
|
37
|
-
'data-testid'?: string;
|
|
38
|
-
disabled?: boolean;
|
|
39
|
-
equals?: FieldValue;
|
|
40
|
-
hint?: string;
|
|
41
|
-
inputClassName?: string | null;
|
|
42
|
-
isRequired?: boolean;
|
|
43
|
-
label: string;
|
|
44
|
-
maxlength?: number;
|
|
45
|
-
name: string;
|
|
46
|
-
onChange?: (value: FieldValue, isValid?: boolean) => void;
|
|
47
|
-
passwordValidator?: (password: string) => boolean;
|
|
48
|
-
placeholder?: string;
|
|
49
|
-
type?: TextInputType;
|
|
50
|
-
value: FieldValue;
|
|
51
|
-
wrapperClassName?: string | null;
|
|
52
|
-
};
|
|
53
|
-
export default propTypes;
|
|
54
|
-
//# sourceMappingURL=prop-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prop-types.d.ts","sourceRoot":"","sources":["../../../src/atom/form-text-input/prop-types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAGnC,eAAO,MAAM,SAAS;;;;;;;;;;CAUZ,CAAC;AAEX,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;CAkBd,CAAC;AAEF,aAAK,aAAa,GAAG,MAAM,OAAO,SAAS,CAAC;AAE5C,oBAAY,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzC,oBAAY,kBAAkB,GAAG;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1D,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,KAAK,EAAE,UAAU,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import keys from 'lodash/fp/keys';
|
|
3
|
-
export const TextInput = {
|
|
4
|
-
country: 'country',
|
|
5
|
-
email: 'email',
|
|
6
|
-
firstName: 'firstName',
|
|
7
|
-
lastName: 'lastName',
|
|
8
|
-
language: 'language',
|
|
9
|
-
login: 'login',
|
|
10
|
-
password: 'password',
|
|
11
|
-
passwordConfirmation: 'passwordConfirmation',
|
|
12
|
-
default: 'default'
|
|
13
|
-
};
|
|
14
|
-
const propTypes = {
|
|
15
|
-
'aria-label': PropTypes.string,
|
|
16
|
-
autocomplete: PropTypes.string,
|
|
17
|
-
'data-testid': PropTypes.string,
|
|
18
|
-
disabled: PropTypes.bool,
|
|
19
|
-
equals: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
20
|
-
hint: PropTypes.string,
|
|
21
|
-
inputClassName: PropTypes.string,
|
|
22
|
-
isRequired: PropTypes.bool,
|
|
23
|
-
label: PropTypes.string,
|
|
24
|
-
maxlength: PropTypes.number,
|
|
25
|
-
name: PropTypes.string,
|
|
26
|
-
onChange: PropTypes.func,
|
|
27
|
-
passwordValidator: PropTypes.func,
|
|
28
|
-
placeholder: PropTypes.string,
|
|
29
|
-
type: PropTypes.oneOf(keys(TextInput)),
|
|
30
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
31
|
-
wrapperClassName: PropTypes.string
|
|
32
|
-
};
|
|
33
|
-
export default propTypes;
|
|
34
|
-
//# sourceMappingURL=prop-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prop-types.js","names":["PropTypes","keys","TextInput","country","email","firstName","lastName","language","login","password","passwordConfirmation","default","propTypes","string","autocomplete","disabled","bool","equals","oneOfType","number","hint","inputClassName","isRequired","label","maxlength","name","onChange","func","passwordValidator","placeholder","type","oneOf","value","wrapperClassName"],"sources":["../../../src/atom/form-text-input/prop-types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport keys from 'lodash/fp/keys';\n\nexport const TextInput = {\n country: 'country',\n email: 'email',\n firstName: 'firstName',\n lastName: 'lastName',\n language: 'language',\n login: 'login',\n password: 'password',\n passwordConfirmation: 'passwordConfirmation',\n default: 'default'\n} as const;\n\nconst propTypes = {\n 'aria-label': PropTypes.string,\n autocomplete: PropTypes.string,\n 'data-testid': PropTypes.string,\n disabled: PropTypes.bool,\n equals: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n hint: PropTypes.string,\n inputClassName: PropTypes.string,\n isRequired: PropTypes.bool,\n label: PropTypes.string,\n maxlength: PropTypes.number,\n name: PropTypes.string,\n onChange: PropTypes.func,\n passwordValidator: PropTypes.func,\n placeholder: PropTypes.string,\n type: PropTypes.oneOf(keys(TextInput)),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n wrapperClassName: PropTypes.string\n};\n\ntype TextInputType = keyof typeof TextInput;\n\nexport type FieldValue = string | number;\n\nexport type FormTextInputProps = {\n 'aria-label'?: string;\n autocomplete?: string;\n 'data-testid'?: string;\n disabled?: boolean;\n equals?: FieldValue;\n hint?: string;\n inputClassName?: string | null;\n isRequired?: boolean;\n label: string;\n maxlength?: number;\n name: string;\n onChange?: (value: FieldValue, isValid?: boolean) => void;\n passwordValidator?: (password: string) => boolean;\n placeholder?: string;\n type?: TextInputType;\n value: FieldValue;\n wrapperClassName?: string | null;\n};\n\nexport default propTypes;\n"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,YAAtB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AAEA,OAAO,MAAMC,SAAS,GAAG;EACvBC,OAAO,EAAE,SADc;EAEvBC,KAAK,EAAE,OAFgB;EAGvBC,SAAS,EAAE,WAHY;EAIvBC,QAAQ,EAAE,UAJa;EAKvBC,QAAQ,EAAE,UALa;EAMvBC,KAAK,EAAE,OANgB;EAOvBC,QAAQ,EAAE,UAPa;EAQvBC,oBAAoB,EAAE,sBARC;EASvBC,OAAO,EAAE;AATc,CAAlB;AAYP,MAAMC,SAAS,GAAG;EAChB,cAAcZ,SAAS,CAACa,MADR;EAEhBC,YAAY,EAAEd,SAAS,CAACa,MAFR;EAGhB,eAAeb,SAAS,CAACa,MAHT;EAIhBE,QAAQ,EAAEf,SAAS,CAACgB,IAJJ;EAKhBC,MAAM,EAAEjB,SAAS,CAACkB,SAAV,CAAoB,CAAClB,SAAS,CAACa,MAAX,EAAmBb,SAAS,CAACmB,MAA7B,CAApB,CALQ;EAMhBC,IAAI,EAAEpB,SAAS,CAACa,MANA;EAOhBQ,cAAc,EAAErB,SAAS,CAACa,MAPV;EAQhBS,UAAU,EAAEtB,SAAS,CAACgB,IARN;EAShBO,KAAK,EAAEvB,SAAS,CAACa,MATD;EAUhBW,SAAS,EAAExB,SAAS,CAACmB,MAVL;EAWhBM,IAAI,EAAEzB,SAAS,CAACa,MAXA;EAYhBa,QAAQ,EAAE1B,SAAS,CAAC2B,IAZJ;EAahBC,iBAAiB,EAAE5B,SAAS,CAAC2B,IAbb;EAchBE,WAAW,EAAE7B,SAAS,CAACa,MAdP;EAehBiB,IAAI,EAAE9B,SAAS,CAAC+B,KAAV,CAAgB9B,IAAI,CAACC,SAAD,CAApB,CAfU;EAgBhB8B,KAAK,EAAEhC,SAAS,CAACkB,SAAV,CAAoB,CAAClB,SAAS,CAACa,MAAX,EAAmBb,SAAS,CAACmB,MAA7B,CAApB,CAhBS;EAiBhBc,gBAAgB,EAAEjC,SAAS,CAACa;AAjBZ,CAAlB;AA4CA,eAAeD,SAAf"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
@value colors: "../../variables/colors.css";
|
|
2
|
-
@value dark from colors;
|
|
3
|
-
@value cm_grey_400 from colors;
|
|
4
|
-
@value cm_grey_450 from colors;
|
|
5
|
-
@value white from colors;
|
|
6
|
-
|
|
7
|
-
.wrapper {
|
|
8
|
-
margin: 10px 0;
|
|
9
|
-
position: relative;
|
|
10
|
-
font-family: 'Gilroy';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.formLabel {
|
|
14
|
-
font-size: 13px;
|
|
15
|
-
text-align: left;
|
|
16
|
-
/* temporal */
|
|
17
|
-
color: dark;
|
|
18
|
-
display: block;
|
|
19
|
-
margin-bottom: 7px;
|
|
20
|
-
width: 100%;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.textInput {
|
|
24
|
-
width: 100%;
|
|
25
|
-
height: 59px;
|
|
26
|
-
background-color: white;
|
|
27
|
-
border: solid 1px cm_grey_450;
|
|
28
|
-
text-align: left;
|
|
29
|
-
margin-bottom: 26px;
|
|
30
|
-
|
|
31
|
-
appearance: none;
|
|
32
|
-
padding: 0 8px 0 15px;
|
|
33
|
-
border-radius: 0;
|
|
34
|
-
|
|
35
|
-
box-sizing: border-box;
|
|
36
|
-
cursor: text;
|
|
37
|
-
|
|
38
|
-
color: inherit;
|
|
39
|
-
font: inherit;
|
|
40
|
-
overflow: visible;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.hintWrapper {
|
|
44
|
-
font-size: 12px;
|
|
45
|
-
margin-top: -20px;
|
|
46
|
-
margin-bottom: 20px;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.hint {
|
|
50
|
-
color: cm_grey_400;
|
|
51
|
-
text-align: left;
|
|
52
|
-
font-style: italic;
|
|
53
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { FormTextInputProps } from './prop-types';
|
|
3
|
-
declare const FormTextInput: {
|
|
4
|
-
({ "aria-label": ariaLabel, autocomplete, "data-testid": dataTestid, disabled, hint, inputClassName, isRequired, label, maxlength, name, onChange, passwordValidator, placeholder, type, value, equals, wrapperClassName }: FormTextInputProps): JSX.Element;
|
|
5
|
-
propTypes: {
|
|
6
|
-
'aria-label': import("prop-types").Requireable<string>;
|
|
7
|
-
autocomplete: import("prop-types").Requireable<string>;
|
|
8
|
-
'data-testid': import("prop-types").Requireable<string>;
|
|
9
|
-
disabled: import("prop-types").Requireable<boolean>;
|
|
10
|
-
equals: import("prop-types").Requireable<NonNullable<string | number | null | undefined>>;
|
|
11
|
-
hint: import("prop-types").Requireable<string>;
|
|
12
|
-
inputClassName: import("prop-types").Requireable<string>;
|
|
13
|
-
isRequired: import("prop-types").Requireable<boolean>;
|
|
14
|
-
label: import("prop-types").Requireable<string>;
|
|
15
|
-
maxlength: import("prop-types").Requireable<number>;
|
|
16
|
-
name: import("prop-types").Requireable<string>;
|
|
17
|
-
onChange: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
18
|
-
passwordValidator: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
19
|
-
placeholder: import("prop-types").Requireable<string>;
|
|
20
|
-
type: import("prop-types").Requireable<string>;
|
|
21
|
-
value: import("prop-types").Requireable<NonNullable<string | number | null | undefined>>;
|
|
22
|
-
wrapperClassName: import("prop-types").Requireable<string>;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export default FormTextInput;
|
|
26
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atom/form-text-input/index.tsx"],"names":[],"mappings":";AAKA,OAAkB,EAAa,kBAAkB,EAAY,MAAM,cAAc,CAAC;AAkBlF,QAAA,MAAM,aAAa;gOAkBhB,kBAAkB;;;;;;;;;;;;;;;;;;;;CAuEpB,CAAC;AAIF,eAAe,aAAa,CAAC"}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.default = void 0;
|
|
5
|
-
|
|
6
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
7
|
-
|
|
8
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
-
|
|
10
|
-
var _isEmpty = _interopRequireDefault(require("lodash/fp/isEmpty"));
|
|
11
|
-
|
|
12
|
-
var _isEqual = _interopRequireDefault(require("lodash/fp/isEqual"));
|
|
13
|
-
|
|
14
|
-
var _noop = _interopRequireDefault(require("lodash/fp/noop"));
|
|
15
|
-
|
|
16
|
-
var _propTypes = _interopRequireWildcard(require("./prop-types"));
|
|
17
|
-
|
|
18
|
-
var _style = _interopRequireDefault(require("./style.css"));
|
|
19
|
-
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
-
|
|
24
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
|
|
26
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
27
|
-
|
|
28
|
-
const validate = (fieldValue, fieldEqualsValue) => {
|
|
29
|
-
return (0, _isEqual.default)(fieldValue, fieldEqualsValue);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const VALID_EMAIL_PATTERN = /[a-z0-9!#$%&'*+=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/;
|
|
33
|
-
|
|
34
|
-
const validatePattern = (fieldValue, pattern) => {
|
|
35
|
-
return pattern.test(fieldValue);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const DEFAULT_MAX_LENGTH = 150;
|
|
39
|
-
|
|
40
|
-
const isEqualsDefined = equals => !(0, _isEmpty.default)(equals);
|
|
41
|
-
|
|
42
|
-
const FormTextInput = ({
|
|
43
|
-
'aria-label': ariaLabel,
|
|
44
|
-
autocomplete,
|
|
45
|
-
'data-testid': dataTestid = 'form-text-input',
|
|
46
|
-
disabled,
|
|
47
|
-
hint,
|
|
48
|
-
inputClassName,
|
|
49
|
-
isRequired,
|
|
50
|
-
label,
|
|
51
|
-
maxlength = DEFAULT_MAX_LENGTH,
|
|
52
|
-
name,
|
|
53
|
-
onChange = _noop.default,
|
|
54
|
-
passwordValidator = () => false,
|
|
55
|
-
placeholder,
|
|
56
|
-
type = 'default',
|
|
57
|
-
value,
|
|
58
|
-
equals,
|
|
59
|
-
wrapperClassName
|
|
60
|
-
}) => {
|
|
61
|
-
const [newValue, setNewValue] = (0, _react.useState)(value);
|
|
62
|
-
const [isValid, setIsValid] = (0, _react.useState)(true);
|
|
63
|
-
const isDefaultType = (0, _react.useMemo)(() => !type || type === _propTypes.TextInput.default, [type]);
|
|
64
|
-
const isPasswordInput = (0, _react.useMemo)(() => type === _propTypes.TextInput.password || type === _propTypes.TextInput.passwordConfirmation, [type]);
|
|
65
|
-
const isEmailInput = (0, _react.useMemo)(() => type === _propTypes.TextInput.email, [type]);
|
|
66
|
-
const handleInputChange = (0, _react.useCallback)(event => {
|
|
67
|
-
const newInput = event.target.value;
|
|
68
|
-
setNewValue(() => {
|
|
69
|
-
const isNewValueValid = !isEqualsDefined(equals) || validate(newInput, equals);
|
|
70
|
-
const validPattern = !isEmailInput || validatePattern(newInput, VALID_EMAIL_PATTERN);
|
|
71
|
-
const isPasswordCompliant = !isPasswordInput || passwordValidator(newInput);
|
|
72
|
-
setIsValid(isPasswordCompliant && isNewValueValid && validPattern);
|
|
73
|
-
return newInput;
|
|
74
|
-
});
|
|
75
|
-
}, [equals, isEmailInput, isPasswordInput, passwordValidator]);
|
|
76
|
-
(0, _react.useEffect)(() => {
|
|
77
|
-
onChange(newValue, isValid);
|
|
78
|
-
return;
|
|
79
|
-
}, [isValid, newValue, onChange]);
|
|
80
|
-
const fieldLabel = (0, _react.useMemo)(() => `${label} ${isRequired ? '*' : ''}`, [isRequired, label]);
|
|
81
|
-
const errorStyle = (0, _react.useMemo)(() => isValid ? undefined : {
|
|
82
|
-
border: '2px solid rgb(247, 63, 82)'
|
|
83
|
-
}, [isValid]);
|
|
84
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
85
|
-
className: (0, _classnames.default)(_style.default.wrapper, wrapperClassName)
|
|
86
|
-
}, /*#__PURE__*/_react.default.createElement("label", {
|
|
87
|
-
className: _style.default.formLabel,
|
|
88
|
-
htmlFor: name
|
|
89
|
-
}, fieldLabel), /*#__PURE__*/_react.default.createElement("input", _extends({}, !isPasswordInput && !isEmailInput && {
|
|
90
|
-
maxLength: maxlength
|
|
91
|
-
}, isEmailInput && {
|
|
92
|
-
autoCapitalize: 'none'
|
|
93
|
-
}, isRequired && {
|
|
94
|
-
required: true
|
|
95
|
-
}, !isValid && {
|
|
96
|
-
'aria-invalid': true
|
|
97
|
-
}, {
|
|
98
|
-
type: isDefaultType ? 'text' : type,
|
|
99
|
-
"aria-label": ariaLabel,
|
|
100
|
-
autoComplete: isDefaultType ? 'on' : autocomplete,
|
|
101
|
-
autoCorrect: 'off',
|
|
102
|
-
className: (0, _classnames.default)(_style.default.textInput, inputClassName),
|
|
103
|
-
"data-testid": dataTestid,
|
|
104
|
-
disabled: disabled,
|
|
105
|
-
id: name,
|
|
106
|
-
name: name,
|
|
107
|
-
onInput: handleInputChange,
|
|
108
|
-
placeholder: placeholder,
|
|
109
|
-
value: value,
|
|
110
|
-
style: errorStyle
|
|
111
|
-
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
112
|
-
className: _style.default.hintWrapper
|
|
113
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
114
|
-
className: _style.default.hint
|
|
115
|
-
}, hint)));
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
FormTextInput.propTypes = process.env.NODE_ENV !== "production" ? _propTypes.default : {};
|
|
119
|
-
var _default = FormTextInput;
|
|
120
|
-
exports.default = _default;
|
|
121
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["validate","fieldValue","fieldEqualsValue","isEqual","VALID_EMAIL_PATTERN","validatePattern","pattern","test","DEFAULT_MAX_LENGTH","isEqualsDefined","equals","isEmpty","FormTextInput","ariaLabel","autocomplete","dataTestid","disabled","hint","inputClassName","isRequired","label","maxlength","name","onChange","noop","passwordValidator","placeholder","type","value","wrapperClassName","newValue","setNewValue","useState","isValid","setIsValid","isDefaultType","useMemo","TextInput","default","isPasswordInput","password","passwordConfirmation","isEmailInput","email","handleInputChange","useCallback","event","newInput","target","isNewValueValid","validPattern","isPasswordCompliant","useEffect","fieldLabel","errorStyle","undefined","border","classnames","style","wrapper","formLabel","maxLength","autoCapitalize","required","textInput","hintWrapper","propTypes"],"sources":["../../../src/atom/form-text-input/index.tsx"],"sourcesContent":["import React, {useCallback, useMemo, useState, useEffect, FormEvent} from 'react';\nimport classnames from 'classnames';\nimport isEmpty from 'lodash/fp/isEmpty';\nimport isEqual from 'lodash/fp/isEqual';\nimport noop from 'lodash/fp/noop';\nimport propTypes, {FieldValue, FormTextInputProps, TextInput} from './prop-types';\nimport style from './style.css';\n\nconst validate = (fieldValue: FieldValue, fieldEqualsValue: FieldValue) => {\n return isEqual(fieldValue, fieldEqualsValue);\n};\n\nconst VALID_EMAIL_PATTERN =\n /[a-z0-9!#$%&'*+=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/;\n\nconst validatePattern = (fieldValue: string, pattern: RegExp) => {\n return pattern.test(fieldValue);\n};\n\nconst DEFAULT_MAX_LENGTH = 150;\n\nconst isEqualsDefined = (equals: FieldValue | undefined): equals is FieldValue => !isEmpty(equals);\n\nconst FormTextInput = ({\n 'aria-label': ariaLabel,\n autocomplete,\n 'data-testid': dataTestid = 'form-text-input',\n disabled,\n hint,\n inputClassName,\n isRequired,\n label,\n maxlength = DEFAULT_MAX_LENGTH,\n name,\n onChange = noop,\n passwordValidator = () => false,\n placeholder,\n type = 'default',\n value,\n equals,\n wrapperClassName\n}: FormTextInputProps) => {\n const [newValue, setNewValue] = useState<FieldValue>(value);\n\n const [isValid, setIsValid] = useState<boolean>(true);\n\n const isDefaultType = useMemo(() => !type || type === TextInput.default, [type]);\n\n const isPasswordInput = useMemo(\n () => type === TextInput.password || type === TextInput.passwordConfirmation,\n [type]\n );\n\n const isEmailInput = useMemo(() => type === TextInput.email, [type]);\n\n const handleInputChange = useCallback(\n (event: FormEvent<HTMLInputElement>) => {\n const newInput: FieldValue = (event.target as HTMLInputElement).value;\n setNewValue(() => {\n const isNewValueValid = !isEqualsDefined(equals) || validate(newInput, equals);\n const validPattern = !isEmailInput || validatePattern(newInput, VALID_EMAIL_PATTERN);\n const isPasswordCompliant = !isPasswordInput || passwordValidator(newInput);\n\n setIsValid(isPasswordCompliant && isNewValueValid && validPattern);\n\n return newInput;\n });\n },\n [equals, isEmailInput, isPasswordInput, passwordValidator]\n );\n\n useEffect(() => {\n onChange(newValue, isValid);\n return;\n }, [isValid, newValue, onChange]);\n\n const fieldLabel = useMemo(() => `${label} ${isRequired ? '*' : ''}`, [isRequired, label]);\n\n const errorStyle = useMemo(\n () => (isValid ? undefined : {border: '2px solid rgb(247, 63, 82)'}),\n [isValid]\n );\n\n return (\n <div className={classnames(style.wrapper, wrapperClassName)}>\n <label className={style.formLabel} htmlFor={name}>\n {fieldLabel}\n </label>\n <input\n {...(!isPasswordInput && !isEmailInput && {maxLength: maxlength})}\n {...(isEmailInput && {autoCapitalize: 'none'})}\n {...(isRequired && {required: true})}\n {...(!isValid && {'aria-invalid': true})}\n type={isDefaultType ? 'text' : type}\n aria-label={ariaLabel}\n autoComplete={isDefaultType ? 'on' : autocomplete}\n autoCorrect={'off'}\n className={classnames(style.textInput, inputClassName)}\n data-testid={dataTestid}\n disabled={disabled}\n id={name}\n name={name}\n onInput={handleInputChange}\n placeholder={placeholder}\n value={value}\n style={errorStyle}\n />\n <div className={style.hintWrapper}>\n <span className={style.hint}>{hint}</span>\n </div>\n </div>\n );\n};\n\nFormTextInput.propTypes = propTypes;\n\nexport default FormTextInput;\n"],"mappings":";;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,QAAQ,GAAG,CAACC,UAAD,EAAyBC,gBAAzB,KAA0D;EACzE,OAAO,IAAAC,gBAAA,EAAQF,UAAR,EAAoBC,gBAApB,CAAP;AACD,CAFD;;AAIA,MAAME,mBAAmB,GACvB,mIADF;;AAGA,MAAMC,eAAe,GAAG,CAACJ,UAAD,EAAqBK,OAArB,KAAyC;EAC/D,OAAOA,OAAO,CAACC,IAAR,CAAaN,UAAb,CAAP;AACD,CAFD;;AAIA,MAAMO,kBAAkB,GAAG,GAA3B;;AAEA,MAAMC,eAAe,GAAIC,MAAD,IAA0D,CAAC,IAAAC,gBAAA,EAAQD,MAAR,CAAnF;;AAEA,MAAME,aAAa,GAAG,CAAC;EACrB,cAAcC,SADO;EAErBC,YAFqB;EAGrB,eAAeC,UAAU,GAAG,iBAHP;EAIrBC,QAJqB;EAKrBC,IALqB;EAMrBC,cANqB;EAOrBC,UAPqB;EAQrBC,KARqB;EASrBC,SAAS,GAAGb,kBATS;EAUrBc,IAVqB;EAWrBC,QAAQ,GAAGC,aAXU;EAYrBC,iBAAiB,GAAG,MAAM,KAZL;EAarBC,WAbqB;EAcrBC,IAAI,GAAG,SAdc;EAerBC,KAfqB;EAgBrBlB,MAhBqB;EAiBrBmB;AAjBqB,CAAD,KAkBI;EACxB,MAAM,CAACC,QAAD,EAAWC,WAAX,IAA0B,IAAAC,eAAA,EAAq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BT,GAJF,eAuBE;IAAK,SAAS,EAAEI,cAAA,CAAMO;EAAtB,gBACE;IAAM,SAAS,EAAEP,cAAA,CAAMzC;EAAvB,GAA8BA,IAA9B,CADF,CAvBF,CADF;AA6BD,CAzFD;;AA2FAL,aAAa,CAACsD,SAAd,2CAA0BA,kBAA1B;eAEetD,a"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
export declare const TextInput: {
|
|
3
|
-
readonly country: "country";
|
|
4
|
-
readonly email: "email";
|
|
5
|
-
readonly firstName: "firstName";
|
|
6
|
-
readonly lastName: "lastName";
|
|
7
|
-
readonly language: "language";
|
|
8
|
-
readonly login: "login";
|
|
9
|
-
readonly password: "password";
|
|
10
|
-
readonly passwordConfirmation: "passwordConfirmation";
|
|
11
|
-
readonly default: "default";
|
|
12
|
-
};
|
|
13
|
-
declare const propTypes: {
|
|
14
|
-
'aria-label': PropTypes.Requireable<string>;
|
|
15
|
-
autocomplete: PropTypes.Requireable<string>;
|
|
16
|
-
'data-testid': PropTypes.Requireable<string>;
|
|
17
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
18
|
-
equals: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
19
|
-
hint: PropTypes.Requireable<string>;
|
|
20
|
-
inputClassName: PropTypes.Requireable<string>;
|
|
21
|
-
isRequired: PropTypes.Requireable<boolean>;
|
|
22
|
-
label: PropTypes.Requireable<string>;
|
|
23
|
-
maxlength: PropTypes.Requireable<number>;
|
|
24
|
-
name: PropTypes.Requireable<string>;
|
|
25
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
26
|
-
passwordValidator: PropTypes.Requireable<(...args: any[]) => any>;
|
|
27
|
-
placeholder: PropTypes.Requireable<string>;
|
|
28
|
-
type: PropTypes.Requireable<string>;
|
|
29
|
-
value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
30
|
-
wrapperClassName: PropTypes.Requireable<string>;
|
|
31
|
-
};
|
|
32
|
-
declare type TextInputType = keyof typeof TextInput;
|
|
33
|
-
export declare type FieldValue = string | number;
|
|
34
|
-
export declare type FormTextInputProps = {
|
|
35
|
-
'aria-label'?: string;
|
|
36
|
-
autocomplete?: string;
|
|
37
|
-
'data-testid'?: string;
|
|
38
|
-
disabled?: boolean;
|
|
39
|
-
equals?: FieldValue;
|
|
40
|
-
hint?: string;
|
|
41
|
-
inputClassName?: string | null;
|
|
42
|
-
isRequired?: boolean;
|
|
43
|
-
label: string;
|
|
44
|
-
maxlength?: number;
|
|
45
|
-
name: string;
|
|
46
|
-
onChange?: (value: FieldValue, isValid?: boolean) => void;
|
|
47
|
-
passwordValidator?: (password: string) => boolean;
|
|
48
|
-
placeholder?: string;
|
|
49
|
-
type?: TextInputType;
|
|
50
|
-
value: FieldValue;
|
|
51
|
-
wrapperClassName?: string | null;
|
|
52
|
-
};
|
|
53
|
-
export default propTypes;
|
|
54
|
-
//# sourceMappingURL=prop-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prop-types.d.ts","sourceRoot":"","sources":["../../../src/atom/form-text-input/prop-types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAGnC,eAAO,MAAM,SAAS;;;;;;;;;;CAUZ,CAAC;AAEX,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;CAkBd,CAAC;AAEF,aAAK,aAAa,GAAG,MAAM,OAAO,SAAS,CAAC;AAE5C,oBAAY,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzC,oBAAY,kBAAkB,GAAG;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1D,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,KAAK,EAAE,UAAU,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.default = exports.TextInput = void 0;
|
|
5
|
-
|
|
6
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
7
|
-
|
|
8
|
-
var _keys = _interopRequireDefault(require("lodash/fp/keys"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
const TextInput = {
|
|
13
|
-
country: 'country',
|
|
14
|
-
email: 'email',
|
|
15
|
-
firstName: 'firstName',
|
|
16
|
-
lastName: 'lastName',
|
|
17
|
-
language: 'language',
|
|
18
|
-
login: 'login',
|
|
19
|
-
password: 'password',
|
|
20
|
-
passwordConfirmation: 'passwordConfirmation',
|
|
21
|
-
default: 'default'
|
|
22
|
-
};
|
|
23
|
-
exports.TextInput = TextInput;
|
|
24
|
-
const propTypes = {
|
|
25
|
-
'aria-label': _propTypes.default.string,
|
|
26
|
-
autocomplete: _propTypes.default.string,
|
|
27
|
-
'data-testid': _propTypes.default.string,
|
|
28
|
-
disabled: _propTypes.default.bool,
|
|
29
|
-
equals: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
30
|
-
hint: _propTypes.default.string,
|
|
31
|
-
inputClassName: _propTypes.default.string,
|
|
32
|
-
isRequired: _propTypes.default.bool,
|
|
33
|
-
label: _propTypes.default.string,
|
|
34
|
-
maxlength: _propTypes.default.number,
|
|
35
|
-
name: _propTypes.default.string,
|
|
36
|
-
onChange: _propTypes.default.func,
|
|
37
|
-
passwordValidator: _propTypes.default.func,
|
|
38
|
-
placeholder: _propTypes.default.string,
|
|
39
|
-
type: _propTypes.default.oneOf((0, _keys.default)(TextInput)),
|
|
40
|
-
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
41
|
-
wrapperClassName: _propTypes.default.string
|
|
42
|
-
};
|
|
43
|
-
var _default = propTypes;
|
|
44
|
-
exports.default = _default;
|
|
45
|
-
//# sourceMappingURL=prop-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prop-types.js","names":["TextInput","country","email","firstName","lastName","language","login","password","passwordConfirmation","default","propTypes","PropTypes","string","autocomplete","disabled","bool","equals","oneOfType","number","hint","inputClassName","isRequired","label","maxlength","name","onChange","func","passwordValidator","placeholder","type","oneOf","keys","value","wrapperClassName"],"sources":["../../../src/atom/form-text-input/prop-types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport keys from 'lodash/fp/keys';\n\nexport const TextInput = {\n country: 'country',\n email: 'email',\n firstName: 'firstName',\n lastName: 'lastName',\n language: 'language',\n login: 'login',\n password: 'password',\n passwordConfirmation: 'passwordConfirmation',\n default: 'default'\n} as const;\n\nconst propTypes = {\n 'aria-label': PropTypes.string,\n autocomplete: PropTypes.string,\n 'data-testid': PropTypes.string,\n disabled: PropTypes.bool,\n equals: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n hint: PropTypes.string,\n inputClassName: PropTypes.string,\n isRequired: PropTypes.bool,\n label: PropTypes.string,\n maxlength: PropTypes.number,\n name: PropTypes.string,\n onChange: PropTypes.func,\n passwordValidator: PropTypes.func,\n placeholder: PropTypes.string,\n type: PropTypes.oneOf(keys(TextInput)),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n wrapperClassName: PropTypes.string\n};\n\ntype TextInputType = keyof typeof TextInput;\n\nexport type FieldValue = string | number;\n\nexport type FormTextInputProps = {\n 'aria-label'?: string;\n autocomplete?: string;\n 'data-testid'?: string;\n disabled?: boolean;\n equals?: FieldValue;\n hint?: string;\n inputClassName?: string | null;\n isRequired?: boolean;\n label: string;\n maxlength?: number;\n name: string;\n onChange?: (value: FieldValue, isValid?: boolean) => void;\n passwordValidator?: (password: string) => boolean;\n placeholder?: string;\n type?: TextInputType;\n value: FieldValue;\n wrapperClassName?: string | null;\n};\n\nexport default propTypes;\n"],"mappings":";;;;;AAAA;;AACA;;;;AAEO,MAAMA,SAAS,GAAG;EACvBC,OAAO,EAAE,SADc;EAEvBC,KAAK,EAAE,OAFgB;EAGvBC,SAAS,EAAE,WAHY;EAIvBC,QAAQ,EAAE,UAJa;EAKvBC,QAAQ,EAAE,UALa;EAMvBC,KAAK,EAAE,OANgB;EAOvBC,QAAQ,EAAE,UAPa;EAQvBC,oBAAoB,EAAE,sBARC;EASvBC,OAAO,EAAE;AATc,CAAlB;;AAYP,MAAMC,SAAS,GAAG;EAChB,cAAcC,kBAAA,CAAUC,MADR;EAEhBC,YAAY,EAAEF,kBAAA,CAAUC,MAFR;EAGhB,eAAeD,kBAAA,CAAUC,MAHT;EAIhBE,QAAQ,EAAEH,kBAAA,CAAUI,IAJJ;EAKhBC,MAAM,EAAEL,kBAAA,CAAUM,SAAV,CAAoB,CAACN,kBAAA,CAAUC,MAAX,EAAmBD,kBAAA,CAAUO,MAA7B,CAApB,CALQ;EAMhBC,IAAI,EAAER,kBAAA,CAAUC,MANA;EAOhBQ,cAAc,EAAET,kBAAA,CAAUC,MAPV;EAQhBS,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