lib/primer/forms/dsl/select_input.rb
# frozen_string_literal: true module Primer module Forms module Dsl # :nodoc: class SelectInput < Input SELECT_ARGUMENTS = %i[multiple include_blank prompt].freeze # :nodoc: class Option attr_reader :label, :value, :system_arguments def initialize(label:, value:, **system_arguments) @label = label @value = value @system_arguments = system_arguments end end attr_reader :name, :label, :options, :select_arguments def initialize(name:, label:, **system_arguments) @name = name @label = label @options = [] @select_arguments = {}.tap do |select_args| SELECT_ARGUMENTS.each do |select_arg| select_args[select_arg] = system_arguments.delete(select_arg) end end super(**system_arguments) yield(self) if block_given? end def option(**system_arguments) @options << Option.new(**system_arguments) end def to_component Select.new(input: self) end # :nocov: def type :select_list end # :nocov: # :nocov: def focusable? true end # :nocov: end end end end
Source Files
- app/components/primer/alpha/action_bar.rb
- app/components/primer/alpha/action_bar/divider.rb
- app/components/primer/alpha/action_bar/item.rb
- app/components/primer/alpha/action_list.rb
- app/components/primer/alpha/action_list/divider.rb
- app/components/primer/alpha/action_list/form_wrapper.rb
- app/components/primer/alpha/action_list/heading.rb
- app/components/primer/alpha/action_list/item.rb
- app/components/primer/alpha/action_menu.rb
- app/components/primer/alpha/action_menu/list.rb
- app/components/primer/alpha/auto_complete.rb
- app/components/primer/alpha/auto_complete/item.rb
- app/components/primer/alpha/banner.rb
- app/components/primer/alpha/button_marketing.rb
- app/components/primer/alpha/check_box.rb
- app/components/primer/alpha/check_box_group.rb
- app/components/primer/alpha/dialog.rb
- app/components/primer/alpha/dialog/body.rb
- app/components/primer/alpha/dialog/footer.rb
- app/components/primer/alpha/dialog/header.rb
- app/components/primer/alpha/dropdown.rb
- app/components/primer/alpha/dropdown/menu.rb
- app/components/primer/alpha/form_button.rb
- app/components/primer/alpha/form_control.rb
- app/components/primer/alpha/hellip_button.rb
- app/components/primer/alpha/hidden_text_expander.rb
- app/components/primer/alpha/image.rb
- app/components/primer/alpha/image_crop.rb
- app/components/primer/alpha/layout.rb
- app/components/primer/alpha/menu.rb
- app/components/primer/alpha/multi_input.rb
- app/components/primer/alpha/nav_list.rb
- app/components/primer/alpha/nav_list/divider.rb
- app/components/primer/alpha/nav_list/group.rb
- app/components/primer/alpha/nav_list/heading.rb
- app/components/primer/alpha/nav_list/item.rb
- app/components/primer/alpha/navigation/tab.rb
- app/components/primer/alpha/octicon_symbols.rb
- app/components/primer/alpha/overlay.rb
- app/components/primer/alpha/overlay/body.rb
- app/components/primer/alpha/overlay/footer.rb
- app/components/primer/alpha/overlay/header.rb
- app/components/primer/alpha/radio_button.rb
- app/components/primer/alpha/radio_button_group.rb
- app/components/primer/alpha/segmented_control.rb
- app/components/primer/alpha/segmented_control/item.rb
- app/components/primer/alpha/select.rb
- app/components/primer/alpha/submit_button.rb
- app/components/primer/alpha/tab_container.rb
- app/components/primer/alpha/tab_nav.rb
- app/components/primer/alpha/tab_panels.rb
- app/components/primer/alpha/text_area.rb
- app/components/primer/alpha/text_field.rb
- app/components/primer/alpha/toggle_switch.rb
- app/components/primer/alpha/tooltip.rb
- app/components/primer/alpha/underline_nav.rb
- app/components/primer/alpha/underline_panels.rb
- app/components/primer/base_component.rb
- app/components/primer/beta/auto_complete.rb
- app/components/primer/beta/auto_complete/item.rb
- app/components/primer/beta/avatar.rb
- app/components/primer/beta/avatar_stack.rb
- app/components/primer/beta/base_button.rb
- app/components/primer/beta/blankslate.rb
- app/components/primer/beta/border_box.rb
- app/components/primer/beta/border_box/header.rb
- app/components/primer/beta/breadcrumbs.rb
- app/components/primer/beta/button.rb
- app/components/primer/beta/button_group.rb
- app/components/primer/beta/clipboard_copy.rb
- app/components/primer/beta/clipboard_copy_button.rb
- app/components/primer/beta/close_button.rb
- app/components/primer/beta/counter.rb
- app/components/primer/beta/details.rb
- app/components/primer/beta/flash.rb
- app/components/primer/beta/heading.rb
- app/components/primer/beta/icon_button.rb
- app/components/primer/beta/label.rb
- app/components/primer/beta/link.rb
- app/components/primer/beta/markdown.rb
- app/components/primer/beta/nav_list.rb
- app/components/primer/beta/nav_list/divider.rb
- app/components/primer/beta/nav_list/group.rb
- app/components/primer/beta/nav_list/heading.rb
- app/components/primer/beta/nav_list/item.rb
- app/components/primer/beta/octicon.rb
- app/components/primer/beta/popover.rb
- app/components/primer/beta/progress_bar.rb
- app/components/primer/beta/relative_time.rb
- app/components/primer/beta/spinner.rb
- app/components/primer/beta/state.rb
- app/components/primer/beta/subhead.rb
- app/components/primer/beta/text.rb
- app/components/primer/beta/timeline_item.rb
- app/components/primer/beta/truncate.rb
- app/components/primer/blankslate_component.rb
- app/components/primer/box.rb
- app/components/primer/button_component.rb
- app/components/primer/component.rb
- app/components/primer/conditional_wrapper.rb
- app/components/primer/content.rb
- app/components/primer/icon_button.rb
- app/components/primer/layout_component.rb
- app/components/primer/navigation/tab_component.rb
- app/components/primer/tooltip.rb
- app/components/primer/truncate.rb
- app/forms/action_menu_form.rb
- app/forms/after_content_form.rb
- app/forms/application_form.rb
- app/forms/array_check_box_group_form.rb
- app/forms/both_types_of_caption_form.rb
- app/forms/caption_template_form.rb
- app/forms/check_box_group_form.rb
- app/forms/check_box_with_nested_form.rb
- app/forms/composed_form.rb
- app/forms/example_toggle_switch_form.rb
- app/forms/first_name_form.rb
- app/forms/horizontal_form.rb
- app/forms/immediate_validation_form.rb
- app/forms/invalid_form.rb
- app/forms/last_name_form.rb
- app/forms/multi_input_form.rb
- app/forms/multi_text_field_form.rb
- app/forms/name_with_question_mark_form.rb
- app/forms/radio_button_group_form.rb
- app/forms/radio_button_with_nested_form.rb
- app/forms/select_form.rb
- app/forms/single_text_field_form.rb
- app/forms/submit_button_form.rb
- app/forms/text_field_and_checkbox_form.rb
- app/helpers/primer/form_helper.rb
- app/lib/primer/attributes_helper.rb
- app/lib/primer/audited/dsl.rb
- app/lib/primer/class_name_helper.rb
- app/lib/primer/fetch_or_fallback_helper.rb
- app/lib/primer/join_style_arguments_helper.rb
- app/lib/primer/octicon/cache.rb
- app/lib/primer/status/dsl.rb
- app/lib/primer/tab_nav_helper.rb
- app/lib/primer/tabbed_component_helper.rb
- app/lib/primer/test_selector_helper.rb
- app/lib/primer/underline_nav_helper.rb
- app/lib/primer/view_helper.rb
- lib/primer/accessibility.rb
- lib/primer/classify.rb
- lib/primer/classify/utilities.rb
- lib/primer/classify/validation.rb
- lib/primer/deprecations.rb
- lib/primer/example_image.rb
- lib/primer/form_components.rb
- lib/primer/forms.rb
- lib/primer/forms/action_menu.rb
- lib/primer/forms/acts_as_component.rb
- lib/primer/forms/base.rb
- lib/primer/forms/base_component.rb
- lib/primer/forms/buffer_rewriter.rb
- lib/primer/forms/builder.rb
- lib/primer/forms/button.rb
- lib/primer/forms/caption.rb
- lib/primer/forms/check_box.rb
- lib/primer/forms/check_box_group.rb
- lib/primer/forms/dsl/action_menu_input.rb
- lib/primer/forms/dsl/button_input.rb
- lib/primer/forms/dsl/check_box_group_input.rb
- lib/primer/forms/dsl/check_box_input.rb
- lib/primer/forms/dsl/form_object.rb
- lib/primer/forms/dsl/form_reference_input.rb
- lib/primer/forms/dsl/hidden_input.rb
- lib/primer/forms/dsl/input.rb
- lib/primer/forms/dsl/input_group.rb
- lib/primer/forms/dsl/input_methods.rb
- lib/primer/forms/dsl/multi_input.rb
- lib/primer/forms/dsl/radio_button_group_input.rb
- lib/primer/forms/dsl/radio_button_input.rb
- lib/primer/forms/dsl/select_input.rb
- lib/primer/forms/dsl/submit_button_input.rb
- lib/primer/forms/dsl/text_area_input.rb
- lib/primer/forms/dsl/text_field_input.rb
- lib/primer/forms/dsl/toggle_switch_input.rb
- lib/primer/forms/form_control.rb
- lib/primer/forms/form_list.rb
- lib/primer/forms/form_reference.rb
- lib/primer/forms/group.rb
- lib/primer/forms/hidden_field.rb
- lib/primer/forms/multi.rb
- lib/primer/forms/primer_base_component_wrapper.rb
- lib/primer/forms/radio_button.rb
- lib/primer/forms/radio_button_group.rb
- lib/primer/forms/select.rb
- lib/primer/forms/separator.rb
- lib/primer/forms/spacing_wrapper.rb
- lib/primer/forms/submit_button.rb
- lib/primer/forms/text_area.rb
- lib/primer/forms/text_field.rb
- lib/primer/forms/toggle_switch.rb
- lib/primer/forms/toggle_switch_form.rb
- lib/primer/forms/utils.rb
- lib/primer/forms/validation_message.rb
- lib/primer/static.rb
- lib/primer/static/generate_arguments.rb
- lib/primer/static/generate_audited_at.rb
- lib/primer/static/generate_constants.rb
- lib/primer/static/generate_info_arch.rb
- lib/primer/static/generate_previews.rb
- lib/primer/static/generate_statuses.rb
- lib/primer/view_components.rb
- lib/primer/view_components/audited.rb
- lib/primer/view_components/constants.rb
- lib/primer/view_components/engine.rb
- lib/primer/view_components/linters.rb
- lib/primer/view_components/linters/argument_mappers/base.rb
- lib/primer/view_components/linters/argument_mappers/button.rb
- lib/primer/view_components/linters/argument_mappers/clipboard_copy.rb
- lib/primer/view_components/linters/argument_mappers/close_button.rb
- lib/primer/view_components/linters/argument_mappers/conversion_error.rb
- lib/primer/view_components/linters/argument_mappers/flash.rb
- lib/primer/view_components/linters/argument_mappers/helpers/erb_block.rb
- lib/primer/view_components/linters/argument_mappers/label.rb
- lib/primer/view_components/linters/argument_mappers/system_arguments.rb
- lib/primer/view_components/linters/autocorrectable.rb
- lib/primer/view_components/linters/base_linter.rb
- lib/primer/view_components/linters/blankslate_api_migration.rb
- lib/primer/view_components/linters/blankslate_component_migration_counter.rb
- lib/primer/view_components/linters/breadcrumbs_component_migration_counter.rb
- lib/primer/view_components/linters/button_component_migration_counter.rb
- lib/primer/view_components/linters/clipboard_copy_component_migration_counter.rb
- lib/primer/view_components/linters/close_button_component_migration_counter.rb
- lib/primer/view_components/linters/deprecated_components_counter.rb
- lib/primer/view_components/linters/details_menu_migration.rb
- lib/primer/view_components/linters/disallow_action_list.rb
- lib/primer/view_components/linters/disallow_component_css_counter.rb
- lib/primer/view_components/linters/flash_migration_counter.rb
- lib/primer/view_components/linters/helpers/deprecated_components_helpers.rb
- lib/primer/view_components/linters/helpers/rubocop_helpers.rb
- lib/primer/view_components/linters/helpers/rule_helpers.rb
- lib/primer/view_components/linters/label_component_migration_counter.rb
- lib/primer/view_components/linters/migrate_deprecated_flash_arguments.rb
- lib/primer/view_components/linters/migrations/iconbutton_component.rb
- lib/primer/view_components/linters/migrations/truncate_component.rb
- lib/primer/view_components/linters/severity_schema.rb
- lib/primer/view_components/linters/subhead_component_migration_counter.rb
- lib/primer/view_components/linters/super_in_component_templates.rb
- lib/primer/view_components/linters/tag_tree_helpers.rb
- lib/primer/view_components/linters/tooltipped_migration.rb
- lib/primer/view_components/linters/two_column_layout_migration_counter.rb
- lib/primer/view_components/statuses.rb
- lib/primer/view_components/version.rb
- lib/primer/yard.rb
- lib/primer/yard/backend.rb
- lib/primer/yard/component_manifest.rb
- lib/primer/yard/component_ref.rb
- lib/primer/yard/docs_helper.rb
- lib/primer/yard/info_arch_docs_helper.rb
- lib/primer/yard/lookbook_docs_helper.rb
- lib/primer/yard/lookbook_pages_backend.rb
- lib/primer/yard/registry.rb
- lib/primer/yard/renders_many_handler.rb
- lib/primer/yard/renders_one_handler.rb
- lib/rubocop/cop/primer.rb
- lib/rubocop/cop/primer/base_cop.rb
- lib/rubocop/cop/primer/component_name_migration.rb
- lib/rubocop/cop/primer/deprecated_arguments.rb
- lib/rubocop/cop/primer/deprecated_button_arguments.rb
- lib/rubocop/cop/primer/deprecated_components.rb
- lib/rubocop/cop/primer/deprecated_label_schemes.rb
- lib/rubocop/cop/primer/deprecated_label_variants.rb
- lib/rubocop/cop/primer/deprecated_layout_component.rb
- lib/rubocop/cop/primer/no_tag_memoize.rb
- lib/rubocop/cop/primer/primer_octicon.rb
- lib/rubocop/cop/primer/system_argument_instead_of_class.rb
- lib/rubocop/cop/primer/test_selector.rb