UNPKG

@s-ui/react-molecule-field

Version:

`MoleculeField` is a component that wraps a composition of Label + some input (input, textarea, ...) + Validation Messages.

21 lines 822 B
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; var _excluded = ["name", "children"]; import PropTypes from 'prop-types'; import Injector from '@s-ui/react-primitive-injector'; import { CLASS_NODE_LABEL_CONTAINER, getLabeled } from './config.js'; import { jsx as _jsx } from "react/jsx-runtime"; var MoleculeLabel = function MoleculeLabel(_ref) { var name = _ref.name, children = _ref.children, rest = _objectWithoutPropertiesLoose(_ref, _excluded); return /*#__PURE__*/_jsx("div", { className: CLASS_NODE_LABEL_CONTAINER, children: /*#__PURE__*/_jsx(Injector, _extends({ htmlFor: name }, rest, { children: getLabeled(children) })) }); }; export default MoleculeLabel;