@devtron-labs/devtron-fe-common-lib 0.3.2-beta-1 → 0.3.3-beta-2
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/Helper.d.ts +7 -0
- package/dist/Common/Types.d.ts +2 -1
- package/dist/Common/index.d.ts +0 -1
- package/dist/Shared/Components/Button/constants.d.ts +2 -4
- package/dist/Shared/Hooks/index.d.ts +0 -1
- package/dist/Shared/Services/ToastManager/ToastContent.d.ts +2 -0
- package/dist/Shared/Services/ToastManager/constants.d.ts +4 -0
- package/dist/Shared/Services/ToastManager/index.d.ts +3 -0
- package/dist/Shared/Services/ToastManager/toastManager.service.d.ts +80 -0
- package/dist/Shared/Services/ToastManager/types.d.ts +40 -0
- package/dist/Shared/Services/index.d.ts +1 -0
- package/dist/assets/index.css +1 -1
- package/dist/{cssMode-ImfOWSq8.js → cssMode-B13OXoi7.js} +1 -1
- package/dist/{freemarker2-BJ-2NO05.js → freemarker2-Ct3zk6su.js} +1 -1
- package/dist/{handlebars-S1Dcde3S.js → handlebars-z8cXyWsp.js} +1 -1
- package/dist/{html-bRe4LTd-.js → html-C5YZsIOl.js} +1 -1
- package/dist/{htmlMode-jC_3p_EM.js → htmlMode-CJHGI9cF.js} +1 -1
- package/dist/{index-OXtj7T5P.js → index-HI_qFSZT.js} +26627 -27002
- package/dist/index.js +209 -209
- package/dist/{javascript-S39_Kd8d.js → javascript-CFl9qx9B.js} +1 -1
- package/dist/{jsonMode-D07yabof.js → jsonMode-CFhPUhg-.js} +1 -1
- package/dist/{liquid-D5VU8OXu.js → liquid-DCew0ZkP.js} +1 -1
- package/dist/{mdx-DULFR6p6.js → mdx-nJA0itMs.js} +1 -1
- package/dist/{python-B48J-3tG.js → python-CJdV0WoO.js} +1 -1
- package/dist/{razor-CEmTA50y.js → razor-DsmGOdrH.js} +1 -1
- package/dist/{tsMode-D6BCsW2e.js → tsMode-BarBggo3.js} +1 -1
- package/dist/{typescript-ChQA5UDJ.js → typescript-BhEmf81H.js} +1 -1
- package/dist/{xml-DnTl2a0T.js → xml-DaeC4WxU.js} +1 -1
- package/dist/{yaml-Dg6m_Zyc.js → yaml-m5VqXoDZ.js} +1 -1
- package/package.json +2 -2
- package/dist/Common/ToastBody.d.ts +0 -23
- package/dist/Shared/Hooks/useForm/index.d.ts +0 -2
- package/dist/Shared/Hooks/useForm/useForm.d.ts +0 -29
- package/dist/Shared/Hooks/useForm/useForm.types.d.ts +0 -30
- package/dist/Shared/Hooks/useForm/useForm.utils.d.ts +0 -10
package/dist/Common/Helper.d.ts
CHANGED
|
@@ -22,6 +22,12 @@ export declare const refresh: () => void;
|
|
|
22
22
|
export declare const reportIssue: () => void;
|
|
23
23
|
export declare function useEffectAfterMount(cb: any, dependencies: any): void;
|
|
24
24
|
export declare function getCookie(sKey: any): string;
|
|
25
|
+
export declare function useForm(stateSchema: any, validationSchema: {}, callback: any): {
|
|
26
|
+
state: any;
|
|
27
|
+
disable: boolean;
|
|
28
|
+
handleOnChange: (event: any) => void;
|
|
29
|
+
handleOnSubmit: (event: any) => void;
|
|
30
|
+
};
|
|
25
31
|
export declare function handleUTCTime(ts: string, isRelativeTime?: boolean): string;
|
|
26
32
|
export declare function useSearchString(): UseSearchString;
|
|
27
33
|
export declare const closeOnEscKeyPressed: (e: any, actionClose: () => void) => void;
|
|
@@ -120,4 +126,5 @@ export declare const DropdownIndicator: (props: any) => JSX.Element;
|
|
|
120
126
|
export declare function mapByKey<T = Map<any, any>>(arr: any[], id: string): T;
|
|
121
127
|
export declare function asyncWrap(promise: any): any[];
|
|
122
128
|
export declare const prefixZeroIfSingleDigit: (value?: number) => string | number;
|
|
129
|
+
export declare const getContainerRegistryIcon: (registryValue: string) => JSX.Element;
|
|
123
130
|
export {};
|
package/dist/Common/Types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { default as React, ReactNode, CSSProperties } from 'react';
|
|
1
|
+
import { default as React, ReactNode, CSSProperties, ReactElement } from 'react';
|
|
2
2
|
import { Placement } from 'tippy.js';
|
|
3
3
|
import { UserGroupDTO } from '../Pages/GlobalConfigurations';
|
|
4
4
|
import { ImageComment, ReleaseTag } from './ImageTags.Types';
|
|
@@ -620,6 +620,7 @@ export interface RegistryTypeDetailType {
|
|
|
620
620
|
registryURL: InputDetailType;
|
|
621
621
|
id: InputDetailType;
|
|
622
622
|
password: InputDetailType;
|
|
623
|
+
startIcon: ReactElement;
|
|
623
624
|
}
|
|
624
625
|
export interface UseSearchString {
|
|
625
626
|
queryParams: URLSearchParams;
|
package/dist/Common/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export * from './Constants';
|
|
|
2
2
|
export * from './ServerError';
|
|
3
3
|
export * from './Types';
|
|
4
4
|
export * from './Api';
|
|
5
|
-
export * from './ToastBody';
|
|
6
5
|
export { default as Reload } from './Reload';
|
|
7
6
|
export { default as ErrorScreenManager } from './ErrorScreenManager';
|
|
8
7
|
export { default as ErrorScreenNotAuthorized } from './ErrorScreenNotAuthorized';
|
|
@@ -2,7 +2,5 @@ import { ProgressingProps } from '../../../Common/Types';
|
|
|
2
2
|
import { ButtonProps } from './types';
|
|
3
3
|
export declare const BUTTON_SIZE_TO_CLASS_NAME_MAP: Record<ButtonProps['size'], string>;
|
|
4
4
|
export declare const ICON_BUTTON_SIZE_TO_CLASS_NAME_MAP: Record<ButtonProps['size'], string>;
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const BUTTON_SIZE_TO_LOADER_SIZE_MAP: Record<ButtonProps['size'], ProgressingProps['size']>;
|
|
8
|
-
export declare const ICON_BUTTON_SIZE_TO_LOADER_SIZE_MAP: Record<ButtonProps['size'], ProgressingProps['size']>;
|
|
5
|
+
export declare const BUTTON_SIZE_TO_ICON_SIZE_MAP: Record<ButtonProps['size'], ProgressingProps['size']>;
|
|
6
|
+
export declare const ICON_BUTTON_SIZE_TO_ICON_SIZE_MAP: Record<ButtonProps['size'], ProgressingProps['size']>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ToastOptions, ToastContainerProps } from 'react-toastify';
|
|
2
|
+
import { ToastProps, ToastVariantType } from './types';
|
|
3
|
+
export declare const TOAST_BASE_CONFIG: ToastContainerProps;
|
|
4
|
+
export declare const TOAST_VARIANT_TO_CONFIG_MAP: Record<ToastVariantType, Required<Pick<ToastProps, 'icon' | 'title' | 'progressBarBg'>> & Pick<ToastOptions, 'type'>>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ToastOptions } from 'react-toastify';
|
|
2
|
+
import { ToastProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Service for handling toast across the application
|
|
5
|
+
*
|
|
6
|
+
* Note: The application needs to have `ToastManagerContainer` at the root
|
|
7
|
+
* level for the toast to work
|
|
8
|
+
*
|
|
9
|
+
* @example Default Usage
|
|
10
|
+
* ```ts
|
|
11
|
+
* ToastManager.showToast({
|
|
12
|
+
* description: 'Lorem ipsum'
|
|
13
|
+
* })
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example Custom Title
|
|
17
|
+
* ```ts
|
|
18
|
+
* ToastManager.showToast({
|
|
19
|
+
* description: 'Lorem ipsum',
|
|
20
|
+
* title: 'Toast title'
|
|
21
|
+
* })
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example With Button
|
|
25
|
+
* ```ts
|
|
26
|
+
* ToastManager.showToast({
|
|
27
|
+
* description: 'Lorem ipsum',
|
|
28
|
+
* buttonProps: {
|
|
29
|
+
* dataTestId: 'toast-btn',
|
|
30
|
+
* text: 'Reload',
|
|
31
|
+
* startIcon: <ICArrowClockwise />
|
|
32
|
+
* }
|
|
33
|
+
* })
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example Auto close disabled
|
|
37
|
+
* ```ts
|
|
38
|
+
* ToastManager.showToast({
|
|
39
|
+
* description: 'Lorem ipsum',
|
|
40
|
+
* toastOptions: {
|
|
41
|
+
* autoClose: false,
|
|
42
|
+
* },
|
|
43
|
+
* })
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example Custom progress bar color
|
|
47
|
+
* ```ts
|
|
48
|
+
* ToastManager.showToast({
|
|
49
|
+
* description: 'Lorem ipsum',
|
|
50
|
+
* progressBarBg: 'var(--N700)',
|
|
51
|
+
* })
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @example Custom icon
|
|
55
|
+
* ```ts
|
|
56
|
+
* ToastManager.showToast({
|
|
57
|
+
* description: 'Lorem ipsum',
|
|
58
|
+
* icon: <ICCube />,
|
|
59
|
+
* })
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
declare class ToastManager {
|
|
63
|
+
#private;
|
|
64
|
+
static get instance(): ToastManager;
|
|
65
|
+
/**
|
|
66
|
+
* Handler for showing the toast
|
|
67
|
+
*/
|
|
68
|
+
showToast: ({ variant, icon: customIcon, title, description, buttonProps, progressBarBg: customProgressBarBg, }: ToastProps, options?: Pick<ToastOptions, "autoClose">) => import('react-toastify').Id;
|
|
69
|
+
/**
|
|
70
|
+
* Handler for dismissing an existing toast
|
|
71
|
+
*/
|
|
72
|
+
dismissToast: (id?: import('react-toastify').Id | undefined) => void;
|
|
73
|
+
/**
|
|
74
|
+
* Handler for checking if the toast is active
|
|
75
|
+
*/
|
|
76
|
+
isToastActive: (id: import('react-toastify').Id) => boolean;
|
|
77
|
+
}
|
|
78
|
+
export declare const ToastManagerContainer: () => JSX.Element;
|
|
79
|
+
declare const _default: ToastManager;
|
|
80
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ButtonProps } from '../../Components';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
export declare enum ToastVariantType {
|
|
4
|
+
info = "info",
|
|
5
|
+
success = "success",
|
|
6
|
+
error = "error",
|
|
7
|
+
warn = "warn",
|
|
8
|
+
notAuthorized = "notAuthorized"
|
|
9
|
+
}
|
|
10
|
+
export interface ToastProps {
|
|
11
|
+
/**
|
|
12
|
+
* Title for the toast
|
|
13
|
+
* If not provided, defaults to a value based on the selected variant
|
|
14
|
+
*/
|
|
15
|
+
title?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Description for the toast
|
|
18
|
+
*/
|
|
19
|
+
description: string;
|
|
20
|
+
/**
|
|
21
|
+
* Custom icon for the toast to override the icon based on variant
|
|
22
|
+
*/
|
|
23
|
+
icon?: ReactElement;
|
|
24
|
+
/**
|
|
25
|
+
* Variant for the toast
|
|
26
|
+
*
|
|
27
|
+
* @default ToastVariantType.info
|
|
28
|
+
*/
|
|
29
|
+
variant?: ToastVariantType;
|
|
30
|
+
/**
|
|
31
|
+
* Props for the action button to be displayed in the toast
|
|
32
|
+
*
|
|
33
|
+
* Note: Size, variant and style are hard-coded and cannot be overriden
|
|
34
|
+
*/
|
|
35
|
+
buttonProps?: ButtonProps;
|
|
36
|
+
/**
|
|
37
|
+
* Custom progress bar color
|
|
38
|
+
*/
|
|
39
|
+
progressBarBg?: string;
|
|
40
|
+
}
|