@devtron-labs/devtron-fe-common-lib 0.4.5-beta-1 → 0.4.5-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.
@@ -1,2 +1,2 @@
1
- import { CollapsibleListProps } from './CollapsibleList.types';
2
- export declare const CollapsibleList: ({ config, onCollapseBtnClick }: CollapsibleListProps) => JSX.Element;
1
+ import { CollapsibleListProps, TabOptions } from './CollapsibleList.types';
2
+ export declare const CollapsibleList: <TabType extends TabOptions>({ config, tabType, onCollapseBtnClick, }: CollapsibleListProps<TabType>) => JSX.Element;
@@ -1,7 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { TippyProps } from '@tippyjs/react';
3
3
  interface ButtonTab {
4
- tabType: 'button';
5
4
  /**
6
5
  * Is tab active ( for button tab )
7
6
  */
@@ -13,7 +12,6 @@ interface ButtonTab {
13
12
  href?: never;
14
13
  }
15
14
  interface NavLinkTab {
16
- tabType: 'navLink';
17
15
  /**
18
16
  * The URL of the nav link.
19
17
  */
@@ -24,8 +22,9 @@ interface NavLinkTab {
24
22
  onClick?: (e: React.MouseEvent<HTMLAnchorElement>) => void;
25
23
  isActive?: never;
26
24
  }
27
- type ConditionalTabType = ButtonTab | NavLinkTab;
28
- export type CollapsibleListItem = ConditionalTabType & {
25
+ export type TabOptions = 'button' | 'navLink';
26
+ type ConditionalTabType<TabType extends TabOptions> = TabType extends 'button' ? ButtonTab : NavLinkTab;
27
+ export type CollapsibleListItem<TabType extends TabOptions> = ConditionalTabType<TabType> & {
29
28
  /**
30
29
  * The title of the list item.
31
30
  */
@@ -52,7 +51,7 @@ export type CollapsibleListItem = ConditionalTabType & {
52
51
  tooltipProps?: TippyProps;
53
52
  };
54
53
  };
55
- export interface CollapsibleListConfig {
54
+ export interface CollapsibleListConfig<TabType extends 'button' | 'navLink'> {
56
55
  /**
57
56
  * The unique identifier for the collapsible list.
58
57
  */
@@ -90,17 +89,21 @@ export interface CollapsibleListConfig {
90
89
  /**
91
90
  * An array of items to be displayed in the collapsible list.
92
91
  */
93
- items: CollapsibleListItem[];
92
+ items: CollapsibleListItem<TabType>[];
94
93
  /**
95
94
  * Boolean indicating whether the list is expanded or not.
96
95
  */
97
96
  isExpanded?: boolean;
98
97
  }
99
- export interface CollapsibleListProps {
98
+ export interface CollapsibleListProps<TabType extends TabOptions> {
100
99
  /**
101
100
  * An array of collapsible list configurations.
102
101
  */
103
- config: CollapsibleListConfig[];
102
+ config: CollapsibleListConfig<TabType>[];
103
+ /**
104
+ * Type of tab list: button or navLink
105
+ */
106
+ tabType: TabType;
104
107
  /**
105
108
  * Function to handle the collapse button click event.
106
109
  *
@@ -27,12 +27,12 @@ export type DeploymentConfigDiffSelectPickerProps = {
27
27
  text?: never;
28
28
  selectPickerProps: SelectPickerProps;
29
29
  };
30
- export interface DeploymentConfigDiffNavigationItem extends Pick<CollapsibleListItem, 'title'> {
30
+ export interface DeploymentConfigDiffNavigationItem extends Pick<CollapsibleListItem<'navLink'>, 'title'> {
31
31
  hasDiff?: boolean;
32
32
  href: string;
33
33
  onClick: (e: React.MouseEvent<HTMLAnchorElement>) => void;
34
34
  }
35
- export interface DeploymentConfigDiffNavigationCollapsibleItem extends Pick<CollapsibleListConfig, 'id' | 'header' | 'noItemsText'> {
35
+ export interface DeploymentConfigDiffNavigationCollapsibleItem extends Pick<CollapsibleListConfig<'navLink'>, 'id' | 'header' | 'noItemsText'> {
36
36
  items: DeploymentConfigDiffNavigationItem[];
37
37
  }
38
38
  export interface DeploymentConfigDiffProps {
@@ -1,7 +1,7 @@
1
1
  var Fe = Object.defineProperty;
2
2
  var Le = (e, n, i) => n in e ? Fe(e, n, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[n] = i;
3
3
  var k = (e, n, i) => Le(e, typeof n != "symbol" ? n + "" : n, i);
4
- import { m as je } from "./index-DolGX43w.js";
4
+ import { m as je } from "./index-2RgTtICn.js";
5
5
  /*!-----------------------------------------------------------------------------
6
6
  * Copyright (c) Microsoft Corporation. All rights reserved.
7
7
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)
@@ -1,4 +1,4 @@
1
- import { m as f } from "./index-DolGX43w.js";
1
+ import { m as f } from "./index-2RgTtICn.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)
@@ -1,4 +1,4 @@
1
- import { m as l } from "./index-DolGX43w.js";
1
+ import { m as l } from "./index-2RgTtICn.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)
@@ -1,4 +1,4 @@
1
- import { m as s } from "./index-DolGX43w.js";
1
+ import { m as s } from "./index-2RgTtICn.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)
@@ -1,7 +1,7 @@
1
1
  var Be = Object.defineProperty;
2
2
  var $e = (e, n, i) => n in e ? Be(e, n, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[n] = i;
3
3
  var k = (e, n, i) => $e(e, typeof n != "symbol" ? n + "" : n, i);
4
- import { m as qe } from "./index-DolGX43w.js";
4
+ import { m as qe } from "./index-2RgTtICn.js";
5
5
  /*!-----------------------------------------------------------------------------
6
6
  * Copyright (c) Microsoft Corporation. All rights reserved.
7
7
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)