{"ast":null,"code":"import React, { useMemo } from 'react';\nimport { generateColor } from \"../util\";\nvar Gradient = function Gradient(_ref) {\n  var colors = _ref.colors,\n    children = _ref.children,\n    _ref$direction = _ref.direction,\n    direction = _ref$direction === void 0 ? 'to right' : _ref$direction,\n    type = _ref.type,\n    prefixCls = _ref.prefixCls;\n  var gradientColors = useMemo(function () {\n    return colors.map(function (color, idx) {\n      var result = generateColor(color);\n      if (type === 'alpha' && idx === colors.length - 1) {\n        result.setAlpha(1);\n      }\n      return result.toRgbString();\n    }).join(',');\n  }, [colors, type]);\n  return /*#__PURE__*/React.createElement(\"div\", {\n    className: \"\".concat(prefixCls, \"-gradient\"),\n    style: {\n      position: 'absolute',\n      inset: 0,\n      background: \"linear-gradient(\".concat(direction, \", \").concat(gradientColors, \")\")\n    }\n  }, children);\n};\nexport default Gradient;","map":{"version":3,"names":["React","useMemo","generateColor","Gradient","_ref","colors","children","_ref$direction","direction","type","prefixCls","gradientColors","map","color","idx","result","length","setAlpha","toRgbString","join","createElement","className","concat","style","position","inset","background"],"sources":["/var/www/gavt/react-demo/node_modules/@rc-component/color-picker/es/components/Gradient.js"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { generateColor } from \"../util\";\nvar Gradient = function Gradient(_ref) {\n  var colors = _ref.colors,\n    children = _ref.children,\n    _ref$direction = _ref.direction,\n    direction = _ref$direction === void 0 ? 'to right' : _ref$direction,\n    type = _ref.type,\n    prefixCls = _ref.prefixCls;\n  var gradientColors = useMemo(function () {\n    return colors.map(function (color, idx) {\n      var result = generateColor(color);\n      if (type === 'alpha' && idx === colors.length - 1) {\n        result.setAlpha(1);\n      }\n      return result.toRgbString();\n    }).join(',');\n  }, [colors, type]);\n  return /*#__PURE__*/React.createElement(\"div\", {\n    className: \"\".concat(prefixCls, \"-gradient\"),\n    style: {\n      position: 'absolute',\n      inset: 0,\n      background: \"linear-gradient(\".concat(direction, \", \").concat(gradientColors, \")\")\n    }\n  }, children);\n};\nexport default Gradient;"],"mappings":"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