@devtron-labs/devtron-fe-common-lib 0.2.8-beta-1 → 0.2.9-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.
- package/dist/Shared/Components/SelectPicker/FilterSelectPicker.d.ts +4 -0
- package/dist/Shared/Components/SelectPicker/SelectPicker.component.d.ts +55 -1
- package/dist/Shared/Components/SelectPicker/common.d.ts +11 -8
- package/dist/Shared/Components/SelectPicker/index.d.ts +1 -0
- package/dist/Shared/Components/SelectPicker/type.d.ts +80 -7
- package/dist/Shared/Components/SelectPicker/utils.d.ts +5 -3
- package/dist/Shared/Components/index.d.ts +0 -1
- package/dist/Shared/types.d.ts +0 -1
- package/dist/assets/index.css +1 -1
- package/dist/{cssMode-865cd9aa.js → cssMode-d22ec408.js} +1 -1
- package/dist/{freemarker2-6ebe8432.js → freemarker2-c97960de.js} +1 -1
- package/dist/{handlebars-b7faeee6.js → handlebars-28d34f7b.js} +1 -1
- package/dist/{html-fe2f11b4.js → html-2e81eafd.js} +1 -1
- package/dist/{htmlMode-14fd66d2.js → htmlMode-5bb893d3.js} +1 -1
- package/dist/{index-f088f721.js → index-3202fe84.js} +42075 -37703
- package/dist/index.js +231 -231
- package/dist/{javascript-ec7e847a.js → javascript-6729e2a2.js} +1 -1
- package/dist/{jsonMode-327213cb.js → jsonMode-b5c0540e.js} +1 -1
- package/dist/{liquid-b9b5d544.js → liquid-d101eeb5.js} +1 -1
- package/dist/{mdx-c3efbd06.js → mdx-28bf186f.js} +1 -1
- package/dist/{python-056b8010.js → python-289bb1e6.js} +1 -1
- package/dist/{razor-abeae3b8.js → razor-7d96af87.js} +1 -1
- package/dist/{tsMode-aea366fd.js → tsMode-4861bc8e.js} +1 -1
- package/dist/{typescript-03aacbdb.js → typescript-24a5d676.js} +1 -1
- package/dist/{xml-8904f0be.js → xml-92ac673d.js} +1 -1
- package/dist/{yaml-e7fcdebe.js → yaml-8df71b8c.js} +1 -1
- package/package.json +5 -5
- package/dist/Shared/Components/TabGroup/TabGroup.component.d.ts +0 -3
- package/dist/Shared/Components/TabGroup/TabGroup.types.d.ts +0 -108
- package/dist/Shared/Components/TabGroup/index.d.ts +0 -2
|
@@ -80,6 +80,60 @@ 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
|
+
* ```
|
|
83
137
|
*/
|
|
84
|
-
declare const SelectPicker: ({ error, icon, renderMenuListFooter, helperText, placeholder, label, showSelectedOptionIcon, size, disabledTippyContent, showSelectedOptionsCount, menuSize, variant, ...props }: SelectPickerProps) => JSX.Element;
|
|
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;
|
|
85
139
|
export default SelectPicker;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { DropdownIndicatorProps, ControlProps, OptionProps, ClearIndicatorProps, ValueContainerProps, MenuListProps } from 'react-select';
|
|
2
|
-
import { SelectPickerOptionType, SelectPickerProps } from './type';
|
|
1
|
+
import { DropdownIndicatorProps, ControlProps, OptionProps, ClearIndicatorProps, ValueContainerProps, MenuListProps, MultiValueRemoveProps, MultiValueProps } from 'react-select';
|
|
2
|
+
import { SelectPickerGroupHeadingProps, SelectPickerOptionType, SelectPickerProps } from './type';
|
|
3
3
|
|
|
4
|
-
export declare const SelectPickerDropdownIndicator: (props: DropdownIndicatorProps<SelectPickerOptionType
|
|
5
|
-
export declare const SelectPickerClearIndicator: (props: ClearIndicatorProps<SelectPickerOptionType
|
|
6
|
-
export declare const SelectPickerControl: ({ icon, showSelectedOptionIcon, ...props }: ControlProps<SelectPickerOptionType
|
|
7
|
-
export declare const SelectPickerValueContainer: ({ showSelectedOptionsCount, ...props }: ValueContainerProps<SelectPickerOptionType
|
|
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;
|
|
8
8
|
export declare const SelectPickerLoadingIndicator: () => JSX.Element;
|
|
9
|
-
export declare const SelectPickerOption: ({ disableDescriptionEllipsis }:
|
|
10
|
-
export declare const SelectPickerMenuList: ({ renderMenuListFooter, ...props }: MenuListProps<SelectPickerOptionType
|
|
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;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { OptionType } from '../../../Common/Types';
|
|
2
2
|
import { ComponentSizeType } from '../../constants';
|
|
3
|
-
import { ReactElement, ReactNode } from 'react';
|
|
4
|
-
import { Props as ReactSelectProps } from 'react-select';
|
|
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';
|
|
5
6
|
|
|
6
|
-
export interface SelectPickerOptionType extends OptionType<
|
|
7
|
+
export interface SelectPickerOptionType<OptionValue = string | number> extends OptionType<OptionValue, ReactNode> {
|
|
7
8
|
/**
|
|
8
9
|
* Description to be displayed for the option
|
|
9
10
|
*/
|
|
@@ -19,10 +20,10 @@ export interface SelectPickerOptionType extends OptionType<number | string, Reac
|
|
|
19
20
|
}
|
|
20
21
|
export declare enum SelectPickerVariantType {
|
|
21
22
|
DEFAULT = "default",
|
|
22
|
-
|
|
23
|
+
BORDER_LESS = "border-less"
|
|
23
24
|
}
|
|
24
|
-
type SelectProps = ReactSelectProps<SelectPickerOptionType
|
|
25
|
-
export
|
|
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' | 'hideSelectedOptions' | 'controlShouldRenderValue' | 'closeMenuOnSelect' | 'isDisabled' | 'isLoading' | 'required' | 'isOptionDisabled' | 'placeholder' | 'menuPosition' | 'getOptionLabel' | 'getOptionValue' | 'isOptionSelected' | 'menuIsOpen' | 'onMenuOpen' | 'onMenuClose' | 'autoFocus'> & Required<Pick<SelectProps<OptionValue, IsMulti>, 'inputId'>> & {
|
|
26
27
|
/**
|
|
27
28
|
* Icon to be rendered in the control
|
|
28
29
|
*/
|
|
@@ -34,7 +35,7 @@ export interface SelectPickerProps extends Pick<SelectProps, 'options' | 'value'
|
|
|
34
35
|
/**
|
|
35
36
|
* Render function for the footer at the bottom of menu list. It is sticky by default
|
|
36
37
|
*/
|
|
37
|
-
renderMenuListFooter?: () => ReactNode;
|
|
38
|
+
renderMenuListFooter?: (selectedOptions: SelectProps<OptionValue, IsMulti>['value']) => ReactNode;
|
|
38
39
|
/**
|
|
39
40
|
* Info text for the select, if any
|
|
40
41
|
*/
|
|
@@ -50,6 +51,10 @@ export interface SelectPickerProps extends Pick<SelectProps, 'options' | 'value'
|
|
|
50
51
|
* @default 'true'
|
|
51
52
|
*/
|
|
52
53
|
showSelectedOptionIcon?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Custom selected options count for use cases like filters
|
|
56
|
+
*/
|
|
57
|
+
customSelectedOptionsCount?: number;
|
|
53
58
|
/**
|
|
54
59
|
* Height of the dropdown
|
|
55
60
|
*
|
|
@@ -86,5 +91,73 @@ export interface SelectPickerProps extends Pick<SelectProps, 'options' | 'value'
|
|
|
86
91
|
* @default false
|
|
87
92
|
*/
|
|
88
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;
|
|
89
162
|
}
|
|
90
163
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CHECKBOX_VALUE } from '../../../Common/Types';
|
|
2
|
+
import { GroupBase, MultiValue, OptionsOrGroups, StylesConfig } from 'react-select';
|
|
2
3
|
import { SelectPickerOptionType, SelectPickerProps } from './type';
|
|
3
4
|
|
|
4
|
-
export declare const getCommonSelectStyle: ({ error, size, menuSize, variant, }: Pick<SelectPickerProps,
|
|
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;
|
|
5
7
|
/**
|
|
6
8
|
* Retrieves an option from the options list based on the provided value.
|
|
7
9
|
*
|
|
@@ -10,4 +12,4 @@ export declare const getCommonSelectStyle: ({ error, size, menuSize, variant, }:
|
|
|
10
12
|
* @param defaultOption - The default option to return if no match is found.
|
|
11
13
|
* @returns The matched option or the default option if no match is found.
|
|
12
14
|
*/
|
|
13
|
-
export declare const getSelectPickerOptionByValue: (optionsList: OptionsOrGroups<SelectPickerOptionType
|
|
15
|
+
export declare const getSelectPickerOptionByValue: <OptionValue>(optionsList: OptionsOrGroups<SelectPickerOptionType<OptionValue>, GroupBase<SelectPickerOptionType<OptionValue>>>, value: OptionValue, defaultOption?: SelectPickerOptionType<OptionValue>) => SelectPickerOptionType<OptionValue>;
|