Sha256: f4ee27f18fe743809a63ac3da8dcaf0c67a13b741e14385d2e5ec4a2e08051ce

Contents?: true

Size: 1.75 KB

Versions: 105

Compression:

Stored size: 1.75 KB

Contents

# frozen_string_literal: true

module Primer
  module Alpha
    # @label CheckBox
    class CheckBoxPreview < ViewComponent::Preview
      # @label Playground
      #
      # @param name text
      # @param value text
      # @param label text
      # @param caption text
      # @param visually_hide_label toggle
      # @param disabled toggle
      def playground(
        name: "my-check-box",
        value: "picard",
        label: "Jean-Luc Picard",
        caption: "Make it so",
        visually_hide_label: false,
        disabled: false
      )
        system_arguments = {
          name: name,
          value: value,
          label: label,
          caption: caption,
          visually_hide_label: visually_hide_label,
          disabled: disabled
        }

        render(Primer::Alpha::CheckBox.new(**system_arguments))
      end

      # @label Default
      def default
        render(Primer::Alpha::CheckBox.new(name: "my-check-box", label: "Jean-Luc Picard"))
      end

      # @!group Options
      # @snapshot
      #
      # @label With caption
      def with_caption
        render(Primer::Alpha::CheckBox.new(caption: "With a caption", name: "my-check-box1", label: "Jean-Luc Picard"))
      end

      # @label Checked
      def checked
        render(Primer::Alpha::CheckBox.new(checked: true, name: "my-check-box1", label: "Jean-Luc Picard"))
      end

      # @label Visually hidden label
      def visually_hide_label
        render(Primer::Alpha::CheckBox.new(visually_hide_label: true, name: "my-check-box2", label: "Jean-Luc Picard"))
      end

      # @label Disabled
      def disabled
        render(Primer::Alpha::CheckBox.new(disabled: true, name: "my-check-box4", label: "Jean-Luc Picard"))
      end
      #
      # @!endgroup
    end
  end
end

Version data entries

105 entries across 105 versions & 2 rubygems

Version Path
primer_view_components-0.36.5 previews/primer/alpha/check_box_preview.rb
openproject-primer_view_components-0.52.2 previews/primer/alpha/check_box_preview.rb
primer_view_components-0.36.4 previews/primer/alpha/check_box_preview.rb
openproject-primer_view_components-0.52.1 previews/primer/alpha/check_box_preview.rb
openproject-primer_view_components-0.52.0 previews/primer/alpha/check_box_preview.rb
primer_view_components-0.36.3 previews/primer/alpha/check_box_preview.rb
openproject-primer_view_components-0.51.0 previews/primer/alpha/check_box_preview.rb
primer_view_components-0.36.2 previews/primer/alpha/check_box_preview.rb
openproject-primer_view_components-0.50.1 previews/primer/alpha/check_box_preview.rb
openproject-primer_view_components-0.50.0 previews/primer/alpha/check_box_preview.rb
primer_view_components-0.36.1 previews/primer/alpha/check_box_preview.rb
primer_view_components-0.36.0 previews/primer/alpha/check_box_preview.rb
openproject-primer_view_components-0.49.2 previews/primer/alpha/check_box_preview.rb
primer_view_components-0.35.2 previews/primer/alpha/check_box_preview.rb
openproject-primer_view_components-0.49.1 previews/primer/alpha/check_box_preview.rb
openproject-primer_view_components-0.49.0 previews/primer/alpha/check_box_preview.rb
primer_view_components-0.35.1 previews/primer/alpha/check_box_preview.rb
primer_view_components-0.35.0 previews/primer/alpha/check_box_preview.rb
openproject-primer_view_components-0.48.2 previews/primer/alpha/check_box_preview.rb
openproject-primer_view_components-0.48.1 previews/primer/alpha/check_box_preview.rb