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-12.35.0.pre.alpha.iconpocwebfonts1023 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-12.35.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-12.34.0.pre.alpha.fixdialogcloseevents1004 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-12.34.0.pre.alpha.fixdialogcloseevents1003 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-12.34.0.pre.alpha.play716popoverkitcloseonclickissue998 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-12.34.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-12.33.1.pre.alpha.PLAY933navkitcollapsible994 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-12.33.1 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-12.33.0.pre.alpha.PLAY905reactionbuttons982 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-12.33.0.pre.alpha.PLAY905reactionbuttons979 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-12.33.0.pre.alpha.revert2650closedialogonoutsideclick977 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-12.33.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-12.32.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-12.31.0.pre.alpha.hoverrails951 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-12.31.0.pre.alpha.hoverrails948 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-12.31.0.pre.alpha.multilevelnopillsdesigns944 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-12.31.0.pre.alpha.multilevelnopillsdesigns941 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-12.31.0.pre.alpha.PLAY814removemomentjs935 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-12.31.0.pre.alpha.PLAY814removemomentjs933 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-12.31.0.pre.alpha.datepickerdisableddatefix931 app/pb_kits/playbook/pb_toggle/toggle.rb