import * as React from "react" import * as ReactDOM from "react-dom" import * as Types from "../../types" import {BaseElement} from "../BaseElement" import mergeClassNames from "classnames" import {Option} from "./Option" import {OptionGroup} from "./OptionGroup" export interface SelectProps extends Types.BluelibHTMLProps { onChange?: (event: React.ChangeEvent) => void, onSimpleChange?: (value: string) => void, value?: string, } export function Select({onChange, onSimpleChange, ...props}: SelectProps): JSX.Element { props.bluelibClassNames = mergeClassNames(props.bluelibClassNames, "input", "input-select") const onChangeWrapped = React.useCallback( event => { if(onChange) onChange(event) if(onSimpleChange) onSimpleChange(event.target.value) }, [onChange, onSimpleChange] ) return ( ) } Select.Option = Option Select.Group = OptionGroup