@devtron-labs/devtron-fe-common-lib 0.2.27 → 0.2.28-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/Shared/Components/Button/Button.component.d.ts +67 -0
- package/dist/Shared/Components/Button/constants.d.ts +8 -0
- package/dist/Shared/Components/Button/index.d.ts +2 -0
- package/dist/Shared/Components/Button/types.d.ts +117 -0
- package/dist/Shared/Components/Button/utils.d.ts +4 -0
- package/dist/Shared/Components/ButtonWithLoader/ButtonWithLoader.d.ts +5 -2
- package/dist/Shared/Components/TabGroup/TabGroup.component.d.ts +2 -0
- package/dist/Shared/Components/TabGroup/TabGroup.types.d.ts +111 -0
- package/dist/Shared/Components/TabGroup/TabGroup.utils.d.ts +7 -0
- package/dist/Shared/Components/TabGroup/index.d.ts +2 -0
- package/dist/Shared/Components/index.d.ts +2 -0
- package/dist/Shared/constants.d.ts +3 -1
- package/dist/Shared/types.d.ts +1 -0
- package/dist/assets/index.css +1 -1
- package/dist/{cssMode-QqXdZhG6.js → cssMode-MB8v0uTL.js} +1 -1
- package/dist/{freemarker2-BUM-ZyuW.js → freemarker2-DrdweWp7.js} +1 -1
- package/dist/{handlebars-DnsDpZjH.js → handlebars-BGEOfj8k.js} +1 -1
- package/dist/{html-CrqZKjj_.js → html-BTcZSQT_.js} +1 -1
- package/dist/{htmlMode-DXIhiVyH.js → htmlMode-DP3WIb8i.js} +1 -1
- package/dist/{index-FMTFtR1h.js → index-C2Hutn-O.js} +20277 -20042
- package/dist/index.js +506 -501
- package/dist/{javascript-kNcdg9AC.js → javascript-C-ICy_0j.js} +1 -1
- package/dist/{jsonMode-BRTFdINU.js → jsonMode-DYQspZyv.js} +1 -1
- package/dist/{liquid-D1NP_VnO.js → liquid-kKxJKiz0.js} +1 -1
- package/dist/{mdx-CNnohuR-.js → mdx-DP56SVnr.js} +1 -1
- package/dist/{python-NBcvsOnT.js → python-C1eDGU0a.js} +1 -1
- package/dist/{razor-DR4arJeq.js → razor-CxaKOHbe.js} +1 -1
- package/dist/{tsMode-BEIDXJeE.js → tsMode-C6t8gJqn.js} +1 -1
- package/dist/{typescript-C15RwDto.js → typescript-CXR057QG.js} +1 -1
- package/dist/{xml-CT0Bc15w.js → xml-CQfuL8pN.js} +1 -1
- package/dist/{yaml-xJdWLhuE.js → yaml-B59wpmh_.js} +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
* @example With onClick
|
|
52
|
+
* ```tsx
|
|
53
|
+
* <Button text="Hello World" onClick={noop} />
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @example Link component
|
|
57
|
+
* ```tsx
|
|
58
|
+
* <Button component={ButtonComponentType.link} linkProps={{ to: '#' }} />
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @example Icon button
|
|
62
|
+
* ```tsx
|
|
63
|
+
* <Button icon={<ICCube />} ariaLabel="Label" />
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
declare const Button: ({ dataTestId, text, variant, size, style, startIcon, endIcon, disabled, isLoading, showTooltip, tooltipProps, icon, ariaLabel, ...props }: ButtonProps) => JSX.Element;
|
|
67
|
+
export default Button;
|
|
@@ -0,0 +1,8 @@
|
|
|
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 ICON_BUTTON_SIZE_TO_CLASS_NAME_MAP: Record<ButtonProps['size'], string>;
|
|
5
|
+
export declare const BUTTON_SIZE_TO_ICON_CLASS_NAME_MAP: Record<ButtonProps['size'], string>;
|
|
6
|
+
export declare const ICON_BUTTON_SIZE_TO_ICON_CLASS_NAME_MAP: Record<ButtonProps['size'], string>;
|
|
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']>;
|
|
@@ -0,0 +1,117 @@
|
|
|
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
|
+
negativeGrey = "negative-grey",
|
|
15
|
+
positive = "positive",
|
|
16
|
+
warning = "warning",
|
|
17
|
+
neutral = "neutral"
|
|
18
|
+
}
|
|
19
|
+
export declare enum ButtonComponentType {
|
|
20
|
+
button = "button",
|
|
21
|
+
link = "link"
|
|
22
|
+
}
|
|
23
|
+
export type ButtonProps = ({
|
|
24
|
+
/**
|
|
25
|
+
* Component to be rendered from the available options
|
|
26
|
+
*
|
|
27
|
+
* @default ButtonComponentType.button
|
|
28
|
+
*/
|
|
29
|
+
component?: ButtonComponentType.button | never;
|
|
30
|
+
/**
|
|
31
|
+
* Props for the button component
|
|
32
|
+
*/
|
|
33
|
+
buttonProps?: Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'styles' | 'className' | 'disabled' | 'onClick'>;
|
|
34
|
+
linkProps?: never;
|
|
35
|
+
onClick?: ButtonHTMLAttributes<HTMLButtonElement>['onClick'];
|
|
36
|
+
} | {
|
|
37
|
+
component: ButtonComponentType.link;
|
|
38
|
+
/**
|
|
39
|
+
* Props for the link component
|
|
40
|
+
*/
|
|
41
|
+
linkProps: Omit<LinkProps, 'children' | 'styles' | 'className' | 'onClick'>;
|
|
42
|
+
buttonProps?: never;
|
|
43
|
+
onClick?: LinkProps['onClick'];
|
|
44
|
+
}) & {
|
|
45
|
+
/**
|
|
46
|
+
* Variant of the button
|
|
47
|
+
*
|
|
48
|
+
* @default ButtonVariantType.primary
|
|
49
|
+
*/
|
|
50
|
+
variant?: ButtonVariantType;
|
|
51
|
+
/**
|
|
52
|
+
* Size of the button
|
|
53
|
+
*
|
|
54
|
+
* @default ComponentSizeType.large
|
|
55
|
+
*/
|
|
56
|
+
size?: ComponentSizeType;
|
|
57
|
+
/**
|
|
58
|
+
* Style to be applied on the button
|
|
59
|
+
*
|
|
60
|
+
* @default ButtonStyleType.default
|
|
61
|
+
*/
|
|
62
|
+
style?: ButtonStyleType;
|
|
63
|
+
/**
|
|
64
|
+
* If true, the loading state is shown for the button with disabled
|
|
65
|
+
*/
|
|
66
|
+
isLoading?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Test id for the component
|
|
69
|
+
*/
|
|
70
|
+
dataTestId: string;
|
|
71
|
+
/**
|
|
72
|
+
* If true, the button is disabled
|
|
73
|
+
*
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
76
|
+
disabled?: boolean;
|
|
77
|
+
} & ({
|
|
78
|
+
/**
|
|
79
|
+
* If true, the tooltip is shown for the button
|
|
80
|
+
*/
|
|
81
|
+
showTooltip: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Props for tooltip
|
|
84
|
+
*/
|
|
85
|
+
tooltipProps: Omit<TooltipProps, 'alwaysShowTippyOnHover' | 'showOnTruncate'>;
|
|
86
|
+
} | {
|
|
87
|
+
showTooltip?: never;
|
|
88
|
+
tooltipProps?: never;
|
|
89
|
+
}) & ({
|
|
90
|
+
icon?: never;
|
|
91
|
+
ariaLabel?: never;
|
|
92
|
+
/**
|
|
93
|
+
* Text to be displayed in the button
|
|
94
|
+
*/
|
|
95
|
+
text: string;
|
|
96
|
+
/**
|
|
97
|
+
* If provided, icon to be displayed at the start of the button
|
|
98
|
+
*/
|
|
99
|
+
startIcon?: ReactElement;
|
|
100
|
+
/**
|
|
101
|
+
* If provided, icon to be displayed at the end of the button
|
|
102
|
+
*/
|
|
103
|
+
endIcon?: ReactElement;
|
|
104
|
+
} | {
|
|
105
|
+
/**
|
|
106
|
+
* If provided, icon button is rendered
|
|
107
|
+
*/
|
|
108
|
+
icon: ReactElement;
|
|
109
|
+
/**
|
|
110
|
+
* Label for the icon button for accessibility.
|
|
111
|
+
* Shown on hover in tooltip if tippy is not provided explicitly
|
|
112
|
+
*/
|
|
113
|
+
ariaLabel: string;
|
|
114
|
+
text?: never;
|
|
115
|
+
startIcon?: never;
|
|
116
|
+
endIcon?: never;
|
|
117
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ButtonProps } from './types';
|
|
2
|
+
export declare const getButtonIconClassName: ({ size, icon }: Pick<ButtonProps, "size" | "icon">) => string;
|
|
3
|
+
export declare const getButtonLoaderSize: ({ size, icon }: Pick<ButtonProps, "size" | "icon">) => number;
|
|
4
|
+
export declare const getButtonDerivedClass: ({ size, variant, style, isLoading, icon, }: Pick<ButtonProps, "variant" | "size" | "style" | "isLoading" | "icon">) => string;
|
|
@@ -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;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { LinkProps, NavLinkProps } from 'react-router-dom';
|
|
2
|
+
import { ComponentSizeType } from '../../constants';
|
|
3
|
+
import { DataAttributes } from '../../types';
|
|
4
|
+
type TabComponentProps<TabTypeProps> = TabTypeProps & DataAttributes;
|
|
5
|
+
type ConditionalTabType = {
|
|
6
|
+
/**
|
|
7
|
+
* Type of the tab, either `button`, `link` or `navLink`.
|
|
8
|
+
*/
|
|
9
|
+
tabType: 'button';
|
|
10
|
+
/**
|
|
11
|
+
* Props passed to button component.
|
|
12
|
+
*/
|
|
13
|
+
props?: TabComponentProps<Omit<React.ComponentProps<'button'>, 'className' | 'style'>>;
|
|
14
|
+
/**
|
|
15
|
+
* Indicates if the tab is currently active.
|
|
16
|
+
*/
|
|
17
|
+
active?: boolean;
|
|
18
|
+
} | {
|
|
19
|
+
/**
|
|
20
|
+
* Type of the tab, either `button`, `link` or `navLink`.
|
|
21
|
+
*/
|
|
22
|
+
tabType: 'navLink';
|
|
23
|
+
/**
|
|
24
|
+
* Props passed to nav link component.
|
|
25
|
+
*/
|
|
26
|
+
props: TabComponentProps<Omit<NavLinkProps, 'className' | 'style' | 'activeClassName'>>;
|
|
27
|
+
/**
|
|
28
|
+
* Active state is determined by matching the URL.
|
|
29
|
+
*/
|
|
30
|
+
active?: false;
|
|
31
|
+
} | {
|
|
32
|
+
/**
|
|
33
|
+
* Type of the tab, either `button`, `link` or `navLink`.
|
|
34
|
+
*/
|
|
35
|
+
tabType: 'link';
|
|
36
|
+
/**
|
|
37
|
+
* Props passed to link component.
|
|
38
|
+
*/
|
|
39
|
+
props: TabComponentProps<Omit<LinkProps, 'className' | 'style'>>;
|
|
40
|
+
/**
|
|
41
|
+
* Indicates if the tab is currently active.
|
|
42
|
+
*/
|
|
43
|
+
active?: boolean;
|
|
44
|
+
};
|
|
45
|
+
export type TabProps = {
|
|
46
|
+
/**
|
|
47
|
+
* Unique identifier for the tab.
|
|
48
|
+
*/
|
|
49
|
+
id: string | number;
|
|
50
|
+
/**
|
|
51
|
+
* Text label for the tab.
|
|
52
|
+
*/
|
|
53
|
+
label: string;
|
|
54
|
+
/**
|
|
55
|
+
* Icon component to be displayed in the tab.
|
|
56
|
+
* This should be a functional component that renders an SVG.
|
|
57
|
+
*/
|
|
58
|
+
icon?: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
|
59
|
+
/**
|
|
60
|
+
* Type of the icon, determining whether it uses a stroke or fill style.
|
|
61
|
+
*/
|
|
62
|
+
iconType?: 'stroke' | 'fill';
|
|
63
|
+
/**
|
|
64
|
+
* Badge number to be displayed on the tab, typically for notifications.
|
|
65
|
+
*/
|
|
66
|
+
badge?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Indicates if an indicator should be shown on the tab.
|
|
69
|
+
*/
|
|
70
|
+
showIndicator?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Indicates if a warning state should be displayed on the tab.
|
|
73
|
+
* @note error state will take precedence over warning state.
|
|
74
|
+
*/
|
|
75
|
+
showWarning?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Indicates if an error state should be displayed on the tab.
|
|
78
|
+
* @note error state will take precedence over warning state.
|
|
79
|
+
*/
|
|
80
|
+
showError?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Disables the tab, preventing interaction and indicating an inactive state.
|
|
83
|
+
*/
|
|
84
|
+
disabled?: boolean;
|
|
85
|
+
} & ConditionalTabType;
|
|
86
|
+
export interface TabGroupProps {
|
|
87
|
+
/**
|
|
88
|
+
* Array of tabs to be rendered.
|
|
89
|
+
*/
|
|
90
|
+
tabs: TabProps[];
|
|
91
|
+
/**
|
|
92
|
+
* Size of the tabs.
|
|
93
|
+
* @default ComponentSizeType.large
|
|
94
|
+
*/
|
|
95
|
+
size?: ComponentSizeType.large | ComponentSizeType.medium;
|
|
96
|
+
/**
|
|
97
|
+
* Optional component to be rendered on the right side of the tab list.
|
|
98
|
+
*/
|
|
99
|
+
rightComponent?: React.ReactElement;
|
|
100
|
+
/**
|
|
101
|
+
* Set to `true` to align the active tab's border with the bottom border of the parent container.
|
|
102
|
+
* @default false
|
|
103
|
+
*/
|
|
104
|
+
alignActiveBorderWithContainer?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Determines if the top padding of the tab group should be hidden.
|
|
107
|
+
* @default false
|
|
108
|
+
*/
|
|
109
|
+
hideTopPadding?: boolean;
|
|
110
|
+
}
|
|
111
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TabGroupProps, TabProps } from './TabGroup.types';
|
|
2
|
+
export declare const getClassNameBySizeMap: ({ hideTopPadding, alignActiveBorderWithContainer, }: Pick<TabGroupProps, "hideTopPadding" | "alignActiveBorderWithContainer">) => Record<TabGroupProps["size"], {
|
|
3
|
+
tabClassName: string;
|
|
4
|
+
iconClassName: string;
|
|
5
|
+
badgeClassName: string;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const getIconColorClassMap: ({ active }: Pick<TabProps, "active">) => Record<TabProps["iconType"], string>;
|
|
@@ -36,6 +36,8 @@ export * from './ShowMoreText';
|
|
|
36
36
|
export * from './CollapsibleList';
|
|
37
37
|
export * from './DeploymentConfigDiff';
|
|
38
38
|
export * from './DetectBottom';
|
|
39
|
+
export * from './TabGroup';
|
|
39
40
|
export * from './EditImageFormField';
|
|
40
41
|
export * from './Collapse';
|
|
41
42
|
export * from './FilterButton';
|
|
43
|
+
export * from './Button';
|
|
@@ -389,9 +389,11 @@ export declare const ANSI_UP_REGEX: RegExp;
|
|
|
389
389
|
* Size variants for components
|
|
390
390
|
*/
|
|
391
391
|
export declare enum ComponentSizeType {
|
|
392
|
+
xs = "xs",
|
|
392
393
|
small = "small",
|
|
393
394
|
medium = "medium",
|
|
394
|
-
large = "large"
|
|
395
|
+
large = "large",
|
|
396
|
+
xl = "xl"
|
|
395
397
|
}
|
|
396
398
|
export declare const POP_UP_MENU_MODAL_ID = "popup";
|
|
397
399
|
/**
|
package/dist/Shared/types.d.ts
CHANGED
|
@@ -570,6 +570,7 @@ export type BaseFilterQueryParams<T> = {
|
|
|
570
570
|
*/
|
|
571
571
|
showAll?: boolean;
|
|
572
572
|
} & SortingParams<T>;
|
|
573
|
+
export type DataAttributes = Record<`data-${string}`, unknown>;
|
|
573
574
|
export interface RuntimeParamsListItemType extends KeyValueListType {
|
|
574
575
|
id: number;
|
|
575
576
|
}
|