@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
51 lines (45 loc) • 1.77 kB
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
;
var index = require('./index-BrhW8s5h.js');
var bemRegistry = require('./bem-registry-DevvgGUu.js');
require('./common-DPb6NWR4.js');
var label = require('./label-DRrPbj-j.js');
require('./variant-quote-DpNzmCtr.js');
var baseController = require('./base-controller-DAzsTqX9.js');
const clickButtonBem = bemRegistry.bem.forBlock('kol-click-button');
const BEM_CLASS_CLICK_BUTTON = clickButtonBem();
const BEM_CLASS_CLICK_BUTTON__LABEL = clickButtonBem('label');
const ClickButtonFC = ({ label, handleClick, refButton }) => (index.h("button", { class: BEM_CLASS_CLICK_BUTTON, ref: refButton, onClick: handleClick, onKeyDown: (event) => event.preventDefault() }, index.h("span", { class: BEM_CLASS_CLICK_BUTTON__LABEL }, label)));
const clickButtonPropsConfig = {
required: [label.labelProp],
};
class ClickButtonController extends baseController.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) {
label.labelProp.apply(value, (v) => {
this.setRenderProp('label', v);
});
}
focus() {
var _a;
(_a = this.buttonRef) === null || _a === void 0 ? void 0 : _a.focus();
}
}
exports.ClickButtonController = ClickButtonController;
exports.ClickButtonFC = ClickButtonFC;
//# sourceMappingURL=controller-CHDjVlC1.js.map
//# sourceMappingURL=controller-CHDjVlC1.js.map