UNPKG

@limetech/lime-elements

Version:
36 lines (35 loc) 1.09 kB
import React from 'react'; import { LimeElementsWidgetAdapter } from '../adapters'; export class Checkbox extends React.Component { constructor(props) { super(props); this.props = props; this.handleChange = this.handleChange.bind(this); } render() { const props = this.props; const additionalProps = getAdditionalProps(props.schema); return React.createElement(LimeElementsWidgetAdapter, { name: 'limel-checkbox', value: props.value, widgetProps: props, extraProps: Object.assign({ checked: !!props.value }, additionalProps), events: { change: this.handleChange, }, }); } handleChange(event) { const props = this.props; event.stopPropagation(); if (!props.onChange) { return; } props.onChange(event.detail); } } function getAdditionalProps(schema) { var _a, _b, _c; return (_c = (_b = (_a = schema.lime) === null || _a === void 0 ? void 0 : _a.component) === null || _b === void 0 ? void 0 : _b.props) !== null && _c !== void 0 ? _c : {}; } //# sourceMappingURL=checkbox.js.map