Morocco has named its first-ever female prime minister, and only the second woman to hold the position in the Arab world, following an election.