venice-ui 2.3.6 → 2.3.7

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.
@@ -30,7 +30,6 @@ const Aligment_1 = require("../Aligment");
30
30
  const Input_styles_1 = require("./Input.styles");
31
31
  const Icons_1 = require("../Icons");
32
32
  const Theme_1 = require("../../Theme");
33
- const lodash_1 = require("lodash");
34
33
  const Input = ({ label, labelPosition = 'top', value, type = 'text', name, disabled = false, size = 'medium', handleChange, handleSubmit, width, error = false, errorMsg, placeholder, min, max, step = 0.1, autoFocus, theme = Theme_1.mainTheme, readOnly = false, prefix, }) => {
35
34
  const [inputValue, setInputValue] = (0, react_1.useState)(value);
36
35
  (0, react_1.useEffect)(() => {
@@ -41,19 +40,14 @@ const Input = ({ label, labelPosition = 'top', value, type = 'text', name, disab
41
40
  ? numberValue
42
41
  : parseFloat(numberValue);
43
42
  };
44
- const debouncedRef = (0, react_1.useRef)((0, lodash_1.debounce)((n, v) => {
45
- console.log('checking debounce', n, v);
46
- handleChange(n, v);
47
- }, 300));
48
43
  const onChange = (e) => {
49
44
  let returnedValue = type === 'number' || type === 'increase'
50
45
  ? calculateNumberValue(e.target.value)
51
46
  : e.target.value.toString();
52
47
  setInputValue(returnedValue);
53
- debouncedRef.current(name, returnedValue);
48
+ handleChange(name, returnedValue);
54
49
  };
55
50
  const onBlurValidation = () => {
56
- debouncedRef.current.flush();
57
51
  if (type === 'number' || type === 'increase') {
58
52
  let validateValue = inputValue;
59
53
  if (isNaN(parseFloat(validateValue.toString()))) {
@@ -72,7 +66,6 @@ const Input = ({ label, labelPosition = 'top', value, type = 'text', name, disab
72
66
  };
73
67
  const onKeyDown = async (e) => {
74
68
  if (handleSubmit && e.key === 'Enter') {
75
- debouncedRef.current.cancel();
76
69
  const currentValue = type === 'number' || type === 'increase'
77
70
  ? calculateNumberValue(e.currentTarget.value)
78
71
  : e.currentTarget.value.toString();
@@ -1,10 +1,9 @@
1
- import React, { useEffect, useRef, useState } from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import { ThemeProvider } from 'styled-components';
3
3
  import { Aligment } from '../Aligment';
4
4
  import { InputTextElement, InputLabelElement, InputErrorMsg, InputWrapper, EyeIconWrapper, IconsWrapper, InputReadOnlyElement, Prefix, } from './Input.styles';
5
5
  import { Icon } from '../Icons';
6
6
  import { mainTheme } from '../../Theme';
7
- import { debounce } from 'lodash';
8
7
  export const Input = ({ label, labelPosition = 'top', value, type = 'text', name, disabled = false, size = 'medium', handleChange, handleSubmit, width, error = false, errorMsg, placeholder, min, max, step = 0.1, autoFocus, theme = mainTheme, readOnly = false, prefix, }) => {
9
8
  const [inputValue, setInputValue] = useState(value);
10
9
  useEffect(() => {
@@ -15,19 +14,14 @@ export const Input = ({ label, labelPosition = 'top', value, type = 'text', name
15
14
  ? numberValue
16
15
  : parseFloat(numberValue);
17
16
  };
18
- const debouncedRef = useRef(debounce((n, v) => {
19
- console.log('checking debounce', n, v);
20
- handleChange(n, v);
21
- }, 300));
22
17
  const onChange = (e) => {
23
18
  let returnedValue = type === 'number' || type === 'increase'
24
19
  ? calculateNumberValue(e.target.value)
25
20
  : e.target.value.toString();
26
21
  setInputValue(returnedValue);
27
- debouncedRef.current(name, returnedValue);
22
+ handleChange(name, returnedValue);
28
23
  };
29
24
  const onBlurValidation = () => {
30
- debouncedRef.current.flush();
31
25
  if (type === 'number' || type === 'increase') {
32
26
  let validateValue = inputValue;
33
27
  if (isNaN(parseFloat(validateValue.toString()))) {
@@ -46,7 +40,6 @@ export const Input = ({ label, labelPosition = 'top', value, type = 'text', name
46
40
  };
47
41
  const onKeyDown = async (e) => {
48
42
  if (handleSubmit && e.key === 'Enter') {
49
- debouncedRef.current.cancel();
50
43
  const currentValue = type === 'number' || type === 'increase'
51
44
  ? calculateNumberValue(e.currentTarget.value)
52
45
  : e.currentTarget.value.toString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "venice-ui",
3
- "version": "2.3.6",
3
+ "version": "2.3.7",
4
4
  "description": "Component library",
5
5
  "main": "index.js",
6
6
  "module": "./dist/esm/index.js",