@devtron-labs/devtron-fe-common-lib 0.0.10 → 0.0.11-beta-1

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.
@@ -23,6 +23,7 @@ export interface DefinitionSourceType {
23
23
  }
24
24
  export interface MandatoryPluginDetailType {
25
25
  id: number;
26
+ icon: string;
26
27
  name: string;
27
28
  description?: string;
28
29
  requiredIn: PluginRequiredStage;
@@ -109,6 +109,7 @@ export interface ReloadType {
109
109
  export interface RadioGroupItemProps {
110
110
  value: string;
111
111
  dataTestId?: string;
112
+ disabled?: boolean;
112
113
  }
113
114
  export interface RadioGroupProps {
114
115
  value: string;
package/dist/index.js CHANGED
@@ -10192,7 +10192,7 @@ var RadioGroupItem = /** @class */ (function (_super) {
10192
10192
  RadioGroupItem.prototype.render = function () {
10193
10193
  var _this = this;
10194
10194
  return (jsxRuntime.jsx(RadioGroupContext.Consumer, { children: function (context) {
10195
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("label", __assign({ className: context.disabled ? 'form__radio-item disabled' : 'form__radio-item' }, { children: [jsxRuntime.jsx("input", { type: "radio", className: "form__checkbox", name: context.name, disabled: context.disabled, onChange: context.onChange, value: _this.props.value, checked: context.value === _this.props.value, "data-testid": _this.props.dataTestId }), jsxRuntime.jsxs("span", __assign({ className: "form__radio-item-content", "data-testid": "".concat(_this.props.dataTestId, "-span") }, { children: [jsxRuntime.jsx("span", { className: "radio__button" }), jsxRuntime.jsx("span", __assign({ className: "radio__title" }, { children: _this.props.children }))] }))] })) }));
10195
+ return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("label", __assign({ className: (_this.props.disabled || context.disabled) ? 'form__radio-item disabled' : 'form__radio-item' }, { children: [jsxRuntime.jsx("input", { type: "radio", className: "form__checkbox", name: context.name, disabled: context.disabled || _this.props.disabled, onChange: context.onChange, value: _this.props.value, checked: context.value === _this.props.value, "data-testid": _this.props.dataTestId }), jsxRuntime.jsxs("span", __assign({ className: "form__radio-item-content", "data-testid": "".concat(_this.props.dataTestId, "-span") }, { children: [jsxRuntime.jsx("span", { className: "radio__button" }), jsxRuntime.jsx("span", __assign({ className: "radio__title" }, { children: _this.props.children }))] }))] })) }));
10196
10196
  } }));
10197
10197
  };
10198
10198
  return RadioGroupItem;
@@ -22437,9 +22437,9 @@ var RadioGroup = React.memo(function RadioGroup(_a) {
22437
22437
  return (jsxRuntime.jsx(RadioContext.Provider, __assign({ value: { name: name, selected: selected, select: select, disabled: disabled, onChange: onChange } }, { children: jsxRuntime.jsx("div", __assign({ className: "".concat(className, " radio-group") }, { children: children })) })));
22438
22438
  });
