1 line
7.7 KiB
JSON
1 line
7.7 KiB
JSON
{"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.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;"],"mappings":"AAAA,OAAOA,cAAc,MAAM,0CAA0C;AACrE,OAAOC,KAAK,IAAIC,MAAM,QAAQ,OAAO;AACrC,OAAOC,YAAY,MAAM,uBAAuB;AAChD,SAASC,UAAU,EAAEC,cAAc,QAAQ,SAAS;AACpD,SAASC,QAAQ,QAAQ,SAAS;AAClC,OAAOC,OAAO,MAAM,WAAW;AAC/B,OAAOC,OAAO,MAAM,WAAW;AAC/B,OAAOC,SAAS,MAAM,aAAa;AACnC,IAAIC,MAAM,GAAG,SAASA,MAAMA,CAACC,IAAI,EAAE;EACjC,IAAIC,KAAK,GAAGD,IAAI,CAACC,KAAK;IACpBC,QAAQ,GAAGF,IAAI,CAACE,QAAQ;IACxBC,SAAS,GAAGH,IAAI,CAACG,SAAS;IAC1BC,gBAAgB,GAAGJ,IAAI,CAACI,gBAAgB;IACxCC,QAAQ,GAAGL,IAAI,CAACK,QAAQ;EAC1B,IAAIC,SAAS,GAAGf,MAAM,CAAC,CAAC;EACxB,IAAIgB,YAAY,GAAGhB,MAAM,CAAC,CAAC;EAC3B,IAAIiB,QAAQ,GAAGjB,MA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