@devtron-labs/devtron-fe-common-lib 0.0.53-beta-4 → 0.0.53-beta-5

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.
@@ -12,9 +12,9 @@ export declare const SourceTypeMap: {
12
12
  BranchRegex: string;
13
13
  };
14
14
  export declare function getUserRole(appName?: string): Promise<UserRole>;
15
- export declare function setImageTags(request: any, pipelineId: number, artifactId: number): Promise<ResponseType>;
15
+ export declare function setImageTags(request: any, pipelineId: number, artifactId: number): Promise<ResponseType<any>>;
16
16
  export declare const genericCDMaterialsService: (serviceType: CDMaterialServiceEnum, cdMaterialID: number, stage: DeploymentNodeType, signal: AbortSignal, queryParams?: CDMaterialServiceQueryParams) => Promise<CDMaterialResponseType>;
17
17
  export declare function extractImage(image: string): string;
18
18
  export declare function createGitCommitUrl(url: string, revision: string): string;
19
- export declare function fetchChartTemplateVersions(): Promise<ResponseType>;
19
+ export declare function fetchChartTemplateVersions(): Promise<ResponseType<any>>;
20
20
  export {};
@@ -3,6 +3,37 @@ import { SearchBarProps } from './types';
3
3
  import './searchBar.scss';
4
4
  /**
5
5
  * Generic search input component with support for enter based and debounced search
6
+ * Note: The component is uncontrolled
7
+ *
8
+ * @example Usage with default debounced search
9
+ * ```tsx
10
+ * <SearchBar handleSearchChange={triggerSearchApi} shouldDebounce />
11
+ * ```
12
+ *
13
+ * @example Initial search text
14
+ * ```tsx
15
+ * <SearchBar initialSearchText="Keyword" />
16
+ * ```
17
+ *
18
+ * @example Custom width
19
+ * ```tsx
20
+ * <SearchBar containerClassName="w-300" />
21
+ * ```
22
+ *
23
+ * @example Trigger search on enter key press
24
+ * ```tsx
25
+ * <SearchBar handleEnter={triggerSearchApi} />
26
+ * ```
27
+ *
28
+ * @example Custom timeout for debounced search
29
+ * ```tsx
30
+ * <SearchBar handleSearchChange={triggerSearchApi} shouldDebounce debounceTimeout={500} />
31
+ * ```
32
+ *
33
+ * @example Placeholder for the search
34
+ * ```tsx
35
+ * <SearchBar inputProps={{ placeholder: 'Enter search text' }} />
36
+ * ```
6
37
  */
7
38
  declare const SearchBar: ({ initialSearchText, handleSearchChange, handleEnter, inputProps, containerClassName, shouldDebounce, debounceTimeout, }: SearchBarProps) => JSX.Element;
8
39
  export default SearchBar;
@@ -2,10 +2,23 @@ import React, { ReactNode, CSSProperties } from 'react';
2
2
  import { Placement } from 'tippy.js';
3
3
  import { ImageComment, ReleaseTag } from './ImageTags.Types';
4
4
  import { DockerConfigOverrideType, TaskErrorObj } from '.';
