Sha256: 085bfdd92ad7a24de62bc4d807a11274ca09f1db3252bdd0fe646c647fa91f15

Contents?: true

Size: 744 Bytes

Versions: 175

Compression:

Stored size: 744 Bytes

Contents

# frozen_string_literal: true

require "action_view"

module Playbook
  module PbToggle
    class Toggle < Playbook::KitBase
      prop :input_options, type: Playbook::Props::HashProp,
                           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

175 entries across 175 versions & 1 rubygems

Version Path
playbook_ui-13.16.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.15.0.pre.alpha.play10841940 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.15.0.pre.alpha.1132globalpropdatepickerspacing1929 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.15.0.pre.alpha.PLAY10851907 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.15.0.pre.alpha.PLAY11311893 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.15.0.pre.alpha.reactselectbump581876 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.15.0.pre.alpha.PLAY10831873 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.14.0.pre.alpha.play1101betaicons1825 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.14.0.pre.alpha.play1101betaicons1798 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.14.0.pre.alpha.play1120lintdatepicker1797 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.15.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.14.0.pre.alpha.PLAY1109bugdisplaypropblocksfontcolor1784 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.14.0.pre.alpha.play1106filter1751 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.14.0.pre.alpha.play1106filter1748 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.14.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.13.0.pre.alpha.PLAY1097linterenhancedelement1728 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.13.0.pre.alpha.play10821727 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.13.0.pre.alpha.play10821726 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.13.0.pre.alpha.play10221678 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.13.0.pre.alpha.PLAY1090csstokens1675 app/pb_kits/playbook/pb_toggle/toggle.rb