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.3.0.pre.rc.7 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.3.0.pre.rc.6 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.3.0.pre.rc.5 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.3.0.pre.rc.4 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.1.pre.alpha.20240828cikubedbump3702 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.3.0.pre.rc.3 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.1.pre.alpha.PBNTR431fixingduplicatingtextareaclassname3689 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.3.0.pre.rc.2 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.1.pre.alpha.PLAY1516railsiconsfixedwidth3674 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.1.pre.alpha.PBNTR479removeextraspacingfromradiochildren3671 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.3.0.pre.rc.1 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.1.pre.alpha.PBNTR479removeextraspacingfromradiochildren3669 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.1.pre.alpha.pbntr373enablekitsforradio3665 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.1.pre.alpha.bugfixforactionrc3663 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.0.pre.alpha.PLAY15063653 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.0.pre.alpha.PLAY15063645 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.1 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.0.pre.alpha.PLAY15063640 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.0.pre.alpha.PLAY15063639 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.2.0.pre.alpha.PLAY15063638 app/pb_kits/playbook/pb_dialog/dialog.rb