import { SearchInput } from "./SearchInput.js";
import { useCommonStyles } from "./useCommonStyles.js";
import { useStateManager } from "react-select";
const useCommonReactSelectProps = ({
  reactSelectProps,
  placeholder,
  data,
  isInvalid,
  onSearch
}) => {
  const styles = useCommonStyles(isInvalid);
  const reactSelectState = useStateManager({
    onInputChange: onSearch,
    onFocus: (e) => {
      onSearch?.(e.target.value);
    }
  });
  return {
    ...reactSelectProps,
    ...reactSelectState,
    placeholder,
    styles,
    options: data,
    getOptionValue: (datum) => datum.key,
    components: {
      Input: SearchInput
    },
    filterOption: () => true
  };
};
export { useCommonReactSelectProps };
//# sourceMappingURL=useCommonReactSelectProps.js.map
