ومن جمع بين حر وعبد أو شاة ذكية وميتة بطل البيع فيهما ومن جمع بين عبد ومدبر أو عبده وعبد غيره صح العقد في العبد بحصته من الثمن
Translation: A combined sale of a free person with an enslaved person, or lawful slaughtered meat with carrion, is void in both parts; historically, a sale combining a saleable enslaved person with a mudabbar or another owner’s slave can be valid for the lawful share at its apportioned price.
This concerns mixed lawful and unlawful components in one single transaction. The text does not give one universal answer for all mixtures.
For the first combinations it states that the sale is void in both components; for the later historical combinations it recognizes a valid apportioned share.
The slavery scenarios describe historical law, not present-day permitted dealings. The technical lesson is that partial validity depends on the legal structure of the combined sale.