~12VDC+ Automatic Dimmer Switches
The device you show is connected directly to the battery (well. through a fuse) so it always has power. The door switch that normally powers the light is now just an input to to this circuit. It probably has a small microcontroller which turns on the light when it sees the door switch close (door opens) and does a delayed fadeout when it sees the door switch open.

As @WesleyLee noted in his comment, a capacitor that could keep a 10W light lit for 30 seconds would be prohibitively large and expensive.