Sha256: d8b6c3d286627235137d293a589d8f081951ee46fb408febe4934c9e5a863f46

Contents?: true

Size: 1.86 KB

Versions: 7

Compression:

Stored size: 1.86 KB

Contents

# frozen_string_literal: true

module Primer
  module Alpha
    # @label AutoComplete
    class AutoCompletePreview < ViewComponent::Preview
      # @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)
        render(Primer::Alpha::AutoComplete.new(label_text: label_text, input_id: "input-id", list_id: "test-id", src: "/auto_complete?version=alpha", is_label_visible: is_label_visible, is_label_inline: is_label_inline, with_icon: with_icon, is_clearable: is_clearable))
      end

      # @!group More examples

      # @label AutoComplete with non-visible label
      def with_non_visible_label
        render(Primer::Alpha::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id-1", list_id: "test-id-1", src: "/auto_complete?version=alpha", is_label_visible: false))
      end

      # @label AutoComplete with inline label
      def with_inline_label
        render(Primer::Alpha::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id-2", list_id: "test-id-2", src: "/auto_complete?version=alpha", is_label_inline: true))
      end

      # @label AutoComplete with search icon
      def with_icon
        render(Primer::Alpha::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id-3", list_id: "test-id-3", src: "/auto_complete?version=alpha", with_icon: true))
      end

      # @label AutoComplete with clear button
      def with_clear_button
        render(Primer::Alpha::AutoComplete.new(label_text: "Select a fruit", input_id: "input-id-4", list_id: "test-id-4", src: "/auto_complete?version=alpha", is_clearable: true))
      end

      # @!endgroup
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
primer_view_components-0.0.104 previews/primer/alpha/auto_complete_preview.rb
primer_view_components-0.0.103 previews/primer/alpha/auto_complete_preview.rb
primer_view_components-0.0.102 previews/primer/alpha/auto_complete_preview.rb
primer_view_components-0.0.101 previews/primer/alpha/auto_complete_preview.rb
primer_view_components-0.0.100 previews/primer/alpha/auto_complete_preview.rb
primer_view_components-0.0.99 previews/primer/alpha/auto_complete_preview.rb
primer_view_components-0.0.98 previews/primer/alpha/auto_complete_preview.rb