@devtron-labs/devtron-fe-common-lib 0.2.24-beta-6 → 0.2.24-beta-8
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/Shared/Components/Button/Button.component.d.ts +53 -0
- package/dist/Shared/Components/Button/constants.d.ts +5 -0
- package/dist/Shared/Components/Button/index.d.ts +2 -0
- package/dist/Shared/Components/Button/types.d.ts +100 -0
- package/dist/Shared/Components/Button/utils.d.ts +2 -0
- package/dist/Shared/Components/ButtonWithLoader/ButtonWithLoader.d.ts +5 -2
- package/dist/Shared/Components/index.d.ts +1 -0
- package/dist/Shared/constants.d.ts +3 -1
- package/dist/assets/index.css +1 -1
- package/dist/{cssMode-B0uYZTMG.js → cssMode-CNOnBlcp.js} +1 -1
- package/dist/{freemarker2-CLurkGv6.js → freemarker2-CSTHODLC.js} +1 -1
- package/dist/{handlebars-BcpOMJAc.js → handlebars-DYWoEo9t.js} +1 -1
- package/dist/{html-CvFr9Son.js → html-CSepiCZd.js} +1 -1
- package/dist/{htmlMode-BzkyOQkL.js → htmlMode-HinwLHH0.js} +1 -1
- package/dist/{index-bdw8hzOj.js → index-BrOkDNGp.js} +17499 -17418
- package/dist/index.js +498 -494
- package/dist/{javascript-DZ0Fe8i8.js → javascript-CUHTHwOx.js} +1 -1
- package/dist/{jsonMode-DKBvVhEi.js → jsonMode-CXf5wiqx.js} +1 -1
- package/dist/{liquid-ByRRZhkq.js → liquid-CFddOC47.js} +1 -1
- package/dist/{mdx-BF6oDhfR.js → mdx-D60hE9Wc.js} +1 -1
- package/dist/{python-DYp5Ol6N.js → python-DPeEdyXo.js} +1 -1
- package/dist/{razor-ZfOLAG1y.js → razor-DSUNdozw.js} +1 -1
- package/dist/{tsMode-DW_WHxut.js → tsMode-CZkX5rff.js} +1 -1
- package/dist/{typescript-CihkhmN0.js → typescript-DIW6xGqn.js} +1 -1
- package/dist/{xml-CMhR_iii.js → xml-ekXswGVR.js} +1 -1
- package/dist/{yaml-DbIcrFMB.js → yaml-CarvuAFY.js} +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ButtonProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Generic component for Button.
|
|
4
|
+
* Should be used in combination of variant, size and style.
|
|
5
|
+
*
|
|
6
|
+
* @example Default button
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Button text="Hello World" />
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* @example Custom variant
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Button text="Hello World" variant={ButtonVariantType.secondary} />
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example Custom size
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <Button text="Hello World" size={ComponentSizeType.medium} />
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @example Custom style
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <Button text="Hello World" style={ButtonStyleType.positive} />
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example Disabled state
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <Button text="Hello World" disabled />
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example Loading state
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <Button text="Hello World" isLoading />
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example With start icon
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <Button text="Hello World" startIcon={<ICCube />} />
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @example With end icon
|
|
42
|
+
* ```tsx
|
|
43
|
+
* <Button text="Hello World" endIcon={<ICCube />} />
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example With tippy
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <Button text="Hello World" showTippy tippyContent="Tippy content" />
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
*/
|
|
52
|
+
declare const Button: ({ dataTestId, text, variant, size, style, startIcon, endIcon, disabled, isLoading, showTooltip, tooltipProps, ...props }: ButtonProps) => JSX.Element;
|
|
53
|
+
export default Button;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ProgressingProps } from '../../../Common/Types';
|
|
2
|
+
import { ButtonProps } from './types';
|
|
3
|
+
export declare const BUTTON_SIZE_TO_CLASS_NAME_MAP: Record<ButtonProps['size'], string>;
|
|
4
|
+
export declare const BUTTON_SIZE_TO_ICON_CLASS_NAME_MAP: Record<ButtonProps['size'], string>;
|
|
5
|
+
export declare const BUTTON_SIZE_TO_LOADER_SIZE_MAP: Record<ButtonProps['size'], ProgressingProps['size']>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { TooltipProps } from '@Common/Tooltip/types';
|
|
2
|
+
import { ComponentSizeType } from '../../constants';
|
|
3
|
+
import { ButtonHTMLAttributes, ReactElement } from 'react';
|
|
4
|
+
import { LinkProps } from 'react-router-dom';
|
|
5
|
+
export declare enum ButtonVariantType {
|
|
6
|
+
primary = "primary",
|
|
7
|
+
secondary = "secondary",
|
|
8
|
+
borderLess = "border-less",
|
|
9
|
+
text = "text"
|
|
10
|
+
}
|
|
11
|
+
export declare enum ButtonStyleType {
|
|
12
|
+
default = "default",
|
|
13
|
+
negative = "negative",
|
|
14
|
+
positive = "positive",
|
|
15
|
+
warning = "warning",
|
|
16
|
+
neutral = "neutral"
|
|
17
|
+
}
|
|
18
|
+
export declare enum ButtonComponentType {
|
|
19
|
+
button = "button",
|
|
20
|
+
link = "link"
|
|
21
|
+
}
|
|
22
|
+
export type ButtonProps = ({
|
|
23
|
+
/**
|
|
24
|
+
* Component to be rendered from the available options
|
|
25
|
+
*
|
|
26
|
+
* @default ButtonComponentType.button
|
|
27
|
+
*/
|
|
28
|
+
component?: ButtonComponentType.button | never;
|
|
29
|
+
/**
|
|
30
|
+
* Props for the button component
|
|
31
|
+
*/
|
|
32
|
+
buttonProps?: Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'styles' | 'className' | 'disabled' | 'onClick'>;
|
|
33
|
+
linkProps?: never;
|
|
34
|
+
onClick?: ButtonHTMLAttributes<HTMLButtonElement>['onClick'];
|
|
35
|
+
} | {
|
|
36
|
+
component: ButtonComponentType.link;
|
|
37
|
+
/**
|
|
38
|
+
* Props for the link component
|
|
39
|
+
*/
|
|
40
|
+
linkProps: Omit<LinkProps, 'children' | 'styles' | 'className' | 'onClick'>;
|
|
41
|
+
buttonProps?: never;
|
|
42
|
+
onClick?: LinkProps['onClick'];
|
|
43
|
+
}) & {
|
|
44
|
+
/**
|
|
45
|
+
* Variant of the button
|
|
46
|
+
*
|
|
47
|
+
* @default ButtonVariantType.primary
|
|
48
|
+
*/
|
|
49
|
+
variant?: ButtonVariantType;
|
|
50
|
+
/**
|
|
51
|
+
* Size of the button
|
|
52
|
+
*
|
|
53
|
+
* @default ComponentSizeType.large
|
|
54
|
+
*/
|
|
55
|
+
size?: ComponentSizeType;
|
|
56
|
+
/**
|
|
57
|
+
* Style to be applied on the button
|
|
58
|
+
*
|
|
59
|
+
* @default ButtonStyleType.default
|
|
60
|
+
*/
|
|
61
|
+
style?: ButtonStyleType;
|
|
62
|
+
/**
|
|
63
|
+
* Text to be displayed in the button
|
|
64
|
+
*/
|
|
65
|
+
text: string;
|
|
66
|
+
/**
|
|
67
|
+
* If provided, icon to be displayed at the start of the button
|
|
68
|
+
*/
|
|
69
|
+
startIcon?: ReactElement;
|
|
70
|
+
/**
|
|
71
|
+
* If provided, icon to be displayed at the end of the button
|
|
72
|
+
*/
|
|
73
|
+
endIcon?: ReactElement;
|
|
74
|
+
/**
|
|
75
|
+
* If true, the loading state is shown for the button with disabled
|
|
76
|
+
*/
|
|
77
|
+
isLoading?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Test id for the component
|
|
80
|
+
*/
|
|
81
|
+
dataTestId: string;
|
|
82
|
+
/**
|
|
83
|
+
* If true, the button is disabled
|
|
84
|
+
*
|
|
85
|
+
* @default false
|
|
86
|
+
*/
|
|
87
|
+
disabled?: boolean;
|
|
88
|
+
} & ({
|
|
89
|
+
/**
|
|
90
|
+
* If true, the tooltip is shown for the button
|
|
91
|
+
*/
|
|
92
|
+
showTooltip: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Props for tooltip
|
|
95
|
+
*/
|
|
96
|
+
tooltipProps: Omit<TooltipProps, 'alwaysShowTippyOnHover' | 'showOnTruncate'>;
|
|
97
|
+
} | {
|
|
98
|
+
showTooltip?: never;
|
|
99
|
+
tooltipProps?: never;
|
|
100
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React, Component } from 'react';
|
|
2
|
-
export interface
|
|
2
|
+
export interface ButtonWithLoaderProps {
|
|
3
3
|
disabled?: boolean;
|
|
4
4
|
rootClassName: string;
|
|
5
5
|
isLoading: boolean;
|
|
@@ -8,7 +8,10 @@ export interface ButtonProps {
|
|
|
8
8
|
children?: React.ReactNode;
|
|
9
9
|
type?: 'submit' | 'reset' | 'button';
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated use Button instead
|
|
13
|
+
*/
|
|
14
|
+
export declare class ButtonWithLoader extends Component<ButtonWithLoaderProps> {
|
|
12
15
|
constructor(props: any);
|
|
13
16
|
clickHandler(event: any): void;
|
|
14
17
|
render(): JSX.Element;
|
|
@@ -387,9 +387,11 @@ export declare const ANSI_UP_REGEX: RegExp;
|
|
|
387
387
|
* Size variants for components
|
|
388
388
|
*/
|
|
389
389
|
export declare enum ComponentSizeType {
|
|
390
|
+
xs = "xs",
|
|
390
391
|
small = "small",
|
|
391
392
|
medium = "medium",
|
|
392
|
-
large = "large"
|
|
393
|
+
large = "large",
|
|
394
|
+
xl = "xl"
|
|
393
395
|
}
|
|
394
396
|
export declare const POP_UP_MENU_MODAL_ID = "popup";
|
|
395
397
|
/**
|