import ReactSelect, { components, GroupBase, InputProps, Props } from "react-select"; import classNames from "@calcom/lib/classNames"; export type SelectProps< Option, IsMulti extends boolean = false, Group extends GroupBase = GroupBase > = Props; export const InputComponent = >({ inputClassName, ...props }: InputProps) => { return ( ); }; function Select< Option, IsMulti extends boolean = false, Group extends GroupBase = GroupBase >({ className, ...props }: SelectProps) { return ( ({ ...theme, borderRadius: 2, colors: { ...theme.colors, primary: "var(--brand-color)", primary50: "rgba(209 , 213, 219, var(--tw-bg-opacity))", primary25: "rgba(244, 245, 246, var(--tw-bg-opacity))", }, })} styles={{ option: (provided, state) => ({ ...provided, color: state.isSelected ? "var(--brand-text-color)" : "black", ":active": { backgroundColor: state.isSelected ? "" : "var(--brand-color)", color: "var(--brand-text-color)", }, }), }} components={{ ...components, IndicatorSeparator: () => null, Input: InputComponent, }} className={className} {...props} /> ); } export default Select; export function UnstyledSelect< Option, IsMulti extends boolean = false, Group extends GroupBase = GroupBase >({ className, ...props }: SelectProps) { return ( ({ ...theme, borderRadius: 0, border: "none" })} components={{ IndicatorSeparator: () => null, Input: InputComponent, }} styles={{ container: (provided) => ({ ...provided, width: "100%", }), control: (provided) => ({ ...provided, backgroundColor: " transparent", border: "none", boxShadow: "none", }), option: (provided, state) => ({ ...provided, color: state.isSelected ? "var(--brand-text-color)" : "black", ":active": { backgroundColor: state.isSelected ? "" : "var(--brand-color)", color: "var(--brand-text-color)", }, }), indicatorSeparator: () => ({ display: "hidden", color: "black", }), }} /> ); }