Portal/rsconcept/frontend/src/features/library/components/select-library-item.tsx

28 lines
795 B
TypeScript
Raw Normal View History

2025-04-13 22:28:28 +03:00
import { ComboBox } from '@/components/input/combo-box';
2025-02-20 20:22:05 +03:00
import { type Styling } from '@/components/props';
2025-02-20 20:22:05 +03:00
import { type ILibraryItem } from '../backend/types';
2025-02-20 20:22:05 +03:00
interface SelectLibraryItemProps extends Styling {
2025-04-10 11:03:55 +03:00
id?: string;
value: ILibraryItem | null;
onChange: (newValue: ILibraryItem | null) => void;
items?: ILibraryItem[];
placeholder?: string;
noBorder?: boolean;
}
2025-04-11 19:59:08 +03:00
export function SelectLibraryItem({ items, placeholder = 'Выберите схему', ...restProps }: SelectLibraryItemProps) {
return (
2025-04-11 19:59:08 +03:00
<ComboBox
items={items}
placeholder={placeholder}
idFunc={item => String(item.id)}
labelValueFunc={item => `${item.alias}: ${item.title}`}
labelOptionFunc={item => `${item.alias}: ${item.title}`}
{...restProps}
/>
);
}