Sha256: 467560927f658d41e9776cc542e4dbb5a6bb43f7269cadf58fac1d0b0bbd2dd5

Contents?: true

Size: 1.04 KB

Versions: 726

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

module Playbook
  module PbDashboardValue
    class DashboardValue < Playbook::KitBase
      prop :align, type: Playbook::Props::Enum,
                   values: %w[left center right],
                   default: "left"
      prop :stat_change, type: Playbook::Props::HashProp,
                         default: {}
      prop :stat_label
      prop :stat_value, type: Playbook::Props::HashProp,
                        default: {}

      def formatted_stat_value
        { **stat_value, value: sanitized_stat_value }
      end

      def classname
        generate_classname("pb_dashboard_value_kit", align)
      end

      # rubocop:disable Lint/FloatComparison
      # Comparing the value coerced to a float versus an integer is the point of this methodd
      def sanitized_stat_value
        value = stat_value[:value]
        if value.is_a?(::String)
          value.to_f == value.to_i ? value.to_i : value.to_f
        else
          value
        end
      end
      # rubocop:enable Lint/FloatComparison
    end
  end
end

Version data entries

726 entries across 726 versions & 1 rubygems

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