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.8.0.pre.alpha.play845allkitsbytypes1255 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.8.0.pre.alpha.play845allkitsbytypes1254 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.8.0.pre.alpha.PLAY962SingleSelect1246 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.8.0.pre.alpha.PLAY1016reactionbuttonemojibug1245 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.8.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.7.0.pre.alpha.play845allkitsbytypes1234 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.7.0.pre.alpha.play845allkitsbytypes1232 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.7.0.pre.alpha.play845allkitsbytypes1231 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.7.0.pre.alpha.play978makehighchartsadevdependencypoc1223 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.6.0.pre.alpha.play845allkitsbytypes1219 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.7.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.6.0.pre.alpha.tiptapreacthookformbug1210 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.6.0 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.5.0.pre.alpha.play984collapsiblekithidestooltips1203 app/pb_kits/playbook/pb_toggle/toggle.rb
playbook_ui-13.4.0.pre.alpha.PLAY973Hash1181 app/pb_kits/playbook/pb_toggle/toggle.rb