@devtron-labs/devtron-fe-common-lib 0.1.7 → 0.1.8-beta-1

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 (31) hide show
  1. package/dist/Common/Constants.d.ts +1 -0
  2. package/dist/Shared/Components/SelectPicker/SelectPicker.component.d.ts +85 -0
  3. package/dist/Shared/Components/SelectPicker/common.d.ts +10 -0
  4. package/dist/Shared/Components/SelectPicker/index.d.ts +2 -0
  5. package/dist/Shared/Components/SelectPicker/type.d.ts +74 -0
  6. package/dist/Shared/Components/SelectPicker/utils.d.ts +4 -0
  7. package/dist/Shared/Components/index.d.ts +1 -0
  8. package/dist/Shared/Hooks/UseDownload/UseDownload.d.ts +7 -0
  9. package/dist/Shared/Hooks/UseDownload/index.d.ts +2 -0
  10. package/dist/Shared/Hooks/UseDownload/service.d.ts +1 -0
  11. package/dist/Shared/Hooks/UseDownload/types.d.ts +5 -0
  12. package/dist/Shared/Hooks/index.d.ts +1 -0
  13. package/dist/Shared/constants.d.ts +8 -0
  14. package/dist/{cssMode-2977678b.js → cssMode-f2041000.js} +1 -1
  15. package/dist/{freemarker2-ed0eec7d.js → freemarker2-6d4da3dd.js} +1 -1
  16. package/dist/{handlebars-3abd8462.js → handlebars-c6090b95.js} +1 -1
  17. package/dist/{html-6dbbc2f9.js → html-9b18aef3.js} +1 -1
  18. package/dist/{htmlMode-1eb5fded.js → htmlMode-b79b819d.js} +1 -1
  19. package/dist/{index-628c18a8.js → index-a02e8b40.js} +21520 -21216
  20. package/dist/index.js +392 -389
  21. package/dist/{javascript-1b65b212.js → javascript-f0049b34.js} +1 -1
  22. package/dist/{jsonMode-0ea0e048.js → jsonMode-42a677c8.js} +1 -1
  23. package/dist/{liquid-e0bae7a8.js → liquid-8059c291.js} +1 -1
  24. package/dist/{mdx-3c1d3df7.js → mdx-4a7fcdf5.js} +1 -1
  25. package/dist/{python-f86872ea.js → python-33772baf.js} +1 -1
  26. package/dist/{razor-cc577f9e.js → razor-78c05948.js} +1 -1
  27. package/dist/{tsMode-5bbb1481.js → tsMode-f6f13eda.js} +1 -1
  28. package/dist/{typescript-56994d01.js → typescript-15389368.js} +1 -1
  29. package/dist/{xml-adb6a988.js → xml-bed45dad.js} +1 -1
  30. package/dist/{yaml-01419bec.js → yaml-4c66b731.js} +1 -1
  31. package/package.json +1 -1
