Sha256: 82f275df9b65163b7fe33b98f35ceccd0d919e9af2859acfdc88bd0af8aefc39

Contents?: true

Size: 623 Bytes

Versions: 19

Compression:

Stored size: 623 Bytes

Contents

class TextInputComponent < ViewComponent::Base
  erb_template <<~ERB
    <input <%= @disabled ? "disabled" : "" %> <%= sanitize @attributes.join(" ") %>>
  ERB

  def initialize(attributes = {})
    @disabled = attributes[:disabled] || false
    attributes[:class] = "border-gray-300 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 focus:border-indigo-500 dark:focus:border-indigo-600 focus:ring-indigo-500 dark:focus:ring-indigo-600 rounded-md shadow-sm#{" #{attributes[:class]}" if attributes[:class]}"
    @attributes = attributes.without(:disabled).map { |key, attribute| "#{key}=\"#{attribute}\"" }
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
kaze-1.0.1 stubs/hotwire/app/components/text_input_component.rb
kaze-1.0.0 stubs/hotwire/app/components/text_input_component.rb
kaze-0.19.0 stubs/hotwire/app/components/text_input_component.rb
kaze-0.18.0 stubs/hotwire/app/components/text_input_component.rb
kaze-0.17.0 stubs/hotwire/app/components/text_input_component.rb
kaze-0.16.0 stubs/hotwire/app/components/text_input_component.rb
kaze-0.15.0 stubs/hotwire/app/components/text_input_component.rb
kaze-0.14.0 stubs/hotwire/app/components/text_input_component.rb
kaze-0.13.0 stubs/hotwire/app/components/text_input_component.rb
kaze-0.12.0 stubs/hotwire/app/components/text_input_component.rb
kaze-0.11.0 stubs/hotwire/app/components/text_input_component.rb
kaze-0.10.0 stubs/hotwire/app/components/text_input_component.rb
kaze-0.9.0 stubs/hotwire/app/components/text_input_component.rb
kaze-0.8.0 stubs/hotwire/app/components/text_input_component.rb
kaze-0.7.0 stubs/hotwire/app/components/text_input_component.rb
kaze-0.6.0 stubs/hotwire/app/components/text_input_component.rb
kaze-0.5.0 stubs/hotwire/app/components/text_input_component.rb
kaze-0.4.0 stubs/hotwire/app/components/text_input_component.rb
kaze-0.3.0 stubs/hotwire/app/components/text_input_component.rb