UNPKG

@tomino/dynamic-form-semantic-ui

Version:

Semantic UI form renderer based on dynamic form generation

14 lines 944 B
import * as React from 'react'; import { observer } from 'mobx-react'; import { onChangeHandler, controlMargin, parseProps } from './properties_common'; import { EditorContext } from '../editor/editor_context'; import { names } from '../common'; export const Checkbox = observer((componentProps) => { const context = React.useContext(EditorContext); const onChange = React.useMemo(() => onChangeHandler.bind({ props: componentProps, editorState: context }), [componentProps, context]); const { readOnly } = componentProps; const { value, error } = parseProps(componentProps, context, true); return (React.createElement("div", { className: controlMargin }, React.createElement("input", { key: (!!value).toString() + 'key', type: "checkbox", name: "source", checked: value, "data-value": value, onChange: onChange, className: names({ invalid: error }), readOnly: readOnly }))); }); //# sourceMappingURL=checkbox.js.map