5
- export interface ResponseType {
5
+ /**
6
+ * Generic response type object with support for overriding the result type
7
+ *
8
+ * @example Default usage:
9
+ * ```ts
10
+ * interface UserResponse extends ResponseType {}
11
+ * ```
12
+ *
13
+ * @example Override the response type:
14
+ * ```ts
15
+ * interface UserResponse extends ResponseType<Record<string, string>> {}
16
+ * ```
17
+ */
18
+ export interface ResponseType<T = any> {
6
19
  code: number;
7
20
  status: string;
8
- result?: any;
21
+ result?: T;
9
22
  errors?: any;
10
23
  }
11
24
  export interface APIOptions {
package/dist/index.js CHANGED
@@ -24618,6 +24618,37 @@ styleInject(css_248z$4);
24618
24618
 
24619
24619
  /**
24620
24620
  * Generic search input component with support for enter based and debounced search
24621
+ * Note: The component is uncontrolled
24622
+ *
24623
+ * @example Usage with default debounced search
24624
+ * ```tsx
24625
+ * <SearchBar handleSearchChange={triggerSearchApi} shouldDebounce />
24626
+ * ```
24627
+ *
24628
+ * @example Initial search text
24629
+ * ```tsx
24630
+ * <SearchBar initialSearchText="Keyword" />
24631
+ * ```
24632
+ *
24633
+ * @example Custom width
24634
+ * ```tsx
24635
+ * <SearchBar containerClassName="w-300" />
24636
+ * ```
24637
+ *
24638
+ * @example Trigger search on enter key press
24639
+ * ```tsx
24640
+ * <SearchBar handleEnter={triggerSearchApi} />
24641
+ * ```
24642
+ *
24643
+ * @example Custom timeout for debounced search
24644
+ * ```tsx
24645
+ * <SearchBar handleSearchChange={triggerSearchApi} shouldDebounce debounceTimeout={500} />
24646
+ * ```
24647
+ *
24648
+ * @example Placeholder for the search
24649
+ * ```tsx
24650
+ * <SearchBar inputProps={{ placeholder: 'Enter search text' }} />
24651
+ * ```
24621
24652
  */
24622
24653
  var SearchBar = function (_a) {
24623
24654
  var _b = _a.initialSearchText, initialSearchText = _b === void 0 ? '' : _b, _c = _a.handleSearchChange, handleSearchChange = _c === void 0 ? function () { } : _c, _d = _a.handleEnter, handleEnter = _d === void 0 ? function () { } : _d, _e = _a.inputProps, inputProps = _e === void 0 ? {} : _e, containerClassName = _a.containerClassName, _f = _a.shouldDebounce, shouldDebounce = _f === void 0 ? false : _f, _g = _a.debounceTimeout, debounceTimeout = _g === void 0 ? 300 : _g;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.53-beta-4",
3
+ "version": "0.0.53-beta-5",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -7,6 +7,37 @@ import { debounce } from '../Helper'
7
7
 
8
8
  /**
9
9
  * Generic search input component with support for enter based and debounced search
10
+ * Note: The component is uncontrolled
11
+ *
12
+ * @example Usage with default debounced search
13
+ * ```tsx
14
+ * <SearchBar handleSearchChange={triggerSearchApi} shouldDebounce />
15
+ * ```
16
+ *
17
+ * @example Initial search text
18
+ * ```tsx
19
+ * <SearchBar initialSearchText="Keyword" />
20
+ * ```
21
+ *
22
+ * @example Custom width
23
+ * ```tsx
24
+ * <SearchBar containerClassName="w-300" />
25
+ * ```
26
+ *
27
+ * @example Trigger search on enter key press
28
+ * ```tsx
29
+ * <SearchBar handleEnter={triggerSearchApi} />
30
+ * ```
31
+ *
32
+ * @example Custom timeout for debounced search
33
+ * ```tsx
34
+ * <SearchBar handleSearchChange={triggerSearchApi} shouldDebounce debounceTimeout={500} />
35
+ * ```
36
+ *
37
+ * @example Placeholder for the search
38
+ * ```tsx
39
+ * <SearchBar inputProps={{ placeholder: 'Enter search text' }} />
40
+ * ```
10
41
  */
11
42
  const SearchBar = ({
12
43
  initialSearchText = '',
@@ -3,10 +3,23 @@ import { Placement } from 'tippy.js'
3
3
  import { ImageComment, ReleaseTag } from './ImageTags.Types'
4
4
  import { DockerConfigOverrideType, TaskErrorObj } from '.'
5
5
 
6
- export interface ResponseType {
6
+ /**
7
+ * Generic response type object with support for overriding the result type
8
+ *
9
+ * @example Default usage:
10
+ * ```ts
11
+ * interface UserResponse extends ResponseType {}
12
+ * ```
13
+ *
14
+ * @example Override the response type:
15
+ * ```ts
16
+ * interface UserResponse extends ResponseType<Record<string, string>> {}
17
+ * ```
18
+ */
19
+ export interface ResponseType<T = any> {
7
20
  code: number
8
21
  status: string
9
- result?: any
22
+ result?: T
10
23
  errors?: any
11
24
  }
12
25