Sha256: 9d12c901814bd876f1d7897ef1e09babd4333beb5f26df411892ce7ab5b97621

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbFormPill
    class FormPill < Playbook::KitBase
      prop :avatar_url
      prop :name
      prop :text
      prop :size

      prop :text_transform, type: Playbook::Props::Enum,
                            values: %w[none lowercase],
                            default: "none"
      prop :color, type: Playbook::Props::Enum,
                   values: %w[primary neutral success warning error info data_1 data_2 data_3 data_4 data_5 data_6 data_7 data_8 windows siding roofing doors gutters solar insulation accessories],
                   default: "primary"
      prop :tabindex
      prop :icon
      prop :truncate, type: Playbook::Props::Number,
                      default: nil

      def classname
        generate_classname("pb_form_pill_kit", color, icon_class, name, text, text_transform)
      end

      def display_text
        object.text
      end

      def size_class
        size == "small" ? " small" : ""
      end

      def icon_class
        icon ? "icon" : nil
      end

      def close_icon_size
        size == "small" ? "xs" : "sm"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
playbook_ui-14.6.2.pre.alpha.PBNTR576tooltiptruncatedformpills4296 app/pb_kits/playbook/pb_form_pill/form_pill.rb