@devtron-labs/devtron-fe-common-lib 0.2.2-beta-15 → 0.2.2-beta-16

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 (28) hide show
  1. package/dist/Common/CodeEditor/types.d.ts +21 -2
  2. package/dist/Common/Tooltip/types.d.ts +4 -14
  3. package/dist/Common/Types.d.ts +1 -0
  4. package/dist/Shared/Components/SelectPicker/SelectPicker.component.d.ts +1 -55
  5. package/dist/Shared/Components/SelectPicker/common.d.ts +8 -11
  6. package/dist/Shared/Components/SelectPicker/index.d.ts +0 -2
  7. package/dist/Shared/Components/SelectPicker/type.d.ts +6 -95
  8. package/dist/Shared/Components/SelectPicker/utils.d.ts +2 -13
  9. package/dist/assets/index.css +1 -1
  10. package/dist/{cssMode-79cf08a3.js → cssMode-cc05e42c.js} +1 -1
  11. package/dist/{freemarker2-453bbf21.js → freemarker2-f038f34b.js} +1 -1
  12. package/dist/{handlebars-0c665205.js → handlebars-d17aff7a.js} +1 -1
  13. package/dist/{html-6e3cbbc7.js → html-abdc7632.js} +1 -1
  14. package/dist/{htmlMode-a8206d99.js → htmlMode-241ea80b.js} +1 -1
  15. package/dist/{index-38725b26.js → index-3b90d008.js} +37477 -41988
  16. package/dist/index.js +353 -356
  17. package/dist/{javascript-7eee0e52.js → javascript-3b51ab44.js} +1 -1
  18. package/dist/{jsonMode-a3c4da82.js → jsonMode-6def590c.js} +1 -1
  19. package/dist/{liquid-63e5b997.js → liquid-780f4ccf.js} +1 -1
  20. package/dist/{mdx-9f100657.js → mdx-d24ff632.js} +1 -1
  21. package/dist/{python-b3af8c42.js → python-ff494aef.js} +1 -1
  22. package/dist/{razor-f2c34363.js → razor-b8dd0e97.js} +1 -1
  23. package/dist/{tsMode-4fe88a41.js → tsMode-5243b163.js} +1 -1
  24. package/dist/{typescript-a5364e45.js → typescript-f8b182ca.js} +1 -1
  25. package/dist/{xml-ef45bc46.js → xml-e016fbb8.js} +1 -1
  26. package/dist/{yaml-c4ceccb8.js → yaml-1cf2e58c.js} +1 -1
  27. package/package.json +5 -5
  28. package/dist/Shared/Components/SelectPicker/FilterSelectPicker.d.ts +0 -4
@@ -1,3 +1,4 @@
1
+ import { XORProps } from '../Types';
1
2
  import { MODES } from '../Constants';
2
3
 
