"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ItemContext = void 0;
exports.defaultItemValueExtractor = defaultItemValueExtractor;
exports.useItemContext = useItemContext;
var _react = require("react");
/**
 * Shared utilities for Select (native + web).
 */

// ---------------------------------------------------------------------------
// defaultItemValueExtractor
// ---------------------------------------------------------------------------

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

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

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