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.34.1.pre.alpha.pbntr258paginationkitforreact3409 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.34.1.pre.alpha.pbntr258paginationkitforreact3404 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.34.1.pre.alpha.powerfontsexternal3403 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-14.0.0 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.34.1.pre.alpha.PLAY14633399 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.34.1.pre.alpha.play1407statvaluekitinconsistencies3388 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.34.1.pre.alpha.PLAY14703378 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.34.0.pre.alpha.PLAY14143373 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.34.0.pre.alpha.PLAY14143372 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.34.1 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3370 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3369 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3368 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.34.0.pre.alpha.PBNTR358responsiveadvancedtablereact3366 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.34.0.pre.alpha.PLAY14143358 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.34.0.pre.alpha.PLAY14143357 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.34.0 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.33.1.pre.alpha.play1407statvaluekitinconsistencies3352 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.33.1.pre.alpha.PLAY14143340 app/pb_kits/playbook/pb_dialog/dialog.rb
playbook_ui-13.33.1.pre.alpha.PLAY14143336 app/pb_kits/playbook/pb_dialog/dialog.rb