import { selectInputOptionItemIncludesNeedle } from '../SelectInput.utils.mjs';
import { SelectInputOption } from '../Option/SelectInputOption.mjs';
import { SelectInputGroupItemView } from './GroupItemView/SelectInputGroupItemView.mjs';
import { jsx } from 'react/jsx-runtime';

function SelectInputItemView({
  item,
  renderValue,
  needle
}) {
  switch (item.type) {
    case 'option':
      {
        if (item.value != null && (needle == null || selectInputOptionItemIncludesNeedle(item, needle))) {
          return /*#__PURE__*/jsx(SelectInputOption, {
            value: item.value,
            disabled: item.disabled,
            children: renderValue(item.value, false)
          });
        }
        break;
      }
    case 'group':
      {
        return /*#__PURE__*/jsx(SelectInputGroupItemView, {
          item: item,
          renderValue: renderValue,
          needle: needle
        });
      }
    case 'separator':
      {
        if (needle == null) {
          return /*#__PURE__*/jsx("hr", {
            className: "np-select-input-separator-item"
          });
        }
        break;
      }
  }
  return null;
}

export { SelectInputItemView };
//# sourceMappingURL=SelectInputItemView.mjs.map
