UNPKG

fomantic-ui-react

Version:

Fomantic-UI React -- A React Component Library.

102 lines (83 loc) 3.23 kB
/** * fomantic-ui-react v0.0.1-alpha.10 * (c) 2022 FireLoong <fireloong@foxmail.com> * @license MIT */ import { _ as _defineProperty, a as _objectWithoutProperties } from '../_chunks/dep-9f1126c1.js'; import React, { forwardRef } from 'react'; import { Icon } from '../icon/index.js'; import '../icon/Icon.js'; import './style/css.js'; import '../icon/type.js'; var _excluded = ["as", "className", "focus", "style", "icon", "iconPosition", "loading", "loadingDouble", "loadingColor", "loadingFast", "loadingElastic", "disabled", "error"]; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } var Input = /*#__PURE__*/forwardRef(function (_ref, ref) { var _ref$as = _ref.as, as = _ref$as === void 0 ? "div" : _ref$as, className = _ref.className, focus = _ref.focus, style = _ref.style, icon = _ref.icon, iconPosition = _ref.iconPosition, loading = _ref.loading, loadingDouble = _ref.loadingDouble, loadingColor = _ref.loadingColor, loadingFast = _ref.loadingFast, loadingElastic = _ref.loadingElastic, disabled = _ref.disabled, error = _ref.error, props = _objectWithoutProperties(_ref, _excluded); var renderIcon = false; var classNames = ["ui", "input"]; if (focus) { classNames.push("focus"); } if (iconPosition) { classNames.push(iconPosition); } if (icon) { classNames.push("icon"); renderIcon = true; } if (loading) { classNames.push("icon"); classNames.push("loading"); renderIcon = true; icon = "search"; } if (loadingDouble) { classNames.push("double"); } if (loadingColor) { classNames.push(loadingColor); } if (loadingFast) { classNames.push("fast"); } if (loadingElastic) { classNames.push("elastic"); } if (disabled) { classNames.push("disabled"); } if (error) { classNames.push("error"); } if (className) { classNames.push(className); } return /*#__PURE__*/React.createElement(as, { ref: ref, className: classNames.join(" "), style: style }, /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement("input", _objectSpread({ type: "text", disabled: disabled }, props)), renderIcon && /* @__PURE__ */React.createElement(Icon, { name: icon }))); }); Input.displayName = "Input"; export { Input as default }; //# sourceMappingURL=Input.js.map