esc_js() is intended to be used for inline JS, inside a tag attribute.
For data inside a <script> tag use wp_json_encode().
<input type="text" onfocus="if( this.value == '<?php echo esc_js( $fields['input_text'] ); ?>' ) { this.value = ''; }" name="name"...