@devtron-labs/devtron-fe-common-lib 0.0.45-beta-6 → 0.0.45-beta-8
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 -4
- package/package.json +1 -1
- package/src/Common/CustomInput/CustomInput.tsx +11 -15
package/dist/index.js
CHANGED
|
@@ -26624,9 +26624,9 @@ 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, _b = _a.onBlur, onBlur = _b === void 0 ? function (e) { } : _b, _c = _a.onFocus, onFocus = _c === void 0 ? function (e) { } : _c,
|
|
26627
|
+
var name = _a.name, value = _a.value, error = _a.error, onChange = _a.onChange, _b = _a.onBlur, onBlur = _b === void 0 ? function (e) { } : _b, _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
26628
|
var renderLabelHelperText = function () {
|
|
26629
|
-
return (jsxRuntime.jsx("span", { children: jsxRuntime.jsx("a", __assign({ target: "_blank", href: link, className: "cursor fs-13 onlink" }, { children: linkText })) }));
|
|
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
|
};
|
|
26631
26631
|
function handleError(error) {
|
|
26632
26632
|
if (!error) {
|
|
@@ -26645,10 +26645,10 @@ function CustomInput(_a) {
|
|
|
26645
26645
|
return (jsxRuntime.jsxs("div", __assign({ className: "form__error" }, { children: [jsxRuntime.jsx(SvgIcWarning, { className: "form__icon form__icon--error" }), error] })));
|
|
26646
26646
|
}
|
|
26647
26647
|
};
|
|
26648
|
-
return (jsxRuntime.jsxs("div", __assign({ className: "flex column left top" }, { children: [label && (jsxRuntime.jsxs("label", __assign({ className: "form__label ".concat(labelClassName, " ").concat(isRequiredField ? 'dc__required-field' : '')
|
|
26648
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flex column left top" }, { children: [label && (jsxRuntime.jsxs("label", __assign({ className: "form__label ".concat(labelClassName), "data-testid": "label-".concat(dataTestid) }, { children: [jsxRuntime.jsx("span", __assign({ className: "".concat(isRequiredField ? 'dc__required-field' : '') }, { children: label })), showLink && renderLabelHelperText()] }))), jsxRuntime.jsx("input", { "data-testid": dataTestid, type: type, name: name, autoComplete: autoComplete, className: "form__input ".concat(rootClassName), onChange: function (e) {
|
|
26649
26649
|
e.persist();
|
|
26650
26650
|
onChange(e);
|
|
26651
|
-
}, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, value: value, disabled: disabled, tabIndex: tabIndex, autoFocus: autoFocus }), renderFormError(), helperText
|
|
26651
|
+
}, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, value: value, disabled: disabled, tabIndex: tabIndex, autoFocus: autoFocus }), renderFormError(), helperText && (jsxRuntime.jsxs("div", __assign({ className: "form__text-field-info" }, { children: [jsxRuntime.jsx(SvgIcInfoFilled, { className: "form__icon form__icon--info" }), jsxRuntime.jsx("p", __assign({ className: "sentence-case" }, { children: helperText }))] })))] })));
|
|
26652
26652
|
}
|
|
26653
26653
|
|
|
26654
26654
|
exports.AppStatus = AppStatus;
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ export function CustomInput({
|
|
|
9
9
|
onChange,
|
|
10
10
|
onBlur = (e) => {},
|
|
11
11
|
onFocus = (e) => {},
|
|
12
|
-
label,
|
|
12
|
+
label = '',
|
|
13
13
|
type = 'text',
|
|
14
14
|
disabled = false,
|
|
15
15
|
labelClassName = '',
|
|
@@ -28,7 +28,7 @@ export function CustomInput({
|
|
|
28
28
|
const renderLabelHelperText = () => {
|
|
29
29
|
return (
|
|
30
30
|
<span>
|
|
31
|
-
<a target="_blank" href={link} className="cursor fs-13 onlink">
|
|
31
|
+
<a target="_blank" href={link} className="cursor fs-13 onlink ml-4">
|
|
32
32
|
{linkText}
|
|
33
33
|
</a>
|
|
34
34
|
</span>
|
|
@@ -69,11 +69,9 @@ export function CustomInput({
|
|
|
69
69
|
return (
|
|
70
70
|
<div className="flex column left top">
|
|
71
71
|
{label && (
|
|
72
|
-
<label
|
|
73
|
-
className={
|
|
74
|
-
|
|
75
|
-
>
|
|
76
|
-
{label} {showLink && renderLabelHelperText()}
|
|
72
|
+
<label className={`form__label ${labelClassName}`} data-testid={`label-${dataTestid}`}>
|
|
73
|
+
<span className={`${isRequiredField ? 'dc__required-field' : ''}`}>{label}</span>
|
|
74
|
+
{showLink && renderLabelHelperText()}
|
|
77
75
|
</label>
|
|
78
76
|
)}
|
|
79
77
|
<input
|
|
@@ -96,14 +94,12 @@ export function CustomInput({
|
|
|
96
94
|
/>
|
|
97
95
|
|
|
98
96
|
{renderFormError()}
|
|
99
|
-
{helperText
|
|
100
|
-
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
</>
|
|
106
|
-
) : null}
|
|
97
|
+
{helperText && (
|
|
98
|
+
<div className="form__text-field-info">
|
|
99
|
+
<Info className="form__icon form__icon--info" />
|
|
100
|
+
<p className="sentence-case">{helperText}</p>
|
|
101
|
+
</div>
|
|
102
|
+
)}
|
|
107
103
|
</div>
|
|
108
104
|
)
|
|
109
105
|
}
|