Sha256: 5ca40ede370dd5d2ccf8a14e9d470f652173a169dcf38503828420f2a6c533ce

Contents?: true

Size: 1.14 KB

Versions: 392

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

require "action_view"

module Playbook
  module PbRadio
    class Radio < Playbook::KitBase
      prop :alignment, type: Playbook::Props::String,
                       default: ""
      prop :checked, type: Playbook::Props::Boolean,
                     default: false
      prop :error, type: Playbook::Props::Boolean,
                   default: false
      prop :input_options, type: Playbook::Props::Hash,
                           default: {}
      prop :name, type: Playbook::Props::String,
                  default: "radio_name"
      prop :text, type: Playbook::Props::String,
                  default: "Radio Text"
      prop :value, type: Playbook::Props::String,
                   default: "radio_text"

      def classname
        generate_classname("pb_radio_kit") + error_class + alignment_class
      end

      def selected
        "checked" if checked == true
      end

      def body_status
        error ? "negative" : nil
      end

    private

      def error_class
        error ? " error" : ""
      end

      def alignment_class
        alignment == "vertical" ? " vertical" : ""
      end
    end
  end
end

Version data entries

392 entries across 392 versions & 1 rubygems

Version Path
playbook_ui-12.31.0.pre.alpha.customiconsfa928 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-12.31.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-12.30.1.pre.alpha.play846responsivespacingglobalpropsneedsdefault924 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-12.30.1.pre.alpha.PLAY906multilevelselectedidsprop917 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-12.30.1.pre.alpha.PLAY906multilevelselectedidsprop916 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-12.30.1.pre.alpha.hovertesting914 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-12.30.1.pre.alpha.PLAY906multilevelselectedidsprop912 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-12.30.1.pre.alpha.PLAY802responsivetitlekit909 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-12.30.0.pre.alpha.PLAY906multilevelselectedidsprop902 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-12.30.1 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-12.30.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-12.29.0.pre.alpha.play716popoverkitcloseonclickissue893 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-12.29.0 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-12.28.0.pre.alpha.PLAY863multilevelv2877 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-12.28.0.pre.alpha.PLAY863multilevelv2876 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-12.28.0.pre.alpha.PLAY814removemomentjs871 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-12.28.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown869 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-12.28.0.pre.alpha.PLAY837MapCustomButton868 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-12.28.0.pre.alpha.20230613implementbakesupport865 app/pb_kits/playbook/pb_radio/radio.rb
playbook_ui-12.28.0 app/pb_kits/playbook/pb_radio/radio.rb