@devtron-labs/devtron-fe-common-lib 0.0.52 → 0.0.53-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/.eslintignore +96 -0
- package/.eslintrc.js +84 -16
- package/.github/pull_request_template.md +25 -0
- package/.github/workflows/ci.yml +31 -0
- package/.github/workflows/release-package.yml +2 -3
- package/.husky/pre-commit +5 -0
- package/.lintstagedrc +3 -0
- package/.nvmrc +1 -0
- package/dist/Common/DebouncedSearch/DebouncedSearch.d.ts +2 -0
- package/dist/Common/Helper.d.ts +4 -0
- package/dist/Common/SearchBar/SearchBar.component.d.ts +8 -0
- package/dist/Common/SearchBar/types.d.ts +35 -0
- package/dist/Common/index.d.ts +1 -0
- package/dist/index.js +269 -183
- package/package.json +19 -2
- package/src/Assets/Icon/ic-search.svg +6 -0
- package/src/Common/DebouncedSearch/DebouncedSearch.tsx +2 -0
- package/src/Common/Helper.tsx +15 -0
- package/src/Common/SearchBar/SearchBar.component.tsx +79 -0
- package/src/Common/SearchBar/searchBar.scss +65 -0
- package/src/Common/SearchBar/types.ts +36 -0
- package/src/Common/index.ts +1 -0
package/.eslintignore
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
.eslintrc.js
|
|
2
|
+
|
|
3
|
+
# Files with ESLint errors/warnings
|
|
4
|
+
src/Common/AddCDButton/AddCDButton.tsx
|
|
5
|
+
src/Common/AddCDButton/utils.tsx
|
|
6
|
+
src/Common/Api.ts
|
|
7
|
+
src/Common/AppStatus/AppStatus.tsx
|
|
8
|
+
src/Common/AppStatus/index.ts
|
|
9
|
+
src/Common/AppStatus/utils.ts
|
|
10
|
+
src/Common/BreadCrumb/BreadCrumb.tsx
|
|
11
|
+
src/Common/BreadCrumb/BreadcrumbStore.tsx
|
|
12
|
+
src/Common/BreadCrumb/Types.ts
|
|
13
|
+
src/Common/CIPipeline.Types.ts
|
|
14
|
+
src/Common/ChartVersionAndTypeSelector.tsx
|
|
15
|
+
src/Common/Checkbox.tsx
|
|
16
|
+
src/Common/ClipboardButton/ClipboardButton.tsx
|
|
17
|
+
src/Common/ClipboardButton/__tests__/ClipboardButton.test.tsx
|
|
18
|
+
src/Common/Common.service.ts
|
|
19
|
+
src/Common/Constants.ts
|
|
20
|
+
src/Common/CustomInput/CustomInput.tsx
|
|
21
|
+
src/Common/CustomInput/Types.ts
|
|
22
|
+
src/Common/CustomInput/index.ts
|
|
23
|
+
src/Common/CustomTagSelector/PropagateTagInfo.tsx
|
|
24
|
+
src/Common/CustomTagSelector/ResizableTagTextArea.tsx
|
|
25
|
+
src/Common/CustomTagSelector/TagDetails.tsx
|
|
26
|
+
src/Common/CustomTagSelector/TagLabelSelect.tsx
|
|
27
|
+
src/Common/CustomTagSelector/TagLabelValueSelector.tsx
|
|
28
|
+
src/Common/CustomTagSelector/TagSelector.utils.ts
|
|
29
|
+
src/Common/CustomTagSelector/Types.ts
|
|
30
|
+
src/Common/CustomTagSelector/ValidationRules.ts
|
|
31
|
+
src/Common/CustomTagSelector/index.ts
|
|
32
|
+
src/Common/DebouncedSearch/DebouncedSearch.tsx
|
|
33
|
+
src/Common/DebouncedSearch/Utils.ts
|
|
34
|
+
src/Common/DebouncedSearch/__tests__/DebouncedSearch.test.tsx
|
|
35
|
+
src/Common/DeleteComponentModal/DeleteComponent.tsx
|
|
36
|
+
src/Common/DeleteComponentModal/types.ts
|
|
37
|
+
src/Common/DevtronProgressing/DevtronProgressing.tsx
|
|
38
|
+
src/Common/Dialogs/ConfirmationDialog.tsx
|
|
39
|
+
src/Common/Dialogs/DeleteDialog.tsx
|
|
40
|
+
src/Common/Dialogs/DialogForm.tsx
|
|
41
|
+
src/Common/Dialogs/ForceDeleteDialog.tsx
|
|
42
|
+
src/Common/Dialogs/Types.ts
|
|
43
|
+
src/Common/Dialogs/index.ts
|
|
44
|
+
src/Common/DraggableWrapper/DraggableButton.tsx
|
|
45
|
+
src/Common/DraggableWrapper/DraggableWrapper.tsx
|
|
46
|
+
src/Common/Drawer/Drawer.tsx
|
|
47
|
+
src/Common/EmptyState/EmptyState.tsx
|
|
48
|
+
src/Common/EmptyState/GenericEmptyState.tsx
|
|
49
|
+
src/Common/Error.tsx
|
|
50
|
+
src/Common/ErrorScreenNotFound.tsx
|
|
51
|
+
src/Common/Grid/Grid.tsx
|
|
52
|
+
src/Common/Helper.tsx
|
|
53
|
+
src/Common/Hooks/UseClickOutside/UseClickOutside.tsx
|
|
54
|
+
src/Common/Hooks/UseSuperAdmin/UseSuperAdmin.tsx
|
|
55
|
+
src/Common/Hooks/UseWindowSize/UseWindowSize.tsx
|
|
56
|
+
src/Common/ImageTags.Types.ts
|
|
57
|
+
src/Common/ImageTags.tsx
|
|
58
|
+
src/Common/InfoColorBar/InfoColourbar.tsx
|
|
59
|
+
src/Common/Modals/Modal.tsx
|
|
60
|
+
src/Common/Modals/OpaqueModal.tsx
|
|
61
|
+
src/Common/Modals/VisibleModal.tsx
|
|
62
|
+
src/Common/Modals/VisibleModal2.tsx
|
|
63
|
+
src/Common/MultiSelectCustomization.tsx
|
|
64
|
+
src/Common/Policy.Types.ts
|
|
65
|
+
src/Common/PopupMenu.tsx
|
|
66
|
+
src/Common/Progressing.tsx
|
|
67
|
+
src/Common/RJSF/Form.tsx
|
|
68
|
+
src/Common/RJSF/common/FieldRow.tsx
|
|
69
|
+
src/Common/RJSF/config.ts
|
|
70
|
+
src/Common/RJSF/templates/ArrayFieldItemTemplate.tsx
|
|
71
|
+
src/Common/RJSF/templates/ArrayFieldTemplate.tsx
|
|
72
|
+
src/Common/RJSF/templates/BaseInput.tsx
|
|
73
|
+
src/Common/RJSF/templates/ButtonTemplates/AddButton.tsx
|
|
74
|
+
src/Common/RJSF/templates/ButtonTemplates/RemoveButton.tsx
|
|
75
|
+
src/Common/RJSF/templates/ButtonTemplates/SubmitButton.tsx
|
|
76
|
+
src/Common/RJSF/templates/Description.tsx
|
|
77
|
+
src/Common/RJSF/templates/Field.tsx
|
|
78
|
+
src/Common/RJSF/templates/FieldErrorTemplate.tsx
|
|
79
|
+
src/Common/RJSF/templates/ObjectFieldTemplate.tsx
|
|
80
|
+
src/Common/RJSF/templates/TitleField.tsx
|
|
81
|
+
src/Common/RJSF/templates/WrapIfAdditionalTemplate.tsx
|
|
82
|
+
src/Common/RJSF/utils.ts
|
|
83
|
+
src/Common/RJSF/widgets/Checkbox.tsx
|
|
84
|
+
src/Common/RJSF/widgets/Select.tsx
|
|
85
|
+
src/Common/RadioGroup.tsx
|
|
86
|
+
src/Common/RadioGroup/RadioGroup.tsx
|
|
87
|
+
src/Common/Reload.tsx
|
|
88
|
+
src/Common/ResizableTextarea.tsx
|
|
89
|
+
src/Common/Security/ScanVulnerabilitiesTable.tsx
|
|
90
|
+
src/Common/ServerError.ts
|
|
91
|
+
src/Common/TippyCustomized.tsx
|
|
92
|
+
src/Common/ToastBody.tsx
|
|
93
|
+
src/Common/Toggle/Toggle.tsx
|
|
94
|
+
src/Common/Types.ts
|
|
95
|
+
src/custom.d.ts
|
|
96
|
+
src/index.ts
|
package/.eslintrc.js
CHANGED
|
@@ -1,41 +1,109 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
parser: '@typescript-eslint/parser',
|
|
3
|
-
plugins: ['@typescript-eslint'],
|
|
3
|
+
plugins: ['@typescript-eslint', 'react', 'prettier'],
|
|
4
4
|
env: {
|
|
5
|
-
commonjs: true,
|
|
6
5
|
browser: true,
|
|
7
|
-
|
|
6
|
+
es2021: true,
|
|
8
7
|
},
|
|
9
8
|
parserOptions: {
|
|
10
|
-
ecmaVersion:
|
|
9
|
+
ecmaVersion: 2021,
|
|
11
10
|
sourceType: 'module',
|
|
12
11
|
ecmaFeatures: {
|
|
13
12
|
jsx: true,
|
|
14
13
|
},
|
|
15
14
|
project: ['./tsconfig.json'],
|
|
16
15
|
},
|
|
16
|
+
globals: {
|
|
17
|
+
JSX: true,
|
|
18
|
+
},
|
|
19
|
+
extends: [
|
|
20
|
+
'eslint:recommended',
|
|
21
|
+
'plugin:react/recommended',
|
|
22
|
+
'plugin:react/jsx-runtime',
|
|
23
|
+
'plugin:@typescript-eslint/eslint-recommended',
|
|
24
|
+
'airbnb',
|
|
25
|
+
'airbnb/hooks',
|
|
26
|
+
'prettier',
|
|
27
|
+
],
|
|
17
28
|
rules: {
|
|
29
|
+
'prettier/prettier': ['error'],
|
|
30
|
+
'linebreak-style': ['error', 'unix'],
|
|
31
|
+
'no-console': 'warn',
|
|
18
32
|
'no-var': 'error',
|
|
19
33
|
'no-duplicate-imports': 'error',
|
|
34
|
+
'no-shadow': 'off',
|
|
35
|
+
'@typescript-eslint/no-shadow': 'warn',
|
|
20
36
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
21
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
22
|
-
'@typescript-eslint/no-use-before-define': 'off',
|
|
23
37
|
'@typescript-eslint/explicit-member-accessibility': 'off',
|
|
24
|
-
|
|
25
|
-
'
|
|
26
|
-
'
|
|
38
|
+
// Since we are using typescript, we can disable the no-unused-vars rule for enum,etc
|
|
39
|
+
'no-unused-vars': 'off',
|
|
40
|
+
'@typescript-eslint/no-unused-vars': 'error',
|
|
41
|
+
'react/jsx-filename-extension': [
|
|
42
|
+
'error',
|
|
43
|
+
{
|
|
44
|
+
extensions: ['tsx'],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
'react/jsx-props-no-spreading': 'off',
|
|
48
|
+
'react/prefer-stateless-function': 'off',
|
|
49
|
+
'jsx-a11y/click-events-have-key-events': 'off',
|
|
50
|
+
'jsx-a11y/no-static-element-interactions': 'off',
|
|
51
|
+
'jsx-a11y/no-noninteractive-element-interactions': 'off',
|
|
52
|
+
'no-underscore-dangle': 'off',
|
|
53
|
+
'import/no-extraneous-dependencies': [
|
|
54
|
+
'warn',
|
|
55
|
+
{
|
|
56
|
+
devDependencies: true,
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
'no-plusplus': [
|
|
60
|
+
'error',
|
|
61
|
+
{
|
|
62
|
+
allowForLoopAfterthoughts: true,
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
// Since we dont use prop-types, we can disable this rule
|
|
66
|
+
'react/require-default-props': 'off',
|
|
67
|
+
'react-hooks/exhaustive-deps': 'off',
|
|
68
|
+
'react/function-component-definition': [
|
|
69
|
+
'warn',
|
|
70
|
+
{
|
|
71
|
+
namedComponents: 'arrow-function',
|
|
72
|
+
unnamedComponents: 'arrow-function',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
'react/jsx-uses-react': 'off',
|
|
76
|
+
'react/react-in-jsx-scope': 'off',
|
|
77
|
+
// additional rules:
|
|
78
|
+
'@typescript-eslint/no-floating-promises': 'error',
|
|
79
|
+
'import/extensions': [
|
|
80
|
+
'warn',
|
|
81
|
+
'ignorePackages',
|
|
82
|
+
{
|
|
83
|
+
js: 'never',
|
|
84
|
+
jsx: 'never',
|
|
85
|
+
ts: 'never',
|
|
86
|
+
tsx: 'never',
|
|
87
|
+
},
|
|
88
|
+
],
|
|
27
89
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
90
|
+
overrides: [
|
|
91
|
+
{
|
|
92
|
+
files: ['*.ts', '*.tsx'],
|
|
93
|
+
rules: {
|
|
94
|
+
'no-undef': 'off',
|
|
95
|
+
},
|
|
96
|
+
},
|
|
35
97
|
],
|
|
36
98
|
settings: {
|
|
37
99
|
react: {
|
|
38
100
|
version: 'detect',
|
|
39
101
|
},
|
|
102
|
+
'import/resolver': {
|
|
103
|
+
node: {
|
|
104
|
+
moduleDirectory: ['src', 'node_modules'],
|
|
105
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
106
|
+
},
|
|
107
|
+
},
|
|
40
108
|
},
|
|
41
109
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Description
|
|
2
|
+
|
|
3
|
+
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
|
|
4
|
+
|
|
5
|
+
## Type of change
|
|
6
|
+
|
|
7
|
+
- [ ] Bug fix (non-breaking change which fixes an issue)
|
|
8
|
+
- [ ] New feature (non-breaking change which adds functionality)
|
|
9
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
|
10
|
+
- [ ] This change requires a documentation update
|
|
11
|
+
|
|
12
|
+
## How Has This Been Tested?
|
|
13
|
+
|
|
14
|
+
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
|
|
15
|
+
|
|
16
|
+
- [ ] Test A
|
|
17
|
+
- [ ] Test B
|
|
18
|
+
|
|
19
|
+
## Checklist
|
|
20
|
+
|
|
21
|
+
- [ ] The title of the PR states what changed and the related issues number (used for the release note).
|
|
22
|
+
- [ ] Does this PR require documentation updates?
|
|
23
|
+
- [ ] I've updated documentation as required by this PR.
|
|
24
|
+
- [ ] I have performed a self-review of my own code
|
|
25
|
+
- [ ] I have commented my code, particularly in hard-to-understand areas
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Common Lib CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types:
|
|
6
|
+
- opened
|
|
7
|
+
- synchronize
|
|
8
|
+
- edited
|
|
9
|
+
- reopened
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
ci:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout repository
|
|
16
|
+
uses: actions/checkout@v3
|
|
17
|
+
|
|
18
|
+
- name: Use Node.js
|
|
19
|
+
uses: actions/setup-node@v3
|
|
20
|
+
with:
|
|
21
|
+
node-version-file: '.nvmrc'
|
|
22
|
+
cache: 'npm'
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: npm ci
|
|
26
|
+
|
|
27
|
+
- name: Check linting issues
|
|
28
|
+
run: npm run lint
|
|
29
|
+
|
|
30
|
+
- name: Build Lib
|
|
31
|
+
run: npm run build-lib
|
|
@@ -11,7 +11,7 @@ jobs:
|
|
|
11
11
|
- uses: actions/checkout@v3
|
|
12
12
|
- uses: actions/setup-node@v3
|
|
13
13
|
with:
|
|
14
|
-
node-version:
|
|
14
|
+
node-version-file: '.nvmrc'
|
|
15
15
|
- run: npm ci
|
|
16
16
|
- run: npm test
|
|
17
17
|
|
|
@@ -25,7 +25,7 @@ jobs:
|
|
|
25
25
|
- uses: actions/checkout@v3
|
|
26
26
|
- uses: actions/setup-node@v3
|
|
27
27
|
with:
|
|
28
|
-
node-version:
|
|
28
|
+
node-version-file: '.nvmrc'
|
|
29
29
|
registry-url: https://npm.pkg.github.com/
|
|
30
30
|
- run: npm ci
|
|
31
31
|
- run: npm run build-lib
|
|
@@ -46,4 +46,3 @@ jobs:
|
|
|
46
46
|
- run: npm publish --access public
|
|
47
47
|
env:
|
|
48
48
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
49
|
-
|
package/.lintstagedrc
ADDED
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v16.13.0
|
|
@@ -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
|
package/dist/Common/Helper.d.ts
CHANGED
|
@@ -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,8 @@
|
|
|
1
|
+
import { FunctionComponent } from '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
|
+
*/
|
|
7
|
+
declare const SearchBar: FunctionComponent<SearchBarProps>;
|
|
8
|
+
export default SearchBar;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { InputHTMLAttributes, SyntheticEvent } 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?: (event: SyntheticEvent) => 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
|
+
}
|
package/dist/Common/index.d.ts
CHANGED
|
@@ -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 { default as SearchBar } from './SearchBar/SearchBar.component';
|
|
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';
|