mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 22:27:16 +01:00
Replace render function children with mapped ListItem elements and remove the unsupported items prop across all Select instances. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
33 lines
888 B
TypeScript
33 lines
888 B
TypeScript
import { ListItem, Select } from '@umami/react-zen';
|
|
import { useState } from 'react';
|
|
import { useMessages } from '@/components/hooks';
|
|
import { CURRENCIES } from '@/lib/constants';
|
|
|
|
export function CurrencySelect({ value, onChange }) {
|
|
const { formatMessage, labels } = useMessages();
|
|
const [search, setSearch] = useState('');
|
|
|
|
return (
|
|
<Select
|
|
label={formatMessage(labels.currency)}
|
|
value={value}
|
|
defaultValue={value}
|
|
onChange={onChange}
|
|
listProps={{ style: { maxHeight: 300 } }}
|
|
onSearch={setSearch}
|
|
allowSearch
|
|
>
|
|
{CURRENCIES.map(({ id, name }) => {
|
|
if (search && !`${id}${name}`.toLowerCase().includes(search)) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<ListItem key={id} id={id}>
|
|
{id} — {name}
|
|
</ListItem>
|
|
);
|
|
}).filter(n => n)}
|
|
</Select>
|
|
);
|
|
}
|