@devtron-labs/devtron-fe-common-lib 1.19.0-pre-5 → 1.19.0-pre-6

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,7 +1,7 @@
1
1
  import { j as n, au as T, aw as J, av as K } from "./@vendor-3ORIJA0h.js";
2
2
  import V, { useState as q, useEffect as Y, forwardRef as G, useMemo as E } from "react";
3
3
  import z, { getDefaultRegistry as Q } from "@rjsf/core";
4
- import { T as O, j as F, c as w, b as N, S as X, i as Z, g as ee, a as te, d as R, e as ne } from "./@code-editor-KdvtlDLy.js";
4
+ import { T as O, j as F, c as w, b as N, S as X, i as Z, g as ee, a as te, d as R, e as ne } from "./@code-editor-C4ZrS_SZ.js";
5
5
  import { getUiOptions as B, getTemplate as $, getSubmitButtonOptions as re, ADDITIONAL_PROPERTY_FLAG as L, errorId as se, englishStringTranslator as ae, TranslatableString as oe, titleId as le, canExpand as ie, deepEquals as ce } from "@rjsf/utils";
6
6
  import { ReactComponent as de } from "./assets/ic-add.cfaa779b.svg";
7
7
  import { ReactComponent as ue } from "./assets/ic-warning.ecf7ff97.svg";
@@ -27,6 +27,7 @@ export declare const KEYBOARD_KEYS_MAP: {
27
27
  readonly Delete: "⌦";
28
28
  readonly '.': ".";
29
29
  readonly Space: "Space";
30
+ readonly '>': ">";
30
31
  };
31
32
  export type SupportedKeyboardKeysType = keyof typeof KEYBOARD_KEYS_MAP;
