Sha256: b3be8a6acca11b5365a4776216c660ac686d8219bbcd2dfd5f4ecaef25b58e86

Contents?: true

Size: 1.66 KB

Versions: 378

Compression:

Stored size: 1.66 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 :loading
      prop :confirm_button
      prop :confirm_button_id
      prop :cancel_button
      prop :cancel_button_id
      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

378 entries across 378 versions & 1 rubygems

Version Path
playbook_ui-14.10.0.pre.rc.23 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.10.0.pre.rc.22 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.10.0.pre.rc.21 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.9.0.pre.alpha.play1703errorstatealignment5060 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.10.0.pre.rc.20 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.10.0.pre.rc.19 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.10.0.pre.rc.18 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.9.0.pre.alpha.PLAY1660reactdropzone5020 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.10.0.pre.rc.17 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.10.0.pre.rc.16 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.9.0.pre.alpha.play17004992 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.9.0.pre.alpha.play1703errorstatealignment4991 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.10.0.pre.rc.15 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.9.0.pre.alpha.PLAY16264952 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.9.0.pre.alpha.PLAY1731inputmasking4927 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.9.0.pre.alpha.play1742globalheightfixes4926 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.9.0.pre.alpha.play1742globalheightfixes4925 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.10.0.pre.rc.14 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.10.0.pre.rc.13 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.9.0.pre.alpha.PBNTR746datepickerdefaultbug4903 app/pb_kits/playbook/pb_dialog/dialog.rb