Sha256: ec5d8ffd2ba0c706db68730b6f295bc383181931557cdfb7ce66b4be879b225a

Contents?: true

Size: 1.73 KB

Versions: 190

Compression:

Stored size: 1.73 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbPopover
    class Popover < Playbook::KitBase
      prop :position, type: Playbook::Props::Enum,
                      values: %w[top bottom left right],
                      default: "left"
      prop :trigger_element_id
      prop :tooltip_id
      prop :max_height
      prop :max_width
      prop :min_width
      prop :min_height
      prop :z_index, type: Playbook::Props::String
      prop :offset, type: Playbook::Props::Boolean, default: false
      prop :close_on_click, type: Playbook::Props::Enum,
                            values: %w[none outside inside any],
                            default: "none"

      def classname
        generate_classname_without_spacing("pb_popover_kit")
      end

      def popover_spacing_helper
        generate_classname(spacing_props.nil? ? "p_sm" : spacing_props)
      end

      def z_index_helper
        z_index.present? ? "z-index: #{z_index}" : ""
      end

      def width_height_helper
        out = ""
        out += "max-height: #{max_height}; " if max_height.present?
        out += "max-width: #{max_width}; " if max_width.present?
        out += "min-height: #{min_height}; " if min_height.present?
        out += "min-width: #{min_width};" if min_width.present?
        out
      end

      def width_height_class_helper
        "overflow_handling" if max_height || max_width
      end

      def data
        Hash(values[:data]).merge(
          pb_popover_kit: true,
          pb_popover_position: position,
          pb_popover_trigger_element_id: trigger_element_id,
          pb_popover_tooltip_id: tooltip_id,
          pb_popover_offset: offset,
          pb_popover_close_on_click: close_on_click
        )
      end
    end
  end
end

Version data entries

190 entries across 190 versions & 1 rubygems

Version Path
playbook_ui-10.9.0 app/pb_kits/playbook/pb_popover/popover.rb
playbook_ui-10.8.1.pre.alpha.flexdeps app/pb_kits/playbook/pb_popover/popover.rb
playbook_ui-10.9.0.pre.alpha1 app/pb_kits/playbook/pb_popover/popover.rb
playbook_ui-10.8.0 app/pb_kits/playbook/pb_popover/popover.rb
playbook_ui-10.7.1 app/pb_kits/playbook/pb_popover/popover.rb
playbook_ui-10.7.0 app/pb_kits/playbook/pb_popover/popover.rb
playbook_ui-10.6.2.pre.alpha.dep app/pb_kits/playbook/pb_popover/popover.rb
playbook_ui-10.6.1.pre.alpha1 app/pb_kits/playbook/pb_popover/popover.rb
playbook_ui-10.6.0 app/pb_kits/playbook/pb_popover/popover.rb
playbook_ui-10.5.0 app/pb_kits/playbook/pb_popover/popover.rb
playbook_ui-10.4.0 app/pb_kits/playbook/pb_popover/popover.rb
playbook_ui-10.3.0 app/pb_kits/playbook/pb_popover/popover.rb
playbook_ui-10.2.1.alpha.sisensefix app/pb_kits/playbook/pb_popover/popover.rb
playbook_ui-10.2.1 app/pb_kits/playbook/pb_popover/popover.rb
playbook_ui-10.2.0 app/pb_kits/playbook/pb_popover/popover.rb
playbook_ui-10.1.0 app/pb_kits/playbook/pb_popover/popover.rb
playbook_ui-10.0.3.pre.alpha.walkthrough2 app/pb_kits/playbook/pb_popover/popover.rb
playbook_ui-10.0.3.pre.alpha.walkthrough app/pb_kits/playbook/pb_popover/popover.rb
playbook_ui-10.0.1.alpha.railscusticon app/pb_kits/playbook/pb_popover/popover.rb
playbook_ui-10.0.2.pre.alpha.pre.iconfix app/pb_kits/playbook/pb_popover/popover.rb