@@ -228,6 +228,7 @@ export declare enum ReactSelectInputAction {
228
228
  export declare const ZERO_TIME_STRING = "0001-01-01T00:00:00Z";
229
229
  export declare const EXCLUDED_FALSY_VALUES: readonly [any, any, "", number];
230
230
  export declare const API_STATUS_CODES: {
231
+ OK: number;
231
232
  BAD_REQUEST: number;
232
233
  UNAUTHORIZED: number;
233
234
  PERMISSION_DENIED: number;
@@ -0,0 +1,85 @@
1
+ import { SelectPickerProps } from './type';
2
+
3
+ /**
4
+ * Generic component for select picker
5
+ *
6
+ * @example With icon in control
7
+ * ```tsx
8
+ * <SelectPicker ... icon={<CustomIcon />} />
9
+ * ```
10
+ *
11
+ * @example Medium menu list width
12
+ * ```tsx
13
+ * <SelectPicker ... menuSize={ComponentSizeType.medium} />
14
+ * ```
15
+ *
16
+ * @example Large menu list width
17
+ * ```tsx
18
+ * <SelectPicker ... menuSize={ComponentSizeType.large} />
19
+ * ```
20
+ *
21
+ * @example Required label
22
+ * ```tsx
23
+ * <SelectPicker ... required label="Label" />
24
+ * ```
25
+ *
26
+ * @example Custom label
27
+ * ```tsx
28
+ * <SelectPicker ... label={<div>Label</div>} />
29
+ * ```
30
+ *
31
+ * @example Error state
32
+ * ```tsx
33
+ * <SelectPicker ... error="Something went wrong" />
34
+ * ```
35
+ *
36
+ * @example Helper text
37
+ * ```tsx
38
+ * <SelectPicker ... helperText="Help information" />
39
+ * ```
40
+ *
41
+ * @example Menu list footer
42
+ * The footer is sticky by default
43
+ * ```tsx
44
+ * <SelectPicker
45
+ * ...
46
+ * renderMenuListFooter={() => (
47
+ * <div className="px-8 py-6 dc__border-top bcn-50 cn-6">
48
+ * <div>Foot note</div>
49
+ * </div>
50
+ * )}
51
+ * />
52
+ * ```
53
+ *
54
+ * @example Loading state
55
+ * ```tsx
56
+ * <SelectPicker ... isLoading />
57
+ * ```
58
+ *
59
+ * @example Disabled state
60
+ * ```tsx
61
+ * <SelectPicker ... isDisabled />
62
+ * ```
63
+ *
64
+ * @example Loading & disabled state
65
+ * ```tsx
66
+ * <SelectPicker ... isLoading isDisabled />
67
+ * ```
68
+ *
69
+ * @example Hide selected option icon in control
70
+ * ```tsx
71
+ * <SelectPicker ... showSelectedOptionIcon={false} />
72
+ * ```
73
+ *
74
+ * @example Selected option clearable
75
+ * ```tsx
76
+ * <SelectPicker ... isClearable />
77
+ * ```
78
+ *
79
+ * @example Selected option clearable
80
+ * ```tsx
81
+ * <SelectPicker ... showSelectedOptionsCount />
82
+ * ```
83
+ */
84
+ declare const SelectPicker: ({ error, icon, renderMenuListFooter, helperText, placeholder, label, showSelectedOptionIcon, size, disabledTippyContent, showSelectedOptionsCount, menuSize, ...props }: SelectPickerProps) => JSX.Element;
85
+ export default SelectPicker;
@@ -0,0 +1,10 @@
1
+ import { DropdownIndicatorProps, ControlProps, OptionProps, ClearIndicatorProps, ValueContainerProps, MenuListProps } from 'react-select';
2
+ import { SelectPickerOptionType, SelectPickerProps } from './type';
3
+
4
+ export declare const SelectPickerDropdownIndicator: (props: DropdownIndicatorProps<SelectPickerOptionType>) => JSX.Element;
5
+ export declare const SelectPickerClearIndicator: (props: ClearIndicatorProps<SelectPickerOptionType>) => JSX.Element;
6
+ export declare const SelectPickerControl: ({ icon, showSelectedOptionIcon, ...props }: ControlProps<SelectPickerOptionType> & Pick<SelectPickerProps, 'icon' | 'showSelectedOptionIcon'>) => JSX.Element;
7
+ export declare const SelectPickerValueContainer: ({ showSelectedOptionsCount, ...props }: ValueContainerProps<SelectPickerOptionType> & Pick<SelectPickerProps, 'showSelectedOptionsCount'>) => JSX.Element;
8
+ export declare const SelectPickerLoadingIndicator: () => JSX.Element;
9
+ export declare const SelectPickerOption: (props: OptionProps<SelectPickerOptionType>) => JSX.Element;
10
+ export declare const SelectPickerMenuList: ({ renderMenuListFooter, ...props }: MenuListProps<SelectPickerOptionType> & Pick<SelectPickerProps, 'renderMenuListFooter'>) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { default as SelectPicker } from './SelectPicker.component';
2
+ export * from './type';
@@ -0,0 +1,74 @@
1
+ import { OptionType } from '../../../Common/Types';
2
+ import { ComponentSizeType } from '../../constants';
3
+ import { ReactElement, ReactNode } from 'react';
4
+ import { Props as ReactSelectProps } from 'react-select';
5
+
6
+ export interface SelectPickerOptionType extends OptionType<number | string, ReactNode> {
7
+ /**
8
+ * Description to be displayed for the option
9
+ */
10
+ description?: string;
11
+ /**
12
+ * Icon at the start of the option
13
+ */
14
+ startIcon?: ReactElement;
15
+ /**
16
+ * Icon at the end of the option
17
+ */
18
+ endIcon?: ReactElement;
19
+ }
20
+ type SelectProps = ReactSelectProps<SelectPickerOptionType>;
21
+ export interface SelectPickerProps extends Pick<SelectProps, 'options' | 'value' | 'onChange' | 'isSearchable' | 'isClearable' | 'isLoading' | 'hideSelectedOptions' | 'controlShouldRenderValue' | 'closeMenuOnSelect' | 'isDisabled' | 'isLoading' | 'required' | 'isOptionDisabled' | 'placeholder'>, Required<Pick<SelectProps, 'classNamePrefix' | 'inputId' | 'name'>> {
22
+ /**
23
+ * Icon to be rendered in the control
24
+ */
25
+ icon?: ReactElement;
26
+ /**
27
+ * Error message for the select
28
+ */
29
+ error?: ReactNode;
30
+ /**
31
+ * Render function for the footer at the bottom of menu list. It is sticky by default
32
+ */
33
+ renderMenuListFooter?: () => ReactNode;
34
+ /**
35
+ * Info text for the select, if any
36
+ */
37
+ helperText?: ReactNode;
38
+ /**
39
+ * Label for the select. if required is added, the corresponding * is also added
40
+ */
41
+ label?: ReactNode;
42
+ /**
43
+ * If true, the selected option icon is shown in the container.
44
+ * startIcon has higher priority than endIcon.
45
+ *
46
+ * @default 'true'
47
+ */
48
+ showSelectedOptionIcon?: boolean;
49
+ /**
50
+ * Height of the dropdown
51
+ *
52
+ * @default 'ComponentSizeType.medium'
53
+ */
54
+ size?: Extract<ComponentSizeType, ComponentSizeType.medium | ComponentSizeType.large>;
55
+ /**
56
+ * Content to be shown in a tippy when disabled
57
+ */
58
+ disabledTippyContent?: ReactNode;
59
+ /**
60
+ * If true, the selected options count is shown in a chip inside ValueContainer
61
+ *
62
+ * @default 'false'
63
+ */
64
+ showSelectedOptionsCount?: boolean;
65
+ /**
66
+ * Width of the menu list
67
+ *
68
+ * Note: the overflow needs to be handled explicitly for non-small variants
69
+ *
70
+ * @default 'ComponentSizeType.small'
71
+ */
72
+ menuSize?: ComponentSizeType;
73
+ }
74
+ export {};
@@ -0,0 +1,4 @@
1
+ import { StylesConfig } from 'react-select';
2
+ import { SelectPickerOptionType, SelectPickerProps } from './type';
3
+
4
+ export declare const getCommonSelectStyle: ({ error, size, menuSize, }: Pick<SelectPickerProps, 'error' | 'size' | 'menuSize'>) => StylesConfig<SelectPickerOptionType>;
@@ -31,3 +31,4 @@ export * from './ArtifactInfoModal';
31
31
  export * from './MaterialHistory';
32
32
  export * from './IframeContainer';
33
33
  export * from './KeyValueTable';
34
+ export * from './SelectPicker';
@@ -0,0 +1,7 @@
1
+ import { HandleDownloadProps } from './types';
2
+
3
+ declare const useDownload: () => {
4
+ handleDownload: ({ downloadUrl, showFilePreparingToast, fileName, }: HandleDownloadProps) => Promise<void>;
5
+ isDownloading: boolean;
6
+ };
7
+ export default useDownload;
@@ -0,0 +1,2 @@
1
+ export { default as useDownload } from './UseDownload';
2
+ export * from './types';
@@ -0,0 +1 @@
1
+ export declare const getDownloadResponse: (downloadUrl: string) => Promise<Response>;
@@ -0,0 +1,5 @@
1
+ export interface HandleDownloadProps {
2
+ downloadUrl: string;
3
+ showFilePreparingToast?: boolean;
4
+ fileName?: string;
5
+ }
@@ -1 +1,2 @@
1
1
  export * from './UsePrompt';
2
+ export * from './UseDownload';
@@ -353,3 +353,11 @@ export declare enum K8sResourcePayloadAppType {
353
353
  HELM_APP = 1,
354
354
  EXTERNAL_ARGO_APP = 2
355
355
  }
356
+ /**
357
+ * Size variants for components
358
+ */
359
+ export declare enum ComponentSizeType {
360
+ small = "small",
361
+ medium = "medium",
362
+ large = "large"
363
+ }
@@ -1,7 +1,7 @@
1
1
  var Le = Object.defineProperty;
2
2
  var je = (e, n, i) => n in e ? Le(e, n, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[n] = i;
3
3
  var k = (e, n, i) => (je(e, typeof n != "symbol" ? n + "" : n, i), i);
4
- import { m as Ne } from "./index-628c18a8.js";
4
+ import { m as Ne } from "./index-a02e8b40.js";
5
5
  /*!-----------------------------------------------------------------------------
6
6
  * Copyright (c) Microsoft Corporation. All rights reserved.
7
7
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)
@@ -1,4 +1,4 @@
1
- import { m as F } from "./index-628c18a8.js";
1
+ import { m as F } from "./index-a02e8b40.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)
@@ -1,4 +1,4 @@
1
- import { m as i } from "./index-628c18a8.js";
1
+ import { m as i } from "./index-a02e8b40.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)
@@ -1,4 +1,4 @@
1
- import { m as d } from "./index-628c18a8.js";
1
+ import { m as d } from "./index-a02e8b40.js";
2
2
  /*!-----------------------------------------------------------------------------
3
3
  * Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)
@@ -1,7 +1,7 @@
1
1
  var $e = Object.defineProperty;
2
2
  var qe = (e, n, i) => n in e ? $e(e, n, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[n] = i;
3
3
  var k = (e, n, i) => (qe(e, typeof n != "symbol" ? n + "" : n, i), i);
4
- import { m as Qe } from "./index-628c18a8.js";
4
+ import { m as Qe } from "./index-a02e8b40.js";
5
5
  /*!-----------------------------------------------------------------------------
6
6
  * Copyright (c) Microsoft Corporation. All rights reserved.
7
7
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)