Sha256: e2d1be0110b71fcb32faddc9061f488051e60066b361235a6649d401220239f7

Contents?: true

Size: 972 Bytes

Versions: 6

Compression:

Stored size: 972 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbTextarea
    class Textarea
      include Playbook::Props

      partial "pb_textarea/textarea"

      prop :error
      prop :object
      prop :label
      prop :method
      prop :name
      prop :placeholder
      prop :resize, type: Playbook::Props::Enum,
            values: %w[none both horizontal vertical],
            default: "none"
      prop :rows, type: Playbook::Props::Number,
            default: 4
      prop :value
      prop :character_count
      prop :onkeyup
      prop :max_characters

      def classname
        generate_classname("pb_textarea_kit") + error_class + resize_class
      end

      def character_counter
        max_characters && character_count ? "#{character_count} / #{max_characters}" : character_count
      end

    private

      def error_class
        error ? " error" : ""
      end

      def resize_class
        " resize_#{resize}"
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
playbook_ui-7.14.0.pre.alpha1 app/pb_kits/playbook/pb_textarea/textarea.rb
playbook_ui-7.14.0 app/pb_kits/playbook/pb_textarea/textarea.rb
playbook_ui-7.13.0.pre.alpha1 app/pb_kits/playbook/pb_textarea/textarea.rb
playbook_ui-7.13.0 app/pb_kits/playbook/pb_textarea/textarea.rb
playbook_ui-7.12.1 app/pb_kits/playbook/pb_textarea/textarea.rb
playbook_ui-7.12.0 app/pb_kits/playbook/pb_textarea/textarea.rb