PromoCursed/node_modules/.cache/babel-loader/293b0da27ebd260efb9213e4f9677a46ec6c040ff86e8c6b1233b24c72111f1f.json

1 line
15 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};\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport RcCheckbox from 'rc-checkbox';\nimport { composeRef } from \"rc-util/es/ref\";\nimport { devUseWarning } from '../_util/warning';\nimport Wave from '../_util/wave';\nimport { TARGET_CLS } from '../_util/wave/interface';\nimport { ConfigContext } from '../config-provider';\nimport DisabledContext from '../config-provider/DisabledContext';\nimport useCSSVarCls from '../config-provider/hooks/useCSSVarCls';\nimport { FormItemInputContext } from '../form/context';\nimport RadioGroupContext, { RadioOptionTypeContext } from './context';\nimport useStyle from './style';\nconst InternalRadio = (props, ref) => {\n var _a, _b;\n const groupContext = React.useContext(RadioGroupContext);\n const radioOptionTypeContext = React.useContext(RadioOptionTypeContext);\n const {\n getPrefixCls,\n direction,\n radio\n } = React.useContext(ConfigContext);\n const innerRef = React.useRef(null);\n const mergedRef = composeRef(ref, innerRef);\n const {\n isFormItemInput\n } = React.useContext(FormItemInputContext);\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning('Radio');\n process.env.NODE_ENV !== \"production\" ? warning(!('optionType' in props), 'usage', '`optionType` is only support in Radio.Group.') : void 0;\n }\n const onChange = e => {\n var _a, _b;\n (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, e);\n (_b = groupContext === null || groupContext === void 0 ? void 0 : groupContext.onChange) === null || _b === void 0 ? void 0 : _b.call(groupContext, e);\n };\n const {\n prefixCls: customizePrefixCls,\n className,\n rootClassName,\n children,\n style,\n title\n } = props,\n restProps = __rest(props, [\"prefixCls\", \"className\", \"rootClassName\", \"children\", \"style\", \"title\"]);\n const radioPrefixCls = getPrefixCls('radio', customizePrefixCls);\n const isButtonType = ((groupContext === null || groupContext === void 0 ? void 0 : groupContext.optionType) || radioOptionTypeContext) === 'button';\n const prefixCls = isButtonType ? `${radioPrefixCls}-button` : radioPrefixCls;\n // Style\n const rootCls = useCSSVarCls(radioPrefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(radioPrefixCls, rootCls);\n const radioProps = Object.assign({}, restProps);\n // ===================== Disabled =====================\n const disabled = React.useContext(DisabledContext);\n if (groupContext) {\n radioProps.name = groupContext.name;\n radioProps.onChange = onChange;\n radioProps.checked = props.value === groupContext.value;\n radioProps.disabled = (_a = radioProps.disabled) !== null && _a !== void 0 ? _a : groupContext.disabled;\n }\n radioProps.disabled = (_b = radioProps.disabled) !== null && _b !== void 0 ? _b : disabled;\n const wrapperClassString = classNames(`${prefixCls}-wrapper`, {\n [`${prefixCls}-wrapper-checked`]: radioProps.checked,\n [`${prefixCls}-wrapper-disabled`]: radioProps.disabled,\n [`${prefixCls}-wrapper-rtl`]: direction === 'rtl',\n [`${prefixCls}-wrapper-in-form-item`]: isFormItemInput\n }, radio === null || radio === void 0 ? void 0 : radio.className, className, rootClassName, hashId, cssVarCls, rootCls);\n return wrapCSSVar( /*#__PURE__*/React.createElement(Wave, {\n component: \"Radio\",\n disabled: radioProps.disabled\n }, /*#__PURE__*/React.createElement(\"label\", {\n className: wrapperClassString,\n style: Object.assign(Object.assign({}, radio === null || radio === void 0 ? v