"use strict";

/**
 * Shared utilities for Select (native + web).
 */
import { createContext, useContext } from 'react';
// ---------------------------------------------------------------------------
// defaultItemValueExtractor
// ---------------------------------------------------------------------------

export function defaultItemValueExtractor(item) {
  if (item != null && typeof item === 'object' && 'value' in item) {
    return String(item.value);
  }
  return String(item);
}

// ---------------------------------------------------------------------------
// Item context
// ---------------------------------------------------------------------------

export const ItemContext = /*#__PURE__*/createContext({
  selected: false,
  hovered: false,
  focused: false,
  pressed: false
});
ItemContext.displayName = 'SelectItemContext';
export function useItemContext() {
  return useContext(ItemContext);
}
//# sourceMappingURL=common.js.map