Sha256: 8e0394aae57bb18b2d6aa8d549bf1a490ccc7635fa17fe6359ea8d82491d91db

Contents?: true

Size: 740 Bytes

Versions: 468

Compression:

Stored size: 740 Bytes

Contents

# frozen_string_literal: true

require "action_view"

module Playbook
  module PbToggle
    class Toggle < Playbook::KitBase
      prop :input_options, type: Playbook::Props::Hash,
                           default: {}

      prop :checked, type: Playbook::Props::Boolean,
                     default: false
      prop :name
      prop :size, type: Playbook::Props::Enum,
                  values: %w[sm md],
                  default: "sm"
      prop :value

      def classname
        generate_classname("pb_toggle_kit", size, checked_class)
      end

      def input
        check_box_tag(name, value, checked, input_options)
      end

    private

      def checked_class
        checked ? "on" : "off"
      end
    end
  end
end

Version data entries

468 entries across 468 versions & 1 rubygems

Version Path
playbook_ui-8.0.0.pre.alpha5 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-8.0.0.pre.alpha4 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-8.0.0.pre.alpha1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-7.16.0.pre.alpha5 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-7.16.0.pre.alpha4 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-7.16.0.pre.alpha3 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-7.16.0.pre.alpha2 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-7.16.0.pre.alpha1 app/pb_kits/playbook/pb_toggle/toggle.rb