Sha256: 7d189a20b96eadaee7fc8f55cc98dfd50b69ab443b5eab418daa354c9dbc6c64

Contents?: true

Size: 1.03 KB

Versions: 18

Compression:

Stored size: 1.03 KB

Contents

module Coco
  module App
    module Elements
      class ButtonGroup < Coco::Component
        include Concerns::ActsAsButtonGroup
        include Concerns::AcceptsOptions

        accepts_option :size, default: :default, private: true
        accepts_option :theme, default: :primary, private: true
        accepts_option :segmented, from: [true, false], default: false
        accepts_option :floating, from: [true, false], default: false
        accepts_option :collapsible, from: [true, false, nil]

        before_initialize do |kwargs|
          if kwargs[:floating] == true
            kwargs[:segmented] = true
            kwargs[:theme] = :toolbar_floating
          end
          kwargs
        end

        def button_kwargs(kwargs, type = nil)
          args = {
            theme: get_option_value(:theme),
            size: get_option_value(:size),
            **kwargs
          }

          if get_option_value(:collapsible) == false
            args[:collapsible] = false
          end

          args
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
coveragebook_components-0.7.10 app/components/coco/app/elements/button_group/button_group.rb
coveragebook_components-0.7.9 app/components/coco/app/elements/button_group/button_group.rb
coveragebook_components-0.7.8 app/components/coco/app/elements/button_group/button_group.rb
coveragebook_components-0.7.7 app/components/coco/app/elements/button_group/button_group.rb
coveragebook_components-0.7.6 app/components/coco/app/elements/button_group/button_group.rb
coveragebook_components-0.7.5 app/components/coco/app/elements/button_group/button_group.rb
coveragebook_components-0.7.4 app/components/coco/app/elements/button_group/button_group.rb
coveragebook_components-0.7.3 app/components/coco/app/elements/button_group/button_group.rb
coveragebook_components-0.7.2 app/components/coco/app/elements/button_group/button_group.rb
coveragebook_components-0.7.1 app/components/coco/app/elements/button_group/button_group.rb
coveragebook_components-0.7.0 app/components/coco/app/elements/button_group/button_group.rb
coveragebook_components-0.6.5 app/components/coco/app/elements/button_group/button_group.rb
coveragebook_components-0.6.4 app/components/coco/app/elements/button_group/button_group.rb
coveragebook_components-0.6.3 app/components/coco/app/elements/button_group/button_group.rb
coveragebook_components-0.6.2 app/components/coco/app/elements/button_group/button_group.rb
coveragebook_components-0.6.1 app/components/coco/app/elements/button_group/button_group.rb
coveragebook_components-0.6.0 app/components/coco/app/elements/button_group/button_group.rb
coveragebook_components-0.5.7 app/components/coco/app/elements/button_group/button_group.rb