class_docstr: Either shows a dropdown or a free text input field for selecting an index
class_docstr_tok: ["Either","shows","a","dropdown","or","a","free","text","input","field","for","selecting","an","index"]
code: def component_callbacks(self, app):
      if self.index_dropdown:
          if (
              len(self.explainer.get_index_list())
              > self.max_idxs_in_dropdown
          ):
  
              @app.callback(
                  Output(self.name, "options"),
                  Input(self.name, "search_value"),
                  Input(self.name, "value"),
              )
              def update_options(search_value, index):
                  trigger_props = [
                      trigger["prop_id"].split(".")[-1]
                      for trigger in dash.callback_context.triggered
                  ]
                  if "value" in trigger_props or not search_value:
                      new_options = [index] if index is not None else []
                  else:
                      new_options = [
                          idx
                          for idx in self.explainer.get_index_list()
                          if (str(search_value) in idx)
                          or (idx == str(index))
                      ]
                  return new_options[: self.max_idxs_in_dropdown]
  
      else:
  
          @app.callback(
              [
                  Output(self.name, "valid"),
                  Output(self.name, "invalid"),
              ],
              [Input(self.name, "value")],
          )
          def update_valid_index(index):
              if index is not None:
                  if self.explainer.index_exists(index):
                      return True, False
                  else:
                      return False, True
              return False, False
  
imports: import sys
  from abc import ABC
  import inspect
  import types
  from typing import Union, List, Tuple
  from pathlib import Path
  from importlib import import_module
  import socket
  import dash
  from dash import html, dcc, Input, Output, State
  from dash.exceptions import PreventUpdate
  import dash_bootstrap_components
  from .None import to_html
label_desc: Use image node_id 3 for calling the IndexSelector obj's underlying member method code with example usage: obj.component_callbacks(app) and returns: False,  False, new_options, True,  False, False,  True