Sha256: 39c15e4c7d155cb585a3fb40065ef16a2a96019f1e1d9b3672c92fc205c1217d

Contents?: true

Size: 1.83 KB

Versions: 148

Compression:

Stored size: 1.83 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbTable
    class Table < Playbook::KitBase
      prop :size, type: Playbook::Props::Enum,
                  values: %w[sm md lg],
                  default: "md"
      prop :single_line, type: Playbook::Props::Boolean,
                         default: false
      prop :disable_hover, type: Playbook::Props::Boolean,
                           default: false
      prop :data_table, type: Playbook::Props::Boolean,
                        default: false
      prop :container, type: Playbook::Props::Boolean,
                       default: true
      prop :responsive, type: Playbook::Props::Enum,
                        values: %w[collapse scroll none],
                        default: "collapse"
      prop :collapse, type: Playbook::Props::Enum,
                      values: %w[sm md lg],
                      default: "sm"
      prop :text
      prop :sticky, type: Playbook::Props::Boolean,
                    default: false

      def classname
        generate_classname(
          "pb_table", "table-#{size}", single_line_class, dark_class,
          disable_hover_class, container_class, data_table_class, sticky_class, collapse_class,
          "table-responsive-#{responsive}", separator: " "
        )
      end

    private

      def dark_class
        dark ? "table-dark" : nil
      end

      def data_table_class
        data_table ? "data_table" : nil
      end

      def single_line_class
        single_line ? "single-line" : nil
      end

      def disable_hover_class
        disable_hover ? "no-hover" : nil
      end

      def container_class
        container ? "table-card" : nil
      end

      def collapse_class
        responsive != "none" ? "table-collapse-#{collapse}" : ""
      end

      def sticky_class
        sticky ? "sticky-header" : nil
      end
    end
  end
end

Version data entries

148 entries across 148 versions & 1 rubygems

Version Path
playbook_ui-12.16.0.pre.alpha.tooltippositionprop566 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-12.16.0.pre.alpha.PLAY693tooltipwrongbg558 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-12.16.0.pre.alpha.PLAY693tooltipwrongbg547 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-12.16.0.pre.alpha.PLAY693tooltipwrongbg532 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-12.16.0.pre.alpha.lightboxcurrentphotoprop531 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-12.16.0.pre.alpha.tiptaptestingpart1528 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-12.16.0 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-12.15.0 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-12.14.0.pre.alpha.lightboxcurrentphotoprop460 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-12.14.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown457 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-12.14.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown456 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-12.14.0 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-12.13.0.pre.alpha.PLAY693tooltipwrongbg440 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-12.13.0.pre.alpha.addingProductTokens439 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-12.13.0.pre.alpha.PLAY705phonenumberkit438 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-12.13.0 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-12.12.0.pre.alpha.PLAY697sandpacklayoutstyles413 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-12.12.0 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-12.11.0 app/pb_kits/playbook/pb_table/table.rb
playbook_ui-12.10.0.pre.alpha.PLAY705phonenumberreturn372 app/pb_kits/playbook/pb_table/table.rb