PromoCursed/node_modules/.cache/babel-loader/9371db225a012879fabe728136d1f65eb6963246fe518dce68655b8e9d282b07.json

1 line
9.0 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import React from 'react';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport classNames from 'classnames';\nfunction Star(props, ref) {\n var disabled = props.disabled,\n prefixCls = props.prefixCls,\n character = props.character,\n characterRender = props.characterRender,\n index = props.index,\n count = props.count,\n value = props.value,\n allowHalf = props.allowHalf,\n focused = props.focused,\n onHover = props.onHover,\n onClick = props.onClick;\n\n // =========================== Events ===========================\n var onInternalHover = function onInternalHover(e) {\n onHover(e, index);\n };\n var onInternalClick = function onInternalClick(e) {\n onClick(e, index);\n };\n var onInternalKeyDown = function onInternalKeyDown(e) {\n if (e.keyCode === KeyCode.ENTER) {\n onClick(e, index);\n }\n };\n\n // =========================== Render ===========================\n // >>>>> ClassName\n var starValue = index + 1;\n var classNameList = new Set([prefixCls]);\n\n // TODO: Current we just refactor from CC to FC. This logic seems can be optimized.\n if (value === 0 && index === 0 && focused) {\n classNameList.add(\"\".concat(prefixCls, \"-focused\"));\n } else if (allowHalf && value + 0.5 >= starValue && value < starValue) {\n classNameList.add(\"\".concat(prefixCls, \"-half\"));\n classNameList.add(\"\".concat(prefixCls, \"-active\"));\n if (focused) {\n classNameList.add(\"\".concat(prefixCls, \"-focused\"));\n }\n } else {\n if (starValue <= value) {\n classNameList.add(\"\".concat(prefixCls, \"-full\"));\n } else {\n classNameList.add(\"\".concat(prefixCls, \"-zero\"));\n }\n if (starValue === value && focused) {\n classNameList.add(\"\".concat(prefixCls, \"-focused\"));\n }\n }\n\n // >>>>> Node\n var characterNode = typeof character === 'function' ? character(props) : character;\n var start = /*#__PURE__*/React.createElement(\"li\", {\n className: classNames(Array.from(classNameList)),\n ref: ref\n }, /*#__PURE__*/React.createElement(\"div\", {\n onClick: disabled ? null : onInternalClick,\n onKeyDown: disabled ? null : onInternalKeyDown,\n onMouseMove: disabled ? null : onInternalHover,\n role: \"radio\",\n \"aria-checked\": value > index ? 'true' : 'false',\n \"aria-posinset\": index + 1,\n \"aria-setsize\": count,\n tabIndex: disabled ? -1 : 0\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-first\")\n }, characterNode), /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-second\")\n }, characterNode)));\n if (characterRender) {\n start = characterRender(start, props);\n }\n return start;\n}\nexport default /*#__PURE__*/React.forwardRef(Star);","map":{"version":3,"names":["React","KeyCode","classNames","Star","props","ref","disabled","prefixCls","character","characterRender","index","count","value","allowHalf","focused","onHover","onClick","onInternalHover","e","onInternalClick","onInternalKeyDown","keyCode","ENTER","starValue","classNameList","Set","add","concat","characterNode","start","createElement","className","Array","from","onKeyDown","onMouseMove","role","tabIndex","forwardRef"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-rate/es/Star.js"],"sourcesContent":["import React from 'react';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport classNames from 'classnames';\nfunction Star(props, ref) {\n var disabled = props.disabled,\n prefixCls = props.prefixCls,\n character = props.character,\n characterRender = props.characterRender,\n index = props.index,\n count = props.count,\n value = props.value,\n allowHalf = props.allowHalf,\n focused = props.focused,\n onHover = props.onHover,\n onClick = props.onClick;\n\n // =========================== Events ===========================\n var onInternalHover = function onInternalHover(e) {\n onHover(e, index);\n };\n var onInternalClick = function onInter