@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.
@@ -2032,6 +2032,9 @@ h2.react-datepicker__current-month {
2032
2032
  margin-bottom: 1rem;
2033
2033
  position: relative;
2034
2034
  }
2035
+ .e-text .e-text-input__short {
2036
+ width: 50%;
2037
+ }
2035
2038
  .e-text input {
2036
2039
  -webkit-appearance: none;
2037
2040
  -moz-appearance: none;
@@ -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'}>
@@ -10,4 +10,5 @@ export interface TextAreaProps {
10
10
  validate?: boolean;
11
11
  disabled?: boolean;
12
12
  onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
13
+ maxLength?: number;
13
14
  }
@@ -10,4 +10,5 @@ export interface TextAreaProps {
10
10
  validate?: boolean
11
11
  disabled?: boolean
12
12
  onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void
13
+ maxLength?: number
13
14
  }
@@ -3,7 +3,7 @@ interface InputProps {
3
3
  name: string;
4
4
  placeholder: string;
5
5
  prefix: string;
6
- maxLength: number;
6
+ maxLength?: number;
7
7
  value: string;
8
8
  type: 'password' | 'text' | 'number' | 'tel';
9
9
  disabled: boolean;
@@ -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, 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
+ 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: number
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}
@@ -10,6 +10,10 @@
10
10
  margin-bottom: 1rem;
11
11
  position: relative;
12
12
 
13
+ .e-text-input__short {
14
+ width: 50%;
15
+ }
16
+
13
17
  input {
14
18
  -webkit-appearance: none;
15
19
  -moz-appearance: none;
@@ -9,7 +9,7 @@ export interface TextInputProps {
9
9
  mask?: string;
10
10
  format?: string;
11
11
  notes?: string;
12
- maxLength?: any;
12
+ maxLength?: number;
13
13
  value?: any;
14
14
  type?: 'password' | 'text' | 'number' | 'tel';
15
15
  validate?: boolean;
@@ -10,7 +10,7 @@ export interface TextInputProps {
10
10
  mask?: string
11
11
  format?: string
12
12
  notes?: string
13
- maxLength?: any
13
+ maxLength?: number
14
14
  value?: any
15
15
  type?: 'password' | 'text' | 'number' | 'tel'
16
16
  validate?: boolean
@@ -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 (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npm_leadtech/legal-lib-components",
3
- "version": "7.46.2",
3
+ "version": "7.47.0",
4
4
  "license": "ISC",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",