PromoCursed/node_modules/.cache/babel-loader/78000dfb3f01e39babc160adf203c52dffe58bc5f12b0f0ccbc63027734ef855.json
2024-08-20 23:25:37 +04:00

1 line
11 KiB
JSON

{"ast":null,"code":"\"use client\";\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport pickAttrs from \"rc-util/es/pickAttrs\";\nimport { ConfigContext } from '../config-provider';\nimport useCSSVarCls from '../config-provider/hooks/useCSSVarCls';\nimport useSize from '../config-provider/hooks/useSize';\nimport { RadioGroupContextProvider } from './context';\nimport Radio from './radio';\nimport useStyle from './style';\nconst RadioGroup = /*#__PURE__*/React.forwardRef((props, ref) => {\n const {\n getPrefixCls,\n direction\n } = React.useContext(ConfigContext);\n const [value, setValue] = useMergedState(props.defaultValue, {\n value: props.value\n });\n const onRadioChange = ev => {\n const lastValue = value;\n const val = ev.target.value;\n if (!('value' in props)) {\n setValue(val);\n }\n const {\n onChange\n } = props;\n if (onChange && val !== lastValue) {\n onChange(ev);\n }\n };\n const {\n prefixCls: customizePrefixCls,\n className,\n rootClassName,\n options,\n buttonStyle = 'outline',\n disabled,\n children,\n size: customizeSize,\n style,\n id,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur\n } = props;\n const prefixCls = getPrefixCls('radio', customizePrefixCls);\n const groupPrefixCls = `${prefixCls}-group`;\n // Style\n const rootCls = useCSSVarCls(prefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootCls);\n let childrenToRender = children;\n // 如果存在 options, 优先使用\n if (options && options.length > 0) {\n childrenToRender = options.map(option => {\n if (typeof option === 'string' || typeof option === 'number') {\n // 此处类型自动推导为 string\n return /*#__PURE__*/React.createElement(Radio, {\n key: option.toString(),\n prefixCls: prefixCls,\n disabled: disabled,\n value: option,\n checked: value === option\n }, option);\n }\n // 此处类型自动推导为 { label: string value: string }\n return /*#__PURE__*/React.createElement(Radio, {\n key: `radio-group-value-options-${option.value}`,\n prefixCls: prefixCls,\n disabled: option.disabled || disabled,\n value: option.value,\n checked: value === option.value,\n title: option.title,\n style: option.style,\n id: option.id,\n required: option.required\n }, option.label);\n });\n }\n const mergedSize = useSize(customizeSize);\n const classString = classNames(groupPrefixCls, `${groupPrefixCls}-${buttonStyle}`, {\n [`${groupPrefixCls}-${mergedSize}`]: mergedSize,\n [`${groupPrefixCls}-rtl`]: direction === 'rtl'\n }, className, rootClassName, hashId, cssVarCls, rootCls);\n return wrapCSSVar( /*#__PURE__*/React.createElement(\"div\", Object.assign({}, pickAttrs(props, {\n aria: true,\n data: true\n }), {\n className: classString,\n style: style,\n onMouseEnter: onMouseEnter,\n onMouseLeave: onMouseLeave,\n onFocus: onFocus,\n onBlur: onBlur,\n id: id,\n ref: ref\n }), /*#__PURE__*/React.createElement(RadioGroupContextProvider, {\n value: {\n onChange: onRadioChange,\n value,\n disabled: props.disabled,\n name: props.name,\n optionType: props.optionType\n }\n }, childrenToRender)));\n});\nexport default /*#__PURE__*/React.memo(RadioGroup);","map":{"version":3,"names":["React","classNames","useMergedState","pickAttrs","ConfigContext","useCSSVarCls","useSize","RadioGroupContextProvider","Radio","useStyle","RadioGroup","forwardRef","props","ref","getPrefixCls","direction","useContext","value","setValue","defaultValue","onRadioChange","ev","lastValue","val","target","onChange","prefixCls","customizePrefixCls","className","rootClassName","options","buttonStyle","disabled","children","size","customizeSize","style","id","onMouseEnter","onMouseLeave","onFocus","onBlur","groupPrefixCls","rootCls","wrapCSSVar","hashId","cssVarCls","childrenToRender","length","map","option","createElement","key","toString","checked","title","required","label","mergedSize","classString","Object","assign","aria","data","name","optionType","memo"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/radio/group.js"],"sourcesContent":["\"use client\";\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport pickAttrs from \"rc-util/es/pickAttrs\";\nimport { ConfigContext } from '../config-provider';\nimport useCSSVarCls from '../config-provider/hooks/useCSSVarCls';\nimport useSize from '../config-provider/hooks/useSize';\nimport { RadioGroupContextProvider } from './context';\nimport Radio from './radio';\nimport useStyle from './style';\nconst RadioGroup = /*#__PURE__*/React.forwardRef((props, ref) => {\n const {\n getPrefixCls,\n direction\n } = React.useContext(ConfigContext);\n const [value, setValue] = useMergedState(props.defaultValue, {\n value: props.value\n });\n const onRadioChange = ev => {\n const lastValue = value;\n const val = ev.target.value;\n if (!('value' in props)) {\n setValue(val);\n }\n const {\n onChange\n } = props;\n if (onChange && val !== lastValue) {\n onChange(ev);\n }\n };\n const {\n prefixCls: customizePrefixCls,\n className,\n rootClassName,\n options,\n buttonStyle = 'outline',\n disabled,\n children,\n size: customizeSize,\n style,\n id,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur\n } = props;\n const prefixCls = getPrefixCls('radio', customizePrefixCls);\n const groupPrefixCls = `${prefixCls}-group`;\n // Style\n const rootCls = useCSSVarCls(prefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootCls);\n let childrenToRender = children;\n // 如果存在 options, 优先使用\n if (options && options.length > 0) {\n childrenToRender = options.map(option => {\n if (typeof option === 'string' || typeof option === 'number') {\n // 此处类型自动推导为 string\n return /*#__PURE__*/React.createElement(Radio, {\n key: option.toString(),\n prefixCls: prefixCls,\n disabled: disabled,\n value: option,\n checked: value === option\n }, option);\n }\n // 此处类型自动推导为 { label: string value: string }\n return /*#__PURE__*/React.createElement(Radio, {\n key: `radio-group-value-options-${option.value}`,\n prefixCls: prefixCls,\n disabled: option.disabled || disabled,\n value: option.value,\n checked: value === option.value,\n title: option.title,\n style: option.style,\n id: option.id,\n required: option.required\n }, option.label);\n });\n }\n const mergedSize = useSize(customizeSize);\n const classString = classNames(groupPrefixCls, `${groupPrefixCls}-${buttonStyle}`, {\n [`${groupPrefixCls}-${mergedSize}`]: mergedSize,\n [`${groupPrefixCls}-rtl`]: direction === 'rtl'\n }, className, rootClassName, hashId, cssVarCls, rootCls);\n return wrapCSSVar( /*#__PURE__*/React.createElement(\"div\", Object.assign({}, pickAttrs(props, {\n aria: true,\n data: true\n }), {\n className: classString,\n style: style,\n onMouseEnter: onMouseEnter,\n onMouseLeave: onMouseLeave,\n onFocus: onFocus,\n onBlur: onBlur,\n id: id,\n ref: ref\n }), /*#__PURE__*/React.createElement(RadioGroupContextProvider, {\n value: {\n onChange: onRadioChange,\n value,\n disabled: props.disabled,\n name: props.name,\n optionType: props.optionType\n }\n }, childrenToRender)));\n});\nexport default /*#__PURE__*/React.memo(RadioGroup);"],"mappings":"AAAA,YAAY;;AAEZ,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,cAAc,MAAM,iCAAiC;AAC5D,OAAOC,SAAS,MAAM,sBAAsB;AAC5C,SAASC,aAAa,QAAQ,oBAAoB;AAClD,OAAOC,YAAY,MAAM,uCAAuC;AAChE,OAAOC,OAAO,MAAM,kCAAkC;AACtD,SAASC,yBAAyB,QAAQ,WAAW;AACrD,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAOC,QAAQ,MAAM,SAAS;AAC9B,MAAMC,UAAU,GAAG,aAAaV,KAAK,CAACW,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAC/D,MAAM;IACJC,YAAY;IACZC;EACF,CAAC,GAAGf,KAAK,CAACgB,UAAU,CAACZ,aAAa,CAAC;EACnC,MAAM,CAACa,KAAK,EAAEC,QAAQ,CAAC,GAAGhB,cAAc,CAACU,KAAK,CAACO,YAAY,EAAE;IAC3DF,KAAK,EAAEL,KAAK,CAACK;EACf,CAAC,CAAC;EACF,MAAMG,aAAa,GAAGC,EAAE,IAAI;IAC1B,MAAMC,SAAS,GAAGL,KAAK;IACvB,MAAMM,GAAG,GAAGF,EAAE,CAACG,MAAM,CAACP,KAAK;IAC3B,IAAI,EAAE,OAAO,IAAIL,KAAK,CAAC,EAAE;MACvBM,QAAQ,CAACK,GAAG,CAAC;I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