1 line
9.1 KiB
JSON
1 line
9.1 KiB
JSON
|
{"ast":null,"code":"import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport * as React from 'react';\nvar Block = function Block(_ref) {\n var bg = _ref.bg,\n children = _ref.children;\n return /*#__PURE__*/React.createElement(\"div\", {\n style: {\n width: '100%',\n height: '100%',\n background: bg\n }\n }, children);\n};\nfunction getPtgColors(color, scale) {\n return Object.keys(color).map(function (key) {\n var parsedKey = parseFloat(key);\n var ptgKey = \"\".concat(Math.floor(parsedKey * scale), \"%\");\n return \"\".concat(color[key], \" \").concat(ptgKey);\n });\n}\nvar PtgCircle = /*#__PURE__*/React.forwardRef(function (props, ref) {\n var prefixCls = props.prefixCls,\n color = props.color,\n gradientId = props.gradientId,\n radius = props.radius,\n circleStyleForStack = props.style,\n ptg = props.ptg,\n strokeLinecap = props.strokeLinecap,\n strokeWidth = props.strokeWidth,\n size = props.size,\n gapDegree = props.gapDegree;\n var isGradient = color && _typeof(color) === 'object';\n var stroke = isGradient ? \"#FFF\" : undefined;\n\n // ========================== Circle ==========================\n var halfSize = size / 2;\n var circleNode = /*#__PURE__*/React.createElement(\"circle\", {\n className: \"\".concat(prefixCls, \"-circle-path\"),\n r: radius,\n cx: halfSize,\n cy: halfSize,\n stroke: stroke,\n strokeLinecap: strokeLinecap,\n strokeWidth: strokeWidth,\n opacity: ptg === 0 ? 0 : 1,\n style: circleStyleForStack,\n ref: ref\n });\n\n // ========================== Render ==========================\n if (!isGradient) {\n return circleNode;\n }\n var maskId = \"\".concat(gradientId, \"-conic\");\n var fromDeg = gapDegree ? \"\".concat(180 + gapDegree / 2, \"deg\") : '0deg';\n var conicColors = getPtgColors(color, (360 - gapDegree) / 360);\n var linearColors = getPtgColors(color, 1);\n var conicColorBg = \"conic-gradient(from \".concat(fromDeg, \", \").concat(conicColors.join(', '), \")\");\n var linearColorBg = \"linear-gradient(to \".concat(gapDegree ? 'bottom' : 'top', \", \").concat(linearColors.join(', '), \")\");\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(\"mask\", {\n id: maskId\n }, circleNode), /*#__PURE__*/React.createElement(\"foreignObject\", {\n x: 0,\n y: 0,\n width: size,\n height: size,\n mask: \"url(#\".concat(maskId, \")\")\n }, /*#__PURE__*/React.createElement(Block, {\n bg: linearColorBg\n }, /*#__PURE__*/React.createElement(Block, {\n bg: conicColorBg\n }))));\n});\nif (process.env.NODE_ENV !== 'production') {\n PtgCircle.displayName = 'PtgCircle';\n}\nexport default PtgCircle;","map":{"version":3,"names":["_typeof","React","Block","_ref","bg","children","createElement","style","width","height","background","getPtgColors","color","scale","Object","keys","map","key","parsedKey","parseFloat","ptgKey","concat","Math","floor","PtgCircle","forwardRef","props","ref","prefixCls","gradientId","radius","circleStyleForStack","ptg","strokeLinecap","strokeWidth","size","gapDegree","isGradient","stroke","undefined","halfSize","circleNode","className","r","cx","cy","opacity","maskId","fromDeg","conicColors","linearColors","conicColorBg","join","linearColorBg","Fragment","id","x","y","mask","process","env","NODE_ENV","displayName"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-progress/es/Circle/PtgCircle.js"],"sourcesContent":["import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport * as React from 'react';\nvar Block = function Block(_ref) {\n var bg = _ref.bg,\n children = _ref.children;\n return /*#__PURE__*/React.createElement(\"div\", {\n style: {\n width: '100%',\n height: '100%',\n background: bg\n }\n }, children);\n};\nfunction getPtgColors(color, scale) {\n return Object.keys(color).map(function (key) {\n var parsedKey = parseFloat(key);\n var ptgKey = \"\".concat(Math.floor(parsedKey * scale), \"%\");\n return \"\".c
|