Sha256: e7a95bb9b37e8463afe76bd117a8a05dc6ac2fdb50f0364906e32727fb22f19c

Contents?: true

Size: 1.05 KB

Versions: 244

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbDropdown
    class Dropdown < Playbook::KitBase
      prop :options, type: Playbook::Props::Array,
                     default: []
      prop :label, type: Playbook::Props::String
      prop :name, type: Playbook::Props::String
      prop :error, type: Playbook::Props::String
      prop :required, type: Playbook::Props::Boolean,
                      default: false
      prop :default_value
      prop :blank_selection, type: Playbook::Props::String,
                             default: ""

      def data
        Hash(prop(:data)).merge(pb_dropdown: true)
      end

      def classname
        generate_classname("pb_dropdown")
      end

    private

      def error_class
        error.present? ? " error" : ""
      end

      def input_default_value
        default_value.present? ? default_value.transform_keys(&:to_s)["id"] : ""
      end

      def options_with_blank
        blank_selection.present? ? [{ id: "", value: "", label: blank_selection }] + options : options
      end
    end
  end
end

Version data entries

244 entries across 244 versions & 1 rubygems

Version Path
playbook_ui-14.6.0.pre.rc.21 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.PLAY1548intltelinputupdatelatest4175 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.6.0.pre.rc.20 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.PLAY1548intltelinputupdatelatest4162 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.PBNTR595popoverwidthpropfilterpopoverprop4158 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.PBNTR614advancedtablepoc4155 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.6.0.pre.rc.19 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.6.0.pre.rc.18 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.play1549upgradereactmodal4130 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.PLAY1601updatereactzoompanpinch4128 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.PLAY1601updatereactzoompanpinch4123 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.6.0.pre.rc.17 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.play1586datearea4115 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.6.0.pre.rc.16 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.PLAY1485selectablecardoverflowoutlinebug4098 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.PLAY1485selectablecardoverflowoutlinebug4097 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.PLAY1485selectablecardoverflowoutlinebug4094 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.6.0.pre.rc.15 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.PLAY1548intltelinputupdatelatest4077 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.6.0.pre.rc.14 app/pb_kits/playbook/pb_dropdown/dropdown.rb