Sha256: 44831c463b0df943cb2a09b2b84686719c935aff03b038c0b1fad1a06aca6fae

Contents?: true

Size: 1.47 KB

Versions: 12

Compression:

Stored size: 1.47 KB

Contents

module Coprl
  module Presenters
    module DSL
      module Components
        class ExpansionPanel < EventBase
          include Mixins::Common

          attr_accessor :open

          def initialize(**attribs_, &block)
            super(type: :expansion_panel, **attribs_, &block)
            self.text(attribs.delete(:text)) if attribs.key?(:text)
            self.secondary_text(attribs.delete(:secondary_text)) if attribs.key?(:secondary_text)
            @open = attribs.delete(:open) { false }
            expand!
          end

          def text(*text, **attribs, &block)
            return @text if locked?
            @text = Components::Typography.new(parent: self, type: :text, text: text, **attribs, &block)
          end

          def secondary_text(*text, **attribs, &block)
            return @secondary_text if locked?
            @secondary_text = Components::Typography.new(parent: self, type: :text, text: text,  **attribs, &block)
          end

          def content(**attribs, &block)
            return @content if locked?
            @content = Content.new(parent: self, **attribs, &block)
          end

          class Content < EventBase
            include Mixins::Common
            include Mixins::Attaches

            attr_accessor :components

            def initialize(**attribs_, &block)
              super(type: :content, **attribs_, &block)
              @components = []
              expand!
            end
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
coprl-3.0.0.beta.12 lib/coprl/presenters/dsl/components/expansion_panel.rb
coprl-3.0.0.beta.11 lib/coprl/presenters/dsl/components/expansion_panel.rb
coprl-3.0.0.beta.10 lib/coprl/presenters/dsl/components/expansion_panel.rb
coprl-3.0.0.beta.9 lib/coprl/presenters/dsl/components/expansion_panel.rb
coprl-3.0.0.beta.8 lib/coprl/presenters/dsl/components/expansion_panel.rb
coprl-3.0.0.beta.7 lib/coprl/presenters/dsl/components/expansion_panel.rb
coprl-3.0.0.beta.6 lib/coprl/presenters/dsl/components/expansion_panel.rb
coprl-3.0.0.beta.5 lib/coprl/presenters/dsl/components/expansion_panel.rb
coprl-3.0.0.beta.4 lib/coprl/presenters/dsl/components/expansion_panel.rb
coprl-3.0.0.beta.3 lib/coprl/presenters/dsl/components/expansion_panel.rb
coprl-3.0.0.beta.2 lib/coprl/presenters/dsl/components/expansion_panel.rb
coprl-3.0.0.beta.1 lib/coprl/presenters/dsl/components/expansion_panel.rb