Sha256: fe14d984f0e72c10da4f287c089e042e7b090b4ec8cf812374c273f98b4d719b

Contents?: true

Size: 778 Bytes

Versions: 17

Compression:

Stored size: 778 Bytes

Contents

import { htmlAttributes } from "../html/html-attributes";

export class TextArea {
  state: any;
  attribute: string;
  attributes: Record<string, any>;

  constructor(state: any, attribute: string, attributes: Record<string, any> = {}) {
    this.state = state;
    this.attributes = attributes;
    this.attribute = attribute;
    this.attributes["data-attribute"] = attribute;
  }

  get render(): string {
    return `<textarea ${htmlAttributes(this.attributes)}>${this.state[this.attribute] || ""}</textarea>`;
  }

  add_action(event: string, klass: string, fn: string, options: { debounce?: number } = {}): TextArea {
    this.attributes["data-action"] = `${this.attributes["data-action"] || ""} ${event}->${klass}#${fn}@${options.debounce || 0}`;
    return this;
  }
}

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
clapton-0.0.17 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.16 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.15 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.14 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.13 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.12 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.11 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.10 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.9 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.8 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.7 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.6 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.5 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.4 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.3 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.2 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.1 lib/clapton/javascripts/src/components/text-area.ts