class Ariadne::Forms::Dsl::Input

def initialize(builder:, form:, **options)

def initialize(builder:, form:, **options)
  @builder = builder
  @form = form
  @options = options.dup
  @input_attributes = @options.delete(:html_attrs) || {}
  @input_attributes.delete(:id) if @input_attributes[:id].blank?
  @label_attributes = @options[:label_html_attributes] || {}
  @label_attributes[:for] = id if id.present?
  @label_attributes[:class] = merge_class_names(
    @label_attributes[:class],
    @options.delete(:visually_hide_label) ? "sr-only" : nil,
  )
  @input_attributes.delete(:class) if @input_attributes[:class].blank?
  @label_attributes.delete(:class) if @label_attributes[:class].blank?
  @caption = @options.delete(:caption)
  @placeholder = @options.delete(:placeholder)
  @disabled = @options.delete(:disabled)
  @validation_message = @options.delete(:validation_message)
  @invalid = @options.delete(:invalid)
  @full_width = @options.delete(:full_width) { true }
  # If scope_name_to_model is false, the name of the input for eg. `my_field`
  # will be `my_field` instead of the Rails default of `model[my_field]`.
  #
  # We achieve this by passing the `name` option to Rails form builder
  # methods. These methods will use the passed name if provided instead
  # of generating a scoped one.
  #
  unless @options.delete(:scope_name_to_model) { true }
    @input_attributes[:name] = name
  end
  # rubocop:enable Style/IfUnlessModifier
  # If scope_id_to_model is false, the name of the input for eg. `my_field`
  # will be `my_field` instead of the Rails default of `model_my_field`.
  #
  # We achieve this by passing the `id` option to Rails form builder
  # methods. These methods will use the passed id if provided instead
  # of generating a scoped one. The id is the name of the field unless
  # explicitly provided in system_arguments.
  #
  # rubocop:disable Style/IfUnlessModifier
  unless @options.delete(:scope_id_to_model) { true }
    @input_attributes[:id] = @input_attributes.delete(:id) { name }
  end
  # rubocop:enable Style/IfUnlessModifier
  # Whether or not to wrap the component in a FormControl, which renders a
  # label above and validation message beneath the input.
  @form_control = @options.delete(:form_control) { true }
  @options[:invalid] = "true" if invalid?
  @base_id = Ariadne::BaseComponent.generate_id(base_name: "ariadne-form-input")
  @ids = {}.tap do |id_map|
    id_map[:validation] = "validation-#{@base_id}" if supports_validation?
    id_map[:caption] = "caption-#{@base_id}" if caption? || caption_template?
  end
  if required?
    input_attributes[:required] = true
    add_input_aria(:required, true)
  end
  add_input_aria(:invalid, true) if invalid?
  add_input_aria(:describedby, ids.values) if ids.any?
end