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

1 line
7.7 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport React, { useRef } from 'react';\nimport useColorDrag from \"../hooks/useColorDrag\";\nimport { calcOffset, calculateColor } from \"../util\";\nimport { useEvent } from 'rc-util';\nimport Handler from \"./Handler\";\nimport Palette from \"./Palette\";\nimport Transform from \"./Transform\";\nvar Picker = function Picker(_ref) {\n var color = _ref.color,\n onChange = _ref.onChange,\n prefixCls = _ref.prefixCls,\n onChangeComplete = _ref.onChangeComplete,\n disabled = _ref.disabled;\n var pickerRef = useRef();\n var transformRef = useRef();\n var colorRef = useRef(color);\n var onDragChange = useEvent(function (offsetValue) {\n var calcColor = calculateColor({\n offset: offsetValue,\n targetRef: transformRef,\n containerRef: pickerRef,\n color: color\n });\n colorRef.current = calcColor;\n onChange(calcColor);\n });\n var _useColorDrag = useColorDrag({\n color: color,\n containerRef: pickerRef,\n targetRef: transformRef,\n calculate: function calculate() {\n return calcOffset(color);\n },\n onDragChange: onDragChange,\n onDragChangeComplete: function onDragChangeComplete() {\n return onChangeComplete === null || onChangeComplete === void 0 ? void 0 : onChangeComplete(colorRef.current);\n },\n disabledDrag: disabled\n }),\n _useColorDrag2 = _slicedToArray(_useColorDrag, 2),\n offset = _useColorDrag2[0],\n dragStartHandle = _useColorDrag2[1];\n return /*#__PURE__*/React.createElement(\"div\", {\n ref: pickerRef,\n className: \"\".concat(prefixCls, \"-select\"),\n onMouseDown: dragStartHandle,\n onTouchStart: dragStartHandle\n }, /*#__PURE__*/React.createElement(Palette, {\n prefixCls: prefixCls\n }, /*#__PURE__*/React.createElement(Transform, {\n x: offset.x,\n y: offset.y,\n ref: transformRef\n }, /*#__PURE__*/React.createElement(Handler, {\n color: color.toRgbString(),\n prefixCls: prefixCls\n })), /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-saturation\"),\n style: {\n backgroundColor: \"hsl(\".concat(color.toHsb().h, \",100%, 50%)\"),\n backgroundImage: 'linear-gradient(0deg, #000, transparent),linear-gradient(90deg, #fff, hsla(0, 0%, 100%, 0))'\n }\n })));\n};\nexport default Picker;","map":{"version":3,"names":["_slicedToArray","React","useRef","useColorDrag","calcOffset","calculateColor","useEvent","Handler","Palette","Transform","Picker","_ref","color","onChange","prefixCls","onChangeComplete","disabled","pickerRef","transformRef","colorRef","onDragChange","offsetValue","calcColor","offset","targetRef","containerRef","current","_useColorDrag","calculate","onDragChangeComplete","disabledDrag","_useColorDrag2","dragStartHandle","createElement","ref","className","concat","onMouseDown","onTouchStart","x","y","toRgbString","style","backgroundColor","toHsb","h","backgroundImage"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/@rc-component/color-picker/es/components/Picker.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport React, { useRef } from 'react';\nimport useColorDrag from \"../hooks/useColorDrag\";\nimport { calcOffset, calculateColor } from \"../util\";\nimport { useEvent } from 'rc-util';\nimport Handler from \"./Handler\";\nimport Palette from \"./Palette\";\nimport Transform from \"./Transform\";\nvar Picker = function Picker(_ref) {\n var color = _ref.color,\n onChange = _ref.onChange,\n prefixCls = _ref.prefixCls,\n onChangeComplete = _ref.onChangeComplete,\n disabled = _ref.disabled;\n var pickerRef = useRef();\n var transformRef = useRef();\n var colorRef = useRef(color);\n var onDragChange = useEvent(function (offsetValue) {\n var calcColor = calculateColor({\n offset: offsetValue,\n targetRef: transformRef,\n containerRef: pickerRef,\n color: color\n });\n colorRef.curr