@devtron-labs/devtron-fe-common-lib 0.0.45-beta-23 → 0.0.45-beta-24

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, onKeyPress, defaultValue, onKeyDown }: 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, onKeyDown, required, additionalErrorInfo }: CustomInputProps): JSX.Element;
@@ -1,4 +1,4 @@
1
- import { HTMLInputTypeAttribute, LegacyRef } from "react";
1
+ import { HTMLInputTypeAttribute } from "react";
2
2
  export interface CustomInputProps {
3
3
  name: string;
4
4
  value: string | number;
@@ -23,8 +23,10 @@ export interface CustomInputProps {
23
23
  handleOnBlur?: (e: any) => void;
24
24
  readOnly?: boolean;
25
25
  noTrim?: boolean;
26
- ref?: LegacyRef<HTMLInputElement>;
26
+ ref?: React.LegacyRef<HTMLInputElement>;
27
27
  onKeyPress?: (e: any) => void;
28
28
  defaultValue?: string | number | ReadonlyArray<string> | undefined;
29
29
  onKeyDown?: (e: any) => void;
30
+ required?: boolean;
31
+ additionalErrorInfo?: React.ReactNode;
30
32
  }
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, onKeyPress = _a.onKeyPress, defaultValue = _a.defaultValue, onKeyDown = _a.onKeyDown;
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, onKeyDown = _a.onKeyDown, required = _a.required, additionalErrorInfo = _a.additionalErrorInfo;
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
  };
@@ -26652,7 +26652,7 @@ function CustomInput(_a) {
26652
26652
  var renderFormError = function () {
26653
26653
  if ((error === null || error === void 0 ? void 0 : error.length) > 0) {
26654
26654
  if (typeof error === 'object') {
26655
- return handleError(error).map(function (err) { return (jsxRuntime.jsxs("div", __assign({ className: "form__error" }, { children: [jsxRuntime.jsx(SvgIcWarning, { className: "form__icon form__icon--error" }), err] }), err)); });
26655
+ return handleError(error).map(function (err) { return (jsxRuntime.jsxs("div", __assign({ className: "form__error" }, { children: [jsxRuntime.jsx(SvgIcWarning, { className: "form__icon form__icon--error" }), err, typeof additionalErrorInfo === "function" && additionalErrorInfo()] }), err)); });
26656
26656
  }
26657
26657
  return (jsxRuntime.jsxs("div", __assign({ className: "form__error" }, { children: [jsxRuntime.jsx(SvgIcWarning, { className: "form__icon form__icon--error" }), error] })));
26658
26658
  }
@@ -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, onKeyPress: onKeyPress, defaultValue: defaultValue, onKeyDown: onKeyDown }), 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, onKeyDown: onKeyDown, required: required }), 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-23",
3
+ "version": "0.0.45-beta-24",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -20,25 +20,25 @@
20
20
  "homepage": "https://github.com/devtron-labs/devtron-fe-common-lib#readme",
21
21
  "devDependencies": {
22
22
  "@rollup/plugin-babel": "^6.0.3",
23
- "@rollup/plugin-node-resolve": "^15.0.1",
23
+ "@rollup/plugin-commonjs": "24.0.1",
24
24
  "@rollup/plugin-image": "3.0.1",
25
- "rollup-plugin-peer-deps-external": "^2.2.4",
26
- "rollup-plugin-postcss": "^4.0.2",
27
- "rollup-plugin-typescript2": "^0.34.1",
25
+ "@rollup/plugin-node-resolve": "^15.0.1",
26
+ "@rollup/plugin-url": "8.0.1",
27
+ "@sentry/browser": "^7.31.1",
28
+ "@svgr/rollup": "6.5.1",
29
+ "@tippyjs/react": "^4.2.0",
28
30
  "@types/react": "17.0.39",
29
31
  "@types/react-dom": "17.0.13",
30
32
  "@types/react-router-dom": "^5.3.3",
31
- "rollup": "^3.10.0",
32
- "rollup-plugin-delete": "^2.0.0",
33
- "@svgr/rollup": "6.5.1",
34
- "@rollup/plugin-url": "8.0.1",
35
- "@rollup/plugin-commonjs": "24.0.1",
36
33
  "moment": "^2.29.4",
37
- "typescript": "^4.9.4",
38
- "react-toastify": "^8.2.0",
39
- "@tippyjs/react": "^4.2.0",
40
34
  "react-select": "5.2.2",
41
- "@sentry/browser": "^7.31.1"
35
+ "react-toastify": "^8.2.0",
36
+ "rollup": "^3.10.0",
37
+ "rollup-plugin-delete": "^2.0.0",
38
+ "rollup-plugin-peer-deps-external": "^2.2.4",
39
+ "rollup-plugin-postcss": "^4.0.2",
40
+ "rollup-plugin-typescript2": "^0.34.1",
41
+ "typescript": "^4.9.4"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@rjsf/core": "^5.13.3",
@@ -29,7 +29,9 @@ export function CustomInput({
29
29
  ref,
30
30
  onKeyPress,
31
31
  defaultValue,
32
- onKeyDown
32
+ onKeyDown,
33
+ required,
34
+ additionalErrorInfo
33
35
  }: CustomInputProps) {
34
36
  const renderLabelHelperText = () => {
35
37
  return (
@@ -71,7 +73,7 @@ export function CustomInput({
71
73
  return handleError(error).map((err: string) => (
72
74
  <div className="form__error" key={err}>
73
75
  <FormError className="form__icon form__icon--error" />
74
- {err}
76
+ {err}{typeof additionalErrorInfo === "function" && additionalErrorInfo() }
75
77
  </div>
76
78
  ))
77
79
  }
@@ -114,6 +116,7 @@ export function CustomInput({
114
116
  onKeyPress={onKeyPress}
115
117
  defaultValue={defaultValue}
116
118
  onKeyDown={onKeyDown}
119
+ required={required}
117
120
  />
118
121
 
119
122
  {renderFormError()}
@@ -1,4 +1,4 @@
1
- import { HTMLInputTypeAttribute, LegacyRef } from "react"
1
+ import { HTMLInputTypeAttribute } from "react"
2
2
 
3
3
  export interface CustomInputProps {
4
4
  name: string
@@ -24,8 +24,10 @@ export interface CustomInputProps {
24
24
  handleOnBlur?: (e) => void
25
25
  readOnly?: boolean
26
26
  noTrim?: boolean
27
- ref?: LegacyRef<HTMLInputElement>
27
+ ref?: React.LegacyRef<HTMLInputElement>
28
28
  onKeyPress?: (e) => void
29
29
  defaultValue?: string | number | ReadonlyArray<string> | undefined;
30
30
  onKeyDown?: (e) => void
31
+ required?: boolean
32
+ additionalErrorInfo?: React.ReactNode
31
33
  }