Spin-polarized light-emitting diodes and lasers