32
33
  export interface ShortcutType {
@@ -1,6 +1,6 @@
1
1
  import { ShortcutType } from './types';
2
2
  export declare const preprocessKeys: (keys: ShortcutType["keys"]) => {
3
- keys: ("N" | "R" | "Enter" | "/" | "Alt" | "F" | "E" | "K" | "X" | "A" | "S" | "Home" | "End" | "." | "Space" | "Control" | "Shift" | "Meta" | "Escape" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "ArrowDown" | "PageUp" | "PageDown" | "Backspace" | "Delete")[];
3
+ keys: ("N" | "R" | "Enter" | "/" | "Alt" | "F" | "E" | "K" | "X" | "A" | "S" | "Home" | "End" | "." | "Space" | ">" | "Control" | "Shift" | "Meta" | "Escape" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "ArrowDown" | "PageUp" | "PageDown" | "Backspace" | "Delete")[];
4
4
  id: string;
5
5
  };
6
6
  export declare const verifyCallbackStack: (stack: ShortcutType["callbackStack"]) => void;
@@ -26,9 +26,6 @@ export interface ResponseType<T = any> {
26
26
  }
27
27
  export interface APIOptions {
28
28
  timeout?: number;
29
- /**
30
- * @deprecated Use abortController instead
31
- */
32
29
  signal?: AbortSignal;
33
30
  abortControllerRef?: MutableRefObject<AbortController>;
34
31
  /**
@@ -1,6 +1,15 @@
1
- import { MouseEvent, ReactNode } from 'react';
1
+ import { MouseEvent, ReactNode, SyntheticEvent } from 'react';
2
2
  import { DTFocusTrapType } from '../DTFocusTrap';
3
- export interface BackdropProps extends Pick<DTFocusTrapType, 'deactivateFocusOnEscape' | 'initialFocus' | 'onEscape'> {
3
+ export interface BackdropProps extends Pick<DTFocusTrapType, 'deactivateFocusOnEscape' | 'initialFocus'> {
4
+ /**
5
+ * Callback function that gets triggered when the Escape key is pressed. \
6
+ * Should be wrapped in useCallback to prevent unnecessary re-renders.
7
+ * @example
8
+ * const handleEscape = useCallback(() => {
9
+ * // Handle escape key press
10
+ * }, []);
11
+ */
12
+ onEscape: (e?: SyntheticEvent) => void;
4
13
  /**
5
14
  * The content to be rendered within the backdrop component.
6
15
  */
@@ -4,5 +4,5 @@ export declare const useFocusTrapControl: () => {
4
4
  disableFocusTrap: typeof noop;
5
5
  resumeFocusTrap: typeof noop;
6
6
  };
7
- declare const DTFocusTrap: ({ onEscape, deactivateFocusOnEscape, children, initialFocus, }: DTFocusTrapType) => JSX.Element;
7
+ declare const DTFocusTrap: ({ deactivateFocusOnEscape, children, initialFocus }: DTFocusTrapType) => JSX.Element;
8
8
  export default DTFocusTrap;
@@ -8,15 +8,6 @@ type FocusTargetValueOrFalse = FocusTargetValue | false;
8
8
  */
9
9
  type FocusTargetOrFalse = FocusTargetValueOrFalse | (() => FocusTargetValueOrFalse);
10
10
  export interface DTFocusTrapType {
11
- /**
12
- * Callback function that gets triggered when the Escape key is pressed. \
13
- * Should be wrapped in useCallback to prevent unnecessary re-renders.
14
- * @example
15
- * const handleEscape = useCallback(() => {
16
- * // Handle escape key press
17
- * }, []);
18
- */
19
- onEscape: (e?: KeyboardEvent | MouseEvent) => void;
20
11
  /**
21
12
  * If focus should be deactivated on escape, pass false when escape is disabled or has no action
22
13
  * true for cases when we are closing modals or dialogs
@@ -0,0 +1,3 @@
1
+ import { KeyboardShortcutProps } from './types';
2
+ declare const KeyboardShortcut: ({ keyboardKey }: KeyboardShortcutProps) => JSX.Element;
3
+ export default KeyboardShortcut;
@@ -0,0 +1 @@
1
+ export { default as KeyboardShortcut } from './KeyboardShortcut.component';
@@ -0,0 +1,4 @@
1
+ import { SupportedKeyboardKeysType } from '../../../Common/Hooks/UseRegisterShortcut/types';
2
+ export interface KeyboardShortcutProps {
3
+ keyboardKey: SupportedKeyboardKeysType;
4
+ }
@@ -59,6 +59,7 @@ export * from './ImageWithFallback';
59
59
  export * from './InfoBlock';
60
60
  export * from './InfoIconTippy';
61
61
  export * from './InvalidYAMLTippy';
62
+ export * from './KeyboardShortcut';
62
63
  export * from './KeyValueTable';
63
64
  export * from './License';
64
65
  export { default as LoadingCard } from './LoadingCard';
@@ -4,7 +4,7 @@ import { PreferredResourceKindType, UserPreferenceFilteredListTypes, UserPrefere
4
4
  * @description This function fetches the user preferences from the server. It uses the `get` method to make a request to the server and retrieves the user preferences based on the `USER_PREFERENCES_ATTRIBUTE_KEY`. The result is parsed and returned as a `UserPreferencesType` object.
5
5
  * @throws Will throw an error if the request fails or if the result is not in the expected format.
6
6
  */
7
- export declare const getUserPreferences: () => Promise<UserPreferencesType>;
7
+ export declare const getUserPreferences: (signal?: AbortSignal) => Promise<UserPreferencesType>;
8
8
  export declare const updateUserPreferences: ({ path, value, resourceKind, shouldThrowError, userPreferencesResponse, }: UserPreferenceResourceProps) => Promise<boolean>;
9
9
  /**
10
10
  * Optimized function to get updated user preferences with resource filtering
@@ -1,6 +1,8 @@
1
1
  import { USER_PREFERENCES_ATTRIBUTE_KEY } from './constants';
2
2
  import { AppThemeType, ThemeConfigType, ThemePreferenceType } from '../../Providers/ThemeProvider/types';
3
3
  import { ResourceKindType } from '../../types';
4
+ export type NavigationItemID = 'application-management-overview' | 'application-management-applications' | 'application-management-application-groups' | 'application-management-chart-store' | 'application-management-bulk-edit' | 'application-management-configurations' | 'application-management-policies' | 'application-management-others' | 'infrastructure-management-overview' | 'infrastructure-management-resource-browser' | 'infrastructure-management-intercepted-changes' | 'infrastructure-management-resource-watcher' | 'infrastructure-management-catalog-framework' | 'software-release-management-overview' | 'software-release-management-software-release' | 'cost-visibility-overview' | 'cost-visibility-trends' | 'cost-visibility-cost-breakdown' | 'cost-visibility-configurations' | 'security-center-overview' | 'security-center-application-security' | 'security-center-security-policies' | 'automation-and-enablement-jobs' | 'automation-and-enablement-alerting' | 'automation-and-enablement-incident-response' | 'automation-and-enablement-api-portal' | 'automation-and-enablement-runbook-automation' | 'global-configuration-sso-login-services' | 'global-configuration-host-urls' | 'global-configuration-cluster-and-environments' | 'global-configuration-container-oci-registry' | 'global-configuration-authorization';
5
+ export type NavigationSubMenuItemID = 'application-management-configurations-gitops' | 'application-management-configurations-git-accounts' | 'application-management-configurations-external-links' | 'application-management-configurations-chart-repository' | 'application-management-configurations-deployment-charts' | 'application-management-configurations-notifications' | 'application-management-configurations-catalog-frameworks' | 'application-management-configurations-scoped-variables' | 'application-management-configurations-build-infra' | 'application-management-policies-deployment-window' | 'application-management-policies-approval-policy' | 'application-management-policies-plugin-policy' | 'application-management-policies-pull-image-digest' | 'application-management-policies-tag-policy' | 'application-management-policies-filter-conditions' | 'application-management-policies-lock-deployment-configuration' | 'application-management-others-application-templates' | 'application-management-others-projects' | 'cost-visibility-cost-breakdown-clusters' | 'cost-visibility-cost-breakdown-environments' | 'cost-visibility-cost-breakdown-projects' | 'cost-visibility-cost-breakdown-applications' | 'global-configuration-authorization-user-permissions' | 'global-configuration-authorization-permission-groups' | 'global-configuration-authorization-api-tokens';
4
6
  export interface GetUserPreferencesQueryParamsType {
5
7
  key: typeof USER_PREFERENCES_ATTRIBUTE_KEY;
6
8
  }
@@ -36,13 +38,18 @@ export interface GetUserPreferencesParsedDTO {
36
38
  *
37
39
  */
38
40
  resources?: UserPreferenceResourceType;
41
+ commandBar: {
42
+ recentNavigationActions: {
43
+ id: NavigationItemID | NavigationSubMenuItemID;
44
+ }[];
45
+ };
39
46
  }
40
47
  export interface UserPreferencesPayloadValueType extends GetUserPreferencesParsedDTO {
41
48
  }
42
49
  export interface UpdateUserPreferencesPayloadType extends Pick<GetUserPreferencesQueryParamsType, 'key'> {
43
50
  value: string;
44
51
  }
45
- export interface UserPreferencesType {
52
+ export interface UserPreferencesType extends Pick<GetUserPreferencesParsedDTO, 'commandBar'> {
46
53
  /**
47
54
  * Preferred theme for the user
48
55
  * If null, would forcibly show user theme switcher dialog for user to select
@@ -69,7 +76,7 @@ export interface UseUserPreferencesProps {
69
76
  migrateUserPreferences?: (userPreferencesResponse: UserPreferencesType) => Promise<UserPreferencesType>;
70
77
  recentlyVisitedFetchConfig?: RecentlyVisitedFetchConfigType;
71
78
  }
72
- export type UserPathValueMapType = {
79
+ type UserPathValueMapType = {
73
80
  path: 'themePreference';
74
81
  value: Required<Pick<UpdatedUserPreferencesType, 'themePreference' | 'appTheme'>>;
75
82
  resourceKind?: never;
@@ -84,7 +91,28 @@ export type UserPathValueMapType = {
84
91
  value: Required<BaseRecentlyVisitedEntitiesTypes[]>;
85
92
  resourceKind: PreferredResourceKindType;
86
93
  userPreferencesResponse?: UserPreferencesType;
94
+ } | {
95
+ path: 'commandBar.recentNavigationActions';
96
+ value: UserPreferencesType['commandBar']['recentNavigationActions'];
97
+ resourceKind?: never;
98
+ userPreferencesResponse?: never;
87
99
  };
100
+ export type GetUserPreferencePayloadParams = {
101
+ userPreferencesResponse: UserPreferencesType;
102
+ resourceKind?: PreferredResourceKindType;
103
+ } & ({
104
+ path: 'themePreference';
105
+ value: Required<Pick<UpdatedUserPreferencesType, 'themePreference' | 'appTheme'>>;
106
+ } | {
107
+ path: 'pipelineRBACViewSelectedTab';
108
+ value: Required<Pick<UserPreferencesType, 'pipelineRBACViewSelectedTab'>>;
109
+ } | {
110
+ path: 'resources';
111
+ value: Required<BaseRecentlyVisitedEntitiesTypes[]>;
112
+ } | {
113
+ path: 'commandBar.recentNavigationActions';
114
+ value: UserPreferencesType['commandBar']['recentNavigationActions'];
115
+ });
88
116
  export type UserPreferenceResourceProps = UserPathValueMapType & {
89
117
  shouldThrowError?: boolean;
90
118
  userPreferencesResponse?: UserPreferencesType;
@@ -92,3 +120,4 @@ export type UserPreferenceResourceProps = UserPathValueMapType & {
92
120
  export interface UserPreferenceFilteredListTypes extends UserPreferenceRecentlyVisitedAppsTypes {
93
121
  userPreferencesResponse?: UserPreferencesType;
94
122
  }
123
+ export {};