PromoCursed/node_modules/.cache/babel-loader/ec5aae37409ce777a2ad371b477a408182df52cc971a0be10e5439fd555b5479.json

1 line
19 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 _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nvar _excluded = [\"id\", \"prefixCls\", \"steps\", \"strokeWidth\", \"trailWidth\", \"gapDegree\", \"gapPosition\", \"trailColor\", \"strokeLinecap\", \"style\", \"className\", \"strokeColor\", \"percent\"];\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { defaultProps, useTransitionDuration } from \"../common\";\nimport useId from \"../hooks/useId\";\nimport PtgCircle from \"./PtgCircle\";\nimport { VIEW_BOX_SIZE, getCircleStyle } from \"./util\";\nfunction toArray(value) {\n var mergedValue = value !== null && value !== void 0 ? value : [];\n return Array.isArray(mergedValue) ? mergedValue : [mergedValue];\n}\nvar Circle = function Circle(props) {\n var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),\n id = _defaultProps$props.id,\n prefixCls = _defaultProps$props.prefixCls,\n steps = _defaultProps$props.steps,\n strokeWidth = _defaultProps$props.strokeWidth,\n trailWidth = _defaultProps$props.trailWidth,\n _defaultProps$props$g = _defaultProps$props.gapDegree,\n gapDegree = _defaultProps$props$g === void 0 ? 0 : _defaultProps$props$g,\n gapPosition = _defaultProps$props.gapPosition,\n trailColor = _defaultProps$props.trailColor,\n strokeLinecap = _defaultProps$props.strokeLinecap,\n style = _defaultProps$props.style,\n className = _defaultProps$props.className,\n strokeColor = _defaultProps$props.strokeColor,\n percent = _defaultProps$props.percent,\n restProps = _objectWithoutProperties(_defaultProps$props, _excluded);\n var halfSize = VIEW_BOX_SIZE / 2;\n var mergedId = useId(id);\n var gradientId = \"\".concat(mergedId, \"-gradient\");\n var radius = halfSize - strokeWidth / 2;\n var perimeter = Math.PI * 2 * radius;\n var rotateDeg = gapDegree > 0 ? 90 + gapDegree / 2 : -90;\n var perimeterWithoutGap = perimeter * ((360 - gapDegree) / 360);\n var _ref = _typeof(steps) === 'object' ? steps : {\n count: steps,\n gap: 2\n },\n stepCount = _ref.count,\n stepGap = _ref.gap;\n var percentList = toArray(percent);\n var strokeColorList = toArray(strokeColor);\n var gradient = strokeColorList.find(function (color) {\n return color && _typeof(color) === 'object';\n });\n var isConicGradient = gradient && _typeof(gradient) === 'object';\n var mergedStrokeLinecap = isConicGradient ? 'butt' : strokeLinecap;\n var circleStyle = getCircleStyle(perimeter, perimeterWithoutGap, 0, 100, rotateDeg, gapDegree, gapPosition, trailColor, mergedStrokeLinecap, strokeWidth);\n var paths = useTransitionDuration();\n var getStokeList = function getStokeList() {\n var stackPtg = 0;\n return percentList.map(function (ptg, index) {\n var color = strokeColorList[index] || strokeColorList[strokeColorList.length - 1];\n var circleStyleForStack = getCircleStyle(perimeter, perimeterWithoutGap, stackPtg, ptg, rotateDeg, gapDegree, gapPosition, color, mergedStrokeLinecap, strokeWidth);\n stackPtg += ptg;\n return /*#__PURE__*/React.createElement(PtgCircle, {\n key: index,\n color: color,\n ptg: ptg,\n radius: radius,\n prefixCls: prefixCls,\n gradientId: gradientId,\n style: circleStyleForStack,\n strokeLinecap: mergedStrokeLinecap,\n strokeWidth: strokeWidth,\n gapDegree: gapDegree,\n ref: function ref(elem) {\n // https://reactjs.org/docs/refs-and-the-dom.html#callback-refs\n // React will call the ref callback with the DOM element when the component mounts,\n // and call it with `null` when it unmounts.\n // Refs are guaranteed to be up-to-date before componentDidMount or componentDidUpdate fires.\n\n paths[index] = elem;\n },\n size: VIEW_B