@devtron-labs/devtron-fe-common-lib 0.0.59-beta-11 → 0.0.59-beta-13

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.
Files changed (60) hide show
  1. package/dist/Common/Api.d.ts +0 -9
  2. package/dist/Common/Constants.d.ts +0 -14
  3. package/dist/Common/Helper.d.ts +4 -1
  4. package/dist/Common/Hooks/index.d.ts +0 -1
  5. package/dist/Common/Types.d.ts +3 -16
  6. package/dist/Common/index.d.ts +0 -1
  7. package/dist/index.d.ts +1 -3
  8. package/dist/index.js +182 -614
  9. package/package.json +1 -1
  10. package/src/Common/Api.ts +0 -21
  11. package/src/Common/Constants.ts +1 -17
  12. package/src/Common/Helper.tsx +30 -16
  13. package/src/Common/Hooks/index.ts +0 -1
  14. package/src/Common/SearchBar/SearchBar.component.tsx +11 -23
  15. package/src/Common/Types.ts +2 -16
  16. package/src/Common/index.ts +0 -1
  17. package/src/index.ts +1 -3
  18. package/dist/Common/Hooks/useUrlFilters/constants.d.ts +0 -8
  19. package/dist/Common/Hooks/useUrlFilters/index.d.ts +0 -2
  20. package/dist/Common/Hooks/useUrlFilters/types.d.ts +0 -6
  21. package/dist/Common/Hooks/useUrlFilters/useUrlFilters.d.ts +0 -32
  22. package/dist/Common/SortableTableHeaderCell/SortableTableHeaderCell.d.ts +0 -18
  23. package/dist/Common/SortableTableHeaderCell/index.d.ts +0 -2
  24. package/dist/Common/SortableTableHeaderCell/types.d.ts +0 -25
  25. package/dist/Pages/GlobalConfigurations/Authorization/constants.d.ts +0 -15
  26. package/dist/Pages/GlobalConfigurations/Authorization/index.d.ts +0 -1
  27. package/dist/Pages/GlobalConfigurations/index.d.ts +0 -1
  28. package/dist/Pages/index.d.ts +0 -1
  29. package/dist/Shared/Components/BulkSelection/BulkSelection.d.ts +0 -4
  30. package/dist/Shared/Components/BulkSelection/BulkSelectionDropdownItems.d.ts +0 -4
  31. package/dist/Shared/Components/BulkSelection/UseBulkSelection.d.ts +0 -3
  32. package/dist/Shared/Components/BulkSelection/constants.d.ts +0 -8
  33. package/dist/Shared/Components/BulkSelection/index.d.ts +0 -4
  34. package/dist/Shared/Components/BulkSelection/types.d.ts +0 -51
  35. package/dist/Shared/Components/index.d.ts +0 -1
  36. package/dist/Shared/index.d.ts +0 -1
  37. package/src/Assets/Icon/ic-arrow-up-down.svg +0 -3
  38. package/src/Assets/Icon/ic-check-all.svg +0 -5
  39. package/src/Assets/Icon/ic-check-square.svg +0 -4
  40. package/src/Assets/Icon/ic-close.svg +0 -3
  41. package/src/Assets/Icon/ic-sort-arrow-down.svg +0 -3
  42. package/src/Common/Hooks/useUrlFilters/constants.ts +0 -9
  43. package/src/Common/Hooks/useUrlFilters/index.ts +0 -2
  44. package/src/Common/Hooks/useUrlFilters/types.ts +0 -6
  45. package/src/Common/Hooks/useUrlFilters/useUrlFilters.ts +0 -121
  46. package/src/Common/SortableTableHeaderCell/SortableTableHeaderCell.tsx +0 -44
  47. package/src/Common/SortableTableHeaderCell/index.ts +0 -2
  48. package/src/Common/SortableTableHeaderCell/types.ts +0 -26
  49. package/src/Pages/GlobalConfigurations/Authorization/constants.ts +0 -16
  50. package/src/Pages/GlobalConfigurations/Authorization/index.ts +0 -1
  51. package/src/Pages/GlobalConfigurations/index.ts +0 -1
  52. package/src/Pages/index.ts +0 -1
  53. package/src/Shared/Components/BulkSelection/BulkSelection.tsx +0 -81
  54. package/src/Shared/Components/BulkSelection/BulkSelectionDropdownItems.tsx +0 -31
  55. package/src/Shared/Components/BulkSelection/UseBulkSelection.tsx +0 -99
  56. package/src/Shared/Components/BulkSelection/constants.tsx +0 -12
  57. package/src/Shared/Components/BulkSelection/index.ts +0 -4
  58. package/src/Shared/Components/BulkSelection/types.tsx +0 -61
  59. package/src/Shared/Components/index.ts +0 -1
  60. package/src/Shared/index.ts +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.59-beta-11",
