UNPKG

react-widgets-up

Version:

An à la carte set of polished, extensible, and accessible inputs built for React

31 lines 1.33 kB
const _excluded = ["className", "disabled", "readOnly", "value", "tabIndex", "type", "component"]; function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; } import cn from 'classnames'; import * as React from 'react'; const Input = /*#__PURE__*/React.forwardRef((_ref, ref) => { let { className, disabled, readOnly, value, tabIndex, type = 'text', component: Component = 'input' } = _ref, props = _objectWithoutPropertiesLoose(_ref, _excluded); return /*#__PURE__*/React.createElement(Component, _extends({}, props, { ref: ref, type: type, tabIndex: tabIndex || 0, autoComplete: "off", disabled: disabled, readOnly: readOnly, "aria-disabled": disabled, "aria-readonly": readOnly, value: value == null ? '' : value, className: cn(className, 'rw-input') })); }); Input.displayName = 'Input'; export default Input;