Sha256: d15671c5eeb21dbf54ae2f13895a96f6b112fe013be6746b222552b548151587

Contents?: true

Size: 1.18 KB

Versions: 12

Compression:

Stored size: 1.18 KB

Contents

require_relative '../item'

module CCS
  module Components
    module GovUK
      class Field < Base
        class Inputs < Field
          class Item < Base
            # = GOV.UK Field Inputs Checkbox
            #
            # This is used to generate an individual checkbox item

            class Checkbox < Item
              # @param (see CCS::Components::GovUK::Field::Items::Item#initialize)
              # label [Hash] attributes for the checkbox label, see {CCS::Components::GovUK::Label#initialize Label#initialize} for more details.
              #
              # @option (see CCS::Components::GovUK::Field::Items::Item#initialize))

              def initialize(attribute:, label:, **options)
                super(attribute: attribute, item_class: 'govuk-checkboxes__item', **options)

                label[:classes] = "govuk-checkboxes__label #{label[:classes]}".rstrip
              end

              # The default attributes for the checkbox

              DEFAULT_ATTRIBUTES = { class: 'govuk-checkboxes__input' }.freeze

              # The type of the input item

              ITEM_TYPE = 'checkboxes'.freeze
            end
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ccs-frontend_helpers-2.1.0 lib/ccs/components/govuk/field/inputs/item/checkbox.rb
ccs-frontend_helpers-2.0.0 lib/ccs/components/govuk/field/inputs/item/checkbox.rb
ccs-frontend_helpers-1.2.0 lib/ccs/components/govuk/field/inputs/item/checkbox.rb
ccs-frontend_helpers-1.1.2 lib/ccs/components/govuk/field/inputs/item/checkbox.rb
ccs-frontend_helpers-1.1.1 lib/ccs/components/govuk/field/inputs/item/checkbox.rb
ccs-frontend_helpers-1.1.0 lib/ccs/components/govuk/field/inputs/item/checkbox.rb
ccs-frontend_helpers-1.1.0.beta0 lib/ccs/components/govuk/field/inputs/item/checkbox.rb
ccs-frontend_helpers-1.0.0 lib/ccs/components/govuk/field/inputs/item/checkbox.rb
ccs-frontend_helpers-0.5.0.beta1 lib/ccs/components/govuk/field/inputs/item/checkbox.rb
ccs-frontend_helpers-0.5.0.beta0 lib/ccs/components/govuk/field/inputs/item/checkbox.rb
ccs-frontend_helpers-0.3.0 lib/ccs/components/govuk/field/inputs/item/checkbox.rb
ccs-frontend_helpers-0.2.0 lib/ccs/components/govuk/field/inputs/item/checkbox.rb