1 line
5.6 KiB
JSON
1 line
5.6 KiB
JSON
|
{"ast":null,"code":"\"use client\";\n\nimport React, { useEffect, useState } from 'react';\nimport { generateColor } from '../util';\nimport ColorSteppers from './ColorSteppers';\nconst ColorRgbInput = _ref => {\n let {\n prefixCls,\n value,\n onChange\n } = _ref;\n const colorRgbInputPrefixCls = `${prefixCls}-rgb-input`;\n const [rgbValue, setRgbValue] = useState(generateColor(value || '#000'));\n // Update step value\n useEffect(() => {\n if (value) {\n setRgbValue(value);\n }\n }, [value]);\n const handleRgbChange = (step, type) => {\n const rgb = rgbValue.toRgb();\n rgb[type] = step || 0;\n const genColor = generateColor(rgb);\n if (!value) {\n setRgbValue(genColor);\n }\n onChange === null || onChange === void 0 ? void 0 : onChange(genColor);\n };\n return /*#__PURE__*/React.createElement(\"div\", {\n className: colorRgbInputPrefixCls\n }, /*#__PURE__*/React.createElement(ColorSteppers, {\n max: 255,\n min: 0,\n value: Number(rgbValue.toRgb().r),\n prefixCls: prefixCls,\n className: colorRgbInputPrefixCls,\n onChange: step => handleRgbChange(Number(step), 'r')\n }), /*#__PURE__*/React.createElement(ColorSteppers, {\n max: 255,\n min: 0,\n value: Number(rgbValue.toRgb().g),\n prefixCls: prefixCls,\n className: colorRgbInputPrefixCls,\n onChange: step => handleRgbChange(Number(step), 'g')\n }), /*#__PURE__*/React.createElement(ColorSteppers, {\n max: 255,\n min: 0,\n value: Number(rgbValue.toRgb().b),\n prefixCls: prefixCls,\n className: colorRgbInputPrefixCls,\n onChange: step => handleRgbChange(Number(step), 'b')\n }));\n};\nexport default ColorRgbInput;","map":{"version":3,"names":["React","useEffect","useState","generateColor","ColorSteppers","ColorRgbInput","_ref","prefixCls","value","onChange","colorRgbInputPrefixCls","rgbValue","setRgbValue","handleRgbChange","step","type","rgb","toRgb","genColor","createElement","className","max","min","Number","r","g","b"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/color-picker/components/ColorRgbInput.js"],"sourcesContent":["\"use client\";\n\nimport React, { useEffect, useState } from 'react';\nimport { generateColor } from '../util';\nimport ColorSteppers from './ColorSteppers';\nconst ColorRgbInput = _ref => {\n let {\n prefixCls,\n value,\n onChange\n } = _ref;\n const colorRgbInputPrefixCls = `${prefixCls}-rgb-input`;\n const [rgbValue, setRgbValue] = useState(generateColor(value || '#000'));\n // Update step value\n useEffect(() => {\n if (value) {\n setRgbValue(value);\n }\n }, [value]);\n const handleRgbChange = (step, type) => {\n const rgb = rgbValue.toRgb();\n rgb[type] = step || 0;\n const genColor = generateColor(rgb);\n if (!value) {\n setRgbValue(genColor);\n }\n onChange === null || onChange === void 0 ? void 0 : onChange(genColor);\n };\n return /*#__PURE__*/React.createElement(\"div\", {\n className: colorRgbInputPrefixCls\n }, /*#__PURE__*/React.createElement(ColorSteppers, {\n max: 255,\n min: 0,\n value: Number(rgbValue.toRgb().r),\n prefixCls: prefixCls,\n className: colorRgbInputPrefixCls,\n onChange: step => handleRgbChange(Number(step), 'r')\n }), /*#__PURE__*/React.createElement(ColorSteppers, {\n max: 255,\n min: 0,\n value: Number(rgbValue.toRgb().g),\n prefixCls: prefixCls,\n className: colorRgbInputPrefixCls,\n onChange: step => handleRgbChange(Number(step), 'g')\n }), /*#__PURE__*/React.createElement(ColorSteppers, {\n max: 255,\n min: 0,\n value: Number(rgbValue.toRgb().b),\n prefixCls: prefixCls,\n className: colorRgbInputPrefixCls,\n onChange: step => handleRgbChange(Number(step), 'b')\n }));\n};\nexport default ColorRgbInput;"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAASC,aAAa,QAAQ,SAAS;AACvC,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,MAAMC,aAAa,GAAGC,IAAI,IAAI;EAC5B,IAAI;IACFC,SAAS;IACTC,KAAK;IACLC;EACF,CAAC,GAAGH,IAAI;EACR,MAAMI,sBAAsB,GAAG,GAAGH,SAAS,YAAY;EACvD
|