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.5.0.pre.alpha.PLAY1548intltelinputupdatelatest4073 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.PBNTR600reactfilterdisplayzeroresults4068 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.PLAY15814066 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.PBNTR568dropdowncleaning4044 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.PBNTR568dropdowncleaning4041 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.PLAY15814040 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.6.0.pre.rc.13 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.PLAY1548intltelinputupdatelatest4037 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.20241007playbookwebsiteaddrdbms4036 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.PBNTR606multilevelselectreset4035 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.PLAY1548intltelinputupdatelatest4032 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.5.0.pre.alpha.PLAY1548intltelinputupdatelatest4028 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.6.0.pre.rc.12 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.6.0.pre.rc.11 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.6.0.pre.rc.10 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.6.0.pre.rc.9 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.6.0.pre.rc.8 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.6.0.pre.rc.7 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.6.0.pre.rc.6 app/pb_kits/playbook/pb_dropdown/dropdown.rb
playbook_ui-14.6.0.pre.rc.5 app/pb_kits/playbook/pb_dropdown/dropdown.rb