Donald Trump has essentially clinched the Republican nomination with his main rival Ted Cruz pulling out of the race.