import type { ComponentPropsWithRef } from 'react'; import { theme } from 'antd'; import './NativeSelect.css'; export interface NativeSelectProps extends Omit< ComponentPropsWithRef<'select'>, 'value' | 'defaultValue' | 'onChange' | 'multiple' | 'children' | 'size' > { value?: Value | null; onChange?: (value: Value) => void; options: readonly { value: Value; label: string | number; disabled?: boolean }[]; placeholder?: string; size?: 'small' | 'middle' | 'large'; } export function NativeSelect({ value, options, onChange, placeholder, disabled, className, style, size, ...props }: NativeSelectProps) { const { token } = theme.useToken(); const selected = options.findIndex((option) => Object.is(option.value, value)); const hasUnlistedValue = selected < 0 && value != null; return ( ); }