# frozen_string_literal: true module Primer module Forms module Dsl # :nodoc: class Input # Use this macro anywhere you want to include the various params all inputs can receive. # # @!macro [new] form_input_arguments # @param name [String] Value for the HTML name attribute. # @param id [String] Value for the HTML id attribute. # @param class [String] CSS classes to include in the input's HTML `class` attribute. Exists for compatibility with Rails form builders. # @param classes [Array] CSS classes to include in the input's HTML `class` attribute. Combined with the `:class` argument. The list may contain strings, hashes, or `nil` values, and is automatically cleaned up by Primer's [`class_name` helper](https://github.com/primer/view_components/blob/c9cb95c98fee3e2e27f4a10683f555e22285e7f1/app/lib/primer/class_name_helper.rb) (`nils`, falsy entries, and blank strings are ignored). # @param caption [String] A string describing the field and what sorts of input it expects. Displayed below the input. # @param label [String] Label text displayed above the input. # @param visually_hide_label [Boolean] When set to `true`, hides the label. Although the label will be hidden visually, it will still be visible to screen readers. # @param disabled [Boolean] When set to `true`, the input will not accept keyboard or mouse input. # @param hidden [Boolean] When set to `true`, visually hides the field. # @param invalid [Boolean] If set to `true`, the input will be rendered with a red border. Implied if `validation_message` is truthy. This option is set to `true` automatically if the model object associated with the form reports that the input is invalid via Rails validations. It is provided for cases where the form does not have an associated model. If the input is invalid as determined by Rails validations, setting `invalid` to `false` will have no effect. # @param validation_message [String] A string displayed between the caption and the input indicating the input's contents are invalid. This option is, by default, set to the first Rails validation message for the input (assuming the form is associated with a model object). Use `validation_message` to override the default or to provide a validation message in case there is no associated model object. # @param label_arguments [Hash] Attributes that will be passed to Rails' `builder.label` method. These can be HTML attributes or any of the other label options Rails supports. They will appear as HTML attributes on the `