PromoCursed/node_modules/.cache/babel-loader/6b9424ef2495da4f04be3d092dc7c885fc3d53d87bc3afa4069a0d3aa70824c8.json

1 line
17 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 { 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 GroupContext from './GroupContext';\nimport useStyle from './style';\nconst InternalCheckbox = (props, ref) => {\n var _a;\n const {\n prefixCls: customizePrefixCls,\n className,\n rootClassName,\n children,\n indeterminate = false,\n style,\n onMouseEnter,\n onMouseLeave,\n skipGroup = false,\n disabled\n } = props,\n restProps = __rest(props, [\"prefixCls\", \"className\", \"rootClassName\", \"children\", \"indeterminate\", \"style\", \"onMouseEnter\", \"onMouseLeave\", \"skipGroup\", \"disabled\"]);\n const {\n getPrefixCls,\n direction,\n checkbox\n } = React.useContext(ConfigContext);\n const checkboxGroup = React.useContext(GroupContext);\n const {\n isFormItemInput\n } = React.useContext(FormItemInputContext);\n const contextDisabled = React.useContext(DisabledContext);\n const mergedDisabled = (_a = (checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.disabled) || disabled) !== null && _a !== void 0 ? _a : contextDisabled;\n const prevValue = React.useRef(restProps.value);\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning('Checkbox');\n process.env.NODE_ENV !== \"production\" ? warning('checked' in restProps || !!checkboxGroup || !('value' in restProps), 'usage', '`value` is not a valid prop, do you mean `checked`?') : void 0;\n }\n React.useEffect(() => {\n checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.registerValue(restProps.value);\n }, []);\n React.useEffect(() => {\n if (skipGroup) {\n return;\n }\n if (restProps.value !== prevValue.current) {\n checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.cancelValue(prevValue.current);\n checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.registerValue(restProps.value);\n prevValue.current = restProps.value;\n }\n return () => checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.cancelValue(restProps.value);\n }, [restProps.value]);\n const prefixCls = getPrefixCls('checkbox', customizePrefixCls);\n const rootCls = useCSSVarCls(prefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootCls);\n const checkboxProps = Object.assign({}, restProps);\n if (checkboxGroup && !skipGroup) {\n checkboxProps.onChange = function () {\n if (restProps.onChange) {\n restProps.onChange.apply(restProps, arguments);\n }\n if (checkboxGroup.toggleOption) {\n checkboxGroup.toggleOption({\n label: children,\n value: restProps.value\n });\n }\n };\n checkboxProps.name = checkboxGroup.name;\n checkboxProps.checked = checkboxGroup.value.includes(restProps.value);\n }\n const classString = classNames(`${prefixCls}-wrapper`, {\n [`${prefixCls}-rtl`]: direction === 'rtl',\n [`${prefixCls}-wrapper-checked`]: checkboxProps.checked,\n [`${prefixCls}-wrapper-disabled`]: mergedDisabled,\n [`${prefixCls}-wrapper-in-form-item`]: isFormItemInput\n }