Sha256: c7deaf8481a1011d2a4b2c8f01fc1ebdc6990b2716d9df7a298b77230adf3921

Contents?: true

Size: 1.08 KB

Versions: 33

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module Primer
  module Alpha
    class SegmentedControl
      # SegmentedControl::Item is a private component that is only used by SegmentedControl
      # It wraps the Button and IconButton components to provide the correct styles
      class Item < Primer::BaseComponent
        status :alpha
        audited_at "2023-02-01"

        # @param label [String] The label to use
        # @param selected [Boolean] Whether the item is selected
        # @param icon [Symbol] The icon to use
        # @param hide_labels [Symbol] Whether to only show the icon
        def initialize(label:, selected: false, icon: nil, hide_labels: false, **system_arguments)
          @icon = icon
          @hide_labels = hide_labels
          @label = label
          @selected = selected

          @system_arguments = system_arguments
          @system_arguments[:"data-action"] = "click:segmented-control#select" if system_arguments[:href].nil?
          @system_arguments[:"aria-current"] = selected
          @system_arguments[:scheme] = :invisible
        end
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
primer_view_components-0.11.0 app/components/primer/alpha/segmented_control/item.rb
openproject-primer_view_components-0.12.1 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.10.0 app/components/primer/alpha/segmented_control/item.rb
openproject-primer_view_components-0.11.0 app/components/primer/alpha/segmented_control/item.rb
openproject-primer_view_components-0.10.0 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.9.0 app/components/primer/alpha/segmented_control/item.rb
openproject-primer_view_components-0.9.1 app/components/primer/alpha/segmented_control/item.rb
openproject-primer_view_components-0.9.0 app/components/primer/alpha/segmented_control/item.rb
openproject-primer_view_components-0.8.0 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.8.0 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.7.0 app/components/primer/alpha/segmented_control/item.rb
openproject-primer_view_components-0.7.0 app/components/primer/alpha/segmented_control/item.rb
openproject-primer_view_components-0.6.3 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.6.0 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.5.1 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.5.0 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.4.0 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.3.1 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.3.0 app/components/primer/alpha/segmented_control/item.rb
primer_view_components-0.2.0 app/components/primer/alpha/segmented_control/item.rb