2 days/nights are ok
If you have two nights in the Yellowstone park, you can visit most of the places.
You spend one day in low loop (Old failthful, Lake yellowstone) and one day in up loop (Mammoth and Canyan). Since it's summer, the sunset will be after 9:30pm so you have enough time to visit the most points.
One thing important to arrange your schedule: The drive from Salt Lake Airport to Grand Teton or Yellowstone is 6-7 hours. Don't miss your flight.
Also book the hotel ASAP since it's hot season.
