import { forwardRef } from "react";

/**
 * Select
 *
 * ghost:   boolean - removes border/background
 * invalid: boolean - applies invalid state
 */
const Select = forwardRef(function Select(
  { ghost = false, invalid = false, className = "", children, ...props },
  ref
) {
  const classes = [
    "prs-input",
    "prs-select",
    ghost && "prs-input-ghost",
    invalid && "prs-input_invalid",
    className,
  ]
    .filter(Boolean)
    .join(" ");

  return (
    <select ref={ref} className={classes} {...props}>
      {children}
    </select>
  );
});

export default Select;
