UNPKG

@public-ui/components

Version:

Contains all web components that belong to KoliBri - The accessible HTML-Standard.

45 lines (44 loc) 1.5 kB
/*! * KoliBri - The accessible HTML-Standard */ import { translate } from "../../../i18n"; import { labelProp, showProp, variantSpinProp } from "../../props"; import { BaseController } from "../base-controller"; import { spinPropsConfig } from "./api"; export class SpinController extends BaseController { constructor(stateAccess) { super(stateAccess, spinPropsConfig); this.translateActionRunning = translate('kol-action-running'); this.translateActionDone = translate('kol-action-done'); this.handleGetTranslateActionRunning = () => { return this.translateActionRunning; }; this.handleGetTranslateActionDone = () => { return this.translateActionDone; }; } componentWillLoad(props) { const { show, label, variant } = props; this.watchShow(show); this.watchLabel(label); this.watchVariant(variant); } watchShow(value) { showProp.apply(value, (v) => { const previousShow = this.getRenderProp('show'); this.setRenderProp('show', v); this.setState('showToggled', previousShow === true && v === false); }); } watchLabel(value) { labelProp.apply(value, (v) => { this.setRenderProp('label', v); }); } watchVariant(value) { variantSpinProp.apply(value, (v) => { this.setRenderProp('variant', v); }); } } //# sourceMappingURL=controller.js.map