@devtron-labs/devtron-fe-common-lib 0.0.7-beta-30 → 0.0.7-beta-32
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/Modals/Modal.d.ts +1 -1
- package/dist/Common/PopupMenu.d.ts +2 -2
- package/dist/Common/Progressing.d.ts +2 -2
- package/dist/Common/Types.d.ts +1 -1
- package/dist/index.js +10 -10
- package/package.json +1 -1
- package/src/Common/EmptyState/EmptyState.tsx +2 -2
- package/src/Common/InfoColorBar/InfoColourbar.tsx +3 -3
- package/src/Common/Modals/Modal.tsx +2 -2
- package/src/Common/PopupMenu.tsx +1 -3
- package/src/Common/Progressing.tsx +6 -4
- package/src/Common/Types.ts +2 -2
|
@@ -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, noBackDrop }: ModalType) => React.ReactPortal;
|
|
3
|
+
export declare const Modal: ({ style, children, modal, rootClassName, onClick, callbackRef, preventWheelDisable, noBackDrop, }: ModalType) => React.ReactPortal;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { PopupMenuBodyType, PopupMenuButtonType, PopupMenuType } from './Types';
|
|
3
3
|
declare function PopupMenu({ children, onToggleCallback, autoClose, autoPosition, }: PopupMenuType): any;
|
|
4
4
|
declare namespace PopupMenu {
|
|
5
|
-
var Button: ({ children, disabled, rootClassName, tabIndex, onHover, isKebab, dataTestId }: PopupMenuButtonType) => JSX.Element;
|
|
6
|
-
var Body: ({ children, rootClassName, style, autoWidth, preventWheelDisable, noBackDrop,
|
|
5
|
+
var Button: ({ children, disabled, rootClassName, tabIndex, onHover, isKebab, dataTestId, }: PopupMenuButtonType) => JSX.Element;
|
|
6
|
+
var Body: ({ children, rootClassName, style, autoWidth, preventWheelDisable, noBackDrop, }: PopupMenuBodyType) => JSX.Element;
|
|
7
7
|
}
|
|
8
8
|
export default PopupMenu;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ProgressingProps } from './Types';
|
|
3
|
-
export declare function Progressing({ pageLoader, size, theme, styles }: ProgressingProps): JSX.Element;
|
|
4
|
-
export declare function DetailsProgressing({ loadingText, size, fullHeight,
|
|
3
|
+
export declare function Progressing({ pageLoader, size, theme, styles, fillColor }: ProgressingProps): JSX.Element;
|
|
4
|
+
export declare function DetailsProgressing({ loadingText, size, fullHeight, styles, fillColor, children, }: ProgressingProps): JSX.Element;
|
package/dist/Common/Types.d.ts
CHANGED
|
@@ -123,6 +123,7 @@ export interface ProgressingProps {
|
|
|
123
123
|
theme?: 'white' | 'default';
|
|
124
124
|
styles?: React.CSSProperties;
|
|
125
125
|
children?: React.ReactNode;
|
|
126
|
+
fillColor?: string;
|
|
126
127
|
}
|
|
127
128
|
export interface PopupMenuType {
|
|
128
129
|
children?: any;
|
|
@@ -146,7 +147,6 @@ export interface PopupMenuBodyType {
|
|
|
146
147
|
autoWidth?: boolean;
|
|
147
148
|
preventWheelDisable?: boolean;
|
|
148
149
|
noBackDrop?: boolean;
|
|
149
|
-
dataTestId?: string;
|
|
150
150
|
}
|
|
151
151
|
export interface ModalType {
|
|
152
152
|
style?: React.CSSProperties;
|
package/dist/index.js
CHANGED
|
@@ -506,7 +506,7 @@ var SvgIcProgressing = function SvgIcProgressing(props) {
|
|
|
506
506
|
|
|
507
507
|
function EmptyState(_a) {
|
|
508
508
|
var children = _a.children, _b = _a.className, className = _b === void 0 ? '' : _b;
|
|
509
|
-
return (jsxRuntime.jsx("div", __assign({ className: "flex column empty-state
|
|
509
|
+
return (jsxRuntime.jsx("div", __assign({ className: "flex column empty-state w-100 h-100 ".concat(className) }, { children: children })));
|
|
510
510
|
}
|
|
511
511
|
function Image(_a) {
|
|
512
512
|
var children = _a.children;
|
|
@@ -3985,13 +3985,13 @@ function useThrottledEffect(callback, delay, deps) {
|
|
|
3985
3985
|
}
|
|
3986
3986
|
|
|
3987
3987
|
function Progressing(_a) {
|
|
3988
|
-
var pageLoader = _a.pageLoader, size = _a.size, theme = _a.theme, styles = _a.styles;
|
|
3988
|
+
var pageLoader = _a.pageLoader, size = _a.size, theme = _a.theme, styles = _a.styles, fillColor = _a.fillColor;
|
|
3989
3989
|
var loaderSize = size ? "".concat(size, "px") : pageLoader ? '48px' : '20px';
|
|
3990
|
-
return (jsxRuntime.jsx("div", __assign({ className: "loader ".concat(theme || 'default', "-background"), style: styles, "data-testid": "progressing" }, { children: jsxRuntime.jsx("div", __assign({ style: { width: loaderSize, height: loaderSize } }, { children: jsxRuntime.jsx("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", className: "loader__svg" }, { children: jsxRuntime.jsxs("g", __assign({ fill: "none", fillRule: "evenodd", strokeLinecap: "round" }, { children: [jsxRuntime.jsx("animateTransform", { attributeName: "transform", attributeType: "XML", dur: "0.5s", from: "0 12 12", repeatCount: "indefinite", to: "360 12 12", type: "rotate" }), jsxRuntime.jsx("path", { fill:
|
|
3990
|
+
return (jsxRuntime.jsx("div", __assign({ className: "loader ".concat(theme || 'default', "-background"), style: styles, "data-testid": "progressing" }, { children: jsxRuntime.jsx("div", __assign({ style: { width: loaderSize, height: loaderSize } }, { children: jsxRuntime.jsx("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", className: "loader__svg" }, { children: jsxRuntime.jsxs("g", __assign({ fill: "none", fillRule: "evenodd", strokeLinecap: "round" }, { children: [jsxRuntime.jsx("animateTransform", { attributeName: "transform", attributeType: "XML", dur: "0.5s", from: "0 12 12", repeatCount: "indefinite", to: "360 12 12", type: "rotate" }), jsxRuntime.jsx("path", { fill: fillColor || '#06C', fillRule: "nonzero", d: "M12 2.5A9.5 9.5 0 1 1 2.5 12a1.5 1.5 0 0 1 3 0A6.5 6.5 0 1 0 12 5.5a1.5 1.5 0 0 1 0-3z" })] })) })) })) })));
|
|
3991
3991
|
}
|
|
3992
3992
|
function DetailsProgressing(_a) {
|
|
3993
|
-
var loadingText = _a.loadingText, _b = _a.size, size = _b === void 0 ? 24 : _b, _c = _a.fullHeight, fullHeight = _c === void 0 ? false : _c,
|
|
3994
|
-
return (jsxRuntime.jsxs("div", __assign({ className: "details-loader bcn-0 flex column fs-14 fw-6 ".concat(fullHeight ? 'h-100' : 'details-loader-height'), style: styles }, { children: [jsxRuntime.jsx("span", __assign({ style: { width: "".concat(size, "px"), height: "".concat(size, "px") } }, { children: jsxRuntime.jsx(Progressing, { size: size }) })), loadingText && jsxRuntime.jsx("span", __assign({ className: "mt-10" }, { children: loadingText })), children] })));
|
|
3993
|
+
var loadingText = _a.loadingText, _b = _a.size, size = _b === void 0 ? 24 : _b, _c = _a.fullHeight, fullHeight = _c === void 0 ? false : _c, styles = _a.styles, fillColor = _a.fillColor, children = _a.children;
|
|
3994
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "details-loader bcn-0 flex column fs-14 fw-6 ".concat(fullHeight ? 'h-100' : 'details-loader-height'), style: styles, "data-testid": "details-progressing" }, { children: [jsxRuntime.jsx("span", __assign({ style: { width: "".concat(size, "px"), height: "".concat(size, "px") } }, { children: jsxRuntime.jsx(Progressing, { size: size, fillColor: fillColor }) })), loadingText && jsxRuntime.jsx("span", __assign({ className: "mt-10" }, { children: loadingText })), children] })));
|
|
3995
3995
|
}
|
|
3996
3996
|
|
|
3997
3997
|
var VisibleModal = /** @class */ (function (_super) {
|
|
@@ -4101,7 +4101,7 @@ var Modal = function (_a) {
|
|
|
4101
4101
|
modal.classList.remove('no-back-drop');
|
|
4102
4102
|
};
|
|
4103
4103
|
}, []);
|
|
4104
|
-
return ReactDOM.createPortal(jsxRuntime.jsx("div", __assign({ tabIndex: 0, onClick: onClick, "data-testid": "modal", ref: function (el) {
|
|
4104
|
+
return ReactDOM.createPortal(jsxRuntime.jsx("div", __assign({ tabIndex: 0, onClick: onClick, "data-testid": "common-modal", ref: function (el) {
|
|
4105
4105
|
if (typeof callbackRef === 'function') {
|
|
4106
4106
|
callbackRef(el);
|
|
4107
4107
|
}
|
|
@@ -4406,9 +4406,9 @@ function Button(_a) {
|
|
|
4406
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, "data-testid": dataTestId }, { children: children })));
|
|
4407
4407
|
}
|
|
4408
4408
|
function Body$1(_a) {
|
|
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
|
|
4410
|
-
var
|
|
4411
|
-
return popupPosition ? (jsxRuntime.jsx(Modal, __assign({ callbackRef: callbackRef, onClick: handleClose,
|
|
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;
|
|
4410
|
+
var _g = usePopupContext(), handleClose = _g.handleClose, popupPosition = _g.popupPosition, opacity = _g.opacity, callbackRef = _g.callbackRef, buttonWidth = _g.buttonWidth;
|
|
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;
|
|
4412
4412
|
}
|
|
4413
4413
|
PopupMenu.Button = Button;
|
|
4414
4414
|
PopupMenu.Body = Body$1;
|
|
@@ -16370,7 +16370,7 @@ function InfoColourBar(_a) {
|
|
|
16370
16370
|
}
|
|
16371
16371
|
else if (redirectLink) {
|
|
16372
16372
|
if (internalLink) {
|
|
16373
|
-
return (jsxRuntime.jsx(reactRouterDom.Link, __assign({ to: redirectLink, onClick: linkOnClick, "data-
|
|
16373
|
+
return (jsxRuntime.jsx(reactRouterDom.Link, __assign({ to: redirectLink, onClick: linkOnClick, "data-testid": "info-bar-internal-link", className: "cursor dc__link dc__underline-onhover mr-5" }, { children: linkText })));
|
|
16374
16374
|
}
|
|
16375
16375
|
return (jsxRuntime.jsx("a", __assign({ href: redirectLink, target: "_blank", onClick: linkOnClick, "data-testid": "info-bar-redirectLink", className: "cursor dc__link dc__underline-onhover mr-5" }, { children: linkText })));
|
|
16376
16376
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { ReactComponent as Progressing } from '../../Assets/Icon/ic-progressing.
|
|
|
4
4
|
|
|
5
5
|
function EmptyState({ children, className = '' }) {
|
|
6
6
|
return (
|
|
7
|
-
<div className={`flex column empty-state
|
|
7
|
+
<div className={`flex column empty-state w-100 h-100 ${className}`}>
|
|
8
8
|
{children}
|
|
9
9
|
</div>
|
|
10
10
|
)
|
|
@@ -39,4 +39,4 @@ EmptyState.Subtitle = Subtitle
|
|
|
39
39
|
EmptyState.Button = Button
|
|
40
40
|
EmptyState.Loading = Loading
|
|
41
41
|
|
|
42
|
-
export default EmptyState
|
|
42
|
+
export default EmptyState
|
|
@@ -26,7 +26,7 @@ function InfoColourBar({
|
|
|
26
26
|
<Link
|
|
27
27
|
to={redirectLink}
|
|
28
28
|
onClick={linkOnClick}
|
|
29
|
-
data-
|
|
29
|
+
data-testid="info-bar-internal-link"
|
|
30
30
|
className="cursor dc__link dc__underline-onhover mr-5"
|
|
31
31
|
>
|
|
32
32
|
{linkText}
|
|
@@ -39,7 +39,7 @@ function InfoColourBar({
|
|
|
39
39
|
href={redirectLink}
|
|
40
40
|
target="_blank"
|
|
41
41
|
onClick={linkOnClick}
|
|
42
|
-
data-testid=
|
|
42
|
+
data-testid="info-bar-redirectLink"
|
|
43
43
|
className="cursor dc__link dc__underline-onhover mr-5"
|
|
44
44
|
>
|
|
45
45
|
{linkText}
|
|
@@ -49,7 +49,7 @@ function InfoColourBar({
|
|
|
49
49
|
|
|
50
50
|
return (
|
|
51
51
|
linkOnClick && (
|
|
52
|
-
<div onClick={linkOnClick} className="cursor dc__link dc__underline-onhover" data-testid=
|
|
52
|
+
<div onClick={linkOnClick} className="cursor dc__link dc__underline-onhover" data-testid="info-bar-linkText">
|
|
53
53
|
{linkText}
|
|
54
54
|
</div>
|
|
55
55
|
)
|
|
@@ -10,7 +10,7 @@ export const Modal = ({
|
|
|
10
10
|
onClick = null,
|
|
11
11
|
callbackRef = null,
|
|
12
12
|
preventWheelDisable = false,
|
|
13
|
-
noBackDrop
|
|
13
|
+
noBackDrop,
|
|
14
14
|
}: ModalType) => {
|
|
15
15
|
const innerRef = React.useRef(null)
|
|
16
16
|
function handleClick(e) {
|
|
@@ -50,7 +50,7 @@ export const Modal = ({
|
|
|
50
50
|
<div
|
|
51
51
|
tabIndex={0}
|
|
52
52
|
onClick={onClick}
|
|
53
|
-
data-testid=
|
|
53
|
+
data-testid="common-modal"
|
|
54
54
|
ref={(el) => {
|
|
55
55
|
if (typeof callbackRef === 'function') {
|
|
56
56
|
callbackRef(el)
|
package/src/Common/PopupMenu.tsx
CHANGED
|
@@ -142,7 +142,7 @@ function Button({
|
|
|
142
142
|
tabIndex = 0,
|
|
143
143
|
onHover = false,
|
|
144
144
|
isKebab = false,
|
|
145
|
-
dataTestId= ""
|
|
145
|
+
dataTestId = "",
|
|
146
146
|
}: PopupMenuButtonType) {
|
|
147
147
|
const { handleOpen, popupPosition, buttonRef, initialiseButtonWidth } = usePopupContext()
|
|
148
148
|
return (
|
|
@@ -170,14 +170,12 @@ function Body({
|
|
|
170
170
|
autoWidth = false,
|
|
171
171
|
preventWheelDisable = false,
|
|
172
172
|
noBackDrop,
|
|
173
|
-
dataTestId= ""
|
|
174
173
|
}: PopupMenuBodyType) {
|
|
175
174
|
const { handleClose, popupPosition, opacity, callbackRef, buttonWidth } = usePopupContext()
|
|
176
175
|
return popupPosition ? (
|
|
177
176
|
<Modal
|
|
178
177
|
callbackRef={callbackRef}
|
|
179
178
|
onClick={handleClose}
|
|
180
|
-
data-testid={dataTestId}
|
|
181
179
|
rootClassName={`${rootClassName} popup-body ${!children ? 'popup-body--empty' : ''} ${Object.keys(
|
|
182
180
|
popupPosition,
|
|
183
181
|
).join(' ')}`}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { ProgressingProps } from './Types'
|
|
3
3
|
|
|
4
|
-
export function Progressing({ pageLoader, size, theme, styles }: ProgressingProps): JSX.Element {
|
|
4
|
+
export function Progressing({ pageLoader, size, theme, styles, fillColor }: ProgressingProps): JSX.Element {
|
|
5
5
|
const loaderSize = size ? `${size}px` : pageLoader ? '48px' : '20px'
|
|
6
6
|
return (
|
|
7
7
|
<div className={`loader ${theme || 'default'}-background`} style={styles} data-testid="progressing">
|
|
@@ -18,7 +18,7 @@ export function Progressing({ pageLoader, size, theme, styles }: ProgressingProp
|
|
|
18
18
|
type="rotate"
|
|
19
19
|
/>
|
|
20
20
|
<path
|
|
21
|
-
fill=
|
|
21
|
+
fill={fillColor || '#06C'}
|
|
22
22
|
fillRule="nonzero"
|
|
23
23
|
d="M12 2.5A9.5 9.5 0 1 1 2.5 12a1.5 1.5 0 0 1 3 0A6.5 6.5 0 1 0 12 5.5a1.5 1.5 0 0 1 0-3z"
|
|
24
24
|
/>
|
|
@@ -33,16 +33,18 @@ export function DetailsProgressing({
|
|
|
33
33
|
loadingText,
|
|
34
34
|
size = 24,
|
|
35
35
|
fullHeight = false,
|
|
36
|
-
children,
|
|
37
36
|
styles,
|
|
37
|
+
fillColor,
|
|
38
|
+
children,
|
|
38
39
|
}: ProgressingProps): JSX.Element {
|
|
39
40
|
return (
|
|
40
41
|
<div
|
|
41
42
|
className={`details-loader bcn-0 flex column fs-14 fw-6 ${fullHeight ? 'h-100' : 'details-loader-height'}`}
|
|
42
43
|
style={styles}
|
|
44
|
+
data-testid="details-progressing"
|
|
43
45
|
>
|
|
44
46
|
<span style={{ width: `${size}px`, height: `${size}px` }}>
|
|
45
|
-
<Progressing size={size} />
|
|
47
|
+
<Progressing size={size} fillColor={fillColor} />
|
|
46
48
|
</span>
|
|
47
49
|
{loadingText && <span className="mt-10">{loadingText}</span>}
|
|
48
50
|
{children}
|
package/src/Common/Types.ts
CHANGED
|
@@ -135,6 +135,7 @@ export interface ProgressingProps {
|
|
|
135
135
|
theme?: 'white' | 'default'
|
|
136
136
|
styles?: React.CSSProperties
|
|
137
137
|
children?: React.ReactNode
|
|
138
|
+
fillColor?: string
|
|
138
139
|
}
|
|
139
140
|
|
|
140
141
|
export interface PopupMenuType {
|
|
@@ -151,7 +152,7 @@ export interface PopupMenuButtonType {
|
|
|
151
152
|
tabIndex?: number
|
|
152
153
|
onHover?: boolean
|
|
153
154
|
isKebab?: boolean
|
|
154
|
-
dataTestId?: string
|
|
155
|
+
dataTestId?: string
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
export interface PopupMenuBodyType {
|
|
@@ -161,7 +162,6 @@ export interface PopupMenuBodyType {
|
|
|
161
162
|
autoWidth?: boolean
|
|
162
163
|
preventWheelDisable?: boolean
|
|
163
164
|
noBackDrop?: boolean
|
|
164
|
-
dataTestId?: string
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
export interface ModalType {
|