# frozen_string_literal: true require_relative "../url_helpers" module Yattho module Alpha # @label AutoComplete class AutoCompletePreview < ViewComponent::Preview # @label Playground # @param label_text text # @param is_label_visible toggle # @param is_label_inline toggle # @param with_icon toggle # @param is_clearable toggle def playground(label_text: "Select a fruit", is_label_visible: true, is_label_inline: false, with_icon: false, is_clearable: false) # rubocop:disable Yattho/ComponentNameMigration render( Yattho::Alpha::AutoComplete.new( label_text: label_text, input_id: "input-id", list_id: "test-id", src: URLHelpers.autocomplete_index_path(version: "alpha"), is_label_visible: is_label_visible, is_label_inline: is_label_inline, with_icon: with_icon, is_clearable: is_clearable ) ) # rubocop:enable Yattho/ComponentNameMigration end # @label Default Options # @param label_text text # @param is_label_visible toggle # @param is_label_inline toggle # @param with_icon toggle # @param is_clearable toggle def default(label_text: "Select a fruit", is_label_visible: true, is_label_inline: false, with_icon: false, is_clearable: false) # rubocop:disable Yattho/ComponentNameMigration render( Yattho::Alpha::AutoComplete.new( label_text: label_text, input_id: "input-id", list_id: "test-id", src: URLHelpers.autocomplete_index_path(version: "alpha"), is_label_visible: is_label_visible, is_label_inline: is_label_inline, with_icon: with_icon, is_clearable: is_clearable ) ) # rubocop:enable Yattho/ComponentNameMigration end # @!group More examples # @label AutoComplete with non-visible label def with_non_visible_label # rubocop:disable Yattho/ComponentNameMigration render( Yattho::Alpha::AutoComplete.new( label_text: "Select a fruit", input_id: "input-id-1", list_id: "test-id-1", src: URLHelpers.autocomplete_index_path(version: "alpha"), is_label_visible: false ) ) # rubocop:enable Yattho/ComponentNameMigration end # @label AutoComplete with inline label def with_inline_label # rubocop:disable Yattho/ComponentNameMigration render( Yattho::Alpha::AutoComplete.new( label_text: "Select a fruit", input_id: "input-id-2", list_id: "test-id-2", src: URLHelpers.autocomplete_index_path(version: "alpha"), is_label_inline: true ) ) # rubocop:enable Yattho/ComponentNameMigration end # @label AutoComplete with search icon def with_icon # rubocop:disable Yattho/ComponentNameMigration render( Yattho::Alpha::AutoComplete.new( label_text: "Select a fruit", input_id: "input-id-3", list_id: "test-id-3", src: URLHelpers.autocomplete_index_path(version: "alpha"), with_icon: true ) ) # rubocop:enable Yattho/ComponentNameMigration end # @label AutoComplete with clear button def with_clear_button # rubocop:disable Yattho/ComponentNameMigration render( Yattho::Alpha::AutoComplete.new( label_text: "Select a fruit", input_id: "input-id-4", list_id: "test-id-4", src: URLHelpers.autocomplete_index_path(version: "alpha"), is_clearable: true ) ) # rubocop:enable Yattho/ComponentNameMigration end # @!endgroup end end end