Skip to content

Commit da93ad7

Browse files
authored
Merge pull request #272 from devtron-labs/fix/select-picker-types
fix: typing for select picker and menu list renderer
2 parents 63a87cc + 6d7b508 commit da93ad7

File tree

6 files changed

+10
-13
lines changed

6 files changed

+10
-13
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.2.19",
3+
"version": "0.2.20",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Components/SelectPicker/FilterSelectPicker.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ const FilterSelectPicker = ({
4747
setSelectedOptions(structuredClone(appliedFilterOptions ?? []))
4848
}
4949

50-
const renderApplyButton = (optionsSelected: Parameters<FilterSelectPickerProps['handleApplyFilter']>[0]) => {
50+
const renderApplyButton = () => {
5151
const handleApplyClick = () => {
52-
handleApplyFilter(optionsSelected)
52+
handleApplyFilter(selectedOptions)
5353
closeMenu()
5454
}
5555

src/Shared/Components/SelectPicker/SelectPicker.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ import { SelectPickerOptionType, SelectPickerProps, SelectPickerVariantType } fr
181181
* />
182182
* ```
183183
*/
184-
const SelectPicker = <OptionValue extends string | number, IsMulti extends boolean>({
184+
const SelectPicker = <OptionValue, IsMulti extends boolean>({
185185
error,
186186
icon,
187187
helperText,

src/Shared/Components/SelectPicker/common.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,10 @@ export const SelectPickerOption = <OptionValue, IsMulti extends boolean>({
173173
)
174174
}
175175

176-
export const SelectPickerMenuList = <OptionValue extends string | number>(
177-
props: MenuListProps<SelectPickerOptionType<OptionValue>>,
178-
) => {
176+
export const SelectPickerMenuList = <OptionValue,>(props: MenuListProps<SelectPickerOptionType<OptionValue>>) => {
179177
const {
180178
children,
181-
selectProps: { inputValue, value, renderMenuListFooter, shouldRenderCustomOptions, renderCustomOptions },
179+
selectProps: { inputValue, renderMenuListFooter, shouldRenderCustomOptions, renderCustomOptions },
182180
} = props
183181

184182
return (
@@ -188,8 +186,7 @@ export const SelectPickerMenuList = <OptionValue extends string | number>(
188186
{/* Added to the bottom of menu list to prevent from hiding when the menu is opened close to the bottom of the screen */}
189187
{!shouldRenderCustomOptions && renderMenuListFooter && (
190188
<div className="dc__position-sticky dc__bottom-0 dc__bottom-radius-4 bcn-0 dc__zi-2">
191-
{/* Passing down value as a prop to ensure that the menu list is not re-rendered and scrolled to top on click */}
192-
{renderMenuListFooter(value)}
189+
{renderMenuListFooter()}
193190
</div>
194191
)}
195192
</components.MenuList>

src/Shared/Components/SelectPicker/type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ declare module 'react-select/base' {
4949
/**
5050
* Render function for the footer at the bottom of menu list. It is sticky by default
5151
*/
52-
renderMenuListFooter?: (selectedOptions: SelectProps<string | number, IsMulti>['value']) => ReactNode
52+
renderMenuListFooter?: () => ReactNode
5353
/**
5454
* If true, custom options are rendered in the menuList component of react select
5555
*

0 commit comments

Comments
 (0)