1 line
26 KiB
JSON
1 line
26 KiB
JSON
|
{"ast":null,"code":"\"use client\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport React, { forwardRef, useContext, useEffect, useRef } from 'react';\nimport classNames from 'classnames';\nimport RcInput from 'rc-input';\nimport { composeRef } from \"rc-util/es/ref\";\nimport ContextIsolator from '../_util/ContextIsolator';\nimport getAllowClear from '../_util/getAllowClear';\nimport { getMergedStatus, getStatusClassNames } from '../_util/statusUtils';\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport DisabledContext from '../config-provider/DisabledContext';\nimport useCSSVarCls from '../config-provider/hooks/useCSSVarCls';\nimport useSize from '../config-provider/hooks/useSize';\nimport { FormItemInputContext } from '../form/context';\nimport useVariant from '../form/hooks/useVariants';\nimport { useCompactItemContext } from '../space/Compact';\nimport useRemovePasswordTimeout from './hooks/useRemovePasswordTimeout';\nimport useStyle from './style';\nimport { hasPrefixSuffix } from './utils';\nexport function triggerFocus(element, option) {\n if (!element) {\n return;\n }\n element.focus(option);\n // Selection content\n const {\n cursor\n } = option || {};\n if (cursor) {\n const len = element.value.length;\n switch (cursor) {\n case 'start':\n element.setSelectionRange(0, 0);\n break;\n case 'end':\n element.setSelectionRange(len, len);\n break;\n default:\n element.setSelectionRange(0, len);\n }\n }\n}\nconst Input = /*#__PURE__*/forwardRef((props, ref) => {\n var _a;\n const {\n prefixCls: customizePrefixCls,\n bordered = true,\n status: customStatus,\n size: customSize,\n disabled: customDisabled,\n onBlur,\n onFocus,\n suffix,\n allowClear,\n addonAfter,\n addonBefore,\n className,\n style,\n styles,\n rootClassName,\n onChange,\n classNames: classes,\n variant: customVariant\n } = props,\n rest = __rest(props, [\"prefixCls\", \"bordered\", \"status\", \"size\", \"disabled\", \"onBlur\", \"onFocus\", \"suffix\", \"allowClear\", \"addonAfter\", \"addonBefore\", \"className\", \"style\", \"styles\", \"rootClassName\", \"onChange\", \"classNames\", \"variant\"]);\n if (process.env.NODE_ENV !== 'production') {\n const {\n deprecated\n } = devUseWarning('Input');\n deprecated(!('bordered' in props), 'bordered', 'variant');\n }\n const {\n getPrefixCls,\n direction,\n input\n } = React.useContext(ConfigContext);\n const prefixCls = getPrefixCls('input', customizePrefixCls);\n const inputRef = useRef(null);\n // Style\n const rootCls = useCSSVarCls(prefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootCls);\n // ===================== Compact Item =====================\n const {\n compactSize,\n compactItemClassnames\n } = useCompactItemContext(prefixCls, direction);\n // ===================== Size =====================\n const mergedSize = useSize(ctx => {\n var _a;\n return (_a = customSize !== null && customSize !== void 0 ? customSize : compactSize) !== null && _a !== void 0 ? _a : ctx;\n });\n // ===================== Disabled =====================\n const disabled = React.useContext(DisabledContext);\n const mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;\n // ===================== Status =====================\n const {\n status: contextStatus,\n hasFeedback,\n feedbackIcon\n } = useContext(FormItemInputContext);\n const mergedStatus = getMergedSt
|