Sha256: d32a8218534a4186b01e4edf1d49b2f9126ef7c800132910ebe000b146674e99

Contents?: true

Size: 1.24 KB

Versions: 191

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbCheckbox
    class Checkbox < Playbook::KitBase
      prop :error, type: Playbook::Props::Boolean, default: false
      prop :checked, type: Playbook::Props::Boolean, default: false
      prop :indeterminate, type: Playbook::Props::Boolean, default: false
      prop :text
      prop :value
      prop :name

      prop :input_options, type: Playbook::Props::HashProp,
                           default: {}
      prop :required, type: Playbook::Props::Boolean,
                      default: false
      prop :form_spacing, type: Playbook::Props::Boolean,
                          default: false

      def checked_html
        checked ? "checked='true'" : nil
      end

      def classname
        generate_classname("pb_checkbox_kit", checked_class) + indeterminate_class + error_class
      end

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

      def checkbox_label_status
        error ? "negative" : nil
      end

    private

      def error_class
        error ? " error" : ""
      end

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

      def indeterminate_class
        indeterminate ? " indeterminate" : ""
      end
    end
  end
end

Version data entries

191 entries across 191 versions & 1 rubygems

Version Path
playbook_ui-13.25.0.pre.alpha.PLAY1249fixTooltipswrappingformelementscausingmisalignment2785 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-13.25.0.pre.alpha.PLAY1249fixTooltipswrappingformelementscausingmisalignment2783 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-13.25.0.pre.alpha.PBNTR272Dropdownkitv42769 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-13.25.0.pre.alpha.barchartfix2766 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-13.25.0.pre.alpha.PLAY761globalpaddingpropsbuttons2713 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-13.25.0 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-13.24.0.pre.alpha.play1305drycontenttag2689 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-13.24.0.pre.alpha.PBNTR261NewKitDropdown2681 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-13.24.0.pre.alpha.PLAY1181circleiconkitfixsizingerrorglobalspacingprops2675 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-13.24.0.pre.alpha.PLAY998backgroundkitremoveemptyinlinline2666 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-13.23.0.pre.alpha.PLAY1284investigation2657 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-13.24.0 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-13.22.0.pre.alpha.pbntr254barchartnegativenumber2640 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-13.22.0.pre.alpha.PLAY1297updatetextstyles2636 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-13.22.0.pre.alpha.playbookgemspecrailsversion2608 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-13.23.0 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-13.21.0.pre.alpha.PLAY12582531 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-13.21.0.pre.alpha.PLAY12582516 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-13.21.0.pre.alpha.PLAY12582515 app/pb_kits/playbook/pb_checkbox/checkbox.rb
playbook_ui-13.21.0.pre.alpha.PLAY12582514 app/pb_kits/playbook/pb_checkbox/checkbox.rb