@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
49 lines (44 loc) • 1.66 kB
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
import { h } from '@stencil/core/internal/client';
import { b as bem } from './bem-registry.js';
import './common.js';
import './prop.validators.js';
import { l as labelProp } from './label2.js';
import './variant-quote.js';
import { B as BaseController } from './base-controller.js';
const clickButtonBem = bem.forBlock('kol-click-button');
const BEM_CLASS_CLICK_BUTTON = clickButtonBem();
const BEM_CLASS_CLICK_BUTTON__LABEL = clickButtonBem('label');
const ClickButtonFC = ({ label, handleClick, refButton }) => (h("button", { class: BEM_CLASS_CLICK_BUTTON, ref: refButton, onClick: handleClick, onKeyDown: (event) => event.preventDefault() }, h("span", { class: BEM_CLASS_CLICK_BUTTON__LABEL }, label)));
const clickButtonPropsConfig = {
required: [labelProp],
};
class ClickButtonController extends BaseController {
constructor(stateAccess) {
super(stateAccess, clickButtonPropsConfig);
this.handleClick = () => {
console.log(this, this.buttonRef, 'button clicked');
};
this.setButtonRef = (element) => {
this.buttonRef = element;
};
}
componentWillLoad(props) {
const { label } = props;
this.watchLabel(label);
}
watchLabel(value) {
labelProp.apply(value, (v) => {
this.setRenderProp('label', v);
});
}
focus() {
var _a;
(_a = this.buttonRef) === null || _a === void 0 ? void 0 : _a.focus();
}
}
export { ClickButtonController as C, ClickButtonFC as a };
//# sourceMappingURL=controller3.js.map
//# sourceMappingURL=controller3.js.map