UNPKG

@aurelia-mdc-web/select

Version:

Wrapper for Material Components Web Select

54 lines 2.34 kB
import { __decorate, __metadata } from "tslib"; import { MdcComponent } from '@aurelia-mdc-web/base'; import { helperTextCssClasses, MDCSelectHelperTextFoundation } from '@material/select'; import { inject, customElement, useView, PLATFORM } from 'aurelia-framework'; import { bindable } from 'aurelia-typed-observable-plugin'; export const mdcHelperTextCssClasses = { ROOT: 'mdc-select-helper-text' }; let MdcSelectHelperText = class MdcSelectHelperText extends MdcComponent { constructor() { super(...arguments); this.helperTextCssClasses = helperTextCssClasses; this.ROOT = mdcHelperTextCssClasses.ROOT; } // Provided for access by MDCTextField component get foundationForTextField() { return this.foundation; } getDefaultFoundation() { // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. const adapter = { addClass: (className) => this.root.classList.add(className), removeClass: (className) => this.root.classList.remove(className), hasClass: (className) => this.root.classList.contains(className), getAttr: (attr) => this.root.getAttribute(attr), setAttr: (attr, value) => this.root.setAttribute(attr, value), removeAttr: (attr) => this.root.removeAttribute(attr), setContent: (content) => { this.root.textContent = content; }, }; return new MDCSelectHelperTextFoundation(adapter); } }; __decorate([ bindable.booleanAttr, __metadata("design:type", Boolean) ], MdcSelectHelperText.prototype, "persistent", void 0); __decorate([ bindable.booleanAttr, __metadata("design:type", Boolean) ], MdcSelectHelperText.prototype, "validation", void 0); __decorate([ bindable.none, __metadata("design:type", Array) ], MdcSelectHelperText.prototype, "errors", void 0); MdcSelectHelperText = __decorate([ inject(Element), useView(PLATFORM.moduleName('./mdc-select-helper-text.html')), customElement(mdcHelperTextCssClasses.ROOT) ], MdcSelectHelperText); export { MdcSelectHelperText }; //# sourceMappingURL=mdc-select-helper-text.js.map