@aurelia-mdc-web/select
Version:
Wrapper for Material Components Web Select
35 lines • 1.66 kB
JavaScript
import { __decorate } from "tslib";
import { customAttribute, inject } from 'aurelia-framework';
import { MdcComponent } from '@aurelia-mdc-web/base';
import { MDCSelectIconFoundation } from '@material/select';
export const mdcIconStrings = {
ATTRIBUTE: 'mdc-select-icon'
};
let MdcSelectIcon = class MdcSelectIcon extends MdcComponent {
// eslint-disable-next-line @typescript-eslint/require-await
async initialise() {
this.root.classList.add('mdc-select__icon');
}
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 = {
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;
},
registerInteractionHandler: (evtType, handler) => this.listen(evtType, handler),
deregisterInteractionHandler: (evtType, handler) => this.unlisten(evtType, handler),
notifyIconAction: () => this.emit(MDCSelectIconFoundation.strings.ICON_EVENT, {} /* evtData */, true /* shouldBubble */),
};
return new MDCSelectIconFoundation(adapter);
}
};
MdcSelectIcon = __decorate([
inject(Element),
customAttribute(mdcIconStrings.ATTRIBUTE)
], MdcSelectIcon);
export { MdcSelectIcon };
//# sourceMappingURL=mdc-select-icon.js.map