Sha256: 3eb42799a0a323be898adc1999529a0292b1c7642f124ffcae9db95642caf7ed

Contents?: true

Size: 785 Bytes

Versions: 7

Compression:

Stored size: 785 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 renderWrapper(): 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

7 entries across 7 versions & 1 rubygems

Version Path
clapton-0.0.24 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.23 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.22 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.21 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.20 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.19 lib/clapton/javascripts/src/components/text-area.ts
clapton-0.0.18 lib/clapton/javascripts/src/components/text-area.ts