import React, { createContext, useContext } from 'react';
var SelectContext = createContext(undefined);
function SelectProvider(_ref) {
  var children = _ref.children,
    getButtonProps = _ref.getButtonProps,
    getOptionMetadata = _ref.getOptionMetadata,
    value = _ref.value;
  return React.createElement(SelectContext.Provider, {
    value: {
      getButtonProps: getButtonProps,
      getOptionMetadata: getOptionMetadata,
      value: value
    }
  }, children);
}
function useSelect() {
  var context = useContext(SelectContext);
  if (context === undefined) {
    throw new Error('useSelect must be used within a SelectProvider');
  }
  return context;
}
export { SelectProvider, useSelect };