3
+ "version": "0.0.59-beta-13",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/Common/Api.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { ServerErrors } from './ServerError'
2
2
  import { FALLBACK_REQUEST_TIMEOUT, Host, URLS } from './Constants'
3
3
  import { ResponseType, APIOptions } from './Types'
4
- import { MutableRefObject } from 'react'
5
4
 
6
5
  const responseMessages = {
7
6
  100: 'Continue',
@@ -229,23 +228,3 @@ export const get = (url: string, options?: APIOptions): Promise<ResponseType> =>
229
228
  export const trash = (url: string, data?: object, options?: APIOptions): Promise<ResponseType> => {
230
229
  return fetchInTime(url, 'DELETE', data, options)
231
230
  }
232
-
233
- /**
234
- * Aborts the previous request before triggering next request
235
- */
236
- export const abortPreviousRequests = <T,>(
237
- callback: () => Promise<T>,
238
- abortControllerRef: MutableRefObject<AbortController>,
239
- ): Promise<T> => {
240
- abortControllerRef.current.abort()
241
- // eslint-disable-next-line no-param-reassign
242
- abortControllerRef.current = new AbortController()
243
- return callback()
244
- }
245
-
246
- /**
247
- * Returns true if the error is due to a aborted request
248
- */
249
- export const getIsRequestAborted = (error) =>
250
- // The 0 code is common for aborted and blocked requests
251
- error && error.code === 0 && error.message === 'The user aborted a request.'
@@ -251,20 +251,4 @@ export const MAX_Z_INDEX = 2147483647
251
251
  export const SELECTED_APPROVAL_TAB_STATE = {
252
252
  APPROVAL: 'approval',
253
253
  PENDING: 'pending',
254
- }
255
-
256
- export enum SortingOrder {
257
- /**
258
- * Ascending order
259
- */
260
- ASC = 'ASC',
261
- /**
262
- * Descending order
263
- */
264
- DESC = 'DESC',
265
- }
266
-
267
- /**
268
- * Base page size for pagination
269
- */
270
- export const DEFAULT_BASE_PAGE_SIZE = 20
254
+ }
@@ -499,18 +499,27 @@ export const getFilteredChartVersions = (charts, selectedChartType) => {
499
499
  chartRefId: item.chartRefId,
500
500
  }))
501
501
  }
