Sha256: 9a5b9c8b90acdf511f8190e70605a32b15b91f9e1e959f12c97215e1693881c4

Contents?: true

Size: 470 Bytes

Versions: 129

Compression:

Stored size: 470 Bytes

Contents

# frozen_string_literal: true

module Primer
  module Forms
    # :nodoc:
    class ToggleSwitch < BaseComponent
      delegate :builder, :form, to: :@input

      def initialize(input:)
        @input = input
        @input.add_label_classes("FormControl-label")
        @input.label_arguments[:id] = label_id
        @input.add_input_aria(:labelledby, label_id)
      end

      def label_id
        @label_id ||= "label-#{@input.base_id}"
      end
    end
  end
end

Version data entries

129 entries across 129 versions & 2 rubygems

Version Path
primer_view_components-0.19.0 lib/primer/forms/toggle_switch.rb
openproject-primer_view_components-0.22.2 lib/primer/forms/toggle_switch.rb
primer_view_components-0.18.2 lib/primer/forms/toggle_switch.rb
openproject-primer_view_components-0.22.1 lib/primer/forms/toggle_switch.rb
primer_view_components-0.18.1 lib/primer/forms/toggle_switch.rb
openproject-primer_view_components-0.22.0 lib/primer/forms/toggle_switch.rb
primer_view_components-0.18.0 lib/primer/forms/toggle_switch.rb
openproject-primer_view_components-0.21.0 lib/primer/forms/toggle_switch.rb
primer_view_components-0.17.0 lib/primer/forms/toggle_switch.rb
openproject-primer_view_components-0.20.0 lib/primer/forms/toggle_switch.rb
primer_view_components-0.16.1 lib/primer/forms/toggle_switch.rb
primer_view_components-0.16.0 lib/primer/forms/toggle_switch.rb
openproject-primer_view_components-0.19.0 lib/primer/forms/toggle_switch.rb
primer_view_components-0.15.1 lib/primer/forms/toggle_switch.rb
primer_view_components-0.15.0 lib/primer/forms/toggle_switch.rb
openproject-primer_view_components-0.18.1 lib/primer/forms/toggle_switch.rb
openproject-primer_view_components-0.17.1 lib/primer/forms/toggle_switch.rb
openproject-primer_view_components-0.17.0 lib/primer/forms/toggle_switch.rb
primer_view_components-0.14.0 lib/primer/forms/toggle_switch.rb
openproject-primer_view_components-0.16.0 lib/primer/forms/toggle_switch.rb