@devtron-labs/devtron-fe-common-lib 0.0.11-beta-1 → 0.0.11
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
CHANGED
|
@@ -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.
|
|
22441
|
-
var
|
|
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:
|
|
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) {
|
|
22443
22443
|
e.persist();
|
|
22444
22444
|
if (canSelect) {
|
|
22445
22445
|
select(e.target.value);
|
package/package.json
CHANGED
|
@@ -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,38 +51,23 @@ const RadioGroup: React.FC<RadioGroupInterface> & RadioGroupComposition = React.
|
|
|
51
51
|
)
|
|
52
52
|
})
|
|
53
53
|
|
|
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
|
-
}) {
|
|
54
|
+
function Radio({ value, children, className = '', showTippy = false, tippyContent = '', canSelect = true, isDisabled = false, tippyClass = '', dataTestId }) {
|
|
66
55
|
const { name, selected, select, disabled, onChange } = useRadioContext()
|
|
67
56
|
return (
|
|
68
57
|
<ConditionalWrap
|
|
69
58
|
condition={showTippy}
|
|
70
59
|
wrap={(children) => (
|
|
71
|
-
<Tippy
|
|
72
|
-
className={`default-tt w-250 ${tippyClass}`}
|
|
73
|
-
arrow={false}
|
|
74
|
-
placement={tippyPlacement as any}
|
|
75
|
-
content={tippyContent}
|
|
76
|
-
>
|
|
60
|
+
<Tippy className={`default-tt w-250 ${tippyClass}`} arrow={false} placement="bottom" content={tippyContent}>
|
|
77
61
|
{children}
|
|
78
62
|
</Tippy>
|
|
79
63
|
)}
|
|
80
64
|
>
|
|
81
|
-
<label className={`${className} radio ${isDisabled || disabled
|
|
65
|
+
<label className={`${className} radio ${(isDisabled || disabled)? 'disabled': ''}`}>
|
|
82
66
|
<input
|
|
83
67
|
type="checkbox"
|
|
84
68
|
value={value}
|
|
85
69
|
name={name}
|
|
70
|
+
|
|
86
71
|
checked={value === selected}
|
|
87
72
|
onChange={(e) => {
|
|
88
73
|
e.persist()
|
|
@@ -93,9 +78,7 @@ function Radio({
|
|
|
93
78
|
}}
|
|
94
79
|
disabled={isDisabled || disabled}
|
|
95
80
|
/>
|
|
96
|
-
<span className="radio__item-label" data-testid={dataTestId}>
|
|
97
|
-
{children}
|
|
98
|
-
</span>
|
|
81
|
+
<span className="radio__item-label" data-testid={dataTestId}>{children}</span>
|
|
99
82
|
</label>
|
|
100
83
|
</ConditionalWrap>
|
|
101
84
|
)
|