Sha256: fa6a070642c9a9cf7c423a11277c19de26fee9a1b5af964486a397df6cad4801

Contents?: true

Size: 1.38 KB

Versions: 280

Compression:

Stored size: 1.38 KB

Contents

# frozen_string_literal: true

module Playbook
  module Classnames
    def self.included(base)
      base.prop :classname
      base.prop :dark, type: Playbook::Props::Boolean, default: false
    end

    def generate_classname(*name_parts, separator: "_")
      [
        name_parts.compact.join(separator),
        prop(:classname),
        spacing_props,
        dark_props,
        min_width_props,
        max_width_props,
        z_index_props,
        number_spacing_props,
        shadow_props,
        line_height_props,
        display_props,
        cursor_props,
        flex_direction_props,
        flex_wrap_props,
        justify_content_props,
        justify_self_props,
        align_items_props,
        align_content_props,
        align_self_props,
        flex_props,
        flex_grow_props,
        flex_shrink_props,
        order_props,
        position_props,
        hover_props,
        border_radius_props,
        text_align_props,
        overflow_props,
        truncate_props,
        left_props,
        top_props,
        right_props,
        bottom_props,
        vertical_align_props,
      ].compact.join(" ")
    end

    def generate_classname_without_spacing(*name_parts, separator: "_")
      [
        name_parts.compact.join(separator),
        prop(:classname),
      ].compact.join(" ")
    end

  private

    def dark_props
      dark ? "dark" : nil
    end
  end
end

Version data entries

280 entries across 280 versions & 1 rubygems

Version Path
playbook_ui-14.6.2.pre.alpha.PBNTR666advancedtablefirstcolumn4406 lib/playbook/classnames.rb
playbook_ui-14.7.0.pre.rc.12 lib/playbook/classnames.rb
playbook_ui-14.6.2.pre.alpha.PLAY15814384 lib/playbook/classnames.rb
playbook_ui-14.6.2.pre.alpha.PBNTR633dropdownavailablepropstable4380 lib/playbook/classnames.rb
playbook_ui-14.7.0.pre.rc.11 lib/playbook/classnames.rb
playbook_ui-14.7.0.pre.rc.10 lib/playbook/classnames.rb
playbook_ui-14.6.2.pre.alpha.PLAY1551tiptapextbump4350 lib/playbook/classnames.rb
playbook_ui-14.6.2.pre.alpha.PLAY15814348 lib/playbook/classnames.rb
playbook_ui-14.7.0.pre.rc.9 lib/playbook/classnames.rb
playbook_ui-14.7.0.pre.rc.8 lib/playbook/classnames.rb
playbook_ui-14.6.2.pre.alpha.PBNTR633dropdownavailablepropstable4316 lib/playbook/classnames.rb
playbook_ui-14.7.0.pre.rc.7 lib/playbook/classnames.rb
playbook_ui-14.6.2.pre.alpha.PBNTR576tooltiptruncatedformpills4312 lib/playbook/classnames.rb
playbook_ui-14.6.2.pre.alpha.PBNTR633dropdownavailablepropstable4305 lib/playbook/classnames.rb
playbook_ui-14.7.0.pre.rc.6 lib/playbook/classnames.rb
playbook_ui-14.6.2.pre.alpha.PBNTR576tooltiptruncatedformpills4304 lib/playbook/classnames.rb
playbook_ui-14.6.2.pre.alpha.PBNTR633dropdownavailablepropstable4303 lib/playbook/classnames.rb
playbook_ui-14.6.2.pre.alpha.PBNTR576tooltiptruncatedformpills4296 lib/playbook/classnames.rb
playbook_ui-14.6.2.pre.alpha.PLAY1550lazysizesupgrade4295 lib/playbook/classnames.rb
playbook_ui-14.6.2.pre.alpha.PLAY1485selectablecardoverflowoutlinebug4274 lib/playbook/classnames.rb