Sha256: 27abc306a1920abe5c3e2e3e9564aab05fe18232ebb131617065bf7080ef2ac0

Contents?: true

Size: 1.39 KB

Versions: 24

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

module Ariadne
  # Add a general description of component here
  # Add additional usage considerations or best practices that may aid the user to use the component correctly.
  # @accessibility Add any accessibility considerations
  class RichTextAreaComponent < Ariadne::Component
    DEFAULT_TAG = :div
    DEFAULT_CLASSES = "ariadne-block ariadne-w-full ariadne-border-0 ariadne-py-3 focus:ariadne-ring-0 sm:ariadne-text-sm"

    # @example Default
    #
    #   <%= render(Ariadne::RichTextAreaComponent.new(name: "bodytext", sr_label: "Enter message contents")) { "Example" } %>
    #
    # @param name [Symbol] Identifies the form/param name for this rich text area.
    # @param sr_label [String] A label to introduce these tabs for screen readers.
    # @param has_form [Boolean] Indicates whether this component is wrapped in a form.
    # @param classes [String] <%= link_to_classes_docs %>
    # @param attributes [Hash] <%= link_to_attributes_docs %>
    def initialize(name:, sr_label:, has_form: true, classes: "", attributes: {})
      @tag = DEFAULT_TAG
      @name = name
      @sr_label = sr_label
      @has_form = has_form

      @classes = class_names(
        DEFAULT_CLASSES,
        classes
      )
      @attributes = attributes
      @attributes[:"data-controller"] = "rich-text-area-component"
      @attributes[:"data-has-form"] = true if @has_form
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.12 app/components/ariadne/rich_text_area_component.rb
ariadne_view_components-0.0.12-x86_64-linux app/components/ariadne/rich_text_area_component.rb
ariadne_view_components-0.0.12-x86_64-darwin app/components/ariadne/rich_text_area_component.rb
ariadne_view_components-0.0.12-x64-mingw32 app/components/ariadne/rich_text_area_component.rb
ariadne_view_components-0.0.12-x64-mingw-ucrt app/components/ariadne/rich_text_area_component.rb
ariadne_view_components-0.0.12-arm64-darwin app/components/ariadne/rich_text_area_component.rb
ariadne_view_components-0.0.12-aarch64-linux app/components/ariadne/rich_text_area_component.rb
ariadne_view_components-0.0.11 app/components/ariadne/rich_text_area_component.rb
ariadne_view_components-0.0.11-x86_64-linux app/components/ariadne/rich_text_area_component.rb
ariadne_view_components-0.0.11-x86_64-darwin app/components/ariadne/rich_text_area_component.rb
ariadne_view_components-0.0.11-x64-mingw32 app/components/ariadne/rich_text_area_component.rb
ariadne_view_components-0.0.11-x64-mingw-ucrt app/components/ariadne/rich_text_area_component.rb
ariadne_view_components-0.0.11-arm64-darwin app/components/ariadne/rich_text_area_component.rb
ariadne_view_components-0.0.11-aarch64-linux app/components/ariadne/rich_text_area_component.rb
ariadne_view_components-0.0.10 app/components/ariadne/rich_text_area_component.rb
ariadne_view_components-0.0.10-x86_64-linux app/components/ariadne/rich_text_area_component.rb
ariadne_view_components-0.0.10-x86_64-darwin app/components/ariadne/rich_text_area_component.rb
ariadne_view_components-0.0.10-x64-mingw32 app/components/ariadne/rich_text_area_component.rb
ariadne_view_components-0.0.10-x64-mingw-ucrt app/components/ariadne/rich_text_area_component.rb
ariadne_view_components-0.0.10-arm64-darwin app/components/ariadne/rich_text_area_component.rb