Sha256: a45bd1c8ae44bc6636b567640cc6c4f0c7a0373b6a24fdc87eb2327e5faa2088

Contents?: true

Size: 1.99 KB

Versions: 514

Compression:

Stored size: 1.99 KB

Contents

# frozen_string_literal: true

# rubocop:disable Style/HashLikeCase

module Playbook
  module PbFixedConfirmationToast
    class FixedConfirmationToast < Playbook::KitBase
      prop :status, type: Playbook::Props::Enum,
                    values: %w[success error neutral tip],
                    default: "neutral"
      prop :text, type: Playbook::Props::String
      prop :multi_line, type: Playbook::Props::Boolean,
                        default: false
      prop :closeable, type: Playbook::Props::Boolean,
                       default: false
      prop :horizontal, type: Playbook::Props::Enum,
                        values: [nil, "right", "left", "center"],
                        default: nil
      prop :vertical, type: Playbook::Props::Enum,
                      values: [nil, "top", "bottom"],
                      default: nil
      prop :auto_close, type: Playbook::Props::Number
      prop :icon, type: Playbook::Props::String

      def show_text?
        text.present?
      end

      def close_class
        closeable.present? ? " remove_toast" : ""
      end

      def auto_close_class
        auto_close.present? ? " auto_close_#{auto_close}" : ""
      end

      def position_class
        horizontal && vertical ? " positioned_toast #{vertical} #{horizontal}" : ""
      end

      def multi_line_class
        multi_line.present? ? "multi_line" : nil
      end

      def icon_value
        icon || case status
                when "success"
                  "check"
                when "error"
                  "exclamation-triangle"
                when "neutral"
                  "info-circle"
                when "tip"
                  "info-circle"
                end
      end

      def icon_class
        icon.present? ? " custom_icon" : ""
      end

      def classname
        generate_classname("pb_fixed_confirmation_toast_kit", status, multi_line_class) + close_class + position_class + auto_close_class + icon_class
      end
    end
  end
end

# rubocop:enable Style/HashLikeCase

Version data entries

514 entries across 514 versions & 1 rubygems

Version Path
playbook_ui-14.11.1.pre.alpha.PLAY17445539 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb
playbook_ui-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb
playbook_ui-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb
playbook_ui-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb
playbook_ui-14.11.1.pre.alpha.PBNTR7495495 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb
playbook_ui-14.12.0.pre.rc.11 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb
playbook_ui-14.12.0.pre.rc.10 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb
playbook_ui-14.12.0.pre.rc.9 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb
playbook_ui-14.12.0.pre.rc.8 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb
playbook_ui-14.12.0.pre.rc.7 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5437 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb
playbook_ui-14.11.1.pre.alpha.PBNTR719listdraggablesimple5432 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb
playbook_ui-14.11.1.pre.alpha.PBNTR768stickyrightcolumn5431 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb
playbook_ui-14.12.0.pre.rc.6 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5415 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5413 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb
playbook_ui-14.12.0.pre.rc.5 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5409 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5400 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5392 app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb