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-13.32.0.pre.alpha.PLAY14143251 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.32.0.pre.alpha.play1416movealiaslogic3239 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.32.0.pre.alpha.PLAY14103236 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.31.0.pre.alpha.play1416movealiaslogic3232 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.31.0.pre.alpha.PBNTR342navtabbing3231 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.31.0.pre.alpha.PBNTR342navtabbing3230 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.32.0 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.31.0.pre.alpha.powercentrainplaybookpt23212 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.31.0.pre.alpha.PLAY10863204 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.31.0.pre.alpha.PLAY10863202 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.31.0.pre.alpha.PLAY882formpillprimaryandneutral3201 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.31.0.pre.alpha.play1262iconstyles3172 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.31.0.pre.alpha.play1262iconstyles3171 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.31.0 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.30.0.pre.alpha.play1367contenttagnoninputkits3159 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.30.0.pre.alpha.20240515remotebuildkitconversion3150 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.30.0.pre.alpha.PBNTR353draggablev53136 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.30.0.pre.alpha.PLAY1328fixtimelinekitglobalpropsreact3096 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.30.0 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.29.0.pre.alpha.removeduplicatekitexampleclass3063 app/pb_kits/playbook/pb_dialog/dialog.rb