A magnitude 7.7 earthquake has struck off the coast of Indonesia, triggering a tsunami warning for the region.