@npm_leadtech/legal-lib-components 7.28.1 → 7.29.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/dist/css/styles.css +3 -0
- package/dist/src/components/atoms/DialogMenuIcon/DialogMenuIcon.styled.js +1 -1
- package/dist/src/components/atoms/DialogMenuIcon/DialogMenuIcon.styled.ts +1 -1
- package/dist/src/components/molecules/TextInput/Input.d.ts +1 -0
- package/dist/src/components/molecules/TextInput/Input.js +4 -5
- package/dist/src/components/molecules/TextInput/Input.tsx +8 -7
- package/dist/src/components/molecules/TextInput/TextInput.js +2 -2
- package/dist/src/components/molecules/TextInput/TextInput.scss +4 -0
- package/dist/src/components/molecules/TextInput/TextInput.tsx +3 -1
- package/dist/src/components/molecules/TextInput/TextInputProps.types.d.ts +1 -0
- package/dist/src/components/molecules/TextInput/TextInputProps.types.ts +1 -0
- package/package.json +7 -1
package/dist/css/styles.css
CHANGED
|
@@ -14,6 +14,7 @@ interface InputProps {
|
|
|
14
14
|
onKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
15
15
|
onKeyUp: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
16
16
|
country: string;
|
|
17
|
+
currrencySymbol?: string;
|
|
17
18
|
}
|
|
18
19
|
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
19
20
|
export {};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
-
import currencyEuro from '../../../../images/svg/currencyDE.svg';
|
|
4
|
-
import currencyOthers from '../../../../images/svg/currencyUS.svg';
|
|
5
3
|
import eyeCloseIcon from '../../../../images/svg/eye-close.svg';
|
|
6
4
|
import eyeIcon from '../../../../images/svg/eye-24-px.svg';
|
|
7
5
|
import percent from '../../../../images/svg/percent.svg';
|
|
8
|
-
export const Input = React.forwardRef(({ value, name, placeholder, className, onChange, onClick, onBlur, onKeyDown, onKeyUp, disabled, type = 'text', maxLength, country, prefix }, ref) => {
|
|
6
|
+
export const Input = React.forwardRef(({ value, name, placeholder, className, onChange, onClick, onBlur, onKeyDown, onKeyUp, disabled, type = 'text', maxLength, country, prefix, currrencySymbol }, ref) => {
|
|
9
7
|
const [hidden, setHidden] = useState(true);
|
|
10
8
|
const showPassword = () => {
|
|
11
9
|
if (value !== null)
|
|
@@ -25,12 +23,13 @@ export const Input = React.forwardRef(({ value, name, placeholder, className, on
|
|
|
25
23
|
else if (isPercent) {
|
|
26
24
|
finalClassName += ' has-percent-suffix';
|
|
27
25
|
}
|
|
28
|
-
return (_jsxs(_Fragment, { children: [isCurrency && !!prefix && otherCurrency && (_jsx("div", { className: 'input-icon-currency-prefix', children: _jsx("
|
|
26
|
+
return (_jsxs(_Fragment, { children: [isCurrency && !!prefix && otherCurrency && currrencySymbol && (_jsx("div", { className: 'input-icon-currency-prefix', children: _jsx("span", { children: currrencySymbol }) })), _jsx("input", { type: !hidden && type === 'password' ? 'text' : type, name: name, id: name, className: finalClassName, maxLength: maxLength, placeholder: placeholder, onChange: onChange, onClick: onClick, onKeyDown: onKeyDown, onKeyUp: onKeyUp, onBlur: onBlur, value: value, "data-qa": name, disabled: disabled, ref: ref }), type === 'password' && (_jsx("button", { type: 'button', className: 'input-icon-password-button', onClick: showPassword, onKeyDown: (e) => {
|
|
29
27
|
if (e.key === 'Enter')
|
|
30
28
|
showPassword();
|
|
31
29
|
}, children: _jsx("img", { src: hidden ? eyeIcon : eyeCloseIcon, alt: '' }) })), isCurrency
|
|
32
30
|
? !!prefix &&
|
|
33
|
-
euro &&
|
|
31
|
+
euro &&
|
|
32
|
+
currrencySymbol && (_jsx("div", { className: 'input-icon-currency-suffix', children: _jsx("span", { children: currrencySymbol }) }))
|
|
34
33
|
: isPercent && (_jsx("div", { className: 'input-icon-percent-suffix', children: _jsx("img", { src: percent, alt: 'percent' }) }))] }));
|
|
35
34
|
});
|
|
36
35
|
Input.displayName = 'Input';
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
2
|
|
|
3
|
-
import currencyEuro from '../../../../images/svg/currencyDE.svg'
|
|
4
|
-
import currencyOthers from '../../../../images/svg/currencyUS.svg'
|
|
5
3
|
import eyeCloseIcon from '../../../../images/svg/eye-close.svg'
|
|
6
4
|
import eyeIcon from '../../../../images/svg/eye-24-px.svg'
|
|
7
5
|
import percent from '../../../../images/svg/percent.svg'
|
|
@@ -21,6 +19,7 @@ interface InputProps {
|
|
|
21
19
|
onKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void
|
|
22
20
|
onKeyUp: (e: React.KeyboardEvent<HTMLInputElement>) => void
|
|
23
21
|
country: string
|
|
22
|
+
currrencySymbol?: string
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
@@ -39,7 +38,8 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
|
39
38
|
type = 'text',
|
|
40
39
|
maxLength,
|
|
41
40
|
country,
|
|
42
|
-
prefix
|
|
41
|
+
prefix,
|
|
42
|
+
currrencySymbol
|
|
43
43
|
}: InputProps,
|
|
44
44
|
ref
|
|
45
45
|
) => {
|
|
@@ -66,9 +66,9 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
|
66
66
|
|
|
67
67
|
return (
|
|
68
68
|
<>
|
|
69
|
-
{isCurrency && !!prefix && otherCurrency && (
|
|
69
|
+
{isCurrency && !!prefix && otherCurrency && currrencySymbol && (
|
|
70
70
|
<div className='input-icon-currency-prefix'>
|
|
71
|
-
<
|
|
71
|
+
<span>{currrencySymbol}</span>
|
|
72
72
|
</div>
|
|
73
73
|
)}
|
|
74
74
|
<input
|
|
@@ -102,9 +102,10 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
|
102
102
|
)}
|
|
103
103
|
{isCurrency
|
|
104
104
|
? !!prefix &&
|
|
105
|
-
euro &&
|
|
105
|
+
euro &&
|
|
106
|
+
currrencySymbol && (
|
|
106
107
|
<div className='input-icon-currency-suffix'>
|
|
107
|
-
<
|
|
108
|
+
<span>{currrencySymbol}</span>
|
|
108
109
|
</div>
|
|
109
110
|
)
|
|
110
111
|
: isPercent && (
|
|
@@ -6,7 +6,7 @@ import { Input } from './Input';
|
|
|
6
6
|
import { TextInputLabel } from './TextInputLabel';
|
|
7
7
|
import { TextInputMessage } from './TextInputMessage';
|
|
8
8
|
import { TextInputTooltip } from './TextInputTooltip';
|
|
9
|
-
const TextInput = React.forwardRef(({ label, value, validate = true, isValidGroup = true, format = undefined, name, placeholder, onChange, onClick, onBlur, onKeyDown, onKeyUp, prefix = '', disabled, type = 'text', maxLength, errorMessage = '', notes, dialogMenuTip, tooltip = '', givenClass = '', children, country }, ref) => {
|
|
9
|
+
const TextInput = React.forwardRef(({ label, value, validate = true, isValidGroup = true, format = undefined, name, placeholder, onChange, onClick, onBlur, onKeyDown, onKeyUp, prefix = '', disabled, type = 'text', maxLength, errorMessage = '', notes, dialogMenuTip, tooltip = '', givenClass = '', children, country, currrencySymbol }, ref) => {
|
|
10
10
|
const classnames = classNames('e-text', {
|
|
11
11
|
[givenClass]: givenClass,
|
|
12
12
|
'e-text--is-invalid': !validate,
|
|
@@ -26,7 +26,7 @@ const TextInput = React.forwardRef(({ label, value, validate = true, isValidGrou
|
|
|
26
26
|
if (Boolean(format) && type !== 'number' && type !== 'tel') {
|
|
27
27
|
return (_jsx(NumericFormat, { name: name, id: name, placeholder: placeholder, className: 'e-text-input', onChange: onChange, onClick: onClick, value: value, "data-qa": name, disabled: disabled, maxLength: maxLength, onBlur: onBlur }));
|
|
28
28
|
}
|
|
29
|
-
return (_jsx(Input, { name: name ?? '', type: type, prefix: prefix, placeholder: placeholder ?? '', className: 'e-text-input', onChange: handleChange, onClick: onClick ?? (() => { }), value: value, "data-qa": name, disabled: disabled ?? false, maxLength: maxLength, onBlur: onBlur ?? (() => { }), ref: ref, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, country: country }));
|
|
29
|
+
return (_jsx(Input, { name: name ?? '', type: type, prefix: prefix, placeholder: placeholder ?? '', className: 'e-text-input', onChange: handleChange, onClick: onClick ?? (() => { }), value: value, "data-qa": name, disabled: disabled ?? false, maxLength: maxLength, onBlur: onBlur ?? (() => { }), ref: ref, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, country: country, currrencySymbol: currrencySymbol }));
|
|
30
30
|
};
|
|
31
31
|
return (_jsxs("div", { className: classnames, children: [Boolean(children) && _jsx("div", { className: 'e-text__children', children: children }), _jsx(TextInputTooltip, { tooltip: tooltip }), _jsx(TextInputMessage, { errorMessage: errorMessage, validate: validate }), renderInput(), _jsx(TextInputLabel, { label: label, htmlFor: name, notes: notes, dialogMenuTip: dialogMenuTip })] }));
|
|
32
32
|
});
|
|
@@ -33,7 +33,8 @@ const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(
|
|
|
33
33
|
tooltip = '',
|
|
34
34
|
givenClass = '',
|
|
35
35
|
children,
|
|
36
|
-
country
|
|
36
|
+
country,
|
|
37
|
+
currrencySymbol
|
|
37
38
|
}: TextInputProps,
|
|
38
39
|
ref
|
|
39
40
|
) => {
|
|
@@ -93,6 +94,7 @@ const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(
|
|
|
93
94
|
onKeyDown={handleKeyDown}
|
|
94
95
|
onKeyUp={handleKeyUp}
|
|
95
96
|
country={country}
|
|
97
|
+
currrencySymbol={currrencySymbol}
|
|
96
98
|
/>
|
|
97
99
|
)
|
|
98
100
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@npm_leadtech/legal-lib-components",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.29.0",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"upgrade-major": "yarn prepare-upgrade && npm version major -m \"Update major version number\" && git push && git push --tags",
|
|
17
17
|
"storybook": "storybook dev -p 6006",
|
|
18
18
|
"format": "prettier --write \"**/*.{js,jsx,json,md,ts,tsx,scss}\"",
|
|
19
|
+
"prettier": "prettier --check .",
|
|
19
20
|
"jest": "jest --maxWorkers=2",
|
|
20
21
|
"test": "jest --coverage",
|
|
21
22
|
"prepare": "husky",
|
|
@@ -121,6 +122,11 @@
|
|
|
121
122
|
"lint-staged": {
|
|
122
123
|
"**/*": "prettier --write --ignore-unknown"
|
|
123
124
|
},
|
|
125
|
+
"jestSonar": {
|
|
126
|
+
"reportPath": "coverage",
|
|
127
|
+
"reportFile": "test-reporter.xml",
|
|
128
|
+
"indent": 4
|
|
129
|
+
},
|
|
124
130
|
"exports": {
|
|
125
131
|
".": "./dist/src/index.js",
|
|
126
132
|
"./ActionButtonHeaderRatafiaCard": "./dist/src/components/atoms/ActionButtonHeaderRatafiaCard/index.js",
|