@devtron-labs/devtron-fe-common-lib 0.0.45-beta-19 → 0.0.45-beta-22

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, onFocus, label, type, disabled, labelClassName, placeholder, tabIndex, dataTestid, isRequiredField, autoFocus, rootClassName, autoComplete, showLink, linkText, link, helperText, handleOnBlur, readOnly, noTrim, ref }: 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, handleOnBlur, readOnly, noTrim, ref, onKeyPress, defaultValue, }: CustomInputProps): JSX.Element;
@@ -24,4 +24,6 @@ export interface CustomInputProps {
24
24
  readOnly?: boolean;
25
25
  noTrim?: boolean;
26
26
  ref?: LegacyRef<HTMLInputElement>;
27
+ onKeyPress?: (e: any) => void;
28
+ defaultValue?: string | number | ReadonlyArray<string> | undefined;
27
29
  }
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, _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 ? false : _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, handleOnBlur = _a.handleOnBlur, _t = _a.readOnly, readOnly = _t === void 0 ? false : _t, _u = _a.noTrim, noTrim = _u === void 0 ? false : _u, ref = _a.ref;
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 ? false : _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, handleOnBlur = _a.handleOnBlur, _t = _a.readOnly, readOnly = _t === void 0 ? false : _t, _u = _a.noTrim, noTrim = _u === void 0 ? false : _u, ref = _a.ref, onKeyPress = _a.onKeyPress, defaultValue = _a.defaultValue;
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
  };
@@ -26660,7 +26660,7 @@ function CustomInput(_a) {
26660
26660
  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) {
26661
26661
  e.persist();
26662
26662
  onChange(e);
26663
- }, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, value: value, disabled: disabled, tabIndex: tabIndex, autoFocus: autoFocus, readOnly: readOnly, ref: ref }), 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 }))] })))] })));
26663
+ }, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, value: value, disabled: disabled, tabIndex: tabIndex, autoFocus: autoFocus, readOnly: readOnly, ref: ref, onKeyPress: onKeyPress, defaultValue: defaultValue }), 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 }))] })))] })));
26664
26664
  }
26665
26665
 
26666
26666
  exports.AppStatus = AppStatus;
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-19",
3
+ "version": "0.0.45-beta-22",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -26,7 +26,9 @@ export function CustomInput({
26
26
  handleOnBlur,
27
27
  readOnly = false,
28
28
  noTrim = false,
29
- ref
29
+ ref,
30
+ onKeyPress,
31
+ defaultValue,
30
32
  }: CustomInputProps) {
31
33
  const renderLabelHelperText = () => {
32
34
  return (
@@ -108,6 +110,8 @@ export function CustomInput({
108
110
  autoFocus={autoFocus}
109
111
  readOnly={readOnly}
110
112
  ref={ref}
113
+ onKeyPress={onKeyPress}
114
+ defaultValue={defaultValue}
111
115
  />
112
116
 
113
117
  {renderFormError()}
@@ -25,4 +25,6 @@ export interface CustomInputProps {
25
25
  readOnly?: boolean
26
26
  noTrim?: boolean
27
27
  ref?: LegacyRef<HTMLInputElement>
28
+ onKeyPress?: (e) => void
29
+ defaultValue?: string | number | ReadonlyArray<string> | undefined;
28
30
  }