1 line
11 KiB
JSON
1 line
11 KiB
JSON
{"ast":null,"code":"\"use client\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport React, { forwardRef, useMemo } from 'react';\nimport { ColorBlock } from '@rc-component/color-picker';\nimport classNames from 'classnames';\nimport pickAttrs from \"rc-util/es/pickAttrs\";\nimport { useLocale } from '../../locale';\nimport { getColorAlpha } from '../util';\nimport ColorClear from './ColorClear';\nconst ColorTrigger = /*#__PURE__*/forwardRef((props, ref) => {\n const {\n color,\n prefixCls,\n open,\n disabled,\n format,\n className,\n showText,\n activeIndex\n } = props,\n rest = __rest(props, [\"color\", \"prefixCls\", \"open\", \"disabled\", \"format\", \"className\", \"showText\", \"activeIndex\"]);\n const colorTriggerPrefixCls = `${prefixCls}-trigger`;\n const colorTextPrefixCls = `${colorTriggerPrefixCls}-text`;\n const colorTextCellPrefixCls = `${colorTextPrefixCls}-cell`;\n const [locale] = useLocale('ColorPicker');\n // ============================== Text ==============================\n const desc = React.useMemo(() => {\n if (!showText) {\n return '';\n }\n if (typeof showText === 'function') {\n return showText(color);\n }\n if (color.cleared) {\n return locale.transparent;\n }\n if (color.isGradient()) {\n return color.getColors().map((c, index) => {\n const inactive = activeIndex !== -1 && activeIndex !== index;\n return /*#__PURE__*/React.createElement(\"span\", {\n key: index,\n className: classNames(colorTextCellPrefixCls, inactive && `${colorTextCellPrefixCls}-inactive`)\n }, c.color.toRgbString(), \" \", c.percent, \"%\");\n });\n }\n const hexString = color.toHexString().toUpperCase();\n const alpha = getColorAlpha(color);\n switch (format) {\n case 'rgb':\n return color.toRgbString();\n case 'hsb':\n return color.toHsbString();\n // case 'hex':\n default:\n return alpha < 100 ? `${hexString.slice(0, 7)},${alpha}%` : hexString;\n }\n }, [color, format, showText, activeIndex]);\n // ============================= Render =============================\n const containerNode = useMemo(() => color.cleared ? ( /*#__PURE__*/React.createElement(ColorClear, {\n prefixCls: prefixCls\n })) : ( /*#__PURE__*/React.createElement(ColorBlock, {\n prefixCls: prefixCls,\n color: color.toCssString()\n })), [color, prefixCls]);\n return /*#__PURE__*/React.createElement(\"div\", Object.assign({\n ref: ref,\n className: classNames(colorTriggerPrefixCls, className, {\n [`${colorTriggerPrefixCls}-active`]: open,\n [`${colorTriggerPrefixCls}-disabled`]: disabled\n })\n }, pickAttrs(rest)), containerNode, showText && /*#__PURE__*/React.createElement(\"div\", {\n className: colorTextPrefixCls\n }, desc));\n});\nexport default ColorTrigger;","map":{"version":3,"names":["__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","React","forwardRef","useMemo","ColorBlock","classNames","pickAttrs","useLocale","getColorAlpha","ColorClear","ColorTrigger","props","ref","color","prefixCls","open","disabled","format","className","showText","activeIndex","rest","colorTriggerPrefixCls","colorTextPrefixCls","colorTextCellPrefixCls","locale","desc","cleared","transparent","isGradient","getColors","map","c","index","inactive","createElement","key","toRgbString","percent","hexString","toHexString","toUpperCase","alpha","toHsbString","slice","containerNode","toCssString","assign"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/color-picker/components/ColorTrigger.js"],"sourcesContent":["\"use client\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport React, { forwardRef, useMemo } from 'react';\nimport { ColorBlock } from '@rc-component/color-picker';\nimport classNames from 'classnames';\nimport pickAttrs from \"rc-util/es/pickAttrs\";\nimport { useLocale } from '../../locale';\nimport { getColorAlpha } from '../util';\nimport ColorClear from './ColorClear';\nconst ColorTrigger = /*#__PURE__*/forwardRef((props, ref) => {\n const {\n color,\n prefixCls,\n open,\n disabled,\n format,\n className,\n showText,\n activeIndex\n } = props,\n rest = __rest(props, [\"color\", \"prefixCls\", \"open\", \"disabled\", \"format\", \"className\", \"showText\", \"activeIndex\"]);\n const colorTriggerPrefixCls = `${prefixCls}-trigger`;\n const colorTextPrefixCls = `${colorTriggerPrefixCls}-text`;\n const colorTextCellPrefixCls = `${colorTextPrefixCls}-cell`;\n const [locale] = useLocale('ColorPicker');\n // ============================== Text ==============================\n const desc = React.useMemo(() => {\n if (!showText) {\n return '';\n }\n if (typeof showText === 'function') {\n return showText(color);\n }\n if (color.cleared) {\n return locale.transparent;\n }\n if (color.isGradient()) {\n return color.getColors().map((c, index) => {\n const inactive = activeIndex !== -1 && activeIndex !== index;\n return /*#__PURE__*/React.createElement(\"span\", {\n key: index,\n className: classNames(colorTextCellPrefixCls, inactive && `${colorTextCellPrefixCls}-inactive`)\n }, c.color.toRgbString(), \" \", c.percent, \"%\");\n });\n }\n const hexString = color.toHexString().toUpperCase();\n const alpha = getColorAlpha(color);\n switch (format) {\n case 'rgb':\n return color.toRgbString();\n case 'hsb':\n return color.toHsbString();\n // case 'hex':\n default:\n return alpha < 100 ? `${hexString.slice(0, 7)},${alpha}%` : hexString;\n }\n }, [color, format, showText, activeIndex]);\n // ============================= Render =============================\n const containerNode = useMemo(() => color.cleared ? ( /*#__PURE__*/React.createElement(ColorClear, {\n prefixCls: prefixCls\n })) : ( /*#__PURE__*/React.createElement(ColorBlock, {\n prefixCls: prefixCls,\n color: color.toCssString()\n })), [color, prefixCls]);\n return /*#__PURE__*/React.createElement(\"div\", Object.assign({\n ref: ref,\n className: classNames(colorTriggerPrefixCls, className, {\n [`${colorTriggerPrefixCls}-active`]: open,\n [`${colorTriggerPrefixCls}-disabled`]: disabled\n })\n }, pickAttrs(rest)), containerNode, showText && /*#__PURE__*/React.createElement(\"div\", {\n className: colorTextPrefixCls\n }, desc));\n});\nexport default ColorTrigger;"],"mappings":"AAAA,YAAY;;AAEZ,IAAIA,MAAM,GAAG,IAAI,IAAI,IAAI,CAACA,MAAM,IAAI,UAAUC,CAAC,EAAEC,CAAC,EAAE;EAClD,IAAIC,CAAC,GAAG,CAAC,CAAC;EACV,KAAK,IAAIC,CAAC,IAAIH,CAAC,EAAE,IAAII,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACP,CAAC,EAAEG,CAAC,CAAC,IAAIF,CAAC,CAACO,OAAO,CAACL,CAAC,CAAC,GAAG,CAAC,EAAED,CAAC,CAACC,CAAC,CAAC,GAAGH,CAAC,CAACG,CAAC,CAAC;EAChG,IAAIH,CAAC,IAAI,IAAI,IAAI,OAAOI,MAAM,CAACK,qBAAqB,KAAK,UAAU,EAAE,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEP,CAAC,GAAGC,MAAM,CAACK,qBAAqB,CAACT,CAAC,CAAC,EAAEU,CAAC,GAAGP,CAAC,CAACQ,MAAM,EAAED,CAAC,EAAE,EAAE;IAC3I,IAAIT,CAAC,CAACO,OAAO,CAACL,CAAC,CAACO,CAAC,CAAC,CAAC,GAAG,CAAC,IAAIN,MAAM,CAACC,SAAS,CAACO,oBAAoB,CAACL,IAAI,CAACP,CAAC,EAAEG,CAAC,CAACO,CAAC,CAAC,CAAC,EAAER,CAAC,CAACC,CAAC,CAACO,CAAC,CAAC,CAAC,GAAGV,CAAC,CAACG,CAAC,CAACO,CAAC,CAAC,CAAC;EACnG;EACA,OAAOR,CAAC;AACV,CAAC;AACD,OAAOW,KAAK,IAAIC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAClD,SAASC,UAAU,QAAQ,4BAA4B;AACvD,OAAO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