502
- function removeEmptyObjectKeysAndNullValues(obj) {
503
- // It recursively removes empty object keys and array values that are null
502
+
503
+ function removeEmptyObjectKeysAndNullValues(obj, originaljsonCopy) {
504
+ // It recursively removes empty object keys and empty array keys
504
505
  for (let key in obj) {
505
506
  if (Array.isArray(obj[key])) {
506
- if (obj[key].length === 0) continue
507
- obj[key] = obj[key].filter((item) => item !== null)
508
507
  // Check if the array is empty
509
- if (obj[key].length === 0) {
510
- delete obj[key] // Delete the key if the array is empty
508
+ if (obj[key].length !== 0) {
509
+ obj[key].forEach((element, index) => {
510
+ if (element === null || (typeof element === 'object' && Object.keys(element).length === 0))
511
+ obj[key].splice(index, 1)
512
+ else removeEmptyObjectKeysAndNullValues(element, originaljsonCopy[key][index])
513
+ })
514
+ }
515
+ if (obj[key].length === 0 && originaljsonCopy[key].length !== 0) {
516
+ delete obj[key]
511
517
  }
512
518
  } else if (obj[key] && typeof obj[key] === 'object') {
513
- if (removeEmptyObjectKeysAndNullValues(obj[key])) {
519
+ if (
520
+ removeEmptyObjectKeysAndNullValues(obj[key], originaljsonCopy[key]) &&
521
+ Object.keys(originaljsonCopy[key]).length !== 0
522
+ ) {
514
523
  delete obj[key]
515
524
  }
516
525
  } else if (obj[key] === undefined) {
@@ -520,20 +529,25 @@ function removeEmptyObjectKeysAndNullValues(obj) {
520
529
  return Object.keys(obj).length === 0
521
530
  }
522
531
 
523
- export function getUnlockedJSON(json, jsonPathArray) {
532
+ export function getUnlockedJSON(json, jsonPathArray, removeParentKeysAndEmptyArrays = false) {
533
+ if (!jsonPathArray.length) return { newDocument: json, removedPatches: [] }
534
+
524
535
  const jsonCopy = JSON.parse(JSON.stringify(json))
536
+ const originaljsonCopy = JSON.parse(JSON.stringify(json))
537
+ let removedPatches = []
525
538
  let patches = jsonPathArray.flatMap((jsonPath) => {
526
539
  const pathsToRemove = JSONPath({ path: jsonPath, json: jsonCopy, resultType: 'all' })
527
- return pathsToRemove.map((result) =>
528
- Array.isArray(result.parent)
529
- ? { op: 'replace', path: result.pointer, value: null }
530
- : { op: 'remove', path: result.pointer },
531
- )
540
+ //reversing patches to handle correct array index deletion
541
+ pathsToRemove.reverse()
542
+ return pathsToRemove.map((result) => {
543
+ //storing removed patches to have functionality of undo
544
+ removedPatches.push({ op: 'add', path: result.pointer, value: result.value })
545
+ return { op: 'remove', path: result.pointer }
546
+ })
532
547
  })
533
548
  let newDocument = jsonpatch.applyPatch(jsonCopy, patches).newDocument
534
-
535
- removeEmptyObjectKeysAndNullValues(newDocument)
536
- return newDocument
549
+ if (removeParentKeysAndEmptyArrays) removeEmptyObjectKeysAndNullValues(newDocument, originaljsonCopy)
550
+ return { newDocument, removedPatches: removedPatches.reverse() }
537
551
  }
538
552
 
539
553
  export function getLockedJSON(json, jsonPathArray: string[]) {
@@ -1,4 +1,3 @@
1
1
  export { useSuperAdmin } from './UseSuperAdmin/UseSuperAdmin'
2
2
  export { useClickOutside } from './UseClickOutside/UseClickOutside'
3
3
  export { useWindowSize } from './UseWindowSize/UseWindowSize'
4
- export * from './useUrlFilters'
@@ -1,4 +1,4 @@
1
- import { ChangeEvent, useCallback, useRef, useState, KeyboardEvent, useEffect } from 'react'
1
+ import { ChangeEvent, useCallback, useRef, useState, KeyboardEvent } from 'react'
2
2
  import { ReactComponent as Search } from '../../Assets/Icon/ic-search.svg'
3
3
  import { ReactComponent as Clear } from '../../Assets/Icon/ic-error-cross.svg'
4
4
  import { SearchBarProps } from './types'
@@ -55,28 +55,9 @@ const SearchBar = ({
55
55
  debounceTimeout,
56
56
  ])
57
57
 
58
- // assuming initialSearchText will change if we are changing history otherwise will be constant and will not change
59
- // since on changing history we expect to make api call using useAsync so not applying handleEnter
60
- useEffect(() => {
61
- inputRef.current.value = initialSearchText
62
- setShowClearButton(!!initialSearchText)
63
- }, [initialSearchText])
64
-
65
- const _applySearch = (value: string) => {
66
- handleSearchChange(value)
67
- handleEnter(value)
68
- }
69
-
70
- const clearSearch = () => {
71
- inputRef.current.value = ''
72
- _applySearch('')
73
- setShowClearButton(false)
74
- }
75
-
76
58
  const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
77
59
  const { value } = e.target
78
60
  setShowClearButton(!!value)
79
-
80
61
  if (shouldDebounce) {
81
62
  debouncedSearchChange(value)
82
63
  } else {
@@ -84,17 +65,25 @@ const SearchBar = ({
84
65
  }
85
66
  }
86
67
 
68
+ const _applySearch = (value: string) => {
69
+ handleSearchChange(value)
70
+ handleEnter(value)
71
+ }
72
+
87
73
  const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {
88
74
  const { key } = e
89
75
 
90
76
  if (key === 'Enter') {
91
- e.preventDefault()
92
77
  const inputTarget = e.target as HTMLInputElement
93
78
  const value = inputTarget.value.trim()
94
79
  _applySearch(value)
95
80
  }
96
81
  }
97
82
 
83
+ const clearSearch = () => {
84
+ inputRef.current.value = ''
85
+ _applySearch('')
86
+ }
98
87
  return (
99
88
  <div className={containerClassName}>
100
89
  <div className="search-bar bc-n50 focus-within-border-b5 dc__hover-border-n300 dc__block w-100 min-w-200 dc__position-rel en-2 bw-1 br-4 h-32">
@@ -105,14 +94,13 @@ const SearchBar = ({
105
94
  type="text"
106
95
  {...inputProps}
107
96
  defaultValue={initialSearchText}
108
- className={`search-bar__input bc-n50 dc__position-abs w-100 h-100 br-4 dc__no-border pt-6 pr-10 pb-6 pl-30 fs-13 lh-20 fw-4 cn-9 placeholder-cn5 ${
97
+ className={`search-bar__input dc__position-abs w-100 h-100 br-4 dc__no-border pt-6 pr-10 pb-6 pl-30 fs-13 lh-20 fw-4 cn-9 placeholder-cn5 ${
109
98
  showClearButton ? 'pr-30' : 'pr-10'
110
99
  }`}
111
100
  onChange={handleChange}
112
101
  onKeyDown={handleKeyDown}
113
102
  ref={inputRef}
114
103
  />
115
- {/* TODO: Sync with product since it should have ic-enter in case of not applied */}
116
104
  {showClearButton && (
117
105
  <button
118
106
  className="flex search-bar__clear-button dc__position-abs dc__transparent mt-0 mb-0 mr-5 ml-5"
@@ -1,7 +1,7 @@
1
1
  import React, { ReactNode, CSSProperties } from 'react'
2
2
  import { Placement } from 'tippy.js'
3
3
  import { ImageComment, ReleaseTag } from './ImageTags.Types'
4
- import { DockerConfigOverrideType, SortingOrder, TaskErrorObj } from '.'
4
+ import { DockerConfigOverrideType, TaskErrorObj } from '.'
5
5
 
6
6
  /**
7
7
  * Generic response type object with support for overriding the result type
@@ -51,13 +51,11 @@ export interface Teams {
51
51
  export enum CHECKBOX_VALUE {
52
52
  CHECKED = 'CHECKED',
53
53
  INTERMEDIATE = 'INTERMEDIATE',
54
- BULK_CHECKED = 'BULK_CHECKED',
55
54
  }
56
55
  export interface CheckboxProps {
57
56
  onChange: (event) => void
58
57
  isChecked: boolean
59
- // FIXME: Need to replace this CHECKBOX_VALUE enum, and replace string instances in dashboard
60
- value: 'CHECKED' | 'INTERMEDIATE' | 'BULK_CHECKED'
58
+ value: 'CHECKED' | 'INTERMEDIATE'
61
59
  disabled?: boolean
62
60
  tabIndex?: number
63
61
  rootClassName?: string
@@ -764,15 +762,3 @@ export interface EdgeNodeType {
764
762
  export interface EdgeEndNodeType extends EdgeNodeType {
765
763
  userApprovalConfig?: UserApprovalConfigType
766
764
  }
767
-
768
- /**
769
- * Search params for sorting configuration
770
- *
771
- * Note: Either both sortOrder and sortBy are required or none
772
- */
773
- export type SortingParams<T = string> =
774
- | {
775
- sortOrder: SortingOrder
776
- sortBy: T
777
- }
778
- | { sortOrder?: never; sortBy?: never }
@@ -27,7 +27,6 @@ export * from './Checkbox'
27
27
  export { default as EmptyState } from './EmptyState/EmptyState'
28
28
  export { default as GenericEmptyState } from './EmptyState/GenericEmptyState'
29
29
  export * from './SearchBar'
30
- export * from './SortableTableHeaderCell'
31
30
  export { default as Toggle } from './Toggle/Toggle'
32
31
  export { default as ScanVulnerabilitiesTable } from './Security/ScanVulnerabilitiesTable'
33
32
  export { default as StyledRadioGroup } from './RadioGroup/RadioGroup'
package/src/index.ts CHANGED
@@ -1,3 +1 @@
1
- export * from './Common'
2
- export * from './Pages'
3
- export * from './Shared'
1
+ export * from "./Common"
@@ -1,8 +0,0 @@
1
- export declare const DEFAULT_PAGE_NUMBER = 1;
2
- export declare const URL_FILTER_KEYS: {
3
- readonly PAGE_SIZE: "pageSize";
4
- readonly PAGE_NUMBER: "pageNumber";
5
- readonly SEARCH_KEY: "searchKey";
6
- readonly SORT_BY: "sortBy";
7
- readonly SORT_ORDER: "sortOrder";
8
- };
@@ -1,2 +0,0 @@
1
- export { default as useUrlFilters } from './useUrlFilters';
2
- export type { UseUrlFiltersProps } from './types';
@@ -1,6 +0,0 @@
1
- export interface UseUrlFiltersProps<T> {
2
- /**
3
- * The key on which the sorting should be applied
4
- */
5
- initialSortKey?: T;
6
- }
@@ -1,32 +0,0 @@
1
- import { SortingOrder } from '../../Constants';
2
- import { UseUrlFiltersProps } from './types';
3
- /**
4
- * Generic hook for implementing URL based filters.
5
- * eg: pagination, search, sort.
6
- *
7
- * The exposed handlers can be consumed directly without the need for explicit state management
8
- *
9
- * @example Default Usage:
10
- * ```tsx
11
- * const { pageSize, changePage, ...rest } = useUrlFilters()
12
- * ```
13
- *
14
- * @example Usage with custom type for sort keys and initial sort key:
15
- * ```tsx
16
- * const { sortBy, sortOrder } = useUrlFilters<'email' | 'name'>({ initialSortKey: 'email' })
17
- * ```
18
- *
19
- */
20
- declare const useUrlFilters: <T = string>({ initialSortKey }?: UseUrlFiltersProps<T>) => {
21
- pageSize: number;
22
- changePage: (page: number) => void;
23
- changePageSize: (_pageSize: number) => void;
24
- searchKey: string;
25
- handleSearch: (searchTerm: string) => void;
26
- offset: number;
27
- sortBy: T;
28
- sortOrder: SortingOrder;
29
- handleSorting: (_sortBy: T) => void;
30
- clearFilters: () => void;
31
- };
32
- export default useUrlFilters;
@@ -1,18 +0,0 @@
1
- /// <reference types="react" />
2
- import { SortableTableHeaderCellProps } from './types';
3
- /**
4
- * Reusable component for the table header cell with support for sorting icons
5
- *
6
- * @example Usage
7
- * ```tsx
8
- * <SortableTableHeaderCell
9
- * isSorted={currentSortedCell === 'cell'}
10
- * triggerSorting={() => {}}
11
- * sortOrder={SortingOrder.ASC}
12
- * title="Header Cell"
13
- * disabled={isDisabled}
14
- * />
15
- * ```
16
- */
17
- declare const SortableTableHeaderCell: ({ isSorted, triggerSorting, sortOrder, title, disabled, }: SortableTableHeaderCellProps) => JSX.Element;
18
- export default SortableTableHeaderCell;
@@ -1,2 +0,0 @@
1
- export { default as SortableTableHeaderCell } from './SortableTableHeaderCell';
2
- export type { SortableTableHeaderCellProps } from './types';
@@ -1,25 +0,0 @@
1
- import { SortingOrder } from '../Constants';
2
- export interface SortableTableHeaderCellProps {
3
- /**
4
- * If true, the cell is sorted
5
- */
6
- isSorted: boolean;
7
- /**
8
- * Callback for handling the sorting of the cell
9
- */
10
- triggerSorting: () => void;
11
- /**
12
- * Current sort order
13
- *
14
- * Note: On click, the sort order should be updated as required
15
- */
16
- sortOrder: SortingOrder;
17
- /**
18
- * Label for the cell
19
- */
20
- title: string;
21
- /**
22
- * If true, the cell is disabled
23
- */
24
- disabled: boolean;
25
- }
@@ -1,15 +0,0 @@
1
- /**
2
- * User Status received from the API
3
- */
4
- export declare enum UserStatusDto {
5
- active = "active",
6
- inactive = "inactive"
7
- }
8
- /**
9
- * User status for the frontend
10
- */
11
- export declare enum UserStatus {
12
- active = "active",
13
- inactive = "inactive",
14
- temporary = "temporary"
15
- }
@@ -1 +0,0 @@
1
- export * from './constants';
@@ -1 +0,0 @@
1
- export * from './Authorization';
@@ -1 +0,0 @@
1
- export * from './GlobalConfigurations';
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import { BulkSelectionProps } from './types';
3
- declare const BulkSelection: <T>({ checkboxValue, isChecked, selectedIdentifiers, handleBulkSelection, showPagination, }: BulkSelectionProps<T>) => JSX.Element;
4
- export default BulkSelection;
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import { BulkSelectionDropdownItemsProps } from './types';
3
- declare const BulkSelectionDropdownItems: <T>({ locator, label, isSelected, handleBulkSelection, icon: Icon, }: BulkSelectionDropdownItemsProps<T>) => JSX.Element;
4
- export default BulkSelectionDropdownItems;
@@ -1,3 +0,0 @@
1
- import { UseBulkSelectionProps, UseBulkSelectionReturnType } from './types';
2
- declare const useBulkSelection: <T>({ identifiers, getSelectAllDialogStatus, }: UseBulkSelectionProps<T>) => UseBulkSelectionReturnType<T>;
3
- export default useBulkSelection;
@@ -1,8 +0,0 @@
1
- export declare const BULK_DROPDOWN_TEST_ID: "bulk-selection-pop-up-menu";
2
- export declare const BulkSelectionOptionsLabels: {
3
- readonly SELECT_ALL_ON_PAGE: "All on this page";
4
- readonly SELECT_ALL_ACROSS_PAGES: "All across pages";
5
- readonly CLEAR_ALL_SELECTIONS: "Clear selection";
6
- };
7
- export declare const SELECT_ALL_ACROSS_PAGES_LOCATOR: "*";
8
- export declare const getInvalidActionMessage: (action: string) => string;
@@ -1,4 +0,0 @@
1
- export { default as BulkSelection } from './BulkSelection';
2
- export { default as useBulkSelection } from './UseBulkSelection';
3
- export * from './types';
4
- export * from './constants';
@@ -1,51 +0,0 @@
1
- /// <reference types="react" />
2
- import { CHECKBOX_VALUE } from '../../../Common';
3
- export declare enum BulkSelectionEvents {
4
- CLEAR_ALL_SELECTIONS = "CLEAR_ALL_SELECTIONS",
5
- CLEAR_IDENTIFIERS = "CLEAR_IDENTIFIERS",
6
- SELECT_ALL_ACROSS_PAGES = "SELECT_ALL_ACROSS_PAGES",
7
- SELECT_ALL_ON_PAGE = "SELECT_ALL_ON_PAGE",
8
- SELECT_IDENTIFIER = "SELECT_IDENTIFIER",
9
- CLEAR_IDENTIFIERS_AFTER_ACROSS_SELECTION = "CLEAR_IDENTIFIERS_AFTER_ACROSS_SELECTION",
10
- CLEAR_SELECTIONS_AND_SELECT_ALL_ACROSS_PAGES = "CLEAR_SELECTIONS_AND_SELECT_ALL_ACROSS_PAGES"
11
- }
12
- export interface HandleBulkSelectionType<T> {
13
- action: BulkSelectionEvents;
14
- data?: {
15
- identifierIds?: (number | string)[];
16
- identifierObject?: T;
17
- };
18
- }
19
- export interface UseBulkSelectionReturnType<T> {
20
- selectedIdentifiers: T;
21
- handleBulkSelection: ({ action, data }: HandleBulkSelectionType<T>) => void;
22
- }
23
- export interface BulkSelectionProps<T> extends UseBulkSelectionReturnType<T> {
24
- checkboxValue: CHECKBOX_VALUE;
25
- isChecked: boolean;
26
- showPagination: boolean;
27
- }
28
- export interface BulkSelectionDropdownItemsType {
29
- locator: BulkSelectionEvents;
30
- label: string;
31
- isSelected: boolean;
32
- icon: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
33
- }
34
- export interface BulkSelectionDropdownItemsProps<T> extends BulkSelectionDropdownItemsType, Pick<BulkSelectionProps<T>, 'handleBulkSelection'> {
35
- }
36
- export declare enum SelectAllDialogStatus {
37
- OPEN = "OPEN",
38
- CLOSED = "CLOSED"
39
- }
40
- export type BulkSelectionIdentifiersType<T> = Record<string | number, T>;
41
- export interface UseBulkSelectionProps<T> {
42
- /**
43
- * Response from API, assuming structure to be array of objects with key and values
44
- * This will the given ids on current page
45
- */
46
- identifiers: T;
47
- /**
48
- * Act as buffer between select all across pages and select all on page state
49
- */
50
- getSelectAllDialogStatus: () => SelectAllDialogStatus;
51
- }
@@ -1 +0,0 @@
1
- export * from './BulkSelection';
@@ -1 +0,0 @@
1
- export * from './Components';
@@ -1,3 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none">
2
- <path d="M4.125 8.5L6 10.75L7.875 8.5M4.125 3.5L6 1.25L7.875 3.5" stroke="#3B444C" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
3
- </svg>
@@ -1,5 +0,0 @@
1
- <svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect x="2" y="2" width="11.2" height="11.2" rx="2" stroke="#596168" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
3
- <path d="M15.4667 5.86621V11.4662C15.4667 13.6754 13.6758 15.4662 11.4667 15.4662H5.8667" stroke="#596168" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
4
- <path d="M10.35 5.84961L6.85004 9.34945L5.10004 7.59961" stroke="#596168" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
5
- </svg>
@@ -1,4 +0,0 @@
1
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect x="2" y="2" width="12" height="12" rx="2" stroke="#596168" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
3
- <path d="M11.2083 5.95801L7.12498 10.0412L5.08331 7.99967" stroke="#596168" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
4
- </svg>
@@ -1,3 +0,0 @@
1
- <svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M8.33335 1.66699L1.66669 8.33366M8.33335 8.33366L1.66669 1.66699" stroke="#596168" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
3
- </svg>
@@ -1,3 +0,0 @@
1
- <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M3.5 7.50009L6.00004 10.0001M6.00004 10.0001L8.5 7.50054M6.00004 10.0001V2" stroke="#596168" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
3
- </svg>
@@ -1,9 +0,0 @@
1
- export const DEFAULT_PAGE_NUMBER = 1
2
-
3
- export const URL_FILTER_KEYS = {
4
- PAGE_SIZE: 'pageSize',
5
- PAGE_NUMBER: 'pageNumber',
6
- SEARCH_KEY: 'searchKey',
7
- SORT_BY: 'sortBy',
8
- SORT_ORDER: 'sortOrder',
9
- } as const
@@ -1,2 +0,0 @@
1
- export { default as useUrlFilters } from './useUrlFilters'
2
- export type { UseUrlFiltersProps } from './types'
@@ -1,6 +0,0 @@
1
- export interface UseUrlFiltersProps<T> {
2
- /**
3
- * The key on which the sorting should be applied
4
- */
5
- initialSortKey?: T
6
- }