@devtron-labs/devtron-fe-common-lib 0.0.45-beta-11 → 0.0.45-beta-13

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.
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { CustomInputProps } from './Types';
3
- export declare function CustomInput({ name, value, error, onChange, onBlur, onFocus, label, type, disabled, labelClassName, placeholder, tabIndex, dataTestid, isRequiredField, autoFocus, rootClassName, autoComplete, showLink, linkText, link, helperText, state, handleBlurChange }: CustomInputProps): JSX.Element;
3
+ export declare function CustomInput({ name, value, error, onChange, onFocus, label, type, disabled, labelClassName, placeholder, tabIndex, dataTestid, isRequiredField, autoFocus, rootClassName, autoComplete, showLink, linkText, link, helperText, handleBlurChange, }: CustomInputProps): JSX.Element;
@@ -3,7 +3,6 @@ export interface CustomInputProps {
3
3
  name: string;
4
4
  value: string | number;
5
5
  onChange: (e: any) => void;
6
- onBlur?: (e: any) => void;
7
6
  onFocus?: (e: any) => void;
8
7
  autoComplete?: string;
9
8
  label?: React.ReactNode;
@@ -21,7 +20,5 @@ export interface CustomInputProps {
21
20
  linkText?: string;
22
21
  error?: string[] | string;
23
22
  helperText?: string;
24
- state?: any;
25
- setState?: any;
26
23
  handleBlurChange?: (e: any) => void;
27
24
  }
package/dist/index.js CHANGED
@@ -26624,7 +26624,7 @@ function DevtronProgressing(_a) {
26624
26624
  }
26625
26625
 
26626
26626
  function CustomInput(_a) {
26627
- var name = _a.name, value = _a.value, error = _a.error, onChange = _a.onChange; _a.onBlur; var _c = _a.onFocus, onFocus = _c === void 0 ? function (e) { } : _c, _d = _a.label, label = _d === void 0 ? '' : _d, _e = _a.type, type = _e === void 0 ? 'text' : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.labelClassName, labelClassName = _g === void 0 ? '' : _g, _h = _a.placeholder, placeholder = _h === void 0 ? '' : _h, _j = _a.tabIndex, tabIndex = _j === void 0 ? 1 : _j, _k = _a.dataTestid, dataTestid = _k === void 0 ? '' : _k, _l = _a.isRequiredField, isRequiredField = _l === void 0 ? false : _l, _m = _a.autoFocus, autoFocus = _m === void 0 ? true : _m, _o = _a.rootClassName, rootClassName = _o === void 0 ? '' : _o, _p = _a.autoComplete, autoComplete = _p === void 0 ? 'off' : _p, _q = _a.showLink, showLink = _q === void 0 ? false : _q, _r = _a.linkText, linkText = _r === void 0 ? '' : _r, _s = _a.link, link = _s === void 0 ? '' : _s, _t = _a.helperText, helperText = _t === void 0 ? '' : _t; _a.state; var handleBlurChange = _a.handleBlurChange;
26627
+ var name = _a.name, value = _a.value, error = _a.error, onChange = _a.onChange, _b = _a.onFocus, onFocus = _b === void 0 ? function (e) { } : _b, _c = _a.label, label = _c === void 0 ? '' : _c, _d = _a.type, type = _d === void 0 ? 'text' : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.labelClassName, labelClassName = _f === void 0 ? '' : _f, _g = _a.placeholder, placeholder = _g === void 0 ? '' : _g, _h = _a.tabIndex, tabIndex = _h === void 0 ? 1 : _h, _j = _a.dataTestid, dataTestid = _j === void 0 ? '' : _j, _k = _a.isRequiredField, isRequiredField = _k === void 0 ? false : _k, _l = _a.autoFocus, autoFocus = _l === void 0 ? true : _l, _m = _a.rootClassName, rootClassName = _m === void 0 ? '' : _m, _o = _a.autoComplete, autoComplete = _o === void 0 ? 'off' : _o, _p = _a.showLink, showLink = _p === void 0 ? false : _p, _q = _a.linkText, linkText = _q === void 0 ? '' : _q, _r = _a.link, link = _r === void 0 ? '' : _r, _s = _a.helperText, helperText = _s === void 0 ? '' : _s, handleBlurChange = _a.handleBlurChange;
26628
26628
  var renderLabelHelperText = function () {
26629
26629
  return (jsxRuntime.jsx("span", { children: jsxRuntime.jsx("a", __assign({ target: "_blank", href: link, className: "cursor fs-13 onlink ml-4" }, { children: linkText })) }));
26630
26630
  };
@@ -26638,9 +26638,12 @@ function CustomInput(_a) {
26638
26638
  return error;
26639
26639
  }
26640
26640
  var handleOnBlur = function (event) {
26641
- onChange(__assign(__assign({}, event), { target: __assign(__assign({}, event.target), { value: event.target.value.trim() }) }));
26641
+ var _a;
26642
+ event.stopPropagation();
26643
+ event.target.value = (_a = event.target.value) === null || _a === void 0 ? void 0 : _a.trim();
26644
+ onChange(event);
26642
26645
  if (typeof handleBlurChange === 'function') {
26643
- handleBlurChange(__assign(__assign({}, event), { target: __assign(__assign({}, event.target), { value: event.target.value.trim() }) }));
26646
+ handleBlurChange(event);
26644
26647
  }
26645
26648
  };
26646
26649
  var renderFormError = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.45-beta-11",
3
+ "version": "0.0.45-beta-13",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,14 +1,13 @@
1
1
  import { CustomInputProps } from './Types'
2
2
  import { ReactComponent as Info } from '../../Assets/Icon/ic-info-filled.svg'
3
3
  import { ReactComponent as FormError } from '../../Assets/Icon/ic-warning.svg'
4
- import { useState } from 'react'
4
+ import { useCallback } from 'react'
5
5
 
6
6
  export function CustomInput({
7
7
  name,
8
8
  value,
9
9
  error,
10
10
  onChange,
11
- onBlur = (e) => {},
12
11
  onFocus = (e) => {},
13
12
  label = '',
14
13
  type = 'text',
@@ -25,10 +24,8 @@ export function CustomInput({
25
24
  linkText = '',
26
25
  link = '',
27
26
  helperText = '',
28
- state,
29
- handleBlurChange
27
+ handleBlurChange,
30
28
  }: CustomInputProps) {
31
-
32
29
  const renderLabelHelperText = () => {
33
30
  return (
34
31
  <span>
@@ -52,24 +49,12 @@ export function CustomInput({
52
49
  }
53
50
 
54
51
  const handleOnBlur = (event) => {
55
-
56
- onChange({
57
- ...event,
58
- target: {
59
- ...event.target,
60
- value: event.target.value.trim(),
61
- },
62
- })
63
- if (typeof handleBlurChange === 'function') {
64
- handleBlurChange({
65
- ...event,
66
- target: {
67
- ...event.target,
68
- value: event.target.value.trim(),
69
- },
70
- })
71
- }
72
-
52
+ event.stopPropagation()
53
+ event.target.value = event.target.value?.trim()
54
+ onChange(event)
55
+ if (typeof handleBlurChange === 'function') {
56
+ handleBlurChange(event)
57
+ }
73
58
  }
74
59
 
75
60
  const renderFormError = () => {
@@ -2,7 +2,6 @@ export interface CustomInputProps {
2
2
  name: string
3
3
  value: string | number
4
4
  onChange: (e: any) => void
5
- onBlur?: (e: any) => void
6
5
  onFocus?: (e: any) => void
7
6
  autoComplete?: string
8
7
  label?: React.ReactNode
@@ -20,7 +19,5 @@ export interface CustomInputProps {
20
19
  linkText?: string
21
20
  error?: string[] | string
22
21
  helperText?: string;
23
- state?;
24
- setState?;
25
22
  handleBlurChange?: (e) => void
26
23
  }