@devtron-labs/devtron-fe-common-lib 0.0.53 → 0.0.54

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 {};
@@ -1,6 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { DebouncedSearchProps } from './Types';
3
3
  /**
4
+ * @deprecated Use `SearchBar` component instead.
5
+ *
4
6
  * @param onSearch - Callback function to be called on search
5
7
  * @param Icon - (Optional) Icon to be shown before the input
6
8
  * @param iconClass - (Optional) Class for the icon
@@ -57,4 +57,8 @@ export declare const customStyles: {
57
57
  export declare const getFilteredChartVersions: (charts: any, selectedChartType: any) => any;
58
58
  export declare function getUnlockedJSON(json: any, jsonPathArray: any): any;
59
59
  export declare function getLockedJSON(json: any, jsonPathArray: string[]): any;
60
+ /**
61
+ * Returns a debounced variant of the function
62
+ */
63
+ export declare const debounce: (func: any, timeout?: number) => (this: any, ...args: any[]) => void;
60
64
  export {};
@@ -0,0 +1,39 @@
1
+ /// <reference types="react" />
2
+ import { SearchBarProps } from './types';
3
+ import './searchBar.scss';
4
+ /**
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
+ * ```
37
+ */
38
+ declare const SearchBar: ({ initialSearchText, handleSearchChange, handleEnter, inputProps, containerClassName, shouldDebounce, debounceTimeout, }: SearchBarProps) => JSX.Element;
39
+ export default SearchBar;
@@ -0,0 +1,2 @@
1
+ export { default as SearchBar } from './SearchBar.component';
2
+ export type { SearchBarProps } from './types';
@@ -0,0 +1,35 @@
1
+ import { InputHTMLAttributes } from 'react';
2
+ export interface SearchBarProps {
3
+ /**
4
+ * Initial search text
5
+ *
6
+ * @default ''
7
+ */
8
+ initialSearchText?: string;
9
+ /**
10
+ * Search handler for the search input
11
+ */
12
+ handleSearchChange?: (searchText: string) => void;
13
+ /**
14
+ * Enter event handler for the search input
15
+ */
16
+ handleEnter?: (searchText: string) => void;
17
+ /**
18
+ * Input props for the search input
19
+ */
20
+ inputProps?: InputHTMLAttributes<HTMLInputElement>;
21
+ /**
22
+ * Class name for the container; can be used for handling width
23
+ */
24
+ containerClassName?: string;
25
+ /**
26
+ * If true, the change handler would be triggered with debounce
27
+ *
28
+ * @default false
29
+ */
30
+ shouldDebounce?: boolean;
31
+ /**
32
+ * Timeout for the debounce handler to be triggered
33
+ */
34
+ debounceTimeout?: number;
35
+ }
@@ -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 {
@@ -26,6 +26,7 @@ export * from './Common.service';
26
26
  export * from './Checkbox';
27
27
  export { default as EmptyState } from './EmptyState/EmptyState';
28
28
  export { default as GenericEmptyState } from './EmptyState/GenericEmptyState';
29
+ export * from './SearchBar';
29
30
  export { default as Toggle } from './Toggle/Toggle';
30
31
  export { default as ScanVulnerabilitiesTable } from './Security/ScanVulnerabilitiesTable';
31
32
  export { default as StyledRadioGroup } from './RadioGroup/RadioGroup';