Get your taxes done using TurboTax

The repayment must be more than $3000--the amount of the check you write to your former employer.
 
Bonuses are withheld at a higher rate but at the end of the year they are taxed along with your regular income.  The credit amount, if you figure it manually, is whatever different the bonus made in the year you received it.  Because the tax rates were reduced, it is likely that your bonus might have been taxed at 15% or 25% last year, even though the tax rates are 12% and 22% this year.  Thats ok.  The amount of the credit is whatever extra tax you paid last year because of the bonus you are now repaying.

If you use the itemized deduction method, that probably automatically takes care of the state since your itemized deductions usually flow from federal to state (for most "conforming" states).  If you use the IRC1341 Claim of Right credit, that does not go to the state form.  You would have to ask your state or check their web site or instructions, to see what their procedure is (if they have one) for salary repayments.