UNPKG

@public-ui/components

Version:

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

48 lines (43 loc) 1.67 kB
/*! * KoliBri - The accessible HTML-Standard */ import { h } from './index-BQlHOxik.js'; import { b as bem } from './bem-registry-CWvl2xho.js'; import './common-Cx_AGO_M.js'; import { l as labelProp } from './label-KTv-zMW0.js'; import './variant-quote-y0Z1TRdz.js'; import { B as BaseController } from './base-controller-CXhqh4cR.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 { ClickButtonFC as C, ClickButtonController as a }; //# sourceMappingURL=controller-osuRO7S2.js.map //# sourceMappingURL=controller-osuRO7S2.js.map