Sha256: 0ea607af6d97f1d82864435c03bdc08f8e607c905410997a443387c2057a0e3f

Contents?: true

Size: 1.89 KB

Versions: 233

Compression:

Stored size: 1.89 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 top-start top-end bottom-start bottom-end right-start right-end left-start left-end],
                      default: "left"
      prop :trigger_element_id
      prop :tooltip_id
      prop :max_height
      prop :max_width
      prop :min_width
      prop :min_height
      prop :width
      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 += "width: #{width};" if width.present?
        out
      end

      def width_height_class_helper
        "overflow_handling" if max_height || max_width || 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

233 entries across 233 versions & 1 rubygems

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