@npm_leadtech/legal-lib-components 5.43.5 → 5.43.6

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.
@@ -9,7 +9,7 @@ export const MidBannerRatafiaSampleStyled = styled.div `
9
9
  img {
10
10
  border-radius: 8px 8px 0 0;
11
11
  box-shadow: var(--box-shadow-small);
12
- max-width: 727px;
12
+ width: 727px;
13
13
  }
14
14
  }
15
15
  &__sumarized-tag {
@@ -10,7 +10,7 @@ export const MidBannerRatafiaSampleStyled = styled.div`
10
10
  img {
11
11
  border-radius: 8px 8px 0 0;
12
12
  box-shadow: var(--box-shadow-small);
13
- max-width: 727px;
13
+ width: 727px;
14
14
  }
15
15
  }
16
16
  &__sumarized-tag {
@@ -3,7 +3,7 @@ interface InputProps {
3
3
  name: string;
4
4
  placeholder: string;
5
5
  maxLength: number;
6
- value: any;
6
+ value: string;
7
7
  type: 'password' | 'text' | 'number' | 'tel';
8
8
  disabled: boolean;
9
9
  className: string;
@@ -1,16 +1,21 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
- /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
4
- /* eslint-disable jsx-a11y/click-events-have-key-events */
5
- import React, { useState } from 'react';
2
+ import React, { useCallback, useState } from 'react';
6
3
  import eyeCloseIcon from '../../../../images/svg/eye-close.svg';
7
4
  import eyeIcon from '../../../../images/svg/eye-24-px.svg';
8
5
  export const Input = React.forwardRef(({ value, name, placeholder, className, onChange, onClick, onBlur, onKeyDown, onKeyUp, disabled, type = 'text', maxLength }, ref) => {
6
+ const [currentValue, setCurrentValue] = useState(value);
9
7
  const [hidden, setHidden] = useState(true);
10
8
  const showPassword = () => {
11
9
  if (value !== null)
12
10
  setHidden(!hidden);
13
11
  };
14
- return (_jsxs(_Fragment, { children: [_jsx("input", { type: !hidden && type === 'password' ? 'text' : type, name: name, id: name, className: className, 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("img", { className: 'input-icon-password', src: hidden ? eyeIcon : eyeCloseIcon, onClick: showPassword, alt: '' }))] }));
12
+ const handleChange = useCallback((event) => {
13
+ setCurrentValue(event.target.value);
14
+ onChange(event);
15
+ }, [currentValue]);
16
+ return (_jsxs(_Fragment, { children: [_jsx("input", { type: !hidden && type === 'password' ? 'text' : type, name: name, id: name, className: className, maxLength: maxLength, placeholder: placeholder, onChange: handleChange, onClick: onClick, onKeyDown: onKeyDown, onKeyUp: onKeyUp, onBlur: onBlur, value: currentValue, "data-qa": name, disabled: disabled, ref: ref }), type === 'password' && (_jsx("button", { className: 'input-icon-password', onClick: showPassword, onKeyDown: (e) => {
17
+ if (e.key === 'Enter')
18
+ showPassword();
19
+ }, children: _jsx("img", { src: hidden ? eyeIcon : eyeCloseIcon, alt: '' }) }))] }));
15
20
  });
16
21
  Input.displayName = 'Input';
@@ -1,8 +1,4 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
-
3
- /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
4
- /* eslint-disable jsx-a11y/click-events-have-key-events */
5
- import React, { useState } from 'react'
1
+ import React, { useCallback, useState } from 'react'
6
2
 
7
3
  import eyeCloseIcon from '../../../../images/svg/eye-close.svg'
8
4
  import eyeIcon from '../../../../images/svg/eye-24-px.svg'
@@ -11,7 +7,7 @@ interface InputProps {
11
7
  name: string
12
8
  placeholder: string
13
9
  maxLength: number
14
- value: any
10
+ value: string
15
11
  type: 'password' | 'text' | 'number' | 'tel'
16
12
  disabled: boolean
17
13
  className: string
@@ -40,12 +36,21 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
40
36
  }: InputProps,
41
37
  ref
42
38
  ) => {
39
+ const [currentValue, setCurrentValue] = useState(value)
43
40
  const [hidden, setHidden] = useState(true)
44
41
 
45
- const showPassword = (): any => {
42
+ const showPassword = (): void => {
46
43
  if (value !== null) setHidden(!hidden)
47
44
  }
48
45
 
46
+ const handleChange = useCallback(
47
+ (event: React.ChangeEvent<HTMLInputElement>) => {
48
+ setCurrentValue(event.target.value)
49
+ onChange(event)
50
+ },
51
+ [currentValue]
52
+ )
53
+
49
54
  return (
50
55
  <>
51
56
  <input
@@ -55,18 +60,26 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
55
60
  className={className}
56
61
  maxLength={maxLength}
57
62
  placeholder={placeholder}
58
- onChange={onChange}
63
+ onChange={handleChange}
59
64
  onClick={onClick}
60
65
  onKeyDown={onKeyDown}
61
66
  onKeyUp={onKeyUp}
62
67
  onBlur={onBlur}
63
- value={value}
68
+ value={currentValue}
64
69
  data-qa={name}
65
70
  disabled={disabled}
66
71
  ref={ref}
67
72
  />
68
73
  {type === 'password' && (
69
- <img className='input-icon-password' src={hidden ? eyeIcon : eyeCloseIcon} onClick={showPassword} alt='' />
74
+ <button
75
+ className='input-icon-password'
76
+ onClick={showPassword}
77
+ onKeyDown={(e) => {
78
+ if (e.key === 'Enter') showPassword()
79
+ }}
80
+ >
81
+ <img src={hidden ? eyeIcon : eyeCloseIcon} alt='' />
82
+ </button>
70
83
  )}
71
84
  </>
72
85
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npm_leadtech/legal-lib-components",
3
- "version": "5.43.5",
3
+ "version": "5.43.6",
4
4
  "license": "ISC",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",