@devtron-labs/devtron-fe-common-lib 0.2.24-beta-7 → 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.
@@ -49,5 +49,5 @@ import { ButtonProps } from './types';
49
49
  * ```
50
50
  *
51
51
  */
52
- declare const Button: ({ variant, size, style, text, startIcon, endIcon, disabled, isLoading, showTippy, tippyContent, type, dataTestId, ...props }: ButtonProps) => JSX.Element;
52
+ declare const Button: ({ dataTestId, text, variant, size, style, startIcon, endIcon, disabled, isLoading, showTooltip, tooltipProps, ...props }: ButtonProps) => JSX.Element;
53
53
  export default Button;
@@ -1,6 +1,7 @@
1
1
  import { TooltipProps } from '@Common/Tooltip/types';
2
2
  import { ComponentSizeType } from '../../constants';
3
3
  import { ButtonHTMLAttributes, ReactElement } from 'react';
4
+ import { LinkProps } from 'react-router-dom';
4
5
  export declare enum ButtonVariantType {
5
6
  primary = "primary",
6
7
  secondary = "secondary",
@@ -14,23 +15,48 @@ export declare enum ButtonStyleType {
14
15
  warning = "warning",
15
16
  neutral = "neutral"
16
17
  }
17
- export type ButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'styles' | 'className'> & {
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
+ }) & {
18
44
  /**
19
45
  * Variant of the button
20
46
  *
21
- * @default 'ButtonVariantType.primary'
47
+ * @default ButtonVariantType.primary
22
48
  */
23
49
  variant?: ButtonVariantType;
24
50
  /**
25
51
  * Size of the button
26
52
  *
27
- * @default 'ComponentSizeType.large'
53
+ * @default ComponentSizeType.large
28
54
  */
29
55
  size?: ComponentSizeType;
30
56
  /**
31
57
  * Style to be applied on the button
32
58
  *
33
- * @default 'ButtonStyleType.default'
59
+ * @default ButtonStyleType.default
34
60
  */
35
61
  style?: ButtonStyleType;
36
62
  /**
@@ -49,17 +75,26 @@ export type ButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'childre
49
75
  * If true, the loading state is shown for the button with disabled
50
76
  */
51
77
  isLoading?: boolean;
78
+ /**
79
+ * Test id for the component
80
+ */
52
81
  dataTestId: string;
82
+ /**
83
+ * If true, the button is disabled
84
+ *
85
+ * @default false
86
+ */
87
+ disabled?: boolean;
53
88
  } & ({
54
89
  /**
55
- * If true, the tippy is shown for the button
90
+ * If true, the tooltip is shown for the button
56
91
  */
57
- showTippy: boolean;
92
+ showTooltip: boolean;
58
93
  /**
59
- * Tippy content to be shown for use cases like disabled etc
94
+ * Props for tooltip
60
95
  */
61
- tippyContent: TooltipProps['content'];
96
+ tooltipProps: Omit<TooltipProps, 'alwaysShowTippyOnHover' | 'showOnTruncate'>;
62
97
  } | {
63
- showTippy?: never;
64
- tippyContent?: never;
98
+ showTooltip?: never;
99
+ tooltipProps?: never;
65
100
  });