@devtron-labs/devtron-fe-common-lib 0.0.7-beta-14 → 0.0.7-beta-15
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/Common/CustomTagSelector/TagLabelValueSelector.d.ts +1 -1
- package/dist/Common/CustomTagSelector/Types.d.ts +1 -0
- package/dist/Common/Modals/Modal.d.ts +1 -1
- package/dist/Common/PopupMenu.d.ts +1 -1
- package/dist/Common/Types.d.ts +2 -0
- package/dist/index.js +11 -7
- package/package.json +1 -1
- package/src/Common/CustomTagSelector/TagLabelValueSelector.tsx +4 -2
- package/src/Common/CustomTagSelector/Types.ts +1 -0
- package/src/Common/Modals/Modal.tsx +3 -0
- package/src/Common/PopupMenu.tsx +2 -0
- package/src/Common/Types.ts +2 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TagLabelValueSelectorType } from './Types';
|
|
3
|
-
export declare const TagLabelValueSelector: ({ selectedTagIndex, tagData, setTagData, tagOptions, isRequired, tagInputType, placeholder, tabIndex, refVar, dependentRef, }: TagLabelValueSelectorType) => JSX.Element;
|
|
3
|
+
export declare const TagLabelValueSelector: ({ selectedTagIndex, tagData, setTagData, tagOptions, isRequired, tagInputType, placeholder, tabIndex, refVar, dependentRef, noBackDrop }: TagLabelValueSelectorType) => JSX.Element;
|
|
@@ -49,6 +49,7 @@ export interface TagLabelValueSelectorType {
|
|
|
49
49
|
tabIndex?: number;
|
|
50
50
|
refVar?: React.MutableRefObject<HTMLTextAreaElement>;
|
|
51
51
|
dependentRef?: React.MutableRefObject<HTMLTextAreaElement>;
|
|
52
|
+
noBackDrop?: boolean;
|
|
52
53
|
}
|
|
53
54
|
export interface ResizableTagTextAreaProps {
|
|
54
55
|
className?: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ModalType } from '../Types';
|
|
3
|
-
export declare const Modal: ({ style, children, modal, rootClassName, onClick, callbackRef, preventWheelDisable, }: ModalType) => React.ReactPortal;
|
|
3
|
+
export declare const Modal: ({ style, children, modal, rootClassName, onClick, callbackRef, preventWheelDisable, noBackDrop }: ModalType) => React.ReactPortal;
|
|
@@ -3,6 +3,6 @@ import { PopupMenuBodyType, PopupMenuButtonType, PopupMenuType } from './Types';
|
|
|
3
3
|
declare function PopupMenu({ children, onToggleCallback, autoClose, autoPosition, }: PopupMenuType): any;
|
|
4
4
|
declare namespace PopupMenu {
|
|
5
5
|
var Button: ({ children, disabled, rootClassName, tabIndex, onHover, isKebab, }: PopupMenuButtonType) => JSX.Element;
|
|
6
|
-
var Body: ({ children, rootClassName, style, autoWidth, preventWheelDisable, }: PopupMenuBodyType) => JSX.Element;
|
|
6
|
+
var Body: ({ children, rootClassName, style, autoWidth, preventWheelDisable, noBackDrop }: PopupMenuBodyType) => JSX.Element;
|
|
7
7
|
}
|
|
8
8
|
export default PopupMenu;
|
package/dist/Common/Types.d.ts
CHANGED
|
@@ -142,6 +142,7 @@ export interface PopupMenuBodyType {
|
|
|
142
142
|
style?: React.CSSProperties;
|
|
143
143
|
autoWidth?: boolean;
|
|
144
144
|
preventWheelDisable?: boolean;
|
|
145
|
+
noBackDrop?: boolean;
|
|
145
146
|
}
|
|
146
147
|
export interface ModalType {
|
|
147
148
|
style?: React.CSSProperties;
|
|
@@ -151,4 +152,5 @@ export interface ModalType {
|
|
|
151
152
|
onClick?: any;
|
|
152
153
|
callbackRef?: (element?: any) => any;
|
|
153
154
|
preventWheelDisable?: boolean;
|
|
155
|
+
noBackDrop?: boolean;
|
|
154
156
|
}
|
package/dist/index.js
CHANGED
|
@@ -4057,7 +4057,7 @@ var Drawer = function (_a) {
|
|
|
4057
4057
|
};
|
|
4058
4058
|
|
|
4059
4059
|
var Modal = function (_a) {
|
|
4060
|
-
var _b = _a.style, style = _b === void 0 ? {} : _b, children = _a.children, _c = _a.modal, modal = _c === void 0 ? false : _c, _d = _a.rootClassName, rootClassName = _d === void 0 ? '' : _d, _e = _a.onClick, onClick = _e === void 0 ? null : _e, _f = _a.callbackRef, callbackRef = _f === void 0 ? null : _f, _g = _a.preventWheelDisable, preventWheelDisable = _g === void 0 ? false : _g;
|
|
4060
|
+
var _b = _a.style, style = _b === void 0 ? {} : _b, children = _a.children, _c = _a.modal, modal = _c === void 0 ? false : _c, _d = _a.rootClassName, rootClassName = _d === void 0 ? '' : _d, _e = _a.onClick, onClick = _e === void 0 ? null : _e, _f = _a.callbackRef, callbackRef = _f === void 0 ? null : _f, _g = _a.preventWheelDisable, preventWheelDisable = _g === void 0 ? false : _g, noBackDrop = _a.noBackDrop;
|
|
4061
4061
|
var innerRef = React.useRef(null);
|
|
4062
4062
|
function handleClick(e) {
|
|
4063
4063
|
var _a;
|
|
@@ -4087,6 +4087,8 @@ var Modal = function (_a) {
|
|
|
4087
4087
|
var modal = document.getElementById('visible-modal');
|
|
4088
4088
|
if (modal)
|
|
4089
4089
|
modal.classList.add('show');
|
|
4090
|
+
if (noBackDrop)
|
|
4091
|
+
modal.classList.add('no-back-drop');
|
|
4090
4092
|
if (!preventWheelDisable)
|
|
4091
4093
|
document.body.addEventListener('wheel', disableWheel, { passive: false });
|
|
4092
4094
|
return function () {
|
|
@@ -4095,6 +4097,8 @@ var Modal = function (_a) {
|
|
|
4095
4097
|
document.removeEventListener('click', handleClick);
|
|
4096
4098
|
if (modal)
|
|
4097
4099
|
modal.classList.remove('show');
|
|
4100
|
+
if (noBackDrop)
|
|
4101
|
+
modal.classList.remove('no-back-drop');
|
|
4098
4102
|
};
|
|
4099
4103
|
}, []);
|
|
4100
4104
|
return ReactDOM.createPortal(jsxRuntime.jsx("div", __assign({ tabIndex: 0, onClick: onClick, ref: function (el) {
|
|
@@ -4402,9 +4406,9 @@ function Button(_a) {
|
|
|
4402
4406
|
return (jsxRuntime.jsx("button", __assign({ ref: initialiseButtonWidth, type: "button", tabIndex: tabIndex, disabled: disabled, className: "".concat(rootClassName, " ").concat(popupPosition ? 'focused' : '', " ").concat(isKebab ? 'popup-button-kebab' : 'popup-button'), onMouseEnter: onHover ? (disabled ? null : handleOpen) : function () { }, onClick: disabled ? null : handleOpen }, { children: children })));
|
|
4403
4407
|
}
|
|
4404
4408
|
function Body$1(_a) {
|
|
4405
|
-
var _b = _a.children, children = _b === void 0 ? null : _b, _c = _a.rootClassName, rootClassName = _c === void 0 ? '' : _c, _d = _a.style, style = _d === void 0 ? {} : _d, _e = _a.autoWidth, autoWidth = _e === void 0 ? false : _e, _f = _a.preventWheelDisable, preventWheelDisable = _f === void 0 ? false : _f;
|
|
4409
|
+
var _b = _a.children, children = _b === void 0 ? null : _b, _c = _a.rootClassName, rootClassName = _c === void 0 ? '' : _c, _d = _a.style, style = _d === void 0 ? {} : _d, _e = _a.autoWidth, autoWidth = _e === void 0 ? false : _e, _f = _a.preventWheelDisable, preventWheelDisable = _f === void 0 ? false : _f, noBackDrop = _a.noBackDrop;
|
|
4406
4410
|
var _g = usePopupContext(), handleClose = _g.handleClose, popupPosition = _g.popupPosition, opacity = _g.opacity, callbackRef = _g.callbackRef, buttonWidth = _g.buttonWidth;
|
|
4407
|
-
return popupPosition ? (jsxRuntime.jsx(Modal, __assign({ callbackRef: callbackRef, onClick: handleClose, rootClassName: "".concat(rootClassName, " popup-body ").concat(!children ? 'popup-body--empty' : '', " ").concat(Object.keys(popupPosition).join(' ')), style: __assign(__assign(__assign(__assign({}, popupPosition), style), (autoWidth ? { width: buttonWidth.current } : {})), { opacity: opacity }), preventWheelDisable: preventWheelDisable }, { children: children }))) : null;
|
|
4411
|
+
return popupPosition ? (jsxRuntime.jsx(Modal, __assign({ callbackRef: callbackRef, onClick: handleClose, rootClassName: "".concat(rootClassName, " popup-body ").concat(!children ? 'popup-body--empty' : '', " ").concat(Object.keys(popupPosition).join(' ')), style: __assign(__assign(__assign(__assign({}, popupPosition), style), (autoWidth ? { width: buttonWidth.current } : {})), { opacity: opacity }), preventWheelDisable: preventWheelDisable, noBackDrop: noBackDrop }, { children: children }))) : null;
|
|
4408
4412
|
}
|
|
4409
4413
|
PopupMenu.Button = Button;
|
|
4410
4414
|
PopupMenu.Body = Body$1;
|
|
@@ -8619,7 +8623,7 @@ function ResizableTagTextArea(_a) {
|
|
|
8619
8623
|
}
|
|
8620
8624
|
|
|
8621
8625
|
var TagLabelValueSelector = function (_a) {
|
|
8622
|
-
var selectedTagIndex = _a.selectedTagIndex, tagData = _a.tagData, setTagData = _a.setTagData, tagOptions = _a.tagOptions, isRequired = _a.isRequired, tagInputType = _a.tagInputType, placeholder = _a.placeholder, _b = _a.tabIndex, tabIndex = _b === void 0 ? null : _b, refVar = _a.refVar, dependentRef = _a.dependentRef;
|
|
8626
|
+
var selectedTagIndex = _a.selectedTagIndex, tagData = _a.tagData, setTagData = _a.setTagData, tagOptions = _a.tagOptions, isRequired = _a.isRequired, tagInputType = _a.tagInputType, placeholder = _a.placeholder, _b = _a.tabIndex, tabIndex = _b === void 0 ? null : _b, refVar = _a.refVar, dependentRef = _a.dependentRef, noBackDrop = _a.noBackDrop;
|
|
8623
8627
|
var _c = __read(React.useState(''), 2), selectedValue = _c[0], setSelectedValue = _c[1];
|
|
8624
8628
|
var _d = __read(React.useState(''), 2), activeElement = _d[0], setActiveElement = _d[1];
|
|
8625
8629
|
var validationRules = new ValidationRules();
|
|
@@ -8681,10 +8685,10 @@ var TagLabelValueSelector = function (_a) {
|
|
|
8681
8685
|
return null;
|
|
8682
8686
|
};
|
|
8683
8687
|
var option = function (tag, index) {
|
|
8684
|
-
return (jsxRuntime.jsx("div", __assign({ "data-key": tag.label, "data-propagate": tag.propagate, className: "dc__hover-n50 lh-20 fs-13 fw-4 pt-6 pr-8 pb-6 pl-8 cursor", onClick: onSelectValue }, { children: tag.label }), "".concat(tag.value, "-").concat(index)));
|
|
8688
|
+
return (jsxRuntime.jsx("div", __assign({ "data-key": tag.label, "data-propagate": tag.propagate, className: "dc__hover-n50 dc__ellipsis-right lh-20 fs-13 fw-4 pt-6 pr-8 pb-6 pl-8 cursor", onClick: onSelectValue }, { children: tag.label }), "".concat(tag.value, "-").concat(index)));
|
|
8685
8689
|
};
|
|
8686
8690
|
var optionWithTippy = function (tag, index) {
|
|
8687
|
-
return (jsxRuntime.jsx(Tippy, __assign({ className: "default-tt", arrow: false, placement: "right", content: jsxRuntime.jsxs("div",
|
|
8691
|
+
return (jsxRuntime.jsx(Tippy, __assign({ className: "default-tt", arrow: false, placement: "right", content: jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", __assign({ className: "mb-10 fs-12 fw-6 cn-0 dc__break-word" }, { children: tag.label })), jsxRuntime.jsx("div", __assign({ className: "fs-12 fw-4 cn-0 dc__break-word" }, { children: tag.description }))] }) }, { children: option(tag, index) })));
|
|
8688
8692
|
};
|
|
8689
8693
|
var renderSuggestions = function () {
|
|
8690
8694
|
if (tagOptions === null || tagOptions === void 0 ? void 0 : tagOptions.length) {
|
|
@@ -8702,7 +8706,7 @@ var TagLabelValueSelector = function (_a) {
|
|
|
8702
8706
|
? "dc__no-right-radius"
|
|
8703
8707
|
: "dc__no-border-radius dc__no-right-border dc__no-left-border", " ").concat(tagData[tagInputType === exports.KEY_VALUE.KEY ? 'isInvalidKey' : 'isInvalidValue']
|
|
8704
8708
|
? 'form__input--error'
|
|
8705
|
-
: ''), value: selectedValue, onChange: handleInputChange, onBlur: handleOnBlur, onFocus: handleOnFocus, placeholder: placeholder, tabIndex: tabIndex, refVar: refVar, dependentRef: dependentRef }) })), popupMenuBody && (jsxRuntime.jsx(PopupMenu.Body, __assign({ rootClassName: "mxh-210 dc__overflow-auto tag-".concat(selectedTagIndex, "-class"), autoWidth: true, preventWheelDisable: true }, { children: popupMenuBody })))] })));
|
|
8709
|
+
: ''), value: selectedValue, onChange: handleInputChange, onBlur: handleOnBlur, onFocus: handleOnFocus, placeholder: placeholder, tabIndex: tabIndex, refVar: refVar, dependentRef: dependentRef }) })), popupMenuBody && (jsxRuntime.jsx(PopupMenu.Body, __assign({ rootClassName: "mxh-210 dc__overflow-auto tag-".concat(selectedTagIndex, "-class"), autoWidth: true, preventWheelDisable: true, noBackDrop: noBackDrop }, { children: popupMenuBody })))] })));
|
|
8706
8710
|
};
|
|
8707
8711
|
|
|
8708
8712
|
var TagDetails = function (_a) {
|
package/package.json
CHANGED
|
@@ -20,6 +20,7 @@ export const TagLabelValueSelector = ({
|
|
|
20
20
|
tabIndex = null,
|
|
21
21
|
refVar,
|
|
22
22
|
dependentRef,
|
|
23
|
+
noBackDrop
|
|
23
24
|
}: TagLabelValueSelectorType) => {
|
|
24
25
|
const [selectedValue, setSelectedValue] = useState<string>('')
|
|
25
26
|
const [activeElement, setActiveElement] = useState<string>('')
|
|
@@ -111,7 +112,7 @@ export const TagLabelValueSelector = ({
|
|
|
111
112
|
key={`${tag.value}-${index}`}
|
|
112
113
|
data-key={tag.label}
|
|
113
114
|
data-propagate={tag.propagate}
|
|
114
|
-
className="dc__hover-n50 lh-20 fs-13 fw-4 pt-6 pr-8 pb-6 pl-8 cursor"
|
|
115
|
+
className="dc__hover-n50 dc__ellipsis-right lh-20 fs-13 fw-4 pt-6 pr-8 pb-6 pl-8 cursor"
|
|
115
116
|
onClick={onSelectValue}
|
|
116
117
|
>
|
|
117
118
|
{tag.label}
|
|
@@ -126,7 +127,7 @@ export const TagLabelValueSelector = ({
|
|
|
126
127
|
arrow={false}
|
|
127
128
|
placement="right"
|
|
128
129
|
content={
|
|
129
|
-
<div
|
|
130
|
+
<div>
|
|
130
131
|
<div className="mb-10 fs-12 fw-6 cn-0 dc__break-word">
|
|
131
132
|
{tag.label}
|
|
132
133
|
</div>
|
|
@@ -188,6 +189,7 @@ export const TagLabelValueSelector = ({
|
|
|
188
189
|
rootClassName={`mxh-210 dc__overflow-auto tag-${selectedTagIndex}-class`}
|
|
189
190
|
autoWidth={true}
|
|
190
191
|
preventWheelDisable={true}
|
|
192
|
+
noBackDrop={noBackDrop}
|
|
191
193
|
>
|
|
192
194
|
{popupMenuBody}
|
|
193
195
|
</PopupMenu.Body>
|
|
@@ -52,6 +52,7 @@ export interface TagLabelValueSelectorType {
|
|
|
52
52
|
tabIndex?: number
|
|
53
53
|
refVar?: React.MutableRefObject<HTMLTextAreaElement>
|
|
54
54
|
dependentRef?: React.MutableRefObject<HTMLTextAreaElement>
|
|
55
|
+
noBackDrop?: boolean
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
export interface ResizableTagTextAreaProps {
|
|
@@ -10,6 +10,7 @@ export const Modal = ({
|
|
|
10
10
|
onClick = null,
|
|
11
11
|
callbackRef = null,
|
|
12
12
|
preventWheelDisable = false,
|
|
13
|
+
noBackDrop
|
|
13
14
|
}: ModalType) => {
|
|
14
15
|
const innerRef = React.useRef(null)
|
|
15
16
|
function handleClick(e) {
|
|
@@ -36,11 +37,13 @@ export const Modal = ({
|
|
|
36
37
|
document.addEventListener('click', handleClick)
|
|
37
38
|
let modal = document.getElementById('visible-modal')
|
|
38
39
|
if (modal) modal.classList.add('show')
|
|
40
|
+
if (noBackDrop) modal.classList.add('no-back-drop')
|
|
39
41
|
if (!preventWheelDisable) document.body.addEventListener('wheel', disableWheel, { passive: false })
|
|
40
42
|
return () => {
|
|
41
43
|
if (!preventWheelDisable) document.body.removeEventListener('wheel', disableWheel)
|
|
42
44
|
document.removeEventListener('click', handleClick)
|
|
43
45
|
if (modal) modal.classList.remove('show')
|
|
46
|
+
if (noBackDrop) modal.classList.remove('no-back-drop')
|
|
44
47
|
}
|
|
45
48
|
}, [])
|
|
46
49
|
return ReactDOM.createPortal(
|
package/src/Common/PopupMenu.tsx
CHANGED
|
@@ -167,6 +167,7 @@ function Body({
|
|
|
167
167
|
style = {},
|
|
168
168
|
autoWidth = false,
|
|
169
169
|
preventWheelDisable = false,
|
|
170
|
+
noBackDrop
|
|
170
171
|
}: PopupMenuBodyType) {
|
|
171
172
|
const { handleClose, popupPosition, opacity, callbackRef, buttonWidth } = usePopupContext()
|
|
172
173
|
return popupPosition ? (
|
|
@@ -183,6 +184,7 @@ function Body({
|
|
|
183
184
|
opacity: opacity,
|
|
184
185
|
}}
|
|
185
186
|
preventWheelDisable={preventWheelDisable}
|
|
187
|
+
noBackDrop={noBackDrop}
|
|
186
188
|
>
|
|
187
189
|
{children}
|
|
188
190
|
</Modal>
|
package/src/Common/Types.ts
CHANGED
|
@@ -157,6 +157,7 @@ export interface PopupMenuBodyType {
|
|
|
157
157
|
style?: React.CSSProperties
|
|
158
158
|
autoWidth?: boolean
|
|
159
159
|
preventWheelDisable?: boolean
|
|
160
|
+
noBackDrop?: boolean
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
export interface ModalType {
|
|
@@ -167,4 +168,5 @@ export interface ModalType {
|
|
|
167
168
|
onClick?: any
|
|
168
169
|
callbackRef?: (element?: any) => any
|
|
169
170
|
preventWheelDisable?: boolean
|
|
171
|
+
noBackDrop?: boolean
|
|
170
172
|
}
|