PromoCursed/node_modules/.cache/babel-loader/d75096dd8b3cfea8d5d01631f9564c0ae8538161ccb1bc63b8ae5f35186b808b.json
2024-08-20 23:25:37 +04:00

1 line
11 KiB
JSON

{"ast":null,"code":"\"use client\";\n\nimport React, { useMemo } from 'react';\nimport { ColorBlock, Color as RcColor } from '@rc-component/color-picker';\nimport classNames from 'classnames';\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport Collapse from '../../collapse';\nimport { useLocale } from '../../locale';\nimport { useToken } from '../../theme/internal';\nimport { generateColor } from '../util';\nconst genPresetColor = list => list.map(value => {\n value.colors = value.colors.map(generateColor);\n return value;\n});\nconst isBright = (value, bgColorToken) => {\n const {\n r,\n g,\n b,\n a\n } = value.toRgb();\n const hsv = new RcColor(value.toRgbString()).onBackground(bgColorToken).toHsv();\n if (a <= 0.5) {\n // Adapted to dark mode\n return hsv.v > 0.5;\n }\n return r * 0.299 + g * 0.587 + b * 0.114 > 192;\n};\nconst genCollapsePanelKey = _ref => {\n let {\n label\n } = _ref;\n return `panel-${label}`;\n};\nconst ColorPresets = _ref2 => {\n let {\n prefixCls,\n presets,\n value: color,\n onChange\n } = _ref2;\n const [locale] = useLocale('ColorPicker');\n const [, token] = useToken();\n const [presetsValue] = useMergedState(genPresetColor(presets), {\n value: genPresetColor(presets),\n postState: genPresetColor\n });\n const colorPresetsPrefixCls = `${prefixCls}-presets`;\n const activeKeys = useMemo(() => presetsValue.reduce((acc, preset) => {\n const {\n defaultOpen = true\n } = preset;\n if (defaultOpen) acc.push(genCollapsePanelKey(preset));\n return acc;\n }, []), [presetsValue]);\n const handleClick = colorValue => {\n onChange === null || onChange === void 0 ? void 0 : onChange(colorValue);\n };\n const items = presetsValue.map(preset => {\n var _a;\n return {\n key: genCollapsePanelKey(preset),\n label: /*#__PURE__*/React.createElement(\"div\", {\n className: `${colorPresetsPrefixCls}-label`\n }, preset === null || preset === void 0 ? void 0 : preset.label),\n children: ( /*#__PURE__*/React.createElement(\"div\", {\n className: `${colorPresetsPrefixCls}-items`\n }, Array.isArray(preset === null || preset === void 0 ? void 0 : preset.colors) && ((_a = preset.colors) === null || _a === void 0 ? void 0 : _a.length) > 0 ? preset.colors.map((presetColor, index) => ( /*#__PURE__*/React.createElement(ColorBlock\n // eslint-disable-next-line react/no-array-index-key\n , {\n // eslint-disable-next-line react/no-array-index-key\n key: `preset-${index}-${presetColor.toHexString()}`,\n color: generateColor(presetColor).toRgbString(),\n prefixCls: prefixCls,\n className: classNames(`${colorPresetsPrefixCls}-color`, {\n [`${colorPresetsPrefixCls}-color-checked`]: presetColor.toHexString() === (color === null || color === void 0 ? void 0 : color.toHexString()),\n [`${colorPresetsPrefixCls}-color-bright`]: isBright(presetColor, token.colorBgElevated)\n }),\n onClick: () => handleClick(presetColor)\n }))) : ( /*#__PURE__*/React.createElement(\"span\", {\n className: `${colorPresetsPrefixCls}-empty`\n }, locale.presetEmpty))))\n };\n });\n return /*#__PURE__*/React.createElement(\"div\", {\n className: colorPresetsPrefixCls\n }, /*#__PURE__*/React.createElement(Collapse, {\n defaultActiveKey: activeKeys,\n ghost: true,\n items: items\n }));\n};\nexport default ColorPresets;","map":{"version":3,"names":["React","useMemo","ColorBlock","Color","RcColor","classNames","useMergedState","Collapse","useLocale","useToken","generateColor","genPresetColor","list","map","value","colors","isBright","bgColorToken","r","g","b","a","toRgb","hsv","toRgbString","onBackground","toHsv","v","genCollapsePanelKey","_ref","label","ColorPresets","_ref2","prefixCls","presets","color","onChange","locale","token","presetsValue","postState","colorPresetsPrefixCls","activeKeys","reduce","acc","preset","defaultOpen","push","handleClick","colorValue","items","_a","key","createElement","className","children","Array","isArray","length","presetColor","index","toHexString","colorBgElevated","onClick","presetEmpty","defaultActiveKey","ghost"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/antd/es/color-picker/components/ColorPresets.js"],"sourcesContent":["\"use client\";\n\nimport React, { useMemo } from 'react';\nimport { ColorBlock, Color as RcColor } from '@rc-component/color-picker';\nimport classNames from 'classnames';\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport Collapse from '../../collapse';\nimport { useLocale } from '../../locale';\nimport { useToken } from '../../theme/internal';\nimport { generateColor } from '../util';\nconst genPresetColor = list => list.map(value => {\n value.colors = value.colors.map(generateColor);\n return value;\n});\nconst isBright = (value, bgColorToken) => {\n const {\n r,\n g,\n b,\n a\n } = value.toRgb();\n const hsv = new RcColor(value.toRgbString()).onBackground(bgColorToken).toHsv();\n if (a <= 0.5) {\n // Adapted to dark mode\n return hsv.v > 0.5;\n }\n return r * 0.299 + g * 0.587 + b * 0.114 > 192;\n};\nconst genCollapsePanelKey = _ref => {\n let {\n label\n } = _ref;\n return `panel-${label}`;\n};\nconst ColorPresets = _ref2 => {\n let {\n prefixCls,\n presets,\n value: color,\n onChange\n } = _ref2;\n const [locale] = useLocale('ColorPicker');\n const [, token] = useToken();\n const [presetsValue] = useMergedState(genPresetColor(presets), {\n value: genPresetColor(presets),\n postState: genPresetColor\n });\n const colorPresetsPrefixCls = `${prefixCls}-presets`;\n const activeKeys = useMemo(() => presetsValue.reduce((acc, preset) => {\n const {\n defaultOpen = true\n } = preset;\n if (defaultOpen) acc.push(genCollapsePanelKey(preset));\n return acc;\n }, []), [presetsValue]);\n const handleClick = colorValue => {\n onChange === null || onChange === void 0 ? void 0 : onChange(colorValue);\n };\n const items = presetsValue.map(preset => {\n var _a;\n return {\n key: genCollapsePanelKey(preset),\n label: /*#__PURE__*/React.createElement(\"div\", {\n className: `${colorPresetsPrefixCls}-label`\n }, preset === null || preset === void 0 ? void 0 : preset.label),\n children: ( /*#__PURE__*/React.createElement(\"div\", {\n className: `${colorPresetsPrefixCls}-items`\n }, Array.isArray(preset === null || preset === void 0 ? void 0 : preset.colors) && ((_a = preset.colors) === null || _a === void 0 ? void 0 : _a.length) > 0 ? preset.colors.map((presetColor, index) => ( /*#__PURE__*/React.createElement(ColorBlock\n // eslint-disable-next-line react/no-array-index-key\n , {\n // eslint-disable-next-line react/no-array-index-key\n key: `preset-${index}-${presetColor.toHexString()}`,\n color: generateColor(presetColor).toRgbString(),\n prefixCls: prefixCls,\n className: classNames(`${colorPresetsPrefixCls}-color`, {\n [`${colorPresetsPrefixCls}-color-checked`]: presetColor.toHexString() === (color === null || color === void 0 ? void 0 : color.toHexString()),\n [`${colorPresetsPrefixCls}-color-bright`]: isBright(presetColor, token.colorBgElevated)\n }),\n onClick: () => handleClick(presetColor)\n }))) : ( /*#__PURE__*/React.createElement(\"span\", {\n className: `${colorPresetsPrefixCls}-empty`\n }, locale.presetEmpty))))\n };\n });\n return /*#__PURE__*/React.createElement(\"div\", {\n className: colorPresetsPrefixCls\n }, /*#__PURE__*/React.createElement(Collapse, {\n defaultActiveKey: activeKeys,\n ghost: true,\n items: items\n }));\n};\nexport default ColorPresets;"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,UAAU,EAAEC,KAAK,IAAIC,OAAO,QAAQ,4BAA4B;AACzE,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,cAAc,MAAM,iCAAiC;AAC5D,OAAOC,QAAQ,MAAM,gBAAgB;AACrC,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,QAAQ,QAAQ,sBAAsB;AAC/C,SAASC,aAAa,QAAQ,SAAS;AACvC,MAAMC,cAAc,GAAGC,IAAI,IAAIA,IAAI,CAACC,GAAG,CAACC,KAAK,IAAI;EAC/CA,KAAK,CAACC,MAAM,GAAGD,KAAK,CAACC,MAAM,CAACF,GAAG,CAACH,aAAa,CAAC;EAC9C,OAAOI,KAAK;AACd,CAAC,CAAC;AACF,MAAME,QAAQ,GAAGA,CAACF,KAAK,EAAEG,YAAY,KAAK;EACxC,MAAM;IACJC,CAAC;IACDC,CAAC;IACDC,CAAC;IACDC;EACF,CAAC,GAAGP,KAAK,CAACQ,KAAK,CAAC,CAAC;EACjB,MAAMC,GAAG,GAAG,IAAInB,OAAO,CAACU,KAAK,CAACU,W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