PromoCursed/node_modules/.cache/babel-loader/0bff1d7137dcd97414fcd86f8a6fe147033cc56088fe20de7c744b1ef0ef6d07.json

1 line
11 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nvar _excluded = [\"prefixCls\", \"className\", \"style\", \"checked\", \"disabled\", \"defaultChecked\", \"type\", \"title\", \"onChange\"];\nimport classNames from 'classnames';\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport * as React from 'react';\nimport { forwardRef, useImperativeHandle, useRef } from 'react';\nexport var Checkbox = /*#__PURE__*/forwardRef(function (props, ref) {\n var _props$prefixCls = props.prefixCls,\n prefixCls = _props$prefixCls === void 0 ? 'rc-checkbox' : _props$prefixCls,\n className = props.className,\n style = props.style,\n checked = props.checked,\n disabled = props.disabled,\n _props$defaultChecked = props.defaultChecked,\n defaultChecked = _props$defaultChecked === void 0 ? false : _props$defaultChecked,\n _props$type = props.type,\n type = _props$type === void 0 ? 'checkbox' : _props$type,\n title = props.title,\n onChange = props.onChange,\n inputProps = _objectWithoutProperties(props, _excluded);\n var inputRef = useRef(null);\n var holderRef = useRef(null);\n var _useMergedState = useMergedState(defaultChecked, {\n value: checked\n }),\n _useMergedState2 = _slicedToArray(_useMergedState, 2),\n rawValue = _useMergedState2[0],\n setRawValue = _useMergedState2[1];\n useImperativeHandle(ref, function () {\n return {\n focus: function focus(options) {\n var _inputRef$current;\n (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus(options);\n },\n blur: function blur() {\n var _inputRef$current2;\n (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.blur();\n },\n input: inputRef.current,\n nativeElement: holderRef.current\n };\n });\n var classString = classNames(prefixCls, className, _defineProperty(_defineProperty({}, \"\".concat(prefixCls, \"-checked\"), rawValue), \"\".concat(prefixCls, \"-disabled\"), disabled));\n var handleChange = function handleChange(e) {\n if (disabled) {\n return;\n }\n if (!('checked' in props)) {\n setRawValue(e.target.checked);\n }\n onChange === null || onChange === void 0 || onChange({\n target: _objectSpread(_objectSpread({}, props), {}, {\n type: type,\n checked: e.target.checked\n }),\n stopPropagation: function stopPropagation() {\n e.stopPropagation();\n },\n preventDefault: function preventDefault() {\n e.preventDefault();\n },\n nativeEvent: e.nativeEvent\n });\n };\n return /*#__PURE__*/React.createElement(\"span\", {\n className: classString,\n title: title,\n style: style,\n ref: holderRef\n }, /*#__PURE__*/React.createElement(\"input\", _extends({}, inputProps, {\n className: \"\".concat(prefixCls, \"-input\"),\n ref: inputRef,\n onChange: handleChange,\n disabled: disabled,\n checked: !!rawValue,\n type: type\n })), /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-inner\")\n }));\n});\nexport default Checkbox;","map":{"version":3,"names":["_extends","_objectSpread","_defineProperty","_slicedToArray","_objectWithoutProperties","_excluded","classNames","useMergedState","React","forwardRef","useImperativeHandle","useRef","Checkbox","props","ref","_props$prefixCls","prefixCls","className","style","checked","disabled","_props$defaultChecked","defaultChecked","_props$type","type","title","onChange","inputProps","inputRef","holderRef","_useMergedState","value","_useMergedState2","rawValue","setRawValue","focus","options","_inputRef$current","