@devtron-labs/devtron-fe-common-lib 0.0.45-beta-10 → 0.0.45-beta-12
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/index.js +4 -12
- package/package.json +1 -1
- package/src/Common/CustomInput/CustomInput.tsx +12 -15
package/dist/index.js
CHANGED
|
@@ -26624,8 +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
|
|
26628
|
-
var _u = __read(React.useState(state), 2), stateForm = _u[0], setStateForm = _u[1];
|
|
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;
|
|
26629
26628
|
var renderLabelHelperText = function () {
|
|
26630
26629
|
return (jsxRuntime.jsx("span", { children: jsxRuntime.jsx("a", __assign({ target: "_blank", href: link, className: "cursor fs-13 onlink ml-4" }, { children: linkText })) }));
|
|
26631
26630
|
};
|
|
@@ -26638,19 +26637,12 @@ function CustomInput(_a) {
|
|
|
26638
26637
|
}
|
|
26639
26638
|
return error;
|
|
26640
26639
|
}
|
|
26641
|
-
var handleOnBlur = function (event) {
|
|
26640
|
+
var handleOnBlur = React.useCallback(function (event) {
|
|
26641
|
+
onChange(__assign(__assign({}, event), { target: __assign(__assign({}, event.target), { value: event.target.value.trim() }) }));
|
|
26642
26642
|
if (typeof handleBlurChange === 'function') {
|
|
26643
26643
|
handleBlurChange(event);
|
|
26644
26644
|
}
|
|
26645
|
-
|
|
26646
|
-
if (stateForm) {
|
|
26647
|
-
console.log('stateForm', stateForm);
|
|
26648
|
-
setStateForm(function (prevState) {
|
|
26649
|
-
var _a;
|
|
26650
|
-
return (__assign(__assign({}, prevState), (_a = {}, _a[event.target.name] = event.target.value.trim(), _a)));
|
|
26651
|
-
});
|
|
26652
|
-
}
|
|
26653
|
-
};
|
|
26645
|
+
}, []);
|
|
26654
26646
|
var renderFormError = function () {
|
|
26655
26647
|
if ((error === null || error === void 0 ? void 0 : error.length) > 0) {
|
|
26656
26648
|
if (typeof error === 'object') {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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 {
|
|
4
|
+
import { useCallback } from 'react'
|
|
5
5
|
|
|
6
6
|
export function CustomInput({
|
|
7
7
|
name,
|
|
@@ -28,7 +28,6 @@ export function CustomInput({
|
|
|
28
28
|
state,
|
|
29
29
|
handleBlurChange
|
|
30
30
|
}: CustomInputProps) {
|
|
31
|
-
const [stateForm, setStateForm] = useState(state)
|
|
32
31
|
|
|
33
32
|
const renderLabelHelperText = () => {
|
|
34
33
|
return (
|
|
@@ -52,21 +51,19 @@ export function CustomInput({
|
|
|
52
51
|
return error
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
const handleOnBlur = (event) => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
[event.target.name]: event.target.value.trim(),
|
|
66
|
-
}))
|
|
54
|
+
const handleOnBlur = useCallback((event) => {
|
|
55
|
+
onChange({
|
|
56
|
+
...event,
|
|
57
|
+
target: {
|
|
58
|
+
...event.target,
|
|
59
|
+
value: event.target.value.trim(),
|
|
60
|
+
},
|
|
61
|
+
})
|
|
62
|
+
if (typeof handleBlurChange === 'function') {
|
|
63
|
+
handleBlurChange(event)
|
|
67
64
|
}
|
|
68
65
|
|
|
69
|
-
}
|
|
66
|
+
},[])
|
|
70
67
|
|
|
71
68
|
const renderFormError = () => {
|
|
72
69
|
if (error?.length > 0) {
|