UNPKG

@s-ui/react-molecule-input-field

Version:

`MoleculeInputField` is a component that wraps a composition of Label + Textarea + Validation Messages.

56 lines 2.04 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; var _excluded = ["id", "label", "nodeLabel", "successText", "errorText", "alertText", "helpText", "autoHideHelpText", "inline", "onChange", "useContrastLabel", "fullWidth"]; import PropTypes from 'prop-types'; import AtomInput from '@s-ui/react-atom-input'; import MoleculeField from '@s-ui/react-molecule-field'; import { getErrorState, getState } from './config.js'; import { jsx as _jsx } from "react/jsx-runtime"; var MoleculeInputField = function MoleculeInputField(_ref) { var id = _ref.id, label = _ref.label, nodeLabel = _ref.nodeLabel, successText = _ref.successText, errorText = _ref.errorText, alertText = _ref.alertText, helpText = _ref.helpText, _ref$autoHideHelpText = _ref.autoHideHelpText, autoHideHelpText = _ref$autoHideHelpText === void 0 ? false : _ref$autoHideHelpText, inline = _ref.inline, onChange = _ref.onChange, useContrastLabel = _ref.useContrastLabel, fullWidth = _ref.fullWidth, props = _objectWithoutPropertiesLoose(_ref, _excluded); var errorState = getErrorState({ successText: successText, errorText: errorText }); var inputState = getState({ successText: successText, errorState: errorState, alertText: alertText }); var disabled = props.disabled; return /*#__PURE__*/_jsx(MoleculeField, { name: id, label: label, nodeLabel: nodeLabel, successText: successText, errorText: errorText, alertText: alertText, helpText: helpText, autoHideHelpText: autoHideHelpText, inline: inline, disabled: disabled, onChange: onChange, useContrastLabel: useContrastLabel, fullWidth: fullWidth, children: /*#__PURE__*/_jsx(AtomInput, _extends({ id: id, errorState: errorState, state: inputState }, props)) }); }; MoleculeInputField.displayName = 'MoleculeInputField'; export default MoleculeInputField;