22439
22439
  function Radio(_a) {
22440
- var value = _a.value, children = _a.children, _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.showTippy, showTippy = _c === void 0 ? false : _c, _d = _a.tippyContent, tippyContent = _d === void 0 ? '' : _d, _e = _a.canSelect, canSelect = _e === void 0 ? true : _e, _f = _a.isDisabled, isDisabled = _f === void 0 ? false : _f, _g = _a.tippyClass, tippyClass = _g === void 0 ? '' : _g, dataTestId = _a.dataTestId;
22441
- var _h = useRadioContext(), name = _h.name, selected = _h.selected, select = _h.select, disabled = _h.disabled, onChange = _h.onChange;
22442
- return (jsxRuntime.jsx(ConditionalWrap, __assign({ condition: showTippy, wrap: function (children) { return (jsxRuntime.jsx(Tippy, __assign({ className: "default-tt w-250 ".concat(tippyClass), arrow: false, placement: "bottom", content: tippyContent }, { children: children }))); } }, { children: jsxRuntime.jsxs("label", __assign({ className: "".concat(className, " radio ").concat((isDisabled || disabled) ? 'disabled' : '') }, { children: [jsxRuntime.jsx("input", { type: "checkbox", value: value, name: name, checked: value === selected, onChange: function (e) {
22440
+ var value = _a.value, children = _a.children, _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.showTippy, showTippy = _c === void 0 ? false : _c, _d = _a.tippyContent, tippyContent = _d === void 0 ? '' : _d, _e = _a.tippyPlacement, tippyPlacement = _e === void 0 ? 'bottom' : _e, _f = _a.canSelect, canSelect = _f === void 0 ? true : _f, _g = _a.isDisabled, isDisabled = _g === void 0 ? false : _g, _h = _a.tippyClass, tippyClass = _h === void 0 ? '' : _h, dataTestId = _a.dataTestId;
22441
+ var _j = useRadioContext(), name = _j.name, selected = _j.selected, select = _j.select, disabled = _j.disabled, onChange = _j.onChange;
22442
+ return (jsxRuntime.jsx(ConditionalWrap, __assign({ condition: showTippy, wrap: function (children) { return (jsxRuntime.jsx(Tippy, __assign({ className: "default-tt w-250 ".concat(tippyClass), arrow: false, placement: tippyPlacement, content: tippyContent }, { children: children }))); } }, { children: jsxRuntime.jsxs("label", __assign({ className: "".concat(className, " radio ").concat(isDisabled || disabled ? 'disabled' : '') }, { children: [jsxRuntime.jsx("input", { type: "checkbox", value: value, name: name, checked: value === selected, onChange: function (e) {
22443
22443
  e.persist();
22444
22444
  if (canSelect) {
22445
22445
  select(e.target.value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.10",
3
+ "version": "0.0.11-beta-1",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -26,6 +26,7 @@ export interface DefinitionSourceType {
26
26
  }
27
27
  export interface MandatoryPluginDetailType {
28
28
  id: number
29
+ icon: string
29
30
  name: string
30
31
  description?: string
31
32
  requiredIn: PluginRequiredStage
@@ -35,7 +35,7 @@ const RadioGroup: React.FC<RadioGroupInterface> & RadioGroupComposition = React.
35
35
  className = '',
36
36
  initialTab,
37
37
  disabled = false,
38
- dataTestId
38
+ dataTestId,
39
39
  }) {
40
40
  const [selected, select] = useState(null)
41
41
 
@@ -51,23 +51,38 @@ const RadioGroup: React.FC<RadioGroupInterface> & RadioGroupComposition = React.
51
51
  )
52
52
  })
53
53
 
54
- function Radio({ value, children, className = '', showTippy = false, tippyContent = '', canSelect = true, isDisabled = false, tippyClass = '', dataTestId }) {
54
+ function Radio({
55
+ value,
56
+ children,
57
+ className = '',
58
+ showTippy = false,
59
+ tippyContent = '',
60
+ tippyPlacement = 'bottom',
61
+ canSelect = true,
62
+ isDisabled = false,
63
+ tippyClass = '',
64
+ dataTestId,
65
+ }) {
55
66
  const { name, selected, select, disabled, onChange } = useRadioContext()
56
67
  return (
57
68
  <ConditionalWrap
58
69
  condition={showTippy}
59
70
  wrap={(children) => (
60
- <Tippy className={`default-tt w-250 ${tippyClass}`} arrow={false} placement="bottom" content={tippyContent}>
71
+ <Tippy
72
+ className={`default-tt w-250 ${tippyClass}`}
73
+ arrow={false}
74
+ placement={tippyPlacement as any}
75
+ content={tippyContent}
76
+ >
61
77
  {children}
62
78
  </Tippy>
63
79
  )}
64
80
  >
65
- <label className={`${className} radio ${(isDisabled || disabled)? 'disabled': ''}`}>
81
+ <label className={`${className} radio ${isDisabled || disabled ? 'disabled' : ''}`}>
66
82
  <input
67
83
  type="checkbox"
68
84
  value={value}
69
85
  name={name}
70
-
71
86
  checked={value === selected}
72
87
  onChange={(e) => {
73
88
  e.persist()
@@ -78,7 +93,9 @@ function Radio({ value, children, className = '', showTippy = false, tippyConten
78
93
  }}
79
94
  disabled={isDisabled || disabled}
80
95
  />
81
- <span className="radio__item-label" data-testid={dataTestId}>{children}</span>
96
+ <span className="radio__item-label" data-testid={dataTestId}>
97
+ {children}
98
+ </span>
82
99
  </label>
83
100
  </ConditionalWrap>
84
101
  )
@@ -9,12 +9,12 @@ export class RadioGroupItem extends Component<RadioGroupItemProps> {
9
9
  {(context) => {
10
10
  return (
11
11
  <>
12
- <label className={context.disabled ? 'form__radio-item disabled' : 'form__radio-item'}>
12
+ <label className={(this.props.disabled || context.disabled) ? 'form__radio-item disabled' : 'form__radio-item'}>
13
13
  <input
14
14
  type="radio"
15
15
  className="form__checkbox"
16
16
  name={context.name}
17
- disabled={context.disabled}
17
+ disabled={context.disabled || this.props.disabled}
18
18
  onChange={context.onChange}
19
19
  value={this.props.value}
20
20
  checked={context.value === this.props.value}
@@ -119,6 +119,7 @@ export interface ReloadType {
119
119
  export interface RadioGroupItemProps {
120
120
  value: string
121
121
  dataTestId?: string
122
+ disabled?: boolean
122
123
  }
123
124
 
124
125
  export interface RadioGroupProps {