Sha256: 55556036b78accfade84d75f15a5bceb8a1f487d2c957facc353407ec876ad6e

Contents?: true

Size: 1.58 KB

Versions: 584

Compression:

Stored size: 1.58 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbDialog
    class Dialog < Playbook::KitBase
      prop :size, type: Playbook::Props::Enum,
                  values: %w[sm md lg xl status_size content],
                  default: "md"
      prop :full_height, type: Playbook::Props::Boolean, default: false
      prop :placement, type: Playbook::Props::Enum,
                       values: %w[left right center],
                       default: "center"
      prop :should_close_on_overlay_click, type: Playbook::Props::Boolean, default: true
      prop :title
      prop :text
      prop :confirm_button
      prop :cancel_button
      prop :status, type: Playbook::Props::Enum,
                    values: ["info", "caution", "delete", "error", "success", "default", ""],
                    default: ""

      def classname
        generate_classname("pb_dialog pb_dialog_rails pb_dialog_#{size}_#{placement}")
      end

      def full_height_style
        if full_height && size === "xl"
          "full_height_center"
        elsif full_height && size != "xl"
          "full_height_#{placement}"
        end
      end

      def overlay_close
        !should_close_on_overlay_click ? "overlay_close" : ""
      end

      def status_alerts
        alerts = {
          "info" => %w[info-circle default],
          "default" => %w[exclamation-circle default],
          "caution" => %w[exclamation-triangle yellow],
          "delete" => %w[trash-alt red],
          "error" => %w[times-circle red],
          "success" => %w[check-circle green],
        }
        alerts[status]
      end
    end
  end
end

Version data entries

584 entries across 584 versions & 1 rubygems

Version Path
playbook_ui-14.2.0.pre.alpha.PLAY15063637 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.0.pre.alpha.PLAY15063634 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.0.pre.alpha.PLAY15063633 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.0.pre.alpha.fixphonenumberinputflag3632 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.0.pre.alpha.fixphonenumberinputflag3631 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.0.pre.alpha.PLAY15063628 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.0.pre.alpha.PLAY15063626 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.0.pre.alpha.PLAY15063624 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.0.pre.alpha.play1432playgroundsanitation3622 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.0.pre.alpha.PLAY15063621 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.0.pre.alpha.PLAY15063620 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.0.pre.alpha.PLAY15063619 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.0.pre.alpha.PLAY15063618 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.3.0.pre.rc.0 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.1.0.pre.alpha.PLAY15063617 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.1.0.pre.alpha.PLAY15063616 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.1.0.pre.alpha.PLAY15063615 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.1.0.pre.alpha.PLAY15063614 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.1.0.pre.alpha.PLAY15063613 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.1.0.pre.alpha.PLAY15063612 app/pb_kits/playbook/pb_dialog/dialog.rb