Sha256: 36dd4aeb6c408b29a5e3c09fa9bbea9b09cd44fe2345510d0acaa83306014a0f

Contents?: true

Size: 1 KB

Versions: 874

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

module Playbook
  module ZIndex
    def self.included(base)
      base.prop :z_index
    end

    def z_index_values
      %w[1 2 3 4 5 6 7 8 9 10]
    end

    def z_index_options
      {
        z_index: "z-index",
      }
    end

    def screen_size_values
      %w[xs sm md lg xl]
    end

    def z_index_props
      selected_props = z_index_options.keys.select { |sk| try(sk) }
      return nil unless selected_props.present?

      responsive = selected_props.present? && try(:z_index).is_a?(::Hash)
      css = ""
      if responsive
        z_index_value = send(:z_index)
        z_index_value.each do |key, value|
          css += "z_index_#{key}_#{value} " if screen_size_values.include?(key.to_s) && z_index_values.include?(value.to_s)
        end
      else
        selected_props.each do |k|
          z_index_value = send(k)
          css += "z_index_#{z_index_value} " if z_index_values.include? z_index_value
        end
      end

      css unless css.blank?
    end
  end
end

Version data entries

874 entries across 874 versions & 1 rubygems

Version Path
playbook_ui-14.11.1.pre.alpha.PLAY17445539 lib/playbook/z_index.rb
playbook_ui-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 lib/playbook/z_index.rb
playbook_ui-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 lib/playbook/z_index.rb
playbook_ui-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 lib/playbook/z_index.rb
playbook_ui-14.11.1.pre.alpha.PBNTR7495495 lib/playbook/z_index.rb
playbook_ui-14.12.0.pre.rc.11 lib/playbook/z_index.rb
playbook_ui-14.12.0.pre.rc.10 lib/playbook/z_index.rb
playbook_ui-14.12.0.pre.rc.9 lib/playbook/z_index.rb
playbook_ui-14.12.0.pre.rc.8 lib/playbook/z_index.rb
playbook_ui-14.12.0.pre.rc.7 lib/playbook/z_index.rb
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5437 lib/playbook/z_index.rb
playbook_ui-14.11.1.pre.alpha.PBNTR719listdraggablesimple5432 lib/playbook/z_index.rb
playbook_ui-14.11.1.pre.alpha.PBNTR768stickyrightcolumn5431 lib/playbook/z_index.rb
playbook_ui-14.12.0.pre.rc.6 lib/playbook/z_index.rb
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5415 lib/playbook/z_index.rb
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5413 lib/playbook/z_index.rb
playbook_ui-14.12.0.pre.rc.5 lib/playbook/z_index.rb
playbook_ui-14.11.1.pre.alpha.play1724darkmodeauditmap5409 lib/playbook/z_index.rb
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5400 lib/playbook/z_index.rb
playbook_ui-14.11.1.pre.alpha.PBNTR718simiplifieddraggablereact5392 lib/playbook/z_index.rb