Hysteresis operators in metric spaces