@npm_leadtech/legal-lib-components 7.83.0 → 7.83.1
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/src/components/molecules/TextInput/Input.d.ts +1 -1
- package/dist/src/components/molecules/TextInput/Input.js +3 -3
- package/dist/src/components/molecules/TextInput/Input.tsx +6 -6
- package/dist/src/components/molecules/TextInput/TextInput.js +2 -2
- package/dist/src/components/molecules/TextInput/TextInput.tsx +2 -2
- package/dist/src/components/molecules/TextInput/TextInputProps.types.d.ts +1 -1
- package/dist/src/components/molecules/TextInput/TextInputProps.types.ts +1 -1
- package/dist/src/components/molecules/TextInput/stories/TextInput.stories.tsx +12 -0
- package/package.json +1 -1
|
@@ -14,7 +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
|
-
|
|
17
|
+
currencySymbol?: string;
|
|
18
18
|
}
|
|
19
19
|
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
20
20
|
export {};
|
|
@@ -3,7 +3,7 @@ import React, { useState } from 'react';
|
|
|
3
3
|
import eyeCloseIcon from '../../../../images/svg/eye-close.svg';
|
|
4
4
|
import eyeIcon from '../../../../images/svg/eye-24-px.svg';
|
|
5
5
|
import percent from '../../../../images/svg/percent.svg';
|
|
6
|
-
export const Input = React.forwardRef(({ value, name, placeholder, className, onChange, onClick, onBlur, onKeyDown, onKeyUp, disabled, type = 'text', maxLength, country, prefix,
|
|
6
|
+
export const Input = React.forwardRef(({ value, name, placeholder, className, onChange, onClick, onBlur, onKeyDown, onKeyUp, disabled, type = 'text', maxLength, country, prefix, currencySymbol }, ref) => {
|
|
7
7
|
const isShortInput = Boolean(maxLength && maxLength <= 5);
|
|
8
8
|
const [hidden, setHidden] = useState(true);
|
|
9
9
|
const showPassword = () => {
|
|
@@ -24,13 +24,13 @@ export const Input = React.forwardRef(({ value, name, placeholder, className, on
|
|
|
24
24
|
else if (isPercent) {
|
|
25
25
|
finalClassName += ' has-percent-suffix';
|
|
26
26
|
}
|
|
27
|
-
return (_jsxs(_Fragment, { children: [isCurrency && !!prefix && otherCurrency &&
|
|
27
|
+
return (_jsxs(_Fragment, { children: [isCurrency && !!prefix && otherCurrency && currencySymbol && (_jsx("div", { className: 'input-icon-currency-prefix', children: _jsx("span", { children: currencySymbol }) })), _jsx("input", { type: !hidden && type === 'password' ? 'text' : type, name: name, id: name, className: `${finalClassName} ${isShortInput ? 'e-text-input__short' : ''}`, 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) => {
|
|
28
28
|
if (e.key === 'Enter')
|
|
29
29
|
showPassword();
|
|
30
30
|
}, children: _jsx("img", { src: hidden ? eyeIcon : eyeCloseIcon, alt: '' }) })), isCurrency
|
|
31
31
|
? !!prefix &&
|
|
32
32
|
euro &&
|
|
33
|
-
|
|
33
|
+
currencySymbol && (_jsx("div", { className: 'input-icon-currency-suffix', children: _jsx("span", { children: currencySymbol }) }))
|
|
34
34
|
: isPercent && (_jsx("div", { className: 'input-icon-percent-suffix', children: _jsx("img", { src: percent, alt: 'percent' }) }))] }));
|
|
35
35
|
});
|
|
36
36
|
Input.displayName = 'Input';
|
|
@@ -19,7 +19,7 @@ interface InputProps {
|
|
|
19
19
|
onKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void
|
|
20
20
|
onKeyUp: (e: React.KeyboardEvent<HTMLInputElement>) => void
|
|
21
21
|
country: string
|
|
22
|
-
|
|
22
|
+
currencySymbol?: string
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
@@ -39,7 +39,7 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
|
39
39
|
maxLength,
|
|
40
40
|
country,
|
|
41
41
|
prefix,
|
|
42
|
-
|
|
42
|
+
currencySymbol
|
|
43
43
|
}: InputProps,
|
|
44
44
|
ref
|
|
45
45
|
) => {
|
|
@@ -67,9 +67,9 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
|
67
67
|
|
|
68
68
|
return (
|
|
69
69
|
<>
|
|
70
|
-
{isCurrency && !!prefix && otherCurrency &&
|
|
70
|
+
{isCurrency && !!prefix && otherCurrency && currencySymbol && (
|
|
71
71
|
<div className='input-icon-currency-prefix'>
|
|
72
|
-
<span>{
|
|
72
|
+
<span>{currencySymbol}</span>
|
|
73
73
|
</div>
|
|
74
74
|
)}
|
|
75
75
|
<input
|
|
@@ -104,9 +104,9 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
|
104
104
|
{isCurrency
|
|
105
105
|
? !!prefix &&
|
|
106
106
|
euro &&
|
|
107
|
-
|
|
107
|
+
currencySymbol && (
|
|
108
108
|
<div className='input-icon-currency-suffix'>
|
|
109
|
-
<span>{
|
|
109
|
+
<span>{currencySymbol}</span>
|
|
110
110
|
</div>
|
|
111
111
|
)
|
|
112
112
|
: 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,
|
|
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, currencySymbol }, 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, currencySymbol: currencySymbol }));
|
|
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
|
});
|
|
@@ -34,7 +34,7 @@ const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(
|
|
|
34
34
|
givenClass = '',
|
|
35
35
|
children,
|
|
36
36
|
country,
|
|
37
|
-
|
|
37
|
+
currencySymbol
|
|
38
38
|
}: TextInputProps,
|
|
39
39
|
ref
|
|
40
40
|
) => {
|
|
@@ -94,7 +94,7 @@ const TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(
|
|
|
94
94
|
onKeyDown={handleKeyDown}
|
|
95
95
|
onKeyUp={handleKeyUp}
|
|
96
96
|
country={country}
|
|
97
|
-
|
|
97
|
+
currencySymbol={currencySymbol}
|
|
98
98
|
/>
|
|
99
99
|
)
|
|
100
100
|
}
|
|
@@ -146,6 +146,18 @@ export const WithPrefixNoEuro: Story = {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
export const WithPrefixEuroAndCurrencySymbol: Story = {
|
|
150
|
+
args: {
|
|
151
|
+
name: 'prefix',
|
|
152
|
+
label: 'Price:',
|
|
153
|
+
value: '20.30',
|
|
154
|
+
type: 'text',
|
|
155
|
+
prefix: 'currency',
|
|
156
|
+
country: 'US',
|
|
157
|
+
currencySymbol: '$'
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
149
161
|
export const WithSufixPercent: Story = {
|
|
150
162
|
args: {
|
|
151
163
|
name: 'prefix',
|