3
4
  export interface InformationBarProps {
@@ -5,7 +6,7 @@ export interface InformationBarProps {
5
6
  className?: string;
6
7
  children?: React.ReactNode;
7
8
  }
8
- export interface CodeEditorInterface {
9
+ interface CodeEditorBaseInterface {
9
10
  value?: string;
10
11
  lineDecorationsWidth?: number;
11
12
  responseType?: string;
@@ -19,7 +20,6 @@ export interface CodeEditorInterface {
19
20
  readOnly?: boolean;
20
21
  noParsing?: boolean;
21
22
  inline?: boolean;
22
- height?: number | string;
23
23
  shebang?: string | JSX.Element;
24
24
  diffView?: boolean;
25
25
  loading?: boolean;
@@ -31,7 +31,25 @@ export interface CodeEditorInterface {
31
31
  isKubernetes?: boolean;
32
32
  cleanData?: boolean;
33
33
  chartVersion?: any;
34
+ /**
35
+ * Defines the minHeight of MonacoEditor in pixels or relative units
36
+ * @default 300
37
+ */
38
+ minHeight?: number | string;
34
39
  }
40
+ interface CodeEditorXORProps {
41
+ /**
42
+ * Defines the height of MonacoEditor in pixels or relative units
43
+ * @default 300
44
+ */
45
+ height: number | string;
46
+ /**
47
+ * If adjustEditorHeightToContent is true the Editor grows and shrinks by its content's height
48
+ * @default false
49
+ */
50
+ adjustEditorHeightToContent: boolean;
51
+ }
52
+ export type CodeEditorInterface = CodeEditorBaseInterface & XORProps<'height', 'adjustEditorHeightToContent', CodeEditorXORProps>;
35
53
  export interface CodeEditorHeaderInterface {
36
54
  children?: any;
37
55
  className?: string;
@@ -84,3 +102,4 @@ export declare enum CodeEditorActionTypes {
84
102
  overrideLoading = "overrideLoading",
85
103
  success = "success"
86
104
  }
105
+ export {};
@@ -1,3 +1,4 @@
1
+ import { XORProps } from '../Types';
1
2
  import { TippyProps } from '@tippyjs/react';
2
3
 
3
4
  type BaseTooltipProps = {
@@ -5,25 +6,14 @@ type BaseTooltipProps = {
5
6
  * If true, show tippy on truncate
6
7
  * @default true
7
8
  */
8
- showOnTruncate?: boolean;
9
+ showOnTruncate: boolean;
9
10
  /**
10
11
  * If showOnTruncate is defined this prop doesn't work
11
12
  * @default false
12
13
  */
13
- alwaysShowTippyOnHover?: never;
14
- } | {
15
- /**
16
- * If alwaysShowTippyOnHover is defined this prop doesn't work
17
- * @default false
18
- */
19
- showOnTruncate?: never;
20
- /**
21
- * If true, wrap with tippy irrespective of other options
22
- * @default false
23
- */
24
- alwaysShowTippyOnHover?: boolean;
14
+ alwaysShowTippyOnHover: boolean;
25
15
  };
26
- export type TooltipProps = BaseTooltipProps & TippyProps & {
16
+ export type TooltipProps = XORProps<'showOnTruncate', 'alwaysShowTippyOnHover', BaseTooltipProps> & TippyProps & {
27
17
  /**
28
18
  * If true, apply dc__word-break-all
29
19
  * @default true
@@ -816,4 +816,5 @@ export interface EnvironmentHelmResult {
816
816
  allowedDeploymentTypes?: DeploymentAppTypes[];
817
817
  }
818
818
  export type EnvironmentListHelmResponse = ResponseType<EnvironmentListHelmResult[]>;
819
+ export type XORProps<P extends string, S extends string, T extends Record<P | S, any>> = (Partial<Record<P, never>> & Partial<Record<S, T[S]>>) | (Partial<Record<P, T[P]>> & Partial<Record<S, never>>);
819
820
  export {};
@@ -80,60 +80,6 @@ import { SelectPickerProps } from './type';
80
80
  * ```tsx
81
81
  * <SelectPicker ... showSelectedOptionsCount />
82
82
  * ```
83
- * @example Multi Select
84
- * ```tsx
85
- * <SelectPicker ... isMulti />
86
- * ```
87
- *
88
- * @example Creatable Multi Select
89
- * ```tsx
90
- * <SelectPicker
91
- * ...
92
- * isMulti
93
- * multiSelectProps={{
94
- * isCreatable: true
95
- * }}
96
- * />
97
- * ```
98
- *
99
- * @example Multi Select with group heading selectable
100
- * ```tsx
101
- * <SelectPicker
102
- * ...
103
- * isMulti
104
- * multiSelectProps={{
105
- * isGroupHeadingSelectable: true
106
- * }}
107
- * />
108
- * ```
109
- *
110
- * @example Multi Select with selected option validator
111
- * ```tsx
112
- * <SelectPicker
113
- * ...
114
- * isMulti
115
- * multiSelectProps={{
116
- * getIsOptionValid: (option) => boolean
117
- * }}
118
- * />
119
- * ```
120
- *
121
- * @example Custom options rendering support (menuIsOpen needs to be handled by consumer)
122
- * ```tsx
123
- * <SelectPicker
124
- * ...
125
- * shouldRenderCustomOptions
126
- * renderCustomOptions={() => <div />}
127
- * />
128
- * ```
129
- *
130
- * @example Align the menu at the right most end
131
- * ```tsx
132
- * <SelectPicker
133
- * ...
134
- * shouldMenuAlignRight
135
- * />
136
- * ```
137
83
  */
138
- declare const SelectPicker: <OptionValue, IsMulti extends boolean>({ error, icon, renderMenuListFooter, helperText, placeholder, label, showSelectedOptionIcon, size, disabledTippyContent, showSelectedOptionsCount, menuSize, menuPosition, variant, disableDescriptionEllipsis, multiSelectProps, isMulti, name, classNamePrefix, renderCustomOptions, shouldRenderCustomOptions, isSearchable, selectRef, shouldMenuAlignRight, fullWidth, customSelectedOptionsCount, ...props }: SelectPickerProps<OptionValue, IsMulti>) => JSX.Element;
84
+ declare const SelectPicker: ({ error, icon, renderMenuListFooter, helperText, placeholder, label, showSelectedOptionIcon, size, disabledTippyContent, showSelectedOptionsCount, menuSize, ...props }: SelectPickerProps) => JSX.Element;
139
85
  export default SelectPicker;
@@ -1,13 +1,10 @@
1
- import { DropdownIndicatorProps, ControlProps, OptionProps, ClearIndicatorProps, ValueContainerProps, MenuListProps, MultiValueRemoveProps, MultiValueProps } from 'react-select';
2
- import { SelectPickerGroupHeadingProps, SelectPickerOptionType, SelectPickerProps } from './type';
1
+ import { DropdownIndicatorProps, ControlProps, OptionProps, ClearIndicatorProps, ValueContainerProps, MenuListProps } from 'react-select';
2
+ import { SelectPickerOptionType, SelectPickerProps } from './type';
3
3
 
4
- export declare const SelectPickerDropdownIndicator: <OptionValue>(props: DropdownIndicatorProps<SelectPickerOptionType<OptionValue>, boolean, import('react-select').GroupBase<SelectPickerOptionType<OptionValue>>>) => JSX.Element;
5
- export declare const SelectPickerClearIndicator: <OptionValue>(props: ClearIndicatorProps<SelectPickerOptionType<OptionValue>, boolean, import('react-select').GroupBase<SelectPickerOptionType<OptionValue>>>) => JSX.Element;
6
- export declare const SelectPickerControl: <OptionValue, IsMulti extends boolean>({ icon, showSelectedOptionIcon, ...props }: ControlProps<SelectPickerOptionType<OptionValue>, boolean, import('react-select').GroupBase<SelectPickerOptionType<OptionValue>>> & Pick<SelectPickerProps<OptionValue, IsMulti>, "icon" | "showSelectedOptionIcon">) => JSX.Element;
7
- export declare const SelectPickerValueContainer: <OptionValue, IsMulti extends boolean>({ showSelectedOptionsCount, customSelectedOptionsCount, ...props }: ValueContainerProps<SelectPickerOptionType<OptionValue>, boolean, import('react-select').GroupBase<SelectPickerOptionType<OptionValue>>> & Pick<SelectPickerProps<OptionValue, IsMulti>, "customSelectedOptionsCount" | "showSelectedOptionsCount">) => JSX.Element;
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
8
  export declare const SelectPickerLoadingIndicator: () => JSX.Element;
9
- export declare const SelectPickerOption: <OptionValue, IsMulti extends boolean>({ disableDescriptionEllipsis, ...props }: OptionProps<SelectPickerOptionType<OptionValue>, boolean, import('react-select').GroupBase<SelectPickerOptionType<OptionValue>>> & Pick<SelectPickerProps<OptionValue, IsMulti>, "disableDescriptionEllipsis">) => JSX.Element;
10
- export declare const SelectPickerMenuList: <OptionValue, IsMulti extends boolean>({ renderMenuListFooter, shouldRenderCustomOptions, renderCustomOptions, ...props }: MenuListProps<SelectPickerOptionType<OptionValue>, boolean, import('react-select').GroupBase<SelectPickerOptionType<OptionValue>>> & Pick<SelectPickerProps<OptionValue, IsMulti>, "renderMenuListFooter" | "shouldRenderCustomOptions" | "renderCustomOptions">) => JSX.Element;
11
- export declare const SelectPickerMultiValueLabel: <OptionValue, IsMulti extends boolean>({ getIsOptionValid, ...props }: MultiValueProps<SelectPickerOptionType<OptionValue>, true, import('react-select').GroupBase<SelectPickerOptionType<OptionValue>>> & Pick<SelectPickerProps<OptionValue, IsMulti>["multiSelectProps"], "getIsOptionValid">) => JSX.Element;
12
- export declare const SelectPickerMultiValueRemove: (props: MultiValueRemoveProps) => JSX.Element;
13
- export declare const SelectPickerGroupHeading: <OptionValue>({ isGroupHeadingSelectable, ...props }: SelectPickerGroupHeadingProps<OptionValue>) => 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;
@@ -1,4 +1,2 @@
1
1
  export { default as SelectPicker } from './SelectPicker.component';
2
- export { default as FilterSelectPicker } from './FilterSelectPicker';
3
2
  export * from './type';
4
- export { getSelectPickerOptionByValue } from './utils';
@@ -1,10 +1,9 @@
1
1
  import { OptionType } from '../../../Common/Types';
2
2
  import { ComponentSizeType } from '../../constants';
3
- import { MutableRefObject, ReactElement, ReactNode } from 'react';
4
- import { GroupBase, GroupHeadingProps, Props as ReactSelectProps, SelectInstance } from 'react-select';
5
- import { CreatableProps } from 'react-select/creatable';
3
+ import { ReactElement, ReactNode } from 'react';
4
+ import { Props as ReactSelectProps } from 'react-select';
6
5
 
7
- export interface SelectPickerOptionType<OptionValue = string | number> extends OptionType<OptionValue, ReactNode> {
6
+ export interface SelectPickerOptionType extends OptionType<number | string, ReactNode> {
8
7
  /**
9
8
  * Description to be displayed for the option
10
9
  */
@@ -18,12 +17,8 @@ export interface SelectPickerOptionType<OptionValue = string | number> extends O
18
17
  */
19
18
  endIcon?: ReactElement;
20
19
  }
21
- export declare enum SelectPickerVariantType {
22
- DEFAULT = "default",
23
- BORDER_LESS = "border-less"
24
- }
25
- type SelectProps<OptionValue, IsMulti extends boolean> = ReactSelectProps<SelectPickerOptionType<OptionValue>, IsMulti, GroupBase<SelectPickerOptionType<OptionValue>>>;
26
- export type SelectPickerProps<OptionValue = number | string, IsMulti extends boolean = false> = Pick<SelectProps<OptionValue, IsMulti>, 'name' | 'classNamePrefix' | 'options' | 'value' | 'onChange' | 'isSearchable' | 'isClearable' | 'isLoading' | 'hideSelectedOptions' | 'controlShouldRenderValue' | 'closeMenuOnSelect' | 'isDisabled' | 'isLoading' | 'required' | 'isOptionDisabled' | 'placeholder' | 'menuPosition' | 'getOptionLabel' | 'getOptionValue' | 'isOptionSelected' | 'menuIsOpen' | 'onMenuOpen' | 'onMenuClose' | 'autoFocus'> & Required<Pick<SelectProps<OptionValue, IsMulti>, 'inputId'>> & {
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'>> {
27
22
  /**
28
23
  * Icon to be rendered in the control
29
24
  */
@@ -35,7 +30,7 @@ export type SelectPickerProps<OptionValue = number | string, IsMulti extends boo
35
30
  /**
36
31
  * Render function for the footer at the bottom of menu list. It is sticky by default
37
32
  */
38
- renderMenuListFooter?: (selectedOptions: SelectProps<OptionValue, IsMulti>['value']) => ReactNode;
33
+ renderMenuListFooter?: () => ReactNode;
39
34
  /**
40
35
  * Info text for the select, if any
41
36
  */
@@ -51,10 +46,6 @@ export type SelectPickerProps<OptionValue = number | string, IsMulti extends boo
51
46
  * @default 'true'
52
47
  */
53
48
  showSelectedOptionIcon?: boolean;
54
- /**
55
- * Custom selected options count for use cases like filters
56
- */
57
- customSelectedOptionsCount?: number;
58
49
  /**
59
50
  * Height of the dropdown
60
51
  *
@@ -79,85 +70,5 @@ export type SelectPickerProps<OptionValue = number | string, IsMulti extends boo
79
70
  * @default 'ComponentSizeType.small'
80
71
  */
81
72
  menuSize?: ComponentSizeType;
82
- /**
83
- * Variant of the select.
84
- *
85
- * @default SelectPickerVariantType.DEFAULT
86
- */
87
- variant?: SelectPickerVariantType;
88
- /**
89
- * Disables the ellipsis on description, it will be shown in full width, wrapped if required.
90
- *
91
- * @default false
92
- */
93
- disableDescriptionEllipsis?: boolean;
94
- /**
95
- * Ref for the select picker
96
- */
97
- selectRef?: IsMulti extends true ? MutableRefObject<SelectInstance<SelectPickerOptionType<OptionValue>, true>> : MutableRefObject<SelectInstance<SelectPickerOptionType<OptionValue>>>;
98
- /**
99
- * If true, the menu is aligned at the right end to prevent going outside of viewport
100
- * in case of menu being larger than the control
101
- *
102
- * @default false
103
- */
104
- shouldMenuAlignRight?: boolean;
105
- /**
106
- * If true, the select spans to the max available width
107
- *
108
- * @default false
109
- */
110
- fullWidth?: boolean;
111
- } & (IsMulti extends true ? {
112
- isMulti: IsMulti | boolean;
113
- multiSelectProps?: Pick<CreatableProps<SelectPickerOptionType<OptionValue>, true, GroupBase<SelectPickerOptionType<OptionValue>>>, 'onCreateOption'> & {
114
- /**
115
- * If true, the select picker creates the new option
116
- * Only applicable for IsMulti: true
117
- *
118
- * @default false
119
- */
120
- isCreatable?: boolean;
121
- /**
122
- * If true, the group heading can be selected
123
- *
124
- * Only applicable for IsMulti: true
125
- *
126
- * @default false
127
- */
128
- isGroupHeadingSelectable?: boolean;
129
- /**
130
- * Callback handler to check if the given selection is valid or not
131
- */
132
- getIsOptionValid?: (option: SelectPickerOptionType<OptionValue>) => boolean;
133
- };
134
- } : {
135
- isMulti?: never;
136
- multiSelectProps?: never;
137
- }) & ({
138
- /**
139
- * If true, custom options are rendered in the menuList component of react select
140
- *
141
- * Note: renderCustomOptions is required to be passed; renderMenuListFooter is also not called
142
- *
143
- * @default false
144
- */
145
- shouldRenderCustomOptions: boolean;
146
- /**
147
- * Callback handler for custom options
148
- *
149
- * Imp Note: The menu open/close needs to handled by the consumer in this case
150
- */
151
- renderCustomOptions: () => ReactElement;
152
- } | {
153
- shouldRenderCustomOptions?: never;
154
- renderCustomOptions?: never;
155
- });
156
- export type SelectPickerGroupHeadingProps<OptionValue> = GroupHeadingProps<SelectPickerOptionType<OptionValue>> & {
157
- isGroupHeadingSelectable: boolean;
158
- };
159
- export interface FilterSelectPickerProps extends Required<Pick<SelectPickerProps<number | string, true>, 'options' | 'isDisabled' | 'placeholder' | 'isLoading'>>, Pick<SelectPickerProps<number | string, true>, 'selectRef' | 'inputId' | 'menuPosition' | 'autoFocus' | 'shouldMenuAlignRight'> {
160
- appliedFilterOptions: SelectPickerProps<number | string, true>['options'];
161
- handleApplyFilter: (filtersToApply: SelectPickerOptionType<number | string>[]) => void;
162
73
  }
163
74
  export {};
@@ -1,15 +1,4 @@
1
- import { CHECKBOX_VALUE } from '../../../Common/Types';
2
- import { GroupBase, MultiValue, OptionsOrGroups, StylesConfig } from 'react-select';
1
+ import { StylesConfig } from 'react-select';
3
2
  import { SelectPickerOptionType, SelectPickerProps } from './type';
4
3
 
5
- export declare const getCommonSelectStyle: <OptionValue, IsMulti extends boolean>({ error, size, menuSize, variant, getIsOptionValid, isGroupHeadingSelectable, shouldMenuAlignRight, }: Pick<SelectPickerProps<OptionValue, IsMulti>, "error" | "size" | "shouldMenuAlignRight" | "menuSize" | "variant"> & Pick<SelectPickerProps<OptionValue, IsMulti>["multiSelectProps"], "getIsOptionValid" | "isGroupHeadingSelectable">) => StylesConfig<SelectPickerOptionType<OptionValue>, boolean, GroupBase<SelectPickerOptionType<OptionValue>>>;
6
- export declare const getGroupCheckboxValue: <OptionValue>(groupHeadingOptions: readonly SelectPickerOptionType<OptionValue>[], selectedOptions: MultiValue<SelectPickerOptionType<OptionValue>>, getOptionValue: (option: SelectPickerOptionType<OptionValue>) => string) => CHECKBOX_VALUE.CHECKED | CHECKBOX_VALUE.INTERMEDIATE;
7
- /**
8
- * Retrieves an option from the options list based on the provided value.
9
- *
10
- * @param optionsList - The list of options or groups of options.
11
- * @param value - The value to compare against the options' values.
12
- * @param defaultOption - The default option to return if no match is found.
13
- * @returns The matched option or the default option if no match is found.
14
- */
15
- export declare const getSelectPickerOptionByValue: <OptionValue>(optionsList: OptionsOrGroups<SelectPickerOptionType<OptionValue>, GroupBase<SelectPickerOptionType<OptionValue>>>, value: string | number, defaultOption?: SelectPickerOptionType<OptionValue>) => SelectPickerOptionType<OptionValue>;
4
+ export declare const getCommonSelectStyle: ({ error, size, menuSize, }: Pick<SelectPickerProps, 'error' | 'size' | 'menuSize'>) => StylesConfig<SelectPickerOptionType>;