@npm_leadtech/legal-lib-components 7.46.2 → 7.47.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/TextArea/TextArea.js +2 -2
- package/dist/src/components/atoms/TextArea/TextArea.tsx +3 -1
- package/dist/src/components/atoms/TextArea/TextAreaProps.types.d.ts +1 -0
- package/dist/src/components/atoms/TextArea/TextAreaProps.types.ts +1 -0
- package/dist/src/components/molecules/TextInput/Input.d.ts +1 -1
- package/dist/src/components/molecules/TextInput/Input.js +2 -1
- package/dist/src/components/molecules/TextInput/Input.tsx +3 -2
- package/dist/src/components/molecules/TextInput/TextInput.scss +4 -0
- 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 +10 -0
- package/dist/src/components/sections/FaqSection/FaqSection.js +0 -2
- package/dist/src/components/sections/FaqSection/FaqSection.tsx +0 -1
- package/package.json +1 -1
package/dist/css/styles.css
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { TextAreaStyled } from './TextArea.styled';
|
|
3
3
|
import error from '../../../../images/svg/info-error_24px_outlined.svg';
|
|
4
|
-
const TextArea = ({ customClass = '', disabled, errorMessage, label, name, onChange, placeholder, tooltip, validate = false, value, dataQa }) => {
|
|
4
|
+
const TextArea = ({ customClass = '', disabled, errorMessage, label, name, onChange, placeholder, tooltip, validate = false, value, dataQa, maxLength }) => {
|
|
5
5
|
const classNames = `${validate ? 'e-textarea' : 'e-textarea --is-invalid'}
|
|
6
6
|
${customClass}`;
|
|
7
|
-
return (_jsxs(TextAreaStyled, { className: classNames, children: [Boolean(tooltip) && _jsx("p", { className: 'tooltip-form sans-serif --small', children: tooltip }), Boolean(errorMessage) && !validate && (_jsxs("span", { className: 'e-text--error sans-serif --small', children: [_jsx("img", { src: error, alt: errorMessage }), errorMessage] })), _jsx("textarea", { id: name, name: name, placeholder: placeholder, onChange: onChange, value: value, disabled: disabled, "data-qa": dataQa }), Boolean(label) && (_jsx("div", { className: 'e-textarea__inner', children: _jsx("div", { className: 'inputLabel', children: label }) }))] }));
|
|
7
|
+
return (_jsxs(TextAreaStyled, { className: classNames, children: [Boolean(tooltip) && _jsx("p", { className: 'tooltip-form sans-serif --small', children: tooltip }), Boolean(errorMessage) && !validate && (_jsxs("span", { className: 'e-text--error sans-serif --small', children: [_jsx("img", { src: error, alt: errorMessage }), errorMessage] })), _jsx("textarea", { id: name, name: name, placeholder: placeholder, onChange: onChange, value: value, disabled: disabled, "data-qa": dataQa, maxLength: maxLength }), Boolean(label) && (_jsx("div", { className: 'e-textarea__inner', children: _jsx("div", { className: 'inputLabel', children: label }) }))] }));
|
|
8
8
|
};
|
|
9
9
|
export default TextArea;
|
|
@@ -15,7 +15,8 @@ const TextArea: FC<TextAreaProps> = ({
|
|
|
15
15
|
tooltip,
|
|
16
16
|
validate = false,
|
|
17
17
|
value,
|
|
18
|
-
dataQa
|
|
18
|
+
dataQa,
|
|
19
|
+
maxLength
|
|
19
20
|
}) => {
|
|
20
21
|
const classNames = `${validate ? 'e-textarea' : 'e-textarea --is-invalid'}
|
|
21
22
|
${customClass}`
|
|
@@ -37,6 +38,7 @@ const TextArea: FC<TextAreaProps> = ({
|
|
|
37
38
|
value={value}
|
|
38
39
|
disabled={disabled}
|
|
39
40
|
data-qa={dataQa}
|
|
41
|
+
maxLength={maxLength}
|
|
40
42
|
/>
|
|
41
43
|
{Boolean(label) && (
|
|
42
44
|
<div className={'e-textarea__inner'}>
|
|
@@ -4,6 +4,7 @@ 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
6
|
export const Input = React.forwardRef(({ value, name, placeholder, className, onChange, onClick, onBlur, onKeyDown, onKeyUp, disabled, type = 'text', maxLength, country, prefix, currrencySymbol }, ref) => {
|
|
7
|
+
const isShortInput = Boolean(maxLength && maxLength <= 5);
|
|
7
8
|
const [hidden, setHidden] = useState(true);
|
|
8
9
|
const showPassword = () => {
|
|
9
10
|
if (value !== null)
|
|
@@ -23,7 +24,7 @@ export const Input = React.forwardRef(({ value, name, placeholder, className, on
|
|
|
23
24
|
else if (isPercent) {
|
|
24
25
|
finalClassName += ' has-percent-suffix';
|
|
25
26
|
}
|
|
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
|
|
27
|
+
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} ${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) => {
|
|
27
28
|
if (e.key === 'Enter')
|
|
28
29
|
showPassword();
|
|
29
30
|
}, children: _jsx("img", { src: hidden ? eyeIcon : eyeCloseIcon, alt: '' }) })), isCurrency
|
|
@@ -8,7 +8,7 @@ interface InputProps {
|
|
|
8
8
|
name: string
|
|
9
9
|
placeholder: string
|
|
10
10
|
prefix: string
|
|
11
|
-
maxLength
|
|
11
|
+
maxLength?: number
|
|
12
12
|
value: string
|
|
13
13
|
type: 'password' | 'text' | 'number' | 'tel'
|
|
14
14
|
disabled: boolean
|
|
@@ -43,6 +43,7 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
|
43
43
|
}: InputProps,
|
|
44
44
|
ref
|
|
45
45
|
) => {
|
|
46
|
+
const isShortInput = Boolean(maxLength && maxLength <= 5)
|
|
46
47
|
const [hidden, setHidden] = useState(true)
|
|
47
48
|
|
|
48
49
|
const showPassword = (): void => {
|
|
@@ -75,7 +76,7 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|
|
75
76
|
type={!hidden && type === 'password' ? 'text' : type}
|
|
76
77
|
name={name}
|
|
77
78
|
id={name}
|
|
78
|
-
className={finalClassName}
|
|
79
|
+
className={`${finalClassName} ${isShortInput ? 'e-text-input__short' : ''}`}
|
|
79
80
|
maxLength={maxLength}
|
|
80
81
|
placeholder={placeholder}
|
|
81
82
|
onChange={onChange}
|
|
@@ -167,3 +167,13 @@ export const WithPrefixPercent: Story = {
|
|
|
167
167
|
country: 'CA'
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
+
|
|
171
|
+
export const SmallMaxLength: Story = {
|
|
172
|
+
args: {
|
|
173
|
+
value: '',
|
|
174
|
+
name: 'Type of property',
|
|
175
|
+
label: 'Type of property',
|
|
176
|
+
type: 'text',
|
|
177
|
+
maxLength: 5
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -3,8 +3,6 @@ import classNames from 'classnames';
|
|
|
3
3
|
import { FaqGroup } from '../../organisms';
|
|
4
4
|
import { FaqSectionStyled } from './FaqSection.styled';
|
|
5
5
|
export const FaqSection = ({ groups, givenClass }) => {
|
|
6
|
-
if (!groups?.length)
|
|
7
|
-
return null;
|
|
8
6
|
const classnames = classNames(`faqSection ${givenClass ?? ''}`);
|
|
9
7
|
return (_jsx(FaqSectionStyled, { className: classnames, itemScope: true, itemType: 'https://www.schema.org/FAQPage', children: groups?.map((group) => _jsx(FaqGroup, { ...group }, group.id)) }));
|
|
10
8
|
};
|
|
@@ -6,7 +6,6 @@ import { type FaqSectionProps } from './FaqSectionProps'
|
|
|
6
6
|
import { FaqSectionStyled } from './FaqSection.styled'
|
|
7
7
|
|
|
8
8
|
export const FaqSection: React.FC<FaqSectionProps> = ({ groups, givenClass }) => {
|
|
9
|
-
if (!groups?.length) return null
|
|
10
9
|
const classnames = classNames(`faqSection ${givenClass ?? ''}`)
|
|
11
10
|
|
|
12
11
|
return (
|