1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-28 23:07:13 -04:00

Improve typings for select options

This commit is contained in:
Bogdan
2025-04-18 12:11:55 +03:00
parent 9ef7c2a0b4
commit 3a55316ada
4 changed files with 44 additions and 44 deletions
+11 -16
View File
@@ -1,12 +1,17 @@
import classNames from 'classnames';
import React, { ChangeEvent, SyntheticEvent, useCallback } from 'react';
import React, {
ChangeEvent,
ComponentProps,
SyntheticEvent,
useCallback,
} from 'react';
import { InputChanged } from 'typings/inputs';
import styles from './SelectInput.css';
interface SelectInputOption {
key: string;
export interface SelectInputOption
extends Pick<ComponentProps<'option'>, 'disabled'> {
key: string | number;
value: string | number | (() => string | number);
isDisabled?: boolean;
}
interface SelectInputProps<T> {
@@ -62,20 +67,10 @@ function SelectInput<T>({
onBlur={onBlur}
>
{values.map((option) => {
const {
key,
value: optionValue,
isDisabled: optionIsDisabled = false,
...otherOptionProps
} = option;
const { key, value: optionValue, ...otherOptionProps } = option;
return (
<option
key={key}
value={key}
disabled={optionIsDisabled}
{...otherOptionProps}
>
<option key={key} value={key} {...otherOptionProps}>
{typeof optionValue === 'function' ? optionValue() : optionValue}
</option>
);