PromoCursed/node_modules/.cache/babel-loader/31c3f3235ed255c59c60150e50d73ad89132c8a722206535723082055d84da4a.json

1 line
30 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"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};\n/* eslint-disable react/button-has-type */\nimport React, { Children, createRef, useContext, useEffect, useMemo, useState } from 'react';\nimport classNames from 'classnames';\nimport omit from \"rc-util/es/omit\";\nimport { composeRef } from \"rc-util/es/ref\";\nimport { devUseWarning } from '../_util/warning';\nimport Wave from '../_util/wave';\nimport { ConfigContext } from '../config-provider';\nimport DisabledContext from '../config-provider/DisabledContext';\nimport useSize from '../config-provider/hooks/useSize';\nimport { useCompactItemContext } from '../space/Compact';\nimport Group, { GroupSizeContext } from './button-group';\nimport { isTwoCNChar, isUnBorderedButtonType, spaceChildren } from './buttonHelpers';\nimport IconWrapper from './IconWrapper';\nimport LoadingIcon from './LoadingIcon';\nimport useStyle from './style';\nimport CompactCmp from './style/compactCmp';\nfunction getLoadingConfig(loading) {\n if (typeof loading === 'object' && loading) {\n let delay = loading === null || loading === void 0 ? void 0 : loading.delay;\n delay = !Number.isNaN(delay) && typeof delay === 'number' ? delay : 0;\n return {\n loading: delay <= 0,\n delay\n };\n }\n return {\n loading: !!loading,\n delay: 0\n };\n}\nconst InternalCompoundedButton = /*#__PURE__*/React.forwardRef((props, ref) => {\n var _a, _b, _c;\n const {\n loading = false,\n prefixCls: customizePrefixCls,\n type,\n danger = false,\n shape = 'default',\n size: customizeSize,\n styles,\n disabled: customDisabled,\n className,\n rootClassName,\n children,\n icon,\n iconPosition = 'start',\n ghost = false,\n block = false,\n // React does not recognize the `htmlType` prop on a DOM element. Here we pick it out of `rest`.\n htmlType = 'button',\n classNames: customClassNames,\n style: customStyle = {},\n autoInsertSpace\n } = props,\n rest = __rest(props, [\"loading\", \"prefixCls\", \"type\", \"danger\", \"shape\", \"size\", \"styles\", \"disabled\", \"className\", \"rootClassName\", \"children\", \"icon\", \"iconPosition\", \"ghost\", \"block\", \"htmlType\", \"classNames\", \"style\", \"autoInsertSpace\"]);\n // https://github.com/ant-design/ant-design/issues/47605\n // Compatible with original `type` behavior\n const mergedType = type || 'default';\n const {\n getPrefixCls,\n direction,\n button\n } = useContext(ConfigContext);\n const mergedInsertSpace = (_a = autoInsertSpace !== null && autoInsertSpace !== void 0 ? autoInsertSpace : button === null || button === void 0 ? void 0 : button.autoInsertSpace) !== null && _a !== void 0 ? _a : true;\n const prefixCls = getPrefixCls('btn', customizePrefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const disabled = useContext(DisabledContext);\n const mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;\n const groupSize = useContext(GroupSizeContext);\n const loadingOrDelay = useMemo(() => getLoadingConfig(loading), [loading]);\n const [innerLoading, setLoading] = useState(loadingOrDelay.loading);\n const [hasTwoCNChar, setHasTwoCNChar] = useState(false);\n const internalRef = /*#__PURE__*/createRef();\n const buttonRef = composeRef(ref, internalRef);\n const needInserted = Children.count(children) === 1 && !icon && !isUnBorderedButtonType(mergedType);\n useEffect(() => {\n let delayTimer = null;\n if (loadingOrDelay.delay > 0) {\n delayTimer = setTimeout(() => {\n delayTimer = null